PageRenderTime 48ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/includes/historypay.php

http://ebpls.googlecode.com/
PHP | 189 lines | 162 code | 26 blank | 1 comment | 19 complexity | f3ba968a15eb5b010f09d8c43d105938 MD5 | raw file
  1. </script>
  2. <?php
  3. $htag='Payment History';
  4. require "includes/headerassess.php";
  5. ?>
  6. <table border=1 align =center width=100% class=sub>
  7. <tr><td colspan=5>
  8. <b>Cash Payment</b></td>
  9. <tr><th>Date Of Payment</th>
  10. <th>OR/Control Number</th><th>Amount Paid</th><th>Received By</th></tr>
  11. <?php
  12. //get cash first
  13. $getcas = SelectMultiTable($dbtype,$dbLink,"ebpls_transaction_payment_or a,
  14. ebpls_transaction_payment_or_details b",
  15. "a.ts_create, concat(a.payment_code,'/',a.or_no),
  16. a.total_amount_paid, a.payment_officer, a.or_no, a.total_amount_due,
  17. a.payment_code, a.or_no",
  18. "where a.or_no=b.or_no and b.trans_id=$owner_id and
  19. b.or_entry_type='CASH' and
  20. b.payment_id=$business_id and b.transaction='$istat'");
  21. $totcash=0;
  22. while ($getcash=FetchRow($dbtype,$getcas))
  23. {
  24. if (date('Y',strtotime($getcash[0]))==date('Y')) {
  25. $getcashnf = number_format($getcash[5], 2);
  26. print "<tr><td>$getcash[0]</td><td align=right>$getcash[1]</td><td align=right>$getcashnf</td>
  27. <td align=center>$getcash[3]</td>";
  28. ?>
  29. <td><a href='#' onClick='javascript:PaymentCommand("CASHVIEW",1,2,"3","<?php echo $getcash[4]; ?>","<?php echo $getcash[6]; ?>",0,"<?php echo $getcash[6]; ?>");'>
  30. <font color=blue>View Payment Details</font></a></td>
  31. </tr>
  32. <?php
  33. $totcash = $totcash+$getcash[5];
  34. $totc = number_format($totcash, 2);
  35. }
  36. }
  37. ?>
  38. <tr><br></tr>
  39. <tr><td></td><td align=right>Total Cash Payment:</td>
  40. <td align=right><?php echo $totc; ?></td></tr>
  41. </table>
  42. <table border=1 align =center class=sub>
  43. <tr><td colspan=5><b>Check Payment</b></td></tr>
  44. <tr>
  45. <th width=20%>Bank Name</th>
  46. <th width=20%>Amount</th>
  47. <th width=20%>OR/Control Number</th>
  48. <th width=20%>Cleared</th><th width=20%> &nbsp;</th></tr>
  49. <?php
  50. $getchek = SelectMultiTable($dbtype,$dbLink,"ebpls_transaction_payment_check a,
  51. ebpls_transaction_payment_or b, ebpls_transaction_payment_or_details c",
  52. "a.check_no, a.check_issue_date, a.check_name, a.check_amount,
  53. b.ts_create, concat(b.payment_code, '/',b.or_no),
  54. a.check_status,a.ts_clear, b.payment_officer,
  55. a.admin, a.check_id, a.remark, b.or_no, b.payment_code",
  56. "where a.or_no=b.or_no and a.or_no=c.or_no and b.or_no=c.or_no and
  57. c.or_entry_type='CHECK' and c.transaction='$istat' and
  58. c.trans_id=$owner_id and c.payment_id=$business_id");
  59. $s=0;
  60. while ($getcheck=FetchRow($dbtype,$getchek))
  61. {
  62. if (date('Y',strtotime($getcheck[4]))==date('Y')) {
  63. $getchecknf = number_format($getcheck[3], 2);
  64. print "<tr>
  65. <td>".stripslashes($getcheck[2])."</td><td align=right>$getchecknf</td>
  66. <td>$getcheck[5]</td><td>$getcheck[6]</td>
  67. <td>";
  68. if ($getcheck[6]<>'CLEARED' and $statpin=='') {
  69. ?>
  70. <a href='#' onClick='javascript:PaymentCommand("CHECKSTATUS",1,2,"3", "<?php echo $getcheck[10]; ?>", "<?php echo $getcash[6]; ?>");'>
  71. <font color=blue>Change Status</font></a>
  72. <?php
  73. }
  74. if ($getcheck[6]<>'PENDING' and $statpin=='') {
  75. ?>
  76. <a href='#' onClick="javascript:PaymentCommand('CHECKVIEW',1,2,'3', <?php echo $getcheck[12]; ?>,0,0,'<?php echo $getcheck[13]; ?>')"><font color=blue>View Payment Details</font></a>
  77. <?php
  78. }
  79. ?>
  80. </td>
  81. <tr>
  82. <?
  83. $totscheck = $totscheck+$getcheck[3];
  84. $s++;
  85. }
  86. }
  87. $getclear = SelectMultiTable($dbtype,$dbLink,"ebpls_transaction_payment_check a,
  88. ebpls_transaction_payment_or b,
  89. ebpls_transaction_payment_or_details c","sum(a.check_amount)",
  90. "where a.or_no=b.or_no and a.or_no=c.or_no and b.or_no=c.or_no and
  91. c.or_entry_type='CHECK' and a.check_status='CLEARED' and
  92. c.transaction='$istat' and
  93. c.trans_id=$owner_id and c.payment_id=$business_id");
  94. $totcheck = FetchRow($dbtype,$getclear);
  95. print "<tr><br></tr>";
  96. $totchecknf = number_format($totscheck, 2);
  97. print "<tr><td></td><td></td><td align=right>Total Check Payment:</td><td align=right>$totchecknf</td></tr>";
  98. $totpay =$totcash+$totscheck;
  99. ?>
  100. </table>
  101. <table border =0 align=left class=sub>
  102. <tr><td></td><td>Total Payments Made:</td><td><font color=red><b>Php <?php echo number_format($totpay,2);?><b></font></td><td></td>
  103. </table>
  104. <?php
  105. if ($bpar==1 || $ulev==6 || $ulev==7 and $totpay>0) {
  106. $ge = SelectDataWhere($dbtype,$dbLink,"havereq",
  107. "where owner_id=$owner_id and
  108. active=1 and business_id=$business_id");
  109. $ge = NumRows($dbtype,$ge);
  110. $getreq = SelectDataWhere($dbtype,$dbLink,"ebpls_buss_requirements",
  111. "where recstatus='A' and reqindicator=1 and permit_type='Business'");
  112. $gt = NumRows($dbtype,$getreq);
  113. $gettag= SelectDataWhere($dbtype,$dbLink,"ebpls_buss_preference","");
  114. $getre=FetchArray($dbtype,$gettag);
  115. $checkapp = mysql_query("select * from ebpls_buss_approve a where
  116. a.owner_id='$owner_id' and
  117. a.decision=1 and a.business_id=$business_id");
  118. $checka = mysql_num_rows($checkapp);
  119. if ($checka==0) {
  120. $gud=0;
  121. } else {
  122. if ($getre[srequire]==1) {
  123. if ($ge==$gt) {
  124. $gud = 1;
  125. } else {
  126. $gud=0;
  127. }
  128. } else {
  129. $gud = 1;
  130. }
  131. }
  132. ?>
  133. <table align=center border=0><br><br><br>
  134. <tr><td>
  135. <?php
  136. if ($gud==1) {
  137. ?>
  138. <input type=button value=RELEASING onclick="parent.location='index.php?part=4&class_type=Permits&itemID_=3212&owner_id=<?php echo $owner_id; ?>&business_id=<?php echo $business_id; ?>&stat=<?php echo $stat; ?>&com=PrintReport&permit_type=Business&busItem=Business'">
  139. <?php
  140. } else {
  141. $checkapp = mysql_query("select * from ebpls_buss_approve a where
  142. a.owner_id='$get_info[0]' and
  143. a.decision=1 and a.business_id=$get_info[1]");
  144. $checka = @mysql_num_rows($checkapp);
  145. if ($checka==0) {
  146. ?>
  147. <td>
  148. <font color=red> Not yet approve. Cannot Proceed To Releasing</font>
  149. </td>
  150. <?php
  151. } else {
  152. ?>
  153. Incomplete Requirements. Cannot Proceed To Releasing</font>
  154. &nbsp
  155. <a href='#' onclick="IncReq('<?php echo $owner_id; ?>','<?php echo $business_id; ?>');">View Details</a>
  156. <?php
  157. }
  158. }
  159. ?>
  160. </td></tr></table>
  161. <?php
  162. }
  163. ?>