You need to sign in to do that
Don't have an account?
force shahid
how to deduct raw material quantity after billing the order ?
Hi Friends,
I created app for restaurent . I created custom objects name as Bill , Order , Raw material . Now i want to write a trigger /something for deduct the rawmaterial after order is billing. howit is possible ?
Thanks in advance
I created app for restaurent . I created custom objects name as Bill , Order , Raw material . Now i want to write a trigger /something for deduct the rawmaterial after order is billing. howit is possible ?
Thanks in advance
If I go with the exact word meaning of deducting & N:N relationship between the two objects then yes you can use trigger but to write a trigger you need to fix a trigger point, when your trigger will deduct the price of the raw material.
say you are storing the total value of bill in bill object & then a simple trigger can help you to deduct it from child records. Adding more info will help to give more accurate answere.
Thanks for your reply. I created relationship between menu Object and Raw material object.
Parent is Rwa material, Child is Menu
Order is parent , child is billing .
When order is billing i need to deduct the raw materialof item .
Example :
One customer orderd coffee ., Milk shake means 2 items.
In menu Object i create Coffee is menu name and i took 10 ingrediant items & their quantity .
For coffee i took 3 ingrediants with their respective quantity .
For milk Shake 4 ingrediants.
In raw material I took coffebeans is one record, sugar is one record , milk is one record.
If this order is billing , i need to deduct the raw material quantity. How to write the trigger ? If it possible , can u provide the code .
Thanks in Advance.
I think relationships what you have mentioned should be other way I am coming from your example only:
Menu & raw materials should be many to many relationship not parent child relationship, reason else everytime you have to create a new record for same raw materials.
"In menu Object i create Coffee is menu name and i took 10 ingrediant items & their quantity ."
For this scenario I would have done this:
1. Created a Total Price field on Menu object which user will key in after every record creation
2. Created a Lookup relationship of Menu on Billing object which is a child to Order object
3. Created two fields one Line Price (Number) & another Price (formula field) which will add up to the Billing object
4. And last field Total Price on Menu object which will sum up the Line Prices from billing object record to Menu, this field will be a roll up summary field on Line Price of Billing object.
5. You have to create a workflow which will copy the Price value to Line Price
I hope with no code you can achieve it.
Thanks for your reply . But i want to deduct the raw material quantity . Not a price.
Then if you follow my suggested way of object creation & relationships then you don't have to care about getting rid of raw materials.
To make it more easy:
Billing will have a lookup to Menu & the above attached screenshot only showinf Menu items along with Billing line item in Order.
Let me know if my explanation help you.