Example #1
0
//----------------
table_section(2);
table_section_title(_("Dimension Defaults"));
text_row(_("Dimension Required By After:"), 'default_dim_required', $_POST['default_dim_required'], 6, 6, '', "", _("days"));
//---------------
table_section_title(_("Suppliers and Purchasing"));
percent_row(_("Delivery Over-Receive Allowance:"), 'po_over_receive');
percent_row(_("Invoice Over-Charge Allowance:"), 'po_over_charge');
table_section_title(_("Suppliers and Purchasing Defaults"));
gl_all_accounts_list_row(_("Payable Account:"), 'creditors_act', $_POST['creditors_act']);
gl_all_accounts_list_row(_("Purchase Discount Account:"), 'pyt_discount_act', $_POST['pyt_discount_act']);
gl_all_accounts_list_row(_("GRN Clearing Account:"), 'grn_clearing_act', get_post('grn_clearing_act'), true, false, _("No postings on GRN"));
table_section_title(_("Inventory"));
check_row(_("Allow Negative Inventory:"), 'allow_negative_stock', null);
label_row(null, _("Warning:  This may cause a delay in GL postings"), "", "class='stockmankofg' colspan=2");
table_section_title(_("Items Defaults"));
gl_all_accounts_list_row(_("Sales Account:"), 'default_inv_sales_act', $_POST['default_inv_sales_act']);
gl_all_accounts_list_row(_("Inventory Account:"), 'default_inventory_act', $_POST['default_inventory_act']);
// this one is default for items and suppliers (purchase account)
gl_all_accounts_list_row(_("C.O.G.S. Account:"), 'default_cogs_act', $_POST['default_cogs_act']);
gl_all_accounts_list_row(_("Inventory Adjustments Account:"), 'default_adj_act', $_POST['default_adj_act']);
gl_all_accounts_list_row(_("Item Assembly Costs Account:"), 'default_assembly_act', $_POST['default_assembly_act']);
//----------------
table_section_title(_("Manufacturing Defaults"));
text_row(_("Work Order Required By After:"), 'default_workorder_required', $_POST['default_workorder_required'], 6, 6, '', "", _("days"));
//----------------
end_outer_table(1);
submit_center('submit', _("Update"), true, '', 'default');
end_form(2);
//-------------------------------------------------------------------------------------------------
end_page();
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();
}
Example #3
0
    hidden('RequDate', '');
    $sql = "SELECT DISTINCT account_code FROM " . TB_PREF . "bank_accounts";
    $rs = db_query($sql, "could not get bank accounts");
    $r = db_fetch_row($rs);
    if (!isset($_POST['Labour'])) {
        $_POST['Labour'] = price_format(0);
        $_POST['cr_lab_acc'] = $r[0];
    }
    amount_row($wo_cost_types[WO_LABOUR], 'Labour');
    gl_all_accounts_list_row(_("Credit Labour Account"), 'cr_lab_acc', null);
    if (!isset($_POST['Costs'])) {
        $_POST['Costs'] = price_format(0);
        $_POST['cr_acc'] = $r[0];
    }
    amount_row($wo_cost_types[WO_OVERHEAD], 'Costs');
    gl_all_accounts_list_row(_("Credit Overhead Account"), 'cr_acc', null);
}
if (get_post('released')) {
    label_row(_("Released On:"), $_POST['released_date']);
}
textarea_row(_("Memo:"), 'memo_', null, 40, 5);
end_table(1);
if (isset($selected_id)) {
    echo "<table align=center><tr>";
    submit_cells('UPDATE_ITEM', _("Update"), '', _('Save changes to work order'), 'default');
    if (get_post('released')) {
        submit_cells('close', _("Close This Work Order"), '', '', true);
    }
    submit_cells('delete', _("Delete This Work Order"), '', '', true);
    echo "</tr></table>";
} else {
Example #4
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();
}
Example #5
0
 if (!isset($_POST['sales_account']) || $_POST['sales_account'] == "") {
     $_POST['sales_account'] = $company_record["default_sales_act"];
 }
 if (!isset($_POST['sales_discount_account']) || $_POST['sales_discount_account'] == "") {
     $_POST['sales_discount_account'] = $company_record["default_sales_discount_act"];
 }
 if (!isset($_POST['receivables_account']) || $_POST['receivables_account'] == "") {
     $_POST['receivables_account'] = $company_record["debtors_act"];
 }
 if (!isset($_POST['payment_discount_account']) || $_POST['payment_discount_account'] == "") {
     $_POST['payment_discount_account'] = $company_record["default_prompt_payment_act"];
 }
 gl_all_accounts_list_row("Sales Account:", 'sales_account', $_POST['sales_account']);
 gl_all_accounts_list_row("Sales Discount Account:", 'sales_discount_account', $_POST['sales_discount_account']);
 gl_all_accounts_list_row("Receivables Account:", 'receivables_account', $_POST['receivables_account']);
 gl_all_accounts_list_row("Payment Discount Account:", 'payment_discount_account', $_POST['payment_discount_account']);
 table_section_title("Location, Tax Type, Sales Type, Sales Person and Payment Terms");
 locations_list_row("Location:", 'default_location', 'DEF');
 tax_groups_list_row(_("Default Tax Group:"), 'tax_group_id', $default_TaxGroup);
 sales_types_list_row("Sales Type:", 'sales_type', null);
 sales_persons_list_row("Sales Person:", 'salesman', null);
 sales_areas_list_row("Sales Area:", 'area');
 currencies_list_row("Customer Currency:", 'currency', $default_Currency);
 payment_terms_list_row("Payment Terms:", 'payment_terms', null);
 text_row("Starting Zen Cart Customer ID:", 'min_cid', $min_cid, 10, 10);
 text_row("Ending Zen Cart Customer ID:", 'max_cid', $max_cid, 10, 10);
 end_table(1);
 hidden('action', 'c_import');
 submit_center('cimport', "Import Zen Cart Customers");
 end_form();
 end_page();
