This topic is locked

Maths with checkbox selection?

7/24/2008 3:03:44 AM
PHPRunner General questions
S
swanside author

Hello again, Just another query.
I am trying to do something like this

SELECT

Job_No,

Engineer_Name,

Paying_Rate,

Account_ID,

Working_Hrs,

Sheet_Returned,

Send_To_Invoice, ( This is a checkbox)

IF Send_To_Invoice=TRUE Select Working_HrsPaying_Rate as Invoice

FROM labour
I have another field in labour called Invoice, so, what I am trying to do is. If the Send_To_Invoice is ticked, then it does the maths or Working_Hrs
Paying_Rate and puts it into the Invoice Field.
Why I do this is, some clients wont pay for an apprentice, so I charge more for an engineer to cover the apprentice wages.
If they get an invoice with two entries on it, say £12 and £4, they will question it, but, If I can tick the boxes so when it goes to invoice, they get the invoice or £16 instead?
Thanks
Paul
UPDATE
I have tried this code aswell, but still no luck
SELECT

Job_No,

Engineer_Name,

Paying_Rate,

Account_ID,

Working_Hrs,

Sheet_Returned,

Send_To_Invoice,

IF Send_To_Invoice=TRUE

THEN (Select (Paying_Rate*Working_Hrs)) as Invoice;

END ;IF

FROM labour

J
Jane 7/24/2008

Hi,
to update Invoice field use Before record added/updated events on the Events tab.

Here is a sample:

if ($values["Send_To_Invoice"])

$values["Invoice"] = $values["Working_Hrs"]*$values["Paying_Rate"];