X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fincludes%2Fdb%2Fsales_invoice_db.inc;h=95d5e396c9d2ad9a96cd42d503269c9cc373461c;hb=49fa30e88e27b311edaca3ae3789d62e4629eb39;hp=3b540d55f2dea6d30a52abbef5a95e8f4d5632f8;hpb=1481d782477692fd972cc1c13b6585a95971769f;p=fa-stable.git diff --git a/sales/includes/db/sales_invoice_db.inc b/sales/includes/db/sales_invoice_db.inc index 3b540d55..95d5e396 100644 --- a/sales/includes/db/sales_invoice_db.inc +++ b/sales/includes/db/sales_invoice_db.inc @@ -25,6 +25,7 @@ function write_sales_invoice(&$invoice) begin_transaction(); + hook_db_prewrite($invoice, ST_SALESINVOICE); $company_data = get_company_prefs(); $branch_data = get_branch_accounts($invoice->Branch); @@ -164,7 +165,7 @@ function write_sales_invoice(&$invoice) if ($trans_no == 0) { $Refs->save(ST_SALESINVOICE, $invoice_no, $invoice->reference); - if ($invoice->cash) { + if ($invoice->payment_terms['cash_sale']) { $amount = $items_total + $items_added_tax + $invoice->freight_cost + $freight_added_tax; @@ -182,6 +183,7 @@ function write_sales_invoice(&$invoice) update_debtor_trans_allocation(ST_CUSTPAYMENT, $pmtno, $amount); } } + hook_db_postwrite($invoice, ST_SALESINVOICE); commit_transaction(); return $invoice_no; @@ -193,6 +195,7 @@ function void_sales_invoice($type, $type_no) { begin_transaction(); + hook_db_prevoid($type, $type_no); void_bank_trans($type, $type_no, true); void_gl_trans($type, $type_no, true);