Part No - User input
Tue Jan 07 2025 15:32:27 GMT+0000 (Coordinated Universal Time)
Saved by @Pooja
if(row.Part_No != null) { match_data = Materials[ID == row.Part_No && Status == "Active"]; row.Part_Description=match_data.ID; row.Specification=match_data.Specification; row.Ordered_Qty=ifnull(match_data.MOQ,0); row.UoM=row.Part_Description.Primary_UoM; row.Mfr_Part_No=match_data.ID; row.Brand=match_data.Brand_Name; if(input.Source_of_Supply.Short_Name == "Out of Scope") { clear row.Tax; row.Tax=GST_Details[Tax_Name == "Out of Scope"].ID; } else { if(input.Source_of_Supply.Short_Name != "UP") { fet_igst = GST_Details[Tax_Name.contains("IGST")].ID.getAll(); clear row.Tax; row.Tax:ui.add(fet_igst); row.Tax=Materials[ID == row.Part_No].IGST_Details; } else { fet_igst = GST_Details[Tax_Name.contains("GST") && !Tax_Name.startswith("I")].ID.getAll(); clear row.Tax; row.Tax:ui.add(fet_igst); row.Tax=Materials[ID == row.Part_No].GST_Details; } } row.Available_Qty=ifnull(Inventory[Part_No == row.Part_No].sum(Available_Qty),0.0); //Unit price and MOq should be come from vendor pricing if vendor record is available in vendor pricing form. ven_pricing = Vendor_Contract_Subform[Vendor_Name == input.Vendor_Name && Part_Description == row.Part_Description && Effective_From <= zoho.currentdate && Effective_To >= zoho.currentdate && sf_Status == "Active"]; //info ven_pricing.ID; //info ven_pricing.count(ID); if(ven_pricing.count(ID) == 1) { row.Ordered_Qty=ifnull(ven_pricing.MOQ,0.0); row.Rate=ifnull(ven_pricing.Unit_Price,0.0); row.MOQ_Qty=ifnull(ven_pricing.MOQ,0.0); } check_ven_map = 0; check_ven_lis = List(); if(input.Vendor_Name != null) { chkvendavl = Vendor_Contract[Vendor_Name == input.Vendor_Name && Status == "Active"]; if(chkvendavl.count() > 0) { for each sub_val in input.Item_Details { check_vendor = Vendor_Contract_Subform[Vendor_Name == input.Vendor_Name && Part_Description == sub_val.Part_Description && Effective_From <= zoho.currentdate && Effective_To >= zoho.currentdate && sf_Status == "Active"]; if(check_vendor.count() == 0) { check_ven_lis.add(sub_val.Part_No.Part_No); check_ven_map = 1; } if(check_vendor.count() > 0) { sub_val.Rate=ifnull(check_vendor.Unit_Price,0.0); sub_val.Vendor_contract_Price_check=true; sub_val.MOQ_Qty=ifnull(check_vendor.MOQ,0.0); if(row.Rate != check_vendor.Unit_Price) { row.Vendor_contract_Price_check=false; } else { row.Vendor_contract_Price_check=true; } } // sendmail // [ // from :"CWPL ERP<erp@carrierwheels.com>" // to :"parthasarathy.m@synprosoft.com" // subject :"Vendor Contract - itemdetils partno validation " + row.Vendor_contract_Price_check // message :"Vendor Contract - itemdetils partno validation " + input.Vendor_Name.Vendor_Name // ] } } if(check_ven_map == 1) { show asso_vendors; Flag_for_Not_Associated_Vendors = true; create_tab = "<table border=1 Style ='color:#ff8b3b'><tr><th>S.No</th><th>Part No</th><th>Associated Vendor(s)</th></tr>"; sno = 1; for each tab in check_ven_lis { ven_lis = List(); for each ven in Vendor_Contract_Subform[Vendor_Name == input.Vendor_Name && Part_Description == sub_val.Part_Description && Effective_From <= zoho.currentdate && Effective_To >= zoho.currentdate && sf_Status == "Active"] { if(ven.Vendor_Name.Status == "Active") { ven_lis.add(ven.Vendor_Name.Vendor_Name); } } create_tab = create_tab + "<tr><td>" + sno + "</td><td>" + tab + "</td><td>" + if(ven_lis.size() == 0,"<b>Not Associated</b>",ven_lis) + "</td></tr>"; sno = sno + 1; } create_tab = create_tab + "</table>"; str = "Selected Vendor <b>" + input.Vendor_Name.Vendor_Name + "</b> is not mapped against the following Item(s) : <br><br> " + create_tab; input.asso_vendors = str; Do_you_want_to_proceed_anyway = ""; } else { hide asso_vendors; } } } else { row.Part_Description=null; row.Available_Qty=null; row.MOQ_Qty=null; row.Ordered_Qty=null; row.Specification=null; hide asso_vendors; } //for vendor gst treatment type is Registered Business - composition then GST is null - Parthasarathy - 09/06/2023 getvend = Vendor[ID == input.Vendor_Name]; getgsttreat = GST_Treatment[ID == getvend.GST_Treatment]; if(getgsttreat.GST_Treatment == "Registered Business - Composition") { row.Tax=null; row.Tax_Value=null; } //if rate is updated in materials the calculate automatically - 19/12/2022 if(row.Ordered_Qty != null && row.Rate != null && row.Tax != null) { get_tax_value = GST_Details[ID == row.Tax].Total_Rate; tax_calc = row.Ordered_Qty * row.Rate * get_tax_value / 100; row.Sub_Total=row.Ordered_Qty * row.Rate; row.Tax_Value=tax_calc; row.Item_Total=row.Sub_Total + tax_calc; tot = 0.0; subtot = 0.0; for each rec in Item_Details { tot = tot + ifnull(rec.Item_Total,0.0); subtot = subtot + ifnull(rec.Sub_Total,0.0); } input.Item_Total = tot; input.Gross_Total = ifnull(subtot,0.0); //17082022input.Total = tot + ifnull(input.Extra_Charge_s_Total,0.0); input.Overall_Total = tot + ifnull(input.Extra_Charge_s_Total,0.0); } else { row.Sub_Total=ifnull(row.Ordered_Qty,0) * ifnull(row.Rate,0) + ifnull(row.Tax_Value,0.0); row.Item_Total=ifnull(row.Sub_Total,0.0) + ifnull(row.Tax_Value,0.0); tot1 = 0.0; subtot1 = 0.0; for each rec in Item_Details { tot1 = tot1 + ifnull(rec.Item_Total,0); subtot1 = subtot1 + ifnull(rec.Sub_Total,0.0); } //17082022input.Total = ifnull(input.Extra_Charge_s_Total,0.0) + tot1; input.Gross_Total = ifnull(subtot1,0.0); input.Overall_Total = ifnull(input.Extra_Charge_s_Total,0.0) + tot1; input.Item_Total = tot1; } //For testing Purpose only Part number created for testing should be selected. if(input.Vendor_Name != null) { if(Vendor_Name.Vendor_Name.startsWithIgnoreCase("Test") == True) { if(row.Part_No != null) { if(row.Part_No.Part_No.startsWithIgnoreCase("Test") == false) { alert "Use Test Part No for Testing"; row.Part_No=null; row.Part_Description=null; } } } }
Comments