Advertisement
Guest User

ShipX Sample Incentive Voucher

a guest
May 31st, 2021
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 8.31 KB | None | 0 0
  1. <html>
  2. <head>
  3.   <script src="https://unpkg.com/pagedjs/dist/paged.polyfill.js"></script>
  4.   <style>
  5.     @page {
  6.       margin: 9cm 1.5cm 3cm 1.5cm;
  7.       size: A4;
  8.       font-size: 9pt;
  9.       font-family: Arial;
  10.       @top-center {
  11.         content: element(header);
  12.         vertical-align: center;
  13.       }
  14.       @bottom-left {
  15.         content: "Page "counter(page) "/"counter(pages);
  16.         width: 3cm;
  17.         font-size: 8pt;
  18.         content: element(footer);
  19.       }
  20.       @bottom-right {
  21.         content: "Printed: {{todayDate}}";
  22.         width: 4cm;
  23.         font-size: 8pt;
  24.       }
  25.     }
  26.     #page_header {
  27.       position: running(header);
  28.     }
  29.     body {}
  30.     table {
  31.       border-collapse: collapse;
  32.     }
  33.     table * {
  34.       font-weight: normal;
  35.       font-size: 9pt;
  36.       vertical-align: top;
  37.     }
  38.     #paper {
  39.       font-size: 9pt;
  40.     }
  41.     #company_header {
  42.       text-align: center;
  43.       margin-bottom: 1em;
  44.     }
  45.     #company_header h1 {
  46.       margin-bottom: 1.4em;
  47.     }
  48.     #document_title {
  49.       text-align: center;
  50.       font-weight: bold;
  51.       font-size: 12pt;
  52.       margin-bottom: 2em;
  53.     }
  54.     #invoice_info {
  55.       margin-bottom: 1em;
  56.     }
  57.     #page_header_invoice_info {
  58.       display: flex;
  59.       flex-direction: row;
  60.       justify-content: space-between;
  61.       padding: 1em 0em;
  62.     }
  63.     #page_header_right_column {
  64.       display: flex;
  65.       flex-direction: column;
  66.     }
  67.     #page_header_left_column {
  68.       display: flex;
  69.       flex-direction: column;
  70.       margin-right: 20px;
  71.     }
  72.     table td {
  73.       padding: 3px;
  74.     }
  75.   </style>
  76. </head>
  77. <body>
  78.   <div id="page_header">
  79.     <div id="company_header">
  80.       <h1>TANJONG EXPRESS (M) SDN BHD</h1>
  81.     </div>
  82.     <div id="document_title">
  83.       Incentive Voucher
  84.     </div>
  85.     <div id="page_header_invoice_info">
  86.       <div id='page_header_left_column'>
  87.         <div style="display: flex; flex-direction: row;padding: 0.5em 0em;">
  88.           <div style="display: flex;width: 80px;justify-content: space-between;">
  89.             <span>Driver(s)</span>
  90.             <span>:</span>
  91.           </div>
  92.           <span style="margin-left: 10px;margin-right: 10px; text-align: left;">{{driversArray}}</span>
  93.         </div>
  94.         <div style="display: flex; flex-direction: row;padding: 0.5em 0em;">
  95.           <div style="display: flex;width: 80px;justify-content: space-between;">
  96.             <span>Vehicle(s)</span>
  97.             <span>:</span>
  98.           </div>
  99.           <span style="margin-left: 10px;text-align: left;">{{vehiclesArray}}</span>
  100.         </div>
  101.       </div>
  102.       <div id='page_header_right_column'>
  103.         <div style="display: flex; flex-direction: row;padding: 0.5em 0em;">
  104.           <div style="display: flex;width: 80px;justify-content: space-between;">
  105.             <span>Date</span>
  106.             <span>:</span>
  107.           </div>
  108.           <span style="margin-left: 10px;">{{date}}</span>
  109.         </div>
  110.         <div style="display: flex; flex-direction: row;padding: 0.5em 0em;">
  111.           <div style="display: flex;width: 80px;justify-content: space-between;">
  112.             <span>Voucher No</span>
  113.             <span>:</span>
  114.           </div>
  115.           <span style="margin-left: 10px;">{{voucherNo}}</span>
  116.         </div>
  117.       </div>
  118.     </div>
  119.   </div>
  120.   <div id='page_body'>
  121.     <h4 style="text-align: left;">Summary</h4>
  122.     <table style="width:100%;">
  123.       <thead>
  124.         <tr style="text-align:left;border-bottom: 1px solid black;border-top: 1px solid black;">
  125.           <th style="text-align: left;font-weight: bold;width: 100px;">Code</th>
  126.           <th style="text-align: left;font-weight: bold;">Desc</th>
  127.           <th style="text-align: right;font-weight: bold;width: 150px;">Incentive</th>
  128.           <th style="text-align: right;font-weight: bold;width: 150px;">Expenses</th>
  129.         </tr>
  130.       </thead>
  131.       <tbody>
  132.         {{#each summary}}
  133.         <tr>
  134.           <td style="text-align: left;">{{ code }}</td>
  135.           <td style="text-align: left;">{{ name }}</td>
  136.           {{#each categorySum}}
  137.           <td style="text-align: right;">{{ this }}</td>
  138.           {{/each }}
  139.         </tr>
  140.         {{/each }}
  141.       </tbody>
  142.       <tr style="border-top: 1px solid black;border-bottom: 1px solid black;border-top: 1px solid black;">
  143.         <td style="font-weight: bold;text-align: left;">Total:</td>
  144.         <td></td>
  145.         <td style="font-weight: bold;text-align: right;">{{totals.[0]}}</td>
  146.         <td style="font-weight: bold;text-align: right;">{{totals.[1]}}</td>
  147.       </tr>
  148.     </table>
  149.     <h4 style="text-align: left;margin-top: 2em;">Jobs</h4>
  150.     <table style="width:100%;">
  151.       <tr style="text-align:left;border-bottom: 1px solid black;border-top: 1px solid black;">
  152.         <th style="text-align: left;font-weight: bold;width: 100px;">Date</th>
  153.         <th style="text-align: left;font-weight: bold;width: 150px;">Desc</th>
  154.         <th style="text-align: left;font-weight: bold;">Pickup - Drop</th>
  155.         <th style="text-align: right;font-weight: bold;width: 150px;">Incentive</th>
  156.         <th style="text-align: right;font-weight: bold;width: 150px;">Expenses</th>
  157.       </tr>
  158.       {{#each jobs}}
  159.       <tr>
  160.         <td style="text-align: left;">{{ date }}</td>
  161.         <td style="text-align: left;">{{ description }}</td>
  162.         <td style="text-align: left;">{{ pickUpDrop }}</td>
  163.         {{#each categorySum}}
  164.         <td style="text-align: right;">{{ this }}</td>
  165.         {{/each }}
  166.       </tr>
  167.       {{/each }}
  168.       <tr style="border-top: 1px solid black;border-bottom: 1px solid black;border-top: 1px solid black;">
  169.         <td style="font-weight: bold;text-align: left;">Total:</td>
  170.         <td></td>
  171.         <td></td>
  172.         <td style="font-weight: bold;text-align: right;">{{totals.[0]}}</td>
  173.         <td style="font-weight: bold;text-align: right;">{{totals.[1]}}</td>
  174.       </tr>
  175.     </table>
  176.     <h4 style="text-align: left;margin-top: 2em;">Details</h4>
  177.     <table style="width:100%;">
  178.       <tr style="text-align:left;border-bottom: 1px solid rgb(126, 124, 124);border-top: 1px solid black;">
  179.         <th style="text-align: left;font-weight: bold;width: 100px;">Date</th>
  180.         <th style="text-align: left;font-weight: bold;width: 150px;">Code</th>
  181.         <th style="text-align: left;font-weight: bold;">Desc</th>
  182.         <th style="text-align: right;font-weight: bold;width: 150px;">Incentive</th>
  183.         <th style="text-align: right;font-weight: bold;width: 150px;">Expenses</th>
  184.       </tr>
  185.       {{#each incentives}}
  186.       <tr>
  187.         <td style="text-align: left;">{{ date }}</td>
  188.         <td style="text-align: left;">{{ code }}</td>
  189.         <td style="text-align: left;">{{ description }}</td>
  190.         <td style="text-align: right;">{{categorySum.[0]}}</td>
  191.         <td style="text-align: right;">{{categorySum.[1]}}</td>
  192.       </tr>
  193.       {{/each }}
  194.       <tr style="border-top: 1px solid black;border-bottom: 1px solid black;border-top: 1px solid black;">
  195.         <td style="font-weight: bold;text-align: left;">Total:</td>
  196.         <td></td>
  197.         <td></td>
  198.         <td style="font-weight: bold;text-align: right;">{{totals.[0]}}</td>
  199.         <td style="font-weight: bold;text-align: right;">{{totals.[1]}}</td>
  200.       </tr>
  201.     </table>
  202.   </div>
  203.   <script>
  204.     class RepeatingTableHeaders extends Paged.Handler {
  205.       constructor(chunker, polisher, caller) {
  206.         super(chunker, polisher, caller);
  207.       }
  208.       afterPageLayout(pageElement, page, breakToken, chunker) {
  209.         // Find all split table elements
  210.         let tables = pageElement.querySelectorAll("table[data-split-from]");
  211.         tables.forEach((table) => {
  212.           // Get the reference UUID of the node
  213.           let ref = table.dataset.ref;
  214.           // Find the node in the original source
  215.           let sourceTable = chunker.source.querySelector("[data-ref='" + ref + "']");
  216.           // Find if there is a header
  217.           let header = sourceTable.querySelector("thead");
  218.           if (header) {
  219.             // Clone the header element
  220.             let clonedHeader = header.cloneNode(true);
  221.             // Insert the header at the start of the split table
  222.             table.insertBefore(clonedHeader, table.firstChild);
  223.           }
  224.         });
  225.       }
  226.     }
  227.     Paged.registerHandlers(RepeatingTableHeaders);
  228.   </script>
  229. </body>
  230. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement