Ejemplo n.º 1
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();
}
Ejemplo n.º 2
0
function gl_payment_controls()
{
    global $table_style2;
    $home_currency = get_company_currency();
    start_form(false, true);
    start_table($table_style2, 5, 7);
    echo "<tr><td valign=top>";
    // outer table
    echo "<table>";
    bank_accounts_list_row(tr("From Account:"), 'FromBankAccount', null, true);
    bank_accounts_list_row(tr("To Account:"), 'ToBankAccount', null, true);
    date_row(tr("Transfer Date:"), 'DatePaid');
    $from_currency = get_bank_account_currency($_POST['FromBankAccount']);
    $to_currency = get_bank_account_currency($_POST['ToBankAccount']);
    if ($from_currency != "" && $to_currency != "" && $from_currency != $to_currency) {
        amount_row(tr("Amount:"), 'amount', null, null, $from_currency);
        exchange_rate_display($from_currency, $to_currency, $_POST['DatePaid']);
    } else {
        amount_row(tr("Amount:"), 'amount');
    }
    echo "</table>";
    echo "</td><td valign=top class='tableseparator'>";
    // outer table
    echo "<table>";
    bank_trans_types_list_row(tr("Transfer Type:"), 'TransferType', null);
    ref_row(tr("Reference:"), 'ref', references::get_next(systypes::bank_transfer()));
    textarea_row(tr("Memo:"), 'memo_', null, 40, 4);
    end_table(1);
    echo "</td></tr>";
    end_table(1);
    // outer table
    submit_center('AddPayment', tr("Enter Transfer"));
    end_form();
}
function display_reval()
{
    global $Refs;
    start_form();
    start_table(TABLESTYLE2);
    if (!isset($_POST['date'])) {
        $_POST['date'] = Today();
    }
    date_row(_("Date for Revaluation:"), 'date', '', null, 0, 0, 0, null, true);
    ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_JOURNAL));
    textarea_row(_("Memo:"), 'memo_', null, 40, 4);
    end_table(1);
    submit_center('submit', _("Revaluate Currencies"), true, false);
    end_form();
}
Ejemplo n.º 4
0
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();
}
Ejemplo n.º 5
0
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();
}
Ejemplo n.º 6
0
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();
}
Ejemplo n.º 7
0
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);
    bank_balance_row($_POST['FromBankAccount']);
    bank_accounts_list_row(_("To Account:"), 'ToBankAccount', null, true);
    if (!isset($_POST['DatePaid'])) {
        // init page
        $_POST['DatePaid'] = new_doc_date();
        if (!is_date_in_fiscalyear($_POST['DatePaid'])) {
            $_POST['DatePaid'] = end_fiscalyear();
        }
    }
    date_row(_("Transfer Date:"), 'DatePaid', '', true, 0, 0, 0, null, true);
    ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_BANKTRANSFER));
    table_section(2);
    $from_currency = get_bank_account_currency($_POST['FromBankAccount']);
    $to_currency = get_bank_account_currency($_POST['ToBankAccount']);
    if ($from_currency != "" && $to_currency != "" && $from_currency != $to_currency) {
        amount_row(_("Amount:"), 'amount', null, null, $from_currency);
        amount_row(_("Bank Charge:"), 'charge', null, null, $from_currency);
        amount_row(_("Incoming Amount:"), 'target_amount', null, '', $to_currency, 2);
    } else {
        amount_row(_("Amount:"), 'amount');
        amount_row(_("Bank Charge:"), 'charge');
    }
    textarea_row(_("Memo:"), 'memo_', null, 40, 4);
    end_outer_table(1);
    // outer table
    submit_center('AddPayment', _("Enter Transfer"), true, '', 'default');
    end_form();
}
$th = array(_("Reconcile Date"), _("Beginning<br>Balance"), _("Ending<br>Balance"), _("Account<br>Total"), _("Reconciled<br>Amount"), _("Difference"));
table_header($th);
start_row();
date_cells("", "reconcile_date", _('Date of bank statement to reconcile'), get_post('bank_date') == '', 0, 0, 0, null, true);
amount_cells_ex("", "beg_balance", 15);
amount_cells_ex("", "end_balance", 15);
$reconciled = input_num('reconciled');
$difference = input_num("end_balance") - input_num("beg_balance") - $reconciled;
amount_cell($total);
amount_cell($reconciled, false, '', "reconciled");
amount_cell($difference, false, '', "difference");
end_row();
end_table();
div_end();
echo "<hr>";
//------------------------------------------------------------------------------------------------
if (!isset($_POST['bank_account'])) {
    $_POST['bank_account'] = "";
}
$sql = get_sql_for_bank_account_reconcile($_POST['bank_account'], get_post('reconcile_date'));
$act = get_bank_account($_POST["bank_account"]);
display_heading($act['bank_account_name'] . " - " . $act['bank_curr_code']);
$cols = array(_("Type") => array('fun' => 'systype_name', 'ord' => ''), _("#") => array('fun' => 'trans_view', 'ord' => ''), _("Reference"), _("Date") => 'date', _("Debit") => array('align' => 'right', 'fun' => 'fmt_debit'), _("Credit") => array('align' => 'right', 'insert' => true, 'fun' => 'fmt_credit'), _("Person/Item") => array('fun' => 'fmt_person'), array('insert' => true, 'fun' => 'gl_view'), "X" => array('insert' => true, 'fun' => 'rec_checkbox'));
$table =& new_db_pager('trans_tbl', $sql, $cols);
$table->width = "80%";
display_db_pager($table);
br(1);
submit_center('Reconcile', _("Reconcile"), true, '', null);
end_form();
//------------------------------------------------------------------------------------------------
end_page();
Ejemplo n.º 9
0
possible separators can be added by modifying the array definition by editing that file */
if (!isset($_POST['language'])) {
    $_POST['language'] = $_SESSION['language']->code;
}
table_section_title(_("Language"));
languages_list_row(_("Language:"), 'language', $_POST['language']);
table_section(2);
table_section_title(_("Miscellaneous"));
check_row(_("Show hints for new users:"), 'show_hints', user_hints());
check_row(_("Show GL Information:"), 'show_gl', user_show_gl_info());
check_row(_("Show Item Codes:"), 'show_codes', user_show_codes());
themes_list_row(_("Theme:"), "theme", user_theme());
/* The array $themes is set up in config.php for modifications
possible separators can be added by modifying the array definition by editing that file */
pagesizes_list_row(_("Page Size:"), "page_size", user_pagesize());
tab_list_row(_("Start-up Tab"), 'startup_tab', user_startup_tab());
/* The array $pagesizes is set up in config.php for modifications
possible separators can be added by modifying the array definition by editing that file */
if (!isset($_POST['print_profile'])) {
    $_POST['print_profile'] = user_print_profile();
}
print_profiles_list_row(_("Printing profile") . ':', 'print_profile', null, _('Browser printing support'));
check_row(_("Use popup window to display reports:"), 'rep_popup', user_rep_popup(), false, _('Set this option to on if your browser directly supports pdf files'));
check_row(_("Use icons instead of text links:"), 'graphic_links', user_graphic_links(), false, _('Set this option to on for using icons instead of text links'));
text_row_ex(_("Query page size:"), 'query_size', 5, 5, '', user_query_size());
check_row(_("Remember last document date:"), 'sticky_doc_date', sticky_doc_date(), false, _('If set document date is remembered on subsequent documents, otherwise default is current date'));
end_outer_table(1);
submit_center('setprefs', _("Update"), true, '', 'default');
end_form(2);
//-------------------------------------------------------------------------------------------------
end_page();
Ejemplo n.º 10
0
display_po_items($_SESSION['PO']);
start_table(TABLESTYLE2);
textarea_row(_("Memo:"), 'Comments', null, 70, 4);
end_table(1);
div_start('controls', 'items_table');
$process_txt = _("Place Order");
$update_txt = _("Update Order");
$cancel_txt = _("Cancel Order");
if ($_SESSION['PO']->trans_type == ST_SUPPRECEIVE) {
    $process_txt = _("Process GRN");
    $update_txt = _("Update GRN");
    $cancel_txt = _("Cancel GRN");
} elseif ($_SESSION['PO']->trans_type == ST_SUPPINVOICE) {
    $process_txt = _("Process Invoice");
    $update_txt = _("Update Invoice");
    $cancel_txt = _("Cancel Invoice");
}
if ($_SESSION['PO']->order_has_items()) {
    if ($_SESSION['PO']->order_no) {
        submit_center_first('Commit', $update_txt, '', 'default');
    } else {
        submit_center_first('Commit', $process_txt, '', 'default');
    }
    submit_center_last('CancelOrder', $cancel_txt);
} else {
    submit_center('CancelOrder', $cancel_txt, true, false, 'cancel');
}
div_end();
//---------------------------------------------------------------------------------------------------
end_form();
end_page();
Ejemplo n.º 11
0
} else {
    $_POST['amount'] = price_format(0);
}
bank_accounts_list_row(_("From Bank Account:"), 'bank_account', null, true);
bank_balance_row($_POST['bank_account']);
table_section(2);
date_row(_("Date Paid") . ":", 'DatePaid', '', true, 0, 0, 0, null, true);
ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_SUPPAYMENT));
table_section(3);
$comp_currency = get_company_currency();
$supplier_currency = $_SESSION['alloc']->set_person($_POST['supplier_id'], PT_SUPPLIER);
if (!$supplier_currency) {
    $supplier_currency = $comp_currency;
}
$_SESSION['alloc']->currency = $bank_currency = get_bank_account_currency($_POST['bank_account']);
if ($bank_currency != $supplier_currency) {
    amount_row(_("Bank Amount:"), 'bank_amount', null, '', $bank_currency);
}
amount_row(_("Bank Charge:"), 'charge', null, '', $bank_currency);
end_outer_table(1);
div_start('alloc_tbl');
show_allocatable(false);
div_end();
start_table(TABLESTYLE, "width='60%'");
amount_row(_("Amount of Discount:"), 'discount', null, '', $supplier_currency);
amount_row(_("Amount of Payment:"), 'amount', null, '', $supplier_currency);
textarea_row(_("Memo:"), 'memo_', null, 22, 4);
end_table(1);
submit_center('ProcessSuppPayment', _("Enter Payment"), true, '', 'default');
end_form();
end_page();
    $_POST['empl_id'] = $myrow["empl_id"];
    $_POST['empl_name'] = $myrow["empl_name"];
    $gross = $_POST['gross_salary'] = $myrow["gross_salary"];
    start_table(TABLESTYLE2, "width=30%");
    table_section_title(_("Employee Informations"));
    hidden('empl_id', $_POST['empl_id']);
    label_row(_("Employee Name:"), $_POST['empl_id'] . '-' . $_POST['empl_name']);
    date_row(_("Date of Pay") . ":", 'date_of_pay');
    label_row(_("Gross Pay:"), $_POST['gross_salary']);
    hidden('gross_pay', $_POST['gross_salary']);
    text_row(_("Number of Leave days :"), 'leave_days', null, 2, 40);
    text_row(_("Monthly loan Amount:"), 'monthly_loan', null, 2, 40);
    //submit_cells('RefreshInquiry', _("Show"),'',_('Show Results'), 'default');
    end_table();
    br();
    submit_center('RefreshInquiry', _("Calculate Pay"), true, '', 'default');
    br();
    br();
}
div_end();
if (isset($selected_id) && $selected_id != '') {
    div_start('totals_tbl');
    $gross = $_POST['gross_salary'];
    //display_notification( $_POST['leave_days'].$_POST['monthly_loan']);
    $employee_leave_record = isset($_POST['leave_days']) ? $_POST['leave_days'] : 0;
    $staff_loan = isset($_POST['monthly_loan']) ? $_POST['monthly_loan'] : 0;
    if (db_has_employee_payslip($_POST['year'], $_POST['month'], $_POST['empl_id'])) {
        $existing_payslip = get_current_payslip($_POST['year'], $_POST['month'], $_POST['empl_id']);
        $basic_pay = $existing_payslip['basic'];
        $da_pay = $existing_payslip['da'];
        $hra_pay = $existing_payslip['hra'];
Ejemplo n.º 13
0
$id = find_submit('Delete');
if ($id != -1) {
    handle_delete_item($id);
}
if (isset($_POST['AddItem'])) {
    handle_new_item();
}
if (isset($_POST['UpdateItem'])) {
    handle_update_item();
}
if (isset($_POST['CancelItemChanges'])) {
    line_start_focus();
}
//-----------------------------------------------------------------------------------------------
if (isset($_GET['trans_no'])) {
    handle_new_order();
}
//-----------------------------------------------------------------------------------------------
display_wo_details($_SESSION['issue_items']->order_id);
echo "<br>";
start_form();
start_table(TABLESTYLE, "width=90%", 10);
echo "<tr><td>";
display_issue_items(_("Items to Issue"), $_SESSION['issue_items']);
issue_options_controls();
echo "</td></tr>";
end_table();
submit_center('Process', _("Process Issue"), true, '', 'default');
end_form();
//------------------------------------------------------------------------------------------------
end_page();
Ejemplo n.º 14
0
    currencies_list_row(tr("Supplier's Currency:"), 'curr_code', null);
}
tax_groups_list_row(tr("Tax Group:"), 'tax_group_id', null);
payment_terms_list_row(tr("Payment Terms:"), 'payment_terms', null);
table_section_title(tr("Accounts"));
gl_all_accounts_list_row(tr("Accounts Payable Account:"), 'payable_account', $_POST['payable_account']);
gl_all_accounts_list_row(tr("Purchase Account:"), 'purchase_account', $_POST['purchase_account']);
gl_all_accounts_list_row(tr("Purchase Discount Account:"), 'payment_discount_account', $_POST['payment_discount_account']);
$dim = get_company_pref('use_dimension');
if ($dim >= 1) {
    table_section_title(tr("Dimension"));
    dimensions_list_row(tr("Dimension") . " 1:", 'dimension_id', null, true, " ", false, 1);
    if ($dim > 1) {
        dimensions_list_row(tr("Dimension") . " 2:", 'dimension2_id', null, true, " ", false, 2);
    }
}
if ($dim < 1) {
    hidden('dimension_id', 0);
}
if ($dim < 2) {
    hidden('dimension2_id', 0);
}
end_table(1);
if (!isset($_POST['New'])) {
    submit_center_first('submit', tr("Update Supplier"));
    submit_center_last('delete', tr("Delete Supplier"));
} else {
    submit_center('submit', tr("Add New Supplier Details"));
}
end_form();
end_page();
Ejemplo n.º 15
0
    unset($_SESSION['supp_trans']);
    meta_forward($_SERVER['PHP_SELF'], "AddedID={$invoice_no}");
}
//--------------------------------------------------------------------------------------------------
if (isset($_POST['PostInvoice'])) {
    handle_commit_invoice();
}
//--------------------------------------------------------------------------------------------------
start_form(false, true);
start_table("{$table_style2} width=80%", 8);
echo "<tr><td valign=center>";
// outer table
echo "<center>";
invoice_header($_SESSION['supp_trans']);
echo "</td></tr><tr><td valign=center>";
// outer table
echo "<center>";
display_grn_items($_SESSION['supp_trans']);
display_gl_items($_SESSION['supp_trans']);
//echo "</td></tr><tr><td align=center colspan=2>"; // outer table
echo "<br>";
invoice_totals($_SESSION['supp_trans']);
echo "</td></tr>";
end_table();
// outer table
echo "<br>";
submit_center('PostInvoice', tr("Enter Invoice"));
echo "<br>";
end_form();
//--------------------------------------------------------------------------------------------------
end_page();
Ejemplo n.º 16
0
function customer_settings($selected_id)
{
    global $SysPrefs, $path_to_root, $auto_create_branch;
    if (!$selected_id) {
        if (list_updated('customer_id') || !isset($_POST['CustName'])) {
            $_POST['CustName'] = $_POST['cust_ref'] = $_POST['address'] = $_POST['tax_id'] = '';
            $_POST['dimension_id'] = 0;
            $_POST['dimension2_id'] = 0;
            $_POST['sales_type'] = -1;
            $_POST['curr_code'] = get_company_currency();
            $_POST['credit_status'] = -1;
            $_POST['payment_terms'] = $_POST['notes'] = '';
            $_POST['discount'] = $_POST['pymt_discount'] = percent_format(0);
            $_POST['credit_limit'] = price_format($SysPrefs->default_credit_limit());
        }
    } else {
        $myrow = get_customer($selected_id);
        $_POST['CustName'] = $myrow["name"];
        $_POST['cust_ref'] = $myrow["debtor_ref"];
        $_POST['address'] = $myrow["address"];
        $_POST['tax_id'] = $myrow["tax_id"];
        $_POST['dimension_id'] = $myrow["dimension_id"];
        $_POST['dimension2_id'] = $myrow["dimension2_id"];
        $_POST['sales_type'] = $myrow["sales_type"];
        $_POST['curr_code'] = $myrow["curr_code"];
        $_POST['credit_status'] = $myrow["credit_status"];
        $_POST['payment_terms'] = $myrow["payment_terms"];
        $_POST['discount'] = percent_format($myrow["discount"] * 100);
        $_POST['pymt_discount'] = percent_format($myrow["pymt_discount"] * 100);
        $_POST['credit_limit'] = price_format($myrow["credit_limit"]);
        $_POST['notes'] = $myrow["notes"];
        $_POST['inactive'] = $myrow["inactive"];
    }
    start_outer_table(TABLESTYLE2);
    table_section(1);
    table_section_title(_("Name and Address"));
    text_row(_("Customer Name:"), 'CustName', $_POST['CustName'], 40, 80);
    text_row(_("Customer Short Name:"), 'cust_ref', null, 30, 30);
    textarea_row(_("Address:"), 'address', $_POST['address'], 35, 5);
    text_row(_("GSTNo:"), 'tax_id', null, 40, 40);
    if (!$selected_id || is_new_customer($selected_id)) {
        currencies_list_row(_("Customer's Currency:"), 'curr_code', $_POST['curr_code']);
    } else {
        label_row(_("Customer's Currency:"), $_POST['curr_code']);
        hidden('curr_code', $_POST['curr_code']);
    }
    sales_types_list_row(_("Sales Type/Price List:"), 'sales_type', $_POST['sales_type']);
    if ($selected_id) {
        record_status_list_row(_("Customer status:"), 'inactive');
    } elseif (isset($auto_create_branch) && $auto_create_branch == 1) {
        table_section_title(_("Branch"));
        text_row(_("Phone:"), 'phone', null, 32, 30);
        text_row(_("Secondary Phone Number:"), 'phone2', null, 32, 30);
        text_row(_("Fax Number:"), 'fax', null, 32, 30);
        email_row(_("E-mail:"), 'email', null, 35, 55);
        sales_persons_list_row(_("Sales Person:"), 'salesman', null);
    }
    table_section(2);
    table_section_title(_("Sales"));
    percent_row(_("Discount Percent:"), 'discount', $_POST['discount']);
    percent_row(_("Prompt Payment Discount Percent:"), 'pymt_discount', $_POST['pymt_discount']);
    amount_row(_("Credit Limit:"), 'credit_limit', $_POST['credit_limit']);
    payment_terms_list_row(_("Payment Terms:"), 'payment_terms', $_POST['payment_terms']);
    credit_status_list_row(_("Credit Status:"), 'credit_status', $_POST['credit_status']);
    $dim = get_company_pref('use_dimension');
    if ($dim >= 1) {
        dimensions_list_row(_("Dimension") . " 1:", 'dimension_id', $_POST['dimension_id'], true, " ", false, 1);
    }
    if ($dim > 1) {
        dimensions_list_row(_("Dimension") . " 2:", 'dimension2_id', $_POST['dimension2_id'], true, " ", false, 2);
    }
    if ($dim < 1) {
        hidden('dimension_id', 0);
    }
    if ($dim < 2) {
        hidden('dimension2_id', 0);
    }
    if ($selected_id) {
        start_row();
        echo '<td class="label">' . _('Customer branches') . ':</td>';
        hyperlink_params_td($path_to_root . "/sales/manage/customer_branches.php", '<b>' . (@$_REQUEST['popup'] ? _("Select or &Add") : _("&Add or Edit ")) . '</b>', "debtor_no=" . $selected_id . (@$_REQUEST['popup'] ? '&popup=1' : ''));
        end_row();
    }
    textarea_row(_("General Notes:"), 'notes', null, 35, 5);
    if (!$selected_id && isset($auto_create_branch) && $auto_create_branch == 1) {
        table_section_title(_("Branch"));
        locations_list_row(_("Default Inventory Location:"), 'location');
        shippers_list_row(_("Default Shipping Company:"), 'ship_via');
        sales_areas_list_row(_("Sales Area:"), 'area', null);
        tax_groups_list_row(_("Tax Group:"), 'tax_group_id', null);
    }
    end_outer_table(1);
    div_start('controls');
    if (!$selected_id) {
        submit_center('submit', _("Add New Customer"), true, '', 'default');
    } else {
        submit_center_first('submit', _("Update Customer"), _('Update customer data'), @$_REQUEST['popup'] ? true : 'default');
        submit_return('select', $selected_id, _("Select this customer and return to document entry."));
        submit_center_last('delete', _("Delete Customer"), _('Delete customer data if have been never used'), true);
    }
    div_end();
}
Ejemplo n.º 17
0
 //			submit_center('continue', _('Continue >>'));
 //			break;
 case '1':
     div_start('welcome');
     subpage_title(_('System Diagnostics'));
     start_table();
     instlang_list_row(_("Select install wizard language:"), 'inst_lang', $_SESSION['inst_set']['inst_lang']);
     end_table(1);
     $_POST['Tests'] = display_system_tests(true);
     br();
     if (@$_POST['Tests']) {
         display_notification(_('All application preliminary requirements seems to be correct. Please press Continue button below.'));
         submit_center('continue', _('Continue >>'));
     } else {
         display_error(_('Application cannot be installed. Please fix problems listed below in red, and press Refresh button.'));
         submit_center('refresh', _('Refresh'));
     }
     div_end();
     break;
 case '2':
     if (!isset($_POST['host'])) {
         foreach ($_SESSION['inst_set'] as $name => $val) {
             $_POST[$name] = $val;
         }
     }
     subpage_title(_('Database Server Settings'));
     start_table(TABLESTYLE);
     text_row_ex(_("Server Host:"), 'host', 30, 60);
     text_row_ex(_("Database User:"******"Database Password:"******"Database Name:"), 'dbname', 30);