Example #6
0
item_tax_types_list_row(_("Item Tax Type:"), 'tax_type_id', null);
stock_item_types_list_row(_("Item Type:"), 'mb_flag', null, true);
stock_units_list_row(_("Units of Measure:"), 'units', null);
check_row(_("Exclude from sales:"), 'no_sale');
gl_all_accounts_list_row(_("Sales Account:"), 'sales_account', $_POST['sales_account']);
if (is_service($_POST['mb_flag'])) {
    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']);
} else {
    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']);
}
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']);
}
$dim = get_company_pref('use_dimension');
if ($dim >= 1) {
    dimensions_list_row(_("Dimension") . " 1", 'dim1', null, true, " ", false, 1);
    if ($dim > 1) {
        dimensions_list_row(_("Dimension") . " 2", 'dim2', null, true, " ", false, 2);
    }
}
if ($dim < 1) {
    hidden('dim1', 0);
}
if ($dim < 2) {
    hidden('dim2', 0);
Example #7
0
}
inactive_control_row($th);
end_table(1);
//-----------------------------------------------------------------------------------
start_table(TABLESTYLE2);
if ($selected_id != -1) {
    if ($Mode == 'Edit') {
        //editing an existing status code
        $myrow = get_asset_type($selected_id);
        $_POST['name'] = $myrow["asset_type_name"];
        $_POST['rate'] = $myrow["depreciation_rate"];
        $_POST['asset_account'] = $myrow["asset_account"];
        $_POST['depreciation_account'] = $myrow["depreciation_account"];
        $_POST['accumulated_account'] = $myrow["accumulated_account"];
        $_POST['valuation_account'] = $myrow["valuation_account"];
        $_POST['disposal_account'] = $myrow["disposal_account"];
    }
    hidden('selected_id', $selected_id);
}
text_row(_("Asset Type:"), 'name', null, 50, 50);
percent_row(_("Depreciation Rate:"), 'rate', null, 50, 50);
gl_all_accounts_list_row(_("Asset Account:"), 'asset_account');
gl_all_accounts_list_row(_("Depreciation Account:"), 'depreciation_account');
gl_all_accounts_list_row(_("Accumulated Depreciation:"), 'accumulated_account');
gl_all_accounts_list_row(_("Asset Revaluation Account:"), 'valuation_account');
gl_all_accounts_list_row(_("Disposal Account:"), 'disposal_account');
end_table(1);
submit_add_or_update_center($selected_id == -1, '', 'both');
end_form();
//------------------------------------------------------------------------------------
end_page();
Example #8
0
    label_cell($label, "class='label'");
    echo "<td>\n";
    $freq = array('1' => _("Weekly"), '2' => _("Bi-weekly"), '3' => _("Monthly"), '4' => _("Quarterly"));
    echo array_selector($name, $selected, $freq);
    echo "</td>\n";
    echo "</tr\n";
}
$dim = get_company_pref('use_dimension');
start_form(false, false, "", "accrual");
start_table(TABLESTYLE2);
date_row(_("Date"), 'date_', _('First date of Accruals'), true, 0, 0, 0, null, true);
start_row();
label_cell(_("Accrued Balance Account"), "class='label'");
gl_all_accounts_list_cells(null, 'acc_act', null, true, false, false, true);
end_row();
gl_all_accounts_list_row(_("Revenue / Cost Account"), 'res_act', null, true);
if ($dim >= 1) {
    dimensions_list_row(_("Dimension"), 'dimension_id', null, true, " ", false, 1);
}
if ($dim > 1) {
    dimensions_list_row(_("Dimension") . " 2", 'dimension2_id', null, true, " ", false, 2);
}
$url = "gl/view/accrual_trans.php?act=" . get_post('acc_act') . "&date=" . get_post('date_');
amount_row(_("Amount"), 'amount', null, null, viewer_link(_("Search Amount"), $url, "", "", ICON_VIEW));
frequency_list_row(_("Frequency"), 'freq', null);
text_row(_("Periods"), 'periods', null, 3, 3);
textarea_row(_("Memo"), 'memo_', null, 35, 3);
end_table(1);
submit_center_first('show', _("Show GL Rows"));
//,true,false,'process',ICON_SUBMIT);
submit_center_last('go', _("Process Accruals"));
Example #9
0
    }
    hidden('selected_id', $selected_id);
    hidden('account_code');
    hidden('account_type');
    hidden('BankAccountCurrency', $_POST['BankAccountCurrency']);
    set_focus('bank_account_name');
}
text_row(_("Bank Account Name:"), 'bank_account_name', null, 50, 100);
if ($is_used) {
    label_row(_("Account Type:"), $bank_account_types[$_POST['account_type']]);
} else {
    bank_account_types_list_row(_("Account Type:"), 'account_type', null);
}
if ($is_used) {
    label_row(_("Bank Account Currency:"), $_POST['BankAccountCurrency']);
} else {
    currencies_list_row(_("Bank Account Currency:"), 'BankAccountCurrency', null);
}
yesno_list_row(_("Default currency account:"), 'dflt_curr_act');
if ($is_used) {
    label_row(_("Bank Account GL Code:"), $_POST['account_code']);
} else {
    gl_all_accounts_list_row(_("Bank Account GL Code:"), 'account_code', null);
}
text_row(_("Bank Name:"), 'bank_name', null, 50, 60);
text_row(_("Bank Account Number:"), 'bank_account_number', null, 30, 60);
textarea_row(_("Bank Address:"), 'bank_address', null, 40, 5);
end_table(1);
submit_add_or_update_center($selected_id == -1, '', 'both');
end_form();
end_page();
function display_credit_options()
{
    global $table_style2;
    echo "<br>";
    start_table($table_style2);
    echo "<tr><td>" . tr("Credit Note Type") . "</td>";
    echo "<td><select name='CreditType' onchange='this.form.submit();'>";
    if (!isset($_POST['CreditType']) || $_POST['CreditType'] == "Return") {
        echo "<option value='WriteOff'>" . tr("Items Written Off") . "</option>";
        echo "<option selected value='Return'>" . tr("Items Returned to Inventory Location") . "</option>";
    } else {
        echo "<option selected value='WriteOff'>" . tr("Items Written Off") . "</option>";
        echo "<option value='Return'>" . tr("Items Returned to Inventory Location") . "</option>";
    }
    echo "</select>";
    echo "</td></tr>";
    if (!isset($_POST['CreditType']) || $_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(tr("Items Returned to Inventory Location"), 'Location', $_POST['Location']);
    } else {
        /* the goods are to be written off to somewhere */
        gl_all_accounts_list_row(tr("Write Off the Cost of the Items to"), 'WriteOffGLCode', $_POST['WriteOffGLCode']);
    }
    textarea_row(tr("Memo"), "CreditText", null, 45, 3);
    end_table();
}
Example #11
0
check_row(_("Use Paypal Transaction Id:"), 'use_paypal_trn_id', null);
check_row(_("Receipts Date Today:"), 'paypal_recpt_today', null);
table_section_title(_("PayPal File"));
text_row_ex(_("Company Name Column:"), 'paypal_name_col', 25, 55);
table_section_title(_("Customers"));
sales_types_list_row("Sales Type:", 'paypal_sales_type_id', null);
sales_persons_list_row(_("Sales Person:"), 'paypal_salesman', null);
sales_areas_list_row(_("Sales Area:"), 'paypal_area', null);
credit_status_list_row(_("Credit Status:"), 'paypal_credit_status', null);
locations_list_row(_("Default Location:"), 'paypal_location', null);
shippers_list_row(_("Default Shipper:"), 'paypal_shipper', null);
table_section(2);
table_section_title(_("Accounts"));
bank_accounts_list_row(_("Bank Account:"), 'paypal_bank_id', $_POST['paypal_bank_id'], false);
gl_all_accounts_list_row(_("Sales Account:"), 'paypal_sales_act', $_POST['paypal_sales_act']);
gl_all_accounts_list_row(_("Sales Tax Account:"), 'paypal_sales_tax_act', $_POST['paypal_sales_tax_act']);
gl_all_accounts_list_row(_("Shipping Account:"), 'paypal_shipping_act', $_POST['paypal_shipping_act']);
gl_all_accounts_list_row(_("Fee Account:"), 'paypal_fee_act', $_POST['paypal_fee_act']);
gl_all_accounts_list_row(_("Insurance Account:"), 'paypal_insurance_act', $_POST['paypal_insurance_act']);
bank_accounts_list_row(_("Withdrawal Account:"), 'paypal_withdraw_id', $_POST['paypal_withdraw_id'], false);
table_section_title(_("Tax"));
check_row(_("Add Tax to Receipts:"), 'paypal_add_tax', null);
check_row(_("Tax Included in Paypal Amount:"), 'paypal_tax_included', null);
tax_types_list_row("Default Tax Type:", 'paypal_tax_type_id', null);
tax_groups_list_row("Default Tax Group:", 'paypal_tax_group_id', null);
item_tax_types_list_row("Default Item Tax Group:", 'paypal_item_tax_id', null);
end_outer_table(1);
submit_center('submit', _("Update"), true, '', 'default');
end_form();
//-------------------------------------------------------------------------------------------------
end_page();
Example #12
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();
}
Example #13
0
if ($is_editing) {
    $myrow = get_bank_account($selected_id);
    $_POST['account_code'] = $myrow["account_code"];
    $_POST['account_type'] = $myrow["account_type"];
    $_POST['bank_name'] = $myrow["bank_name"];
    $_POST['bank_account_name'] = $myrow["bank_account_name"];
    $_POST['bank_account_number'] = $myrow["bank_account_number"];
    $_POST['bank_address'] = $myrow["bank_address"];
    $_POST['BankAccountCurrency'] = $myrow["bank_curr_code"];
    $_POST['bank_iban'] = $myrow["bank_iban"];
    hidden('selected_id', $selected_id);
    hidden('account_code', $_POST['account_code']);
    hidden('BankAccountCurrency', $_POST['BankAccountCurrency']);
    label_row(tr("Bank Account GL Code:"), $_POST['account_code']);
} else {
    gl_all_accounts_list_row(tr("Bank Account GL Code:"), 'account_code', null, true);
}
bank_account_types_list_row(tr("Account Type:"), 'account_type', null);
text_row(tr("Bank Name:"), 'bank_name', null, 50, 50);
text_row(tr("Bank Account Name:"), 'bank_account_name', null, 50, 50);
text_row(tr("Bank Account Number:"), 'bank_account_number', null, 30, 30);
text_row(tr("IBAN:"), 'bank_iban', null, 60, 60);
if ($is_editing) {
    label_row(tr("Bank Account Currency:"), $_POST['BankAccountCurrency']);
} else {
    currencies_list_row(tr("Bank Account Currency:"), 'BankAccountCurrency', null);
}
textarea_row(tr("Bank Address:"), 'bank_address', null, 40, 5);
//text_row(tr("Bank Address:"), 'bank_address', null, 70, 70);
end_table(1);
submit_add_or_update_center(!isset($selected_id));
Example #14
0
display_gl_items($_SESSION['supp_trans'], 1);
echo "<br>";
if ($_SESSION['supp_trans']->is_invoice == true) {
    hyperlink_no_params("{$path_to_root}/purchasing/supplier_invoice.php", tr("Back to Invoice Entry"));
} else {
    hyperlink_no_params("{$path_to_root}/purchasing/supplier_credit.php", tr("Back to Credit Note Entry"));
}
echo "<hr>";
//------------------------------------------------------------------------------------------------
/*Set up a form to allow input of new GL entries */
start_form(false, true);
display_heading2(tr("Enter a GL Line"));
start_table($table_style2);
$accs = get_supplier_accounts($_SESSION['supp_trans']->supplier_id);
$_POST['AcctSelection'] = $accs['purchase_account'];
gl_all_accounts_list_row(tr("GL Account Selection:"), 'AcctSelection', $_POST['AcctSelection']);
$dim = get_company_pref('use_dimension');
if ($dim >= 1) {
    dimensions_list_row(tr("Dimension") . " 1", 'dimension_id', null, true, " ", false, 1);
}
if ($dim > 1) {
    dimensions_list_row(tr("Dimension") . " 2", 'dimension2_id', null, true, " ", false, 2);
}
if ($dim < 1) {
    hidden('dimension_id', 0);
}
if ($dim < 2) {
    hidden('dimension2_id', 0);
}
amount_row(tr("Amount:"), 'amount');
textarea_row(tr("Memo:"), "memo_", null, 40, 2);
Example #15
0
textarea_row(tr("Address:"), 'address', null, 35, 5);
text_row(tr("Email:"), 'email', null, 42, 40);
text_row(tr("Bank Account:"), 'bank_account', null, 42, 40);
// Sherifoz 23.09.03 currency can't be changed if editing
if (isset($_POST['supplier_id']) && !isset($_POST['New'])) {
    label_row(tr("Supplier's Currency:"), $_POST['curr_code']);
    hidden('curr_code', $_POST['curr_code']);
} else {
    currencies_list_row(tr("Supplier's Currency:"), 'curr_code', null);
}
tax_groups_list_row(tr("Tax Group:"), 'tax_group_id', null);
payment_terms_list_row(tr("Payment Terms:"), 'payment_terms', null);
table_section_title(tr("Accounts"));
gl_all_accounts_list_row(tr("Accounts Payable Account:"), 'payable_account', $_POST['payable_account']);
gl_all_accounts_list_row(tr("Purchase Account:"), 'purchase_account', $_POST['purchase_account']);
gl_all_accounts_list_row(tr("Purchase Discount Account:"), 'payment_discount_account', $_POST['payment_discount_account']);
$dim = get_company_pref('use_dimension');
if ($dim >= 1) {
    table_section_title(tr("Dimension"));
    dimensions_list_row(tr("Dimension") . " 1:", 'dimension_id', null, true, " ", false, 1);
    if ($dim > 1) {
        dimensions_list_row(tr("Dimension") . " 2:", 'dimension2_id', null, true, " ", false, 2);
    }
}
if ($dim < 1) {
    hidden('dimension_id', 0);
}
if ($dim < 2) {
    hidden('dimension2_id', 0);
}
end_table(1);
         $_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));
         }
     }
 }
 if ($dim >= 1) {
     dimensions_list_row(_("Dimension") . ":", 'dimension_id', null, true, " ", false, 1);
 }
 if ($dim > 1) {
     dimensions_list_row(_("Dimension") . " 2:", 'dimension2_id', null, true, " ", false, 2);
 }
 end_table(1);
