function display_wo_issue_details($issue_no)
{
    $result = get_work_order_issue_details($issue_no);
    if (db_num_rows($result) == 0) {
        display_note(_("There are no items for this issue."));
    } else {
        start_table(TABLESTYLE);
        $th = array(_("Component"), _("Quantity"), _("Units"));
        table_header($th);
        $j = 1;
        $k = 0;
        //row colour counter
        $total_cost = 0;
        while ($myrow = db_fetch($result)) {
            alt_table_row_color($k);
            label_cell($myrow["stock_id"] . " - " . $myrow["description"]);
            qty_cell($myrow["qty_issued"], false, get_qty_dec($myrow["stock_id"]));
            label_cell($myrow["units"]);
            end_row();
            $j++;
            if ($j == 12) {
                $j = 1;
                table_header($th);
            }
            //end of page full new headings if
        }
        //end of while
        end_table();
    }
}
Exemple #2
0
function edit_allocations_for_transaction($type, $trans_no)
{
    global $systypes_array;
    $cart = $_SESSION['alloc'];
    display_heading(sprintf(_("Allocation of %s # %d"), $systypes_array[$cart->type], $cart->trans_no));
    display_heading($cart->person_name);
    display_heading2(_("Date:") . " <b>" . $cart->date_ . "</b>");
    display_heading2(_("Total:") . " <b>" . price_format($cart->bank_amount) . ' ' . $cart->currency . "</b>");
    if ($cart->currency != $cart->person_curr) {
        $total = _("Total in clearing currency:") . " <b>" . price_format($cart->amount) . "</b>" . sprintf(" %s (%s %s/%s)", $cart->person_curr, exrate_format($cart->bank_amount / $cart->amount), $cart->currency, $cart->person_curr);
        display_heading2($total);
    }
    echo "<br>";
    start_form();
    div_start('alloc_tbl');
    if (count($cart->allocs) > 0) {
        show_allocatable(true);
        submit_center_first('UpdateDisplay', _("Refresh"), _('Start again allocation of selected amount'), true);
        submit('Process', _("Process"), true, _('Process allocations'), 'default');
        submit_center_last('Cancel', _("Back to Allocations"), _('Abandon allocations and return to selection of allocatable amounts'), 'cancel');
    } else {
        display_note(_("There are no unsettled transactions to allocate."), 0, 1);
        submit_center('Cancel', _("Back to Allocations"), true, _('Abandon allocations and return to selection of allocatable amounts'), 'cancel');
    }
    div_end();
    end_form();
}
function check_valid_entries()
{
    if (!is_numeric($_POST['FromTransNo']) or $_POST['FromTransNo'] <= 0) {
        display_note(tr("The starting transaction number is expected to be numeric and greater than zero."));
        return false;
    }
    if (!is_numeric($_POST['ToTransNo']) or $_POST['ToTransNo'] <= 0) {
        echo tr("The ending transaction number is expected to be numeric and greater than zero.");
        return false;
    }
    if (!isset($_POST['filterType']) || $_POST['filterType'] == "") {
        return false;
    }
    return true;
}
function display_grn_items_for_selection()
{
    global $table_style;
    $result = get_grn_items(0, $_SESSION['supp_trans']->supplier_id, true);
    if (db_num_rows($result) == 0) {
        display_note(tr("There are no outstanding items received from this supplier that have not been invoiced by them."), 0, 1);
        end_page();
        exit;
    }
    /*Set up a table to show the outstanding GRN items for selection */
    start_form(false, true);
    display_heading2(tr("Items Received Yet to be Invoiced"));
    start_table("{$table_style} colspan=7 width=95%");
    $th = array(tr("Delivery"), tr("Sequence #"), tr("P.O."), tr("Item"), tr("Description"), tr("Received On"), tr("Quantity Received"), tr("Quantity Invoiced"), tr("Uninvoiced Quantity"), tr("Order Price"), tr("Total"));
    table_header($th);
    $i = $k = 0;
    while ($myrow = db_fetch($result)) {
        $grn_already_on_invoice = False;
        foreach ($_SESSION['supp_trans']->grn_items as $entered_grn) {
            if ($entered_grn->id == $myrow["id"]) {
                $grn_already_on_invoice = True;
            }
        }
        if ($grn_already_on_invoice == False) {
            alt_table_row_color($k);
            label_cell(get_trans_view_str(25, $myrow["grn_batch_id"]));
            //text_cells(null, 'grn_item_id', $myrow["id"]);
            submit_cells('grn_item_id', $myrow["id"]);
            label_cell(get_trans_view_str(systypes::po(), $myrow["purch_order_no"]));
            label_cell($myrow["item_code"]);
            label_cell($myrow["description"]);
            label_cell(sql2date($myrow["delivery_date"]));
            qty_cell($myrow["qty_recd"]);
            qty_cell($myrow["quantity_inv"]);
            qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"]);
            amount_cell($myrow["unit_price"]);
            amount_cell(round($myrow["unit_price"] * ($myrow["qty_recd"] - $myrow["quantity_inv"]), user_price_dec()));
            end_row();
            $i++;
            if ($i > 15) {
                $i = 0;
                table_header($th);
            }
        }
    }
    end_table();
}
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'])) {
            $_POST['DatePaid'] = end_fiscalyear();
        }
    }
    start_table($table_style2, 5, 7);
    echo "<tr><td valign=top>";
    // outer table
    echo "<table>";
    bank_accounts_list_row(tr("From Bank Account:"), 'bank_account', null, true);
    amount_row(tr("Amount of Payment:"), 'amount');
    amount_row(tr("Amount of Discount:"), 'discount');
    date_row(tr("Date Paid") . ":", 'DatePaid');
    echo "</table>";
    echo "</td><td valign=top class='tableseparator'>";
    // outer table
    echo "<table>";
    supplier_list_row(tr("Payment To:"), 'supplier_id', null, false, true);
    set_global_supplier($_POST['supplier_id']);
    $supplier_currency = get_supplier_currency($_POST['supplier_id']);
    $bank_currency = get_bank_account_currency($_POST['bank_account']);
    if ($bank_currency != $supplier_currency) {
        exchange_rate_display($bank_currency, $supplier_currency, $_POST['DatePaid']);
    }
    bank_trans_types_list_row(tr("Payment Type:"), 'PaymentType', null);
    ref_row(tr("Reference:"), 'ref', references::get_next(22));
    text_row(tr("Memo:"), 'memo_', null, 52, 50);
    echo "</table>";
    echo "</td></tr>";
    end_table(1);
    // outer table
    submit_center('ProcessSuppPayment', tr("Enter Payment"));
    if ($bank_currency != $supplier_currency) {
        display_note(tr("The amount and discount are in the bank account's currency."), 2, 0);
    }
    end_form();
}
function handle_report()
{
    global $Ajax;
    if (can_process()) {
        $from = $_POST['TransFromDate'];
        $to = $_POST['TransToDate'];
        $typeId = $_POST['typeId'];
        $accountId = $_POST['accountId'];
        display_notification(_('Report successfully generated.'));
        $arr = array($from, $to, $typeId, $accountId);
        $trans_type = ST_SUBSIDIARY;
        display_note(print_document_link($arr, _("&Print Report"), true, $trans_type));
    } else {
        display_notification(_('Report not generated, please contact the administrator.'));
    }
    $Ajax->activate('_page_body');
    return;
}
function viewing_controls()
{
    display_note(_("Only documents can be printed."));
    start_table(TABLESTYLE_NOBORDER);
    start_row();
    systypes_list_cells(_("Type:"), 'filterType', null, true);
    if (!isset($_POST['FromTransNo'])) {
        $_POST['FromTransNo'] = "1";
    }
    if (!isset($_POST['ToTransNo'])) {
        $_POST['ToTransNo'] = "999999";
    }
    ref_cells(_("from #:"), 'FromTransNo');
    ref_cells(_("to #:"), 'ToTransNo');
    submit_cells('ProcessSearch', _("Search"), '', '', 'default');
    end_row();
    end_table(1);
}
function voiding_controls()
{
    global $table_style2;
    start_form(false, true);
    start_table($table_style2);
    systypes_list_row(tr("Transaction Type:"), "filterType", null, true);
    text_row(tr("Transaction #:"), 'trans_no', null, 12, 12);
    date_row(tr("Voiding Date:"), 'date_');
    textarea_row(tr("Memo:"), 'memo_', null, 30, 4);
    end_table(1);
    if (!isset($_POST['ProcessVoiding'])) {
        submit_center('ProcessVoiding', tr("Void Transaction"));
    } else {
        display_note(tr("Are you sure you want to void this transaction ? This action cannot be undone."), 0, 1);
        submit_center_first('ConfirmVoiding', tr("Proceed"));
        submit_center_last('CancelVoiding', tr("Cancel"));
    }
    end_form();
}
Exemple #9
0
function can_delete($selected_id)
{
    if ($selected_id == -1) {
        return false;
    }
    $sql = "SELECT COUNT(*) FROM cust_branch WHERE tax_group_id={$selected_id}";
    $result = db_query($sql, "could not query customers");
    $myrow = db_fetch_row($result);
    if ($myrow[0] > 0) {
        display_note(tr("Cannot delete this tax group because customer branches been created referring to it."));
        return false;
    }
    $sql = "SELECT COUNT(*) FROM suppliers WHERE tax_group_id={$selected_id}";
    $result = db_query($sql, "could not query suppliers");
    $myrow = db_fetch_row($result);
    if ($myrow[0] > 0) {
        display_note(tr("Cannot delete this tax group because suppliers been created referring to it."));
        return false;
    }
    return true;
}
function edit_allocations_for_transaction($type, $trans_no)
{
    global $systypes_array;
    start_form();
    display_heading(_("Allocation of") . " " . $systypes_array[$_SESSION['alloc']->type] . " # " . $_SESSION['alloc']->trans_no);
    display_heading($_SESSION['alloc']->person_name);
    display_heading2(_("Date:") . " <b>" . $_SESSION['alloc']->date_ . "</b>");
    display_heading2(_("Total:") . " <b>" . price_format(-$_SESSION['alloc']->amount) . "</b>");
    echo "<br>";
    div_start('alloc_tbl');
    if (count($_SESSION['alloc']->allocs) > 0) {
        show_allocatable(true);
        submit_center_first('UpdateDisplay', _("Refresh"), _('Start again allocation of selected amount'), true);
        submit('Process', _("Process"), true, _('Process allocations'), 'default');
        submit_center_last('Cancel', _("Back to Allocations"), _('Abandon allocations and return to selection of allocatable amounts'), 'cancel');
    } else {
        display_note(_("There are no unsettled transactions to allocate."), 0, 1);
        submit_center('Cancel', _("Back to Allocations"), true, _('Abandon allocations and return to selection of allocatable amounts'), 'cancel');
    }
    div_end();
    end_form();
}
Exemple #11
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;
}
Exemple #12
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;
    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));
        label_cell($myrow["br_name"]);
        label_cell($myrow["contact_name"]);
        label_cell($myrow["salesman_name"]);
        label_cell($myrow["description"]);
        label_cell($myrow["phone"]);
        label_cell($myrow["fax"]);
        label_cell("<a href=mailto:" . $myrow["email"] . ">" . $myrow["email"] . "</a>");
        label_cell($myrow["tax_group_name"]);
        edit_link_cell("debtor_no=" . $_POST['customer_id'] . "&SelectedBranch=" . $myrow["branch_code"]);
        delete_link_cell("debtor_no=" . $_POST['customer_id'] . "&SelectedBranch=" . $myrow["branch_code"] . "&delete=yes");
        end_row();
    }
    end_table();
    //END WHILE LIST LOOP
} else {
    display_note(tr("The selected customer does not have any branches. Please create at least one branch."));
}
if ($_POST['customer_id'] != "" && $_POST['branch_code'] != '') {
    hyperlink_params($_SERVER['PHP_SELF'], tr("New Customer Branch"), "debtor_no=" . $_POST['customer_id']);
}
echo "<br>";
start_table("{$table_style2} width=60%", 5);
echo "<tr valign=top><td>";
// outer table
echo "<table>";
//editing an existing branch
$sql = "SELECT * FROM cust_branch WHERE branch_code='" . $_POST['branch_code'] . "' AND debtor_no='" . $_POST['customer_id'] . "'";
$result = db_query($sql, "check failed");
$myrow = db_fetch($result);
$_POST['branch_code'] = $myrow["branch_code"];
$_POST['br_name'] = $myrow["br_name"];
$_POST['ChargeFreightCost'] = get_post('ChargeFreightCost', price_format($_SESSION['Items']->freight_cost));
$colspan = 9;
start_row();
label_cell(_("Shipping Cost"), "colspan={$colspan} align=right");
small_amount_cells(null, 'ChargeFreightCost', $_SESSION['Items']->freight_cost);
end_row();
$inv_items_total = $_SESSION['Items']->get_items_total_dispatch();
$display_sub_total = price_format($inv_items_total + input_num('ChargeFreightCost'));
label_row(_("Sub-total"), $display_sub_total, "colspan={$colspan} align=right", "align=right");
$taxes = $_SESSION['Items']->get_taxes(input_num('ChargeFreightCost'));
$tax_total = display_edit_tax_items($taxes, $colspan, $_SESSION['Items']->tax_included);
$display_total = price_format($inv_items_total + input_num('ChargeFreightCost') + $tax_total);
label_row(_("Amount Total"), $display_total, "colspan={$colspan} align=right", "align=right");
end_table(1);
if ($has_marked) {
    display_note(_("Marked items have insufficient quantities in stock as on day of delivery."), 0, 1, "class='stockmankofg'");
}
start_table(TABLESTYLE2);
policy_list_row(_("Action For Balance"), "bo_policy", null);
textarea_row(_("Memo"), 'Comments', null, 50, 4);
end_table(1);
div_end();
submit_center_first('Update', _("Update"), _('Refresh document page'), true);
if (isset($_POST['clear_quantity'])) {
    submit('reset_quantity', _('Reset quantity'), true, _('Refresh document page'));
} else {
    submit('clear_quantity', _('Clear quantity'), true, _('Refresh document page'));
}
submit_center_last('process_delivery', _("Process Dispatch"), _('Check entered data and save document'), 'default');
end_form();
end_page();
Exemple #16
0
    qty_cell($stock_item->qty_inv, false, $dec);
    end_row();
    $total += $line_total;
}
$display_sub_tot = number_format2($total, user_price_dec());
label_row(_("Sub Total"), $display_sub_tot, "align=right colspan=6", "nowrap align=right", 2);
$taxes = $purchase_order->get_taxes();
$tax_total = display_edit_tax_items($taxes, 6, $purchase_order->tax_included, 2);
$display_total = price_format($total + $tax_total);
start_row();
label_cells(_("Amount Total"), $display_total, "colspan=6 align='right'", "align='right'");
label_cell('', "colspan=2");
end_row();
end_table();
if ($overdue_items) {
    display_note(_("Marked items are overdue."), 0, 0, "class='overduefg'");
}
//----------------------------------------------------------------------------------------------------
$k = 0;
$grns_result = get_po_grns($_GET['trans_no']);
if (db_num_rows($grns_result) > 0) {
    echo "</td><td valign=top>";
    // outer table
    display_heading2(_("Deliveries"));
    start_table(TABLESTYLE);
    $th = array(_("#"), _("Reference"), _("Delivered On"));
    table_header($th);
    while ($myrow = db_fetch($grns_result)) {
        alt_table_row_color($k);
        label_cell(get_trans_view_str(ST_SUPPRECEIVE, $myrow["id"]));
        label_cell($myrow["reference"]);
label_cells(_("Amount"), number_format2(-$from_trans['amount'], user_price_dec()), "class='tableheader2'", "align=right");
label_cells(_("Date"), sql2date($from_trans['trans_date']), "class='tableheader2'");
end_row();
start_row();
label_cells(_("Pay To"), payment_person_name($from_trans['person_type_id'], $from_trans['person_id']), "class='tableheader2'", "colspan={$colspan1}");
label_cells(_("Payment Type"), $bank_transfer_types[$from_trans['account_type']], "class='tableheader2'");
end_row();
start_row();
label_cells(_("Reference"), $from_trans['ref'], "class='tableheader2'", "colspan={$colspan2}");
end_row();
comments_display_row(ST_BANKPAYMENT, $trans_no);
end_table(1);
$voided = is_voided_display(ST_BANKPAYMENT, $trans_no, _("This payment has been voided."));
$items = get_gl_trans(ST_BANKPAYMENT, $trans_no);
if (db_num_rows($items) == 0) {
    display_note(_("There are no items for this payment."));
} else {
    display_heading2(_("Items for this Payment"));
    if ($show_currencies) {
        display_heading2(_("Item Amounts are Shown in :") . " " . $company_currency);
    }
    echo "<br>";
    start_table(TABLESTYLE, "width=80%");
    $dim = get_company_pref('use_dimension');
    if ($dim == 2) {
        $th = array(_("Account Code"), _("Account Description"), _("Dimension") . " 1", _("Dimension") . " 2", _("Amount"), _("Memo"));
    } else {
        if ($dim == 1) {
            $th = array(_("Account Code"), _("Account Description"), _("Dimension"), _("Amount"), _("Memo"));
        } else {
            $th = array(_("Account Code"), _("Account Description"), _("Amount"), _("Memo"));
            $credits_total += $this_total;
            label_cell(get_customer_trans_view_str($credits_row["type"], $credits_row["trans_no"]));
            label_cell($credits_row["reference"]);
            label_cell(sql2date($credits_row["tran_date"]));
            amount_cell(-$this_total);
            end_row();
        }
    }
    label_row(null, "<font color=red>" . price_format(-$credits_total) . "</font>", " ", "colspan=4 align=right");
    end_table();
    echo "</td></tr>";
    end_table();
}
echo "<center>";
if ($_SESSION['View']->so_type == 1) {
    display_note(_("This Sales Order is used as a Template."), 0, 0, "class='currentfg'");
}
display_heading2(_("Line Details"));
start_table(TABLESTYLE, "colspan=9 width=95%");
$th = array(_("Item Code"), _("Item Description"), _("Quantity"), _("Unit"), _("Price"), _("Discount"), _("Total"), _("Quantity Delivered"));
table_header($th);
$k = 0;
//row colour counter
foreach ($_SESSION['View']->line_items as $stock_item) {
    $line_total = round2($stock_item->quantity * $stock_item->price * (1 - $stock_item->discount_percent), user_price_dec());
    alt_table_row_color($k);
    label_cell($stock_item->stock_id);
    label_cell($stock_item->item_description);
    $dec = get_qty_dec($stock_item->stock_id);
    qty_cell($stock_item->quantity, false, $dec);
    label_cell($stock_item->units);
Exemple #19
0
if ($use_popup_windows) {
    $js .= get_js_open_window(800, 500);
}
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(_($help_context = "Inventory Location Transfers"), false, false, "", $js);
//-----------------------------------------------------------------------------------------------
check_db_has_costable_items(_("There are no inventory items defined in the system (Purchased or manufactured items)."));
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_LOCTRANSFER;
    display_notification_centered(_("Inventory transfer has been processed"));
    display_note(get_trans_view_str($trans_type, $trans_no, _("&View this transfer")));
    hyperlink_no_params($_SERVER['PHP_SELF'], _("Enter &Another Inventory Transfer"));
    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['transfer_items'])) {
        $_SESSION['transfer_items']->clear_items();
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);
function edit_allocations_for_transaction($type, $trans_no)
{
    global $table_style;
    start_form(false, true);
    display_heading(sprintf(tr("Allocation of %s # %d"), systypes::name($_SESSION['alloc']->type), $_SESSION['alloc']->trans_no));
    display_heading($_SESSION['alloc']->person_name);
    display_heading2(tr("Date:") . " <b>" . $_SESSION['alloc']->date_ . "</b>");
    display_heading2(tr("Total:") . " <b>" . price_format($_SESSION['alloc']->amount) . "</b>");
    echo "<br>";
    if (count($_SESSION['alloc']->allocs) > 0) {
        start_table($table_style);
        $th = array(tr("Transaction Type"), tr("#"), tr("Date"), tr("Due Date"), tr("Amount"), tr("Other Allocations"), tr("This Allocation"), tr("Left to Allocate"), "", "");
        table_header($th);
        $k = $counter = $total_allocated = 0;
        foreach ($_SESSION['alloc']->allocs as $allocn_item) {
            alt_table_row_color($k);
            label_cell(systypes::name($allocn_item->type));
            label_cell(get_trans_view_str($allocn_item->type, $allocn_item->type_no));
            label_cell($allocn_item->date_, "align=right");
            label_cell($allocn_item->due_date, "align=right");
            amount_cell($allocn_item->amount);
            amount_cell($allocn_item->amount_allocated);
            if (!check_num('amount' . $counter)) {
                $_POST['amount' . $counter] = price_format($allocn_item->current_allocated);
            }
            amount_cells(null, 'amount' . $counter, $_POST['amount' . $counter]);
            $un_allocated = round($allocn_item->amount - $allocn_item->amount_allocated, 6);
            hidden("un_allocated" . $counter, $un_allocated);
            amount_cell($un_allocated);
            label_cell("<a href='#' name=Alloc{$counter} onclick='allocate_all(this.name.substr(5));return true;'>" . tr("All") . "</a>");
            label_cell("<a href='#' name=DeAll{$counter} onclick='allocate_none(this.name.substr(5));return true;'>" . tr("None") . "</a>");
            end_row();
            $total_allocated += input_num('amount' . $counter);
            $counter++;
        }
        label_row(tr("Total Allocated"), price_format($total_allocated), "colspan=6 align=right", "nowrap align=right id='total_allocated'");
        if ($_SESSION['alloc']->amount - $total_allocated < 0) {
            $font1 = "<font color=red>";
            $font2 = "</font>";
        } else {
            $font1 = $font2 = "";
        }
        $left_to_allocate = $_SESSION['alloc']->amount - $total_allocated;
        $left_to_allocate = price_format($left_to_allocate);
        label_row(tr("Left to Allocate"), $font1 . $left_to_allocate . $font2, "colspan=6 align=right ", "nowrap align=right id='left_to_allocate'");
        end_table(1);
        hidden('TotalNumberOfAllocs', $counter);
        //		hidden('left_to_allocate', $left_to_allocate);
        submit_center_first('UpdateDisplay', tr("Update"));
        submit('Process', tr("Process"));
    } else {
        display_note(tr("There are no unsettled transactions to allocate."), 0, 1);
    }
    submit_center_last('Cancel', tr("Back to Allocations"));
    end_form();
}
include_once $path_to_root . "/includes/date_functions.inc";
include_once $path_to_root . "/includes/db/inventory_db.inc";
include_once $path_to_root . "/includes/manufacturing.inc";
include_once $path_to_root . "/manufacturing/includes/manufacturing_db.inc";
include_once $path_to_root . "/manufacturing/includes/manufacturing_ui.inc";
$js = "";
if ($use_date_picker) {
    $js .= get_js_date_picker();
}
page(tr("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'])) {
    display_note(tr("The manufacturing process has been entered."));
    hyperlink_no_params("search_work_orders.php", tr("Select another Work Order to Process"));
    end_page();
    exit;
}
//--------------------------------------------------------------------------------------------------
$wo_details = get_work_order($_POST['selected_id']);
if (strlen($wo_details[0]) == 0) {
    display_error(tr("The order number sent is not valid."));
    exit;
}
//--------------------------------------------------------------------------------------------------
function can_process()
{
    global $wo_details;
    if (!references::is_valid($_POST['ref'])) {
function display_companies()
{
    global $def_coy, $db_connections;
    $coyno = $_SESSION["wa_current_user"]->company;
    echo "\n\t\t<script language='javascript'>\n\t\tfunction deleteCompany(id, name) {\n\t\t\tif (!confirm('" . _("Are you sure you want to delete company no. ") . "'+id+' '+name+'?'))\n\t\t\t\treturn\n\t\t\tdocument.location.replace('create_coy.php?c=df&id='+id)\n\t\t}\n\t\t</script>";
    start_table(TABLESTYLE);
    $th = array(_("Company"), _("Database Host"), _("Database User"), _("Database Name"), _("Table Pref"), _("Default"), "", "");
    table_header($th);
    $k = 0;
    $conn = $db_connections;
    $n = count($conn);
    for ($i = 0; $i < $n; $i++) {
        if ($i == $def_coy) {
            $what = _("Yes");
        } else {
            $what = _("No");
        }
        if ($i == $coyno) {
            start_row("class='stockmankobg'");
        } else {
            alt_table_row_color($k);
        }
        label_cell($conn[$i]['name']);
        label_cell($conn[$i]['host']);
        label_cell($conn[$i]['dbuser']);
        label_cell($conn[$i]['dbname']);
        label_cell($conn[$i]['tbpref']);
        label_cell($what);
        $edit = _("Edit");
        $delete = _("Delete");
        if (user_graphic_links()) {
            $edit = set_icon(ICON_EDIT, $edit);
            $delete = set_icon(ICON_DELETE, $delete);
        }
        label_cell("<a href='" . $_SERVER['PHP_SELF'] . "?selected_id={$i}'>{$edit}</a>");
        $name = "\"" . $conn[$i]['name'] . "\"";
        label_cell($i == $coyno ? '' : "<a href='javascript:deleteCompany({$i}, {$name})'>{$delete}</a>");
        end_row();
    }
    end_table();
    display_note(_("The marked company is the current company which cannot be deleted."), 0, 0, "class='currentfg'");
    display_note(_("If no Admin Password is entered, the new Admin Password will be '<b>password</b>' by default "), 1, 0, "class='currentfg'");
}
Exemple #24
0
            set_focus('name');
        }
        if (!isset($installed_extensions)) {
            $installed_extensions = array();
            update_extensions($installed_extensions);
        }
        subpage_title(_('Company Settings'));
        start_table(TABLESTYLE);
        text_row_ex(_("Company Name:"), 'name', 30);
        text_row_ex(_("Admin Login:"******"Admin Password:"******"Reenter Password:"******"Select Chart of Accounts:"), 'coa');
        languages_list_row(_("Select Default Language:"), 'lang');
        end_table(1);
        submit_center_first('back', _('<< Back'));
        submit_center_last('set_admin', _('Continue >>'));
        break;
    case '6':
        // final screen
        subpage_title(_('SerbizHub Suite ERP has been installed successsfully.'));
        display_note(_('Please do not forget to remove install wizard folder.'));
        session_unset();
        session_destroy();
        hyperlink_no_params($path_to_root . '/index.php', _('Click here to start.'));
        break;
}
hidden('Tests');
hidden('Page');
end_form(1);
end_page(false, false, true);
Exemple #25
0
function handle_cancel_po()
{
    global $path_to_root;
    //need to check that not already dispatched or invoiced by the supplier
    if ($_SESSION['PO']->order_no != 0 && $_SESSION['PO']->any_already_received() == 1) {
        display_error(tr("This order cannot be cancelled because some of it has already been received.") . "<br>" . tr("The line item quantities may be modified to quantities more than already received. prices cannot be altered for lines that have already been received and quantities cannot be reduced below the quantity already received."));
        return;
    }
    if ($_SESSION['PO']->order_no != 0) {
        delete_po($_SESSION['PO']->order_no);
    }
    $_SESSION['PO']->clear_items();
    $_SESSION['PO'] = new purch_order();
    display_note(tr("This purchase order has been cancelled."), 0, 1);
    hyperlink_params($path_to_root . "/purchasing/po_entry_items.php", tr("Enter a new purchase order"), "NewOrder=Yes");
    echo "<br>";
    end_page();
    exit;
}
$comp_currency = get_company_currency();
$cust_currency = get_customer_currency($_POST['customer_id']);
$bank_currency = get_bank_account_currency($_POST['bank_account']);
if ($cust_currency != $bank_currency) {
    exchange_rate_display($bank_currency, $cust_currency, $_POST['DateBanked'], $bank_currency == $comp_currency);
}
amount_row(_("Bank Charge:"), 'charge');
end_outer_table(1);
if ($cust_currency == $bank_currency) {
    div_start('alloc_tbl');
    show_allocatable(false);
    div_end();
}
start_table(TABLESTYLE, "width=60%");
label_row(_("Customer prompt payment discount :"), $display_discount_percent);
amount_row(_("Amount of Discount:"), 'discount');
amount_row(_("Amount:"), 'amount');
textarea_row(_("Memo:"), 'memo_', null, 22, 4);
end_table(1);
if ($cust_currency != $bank_currency) {
    display_note(_("Amount and discount are in customer's currency."));
}
br();
if ($new) {
    submit_center('AddPaymentItem', _("Update Payment"), true, '', 'default');
} else {
    submit_center('AddPaymentItem', _("Add Payment"), true, '', 'default');
}
br();
end_form();
end_page();
    }
    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()
    }
    label_cell($myrow["description"]);
    label_cell(get_customer_trans_view_str(30, $myrow["order_no"]));
    if ($myrow["debtor_no"] == 0) {
        label_cell("");
        label_cell(get_sales_group_name($myrow["group_no"]));
    } else {
        label_cell(get_customer_name($myrow["debtor_no"]));
        label_cell(get_branch_name($myrow['group_no']));
    }
    label_cell($myrow["days"]);
    label_cell($myrow['monthly']);
    label_cell($begin);
    label_cell($end);
    label_cell($myrow['last_sent'] == "0000-00-00" ? "" : $last_sent);
    if ($overdue) {
        button_cell("create" . $myrow["id"], _("Create Invoices"), "", ICON_DOC);
    } else {
        label_cell("");
    }
    end_row();
}
end_table();
end_form();
if ($due) {
    display_note(_("Marked items are due."), 1, 0, "class='overduefg'");
} else {
    display_note(_("No recurrent invoices are due."), 1, 0);
}
br();
end_page();
label_cells(_("From"), payment_person_name($to_trans['person_type_id'], $to_trans['person_id']), "class='tableheader2'", "colspan={$colspan1}");
if ($show_currencies) {
    label_cells(_("Settle currency"), $to_trans['settle_curr'], "class='tableheader2'");
    label_cells(_("Settled amount"), number_format2($to_trans['settled_amount'], user_price_dec()), "class='tableheader2'");
}
label_cells(_("Deposit Type"), $bank_transfer_types[$to_trans['account_type']], "class='tableheader2'");
end_row();
start_row();
label_cells(_("Reference"), $to_trans['ref'], "class='tableheader2'", "colspan={$colspan2}");
end_row();
comments_display_row(ST_BANKDEPOSIT, $trans_no);
end_table(1);
is_voided_display(ST_BANKDEPOSIT, $trans_no, _("This deposit has been voided."));
$items = get_gl_trans(ST_BANKDEPOSIT, $trans_no);
if (db_num_rows($items) == 0) {
    display_note(_("There are no items for this deposit."));
} else {
    display_heading2(_("Items for this Deposit"));
    if ($show_currencies) {
        display_heading2(_("Item Amounts are Shown in:") . " " . $company_currency);
    }
    start_table(TABLESTYLE, "width=80%");
    $dim = get_company_pref('use_dimension');
    if ($dim == 2) {
        $th = array(_("Account Code"), _("Account Description"), _("Dimension") . " 1", _("Dimension") . " 2", _("Amount"), _("Memo"));
    } else {
        if ($dim == 1) {
            $th = array(_("Account Code"), _("Account Description"), _("Dimension"), _("Amount"), _("Memo"));
        } else {
            $th = array(_("Account Code"), _("Account Description"), _("Amount"), _("Memo"));
        }
    $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');
    submenu_view(_("&View this Customer Payment"), ST_CUSTPAYMENT, $payment_no);
    submenu_option(_("Enter Another &Customer Payment"), "/sales/customer_payments.php");
    submenu_option(_("Enter Other &Deposit"), "/gl/gl_bank.php?NewDeposit=Yes");
    submenu_option(_("Enter Payment to &Supplier"), "/purchasing/supplier_payment.php");
    submenu_option(_("Enter Other &Payment"), "/gl/gl_bank.php?NewPayment=Yes");
    submenu_option(_("Bank Account &Transfer"), "/gl/bank_transfer.php");
    display_note(get_gl_view_str(ST_CUSTPAYMENT, $payment_no, _("&View the GL Journal Entries for this 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')) {