mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
seriennummern lieferschein enter()
This commit is contained in:
parent
a907a9fa3f
commit
c486b241bd
@ -91424,7 +91424,7 @@
|
||||
},
|
||||
{
|
||||
"Field": "datum",
|
||||
"Type": "date",
|
||||
"Type": "datetime",
|
||||
"Collation": null,
|
||||
"Null": "NO",
|
||||
"Key": "",
|
||||
|
@ -17,148 +17,148 @@
|
||||
<div class="col-xs-14 col-md-6 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend>{|Lieferscheinpositionen|}</legend>
|
||||
[LIEFERSCHEINPOSITIONEN]
|
||||
<legend [LIEFERSCHEIN_HIDDEN]>{|Lieferscheinpositionen|}</legend>
|
||||
<legend [ARTIKEL_HIDDEN]>{|Seriennummern|}</legend>
|
||||
[POSITIONEN]
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-14 col-md-6 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<div class="row">
|
||||
<div class="row-height">
|
||||
<div class="col-xs-14 col-md-14 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend>{|Seriennummern erfassen [LEGEND]|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr [ARTIKEL_HIDDEN]>
|
||||
<td>
|
||||
{|Lagermenge|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" value="[ANZLAGER]" size="40" disabled />
|
||||
</td>
|
||||
</tr>
|
||||
<tr [ARTIKEL_HIDDEN]>
|
||||
<td>
|
||||
{|Seriennummern verfügbar|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" value="[ANZVORHANDEN]" size="40" disabled />
|
||||
</td>
|
||||
</tr>
|
||||
<tr [ARTIKEL_HIDDEN]>
|
||||
<td>
|
||||
{|Seriennummern fehlen|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" value="[ANZFEHLT]" size="40" disabled />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{|Seriennummer scannen|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="eingabescan" id="eingabescan" value="[EINGABESCAN]" size="40" autofocus />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{|Seriennummer wählen|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="eingabe" id="eingabe" value="[EINGABE]" size="40" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row-height">
|
||||
<div class="col-xs-14 col-md-14 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend>{|Seriennummern erfassen [LEGEND]|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr [ARTIKEL_HIDDEN]>
|
||||
<td>
|
||||
{|Lagermenge|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" value="[ANZLAGER]" size="40" disabled />
|
||||
</td>
|
||||
</tr>
|
||||
<tr [ARTIKEL_HIDDEN]>
|
||||
<td>
|
||||
{|Seriennummern verfügbar|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" value="[ANZVORHANDEN]" size="40" disabled />
|
||||
</td>
|
||||
</tr>
|
||||
<tr [LIEFERSCHEIN_HIDDEN]>
|
||||
<td>
|
||||
{|Menge auf Lieferschein|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" value="[ANZLIEFERSCHEIN]" size="40" disabled />
|
||||
</td>
|
||||
</tr>
|
||||
<tr [LIEFERSCHEIN_HIDDEN]>
|
||||
<td>
|
||||
{|Seriennummern zugeordnet|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" value="[ANZVORHANDEN]" size="40" disabled />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{|Seriennummern fehlen|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" value="[ANZFEHLT]" size="40" disabled />
|
||||
</td>
|
||||
</tr>
|
||||
<tr [ARTIKEL_HIDDEN] [EINGABE_HIDDEN]>
|
||||
<td>
|
||||
{|Seriennummer scannen|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="eingabescan" id="eingabescan" value="[EINGABESCAN]" size="40" autofocus />
|
||||
</td>
|
||||
</tr>
|
||||
<tr [LIEFERSCHEIN_HIDDEN] [EINGABE_HIDDEN]>
|
||||
<td>
|
||||
{|Seriennummer wählen|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="eingabe" id="eingabe" value="[EINGABE]" size="40" autofocus/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr [EINGABE_HIDDEN]>
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend>{|Seriennummernassistent|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr>
|
||||
<td>
|
||||
{|Letzte Seriennummer|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="muster" id="muster" value="[LETZTE]" size="40" disabled />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{|Präfix|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="praefix" id="praefix" value="[PRAEFIX]" size="40" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{|Start|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="start" id="start" value="[START]" size="40" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{|Postfix|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="postfix" id="postfix" value="[POSTFIX]" size="40" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{|Anzahl|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="anzahl" id="anzahl" value="[ANZAHL]" size="40" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row-height">
|
||||
<div class="col-xs-14 col-md-14 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
</fieldset>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr [EINGABE_HIDDEN]>
|
||||
<td [ARTIKEL_HIDDEN]>
|
||||
{|Letzte Seriennummer|}:
|
||||
</td>
|
||||
<td [LIEFERSCHEIN_HIDDEN]>
|
||||
{|Nächste Seriennummer|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="muster" id="muster" value="[LETZTE]" size="40" disabled />
|
||||
</td>
|
||||
</tr>
|
||||
<tr [EINGABE_HIDDEN]>
|
||||
<td>
|
||||
{|Präfix|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="praefix" id="praefix" value="[PRAEFIX]" size="40" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr [EINGABE_HIDDEN]>
|
||||
<td>
|
||||
{|Start|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="start" id="start" value="[START]" size="40" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr [EINGABE_HIDDEN]>
|
||||
<td>
|
||||
{|Postfix|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="postfix" id="postfix" value="[POSTFIX]" size="40" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr [EINGABE_HIDDEN]>
|
||||
<td>
|
||||
{|Anzahl|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="anzahl" id="anzahl" value="[ANZAHL]" size="40" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr [EINGABE_HIDDEN]>
|
||||
<td>
|
||||
<fieldset>
|
||||
<legend>{|Gewählte Seriennummern|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr>
|
||||
<td>
|
||||
{|Seriennummern|}:
|
||||
</td>
|
||||
<td>
|
||||
<textarea name="seriennummern" id="seriennummern" rows="20" style="width:100%;">[SERIENNUMMERN]</textarea>
|
||||
<i>Liste der Seriennummern, 1 pro Zeile</i>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr [EINGABE_HIDDEN]>
|
||||
<td>
|
||||
{|Seriennummern|}:
|
||||
</td>
|
||||
<td>
|
||||
<textarea name="seriennummern" id="seriennummern" rows="20" style="width:100%;">[SERIENNUMMERN]</textarea>
|
||||
<i>Liste der Seriennummern, 1 pro Zeile</i>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-14 col-md-2 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend>{|<!--Legend for this form area goes here>-->Aktionen|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<table width="100%" border="0" class="mkTableFormular" [EINGABE_HIDDEN]>
|
||||
<tr>
|
||||
<td>
|
||||
<button name="submit" value="hinzufuegen" class="ui-button-icon" style="width:100%;">Hinzufügen</button>
|
||||
@ -179,7 +179,7 @@
|
||||
<button name="submit" value="einlagern" class="ui-button-icon" style="width:100%;">Einlagern</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr [LIEFERSCHEIN_HIDDEN]>
|
||||
<td>
|
||||
<button name="submit" value="lieferscheinzuordnen" class="ui-button-icon" style="width:100%;">Zuordnen</button>
|
||||
</td>
|
||||
|
28
www/pages/content/seriennummern_lieferscheine_list.tpl
Normal file
28
www/pages/content/seriennummern_lieferscheine_list.tpl
Normal file
@ -0,0 +1,28 @@
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-1">[TABTEXT1]</a></li>
|
||||
</ul>
|
||||
<div class="filter-box filter-usersave">
|
||||
<div class="filter-block filter-inline">
|
||||
<div class="filter-title">{|Filter|}
|
||||
</div>
|
||||
<ul class="filter-list">
|
||||
<li class="filter-item">
|
||||
<label for="altelieferscheine" class="switch">
|
||||
<input type="checkbox" id="altelieferscheine" />
|
||||
<span class="slider round">
|
||||
</span>
|
||||
</label>
|
||||
<label for="altelieferscheine">
|
||||
{|Zzgl. alte Lieferscheine|}
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="tabs-1">
|
||||
[MESSAGE]
|
||||
[TAB1]
|
||||
[TAB1NEXT]
|
||||
</div>
|
||||
</div>
|
@ -21,6 +21,7 @@ class Seriennummern {
|
||||
$this->app->ActionHandler("lieferscheine_list", "seriennummern_lieferscheine_list");
|
||||
$this->app->ActionHandler("enter", "seriennummern_enter");
|
||||
$this->app->ActionHandler("delete", "seriennummern_delete");
|
||||
$this->app->ActionHandler("remove", "seriennummern_remove");
|
||||
$this->app->ActionHandler("minidetail", "seriennummern_minidetail");
|
||||
$this->app->DefaultActionHandler("list");
|
||||
$this->app->ActionHandlerListen($app);
|
||||
@ -34,13 +35,15 @@ class Seriennummern {
|
||||
switch ($name) {
|
||||
case "seriennummern_list":
|
||||
$allowed['seriennummern_list'] = array('list');
|
||||
$heading = array('Artikel-Nr.','Artikel', 'Seriennummer','Erfasst am','Eingelagert','Adresse','Lieferschein','Lieferdatum', 'Menü');
|
||||
$width = array('10%','20%','20%'); // Fill out manually later
|
||||
// $heading = array('Artikel-Nr.','Artikel', 'Seriennummer','Erfasst am','Eingelagert','Adresse','Lieferschein','Lieferdatum', 'Menü');
|
||||
$heading = array('Artikel-Nr.','Artikel', 'Seriennummer','Erfasst am','Eingelagert', 'Menü');
|
||||
$width = array('10%','20%','20%','10%','1%','1%'); // Fill out manually later
|
||||
|
||||
// columns that are aligned right (numbers etc)
|
||||
// $alignright = array(4,5,6,7,8);
|
||||
|
||||
$findcols = array('a.nummer', 'a.name_de', 's.seriennummer','s.datum','s.eingelagert','lh.adresse_name','lh.belegnr','lh.datum','s.id');
|
||||
// $findcols = array('a.nummer', 'a.name_de', 's.seriennummer','s.datum','s.eingelagert','lh.adresse_name','lh.belegnr','lh.datum','s.id');
|
||||
$findcols = array('a.nummer', 'a.name_de', 's.seriennummer','s.datum','s.eingelagert','s.id');
|
||||
$searchsql = array('a.nummer', 'a.name_de', 's.seriennummer');
|
||||
|
||||
$defaultorder = 1;
|
||||
@ -66,19 +69,30 @@ class Seriennummern {
|
||||
'</a>',
|
||||
);
|
||||
|
||||
$sql_columns = "
|
||||
/* $sql_columns = "
|
||||
s.id,
|
||||
CONCAT('<a href=\"index.php?module=artikel&action=edit&id=',a.id,'\">',a.nummer,'</a>') as nummer,
|
||||
a.name_de,
|
||||
s.seriennummer,
|
||||
".$app->erp->FormatDate("s.datum").",
|
||||
".$app->erp->FormatDateTime("s.datum").",
|
||||
if(s.eingelagert,'Ja','Nein'),
|
||||
lh.adresse_name,
|
||||
".$app->erp->ConcatSQL($lieferschein_link).",
|
||||
".$app->erp->FormatDate("lh.datum").",
|
||||
s.id
|
||||
";*/
|
||||
|
||||
$sql_columns = "
|
||||
s.id,
|
||||
CONCAT('<a href=\"index.php?module=artikel&action=edit&id=',a.id,'\">',a.nummer,'</a>') as nummer,
|
||||
a.name_de,
|
||||
s.seriennummer,
|
||||
".$app->erp->FormatDateTime("s.datum").",
|
||||
if(s.eingelagert,'Ja','Nein'),
|
||||
s.id
|
||||
";
|
||||
|
||||
|
||||
$sql_tables = "
|
||||
seriennummern s
|
||||
INNER JOIN
|
||||
@ -165,7 +179,7 @@ class Seriennummern {
|
||||
case "seriennummern_artikel_list":
|
||||
$allowed['seriennummern_artikel_list'] = array('list');
|
||||
$heading = array('Artikel-Nr.', 'Artikel', 'Lagermenge', 'Nummern verfügbar', 'Nummern ausgeliefert', 'Nummern gesamt', 'Menü','');
|
||||
$width = array('10%','20%'); // Fill out manually later
|
||||
$width = array('10%','90%','1%','1%','1%','1%','1%'); // Fill out manually later
|
||||
|
||||
// columns that are aligned right (numbers etc)
|
||||
// $alignright = array(4,5,6,7,8);
|
||||
@ -243,7 +257,7 @@ class Seriennummern {
|
||||
case "seriennummern_lieferscheine_list":
|
||||
$allowed['seriennummern_artikel_list'] = array('list');
|
||||
$heading = array('Lieferschein', 'Vom', 'Adresse', 'Menge Artikel', 'Nummern zugeordnet', 'Nummern fehlen', 'Menü','');
|
||||
$width = array('10%','10%','20%'); // Fill out manually later
|
||||
$width = array('10%','10%','20%','1%','1%','1%','1%','1%','1%'); // Fill out manually later
|
||||
|
||||
// columns that are aligned right (numbers etc)
|
||||
$alignright = array(4,5,6,7);
|
||||
@ -262,10 +276,10 @@ class Seriennummern {
|
||||
//$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=seriennummern&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a> <a href=\"#\" onclick=DeleteDialog(\"index.php?module=seriennummern&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
|
||||
|
||||
$menu_link = array(
|
||||
'<a href="index.php?module=seriennummern&action=enter&artikel=',
|
||||
['sql' => 'a.id'],
|
||||
'<a href="index.php?module=seriennummern&action=enter&lieferschein=',
|
||||
['sql' => 'l.id'],
|
||||
'">',
|
||||
'<img src="./themes/'.$app->Conf->WFconf['defaulttheme'].'/images/add.png" title="Seriennummern erfassen" border="0">',
|
||||
'<img src="./themes/'.$app->Conf->WFconf['defaulttheme'].'/images/edit.svg" title="Seriennummern erfassen" border="0">',
|
||||
'</a>',
|
||||
);
|
||||
|
||||
@ -284,7 +298,7 @@ class Seriennummern {
|
||||
adr.name,
|
||||
".$app->erp->FormatMengeFuerFormular("menge").",
|
||||
SUM(if(slp.id IS NULL,0,1)),
|
||||
".$app->erp->FormatMengeFuerFormular("menge-SUM(if(slp.id IS NULL,0,1))").",
|
||||
".$app->erp->FormatMengeFuerFormular("if(menge>SUM(if(slp.id IS NULL,0,1)),menge-SUM(if(slp.id IS NULL,0,1)),0) ").",
|
||||
".$app->erp->ConcatSQL($menu_link).",
|
||||
l.id
|
||||
FROM
|
||||
@ -299,7 +313,36 @@ class Seriennummern {
|
||||
adr.id = l.adresse
|
||||
";
|
||||
|
||||
$where = "(a.seriennummern <> 'keine') AND (l.datum >= (SELECT MIN(datum) FROM seriennummern WHERE artikel = a.id))";
|
||||
$where = "(a.seriennummern <> 'keine')";
|
||||
|
||||
// Toggle filters
|
||||
$app->Tpl->Add('JQUERYREADY', "$('#altelieferscheine').click( function() { fnFilterColumn1( 0 ); } );");
|
||||
|
||||
for ($r = 1;$r <= 1;$r++) {
|
||||
$app->Tpl->Add('JAVASCRIPT', '
|
||||
function fnFilterColumn' . $r . ' ( i )
|
||||
{
|
||||
if(oMoreData' . $r . $name . '==1)
|
||||
oMoreData' . $r . $name . ' = 0;
|
||||
else
|
||||
oMoreData' . $r . $name . ' = 1;
|
||||
|
||||
$(\'#' . $name . '\').dataTable().fnFilter(
|
||||
\'\',
|
||||
i,
|
||||
0,0
|
||||
);
|
||||
}
|
||||
');
|
||||
}
|
||||
|
||||
$more_data1 = $app->Secure->GetGET("more_data1");
|
||||
if ($more_data1 == 1) {
|
||||
} else {
|
||||
$where .= " AND (l.datum >= (SELECT DATE(MIN(datum)) FROM seriennummern WHERE artikel = a.id))";
|
||||
}
|
||||
|
||||
|
||||
$count = "SELECT COUNT(DISTINCT lp.lieferschein) FROM
|
||||
lieferschein_position lp
|
||||
LEFT JOIN seriennummern_lieferschein_position slp
|
||||
@ -314,7 +357,7 @@ class Seriennummern {
|
||||
break;
|
||||
case "seriennummern_lieferschein_positionen":
|
||||
$allowed['seriennummern_artikel_list'] = array('list');
|
||||
$heading = array('','','Position', 'Artikel-Nr.', 'Artikel', 'Menge', 'Nummern zugeordnet', 'Nummern fehlen', 'Menü','');
|
||||
$heading = array('','','Position', 'Artikel-Nr.', 'Artikel', 'Menge', 'Nummern zugeordnet', 'Nummern fehlen', 'Menü');
|
||||
$width = array('1%','1%','10%','10%','20%'); // Fill out manually later
|
||||
|
||||
$lieferschein_id = $app->User->GetParameter('seriennummern_lieferschein_id');
|
||||
@ -337,15 +380,7 @@ class Seriennummern {
|
||||
|
||||
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',lp.id,'\" />') AS `auswahl`";
|
||||
|
||||
//$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=seriennummern&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a> <a href=\"#\" onclick=DeleteDialog(\"index.php?module=seriennummern&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
|
||||
|
||||
$menu_link = array(
|
||||
'<a href="index.php?module=seriennummern&action=enter&artikel=',
|
||||
['sql' => 'a.id'],
|
||||
'">',
|
||||
'<img src="./themes/'.$app->Conf->WFconf['defaulttheme'].'/images/add.png" title="Seriennummern erfassen" border="0">',
|
||||
'</a>',
|
||||
);
|
||||
$menu = "<a href=\"#\" onclick=DeleteDialog(\"index.php?module=seriennummern&action=remove&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>";
|
||||
|
||||
$lieferschein_link = array(
|
||||
'<a href="index.php?module=lieferschein&action=edit&id=',
|
||||
@ -364,8 +399,7 @@ class Seriennummern {
|
||||
".$app->erp->FormatMengeFuerFormular("menge").",
|
||||
SUM(if(slp.id IS NULL,0,1)),
|
||||
".$app->erp->FormatMengeFuerFormular("menge-SUM(if(slp.id IS NULL,0,1))").",
|
||||
".$app->erp->ConcatSQL($menu_link).",
|
||||
l.id
|
||||
lp.id
|
||||
FROM
|
||||
lieferschein_position lp
|
||||
LEFT JOIN seriennummern_lieferschein_position slp
|
||||
@ -440,21 +474,21 @@ class Seriennummern {
|
||||
|
||||
$check_delivery_notes = $this->seriennummern_check_delivery_notes($lieferschein_id);
|
||||
if (!empty($check_delivery_notes)) {
|
||||
$lieferschein_minus_id_links = array();
|
||||
$lieferschein_plus_id_links = array();
|
||||
foreach ($check_delivery_notes as $lieferschein_id) {
|
||||
if ($lieferschein_id['anzahl_nummern'] < $lieferschein_id['menge']) {
|
||||
$lieferschein_minus_id_links[] = '<a href="index.php?module=seriennummern&action=enter&lieferschein='.$lieferschein_id['id'].'">'.$lieferschein_id['nummer'].'</a>';
|
||||
$lieferschein_minus_links = array();
|
||||
$lieferschein_plus_links = array();
|
||||
foreach ($check_delivery_notes as $check_delivery_note) {
|
||||
if ($check_delivery_note['anzahl_nummern'] < $check_delivery_note['menge_lieferschein']) {
|
||||
$lieferschein_minus_links[] = '<a href="index.php?module=seriennummern&action=enter&lieferschein='.$check_delivery_note['lieferschein'].'">'.$check_delivery_note['belegnr'].'</a>';
|
||||
}
|
||||
else if ($lieferschein_id['anzahl_nummern'] > $lieferschein_id['menge']) {
|
||||
$lieferschein_plus_id_links[] = '<a href="index.php?module=seriennummern&action=nummern_list&lieferschein='.$lieferschein_id['id'].'">'.$lieferschein_id['nummer'].'</a>';
|
||||
else if ($check_delivery_note['anzahl_nummern'] > $check_delivery_note['menge']) {
|
||||
$lieferschein_plus_links[] = '<a href="index.php?module=seriennummern&action=nummern_list&lieferschein='.$check_delivery_note['lieferschein'].'">'.$check_delivery_note['belegnr'].'</a>';
|
||||
}
|
||||
}
|
||||
if (!empty($lieferschein_minus_id_links)) {
|
||||
$this->app->YUI->Message('warning','Seriennummern fehlen für Lieferschein: '.implode(', ',$lieferschein_minus_id_links));
|
||||
if (!empty($lieferschein_minus_links)) {
|
||||
$this->app->YUI->Message('warning','Seriennummern fehlen für Lieferschein: '.implode(', ',$lieferschein_minus_links));
|
||||
}
|
||||
if (!empty($lieferschein_plus_id_links)) {
|
||||
$this->app->YUI->Message('warning','Seriennummern Überschuss für Lieferschein: '.implode(', ',$lieferschein_plus_id_links));
|
||||
if (!empty($lieferschein_plus_links)) {
|
||||
$this->app->YUI->Message('warning','Seriennummern Überschuss für Lieferschein: '.implode(', ',$lieferschein_plus_links));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -526,20 +560,36 @@ class Seriennummern {
|
||||
|
||||
$this->app->YUI->TableSearch('TAB1', 'seriennummern_lieferscheine_list', "show", "", "", basename(__FILE__), __CLASS__);
|
||||
|
||||
$this->app->Tpl->Parse('PAGE', "seriennummern_list.tpl");
|
||||
$this->app->Tpl->Parse('PAGE', "seriennummern_lieferscheine_list.tpl");
|
||||
}
|
||||
|
||||
public function seriennummern_delete() {
|
||||
$id = (int) $this->app->Secure->GetGET('id');
|
||||
|
||||
if (!$this->app->DB->Select("SELECT id FROM `seriennummern_lieferschein_position` WHERE `seriennummer` = '{$id}'")) {
|
||||
$this->app->DB->Delete("DELETE FROM `seriennummern` WHERE `id` = '{$id}'");
|
||||
$this->app->Tpl->addMessage('error', 'Der Eintrag wurde gelöscht');
|
||||
} else {
|
||||
$this->app->Tpl->addMessage('error', 'Der Eintrag kann nicht gelöscht werden da eine Lieferscheinzuordnung existiert!');
|
||||
if ($id) {
|
||||
if (!$this->app->DB->Select("SELECT id FROM `seriennummern_lieferschein_position` WHERE `seriennummer` = '{$id}'")) {
|
||||
$this->app->DB->Delete("DELETE FROM `seriennummern` WHERE `id` = '{$id}'");
|
||||
$this->app->Tpl->addMessage('error', 'Der Eintrag wurde gelöscht');
|
||||
} else {
|
||||
$this->app->Tpl->addMessage('error', 'Der Eintrag kann nicht gelöscht werden da eine Lieferscheinzuordnung existiert!');
|
||||
}
|
||||
$this->seriennummern_nummern_list();
|
||||
}
|
||||
$this->seriennummern_nummern_list();
|
||||
|
||||
}
|
||||
|
||||
public function seriennummern_remove() {
|
||||
$id = (int) $this->app->Secure->GetGET('id');
|
||||
|
||||
if ($id) {
|
||||
if (!$this->app->DB->Delete("DELETE FROM `seriennummern_lieferschein_position` WHERE `lieferschein_position` = '{$id}'")) {
|
||||
$this->app->Tpl->addMessage('error', 'Der Eintrag wurde gelöscht');
|
||||
}
|
||||
$lieferschein = $this->app->DB->Select("SELECT lieferschein FROM lieferschein_position WHERE id = '".$id."'");
|
||||
$this->app->Location->execute("index.php?module=seriennummern&action=enter&lieferschein=$lieferschein&msg=$msg");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function seriennummern_enter() {
|
||||
|
||||
@ -573,6 +623,18 @@ class Seriennummern {
|
||||
$seriennummern = explode('\n',str_replace(['\r'],'',$seriennummern_text));
|
||||
|
||||
switch ($submit) {
|
||||
case 'assistent':
|
||||
$praefix = $this->app->Secure->GetPOST('praefix');
|
||||
$start = $this->app->Secure->GetPOST('start');
|
||||
$postfix = $this->app->Secure->GetPOST('postfix');
|
||||
$anzahl = (int) $this->app->Secure->GetPOST('anzahl');
|
||||
|
||||
while ($anzahl) {
|
||||
$seriennummern[] = $praefix.$start.$postfix;
|
||||
$anzahl--;
|
||||
$start++;
|
||||
}
|
||||
break;
|
||||
case 'hinzufuegen':
|
||||
$eingabescan = $this->app->Secure->GetPOST('eingabescan');
|
||||
$eingabe = $this->app->Secure->GetPOST('eingabe');
|
||||
@ -630,24 +692,87 @@ class Seriennummern {
|
||||
}
|
||||
$seriennummern = array_merge($seriennummern_not_written, $seriennummern_already_exist, $seriennummern_old_not_allowed);
|
||||
break;
|
||||
case 'assistent':
|
||||
$praefix = $this->app->Secure->GetPOST('praefix');
|
||||
$start = $this->app->Secure->GetPOST('start');
|
||||
$postfix = $this->app->Secure->GetPOST('postfix');
|
||||
$anzahl = (int) $this->app->Secure->GetPOST('anzahl');
|
||||
case 'lieferscheinzuordnen':
|
||||
|
||||
while ($anzahl) {
|
||||
$seriennummern[] = $praefix.$start.$postfix;
|
||||
$anzahl--;
|
||||
$start++;
|
||||
if (empty($lieferschein_id)) {
|
||||
break;
|
||||
}
|
||||
|
||||
$auswahl = $this->app->Secure->GetPOST('auswahl');
|
||||
if (!empty($auswahl)) {
|
||||
if (count($auswahl) > 1) {
|
||||
$this->app->Tpl->addMessage('error', 'Bitte eine oder keine Position anklicken');
|
||||
break;
|
||||
}
|
||||
$lieferschein_position = $auswahl[0];
|
||||
$sql_auswahl = " AND artikel IN (SELECT artikel FROM lieferschein_position WHERE id = '".$lieferschein_position."'";
|
||||
}
|
||||
|
||||
$seriennummern_not_written = array();
|
||||
$seriennummern_dont_exist = array();
|
||||
$seriennummern_ambigious = array();
|
||||
|
||||
foreach ($seriennummern as $seriennummer) {
|
||||
|
||||
$seriennummer = trim($seriennummer);
|
||||
|
||||
if (empty($seriennummer)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$sql = "SELECT id, artikel FROM seriennummern WHERE eingelagert = 1 AND seriennummer = '".$this->app->DB->real_escape_string($seriennummer)."'".$sql_auswahl;
|
||||
|
||||
$check_existing = $this->app->DB->SelectArr($sql);
|
||||
|
||||
if (empty($check_existing)) {
|
||||
$seriennummern_dont_exist[] = $seriennummer;
|
||||
} else if (count($check_existing) > 1) {
|
||||
$seriennummern_ambigious[] = $seriennummer;
|
||||
} else {
|
||||
|
||||
$check_lieferschein = $this->seriennummern_check_delivery_notes($lieferschein_id, ignore_date: true);
|
||||
$written = false;
|
||||
|
||||
foreach ($check_lieferschein as $position) {
|
||||
$menge_offen = $position['menge_lieferschein']-$position['menge_nummern'];
|
||||
|
||||
if ($menge_offen > 0) {
|
||||
if (empty($lieferschein_position)) {
|
||||
$lieferschein_position = $position['lieferschein_position'];
|
||||
}
|
||||
if ($lieferschein_position == $position['lieferschein_position']) {
|
||||
$sql = "INSERT INTO seriennummern_lieferschein_position (lieferschein_position, seriennummer) VALUES ('".$lieferschein_position."','".$check_existing[0]['id']."') ";
|
||||
|
||||
$this->app->DB->Insert($sql);
|
||||
$written = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$written) {
|
||||
$seriennummern_not_written[] = $seriennummer;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (!empty($seriennummern_dont_exist)) {
|
||||
$this->app->Tpl->addMessage('error', 'Seriennummern existieren nicht: '.implode(', ',$seriennummern_dont_exist));
|
||||
}
|
||||
if (!empty($seriennummern_ambigious)) {
|
||||
$this->app->Tpl->addMessage('error', 'Seriennummern nicht eindeutig: '.implode(', ',$seriennummern_ambigious));
|
||||
}
|
||||
$seriennummern = array_merge($seriennummern_not_written, $seriennummern_ambigious, $seriennummern_dont_exist);
|
||||
|
||||
break;
|
||||
}
|
||||
$seriennummern = array_unique($seriennummern);
|
||||
|
||||
$complete = false;
|
||||
|
||||
switch ($task) {
|
||||
case 'artikel':
|
||||
$this->app->Tpl->Set('LIEFERSCHEIN_HIDDEN', "hidden=\"true\"");
|
||||
$check_seriennummern = $this->seriennummern_check_serials($artikel_id);
|
||||
$check_seriennummern = $check_seriennummern[0];
|
||||
|
||||
@ -676,13 +801,38 @@ class Seriennummern {
|
||||
$this->app->Tpl->Set('ANZLAGER', $check_seriennummern['menge_auf_lager']);
|
||||
$this->app->Tpl->Set('ANZVORHANDEN', $check_seriennummern['menge_nummern']);
|
||||
$this->app->Tpl->Set('ANZFEHLT', $anzahl_fehlt);
|
||||
$this->app->Tpl->Set('SERIENNUMMERN', implode("\n",$seriennummern));
|
||||
$this->app->Tpl->Set('SERIENNUMMERN', implode("\n",$seriennummern));
|
||||
|
||||
$artikel_id = $this->app->Secure->GetGET('artikel');
|
||||
$this->app->User->SetParameter('seriennummern_artikel_id', $artikel_id);
|
||||
$this->app->YUI->TableSearch('POSITIONEN', 'seriennummern_list', "show", "", "", basename(__FILE__), __CLASS__);
|
||||
|
||||
break;
|
||||
case 'lieferschein':
|
||||
$this->app->erp->MenuEintrag("index.php?module=seriennummern&action=lieferscheine_list", "Zurück");
|
||||
$this->app->Tpl->Set('ARTIKEL_HIDDEN', "hidden");
|
||||
$this->app->Tpl->Set('LIEFERSCHEINNUMMER', '<a href="index.php?module=lieferschein&action=edit&id='.$lieferschein_id.'">'.$lieferschein['belegnr'].'</a>');
|
||||
|
||||
$check_lieferschein = $this->seriennummern_check_delivery_notes($lieferschein_id, ignore_date: true);
|
||||
|
||||
if (empty($check_lieferschein)) {
|
||||
$this->app->Tpl->AddMessage('success', 'Seriennummern vollständig.');
|
||||
$check_lieferschein = $this->seriennummern_check_delivery_notes($lieferschein_id, ignore_date: true, only_missing: false);
|
||||
$this->app->Tpl->Set('EINGABE_HIDDEN', 'hidden');
|
||||
}
|
||||
|
||||
$menge_lieferschein = array_sum(array_column($check_lieferschein,'menge_lieferschein'));
|
||||
$menge_nummern = array_sum(array_column($check_lieferschein,'menge_nummern'));
|
||||
$anzahl_fehlt = $menge_lieferschein-$menge_nummern;
|
||||
|
||||
if ($anzahl_fehlt < 0) {
|
||||
$anzahl_fehlt = 0;
|
||||
}
|
||||
|
||||
$this->app->Tpl->Set('ANZLIEFERSCHEIN', $menge_lieferschein);
|
||||
$this->app->Tpl->Set('ANZVORHANDEN', $menge_nummern);
|
||||
$this->app->Tpl->Set('ANZFEHLT', $anzahl_fehlt);
|
||||
|
||||
$artikel_lieferschein = $this->app->DB->SelectArr("SELECT artikel FROM lieferschein_position WHERE lieferschein = '".$lieferschein_id."'");
|
||||
|
||||
$sql = "
|
||||
@ -693,7 +843,7 @@ class Seriennummern {
|
||||
LEFT JOIN
|
||||
seriennummern_lieferschein_position slp ON slp.seriennummer = s.id
|
||||
WHERE
|
||||
s.artikel IN ('".implode("','",array_column($artikel_lieferschein,'artikel'))."')
|
||||
s.artikel = '".$check_lieferschein[0]['artikel']."'
|
||||
AND s.eingelagert = 1
|
||||
AND slp.id IS NULL
|
||||
ORDER BY s.id ASC
|
||||
@ -708,7 +858,14 @@ class Seriennummern {
|
||||
$this->app->Tpl->Set('START', $matches[2]);
|
||||
$this->app->Tpl->Set('POSTFIX', $matches[3]);
|
||||
|
||||
$this->app->YUI->TableSearch('LIEFERSCHEINPOSITIONEN', 'seriennummern_lieferschein_positionen', "show", "", "", basename(__FILE__), __CLASS__);
|
||||
$fehlt = $check_lieferschein[0]['menge_lieferschein']-$check_lieferschein[0]['menge_nummern'];
|
||||
if ($fehlt < 0) {
|
||||
$fehlt = 0;
|
||||
}
|
||||
|
||||
$this->app->Tpl->Set('ANZAHL', $fehlt);
|
||||
|
||||
$this->app->YUI->TableSearch('POSITIONEN', 'seriennummern_lieferschein_positionen', "show", "", "", basename(__FILE__), __CLASS__);
|
||||
$this->app->YUI->AutoComplete("eingabe", "seriennummerverfuegbar",0,"&lieferschein=$lieferschein_id");
|
||||
|
||||
$this->app->Tpl->Set('SERIENNUMMERN', implode("\n",$seriennummern));
|
||||
@ -774,37 +931,54 @@ class Seriennummern {
|
||||
* Check if all delivery notes have serials
|
||||
* Return array of delivery note positions and head information
|
||||
*/
|
||||
public function seriennummern_check_delivery_notes($lieferschein_id = null) : array {
|
||||
public function seriennummern_check_delivery_notes($lieferschein_id = null, $ignore_date = false, $only_missing = true) : array {
|
||||
$sql = "
|
||||
SELECT SQL_CALC_FOUND_ROWS
|
||||
l.id,
|
||||
l.belegnr nummer,
|
||||
menge,
|
||||
SUM(IF(slp.id IS NULL, 0, 1)) menge_nummern
|
||||
l.id lieferschein,
|
||||
l.belegnr belegnr,
|
||||
lp.id lieferschein_position,
|
||||
a.id artikel,
|
||||
a.nummer artikel_nummer,
|
||||
a.name_de,
|
||||
".$this->app->erp->FormatMenge('SUM(menge)')." menge_lieferschein,
|
||||
SUM(COALESCE(menge_nummern,0)) menge_nummern
|
||||
FROM
|
||||
lieferschein_position lp
|
||||
LEFT JOIN seriennummern_lieferschein_position slp ON
|
||||
slp.lieferschein_position = lp.id
|
||||
lieferschein_position lp
|
||||
INNER JOIN lieferschein l ON
|
||||
l.id = lp.lieferschein
|
||||
INNER JOIN artikel a ON
|
||||
a.id = lp.artikel
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
lieferschein_position,
|
||||
COUNT(*) menge_nummern
|
||||
FROM
|
||||
seriennummern_lieferschein_position slp
|
||||
GROUP BY
|
||||
slp.lieferschein_position
|
||||
) slp ON slp.lieferschein_position = lp.id
|
||||
WHERE
|
||||
(a.seriennummern <> 'keine') AND(
|
||||
(a.seriennummern <> 'keine')
|
||||
AND (
|
||||
l.datum >=(
|
||||
SELECT
|
||||
MIN(datum)
|
||||
FROM
|
||||
seriennummern
|
||||
WHERE
|
||||
artikel = a.id
|
||||
)
|
||||
) AND (l.id = '".$lieferschein_id."' OR '".$lieferschein_id."' = '')
|
||||
SELECT
|
||||
DATE(MIN(datum))
|
||||
FROM
|
||||
seriennummern
|
||||
WHERE
|
||||
artikel = a.id
|
||||
) OR ('".$ignore_date."' <> '')
|
||||
)
|
||||
AND (l.id = '".$lieferschein_id."' OR '".$lieferschein_id."' = '')
|
||||
GROUP BY
|
||||
l.id
|
||||
HAVING menge > menge_nummern
|
||||
l.id,
|
||||
lp.id
|
||||
";
|
||||
|
||||
|
||||
if ($only_missing) {
|
||||
$sql .= " HAVING menge_lieferschein > menge_nummern";
|
||||
}
|
||||
|
||||
$result = $this->app->DB->SelectArr($sql);
|
||||
return(empty($result)?array():$result);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user