PageRenderTime 49ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/reports/ebpls_fishery_list.php

http://ebpls.googlecode.com/
PHP | 229 lines | 185 code | 26 blank | 18 comment | 9 complexity | f92e21a8b88251bb14b9ae0f8f6ef3a8 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 $trans $cap_inv $last_yr";
  10. class PDF extends FPDF
  11. {
  12. var $prov;
  13. var $lgu;
  14. var $office;
  15. var $df;
  16. var $dt;
  17. var $y0;
  18. function setLGUinfo($p='', $l='', $o='') {
  19. $this->prov = $p;
  20. $this->lgu = $l;
  21. $this->office = $o;
  22. // echo 'setLGUinfo'.$this->prov;
  23. }
  24. function setDateRange($x='', $y='') {
  25. $this->df = $x;
  26. $this->dt = $y;
  27. }
  28. function AcceptPageBreak()
  29. {
  30. //Method accepting or not automatic page break
  31. if($this->y<2)
  32. {
  33. //Set ordinate to top
  34. $this->SetY($this->y0);
  35. //Keep on page
  36. return false;
  37. }
  38. else
  39. {
  40. return true;
  41. }
  42. }
  43. //Page header
  44. function Header()
  45. {
  46. //Logo
  47. //$this->Image('logo_pb.png',10,8,33);
  48. //Arial bold 15
  49. $this->Image('../images/ebpls_logo.jpg',10,8,33);
  50. $this->SetFont('Arial','B',12);
  51. $this->Cell(340,5,'REPUBLIC OF THE PHILIPPINES',0,1,'C');
  52. $this->Cell(340,5,$this->lgu,0,1,'C');
  53. $this->Cell(340,5,$this->prov,0,2,'C');
  54. $this->SetFont('Arial','B',14);
  55. $this->Cell(340,5,$this->office,0,2,'C');
  56. $this->Cell(340,5,'',0,2,'C');
  57. $this->SetFont('Arial','BU',16);
  58. $this->Cell(340,5,'FISHERY REGISTRY',0,1,'C');
  59. $this->Cell(340,5,'',0,2,'C');
  60. $this->SetFont('Arial','',12);
  61. $this->Cell(340,5,'FROM '.$this->df.' TO '.$this->dt,0,1,'C');
  62. $this->Ln(22);
  63. }
  64. //Page footer
  65. function Footer()
  66. {
  67. //Position at 1.5 cm from bottom
  68. $this->SetY(-15);
  69. //Arial italic 8
  70. $this->SetFont('Arial','I',8);
  71. //Page number
  72. $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
  73. }
  74. } // end of PDF class
  75. $result=mysql_query("select lguname, lguprovince, lguoffice from ebpls_buss_preference")
  76. or die(mysql_error());
  77. $resulta=mysql_fetch_row($result);
  78. $getlgu = @mysql_query("select city_municipality_desc from ebpls_city_municipality where city_municipality_code = '$resulta[0]'");
  79. $getlgu = @mysql_fetch_row($getlgu);
  80. $getprov = @mysql_query("select province_desc from ebpls_province where province_code = '$resulta[1]'");
  81. $getprov = @mysql_fetch_row($getprov);
  82. if ($cap_inv2 == "" || $cap_inv2 == 0) {
  83. $cap_inv2 = 9999999999999;
  84. }
  85. //$pdf=new FPDF('L','mm','Legal');
  86. $pdf=new PDF('L','mm','Legal');
  87. $pdf->setLGUinfo($getlgu[0],$getprov[0],'');
  88. $pdf->AddPage();
  89. $pdf->AliasNbPages();
  90. $pdf->SetFont('Arial','B',10);
  91. $pdf->SetY(40);
  92. $pdf->SetX(10);
  93. $pdf->Cell(25,5,'',0,0,'L');
  94. $pdf->SetX(50);
  95. $pdf->Cell(100,5,'',0,1,'L');
  96. $Y_Label_position = 50;
  97. $Y_Table_Position = 55;
  98. $pdf->SetFont('Arial','B',6);
  99. $pdf->SetY($Y_Label_position);
  100. $pdf->SetX(5);
  101. $pdf->Cell(25,5,'PERMIT #',1,0,'C');
  102. $pdf->Cell(80,5,'OWNER',1,0,'C');
  103. $pdf->Cell(100,5,'ADDRESS',1,0,'C');
  104. $pdf->Cell(50,5,'BOAT NAME',1,0,'C');
  105. $pdf->Cell(25,5,'# OF CREW',1,0,'C');
  106. $pdf->Cell(25,5,'REGISTRATION #',1,0,'C');
  107. $pdf->Cell(25,5,'NATIONALITY',1,0,'C');
  108. if ($brgy_name == "") {
  109. $brgy_name = "$brgy_name%";
  110. } else {
  111. $brgy_name = "$brgy_name";
  112. }
  113. $date_from = str_replace("/", "", $date_from);
  114. $idate = strtotime($date_from);
  115. //$idate = $idate - (60*60*24);
  116. $date_from = date('Y-m-d', $idate);
  117. $date_to = str_replace("/", "", $date_to);
  118. $xdate = strtotime($date_to);
  119. $xdate = $xdate + (60*60*24);
  120. $date_to = date('Y-m-d', $xdate);
  121. $result = mysql_query ("select distinct (b.ebpls_fishery_permit_code) as pid,
  122. concat(a.owner_first_name, ' ', a.owner_middle_name, ' ', a.owner_last_name) as fulln, a.owner_citizenship,
  123. concat(a.owner_street, ' ', f.barangay_desc, ' ',
  124. g.city_municipality_desc, ' ', h.province_desc, ' ',
  125. a.owner_zip_code) as owner_add,
  126. d.boat_name, d.crew, d.reg_no, d.engine_type
  127. from ebpls_owner a, ebpls_fishery_permit b, fish_assess c, fish_boat d,
  128. ebpls_barangay f , ebpls_city_municipality g , ebpls_province h where
  129. b.active=1 and a.owner_id = b.owner_id and c.owner_id = b.owner_id and d.owner_id = a.owner_id
  130. and f.barangay_code = a.owner_barangay_code and g.city_municipality_code = a.owner_city_code
  131. and h.province_code = a.owner_province_code and c.owner_id = a.owner_id and
  132. b. ebpls_fishery_permit_application_date between '$date_from' and '$date_to'
  133. and a.owner_barangay_code like '$brgy_name'");
  134. $i = 1;
  135. $pdf->SetY($Y_Table_Position);
  136. $pdf->SetFont('Arial','',6);
  137. $total_ = 0;
  138. while ($resulta=mysql_fetch_array($result))
  139. {
  140. $pdf->SetX(1);
  141. //$pdf->MultiCell(349,5,$i,1);
  142. $pdf->SetX(5);
  143. $pdf->Cell(25,5,$resulta[pid],1,0,'C');
  144. $pdf->Cell(80,5,$resulta[fulln],1,0,'C');
  145. $pdf->Cell(100,5,$resulta[owner_add],1,0,'C');
  146. $pdf->Cell(50,5,$resulta[boat_name],1,0,'C');
  147. $pdf->Cell(25,5,$resulta[crew],1,0,'C');
  148. $pdf->Cell(25,5,$resulta[reg_no],1,0,'C');
  149. $pdf->Cell(25,5,$resulta[owner_citizenship],1,0,'C');
  150. $qute=0;
  151. $i++;
  152. $total_++;
  153. $pdf->SetY($pdf->GetY()+5);
  154. }
  155. $pdf->SetX(5);
  156. $pdf->Cell(20,5,'',0,0,'C');
  157. $pdf->Cell(60,5,'',0,0,'C');
  158. $pdf->Cell(80,5,'',0,0,'C');
  159. $pdf->Cell(25,5,'',0,0,'C');
  160. $pdf->Cell(25,5,'',0,0,'C');
  161. $pdf->Cell(25,5,'',0,0,'C');
  162. $pdf->Cell(25,5,'',0,0,'C');
  163. $pdf->Cell(25,5,'',0,0,'C');
  164. $pdf->Cell(25,5,'TOTAL :',0,0,'C');
  165. $pdf->Cell(25,5,$total_.' REGISTRY',0,1,'C');
  166. $pdf->SetX(5);
  167. $pdf->Cell(10,5,'',0,0,'L');
  168. $pdf->SetX(15);
  169. $pdf->Cell(25,5,'',0,0,'L');
  170. $pdf->SetX(40);
  171. $pdf->Cell(55,5,'',0,0,'L');
  172. $pdf->SetX(95);
  173. $pdf->Cell(60,5,'',0,0,'L');
  174. $pdf->SetX(155);
  175. $pdf->Cell(90,5,'',0,1,'L');
  176. //$pdf->SetX(305);
  177. $pdf->Cell(270,5,'',0,1,'C');
  178. $pdf->Cell(270,5,'',0,1,'C');
  179. //$pdf->SetY(-18);
  180. $pdf->SetX(5);
  181. $pdf->SetFont('Arial','B',10);
  182. $pdf->Cell(172,5,'Prepared By :',0,0,'L');
  183. $pdf->Cell(172,5,'Noted By :',0,1,'L');
  184. $pdf->Cell(270,5,'',0,1,'C');
  185. $pdf->Cell(270,5,'',0,1,'C');
  186. $getuser = @mysql_query("select * from ebpls_user where username = '$usernm'") or die(mysql_error());
  187. $getuser = @mysql_fetch_array($getuser);
  188. $getsignatories = @mysql_query("select * from report_signatories where report_file='Fishery Registry' and sign_type='3'");
  189. $getsignatories1 = @mysql_fetch_array($getsignatories);
  190. $getsignatories = @mysql_query("select * from global_sign where sign_id='$getsignatories1[sign_id]'");
  191. $getsignatories1 = @mysql_fetch_array($getsignatories);
  192. $pdf->SetX(5);
  193. $pdf->SetFont('Arial','B',10);
  194. $pdf->Cell(172,5,$getuser[firstname].' '.$getuser[lastname],0,0,'L');
  195. $pdf->Cell(172,5,$getsignatories1[gs_name],0,1,'L');
  196. $pdf->SetFont('Arial','B',10);
  197. $pdf->SetX(5);
  198. $pdf->Cell(172,5,'',0,0,'C');
  199. $pdf->Cell(172,5,$getsignatories1[gs_pos],0,1,'L');
  200. $report_desc='Business Establishment';
  201. //include '../report_signatories_footer1.php';
  202. $pdf->Output();
  203. ?>