PageRenderTime 46ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 1ms

/reports/ebpls_bus_taxcoll.php

http://ebpls.googlecode.com/
PHP | 362 lines | 209 code | 25 blank | 128 comment | 26 complexity | 58e95583822fbe9353bb440100d33d6b MD5 | raw file
  1. <?php
  2. require_once("lib/ebpls.utils.php");
  3. define('FPDF_FONTPATH','font/');
  4. require('ebpls-php-lib/html2pdf_lib/fpdf.php');
  5. include("lib/phpFunctions-inc.php");
  6. $dbLink = get_db_connection();
  7. $e = strrpos($owner_last,"-");//$owner_last is date
  8. $l =strlen($owner_last);
  9. $dateprev = substr($owner_last, $l-$e);
  10. $dateprev = $dateprev;
  11. $datenext = $dateprev + 1;
  12. $result=mysql_query("select lgumunicipality, lguprovince, lguoffice from ebpls_buss_preference") or die(mysql_error());
  13. $resulta=mysql_fetch_row($result);
  14. $pdf=new FPDF('L','mm','Legal');
  15. $pdf->AddPage();
  16. $pdf->image('peoplesmall.jpg',10,5,33);
  17. $pdf->SetFont('Arial','B',12);
  18. $pdf->Cell(340,5,'REPUBLIC OF THE PHILIPPINES',0,1,'C');
  19. $pdf->Cell(340,5,$resulta[0],0,1,'C');
  20. $pdf->Cell(340,5,$resulta[1],0,2,'C');
  21. $pdf->SetFont('Arial','B',14);
  22. $pdf->Cell(340,5,$resulta[2],0,2,'C');
  23. $pdf->Cell(340,5,'',0,2,'C');
  24. $pdf->SetFont('Arial','BU',16);
  25. $pdf->Cell(340,5,'BUSINESS TAX COLLECTION QUARTERLY',0,1,'C');
  26. /* $result=mysql_query("select a.business_permit_code, concat(c.owner_first_name, ' ', c.owner_middle_name, ' ',
  27. c.owner_last_name), b.business_name, e.bus_nature, b.business_street, e.cap_inv, e.last_yr, d.total_amount_paid,
  28. d.or_no, d.or_date, b.business_category_code
  29. from ebpls_business_enterprise_permit a, ebpls_business_enterprise b, ebpls_owner c, ebpls_transaction_payment_or d,
  30. tempbusnature e
  31. where a.owner_id = b.owner_id and a.owner_id = c.owner_id and b.owner_id = d.trans_id
  32. and b.business_id = e.business_id limit 10") or die(mysql_error());*/
  33. $taxq1 = mysql_query("select a.business_name, b.business_permit_code, concat(c.owner_first_name, ' ', c.owner_middle_name, ' ', c.owner_last_name), concat(a.business_street, ' ', a.business_barangay_code, ' ', a.business_zone_code, ' ', a.business_district_code, ' ', a.business_city_code), d.for_year, d.or_no, d.taxes from ebpls_business_enterprise a, ebpls_business_enterprise_permit b, ebpls_owner c, comparative_statement d where d.for_year='$dateprev' and a.owner_id=d.owner_id and b.owner_id=d.owner_id and c.owner_id=d.owner_id and d.month>=1 and d.month<=3") or die(mysql_error());
  34. $taxq2 = mysql_query("select a.business_name, b.business_permit_code, concat(c.owner_first_name, ' ', c.owner_middle_name, ' ', c.owner_last_name), concat(a.business_street, ' ', a.business_barangay_code, ' ', a.business_zone_code, ' ', a.business_district_code, ' ', a.business_city_code), d.for_year, d.or_no, d.taxes from ebpls_business_enterprise a, ebpls_business_enterprise_permit b, ebpls_owner c, comparative_statement d where d.for_year='$dateprev' and a.owner_id=d.owner_id and b.owner_id=d.owner_id and c.owner_id=d.owner_id and d.month>=4 and d.month<=6") or die(mysql_error());
  35. $taxq3 = mysql_query("select a.business_name, b.business_permit_code, concat(c.owner_first_name, ' ', c.owner_middle_name, ' ', c.owner_last_name), concat(a.business_street, ' ', a.business_barangay_code, ' ', a.business_zone_code, ' ', a.business_district_code, ' ', a.business_city_code), d.for_year, d.or_no, d.taxes from ebpls_business_enterprise a, ebpls_business_enterprise_permit b, ebpls_owner c, comparative_statement d where d.for_year='$dateprev' and a.owner_id=d.owner_id and b.owner_id=d.owner_id and c.owner_id=d.owner_id and d.month>=7 and d.month<=9") or die(mysql_error());
  36. $taxq4 = mysql_query("select a.business_name, b.business_permit_code, concat(c.owner_first_name, ' ', c.owner_middle_name, ' ', c.owner_last_name), concat(a.business_street, ' ', a.business_barangay_code, ' ', a.business_zone_code, ' ', a.business_district_code, ' ', a.business_city_code), d.for_year, d.or_no, d.taxes from ebpls_business_enterprise a, ebpls_business_enterprise_permit b, ebpls_owner c, comparative_statement d where d.for_year='$dateprev' and a.owner_id=d.owner_id and b.owner_id=d.owner_id and c.owner_id=d.owner_id and d.month>=10 and d.month<=12") or die(mysql_error());
  37. while ($taxq1n=mysql_fetch_row($taxq1) or $taxq2n=mysql_fetch_row($taxq2) or $taxq3n=mysql_fetch_row($taxq3) or $taxq4n=mysql_fetch_row($taxq4))
  38. {
  39. if ($taxq1n[0]=='') {
  40. if ($taxq2n[0]=='') {
  41. if ($taxq3n[0]=='') {
  42. $row1 = $taxq4n[0];
  43. } else {
  44. $row1 = $taxq3n[0];
  45. }
  46. } else {
  47. $row1 = $taxq2n[0];
  48. }
  49. } else {
  50. $row1 = $taxq1n[0];
  51. }
  52. if ($taxq1n[1]=='') {
  53. if ($taxq2n[1]=='') {
  54. if ($taxq3n[1]=='') {
  55. $row2 = $taxq4n[1];
  56. } else {
  57. $row2 = $taxq3n[1];
  58. }
  59. } else {
  60. $row2 = $taxq2n[1];
  61. }
  62. } else {
  63. $row2 = $taxq1n[1];
  64. }
  65. if ($taxq1n[2]=='') {
  66. if ($taxq2n[2]=='') {
  67. if ($taxq3n[2]=='') {
  68. $row3 = $taxq4n[2];
  69. } else {
  70. $row3 = $taxq3n[2];
  71. }
  72. } else {
  73. $row3 = $taxq2n[2];
  74. }
  75. } else {
  76. $row3 = $taxq1n[2];
  77. }
  78. if ($taxq1n[3]=='') {
  79. if ($taxq2n[3]=='') {
  80. if ($taxq3n[3]=='') {
  81. $row4 = $taxq4n[3];
  82. } else {
  83. $row4 = $taxq3n[3];
  84. }
  85. } else {
  86. $row4 = $taxq2n[3];
  87. }
  88. } else {
  89. $row4 = $taxq1n[3];
  90. }
  91. $row5 = number_format($taxq1n[6],2);
  92. $row6 = $taxq1n[5];
  93. $row7 = number_format($taxq2n[6],2);
  94. $row8 = $taxq2n[5];
  95. $row9 = number_format($taxq3n[6],2);
  96. $row10 = $taxq3n[5];
  97. $row11 = number_format($taxq4n[6],2);
  98. $row12 = $taxq4n[5];
  99. $column_code1 = $column_code1.$row1."\n";
  100. $column_code2 = $column_code2.$row2."\n";
  101. $column_code3 = $column_code3.$row3."\n";
  102. $column_code4 = $column_code4.$row4."\n";
  103. $column_code5 = $column_code5.$row5."\n";
  104. $column_code6 = $column_code6.$row6."\n";
  105. $column_code7 = $column_code7.$row7."\n";
  106. $column_code8 = $column_code8.$row8."\n";
  107. $column_code9 = $column_code9.$row9."\n";
  108. $column_code10 = $column_code10.$row10."\n";
  109. $column_code11 = $column_code11.$row11."\n";
  110. $column_code12 = $column_code12.$row12."\n";
  111. $number_of_rows=$number_of_rows+1;
  112. }
  113. $pdf->SetLineWidth(2);
  114. $pdf->Line(0,45,360,45);
  115. $pdf->SetLineWidth(0);
  116. $pdf->Cell(270,5,'',0,1,'C');
  117. $pdf->Cell(270,5,'',0,1,'C');
  118. $Y_Label_position = 50;
  119. $Y_Table_Position = 55;
  120. $pdf->SetFont('Arial','B',6);
  121. $pdf->SetY($Y_Label_position);
  122. $pdf->SetX(5);
  123. $pdf->Cell(35,5,'NAME OF BUSINESS'.$number_of_rows,1,0,'C');
  124. $pdf->SetX(40);
  125. $pdf->Cell(20,5,'PERMIT NUMBER',1,0,'C');
  126. $pdf->SetX(60);
  127. $pdf->Cell(60,5,'NAME OF OWNER',1,0,'C');
  128. $pdf->SetX(120);
  129. $pdf->Cell(70,5,'BUSINESS ADDRESS',1,0,'C');
  130. $pdf->SetX(190);
  131. $pdf->Cell(20,5,'1ST QUARTER',1,0,'C');
  132. $pdf->SetX(210);
  133. $pdf->Cell(15,5,'OR NUMBER',1,0,'C');
  134. $pdf->SetX(225);
  135. $pdf->Cell(20,5,'2ND QUARTER',1,0,'C');
  136. $pdf->SetX(245);
  137. $pdf->Cell(15,5,'OR NUMBER',1,0,'C');
  138. $pdf->SetX(260);
  139. $pdf->Cell(20,5,'3RD QUARTER',1,0,'C');
  140. $pdf->SetX(280);
  141. $pdf->Cell(15,5,'OR NUMBER',1,0,'C');
  142. $pdf->SetX(295);
  143. $pdf->Cell(20,5,'4TH QUARTER',1,0,'C');
  144. $pdf->SetX(315);
  145. $pdf->Cell(15,5,'OR NUMBER',1,0,'C');
  146. $pdf->SetFont('Arial','',6);
  147. $pdf->SetY($Y_Table_Position);
  148. $pdf->SetX(5);
  149. $pdf->MultiCell(35,5,$column_code1,1);
  150. $pdf->SetY($Y_Table_Position);
  151. $pdf->SetX(40);
  152. $pdf->MultiCell(20,5,$column_code2,1);
  153. $pdf->SetY($Y_Table_Position);
  154. $pdf->SetX(60);
  155. $pdf->MultiCell(60,5,$column_code3,1);
  156. $pdf->SetY($Y_Table_Position);
  157. $pdf->SetX(120);
  158. $pdf->MultiCell(70,5,$column_code4,1);
  159. $pdf->SetY($Y_Table_Position);
  160. $pdf->SetX(190);
  161. $pdf->MultiCell(20,5,$column_code5,1,'R');
  162. $pdf->SetY($Y_Table_Position);
  163. $pdf->SetX(210);
  164. $pdf->MultiCell(15,5,$column_code6,1,'R');
  165. $pdf->SetY($Y_Table_Position);
  166. $pdf->SetX(225);
  167. $pdf->MultiCell(20,5,$column_code7,1,'R');
  168. $pdf->SetY($Y_Table_Position);
  169. $pdf->SetX(245);
  170. $pdf->MultiCell(15,5,$column_code8,1,'R');
  171. $pdf->SetY($Y_Table_Position);
  172. $pdf->SetX(260);
  173. $pdf->MultiCell(20,5,$column_code9,1,'R');
  174. $pdf->SetY($Y_Table_Position);
  175. $pdf->SetX(280);
  176. $pdf->MultiCell(15,5,$column_code10,1,'R');
  177. $pdf->SetY($Y_Table_Position);
  178. $pdf->SetX(295);
  179. $pdf->MultiCell(20,5,$column_code11,1,'R');
  180. $pdf->SetY($Y_Table_Position);
  181. $pdf->SetX(315);
  182. $pdf->MultiCell(15,5,$column_code12,1,'R');
  183. $i = 0;
  184. $pdf->SetY($Y_Table_Position);
  185. $ymulti=5*$number_of_rows;;
  186. while ($i < $number_of_rows)
  187. {
  188. $pdf->SetX(5);
  189. $pdf->MultiCell(325,5,'',1);
  190. $i = $i +1;
  191. }
  192. $result=mysql_query("select gs_name, gs_pos, gs_office from global_sign where sign_id =1") or die(mysql_error());
  193. $resulta=mysql_fetch_row($result);
  194. $Y_Table_Position = $Y_Table_Position + 25 + $ymulti;
  195. $pdf->SetY($Y_Table_Position);
  196. $pdf->SetX(5);
  197. $pdf->SetFont('Arial','B',10);
  198. $pdf->Cell(172,5,'Approved By:',1,0,'L');
  199. $pdf->Cell(172,5,'Noted By:',1,1,'L');
  200. $pdf->Cell(350,5,'',0,2,'C');
  201. $pdf->Cell(350,5,'',0,2,'C');
  202. $pdf->SetFont('Arial','BU',10);
  203. $pdf->SetX(5);
  204. $pdf->Cell(172,5,$resulta[0],1,0,'C');
  205. $pdf->Cell(172,5,$resulta[3],1,1,'C');
  206. $pdf->SetFont('Arial','B',10);
  207. $pdf->SetX(5);
  208. $pdf->Cell(172,5,$resulta[2],1,0,'C');
  209. $pdf->Cell(172,5,$resulta[7],1,1,'C');
  210. $pdf->Output();
  211. ?>
  212. <?php /*
  213. require_once("lib/ebpls.lib.php");
  214. require_once("lib/ebpls.utils.php");
  215. require_once("ebpls-php-lib/utils/ebpls.search.funcs.php");
  216. //require_once("includes/eBPLS_header.php");
  217. //--- get connection from DB
  218. $dbLink = get_db_connection();
  219. ?>
  220. <?php
  221. echo date("F dS Y h:i:s A");
  222. ?>
  223. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  224. <html>
  225. <head>
  226. <meta http-equiv="Content-Type"
  227. content="text/html; charset=iso-8859-1">
  228. <title>BUSINESS TAX COLLECTION QUARTERLY</title>
  229. <meta name="Author" content=" Pagoda, Ltd. ">
  230. <link href="includes/eBPLS.css" rel="stylesheet" type="text/css">
  231. <script language="JavaScript" src="includes/eBPLS.js"></script>
  232. </head>
  233. <body>
  234. <?php
  235. $result=mysql_query("select lgumunicipality, lguprovince, lguoffice from ebpls_buss_preference") or die(mysql_error());
  236. $resulta=mysql_fetch_row($result);
  237. ?>
  238. <h4 align="center"> Republic of the Philippines </h4>
  239. <h4 align="center"> <?php echo $resulta[1]; ?> </h4>
  240. <h4 align="center"> <?php echo $resulta[0]; ?> </h4>
  241. <h4 align="center"> <?php echo $resulta[2]; ?> </h4>
  242. <h4 align="center"><u> BUSINESS TAX COLLECTION QUARTERLY</u></h4>
  243. <hr>
  244. <br>
  245. <table border="1" cellpadding="1" cellspacing="1" width="1400">
  246. <tbody>
  247. <tr>
  248. <td align="center"><b> Name of Business </b></td>
  249. <td align="center"><b> Permit Number </b></td>
  250. <td align="center"><b> Owner's Name </b></td>
  251. <td align="center"><b> Nature of Business </b></td>
  252. <td align="center"><b> Business Address </b></td>
  253. <td align="center"><b> 1st Q. </b></td>
  254. <td align="center"><b> O.R. Number </b></td>
  255. <td align="center"><b> 2nd Q. </b></td>
  256. <td align="center"><b> OR No. </b></td>
  257. <td align="center"><b> 3rd Q </b></td>
  258. <td align="center"><b> OR No. </b></td>
  259. <td align="center"><b> 4th Q </b></td>
  260. <td align="center"><b> OR No. </b></td>
  261. <td align="center"><b> Total Amount Due </b></td>
  262. </tr>
  263. <?php
  264. // unang gawang tama
  265. $result=mysql_query("select business_name, ' ', ' ', ' ', business_street, '0.00', ' ', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', '0.00'
  266. from ebpls_business_enterprise") or die(mysql_error());
  267. while ($resulta=mysql_fetch_row($result)){
  268. /* sample/test ko lng
  269. $result=mysql_query("select a.owner_id, a.business_name, a.business_city_code, a.business_type_code,
  270. a.business_street, a.business_capital_investment, a.business_last_yrs_dec_gross_sales, b.fee_amount,
  271. b.input_date from ebpls_business_enterprise a, ebpls_fees_paid b where a.owner_id = b.owner_id and
  272. a.business_create_ts = '2004-12-28'") or die(mysql_error());
  273. while ($resulta=mysql_fetch_row($result)){
  274. print "<tr>\n";
  275. foreach ($resulta as $field )
  276. print "<td>&nbsp;$field&nbsp</td>\n";
  277. print "</tr>";
  278. }
  279. ?>
  280. </tbody>
  281. </table>
  282. <br>
  283. <br>
  284. <br>
  285. <br>
  286. <?php
  287. $result=mysql_query("select sign1, sign2, sign3, sign4, pos1, pos2, pos3, pos4
  288. from permit_templates") or die(mysql_error());
  289. $resulta=mysql_fetch_row($result);
  290. ?>
  291. <table style="width: 1000px" border="0" cellpadding="1" cellspacing="1">
  292. <tbody>
  293. <tr>
  294. <td align="left", width="500"><b> Prepared By: <br> <br> <br> <br> <br> </b></td>
  295. <td align="left", width="500"><b> Noted By: <br> <br> <br> <br> <br> </b></td>
  296. </tr>
  297. <tr>
  298. <td align="center"><u><b> <?php echo $resulta[0]; ?> </u> </b> </td>
  299. <td align="center"> <u><b> <?php echo $resulta[3]; ?> </u> </b> </td>
  300. </tr>
  301. <tr>
  302. <td align="center"> <?php echo $resulta[4]; ?> <br> <br> <br> <br> <br> <br> <br> <br> </td>
  303. <td align="center"> <?php echo $resulta[7]; ?> <br> <br> <br> <br> <br> <br> <br> <br> </td>
  304. </tr>
  305. <tr>
  306. <td align="left"> Date printed: &nbsp; &nbsp; <?php echo date("F d Y"); ?> </td>
  307. </tbody>
  308. </table>
  309. <br>
  310. <br>
  311. <?php
  312. require_once("includes/eBPLS_footer.php");
  313. */
  314. ?>
  315. </body>
  316. </html>
  317. -->