InvoiceFile WIP 2024-07-09
This commit is contained in:
@@ -33,6 +33,7 @@ class InvoiceModel {
|
||||
public $total;
|
||||
public $total_gross;
|
||||
public $bmd_export_date;
|
||||
public $date_delivered;
|
||||
public $total_vat;
|
||||
public $create_by;
|
||||
public $edit_by;
|
||||
@@ -173,7 +174,7 @@ class InvoiceModel {
|
||||
$sql = "SELECT COUNT(*) as cnt FROM Invoice
|
||||
WHERE $where";
|
||||
|
||||
//mfLoghandler::singleton()->debug($sql);
|
||||
mfLoghandler::singleton()->debug($sql);
|
||||
|
||||
$res = $db->query($sql);
|
||||
if($db->num_rows($res)) {
|
||||
@@ -220,7 +221,7 @@ class InvoiceModel {
|
||||
|
||||
private static function getSqlFilter($filter) {
|
||||
$where = "1=1 ";
|
||||
|
||||
//var_dump($filter);exit;
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
//var_dump($filter);exit;
|
||||
@@ -253,6 +254,31 @@ class InvoiceModel {
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("invoice_date>", $filter)) {
|
||||
$invoice_date = $db->escape($filter['invoice_date>']);
|
||||
if($invoice_date) {
|
||||
$where .= " AND Invoice.invoice_date > '$invoice_date'";
|
||||
}
|
||||
}
|
||||
if(array_key_exists("invoice_date>=", $filter)) {
|
||||
$invoice_date = $db->escape($filter['invoice_date>=']);
|
||||
if($invoice_date) {
|
||||
$where .= " AND Invoice.invoice_date >= '$invoice_date'";
|
||||
}
|
||||
}
|
||||
if(array_key_exists("invoice_date<", $filter)) {
|
||||
$invoice_date = $db->escape($filter['invoice_date<']);
|
||||
if($invoice_date) {
|
||||
$where .= " AND Invoice.invoice_date < '$invoice_date'";
|
||||
}
|
||||
}
|
||||
if(array_key_exists("invoice_date<=", $filter)) {
|
||||
$invoice_date = $db->escape($filter['invoice_date<=']);
|
||||
if($invoice_date) {
|
||||
$where .= " AND Invoice.invoice_date <= '$invoice_date'";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("bmd_export_date", $filter)) {
|
||||
$bmd_export_date = $filter['bmd_export_date'];
|
||||
if(is_numeric($bmd_export_date)) {
|
||||
@@ -264,6 +290,17 @@ class InvoiceModel {
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("date_delivered", $filter)) {
|
||||
$date_delivered = $filter['date_delivered'];
|
||||
if(is_numeric($date_delivered)) {
|
||||
$where .= " AND Invoice.date_delivered=$date_delivered";
|
||||
} elseif($date_delivered === null || $date_delivered === false) {
|
||||
$where .= " AND Invoice.date_delivered IS NULL";
|
||||
} elseif($date_delivered === true) {
|
||||
$where .= " AND Invoice.date_delivered > 0";
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("billingaddress_id", $filter)) {
|
||||
$Invoiceaddress_id = $filter['billingaddress_id'];
|
||||
if(is_numeric($Invoiceaddress_id)) {
|
||||
@@ -353,7 +390,6 @@ class InvoiceModel {
|
||||
$where .= " AND Invoice.Invoice_period = $Invoice_period";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user