<?php
include_once('../core/basededatos.php');
include_once('../core/Paciente.php');
include_once('../core/Factura.php');
include_once('../core/Numeros.php');
include('./class.ezpdf.php');
session_start();
$paciente=new Paciente();
$paciente->id=$_GET['Pac'];
$paciente->obtenerdatos();
$paciente->obtenerFiscal();
$factura=new Factura();
$factura->numero=$_GET['numero'];
$factura->id_paciente=$_GET['Pac'];
$factura->Get();
header("Content-Type:application/xhtml+xml; charset=ISO-8859-1;");

$pdf=&new Cezpdf('letter');
$pdf->selectFont('./fonts/Helvetica.afm');
$datacreator = array (
					'Title'=>'CECOM - FACTURA',
					'Author'=>'CECOM',
					'Subject'=>'Factura',					
					);
$pdf->addInfo($datacreator);

$cantidad=explode(".",$factura->total);	
if(!$cantidad[1])
{
	$cantidad[1]="00";
}

$pdf->selectFont('./fonts/Helvetica-Bold.afm');
$pdf->addText(130,640,10,$paciente->nombrefiscal,0,0);
$pdf->addText(130,620,10,$paciente->domiciliofiscal,0,0);
$pdf->addText(500,640,10,$paciente->rfc,0,0);
$pdf->addText(500,590,10,"$ ".number_format($factura->cantidad,2),0,0);
$pdf->addText(500,570,10,"$ ".number_format($factura->isr,2),0,0);
$pdf->addText(500,550,10,"$ ".number_format($factura->total,2),0,0);
$pdf->addText(140,530,8,strtoupper(num2letras($cantidad[0]))." PESOS ".$cantidad[1]."/100 MN",0,0);
$pdf->addText(200,510,10,$_GET['nombre'],0,0);
$pdf->addText(200,490,10,$factura->concepto,0,0);
$pdf->addText(350,470,10,$_GET['dia'],0,0);
$pdf->addText(430,470,10,$_GET['mes'],0,0);
$pdf->addText(560,470,10,$_GET['ano'],0,0);
$pdf->selectFont('./fonts/Helvetica.afm');
$pdf->ezText("\n\n\n",8,array('justification' => 'center'));

$pdf->selectFont('./fonts/Helvetica-Bold.afm');
$pdf->addText(130,220,10,$paciente->nombrefiscal,0,0);
$pdf->addText(130,200,10,$paciente->domiciliofiscal,0,0);
$pdf->addText(500,220,10,$paciente->rfc,0,0);
$pdf->addText(500,175,10,"$ ".number_format($factura->cantidad,2),0,0);
$pdf->addText(500,155,10,"$ ".number_format($factura->isr,2),0,0);
$pdf->addText(500,135,10,"$ ".number_format($factura->total,2),0,0);
$pdf->addText(140,110,8,strtoupper(num2letras($cantidad[0]))." PESOS ".$cantidad[1]."/100 MN",0,0);
$pdf->addText(200,90,10,$paciente->nombre." ".$paciente->apellidop." ".$paciente->apellidom,0,0);
$pdf->addText(200,70,10,$factura->concepto,0,0);
$pdf->addText(350,50,10,$_GET['dia'],0,0);
$pdf->addText(430,50,10,$_GET['mes'],0,0);
$pdf->addText(560,50,10,$_GET['ano'],0,0);
$pdf->selectFont('./fonts/Helvetica-Bo500ld.afm');
//$datostabla[]=array('cons'=>$contador,'tipo'=>substr($cargas[1],0,17),'razon'=>$cliente->razon_social,'placas'=>$carga->placas,'modelo'=>$carga->modelo,'vehiculo'=>$carga->peso_vacio,'carga'=>$peso,'total'=>$carga->peso_lleno,'contenido'=>$carga->observaciones,'largo'=>$carga->largo);
$pdf->ezStream();
?>

