X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fincludes%2Fdb%2Fsales_invoice_db.inc;h=0dc6de5655a76bf1a8a860095a7309e28304144c;hb=ba13d6373cb634abf30fb7e691b17485f3dd2917;hp=87b9eb7ec580bc0b78f5da9971d903423e670ab4;hpb=4232965822b3543f7fe44e15dd395f2b8ab0d7eb;p=fa-stable.git diff --git a/sales/includes/db/sales_invoice_db.inc b/sales/includes/db/sales_invoice_db.inc index 87b9eb7e..0dc6de56 100644 --- a/sales/includes/db/sales_invoice_db.inc +++ b/sales/includes/db/sales_invoice_db.inc @@ -122,12 +122,6 @@ function write_sales_invoice(&$invoice) } /*quantity dispatched is more than 0 */ } /*end of delivery_line loop */ - if (($items_total + $charge_shipping) != 0) { - $total += add_gl_trans_customer(10, $invoice_no, $date_, $branch_data["receivables_account"], 0, 0, - ($items_total + $charge_shipping + $items_added_tax + $freight_added_tax), - $invoice->customer_id, "The total debtor GL posting could not be inserted"); - } - if ($charge_shipping != 0) { $total += add_gl_trans_customer(10, $invoice_no, $date_, $company_data["freight_act"], 0, 0, -$invoice->get_tax_free_shipping(), $invoice->customer_id, @@ -145,6 +139,11 @@ function write_sales_invoice(&$invoice) } } + if (($items_total + $charge_shipping) != 0) { + $total += add_gl_trans(10, $invoice_no, $date_, $branch_data["receivables_account"], 0, 0, "", + -$total, null, payment_person_types::customer(), $invoice->customer_id, "The total debtor GL posting could not be inserted"); + } + /*Post a balance post if $total != 0 */ add_gl_balance(10, $invoice_no, $date_, -$total, payment_person_types::customer(), $invoice->customer_id);