else
$value = "IF (trans.type=".ST_SUPPINVOICE." OR trans.type=".ST_BANKDEPOSIT."
OR (trans.type=".ST_JOURNAL." AND (trans.ov_amount + trans.ov_gst + trans.ov_discount)>0), 1, -1)*
- ABS(trans.ov_amount + trans.ov_gst + trans.ov_discount) - trans.alloc)";
+ ABS(trans.ov_amount + trans.ov_gst + trans.ov_discount) - trans.alloc";
$due = "IF (trans.type=".ST_SUPPINVOICE." OR trans.type=".ST_SUPPCREDIT.",trans.due_date,trans.tran_date)";
$sql = "SELECT supp.supp_name, supp.curr_code, ".TB_PREF."payment_terms.terms,
function get_supplier_accounts($supplier_id)
{
- $sql = "SELECT payable_account,purchase_account,payment_discount_account FROM ".TB_PREF."suppliers WHERE supplier_id=".db_escape($supplier_id);
+ $sql = "SELECT payable_account,purchase_account,payment_discount_account, dimension_id, dimension2_id FROM ".TB_PREF."suppliers WHERE supplier_id=".db_escape($supplier_id);
$result = db_query($sql, "could not get supplier");
$result = db_query($sql, "Retreive currency of supplier $supplier_id");
$myrow=db_fetch_row($result);
- return $myrow[0];
+ return $myrow ? $myrow[0] : get_company_currency();
}
function get_suppliers_search($supplier)