PageRenderTime 64ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 0ms

/reports/ebpls_comparative_annual.php

http://ebpls.googlecode.com/
PHP | 722 lines | 609 code | 76 blank | 37 comment | 49 complexity | e1145ab05131699ab112cd5d454f0f3c 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. $this->Cell(340,5,'REPUBLIC OF THE PHILIPPINES',0,1,'C');
  46. $this->Cell(340,5,$this->prov,0,1,'C');
  47. $this->Cell(340,5,$this->lgu,0,2,'C');
  48. $this->SetFont('Arial','B',14);
  49. $this->Cell(340,5,$this->office,0,2,'C');
  50. $this->Cell(340,5,'',0,2,'C');
  51. $this->SetFont('Arial','BU',16);
  52. $this->Cell(340,5,'QUARTERLY COMPARATIVE REPORT',0,1,'C');
  53. $this->SetFont('Arial','BU',12);
  54. $this->Ln(22);
  55. }
  56. //Page footer
  57. function Footer()
  58. {
  59. //Position at 1.5 cm from bottom
  60. $this->SetY(-15);
  61. //Arial italic 8
  62. $this->SetFont('Arial','I',8);
  63. //Page number
  64. $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
  65. }
  66. } // end of PDF class
  67. //$dbLink = get_db_connection();
  68. $e = strrpos($owner_last,"-");//$owner_last is date
  69. $l =strlen($owner_last);
  70. $dateprev = substr($owner_last, 0,4);
  71. $dateprev = $dateprev;
  72. $datenext = $dateprev + 1;
  73. $result=mysql_query("select lguname, lguprovince, lguoffice from ebpls_buss_preference")
  74. or die(mysql_error());
  75. $resulta=mysql_fetch_row($result);
  76. //taxes
  77. $sumtaxq1 = mysql_query("select sum(taxes) from comparative_statement where for_year='$dateprev' and
  78. paid = 0 and month>=1 and month<=3");
  79. $sumtaxq1 = mysql_fetch_row($sumtaxq1);
  80. $sumtaxq2 = mysql_query("select sum(taxes) from comparative_statement where for_year='$dateprev' and
  81. paid = 0 and month>=4 and month<=6");
  82. $sumtaxq2 = mysql_fetch_row($sumtaxq2);
  83. $sumtaxq3 = mysql_query("select sum(taxes) from comparative_statement where for_year='$dateprev' and
  84. paid = 0 and month>=7 and month<=9");
  85. $sumtaxq3 = mysql_fetch_row($sumtaxq3);
  86. $sumtaxq4 = mysql_query("select sum(taxes) from comparative_statement where for_year='$dateprev' and
  87. paid = 0 and month>=10 and month<=12");
  88. $sumtaxq4 = mysql_fetch_row($sumtaxq4);
  89. $sumtaxq1n = mysql_query("select sum(taxes) from comparative_statement where for_year='$datenext' and
  90. paid = 0 and month>=1 and month<=3");
  91. $sumtaxq1n = mysql_fetch_row($sumtaxq1n);
  92. $sumtaxq2n = mysql_query("select sum(taxes) from comparative_statement where for_year='$datenext' and
  93. paid = 0 and month>=4 and month<=6");
  94. $sumtaxq2n = mysql_fetch_row($sumtaxq2n);
  95. $sumtaxq3n = mysql_query("select sum(taxes) from comparative_statement where for_year='$datenext' and
  96. paid = 0 and month>=7 and month<=9");
  97. $sumtaxq3n = mysql_fetch_row($sumtaxq3n);
  98. $sumtaxq4n = mysql_query("select sum(taxes) from comparative_statement where for_year='$datenext' and
  99. paid = 0 and month>=10 and month<=12");
  100. $sumtaxq4n = mysql_fetch_row($sumtaxq4n);
  101. //fees
  102. $sumfeeq1 = mysql_query("select sum(fees) from comparative_statement where for_year='$dateprev' and
  103. paid = 0 and month>=1 and month<=3");
  104. $sumfeeq1 = mysql_fetch_row($sumfeeq1);
  105. $sumfeeq2 = mysql_query("select sum(fees) from comparative_statement where for_year='$dateprev' and
  106. paid = 0 and month>=4 and month<=6");
  107. $sumfeeq2 = mysql_fetch_row($sumfeeq2);
  108. $sumfeeq3 = mysql_query("select sum(fees) from comparative_statement where for_year='$dateprev' and
  109. paid = 0 and month>=7 and month<=9");
  110. $sumfeeq3 = mysql_fetch_row($sumfeeq3);
  111. $sumfeeq4 = mysql_query("select sum(fees) from comparative_statement where for_year='$dateprev' and
  112. paid = 0 and month>=10 and month<=12");
  113. $sumfeeq4 = mysql_fetch_row($sumfeeq4);
  114. $sumfeeq1n = mysql_query("select sum(fees) from comparative_statement where for_year='$datenext' and
  115. paid = 0 and month>=1 and month<=3");
  116. $sumfeeq1n = mysql_fetch_row($sumfeeq1n);
  117. $sumfeeq2n = mysql_query("select sum(fees) from comparative_statement where for_year='$datenext' and
  118. paid = 0 and month>=4 and month<=6");
  119. $sumfeeq2n = mysql_fetch_row($sumfeeq2n);
  120. $sumfeeq3n = mysql_query("select sum(fees) from comparative_statement where for_year='$datenext' and
  121. paid = 0 and month>=7 and month<=9");
  122. $sumfeeq3n = mysql_fetch_row($sumfeeq3n);
  123. $sumfeeq4n = mysql_query("select sum(fees) from comparative_statement where for_year='$datenext' and
  124. paid = 0 and month>=10 and month<=12");
  125. $sumfeeq4n = mysql_fetch_row($sumfeeq4n);
  126. //penalty
  127. $sumpenq1 = mysql_query("select sum(penalty) from comparative_statement where for_year='$dateprev' and
  128. paid = 0 and month>=1 and month<=3");
  129. $sumpenq1 = mysql_fetch_row($sumpenq1);
  130. $sumpenq2 = mysql_query("select sum(penalty) from comparative_statement where for_year='$dateprev' and
  131. paid = 0 and month>=4 and month<=6");
  132. $sumpenq2 = mysql_fetch_row($sumpenq2);
  133. $sumpenq3 = mysql_query("select sum(penalty) from comparative_statement where for_year='$dateprev' and
  134. paid = 0 and month>=7 and month<=9");
  135. $sumpenq3 = mysql_fetch_row($sumpenq3);
  136. $sumpenq4 = mysql_query("select sum(penalty) from comparative_statement where for_year='$dateprev' and
  137. paid = 0 and month>=10 and month<=12");
  138. $sumpenq4 = mysql_fetch_row($sumpenq4);
  139. $sumpenq1n = mysql_query("select sum(penalty) from comparative_statement where for_year='$datenext' and
  140. paid = 0 and month>=1 and month<=3");
  141. $sumpenq1n = mysql_fetch_row($sumpenq1n);
  142. $sumpenq2n = mysql_query("select sum(penalty) from comparative_statement where for_year='$datenext' and
  143. paid = 0 and month>=4 and month<=6");
  144. $sumpenq2n = mysql_fetch_row($sumpenq2n);
  145. $sumpenq3n = mysql_query("select sum(penalty) from comparative_statement where for_year='$datenext' and
  146. paid = 0 and month>=7 and month<=9");
  147. $sumpenq3n = mysql_fetch_row($sumpenq3n);
  148. $sumpenq4n = mysql_query("select sum(penalty) from comparative_statement where for_year='$datenext' and
  149. paid = 0 and month>=10 and month<=12");
  150. $sumpenq4n = mysql_fetch_row($sumpenq4n);
  151. //surcharge
  152. $sumintq1 = mysql_query("select sum(surcharge) from comparative_statement where for_year='$dateprev' and
  153. paid = 0 and month>=1 and month<=3");
  154. $sumintq1 = mysql_fetch_row($sumintq1);
  155. $sumintq2 = mysql_query("select sum(surcharge) from comparative_statement where for_year='$dateprev' and
  156. paid = 0 and month>=4 and month<=6");
  157. $sumintq2 = mysql_fetch_row($sumintq2);
  158. $sumintq3 = mysql_query("select sum(surcharge) from comparative_statement where for_year='$dateprev' and
  159. paid = 0 and month>=7 and month<=9");
  160. $sumintq3 = mysql_fetch_row($sumintq3);
  161. $sumintq4 = mysql_query("select sum(surcharge) from comparative_statement where for_year='$dateprev' and
  162. paid = 0 and month>=10 and month<=12");
  163. $sumintq4 = mysql_fetch_row($sumintq4);
  164. $sumintq1n = mysql_query("select sum(surcharge) from comparative_statement where for_year='$datenext' and
  165. paid = 0 and month>=1 and month<=3");
  166. $sumintq1n = mysql_fetch_row($sumintq1n);
  167. $sumintq2n = mysql_query("select sum(surcharge) from comparative_statement where for_year='$datenext' and
  168. paid = 0 and month>=4 and month<=6");
  169. $sumintq2n = mysql_fetch_row($sumintq2n);
  170. $sumintq3n = mysql_query("select sum(surcharge) from comparative_statement where for_year='$datenext' and
  171. paid = 0 and month>=7 and month<=9");
  172. $sumintq3n = mysql_fetch_row($sumintq3n);
  173. $sumintq4n = mysql_query("select sum(surcharge) from comparative_statement where for_year='$datenext' and
  174. paid = 0 and month>=10 and month<=12");
  175. $sumintq4n = mysql_fetch_row($sumintq4n);
  176. //backtax
  177. $sumbakq1 = mysql_query("select sum(backtax) from comparative_statement where for_year='$dateprev' and
  178. paid = 0 and month>=1 and month<=3");
  179. $sumbakq1 = mysql_fetch_row($sumbakq1);
  180. $sumbakq2 = mysql_query("select sum(backtax) from comparative_statement where for_year='$dateprev' and
  181. paid = 0 and month>=4 and month<=6");
  182. $sumbakq2 = mysql_fetch_row($sumbakq2);
  183. $sumbakq3 = mysql_query("select sum(backtax) from comparative_statement where for_year='$dateprev' and
  184. paid = 0 and month>=7 and month<=9");
  185. $sumbakq3 = mysql_fetch_row($sumbakq3);
  186. $sumbakq4 = mysql_query("select sum(backtax) from comparative_statement where for_year='$dateprev' and
  187. paid = 0 and month>=10 and month<=12");
  188. $sumbakq4 = mysql_fetch_row($sumbakq4);
  189. $sumbakq1n = mysql_query("select sum(backtax) from comparative_statement where for_year='$datenext' and
  190. paid = 0 and month>=1 and month<=3");
  191. $sumbakq1n = mysql_fetch_row($sumbakq1n);
  192. $sumbakq2n = mysql_query("select sum(backtax) from comparative_statement where for_year='$datenext' and
  193. paid = 0 and month>=4 and month<=6");
  194. $sumbakq2n = mysql_fetch_row($sumbakq2n);
  195. $sumbakq3n = mysql_query("select sum(backtax) from comparative_statement where for_year='$datenext' and
  196. paid = 0 and month>=7 and month<=9");
  197. $sumbakq3n = mysql_fetch_row($sumbakq3n);
  198. $sumbakq4n = mysql_query("select sum(backtax) from comparative_statement where for_year='$datenext' and
  199. paid = 0 and month>=10 and month<=12");
  200. $sumbakq4n = mysql_fetch_row($sumbakq4n);
  201. //total
  202. $totalq1 = $sumtaxq1[0]+$sumfeeq1[0]+$sumpenq1[0]+$sumintq1[0]+$sumbakq1[0];
  203. $totalq2 = $sumtaxq2[0]+$sumfeeq2[0]+$sumpenq2[0]+$sumintq2[0]+$sumbakq2[0];
  204. $totalq3 = $sumtaxq3[0]+$sumfeeq3[0]+$sumpenq3[0]+$sumintq3[0]+$sumbakq3[0];
  205. $totalq4 = $sumtaxq4[0]+$sumfeeq4[0]+$sumpenq4[0]+$sumintq4[0]+$sumbakq4[0];
  206. $totalq1n = $sumtaxq1n[0]+$sumfeeq1n[0]+$sumpenq1n[0]+$sumintq1n[0]+$sumbakq1n[0];
  207. $totalq2n = $sumtaxq2n[0]+$sumfeeq2n[0]+$sumpenq2n[0]+$sumintq2n[0]+$sumbakq2n[0];
  208. $totalq3n = $sumtaxq3n[0]+$sumfeeq3n[0]+$sumpenq3n[0]+$sumintq3n[0]+$sumbakq3n[0];
  209. $totalq4n = $sumtaxq4n[0]+$sumfeeq4n[0]+$sumpenq4n[0]+$sumintq4n[0]+$sumbakq4n[0];
  210. //difference
  211. $difftaxq1 = $sumtaxq1n[0]-$sumtaxq1[0];
  212. $difftaxq2 = $sumtaxq2n[0]-$sumtaxq2[0];
  213. $difftaxq3 = $sumtaxq3n[0]-$sumtaxq3[0];
  214. $difftaxq4 = $sumtaxq4n[0]-$sumtaxq4[0];
  215. $difffeeq1 = $sumfeeq1n[0]-$sumfeeq1[0];
  216. $difffeeq2 = $sumfeeq2n[0]-$sumfeeq2[0];
  217. $difffeeq3 = $sumfeeq3n[0]-$sumfeeq3[0];
  218. $difffeeq4 = $sumfeeq4n[0]-$sumfeeq4[0];
  219. $diffpenq1 = $sumpenq1n[0]-$sumpenq1[0];
  220. $diffpenq2 = $sumpenq2n[0]-$sumpenq2[0];
  221. $diffpenq3 = $sumpenq3n[0]-$sumpenq3[0];
  222. $diffpenq4 = $sumpenq4n[0]-$sumpenq4[0];
  223. $diffintq1 = $sumintq1n[0]-$sumintq1[0];
  224. $diffintq2 = $sumintq2n[0]-$sumintq2[0];
  225. $diffintq3 = $sumintq3n[0]-$sumintq3[0];
  226. $diffintq4 = $sumintq4n[0]-$sumintq4[0];
  227. $diffbakq1 = $sumbakq1n[0]-$sumbakq1[0];
  228. $diffbakq2 = $sumbakq2n[0]-$sumbakq2[0];
  229. $diffbakq3 = $sumbakq3n[0]-$sumbakq3[0];
  230. $diffbakq4 = $sumbakq4n[0]-$sumbakq4[0];
  231. $difftotq1 = $totalq1n-$totalq1;
  232. $difftotq2 = $totalq2n-$totalq2;
  233. $difftotq3 = $totalq3n-$totalq3;
  234. $difftotq4 = $totalq4n-$totalq4;
  235. //percentage
  236. if ($sumtaxq1[0]==0) {
  237. $percentdifftaxq1 = ($difftaxq1/1)*100;
  238. } else {
  239. $percentdifftaxq1 = ($difftaxq1/$sumtaxq1[0])*100;
  240. }
  241. if ($sumtaxq2[0]==0) {
  242. $percentdifftaxq2 = ($difftaxq2/1)*100;
  243. } else {
  244. $percentdifftaxq2 = ($difftaxq2/$sumtaxq2[0])*100;
  245. }
  246. if ($sumtaxq3[0]==0) {
  247. $percentdifftaxq3 = ($difftaxq3/1)*100;
  248. } else {
  249. $percentdifftaxq3 = ($difftaxq3/$sumtaxq3[0])*100;
  250. }
  251. if ($sumtaxq4[0]==0) {
  252. $percentdifftaxq4 = ($difftaxq4/1)*100;
  253. } else {
  254. $percentdifftaxq4 = ($difftaxq4/$sumtaxq4[0])*100;
  255. }
  256. if ($sumfeeq1[0]==0) {
  257. $percentdifffeeq1 = ($difffeeq1/1)*100;
  258. } else {
  259. $percentdifffeeq1 = ($difffeeq1/$sumfeeq1[0])*100;
  260. }
  261. if ($sumfeeq2[0]==0) {
  262. $percentdifffeeq2 = ($difffeeq2/1)*100;
  263. } else {
  264. $percentdifffeeq2 = ($difffeeq2/$sumfeeq2[0])*100;
  265. }
  266. if ($sumfeeq3[0]==0) {
  267. $percentdifffeeq3 = ($difffeeq3/1)*100;
  268. } else {
  269. $percentdifffeeq3 = ($difffeeq3/$sumfeeq3[0])*100;
  270. }
  271. if ($sumfeeq4[0]==0) {
  272. $percentdifffeeq4 = ($difffeeq4/1)*100;
  273. } else {
  274. $percentdifffeeq4 = ($difffeeq4/$sumfeeq4[0])*100;
  275. }
  276. if ($sumpenq1[0]==0) {
  277. $percentdiffpenq1 = ($diffpenq1/1)*100;
  278. } else {
  279. $percentdiffpenq1 = ($diffpenq1/$sumpenq1[0])*100;
  280. }
  281. if ($sumpenq2[0]==0) {
  282. $percentdiffpenq2 = ($diffpenq2/1)*100;
  283. } else {
  284. $percentdiffpenq2 = ($diffpenq2/$sumpenq2[0])*100;
  285. }
  286. if ($sumpenq3[0]==0) {
  287. $percentdiffpenq3 = ($diffpenq3/1)*100;
  288. } else {
  289. $percentdiffpenq3 = ($diffpenq3/$sumpenq3[0])*100;
  290. }
  291. if ($sumpenq4[0]==0) {
  292. $percentdiffpenq4 = ($diffpenq4/1)*100;
  293. } else {
  294. $percentdiffpenq4 = ($diffpenq4/$sumpenq4[0])*100;
  295. }
  296. if ($sumintq1[0]==0) {
  297. $percentdiffintq1 = ($diffintq1/1)*100;
  298. } else {
  299. $percentdiffintq1 = ($diffintq1/$sumintq1[0])*100;
  300. }
  301. if ($sumintq2[0]==0) {
  302. $percentdiffintq2 = ($diffintq2/1)*100;
  303. } else {
  304. $percentdiffintq2 = ($diffintq2/$sumintq2[0])*100;
  305. }
  306. if ($sumintq3[0]==0) {
  307. $percentdiffintq3 = ($diffintq3/1)*100;
  308. } else {
  309. $percentdiffintq3 = ($diffintq3/$sumintq3[0])*100;
  310. }
  311. if ($sumintq4[0]==0) {
  312. $percentdiffintq4 = ($diffintq4/1)*100;
  313. } else {
  314. $percentdiffintq4 = ($diffintq4/$sumintq4[0])*100;
  315. }
  316. if ($sumbakq1[0]==0) {
  317. $percentdiffbakq1 = ($diffbakq1/1)*100;
  318. } else {
  319. $percentdiffbakq1 = ($diffbakq1/$sumbakq1[0])*100;
  320. }
  321. if ($sumbakq2[0]==0) {
  322. $percentdiffbakq2 = ($diffbakq2/1)*100;
  323. } else {
  324. $percentdiffbakq2 = ($diffbakq2/$sumbakq2[0])*100;
  325. }
  326. if ($sumbakq3[0]==0) {
  327. $percentdiffbakq3 = ($diffbakq3/1)*100;
  328. } else {
  329. $percentdiffbakq3 = ($diffbakq3/$sumbakq3[0])*100;
  330. }
  331. if ($sumbakq4[0]==0) {
  332. $percentdiffbakq4 = ($diffbakq4/1)*100;
  333. } else {
  334. $percentdiffbakq4 = ($diffbakq4/$sumbakq4[0])*100;
  335. }
  336. if ($totalq1==0) {
  337. $percentdifftotq1 = ($difftotq1/1)*100;
  338. } else {
  339. $percentdifftotq1 = ($difftotq1/$totalq1)*100;
  340. }
  341. if ($totalq2==0) {
  342. $percentdifftotq2 = ($difftotq2/1)*100;
  343. } else {
  344. $percentdifftotq2 = ($difftotq2/$totalq2)*100;
  345. }
  346. if ($totalq3==0) {
  347. $percentdifftotq3 = ($difftotq3/1)*100;
  348. } else {
  349. $percentdifftotq3 = ($difftotq3/$totalq3)*100;
  350. }
  351. if ($totalq4==0) {
  352. $percentdifftotq4 = ($difftotq4/1)*100;
  353. } else {
  354. $percentdifftotq4 = ($difftotq4/$totalq4)*100;
  355. }
  356. //formatting
  357. $sumtaxq1[0]=number_format($sumtaxq1[0],2);
  358. $sumtaxq2[0]=number_format($sumtaxq2[0],2);
  359. $sumtaxq3[0]=number_format($sumtaxq3[0],2);
  360. $sumtaxq4[0]=number_format($sumtaxq4[0],2);
  361. $sumfeeq1[0]=number_format($sumfeeq1[0],2);
  362. $sumfeeq2[0]=number_format($sumfeeq2[0],2);
  363. $sumfeeq3[0]=number_format($sumfeeq3[0],2);
  364. $sumfeeq4[0]=number_format($sumfeeq4[0],2);
  365. $sumpenq1[0]=number_format($sumpenq1[0],2);
  366. $sumpenq2[0]=number_format($sumpenq2[0],2);
  367. $sumpenq3[0]=number_format($sumpenq3[0],2);
  368. $sumpenq4[0]=number_format($sumpenq4[0],2);
  369. $sumintq1[0]=number_format($sumintq1[0],2);
  370. $sumintq2[0]=number_format($sumintq2[0],2);
  371. $sumintq3[0]=number_format($sumintq3[0],2);
  372. $sumintq4[0]=number_format($sumintq4[0],2);
  373. $sumbakq1[0]=number_format($sumbakq1[0],2);
  374. $sumbakq2[0]=number_format($sumbakq2[0],2);
  375. $sumbakq3[0]=number_format($sumbakq3[0],2);
  376. $sumbakq4[0]=number_format($sumbakq4[0],2);
  377. $sumtaxq1n[0]=number_format($sumtaxq1n[0],2);
  378. $sumtaxq2n[0]=number_format($sumtaxq2n[0],2);
  379. $sumtaxq3n[0]=number_format($sumtaxq3n[0],2);
  380. $sumtaxq4n[0]=number_format($sumtaxq4n[0],2);
  381. $sumfeeq1n[0]=number_format($sumfeeq1n[0],2);
  382. $sumfeeq2n[0]=number_format($sumfeeq2n[0],2);
  383. $sumfeeq3n[0]=number_format($sumfeeq3n[0],2);
  384. $sumfeeq4n[0]=number_format($sumfeeq4n[0],2);
  385. $sumpenq1n[0]=number_format($sumpenq1n[0],2);
  386. $sumpenq2n[0]=number_format($sumpenq2n[0],2);
  387. $sumpenq3n[0]=number_format($sumpenq3n[0],2);
  388. $sumpenq4n[0]=number_format($sumpenq4n[0],2);
  389. $sumintq1n[0]=number_format($sumintq1n[0],2);
  390. $sumintq2n[0]=number_format($sumintq2n[0],2);
  391. $sumintq3n[0]=number_format($sumintq3n[0],2);
  392. $sumintq4n[0]=number_format($sumintq4n[0],2);
  393. $sumbakq1n[0]=number_format($sumbakq1n[0],2);
  394. $sumbakq2n[0]=number_format($sumbakq2n[0],2);
  395. $sumbakq3n[0]=number_format($sumbakq3n[0],2);
  396. $sumbakq4n[0]=number_format($sumbakq4n[0],2);
  397. $totalq1=number_format($totalq1,2);
  398. $totalq2=number_format($totalq2,2);
  399. $totalq3=number_format($totalq3,2);
  400. $totalq4=number_format($totalq4,2);
  401. $totalq1n=number_format($totalq1n,2);
  402. $totalq2n=number_format($totalq2n,2);
  403. $totalq3n=number_format($totalq3n,2);
  404. $totalq4n=number_format($totalq4n,2);
  405. $difftaxq1 = number_format($difftaxq1,2);
  406. $difftaxq2 = number_format($difftaxq2,2);
  407. $difftaxq3 = number_format($difftaxq3,2);
  408. $difftaxq4 = number_format($difftaxq4,2);
  409. $difffeeq1 = number_format($difffeeq1,2);
  410. $difffeeq2 = number_format($difffeeq2,2);
  411. $difffeeq3 = number_format($difffeeq3,2);
  412. $difffeeq4 = number_format($difffeeq4,2);
  413. $diffpenq1 = number_format($diffpenq1,2);
  414. $diffpenq2 = number_format($diffpenq2,2);
  415. $diffpenq3 = number_format($diffpenq3,2);
  416. $diffpenq4 = number_format($diffpenq4,2);
  417. $diffintq1 = number_format($diffintq1,2);
  418. $diffintq2 = number_format($diffintq2,2);
  419. $diffintq3 = number_format($diffintq3,2);
  420. $diffintq4 = number_format($diffintq4,2);
  421. $diffbakq1 = number_format($diffbakq1,2);
  422. $diffbakq2 = number_format($diffbakq2,2);
  423. $diffbakq3 = number_format($diffbakq3,2);
  424. $diffbakq4 = number_format($diffbakq4,2);
  425. $difftotq1 = number_format($difftotq1,2);
  426. $difftotq2 = number_format($difftotq2,2);
  427. $difftotq3 = number_format($difftotq3,2);
  428. $difftotq4 = number_format($difftotq4,2);
  429. $percentdifftaxq1 = number_format($percentdifftaxq1,2);
  430. $percentdifftaxq2 = number_format($percentdifftaxq2,2);
  431. $percentdifftaxq3 = number_format($percentdifftaxq3,2);
  432. $percentdifftaxq4 = number_format($percentdifftaxq4,2);
  433. $percentdifffeeq1 = number_format($percentdifffeeq1,2);
  434. $percentdifffeeq2 = number_format($percentdifffeeq2,2);
  435. $percentdifffeeq3 = number_format($percentdifffeeq3,2);
  436. $percentdifffeeq4 = number_format($percentdifffeeq4,2);
  437. $percentdiffpenq1 = number_format($percentdiffpenq1,2);
  438. $percentdiffpenq2 = number_format($percentdiffpenq2,2);
  439. $percentdiffpenq3 = number_format($percentdiffpenq3,2);
  440. $percentdiffpenq4 = number_format($percentdiffpenq4,2);
  441. $percentdiffintq1 = number_format($percentdiffintq1,2);
  442. $percentdiffintq2 = number_format($percentdiffintq2,2);
  443. $percentdiffintq3 = number_format($percentdiffintq3,2);
  444. $percentdiffintq4 = number_format($percentdiffintq4,2);
  445. $percentdiffbakq1 = number_format($percentdiffbakq1,2);
  446. $percentdiffbakq2 = number_format($percentdiffbakq2,2);
  447. $percentdiffbakq3 = number_format($percentdiffbakq3,2);
  448. $percentdiffbakq4 = number_format($percentdiffbakq4,2);
  449. $percentdifftotq1 = number_format($percentdifftotq1,2);
  450. $percentdifftotq2 = number_format($percentdifftotq2,2);
  451. $percentdifftotq3 = number_format($percentdifftotq3,2);
  452. $percentdifftotq4 = number_format($percentdifftotq4,2);
  453. $getlgu = @mysql_query("select city_municipality_desc from ebpls_city_municipality where city_municipality_code = '$resulta[0]'");
  454. $getlgu = @mysql_fetch_row($getlgu);
  455. $getprov = @mysql_query("select province_desc from ebpls_province where province_code = '$resulta[1]'");
  456. $getprov = @mysql_fetch_row($getprov);
  457. //$pdf=new FPDF('L','mm','Legal');
  458. $pdf=new PDF('L','mm','Legal');
  459. $pdf->setLGUinfo($getlgu[0],$getprov[0],$resulta[2]);
  460. $pdf->AddPage();
  461. $pdf->AliasNbPages();
  462. $Y_Label_position = 50;
  463. $Y_Table_Position = 55;
  464. $pdf->SetFont('Arial','B',6);
  465. $pdf->SetY($Y_Label_position);
  466. $pdf->SetX(5);
  467. $pdf->Cell(30,5,'DETAILS',1,0,'C');
  468. $pdf->SetX(35);
  469. $pdf->Cell(80,5,'YEAR 1 ('.$dateprev.')',1,0,'C');
  470. $pdf->SetX(115);
  471. $pdf->Cell(80,5,'YEAR 2 ('.$datenext.')',1,0,'C');
  472. $pdf->SetX(195);
  473. $pdf->Cell(60,5,'% DIFFERENCE',1,0,'C');
  474. $pdf->SetX(255);
  475. $pdf->Cell(80,5,'AMOUNT DIFFERENCE',1,1,'C');
  476. $pdf->SetX(5);
  477. $pdf->Cell(30,5,'',1,0,'C');
  478. $pdf->Cell(20,5,'Q1',1,0,'C');
  479. $pdf->Cell(20,5,'Q2',1,0,'C');
  480. $pdf->Cell(20,5,'Q3',1,0,'C');
  481. $pdf->Cell(20,5,'Q4',1,0,'C');
  482. $pdf->Cell(20,5,'Q1',1,0,'C');
  483. $pdf->Cell(20,5,'Q2',1,0,'C');
  484. $pdf->Cell(20,5,'Q3',1,0,'C');
  485. $pdf->Cell(20,5,'Q4',1,0,'C');
  486. $pdf->Cell(15,5,'Q1',1,0,'C');
  487. $pdf->Cell(15,5,'Q2',1,0,'C');
  488. $pdf->Cell(15,5,'Q3',1,0,'C');
  489. $pdf->Cell(15,5,'Q4',1,0,'C');
  490. $pdf->Cell(20,5,'Q1',1,0,'C');
  491. $pdf->Cell(20,5,'Q2',1,0,'C');
  492. $pdf->Cell(20,5,'Q3',1,0,'C');
  493. $pdf->Cell(20,5,'Q4',1,1,'C');
  494. $pdf->SetX(5);
  495. $pdf->Cell(30,5,'TAXES',1,0,'L');
  496. $pdf->SetX(35);
  497. $pdf->Cell(20,5,$sumtaxq1[0],1,0,'C');
  498. $pdf->Cell(20,5,$sumtaxq2[0],1,0,'C');
  499. $pdf->Cell(20,5,$sumtaxq3[0],1,0,'C');
  500. $pdf->Cell(20,5,$sumtaxq4[0],1,0,'C');
  501. $pdf->Cell(20,5,$sumtaxq1n[0],1,0,'C');
  502. $pdf->Cell(20,5,$sumtaxq2n[0],1,0,'C');
  503. $pdf->Cell(20,5,$sumtaxq3n[0],1,0,'C');
  504. $pdf->Cell(20,5,$sumtaxq4n[0],1,0,'C');
  505. $pdf->Cell(15,5,$percentdifftaxq1,1,0,'C');
  506. $pdf->Cell(15,5,$percentdifftaxq2,1,0,'C');
  507. $pdf->Cell(15,5,$percentdifftaxq3,1,0,'C');
  508. $pdf->Cell(15,5,$percentdifftaxq4,1,0,'C');
  509. $pdf->Cell(20,5,$difftaxq1,1,0,'C');
  510. $pdf->Cell(20,5,$difftaxq2,1,0,'C');
  511. $pdf->Cell(20,5,$difftaxq3,1,0,'C');
  512. $pdf->Cell(20,5,$difftaxq4,1,1,'C');
  513. $pdf->SetX(5);
  514. $pdf->Cell(30,5,'FEES',1,0,'L');
  515. $pdf->SetX(35);
  516. $pdf->Cell(20,5,$sumfeeq1[0],1,0,'C');
  517. $pdf->Cell(20,5,$sumfeeq2[0],1,0,'C');
  518. $pdf->Cell(20,5,$sumfeeq3[0],1,0,'C');
  519. $pdf->Cell(20,5,$sumfeeq4[0],1,0,'C');
  520. $pdf->Cell(20,5,$sumfeeq1n[0],1,0,'C');
  521. $pdf->Cell(20,5,$sumfeeq2n[0],1,0,'C');
  522. $pdf->Cell(20,5,$sumfeeq3n[0],1,0,'C');
  523. $pdf->Cell(20,5,$sumfeeq4n[0],1,0,'C');
  524. $pdf->Cell(15,5,$percentdifffeeq1,1,0,'C');
  525. $pdf->Cell(15,5,$percentdifffeeq2,1,0,'C');
  526. $pdf->Cell(15,5,$percentdifffeeq3,1,0,'C');
  527. $pdf->Cell(15,5,$percentdifffeeq4,1,0,'C');
  528. $pdf->Cell(20,5,$difffeeq1,1,0,'C');
  529. $pdf->Cell(20,5,$difffeeq2,1,0,'C');
  530. $pdf->Cell(20,5,$difffeeq3,1,0,'C');
  531. $pdf->Cell(20,5,$difffeeq4,1,1,'C');
  532. $pdf->SetX(5);
  533. $pdf->Cell(30,5,'PENALTIES',1,0,'L');
  534. $pdf->SetX(35);
  535. $pdf->Cell(20,5,$sumpenq1[0],1,0,'C');
  536. $pdf->Cell(20,5,$sumpenq2[0],1,0,'C');
  537. $pdf->Cell(20,5,$sumpenq3[0],1,0,'C');
  538. $pdf->Cell(20,5,$sumpenq4[0],1,0,'C');
  539. $pdf->Cell(20,5,$sumpenq1n[0],1,0,'C');
  540. $pdf->Cell(20,5,$sumpenq2n[0],1,0,'C');
  541. $pdf->Cell(20,5,$sumpenq3n[0],1,0,'C');
  542. $pdf->Cell(20,5,$sumpenq4n[0],1,0,'C');
  543. $pdf->Cell(15,5,$percentdiffpenq1,1,0,'C');
  544. $pdf->Cell(15,5,$percentdiffpenq2,1,0,'C');
  545. $pdf->Cell(15,5,$percentdiffpenq3,1,0,'C');
  546. $pdf->Cell(15,5,$percentdiffpenq4,1,0,'C');
  547. $pdf->Cell(20,5,$diffpenq1,1,0,'C');
  548. $pdf->Cell(20,5,$diffpenq2,1,0,'C');
  549. $pdf->Cell(20,5,$diffpenq3,1,0,'C');
  550. $pdf->Cell(20,5,$diffpenq4,1,1,'C');
  551. $pdf->SetX(5);
  552. $pdf->Cell(30,5,'SURCHARGES',1,0,'L');
  553. $pdf->SetX(35);
  554. $pdf->Cell(20,5,$sumintq1[0],1,0,'C');
  555. $pdf->Cell(20,5,$sumintq2[0],1,0,'C');
  556. $pdf->Cell(20,5,$sumintq3[0],1,0,'C');
  557. $pdf->Cell(20,5,$sumintq4[0],1,0,'C');
  558. $pdf->Cell(20,5,$sumintq1n[0],1,0,'C');
  559. $pdf->Cell(20,5,$sumintq2n[0],1,0,'C');
  560. $pdf->Cell(20,5,$sumintq3n[0],1,0,'C');
  561. $pdf->Cell(20,5,$sumintq4n[0],1,0,'C');
  562. $pdf->Cell(15,5,$percentdiffintq1,1,0,'C');
  563. $pdf->Cell(15,5,$percentdiffintq2,1,0,'C');
  564. $pdf->Cell(15,5,$percentdiffintq3,1,0,'C');
  565. $pdf->Cell(15,5,$percentdiffintq4,1,0,'C');
  566. $pdf->Cell(20,5,$diffintq1,1,0,'C');
  567. $pdf->Cell(20,5,$diffintq2,1,0,'C');
  568. $pdf->Cell(20,5,$diffintq3,1,0,'C');
  569. $pdf->Cell(20,5,$diffintq4,1,1,'C');
  570. $pdf->SetX(5);
  571. $pdf->Cell(30,5,'BACK TAX',1,0,'L');
  572. $pdf->SetX(35);
  573. $pdf->Cell(20,5,$sumbakq1[0],1,0,'C');
  574. $pdf->Cell(20,5,$sumbakq2[0],1,0,'C');
  575. $pdf->Cell(20,5,$sumbakq3[0],1,0,'C');
  576. $pdf->Cell(20,5,$sumbakq4[0],1,0,'C');
  577. $pdf->Cell(20,5,$sumbakq1n[0],1,0,'C');
  578. $pdf->Cell(20,5,$sumbakq2n[0],1,0,'C');
  579. $pdf->Cell(20,5,$sumbakq3n[0],1,0,'C');
  580. $pdf->Cell(20,5,$sumbakq4n[0],1,0,'C');
  581. $pdf->Cell(15,5,$percentdiffbakq1,1,0,'C');
  582. $pdf->Cell(15,5,$percentdiffbakq2,1,0,'C');
  583. $pdf->Cell(15,5,$percentdiffbakq3,1,0,'C');
  584. $pdf->Cell(15,5,$percentdiffbakq4,1,0,'C');
  585. $pdf->Cell(20,5,$diffbakq1,1,0,'C');
  586. $pdf->Cell(20,5,$diffbakq2,1,0,'C');
  587. $pdf->Cell(20,5,$diffbakq3,1,0,'C');
  588. $pdf->Cell(20,5,$diffbakq4,1,1,'C');
  589. $pdf->SetX(5);
  590. $pdf->Cell(30,5,'TOTAL',1,0,'L');
  591. $pdf->SetX(35);
  592. $pdf->Cell(20,5,$totalq1,1,0,'C');
  593. $pdf->Cell(20,5,$totalq2,1,0,'C');
  594. $pdf->Cell(20,5,$totalq3,1,0,'C');
  595. $pdf->Cell(20,5,$totalq4,1,0,'C');
  596. $pdf->Cell(20,5,$totalq1n,1,0,'C');
  597. $pdf->Cell(20,5,$totalq2n,1,0,'C');
  598. $pdf->Cell(20,5,$totalq3n,1,0,'C');
  599. $pdf->Cell(20,5,$totalq4n,1,0,'C');
  600. $pdf->Cell(15,5,$percentdifftotq1,1,0,'C');
  601. $pdf->Cell(15,5,$percentdifftotq2,1,0,'C');
  602. $pdf->Cell(15,5,$percentdifftotq3,1,0,'C');
  603. $pdf->Cell(15,5,$percentdifftotq4,1,0,'C');
  604. $pdf->Cell(20,5,$difftotq1,1,0,'C');
  605. $pdf->Cell(20,5,$difftotq2,1,0,'C');
  606. $pdf->Cell(20,5,$difftotq3,1,0,'C');
  607. $pdf->Cell(20,5,$difftotq4,1,1,'C');
  608. //new signatories table
  609. // $result=mysql_query("select gs_name, gs_pos, gs_office from global_sign where sign_id =1") or die(mysql_error());
  610. // $resulta=mysql_fetch_row($result);
  611. //$Y_Table_Position = $Y_Table_Position + 20;
  612. $pdf->Cell(270,5,'',0,1,'C');
  613. $pdf->Cell(270,5,'',0,1,'C');
  614. //$pdf->SetY(-18);
  615. $pdf->SetX(5);
  616. $pdf->SetFont('Arial','B',10);
  617. $pdf->Cell(172,5,'Prepared By :',0,0,'L');
  618. $pdf->Cell(172,5,'Noted By :',0,1,'L');
  619. $pdf->Cell(270,5,'',0,1,'C');
  620. $pdf->Cell(270,5,'',0,1,'C');
  621. $getuser = @mysql_query("select * from ebpls_user where username = '$usernm'") or die(mysql_error());
  622. $getuser = @mysql_fetch_array($getuser);
  623. $getsignatories = @mysql_query("select * from report_signatories where report_file='Comparative Annual Report' and sign_type='3'");
  624. $getsignatories1 = @mysql_fetch_array($getsignatories);
  625. $getsignatories = @mysql_query("select * from global_sign where sign_id='$getsignatories1[sign_id]'");
  626. $getsignatories1 = @mysql_fetch_array($getsignatories);
  627. $pdf->SetX(5);
  628. $pdf->SetFont('Arial','B',10);
  629. $pdf->Cell(172,5,$getuser[firstname].' '.$getuser[lastname],0,0,'L');
  630. $pdf->Cell(172,5,$getsignatories1[gs_name],0,1,'L');
  631. $pdf->SetFont('Arial','B',10);
  632. $pdf->SetX(5);
  633. $pdf->Cell(172,5,'',0,0,'C');
  634. $pdf->Cell(172,5,$getsignatories1[gs_pos],0,1,'L');
  635. //$pdf->SetX(5);
  636. //$pdf->SetFont('Arial','BU',10);
  637. //$pdf->Cell(172,5,'',1,0,'C');
  638. //$pdf->Cell(172,5,$resulta[0],1,1,'C');
  639. //$pdf->SetFont('Arial','B',10);
  640. //$pdf->SetX(5);
  641. //$pdf->Cell(172,5,'',1,0,'C');
  642. //$pdf->Cell(172,5,$resulta[2],1,0,'C');
  643. $report_desc='Comparative Quarterly Report';
  644. //include 'report_signatories_footer1.php';
  645. $pdf->Output();
  646. ?>