Example #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $id = $input->getArgument('id');
     $pdffile = $input->getArgument('pdf');
     $em = $this->getContainer()->get('doctrine');
     $tab = $this->csv($pdffile);
     $template = $em->getRepository('PrintBundle:Template')->find($id);
     $path = $this->getContainer()->get('kernel')->getRootDir() . '/../web/uploads/pdf/' . $template->getPdffile();
     $width = $template->getWidth();
     $height = $template->getHeight();
     $orientation = $height > $width ? 'P' : 'L';
     $custom_layout = array($width, $height);
     $i = 1;
     foreach ($tab as $key => $value) {
         $pdf = new \FPDI($orientation, 'mm', $custom_layout, true, 'UTF-8', false);
         $pdf->setPageOrientation($orientation);
         $pdf->SetMargins(PDF_MARGIN_LEFT, 40, PDF_MARGIN_RIGHT);
         $pdf->SetAutoPageBreak(true, 40);
         $pdf->setFontSubsetting(false);
         // add a page
         $pdf->AddPage($orientation);
         $pdf->setSourceFile($path);
         $_tplIdx = $pdf->importPage(1);
         $size = $pdf->useTemplate($_tplIdx, 0, 0, $width, true);
         foreach ($template->getChildactivity() as $opt) {
             $pdf->SetXY($opt->getX(), $opt->getY());
             $pdf->SetFont($opt->getFont(), '', $opt->getFontsize() * 2);
             // echo $opt->getFontsize()."\n";
             $pdf->Cell($opt->getWidth(), $opt->getHeight(), $value[$opt->getName()]);
         }
         //$pdf->Cell(0, $size['h'], 'TCPDF and FPDI');
         // echo $template->getId();
         $pdf->Output($this->getContainer()->get('kernel')->getRootDir() . '/../web/folder/pdf' . $template->getId() . "-{$i}.pdf", 'F');
         $i++;
     }
 }
$pdf = new FPDI();
$pdf->setSourceFile($_SERVER["DOCUMENT_ROOT"]."/modules/usuarios_registrados/agentes_comerciales/comisiones/templates/orden_pago.pdf");

define("MAX_REGISTROS_POR_HOJA", 52);

dibujarCabecera($rowCabecera);

$i = 1;
$netoAPagar = 0;
while ($row = DBGetQuery($stmt)) {
	if (($i % MAX_REGISTROS_POR_HOJA) == 0)
		dibujarCabecera();

	$pdf->Ln(4);
	$pdf->Cell(-5);
	$pdf->Cell(32, 0, $row["TIPO"], 0, 0, "C");
	$pdf->Cell(20, 0, $row["FECHA"], 0, 0, "C");
	$pdf->Cell(32, 0, $row["NUMERO"], 0, 0, "C");
	$pdf->Cell(84, 0, $row["DESCRIPCION"], 0, 0, "C");
	$pdf->Cell(32, 0, $row["MONTOFORMATEADO"], 0, 0, "R");
	$netoAPagar+= str_replace(",", ".", $row["MONTO"]);
	$i++;
}

$pdf->SetY(272);
$pdf->Ln(1);
$pdf->Rect($pdf->GetX() - 5, $pdf->GetY(), 200, 0.2, "F");

$sql = "SELECT TO_CHAR(".$netoAPagar.", '$9,999,999,990.00') montoformateado FROM DUAL";
if ($autoPrint)
	$pdf = new PDF_AutoPrint();
else
	$pdf = new FPDI();

$pdf->setSourceFile($_SERVER["DOCUMENT_ROOT"]."/modules/solicitud_afiliacion/templates/solicitud_afiliacion.pdf");

//Página 1..
$pdf->AddPage();
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx);
$pdf->SetFont("Arial", "", 8);

if (($row2["SA_MOTIVOALTA"] == "03") or ($row2["SA_MOTIVOALTA"] == "04") or ($row2["SA_MOTIVOALTA"] == "05")) {
	$pdf->Ln(6);
	$pdf->Cell(-0.4);
	$pdf->Cell(0, 0, "X");

	$pdf->Ln(8.2);
	$pdf->Cell(1);
}
else {
	$pdf->Ln(10.2);
	$pdf->Cell(-0.4);
	$pdf->Cell(0, 0, "X");

	$pdf->SetFont("Arial", "B", 8);
	$pdf->Ln(4);
	$pdf->Cell(1);
	$pdf->Cell(45, 0, $row2["AR_NOMBRE"]);
}
$sql =
	"SELECT art.utiles.armar_cuit(sa_cuit) cuit, sa_nombre
		 FROM asa_solicitudafiliacion
		WHERE sa_idformulario = :idformulario";
$stmt = DBExecSql($conn, $sql, $params);
$row2 = DBGetQuery($stmt, 1, false);

if ($autoPrint)
	$pdf = new PDF_AutoPrint();
else
	$pdf = new FPDI();

$pdf->setSourceFile($_SERVER["DOCUMENT_ROOT"]."/modules/solicitud_afiliacion/templates/nomina_personal_expuesto.pdf");

$pdf->AddPage("L");
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx, null, null, 0, 0, true);
$pdf->SetFont("Arial", "B", 9);

$pdf->Ln(17);
$pdf->Cell(14);
$pdf->Cell(226, 0, $row2["SA_NOMBRE"]);

$pdf->Cell(16);
$pdf->Cell(0, 0, $row2["CUIT"]);


if ($autoPrint)
	$pdf->AutoPrint(false);
$pdf->Output();
?>
Example #5
0
	$pdf = new FPDI("P", "mm", array(216, 320));

$pdf->setSourceFile($_SERVER["DOCUMENT_ROOT"]."/modules/solicitud_afiliacion/templates/rgrl.pdf");

$pdf->AddPage();
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx);
$pagina = 1;
dibujarPie($pagina);

// Cabecera..
setNumeroSolicitud($row["CUIT"], $row["FO_FORMULARIO"]);

$pdf->SetFont("Arial", "B", 8);
$pdf->Ln(-7.2);
$pdf->Cell(4);
$pdf->Cell(0, 0, date("d/m/Y"));

$pdf->SetFont("Arial", "B", 9);
$pdf->Ln(3);
$pdf->Cell(192, 0, $row["TITULO"], 0, 0, "C");

$pdf->SetFont("Arial", "B", 8);
$pdf->Ln(34.6);
$pdf->Cell(26);
$pdf->Cell(100, 0, $row["NOMBRE"]);

$pdf->Cell(26);
$pdf->Cell(0, 0, ponerGuiones($row["CUIT"]));

$pdf->Ln(5.2);
 /**
  * Save post metadata when a post is saved.
  *
  * @param int $post_id The post ID.
  * @param post $post The post object.
  * @param bool $update Whether this is an existing post being updated or not.
  */
 public function save_ticket_data($post_id, $post, $update)
 {
     global $product;
     /*
      * In production code, $slug should be set only once in the plugin,
      * preferably as a class property, rather than in each function that needs it.
      */
     $slug = 'product';
     // If this isn't a 'product' post, don't update it.
     if ($slug != $post->post_type) {
         return;
     }
     $getprod = get_product($post_id);
     //If it's not a ticket return aswell
     if ($getprod->product_type != 'ticket') {
         return;
     }
     $getmeta = get_post_meta($post_id, '_downloadable_files', true);
     //Traverse the return array since we don't know the first key
     foreach ($getmeta as $key => $value) {
         $url = $value['file'];
     }
     $path = $_SERVER['DOCUMENT_ROOT'] . parse_url($url, PHP_URL_PATH);
     //To get the dir, use: dirname($path)
     require_once 'fpdf/fpdf.php';
     require_once 'fpdi/fpdi.php';
     //Get stuff to add to pdf :D
     $getmetaall = get_post_meta($post_id);
     $getcontent = get_post_meta($post_id, 'frs_woo_product_tabs', true);
     $i = 1;
     $pdf = new FPDI();
     //	$pdf->AddPage();
     //Set the source PDF file
     //$pagecount = $pdf->setSourceFile($path);
     //Import the first page of the file
     //$tpl = $pdf->importPage($i);
     //Use this page as template
     //$pdf->useTemplate($tpl);
     #Print Hello World at the bottom of the page
     //Clear all
     $pdf->SetFillColor(255, 255, 255);
     $pdf->SetY(1);
     $pdf->SetFont('Arial', 'I', 19);
     $pdf->Cell(0, $pdf->h - 2, ' ', 0, 0, 'C', true);
     //Go to 1.5 cm from bottom
     $pdf->SetY(1);
     //Select Arial italic 8
     $pdf->SetFont('Arial', 'I', 19);
     //Print centered cell with a text in it
     $pdf->Cell(0, 10, $post->post_title, 0, 0, 'C');
     /*
     
     
     			$pdf->SetY(10);
     			$pdf->SetFont('Arial','I',16);
     			$pdf->Cell(0, 10, gmdate("Y-m-d", $getmetaall["wpcf-event-start-date"][0]), 0, 0, 'C');
     
     			$pdf->SetY(20);
     			$pdf->SetFont('Arial','I',16);
     			$pdf->Cell(0, 10, 'Start time: ' . $getmetaall["wpcf-event-start-time"][0], 0, 0, 'C');
     
     			$pdf->SetY(27);
     			$pdf->SetFont('Arial','I',16);
     			$pdf->Cell(0, 10, 'End time: ' . $getmetaall["wpcf-event-end-time"][0], 0, 0, 'C');
     
     			$pdf->SetY(1);
     			$pdf->Image('http://dancenergy.zenutech.com/production/wp-content/uploads/2014/06/Logo.png', 5, 0, 33.78);
     */
     //Select Arial italic 8
     $pdf->SetY(20);
     $pdf->SetFont('Arial', 'I', 15);
     $pdf->WriteHTML($getcontent[0]['ticket_content']);
     $pdf->Output($path, "F");
     /*
     			echo "<pre>";
     				var_dump( $getmetaall );
     			echo "</pre>";
     */
     return;
 }
Example #7
0
	public function view_sign_pce(){
		require_once('./assets/fpdf17/fpdf.php');
		require_once('./assets/fpdf17/fpdi.php');
		$pce_id=$this->uri->segment(3,'');
		
		// init pce data                       
		$pce_dat=$this->m_pce->get_pce_by_id($pce_id);
		$project=$this->m_project->get_project_by_id($pce_dat->project_id);
        //init sign pic
        $ae_sign_user_dat=$this->m_user->get_user_by_login_name($project->project_cs);
        $ae_sign_filename="no";
        if (isset($ae_sign_user_dat->sign_filename)) {
          $ae_sign_filename=$ae_sign_user_dat->sign_filename;
        }
        $client_service_sign_dat=$this->m_user->get_user_by_login_name($pce_dat->csd_sign);
        $client_service_sign_filename="no";
        if (isset($client_service_sign_dat->sign_filename)) {
          $client_service_sign_filename=$client_service_sign_dat->sign_filename;
        }
        $finance_sign_dat=$this->m_user->get_user_by_login_name($pce_dat->fc_sign);
        $finance_sign_filename="no";
        if (isset($finance_sign_dat->sign_filename)) {
          $finance_sign_filename=$finance_sign_dat->sign_filename;
        }
        // initiate FPDI
        $pdf = new FPDI();

        // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวธรรมดา กำหนด ชื่อ เป็น angsana
            $pdf->AddFont('angsana','','angsa.php');
             
            // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา  กำหนด ชื่อ เป็น angsana
            $pdf->AddFont('angsana','B','angsab.php');
             
            // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา  กำหนด ชื่อ เป็น angsana
            $pdf->AddFont('angsana','I','angsai.php');
             
            // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา  กำหนด ชื่อ เป็น angsana
            $pdf->AddFont('angsana','BI','angsaz.php');


        // get the page count
        $pageCount = $pdf->setSourceFile("./media/real_pdf/".$pce_dat->filename);
        // iterate through all pages
        for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
            // import a page
            $templateId = $pdf->importPage($pageNo);
            // get the size of the imported page
            $size = $pdf->getTemplateSize($templateId);

            // create a page (landscape or portrait depending on the imported page size)
            if ($size['w'] > $size['h']) {
                $pdf->AddPage('L', array($size['w'], $size['h']));
            } else {
                $pdf->AddPage('P', array($size['w'], $size['h']));
            }

            // use the imported page
            $pdf->useTemplate($templateId);

            $pdf->SetTextColor(0,0,0);
            $pdf->SetFont('angsana','B',14);
            $pdf->SetXY(5, 5);
            //$pdf->Write(8, 'A complete document imported with FPDI');
            $all_three_sign=0;
            if ($finance_sign_filename!="no"&&$finance_sign_filename!=""&&$finance_sign_filename!=null) {
              $pdf->Image("./media/sign_photo/".$finance_sign_filename,152,242,40,0);
              $c_time=$pce_dat->fc_sign_time;
              $pdf->SetXY(162,269);
              $pdf->Cell(30,5,iconv( 'UTF-8','cp874' , date("d",$c_time)."     ".date("m",$c_time)."     ".date("Y",$c_time)),0,0);
              $all_three_sign+=1;
            }
            if ($client_service_sign_filename!="no"&&$client_service_sign_filename!=""&&$client_service_sign_filename!=null) {
              $pdf->Image("./media/sign_photo/".$client_service_sign_filename,86,242,40,0);
              $c_time=$pce_dat->csd_sign_time;
              $pdf->SetXY(96,269.5);
              $pdf->Cell(30,5,iconv( 'UTF-8','cp874' , date("d",$c_time)."     ".date("m",$c_time)."     ".date("Y",$c_time)),0,0);
              $all_three_sign+=1;
            }
            if ($ae_sign_filename!="no"&&$ae_sign_filename!=""&&$ae_sign_filename!=null) {
              $pdf->Image("./media/sign_photo/".$ae_sign_filename,20,242,40,0);
              $c_time=$pce_dat->cs_sign_time;
              $pdf->SetXY(30,270);
              $pdf->Cell(30,5,iconv( 'UTF-8','cp874' , date("d",$c_time)."     ".date("m",$c_time)."     ".date("Y",$c_time)),0,0);
              $all_three_sign+=1;
            }
            //if ($all_three_sign==3) {
            	$pdf->Image("./img/Client_Approval_Tag.png",110,204.2,35,0);
            //}
            //$pdf->Image("images/play.png",100,100,100,0);
        }
        $new_filename=$pce_dat->pce_no."_A.pdf";

        // Output the new PDF
        //@unlink("./media/real_pdf/".$new_filename);
        $pdf->Output($new_filename,"I");
        //redirect("media/real_pdf/".$new_filename);
	}
 /**
  * Determine if the email should actually be sent and setup email merge variables
  *
  * @since 0.1
  * @param int $order_id
  */
 public function trigger($order_id)
 {
     global $woocommerce;
     // bail if no order ID is present
     if (!$order_id) {
         return;
     }
     // setup order object
     $this->object = new WC_Order($order_id);
     //check if is downloadbale
     if (!$this->object->has_downloadable_item()) {
         return;
     }
     // replace variables in the subject/headings
     $this->find[] = '{order_date}';
     $this->replace[] = date_i18n(woocommerce_date_format(), strtotime($this->object->order_date));
     $this->find[] = '{order_number}';
     $this->replace[] = $this->object->get_order_number();
     //To get the dir, use: dirname($path)
     require_once 'fpdf/fpdf.php';
     require_once 'fpdi/fpdi.php';
     if (!$this->is_enabled() || !$this->get_recipient()) {
         return;
     }
     $upload_dir = wp_upload_dir();
     // Array of key => value pairs
     //cosntruct ticket temp dir
     $tickettemp = $upload_dir['basedir'] . '/tickets_temp';
     if (!file_exists($tickettemp)) {
         mkdir($tickettemp, 0755, true);
     }
     $items = $this->object->get_items();
     $varation_ids = array();
     $metaorder = get_post_meta($this->object->id);
     $emaailid = $this->object->billing_email;
     $downloadlinks = array();
     $i = 0;
     foreach ($items as $key => $value) {
         $x = 1;
         $getprod = $this->object->get_product_from_item($value);
         $getdownload = $this->object->get_item_downloads($value);
         if ($getprod->product_type != 'ticket') {
             break;
         }
         if (empty($getdownload)) {
             break;
         }
         $qty = intval($value['qty']);
         while ($x <= $qty) {
             $x++;
             foreach ($getdownload as $keysub => $valuesub) {
                 $downlink = $valuesub['file'];
             }
             $path = $_SERVER['DOCUMENT_ROOT'] . parse_url($downlink, PHP_URL_PATH);
             $pdfout = $tickettemp . '/ticket_' . $this->object->id . '' . $value['product_id'] . '' . $x . '.pdf';
             $downloadlinks[$i] = $pdfout;
             $pagenum = 1;
             $pdf = new FPDI();
             $pdf->AddPage();
             //Set the source PDF file
             $pagecount = $pdf->setSourceFile($path);
             //Import the first page of the file
             $tpl = $pdf->importPage($pagenum);
             //Use this page as template
             $pdf->useTemplate($tpl);
             $getfooterY = $pdf->h - 35;
             //Select Arial italic 8
             $pdf->SetY($getfooterY);
             $pdf->SetFont('Arial', 'I', 10);
             $pdf->Cell(0, 10, 'Ticket id: ' . $this->object->id . '' . $value['product_id'] . '' . $x, 0, 0, 'C');
             $pdf->Output($pdfout, "F");
             $i++;
         }
     }
     /*
                 $email_class = new WC_Email();
                 remove_action( 'woocommerce_after_resend_order_email', array( $email_class->emails['WC_Email_Customer_Completed_Order'], 'trigger' ) );
                 remove_action( 'woocommerce_order_status_completed_notification', array( $email_class->emails['WC_Email_Customer_Completed_Order'], 'trigger' ) );
                 echo "<pre>";
                   var_dump( $this->emails );
                 echo "</pre>";
                   var_dump( $downloadlinks );
                   var_dump( $items );
                   var_dump( $emaailid);
                   var_dump( $this->object );
     */
     // woohoo, send the email!
     $this->send($this->get_recipient() . ', ' . $this->object->billing_email, $this->get_subject(), $this->get_content(), $this->get_headers(), $downloadlinks);
     //Delete the temp tickets
     foreach ($downloadlinks as $key => $value) {
         chmod($value, 0777);
         if (file_exists($value)) {
             unlink($value);
         }
     }
     //die();
 }
