本文整理汇总了PHP中input_num函数的典型用法代码示例。如果您正苦于以下问题:PHP input_num函数的具体用法?PHP input_num怎么用?PHP input_num使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了input_num函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle_submit
function handle_submit(&$selected_id)
{
global $path_to_root, $Ajax, $auto_create_branch;
if (!can_process()) {
return;
}
if ($selected_id) {
update_customer($_POST['customer_id'], $_POST['CustName'], $_POST['cust_ref'], $_POST['address'], $_POST['tax_id'], $_POST['curr_code'], $_POST['dimension_id'], $_POST['dimension2_id'], $_POST['credit_status'], $_POST['payment_terms'], input_num('discount') / 100, input_num('pymt_discount') / 100, input_num('credit_limit'), $_POST['sales_type'], $_POST['notes']);
update_record_status($_POST['customer_id'], $_POST['inactive'], 'debtors_master', 'debtor_no');
$Ajax->activate('customer_id');
// in case of status change
display_notification(_("Customer has been updated."));
} else {
//it is a new customer
begin_transaction();
add_customer($_POST['CustName'], $_POST['cust_ref'], $_POST['address'], $_POST['tax_id'], $_POST['curr_code'], $_POST['dimension_id'], $_POST['dimension2_id'], $_POST['credit_status'], $_POST['payment_terms'], input_num('discount') / 100, input_num('pymt_discount') / 100, input_num('credit_limit'), $_POST['sales_type'], $_POST['notes']);
$selected_id = $_POST['customer_id'] = db_insert_id();
if (isset($auto_create_branch) && $auto_create_branch == 1) {
add_branch($selected_id, $_POST['CustName'], $_POST['cust_ref'], $_POST['address'], $_POST['salesman'], $_POST['area'], $_POST['tax_group_id'], '', get_company_pref('default_sales_discount_act'), get_company_pref('debtors_act'), get_company_pref('default_prompt_payment_act'), $_POST['location'], $_POST['address'], 0, 0, $_POST['ship_via'], $_POST['notes']);
$selected_branch = db_insert_id();
add_crm_person($_POST['CustName'], $_POST['cust_ref'], '', $_POST['address'], $_POST['phone'], $_POST['phone2'], $_POST['fax'], $_POST['email'], '', '');
add_crm_contact('cust_branch', 'general', $selected_branch, db_insert_id());
}
commit_transaction();
display_notification(_("A new customer has been added."));
if (isset($auto_create_branch) && $auto_create_branch == 1) {
display_notification(_("A default Branch has been automatically created, please check default Branch values by using link below."));
}
$Ajax->activate('_page_body');
}
}
示例2: on_submit
function on_submit($selected_parent, $selected_id = -1)
{
if (!check_num('quantity', 0)) {
display_error(_("The quantity entered must be numeric and greater than zero."));
set_focus('quantity');
return;
}
if ($selected_id != -1) {
update_bom($selected_parent, $selected_id, $_POST['workcentre_added'], $_POST['loc_code'], input_num('quantity'));
display_notification(_('Selected component has been updated'));
$Mode = 'RESET';
} else {
/*Selected component is null cos no item selected on first time round
so must be adding a record must be Submitting new entries in the new
component form */
//need to check not recursive bom component of itself!
if (!check_for_recursive_bom($selected_parent, $_POST['component'])) {
/*Now check to see that the component is not already on the bom */
if (!is_component_already_on_bom($_POST['component'], $_POST['workcentre_added'], $_POST['loc_code'], $selected_parent)) {
add_bom($selected_parent, $_POST['component'], $_POST['workcentre_added'], $_POST['loc_code'], input_num('quantity'));
display_notification(_("A new component part has been added to the bill of material for this item."));
$Mode = 'RESET';
} else {
/*The component must already be on the bom */
display_error(_("The selected component is already on this bom. You can modify it's quantity but it cannot appear more than once on the same bom."));
}
} else {
display_error(_("The selected component is a parent of the current item. Recursive BOMs are not allowed."));
}
}
}
示例3: check_data
function check_data()
{
global $check_price_charged_vs_order_price, $check_qty_charged_vs_del_qty;
if (!check_num('this_quantity_inv', 0) || input_num('this_quantity_inv') == 0) {
display_error(tr("The quantity to invoice must be numeric and greater than zero."));
set_focus('this_quantity_inv');
return false;
}
if (!check_num('ChgPrice')) {
display_error(tr("The price is not numeric."));
set_focus('ChgPrice');
return false;
}
if ($check_price_charged_vs_order_price == True) {
if ($_POST['order_price'] != input_num('ChgPrice')) {
if ($_POST['order_price'] == 0 || input_num('ChgPrice') / $_POST['order_price'] > 1 + sys_prefs::over_charge_allowance() / 100) {
display_error(tr("The price being invoiced is more than the purchase order price by more than the allowed over-charge percentage. The system is set up to prohibit this. See the system administrator to modify the set up parameters if necessary.") . tr("The over-charge percentage allowance is :") . sys_prefs::over_charge_allowance() . "%");
set_focus('ChgPrice');
return false;
}
}
}
if ($check_qty_charged_vs_del_qty == True) {
if (input_num('this_quantity_inv') / ($_POST['qty_recd'] - $_POST['prev_quantity_inv']) > 1 + sys_prefs::over_charge_allowance() / 100) {
display_error(tr("The quantity being invoiced is more than the outstanding quantity by more than the allowed over-charge percentage. The system is set up to prohibit this. See the system administrator to modify the set up parameters if necessary.") . tr("The over-charge percentage allowance is :") . sys_prefs::over_charge_allowance() . "%");
set_focus('this_quantity_inv');
return false;
}
}
return true;
}
示例4: handle_submit
function handle_submit()
{
global $selected_id;
if (!check_data()) {
return false;
}
if ($selected_id != "") {
update_exchange_rate($_POST['curr_abrev'], $_POST['date_'], input_num('BuyRate'), input_num('BuyRate'));
} else {
add_exchange_rate($_POST['curr_abrev'], $_POST['date_'], input_num('BuyRate'), input_num('BuyRate'));
}
return true;
}
示例5: can_process
function can_process()
{
if (!isset($_POST['DateBanked']) || !is_date($_POST['DateBanked'])) {
display_error(tr("The entered date is invalid. Please enter a valid date for the payment."));
set_focus('DateBanked');
return false;
} elseif (!is_date_in_fiscalyear($_POST['DateBanked'])) {
display_error(tr("The entered date is not in fiscal year."));
set_focus('DateBanked');
return false;
}
if (!references::is_valid($_POST['ref'])) {
display_error(tr("You must enter a reference."));
set_focus('ref');
return false;
}
if (!is_new_reference($_POST['ref'], 12)) {
display_error(tr("The entered reference is already in use."));
set_focus('ref');
return false;
}
if (!check_num('amount', 0)) {
display_error(tr("The entered amount is invalid or negative and cannot be processed."));
set_focus('amount');
return false;
}
if (!check_num('discount')) {
display_error(tr("The entered discount is not a valid number."));
set_focus('discount');
return false;
}
if (input_num('amount') - input_num('discount') <= 0) {
display_error(tr("The balance of the amount and discout is zero or negative. Please enter valid amounts."));
set_focus('discount');
return false;
}
return true;
}
示例6: handle_submit
function handle_submit()
{
global $path_to_root;
if (!can_process()) {
return;
}
if (!isset($_POST['New'])) {
$sql = "UPDATE debtors_master SET name=" . db_escape($_POST['CustName']) . ", \n\t\t\taddress=" . db_escape($_POST['address']) . ", \n\t\t\ttax_id=" . db_escape($_POST['tax_id']) . ", \n\t\t\tcurr_code=" . db_escape($_POST['curr_code']) . ", \n\t\t\temail=" . db_escape($_POST['email']) . ", \n\t\t\tdimension_id=" . db_escape($_POST['dimension_id']) . ", \n\t\t\tdimension2_id=" . db_escape($_POST['dimension2_id']) . ", \n credit_status=" . db_escape($_POST['credit_status']) . ", \n payment_terms=" . db_escape($_POST['payment_terms']) . ", \n discount=" . input_num('discount') / 100 . ", \n pymt_discount=" . input_num('pymt_discount') / 100 . ", \n credit_limit=" . input_num('credit_limit') . ", \n sales_type = " . db_escape($_POST['sales_type']) . " \n WHERE debtor_no = '" . $_POST['customer_id'] . "'";
db_query($sql, "The customer could not be updated");
display_notification(tr("Customer has been updated."));
clear_fields();
} else {
//it is a new customer
begin_transaction();
$sql = "INSERT INTO debtors_master (name, address, tax_id, email, dimension_id, dimension2_id, \n\t\t\tcurr_code, credit_status, payment_terms, discount, pymt_discount,credit_limit, \n\t\t\tsales_type) VALUES (" . db_escape($_POST['CustName']) . ", " . db_escape($_POST['address']) . ", " . db_escape($_POST['tax_id']) . "," . db_escape($_POST['email']) . ", " . db_escape($_POST['dimension_id']) . ", " . db_escape($_POST['dimension2_id']) . ", " . db_escape($_POST['curr_code']) . ", \n\t\t\t" . db_escape($_POST['credit_status']) . ", " . db_escape($_POST['payment_terms']) . ", " . input_num('discount') / 100 . ", \n\t\t\t" . input_num('pymt_discount') / 100 . ", " . input_num('credit_limit') . ", " . db_escape($_POST['sales_type']) . ")";
db_query($sql, "The customer could not be added");
$new_customer_id = db_insert_id();
commit_transaction();
display_notification(tr("A new customer has been added."));
hyperlink_params($path_to_root . "/sales/manage/customer_branches.php", tr("Add branches for this customer"), "debtor_no={$new_customer_id}");
clear_fields();
}
}
示例7: display_error
if (strlen($_POST['item_code']) == 0) {
$input_error = 1;
display_error(_("The item of use cannot be empty."));
set_focus('name');
}
if (strlen($_POST['estimate_price']) == 0) {
$input_error = 1;
display_error(_("The estimated price be empty."));
set_focus('rate');
}
if ($input_error != 1) {
if ($selected_id != -1) {
update_requisition_detail($selected_id, $_POST['item_code'], $_POST['purpose'], $_POST['order_quantity'], input_num('estimate_price'));
display_notification(_('Selected requisition details has been updated.'));
} else {
add_requisition_detail($_POST['requisitionid'], $_POST['item_code'], $_POST['purpose'], $_POST['order_quantity'], input_num('estimate_price'));
display_notification(_('New requisition details has been added'));
}
$Mode = 'RESET';
}
}
//-----------------------------------------------------------------------------------
if ($Mode == 'Delete') {
delete_requisition_detail($selected_id);
display_notification(_('Selected requisition detail has been deleted'));
$Mode = 'RESET';
}
if ($Mode == 'RESET') {
$selected_id = -1;
$sav = get_post('show_inactive');
$requisitionid = $_POST['requisitionid'];
示例8: handle_new_item
function handle_new_item()
{
if (!check_item_data()) {
return;
}
if (!isset($_POST['std_cost'])) {
$_POST['std_cost'] = 0;
}
add_to_order($_SESSION['transfer_items'], $_POST['stock_id'], input_num('qty'), $_POST['std_cost']);
line_start_focus();
}
示例9: can_process
function can_process()
{
global $Refs;
if (!get_post('customer_id')) {
display_error(_("There is no customer selected."));
set_focus('customer_id');
return false;
}
if (!get_post('BranchID')) {
display_error(_("This customer has no branch defined."));
set_focus('BranchID');
return false;
}
if (!isset($_POST['DateBanked']) || !is_date($_POST['DateBanked'])) {
display_error(_("The entered date is invalid. Please enter a valid date for the payment."));
set_focus('DateBanked');
return false;
} elseif (!is_date_in_fiscalyear($_POST['DateBanked'])) {
display_error(_("The entered date is not in fiscal year."));
set_focus('DateBanked');
return false;
}
if (!$Refs->is_valid($_POST['ref'])) {
display_error(_("You must enter a reference."));
set_focus('ref');
return false;
}
//Chaitanya : 13-OCT-2011 - To support Edit feature
if (isset($_POST['trans_no']) && $_POST['trans_no'] == 0 && !is_new_reference($_POST['ref'], ST_CUSTPAYMENT)) {
display_error(_("The entered reference is already in use."));
set_focus('ref');
return false;
} elseif ($_POST['ref'] != $_POST['old_ref'] && !is_new_reference($_POST['ref'], ST_CUSTPAYMENT)) {
display_error(_("The entered reference is already in use."));
set_focus('ref');
return false;
}
if (!check_num('amount', 0)) {
display_error(_("The entered amount is invalid or negative and cannot be processed."));
set_focus('amount');
return false;
}
if (isset($_POST['charge']) && !check_num('charge', 0)) {
display_error(_("The entered amount is invalid or negative and cannot be processed."));
set_focus('charge');
return false;
}
if (isset($_POST['charge']) && input_num('charge') > 0) {
$charge_acct = get_company_pref('bank_charge_act');
if (get_gl_account($charge_acct) == false) {
display_error(_("The Bank Charge Account has not been set in System and General GL Setup."));
set_focus('charge');
return false;
}
}
if (isset($_POST['_ex_rate']) && !check_num('_ex_rate', 1.0E-6)) {
display_error(_("The exchange rate must be numeric and greater than zero."));
set_focus('_ex_rate');
return false;
}
if ($_POST['discount'] == "") {
$_POST['discount'] = 0;
}
if (!check_num('discount')) {
display_error(_("The entered discount is not a valid number."));
set_focus('discount');
return false;
}
//if ((input_num('amount') - input_num('discount') <= 0)) {
if (input_num('amount') <= 0) {
display_error(_("The balance of the amount and discout is zero or negative. Please enter valid amounts."));
set_focus('discount');
return false;
}
if (!db_has_currency_rates(get_customer_currency($_POST['customer_id']), $_POST['DateBanked'], true)) {
return false;
}
$_SESSION['alloc']->amount = input_num('amount');
if (isset($_POST["TotalNumberOfAllocs"])) {
return check_allocations();
} else {
return true;
}
}
示例10: handle_add_new_item
function handle_add_new_item()
{
$allow_update = check_data();
if ($allow_update == true) {
if (count($_SESSION['PO']->line_items) > 0) {
foreach ($_SESSION['PO']->line_items as $order_item) {
/* do a loop round the items on the order to see that the item
is not already on this order */
if ($order_item->stock_id == $_POST['stock_id'] && $order_item->Deleted == False) {
$allow_update = False;
display_error(tr("The selected item is already on this order."));
}
}
/* end of the foreach loop to look for pre-existing items of the same code */
}
if ($allow_update == true) {
$sql = "SELECT description, units, mb_flag\n\t\t\t\tFROM stock_master WHERE stock_id = '" . $_POST['stock_id'] . "'";
$result = db_query($sql, "The stock details for " . $_POST['stock_id'] . " could not be retrieved");
if (db_num_rows($result) == 0) {
$allow_update = False;
}
if ($allow_update) {
$myrow = db_fetch($result);
$_SESSION['PO']->add_to_order($_POST['line_no'], $_POST['stock_id'], input_num('qty'), $myrow["description"], input_num('price'), $myrow["units"], $_POST['req_del_date'], 0, 0);
unset_form_variables();
$_POST['StockID2'] = $_POST['stock_id'] = "";
} else {
display_error(tr("The selected item does not exist or it is a kit part and therefore cannot be purchased."));
}
}
/* end of if not already on the order and allow input was true*/
}
}
示例11: handle_new_item
function handle_new_item()
{
if (!check_item_data()) {
return;
}
add_to_order($_SESSION['adj_items'], $_POST['stock_id'], input_num('qty'), input_num('std_cost'));
line_start_focus();
}
示例12: start_row
$total = $btotal = $ltotal = 0;
for ($i = 0, $date_ = $begin; date1_greater_date2($end, $date_); $i++) {
start_row();
$_POST['amount' . $i] = number_format2(get_only_budget_trans_from_to($date_, $date_, $_POST['account'], $_POST['dim1'], $_POST['dim2']), 0);
label_cell($date_);
if (!isset($_POST['amount' . $i])) {
$_POST['amount' . $i] = '0';
}
amount_cells(null, 'amount' . $i, null, 15, null, 0);
if ($showdims) {
$d = get_budget_trans_from_to($date_, $date_, $_POST['account'], $_POST['dim1'], $_POST['dim2']);
label_cell(number_format2($d, 0), "nowrap align=right");
$btotal += $d;
}
$lamount = get_gl_trans_from_to(add_years($date_, -1), add_years(end_month($date_), -1), $_POST['account'], $_POST['dim1'], $_POST['dim2']);
$total += input_num('amount' . $i);
$ltotal += $lamount;
label_cell(number_format2($lamount, 0), "nowrap align=right");
$date_ = add_months($date_, 1);
end_row();
}
start_row();
label_cell("<b>" . tr("Total") . "</b>");
label_cell("<b>" . number_format2($total, 0) . "</b>", 'align=right');
if ($showdims) {
label_cell("<b>" . number_format2($btotal, 0) . "</b>", "nowrap align=right");
}
label_cell("<b>" . number_format2($ltotal, 0) . "</b>", "nowrap align=right");
end_row();
end_table(1);
submit_center_first('add', tr("Save"));
示例13: display_error
$input_error = 1;
display_error(tr("Salesman provision cannot be less than 0 or more than 100%."));
set_focus(!$pr1 ? 'provision' : 'provision2');
}
if (!check_num('break_pt', 0)) {
$input_error = 1;
display_error(tr("Salesman provision breakpoint must be numeric and not less than 0."));
set_focus('break_pt');
}
if ($input_error != 1) {
if (isset($selected_id)) {
/*selected_id could also exist if submit had not been clicked this code would not run in this case cos submit is false of course see the delete code below*/
$sql = "UPDATE salesman SET salesman_name=" . db_escape($_POST['salesman_name']) . ",\n \t\t\tsalesman_phone=" . db_escape($_POST['salesman_phone']) . ",\n \t\t\tsalesman_fax=" . db_escape($_POST['salesman_fax']) . ",\n \t\t\tsalesman_email=" . db_escape($_POST['salesman_email']) . ",\n \t\t\tprovision=" . input_num('provision') . ",\n \t\t\tbreak_pt=" . input_num('break_pt') . ",\n \t\t\tprovision2=" . input_num('provision2') . "\n \t\t\tWHERE salesman_code = '{$selected_id}'";
} else {
/*Selected group is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new Sales-person form */
$sql = "INSERT INTO salesman (salesman_name, salesman_phone, salesman_fax, salesman_email,\n \t\t\tprovision, break_pt, provision2)\n \t\t\tVALUES (" . db_escape($_POST['salesman_name']) . ", " . db_escape($_POST['salesman_phone']) . ", " . db_escape($_POST['salesman_fax']) . ", " . db_escape($_POST['salesman_email']) . ", " . input_num('provision') . ", " . input_num('break_pt') . ", " . input_num('provision2') . ")";
}
//run the sql from either of the above possibilites
db_query($sql, "The insert or update of the salesperson failed");
meta_forward($_SERVER['PHP_SELF']);
}
}
if (isset($_GET['delete'])) {
//the link to delete a selected record was clicked instead of the submit button
// PREVENT DELETES IF DEPENDENT RECORDS IN 'debtors_master'
$sql = "SELECT COUNT(*) FROM cust_branch WHERE salesman='{$selected_id}'";
$result = db_query($sql, "check failed");
$myrow = db_fetch_row($result);
if ($myrow[0] > 0) {
display_error("Cannot delete this sales-person because branches are set up referring to this sales-person - first alter the branches concerned.");
} else {
示例14: handle_add_payment
function handle_add_payment()
{
$payment_id = write_supp_payment(0, $_POST['supplier_id'], $_POST['bank_account'], $_POST['DatePaid'], $_POST['ref'], input_num('amount'), input_num('discount'), $_POST['memo_'], input_num('charge'), input_num('bank_amount', input_num('amount')));
new_doc_date($_POST['DatePaid']);
$_SESSION['alloc']->trans_no = $payment_id;
$_SESSION['alloc']->date_ = $_POST['DatePaid'];
$_SESSION['alloc']->write();
unset($_POST['bank_account']);
unset($_POST['DatePaid']);
unset($_POST['currency']);
unset($_POST['memo_']);
unset($_POST['amount']);
unset($_POST['discount']);
unset($_POST['ProcessSuppPayment']);
meta_forward($_SERVER['PHP_SELF'], "AddedID={$payment_id}&supplier_id=" . $_POST['supplier_id']);
}
示例15: change_tpl_flag
function change_tpl_flag($reconcile_id)
{
global $Ajax;
if (!check_date() && check_value("rec_" . $reconcile_id)) {
// temporary fix
return false;
}
if (get_post('bank_date') == '') {
// new reconciliation
$Ajax->activate('bank_date');
}
$_POST['bank_date'] = date2sql(get_post('reconcile_date'));
$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;
}