public function ActionCreatePDF($id) { $mpdf = Yii::app()->ePdf->mpdf(); $model_historia = $this->loadModel($id); $model_historiaO_paciente = HistoriaObstetricia::model()->getHistoriasObstetriciaByPaciente($model_historia->paciente->id); $model_historiaG_paciente = HistoriaGinecologia::model()->getHistoriasGinecologicasByPaciente($model_historia->paciente->id); $historia = array($model_historiaG_paciente, $model_historiaO_paciente); $stylesheet = file_get_contents('C:\\wamp\\www\\Gineobs\\themes\\hebo\\css\\pdfMain.css'); //configurando pdf general $mpdf = new mPDF('utf-8', 'Letter-L'); //agregando header y footer $mpdf->SetHeader('{DATE j-m-Y}||Recipe #' . $model_historia->paciente->id); $mpdf->SetFooter('Dr. María Hernández|Ginecologia y obstetricia|{PAGENO}'); //Propiedades del PDF $mpdf->setTitle("Historia Medica"); $mpdf->setAuthor("María Hernández"); $mpdf->setCreator("Edgar Cardona y Gabriela Soto"); $mpdf->setSubject("Historia medica de pacientes."); $mpdf->setKeywords("Historia,Medicina"); //escribiendo CSS $mpdf->WriteHTML($stylesheet, 1); //Escribiendo PDF $mpdf->writeHTML($this->renderPartial('historia', array('model' => $model_historia->paciente->id, 'historia' => $historia), true), 2); //Salida $mpdf->output("Recipe Medico", EYiiPdf::OUTPUT_TO_DOWNLOAD); }
public static function GerarPdf($html, $titulo = null, $paisagem = false, $nomePdf = null) { $mpdf = new mPDF(); $mpdf->allow_charset_conversion = true; $mpdf->charset_in = 'utf-8'; if ($paisagem == true) { $mpdf->CurOrientation = 'l'; } //Exibir a pagina inteira no browser //$mpdf->SetDisplayMode('fullpage'); //Cabeçalho: Seta a data/hora completa de quando o PDF foi gerado + um texto no lado direito if ($titulo != null) { $mpdf->SetHeader("{$titulo}"); } //Rodapé: Seta a data/hora completa de quando o PDF foi gerado + um texto no lado direito $mpdf->SetFooter("{DATE j/m/Y H:i}|{PAGENO}/{nb}| {$titulo}"); $mpdf->WriteHTML($html); // define um nome para o arquivo PDF if ($nomePdf == null) { $nomePdf = time() . '.pdf'; } $mpdf->Output($nomePdf, 'I'); }
function pdf($html, $filename = null, $cabecalho = '', $rodape = '') { require APPPATH . "helpers/mpdf/mpdf.php"; $mpdf = new mPDF(); //$mpdf->allow_charset_conversion=true; $mpdf->charset_in = 'utf-8'; //Exibir a pagina inteira no browser $mpdf->SetDisplayMode('fullpage'); //Cabeçalho: Seta a data/hora completa de quando o PDF foi gerado + um texto no lado direito if ($cabecalho !== '') { $mpdf->SetHeader('{DATE j/m/Y H:i}| | ' . $cabecalho); } //Rodapé: Seta a data/hora completa de quando o PDF foi gerado + um texto no lado direito if ($rodape !== '') { $mpdf->SetFooter($rodape); } $mpdf->WriteHTML($html); // define um nome para o arquivo PDF if ($filename == null) { $filename = date("Y-m-d_his") . '_impressao.pdf'; } $mpdf->Output($filename, 'I'); }
public function laba_rugi_download() { if ($this->session->userdata('logged_in')) { $total_branch = $this->branch_model->count_branch(); $timestamp = date("Ymdhis"); $tgl = date("d-M-Y"); $filename = "LAPORAN_LABA_RUGI_{$timestamp}"; $print = "<style> table tr td,table thead tr td, table tr th{ border-left:0; border-right:0; font-size:10px;} table thead tr td,table thead tr th,table tr th{ border-bottom: 0.5px solid #666; }</style>"; $print .= ''; //$print .= '<h1 align="center">Amartha Microfinance</h1>'; //$print .= '<hr/>'; $print .= '<h2 align="center">LAPORAN LABA RUGI</h2><br/>'; $print .= '<table border="1" width="100%">'; $print .= '<tr> <th width="350px"></th> <th class="text-center">Konsolidasi</th> <th class="text-center">Pusat</th> <th class="text-center">Ciseeng</th> <th class="text-center">Jasinga</th> <th class="text-center">Bojong Gede</th> <th class="text-center">Kemang</th> <th class="text-center">Tenjo</th> <th class="text-center">Cangkuang</th> <th class="text-center">Pangalengan</th> </tr>'; $colspan = $total_branch + 2; $colspan2 = $total_branch + 3; //Cek User Branch $user_branch = $this->session->userdata('user_branch'); if ($user_branch == "0") { $user_branch = NULL; } function getStartAndEndDate($week, $year) { $time = strtotime("1 January {$year}", time()); $day = date('w', $time); $time += (7 * $week + 1 - $day) * 24 * 3600; $return[0] = date('Y-n-j', $time); $time += 6 * 24 * 3600; $return[1] = date('Y-n-j', $time); return $return; } $date_today = date("Y-m-d"); $date_year_today = date("Y"); $date_week_today = date("W", strtotime($date_today)) - 1; $date_week_before = $date_week_today - 1; $week_today = getStartAndEndDate($date_week_today, $date_year_today); $date_start = $this->input->post('date_start'); $date_end = $this->input->post('date_end'); if ($date_start and $date_end and $date_start <= $date_end) { $date_start = $this->input->post('date_start'); $date_end = $this->input->post('date_end'); } else { //$date_start =$week_today[0]; $date_start = "2015-01-01"; $date_end = date("Y-m-d"); } $date_end_before = strtotime($date_start); //$date_end_before = $date_start; $date_end_before = strtotime("-1 day", $date_end_before); $date_end_before = date('Y-m-d', $date_end_before); $date_start_before = "2014-01-01"; //echo $date_start_before." ----- ".$date_end_before; $account_debet = 0; $account_credit = 0; $account_saldo = 0; $saldo_awal = 0; //PENDAPATAN $print .= ' <tr><td align="left" ><b>Pendapatan</b></td> <td colspan="' . $colspan . '" ></td></tr>'; //4010000 Pendapatan Pembiayaan $code = "4010000"; $code_level1 = substr($code, 0, 3); for ($branch = 0; $branch <= $total_branch; $branch++) { $account_4010000_debet[$branch] = $this->jurnal_model->sum_account_parent_debet_by_date($code_level1, $date_start, $date_end, $branch); $account_4010000_credit[$branch] = $this->jurnal_model->sum_account_parent_credit_by_date($code_level1, $date_start, $date_end, $branch); $account_4010000[$branch] = $account_4010000_credit[$branch] - $account_4010000_debet[$branch]; $account_4010000_total += $account_4010000[$branch]; $account_pendapatan_total[$branch] += $account_4010000[$branch]; } $print .= ' <tr><td align="left" > Pendapatan Pembiayaan</td>'; $print .= ' <td align="right" class="">' . ($account_4010000_total < 0 ? "(" . number_format(abs($account_4010000_total)) . ")" : number_format($account_4010000_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_4010000[$branch] < 0 ? "(" . number_format(abs($account_4010000[$branch])) . ")" : number_format($account_4010000[$branch])) . '</td>'; } $print .= '</tr>'; //4020000 Pendapatan Jasa Administrasi $code = "4020000"; $code_level1 = substr($code, 0, 3); for ($branch = 0; $branch <= $total_branch; $branch++) { $account_4020000_debet[$branch] = $this->jurnal_model->sum_account_parent_debet_by_date($code_level1, $date_start, $date_end, $branch); $account_4020000_credit[$branch] = $this->jurnal_model->sum_account_parent_credit_by_date($code_level1, $date_start, $date_end, $branch); $account_4020000[$branch] = $account_4020000_credit[$branch] - $account_4020000_debet[$branch]; $account_4020000_total += $account_4020000[$branch]; $account_pendapatan_total[$branch] += $account_4020000[$branch]; } $print .= ' <tr><td align="left" > Pendapatan Administrasi</td>'; $print .= ' <td align="right" class="border_btm">' . ($account_4020000_total < 0 ? "(" . number_format(abs($account_4020000_total)) . ")" : number_format($account_4020000_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="border_btm">' . ($account_4020000[$branch] < 0 ? "(" . number_format(abs($account_4020000[$branch])) . ")" : number_format($account_4020000[$branch])) . '</td>'; } $print .= '</tr>'; //Jumlah Pendapatan $account_pendapatan_konsolidasi = $account_4010000_total + $account_4020000_total; $print .= ' <tr><td align="left" >Total Pendapatan</td>'; $print .= ' <td align="right" class="border_btm">' . ($account_pendapatan_konsolidasi < 0 ? "(" . number_format(abs($account_pendapatan_konsolidasi)) . ")" : number_format($account_pendapatan_konsolidasi)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="border_btm">' . ($account_pendapatan_total[$branch] < 0 ? "(" . number_format(abs($account_pendapatan_total[$branch])) . ")" : number_format($account_pendapatan_total[$branch])) . '</td>'; } $print .= ' </tr>'; //--------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------- $print .= ' <tr><td align="left" colspan="' . $colspan2 . '"> </td></tr>'; $print .= ' <tr><td align="left" ><b>Biaya Langsung</b></td> <td colspan="' . $colspan . '" ></td></tr>'; //Beban Dana Pinjaman Bank $code = "5010200"; $code_level1 = substr($code, 0, 5); for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5010200_debet[$branch] = $this->jurnal_model->sum_account_parent_debet_by_date($code_level1, $date_start, $date_end, $branch); $account_5010200_credit[$branch] = $this->jurnal_model->sum_account_parent_credit_by_date($code_level1, $date_start, $date_end, $branch); $account_5010200[$branch] = $account_5010200_debet[$branch] - $account_5010200_credit[$branch]; $account_5010200_total += $account_5010200[$branch]; $account_biaya_langsung_total[$branch] += $account_5010200[$branch]; } $print .= ' <tr><td align="left" > Beban Dana Pinjaman Bank</td>'; $print .= ' <td align="right" class="">' . ($account_5010200_total < 0 ? "(" . number_format(abs($account_5010200_total)) . ")" : number_format($account_5010200_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_5010200[$branch] < 0 ? "(" . number_format(abs($account_5010200[$branch])) . ")" : number_format($account_5010200[$branch])) . '</td>'; } $print .= '</tr>'; //Beban Dana Simpanan Berjangka $code = "5010100"; $code_level1 = substr($code, 0, 5); for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5010100_debet[$branch] = $this->jurnal_model->sum_account_parent_debet_by_date($code_level1, $date_start, $date_end, $branch); $account_5010100_credit[$branch] = $this->jurnal_model->sum_account_parent_credit_by_date($code_level1, $date_start, $date_end, $branch); $account_5010100[$branch] = $account_5010100_debet[$branch] - $account_5010100_credit[$branch]; $account_5010100_total += $account_5010100[$branch]; $account_biaya_langsung_total[$branch] += $account_5010100[$branch]; } $print .= ' <tr><td align="left" > Beban Dana Simpanan Berjangka</td>'; $print .= ' <td align="right" class="">' . ($account_5010100_total < 0 ? "(" . number_format(abs($account_5010100_total)) . ")" : number_format($account_5010100_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_5010100[$branch] < 0 ? "(" . number_format(abs($account_5010100[$branch])) . ")" : number_format($account_5010100[$branch])) . '</td>'; } $print .= '</tr>'; //Beban Bonus $code = "5020000"; $code_level1 = substr($code, 0, 3); for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5020000_debet[$branch] = $this->jurnal_model->sum_account_parent_debet_by_date($code_level1, $date_start, $date_end, $branch); $account_5020000_credit[$branch] = $this->jurnal_model->sum_account_parent_credit_by_date($code_level1, $date_start, $date_end, $branch); $account_5020000[$branch] = $account_5020000_debet[$branch] - $account_5020000_credit[$branch]; $account_5020000_total += $account_5020000[$branch]; $account_biaya_langsung_total[$branch] += $account_5020000[$branch]; } $print .= ' <tr><td align="left" > Beban Bonus</td>'; $print .= ' <td align="right" class="border_btm">' . ($account_5020000_total < 0 ? "(" . number_format(abs($account_5020000_total)) . ")" : number_format($account_5020000_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="border_btm">' . ($account_5020000[$branch] < 0 ? "(" . number_format(abs($account_5020000[$branch])) . ")" : number_format($account_5020000[$branch])) . '</td>'; } $print .= '</tr>'; //Total Biaya_langsung $account_biaya_langsung_konsolidasi = $account_5010100_total + $account_5010200_total + $account_5020000_total; $print .= ' <tr><td align="left" >Total Biaya Langsung</td>'; $print .= ' <td align="right" class="border_btm">' . ($account_biaya_langsung_konsolidasi < 0 ? "(" . number_format(abs($account_biaya_langsung_konsolidasi)) . ")" : number_format($account_biaya_langsung_konsolidasi)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="border_btm">' . ($account_biaya_langsung_total[$branch] < 0 ? "(" . number_format(abs($account_biaya_langsung_total[$branch])) . ")" : number_format($account_biaya_langsung_total[$branch])) . '</td>'; } $print .= ' </tr>'; $print .= ' <tr><td></td><td align="left" class="border_btm" colspan="' . $colspan . '"> </td></tr>'; //Laba Rugi Kotor $account_labarugi_kotor_konsolidasi = $account_pendapatan_konsolidasi - $account_biaya_langsung_konsolidasi; $print .= ' <tr><td align="left" ><b>Laba (Rugi) Kotor</b></td>'; $print .= ' <td align="right" class="border_btm"><b>' . ($account_labarugi_kotor_konsolidasi < 0 ? "(" . number_format(abs($account_labarugi_kotor_konsolidasi)) . ")" : number_format($account_labarugi_kotor_konsolidasi)) . '</b></td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_labarugi_kotor_total[$branch] = $account_pendapatan_total[$branch] - $account_biaya_langsung_total[$branch]; $print .= ' <td align="right" class="border_btm"><b>' . ($account_labarugi_kotor_total[$branch] < 0 ? "(" . number_format(abs($account_labarugi_kotor_total[$branch])) . ")" : number_format($account_labarugi_kotor_total[$branch])) . '</b></td>'; } $print .= ' </tr>'; //--------------------------------------------------------------------------------------------- //BEBAN OPERASI //--------------------------------------------------------------------------------------------- $print .= ' <tr><td align="left" colspan="' . $colspan2 . '"> </td></tr>'; $print .= ' <tr><td align="left" ><b>Biaya Operasi</b></td> <td colspan="' . $colspan . '" ></td></tr>'; //Beban Lainnya: 5030101, 5030102, 5030103, 5030104, 5030105, 5030106, 5030108, 5030109, 5030110, 5030111, 5030112, 5030113, 5030114 $code = "5030101"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5030101_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5030101_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5030101[$branch] = $account_5030101_debet[$branch] - $account_5030101_credit[$branch]; $account_5030101_total += $account_5030101[$branch]; $account_beban_gaji_total[$branch] += $account_5030101[$branch]; $account_beban_operasi_total[$branch] += $account_5030101[$branch]; } $code = "5030102"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5030102_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5030102_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5030102[$branch] = $account_5030102_debet[$branch] - $account_5030102_credit[$branch]; $account_5030102_total += $account_5030102[$branch]; $account_beban_gaji_total[$branch] += $account_5030102[$branch]; $account_beban_operasi_total[$branch] += $account_5030102[$branch]; } $code = "5030103"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5030103_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5030103_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5030103[$branch] = $account_5030103_debet[$branch] - $account_5030103_credit[$branch]; $account_5030103_total += $account_5030103[$branch]; $account_beban_gaji_total[$branch] += $account_5030103[$branch]; $account_beban_operasi_total[$branch] += $account_5030103[$branch]; } $code = "5030104"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5030104_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5030104_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5030104[$branch] = $account_5030104_debet[$branch] - $account_5030104_credit[$branch]; $account_5030104_total += $account_5030104[$branch]; $account_beban_gaji_total[$branch] += $account_5030104[$branch]; $account_beban_operasi_total[$branch] += $account_5030104[$branch]; } $code = "5030105"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5030105_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5030105_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5030105[$branch] = $account_5030105_debet[$branch] - $account_5030105_credit[$branch]; $account_5030105_total += $account_5030105[$branch]; $account_beban_gaji_total[$branch] += $account_5030105[$branch]; $account_beban_operasi_total[$branch] += $account_5030105[$branch]; } $code = "5030106"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5030106_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5030106_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5030106[$branch] = $account_5030106_debet[$branch] - $account_5030106_credit[$branch]; $account_5030106_total += $account_5030106[$branch]; $account_beban_gaji_total[$branch] += $account_5030106[$branch]; $account_beban_operasi_total[$branch] += $account_5030106[$branch]; } $code = "5030108"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5030108_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5030108_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5030108[$branch] = $account_5030108_debet[$branch] - $account_5030108_credit[$branch]; $account_5030108_total += $account_5030108[$branch]; $account_beban_gaji_total[$branch] += $account_5030108[$branch]; $account_beban_operasi_total[$branch] += $account_5030108[$branch]; } $code = "5030109"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5030109_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5030109_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5030109[$branch] = $account_5030109_debet[$branch] - $account_5030109_credit[$branch]; $account_5030109_total += $account_5030109[$branch]; $account_beban_gaji_total[$branch] += $account_5030109[$branch]; $account_beban_operasi_total[$branch] += $account_5030109[$branch]; } $code = "5030110"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5030110_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5030110_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5030110[$branch] = $account_5030110_debet[$branch] - $account_5030110_credit[$branch]; $account_5030110_total += $account_5030110[$branch]; $account_beban_gaji_total[$branch] += $account_5030110[$branch]; $account_beban_operasi_total[$branch] += $account_5030110[$branch]; } $code = "5030111"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5030111_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5030111_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5030111[$branch] = $account_5030111_debet[$branch] - $account_5030111_credit[$branch]; $account_5030111_total += $account_5030111[$branch]; $account_beban_gaji_total[$branch] += $account_5030111[$branch]; $account_beban_operasi_total[$branch] += $account_5030111[$branch]; } $code = "5030112"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5030112_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5030112_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5030112[$branch] = $account_5030112_debet[$branch] - $account_5030112_credit[$branch]; $account_5030112_total += $account_5030112[$branch]; $account_beban_gaji_total[$branch] += $account_5030112[$branch]; $account_beban_operasi_total[$branch] += $account_5030112[$branch]; } $code = "5030113"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5030113_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5030113_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5030113[$branch] = $account_5030113_debet[$branch] - $account_5030113_credit[$branch]; $account_5030113_total += $account_5030113[$branch]; $account_beban_gaji_total[$branch] += $account_5030113[$branch]; $account_beban_operasi_total[$branch] += $account_5030113[$branch]; } $code = "5030114"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5030114_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5030114_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5030114[$branch] = $account_5030114_debet[$branch] - $account_5030114_credit[$branch]; $account_5030114_total += $account_5030114[$branch]; $account_beban_gaji_total[$branch] += $account_5030114[$branch]; $account_beban_operasi_total[$branch] += $account_5030114[$branch]; } $account_beban_gaji_konsolidasi = $account_5030101_total + $account_5030102_total + $account_5030103_total + $account_5030104_total + $account_5030105_total + $account_5030106_total + $account_5030108_total + $account_5030109_total + $account_5030110_total + $account_5030111_total + $account_5030112_total + $account_5030113_total + $account_5030114_total; $print .= ' <tr><td align="left" > Beban Gaji & Honor</td>'; $print .= ' <td align="right" class="">' . ($account_beban_gaji_konsolidasi < 0 ? "(" . number_format(abs($account_beban_gaji_konsolidasi)) . ")" : number_format($account_beban_gaji_konsolidasi)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_beban_gaji_total[$branch] < 0 ? "(" . number_format(abs($account_beban_gaji_total[$branch])) . ")" : number_format($account_beban_gaji_total[$branch])) . '</td>'; } $print .= '</tr>'; //5080404 Beban Asuransi Jiwa $code = "5080404"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080404_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080404_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080404[$branch] = $account_5080404_debet[$branch] - $account_5080404_credit[$branch]; $account_5080404_total += $account_5080404[$branch]; $account_beban_operasi_total[$branch] += $account_5080404[$branch]; } $print .= ' <tr><td align="left" > Beban Asuransi Jiwa</td>'; $print .= ' <td align="right" class="">' . ($account_5080404_total < 0 ? "(" . number_format(abs($account_5080404_total)) . ")" : number_format($account_5080404_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_5080404[$branch] < 0 ? "(" . number_format(abs($account_5080404[$branch])) . ")" : number_format($account_5080404[$branch])) . '</td>'; } $print .= '</tr>'; //5040003 Beban Rekrutmen $code = "5040003"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5040003_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5040003_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5040003[$branch] = $account_5040003_debet[$branch] - $account_5040003_credit[$branch]; $account_5040003_total += $account_5040003[$branch]; $account_beban_operasi_total[$branch] += $account_5040003[$branch]; } $print .= ' <tr><td align="left" > Beban Rekrutmen</td>'; $print .= ' <td align="right" class="">' . ($account_5040003_total < 0 ? "(" . number_format(abs($account_5040003_total)) . ")" : number_format($account_5040003_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_5040003[$branch] < 0 ? "(" . number_format(abs($account_5040003[$branch])) . ")" : number_format($account_5040003[$branch])) . '</td>'; } $print .= '</tr>'; //Beban Training $print .= ' <tr><td align="left" > Beban Training</td>'; $print .= ' <td align="right" class="">' . ($account_9999999_total < 0 ? "(" . number_format(abs($account_9999999_total)) . ")" : number_format($account_9999999_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_9999999[$branch] < 0 ? "(" . number_format(abs($account_9999999[$branch])) . ")" : number_format($account_9999999[$branch])) . '</td>'; } $print .= '</tr>'; //5030107 Insentif Operations $code = "5030107"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5030107_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5030107_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5030107[$branch] = $account_5030107_debet[$branch] - $account_5030107_credit[$branch]; $account_5030107_total += $account_5030107[$branch]; $account_beban_operasi_total[$branch] += $account_5030107[$branch]; } $print .= ' <tr><td align="left" > Insentif Operations</td>'; $print .= ' <td align="right" class="">' . ($account_5030107_total < 0 ? "(" . number_format(abs($account_5030107_total)) . ")" : number_format($account_5030107_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_5030107[$branch] < 0 ? "(" . number_format(abs($account_5030107[$branch])) . ")" : number_format($account_5030107[$branch])) . '</td>'; } $print .= '</tr>'; //5080501 Beban Rumah Tangga Pusat $code = "5080501"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080501_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080501_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080501[$branch] = $account_5080501_debet[$branch] - $account_5080501_credit[$branch]; $account_5080501_total += $account_5080501[$branch]; $account_beban_RT_pusat_total[$branch] += $account_5080501[$branch]; $account_beban_operasi_total[$branch] += $account_5080501[$branch]; } $code = "5080301"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080301_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080301_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080301[$branch] = $account_5080301_debet[$branch] - $account_5080301_credit[$branch]; $account_5080301_total += $account_5080301[$branch]; $account_beban_RT_pusat_total[$branch] += $account_5080301[$branch]; $account_beban_operasi_total[$branch] += $account_5080301[$branch]; } $account_beban_RT_pusat_konsolidasi = $account_5080501_total + $account_5080301_total; $account_beban_RT_cabang_konsolidasi = $account_beban_RT_pusat_konsolidasi - $account_beban_RT_pusat_total[0]; $print .= ' <tr><td align="left" > Beban Rumah Tangga Pusat</td>'; $print .= ' <td align="right" class="">' . ($account_beban_RT_pusat_total[0] < 0 ? "(" . number_format(abs($account_beban_RT_pusat_total[0])) . ")" : number_format($account_beban_RT_pusat_total[0])) . '</td>'; $print .= ' <td align="right" class="">' . ($account_beban_RT_pusat_total[0] < 0 ? "(" . number_format(abs($account_beban_RT_pusat_total[0])) . ")" : number_format($account_beban_RT_pusat_total[0])) . '</td>'; for ($branch = 1; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">0</td>'; } $print .= '</tr>'; //Beban ATK Pusat : 5080201, 5080202, 5080203, 5080401 $code = "5080201"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080201_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080201_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080201[$branch] = $account_5080201_debet[$branch] - $account_5080201_credit[$branch]; $account_5080201_total += $account_5080201[$branch]; $account_beban_ATK_pusat_total[$branch] += $account_5080201[$branch]; $account_beban_operasi_total[$branch] += $account_5080201[$branch]; } $code = "5080202"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080202_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080202_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080202[$branch] = $account_5080202_debet[$branch] - $account_5080202_credit[$branch]; $account_5080202_total += $account_5080202[$branch]; $account_beban_ATK_pusat_total[$branch] += $account_5080202[$branch]; $account_beban_operasi_total[$branch] += $account_5080202[$branch]; } $code = "5080203"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080203_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080203_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080203[$branch] = $account_5080203_debet[$branch] - $account_5080203_credit[$branch]; $account_5080203_total += $account_5080203[$branch]; $account_beban_ATK_pusat_total[$branch] += $account_5080203[$branch]; $account_beban_operasi_total[$branch] += $account_5080203[$branch]; } $code = "5080401"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080401_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080401_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080401[$branch] = $account_5080401_debet[$branch] - $account_5080401_credit[$branch]; $account_5080401_total += $account_5080401[$branch]; $account_beban_ATK_pusat_total[$branch] += $account_5080401[$branch]; $account_beban_operasi_total[$branch] += $account_5080401[$branch]; } $account_beban_ATK_pusat_konsolidasi = $account_5080201_total + $account_5080202_total + $account_5080203_total + $account_5080401_total; $account_beban_ATK_cabang_konsolidasi = $account_beban_ATK_pusat_konsolidasi - $account_beban_ATK_pusat_total[0]; $print .= ' <tr><td align="left" > Beban ATK Pusat</td>'; $print .= ' <td align="right" class="">' . ($account_beban_ATK_pusat_total[0] < 0 ? "(" . number_format(abs($account_beban_ATK_pusat_total[0])) . ")" : number_format($account_beban_ATK_pusat_total[0])) . '</td>'; $print .= ' <td align="right" class="">' . ($account_beban_ATK_pusat_total[0] < 0 ? "(" . number_format(abs($account_beban_ATK_pusat_total[0])) . ")" : number_format($account_beban_ATK_pusat_total[0])) . '</td>'; for ($branch = 1; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">0</td>'; } $print .= '</tr>'; //Beban Transportasi Pusat : 5080302, 5080303, 5080304 $code = "5080302"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080302_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080302_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080302[$branch] = $account_5080302_debet[$branch] - $account_5080302_credit[$branch]; $account_5080302_total += $account_5080302[$branch]; $account_beban_transportasi_pusat_total[$branch] += $account_5080302[$branch]; $account_beban_operasi_total[$branch] += $account_5080302[$branch]; } $code = "5080303"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080303_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080303_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080303[$branch] = $account_5080303_debet[$branch] - $account_5080303_credit[$branch]; $account_5080303_total += $account_5080303[$branch]; $account_beban_transportasi_pusat_total[$branch] += $account_5080303[$branch]; $account_beban_operasi_total[$branch] += $account_5080303[$branch]; } $code = "5080304"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080304_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080304_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080304[$branch] = $account_5080304_debet[$branch] - $account_5080304_credit[$branch]; $account_5080304_total += $account_5080304[$branch]; $account_beban_transportasi_pusat_total[$branch] += $account_5080304[$branch]; $account_beban_operasi_total[$branch] += $account_5080304[$branch]; } $account_beban_transportasi_pusat_konsolidasi = $account_5080302_total + $account_5080303_total + $account_5080304_total; $account_beban_transportasi_cabang_konsolidasi = $account_beban_transportasi_pusat_konsolidasi - $account_beban_transportasi_pusat_total[0]; $print .= ' <tr><td align="left" > Beban Transportasi Pusat</td>'; $print .= ' <td align="right" class="">' . ($account_beban_transportasi_pusat_total[0] < 0 ? "(" . number_format(abs($account_beban_transportasi_pusat_total[0])) . ")" : number_format($account_beban_transportasi_pusat_total[0])) . '</td>'; $print .= ' <td align="right" class="">' . ($account_beban_transportasi_pusat_total[0] < 0 ? "(" . number_format(abs($account_beban_transportasi_pusat_total[0])) . ")" : number_format($account_beban_transportasi_pusat_total[0])) . '</td>'; for ($branch = 1; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">0</td>'; } $print .= '</tr>'; //Beban Perawatan Pusat $code = "5060000"; $code_level1 = substr($code, 0, 3); for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5060000_debet[$branch] = $this->jurnal_model->sum_account_parent_debet_by_date($code_level1, $date_start, $date_end, $branch); $account_5060000_credit[$branch] = $this->jurnal_model->sum_account_parent_credit_by_date($code_level1, $date_start, $date_end, $branch); $account_5060000[$branch] = $account_5060000_debet[$branch] - $account_5060000_credit[$branch]; $account_5060000_total += $account_5060000[$branch]; $account_beban_operasi_total[$branch] += $account_5060000[$branch]; } $account_5060000_cabang = $account_5060000_total - $account_5060000[0]; $print .= ' <tr><td align="left" > Beban Perawatan Pusat</td>'; $print .= ' <td align="right" class="">' . ($account_5060000[0] < 0 ? "(" . number_format(abs($account_5060000[0])) . ")" : number_format($account_5060000[0])) . '</td>'; $print .= ' <td align="right" class="">' . ($account_5060000[0] < 0 ? "(" . number_format(abs($account_5060000[0])) . ")" : number_format($account_5060000[0])) . '</td>'; for ($branch = 1; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">0</td>'; } $print .= '</tr>'; //Beban Listrik, Air, Telepon dan Internet Pusat : 5080101, 5080102, 5080103 $code = "5080101"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080101_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080101_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080101[$branch] = $account_5080101_debet[$branch] - $account_5080101_credit[$branch]; $account_5080101_total += $account_5080101[$branch]; $account_beban_listrik_air_telp_pusat_total[$branch] += $account_5080101[$branch]; $account_beban_operasi_total[$branch] += $account_5080101[$branch]; } $code = "5080102"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080102_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080102_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080102[$branch] = $account_5080102_debet[$branch] - $account_5080102_credit[$branch]; $account_5080102_total += $account_5080102[$branch]; $account_beban_listrik_air_telp_pusat_total[$branch] += $account_5080102[$branch]; $account_beban_operasi_total[$branch] += $account_5080102[$branch]; } $code = "5080103"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080103_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080103_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080103[$branch] = $account_5080103_debet[$branch] - $account_5080103_credit[$branch]; $account_5080103_total += $account_5080103[$branch]; $account_beban_listrik_air_telp_pusat_total[$branch] += $account_5080103[$branch]; $account_beban_operasi_total[$branch] += $account_5080103[$branch]; } $account_beban_listrik_air_telp_pusat_konsolidasi = $account_5080101_total + $account_5080102_total + $account_5080103_total; $account_beban_listrik_air_telp_cabang_konsolidasi = $account_beban_listrik_air_telp_pusat_konsolidasi - $account_beban_listrik_air_telp_pusat_total[0]; $print .= ' <tr><td align="left" > Beban Listrik, Air, Telepon dan Internet Pusat</td>'; $print .= ' <td align="right" class="">' . ($account_beban_listrik_air_telp_pusat_total[0] < 0 ? "(" . number_format(abs($account_beban_listrik_air_telp_pusat_total[0])) . ")" : number_format($account_beban_listrik_air_telp_pusat_total[0])) . '</td>'; $print .= ' <td align="right" class="">' . ($account_beban_listrik_air_telp_pusat_total[0] < 0 ? "(" . number_format(abs($account_beban_listrik_air_telp_pusat_total[0])) . ")" : number_format($account_beban_listrik_air_telp_pusat_total[0])) . '</td>'; for ($branch = 1; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">0</td>'; } $print .= '</tr>'; //Beban Lain-lain Pusat : 5080104, 5080402, 5080403, 5080406, 5080502, 5080503, 5080504 $code = "5080104"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080104_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080104_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080104[$branch] = $account_5080104_debet[$branch] - $account_5080104_credit[$branch]; $account_5080104_total += $account_5080104[$branch]; $account_beban_lainlain_pusat_total[$branch] += $account_5080104[$branch]; $account_beban_operasi_total[$branch] += $account_5080104[$branch]; } $code = "5080402"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080402_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080402_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080402[$branch] = $account_5080402_debet[$branch] - $account_5080402_credit[$branch]; $account_5080402_total += $account_5080402[$branch]; $account_beban_lainlain_pusat_total[$branch] += $account_5080402[$branch]; $account_beban_operasi_total[$branch] += $account_5080402[$branch]; } $code = "5080403"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080403_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080403_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080403[$branch] = $account_5080403_debet[$branch] - $account_5080403_credit[$branch]; $account_5080403_total += $account_5080403[$branch]; $account_beban_lainlain_pusat_total[$branch] += $account_5080403[$branch]; $account_beban_operasi_total[$branch] += $account_5080403[$branch]; } $code = "5080406"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080406_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080406_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080406[$branch] = $account_5080406_debet[$branch] - $account_5080406_credit[$branch]; $account_5080406_total += $account_5080406[$branch]; $account_beban_lainlain_pusat_total[$branch] += $account_5080406[$branch]; $account_beban_operasi_total[$branch] += $account_5080406[$branch]; } $code = "5080502"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080502_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080502_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080502[$branch] = $account_5080502_debet[$branch] - $account_5080502_credit[$branch]; $account_5080502_total += $account_5080502[$branch]; $account_beban_lainlain_pusat_total[$branch] += $account_5080502[$branch]; $account_beban_operasi_total[$branch] += $account_5080502[$branch]; } $code = "5080503"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080503_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080503_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080503[$branch] = $account_5080503_debet[$branch] - $account_5080503_credit[$branch]; $account_5080503_total += $account_5080503[$branch]; $account_beban_lainlain_pusat_total[$branch] += $account_5080503[$branch]; $account_beban_operasi_total[$branch] += $account_5080503[$branch]; } $code = "5080504"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080504_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080504_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080504[$branch] = $account_5080504_debet[$branch] - $account_5080504_credit[$branch]; $account_5080504_total += $account_5080504[$branch]; $account_beban_lainlain_pusat_total[$branch] += $account_5080504[$branch]; $account_beban_operasi_total[$branch] += $account_5080504[$branch]; } $account_beban_lainlain_pusat_konsolidasi = $account_5080104_total + $account_5080402_total + $account_5080403_total + $account_5080406_total + $account_5080502_total + $account_5080503_total + $account_5080504_total; $account_beban_lainlain_cabang_konsolidasi = $account_beban_lainlain_pusat_konsolidasi - $account_beban_lainlain_pusat_total[0]; $print .= ' <tr><td align="left" > Beban Lain-lain Pusat</td>'; $print .= ' <td align="right" class="">' . ($account_beban_lainlain_pusat_total[0] < 0 ? "(" . number_format(abs($account_beban_lainlain_pusat_total[0])) . ")" : number_format($account_beban_lainlain_pusat_total[0])) . '</td>'; $print .= ' <td align="right" class="">' . ($account_beban_lainlain_pusat_total[0] < 0 ? "(" . number_format(abs($account_beban_lainlain_pusat_total[0])) . ")" : number_format($account_beban_lainlain_pusat_total[0])) . '</td>'; for ($branch = 1; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">0</td>'; } $print .= '</tr>'; //Beban Rumah Tangga Seluruh Cabang $account_beban_RT_cabang_konsolidasi = $account_beban_RT_pusat_konsolidasi - $account_beban_RT_pusat_total[0]; $print .= ' <tr><td align="left" > Beban Rumah Seluruh Cabang</td>'; $print .= ' <td align="right" class="">' . ($account_beban_RT_cabang_konsolidasi < 0 ? "(" . number_format(abs($account_beban_RT_cabang_konsolidasi)) . ")" : number_format($account_beban_RT_cabang_konsolidasi)) . '</td>'; $print .= ' <td align="right" class="">0</td>'; for ($branch = 1; $total_branch <= 0; $branch++) { $print .= ' <td align="right" class="">' . ($account_beban_RT_pusat_total[$branch] < 0 ? "(" . number_format(abs($account_beban_RT_pusat_total[$branch])) . ")" : number_format($account_beban_RT_pusat_total[$branch])) . '</td>'; } $print .= '</tr>'; //Beban ATK Seluruh Cabang $account_beban_ATK_cabang_konsolidasi = $account_beban_ATK_pusat_konsolidasi - $account_beban_ATK_pusat_total[0]; $print .= ' <tr><td align="left" > Beban ATK Seluruh Cabang</td>'; $print .= ' <td align="right" class="">' . ($account_beban_ATK_cabang_konsolidasi < 0 ? "(" . number_format(abs($account_beban_ATK_cabang_konsolidasi)) . ")" : number_format($account_beban_ATK_cabang_konsolidasi)) . '</td>'; $print .= ' <td align="right" class="">0</td>'; for ($branch = 1; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_beban_ATK_pusat_total[$branch] < 0 ? "(" . number_format(abs($account_beban_ATK_pusat_total[$branch])) . ")" : number_format($account_beban_ATK_pusat_total[$branch])) . '</td>'; } //Beban Transportasi Seluruh Cabang $account_beban_transportasi_cabang_konsolidasi = $account_beban_transportasi_pusat_konsolidasi - $account_beban_transportasi_pusat_total[0]; $print .= ' <tr><td align="left" > Beban Transportasi Seluruh Cabang</td>'; $print .= ' <td align="right" class="">' . ($account_beban_transportasi_cabang_konsolidasi < 0 ? "(" . number_format(abs($account_beban_transportasi_cabang_konsolidasi)) . ")" : number_format($account_beban_transportasi_cabang_konsolidasi)) . '</td>'; $print .= ' <td align="right" class="">0</td>'; for ($branch = 1; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_beban_transportasi_pusat_total[$branch] < 0 ? "(" . number_format(abs($account_beban_transportasi_pusat_total[$branch])) . ")" : number_format($account_beban_transportasi_pusat_total[$branch])) . '</td>'; } $print .= '</tr>'; //Beban Perawatan Seluruh Cabang $print .= ' <tr><td align="left" > Beban Perawatan Seluruh Cabang</td>'; $print .= ' <td align="right" class="">' . ($account_5060000_cabang < 0 ? "(" . number_format(abs($account_5060000_cabang)) . ")" : number_format($account_5060000_cabang)) . '</td>'; $print .= ' <td align="right" class="">0</td>'; for ($branch = 1; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_5060000[$branch] < 0 ? "(" . number_format(abs($account_5060000[$branch])) . ")" : number_format($account_5060000[$branch])) . '</td>'; } $print .= '</tr>'; //Beban Listrik, Air, Telepon dan Internet Seluruh Cabang $account_beban_listrik_air_telp_cabang_konsolidasi = $account_beban_listrik_air_telp_pusat_konsolidasi - $account_beban_listrik_air_telp_pusat_total[0]; $print .= ' <tr><td align="left" > Beban Listrik, Air, Telepon dan Internet Seluruh Cabang</td>'; $print .= ' <td align="right" class="">' . ($account_beban_listrik_air_telp_cabang_konsolidasi < 0 ? "(" . number_format(abs($account_beban_listrik_air_telp_cabang_konsolidasi)) . ")" : number_format($account_beban_listrik_air_telp_cabang_konsolidasi)) . '</td>'; $print .= ' <td align="right" class="">0</td>'; for ($branch = 1; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_beban_listrik_air_telp_pusat_total[$branch] < 0 ? "(" . number_format(abs($account_beban_listrik_air_telp_pusat_total[$branch])) . ")" : number_format($account_beban_listrik_air_telp_pusat_total[$branch])) . '</td>'; } $print .= '</tr>'; //Beban Lain-lain Seluruh Cabang $account_beban_lainlain_cabang_konsolidasi = $account_beban_lainlain_pusat_konsolidasi - $account_beban_lainlain_pusat_total[0]; $print .= ' <tr><td align="left" > Beban Lain-lain Seluruh Cabang</td>'; $print .= ' <td align="right" class="">' . ($account_beban_lainlain_cabang_konsolidasi < 0 ? "(" . number_format(abs($account_beban_lainlain_cabang_konsolidasi)) . ")" : number_format($account_beban_lainlain_cabang_konsolidasi)) . '</td>'; $print .= ' <td align="right" class="">0</td>'; for ($branch = 1; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_beban_lainlain_pusat_total[$branch] < 0 ? "(" . number_format(abs($account_beban_lainlain_pusat_total[$branch])) . ")" : number_format($account_beban_lainlain_pusat_total[$branch])) . '</td>'; } //Beban Cleaning Service $print .= ' <tr><td align="left" > Beban Cleaning Service</td>'; $print .= ' <td align="right" class="">' . ($account_9999999_total < 0 ? "(" . number_format(abs($account_9999999_total)) . ")" : number_format($account_9999999_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_9999999[$branch] < 0 ? "(" . number_format(abs($account_9999999[$branch])) . ")" : number_format($account_9999999[$branch])) . '</td>'; } $print .= '</tr>'; //Beban Keamanan dan Kebersihan $code = "5080405"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5080405_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5080405_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5080405[$branch] = $account_5080405_debet[$branch] - $account_5080405_credit[$branch]; $account_5080405_total += $account_5080405[$branch]; $account_biaya_langsung_total[$branch] += $account_5080405[$branch]; } $print .= ' <tr><td align="left" > Beban Keamanan dan Kebersihan</td>'; $print .= ' <td align="right" class="">' . ($account_5080405_total < 0 ? "(" . number_format(abs($account_5080405_total)) . ")" : number_format($account_5080405_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_5080405[$branch] < 0 ? "(" . number_format(abs($account_5080405[$branch])) . ")" : number_format($account_5080405[$branch])) . '</td>'; } $print .= '</tr>'; //Beban Penyusutan $code = "5070000"; $code_level1 = substr($code, 0, 3); for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5070000_debet[$branch] = $this->jurnal_model->sum_account_parent_debet_by_date($code_level1, $date_start, $date_end, $branch); $account_5070000_credit[$branch] = $this->jurnal_model->sum_account_parent_credit_by_date($code_level1, $date_start, $date_end, $branch); $account_5070000[$branch] = $account_5070000_debet[$branch] - $account_5070000_credit[$branch]; $account_5070000_total += $account_5070000[$branch]; $account_biaya_operasi_total[$branch] += $account_5070000[$branch]; } $print .= ' <tr><td align="left" > Beban Penyusutan</td>'; $print .= ' <td align="right" class="">' . ($account_5070000_total < 0 ? "(" . number_format(abs($account_5070000_total)) . ")" : number_format($account_5070000_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_5070000[$branch] < 0 ? "(" . number_format(abs($account_5070000[$branch])) . ")" : number_format($account_5070000[$branch])) . '</td>'; } $print .= '</tr>'; //Beban Sewa Kantor Cabang : 5040001, 5040002 $code = "5040001"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5040001_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5040001_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5040001[$branch] = $account_5040001_debet[$branch] - $account_5040001_credit[$branch]; $account_5040001_total += $account_5040001[$branch]; $account_beban_sewa_kantor_cabang_total[$branch] += $account_5040001[$branch]; $account_beban_operasi_total[$branch] += $account_5040001[$branch]; } $code = "5040002"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5040002_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5040002_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5040002[$branch] = $account_5040002_debet[$branch] - $account_5040002_credit[$branch]; $account_5040002_total += $account_5040002[$branch]; $account_beban_sewa_kantor_cabang_total[$branch] += $account_5040002[$branch]; $account_beban_operasi_total[$branch] += $account_5040002[$branch]; } $account_beban_sewa_kantor_cabang_konsolidasi = $account_5040001_total + $account_5040002_total; $print .= ' <tr><td align="left" > Beban Sewa Kantor Cabang</td>'; $print .= ' <td align="right" class="">' . ($account_beban_sewa_kantor_cabang_konsolidasi < 0 ? "(" . number_format(abs($account_beban_sewa_kantor_cabang_konsolidasi)) . ")" : number_format($account_beban_sewa_kantor_cabang_konsolidasi)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_beban_sewa_kantor_cabang_total[$branch] < 0 ? "(" . number_format(abs($account_beban_sewa_kantor_cabang_total[$branch])) . ")" : number_format($account_beban_sewa_kantor_cabang_total[$branch])) . '</td>'; } $print .= '</tr>'; //Beban MIS $print .= ' <tr><td align="left" > Beban MIS</td>'; $print .= ' <td align="right" class="border_btm">' . ($account_9999999_total < 0 ? "(" . number_format(abs($account_9999999_total)) . ")" : number_format($account_9999999_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="border_btm">' . ($account_9999999[$branch] < 0 ? "(" . number_format(abs($account_9999999[$branch])) . ")" : number_format($account_9999999[$branch])) . '</td>'; } $print .= '</tr>'; //Total Biaya Operasi for ($branch = 0; $branch <= $total_branch; $branch++) { $account_beban_operasi_konsolidasi += $account_beban_operasi_total[$branch]; } $print .= ' <tr><td align="left" >Total Biaya Operasi</td>'; $print .= ' <td align="right" class="border_btm">' . ($account_beban_operasi_konsolidasi < 0 ? "(" . number_format(abs($account_beban_operasi_konsolidasi)) . ")" : number_format($account_beban_operasi_konsolidasi)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="border_btm">' . ($account_beban_operasi_total[$branch] < 0 ? "(" . number_format(abs($account_beban_operasi_total[$branch])) . ")" : number_format($account_beban_operasi_total[$branch])) . '</td>'; } $print .= ' </tr>'; $print .= ' <tr><td></td><td align="left" class="border_btm" colspan="' . $colspan . '"> </td></tr>'; //Laba (Rugi) Operasi $account_LR_operasi_konsolidasi = $account_labarugi_kotor_konsolidasi - $account_beban_operasi_konsolidasi; $print .= ' <tr><td align="left" ><b>Laba (Rugi) Operasi</b></td>'; $print .= ' <td align="right" class="border_btm"><b>' . ($account_LR_operasi_konsolidasi < 0 ? "(" . number_format(abs($account_LR_operasi_konsolidasi)) . ")" : number_format($account_LR_operasi_konsolidasi)) . '</b></td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_LR_operasi[$branch] = $account_labarugi_kotor_total[$branch] - $account_beban_operasi_total[$branch]; $print .= ' <td align="right" class="border_btm"><b>' . ($account_LR_operasi[$branch] < 0 ? "(" . number_format(abs($account_LR_operasi[$branch])) . ")" : number_format($account_LR_operasi[$branch])) . '</b></td>'; } $print .= ' </tr>'; //--------------------------------------------------------------------------------------------- //Pendapatan Diluar Usaha //--------------------------------------------------------------------------------------------- $print .= ' <tr><td align="left" colspan="' . $colspan2 . '"> </td></tr>'; $print .= ' <tr><td align="left" ><b>Pendapatan & Beban Diluar Usaha</b></td> <td colspan="' . $colspan . '" ></td></tr>'; $print .= ' <tr><td align="left" ><b>Pendapatan Diluar Usaha</b></td> <td colspan="' . $colspan . '" ></td></tr>'; //Pendapatan Bunga Bank $code = "4030005"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_4030005_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_4030005_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_4030005[$branch] = $account_4030005_credit[$branch] - $account_4030005_debet[$branch]; $account_4030005_total += $account_4030005[$branch]; $account_pendapatan_diluar_usaha_total[$branch] += $account_4030005[$branch]; } $print .= ' <tr><td align="left" > Pendapatan Bunga Bank</td>'; $print .= ' <td align="right" class="">' . ($account_4030005_total < 0 ? "(" . number_format(abs($account_4030005_total)) . ")" : number_format($account_4030005_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_4030005[$branch] < 0 ? "(" . number_format(abs($account_4030005[$branch])) . ")" : number_format($account_4030005[$branch])) . '</td>'; } $print .= '</tr>'; //Pendapatan Lainnya : 4030001, 4030002, 4030003, 4030004, 4030006 $code = "4030001"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_4030001_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_4030001_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_4030001[$branch] = $account_4030001_credit[$branch] - $account_4030001_debet[$branch]; $account_4030001_total += $account_4030001[$branch]; $account_pendapatan_lain_pusat_total[$branch] += $account_4030001[$branch]; $account_pendapatan_diluar_usaha_total[$branch] += $account_4030001[$branch]; } $code = "4030002"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_4030002_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_4030002_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_4030002[$branch] = $account_4030002_credit[$branch] - $account_4030002_debet[$branch]; $account_4030002_total += $account_4030002[$branch]; $account_pendapatan_lain_pusat_total[$branch] += $account_4030002[$branch]; $account_pendapatan_diluar_usaha_total[$branch] += $account_4030002[$branch]; } $code = "4030003"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_4030003_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_4030003_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_4030003[$branch] = $account_4030003_credit[$branch] - $account_4030003_debet[$branch]; $account_4030003_total += $account_4030003[$branch]; $account_pendapatan_lain_pusat_total[$branch] += $account_4030003[$branch]; $account_pendapatan_diluar_usaha_total[$branch] += $account_4030003[$branch]; } $code = "4030004"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_4030004_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_4030004_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_4030004[$branch] = $account_4030004_credit[$branch] - $account_4030004_debet[$branch]; $account_4030004_total += $account_4030004[$branch]; $account_pendapatan_lain_pusat_total[$branch] += $account_4030004[$branch]; $account_pendapatan_diluar_usaha_total[$branch] += $account_4030004[$branch]; } $code = "4030006"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_4030006_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_4030006_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_4030006[$branch] = $account_4030006_credit[$branch] - $account_4030006_debet[$branch]; $account_4030006_total += $account_4030006[$branch]; $account_pendapatan_lain_pusat_total[$branch] += $account_4030006[$branch]; $account_pendapatan_diluar_usaha_total[$branch] += $account_4030006[$branch]; } $account_pendapatan_lain_konsolidasi = $account_4030001_total + $account_4030002_total + $account_4030003_total + $account_4030004_total + $account_4030006_total; $print .= ' <tr><td align="left" > Pendapatan Lainnya</td>'; $print .= ' <td align="right" class="border_btm">' . ($account_pendapatan_lain_konsolidasi < 0 ? "(" . number_format(abs($account_pendapatan_lain_konsolidasi)) . ")" : number_format($account_pendapatan_lain_konsolidasi)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="border_btm">' . ($account_pendapatan_lain_pusat_total[$branch] < 0 ? "(" . number_format(abs($account_pendapatan_lain_pusat_total[$branch])) . ")" : number_format($account_pendapatan_lain_pusat_total[$branch])) . '</td>'; } $print .= '</tr>'; //Total Pendapatan Diluar Usaha $account_pendapatan_diluar_usaha_konsolidasi = $account_4030005_total + $account_pendapatan_lain_konsolidasi; $print .= ' <tr><td align="left" > Total Pendapatan Diluar Usaha</td>'; $print .= ' <td align="right" class="border_btm">' . ($account_pendapatan_diluar_usaha_konsolidasi < 0 ? "(" . number_format(abs($account_pendapatan_diluar_usaha_konsolidasi)) . ")" : number_format($account_pendapatan_diluar_usaha_konsolidasi)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="border_btm">' . ($account_pendapatan_diluar_usaha_total[$branch] < 0 ? "(" . number_format(abs($account_pendapatan_diluar_usaha_total[$branch])) . ")" : number_format($account_pendapatan_diluar_usaha_total[$branch])) . '</td>'; } $print .= '</tr>'; //--------------------------------------------------------------------------------------------- //Beban Diluar Usaha //--------------------------------------------------------------------------------------------- $print .= ' <tr><td align="left" colspan="' . $colspan2 . '"> </td></tr>'; $print .= ' <tr><td align="left" ><b>Beban Diluar Usaha</b></td> <td colspan="' . $colspan . '" ></td></tr>'; //Beban Bunga Bank $code = "5090004"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5090004_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5090004_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5090004[$branch] = $account_5090004_debet[$branch] - $account_5090004_credit[$branch]; $account_5090004_total += $account_5090004[$branch]; $account_beban_diluar_usaha_total[$branch] += $account_5090004[$branch]; } $print .= ' <tr><td align="left" > Beban Bunga Bank</td>'; $print .= ' <td align="right" class="">' . ($account_5090004_total < 0 ? "(" . number_format(abs($account_5090004_total)) . ")" : number_format($account_5090004_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_5090004[$branch] < 0 ? "(" . number_format(abs($account_5090004[$branch])) . ")" : number_format($account_5090004[$branch])) . '</td>'; } $print .= '</tr>'; //Beban Merchant Discount Rate $print .= ' <tr><td align="left" > Beban Merchant Discount Rate</td>'; $print .= ' <td align="right" class="">' . ($account_9999999_total < 0 ? "(" . number_format(abs($account_9999999_total)) . ")" : number_format($account_9999999_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_9999999[$branch] < 0 ? "(" . number_format(abs($account_9999999[$branch])) . ")" : number_format($account_9999999[$branch])) . '</td>'; } $print .= '</tr>'; //Beban Kerugian Penghapusan Aktiva Tetap $code = "5090003"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5090003_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5090003_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5090003[$branch] = $account_5090003_debet[$branch] - $account_5090003_credit[$branch]; $account_5090003_total += $account_5090003[$branch]; $account_beban_diluar_usaha_total[$branch] += $account_5090003[$branch]; } $print .= ' <tr><td align="left" > Beban Kerugian Penghapusan Aktiva Tetap</td>'; $print .= ' <td align="right" class="">' . ($account_5090003_total < 0 ? "(" . number_format(abs($account_5090003_total)) . ")" : number_format($account_5090003_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_5090003[$branch] < 0 ? "(" . number_format(abs($account_5090003[$branch])) . ")" : number_format($account_5090003[$branch])) . '</td>'; } $print .= '</tr>'; //Selisih kurs/Penerimaan /Pembayaran $print .= ' <tr><td align="left" > Selisih kurs/Penerimaan /Pembayaran</td>'; $print .= ' <td align="right" class="">' . ($account_9999999_total < 0 ? "(" . number_format(abs($account_9999999_total)) . ")" : number_format($account_9999999_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_9999999[$branch] < 0 ? "(" . number_format(abs($account_9999999[$branch])) . ")" : number_format($account_9999999[$branch])) . '</td>'; } $print .= '</tr>'; //Beban PPh Pasal 21 Karyawan $code = "5050003"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5050003_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5050003_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5050003[$branch] = $account_5050003_debet[$branch] - $account_5050003_credit[$branch]; $account_5050003_total += $account_5050003[$branch]; $account_beban_diluar_usaha_total[$branch] += $account_5050003[$branch]; } $print .= ' <tr><td align="left" > Beban PPh Pasal 21 Karyawan</td>'; $print .= ' <td align="right" class="">' . ($account_5050003_total < 0 ? "(" . number_format(abs($account_5050003_total)) . ")" : number_format($account_5050003_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_5050003[$branch] < 0 ? "(" . number_format(abs($account_5050003[$branch])) . ")" : number_format($account_5050003[$branch])) . '</td>'; } $print .= '</tr>'; //Beban PPh Pasal 4 Ayat (2) atas Sewa Ruangan $print .= ' <tr><td align="left" > Beban PPh Pasal 4 Ayat (2) atas Sewa Ruangan</td>'; $print .= ' <td align="right" class="">' . ($account_9999999_total < 0 ? "(" . number_format(abs($account_9999999_total)) . ")" : number_format($account_9999999_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_9999999[$branch] < 0 ? "(" . number_format(abs($account_9999999[$branch])) . ")" : number_format($account_9999999[$branch])) . '</td>'; } $print .= '</tr>'; //Beban PPh Pasal 4 Ayat (2) atas Bunga Bank $print .= ' <tr><td align="left" > Beban PPh Pasal 4 Ayat (2) atas Bunga Bank</td>'; $print .= ' <td align="right" class="">' . ($account_9999999_total < 0 ? "(" . number_format(abs($account_9999999_total)) . ")" : number_format($account_9999999_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="">' . ($account_9999999[$branch] < 0 ? "(" . number_format(abs($account_9999999[$branch])) . ")" : number_format($account_9999999[$branch])) . '</td>'; } $print .= '</tr>'; //Beban Lainnya: 5050001, 5050002, 5050005, 5090001, 5090002, 5090005 $code = "5050001"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5050001_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5050001_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5050001[$branch] = $account_5050001_debet[$branch] - $account_5050001_credit[$branch]; $account_5050001_total += $account_5050001[$branch]; $account_beban_lain_total[$branch] += $account_5050001[$branch]; $account_beban_diluar_usaha_total[$branch] += $account_5050001[$branch]; } $code = "5050002"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5050002_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5050002_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5050002[$branch] = $account_5050002_debet[$branch] - $account_5050002_credit[$branch]; $account_5050002_total += $account_5050002[$branch]; $account_beban_lain_total[$branch] += $account_5050002[$branch]; $account_beban_diluar_usaha_total[$branch] += $account_5050002[$branch]; } $code = "5050005"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5050005_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5050005_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5050005[$branch] = $account_5050005_debet[$branch] - $account_5050005_credit[$branch]; $account_5050005_total += $account_5050005[$branch]; $account_beban_lain_total[$branch] += $account_5050005[$branch]; $account_beban_diluar_usaha_total[$branch] += $account_5050005[$branch]; } $code = "5090001"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5090001_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5090001_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5090001[$branch] = $account_5090001_debet[$branch] - $account_5090001_credit[$branch]; $account_5090001_total += $account_5090001[$branch]; $account_beban_lain_total[$branch] += $account_5090001[$branch]; $account_beban_diluar_usaha_total[$branch] += $account_5090001[$branch]; } $code = "5090002"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5090002_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5090002_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5090002[$branch] = $account_5090002_debet[$branch] - $account_5090002_credit[$branch]; $account_5090002_total += $account_5090002[$branch]; $account_beban_lain_total[$branch] += $account_5090002[$branch]; $account_beban_diluar_usaha_total[$branch] += $account_5090002[$branch]; } $code = "5090005"; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_5090005_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $branch); $account_5090005_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $branch); $account_5090005[$branch] = $account_5090005_debet[$branch] - $account_5090005_credit[$branch]; $account_5090005_total += $account_5090005[$branch]; $account_beban_lain_total[$branch] += $account_5090005[$branch]; $account_beban_diluar_usaha_total[$branch] += $account_5090005[$branch]; } $account_beban_lain_konsolidasi = $account_5050001_total + $account_5050002_total + $account_5050005_total + $account_5090001_total + $account_5090002_total + $account_5090005_total; $print .= ' <tr><td align="left" > Beban Lainnya</td>'; $print .= ' <td align="right" class="border_btm">' . ($account_beban_lain_konsolidasi < 0 ? "(" . number_format(abs($account_beban_lain_konsolidasi)) . ")" : number_format($account_beban_lain_konsolidasi)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="border_btm">' . ($account_beban_lain_total[$branch] < 0 ? "(" . number_format(abs($account_beban_lain_total[$branch])) . ")" : number_format($account_beban_lain_total[$branch])) . '</td>'; } $print .= '</tr>'; //Total Beban Diluar Usaha for ($branch = 0; $branch <= $total_branch; $branch++) { $account_beban_diluar_usaha_konsolidasi += $account_beban_diluar_usaha_total[$branch]; } $print .= ' <tr><td align="left" > Total Beban Diluar Usaha</td>'; $print .= ' <td align="right" class="border_btm">' . ($account_beban_diluar_usaha_konsolidasi < 0 ? "(" . number_format(abs($account_beban_diluar_usaha_konsolidasi)) . ")" : number_format($account_beban_diluar_usaha_konsolidasi)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="border_btm">' . ($account_beban_diluar_usaha_total[$branch] < 0 ? "(" . number_format(abs($account_beban_diluar_usaha_total[$branch])) . ")" : number_format($account_beban_diluar_usaha_total[$branch])) . '</td>'; } $print .= '</tr>'; $print .= ' <tr><td></td><td align="left" colspan="' . $colspan . '" class="border_btm"> </td></tr>'; //--------------------------------------------------------------------------------------------- //Laba (Rugi) TOTAL //--------------------------------------------------------------------------------------------- //Laba (Rugi) Sebelum Pajak $account_LR_sebelum_pajak_konsolidasi = $account_LR_operasi_konsolidasi + $account_pendapatan_diluar_usaha_konsolidasi - $account_beban_diluar_usaha_konsolidasi; $print .= ' <tr><td align="left" ><b>Laba (Rugi) Sebelum Pajak</b></td>'; $print .= ' <td align="right" class="border_btm"><b>' . ($account_LR_sebelum_pajak_konsolidasi < 0 ? "(" . number_format(abs($account_LR_sebelum_pajak_konsolidasi)) . ")" : number_format($account_LR_sebelum_pajak_konsolidasi)) . '</b></td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_LR_sebelum_pajak[$branch] = $account_LR_operasi_total[$branch] + $account_pendapatan_diluar_usaha_total[$branch] - $account_beban_diluar_usaha_total[$branch]; $print .= ' <td align="right" class="border_btm"><b>' . ($account_LR_sebelum_pajak[$branch] < 0 ? "(" . number_format(abs($account_LR_sebelum_pajak[$branch])) . ")" : number_format($account_LR_sebelum_pajak[$branch])) . '</b></td>'; } $print .= '</tr>'; $print .= ' <tr><td></td><td align="left" colspan="' . $colspan . '" class="border_btm"></td></tr>'; //Pajak Penghasilan Badan $code = "5050004"; for ($branch = 0; $branch <= $total_branch; $branch++) { //$account_5050004_debet[$branch] = $this->jurnal_model->sum_account_debet_by_date($code,$date_start,$date_end,$branch); //$account_5050004_credit[$branch] = $this->jurnal_model->sum_account_credit_by_date($code,$date_start,$date_end,$branch); //$account_5050004[$branch] = $account_5050004_debet[$branch] - $account_5050004_credit[$branch]; $account_5050004[$branch] = 0; $account_5050004_total += $account_5050004[$branch]; } $print .= ' <tr><td align="left" > Pajak Penghasilan Badan</td>'; $print .= ' <td align="right" class="border_btm">' . ($account_5050004_total < 0 ? "(" . number_format(abs($account_5050004_total)) . ")" : number_format($account_5050004_total)) . '</td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $print .= ' <td align="right" class="border_btm">' . ($account_5050004[$branch] < 0 ? "(" . number_format(abs($account_5050004[$branch])) . ")" : number_format($account_5050004[$branch])) . '</td>'; } $print .= '</tr>'; $print .= ' <tr><td></td><td align="left" colspan="' . $colspan . '" class="border_btm"></td></tr>'; //Laba (Rugi) Bersih $account_LR_bersih_konsolidasi = $account_LR_sebelum_pajak_konsolidasi - $account_5050004_total; $print .= ' <tr><td align="left" ><b>Laba (Rugi) Bersih</b></td>'; $print .= ' <td align="right" class="border_btm"><b>' . ($account_LR_bersih_konsolidasi < 0 ? "(" . number_format(abs($account_LR_bersih_konsolidasi)) . ")" : number_format($account_LR_bersih_konsolidasi)) . '</b></td>'; for ($branch = 0; $branch <= $total_branch; $branch++) { $account_LR_bersih_total[$branch] = $account_LR_sebelum_pajak[$branch] - $account_5050004[$branch]; $print .= ' <td align="right" class="border_btm"><b>' . ($account_LR_bersih_total[$branch] < 0 ? "(" . number_format(abs($account_LR_bersih_total[$branch])) . ")" : number_format($account_LR_bersih_total[$branch])) . '</b></td>'; } $print .= '</tr>'; $print .= '</table>'; $html .= $print; $this->load->library('mpdf'); $mpdf = new mPDF('utf-8', 'A4-L'); $mpdf->SetHeader("Amartha Microfinance" . '||' . $tgl . '|'); $mpdf->SetFooter("Laporan Laba Rugi" . '||{PAGENO}|'); $mpdf->WriteHTML($html); //echo $html; //$this->mpdf->Output(); $pdfFilePath = FCPATH . "downloads/labarugi/{$filename}.pdf"; $pdffile = base_url() . "downloads/labarugi/{$filename}.pdf"; $mpdf->Output($pdfFilePath, 'F'); redirect($pdffile, 'refresh'); } else { //If no session, redirect to login page redirect('login', 'refresh'); } }
1<br> 1<br> 1<br> 1<br> 1<br> 1<br> 1<br> 1<br> 1<br> 1<br> 1<br> 1<br> '; //============================================================== //============================================================== //============================================================== include "../mpdf.php"; $mpdf = new mPDF('c', 'A4', '', '', 5, 5, 5, 5, 0, 0); $mpdf->mirrorMargins = 1; // Use different Odd/Even headers and footers and mirror margins (1 or 0) //$mpdf->SetDisplayMode('fullpage','two'); // LOAD a stylesheet $stylesheet = file_get_contents('mpdfstylePaged.css'); //$mpdf->WriteHTML($stylesheet,1); // The parameter 1 tells that this is css/style only and no body/html/text $mpdf->SetHeader('<b style="text-align:left">Document Title {PAGENO}<b>'); $mpdf->WriteHTML('Document text'); $mpdf->WriteHTML($html); $mpdf->Output(); exit; //============================================================== //==============================================================
* it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * Primary Author Contact: Jacob Bates <*****@*****.**> */ require '../vendor/autoload.php'; use zz\Html\HTMLMinify; ini_set('max_execution_time', 300); $pdf = new mPDF(); $stylesheet = <<<EOD <link rel="stylesheet" href="../assets/css/pdf.css" type="text/css"> EOD; session_start(); $title = $_POST['context_title']; session_write_close(); $html = HTMLMinify::minify($_POST['result_html']); $pdf->SetHeader("Scanned on " . date("m/d/Y") . " at " . date("g:i a")); $pdf->SetFooter("Page {PAGENO} / {nb}"); $pdf->WriteHTML($stylesheet, 1); $pdf->WriteHTML($html, 2); $pdf->Output($title . '_' . date("Y-m-d_g:i-a") . '.pdf', 'D'); exit;
<?php /*********************************************************************/ /*Generar el reporte del dia, todos los tours */ /* */ /*********************************************************************/ $hotel = $_GET['hotel']; $table_header = ""; include "../mpdf/mpdf.php"; $mpdf = new mPDF(”); //the table stylesheet $stylesheet = file_get_contents('../mpdf/examples/mpdfstyletables.css'); $mpdf->WriteHTML($stylesheet, 1); //$mpdf->useDefaultCSS2 = true; //set header and footer to the pdf $mpdf->SetHeader('{DATE j-m-Y h:i:s}| <h5>Operadora Zacatecas S.A de C.V<h5> |{PAGENO}'); $mpdf->SetFooter('|Operadora|'); $mpdf->WriteHTML('<br/>'); $texto = "ERROR: "; //archivo de configuracion include 'config.php'; $mysqli = new mysqli($hostdb, $usuariodb, $clavedb, $nombredb); /* comprobar la conexión */ if (mysqli_connect_errno()) { echo $texto . mysqli_connect_error(); /**printf("Falló la conexión: %s\n", mysqli_connect_error());**/ exit; } //Consultar todos los hoteles activos en la base de datos //Esta consulta carga la clave de los hoteles //$consulta = 'SELECT th.id_tour, t.nombre_tour, th.horario, t.numero_tour FROM tourhorario th, tours t WHERE th.id_tour = t.id_tour';
public function pdfReportAction(Request $request) { $html = $request->getSession()->get('pdf'); //$html = utf8_encode($html); $mpdf = new \mPDF(); //$mpdf->WriteHTML('<pagebreak sheet-size="A5-L" />'); //$L = "L"; //$mpdf->_setPageSize("A4",$L); $mpdf->defaultheaderfontsize = 10; /* in pts */ $mpdf->defaultheaderfontstyle = B; /* blank, B, I, or BI */ $mpdf->defaultheaderline = 1; /* 1 to include line below header/above footer */ $mpdf->defaultfooterfontsize = 12; /* in pts */ $mpdf->defaultfooterfontstyle = B; /* blank, B, I, or BI */ $mpdf->defaultfooterline = 1; /* 1 to include line below header/above footer */ $mpdf->SetHeader('{DATE j-m-Y}|{PAGENO}|Reportes SISCONEE'); $mpdf->SetFooter('{PAGENO}'); /* defines footer for Odd and Even Pages - placed at Outer margin */ $mpdf->WriteHTML($html); $mpdf->Output(); exit; }
$fooder .= "<tr>"; $fooder .= "<td>"; $fooder .= "<b>Matriz:</b> Av. Santos Dumont, 1504 Km 01 da Estrada do Coco, Itinga - Lauro de Freitas - Bahia "; $fooder .= "Tel: (71) 3450-5686 <br>"; $fooder .= "<b>Filial Feira de Santana: </b>Pça João Pedreira, 24, Edf. Antônio Pinto Sala 201, Centro - Feira de Santana - Bahia CEP:44.002-168 "; $fooder .= "Tel: (75) 3223-4279 <br>"; $fooder .= "<b>Filial Salvador:</b> Rua Lucaia, 03, Rio Vermelho- Salvador, Bahia-CEP:41.940-650"; $fooder .= "Tel: (71) 3018-5686 <br>"; $fooder .= "</td>"; $fooder .= "</tr>"; $fooder .= "<tr>"; $fooder .= "<td align=\"center\" >"; $fooder .= "www ciderh.org.br <br>"; $fooder .= "<font color=\"#AB3156\"><b>CIDE - 17 Anos Intermediando o seu Desenvolvimento</b></font>"; $fooder .= "</td>"; $fooder .= "</tr>"; $fooder .= "</table>"; $mpdf=new mPDF(); $mpdf->SetHeader($header); $mpdf->SetFooter($fooder); $mpdf->SetDisplayMode('fullpage'); $css = file_get_contents("estilo_termo_adtivo.css"); $mpdf->WriteHTML($css,1); $mpdf->WriteHTML($html); $mpdf->Output(); exit; finalizar(); ?>
* print to a web browser */ //echo '<!DOCTYPE html><html><head><meta charset="UTF-8">' . $this->var_('style') . '</head><body>' . $headCont . $subHeader . $cont . '</body></html>'; //exit(); /** * Create a new PDF document * * @param string $mode * @param string $format * @param int $font_size * @param string $font * @param int $margin_left * @param int $margin_right * @param int $margin_top (Margin between content and header, not to be mixed with margin_header - which is document margin) * @param int $margin_bottom (Margin between content and footer, not to be mixed with margin_footer - which is document margin) * @param int $margin_header * @param int $margin_footer * @param string $orientation (P, L) new mPDF($mode, $format, $font_size, $font, $margin_left, $margin_right, $margin_top, $margin_bottom, $margin_header, $margin_footer, $orientation); default : $mode='',$format='A4',$default_font_size=0,$default_font='',$mgl=15,$mgr=15,$mgt=16,$mgb=16,$mgh=9,$mgf=9, $orientation='P' * * */ $mpdf = new mPDF('', 'A4', 0, '', 15, 15, 24, 16, 9, 9, 'P'); $mpdf->simpleTables = true; $mpdf->useSubstitutions = false; // true/ false $mpdf->defaultheaderline = 0; $mpdf->SetHeader(\GLOBALVAR\ROOT . '|MZE, VÚMOP v.v.i.|Generováno dne: {DATE d.m.Y}'); $mpdf->setAutoTopMargin = 5; $mpdf->SetFooter('|{PAGENO}.|'); $mpdf->WriteHTML('<!DOCTYPE html><html><head><meta charset="UTF-8">' . $this->var_('style') . '</head><body>' . $headCont . $subHeader . $cont . '</body></html>'); $mpdf->Output('REPORT_eKalkulacka.pdf', 'I');
$html .= "<td colspan=\"2\"><span class=\"style5\">ESTAGIÁRIO(A)</span></td>"; $html .= "<td colspan=\"2\"> </td>"; $html .= "</tr>"; $html .= "<tr align=\"left\" valign=\"top\">"; $html .= "<td colspan=\"4\"><span class=\"style6\">Nome do Estagiário:"; $html .=strtoupper($lineDados['nome']); $html .= "</tr>"; $html .= "</table>"; $mpdf=new mPDF(); $mpdf->SetHeader('teste'); $mpdf->SetDisplayMode('fullpage'); $css = file_get_contents("estilo_pdf.css"); $mpdf->WriteHTML($css,1); $mpdf->WriteHTML($html); $mpdf->Output(); exit; ?> </span></td></tr> <tr align="left" valign="top"> <td colspan="2"><span class="style6">RG: <?php echo $lineDados['rg']; ?> </span></td>
$appendTable .="<td>".$row[$x]."</td>";} else if($flag != 3){ $appendTable .="<td>".$row[$x]."</td>"; }} } $appendTable .='</tr>'; } $appendTable .='</tbody></table>'; //DROP TEMP TABLE $drop_query="DROP TABLE $temp_table "; if(($flag==3)||($flag==5)||($flag==6)||($flag==7)||($flag==8)||($flag==9)||($flag==10)||($flag==11)||($flag==12)||($flag==13)||($flag==14)||($flag==15)) mysqli_query($con,$drop_query); //GENERATE PDF $pageWidth=$arrTableWidth[$flag]/4; $mpdf=new mPDF('utf-8', array($pageWidth,236)); $mpdf->SetHeader($_GET['title']); $mpdf->WriteHTML($appendTable); $outputpdf=$mpdf->Output($_GET['title'].'.pdf','d'); echo $outputpdf; ?> <!-- 1*******USER DETAIL SEARCH 2******* 3*******TICKLER HISTORY 4*******DOOR CODE ACCES 5,6,7,8,9*******REVENUE 10******PROJECT REVENUE DATE RANGE 11******ATTENDANCE PRE ABS COUNT 12******ATTENDANCE PR ABS CNT BY MONTH 13******ATTENDANCE REPORT ENTRY MISSED 14******BANDWIDTH
/** * @param $url string - address of the item to print as PDF * @return string - contents of the PDF */ private function mpdf($url) { if (!extension_loaded('curl')) { TikiLib::lib('reporterror')->report(tra('mPDF: CURL PHP extension not available')); return ''; } // To prevent anyone else using your script to create their PDF files - TODO? //if (!preg_match("/^$base_url/", $url)) { die("Access denied"); } /* FIXME later, cookie auth not working yet $cookie = []; foreach ($_COOKIE as $key => $value) { $cookie[] = "{$key}={$value}"; }; $cookie = implode(';', $cookie); $ckfile = tempnam("/tmp", 'curl_cookies_'); file_put_contents($ckfile, $cookie); $curl_log = fopen('temp/curl_debug.txt', 'w+'); // open file for READ and write */ $options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false, CURLINFO_HEADER_OUT => true, CURLOPT_ENCODING => "", CURLOPT_HTTPHEADER => ['Expect:'], CURLOPT_FOLLOWLOCATION => true, CURLOPT_AUTOREFERER => true, CURLOPT_MAXREDIRS => 10, CURLOPT_CONNECTTIMEOUT => 10, CURLOPT_TIMEOUT => 30, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1); // For $_POST i.e. forms with fields if (count($_POST) > 0) { $ch = curl_init($url); curl_setopt_array($ch, $options); $formvars = []; foreach ($_POST as $name => $post) { $formvars = [$name => $post . " \n"]; } curl_setopt($ch, CURLOPT_POSTFIELDS, $formvars); $html = curl_exec($ch); curl_close($ch); } else { $ch = curl_init($url); curl_setopt_array($ch, $options); $html = curl_exec($ch); curl_close($ch); if (!$html) { $err = curl_error($ch); TikiLib::lib('errorreport')->report($err ? $err : tr('mPDF: An error occurred retrieving page %0', $url)); return ''; } } include $this->location . 'mpdf.php'; $mpdf = new mPDF(''); $mpdf->useSubstitutions = true; // optional - just as an example $mpdf->SetHeader($url . '||Page {PAGENO}'); // optional - just as an example $mpdf->CSSselectMedia = 'print'; // assuming you used this in the document header $mpdf->autoScriptToLang = true; $mpdf->autoLangToFont = true; $mpdf->setBasePath($url); $mpdf->WriteHTML($html); return $mpdf->Output('', 'S'); // Return as a string }
public static function PrintPDF($args) { $html = $args; //$name = $args["name"]; //$css = $args["css"]; include "Lib/PDF/mpdf.php"; $pdf = new mPDF("utf-8"); $pdf->SetHeader("Lapa"); $pdf->setFooter("{PAGENO}"); $pdf->useOnlyCoreFonts = true; $pdf->SetDisplayMode("fullpage"); $pdf->WriteHTML($html); $pdf->Output('page.pdf', 'F'); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Type: application/pdf"); header('Content-Disposition: attachment; filename="http://arthurvershinin.id.lv/page.pdf"'); exit("http://arthurvershinin.id.lv/page.pdf"); }
if ($i % 3 == 1) { $html = $html2; } else { $html = $html1; } $pph[$i] = SinglePage($html, $pw, $ph, $minK); // $pph saves the actual height of each page } //============================================================== // Save the pages to a file $mpdf->Output('test.pdf', 'F'); // Now collate those pages using IMPORT - 4 pages to one page $mpdf = new mPDF(); $mpdf->SetImportUse(); $mpdf->SetDisplayMode('fullpage'); $mpdf->SetHeader('{DATE j-m-Y}|My Yearbook 2005|{PAGENO}'); $mpdf->SetFooter('|Printed using mPDF|'); $pagecount = $mpdf->SetSourceFile('test.pdf'); for ($i = 1; $i <= $pagecount; $i++) { if ($i % 4 == 1) { $mpdf->AddPage(); } $pgheight = $mpdf->h - $mpdf->tMargin - $mpdf->bMargin; $hspacing = min($spacing, $mpdf->pgwidth - $pw * 2); $vspacing = min($spacing, $pgheight - $ph * 2); $x1 = $mpdf->lMargin + ($mpdf->pgwidth / 2 - $hspacing / 2 - $pw) / 2; $x2 = $mpdf->lMargin + $mpdf->pgwidth / 2 + $hspacing / 2 + ($mpdf->pgwidth / 2 - $hspacing / 2 - $pw) / 2; $y1 = $mpdf->tMargin + ($pgheight / 2 - $vspacing / 2 - $ph) / 2; $y2 = $mpdf->tMargin + $pgheight / 2 + $vspacing / 2 + ($pgheight / 2 - $vspacing / 2 - $ph) / 2; if ($i % 4 == 1) { $x = $x1;
$mpdf->WriteHTML("<br /><br /><br />"); $mpdf->WriteHTML("<p style='font-size: 16px; text-align: center;'> COMMITTEE MEMBERS: </p>"); $mpdf->WriteHTML("</div>"); $mpdf->WriteHTML("<div class='names'>"); $mpdf->WriteHTML('<columns column-count="2" column-gap="12" vAlign="justify" />'); $mpdf->WriteHTML("<p style='font-size: 16px; text-align: left; float: left;'><i> Students: </i></span>"); $mpdf->WriteHTML("<columnbreak />"); $mpdf->WriteHTML("<p style='font-size: 16px; text-align: right; float: right;'><i> Faculty: </i> </span>"); $mpdf->WriteHTML("</div>"); $mpdf->TOCpagebreak(array('toc-preHTML' => '<h1> Contents </h1>')); $mpdf->AddPage('P', 'Letter', '1'); //$mpdf->WriteHTML('<pagebreak resetpagenum="1" />'); $mpdf->WriteHTML('<columns column-count="2" column-gap="17" />'); $mpdf->keepColumns = true; $mpdf->pagenumPrefix = "Page "; $mpdf->SetHeader('{PAGENO}'); foreach ($sql as $name => $dep) { $result = $conn->query($dep); $mpdf->WriteHTML('<h4 class="text-align: center"> ' . strtoupper($name) . '</h4>'); $letter = 'A'; $mpdf->TOC_Entry($name, 0); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $text = $row['abstract']; $title = $row['title']; $mpdf->TOC_Entry($title, 1); $text = iconv("UTF-8", "UTF-8//IGNORE", $text); $title = iconv("UTF-8", "UTF-8//IGNORE", $title); $authors = array(); array_push($authors, $row['pauthor']); // getting authors
public function download_labarugi() { if ($this->session->userdata('logged_in')) { $timestamp = date("Ymdhis"); $tgl = date("d-M-Y"); $filename = "LAPORAN_LABARUGI_{$timestamp}"; $html = "<style> table tr td,table thead tr td, table tr th{ border-left:0; border-right:0;} table thead tr td,table thead tr th,table tr th{ border-bottom: 2px solid #000; }</style>"; $html .= ''; //$html .= '<h1 align="center">Amartha Microfinance</h1>'; //$html .= '<hr/>'; $html .= '<h2 align="center">LAPORAN LABA RUGI</h2><br/>'; $html .= '<table border="1" width="100%">'; //$html .= '<thead>'; $html .= '<tr>'; $html .= '<th>Account</th>'; $html .= '<th align="right" class="text-right" width="100px">Saldo Awal</th>'; $html .= '<th align="right" class="text-right" width="100px">Debet</th>'; $html .= '<th align="right" class="text-right" width="100px">Credit</th>'; $html .= '<th align="right" class="text-right" width="100px">Saldo Akhir</th>'; $html .= '</tr> '; $html .= '</thead>'; //Cek User Branch $user_branch = $this->session->userdata('user_branch'); if ($user_branch == "0") { $user_branch = NULL; } function getStartAndEndDate($week, $year) { $time = strtotime("1 January {$year}", time()); $day = date('w', $time); $time += (7 * $week + 1 - $day) * 24 * 3600; $return[0] = date('Y-n-j', $time); $time += 6 * 24 * 3600; $return[1] = date('Y-n-j', $time); return $return; } $date_today = date("Y-m-d"); $date_year_today = date("Y"); $date_week_today = date("W", strtotime($date_today)) - 1; $date_week_before = $date_week_today - 1; $week_today = getStartAndEndDate($date_week_today, $date_year_today); $date_start = $this->input->post('date_start'); $date_end = $this->input->post('date_end'); if ($date_start and $date_end and $date_start <= $date_end) { $date_start = $this->input->post('date_start'); $date_end = $this->input->post('date_end'); } else { $date_start = $week_today[0]; $date_end = $week_today[1]; } $date_end_before = strtotime($date_end); $date_end_before = strtotime("-7 day", $date_end_before); $date_end_before = date('Y-m-d', $date_end_before); $date_start_before = "2013-01-01"; $accounting = $this->accounting_model->get_all_accounting_labarugi()->result(); foreach ($accounting as $c) { $code = $c->accounting_code; $code_level0 = substr($code, 0, 1); $code_level1 = substr($code, 0, 3); $code_level2 = substr($code, 0, 5); $haschild = $c->accounting_haschild; $parent = $c->accounting_parent; $account_debet = 0; $account_credit = 0; $account_saldo = 0; $saldo_awal = 0; if ($code_level0_old != $code_level0) { $neraca .= '<tr><td colspan="5"> </td></tr><tr>'; } if ($haschild == "1" and $parent == "0") { //LEVEL 1 $account_debet = $this->jurnal_model->sum_account_parent_debet_by_date($code_level1, $date_start, $date_end, $user_branch); $account_credit = $this->jurnal_model->sum_account_parent_credit_by_date($code_level1, $date_start, $date_end, $user_branch); $account_debet_before = $this->jurnal_model->sum_account_parent_debet_by_date($code_level1, $date_start_before, $date_end_before, $user_branch); $account_credit_before = $this->jurnal_model->sum_account_parent_credit_by_date($code_level1, $date_start_before, $date_end_before, $user_branch); $account_saldo_before = $account_debet_before - $account_credit_before; $account_saldo = $account_saldo_before + $account_debet - $account_credit; $neraca .= '<tr> <td align="left" ><b>' . $c->accounting_code . " " . $c->accounting_name . '</b></td> <td class="text-right"><b>' . ($account_saldo_before < 0 ? "(" . number_format(abs($account_saldo_before)) . ")" : number_format($account_saldo_before)) . '</b></td> <td class="text-right"><b>' . number_format($account_debet) . '</b></td> <td class="text-right"><b>' . number_format($account_credit) . '</b></td> <td class="text-right"><b>' . ($account_saldo < 0 ? "(" . number_format(abs($account_saldo)) . ")" : number_format($account_saldo)) . '</b></td> </tr>'; } elseif ($haschild == "1" and $parent != "0") { //LEVEL 2 $account_debet = $this->jurnal_model->sum_account_parent_debet_by_date($code_level2, $date_start, $date_end, $user_branch); $account_credit = $this->jurnal_model->sum_account_parent_credit_by_date($code_level2, $date_start, $date_end, $user_branch); $account_debet_before = $this->jurnal_model->sum_account_parent_debet_by_date($code_level2, $date_start_before, $date_end_before, $user_branch); $account_credit_before = $this->jurnal_model->sum_account_parent_credit_by_date($code_level2, $date_start_before, $date_end_before, $user_branch); $account_saldo_before = $account_debet_before - $account_credit_before; $account_saldo = $account_saldo_before + $account_debet - $account_credit; $neraca .= '<tr> <td align="left" ><b> ' . $c->accounting_code . " " . $c->accounting_name . '</b></td> <td class="text-right"><b>' . ($account_saldo_before < 0 ? "(" . number_format(abs($account_saldo_before)) . ")" : number_format($account_saldo_before)) . '</b></td> <td class="text-right"><b>' . number_format($account_debet) . '</b></td> <td class="text-right"><b>' . number_format($account_credit) . '</b></td> <td class="text-right"><b>' . ($account_saldo < 0 ? "(" . number_format(abs($account_saldo)) . ")" : number_format($account_saldo)) . '</b></td> </tr>'; } else { //LEVEL 3 $account_debet = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $user_branch); $account_credit = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $user_branch); $account_debet_before = $this->jurnal_model->sum_account_debet_by_date($code, $date_start_before, $date_end_before, $user_branch); $account_credit_before = $this->jurnal_model->sum_account_credit_by_date($code, $date_start_before, $date_end_before, $user_branch); $account_saldo_before = $account_debet_before - $account_credit_before; $account_saldo = $account_saldo_before + $account_debet - $account_credit; //grand total dihitung dari total account level 3 $grand_total_debet += $account_debet; $grand_total_credit += $account_credit; $grand_total_before += $account_saldo_before; if ($code_level0 == "4") { $grand_total_pendapatan_debet += $account_debet; $grand_total_pendapatan_credit += $account_credit; $grand_total_pendapatan_before += $account_saldo_before; } elseif ($code_level0 == "5") { $grand_total_beban_debet += $account_debet; $grand_total_beban_credit += $account_credit; $grand_total_beban_before += $account_saldo_before; } $neraca .= '<tr> <td align="left" > ' . $c->accounting_code . " " . $c->accounting_name . '</td> <td class="text-right">' . ($account_saldo_before < 0 ? "(" . number_format(abs($account_saldo_before)) . ")" : number_format($account_saldo_before)) . '</td> <td class="text-right">' . number_format($account_debet) . '</td> <td class="text-right">' . number_format($account_credit) . '</td> <td class="text-right">' . ($account_saldo < 0 ? "(" . number_format(abs($account_saldo)) . ")" : number_format($account_saldo)) . '</td> </tr>'; } $code_level0_old = $code_level0; } //GRAND TOTAL $grand_total_saldo = $saldo_awal + $grand_total_debet - $grand_total_credit; $grand_total_pendapatan_saldo = $grand_total_pendapatan_before + $grand_total_pendapatan_debet - $grand_total_pendapatan_credit; $grand_total_beban_saldo = $grand_total_beban_before + $grand_total_beban_debet - $grand_total_beban_credit; $laba_rugi = $grand_total_pendapatan_before + $grand_total_pendapatan_credit - ($grand_total_beban_before + $grand_total_beban_debet); $neraca .= '<tfoot ><tr bgcolor="#eee"> <td align="left" ><b>TOTAL PENDAPATAN</b></td> <td class="text-right"><b>' . ($grand_total_pendapatan_before < 0 ? "(" . number_format(abs($grand_total_pendapatan_before)) . ")" : number_format($grand_total_pendapatan_before)) . '</b></td> <td class="text-right"><b>' . number_format($grand_total_pendapatan_debet) . '</b></td> <td class="text-right"><b>' . number_format($grand_total_pendapatan_credit) . '</b></td> <td class="text-right"><b>' . ($grand_total_pendapatan_saldo < 0 ? "(" . number_format(abs($grand_total_pendapatan_saldo)) . ")" : number_format($grand_total_pendapatan_saldo)) . '</b></td> </tr>'; $neraca .= '<tr bgcolor="#eee"> <td align="left" ><b>TOTAL BEBAN</b></td> <td class="text-right"><b>' . ($grand_total_beban_before < 0 ? "(" . number_format(abs($grand_total_beban_before)) . ")" : number_format($grand_total_beban_before)) . '</b></td> <td class="text-right"><b>' . number_format($grand_total_beban_debet) . '</b></td> <td class="text-right"><b>' . number_format($grand_total_beban_credit) . '</b></td> <td class="text-right"><b>' . ($grand_total_beban_saldo < 0 ? "(" . number_format(abs($grand_total_beban_saldo)) . ")" : number_format($grand_total_beban_saldo)) . '</b></td> </tr>'; $neraca .= '<tr bgcolor="#ddd"> <td align="left" ><b>LABA RUGI</b></td> <td class="text-right"></td> <td class="text-right"></td> <td class="text-right"></td> <td class="text-right"><b>' . ($laba_rugi < 0 ? "(" . number_format(abs($laba_rugi)) . ")" : number_format($laba_rugi)) . '</b></td> </tr></tfoot>'; $neraca .= '</table>'; $html .= $neraca; $this->load->library('mpdf'); $mpdf = new mPDF('utf-8', 'A4-L'); $mpdf->SetHeader("Amartha Microfinance" . '||' . $tgl . '|'); $mpdf->SetFooter("Laporan Laba Rugi" . '||{PAGENO}|'); $mpdf->WriteHTML($html); //echo $html; //$this->mpdf->Output(); $pdfFilePath = FCPATH . "downloads/labarugi/{$filename}.pdf"; $pdffile = base_url() . "downloads/labarugi/{$filename}.pdf"; $mpdf->Output($pdfFilePath, 'F'); redirect($pdffile, 'refresh'); } else { //If no session, redirect to login page redirect('login', 'refresh'); } }
'R' => array( 'content' => '{PAGENO}{nbpg}', 'font-family' => 'sans', 'font-style' => '', 'font-size' => '9', /* gives default */ ), 'line' => 1, ); $footer = ' <table width="100%" style="border-top: 0.1mm solid #000000; vertical-align: top; font-family: sans; font-size: 9pt; color: #000055;"><tr> <td width="50%"></td> <td width="50%" align="right">See <a href="http://mpdf1.com/manual/index.php">documentation manual</a> for further details</td> </tr></table> '; $mpdf->SetHeader($header,'O'); $mpdf->SetHTMLFooter($footer); //============================================================== $mpdf->SetDisplayMode('fullpage'); $mpdf->WriteHTML($html); $mpdf->Output(); exit; //============================================================== //============================================================== //============================================================== //==============================================================
// 0 => Mode Dev ; 1 => Mode PDF include "components/mpdf/mpdf.php"; $mpdf = new mPDF('utf-8', 'A4'); $mpdf->defaultheaderfontsize = 10; /* in pts */ $mpdf->defaultheaderfontstyle = B; /* blank, B, I, or BI */ $mpdf->defaultheaderline = 1; /* 1 to include line below header/above footer */ $mpdf->defaultfooterfontsize = 12; /* in pts */ $mpdf->defaultfooterfontstyle = B; /* blank, B, I, or BI */ $mpdf->defaultfooterline = 1; /* 1 to include line below header/above footer */ $mpdf->SetHeader('Gestion de Support ' . $rparameters['company'] . '||{DATE j/m/Y}'); $mpdf->SetFooter('{PAGENO}'); /* defines footer for Odd and Even Pages - placed at Outer margin */ $mpdf->WriteHTML($html); $mpdf->Output(); exit; } else { echo $html; } } else { echo '<script language="Javascript"> <!-- history.back(); // --> </script>'; }
public function gerarRelatorio($data = NULL, $origem = NULL) { //verificando a sessao $this->verificarSessao(); //iniciando o relatório $mpdf = new mPDF('', '', 0, '', 15, 15, 35, 16, 9, 9, 'L'); //tamanho do pdf $mpdf->SetDisplayMode('fullpage'); //cabeçalho $mpdf->SetHeader('|Faculdade de Tecnologia Dom Amaury Castanho <br /> Av. Tiradentes, 1211 - Parque Industrial, Itu - SP, 13309-640 <br />(11) 4013-1872|'); //rodapé $mpdf->SetFooter('|Página {PAGENO} de {nb}|www.fatecitu.edu.br'); switch ($origem) { case 1: $html = $this->load->view('relatorio/modelos/historicoAtivo_view', $data, true); //titulo $mpdf->SetTitle('Histórico do Ativo'); //conteúdo $mpdf->WriteHTML($html); //gerar pdf $mpdf->Output('historicoDoAtivo.pdf', 'D'); break; case 2: $html = $this->load->view('relatorio/modelos/ativosPorLocal_view', $data, true); //titulo $mpdf->SetTitle('Ativos por Local'); //conteúdo $mpdf->WriteHTML($html); //gerar pdf $mpdf->Output('ativosPorLocal.pdf', 'D'); break; case 3: //titulo $mpdf->SetTitle('Relatório de Divergência'); $html = $this->load->view('relatorio/modelos/divergencia_view', $data, true); $mpdf->WriteHTML($html); //adicionando uma nova página $mpdf->AddPage(); $html = $this->load->view('relatorio/modelos/ativosLocalErrado_view', $data, true); $mpdf->WriteHTML($html); //adicionando uma nova página $mpdf->AddPage(); $html = $this->load->view('relatorio/modelos/ativoNaoEncontrado_view', $data, true); $mpdf->WriteHTML($html); //gerar pdf $mpdf->Output('assets/docs/' . $data['id'] . '.pdf', 'F'); $mpdf->Output('relatorioDeDivergencia.pdf', 'D'); break; } redirect('ativo/carregarRelatorio'); }
public function tabwajib_download() { $client_account = $this->uri->segment(3); $data = $this->tabwajib_model->get_transaction($client_account); $client = $this->tabwajib_model->get_account($client_account); $client = $client[0]; $timestamp = date("Ymdhis"); $tgl = date("d-M-Y"); $filename = "MUTASI_TAB_WAJIB_" . $client->client_account . "_{$timestamp}"; $html = "<style> table tr td,table thead tr td, table tr th{ border-left:0; border-right:0;} table thead tr td,table thead tr th,table tr th{ border-bottom: 2px solid #000; }</style>"; $html .= ''; $no = 1; $html .= '<h2 align="center">MUTASI TABUNGAN WAJIB</h2>'; $html .= "<p align='center'>" . $client->client_fullname . " - " . $client->client_account . "</p><br/>"; $html .= '<table border="1" width="100%">'; ////$html .= '<thead>'; $html .= '<tr>'; $html .= '<th>NO</th>'; $html .= '<th align="left" class="text-left">KODE TRANSAKSI</th>'; $html .= '<th align="left" class="text-left">TANGGAL</th>'; $html .= '<th align="right" class="text-right">DEBET</th>'; $html .= '<th align="right" class="text-right">KREDIT</th>'; $html .= '<th align="right" class="text-right">SALDO</th>'; $html .= '<th align="left" class="text-left">KETERANGAN</th>'; $html .= '</tr> '; foreach ($data as $c) { $html .= '<tr> '; $html .= '<td align="center">' . $no . '</td>'; $html .= '<td>' . $c->tr_topsheet_code . '</td> '; $html .= '<td>' . date("Y-m-d", strtotime($c->tr_date)) . '</td>'; $html .= '<td align="right" class="text-right">' . number_format($c->tr_debet) . '</td>'; $html .= '<td align="right" class="text-right">' . number_format($c->tr_credit) . '</td>'; $html .= '<td align="right" class="text-right">' . number_format($c->tr_saldo) . '</td>'; $html .= '<td>' . $c->tr_remark . '</td>'; $html .= '</tr>'; $no++; } $html .= '</table>'; $this->load->library('mpdf'); $mpdf = new mPDF('utf-8', 'A4-L'); $mpdf->SetHeader("Amartha Microfinance" . '||' . $tgl . '|'); $mpdf->SetFooter("Mutasi Tabungan Wajib" . '||{PAGENO}|'); $mpdf->WriteHTML($html); //echo $html; //$this->mpdf->Output(); $pdfFilePath = FCPATH . "downloads/mutasi/{$filename}.pdf"; $pdffile = base_url() . "downloads/mutasi/{$filename}.pdf"; $mpdf->Output($pdfFilePath, 'F'); redirect($pdffile, 'refresh'); }
} else { $html .= "Tidak ada berkas!"; } $html .= "</td>\n <td> </td>\n </tr>\n \n </table>"; } $html .= "<div></div>"; $html .= "</body>\n</html>"; echo $html; exit; define("_JPGRAPH_PATH", "{$PATH}/library/mpdf/jpgraph/src/"); // must define this before including mpdf.php file $JpgUseSVGFormat = true; define('_MPDF_URI', "{$url_rewrite}/library/mpdf/"); require "{$PATH}/library/mpdf/mpdf.php"; $mpdf = new mPDF(); $mpdf->SetHeader('{DATE j-M-Y}|Sistem Perizinan Mahasiswa Asing|Dikti'); //$mpdf->SetFooter('Colaboration with Universitas Gunadarma||{PAGENO}'); $mpdf->WriteHTML($html); $mpdf->Output("{$filename}", "D"); /*$mpdf=new mPDF('','','','',15,15,16,16,9,9,'L'); $mpdf->AddPage('P','','','','',15,15,16,16,9,9); $mpdf->setFooter('{PAGENO}') ; $mpdf->progbar_heading = 'Progress Bar report'; $mpdf->StartProgressBarOutput(); $mpdf->useGraphs = true; $mpdf->list_number_suffix = ')'; $mpdf->hyphenate = true; $mpdf->debug = true; $mpdf->WriteHTML($html); $mpdf->Output('tes.pdf',"D");*/
<input type="password" size="40" name="password" value="secret"> <br /><br /> <input type="checkbox" name="QPC" value="ON" > Checkboxes<br> <input type="checkbox" name="QPA" value="ON" > Not selected<br> <input type="checkbox" name="QLY" value="ON" checked="checked" > Selected<br> <input type="checkbox" name="QLY" value="ON" disabled="disabled" > Disabled <br /><br /> <input type="submit" name="submit" value="Submit" /> <input type="image" name="submit" src="goto.gif" /> <input type="button" name="submit" value="Button" /> <input type="reset" name="submit" value="Reset" /> </form> '; //============================================================== //============================================================== //============================================================== include "../mpdf.php"; $mpdf = new mPDF(); $mpdf->SetHeader('Document Title|Center Text'); $mpdf->SetFooter('Document Title | {PAGENO}'); $mpdf->WriteHTML($html); $mpdf->Output(); exit; //============================================================== //============================================================== //==============================================================
<?php include "mpdf/mpdf.php"; $mpdf = new mPDF('win-1252', 'A4', '', '', 15, 10, 16, 10, 10, 10); //A4 page in portrait for landscape add -L. $mpdf->SetHeader('Hoja de Vida'); $mpdf->setFooter('{PAGENO}'); // Giving page number to your footer. $mpdf->useOnlyCoreFonts = true; // false is default $mpdf->SetDisplayMode('fullpage'); // Buffer the following html with PHP so we can store it to a variable later ob_start(); include "pages/recursos_humanos/cv/reportes/reportePersona.php"; //This is your php page $html = ob_get_contents(); ob_end_clean(); // send the captured HTML from the output buffer to the mPDF class for processing $mpdf->WriteHTML($html); //$mpdf->SetProtection(array(), 'user', 'password'); uncomment to protect your pdf page with password. $mpdf->Output(); exit;
public function download_aruskas() { if ($this->session->userdata('logged_in')) { $timestamp = date("Ymdhis"); $tgl = date("d-M-Y"); $filename = "LAPORAN_ARUS_KAS_{$timestamp}"; $html = "<style> table tr td{ border:0;} </style>"; $html .= ''; //$html .= '<h1 align="center">Amartha Microfinance</h1>'; //$html .= '<hr/>'; $html .= '<h2 align="center">LAPORAN ARUS KAS</h2><br/>'; //Cek User Branch $user_branch = $this->session->userdata('user_branch'); function getStartAndEndDate($week, $year) { $time = strtotime("1 January {$year}", time()); $day = date('w', $time); $time += (7 * $week + 1 - $day) * 24 * 3600; $return[0] = date('Y-n-j', $time); $time += 6 * 24 * 3600; $return[1] = date('Y-n-j', $time); return $return; } $date_today = date("Y-m-d"); $date_year_today = date("Y"); $date_week_today = date("W", strtotime($date_today)) - 1; $date_week_before = $date_week_today - 1; $week_today = getStartAndEndDate($date_week_today, $date_year_today); $date_start = $this->input->post('date_start'); $date_end = $this->input->post('date_end'); if ($date_start and $date_end and $date_start <= $date_end) { $date_start = $this->input->post('date_start'); $date_end = $this->input->post('date_end'); } else { //$date_start =$week_today[0]; //$date_end = $week_today[1]; $date_start = $date_year_today . "-01-01"; $date_end = $date_today; } $date_end_before = strtotime($date_start); $date_end_before = strtotime("-1 day", $date_end_before); $date_end_before = date('Y-m-d', $date_end_before); $date_start_before = "2013-01-01"; $arus_kas_operasi_actual = 0; $arus_kas_operasi_before = 0; //Hitung Laba Rugi TODAY $accounting = $this->accounting_model->get_all_accounting_labarugi()->result(); foreach ($accounting as $c) { $code = $c->accounting_code; $code_level0 = substr($code, 0, 1); $code_level1 = substr($code, 0, 3); $code_level2 = substr($code, 0, 5); $haschild = $c->accounting_haschild; $parent = $c->accounting_parent; $account_debet = 0; $account_credit = 0; $account_saldo = 0; $saldo_awal = 0; if ($haschild == "1" and $parent == "0") { } elseif ($haschild == "1" and $parent != "0") { } else { //LEVEL 3 $account_debet = $this->jurnal_model->sum_account_debet_by_date($code, $date_start, $date_end, $user_branch); $account_credit = $this->jurnal_model->sum_account_credit_by_date($code, $date_start, $date_end, $user_branch); $account_debet_before = $this->jurnal_model->sum_account_debet_by_date($code, $date_start_before, $date_end_before, $user_branch); $account_credit_before = $this->jurnal_model->sum_account_credit_by_date($code, $date_start_before, $date_end_before, $user_branch); $account_saldo_before = $account_debet_before - $account_credit_before; $account_saldo = $account_saldo_before + $account_debet - $account_credit; //grand total dihitung dari total account level 3 $grand_total_debet += $account_debet; $grand_total_credit += $account_credit; $grand_total_before += $account_saldo_before; if ($code_level0 == "4") { $grand_total_pendapatan_debet += $account_debet; $grand_total_pendapatan_credit += $account_credit; $grand_total_pendapatan_before += $account_saldo_before; //* $grand_total_pendapatan_credit_before += $account_credit; } elseif ($code_level0 == "5") { $grand_total_beban_debet += $account_debet; $grand_total_beban_credit += $account_credit; $grand_total_beban_before += $account_saldo_before; //* $grand_total_beban_debet_before += $account_debet; } } $code_level0_old = $code_level0; } //GRAND TOTAL LABA RUGI BERJALAN $grand_total_saldo = $saldo_awal + $grand_total_debet - $grand_total_credit; $grand_total_pendapatan_saldo = $grand_total_pendapatan_before + $grand_total_pendapatan_debet - $grand_total_pendapatan_credit; $grand_total_beban_saldo = $grand_total_beban_before + $grand_total_beban_debet - $grand_total_beban_credit; $laba_rugi = $grand_total_pendapatan_credit - $grand_total_beban_debet; $laba_rugi_before = $grand_total_pendapatan_credit_before - $grand_total_beban_debet_before; //End of Hitung Laba Rugi //ARUS KAS OPERASI $arus_kas_operasi_actual += $laba_rugi; $arus_kas_operasi_before += $laba_rugi_before; $grand_total_debet = 0; $grand_total_credit = 0; $grand_total_before = 0; //Penyusutan aset tetap $get_account_saldo = $this->get_account_saldo("1060302", 3, $date_start, $date_end, $date_start_before, $date_end_before, $user_branch); list($total_before, $total_debet, $total_credit, $total_saldo) = $get_account_saldo; $actual_1060302 = $total_saldo; $before_1060302 = $total_before; $get_account_saldo = $this->get_account_saldo("1060202", 3, $date_start, $date_end, $date_start_before, $date_end_before, $user_branch); list($total_before, $total_debet, $total_credit, $total_saldo) = $get_account_saldo; $actual_1060202 = $total_saldo; $before_1060202 = $total_before; $penyusutan_aset_tetap_actual = $actual_1060302 + $actual_1060202; $penyusutan_aset_tetap_before = $before_1060302 + $before_1060202; $arus_kas_operasi_actual += $penyusutan_aset_tetap_actual; $arus_kas_operasi_before += $penyusutan_aset_tetap_before; //Piutang Pembiayaan $get_account_saldo = $this->get_account_saldo("1030000", 1, $date_start, $date_end, $date_start_before, $date_end_before, $user_branch); list($total_before, $total_debet, $total_credit, $total_saldo) = $get_account_saldo; $piutang_pembiayaan_actual = $total_saldo; $piutang_pembiayaan_before = $total_before; $arus_kas_operasi_actual += $piutang_pembiayaan_actual; $arus_kas_operasi_before += $piutang_pembiayaan_before; //Beban dibayar di muka $get_account_saldo = $this->get_account_saldo("1070104", 3, $date_start, $date_end, $date_start_before, $date_end_before, $user_branch); list($total_before, $total_debet, $total_credit, $total_saldo) = $get_account_saldo; $beban_dibayar_dimuka_actual = $total_saldo; $beban_dibayar_dimuka_before = $total_before; $arus_kas_operasi_actual += $beban_dibayar_dimuka_actual; $arus_kas_operasi_before += $beban_dibayar_dimuka_before; //persediaan_barang_cetakan $get_account_saldo = $this->get_account_saldo("1070104", 3, $date_start, $date_end, $date_start_before, $date_end_before, $user_branch); list($total_before, $total_debet, $total_credit, $total_saldo) = $get_account_saldo; $persediaan_barang_cetakan_actual = $total_saldo; $persediaan_barang_cetakan_before = $total_before; $arus_kas_operasi_actual += $persediaan_barang_cetakan_actual; $arus_kas_operasi_before += $persediaan_barang_cetakan_before; //simpanan anggota $get_account_saldo = $this->get_account_saldo("2010000", 1, $date_start, $date_end, $date_start_before, $date_end_before, $user_branch); list($total_before, $total_debet, $total_credit, $total_saldo) = $get_account_saldo; $simpanan_anggota_actual = $total_saldo; $simpanan_anggota_before = $total_before; $arus_kas_operasi_actual += $simpanan_anggota_actual; $arus_kas_operasi_before += $simpanan_anggota_before; //simpanan berjangka $get_account_saldo = $this->get_account_saldo("2020000", 1, $date_start, $date_end, $date_start_before, $date_end_before, $user_branch); list($total_before, $total_debet, $total_credit, $total_saldo) = $get_account_saldo; $simpanan_berjangka_actual = $total_saldo; $simpanan_berjangka_before = $total_before; $arus_kas_operasi_actual += $simpanan_berjangka_actual; $arus_kas_operasi_before += $simpanan_berjangka_before; //hutang pembiayaan $get_account_saldo = $this->get_account_saldo("2040000", 1, $date_start, $date_end, $date_start_before, $date_end_before, $user_branch); list($total_before, $total_debet, $total_credit, $total_saldo) = $get_account_saldo; $hutang_pembiayaan_actual = $total_saldo; $hutang_pembiayaan_before = $total_before; $arus_kas_operasi_actual += $hutang_pembiayaan_actual; $arus_kas_operasi_before += $hutang_pembiayaan_before; //hutang_lain $get_account_saldo = $this->get_account_saldo("2050000", 1, $date_start, $date_end, $date_start_before, $date_end_before, $user_branch); list($total_before, $total_debet, $total_credit, $total_saldo) = $get_account_saldo; $hutang_lain_actual = $total_saldo; $hutang_lain_before = $total_before; $arus_kas_operasi_actual += $hutang_lain_actual; $arus_kas_operasi_before += $hutang_lain_before; //ARUS KAS INVESTASI $arus_kas_investasi_actual = 0; $arus_kas_investasi_before = 0; //Penambahan aset tetap $get_account_saldo = $this->get_account_saldo("1060000", 1, $date_start, $date_end, $date_start_before, $date_end_before, $user_branch); list($total_before, $total_debet, $total_credit, $total_saldo) = $get_account_saldo; $penambahan_aset_tetap_actual = $total_saldo; $penambahan_aset_tetap_before = $total_before; $arus_kas_investasi_actual += $penambahan_aset_tetap_actual; $arus_kas_investasi_before += $penambahan_aset_tetap_before; //Penambahan aset lain $get_account_saldo = $this->get_account_saldo("1070000", 1, $date_start, $date_end, $date_start_before, $date_end_before, $user_branch); list($total_before, $total_debet, $total_credit, $total_saldo) = $get_account_saldo; $penambahan_aset_lain_actual = $total_saldo; $penambahan_aset_lain_before = $total_before; $arus_kas_investasi_actual += $penambahan_aset_lain_actual; $arus_kas_investasi_before += $penambahan_aset_lain_before; //ARUS KAS PENDANAAN $arus_kas_pendanaan_actual = 0; $arus_kas_pendanaan_before = 0; //Penambahan simpanan $get_account_saldo = $this->get_account_saldo("3010101", 3, $date_start, $date_end, $date_start_before, $date_end_before, $user_branch); list($total_before, $total_debet, $total_credit, $total_saldo) = $get_account_saldo; $penambahan_simpanan_3010101_actual = $total_saldo; $penambahan_simpanan_3010101_before = $total_before; $get_account_saldo = $this->get_account_saldo("3010102", 3, $date_start, $date_end, $date_start_before, $date_end_before, $user_branch); list($total_before, $total_debet, $total_credit, $total_saldo) = $get_account_saldo; $penambahan_simpanan_3010102_actual = $total_saldo; $penambahan_simpanan_3010102_before = $total_before; $penambahan_simpanan_actual = $penambahan_simpanan_3010101_actual + $penambahan_simpanan_3010102_actual; $penambahan_simpanan_before = $penambahan_simpanan_3010101_before + $penambahan_simpanan_3010102_before; $arus_kas_pendanaan_actual += $penambahan_simpanan_actual; $arus_kas_pendanaan_before += $penambahan_simpanan_before; //Penambahan hibah $get_account_saldo = $this->get_account_saldo("3010103", 3, $date_start, $date_end, $date_start_before, $date_end_before, $user_branch); list($total_before, $total_debet, $total_credit, $total_saldo) = $get_account_saldo; $penambahan_hibah_actual = $total_saldo; $penambahan_hibah_before = $total_before; $arus_kas_pendanaan_actual += $penambahan_hibah_actual; $arus_kas_pendanaan_before += $penambahan_hibah_before; //Penambahan modal $get_account_saldo = $this->get_account_saldo("3010202", 3, $date_start, $date_end, $date_start_before, $date_end_before, $user_branch); list($total_before, $total_debet, $total_credit, $total_saldo) = $get_account_saldo; $penambahan_modal_actual = $total_saldo; $penambahan_modal_before = $total_before; $arus_kas_pendanaan_actual += $penambahan_modal_actual; $arus_kas_pendanaan_before += $penambahan_modal_before; //KAS AWAL TAHUN $kas_awal_tahun_actual = $arus_kas_operasi_actual + $arus_kas_investasi_actual + $arus_kas_pendanaan_actual; $kas_awal_tahun_before = $arus_kas_operasi_before + $arus_kas_investasi_before + $arus_kas_pendanaan_before; //KAS AKHIR TAHUN $get_account_saldo = $this->get_account_saldo("1010000", 1, $date_start, $date_end, $date_start_before, $date_end_before, $user_branch); list($total_before, $total_debet, $total_credit, $total_saldo) = $get_account_saldo; $kas_akhir_tahun_actual = $total_saldo; $kas_akhir_tahun_before = $total_before; //SELISIH KAS $selisih_kas_actual = $kas_awal_tahun_actual - $kas_akhir_tahun_actual; $selisih_kas_before = $kas_awal_tahun_before - $kas_akhir_tahun_before; //LAPORAN FORMAT $laporan .= '<table cellpadding="5px" width="95%" align="center">'; $laporan .= '<tr> <td width="28%" align="left" ></td> <td width="20%" align="center" style="border-bottom: 1px solid #000;">2014</td> <td width="4%" align="left" ></td> <td width="20%" align="center" style="border-bottom: 1px solid #000;">2013</td> <td width="28%" align="right"></td> </tr>'; $laporan .= '<tr> <td align="left" ><b>Arus Kas Dari Aktivitas Operasi</b></td> <td align="right"></td> <td> </td> <td align="right"></td> <td align="right"><b><i>Cash Flow From Operating Activities</i></b></td> </tr>'; $laporan .= '<tr> <td align="left" >Laba bersih</td> <td align="right">' . ($laba_rugi < 0 ? "(" . number_format(abs($laba_rugi)) . ")" : number_format($laba_rugi)) . '</td> <td> </td> <td align="right">' . ($laba_rugi_before < 0 ? "(" . number_format(abs($laba_rugi_before)) . ")" : number_format($laba_rugi_before)) . '</td> <td align="right"><i>Net Income</i></td> </tr>'; $laporan .= '<tr> <td align="left" >Penyesuaian untuk merekonsiliasi Laba bersih menjadi arus kas bersih dari aktivitas operasi:</td> <td align="right"> </td> <td> </td> <td align="right"> </td> <td align="right"><i>Adjustment to reconcile net income to be net cash from Operationg activities:</i></td> </tr>'; $laporan .= '<tr> <td align="left" >Penyusutan aset tetap</td> <td align="right">' . ($penyusutan_aset_tetap_actual < 0 ? "(" . number_format(abs($penyusutan_aset_tetap_actual)) . ")" : number_format($penyusutan_aset_tetap_actual)) . '</td> <td> </td> <td align="right">' . ($penyusutan_aset_tetap_before < 0 ? "(" . number_format(abs($penyusutan_aset_tetap_before)) . ")" : number_format($penyusutan_aset_tetap_before)) . '</td> <td align="right"><i>Depreciation of fixed assets</i></td> </tr>'; $laporan .= '<tr> <td align="left" >Penyusutan Aset dan Liabilitas dari Operasional: </td> <td align="right"></td> <td> </td> <td align="right"></td> <td align="right"><i>Changes in operating assets and liablities</i></td> </tr>'; $laporan .= '<tr> <td align="left" >Piutang Pembiayaan</td> <td align="right">' . ($piutang_pembiayaan_actual < 0 ? "(" . number_format(abs($piutang_pembiayaan_actual)) . ")" : number_format($piutang_pembiayaan_actual)) . '</td> <td> </td> <td align="right">' . ($piutang_pembiayaan_before < 0 ? "(" . number_format(abs($piutang_pembiayaan_before)) . ")" : number_format($piutang_pembiayaan_before)) . '</td> <td align="right"><i>Financing Receivables</i></td> </tr>'; $laporan .= '<tr> <td align="left" >Beban dibayar dimuka</td> <td align="right">' . ($beban_dibayar_dimuka_actual < 0 ? "(" . number_format(abs($beban_dibayar_dimuka_actual)) . ")" : number_format($beban_dibayar_dimuka_actual)) . '</td> <td> </td> <td align="right">' . ($beban_dibayar_dimuka_before < 0 ? "(" . number_format(abs($beban_dibayar_dimuka_before)) . ")" : number_format($beban_dibayar_dimuka_before)) . '</td> <td align="right"><i>Prepaid Expenses</i></td> </tr>'; $laporan .= '<tr> <td align="left" >Persediaan Barang Cetakan</td> <td align="right">' . ($persediaan_barang_cetakan_actual < 0 ? "(" . number_format(abs($persediaan_barang_cetakan_actual)) . ")" : number_format($persediaan_barang_cetakan_actual)) . '</td> <td> </td> <td align="right">' . ($persediaan_barang_cetakan_before < 0 ? "(" . number_format(abs($persediaan_barang_cetakan_before)) . ")" : number_format($persediaan_barang_cetakan_before)) . '</td> <td align="right"><i>Inventory</i></td> </tr>'; $laporan .= '<tr> <td align="left" >Simpanan Anggota</td> <td align="right">' . ($simpanan_anggota_actual < 0 ? "(" . number_format(abs($simpanan_anggota_actual)) . ")" : number_format($simpanan_anggota_actual)) . '</td> <td> </td> <td align="right">' . ($simpanan_anggota_before < 0 ? "(" . number_format(abs($simpanan_anggota_before)) . ")" : number_format($simpanan_anggota_before)) . '</td> <td align="right"><i>Members Savings</i></td> </tr>'; $laporan .= '<tr> <td align="left" >Simpanan Berjangka</td> <td align="right">' . ($simpanan_berjangka_actual < 0 ? "(" . number_format(abs($simpanan_berjangka_actual)) . ")" : number_format($simpanan_berjangka_actual)) . '</td> <td> </td> <td align="right">' . ($simpanan_berjangka_before < 0 ? "(" . number_format(abs($simpanan_berjangka_before)) . ")" : number_format($simpanan_berjangka_before)) . '</td> <td align="right"><i>Term Deposits</i></td> </tr>'; $laporan .= '<tr> <td align="left" >Hutang Pembiayaan</td> <td align="right">' . ($hutang_pembiayaan_actual < 0 ? "(" . number_format(abs($hutang_pembiayaan_actual)) . ")" : number_format($hutang_pembiayaan_actual)) . '</td> <td> </td> <td align="right">' . ($hutang_pembiayaan_before < 0 ? "(" . number_format(abs($hutang_pembiayaan_before)) . ")" : number_format($hutang_pembiayaan_before)) . '</td> <td align="right"><i>Financing Payables</i></td> </tr>'; $laporan .= '<tr> <td align="left" >Hutang Lain-lain</td> <td align="right" style="border-bottom: 1px solid #000;">' . ($hutang_lain_actual < 0 ? "(" . number_format(abs($hutang_lain_actual)) . ")" : number_format($hutang_lain_actual)) . '</td> <td> </td> <td align="right" style="border-bottom: 1px solid #000;">' . ($hutang_lain_before < 0 ? "(" . number_format(abs($hutang_lain_before)) . ")" : number_format($hutang_lain_before)) . '</td> <td align="right"><i>Other Liabilities</i></td> </tr>'; $laporan .= '<tr> <td align="left" >Arus kas bersih dari aktivitas operasi</td> <td align="right" style="border-bottom: 1px solid #000;">' . ($arus_kas_operasi_actual < 0 ? "(" . number_format(abs($arus_kas_operasi_actual)) . ")" : number_format($arus_kas_operasi_actual)) . '</td> <td> </td> <td align="right" style="border-bottom: 1px solid #000;">' . ($arus_kas_operasi_before < 0 ? "(" . number_format(abs($arus_kas_operasi_before)) . ")" : number_format($arus_kas_operasi_before)) . '</td> <td align="right"><i>Net cash flow from operating activities</i></td> </tr>'; $laporan .= '<tr> <td align="left" ><br/><b>Arus Kas Dari Aktivitas Investasi</b></td> <td align="right"></td> <td> </td> <td align="right"></td> <td align="right"><br/><b><i>Cash Flow From Investment Operating</i></b></td> </tr>'; $laporan .= '<tr> <td align="left" >Penambahan Aset Tetap</td> <td align="right">' . ($penambahan_aset_tetap_actual < 0 ? "(" . number_format(abs($penambahan_aset_tetap_actual)) . ")" : number_format($penambahan_aset_tetap_actual)) . '</td> <td> </td> <td align="right">' . ($penambahan_aset_tetap_before < 0 ? "(" . number_format(abs($penambahan_aset_tetap_before)) . ")" : number_format($penambahan_aset_tetap_before)) . '</td> <td align="right"><i>Acquisition of Fixed Assets</i></td> </tr>'; $laporan .= '<tr> <td align="left" >Penambahan Aset Lain</td> <td align="right" style="border-bottom: 1px solid #000;">' . ($penambahan_aset_lain_actual < 0 ? "(" . number_format(abs($penambahan_aset_lain_actual)) . ")" : number_format($penambahan_aset_lain_actual)) . '</td> <td> </td> <td align="right" style="border-bottom: 1px solid #000;">' . ($penambahan_aset_lain_before < 0 ? "(" . number_format(abs($penambahan_aset_lain_before)) . ")" : number_format($penambahan_aset_lain_before)) . '</td> <td align="right"><i>Acquisition of Other Assets</i></td> </tr>'; $laporan .= '<tr> <td align="left" >Arus kas bersih dari aktivitas investasi</td> <td align="right" style="border-bottom: 1px solid #000;">' . ($arus_kas_investasi_actual < 0 ? "(" . number_format(abs($arus_kas_investasi_actual)) . ")" : number_format($arus_kas_investasi_actual)) . '</td> <td> </td> <td align="right" style="border-bottom: 1px solid #000;">' . ($arus_kas_investasi_actual < 0 ? "(" . number_format(abs($arus_kas_investasi_actual)) . ")" : number_format($arus_kas_investasi_actual)) . '</td> <td align="right"><i>Net cash flow from investment activities</i></td> </tr>'; $laporan .= '<tr> <td align="left" ><br/><b>Arus Kas Dari Aktivitas Pendanaan</b></td> <td align="right"></td> <td> </td> <td align="right"></td> <td align="right"><br/><b><i>Cash Flow From Financing Operating</i></b></td> </tr>'; $laporan .= '<tr> <td align="left" >Penambahan (Pengurangan) Simpanan</td> <td align="right">' . ($penambahan_simpanan_actual < 0 ? "(" . number_format(abs($penambahan_simpanan_actual)) . ")" : number_format($penambahan_simpanan_actual)) . '</td> <td> </td> <td align="right">' . ($penambahan_simpanan_before < 0 ? "(" . number_format(abs($penambahan_simpanan_before)) . ")" : number_format($penambahan_simpanan_before)) . '</td> <td align="right"><i>Increase (Decrease) Savings</i></td> </tr>'; $laporan .= '<tr> <td align="left" >Penambahan (Pengurangan) Hibah</td> <td align="right">' . ($penambahan_hibah_actual < 0 ? "(" . number_format(abs($penambahan_hibah_actual)) . ")" : number_format($penambahan_hibah_actual)) . '</td> <td> </td> <td align="right">' . ($penambahan_hibah_before < 0 ? "(" . number_format(abs($penambahan_hibah_before)) . ")" : number_format($penambahan_hibah_before)) . '</td> <td align="right"><i>Increase (Decrease) Grants</i></td> </tr>'; $laporan .= '<tr> <td align="left" >Penambahan (Pengurangan) Modal Penyertaan</td> <td align="right" style="border-bottom: 1px solid #000;">' . ($penambahan_modal_actual < 0 ? "(" . number_format(abs($penambahan_modal_actual)) . ")" : number_format($penambahan_modal_actual)) . '</td> <td> </td> <td align="right" style="border-bottom: 1px solid #000;">' . ($penambahan_modal_before < 0 ? "(" . number_format(abs($penambahan_modal_before)) . ")" : number_format($penambahan_modal_before)) . '</td> <td align="right"><i>Increase (Decrease) Capital Participations</i></td> </tr>'; $laporan .= '<tr> <td align="left" >Arus kas bersih dari aktivitas pendanaan</td> <td align="right" style="border-bottom: 1px solid #000;">' . ($arus_kas_pendanaan_actual < 0 ? "(" . number_format(abs($arus_kas_pendanaan_actual)) . ")" : number_format($arus_kas_pendanaan_actual)) . '</td> <td> </td> <td align="right" style="border-bottom: 1px solid #000;">' . ($arus_kas_pendanaan_before < 0 ? "(" . number_format(abs($arus_kas_pendanaan_before)) . ")" : number_format($arus_kas_pendanaan_before)) . '</td> <td align="right"><i>Net cash flow from investment financing</i></td> </tr>'; $laporan .= '<tr> <td align="left" ><br/><b>Kenaikan (penurunan) bersih kas dan setara kas</b></td> <td align="right">' . ($selisih_kas_actual < 0 ? "(" . number_format(abs($selisih_kas_actual)) . ")" : number_format($selisih_kas_actual)) . '</td> <td> </td> <td align="right">' . ($selisih_kas_before < 0 ? "(" . number_format(abs($selisih_kas_before)) . ")" : number_format($selisih_kas_before)) . '</td> <td align="right"><br/><b><i>Net increase (decrease) in cash and cash equivalent</i></b></td> </tr>'; $laporan .= '<tr> <td align="left" ><br/><b>Kas dan setara kas awal tahun</b></td> <td align="right" style="border-bottom: 1px solid #000;">' . ($kas_awal_tahun_actual < 0 ? "(" . number_format(abs($kas_awal_tahun_actual)) . ")" : number_format($kas_awal_tahun_actual)) . '</td> <td> </td> <td align="right" style="border-bottom: 1px solid #000;">' . ($kas_awal_tahun_before < 0 ? "(" . number_format(abs($kas_awal_tahun_before)) . ")" : number_format($kas_awal_tahun_before)) . '</td> <td align="right"><br/><b><i>Cash and cash equivalent at beginning of year</i></b></td> </tr>'; $laporan .= '<tr> <td align="left" ><br/><b>Kas dan setara kas akhir tahun</b></td> <td align="right" style="border-bottom: 2px solid #000;">' . ($kas_akhir_tahun_actual < 0 ? "(" . number_format(abs($kas_akhir_tahun_actual)) . ")" : number_format($kas_akhir_tahun_actual)) . '</td> <td> </td> <td align="right" style="border-bottom: 2px solid #000;">' . ($kas_akhir_tahun_before < 0 ? "(" . number_format(abs($kas_akhir_tahun_before)) . ")" : number_format($kas_akhir_tahun_before)) . '</td> <td align="right"><br/><b><i>Cash and cash equivalent at end of year</i></b></td> </tr>'; $laporan .= '</table>'; $html .= $laporan; $this->load->library('mpdf'); $mpdf = new mPDF('utf-8', 'A4-L'); $mpdf->SetHeader("Amartha Microfinance" . '||' . $tgl . '|'); $mpdf->SetFooter("Laporan Arus Kas" . '||{PAGENO}|'); $mpdf->WriteHTML($html); //echo $html; //$this->mpdf->Output(); $pdfFilePath = FCPATH . "downloads/aruskas/{$filename}.pdf"; $pdffile = base_url() . "downloads/aruskas/{$filename}.pdf"; $mpdf->Output($pdfFilePath, 'F'); redirect($pdffile, 'refresh'); } else { //If no session, redirect to login page redirect('login', 'refresh'); } }
$mpdf = new mPDF('c'); $mpdf->mirrorMargins = 1; // Use different Odd/Even headers and footers and mirror margins $mpdf->defaultheaderfontsize = 10; /* in pts */ $mpdf->defaultheaderfontstyle = B; /* blank, B, I, or BI */ $mpdf->defaultheaderline = 1; /* 1 to include line below header/above footer */ $mpdf->defaultfooterfontsize = 12; /* in pts */ $mpdf->defaultfooterfontstyle = B; /* blank, B, I, or BI */ $mpdf->defaultfooterline = 1; /* 1 to include line below header/above footer */ $mpdf->SetHeader('{DATE j-m-Y}|{PAGENO}/{nb}|My document'); $mpdf->SetFooter('{PAGENO}'); /* defines footer for Odd and Even Pages - placed at Outer margin */ $mpdf->SetFooter(array('L' => array('content' => 'Text to go on the left', 'font-family' => 'sans-serif', 'font-style' => 'B', 'font-size' => '10'), 'C' => array('content' => '- {PAGENO} -', 'font-family' => 'serif', 'font-style' => 'BI', 'font-size' => '18'), 'R' => array('content' => 'Printed @ {DATE j-m-Y H:m}', 'font-family' => 'monospace', 'font-style' => '', 'font-size' => '10'), 'line' => 1), 'E'); $html = ' <h1>mPDF</h1> <h2>Headers & Footers Method 1</h2> <h3>Odd / Right page</h3> <p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p> <pagebreak /> <h3>Even / Left page</h3> <p>Nulla felis erat, imperdiet eu, ullamcorper non, nonummy quis, elit. Suspendisse potenti. Ut a eros at ligula vehicula pretium. Maecenas feugiat pede vel risus. Nulla et lectus. Fusce eleifend neque sit amet erat. Integer consectetuer nulla non orci. Morbi feugiat pulvinar dolor. Cras odio. Donec mattis, nisi id euismod auctor, neque metus pellentesque risus, at eleifend lacus sapien et risus. Phasellus metus. Phasellus feugiat, lectus ac aliquam molestie, leo lacus tincidunt turpis, vel aliquam quam odio et sapien. Mauris ante pede, auctor ac, suscipit quis, malesuada sed, nulla. Integer sit amet odio sit amet lectus luctus euismod. Donec et nulla. Sed quis orci. </p> '; $mpdf->WriteHTML($html); $mpdf->Output(); exit;
public function createPDF($id) { $model = $this->loadModel($id); $stylesheet = file_get_contents('C:\\xampp\\htdocs\\Gineobs\\themes\\hebo\\css\\pdfMain.css'); $texto = '<div id=contenedor>'; $texto = $texto . '<div id=columna1>'; $texto = $texto . '<H1 class="h1PDF"> Dra. Maria C. Hernandez N.</H1>'; $texto = $texto . '<H1 class="h1PDF"> Ginecologo-Obstetra.</H1>'; $texto = $texto . '<H1 class="h1PDF"> C.C. Galeno Center Of. C8 Av. Country Club. Bna.</H1>'; $texto = $texto . '<H1 class="h1PDF"> Telf. 0281-2743367/0414-8240064. CM972.</H1>'; $texto = $texto . '<H1 class="h1PDF"> Rif: 3956719-5 MSAS 18083.</H1>'; $texto = $texto . '</div>'; $texto = $texto . '<div id=columna2>'; $texto = $texto . '<H1 class="h1PDF"> Dra. Maria C. Hernandez N.</H1>'; $texto = $texto . '<H1 class="h1PDF"> Ginecologo-Obstetra.</H1>'; $texto = $texto . '<H1 class="h1PDF"> C.C. Galeno Center Of. C8 Av. Country Club. Bna.</H1>'; $texto = $texto . '<H1 class="h1PDF"> Telf. 0281-2743367/0414-8240064. CM972.</H1>'; $texto = $texto . '<H1 class="h1PDF"> Rif: 3956719-5 MSAS 18083.</H1>'; $texto = $texto . '</div>'; $texto = $texto . '<div id=columna1>'; $texto = $texto . '<p>Medicina: ' . $this->visualizarArreglo($model->recipeMedicinas, 'nombre') . '</p>'; $texto = $texto . '<p>Indicaciones: ' . $model->indicaciones . ' </p>'; $texto = $texto . '<p>Paciente: ' . Paciente::GET_NOMBRE_COMPLETO_PK($model->paciente_id) . ' </p>'; $texto = $texto . '<p>Fecha de creacion: ' . $model->fecha . ' </p>'; $texto = $texto . '</div>'; $texto = $texto . '</div>'; /* $mpdf->writeHTML( $this->render('create',null ,true) );*/ //Propiedades del header y footer // $mpdf->defaultheaderfontsize=10; // $mpdf->defaultheaderfontstyle='B'; // $mpdf->defaultheaderline=0; // $mpdf->defaultfooterfontsize=10; // $mpdf->defaultfooterfontstyle='BI'; // $mpdf->defaultfooterline=0; //configurando pdf general $mpdf = new mPDF('utf-8', 'Letter-L'); //agregando header y footer $mpdf->SetHeader('{DATE j-m-Y}||Recipe #' . $model->id); $mpdf->SetFooter('Dr. María Hernández|Ginecologia y obstetricia|{PAGENO}'); //Propiedades del PDF $mpdf->setTitle("Recipe Medico"); $mpdf->setAuthor("María Hernández"); $mpdf->setCreator("Edgar Cardona y Gabriela Soto"); $mpdf->setSubject("Recipe medico para tratamiento de pacientes."); $mpdf->setKeywords("Recipe,Medico"); //escribiendo CSS $mpdf->WriteHTML($stylesheet, 1); //Escribiendo PDF $mpdf->writeHTML($texto, 2); //Salida $mpdf->output("Recipe Medico", EYiiPdf::OUTPUT_TO_BROWSER); }