getsprice = Customer_Pricing_subform[Part_No == row.Part_No && Packaging == row.Packing_Std && Customer_Name == input.Customer_Name && sf_Status == "Active"]; row.Rate=getsprice.Settled_Price; if(row.Rate != null && row.Qty != null && row.Tax != null) { get_tax_value = GST_Details[ID == ifnull(row.Tax,"")].Total_Rate; Tax_calc = ifnull(row.Qty,0.0) * ifnull(row.Rate,0.0) * ifnull(get_tax_value,0.0) / 100; amount_calc = ifnull(row.Qty,0.0) * ifnull(row.Rate,0.0); row.Sub_Total=ifnull(amount_calc,0.00); row.Tax_Value=Tax_calc; row.Total_Amount=ifnull(amount_calc,0.0) + ifnull(Tax_calc,0.0); tot = 0.0; totqty = 0.0; subtot = 0.0; for each rec in Item_Details { tot = tot + ifnull(rec.Total_Amount,0.0); totqty = totqty + ifnull(rec.Qty,0.0); subtot = subtot + ifnull(rec.Sub_Total,0.0); } input.Item_Total = tot; input.Overall_Total = ifnull(input.Item_Total,0.0) + ifnull(input.Extra_Charge_s_Total,0.0); input.Total_Quantity = ifnull(totqty,0.0); //new field calculation starts here - 1/4/2023 input.Gross_Total = ifnull(subtot,0.0); if(input.Discount_Amount > 0) { input.Gross_with_Discount = ifnull(input.Gross_Total,0.0) - ifnull(input.Discount_Amount,0.0); } else { input.Gross_with_Discount = ifnull(input.Gross_Total,0.0); } get_tax_value = GST_Details[ID == ifnull(input.TaxP,"")].Total_Rate; if(get_tax_value == 0) { input.Gross_Value_Tax = 0; input.Gross_Total_with_Discount = ifnull(input.Gross_with_Discount,0.0); } else { Tax_calc = ifnull(input.Gross_with_Discount,0.0) * ifnull(get_tax_value,0.0) / 100; input.Tax_Total = ifnull(Tax_calc,0.0); input.Gross_Value_Tax = ifnull(Tax_calc,0.0); input.Gross_Total_with_Discount = ifnull(input.Gross_with_Discount,0.0) + ifnull(input.Gross_Value_Tax,0.0); } if(input.Packing_Forwarding > 0) { if(get_tax_value == 0) { Tax_calc1 = 0; } else { Tax_calc1 = ifnull(input.Packing_Forwarding,0.0) * ifnull(get_tax_value,0.0) / 100; } input.PF_Tax_value = ifnull(Tax_calc1,0.0); input.PF_Total_with_tax = ifnull(input.Packing_Forwarding,0.0) + ifnull(input.PF_Tax_value,0.0); } else { input.PF_Total_with_tax = 0; } input.Grand_Total = ifnull(input.Gross_Total_with_Discount,0.0) + ifnull(input.PF_Total_with_tax,0.0); //new fields calculation ends } //For Adding subtotal field if(row.Qty != null && row.Rate != null && row.Tax == null) { row.Sub_Total=row.Qty * row.Rate; } //rate is null if(row.Rate == null) { row.Sub_Total=null; row.Tax_Value=null; row.Total_Amount=null; }