mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
wareneingang bugfix limit menge
This commit is contained in:
parent
169a5c34c5
commit
3c57df65e6
@ -140,21 +140,14 @@ class Wareneingang {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$more_data1 = $this->app->Secure->GetGET("more_data1");
|
$more_data1 = $this->app->Secure->GetGET("more_data1");
|
||||||
|
$maximalmenge = 'trim(bp.menge - bp.geliefert)+0';
|
||||||
if ($more_data1 == 1) {
|
if ($more_data1 == 1) {
|
||||||
$ausfuellen = 'trim(bp.menge - bp.geliefert)+0';
|
$ausfuellen = $maximalmenge;
|
||||||
} else {
|
} else {
|
||||||
$ausfuellen = "''";
|
$ausfuellen = "''";
|
||||||
}
|
}
|
||||||
// END Toggle filters
|
// END Toggle filters
|
||||||
|
|
||||||
$vorschlag = "
|
|
||||||
if(
|
|
||||||
bp.menge-bp.geliefert-COALESCE((SELECT TRIM(SUM(menge))+0 FROM paketdistribution WHERE vorlaeufig = 1 AND bestellung_position = bp.id),0) > 0,
|
|
||||||
bp.menge-bp.geliefert-COALESCE((SELECT TRIM(SUM(menge))+0 FROM paketdistribution WHERE vorlaeufig = 1 AND bestellung_position = bp.id),0),
|
|
||||||
0
|
|
||||||
)
|
|
||||||
";
|
|
||||||
|
|
||||||
$artikel_link = array(
|
$artikel_link = array(
|
||||||
'<a href=\"index.php?module=artikel&action=edit&id=',
|
'<a href=\"index.php?module=artikel&action=edit&id=',
|
||||||
['sql' => 'art.id'],
|
['sql' => 'art.id'],
|
||||||
@ -172,6 +165,9 @@ class Wareneingang {
|
|||||||
|
|
||||||
$input_for_menge = array(
|
$input_for_menge = array(
|
||||||
'<input type = \"number\" min=\"0\"',
|
'<input type = \"number\" min=\"0\"',
|
||||||
|
' max=\"',
|
||||||
|
['sql' => $maximalmenge],
|
||||||
|
'\""',
|
||||||
' value=\"',
|
' value=\"',
|
||||||
['sql' => $ausfuellen],
|
['sql' => $ausfuellen],
|
||||||
'\"',
|
'\"',
|
||||||
@ -2228,7 +2224,7 @@ class Wareneingang {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Gather info bestellung
|
// Gather info bestellung
|
||||||
$bparr = $this->app->DB->SelectRow("SELECT bp.artikel, a.nummer, b.projekt, b.belegnr, bp.vpe, bp.menge FROM bestellung b INNER JOIN bestellung_position bp ON bp.bestellung = b.id INNER JOIN artikel a ON bp.artikel = a.id WHERE bp.id='$bestellposition' LIMIT 1");
|
$bparr = $this->app->DB->SelectRow("SELECT bp.artikel, a.nummer, b.projekt, b.belegnr, bp.vpe, bp.menge, bp.geliefert FROM bestellung b INNER JOIN bestellung_position bp ON bp.bestellung = b.id INNER JOIN artikel a ON bp.artikel = a.id WHERE bp.id='$bestellposition' LIMIT 1");
|
||||||
$artikel = $bparr['artikel'];
|
$artikel = $bparr['artikel'];
|
||||||
$artikel_nr = $bparr['nummer'];
|
$artikel_nr = $bparr['nummer'];
|
||||||
$projekt = $bparr['projekt'];
|
$projekt = $bparr['projekt'];
|
||||||
@ -2240,6 +2236,12 @@ class Wareneingang {
|
|||||||
$sql = "SELECT id, menge FROM paketdistribution WHERE paketannahme = ".$id." AND bestellung_position = ".$bestellposition." AND vorlaeufig = 1 LIMIT 1";
|
$sql = "SELECT id, menge FROM paketdistribution WHERE paketannahme = ".$id." AND bestellung_position = ".$bestellposition." AND vorlaeufig = 1 LIMIT 1";
|
||||||
$preliminary = $this->app->DB->SelectRow($sql);
|
$preliminary = $this->app->DB->SelectRow($sql);
|
||||||
|
|
||||||
|
$menge = $menge + $preliminary['menge'];
|
||||||
|
if ($menge > $bparr['menge']-$bparr['geliefert']) {
|
||||||
|
$menge = $bparr['menge']-$bparr['geliefert'];
|
||||||
|
$this->app->YUI->Message('warning','Mengen wurden angepasst');
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($preliminary)) {
|
if (empty($preliminary)) {
|
||||||
$sql = "INSERT INTO paketdistribution(
|
$sql = "INSERT INTO paketdistribution(
|
||||||
id,
|
id,
|
||||||
@ -2270,12 +2272,7 @@ class Wareneingang {
|
|||||||
1
|
1
|
||||||
)";
|
)";
|
||||||
$this->app->DB->Insert($sql);
|
$this->app->DB->Insert($sql);
|
||||||
} else {
|
} else {
|
||||||
$menge = $menge + $preliminary['menge'];
|
|
||||||
if ($menge > $bparr['menge']-$bparr['geliefert']) {
|
|
||||||
$menge = $bparr['menge']-$bparr['geliefert'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql = "UPDATE paketdistribution SET menge = ".$menge.", bemerkung = '".$this->app->DB->real_escape_string($bemerkung)."' WHERE id = ".$preliminary['id'];
|
$sql = "UPDATE paketdistribution SET menge = ".$menge.", bemerkung = '".$this->app->DB->real_escape_string($bemerkung)."' WHERE id = ".$preliminary['id'];
|
||||||
$this->app->DB->Insert($sql);
|
$this->app->DB->Insert($sql);
|
||||||
}
|
}
|
||||||
@ -2350,7 +2347,13 @@ class Wareneingang {
|
|||||||
WHERE
|
WHERE
|
||||||
bestellung_position.id='$bestellposition'
|
bestellung_position.id='$bestellposition'
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
");
|
");
|
||||||
|
|
||||||
|
if ($menge > $bparr['menge']-$bparr['geliefert']) {
|
||||||
|
$this->app->YUI->Message('error','Mengen ungültig');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$artikel = $bparr['artikel'];
|
$artikel = $bparr['artikel'];
|
||||||
$artikel_nr = $bparr['nummer'];
|
$artikel_nr = $bparr['nummer'];
|
||||||
$projekt = $bparr['projekt'];
|
$projekt = $bparr['projekt'];
|
||||||
@ -2606,16 +2609,14 @@ class Wareneingang {
|
|||||||
$sql = "SELECT id FROM paketdistribution WHERE paketannahme = ".$id." AND vorlaeufig = 1";
|
$sql = "SELECT id FROM paketdistribution WHERE paketannahme = ".$id." AND vorlaeufig = 1";
|
||||||
$vorlaeufige = $this->app->DB->SelectArr($sql);
|
$vorlaeufige = $this->app->DB->SelectArr($sql);
|
||||||
if (!empty($vorlaeufige)) {
|
if (!empty($vorlaeufige)) {
|
||||||
$this->app->YUI->Message('warning','Nicht eingebuchte Positionen vorhanden');
|
$this->app->YUI->Message('info','Nicht eingebuchte Positionen vorhanden');
|
||||||
$this->app->Tpl->Set('ABSCHLIESSENHIDDEN','hidden');
|
$this->app->Tpl->Set('ABSCHLIESSENHIDDEN','hidden');
|
||||||
} else {
|
} else {
|
||||||
$this->app->Tpl->Set('BUCHENHIDDEN','hidden');
|
$this->app->Tpl->Set('BUCHENHIDDEN','hidden');
|
||||||
if ($status != 'abgeschlossen') {
|
if ($status != 'abgeschlossen') {
|
||||||
$this->app->YUI->Message('warning','Wareneingang noch nicht abgeschlossen');
|
$this->app->YUI->Message('info','Wareneingang noch nicht abgeschlossen');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->app->Tpl->Parse('PAGE', 'wareneingang_paketinhalt.tpl');
|
$this->app->Tpl->Parse('PAGE', 'wareneingang_paketinhalt.tpl');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user