Example #9
0
 function ten_tardiness_second($second_offenders = array())
 {
     $this->load->library('fpdf');
     define('FPDF_FONTPATH', $this->config->item('fonts_path'));
     $this->load->library('fpdi');
     // initiate FPDI
     $pdf = new FPDI('P', 'mm', 'Legal');
     $pdf->SetLeftMargin(20);
     $pdf->SetRightMargin(15);
     // add a page
     $pdf->AddPage();
     // set the sourcefile
     $pdf->setSourceFile('dtr/template/notice2nd.pdf');
     // select the first page
     $tplIdx = $pdf->importPage(1);
     // use the page we imported
     $pdf->useTemplate($tplIdx);
     $offices = Input::get('offices');
     $office_id = $offices[0];
     $m1 = 'Jul';
     $m2 = 'Aug';
     $m3 = 'Sep';
     $m4 = 'Oct';
     $m5 = 'Nov';
     $m6 = 'Dec';
     $mo1 = '07';
     $mo2 = '08';
     $mo3 = '09';
     $mo4 = '10';
     $mo5 = '11';
     $mo6 = '12';
     $pdf->SetFont('Arial', '', '12');
     $pdf->SetXY(155, 50);
     $pdf->Write(0, date('F d, Y'));
     $pdf->SetX(35);
     $pdf->SetFont('Arial', 'B', '');
     $pdf->Cell(0, 6, "HON. EDWARD S. HAGEDORN ", '', 1, 'L', FALSE);
     $pdf->SetFont('Arial', '', '');
     $pdf->SetX(35);
     $pdf->Cell(0, 6, "City Mayor", '', 1, 'L', FALSE);
     $pdf->SetX(35);
     $pdf->Cell(0, 6, "Puerto Princesa City", '', 1, 'L', FALSE);
     $pdf->Cell(0, 6, "", '', 1, 'C', FALSE);
     $pdf->Cell(0, 6, "Thru: ATTY. SHIRLEY R. DAGANTA", '', 1, 'C', FALSE);
     $pdf->Cell(0, 6, "CG Assistant Dept. Head II", '', 1, 'C', FALSE);
     $pdf->Cell(0, 6, "Assistant City Legal Officer II", '', 1, 'C', FALSE);
     $pdf->Ln(12);
     $pdf->SetX(35);
     $pdf->SetFont('Arial', 'B', '');
     $pdf->Write(0, 'Madam:');
     $pdf->SetFont('Arial', '', '');
     $pdf->Ln(6);
     $pdf->SetX(35);
     $pdf->MultiCell(0, 6, "                Please be informed that despite the first notice issued to him/her as per records in this office, it has been observed that the he/she has continuously incurred the following tardiness and undertime, viz:", 0, 'L', false);
     //$pdf->SetX(35);
     //$pdf->Cell(0,6," $number of your employees has incurred the following, viz:",'',0,'L',false);
     $pdf->SetFont('Arial', 'BI', 10);
     $pdf->Ln(2);
     $pdf->SetFillColor(210, 210, 210);
     //$pdf->SetX(20);
     //header
     $pdf->Cell(50, 8, "Name", 'RLTB', 0, 'C', 1);
     $pdf->Cell(20, 4, $m1, '1', 0, 'C', 1);
     $pdf->Cell(20, 4, $m2, '1', 0, 'C', 1);
     $pdf->Cell(20, 4, $m3, '1', 0, 'C', 1);
     $pdf->Cell(20, 4, $m4, '1', 0, 'C', 1);
     $pdf->Cell(20, 4, $m5, '1', 0, 'C', 1);
     $pdf->Cell(20, 4, $m6, '1', 1, 'C', 1);
     $pdf->SetFont('Arial', '', 9);
     $pdf->SetFillColor(240, 240, 240);
     $pdf->Cell(50, 4, "", 'RLB', 0, 'C', false);
     $pdf->Cell(10, 4, "Tardy", '1', 0, 'C', 1);
     $pdf->Cell(10, 4, "UT", '1', 0, 'C', 1);
     $pdf->Cell(10, 4, "Tardy", '1', 0, 'C', 1);
     $pdf->Cell(10, 4, "UT", '1', 0, 'C', 1);
     $pdf->Cell(10, 4, "Tardy", '1', 0, 'C', 1);
     $pdf->Cell(10, 4, "UT", '1', 0, 'C', 1);
     $pdf->Cell(10, 4, "Tardy", '1', 0, 'C', 1);
     $pdf->Cell(10, 4, "UT", '1', 0, 'C', 1);
     $pdf->Cell(10, 4, "Tardy", '1', 0, 'C', 1);
     $pdf->Cell(10, 4, "UT", '1', 0, 'C', 1);
     $pdf->Cell(10, 4, "Tardy", '1', 0, 'C', 1);
     $pdf->Cell(10, 4, "UT", '1', 1, 'C', 1);
     $pdf->SetFillColor(215, 255, 215);
     $year1 = Input::get('year');
     $tardis = $second_offenders;
     if (is_array($tardis)) {
         foreach ($tardis as $tardi) {
             $name = $this->Employee->get_employee_info($tardi, $field = '');
             $late1 = $this->Tardiness->count_late($name['employee_id'], $mo1, $year1, 1, 3);
             $late2 = $this->Tardiness->count_late($name['employee_id'], $mo2, $year1, 1, 3);
             $late3 = $this->Tardiness->count_late($name['employee_id'], $mo3, $year1, 1, 3);
             $late4 = $this->Tardiness->count_late($name['employee_id'], $mo4, $year1, 1, 3);
             $late5 = $this->Tardiness->count_late($name['employee_id'], $mo5, $year1, 1, 3);
             $late6 = $this->Tardiness->count_late($name['employee_id'], $mo6, $year1, 1, 3);
             $under_time1 = $this->Tardiness->count_late($name['employee_id'], $mo1, $year1, 2, 4);
             $under_time2 = $this->Tardiness->count_late($name['employee_id'], $mo2, $year1, 2, 4);
             $under_time3 = $this->Tardiness->count_late($name['employee_id'], $mo3, $year1, 2, 4);
             $under_time4 = $this->Tardiness->count_late($name['employee_id'], $mo4, $year1, 2, 4);
             $under_time5 = $this->Tardiness->count_late($name['employee_id'], $mo5, $year1, 2, 4);
             $under_time6 = $this->Tardiness->count_late($name['employee_id'], $mo6, $year1, 2, 4);
             $late1['tardi_count'] = $this->Tardiness->is_tardy_zero($late1['tardi_count']);
             $late2['tardi_count'] = $this->Tardiness->is_tardy_zero($late2['tardi_count']);
             $late3['tardi_count'] = $this->Tardiness->is_tardy_zero($late3['tardi_count']);
             $late4['tardi_count'] = $this->Tardiness->is_tardy_zero($late4['tardi_count']);
             $late5['tardi_count'] = $this->Tardiness->is_tardy_zero($late5['tardi_count']);
             $late6['tardi_count'] = $this->Tardiness->is_tardy_zero($late6['tardi_count']);
             $under_time1['tardi_count'] = $this->Tardiness->is_tardy_zero($under_time1['tardi_count']);
             $under_time2['tardi_count'] = $this->Tardiness->is_tardy_zero($under_time2['tardi_count']);
             $under_time3['tardi_count'] = $this->Tardiness->is_tardy_zero($under_time3['tardi_count']);
             $under_time4['tardi_count'] = $this->Tardiness->is_tardy_zero($under_time4['tardi_count']);
             $under_time5['tardi_count'] = $this->Tardiness->is_tardy_zero($under_time5['tardi_count']);
             $under_time6['tardi_count'] = $this->Tardiness->is_tardy_zero($under_time6['tardi_count']);
             //start employee tardy
             $pdf->Cell(50, 4, ucwords(strtolower(utf8_decode($name['fname'] . ' ' . $name['mname'] . ' ' . $name['lname']))), 'RLTB', 0, 'L', false);
             $pdf->Cell(10, 4, $late1['tardi_count'], '1', 0, 'C', FALSE);
             $pdf->Cell(10, 4, $under_time1['tardi_count'], '1', 0, 'C', FALSE);
             $pdf->Cell(10, 4, $late2['tardi_count'], '1', 0, 'C', FALSE);
             $pdf->Cell(10, 4, $under_time2['tardi_count'], '1', 0, 'C', FALSE);
             $pdf->Cell(10, 4, $late3['tardi_count'], '1', 0, 'C', FALSE);
             $pdf->Cell(10, 4, $under_time3['tardi_count'], '1', 0, 'C', FALSE);
             $pdf->Cell(10, 4, $late4['tardi_count'], '1', 0, 'C', FALSE);
             $pdf->Cell(10, 4, $under_time4['tardi_count'], '1', 0, 'C', FALSE);
             $pdf->Cell(10, 4, $late5['tardi_count'], '1', 0, 'C', FALSE);
             $pdf->Cell(10, 4, $under_time5['tardi_count'], '1', 0, 'C', FALSE);
             $pdf->Cell(10, 4, $late6['tardi_count'], '1', 0, 'C', FALSE);
             $pdf->Cell(10, 4, $under_time6['tardi_count'], '1', 1, 'C', FALSE);
         }
     }
     $pdf->Cell(50, 4, "", 'RLTB', 0, 'L', FALSE);
     $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE);
     $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE);
     $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE);
     $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE);
     $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE);
     $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE);
     $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE);
     $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE);
     $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE);
     $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE);
     $pdf->Cell(10, 4, "", '1', 0, 'C', FALSE);
     $pdf->Cell(10, 4, "", '1', 1, 'C', FALSE);
     // line break
     $pdf->Ln(5);
     $pdf->SetFont('Arial', '', '12');
     $pdf->SetX(35);
     $pdf->MultiCell(0, 6, "             Section 8, Rule XVII of the Omnibus Rules Implementing Book V of Executive Order No. 292, states that: \n\t\t\t\t   'Officers and employees who have incurred tardiness and undertime, regardless of the number of minutes per day, ten (10) times a month for at least two (2) consecutive months during the year or for at least two (2) months in a semester shall be subject to disciplinary action.'\n\t\t\t\t   Violation of the said rule carries the following penalties:\n\t\t\n\t\t\t\t   1.\tFirst Offense - Reprimand;\n\t\t\t\t   2.\tSecond Offense - Suspension for one (1) day to thirty (30) days; and\n\t\t\t\t   3.\tThird Offense - Dismissal.\n\t\t\n\t\t\t\t   For your appropriate action.\n\t\t", '', 1, 'L', false);
     $pdf->Cell(0, 6, " Very truly yours,              ", 0, 'R', FALSE);
     $pdf->Cell(0, 6, "              ", '', 1, 'R', FALSE);
     $pdf->Cell(0, 6, "               ", '', 1, 'R', FALSE);
     $pdf->SetFont('Arial', 'B', '');
     $pdf->Cell(0, 6, " FELIMON R. SABAS              ", '', 1, 'R', FALSE);
     $pdf->SetFont('Arial', '', '');
     $pdf->Cell(0, 6, " CG Department Head II              ", '', 1, 'R', FALSE);
     $pdf->Cell(0, 6, " (City Personnel Officer)              ", '', 1, 'R', FALSE);
     $pdf->MultiCell(0, 6, "\n\t\tNOTED:\n\t\t\n\t\tBY AUTHORITY OF THE CITY MAYOR:", 0, 'L', FALSE);
     $pdf->SetFont('Arial', 'B', '');
     $pdf->Cell(0, 6, "    ATTY. AGUSTIN M. ROCAMORA", '', 1, 'L', FALSE);
     $pdf->SetFont('Arial', '', '');
     $pdf->Cell(0, 6, "       City Administrator II", '', 1, 'L', FALSE);
     header('Cache-Control: maxage=3600');
     //Adjust maxage appropriately
     header('Pragma: public');
     //If the parameter is D = download F = save as file
     $pdf->Output('dtr/reports/ten_tardiness_second.pdf', 'F');
 }
