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