Example #17
0
sales_persons_list_row(tr("Sales Person:"), 'salesman', null);
sales_areas_list_row(tr("Sales Area:"), 'area', null);
locations_list_row(tr("Default Inventory Location:"), 'default_location', null);
shippers_list_row(tr("Default Shipping Company:"), 'default_ship_via', null);
tax_groups_list_row(tr("Tax Group:"), 'tax_group_id', null, 31, 30);
language_list_row(tr("Language"), 'lang_code', null, 31, 30);
yesno_list_row(tr("Disable this Branch:"), 'disable_trans', null);
echo "</table>";
echo "</td><td  class='tableseparator'>";
// outer table
echo "<table>";
table_section_title(tr("GL Accounts"));
gl_all_accounts_list_row(tr("Sales Account:"), 'sales_account', $_POST['sales_account']);
gl_all_accounts_list_row(tr("Sales Discount Account:"), 'sales_discount_account', $_POST['sales_discount_account']);
gl_all_accounts_list_row(tr("Accounts Receivable Account:"), 'receivables_account', $_POST['receivables_account']);
gl_all_accounts_list_row(tr("Prompt Payment Discount Account:"), 'payment_discount_account', $_POST['payment_discount_account']);
table_section_title(tr("Addresses"));
textarea_row(tr("Mailing Address:"), 'br_post_address', $_POST['br_post_address'], 35, 5);
textarea_row(tr("Billing Address:"), 'br_address', $_POST['br_address'], 35, 5);
end_table();
end_table(1);
// outer table
submit_add_or_update_center(isset($_POST['New']));
end_form();
end_page();
function check_branches()
{
    $cust = $_POST['customer_id'];
    $branch = $_POST['branch_code'];
    if ($cust != "" && $branch != "") {
        $sql = "SELECT branch_code from cust_branch WHERE debtor_no={$cust} AND " . "branch_code={$branch} ORDER BY branch_code ASC";
Example #18
0
    label_cell($myrow["name"]);
    label_cell(percent_format($myrow["rate"]), "align=right");
    label_cell($myrow["sales_gl_code"] . "&nbsp;" . $myrow["SalesAccountName"]);
    label_cell($myrow["purchasing_gl_code"] . "&nbsp;" . $myrow["PurchasingAccountName"]);
    edit_link_cell("selected_id=" . $myrow["id"]);
    delete_link_cell("selected_id=" . $myrow["id"] . "&delete=1");
    end_row();
}
end_table();
//-----------------------------------------------------------------------------------
hyperlink_no_params($_SERVER['PHP_SELF'], tr("New Tax Type"));
//-----------------------------------------------------------------------------------
start_form();
start_table($table_style2);
if (isset($selected_id)) {
    //editing an existing status code
    $myrow = get_tax_type($selected_id);
    $_POST['name'] = $myrow["name"];
    $_POST['rate'] = percent_format($myrow["rate"]);
    $_POST['sales_gl_code'] = $myrow["sales_gl_code"];
    $_POST['purchasing_gl_code'] = $myrow["purchasing_gl_code"];
    hidden('selected_id', $selected_id);
}
text_row_ex(tr("Description:"), 'name', 50);
small_amount_row(tr("Default Rate:"), 'rate', '', "", "%", user_percent_dec());
gl_all_accounts_list_row(tr("Sales GL Account:"), 'sales_gl_code', null);
gl_all_accounts_list_row(tr("Purchasing GL Account:"), 'purchasing_gl_code', null);
end_table(1);
submit_add_or_update_center(!isset($selected_id));
end_form();
end_page();
Example #19
0
    }
    commit_transaction();
    if (isset($_POST['add'])) {
        display_notification_centered(tr("The Budget has been saved."));
    } else {
        display_notification_centered(tr("The Budget has been deleted."));
    }
    //meta_forward($_SERVER['PHP_SELF']);
}
//-------------------------------------------------------------------------------------
start_form();
if (db_has_gl_accounts()) {
    $dim = get_company_pref('use_dimension');
    start_table($table_style2);
    fiscalyears_list_row(tr("Fiscal Year:"), 'fyear', null);
    gl_all_accounts_list_row(tr("Account Code:"), 'account', null);
    if (!isset($_POST['dim1'])) {
        $_POST['dim1'] = 0;
    }
    if (!isset($_POST['dim2'])) {
        $_POST['dim2'] = 0;
    }
    if ($dim == 2) {
        dimensions_list_row(tr("Dimension") . " 1", 'dim1', $_POST['dim1'], true, null, false, 1);
        dimensions_list_row(tr("Dimension") . " 2", 'dim2', $_POST['dim2'], true, null, false, 2);
    } else {
        if ($dim == 1) {
            dimensions_list_row(tr("Dimension"), 'dim1', $_POST['dim1'], true, null, false, 1);
            hidden('dim2', 0);
        } else {
            hidden('dim1', 0);
Example #20
0
function branch_settings($selected_id)
{
    global $Mode, $num_branches;
    start_outer_table(TABLESTYLE2);
    table_section(1);
    $_POST['email'] = "";
    if ($selected_id != -1) {
        if ($Mode == 'Edit' || !isset($_POST['br_name'])) {
            //editing an existing branch
            $myrow = get_cust_branch($_POST['customer_id'], $_POST['branch_code']);
            set_focus('br_name');
            $_POST['branch_code'] = $myrow["branch_code"];
            $_POST['br_name'] = $myrow["br_name"];
            $_POST['br_ref'] = $myrow["branch_ref"];
            $_POST['br_address'] = $myrow["br_address"];
            $_POST['br_post_address'] = $myrow["br_post_address"];
            //		    $_POST['contact_name'] = $myrow["contact_name"];
            $_POST['salesman'] = $myrow["salesman"];
            $_POST['area'] = $myrow["area"];
            //		    $_POST['rep_lang'] =$myrow["rep_lang"];
            //		    $_POST['phone'] =$myrow["phone"];
            //		    $_POST['phone2'] =$myrow["phone2"];
            //		    $_POST['fax'] =$myrow["fax"];
            //		    $_POST['email'] =$myrow["email"];
            $_POST['tax_group_id'] = $myrow["tax_group_id"];
            $_POST['disable_trans'] = $myrow['disable_trans'];
            $_POST['default_location'] = $myrow["default_location"];
            $_POST['default_ship_via'] = $myrow['default_ship_via'];
            $_POST['sales_account'] = $myrow["sales_account"];
            $_POST['sales_discount_account'] = $myrow['sales_discount_account'];
            $_POST['receivables_account'] = $myrow['receivables_account'];
            $_POST['payment_discount_account'] = $myrow['payment_discount_account'];
            $_POST['group_no'] = $myrow["group_no"];
            $_POST['notes'] = $myrow["notes"];
        }
    } elseif ($Mode != 'ADD_ITEM') {
        //end of if $SelectedBranch only do the else when a new record is being entered
        $myrow = get_default_info_for_branch($_POST['customer_id']);
        //		$_POST['rep_lang'] = $myrow['rep_lang'];
        if (!$num_branches) {
            $_POST['br_name'] = $myrow["name"];
            $_POST['br_ref'] = $myrow["debtor_ref"];
            $_POST['contact_name'] = _('Main Branch');
            $_POST['br_address'] = $_POST['br_post_address'] = $myrow["address"];
        }
        $_POST['branch_code'] = "";
        if (!isset($_POST['sales_account']) || !isset($_POST['sales_discount_account'])) {
            $company_record = get_company_prefs();
            // We use the Item Sales Account as default!
            // $_POST['sales_account'] = $company_record["default_sales_act"];
            $_POST['sales_account'] = $_POST['notes'] = '';
            $_POST['sales_discount_account'] = $company_record['default_sales_discount_act'];
            $_POST['receivables_account'] = $company_record['debtors_act'];
            $_POST['payment_discount_account'] = $company_record['default_prompt_payment_act'];
        }
    }
    hidden('popup', @$_REQUEST['popup']);
    table_section_title(_("Name and Contact"));
    text_row(_("Branch Name:"), 'br_name', null, 35, 40);
    text_row(_("Branch Short Name:"), 'br_ref', null, 30, 30);
    table_section_title(_("Sales"));
    sales_persons_list_row(_("Sales Person:"), 'salesman', null);
    sales_areas_list_row(_("Sales Area:"), 'area', null);
    sales_groups_list_row(_("Sales Group:"), 'group_no', null, true);
    locations_list_row(_("Default Inventory Location:"), 'default_location', null);
    shippers_list_row(_("Default Shipping Company:"), 'default_ship_via', null);
    tax_groups_list_row(_("Tax Group:"), 'tax_group_id', null);
    table_section_title(_("GL Accounts"));
    // 2006-06-14. Changed gl_al_accounts_list to have an optional all_option 'Use Item Sales Accounts'
    gl_all_accounts_list_row(_("Sales Account:"), 'sales_account', null, false, false, true);
    gl_all_accounts_list_row(_("Sales Discount Account:"), 'sales_discount_account');
    gl_all_accounts_list_row(_("Accounts Receivable Account:"), 'receivables_account', null, true);
    gl_all_accounts_list_row(_("Prompt Payment Discount Account:"), 'payment_discount_account');
    table_section(2);
    if ($selected_id == -1) {
        table_section_title(_("General contact data"));
        text_row(_("Contact Person:"), 'contact_name', null, 35, 40);
        text_row(_("Phone Number:"), '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);
        languages_list_row(_("Document Language:"), 'rep_lang', null, _("Customer default"));
    }
    table_section_title(_("Addresses"));
    textarea_row(_("Mailing Address:"), 'br_post_address', null, 35, 4);
    textarea_row(_("Billing Address:"), 'br_address', null, 35, 4);
    textarea_row(_("General Notes:"), 'notes', null, 35, 4);
    if ($selected_id != -1) {
        yesno_list_row(_("Disable this Branch:"), 'disable_trans', null);
    }
    end_outer_table(1);
    submit_add_or_update_center($selected_id == -1, '', 'both');
}