fet_pref = Preferences[Module_Name = "GRN"]; input.Auto_Approval = fet_pref.Auto_Approval; //_________________________________________________________________ hide Item_Details.Purchase_Order_Number; hide Item_Details.Tax_Value; hide Item_Details.Tax; hide Item_Details.Income_Quality_Check_Process; hide Item_Details.zinvt_line_item_id; hide Item_Details.zinvt_item_id; hide Purchase_Order_Subform_RECID; hide Transportation_details.GRN_Main_RECID; input.Received_By = Employee_Details[Employee_Email == zoho.loginuserid].ID; input.GRN_Time = zoho.currenttime; disable GRN_Time; if(Purchase_Order_Subform_RECID != null || Purchase_Order_Subform_RECID.size() > 0) { TotalValue = 0; tot_qty = 0; i = 0; input.Goods_Received_Note_Date = zoho.currentdate; for each PORec in input.Purchase_Order_Subform_RECID { i = i + 1; getPosub = Purchase_Order_Subform[ID == PORec.ID && PO_Status == "GRN Pending" || PO_Status == "Gate Entry Partially Done" || PO_Status == "GRN Partially Received"]; getPOMain = Purchase_Order[ID == getPosub.Purchase_Order_ExisID]; //get the indent raised by and department details - user requirememnt - 12/12/2022 getindentsf = Indent_Sub_Form[ID == getPOMain.Indent_Sub_Form_RECID]; getindent = Indent[ID == getindentsf.Indent_Form_RECID]; // getindentno = Indent_Sub_Form[Purchase_Order_Subform_RECIDD == PORec.ID]; getindentno = Indent_Sub_Form[ID == getPosub.Indent_Sub_Form]; //info getindentno; getmaterials = Materials[ID == getPosub.Part_No]; getcategory = Category[ID == getmaterials.Category]; //info getcategory; if(getindent.count() = 0) { hide Indent_No; hide Indentor; hide Department; } else { input.Indent_No = getindentno.Indent_No; disable Indent_No; input.Indentor = getindent.Request_Raised_By; disable Indentor; input.Department = getindent.Department; disable Department; } input.Purchase_Order = getPosub.Purchase_Order_ExisID; input.Purchase_Order_Nos = (input.Purchase_Order_Subform_RECID.Purchase_Order_ExisID.getall()).distinct(); //input.Mode_of_delivery = getPOMain.Shipping_Mode;//field deleted as per user request - 31/01/2023 input.Purchase_Order_Number = getPOMain.ID; input.Purchase_Order_Date = getPOMain.Purchase_Order_Date; disable Purchase_Order; disable Mode_of_delivery; disable Purchase_Order_Number; disable Purchase_Order_Date; input.Vendor_Name = getPOMain.Vendor_Name; gatefet = Create_Gate_Entry1[Vendor_Name == input.Vendor_Name && GEP_Status != "Closed"].ID.getAll(); input.Gate_Entry_No:ui.add(gatefet); disable Vendor_Name; Get_Tax_Perc = GST_Details[ID == getPosub.Tax].Total_Rate; if(Get_Tax_Perc != null) { Tax_Amount = (ifnull(PORec.Ordered_Qty,0) - ifnull(PORec.Qty_Received_so_far,0)) * ifnull(getPosub.Rate,0.00) * Get_Tax_Perc / 100; } if(Get_Tax_Perc != null) { Total_Amount = (ifnull(PORec.Ordered_Qty,0) - ifnull(PORec.Qty_Received_so_far,0)) * ifnull(getPosub.Rate,0.00) + ifnull(Tax_Amount,0.0); } else { Total_Amount = (ifnull(PORec.Ordered_Qty,0) - ifnull(PORec.Qty_Received_so_far,0)) * ifnull(getPosub.Rate,0.00); } //Disable all Subform Fields except Received Quantity. hide Item_Details.GRN_Created_Date; if(getcategory.Category != "HR Coils") { hide Item_Details.HR_Coil_id; } else { hide Item_Details.HR_Coil_id; } disable Item_Details.S_No; disable Item_Details.GRN_Created_Date; disable Item_Details.Part_No; disable Item_Details.Part_Description; disable Item_Details.Specification; disable Item_Details.UoM; disable Item_Details.Ordered_Qty; disable Item_Details.Received_Qty_So_far; disable Item_Details.Rate; disable Item_Details.Sub_Total; disable Item_Details.Tax; disable Item_Details.Tax_Value; disable Item_Details.Amount; disable Item_Details.Balance_Qty; //disable Item_Details.MFG_Date; comment on 6.9.2022 by partha //disable Item_Details.Exp_Date; comment on 6.9.2022 by partha disable Item_Details.PO_ID; disable Item_Details.Purchase_Order_SubForm_RECID; disable Item_Details.Batch_Number; disable Item_Details.Total_Price; disable Item_Details.Barcode; disable Item_Details.GRN_ID; disable Item_Details.HR_Coil_id; disable Item_Details.Indentor; disable Item_Details.Indent_No; disable Item_Details.Indentor_Dept; //ItemDetails Subform - Declaring the Row for Subform ItemDetailSFRow = GRN.Item_Details(); // assigning values for various subform fields in the row ItemDetailSFRow.S_No=i; ItemDetailSFRow.GRN_Created_Date=zoho.currentdate; ItemDetailSFRow.Part_No=getPosub.Part_No; ItemDetailSFRow.Part_Description=getPosub.Part_Description; ItemDetailSFRow.Specification=getPosub.Specification; ItemDetailSFRow.UoM=getPosub.UoM; ItemDetailSFRow.Rate=ifnull(getPosub.Rate,0.00); ItemDetailSFRow.Sales_Order_No=getPosub.Sales_Order_No; ItemDetailSFRow.PO_ID=getPosub.Purchase_Order_ExisID; ItemDetailSFRow.Purchase_Order_SubForm_RECID=PORec.ID; ItemDetailSFRow.Ordered_Qty=getPosub.Ordered_Qty; ItemDetailSFRow.Received_Qty=Ifnull(getPosub.Ordered_Qty,0) - Ifnull(getPosub.Qty_Received_so_far,0); //Pooja ItemDetailSFRow.Received_Qty=ifnull(getPosub.Qty_Recieved_so_far_GE,0); //ItemDetailSFRow.Received_Qty=ifnull(getPosub.Qty_Recieved_so_far_GE,0) - ifNull(getPosub.Qty_Received_so_far,0); ItemDetailSFRow.Balance_Qty=ifnull(getPosub.Ordered_Qty,0) - (ifnull(ItemDetailSFRow.Received_Qty,0) + ifnull(getPosub.Qty_Received_so_far,0)); ItemDetailSFRow.Received_Qty_So_far=Ifnull(getPosub.Qty_Received_so_far,0); ItemDetailSFRow.Sub_Total=(ifnull(getPosub.Ordered_Qty,0) - ifnull(getPosub.Qty_Received_so_far,0)) * ifnull(getPosub.Rate,0.00); if(getPosub.Tax != null) { ItemDetailSFRow.Tax=Ifnull(getPosub.Tax,""); ItemDetailSFRow.Tax_Value=ifnull(Tax_Amount,0.00); } if(getPosub.Tax == null) { ItemDetailSFRow.Amount=ifnull(ItemDetailSFRow.Sub_Total,0.00); } else { ItemDetailSFRow.Amount=ifnull(ItemDetailSFRow.Sub_Total,0.00) + ifnull(ItemDetailSFRow.Tax_Value,0.00); } ItemDetailSFRow.Total_Price=ItemDetailSFRow.Amount; ItemDetailSFRow.Purchase_Order_Number=getPOMain.ID; TotalValue = ifnull(TotalValue,0.00) + ifnull(ItemDetailSFRow.Amount,0.00); tot_qty = tot_qty + ifnull(ItemDetailSFRow.Received_Qty,0); //ItemDetailSFRow.Indent_No=getindent.Indent_No; ItemDetailSFRow.Indent_No=ifnull(getindentno,""); ItemDetailSFRow.Indentor=getindent.Request_Raised_By; ItemDetailSFRow.Indentor_Dept=getindent.Department; //ItemDetailSFRow.HR_Coil_id=Coil_id; // declare a variable to hold the collection of rows ItemDetailSfCol = Collection(); ItemDetailSfCol.insert(ItemDetailSFRow); // insert the rows into the subform through the variable input.Item_Details.insert(ItemDetailSfCol); } //Retrieve the Transportation details /* fetgateentry = Gate_Entry_Process[Purchase_Order_No == input.Purchase_Order_Number]; if(fetgateentry.count() > 0) { fettransentry = Gate_Entry_Transport_Details[Gate_Entry_Process_RECID == fetgateentry.ID]; for each transrec in fettransentry { //if(fettransentry.count() > 0) // { TransportSFRow = GRN.Transportation_details(); TransportSFRow.Vehicle_No=transrec.Vehicle_No; TransportSFRow.Name_of_Transport=transrec.Name_of_Transport; TransportSFRow.Driver_Name=transrec.Driver_Name; TransportSFRow.Driver_Contact_No=transrec.Driver_Contact_No; TransportSFRow.GR_RR_No=transrec.GR_RR_No; TransportSFRow.GR_RR_Date=transrec.GR_RR_Date; TransportSFRow.Picture_of_Item_Lorry=transrec.Picture_of_Item_Lorry; TransportSFRow.Picture_Description=transrec.Picture_Description; TransportSfCol = Collection(); TransportSfCol.insert(TransportSFRow); // insert the rows into the subform through the variable input.Transportation_details.insert(TransportSfCol); disable Transportation_details.Vehicle_No; disable Transportation_details.Name_of_Transport; disable Transportation_details.Driver_Name; disable Transportation_details.Driver_Contact_No; disable Transportation_details.GR_RR_Date; disable Transportation_details.GR_RR_No; disable Transportation_details.Picture_Description; disable Transportation_details.Picture_of_Item_Lorry; disable Transportation_details.Status; } } else { hide Transportation_details; } */ input.Total_Value = ifnull(TotalValue,0.00); input.Total_Quantity = ifnull(tot_qty,0.00); html = "<html><head><style>#customers {font-family: 'Trebuchet MS', Arial, Helvetica, sans-serif;border-collapse: collapse;width: 100%;}#customers td, #customers th {border: 1px solid #ddd;padding: 8px;}#customers tr:nth-child(even){background-color: #f2f2f2;}#customers tr:hover {background-color: #ddd;}#customers th { padding-top: 12px;padding-bottom: 12px;text-align: left;background-color: #f9f9f9;}</style></head><body>"; html = html + "<table id='customers'><th style='text-align:center;'>PO Form</th></tr>"; Val_url = "https://app.zohocreator.in/carrierwheels/erp/#Page:PO_Template?ID=" + input.Purchase_Order + "&zc_LoadIn=dialog&zc_Header=false"; urlvalue = "<a href='" + Val_url + "'>View PO</a>"; html = html + "</td><td>" + urlvalue + "</td></tr>"; html = html + "</table></body></html>"; input.plain = html; } disable Material_Landing_Rack; if(input.Material_Landing_Rack == null) { fet_mat = Rack_Master[Racks_Bins == "Store Incoming Area"]; input.Material_Landing_Rack = fet_mat.ID; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter