mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
bugfix lieferantengutschrift positionen hinzufuegen
This commit is contained in:
parent
345bbc5a9d
commit
9fc07ca3df
@ -303,17 +303,17 @@ class lieferantengutschrift {
|
|||||||
|
|
||||||
$auswahl = array (
|
$auswahl = array (
|
||||||
'<input type=\"checkbox\" name=\"ids[]\" value=\"',
|
'<input type=\"checkbox\" name=\"ids[]\" value=\"',
|
||||||
['sql' => 'pd.id'],
|
['sql' => 'vp.id'],
|
||||||
'"/>'
|
'"/>'
|
||||||
);
|
);
|
||||||
|
|
||||||
$werte = array (
|
$werte = array (
|
||||||
'<input type="number" name="werte[]" min="0"',
|
'<input type="number" name="werte[]" min="0"',
|
||||||
'max = "',
|
'max = "',
|
||||||
['sql' => 'vp.menge'],
|
['sql' => 'if(vp.menge > COALESCE(lgp.menge,0),vp.menge-COALESCE(lgp.menge,0),0)'],
|
||||||
'" ',
|
'" ',
|
||||||
'value = "',
|
'value = "',
|
||||||
['sql' => 'vp.menge'],
|
['sql' => 'if(vp.menge > COALESCE(lgp.menge,0),vp.menge-COALESCE(lgp.menge,0),0)'],
|
||||||
'" ',
|
'" ',
|
||||||
'/>'
|
'/>'
|
||||||
);
|
);
|
||||||
@ -358,9 +358,20 @@ class lieferantengutschrift {
|
|||||||
INNER JOIN adresse adr ON
|
INNER JOIN adresse adr ON
|
||||||
adr.id = v.adresse
|
adr.id = v.adresse
|
||||||
LEFT JOIN kontorahmen skv ON skv.id = vp.kontorahmen
|
LEFT JOIN kontorahmen skv ON skv.id = vp.kontorahmen
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
verbindlichkeit_position,
|
||||||
|
SUM(menge) AS menge
|
||||||
|
FROM
|
||||||
|
lieferantengutschrift_position lgp
|
||||||
|
INNER JOIN
|
||||||
|
lieferantengutschrift lg ON lg.id = lgp.lieferantengutschrift
|
||||||
|
WHERE
|
||||||
|
lg.status <> 'storniert' AND verbindlichkeit_position <> 0 and verbindlichkeit_position IS NOT NULL
|
||||||
|
) lgp ON lgp.verbindlichkeit_position = vp.id
|
||||||
";
|
";
|
||||||
|
|
||||||
$where = "v.adresse = (SELECT adresse FROM lieferantengutschrift WHERE id = ".$id.") AND v.status = 'freigegeben'";
|
$where = "v.adresse = (SELECT adresse FROM lieferantengutschrift WHERE id = ".$id.") AND v.status IN ('freigegeben','abgeschlossen')";
|
||||||
|
|
||||||
$count = "";
|
$count = "";
|
||||||
|
|
||||||
@ -713,13 +724,17 @@ class lieferantengutschrift {
|
|||||||
";
|
";
|
||||||
$offen_menge = $this->app->DB->Select($sql);
|
$offen_menge = $this->app->DB->Select($sql);
|
||||||
|
|
||||||
if ($offen_menge == 0) {
|
if ($offen_menge === 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($menge > $offen_menge) {
|
if ($menge > $offen_menge && !empty($offen_menge)) {
|
||||||
$menge = $offen_menge;
|
$menge = $offen_menge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($menge == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
a.id,
|
a.id,
|
||||||
@ -1297,10 +1312,10 @@ class lieferantengutschrift {
|
|||||||
|
|
||||||
if (!$this->lieferantengutschrift_is_freigegeben($id)) {
|
if (!$this->lieferantengutschrift_is_freigegeben($id)) {
|
||||||
if ($gotoedit) {
|
if ($gotoedit) {
|
||||||
$this->app->YUI->Message('warning','lieferantengutschrift nicht freigebeben');
|
$this->app->YUI->Message('warning','lieferantengutschrift nicht freigegeben');
|
||||||
$error = true;
|
$error = true;
|
||||||
} else {
|
} else {
|
||||||
return('lieferantengutschrift nicht freigebeben '.$this->lieferantengutschrift_get_belegnr($id));
|
return('lieferantengutschrift nicht freigegeben '.$this->lieferantengutschrift_get_belegnr($id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1332,10 +1347,10 @@ class lieferantengutschrift {
|
|||||||
|
|
||||||
if (!$this->lieferantengutschrift_is_freigegeben($id)) {
|
if (!$this->lieferantengutschrift_is_freigegeben($id)) {
|
||||||
if ($gotoedit) {
|
if ($gotoedit) {
|
||||||
$this->app->YUI->Message('warning','lieferantengutschrift nicht freigebeben');
|
$this->app->YUI->Message('warning','lieferantengutschrift nicht freigegeben');
|
||||||
$error = true;
|
$error = true;
|
||||||
} else {
|
} else {
|
||||||
return('lieferantengutschrift nicht freigebeben '.$this->lieferantengutschrift_get_belegnr($id));
|
return('lieferantengutschrift nicht freigegeben '.$this->lieferantengutschrift_get_belegnr($id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1387,10 +1402,10 @@ class lieferantengutschrift {
|
|||||||
|
|
||||||
if (!$this->lieferantengutschrift_is_freigegeben($id)) {
|
if (!$this->lieferantengutschrift_is_freigegeben($id)) {
|
||||||
if ($gotoedit) {
|
if ($gotoedit) {
|
||||||
$this->app->YUI->Message('warning','lieferantengutschrift nicht freigebeben');
|
$this->app->YUI->Message('warning','lieferantengutschrift nicht freigegeben');
|
||||||
$error = true;
|
$error = true;
|
||||||
} else {
|
} else {
|
||||||
return('lieferantengutschrift nicht freigebeben '.$this->lieferantengutschrift_get_belegnr($id));
|
return('lieferantengutschrift nicht freigegeben '.$this->lieferantengutschrift_get_belegnr($id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1626,7 +1641,7 @@ class lieferantengutschrift {
|
|||||||
WHERE
|
WHERE
|
||||||
id='$id'
|
id='$id'
|
||||||
AND
|
AND
|
||||||
status IN ('freigegeben')
|
status IN ('freigegeben','abgeschlossen')
|
||||||
";
|
";
|
||||||
|
|
||||||
$check = $this->app->DB->SelectArr($sql);
|
$check = $this->app->DB->SelectArr($sql);
|
||||||
|
Loading…
Reference in New Issue
Block a user