versandpakete extended handling of lieferschein_ohne_pos, tracking is editable if no versandmodul

This commit is contained in:
OpenXE 2023-11-01 15:42:21 +01:00
parent 3e70af8466
commit e474014b8c
3 changed files with 117 additions and 56 deletions

View File

@ -3665,8 +3665,8 @@ class YUI {
WHEN status = 'storniert' THEN '$storniert' WHEN status = 'storniert' THEN '$storniert'
ELSE CONCAT( ELSE CONCAT(
CASE CASE
WHEN lieferschein_ohne_pos <> '' THEN '$lieferschein_ohne_pos'
WHEN lieferscheine <> '' AND vmenge = lmenge THEN '$lieferschein_voll' WHEN lieferscheine <> '' AND vmenge = lmenge THEN '$lieferschein_voll'
WHEN lieferscheine <> '' AND vmenge IS NULL THEN '$lieferschein_ohne_pos'
WHEN lieferscheine <> '' THEN '$lieferschein_teil' WHEN lieferscheine <> '' THEN '$lieferschein_teil'
ELSE ELSE
'$lieferschein_kein' '$lieferschein_kein'

View File

@ -45,12 +45,12 @@
{|Tracking|}: {|Tracking|}:
</td> </td>
<td> <td>
<input type="text" name="" id="" value="[TRACKING]" size="40" disabled> <input type="text" name="tracking" id="tracking" value="[TRACKING]" size="40" [TRACKING_DISABLED]>
<a href="[PAKETMARKE_LINK]" [PAKETMARKE_HIDDEN]> <a href="[PAKETMARKE_LINK]" [PAKETMARKE_HIDDEN]>
<img src="themes/new/images/portogo.png" border="0" style="top:6px; position:relative"> <img src="themes/new/images/portogo.png" border="0" title="Zur Paketmarke" style="top:6px; position:relative">
</a> </a>
<a href="[TRACKING_LINK]" [PAKETMARKE_HIDDEN]> <a href="[TRACKING_LINK]" [TRACKING_LINK_HIDDEN]>
<img src="themes/new/images/forward.svg" border="0" style="top:6px; position:relative"> <img src="themes/new/images/forward.svg" border="0" title="Zum Tracking" style="top:6px; position:relative">
</a> </a>
</td> </td>
</tr> </tr>
@ -81,16 +81,16 @@
<table width="100%" border="0" class="mkTableFormular"> <table width="100%" border="0" class="mkTableFormular">
<tr [LIEFERSCHEIN_OHNE_POS_HIDDEN]> <tr [LIEFERSCHEIN_OHNE_POS_HIDDEN]>
<td> <td>
{|Lieferschein ohne Positionen|}: {|Zugeordnet|}:
</td> </td>
<td> <td>
<input form="add" type="text" name="" id="" value="[LIEFERSCHEIN_OHNE_POS]" size="40" disabled> <input form="add" type="text" name="" id="" value="[LIEFERSCHEIN_OHNE_POS]" size="40" disabled>
<a href="index.php?module=lieferschein&action=edit&id=[LIEFERSCHEIN_OHNE_POS_ID]"><img src="themes/new/images/forward.svg" border="0" style="top:6px; position:relative"></a> <a href="index.php?module=lieferschein&action=edit&id=[LIEFERSCHEIN_OHNE_POS_ID]"><img src="themes/new/images/forward.svg" title="Zum Lieferschein" border="0" style="top:6px; position:relative"></a>
</td> </td>
</tr> </tr>
<tr [LIEFERSCHEIN_ADD_POS_HIDDEN]> <tr [LIEFERSCHEIN_ADD_POS_HIDDEN]>
<td> <td>
{|Artikel von Lieferschein hinzuf&uuml;gen|}: {|Lieferschein für Artikel hinzuf&uuml;gen|}:
</td> </td>
<td> <td>
<input form="add" type="text" name="lieferschein" id="lieferschein" value="[LIEFERSCHEIN]" autofocus size="40"> <input form="add" type="text" name="lieferschein" id="lieferschein" value="[LIEFERSCHEIN]" autofocus size="40">

View File

@ -70,13 +70,13 @@ class Versandpakete {
case "lieferung_versandpakete_list": case "lieferung_versandpakete_list":
$lieferschein_filter = $app->User->GetParameter('versandpakete_lieferschein_filter'); $lieferschein_filter = $app->User->GetParameter('versandpakete_lieferschein_filter');
if ($lieferschein_filter) { if ($lieferschein_filter) {
$lieferschein_filter_where = "WHERE lieferschein = ".$lieferschein_filter; $lieferschein_filter_where = "WHERE lieferschein = ".$lieferschein_filter." OR lieferschein_ohne_pos = ".$lieferschein_filter;
$lieferung_link = "&lieferung=".$lieferschein_filter; $lieferung_link = "&lieferung=".$lieferschein_filter;
} }
// break omitted intentionally // break omitted intentionally
case "versandpakete_list": case "versandpakete_list":
$allowed['versandpakete_list'] = array('list'); $allowed['versandpakete_list'] = array('list');
$heading = array('', '', 'Paket-Nr.','Datum','Adresse', 'Lieferschein', 'Versandart', 'Tracking', 'Menge auf Lieferscheinen', 'Menge', 'Gewicht','Versender', 'Bemerkung', 'Status', 'Monitor', 'Men&uuml;', ''); $heading = array('', '', 'Paket-Nr.','Datum','Adresse', 'Lieferung', 'Versandart', 'Tracking', 'Menge auf Lieferscheinen', 'Menge', 'Gewicht','Versender', 'Bemerkung', 'Status', 'Monitor', 'Men&uuml;', '');
$width = array( '1%','1%','1%', '1%', '10%', '1%', '2%', '2%', '1%', '1%', '1%', '2%', '10%', '1%', '1%', '1%', '1%'); $width = array( '1%','1%','1%', '1%', '10%', '1%', '2%', '2%', '1%', '1%', '1%', '2%', '10%', '1%', '1%', '1%', '1%');
// columns that are aligned right (numbers etc) // columns that are aligned right (numbers etc)
@ -115,8 +115,16 @@ class Versandpakete {
'</a>' '</a>'
); );
$lieferschein_ohne_pos_link = array( $lieferung_link = array(
'<a href="index.php?module=lieferschein&action=edit&id=', '<a href="index.php?module=versandpakete&action=lieferung&id=',
['sql' => 'l.id'],
'">',
['sql' => 'l.belegnr'],
'</a>'
);
$lieferung_ohne_pos_link = array(
'<a href="index.php?module=versandpakete&action=lieferung&id=',
['sql' => 'lop.id'], ['sql' => 'lop.id'],
'">', '">',
['sql' => 'lop.belegnr'], ['sql' => 'lop.belegnr'],
@ -197,7 +205,7 @@ class Versandpakete {
v.id, v.id,
v.datum, v.datum,
if(lop.id IS NOT NULL,lop.name,l.name) AS name, if(lop.id IS NOT NULL,lop.name,l.name) AS name,
if(lop.id IS NOT NULL,".$app->erp->ConcatSQL($lieferschein_ohne_pos_link).", GROUP_CONCAT(".$app->erp->ConcatSQL($lieferschein_link)." SEPARATOR ', ')) AS lieferscheine, if(lop.id IS NOT NULL,".$app->erp->ConcatSQL($lieferung_ohne_pos_link).", GROUP_CONCAT(".$app->erp->ConcatSQL($lieferung_link)." SEPARATOR ', ')) AS lieferscheine,
v.versandart, v.versandart,
tracking, tracking,
tracking_link, tracking_link,
@ -275,7 +283,7 @@ class Versandpakete {
$allowed['versandpakete_lieferscheine'] = array('lieferscheine'); $allowed['versandpakete_lieferscheine'] = array('lieferscheine');
$heading = array('', '', 'Lieferschein', 'Adresse','Menge','Menge in Versandpaketen','Monitor','Pakete','Paket erstellen'); $heading = array('', '', 'Lieferschein', 'Adresse','Menge','Menge in Versandpaketen','Monitor','Pakete','Paket hinzuf&uuml;gen');
$width = array( '1%','1%', '10%', '10%', '10%', '10%', '1%', '1%', '1%'); // Fill out manually later $width = array( '1%','1%', '10%', '10%', '10%', '10%', '1%', '1%', '1%'); // Fill out manually later
// columns that are aligned right (numbers etc) // columns that are aligned right (numbers etc)
@ -556,7 +564,7 @@ class Versandpakete {
if ($complete === true) { if ($complete === true) {
$this->app->Tpl->addMessage('success', 'Lieferung vollst&auml;ndig in Paketen.', false, 'MESSAGE'); $this->app->Tpl->addMessage('success', 'Lieferung vollst&auml;ndig in Paketen.', false, 'MESSAGE');
} }
else if ($complete === false) { else {
$this->app->Tpl->addMessage('info', 'Lieferung unvollst&auml;ndig.', false, 'MESSAGE'); $this->app->Tpl->addMessage('info', 'Lieferung unvollst&auml;ndig.', false, 'MESSAGE');
} }
} }
@ -583,7 +591,7 @@ class Versandpakete {
$sql = "DELETE vlp FROM `versandpaket_lieferschein_position` vlp INNER JOIN versandpakete v ON vlp.versandpaket = v.id WHERE vlp.`id` = '{$pos}' AND v.status = 'neu'"; $sql = "DELETE vlp FROM `versandpaket_lieferschein_position` vlp INNER JOIN versandpakete v ON vlp.versandpaket = v.id WHERE vlp.`id` = '{$pos}' AND v.status = 'neu'";
$this->app->DB->Delete($sql); $this->app->DB->Delete($sql);
header("Location: index.php?module=versandpakete&action=edit&id=".$id); $this->app->Location->execute("Location: index.php?module=versandpakete&action=edit&id=".$id);
} }
/* /*
@ -620,7 +628,7 @@ class Versandpakete {
$sql = "INSERT INTO versandpakete (status, versender) VALUES ('neu','".$this->app->User->GetName()."')"; $sql = "INSERT INTO versandpakete (status, versender) VALUES ('neu','".$this->app->User->GetName()."')";
$this->app->DB->Insert($sql); $this->app->DB->Insert($sql);
$id = $this->app->DB->GetInsertId(); $id = $this->app->DB->GetInsertId();
header("Location: index.php?module=versandpakete&action=edit&id=".$id); $this->app->Location->execute("Location: index.php?module=versandpakete&action=edit&id=".$id);
} }
// Check versandart // Check versandart
@ -635,10 +643,14 @@ class Versandpakete {
// Add checks here // Add checks here
$sql = "SELECT status FROM versandpakete WHERE id = ".$id; $sql = "SELECT status FROM versandpakete WHERE id = ".$id;
$input['status'] = $this->app->DB->SelectArr($sql)[0]['status']; $input['status'] = $this->app->DB->SelectArr($sql)[0]['status']; // Status is not changeable
if ($input['status'] != 'neu') { if ($input['status'] != 'neu') {
$input = Array('bemerkung' => $input['bemerkung']); $input = Array('bemerkung' => $input['bemerkung']);
} }
if (!empty($paket_db['tracking'])) { // Tracking is not changeable
unset($input['tracking']);
unset($input['tracking_link']);
}
$columns = "id, "; $columns = "id, ";
$values = "$id, "; $values = "$id, ";
@ -690,29 +702,33 @@ class Versandpakete {
} }
$sql = "SELECT $sql = "SELECT
lieferschein_ohne_pos, lieferschein_ohne_pos,
belegnr, l.belegnr,
lieferschein_position, lop.belegnr lieferschein_ohne_pos_belegnr,
GROUP_CONCAT(lieferschein_position) lieferschein_position,
l.versandart l.versandart
FROM versandpakete v FROM versandpakete v
LEFT JOIN lieferschein l ON v.lieferschein_ohne_pos = l.id LEFT JOIN lieferschein l ON v.lieferschein_ohne_pos = l.id
LEFT JOIN versandpaket_lieferschein_position vlp ON vlp.versandpaket = v.id LEFT JOIN versandpaket_lieferschein_position vlp ON vlp.versandpaket = v.id
WHERE v.id = ".$id; LEFT JOIN lieferschein lop ON lop.id = v.lieferschein_ohne_pos
WHERE v.id = ".$id."
GROUP BY v.id
";
$lieferschein_check = $this->app->DB->SelectArr($sql); $lieferschein_check = $this->app->DB->SelectArr($sql);
if (empty($lieferschein_check[0]['lieferschein_position']) && empty($lieferschein_check[0]['lieferschein_ohne_pos'])) { if (empty($lieferschein_check[0]['lieferschein_position']) && empty($lieferschein_check[0]['lieferschein_ohne_pos'])) {
$this->app->Tpl->Set('NO_ADDRESS_HIDDEN', 'hidden'); $this->app->Tpl->Set('NO_ADDRESS_HIDDEN', 'hidden');
$this->app->Tpl->Set('PAKETMARKE_ADD_HIDDEN', 'hidden'); $this->app->Tpl->Set('PAKETMARKE_ADD_HIDDEN', 'hidden');
} }
if (empty($lieferschein_check[0]['lieferschein_ohne_pos'])) { if (empty($lieferschein_check[0]['lieferschein_ohne_pos'])) {
$this->app->Tpl->Set('LIEFERSCHEIN_OHNE_POS_HIDDEN', 'hidden'); $this->app->Tpl->Set('LIEFERSCHEIN_OHNE_POS_HIDDEN', 'hidden');
} else {
$this->app->Tpl->Set('LIEFERSCHEIN_ADD_POS_HIDDEN', 'hidden');
} }
if (empty($lieferschein_check[0]['lieferschein_position'])) { if (!empty($lieferschein_check[0]['lieferschein_ohne_pos'])) {
$this->app->Tpl->Set('LIEFERSCHEIN_OHNE_POS', $lieferschein_check[0]['belegnr']); $this->app->Tpl->Set('LIEFERSCHEIN_OHNE_POS', $lieferschein_check[0]['lieferschein_ohne_pos_belegnr']);
$this->app->Tpl->Set('LIEFERSCHEIN_OHNE_POS_ID', $lieferschein_check[0]['lieferschein_ohne_pos']); $this->app->Tpl->Set('LIEFERSCHEIN_OHNE_POS_ID', $lieferschein_check[0]['lieferschein_ohne_pos']);
$this->app->Tpl->Set('LIEFERSCHEIN_POS_HIDDEN', 'hidden');
} }
if (empty($lieferschein_check[0]['lieferschein_position'])) {
$this->app->Tpl->Set('LIEFERSCHEIN_POS_HIDDEN', 'hidden');
}
if ($result[0]['status'] != 'neu') { if ($result[0]['status'] != 'neu') {
$this->app->Tpl->Set('LIEFERSCHEIN_ADD_POS_HIDDEN', 'hidden'); $this->app->Tpl->Set('LIEFERSCHEIN_ADD_POS_HIDDEN', 'hidden');
$this->app->Tpl->Set('LIEFERSCHEIN_GEWICHT_DISABLED', 'disabled'); $this->app->Tpl->Set('LIEFERSCHEIN_GEWICHT_DISABLED', 'disabled');
@ -725,9 +741,18 @@ class Versandpakete {
} }
if (!empty($result[0]['tracking'])) { if (!empty($result[0]['tracking'])) {
$this->app->Tpl->Set('PAKETMARKE_ADD_HIDDEN', 'hidden'); $this->app->Tpl->Set('PAKETMARKE_ADD_HIDDEN', 'hidden');
} else { } else {
$this->app->Tpl->Set('PAKETMARKE_HIDDEN', 'hidden');
$this->app->Tpl->Set('ABSENDEN_HIDDEN', 'hidden'); $this->app->Tpl->Set('ABSENDEN_HIDDEN', 'hidden');
}
if (empty($result[0]['tracking_link'])) {
$this->app->Tpl->Set('TRACKING_LINK_HIDDEN', 'hidden');
}
$versandart = $this->app->DB->SelectRow("SELECT va.id, va.modul FROM versandpakete vp INNER JOIN versandarten va ON vp.versandart = va.type WHERE vp.id = ".$id." LIMIT 1");
if (empty($versandart['modul']) || empty($versandart['id'])) {
$this->app->Tpl->Set('PAKETMARKE_ADD_HIDDEN', 'hidden');
} else {
$this->app->Tpl->Set('TRACKING_DISABLED', 'disabled');
} }
$file_attachments = $this->app->erp->GetDateiSubjektObjekt('paketmarke','versandpaket',$id); $file_attachments = $this->app->erp->GetDateiSubjektObjekt('paketmarke','versandpaket',$id);
@ -735,6 +760,8 @@ class Versandpakete {
foreach ($file_attachments as $file_attachment) { foreach ($file_attachments as $file_attachment) {
$this->app->Tpl->Add('PAKETMARKE_LINK', "index.php?module=dateien&action=send&id=".$file_attachment); $this->app->Tpl->Add('PAKETMARKE_LINK', "index.php?module=dateien&action=send&id=".$file_attachment);
} }
} else {
$this->app->Tpl->Set('PAKETMARKE_HIDDEN', 'hidden');
} }
$sql = "SELECT SQL_CALC_FOUND_ROWS $sql = "SELECT SQL_CALC_FOUND_ROWS
@ -775,6 +802,8 @@ class Versandpakete {
function versandpakete_add() { function versandpakete_add() {
$id = $this->app->Secure->GetGET('id'); $id = $this->app->Secure->GetGET('id');
$input = $this->GetInput();
$this->versandpakete_menu(); $this->versandpakete_menu();
$this->app->erp->MenuEintrag("index.php?module=versandpakete&action=edit&id=".$id, "Details"); $this->app->erp->MenuEintrag("index.php?module=versandpakete&action=edit&id=".$id, "Details");
$this->app->Tpl->SetText('KURZUEBERSCHRIFT2', 'Artikel hinzuf&uuml;gen'); $this->app->Tpl->SetText('KURZUEBERSCHRIFT2', 'Artikel hinzuf&uuml;gen');
@ -782,22 +811,56 @@ class Versandpakete {
$lieferschein = $this->app->Secure->GetGET('lieferschein'); $lieferschein = $this->app->Secure->GetGET('lieferschein');
if (empty($lieferschein)) { if (empty($lieferschein)) {
$msg = $this->app->erp->base64_url_encode("<div class=\"error\">Kein Lieferschein angegeben.</div>"); $msg = $this->app->erp->base64_url_encode("<div class=\"error\">Kein Lieferschein angegeben.</div>");
header("Location: index.php?module=versandpakete&action=list&msg=$msg"); $this->app->Location->execute("Location: index.php?module=versandpakete&action=list&msg=$msg");
} else { } else {
$lieferschein_belegnr = $this->app->erp->ReplaceLieferschein(false, $lieferschein, false); // Parameters: Target db?, value, from form? $lieferschein_belegnr = $this->app->erp->ReplaceLieferschein(false, $lieferschein, false); // Parameters: Target db?, value, from form?
/* Create new paket and add the given lieferschein */
$sql = "INSERT INTO versandpakete (status, versender) VALUES ('neu','".$this->app->User->GetName()."')"; // Check if there is an unused paket waiting...
$this->app->DB->Insert($sql); $sql = "SELECT
$id = $this->app->DB->GetInsertId(); v.id,
$this->app->Tpl->addMessage('success', 'Versandpaket Paket Nr. '.$id.' wurde erstellt.', false, 'MESSAGE'); lieferschein_ohne_pos,
l.id AS lieferschein_mit_pos
FROM
versandpakete v
LEFT JOIN versandpaket_lieferschein_position vlp ON vlp.versandpaket = v.id
LEFT JOIN lieferschein_position lp ON vlp.lieferschein_position = lp.id
LEFT JOIN lieferschein l on l.id = lp.lieferschein
WHERE
v.status = 'neu' AND
l.id IS NULL AND
v.lieferschein_ohne_pos = ".$lieferschein."
LIMIT 1
";
$waiting_paket = $this->app->DB->SelectArr($sql);
if (!empty($waiting_paket)) {
// Use existing
echo("use old");
$msg = $this->app->erp->base64_url_encode("<div class=\"success\">Versandpaket Paket Nr. ".$waiting_paket[0]['id']." wurde zugeordnet.</div>");
$this->app->Location->execute("Location: index.php?module=versandpakete&action=add&id=".$waiting_paket[0]['id']."&lieferschein=".$lieferschein."&msg=$msg");
}
else {
// Create new paket and add the given lieferschein
echo("nake new");
$sql = "INSERT INTO versandpakete (status, lieferschein_ohne_pos, versender) VALUES ('neu',".$lieferschein.",'".$this->app->User->GetName()."')";
$this->app->DB->Insert($sql);
$id = $this->app->DB->GetInsertId();
$msg = $this->app->erp->base64_url_encode("<div class=\"success\">Versandpaket Paket Nr. ".$id." wurde erstellt.</div>");
$this->app->Location->execute("Location: index.php?module=versandpakete&action=add&id=".$id."&lieferschein=".$lieferschein."&msg=$msg");
}
} }
} else { // $id not empty } else { // $id not empty
$lieferschein_input = $this->app->Secure->GetPOST('lieferschein'); $lieferschein_post = $this->app->Secure->GetPOST('lieferschein');
$lieferschein = $this->app->erp->ReplaceLieferschein(true, $lieferschein_input, true); // Parameters: Target db?, value, from form? $lieferschein = $this->app->erp->ReplaceLieferschein(true, $lieferschein_post, true); // Parameters: Target db?, value, from form?
$lieferschein_belegnr = $this->app->erp->ReplaceLieferschein(false, $lieferschein_input, true); // Parameters: Target db?, value, from form? $lieferschein_belegnr = $this->app->erp->ReplaceLieferschein(false, $lieferschein_post, true); // Parameters: Target db?, value, from form?
if (empty($lieferschein_input)) { if (empty($lieferschein)) {
$msg = $this->app->erp->base64_url_encode("<div class=\"error\">Kein Lieferschein angegeben.</div>"); $lieferschein = $this->app->Secure->GetGET('lieferschein');
header("Location: index.php?module=versandpakete&action=edit&id=".$id."&msg=$msg"); if (empty($lieferschein)) {
$msg = $this->app->erp->base64_url_encode("<div class=\"error\">Kein Lieferschein angegeben.</div>");
$this->app->Location->execute("Location: index.php?module=versandpakete&action=edit&id=".$id."&msg=$msg");
}
$lieferschein_belegnr = $this->app->erp->ReplaceLieferschein(false, $lieferschein, false); // Parameters: Target db?, value, from form?
$input['lieferschein'] = $lieferschein;
} }
} }
@ -809,10 +872,8 @@ class Versandpakete {
$artikel_input = $this->app->Secure->GetPOST('artikel'); $artikel_input = $this->app->Secure->GetPOST('artikel');
$artikel = $this->app->erp->ReplaceArtikel(true, $artikel_input,true); // Parameters: Target db?, value, from form? $artikel = $this->app->erp->ReplaceArtikel(true, $artikel_input,true); // Parameters: Target db?, value, from form?
$menge = $this->app->Secure->GetPOST('menge'); $menge = $this->app->Secure->GetPOST('menge');
$this->app->Tpl->Set('ID', $id); $this->app->Tpl->Set('ID', $id);
$input = $this->GetInput();
$submit = $this->app->Secure->GetPOST('submit'); $submit = $this->app->Secure->GetPOST('submit');
// Check Status // Check Status
@ -820,10 +881,7 @@ class Versandpakete {
$result = $this->app->DB->SelectArr($sql); $result = $this->app->DB->SelectArr($sql);
if ($result[0]['status'] != 'neu') { if ($result[0]['status'] != 'neu') {
return; return;
} }
if (!empty($result[0]['lieferschein_ohne_pos'])) {
return;
}
switch ($submit) { switch ($submit) {
case 'hinzufuegen': case 'hinzufuegen':
@ -912,7 +970,7 @@ class Versandpakete {
if ($buchmenge_gesamt > 0) { if ($buchmenge_gesamt > 0) {
$msg = $this->app->erp->base64_url_encode("<div class=\"info\">Lieferschein hinzugef&uuml;gt.</div>"); $msg = $this->app->erp->base64_url_encode("<div class=\"info\">Lieferschein hinzugef&uuml;gt.</div>");
header("Location: index.php?module=versandpakete&action=edit&id=".$id."&msg=$msg"); $this->app->Location->execute("Location: index.php?module=versandpakete&action=edit&id=".$id."&msg=$msg");
} }
break; break;
} }
@ -931,7 +989,7 @@ class Versandpakete {
if ($complete === true) { if ($complete === true) {
$this->app->Tpl->addMessage('success', 'Lieferung vollst&auml;ndig in Paketen.', false, 'MESSAGE'); $this->app->Tpl->addMessage('success', 'Lieferung vollst&auml;ndig in Paketen.', false, 'MESSAGE');
} }
else if ($complete === false) { else {
$this->app->Tpl->addMessage('info', 'Lieferung unvollst&auml;ndig.', false, 'MESSAGE'); $this->app->Tpl->addMessage('info', 'Lieferung unvollst&auml;ndig.', false, 'MESSAGE');
} }
@ -1100,14 +1158,13 @@ class Versandpakete {
$this->app->Tpl->Set('TABTEXT',"Paketmarke"); $this->app->Tpl->Set('TABTEXT',"Paketmarke");
$result = $this->app->DB->SelectRow("SELECT va.id, va.modul FROM versandpakete vp INNER JOIN versandarten va ON vp.versandart = va.type LIMIT 1"); $versandart = $this->app->DB->SelectRow("SELECT va.id, va.modul FROM versandpakete vp INNER JOIN versandarten va ON vp.versandart = va.type WHERE vp.id = ".$id." LIMIT 1");
if (empty($versandart['modul']) || empty($versandart['id'])) {
if (empty($result['modul']) || empty($result['id'])) {
$this->app->Tpl->addMessage('error', 'Bitte zuerst eine gültige Versandart auswählen', false, 'PAGE'); $this->app->Tpl->addMessage('error', 'Bitte zuerst eine gültige Versandart auswählen', false, 'PAGE');
return; return;
} }
$lieferschein = $this->app->DB->SelectRow("SELECT * FROM (".self::SQL_VERSANDPAKETE_LIEFERSCHEIN.") temp WHERE versandpaket = ".$id." LIMIT 1"); $lieferschein = $this->app->DB->SelectRow("SELECT * FROM (".self::SQL_VERSANDPAKETE_LIEFERSCHEIN.") temp WHERE versandpaket = ".$id." LIMIT 1");
$versandmodul = $this->app->erp->LoadVersandModul($result['modul'], $result['id']); $versandmodul = $this->app->erp->LoadVersandModul($versandart['modul'], $versandart['id']);
$versandmodul->Paketmarke('TAB1', 'lieferschein', $lieferschein['lieferschein'], $id); $versandmodul->Paketmarke('TAB1', 'lieferschein', $lieferschein['lieferschein'], $id);
$this->app->Tpl->Parse('PAGE',"tabview.tpl"); $this->app->Tpl->Parse('PAGE',"tabview.tpl");
} }
@ -1119,6 +1176,7 @@ class Versandpakete {
$input = array(); $input = array();
$input['gewicht'] = $this->app->Secure->GetPOST('gewicht'); $input['gewicht'] = $this->app->Secure->GetPOST('gewicht');
$input['bemerkung'] = $this->app->Secure->GetPOST('bemerkung'); $input['bemerkung'] = $this->app->Secure->GetPOST('bemerkung');
$input['tracking'] = $this->app->Secure->GetPOST('tracking');
return $input; return $input;
} }
@ -1133,6 +1191,7 @@ class Versandpakete {
l.name, l.name,
lp.menge lmenge, lp.menge lmenge,
SUM(vlp.menge) vmenge, SUM(vlp.menge) vmenge,
GROUP_CONCAT(vop.id) vop,
BIT_OR(COALESCE(v.status,0) IN ('versendet')) AS eins_versendet, BIT_OR(COALESCE(v.status,0) IN ('versendet')) AS eins_versendet,
BIT_AND(COALESCE(v.status,0) IN ('versendet')) AS alle_versendet, BIT_AND(COALESCE(v.status,0) IN ('versendet')) AS alle_versendet,
BIT_OR(COALESCE(v.status,0) IN ('abgeschlossen')) AS eins_abgeschlossen, BIT_OR(COALESCE(v.status,0) IN ('abgeschlossen')) AS eins_abgeschlossen,
@ -1143,6 +1202,7 @@ class Versandpakete {
INNER JOIN artikel a ON lp.artikel = a.id INNER JOIN artikel a ON lp.artikel = a.id
LEFT JOIN versandpaket_lieferschein_position vlp ON vlp.lieferschein_position = lp.id LEFT JOIN versandpaket_lieferschein_position vlp ON vlp.lieferschein_position = lp.id
LEFT JOIN versandpakete v ON vlp.versandpaket = v.id LEFT JOIN versandpakete v ON vlp.versandpaket = v.id
LEFT JOIN versandpakete vop ON vop.lieferschein_ohne_pos = l.id
WHERE WHERE
l.versand_status <> 0 AND l.versand_status <> 0 AND
l.belegnr <> '' AND l.belegnr <> '' AND
@ -1161,7 +1221,8 @@ class Versandpakete {
eins_versendet, eins_versendet,
alle_versendet, alle_versendet,
eins_abgeschlossen, eins_abgeschlossen,
alle_abgeschlossen alle_abgeschlossen,
vop
FROM ( FROM (
".$sql_lieferschein_position." ".$sql_lieferschein_position."
) lp ) lp
@ -1177,7 +1238,7 @@ class Versandpakete {
".$app->erp->FormatMenge("lmenge").", ".$app->erp->FormatMenge("lmenge").",
".$app->erp->FormatMenge("vmenge").", ".$app->erp->FormatMenge("vmenge").",
".$app->YUI->IconsSQL_lieferung().", ".$app->YUI->IconsSQL_lieferung().",
if(vmenge=0,'',CONCAT('<a href=\"index.php?module=versandpakete&action=lieferung&id=',id,'\"><img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/forward.svg\" title=\"Pakete anzeigen\" border=\"0\"></a>')), if(vmenge > 0 OR vop IS NOT NULL,CONCAT('<a href=\"index.php?module=versandpakete&action=lieferung&id=',id,'\"><img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/forward.svg\" title=\"Pakete anzeigen\" border=\"0\"></a>'),''),
id, id,
alle_abgeschlossen alle_abgeschlossen
FROM ( FROM (