//$company_currency = get_company_currency();
$trans_no = $supp_trans->trans_no;
$trans_type = $supp_trans->trans_type;
- /*Start an sql transaction */
+ $supplier = get_supplier($supp_trans->supplier_id);
+
begin_transaction();
hook_db_prewrite($supp_trans, $trans_type);
$tax_total = 0;
} else
$allocs = get_po_prepayments($supp_trans);
- $supplier = get_supplier($supp_trans->supplier_id);
-
add_new_exchange_rate($supplier['curr_code'], $supp_trans->tran_date, $supp_trans->ex_rate);
foreach ($taxes as $n => $taxitem)
$total += add_gl_trans_supplier($trans_type, $invoice_id, $date_, $entered_gl_code->gl_code,
$entered_gl_code->gl_dim, $entered_gl_code->gl_dim2, $entered_gl_code->amount, $supp_trans->supplier_id, "", 0, $memo_);
- add_supp_invoice_gl_item($trans_type, $invoice_id, $entered_gl_code->gl_code,
- $entered_gl_code->amount, $memo_);
+ add_supp_invoice_gl_item($trans_type, $invoice_id, $entered_gl_code->gl_code, $entered_gl_code->amount, $memo_,
+ $entered_gl_code->gl_dim, $entered_gl_code->gl_dim2);
// store tax details if the gl account is a tax account
if ($trans_type == ST_SUPPCREDIT)
$stock_gl_code = get_stock_gl_code($entered_grn->item_code);
- $dim = $supplier['dimension_id'] ? $supplier['dimension_id'] : $stock_gl_code['dimension_id'];
- $dim2 = $supplier['dimension2_id'] ? $supplier['dimension2_id'] : $stock_gl_code['dimension2_id'];
+ $dim = !empty($supp_trans->dimension) ? $supp_trans->dimension :
+ ($supplier['dimension_id'] ? $supplier['dimension_id'] : $stock_gl_code['dimension_id']);
+ $dim2 = !empty($supp_trans->dimension2) ? $supp_trans->dimension2 :
+ ($supplier['dimension2_id'] ? $supplier['dimension2_id'] : $stock_gl_code['dimension2_id']);
if ($trans_type == ST_SUPPCREDIT)
{
$iv_act = (is_inventory_item($entered_grn->item_code) ? $stock_gl_code["inventory_account"] :
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["FullUnitPrice"], $details_row["memo_"], $details_row["dimension_id"], $details_row["dimension2_id"]);
}
}
$supp_trans->tax_overrides = get_tax_overrides($trans_type, $trans_no);