Example #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();
}
function show_results()
{
    global $path_to_root;
    /*Now get the transactions  */
    div_start('trans_tbl');
    start_table(TABLESTYLE);
    $netAmounts = check_value('NetAmounts');
    if ($netAmounts) {
        $net = _("Net");
    } else {
        $net = _("Gross");
    }
    $th = array(_("Type"), _("Description"), _("Tax") . "<br>" . _("Amount"), $net . "<br>" . _("Outputs") . "/" . _("Inputs"));
    table_header($th);
    $k = 0;
    $total = 0;
    $bdate = date2sql($_POST['TransFromDate']);
    $edate = date2sql($_POST['TransToDate']);
    $taxes = get_tax_cash_summary($_POST['TransFromDate'], $_POST['TransToDate']);
    while ($tx = db_fetch($taxes)) {
        $payable = $tx['payable'];
        $collectible = $tx['collectible'];
        $net = $collectible + $payable;
        $total += $net;
        alt_table_row_color($k);
        label_cell($tx['name'] . " " . $tx['rate'] . "%");
        label_cell(_("Charged on sales") . " (" . _("Output Tax") . "):");
        amount_cell($payable);
        if ($netAmounts) {
            amount_cell($tx['net_output']);
        } else {
            amount_cell($tx['gross_output']);
        }
        end_row();
        alt_table_row_color($k);
        label_cell($tx['name'] . " " . $tx['rate'] . "%");
        label_cell(_("Paid on purchases") . " (" . _("Input Tax") . "):");
        amount_cell($collectible);
        if ($netAmounts) {
            amount_cell($tx['net_input']);
        } else {
            amount_cell($tx['gross_input']);
        }
        end_row();
        alt_table_row_color($k);
        label_cell("<b>" . $tx['name'] . " " . $tx['rate'] . "%</b>");
        label_cell("<b>" . _("Net payable or collectible") . ":</b>");
        amount_cell($net, true);
        label_cell("");
        end_row();
    }
    alt_table_row_color($k);
    label_cell("");
    label_cell("<b>" . _("Total payable or refund") . ":</b>");
    amount_cell($total, true);
    label_cell("");
    end_row();
    end_table(2);
    div_end();
}
Example #3
0
 public function show()
 {
     $list_div = array('id' => $this->name . '_div', 'class' => 'list');
     $list = array('id' => $this->name . '_list', 'class' => 'list');
     echo div_start($list_div);
     echo table($this->items, $list);
     echo div_end();
 }
