<?php



//ini_set('display_errors',1);



require_once('../../libreriasphp/html2pdf/_tcpdf_5.9.206/tcpdf.php');



session_start();



require_once ("../../config/Cado.php");



require_once ("../../app/cuentapagada/cCuentapagada.php");

$oCuentapagada = new cCuentapagada();



require_once ("../../app/empresa/cEmpresa.php");

$oEmpresa = new cEmpresa();



require_once ("../../app/formatos/formato.php");

require_once ("../../app/formatos/fechas.php");



$dts=$oEmpresa->mostrarUno(1);

$dt = mysql_fetch_array($dts);

	$emp_ruc=$dt['tb_empresa_ruc'];

	$emp_nomcom=$dt['tb_empresa_nomcom'];

	$emp_razsoc=$dt['tb_empresa_razsoc'];

	$emp_dir=$dt['tb_empresa_dir'];

	$emp_dir2=$dt['tb_empresa_dir2'];

	$emp_tel=$dt['tb_empresa_tel'];

	$emp_ema=$dt['tb_empresa_ema'];

	$emp_fir=$dt['tb_empresa_fir'];		

mysql_free_result($dts);



$fec=date('d-m-Y');

	

$title = "REPORTE | CUENTAS PAGADAS JV - ".$fec;

$nombre_archivo = 'REPORTE | CUENTAS PAGADAS JV '.$fec.'.pdf';



// $file_name = 'FA-'.$serie.'-'.$numero.'-code.png';

// $path = 'temp/'.$file_name;

// $type = pathinfo($path, PATHINFO_EXTENSION);

// $data = file_get_contents($path);

// $base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);





class MYPDF extends TCPDF

{



    public function Header() {	

      //$image_file = K_PATH_IMAGES.'logo.jpg';

      //$this->Image($image_file, 20, 10, 71, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);

      // Set font

      //$this->SetFont('helvetica', 'B', 20);

      // Title

      //$this->Cell(0, 15, '<< TCPDF Example 003 >>', 0, false, 'C', 0, '', 0, false, 'M', 'M');

    }



    public function Footer() 

    {

       $style = array(

        'position' => 'L',

        'align' => 'L',

        'stretch' => false,

        'fitwidth' => true,

        'cellfitalign' => '',

        'border' => false,

        'padding' => 0,

        'fgcolor' => array(0,0,0),

        'bgcolor' => false,

        'text' => false

      //     'font' => 'helvetica',

      //     'fontsize' => 8,

      //     'stretchtext' => 4

      );



      $this -> SetY(-12);

      // Page number

      $this->SetFont('helvetica', '', 9);

      //$this->SetTextColor(0,0,0);

      $this->Cell(0, 0, 'Página '.$this->getAliasNumPage().' de '.$this->getAliasNbPages(), 'T', 1, 'R', 0, '', 0, false, 'T', 'M');

      

      $codigo='CAV-'.str_pad($_GET['d1'], 4, "0", STR_PAD_LEFT);

      

    

      $this->Cell(0, 0, 'www.grupovyf.com', 0, 1, 'C', 0, '', 0, false, 'T', 'M');      

    }

}



// create new PDF document

$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);



$pdf->SetCreator(PDF_CREATOR);

$pdf->SetAuthor('www.infosisperu.com');

$pdf->SetTitle($title);



$pdf->SetSubject('www.infosisperu.com');

$pdf->SetKeywords('www.infosisperu.com');



// set header and footer fonts

$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));

$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));



// set default monospaced font

$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);



//set margins

$pdf->SetMargins(12, 15, 12);// left top right

$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);

//$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);



//set auto page breaks

$pdf->SetAutoPageBreak(TRUE, 15);



//set image scale factor

$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);



//set some language-dependent strings

$pdf->setLanguageArray($l);



// ---------------------------------------------------------



// add a page

$pdf->AddPage('L', 'A4');



//font-family: Consolas, monaco, monospace;

//helvetica, monaco, monospace;



// Introducimos HTML de prueba

$html = '

<!DOCTYPE html>

<html lang="es">

<head>

    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>

	<link rel="shortcut icon" href="../../admin/bootstrap/images/favicon.png">

	

