diff --git a/phpwf/plugins/class.yui.php b/phpwf/plugins/class.yui.php index 70cedeee..f517bab6 100644 --- a/phpwf/plugins/class.yui.php +++ b/phpwf/plugins/class.yui.php @@ -3614,6 +3614,79 @@ class YUI { '')"; } + function IconsSQL_versandpaket() { +/* + status: + neu -> + + Lagergo + lagergo_stop + lagerstop + + Schein + summe_go + summe_stop + + Auto + liefersperrego + liefersperrestop + + marke + portogo + portostop + + produktion_usn_gut + storno*/ + + + $lieferschein_kein = "app->Conf->WFconf['defaulttheme']}/images/summe_stop.png\" title=\"Kein Lieferschein\" border=\"0\" style=\"margin-right:1px\">"; + $lieferschein_ohne_pos = "app->Conf->WFconf['defaulttheme']}/images/summe_go.png\" title=\"Lieferschein ohne Positionen\" border=\"0\" style=\"margin-right:1px\">"; + $lieferschein_voll = "app->Conf->WFconf['defaulttheme']}/images/lagergo.png\" title=\"Lieferschein vollständig\" border=\"0\" style=\"margin-right:1px\">"; + $lieferschein_teil = "app->Conf->WFconf['defaulttheme']}/images/lagergo_stop.png\" title=\"Lieferschein teilweise\" border=\"0\" style=\"margin-right:1px\">"; + + $versendet = "app->Conf->WFconf['defaulttheme']}/images/liefersperrego.png\" title=\"Versendet\" border=\"0\" style=\"margin-right:1px\">"; + $versendet_nicht = "app->Conf->WFconf['defaulttheme']}/images/liefersperrestop.png\" title=\"Nicht versendet\" border=\"0\" style=\"margin-right:1px\">"; + + $paketmarke = "app->Conf->WFconf['defaulttheme']}/images/portogo.png\" style=\"margin-right:1px\" title=\"Paketmarke\" border=\"0\">"; + $paketmarke_keine = "app->Conf->WFconf['defaulttheme']}/images/portostop.png\" style=\"margin-right:1px\" title=\"Keine Paketmarke\" border=\"0\">"; + + $ausgeliefert = "app->Conf->WFconf['defaulttheme']}/images/grey.png\" style=\"margin-right:1px\" title=\"Ausgeliefert\" border=\"0\">"; + $ausgeliefert_nicht = "app->Conf->WFconf['defaulttheme']}/images/nicht_eingelagert.png\" style=\"margin-right:1px\" title=\"Nicht ausgeliefert\" border=\"0\">"; + + $storno = "app->Conf->WFconf['defaulttheme']}/images/storno.png\" style=\"margin-right:1px\" title=\"Storniert\" border=\"0\">"; + + for ($z = 0;$z < 4;$z++) { + $abgeschlossen .= $ausgeliefert; + $storniert .= $storno; + } + + return "CONCAT('
', + CASE + WHEN v.status = 'abgeschlossen' THEN '$abgeschlossen' + WHEN v.status = 'storniert' THEN '$storniert' + ELSE CONCAT( + CASE + WHEN lieferschein_ohne_pos <> '' THEN '$lieferschein_ohne_pos' + WHEN lieferschein <> '' THEN '$lieferschein_voll' + ELSE + '$lieferschein_kein' + END, + CASE + WHEN tracking <> '' THEN '$paketmarke' + ELSE + '$paketmarke_keine' + END, + CASE + WHEN v.status = 'versendet' THEN '$versendet' + ELSE + '$versendet_nicht' + END, + '$ausgeliefert_nicht' + ) + END, + '
')"; + } + function TablePositionSearch($parsetarget, $name, $callback = "show", $gener) { $id = $this->app->Secure->GetGET("id"); diff --git a/upgrade/data/db_schema.json b/upgrade/data/db_schema.json index 3578f8f2..453cc950 100644 --- a/upgrade/data/db_schema.json +++ b/upgrade/data/db_schema.json @@ -112662,7 +112662,7 @@ } ] }, - { + { "name": "versandpaket_lieferschein_position", "collation": "utf8mb3_general_ci", "type": "BASE TABLE", @@ -112952,6 +112952,17 @@ "Privileges": "select,insert,update,references", "Comment": "" }, + { + "Field": "versandart", + "Type": "varchar(64)", + "Collation": "utf8mb3_general_ci", + "Null": "NO", + "Key": "", + "Default": "", + "Extra": "", + "Privileges": "select,insert,update,references", + "Comment": "" + }, { "Field": "lieferschein_ohne_pos", "Type": "int(11)", diff --git a/www/lib/class.erpapi.php b/www/lib/class.erpapi.php index a6fe3664..b9ba007f 100644 --- a/www/lib/class.erpapi.php +++ b/www/lib/class.erpapi.php @@ -22896,9 +22896,6 @@ function ChargenMHDAuslagern($artikel, $menge, $lagerplatztyp, $lpid,$typ,$wert, return $this->GetSelectDokumentKunde("arbeitsnachweis",$adresse,$select); } - - - function GetSelectAnsprechpartner($adresse, $selected="") { $first = $this->app->DB->Select("SELECT CONCAT(ansprechpartner,' <',email,'>') FROM adresse WHERE id='$adresse' AND geloescht=0 LIMIT 1"); @@ -22915,7 +22912,7 @@ function ChargenMHDAuslagern($artikel, $menge, $lagerplatztyp, $lpid,$typ,$wert, $tpl .=""; } return $tpl; - } + } function GetVorgaenger($projekt,$disableid="") { diff --git a/www/lib/class.versanddienstleister.php b/www/lib/class.versanddienstleister.php index 0debe90d..3deb5899 100644 --- a/www/lib/class.versanddienstleister.php +++ b/www/lib/class.versanddienstleister.php @@ -75,7 +75,8 @@ abstract class Versanddienstleister $ret['lieferscheinId'] = $lieferscheinId; $addressfields = ['name', 'adresszusatz', 'abteilung', 'ansprechpartner', 'unterabteilung', 'ort', 'plz', - 'strasse', 'land']; + 'strasse', 'land']; + $ret['original'] = array_filter($docArr, fn($key) => in_array($key, $addressfields), ARRAY_FILTER_USE_KEY); $ret['name'] = empty(trim($docArr['ansprechpartner'])) ? trim($docArr['name']) : trim($docArr['ansprechpartner']); @@ -403,14 +404,18 @@ abstract class Versanddienstleister lieferschein_ohne_pos, gewicht, tracking, - tracking_link + tracking_link, + status, + versandart ) VALUES ( {$address['lieferscheinId']}, '$json->weight', '$result->TrackingNumber', - '$result->TrackingUrl' + '$result->TrackingUrl', + 'versendet', + '$this->type' )"; $this->app->DB->Insert($sql); diff --git a/www/pages/content/lieferschein_minidetail.tpl b/www/pages/content/lieferschein_minidetail.tpl index 3d1de593..389e17ab 100644 --- a/www/pages/content/lieferschein_minidetail.tpl +++ b/www/pages/content/lieferschein_minidetail.tpl @@ -22,7 +22,7 @@ Projekt:[PROJEKT]Angebotssumme:[GESAMTSUMME] Auftrag:[AUFTRAG]Versteuerung:[STEUER] Rechnung:[RECHNUNG]Gewicht (netto):[GEWICHT] -Tracking:[TRACKING]Versandart:[VERSANDART] +Pakete:[TRACKING]Versandart:[VERSANDART] Retoure:[RETOURE] diff --git a/www/pages/content/versandpakete_edit.tpl b/www/pages/content/versandpakete_edit.tpl index bdcd4eef..62540109 100644 --- a/www/pages/content/versandpakete_edit.tpl +++ b/www/pages/content/versandpakete_edit.tpl @@ -28,7 +28,15 @@ - + + + + {|Versandart|}: + + + + + {|Tracking|}: @@ -42,7 +50,7 @@ {|Gewicht Kg|}: - + @@ -71,7 +79,21 @@ - + +
+ {|Lieferschein|} + + + + + +
+ {|Lieferschein|}: + + + +
+
@@ -82,6 +104,7 @@ +
@@ -91,6 +114,8 @@
+
+
diff --git a/www/pages/content/versandpakete_list.tpl b/www/pages/content/versandpakete_list.tpl index 394c103a..544d08e4 100644 --- a/www/pages/content/versandpakete_list.tpl +++ b/www/pages/content/versandpakete_list.tpl @@ -4,7 +4,50 @@
[MESSAGE] - [TAB1] +
+
+
{|Filter|}
+
    + [STATUSFILTER] +
  • + + +
  • +
  • + + +
  • +
