{
$myrow = get_sales_order_header($order_no, ST_SALESORDER);
- return !$myrow['prepaid'];
+ return !$myrow['prepaid'] && ! $myrow['cash_sale'];
}
function create_template_invoice($customer_id, $branch_id, $order_no, $tmpl_no, $date, $from, $to, $memo)
$doc->trans_no = 0;
$doc->document_date = $date;
- $doc->due_date = get_invoice_duedate($doc->payment, $doc->document_date);
+ $doc->due_date = get_payment_due_date($doc->payment, $doc->document_date);
$doc->reference = $Refs->get_next($doc->trans_type, null, array('customer' => $customer_id, 'branch' => $branch_id,
'date' => $date));
$cart = $doc;
$cart->trans_type = ST_SALESINVOICE;
$cart->reference = $Refs->get_next($cart->trans_type);
- $cart->payment_terms['cash_sale'] = false; // no way to register cash payment with recurrent invoice at once
$invno = $cart->write(1);