</head>

<style type="text/css">

    body {

        color: black;

        font-family: Verdana, Arial, Consolas;

        font-size: 7.5pt;

    }

    .header_row th {

		font-size:28px;

		background-color:#eee;

        border-bottom: 0.9px solid #010101;

        border-right: 0.9px solid #010101;

        border-left: 0.9px solid #010101;

        border-top: 0.9px solid #010101;

    }

    .odd_row td {

        background-color: transparent;

        border-bottom: 0.9px solid #010101;

        padding-top: 5px;

        padding-bottom: 5px;

    }

    .even_row td {

        padding-top: 5px;

        padding-bottom: 5px;

        background-color: #f6f6f6;

        border-bottom: 0.9px solid #010101;

    }

    .row td{

        border-right: 0.9px solid #010101;

        border-left: 0.9px solid #010101;

    }

	

	

	

	div#div_tabla {  }

	div#div_tabla table { border-collapse: collapse; width: 100%; }

	div#div_tabla table td, div#div_tabla table th { border: 1px solid #eee;font-family:arial; font-size:20px; }

	

</style>



<style media="print">

    .oculto{

        display: none;

    }



</style>

<body>





<table style="width: 100%; margin-bottom: 10px">

	<tr>

	<td width="15%">

	<img src="../../imagenes/logo.png" alt="" />

	</td>

        <td style="text-align: left" width="50%">

		<br />

		<br />

		<br />

            <strong style="font-size:35px">'.$emp_razsoc.'</strong><br>

            '.$emp_dir.'<br />   <strong>Telf.: '.$emp_tel.'  E-mail.: '.$emp_ema.'</strong> 

        </td>   

	    <td style="text-align: center;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;padding:2px;" width="30%">

		<br />

		<br />

		<br />

		   <strong style="font-size: 40px">ESTADO DE CUENTAS PAGADAS JV<br>POR PROVEEDOR</strong>

        </td>

    </tr>

</table>



<br />

<br />		

';

































