Billing changes

This commit is contained in:
Frank Schubert
2024-08-05 21:09:13 +02:00
parent 75f75b6327
commit a6389f014f
10 changed files with 357 additions and 149 deletions
+25 -10
View File
@@ -205,10 +205,10 @@ class BillingModel {
$items = [];
$where = self::getSqlFilter($filter);
$sql = "SELECT owner_id, billingaddress_id, billing_type, billing_delivery FROM Billing
$sql = "SELECT owner_id, billingaddress_id, billing_type, billing_delivery, vatgroup_id FROM Billing
WHERE $where
GROUP BY owner_id, billingaddress_id, billing_type, billing_delivery
ORDER BY owner_id, billingaddress_id, billing_type, billing_delivery";
GROUP BY owner_id, billingaddress_id, billing_type, billing_delivery, vatgroup_id
ORDER BY owner_id, billingaddress_id, billing_type, billing_delivery, vatgroup_id";
//var_dump($sql);exit;
$res = $db->query($sql);
if($db->num_rows($res)) {
@@ -217,7 +217,8 @@ class BillingModel {
"owner_id" => $data->owner_id,
"billingaddress_id" => $data->billingaddress_id,
"billing_type" => $data->billing_type,
"billing_delivery" => $data->billing_delivery
"billing_delivery" => $data->billing_delivery,
"vatgroup_id" => $data->vatgroup_id
];
}
}
@@ -490,11 +491,6 @@ class BillingModel {
}
}
if(array_key_exists("add-where", $filter)) {
$where .= " ".$filter['add-where'];
}
if(array_key_exists("billing_type", $filter)) {
$billing_type = $filter['billing_type'];
if(is_numeric($billing_type)) {
@@ -515,7 +511,26 @@ class BillingModel {
$where .= " AND Billing.billing_delivery = '$billing_delivery'";
}
}
if(array_key_exists("vatgroup_id", $filter)) {
$vatgroup_id = $filter['vatgroup_id'];
if(is_numeric($vatgroup_id)) {
$where .= " AND Billing.vatgroup_id = $vatgroup_id";
}
}
if(array_key_exists("!vatgroup_id", $filter)) {
$vatgroup_id = $filter['!vatgroup_id'];
if(is_numeric($vatgroup_id)) {
$where .= " AND Billing.vatgroup_id <> $vatgroup_id";
}
}
if(array_key_exists("add-where", $filter)) {
$where .= " ".$filter['add-where'];
}
//var_dump($filter, $where);exit;
return $where;
}