⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Auto-calculated amount in Sales Transaction



h4kl0rd

h4kl0rd
  • profile picture
  • Member

Posted 10 October 2013 - 16:31 PM

I have the following tables:

 

1. Sales

with fields (item_id, item_type_id, quantity_sold, amount_buying_price, amount_selling_price)

 

2. Item_details

with fields (item_id, item_type_id, buying_price, selling_price)

 

[attachment=698:sales.png]

 

The amounts must load in the respective fields after the item and item type are selected.

Users will select item and item type, then enter quantity sold, while they enter the quantity, I want the amounts for buying price and selling price to display.

 

Amount - Buying Price is calculated as:

Amount_buying_price = Quantity Sold x Buying Price

Amount - Selling Price is calculated as:

Amount_selling_price = Quantity Sold x Selling Price

The buying and selling price values can be retrieved from item_details table.

 

Finally, the user will click save and the record will be saved in the Sales Table