Print new label in PDF report

Jira Code: APC-24

On the test report record, added a new Print Label button which prints the label PDF and customizes the test report PDF to include all the data in the test report.

Advanced PDF template For the Test Report

<?xml version="1.0"?>
<!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">
<pdf>

    <head>
        <link name="NotoSans" type="font" subtype="truetype" src="${nsfont.NotoSans_Regular}" src-bold="${nsfont.NotoSans_Bold}" src-italic="${nsfont.NotoSans_Italic}" src-bolditalic="${nsfont.NotoSans_BoldItalic}" bytes="2" />
        <#if .locale=="zh_CN">
            <link name="NotoSansCJKsc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKsc_Regular}" src-bold="${nsfont.NotoSansCJKsc_Bold}" bytes="2" />
            <#elseif .locale=="zh_TW">
                <link name="NotoSansCJKtc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKtc_Regular}" src-bold="${nsfont.NotoSansCJKtc_Bold}" bytes="2" />
                <#elseif .locale=="ja_JP">
                    <link name="NotoSansCJKjp" type="font" subtype="opentype" src="${nsfont.NotoSansCJKjp_Regular}" src-bold="${nsfont.NotoSansCJKjp_Bold}" bytes="2" />
                    <#elseif .locale=="ko_KR">
                        <link name="NotoSansCJKkr" type="font" subtype="opentype" src="${nsfont.NotoSansCJKkr_Regular}" src-bold="${nsfont.NotoSansCJKkr_Bold}" bytes="2" />
                        <#elseif .locale=="th_TH">
                            <link name="NotoSansThai" type="font" subtype="opentype" src="${nsfont.NotoSansThai_Regular}" src-bold="${nsfont.NotoSansThai_Bold}" bytes="2" />
        </#if>
        <style type="text/css">
        table {

            font-size: 9pt;
            table-layout: fixed;
            width: 100%;
            padding-top: 2px;
            padding-bottom: 2px;
        }

        th {
            font-weight: bold;
            font-size: 8pt;
            vertical-align: middle;

            background-color: #e3e3e3;
            color: #333333;
        }

        td {

            border: 1px solid black;
        }

        b {
            font-weight: bold;
            color: #333333;
        }

        .fullWidth {
            width: 100%;
            margin-bottom: 10px;
        }

        .halfWidth {
            width: 49%;
            display: inline-block;
        }

        .labelbox {
            background-color: black;
            border: 0px border-color: #000000;
            margin-top: 0px;
            width: 320px;
            padding-bottom: 1.905cm;
            padding-left: 1.905cm padding-top: 200px;
            height: 3.175cm;
            width: 6.35cm;
        }
        </style>
    </head>

    <body padding="0.75in 0.75in 0.75in 0.75in" size="Letter">
     <#assign customer = record.custrecord_customer?keep_after(" ")>
        <table>
            <tr>
                <!-- <td style="border:0px;font-size: 15pt">${record.name}</td> -->
                <td style="border:0px;padding-left:-3px;">
                    <table style="border:0px;">
                        <tr>
                            <td style="border:0px;font-size: 20pt;padding-left:-1px;color:#0f3a6b">TEST REPORT</td>
                        </tr>
                        <tr>
                            <td style="font-size:9pt;border:0px;">Test Report ID : ${record.name}</td>
                        </tr>
                    </table>
                </td>
                <td style="border:0px;"><img src="http://shopping.netsuite.com/core/media/media.nl?id=6772&c=5160728_SB1&h=b38e06807534ace9a679" style="height:50px;" /></td>
            </tr>
        </table>
        <table style="width:100%; padding-left: -3px;">
            <tr>
                <td style="border: 1px solid white;width:100%;"><b>Basic Information</b></td>
                <td align="right" style="border: 1px solid white;width:100%;"><b>Environment Information</b></td>
              
            </tr>
            <tr>
                <td style="border: 1px solid white;">
                    <table width="160%">
                        <tr>
                            <td style="width:35%;background-color:#D3D3D3">Date</td>
                            <td style="width:35%;background-color:#D3D3D3">Tester</td>
                            <td style="width:35%;background-color:#D3D3D3">SO#</td>
                        <td style="background-color:#D3D3D3;width:55%;">Customer</td>
                           <td style="width:45%;background-color:#D3D3D3">PO#</td>
                         
                        </tr>
                        <tr>
                          <td style="width:35%"><span align="left">${record.custrecord_date?string["MM/dd/yyyy"]}</span></td>
                          <td style="width:35%"><span align="left"><#if record.custrecord_tester?has_content><#if record.custrecord_tester?length > 10>${record.custrecord_tester?substring(0,10)}<#else>${record.custrecord_tester}</#if></#if></span></td>
                    <td style="width:35%"><#if record.custrecord_sales_order_no?has_content>${record.custrecord_sales_order_no?keep_after("Sales Order #")}</#if></td>
                        <td style="width:55%;"><label class="labels"><span align="left"> <#if record.custrecord_customer?has_content> <#if record.custrecord_customer?length > 20> ${customer?substring(0,20)}<#else> ${customer}</#if></#if></span></label></td>
                          <td style="width:45%;" ><label class="labels"><span align="left">${record.custrecord_purchase_order_no}</span></label></td>
                        </tr>
                    </table>
                </td>
                <td  style="border: 1px solid white;">
                 <table width="40%" align="right">
                        <tr>
                            <td style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3;width:25%;"> Temp (F)</td>
                            <td style="border-bottom: 0px;background-color:#D3D3D3;width:25%;">Humidity%</td>
                        </tr>
                        <tr>
                            <td style="border-right: 0px;width:25%;">${record.custrecord_local_temperature}</td>
                            <td style="border-right: 1px;width:25%;" >${record.custrecord_local_humidity}</td>
                        </tr>
                    </table>
                </td>
            </tr>
          
        </table>                          
       
       
       
        <table style="width:100%; padding-left: -3px;">
            <tr>
                <td style="border: 1px solid white;"><b>Identification Information</b>
                    <table>
                        <tr>
                            
                            <td style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3"><label class="labels">Manufacturer</label></td>
                            <td style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3"><label class="labels">Model No.</label></td>
                            <td style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3"><label class="labels">Poles</label></td>
                            <td style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3"><label class="labels">Frame Size</label></td>
                            <td style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3"><label class="labels">Voltage Max</label></td>
                            <td style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3"><label class="labels">AIC Rating</label></td>
                            <td style="border-bottom: 0px;background-color:#D3D3D3"><label class="labels">Trip Amp</label></td>
                        </tr>
                        <tr>
                         
                            <td style="border-right: 0px;"><label class="labels">${record.custrecord_manufactuerer}</label></td>
                            <td style="border-right: 0px;"><label class="labels">${record.custrecord_model_part_number}</label></td>
                            <td style="border-right: 0px;"><label class="labels">${record.custrecord_poles}</label></td>
                            <td style="border-right: 0px;"><label class="labels">${record.custrecord_frame}</label></td>
                            <td style="border-right: 0px;"><label class="labels">${record.custrecord_voltage_max}</label></td>
                            <td style="border-right: 0px;"><label class="labels">${record.custrecord_aic_rating}</label></td>
                            <td><label class="labels">${record.custrecord_trip_details}</label></td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        <table style="width:100%; padding-left: -3px;">
            <tr>
                <td style="border: 1px solid white;"><b>Accessories Test</b></td>
            </tr>
            <tr>
                <td style="border: 1px solid white;">
                    <table style="width:100%">
                        <tbody>
                            <tr>
                                <td style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3"></td>
                                <td style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3">Voltage</td>
                                <td style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3">Test Voltage</td>
                                <td style="border-bottom: 0px;background-color:#D3D3D3">Result</td>
                            </tr>
                            <tr>
                                <td class="labels" width="20%" style="border-right: 0px;">Shunt Trip</td>
                                <td style="border-right: 0px;">${record.custrecord_shunt_trip_voltage}</td>
                                <td style="border-right: 0px;">${record.custrecord_shunt_trip_test_voltage}</td>
                                <td>${record.custrecord_shunt_trip_result}</td>
                            </tr>
                        </tbody>
                    </table>
                </td>
               
                <td style="border: 1px solid white;">
                    <table style="width:100%">
                        <tbody>
                            <tr>
                                <td style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3"></td>
                                <td style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3">NO</td>
                                <td style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3">NC</td>
                                <td style="border-bottom: 0px;background-color:#D3D3D3">Result</td>
                            </tr>
                            <tr>
                                <td class="labels" width="20%" style="border-right: 0px;">Auxiliary</td>
                                <td style="border-right: 0px;">${record.custrecord_auxiliary_no}</td>
                                <td style="border-right: 0px;">${record.custrecord_auxiliary_nc}</td>
                                <td>${record.custrecord_auxiliary_result}</td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
        </table>
       
        <table style="width:100%;padding-right: 3px;">
            <tbody>
                <tr>
                    <td style="border-bottom: 0px; border-right: 0px; width:10%;background-color:#D3D3D3"></td>
                    <td style="border-bottom: 0px; border-right: 0px; width:40%;background-color:#D3D3D3">Description</td>
                    <td style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3">Test</td>
                    <td style="border-bottom: 0px;background-color:#D3D3D3">Result</td>
                </tr>
                <tr>
                    <td class="labels" style="border-bottom: 0px; border-right: 0px; width:10%;">Other</td>
                    <td style="border-bottom: 0px; border-right: 0px; width:40%;">${record.custrecord_other_1_description} </td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_other_1_test}</td>
                    <td style="border-bottom: 0px;">${record.custrecord_other_1_result}</td>
                </tr>
                <tr>
                    <td class="labels" width="20%" style="border-bottom: 0px; border-right: 0px;width:10%;">Other</td>
                    <td style="border-bottom: 0px; border-right: 0px; width:40%;">${record.custrecord_other_2_description}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_other_2_test}</td>
                    <td style="border-bottom: 0px;">${record.custrecord_other_2_result}</td>
                </tr>
                <tr>
                    <td class="labels" width="20%" style="border-right: 0px;width:10%;">Other</td>
                    <td style="border-right: 0px; width:40%;">${record.custrecord_other_3_description}</td>
                    <td style="border-right: 0px;">${record.custrecord_other_3_test}</td>
                    <td>${record.custrecord_other_3_result}</td>
                </tr>
            </tbody>
        </table>
        <!-- <h6>Current Test</h6> -->
        <table style="width:100%;padding-right: 3px;">
            <tbody>
                <tr>
                    <td style="border: 1px solid white; padding-left: -3px;"><b>Current Test</b></td>
                </tr>
                <tr>
                    <td style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3"></td>
                    <td style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3"></td>
                    <td colspan="3" align="center" style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3">Current Result</td>
                    <td colspan="3" align="center" style="border-bottom: 0px;background-color:#D3D3D3">Trip Time</td>
                </tr>
                <tr>
                    <td align="center" style="border-bottom: 0px; border-right: 0px;">Function</td>
                    <td align="center" style="border-bottom: 0px; border-right: 0px;">Current Setting</td>
                    <td align="center" style="border-bottom: 0px; border-right: 0px;">A</td>
                    <td align="center" style="border-bottom: 0px; border-right: 0px;">B</td>
                    <td align="center" style="border-bottom: 0px; border-right: 0px;">C</td>
                    <td align="center" style="border-bottom: 0px; border-right: 0px;">A</td>
                    <td align="center" style="border-bottom: 0px; border-right: 0px;">B</td>
                    <td align="center" style="border-bottom: 0px;">C</td>
                </tr>
                <tr>
                    <td style="border-bottom: 0px; border-right: 0px;font-size: 7pt">Long Time Trip</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_long_time_trip_setting}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_long_time_current_a}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_long_time_current_b}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_long_time_current_c}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_long_time_trip_trip_time_a}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_long_time_trip_trip_time_b}</td>
                    <td style="border-bottom: 0px;">${record.custrecord_long_time_trip_trip_time_c}</td>
                </tr>
                <tr>
                    <td style="border-bottom: 0px; border-right: 0px;font-size: 7pt">Long Time Delay</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_long_time_delay_setting}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_long_time_delay_current_a}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_long_time_delay_current_b}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_long_time_delay_current_c}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_long_time_delay_trip_time_a}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_long_time_delay_trip_time_b}</td>
                    <td style="border-bottom: 0px;">${record.custrecord_long_time_delay_trip_time_c}</td>
                </tr>
                <tr>
                    <td style="border-bottom: 0px; border-right: 0px;font-size: 7pt">Short Time Trip</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_short_time_trip_setting}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_short_time_trip_current_a}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_short_time_trip_current_b}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_short_time_trip_current_c}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_short_time_trip_time_a}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_short_time_trip_time_b}</td>
                    <td style="border-bottom: 0px;">${record.custrecord_short_time_trip_time_c}</td>
                </tr>
                <tr>
                    <td style="border-bottom: 0px; border-right: 0px;font-size: 7pt">Short Time Delay</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_short_time_delay_setting}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_short_time_delay_current_a}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_short_time_delay_current_c}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_short_time_delay_current_c}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_short_time_delay_trip_a}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_short_time_delay_trip_b}</td>
                    <td style="border-bottom: 0px;">${record.custrecord_short_time_delay_trip_c}</td>
                </tr>
                <tr>
                    <td style="border-bottom: 0px; border-right: 0px;font-size: 7pt">Instantaneous Trip</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_instantaneous_trip_setting}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_instantaneous_current_a}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_instantaneous_current_b}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_instantaneous_current_c}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_instantaneous_trip_time_a}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_instantaneous_trip_time_b}</td>
                    <td style="border-bottom: 0px;">${record.custrecord_instantaneous_trip_time_c}</td>
                </tr>
                <tr>
                    <td style="border-bottom: 0px; border-right: 0px;font-size: 7pt">Ground Fault Trip</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_ground_fault_trip_setting}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_ground_fault_trip_current_a}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_ground_fault_trip_current_b}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_ground_fault_trip_current_c}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_ground_fault_trip_trip_time_a}</td>
                    <td style="border-bottom: 0px; border-right: 0px;">${record.custrecord_ground_fault_trip_trip_time_b}</td>
                    <td style="border-bottom: 0px;">${record.custrecord_ground_fault_trip_trip_time_c}</td>
                </tr>
                <tr>
                    <td style="border-right: 0px;font-size: 7pt">Ground Fault Delay</td>
                    <td style="border-right: 0px;">${record.custrecord_ground_fault_delay_setting}</td>
                    <td style="border-right: 0px;">${record.custrecord_ground_fault_delay_current_a}</td>
                    <td style="border-right: 0px;">${record.custrecord_ground_fault_delay_current_b}</td>
                    <td style="border-right: 0px;">${record.custrecord_ground_fault_delay_current_c}</td>
                    <td style="border-right: 0px;">${record.custrecord_ground_fault_delay_trip_time_}</td>
                    <td style="border-right: 0px;">${record.custrecord_ground_fault_delay_trip_timeb}</td>
                    <td style="">${record.custrecord_ground_fault_delay_delay_trip}</td>
                </tr>
            </tbody>
        </table>
        <table style="border: 1px solid white; padding-left: -5px;">
            <tr>
                <td style="border: 1px solid white;">
                    <!-- <h6>Resistance Test</h6> -->
                    <table style="width:100%; border: 1px solid white;">
                        <tbody>
                            <tr>
                                <td style="border: 1px solid white; padding-left: -3px;"><b>Resistance Test</b></td>
                            </tr>
                            <tr>
                                <td align="center" style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3">A</td>
                                <td align="center" style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3">B</td>
                                <td align="center" style="border-bottom: 0px;background-color:#D3D3D3">C</td>
                            </tr>
                            <tr>
                                <td style="border-right: 0px;">${record.custrecord_resistance_test}</td>
                                <td style="border-right: 0px;">${record.custrecord_resistance_test_b}</td>
                                <td>${record.custrecord_resistance_test_c}</td>
                            </tr>
                        </tbody>
                    </table>
                </td>
                <td style="border: 1px solid white; padding-left: -3px;">
                    <!-- <h6>Insulation Test</h6> -->
                    <table style="width:100%; border: 1px solid white;">
                        <tbody>
                            <tr>
                                <td style="border: 1px solid white;" colspan="2"><b>Insulation Test</b></td>
                            </tr>
                            <tr>
                                <td align="center" style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3">A-B</td>
                                <td align="center" style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3">A-C</td>
                                <td align="center" style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3">B-C</td>
                                <td align="center" style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3">A-G</td>
                                <td align="center" style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3">B-G</td>
                                <td align="center" style="border-bottom: 0px;background-color:#D3D3D3">C-G</td>
                            </tr>
                            <tr>
                                <td style="border-right: 0px;">${record.custrecord_insulation_test_a_b}</td>
                                <td style="border-right: 0px;">${record.custrecord_insulation_test_a_c}</td>
                                <td style="border-right: 0px;">${record.custrecord_insulation_test_b_c}</td>
                                <td style="border-right: 0px;">${record.custrecord_insulation_test_a_g}</td>
                                <td style="border-right: 0px;">${record.custrecord_insulation_test_b_g}</td>
                                <td>${record.custrecord_insulation_test_c_g}</td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
        </table>
           <table style="width:100%; border: 1px solid white;">
                        <tbody>
                            <tr>
                                <td style="border: 1px solid white;" colspan="2"><b>Visual Inspection</b></td>
                            </tr>
                            <tr>
                                <td align="center" style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3">Frame</td>
                                <td align="center" style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3">Lugs</td>
                                <td align="center" style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3">Arc Chute</td>
                                <td align="center" style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3">Phase Separators</td>
                                <td align="center" style="border-bottom: 0px; border-right: 0px;background-color:#D3D3D3">Contacts</td>
                                <td align="center" style="border-bottom: 0px;background-color:#D3D3D3">Accessories</td>
                            </tr>
                            <tr>
                                <td style="border-right: 0px;">${record.custrecord_frame_inspected}</td>
                                <td style="border-right: 0px;">${record.custrecord_lugs}</td>
                                <td style="border-right: 0px;">${record.custrecord_arc_chute}</td>
                                <td style="border-right: 0px;">${record.custrecord_phase_seperators}</td>
                                <td style="border-right: 0px;">${record.custrecord_contacts}</td>
                                <td>${record.custrecord_accessories}</td>
                            </tr>
                        </tbody>
                    </table>
             
        
             
     
    </body>
