Wareneingang added empty and fill from bestellung

This commit is contained in:
OpenXE 2023-10-04 12:31:02 +02:00
parent bdb05c747a
commit b2bf2f14f2
2 changed files with 50 additions and 4 deletions

View File

@ -48,14 +48,12 @@
</td></tr> </td></tr>
[AFTERMANUELLERFASSEN] [AFTERMANUELLERFASSEN]
[ISLIEFERANTSTART] [ISLIEFERANTSTART]
<!--
<tr><td> <tr><td>
<button name="submit" class="ui-button-icon" style="width:100%;" value="fuellen">{|Aus Bestellungen f&uuml;llen|}</button> <button name="submit" class="ui-button-icon" style="width:100%;" value="fuellen">{|Aus Bestellungen f&uuml;llen|}</button>
</td></tr> </td></tr>
<tr><td> <tr><td>
<button name="submit" class="ui-button-icon" style="width:100%;" value="leeren">{|Leeren|}</button> <button name="submit" class="ui-button-icon" style="width:100%;" value="leeren">{|Leeren|}</button>
</td></tr> </td></tr>
-->
[ISLIEFERANTENDE] [ISLIEFERANTENDE]
<tr><td> <tr><td>
<button name="submit" class="ui-button-icon" style="width:100%;" value="speichern">{|Speichern|}</button> <button name="submit" class="ui-button-icon" style="width:100%;" value="speichern">{|Speichern|}</button>

View File

@ -1691,8 +1691,56 @@ class Wareneingang {
switch ($submit) { switch ($submit) {
case 'fuellen': case 'fuellen':
// Get bestellung_position from form
$form_input = $this->app->Secure->GetPOSTArray();
foreach ($form_input as $key => $menge) {
if ((strpos($key,'menge_') === 0)) {
$bestellposition = substr($key,'6');
// Remove existing preliminary value
$sql = "DELETE FROM paketdistribution WHERE paketannahme = ".$id." AND bestellung_position = ".$bestellposition." AND vorlaeufig = 1";
$this->app->DB->Delete($sql);
// Write paketdistribution
$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',
(SELECT menge-geliefert FROM bestellung_position WHERE id = ".$bestellposition."),
'$vpe',
'',
'$bemerkung',
'$bestellposition',
1
)";
$this->app->DB->Insert($sql);
}
}
break; break;
case 'leeren': case 'leeren':
// Remove existing preliminary value
$sql = "DELETE FROM paketdistribution WHERE paketannahme = ".$id." AND vorlaeufig = 1";
$this->app->DB->Delete($sql);
break; break;
case 'manuellerfassen': case 'manuellerfassen':
$this->app->Location->execute('index.php?module=wareneingang&action=manuellerfassen&id=' . $id); $this->app->Location->execute('index.php?module=wareneingang&action=manuellerfassen&id=' . $id);
@ -1789,8 +1837,8 @@ class Wareneingang {
foreach ($menge_input as $key => $menge) { foreach ($menge_input as $key => $menge) {
if ((strpos($key,'menge_') === 0) && ($menge !== '')) { if ((strpos($key,'menge_') === 0) && ($menge !== '')) {
$bestellposition = substr($key,'6'); $bestellposition = substr($key,'6');
if ($menge > 0) {
if ($menge >= 0) { // Allow 0 for reset of saved value
// Gather info bestellung // 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"); $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 = $bparr['artikel'];