示例#1
0
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;
}
end_row();
start_row();
label_cells(_("From"), payment_person_name($to_trans['person_type_id'], $to_trans['person_id']), "class='tableheader2'", "colspan={$colspan1}");
if ($show_currencies) {
    label_cells(_("Settle currency"), $to_trans['settle_curr'], "class='tableheader2'");
    label_cells(_("Settled amount"), number_format2($to_trans['settled_amount'], user_price_dec()), "class='tableheader2'");
}
label_cells(_("Deposit Type"), $bank_transfer_types[$to_trans['account_type']], "class='tableheader2'");
end_row();
start_row();
label_cells(_("Reference"), $to_trans['ref'], "class='tableheader2'", "colspan={$colspan2}");
end_row();
comments_display_row(ST_BANKDEPOSIT, $trans_no);
end_table(1);
is_voided_display(ST_BANKDEPOSIT, $trans_no, _("This deposit has been voided."));
$items = get_gl_trans(ST_BANKDEPOSIT, $trans_no);
if (db_num_rows($items) == 0) {
    display_note(_("There are no items for this deposit."));
} else {
    display_heading2(_("Items for this Deposit"));
    if ($show_currencies) {
        display_heading2(_("Item Amounts are Shown in:") . " " . $company_currency);
    }
    start_table(TABLESTYLE, "width=80%");
    $dim = get_company_pref('use_dimension');
    if ($dim == 2) {
        $th = array(_("Account Code"), _("Account Description"), _("Dimension") . " 1", _("Dimension") . " 2", _("Amount"), _("Memo"));
    } else {
        if ($dim == 1) {
            $th = array(_("Account Code"), _("Account Description"), _("Dimension"), _("Amount"), _("Memo"));
        } else {
示例#3
0
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;
}
示例#4
0
    label_cells(_("Currency"), $from_trans['bank_curr_code'], "class='tableheader2'");
}
label_cells(_("Amount"), number_format2(-$from_trans['amount'], user_price_dec()), "class='tableheader2'", "align=right");
label_cells(_("Date"), sql2date($from_trans['trans_date']), "class='tableheader2'");
end_row();
start_row();
label_cells(_("Pay To"), payment_person_name($from_trans['person_type_id'], $from_trans['person_id']), "class='tableheader2'", "colspan={$colspan1}");
label_cells(_("Payment Type"), $bank_transfer_types[$from_trans['account_type']], "class='tableheader2'");
end_row();
start_row();
label_cells(_("Reference"), $from_trans['ref'], "class='tableheader2'", "colspan={$colspan2}");
end_row();
comments_display_row(ST_BANKPAYMENT, $trans_no);
end_table(1);
$voided = is_voided_display(ST_BANKPAYMENT, $trans_no, _("This payment has been voided."));
$items = get_gl_trans(ST_BANKPAYMENT, $trans_no);
if (db_num_rows($items) == 0) {
    display_note(_("There are no items for this payment."));
} else {
    display_heading2(_("Items for this Payment"));
    if ($show_currencies) {
        display_heading2(_("Item Amounts are Shown in :") . " " . $company_currency);
    }
    echo "<br>";
    start_table(TABLESTYLE, "width=80%");
    $dim = get_company_pref('use_dimension');
    if ($dim == 2) {
        $th = array(_("Account Code"), _("Account Description"), _("Dimension") . " 1", _("Dimension") . " 2", _("Amount"), _("Memo"));
    } else {
        if ($dim == 1) {
            $th = array(_("Account Code"), _("Account Description"), _("Dimension"), _("Amount"), _("Memo"));
示例#5
0
    label_cells(tr("Currency"), $from_trans['bank_curr_code'], "class='tableheader2'");
}
label_cells(tr("Amount"), number_format2(-$from_trans['amount'], user_price_dec()), "class='tableheader2'", "align=right");
label_cells(tr("Date"), sql2date($from_trans['trans_date']), "class='tableheader2'");
end_row();
start_row();
label_cells(tr("Pay To"), payment_person_types::person_name($from_trans['person_type_id'], $from_trans['person_id']), "class='tableheader2'", "colspan={$colspan1}");
label_cells(tr("Payment Type"), $from_trans['BankTransType'], "class='tableheader2'");
end_row();
start_row();
label_cells(tr("Reference"), $from_trans['ref'], "class='tableheader2'", "colspan={$colspan2}");
end_row();
comments_display_row(systypes::bank_payment(), $trans_no);
end_table(1);
$voided = is_voided_display(systypes::bank_payment(), $trans_no, tr("This payment has been voided."));
$items = get_gl_trans(systypes::bank_payment(), $trans_no);
if (db_num_rows($items) == 0) {
    echo "<br>" . tr("There are no items for this payment.");
} else {
    display_heading2(tr("Items for this Payment"));
    if ($show_currencies) {
        display_heading2(tr("Item Amounts are Shown in :") . " " . $company_currency);
    }
    echo "<br>";
    start_table("{$table_style} width=80%");
    $th = array(tr("Account Code"), tr("Account Description"), tr("Amount"), tr("Memo"));
    table_header($th);
    $k = 0;
    //row colour counter
    $totalAmount = 0;
    while ($item = db_fetch($items)) {
示例#6
0
{
    global $systypes_array;
    $trans_name = $systypes_array[$_GET['type_id']];
    start_table(TABLESTYLE, "width='95%'");
    $th = array(_("General Ledger Transaction Details"), _("Reference"), _("Date"), _("Person/Item"));
    table_header($th);
    start_row();
    label_cell("{$trans_name} #" . $_GET['trans_no']);
    label_cell($myrow["reference"]);
    label_cell(sql2date($myrow["tran_date"]));
    label_cell(payment_person_name($myrow["person_type_id"], $myrow["person_id"]));
    end_row();
    comments_display_row($_GET['type_id'], $_GET['trans_no']);
    end_table(1);
}
$result = get_gl_trans($_GET['type_id'], $_GET['trans_no']);
if (db_num_rows($result) == 0) {
    echo "<p><center>" . _("No general ledger transactions have been created for") . " " . $systypes_array[$_GET['type_id']] . " " . _("number") . " " . $_GET['trans_no'] . "</center></p><br><br>";
    end_page(true);
    exit;
}
/*show a table of the transactions returned by the sql */
$dim = get_company_pref('use_dimension');
if ($dim == 2) {
    $th = array(_("Account Code"), _("Account Name"), _("Dimension") . " 1", _("Dimension") . " 2", _("Debit"), _("Credit"), _("Memo"));
} else {
    if ($dim == 1) {
        $th = array(_("Account Code"), _("Account Name"), _("Dimension"), _("Debit"), _("Credit"), _("Memo"));
    } else {
        $th = array(_("Account Code"), _("Account Name"), _("Debit"), _("Credit"), _("Memo"));
    }
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;
}
示例#8
0
function print_check_voucher()
{
    global $path_to_root, $systypes_array;
    $trans_no = $_POST['PARAM_0'];
    $trans_num = $_POST['PARAM_1'];
    $orientation = $_POST['PARAM_2'];
    $destination = $_POST['PARAM_3'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report2.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    $rep = new FrontReport(_('JOURNAL VOUCHER'), "JournalVoucher", user_pagesize(), 9, $orientation);
    $dec = user_price_dec();
    $cols = array(0, 65, 105, 125, 175, 210, 250, 300, 360, 370);
    $aligns = array('left', 'left', 'left', 'center', 'right', 'right', 'right', 'right', 'right');
    $rep->SetHeaderType(0);
    $rep->Font();
    $rep->Info(null, $cols, null, $aligns);
    $rep->NewPage();
    $res = get_transaction($trans_no);
    $myrow = db_fetch($res);
    $credit = $debit = 0;
    $res2 = get_gl_trans(0, $trans_num);
    $res3 = get_gl_trans(0, $trans_num);
    $fiscal = get_year();
    //to be use
    $year_no = substr(sql2date($fiscal['begin']), 8);
    //to be use
    $transtype = ST_JOURNAL;
    $ser = db_fetch(get_used_series($year_no, $transtype));
    $num = substr($ser['year'], 2);
    $rep->Font('bold');
    //$rep->TextCol(7,11, _("ST. MATTHEW'S PUBLISHING CORPORATION"));
    $rep->Font();
    $rep->NewLine();
    // $rep->TextCol(7,11, _("Tel. Nos. 426-5611 * 433-5385 Telefax: 426-1274"));
    $rep->NewLine(3);
    //$rep->Font('bold');
    //$rep->SetFontSize(14);
    //$rep->TextCol(3,8, _("JOURNAL VOUCHER"));
    $rep->NewLine(5);
    $rep->SetFontSize(10);
    $rep->TextCol(0, 2, $myrow['tranDate']);
    $rep->SetFontSize(12);
    $rep->TextCol(6, 8, $num . "-" . str_pad($myrow['customized_no'], 4, 0, STR_PAD_LEFT));
    $rep->NewLine(2);
    //$rep->Line($rep->row  - -10);
    // $rep->TextCol(7,8, _("DEBIT"));
    //$rep->TextCol(9,10, _("CREDIT"));
    //$rep->TextCol(5,7, _("ACCOUNT CODE"));
    $rep->SetFontSize(10);
    $rep->Font();
    //$rep->Line($rep->row  - 4);
    $rep->NewLine(2);
    while ($myrow3 = db_fetch($res3)) {
        $accounts = get_gl_accounts($myrow3['account']);
        $account = db_fetch($accounts);
        if ($myrow3['amount'] > 0) {
            $rep->TextCol(0, 3, $account['account_name']);
            $rep->TextCol(4, 5, $account['account_code']);
            $rep->AmountCol(5, 7, $myrow3['amount'], 2);
            $rep->NewLine();
            $debit += $myrow3['amount'];
        } else {
            $rep->TextCol(0, 3, $account['account_name']);
            $rep->TextCol(4, 5, $account['account_code']);
            $rep->AmountCol(7, 9, abs($myrow3['amount']), 2);
            $rep->NewLine();
            $credit += abs($myrow3['amount']);
        }
    }
    // $rep->Line($rep->row  - -4);
    $rep->NewLine(17);
    $rep->Font('bold');
    //$rep->TextCol(0,4, _("Total"));
    $rep->AmountCol(5, 7, $debit, 2);
    $rep->AmountCol(7, 9, $credit, 2);
    $rep->NewLine(2);
    $rep->Font();
    $comment = get_comments_string($transtype, $trans_num);
    $rep->TextCol(0, 9, $comment);
    // $rep->Line($rep->row  - 4);
    $rep->End();
}
示例#9
0
    label_cells(tr("Currency"), $to_trans['bank_curr_code'], "class='tableheader2'");
}
label_cells(tr("Amount"), number_format2($to_trans['amount'], user_price_dec()), "class='tableheader2'", "align=right");
label_cells(tr("Date"), sql2date($to_trans['trans_date']), "class='tableheader2'");
end_row();
start_row();
label_cells(tr("From"), payment_person_types::person_name($to_trans['person_type_id'], $to_trans['person_id']), "class='tableheader2'", "colspan={$colspan1}");
label_cells(tr("Deposit Type"), $to_trans['BankTransType'], "class='tableheader2'");
end_row();
start_row();
label_cells(tr("Reference"), $to_trans['ref'], "class='tableheader2'", "colspan={$colspan2}");
end_row();
comments_display_row(systypes::bank_deposit(), $trans_no);
end_table(1);
is_voided_display(systypes::bank_deposit(), $trans_no, tr("This deposit has been voided."));
$items = get_gl_trans(systypes::bank_deposit(), $trans_no);
if (db_num_rows($items) == 0) {
    echo "<br>" . tr("There are no items for this deposit.");
} else {
    display_heading2(tr("Items for this Deposit"));
    if ($show_currencies) {
        display_heading2(tr("Item Amounts are Shown in :") . " " . $company_currency);
    }
    start_table("{$table_style} width=80%");
    $th = array(tr("Account Code"), tr("Account Description"), tr("Amount"), tr("Memo"));
    table_header($th);
    $k = 0;
    //row colour counter
    $total_amount = 0;
    while ($item = db_fetch($items)) {
        if ($item["account"] != $to_trans["account_code"]) {
示例#10
0
function print_check_voucher()
{
    global $path_to_root, $systypes_array;
    $trans_no = $_POST['PARAM_0'];
    $trans_num = $_POST['PARAM_1'];
    $cv_no = $_POST['PARAM_2'];
    $account = $_POST['PARAM_3'];
    $orientation = $_POST['PARAM_4'];
    $destination = $_POST['PARAM_5'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report2.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    $rep = new FrontReport(_('CHECK VOUCHER'), "CheckVoucher", user_pagesize(), '', $orientation);
    $dec = user_price_dec();
    $cols = array(0, 30, 50, 125, 175, 200, 265, 285, 360, 425, 460, 542, 550);
    $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'left', 'left', 'right', 'right', 'right');
    $rep->SetHeaderType(0);
    $rep->Font();
    $rep->Info(null, $cols, null, $aligns);
    $rep->NewPage();
    $ty = explode("-", $trans_no);
    $t_type = $ty[1];
    if ($t_type != 0) {
        $res = get_transaction($trans_no, $t_type);
        $res1 = get_heading($trans_no, $t_type);
    } else {
        $res = get_transaction($trans_no, ST_DISBURSEMENT);
        $res1 = get_heading($trans_no, ST_DISBURSEMENT);
    }
    $myrow = db_fetch($res);
    $myrow1 = db_fetch($res1);
    $credit = $debit = 0;
    //$transtype = ST_DISBURSEMENT;
    if ($t_type != 0 || $t_type != '') {
        $res2 = get_gl_trans($t_type, $trans_num);
        $res3 = get_gl_trans($t_type, $trans_num);
    } else {
        $res2 = get_gl_trans(ST_DISBURSEMENT, $trans_num);
        $res3 = get_gl_trans(ST_DISBURSEMENT, $trans_num);
    }
    $new_ret = 0;
    $return = 0;
    //$fiscal = get_year(); //to be use
    // $year_no = substr(sql2date($fiscal['begin']), 8); //to be use
    // $ser = db_fetch(get_used_series($year_no, $transtype));
    // $num = substr($ser['year'], 2);
    /* $rep->Font('bold');
       $rep->TextCol(7,11, _("ST. MATTHEW'S PUBLISHING CORPORATION"));
       $rep->Font();
       $rep->NewLine();
       $rep->TextCol(7,11, _("Tel. Nos. 426-5611 * 433-5385 Telefax: 426-1274"));
       $rep->NewLine(3);
       $rep->Font('bold');
       $rep->SetFontSize(14);
       $rep->TextCol(5,8, _("CHECK VOUCHER"));*/
    $rep->NewLine(7);
    $rep->SetFontSize(12);
    $num = substr($myrow['yearDate'], 2);
    $name = payment_person_name($myrow["person_type_id"], $myrow["person_id"]);
    $rep->TextCol(2, 6, $name);
    $rep->TextCol(9, 11, $num . "-" . str_pad($myrow1['customized_no'], 4, 0, STR_PAD_LEFT));
    $rep->NewLine();
    if ($myrow1['customized_field'] != 0 || $myrow1['customized_field'] != '') {
        $rep->TextCol(0, 4, $myrow1['customized_field']);
    } else {
        $rep->TextCol(0, 4, _(""));
    }
    $rep->NewLine(1);
    $rep->TextCol(8, 10, $myrow['sqldate']);
    $rep->NewLine(5);
    // $rep->Line($rep->row  - -10);
    //  $rep->TextCol(4,6, _("PARTICULARS"));
    // $rep->TextCol(9,10, _("AMOUNT"));
    //  $rep->Line($rep->row  - 4);
    $var = array();
    $pos = array();
    $neg = array();
    $pos_amt = array();
    $neg_amt = array();
    $tots = 0;
    $comment = get_comments_string($cv_no, $trans_num);
    while ($myrow2 = db_fetch($res2)) {
        $tots = 0;
        if (is_bank_account($myrow2['account'])) {
            $var = array($myrow2['account']);
            $rep->TextCol(1, 8, $comment);
            $tots += abs($myrow2['amount']);
        }
    }
    $rep->AmountCol(9, 11, $tots, 2);
    $rep->NewLine(2);
    // $rep->Line($rep->row  - -10);
    // $rep->TextCol(1,3, _("DEBIT"));
    // $rep->TextCol(7,8, _("CREDIT"));
    // $rep->Line($rep->row  - 4);
    $rep->NewLine(5);
    $rep->SetFontSize(12);
    while ($myrow3 = db_fetch($res3)) {
        $accounts = get_gl_accounts($myrow3['account']);
        $account = db_fetch($accounts);
        if ($myrow3['amount'] > 0) {
            // $rep->Line($rep->row  - -10);
            //$rep->TextCol(0,4, $account['account_name']);
            //  $rep->AmountCol(5,6, $myrow3['amount'],2);
            //  $rep->NewLine();
            //  $rep->Line($rep->row  + 8);
            array_push($pos, $account['account_name']);
            array_push($pos_amt, $myrow3['amount']);
            $debit += $myrow3['amount'];
        } else {
            array_push($neg, $account['account_name']);
            array_push($neg_amt, $myrow3['amount']);
            //  $rep->Line($rep->row  - 4);
            //  $rep->TextCol(6,8, $account['account_name']);
            //  $rep->AmountCol(9,11, abs($myrow3['amount']), 2);
            //  $rep->NewLine();
            // $rep->Line($rep->row  - 4);
        }
    }
    $result = array_merge($pos, $neg);
    $new = array();
    for ($i = 0; $i < count($result); $i++) {
        $new[] = $pos[$i];
        $new[] = $neg[$i];
    }
    $result2 = array_merge($pos_amt, $neg_amt);
    $new2 = array();
    for ($j = 0; $j < count($result2); $j++) {
        $new2[] = $pos_amt[$j];
        $new2[] = $neg_amt[$j];
    }
    $final_res = array_merge($new, $new2);
    $final_array = array();
    $final = array();
    for ($k = 0; $k < count($final_res); $k++) {
        $final[] = $new[$k];
        $final[] = $new2[$k];
    }
    $enter = 0;
    for ($i = 0; $i <= count($final_res); $i++) {
        //if ($final[$i] != 0)
        //{
        $rep->TextCol(0, 4, $pos[$i]);
        if ($pos_amt[$i] != 0) {
            $rep->AmountCol(4, 6, $pos_amt[$i], 2);
        }
        $rep->TextCol(7, 9, $neg[$i]);
        if ($neg_amt[$i] != 0) {
            $rep->AmountCol(9, 11, abs($neg_amt[$i]), 2);
        }
        if ($pos[$i] != "") {
            $rep->NewLine();
            $enter++;
        }
        // }
    }
    $return = 11 - $enter;
    //$rep->Line($rep->row  - 4);
    $rep->NewLine($return);
    //$rep->TextCol(0,2, count($final_res));
    //$rep->TextCol(4,5, $enter);
    //else
    //  $rep->NewLine($return);
    $rep->SetFontSize(10);
    // $rep->TextCol(0,2, _("Cash"));
    $words = price_in_words($tots, ST_CHEQUE);
    $_word = strlen($words);
    $first_word = substr($words, 0, 34);
    $second_word = substr($words, 34);
    // if ($words != "")
    // {
    //$rep->TextCol(5,7, _("Received the sum of :"));
    // $oldrow = $rep->row;
    $rep->TextColLines(8, 11, $first_word . "-", -2);
    //$newrow = $rep->row;
    // $rep->row = $oldrow;
    // }
    $rep->SetFontSize(10);
    $rep->TextCol(1, 3, $myrow1['check_num']);
    $tots_dec = price_format($tots);
    $rep->TextCol(3, 7, "                       " . $tots_dec);
    $rep->SetFontSize(10);
    $rep->TextCol(7, 11, $second_word);
    //$rep->TextCol(7,10, _("as payment of the above particulars."));
    $rep->NewLine();
    $rep->SetFontSize(10);
    //$rep->TextCol(0,10, _("Bank/Branch: "));
    foreach ($var as $vars) {
        // $bank_name = get_bank_name($vars);
        $rep->TextCol(2, 10, get_bank_name($vars) . " ");
    }
    //  $rep->TextCol(1,5, $myrow['bank_address']);
    $rep->TextCol(7, 9, "     " . $tots_dec);
    $rep->End();
}