</pdf>

Advanced PDF template For Print label

<?xml version="1.0"?>
<!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">
<pdf>

    <head>
        <link name="NotoSans" type="font" subtype="truetype" src="${nsfont.NotoSans_Regular}" src-bold="${nsfont.NotoSans_Bold}" src-italic="${nsfont.NotoSans_Italic}" src-bolditalic="${nsfont.NotoSans_BoldItalic}" bytes="2" />
        <#if .locale=="zh_CN">
            <link name="NotoSansCJKsc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKsc_Regular}" src-bold="${nsfont.NotoSansCJKsc_Bold}" bytes="2" />
            <#elseif .locale=="zh_TW">
                <link name="NotoSansCJKtc" type="font" subtype="opentype" src="${nsfont.NotoSansCJKtc_Regular}" src-bold="${nsfont.NotoSansCJKtc_Bold}" bytes="2" />
                <#elseif .locale=="ja_JP">
                    <link name="NotoSansCJKjp" type="font" subtype="opentype" src="${nsfont.NotoSansCJKjp_Regular}" src-bold="${nsfont.NotoSansCJKjp_Bold}" bytes="2" />
                    <#elseif .locale=="ko_KR">
                        <link name="NotoSansCJKkr" type="font" subtype="opentype" src="${nsfont.NotoSansCJKkr_Regular}" src-bold="${nsfont.NotoSansCJKkr_Bold}" bytes="2" />
                        <#elseif .locale=="th_TH">
                            <link name="NotoSansThai" type="font" subtype="opentype" src="${nsfont.NotoSansThai_Regular}" src-bold="${nsfont.NotoSansThai_Bold}" bytes="2" />
        </#if>
        <style type="text/css">
      table {
            font-size: 9pt;
            table-layout: absolute;
            page-break-inside: avoid;
          	align: center;
          border-collapse: collapse;
   			 border-spacing: 0;
        }


        b {
            font-weight: bold;
            color: #333333;
        }

        </style>
    </head>

    <body style="width:2.25in; height:1.25in;" padding="0.075in 0.05in 0.05in 0.075in">
                    <#assign aDateTime=.now>
                        <#assign aDate=aDateTime?date>
                            <#assign aTime=aDateTime?time>
                             <table align="center" width="100%" style="padding-bottom:5px;" >
                               
                                             <tr>
                                                    <td><br/>Date : ${aDate?string["MM/dd/yyyy"]}</td>
                                                </tr>

                                                <tr>
                                                  <td><p align="left">Test Report ID : ${record.name}</p></td>
                                                </tr>
                                                <tr>
                                                    <td>Result : ${record.custrecord_final_result}  </td>
                                                </tr>
                                                <tr>
                                                    <td>www.alliedpowerandcontrol.com</td>
                                                </tr>
                                            </table>
    </body>
