/** @Functions que permiten generar PDF's con reportes /**************************************************************************/ public function reporte_medicamentos() { // Carga de datos $data_meds = $this->gestion->get_medicamentos(); $tmp_meds = $this->templates->tmp_reporte_medicamentos($data_meds); // Generacion de PDF $pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Sysmedcloud'); $pdf->SetTitle('Reporte de Medicamentos'); $pdf->SetSubject(''); $pdf->SetKeywords(''); $pdf->SetHeaderData('logo.png', PDF_HEADER_LOGO_WIDTH + 20, 'Reporte', 'Medicamentos', array(0, 64, 255), array(0, 64, 128)); $pdf->setFooterData($tc = array(0, 64, 0), $lc = array(0, 64, 128)); $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setFontSubsetting(true); $pdf->SetFont('Helvetica', '', 8, '', true); $pdf->AddPage(); $pdf->writeHTML($tmp_meds, true, 0, true, 0); $nombre_archivo = utf8_decode("reporte-medicamentos-" . date("d") . "_" . date("m") . "_" . date("Y") . ".pdf"); $pdf->Output($nombre_archivo, 'I'); }
public function GeneraPdf($html, $nombre) { $pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor(''); $pdf->SetTitle(''); $pdf->SetSubject(''); $pdf->SetKeywords(''); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . '', PDF_HEADER_STRING, array(255, 255, 255), array(255, 255, 255)); $pdf->SetFooterData($tc = array(0, 64, 0), $lc = array(255, 255, 255)); $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setFontSubsetting(true); $pdf->SetFont('helvetica', '', 10, '', true); $pdf->AddPage(); $pdf->writeHTML($html, true, false, true, false, ''); $nombre_archivo = utf8_decode($nombre . date('Y-m-d-His') . ".pdf"); $pdf->Output($nombre_archivo, 'I'); }
public function imprimir_detalle() { $data['id'] = $this->input->post('id'); $data['cliente'] = $this->clientes->buscar_cliente_detalle($data); $data['orden'] = $this->clientes->buscar_orden_detalle($data); $html = $this->load->view('pdf/detalle_cliente', $data, true); ///////////// $this->load->library('Pdf'); $pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->SetTitle('Titulo Generación de Etiqueta'); $pdf->SetSubject('Subtitulo'); $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setFontSubsetting(true); $pdf->SetFont('freemono', '', 14, '', true); $pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 1, 'blend_mode' => 'Normal')); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetMargins(10, 10, 10); $pdf->SetAutoPageBreak(true, -10); $pdf->AddPage('P', array(215.9, 279.4)); //en mm 21.59cm por 27.94cm $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true); $nombre_archivo = utf8_decode("informe" . ".pdf"); $pdf->Output($nombre_archivo, 'I'); }
public function generar_turno($numero, $cita) { $data['numero'] = base64_decode($numero); $data['cita'] = base64_decode($cita); $this->load->library('Pdf'); $pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); //$pdf->SetAuthor('Osmel Calderón'); $pdf->SetTitle('Titulo Generación de Etiqueta'); $pdf->SetSubject('Subtitulo'); //$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // datos por defecto de cabecera, se pueden modificar en el archivo tcpdf_config_alt.php de libraries/config //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 001', PDF_HEADER_STRING, array(0, 64, 255), array(0, 64, 128)); //$pdf->setFooterData($tc = array(0, 64, 0), $lc = array(0, 64, 128)); // datos por defecto de cabecera, se pueden modificar en el archivo tcpdf_config.php de libraries/config $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // se pueden modificar en el archivo tcpdf_config.php de libraries/config $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //relación utilizada para ajustar la conversión de los píxeles $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // --------------------------------------------------------- // establecer el modo de fuente por defecto $pdf->setFontSubsetting(true); // Establecer el tipo de letra //Si tienes que imprimir carácteres ASCII estándar, puede utilizar las fuentes básicas como // Helvetica para reducir el tamaño del archivo. //$pdf->SetFont('freemono', '', 14, '', true); // Añadir una página // Este método tiene varias opciones, consulta la documentación para más información. // $pdf->AddPage(); //fijar efecto de sombra en el texto $pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 1, 'blend_mode' => 'Normal')); // Establecemos el contenido para imprimir //$provincia = $this->input->post('provincia'); //$data['id_movimiento']='29'; // remove default header/footer $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins //$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT, PDF_MARGIN_BOTTOM); // set margins $pdf->SetMargins(0, 0, 0); // set auto page breaks $pdf->SetAutoPageBreak(true, -10); $pdf->AddPage('P', array(100.0, 100.0)); //en mm //$pdf->AddPage(); //en mm $html = $this->load->view('pdfs/turno', $data, true); // Imprimimos el texto con writeHTMLCell() $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true); // --------------------------------------------------------- // Cerrar el documento PDF y preparamos la salida // Este método tiene varias opciones, consulte la documentación para más información. $nombre_archivo = utf8_decode($data['numero'] . ".pdf"); $pdf->Output($nombre_archivo, 'I'); }
public function create() { $this->load->library('Mpdf'); $html = "<b>Ví Dụ</b><br />Xuất file PDF"; $mpdf = new Pdf(); $mpdf->SetAutoFont(AUTOFONT_ALL); $mpdf->WriteHTML($html); $mpdf->Output("file/mpdf.pdf", 'I'); }
function index() { $this->load->library('Pdf'); $userdata = $this->session->all_userdata(); $data['email'] = $userdata['email']; $this->load->model('tenants_model'); $data['tenant_detail'] = $this->tenants_model->get_unit($data['email']); $pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false); $pdf->SetTitle('Rent Receipt'); $pdf->SetHeaderMargin(30); $pdf->SetTopMargin(20); $pdf->setFooterMargin(20); $pdf->SetAutoPageBreak(true); $pdf->SetAuthor('Rentit Agency'); $pdf->SetDisplayMode('real', 'default'); $pdf->AddPage(); $html = <<<EOD <table cellspacing="3" cellpadding="6" border=""> \t\t \t\t EOD; $pdf->Ln(); $html .= "<tr><td>"; $html .= "<b>RENTIT AGENCY<br />RENT RECEIPT</b>"; $html .= "</td><td>"; $this->load->helper('date'); $datestring = "%Y-%m-%d "; $date = mdate($datestring); $html .= "<b>Date Received: </b> {$date} <br />"; $html .= "<br /><b>Received From: </b> "; $html .= $userdata['email']; '<br />'; $html .= "<br /><br/><b>The sum of: </b> KeS "; $html .= $userdata['amount']; '<br />'; $html .= "</td></tr>"; $html .= "<tr><td colspan=2>"; $html .= "<b>For Rent at:</b> "; $html .= $data['tenant_detail'][0]['block_name']; $html .= " house, "; $html .= $data['tenant_detail'][0]['unitname']; ','; $html .= "<br /><br /><b>Rent Period Starting</b>: "; $html .= $data['tenant_detail'][0]['occupation_date']; ',<br />'; $html .= "<br /><br /><b>Received by: </b> Rentit Agency"; $html .= "</td></tr>"; $html .= "</table>"; $pdf->writeHTML($html, true, false, false, false, ''); ob_clean(); $pdf->Output('Receipt.pdf', 'I'); }
function ImprimirPdf($pedido) { $total = 0; foreach ($pedido as $idx => $p) { $pdf = new Pdf(); $pdf->AddPage(); $pdf->SetFont('Arial', 'B', 14); $pdf->Cell(40, 7, "Pedido: " . $pedido[$idx]['codigo_pedido'], 0); $pdf->Cell(70, 7, "Estado: " . $pedido[$idx]['Estado'], 0); $pdf->Cell(70, 7, "Fecha: " . $pedido[$idx]['fecha'], 0); $pdf->Ln(); $pdf->Ln(); $pdf->Ln(); $pdf->Cell(70, 7, "Nombre del producto", 1); $pdf->Cell(26, 7, "Cantidad", 1); $pdf->Cell(40, 7, "Precio", 1); $pdf->Ln(); foreach ($pedido[$idx]['lineas'] as $linea) { $pdf->Cell(70, 7, $linea['Nombre'], 1); $pdf->Cell(26, 7, $linea['Cantidad'], 1); $pdf->Cell(40, 7, $linea['Precio'] . iconv('UTF-8', 'windows-1252', '€'), 1); $pdf->Ln(); $total = $total + $linea['Precio']; } $pdf->Ln(); $pdf->Ln(); $pdf->Cell(100, 7, "Total del pedido: " . $total . iconv('UTF-8', 'windows-1252', '€'), 1); $pdf->Ln(); $pdf->Ln(); $pdf->Ln(); $pdf->Cell(100, 7, "* Impuestos y descuento aplicados ", 0); // diferenciamos si va para mostrar en navegador o para guardar en local y posteriormente enviar por correo. if (isset($_SESSION['Fin_Compra'])) { $pdf->Output('F', 'asset/pedidos/pedido_' . $pedido[$idx]['codigo_pedido'] . ".pdf", true); } else { $pdf->Output('I', 'pedido : ' . $pedido[$idx]['codigo_pedido']); } } }
public function index() { if (strlen($this->getParam()) == 0) { App::redirectUrl($this->registry->router->generate('frontend.home', true)); } $product = App::getModel('product/product')->getProductAndAttributesById((int) $this->registry->core->getParam()); $range = App::getModel('product/product')->getRangeType((int) $this->registry->core->getParam()); App::getModel('product/product')->getPhotos($product); if (empty($product)) { App::redirectUrl($this->registry->router->generate('frontend.home', true)); } $product['photo']['normal'][0] = 'design/' . str_replace(DESIGNPATH, '', $product['photo']['normal'][0]); $selectAttributes = App::getModel('product/product')->getProductAttributeGroups($product); $attset = App::getModel('product/product')->getProductVariant($product); $this->registry->template->assign('product', $product); $this->registry->template->assign('attributes', $selectAttributes); $this->registry->template->assign('attset', $attset); $this->registry->template->assign('ROOTPATH', ROOTPATH); $htmlcontent = $this->registry->template->fetch($this->loadTemplate('index.tpl')); $pdf = new Pdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true); $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Gekosale'); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setLanguageArray(1); $pdf->SetFont('dejavusans', '', 10); $pdf->AddPage(); $pdf->writeHTML($htmlcontent, true, 0, true, 0); @ob_clean(); $pdf->Output($product['seo'], 'D'); }
function tiparire($fromDate, $toDate) { $this->load->model('cerere_model'); $filtru = array('fromDate' => $fromDate, 'toDate' => $toDate); $cereri = $this->cerere_model->getCereriAll($filtru); $this->load->library('Pdf'); $pdf = new Pdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->SetTitle('Cereri'); $pdf->SetTopMargin(5); $pdf->setFooterMargin(5); $pdf->SetAutoPageBreak(true); $pdf->SetAuthor('poartacerului.ro'); $pdf->SetDisplayMode('real', 'default'); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $output = "<strong>Cereri rugaciune din data {$fromDate} in data {$toDate}</strong>"; foreach ($cereri as $cerere) { $output .= "<br /><br />Nume: " . $cerere['nume'] . ", Localitate: " . $cerere['localitate'] . ", Data: " . $cerere['data']; $output .= "<br />Continut: " . $cerere['continut']; } $pdf->PrintChapter($output, true); $pdf->Output('cereri-rugaciune.pdf', 'I'); }
public function reporteEstatusPdf() { $pdf = new Pdf('L', 'mm', 'A4', true, 'UTF-8', false); $pdf->setPageOrientation('p'); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetMargins(PDF_MARGIN_LEFT, 15, PDF_MARGIN_RIGHT); //$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setFontSubsetting(true); $pdf->SetFont('times', '', 12, '', true); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->AddPage(); $html = null; $reporteEstatus = $this->reporteticket_model->reporteEstatusPDF(); if ($reporteEstatus) { $pdf->Image("imagen/logo/logoborde.png", $x = 5, $y = 5, $w = 70, $h = 40, $type = '', $link = '', $align = 'right', $resize = false, $dpi = 300, $palign = '', $ismask = false, $imgmask = false, $border = 0, $fitbox = false, $hidden = false, $fitonpage = false, $alt = false, $altimgs = array()); $pdf->Text(120, 15, "República Bolivariana de Venezuela", $fstroke = false, $fclip = false, $ffill = true, $border = 0, $ln = 0, $align = 'left', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M', $rtloff = false); $pdf->Text(120, 20, "Gobernación del Estado Lara", $fstroke = false, $fclip = false, $ffill = true, $border = 0, $ln = 0, $align = 'left', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M', $rtloff = false); $pdf->Text(120, 25, "Oficina de Atención al Ciudadano.", $fstroke = false, $fclip = false, $ffill = true, $border = 0, $ln = 0, $align = 'left', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M', $rtloff = false); $pdf->SetFont('Times', 'B', 12); $pdf->Text(60, 50, 'Reporte estadistico del estatus de los Ticket registrados.'); foreach ($reporteEstatus->result_array() as $fila) { $arregloDatos[] = array('estatus' => $fila['estatus'], 'contador' => $fila['contador']); } $pdf->Ln(10); $pdf->SetFillColor('150', '210', '255'); $pdf->Cell(0, 0, 'Cuadro Resumen', 1, 1, 'C', 1); $pdf->Cell(75, 0, 'Tipo ticket', 1, 0, 'C', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $pdf->Cell(75, 0, 'Sector relacionado', 1, 0, 'C', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $pdf->Cell(30, 0, 'Cantidad', 1, 1, 'C', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $reporteCuadro = $this->reporteticket_model->reporteEstatusCuadroPDF(); foreach ($reporteCuadro as $fila2) { $pdf->Cell(75, 0, $fila2->tipo, 1, 0, 'C', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $pdf->Cell(75, 0, $fila2->sector, 1, 0, 'C', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $pdf->Cell(30, 0, $fila2->cantidad, 1, 1, 'C', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $total = $fila2->total; } $pdf->Cell(150, 0, 'Total de ticket', 1, 0, 'R', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $pdf->Cell(30, 0, $total, 1, 1, 'C', 1); $pdf->Ln(10); $pdf->graficoPDF($arregloDatos, 'Grafico', array(60, '', 90, 100), ''); } else { $pdf->SetFont('Times', 'B', 18); $pdf->Text(14, 40, 'No se encuentra información con las características indicadas.'); } $nombre_archivo = utf8_decode("listado.pdf"); $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'C', $autopadding = true); $pdf->Output($nombre_archivo, 'I'); }
public function generarListadogeneneral() { $nombre = $this->input->get("nombre") != '' ? "LIKE '%" . $this->input->get("nombre") . "%'" : 'LIKE "%"'; $apellido = $this->input->get("apellido") != '' ? "LIKE '%" . $this->input->get("apellido") . "%'" : 'LIKE "%"'; $pdf = new Pdf('l', 'mm', 'A4', true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->SetSubject('Tutorial TCPDF'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // $pdf->SetHeaderData(PDF_HEADER_LOGO,PDF_HEADER_LOGO_WIDTH,PDF_HEADER_TITLE,PDF_HEADER_STRING,array(0,64,255),array(0,64, 128)); $pdf->setFooterData($tc = array(0, 64, 0), $lc = array(0, 64, 128)); // datos por defecto de cabecera, se pueden modificar en el archivo tcpdf_config.php de libraries/config // $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH,'Listado General',PDF_HEADER_STRING,array(0,64,255), array(0,64,128)); $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $pdf->SetPageOrientation('p'); // se pueden modificar en el archivo tcpdf_config.php de libraries/config $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // se pueden modificar en el archivo tcpdf_config.php de libraries/config $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // se pueden modificar en el archivo tcpdf_config.php de libraries/config $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //relación utilizada para ajustar la conversión de los píxeles $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // establecer el modo de fuente por defecto $pdf->setFontSubsetting(true); $pdf->SetFont('times', '', 9, '', true); $pdf->AddPage(); $html = null; $nombre_archivo = null; // Establecemos el contenido para imprimir $resultado = $this->ReporteGeneral_model->getlistadogeneral($nombre, $apellido); if ($resultado) { $html = ''; $html .= "<style type=text/css>"; $html .= "th{color: #fff; font-weight: bold; background-color: #0B615E; align=center}"; $html .= "td{background-color: #fff; color: #222; align=center}"; $html .= "</style>"; $html .= "<h2>Listado General de las Personas con Permisos</h2>"; $html .= "<table width='100%' border='1' cellpadding='0' cellspacing='0' >"; $html .= "<tr>\r\n <th><em>Fecha del Permiso</em></th>\r\n <th><em>Cédula</em></th>\r\n <th><em>Nombres</em></th>\r\n <th><em>Cantidad de salidas</em></th>\r\n <th><em>Departamento</em></th>\r\n <th><em>Motivo</em></th>\r\n </tr>"; foreach ($resultado as $fila) { $html .= '<tr> <td>' . mb_convert_case($fila["fechaautorizacion"], MB_CASE_TITLE, "UTF-8") . '</td> <td>' . mb_convert_case($fila["cedula"], MB_CASE_TITLE, "UTF-8") . '</td> <td>' . mb_convert_case($fila["nombre"], MB_CASE_TITLE, "UTF-8") . ' ' . mb_convert_case($fila["apellido"], MB_CASE_TITLE, "UTF-8") . '</td> <td>' . mb_convert_case($fila["contsalida"], MB_CASE_TITLE, "UTF-8") . '</td> <td>' . mb_convert_case($fila["departamento"], MB_CASE_TITLE, "UTF-8") . '</td> <td>' . mb_convert_case($fila["motivo"], MB_CASE_TITLE, "UTF-8") . '</td> </tr> <hr>'; } $html .= "</table>"; $cantidad = count($resultado); if ($cantidad > 1) { $html .= "<h4>Actualmente: " . count($resultado) . " empleados con permisos</h4>"; } else { $html .= "<h4>Actualmente: " . count($resultado) . " empleados con permisos</h4>"; } $nombre_archivo = utf8_decode("Listado General.pdf"); } else { $html = ''; $html .= "<style type=text/css>"; $html .= "th{color: #fff; font-weight: bold; background-color: #AAC7E3}"; $html .= "td{background-color: #fff; color: #222}"; $html .= "</style>"; $html .= "<h4>Listado General de las Personas con Permisos</h4>"; $html .= "<table width='100%'>"; $html .= "<tr><th>No hay empleados de permiso con las características indicadas</th></tr>"; $html .= "</table>"; $nombre_archivo = utf8_decode("Listado General " . $nombre . ".pdf"); } $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'C', $autopadding = true); $pdf->Output($nombre_archivo, 'I'); }
public function generarSalidaEmpleados() { $nacionalidad = $this->input->get("nacionalidad") != '' ? "LIKE '%" . $this->input->get("nacionalidad") . "%'" : 'LIKE "%"'; $cedula = $this->input->get("cedula") != '' ? '=' . $this->input->get("cedula") : 'LIKE "%"'; $nombre = $this->input->get("nombre") != '' ? "LIKE '%" . $this->input->get("nombre") . "%'" : 'LIKE "%"'; $apellido = $this->input->get("apellido") != '' ? "LIKE '%" . $this->input->get("apellido") . "%'" : 'LIKE "%"'; $pdf = new Pdf('p', 'mm', 'A4', true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->SetSubject('Tutorial TCPDF'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // $pdf->SetHeaderData(PDF_HEADER_LOGO,PDF_HEADER_LOGO_WIDTH,PDF_HEADER_TITLE,PDF_HEADER_STRING,array(0,64,255),array(0,64, 128)); $pdf->setFooterData($tc = array(0, 64, 0), $lc = array(0, 64, 128)); // datos por defecto de cabecera, se pueden modificar en el archivo tcpdf_config.php de libraries/config // $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH,'Listado General',PDF_HEADER_STRING,array(0,64,255), array(0,64,128)); $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $pdf->SetPageOrientation('l'); // se pueden modificar en el archivo tcpdf_config.php de libraries/config $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // se pueden modificar en el archivo tcpdf_config.php de libraries/config $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // se pueden modificar en el archivo tcpdf_config.php de libraries/config $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //relación utilizada para ajustar la conversión de los píxeles $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // establecer el modo de fuente por defecto $pdf->setFontSubsetting(true); $pdf->SetFont('times', '', 10, '', true); $pdf->AddPage(); $pdf->Cell(44, 0, 'Cédula', 1, 0, 'C', 0, '', 0); $pdf->Cell(90, 0, 'Nombres y Apellidos', 1, 0, 'C', 0, '', 1); $pdf->Cell(44, 0, 'Sexo', 1, 0, 'C', 0, '', 1); $pdf->Cell(44, 0, 'Edo. Civil', 1, 0, 'C', 0, '', 1); $pdf->Cell(44, 0, 'Posee Partida', 1, 1, 'C', 0, '', 1); $pdf->Ln(5); $pdf->Cell(44, 0, 'Teléfono Móvil ', 1, 0, 'C', 0, '', 0); $pdf->Cell(90, 0, 'Municipio', 1, 0, 'C', 0, '', 1); $pdf->Cell(88, 0, 'Parroquia', 1, 0, 'C', 0, '', 1); $pdf->Cell(44, 0, 'Fecha Nac.', 1, 1, 'C', 0, '', 1); $pdf->Ln(5); $pdf->Cell(44, 0, 'Teléfono Local', 1, 0, 'C', 0, '', 0); $pdf->Cell(178, 0, 'Dirección', 1, 0, 'C', 0, '', 1); $pdf->Cell(44, 0, 'Edad', 1, 1, 'C', 0, '', 1); $pdf->Ln(5); $pdf->Cell(44, 0, 'CI Responsable', 1, 0, 'C', 0, '', 0); $pdf->Cell(90, 0, 'Nombres y Apellidos del Responsable', 1, 0, 'C', 0, '', 1); $pdf->Cell(130, 0, 'Dirección', 1, 0, 'C', 0, '', 1); // <td><b>CI Responsable</b></td> // <td colspan="2"><b>Nombres y Apellidos del Responsable</b></td> // <td colspan="3"><b>Dirección</b></td> // <td><b>Tipo Vivienda</b></td> // <td><b>Tenencia Vivienda</b></td> // <td><b>Parentesco</b></td> // <td><b>Padres Vivos</b></td> // <td> // <b>Nro. Personas</b> // </td> // <td><b>Convive con el Discapacitado</b></td> // <td><br><b>Condición/Discapacidad</b></td> // <td><br><b>Tipo Discapacidad</b></td> // <td colspan="2"><br><b>Diagnóstico Tipo Discapacidad</b></td> // <td><br><b>Certificado Informe Médico</b></td> // <td><br><b>Estatus</b></td> // <td><b>Requiere Medicamento</b></td> // <td colspan="2"><br><b>Nombre de los Medicamentos</b></td> // <td><br><b>Requiere Ayuda</b></td> // <td colspan="2"><br><b>Nombre de la Ayuda</b></td> // <td ><b>Grado de instrucción</b></td> // <td colspan="2"><b>Deseo de continuar Estudiando</b></td> // <td colspan="2"><b>Condiciones para seguir Estudiando</b></td> // <td><b>Limitación de Estudio</b></td> // --------------------------------------------------------- //Close and output PDF document $pdf->Output('example_004.pdf', 'I'); }
function generar() { $this->load->library('Pdf'); $pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Cony Jaramillo'); $pdf->SetTitle('Combrobante'); $pdf->SetSubject('Registro Coordinadores y Promotores'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); ob_start(); // datos por defecto de cabecera, se pueden modificar en el archivo tcpdf_config_alt.php de libraries/config $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING, array(0, 64, 255), array(0, 1, 0)); $pdf->setFooterData($tc = array(0, 64, 0), $lc = array(0, 64, 128)); // datos por defecto de cabecera, se pueden modificar en el archivo tcpdf_config.php de libraries/config $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // se pueden modificar en el archivo tcpdf_config.php de libraries/config $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // se pueden modificar en el archivo tcpdf_config.php de libraries/config $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); //$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // se pueden modificar en el archivo tcpdf_config.php de libraries/config $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //relación utilizada para ajustar la conversión de los píxeles $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // --------------------------------------------------------- // establecer el modo de fuente por defecto $pdf->setFontSubsetting(true); // Establecer el tipo de letra $pdf->SetFont('helvetica', '', 14, '', true); // Añadir una página // Este método tiene varias opciones, consulta la documentación para más información. $pdf->AddPage(); //fijar efecto de sombra en el texto $pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(255, 255, 255), 'opacity' => 1, 'blend_mode' => 'Normal')); // Establecemos el contenido para imprimir $data['nombre'] = $this->input->post('nombre'); $data['folio'] = $this->input->post('folio'); $data['correo'] = $this->input->post('correo'); $data['fecha'] = $this->input->post('fecha'); $data['plantel'] = $this->input->post('plantel'); $data['institucion'] = $this->input->post('institucion'); $data['tipo_registro'] = $this->input->post('tipo_registro'); $matricula = $this->input->post('matricula'); //preparamos y maquetamos el contenido a crear $html = ""; $html .= "<style type=text/css>"; $html .= " h1 {\n\t\t\t\t\t \n\t\t\t\t\t width: 100%;\n\t\t\t\t\t font-weight: bold;\n\t\t\t\t\t font-size: 13;\n\t\t\t\t\t line-height: 2;\n\t\t\t\t\t text-align: center;\n\t\t\t\t\t color: #070005;\n\t\t\t\t\t}\n \t\t\th2{\n \t\t\t\t\ttext-align: justify;\n \t\t\t\t\tfont-weight: bold;\n\t\t\t\t\t\tfont-size: 9;\n\t\t\t\t\t\tline-height: 1.5;\n \t\t\t\t\tcolor: #070005;\n \t\t\t\t}\n \t\t\th3{\n \t\t\t\tline-height: 3;\n \t\t\t\ttext-align: center;\n \t\t\t\tfont-weight: normal;\n \t\t\t\tfont-size: 9;\n \t\t\t\t}\n\t\t\t\t\th4{\n \t\t\t\t\ttext-align: center;\n \t\t\t\t\tfont-weight: bold;\n\t\t\t\t\t\tfont-size: 10;\n\t\t\t\t\t\tline-height: 1;\n \t\t\t\t\tcolor: #070005;\n\t\t\t\t}\n \t\t\t\n \t\t\th5{\n \t\t\t\t\ttext-align: justify;\n \t\t\t\t\tfont-weight: bold;\n\t\t\t\t\t\tfont-size: 10;\n\t\t\t\t\t\tline-height: 4;\n \t\t\t\t\tcolor: #070005;\n\t\t\t\t}\n \t\t\tp {\n \t\t\t \tline-height: 1.5;\n \t\t\t\tcolor: #5E5D5D;\n \t\t\t\tfont-weight: bold;\n\t\t\t\t text-align: justify;\n\t\t\t\t\t\n \t\t\t\tfont-size: 9;\n \t\t\t\t\n\t\t\t\t}\n \t\t\t\t\n \t\t\t\n\t\t\t"; $html .= "</style>"; $html .= '<h1>COMPROBANTE DE REGISTRO COMO ' . $data['tipo_registro'] . '<br> DEL PROGRAMA PREPA SÍ</h1>'; $html .= "<p><h5>" . $data['nombre'] . "</h5></p>"; $html .= '<table border="0"> <tr> <td><h2>FECHA DE REGISTRO</h2></td> <td colspan="2"><p>' . $data['fecha'] . '</p></td> </tr> <tr> <td><h2>INSTITUCION</h2></td> <td colspan="2"><p>' . $data['institucion'] . '</p></td> </tr> <tr> <td><h2>PLANTEL</h2></td> <td colspan="2"><p>' . $data['plantel'] . '</p></td> </tr> <tr> <td colspan="3"><h4></h4></td> </tr> <tr> <td colspan="3" bgcolor="#FBEFFB"><h4>FOLIO: ' . $data['folio'] . '</h4></td> </tr> </table>'; $html .= "<br><br><br><br><br><h3>Has quedado registrado, te sugerimos estar al pendiente de tu correo: <br> <u>" . $data['correo'] . "</u></h3>"; // Imprimimos el texto con writeHTMLCell() $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true); $estilo = array('padding' => 'auto'); $tipos = array('C128A'); for ($i = 0; $i < sizeof($tipos); $i++) { $pdf->SetXY(78, 110); $pdf->Cell(45, 50, $matricula, 0, 0, 'C'); $pdf->write1DBarcode($matricula, $tipos[$i], 75, 115, 50, 14, '', $estilo); } // --------------------------------------------------------- // Cerrar el documento PDF y preparamos la salida // Este método tiene varias opciones, consulte la documentación para más información. $nombre_archivo = utf8_decode("Registro_" . $data['folio'] . ".pdf"); $pdf->Output($nombre_archivo, 'I'); ob_end_flush(); }
function export_pdf39() { $this->load->library('pdf'); ob_clean(); $pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false); $tbl = ''; $tbl .= ' <h3><u>MASTER DIAGNOSA</u></h3> <table border="0" cellpadding="0" cellspacing="0" > <tr >'; $tbl .= '<th align="center" bgcolor="#359AFF" width="30" >NO</th>'; $tbl .= '<th valign="middle" bgcolor="#359AFF" width="100" >DIAG_KODE</th>'; $tbl .= '<th valign="middle" bgcolor="#359AFF" width="230" >DIAG_NAMA</th>'; $tbl .= '<th valign="middle" bgcolor="#359AFF" width="80" >ST_DIAG</th>'; $tbl .= '</tr>'; $sql = "select diag_kode, diag_nama, diag_level,case when diag_aktif=1 then 'aktif' else 'tidak aktif' end \nas st_diag, diag_aktif,diag_id from billing.b_ms_diagnosa"; $data = $this->m_global->grid_view($sql)->result_array(); $no = 1; foreach ($data as $row) { $bg = $no % 2; if ($bg == 0) { $bg = ' bgcolor="#E1F0FF" '; } else { $bg = ' bgcolor="#FFFFFF" '; } $tbl .= ' <tr> <td ' . $bg . ' align="center" width="30">' . $no . '</td>'; $tbl .= '<td ' . $bg . ' width="100" >' . $row['diag_kode'] . '</td>'; $tbl .= '<td ' . $bg . ' width="230" >' . $row['diag_nama'] . '</td>'; $tbl .= '<td ' . $bg . ' width="80" >' . $row['st_diag'] . '</td>'; $tbl .= '</tr>'; $no++; } $tbl .= '</table>'; $pdf->AddPage(); $pdf->SetFont('helvetica', '', 8); $pdf->writeHTML($tbl, true, false, false, false, ''); $pdf->Output('example_048.pdf', 'I'); }
public function outputPdfFile($strReportName, $arrFields, $arrResults, $booOutputHtml = false) { $strHtml = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"><html><head><link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"includes/css/report.css\" /></head>"; $strHtml .= "<body><div>"; $strHtml .= "<table><tr><td>"; $strHtml .= "<h1>YouAudit Report</h1>"; $strHtml .= "<h2>" . $strReportName . "</h2>"; $strHtml .= "</td><td class=\"right\">"; $logo = 'logo.png'; if (isset($this->session->userdata['theme_design']->logo)) { $logo = $this->session->userdata['theme_design']->logo; } $strHtml .= "<img alt=\"ictracker\" src='brochure/logo/" . $logo . "'>"; $strHtml .= "</td></tr></table>"; $strHtml .= "<table class=\"report\">"; $strHtml .= "<thead >"; $strHtml .= "<tr style='background-color:#00AEEF'>"; foreach ($arrFields as $arrReportField) { $strHtml .= "<th style='color:white'>" . $arrReportField['strName'] . "</th>"; } $strHtml .= "</tr>"; $strHtml .= "</thead><tbody>"; $arrTotals = array(); foreach ($arrResults as $objItem) { $strHtml .= "<tr>"; $arrPageData['arrSessionData'] = $this->session->userdata; foreach ($arrFields as $arrReportField) { $strHtml .= "<td style='height:50px'>"; if (array_key_exists('strConversion', $arrReportField)) { switch ($arrReportField['strConversion']) { case 'compliance': if ($objItem['compliance'] == 1) { $strHtml .= 'YES'; } else { $strHtml .= "NO"; } break; case 'fleet': if ($objItem['fleet'] == 1) { $strHtml .= 'YES'; } else { $strHtml .= "NO"; } break; case 'condition_module': if ($objItem['condition_module'] == 1) { $strHtml .= 'YES'; } else { $strHtml .= "NO"; } break; case 'depereciation_module': if ($objItem['depereciation_module'] == 1) { $strHtml .= 'YES'; } else { $strHtml .= "NO"; } break; case 'reporting_module': if ($objItem['reporting_module'] == 1) { $strHtml .= 'YES'; } else { $strHtml .= "NO"; } break; case 'create_date': $strHtml .= date('d/m/Y', $objItem['create_date']); break; case 'owner': $owner = json_decode($objItem['owner']); if (!empty($owner)) { foreach ($owner as $val) { if ($val == '') { $strHtml .= "N/A"; $strHtml .= "<br>"; } else { $strHtml .= $val; $strHtml .= "<br>"; } } } else { $strHtml .= "N/A"; } break; case 'category': $category = json_decode($objItem['category']); if (!empty($category)) { foreach ($category as $cat) { if ($cat == '') { $strHtml .= "N/A"; $strHtml .= "<br>"; } else { $strHtml .= $cat; $strHtml .= "<br>"; } } } else { $strHtml .= 'N/A'; } break; case 'manu': $manu = json_decode($objItem['manu']); if (!empty($manu)) { foreach ($manu as $man) { if ($man == '') { $strHtml .= "N/A"; $strHtml .= "<br>"; } else { $strHtml .= $man; $strHtml .= "<br>"; } } } else { $strHtml .= "N/A"; } break; case 'manufacturer': $manufacturer = json_decode($objItem['manufacturer']); if (!empty($manufacturer)) { foreach ($manufacturer as $manufact) { if ($manufact == '') { $strHtml .= "N/A"; $strHtml .= "<br>"; } else { $strHtml .= $manufact; $strHtml .= "<br>"; } } } else { $strHtml .= "N/A"; } break; } } else { $strHtml .= $objItem[$arrReportField['strFieldReference']]; } if (array_key_exists('arrFooter', $arrReportField) && array_key_exists('booTotal', $arrReportField['arrFooter'])) { if (array_key_exists($arrReportField['strFieldReference'], $arrTotals)) { $arrTotals[$arrReportField['strFieldReference']] += $objItem[$arrReportField['strFieldReference']]; } else { $arrTotals[$arrReportField['strFieldReference']] = $objItem[$arrReportField['strFieldReference']]; } } $strHtml .= "</td>"; } $strHtml .= "</tr>"; } $strHtml .= "</tbody>"; $strHtml .= "<tfoot><tr>"; foreach ($arrFields as $arrReportField) { if (array_key_exists('arrFooter', $arrReportField)) { if (array_key_exists('booTotal', $arrReportField['arrFooter']) && $arrReportField['arrFooter']['booTotal']) { $strHtml .= "<td>"; if (array_key_exists('strConversion', $arrReportField) && ($arrReportField['strConversion'] == "price")) { $strHtml .= $currency; } $strHtml .= $arrTotals[$arrReportField['strFieldReference']]; $strHtml .= "</td>"; } else { if (array_key_exists('booTotalLabel', $arrReportField['arrFooter']) && $arrReportField['arrFooter']['booTotalLabel']) { $strHtml .= "<td"; if (array_key_exists('intColSpan', $arrReportField['arrFooter']) && ($arrReportField['arrFooter']['intColSpan'] > 0)) { $strHtml .= " colspan=\"" . $arrReportField['arrFooter']['intColSpan'] . "\""; } $strHtml .= " class=\"right\">"; $strHtml .= "Totals</td>"; } } } } $strHtml .= "</tr></tfoot>"; $strHtml .= "</table>"; if (($arrPageData['arrSessionData']["objAdminUser"])) { $strHtml .= "<p>Produced by " . $arrPageData['arrSessionData']["objAdminUser"]->firstname . " " . $arrPageData['arrSessionData']["objAdminUser"]->lastname . " (" . $arrPageData['arrSessionData']["objAdminUser"]->username . ") on " . date('d/m/Y') . "</p>"; $strHtml .= "</div></body></html>"; } else { $strHtml .= "<p>Produced by " . $arrPageData['arrSessionData']['YouAuditSystemAdmin']['firstname'] . " " . $arrPageData['arrSessionData']['YouAuditSystemAdmin']['lastname'] . " (" . $arrPageData['arrSessionData']['YouAuditSystemAdmin']['username'] . ") on " . date('d/m/Y') . "</p>"; $strHtml .= "</div></body></html>"; } if (!$booOutputHtml) { $this->load->library('Mpdf'); $mpdf = new Pdf('en-GB', 'A4'); $mpdf->setFooter('{PAGENO} of {nb}'); $mpdf->WriteHTML($strHtml); $mpdf->Output("YouAudit_" . date('Ymd_His') . ".pdf", "D"); } else { echo $strHtml; die(); } }
public function outputPdfFileComplianceComplete($strReportName, $arrResults, $booOutputHtml = false) { $strHtml = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"><html><head><link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"https://www.iworkaudit.com/includes/css/report.css\" /></head>"; $strHtml .= "<body><div>"; $strHtml .= "<table><tr><td>"; $strHtml .= "<h1>Youaudit Report</h1>"; $strHtml .= "<h2>" . $strReportName . "</h2>"; $strHtml .= "</td><td class=\"right\">"; $logo = 'logo.png'; $strHtml .= "<img alt=\"Youaudit\" src='brochure/logo/" . $logo . "'>"; $strHtml .= "</td></tr></table>"; $strHtml .= "<table class=\"report\">"; $strHtml .= "<thead>"; $strHtml .= "<tr>"; $strHtml .= "<th>Date</th>"; $strHtml .= "<th>QR Code</th>"; $strHtml .= "<th>Serial No</th>"; $strHtml .= "<th>Manufacturer & Model</th>"; $strHtml .= "<th>Category</th>"; $strHtml .= "<th>Check Name</th>"; $strHtml .= "<th>Mandatory</th>"; $strHtml .= "</tr>"; $strHtml .= "</thead><tbody>"; foreach ($arrResults as $test) { $strHtml .= "<tr>"; $date_ex = explode('-', $test['test_date']); $test['test_date'] = $date_ex[2] . "-" . $date_ex[1] . "-" . $date_ex[0]; $strHtml .= "<td>" . $test['test_date'] . "</td>"; $strHtml .= "<td><a href=\"/iwa/items/view/" . $test['test_item_id'] . "\">" . $test['barcode'] . "</a></td>"; $strHtml .= "<td>" . $test['serial_number'] . "</td>"; $strHtml .= "<td>" . $test['manufacturer'] . " " . $test['model'] . "</td>"; $strHtml .= "<td>" . $test['name'] . "</td>"; $strHtml .= "<td>" . $test['test_type_name'] . "</td>"; if ($test['test_type_mandatory'] == 1) { $strHtml .= "<td>Yes</td>"; } else { $strHtml .= "<td>No</td>"; } $strHtml .= "</tr>"; } $strHtml .= "</tbody>"; $strHtml .= "<tfoot><tr>"; $strHtml .= "</table>"; $strHtml .= "<p>Produced by " . $this->session->userdata('objSystemUser')->firstname . " " . $this->session->userdata('objSystemUser')->lastname . " (" . $this->session->userdata('objSystemUser')->username . ") on " . date('d/m/Y') . "</p>"; $strHtml .= "</div></body></html>"; if (!$booOutputHtml) { $this->load->library('Mpdf'); $mpdf = new Pdf('en-GB', 'A4'); $mpdf->setFooter('{PAGENO} of {nb}'); $mpdf->WriteHTML($strHtml); $mpdf->Output("iwareport_" . date('Ymd_His') . ".pdf", "D"); } else { echo $strHtml; die; } }
$pdf->SetFillColor(252, 124, 5); $pdf->SetFont('Arial', '', 11); $total_sales = "TOTAL SALES " . $_SESSION['sum'] . "\n LESS \n"; $pdf->MultiCell(0, 15, $total_sales); $total_expense = "TOTAL EXPENSES " . $_SESSION['cash_advance']; $pdf->MultiCell(0, 15, $total_expense); $remittance = "TOTAL CASH FOR REMITTANCE " . $total_remittance; $pdf->MultiCell(0, 15, $remittance); $remitted_cash = "REMITTED CASH " . $_SESSION['remittance']; $pdf->MultiCell(0, 15, $remitted_cash); $cash_variance = "CASH VARIANCE " . $_SESSION['cash_variance']; $pdf->MultiCell(0, 15, $cash_variance); $pdf->Ln(10); $pdf->MultiCell(0, 15, "Remarks: " . $_SESSION['remarks']); $filename = "Reports/" . date('F j, Y') . " - Shift " . $_SESSION['shift'] . ".pdf"; $pdf->Output($filename, 'F'); ?> <div class="modal-footer"> </form> <?php echo '<a id="generate-report" href="Reports/' . date('F j, Y') . ' - Shift ' . $_SESSION['shift'] . '.pdf" type="button" class="btn btn-primary" target="_blank">Generate Report</a>'; ?> <a id="generate-report-submit" data-remote="send-email.php" data-toggle="modal" data-target="#emailConfirmationModal" class="btn btn-success">Submit</a> </div> <script type="text/javascript"> $(document).ready(function(){ $("#generate-report-submit").attr("disabled", true); $('#generate-report').click(function(){ $("#generate-report-submit").removeAttr("disabled"); });
public function exportInvoice($ids) { $pdf = new Pdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8'); $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Gekosale'); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setLanguageArray(1); $pdf->SetFont('dejavusans', '', 10); $sql = 'SELECT * FROM invoice WHERE idinvoice IN (' . implode(',', $ids) . ')'; $stmt = Db::getInstance()->prepare($sql); $stmt->execute(); $Data = array(); while ($rs = $stmt->fetch()) { switch ($rs['contenttype']) { case 'html': $data = $rs['contentcopy']; $pdf->AddPage(); $pdf->writeHTML($data, true, 0, true, 0); break; } } @ob_clean(); $pdf->Output('Faktury z ' . date('Y-m-d'), 'D'); }
public function generarReporteEventoGeneralSeleccionFecha() { $fecha = date("Y-m-d", strtotime($this->input->get('fecha'))); $pdf = new Pdf('L', 'mm', 'Legal', true, 'UTF-8', false); $pdf->setPageOrientation('l'); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetMargins(PDF_MARGIN_LEFT, 15, PDF_MARGIN_RIGHT); //$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING, array(0, 64, 255), array(0, 64, 128)); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setFontSubsetting(true); $pdf->SetFont('times', '', 12, '', true); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->AddPage(); $html = null; $pdf->SetFont('Times', 'B', 14); $pdf->Image("imagen/logo/bannerprevengo2.png", $x = 5, $y = 5, $w = 290, $h = 40, $type = 'PNG', $link = '', $align = 'right', $resize = false, $dpi = 300, $palign = '', $ismask = false, $imgmask = false, $border = 0, $fitbox = false, $hidden = false, $fitonpage = false, $alt = false, $altimgs = array()); $pdf->SetTextColor('0', '25', '215'); $pdf->Text(130, 12, "República Bolivariana de Venezuela", $fstroke = false, $fclip = false, $ffill = true, $border = 0, $ln = 0, $align = 'left', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M', $rtloff = false); $pdf->Text(130, 17, "Gobernación del Estado Lara", $fstroke = false, $fclip = false, $ffill = true, $border = 0, $ln = 0, $align = 'left', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M', $rtloff = false); $pdf->Text(130, 23, "Oficina de Personal--División de Planificación y Presupuesto.", $fstroke = false, $fclip = false, $ffill = true, $border = 0, $ln = 0, $align = 'left', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M', $rtloff = false); $pdf->SetFont('Times', 'B', 12); $pdf->SetTextColor('8', '8', '8'); // $pdf->Text(50, 35, 'Reporte General de Eventos.'); // $pdf->Ln(20); //$pdf->Text(30, 40, 'Fecha:' . date('d-m-Y'), $align = 'rigth'); $pdf->Ln(15); $pdf->SetFont('times', '', 11, '', true); $ano = date('Y'); $mesesN = array(1 => "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"); $mes = $mesesN[date('n')]; $dia = date('d'); $html .= ' <table> <tr colspan="8"> <td colspan="2"><p align="center"><b></b></p></td> <td colspan="2" ><p align="center"><b></b></p></td> <td colspan="2"><p align="center"><b>Barquisimeto, ' . $dia . ' de ' . $mes . ' del ' . $ano . '</b></p></td> </tr> </table>'; $html .= "<h1>Reporte General de Eventos con las siguientes caracteristicas: </h1>"; $html .= ' <table border="1"> <tr colspan="1" width="5" heigth="5"> <td colspan="1" bgColor="#429DED"><p align="center"><b> Fecha </b></p></td> </tr> <tr colspan="1" width="5" heigth="5"> <td colspan="1" bgColor=""><p align="center"><b> ' . date("Y-m-d", strtotime($this->input->get('fecha'))) . '</b></p></td> </tr> </table>'; $condicion = 'evento.fechatope="' . $fecha . '"'; $reporte = $this->evento_model->cargarListaEventoSeleccionPDF($condicion); $html .= "<H1></h1>"; if ($reporte->num_rows() > 0) { $html .= ' <table border="1"> <tr colspan="8"> <td colspan="3" bgColor="#429DED"><p align="center"><b>Titulo</b></p></td> <td colspan="10" bgColor="#429DED"><p align="center"><b>Descripción</b></p></td> <td colspan="2" bgColor="#429DED"><p align="center"><b>Tipo de Evento</b></p></td> <td colspan="2" bgColor="#429DED"><p align="center"><b>Sector</b></p></td> <td colspan="2" bgColor="#429DED"><p align="center"><b>Alcance</b></p></td> <td colspan="2" bgColor="#429DED"><p align="center"><b>Agente</b></p></td> <td colspan="2.5" bgColor="#429DED"><p align="center"><b>Estatus</b></p></td> </tr>'; foreach ($reporte->result_array() as $fila2) { $html .= '<tr colspan="8"> <td colspan="3"><p align="center">' . $fila2['titulo'] . '</p></td> <td colspan="10"><p align="center">' . $fila2['descripcion'] . '</p></td> <td colspan="2"><p align="center">' . $fila2['tipoEv'] . '</p></td> <td colspan="2"><p align="center">' . $fila2['sector'] . '</p></td> <td colspan="2"><p align="center">' . $fila2['alcance'] . '</p></td> <td colspan="2"><p align="center">' . $fila2['agente'] . '</p></td> <td colspan="2.5"><p align="center">' . $fila2['estatus'] . '</p></td> </tr>'; } $html .= '<tr> <td colspan="21"><p align="right"> Cantidad de Eventos: </p></td> <td colspan="2"><p align="center">' . $reporte->num_rows() . '</p></td> </tr> </table>'; } else { $html .= '<h1>No se encuentra eventos registrados para la fecha seleccionada.</h1>'; } $nombre_archivo = utf8_decode("reporteEventos.pdf"); $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'C', $autopadding = true); $pdf->Output($nombre_archivo, 'I'); }
$pdf->Cell($width, 6, $value, 1, 0, 'C', 0, $links_to_vulns[$hostIP_ctx][$rvalue]); } else { $pdf->Cell($width, 6, $value, 1, 0, 'C'); } } $pdf->Ln(); } $pdf->Ln(); $pdf->Ln(); if ($summary == "1") { //output the pdf, now we're done$pdf- header("Cache-Control: public, must-revalidate"); header("Pragma: "); header('Content-Type: application/pdf'); //header("Content-disposition: attachment; filename=scanresults-$uid-$scantime.pdf"); $pdf->Output("scanresults-{$uid}-{$scantime}.pdf", "I"); exit; } $query = "SELECT distinct t1.hostIP, HEX(t1.ctx) as ctx, t1.service, t1.port, t1.protocol, t1.app, t1.risk, t1.scriptid, v.name, t1.msg\n FROM vuln_nessus_results t1\n LEFT JOIN vuln_nessus_plugins{$feed} as v ON v.id=t1.scriptid\n WHERE t1.report_id in ({$report_id})\n {$query_host}\n {$query_critical}\n {$perms_where}\n and t1.falsepositive<>'Y'\n ORDER BY INET_ATON(t1.hostIP) ASC, t1.risk ASC"; $eid = ""; $result = $dbconn->Execute($query); $arrResults = array(); while ($result->fields) { $hostIP = $result->fields['hostIP']; $hostctx = $result->fields['ctx']; $service = $result->fields['service']; $service_num = $result->fields['port']; $service_proto = $result->fields['protocol']; $app = $result->fields['app']; $risk = $result->fields['risk']; $scriptid = $result->fields['scriptid'];
public function actionPdfAdmin($year, $month, $nip) { $roles = Rights::getAssignedRoles(Yii::app()->user->Id); foreach ($roles as $role) { $cekrole = $role->name; } if ($cekrole == 'employee') { $status = Yii::app()->user->Id; //$nip = $this->loadModel2($status); /*User::model()->findByAttributes(array('id'=>$status));*/ $command = Yii::app()->db->createCommand(); $nipUser = $command->select('*')->from('profiles')->where('user_id=:id', array(':id' => $status))->queryRow(); } if ($cekrole != 'supervisorMorena' and $cekrole != 'Admin' and $cekrole != 'adminMorena' and $nipUser['nip'] != $nip) { throw new CHttpException(403, 'You are not authorized to perform this action.'); } $pdf = new Pdf('L', 'mm', 'A4'); $noSlip = $year . $month . $nip; $model = $this->loadModelPdfAdmin($noSlip); if ($model == null) { throw new CHttpException(772, 'Salary Slip cannot be found in Database, please check NIP, Year, or Month in Payroll Management.'); } $model2 = $this->loadModel2($nip); if ($model2 == null) { throw new CHttpException(772, 'Data Employee not found!'); } $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetFont('Arial', '', 12); $pdf->mySurat($model2['firstname'], $model2['lastname'], $model2['position'], $model2['departement'], $model2['location'], $model2['class'], $model2['marriageStatus'], $model->noSlipGaji, $model->year, $model->month, $model->nip, $model->workDays, $model->grossSalary, $model->fixAllowance, $model->pulse, $model->medicalAllowance, $model->overtime, $model->bonus, $model->thr, $model->correctionPlus, $model->incentive, $model->jobAllowance, $model->marriageAllowance, $model->houseAllowance, $model->maternityAllowance, $model->glassesAllowance, $model->condolanceAllowance, $model->separationPay, $model->opex, $model->coc, $model->pph21, $model->bpjs, $model->jamsostek, $model->benefitMin, $model->copAllowanceMin, $model->koperasi, $model->mcs, $model->loan, $model->meal, $model->transport, $model->taskForceAllowance); $pdf->Output("SALARY-SLIP-" . $model->nip . '-' . $model->month . '-' . $model->year . ".pdf", 'D'); // } // else { // throw new CHttpException(403,'You are not authorized to perform this action.'); // } }
function mailroutine($customer_data) { $new_file = $_SERVER['DOCUMENT_ROOT'] . '/iwa/excel_file/isareport_' . date('Ymd_His') . '.pdf'; $curr_count = (int) $this->count_routine; $total_count = count($customer_data); if ($total_count > $curr_count) { if ((int) $customer_data[$this->count_routine]['account_id'] > 0) { $table = $this->getDues($customer_data[$this->count_routine]['account_id'], $customer_data[$this->count_routine]['id']); $this->load->library('Mpdf'); $mpdf = new Pdf('en-GB', 'A4'); $mpdf->setFooter('{PAGENO} of {nb}'); $mpdf->WriteHTML($table); $mpdf->Output($new_file, "F"); $this->load->library('email'); $this->email->from("*****@*****.**", "Due Compliance"); // $this->email->to('*****@*****.**'); $this->email->to($customer_data[$this->count_routine]['username']); $this->email->subject('Due Compliance List'); $this->email->message('Due Compliance list is attached with pdf (Testing) '); $this->email->attach($new_file); $this->email->send(); $this->count_routine = $this->count_routine + 1; $this->email->clear(TRUE); $this->mailroutine($customer_data); } else { $this->count_routine = $this->count_routine + 1; $this->mailroutine($customer_data); } } }
public function generar() { $this->load->library('Pdf'); $pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Israel Parra'); $pdf->SetTitle('Ejemplo de provincías con TCPDF'); $pdf->SetSubject('Tutorial TCPDF'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // datos por defecto de cabecera, se pueden modificar en el archivo tcpdf_config_alt.php de libraries/config $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 001', PDF_HEADER_STRING, array(0, 64, 255), array(0, 64, 128)); $pdf->setFooterData($tc = array(0, 64, 0), $lc = array(0, 64, 128)); // datos por defecto de cabecera, se pueden modificar en el archivo tcpdf_config.php de libraries/config $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // se pueden modificar en el archivo tcpdf_config.php de libraries/config $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // se pueden modificar en el archivo tcpdf_config.php de libraries/config $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // se pueden modificar en el archivo tcpdf_config.php de libraries/config $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //relación utilizada para ajustar la conversión de los píxeles $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // --------------------------------------------------------- // establecer el modo de fuente por defecto $pdf->setFontSubsetting(true); // Establecer el tipo de letra //Si tienes que imprimir carácteres ASCII estándar, puede utilizar las fuentes básicas como // Helvetica para reducir el tamaño del archivo. $pdf->SetFont('freemono', '', 14, '', true); // Añadir una página // Este método tiene varias opciones, consulta la documentación para más información. $pdf->AddPage(); //fijar efecto de sombra en el texto $pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 1, 'blend_mode' => 'Normal')); // Establecemos el contenido para imprimir $matricula = $this->input->post('provincia'); $provincias = $this->modelo->getIdentificacion($matricula); foreach ($provincias as $fila) { $prov = $fila['nombre']; } //preparamos y maquetamos el contenido a crear $html = ''; $html .= "<style type=text/css>"; $html .= "th{color: #fff; font-weight: bold; background-color: #222}"; $html .= "td{background-color: #AAC7E3; color: #fff}"; $html .= "</style>"; $html .= "<h2>Localidades de " . $prov . "</h2><h4>Actualmente: " . count($provincias) . " localidades</h4>"; $html .= "<table width='100%'>"; $html .= "<tr><th>Id localidad</th><th>Localidades</th></tr>"; //provincias es la respuesta de la función getProvinciasSeleccionadas($provincia) del modelo foreach ($provincias as $fila) { $id = $fila['ap']; $localidad = $fila['am']; $html .= "<tr><td class='id'>" . $id . "</td><td class='localidad'>" . $localidad . "</td></tr>"; } $html .= "</table>"; // Imprimimos el texto con writeHTMLCell() $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true); // --------------------------------------------------------- // Cerrar el documento PDF y preparamos la salida // Este método tiene varias opciones, consulte la documentación para más información. $nombre_archivo = utf8_decode("Localidades de " . $prov . ".pdf"); $pdf->Output($nombre_archivo, 'I'); }
public function printAbstract($title = "", $vendorName, $total, $startDate, $endDate) { set_time_limit(0); $pdf = new Pdf("P", PDF_UNIT, "A4", true, 'UTF-8', false); $date = date('d-m-Y'); $filename = $vendorName . "_" . $startDate . "_" . $endDate . "_" . $date; // set header and footer fonts // set margins $pdf->setTitle(''); $pdf->Header(); $pdf->Footer(); $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT, true); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); //$pdf->SetMargins (15, 27, 15, true); $pdf->SetFont('times', '', 14); $pdf->SetAutoPageBreak(TRUE, 50); $pdf->AddPage(); $pdf->Cell(0, 0, 'ENGINEERING COLLEGE HOSTELS', 0, 0, 'C'); $pdf->Ln(); $pdf->SetFont('times', '', 12); $pdf->Cell(0, 0, 'COLLEGE OF ENGINEERING, GUINDY', 0, 0, 'C'); $pdf->Ln(); $pdf->Cell(0, 0, 'ANNA UNIVERSITY, CHENNAI-25', 0, 0, 'C'); $pdf->Ln(); $pdf->SetFont('times', '', 14); $pdf->Cell(0, 0, 'ABSTRACT OF SUPPLIER\'S BILL', 0, 0, 'C'); $pdf->Ln(); $pdf->Ln(); $pdf->SetFont('times', '', 14); $text = "BILL RECEIVED FROM " . $vendorName . " FOR THE SUPPLIES MADE"; $pdf->Cell(0, 0, $text, 0, 0, 'L'); if ($startDate == $endDate) { $text = "ON " . $startDate; } else { $text = "BETWEEN " . $startDate . " AND " . $endDate; } $pdf->Ln(); $pdf->Cell(0, 0, $text, 0, 0, 'L'); $pdf->SetFont('times', '', 12); $html = ""; //create html $html .= '<html><head><title>Report</title>'; $html .= '</head><body >'; $base_path = base_url(); $html .= '<style>tr,th{border: 1px solid black;}</style>'; $html .= $_POST['toSend']; $html .= '</body></html>'; $pdf->writeHTML($html, false, false, false, false, ''); $inWords = $this->convert_number($total); $text = "BILL PASSED FOR RUPEES " . $inWords; $pdf->SetFont('times', '', 14); $pdf->Ln(); $pdf->Cell(0, 0, $text, 0, 0, 'L'); $pdf->Ln(); $pdf->Ln(); $pdf->Ln(); $pdf->Ln(); $pdf->Ln(); $html = '<table><tr><th>Store Manager</th><th>Deputy Warden</th><th>Hostel Warden</th></tr></table>'; $pdf->writeHTML($html, false, false, false, false, ''); // $pdf->Output('C:\xampp\htdocs\cegMessStore\reports\report.pdf', 'FD'); //save pdf if (strpos($title, "Vegetable") !== false) { $dir = "Vegetable Abstract/" . $filename . ".pdf"; } else { $dir = "Items Abstract/" . $filename . ".pdf"; } $pdf->Output("/var/www/cegMessStore/reports/" . $dir, 'FD'); //save pdf // $pdf->Output('file.pdf', 'I'); // show pdf return true; }
function export_pdf07() { $this->load->library('pdf'); ob_clean(); $pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false); $tbl = ''; $tbl .= ' <h3><u>MASTER USER</u></h3> <table border="0" cellpadding="0" cellspacing="0" > <tr >'; $tbl .= '<th align="center" bgcolor="#359AFF" width="30" >NO</th>'; $tbl .= '<th valign="middle" bgcolor="#359AFF" width="200" >USER NAME</th>'; $tbl .= '<th valign="middle" bgcolor="#359AFF" width="250" >NAMA PEGAWAI</th>'; $tbl .= '<th valign="middle" bgcolor="#359AFF" width="180" >NAMA GROUP</th>'; $tbl .= '<th valign="middle" bgcolor="#359AFF" width="100" >AKTIF</th>'; $tbl .= '</tr>'; $sql = "select user_id,user_name,user_pwd,user_group_id, user_pegawai,if(user_aktif=1,'aktif','tidak aktif') st_user,user_aktif,group_id, group_nama from v_user where group_aktif=1"; $data = $this->m_global->grid_view($sql)->result_array(); $no = 1; foreach ($data as $row) { $bg = $no % 2; if ($bg == 0) { $bg = ' bgcolor="#E1F0FF" '; } else { $bg = ' bgcolor="#FFFFFF" '; } $tbl .= ' <tr> <td ' . $bg . ' align="center" width="30">' . $no . '</td>'; $tbl .= '<td ' . $bg . ' width="200" >' . $row['user_name'] . '</td>'; $tbl .= '<td ' . $bg . ' width="250" >' . $row['user_pegawai'] . '</td>'; $tbl .= '<td ' . $bg . ' width="180" >' . $row['group_nama'] . '</td>'; $tbl .= '<td ' . $bg . ' width="100" >' . $row['st_user'] . '</td>'; $tbl .= '</tr>'; $no++; } $tbl .= '</table>'; $pdf->AddPage(); $pdf->SetFont('helvetica', '', 8); $pdf->writeHTML($tbl, true, false, false, false, ''); $pdf->Output('example_048.pdf', 'I'); }
public function outputPdfFile($strReportName, $arrFields, $arrResults, $booOutputHtml = false) { $arrPageData['arrSessionData'] = $this->session->userdata; $strHtml = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"><html><head><link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"includes/css/report.css\" /></head>"; $strHtml .= "<body><div>"; $strHtml .= "<table><tr><td>"; $strHtml .= "<h1>" . $this->session->userdata('objSystemUser')->firstname . " " . $this->session->userdata('objSystemUser')->lastname . "/" . $this->session->userdata('objSystemUser')->accountname . "</h1>"; $strHtml .= "<h2>" . $strReportName . "</h2>"; $strHtml .= "</td><td class=\"right\">"; $logo = 'logo.png'; if (isset($this->session->userdata['theme_design']->logo)) { $logo = $this->session->userdata['theme_design']->logo; } $strHtml .= "<img alt=\"ictracker\" src='brochure/logo/" . $logo . "'>"; $strHtml .= "</td></tr></table>"; $strHtml .= "<table class=\"report\">"; $strHtml .= "<thead>"; $strHtml .= "<tr style='background-color:#00AEEF'>"; foreach ($arrFields as $arrReportField) { $strHtml .= "<th style='color:white'>" . $arrReportField['strName'] . "</th>"; } $strHtml .= "</tr>"; $strHtml .= "</thead><tbody>"; $arrTotals = array(); foreach ($arrResults as $objItem) { $strHtml .= "<tr>"; $arrPageData['arrSessionData'] = $this->session->userdata; foreach ($arrFields as $arrReportField) { // var_dump($arrReportField); $strHtml .= "<td style='height:50px:'>"; if (array_key_exists('strConversion', $arrReportField)) { switch ($arrReportField['strConversion']) { case 'dt': if ($objItem['dt'] != '') { $strHtml .= date('d/m/Y', strtotime($objItem['dt'])); } else { $strHtml .= "Unknown"; } break; case 'date': $arrDate = explode('-', $objItem->{$arrReportField['strFieldReference']}); if (count($arrDate) > 1) { $strHtml .= $arrDate[2] . "/" . $arrDate[1] . "/" . $arrDate[0]; } else { $strHtml .= "Unknown"; } break; case 'datetime': $arrDateTime = explode(' ', $objItem->{$arrReportField['strFieldReference']}); $strTime = $arrDateTime[1]; $arrDate = explode('-', $arrDateTime[0]); $strHtml .= $arrDate[2] . "/" . $arrDate[1] . "/" . $arrDate[0] . " " . $strTime; break; case 'pat_result': if ($objItem->{$arrReportField['strFieldReference']} === null) { $strHtml.="-"; } else { if ($objItem->{$arrReportField['strFieldReference']} == 1) { $strHtml.="Pass"; } else { $strHtml.="Fail"; } } break; case 'price': $strHtml .= $currency . $objItem->{$arrReportField['strFieldReference']}; break; case 'img': if ($objItem['photo_id']) { if (strpos($objItem['photo_id'], ',')) { $photos = explode(',', $objItem['photo_id']); for ($i = 0; $i < count($photos); $i++) { $image = $this->db->select('path')->where('id', $photos[$i])->get('photos')->row(); $strHtml .= "<img width='20' height='20' src='" . base_url() . $image->path . "'>"; } } else { $image = $this->db->select('path')->where('id', $objItem['photo_id'])->get('photos')->row(); $strHtml .= "<img width='20' height='20' src='" . base_url() . $image->path . "'>"; } } } } else { $strHtml .= $objItem[$arrReportField['strFieldReference']]; } if (array_key_exists('arrFooter', $arrReportField) && array_key_exists('booTotal', $arrReportField['arrFooter'])) { if (array_key_exists($arrReportField['strFieldReference'], $arrTotals)) { $arrTotals[$arrReportField['strFieldReference']] += $objItem[$arrReportField['strFieldReference']]; } else { $arrTotals[$arrReportField['strFieldReference']] = $objItem[$arrReportField['strFieldReference']]; } } $strHtml .= "</td>"; } $strHtml .= "</tr>"; } $strHtml .= "</tbody>"; $strHtml .= "<tfoot><tr>"; foreach ($arrFields as $arrReportField) { if (array_key_exists('arrFooter', $arrReportField)) { if (array_key_exists('booTotal', $arrReportField['arrFooter']) && $arrReportField['arrFooter']['booTotal']) { $strHtml .= "<td>"; if (array_key_exists('strConversion', $arrReportField) && ($arrReportField['strConversion'] == "price")) { $strHtml .= $currency; } $strHtml .= $arrTotals[$arrReportField['strFieldReference']]; $strHtml .= "</td>"; } else { if (array_key_exists('booTotalLabel', $arrReportField['arrFooter']) && $arrReportField['arrFooter']['booTotalLabel']) { $strHtml .= "<td"; if (array_key_exists('intColSpan', $arrReportField['arrFooter']) && ($arrReportField['arrFooter']['intColSpan'] > 0)) { $strHtml .= " colspan=\"" . $arrReportField['arrFooter']['intColSpan'] . "\""; } $strHtml .= " class=\"right\">"; $strHtml .= "Totals</td>"; } } } } $strHtml .= "</tr></tfoot>"; $strHtml .= "</table>"; $strHtml .= "<p>Produced by " . $arrPageData['arrSessionData']["objSystemUser"]->firstname . " " . $arrPageData['arrSessionData']["objSystemUser"]->lastname . " (" . $arrPageData['arrSessionData']["objSystemUser"]->username . ") on " . date('d/m/Y') . "</p>"; $strHtml .= "</div></body></html>"; if (!$booOutputHtml) { $this->load->library('Mpdf'); $mpdf = new Pdf('en-GB', 'A4'); $mpdf->setFooter('{PAGENO} of {nb}'); $mpdf->WriteHTML($strHtml); $mpdf->Output("YouAudit_" . date('Ymd_His') . ".pdf", "D"); } else { echo $strHtml; die(); } }
public function MatricRollNoGroupwise() { // DebugBreak() ; $this->load->helper('url'); //Load the library $this->load->library('html2pdf'); $grp_cd = $this->uri->segment(3); $sess = 1; $class = 10; $year = 2016; $this->load->library('session'); $Logged_In_Array = $this->session->all_userdata(); $user = $Logged_In_Array['logged_in']; //DebugBreak(); $this->load->library('Pdf'); $pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false); $pdf->setHeaderData('', 0, '', '', array(0, 0, 0), array(255, 255, 255)); $pdf->SetPrintHeader(false); $pdf->SetPrintFooter(false); $pdf->SetTitle('Matric Roll Number Slip'); $pdf->SetHeaderMargin(1); $pdf->SetTopMargin(1); $pdf->setFooterMargin(1); $pdf->SetFont('helvetica', '', 8); $pdf->SetAutoPageBreak(TRUE, 0); $pdf->SetAuthor('BiseGrw'); $pdf->SetMargins(4, 1, 4, true); $Inst_Id = $user['Inst_Id']; $this->load->model('RollNoSlip_model'); // DebugBreak(); $studeninfo = array('data' => $this->RollNoSlip_model->get10thrslipWith_Grp_CD($class, $year, $sess, $grp_cd, $Inst_Id)); $template_pdf = ''; $totalslips = count($studeninfo['data']['slip']); $studentslip = array(); //DebugBreak(); for ($i = 0; $i < count($studeninfo['data']['info']); $i++) { $pdf->AddPage(); $rno = $studeninfo['data']['info'][$i]['Rno']; $temp = "{$rno}@{$class}@{$sess}@{$year}@{$Inst_Id}"; $image = $this->set_barcode($temp); $studeninfo['data']['info'][$i]['barcode'] = $image; for ($j = 0; $j < $totalslips; $j++) { if ($rno == $studeninfo['data']['slip'][$j]['rno']) { $studeninfo['data']['info'][$i]['slips'][] = $studeninfo['data']['slip'][$j]; } } // DebugBreak(); $html = $this->load->view('RollNoSlip/MatricRollNoCombine', $studeninfo['data']['info'][$i], true); $pdf->writeHTML($html, true, false, true, false, ''); if ($i == 0) { break; } } $pdf->Output('pdfexample.pdf', 'I'); //$this->html2pdf->html($this->load->view('RollNoSlip/MatricRollNoCombine', $studeninfo['data'], true)); // $this->html2pdf->html($template_pdf); /* if($this->html2pdf->create('downlaod')) { if($class == 10) redirect('RollNoSlip/TenthStd'); else if($class == 9) redirect('RollNoSlip/NinthStd'); } */ }
$checked_out_by = '--'; } $html .= <<<EOD <tr> <td><a href="tatt.com/items/item.php?id={$item['id']}">{$item['name']}</a></td> <td>{$item['type_name']}</td> <td>{$location}</td> <td>{$item['last_accounted_for']}</td> <td>{$checked_out_by}</td> </tr> EOD; } $html .= <<<EOD </tbody> </table> EOD; // Print text using writeHTMLCell() $pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true); // --------------------------------------------------------- // Close and output PDF document // This method has several options, check the source code documentation for more information. $pdf->Output('example_001.pdf', 'I'); //============================================================+ // END OF FILE //============================================================+
public function ticketPdf() { $ticket = $this->input->get("ticket"); $pdf = new Pdf('L', 'mm', 'A4', true, 'UTF-8', false); $pdf->setPageOrientation('p'); $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); $pdf->SetMargins(PDF_MARGIN_LEFT, 15, PDF_MARGIN_RIGHT); //$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setFontSubsetting(true); $pdf->SetFont('times', '', 12, '', true); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->AddPage(); $html = null; $buscarTicket = $this->ticket_model->buscarTicket($ticket); $buscarTicketSector = $this->ticket_model->buscarTicketSector($ticket); if ($buscarTicket) { foreach ($buscarTicket as $fila1) { $html = ''; $html .= "<style type=text/css>"; $html .= "td{ color: #222}"; $html .= "</style>"; $html .= '<table border="0"> <tr colspan="6"> <td colspan="2" align="left"><img alt="Imagen" src="imagen/logo/logoborde.png" width="220" heigth="90"/></td> <td colspan="2" ><br></td> <td colspan="2"><p align="right"><b>República Bolivariana de Venezuela<br>Gobernación del Estado Lara</b></p></td> </tr><br> <tr colspan="6"> <td colspan="6" align="right"><b>Ticket: ' . $fila1->codigo . '</b></td><br> </tr> <tr colspan="6"> <td colspan="6" align="right"><b>Barquisimeto, ' . $fila1->fecha . '</b></td> </tr><br> <tr colspan="6"> <td colspan="6" align="center"><b>REQUERIMIENTO</b></td> </tr> </table><br> <table border="1"> <tr colspan="6"> <td colspan="2" bgColor="#DCDCDC"><p align="center"><b>Solicitante:</b></p></td> <td colspan="4"><p align="center">' . $fila1->solicitante . '</p></td><br> </tr> <tr colspan="6"> <td colspan="2" bgColor="#DCDCDC"><p align="center"><b>Tipo de requerimiento:</b></p></td> <td colspan="4"><p align="center">' . $fila1->nombretipo . '</p></td><br> </tr> </table><br>'; if ($fila1->tipoticket == 3) { $html .= ' <table border="1"> <tr colspan="8"> <td colspan="8" bgColor="#DCDCDC"><p align="center"><b>DESCRIPCIÓN REQUERIMIENTO.-</b></p></td> </tr> <tr colspan="8"> <td colspan="3" bgColor="#DCDCDC"><p align="center"><b>Tipo de ayuda</b></p></td> <td colspan="3" bgColor="#DCDCDC"><p align="center"><b>Descripción</b></p></td> <td colspan="2" bgColor="#DCDCDC"><p align="center"><b>Cantidad</b></p></td> </tr>'; foreach ($buscarTicketSector as $fila2) { $variable = $fila2->nombresector; $html .= '<tr colspan="8"> <td colspan="3"><p align="center">' . $fila2->ayudaticket . '</p></td> <td colspan="3"><p align="center">' . $fila2->descripcion . '</p></td> <td colspan="2"><p align="center">' . $fila2->cantidad . '</p></td> </tr>'; } $html .= '<tr colspan="8"> <td colspan="8" bgColor="#DCDCDC"><p align="center">SECTOR RELACIONADO AL REQUERIMIENTO: ' . $variable . '</p></td><br> </tr> </table>'; } else { $html .= '<table border="1"> <tr colspan="6"> <td colspan="6" bgColor="#DCDCDC"><p align="center">SECTOR RELACIONADO AL REQUERIMIENTO: ' . $fila1->nombresector . '</p></td><br> </tr> <tr colspan="6"> <td colspan="6" bgColor="#DCDCDC"><p align="center">DESCRIPCIÓN REQUERIMIENTO.-</p></td><br> </tr> <tr colspan="6"> <td colspan="6"><p align="justify">' . $fila1->descripcion . '</p></td><br> </tr> </table>'; } } } else { $pdf->SetFont('Times', 'B', 18); $pdf->Text(5, 25, 'No se encuentra Documento con las características indicadas.'); } $nombre_archivo = utf8_decode("ticket.pdf"); $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'C', $autopadding = true); $pdf->Output($nombre_archivo, 'I'); }
public function index() { $this->load->library('Pdf'); $pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false); $pdf->SetTitle('Pdf Example'); $pdf->SetHeaderMargin(30); $pdf->SetTopMargin(20); $pdf->setFooterMargin(20); $pdf->SetAutoPageBreak(true); $pdf->SetAuthor('Author'); $pdf->SetDisplayMode('real', 'default'); $pdf->Write(5, 'CodeIgniter TCPDF Integration'); $pdf->Output('pdfexample.pdf', 'I'); }