//---------------------------------------------------------------------------------------------------------------
-function get_invoice_duedate($terms, $invdate)
-{
- if (!is_date($invdate))
- {
- return new_doc_date();
- }
-
- $myrow = get_payment_terms($terms);
-
- if (!$myrow)
- return $invdate;
-
- if ($myrow['type'] == PTT_FOLLOWING)
- $duedate = add_days(end_month($invdate), $myrow['days']);
- elseif ($myrow['type'] == PTT_DAYS)
- $duedate = add_days($invdate, $myrow['days']);
- else
- $duedate = $invdate;
- return $duedate;
-}
-
function get_customer_to_order($customer_id) {
// Now check to ensure this account is not on hold */
cust.curr_code,
cust.discount,
cust.payment_terms,
- cust.pymt_discount,
cust.credit_limit - Sum(IFNULL(IF(trans.type IN(".implode(',', array(ST_CUSTCREDIT, ST_CUSTPAYMENT, ST_BANKDEPOSIT))."),
-1, 1) * (ov_amount + ov_gst + ov_freight + ov_freight_tax + ov_discount),0)) as cur_credit
FROM ".TB_PREF."debtors_master cust