versandpaket paketmarke calculate weight of versandpaket

This commit is contained in:
OpenXE 2024-05-23 14:27:32 +02:00
parent 63aaaf96ee
commit e19484b597
3 changed files with 24 additions and 10 deletions

View File

@ -163,12 +163,6 @@ abstract class Versanddienstleister
ORDER BY lp.sort";
$ret['positions'] = $this->app->DB->SelectArr($sql) ?? [];
if ($sid === "lieferschein") {
$standardkg = $this->app->erp->VersandartMindestgewicht($lieferscheinId);
} else {
$standardkg = $this->app->erp->VersandartMindestgewicht();
}
$ret['weight'] = $standardkg;
return $ret;
}
@ -370,9 +364,11 @@ abstract class Versanddienstleister
return true;
}
public function Paketmarke(string $target, string $docType, int $docId, $versandpaket = null): void
public function Paketmarke(string $target, string $docType, int $docId, $gewicht = 0, $versandpaket = null): void
{
$address = $this->GetAdressdaten($docId, $docType);
$address['weight'] = $gewicht;
if (isset($_SERVER['CONTENT_TYPE']) && ($_SERVER['CONTENT_TYPE'] === 'application/json')) {
$json = json_decode(file_get_contents('php://input'));
$ret = [];

View File

@ -575,7 +575,10 @@ class Lieferschein extends GenLieferschein
return;
}
$versandmodul = $this->app->erp->LoadVersandModul($result['modul'], $result['id']);
$versandmodul->Paketmarke('TAB1', 'lieferschein', $id);
$gewicht = $this->app->erp->VersandartMindestgewicht($id, 'lieferschein');
$versandmodul->Paketmarke('TAB1', docType: 'lieferschein', docId: $id, gewicht: $gewicht);
$this->app->Tpl->Parse('PAGE',"tabview.tpl");
}

View File

@ -1176,7 +1176,22 @@ class Versandpakete {
}
$lieferschein = $this->app->DB->SelectRow("SELECT * FROM (".self::SQL_VERSANDPAKETE_LIEFERSCHEIN.") temp WHERE versandpaket = ".$id." LIMIT 1");
$versandmodul = $this->app->erp->LoadVersandModul($versandart['modul'], $versandart['id']);
$versandmodul->Paketmarke('TAB1', 'lieferschein', $lieferschein['lieferschein'], $id);
$sql = "
SELECT
SUM(COALESCE(a.gewicht,0)*vlp.menge)
FROM
artikel a
INNER JOIN lieferschein_position lp ON
a.id = lp.artikel
INNER JOIN
versandpaket_lieferschein_position vlp ON
vlp.lieferschein_position = lp.id
WHERE vlp.versandpaket = ".$id."
";
$gewicht = $this->app->DB->Select($sql);
$versandmodul->Paketmarke('TAB1', docType: 'lieferschein', docId: $lieferschein['lieferschein'], versandpaket: $id, gewicht: $gewicht);
$this->app->Tpl->Parse('PAGE',"tabview.tpl");
}