This topic is locked
[SOLVED]

 Calculate field in details page problem

7/16/2011 9:14:01 AM
PHPRunner General questions
P
pim author

Hi,
I'm testing if I can build my project with PhpRunner and so far it all seems to go well. Just for you to know, I have knowledge of writing websites in html, and some knowledge of ms acces. Php is newland to me.
Within my project I have a problem with calculating a field in a details page:
table 1 b_bills



BillID

BilNr

OrderDate

TourNr

OrderedBy

Supplier

PaymentDueDate

PaymnentStatus

PaidBy

PaidDate
--------------------------

table 2 - b_orders
Orders

OrderedFor

Item

Brand

Quantity

QuantityType

Price

SubTotal

VAT

Total

OrderDeliveryDate

OrderDeliveryTime

ReceivedDate

ReceivedBy

BillID

TimeStamp

Comments
--------------------------

Table link properties:

Master: b_bills (BillsID) -> Details: b_orders (BillID)
display child records on

list page

view page

add page

edit page
--------------------------

In Events I added the (example) code as below to the pages
b_orders

-> add page -> javascript OnLoad event

-> edit page -> javascript OnLoad event
--------------------------

Code:

--------------------------

var ctrlPrice = Runner.getControl(pageid, 'Price');

var ctrlQuantity = Runner.getControl(pageid, 'Quantity');

var ctrlTotal = Runner.getControl(pageid, 'Total');
function func() {
if ( ctrlPrice.getValue()!='' && ctrlQuantity.getValue() && !isNaN(ctrlPrice.getValue()) && !isNaN(ctrlQuantity.getValue()))

ctrlTotal.setValue(parseFloat(ctrlPrice.getValue())
parseFloat(ctrlQuantity.getValue()));

else

ctrlTotal.setValue('');

};
ctrlPrice.on('keyup', func);

ctrlQuantity.on('keyup', func);
// Place event code here.

// Use "Add Action" button to add code snippets.
// Place event code here.

// Use "Add Action" button to add code snippets.

*

--------------------------

The problem
Now, when I go to the browser to the

Means I add a price (100) and a quantity (1) and the sum in total will be calculated (100).
However, when I go to the b_bills page and I add or edit from there,[color="#FF0000"] the child b_orders, the sum does not work.
Now what should I do to fix this? I hope that there is somebody out there who is willing to help me. Thank you so much in advance,
Pim