mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-24 13:40:29 +01:00
versandpakete initial
This commit is contained in:
parent
b838b63258
commit
4f7eb4049b
@ -42,7 +42,10 @@ class PLACEHOLDER_MODULECLASSNAME {
|
||||
$defaultorder = 1;
|
||||
$defaultorderdesc = 0;
|
||||
|
||||
$dropnbox = "PLACEHOLDER_DROPNBOX";
|
||||
$dropnbox = "PLACEHOLDER_DROPNBOX";
|
||||
|
||||
// $moreinfo = true; // Allow drop down details
|
||||
// $menucol = 11; // Set id col for moredata/menu
|
||||
|
||||
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=PLACEHOLDER_MODULENAME&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a> <a href=\"#\" onclick=DeleteDialog(\"index.php?module=PLACEHOLDER_MODULENAME&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
|
||||
|
||||
@ -118,6 +121,8 @@ class PLACEHOLDER_MODULECLASSNAME {
|
||||
|
||||
// Add checks here
|
||||
|
||||
// $input['projekt'] = $this->app->erp->ReplaceProjekt(true,$input['projekt'],true); // Parameters: Target db?, value, from form?
|
||||
|
||||
$columns = "id, ";
|
||||
$values = "$id, ";
|
||||
$update = "";
|
||||
@ -166,6 +171,9 @@ class PLACEHOLDER_MODULECLASSNAME {
|
||||
$this->app->Tpl->Add('KURZUEBERSCHRIFT2', $email);
|
||||
$this->app->Tpl->Add('EMAIL', $email);
|
||||
$this->app->Tpl->Add('ANGEZEIGTERNAME', $angezeigtername);
|
||||
|
||||
$this->app->YUI->AutoComplete("artikel", "artikelnummer");
|
||||
|
||||
*/
|
||||
|
||||
// $this->SetInput($input);
|
||||
|
@ -112662,6 +112662,76 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "versandpaket_lieferschein_position",
|
||||
"collation": "utf8mb3_general_ci",
|
||||
"type": "BASE TABLE",
|
||||
"columns": [
|
||||
{
|
||||
"Field": "id",
|
||||
"Type": "int(11)",
|
||||
"Collation": null,
|
||||
"Null": "NO",
|
||||
"Key": "PRI",
|
||||
"Default": null,
|
||||
"Extra": "auto_increment",
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Comment": ""
|
||||
},
|
||||
{
|
||||
"Field": "versandpaket",
|
||||
"Type": "int(11)",
|
||||
"Collation": null,
|
||||
"Null": "NO",
|
||||
"Key": "",
|
||||
"Default": null,
|
||||
"Extra": "",
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Comment": ""
|
||||
},
|
||||
{
|
||||
"Field": "lieferschein_position",
|
||||
"Type": "int(11)",
|
||||
"Collation": null,
|
||||
"Null": "NO",
|
||||
"Key": "",
|
||||
"Default": null,
|
||||
"Extra": "",
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Comment": ""
|
||||
},
|
||||
{
|
||||
"Field": "menge",
|
||||
"Type": "decimal(14,4)",
|
||||
"Collation": null,
|
||||
"Null": "NO",
|
||||
"Key": "",
|
||||
"Default": null,
|
||||
"Extra": "",
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Comment": ""
|
||||
}
|
||||
],
|
||||
"keys": [
|
||||
{
|
||||
"Key_name": "PRIMARY",
|
||||
"Index_type": "BTREE",
|
||||
"columns": [
|
||||
"id"
|
||||
],
|
||||
"Non_unique": ""
|
||||
},
|
||||
{
|
||||
"Key_name": "versandpaket_lieferschein_position",
|
||||
"Index_type": "BTREE",
|
||||
"columns": [
|
||||
"versandpaket",
|
||||
"lieferschein_position"
|
||||
],
|
||||
"Non_unique": "UNIQUE"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "versandarten",
|
||||
"collation": "utf8mb3_general_ci",
|
||||
@ -112849,6 +112919,17 @@
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Comment": ""
|
||||
},
|
||||
{
|
||||
"Field": "datum",
|
||||
"Type": "datetime",
|
||||
"Collation": null,
|
||||
"Null": "NO",
|
||||
"Key": "",
|
||||
"Default": "current_timestamp()",
|
||||
"Extra": "",
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Comment": ""
|
||||
},
|
||||
{
|
||||
"Field": "versand",
|
||||
"Type": "int(11)",
|
||||
@ -112871,6 +112952,17 @@
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Comment": ""
|
||||
},
|
||||
{
|
||||
"Field": "lieferschein_ohne_pos",
|
||||
"Type": "int(11)",
|
||||
"Collation": null,
|
||||
"Null": "NO",
|
||||
"Key": "",
|
||||
"Default": "0",
|
||||
"Extra": "",
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Comment": ""
|
||||
},
|
||||
{
|
||||
"Field": "tracking",
|
||||
"Type": "varchar(255)",
|
||||
@ -112882,6 +112974,17 @@
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Comment": ""
|
||||
},
|
||||
{
|
||||
"Field": "tracking_link",
|
||||
"Type": "text",
|
||||
"Collation": "utf8mb3_general_ci",
|
||||
"Null": "NO",
|
||||
"Key": "",
|
||||
"Default": "",
|
||||
"Extra": "",
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Comment": ""
|
||||
},
|
||||
{
|
||||
"Field": "versender",
|
||||
"Type": "varchar(255)",
|
||||
@ -112914,6 +113017,28 @@
|
||||
"Extra": "",
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Comment": ""
|
||||
},
|
||||
{
|
||||
"Field": "status",
|
||||
"Type": "varchar(64)",
|
||||
"Collation": "utf8mb3_general_ci",
|
||||
"Null": "NO",
|
||||
"Key": "",
|
||||
"Default": null,
|
||||
"Extra": "",
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Comment": ""
|
||||
},
|
||||
{
|
||||
"Field": "usereditid",
|
||||
"Type": "int(11)",
|
||||
"Collation": null,
|
||||
"Null": "YES",
|
||||
"Key": "MUL",
|
||||
"Default": null,
|
||||
"Extra": "",
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Comment": ""
|
||||
}
|
||||
],
|
||||
"keys": [
|
||||
|
@ -13233,7 +13233,6 @@ function SendPaypalFromAuftrag($auftrag, $test = false)
|
||||
//value muss hier vom format ueberprueft werden
|
||||
$dbformat = 0;
|
||||
if(!$fromform) {
|
||||
$dbformat = 1;
|
||||
$id = $value;
|
||||
if($id > 0){
|
||||
$abkuerzung = $this->app->DB->Select("SELECT belegnr as name FROM $table WHERE id='$id' LIMIT 1");
|
||||
@ -13241,13 +13240,16 @@ function SendPaypalFromAuftrag($auftrag, $test = false)
|
||||
$abkuerzung = '';
|
||||
}
|
||||
} else {
|
||||
$dbformat = 0;
|
||||
$abkuerzung = $value;
|
||||
$tmp = explode(' ', trim($value));
|
||||
$tmp = reset($tmp);
|
||||
//$id = $this->app->DB->Select("SELECT id FROM adresse WHERE kundennummer='$rest' AND geloescht=0 LIMIT 1");
|
||||
$id = $this->app->DB->Select("SELECT id FROM $table WHERE belegnr='$tmp' AND belegnr!='' LIMIT 1");
|
||||
if($id <=0) $id=0;
|
||||
if ($id <=0) {
|
||||
$id=0;
|
||||
$abkuerzung = '';
|
||||
} else {
|
||||
$abkuerzung = $tmp;
|
||||
}
|
||||
}
|
||||
|
||||
// wenn ziel datenbank
|
||||
|
@ -378,11 +378,41 @@ abstract class Versanddienstleister
|
||||
if ($json->submit == 'print') {
|
||||
$result = $this->CreateShipment($json, $address);
|
||||
if ($result->Success) {
|
||||
$sql = "INSERT INTO versand
|
||||
(adresse, lieferschein, versandunternehmen, gewicht, tracking, tracking_link, anzahlpakete)
|
||||
VALUES
|
||||
({$address['addressId']}, {$address['lieferscheinId']}, '$this->type',
|
||||
'$json->weight', '$result->TrackingNumber', '$result->TrackingUrl', 1)";
|
||||
/* $sql = "INSERT INTO versand
|
||||
(
|
||||
adresse,
|
||||
lieferschein,
|
||||
versandunternehmen,
|
||||
gewicht,
|
||||
tracking,
|
||||
tracking_link,
|
||||
anzahlpakete
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
{$address['addressId']},
|
||||
{$address['lieferscheinId']},
|
||||
'$this->type',
|
||||
'$json->weight',
|
||||
'$result->TrackingNumber',
|
||||
'$result->TrackingUrl',
|
||||
1
|
||||
)";*/
|
||||
$sql = "INSERT INTO versandpakete
|
||||
(
|
||||
lieferschein_ohne_pos,
|
||||
gewicht,
|
||||
tracking,
|
||||
tracking_link
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
{$address['lieferscheinId']},
|
||||
'$json->weight',
|
||||
'$result->TrackingNumber',
|
||||
'$result->TrackingUrl'
|
||||
)";
|
||||
|
||||
$this->app->DB->Insert($sql);
|
||||
|
||||
$filename = $this->app->erp->GetTMP() . join('_', [$this->type, 'Label', $result->TrackingNumber]) . '.pdf';
|
||||
|
@ -1597,11 +1597,14 @@ select a.kundennummer, (SELECT name FROM adresse a2 WHERE a2.kundennummer = a.ku
|
||||
if($artikel_freitext1_suche)
|
||||
{
|
||||
$felder[] = 'art.freifeld1';
|
||||
} else {
|
||||
$artikel_freitext1_suche = 'true';
|
||||
}
|
||||
$subwhere = $this->AjaxFilterWhere($termorig,$felder);
|
||||
$arr = $this->app->DB->SelectArr("SELECT CONCAT(art.nummer,' ',art.name_de) as name FROM artikel art
|
||||
$subwhere = $this->AjaxFilterWhere($termorig,$felder);
|
||||
$sql = "SELECT CONCAT(art.nummer,' ',art.name_de) as name FROM artikel art
|
||||
INNER JOIN $doctype"."_position ap ON ap.artikel = art.id AND $doctype = '$doctypeid'
|
||||
WHERE art.geloescht=0 AND ($artikel_freitext1_suche) AND art.geloescht=0 AND art.intern_gesperrt!=1 LIMIT 20");
|
||||
WHERE art.geloescht=0 AND ($artikel_freitext1_suche) AND art.geloescht=0 AND art.intern_gesperrt!=1 LIMIT 20";
|
||||
$arr = $this->app->DB->SelectArr($sql);
|
||||
$carr = !empty($arr)?count($arr):0;
|
||||
for($i = 0; $i < $carr; $i++) {
|
||||
$newarr[] = $arr[$i]['name'];
|
||||
@ -2479,7 +2482,7 @@ select a.kundennummer, (SELECT name FROM adresse a2 WHERE a2.kundennummer = a.ku
|
||||
$adresse = $this->app->DB->Select("SELECT id FROM adresse WHERE kundennummer = '".$kunde[0]."' AND kundennummer <> '' LIMIT 1");
|
||||
}
|
||||
$beleg = str_replace('kunden','',$filtername);
|
||||
$arr = $this->app->DB->SelectArr("SELECT CONCAT(id,' ',if(belegnr <> '',belegnr,'ENTWURF'),' ',kundennummer,' ',name) as name FROM $beleg WHERE (belegnr LIKE '%$term%' OR name LIKE '%$term%' OR kundennummer LIKE '$%term%') AND (status = 'angelegt' OR status = 'freigegeben')
|
||||
$arr = $this->app->DB->SelectArr("SELECT CONCAT(belegnr,' ',kundennummer,' ',name) as name FROM $beleg WHERE (belegnr <> '') AND (belegnr LIKE '%$term%' OR name LIKE '%$term%' OR kundennummer LIKE '$%term%') AND (status = 'angelegt' OR status = 'freigegeben')
|
||||
".($adresse?" AND adresse = '$adresse' ":'')." ".$this->app->erp->ProjektRechte('projekt')."
|
||||
ORDER by belegnr LIMIT 20");
|
||||
$carr = !empty($arr)?count($arr):0;
|
||||
|
80
www/pages/content/versandpakete_add.tpl
Normal file
80
www/pages/content/versandpakete_add.tpl
Normal file
@ -0,0 +1,80 @@
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-1"></a></li>
|
||||
</ul>
|
||||
<div id="tabs-1">
|
||||
[MESSAGE]
|
||||
<form action="index.php?module=versandpakete&action=add&id=[ID]&lieferschein=[LIEFERSCHEIN_ID]" method="post">
|
||||
[FORMHANDLEREVENT]
|
||||
<div class="row">
|
||||
<div class="row-height">
|
||||
<div class="col-xs-14 col-md-10 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend>{|Hinzufügen von Artikeln aus <a href="index.php?module=lieferschein&action=edit&id=[LIEFERSCHEIN_ID]"><b>Lieferschein [LIEFERSCHEIN]</b></a> zu Versandpaket <b>Nr. [ID]</b>|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr>
|
||||
<td>
|
||||
{|Artikel|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="artikel" id="artikel" value="" size="40" autofocus>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{|Menge|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="menge" id="menge" value="" min="1" 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>{|Aktionen|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr><td><button name="submit" value="hinzufuegen" class="ui-button-icon" style="width:100%;">Hinzufügen</button></td></tr>
|
||||
<tr><td><button name="submit" value="lieferschein_komplett_hinzufuegen" class="ui-button-icon" style="width:100%;">Alle hinzufügen</button></td></tr>
|
||||
<tr><td><button form="back" name="submit" value="fertig" class="ui-button-icon" style="width:100%;">Fertig</button></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row-height">
|
||||
<div class="col-xs-12 col-md-12 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend>{|Lieferscheininhalt|}</legend>
|
||||
[LIEFERSCHEININHALT]
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row-height">
|
||||
<div class="col-xs-12 col-md-12 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend>{|Paketinhalt|}</legend>
|
||||
[PAKETINHALT]
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" name="lieferschein" id="lieferschein" value="[LIEFERSCHEIN]" size="40" hidden>
|
||||
</form>
|
||||
<form action="index.php?module=versandpakete&action=edit&id=[VERSANDPAKET_ID]" id="back" method="post">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
108
www/pages/content/versandpakete_edit.tpl
Normal file
108
www/pages/content/versandpakete_edit.tpl
Normal file
@ -0,0 +1,108 @@
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-1"></a></li>
|
||||
</ul>
|
||||
<div id="tabs-1">
|
||||
[MESSAGE]
|
||||
[FORMHANDLEREVENT]
|
||||
<form id="save" action="" method="post">
|
||||
<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>{|Versandpaket <b>Nr. [ID]</b> vom [DATUM] für Adresse '[ADRESSE]'|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr>
|
||||
<td>
|
||||
{|Status|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="" id="" value="[STATUS]" size="40" disabled>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{|Versender|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="" id="" value="[VERSENDER]" size="40" disabled>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{|Tracking|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="" id="" value="[TRACKING]" size="40" disabled><a href="[TRACKING_LINK]"><img src="themes/new/images/forward.svg" border="0" style="top:6px; position:relative"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{|Gewicht Kg|}:
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" name="gewicht" id="gewicht" min="1" value="[GEWICHT]" size="40">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{|Bemerkung|}:
|
||||
</td>
|
||||
<td>
|
||||
<textarea name="bemerkung" id="bemerkung" rows="3" style="width:100%;">[BEMERKUNG]</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-14 col-md-6 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset [LIEFERSCHEIN_ADD_POS_HIDDEN]>
|
||||
<legend>{|Artikel aus Lieferschein hinzufügen|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr>
|
||||
<td>
|
||||
{|Lieferschein|}:
|
||||
</td>
|
||||
<td>
|
||||
<input form="add" type="text" name="lieferschein" id="lieferschein" value="[LIEFERSCHEIN]" autofocus style="width:99%;">
|
||||
</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>{|Aktionen|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr><td><button form="save" name="submit" value="speichern" class="ui-button-icon" style="width:100%;">Speichern</button></td></tr>
|
||||
<tr [LIEFERSCHEIN_ADD_POS_HIDDEN]><td><button form="add" name="submit" value="lieferschein_hinzufuegen" class="ui-button-icon" style="width:100%;">Artikel hinzufügen</button></td></tr>
|
||||
<tr [LIEFERSCHEIN_ADD_POS_HIDDEN]><td><button form="add" name="submit" value="lieferschein_komplett_hinzufuegen" class="ui-button-icon" style="width:100%;">Kompletten Lieferschein hinzufügen</button></td></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form id="add" action="index.php?module=versandpakete&action=add&id=[ID]" method="post">
|
||||
</form>
|
||||
<div class="row" [LIEFERSCHEIN_POS_HIDDEN]>
|
||||
<div class="row-height">
|
||||
<div class="col-xs-12 col-md-12 col-md-height">
|
||||
<div class="inside inside-full-height">
|
||||
<fieldset>
|
||||
<legend>{|Paketinhalt|}</legend>
|
||||
[PAKETINHALT]
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
10
www/pages/content/versandpakete_lieferscheine.tpl
Normal file
10
www/pages/content/versandpakete_lieferscheine.tpl
Normal file
@ -0,0 +1,10 @@
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-1">[TABTEXT1]</a></li>
|
||||
</ul>
|
||||
<div id="tabs-1">
|
||||
[MESSAGE]
|
||||
[TAB1]
|
||||
[TAB1NEXT]
|
||||
</div>
|
||||
</div>
|
10
www/pages/content/versandpakete_list.tpl
Normal file
10
www/pages/content/versandpakete_list.tpl
Normal file
@ -0,0 +1,10 @@
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-1">[TABTEXT1]</a></li>
|
||||
</ul>
|
||||
<div id="tabs-1">
|
||||
[MESSAGE]
|
||||
[TAB1]
|
||||
[TAB1NEXT]
|
||||
</div>
|
||||
</div>
|
@ -960,6 +960,7 @@ class Lieferschein extends GenLieferschein
|
||||
|
||||
$this->app->Tpl->Set('VERSANDART',$auftragArr[0]['versandart']);
|
||||
|
||||
/*
|
||||
$tracking = $this->app->DB->SelectArr("SELECT
|
||||
if(v.tracking_link IS NOT NULL AND v.tracking_link != '', CONCAT(UPPER(versandunternehmen), ':<a href=\"', v.tracking_link, '\">', v.tracking, '</a>'),
|
||||
if(versandunternehmen = 'dhlexpress' AND l.land = 'DE' AND v.tracking != '', CONCAT(UPPER(versandunternehmen), ':<a href=\"https://www.dhl.de/de/privatkunden/pakete-empfangen/verfolgen.html?piececode=', v.tracking, '\" target=\"_blank\">', v.tracking, '</a>'),
|
||||
@ -1018,7 +1019,30 @@ class Lieferschein extends GenLieferschein
|
||||
if (!is_null($tmp)) {
|
||||
$this->app->Tpl->Set('TRACKING',implode(', ',$tmp));
|
||||
}
|
||||
*/
|
||||
|
||||
$sql = "SELECT SQL_CALC_FOUND_ROWS
|
||||
v.tracking as tracking,
|
||||
v.tracking_link
|
||||
FROM
|
||||
versandpakete v
|
||||
LEFT JOIN
|
||||
versandpaket_lieferschein_position vlp ON v.id = vlp.versandpaket
|
||||
LEFT JOIN
|
||||
lieferschein_position lp ON lp.id = vlp.lieferschein_position
|
||||
LEFT JOIN
|
||||
lieferschein l ON lp.lieferschein = l.id
|
||||
WHERE l.id = ".$id." OR v.lieferschein_ohne_pos = ".$id."
|
||||
GROUP BY
|
||||
v.tracking
|
||||
";
|
||||
$tracking = $this->app->DB->SelectArr($sql);
|
||||
$tracking_list = array();
|
||||
foreach ($tracking as $single_tracking) {
|
||||
$tracking_list[] = '<a href="'.$single_tracking['tracking_link'].'">'.$single_tracking['tracking'].'</a>';
|
||||
}
|
||||
|
||||
$this->app->Tpl->Set('TRACKING',implode(', ',$tracking_list));
|
||||
|
||||
$returnOrders = (array)$this->app->DB->SelectArr(
|
||||
sprintf(
|
||||
|
604
www/pages/versandpakete.php
Normal file
604
www/pages/versandpakete.php
Normal file
@ -0,0 +1,604 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022 OpenXE project
|
||||
*/
|
||||
|
||||
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 SQL_VERSANDPAKETE_LIEFERSCHEIN = "
|
||||
SELECT DISTINCT
|
||||
versandpaket,
|
||||
lieferschein
|
||||
FROM
|
||||
versandpaket_lieferschein_position vlp
|
||||
INNER JOIN lieferschein_position lp ON
|
||||
vlp.lieferschein_position = lp.id
|
||||
UNION
|
||||
SELECT DISTINCT
|
||||
id,
|
||||
lieferschein_ohne_pos AS lieferschein
|
||||
FROM
|
||||
versandpakete
|
||||
WHERE
|
||||
lieferschein_ohne_pos <> 0
|
||||
";
|
||||
|
||||
function __construct($app, $intern = false) {
|
||||
$this->app = $app;
|
||||
if ($intern)
|
||||
return;
|
||||
|
||||
$this->app->ActionHandlerInit($this);
|
||||
$this->app->ActionHandler("list", "versandpakete_list");
|
||||
$this->app->ActionHandler("create", "versandpakete_edit"); // This automatically adds a "New" button
|
||||
$this->app->ActionHandler("edit", "versandpakete_edit");
|
||||
$this->app->ActionHandler("add", "versandpakete_add");
|
||||
$this->app->ActionHandler("lieferscheine", "versandpakete_lieferscheine");
|
||||
$this->app->ActionHandler("delete", "versandpakete_delete");
|
||||
$this->app->ActionHandler("minidetail", "versandpakete_minidetail");
|
||||
$this->app->DefaultActionHandler("list");
|
||||
$this->app->ActionHandlerListen($app);
|
||||
}
|
||||
|
||||
public function Install() {
|
||||
/* Fill out manually later */
|
||||
}
|
||||
|
||||
static function TableSearch(&$app, $name, $erlaubtevars) {
|
||||
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
|
||||
|
||||
// columns that are aligned right (numbers etc)
|
||||
// $alignright = array(4,5,6,7,8);
|
||||
|
||||
$findcols = array('v.id','v.id','v.id','a.name','l.belegnr','v.tracking', 'v.versender', 'v.gewicht', 'v.bemerkung', 'v.status');
|
||||
$searchsql = array('v.versand', 'v.nr', 'v.tracking', 'v.versender', 'v.gewicht', 'v.bemerkung', 'v.status');
|
||||
|
||||
$defaultorder = 1;
|
||||
$defaultorderdesc = 0;
|
||||
|
||||
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',v.id,'\" />') AS `auswahl`";
|
||||
|
||||
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>" . "<a href=\"index.php?module=versandpakete&action=edit&id=%value%\"><img src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\" border=\"0\"></a> <a href=\"#\" onclick=DeleteDialog(\"index.php?module=versandpakete&action=delete&id=%value%\");>" . "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>" . "</td></tr></table>";
|
||||
$menucol = 11;
|
||||
$moreinfo = true; // Allow drop down details
|
||||
|
||||
$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,
|
||||
v.gewicht,
|
||||
v.bemerkung,
|
||||
v.status,
|
||||
v.id
|
||||
FROM
|
||||
versandpakete v
|
||||
LEFT JOIN
|
||||
(".self::SQL_VERSANDPAKETE_LIEFERSCHEIN.") vl ON v.id = vl.versandpaket
|
||||
LEFT JOIN
|
||||
lieferschein l on vl.lieferschein = l.id
|
||||
LEFT JOIN
|
||||
adresse a on a.id = l.adresse
|
||||
";
|
||||
|
||||
$where = "";
|
||||
// $count = "SELECT count(DISTINCT id) FROM versandpakete v WHERE $where";
|
||||
$groupby = "GROUP BY v.id";
|
||||
|
||||
break;
|
||||
case "versandpakete_lieferscheine":
|
||||
|
||||
$allowed['versandpakete_lieferscheine'] = array('lieferscheine');
|
||||
|
||||
$heading = array( 'Lieferschein', 'Adresse','Menge','Menge in Versandpaketen','Paket-Nr.', 'Paket erstellen');
|
||||
$width = array( '10%', '10%', '10%', '10%' ,'10%', '1%'); // Fill out manually later
|
||||
|
||||
// columns that are aligned right (numbers etc)
|
||||
// $alignright = array(4,5,6,7,8);
|
||||
|
||||
$findcols = array('id','id');
|
||||
$searchsql = array('v.versand', 'v.nr', 'v.tracking', 'v.versender', 'v.gewicht', 'v.bemerkung', 'v.status');
|
||||
|
||||
$defaultorder = 1;
|
||||
$defaultorderdesc = 0;
|
||||
|
||||
$menu = "<a href=\"index.php?module=versandpakete&action=add&lieferschein=%value%\"><img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/forward.svg\" border=\"0\"></a>";
|
||||
$menucol = 5;
|
||||
|
||||
$paket_link = array(
|
||||
'<a href="index.php?module=versandpakete&action=edit&id=',
|
||||
['sql' => 'versandpaket'],
|
||||
'">',
|
||||
['sql' => 'versandpaket'],
|
||||
'</a>'
|
||||
);
|
||||
|
||||
$sql = "
|
||||
SELECT
|
||||
id,
|
||||
CONCAT('<a href=\"index.php?module=lieferschein&action=edit&id=',id,'\">',belegnr,'</a>'),
|
||||
name,
|
||||
".$app->erp->FormatMenge("SUM(lmenge)")." as lmenge,
|
||||
".$app->erp->FormatMenge("SUM(vmenge)")." as vmenge,
|
||||
pakete,
|
||||
id
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
l.id,
|
||||
l.belegnr,
|
||||
l.name,
|
||||
lp.menge lmenge,
|
||||
SUM(vlp.menge) vmenge,
|
||||
GROUP_CONCAT(".$app->erp->ConcatSQL($paket_link)." SEPARATOR ', ') as pakete
|
||||
FROM
|
||||
lieferschein l
|
||||
INNER JOIN lieferschein_position lp ON lp.lieferschein = l.id
|
||||
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."')
|
||||
GROUP BY lp.id
|
||||
) l_mengen
|
||||
";
|
||||
|
||||
$where = "";
|
||||
// $count = "SELECT count(DISTINCT id) FROM versandpakete v WHERE $where";
|
||||
$groupby = "GROUP BY id";
|
||||
|
||||
break;
|
||||
case "versandpakete_paketinhalt_list":
|
||||
|
||||
$id = (int) $app->Secure->GetGET('id');
|
||||
|
||||
$allowed['versandpakete_paketinhalt_list'] = array('list');
|
||||
$heading = array('Lieferschein','Pos', 'Artikel', 'Artikel-Nr.','Menge Lieferschein', 'Menge Paket', 'Menü');
|
||||
$width = array('10%','10%','10%'); // Fill out manually later
|
||||
|
||||
// columns that are aligned right (numbers etc)
|
||||
// $alignright = array(4,5,6,7,8);
|
||||
|
||||
$findcols = array('lp.id','v.id','v.id','a.name','l.belegnr','v.tracking', 'v.versender', 'v.gewicht', 'v.bemerkung', 'v.status');
|
||||
$searchsql = array('v.versand', 'v.nr', 'v.tracking', 'v.versender', 'v.gewicht', 'v.bemerkung', 'v.status');
|
||||
|
||||
$defaultorder = 1;
|
||||
$defaultorderdesc = 0;
|
||||
|
||||
$menu = "<a href=\"index.php?module=versandpakete&action=deletepos&pos=%value%\"><img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\"></a>";
|
||||
$menucol = 6;
|
||||
|
||||
$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,
|
||||
".$app->erp->ConcatSQL($lieferschein_link)." as lieferschein,
|
||||
lp.sort,
|
||||
a.name_de,
|
||||
a.nummer,
|
||||
".$app->erp->FormatMenge('lp.menge')." as l_menge,
|
||||
".$app->erp->FormatMenge('SUM(vlp.menge)')." as v_menge,
|
||||
vlp.id
|
||||
FROM
|
||||
versandpakete v
|
||||
INNER JOIN versandpaket_lieferschein_position vlp ON
|
||||
v.id = vlp.versandpaket
|
||||
INNER JOIN lieferschein_position lp ON
|
||||
vlp.lieferschein_position = lp.id
|
||||
INNER JOIN lieferschein l ON
|
||||
lp.lieferschein = l.id
|
||||
INNER JOIN artikel a ON
|
||||
lp.artikel = a.id
|
||||
";
|
||||
|
||||
$where = "v.id =".$id;
|
||||
// $count = "SELECT count(DISTINCT id) FROM versandpakete v WHERE $where";
|
||||
$groupby = "GROUP BY lp.id";
|
||||
break;
|
||||
case "versandpakete_lieferschein_paket_list":
|
||||
|
||||
$lieferschein_id = $app->User->GetParameter('versandpakete_lieferschein');
|
||||
|
||||
$allowed['versandpakete_lieferschein_paket_list'] = array('list');
|
||||
$heading = array('Pos', 'Artikel', 'Artikel-Nr.','Menge Lieferschein', 'Menge in Versandpaketen', 'Paket-Nr.', 'Menü');
|
||||
$width = array('10%','10%','10%'); // Fill out manually later
|
||||
|
||||
// columns that are aligned right (numbers etc)
|
||||
// $alignright = array(4,5,6,7,8);
|
||||
|
||||
$findcols = array('lp.id','lp.id');
|
||||
$searchsql = array('v.versand', 'v.nr', 'v.tracking', 'v.versender', 'v.gewicht', 'v.bemerkung', 'v.status');
|
||||
|
||||
$defaultorder = 1;
|
||||
$defaultorderdesc = 0;
|
||||
|
||||
$menu = "";
|
||||
$menucol = 6;
|
||||
|
||||
$paket_link = array(
|
||||
'<a href="index.php?module=versandpakete&action=edit&id=',
|
||||
['sql' => 'vlp.versandpaket'],
|
||||
'">',
|
||||
['sql' => 'vlp.versandpaket'],
|
||||
'</a>'
|
||||
);
|
||||
|
||||
$sql = "SELECT SQL_CALC_FOUND_ROWS
|
||||
vlp.id,
|
||||
lp.sort,
|
||||
a.name_de,
|
||||
a.nummer,
|
||||
".$app->erp->FormatMenge('lp.menge')." as l_menge,
|
||||
".$app->erp->FormatMenge('SUM(vlp.menge)')." as v_menge,
|
||||
".$app->erp->ConcatSQL($paket_link).",
|
||||
vlp.id
|
||||
FROM lieferschein l
|
||||
INNER JOIN lieferschein_position lp ON
|
||||
lp.lieferschein = l.id
|
||||
INNER JOIN artikel a ON
|
||||
lp.artikel = a.id
|
||||
LEFT JOIN versandpaket_lieferschein_position vlp ON vlp.lieferschein_position = lp.id
|
||||
";
|
||||
|
||||
$where = "l.id =".$lieferschein_id;
|
||||
// $count = "SELECT count(DISTINCT id) FROM versandpakete v WHERE $where";
|
||||
// $groupby = "GROUP BY lp.id";
|
||||
$groupby = "GROUP BY lp.id";
|
||||
break;
|
||||
}
|
||||
|
||||
$erg = false;
|
||||
|
||||
foreach ($erlaubtevars as $k => $v) {
|
||||
if (isset($$v)) {
|
||||
$erg[$v] = $$v;
|
||||
}
|
||||
}
|
||||
return $erg;
|
||||
}
|
||||
|
||||
function versandpakete_menu() {
|
||||
$this->app->erp->MenuEintrag("index.php?module=versandpakete&action=list", "Übersicht");
|
||||
$this->app->erp->MenuEintrag("index.php?module=versandpakete&action=lieferscheine", "Offene Lieferscheine");
|
||||
$this->app->erp->MenuEintrag("index.php?module=versandpakete&action=create", "Neu anlegen");
|
||||
$this->app->erp->MenuEintrag("index.php", "Zurück");
|
||||
}
|
||||
|
||||
function versandpakete_list() {
|
||||
$this->versandpakete_menu();
|
||||
$this->app->YUI->TableSearch('TAB1', 'versandpakete_list', "show", "", "", basename(__FILE__), __CLASS__);
|
||||
$this->app->Tpl->Parse('PAGE', "versandpakete_list.tpl");
|
||||
}
|
||||
|
||||
function versandpakete_lieferscheine() {
|
||||
$this->versandpakete_menu();
|
||||
$this->app->YUI->TableSearch('TAB1', 'versandpakete_lieferscheine', "show", "", "", basename(__FILE__), __CLASS__);
|
||||
$this->app->Tpl->Parse('PAGE', "versandpakete_lieferscheine.tpl");
|
||||
}
|
||||
|
||||
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->Tpl->Set('MESSAGE', "<div class=\"error\">Der Eintrag wurde storniert.</div>");
|
||||
|
||||
$this->versandpakete_list();
|
||||
}
|
||||
|
||||
/*
|
||||
* Edit versandpakete item
|
||||
* If id is empty, create a new one
|
||||
*/
|
||||
|
||||
function versandpakete_edit() {
|
||||
|
||||
$this->versandpakete_menu();
|
||||
|
||||
$id = $this->app->Secure->GetGET('id');
|
||||
|
||||
// Check if other users are editing this id
|
||||
if($this->app->erp->DisableModul('versandpakete',$id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->app->Tpl->Set('ID', $id);
|
||||
$input = $this->GetInput();
|
||||
$submit = $this->app->Secure->GetPOST('submit');
|
||||
|
||||
if (empty($id)) {
|
||||
// New item
|
||||
$id = 'NULL';
|
||||
$input['status'] = self::VERSANDPAKETE_STATUS_NEU;
|
||||
$input['versender'] = $this->app->User->GetName();
|
||||
}
|
||||
|
||||
switch ($submit) {
|
||||
case 'speichern':
|
||||
// Write to database
|
||||
// Add checks here
|
||||
$columns = "id, ";
|
||||
$values = "$id, ";
|
||||
$update = "";
|
||||
$fix = "";
|
||||
foreach ($input as $key => $value) {
|
||||
$columns = $columns.$fix.$key;
|
||||
$values = $values.$fix."'".$value."'";
|
||||
$update = $update.$fix.$key." = '$value'";
|
||||
|
||||
$fix = ", ";
|
||||
}
|
||||
$sql = "INSERT INTO versandpakete (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update;
|
||||
$this->app->DB->Insert($sql);
|
||||
$id = $this->app->DB->GetInsertId();
|
||||
if ($id == 'NULL') {
|
||||
$msg = $this->app->erp->base64_url_encode("<div class=\"success\">Das Element wurde erfolgreich angelegt.</div>");
|
||||
header("Location: index.php?module=versandpakete&action=edit&id=".$id."&msg=$msg");
|
||||
} else {
|
||||
$this->app->Tpl->Set('MESSAGE', "<div class=\"success\">Die Einstellungen wurden erfolgreich übernommen.</div>");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Load values again from database
|
||||
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',v.id,'\" />') 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");
|
||||
|
||||
foreach ($result[0] as $key => $value) {
|
||||
$this->app->Tpl->Set(strtoupper($key), $value);
|
||||
}
|
||||
|
||||
// Check for only one delivery adress
|
||||
$this->app->YUI->AutoComplete("lieferschein", "lieferschein");
|
||||
$sql = "SELECT DISTINCT a.name, l.adresse FROM (".self::SQL_VERSANDPAKETE_LIEFERSCHEIN.") vpl INNER JOIN lieferschein l ON vpl.lieferschein = l.id INNER JOIN adresse a ON l.adresse = a.id WHERE vpl.versandpaket = ".$id;
|
||||
$adress_check = $this->app->DB->SelectArr($sql);
|
||||
if (!empty($adress_check)) {
|
||||
if (count($adress_check) != 1) {
|
||||
// More than one adress for the packet -> error
|
||||
} else {
|
||||
$this->app->Tpl->Set('ADRESSE', $adress_check[0]['name']);
|
||||
$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');
|
||||
$this->app->Tpl->Set('LIEFERSCHEIN_POS_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() {
|
||||
|
||||
$this->versandpakete_menu();
|
||||
|
||||
$id = $this->app->Secure->GetGET('id');
|
||||
if (empty($id)) {
|
||||
$lieferschein = $this->app->Secure->GetGET('lieferschein');
|
||||
if (empty($lieferschein)) {
|
||||
$msg = $this->app->erp->base64_url_encode("<div class=\"error\">Kein Lieferschein angegeben.</div>");
|
||||
header("Location: index.php?module=versandpakete&action=list&msg=$msg");
|
||||
} 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."')";
|
||||
$this->app->DB->Insert($sql);
|
||||
$id = $this->app->DB->GetInsertId();
|
||||
}
|
||||
} else { // $id not empty
|
||||
$lieferschein_input = $this->app->Secure->GetPOST('lieferschein');
|
||||
$lieferschein = $this->app->erp->ReplaceLieferschein(true, $lieferschein_input, true); // Parameters: Target db?, value, from form?
|
||||
$lieferschein_belegnr = $this->app->erp->ReplaceLieferschein(false, $lieferschein_input, true); // Parameters: Target db?, value, from form?
|
||||
if (empty($lieferschein_input)) {
|
||||
$msg = $this->app->erp->base64_url_encode("<div class=\"error\">Kein Lieferschein angegeben.</div>");
|
||||
header("Location: index.php?module=versandpakete&action=edit&id=".$id."&msg=$msg");
|
||||
}
|
||||
}
|
||||
|
||||
// Check if other users are editing this id
|
||||
if($this->app->erp->DisableModul('versandpakete',$id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$artikel_input = $this->app->Secure->GetPOST('artikel');
|
||||
$artikel = $this->app->erp->ReplaceArtikel(true, $artikel_input,true); // Parameters: Target db?, value, from form?
|
||||
|
||||
$menge = $this->app->Secure->GetPOST('menge');
|
||||
$this->app->Tpl->Set('ID', $id);
|
||||
$input = $this->GetInput();
|
||||
$submit = $this->app->Secure->GetPOST('submit');
|
||||
|
||||
// Check Status
|
||||
$sql = "SELECT status FROM versandpakete WHERE id = ".$id." LIMIT 1";
|
||||
$result = $this->app->DB->SelectArr($sql);
|
||||
if ($result[0]['status'] != self::VERSANDPAKETE_STATUS_NEU) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ($submit) {
|
||||
case 'hinzufuegen':
|
||||
|
||||
if ($menge <= 0) {
|
||||
$msg = "<div class=\"error\">Falsche Mengenangabe.</div>";
|
||||
break;
|
||||
}
|
||||
|
||||
// Find a matching lieferschein_position
|
||||
$sql = "SELECT
|
||||
lp.id AS lp_id,
|
||||
MAX(lp.menge) AS lp_menge,
|
||||
SUM(vlp.menge) AS v_menge
|
||||
FROM lieferschein_position lp
|
||||
LEFT JOIN versandpaket_lieferschein_position vlp ON vlp.lieferschein_position = lp.id
|
||||
WHERE lp.lieferschein = ".$lieferschein." AND lp.artikel = ".$artikel."
|
||||
GROUP BY lp.id
|
||||
";
|
||||
|
||||
$lieferschein_positionen = $this->app->DB->SelectArr($sql);
|
||||
if (empty($lieferschein_positionen)) {
|
||||
$msg = "<div class=\"error\">Keine passende Lieferscheinposition gefunden.</div>";
|
||||
break;
|
||||
}
|
||||
|
||||
$buchmenge_gesamt = 0;
|
||||
|
||||
foreach($lieferschein_positionen as $lieferschein_position) {
|
||||
$restmenge = $lieferschein_position['lp_menge']-$lieferschein_position['v_menge'];
|
||||
$buchmenge = $menge;
|
||||
if ($restmenge <= 0) {
|
||||
continue;
|
||||
}
|
||||
if ($menge > $restmenge) {
|
||||
$buchmenge = $restmenge;
|
||||
$menge -= $buchmenge;
|
||||
}
|
||||
|
||||
$sql = "INSERT INTO versandpaket_lieferschein_position (versandpaket, lieferschein_position, menge) VALUES (".$id.",".$lieferschein_position['lp_id'].",".$buchmenge.") ON DUPLICATE KEY UPDATE menge = '".$buchmenge."'";
|
||||
|
||||
$this->app->DB->Insert($sql);
|
||||
$buchmenge_gesamt += $buchmenge;
|
||||
}
|
||||
|
||||
if ($menge != $buchmenge_gesamt) {
|
||||
$msg = "<div class=\"error\">Menge wurde angepasst auf ".$buchmenge_gesamt.".</div>";
|
||||
}
|
||||
|
||||
break;
|
||||
case 'lieferschein_komplett_hinzufuegen':
|
||||
// Find all lieferschein_position
|
||||
$sql = "SELECT
|
||||
lp.id AS lp_id,
|
||||
MAX(lp.menge) AS lp_menge,
|
||||
SUM(vlp.menge) AS v_menge
|
||||
FROM lieferschein_position lp
|
||||
LEFT JOIN versandpaket_lieferschein_position vlp ON vlp.lieferschein_position = lp.id
|
||||
WHERE lp.lieferschein = ".$lieferschein."
|
||||
GROUP BY lp.id
|
||||
";
|
||||
|
||||
$lieferschein_positionen = $this->app->DB->SelectArr($sql);
|
||||
if (empty($lieferschein_positionen)) {
|
||||
$msg = "<div class=\"error\">Keine passende Lieferscheinposition gefunden.</div>";
|
||||
break;
|
||||
}
|
||||
|
||||
foreach($lieferschein_positionen as $lieferschein_position) {
|
||||
$buchmenge = $lieferschein_position['lp_menge']-$lieferschein_position['v_menge'];
|
||||
$sql = "INSERT INTO versandpaket_lieferschein_position (versandpaket, lieferschein_position, menge) VALUES (".$id.",".$lieferschein_position['lp_id'].",".$buchmenge.") ON DUPLICATE KEY UPDATE menge = '".$buchmenge."'";
|
||||
$this->app->DB->Insert($sql);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$this->app->Tpl->Set('LIEFERSCHEIN', $lieferschein_belegnr);
|
||||
$this->app->Tpl->Set('LIEFERSCHEIN_ID', $lieferschein);
|
||||
$this->app->Tpl->Set('VERSANDPAKET_ID', $id);
|
||||
|
||||
$this->app->YUI->AutoComplete("artikel", "artikelnummerbeleg",0,"&doctype=lieferschein&doctypeid=".$lieferschein);
|
||||
|
||||
// For transfer to tablesearch
|
||||
$this->app->User->SetParameter('versandpakete_lieferschein', $lieferschein);
|
||||
$this->app->User->SetParameter('versandpakete_versandpaket', $id);
|
||||
|
||||
$this->app->YUI->TableSearch('LIEFERSCHEININHALT', 'versandpakete_lieferschein_paket_list', "show", "", "", basename(__FILE__), __CLASS__);
|
||||
$this->app->YUI->TableSearch('PAKETINHALT', 'versandpakete_paketinhalt_list', "show", "", "", basename(__FILE__), __CLASS__);
|
||||
$this->app->Tpl->Set('MESSAGE', $msg);
|
||||
$this->app->Tpl->Parse('PAGE', "versandpakete_add.tpl");
|
||||
}
|
||||
|
||||
|
||||
function versandpakete_minidetail() {
|
||||
$id = $this->app->Secure->GetGET('id');
|
||||
$table = new EasyTable($this->app);
|
||||
$table->Query("SELECT SQL_CALC_FOUND_ROWS
|
||||
l.belegnr as Lieferschein,
|
||||
lp.sort as Pos,
|
||||
a.name_de as Artikel,
|
||||
a.nummer as `Artikel-Nr.`,
|
||||
".$this->app->erp->FormatMenge('lp.menge')." as `Menge Lieferschein`,
|
||||
".$this->app->erp->FormatMenge('SUM(vlp.menge)')." as `Menge Paket`
|
||||
FROM
|
||||
versandpakete v
|
||||
INNER JOIN versandpaket_lieferschein_position vlp ON
|
||||
v.id = vlp.versandpaket
|
||||
INNER JOIN lieferschein_position lp ON
|
||||
vlp.lieferschein_position = lp.id
|
||||
INNER JOIN lieferschein l ON
|
||||
lp.lieferschein = l.id
|
||||
INNER JOIN artikel a ON
|
||||
lp.artikel = a.id
|
||||
WHERE vlp.versandpaket = ".$id."
|
||||
GROUP BY
|
||||
l.belegnr, lp.id
|
||||
ORDER BY l.belegnr, lp.sort
|
||||
");
|
||||
$table->DisplayNew('TABLE', 'Menge Paket', 'noAction');
|
||||
$this->app->Tpl->Output('table.tpl');
|
||||
$this->app->ExitXentral();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all paramters from html form and save into $input
|
||||
*/
|
||||
public function GetInput(): array {
|
||||
$input = array();
|
||||
//$input['EMAIL'] = $this->app->Secure->GetPOST('email');
|
||||
|
||||
$input['versand'] = $this->app->Secure->GetPOST('versand');
|
||||
$input['nr'] = $this->app->Secure->GetPOST('nr');
|
||||
$input['tracking'] = $this->app->Secure->GetPOST('tracking');
|
||||
$input['versender'] = $this->app->Secure->GetPOST('versender');
|
||||
$input['gewicht'] = $this->app->Secure->GetPOST('gewicht');
|
||||
$input['bemerkung'] = $this->app->Secure->GetPOST('bemerkung');
|
||||
$input['status'] = $this->app->Secure->GetPOST('status');
|
||||
|
||||
return $input;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set all fields in the page corresponding to $input
|
||||
*/
|
||||
function SetInput($input) {
|
||||
// $this->app->Tpl->Set('EMAIL', $input['email']);
|
||||
|
||||
$this->app->Tpl->Set('VERSAND', $input['versand']);
|
||||
$this->app->Tpl->Set('NR', $input['nr']);
|
||||
$this->app->Tpl->Set('TRACKING', $input['tracking']);
|
||||
$this->app->Tpl->Set('VERSENDER', $input['versender']);
|
||||
$this->app->Tpl->Set('GEWICHT', $input['gewicht']);
|
||||
$this->app->Tpl->Set('BEMERKUNG', $input['bemerkung']);
|
||||
$this->app->Tpl->Set('STATUS', $input['status']);
|
||||
|
||||
}
|
||||
|
||||
}
|
6
www/themes/new/images/sidebar/logistik.svg
Normal file
6
www/themes/new/images/sidebar/logistik.svg
Normal file
@ -0,0 +1,6 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.06267 11.2331H4.76674C4.5067 11.2331 4.2959 11.4439 4.2959 11.7039V14.529C4.2959 14.7891 4.5067 14.9999 4.76674 14.9999H7.59182C7.85186 14.9999 8.06267 14.7891 8.06267 14.529V11.2331Z" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.3584 11.2331H8.0625V14.529C8.0625 14.7891 8.27331 14.9999 8.53335 14.9999H11.3584C11.6185 14.9999 11.8293 14.7891 11.8293 14.529V11.7039C11.8293 11.4439 11.6185 11.2331 11.3584 11.2331Z" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.47512 7.46631H6.65005C6.39 7.46631 6.1792 7.67711 6.1792 7.93716V11.2331H9.94597V7.93716C9.94597 7.67711 9.73517 7.46631 9.47512 7.46631Z" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M15.1254 15V5.2064C15.1255 4.85853 14.9339 4.53892 14.6269 4.37519L8.50592 1.11066C8.22908 0.963114 7.89694 0.963114 7.6201 1.11066L1.4991 4.37519C1.19193 4.53876 1 4.85839 1 5.2064V15" stroke="white" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
Loading…
Reference in New Issue
Block a user