Пример #1
0
function print_list_of_journal_entries()
{
    global $path_to_root;
    include_once $path_to_root . "reporting/includes/pdf_report.inc";
    $from = $_REQUEST['PARAM_0'];
    $to = $_REQUEST['PARAM_1'];
    $systype = $_REQUEST['PARAM_2'];
    $comments = $_REQUEST['PARAM_3'];
    $dec = user_price_dec();
    $cols = array(0, 100, 240, 300, 400, 460, 520, 580);
    $headers = array(tr('Type/Account'), tr('Account Name'), tr('Date/Dim.'), tr('Person/Item/Memo'), tr('Debit'), tr('Credit'));
    $aligns = array('left', 'left', 'left', 'left', 'right', 'right');
    $params = array(0 => $comments, 1 => array('text' => tr('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => tr('Type'), 'from' => systypes::name($systype), 'to' => ''));
    $rep = new FrontReport(tr('List of Journal Entries'), "JournalEntries.pdf", user_pagesize());
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->Header();
    if ($systype == -1) {
        $systype = null;
    }
    $trans = get_gl_transactions($from, $to, -1, null, 0, $systype);
    $typeno = 0;
    while ($myrow = db_fetch($trans)) {
        if ($typeno != $myrow['type_no']) {
            if ($typeno != 0) {
                $rep->Line($rep->row + 4);
                $rep->NewLine();
            }
            $typeno = $myrow['type_no'];
            $TransName = systypes::name($myrow['type']);
            $rep->TextCol(0, 2, $TransName . " # " . $myrow['type_no']);
            $rep->TextCol(2, 3, sql2date($myrow['tran_date']));
            $coms = payment_person_types::person_name($myrow["person_type_id"], $myrow["person_id"]);
            $memo = get_comments_string($myrow['type'], $myrow['type_no']);
            if ($memo != '') {
                $coms .= $coms != "" ? "/" : "" . $memo;
            }
            $rep->TextCol(3, 6, $coms);
            $rep->NewLine(2);
        }
        $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) {
            $rep->TextCol(4, 5, number_format2(abs($myrow['amount']), $dec));
        } else {
            $rep->TextCol(5, 6, number_format2(abs($myrow['amount']), $dec));
        }
        $rep->NewLine(1, 2);
    }
    $rep->Line($rep->row + 4);
    $rep->End();
}
Пример #2
0
function display_gl_heading($myrow)
{
    global $table_style;
    $trans_name = systypes::name($_GET['type_id']);
    start_table("{$table_style} width=95%");
    $th = array(tr("General Ledger Transaction Details"), tr("Date"), tr("Person/Item"));
    table_header($th);
    start_row();
    label_cell("{$trans_name} #" . $_GET['trans_no']);
    label_cell(sql2date($myrow["tran_date"]));
    label_cell(payment_person_types::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
include_once $path_to_root . "/includes/date_functions.inc";
include_once $path_to_root . "/includes/ui.inc";
include_once $path_to_root . "/sales/includes/sales_db.inc";
if (isset($_GET["trans_no"])) {
    $trans_id = $_GET["trans_no"];
}
$receipt = get_customer_trans($trans_id, systypes::cust_payment());
display_heading(sprintf(tr("Customer Payment #%d"), $trans_id));
echo "<br>";
start_table("{$table_style} width=80%");
start_row();
label_cells(tr("From Customer"), $receipt['DebtorName'], "class='tableheader2'");
label_cells(tr("Into Bank Account"), $receipt['bank_account_name'], "class='tableheader2'");
label_cells(tr("Date of Deposit"), sql2date($receipt['tran_date']), "class='tableheader2'");
end_row();
start_row();
label_cells(tr("Payment Currency"), $receipt['curr_code'], "class='tableheader2'");
label_cells(tr("Amount"), price_format($receipt['ov_amount']), "class='tableheader2'");
label_cells(tr("Discount"), price_format($receipt['ov_discount']), "class='tableheader2'");
end_row();
start_row();
label_cells(tr("Payment Type"), $receipt['BankTransType'], "class='tableheader2'");
label_cells(tr("Reference"), $receipt['reference'], "class='tableheader2'", "colspan=4");
end_row();
comments_display_row(systypes::cust_payment(), $trans_id);
end_table(1);
$voided = is_voided_display(systypes::cust_payment(), $trans_id, tr("This customer payment has been voided."));
if (!$voided) {
    display_allocations_from(payment_person_types::customer(), $receipt['debtor_no'], systypes::cust_payment(), $trans_id, -$receipt['Total']);
}
end_page(true);
Пример #4
0
    $colspan1 = 5;
    $colspan2 = 8;
} else {
    $colspan1 = 3;
    $colspan2 = 6;
}
start_row();
label_cells(tr("From Bank Account"), $from_trans['bank_account_name'], "class='tableheader2'");
if ($show_currencies) {
    label_cells(tr("Currency"), $from_trans['bank_curr_code'], "class='tableheader2'");
}
label_cells(tr("Amount"), number_format2(-$from_trans['amount'], user_price_dec()), "class='tableheader2'", "align=right");
label_cells(tr("Date"), sql2date($from_trans['trans_date']), "class='tableheader2'");
end_row();
start_row();
label_cells(tr("Pay To"), payment_person_types::person_name($from_trans['person_type_id'], $from_trans['person_id']), "class='tableheader2'", "colspan={$colspan1}");
label_cells(tr("Payment Type"), $from_trans['BankTransType'], "class='tableheader2'");
end_row();
start_row();
label_cells(tr("Reference"), $from_trans['ref'], "class='tableheader2'", "colspan={$colspan2}");
end_row();
comments_display_row(systypes::bank_payment(), $trans_no);
end_table(1);
$voided = is_voided_display(systypes::bank_payment(), $trans_no, tr("This payment has been voided."));
$items = get_gl_trans(systypes::bank_payment(), $trans_no);
if (db_num_rows($items) == 0) {
    echo "<br>" . tr("There are no items for this payment.");
} else {
    display_heading2(tr("Items for this Payment"));
    if ($show_currencies) {
        display_heading2(tr("Item Amounts are Shown in :") . " " . $company_currency);
Пример #5
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"] . "&nbsp;&nbsp;&nbsp;" . $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);
    }
}
Пример #6
0
        label_cell($myrow2["StockDescription"]);
        qty_cell($myrow2["quantity"]);
        label_cell($myrow2["units"], "align=right");
        amount_cell($myrow2["unit_price"]);
        label_cell($display_discount, "align=right");
        amount_cell($value);
        end_row();
    }
    //end while there are line items to print out
} else {
    display_note(tr("There are no line items on this credit note."), 1, 2);
}
$display_sub_tot = price_format($sub_total);
$display_freight = price_format($myrow["ov_freight"]);
$credit_total = $myrow["ov_freight"] + $myrow["ov_gst"] + $myrow["ov_amount"] + $myrow["ov_freight_tax"];
$display_total = price_format($credit_total);
/*Print out the invoice text entered */
if ($sub_total != 0) {
    label_row(tr("Sub Total"), $display_sub_tot, "colspan=6 align=right", "nowrap align=right width=15%");
}
label_row(tr("Shipping"), $display_freight, "colspan=6 align=right", "nowrap align=right");
$tax_items = get_customer_trans_tax_details(11, $trans_id);
display_customer_trans_tax_details($tax_items, 6);
label_row("<font color=red>" . tr("TOTAL CREDIT") . "</font", "<font color=red>{$display_total}</font>", "colspan=6 align=right", "nowrap align=right");
end_table(1);
$voided = is_voided_display(11, $trans_id, tr("This credit note has been voided."));
if (!$voided) {
    display_allocations_from(payment_person_types::customer(), $myrow['debtor_no'], 11, $trans_id, $credit_total);
}
/* end of check to see that there was an invoice record to print */
end_page(true);
Пример #7
0
echo "<br>";
start_table("{$table_style2} width=80%");
start_row();
label_cells(tr("To Supplier"), $receipt['supplier_name'], "class='tableheader2'");
label_cells(tr("From Bank Account"), $receipt['bank_account_name'], "class='tableheader2'");
label_cells(tr("Date Paid"), sql2date($receipt['tran_date']), "class='tableheader2'");
end_row();
start_row();
if ($show_currencies) {
    label_cells(tr("Payment Currency"), $receipt['bank_curr_code'], "class='tableheader2'");
}
label_cells(tr("Amount"), number_format2(-$receipt['BankAmount'], user_price_dec()), "class='tableheader2'");
label_cells(tr("Payment Type"), $receipt['BankTransType'], "class='tableheader2'");
end_row();
start_row();
if ($show_currencies) {
    label_cells(tr("Supplier's Currency"), $receipt['SupplierCurrCode'], "class='tableheader2'");
}
if ($show_both_amounts) {
    label_cells(tr("Amount"), number_format2(-$receipt['ov_amount'], user_price_dec()), "class='tableheader2'");
}
label_cells(tr("Reference"), $receipt['ref'], "class='tableheader2'");
end_row();
comments_display_row(22, $trans_no);
end_table(1);
$voided = is_voided_display(22, $trans_no, tr("This payment has been voided."));
// now display the allocations for this payment
if (!$voided) {
    display_allocations_from(payment_person_types::supplier(), $receipt['supplier_id'], 22, $trans_no, -$receipt['ov_amount']);
}
end_page(true);
Пример #8
0
function print_GL_transactions()
{
    global $path_to_root;
    include_once $path_to_root . "reporting/includes/pdf_report.inc";
    $rep = new FrontReport(tr('GL Account Transactions'), "GLAccountTransactions.pdf", user_pagesize());
    $dim = get_company_pref('use_dimension');
    $dimension = $dimension2 = 0;
    $from = $_REQUEST['PARAM_0'];
    $to = $_REQUEST['PARAM_1'];
    $fromacc = $_REQUEST['PARAM_2'];
    $toacc = $_REQUEST['PARAM_3'];
    if ($dim == 2) {
        $dimension = $_REQUEST['PARAM_4'];
        $dimension2 = $_REQUEST['PARAM_5'];
        $comments = $_REQUEST['PARAM_6'];
    } else {
        if ($dim == 1) {
            $dimension = $_REQUEST['PARAM_4'];
            $comments = $_REQUEST['PARAM_5'];
        } else {
            $comments = $_REQUEST['PARAM_4'];
        }
    }
    $dec = user_price_dec();
    $cols = array(0, 70, 90, 140, 210, 280, 340, 400, 450, 510, 570);
    //------------0--1---2---3----4----5----6----7----8----9----10-------
    //-----------------------dim1-dim2-----------------------------------
    //-----------------------dim1----------------------------------------
    //-------------------------------------------------------------------
    $aligns = array('left', 'left', 'left', 'left', 'left', 'left', 'right', 'right', 'right');
    if ($dim == 2) {
        $headers = array(tr('Type'), tr('#'), tr('Date'), tr('Dimension') . " 1", tr('Dimension') . " 2", tr('Person/Item'), tr('Debit'), tr('Credit'), tr('Balance'));
    } else {
        if ($dim == 1) {
            $headers = array(tr('Type'), tr('#'), tr('Date'), tr('Dimension'), "", tr('Person/Item'), tr('Debit'), tr('Credit'), tr('Balance'));
        } else {
            $headers = array(tr('Type'), tr('#'), tr('Date'), "", "", tr('Person/Item'), tr('Debit'), tr('Credit'), tr('Balance'));
        }
    }
    if ($dim == 2) {
        $params = array(0 => $comments, 1 => array('text' => tr('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => tr('Accounts'), 'from' => $fromacc, 'to' => $toacc), 3 => array('text' => tr('Dimension') . " 1", 'from' => get_dimension_string($dimension), 'to' => ''), 4 => array('text' => tr('Dimension') . " 2", 'from' => get_dimension_string($dimension2), 'to' => ''));
    } else {
        if ($dim == 1) {
            $params = array(0 => $comments, 1 => array('text' => tr('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => tr('Accounts'), 'from' => $fromacc, 'to' => $toacc), 3 => array('text' => tr('Dimension'), 'from' => get_dimension_string($dimension), 'to' => ''));
        } else {
            $params = array(0 => $comments, 1 => array('text' => tr('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => tr('Accounts'), 'from' => $fromacc, 'to' => $toacc));
        }
    }
    $rep->Font();
    $rep->Info($params, $cols, $headers, $aligns);
    $rep->Header();
    $accounts = get_gl_accounts($fromacc, $toacc);
    while ($account = db_fetch($accounts)) {
        if (is_account_balancesheet($account["account_code"])) {
            $begin = "";
        } else {
            if ($from < $begin) {
                $begin = add_days($from, -1);
            } else {
                $begin = add_days(begin_fiscalyear(), -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, 3, $account['account_code'] . " " . $account['account_name']);
        $rep->TextCol(3, 5, tr('Opening Balance'));
        if ($prev_balance > 0.0) {
            $rep->TextCol(6, 7, number_format2(abs($prev_balance), $dec));
        } else {
            $rep->TextCol(7, 8, number_format2(abs($prev_balance), $dec));
        }
        $rep->Font();
        $total = $prev_balance;
        $rep->NewLine(2);
        if ($rows > 0) {
            while ($myrow = db_fetch($trans)) {
                $total += $myrow['amount'];
                $rep->TextCol(0, 1, systypes::name($myrow["type"]));
                $rep->TextCol(1, 2, $myrow['type_no']);
                $rep->TextCol(2, 3, sql2date($myrow["tran_date"]));
                if ($dim >= 1) {
                    $rep->TextCol(3, 4, get_dimension_string($myrow['dimension_id']));
                }
                if ($dim > 1) {
                    $rep->TextCol(4, 5, get_dimension_string($myrow['dimension2_id']));
                }
                $rep->TextCol(5, 6, payment_person_types::person_name($myrow["person_type_id"], $myrow["person_id"], false));
                if ($myrow['amount'] > 0.0) {
                    $rep->TextCol(6, 7, number_format2(abs($myrow['amount']), $dec));
                } else {
                    $rep->TextCol(7, 8, number_format2(abs($myrow['amount']), $dec));
                }
                $rep->TextCol(8, 9, number_format2($total, $dec));
                $rep->NewLine();
                if ($rep->row < $rep->bottomMargin + $rep->lineHeight) {
                    $rep->Line($rep->row - 2);
                    $rep->Header();
                }
            }
            $rep->NewLine();
        }
        $rep->Font('bold');
        $rep->TextCol(3, 5, tr("Ending Balance"));
        if ($total > 0.0) {
            $rep->TextCol(6, 7, number_format2(abs($total), $dec));
        } else {
            $rep->TextCol(7, 8, number_format2(abs($total), $dec));
        }
        $rep->Font();
        $rep->Line($rep->row - $rep->lineHeight + 4);
        $rep->NewLine(2, 1);
    }
    $rep->End();
}
Пример #9
0
echo "<br>";
start_table($table_style2);
start_row();
label_cells(tr("Supplier"), $supp_trans->supplier_name, "class='tableheader2'");
label_cells(tr("Reference"), $supp_trans->reference, "class='tableheader2'");
label_cells(tr("Supplier's Reference"), $supp_trans->supp_reference, "class='tableheader2'");
end_row();
start_row();
label_cells(tr("Invoice Date"), $supp_trans->tran_date, "class='tableheader2'");
label_cells(tr("Due Date"), $supp_trans->due_date, "class='tableheader2'");
label_cells(tr("Currency"), get_supplier_currency($supp_trans->supplier_id), "class='tableheader2'");
end_row();
comments_display_row(21, $trans_no);
end_table(1);
$total_gl = display_gl_items($supp_trans, 3);
$total_grn = display_grn_items($supp_trans, 2);
$display_sub_tot = number_format2($total_gl + $total_grn, user_price_dec());
start_table("{$table_style} width=95%");
label_row(tr("Sub Total"), $display_sub_tot, "align=right", "nowrap align=right width=17%");
$tax_items = get_supp_invoice_tax_items(21, $trans_no);
display_supp_trans_tax_details($tax_items, 1);
$display_total = number_format2(-($supp_trans->ov_amount + $supp_trans->ov_gst), user_price_dec());
label_row(tr("TOTAL CREDIT NOTE"), $display_total, "colspan=1 align=right", "nowrap align=right");
end_table(1);
$voided = is_voided_display(21, $trans_no, tr("This credit note has been voided."));
if (!$voided) {
    $tax_total = 0;
    // ??????
    display_allocations_from(payment_person_types::supplier(), $supp_trans->supplier_id, 21, $trans_no, -($supp_trans->ov_amount + $tax_total));
}
end_page(true);
Пример #10
0
table_header($th);
$j = 1;
$k = 0;
while ($myrow = db_fetch($result)) {
    // check if it's an overdue work order
    if (!$myrow["closed"] && date_diff(Today(), sql2date($myrow["required_by"]), "d") > 0) {
        start_row("class='overduebg'");
    } else {
        alt_table_row_color($k);
    }
    $modify_page = $path_to_root . "/manufacturing/work_order_entry.php?" . SID . "trans_no=" . $myrow["id"];
    $release_page = $path_to_root . "/manufacturing/work_order_release.php?" . SID . "trans_no=" . $myrow["id"];
    if ($myrow["closed"] == 0) {
        $issue = $path_to_root . "/manufacturing/work_order_issue.php?" . SID . "trans_no=" . $myrow["id"];
        $add_finished = $path_to_root . "/manufacturing/work_order_add_finished.php?" . SID . "trans_no=" . $myrow["id"];
        $costs = $path_to_root . "/gl/gl_payment.php?NewPayment=1&PayType=" . payment_person_types::WorkOrder() . "&PayPerson=" . $myrow["id"];
        $can_issue = $myrow["released"];
        $issue_link = $can_issue ? "<a href={$issue}>" . tr("Issue") . "</a></td>\n\t\t\t<td><a href={$add_finished}>" . tr("Produce") . "</a></td>\n\t\t\t<td><a href={$costs}>" . tr("Costs") . "</a>" : tr("Not Released");
    } else {
        $issue_link = "";
    }
    label_cell(get_trans_view_str(systypes::work_order(), $myrow["id"]));
    label_cell(get_trans_view_str(systypes::work_order(), $myrow["id"], $myrow["wo_ref"]));
    label_cell(wo_types::name($myrow["type"]));
    label_cell($myrow["location_name"]);
    view_stock_status_cell($myrow["stock_id"], $myrow["description"]);
    qty_cell($myrow["units_reqd"]);
    qty_cell($myrow["units_issued"]);
    label_cell(sql2date($myrow["date_"]));
    label_cell(sql2date($myrow["required_by"]));
    label_cell($myrow["closed"] ? tr("Yes") : tr("No"));
Пример #11
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["trans_date"]);
    label_cell(systypes::name($myrow["type"]));
    label_cell(get_trans_view_str($myrow["type"], $myrow["trans_no"]));
    label_cell(get_trans_view_str($myrow["type"], $myrow["trans_no"], $myrow['ref']));
    label_cell($myrow["BankTransType"]);
    label_cell($trandate);
    display_debit_or_credit_cells($myrow["amount"]);
    amount_cell($running_total);
    label_cell(payment_person_types::person_name($myrow["person_type_id"], $myrow["person_id"]));
    label_cell(get_gl_view_str($myrow["type"], $myrow["trans_no"]));
    end_row();
    if ($j == 12) {
        $j = 1;
        table_header($th);
    }
    $j++;
}
//end of while loop
start_row("class='inquirybg'");
label_cell("<b>" . tr("Ending Balance") . " - " . $_POST['TransToDate'] . "</b>", "colspan=5");
display_debit_or_credit_cells($running_total);
label_cell("");
end_row();
end_table(2);