PageRenderTime 59ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/reports/ebpls_collection_summary.php

http://ebpls.googlecode.com/
PHP | 248 lines | 127 code | 21 blank | 100 comment | 2 complexity | 810d73b024704c9e9dc36cb4afac4ba3 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. $criteria=$brgy_name.$owner_last.$bus_name.$trans.$bus_nature.$cap_inv.$last_yr;
  10. class PDF extends FPDF
  11. {
  12. var $prov;
  13. var $lgu;
  14. var $office;
  15. var $y0;
  16. function setLGUinfo($p='', $l='', $o='') {
  17. $this->prov = $p;
  18. $this->lgu = $l;
  19. $this->office = $o;
  20. // echo 'setLGUinfo'.$this->prov;
  21. }
  22. function AcceptPageBreak()
  23. {
  24. //Method accepting or not automatic page break
  25. if($this->y<2)
  26. {
  27. //Set ordinate to top
  28. $this->SetY($this->y0);
  29. //Keep on page
  30. return false;
  31. }
  32. else
  33. {
  34. return true;
  35. }
  36. }
  37. //Page header
  38. function Header()
  39. {
  40. //Logo
  41. //$this->Image('logo_pb.png',10,8,33);
  42. //Arial bold 15
  43. $this->Image('../images/ebpls_logo.jpg',10,8,33);
  44. $this->SetFont('Arial','B',12);
  45. /*--------------------------------------------------------------
  46. FREDERICK -> changed the cell width of the ff: from 340 to 195:
  47. $this->Cell(340,5,'REPUBLIC OF THE PHILIPPINES',0,1,'C');
  48. $this->Cell(340,5,$this->prov,0,1,'C');
  49. $this->Cell(340,5,$this->lgu,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,'COLLECTIONS SUMMARY',0,1,'C');
  55. Additionally: */
  56. //changed letter case
  57. $this->Cell(195,5,'Republic of the Philippines',0,1,'C');
  58. //change $this->prov and $this->lgu SEE: change made on lines 121 & 122
  59. //added the words "Province of & MUNICIPALITY OF"
  60. $this->Cell(195,5,'Province of '.$this->prov,0,1,'C');
  61. $this->Cell(195,5,'MUNICIPALITY OF '.strtoupper($this->lgu),0,2,'C');
  62. //added blank space
  63. $this->Cell(195,5,'',0,1,'C');
  64. $this->SetFont('Arial','B',14);
  65. //changed to ALL CAPS
  66. $this->Cell(195,5,strtoupper($this->office),0,2,'C');
  67. $this->Cell(195,5,'',0,2,'C');
  68. $this->SetFont('Arial','BU',16);
  69. $this->Cell(195,5,'COLLECTIONS SUMMARY',0,1,'C');
  70. $this->SetFont('Arial','BU',12);
  71. $this->Ln(22);
  72. }
  73. //-------------------------------------------------------------------------
  74. //Page footer
  75. function Footer()
  76. {
  77. //Position at 1.5 cm from bottom
  78. $this->SetY(-15);
  79. //Arial italic 8
  80. $this->SetFont('Arial','I',8);
  81. //Page number
  82. $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
  83. }
  84. } // end of PDF class
  85. //$dbLink = get_db_connection();
  86. $e = strrpos($owner_last,"-");//$owner_last is date
  87. $l =strlen($owner_last);
  88. $dateprev = substr($owner_last, $l-$e);
  89. $dateprev = $dateprev;
  90. $datenext = $dateprev + 1;
  91. $lgu=mysql_query("select * from ebpls_buss_preference")
  92. or die(mysql_error());
  93. $resulta=mysql_fetch_array($lgu);
  94. $result=@mysql_query("select * from ebpls_buss_tfo where taxfeetype='$taxtype'")
  95. or die(mysql_error());
  96. // $resulta=mysql_fetch_array($result);
  97. $getlgu = @mysql_query("select city_municipality_desc from ebpls_city_municipality where city_municipality_code = '$resulta[lguname]'");
  98. $getlgu = @mysql_fetch_row($getlgu);
  99. $getprov = @mysql_query("select province_desc from ebpls_province where province_code = '$resulta[lguprovince]'");
  100. $getprov = @mysql_fetch_row($getprov);
  101. //$pdf=new FPDF('L','mm','Legal');
  102. /*-------------------------------------------------------------------
  103. FREDERICK -> change Paper Orientation from Landscape to Portrait
  104. $pdf=new PDF('L','mm','Legal'); */
  105. $pdf=new PDF('P','mm','Legal');
  106. //change arrangement of $getlgu & $getprov SEE: function setLGUinfo on line 19
  107. //$pdf->setLGUinfo($getlgu[0],$getprov[0],$resulat[2]);
  108. $pdf->setLGUinfo($getprov[0],$getlgu[0],'Office of the Treasurer');
  109. //---------------------------------------------------------------------
  110. $pdf->AddPage();
  111. $pdf->AliasNbPages();
  112. $Y_Label_position = 50;
  113. $Y_Table_Position = 55;
  114. $resultpp=@mysql_query("select * from ebpls_buss_taxfeetype where taxfeetype='$taxtype'")
  115. or die(mysql_error());
  116. $gettype = @mysql_fetch_array($resultpp);
  117. //header
  118. $pdf->SetFont('Arial','B',6);
  119. $pdf->SetY($Y_Label_position);
  120. /*====================================================
  121. FREDERICK -> change X Coordinate from 5 to 55:
  122. /$pdf->SetX(5); */
  123. $pdf->SetX(55);
  124. //====================================================
  125. $pdf->Cell(50,5,$gettype[typedesc],1,0,'C');
  126. /*====================================================
  127. FREDERICK -> removed this X Coordinate
  128. /$pdf->SetX(55);
  129. =====================================================*/
  130. $pdf->Cell(55,5,'COLLECTION',1,1,'C');
  131. //second line
  132. $totalamount = 0;
  133. while ($getfees=mysql_fetch_array($result)) {
  134. $Yx++;
  135. $Yxx=$Yx*5;
  136. $pdf->SetY($Y_Label_position+$Yxx);
  137. /*=========================================
  138. FREDERICK -> change X coordinate
  139. /$pdf->SetX(5); */
  140. $pdf->SetX(55);
  141. //=========================================
  142. $pdf->Cell(50,5,$getfees[tfodesc],1,0,'L');
  143. $getamount = mysql_query("select sum(compval) from tempassess where tfoid='$getfees[tfoid]' and date_create between '$date_from' and '$date_to' and active='1'");
  144. $getamount = mysql_fetch_row($getamount);
  145. /*=========================================
  146. FREDERICK -> removed this X Coordinate
  147. $pdf->SetX(55); */
  148. //=========================================
  149. $pdf->Cell(55,5,number_format($getamount[0],2),1,0,'R');
  150. $totalamount = $totalamount + $getamount[0];
  151. }
  152. $totalamount = number_format($totalamount,2);
  153. /*=========================================
  154. FREDERICK -> change addtl Y coordinate from 10 to 6
  155. $pdf->SetY($Y_Label_position+$Yxx+10); */
  156. $pdf->SetY($Y_Label_position+$Yxx+6);
  157. /* changed this X Coordinate from 5 to 55
  158. $pdf->SetX(5); */
  159. $pdf->SetX(55);
  160. //=========================================
  161. $pdf->Cell(50,5,'Total',1,0,'L');
  162. /*=========================================
  163. FREDERICK -> removed this X coordinate
  164. $pdf->SetX(55);
  165. ===========================================*/
  166. $pdf->Cell(55,5,$totalamount,1,0,'R');
  167. /*=========================================
  168. FREDERICK -> change cell width of the ff: from 270 to 195
  169. $pdf->Cell(270,5,'',0,1,'C');
  170. $pdf->Cell(270,5,'',0,1,'C'); */
  171. $pdf->Cell(195,5,'',0,1,'C');
  172. $pdf->Cell(195,5,'',0,1,'C');
  173. //$pdf->SetY(-18);
  174. /* change X coordinate from 5to 25
  175. $pdf->SetX(5); */
  176. $pdf->SetX(25);
  177. //===========================================
  178. $pdf->SetFont('Arial','B',10);
  179. $pdf->Cell(50,5,'Prepared By :',0,0,'L');
  180. $pdf->SetX(125);
  181. $pdf->Cell(50,5,'Noted By :',0,1,'L');
  182. /*==========================================
  183. FREDERICK -> change cell width of the ff: from 270 to 195
  184. $pdf->Cell(270,5,'',0,1,'C');
  185. $pdf->Cell(270,5,'',0,1,'C'); */
  186. $pdf->Cell(195,5,'',0,1,'C');
  187. $pdf->Cell(195,5,'',0,1,'C');
  188. //===========================================
  189. $getuser = @mysql_query("select * from ebpls_user where username = '$usernm'") or die(mysql_error());
  190. $getuser = @mysql_fetch_array($getuser);
  191. $getsignatories = @mysql_query("select * from report_signatories where report_file='Comparative Annual Report' and sign_type='3'");
  192. $getsignatories1 = @mysql_fetch_array($getsignatories);
  193. $getsignatories = @mysql_query("select * from global_sign where sign_id='$getsignatories1[sign_id]'");
  194. $getsignatories1 = @mysql_fetch_array($getsignatories);
  195. /*====================================================
  196. FREDERICK -> change X coordinate from 5 to 25
  197. $pdf->SetX(5); */
  198. $pdf->SetX(25);
  199. $pdf->SetFont('Arial','B',10);
  200. $pdf->Cell(75,5,$getuser[firstname].' '.$getuser[lastname],0,0,'L');
  201. //add this X coordinate:
  202. $pdf->SetX(125);
  203. $pdf->Cell(75,5,$getsignatories1[gs_name],0,1,'L');
  204. $pdf->SetFont('Arial','B',10);
  205. //$pdf->SetX(5);
  206. $pdf->SetX(125);
  207. //$pdf->Cell(75,5,'',0,0,'C');
  208. $pdf->Cell(75,5,$getsignatories1[gs_pos],0,1,'L');
  209. //=====================================================
  210. //$pdf->SetFont('Arial','B',10);
  211. //$pdf->Cell(172,5,'Recommend Approval:',1,0,'L');
  212. //$pdf->Cell(172,5,'Approved:',1,1,'L');
  213. //$pdf->Cell(270,5,'',0,1,'C');
  214. //$pdf->Cell(270,5,'',0,1,'C');
  215. //$pdf->SetX(5);
  216. //$pdf->SetFont('Arial','BU',10);
  217. //$pdf->Cell(172,5,'',1,0,'C');
  218. //$pdf->Cell(172,5,$resulta[0],1,1,'C');
  219. //$pdf->SetFont('Arial','B',10);
  220. //$pdf->SetX(5);
  221. //$pdf->Cell(172,5,'',1,0,'C');
  222. //$pdf->Cell(172,5,$resulta[2],1,0,'C');
  223. $report_desc='Collection Summary';
  224. include '../report_signatories_footer1.php';
  225. $pdf->Output();
  226. ?>