コード例 #1
0
 function render($id, $title)
 {
     global $path_to_root, $systypes_array;
     include_once $path_to_root . "/includes/ui.inc";
     $start_date = add_days(Today(), -$this->days_past);
     $end_date = add_days(Today(), $this->days_future);
     $result = get_bank_trans_for_bank_account($this->bank_act, $start_date, $end_date);
     start_table(TABLESTYLE, 'width=98%');
     $th = array(_("#"), _("Date"), _("Receipt"), _("Payment"), _("Balance"), _("Person/Item"), _("Memo"), "");
     table_header($th);
     $bfw = get_balance_before_for_bank_account($this->bank_act, $start_date);
     $credit = $debit = 0;
     start_row("class='inquirybg' style='font-weight:bold'");
     label_cell(_("Opening Balance") . " - " . $start_date, "colspan=4");
     display_debit_or_credit_cells($bfw);
     label_cell("");
     label_cell("", "colspan=2");
     end_row();
     $running_total = $bfw;
     if ($bfw > 0) {
         $debit += $bfw;
     } else {
         $credit += $bfw;
     }
     $j = 1;
     $k = 0;
     //row colour counter
     while ($myrow = db_fetch($result)) {
         alt_table_row_color($k);
         $running_total += $myrow["amount"];
         label_cell(get_trans_view_str($myrow["type"], $myrow["trans_no"]));
         $trandate = sql2date($myrow["trans_date"]);
         label_cell($trandate);
         display_debit_or_credit_cells($myrow["amount"]);
         amount_cell($running_total);
         label_cell(payment_person_name($myrow["person_type_id"], $myrow["person_id"]));
         label_cell(get_comments_string($myrow["type"], $myrow["trans_no"]));
         label_cell(get_gl_view_str($myrow["type"], $myrow["trans_no"]));
         end_row();
         if ($myrow["amount"] > 0) {
             $debit += $myrow["amount"];
         } else {
             $credit += $myrow["amount"];
         }
         if ($j == 12) {
             $j = 1;
             table_header($th);
         }
         $j++;
     }
     //end of while loop
     start_row("class='inquirybg' style='font-weight:bold'");
     label_cell(_("Ending Balance") . " - " . $end_date, "colspan=4");
     amount_cell($debit + $credit);
     label_cell("");
     label_cell("", "colspan=2");
     end_row();
     end_table(2);
 }
