I have Master Table "cashregister"
Fields (BillNo
, Location
, Address
, Customer
, TIN
, BillTotal
, PayMode
, No
, PaidAmount
, Date
, UserID
FROM cashregister
)
Maaster Detail Table " cashbills"
Fields (Item
, Units
, Qty
, SaleDate
, BillNo
, Location
, UserID
, SPrice
, Tax
, id
, CPrice
, Class
FROM cashbills
)
function Row_Updating(&$rsold, &$rsnew)
$MyResult = ew_Execute("
INSERT INTO stock (Location, Class, ItemNo, Units, Qty)
VALUES(".$rsnew["Location"].", ".$rsnew["Class"].", ".$rsnew["Item"].", '".$rsnew["Units"]."', -(".$rsnew["Qty"]."))
ON DUPLICATE KEY UPDATE Qty = Qty - (".$rsnew["Qty"].")
");
I need to Execute the above function
Case 1:
When the Customer is Cash and PayMode is Cash and Paid Amount Greater or Equals to BillTotal
Case 2:
When the Customer is not Cash and PayMode is not Cash
Can anybody please help.
Thanks in advance