$pdf->Cell(14);
$pdf->Cell(41, 0, $row2["TELEFONO"]);

$pdf->Ln(4.4);
$pdf->Cell(40);
$pdf->Cell(16, 0, $row2["ESTABLECIMIENTOS"]);


$pdf->Ln(2.4);
$pdf->SetFont("Arial", "", 7);
$pdf->SetDrawColor(255, 255, 255);
$pdf->SetFillColor(0, 135, 196);
switch ($row2["SA_NIVEL"]) {
	case 1:
		$pdf->Cell(66);
		$pdf->Rect($pdf->GetX(), $pdf->GetY(), 4.2, 3.4, "F");
		$pdf->Ln(2);
		$pdf->Cell(66.6);
		$pdf->Cell(0, 0, "I");
		$pdf->Ln(-2);
		break;
	case 2:
		$pdf->Cell(72.4);
		$pdf->Rect($pdf->GetX(), $pdf->GetY(), 4, 3.4, "F");
		$pdf->Ln(2);
		$pdf->Cell(72.6);
		$pdf->Cell(0, 0, "II");
		$pdf->Ln(-2);
		break;
	case 3:
		$pdf->Cell(78.6);
	if ($row["SUSCRIBEPOLIZARC"] == "S") {
		$pdf->Ln(119);
		$pdf->Cell(32);
		$pdf->Cell(32, 0, $row["VALORRC"], 0, 0, "R");

		$pdf->Ln(6);
		$pdf->Cell(32);
		$pdf->Cell(32, 0, $row["CUOTAINICIALRC"], 0, 0, "R");

		$pdf->Ln(5.7);
		$pdf->Cell(32);
		$pdf->Cell(32, 0, $row["SUMAASEGURADARC"], 0, 0, "R");
	}
	else {
		$pdf->Ln(96);
		$pdf->Rect($pdf->GetX(), $pdf->GetY(), 194, 44, "DF");
	}


	if (($id == 328723) or ($id == 334890)) {		// Harcodeado por ticket 41756..
		$pdf->Rect(92, 110, 104, 8, "DF");	
		$pdf->Ln(-102);
		$pdf->SetFont("Arial", "", 8);
		$pdf->Cell(80);
		$pdf->Cell(0, 0, "Claúsula penal por incumplimientos de denuncias del empleador $2.000- (dos mil)", 0, 0);	
	}

	if ($row["ILTEMPLEADOR"] != "S")
		$pdf->Rect(12, 123, 104, 4, "DF");	

	$pdf->Output($file, "F");
Example #3
0
$pdf->Ln(5.2);
$pdf->Cell(8);
$pdf->Cell(38, 0, $row["PROVINCIA"]);

$pdf->Cell(36);
$pdf->Cell(32, 0, $row["CPOSTALA"]);

$pdf->Cell(16);
$pdf->Cell(28, 0, $row["LOCALIDAD"]);

$pdf->Cell(14);
$pdf->Cell(26, 0, $row["TELEFONOS"]);

$pdf->Ln(4);
$pdf->SetFillColor(255, 255, 255);
$pdf->Rect($pdf->GetX() + 128, $pdf->GetY(), 40, 4.6, "F");
$pdf->SetFillColor(0, 0, 0);

$pdf->SetFont("Arial", "B", 10);
$pdf->Ln(2.6);
$pdf->Cell(128);
$pdf->Cell(70, 0, " (".$row["DESCRIPCION"].")");

$pdf->Ln(3.6);
$pdf->Rect($pdf->GetX() + 8, $pdf->GetY(), 80, 4, "F");

$pdf->SetTextColor(255, 255, 255);
$pdf->SetFont("Arial", "B", 7);
$pdf->Ln(2.4);
$pdf->Cell(1);
$pdf->Cell(114, 0, $row["HEADER"].": CONDICIONES A CUMPLIR", 0, 0, "C");
 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;
 }
	}
	if ($row2["DEBITO"] == "") {
		$pdf->Ln(0.1);
		$pdf->Cell(57);
		$pdf->Cell(18.6, 0, "", 1, 0, "C");
	}
	$pdf->SetDrawColor(255, 255, 255);

	$pdf->Ln(3);
	$pdf->Cell(20);
	$pdf->Cell(24, 0, $row2["COD_PRODUCTOR"]);

	$pdf->Cell(4);
	$pdf->Cell(32, 0, $row2["CUITVENDEDOR"]);

	$pdf->Rect($pdf->GetX() + 2, $pdf->GetY() - 2, 12, 2.8, "DF");

	$pdf->Ln(4);
	$pdf->Cell(20);
	$pdf->Cell(80, 0, $row2["NOM_PRODUCTOR"]);
	$pdf->Ln(-4);

	$pdf->Ln(10.4);
	$pdf->Cell(16);
	$pdf->Cell(36, 0, $row2["FECHAVIGENCIADESDE"]);

	$pdf->Cell(15);
	$pdf->Cell(30, 0, $row2["FECHAVIGENCIAHASTA"]);


	// DATOS DEL EMPLEADOR..
$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";

$pdf->SetFont("Arial", "B", 8);
$pdf->Ln(2);
$pdf->Cell(132);
$pdf->Cell(20, 0, "Neto a Pagar:");
$pdf->Cell(43, 0, ValorSql($sql, 0, array()), 0, 0, "R");

$pdf->Output();
?>
	$pdf->Cell(2);
	$pdf->Cell(16, 0, $row["FECHA"]);

	$pdf->Cell(0.4);
	$pdf->Cell(30, 0, $row["NUMERO"]);

	$pdf->Cell(1.4);
	$pdf->Cell(95, 0, $row["DESCRIPCION"]);

	$pdf->SetFont("Arial", "", 8);
	$pdf->Cell(2);
	$pdf->Cell(17, 0, trim($row["MONTOFORMAT"]), 0, 0, "R");
	$pdf->SetFont("Arial", "", 7);
	
	$pdf->Ln(2);
	$pdf->Rect($pdf->GetX() - 4.6, $pdf->GetY(), 204, 0.2, "F");

	$i++;
	if ($i > MAX_LINEAS_POR_HOJA) {
		$i = 1;
	}
	$netoAPagar+= str_replace(",", ".", $row["MONTO"]);
}

$sql = "SELECT TO_CHAR(".$netoAPagar.", '".DB_FORMATMONEY."') montoformateado FROM DUAL";

$pdf->SetFont("Arial", "B", 8);
$pdf->Ln(4);
$pdf->Cell(132);
$pdf->Cell(20, 0, "Neto a Pagar:");
$pdf->Cell(44, 0, ValorSql($sql, 0, array()), 0, 0, "R");