Example #4
0
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"));
    table_header($th);
    /*show the line items on the order with the quantity being received for modification */
    $total = 0;
    $k = 0;
    //row colour counter
    if (count($_SESSION['PO']->line_items) > 0) {
        foreach ($_SESSION['PO']->line_items as $ln_itm) {
            alt_table_row_color($k);
            $qty_outstanding = $ln_itm->quantity - $ln_itm->qty_received;
            if (!isset($_POST['Update']) && !isset($_POST['ProcessGoodsReceived']) && $ln_itm->receive_qty == 0) {
                //If no quantites yet input default the balance to be received
                $ln_itm->receive_qty = $qty_outstanding;
            }
            $line_total = $ln_itm->receive_qty * $ln_itm->price;
            $total += $line_total;
            label_cell($ln_itm->stock_id);
            if ($qty_outstanding > 0) {
                text_cells(null, $ln_itm->stock_id . "Desc", $ln_itm->item_description, 30, 50);
            } else {
                label_cell($ln_itm->item_description);
            }
            $dec = get_qty_dec($ln_itm->stock_id);
            qty_cell($ln_itm->quantity, false, $dec);
            label_cell($ln_itm->units);
            qty_cell($ln_itm->qty_received, false, $dec);
            qty_cell($qty_outstanding, false, $dec);
            if ($qty_outstanding > 0) {
                qty_cells(null, $ln_itm->line_no, number_format2($ln_itm->receive_qty, $dec), "align=right", null, $dec);
            } else {
                label_cell(number_format2($ln_itm->receive_qty, $dec), "align=right");
            }
            amount_decimal_cell($ln_itm->price);
            amount_cell($line_total);
            end_row();
        }
    }
    $colspan = count($th) - 1;
    $display_sub_total = price_format($total);
    label_row(_("Sub-total"), $display_sub_total, "colspan={$colspan} align=right", "align=right");
    $taxes = $_SESSION['PO']->get_taxes(input_num('freight_cost'), true);
    $tax_total = display_edit_tax_items($taxes, $colspan, $_SESSION['PO']->tax_included);
    $display_total = price_format($total + input_num('freight_cost') + $tax_total);
    start_row();
    label_cells(_("Amount Total"), $display_total, "colspan={$colspan} align='right'", "align='right'");
    end_row();
    end_table();
    div_end();
}
Example #5
0
function display_extensions()
{
    global $installed_extensions;
    div_start('ext_tbl');
    start_table(TABLESTYLE);
    $th = array(_("Extension"), _("Modules provided"), _("Options provided"), _("Installed"), _("Available"), "", "");
    table_header($th);
    $k = 0;
    $mods = get_extensions_list('extension');
    foreach ($mods as $pkg_name => $ext) {
        $available = @$ext['available'];
        $installed = @$ext['version'];
        $id = @$ext['local_id'];
        $entries = fmt_titles(@$ext['entries']);
        $tabs = fmt_titles(@$ext['tabs']);
        alt_table_row_color($k);
        label_cell($available ? get_package_view_str($pkg_name, $ext['name']) : $ext['name']);
        label_cell($tabs);
        label_cell($entries);
        label_cell($id === null ? _("None") : ($available && $installed ? $installed : _("Unknown")));
        label_cell($available ? $available : _("Unknown"));
        if (!$available && $ext['type'] == 'extension') {
            // third-party plugin
            if (!$installed) {
                button_cell('Local' . $ext['package'], _("Install"), _('Install third-party extension.'), ICON_DOWN);
            } else {
                label_cell('');
            }
        } elseif (check_pkg_upgrade($installed, $available)) {
            // outdated or not installed extension in repo
            button_cell('Update' . $pkg_name, $installed ? _("Update") : _("Install"), _('Upload and install latest extension package'), ICON_DOWN);
        } else {
            label_cell('');
        }
        if ($id !== null) {
            delete_button_cell('Delete' . $id, _('Delete'));
            submit_js_confirm('Delete' . $id, sprintf(_("You are about to remove package \\'%s\\'.\nDo you want to continue ?"), $ext['name']));
        } else {
            label_cell('');
        }
        end_row();
    }
    end_table(1);
    submit_center_first('Refresh', _("Update"), '', null);
    div_end();
}
Example #6
0
function display_kit_items($selected_kit)
{
    $result = get_item_kit($selected_kit);
    div_start('bom');
    start_table(TABLESTYLE, "width='60%'");
    $th = array(_("Stock Item"), _("Description"), _("Quantity"), _("Units"), '', '');
    table_header($th);
    $k = 0;
    while ($myrow = db_fetch($result)) {
        alt_table_row_color($k);
        label_cell($myrow["stock_id"]);
        label_cell($myrow["comp_name"]);
        qty_cell($myrow["quantity"], false, $myrow["units"] == '' ? 0 : get_qty_dec($myrow["comp_name"]));
        label_cell($myrow["units"] == '' ? _('kit') : $myrow["units"]);
        edit_button_cell("Edit" . $myrow['id'], _("Edit"));
        delete_button_cell("Delete" . $myrow['id'], _("Delete"));
        end_row();
    }
    //END WHILE LIST LOOP
    end_table();
    div_end();
}
Example #7
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();
}
Example #8
0
function display_bom_items($selected_parent)
{
    $result = get_bom($selected_parent);
    div_start('bom');
    start_table(TABLESTYLE, "width=60%");
    $th = array(_("Code"), _("Description"), _("Location"), _("Work Centre"), _("Quantity"), _("Units"), '', '');
    table_header($th);
    $k = 0;
    while ($myrow = db_fetch($result)) {
        alt_table_row_color($k);
        label_cell($myrow["component"]);
        label_cell($myrow["description"]);
        label_cell($myrow["location_name"]);
        label_cell($myrow["WorkCentreDescription"]);
        qty_cell($myrow["quantity"], false, get_qty_dec($myrow["component"]));
        label_cell($myrow["units"]);
        edit_button_cell("Edit" . $myrow['id'], _("Edit"));
        delete_button_cell("Delete" . $myrow['id'], _("Delete"));
        end_row();
    }
    //END WHILE LIST LOOP
    end_table();
    div_end();
}
Example #9
0
start_table(TABLESTYLE_NOBORDER);
start_row();
locations_list_cells(_("From Location:"), 'StockLocation', null);
date_cells(_("From:"), 'AfterDate', '', null, -30);
date_cells(_("To:"), 'BeforeDate');
submit_cells('ShowMoves', _("Show Movements"), '', _('Refresh Inquiry'), 'default');
end_row();
end_table();
if (!@$_GET['popup']) {
    end_form();
}
set_global_stock_item($_POST['stock_id']);
$before_date = date2sql($_POST['BeforeDate']);
$after_date = date2sql($_POST['AfterDate']);
$result = get_stock_movements($_POST['stock_id'], $_POST['StockLocation'], $_POST['BeforeDate'], $_POST['AfterDate']);
div_start('doc_tbl');
start_table(TABLESTYLE);
$th = array(_("Type"), _("#"), _("Reference"), _("Date"), _("Detail"), _("Quantity In"), _("Quantity Out"), _("Quantity On Hand"));
table_header($th);
$before_qty = get_stock_movements_before($_POST['stock_id'], $_POST['StockLocation'], $_POST['AfterDate']);
$after_qty = $before_qty;
/*
if (!isset($before_qty_row[0]))
{
	$after_qty = $before_qty = 0;
}
*/
start_row("class='inquirybg'");
label_cell("<b>" . _("Quantity on hand before") . " " . $_POST['AfterDate'] . "</b>", "align=center colspan=5");
label_cell("&nbsp;", "colspan=2");
$dec = get_qty_dec($_POST['stock_id']);
Example #10
0
if (list_updated('inst_lang')) {
    $_SESSION['inst_set']['inst_lang'] = get_post('inst_lang');
    $Ajax->setEncoding($inst_langs[get_post('inst_lang')]['encoding']);
    $Ajax->activate('welcome');
}
start_form();
switch (@$_POST['Page']) {
    default:
        //			include ('../install.html');
        //			submit_center('continue', _('Continue >>'));
        //			break;
    //			include ('../install.html');
    //			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;
Example #11
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();
}
Example #12
0
}
if (isset($_POST['go'])) {
    $Ajax->activate('gl_items');
    display_quick_entries($_SESSION['supp_trans'], $_POST['qid'], input_num('totamount'), QE_SUPPINV);
    $_POST['totamount'] = price_format(0);
    $Ajax->activate('totamount');
    reset_tax_input();
}
start_form();
invoice_header($_SESSION['supp_trans']);
if ($_POST['supplier_id'] == '') {
    display_error(_("There is no supplier selected."));
} else {
    display_grn_items($_SESSION['supp_trans'], 1);
    display_gl_items($_SESSION['supp_trans'], 1);
    div_start('inv_tot');
    invoice_totals($_SESSION['supp_trans']);
    div_end();
}
//-----------------------------------------------------------------------------------------
if ($id != -1 || $id2 != -1) {
    $Ajax->activate('grn_items');
    $Ajax->activate('inv_tot');
}
if (get_post('AddGLCodeToTrans')) {
    $Ajax->activate('inv_tot');
}
br();
submit_center('PostInvoice', _("Enter Invoice"), true, '', 'default');
br();
end_form();
    if (!isset($_POST["beg_balance"])) {
        // new selected account/statement
        $_POST["last_date"] = sql2date($row["last_date"]);
        $_POST["beg_balance"] = price_format($row["beg_balance"]);
        $_POST["end_balance"] = price_format($row["end_balance"]);
        if (get_post('bank_date')) {
            // if it is the last updated bank statement retrieve ending balance
            $row = get_ending_reconciled($_POST['bank_account'], $_POST['bank_date']);
            if ($row) {
                $_POST["end_balance"] = price_format($row["ending_reconcile_balance"]);
            }
        }
    }
}
echo "<hr>";
div_start('summary');
start_table(TABLESTYLE);
$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();
Example #14
0
    label_cell($stock_types[$myrow["dflt_mb_flag"]]);
    label_cell($myrow["dflt_sales_act"], "align=center");
    label_cell($myrow["dflt_inventory_act"], "align=center");
    label_cell($myrow["dflt_cogs_act"], "align=center");
    label_cell($myrow["dflt_adjustment_act"], "align=center");
    label_cell($myrow["dflt_assembly_act"], "align=center");
    inactive_control_cell($myrow["category_id"], $myrow["inactive"], 'stock_category', 'category_id');
    edit_button_cell("Edit" . $myrow["category_id"], _("Edit"));
    delete_button_cell("Delete" . $myrow["category_id"], _("Delete"));
    end_row();
}
inactive_control_row($th);
end_table();
echo '<br>';
//----------------------------------------------------------------------------------
div_start('details');
start_table(TABLESTYLE2);
if ($selected_id != -1) {
    if ($Mode == 'Edit') {
        //editing an existing item category
        $myrow = get_item_category($selected_id);
        $_POST['category_id'] = $myrow["category_id"];
        $_POST['description'] = $myrow["description"];
        $_POST['tax_type_id'] = $myrow["dflt_tax_type"];
        $_POST['sales_account'] = $myrow["dflt_sales_act"];
        $_POST['cogs_account'] = $myrow["dflt_cogs_act"];
        $_POST['inventory_account'] = $myrow["dflt_inventory_act"];
        $_POST['adjustment_account'] = $myrow["dflt_adjustment_act"];
        $_POST['assembly_account'] = $myrow["dflt_assembly_act"];
        $_POST['units'] = $myrow["dflt_units"];
        $_POST['mb_flag'] = $myrow["dflt_mb_flag"];
    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'];
        $convey_allow = $existing_payslip['convey_allow'];
        $edu_other_allow = $existing_payslip['edu_other_allow'];
        $pf = $existing_payslip['pf'];
        $lop_amount = $existing_payslip['lop_amount'];
        $adv_sal = $tds = 0;
        $total_ded = $existing_payslip['total_ded'];
         } else {
             amount_cell($myrow['amount']);
         }
     }
     if ($dim >= 1) {
         label_cell(get_dimension_string($myrow['dimension_id'], true));
     }
     if ($dim > 1) {
         label_cell(get_dimension_string($myrow['dimension2_id'], true));
     }
     edit_button_cell("BEd" . $myrow["id"], _("Edit"));
     delete_button_cell("BDel" . $myrow["id"], _("Delete"));
     end_row();
 }
 end_table(1);
 div_start('edit_line');
 start_table(TABLESTYLE2);
 if ($selected_id2 != -1) {
     if ($Mode2 == 'BEd') {
         //editing an existing status code
         $myrow = get_quick_entry_line($selected_id2);
         $_POST['id'] = $myrow["id"];
         $_POST['dest_id'] = $myrow["dest_id"];
         $_POST['actn'] = $myrow["action"];
         $_POST['amount'] = $myrow["amount"];
         $_POST['dimension_id'] = $myrow["dimension_id"];
         $_POST['dimension2_id'] = $myrow["dimension2_id"];
     }
 }
 quick_actions_list_row(_("Posted") . ":", 'actn', null, true);
 if (list_updated('actn')) {
Example #17
0
$k = 0;
$unkn = 0;
foreach (get_reports() as $rep => $descr) {
    alt_table_row_color($k);
    label_cell($rep == '' ? '-' : $rep, 'align=center');
    label_cell($descr == '' ? '???<sup>1)</sup>' : _($descr));
    $_POST['Prn' . $rep] = isset($prints[$rep]) ? $prints[$rep] : '';
    echo '<td>';
    echo printers_list('Prn' . $rep, null, $rep == '' ? _('Browser support') : _('Default'));
    echo '</td>';
    if ($descr == '') {
        $unkn = 1;
    }
    end_row();
}
end_table();
if ($unkn) {
    display_note('<sup>1)</sup>&nbsp;-&nbsp;' . _("no title was found in this report definition file."), 0, 1, '');
} else {
    echo '<br>';
}
div_start('controls');
if (get_post('profile_id') == '') {
    submit_center('submit', _("Add New Profile"), true, '', 'default');
} else {
    submit_center_first('submit', _("Update Profile"), _('Update printer profile'), 'default');
    submit_center_last('delete', _("Delete Profile"), _('Delete printer profile (only if not used by any user)'), true);
}
div_end();
end_form();
end_page();
Example #18
0
function display_profit_and_loss()
{
    global $path_to_root, $sel;
    if (!isset($_POST['Dimension'])) {
        $_POST['Dimension'] = 0;
    }
    if (!isset($_POST['Dimension2'])) {
        $_POST['Dimension2'] = 0;
    }
    $dimension = $_POST['Dimension'];
    $dimension2 = $_POST['Dimension2'];
    $from = $_POST['TransFromDate'];
    $to = $_POST['TransToDate'];
    $compare = $_POST['Compare'];
    if (isset($_POST["AccGrp"]) && strlen($_POST['AccGrp']) > 0) {
        $drilldown = 1;
    } else {
        $drilldown = 0;
    }
    // Root level
    $dec = 0;
    $pdec = user_percent_dec();
    if ($compare == 0 || $compare == 2) {
        $end = $to;
        if ($compare == 2) {
            $begin = $from;
        } else {
            $begin = begin_fiscalyear();
        }
    } elseif ($compare == 1) {
        $begin = add_months($from, -12);
        $end = add_months($to, -12);
    }
    div_start('pl_tbl');
    start_table(TABLESTYLE, "width=50%");
    $tableheader = "<tr>\n        <td class='tableheader'>" . _("Group/Account Name") . "</td>\n        <td class='tableheader'>" . _("Period") . "</td>\n\t\t<td class='tableheader'>" . $sel[$compare] . "</td>\n\t\t<td class='tableheader'>" . _("Achieved %") . "</td>\n        </tr>";
    if (!$drilldown) {
        $parent = -1;
        $classper = 0.0;
        $classacc = 0.0;
        $salesper = 0.0;
        $salesacc = 0.0;
        //Get classes for PL
        $classresult = get_account_classes(false, 0);
        while ($class = db_fetch($classresult)) {
            $class_per_total = 0;
            $class_acc_total = 0;
            $convert = get_class_type_convert($class["ctype"]);
            //Print Class Name
            table_section_title($class["class_name"], 4);
            echo $tableheader;
            //Get Account groups/types under this group/type
            $typeresult = get_account_types(false, $class['cid'], -1);
            while ($accounttype = db_fetch($typeresult)) {
                $TypeTotal = display_type($accounttype["id"], $accounttype["name"], $from, $to, $begin, $end, $compare, $convert, $dec, $pdec, $rep, $dimension, $dimension2, $drilldown, $path_to_root);
                $class_per_total += $TypeTotal[0];
                $class_acc_total += $TypeTotal[1];
                if ($TypeTotal[0] != 0 || $TypeTotal[1] != 0) {
                    $url = "<a href='{$path_to_root}/gl/inquiry/profit_loss.php?TransFromDate=" . $from . "&TransToDate=" . $to . "&Compare=" . $compare . "&Dimension=" . $dimension . "&Dimension2=" . $dimension2 . "&AccGrp=" . $accounttype['id'] . "'>" . $accounttype['id'] . " " . $accounttype['name'] . "</a>";
                    alt_table_row_color($k);
                    label_cell($url);
                    amount_cell($TypeTotal[0] * $convert);
                    amount_cell($TypeTotal[1] * $convert);
                    amount_cell(Achieve($TypeTotal[0], $TypeTotal[1]));
                    end_row();
                }
            }
            //Print Class Summary
            start_row("class='inquirybg' style='font-weight:bold'");
            label_cell(_('Total') . " " . $class["class_name"]);
            amount_cell($class_per_total * $convert);
            amount_cell($class_acc_total * $convert);
            amount_cell(Achieve($class_per_total, $class_acc_total));
            end_row();
            $salesper += $class_per_total;
            $salesacc += $class_acc_total;
        }
        start_row("class='inquirybg' style='font-weight:bold'");
        label_cell(_('Calculated Return'));
        amount_cell($salesper * -1);
        amount_cell($salesacc * -1);
        amount_cell(achieve($salesper, $salesacc));
        end_row();
    } else {
        //Level Pointer : Global variable defined in order to control display of root
        global $levelptr;
        $levelptr = 0;
        $accounttype = get_account_type($_POST["AccGrp"]);
        $classid = $accounttype["class_id"];
        $class = get_account_class($classid);
        $convert = get_class_type_convert($class["ctype"]);
        //Print Class Name
        table_section_title($_POST["AccGrp"] . " " . get_account_type_name($_POST["AccGrp"]), 4);
        echo $tableheader;
        $classtotal = display_type($accounttype["id"], $accounttype["name"], $from, $to, $begin, $end, $compare, $convert, $dec, $pdec, $rep, $dimension, $dimension2, $drilldown, $path_to_root);
    }
    end_table(1);
    // outer table
    div_end();
}
Example #19
0
if (!isset($_POST['stock_id'])) {
    $_POST['stock_id'] = get_global_stock_item();
}
echo "<center>" . _("Item:") . "&nbsp;";
//Chaitanya : Manufcatured item visible
echo stock_items_list('stock_id', $_POST['stock_id'], false, true);
//echo stock_purchasable_items_list('stock_id', $_POST['stock_id'], false, true);
echo "<hr></center>";
set_global_stock_item($_POST['stock_id']);
$result = get_item_code_dflts($_POST['stock_id']);
$dec = $result['decimals'];
$units = $result['units'];
$dflt_desc = $result['description'];
$dflt_cat = $result['category_id'];
$result = get_all_item_codes($_POST['stock_id']);
div_start('code_table');
start_table(TABLESTYLE, "width=60%");
$th = array(_("EAN/UPC Code"), _("Quantity"), _("Units"), _("Description"), _("Category"), "", "");
table_header($th);
$k = $j = 0;
//row colour counter
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    label_cell($myrow["item_code"]);
    qty_cell($myrow["quantity"], $dec);
    label_cell($units);
    label_cell($myrow["description"]);
    label_cell($myrow["cat_name"]);
    edit_button_cell("Edit" . $myrow['id'], _("Edit"));
    edit_button_cell("Delete" . $myrow['id'], _("Delete"));
    end_row();
function display_credit_options()
{
    global $Ajax;
    br();
    if (isset($_POST['_CreditType_update'])) {
        $Ajax->activate('options');
    }
    div_start('options');
    start_table(TABLESTYLE2);
    credit_type_list_row(_("Credit Note Type"), 'CreditType', null, true);
    if ($_POST['CreditType'] == "Return") {
        /*if the credit note is a return of goods then need to know which location to receive them into */
        if (!isset($_POST['Location'])) {
            $_POST['Location'] = $_SESSION['Items']->Location;
        }
        locations_list_row(_("Items Returned to Location"), 'Location', $_POST['Location']);
    } else {
        /* the goods are to be written off to somewhere */
        gl_all_accounts_list_row(_("Write off the cost of the items to"), 'WriteOffGLCode', null);
    }
    textarea_row(_("Memo"), "CreditText", null, 51, 3);
    echo "</table>";
    div_end();
}
 function pager(&$pager)
 {
     global $use_popup_windows, $use_date_picker, $path_to_root;
     $pager->select_records();
     div_start("_{$pager->name}_span");
     $headers = array();
     foreach ($pager->columns as $num_col => $col) {
         // record status control column is displayed only when control checkbox is on
         if (isset($col['head']) && ($col['type'] != 'inactive' || get_post('show_inactive'))) {
             if (!isset($col['ord'])) {
                 $headers[] = $col['head'];
             } else {
                 $icon = $col['ord'] == 'desc' ? 'sort_desc.gif' : ($col['ord'] == 'asc' ? 'sort_asc.gif' : 'sort_none.gif');
                 $headers[] = navi_button($pager->name . '_sort_' . $num_col, $col['head'], true, $icon);
             }
         }
     }
     /* show a table of records returned by the sql */
     start_table(TABLESTYLE, "width={$pager->width}");
     table_header($headers);
     if ($pager->header_fun) {
         // if set header handler
         start_row("class='{$pager->header_class}'");
         $fun = $pager->header_fun;
         if (method_exists($pager, $fun)) {
             $h = $pager->{$fun}($pager);
         } elseif (function_exists($fun)) {
             $h = $fun($pager);
         }
         foreach ($h as $c) {
             // draw header columns
             $pars = isset($c[1]) ? $c[1] : '';
             label_cell($c[0], $pars);
         }
         end_row();
     }
     $cc = 0;
     // row colour counter
     foreach ($pager->data as $line_no => $row) {
         $marker = $pager->marker;
         if ($marker && $marker($row)) {
             start_row("class='{$pager->marker_class}'");
         } else {
             alt_table_row_color($cc);
         }
         foreach ($pager->columns as $k => $col) {
             $coltype = $col['type'];
             $cell = isset($col['name']) ? $row[$col['name']] : '';
             if (isset($col['fun'])) {
                 // use data input function if defined
                 $fun = $col['fun'];
                 if (method_exists($pager, $fun)) {
                     $cell = $pager->{$fun}($row, $cell);
                 } elseif (function_exists($fun)) {
                     $cell = $fun($row, $cell);
                 } else {
                     $cell = '';
                 }
             }
             switch ($coltype) {
                 // format column
                 case 'time':
                     label_cell($cell, "width=40");
                     break;
                 case 'date':
                     label_cell(sql2date($cell), "align='center' nowrap");
                     break;
                 case 'dstamp':
                     // time stamp displayed as date
                     label_cell(sql2date(substr($cell, 0, 10)), "align='center' nowrap");
                     break;
                 case 'tstamp':
                     // time stamp - FIX user format
                     label_cell(sql2date(substr($cell, 0, 10)) . ' ' . substr($cell, 10), "align='center'");
                     break;
                 case 'percent':
                     percent_cell($cell);
                     break;
                 case 'amount':
                     if ($cell == '') {
                         label_cell('');
                     } else {
                         amount_cell($cell, false);
                     }
                     break;
                 case 'qty':
                     if ($cell == '') {
                         label_cell('');
                     } else {
                         qty_cell($cell, false, isset($col['dec']) ? $col['dec'] : null);
                     }
                     break;
                 case 'email':
                     email_cell($cell, isset($col['align']) ? "align='" . $col['align'] . "'" : null);
                     break;
                 case 'rate':
                     label_cell(number_format2($cell, user_exrate_dec()), "align=center");
                     break;
                 case 'inactive':
                     if (get_post('show_inactive')) {
                         $pager->inactive_control_cell($row);
                     }
                     break;
                 default:
                     // case 'text':
                     if (isset($col['align'])) {
                         label_cell($cell, "align='" . $col['align'] . "'");
                     } else {
                         label_cell($cell);
                     }
                 case 'skip':
                     // column not displayed
             }
         }
         end_row();
     }
     // end of while loop
     if ($pager->footer_fun) {
         // if set footer handler
         start_row("class='{$pager->footer_class}'");
         $fun = $pager->footer_fun;
         if (method_exists($pager, $fun)) {
             $h = $pager->{$fun}($pager);
         } elseif (function_exists($fun)) {
             $h = $fun($pager);
         }
         foreach ($h as $c) {
             // draw footer columns
             $pars = isset($c[1]) ? $c[1] : '';
             label_cell($c[0], $pars);
         }
         end_row();
     }
     start_row("class='navibar'");
     $colspan = count($pager->columns);
     $inact = @$pager->inactive_ctrl == true ? ' ' . checkbox(null, 'show_inactive', null, true) . _("Show also Inactive") : '';
     end_row();
     end_table();
     $but_pref = $pager->name . '_page_';
     // 			if (@$pager->inactive_ctrl)
     // 				submit('Update', _('Update'), true, '', null); // inactive update
     $context = array('first' => $this->pager_button($but_pref . 'first', _('&laquo;'), $pager->first_page), 'previous' => $this->pager_button($but_pref . 'prev', _('&lsaquo;'), $pager->prev_page), 'next' => $this->pager_button($but_pref . 'next', _('&rsaquo;'), $pager->next_page), 'last' => $this->pager_button($but_pref . 'last', _('&raquo;'), $pager->last_page));
     $from = ($pager->curr_page - 1) * $pager->page_len + 1;
     $to = $from + $pager->page_len - 1;
     if ($to > $pager->rec_count) {
         $to = $pager->rec_count;
     }
     $all = $pager->rec_count;
     // 			echo sprintf(_('Records %d-%d of %d'), $from, $to, $all);
     // 			echo $inact;
     // 			echo "</td>";
     echo ThemeBootstrap::get()->renderBlock('controls.twig.html', 'pager', $context);
     /*
     		if ($pager->rec_count) {
     			echo "<td colspan=$colspan class='navibar' style='border:none;padding:3px;'>";
     			echo "<div style='float:right;'>";
     			$but_pref = $pager->name . '_page_';
     			start_table();
     			start_row();
     			if (@$pager->inactive_ctrl)
     				submit('Update', _('Update'), true, '', null); // inactive update
     			echo navi_button_cell($but_pref . 'first', _('First'), $pager->first_page, 'right');
     			echo navi_button_cell($but_pref . 'prev', _('Prev'), $pager->prev_page, 'right');
     			echo navi_button_cell($but_pref . 'next', _('Next'), $pager->next_page, 'right');
     			echo navi_button_cell($but_pref . 'last', _('Last'), $pager->last_page, 'right');
     			end_row();
     			end_table();
     			echo "</div>";
     			$from = ($pager->curr_page - 1) * $pager->page_len + 1;
     			$to = $from + $pager->page_len - 1;
     			if ($to > $pager->rec_count)
     				$to = $pager->rec_count;
     			$all = $pager->rec_count;
     			echo sprintf(_('Records %d-%d of %d'), $from, $to, $all);
     			echo $inact;
     			echo "</td>";
     		} else {
     			label_cell(_('No records') . $inact, "colspan=$colspan class='navibar'");
     		}
     */
     if (isset($pager->marker_txt)) {
         display_note($pager->marker_txt, 0, 1, "class='{$pager->notice_class}'");
     }
     div_end();
     return true;
 }
Example #22
0
function display_balance_sheet()
{
    global $path_to_root;
    $from = begin_fiscalyear();
    $to = $_POST['TransToDate'];
    if (!isset($_POST['Dimension'])) {
        $_POST['Dimension'] = 0;
    }
    if (!isset($_POST['Dimension2'])) {
        $_POST['Dimension2'] = 0;
    }
    $dimension = $_POST['Dimension'];
    $dimension2 = $_POST['Dimension2'];
    $lconvert = $econvert = 1;
    if (isset($_POST["AccGrp"]) && strlen($_POST['AccGrp']) > 0) {
        $drilldown = 1;
    } else {
        $drilldown = 0;
    }
    // Root level
    div_start('balance_tbl');
    start_table(TABLESTYLE, "width='30%'");
    if (!$drilldown) {
        $equityclose = 0.0;
        $lclose = 0.0;
        $calculateclose = 0.0;
        $parent = -1;
        //Get classes for BS
        $classresult = get_account_classes(false, 1);
        while ($class = db_fetch($classresult)) {
            $classclose = 0.0;
            $convert = get_class_type_convert($class["ctype"]);
            $ctype = $class["ctype"];
            $classname = $class["class_name"];
            //Print Class Name
            table_section_title($class["class_name"]);
            //Get Account groups/types under this group/type
            $typeresult = get_account_types(false, $class['cid'], -1);
            while ($accounttype = db_fetch($typeresult)) {
                $TypeTotal = display_type($accounttype["id"], $accounttype["name"], $from, $to, $convert, $dimension, $dimension2, $drilldown, $path_to_root);
                //Print Summary
                if ($TypeTotal != 0) {
                    $url = "<a href='{$path_to_root}/gl/inquiry/balance_sheet.php?TransFromDate=" . $from . "&TransToDate=" . $to . "&Dimension=" . $dimension . "&Dimension2=" . $dimension2 . "&AccGrp=" . $accounttype['id'] . "'>" . $accounttype['id'] . " " . $accounttype['name'] . "</a>";
                    alt_table_row_color($k);
                    label_cell($url);
                    amount_cell($TypeTotal * $convert);
                    end_row();
                }
                $classclose += $TypeTotal;
            }
            //Print Class Summary
            start_row("class='inquirybg' style='font-weight:bold'");
            label_cell(_('Total') . " " . $class["class_name"]);
            amount_cell($classclose * $convert);
            end_row();
            if ($ctype == CL_EQUITY) {
                $equityclose += $classclose;
                $econvert = $convert;
            }
            if ($ctype == CL_LIABILITIES) {
                $lclose += $classclose;
                $lconvert = $convert;
            }
            $calculateclose += $classclose;
        }
        if ($lconvert == 1) {
            $calculateclose *= -1;
        }
        //Final Report Summary
        $url = "<a href='{$path_to_root}/gl/inquiry/profit_loss.php?TransFromDate=" . $from . "&TransToDate=" . $to . "&Dimension=" . $dimension . "&Dimension2=" . $dimension2 . "&Compare=0'>" . _('Calculated Return') . "</a>";
        start_row("class='inquirybg' style='font-weight:bold'");
        label_cell($url);
        amount_cell($calculateclose);
        end_row();
        start_row("class='inquirybg' style='font-weight:bold'");
        label_cell(_('Total') . " " . _('Liabilities') . _(' and ') . _('Equities'));
        amount_cell($lclose * $lconvert + $equityclose * $econvert + $calculateclose);
        end_row();
    } else {
        //Level Pointer : Global variable defined in order to control display of root
        global $levelptr;
        $levelptr = 0;
        $accounttype = get_account_type($_POST["AccGrp"]);
        $classid = $accounttype["class_id"];
        $class = get_account_class($classid);
        $convert = get_class_type_convert($class["ctype"]);
        //Print Class Name
        table_section_title($_POST["AccGrp"] . " " . get_account_type_name($_POST["AccGrp"]));
        $classclose = display_type($accounttype["id"], $accounttype["name"], $from, $to, $convert, $dimension, $dimension2, $drilldown, $path_to_root);
    }
    end_table(1);
    // outer table
    div_end();
}
Example #23
0
//Chaitanya : 13-OCT-2011 - Is AJAX call really needed ???
//bank_accounts_list_row(_("Into Bank Account:"), 'bank_account', null, true);
bank_accounts_list_row(_("Into Bank Account:"), 'bank_account', null, false);
text_row(_("Reference:"), 'ref', null, 20, 40);
table_section(3);
date_row(_("Date of Deposit:"), 'DateBanked', '', true, 0, 0, 0, null, true);
$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');
    echo "<center>" . _("Item:") . "&nbsp;";
    //Chaitanya : All items can be purchased
    echo stock_items_list('stock_id', $_POST['stock_id'], false, true);
    //echo stock_purchasable_items_list('stock_id', $_POST['stock_id'], false, true);
    echo "<hr></center>";
} else {
    br(2);
}
set_global_stock_item($_POST['stock_id']);
$mb_flag = get_mb_flag($_POST['stock_id']);
if ($mb_flag == -1) {
    display_error(_("Entered item is not defined. Please re-enter."));
    set_focus('stock_id');
} else {
    $result = get_items_purchasing_data($_POST['stock_id']);
    div_start('price_table');
    if (db_num_rows($result) == 0) {
        display_note(_("There is no purchasing data set up for the part selected"));
    } else {
        start_table(TABLESTYLE, "width=65%");
        $th = array(_("Supplier"), _("Price"), _("Currency"), _("Supplier's Unit"), _("Conversion Factor"), _("Supplier's Description"), "", "");
        table_header($th);
        $k = $j = 0;
        //row colour counter
        while ($myrow = db_fetch($result)) {
            alt_table_row_color($k);
            label_cell($myrow["supp_name"]);
            amount_decimal_cell($myrow["price"]);
            label_cell($myrow["curr_code"]);
            label_cell($myrow["suppliers_uom"]);
            qty_cell($myrow['conversion_factor'], false, 'max');
start_row();
date_cells(_("Invoice Dead-line"), 'due_date', '', null, 0, 0, 0, "class='tableheader2'");
end_row();
end_table();
echo "</td></tr>";
end_table(1);
// outer table
$row = get_customer_to_order($_SESSION['Items']->customer_id);
if ($row['dissallow_invoices'] == 1) {
    display_error(_("The selected customer account is currently on hold. Please contact the credit control personnel to discuss."));
    end_form();
    end_page();
    exit;
}
display_heading(_("Delivery Items"));
div_start('Items');
start_table(TABLESTYLE, "width=80%");
$new = $_SESSION['Items']->trans_no == 0;
$th = array(_("Item Code"), _("Item Description"), $new ? _("Ordered") : _("Max. delivery"), _("Units"), $new ? _("Delivered") : _("Invoiced"), _("This Delivery"), _("Price"), _("Tax Type"), _("Discount"), _("Total"));
table_header($th);
$k = 0;
$has_marked = false;
foreach ($_SESSION['Items']->line_items as $line => $ln_itm) {
    if ($ln_itm->quantity == $ln_itm->qty_done) {
        continue;
        //this line is fully delivered
    }
    if (isset($_POST['_Location_update']) || isset($_POST['clear_quantity']) || isset($_POST['reset_quantity'])) {
        // reset quantity
        $ln_itm->qty_dispatched = $ln_itm->quantity - $ln_itm->qty_done;
    }
if (!isset($_POST['stock_id'])) {
    $_POST['stock_id'] = get_global_stock_item();
}
if (!@$_GET['popup']) {
    echo "<center>" . _("Item:") . "&nbsp;";
    echo stock_costable_items_list('stock_id', $_POST['stock_id'], false, true);
    echo "<hr></center>";
} else {
    br(2);
}
div_start('show_heading');
stock_item_heading($_POST['stock_id']);
br();
div_end();
set_global_stock_item($_POST['stock_id']);
div_start('reorders');
start_table(TABLESTYLE, "width=30%");
$th = array(_("Location"), _("Quantity On Hand"), _("Re-Order Level"));
table_header($th);
$j = 1;
$k = 0;
//row colour counter
$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"]);
Example #27
0
if ($id = find_submit('Delete', false)) {
    $extensions = get_company_extensions();
    if ($extensions[$id]['type'] == 'chart' && uninstall_package($extensions[$id]['package'])) {
        unset($extensions[$id]);
        if (update_extensions($extensions)) {
            display_notification(_("Selected chart has been successfully deleted"));
            meta_forward($_SERVER['PHP_SELF']);
        }
    }
}
if ($id = find_submit('Update', false)) {
    install_extension($id);
}
//---------------------------------------------------------------------------------------------
start_form(true);
div_start('ext_tbl');
start_table(TABLESTYLE);
$th = array(_("Chart"), _("Installed"), _("Available"), _("Encoding"), "", "");
table_header($th);
$k = 0;
$mods = get_charts_list();
foreach ($mods as $pkg_name => $ext) {
    $available = @$ext['available'];
    $installed = @$ext['version'];
    $id = @$ext['local_id'];
    $encoding = @$ext['encoding'];
    alt_table_row_color($k);
    //		label_cell(is_array($ext['Descr']) ? $ext['Descr'][0] : $ext['Descr']);
    label_cell($available ? get_package_view_str($pkg_name, $ext['name']) : $ext['name']);
    label_cell($id === null ? _("None") : ($available && $installed ? $installed : _("Unknown")));
    label_cell($available ? $available : _("None"));
Example #28
0
}
if (isset($_POST['CancelUpdate'])) {
    unset_form_variables();
}
if (isset($_POST['CancelUpdate']) || isset($_POST['UpdateLine'])) {
    line_start_focus();
}
//---------------------------------------------------------------------------------------------------
start_form();
display_po_header($_SESSION['PO']);
echo "<br>";
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');
Example #29
0
        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);
    }
}
//----------------------------------------------------------------------------------------------------
gl_inquiry_controls();
div_start('trans_tbl');
if (get_post('Show') || get_post('account')) {
    show_results();
}
div_end();
//----------------------------------------------------------------------------------------------------
end_page();
Example #30
0
function supplier_settings(&$supplier_id)
{
    start_outer_table(TABLESTYLE2);
    table_section(1);
    if ($supplier_id) {
        //SupplierID exists - either passed when calling the form or from the form itself
        $myrow = get_supplier($_POST['supplier_id']);
        $_POST['supp_name'] = $myrow["supp_name"];
        $_POST['supp_ref'] = $myrow["supp_ref"];
        $_POST['address'] = $myrow["address"];
        $_POST['supp_address'] = $myrow["supp_address"];
        $_POST['gst_no'] = $myrow["gst_no"];
        $_POST['website'] = $myrow["website"];
        $_POST['supp_account_no'] = $myrow["supp_account_no"];
        $_POST['bank_account'] = $myrow["bank_account"];
        $_POST['dimension_id'] = $myrow["dimension_id"];
        $_POST['dimension2_id'] = $myrow["dimension2_id"];
        $_POST['curr_code'] = $myrow["curr_code"];
        $_POST['payment_terms'] = $myrow["payment_terms"];
        $_POST['credit_limit'] = price_format($myrow["credit_limit"]);
        $_POST['tax_group_id'] = $myrow["tax_group_id"];
        $_POST['tax_included'] = $myrow["tax_included"];
        $_POST['payable_account'] = $myrow["payable_account"];
        $_POST['purchase_account'] = $myrow["purchase_account"];
        $_POST['payment_discount_account'] = $myrow["payment_discount_account"];
        $_POST['notes'] = $myrow["notes"];
        $_POST['inactive'] = $myrow["inactive"];
    } else {
        $_POST['supp_name'] = $_POST['supp_ref'] = $_POST['address'] = $_POST['supp_address'] = $_POST['tax_group_id'] = $_POST['website'] = $_POST['supp_account_no'] = $_POST['notes'] = '';
        $_POST['dimension_id'] = 0;
        $_POST['dimension2_id'] = 0;
        $_POST['tax_included'] = 0;
        $_POST['sales_type'] = -1;
        $_POST['gst_no'] = $_POST['bank_account'] = '';
        $_POST['payment_terms'] = '';
        $_POST['credit_limit'] = price_format(0);
        $company_record = get_company_prefs();
        $_POST['curr_code'] = $company_record["curr_default"];
        $_POST['payable_account'] = $company_record["creditors_act"];
        $_POST['purchase_account'] = '';
        // default/item's cogs account
        $_POST['payment_discount_account'] = $company_record['pyt_discount_act'];
    }
    table_section_title(_("Basic Data"));
    text_row(_("Supplier Name:"), 'supp_name', null, 42, 40);
    text_row(_("Supplier Short Name:"), 'supp_ref', null, 30, 30);
    text_row(_("GSTNo:"), 'gst_no', null, 42, 40);
    link_row(_("Website:"), 'website', null, 35, 55);
    if ($supplier_id && !is_new_supplier($supplier_id) && (key_in_foreign_table($_POST['supplier_id'], 'supp_trans', 'supplier_id') || key_in_foreign_table($_POST['supplier_id'], 'purch_orders', 'supplier_id'))) {
        label_row(_("Supplier's Currency:"), $_POST['curr_code']);
        hidden('curr_code', $_POST['curr_code']);
    } else {
        currencies_list_row(_("Supplier's Currency:"), 'curr_code', null);
    }
    tax_groups_list_row(_("Tax Group:"), 'tax_group_id', null);
    text_row(_("Our Customer No:"), 'supp_account_no', null, 42, 40);
    table_section_title(_("Purchasing"));
    text_row(_("Bank Name/Account:"), 'bank_account', null, 42, 40);
    amount_row(_("Credit Limit:"), 'credit_limit', null);
    payment_terms_list_row(_("Payment Terms:"), 'payment_terms', null);
    //
    // tax_included option from supplier record is used directly in update_average_cost() function,
    // therefore we can't edit the option after any transaction waas done for the supplier.
    //
    if (is_new_supplier($supplier_id)) {
        check_row(_("Prices contain tax included:"), 'tax_included');
    } else {
        hidden('tax_included');
        label_row(_("Prices contain tax included:"), $_POST['tax_included'] ? _('Yes') : _('No'));
    }
    table_section_title(_("Accounts"));
    gl_all_accounts_list_row(_("Accounts Payable Account:"), 'payable_account', $_POST['payable_account']);
    gl_all_accounts_list_row(_("Purchase Account:"), 'purchase_account', $_POST['purchase_account'], false, false, _("Use Item Inventory/COGS Account"));
    gl_all_accounts_list_row(_("Purchase Discount Account:"), 'payment_discount_account', $_POST['payment_discount_account']);
    if (!$supplier_id) {
        table_section_title(_("Contact Data"));
        text_row(_("Phone Number:"), 'phone', null, 32, 30);
        text_row(_("Secondary Phone Number:"), 'phone2', null, 32, 30);
    }
    table_section(2);
    $dim = get_company_pref('use_dimension');
    if ($dim >= 1) {
        table_section_title(_("Dimension"));
        dimensions_list_row(_("Dimension") . " 1:", 'dimension_id', null, true, " ", false, 1);
        if ($dim > 1) {
            dimensions_list_row(_("Dimension") . " 2:", 'dimension2_id', null, true, " ", false, 2);
        }
    }
    if ($dim < 1) {
        hidden('dimension_id', 0);
    }
    if ($dim < 2) {
        hidden('dimension2_id', 0);
    }
    table_section_title(_("Addresses"));
    textarea_row(_("Mailing Address:"), 'address', null, 35, 5);
    textarea_row(_("Physical Address:"), 'supp_address', null, 35, 5);
    table_section_title(_("General"));
    textarea_row(_("General Notes:"), 'notes', null, 35, 5);
    if ($supplier_id) {
        record_status_list_row(_("Supplier status:"), 'inactive');
    } else {
        table_section_title(_("Contact Data"));
        text_row(_("Contact Person:"), 'contact', null, 42, 40);
        text_row(_("Fax Number:"), 'fax', null, 32, 30);
        email_row(_("E-mail:"), 'email', null, 35, 55);
        languages_list_row(_("Document Language:"), 'rep_lang', null, _('System default'));
    }
    end_outer_table(1);
    div_start('controls');
    if ($supplier_id) {
        submit_center_first('submit', _("Update Supplier"), _('Update supplier data'), @$_REQUEST['popup'] ? true : 'default');
        submit_return('select', get_post('supplier_id'), _("Select this supplier and return to document entry."));
        submit_center_last('delete', _("Delete Supplier"), _('Delete supplier data if have been never used'), true);
    } else {
        submit_center('submit', _("Add New Supplier Details"), true, '', 'default');
    }
    div_end();
}