seriennummern zwischenstand

This commit is contained in:
OpenXE 2024-08-04 22:05:35 +02:00
parent 00d10dd7cc
commit a907a9fa3f
4 changed files with 571 additions and 175 deletions

View File

@ -2610,7 +2610,29 @@ select a.kundennummer, (SELECT name FROM adresse a2 WHERE a2.kundennummer = a.ku
break;
case "seriennummerverfuegbar":
$artikel = (int)$this->app->Secure->GetGET('artikel');
$arr = $this->app->DB->SelectArr("SELECT seriennummer FROM seriennummern WHERE lieferschein = 0 AND seriennummer LIKE '%$term%' AND artikel = '$artikel' LIMIT 20");
$lieferschein = (int)$this->app->Secure->GetGET('lieferschein');
$sql = "
SELECT DISTINCT
s.seriennummer
FROM
seriennummern s
INNER JOIN
lieferschein_position lp ON lp.artikel = s.artikel
LEFT JOIN
seriennummern_lieferschein_position slp ON slp.seriennummer = s.id
WHERE
s.eingelagert = 1
AND slp.id IS NULL
AND s.seriennummer LIKE '%$term%'
AND (s.artikel = '$artikel' OR '$artikel' = '0')
LIMIT 20
";
//echo($sql);
$arr = $this->app->DB->SelectArr($sql);
$carr = !empty($arr)?count($arr):0;
for($i = 0; $i < $carr; $i++) {
$newarr[] = $arr[$i]['seriennummer'];

View File

@ -17,30 +17,42 @@
<div class="col-xs-14 col-md-6 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Seriennummern erfassen Artikel [ARTIKELNUMMER] [ARTIKEL]|}</legend>
<legend>{|Lieferscheinpositionen|}</legend>
[LIEFERSCHEINPOSITIONEN]
</fieldset>
</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>
<tr [ARTIKEL_HIDDEN]>
<td>
{|Lagermenge|}:
</td>
<td>
<input type="text" value="[ANZLAGER]" size="40" disabled>
<input type="text" value="[ANZLAGER]" size="40" disabled />
</td>
</tr>
<tr>
<tr [ARTIKEL_HIDDEN]>
<td>
{|Seriennummern verf&uuml;gbar|}:
</td>
<td>
<input type="text" value="[ANZVORHANDEN]" size="40" disabled>
<input type="text" value="[ANZVORHANDEN]" size="40" disabled />
</td>
</tr>
<tr>
<tr [ARTIKEL_HIDDEN]>
<td>
{|Seriennummern fehlen|}:
</td>
<td>
<input type="text" value="[ANZFEHLT]" size="40" disabled>
<input type="text" value="[ANZFEHLT]" size="40" disabled />
</td>
</tr>
<tr>
@ -48,75 +60,15 @@
{|Seriennummer scannen|}:
</td>
<td>
<input type="text" name="eingabeneu" id="eingabeneu" value="[EINGABENEU]" size="40" autofocus>
</td>
</tr>
</table>
</fieldset>
</div>
</div>
<div class="col-xs-14 col-md-6 col-md-height">
<div class="inside inside-full-height">
<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>
<input type="text" name="eingabescan" id="eingabescan" value="[EINGABESCAN]" size="40" autofocus />
</td>
</tr>
<tr>
<td>
{|Pr&auml;fix|}:
{|Seriennummer w&auml;hlen|}:
</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 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">
<tr>
<td>
<button name="submit" value="hinzufuegen" class="ui-button-icon" style="width:100%;">Hinzuf&uuml;gen</button>
</td>
</tr>
<tr>
<td>
<button name="submit" value="assistent" class="ui-button-icon" style="width:100%;">Assistent ausf&uuml;hren</button>
<input type="text" name="eingabe" id="eingabe" value="[EINGABE]" size="40" />
</td>
</tr>
</table>
@ -127,7 +79,60 @@
</div>
<div class="row">
<div class="row-height">
<div class="col-xs-14 col-md-12 col-md-height">
<div class="col-xs-14 col-md-14 col-md-height">
<div class="inside inside-full-height">
<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&auml;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>
<legend>{|Gew&auml;hlte Seriennummern|}</legend>
@ -145,6 +150,10 @@
</fieldset>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xs-14 col-md-2 col-md-height">
<div class="inside inside-full-height">
<fieldset>
@ -152,12 +161,27 @@
<table width="100%" border="0" class="mkTableFormular">
<tr>
<td>
<input type="checkbox" name="allowold" id="allowold" value="1" [PRIO] size="20">{|Ausgelieferte erlauben|}
<button name="submit" value="hinzufuegen" class="ui-button-icon" style="width:100%;">Hinzuf&uuml;gen</button>
</td>
</tr>
<tr>
<td>
<button name="submit" value="speichern" class="ui-button-icon" style="width:100%;">Speichern</button>
<button name="submit" value="assistent" class="ui-button-icon" style="width:100%;">Assistent ausf&uuml;hren</button>
</td>
</tr>
<tr [ARTIKEL_HIDDEN]>
<td>
<input type="checkbox" name="allowold" id="allowold" value="1" [PRIO] size="20">{|Ausgelieferte erlauben|}
</td>
</tr>
<tr [ARTIKEL_HIDDEN]>
<td>
<button name="submit" value="einlagern" class="ui-button-icon" style="width:100%;">Einlagern</button>
</td>
</tr>
<tr>
<td>
<button name="submit" value="lieferscheinzuordnen" class="ui-button-icon" style="width:100%;">Zuordnen</button>
</td>
</tr>
</table>

View File

@ -0,0 +1,197 @@
<div id="tabs">
<ul>
<li><a href="#tabs-1"></a></li>
</ul>
<!-- Example for multiple tabs
<ul hidden">
<li><a href="#tabs-1">First Tab</a></li>
<li><a href="#tabs-2">Second Tab</a></li>
</ul>
-->
<div id="tabs-1">
[MESSAGE]
<form action="" method="post">
[FORMHANDLEREVENT]
<div class="row">
<div class="row-height">
<div class="col-xs-14 col-md-6 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Seriennummern erfassen [LEGEND]|}</legend>
<table width="100%" border="0" class="mkTableFormular">
<tr>
<td>
{|Lagermenge|}:
</td>
<td>
<input type="text" value="[ANZLAGER]" size="40" disabled>
</td>
</tr>
<tr>
<td>
{|Seriennummern verf&uuml;gbar|}:
</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>
<td>
{|Seriennummer scannen|}:
</td>
<td>
<input type="text" name="eingabeneu" id="eingabeneu" value="[EINGABENEU]" size="40" autofocus>
</td>
</tr>
<tr>
<td>
{|Seriennummer w&auml;hlen|}:
</td>
<td>
<input type="text" name="eingabe" id="eingabe" value="[EINGABE]" size="40">
</td>
</tr>
</table>
</fieldset>
</div>
</div>
<div class="col-xs-14 col-md-6 col-md-height">
<div class="inside inside-full-height">
<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&auml;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 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">
<tr>
<td>
<button name="submit" value="hinzufuegen" class="ui-button-icon" style="width:100%;">Hinzuf&uuml;gen</button>
</td>
</tr>
<tr>
<td>
<button name="submit" value="assistent" class="ui-button-icon" style="width:100%;">Assistent ausf&uuml;hren</button>
</td>
</tr>
</table>
</fieldset>
</div>
</div>
</div>
</div>
<div class="row">
<div class="row-height">
<div class="col-xs-14 col-md-12 col-md-height">
<div class="inside inside-full-height">
<fieldset>
<legend>{|Gew&auml;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 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">
<tr>
<td>
<input type="checkbox" name="allowold" id="allowold" value="1" [PRIO] size="20">{|Ausgelieferte erlauben|}
</td>
</tr>
<tr>
<td>
<button name="submit" value="speichern" class="ui-button-icon" style="width:100%;">Speichern</button>
</td>
</tr>
<tr>
<td>
<button name="submit" value="lieferscheinzuordnen" class="ui-button-icon" style="width:100%;">Zuordnen</button>
</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>
<legend>{|Lieferscheinpositionen|}</legend>
[LIEFERSCHEINPOSITIONEN]
</fieldset>
</div>
</div>
</div>
</div>
</form>
</div>
</div>

View File

@ -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("minidetail", "seriennummern_minidetail");
$this->app->DefaultActionHandler("list");
$this->app->ActionHandlerListen($app);
}
@ -310,6 +311,88 @@ class Seriennummern {
"." WHERE ".$where;
$groupby = "GROUP BY l.id";
break;
case "seriennummern_lieferschein_positionen":
$allowed['seriennummern_artikel_list'] = array('list');
$heading = array('','','Position', 'Artikel-Nr.', 'Artikel', 'Menge', 'Nummern zugeordnet', 'Nummern fehlen', 'Men&uuml;','');
$width = array('1%','1%','10%','10%','20%'); // Fill out manually later
$lieferschein_id = $app->User->GetParameter('seriennummern_lieferschein_id');
// columns that are aligned right (numbers etc)
$alignright = array(6,7,8,9);
$findcols = array('lp.id','lp.id','lp.sort','a.nummer', 'a.name_de', 'null', 'null', 'null', 'null', 'null', 'null');
$searchsql = array('l.belegnr');
$moreinfo = true; // Allow drop down details
// $moreinfoaction = "lieferschein"; // specify suffix for minidetail-URL to allow different minidetails
$menucol = 1; // Set id col for moredata/menu
$defaultorder = 1;
$defaultorderdesc = 0;
$aligncenter = array();
$numbercols = array();
$sumcol = array();
$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>&nbsp;<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>',
);
$lieferschein_link = array(
'<a href="index.php?module=lieferschein&action=edit&id=',
['sql' => 'l.id'],
'">',
['sql' => 'l.belegnr'],
'</a>',
);
$sql = "SELECT SQL_CALC_FOUND_ROWS
lp.id,
$dropnbox,
lp.sort,
a.nummer,
a.name_de,
".$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
FROM
lieferschein_position lp
LEFT JOIN seriennummern_lieferschein_position slp
ON slp.lieferschein_position = lp.id
INNER JOIN lieferschein l ON
l.id = lp.lieferschein
INNER JOIN artikel a ON
a.id = lp.artikel
INNER JOIN adresse adr ON
adr.id = l.adresse
";
$where = "(a.seriennummern <> 'keine') AND (l.id = '".$lieferschein_id."')";
$count = "SELECT COUNT(DISTINCT lp.lieferschein) FROM
lieferschein_position lp
LEFT JOIN seriennummern_lieferschein_position slp
ON slp.lieferschein_position = lp.id
INNER JOIN lieferschein l ON
l.id = lp.lieferschein
INNER JOIN artikel a ON
a.id = lp.artikel
"." WHERE ".$where;
$groupby = "GROUP BY lp.id";
// echo($sql." WHERE ".$where." ".$groupby);
break;
}
@ -461,29 +544,46 @@ class Seriennummern {
function seriennummern_enter() {
$this->app->erp->MenuEintrag("index.php?module=seriennummern&action=list", "Zur&uuml;ck zur &Uuml;bersicht");
$task = "";
$artikel_id = (int) $this->app->Secure->GetGET('artikel');
$lieferschein_id = (int) $this->app->Secure->GetGET('lieferschein');
if (!empty($artikel_id)) {
$artikel = $this->app->DB->SelectRow("SELECT name_de, nummer FROM artikel WHERE id ='".$artikel_id."'");
$this->app->Tpl->SetText('KURZUEBERSCHRIFT1','Erfassen');
$this->app->Tpl->SetText('KURZUEBERSCHRIFT2',$artikel['name_de']." (Artikel ".$artikel['nummer'].")");
$this->app->Tpl->SetText('LEGEND',$artikel['name_de']." (Artikel ".$artikel['nummer'].")");
$task = "artikel";
}
$lieferschein_id = (int) $this->app->Secure->GetGET('lieferschein');
if (!empty($lieferschein_id)) {
$this->app->User->SetParameter('seriennummern_lieferschein_id', $lieferschein_id);
$lieferschein = $this->app->DB->SelectRow("SELECT belegnr FROM lieferschein WHERE id ='".$lieferschein_id."'");
$this->app->Tpl->SetText('KURZUEBERSCHRIFT1','Erfassen');
$this->app->Tpl->SetText('KURZUEBERSCHRIFT2','Lieferschein '.$lieferschein['belegnr']);
$this->app->Tpl->SetText('LEGEND','Lieferschein '.$lieferschein['belegnr']);
$task = "lieferschein";
}
$allowold = $this->app->Secure->GetPOST('allowold');
$submit = $this->app->Secure->GetPOST('submit');
$seriennummern = array();
$seriennummern_text = $this->app->Secure->GetPOST('seriennummern');
$seriennummern = explode('\n',str_replace(['\r'],'',$seriennummern_text));
switch ($submit) {
case 'hinzufuegen':
$eingabe = $this->app->Secure->GetPOST('eingabeneu');
$eingabescan = $this->app->Secure->GetPOST('eingabescan');
$eingabe = $this->app->Secure->GetPOST('eingabe');
if (!empty($eingabe)) {
$seriennummern[] = $eingabe;
}
if (!empty($eingabescan)) {
$seriennummern[] = $eingabescan;
}
break;
case 'speichern':
case 'einlagern':
$seriennummern_not_written = array();
$seriennummern_already_exist = array();
$seriennummern_old_not_allowed = array();
@ -544,9 +644,10 @@ class Seriennummern {
break;
}
$seriennummern = array_unique($seriennummern);
switch ($task) {
case 'artikel':
$check_seriennummern = $this->seriennummern_check_serials($artikel_id);
$check_seriennummern = $check_seriennummern[0];
@ -562,9 +663,7 @@ class Seriennummern {
$letzte_seriennummer = (string) $this->app->DB->Select("SELECT seriennummer FROM seriennummern WHERE artikel = '".$artikel_id."' ORDER BY id DESC LIMIT 1");
$regex_result = array(preg_match('/(.*?)(\d+)(?!.*\d)(.*)/', $letzte_seriennummer, $matches));
$this->app->Tpl->Set('LETZTE', $letzte_seriennummer);
$this->app->Tpl->Set('PRAEFIX', $matches[1]);
$this->app->Tpl->Set('START', $matches[2]+1);
$this->app->Tpl->Set('POSTFIX', $matches[3]);
@ -572,13 +671,54 @@ class Seriennummern {
$this->app->Tpl->Set('ANZAHL', $anzahl_fehlt);
$this->app->Tpl->Set('ARTIKELNUMMER', '<a href="index.php?module=artikel&action=edit&id='.$check_seriennummern['id'].'">'.$check_seriennummern['nummer'].'</a>');
$this->app->Tpl->Set('ARTIKEL', $check_seriennummern['name']);
$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->YUI->AutoComplete("eingabe", "seriennummerverfuegbar",0,"&artikel=$artikel_id");
break;
case 'lieferschein':
$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>');
$artikel_lieferschein = $this->app->DB->SelectArr("SELECT artikel FROM lieferschein_position WHERE lieferschein = '".$lieferschein_id."'");
$sql = "
SELECT
DISTINCT s.seriennummer
FROM
seriennummern s
LEFT JOIN
seriennummern_lieferschein_position slp ON slp.seriennummer = s.id
WHERE
s.artikel IN ('".implode("','",array_column($artikel_lieferschein,'artikel'))."')
AND s.eingelagert = 1
AND slp.id IS NULL
ORDER BY s.id ASC
LIMIT 1
";
$letzte_seriennummer = (string) $this->app->DB->Select($sql);
$regex_result = array(preg_match('/(.*?)(\d+)(?!.*\d)(.*)/', $letzte_seriennummer, $matches));
$this->app->Tpl->Set('LETZTE', $letzte_seriennummer);
$this->app->Tpl->Set('PRAEFIX', $matches[1]);
$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__);
$this->app->YUI->AutoComplete("eingabe", "seriennummerverfuegbar",0,"&lieferschein=$lieferschein_id");
$this->app->Tpl->Set('SERIENNUMMERN', implode("\n",$seriennummern));
break;
default:
exit();
break;
}
$this->app->Tpl->Parse('PAGE', "seriennummern_enter.tpl");
}
@ -733,4 +873,17 @@ class Seriennummern {
}
}
public function seriennummern_minidetail($parsetarget='',$menu=true) {
$id = $this->app->Secure->GetGET('id');
if($parsetarget=='')
{
$tmp = new EasyTable($this->app);
$tmp->Query("SELECT s.seriennummer FROM seriennummern s INNER JOIN seriennummern_lieferschein_position slp ON slp.seriennummer = s.id WHERE slp.lieferschein_position ='$id' ",0,"");
$tmp->DisplayNew('TAB1',"Seriennummern","noAction");
$this->app->Tpl->Output('emptytab.tpl');
$this->app->ExitXentral();
}
}
}