More changes to Billing and Invoice
This commit is contained in:
@@ -78,6 +78,22 @@ class InvoiceController extends mfBaseController {
|
||||
unset($filter["invoice_number"]);
|
||||
}
|
||||
|
||||
if(array_key_exists("invoice_date_from", $filter)) {
|
||||
if($filter["invoice_date_from"]) {
|
||||
$from = Layout::dateToInt($filter["invoice_date_from"]);
|
||||
$new_filter["invoice_date>="] = $from;
|
||||
}
|
||||
unset($filter["invoice_date_from"]);
|
||||
}
|
||||
|
||||
if(array_key_exists("invoice_date_to", $filter)) {
|
||||
if($filter["invoice_date_to"]) {
|
||||
$to = Layout::dateToInt($filter["invoice_date_to"]);
|
||||
$new_filter["invoice_date<="] = $to;
|
||||
}
|
||||
unset($filter["invoice_date_to"]);
|
||||
}
|
||||
|
||||
if (is_array($filter) && count($filter)) {
|
||||
foreach ($filter as $name => $value) {
|
||||
$new_filter[$name] = $value;
|
||||
@@ -220,7 +236,7 @@ class InvoiceController extends mfBaseController {
|
||||
$price_setup_total = $bill->price_setup * $bill->amount;
|
||||
$price_setup_gross = ($vatrate) ? $price_setup_total + ($price_setup_total / 100) * $vatrate : $price_setup_total;
|
||||
$add_setup_position = ($price > 0 && $price_setup > 0);
|
||||
$is_setup_only = ($price < 0.00001 && $price_setup > 0);
|
||||
$is_setup_only = ($price < 0.00001 && ($price_setup > 0.00001 || $price_setup < -0.00001));
|
||||
|
||||
$price_total_sum += $price_gross + $price_setup_gross;
|
||||
|
||||
@@ -531,12 +547,12 @@ class InvoiceController extends mfBaseController {
|
||||
die("Error saving Invoice number and date");
|
||||
}
|
||||
|
||||
/*
|
||||
$address = new Address($invoice->billingaddress_id);
|
||||
if($address) {
|
||||
$address->last_invoice_date = date("U");
|
||||
$address->save();
|
||||
}*/
|
||||
|
||||
$baddress = new Address($invoice->billingaddress_id);
|
||||
if($baddress) {
|
||||
$baddress->last_invoice_date = date("U");
|
||||
$baddress->save();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
if ($invoice) {
|
||||
$invoice->rollbackTransaction();
|
||||
|
||||
Reference in New Issue
Block a user