Dear Experts,
In need your help with respect to following query.
I have of BOM (Bill of Material Table) in which Selling Price is calculated by the system for almost all the items except few. For those items whose S.P. is not calculated by the system I have used the formula (Pur. Price * Margin Factor) to calculate the Selling Price.
Total BOM Selling Price is calculated by totaling the Selling Price at the bottom of the column. I have already designed the query for subtotaling of the selling price column at the bottom of it. The only problem is the cell in which selling price is null I need to take from Calculated Selling Price column and I need to highlight the cell color in yellow so that I should know by looking a the cell that it is taken from calculated Selling Price
CREATE TABLE BOMPrice (
Parent_Item VARCHAR(4) NOT NULL PRIMARY KEY
,Child_Item VARCHAR(2) NOT NULL
,Selling_Price_Rs INT
,Pur_Price_Euro INT NOT NULL
,Margin_Factor INT NOT NULL
,Calc_Selling_Price_Rs INT NOT NULL
);
INSERT INTO BOMPrice (
Parent_Item
,Child_Item
,Selling_Price_Rs
,Pur_Price_Euro
,Margin_Factor
,Calc_Selling_Price_Rs
)
VALUES (
'ABCD'
,'A'
,5
,2
,3
,6
);
INSERT INTO BOMPrice (
Parent_Item
,Child_Item
,Selling_Price_Rs
,Pur_Price_Euro
,Margin_Factor
,Calc_Selling_Price_Rs
)
VALUES (
'ABCD'
,'B'
,2
,1
,3
,3
);
INSERT INTO BOMPrice (
Parent_Item
,Child_Item
,Selling_Price_Rs
,Pur_Price_Euro
,Margin_Factor
,Calc_Selling_Price_Rs
)
VALUES (
'ABCD'
,'C'
,NULL
,3
,3
,9
);
INSERT INTO BOMPrice (
Parent_Item
,Child_Item
,Selling_Price_Rs
,Pur_Price_Euro
,Margin_Factor
,Calc_Selling_Price_Rs
)
VALUES (
'ABCD'
,'D'
,13
,5
,3
,15
);
When the Selling Price (Rs.) = Null then Selling Price (Rs.) = Pur. Price (Euro)*Margin Factor (with cell background color to be yellow) else Selling Price (Rs.)
Desired Output