+
+
+
+ [TAB1] +
+ + Stapelverarbeitung + + + + +
{|Status|}:
 alle markieren 
+
+
[TAB1NEXT]
+ + diff --git a/www/pages/lieferschein.php b/www/pages/lieferschein.php index a5141680..49a9a594 100644 --- a/www/pages/lieferschein.php +++ b/www/pages/lieferschein.php @@ -1021,7 +1021,8 @@ class Lieferschein extends GenLieferschein } */ - $sql = "SELECT SQL_CALC_FOUND_ROWS + $sql = "SELECT SQL_CALC_FOUND_ROWS + v.id, v.tracking as tracking, v.tracking_link FROM @@ -1034,15 +1035,16 @@ class Lieferschein extends GenLieferschein lieferschein l ON lp.lieferschein = l.id WHERE l.id = ".$id." OR v.lieferschein_ohne_pos = ".$id." GROUP BY - v.tracking + v.id "; $tracking = $this->app->DB->SelectArr($sql); $tracking_list = array(); foreach ($tracking as $single_tracking) { - $tracking_list[] = ''.$single_tracking['tracking'].''; + $tracking_list[] = 'Paket Nr.'.$single_tracking['id'].''. + ' ('.''.$single_tracking['tracking'].''.')'; } - $this->app->Tpl->Set('TRACKING',implode(', ',$tracking_list)); + $this->app->Tpl->Set('TRACKING',implode('
',$tracking_list)); $returnOrders = (array)$this->app->DB->SelectArr( sprintf( diff --git a/www/pages/versandpakete.php b/www/pages/versandpakete.php index e29187e9..63934075 100644 --- a/www/pages/versandpakete.php +++ b/www/pages/versandpakete.php @@ -8,10 +8,7 @@ use Xentral\Components\Database\Exception\QueryFailureException; class Versandpakete { - const VERSANDPAKETE_STATUS_NEU = 'neu'; - const VERSANDPAKETE_STATUS_VERSENDET = 'versendet'; - const VERSANDPAKETE_STATUS_ABGESCHLOSSEN = 'abgeschlossen'; - const VERSANDPAKETE_STATUS_STORNIERT = 'storniert'; + const STATUS = ARRAY ('neu','versendet','abgeschlossen','storniert'); const SQL_VERSANDPAKETE_LIEFERSCHEIN = " SELECT DISTINCT @@ -42,6 +39,8 @@ class Versandpakete { $this->app->ActionHandler("edit", "versandpakete_edit"); $this->app->ActionHandler("add", "versandpakete_add"); $this->app->ActionHandler("lieferscheine", "versandpakete_lieferscheine"); + $this->app->ActionHandler("stapelverarbeitung", "versandpakete_stapelverarbeitung"); + $this->app->ActionHandler("paketmarke", "versandpakete_paketmarke"); $this->app->ActionHandler("delete", "versandpakete_delete"); $this->app->ActionHandler("minidetail", "versandpakete_minidetail"); $this->app->DefaultActionHandler("list"); @@ -56,8 +55,8 @@ class Versandpakete { switch ($name) { case "versandpakete_list": $allowed['versandpakete_list'] = array('list'); - $heading = array('','', 'Paket-Nr.','Datum','Adresse', 'Lieferschein', 'Tracking', 'Versender', 'Gewicht', 'Bemerkung', 'Status', 'Menü'); - $width = array('1%','1%','10%'); // Fill out manually later + $heading = array('','', 'Paket-Nr.','Datum','Adresse', 'Lieferschein', 'Versandart', 'Tracking', 'Gewicht','Versender', 'Bemerkung', 'Status', 'Monitor', 'Menü'); + $width = array('1%','1%','1%'); // Fill out manually later // columns that are aligned right (numbers etc) // $alignright = array(4,5,6,7,8); @@ -71,21 +70,39 @@ class Versandpakete { $dropnbox = "'' AS `open`, CONCAT('') AS `auswahl`"; $menu = "
" . "Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"> " . "Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\">" . "
"; - $menucol = 11; + $menucol = 12; $moreinfo = true; // Allow drop down details + $lieferschein_link = array( + '', + ['sql' => 'l.belegnr'], + '' + ); + + $tracking_link = array( + '', + ['sql' => 'v.tracking'], + '' + ); + $sql = "SELECT SQL_CALC_FOUND_ROWS v.id, $dropnbox, v.id, ".$app->erp->FormatDateTimeShort('v.datum').", a.name, - GROUP_CONCAT(DISTINCT l.belegnr SEPARATOR ', ') as lieferschein, - v.tracking, - v.versender, + GROUP_CONCAT(DISTINCT ".$app->erp->ConcatSQL($lieferschein_link)." SEPARATOR ', ') as lieferschein, + ".$app->erp->FormatUCfirst('v.versandart')." as versandart, + ".$app->erp->ConcatSQL($tracking_link)." as tracking_link, v.gewicht, + v.versender, v.bemerkung, v.status, + ".$app->YUI->IconsSQL_versandpaket().", v.id FROM versandpakete v @@ -94,10 +111,48 @@ class Versandpakete { LEFT JOIN lieferschein l on vl.lieferschein = l.id LEFT JOIN - adresse a on a.id = l.adresse + adresse a on a.id = l.adresse "; - $where = ""; + $where = "v.status IN ('neu', 'versendet')"; + + // Toggle filters + $app->Tpl->Add('JQUERYREADY', "$('#geschlossene').click( function() { fnFilterColumn1( 0 ); } );"); + $app->Tpl->Add('JQUERYREADY', "$('#stornierte').click( function() { fnFilterColumn2( 0 ); } );"); + + for ($r = 1;$r <= 2;$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) { + $where .= " OR v.status IN ('abgeschlossen')"; + } else { + } + + $more_data2 = $app->Secure->GetGET("more_data2"); + if ($more_data2 == 1) { + $where .= " OR v.status IN ('storniert')"; + } + else { + } + // END Toggle filters + // $count = "SELECT count(DISTINCT id) FROM versandpakete v WHERE $where"; $groupby = "GROUP BY v.id"; @@ -153,7 +208,7 @@ class Versandpakete { LEFT JOIN versandpaket_lieferschein_position vlp ON vlp.lieferschein_position = lp.id LEFT JOIN versandpakete v ON vlp.versandpaket = v.id WHERE - l.belegnr <> '' AND l.versendet <> 1 AND (v.status IS NULL OR v.status != '".self::VERSANDPAKETE_STATUS_STORNIERT."') + l.belegnr <> '' AND l.versendet <> 1 AND (v.status IS NULL OR v.status != 'storniert') GROUP BY lp.id ) l_mengen "; @@ -285,12 +340,40 @@ class Versandpakete { $this->app->erp->MenuEintrag("index.php", "Zurück"); } - function versandpakete_list() { + function versandpakete_list() { $this->versandpakete_menu(); + // Status select + $options_text = ""; + foreach (self::STATUS as $status) + { + $options_text .= ""; + } + $this->app->Tpl->Set('STATUS_OPTIONS', $options_text); $this->app->YUI->TableSearch('TAB1', 'versandpakete_list', "show", "", "", basename(__FILE__), __CLASS__); $this->app->Tpl->Parse('PAGE', "versandpakete_list.tpl"); } + function versandpakete_stapelverarbeitung() { + // Process multi action + $auswahl = $this->app->Secure->GetPOST('auswahl'); + $selectedIds = []; + if(!empty($auswahl)) { + foreach($auswahl as $selectedId) { + $selectedId = (int)$selectedId; + if($selectedId > 0) { + $selectedIds[] = $selectedId; + } + } + + $status = $this->app->Secure->GetPOST('status'); + + $sql = "UPDATE versandpakete SET status = '".$status."'"; + $sql .= " WHERE id IN (".implode(",",$selectedIds).")"; + $this->app->DB->Update($sql); + } + $this->versandpakete_list(); + } + function versandpakete_lieferscheine() { $this->versandpakete_menu(); $this->app->YUI->TableSearch('TAB1', 'versandpakete_lieferscheine', "show", "", "", basename(__FILE__), __CLASS__); @@ -300,7 +383,7 @@ class Versandpakete { public function versandpakete_delete() { $id = (int) $this->app->Secure->GetGET('id'); - $this->app->DB->Delete("UPDATE `versandpakete` SET status='".self::VERSANDPAKETE_STATUS_STORNIERT."' WHERE `id` = '{$id}'"); + $this->app->DB->Delete("UPDATE `versandpakete` SET status='storniert' WHERE `id` = '{$id}'"); $this->app->Tpl->Set('MESSAGE', "
Der Eintrag wurde storniert.
"); $this->versandpakete_list(); @@ -329,8 +412,9 @@ class Versandpakete { if (empty($id)) { // New item + $new_item = true; $id = 'NULL'; - $input['status'] = self::VERSANDPAKETE_STATUS_NEU; + $input['status'] = 'neu'; $input['versender'] = $this->app->User->GetName(); } @@ -358,12 +442,12 @@ class Versandpakete { } else { $this->app->Tpl->Set('MESSAGE', "
Die Einstellungen wurden erfolgreich übernommen.
"); } - break; + break; } // Load values again from database $dropnbox = "'' AS `open`, CONCAT('') AS `auswahl`"; - $result = $this->app->DB->SelectArr("SELECT SQL_CALC_FOUND_ROWS v.id, $dropnbox, ".$this->app->erp->FormatDate('datum')." as datum, v.versand, v.nr, v.tracking, v.versender, v.gewicht, v.bemerkung, v.status, v.id FROM versandpakete v"." WHERE id=$id"); + $result = $this->app->DB->SelectArr("SELECT SQL_CALC_FOUND_ROWS v.id, $dropnbox, ".$this->app->erp->FormatDate('datum')." as datum, v.versand, ".$this->app->erp->FormatUCfirst('v.versandart')." as versandart, v.nr, v.tracking, v.tracking_link, v.versender, v.gewicht, v.bemerkung, v.status, v.id FROM versandpakete v"." WHERE id=$id"); foreach ($result[0] as $key => $value) { $this->app->Tpl->Set(strtoupper($key), $value); @@ -381,26 +465,34 @@ class Versandpakete { $this->app->YUI->AutoComplete("lieferschein", "kundenlieferschein",0,"&adresse=".$adress_check[0]['adresse']); } } - - $sql = "SELECT lieferschein_ohne_pos FROM versandpakete WHERE id = ".$id; - $lieferschein_ohne_pos = $this->app->DB->SelectArr($sql); - - if (!empty($lieferschein_ohne_pos[0]['lieferschein_ohne_pos'])) { - $this->app->Tpl->Set('LIEFERSCHEIN_ADD_POS_HIDDEN', 'hidden'); - } - if ($result[0]['status'] != self::VERSANDPAKETE_STATUS_NEU) { - $this->app->Tpl->Set('LIEFERSCHEIN_ADD_POS_HIDDEN', 'hidden'); + if ($new_item) { $this->app->Tpl->Set('LIEFERSCHEIN_POS_HIDDEN', 'hidden'); } + $sql = "SELECT lieferschein_ohne_pos, belegnr FROM versandpakete v INNER JOIN lieferschein l ON v.lieferschein_ohne_pos = l.id WHERE v.id = ".$id; + $lieferschein_ohne_pos = $this->app->DB->SelectArr($sql); + if (!empty($lieferschein_ohne_pos[0]['lieferschein_ohne_pos'])) { + $this->app->Tpl->Set('LIEFERSCHEIN_ADD_POS_HIDDEN', 'hidden'); + $this->app->Tpl->Set('LIEFERSCHEIN_OHNE_POS', $lieferschein_ohne_pos[0]['belegnr']); + $this->app->Tpl->Set('LIEFERSCHEIN_OHNE_POS_ID', $lieferschein_ohne_pos[0]['lieferschein_ohne_pos']); + $this->app->Tpl->Set('LIEFERSCHEIN_POS_HIDDEN', 'hidden'); + } else { + $this->app->Tpl->Set('LIEFERSCHEIN_OHNE_POS_HIDDEN', 'hidden'); + } + if ($result[0]['status'] != 'neu') { + $this->app->Tpl->Set('LIEFERSCHEIN_ADD_POS_HIDDEN', 'hidden'); + $this->app->Tpl->Set('LIEFERSCHEIN_GEWICHT_DISABLED', 'disabled'); + $this->app->Tpl->Set('PAKETMARKE_HIDDEN', 'hidden'); + } + if (!empty($result[0]['tracking'])) { + $this->app->Tpl->Set('PAKETMARKE_HIDDEN', 'hidden'); + } $this->app->YUI->TableSearch('PAKETINHALT', 'versandpakete_paketinhalt_list', "show", "", "", basename(__FILE__), __CLASS__); $this->app->Tpl->Parse('PAGE', "versandpakete_edit.tpl"); } - function versandpakete_add() { - + function versandpakete_add() { $this->versandpakete_menu(); - $id = $this->app->Secure->GetGET('id'); if (empty($id)) { $lieferschein = $this->app->Secure->GetGET('lieferschein'); @@ -410,7 +502,7 @@ class Versandpakete { } else { $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) VALUES ('".self::VERSANDPAKETE_STATUS_NEU."')"; + $sql = "INSERT INTO versandpakete (status) VALUES ('neu')"; $this->app->DB->Insert($sql); $id = $this->app->DB->GetInsertId(); } @@ -439,9 +531,12 @@ class Versandpakete { $submit = $this->app->Secure->GetPOST('submit'); // Check Status - $sql = "SELECT status FROM versandpakete WHERE id = ".$id." LIMIT 1"; + $sql = "SELECT status, lieferschein_ohne_pos FROM versandpakete WHERE id = ".$id." LIMIT 1"; $result = $this->app->DB->SelectArr($sql); - if ($result[0]['status'] != self::VERSANDPAKETE_STATUS_NEU) { + if ($result[0]['status'] != 'neu') { + return; + } + if (!empty($result[0]['lieferschein_ohne_pos'])) { return; } @@ -565,8 +660,29 @@ class Versandpakete { $table->DisplayNew('TABLE', 'Menge Paket', 'noAction'); $this->app->Tpl->Output('table.tpl'); $this->app->ExitXentral(); - } - + } + + function versandpakete_paketmarke() + { + $this->versandpakete_menu(); + $id = $this->app->Secure->GetGET('id'); + + $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"); + + print_r($result); + + if (empty($result['modul']) || empty($result['id'])) { + $this->app->Tpl->addMessage('error', 'Bitte zuerst eine gültige Versandart auswählen', false, 'PAGE'); + return; + } + $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->Paketmarke('TAB1', 'lieferschein', $lieferschein['lieferschein']); + $this->app->Tpl->Parse('PAGE',"tabview.tpl"); + } + /** * Get all paramters from html form and save into $input */