本文整理汇总了PHP中check_num函数的典型用法代码示例。如果您正苦于以下问题:PHP check_num函数的具体用法?PHP check_num怎么用?PHP check_num使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_num函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: on_submit
function on_submit($selected_parent, $selected_component = null)
{
if (!check_num('quantity', 0)) {
display_error(tr("The quantity entered must be numeric and greater than zero."));
set_focus('quantity');
return;
}
if (isset($selected_parent) && isset($selected_component)) {
$sql = "UPDATE bom SET workcentre_added='" . $_POST['workcentre_added'] . "',\n\t\t\tloc_code='" . $_POST['loc_code'] . "',\n\t\t\tquantity= " . input_num('quantity') . "\n\t\t\tWHERE parent='" . $selected_parent . "'\n\t\t\tAND id='" . $selected_component . "'";
check_db_error("Could not update this bom component", $sql);
db_query($sql, "could not update bom");
} elseif (!isset($selected_component) && isset($selected_parent)) {
/*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 */
$sql = "SELECT component FROM bom\n\t\t\t\tWHERE parent='{$selected_parent}'\n\t\t\t\tAND component='" . $_POST['component'] . "'\n\t\t\t\tAND workcentre_added='" . $_POST['workcentre_added'] . "'\n\t\t\t\tAND loc_code='" . $_POST['loc_code'] . "'";
$result = db_query($sql, "check failed");
if (db_num_rows($result) == 0) {
$sql = "INSERT INTO bom (parent, component, workcentre_added, loc_code, quantity)\n\t\t\t\t\tVALUES ('{$selected_parent}', '" . $_POST['component'] . "', '" . $_POST['workcentre_added'] . "', '" . $_POST['loc_code'] . "', " . input_num('quantity') . ")";
db_query($sql, "check failed");
//$msg = tr("A new component part has been added to the bill of material for this item.");
} else {
/*The component must already be on the bom */
display_error(tr("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(tr("The selected component is a parent of the current item. Recursive BOMs are not allowed."));
}
}
}
示例2: can_process
function can_process()
{
if (!check_num('po_over_receive', 0, 100)) {
display_error(_("The delivery over-receive allowance must be between 0 and 100."));
set_focus('po_over_receive');
return false;
}
if (!check_num('po_over_charge', 0, 100)) {
display_error(_("The invoice over-charge allowance must be between 0 and 100."));
set_focus('po_over_charge');
return false;
}
if (!check_num('past_due_days', 0, 100)) {
display_error(_("The past due days interval allowance must be between 0 and 100."));
set_focus('past_due_days');
return false;
}
$grn_act = get_company_pref('grn_clearing_act');
if (get_post('grn_clearing_act') != $grn_act && db_num_rows(get_grn_items(0, '', true))) {
display_error(_("Before GRN Clearing Account can be changed all GRNs have to be invoiced"));
$_POST['grn_clearing_act'] = $grn_act;
set_focus('grn_clearing_account');
return false;
}
if (!is_account_balancesheet(get_post('retained_earnings_act')) || is_account_balancesheet(get_post('profit_loss_year_act'))) {
display_error(_("The Retained Earnings Account should be a Balance Account or the Profit and Loss Year Account should be an Expense Account (preferred the last one in the Expense Class)"));
return false;
}
return true;
}
示例3: check_data
function check_data()
{
$total_allocated = 0;
for ($counter = 0; $counter < $_POST["TotalNumberOfAllocs"]; $counter++) {
if (!check_num('amount' . $counter, 0)) {
display_error(tr("The entry for one or more amounts is invalid or negative."));
set_focus('amount');
return false;
}
/*Now check to see that the AllocAmt is no greater than the
amount left to be allocated against the transaction under review */
if (input_num('amount' . $counter) > $_POST['un_allocated' . $counter]) {
//$_POST['amount' . $counter] = $_POST['un_allocated' . $counter];
}
$_SESSION['alloc']->allocs[$counter]->current_allocated = input_num('amount' . $counter);
$total_allocated += input_num('amount' . $counter);
}
if ($total_allocated + $_SESSION['alloc']->amount > sys_prefs::allocation_settled_allowance()) {
display_error(tr("These allocations cannot be processed because the amount allocated is more than the total amount left to allocate."));
//echo tr("Total allocated:") . " " . $total_allocated ;
//echo " " . tr("Total amount that can be allocated:") . " " . -$_SESSION['alloc']->TransAmt . "<BR>";
return false;
}
return true;
}
示例4: check_valid_entries
function check_valid_entries()
{
if (!is_date($_POST['DatePaid'])) {
display_error(tr("The entered date is invalid."));
set_focus('DatePaid');
return false;
}
if (!is_date_in_fiscalyear($_POST['DatePaid'])) {
display_error(tr("The entered date is not in fiscal year."));
set_focus('DatePaid');
return false;
}
if (!check_num('amount', 0)) {
display_error(tr("The entered amount is invalid or less than zero."));
set_focus('amount');
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'], systypes::bank_transfer())) {
display_error(tr("The entered reference is already in use."));
set_focus('ref');
return false;
}
if ($_POST['FromBankAccount'] == $_POST['ToBankAccount']) {
display_error(tr("The source and destination bank accouts cannot be the same."));
set_focus('ToBankAccount');
return false;
}
return true;
}
示例5: can_process
function can_process()
{
if (strlen($_POST['CustName']) == 0) {
display_error(_("The customer name cannot be empty."));
set_focus('CustName');
return false;
}
if (strlen($_POST['cust_ref']) == 0) {
display_error(_("The customer short name cannot be empty."));
set_focus('cust_ref');
return false;
}
if (!check_num('credit_limit', 0)) {
display_error(_("The credit limit must be numeric and not less than zero."));
set_focus('credit_limit');
return false;
}
if (!check_num('pymt_discount', 0, 100)) {
display_error(_("The payment discount must be numeric and is expected to be less than 100% and greater than or equal to 0."));
set_focus('pymt_discount');
return false;
}
if (!check_num('discount', 0, 100)) {
display_error(_("The discount percentage must be numeric and is expected to be less than 100% and greater than or equal to 0."));
set_focus('discount');
return false;
}
return true;
}
示例6: 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;
}
示例7: on_submit
function on_submit($selected_parent, $selected_component = -1)
{
if (!check_num('quantity', 0)) {
display_error(_("The quantity entered must be numeric and greater than zero."));
set_focus('quantity');
return;
}
if ($selected_component != -1) {
update_bom($selected_parent, $selected_component, $_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."));
}
}
}
示例8: update_component
function update_component($kit_code, $selected_item)
{
global $Mode, $Ajax, $selected_kit;
if (!check_num('quantity', 0)) {
display_error(_("The quantity entered must be numeric and greater than zero."));
set_focus('quantity');
return;
} elseif ($_POST['description'] == '') {
display_error(_("Item code description cannot be empty."));
set_focus('description');
return;
} elseif ($selected_item == -1) {
if (get_post('item_code') == '') {
// New kit/alias definition
$kit = get_item_kit($_POST['kit_code']);
if (db_num_rows($kit)) {
$input_error = 1;
display_error(_("This item code is already assigned to stock item or sale kit."));
set_focus('kit_code');
return;
}
if (get_post('kit_code') == '') {
display_error(_("Kit/alias code cannot be empty."));
set_focus('kit_code');
return;
}
}
}
if (check_item_in_kit($selected_item, $kit_code, $_POST['component'], true)) {
display_error(_("The selected component contains directly or on any lower level the kit under edition. Recursive kits are not allowed."));
set_focus('component');
return;
}
/*Now check to see that the component is not already in the kit */
if (check_item_in_kit($selected_item, $kit_code, $_POST['component'])) {
display_error(_("The selected component is already in this kit. You can modify it's quantity but it cannot appear more than once in the same kit."));
set_focus('component');
return;
}
if ($selected_item == -1) {
// new item alias/kit
if ($_POST['item_code'] == '') {
$kit_code = $_POST['kit_code'];
$selected_kit = $_POST['item_code'] = $kit_code;
$msg = _("New alias code has been created.");
} else {
$msg = _("New component has been added to selected kit.");
}
add_item_code($kit_code, get_post('component'), get_post('description'), get_post('category'), input_num('quantity'), 0);
display_notification($msg);
} else {
$props = get_kit_props($_POST['item_code']);
update_item_code($selected_item, $kit_code, get_post('component'), $props['description'], $props['category_id'], input_num('quantity'), 0);
display_notification(_("Component of selected kit has been updated."));
}
$Mode = 'RESET';
$Ajax->activate('_page_body');
}
示例9: can_process
function can_process()
{
if (strlen($_POST['name']) == 0) {
display_error(tr("The tax type name cannot be empty."));
set_focus('name');
return false;
} elseif (!check_num('rate', 0)) {
display_error(tr("The default tax rate must be numeric and not less than zero."));
set_focus('rate');
return false;
}
return true;
}
示例10: can_process
function can_process()
{
if (strlen($_POST['sales_type']) == 0) {
display_error(_("The sales type description cannot be empty."));
set_focus('sales_type');
return false;
}
if (!check_num('factor', 0)) {
display_error(_("Calculation factor must be valid positive number."));
set_focus('factor');
return false;
}
return true;
}
示例11: check_data
function check_data()
{
if (!check_num('This_QuantityCredited', 0)) {
display_error(tr("The quantity to credit must be numeric and greater than zero."));
set_focus('This_QuantityCredited');
return false;
}
if (!check_num('ChgPrice', 0)) {
display_error(tr("The price is either not numeric or negative."));
set_focus('ChgPrice');
return false;
}
return true;
}
示例12: can_process
function can_process()
{
global $wo_details;
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'], 29)) {
display_error(tr("The entered reference is already in use."));
set_focus('ref');
return false;
}
if (!check_num('quantity', 0)) {
display_error(tr("The quantity entered is not a valid number or less then zero."));
set_focus('quantity');
return false;
}
if (!is_date($_POST['date_'])) {
display_error(tr("The entered date is invalid."));
set_focus('date_');
return false;
} elseif (!is_date_in_fiscalyear($_POST['date_'])) {
display_error(tr("The entered date is not in fiscal year."));
set_focus('date_');
return false;
}
if (date_diff(sql2date($wo_details["released_date"]), $_POST['date_'], "d") > 0) {
display_error(tr("The production date cannot be before the release date of the work order."));
set_focus('date_');
return false;
}
// if unassembling we need to check the qoh
if ($_POST['ProductionType'] == 0 && !sys_prefs::allow_negative_stock()) {
$wo_details = get_work_order($_POST['selected_id']);
$qoh = get_qoh_on_date($wo_details["stock_id"], $wo_details["loc_code"], $date_);
if (-$_POST['quantity'] + $qoh < 0) {
display_error(tr("The unassembling cannot be processed because there is insufficient stock."));
set_focus('quantity');
return false;
}
}
return true;
}
示例13: can_process
function can_process()
{
if (!check_num('po_over_receive', 0, 100)) {
display_error(tr("The delivery over-receive allowance must be between 0 and 100."));
set_focus('po_over_receive');
return false;
}
if (!check_num('po_over_charge', 0, 100)) {
display_error(tr("The invoice over-charge allowance must be between 0 and 100."));
set_focus('po_over_charge');
return false;
}
if (!check_num('past_due_days', 0, 100)) {
display_error(tr("The past due days interval allowance must be between 0 and 100."));
set_focus('past_due_days');
return false;
}
return true;
}
示例14: check_data
function check_data()
{
if (!is_date($_POST['date_'])) {
display_error(tr("The entered date is invalid."));
set_focus('date_');
return false;
}
if (!check_num('BuyRate', 0)) {
display_error(tr("The exchange rate must be numeric and greater than zero."));
set_focus('BuyRate');
return false;
}
if ($_POST['BuyRate'] <= 0) {
display_error(tr("The exchange rate cannot be zero or a negative number."));
set_focus('BuyRate');
return false;
}
return true;
}
示例15: can_process
function can_process()
{
global $selected_id;
if (strlen($_POST['name']) == 0) {
display_error(_("The tax type name cannot be empty."));
set_focus('name');
return false;
} elseif (!check_num('rate', 0)) {
display_error(_("The default tax rate must be numeric and not less than zero."));
set_focus('rate');
return false;
}
if (!is_tax_gl_unique(get_post('sales_gl_code'), get_post('purchasing_gl_code'), $selected_id)) {
display_error(_("Selected GL Accounts cannot be used by another tax type."));
set_focus('sales_gl_code');
return false;
}
return true;
}