PageRenderTime 40ms CodeModel.GetById 6ms RepoModel.GetById 0ms app.codeStats 0ms

/reports/ebpls_bus_taxcoll_quar.php

http://ebpls.googlecode.com/
PHP | 206 lines | 144 code | 54 blank | 8 comment | 1 complexity | 3e39cae68d146ea59edd557273feba3b 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. include("../includes/variables.php");
  7. include("../lib/multidbconnection.php");
  8. $dbLink =Open($dbtype,$connecttype,$dbhost,$dbuser,$dbpass,$dbname);
  9. $e = strrpos($owner_last,"-");//$owner_last is date
  10. $l =strlen($owner_last);
  11. $dateprev = substr($owner_last,0,4);
  12. $dateprev = $dateprev;
  13. $datenext = $dateprev + 1;
  14. $result=mysql_query("select lgumunicipality, lguprovince, lguoffice from ebpls_buss_preference") or die(mysql_error());
  15. $resulta=mysql_fetch_row($result);
  16. $pdf=new FPDF('L','mm','Legal');
  17. $pdf->AddPage();
  18. $pdf->image('../images/ebpls_logo.jpg',10,5,33);
  19. $pdf->SetFont('Arial','B',12);
  20. $pdf->Cell(340,5,'REPUBLIC OF THE PHILIPPINES',0,1,'C');
  21. $pdf->Cell(340,5,$resulta[0],0,1,'C');
  22. $pdf->Cell(340,5,$resulta[1],0,2,'C');
  23. $pdf->SetFont('Arial','B',14);
  24. $pdf->Cell(340,5,$resulta[2],0,2,'C');
  25. $pdf->Cell(340,5,'',0,2,'C');
  26. $pdf->SetFont('Arial','BU',16);
  27. $pdf->Cell(340,5,'BUSINESS TAX COLLECTION QUARTERLY',0,1,'C');
  28. $pdf->SetLineWidth(2);
  29. $pdf->Line(0,45,360,45);
  30. $pdf->SetLineWidth(0);
  31. $pdf->Cell(270,5,'',0,1,'C');
  32. $pdf->Cell(270,5,'',0,1,'C');
  33. $Y_Label_position = 50;
  34. $Y_Table_Position = 55;
  35. $pdf->SetFont('Arial','B',6);
  36. $pdf->SetY($Y_Label_position);
  37. $pdf->SetX(10);
  38. $pdf->Cell(35,5,'NAME OF BUSINESS',1,0,'C');
  39. $pdf->Cell(20,5,'PERMIT NUMBER',1,0,'C');
  40. $pdf->Cell(60,5,'NAME OF OWNER',1,0,'C');
  41. $pdf->Cell(70,5,'BUSINESS ADDRESS',1,0,'C');
  42. $pdf->Cell(20,5,'1ST QUARTER',1,0,'C');
  43. $pdf->Cell(15,5,'OR NUMBER',1,0,'C');
  44. $pdf->Cell(20,5,'2ND QUARTER',1,0,'C');
  45. $pdf->Cell(15,5,'OR NUMBER',1,0,'C');
  46. $pdf->Cell(20,5,'3RD QUARTER',1,0,'C');
  47. $pdf->Cell(15,5,'OR NUMBER',1,0,'C');
  48. $pdf->Cell(20,5,'4TH QUARTER',1,0,'C');
  49. $pdf->Cell(15,5,'OR NUMBER',1,1,'C');
  50. //first quarter
  51. $taxq1 = mysql_query("select a.business_name, b.business_permit_code,
  52. concat(c.owner_first_name, ' ', c.owner_middle_name, ' ', c.owner_last_name) as fulln,
  53. concat(a.business_street, ' ', a.business_barangay_code, ' ', a.business_zone_code, ' ',
  54. a.business_district_code, ' ', a.business_city_code) as bus_name,
  55. c.owner_id from ebpls_business_enterprise a, ebpls_business_enterprise_permit b,
  56. ebpls_owner c, comparative_statement d
  57. where d.for_year='$dateprev' and a.owner_id=d.owner_id and
  58. b.owner_id=d.owner_id and c.owner_id=d.owner_id and d.business_id=a.business_id and
  59. d.business_id=b.business_id and b.active=1
  60. ");
  61. $pdf->SetFont('Arial','',6);
  62. //$pdf->SetY($Y_Table_Position);
  63. while ($taxqn1=mysql_fetch_array($taxq1)) {
  64. $number_of_rows++;
  65. $pdf->Cell(35,5,$taxqn1[business_name],1,0,'C');
  66. $pdf->Cell(20,5,$taxqn1[business_permit_code],1,0,'C');
  67. $pdf->Cell(60,5,$taxqn1[fulln],1,0,'L');
  68. $pdf->SetFont('Arial','B',4);
  69. $pdf->Cell(70,5,$taxqn1[bus_name],1,0,'L');
  70. $pdf->SetFont('Arial','B',6);
  71. //2nd quarter
  72. $taxq2 = mysql_query("select d.or_no, d.taxes from
  73. ebpls_business_enterprise a, ebpls_business_enterprise_permit b,
  74. ebpls_owner c, comparative_statement d
  75. where d.for_year='$dateprev' and
  76. a.owner_id=d.owner_id and
  77. b.owner_id=d.owner_id and
  78. c.owner_id=d.owner_id and
  79. d.business_id=a.business_id and
  80. d.business_id=b.business_id and b.active=1 and
  81. c.owner_id = '$taxqn1[owner_id]' and
  82. d.month between 0 and 4 and d.month<>4");
  83. $taxn2 = mysql_fetch_array($taxq2);
  84. $pdf->Cell(20,5,$taxn2[taxes],1,0,'R');
  85. $pdf->Cell(15,5,$taxn2[or_no],1,0,'R');
  86. //$pdf->Cell(20,5,$taxqn1[taxes],1,0,'R');
  87. //$pdf->Cell(15,5,$taxqn1[or_no],1,0,'R');
  88. //2nd quarter
  89. $taxq2 = mysql_query("select d.or_no, d.taxes from
  90. ebpls_business_enterprise a, ebpls_business_enterprise_permit b,
  91. ebpls_owner c, comparative_statement d
  92. where d.for_year='$dateprev' and
  93. a.owner_id=d.owner_id and
  94. b.owner_id=d.owner_id and
  95. c.owner_id=d.owner_id and
  96. d.business_id=a.business_id and
  97. d.business_id=b.business_id and b.active=1 and
  98. c.owner_id = '$taxqn1[owner_id]' and
  99. d.month between 3 and 7 and d.month<>3 and d.month<>7");
  100. $taxn2 = mysql_fetch_array($taxq2);
  101. $pdf->Cell(20,5,$taxn2[taxes],1,0,'R');
  102. $pdf->Cell(15,5,$taxn2[or_no],1,0,'R');
  103. //3rd quarter
  104. $taxq2 = mysql_query("select d.or_no, d.taxes from
  105. ebpls_business_enterprise a, ebpls_business_enterprise_permit b,
  106. ebpls_owner c, comparative_statement d
  107. where d.for_year='$dateprev' and
  108. a.owner_id=d.owner_id and
  109. b.owner_id=d.owner_id and
  110. c.owner_id=d.owner_id and
  111. d.business_id=a.business_id and
  112. d.business_id=b.business_id and b.active=1 and
  113. c.owner_id = '$taxqn1[owner_id]' and
  114. d.month between 6 and 10 and d.month<>6 and d.month<>10");
  115. $taxn2 = mysql_fetch_array($taxq2);
  116. $pdf->Cell(20,5,$taxn2[taxes],1,0,'R');
  117. $pdf->Cell(15,5,$taxn2[or_no],1,0,'R');
  118. //4th quarter
  119. $taxq2 = mysql_query("select d.or_no, d.taxes from
  120. ebpls_business_enterprise a, ebpls_business_enterprise_permit b,
  121. ebpls_owner c, comparative_statement d
  122. where d.for_year='$dateprev' and
  123. a.owner_id=d.owner_id and
  124. b.owner_id=d.owner_id and
  125. c.owner_id=d.owner_id and
  126. d.business_id=a.business_id and
  127. d.business_id=b.business_id and b.active=1 and
  128. c.owner_id = '$taxqn1[owner_id]' and
  129. d.month between 9 and 13 and d.month<>9");
  130. $taxn2 = mysql_fetch_array($taxq2);
  131. $pdf->Cell(20,5,$taxn2[taxes],1,0,'R');
  132. $pdf->Cell(15,5,$taxn2[or_no],1,1,'R');
  133. }
  134. $pdf->Cell(15,5,'',0,1,'R');
  135. $result=mysql_query("select gs_name, gs_pos, gs_office from global_sign where sign_id =1") or die(mysql_error());
  136. $resulta=mysql_fetch_row($result);
  137. $Y_Table_Position = $Y_Table_Position + 5;
  138. $pdf->SetFont('Arial','B',10);
  139. $pdf->Cell(172,5,'Approved By:',1,0,'L');
  140. $pdf->Cell(172,5,'Noted By:',1,1,'L');
  141. $pdf->Cell(350,5,'',0,2,'C');
  142. $pdf->Cell(350,5,'',0,2,'C');
  143. $pdf->SetFont('Arial','BU',10);
  144. $pdf->SetX(5);
  145. $pdf->Cell(172,5,$resulta[0],1,0,'C');
  146. $pdf->Cell(172,5,$resulta[3],1,1,'C');
  147. $pdf->SetFont('Arial','B',10);
  148. $pdf->SetX(5);
  149. $pdf->Cell(172,5,$resulta[2],1,0,'C');
  150. $pdf->Cell(172,5,$resulta[7],1,1,'C');
  151. $pdf->Output();
  152. ?>