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

/reports/ebpls_buslist_suspended.php

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