mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
bugfix artikel instueckliste sum view
This commit is contained in:
parent
c6ee9c0faf
commit
7b1d12d59b
@ -1800,22 +1800,35 @@ class Artikel extends GenArtikel {
|
|||||||
// SQL statement
|
// SQL statement
|
||||||
|
|
||||||
if (!empty($this->app->Conf->WFdbType) && $this->app->Conf->WFdbType == 'postgre') {
|
if (!empty($this->app->Conf->WFdbType) && $this->app->Conf->WFdbType == 'postgre') {
|
||||||
$sql = 'SELECT s.id, a.name_de as artikel,a.nummer as nummer, trim(s.menge)+0 as menge,
|
$sql = 'SELECT
|
||||||
CASE WHEN (SELECT SUM(l.menge) FROM lager_platz_inhalt l WHERE l.artikel=a.id) > 0
|
s.id,
|
||||||
THEN (SELECT SUM(l.menge) FROM lager_platz_inhalt l WHERE l.artikel=a.id)
|
a.name_de as artikel,
|
||||||
ELSE 0
|
a.nummer as nummer,
|
||||||
END as lager, s.artikel as menu
|
trim(SUM(s.menge))+0 as menge,
|
||||||
|
CASE
|
||||||
|
WHEN (SELECT SUM(l.menge) FROM lager_platz_inhalt l WHERE l.artikel=a.id) > 0
|
||||||
|
THEN (SELECT SUM(l.menge) FROM lager_platz_inhalt l WHERE l.artikel=a.id)
|
||||||
|
ELSE 0
|
||||||
|
END as lager,
|
||||||
|
s.artikel as menu
|
||||||
FROM stueckliste s LEFT JOIN artikel a ON s.artikel=a.id ';
|
FROM stueckliste s LEFT JOIN artikel a ON s.artikel=a.id ';
|
||||||
} else {
|
} else {
|
||||||
$sql = 'SELECT SQL_CALC_FOUND_ROWS s.id, a.name_de as artikel,a.nummer as nummer, trim(s.menge)+0 as menge,
|
$sql = ' SELECT SQL_CALC_FOUND_ROWS
|
||||||
s.stuecklistevonartikel
|
s.id,
|
||||||
as menu
|
a.name_de as artikel,
|
||||||
FROM stueckliste s LEFT JOIN artikel a ON s.stuecklistevonartikel=a.id ';
|
a.nummer as nummer,
|
||||||
|
trim(SUM(s.menge))+0 as menge,
|
||||||
|
s.stuecklistevonartikel AS menu
|
||||||
|
FROM
|
||||||
|
stueckliste s
|
||||||
|
LEFT JOIN artikel a ON s.stuecklistevonartikel=a.id ';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fester filter
|
// Fester filter
|
||||||
$where = "s.artikel='$id' ";
|
$where = "s.artikel='$id' ";
|
||||||
|
|
||||||
|
$groupby = " GROUP BY a.id";
|
||||||
|
|
||||||
// gesamt anzahl
|
// gesamt anzahl
|
||||||
$count = "SELECT COUNT(s.id) FROM stueckliste s WHERE s.stuecklistevonartikel='$id' ";
|
$count = "SELECT COUNT(s.id) FROM stueckliste s WHERE s.stuecklistevonartikel='$id' ";
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user