diff --git a/upgrade/data/db_schema.json b/upgrade/data/db_schema.json index 9693c8f0..bd8e12c8 100644 --- a/upgrade/data/db_schema.json +++ b/upgrade/data/db_schema.json @@ -64785,6 +64785,17 @@ "Extra": "", "Privileges": "select,insert,update,references", "Comment": "" + }, + { + "Field": "vorlaeufig", + "Type": "int(1)", + "Collation": null, + "Null": "YES", + "Key": "", + "Default": "", + "Extra": "", + "Privileges": "select,insert,update,references", + "Comment": "" } ], "keys": [ diff --git a/www/pages/content/wareneingang_paketinhalt.tpl b/www/pages/content/wareneingang_paketinhalt.tpl index 3cd14e47..8d00bb78 100644 --- a/www/pages/content/wareneingang_paketinhalt.tpl +++ b/www/pages/content/wareneingang_paketinhalt.tpl @@ -11,9 +11,7 @@ [BEFORETAB1]
- [TAB1START] - [MESSAGE1]
@@ -25,33 +23,52 @@ - - + [ISLIEFERANTSTART] + + [ISLIEFERANTENDE]
{|Lieferschein-Nr.|}:
{|Rechnung-Nr.|}:
{|Ziellager|}:
{|Bemerkung|}:
{|Ziellager|}:
-
- {|Aktionen|} - [BUTTONS] - [BEFOREFRM] - [AFTERFRM] - [DISTRIINHALTBUTTONS] - [ISLIEFERANTSTART] - - [ISLIEFERANTENDE] - [BEFOREMANUELLERFASSEN] - - [AFTERMANUELLERFASSEN] - [BEFOREFRM] - [AFTERFRM] - - - +
+ [BUTTONS] + [BEFOREFRM] + [AFTERFRM] + [DISTRIINHALTBUTTONS] + [BEFOREFRM] + [AFTERFRM] + + {|Aktionen|} + [BEFOREMANUELLERFASSEN] + + [AFTERMANUELLERFASSEN] + [ISLIEFERANTSTART] + + [ISLIEFERANTENDE] + + [ISLIEFERANTSTART] + + [ISLIEFERANTENDE] + +
+ +
+ +
+ +
+ +
@@ -61,9 +78,7 @@
- - [TAB1] - + [TAB1]
diff --git a/www/pages/wareneingang.php b/www/pages/wareneingang.php index 3cb199bf..3039cf49 100644 --- a/www/pages/wareneingang.php +++ b/www/pages/wareneingang.php @@ -117,6 +117,9 @@ class Wareneingang { $input_for_menge = "CONCAT( 'app->erp->FormatMenge("sum(paketdistribution.menge)")." as menge, paketdistribution.bemerkung - FROM paketdistribution - INNER JOIN artikel ON artikel.id = paketdistribution.artikel - LEFT JOIN bestellung_position ON bestellung_position = bestellung_position.id - LEFT JOIN bestellung on bestellung_position.bestellung = bestellung.id - where paketannahme = $id GROUP BY bestellung_position, paketdistribution.artikel) as p"; */ - + $sql = "SELECT SQL_CALC_FOUND_ROWS p.nummer,p.lieferantnummer, p.nummer, p.bestellbezug, p.name, p.menge, p.bemerkung from (SELECT bestellung.belegnr as bestellbezug, bestellung_position.bestellnummer as lieferantnummer ,artikel.nummer as nummer, artikel.name_de as name, " . $this->app->erp->FormatMenge("paketdistribution.menge") . " as menge, paketdistribution.bemerkung FROM paketdistribution INNER JOIN artikel ON artikel.id = paketdistribution.artikel LEFT JOIN bestellung_position ON bestellung_position = bestellung_position.id LEFT JOIN bestellung on bestellung_position.bestellung = bestellung.id - where paketannahme = $id) as p"; + where paketannahme = $id AND vorlaeufig IS NULL) as p"; $where = ""; - $count = "SELECT count(DISTINCT id) FROM paketdistribution p WHERE paketannahme = $id"; + $count = "SELECT count(DISTINCT id) FROM paketdistribution p WHERE paketannahme = $id AND vorlaeufig IS NULL"; // $groupby = ""; break; - case "paketannahme_list": - /* $allowed['paketdistribution_list'] = array('list'); - $heading = array('bearbeiter', 'zeit', 'paketannahme', 'adresse', 'artikel', 'menge', 'vpe', 'etiketten', 'bemerkung', 'bestellung_position', 'logdatei', 'retoure_position', 'Menü'); - $width = array('10%'); // Fill out manually later - - $findcols = array('bearbeiter', 'zeit', 'paketannahme', 'adresse', 'artikel', 'menge', 'vpe', 'etiketten', 'bemerkung', 'bestellung_position', 'logdatei', 'retoure_position'); - $searchsql = array('bearbeiter', 'zeit', 'paketannahme', 'adresse', 'artikel', 'menge', 'vpe', 'etiketten', 'bemerkung', 'bestellung_position', 'logdatei', 'retoure_position'); - - $defaultorder = 1; - $defaultorderdesc = 0; - - $menu = "
" . "Conf->WFconf['defaulttheme']}/images/edit.png\" border=\"0\"> " . "Conf->WFconf['defaulttheme']}/images/delete.svg\" border=\"0\">" . "
"; - - $sql = "SELECT id, bearbeiter, zeit, paketannahme, adresse, artikel, menge, vpe, etiketten, bemerkung, bestellung_position, logdatei, retoure_position, id FROM paketdistribution"; - - $where = "1"; - $count = "SELECT count(DISTINCT id) FROM paketdistribution WHERE $where"; - // $groupby = ""; - */ + case "paketannahme_list": $allowed['paketannahme_list'] = array('list'); $heading = array('', 'Paket-Nr.', 'Datum', 'Status', 'Name', 'Kunde', 'Lieferant', 'Bestellung', 'LS-Nr.', 'RE-Nr.', 'Bearbeiter', 'Bemerkung', 'Menü'); $width = array('1%', '5%', '10%', '10%', '10%', '10%', '10%', '10%', '10%', '10%', '10%'); // Fill out manually later @@ -1648,7 +1625,7 @@ class Wareneingang { } public function WareneingangPaketDistriInhalt() { - $this->WareneingangPaketMenu(); + $this->WareneingangPaketMenu(); $id = $this->app->Secure->GetGET('id'); $cmd = $this->app->Secure->GetGET('cmd'); @@ -1792,13 +1769,78 @@ class Wareneingang { '$bemerkung', '$bestellposition' )"; - $this->app->DB->Insert($sql); + $this->app->DB->Insert($sql); + + // Remove existing preliminary value + $sql = "DELETE FROM paketdistribution WHERE paketannahme = ".$id." AND bestellung_position = ".$bestellposition." AND vorlaeufig = 1"; + $this->app->DB->Delete($sql); + } } } break; case 'speichern': + $menge_input = $this->app->Secure->GetPOSTArray(); + $mengen = array(); + + $msg = ""; + + foreach ($menge_input as $key => $menge) { + if ((strpos($key,'menge_') === 0) && ($menge !== '')) { + $bestellposition = substr($key,'6'); + if ($menge > 0) { + + // Gather info bestellung + $bparr = $this->app->DB->SelectRow("SELECT * FROM bestellung INNER JOIN bestellung_position ON bestellung_position.bestellung = bestellung.id INNER JOIN artikel ON bestellung_position.artikel = artikel.id WHERE bestellung_position.id='$bestellposition' LIMIT 1"); + $artikel = $bparr['artikel']; + $artikel_nr = $bparr['nummer']; + $projekt = $bparr['projekt']; + $bestellung_belegnr = $bparr['belegnr']; + $vpe = $bparr['vpe']; + $menge_bestellung = $bparr['menge']; + + // Check existing preliminary value + $sql = "SELECT id FROM paketdistribution WHERE paketannahme = ".$id." AND bestellung_position = ".$bestellposition." AND vorlaeufig = 1 LIMIT 1"; + $preliminary = $this->app->DB->Select($sql); + + if (empty($preliminary)) { + $sql = "INSERT INTO paketdistribution( + id, + bearbeiter, + zeit, + paketannahme, + adresse, + artikel, + menge, + vpe, + etiketten, + bemerkung, + bestellung_position, + vorlaeufig + ) + VALUES( + '', + '" . $this->app->User->GetName() . "', + NOW(), + '$id', + '', + '$artikel', + '$menge', + '$vpe', + '', + '$bemerkung', + '$bestellposition', + 1 + )"; + $this->app->DB->Insert($sql); + } else { + $sql = "UPDATE paketdistribution SET menge = ".$menge." WHERE id = ".$preliminary; + $this->app->DB->Insert($sql); + } + } + } + } break; case 'abschliessen': break; @@ -1899,11 +1941,11 @@ class Wareneingang { if ($isSupplier) { //$this->app->Tpl->Set('TAB1TEXT','
  • Bestellungen
  • '); - $this->app->Tpl->Set('TAB1TEXT', 'Bestellungen'); + //$this->app->Tpl->Set('TAB1TEXT', 'Bestellungen'); //$this->app->Tpl->Set('TAB1START','
    '); //$this->app->Tpl->Set('TAB1ENDE','
    '); - $this->app->Tpl->Add('TAB1', "

    Offene Artikel aus Bestellungen bei $name:


    "); + $this->app->Tpl->Add('TAB1', "

    Offene Artikel aus Bestellungen bei $name:

    "); $this->app->YUI->TableSearch('TAB1', 'wareneingang_lieferant', 'show', '', '', basename(__FILE__), __CLASS__); } else { $this->app->Tpl->Set('ISLIEFERANTSTART', '