Ex. trans_no, Joulnal Entry, customer_id.
$_SESSION['alloc'] = new allocation(ST_SUPPAYMENT, 0, get_post('supplier_id'));
if (isset($_GET['PInvoice'])) {
+ $supp = isset($_POST['supplier_id']) ? $_POST['supplier_id'] : null;
// get date and supplier
- $inv = get_supp_trans($_GET['PInvoice'], $_GET['trans_type']);
+ $inv = get_supp_trans($_GET['PInvoice'], $_GET['trans_type'], $supp);
if ($inv) {
$_SESSION['alloc']->person_id = $_POST['supplier_id'] = $inv['supplier_id'];
$_SESSION['alloc']->read();
if (isset($_GET['SInvoice'])) {
// get date and supplier
$type = !isset($_GET['Type']) ? ST_SALESINVOICE : $_GET['Type'];
- $inv = get_customer_trans($_GET['SInvoice'], $type);
+ $cust = !isset($_GET['customer_id']) ? null : $_GET['customer_id'];
+ $inv = get_customer_trans($_GET['SInvoice'], $type, $cust);
$dflt_act = get_default_bank_account($inv['curr_code']);
$_POST['bank_account'] = $dflt_act['id'];
if ($inv) {
}
}
- $sql .= " GROUP BY trans.trans_no, trans.type";
+ $sql .= " GROUP BY trans.trans_no, trans.type, trans.debtor_no";
return $sql;
}