if($_GET['com']==1){

	

$tip = 1;



if($_GET['comope']!==""){

	$por = '1';

}else if($_GET['comven']!==""){

	$por = '2';

}



if($_GET['comasc']!==""){

	$ord = '1';

}else if($_GET['comdesc']!==""){

	$ord = '2';

}



$dtsa = $oCuentapagada->cuentas_pagada_reporte_agru($_GET['proid'],'2',$tip,$por,fecha_mysql($_GET['comfec1']),fecha_mysql($_GET['comfec2']),$ord);

$num_rows= mysql_num_rows($dtsa);

 

		

	$html.='

	<div id="div_tabla">

	<table id="tabla_resumen_todos" width="100.4%" class="">

           <thead>

			

			<tr style="font-weight:bold;font-size:35px;background-color:red;;color:#fff;">

				<th colspan="13" >COMPROBANTES</th>

			</tr>

				

			<tr class="header_row" >

				<th width="50" align="center" >PROVEEDOR</th>

				<th width="18" align="center" >E</th>

				<th width="18" align="center" >T</th>			

				<th width="55" align="center" >NUMERO</th>

				<th width="45" align="center" >EMISION</th>

				<th width="45" align="center" >VCTO</th>												

				<th width="25" align="center" >BAN</th>				

				<th width="50" align="center" >NUM.UNI.</th>	

				<th width="48" align="center" >CONDICION</th>	

				<th width="22" align="center" >M</th>	

				<th width="35" align="center" >IMP.</th>				

				<th width="48" align="center" >MODO</th>										

				<th width="15" align="center" >DIA</th>										

				<th width="45" align="center" >OPE.</th>										

				<th width="25" align="center" >B.O.</th>					

				<th width="68" align="center" >CUENTA</th>					

				<th width="25" align="center" >B.D.</th>					

				<th width="68" align="center" >CUENTA</th>					

				<th width="68" align="center" >CTA PRO.</th>										

				<th width="50" align="center" >NRO OPE.</th>					

				<th width="35" align="center" >G.OPE.</th>					

				<th width="35" align="center" >PAGADO</th>					

				<th width="70" align="center" >RESP.</th>														

			</tr>

			</thead>

			<tbody>	

		

		';

		

		if($num_rows>0){

		

		while($dta = mysql_fetch_array($dtsa))

		{ 			

		

		$dts1 = $oCuentapagada->cuentas_pagada_reporte($_GET['proid'],'2',$tip,$por,fecha_mysql($dta['fecha']),fecha_mysql($dta['fechaven']),$ord,$dta['con']);

		$num_rowsf= mysql_num_rows($dts1);

		while($dt1 = mysql_fetch_array($dts1))

		{

			$banori = '';

			$ban = '';

			$bandes = '';

			$mod = '';

			$mone_id = $dt1['mon'];	

		

			$total = $dt1['tb_comprapago_mon'];

			if($mone_id==1){

					$lbl_mone = 'S/';

			}else if($mone_id==2){

					$lbl_mone = 'US$';

			}

					

			if($dt1['tb_comprapago_fecven']!='0000-00-00'){

				$fecven = mostrarFecha($dt1['tb_comprapago_fecven']);

				$dias = dias_transcurridos($dt1['tb_egreso_fec'],$dt1['tb_comprapago_fecven']);

				if($dias<0){

					$dias = 0;

				}else{

					$dias = $dias ;

				}

			}else{

				$fecven='E/CONTADO';

				$dias = '';

			}

			

			if($dt1['banid']==0){

				$ban = '';

			}else if($dt1['banid']==1){

				$ban = 'BCP';

			}else if($dt1['banid']==2){

				$ban = 'BBVA';

			}else if($dt1['banid']==3){

				$ban = 'SCT';

			}

			

			if($dt1['tb_banco_ori']==1){

			$banori = 'BCP';

		}else if($dt1['tb_banco_ori']==2){

			$banori = 'BBVA';

		}else if($dt1['tb_banco_ori']==3){

			$banori = 'SCT';

		}else if($dt1['tb_banco_ori']==4){

			$banori = 'CMA TRUJILLO';

		}else if($dt1['tb_banco_ori']==5){

			$banori = 'CMA PIURA';

		}



		if($dt1['tb_banco_des']==1){

			$bandes = 'BCP';

		}else if($dt1['tb_banco_des']==2){

			$bandes = 'BBVA';

		}else if($dt1['tb_banco_des']==3){

			$bandes = 'SCT';

		}else if($dt1['tb_banco_des']==4){

			$bandes = 'CMA TRUJILLO';

		}else if($dt1['tb_banco_des']==5){

			$bandes = 'CMA PIURA';

		}

		

		if($dt1['tb_egreso_modo']==1){

			$mod = 'EFECTIVO';

		}else if($dt1['tb_egreso_modo']==2){

			$mod = 'DEPOSITO';

		}else if($dt1['tb_egreso_modo']==3){

			$mod = 'TRANSFERENCIA';

		}else if($dt1['tb_egreso_modo']==4){

			$mod = 'CHEQUE';

		}			

		

		if($dt1['tb_comprapago_con']==1){

			$con = 'CBRZAS';

		}else if($dt1['tb_comprapago_con']==2){

			$con = 'DSCTOS';

		}else if($dt1['tb_comprapago_con']==3){

			$con = 'CARTERAS';

		}else if($dt1['tb_comprapago_con']==0){

			$con = 'SIN CONDICION';

		}

		

				$html.='<tr class="row" >

				<td width="50" align="left" nowrap >'.$dt1['tb_proveedor_alias'].'</td>

				<td width="18" align="left">'.$dt1['tb_empresa_nomcom'].'</td>

				<td width="18" align="left">'.$dt1['tb_documento_abr'].'</td>

				<td width="55" align="left" nowrap >'.$dt1['tb_compra_numdoc'].'</td>					

				<td width="45" nowrap align="left">'.mostrarFecha($dt1['tb_compra_fec']).'</td>	

				<td width="45" align="left">'.$fecven.'</td>																				

				<td width="25" align="left">'.$ban.'</td>					

				<td width="50" align="left" nowrap >'.$dt1['tb_comprapago_numuni'].'</td>

				<td width="48" align="left" nowrap >'.$con.'</td>

				<td width="22" align="left"><strong>'.$lbl_mone.'</strong></td>					

				<td width="35" align="right"><strong>'.formato_money($dt1['tb_comprapago_mon']).'</strong></td>				

				<td width="48" align="left">'.$mod .'</td>

				<td width="15" align="left">'.$dias.'</td>	

				<td width="45" align="left">'.mostrarFecha($dt1['tb_egreso_fec']).'</td>

				<td width="25" align="left">'.$banori .'</td>							

				<td width="68" align="left">'.$dt1['tb_cuenta_ori'].'</td>							

				<td width="25" align="left">'.$bandes.'</td>							

				<td width="68" align="left">'.$dt1['tb_cuenta_des'].'</td>							

				<td width="68" align="left" nowrap >'.$dt1['tb_proveedorcuenta_nrocue'].'</td>																		

				<td width="50" align="right" nowrap >'.$dt1['tb_egreso_nroope'].'</td>							

				<td width="35" align="right" nowrap >'.formato_money($dt1['tb_egreso_gasope']).'</td>							

				<td width="35" align="right" nowrap >'.formato_money($dt1['tb_egreso_val']).'</td>							

				<td width="70" align="left" nowrap >'.$dt1['tb_egreso_cob'].'</td>

				

			</tr>';		

		}

		

		if($por==1){

			$lbl = 'TOTAL DE PAGOS SEGUN FECHA DE OPERACION : ';

			$fe = mostrarFecha($dta['fecha']);

		}else if($por==2){

			$fe = mostrarFecha($dta['fechaven']);

			$lbl = 'TOTAL DE PAGOS SEGUN FECHA DE VENCIMIENTO : ';

		}

		

		$html.='

		<tr class="" style="background-color:#80cbc4;" >

		<td colspan="7" align="right" >'. $lbl.'<strong>'. $fe .'</strong> </td>

		<td colspan="15" align="right" > <strong> S/ '. formato_money($dta['soles']).'</strong> <span> | </span> 

		<strong> US$ '.formato_money($dta['dolares']).'</strong> </td>

		<td colspan="1" align="right" ></td>

		</tr>

		';

		} 

		$con = '';

		mysql_free_result($dts1); 

		

		}else{		

		$html.='<tr>

			<td colspan="23" align="center" >No hay cuentas pagadas</td>

			</tr>';

		}

		

		$html.='</tbody>

			<tr class="even" style="background-color:#eee;">

				<td colspan="23" ></td>

			</tr>

      </table> 

	  </div> ';

}