</pdf>

Suitelet


/**
 * @NApiVersion 2.x
 * @NScriptType Suitelet
 * @NModuleScope SameAccount
 */
/*******************************************************************************
* CLIENTNAME:Allied Power and Control
* APC-24
* Print Label
* **************************************************************************
* Date : 25-05-2019
*
* Author: Jobin & Jismi IT Services LLP
* Script Description : This script is to render the label PDF in  Test report.
* Date created : 25-05-2019
*
* REVISION HISTORY
*
* Revision 1.0 ${25-05-2019} nd :marg created
* 
*
******************************************************************************/
define(['N/file','N/render','N/record','N/search'],

function(file,render,record,search) {
   
    function onRequest(context) {
        try{
             var internalId = context.request.parameters.rec_id;
          			     var type = context.request.parameters.rec_type;
            			  log.debug('type',type)
            
          				   var objRecord = record.load({
                  		   type: type, 
                 		   id: internalId
             			   });

             			   var myFile = render.create();

                        var template = 122;
                        myFile.setTemplateById(template);


                        myFile.addRecord({
                            templateName: 'record',
                            record: objRecord
                        });
                        
                        var transactionFile = myFile.renderAsPdf();

                        context.response.writeFile(transactionFile, true);
                   


        }catch(error){
            log.error('error @ onRequest',error)
        }

    }

    return {
        onRequest: onRequest
    };
    
});