Ejemplo n.º 18
0
function display_item_form()
{
    global $table_style2;
    start_table($table_style2, 5, 7);
    echo "<tr><td valign=top>";
    // outer table
    echo "<table>";
    if (!isset($_POST['customer_id'])) {
        $_POST['customer_id'] = get_global_customer(false);
    }
    if (!isset($_POST['DateBanked'])) {
        $_POST['DateBanked'] = Today();
        if (!is_date_in_fiscalyear($_POST['DateBanked'])) {
            $_POST['DateBanked'] = end_fiscalyear();
        }
    }
    customer_list_row(tr("From Customer:"), 'customer_id', null, false, true);
    if (db_customer_has_branches($_POST['customer_id'])) {
        customer_branches_list_row(tr("Branch:"), $_POST['customer_id'], 'BranchID', null, false, true, true);
    } else {
        hidden('BranchID', reserved_words::get_any_numeric());
    }
    read_customer_data();
    set_global_customer($_POST['customer_id']);
    if (isset($_POST['HoldAccount']) && $_POST['HoldAccount'] != 0) {
        echo "</table></table>";
        display_note(tr("This customer account is on hold."), 0, 0, "class='redfb'");
    } else {
        $display_discount_percent = percent_format($_POST['pymt_discount'] * 100) . "%";
        amount_row(tr("Amount:"), 'amount');
        amount_row(tr("Amount of Discount:"), 'discount');
        label_row(tr("Customer prompt payment discount :"), $display_discount_percent);
        date_row(tr("Date of Deposit:"), 'DateBanked');
        echo "</table>";
        echo "</td><td valign=top class='tableseparator'>";
        // outer table
        echo "<table>";
        bank_accounts_list_row(tr("Into Bank Account:"), 'bank_account', null, true);
        $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($cust_currency, $bank_currency, $_POST['DateBanked']);
        }
        bank_trans_types_list_row(tr("Type:"), 'ReceiptType', null);
        text_row(tr("Reference:"), 'ref', null, 20, 40);
        textarea_row(tr("Memo:"), 'memo_', null, 22, 4);
        echo "</table>";
        echo "</td></tr>";
        end_table();
        // outer table
        if ($cust_currency != $bank_currency) {
            display_note(tr("Amount and discount are in customer's currency."));
        }
        echo "<br>";
        submit_center('AddPaymentItem', tr("Add Payment"));
    }
    echo "<br>";
}
    if ($_POST['password'] != $_POST['passwordConfirm']) {
        display_error(_("The passwords entered are not the same."));
        set_focus('password');
        return false;
    }
    return true;
}
if (isset($_POST['UPDATE_ITEM']) && check_csrf_token()) {
    if (can_process()) {
        if ($allow_demo_mode) {
            display_warning(_("Password cannot be changed in demo mode."));
        } else {
            update_user_password($_SESSION["wa_current_user"]->user, $_SESSION["wa_current_user"]->username, md5($_POST['password']));
            display_notification(_("Your password has been updated."));
        }
        $Ajax->activate('_page_body');
    }
}
start_form();
start_table(TABLESTYLE);
$myrow = get_user($_SESSION["wa_current_user"]->user);
label_row(_("User login:"******"";
$_POST['passwordConfirm'] = "";
password_row(_("Password:"******"Repeat password:"******"Enter your new password in the fields."));
end_table(1);
submit_center('UPDATE_ITEM', _('Change password'), true, '', 'default');
end_form();
end_page();
Ejemplo n.º 20
0
function voiding_controls()
{
    global $selected_id;
    $not_implemented = array(ST_PURCHORDER, ST_SALESORDER, ST_SALESQUOTE, ST_COSTUPDATE);
    start_form();
    start_table(TABLESTYLE_NOBORDER);
    start_row();
    systypes_list_cells(_("Type:"), 'filterType', null, true, $not_implemented);
    if (list_updated('filterType')) {
        $selected_id = -1;
    }
    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);
    $trans_ref = false;
    $sql = get_sql_for_view_transactions($_POST['filterType'], $_POST['FromTransNo'], $_POST['ToTransNo'], $trans_ref);
    if ($sql == "") {
        return;
    }
    $cols = array(_("#") => array('insert' => true, 'fun' => 'view_link'), _("Reference") => array('fun' => 'ref_view'), _("Date") => array('type' => 'date', 'fun' => 'date_view'), _("GL") => array('insert' => true, 'fun' => 'gl_view'), _("Select") => array('insert' => true, 'fun' => 'select_link'));
    $table =& new_db_pager('transactions', $sql, $cols);
    $table->width = "40%";
    display_db_pager($table);
    start_table(TABLESTYLE2);
    if ($selected_id != -1) {
        hidden('trans_no', $selected_id);
        hidden('selected_id', $selected_id);
    } else {
        hidden('trans_no', '');
        $_POST['memo_'] = '';
    }
    label_row(_("Transaction #:"), $selected_id == -1 ? '' : $selected_id);
    date_row(_("Voiding Date:"), 'date_');
    textarea_row(_("Memo:"), 'memo_', null, 30, 4);
    end_table(1);
    if (!isset($_POST['ProcessVoiding'])) {
        submit_center('ProcessVoiding', _("Void Transaction"), true, '', 'default');
    } else {
        if (!exist_transaction($_POST['filterType'], $_POST['trans_no'])) {
            display_error(_("The entered transaction does not exist or cannot be voided."));
            unset($_POST['trans_no']);
            unset($_POST['memo_']);
            unset($_POST['date_']);
            submit_center('ProcessVoiding', _("Void Transaction"), true, '', 'default');
        } else {
            display_warning(_("Are you sure you want to void this transaction ? This action cannot be undone."), 0, 1);
            br();
            submit_center_first('ConfirmVoiding', _("Proceed"), '', true);
            submit_center_last('CancelVoiding', _("Cancel"), '', 'cancel');
        }
    }
    end_form();
}
Ejemplo n.º 21
0
function display_company_edit($selected_id)
{
    global $def_coy, $db_connections, $tb_pref_counter;
    start_form();
    start_table(TABLESTYLE2);
    if ($selected_id != -1) {
        $conn = $db_connections[$selected_id];
        $_POST['name'] = $conn['name'];
        $_POST['host'] = $conn['host'];
        $_POST['dbuser'] = $conn['dbuser'];
        $_POST['dbpassword'] = $conn['dbpassword'];
        $_POST['dbname'] = $conn['dbname'];
        $_POST['tbpref'] = $conn['tbpref'];
        if ($selected_id == $def_coy) {
            $_POST['def'] = true;
        } else {
            $_POST['def'] = false;
        }
        $_POST['dbcreate'] = false;
        hidden('selected_id', $selected_id);
        hidden('tbpref', $_POST['tbpref']);
        hidden('dbpassword', $_POST['dbpassword']);
    } else {
        $_POST['tbpref'] = $tb_pref_counter . "_";
        // Insert the current settings as default
        $conn = $db_connections[user_company()];
        $_POST['name'] = '';
        $_POST['host'] = $conn['host'];
        $_POST['dbuser'] = $conn['dbuser'];
        $_POST['dbpassword'] = $conn['dbpassword'];
        $_POST['dbname'] = $conn['dbname'];
    }
    text_row_ex(_("Company"), 'name', 50);
    if ($selected_id == -1) {
        text_row_ex(_("Host"), 'host', 30, 60);
        text_row_ex(_("Database User"), 'dbuser', 30);
        text_row_ex(_("Database Password"), 'dbpassword', 30);
        text_row_ex(_("Database Name"), 'dbname', 30);
        yesno_list_row(_("Table Pref"), 'tbpref', 1, $_POST['tbpref'], _("None"), false);
    } else {
        label_row(_("Host"), $_POST['host']);
        label_row(_("Database User"), $_POST['dbuser']);
        label_row(_("Database Name"), $_POST['dbname']);
        label_row(_("Table Pref"), $_POST['tbpref']);
    }
    yesno_list_row(_("Default"), 'def', null, "", "", false);
    if ($selected_id == -1) {
        coa_list_row(_("Database Script"), 'coa');
        text_row_ex(_("New script Admin Password"), 'admpassword', 20);
    }
    end_table(1);
    submit_center('save', _("Save"));
    end_form();
}
Ejemplo n.º 22
0
    }
    $invoice_no = add_supp_invoice($_SESSION['supp_trans']);
    $_SESSION['supp_trans']->clear_items();
    unset($_SESSION['supp_trans']);
    meta_forward($_SERVER['PHP_SELF'], "AddedID={$invoice_no}");
}
//--------------------------------------------------------------------------------------------------
if (isset($_POST['PostCreditNote'])) {
    handle_commit_credit_note();
}
//--------------------------------------------------------------------------------------------------
start_form(false, true);
start_table("{$table_style} width=80%", 8);
echo "<tr><td valign=center>";
// outer table
echo "<center>";
invoice_header($_SESSION['supp_trans']);
echo "</td></tr><tr><td valign=center>";
// outer table
$total_grn_value = display_grn_items($_SESSION['supp_trans']);
$total_gl_value = display_gl_items($_SESSION['supp_trans']);
echo "</td></tr><tr><td align=center colspan=2>";
// outer table
invoice_totals($_SESSION['supp_trans']);
echo "</td></tr>";
end_table(1);
// outer table
submit_center('PostCreditNote', tr("Enter Credit Note"));
echo "<br><br>";
end_form();
end_page();
Ejemplo n.º 23
0
$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();
Ejemplo n.º 24
0
}
if (isset($_POST['AddItem'])) {
    handle_new_item();
}
if (isset($_POST['UpdateItem'])) {
    handle_update_item();
}
if (isset($_POST['CancelItemChanges'])) {
    line_start_focus();
}
if (isset($_POST['go'])) {
    display_quick_entries($_SESSION['journal_items'], $_POST['person_id'], input_num('totamount'), QE_JOURNAL);
    $_POST['totamount'] = price_format(0);
    $Ajax->activate('totamount');
    line_start_focus();
}
//-----------------------------------------------------------------------------------------------
start_form();
display_order_header($_SESSION['journal_items']);
start_table(TABLESTYLE2, "width='90%'", 10);
start_row();
echo "<td>";
display_gl_items(_("Rows"), $_SESSION['journal_items']);
gl_options_controls();
echo "</td>";
end_row();
end_table(1);
submit_center('Process', _("Process Journal Entry"), true, _('Process journal entry only if debits equal to credits'), 'default');
end_form();
//------------------------------------------------------------------------------------------------
end_page();
Ejemplo n.º 25
0
function company_extensions($id)
{
    start_table(TABLESTYLE);
    $th = array(_("Extension"), _("Modules provided"), _("Options provided"), _("Active"));
    $mods = get_company_extensions();
    $exts = get_company_extensions($id);
    foreach ($mods as $key => $ins) {
        foreach ($exts as $ext) {
            if ($ext['name'] == $ins['name']) {
                $mods[$key]['active'] = @$ext['active'];
                continue 2;
            }
        }
    }
    $mods = array_natsort($mods, null, 'name');
    table_header($th);
    $k = 0;
    foreach ($mods as $i => $mod) {
        if ($mod['type'] != 'extension') {
            continue;
        }
        alt_table_row_color($k);
        label_cell($mod['name']);
        $entries = fmt_titles(@$mod['entries']);
        $tabs = fmt_titles(@$mod['tabs']);
        label_cell($tabs);
        label_cell($entries);
        check_cells(null, 'Active' . $i, @$mod['active'] ? 1 : 0, false, false, "align='center'");
        end_row();
    }
    end_table(1);
    submit_center('Refresh', _('Update'), true, false, 'default');
}
Ejemplo n.º 26
0
    if (!isset($_POST['Labour'])) {
        $_POST['Labour'] = price_format(0);
        $_POST['cr_lab_acc'] = $r[0];
    }
    amount_row($wo_cost_types[WO_LABOUR], 'Labour');
    gl_all_accounts_list_row(_("Credit Labour Account"), 'cr_lab_acc', null);
    if (!isset($_POST['Costs'])) {
        $_POST['Costs'] = price_format(0);
        $_POST['cr_acc'] = $r[0];
    }
    amount_row($wo_cost_types[WO_OVERHEAD], 'Costs');
    gl_all_accounts_list_row(_("Credit Overhead Account"), 'cr_acc', null);
}
if (get_post('released')) {
    label_row(_("Released On:"), $_POST['released_date']);
}
textarea_row(_("Memo:"), 'memo_', null, 40, 5);
end_table(1);
if (isset($selected_id)) {
    echo "<table align=center><tr>";
    submit_cells('UPDATE_ITEM', _("Update"), '', _('Save changes to work order'), 'default');
    if (get_post('released')) {
        submit_cells('close', _("Close This Work Order"), '', '', true);
    }
    submit_cells('delete', _("Delete This Work Order"), '', '', true);
    echo "</tr></table>";
} else {
    submit_center('ADD_ITEM', _("Add Workorder"), true, '', 'default');
}
end_form();
end_page();
Ejemplo n.º 27
0
    if (!isset($_POST['OrderDate'])) {
        $_POST['OrderDate'] = $_SESSION['PO']->orig_order_date;
    }
    if (!isset($_POST['Requisition'])) {
        $_POST['Requisition'] = $_SESSION['PO']->requisition_no;
    }
    if (!isset($_POST['Comments'])) {
        $_POST['Comments'] = $_SESSION['PO']->Comments;
    }
}
//---------------------------------------------------------------------------------------------------
start_form(false, true);
display_po_header($_SESSION['PO']);
echo "<br>";
display_po_items($_SESSION['PO']);
start_table($table_style2);
textarea_row(tr("Memo:"), 'Comments', null, 70, 4);
end_table(1);
if ($_SESSION['PO']->order_has_items()) {
    if ($_SESSION['PO']->order_no) {
        submit_center_first('Commit', tr("Update Order"));
    } else {
        submit_center_first('Commit', tr("Place Order"));
    }
    submit_center_last('CancelOrder', tr("Cancel Order"));
} else {
    submit_center('CancelOrder', tr("Cancel Order"));
}
//---------------------------------------------------------------------------------------------------
end_form();
end_page();
Ejemplo n.º 28
0
$result = get_loc_details($_POST['stock_id']);
if (@$_GET['popup']) {
    hidden('_tabs_sel', get_post('_tabs_sel'));
    hidden('popup', @$_GET['popup']);
}
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    if (isset($_POST['UpdateData']) && check_num($myrow["loc_code"])) {
        $myrow["reorder_level"] = input_num($myrow["loc_code"]);
        set_reorder_level($_POST['stock_id'], $myrow["loc_code"], input_num($myrow["loc_code"]));
        display_notification(_("Reorder levels has been updated."));
    }
    $qoh = get_qoh_on_date($_POST['stock_id'], $myrow["loc_code"]);
    label_cell($myrow["location_name"]);
    $_POST[$myrow["loc_code"]] = qty_format($myrow["reorder_level"], $_POST['stock_id'], $dec);
    qty_cell($qoh, false, $dec);
    qty_cells(null, $myrow["loc_code"], null, null, null, $dec);
    end_row();
    $j++;
    if ($j == 12) {
        $j = 1;
        table_header($th);
    }
}
end_table(1);
div_end();
submit_center('UpdateData', _("Update"), true, false, 'default');
if (!@$_GET['popup']) {
    end_form();
    end_page(@$_GET['popup'], false, false);
}
Ejemplo n.º 29
0
//-----------------------------------------------------------------------------------------
if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "") {
    $myrow = get_grn_item_detail($_POST['grn_item_id']);
    echo "<br>";
    display_heading2(tr("Delivery Item Selected For Adding To A Supplier Invoice"));
    start_table("{$table_style} width=80%");
    $th = array(tr("Sequence #"), tr("Item"), tr("Description"), tr("Quantity Outstanding"), tr("Quantity to Invoice"), tr("Order Price"), tr("Actual Price"));
    table_header($th);
    start_row();
    label_cell($_POST['grn_item_id']);
    label_cell($myrow['item_code']);
    label_cell($myrow['description']);
    qty_cell($myrow['QtyOstdg']);
    qty_cells(null, 'this_quantity_inv', qty_format($myrow['QtyOstdg']));
    amount_cell($myrow['unit_price']);
    small_amount_cells(null, 'ChgPrice', price_format($myrow['unit_price']));
    end_row();
    end_table(1);
    submit_center('AddGRNToTrans', tr("Add to Invoice"));
    hidden('GRNNumber', $_POST['grn_item_id']);
    hidden('item_code', $myrow['item_code']);
    hidden('item_description', $myrow['description']);
    hidden('qty_recd', $myrow['qty_recd']);
    hidden('prev_quantity_inv', $myrow['quantity_inv']);
    hidden('order_price', $myrow['unit_price']);
    hidden('std_cost_unit', $myrow['std_cost_unit']);
    hidden('po_detail_item', $myrow['po_detail_item']);
}
//----------------------------------------------------------------------------------------
end_form();
end_page();
Ejemplo n.º 30
0
//----------------
table_section(2);
table_section_title(_("Dimension Defaults"));
text_row(_("Dimension Required By After:"), 'default_dim_required', $_POST['default_dim_required'], 6, 6, '', "", _("days"));
//---------------
table_section_title(_("Suppliers and Purchasing"));
percent_row(_("Delivery Over-Receive Allowance:"), 'po_over_receive');
percent_row(_("Invoice Over-Charge Allowance:"), 'po_over_charge');
table_section_title(_("Suppliers and Purchasing Defaults"));
gl_all_accounts_list_row(_("Payable Account:"), 'creditors_act', $_POST['creditors_act']);
gl_all_accounts_list_row(_("Purchase Discount Account:"), 'pyt_discount_act', $_POST['pyt_discount_act']);
gl_all_accounts_list_row(_("GRN Clearing Account:"), 'grn_clearing_act', get_post('grn_clearing_act'), true, false, _("No postings on GRN"));
table_section_title(_("Inventory"));
check_row(_("Allow Negative Inventory:"), 'allow_negative_stock', null);
label_row(null, _("Warning:  This may cause a delay in GL postings"), "", "class='stockmankofg' colspan=2");
table_section_title(_("Items Defaults"));
gl_all_accounts_list_row(_("Sales Account:"), 'default_inv_sales_act', $_POST['default_inv_sales_act']);
gl_all_accounts_list_row(_("Inventory Account:"), 'default_inventory_act', $_POST['default_inventory_act']);
// this one is default for items and suppliers (purchase account)
gl_all_accounts_list_row(_("C.O.G.S. Account:"), 'default_cogs_act', $_POST['default_cogs_act']);
gl_all_accounts_list_row(_("Inventory Adjustments Account:"), 'default_adj_act', $_POST['default_adj_act']);
gl_all_accounts_list_row(_("Item Assembly Costs Account:"), 'default_assembly_act', $_POST['default_assembly_act']);
//----------------
table_section_title(_("Manufacturing Defaults"));
text_row(_("Work Order Required By After:"), 'default_workorder_required', $_POST['default_workorder_required'], 6, 6, '', "", _("days"));
//----------------
end_outer_table(1);
submit_center('submit', _("Update"), true, '', 'default');
end_form(2);
//-------------------------------------------------------------------------------------------------
end_page();