if (isset($_GET['SInvoice'])) {
// get date and supplier
- $inv = get_customer_trans($_GET['SInvoice'], ST_SALESINVOICE);
+ $type = !isset($_GET['Type']) ? ST_SALESINVOICE : $_GET['Type'];
+ $inv = get_customer_trans($_GET['SInvoice'], $type);
$dflt_act = get_default_bank_account($inv['curr_code']);
$_POST['bank_account'] = $dflt_act['id'];
if ($inv) {
$_POST['BranchID'] = $inv['branch_code'];
$_POST['DateBanked'] = sql2date($inv['tran_date']);
foreach($_SESSION['alloc']->allocs as $line => $trans) {
- if ($trans->type == ST_SALESINVOICE && $trans->type_no == $_GET['SInvoice']) {
+ if ($trans->type == $type && $trans->type_no == $_GET['SInvoice']) {
$un_allocated = $trans->amount - $trans->amount_allocated;
if ($un_allocated){
$_SESSION['alloc']->allocs[$line]->current_allocated = $un_allocated;