Advertisement
Guest User

Laporan.php

a guest
Jan 22nd, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.15 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3.  
  4. class Laporan extends CI_Controller
  5. {
  6. function __construct()
  7. {
  8. parent::__construct();
  9. if (!$this->session->userdata('id_user')) {
  10. redirect(site_url('auth'));
  11. date_default_timezone_set("Asia/Bangkok");
  12. }
  13. $this->load->library('session');
  14. $this->load->library('Pdf');
  15. $this->load->model('M_Laporan');
  16. }
  17.  
  18. public function perencanaan()
  19. {
  20. $this->load->view('laporan/view_laporan_perencanaan');
  21. }
  22.  
  23. public function lap_perencanaan()
  24. {
  25. $date_create = date('Ymd h:i:s');
  26. $pdf = new Pdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  27. $pdf->SetTitle('Laporan');
  28. $pdf->SetAuthor($this->session->userdata('nama_user'));
  29. $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
  30. $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
  31. $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
  32. $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
  33. $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
  34. $pdf->SetHeaderData(0, 0, PDF_HEADER_TITLE, PDF_HEADER_STRING);
  35. $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
  36. $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
  37. $pdf->SetFont('times', '', 10);
  38. $pdf->AddPage();
  39. $pdf->setCellPaddings(1, 1, 1, 1);
  40. $pdf->setCellMargins(1, 1, 1, 1);
  41. $pdf->SetFillColor(255, 255, 127);
  42. $title = '
  43. <h3>Report Perencanaan Asset</h3>
  44. ';
  45. $pdf->WriteHTMLCell(0, 0, '', '',$title, 0, 1, 0, true, 'C', true);
  46. $table = '<table style="border:1px solid #000; padding:6px;">';
  47. $table .= '<tr align="center" bgcolor="#ccc">
  48. <th style="border:1px solid #000;" width="30px">No</th>
  49. <th style="border:1px solid #000;" width="50px">ID Perencanaan</th>
  50. <th style="border:1px solid #000;" width="90px">Tgl Rencana Pengadaan</th>
  51. <th style="border:1px solid #000;" width="60px">Tanggal Transaksi</th>
  52. <th style="border:1px solid #000;" width="60px">Nama Staff Penginput</th>
  53. <th style="border:1px solid #000;" width="50px">Tujuan</th>
  54. <th style="border:1px solid #000;" width="50px">Total Perencanaan</th>
  55. <th style="border:1px solid #000;" width="60px">Status Perencanaan</th>
  56. </tr>';
  57. $no = 1;
  58. $startdate = $this->input->post('startdate');
  59. $enddate = $this->input->post('enddate');
  60.  
  61. $data = $this->M_Laporan->report_perencanaan($startdate,$enddate)->result();
  62. $result = $this->M_Laporan->total($startdate,$enddate)->result();
  63. foreach($data as $row){
  64. $table .= '<tr align="center">
  65. <td style="border:1px solid #000;" width="30px">'.$no++.'</td>
  66. <td style="border:1px solid #000;">'.$row->id_perencanaan.'</td>
  67. <td style="border:1px solid #000;">'.$row->tgl_rencana_pengadaan.'</td>
  68. <td style="border:1px solid #000;">'.$row->tgl_transaksi.'</td>
  69. <td style="border:1px solid #000;">'.$row->nama_user.'</td>
  70. <td style="border:1px solid #000;">'.$row->tujuan.'</td>
  71. <td style="border:1px solid #000;">'.$row->total_perencanaan.'</td>
  72. <td style="border:1px solid #000;">'.$row->status_data.'</td>
  73. </tr>';
  74. }
  75. $table .= '</table>';
  76. $pdf->WriteHTMLCell(0, 0, 30, '',$table, 0, 1, 0, true, 'C', true);
  77. foreach($result as $row){
  78. $table = '<table style="padding:5px;">';
  79. $table .= '<tr>
  80. <th style="background-color:#ccc" align="center">Subtotal</th>
  81. <td>'.$row->subtotal.'</td>
  82. </tr>';
  83. $table .= '</table>';
  84. }
  85.  
  86.  
  87. $pdf->WriteHTMLCell(51, 0, 125, '',$table, 'LRTB', 1, 0, true, 'R', true);
  88. $now = date('d-m-Y');
  89. $table = '<table>';
  90. $table .= '<tr align="center">
  91. <td>Yogyakarta, '.$now.'</td>
  92. </tr>';
  93. $table .= '</table>';
  94. $pdf->writeHTMLCell(51, 0, 125, '', $table, 0, 1, 0, true, 'R', true);
  95. $table = '<table cellspacing="40">';
  96. foreach($data as $row){
  97. $table .= '<tr align="center">
  98.  
  99. <td> Rahmat Kurniawan, S.T </td>
  100. <pre><?php echo print_r($_SESSION); ?></pre>
  101. <td> </td>
  102. </tr>';
  103. $table .= '</table>';
  104.  
  105. }
  106. //ob_start();
  107.  
  108. $pdf->WriteHTMLCell(0, 0, 30, '',$table, 0, 1, 0, true, 'C', true);
  109. $pdf->lastPage();
  110. //ob_clean();
  111. $pdf->Output('Laporan_Perencanaan'.$date_create.'.pdf', 'I');
  112. }
  113.  
  114. public function pengadaan()
  115. {
  116. $this->load->view('laporan/view_laporan_pengadaan');
  117. }
  118.  
  119. public function lap_pengadaan()
  120. {
  121. $date_create = date('Ymd h:i:s');
  122. $pdf = new Pdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  123. $pdf->SetTitle('Laporan');
  124. $pdf->SetAuthor($this->session->userdata('nama_user'));
  125. $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
  126. $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
  127. $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
  128. $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
  129. $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
  130. $pdf->SetHeaderData(0, 0, PDF_HEADER_TITLE, PDF_HEADER_STRING);
  131. $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
  132. $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
  133. $pdf->SetFont('times', '', 10);
  134. $pdf->AddPage();
  135. $pdf->setCellPaddings(1, 1, 1, 1);
  136. $pdf->setCellMargins(1, 1, 1, 1);
  137. $pdf->SetFillColor(255, 255, 127);
  138. $title = <<<EOD
  139. <h3>Report Pengadaan Asset</h3>
  140. EOD;
  141. $pdf->WriteHTMLCell(0, 0, '', '',$title, 0, 1, 0, true, 'C', true);
  142. $table = '<table style="border:1px solid #000; padding:6px;">';
  143. $table .= '<tr align="center" bgcolor="#ccc">
  144. <th style="border:1px solid #000;" width="30px">No</th>
  145. <th style="border:1px solid #000;" width="90px">ID Pengadaan</th>
  146. <th style="border:1px solid #000;" width="90px">Tanggal Pengadaan</th>
  147. <th style="border:1px solid #000;" width="80px">Tanggal Perencanaan</th>
  148. <th style="border:1px solid #000;">Total Harga Diajukan</th>
  149. <th style="border:1px solid #000;">Total Harga Realisasi</th>
  150. <th style="border:1px solid #000;">Status Inventarisasi</th>
  151. </tr>';
  152. $no = 1;
  153. $startdate = $this->input->post('startdate');
  154. $enddate = $this->input->post('enddate');
  155.  
  156. $data = $this->M_Laporan->report_pengadaan($startdate,$enddate)->result();
  157. $result = $this->M_Laporan->total_pengadaan($startdate,$enddate)->result();
  158. foreach($data as $row){
  159. //$tgl_bayar = date('Y-m-d',strtotime($row->tgl_bayar));
  160. $table .= '<tr align="center">
  161. <td style="border:1px solid #000;">'.$no++.'</td>
  162. <td style="border:1px solid #000;">'.$row->id_pengadaan.'</td>
  163. <td style="border:1px solid #000;">'.$row->tgl_pengadaan.'</td>
  164. <td style="border:1px solid #000;">'.$row->tgl_perencanaan.'</td>
  165. <td style="border:1px solid #000;">'.$row->total_harga_diajukan.'</td>
  166. <td style="border:1px solid #000;">'.$row->total_harga.'</td>
  167. <td style="border:1px solid #000;">'.$row->is_inventarisasi.'</td>
  168. </tr>';
  169. }
  170. $table .= '</table>';
  171. $pdf->WriteHTMLCell(0, 0, 14, '',$table, 0, 1, 0, true, 'C', true);
  172. foreach($result as $row){
  173. $table = '<table style="padding:5px;">';
  174. $table .= '<tr>
  175. <th style="background-color:#ccc" align="center">Subtotal</th>
  176. <td>'.$row->subtotal.'</td>
  177. </tr>';
  178. $table .= '</table>';
  179. }
  180. $pdf->WriteHTMLCell(51, 0, 142, '',$table, 'LRTB', 1, 0, true, 'R', true);
  181. $now = date('d-m-Y');
  182. $table = '<table>';
  183. $table .= '<tr align="center">
  184. <td>Yogyakarta, '.$now.'</td>
  185. </tr>';
  186. $table .= '</table>';
  187. $pdf->writeHTMLCell(51, 0, 142, '', $table, 0, 1, 0, true, 'R', true);
  188. $table = '<table cellspacing="40" align="left">';
  189. $table .= '<tr align="center">
  190. <td>( Pimpinan )</td>
  191. <td width="370px">( Operator )</td>
  192. </tr>';
  193. $table .= '</table>';
  194. $pdf->WriteHTMLCell(0, 0, 0, '',$table, '', 1, 0, true, 'L', true);
  195. $pdf->lastPage();
  196. ob_clean();
  197. $pdf->Output('Laporan_Pengadaan'.$date_create.'.pdf', 'I');
  198. }
  199.  
  200. public function inventarisasi()
  201. {
  202. $this->load->view('laporan/view_laporan_inventarisasi');
  203. }
  204.  
  205. public function lap_inventarisasi()
  206. {
  207. $date_create = date('Ymd h:i:s');
  208. $pdf = new Pdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  209. $pdf->SetTitle('Laporan');
  210. $pdf->SetAuthor($this->session->userdata('nama_user'));
  211. $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
  212. $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
  213. $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
  214. $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
  215. $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
  216. $pdf->SetHeaderData(0, 0, PDF_HEADER_TITLE, PDF_HEADER_STRING);
  217. $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
  218. $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
  219. $pdf->SetFont('times', '', 10);
  220. $pdf->AddPage();
  221. $pdf->setCellPaddings(1, 1, 1, 1);
  222. $pdf->setCellMargins(1, 1, 1, 1);
  223. $pdf->SetFillColor(255, 255, 127);
  224. $title = <<<EOD
  225. <h3>Report Inventarisasi Asset</h3>
  226. EOD;
  227. $pdf->WriteHTMLCell(0, 0, '', '',$title, 0, 1, 0, true, 'C', true);
  228. $table = '<table style="border:1px solid #000; padding:6px;">';
  229. $table .= '<tr align="center" bgcolor="#ccc">
  230. <th style="border:1px solid #000;" width="30px">No</th>
  231. <th style="border:1px solid #000;" width="90px">ID Inventarisasi</th>
  232. <th style="border:1px solid #000;" width="90px">ID Pengadaan</th>
  233. <th style="border:1px solid #000;" width="80px">ID Asset</th>
  234. <th style="border:1px solid #000;">Tanggal Inventarisasi</th>
  235. <th style="border:1px solid #000;">Harga Inventarisasi</th>
  236. <th style="border:1px solid #000;">Status Inventarisasi</th>
  237. </tr>';
  238. $no = 1;
  239. $startdate = $this->input->post('startdate');
  240. $enddate = $this->input->post('enddate');
  241.  
  242. $data = $this->M_Laporan->report_inventarisasi($startdate,$enddate)->result();
  243. $result = $this->M_Laporan->total_inventarisasi($startdate,$enddate)->result();
  244. foreach($data as $row){
  245. //$tgl_bayar = date('Y-m-d',strtotime($row->tgl_bayar));
  246. $table .= '<tr align="center">
  247. <td style="border:1px solid #000;">'.$no++.'</td>
  248. <td style="border:1px solid #000;">'.$row->id_inventarisasi.'</td>
  249. <td style="border:1px solid #000;">'.$row->id_pengadaan.'</td>
  250. <td style="border:1px solid #000;">'.$row->id_asset.'</td>
  251. <td style="border:1px solid #000;">'.$row->tgl_input.'</td>
  252. <td style="border:1px solid #000;">'.$row->harga_realisasi.'</td>
  253. <td style="border:1px solid #000;">'.$row->status_ada.'</td>
  254. </tr>';
  255. }
  256. $table .= '</table>';
  257. $pdf->WriteHTMLCell(0, 0, 14, '',$table, 0, 1, 0, true, 'C', true);
  258. foreach($result as $row){
  259. $table = '<table style="padding:5px;">';
  260. $table .= '<tr>
  261. <th style="background-color:#ccc" align="center">Subtotal</th>
  262. <td>'.$row->subtotal.'</td>
  263. </tr>';
  264. $table .= '</table>';
  265. }
  266. $pdf->WriteHTMLCell(51, 0, 142, '',$table, 'LRTB', 1, 0, true, 'R', true);
  267. $now = date('d-m-Y');
  268. $table = '<table>';
  269. $table .= '<tr align="center">
  270. <td>Yogyakarta, '.$now.'</td>
  271. </tr>';
  272. $table .= '</table>';
  273. $pdf->writeHTMLCell(51, 0, 142, '', $table, 0, 1, 0, true, 'R', true);
  274. $table = '<table cellspacing="40" align="left">';
  275. $table .= '<tr align="center">
  276. <td>( Pimpinan )</td>
  277. <td width="370px">( Operator )</td>
  278. </tr>';
  279. $table .= '</table>';
  280. $pdf->WriteHTMLCell(0, 0, 0, '',$table, '', 1, 0, true, 'L', true);
  281. $pdf->lastPage();
  282. ob_clean();
  283. $pdf->Output('Laporan_Pengadaan'.$date_create.'.pdf', 'I');
  284. }
  285.  
  286. public function pengelolaan()
  287. {
  288. $this->load->view('laporan/view_laporan_pengelolaan');
  289. }
  290.  
  291. public function lap_pengelolaan()
  292. {
  293. $date_create = date('Ymd h:i:s');
  294. $pdf = new Pdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  295. $pdf->SetTitle('Laporan');
  296. $pdf->SetAuthor($this->session->userdata('nama_user'));
  297. $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
  298. $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
  299. $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
  300. $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
  301. $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
  302. $pdf->SetHeaderData(0, 0, PDF_HEADER_TITLE, PDF_HEADER_STRING);
  303. $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
  304. $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
  305. $pdf->SetFont('times', '', 10);
  306. $pdf->AddPage();
  307. $pdf->setCellPaddings(1, 1, 1, 1);
  308. $pdf->setCellMargins(1, 1, 1, 1);
  309. $pdf->SetFillColor(255, 255, 127);
  310. $title = <<<EOD
  311. <h3>Report Pengelolaan Asset</h3>
  312. EOD;
  313. $pdf->WriteHTMLCell(0, 0, '', '',$title, 0, 1, 0, true, 'C', true);
  314. $table = '<table style="border:1px solid #000; padding:6px;">';
  315. $table .= '<tr align="center" bgcolor="#ccc">
  316. <th style="border:1px solid #000;" width="30px">No</th>
  317. <th style="border:1px solid #000;" width="90px">ID Sewa</th>
  318. <th style="border:1px solid #000;" width="90px">ID Karyawan</th>
  319. <th style="border:1px solid #000;" width="80px">Tanggal Transaksi</th>
  320. <th style="border:1px solid #000;">ID Customer</th>
  321. <th style="border:1px solid #000;">DP</th>
  322. <th style="border:1px solid #000;">Subtotal</th>
  323.  
  324. </tr>';
  325. $no = 1;
  326. $startdate = $this->input->post('startdate');
  327. $enddate = $this->input->post('enddate');
  328.  
  329. $data = $this->M_Laporan->report_pengelolaan($startdate,$enddate)->result();
  330. $result = $this->M_Laporan->total_pengelolaan($startdate,$enddate)->result();
  331. foreach($data as $row){
  332. //$tgl_bayar = date('Y-m-d',strtotime($row->tgl_bayar));
  333. $table .= '<tr align="center">
  334. <td style="border:1px solid #000;">'.$no++.'</td>
  335. <td style="border:1px solid #000;">'.$row->id_sewa.'</td>
  336. <td style="border:1px solid #000;">'.$row->id_karyawan.'</td>
  337. <td style="border:1px solid #000;">'.$row->tgl_transaksi.'</td>
  338. <td style="border:1px solid #000;">'.$row->id_customer.'</td>
  339. <td style="border:1px solid #000;">'.$row->dp.'</td>
  340. <td style="border:1px solid #000;">'.$row->subtotal.'</td>
  341.  
  342. </tr>';
  343. }
  344. $table .= '</table>';
  345. $pdf->WriteHTMLCell(0, 0, 14, '',$table, 0, 1, 0, true, 'C', true);
  346. foreach($result as $row){
  347. $table = '<table style="padding:5px;">';
  348. $table .= '<tr>
  349. <th style="background-color:#ccc" align="center">Subtotal</th>
  350. <td>'.$row->subtotal.'</td>
  351. </tr>';
  352. $table .= '</table>';
  353. }
  354. $pdf->WriteHTMLCell(51, 0, 142, '',$table, 'LRTB', 1, 0, true, 'R', true);
  355. $now = date('d-m-Y');
  356. $table = '<table>';
  357. $table .= '<tr align="center">
  358. <td>Yogyakarta, '.$now.'</td>
  359. </tr>';
  360. $table .= '</table>';
  361. $pdf->writeHTMLCell(51, 0, 142, '', $table, 0, 1, 0, true, 'R', true);
  362. $table = '<table cellspacing="40" align="left">';
  363. $table .= '<tr align="center">
  364. <td>( Pimpinan )</td>
  365. <td width="370px">( Operator )</td>
  366. </tr>';
  367. $table .= '</table>';
  368. $pdf->WriteHTMLCell(0, 0, 0, '',$table, '', 1, 0, true, 'L', true);
  369. $pdf->lastPage();
  370. ob_clean();
  371. $pdf->Output('Laporan_Pengadaan'.$date_create.'.pdf', 'I');
  372. }
  373.  
  374.  
  375.  
  376. public function penghapusan()
  377. {
  378. $this->load->view('laporan/view_laporan_penghapusan');
  379. }
  380.  
  381. public function lap_penghapusan()
  382. {
  383. $date_create = date('Ymd h:i:s');
  384. $pdf = new Pdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  385. $pdf->SetTitle('Laporan');
  386. $pdf->SetAuthor($this->session->userdata('nama_user'));
  387. $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
  388. $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
  389. $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
  390. $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
  391. $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
  392. $pdf->SetHeaderData(0, 0, PDF_HEADER_TITLE, PDF_HEADER_STRING);
  393. $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
  394. $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
  395. $pdf->SetFont('times', '', 10);
  396. $pdf->AddPage();
  397. $pdf->setCellPaddings(1, 1, 1, 1);
  398. $pdf->setCellMargins(1, 1, 1, 1);
  399. $pdf->SetFillColor(255, 255, 127);
  400. $title = <<<EOD
  401. <h3>Report Penghapusan Asset</h3>
  402. EOD;
  403. $pdf->WriteHTMLCell(0, 0, '', '',$title, 0, 1, 0, true, 'C', true);
  404. $table = '<table style="border:1px solid #000; padding:6px;">';
  405. $table .= '<tr align="center" bgcolor="#ccc">
  406. <th style="border:1px solid #000;" width="30px">No</th>
  407. <th style="border:1px solid #000;" width="90px">ID Penghapusan</th>
  408. <th style="border:1px solid #000;" width="90px">ID Inventarisasi</th>
  409. <th style="border:1px solid #000;" width="80px">Alasan Dihapus</th>
  410. <th style="border:1px solid #000;"> Harga Asset</th>
  411. <th style="border:1px solid #000;">Tanggal Dihapus</th>
  412.  
  413. </tr>';
  414. $no = 1;
  415. $startdate = $this->input->post('startdate');
  416. $enddate = $this->input->post('enddate');
  417.  
  418. $data = $this->M_Laporan->report_penghapusan($startdate,$enddate)->result();
  419. $result = $this->M_Laporan->total_penghapusan($startdate,$enddate)->result();
  420. foreach($data as $row){
  421. //$tgl_bayar = date('Y-m-d',strtotime($row->tgl_bayar));
  422. $table .= '<tr align="center">
  423. <td style="border:1px solid #000;">'.$no++.'</td>
  424. <td style="border:1px solid #000;">'.$row->id_penghapusan.'</td>
  425. <td style="border:1px solid #000;">'.$row->id_inventarisasi.'</td>
  426. <td style="border:1px solid #000;">'.$row->alasan_dihapus.'</td>
  427. <td style="border:1px solid #000;">'.$row->harga_asset.'</td>
  428. <td style="border:1px solid #000;">'.$row->tgl_hapus.'</td>
  429.  
  430. </tr>';
  431. }
  432. $table .= '</table>';
  433. $pdf->WriteHTMLCell(0, 0, 14, '',$table, 0, 1, 0, true, 'C', true);
  434. foreach($result as $row){
  435. $table = '<table style="padding:5px;">';
  436. $table .= '<tr>
  437. <th style="background-color:#ccc" align="center">Subtotal</th>
  438. <td>'.$row->subtotal.'</td>
  439. </tr>';
  440. $table .= '</table>';
  441. }
  442. $pdf->WriteHTMLCell(51, 0, 142, '',$table, 'LRTB', 1, 0, true, 'R', true);
  443. $now = date('d-m-Y');
  444. $table = '<table>';
  445. $table .= '<tr align="center">
  446. <td>Yogyakarta, '.$now.'</td>
  447. </tr>';
  448. $table .= '</table>';
  449. $pdf->writeHTMLCell(51, 0, 142, '', $table, 0, 1, 0, true, 'R', true);
  450. $table = '<table cellspacing="40" align="left">';
  451. $table .= '<tr align="center">
  452. <td>( Pimpinan )</td>
  453. <td width="370px">( Operator )</td>
  454. </tr>';
  455. $table .= '</table>';
  456. $pdf->WriteHTMLCell(0, 0, 0, '',$table, '', 1, 0, true, 'L', true);
  457. $pdf->lastPage();
  458. ob_clean();
  459. $pdf->Output('Laporan_Pengadaan'.$date_create.'.pdf', 'I');
  460. }
  461.  
  462. public function penyusutan()
  463. {
  464. $this->load->view('laporan/view_laporan_penyusutan');
  465. }
  466.  
  467. public function lap_penyusutan()
  468. {
  469. $date_create = date('Ymd h:i:s');
  470. $pdf = new Pdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  471. $pdf->SetTitle('Laporan');
  472. $pdf->SetAuthor($this->session->userdata('nama_user'));
  473. $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
  474. $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
  475. $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
  476. $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
  477. $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
  478. $pdf->SetHeaderData(0, 0, PDF_HEADER_TITLE, PDF_HEADER_STRING);
  479. $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
  480. $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
  481. $pdf->SetFont('times', '', 10);
  482. $pdf->AddPage();
  483. $pdf->setCellPaddings(1, 1, 1, 1);
  484. $pdf->setCellMargins(1, 1, 1, 1);
  485. $pdf->SetFillColor(255, 255, 127);
  486. $title = <<<EOD
  487. <h3>Report Nilai Penyusutan Asset</h3>
  488. EOD;
  489. $pdf->WriteHTMLCell(0, 0, '', '',$title, 0, 1, 0, true, 'C', true);
  490. $table = '<table style="border:1px solid #000; padding:6px;">';
  491. $table .= '<tr align="center" bgcolor="#ccc">
  492. <th style="border:1px solid #000;" width="50px">No</th>
  493. <th style="border:1px solid #000;" width="90px">ID Penyusutan</th>
  494. <th style="border:1px solid #000;" width="90px">ID Asset</th>
  495. <th style="border:1px solid #000;" width="80px">Harga Beli Asset</th>
  496. <th style="border:1px solid #000;" width="80px">Umur Ekonomis</th>
  497. <th style="border:1px solid #000;" width="80px">Nilai Residu</th>
  498. <th style="border:1px solid #000;" width="60px">Total Penyusutan</th>
  499.  
  500. </tr>';
  501. $no = 1;
  502. $startdate = $this->input->post('startdate');
  503. $enddate = $this->input->post('enddate');
  504.  
  505. $data = $this->M_Laporan->report_penyusutan($startdate,$enddate)->result();
  506. $result = $this->M_Laporan->total_penyusutans($startdate,$enddate)->result();
  507. foreach($data as $row){
  508. //$tgl_bayar = date('Y-m-d',strtotime($row->tgl_bayar));
  509. $table .= '<tr align="center">
  510. <td style="border:1px solid #000;">'.$no++.'</td>
  511. <td style="border:1px solid #000;">'.$row->id_penyusutan.'</td>
  512. <td style="border:1px solid #000;">'.$row->id_asset.'</td>
  513. <td style="border:1px solid #000;">'.$row->harga_beli.'</td>
  514. <td style="border:1px solid #000;">'.$row->tahun.'</td>
  515. <td style="border:1px solid #000;">'.$row->nilai_residu.'</td>
  516. <td style="border:1px solid #000;">'.$row->total_penyusutan.'</td>
  517. </tr>';
  518. }
  519. $table .= '</table>';
  520. $pdf->WriteHTMLCell(0, 0, 14, '',$table, 0, 1, 0, true, 'C', true);
  521. foreach($result as $row){
  522. $table = '<table style="padding:5px;">';
  523. $table .= '<tr>
  524. <th style="background-color:#ccc" align="center">Subtotal</th>
  525. <td>'.$row->subtotal.'</td>
  526. </tr>';
  527. $table .= '</table>';
  528. }
  529. $pdf->WriteHTMLCell(51, 0, 142, '',$table, 'LRTB', 1, 0, true, 'R', true);
  530. $now = date('d-m-Y');
  531. $table = '<table>';
  532. $table .= '<tr align="center">
  533. <td>Yogyakarta, '.$now.'</td>
  534. </tr>';
  535. $table .= '</table>';
  536. $pdf->writeHTMLCell(51, 0, 142, '', $table, 0, 1, 0, true, 'R', true);
  537. $table = '<table cellspacing="40" align="left">';
  538. $table .= '<tr align="center">
  539. <td>( Pimpinan )</td>
  540. <td width="370px">( Operator )</td>
  541. </tr>';
  542. $table .= '</table>';
  543. $pdf->WriteHTMLCell(0, 0, 0, '',$table, '', 1, 0, true, 'L', true);
  544. $pdf->lastPage();
  545. ob_clean();
  546. $pdf->Output('Laporan_Pengadaan'.$date_create.'.pdf', 'I');
  547. }
  548.  
  549. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement