Created or Edited -> User input of Item Details.Qty -> ItemDetails_Qty_Validations
Tue Jan 07 2025 14:17:44 GMT+0000 (Coordinated Universal Time)
Saved by @Pooja
//For Negative validation Check
for each var in input.Item_Details
{
var.Balance_Qty=var.Qty;
}
if(row.Qty <= 0 && row.Qty != null)
{
alert "Please enter positive values";
row.Qty=null;
}
else
{
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;
}
fet_deli = Delivery_Schedule[Part_No == row.Part_No];
if(fet_deli.count() >= 1)
{
if(row.Qty > fet_deli.sum(Quantity))
{
fet_deli.Full_Quantity=false;
}
}
}



Comments