This topic is locked

Aafter record added

5/17/2010 10:02:44 AM
PHPRunner General questions
B
benim author

i have a Tabelle as "Rechnung" and Field as "Stuck" (piece), "Preis" (price) and "Gesamt" (sum).
// Add page: Before display

function BeforeShowAdd(&$xt,&$templatefile)

{

//** Insert a record into another table ****

global $conn;

$strSQLInsert = "insert into rechnung (Stuck, Preis) values ("Stuck, Preis" , "Stuck * Einzelpreis")";

db_exec($strSQLInsert,$conn);
;

} // function BeforeShowAdd
I want to calculate the Stuck Field and Preis Field as Sum Gesamt Field.

help me plaese <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=14448&image=1&table=forumtopics' class='bbc_emoticon' alt=':o' />

A
ann 5/18/2010

Hi,
you can fill in Gesamt field as a sum in the Before Add/Edit event on the Events tab.

Here is a sample:

$values["Gesamt"]=$values["Stuck"]+$values["Preis"];



As Gesamt is a field in the table you should uncheck Add/Edit for that field on the Choose fields tab.