function gl_view($row)
{
    if (!isset($row['type'])) {
        $row['type'] = $_POST['filterType'];
    }
    return get_gl_view_str($row["type"], $row["trans_no"]);
}
 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);
 }
Example #3
0
} elseif (isset($_GET['ModifyCredit'])) {
    $_SESSION['page_title'] = sprintf(tr("Modifying Customer Credit Note #%d"), $_GET['ModifyCredit']);
    handle_new_credit($_GET['ModifyCredit']);
    $help_page_title = tr("Modifying Customer Credit Note");
}
page($_SESSION['page_title'], false, false, "", $js);
//-----------------------------------------------------------------------------
check_db_has_stock_items(tr("There are no items defined in the system."));
check_db_has_customer_branches(tr("There are no customers, or there are no customers with branches. Please define customers and customer branches."));
//-----------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $credit_no = $_GET['AddedID'];
    $trans_type = 11;
    display_notification_centered(sprintf(tr("Credit Note # %d has been processed"), $credit_no));
    display_note(get_customer_trans_view_str($trans_type, $credit_no, tr("View this credit note")), 0, 1);
    display_note(get_gl_view_str($trans_type, $credit_no, tr("View the GL Journal Entries for this Credit Note")));
    hyperlink_params($_SERVER['PHP_SELF'], tr("Enter Another Credit Note"), "NewCredit=yes");
    display_footer_exit();
}
//--------------------------------------------------------------------------------
function line_start_focus()
{
    set_focus(get_company_pref('no_supplier_list') ? 'stock_id_edit' : 'StockID2');
}
//-----------------------------------------------------------------------------
function copy_to_cn()
{
    $_SESSION['Items']->Comments = $_POST['CreditText'];
    $_SESSION['Items']->document_date = $_POST['OrderDate'];
    $_SESSION['Items']->freight_cost = input_num('ChargeFreightCost');
    $_SESSION['Items']->Location = $_POST["Location"];
Example #4
0
    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"));
    if ($issue_link != "") {
        label_cell($issue_link);
    }
    if ($myrow["released"] == 0) {
        label_cell("<a href={$release_page}>" . tr("Release") . "</a>");
    }
    if ($myrow["closed"] == 0) {
        label_cell("<a href={$modify_page}>" . tr("Edit") . "</a>");
    }
    label_cell(get_gl_view_str(systypes::work_order(), $myrow["id"]));
    end_row();
    $j++;
    if ($j == 12) {
        $j = 1;
        table_header($th);
    }
    //end of page full new headings if
}
//end of while loop
end_table(1);
//---------------------------------------------------------------------------------
end_page();
Example #5
0
    $js .= get_js_open_window(900, 500);
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(tr("Enter Supplier Invoice"), false, false, "", $js);
//----------------------------------------------------------------------------------------
check_db_has_suppliers(tr("There are no suppliers defined in the system."));
//---------------------------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $invoice_no = $_GET['AddedID'];
    $trans_type = 20;
    echo "<center>";
    display_notification_centered(tr("Supplier invoice has been processed."));
    display_note(get_trans_view_str($trans_type, $invoice_no, tr("View this Invoice")));
    display_note(get_gl_view_str($trans_type, $invoice_no, tr("View the GL Journal Entries for this Invoice")), 1);
    hyperlink_params($_SERVER['PHP_SELF'], tr("Enter Another Invoice"), "New=1");
    display_footer_exit();
}
//--------------------------------------------------------------------------------------------------
if (isset($_GET['New'])) {
    if (isset($_SESSION['supp_trans'])) {
        unset($_SESSION['supp_trans']->grn_items);
        unset($_SESSION['supp_trans']->gl_codes);
        unset($_SESSION['supp_trans']);
    }
    //session_register("SuppInv");
    session_register("supp_trans");
    $_SESSION['supp_trans'] = new supp_trans();
    $_SESSION['supp_trans']->is_invoice = true;
}
    $help_context = "Modifying Delivery Note";
    processing_start();
} elseif (isset($_GET['OrderNumber'])) {
    $_SESSION['page_title'] = _($help_context = "Deliver Items for a Sales Order");
    processing_start();
}
page($_SESSION['page_title'], false, false, "", $js);
if (isset($_GET['AddedID'])) {
    $dispatch_no = $_GET['AddedID'];
    display_notification_centered(sprintf(_("Delivery # %d has been entered."), $dispatch_no));
    display_note(get_customer_trans_view_str(ST_CUSTDELIVERY, $dispatch_no, _("&View This Delivery")), 0, 1);
    display_note(print_document_link($dispatch_no, _("&Print Delivery Note"), true, ST_CUSTDELIVERY));
    display_note(print_document_link($dispatch_no, _("&Email Delivery Note"), true, ST_CUSTDELIVERY, false, "printlink", "", 1), 1, 1);
    display_note(print_document_link($dispatch_no, _("P&rint as Packing Slip"), true, ST_CUSTDELIVERY, false, "printlink", "", 0, 1));
    display_note(print_document_link($dispatch_no, _("E&mail as Packing Slip"), true, ST_CUSTDELIVERY, false, "printlink", "", 1, 1), 1);
    display_note(get_gl_view_str(13, $dispatch_no, _("View the GL Journal Entries for this Dispatch")), 1);
    hyperlink_params("{$path_to_root}/sales/customer_invoice.php", _("Invoice This Delivery"), "DeliveryNumber={$dispatch_no}");
    hyperlink_params("{$path_to_root}/sales/inquiry/sales_orders_view.php", _("Select Another Order For Dispatch"), "OutstandingOnly=1");
    display_footer_exit();
} elseif (isset($_GET['UpdatedID'])) {
    $delivery_no = $_GET['UpdatedID'];
    display_notification_centered(sprintf(_('Delivery Note # %d has been updated.'), $delivery_no));
    display_note(get_trans_view_str(ST_CUSTDELIVERY, $delivery_no, _("View this delivery")), 0, 1);
    display_note(print_document_link($delivery_no, _("&Print Delivery Note"), true, ST_CUSTDELIVERY));
    display_note(print_document_link($delivery_no, _("&Email Delivery Note"), true, ST_CUSTDELIVERY, false, "printlink", "", 1), 1, 1);
    display_note(print_document_link($delivery_no, _("P&rint as Packing Slip"), true, ST_CUSTDELIVERY, false, "printlink", "", 0, 1));
    display_note(print_document_link($delivery_no, _("E&mail as Packing Slip"), true, ST_CUSTDELIVERY, false, "printlink", "", 1, 1), 1);
    hyperlink_params($path_to_root . "/sales/customer_invoice.php", _("Confirm Delivery and Invoice"), "DeliveryNumber={$delivery_no}");
    hyperlink_params($path_to_root . "/sales/inquiry/sales_deliveries_view.php", _("Select A Different Delivery"), "OutstandingOnly=1");
    display_footer_exit();
}
function view_gl_link($row)
{
    //if ($row['closed'] == 0)
    //	return '';
    return get_gl_view_str(ST_WORKORDER, $row['id']);
}
    }
    display_footer_exit();
} elseif (isset($_GET['AddedDI'])) {
    $invoice = $_GET['AddedDI'];
    display_notification_centered(sprintf(_("Invoice # %d has been entered."), $invoice));
    submenu_view(_("&View This Invoice"), ST_SALESINVOICE, $invoice);
    submenu_print(_("&Print Sales Invoice"), ST_SALESINVOICE, $invoice . "-" . ST_SALESINVOICE, 'prtopt');
    submenu_print(_("&Email Sales Invoice"), ST_SALESINVOICE, $invoice . "-" . ST_SALESINVOICE, null, 1);
    set_focus('prtopt');
    $sql = "SELECT trans_type_from, trans_no_from FROM " . TB_PREF . "cust_allocations\n\t\t\tWHERE trans_type_to=" . ST_SALESINVOICE . " AND trans_no_to=" . db_escape($invoice);
    $result = db_query($sql, "could not retrieve customer allocation");
    $row = db_fetch($result);
    if ($row !== false) {
        submenu_print(_("Print &Receipt"), $row['trans_type_from'], $row['trans_no_from'] . "-" . $row['trans_type_from'], 'prtopt');
    }
    display_note(get_gl_view_str(ST_SALESINVOICE, $invoice, _("View the GL &Journal Entries for this Invoice")), 0, 1);
    if (isset($_GET['Type']) && $_GET['Type'] == 1) {
        submenu_option(_("Enter a &New Template Invoice"), "/sales/inquiry/sales_orders_view.php?InvoiceTemplates=Yes");
    } else {
        submenu_option(_("Enter a &New Direct Invoice"), "/sales/sales_order_entry.php?NewInvoice=0");
    }
    if ($row === false) {
        submenu_option(_("Entry &customer payment for this invoice"), "/sales/customer_payments.php?SInvoice=" . $invoice);
    }
    submenu_option(_("Add an Attachment"), "/admin/attachments.php?filterType=" . ST_SALESINVOICE . "&trans_no={$invoice}");
    display_footer_exit();
} else {
    check_edit_conflicts();
}
//-----------------------------------------------------------------------------
function copy_to_cart()
Example #9
0
                    break;
                }
            }
            unset($inv);
        } else {
            display_error(_("Invalid purchase invoice number."));
        }
    }
}
if (isset($_GET['AddedID'])) {
    $payment_id = $_GET['AddedID'];
    display_notification_centered(_("Payment has been sucessfully entered"));
    submenu_print(_("&Print This Remittance"), ST_SUPPAYMENT, $payment_id . "-" . ST_SUPPAYMENT, 'prtopt');
    submenu_print(_("&Email This Remittance"), ST_SUPPAYMENT, $payment_id . "-" . ST_SUPPAYMENT, null, 1);
    submenu_view(_("View this Payment"), ST_SUPPAYMENT, $payment_id);
    display_note(get_gl_view_str(ST_SUPPAYMENT, $payment_id, _("View the GL &Journal Entries for this Payment")), 0, 1);
    submenu_option(_("Enter another supplier &payment"), "/purchasing/supplier_payment.php?supplier_id=" . $_POST['supplier_id']);
    submenu_option(_("Enter Other &Payment"), "/gl/gl_bank.php?NewPayment=Yes");
    submenu_option(_("Enter &Customer Payment"), "/sales/customer_payments.php");
    submenu_option(_("Enter Other &Deposit"), "/gl/gl_bank.php?NewDeposit=Yes");
    submenu_option(_("Bank Account &Transfer"), "/gl/bank_transfer.php");
    display_footer_exit();
}
//----------------------------------------------------------------------------------------
function check_inputs()
{
    global $Refs;
    if (!get_post('supplier_id')) {
        display_error(_("There is no supplier selected."));
        set_focus('supplier_id');
        return false;
function gl_link($row)
{
    return get_gl_view_str($row["type"], $row["type_no"]);
}
Example #11
0
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(tr("Supplier Payment Entry"), false, false, "", $js);
if (isset($_GET['supplier_id'])) {
    $_POST['supplier_id'] = $_GET['supplier_id'];
}
//----------------------------------------------------------------------------------------
check_db_has_suppliers(tr("There are no suppliers defined in the system."));
check_db_has_bank_accounts(tr("There are no bank accounts defined in the system."));
check_db_has_bank_trans_types(tr("There are no bank payment types defined in the system."));
//----------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $payment_id = $_GET['AddedID'];
    display_notification_centered(tr("Payment has been sucessfully entered"));
    display_note(get_gl_view_str(22, $payment_id, tr("View the GL Journal Entries for this Payment")));
    hyperlink_params($path_to_root . "/purchasing/allocations/supplier_allocate.php", tr("Allocate this Payment"), "trans_no={$payment_id}&trans_type=22");
    hyperlink_params($_SERVER['PHP_SELF'], tr("Enter another supplier payment"), "supplier_id=" . $_POST['supplier_id']);
    display_footer_exit();
}
//----------------------------------------------------------------------------------------
function display_controls()
{
    global $table_style2;
    start_form(false, true);
    if (!isset($_POST['supplier_id'])) {
        $_POST['supplier_id'] = get_global_supplier(false);
    }
    if (!isset($_POST['DatePaid'])) {
        $_POST['DatePaid'] = Today();
        if (!is_date_in_fiscalyear($_POST['DatePaid'])) {
Example #12
0
$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_array[$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($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") . " - " . $_POST['TransToDate'], "colspan=4");
Example #13
0
    $old_cost = get_standard_cost($_POST['stock_id']);
    $new_cost = input_num('material_cost') + input_num('labour_cost') + input_num('overhead_cost');
    $should_update = true;
    if (!check_num('material_cost') || !check_num('labour_cost') || !check_num('overhead_cost')) {
        display_error(_("The entered cost is not numeric."));
        set_focus('material_cost');
        $should_update = false;
    } elseif ($old_cost == $new_cost) {
        display_error(_("The new cost is the same as the old cost. Cost was not updated."));
        $should_update = false;
    }
    if ($should_update) {
        $update_no = stock_cost_update($_POST['stock_id'], input_num('material_cost'), input_num('labour_cost'), input_num('overhead_cost'), $old_cost);
        display_notification(_("Cost has been updated."));
        if ($update_no > 0) {
            display_notification(get_gl_view_str(ST_COSTUPDATE, $update_no, _("View the GL Journal Entries for this Cost Update")));
        }
    }
}
if (list_updated('stock_id')) {
    $Ajax->activate('cost_table');
}
//-----------------------------------------------------------------------------------------
$action = $_SERVER['PHP_SELF'];
if (@$_GET['popup']) {
    $action .= "?stock_id=" . get_post('stock_id');
}
start_form(false, false, $action);
if (!isset($_POST['stock_id'])) {
    $_POST['stock_id'] = get_global_stock_item();
}
Example #14
0
    $js .= get_js_open_window(800, 500);
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
set_focus('CodeID2');
page(tr("Bank Account Payment Entry"), false, false, '', $js);
//-----------------------------------------------------------------------------------------------
check_db_has_bank_accounts(tr("There are no bank accounts defined in the system."));
check_db_has_bank_trans_types(tr("There are no bank payment types defined in the system."));
//-----------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $trans_no = $_GET['AddedID'];
    $trans_type = systypes::bank_payment();
    display_notification_centered(tr("Payment has been entered"));
    display_note(get_gl_view_str($trans_type, $trans_no, tr("View the GL Postings for this Payment")));
    hyperlink_no_params($_SERVER['PHP_SELF'], tr("Enter Another Payment"));
    display_footer_exit();
}
//--------------------------------------------------------------------------------------------------
function copy_to_py()
{
    $_SESSION['pay_items']->from_loc = $_POST['bank_account'];
    $_SESSION['pay_items']->tran_date = $_POST['date_'];
    $_SESSION['pay_items']->transfer_type = $_POST['type'];
    $_SESSION['pay_items']->increase = $_POST['PayType'];
    if (!isset($_POST['person_id'])) {
        $_POST['person_id'] = "";
    }
    $_SESSION['pay_items']->person_id = $_POST['person_id'];
    if (!isset($_POST['PersonDetailID'])) {
function handle_search()
{
    global $table_style;
    if (check_valid_entries() == true) {
        $db_info = get_systype_db_info($_POST['filterType']);
        if ($db_info == null) {
            return;
        }
        $table_name = $db_info[0];
        $type_name = $db_info[1];
        $trans_no_name = $db_info[2];
        $trans_ref = $db_info[3];
        $sql = "SELECT DISTINCT {$trans_no_name} ";
        if ($trans_ref) {
            $sql .= " ,{$trans_ref} ";
        }
        $sql .= " FROM {$table_name}\n\t\t\tWHERE {$trans_no_name} >= " . $_POST['FromTransNo'] . "\n\t\t\tAND  {$trans_no_name} <= " . $_POST['ToTransNo'];
        if ($type_name != null) {
            $sql .= " AND {$type_name} = " . $_POST['filterType'];
        }
        $sql .= " ORDER BY {$trans_no_name}";
        $result = db_query($sql, "could not query transactions on {$table_name}");
        if (db_num_rows($result) == 0) {
            echo tr("There are no transactions for the given parameters.");
            return;
        }
        $print_type = $_POST['filterType'];
        $print_out = $print_type == 10 || $print_type == 11 || $print_type == systypes::cust_dispatch() || $print_type == systypes::po() || $print_type == systypes::sales_order();
        if ($print_out) {
            print_hidden_script($print_type);
            if ($trans_ref) {
                $th = array(tr("#"), tr("Reference"), tr("View"), tr("Print"), tr("GL"));
            } else {
                $th = array(tr("#"), tr("View"), tr("Print"), tr("GL"));
            }
        } else {
            if ($trans_ref) {
                $th = array(tr("#"), tr("Reference"), tr("View"), tr("GL"));
            } else {
                $th = array(tr("#"), tr("View"), tr("GL"));
            }
        }
        start_table($table_style);
        table_header($th);
        $k = 0;
        while ($line = db_fetch($result)) {
            alt_table_row_color($k);
            label_cell($line[$trans_no_name]);
            if ($trans_ref) {
                label_cell($line[$trans_ref]);
            }
            label_cell(get_trans_view_str($_POST['filterType'], $line[$trans_no_name], tr("View")));
            if ($print_out) {
                label_cell(print_document_link($line[$trans_no_name], tr("Print"), true, $print_type));
            }
            label_cell(get_gl_view_str($_POST['filterType'], $line[$trans_no_name], tr("View GL")));
            end_row();
        }
        end_table();
    }
}
Example #16
0
    $js .= get_js_open_window(800, 500);
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(_($help_context = "Item Adjustments Note"), false, false, "", $js);
//-----------------------------------------------------------------------------------------------
check_db_has_costable_items(_("There are no inventory items defined in the system which can be adjusted (Purchased or Manufactured)."));
check_db_has_movement_types(_("There are no inventory movement types defined in the system. Please define at least one inventory adjustment type."));
//-----------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $trans_no = $_GET['AddedID'];
    $trans_type = ST_INVADJUST;
    display_notification_centered(_("Items adjustment has been processed"));
    display_note(get_trans_view_str($trans_type, $trans_no, _("&View this adjustment")));
    display_note(get_gl_view_str($trans_type, $trans_no, _("View the GL &Postings for this Adjustment")), 1, 0);
    hyperlink_no_params($_SERVER['PHP_SELF'], _("Enter &Another Adjustment"));
    hyperlink_params("{$path_to_root}/admin/attachments.php", _("Add an Attachment"), "filterType={$trans_type}&trans_no={$trans_no}");
    display_footer_exit();
}
//--------------------------------------------------------------------------------------------------
function line_start_focus()
{
    global $Ajax;
    $Ajax->activate('items_table');
    set_focus('_stock_id_edit');
}
//-----------------------------------------------------------------------------------------------
function handle_new_order()
{
    if (isset($_SESSION['adj_items'])) {
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(_($help_context = "Produce or Unassemble Finished Items From Work Order"), false, false, "", $js);
if (isset($_GET['trans_no']) && $_GET['trans_no'] != "") {
    $_POST['selected_id'] = $_GET['trans_no'];
}
//--------------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    include_once $path_to_root . "/reporting/includes/reporting.inc";
    $id = $_GET['AddedID'];
    $stype = ST_WORKORDER;
    display_notification(_("The manufacturing process has been entered."));
    display_note(get_trans_view_str($stype, $id, _("View this Work Order")));
    display_note(get_gl_view_str($stype, $id, _("View the GL Journal Entries for this Work Order")), 1);
    $ar = array('PARAM_0' => $_GET['date'], 'PARAM_1' => $_GET['date'], 'PARAM_2' => $stype);
    display_note(print_link(_("Print the GL Journal Entries for this Work Order"), 702, $ar), 1);
    hyperlink_no_params("search_work_orders.php", _("Select another &Work Order to Process"));
    br();
    end_page();
    exit;
}
//--------------------------------------------------------------------------------------------------
$wo_details = get_work_order($_POST['selected_id']);
if (strlen($wo_details[0]) == 0) {
    display_error(_("The order number sent is not valid."));
    exit;
}
//--------------------------------------------------------------------------------------------------
function can_process()
Example #18
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);
    }
}
Example #19
0
include_once $path_to_root . "/gl/includes/gl_ui.inc";
$js = "";
if ($use_popup_windows) {
    $js .= get_js_open_window(800, 500);
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(_($help_context = "Transfer between Bank Accounts"), false, false, "", $js);
check_db_has_bank_accounts(_("There are no bank accounts defined in the system."));
//----------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $trans_no = $_GET['AddedID'];
    $trans_type = ST_BANKTRANSFER;
    display_notification_centered(_("Transfer has been entered"));
    display_note(get_gl_view_str($trans_type, $trans_no, _("&View the GL Journal Entries for this Transfer")));
    hyperlink_no_params($_SERVER['PHP_SELF'], _("Enter &Another Transfer"));
    display_footer_exit();
}
if (isset($_POST['_DatePaid_changed'])) {
    $Ajax->activate('_ex_rate');
}
//----------------------------------------------------------------------------------------
function gl_payment_controls()
{
    global $Refs;
    $home_currency = get_company_currency();
    start_form();
    start_outer_table(TABLESTYLE2);
    table_section(1);
    bank_accounts_list_row(_("From Account:"), 'FromBankAccount', null, true);
Example #20
0
if ($use_popup_windows) {
    $js .= get_js_open_window(900, 500);
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(_($help_context = "Receive Purchase Order Items"), false, false, "", $js);
//---------------------------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $grn = $_GET['AddedID'];
    $trans_type = ST_SUPPRECEIVE;
    display_notification_centered(_("Purchase Order Delivery has been processed"));
    display_note(get_trans_view_str($trans_type, $grn, _("&View this Delivery")));
    $clearing_act = get_company_pref('grn_clearing_act');
    if ($clearing_act) {
        display_note(get_gl_view_str($trans_type, $grn, _("View the GL Journal Entries for this Delivery")), 1);
    }
    hyperlink_params("{$path_to_root}/purchasing/supplier_invoice.php", _("Entry purchase &invoice for this receival"), "New=1");
    hyperlink_no_params("{$path_to_root}/purchasing/inquiry/po_search.php", _("Select a different &purchase order for receiving items against"));
    display_footer_exit();
}
//--------------------------------------------------------------------------------------------------
if ((!isset($_GET['PONumber']) || $_GET['PONumber'] == 0) && !isset($_SESSION['PO'])) {
    die(_("This page can only be opened if a purchase order has been selected. Please select a purchase order first."));
}
//--------------------------------------------------------------------------------------------------
function display_po_receive_items()
{
    div_start('grn_items');
    start_table(TABLESTYLE, "colspan=7 width='90%'");
    $th = array(_("Item Code"), _("Description"), _("Ordered"), _("Units"), _("Received"), _("Outstanding"), _("This Delivery"), _("Price"), _("Total"));
function gl_view($row)
{
    return get_gl_view_str($row["type"], $row["trans_no"]);
}
include_once $path_to_root . "/manufacturing/includes/manufacturing_ui.inc";
include_once $path_to_root . "/manufacturing/includes/work_order_issue_ui.inc";
$js = "";
if ($use_popup_windows) {
    $js .= get_js_open_window(800, 500);
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(_($help_context = "Issue Items to Work Order"), false, false, "", $js);
//-----------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $id = $_GET['AddedID'];
    display_notification(_("The work order issue has been entered."));
    display_note(get_trans_view_str(ST_WORKORDER, $id, _("View this Work Order")));
    display_note(get_gl_view_str(ST_WORKORDER, $id, _("View the GL Journal Entries for this Work Order")), 1);
    hyperlink_no_params("search_work_orders.php", _("Select another &Work Order to Process"));
    display_footer_exit();
}
//--------------------------------------------------------------------------------------------------
function line_start_focus()
{
    global $Ajax;
    $Ajax->activate('items_table');
    set_focus('_stock_id_edit');
}
//--------------------------------------------------------------------------------------------------
function handle_new_order()
{
    if (isset($_SESSION['issue_items'])) {
        $_SESSION['issue_items']->clear_items();
Example #23
0
    }
}
if (isset($_GET['AddedID'])) {
    $payment_no = $_GET['AddedID'];
    display_notification_centered(_("The customer payment has been successfully entered."));
    submenu_print(_("&Print This Receipt"), ST_CUSTPAYMENT, $payment_no . "-" . ST_CUSTPAYMENT, 'prtopt');
    display_note(get_gl_view_str(ST_CUSTPAYMENT, $payment_no, _("&View the GL Journal Entries for this Customer Payment")));
    //	hyperlink_params($path_to_root . "/sales/allocations/customer_allocate.php", _("&Allocate this Customer Payment"), "trans_no=$payment_no&trans_type=12");
    hyperlink_no_params($path_to_root . "/sales/inquiry/customer_allocation_inquiry.php?customer_id=", _("Select Another &Customer Transaction for Payment"));
    hyperlink_no_params($path_to_root . "/sales/customer_payments.php", _("Enter Another &Customer Payment"));
    display_footer_exit();
} elseif (isset($_GET['UpdatedID'])) {
    $payment_no = $_GET['UpdatedID'];
    display_notification_centered(_("The customer payment has been successfully updated."));
    submenu_print(_("&Print This Receipt"), ST_CUSTPAYMENT, $payment_no . "-" . ST_CUSTPAYMENT, 'prtopt');
    display_note(get_gl_view_str(ST_CUSTPAYMENT, $payment_no, _("&View the GL Journal Entries for this Customer Payment")));
    //	hyperlink_params($path_to_root . "/sales/allocations/customer_allocate.php", _("&Allocate this Customer Payment"), "trans_no=$payment_no&trans_type=12");
    hyperlink_no_params($path_to_root . "/sales/inquiry/customer_inquiry.php?", _("Select Another Customer Payment for &Edition"));
    hyperlink_no_params($path_to_root . "/sales/customer_payments.php", _("Enter Another &Customer Payment"));
    display_footer_exit();
}
//----------------------------------------------------------------------------------------------
function can_process()
{
    global $Refs;
    if (!get_post('customer_id')) {
        display_error(_("There is no customer selected."));
        set_focus('customer_id');
        return false;
    }
    if (!get_post('BranchID')) {
Example #24
0
if ($use_popup_windows) {
    $js .= get_js_open_window(900, 500);
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(tr("Customer Payment Entry"), false, false, "", $js);
//----------------------------------------------------------------------------------------------
check_db_has_customers(tr("There are no customers defined in the system."));
check_db_has_bank_accounts(tr("There are no bank accounts defined in the system."));
check_db_has_bank_trans_types(tr("There are no bank payment types defined in the system."));
//----------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $payment_no = $_GET['AddedID'];
    display_notification_centered(tr("The customer payment has been successfully entered."));
    display_note(get_gl_view_str(12, $payment_no, tr("View the GL Journal Entries for this Customer Payment")));
    hyperlink_params($path_to_root . "/sales/allocations/customer_allocate.php", tr("Allocate this Customer Payment"), "trans_no={$payment_no}&trans_type=12");
    hyperlink_no_params($path_to_root . "/sales/customer_payments.php", tr("Enter Another Customer Payment"));
    br(1);
    end_page();
    exit;
}
//----------------------------------------------------------------------------------------------
function can_process()
{
    if (!isset($_POST['DateBanked']) || !is_date($_POST['DateBanked'])) {
        display_error(tr("The entered date is invalid. Please enter a valid date for the payment."));
        set_focus('DateBanked');
        return false;
    } elseif (!is_date_in_fiscalyear($_POST['DateBanked'])) {
        display_error(tr("The entered date is not in fiscal year."));
Example #25
0
    display_footer_exit();
}
if (isset($_GET['AddedDep'])) {
    $trans_no = $_GET['AddedDep'];
    $trans_type = ST_BANKDEPOSIT;
    display_notification_centered(sprintf(_("Deposit %d has been entered"), $trans_no));
    display_note(get_gl_view_str($trans_type, $trans_no, _("View the GL Postings for this Deposit")));
    hyperlink_params($_SERVER['PHP_SELF'], _("Enter Another Deposit"), "NewDeposit=yes");
    hyperlink_params($_SERVER['PHP_SELF'], _("Enter A Payment"), "NewPayment=yes");
    display_footer_exit();
}
if (isset($_GET['UpdatedDep'])) {
    $trans_no = $_GET['UpdatedDep'];
    $trans_type = ST_BANKDEPOSIT;
    display_notification_centered(sprintf(_("Deposit %d has been modified"), $trans_no));
    display_note(get_gl_view_str($trans_type, $trans_no, _("&View the GL Postings for this Deposit")));
    hyperlink_params($_SERVER['PHP_SELF'], _("Enter Another &Deposit"), "NewDeposit=yes");
    hyperlink_params($_SERVER['PHP_SELF'], _("Enter A &Payment"), "NewPayment=yes");
    display_footer_exit();
}
//--------------------------------------------------------------------------------------------------
function create_cart($type, $trans_no)
{
    global $Refs;
    if (isset($_SESSION['pay_items'])) {
        unset($_SESSION['pay_items']);
    }
    $cart = new items_cart($type);
    $cart->order_id = $trans_no;
    if ($trans_no) {
        $bank_trans = db_fetch(get_bank_trans($type, $trans_no));
Example #26
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 #27
0
}
//-----------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $trans_no = $_GET['AddedID'];
    $trans_type = ST_JOURNAL;
    display_notification_centered(_("Journal entry has been entered") . " #{$trans_no}");
    display_note(get_gl_view_str($trans_type, $trans_no, _("&View this Journal Entry")));
    reset_focus();
    hyperlink_params($_SERVER['PHP_SELF'], _("Enter &New Journal Entry"), "NewJournal=Yes");
    hyperlink_params("{$path_to_root}/admin/attachments.php", _("Add an Attachment"), "filterType={$trans_type}&trans_no={$trans_no}");
    display_footer_exit();
} elseif (isset($_GET['UpdatedID'])) {
    $trans_no = $_GET['UpdatedID'];
    $trans_type = ST_JOURNAL;
    display_notification_centered(_("Journal entry has been updated") . " #{$trans_no}");
    display_note(get_gl_view_str($trans_type, $trans_no, _("&View this Journal Entry")));
    hyperlink_no_params($path_to_root . "/gl/inquiry/journal_inquiry.php", _("Return to Journal &Inquiry"));
    display_footer_exit();
}
//--------------------------------------------------------------------------------------------------
if (isset($_GET['NewJournal'])) {
    create_cart(0, 0);
} elseif (isset($_GET['ModifyGL'])) {
    if (!isset($_GET['trans_type']) || $_GET['trans_type'] != 0) {
        display_error(_("You can edit directly only journal entries created via Journal Entry page."));
        hyperlink_params("{$path_to_root}/gl/gl_journal.php", _("Entry &New Journal Entry"), "NewJournal=Yes");
        display_footer_exit();
    }
    create_cart($_GET['trans_type'], $_GET['trans_no']);
}
function create_cart($type = 0, $trans_no = 0)
Example #28
0
    $old_cost = $_POST['OldMaterialCost'] + $_POST['OldLabourCost'] + $_POST['OldOverheadCost'];
    $new_cost = input_num('material_cost') + input_num('labour_cost') + input_num('overhead_cost');
    $should_update = true;
    if (!check_num('material_cost') || !check_num('labour_cost') || !check_num('overhead_cost')) {
        display_error(tr("The entered cost is not numeric."));
        set_focus('material_cost');
        $should_update = false;
    } elseif ($old_cost == $new_cost) {
        display_error(tr("The new cost is the same as the old cost. Cost was not updated."));
        $should_update = false;
    }
    if ($should_update) {
        $update_no = stock_cost_update($_POST['stock_id'], input_num('material_cost'), input_num('labour_cost'), input_num('overhead_cost'), $old_cost);
        display_note(tr("Cost has been updated."));
        if ($update_no > 0) {
            display_note(get_gl_view_str(systypes::cost_update(), $update_no, tr("View the GL Journal Entries for this Cost Update")), 1, 0);
        }
    }
}
//-----------------------------------------------------------------------------------------
start_form(false, true);
if (!isset($_POST['stock_id'])) {
    $_POST['stock_id'] = get_global_stock_item();
}
echo "<center>" . tr("Item:") . "&nbsp;";
stock_costable_items_list('stock_id', $_POST['stock_id'], false, true);
echo "</center><hr>";
set_global_stock_item($_POST['stock_id']);
$sql = "SELECT description, units, last_cost, actual_cost, material_cost, labour_cost,\n\toverhead_cost, mb_flag\n\tFROM stock_master\n\tWHERE stock_id='" . $_POST['stock_id'] . "'\n\tGROUP BY description, units, last_cost, actual_cost, material_cost, labour_cost, overhead_cost, mb_flag";
$result = db_query($sql);
check_db_error("The cost details for the item could not be retrieved", $sql);