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

/reports/ebpls_ctc_issued.php

http://ebpls.googlecode.com/
PHP | 213 lines | 169 code | 25 blank | 19 comment | 5 complexity | 0fa59efa2488e80f76f3d6168301c0ca 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. $criteria=$brgy_name.$owner_last.$bus_name.$trans.$bus_nature.$cap_inv.$last_yr;
  7. class PDF extends FPDF
  8. {
  9. var $prov;
  10. var $lgu;
  11. var $office;
  12. var $df;
  13. var $dt;
  14. var $y0;
  15. function setLGUinfo($p='', $l='', $o='') {
  16. $this->prov = $p;
  17. $this->lgu = $l;
  18. $this->office = $o;
  19. // echo 'setLGUinfo'.$this->prov;
  20. }
  21. function setDateRange($x='', $y='') {
  22. $this->df = $x;
  23. $this->dt = $y;
  24. }
  25. function AcceptPageBreak()
  26. {
  27. //Method accepting or not automatic page break
  28. if($this->y<2)
  29. {
  30. //Set ordinate to top
  31. $this->SetY($this->y0);
  32. //Keep on page
  33. return false;
  34. }
  35. else
  36. {
  37. return true;
  38. }
  39. }
  40. //Page header
  41. function Header()
  42. {
  43. //Logo
  44. //$this->Image('logo_pb.png',10,8,33);
  45. //Arial bold 15
  46. $this->SetFont('Arial','B',12);
  47. $this->Cell(340,5,'REPUBLIC OF THE PHILIPPINES',0,1,'C');
  48. $this->Cell(340,5,$this->lgu,0,1,'C');
  49. $this->Cell(340,5,$this->prov,0,2,'C');
  50. $this->SetFont('Arial','B',14);
  51. $this->Cell(340,5,$this->office,0,2,'C');
  52. $this->Cell(340,5,'',0,2,'C');
  53. $this->SetFont('Arial','BU',16);
  54. $this->Cell(340,5,'ABSTRACT OF CTC ISSUED',0,1,'C');
  55. $this->Cell(340,5,'',0,2,'C');
  56. $this->SetFont('Arial','',12);
  57. $this->Cell(340,5,'FROM '.$this->df.' TO '.$this->dt,0,1,'C');
  58. $this->Ln(22);
  59. }
  60. //Page footer
  61. function Footer()
  62. {
  63. //Position at 1.5 cm from bottom
  64. $this->SetY(-15);
  65. //Arial italic 8
  66. $this->SetFont('Arial','I',8);
  67. //Page number
  68. $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
  69. }
  70. } // end of PDF class
  71. include'../includes/variables.php';
  72. include_once("../lib/multidbconnection.php");
  73. $dbLink =Open($dbtype,$connecttype,$dbhost,$dbuser,$dbpass,$dbname);
  74. $result=@mysql_query("select lguname, lguprovince from ebpls_buss_preference")
  75. or die(mysql_error());
  76. $resulta=mysql_fetch_row($result);
  77. $getlgu = @mysql_query("select city_municipality_desc from ebpls_city_municipality where city_municipality_code = '$resulta[0]'");
  78. $getlgu = @mysql_fetch_row($getlgu);
  79. $getprov = @mysql_query("select province_desc from ebpls_province where province_code = '$resulta[1]'");
  80. $getprov = @mysql_fetch_row($getprov);
  81. $pdf=new PDF('L','mm','Legal');
  82. $pdf->setLGUinfo($getlgu[0],$getprov[0],'Office of the Treasurer');
  83. $pdf->setDateRange($date_from, $date_to);
  84. $pdf->AddPage();
  85. $pdf->AliasNbPages();
  86. $Y_Label_position = 50;
  87. $Y_Table_Position = 55;
  88. $pdf->SetFont('Arial','B',5);
  89. $pdf->SetY($Y_Label_position);
  90. $pdf->SetX(5);
  91. $pdf->Cell(70,5,'NAME',1,0,'C');
  92. $pdf->Cell(100,5,'ADDRESS',1,0,'C');
  93. $pdf->Cell(30,5,'DATE ISSUED',1,0,'C');
  94. $pdf->Cell(40,5,'AMOUNT PAID',1,0,'C');
  95. $pdf->Cell(40,5,'CTC #',1,0,'C');
  96. $pdf->Cell(40,5,'TAXABLED INCOME',1,0,'C');
  97. $date_from = str_replace("/", "", $date_from);
  98. $idate = strtotime($date_from);
  99. //$idate = $idate - (60*60*24);
  100. $date_from = date('Y-m-d', $idate);
  101. $date_to = str_replace("/", "", $date_to);
  102. $xdate = strtotime($date_to);
  103. $xdate = $xdate + (60*60*24);
  104. $date_to = date('Y-m-d', $xdate);
  105. $result1=mysql_query("select concat(ctc_first_name, ' ', ctc_middle_name, ' ', ctc_last_name) as name, ctc_code,
  106. ctc_address, ctc_date_issued, ctc_tax_due, ctc_tax_interest, ctc_additional_tax1, ctc_additional_tax2, ctc_additional_tax3 from ebpls_ctc_individual where ctc_date_issued between '$date_from' and '$date_to' order by name asc")
  107. or die(mysql_error());
  108. $x1 = @mysql_num_rows($result1);
  109. $result2=mysql_query("select ctc_company, ctc_code, ctc_company_address, ctc_date_issued, ctc_tax_due, ctc_tax_interest, ctc_additional_tax1, ctc_additional_tax2 from ebpls_ctc_business where ctc_date_issued between '$date_from' and '$date_to' order by ctc_company asc")
  110. or die(mysql_error());
  111. $x2 = @mysql_num_rows($result2);
  112. //$resulta=mysql_fetch_row($result);
  113. $i = 0;
  114. $pdf->SetY($Y_Table_Position);
  115. $total_ = 0;
  116. $pdf->SetFont('Arial','',5);
  117. while ($resulta1=mysql_fetch_row($result1))
  118. {
  119. $pdf->SetX(1);
  120. //$pdf->MultiCell(349,5,$i,1);
  121. $pdf->SetX(5);
  122. $pdf->Cell(70,5,$resulta1[0],1,0,'C');
  123. $pdf->Cell(100,5,$resulta1[2],1,0,'C');
  124. $pdf->Cell(30,5,$resulta1[3],1,0,'C');
  125. $pdf->Cell(40,5,number_format($resulta1[4] + $resulta1[5],2),1,0,'C');
  126. $pdf->Cell(40,5,$resulta[1],1,0,'C');
  127. $pdf->Cell(40,5,number_format($resulta1[6] + $resulta1[7] + $resulta1[8],2),1,0,'C');
  128. $total_ = $total_ + $resulta1[4] + $resulta1[5];
  129. $i++;
  130. $pdf->SetY($pdf->GetY()+5);
  131. }
  132. while ($resulta2=mysql_fetch_row($result2))
  133. {
  134. $pdf->SetX(1);
  135. //$pdf->MultiCell(349,5,$i,1);
  136. $pdf->SetX(5);
  137. $pdf->Cell(70,5,$resulta2[0],1,0,'C');
  138. $pdf->Cell(100,5,$resulta2[2],1,0,'C');
  139. $pdf->Cell(30,5,$resulta2[3],1,0,'C');
  140. $pdf->Cell(40,5,number_format($resulta2[4] + $resulta2[5],2),1,0,'C');
  141. $pdf->Cell(40,5,$resulta2[1],1,0,'C');
  142. $pdf->Cell(40,5,number_format($resulta2[6] + $resulta2[7],2),1,0,'C');
  143. $total_ = $total_ + $resulta2[4] + $resulta2[5];
  144. $i++;
  145. $pdf->SetY($pdf->GetY()+5);
  146. }
  147. $pdf->Cell(230,5,'',0,1,'L');
  148. $pdf->Cell(230,5,'',0,1,'L');
  149. $pdf->SetX(5);
  150. $pdf->Cell(230,5,'',0,0,'L');
  151. $pdf->Cell(50,5,'GRAND TOTAL OF AMOUNT PAID:',0,0,'C');
  152. $pdf->Cell(40,5,number_format($total_,2),1,1,'R');
  153. $pdf->SetX(5);
  154. $pdf->Cell(230,5,'',0,0,'L');
  155. $pdf->Cell(50,5,'ITEM COUNT:',0,0,'C');
  156. $x = $x1+$x2;
  157. if ($x == "") {
  158. $x = '0';
  159. }
  160. $pdf->Cell(30,5,$x,0,1,'R');
  161. // $result=mysql_query("select gs_name, gs_pos, gs_office from global_sign where sign_id =1") or die(mysql_error());
  162. // $resulta=mysql_fetch_row($result);
  163. $pdf->Cell(270,15,'',0,1,'C');
  164. $pdf->Cell(270,15,'',0,1,'C');
  165. $pdf->SetX(5);
  166. $pdf->SetFont('Arial','B',10);
  167. $pdf->Cell(252,5,'Prepared By:',0,0,'L');
  168. $pdf->Cell(173,5,'Noted By :',0,1,'L');
  169. $pdf->Cell(270,5,'',0,1,'C');
  170. $pdf->Cell(270,5,'',0,1,'C');
  171. $getuser = @mysql_query("select * from ebpls_user where username = '$usern'") or die(mysql_error());
  172. $getuser = @mysql_fetch_array($getuser);
  173. $getsignatories = @mysql_query("select * from report_signatories where report_file='CTC Business Application Masterlist' and sign_type='3'");
  174. $getsignatories1 = @mysql_fetch_array($getsignatories);
  175. $getsignatories = @mysql_query("select * from global_sign where sign_id='$getsignatories1[sign_id]'");
  176. $getsignatories1 = @mysql_fetch_array($getsignatories);
  177. $pdf->SetX(5);
  178. $pdf->SetFont('Arial','B',10);
  179. $pdf->Cell(252,5,$getuser[firstname].' '.$getuser[lastname],0,0,'L');
  180. $pdf->Cell(173,5,$getsignatories1[gs_name],0,1,'L');
  181. $pdf->SetFont('Arial','B',10);
  182. $pdf->SetX(5);
  183. $pdf->Cell(252,5,'',0,0,'C');
  184. $pdf->Cell(173,5,$getsignatories1[gs_pos],0,1,'L');
  185. $report_desc='CTC Business Application Masterlist';
  186. //include 'report_signatories_footer1.php';
  187. $pdf->Output();
  188. ?>