if($_GET['letra']==1){

	

$tiplet = 2;



if($_GET['letraope']!==""){

	$porlet = '1';

}else if($_GET['letraven']!==""){

	$porlet = '2';

}



if($_GET['letraasc']!==""){

	$ordlet = '1';

}else if($_GET['letradesc']!==""){

	$ordlet = '2';

}

 

 //echo fecha_mysql($_POST['letrafec1']).'--'.fecha_mysql($_POST['letrafec2']);

 

$dtsa = $oCuentapagada->cuentas_pagada_reporte_agru($_GET['proid'],'2',$tiplet,$porlet,fecha_mysql($_GET['letrafec1']),fecha_mysql($_GET['letrafec2']),$ordlet);

$num_rows= mysql_num_rows($dtsa);

		

	$html.='

	

	

<br />



<table style="width: 100%;font-size:32px;padding-bottom:4px;padding-top:4px; border-bottom: 0.9px solid #010101;

        border-right: 0.9px solid #010101;

        border-left: 0.9px solid #010101;

        border-top: 0.9px solid #010101;padding:3px;" >

  

    <tr class="header_row">

        <td width="20%" style="text-align: left; border-bottom: 0.9px solid #010101;

        border-right: 0.9px solid #010101;

        border-left: 0.9px solid #010101;

        border-top: 0.9px solid #010101;">LEYENDA</td>

    </tr>

	<tr class="header_row">

        <td width="20%" style="text-align: left; border-bottom: 0.9px solid #010101;

        border-right: 0.9px solid #010101;

        border-left: 0.9px solid #010101;

        border-top: 0.9px solid #010101;">a) DIAS MORA</td>

   

        <td width="20%" style="text-align: left; border-bottom: 0.9px solid #010101;

        border-right: 0.9px solid #010101;

        border-left: 0.9px solid #010101;

        border-top: 0.9px solid #010101;">b) INTERES VENCIDO</td>

    

        <td width="20%" style="text-align: left; border-bottom: 0.9px solid #010101;

        border-right: 0.9px solid #010101;

        border-left: 0.9px solid #010101;

        border-top: 0.9px solid #010101;">c) INETERES MORATORIO</td>

		

		<td width="20%" style="text-align: left; border-bottom: 0.9px solid #010101;

        border-right: 0.9px solid #010101;

        border-left: 0.9px solid #010101;

        border-top: 0.9px solid #010101;">d) INTERES COMPENSATORIO</td>

    </tr>

	<tr class="header_row">

        

        <td width="20%" style="text-align: left; border-bottom: 0.9px solid #010101;

        border-right: 0.9px solid #010101;

        border-left: 0.9px solid #010101;

        border-top: 0.9px solid #010101;">e) GASTO PROTESTO</td>

    

        <td width="20%" style="text-align: left; border-bottom: 0.9px solid #010101;

        border-right: 0.9px solid #010101;

        border-left: 0.9px solid #010101;

        border-top: 0.9px solid #010101;">f) COMISION PROTESTO</td>

		

		<td width="20%" style="text-align: left; border-bottom: 0.9px solid #010101;

        border-right: 0.9px solid #010101;

        border-left: 0.9px solid #010101;

        border-top: 0.9px solid #010101;">g) INTERES ADELANTADO PROTESTO</td>

   

        <td width="20%" style="text-align: left; border-bottom: 0.9px solid #010101;

        border-right: 0.9px solid #010101;

        border-left: 0.9px solid #010101;

        border-top: 0.9px solid #010101;">h) COMISION RENOVACION</td>

		

    </tr>

	<tr class="header_row">

          

        <td width="20%" style="text-align: left; border-bottom: 0.9px solid #010101;

        border-right: 0.9px solid #010101;

        border-left: 0.9px solid #010101;

        border-top: 0.9px solid #010101;">i) PORTE</td>

   

        <td width="20%" style="text-align: left; border-bottom: 0.9px solid #010101;

        border-right: 0.9px solid #010101;

        border-left: 0.9px solid #010101;

        border-top: 0.9px solid #010101;">j) COMISION DEVOLUCION VALORADA</td>

   

        <td width="20%" style="text-align: left; border-bottom: 0.9px solid #010101;

        border-right: 0.9px solid #010101;

        border-left: 0.9px solid #010101;

        border-top: 0.9px solid #010101;">K) DIAS PRORROGA</td>

    </tr>

	

</table>



<br />

<br />



	

	

	

	<div id="div_tabla"  >

	<table width="103.3%" id="tabla_resumen_todos" class="table table-bordered table-striped">

           <thead>

			

			<tr class="" style="font-weight:bold;font-size:35px;background-color:red;color:#fff;">

				<th colspan="13" style="border-bottom: 0.9px solid #010101;

        border-right: 0.9px solid #010101;

        border-left: 0.9px solid #010101;

        border-top: 0.9px solid #010101;" >LETRAS DE CAMBIO</th>

			</tr>

			

				

				<tr class="header_row">				

				<th width="276px" align="center" >DETALLES DOCUMENTO</th>

				<th width="114px" align="center" >UBICACION</th>

				<th width="138px" align="center" >PAGO</th>

				<th width="225px" align="center" >GASTOS INTERESES</th>

				<th width="99px" align="center" >RENOVACION</th>

				<th width="139px" align="center" >TOTAL</th>

				

			</tr>

			

			<tr class="header_row">				

				<th width="45" align="center" >PROVEEDOR</th>

				<th width="18" align="center" >E</th>

				<th width="15" align="center" >T.D.</th>

				<th width="48" align="center" >NUMERO</th>

				<th width="44" align="center" >EMISION</th>

				<th width="44" align="center" >VCTO</th>				

				<th width="22" align="center" >M</th>								

				<th width="40" align="center" >IMPORTE</th>

				

				<th width="28" align="center" >BAN</th>

				<th width="38" align="center" >CONDICION</th>

				<th width="48" align="center" >NUM. UNI.</th>

				

				<th width="34" align="center" >MODO</th>

				<th width="44" align="center" >FECHA OP.</th>

				<th width="15" align="center" >a)</th>

				<th width="45" align="center" >Nº OP.</th>

				

				<th width="25" align="center" >b)</th>

				<th width="25" align="center" >c)</th>

				<th width="25" align="center" >d)</th>

				<th width="25" align="center" >e)</th>

				<th width="25" align="center" >f)</th>

				<th width="25" align="center" >j)</th>

				<th width="25" align="center" >h)</th>

				<th width="25" align="center" >i)</th>

				<th width="25" align="center" >j)</th>

				

				<th width="40" align="center" >NUEVO IMPORTE)</th>

				<th width="44" align="center" >NUEVA FECHA</th>

				<th width="15" align="center" >k)</th>

				

				<th width="34" align="center" >TASA</th>

				<th width="25" align="center" >ITF</th>

				<th width="40" align="center" >AMORT.</th>

				<th width="40" align="center" >IMPORTE PAGADO</th>

			</tr>



			</thead>

			<tbody>	

		

		';

		

		if($num_rows>0){

			

		while($dta = mysql_fetch_array($dtsa))

		{ 			

				

		 $dts1 = $oCuentapagada->cuentas_pagada_reporte($_GET['proid'],'2',$tiplet,$porlet,fecha_mysql($dta['fecha']),fecha_mysql($dta['fechaven']),$ordlet,$dta['con']);

		 $num_rowsf= mysql_num_rows($dts1);

		 while($dt1 = mysql_fetch_array($dts1))

		{

			$mone_id = $dt1['mon'];	

			

			$total = $dt1['tb_comprapago_mon'];

			

			if($mone_id==1){

					$lbl_mone = 'S/ ';

			}else if($mone_id==2){

					$lbl_mone = 'US$ ';

			}

			

			if($dt1['banid']==0){

				$ban = '';

			}else if($dt1['banid']==1){

				$ban = 'BCP';

			}else if($dt1['banid']==2){

				$ban = 'BBVA';

			}else if($dt1['banid']==3){

				$ban = 'SCT';

			}



			if($dt1['tb_comprapago_fecven']!='0000-00-00'){

				$fecven = mostrarFecha($dt1['tb_comprapago_fecven']);

				$dias = dias_transcurridos($dt1['tb_egreso_fec'],$dt1['tb_comprapago_fecven']);

				if($dias<0){

					$dias = 0;

				}else{

					$dias = $dias ;

				}

			}else{

				$fecven='E/CONTADO';

				$dias = '';

			}

			

			

  if($dt1['tb_egreso_modo']==1){

    $egretip = 'CANCE';

	$nvofec = '';

	$diapro = '';

	

  }else if($dt1['tb_egreso_modo']==2){

    $egretip = 'AMORT';

	$nvofec = mostrarFecha($dt1['tb_egreso_nvofecven']);

	$diapro = $dt1['tb_egreso_diapro'];

  }

  

		if($dt1['tb_comprapago_con']==1){

			$con = 'CBRZAS';

		}else if($dt1['tb_comprapago_con']==2){

			$con = 'DSCTOS';

		}else if($dt1['tb_comprapago_con']==3){

			$con = 'CARTERAS';

		}else if($dt1['tb_comprapago_con']==0){

			$con = 'SIN CONDICION';

		}

  

  

				$html.='<tr class="row" >

				<td width="45" align="left" nowrap >'.$dt1['tb_proveedor_alias'].'</td>

				<td width="18" align="left">'.$dt1['tb_empresa_nomcom'].'</td>

				<td width="15" align="left">'.$dt1['tb_documento_abr'] .'</td>

				<td width="48" align="left" nowrap >'.$dt1['tb_compra_numdoc'].'</td>	

				<td width="44" nowrap align="left">'.mostrarFecha($dt1['tb_compra_fec']).'</td>					

				<td width="44" align="left">'. $fecven .'</td>					

				<td width="22" align="left">'.$lbl_mone.'</td>

				<td width="40" align="right"><strong> '. formato_money($dt1['tb_comprapago_mon']).'</strong> </td>	

				

				<td width="28" align="left">'. $ban.'</td>					

				<td width="38" align="left" nowrap >'.$con.'</td>				

				<td width="48" align="left" nowrap >'. $dt1['tb_comprapago_numuni'].'</td>

				

				

				<td width="34" align="left"  >'. $egretip.'</td>	

				<td width="44" align="left"  >'. mostrarFecha($dt1['tb_egreso_fec']).'</td>								

				<td width="15" align="left">'.$dias.'</td>

				<td width="45" align="left">'.$dt1['tb_egreso_nroope'].'</td>	

				

				<td width="25" align="right"  >'. formato_money($dt1['tb_egreso_intven']).'</td>				

				<td width="25" align="right">'. formato_money($dt1['tb_egreso_intmora']).'</td>			

				<td width="25" align="right">'. formato_money($dt1['tb_egreso_intcom']).'</td>	

				

				<td width="25" align="right">'. formato_money($dt1['tb_egreso_gaspro']).'</td>			

				<td width="25" align="right">'. formato_money($dt1['tb_egreso_compro']).'</td>

				<td width="25" align="right">'. formato_money($dt1['tb_egreso_intade']).'</td>							

				<td width="25" align="right">'. formato_money($dt1['tb_egreso_gasope']).'</td>

				<td width="25" align="right">'. formato_money($dt1['tb_egreso_por']).'</td>

				<td width="25" align="right" >'. formato_money($dt1['tb_egreso_comdeval']).'</td>

				

							

				<td width="40" align="right" nowrap >'. formato_money($dt1['tb_egreso_nvoimp']).'</td>			

				<td width="44" align="left" nowrap >'.$nvofec.'</td>

				<td width="15" align="left" nowrap >'. $diapro.'</td>

				<td width="34" align="left" nowrap >'. formato_money($dt1['tb_egreso_tas']) .' %'.'</td>	

				<td width="25" align="right" nowrap >'. formato_money($dt1['tb_egreso_itf']).'</td>	

				<td width="40" align="right" nowrap >'. formato_money($dt1['tb_egreso_amor']).'</td>				

				<td width="40" align="right" nowrap >'. formato_money($dt1['tb_egreso_val']).'</td>	

	

			</tr>';		

			

		

		}

		

		if($porlet==1){

			$lbl = 'TOTAL DE PAGOS SEGUN FECHA DE OPERACION : ';

			$fe = mostrarFecha($dta['fecha']);

		}else if($porlet==2){

			$fe = mostrarFecha($dta['fechaven']);

			$lbl = 'TOTAL DE PAGOS SEGUN FECHA DE VENCIMIENTO : ';

		}

		

		

		

		$html.='<tr class="" style="background-color:#80cbc4;" >

		<td colspan="8" align="right" >'. $lbl .' <strong>'. $fe .'</strong></td>

		<td colspan="24" align="right" > <strong> S/ '.formato_money($dta['soles']).'</strong> <span> | </span> 

		<strong>US$ '.formato_money($dta['dolares']).'</strong> </td>

		</tr>';

		

		} 

		

		mysql_free_result($dts1); 

		

		}else{		

		$html.='<tr>

			<td colspan="42" align="center" >No hay cuentas por pagar.</td>

			</tr>';

		}

		

		$html.='</tbody>

			<tr class="even" style="background-color:#eee;">

				<td colspan="42" ></td>

			</tr>

      </table> 

	  </div> ';

}































$html.='

<br />

<br />

<br />



</body>

</html>';



$pdf->writeHTML($html, true, 0, true, true);



//$pdf->write2DBarcode($ruc_empresa.'|'.$idcomprobante.'|'.$serie.'|'.$numero.'|'.$toigv.'|'.$importetotal.'|'.fecha_mysql($fecha).'|'.$idtipodni.'|'.$ruc.'|', 'QRCODE,Q', 157, 99, 40, 40, $style, 'N');



$pdf->Output($nombre_archivo, 'I');



