Invoice BMD export

This commit is contained in:
Frank Schubert
2024-07-09 18:50:08 +02:00
parent 74e78fed49
commit cc4f2e3bdb
7 changed files with 241 additions and 27 deletions
+26
View File
@@ -24,6 +24,7 @@ class IvtBillModel {
$db = FronkDB::singleton(IVT_DBHOST, IVT_DBUSER, IVT_DBPASS, IVT_DBNAME);
$where = self::getSqlFilter($filter);
mfLoghandler::singleton()->debug($where);
$res = $db->select("bills", "*", "$where ORDER BY id LIMIT 1");
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
@@ -41,6 +42,7 @@ class IvtBillModel {
$db = FronkDB::singleton(IVT_DBHOST, IVT_DBUSER, IVT_DBPASS, IVT_DBNAME);
$where = self::getSqlFilter($filter);
mfLoghandler::singleton()->debug($where);
$res = $db->select("bills", "*", "$where ORDER BY id DESC LIMIT 1");
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
@@ -109,6 +111,30 @@ class IvtBillModel {
$where .= " AND bills.date_outgoing <= '$date_outgoing'";
}
}
if(array_key_exists("iban", $filter)) {
$iban = $filter['iban'];
if($iban === true) {
$where .= " AND bills.iban IS NOT NULL AND bills.iban <> ''";
} elseif ($iban === null || $iban === false) {
$where .= " AND (bills.iban IS NULL OR bills.iban = '')";
} else {
$iban = FronkDB::singleton()->escape($filter["iban"]);
$where .= " AND bills.iba='$iban' ";
}
}
if(array_key_exists("bic", $filter)) {
$bic = $filter['bic'];
if($bic === true) {
$where .= " AND bills.bic IS NOT NULL AND bills.bic <> ''";
} elseif ($bic === null || $bic === false) {
$where .= " AND (bills.bic IS NULL OR bills.bic = '')";
} else {
$bic = FronkDB::singleton()->escape($filter["bic"]);
$where .= " AND bills.iba='$bic' ";
}
}
/*
if(array_key_exists("status_id", $filter)) {
$status_id = $filter['status_id'];