Example #10
0
 function cto_apps($id = '')
 {
     $c = CompensatoryTimeoff::find($id);
     $name = $this->Employee->get_employee_info($c->employee_id);
     $office_name = $this->Office->get_office_name($name['office_id']);
     $this->load->library('fpdf');
     define('FPDF_FONTPATH', $this->config->item('fonts_path'));
     $this->load->library('fpdi');
     $pdf = new FPDI('P', 'mm', 'Legal');
     // add a page
     $pdf->AddPage();
     // set the sourcefile
     $pdf->setSourceFile('dtr/template/app_for_offset.pdf');
     // select the first page
     $tplIdx = $pdf->importPage(1);
     // use the page we imported
     $pdf->useTemplate($tplIdx);
     // set font, font style, font size.
     $pdf->SetFont('Arial', 'B', 12);
     // set initial placement
     $pdf->SetXY(158, 10.5);
     $pdf->Write(0, 'Tracking no: ' . $id);
     $pdf->Ln(9);
     $pdf->SetX(158);
     $pdf->Ln(20);
     // go to 25 X (indent)
     $pdf->SetX(12);
     $this->Office->fields = array('office_code');
     $office = $this->Office->get_office_info($name['office_id']);
     // write office
     $pdf->SetFont('Arial', 'B', 10);
     $pdf->Write(0, $office['office_name']);
     $pdf->SetFont('Arial', 'B', 12);
     //lname
     $pdf->SetX(99);
     $pdf->Write(0, $name['lname']);
     //fname
     $pdf->SetX(145);
     $pdf->Write(0, $name['fname']);
     //mname
     $pdf->SetX(187);
     $pdf->Write(0, $name['mname'][0] . '.');
     $pdf->Ln(10);
     //date of file
     $pdf->SetX(20);
     $pdf->Write(0, $c->date_file);
     //position
     $pdf->SetFont('Arial', 'B', 10);
     $pdf->SetX(63);
     $pdf->Write(0, $name['position']);
     $pdf->SetFont('Arial', 'B', 12);
     // We need to check what salary grade the office use
     if ($office['salary_grade_type'] == 'hospital') {
         $this->Salary_grade->salary_grade_type = 'hospital';
     }
     //monthly salary
     $pdf->SetX(140);
     $pdf->Write(0, 'P ' . number_format($this->Salary_grade->get_monthly_salary($name['salary_grade'], $name['step']), 2));
     $days = 'day';
     if ($c->days > 1) {
         $days = 'days';
     }
     $pdf->Ln(13);
     $pdf->SetX(30);
     $pdf->Write(0, $c->days . ' ' . $days);
     $pdf->SetX(140);
     //$pdf->Write(0, 'daily rate here');
     $pdf->Ln(13);
     $pdf->SetX(50);
     $pdf->Write(0, $this->Helps->get_month_name($c->month) . ' ' . $c->dates . ', ' . $c->year);
     $cto_balances_as_of = date("F d, Y", strtotime($c->date_file . "-1 day"));
     $pdf->SetXY(30, 106);
     $pdf->Write(0, $cto_balances_as_of);
     // Compute balances
     // (balance + earn) - spent
     $cto = CompensatoryTimeoff::getBalance($c->employee_id);
     //$balance = $cto->days;
     $balance = $cto;
     $cto = CompensatoryTimeoff::getEarnedSpent($c->employee_id);
     //$earn = $cto->days;
     $earn = $cto;
     $cto = CompensatoryTimeoff::getEarnedSpent($c->employee_id, 'spent');
     //$spent = $cto->days;
     $spent = $cto;
     $total_balance = $balance + $earn - $spent;
     $pdf->SetXY(35, 116);
     $pdf->Write(0, $total_balance);
     $pdf->SetX(87);
     $pdf->Write(0, '');
     // hours here
     // Get office head
     $office = $this->Office->get_office_info($name['office_id']);
     // If detailed
     if ($name['detailed_office_id'] != 0) {
         $detailed_office = $this->Office->get_office_info($name['detailed_office_id']);
         $office['office_head'] = $detailed_office['office_head'];
         $office['position'] = $detailed_office['position'];
     }
     // If Employee is Department head
     $o = new Office_m();
     $o->get_by_employee_id($c->employee_id);
     if ($o->exists()) {
         $office['office_head'] = 'CARMENCITA O. REYES';
         $office['position'] = 'Governor';
     }
     // We need to work out for this as exception
     if ($c->employee_id == '61') {
         $office['office_head'] = 'ANTONIO L. UY, JR. M.D.';
         $office['position'] = 'Vice Governor';
     }
     $pdf->Ln(6);
     $pdf->SetX(120);
     $pdf->Cell(73, 4, strtoupper($office['office_head']), '0', 0, 'C', FALSE);
     $pdf->Ln(5);
     $pdf->SetFont('Arial', '', 10);
     $pdf->SetX(120);
     $pdf->Cell(73, 4, $office['position'], '0', 0, 'C', FALSE);
     $pdf->SetFont('Arial', 'B', 12);
     // Statement of CTO signatory
     $statement_certified = Setting::getField('cto_certification');
     $statement_certified_position = Setting::getField('cto_certification_position');
     $pdf->Ln(5);
     $pdf->SetX(22);
     $pdf->Cell(73, 4, strtoupper($statement_certified), '0', 0, 'C', FALSE);
     $pdf->Ln(5);
     $pdf->SetFont('Arial', '', 10);
     $pdf->SetX(22);
     $pdf->Cell(73, 4, $statement_certified_position, '0', 0, 'C', FALSE);
     $pdf->SetFont('Arial', 'B', 12);
     // ====================Second Form =============
     $pdf->Ln(44);
     $pdf->SetX(12);
     // write office
     $pdf->SetFont('Arial', 'B', 10);
     $pdf->Write(0, $office['office_name']);
     $pdf->SetFont('Arial', 'B', 12);
     //lname
     $pdf->SetX(99);
     $pdf->Write(0, $name['lname']);
     //fname
     $pdf->SetX(145);
     $pdf->Write(0, $name['fname']);
     //mname
     $pdf->SetX(187);
     $pdf->Write(0, $name['mname'][0] . '.');
     $pdf->Ln(10);
     //date of file
     $pdf->SetX(20);
     $pdf->Write(0, $c->date_file);
     //position
     $pdf->SetFont('Arial', 'B', 10);
     $pdf->SetX(63);
     $pdf->Write(0, $name['position']);
     $pdf->SetFont('Arial', 'B', 12);
     //monthly salary
     $pdf->SetX(140);
     $pdf->Write(0, 'P ' . number_format($this->Salary_grade->get_monthly_salary($name['salary_grade'], $name['step']), 2));
     $pdf->Ln(13);
     $pdf->SetX(30);
     $pdf->Write(0, $c->days . ' ' . $days);
     $pdf->SetX(140);
     //$pdf->Write(0, 'daily rate here');
     $pdf->Ln(13);
     $pdf->SetX(50);
     $pdf->Write(0, $this->Helps->get_month_name($c->month) . ' ' . $c->dates . ', ' . $c->year);
     $cto_balances_as_of = date("F d, Y", strtotime($c->date_file . "-1 day"));
     $pdf->Ln(30);
     $pdf->SetX(30);
     //$pdf->Write(0, $cto_balances_as_of);
     $pdf->Ln(10);
     $pdf->SetX(35);
     //$pdf->Write(0, $total_balance);
     $pdf->Ln(6);
     $pdf->SetX(120);
     $pdf->Cell(73, 4, strtoupper($office['office_head']), '0', 0, 'C', FALSE);
     $pdf->Ln(5);
     $pdf->SetFont('Arial', '', 10);
     $pdf->SetX(120);
     $pdf->Cell(73, 4, $office['position'], '0', 0, 'C', FALSE);
     $pdf->SetFont('Arial', 'B', 12);
     $pdf->Ln(5);
     $pdf->SetX(22);
     $pdf->Cell(73, 4, strtoupper($statement_certified), '0', 0, 'C', FALSE);
     $pdf->Ln(5);
     $pdf->SetFont('Arial', '', 10);
     $pdf->SetX(22);
     $pdf->Cell(73, 4, $statement_certified_position, '0', 0, 'C', FALSE);
     $pdf->SetFont('Arial', 'B', 12);
     header('Cache-Control: maxage=3600');
     //Adjust maxage appropriately
     header('Pragma: public');
     $pdf->Output('dtr/reports/cto-apps-' . intval($c->employee_id) . '.pdf', 'I');
     //return Redirect::to('dtr/reports/leave-apps-'.$rows['employee_id'].'.pdf', 'refresh');
 }
Example #11
0
function write_instruction($rec_ind, $q, $data)
{
    // $ind = recipe index, $q = quote array, $data = recipe data array
    // Dynamic Data
    $bul = html_entity_decode("&bull;", ENT_HTML401, "cp1252");
    $deg = html_entity_decode("&deg;", ENT_HTML401, "cp1252");
    $recipe = $data[$rec_ind][0];
    $style = $data[$rec_ind][1];
    $og = $data[$rec_ind][2];
    $fg = $data[$rec_ind][3];
    $abv = $data[$rec_ind][4] . "%";
    //$hop1 = $bul . " " . $data[$rec_ind][5];
    if (empty($data[$rec_ind][5])) {
        $hop1 = "";
    } else {
        $hop1 = $bul . " " . $data[$rec_ind][5];
    }
    if (empty($data[$rec_ind][6])) {
        $hop2 = "";
    } else {
        $hop2 = $bul . " " . $data[$rec_ind][6];
    }
    if (empty($data[$rec_ind][7])) {
        $hop3 = "";
    } else {
        $hop3 = $bul . " " . $data[$rec_ind][7];
    }
    if (empty($data[$rec_ind][8])) {
        $hop4 = "";
    } else {
        $hop4 = $bul . " " . $data[$rec_ind][8];
    }
    if (empty($data[$rec_ind][9])) {
        $hop5 = "";
    } else {
        $hop5 = $bul . " " . $data[$rec_ind][9];
    }
    if (empty($data[$rec_ind][10])) {
        $hop6 = "";
    } else {
        $hop6 = $bul . " " . $data[$rec_ind][10];
    }
    if (empty($data[$rec_ind][11])) {
        $sp_inst = "No special instructions needed. Instead, we have included a quote about beer: \n" . $q[rand(0, 12)];
    } else {
        $sp_inst = $data[$rec_ind][11];
    }
    if (empty($data[$rec_ind][12])) {
        $ing1 = "";
    } else {
        $ing1 = $bul . " " . $data[$rec_ind][12];
    }
    if (empty($data[$rec_ind][13])) {
        $ing2 = "";
    } else {
        $ing2 = $bul . " " . $data[$rec_ind][13];
    }
    if (empty($data[$rec_ind][14])) {
        $ing3 = "";
    } else {
        $ing3 = $bul . " " . $data[$rec_ind][14];
    }
    if (empty($data[$rec_ind][15])) {
        $ing4 = "";
    } else {
        $ing4 = $bul . " " . $data[$rec_ind][15];
    }
    if (empty($data[$rec_ind][16])) {
        $ing5 = "";
    } else {
        $ing5 = $bul . " " . $data[$rec_ind][16];
    }
    if (empty($data[$rec_ind][17])) {
        $ing6 = "";
    } else {
        $ing6 = $bul . " " . $data[$rec_ind][17];
    }
    if (empty($data[$rec_ind][18])) {
        $ing7 = "";
    } else {
        $ing7 = $bul . " " . $data[$rec_ind][18];
    }
    if (empty($data[$rec_ind][19])) {
        $ing8 = "";
    } else {
        $ing8 = $bul . " " . $data[$rec_ind][19];
    }
    if (empty($data[$rec_ind][20])) {
        $ing9 = "";
    } else {
        $ing9 = $bul . " " . $data[$rec_ind][20];
    }
    if (empty($data[$rec_ind][21])) {
        $ing10 = "";
    } else {
        $ing10 = $bul . " " . $data[$rec_ind][21];
    }
    if (empty($data[$rec_ind][22])) {
        $ing11 = "";
    } else {
        $ing11 = $bul . " " . $data[$rec_ind][22];
    }
    if (empty($data[$rec_ind][23])) {
        $ing12 = "";
    } else {
        $ing12 = $bul . " " . $data[$rec_ind][23];
    }
    if (empty($data[$rec_ind][24])) {
        $ing13 = "";
    } else {
        $ing13 = $bul . " " . $data[$rec_ind][24];
    }
    if (empty($data[$rec_ind][25])) {
        $ing14 = "";
    } else {
        $ing14 = $bul . " " . $data[$rec_ind][25];
    }
    if (empty($data[$rec_ind][26])) {
        $ing15 = "";
    } else {
        $ing15 = $bul . " " . $data[$rec_ind][26];
    }
    if (empty($data[$rec_ind][27])) {
        $ing16 = "";
    } else {
        $ing16 = $bul . " " . $data[$rec_ind][27];
    }
    if (empty($data[$rec_ind][28])) {
        $ing17 = "";
    } else {
        $ing17 = $bul . " " . $data[$rec_ind][28];
    }
    if (empty($data[$rec_ind][29])) {
        $ing18 = "";
    } else {
        $ing18 = $bul . " " . $data[$rec_ind][29];
    }
    // Initiate FPDI & FPDF
    $pdf = new FPDI();
    $pdf->setSourceFile("extract_template.pdf");
    // Create page 1 & Read Template Page 1
    $pdf->AddPage('P', 'Letter');
    $tmp = $pdf->importPage(1);
    $pdf->useTemplate($tmp, 0, 0);
    // Declare Fonts
    $pdf->AddFont('Kenyancoffee', '', 'Kenyancoffeerg.php');
    $pdf->AddFont('Roboto', '', 'Roboto-Regular.php');
    $pdf->AddFont('Roboto', 'L', 'Roboto-Light.php');
    $pdf->AddFont('Roboto', 'B', 'Roboto-Bold.php');
    // Write Dynamic Data - Header
    $pdf->SetFont('Kenyancoffee', '', 23);
    $pdf->SetTextColor(229, 80, 84);
    $pdf->SetXY(57.3, 19);
    $pdf->Cell(0, 0, $recipe);
    $pdf->SetFont('Roboto', 'L', 9.9);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->SetXY(57.3, 25.5);
    $pdf->Cell(0, 0, $style);
    $pdf->SetFont('Roboto', 'L', 9.9);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->SetXY(65.2, 36.2);
    $pdf->Cell(0, 0, $og);
    $pdf->SetFont('Roboto', 'L', 9.9);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->SetXY(85.2, 36.2);
    $pdf->Cell(0, 0, $fg);
    $pdf->SetFont('Roboto', 'L', 9.9);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->SetXY(108.5, 36.2);
    $pdf->Cell(0, 0, $abv);
    // Write Dynamic Data - Ingredients
    $pdf->SetFont('Roboto', 'B', 7.5);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetXY(5.3, 156.5);
    $pdf->Cell(0, 0, $ing1);
    $pdf->SetFont('Roboto', 'B', 7.5);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetXY(5.3, 161.5);
    $pdf->Cell(0, 0, $ing2);
    $pdf->SetFont('Roboto', 'B', 7.5);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetXY(5.3, 166.5);
    $pdf->Cell(0, 0, $ing3);
    $pdf->SetFont('Roboto', 'B', 7.5);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetXY(5.3, 171.5);
    $pdf->Cell(0, 0, $ing4);
    $pdf->SetFont('Roboto', 'B', 7.5);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetXY(5.3, 176.5);
    $pdf->Cell(0, 0, $ing5);
    $pdf->SetFont('Roboto', 'B', 7.5);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetXY(5.3, 181.5);
    $pdf->Cell(0, 0, $ing6);
    $pdf->SetFont('Roboto', 'B', 7.5);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetXY(5.3, 186.5);
    $pdf->Cell(0, 0, $ing7);
    $pdf->SetFont('Roboto', 'B', 7.5);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetXY(5.3, 191.5);
    $pdf->Cell(0, 0, $ing8);
    $pdf->SetFont('Roboto', 'B', 7.5);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetXY(5.3, 196.5);
    $pdf->Cell(0, 0, $ing9);
    $pdf->SetFont('Roboto', 'B', 7.5);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetXY(5.3, 201.5);
    $pdf->Cell(0, 0, $ing10);
    $pdf->SetFont('Roboto', 'B', 7.5);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetXY(5.3, 206.5);
    $pdf->Cell(0, 0, $ing11);
    $pdf->SetFont('Roboto', 'B', 7.5);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetXY(5.3, 211.5);
    $pdf->Cell(0, 0, $ing12);
    $pdf->SetFont('Roboto', 'B', 7.5);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetXY(5.3, 216.5);
    $pdf->Cell(0, 0, $ing13);
    $pdf->SetFont('Roboto', 'B', 7.5);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetXY(5.3, 221.5);
    $pdf->Cell(0, 0, $ing14);
    $pdf->SetFont('Roboto', 'B', 7.5);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetXY(5.3, 226.5);
    $pdf->Cell(0, 0, $ing15);
    $pdf->SetFont('Roboto', 'B', 7.5);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetXY(5.3, 231.5);
    $pdf->Cell(0, 0, $ing16);
    $pdf->SetFont('Roboto', 'B', 7.5);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetXY(5.3, 236.5);
    $pdf->Cell(0, 0, $ing17);
    $pdf->SetFont('Roboto', 'B', 7.5);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetXY(5.3, 241.5);
    $pdf->Cell(0, 0, $ing18);
    // Write Dynamic Data - Hop Schedule
    $pdf->SetFont('Roboto', '', 7.5);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->SetXY(114, 171);
    $pdf->Cell(0, 0, $hop1);
    $pdf->SetFont('Roboto', '', 7.5);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->SetXY(114, 174.2);
    $pdf->Cell(0, 0, $hop2);
    $pdf->SetFont('Roboto', '', 7.5);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->SetXY(114, 177.4);
    $pdf->Cell(0, 0, $hop3);
    $pdf->SetFont('Roboto', '', 7.5);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->SetXY(114, 180.6);
    $pdf->Cell(0, 0, $hop4);
    $pdf->SetFont('Roboto', '', 7.5);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->SetXY(114, 183.8);
    $pdf->Cell(0, 0, $hop5);
    $pdf->SetFont('Roboto', '', 7.5);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->SetXY(114, 187);
    $pdf->Cell(0, 0, $hop6);
    // Create page 2 & Read Template Page 2
    $pdf->AddPage('P', 'Letter');
    $tmp = $pdf->importPage(2);
    $pdf->useTemplate($tmp, 0, 0);
    // Write Dynamic Data - Special Instructions
    $pdf->SetFont('Roboto', '', 7.5);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetXY(11, 13);
    $pdf->MultiCell(165, 3, utf8_decode($sp_inst));
    $shortname = str_replace(' ', '', $recipe);
    $filename = "C:/Users/tyler/Google Drive/MonsterBrew/Product/Recipe Kits/Instructions/Instructions - Extract/EX_INS_" . $shortname . ".pdf";
    $pdf->Output($filename, 'F');
}
<?php

