Advertisement
Guest User

Untitled

a guest
May 31st, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.40 KB | None | 0 0
  1. function tableDeposit($params=""){
  2.  
  3. global $s, $inp, $par, $arrTitle, $arrParameter, $menuAccess;
  4.  
  5. $text.="
  6.  
  7. <table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" class=\"stdtable stdtablequick\">
  8. <thead>
  9. <tr>
  10. <th ".$width.$array[0].">No.</th>
  11. <th ".$width.$array[1].">Tanggal</th>
  12. <th ".$width.$array[3].">Uraian</th>
  13. <th ".$width.$array[2].">Kredit</th>
  14. <th ".$width.$array[2].">Debet</th>
  15. <th ".$width.$array[2].">Saldo</th>";
  16. if ($params=="lihat") {
  17. $text.="<th ".$width.$array[0].">Status</th>";
  18. if (isset($menuAccess[$s]["edit"]) || isset($menuAccess[$s]["delete"]))
  19. $text.="<th ".$width.$array[1].">Kontrol</th>";
  20. }
  21. $text.="
  22. </tr>
  23. </thead>
  24. <tbody>";
  25.  
  26. $filter = "where t1.jumlahDeposit != '0' AND idBA='$par[idBA]'";
  27.  
  28. if (!empty($par[tgl1]) AND !empty($par[tgl2]))
  29. $filter .=" AND t1.tglDeposit between '".setTanggal($par[tgl1])."' AND '".setTanggal($par[tgl2])."'";
  30.  
  31. $sql = "SELECT t1.* FROM dta_deposit t1 $filter";
  32.  
  33. $res = db($sql);
  34.  
  35. $no = 0;
  36. $kredit = "";
  37. $debet = "";
  38. $status = "";
  39. while ($r = mysql_fetch_array($res)) {
  40.  
  41. $tipe = $r['katDeposit'];
  42. if($tipe == 'Debet'){
  43. $debet = $r['jumlahDeposit'];
  44. $kredit = '0';
  45. } else {
  46. $debet = '0';
  47. $kredit = $r['jumlahDeposit'];
  48. }
  49.  
  50. switch ($r[statusDeposit]) {
  51. case '1':
  52. $status = "<img src=\"styles/images/t.png\" title='Diterima'>";
  53. break;
  54.  
  55. case '2':
  56. $status = "<img src=\"styles/images/p.png\" title='Pending'>";
  57. break;
  58.  
  59. default:
  60. $status = "<img src=\"styles/images/p.png\" title='Pending'>";
  61. break;
  62. }
  63.  
  64. $saldo += $kredit - $debet ;
  65.  
  66.  
  67. $no++;
  68.  
  69. if ($params == 'lihat') {
  70.  
  71. $array = array('20','50','90','150');
  72. $width = "width=";
  73. $kontrol = "<th ".$width.$array[1].">Kontrol</th>";
  74.  
  75. }elseif($params == "cetak"){
  76. $array = "";
  77. $width = "";
  78. $kontrol = "";
  79. }
  80.  
  81. $text.="
  82. <tr>
  83. <td ".$width.$array[0].">$no.</td>
  84. <td ".$width.$array[1]." style=\"text-align:center;\">".getTanggal($r[tglDeposit])."</td>
  85. <td ".$width.$array[3].">$r[ketDeposit]</td>
  86. <td ".$width.$array[2]." style=\"text-align:right;\">".getAngka($kredit)."</td>
  87. <td ".$width.$array[2]." style=\"text-align:right;\">".getAngka($debet)."</td>
  88. <td ".$width.$array[2]." style=\"text-align:right;\">".getAngka($saldo)."</td>";
  89. if ($params=="lihat") {
  90. $text.="
  91. <td ".$width.$array[0]." style=\"text-align:center;\">".$status."</td>
  92. <td ".$width.$array[1]." style=\"text-align:center;\">";
  93. if (isset($menuAccess[$s]["edit"]))
  94. $text.="<a href=\"#\" onclick=\"openBox('popup.php?par[mode]=formDeposit&par[idDeposit]=$r[idDeposit]" . getPar($par, "mode,tgl1,tgl2") . "',800,360);\" title=\"Edit Data\" class=\"edit\"><span>Edit</span></a>";
  95.  
  96. if (isset($menuAccess[$s]["delete"]))
  97. $text.="<a href=\"?par[mode]=deleteDeposit&par[idDeposit]=$r[idDeposit]" . getPar($par, "mode,idDeposit") . "\" onclick=\"return confirm('are you sure to delete data ?');\" title=\"Delete Data\" class=\"delete\"><span>Delete</span></a>";
  98. $text.="
  99. </td>";
  100. }
  101. $text.="
  102. </tr>";
  103. }
  104. $text.="
  105. </tbody>
  106. </table>
  107. ";
  108.  
  109. return $text;
  110.  
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement