PageRenderTime 27ms CodeModel.GetById 1ms RepoModel.GetById 1ms app.codeStats 0ms

/includes/paymtop1.php

http://ebpls.googlecode.com/
PHP | 360 lines | 292 code | 58 blank | 10 comment | 36 complexity | 96ca83b591317cabac897d996f5dd957 MD5 | raw file
  1. <?php
  2. require_once "includes/variables.php";
  3. // get total vehicle
  4. $tfee = SelectMultiTable($dbtype,$dbLink,$permittable,
  5. "owner_id",
  6. "where owner_id = '$owner_id' and transaction='$stat' and active='1' and paid='0'");
  7. $ispay=NumRows($dbtype,$tfee);
  8. if ($permit_type=='Motorized' || $permit_type=='Franchise') {
  9. $totvec=SelectMultiTable($dbtype,$dbLink,"ebpls_motorized_vehicles",
  10. "count(motorized_motor_id)",
  11. "where motorized_operator_id = $owner_id and permit_type='$tag'");
  12. $tot = FetchRow($dbtype,$totvec);
  13. ?>
  14. <input type=hidden name=totalvec value=<?php echo $tot[0]; ?>>
  15. Total vehicles: <?php echo $tot[0]; ?> <br><br>
  16. <table border=1>
  17. <tr>
  18. <td> Vehicle ID </td><td> Motor Model </td><td> Motor Number </td>
  19. <td> Chasis Number </td><td> Plate Number </td><td> Body Number </td>
  20. <td> Route </td><td> Line Type </td>
  21. </tr>
  22. <?php
  23. //populate vehicle
  24. $result = SelectMultiTable($dbtype,$dbLink,$vehicle,
  25. "motorized_motor_id, motorized_motor_model, motorized_motor_no,
  26. motorized_chassis_no, motorized_plate_no, motorized_body_no,
  27. route, linetype",
  28. "where motorized_operator_id = $owner_id and permit_type='$tag'");
  29. while ($get_info = FetchRow($dbtype,$result)){
  30. print "<tr>\n";
  31. foreach ($get_info as $field )
  32. print "<td>&nbsp;$field&nbsp</td>\n";
  33. print "</tr>\n";
  34. }//end while
  35. print "</table>";
  36. } // end if not occu
  37. print "<br>";
  38. require_once "includes/form_add_mtoassesment.html";
  39. //if ($permit_type=='Occupational') {
  40. if ($permit_type<>'Fishery') {
  41. print "<table border = 1 >";
  42. print "<tr>";
  43. print "<td>";
  44. print "Fee </td> <td>";
  45. print "Amount </td> ";
  46. }
  47. if ($permit_type=='Motorized' || $permit_type=='Franchise') {
  48. print "<td>No. of Units</td><td>Total Amount</td></tr>";
  49. }
  50. if ($permit_type=='Motorized' || $permit_type=='Franchise') {
  51. $getyearnow = date('Y');
  52. //get from fees paid
  53. $getfees1 = @mysql_query("select * from ebpls_fees_paid where permit_type= '$permit_type' and permit_status = '$stat' and owner_id = '$owner_id' and input_date like '$getyearnow%'");
  54. $getnoveh = @mysql_query("select * from ebpls_motorized_vehicles where motorized_operator_id = '$owner_id' and status = '1'");
  55. $tot = mysql_num_rows($getnoveh);
  56. $totalfee = 0;
  57. while ($getfees = @mysql_fetch_assoc($getfees1)) {
  58. print "<tr>\n";
  59. //foreach ($getfee as $field )
  60. print "<td>&nbsp;$getfees[fee_desc]&nbsp</td>\n";
  61. print "<td align=right>&nbsp;$getfees[fee_amount]&nbsp</td>\n";
  62. print "<td align=right>&nbsp;$tot&nbsp;</td>\n";
  63. $tamt =$getfees[fee_amount] * $tot;
  64. $totalamt = number_format($tamt,2);
  65. print "<td align=right>&nbsp;$totalamt&nbsp;</td>";
  66. print "</tr>\n";
  67. $totalfee = $totalfee + $tamt;
  68. }
  69. include_once "includes/other_permit_penalty.php";
  70. $totalfee=$totalfee + $otherpen + $otherint + $otherlate;
  71. $totalfeenf = number_format($totalfee,2);
  72. ?>
  73. <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
  74. <tr><td>&nbsp;</td><td>&nbsp;</td><td>Grand Total:</td>
  75. <td align=right>&nbsp;<?php echo $totalfeenf; ?> </td> </tr>
  76. </table>
  77. </td></table>
  78. <?php
  79. if ($stat<>'New') {
  80. $ota=$totalfeenf;
  81. $totfee=0;
  82. require_once"includes/penalty.php";
  83. $totalpay=$grandamt;
  84. } else {
  85. $totalpay=$totalfeenf;
  86. }
  87. } else {
  88. if ($permit_type==Fishery) {
  89. $getboat = SelectDataWhere($dbtype,$dbLink,"fish_boat","where owner_id=$owner_id");
  90. while ($getb = FetchRow($dbtype,$getboat))
  91. {
  92. $getfee = SelectMultiTable($dbtype,$dbLink,"boat_fee",
  93. "amt,range_lower, range_higher",
  94. "where boat_type='$getb[4]' and
  95. range_lower<$getb[5] and range_higher>=$getb[5] and
  96. transaction='$stat' and active = 1");
  97. $getnum=NumRows($dbtype,$getfee);
  98. if ($getnum==0) {
  99. $getfee = SelectMultiTable($dbtype,$dbLink,"boat_fee","amt",
  100. "where boat_type='$getb[4]' and
  101. range_lower<=$getb[5] and range_higher=0 and
  102. transaction='$stat' and active = 1");
  103. }
  104. $getfee = FetchRow($dbtype,$getfee);
  105. $ttfee = $ttfee+$getfee[0];
  106. }
  107. $getot = SelectDataWhere($dbtype,$dbLink,$fee," where permit_type='$stat' and active=1");
  108. $getact = SelectMultiTable($dbtype,$dbLink,"fish_activity","sum(act_fee)",
  109. "where owner_id=$owner_id and transaction='$stat' and active = 1");
  110. $getact = FetchRow($dbtype,$getact);
  111. $tfee1 = $getact[0];
  112. $getboat = SelectDataWhere($dbtype,$dbLink,"fish_assess","where owner_id=$owner_id");
  113. while ($getb = FetchArray($dbtype,$getboat))
  114. {
  115. $getfee = SelectDataWhere($dbtype,$dbLink,"culture_fee",
  116. "where culture_id='$getb[culture_id]' and
  117. transaction='$stat' and active = 1 ");
  118. $getnum = FetchArray($dbtype,$getfee);
  119. if ($getnum[fee_type]=='3') {
  120. $getfee = SelectDataWhere($dbtype,$dbLink,"culture_range",
  121. "where culture_id='$getb[culture_id]' and
  122. range_lower<$getb[amt] and range_higher>=$getb[amt] ");
  123. $getnum = NumRows($dbtype,$getfee);
  124. if ($getnum==0) {
  125. $getfee = SelectDataWhere($dbtype,$dbLink,"culture_range",
  126. "where culture_id='$getb[culture_id]' and
  127. range_lower<=$getb[amt] and range_higher=0");
  128. }
  129. }
  130. $getfee1 = FetchArray($dbtype,$getfee);
  131. $ttfee1 = $ttfee1+$getfee1[amt];
  132. }
  133. ?>
  134. <table width=60%>
  135. <tr>
  136. <td>Fees from Boat Registration</td><td><?php echo number_format($ttfee,2); ?></td>
  137. </tr>
  138. <tr>
  139. <td>Fees from Fish Activities</td><td><?php echo number_format($ttfee1,2); ?></td>
  140. </tr>
  141. <tr>
  142. <td>Other Fees</td><td></td></tr>
  143. <?php
  144. while ($getj = FetchRow($dbtype,$getot))
  145. {
  146. ?>
  147. <tr>
  148. <td align=right><?php echo $getj[1]; ?> &nbsp; -----------------</td><td><?php echo $getj[2]; ?></td>
  149. </tr>
  150. <?php
  151. $ff = $ff + $getj[2];
  152. }
  153. ?>
  154. <tr><td></td><td>_______</td></tr>
  155. <tr>
  156. <td>Total Assessement</td><td><?php $totass = $ttfee+$ttfee1+$ff; echo number_format($totass,2); ?></td>
  157. </tr>
  158. <?php
  159. $totalfee = $totass;
  160. include_once "includes/other_permit_penalty.php";
  161. $totass=$totass + $otherpen + $otherint + $otherlate;
  162. $totalfeenf = number_format($totass,2);
  163. ?>
  164. <tr>
  165. <td>Grand Total</td><td><?php echo number_format($totass,2); ?></td>
  166. </tr>
  167. <?php
  168. } else {
  169. $mfee = SelectMultiTable($dbtype,$dbLink,"ebpls_fees_paid",
  170. "fee_desc, fee_amount",
  171. "where owner_id = $owner_id and permit_type='$permit_type'
  172. and permit_status='$stat'");
  173. while ($getfee = FetchRow($dbtype,$mfee)){
  174. print "<tr>\n";
  175. foreach ($getfee as $field )
  176. print "<td>&nbsp;$field&nbsp</td>\n";
  177. print "</tr>\n";
  178. }//end while
  179. //total fee
  180. $tfee = SelectMultiTable($dbtype,$dbLink,"ebpls_fees_paid",
  181. "sum(fee_amount)",
  182. "where owner_id = $owner_id and permit_type='$permit_type'
  183. and permit_status='$stat'");
  184. $totalfee=FetchRow($dbtype,$tfee);
  185. include_once "includes/other_permit_penalty.php";
  186. $totalfee[0]=$totalfee[0] + $otherpen + $otherint + $otherlate;
  187. $totalfeenf = number_format($totalfee[0],2);
  188. ?>
  189. <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
  190. <tr><td>&nbsp;</td><td>Grand Total:</td><td>&nbsp;<?php echo $totalfeenf; ?></td></tr>
  191. </table>
  192. </td></table>
  193. <?php
  194. }
  195. if ($stat<>'New') {
  196. $ota=$totalfee[0];
  197. $totfee=0;
  198. require_once"includes/penalty.php";
  199. $totalpay=$grandamt;
  200. } else {
  201. $totalpay=$totalfee[0];
  202. }
  203. $totpay=$totalfee[0];
  204. $totalfee=$totalfee[0];
  205. }
  206. $getmax = SelectMultiTable($dbtype,$dbLink,"ebpls_transaction_payment_or",
  207. " count(or_no) + 1","");
  208. $getor = FetchRow($dbtype,$getmax);
  209. $or_no = $getor[0];
  210. if ($com=='cash') {
  211. if ($permit_type=='Fishery') {
  212. $totalpay = $totass;
  213. $totalfee = $totass;
  214. }
  215. if ($ispay==1 || $nopayment == '1') {
  216. require_once "includes/form_pay.php";
  217. }
  218. } elseif ($com=='reassess') {
  219. }
  220. //payment history //
  221. ?>
  222. <bR><table cellspacing=0 cellpadding=0 border=1 width=60% align=center>
  223. <tr><td align=center valign=top class='header2'>
  224. Payment History </td> </tr> </table> <br>
  225. <?php
  226. $getpay = SelectMultiTable($dbtype,$dbLink,"temppayment",
  227. "payid, payamt, pay_date, pay_type,
  228. or_no,status",
  229. "where owner_id = $owner_id and permit_type='$permit_type'
  230. and permit_status='$stat' and pay_date like '$getyearnow%'");
  231. ?>
  232. <table border=1 align=center>
  233. <td>OR No </td><td>Paid Amount </td><td>Paid Date </td>
  234. <td>Action </td>
  235. <?php
  236. $totalpayment_=0;
  237. while ($get_info = FetchRow($dbtype,$getpay)){
  238. print "<tr>\n";
  239. //foreach ($get_info as $field )
  240. print "<td>&nbsp;$get_info[4]&nbsp</td>\n";
  241. $pdamt = number_format($get_info[1],2);
  242. print "<td align=right>&nbsp;$pdamt&nbsp</td>\n";
  243. print "<td>&nbsp;$get_info[2]&nbsp</td>\n";
  244. $totalpayment_=$get_info[1]+$totalpayment_;
  245. if ($get_info[5]<>0) {
  246. print "<td><a class=subnavwhite href='index.php?part=4&class_type=Permits&itemID_=2212&owner_id=$owner_id&payid=$get_info[0]&cmd=delete&com=cash&permit_type=$tag&stat=$stat&busItem=$permit_type'>Delete</a></td>";
  247. ?>
  248. <td><div align=center><a href="#" class=subnavwhite onclick='window.open("ebplsothrec.php?owner_id=<?php echo $owner_id; ?>&or_no=<?php echo $get_info[4]; ?>&permit_type=<?php echo $permit_type; ?>&stat=<?php echo $stat; ?>");'>Print OR</a></div></td>
  249. <?php
  250. } else {
  251. ?>
  252. <td><div align=center><a href="#" class=subnavwhite onclick='window.open("ebplsothrec.php?owner_id=<?php echo $owner_id; ?>&or_no=<?php echo $get_info[4]; ?>&permit_type=<?php echo $permit_type; ?>&stat=<?php echo $stat; ?>");'>Re-Print OR</a></div></td>
  253. <?php
  254. }
  255. print "</tr>\n";
  256. }//end while
  257. $getpay = SelectMultiTable($dbtype,$dbLink,"temppayment","sum(payamt)",
  258. "where owner_id = $owner_id and permit_type='$permit_type'
  259. and permit_status='$stat' and pay_date like '$getyearnow%'");
  260. $totalpaid = FetchRow($dbtype,$getpay);
  261. $totalpaidnf = number_format($totalpaid[0],2);
  262. ?>
  263. <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
  264. <tr><td>Total : </td>
  265. <td align=right>&nbsp;<?php echo $totalpaidnf; ?> </td>
  266. <?php
  267. $hj = $totalpaid[0];
  268. $amtchange = $hj - $totalpay;
  269. if ($amtchange<0) {
  270. print "<td></td>\n";
  271. } else {
  272. print "<td></td>\n";
  273. }
  274. $amtchange=abs($amtchange);
  275. //$amtchangenf = number_format($amtchange,2);
  276. print "<td align=right>&nbsp;$amtchangenf </td>\n";
  277. print "</tr>";
  278. print "</table>";
  279. ?>
  280. <script language="Javascript">
  281. function DeletePayment(x)
  282. {
  283. var _FRM = document._FRM;
  284. delconf = confirm("Delete Payment?");
  285. if (delconf == true) {
  286. _FRM.delproc.value = "yes";
  287. _FRM.payid.value = x;
  288. _FRM.submit();
  289. return true;
  290. } else {
  291. alert("Transaction Cancelled.");
  292. _FRM.delproc.value = "no";
  293. return false;
  294. }
  295. }
  296. </script>
  297. <input type=hidden name=delproc>
  298. <input type=hidden name=payid value="<? echo $payid;?>">
  299. <?php
  300. require_once "includes/form_add_lastpermit.html";
  301. //}
  302. ?>