<?xml version="1.0" encoding="utf-8" ?> <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null"> <style> .thead tr{ padding-top: 30px; } .main{ border: 1px solid black; } thead { display: block; } .row tr td{ border: 1px solid black; } .theader{ padding-bottom: 15px; } thead .text-left span { padding-right: 10px; } table, th, td { height: 25px; border-collapse: collapse; } p { margin: 0 0 0px; } .border-ri { height: 90px; border: 1px solid black; } .border-ri1 { height: 31px; border-right: 1px solid black; } .col-wid{ width: 10.8888% !important; } @media print { html, body { margin: 0 !important; overflow: absolute; height:100vh; <!-- font-size: 10px; --> page-break-after: always; /* breaks the page*/ page-break-before: always; } .page_header { display: table-header-group; } } thead { display: table-header-group; } } @page{ size:auto; margin-top: 7mm; margin-bottom: 7mm; } .last-page { page: last_page; page-break-before: always; /* Use if your last page is blank, else omit. */ } .size{ font-size: 10px; } } </style> <g:evaluate> var section_capacity_total = 0; var license_code; var gr = new GlideRecord('x_agms_ewcmd_examination_form_xxx'); gr.get('${sysparm_id}'); var struct = new GlideRecord('x_agms_ewcmd_examination_form_xxx_structure'); struct.addQuery('examination',gr.examination); struct.query(); var gr1 = new GlideAggregate('x_agms_ewcmd_examination_form_xxx_structure'); //GlideAggregate query gr1.addQuery('examination',gr.examination); gr1.addEncodedQuery('section.section_statusNOT INinactive,pending_removal'); gr1.addAggregate('SUM', 'capacity'); gr1.groupBy('section'); gr1.query(); if(gr.examination.warehouse.license.getDisplayValue() == ''){ license_code = gr.examination.warehouse.warehouse_code; } else{ license_code = gr.examination.warehouse.license.getDisplayValue(); } </g:evaluate> <!-- Header --> <table style="margin: 0 auto"> <thead> <tr> <td> <div class="container-fluid main"> <div class="row"> <div class="col-xs-5"> <p><b>WA-xxx</b></p> <p>Name : ${HTML:gr.examination.warehouse.getDisplayValue()}</p> <p>Location : ${HTML:gr.examination.warehouse.warehouse_location.getDisplayValue()}</p> </div> <div class="col-xs-5" style="text-align:left;border-right: 1px solid;"> <p><b>India. DEPARTMENT OF AGRICULTURE</b></p> <!-- <p>Farm Service Agency</p> --> <p><b>Agricultural Marketing Service</b></p> <p><b>BIN CHART</b></p> <p><b>(Post conspicuously in main office)</b></p> </div> <div class="col-xs-2"> <p>LICENSE/CODE NO. :</p> <!-- <p>${HTML:gr.examination.warehouse.license.getDisplayValue()}</p> --> <p style="margin-top: 21px;">${license_code}</p> </div> </div> </div> </td> </tr> <tr><td><br></br></td></tr> </thead> <tbody> <tr> <td> <div class="container-fluid"> <div class="row"> <!-- Table content(sections) --> <!-- <div style="padding-top:20px"> --> <div class="con"> <!-- <div class="col-sm-12"> --> <table style="width:100%;padding-left: 10px;padding-right:10px;"> <j:while test="${gr1.next()}"> <tr class="text-center theader"> <td><span><b> Section</b></span></td> <td><span><b> Container No.</b></span></td> <td><span><b> Capacity</b></span></td> <td><span><b> Effective Depth</b></span></td> <td><span><b> BU Per Foot</b></span></td> <td><span><b> Base Pack</b></span></td> </tr> <!-- <tr> <td class="text-left">Sum</td> <td class="text-left"> ${gr1.getAggregate('SUM', 'capacity')}</td> </tr> --> <g:evaluate> var diff =0;var cap_with_pack_tot = 0; //var sec_cap_tot = 0;var tot = 0; diff = ((gr1.section.section_capacity) - (gr1.section.section_capacity_raw)); section_capacity_total = section_capacity_total+gr1.section.section_capacity; var gr2 = new GlideRecord('x_agms_ewcmd_examination_form_xxx'); gr2.get('${sysparm_id}'); var struct1 = new GlideRecord('x_agms_ewcmd_examination_form_xxx_structure'); struct1.addQuery('examination',gr2.examination); struct1.addEncodedQuery("container_statusNOT INinactive,pending_removal"); struct1.orderBy('container_number'); struct1.query(); </g:evaluate> <j:while test="${struct1.next()}"> <j:if test="${gr1.section==struct1.section}"> <g:evaluate> //sec_cap_tot = sec_cap_tot+struct1.capacity; cap_with_pack_tot = cap_with_pack_tot+struct1.capacity_with_pack; //tot = sec_cap_tot + cap_with_pack_tot + diff; var cap = struct1.capacity.replace(/\B(?=(\d{3})+(?!\d))/g, ","); //var bu_foot = struct1.bu_per_foot.replace(/\B(?=(\d{3})+(?!\d))/g, ","); var bu_foot = struct1.bu_per_foot; var bu_foot1 = bu_foot.toString().split("."); bu_foot1[0] = bu_foot1[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); var bu_foot2=bu_foot1.join("."); if(bu_foot1[1]==undefined) { bu_foot2=bu_foot2+".0"; } var base_pack = parseFloat(struct1.base_pack); var effective_depth = parseFloat(struct1.effective_depth); //var bu_foot_1 = parseFloat(bu_foot); </g:evaluate> <tr> <td class="text-left" style="padding-left: 10px;"><span>${HTML:gr1.section.section_code}</span></td> <td class="text-left" style="padding-left: 10px;"><span>${HTML:struct1.container_number}</span></td> <td style ="text-align: right;padding-right: 10px;"><span>${HTML:cap}</span></td> <td style ="text-align: right;padding-right: 10px;"><span>${HTML:effective_depth}</span></td> <td style ="text-align: right;padding-right: 10px;"><span>${HTML:bu_foot2}</span></td> <td style ="text-align: right;padding-right: 10px;;"><span>${HTML:base_pack}</span></td> </tr> </j:if> </j:while> <g:evaluate> var cap_with_tot = Math.round(cap_with_pack_tot).toFixed(0); //var tot1 = Math.round(tot).toFixed(0); var tot1 = gr1.section.section_capacity.replace(/\B(?=(\d{3})+(?!\d))/g, ","); <!-- var num_parts = tot1.toString().split("."); num_parts[0] = num_parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); var total1=num_parts.join("."); --> var total_cap = cap_with_tot.toString().split("."); total_cap[0] = total_cap[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); var total_cap1=total_cap.join("."); </g:evaluate> <tr> <td colspan="6" style="border: none;"> <div class="row" style="border: 1px solid;margin-top: 4px;border-bottom: none;margin-left: 0px; margin-right: 0px;"> <div class="col-xs-5" style="/* text-align: center; */width: 36.9%;"></div> <!-- <div class="col-xs-1" style ="padding-left: 10px;">${gr1.getAggregate('SUM', 'capacity')}</div> --> <div class="col-xs-1" style ="padding-left: 10px;">${(total_cap1)}</div> <!-- <div class="col-xs-1" style=" width: 13.33333%;">Add $[SP]$[SP]$[SP] ${(diff.toString())} $[SP]$[SP]$[SP] to even.</div> <div class="col-xs-2" style="width: 11.33333%;"></div> --> <div class="col-xs-1" style=" width: 22.5555%;">Add $[SP]$[SP]$[SP] ${(diff.toString())} $[SP]$[SP]$[SP] to even.</div> <div class="col-xs-3">Section Code: ${gr1.section.examination.warehouse_code.code}</div> </div> <div class="row" style="margin-bottom: 13px;border: 1px solid;border-top: none;margin-left: 0px; margin-right: 0px;"> <!-- <div class="col-xs-3" id='${gr1.section}' style ="padding-left: 30px;"></div> --> <div class="col-xs-3" style ="padding-left: 30px;"><b>${(tot1)}</b></div> <div class="col-xs-4 " style="text-align: center;"><b>Total Capacity of Section</b></div> <!-- <div class="col-xs-2 " style="width: 11.66667%;">${gr1.section.section_code}</div> <div class="col-xs-3">Location: ${gr1.section.functional_unit.functional_unit_address.city}, ${gr1.section.functional_unit.functional_unit_address.state.state_abbr}, ${gr1.section.functional_unit.functional_unit_address.county.county_name}</div> --> <div class="col-xs-2 " style="width: 9.66667%;">${gr1.section.section_code}</div> <div class="col-xs-3" style="width: 32%;">Location: ${gr1.section.functional_unit.functional_unit_address.city}, ${gr1.section.functional_unit.functional_unit_address.state.state_abbr}, ${gr1.section.functional_unit.functional_unit_address.county.county_name}</div> </div> </td> </tr> </j:while> </table> <!-- </div> --> </div> <g:evaluate> var gr3 = new GlideRecord('x_agms_ewcmd_examination_form_xxx'); gr3.get('${sysparm_id}'); var examnr = new GlideRecord('x_agms_ewcmd_examination_examiner'); examnr.addQuery('examination',gr.examination); examnr.addQuery('lead_examiner','true'); examnr.query(); var name; if(examnr.next()){ name = examnr.examiner.name; } <!-- var gr_cap = new GlideRecord('x_agms_ewcmd_examination_form_xxx_structure'); //GlideAggregate query gr_cap.addQuery('examination',gr.examination); gr_cap.query(); var totalcap = 0; while(gr_cap.next()){ totalcap = gr_cap.capacity+totalcap ; } --> //var totalcap1 = totalcap.toString().split("."); var totalcap1 = section_capacity_total.toString().split("."); totalcap1[0] = totalcap1[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); var totalcap2=totalcap1.join("."); </g:evaluate> </div> </div> <br></br> <!-- <div class ="last-page container-fluid"> --> <!-- <div class ="container-fluid"> <div class="row"> <div class="txt_wrap"><p><b>Total Capacity:</b>$[SP]$[SP]$[SP] ${(totalcap2)}</p><p><b>Remarks:</b></p><pre> ${gr.remarks}</pre></div> </div> </div> --> <div class ="container"> <div class="row"> <!-- <div class="txt_wrap"><p><b>Total Capacity:</b>$[SP]$[SP]$[SP] ${(totalcap2)}</p><p><b>Remarks:</b></p><pre style="white-space: pre-wrap;word-break: break-word;">${gr.remarks}</pre></div> --> <div class="txt_wrap"><p><b>Total Capacity:</b>$[SP]$[SP]$[SP] ${(totalcap2)}</p><p><b>Remarks:</b></p><div style="white-space: pre-wrap;word-break: break-word;">${gr.remarks}</div></div> </div> </div> <br></br> <div class="container-fluid"> <div class="row"> <div class="txt_wrap"> <!-- <div class="col-xs-1 border-ri" style="padding-left: 1px;"><p>Date Prepared</p><p>${HTML:new GlideDate().getDisplayValue()}</p></div> --> <div class="col-xs-1 border-ri" style="padding-left: 1px;"><p>Date Prepared</p><p>${gr.examination.cut_off_date.getDisplayValue()}</p></div> <div class="col-xs-2 border-ri">Date Reused to Support Amendment</div> <div class="col-xs-2 border-ri"><p>Signature of Examiner</p><p>${name}</p></div> <div class="col-xs-2 border-ri">I Certify that the Inventory was made</div> <div class="col-xs-1 border-ri" style="padding-left: 1px;">Date Inventoried</div> <div class="col-xs-2 border-ri">Signature of Examiner</div> <div class="col-xs-1 border-ri" style="padding-left: 1px;">Date Rechecked</div> <div class="col-xs-1 border-ri" style="padding-left: 1px;">Initials of Examiner</div> </div> </div> </div> </td> </tr> </tbody> </table> </j:jelly>
Ui Page Design with GlideRecord and function ServiceNow
admin Changed status to publish December 26, 2023