new_doc_date($_SESSION['Items']->document_date);
    }
    $invoice_no = $_SESSION['Items']->write();
    if ($invoice_no == -1) {
        display_error(_("The entered reference is already in use."));
        set_focus('ref');
    } else {
        processing_end();
        if ($newinvoice) {
            meta_forward($_SERVER['PHP_SELF'], "AddedID={$invoice_no}");
        } else {
            meta_forward($_SERVER['PHP_SELF'], "UpdatedID={$invoice_no}");
        }
    }
}
if (list_updated('payment')) {
    $order =& $_SESSION['Items'];
    $order->payment = get_post('payment');
    $order->payment_terms = get_payment_terms($order->payment);
    $order->due_date = get_invoice_duedate($order->payment, $order->document_date);
    if ($order->payment_terms['cash_sale']) {
        $_POST['Location'] = $order->Location = $order->pos['pos_location'];
        $order->location_name = $order->pos['location_name'];
    }
}
// find delivery spans for batch invoice display
$dspans = array();
$lastdn = '';
$spanlen = 1;
for ($line_no = 0; $line_no < count($_SESSION['Items']->line_items); $line_no++) {
    $line = $_SESSION['Items']->line_items[$line_no];
include_once $path_to_root . "/modules/HumanResourceManagement/includes/employee_db.inc";
$js = get_js_date_picker();
page(_($help_context = "PaySlip"), false, false, "", $js);
if (isset($_GET['selected_id'])) {
    $_POST['selected_id'] = $_GET['selected_id'];
}
if (isset($_GET['month'])) {
    $_POST['month'] = $_GET['month'];
}
if (isset($_GET['year'])) {
    $_POST['year'] = $_GET['year'];
}
$month = get_post('month', '');
$year = get_post('year', '');
$selected_id = get_post('selected_id');
if (list_updated('selected_id')) {
    $_POST['empl_id'] = $selected_id = get_post('selected_id');
    clear_data();
    $Ajax->activate('details');
}
function clear_data()
{
    unset($_POST['empl_id']);
    unset($_POST['empl_name']);
    unset($_POST['gross_salary']);
}
if (isset($_POST['submit'])) {
    if (strlen(trim($_POST['empl_name'])) == 0) {
        display_error(_("The employee name cannot be empty."));
        set_focus('empl_name');
        return false;
function voucher_details($id)
{
    div_start('voucher_table');
    br();
    if (!isset($_POST['imc']) || list_updated($_POST['imc'])) {
        $imc = get_post('imc');
        $row = get_salesman_trans($imc);
        $_POST['sales'] = $row['salesman_name'];
        $_POST['invoice_no'] = $row['customized_no'];
        $_POST['client'] = $row['br_name'];
        $_POST['provision'] = $row['provision'];
        $_POST['total'] = $row['InvoiceTotal'];
    }
    div_start('detail_table');
    start_outer_table(TABLESTYLE2);
    table_section(1);
    date_row(_("Date:"), 'date');
    text_row(_("IMC: "), 'sales');
    text_row(_("Invoice No."), 'invoice_no');
    text_row(_("Client: "), 'client');
    hidden('gross', $_POST['gross']);
    table_section(2);
    amount_row(_("Commission %: "), 'provision');
    label_row(_("Gross Commission: "), price_format($_POST['netsales']));
    label_row(_("W/Tax: "), price_format($_POST['tax']));
    label_row(_("Net Commission: "), price_format($_POST['total']));
    hidden('netsales', $_POST['netsales']);
    hidden('tax', $_POST['tax']);
    hidden('total', $_POST['total']);
    submit_row('Compute', _("Compute"), '', 'default');
    hidden('br_id', $_POST['br_id']);
    hidden('discount', $_POST['discount']);
    hidden('returns', $_POST['returns']);
    end_outer_table(1);
    div_start('controls');
    if (isset($_POST['Compute'])) {
        submit_center_first('Submit', _("Create Commission Voucher"), '', 'default');
    }
    div_end();
    br();
    start_table(TABLESTYLE, "width=90%");
    $th = array(_('IMC'), _('Invoice #'), _('Date'), _('Client'), '');
    table_header($th);
    $k = 0;
    $res = get_salesman_trans($_POST['imc'], $_POST['customNum']);
    while ($myrow = db_fetch($res)) {
        alt_table_row_color($k);
        if (checkvouchexists($myrow['customized_no']) == 0) {
            if ($myrow['Voided'] == '') {
                label_cell($myrow['salesman_name']);
                label_cell($myrow['customized_no']);
                label_cell($myrow['tran_date']);
                label_cell($myrow['br_name']);
                edit_button_cell("Edit" . $myrow['customized_no'], _("Select"));
            }
        }
        end_row();
    }
    end_table(1);
    div_end();
    div_end();
    br();
}
Example #4
0
    $_POST['memo_'] = $_POST['amount'] = $_POST['discount'] = '';
    $Ajax->activate('alloc_tbl');
}
if (db_customer_has_branches($_POST['customer_id'])) {
    customer_branches_list_row(_("Branch:"), $_POST['customer_id'], 'BranchID', null, false, true, true);
} else {
    hidden('BranchID', ANY_NUMERIC);
}
read_customer_data();
set_global_customer($_POST['customer_id']);
if (isset($_POST['HoldAccount']) && $_POST['HoldAccount'] != 0) {
    display_warning(_("This customer account is on hold."));
}
$display_discount_percent = percent_format($_POST['pymt_discount'] * 100) . "%";
table_section(2);
if (!list_updated('bank_account')) {
    $_POST['bank_account'] = get_default_customer_bank_account($_POST['customer_id']);
}
//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');
Example #5
0
    // PREVENT DELETES IF DEPENDENT RECORDS IN 'stock_master'
    if (key_in_foreign_table($selected_id, 'stock_master', 'category_id')) {
        display_error(_("Cannot delete this item category because items have been created using this item category."));
    } else {
        delete_item_category($selected_id);
        display_notification(_('Selected item category has been deleted'));
    }
    $Mode = 'RESET';
}
if ($Mode == 'RESET') {
    $selected_id = -1;
    $sav = get_post('show_inactive');
    unset($_POST);
    $_POST['show_inactive'] = $sav;
}
if (list_updated('mb_flag')) {
    $Ajax->activate('details');
}
//----------------------------------------------------------------------------------
$result = get_item_categories(check_value('show_inactive'));
start_form();
start_table(TABLESTYLE, "width=80%");
$th = array(_("Name"), _("Tax type"), _("Units"), _("Type"), _("Sales Act"), _("Inventory Account"), _("COGS Account"), _("Adjustment Account"), _("Assembly Account"), "", "");
inactive_control_column($th);
table_header($th);
$k = 0;
//row colour counter
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    label_cell($myrow["description"]);
    label_cell($myrow["tax_name"]);
Example #6
0
        set_focus('admin');
    } elseif (get_post('pass') == '') {
        display_error(_('Company admin password cannot be empty.'));
        set_focus('pass');
    } elseif (get_post('pass') != get_post('repass')) {
        display_error(_('Company admin passwords differ.'));
        unset($_POST['pass'], $_POST['repass']);
        set_focus('pass');
    } else {
        $_SESSION['inst_set'] = array_merge($_SESSION['inst_set'], array('coa' => $_POST['coa'], 'pass' => $_POST['pass'], 'name' => $_POST['name'], 'admin' => $_POST['admin']));
        if (do_install()) {
            $_POST['Page'] = 6;
        }
    }
}
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');
hidden('old_ref', $old_ref);
start_outer_table(TABLESTYLE2, "width='60%'", 5);
table_section(1);
bank_accounts_list_row(_("Into Bank Account:"), 'bank_account', null, true);
if ($new) {
    customer_list_row(_("From Customer:"), 'customer_id', null, false, true);
} else {
    label_cells(_("From Customer:"), $_SESSION['alloc']->person_name, "class='label'");
    hidden('customer_id', $_POST['customer_id']);
}
if (db_customer_has_branches($_POST['customer_id'])) {
    customer_branches_list_row(_("Branch:"), $_POST['customer_id'], 'BranchID', null, false, true, true);
} else {
    hidden('BranchID', ANY_NUMERIC);
}
if (list_updated('customer_id') || $new && list_updated('bank_account')) {
    $_SESSION['alloc']->set_person($_POST['customer_id'], PT_CUSTOMER);
    $_SESSION['alloc']->read();
    $_POST['memo_'] = $_POST['amount'] = $_POST['discount'] = '';
    $Ajax->activate('alloc_tbl');
}
read_customer_data();
set_global_customer($_POST['customer_id']);
if (isset($_POST['HoldAccount']) && $_POST['HoldAccount'] != 0) {
    display_warning(_("This customer account is on hold."));
}
$display_discount_percent = percent_format($_POST['pymt_discount'] * 100) . "%";
table_section(2);
date_row(_("Date of Deposit:"), 'DateBanked', '', true, 0, 0, 0, null, true);
ref_row(_("Reference:"), 'ref', '', null, '', ST_CUSTPAYMENT);
table_section(3);
    alt_table_row_color($k);
    $widget = $app->get_widget($myrow["widget"]);
    include_once $path_to_root . $widget->path;
    label_cell($app->apps[$myrow["app"]]);
    label_cell($widget->title);
    label_cell($myrow["description"]);
    label_cell($myrow["column_id"], "align='center'");
    label_cell($myrow["sort_no"], "align='center'");
    echo "<td align='center'><input" . ($myrow["collapsed"] == 1 ? ' checked' : '') . " type='checkbox' value='1'" . "disabled='disabled' /></td>";
    edit_button_cell("Edit" . $myrow["id"], _("Edit"));
    delete_button_cell("Delete" . $myrow["id"], _("Delete"));
    end_row();
}
end_table(1);
//-------------------------------------------------------------------------------------------------
if (list_updated('widget')) {
    $Ajax->activate('edits');
}
div_start('edits');
start_table(TABLESTYLE2);
$_POST['param'] = '';
if ($selected_id != -1) {
    if ($Mode == 'Edit') {
        //editing an existing payment widget
        $myrow = get_dashboard_widget($selected_id);
        $_POST['widget_app'] = $myrow["app"];
        $_POST['column_id'] = $myrow["column_id"];
        $_POST['sort_no'] = $myrow["sort_no"];
        $_POST['description'] = $myrow["description"];
        $_POST['widget'] = $myrow["widget"];
        $_POST['sort_no'] = $myrow["sort_no"];
Example #9
0
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    $type = term_type($myrow);
    $days = term_days($myrow);
    label_cell($myrow["terms"]);
    label_cell($pterm_types[$type]);
    label_cell($type == PTT_DAYS ? "{$days} " . _("days") : ($type == PTT_FOLLOWING ? $days : _("N/A")));
    inactive_control_cell($myrow["terms_indicator"], $myrow["inactive"], 'payment_terms', "terms_indicator");
    edit_button_cell("Edit" . $myrow["terms_indicator"], _("Edit"));
    delete_button_cell("Delete" . $myrow["terms_indicator"], _("Delete"));
    end_row();
}
inactive_control_row($th);
end_table(1);
//-------------------------------------------------------------------------------------------------
if (list_updated('type')) {
    $Ajax->activate('edits');
}
div_start('edits');
start_table(TABLESTYLE2);
$day_in_following_month = $days_before_due = 0;
if ($selected_id != -1) {
    if ($Mode == 'Edit') {
        //editing an existing payment terms
        $myrow = get_payment_terms($selected_id);
        $_POST['terms'] = $myrow["terms"];
        $_POST['DayNumber'] = term_days($myrow);
        $_POST['type'] = term_type($myrow);
    }
    hidden('selected_id', $selected_id);
}
Example #10
0
}
//------------------------------------------------------------------------------------------------------
if ($Mode == 'Delete') {
    //the link to delete a selected record was clicked
    delete_item_price($selected_id);
    display_notification(_("The selected price has been deleted."));
    $Mode = 'RESET';
}
if ($Mode == 'RESET') {
    $selected_id = -1;
}
if (list_updated('stock_id')) {
    $Ajax->activate('price_table');
    $Ajax->activate('price_details');
}
if (list_updated('stock_id') || isset($_POST['_curr_abrev_update']) || isset($_POST['_sales_type_id_update'])) {
    // after change of stock, currency or salestype selector
    // display default calculated price for new settings.
    // If we have this price already in db it is overwritten later.
    unset($_POST['price']);
    $Ajax->activate('price_details');
}
//---------------------------------------------------------------------------------------------------
$prices_list = get_prices($_POST['stock_id']);
div_start('price_table');
start_table(TABLESTYLE, "width=30%");
$th = array(_("Currency"), _("Sales Type"), _("Price"), "", "");
table_header($th);
$k = 0;
//row colour counter
$calculated = false;
Example #11
0
function viewing_controls()
{
    global $selected_id;
    start_table(TABLESTYLE_NOBORDER);
    start_row();
    systypes_list_cells(_("Type:"), 'filterType', null, true);
    if (list_updated('filterType')) {
        $selected_id = -1;
    }
    end_row();
    end_table(1);
}
Example #12
0
//--------------------------------------------------------------------------------------------------
if (get_post('delete')) {
    if (check_role_used(get_post('role'))) {
        display_error(_("This role is currently assigned to some users and cannot be deleted"));
    } else {
        delete_security_role(get_post('role'));
        display_notification(_("Security role has been sucessfully deleted."));
        unset($_POST['role']);
    }
    $Ajax->activate('_page_body');
}
if (get_post('cancel')) {
    unset($_POST['role']);
    $Ajax->activate('_page_body');
}
if (!isset($_POST['role']) || get_post('clone') || list_updated('role')) {
    $id = get_post('role');
    $clone = get_post('clone');
    unset($_POST);
    if ($id) {
        $row = get_security_role($id);
        $_POST['description'] = $row['description'];
        $_POST['name'] = $row['role'];
        //	if ($row['inactive']
        //		$_POST['inactive'] = 1;
        $_POST['inactive'] = $row['inactive'];
        $access = $row['areas'];
        $sections = $row['sections'];
    } else {
        $_POST['description'] = $_POST['name'] = '';
        unset($_POST['inactive']);
        $errors++;
        display_error(_("The SMTP username must be entered."));
    }
    if (empty($_POST['smtp_password']) && $_POST['mail_type'] == 'SMTP') {
        $errors++;
        display_error(_("The SMTP password must be entered."));
    }
    return $errors == 0;
}
//-------------------------------------------------------------------------------------------------
if (isset($_POST['submit']) && can_process()) {
    update_company_prefs(get_post(array('mail_type', 'smtp_host', 'smtp_port', 'smtp_auth', 'smtp_secure', 'smtp_username', 'smtp_password')));
    display_notification(_("The mail sending settings has been updated."));
}
/* end of if submit */
if (list_updated('mail_type')) {
    $Ajax->activate('details');
}
$prefs = get_company_prefs();
if (!isset($_POST['mail_type'])) {
    $_POST['mail_type'] = $prefs['mail_type'];
}
$_POST['smtp_host'] = $prefs['smtp_host'];
$_POST['smtp_port'] = $prefs['smtp_port'];
$_POST['smtp_secure'] = $prefs['smtp_secure'];
$_POST['smtp_username'] = $prefs['smtp_username'];
$_POST['smtp_password'] = $prefs['smtp_password'];
//-------------------------------------------------------------------------------------------------
start_form();
start_table(TABLESTYLE_NOBORDER);
start_row();
table_header($th);
$k = 0;
//row colour counter
while ($myrow = db_fetch($result)) {
    alt_table_row_color($k);
    label_cell($myrow["role"]);
    label_cell(sql2date($myrow["next_date"]));
    label_cell("<pre>" . $myrow["description"] . "</pre>");
    label_cell($frequencies[$myrow["frequency"]]);
    edit_button_cell("Edit" . $myrow["id"], _("Edit"));
    delete_button_cell("Delete" . $myrow["id"], _("Delete"));
    end_row();
}
end_table(1);
//-------------------------------------------------------------------------------------------------
if (list_updated('frequency')) {
    $Ajax->activate('edits');
}
div_start('edits');
start_table(TABLESTYLE2);
$_POST['param'] = '';
if ($selected_id != -1) {
    if ($Mode == 'Edit') {
        //editing an existing payment reminder
        $myrow = get_dashboard_reminder($selected_id);
        $_POST['role_id'] = $myrow["role_id"];
        $_POST['next_date'] = sql2date($myrow["next_date"]);
        $_POST['description'] = $myrow["description"];
        $_POST['frequency'] = $myrow["frequency"];
        $_POST['param'] = $myrow["param"];
        $data = json_decode(html_entity_decode($_POST['param']));
Example #15
0
        end_page();
        exit;
    }
}
//----------------------------------------------------------------------------------------
start_form();
start_outer_table(TABLESTYLE2, "width='60%'", 5);
table_section(1);
supplier_list_row(_("Payment To:"), 'supplier_id', null, false, true);
if (list_updated('supplier_id') || list_updated('bank_account')) {
    $_SESSION['alloc']->read();
    $_POST['memo_'] = $_POST['amount'] = '';
    $Ajax->activate('alloc_tbl');
}
set_global_supplier($_POST['supplier_id']);
if (!list_updated('bank_account') && !get_post('__ex_rate_changed')) {
    $_POST['bank_account'] = get_default_supplier_bank_account($_POST['supplier_id']);
} 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;
}
Example #16
0
function item_settings(&$stock_id)
{
    global $SysPrefs, $path_to_root, $new_item, $pic_height;
    start_outer_table(TABLESTYLE2);
    table_section(1);
    table_section_title(_("Item"));
    //------------------------------------------------------------------------------------
    if ($new_item) {
        text_row(_("Item Code/ISBN:"), 'NewStockID', null, 21, 20);
        $_POST['inactive'] = 0;
    } else {
        // Must be modifying an existing item
        if (get_post('NewStockID') != get_post('stock_id') || get_post('addupdate')) {
            // first item display
            $_POST['NewStockID'] = $_POST['stock_id'];
            $myrow = get_item($_POST['NewStockID']);
            $_POST['long_description'] = $myrow["long_description"];
            $_POST['description'] = $myrow["description"];
            $_POST['category_id'] = $myrow["category_id"];
            /*==============MOODLEARNING=============*/
            $_POST['level_id'] = $myrow["level_id"];
            /*=======================================*/
            $_POST['tax_type_id'] = $myrow["tax_type_id"];
            $_POST['units'] = $myrow["units"];
            $_POST['mb_flag'] = $myrow["mb_flag"];
            $_POST['sales_account'] = $myrow['sales_account'];
            $_POST['inventory_account'] = $myrow['inventory_account'];
            $_POST['cogs_account'] = $myrow['cogs_account'];
            $_POST['adjustment_account'] = $myrow['adjustment_account'];
            $_POST['assembly_account'] = $myrow['assembly_account'];
            $_POST['dimension_id'] = $myrow['dimension_id'];
            $_POST['dimension2_id'] = $myrow['dimension2_id'];
            $_POST['no_sale'] = $myrow['no_sale'];
            $_POST['del_image'] = 0;
            $_POST['inactive'] = $myrow["inactive"];
            $_POST['editable'] = $myrow["editable"];
        }
        label_row(_("Item Code/ISBN:"), $_POST['NewStockID']);
        hidden('NewStockID', $_POST['NewStockID']);
        set_focus('description');
    }
    /*=================MOODLEARNING====================*/
    level_list_row(_("Level:"), 'level_id', null);
    /*=================================================*/
    text_row(_("Name:"), 'description', null, 52, 200);
    textarea_row(_('Description:'), 'long_description', null, 42, 3);
    stock_categories_list_row(_("Category/Subject:"), 'category_id', null, false, $new_item);
    if ($new_item && (list_updated('category_id') || !isset($_POST['units']))) {
        $category_record = get_item_category($_POST['category_id']);
        $_POST['level_id'] = $category_record["level_id"];
        // moodlearning edit
        $_POST['subject_id'] = $category_record["level_id"];
        $_POST['tax_type_id'] = $category_record["dflt_tax_type"];
        $_POST['units'] = $category_record["dflt_units"];
        $_POST['mb_flag'] = $category_record["dflt_mb_flag"];
        $_POST['inventory_account'] = $category_record["dflt_inventory_act"];
        $_POST['cogs_account'] = $category_record["dflt_cogs_act"];
        $_POST['sales_account'] = $category_record["dflt_sales_act"];
        $_POST['adjustment_account'] = $category_record["dflt_adjustment_act"];
        $_POST['assembly_account'] = $category_record["dflt_assembly_act"];
        $_POST['dimension_id'] = $category_record["dflt_dim1"];
        $_POST['dimension2_id'] = $category_record["dflt_dim2"];
        $_POST['no_sale'] = $category_record["dflt_no_sale"];
        $_POST['editable'] = 0;
    }
    $fresh_item = !isset($_POST['NewStockID']) || $new_item || check_usage($_POST['stock_id'], false);
    item_tax_types_list_row(_("Item Tax Type:"), 'tax_type_id', null);
    stock_item_types_list_row(_("Item Type:"), 'mb_flag', null, $fresh_item);
    stock_units_list_row(_('Units of Measure:'), 'units', null, $fresh_item);
    check_row(_("Editable description:"), 'editable');
    check_row(_("Exclude from sales:"), 'no_sale');
    table_section(2);
    $dim = get_company_pref('use_dimension');
    if ($dim >= 1) {
        table_section_title(_("Dimensions"));
        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(_("GL Accounts"));
    gl_all_accounts_list_row(_("Sales Account:"), 'sales_account', $_POST['sales_account']);
    if (!is_service($_POST['mb_flag'])) {
        gl_all_accounts_list_row(_("Inventory Account:"), 'inventory_account', $_POST['inventory_account']);
        gl_all_accounts_list_row(_("C.O.G.S. Account:"), 'cogs_account', $_POST['cogs_account']);
        gl_all_accounts_list_row(_("Inventory Adjustments Account:"), 'adjustment_account', $_POST['adjustment_account']);
    } else {
        gl_all_accounts_list_row(_("C.O.G.S. Account:"), 'cogs_account', $_POST['cogs_account']);
        hidden('inventory_account', $_POST['inventory_account']);
        hidden('adjustment_account', $_POST['adjustment_account']);
    }
    if (is_manufactured($_POST['mb_flag'])) {
        gl_all_accounts_list_row(_("Item Assembly Costs Account:"), 'assembly_account', $_POST['assembly_account']);
    } else {
        hidden('assembly_account', $_POST['assembly_account']);
    }
    table_section_title(_("Other"));
    // Add image upload for New Item  - by Joe
    file_row(_("Image File (.jpg)") . ":", 'pic', 'pic');
    // Add Image upload for New Item  - by Joe
    $stock_img_link = "";
    $check_remove_image = false;
    if (isset($_POST['NewStockID']) && file_exists(company_path() . '/images/' . item_img_name($_POST['NewStockID']) . ".jpg")) {
        // 31/08/08 - rand() call is necessary here to avoid caching problems. Thanks to Peter D.
        $stock_img_link .= "<img id='item_img' alt = '[" . $_POST['NewStockID'] . ".jpg" . "]' src='" . company_path() . '/images/' . item_img_name($_POST['NewStockID']) . ".jpg?nocache=" . rand() . "'" . " height='{$pic_height}' border='0'>";
        $check_remove_image = true;
    } else {
        $stock_img_link .= _("No image");
    }
    label_row("&nbsp;", $stock_img_link);
    if ($check_remove_image) {
        check_row(_("Delete Image:"), 'del_image');
    }
    record_status_list_row(_("Item status:"), 'inactive');
    end_outer_table(1);
    div_start('controls');
    if (!isset($_POST['NewStockID']) || $new_item) {
        submit_center('addupdate', _("Insert New Item"), true, '', 'default');
    } else {
        submit_center_first('addupdate', _("Update Item"), '', @$_REQUEST['popup'] ? true : 'default');
        submit_return('select', get_post('stock_id'), _("Select this items and return to document entry."), 'default');
        submit('clone', _("Clone This Item"), true, '', true);
        submit('delete', _("Delete This Item"), true, '', true);
        submit_center_last('cancel', _("Cancel"), _("Cancel Edition"), 'cancel');
    }
    div_end();
}
    $reconcile_value = check_value("rec_" . $reconcile_id) ? "'" . $_POST['bank_date'] . "'" : 'NULL';
    update_reconciled_values($reconcile_id, $reconcile_value, $_POST['reconcile_date'], input_num('end_balance'), $_POST['bank_account']);
    $Ajax->activate('reconciled');
    $Ajax->activate('difference');
    return true;
}
if (!isset($_POST['reconcile_date'])) {
    // init page
    $_POST['reconcile_date'] = new_doc_date();
    //	$_POST['bank_date'] = date2sql(Today());
}
if (list_updated('bank_account')) {
    $Ajax->activate('bank_date');
    update_data();
}
if (list_updated('bank_date')) {
    $_POST['reconcile_date'] = get_post('bank_date') == '' ? Today() : sql2date($_POST['bank_date']);
    update_data();
}
if (get_post('_reconcile_date_changed')) {
    $_POST['bank_date'] = check_date() ? date2sql(get_post('reconcile_date')) : '';
    $Ajax->activate('bank_date');
    update_data();
}
$id = find_submit('_rec_');
if ($id != -1) {
    change_tpl_flag($id);
}
if (isset($_POST['Reconcile'])) {
    set_focus('bank_date');
    foreach ($_POST['last'] as $id => $value) {
Example #18
0
    $_SESSION['page_title'] = _($help_context = "New Sales Order Entry");
    create_cart(ST_SALESORDER, 0);
} elseif (isset($_GET['NewQuotation'])) {
    $_SESSION['page_title'] = _($help_context = "New Sales Quotation Entry");
    create_cart(ST_SALESQUOTE, 0);
} elseif (isset($_GET['NewQuoteToSalesOrder'])) {
    $_SESSION['page_title'] = _($help_context = "Sales Order Entry");
    create_cart(ST_SALESQUOTE, $_GET['NewQuoteToSalesOrder']);
}
page($_SESSION['page_title'], false, false, "", $js);
//-----------------------------------------------------------------------------
//$customer_id='4';
if (isset($_GET['branch_id'])) {
    $_POST['branch_id'] = $_GET['branch_id'];
}
if (list_updated('branch_id') || isset($_GET['branch_id'])) {
    // when branch is selected via external editor also customer can change
    $br = get_branch(get_post('branch_id'));
    $_POST['customer_id'] = $br['debtor_no'];
    $Ajax->activate('customer_id');
}
if (isset($_GET['AddedID'])) {
    $order_no = $_GET['AddedID'];
    display_notification_centered(sprintf(_("Order # %d has been entered."), $order_no));
    submenu_view(_("&View This Order"), ST_SALESORDER, $order_no);
    submenu_print(_("&Print This Order"), ST_SALESORDER, $order_no, 'prtopt');
    submenu_print(_("&Email This Order"), ST_SALESORDER, $order_no, null, 1);
    set_focus('prtopt');
    submenu_option(_("Make &Delivery Against This Order"), "/sales/customer_delivery.php?OrderNumber={$order_no}");
    submenu_option(_("Work &Order Entry"), "/manufacturing/work_order_entry.php?");
    submenu_option(_("Enter a &New Order"), "/sales/sales_order_entry.php?NewOrder=0");
    $help_context = 'Modifying Sales Quotation';
    $_SESSION['page_title'] = sprintf(_("Modifying Sales Quotation # %d"), $_GET['ModifyQuotationNumber']);
    create_cart(ST_SALESQUOTE, $_GET['ModifyQuotationNumber']);
} elseif (isset($_GET['NewOrder'])) {
    $_SESSION['page_title'] = _($help_context = "New Sales Order Entry");
    create_cart(ST_SALESORDER, 0);
} elseif (isset($_GET['NewQuotation'])) {
    $_SESSION['page_title'] = _($help_context = "New Sales Quotation Entry");
    create_cart(ST_SALESQUOTE, 0);
} elseif (isset($_GET['NewQuoteToSalesOrder'])) {
    $_SESSION['page_title'] = _($help_context = "Sales Order Entry");
    create_cart(ST_SALESQUOTE, $_GET['NewQuoteToSalesOrder']);
}
page($_SESSION['page_title'], false, false, "", $js);
//-----------------------------------------------------------------------------
if (list_updated('branch_id')) {
    // when branch is selected via external editor also customer can change
    $br = get_branch(get_post('branch_id'));
    $_POST['customer_id'] = $br['debtor_no'];
    $Ajax->activate('customer_id');
}
if (isset($_GET['AddedID'])) {
    $order_no = $_GET['AddedID'];
    display_notification_centered(sprintf(_("Order # %d has been entered."), $order_no));
    submenu_view(_("&View This Order"), ST_SALESORDER, $order_no);
    submenu_print(_("&Print This Order"), ST_SALESORDER, $order_no, 'prtopt');
    submenu_print(_("&Email This Order"), ST_SALESORDER, $order_no, null, 1);
    set_focus('prtopt');
    submenu_option(_("Make &Delivery Against This Order"), "/sales/customer_delivery.php?OrderNumber={$order_no}");
    submenu_option(_("Work &Order Entry"), "/manufacturing/work_order_entry.php?");
    submenu_option(_("Enter a &New Order"), "/sales/sales_order_entry.php?NewOrder=0");
Example #20
0
    $myrow = get_item_code($selected_id);
    $_POST['component'] = $myrow["stock_id"];
    $_POST['quantity'] = number_format2($myrow["quantity"], get_qty_dec($myrow["stock_id"]));
}
hidden("selected_id", $selected_id);
sales_local_items_list_row(_("Component:"), 'component', null, false, true);
//	if (get_post('description') == '')
//		$_POST['description'] = get_kit_name($_POST['component']);
if (get_post('item_code') == '') {
    // new kit/alias
    if ($Mode != 'ADD_ITEM' && $Mode != 'UPDATE_ITEM') {
        $_POST['description'] = $props['description'];
        $_POST['category'] = $props['category_id'];
    }
    text_row(_("Description:"), 'description', null, 50, 200);
    stock_categories_list_row(_("Category:"), 'category', null);
}
$res = get_item_edit_info(get_post('component'));
$dec = $res["decimals"] == '' ? 0 : $res["decimals"];
$units = $res["units"] == '' ? _('kits') : $res["units"];
if (list_updated('component')) {
    $_POST['quantity'] = number_format2(1, $dec);
    $Ajax->activate('quantity');
    $Ajax->activate('category');
}
qty_row(_("Quantity:"), 'quantity', number_format2(1, $dec), '', $units, $dec);
end_table(1);
submit_add_or_update_center($selected_id == -1, '', 'both');
end_form();
//----------------------------------------------------------------------------------
end_page();
Example #21
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();
}
 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')) {
     $Ajax->activate('edit_line');
 }
 $actn = strtolower(substr($_POST['actn'], 0, 1));
 if ($actn == 't') {
     //item_tax_types_list_row(_("Item Tax Type").":",'dest_id', null);
     tax_types_list_row(_("Tax Type") . ":", 'dest_id', null);
 } else {
     gl_all_accounts_list_row(_("Account") . ":", 'dest_id', null, $_POST['type'] == QE_DEPOSIT || $_POST['type'] == QE_PAYMENT);
     if ($actn != '=') {
         if ($actn == '%') {
             small_amount_row(_("Part") . ":", 'amount', price_format(0), null, "%", user_exrate_dec());
         } else {
             amount_row(_("Amount") . ":", 'amount', price_format(0));
         }
     }
Example #23
0
    } else {
        display_notification(_('Current active extensions set has been saved.'));
    }
}
if ($id = find_submit('Update', false)) {
    install_extension($id);
}
if ($id = find_submit('Local', false)) {
    local_extension($id);
}
if ($Mode == 'RESET') {
    $selected_id = -1;
    unset($_POST);
}
//---------------------------------------------------------------------------------------------
start_form(true);
if (list_updated('extset')) {
    $Ajax->activate('_page_body');
}
$set = get_post('extset', -1);
echo "<center>" . _('Extensions:') . "&nbsp;&nbsp;";
echo extset_list('extset', null, true);
echo "</center><br>";
if ($set == -1) {
    display_extensions();
} else {
    company_extensions($set);
}
//---------------------------------------------------------------------------------------------
end_form();
end_page();
// ----------------------------------------------------------------
$page_security = 'SA_OPEN';
$path_to_root = "../..";
include_once $path_to_root . "/includes/session.inc";
include_once $path_to_root . "/includes/ui.inc";
include_once $path_to_root . "/modules/HumanResourceManagement/includes/employee_db.inc";
page(_($help_context = "Pay History"), false, false);
if (isset($_GET['month'])) {
    $_POST['month'] = $_GET['month'];
}
if (isset($_GET['year'])) {
    $_POST['year'] = $_GET['year'];
}
$month = get_post('month', '');
$year = get_post('year', '');
if (list_updated('month')) {
    $month = get_post('month');
    $Ajax->activate('details');
}
start_form();
if (db_has_payslip()) {
    start_table(TABLESTYLE_NOBORDER);
    start_row();
    hrm_year_list(_("Year:"), 'year', null);
    hrm_months_list(_("Month:"), 'month', null, true);
    end_row();
    end_table();
    if (get_post('_show_inactive_update')) {
        $Ajax->activate('month');
        $Ajax->activate('details');
        set_focus('month');
Example #25
0
        if (isset($_GET['ModifyPayment'])) {
            $_SESSION['page_title'] = _($help_context = "Modify Bank Account Entry") . " #" . $_GET['trans_no'];
            create_cart(ST_BANKPAYMENT, $_GET['trans_no']);
        } else {
            if (isset($_GET['ModifyDeposit'])) {
                $_SESSION['page_title'] = _($help_context = "Modify Bank Deposit Entry") . " #" . $_GET['trans_no'];
                create_cart(ST_BANKDEPOSIT, $_GET['trans_no']);
            }
        }
    }
}
page($_SESSION['page_title'], false, false, '', $js);
//-----------------------------------------------------------------------------------------------
check_db_has_bank_accounts(_("There are no bank accounts defined in the system."));
//----------------------------------------------------------------------------------------
if (list_updated('PersonDetailID')) {
    $br = get_branch(get_post('PersonDetailID'));
    $_POST['person_id'] = $br['debtor_no'];
    $Ajax->activate('person_id');
}
//--------------------------------------------------------------------------------------------------
function line_start_focus()
{
    global $Ajax;
    $Ajax->activate('items_table');
    $Ajax->activate('footer');
    set_focus('_code_id_edit');
}
//-----------------------------------------------------------------------------------------------
if (isset($_GET['AddedID'])) {
    $trans_no = $_GET['AddedID'];
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();
}
Example #27
0
    delete_bom($selected_id);
    display_notification(_("The component item has been deleted from this bom"));
    $Mode = 'RESET';
}
if ($Mode == 'RESET') {
    $selected_id = -1;
    unset($_POST['quantity']);
}
//--------------------------------------------------------------------------------------------------
start_form();
start_form(false, true);
start_table(TABLESTYLE_NOBORDER);
start_row();
stock_manufactured_items_list_cells(_("Select a manufacturable item:"), 'stock_id', null, false, true);
end_row();
if (list_updated('stock_id')) {
    $Ajax->activate('_page_body');
}
end_table();
br();
end_form();
//--------------------------------------------------------------------------------------------------
if (get_post('stock_id') != '') {
    //Parent Item selected so display bom or edit component
    $selected_parent = $_POST['stock_id'];
    if ($Mode == 'ADD_ITEM' || $Mode == 'UPDATE_ITEM') {
        on_submit($selected_parent, $selected_id);
    }
    //--------------------------------------------------------------------------------------
    start_form();
    display_bom_items($selected_parent);
     }
     $trans = get_customer_habit($_POST['person_id']);
     // take care of customers on hold
     if ($trans['dissallow_invoices'] != 0) {
         if ($payment) {
             $customer_error = true;
             display_error(_("This customer account is on hold."));
         } else {
             display_warning(_("This customer account is on hold."));
         }
     }
     break;
 case PT_QUICKENTRY:
     quick_entries_list_row(_("Type") . ":", 'person_id', null, $payment ? QE_PAYMENT : QE_DEPOSIT, true);
     $qid = get_quick_entry(get_post('person_id'));
     if (list_updated('person_id')) {
         unset($_POST['totamount']);
         // enable default
         $Ajax->activate('footer');
         $Ajax->activate('totamount');
     }
     amount_row($qid['base_desc'] . ":", 'totamount', price_format($qid['base_amount']), null, "&nbsp;&nbsp;" . submit('go', _("Go"), false, false, true));
     break;
 case PT_EMPLOYEE:
     employee_list_row(_("Employee:"), 'person_id', null, false, true, false, true);
     break;
 case PT_IMC:
     //text_row("Sample", '');
     sales_persons_list_row(_("IMC:"), 'person_id', null, false, true, false, true);
     break;
 case PT_AUTHOR: