PageRenderTime 50ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/reports/ebpls_bus_woutpermit_unpaid.php

http://ebpls.googlecode.com/
PHP | 469 lines | 130 code | 36 blank | 303 comment | 2 complexity | 9db924c981c8a147b20e8034a68856f6 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. class PDF extends FPDF
  7. {
  8. var $prov;
  9. var $lgu;
  10. var $office;
  11. var $y0;
  12. function setLGUinfo($p='', $l='', $o='') {
  13. $this->prov = $p;
  14. $this->lgu = $l;
  15. $this->office = $o;
  16. // echo 'setLGUinfo'.$this->prov;
  17. }
  18. function AcceptPageBreak()
  19. {
  20. //Method accepting or not automatic page break
  21. if($this->y<2)
  22. {
  23. //Set ordinate to top
  24. $this->SetY($this->y0);
  25. //Keep on page
  26. return false;
  27. }
  28. else
  29. {
  30. return true;
  31. }
  32. }
  33. //Page header
  34. function Header()
  35. {
  36. //Logo
  37. //$this->Image('logo_pb.png',10,8,33);
  38. //Arial bold 15
  39. $this->Image('peoplesmall.jpg',10,8,33);
  40. $this->SetFont('Arial','B',12);
  41. $this->Cell(340,5,'REPUBLIC OF THE PHILIPPINES',0,1,'C');
  42. $this->Cell(340,5,$this->prov,0,1,'C');
  43. $this->Cell(340,5,$this->lgu,0,2,'C');
  44. $this->SetFont('Arial','B',14);
  45. $this->Cell(340,5,$this->office,0,2,'C');
  46. $this->Cell(340,5,'',0,2,'C');
  47. $this->SetFont('Arial','BU',16);
  48. $this->Cell(340,5,'UNPAID BUSINESS ESTABLISHMENT WITHOUT PERMIT',0,1,'C');
  49. $this->Ln(22);
  50. }
  51. //Page footer
  52. function Footer()
  53. {
  54. //Position at 1.5 cm from bottom
  55. $this->SetY(-15);
  56. //Arial italic 8
  57. $this->SetFont('Arial','I',8);
  58. //Page number
  59. $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
  60. }
  61. } // end of PDF class
  62. $dbLink = get_db_connection();
  63. $result=mysql_query("select lgumunicipality, lguprovince, lguoffice from ebpls_buss_preference")
  64. or die(mysql_error());
  65. $resulta=mysql_fetch_row($result);
  66. //$pdf=new FPDF('L','mm','Legal');
  67. $pdf=new PDF('L','mm','Legal');
  68. $pdf->setLGUinfo($resulta[0],$resulta[1],$resulta[2]);
  69. $pdf->AddPage();
  70. $pdf->AliasNbPages();
  71. $Y_Label_position = 50;
  72. $Y_Table_Position = 55;
  73. $pdf->SetFont('Arial','B',6);
  74. $pdf->SetY($Y_Label_position);
  75. $pdf->SetX(5);
  76. $pdf->Cell(10,5,'SEQ. NO.',1,0,'C');
  77. $pdf->SetX(15);
  78. $pdf->Cell(25,5,'PERMIT NO.',1,0,'C');
  79. $pdf->SetX(40);
  80. $pdf->Cell(55,5,'NAME OF OWNER',1,0,'C');
  81. $pdf->SetX(95);
  82. $pdf->Cell(60,5,'BUSINESS NAME',1,0,'C');
  83. $pdf->SetX(155);
  84. $pdf->Cell(60,5,'BUSINESS NATURE',1,0,'C');
  85. $pdf->SetX(215);
  86. $pdf->Cell(60,5,'BUSINESS ADDRESS',1,0,'C');
  87. $pdf->SetX(275);
  88. $pdf->Cell(30,5,'CAPITAL INVESTMENT',1,0,'C');
  89. $pdf->SetX(305);
  90. $pdf->Cell(30,5,'GROSS LAST YEAR',1,0,'C');
  91. // $result=mysql_query("select ' ', business_name, ' ' , business_street, ' ' from ebpls_business_enterprise") or die(mysql_error());
  92. $result = mysql_query("select a.business_name, concat(a.business_lot_no, ' ', a.business_street, ' ',
  93. a.business_city_code, ' ', a.business_province_code, ' ', a.business_zip_code), a.employee_male, a.employee_female,
  94. concat(b.owner_first_name, ' ', b.owner_middle_name, ' ', b.owner_last_name), c.business_permit_id, c.active,
  95. d.bus_nature, d.cap_inv, d.last_yr
  96. from ebpls_business_enterprise a, ebpls_owner b, ebpls_business_enterprise_permit c,
  97. tempbusnature d, ebpls_transaction_payment_or e
  98. where b.owner_id = a.owner_id and a.business_id = c.business_id and a.business_id = d.business_id")
  99. or die(mysql_error());
  100. $number_of_rows = mysql_numrows($result);
  101. $result2 = mysql_query("select last_yr
  102. from ebpls_business_enterprise a, ebpls_owner b, ebpls_business_enterprise_permit c, tempbusnature d
  103. where b.owner_id = a.owner_id and a.business_id = c.business_id and a.business_id = d.business_id
  104. and d.active=1")
  105. or die(mysql_error());
  106. $number_of_rows2 = mysql_numrows($result2);
  107. $resulta2=mysql_fetch_row($result2);
  108. $i = 1;
  109. $pdf->SetY($Y_Table_Position);
  110. while ($resulta=mysql_fetch_row($result))
  111. {
  112. $pdf->SetX(1);
  113. //$pdf->MultiCell(349,5,$i,1);
  114. $pdf->SetX(5);
  115. $pdf->Cell(10,5,$i,1,0,'L');
  116. $pdf->SetX(15);
  117. $pdf->Cell(25,5,$resulta[5],1,0,'L');
  118. $pdf->SetX(40);
  119. $pdf->Cell(55,5,$resulta[4],1,0,'L');
  120. $pdf->SetX(95);
  121. $pdf->Cell(60,5,$resulta[0],1,0,'L');
  122. $pdf->SetX(155);
  123. $pdf->Cell(60,5,$resulta[7],1,0,'L');
  124. $pdf->SetX(215);
  125. $pdf->Cell(60,5,$resulta[1],1,0,'L');
  126. $pdf->SetX(275);
  127. $pdf->Cell(30,5,$resulta[8],1,0,'R');
  128. $pdf->SetX(305);
  129. $pdf->Cell(30,5,$resulta[9],1,0,'R');
  130. $i++;
  131. $pdf->SetY($pdf->GetY()+5);
  132. }
  133. /*
  134. $i = 1;
  135. $pdf->SetY($Y_Table_Position);
  136. while ($i < $number_of_rows)
  137. {
  138. $pdf->SetX(1);
  139. $pdf->MultiCell(349,5,$i,1);
  140. $i = $i +1;
  141. } */
  142. //new signatories table
  143. // $result=mysql_query("select gs_name, gs_pos, gs_office from global_sign where sign_id =1") or die(mysql_error());
  144. // $resulta=mysql_fetch_row($result);
  145. //$Y_Table_Position = $Y_Table_Position + 20;
  146. $pdf->Cell(270,5,'',0,1,'C');
  147. //$pdf->SetY(-18);
  148. $pdf->SetX(5);
  149. $pdf->SetFont('Arial','B',10);
  150. $pdf->Cell(172,5,'Recommend Approval:',1,0,'L');
  151. $pdf->Cell(173,5,'Approved:',1,1,'L');
  152. $pdf->Cell(270,5,'',0,1,'C');
  153. $pdf->Cell(270,5,'',0,1,'C');
  154. //$pdf->SetX(5);
  155. //$pdf->SetFont('Arial','BU',10);
  156. //$pdf->Cell(172,5,'',1,0,'C');
  157. //$pdf->Cell(172,5,$resulta[0],1,1,'C');
  158. //$pdf->SetFont('Arial','B',10);
  159. //$pdf->SetX(5);
  160. //$pdf->Cell(172,5,'',1,0,'C');
  161. //$pdf->Cell(172,5,$resulta[2],1,0,'C');
  162. $report_desc='Business Establishment Without Permit (Unpaid)';
  163. include 'report_signatories_footer1.php';
  164. $pdf->Output();
  165. ?>
  166. <?php /*
  167. require_once("lib/ebpls.utils.php");
  168. define('FPDF_FONTPATH','font/');
  169. require('ebpls-php-lib/html2pdf_lib/fpdf.php');
  170. include("lib/phpFunctions-inc.php");
  171. class PDF extends FPDF
  172. {
  173. var $prov;
  174. var $lgu;
  175. var $office;
  176. var $y0;
  177. function setLGUinfo($p='', $l='', $o='') {
  178. $this->prov = $p;
  179. $this->lgu = $l;
  180. $this->office = $o;
  181. // echo 'setLGUinfo'.$this->prov;
  182. }
  183. function AcceptPageBreak()
  184. {
  185. //Method accepting or not automatic page break
  186. if($this->y<2)
  187. {
  188. //Set ordinate to top
  189. $this->SetY($this->y0);
  190. //Keep on page
  191. return false;
  192. }
  193. else
  194. {
  195. return true;
  196. }
  197. }
  198. //Page header
  199. function Header()
  200. {
  201. //Logo
  202. //$this->Image('logo_pb.png',10,8,33);
  203. //Arial bold 15
  204. //$this->Image('peoplesmall.jpg',10,8,33);
  205. $this->SetFont('Arial','B',12);
  206. $this->Cell(340,5,'REPUBLIC OF THE PHILIPPINES',0,1,'C');
  207. $this->Cell(340,5,$this->prov,0,1,'C');
  208. $this->Cell(340,5,$this->lgu,0,2,'C');
  209. $this->SetFont('Arial','B',14);
  210. $this->Cell(340,5,$this->office,0,2,'C');
  211. $this->Cell(340,5,'',0,2,'C');
  212. $this->SetFont('Arial','BU',16);
  213. $this->Cell(340,5,'MASTERLIST OF BUSINESS ESTABLISHMENT',0,1,'C');
  214. $this->Ln(22);
  215. }
  216. //Page footer
  217. function Footer()
  218. {
  219. //Position at 1.5 cm from bottom
  220. $this->SetY(-15);
  221. //Arial italic 8
  222. $this->SetFont('Arial','I',8);
  223. //Page number
  224. $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
  225. }
  226. } // end of PDF class
  227. $dbLink = get_db_connection();
  228. $result=mysql_query("select lgumunicipality, lguprovince, lguoffice from ebpls_buss_preference")
  229. or die(mysql_error());
  230. $resulta=mysql_fetch_row($result);
  231. //$pdf=new FPDF('L','mm','Legal');
  232. $pdf=new PDF('L','mm','Legal');
  233. $pdf->setLGUinfo($resulta[0],$resulta[1],$resulta[2]);
  234. $pdf->AddPage();
  235. $pdf->AliasNbPages();
  236. //JUST FOR LISTING
  237. //$result=mysql_query("select ' ', business_name, ' ' , business_street, ' ' from ebpls_business_enterprise") or die(mysql_error());
  238. $result=mysql_query("select a.business_permit_code, concat(c.owner_first_name, ' ', c.owner_middle_name, ' ',
  239. c.owner_last_name), b.business_name, e.bus_nature, b.business_street, e.cap_inv, e.last_yr, d.total_amount_paid,
  240. d.or_no, d.or_date, b.business_category_code
  241. from ebpls_business_enterprise_permit a, ebpls_business_enterprise b, ebpls_owner c,
  242. ebpls_transaction_payment_or d, tempbusnature e
  243. where a.owner_id = b.owner_id and a.owner_id = c.owner_id and b.owner_id = d.trans_id
  244. and b.business_id = e.business_id")
  245. or die(mysql_error());
  246. $result=mysql_query("select a.business_permit_id, a.application_date, b.business_name, b.business_street,
  247. a.transaction, concat(c.owner_first_name, ' ', c.owner_middle_name, ' ', c.owner_last_name), c.owner_gender,
  248. concat(c.owner_street, ' ', c.owner_city_code, ' ', c.owner_province_code), a.business_permit_id, d.cap_inv,
  249. d.last_yr, b.employee_male, b.employee_female, d.bus_nature, b.business_payment_mode, c.owner_id, e.or_no,
  250. e.or_date from ebpls_business_enterprise_permit a, ebpls_business_enterprise b, ebpls_owner c, tempbusnature d,
  251. ebpls_transaction_payment_or e
  252. where a.business_id = b.business_id and a.owner_id = c.owner_id and a.business_id = d.business_id
  253. and c.owner_id = d.owner_id and b.owner_id = e.trans_id")
  254. or die(mysql_error());
  255. $resulta=mysql_fetch_row($result);
  256. $number_of_rows = mysql_numrows($result);
  257. while ($resulta=mysql_fetch_row($result))
  258. {
  259. $row1 = $resulta[0]; //permit number
  260. $row2 = $resulta[5]; //owner
  261. $row3 = $resulta[2]; //busines name
  262. $row4 = $resulta[13]; //nature
  263. $row5 = $resulta[3]; //bus address
  264. $row6 = $resulta[8]; //cap invest
  265. $row7 = $resulta[9]; //gross
  266. $row8 = $resulta[7]; //amount paid
  267. $row9 = $resulta[16]; //or_no
  268. $row10 = $resulta[17]; //payment date
  269. //$row10 = substr($resulta[17],0,10);
  270. $row11 = $resulta[10]; //ownership type
  271. $column_code1 = $column_code1.$row1."\n";
  272. $column_code2 = $column_code2.$row2."\n";
  273. $column_code3 = $column_code3.$row3."\n";
  274. $column_code4 = $column_code4.$row4."\n";
  275. $column_code5 = $column_code5.$row5."\n";
  276. $column_code6 = $column_code6.$row6."\n";
  277. $column_code7 = $column_code7.$row7."\n";
  278. $column_code8 = $column_code8.$row8."\n";
  279. $column_code9 = $column_code9.$row9."\n";
  280. $column_code10 = $column_code10.$row10."\n";
  281. $column_code11 = $column_code11.$row11."\n";
  282. }
  283. $pdf->SetLineWidth(2);
  284. $pdf->Line(0,45,360,45);
  285. $pdf->SetLineWidth(0);
  286. $pdf->Cell(270,5,'',0,1,'C');
  287. $pdf->Cell(270,5,'',0,1,'C');
  288. $Y_Label_position = 50;
  289. $Y_Table_Position = 55;
  290. $pdf->SetFont('Arial','B',6);
  291. $pdf->SetY($Y_Label_position);
  292. $pdf->SetX(5);
  293. $pdf->Cell(15,5,'PERMIT NO.',1,0,'C');
  294. $pdf->SetX(20);
  295. $pdf->Cell(50,5,'NAME OF OWNER',1,0,'C');
  296. $pdf->SetX(70);
  297. $pdf->Cell(50,5,'BUSINESS NAME',1,0,'C');
  298. $pdf->SetX(120);
  299. $pdf->Cell(30,5,'BUSINESS NATURE',1,0,'C');
  300. $pdf->SetX(150);
  301. $pdf->Cell(60,5,'BUSINESS ADDRESS',1,0,'C');
  302. $pdf->SetX(210);
  303. $pdf->Cell(30,5,'CAPITAL INVESTMENT',1,0,'C');
  304. $pdf->SetX(240);
  305. $pdf->Cell(30,5,'GROSS SALES',1,0,'C');
  306. $pdf->SetX(270);
  307. $pdf->Cell(20,5,'AMOUNT PAID',1,0,'C');
  308. $pdf->SetX(290);
  309. $pdf->Cell(15,5,'O.R. NO.',1,0,'C');
  310. $pdf->SetX(305);
  311. $pdf->Cell(20,5,'PAYMENT DATE',1,0,'C');
  312. $pdf->SetX(325);
  313. $pdf->Cell(25,5,'OWNERSHIP TYPE',1,0,'C');
  314. $pdf->SetFont('Arial','',6);
  315. $pdf->SetY($Y_Table_Position);
  316. $pdf->SetX(5);
  317. $pdf->MultiCell(15,5,$column_code1,1);
  318. $pdf->SetY($Y_Table_Position);
  319. $pdf->SetX(20);
  320. $pdf->MultiCell(50,5,$column_code2,1);
  321. $pdf->SetY($Y_Table_Position);
  322. $pdf->SetX(70);
  323. $pdf->MultiCell(50,5,$column_code3,1);
  324. $pdf->SetY($Y_Table_Position);
  325. $pdf->SetX(120);
  326. $pdf->MultiCell(30,5,$column_code4,1);
  327. $pdf->SetY($Y_Table_Position);
  328. $pdf->SetX(150);
  329. $pdf->MultiCell(60,5,$column_code5,1);
  330. $pdf->SetY($Y_Table_Position);
  331. $pdf->SetX(210);
  332. $pdf->MultiCell(30,5,$column_code6,1,'R');
  333. $pdf->SetY($Y_Table_Position);
  334. $pdf->SetX(240);
  335. $pdf->MultiCell(30,5,$column_code7,1,'R');
  336. $pdf->SetY($Y_Table_Position);
  337. $pdf->SetX(270);
  338. $pdf->MultiCell(20,5,$column_code8,1);
  339. $pdf->SetY($Y_Table_Position);
  340. $pdf->SetX(290);
  341. $pdf->MultiCell(15,5,$column_code9,1);
  342. $pdf->SetY($Y_Table_Position);
  343. $pdf->SetX(305);
  344. $pdf->MultiCell(20,5,$column_code10,1);
  345. $pdf->SetY($Y_Table_Position);
  346. $pdf->SetX(325);
  347. $pdf->MultiCell(25,5,$column_code11,1);
  348. //$pdf->MultiCell(349,5,$i,1);
  349. $pdf->Ln(20);
  350. $i = 1;
  351. $pdf->SetY($Y_Table_Position);
  352. while ($i < $number_of_rows)
  353. {
  354. $pdf->SetX(1);
  355. $pdf->MultiCell(349,5,$i,1);
  356. $i = $i +1;
  357. }
  358. //new signatories table
  359. $result=mysql_query("select gs_name, gs_pos, gs_office from global_sign where sign_id =1") or die(mysql_error());
  360. $resulta=mysql_fetch_row($result);
  361. //$Y_Table_Position = $Y_Table_Position + 20;
  362. $pdf->Cell(270,5,'',0,1,'C');
  363. $pdf->SetY(-18);
  364. $pdf->SetX(5);
  365. $pdf->SetFont('Arial','B',10);
  366. $pdf->Cell(172,5,'Recommend Approval:',1,0,'L');
  367. $pdf->Cell(173,5,'Approved:',1,1,'L');
  368. $pdf->Cell(270,5,'',0,1,'C');
  369. $pdf->Cell(270,5,'',0,1,'C');
  370. $pdf->SetX(5);
  371. $pdf->SetFont('Arial','BU',10);
  372. $pdf->Cell(172,5,'',1,0,'C');
  373. $pdf->Cell(172,5,$resulta[0],1,1,'C');
  374. $pdf->SetFont('Arial','B',10);
  375. $pdf->SetX(5);
  376. $pdf->Cell(172,5,'',1,0,'C');
  377. $pdf->Cell(172,5,$resulta[2],1,0,'C');
  378. //$pdf->SetFont('Arial','B',10);
  379. //$pdf->Cell(135,5,$resulta[2],1,0,'C');
  380. //$pdf->Cell(135,5,$resulta[2],1,1,'C');
  381. /*
  382. $pdf->SetY(-18);
  383. $pdf->SetX(5);
  384. $pdf->SetFont('Arial','B',10);
  385. $pdf->Cell(172,5,'Inspected By:',1,0,'L');
  386. $pdf->Cell(173,5,'Noted By:',1,1,'L');
  387. $pdf->Cell(350,5,'',0,2,'C');
  388. $pdf->Cell(350,5,'',0,2,'C');
  389. $pdf->SetFont('Arial','BU',10);
  390. $pdf->SetX(5);
  391. $pdf->Cell(172,5,$resulta[0],1,0,'C');
  392. $pdf->Cell(173,5,$resulta[3],1,1,'C');
  393. $pdf->SetFont('Arial','B',10);
  394. $pdf->SetX(5);
  395. $pdf->Cell(172,5,$resulta[4],1,0,'C');
  396. $pdf->Cell(173,5,$resulta[7],1,1,'C');
  397. */
  398. //$pdf->Output();
  399. ?>