<style>
    .print-format {
        padding-left: 10mm;
        padding-right: 5mm;
        padding-top: 0mm;
        font-size: 13pt;	
        font-family: Arial, Helvetica, sans-serif;
     }
     
     .print-format td, .print-format th {
        vertical-align: top !important;
        padding: 2px !important;
     
     }

     @media screen {
	      .print-format {
		        width: 8.5in;
		        height: 11in;
		    }
	  }
     
     .table-bordered > thead > tr > th.no-line {
     border:border: 1px solid black; !important;
     border-right: none !important;
     border-left: none !important;
     border-top: none !important;
     border-right-style: none !important;
     border-left-style: none !important;
     }
     
     .table-bordered{
       border:none;
     }
    </style>
    {% var start_date = filters.from_date  %}
    {% var end_date = filters.to_date  %}
    {% var tin = data[0][ __("TIN")]  %}
    
    {% if ( end_date[5]+ end_date[6] == "06") { %}
    {% var tick1 = "X" %}
    {% } %}
    
    {% if ( end_date[5]+ end_date[6] == "12") { %}
    {% var tick2 = "X" %}
    {% } %}

    <table cellspacing=0 cellpadding=0 style="border: 0px solid black;">
      <colgroup>
        <col style="width: 50%" />
        <col style="width: 50%" />
      </colgroup>
      <tbody>
          <tr>
            <td colspan="2">
              <p class="manifest-header text-center">
                <img src="/files/tra-logo.gif" style="width: 35% !important;"/>
                <br><br>
                <p style="font-size: 14pt; font-family: Arial, Helvetica, sans-serif; font-weight: bold; text-align: center;">
                  WITHHOLDING TAXES
                </p>
                <p style="font-size: 14pt; font-family: Arial, Helvetica, sans-serif; font-weight: bold;text-align: center">
                  STATEMENT AND PAYMENT OF TAX WITHHELD
                </p>
                <p style="font-size: 10pt; font-family: Arial, Helvetica, sans-serif; font-weight: bold;text-align: center">
                  (Please, read the notes carefully before filling the form.)
                </p>
              </p>
            </td>
          </tr>
          <tr>
            <td></td>
            <td>
              <table>
                <colgroup>
                  <col width="70">
                  <col width="35">
                  <col width="35">
                  <col width="35">
                  <col width="35">
                </colgroup>
                <tbody >
                  <tr>
                    <td width=30 style="font-size: 14pt; font-family: Arial, Helvetica, sans-serif; font-weight: bold;">YEAR</td>
                    <td style="vertical-align: middle !important; font-weight: bold; border: 1px solid black; text-align: center;">{%= start_date[0] %}</td>
                    <td style="vertical-align: middle !important; font-weight: bold; border: 1px solid black; text-align: center;">{%= start_date[1] %}</td>
                    <td style="vertical-align: middle !important; font-weight: bold; border: 1px solid black; text-align: center;">{%= start_date[2] %}</td>
                    <td style="vertical-align: middle !important; font-weight: bold; border: 1px solid black; text-align: center;">{%= start_date[3] %}</td>
                  </tr>
                </tbody>
              </table>
              <br>
              <table>
                <colgroup>
                  <col width="70">
                  <col width="30">
                  <col width="30">
                  <col width="30">
                  <col width="30">
                  <col width="30">
                  <col width="30">
                  <col width="30">
                  <col width="30">
                  <col width="30">
                  <col width="30">
                  <col width="30">
                </colgroup>
                <tbody>
                <tr>
                  <td width=30 style="font-size: 14pt; font-family: Arial, Helvetica, sans-serif; font-weight: bold;">TIN</td>
                  <td style="vertical-align: middle !important; font-weight: bold; border: 1px solid black; text-align: center;">{%= tin[0] %}</td>
                  <td style="vertical-align: middle !important; font-weight: bold; border: 1px solid black; text-align: center;">{%= tin[1] %}</td>
                  <td style="vertical-align: middle !important; font-weight: bold; border: 1px solid black; text-align: center;">{%= tin[2] %}</td>
                  <td style="vertical-align: middle !important; font-weight: bold; border: 1px solid black; text-align: center; background-color: #000;"></td>
                  <td style="vertical-align: middle !important; font-weight: bold; border: 1px solid black; text-align: center;">{%= tin[4] %}</td>
                  <td style="vertical-align: middle !important; font-weight: bold; border: 1px solid black; text-align: center;">{%= tin[5] %}</td>
                  <td style="vertical-align: middle !important; font-weight: bold; border: 1px solid black; text-align: center;">{%= tin[6] %}</td>
                  <td style="vertical-align: middle !important; font-weight: bold; border: 1px solid black; text-align: center; background-color: #000;"></td>
                  <td style="vertical-align: middle !important; font-weight: bold; border: 1px solid black; text-align: center;">{%= tin[8] %}</td>
                  <td style="vertical-align: middle !important; font-weight: bold; border: 1px solid black; text-align: center;">{%= tin[9] %}</td>
                  <td style="vertical-align: middle !important; font-weight: bold; border: 1px solid black; text-align: center;">{%= tin[10] %}</td>
                </tr>
                </tbody>
              </table>      
            </td>
          </tr>
          <tr>
            <td colspan="2">
              <b>Period: </b><small style="font-size: 70% !important;"><b>(Please tick the appropriate box)</b></small>
            </td>
          </tr>
          <tr>
            <td colspan="2">
              <table style="border-collapse:separate; border-spacing:0 15px;" >
                <colgroup>
                  <col width="32">
                  <col width="400">
                <tbody >
                <tr>
                  <td style="border: 1px solid black; text-align: center;">{%= tick1 %}</td>
                  <td><font style="font-weight: bold;">From 1 January to 30 June</font></td>
                </tr>
                <tr>
                  <td style="border: 1px solid black; text-align: center;">{%= tick2 %}</td>
                  <td><font style="font-weight: bold;">From 1 July to 31 December</font></td>
                </tr>
                </tbody>
              </table>
          </tr>
          <tr>
            <td colspan="2">
              <table width="100%" style="border-collapse:separate; border-spacing:0 15px;" >
                <colgroup>
                  <col width="40%">
                  <col width="50%">
                <tbody >
                  <tr>
                    <td><font style="font-weight: bold;">WITHHOLDING TAX ON</font></td>
                    <td style="font-weight: bold; border: 1px solid black; text-align: left;">{%= data[0][ __("Withholding Type")] %}</td>
                  </tr>
                </tbody>
              </table>
            </td>
          </tr>
          <tr>
            <td colspan="2">
              <b>Name of Withholder:</b>
            </td>
          </tr>
          <tr>
            <td colspan="2" style="border: 1px solid black;">
              {%= data[0][ __("Withholder")] %}
            </td>
          </tr>
          <tr>
            <td colspan="2" style="border: 0px solid black;">
              <table style="border-collapse:separate; border-spacing:0 3x; ">
                <colgroup>
                  <col width="200">
                  <col width="200">
                  <col width="200">
                  <col width="200">
                <tbody >
                <tr>
                  <td colspan=4><font style="font-weight: bold;">Postal Address:</font></td>
                </tr>
                <tr>
                  <td><font style="">P. O. Box</font></td>
                  <td style="border: 1px solid black; text-align: center;">{%= data[0][ __("P O Box")] %}</td>
                  <td><font style="">Postal Address</font></td>
                  <td style="border: 1px solid black; text-align: center;">&nbsp;</td>
                </tr>
                <tr>
                  <td colspan=4><font style="font-weight: bold;"><br>Contact Numbers:</font></td>
                </tr>
                <tr>
                  <td><font style="">Phone number</font></td>
                  <td style="border: 1px solid black; text-align: center;">{%= data[0][ __("Phone")] %}</td>
                  <td><font style="">Second Phone</font></td>
                  <td style="border: 1px solid black; text-align: center;">&nbsp;</td>
                </tr>
                <tr>
                  <td colspan=4></td>
                </tr>
                <tr>
                  <td><font style="">Third Phone</font></td>
                  <td style="border: 1px solid black; text-align: center;">&nbsp;</td>
                  <td><font style="">Fax number</font></td>
                  <td style="border: 1px solid black; text-align: center;">{%= data[0][ __("Fax Number")] %}</td>
                </tr>
                <tr>
                  <td colspan=4></td>
                </tr>
                <tr>
                  <td><font style="font-weight: bold;">E-mail address:</font></td>
                  <td style="border: 1px solid black; text-align: left;" colspan=3>{%= data[0][ __("Email")] %}</td>
                </tr>
                <tr>
                  <td colspan=4><font style="font-weight: bold;"><br>Physical Adddress:</font></td>
                </tr>
                <tr>
                  <td><font style="">Plot Number</font></td>
                  <td style="border: 1px solid black; text-align: center;">{%= data[0][ __("Plot Number")] %}</td>
                  <td><font style="">Block Number </font></td>
                  <td style="border: 1px solid black; text-align: center;">{%= data[0][ __("Block Number")] %}</td>
                </tr>
                <tr>
                  <td colspan=4></td>
                </tr>
                <tr>
                  <td><font style="font-weight: bold;">Street/Location</font></td>
                  <td style="border: 1px solid black; text-align: left;" colspan=3>{%= data[0][ __("Street")] %}</td>
                </tr>
                <tr>
                  <td colspan=4></td>
                </tr>
                <tr>
                  <td><font style="font-weight: bold;">Name of Branch</font></td>
                  <td style="border: 1px solid black; text-align: center;" colspan=3>&nbsp;</td>
                </tr>
                <tr>
                  <td colspan=4>
                    <font style="font-size: 60%; font-weight: bold; color: grey;">
                    <br><br><br><br>ITX 230.01.E – Withholding Tax Statement 
                    <!-- <br><center>Page 1 of 2</center> -->
                    </font>
                  </td>
                </tr>
                </tbody>
              </table>
            </td>
          </tr>
        </tbody>
    </table>
  <div class="page-break"></div>  
    <table cellspacing=0 cellpadding=0>
      <colgroup>
         <col style="width: 50%" />
         <col style="width: 50%" />
      </colgroup>
      <tbody>
        <tr>
          <td colspan="2" style="text-align: center;">
            <font style="font-size: 13pt; font-weight: bold;">
              WITHHOLDING TAX - DETAILS OF PAYMENT OF TAX WITHHELD<br><br>
            </font>
            <br>
          </td>
        </tr>
        <tr>
          <td style="border: 1px solid black; border:none !important;"">
            <font style="font-size: 80%; font-weight: normal; text-decoration: underline;">
              <b>Name of Withholder: </b>
              <u>{%= data[0][ __("Withholder")] %}</u>
            </font>
          </td>
          <td valign=middle style="vertical-align: top; border:none !important;" >
            <table>
              <colgroup>
                <col width="50">
                <col width="30">
                <col width="30">
                <col width="30">
                <col width="30">
                <col width="30">
                <col width="30">
                <col width="30">
                <col width="30">
                <col width="30">
                <col width="30">
                <col width="30">
              </colgroup>
              <tbody>
                <tr>
                  <td width=30 style="border:none !important;" ><strong>TIN</strong></td>
                  <td style="border: 1px solid black; text-align: center;">{%= tin[0] %}</td>
                  <td style="border: 1px solid black; text-align: center;">{%= tin[1] %}</td>
                  <td style="border: 1px solid black; text-align: center;">{%= tin[2] %}</td>
                  <td style="border: 1px solid black; text-align: center; background-color: #000;"></td>
                  <td style="border: 1px solid black; text-align: center;">{%= tin[4] %}</td>
                  <td style="border: 1px solid black; text-align: center;">{%= tin[5] %}</td>
                  <td style="border: 1px solid black; text-align: center;">{%= tin[6] %}</td>
                  <td style="border: 1px solid black; text-align: center; background-color: #000;"></td>
                  <td style="border: 1px solid black; text-align: center;">{%= tin[8] %}</td>
                  <td style="border: 1px solid black; text-align: center;">{%= tin[9] %}</td>
                  <td style="border: 1px solid black; text-align: center;">{%= tin[10] %}</td>
                </tr>
              </tbody>
            </table>
          </td>
        </tr>
      </tbody>
    </table>
    <TABLE cellspacing=0 cellpadding=0" class="table table-bordered" style="font-size: small !important;">
      <colgroup>
        <col width="5%">
        <col width="15%">
        <col width="15%">
        <col width="15%">
        <col width="15%">
        <col width="15%">
        <col width="15%">
      </colgroup>
      <THEAD>
        <TR>
          <TH style="text-align: center;">S/NO</TH>
          <TH style="text-align: center;">TIN</TH>
          <TH style="text-align: center;">NAME OF WITHHOLDEE</TH>
          <TH style="text-align: center;">POSTAL ADDRESS</TH>
          <TH style="text-align: center;">POSTAL CITY</TH>
          <TH style="text-align: center;">GROSS PAYMENT TZS</TH>
          <TH style="text-align: center;">TAX WITHHELD TZS</TH>
        </TR>
      </THEAD>
      <TBODY>
        {% 
          var post_add=0;
          var gross_total=0;
          var tax_withheld=0;
        %}
        {% for(var i=0, l=data.length; i<l; i++) { %} 
          {% if (i+1 != l) { %}
            <TR>
              {% 
                var gross_total = gross_total + data[i][ __("Gross Payment")];
                var tax_withheld = tax_withheld + data[i][ __("Tax Withheld")];
              %}
              <TD style="text-align: left; ">{%= i+1 %}</TD>
              <TD style="text-align: left; ">{%= data[i][ __("Withholdee TIN")] %}</TD>
              <TD style="text-align: left; ">{%= data[i][ __("Withholdee")] %}</TD>
              <TD style="text-align: left; ">{%= data[i][ __("Withholdee Post")] %}</TD>
              <TD style="text-align: left; ">{%= data[i][ __("Withholdee City")] %}</TD>
              <TD style="text-align: right; ">{%= data[i][ __("Gross Payment")].toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 0}) %}</TD>
              <TD style="text-align: right; ">{%= data[i][ __("Tax Withheld")].toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 0}) %}</TD>
            </TR>
          {% } else { %}
           <TR>
              <TH style="text-align: right;" colspan=5>TOTAL</TH>
              <TH style="text-align: right;">{%= gross_total.toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 0}) %}</TH>
              <TH style="text-align: right;">{%= tax_withheld.toLocaleString(undefined, {minimumFractionDigits: 0, maximumFractionDigits: 0}) %}</TH>
            </TR>
          {% } %}
        {% } %}     
      </TBODY>
    </TABLE>
