Here is my script -
----------------------------------------------------
lineItemsCostWithTax = 0.0;
lineItemsCostWithoutTax = 0.0;
lineItemDiscount = 0;
discountOnAllLineItems = 0;
//Get details of the customer in current order
detailsOfCustomerInCurrentOrder = Customers[ID == input.Customer];
selectedProdInOrder = detailsOfCustomerInCurrentOrder.Customer_Discounts.Select_Product.New_Product_Name;
discForSelectedProdInOrder = detailsOfCustomerInCurrentOrder.Customer_Discounts.Discount_in_Rs;
info discForSelectedProdInOrder;
if(Calculate_Order_Cost)
{
for each lineItem in Add_Product
{
currentGST = 0.0;
currentCGST = 0.0;
if(lineItem.Product_Name1 == "14.2KG")
{
currentGST = lineItem.Price * lineItem.Quantity * 0.025;
currentCGST = lineItem.Price * lineItem.Quantity * 0.025;
}
else
{
currentGST = lineItem.Price * lineItem.Quantity * 0.09;
currentCGST = lineItem.Price * lineItem.Quantity * 0.09;
}
//Calculate Taxes
lineItemsCostWithTax = lineItemsCostWithTax + lineItem.Price * lineItem.Quantity + currentGST + currentCGST;
lineItemsCostWithoutTax = lineItemsCostWithoutTax + lineItem.Price * lineItem.Quantity;
//Calculate Discount
if(selectedProdInOrder != null && selectedProdInOrder == lineItem.Product_Name1)
{
info "I'm in";
info lineItem.Quantity;
info discForSelectedProdInOrder;
lineItemDiscount = discForSelectedProdInOrder * lineItem.Quantity;
}
discountOnAllLineItems = lineItemDiscount + lineItemDiscount;
}
// totalCurrentTAX = currentGST + currentGST;
input.Tax_Applied = lineItemsCostWithTax - lineItemsCostWithoutTax;
// input.Discount = discountOnAllLineItems;
input.Sub_Total = lineItemsCostWithoutTax;
input.Grand_Total = lineItemsCostWithTax;
}
else if(!Calculate_Order_Cost)
{
input.Tax_Applied = 0.0;
input.Grand_Total = 0.0;
input.Discount = 0.0;
input.Sub_Total = 0.0;
}
----------------------------------------------------
Everything works well except the highlighted line - it throws - 'mismatch'
The variables 'Discount_in_Rs' and
'lineItem.Quantity' both are are bigints with equal length.. I am completely blocked!!