Hi All,
I am new to PHP and MySQL and have following problem. I will be grateful if someone could help.
In my table I have fields: TotalTime, Rate and ProfitCost.
On Add and Edit the following calculationshould take place:
ProfitCost=TotalTime*Rate
ProfitCost format - "0000.00", TotalTime format - "0000", Rate format "0.00".
Although the calculation is simple I have tried everything I could think of and I am getting weird results.
Nothing as it should be when done by hand.
What data format or definition do I need to use?
TotalTime is calculated prior as TotalTime=Time+12.
Here is the syntax:
// Parameters:
// $values - Array object.
// Each field on the Add form is represented as a 'Field name'-'Field value' pair
// $where - string with WHERE clause pointing to record to be edited
// $oldvalues - Array object with existing data record content
// $keys - Array object with added record key column values
//** Custom code ****
// put your custom code here
$values["ClientName"]=strtoupper($values["ClientName"]);
$values["ClientSurname"]=strtoupper($values["ClientSurname"]);
$values["Address1"]=strtoupper($values["Address1"]);
$values["Address2"]=strtoupper($values["Address2"]);
$values["City"]=strtoupper($values["City"]);
$values["PostCode"]=strtoupper($values["PostCode"]);
$values["CaseStage"]=strtoupper($values["CaseStage"]);
$values["EndCode1"]=strtoupper($values["EndCode1"]);
$values["EndCode3"]=strtoupper($values["EndCode3"]);
$values["TotalTime"]=$values["Time"]+12;
$values["ProfitCost"]=$values["TotalTime"]*$valued["Rate"];
return true;
// return true if you like to proceed with adding new record
// return false otherwise
Please, please help.
Tom