function create_cart($type = 0, $trans_no = 0) { global $Refs; if (isset($_SESSION['journal_items'])) { unset($_SESSION['journal_items']); } $cart = new items_cart($type); $cart->order_id = $trans_no; if ($trans_no) { $result = get_gl_trans($type, $trans_no); if ($result) { while ($row = db_fetch($result)) { if ($row['amount'] == 0) { continue; } $date = $row['tran_date']; $cart->add_gl_item($row['account'], $row['dimension_id'], $row['dimension2_id'], $row['amount'], $row['memo_']); } } $cart->memo_ = get_comments_string($type, $trans_no); $cart->tran_date = sql2date($date); $cart->reference = $Refs->get($type, $trans_no); $_POST['ref_original'] = $cart->reference; // Store for comparison when updating } else { $cart->reference = $Refs->get_next(0); $cart->tran_date = new_doc_date(); if (!is_date_in_fiscalyear($cart->tran_date)) { $cart->tran_date = end_fiscalyear(); } $_POST['ref_original'] = -1; } $_POST['memo_'] = $cart->memo_; $_POST['ref'] = $cart->reference; $_POST['date_'] = $cart->tran_date; $_POST['jv_no'] = $cart->custom_no; /**========MOODLEARNING=======*/ $_SESSION['journal_items'] =& $cart; }
function create_cart($type, $trans_no) { global $Refs; if (isset($_SESSION['pay_items'])) { unset($_SESSION['pay_items']); } $cart = new items_cart($type); $cart->order_id = $trans_no; if ($trans_no) { $bank_trans = db_fetch(get_bank_trans($type, $trans_no)); $_POST['bank_account'] = $bank_trans["bank_act"]; $_POST['PayType'] = $bank_trans["person_type_id"]; if ($bank_trans["person_type_id"] == PT_CUSTOMER) { $trans = get_customer_trans($trans_no, $type); $_POST['person_id'] = $trans["debtor_no"]; $_POST['PersonDetailID'] = $trans["branch_code"]; } elseif ($bank_trans["person_type_id"] == PT_SUPPLIER) { $trans = get_supp_trans($trans_no, $type); $_POST['person_id'] = $trans["supplier_id"]; } elseif ($bank_trans["person_type_id"] == PT_MISC) { $_POST['person_id'] = $bank_trans["person_id"]; } elseif ($bank_trans["person_type_id"] == PT_QUICKENTRY) { $_POST['person_id'] = $bank_trans["person_id"]; } else { $_POST['person_id'] = $bank_trans["person_id"]; } $cart->memo_ = get_comments_string($type, $trans_no); $cart->tran_date = sql2date($bank_trans['trans_date']); $cart->reference = $Refs->get($type, $trans_no); $cart->original_amount = $bank_trans['amount']; $result = get_gl_trans($type, $trans_no); if ($result) { while ($row = db_fetch($result)) { if (is_bank_account($row['account'])) { // date exchange rate is currenly not stored in bank transaction, // so we have to restore it from original gl amounts $ex_rate = $bank_trans['amount'] / $row['amount']; } else { $date = $row['tran_date']; $cart->add_gl_item($row['account'], $row['dimension_id'], $row['dimension2_id'], $row['amount'], $row['memo_']); } } } // apply exchange rate foreach ($cart->gl_items as $line_no => $line) { $cart->gl_items[$line_no]->amount *= $ex_rate; } } else { $cart->reference = $Refs->get_next($cart->trans_type); $cart->tran_date = new_doc_date(); if (!is_date_in_fiscalyear($cart->tran_date)) { $cart->tran_date = end_fiscalyear(); } } $_POST['memo_'] = $cart->memo_; $_POST['ref'] = $cart->reference; $_POST['date_'] = $cart->tran_date; $_SESSION['pay_items'] =& $cart; }
function create_cart($type = 0, $trans_no = 0) { global $Refs; if (isset($_SESSION['disbursement_items'])) { unset($_SESSION['disbursement_items']); } $cart = new items_cart($type); $cart->order_id = $trans_no; if ($trans_no) { $result = get_gl_trans($type, $trans_no); $_POST['PayType'] = $res["person_type_id"]; if ($res["person_type_id"] == PT_CUSTOMER) { $trans = get_customer_trans($trans_no, $type); $_POST['person_id'] = $trans["debtor_no"]; $_POST['PersonDetailID'] = $trans["branch_code"]; } elseif ($res["person_type_id"] == PT_SUPPLIER) { $trans = get_supp_trans($trans_no, $type); $_POST['person_id'] = $trans["supplier_id"]; } elseif ($res["person_type_id"] == PT_MISC) { $_POST['person_id'] = $res["person_id"]; } elseif ($res["person_type_id"] == PT_QUICKENTRY) { $_POST['person_id'] = $res["person_id"]; } else { $_POST['person_id'] = $res["person_id"]; } if ($result) { while ($row = db_fetch($result)) { if ($row['amount'] == 0) { continue; } $date = $row['tran_date']; $cart->add_gl_item($row['account'], $row['dimension_id'], $row['dimension2_id'], $row['amount'], $row['memo_']); } } $cart->memo_ = get_comments_string($type, $trans_no); $cart->tran_date = sql2date($date); if ($type == ST_DISBURSEMENT) { $voucher_type = 'Check Voucher'; $cart->reference = $Refs->get(ST_DISBURSEMENT, $trans_no); } if ($type == ST_SUPPAYMENT) { $cart->reference = $Refs->get_next(ST_DISBURSEMENT); } $_POST['ref_original'] = $cart->reference; // Store for comparison when updating } else { $cart->reference = $Refs->get_next(ST_DISBURSEMENT); $cart->tran_date = new_doc_date(); if (!is_date_in_fiscalyear($cart->tran_date)) { $cart->tran_date = end_fiscalyear(); } $_POST['ref_original'] = -1; } $_POST['memo_'] = $cart->memo_; $_POST['ref'] = $cart->reference; $_POST['date_'] = $cart->tran_date; $_POST['cv_no'] = $cart->custom_no; /**========MOODLEARNING=======*/ $_POST['address'] = $cart->address; $_POST['check_num'] = $cart->check_num; $_POST['PayType'] = $cart->person_id; $_POST['person_id'] = $cart->person_detail_id; $_POST['settled_amount'] = $cart->settled_amount; $_SESSION['disbursement_items'] =& $cart; }