getemail = Email_Template[Template_No == 9]; sub = getemail.Subject_field; body = getemail.Body; tab = "<html><style>th,td {padding: 5px;}</style><table border = 1> <th> S.No. </th> <th>Part No.</th> <th>Part Name <th>Minimum Quantity</th> <th>Available Quantity</th>"; count = 0; for each var in Materials[Material_Item_Type.Material_Type == "General Purchase" && Planning_Procedure == "Consumption-Based Planning"] { stock = Stock_Value[Part_No == var.ID].sum(Stock_Qty); if(var.Minimum_Stock != null) { if(var.Minimum_Stock >= stock) { count = count + 1; tab = tab + "<tr><td>" + count + "</td>"; tab = tab + "<td>" + var.Part_No + "</td>"; tab = tab + "<td>" + var.Part_Description + "</td>"; tab = tab + "<td>" + var.Minimum_Stock + "</td>"; tab = tab + "<td>" + stock + "</td></tr>"; } } } if(count > 1) { info "test"; tab = tab + "</table></html>"; body = body.replaceAll("{table}",tab,true); sub = sub.replaceAll("<partno>",var.Part_No,true); sendmail [ from :"CWPL ERP <erp@carrierwheels.com>" to :"pooja.s@synprosoft.com" subject :sub message :body ] }
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