if (@$_POST['id_certificado']) {
    global $wpdb;
    $certificado = $wpdb->get_row($wpdb->prepare("SELECT c.id as id, c.nome as nome, e.id as evento_id FROM participantes c INNER JOIN " . "evento e ON (e.id = c.evento_id) WHERE c.id=%d", $_POST['id_certificado']));
    require get_stylesheet_directory() . '/inc/fpdf/fpdf.php';
    require get_stylesheet_directory() . '/inc/fpdf/fpdi.php';
    $pdf = new FPDI('L', 'mm', "A4");
    $pdf->setSourceFile(get_stylesheet_directory() . "/certificados/evento_" . $certificado->evento_id . ".pdf");
    $pdf->AddPage('L');
    $tplidx = $pdf->importPage(1, '/MediaBox');
    $pdf->useTemplate($tplidx, 0, 0, 297, 210, true);
    $pdf->SetXY(10, 85);
    //Informamos a fonte, seu estilo e seu tamanho
    $pdf->SetFont('Arial', '', 28);
    $pdf->Cell(0, 8, iconv("UTF-8", "CP1252", $certificado->nome), 0, 1, 'C');
    $arquivo_certificado = preg_replace('/[^A-Za-z0-9\\-]/', '', str_replace(" ", "_", $certificado->nome)) . ".pdf";
    $pdf->Output($arquivo_certificado, 'D');
    $wpdb->query($wpdb->prepare("UPDATE participantes SET data_geracao = CURRENT_TIMESTAMP WHERE id=%d", $_POST['id_certificado']));
}
get_header();
?>

<section>
	<div class="container mt-lg mb-lg">
		<?php 
if (have_posts()) {
    ?>
			<?php 
    while (have_posts()) {
        the_post();
else
	$pdf = new FPDI();


if ($msgSqlVacio == "") {
	$pdf->setSourceFile($_SERVER["DOCUMENT_ROOT"]."/modules/solicitud_afiliacion/templates/responsabilidad_civil.pdf");
	$pdf->SetDrawColor(255, 255, 255);
	$pdf->SetFillColor(255, 255, 255);

	$pdf->AddPage();
	$tplIdx = $pdf->importPage(1);
	$pdf->useTemplate($tplIdx);
	$pdf->SetFont("Arial", "B", 9);

	$pdf->Ln(30);
	$pdf->Cell(168);
	$pdf->Cell(0, 0, "PCI".$row2["IDFORMULARIO"]);

	$pdf->Ln(5);
	$pdf->SetDrawColor(0, 0, 0);
	if ($row2["BOLETA"] == "") {
		$pdf->Cell(46);
		$pdf->Cell(7, 0, "", 1, 0, "C");
	}
	if ($row2["DEBITO"] == "") {
		$pdf->Ln(0.1);
		$pdf->Cell(57);
		$pdf->Cell(18.6, 0, "", 1, 0, "C");
	}
	$pdf->SetDrawColor(255, 255, 255);
Example #14
0
	$pdf = new FPDI();

$pdf->setSourceFile(DATA_AVISO_OBRA_PATH.$_REQUEST["filename"].".".$_REQUEST["extension"]);
$pdf->AddPage();
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx);

$_REQUEST["x"] = $_REQUEST["x"] * 0.686;
$_REQUEST["y"] = $_REQUEST["y"] * 0.728;

if ($_REQUEST["tipoSello"] == "n") {
	$pdf->SetFont("Arial", "B", 14);
	$pdf->SetTextColor(0, 0, 0);

	$pdf->SetXY($_REQUEST["x"] + 8, $_REQUEST["y"] + 18);
	$pdf->Cell(0, 0, "NO CORRESPONDE PRESENTACIÓN");
	$pdf->SetXY($_REQUEST["x"] + 11, $_REQUEST["y"] + 24);
	$pdf->Cell(0, 0, "POR ACTIVIDAD DESARROLLADA");
}
else {
	$pdf->SetFont("Arial", "B", 16);
	switch ($_REQUEST["tipoSello"]) {
		case "e":
			$pdf->SetDrawColor(0, 0, 196);
			$pdf->SetTextColor(0, 0, 196);
			break;
		case "h":
			$pdf->SetDrawColor(196, 0, 0);
			$pdf->SetTextColor(196, 0, 0);
			break;
		case "i":
function watermark_and_sent(stdClass $issuedcert)
{
    global $CFG, $USER, $COURSE, $DB, $PAGE;
    if ($issuedcert->haschange) {
        //This issue have a haschange flag, try to reissue
        if (empty($issuedcert->timedeleted)) {
            require_once $CFG->dirroot . '/mod/simplecertificate/locallib.php';
            try {
                // Try to get cm
                $cm = get_coursemodule_from_instance('simplecertificate', $issuedcert->certificateid, 0, false, MUST_EXIST);
                $context = context_module::instance($cm->id);
                //Must set a page context to issue ....
                $PAGE->set_context($context);
                $simplecertificate = new simplecertificate($context, null, null);
                $file = $simplecertificate->get_issue_file($issuedcert);
            } catch (moodle_exception $e) {
                // Only debug, no errors
                debugging($e->getMessage(), DEBUG_DEVELOPER, $e->getTrace());
            }
        } else {
            //Have haschange and timedeleted, somehting wrong, it will be impossible to reissue
            //add wraning
            debugging("issued certificate [{$issuedcert->id}], have haschange and timedeleted");
        }
        $issuedcert->haschange = 0;
        $DB->update_record('simplecertificate_issues', $issuedcert);
    }
    if (empty($file)) {
        $fs = get_file_storage();
        if (!$fs->file_exists_by_hash($issuedcert->pathnamehash)) {
            print_error(get_string('filenotfound', 'simplecertificate', ''));
        }
        $file = $fs->get_file_by_hash($issuedcert->pathnamehash);
    }
    $canmanage = false;
    if (!empty($COURSE)) {
        $canmanage = has_capability('mod/simplecertificate:manage', context_course::instance($COURSE->id));
    }
    if ($canmanage || !empty($USER) && $USER->id == $issuedcert->userid) {
        send_stored_file($file, 0, 0, true);
    } else {
        require_once $CFG->libdir . '/pdflib.php';
        require_once $CFG->dirroot . '/mod/simplecertificate/lib/fpdi/fpdi.php';
        // copy to a tmp file
        $tmpfile = $file->copy_content_to_temp();
        // TCPF doesn't import files yet, so i must use FPDI
        $pdf = new FPDI();
        $pageCount = $pdf->setSourceFile($tmpfile);
        for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
            // import a page
            $templateId = $pdf->importPage($pageNo);
            // get the size of the imported page
            $size = $pdf->getTemplateSize($templateId);
            // create a page (landscape or portrait depending on the imported page size)
            if ($size['w'] > $size['h']) {
                $pdf->AddPage('L', array($size['w'], $size['h']));
                // Font size 1/3 Height if it landscape
                $fontsize = $size['h'] / 3;
            } else {
                $pdf->AddPage('P', array($size['w'], $size['h']));
                // Font size 1/3 Width if it portrait
                $fontsize = $size['w'] / 3;
            }
            // use the imported page
            $pdf->useTemplate($templateId);
            // Calculating the rotation angle
            $rotAngle = atan($size['h'] / $size['w']) * 180 / pi();
            // Find the middle of the page to use as a pivot at rotation.
            $mX = $size['w'] / 2;
            $mY = $size['h'] / 2;
            // Set the transparency of the text to really light
            $pdf->SetAlpha(0.25);
            $pdf->StartTransform();
            $pdf->Rotate($rotAngle, $mX, $mY);
            $pdf->SetFont("freesans", "B", $fontsize);
            $pdf->SetXY(0, $mY);
            $boder_style = array('LTRB' => array('width' => 2, 'dash' => $fontsize / 5, 'cap' => 'round', 'join' => 'round', 'phase' => $fontsize / $mX));
            $pdf->Cell($size['w'], $fontsize, get_string('certificatecopy', 'simplecertificate'), $boder_style, 0, 'C', false, '', 4, true, 'C', 'C');
            $pdf->StopTransform();
            // Reset the transparency to default
            $pdf->SetAlpha(1);
        }
        // Set protection seems not work, so comment
        // $pdf->SetProtection(array('print', 'modify', 'print-high'),null, random_string(), '1',null);
        // For DEGUG
        // $pdf->Output($file->get_filename(), 'I');
        // Save and send tmpfiles
        $pdf->Output($tmpfile, 'F');
        send_temp_file($tmpfile, $file->get_filename());
    }
}
Example #16
0
	$stmt = DBExecSP($conn, $curs, $sql, $params);
	$row = DBGetSP($curs, false);

	//	*******  INICIO - Armado del reporte..  *******
	$pdf = new FPDI();

	$pdf->setSourceFile($_SERVER["DOCUMENT_ROOT"]."/modules/usuarios_registrados/clientes/denuncias_de_siniestros/templates/denuncia_siniestro.pdf");
	$pdf->AddPage();
	$tplIdx = $pdf->importPage(1);
	$pdf->useTemplate($tplIdx);
	$pdf->SetFont("Arial", "", 8);

	$pdf->Ln(15);
	switch ($row["EW_TIPOSINIESTRO"]) {
		case 1:
			$pdf->Cell(81);
			$pdf->Cell(0, 0, "X");
			break;
		case 2:
			$pdf->Cell(113);
			$pdf->Cell(0, 0, "X");
			break;
		case 3:
			$pdf->Cell(45.2);
			$pdf->Cell(0, 0, "X");
			break;
	}

	$pdf->Ln(4);
	$pdf->Cell(154);
	$pdf->Cell(0, 0, str_replace("/", "     ", $row["EW_FECHASIN"]));
		 FROM cfi_firma
		WHERE fi_id = 444";		// Queda fijo Ana Bordachar..
$stmt = DBExecSql($conn, $sql, array());
$rowFirmante = DBGetQuery($stmt, 1, false);

$pdf = new FPDI();
$pdf->setSourceFile($_SERVER["DOCUMENT_ROOT"]."/modules/usuarios_registrados/agentes_comerciales/comisiones/templates/ingresos_brutos_generico.pdf");

$pdf->AddPage();
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx);
$pdf->SetFont("Arial", "", 13);

$numeroComprobante = str_pad($row["NROCOMPROBANTE"], 12, "0", STR_PAD_LEFT);
$pdf->Ln(4.6);
$pdf->Cell(148);
$pdf->Cell(0, 0, substr($numeroComprobante, 0, 4)."-".substr($numeroComprobante, 4));

$pdf->SetFont("Arial", "B", 12);
$pdf->Ln(14);
$pdf->Cell(2);
$pdf->Cell(0, 0, "Provincia Aseguradora de Riesgos de Trabajo S.A.");

$pdf->SetFont("Arial", "", 10);
$pdf->Ln(6);
$pdf->Cell(2);
$pdf->Cell(0, 0, "Carlos Pellegrini 91 1º Piso - Capital Federal");

$pdf->Ln(6);
$pdf->Cell(2);
$pdf->Cell(0, 0, "C.P. 1009");
    function preview($rows, $report_name = '')
    {
        $html = '
		
		<table width="100%" border="0">
	  <tr>
		<td colspan="3" align="center">' . $report_name . '</td>
	  </tr>
	  <tr>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
	  </tr>
	</table>
			
	<table width="100%" border="1">
	<tbody><tr>
	  <td width="10%"><strong>Employee ID</strong></td>
	  <td width="9%"><strong>Name</strong></td>
	  <td width="4%"><strong>Sex</strong></td>
	  <td width="10%"><strong>Position/<br />
		Designation</strong></td>
	  <td width="13%"><strong>Office / Department</strong></td>
	  <td width="11%"><strong>Employment Status</strong></td>
	  <td width="6%"><strong>Salary Grade</strong></td>
	  <td width="9%"><strong>Eligibility</strong></td>
	  <td width="11%"><strong>Education</strong></td>
	  <td width="8%"><strong>Birthday</strong></td>
	  <td width="9%"><strong>Address</strong></td></tr>';
        $office = new Orm_office();
        foreach ($rows as $row) {
            $office->get_by_office_id($row->office_id);
            $type_employment = $this->options->type_employment();
            $birth_date = $row->birth_date;
            if ($row->birth_date == '0000-00-00') {
                $birth_date = '';
            }
            $html .= '
	<tr>
		<td>' . $row->id . '</td>
		 <td>' . $row->lname . ',' . $row->fname . ' ' . $row->mname . '</td>
		 <td>' . $row->sex . '</td>
		 <td>' . $row->position . '</td>
		 <td>' . $office->office_name . '</td>
		 <td>' . $type_employment[$row->permanent] . '</td>
		 <td>' . $row->salary_grade . '-' . $row->step . '</td>
		 <td>' . $row->eligibility . '</td>
		 <td>' . $row->education . '</td>
		 <td>' . $birth_date . '</td>
		 <td>' . $row->res_address . '</td>
	</tr>';
        }
        $html .= '
<tr><td><p>&nbsp;</p></td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td><td>&nbsp;</td></tr>
</tbody></table>';
        // Signatories
        $sr_prepared = $this->Settings->get_selected_field('sr_prepared');
        $sr_prepared_position = $this->Settings->get_selected_field('sr_prepared_position');
        $sr_certified = $this->Settings->get_selected_field('sr_certified');
        $sr_certified_position = $this->Settings->get_selected_field('sr_certified_position');
        $html .= '
	<table width="100%" border="0">
	  <tr>
		<td width="38%">&nbsp;</td>
		<td width="23%">&nbsp;</td>
		<td width="39%">&nbsp;</td>
	  </tr>
	  <tr>
		<td align="center">PREPARED BY:</td>
		<td>&nbsp;</td>
		<td align="center">CERTIFIED CORRECT:</td>
	  </tr>
	  <tr>
		<td align="center">&nbsp;</td>
		<td>&nbsp;</td>
		<td align="center">&nbsp;</td>
	  </tr>
	  <tr>
		<td align="center">&nbsp;</td>
		<td>&nbsp;</td>
		<td align="center">&nbsp;</td>
	  </tr>
	  <tr>
		<td align="center">' . $sr_prepared . '</td>
		<td>&nbsp;</td>
		<td align="center">' . $sr_certified . '</td>
	  </tr>
	  <tr>
		<td align="center">' . $sr_prepared_position . '</td>
		<td>&nbsp;</td>
		<td align="center">' . $sr_certified_position . '</td>
	  </tr>
	</table>
	';
        $this->load->library('MPDF52/mpdf');
        //$this->mpdf->WriteHTML('<p>Hello There hahahaha</p>');
        //$this->mpdf->Output('mpdf.pdf','I');
        // LOAD a stylesheet
        $stylesheet = file_get_contents(base_url() . 'css/mpdf/mpdfstyletables.css');
        $this->mpdf->WriteHTML($stylesheet, 1);
        // The parameter 1 tells that this is css/style only and no body/html/text
        $this->mpdf->WriteHTML($html);
        $this->mpdf->Output('dtr/template/pds/archives/pds_' . date('Y_m_d') . '.pdf', 'F');
        return 'dtr/template/pds/archives/pds_' . date('Y_m_d') . '.pdf';
        exit;
        $this->load->helper('settings');
        $this->load->library('fpdf');
        //define('FPDF_FONTPATH',$this->config->item('fonts_path'));
        $this->load->library('fpdi');
        // initiate FPDI
        $pdf = new FPDI('L', 'mm', 'Letter');
        // add a page
        $pdf->AddPage();
        // set the sourcefile
        //$pdf->setSourceFile('dtr/template/service_record/service_record.pdf');
        // import page 1
        //$tplIdx = $pdf->importPage(1);
        // use the imported page and place it at point 10,10 with a width of 100 mm
        //$pdf->useTemplate($tplIdx, 1, 1, 210);
        // now write some text above the imported page
        $pdf->SetFont('Arial');
        $pdf->SetTextColor(0, 0, 0);
        $pdf->SetXY(15, 60);
        $pdf->SetFont('Arial', '', 16);
        $pdf->Cell(0, 3, "Report Name", '', 1, 'C', false);
        //$pdf->Ln(4);
        //$e = new Employee_m();
        //$e->get_by_employee_id( $employee_id );
        $pdf->SetFont('Arial', '', 12);
        //$pdf->Cell(0,8,"Employee No.:".$e->id ,'',1,'L',false);
        //$pdf->Ln(2);
        //$pdf->SetFont('Arial', '', 12);
        //$pdf->Cell(0,8,"Employee Name:".$e->lname.', '.$e->fname.' '.$e->mname ,'',1,'L',false);
        $pdf->Ln(4);
        $pdf->Cell(0, 8, "Emp ID    Name                  Sex     Position/Designation    Office    Employment Status     Salary Grade Eligibility Education Birth Day   Address", '1', 1, 'L', false);
        $pdf->Ln(4);
        $i = 1;
        $this->load->helper('text');
        //$pdf->Cell(30,12, word_wrap('msayado maahhn ndhah ahhhehe so ano gagawin mo now', 10) ,'1',1,'L',false);
        //$pdf->MultiCell(30,3,word_wrap("hello this is a sample nlong text with line break ", 15) ,'1',1,'L',false);
        //$pdf->MultiCell(30,3,word_wrap("hello this is a sample nlong text with line break ", 15) ,'0',1,'L',false);
        foreach ($rows as $row) {
            $pdf->SetFont('Arial', '', 11);
            $pdf->SetX(10);
            //$pdf->Write(0, $row->id);
            $pdf->Cell(15, 12, $row->id, '1', 0, 'L', false);
            $pdf->SetX(29);
            //$pdf->Write(0, $row->lname.', '.$row->fname.''.$row->mname);
            $pdf->Cell(30, 12, word_wrap($row->lname . ', ' . $row->fname . '' . $row->mname, 10), '1', 1, 'L', false);
            $pdf->SetFont('Arial', '', 8);
            $pdf->SetX(62);
            $pdf->Write(0, $row->sex);
            $pdf->SetX(75);
            //$pdf->Write(0, $row->company);
            $pdf->Write(0, $row->position);
            //$pdf->SetFont('Arial', '', 12);
            $pdf->SetX(160);
            $pdf->Write(0, $row->movement);
            //$pdf->SetX(150);
            //$pdf->Write(0, $row->salary_grade);
            $pdf->SetFont('Arial', '', 8);
            $pdf->SetX(185);
            //$pdf->Write(0, $row->status);
            if ($row->govt_service == 1) {
                $row->govt_service = 'Yes';
            } else {
                $row->govt_service = 'No';
            }
            $pdf->SetX(190);
            //$pdf->Write(0, $row->govt_service);
            $pdf->SetFont('Arial', '', 12);
            if ($i == 6 || $i == 10 || $i == 13 || $i == 16 || $i == 19 || $i == 22) {
                $pdf->Ln(8);
            } else {
                $pdf->Ln(7);
            }
            $i++;
        }
        $pdf->Cell(0, 8, "--------------------------------------------------------- Nothing Follows ---------------------------------------------------------", '', 1, 'C', false);
        // Signatories
        $pdf->Ln(15);
        $pdf->SetX(20);
        $pdf->Cell(90, 5, "PREPARED BY:", '0', 0, 'C', false);
        $pdf->Cell(90, 5, "CERTIFIED CORRECT:", '0', 1, 'C', false);
        $pdf->Ln(10);
        $sr_prepared = $this->Settings->get_selected_field('sr_prepared');
        $sr_prepared_position = $this->Settings->get_selected_field('sr_prepared_position');
        $sr_certified = $this->Settings->get_selected_field('sr_certified');
        $sr_certified_position = $this->Settings->get_selected_field('sr_certified_position');
        $pdf->SetX(20);
        $pdf->Cell(90, 5, $sr_prepared, '0', 0, 'C', false);
        //4th param border
        $pdf->Cell(90, 5, $sr_certified, '0', 1, 'C', false);
        $pdf->SetX(20);
        $pdf->Cell(90, 5, $sr_prepared_position, '0', 0, 'C', false);
        $pdf->Cell(90, 5, $sr_certified_position, '0', 1, 'C', false);
        // Output
        $pdf->Output('dtr/template/pds/archives/pds_' . date('Y_m_d') . '.pdf', 'F');
        return 'dtr/template/pds/archives/pds_' . date('Y_m_d') . '.pdf';
    }
		$pdf->Text(58, 73, $rowCabecera["FECHA_CHEQUE"]);
		$pdf->Text(83, 73, $rowCabecera["OPAGO"]);
		$pdf->Text(105, 73, $rowCabecera["DESCRIPCION"]);
		$pdf->Text(170, 73, $rowCabecera["MONTOREEMP"]);
//---------------------------------------------------------------------------				
		$i = 1;
		$netoAPagar = 0;
		$posX = 0;
		
		$stmt = DBExecSql($conn, $sqlMain, $paramsMain);
		while ($row = DBGetQuery($stmt, 1, false)) {
			if ($i == 1 && $netoAPagar > 0) {	$pdf->AddPage();}
			
			$posX = (93 + ($i*4));
			$pdf->SetXY(20, $posX);			
			$pdf->Cell(20, 0, $row["DESCRIPTION"], 0, 0, 'L' );
			
			$pdf->SetX(40);			
			$pdf->Cell(50, 0, $row["BANK_NAME"], 0, 0, 'L' );
			
			$pdf->SetX(88);			
			$pdf->Cell(20, 0, $row["BANK_ACCOUNT_NUM"], 0, 0, 'L' );
			
			$pdf->SetX(120);			
			$pdf->Cell(20, 0, $row["CHEQUE"], 0, 0, 'L' );
			
			$pdf->SetX(146);			
			$pdf->Cell(20, 0, $row["FECHA_OP"], 0, 0, 'L' );
			
			$pdf->SetX(170);			
			$pdf->Cell(20, 0, $row["MONTO"], 0, 0, 'R' );
	"SELECT fi_caracter, fi_firmante
		 FROM cfi_firma
		WHERE fi_id = 444";		// Queda fijo Ana Bordachar..
$stmt = DBExecSql($conn, $sql, array());
$rowFirmante = DBGetQuery($stmt, 1, false);

$pdf = new FPDI();
$pdf->setSourceFile($_SERVER["DOCUMENT_ROOT"]."/modules/usuarios_registrados/agentes_comerciales/comisiones/templates/ingresos_brutos_4.pdf");

$pdf->AddPage();
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx);
$pdf->SetFont("Arial", "B", 9);

$pdf->Ln(41.8);
$pdf->Cell(39.6);
$pdf->Cell(80, 0, "Provincia Aseguradora de Riesgos de Trabajo S.A.");

$pdf->Ln(5.4);
$pdf->Cell(39.6);
$pdf->Cell(80, 0, "Carlos Pellegrini 91 1º Piso - Capital Federal");

$pdf->Ln(5);
$pdf->Cell(39.6);
$pdf->Cell(0, 0, "30-68825409-0");

$pdf->SetFont("Arial", "", 10);
$pdf->Ln(-4.6);
$pdf->Cell(152);
$pdf->Cell(8, 0, $row["ANOFECHA"]);
$rowE = DBGetQuery($stmt, 1, false);

if ($autoPrint)
	$pdf = new PDF_AutoPrint();
else
	$pdf = new FPDI();

$pdf->setSourceFile($_SERVER["DOCUMENT_ROOT"]."/modules/solicitud_afiliacion/templates/exposicion_riesgos_quimicos.pdf");

$pdf->AddPage("L");
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx, null, null, 0, 0, true);
$pdf->SetFont("Arial", "B", 9);

$pdf->Ln(22);
$pdf->Cell(16);
$pdf->Cell(252, 0, $row2["SA_NOMBRE"]);

$pdf->Cell(20);
$pdf->Cell(0, 0, $row2["CUIT"]);

$pdf->Ln(8);
$pdf->Cell(44);
$pdf->Cell(84, 0, $rowE["NROESTABLECIMIENTO"]);

$pdf->Cell(20);
$pdf->Cell(48, 0, $rowE["CIIU"]);

$pdf->Cell(22);
$pdf->Cell(76, 0, $rowE["ACTIVIDAD"]);
Example #22
0
 public function executeBatchPrintBadge(sfWebRequest $request)
 {
     $ids = $request->getParameter('ids');
     // initiate FPDI
     $pdf = new FPDI('P', 'pt');
     // set the sourcefile
     $pdf->setSourceFile(sfConfig::get('sf_upload_dir') . '/badges/ID_new.pdf');
     foreach ($ids as $id) {
         $this->employee = EmployeePeer::retrieveByPk($id);
         // import page 1
         $tplIdx = $pdf->importPage(1);
         // add a new page based on size of the badge
         $s = $pdf->getTemplatesize($tplIdx);
         $pdf->AddPage('P', array($s['w'], $s['h']));
         $pdf->useTemplate($tplIdx);
         $pdf->setMargins(0, 0, 0, 0);
         $pdf->SetAutoPageBreak(false);
         if ($this->employee->getPicture()) {
             $pdf->Image(sfConfig::get('sf_upload_dir') . '/' . sfConfig::get('app_employee_images_dir') . '/' . $this->employee->getPicture(), 29.5, 25.5, 60.3, 74.3);
         } else {
             $pdf->Image(sfConfig::get('sf_upload_dir') . '/badges/picture_missing.jpg', 29.5, 25.5, 60.3, 74.3);
         }
         // now write some text above the imported page
         $pdf->SetFont('freesans', 'B', 12);
         $pdf->SetTextColor(82, 78, 134);
         $pdf->SetXY(22, 110);
         $pdf->Cell(0, 12, $this->employee->getFullName());
         $pdf->Ln();
         $pdf->SetX(22);
         $pdf->SetFont('freesans', 'BI', 10);
         $pdf->Cell(0, 14, $this->employee->getJob());
         $pdf->SetDisplayMode('real');
     }
     return $pdf->Output('newpdf.pdf', 'D');
 }
Example #23
0
 function showForm($data = "", $msg = "")
 {
     global $t, $db, $sesIdUsuario, $hoy, $usuario;
     $idReg = $data[idReg];
     $idPedido = $data[idPedido];
     //echo "ID_PEDIDO : $idPedido <hr>";
     $t->set_file("page", "opGuia.inc.html");
     // -----------------------------------------
     // Datos del Pedido
     // -----------------------------------------
     $sql = "select id_cliente,ori,des,mov,bkg,pos_fec,pos_hor,pos_min,ori,des, ";
     $sql .= "destinatario,destinatario_dom ";
     $sql .= "from PEDIDO where id_pedido='{$idPedido}' ";
     $db->query($sql);
     while ($db->next_record()) {
         $idCliente = $db->f(id_cliente);
         $cliente = getValueTable("cliente", "CLIENTE", "id_cliente", $idCliente);
         $ori = $db->f(ori);
         $des = $db->f(des);
         $mov = $db->f(mov);
         $bkg = $db->f(bkg);
         $posFec = $db->f(pos_fec);
         $posHor = $db->f(pos_hor);
         $posMin = $db->f(pos_min);
         $pos = "{$posFec} {$posHor}:{$posMin}";
         $ori = $db->f(ori);
         $des = $db->f(des);
         $ruta = "{$ori} / {$des}";
         $destinatario = $db->f(destinatario);
         $destinatarioDom = $db->f(destinatario_dom);
     }
     $t->set_var(array("ID_REG" => $idReg, "ID_PEDIDO" => $idPedido, "ACTION" => $PHP_SELF, "MENSAJE" => "", "CLIENTE" => $cliente, "ORI" => $ori, "DES" => $des, "MOV" => $mov, "CANCELADO_DETALLE" => "", "IMPRIMIR" => "<a href=\"javascript:ventanaNueva('opGuiaImp.php?idReg={$idReg}',850,600)\"><img src=\"../images/imp.png\" border=\"0\" height=\"30\" width=\"30\"></a>", "PDF" => ""));
     // Consultar si esta cancelada la Guia de embarque.
     $stRegGE = getValueTable("st_reg", "GUIA", "id_guia", $idReg);
     $bajaIdUsr = getValueTable("baja_id_usr", "GUIA", "id_guia", $idReg);
     $bajaFec = getValueTable("baja_fec", "GUIA", "id_guia", $idReg);
     if ($stRegGE == "B") {
         $bajaUsr = getValueTable("usuario", "USUARIO", "id_usuario", $bajaIdUsr);
         $bajaDetalle = "<font color=red>**CANCELADO**<br>Por: {$bajaUsr}<br>Fecha : {$bajaFec}</font>";
         $t->set_var("CANCELADO_DETALLE", "{$bajaDetalle}");
     } else {
         $stRegColor = "class=\"color3\"";
         $bajaDetalle = "";
         $t->set_var("BAJA", "<a href=\"javascript:submitD(document.frm1,'{$PHP_SELF}','{$idGuia}','baja')\"><img src=\"../images/b_del.png\" border=0></a>");
     }
     if (empty($idReg) || $idReg == 0) {
         $op = "nuevo";
     } elseif ($stRegGE == "B") {
         $op = "cancelado";
         $t->set_var("GUARDAR", "");
         $t->set_var("ACTUALIZAR", "");
         $t->set_var("IMPRIMIR", "");
     } else {
         $op = "editar";
     }
     switch ($op) {
         case "editar":
             if ($usuario->havePerm("1,9", $_SESSION['sesArrPerms'])) {
                 // 9 : [Transporte] Captura Pedidos
                 $t->set_var("GUARDAR", "");
                 $t->set_var("ACTUALIZAR", "<a href=\"javascript:submitD(document.frm1,'{$PHP_SELF}','{$idReg}','update')\">Actualizar Datos</a>");
             } else {
                 $t->set_var("GUARDAR", "");
                 $t->set_var("ACTUALIZAR", "");
             }
             break;
         case "nuevo":
             if ($usuario->havePerm("1,9", $_SESSION['sesArrPerms'])) {
                 if (!empty($idPedido)) {
                     $t->set_var("GUARDAR", "<a href=\"javascript:submitD(document.frm1,'{$PHP_SELF}','','rec')\">Guardar</a>");
                     $t->set_var("ACTUALIZAR", "");
                 } else {
                     $t->set_var("GUARDAR", "<font color=\"red\"><b>ERROR : PRIMERO SELECCIONE UN PEDIDO Y LUEGO CREE UNA GUIA DE EMBARQUE.</b></font>");
                     $t->set_var("ACTUALIZAR", "");
                 }
             } else {
                 $t->set_var("GUARDAR", "");
                 $t->set_var("ACTUALIZAR", "");
             }
             break;
     }
     // --------------------------
     // CONSULTA DE GUIA
     // --------------------------
     if ($idReg > 0) {
         $sql = "select * from GUIA where id_guia='{$idReg}'";
         $db->query($sql);
         while ($db->next_record()) {
             $serie = $db->f(serie);
             $folio = $db->f(folio);
             $data[folio] = $serie . $folio;
             //$data[facturaS] = $db->f(factura_s);
             $data[factura] = $db->f(factura);
             $idConte = $db->f(id_contenedor);
             $idEquipo = getValueTable("id_equipo", "CONTENEDOR", "id_contenedor", $idConte);
             $data[conte] = getValueTable("numero", "CONTENEDOR", "id_contenedor", $idConte);
             $data[equipo] = getValueTable("equipo", "EQUIPO", "id_equipo", $idEquipo);
             $data[sello] = $db->f(sello);
             $data[flete] = $db->f(flete);
             $data[seguro] = $db->f(seguro);
             $data[otroCosto] = $db->f(otro_costo);
             $data[diceContener] = $db->f(dice_contener);
             $data[mercancia] = $db->f(mercancia);
             $data[bulto] = $db->f(bulto);
             $data[operador] = $db->f(operador);
             $data[nota] = $db->f(nota);
             $data[traUni] = $db->f(tra_uni);
             $data[traPla] = $db->f(tra_pla);
             $data[chaUni] = $db->f(cha_uni);
             $data[chaPla] = $db->f(cha_pla);
             $data[terLlega] = $db->f(ter_llega);
             $data[terSale] = $db->f(ter_sale);
             $data[terVacLlega] = $db->f(ter_vac_llega);
             $data[terVacSale] = $db->f(ter_vac_sale);
             $data[referencia] = $db->f(referencia);
             $data[tonelaje] = $db->f(tonelaje);
             $data[valorDec] = $db->f(valor_dec);
             $capIdUsr = $db->f(cap_id_usr);
             $capFec = $db->f(cap_fec);
             $modIdUsr = $db->f(mod_id_usr);
             $modFec = $db->f(mod_fec);
             $capUsr = getValueTable("usuario", "USUARIO", "id_usuario", $capIdUsr);
             $modUsr = getValueTable("usuario", "USUARIO", "id_usuario", $modIdUsr);
             $data[maniobra] = $db->f(maniobra);
             $data[autopista] = $db->f(autopista);
             $data[clase] = $db->f(clase);
             $data[ruta] = $db->f(ruta);
             $data[gastosViaje] = $db->f(gastos_viaje);
             $data[dollyNum] = $db->f(dolly_num);
             $data[dollyPla] = $db->f(dolly_pla);
         }
     }
     // Combos
     if ($data[maniobra] == "M") {
         $t->set_var("MANI_SEL_M", "selected");
     }
     if ($data[maniobra] == "C") {
         $t->set_var("MANI_SEL_C", "selected");
     }
     if ($data[autopista] == "S") {
         $t->set_var("AUTOPISTA_SEL_S", "selected");
     }
     if ($data[autopista] == "N") {
         $t->set_var("AUTOPISTA_SEL_N", "selected");
     }
     // Combo Bulto
     if ($data[bulto] == "20-DC") {
         $t->set_var("20DCSEL", "selected");
     }
     if ($data[bulto] == "40-DC") {
         $t->set_var("40DCSEL", "selected");
     }
     if ($data[bulto] == "40-HC") {
         $t->set_var("40HCSEL", "selected");
     }
     if ($data[bulto] == "20-RF") {
         $t->set_var("20RFSEL", "selected");
     }
     if ($data[bulto] == "40-RF") {
         $t->set_var("40RFSEL", "selected");
     }
     if ($data[bulto] == "20-OT") {
         $t->set_var("20OTSEL", "selected");
     }
     if ($data[bulto] == "40-OT") {
         $t->set_var("40OTSEL", "selected");
     }
     if ($data[bulto] == "20-FL") {
         $t->set_var("20FLSEL", "selected");
     }
     if ($data[bulto] == "40-FL") {
         $t->set_var("40FLSEL", "selected");
     }
     if ($data[bulto] == "20-TK") {
         $t->set_var("20TKSEL", "selected");
     }
     if ($data[bulto] == "40-TK") {
         $t->set_var("40TKSEL", "selected");
     }
     // Combo Clase de contenedor
     if ($data[clase] == "A") {
         $t->set_var("CLASESELA", "selected");
     }
     if ($data[clase] == "B") {
         $t->set_var("CLASESELB", "selected");
     }
     if ($data[clase] == "C") {
         $t->set_var("CLASESELC", "selected");
     }
     if ($data[clase] == "D") {
         $t->set_var("CLASESELD", "selected");
     }
     if ($data[clase] == "FG") {
         $t->set_var("CLASESELFG", "selected");
     }
     if ($data[clase] == "GC") {
         $t->set_var("CLASESELGC", "selected");
     }
     $folioX = $data[folio];
     $t->set_var(array("FOLIO" => $folioX, "FACTURA_S" => $data[facturaS], "FACTURA" => $data[factura], "REFERENCIA" => $data[referencia], "TONELAJE" => $data[tonelaje], "VALOR_DEC" => $data[valorDec], "CONTENEDOR" => $data[conte], "EQUIPO" => $data[equipo], "SELLO" => $data[sello], "FLETE" => $data[flete], "MANIOBRA" => $data[maniobra], "SEGURO" => $data[seguro], "AUTOPISTA" => $data[autopista], "OTRO_COSTO" => $data[otroCosto], "MERCANCIA" => $data[mercancia], "DICE_CONTENER" => $data[diceContener], "OPERADOR" => $data[operador], "NOTA" => $data[nota], "TRA_UNI" => $data[traUni], "TRA_PLA" => $data[traPla], "CHA_UNI" => $data[chaUni], "CHA_PLA" => $data[chaPla], "TER_LLEGA" => $data[terLlega], "TER_SALE" => $data[terSale], "TER_VAC_LLEGA" => $data[terVacLlega], "TER_VAC_SALE" => $data[terVacSale], "CAPTURO" => "{$capUsr} / {$capFec}", "MODIFICO" => "{$modUsr} / {$modFec}", "RUTA" => $data[ruta], "GASTOS_VIAJE" => $data[gastosViaje], "DOLLY_NUM" => $data[dollyNum], "DOLLY_PLA" => $data[dollyPla]));
     // ""=>$data[],
     //$facS = $data[facturaS];
     $facX = $data[factura];
     if (preg_match("/(.{0,2})(.*)/", $facX, $parts)) {
         $facS = $parts[1];
         $facN = $parts[2];
     }
     if ($idReg > 0 && !empty($facN)) {
         // ----------------------------------------------
         // PROCESO DE EDICION DE FACTURA-PDF
         //
         // 1. Comprobar que exista la factura original.
         // 2. Buscar todas las GE que tengan la misma factura relacionada.
         // 3. Consultar (Folio_serie,Folio,Contenedor,Tipo,Bkg,Posicionamiento,Ruta,etc.
         // 4. Generar nuevo PDF.
         // ----------------------------------------------
         $facN2 = str_pad($facN, 7, 0, STR_PAD_LEFT);
         $filePdfOri = "OPE0606129RAF" . $facS . $facN2 . ".pdf";
         $filePdfEdi = "OPE0606129RAF" . $facS . $facN2 . "_.pdf";
         // Consultar datos GE con la misma Factura.
         unset($txtFac);
         unset($txtFac2);
         $numConte = 0;
         $sql = "select folio,id_contenedor ";
         $sql .= "from GUIA ";
         //$sql.="where factura_s='$facS' and factura='$facN' and st_reg<>'B' ";
         $sql .= "where factura='{$facX}' and st_reg<>'B' ";
         $db->query($sql);
         while ($db->next_record()) {
             $numConte++;
             $folioX = $db->f(folio);
             $folioS = substr($folioX, 0, 2);
             $folioN = substr($folioX, 2, 10);
             $idConte = $db->f(id_contenedor);
             $conte = getValueTable("numero", "CONTENEDOR", "id_contenedor", $idConte);
             $idEq = getValueTable("id_equipo", "CONTENEDOR", "id_contenedor", $idConte);
             $equipo = getValueTable("equipo", "EQUIPO", "id_equipo", $idEq);
             // Si la cantidad de contenedores es mayor al limite, entonces 2do arreglo.
             $maxConte = 17;
             if ($numConte > $maxConte) {
                 $txtFac2[] = "{$folioS} {$folioN} {$conte} {$equipo}";
             } else {
                 $txtFac[] = "{$folioS} {$folioN} {$conte} {$equipo}";
             }
         }
         // ---------------------------------------------------
         // Editar factura.
         if (file_exists("../facturas/{$filePdfOri}")) {
             //$pdf =& new FPDI();
             $pdf = new FPDI();
             $pdf->AddPage();
             //Set the source PDF file
             $pagecount = $pdf->setSourceFile("../facturas/{$filePdfOri}");
             //Import the first page of the file
             $tpl = $pdf->importPage(1);
             //Use this page as template
             $pdf->useTemplate($tpl);
             $pdf->SetFont('Arial', '', 7);
             // PAGINA #1
             // Inicializa la posición
             $destinatarioDom = str_replace("\n", "", $destinatarioDom);
             $destinatarioDom = str_replace("\r", "", $destinatarioDom);
             $pdf->SetXY(60, 90);
             $pdf->Cell(45, 5, "BKG : {$bkg} ", 0, 0, 'L');
             $pdf->SetXY(60, 93);
             $pdf->Cell(45, 5, "POSICIONAMIENTO : {$pos} ", 0, 0, 'L');
             $pdf->SetXY(60, 96);
             $pdf->Cell(45, 5, "RUTA : {$ruta}", 0, 0, 'L');
             $pdf->SetXY(60, 99);
             $pdf->Cell(45, 5, "SALIDA DE VACIO : ? ", 0, 0, 'L');
             $pdf->SetXY(60, 105);
             $pdf->Cell(60, 5, $destinatario, 0, 0, 'L');
             // Seccionar a varias Cell, el domicilio del destinatario
             // Direccion de destinatario
             $s = $destinatarioDom;
             $s = strtoupper($s);
             $lenTl = strlen($s);
             // Conocer el numero de lineas
             $nlDes = $lenTl / 15;
             // El total de caracteres entre el ancho de 35 que es el max de caracteres x linea.
             $posIni = 0;
             $y = 109;
             for ($i = 1; $i <= $nlDes; $i++) {
                 $txtX = substr($s, $posIni, 35);
                 $pdf->SetXY(60, $y);
                 $pdf->Cell(60, 4, $txtX, 0, 0, 'L');
                 $posIni = $posIni + 35;
                 $y = $y + 3;
             }
             // ---------------------------
             $y = 90;
             foreach ($txtFac as $txt) {
                 $pdf->SetXY(10, $y);
                 $pdf->Cell(45, 5, $txt, 0, 0, 'L');
                 $y = $y + 3;
             }
             if ($numConte > $maxConte) {
                 $pdf->SetXY(60, 130);
                 $pdf->Cell(45, 5, "*** VER ANEXO *** VER ANEXO ***", 0, 0, 'L');
                 // PAGINA #2
                 $pdf->AddPage();
                 $y = 20;
                 foreach ($txtFac2 as $txt2) {
                     $pdf->SetXY(10, $y);
                     $pdf->Cell(45, 5, "{$txt2}", 0, 0, 'L');
                     $y = $y + 3;
                     if ($y == 266) {
                         $y = 20;
                         $pdf->AddPage();
                     }
                 }
             }
             // Grabar archivo
             //echo "[$filePdfEdi]";
             $pdf->Output("../facturas/{$filePdfEdi}", "F");
             //$x  = file_exists("../facturas/$filePdfEdi");
             if (file_exists("../facturas/{$filePdfEdi}")) {
                 $pdfImg = "<a href=\"javascript:ventanaNueva('../facturas/{$filePdfEdi}',800,600)\"><img src=\"../images/pdf.gif\" width=\"25\" hight=\"20\" border=0></a>";
             } else {
                 $pdfImg = "";
             }
             $t->set_var("PDF", "{$pdfImg}");
         } else {
             $t->set_var("PDF", "");
         }
     }
     // -----------------------------------------------
     //  Control de mensajes
     // -------------------------------------------
     if (!empty($msg)) {
         $canMsg = count($msg);
         if ($canMsg > 0) {
             foreach ($msg as $val) {
                 $cadMsg .= $val . " <br>";
             }
             $t->set_var(array("MENSAJE" => $cadMsg));
         }
     }
     $t->pparse("out", "page");
 }
Example #24
0
 function back_id($results)
 {
     $this->load->helper('settings');
     //print preview of MR
     $this->load->library('fpdf');
     $this->load->library('fpdi');
     // initiate FPDI
     $pdf = new FPDI('L');
     // add a page
     $pdf->AddPage();
     // set the sourcefile
     $pagecount = $pdf->setSourceFile('pdf-report/id/back-id.pdf');
     // import page 1
     $tplIdx = $pdf->importPage(1);
     // use the imported page and place it at point 10,10 with a width of 100 mm
     $pdf->useTemplate($tplIdx);
     // now write some text above the imported page
     $pdf->SetTextColor(0, 0, 0);
     $pdf->SetFont('Arial', '', 7);
     $n = 1;
     foreach ($results as $result) {
         $s = new Personal_m();
         $row = $s->get_by_employee_id($result->employee_id);
         //======================== START Column 1 | Right to Left ==============================
         if ($n == 11) {
             //add new page
             $pdf->addPage();
             for ($n = 1; $n <= 1; $n++) {
                 $tplidx = $pdf->ImportPage(1);
                 $pdf->useTemplate($tplIdx);
                 //, 1, 1, 210
             }
             $n = $n - 1;
         }
         $bday = $row->birth_date;
         $address = $row->res_address;
         $blood_type = '"' . $row->blood_type . '"';
         $gsis = $row->gsis;
         $pagibig = $row->pagibig;
         $philhealth = $row->philhealth;
         $tin = $row->tin;
         $emergency = '';
         $contact = $row->cp;
         //----------------------------- Row 1 ----------------------------------
         ///Birthday
         if ($n == 1) {
             //Birthday
             if ($bday != '0000-00-00') {
                 $pdf->SetXY(247, 23);
                 $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false);
             }
             //Address
             $pdf->SetXY(257, 15);
             $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28);
             $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false);
             //display text overflow
             if ($addr[1]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(257);
                 $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false);
             }
             if ($addr[2]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(257);
                 $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false);
             }
             if ($addr[3]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(257);
                 $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false);
             }
             //Blood Type
             $pdf->SetXY(247, 28.3);
             $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false);
             //GSIS
             $pdf->SetXY(247, 33);
             $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false);
             //PAGIBIG
             $pdf->SetXY(247, 38);
             $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false);
             //PHILHEALTH
             $pdf->SetXY(247, 43.5);
             $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false);
             //PHILHEALTH
             $pdf->SetXY(247, 48.5);
             $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false);
             //in case of emergency
             $pdf->SetXY(235, 75.5);
             $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false);
             //CP No.
             $pdf->SetXY(250, 78);
             $cpno = splitstroverflow($contact, 13);
             $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false);
             if ($cpno[1]) {
                 $pdf->Ln(3);
                 $pdf->SetX(250);
                 $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false);
             }
         }
         //----------------------------- Row 2 ----------------------------------
         if ($n == 2) {
             //Birthday
             if ($bday != '0000-00-00') {
                 $pdf->SetXY(189, 23);
                 $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false);
             }
             //Address
             $pdf->SetXY(199, 15);
             $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28);
             $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false);
             //display text overflow
             if ($addr[1]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(199);
                 $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false);
             }
             if ($addr[2]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(199);
                 $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false);
             }
             if ($addr[3]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(199);
                 $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false);
             }
             //Blood Type
             $pdf->SetXY(189, 28.3);
             $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false);
             //GSIS
             $pdf->SetXY(189, 33);
             $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false);
             //PAGIBIG
             $pdf->SetXY(189, 38);
             $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false);
             //PHILHEALTH
             $pdf->SetXY(189, 43.5);
             $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false);
             //PHILHEALTH
             $pdf->SetXY(189, 48.5);
             $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false);
             //in case of emergency
             $pdf->SetXY(177, 75.5);
             $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false);
             //CP No.
             $pdf->SetXY(192, 78);
             $cpno = splitstroverflow($contact, 13);
             $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false);
             if ($cpno[1]) {
                 $pdf->Ln(3);
                 $pdf->SetX(192);
                 $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false);
             }
         }
         //----------------------------- Row 3 ----------------------------------
         if ($n == 3) {
             //Birthday
             if ($bday != '0000-00-00') {
                 $pdf->SetXY(131, 23);
                 $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false);
             }
             //Address
             $pdf->SetXY(141, 15);
             $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28);
             $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false);
             //display text overflow
             if ($addr[1]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(141);
                 $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false);
             }
             if ($addr[2]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(141);
                 $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false);
             }
             if ($addr[3]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(141);
                 $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false);
             }
             //Blood Type
             $pdf->SetXY(131, 28.3);
             $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false);
             //GSIS
             $pdf->SetXY(131, 33);
             $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false);
             //PAGIBIG
             $pdf->SetXY(131, 38);
             $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false);
             //PHILHEALTH
             $pdf->SetXY(131, 43.5);
             $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false);
             //PHILHEALTH
             $pdf->SetXY(131, 48.5);
             $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false);
             //in case of emergency
             $pdf->SetXY(119, 75.5);
             $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false);
             //CP No.
             $pdf->SetXY(134, 78);
             $cpno = splitstroverflow($contact, 13);
             $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false);
             if ($cpno[1]) {
                 $pdf->Ln(3);
                 $pdf->SetX(134);
                 $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false);
             }
         }
         //----------------------------- Row 4 ----------------------------------
         if ($n == 4) {
             //Birthday
             if ($bday != '0000-00-00') {
                 $pdf->SetXY(73, 23);
                 $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false);
             }
             //Address
             $pdf->SetXY(83, 15);
             $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28);
             $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false);
             //display text overflow
             if ($addr[1]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(83);
                 $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false);
             }
             if ($addr[2]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(83);
                 $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false);
             }
             if ($addr[3]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(3);
                 $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false);
             }
             //Blood Type
             $pdf->SetXY(73, 28.3);
             $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false);
             //GSIS
             $pdf->SetXY(73, 33);
             $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false);
             //PAGIBIG
             $pdf->SetXY(73, 38);
             $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false);
             //PHILHEALTH
             $pdf->SetXY(73, 43.5);
             $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false);
             //PHILHEALTH
             $pdf->SetXY(73, 48.5);
             $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false);
             //in case of emergency
             $pdf->SetXY(61, 75.5);
             $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false);
             //CP No.
             $pdf->SetXY(76, 78);
             $cpno = splitstroverflow($contact, 13);
             $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false);
             if ($cpno[1]) {
                 $pdf->Ln(3);
                 $pdf->SetX(76);
                 $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false);
             }
         }
         //----------------------------- Row 5 ----------------------------------
         if ($n == 5) {
             //Birthday
             if ($bday != '0000-00-00') {
                 $pdf->SetXY(15, 23);
                 $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false);
             }
             //Address
             $pdf->SetXY(25, 15);
             $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28);
             $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false);
             //display text overflow
             if ($addr[1]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(25);
                 $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false);
             }
             if ($addr[2]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(25);
                 $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false);
             }
             if ($addr[3]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(25);
                 $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false);
             }
             //Blood Type
             $pdf->SetXY(15, 28.3);
             $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false);
             //GSIS
             $pdf->SetXY(15, 33);
             $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false);
             //PAGIBIG
             $pdf->SetXY(15, 38);
             $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false);
             //PHILHEALTH
             $pdf->SetXY(15, 43.5);
             $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false);
             //PHILHEALTH
             $pdf->SetXY(15, 48.5);
             $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false);
             //in case of emergency
             $pdf->SetXY(3, 75.5);
             $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false);
             //CP No.
             $pdf->SetXY(18, 78);
             $cpno = splitstroverflow($contact, 13);
             $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false);
             if ($cpno[1]) {
                 $pdf->Ln(3);
                 $pdf->SetX(18);
                 $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false);
             }
         }
         //======================== END Column 1 | Right to Left ==============================
         //======================== START Column 2 | Right to Left ==============================
         //----------------------------- Row 1 ----------------------------------
         ///Birthday
         if ($n == 6) {
             //Birthday
             if ($bday != '0000-00-00') {
                 $pdf->SetXY(247, 123.5);
                 $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false);
             }
             //Address
             $pdf->SetXY(257, 115);
             $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28);
             $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false);
             //display text overflow
             if ($addr[1]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(257);
                 $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false);
             }
             if ($addr[2]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(257);
                 $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false);
             }
             if ($addr[3]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(257);
                 $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false);
             }
             //Blood Type
             $pdf->SetXY(247, 128.5);
             $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false);
             //GSIS
             $pdf->SetXY(247, 133.5);
             $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false);
             //PAGIBIG
             $pdf->SetXY(247, 138.5);
             $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false);
             //PHILHEALTH
             $pdf->SetXY(247, 144);
             $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false);
             //TIN
             $pdf->SetXY(247, 149);
             $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false);
             //in case of emergency
             $pdf->SetXY(235, 176.3);
             $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false);
             //CP No.
             $pdf->SetXY(250, 178.5);
             $cpno = splitstroverflow($contact, 13);
             $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false);
             if ($cpno[1]) {
                 $pdf->Ln(3);
                 $pdf->SetX(250);
                 $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false);
             }
         }
         //----------------------------- Row 2 ----------------------------------
         //----------------------------- Row 2 ----------------------------------
         if ($n == 7) {
             //Birthday
             if ($bday != '0000-00-00') {
                 $pdf->SetXY(189, 123.5);
                 $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false);
             }
             //Address
             $pdf->SetXY(199, 115);
             $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28);
             $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false);
             //display text overflow
             if ($addr[1]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(199);
                 $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false);
             }
             if ($addr[2]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(199);
                 $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false);
             }
             if ($addr[3]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(199);
                 $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false);
             }
             //Blood Type
             $pdf->SetXY(189, 128.5);
             $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false);
             //GSIS
             $pdf->SetXY(189, 133.5);
             $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false);
             //PAGIBIG
             $pdf->SetXY(189, 138.5);
             $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false);
             //PHILHEALTH
             $pdf->SetXY(189, 144);
             $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false);
             //tin
             $pdf->SetXY(189, 149);
             $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false);
             //in case of emergency
             $pdf->SetXY(177, 176.3);
             $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false);
             //CP No.
             $pdf->SetXY(192, 178.5);
             $cpno = splitstroverflow($contact, 13);
             $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false);
             if ($cpno[1]) {
                 $pdf->Ln(3);
                 $pdf->SetX(192);
                 $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false);
             }
         }
         //----------------------------- Row 3 ----------------------------------
         if ($n == 8) {
             //Birthday
             if ($bday != '0000-00-00') {
                 $pdf->SetXY(131, 123.5);
                 $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false);
             }
             //Address
             $pdf->SetXY(141, 115);
             $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28);
             $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false);
             //display text overflow
             if ($addr[1]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(141);
                 $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false);
             }
             if ($addr[2]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(141);
                 $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false);
             }
             if ($addr[3]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(141);
                 $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false);
             }
             //Blood Type
             $pdf->SetXY(131, 128.5);
             $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false);
             //GSIS
             $pdf->SetXY(131, 133.5);
             $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false);
             //PAGIBIG
             $pdf->SetXY(131, 138.5);
             $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false);
             //PHILHEALTH
             $pdf->SetXY(131, 144);
             $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false);
             //PHILHEALTH
             $pdf->SetXY(131, 149);
             $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false);
             //in case of emergency
             $pdf->SetXY(119, 176.3);
             $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false);
             //CP No.
             $pdf->SetXY(134, 178.5);
             $cpno = splitstroverflow($contact, 13);
             $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false);
             if ($cpno[1]) {
                 $pdf->Ln(3);
                 $pdf->SetX(134);
                 $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false);
             }
         }
         //----------------------------- Row 4 ----------------------------------
         if ($n == 9) {
             //Birthday
             if ($bday != '0000-00-00') {
                 $pdf->SetXY(73, 123.5);
                 $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false);
             }
             //Address
             $pdf->SetXY(83, 115);
             $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28);
             $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false);
             //display text overflow
             if ($addr[1]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(83);
                 $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false);
             }
             if ($addr[2]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(83);
                 $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false);
             }
             if ($addr[3]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(3);
                 $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false);
             }
             //Blood Type
             $pdf->SetXY(73, 128.5);
             $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false);
             //GSIS
             $pdf->SetXY(73, 133.5);
             $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false);
             //PAGIBIG
             $pdf->SetXY(73, 138.5);
             $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false);
             //PHILHEALTH
             $pdf->SetXY(73, 144);
             $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false);
             //PHILHEALTH
             $pdf->SetXY(73, 149);
             $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false);
             //in case of emergency
             $pdf->SetXY(61, 176.3);
             $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false);
             //CP No.
             $pdf->SetXY(76, 178.5);
             $cpno = splitstroverflow($contact, 13);
             $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false);
             if ($cpno[1]) {
                 $pdf->Ln(3);
                 $pdf->SetX(76);
                 $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false);
             }
         }
         //----------------------------- Row 5 ----------------------------------
         if ($n == 10) {
             //Birthday
             if ($bday != '0000-00-00') {
                 $pdf->SetXY(15, 123.5);
                 $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false);
             }
             //Address
             $pdf->SetXY(25, 115);
             $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28);
             $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false);
             //display text overflow
             if ($addr[1]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(25);
                 $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false);
             }
             if ($addr[2]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(25);
                 $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false);
             }
             if ($addr[3]) {
                 $pdf->Ln(2.5);
                 $pdf->SetX(25);
                 $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false);
             }
             //Blood Type
             $pdf->SetXY(15, 128.5);
             $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false);
             //GSIS
             $pdf->SetXY(15, 133.5);
             $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false);
             //PAGIBIG
             $pdf->SetXY(15, 138.5);
             $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false);
             //PHILHEALTH
             $pdf->SetXY(15, 144);
             $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false);
             //tin
             $pdf->SetXY(15, 149);
             $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false);
             //in case of emergency
             $pdf->SetXY(3, 176.3);
             $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false);
             //CP No.
             $pdf->SetXY(18, 178.5);
             $cpno = splitstroverflow($contact, 13);
             $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false);
             if ($cpno[1]) {
                 $pdf->Ln(3);
                 $pdf->SetX(18);
                 $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false);
             }
         }
         //======================== END Column 2 | Right to Left ==============================
         $n++;
     }
     // Output
     $pdf->Output('pdf-report/back-id.pdf', 'F');
     return 'pdf-report/back-id.pdf';
 }
	"SELECT art.utiles.armar_cuit(sa_cuit) cuit, sa_nombre
		 FROM asa_solicitudafiliacion
		WHERE sa_idformulario = :sa_idformulario";
$stmt = DBExecSql($conn, $sql, $params);
$row2 = DBGetQuery($stmt, 1, false);

if ($autoPrint)
	$pdf = new PDF_AutoPrint();
else
	$pdf = new FPDI();

$pdf->setSourceFile($_SERVER["DOCUMENT_ROOT"]."/modules/solicitud_afiliacion/templates/ventanilla_electronica.pdf");

$pdf->AddPage();
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx);
$pdf->SetFont("Arial", "B", 9);

$pdf->Ln(34.5);
$pdf->Cell(38);
$pdf->Cell(136, 0, $row2["SA_NOMBRE"]);

$pdf->Ln(5.2);
$pdf->Cell(31);
$pdf->Cell(32, 0, $row2["CUIT"]);


if ($autoPrint)
	$pdf->AutoPrint(false);
$pdf->Output();
?>
Example #26
0
 public function createScreeningPdf($hash)
 {
     $screening_entry_model = ScreeningEntry::findOne(['hash' => $hash]);
     $screening_form_model = ScreeningForm::findOne(['id' => $screening_entry_model->screening_form_id]);
     $subject_model = Subject::findOne(['id' => $screening_entry_model->subject_id]);
     $count = 1;
     //$permissions = \SetaPDF_Core_SecHandler::PERM_DIGITAL_PRINT ;
     $this->_font = 'Helvetica';
     //class_exists('TCPDF', true); // trigger Composers autoloader to load the TCPDF class
     $pdf = new \FPDI();
     $pdf->SetAutoPageBreak(true);
     // add a page
     $pdf->SetTopMargin(30);
     $pdf->AddPage();
     $pdf->setSourceFile(\yii::$app->basePath . "/../letterhead-mini-header.pdf");
     $tplIdx = $pdf->importPage(1);
     // use the imported page and place it at point 10,10 with a width of 100 mm
     $pdf->useTemplate($tplIdx, 0, 0);
     $pdf->SetFont($this->_font, '', 9);
     $pdf->SetXY(10, 6);
     $pdf->Cell(0, 3, 'Confidential - Participant screening form');
     $pdf->SetFont($this->_font, '', 12);
     $pdf->SetXY(10, 14);
     $pdf->MultiCell(150, 3, yii::$app->DateComponent->timestampToUkDate($screening_entry_model->created_at), 0, 'R');
     $pdf->MultiCell(100, 3, $screening_entry_model->screening_form_title, 0, '');
     $pdf->Ln();
     $pdf->SetFont($this->_font, '', 9);
     $pdf->Cell(100, 4, sprintf('Participant: %s %s (dob %s)', $screening_entry_model->subject->first_name, $screening_entry_model->subject->last_name, yii::$app->DateComponent->isoToUkDate($screening_entry_model->subject->dob)));
     $pdf->Cell(50, 4, sprintf('Identifier: %s', $screening_entry_model->subject->cubric_id), 0, '', 'R');
     $pdf->Ln();
     $pdf->Cell(100, 4, sprintf('Researcher: %s %s (project %s)', $screening_entry_model->researcher->first_name, $screening_entry_model->researcher->last_name, $screening_entry_model->project->code));
     $pdf->Cell(50, 4, sprintf('Resource: %s', $screening_entry_model->resource_title), 0, '', 'R');
     $pdf->SetXY(10, 38);
     $pdf->SetFont($this->_font, '', 12);
     $pdf->Cell(150, 4, sprintf('Responses'));
     $pdf->SetFont($this->_font, '', 9);
     $pdf->Ln();
     foreach (yii::$app->screeningresponse->getResponses($hash) as $response) {
         if (strlen($response['caption']) > 0) {
             $pdf->Ln();
             $pdf->MultiCell(180, 4, sprintf('%s ', $response['caption']), 0, 'U');
             $count = 1;
         }
         $pdf->MultiCell(180, 4, sprintf('%s. %s ', $count, $response['content']));
         $pdf->SetFont($this->_font, 'B', 9);
         if ($response['response'] === null) {
             $response['response'] = 'Not specified / Unknown.';
         }
         $pdf->MultiCell(180, 4, sprintf('%s ', $response['response']));
         $pdf->SetFont($this->_font, '', 9);
         $count++;
         $pdf->Ln();
     }
     $pdf->Ln();
     $pdf->SetFont($this->_font, '', 12);
     $pdf->Cell(180, 4, sprintf('Signatures'));
     $pdf->Ln();
     $pdf->Ln();
     $pdf->SetFont($this->_font, '', 9);
     $pdf->Cell(100, 4, 'Participant ');
     $pdf->Cell(100, 4, 'Researcher ');
     $pdf->Ln();
     $pdf->Ln();
     $currentX = $pdf->GetX();
     $currentY = $pdf->GetY();
     $pdf->Image(sprintf('/tmp/subject-%s.png', $hash), $currentX, $currentY);
     $currentX = $pdf->GetX();
     $pdf->Image(sprintf('/tmp/researcher-%s.png', $hash), $currentX + 100, $currentY);
     // now write some text above the imported page
     // NOW SET ScreeningEntry::progress_id = PUBLISHED so it cannot be edited again.
     // $pdfData = $pdf->Output('S');
     // create a writer
     // create a Http writer
     //$writer = new \SetaPDF_Core_Writer_Http("fpdf-sign-demo.pdf", true);
     // load document by filename
     //$document = new \SetaPDF_Core_Document::loadByString($pdfData, $writer);
     //$document = new \SetaPDF_Core_Reader_File($pdf->Output(), $writer);
     $writer = new \SetaPDF_Core_Writer_File("/Users/Spiro/tmp/myPDF.pdf");
     $document = \SetaPDF_Core_Document::loadByString($pdf->Output("S"), $writer);
     // let's prepare the temporary file writer:
     \SetaPDF_Core_Writer_TempFile::setTempDir("/tmp/");
     // create a signer instance for the document
     $signer = new \SetaPDF_Signer($document);
     // add a field with the name "Signature" to the top left of page 1
     $signer->addSignatureField(\SetaPDF_Signer_SignatureField::DEFAULT_FIELD_NAME, 1, \SetaPDF_Signer_SignatureField::POSITION_LEFT_BOTTOM, array('x' => 10, 'y' => 10), 180, 50);
     // set some signature properties
     $signer->setReason('Integrity');
     $signer->setLocation('CUBRIC');
     $signer->setContactInfo('+44 2920 703859');
     // ccreate an OpenSSL module instance
     $module = new \SetaPDF_Signer_Signature_Module_OpenSsl();
     // set the sign certificate
     $module->setCertificate(file_get_contents("/Users/spiro/Sites/projects/certs/certificate.pem"));
     // set the private key for the sign certificate
     $module->setPrivateKey(array(file_get_contents("/Users/spiro/Sites/projects/certs/key.pem"), ""));
     // create a Signature appearance
     $visibleAppearance = new \SetaPDF_Signer_Signature_Appearance_Dynamic($module);
     // choose a document to get the background from and convert the art box to an xObject
     $backgroundDocument = \SetaPDF_Core_Document::loadByFilename(Yii::getAlias('@frontend/web/img/cubric-logo.pdf'));
     $backgroundXObject = $backgroundDocument->getCatalog()->getPages()->getPage(1)->toXObject($document);
     // format the date
     $visibleAppearance->setShowFormat(\SetaPDF_Signer_Signature_Appearance_Dynamic::CONFIG_DATE, 'd-m-Y H:i:s');
     // disable the distinguished name
     $visibleAppearance->setShow(\SetaPDF_Signer_Signature_Appearance_Dynamic::CONFIG_DISTINGUISHED_NAME, false);
     // set the background with 50% opacity
     $visibleAppearance->setGraphic($backgroundXObject, 0.5);
     //$visibleAppearance->setBackgroundLogo($backgroundXObject, .5);
     // sign/certify the document
     // define the appearance
     $signer->setAppearance($visibleAppearance);
     $signer->sign($module);
     if (file_exists(sprintf('/tmp/subject-%s.png', $hash))) {
     }
     //   unlink(sprintf('/tmp/subject-%s.png' , $hash));
     if (file_exists(sprintf('/tmp/researcher-%s.png', $hash))) {
     }
     //     unlink(sprintf('/tmp/researcher-%s.png' , $hash));
     return true;
 }
Example #27
0
     $pdf->Image($logo, 0.5, 0.4, 2.5, 0.9, null, null, 'N', true, 300, null, false, false, 0, true);
 } else {
     //set position for header text, if enabled
     $pdf->SetXY($x + 0.5, $y + 0.4);
 }
 //header
 if ($fax_header != '') {
     $pdf->SetLeftMargin(0.5);
     $pdf->SetFont($pdf_font, "", 10);
     $pdf->Write(0.3, $fax_header);
 }
 //fax, cover sheet
 $pdf->SetTextColor(0, 0, 0);
 $pdf->SetFont($pdf_font, "B", 55);
 $pdf->SetXY($x + 4.55, $y + 0.25);
 $pdf->Cell($x + 3.5, $y + 0.4, $text['label-fax-fax'], 0, 0, 'R', false, null, 0, false, 'T', 'T');
 $pdf->SetFont($pdf_font, "", 12);
 $pdf->SetFontSpacing(0.0425);
 $pdf->SetXY($x + 4.55, $y + 1.0);
 $pdf->Cell($x + 3.5, $y + 0.4, $text['label-fax-cover-sheet'], 0, 0, 'R', false, null, 0, false, 'T', 'T');
 $pdf->SetFontSpacing(0);
 //field labels
 $pdf->SetFont($pdf_font, "B", 12);
 if ($fax_recipient != '' || sizeof($fax_numbers) > 0) {
     $pdf->Text($x + 0.5, $y + 2.0, strtoupper($text['label-fax-recipient']) . ":");
 }
 if ($fax_sender != '' || $fax_caller_id_number != '') {
     $pdf->Text($x + 0.5, $y + 2.3, strtoupper($text['label-fax-sender']) . ":");
 }
 if ($fax_page_count > 0) {
     $pdf->Text($x + 0.5, $y + 2.6, strtoupper($text['label-fax-attached']) . ":");
	"SELECT fi_caracter, fi_firmante
		 FROM cfi_firma
		WHERE fi_id = 444";		// Queda fijo Ana Bordachar..
$stmt = DBExecSql($conn, $sql, array());
$rowFirmante = DBGetQuery($stmt, 1, false);

$pdf = new FPDI();
$pdf->setSourceFile($_SERVER["DOCUMENT_ROOT"]."/modules/usuarios_registrados/agentes_comerciales/comisiones/templates/obra_social.pdf");

$pdf->AddPage();
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx);

$pdf->SetFont("Arial", "", 12);
$pdf->Ln(4);
$pdf->Cell(8);
$pdf->Cell(0, 0, "Provincia Aseguradora de Riesgos de Trabajo S.A.");

$pdf->SetFont("Arial", "", 10);
$pdf->Ln(6);
$pdf->Cell(8);
$pdf->Cell(0, 0, "Carlos Pellegrini 91 1º Piso - Capital Federal");

$pdf->Ln(6);
$pdf->Cell(8);
$pdf->Cell(0, 0, "C.P. 1009");

$pdf->Ln(6);
$pdf->Cell(8);
$pdf->Cell(0, 0, "Tel: 4819-2800 Fax: 0800-999-1829");
			$graficoOk = false;
		}
		// FIN - Generación de gráfico que va incrustado en el reporte..

if ($graficoOk) {
		$pdf->setSourceFile($_SERVER["DOCUMENT_ROOT"]."/modules/solicitud_cotizacion/plantillas/analisis_comparativo_costos.pdf");
		$pdf->SetDrawColor(255, 255, 255);
		$pdf->SetFillColor(255, 255, 255);

		$pdf->AddPage();
		$tplIdx = $pdf->importPage(1);
		$pdf->useTemplate($tplIdx);
		$pdf->SetFont("Arial", "B", 10);

		$pdf->Ln(33);
		$pdf->Cell(40);
		$pdf->Cell(144, 0, $row["RAZONSOCIAL"]);

		$pdf->Ln(6.6);
		$pdf->Cell(28);
		$pdf->Cell(36, 0, $row["CUIT"]);

		$pdf->Cell(16);
		$pdf->Cell(80, 0, $row["CIIU"]);

		$pdf->Ln(6.6);
		$pdf->Cell(38);
		$pdf->Cell(146, 0, $row["DESCRIPCIONCIIU"]);

		$pdf->Ln(6);
		$pdf->Cell(32);
Example #30
0
     $pdf = new FPDI();
     if ($user->getPrivilege() <= 10) {
         $source = "docs/certificatelead.pdf";
     } else {
         $source = "docs/certificate.pdf";
     }
     $pagecount = $pdf->setSourceFile($source);
     $tplidx = $pdf->importPage(1);
     $pdf->addPage('L');
     $pdf->useTemplate($tplidx, 0, 0, 0);
     $date = date('jS F Y');
     $pdf->AddFont('DejaVu', '', 'DejaVuSansCondensed.ttf', true);
     $pdf->SetFont('DejaVu', '', 30);
     $pdf->SetTextColor(0, 0, 0);
     $pdf->SetXY(0, 95);
     $pdf->Cell(297, 15, $name, 0, 0, 'C', 0);
     $pdf->SetFont('Arial', '', 18);
     $pdf->SetXY(170, 160);
     $pdf->Write(0, $date);
     $attachment = $pdf->output('Certificate.pdf', 'S');
     header('Pragma: public');
     header('Expires: -1');
     header('Content-Transfer-Encoding: binary');
     header('Content-Type: application/pdf');
     header('Content-Disposition: attachment;filename="ISOS%20Certificate.pdf"');
     header('Cache-Control: max-age=0');
     // output the file
     echo $attachment;
     exit;
     break;
 case 'violationlist':