versandpakete intermediate

This commit is contained in:
OpenXE 2023-10-18 14:35:35 +02:00
parent b171dd7760
commit e899b1c389
9 changed files with 324 additions and 52 deletions

View File

@ -3614,6 +3614,79 @@ class YUI {
'</td></tr></table>')"; '</td></tr></table>')";
} }
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 = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/summe_stop.png\" title=\"Kein Lieferschein\" border=\"0\" style=\"margin-right:1px\">";
$lieferschein_ohne_pos = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/summe_go.png\" title=\"Lieferschein ohne Positionen\" border=\"0\" style=\"margin-right:1px\">";
$lieferschein_voll = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/lagergo.png\" title=\"Lieferschein vollst&auml;ndig\" border=\"0\" style=\"margin-right:1px\">";
$lieferschein_teil = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/lagergo_stop.png\" title=\"Lieferschein teilweise\" border=\"0\" style=\"margin-right:1px\">";
$versendet = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/liefersperrego.png\" title=\"Versendet\" border=\"0\" style=\"margin-right:1px\">";
$versendet_nicht = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/liefersperrestop.png\" title=\"Nicht versendet\" border=\"0\" style=\"margin-right:1px\">";
$paketmarke = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/portogo.png\" style=\"margin-right:1px\" title=\"Paketmarke\" border=\"0\">";
$paketmarke_keine = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/portostop.png\" style=\"margin-right:1px\" title=\"Keine Paketmarke\" border=\"0\">";
$ausgeliefert = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/grey.png\" style=\"margin-right:1px\" title=\"Ausgeliefert\" border=\"0\">";
$ausgeliefert_nicht = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/nicht_eingelagert.png\" style=\"margin-right:1px\" title=\"Nicht ausgeliefert\" border=\"0\">";
$storno = "<img src=\"./themes/{$this->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('<table><tr><td nowrap>',
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,
'</td></tr></table>')";
}
function TablePositionSearch($parsetarget, $name, $callback = "show", $gener) { function TablePositionSearch($parsetarget, $name, $callback = "show", $gener) {
$id = $this->app->Secure->GetGET("id"); $id = $this->app->Secure->GetGET("id");

View File

@ -112662,7 +112662,7 @@
} }
] ]
}, },
{ {
"name": "versandpaket_lieferschein_position", "name": "versandpaket_lieferschein_position",
"collation": "utf8mb3_general_ci", "collation": "utf8mb3_general_ci",
"type": "BASE TABLE", "type": "BASE TABLE",
@ -112952,6 +112952,17 @@
"Privileges": "select,insert,update,references", "Privileges": "select,insert,update,references",
"Comment": "" "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", "Field": "lieferschein_ohne_pos",
"Type": "int(11)", "Type": "int(11)",

View File

@ -22896,9 +22896,6 @@ function ChargenMHDAuslagern($artikel, $menge, $lagerplatztyp, $lpid,$typ,$wert,
return $this->GetSelectDokumentKunde("arbeitsnachweis",$adresse,$select); return $this->GetSelectDokumentKunde("arbeitsnachweis",$adresse,$select);
} }
function GetSelectAnsprechpartner($adresse, $selected="") function GetSelectAnsprechpartner($adresse, $selected="")
{ {
$first = $this->app->DB->Select("SELECT CONCAT(ansprechpartner,' &lt;',email,'&gt;') FROM adresse WHERE id='$adresse' AND geloescht=0 LIMIT 1"); $first = $this->app->DB->Select("SELECT CONCAT(ansprechpartner,' &lt;',email,'&gt;') FROM adresse WHERE id='$adresse' AND geloescht=0 LIMIT 1");
@ -22915,7 +22912,7 @@ function ChargenMHDAuslagern($artikel, $menge, $lagerplatztyp, $lpid,$typ,$wert,
$tpl .="<option value=\"".$others[$i]['id']."\" $mark>{$others[$i]['name']}</option>"; $tpl .="<option value=\"".$others[$i]['id']."\" $mark>{$others[$i]['name']}</option>";
} }
return $tpl; return $tpl;
} }
function GetVorgaenger($projekt,$disableid="") function GetVorgaenger($projekt,$disableid="")
{ {

View File

@ -75,7 +75,8 @@ abstract class Versanddienstleister
$ret['lieferscheinId'] = $lieferscheinId; $ret['lieferscheinId'] = $lieferscheinId;
$addressfields = ['name', 'adresszusatz', 'abteilung', 'ansprechpartner', 'unterabteilung', 'ort', 'plz', $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['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']); $ret['name'] = empty(trim($docArr['ansprechpartner'])) ? trim($docArr['name']) : trim($docArr['ansprechpartner']);
@ -403,14 +404,18 @@ abstract class Versanddienstleister
lieferschein_ohne_pos, lieferschein_ohne_pos,
gewicht, gewicht,
tracking, tracking,
tracking_link tracking_link,
status,
versandart
) )
VALUES VALUES
( (
{$address['lieferscheinId']}, {$address['lieferscheinId']},
'$json->weight', '$json->weight',
'$result->TrackingNumber', '$result->TrackingNumber',
'$result->TrackingUrl' '$result->TrackingUrl',
'versendet',
'$this->type'
)"; )";
$this->app->DB->Insert($sql); $this->app->DB->Insert($sql);

View File

@ -22,7 +22,7 @@
<tr><td class="auftraginfo_cell">Projekt:</td><td class="auftraginfo_cell">[PROJEKT]</td><td class="auftraginfo_cell">Angebotssumme:</td><td class="auftraginfo_cell">[GESAMTSUMME]</td></tr> <tr><td class="auftraginfo_cell">Projekt:</td><td class="auftraginfo_cell">[PROJEKT]</td><td class="auftraginfo_cell">Angebotssumme:</td><td class="auftraginfo_cell">[GESAMTSUMME]</td></tr>
<tr><td class="auftraginfo_cell">Auftrag:</td><td class="auftraginfo_cell">[AUFTRAG]</td><td class="auftraginfo_cell">Versteuerung:</td><td class="auftraginfo_cell">[STEUER]</td></tr> <tr><td class="auftraginfo_cell">Auftrag:</td><td class="auftraginfo_cell">[AUFTRAG]</td><td class="auftraginfo_cell">Versteuerung:</td><td class="auftraginfo_cell">[STEUER]</td></tr>
<tr><td class="auftraginfo_cell">Rechnung:</td><td class="auftraginfo_cell">[RECHNUNG]</td><td class="auftraginfo_cell">Gewicht (netto):</td><td class="auftraginfo_cell">[GEWICHT]</td></tr> <tr><td class="auftraginfo_cell">Rechnung:</td><td class="auftraginfo_cell">[RECHNUNG]</td><td class="auftraginfo_cell">Gewicht (netto):</td><td class="auftraginfo_cell">[GEWICHT]</td></tr>
<tr><td class="auftraginfo_cell">Tracking:</td><td class="auftraginfo_cell">[TRACKING]</td><td class="auftraginfo_cell">Versandart:</td><td class="auftraginfo_cell">[VERSANDART]</td></tr> <tr><td class="auftraginfo_cell">Pakete:</td><td class="auftraginfo_cell">[TRACKING]</td><td class="auftraginfo_cell">Versandart:</td><td class="auftraginfo_cell">[VERSANDART]</td></tr>
<tr><td class="auftraginfo_cell">Retoure:</td><td class="auftraginfo_cell">[RETOURE]</td><td class="auftraginfo_cell"></td><td class="auftraginfo_cell"></td></tr> <tr><td class="auftraginfo_cell">Retoure:</td><td class="auftraginfo_cell">[RETOURE]</td><td class="auftraginfo_cell"></td><td class="auftraginfo_cell"></td></tr>
</table> </table>

View File

@ -28,7 +28,15 @@
<td> <td>
<input type="text" name="" id="" value="[VERSENDER]" size="40" disabled> <input type="text" name="" id="" value="[VERSENDER]" size="40" disabled>
</td> </td>
</tr> </tr>
<tr>
<td>
{|Versandart|}:
</td>
<td>
<input type="text" name="" id="" value="[VERSANDART]" size="40" disabled>
</td>
</tr>
<tr> <tr>
<td> <td>
{|Tracking|}: {|Tracking|}:
@ -42,7 +50,7 @@
{|Gewicht Kg|}: {|Gewicht Kg|}:
</td> </td>
<td> <td>
<input type="number" name="gewicht" id="gewicht" min="1" value="[GEWICHT]" size="40"> <input type="number" name="gewicht" id="gewicht" min="1" value="[GEWICHT]" size="40" [LIEFERSCHEIN_GEWICHT_DISABLED]>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -71,7 +79,21 @@
</td> </td>
</tr> </tr>
</table> </table>
</fieldset> </fieldset>
<fieldset [LIEFERSCHEIN_OHNE_POS_HIDDEN]>
<legend>{|Lieferschein|}</legend>
<table width="100%" border="0" class="mkTableFormular">
<tr>
<td>
{|Lieferschein|}:
</td>
<td>
<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>
</td>
</tr>
</table>
</fieldset>
</div> </div>
</div> </div>
<div class="col-xs-14 col-md-2 col-md-height"> <div class="col-xs-14 col-md-2 col-md-height">
@ -82,6 +104,7 @@
<tr><td><button form="save" name="submit" value="speichern" class="ui-button-icon" style="width:100%;">Speichern</button></td></tr> <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&uuml;gen</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&uuml;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&uuml;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&uuml;gen</button></td></tr>
<tr [PAKETMARKE_HIDDEN]><td><button form="paketmarke" name="submit" value="paketmarke" class="ui-button-icon" style="width:100%;">Parketmarke drucken und absenden</button></td></tr>
</table> </table>
</fieldset> </fieldset>
</div> </div>
@ -91,6 +114,8 @@
</form> </form>
<form id="add" action="index.php?module=versandpakete&action=add&id=[ID]" method="post"> <form id="add" action="index.php?module=versandpakete&action=add&id=[ID]" method="post">
</form> </form>
<form id="paketmarke" action="index.php?module=versandpakete&action=paketmarke&id=[ID]" method="post">
</form>
<div class="row" [LIEFERSCHEIN_POS_HIDDEN]> <div class="row" [LIEFERSCHEIN_POS_HIDDEN]>
<div class="row-height"> <div class="row-height">
<div class="col-xs-12 col-md-12 col-md-height"> <div class="col-xs-12 col-md-12 col-md-height">

View File

@ -4,7 +4,50 @@
</ul> </ul>
<div id="tabs-1"> <div id="tabs-1">
[MESSAGE] [MESSAGE]
[TAB1] <div class="filter-box filter-usersave">
<div class="filter-block filter-inline">
<div class="filter-title">{|Filter|}</div>
<ul class="filter-list">
[STATUSFILTER]
<li class="filter-item">
<label for="geschlossene" class="switch">
<input type="checkbox" id="geschlossene">
<span class="slider round"></span>
</label>
<label for="geschlossene">{|Zzgl. abgeschlossen|}</label>
</li>
<li class="filter-item">
<label for="stornierte" class="switch">
<input type="checkbox" id="stornierte">
<span class="slider round"></span>
</label>
<label for="stornierte">{|Zzgl. Papierkorb|}</label>
</li>
</ul>
</div>
</div>
<form action="index.php?module=versandpakete&action=stapelverarbeitung" id="frmauto" name="frmauto" method="post">
[TAB1]
<fieldset>
<table>
<legend>Stapelverarbeitung</legend>
<tr>
<tr><td>{|Status|}:</td><td><select name="status">[STATUS_OPTIONS]</select></td></tr>
<td><input type="checkbox" value="1" id="autoalle" />&nbsp;alle markieren&nbsp;</td><td><input type="submit" class="btnBlue" name="status_setzen" value="{|Status setzen|}" /></td>
</tr>
</table>
</fieldset>
</form>
[TAB1NEXT] [TAB1NEXT]
</div> </div>
</div> </div>
<script>
$('#autoalle').on('change',function(){
var wert = $(this).prop('checked');
$('#versandpakete_list').find('input[type="checkbox"]').prop('checked',wert);
$('#versandpakete_list').find('input[type="checkbox"]').first().trigger('change');
});
</script>

View File

@ -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 as tracking,
v.tracking_link v.tracking_link
FROM FROM
@ -1034,15 +1035,16 @@ class Lieferschein extends GenLieferschein
lieferschein l ON lp.lieferschein = l.id lieferschein l ON lp.lieferschein = l.id
WHERE l.id = ".$id." OR v.lieferschein_ohne_pos = ".$id." WHERE l.id = ".$id." OR v.lieferschein_ohne_pos = ".$id."
GROUP BY GROUP BY
v.tracking v.id
"; ";
$tracking = $this->app->DB->SelectArr($sql); $tracking = $this->app->DB->SelectArr($sql);
$tracking_list = array(); $tracking_list = array();
foreach ($tracking as $single_tracking) { foreach ($tracking as $single_tracking) {
$tracking_list[] = '<a href="'.$single_tracking['tracking_link'].'">'.$single_tracking['tracking'].'</a>'; $tracking_list[] = '<a href="index.php?module=versandpakete&action=edit&id='.$single_tracking['id'].'">Paket Nr.'.$single_tracking['id'].'</a>'.
' ('.'<a href="'.$single_tracking['tracking_link'].'">'.$single_tracking['tracking'].'</a>'.')';
} }
$this->app->Tpl->Set('TRACKING',implode(', ',$tracking_list)); $this->app->Tpl->Set('TRACKING',implode('<br>',$tracking_list));
$returnOrders = (array)$this->app->DB->SelectArr( $returnOrders = (array)$this->app->DB->SelectArr(
sprintf( sprintf(

View File

@ -8,10 +8,7 @@ use Xentral\Components\Database\Exception\QueryFailureException;
class Versandpakete { class Versandpakete {
const VERSANDPAKETE_STATUS_NEU = 'neu'; const STATUS = ARRAY ('neu','versendet','abgeschlossen','storniert');
const VERSANDPAKETE_STATUS_VERSENDET = 'versendet';
const VERSANDPAKETE_STATUS_ABGESCHLOSSEN = 'abgeschlossen';
const VERSANDPAKETE_STATUS_STORNIERT = 'storniert';
const SQL_VERSANDPAKETE_LIEFERSCHEIN = " const SQL_VERSANDPAKETE_LIEFERSCHEIN = "
SELECT DISTINCT SELECT DISTINCT
@ -42,6 +39,8 @@ class Versandpakete {
$this->app->ActionHandler("edit", "versandpakete_edit"); $this->app->ActionHandler("edit", "versandpakete_edit");
$this->app->ActionHandler("add", "versandpakete_add"); $this->app->ActionHandler("add", "versandpakete_add");
$this->app->ActionHandler("lieferscheine", "versandpakete_lieferscheine"); $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("delete", "versandpakete_delete");
$this->app->ActionHandler("minidetail", "versandpakete_minidetail"); $this->app->ActionHandler("minidetail", "versandpakete_minidetail");
$this->app->DefaultActionHandler("list"); $this->app->DefaultActionHandler("list");
@ -56,8 +55,8 @@ class Versandpakete {
switch ($name) { switch ($name) {
case "versandpakete_list": case "versandpakete_list":
$allowed['versandpakete_list'] = array('list'); $allowed['versandpakete_list'] = array('list');
$heading = array('','', 'Paket-Nr.','Datum','Adresse', 'Lieferschein', 'Tracking', 'Versender', 'Gewicht', 'Bemerkung', 'Status', 'Men&uuml;'); $heading = array('','', 'Paket-Nr.','Datum','Adresse', 'Lieferschein', 'Versandart', 'Tracking', 'Gewicht','Versender', 'Bemerkung', 'Status', 'Monitor', 'Men&uuml;');
$width = array('1%','1%','10%'); // Fill out manually later $width = array('1%','1%','1%'); // Fill out manually later
// columns that are aligned right (numbers etc) // columns that are aligned right (numbers etc)
// $alignright = array(4,5,6,7,8); // $alignright = array(4,5,6,7,8);
@ -71,21 +70,39 @@ class Versandpakete {
$dropnbox = "'<img src=./themes/new/images/details_open.png class=details>' AS `open`, CONCAT('<input type=\"checkbox\" name=\"auswahl[]\" value=\"',v.id,'\" />') AS `auswahl`"; $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>&nbsp;<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>"; $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>&nbsp;<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; $menucol = 12;
$moreinfo = true; // Allow drop down details $moreinfo = true; // Allow drop down details
$lieferschein_link = array(
'<a href="index.php?module=lieferschein&action=edit&id=',
['sql' => 'l.id'],
'">',
['sql' => 'l.belegnr'],
'</a>'
);
$tracking_link = array(
'<a href="',
['sql' => 'v.tracking_link'],
'">',
['sql' => 'v.tracking'],
'</a>'
);
$sql = "SELECT SQL_CALC_FOUND_ROWS $sql = "SELECT SQL_CALC_FOUND_ROWS
v.id, v.id,
$dropnbox, $dropnbox,
v.id, v.id,
".$app->erp->FormatDateTimeShort('v.datum').", ".$app->erp->FormatDateTimeShort('v.datum').",
a.name, a.name,
GROUP_CONCAT(DISTINCT l.belegnr SEPARATOR ', ') as lieferschein, GROUP_CONCAT(DISTINCT ".$app->erp->ConcatSQL($lieferschein_link)." SEPARATOR ', ') as lieferschein,
v.tracking, ".$app->erp->FormatUCfirst('v.versandart')." as versandart,
v.versender, ".$app->erp->ConcatSQL($tracking_link)." as tracking_link,
v.gewicht, v.gewicht,
v.versender,
v.bemerkung, v.bemerkung,
v.status, v.status,
".$app->YUI->IconsSQL_versandpaket().",
v.id v.id
FROM FROM
versandpakete v versandpakete v
@ -94,10 +111,48 @@ class Versandpakete {
LEFT JOIN LEFT JOIN
lieferschein l on vl.lieferschein = l.id lieferschein l on vl.lieferschein = l.id
LEFT JOIN 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"; // $count = "SELECT count(DISTINCT id) FROM versandpakete v WHERE $where";
$groupby = "GROUP BY v.id"; $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 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
WHERE 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 GROUP BY lp.id
) l_mengen ) l_mengen
"; ";
@ -285,12 +340,40 @@ class Versandpakete {
$this->app->erp->MenuEintrag("index.php", "Zur&uuml;ck"); $this->app->erp->MenuEintrag("index.php", "Zur&uuml;ck");
} }
function versandpakete_list() { function versandpakete_list() {
$this->versandpakete_menu(); $this->versandpakete_menu();
// Status select
$options_text = "";
foreach (self::STATUS as $status)
{
$options_text .= "<option value=\"".$status."\">".$status."</option>";
}
$this->app->Tpl->Set('STATUS_OPTIONS', $options_text);
$this->app->YUI->TableSearch('TAB1', 'versandpakete_list', "show", "", "", basename(__FILE__), __CLASS__); $this->app->YUI->TableSearch('TAB1', 'versandpakete_list', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->Tpl->Parse('PAGE', "versandpakete_list.tpl"); $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() { function versandpakete_lieferscheine() {
$this->versandpakete_menu(); $this->versandpakete_menu();
$this->app->YUI->TableSearch('TAB1', 'versandpakete_lieferscheine', "show", "", "", basename(__FILE__), __CLASS__); $this->app->YUI->TableSearch('TAB1', 'versandpakete_lieferscheine', "show", "", "", basename(__FILE__), __CLASS__);
@ -300,7 +383,7 @@ class Versandpakete {
public function versandpakete_delete() { public function versandpakete_delete() {
$id = (int) $this->app->Secure->GetGET('id'); $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', "<div class=\"error\">Der Eintrag wurde storniert.</div>"); $this->app->Tpl->Set('MESSAGE', "<div class=\"error\">Der Eintrag wurde storniert.</div>");
$this->versandpakete_list(); $this->versandpakete_list();
@ -329,8 +412,9 @@ class Versandpakete {
if (empty($id)) { if (empty($id)) {
// New item // New item
$new_item = true;
$id = 'NULL'; $id = 'NULL';
$input['status'] = self::VERSANDPAKETE_STATUS_NEU; $input['status'] = 'neu';
$input['versender'] = $this->app->User->GetName(); $input['versender'] = $this->app->User->GetName();
} }
@ -358,12 +442,12 @@ class Versandpakete {
} else { } else {
$this->app->Tpl->Set('MESSAGE', "<div class=\"success\">Die Einstellungen wurden erfolgreich &uuml;bernommen.</div>"); $this->app->Tpl->Set('MESSAGE', "<div class=\"success\">Die Einstellungen wurden erfolgreich &uuml;bernommen.</div>");
} }
break; break;
} }
// Load values again from database // 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`"; $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"); $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) { foreach ($result[0] as $key => $value) {
$this->app->Tpl->Set(strtoupper($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']); $this->app->YUI->AutoComplete("lieferschein", "kundenlieferschein",0,"&adresse=".$adress_check[0]['adresse']);
} }
} }
if ($new_item) {
$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->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->YUI->TableSearch('PAKETINHALT', 'versandpakete_paketinhalt_list', "show", "", "", basename(__FILE__), __CLASS__);
$this->app->Tpl->Parse('PAGE', "versandpakete_edit.tpl"); $this->app->Tpl->Parse('PAGE', "versandpakete_edit.tpl");
} }
function versandpakete_add() { function versandpakete_add() {
$this->versandpakete_menu(); $this->versandpakete_menu();
$id = $this->app->Secure->GetGET('id'); $id = $this->app->Secure->GetGET('id');
if (empty($id)) { if (empty($id)) {
$lieferschein = $this->app->Secure->GetGET('lieferschein'); $lieferschein = $this->app->Secure->GetGET('lieferschein');
@ -410,7 +502,7 @@ class Versandpakete {
} 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 */ /* 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); $this->app->DB->Insert($sql);
$id = $this->app->DB->GetInsertId(); $id = $this->app->DB->GetInsertId();
} }
@ -439,9 +531,12 @@ class Versandpakete {
$submit = $this->app->Secure->GetPOST('submit'); $submit = $this->app->Secure->GetPOST('submit');
// Check Status // 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); $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; return;
} }
@ -565,8 +660,29 @@ class Versandpakete {
$table->DisplayNew('TABLE', 'Menge Paket', 'noAction'); $table->DisplayNew('TABLE', 'Menge Paket', 'noAction');
$this->app->Tpl->Output('table.tpl'); $this->app->Tpl->Output('table.tpl');
$this->app->ExitXentral(); $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 * Get all paramters from html form and save into $input
*/ */