Advertisement
asrulsibaoel

pagebreak CSS

Oct 4th, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  1. <div id='printableArea'>
  2. <style type="text/css" media="print">
  3. .table td {
  4. padding: 0px !important;
  5. margin: 0px !important;
  6.  
  7. }
  8. .table tr{
  9. padding : 0px !important;
  10. margin : 0px !important;
  11. page-break-after: always;
  12. page-break-inside: avoid;
  13. }
  14. body {font-size:7.5pt;}
  15.  
  16. </style>
  17. <table width="100%">
  18. <tr>
  19. <td></td>
  20. <td></td>
  21. <td style="text-align: center" colspan="2"><h2>KARTU HUTANG REPORT</h2>
  22. <?php echo date('d F Y', strtotime($start)) . " - " . date('d F Y', strtotime($end)); ?>
  23. <hr></td>
  24. </tr>
  25.  
  26. </table>
  27.  
  28. <table class="table table-bordered" style="border-collapse: separate" border="1">
  29. <thead>
  30. <tr>
  31. <th colspan="2" width="5%"><p align="center">Date</p></th>
  32. <th width="25%"><p align="center">Description</p></th>
  33. <th width="5%"><p align="center">Reff</p></th>
  34. <th width="5%"><p align="center">Invoice</p></th>
  35. <th width="20%"><p align="center">Debet</p></th>
  36. <th width="20%"><p align="center">Credit</p></th>
  37. <th width="20%"><p align="center">Saldo</p></th>
  38. </tr>
  39.  
  40.  
  41. </thead>
  42. <tr>
  43. <?php
  44. $balance = AccCoaDet::model()->saldoKartu(date('Y-m-d', strtotime($start)), $id);
  45. ?>
  46. <th></th>
  47. <th></th>
  48. <th>Saldo Awal</th>
  49. <th></th>
  50. <th></th>
  51. <th></th>
  52. <th></th>
  53. <th style="text-align:right;"><?php echo landa()->rp($balance); ?></th>
  54. </tr>
  55. <?php
  56. $total = 0;
  57. $monthYear = "";
  58. $i = 0;
  59. $saldo = $balance;
  60. $tDebet = 0;
  61. $tCredit = 0;
  62. foreach ($accCoaDet as $a) {
  63. $sDate = ($monthYear == date('M Y', strtotime($a->date_coa))) ? "" : date('M Y', strtotime($a->date_coa));
  64. $monthYear = date('M Y', strtotime($a->date_coa));
  65.  
  66. $saldo = $saldo + $a->debet - $a->credit;
  67. $tDebet += $a->debet;
  68. $tCredit += $a->credit;
  69. echo '<tr>
  70. <td>' . $sDate . '</td>
  71. <td>' . date('d', strtotime($a->date_coa)) . '</td>
  72. <td>' . $a->description . '</td>
  73. <td>' . $a->code . '</td>
  74. <td>' . $a->InvoiceDet->code . '</td>
  75. <td name="deb" style="text-align:right">' . landa()->rp($a->debet, false) . ',- </td>
  76. <td name="cred" style="text-align:right">' . landa()->rp($a->credit, false) . ',- </td>
  77. <td name="tdeb" style="text-align:right">' . landa()->rp($saldo) . ',- </td>
  78. </tr>';
  79. }
  80. ?>
  81. <tfoot>
  82. <tr>
  83. <th colspan="5">Saldo Akhir</th>
  84. <th style="text-align: right;"><?php echo landa()->rp($tDebet, false) . ',-' ?></th>
  85. <th style="text-align: right;"><?php echo landa()->rp($tCredit, false) . ',-' ?></th>
  86. <th style="text-align: right;"><?php echo landa()->rp($saldo, false) . ',-' ?></th>
  87. </tr>
  88. </tfoot>
  89. </table>
  90. </div>
  91.  
  92.  
  93. <script type="text/javascript">
  94. function printDiv(divName) {
  95. var printContents = document.getElementById(divName).innerHTML;
  96. var originalContents = document.body.innerHTML;
  97. document.body.innerHTML = printContents;
  98. window.print();
  99. document.body.innerHTML = originalContents;
  100. }
  101. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement