i = 0; for each rec_sn in input.Despatch_Schedule { i = i + 1; row.S_No=i; } //For Delivery Schedule clear row.Part_No; item_list = List(); deliv_list = List(); for each an_item in input.Item_Details { item_list.add(an_item.Part_Description); } for each deliv in input.Despatch_Schedule { if(deliv.Part_No != null && deliv.Full_Quantity == true) { deliv_list.add(deliv.Part_No); } } item_list.removeAll(deliv_list); row.Part_No:ui.add(item_list.sort(true)); if(item_list.size() > 0) { row.Part_No=item_list.get(0); //Setting Quantity for each rec in input.Item_Details { if(rec.Qty < 1) { alert "Please enter quantity for all the item(s) in Item Details "; row.Quantity=null; } else { tot = 0.0; for each rec1 in input.Despatch_Schedule { if(rec1.Part_No == rec.Part_Description) { tot = tot + ifnull(rec1.Quantity,0.0); } } if(rec.Part_Description == row.Part_No) { row.Quantity=if(tot > 0,rec.Qty - tot,rec.Qty); row.Delivery_Date=if(tot > 0,null,input.Expected_Shipment_Date); row.Specification=rec.Remarks_multiline; row.Full_Quantity=true; } } } }
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