コード例 #2
0
ファイル: gl_trans_view.php プロジェクト: M-Shahbaz/FA
function display_gl_heading($myrow)
{
    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);
}
コード例 #3
0
function display_gl_heading($myrow)
{
    global $systypes_array;
    $title = "";
    //moodlearning
    if ($myrow['type'] == 55 || $myrow['type'] == 1) {
        if ($myrow['type'] == 0) {
            $title = "JV No.";
            $num = substr($ser['year'], 2);
        }
        if ($myrow['type'] == 55) {
            $voucher_type = "Check Voucher";
            $title = "CV No.";
            $myDateTime = DateTime::createFromFormat('Y-m-d', $myrow['tran_date']);
            $newDateString = $myDateTime->format('d-m-Y');
            $year = substr($newDateString, 8) . "-";
        }
    }
    $trans_name = $systypes_array[$_GET['type_id']];
    start_table(TABLESTYLE, "width=95%");
    if ($myrow['type'] == 0 || $myrow['type'] == 1 || $myrow['type'] == 55) {
        $th = array(_("General Ledger Transaction Details"), _("Reference"), _("Date"), _("Person/Item"), $title);
    } else {
        $th = array(_("General Ledger Transaction Details"), _("Reference"), _("Date"), _("Person/Item"));
    }
    table_header($th);
    start_row();
    if ($custom == 0) {
        label_cell("{$trans_name} #" . $_GET['type_id']);
    } else {
        label_cell("{$trans_name} #" . get_customized_no($myrow['type'], $myrow['type_no']));
    }
    label_cell($myrow["reference"]);
    label_cell(sql2date($myrow["tran_date"]));
    label_cell(payment_person_name($myrow["person_type_id"], $myrow["person_id"]));
    if ($myrow['type'] == 0 || $myrow['type'] == 1 || $myrow['type'] == 55) {
        label_cell($year . str_pad(get_customized_no($myrow['type'], $myrow['type_no']), 4, 0, STR_PAD_LEFT));
    }
    //moodlearning
    end_row();
    comments_display_row($_GET['type_id'], $_GET['trans_no']);
    end_table(1);
}
コード例 #4
0
    $colspan1 = 1;
    $colspan2 = 7;
} else {
    $colspan1 = 3;
    $colspan2 = 5;
}
start_row();
label_cells(_("To Bank Account"), $to_trans['bank_account_name'], "class='tableheader2'");
if ($show_currencies) {
    label_cells(_("Currency"), $to_trans['bank_curr_code'], "class='tableheader2'");
}
label_cells(_("Amount"), number_format2($to_trans['amount'], user_price_dec()), "class='tableheader2'", "align=right");
label_cells(_("Date"), sql2date($to_trans['trans_date']), "class='tableheader2'");
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."));
コード例 #5
0
ファイル: rep704.php プロジェクト: knjy24/FrontAccounting
function print_GL_transactions()
{
    global $path_to_root, $systypes_array;
    $dim = get_company_pref('use_dimension');
    $dimension = $dimension2 = 0;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $fromacc = $_POST['PARAM_2'];
    $toacc = $_POST['PARAM_3'];
    if ($dim == 2) {
        $dimension = $_POST['PARAM_4'];
        $dimension2 = $_POST['PARAM_5'];
        $comments = $_POST['PARAM_6'];
        $orientation = $_POST['PARAM_7'];
        $destination = $_POST['PARAM_8'];
    } else {
        if ($dim == 1) {
            $dimension = $_POST['PARAM_4'];
            $comments = $_POST['PARAM_5'];
            $orientation = $_POST['PARAM_6'];
            $destination = $_POST['PARAM_7'];
        } else {
            $comments = $_POST['PARAM_4'];
            $orientation = $_POST['PARAM_5'];
            $destination = $_POST['PARAM_6'];
        }
    }
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    $rep = new FrontReport(_('GL Account Transactions'), "GLAccountTransactions", user_pagesize(), 9, $orientation);
    $dec = 2;
    //$cols = array(0, 80, 100, 150, 210, 280, 340, 400, 450, 510, 570);
    $cols = array(0, 65, 105, 125, 175, 230, 290, 345, 405, 465, 525);
    //------------0--1---2---3----4----5----6----7----8----9----10-------
    //-----------------------dim1-dim2-----------------------------------
    //-----------------------dim1----------------------------------------
    //-------------------------------------------------------------------
    $aligns = array('left', 'left', 'left', 'left', 'left', 'left', 'left', 'right', 'right', 'right');
    if ($dim == 2) {
        $headers = array(_('Type'), _('Ref'), _('#'), _('Date'), _('Dimension') . " 1", _('Dimension') . " 2", _('Person/Item'), _('Debit'), _('Credit'), _('Balance'));
    } elseif ($dim == 1) {
        $headers = array(_('Type'), _('Ref'), _('#'), _('Date'), _('Dimension'), "", _('Person/Item'), _('Debit'), _('Credit'), _('Balance'));
    } else {
        $headers = array(_('Type'), _('Ref'), _('#'), _('Date'), "", "", _('Person/Item'), _('Debit'), _('Credit'), _('Balance'));
    }
    if ($dim == 2) {
        $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Accounts'), 'from' => $fromacc, 'to' => $toacc), 3 => array('text' => _('Dimension') . " 1", 'from' => get_dimension_string($dimension), 'to' => ''), 4 => array('text' => _('Dimension') . " 2", 'from' => get_dimension_string($dimension2), 'to' => ''));
    } else {
        if ($dim == 1) {
            $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Accounts'), 'from' => $fromacc, 'to' => $toacc), 3 => array('text' => _('Dimension'), 'from' => get_dimension_string($dimension), 'to' => ''));
        } else {
            $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Accounts'), 'from' => $fromacc, 'to' => $toacc));
        }
    }
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $accounts = get_gl_accounts($fromacc, $toacc);
    while ($account = db_fetch($accounts)) {
        if (is_account_balancesheet($account["account_code"])) {
            $begin = "";
        } else {
            $begin = get_fiscalyear_begin_for_date($from);
            if (date1_greater_date2($begin, $from)) {
                $begin = $from;
            }
            $begin = add_days($begin, -1);
        }
        $prev_balance = get_gl_balance_from_to($begin, $from, $account["account_code"], $dimension, $dimension2);
        $trans = get_gl_transactions($from, $to, -1, $account['account_code'], $dimension, $dimension2);
        $rows = db_num_rows($trans);
        if ($prev_balance == 0.0 && $rows == 0) {
            continue;
        }
        $rep->Font('bold');
        $rep->TextCol(0, 4, $account['account_code'] . " " . $account['account_name'], -2);
        $rep->TextCol(4, 6, _('Opening Balance'));
        if ($prev_balance > 0.0) {
            $rep->AmountCol(7, 8, abs($prev_balance), $dec);
        } else {
            $rep->AmountCol(8, 9, abs($prev_balance), $dec);
        }
        $rep->Font();
        $total = $prev_balance;
        $rep->NewLine(2);
        if ($rows > 0) {
            while ($myrow = db_fetch($trans)) {
                $total += $myrow['amount'];
                $type_name = $systypes_array[$myrow["type"]];
                if ($type_name == "Customer Payment") {
                    $rep->TextCol(0, 1, "CRB", -2);
                }
                if ($type_name == "Cash Disbursement/Check Voucher") {
                    $rep->TextCol(0, 1, "CDB", -2);
                }
                if ($type_name == "Journal Entry") {
                    $rep->TextCol(0, 1, "JB", -2);
                }
                if ($type_name == "Customer Credit Note") {
                    $type_name = "Credit Memo";
                }
                if ($type_name == "Sales Invoice") {
                    $type_name = "Invoice";
                } else {
                    if ($type_name != "Customer Payment" && $type_name != "Cash Disbursement/Check Voucher" && $type_name != "Journal Entry") {
                        $rep->TextCol(0, 1, $type_name, -2);
                    }
                }
                $reference = get_reference($myrow["type"], $myrow["type_no"]);
                $rep->TextCol(1, 2, $reference);
                $rep->TextCol(2, 3, $myrow['type_no'], -2);
                $rep->DateCol(3, 4, $myrow["tran_date"], true);
                if ($dim >= 1) {
                    $rep->TextCol(4, 5, get_dimension_string($myrow['dimension_id']));
                }
                if ($dim > 1) {
                    $rep->TextCol(5, 6, get_dimension_string($myrow['dimension2_id']));
                }
                $txt = payment_person_name($myrow["person_type_id"], $myrow["person_id"], false);
                $memo = $myrow['memo_'];
                if ($txt != "") {
                    if ($memo != "") {
                        $txt = $txt . "/" . $memo;
                    }
                } else {
                    $txt = $memo;
                }
                $rep->TextCol(6, 7, $txt, -2);
                if ($myrow['amount'] > 0.0) {
                    $rep->AmountCol(7, 8, abs($myrow['amount']), $dec);
                } else {
                    $rep->AmountCol(8, 9, abs($myrow['amount']), $dec);
                }
                $rep->TextCol(9, 10, number_format2($total, $dec));
                $rep->NewLine();
                if ($rep->row < $rep->bottomMargin + $rep->lineHeight) {
                    $rep->Line($rep->row - 2);
                    $rep->NewPage();
                }
            }
            $rep->NewLine();
        }
        $rep->Font('bold');
        $rep->TextCol(4, 6, _("Ending Balance"));
        if ($total > 0.0) {
            $rep->AmountCol(7, 8, abs($total), $dec);
        } else {
            $rep->AmountCol(8, 9, abs($total), $dec);
        }
        $rep->Font();
        $rep->Line($rep->row - $rep->lineHeight + 4);
        $rep->NewLine(2, 1);
    }
    $rep->End();
}
コード例 #6
0
function fmt_person($row)
{
    return payment_person_name($row["person_type_id"], $row["person_id"]);
}
コード例 #7
0
ファイル: gl_account_inquiry.php プロジェクト: M-Shahbaz/FA
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);
    }
}
コード例 #8
0
$result = get_gl_transactions($begin, $end, -1, $account, 0, 0, null);
$j = 0;
$k = 1;
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    $trandate = sql2date($myrow["tran_date"]);
    label_cell($systypes_array[$myrow["type"]]);
    $amount = price_format($myrow["amount"]);
    $str = "<a href='#' onclick='return WindowClose(\"{$amount}\", \"{$trandate}\");' >" . $myrow['type_no'] . "</a>";
    label_cell($str);
    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_name($myrow["person_type_id"], $myrow["person_id"]));
    display_debit_or_credit_cells($myrow["amount"]);
    label_cell($myrow['memo_']);
    end_row();
    $j++;
    if ($j == 12) {
        $j = 1;
        table_header($th);
    }
}
//end of while loop
//end of while loop
end_table(1);
end_page(true);
コード例 #9
0
ファイル: rep601.php プロジェクト: knjy24/FrontAccounting
function print_bank_transactions()
{
    global $path_to_root, $systypes_array;
    $acc = $_POST['PARAM_0'];
    $from = $_POST['PARAM_1'];
    $to = $_POST['PARAM_2'];
    $zero = $_POST['PARAM_3'];
    $comments = $_POST['PARAM_4'];
    $orientation = $_POST['PARAM_5'];
    $destination = $_POST['PARAM_6'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    $rep = new FrontReport(_('Bank Statement'), "BankStatement", user_pagesize(), 9, $orientation);
    $dec = user_price_dec();
    $cols = array(0, 90, 110, 170, 225, 350, 400, 460, 520);
    $aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right', 'right');
    $headers = array(_('Type'), _('#'), _('Reference'), _('Date'), _('Person/Item'), _('Debit'), _('Credit'), _('Balance'));
    $account = get_bank_account($acc);
    $act = $account['bank_account_name'] . " - " . $account['bank_curr_code'] . " - " . $account['bank_account_number'];
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Bank Account'), 'from' => $act, 'to' => ''));
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $prev_balance = get_bank_balance_to($from, $account["id"]);
    $trans = get_bank_transactions($from, $to, $account['id']);
    $rows = db_num_rows($trans);
    if ($prev_balance != 0.0 || $rows != 0) {
        $rep->Font('bold');
        $rep->TextCol(0, 3, $act);
        $rep->TextCol(3, 5, _('Opening Balance'));
        if ($prev_balance > 0.0) {
            $rep->AmountCol(5, 6, abs($prev_balance), $dec);
        } else {
            $rep->AmountCol(6, 7, abs($prev_balance), $dec);
        }
        $rep->Font();
        $total = $prev_balance;
        $rep->NewLine(2);
        $total_debit = $total_credit = 0;
        if ($rows > 0) {
            // Keep a running total as we loop through
            // the transactions.
            while ($myrow = db_fetch($trans)) {
                if ($zero == 0 && $myrow['amount'] == 0.0) {
                    continue;
                }
                $total += $myrow['amount'];
                $rep->TextCol(0, 1, $systypes_array[$myrow["type"]]);
                $rep->TextCol(1, 2, $myrow['trans_no']);
                $rep->TextCol(2, 3, $myrow['ref']);
                $rep->DateCol(3, 4, $myrow["trans_date"], true);
                $rep->TextCol(4, 5, payment_person_name($myrow["person_type_id"], $myrow["person_id"], false));
                if ($myrow['amount'] > 0.0) {
                    $rep->AmountCol(5, 6, abs($myrow['amount']), $dec);
                    $total_debit += abs($myrow['amount']);
                } else {
                    $rep->AmountCol(6, 7, abs($myrow['amount']), $dec);
                    $total_credit += abs($myrow['amount']);
                }
                $rep->AmountCol(7, 8, $total, $dec);
                $rep->NewLine();
                if ($rep->row < $rep->bottomMargin + $rep->lineHeight) {
                    $rep->Line($rep->row - 2);
                    $rep->NewPage();
                }
            }
            $rep->NewLine();
        }
        // Print totals for the debit and credit columns.
        $rep->TextCol(3, 5, _("Total Debit / Credit"));
        $rep->AmountCol(5, 6, $total_debit, $dec);
        $rep->AmountCol(6, 7, $total_credit, $dec);
        $rep->NewLine(2);
        $rep->Font('bold');
        $rep->TextCol(3, 5, _("Ending Balance"));
        if ($total > 0.0) {
            $rep->AmountCol(5, 6, abs($total), $dec);
        } else {
            $rep->AmountCol(6, 7, abs($total), $dec);
        }
        $rep->Font();
        $rep->Line($rep->row - $rep->lineHeight + 4);
        $rep->NewLine(2, 1);
        // Print the difference between starting and ending balances.
        $net_change = $total - $prev_balance;
        $rep->TextCol(3, 5, _("Net Change"));
        if ($total > 0.0) {
            $rep->AmountCol(5, 6, $net_change, $dec, 0, 0, 0, 0, null, 1, True);
        } else {
            $rep->AmountCol(6, 7, $net_change, $dec, 0, 0, 0, 0, null, 1, True);
        }
    }
    $rep->End();
}
コード例 #10
0
function print_bank_transactions()
{
    global $path_to_root, $systypes_array;
    $acc = $_POST['PARAM_0'];
    $from = $_POST['PARAM_1'];
    $to = $_POST['PARAM_2'];
    $comments = $_POST['PARAM_3'];
    $destination = $_POST['PARAM_4'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $rep = new FrontReport(_('Bank Statement'), "BankStatement", user_pagesize(), 9, "L");
    $dec = user_price_dec();
    $cols = array(0, 90, 110, 170, 225, 450, 500, 550, 600, 660, 700);
    $aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right', 'right', 'center', 'left');
    $headers = array(_('Type'), _('#'), _('Reference'), _('Date'), _('Person/Item'), _('Debit'), _('Credit'), _('Balance'), _('Reco Date'), _('Narration'));
    $account = get_bank_account($acc);
    $act = $account['bank_account_name'] . " - " . $account['bank_curr_code'] . " - " . $account['bank_account_number'];
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Bank Account'), 'from' => $act, 'to' => ''));
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $prev_balance = get_bank_balance_to($from, $account["id"]);
    $trans = get_bank_transactions($from, $to, $account['id']);
    $rows = db_num_rows($trans);
    if ($prev_balance != 0.0 || $rows != 0) {
        $rep->Font('bold');
        $rep->TextCol(0, 3, $act);
        $rep->TextCol(3, 5, _('Opening Balance'));
        if ($prev_balance > 0.0) {
            $rep->AmountCol(5, 6, abs($prev_balance), $dec);
        } else {
            $rep->AmountCol(6, 7, abs($prev_balance), $dec);
        }
        $rep->Font();
        $total = $prev_balance;
        $rep->NewLine(2);
        if ($rows > 0) {
            // Keep a running total as we loop through
            // the transactions.
            $total_debit = $total_credit = 0;
            while ($myrow = db_fetch($trans)) {
                $total += $myrow['amount'];
                $rep->TextCol(0, 1, $systypes_array[$myrow["type"]]);
                $rep->TextCol(1, 2, $myrow['trans_no']);
                $rep->TextCol(2, 3, $myrow['ref']);
                $rep->DateCol(3, 4, $myrow["trans_date"], true);
                $rep->TextCol(4, 5, payment_person_name($myrow["person_type_id"], $myrow["person_id"], false));
                if ($myrow['amount'] > 0.0) {
                    $rep->AmountCol(5, 6, abs($myrow['amount']), $dec);
                    $total_debit += abs($myrow['amount']);
                } else {
                    $rep->AmountCol(6, 7, abs($myrow['amount']), $dec);
                    $total_credit += abs($myrow['amount']);
                }
                $rep->AmountCol(7, 8, $total, $dec);
                if ($myrow["reconciled"] && $myrow["reconciled"] != '0000-00-00') {
                    $rep->DateCol(8, 9, $myrow["reconciled"], true);
                }
                $rep->TextCol(9, 10, $myrow['memo_']);
                $rep->NewLine();
                if ($rep->row < $rep->bottomMargin + $rep->lineHeight) {
                    $rep->Line($rep->row - 2);
                    $rep->NewPage();
                }
            }
            $rep->NewLine();
        }
        // Print totals for the debit and credit columns.
        $rep->TextCol(3, 5, _("Total Debit / Credit"));
        $rep->AmountCol(5, 6, $total_debit, $dec);
        $rep->AmountCol(6, 7, $total_credit, $dec);
        $rep->NewLine(2);
        $rep->Font('bold');
        $rep->TextCol(3, 5, _("Ending Balance"));
        if ($total > 0.0) {
            $rep->AmountCol(5, 6, abs($total), $dec);
        } else {
            $rep->AmountCol(6, 7, abs($total), $dec);
        }
        $rep->Font();
        $rep->NewLine(2);
        // Print the difference between starting and ending balances.
        $net_change = $total - $prev_balance;
        $rep->TextCol(3, 5, _("Net Change"));
        if ($total > 0.0) {
            $rep->AmountCol(5, 6, $net_change, $dec, 0, 0, 0, 0, null, 1, True);
        } else {
            $rep->AmountCol(6, 7, $net_change, $dec, 0, 0, 0, 0, null, 1, True);
        }
        $rep->Font();
        $rep->NewLine(2);
        // Calculate Bank Balance as per reco
        $date = date2sql($to);
        $sql = "SELECT SUM(IF(reconciled<='{$date}' AND reconciled !='0000-00-00', amount, 0)) as reconciled,\n\t\t\t\t SUM(amount) as books_total\n\t\t\tFROM " . TB_PREF . "bank_trans trans\n\t\t\tWHERE bank_act=" . db_escape($account['id']) . "\n\t\t\tAND trans_date <= '{$date}'";
        //	." AND trans.reconciled IS NOT NULL";
        //display_notification($sql);
        $t_result = db_query($sql, "Cannot retrieve reconciliation data");
        if ($t_row = db_fetch($t_result)) {
            $books_total = $t_row['books_total'];
            $reconciled = $t_row['reconciled'];
        }
        $difference = $books_total - $reconciled;
        // Bank Balance (by Reco)
        $rep->Font('bold');
        $rep->TextCol(3, 5, _("Bank Balance"));
        if ($reconciled > 0.0) {
            $rep->AmountCol(5, 6, abs($reconciled), $dec);
        } else {
            $rep->AmountCol(6, 7, abs($reconciled), $dec);
        }
        $rep->Font();
        $rep->NewLine(2);
        // Reco Difference
        $rep->Font('bold');
        $rep->TextCol(3, 5, _("Difference"));
        if ($difference > 0.0) {
            $rep->AmountCol(5, 6, abs($difference), $dec);
        } else {
            $rep->AmountCol(6, 7, abs($difference), $dec);
        }
        $rep->Font();
        $rep->NewLine(2);
        $rep->Line($rep->row - $rep->lineHeight + 4);
        $rep->NewLine(2, 1);
    }
    $rep->End();
}
コード例 #11
0
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();
}
コード例 #12
0
function print_tax_details_cash()
{
    global $path_to_root, $systypes_array;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $net = $_POST['PARAM_2'];
    $comments = $_POST['PARAM_3'];
    $destination = $_POST['PARAM_4'];
    if ($destination) {
        include_once $path_to_root . "/reporting/includes/excel_report.inc";
    } else {
        include_once $path_to_root . "/reporting/includes/pdf_report.inc";
    }
    $rep = new FrontReport(_('Tax Details (Cash Basis)'), "TaxDetails", user_pagesize(), 9, "L");
    $dec = user_price_dec();
    $cols = array(0, 100, 170, 250, 310, 485, 550, 700);
    $aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right');
    if (!$net) {
        $grossAmount = _('Gross');
    } else {
        $grossAmount = _('Net');
    }
    $headers = array(_('Type'), _('Ref'), _('#'), _('Date'), _('Payer/Payee'), _('Tax Amount'), $grossAmount . ' ' . _('Output/Input'));
    if (!$net) {
        $grossAmount = _('Gross Amounts');
    } else {
        $grossAmount = _('Net Amounts');
    }
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Output/input'), 'from' => $grossAmount, 'to' => ''));
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $trans = get_tax_cash_details($from, $to);
    $rows = db_num_rows($trans);
    $rep->Font();
    if ($rows > 0) {
        // Keep a running total as we loop through
        // the transactions.
        $subTotalTax = 0;
        $subTotalGross = 0;
        $total = 0;
        $lastTaxType = '';
        $lastOutput = '';
        $lastRate = 0;
        while ($myrow = db_fetch($trans)) {
            $taxType = $myrow["name"];
            $output = $myrow["Output"];
            if ($taxType != $lastTaxType || $output != $lastOutput) {
                if ($lastTaxType != '') {
                    print_tax_details_cash_subtotals($rep, $lastOutput, $lastTaxType, $lastRate, $subTotalTax, $subTotalGross);
                }
                $lastOutput = $output;
                $lastTaxType = $taxType;
                $lastRate = $myrow['rate'];
                $subTotalTax = 0;
                $subTotalGross = 0;
            }
            $rep->TextCol(0, 1, $systypes_array[$myrow["type"]], -2);
            $reference = get_reference($myrow["type"], $myrow["trans_no"]);
            $rep->TextCol(1, 2, $reference);
            $rep->TextCol(2, 3, $myrow["trans_no"]);
            $rep->DateCol(3, 4, $myrow["trans_date"], true);
            $rep->TextCol(4, 5, payment_person_name($myrow["person_type_id"], $myrow["person_id"], false));
            if ($output == "Output") {
                $payable = $myrow['payable'];
                if (!$net) {
                    $amount = $myrow['gross_output'];
                } else {
                    $amount = $myrow['net_output'];
                }
                $rep->AmountCol(5, 6, $payable, $dec);
                $subTotalTax += $payable;
                $total += $payable;
                $rep->AmountCol(6, 7, $amount, $dec);
                $subTotalGross += $amount;
            } else {
                $collectible = $myrow['collectible'];
                if (!$net) {
                    $amount = $myrow['gross_input'];
                } else {
                    $amount = $myrow['net_input'];
                }
                $rep->AmountCol(5, 6, $collectible, $dec);
                $subTotalTax += $collectible;
                $total += $collectible;
                $rep->AmountCol(6, 7, $amount, $dec);
                $subTotalGross += $amount;
            }
            $rep->NewLine();
            if ($rep->row < $rep->bottomMargin + $rep->lineHeight) {
                $rep->Line($rep->row - 2);
                $rep->NewPage();
            }
        }
        // Print totals
        print_tax_details_cash_subtotals($rep, $lastOutput, $lastTaxType, $lastRate, $subTotalTax, $subTotalGross);
        $rep->Font('bold');
        $rep->TextCol(4, 5, _("Total Payable or Refund"));
        $rep->AmountCol(5, 6, $total, $dec);
        $rep->NewLine(2);
        $rep->Font();
        $rep->NewLine(2);
    }
    $rep->End();
}
コード例 #13
0
ファイル: rep702.php プロジェクト: pthdnq/ivalley-svn
function print_list_of_journal_entries()
{
    global $path_to_root, $systypes_array;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $systype = $_POST['PARAM_2'];
    $comments = $_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_report.inc";
    }
    $orientation = $orientation ? 'L' : 'P';
    $dec = user_price_dec();
    $cols = array(0, 100, 240, 300, 400, 460, 520, 580);
    $headers = array(_('Type/Account'), _('Reference') . '/' . _('Account Name'), _('Date/Dim.'), _('Person/Item/Memo'), _('Debit'), _('Credit'));
    $aligns = array('left', 'left', 'left', 'left', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Type'), 'from' => $systype == -1 ? _('All') : $systypes_array[$systype], 'to' => ''));
    $rep = new FrontReport(_('List of Journal Entries'), "JournalEntries", user_pagesize(), 9, $orientation);
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    if ($systype == -1) {
        $systype = null;
    }
    $trans = get_gl_transactions($from, $to, -1, null, 0, 0, $systype);
    $typeno = $type = 0;
    $debit = $credit = 0.0;
    $totdeb = $totcre = 0.0;
    while ($myrow = db_fetch($trans)) {
        if ($type != $myrow['type'] || $typeno != $myrow['type_no']) {
            if ($typeno != 0) {
                $rep->Line($rep->row += 6);
                $rep->NewLine();
                $rep->AmountCol(4, 5, $debit, $dec);
                $rep->AmountCol(5, 6, abs($credit), $dec);
                $totdeb += $debit;
                $totcre += $credit;
                $debit = $credit = 0.0;
                $rep->Line($rep->row -= 4);
                $rep->NewLine();
            }
            $typeno = $myrow['type_no'];
            $type = $myrow['type'];
            $TransName = $systypes_array[$myrow['type']];
            $rep->TextCol(0, 1, $TransName . " # " . $myrow['type_no']);
            $rep->TextCol(1, 2, get_reference($myrow['type'], $myrow['type_no']));
            $rep->DateCol(2, 3, $myrow['tran_date'], true);
            $coms = payment_person_name($myrow["person_type_id"], $myrow["person_id"]);
            $memo = get_comments_string($myrow['type'], $myrow['type_no']);
            if ($memo != '') {
                if ($coms == "") {
                    $coms = $memo;
                } else {
                    $coms .= " / " . $memo;
                }
            }
            $rep->TextColLines(3, 6, $coms);
            $rep->NewLine();
        }
        $rep->TextCol(0, 1, $myrow['account']);
        $rep->TextCol(1, 2, $myrow['account_name']);
        $dim_str = get_dimension_string($myrow['dimension_id']);
        $dim_str2 = get_dimension_string($myrow['dimension2_id']);
        if ($dim_str2 != "") {
            $dim_str .= "/" . $dim_str2;
        }
        $rep->TextCol(2, 3, $dim_str);
        $rep->TextCol(3, 4, $myrow['memo_']);
        if ($myrow['amount'] > 0.0) {
            $debit += $myrow['amount'];
            $rep->AmountCol(4, 5, abs($myrow['amount']), $dec);
        } else {
            $credit += $myrow['amount'];
            $rep->AmountCol(5, 6, abs($myrow['amount']), $dec);
        }
        $rep->NewLine(1, 2);
    }
    if ($typeno != 0) {
        $rep->Line($rep->row += 6);
        $rep->NewLine();
        $rep->AmountCol(4, 5, $debit, $dec);
        $rep->AmountCol(5, 6, abs($credit), $dec);
        $totdeb += $debit;
        $totcre += $credit;
        $rep->Line($rep->row -= 4);
        $rep->NewLine();
        $rep->TextCol(0, 4, _("Total"));
        $rep->AmountCol(4, 5, $totdeb, $dec);
        $rep->AmountCol(5, 6, abs($totcre), $dec);
        $rep->Line($rep->row -= 4);
    }
    $rep->End();
}
コード例 #14
0
function print_subsidiary_ledger()
{
    global $path_to_root, $systypes_array;
    $dim = get_company_pref('use_dimension');
    $dimension = $dimension2 = 0;
    $from = $_POST['PARAM_0'];
    $to = $_POST['PARAM_1'];
    $fromacc = $_POST['PARAM_2'];
    $comments = $_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(_('Subsidiary Ledger Report'), "SubsidiaryLedger", user_pagesize(), 9, $orientation);
    $dec = user_price_dec();
    //$headers = array(_('Type'),	_('Ref'), _('#'),	_('Date'), _('Dimension')." 1", _('Dimension')." 2",
    //		_('Person/Item'), _('Debit'),	_('Credit'), _('Balance'));
    //$cols = array(0, 80, 100, 150, 210, 280, 340, 400, 450, 510, 570);
    $cols = array(0, 65, 105, 125, 175, 230, 290, 345, 405, 465, 525);
    //------------0--1---2---3----4----5----6----7----8----9----10-------
    //-----------------------dim1-dim2-----------------------------------
    //-----------------------dim1----------------------------------------
    //-------------------------------------------------------------------
    $aligns = array('left', 'left', 'left', 'center', 'left', 'left', 'left', 'right', 'right', 'right', 'right');
    $headers = array(_('Account Name'), '', '', '', '', '', _('Debit'), _('Credit'), '', _('Balance'));
    $params = array(0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Accounts'), 'from' => $fromacc, 'to' => $fromacc));
    if ($orientation == 'L') {
        recalculate_cols($cols);
    }
    $rep->SetHeaderType('Header_custom');
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->NewPage();
    $accounts = get_gl_accounts($fromacc, $fromacc);
    while ($account = db_fetch($accounts)) {
        if (is_account_balancesheet($account["account_code"])) {
            $begin = "";
        } else {
            $begin = get_fiscalyear_begin_for_date($from);
            if (date1_greater_date2($begin, $from)) {
                $begin = $from;
            }
            $begin = add_days($begin, -1);
        }
        $prev_balance = get_gl_balance_from_to($begin, $from, $account["account_code"], $dimension, $dimension2);
        $trans = get_gl_transactions($from, $to, -1, $account['account_code'], $dimension, $dimension2);
        $rows = db_num_rows($trans);
        if ($prev_balance == 0.0 && $rows == 0) {
            continue;
        }
        $rep->Font('bold');
        $rep->TextCol(0, 4, $account['account_code'] . " " . $account['account_name'], -2);
        $rep->TextCol(4, 6, _('Opening Balance'));
        if ($prev_balance > 0.0) {
            $rep->AmountCol(7, 8, abs($prev_balance), $dec);
        } else {
            $rep->AmountCol(8, 9, abs($prev_balance), $dec);
        }
        $rep->Font();
        $total = $prev_balance;
        $rep->NewLine(2);
        if ($rows > 0) {
            $previous = '';
            while ($myrow = db_fetch($trans)) {
                $total += $myrow['amount'];
                $txt = payment_person_name($myrow["person_type_id"], $myrow["person_id"], false);
                $current = $txt;
                $memo = $myrow['memo_'];
                if ($txt != "") {
                    if ($previous == $current) {
                        $txt = '';
                    } else {
                        $rep->NewLine(1);
                        $rep->Line($rep->row - $rep->lineHeight + 4);
                        $rep->NewLine(2, 0);
                        $rep->TextCol(3, 8, $txt, -2);
                        $rep->Line($rep->row - $rep->lineHeight + 4);
                        $rep->NewLine(2, 1);
                        $rep->NewLine(1);
                    }
                    $previous = $current;
                }
                $rep->TextCol(0, 3, $systypes_array[$myrow["type"]], -2);
                $rep->DateCol(4, 6, $myrow["tran_date"], true);
                if ($myrow['amount'] > 0.0) {
                    $rep->AmountCol(6, 7, abs($myrow['amount']), $dec);
                } else {
                    $rep->AmountCol(7, 8, abs($myrow['amount']), $dec);
                }
                $rep->TextCol(8, 10, number_format2($total, $dec));
                $rep->NewLine();
                if ($rep->row < $rep->bottomMargin + $rep->lineHeight) {
                    $rep->Line($rep->row - 2);
                    $rep->NewPage();
                }
            }
            $rep->NewLine();
        }
        $rep->Font('bold');
        $rep->TextCol(4, 6, _("Ending Balance"));
        if ($total > 0.0) {
            $rep->AmountCol(7, 8, abs($total), $dec);
        } else {
            $rep->AmountCol(8, 9, abs($total), $dec);
        }
        $rep->Font();
    }
    $rep->End();
}
コード例 #15
0
ファイル: rep712.php プロジェクト: knjy24/FrontAccounting
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();
}