set_focus('ToBankAccount');
return false;
}
+
+ if (!db_has_currency_rates(get_bank_account_currency($_POST['FromBankAccount']), $_POST['DatePaid']))
+ return false;
+
+ if (!db_has_currency_rates(get_bank_account_currency($_POST['ToBankAccount']), $_POST['DatePaid']))
+ return false;
return true;
}
set_focus('person_id');
$input_error = 1;
}
+ if (!db_has_currency_rates(get_bank_account_currency($_POST['bank_account']), $_POST['date_'], true))
+ $input_error = 1;
if ($input_error == 1)
unset($_POST['Process']);
}
}
+function db_has_currency_rates($currency, $date_, $msg=false)
+{
+ $date = date2sql($date_);
+
+ if (is_company_currency($currency))
+ return 1;
+ $ret = check_empty_result("SELECT COUNT(*) FROM ".TB_PREF."exchange_rates WHERE curr_code = '$currency' && date_ <= '$date'");
+ if ($ret == 0 && $msg)
+ display_error(sprintf(_("Cannot retrieve exchange rate for currency %s as of %s. Please add exchange rate manually on Exchange Rates page."),
+ $currency, $date_), true);
+ return $ret;
+}
+
function db_has_sales_types()
{
return check_empty_result("SELECT COUNT(*) FROM ".TB_PREF."sales_types");
display_error( _("The price entered must be numeric."));
set_focus('price');
}
+ elseif(!db_has_currency_rates($_POST['curr_abrev'], Today(), true))
+ $input_error = 1;
if ($input_error != 1)
{
display_error( _("The conversion factor entered was not numeric. The conversion factor is the number by which the price must be divided by to get the unit price in our unit of measure."));
set_focus('conversion_factor');
}
+ elseif(!db_has_currency_rates(get_supplier_currency($_POST['supplier_id']), Today(), true))
+ $input_error = 1;
if ($input_error == 0)
{
set_focus('StkLocation');
return false;
}
-
+ if (!db_has_currency_rates($_SESSION['PO']->curr_code, $_POST['OrderDate']))
+ return false;
if ($_SESSION['PO']->order_has_items() == false)
{
display_error (_("The order cannot be placed because there are no lines entered on this order."));
return false;
}
+ if (!db_has_currency_rates(get_supplier_currency($_POST['supplier_id']), $_POST['DatePaid'], true))
+ return false;
$_SESSION['alloc']->amount = -input_num('amount');
if (isset($_POST["TotalNumberOfAllocs"]))
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');
set_focus('ref');
return false;
}
+ if (!db_has_currency_rates($_SESSION['Items']->customer_currency, $_POST['OrderDate']))
+ return false;
if ($_SESSION['Items']->get_items_total() < 0) {
display_error("Invoice total amount cannot be less than zero.");