Example #1
0
function show_results()
{
    global $path_to_root, $table_style;
    if (!isset($_POST["account"]) || $_POST["account"] == "") {
        return;
    }
    $act_name = get_gl_account_name($_POST["account"]);
    $dim = get_company_pref('use_dimension');
    /*Now get the transactions  */
    if (!isset($_POST['Dimension'])) {
        $_POST['Dimension'] = 0;
    }
    if (!isset($_POST['Dimension2'])) {
        $_POST['Dimension2'] = 0;
    }
    $result = get_gl_transactions($_POST['TransFromDate'], $_POST['TransToDate'], -1, $_POST["account"], $_POST['Dimension'], $_POST['Dimension2']);
    $colspan = $dim == 2 ? "6" : ($dim == 1 ? "5" : "4");
    //echo "\nDimension =". $_POST['Dimension'];
    display_heading($_POST["account"] . "   " . $act_name);
    start_table($table_style);
    if ($dim == 2) {
        $th = array(tr("Type"), tr("#"), tr("Date"), tr("Dimension") . " 1", tr("Dimension") . " 2", tr("Person/Item"), tr("Debit"), tr("Credit"), tr("Balance"), tr("Memo"));
    } else {
        if ($dim == 1) {
            $th = array(tr("Type"), tr("#"), tr("Date"), tr("Dimension"), tr("Person/Item"), tr("Debit"), tr("Credit"), tr("Balance"), tr("Memo"));
        } else {
            $th = array(tr("Type"), tr("#"), tr("Date"), tr("Person/Item"), tr("Debit"), tr("Credit"), tr("Balance"), tr("Memo"));
        }
    }
    table_header($th);
    if (is_account_balancesheet($_POST["account"])) {
        $begin = "";
    } else {
        $begin = begin_fiscalyear();
        if ($_POST['TransFromDate'] < $begin) {
            $begin = $_POST['TransFromDate'];
        }
        $begin = add_days($begin, -1);
    }
    $bfw = get_gl_balance_from_to($begin, $_POST['TransFromDate'], $_POST["account"], $_POST['Dimension'], $_POST['Dimension2']);
    start_row("class='inquirybg'");
    label_cell("<b>" . tr("Opening Balance") . " - " . $_POST['TransFromDate'] . "</b>", "colspan={$colspan}");
    display_debit_or_credit_cells($bfw);
    label_cell("");
    end_row();
    //$running_total =0;
    $running_total = $bfw;
    $j = 1;
    $k = 0;
    //row colour counter
    while ($myrow = db_fetch($result)) {
        alt_table_row_color($k);
        $running_total += $myrow["amount"];
        $trandate = sql2date($myrow["tran_date"]);
        label_cell(systypes::name($myrow["type"]));
        label_cell(get_gl_view_str($myrow["type"], $myrow["type_no"], $myrow["type_no"], true));
        label_cell($trandate);
        if ($dim >= 1) {
            label_cell(get_dimension_string($myrow['dimension_id'], true));
        }
        if ($dim > 1) {
            label_cell(get_dimension_string($myrow['dimension2_id'], true));
        }
        label_cell(payment_person_types::person_name($myrow["person_type_id"], $myrow["person_id"]));
        display_debit_or_credit_cells($myrow["amount"]);
        amount_cell($running_total);
        label_cell($myrow['memo_']);
        end_row();
        $j++;
        if ($j == 12) {
            $j = 1;
            table_header($th);
        }
    }
    //end of while loop
    start_row("class='inquirybg'");
    label_cell("<b>" . tr("Ending Balance") . " - " . $_POST['TransToDate'] . "</b>", "colspan={$colspan}");
    display_debit_or_credit_cells($running_total);
    label_cell("");
    end_row();
    end_table(2);
    if (db_num_rows($result) == 0) {
        display_note(tr("No general ledger transactions have been created for this account on the selected dates."), 0, 1);
    }
}
Example #2
0
function show_results()
{
    global $path_to_root, $systypes_array;
    if (!isset($_POST["account"])) {
        $_POST["account"] = null;
    }
    $act_name = $_POST["account"] ? get_gl_account_name($_POST["account"]) : "";
    $dim = get_company_pref('use_dimension');
    /*Now get the transactions  */
    if (!isset($_POST['Dimension'])) {
        $_POST['Dimension'] = 0;
    }
    if (!isset($_POST['Dimension2'])) {
        $_POST['Dimension2'] = 0;
    }
    $result = get_gl_transactions($_POST['TransFromDate'], $_POST['TransToDate'], -1, $_POST["account"], $_POST['Dimension'], $_POST['Dimension2'], null, input_num('amount_min'), input_num('amount_max'));
    $colspan = $dim == 2 ? "6" : ($dim == 1 ? "5" : "4");
    if ($_POST["account"] != null) {
        display_heading($_POST["account"] . "&nbsp;&nbsp;&nbsp;" . $act_name);
    }
    // Only show balances if an account is specified AND we're not filtering by amounts
    $show_balances = $_POST["account"] != null && input_num("amount_min") == 0 && input_num("amount_max") == 0;
    start_table(TABLESTYLE);
    $first_cols = array(_("Type"), _("#"), _("Date"));
    if ($_POST["account"] == null) {
        $account_col = array(_("Account"));
    } else {
        $account_col = array();
    }
    if ($dim == 2) {
        $dim_cols = array(_("Dimension") . " 1", _("Dimension") . " 2");
    } else {
        if ($dim == 1) {
            $dim_cols = array(_("Dimension"));
        } else {
            $dim_cols = array();
        }
    }
    if ($show_balances) {
        $remaining_cols = array(_("Person/Item"), _("Debit"), _("Credit"), _("Balance"), _("Memo"));
    } else {
        $remaining_cols = array(_("Person/Item"), _("Debit"), _("Credit"), _("Memo"));
    }
    $th = array_merge($first_cols, $account_col, $dim_cols, $remaining_cols);
    table_header($th);
    if ($_POST["account"] != null && is_account_balancesheet($_POST["account"])) {
        $begin = "";
    } else {
        $begin = get_fiscalyear_begin_for_date($_POST['TransFromDate']);
        if (date1_greater_date2($begin, $_POST['TransFromDate'])) {
            $begin = $_POST['TransFromDate'];
        }
        $begin = add_days($begin, -1);
    }
    $bfw = 0;
    if ($show_balances) {
        $bfw = get_gl_balance_from_to($begin, $_POST['TransFromDate'], $_POST["account"], $_POST['Dimension'], $_POST['Dimension2']);
        start_row("class='inquirybg'");
        label_cell("<b>" . _("Opening Balance") . " - " . $_POST['TransFromDate'] . "</b>", "colspan={$colspan}");
        display_debit_or_credit_cells($bfw, true);
        label_cell("");
        label_cell("");
        end_row();
    }
    $running_total = $bfw;
    $j = 1;
    $k = 0;
    //row colour counter
    while ($myrow = db_fetch($result)) {
        alt_table_row_color($k);
        $running_total += $myrow["amount"];
        $trandate = sql2date($myrow["tran_date"]);
        label_cell($systypes_array[$myrow["type"]]);
        label_cell(get_gl_view_str($myrow["type"], $myrow["type_no"], $myrow["type_no"], true));
        label_cell($trandate);
        if ($_POST["account"] == null) {
            label_cell($myrow["account"] . ' ' . get_gl_account_name($myrow["account"]));
        }
        if ($dim >= 1) {
            label_cell(get_dimension_string($myrow['dimension_id'], true));
        }
        if ($dim > 1) {
            label_cell(get_dimension_string($myrow['dimension2_id'], true));
        }
        label_cell(payment_person_name($myrow["person_type_id"], $myrow["person_id"]));
        display_debit_or_credit_cells($myrow["amount"]);
        if ($show_balances) {
            amount_cell($running_total);
        }
        if ($myrow['memo_'] == "") {
            $myrow['memo_'] = get_comments_string($myrow['type'], $myrow['type_no']);
        }
        label_cell($myrow['memo_']);
        end_row();
        $j++;
        if ($j == 12) {
            $j = 1;
            table_header($th);
        }
    }
    //end of while loop
    if ($show_balances) {
        start_row("class='inquirybg'");
        label_cell("<b>" . _("Ending Balance") . " - " . $_POST['TransToDate'] . "</b>", "colspan={$colspan}");
        display_debit_or_credit_cells($running_total, true);
        label_cell("");
        label_cell("");
        end_row();
    }
    end_table(2);
    if (db_num_rows($result) == 0) {
        display_note(_("No general ledger transactions have been created for the specified criteria."), 0, 1);
    }
}
Example #3
0
$page_security = 'SA_ACCRUALS';
$path_to_root = "../..";
include_once $path_to_root . "/includes/session.inc";
$_SESSION['page_title'] = _($help_context = _("Search General Ledger Transactions for account: ") . $_GET['act']);
page($_SESSION['page_title'], true);
include_once $path_to_root . "/includes/date_functions.inc";
include_once $path_to_root . "/includes/ui.inc";
include_once $path_to_root . "/gl/includes/gl_db.inc";
$js = "\n<script type='text/javascript'>\n" . "<!--\n" . " function WindowClose(amount_, date__)\n" . "{\n" . " opener.document.getElementsByName('amount')[0].value = amount_; \n" . " opener.document.getElementsByName('date_')[0].value = date__; \n" . " window.close();\n" . " return true;\n" . "}\n" . "-->\n" . "</script>\n";
echo $js;
if (!isset($_GET['act']) || !isset($_GET['date'])) {
    /*Script was not passed the correct parameters */
    echo "<p>" . _("The script must be called with a valid transaction type and transaction number to review the general ledger postings for.") . "</p>";
    exit;
}
display_heading($_SESSION['page_title'] . " " . get_gl_account_name($_GET['act']));
br();
start_table(TABLESTYLE);
$dim = get_company_pref('use_dimension');
$first_cols = array(_("Type"), "#", _("Date"));
if ($dim == 2) {
    $dim_cols = array(_("Dimension") . " 1", _("Dimension") . " 2");
} else {
    if ($dim == 1) {
        $dim_cols = array(_("Dimension"));
    } else {
        $dim_cols = array();
    }
}
$remaining_cols = array(_("Person/Item"), _("Debit"), _("Credit"), _("Memo"));
$th = array_merge($first_cols, $dim_cols, $remaining_cols);
Example #4
0
         $Refs->save(ST_JOURNAL, $id, $ref);
     } else {
         alt_table_row_color($k);
         label_cell($date);
         label_cell($_POST['acc_act'] . " " . get_gl_account_name($_POST['acc_act']));
         if ($dim > 0) {
             label_cell("");
         }
         if ($dim > 1) {
             label_cell("");
         }
         display_debit_or_credit_cells($am0 * -1);
         label_cell($memo);
         alt_table_row_color($k);
         label_cell($date);
         label_cell($_POST['res_act'] . " " . get_gl_account_name($_POST['res_act']));
         if ($dim > 0) {
             label_cell(get_dimension_string($_POST['dimension_id'], true));
         }
         if ($dim > 1) {
             label_cell(get_dimension_string($_POST['dimension2_id'], true));
         }
         display_debit_or_credit_cells($am0);
         label_cell($memo);
     }
 }
 if (isset($_POST['go'])) {
     commit_transaction();
     display_notification_centered(_("Revenue / Cost Accruals have been processed."));
     $_POST['date_'] = $_POST['amount'] = $_POST['periods'] = "";
 } else {
function print_inventory_sales()
{
    global $path_to_root;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $destination = $_POST['PARAM_2'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $dec = user_price_dec();
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    $cols = array(0, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1050, 1100, 1150, 1200, 1250, 1300, 1350, 1400, 1450, 1500, 1550, 1600, 1650, 1700, 1750, 1800);
    $headers = array(_('Account'), _('JANUARY'), _(''), _('FEBRUARY'), _(''), _('MARCH'), _(''), _('APRIL'), _(''), _('MAY'), _(''), _('JUNE'), _(''), _('JULY'), _(''), _('AUGUST'), _(''), _('SEPTEMBER'), _(''), _('OCTOBER'), _(''), _('NOVEMBER'), _(''), _('DECEMBER'));
    $headers2 = array(_(''), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'), _('DR'), _('CR'));
    $aligns = array('left', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''));
    $rep = new FrontReport(_('Recapitulation'), "CashDisbursementSummary", user_pagesize(), 8, 'L');
    $rep->Font();
    $rep->Info($params, $cols, $headers2, $aligns, $cols, $headers, $aligns);
    $rep->NewPage();
    $acc = getExpenseAccount();
    $account = array();
    while ($accs = db_fetch($acc)) {
        array_push($account, $accs['account_code']);
    }
    $year = substr(date2sql($from), 0, 4);
    //$res = getTransactions($from, $to);
    $previous = '';
    $dr = 0;
    $cr = 0;
    // $monthfr = date("n",strtotime($from));
    // $monthto = date("n",strtotime($to));
    $date_from = date2sql($from);
    $date_to = date2sql($to);
    $monthfr = date("n", strtotime($date_from));
    $monthto = date("n", strtotime($date_to));
    //$myrow = 0;
    //$row = 0;
    $row = getTransactions($monthfr, $monthto, $year, $account);
    // $myrow = db_fetch($row);
    foreach ($row as $myrow) {
        $acc_name = get_gl_account_name($myrow[0]);
        $rep->TextCol(0, 1, $acc_name);
        $rep->AmountCol(1, 2, $myrow[1], 2);
        $rep->AmountCol(2, 3, abs($myrow[2]), 2);
        $rep->AmountCol(3, 4, $myrow[3], 2);
        $rep->AmountCol(4, 5, abs($myrow[4]), 2);
        $rep->AmountCol(5, 6, $myrow[5], 2);
        $rep->AmountCol(6, 7, abs($myrow[6]), 2);
        $rep->AmountCol(7, 8, $myrow[7], 2);
        $rep->AmountCol(8, 9, abs($myrow[8]), 2);
        $rep->AmountCol(9, 10, $myrow[9], 2);
        $rep->AmountCol(10, 11, abs($myrow[10]), 2);
        $rep->AmountCol(11, 12, $myrow[11], 2);
        $rep->AmountCol(12, 13, abs($myrow[12]), 2);
        $rep->AmountCol(13, 14, $myrow[13], 2);
        $rep->AmountCol(14, 15, abs($myrow[14]), 2);
        $rep->AmountCol(15, 16, $myrow[15], 2);
        $rep->AmountCol(16, 17, abs($myrow[16]), 2);
        $rep->AmountCol(17, 18, $myrow[17], 2);
        $rep->AmountCol(18, 19, abs($myrow[18]), 2);
        $rep->AmountCol(19, 20, $myrow[19], 2);
        $rep->AmountCol(20, 21, abs($myrow[20]), 2);
        $rep->AmountCol(21, 22, $myrow[21], 2);
        $rep->AmountCol(22, 23, abs($myrow[22]), 2);
        $rep->AmountCol(23, 24, $myrow[23], 2);
        $rep->AmountCol(24, 25, abs($myrow[24]), 2);
        $rep->NewLine();
    }
    $rep->End();
}
function print_inventory_sales()
{
    global $path_to_root;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $destination = $_POST['PARAM_2'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $dec = user_price_dec();
    if ($category == ALL_NUMERIC) {
        $category = 0;
    }
    if ($category == 0) {
        $cat = _('All');
    } else {
        $cat = get_category_name($category);
    }
    $cols = array(0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1050, 1100, 1150, 1200);
    $headers = array(_('DATE'), _('PAYEES'), _('PARTICULARS'), _('GV NO'), _('CHECK NO'), _('CASH IN'), _('PURCHASES'), _('SALARIES &'), _('SUPPLIES'), _('GASOLINE &'), _('LIGHT &'), _('TELECOMS'), _('REPAIRS'), _('REPRESENTATION'), _('TRANSPORTATION'), _('POSTAGE'), _('AD &'), _('PROF.'), _('INSURANCE'), _('CASH'), _('SUNDRY'), _('DEBIT'), _('CREDIT'));
    $header2 = array(_(''), '', '', '', _(''), _('BANK'), _(''), _('WAGES'), _(''), _('OIL'), _('WATER'), _(''), _('& MAINT.'), _('EXPENSE'), _('EXPENSE'), _('& COURIER'), _('PROMO'), _('FEES'), _(''), _('ADVANCE'), _('ACCOUNTS'));
    $aligns = array('left', 'center', 'center', 'center', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Category'), 'from' => $cat, 'to' => ''));
    $rep = new FrontReport(_('Cash Disbursement Summary'), "CashDisbursementSummary", user_pagesize(), 8, 'L');
    $rep->Font();
    $rep->Info($params, $cols, $header2, $aligns, $cols, $headers, $aligns);
    $rep->NewPage();
    $salary = '6-1010';
    $purchase = '5-1010';
    $supplies = '6-1175';
    $gas_oil = '6-1110';
    $light_water = '6-1075';
    $tel = '6-1080';
    $repair = '6-1085';
    $representation = '6-1055';
    $transport = '6-1070';
    $postage = '6-1155';
    $ad_promo = '6-1230';
    $prof_fee = '6-1185';
    $insurance = '6-1105';
    $cash_advance = '1-2045';
    $petty_cash = '1-1010';
    $res = getTransactions($from, $to);
    $previous = '';
    $var = array($salary, $purchase, $gas_oil, $light_water, $tel, $repair, $representation, $transport, $postage, $ad_promo, $prof_fee, $insurance, $cash_advance);
    $total = 0;
    $purchase_total = 0;
    $sal_total = 0;
    $sup_total = 0;
    $gas_total = 0;
    $light_total = 0;
    $tel_total = 0;
    $repair_total = 0;
    $rep_total = 0;
    $trans_total = 0;
    $post_total = 0;
    $ad_total = 0;
    $prof_total = 0;
    $ins_total = 0;
    $adv_total = 0;
    $dr = 0;
    $cr = 0;
    $sun_bank_name = '';
    $sun_bank_amount = '';
    while ($myrow = db_fetch($res)) {
        $check = $myrow['customized_no'];
        $current = $check;
        $name = payment_person_name($myrow["person_type_id"], $myrow["person_id"]);
        $comment = get_comments_string($myrow['type'], $myrow['type_no']);
        $account_name = get_gl_account_name($myrow['account']);
        //$rep->NewLine();
        if ($current != '') {
            if ($previous == $current) {
                if ($myrow['type'] == '') {
                    if (is_bank_account($myrow['account'])) {
                        if ($myrow['account'] != $petty_cash) {
                            $rep->AmountCol(5, 6, abs($myrow['amount']), 2);
                            $total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $purchase) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(6, 7, abs($myrow['amount']), 2);
                            $purchase_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $salary) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(7, 8, abs($myrow['amount']), 2);
                            $sal_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $supplies) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(8, 9, abs($myrow['amount']), 2);
                            $sup_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $gas_oil) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(9, 10, abs($myrow['amount']), 2);
                            $gas_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $light_water) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(10, 11, abs($myrow['amount']), 2);
                            $light_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $tel) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(11, 12, abs($myrow['amount']), 2);
                            $tel_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $repair) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(12, 13, abs($myrow['amount']), 2);
                            $repair_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $representation) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(13, 14, abs($myrow['amount']), 2);
                            $rep_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $transport) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(14, 15, abs($myrow['amount']), 2);
                            $trans_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $postage) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(15, 16, abs($myrow['amount']), 2);
                            $post_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $ad_promo) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(16, 17, abs($myrow['amount']), 2);
                            $ad_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $prof_fee) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(17, 18, abs($myrow['amount']), 2);
                            $prof_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $insurance) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(18, 19, abs($myrow['amount']), 2);
                            $ins_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $cash_advance) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(19, 20, abs($myrow['amount']), 2);
                            $adv_total += abs($myrow['amount']);
                        }
                    }
                }
            } else {
                if ($sun_bank_amount != 0 && $sun_bank_name != '') {
                    $rep->TextCol(20, 21, $account_name);
                    $rep->AmountCol(21, 22, $myrow['amount'], 2);
                    $rep->NewLine();
                }
                $result = get_sundry($previous);
                $ctr = 0;
                while ($row = db_fetch($result)) {
                    if ($row['type'] == "") {
                        if (!is_bank_account($row['account'])) {
                            $yes = check_account($row['account'], $row['amount']);
                            if ($yes) {
                                // $rep->TextCol(22, 23, $check_account($row['account']));
                                $ctr++;
                                if ($ctr > 1) {
                                    $rep->NewLine();
                                }
                                $account_name2 = get_gl_account_name($row['account']);
                                $rep->TextCol(20, 21, $account_name2);
                                if ($row['amount'] > 0) {
                                    $rep->AmountCol(21, 22, $row['amount'], 2);
                                    $dr += abs($myrow['amount']);
                                } else {
                                    $rep->AmountCol(22, 23, abs($row['amount']), 2);
                                    $cr += abs($myrow['amount']);
                                }
                            }
                        }
                    }
                }
                $rep->NewLine();
                if ($myrow['type'] == '') {
                    $rep->TextCol(0, 1, $myrow['tranDate']);
                    $rep->TextCol(1, 2, $name);
                    $rep->TextCol(2, 3, $comment);
                    $rep->TextCol(3, 4, $myrow['customized_no']);
                    $rep->TextCol(4, 5, $myrow['check_num']);
                    if (is_bank_account($myrow['account'])) {
                        if ($myrow['account'] != $petty_cash) {
                            $rep->AmountCol(5, 6, abs($myrow['amount']), 2);
                            $total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $purchase) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(6, 7, abs($myrow['amount']), 2);
                            $purchase_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $salary) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(7, 8, abs($myrow['amount']), 2);
                            $sal_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $supplies) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(8, 9, abs($myrow['amount']), 2);
                            $sup_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $gas_oil) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(9, 10, abs($myrow['amount']), 2);
                            $gas_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $light_water) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(10, 11, abs($myrow['amount']), 2);
                            $light_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $tel) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(11, 12, abs($myrow['amount']), 2);
                            $tel_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $repair) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(12, 13, abs($myrow['amount']), 2);
                            $repair_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $representation) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(13, 14, abs($myrow['amount']), 2);
                            $rep_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $transport) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(14, 15, abs($myrow['amount']), 2);
                            $trans_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $postage) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(15, 16, abs($myrow['amount']), 2);
                            $post_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $ad_promo) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(16, 17, abs($myrow['amount']), 2);
                            $ad_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $prof_fee) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(17, 18, abs($myrow['amount']), 2);
                            $prof_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $insurance) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(18, 19, abs($myrow['amount']), 2);
                            $ins_total += abs($myrow['amount']);
                        }
                    }
                    if ($myrow['account'] == $cash_advance) {
                        if ($myrow['amount'] > 0) {
                            $rep->AmountCol(19, 20, abs($myrow['amount']), 2);
                            $adv_total += abs($myrow['amount']);
                        }
                    }
                } else {
                    $rep->TextCol(0, 1, $myrow['tranDate']);
                    $rep->TextCol(1, 2, "Cancelled");
                    $rep->TextCol(2, 3, "");
                    $rep->TextCol(3, 4, $myrow['customized_no']);
                    $rep->TextCol(4, 5, $myrow['check_num']);
                }
            }
            $previous = $current;
        }
    }
    $rep->NewLine();
    $rep->Font('bold');
    $rep->AmountCol(5, 6, $total, 2);
    $rep->AmountCol(6, 7, $purchase_total, 2);
    $rep->AmountCol(7, 8, $sal_total, 2);
    $rep->AmountCol(8, 9, $sup_total, 2);
    $rep->AmountCol(9, 10, $gas_total, 2);
    $rep->AmountCol(10, 11, $light_total, 2);
    $rep->AmountCol(11, 12, $tel_total, 2);
    $rep->AmountCol(12, 13, $repair_total, 2);
    $rep->AmountCol(13, 14, $rep_total, 2);
    $rep->AmountCol(14, 15, $trans_total, 2);
    $rep->AmountCol(15, 16, $post_total, 2);
    $rep->AmountCol(16, 17, $ad_total, 2);
    $rep->AmountCol(17, 18, $prof_total, 2);
    $rep->AmountCol(18, 19, $ins_total, 2);
    $rep->AmountCol(19, 20, $adv_total, 2);
    $rep->AmountCol(21, 22, $dr, 2);
    $rep->AmountCol(22, 23, $cr, 2);
    /* $i = 0;
       $k = 1;
       foreach($var as $vars)
       {
           $tots = getTotal($vars);
           $rep->AmountCol($i, $k, $tots, 2);
           $i++;
           $j++;
       }*/
    $rep->End();
}
 }
 if ($type == ST_BANKDEPOSIT || $type == ST_BANKPAYMENT || $type == ST_JOURNAL) {
     $description = get_gl_account_name($code_id);
 }
 if (is_date($date) == false) {
     display_error(_("Error: date '{$date}' not properly formatted (line {$line} in import file '{$_FILES['imp']['name']}')"));
     $error = true;
 }
 //$date = sql2date($date);
 if (is_date_in_fiscalyear($date) == false) {
     display_error(_("Error: Date not within company fiscal year. Make sure date is in dd/mm/yyyy format and your csv years are 4 digits long. Check that current fiscal year is active under Setup..Company Setup"));
     $error = true;
 }
 // validation for
 if ($type == ST_BANKDEPOSIT || $type == ST_BANKPAYMENT) {
     $bankdesc = get_gl_account_name($bank_account_gl_code);
 }
 if ($type == ST_BANKDEPOSIT || $type == ST_BANKPAYMENT || $type == ST_JOURNAL) {
     $i = journal_display($i, $type, $taxtype, $amt, $entry, $code_id, $dim1, $dim2, $memo, $description, $bank_account_gl_code, $bank_desc);
 }
 if (!$error) {
     if ($type == ST_JOURNAL) {
         if (gl_account_in_bank_accounts($code_id) == true) {
             display_notification_centered(_("Error: Bank account detected in journal. No processing of bank accounts allowed. (line {$line} in import file '{$_FILES['imp']['name']}')"));
             $error = true;
         }
         if (check_tax_appropriate($code_id, $taxtype, $line) == true) {
             journal_inclusive_tax($type, $date, $line, $curEntryId, $code_id, $dim1, $dim2, $memo, $amt, $taxtype, $person_type_id, $person_id);
             add_audit_trail($type, $curEntryId, $date);
         }
     } elseif (($type == ST_BANKDEPOSIT || $type == ST_BANKPAYMENT) && $amt > 0) {