X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=purchasing%2Fincludes%2Fdb%2Finvoice_db.inc;h=aee0bfcce7ab478afb5e30da8c23d41a6be008f8;hb=4d61463530af727a86e5a59e040b06de90ac5ce7;hp=372aca3c2fbfeee730863bce684eebad6c9fa8cb;hpb=5b6858588fc878c18aeb26c6b495aca7b32a5a43;p=fa-stable.git diff --git a/purchasing/includes/db/invoice_db.inc b/purchasing/includes/db/invoice_db.inc index 372aca3c..aee0bfcc 100644 --- a/purchasing/includes/db/invoice_db.inc +++ b/purchasing/includes/db/invoice_db.inc @@ -135,7 +135,7 @@ function add_supp_invoice(&$supp_trans) $tax_total = 0; $taxes = $supp_trans->get_taxes($supp_trans->tax_group_id); if ($trans_no) { - $allocs = get_payments_for($trans_no, $trans_type); // save allocations + $allocs = get_payments_for($trans_no, $trans_type, $supp_trans->supplier_id); // save allocations void_transaction($trans_type, $trans_no, Today(), _("Document reentered.")); $Refs->restore_last($trans_type, $trans_no); } else @@ -354,7 +354,7 @@ function add_supp_invoice(&$supp_trans) } add_or_update_purchase_data($supp_trans->supplier_id, $entered_grn->item_code, $entered_grn->chg_price); } - + update_purchase_value($entered_grn->item_code, $entered_grn->chg_price * $ex_rate); add_supp_invoice_item($trans_type, $invoice_id, $entered_grn->item_code, $entered_grn->item_description, 0, $entered_grn->chg_price, $line_tax/$entered_grn->this_quantity_inv, $entered_grn->this_quantity_inv, $entered_grn->id, $entered_grn->po_detail_item, ""); @@ -393,11 +393,7 @@ function add_supp_invoice(&$supp_trans) } } -//_vd($allocs); - reallocate_payments($invoice_id, ST_SUPPINVOICE, $date_, $to_allocate, $allocs); -//_vd(get_payments_for($sales_order, ST_PURCHORDER)); -//_vd(get_payments_for($invoice_id, ST_SUPPINVOICE)); -//exit; + reallocate_payments($invoice_id, ST_SUPPINVOICE, $date_, $to_allocate, $allocs, $supp_trans->supplier_id); $supp_trans->trans_no = $invoice_id; hook_db_postwrite($supp_trans, $supp_trans->trans_type); commit_transaction(); @@ -496,8 +492,9 @@ function read_supp_invoice($trans_no, $trans_type, &$supp_trans) } else { - $supp_trans->add_gl_codes_to_trans($details_row["gl_code"], get_gl_account_name($details_row["gl_code"]), 0, 0, - $details_row["FullUnitPrice"], $details_row["memo_"], $details_row["dimension_id"], $details_row["dimension2_id"]); + $supp_trans->add_gl_codes_to_trans($details_row["gl_code"], get_gl_account_name($details_row["gl_code"]), + $details_row["dimension_id"], $details_row["dimension2_id"], + $details_row["FullUnitPrice"], $details_row["memo_"]); } } $supp_trans->tax_overrides = get_tax_overrides($trans_type, $trans_no);