User Event

/**
 * @NApiVersion 2.x
 * @NScriptType UserEventScript
 * @NModuleScope SameAccount
 */
/*******************************************************************************
* CLIENTNAME:Allied Power and Control
* APC-24
* Print Label
* **************************************************************************
* Date : 25-05-2019
*
* Author: Jobin & Jismi IT Services LLP
* Script Description : This script is to add a button in Test report to print the Label.
* Date created : 25-05-2019
*
* REVISION HISTORY
*
* Revision 1.0 ${25-05-2019} nd :marg created
* 
*
******************************************************************************/
define([],

function() {
   
    
    function beforeLoad(scriptContext) {

    	try{
    		var itemRec =  scriptContext.form;
    	 scriptContext.form.clientScriptFileId = 28313;
        	 if(scriptContext.type == 'view'){
        		
        		 var button = itemRec.addButton({
             		id: 'custpage_printlabel',
             		label :'Print Label',
             		 functionName: 'printbuttonClick'
             	 });
     		}
    	}catch(err){
    		log.debug('error @ beforeLoad',err)
    	}
    	

    

    }

   

    return {
        beforeLoad: beforeLoad
    };
    
});

Client Script


/*******************************************************************************
* CLIENTNAME:Allied Power and Control
* APC-24
* Print Label
* **************************************************************************
* Date : 25-05-2019
*
* Author: Jobin & Jismi IT Services LLP
* Script Description : This script is define the action of print Button in Test report.
* Date created : 25-05-2019
*
* REVISION HISTORY
*
* Revision 1.0 ${25-05-2019} nd :marg created
* 
*
******************************************************************************/
define(['N/currentRecord','N/url'],

function(currentRecord,url) {
    
   

    function printbuttonClick(){
    	try{
    		var record = currentRecord.get();
    		var rec_id = record.id;
			var rec_type = record.type;
            console.log('rec_type',rec_type)
            
    		get_url = url.resolveScript({
	    		scriptId: "customscript_jj_apc_24_sl_print_label",
	           deploymentId: "customdeploy_jj_apc_sl_print_label"
	        });	
   		 	
	     get_url += ('&rec_id=' + rec_id + '&rec_type=' + rec_type);
	        window.open(get_url);
    		
    	}catch(er){
    		console.log('error at printbuttonClick',er)
    	}
	}
	

    

    return {
		 printbuttonClick:printbuttonClick
				 
    };
    
});

Leave a comment

Your email address will not be published. Required fields are marked *