<div class="row">
	<h2 class="text-center">Corte <?php if($corteInfo['tipo']==0 || $corteInfo['tipo']==1){echo "X";}else{echo "Z";}?></h2>
	<div class="text-center">
		<span><?php echo date("d-m-Y H:i:s", strtotime($corteInfo['fecha']));?></span><br>
		<span>Corte No.: <?php echo $corteInfo['correlativo'];?></span>
	</div>
	<div class="hr-line-dashed"></div>
	
	<div class="row">
		<label class="col-xs-1"></label>
		<label class="col-xs-6">Total Gravadas</label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-3 text-right"><?php echo $corteInfo['total_grabado_tk'];?></span>
	</div>
	<div class="row">
		<label class="col-xs-1"></label>
		<label class="col-xs-6">Total Exentas</label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-3 text-right"><?php echo $corteInfo['total_exento_tk'];?></span>
	</div>
	<div class="row">
		<label class="col-xs-1"></label>
		<label class="col-xs-6">Total No Sujetas</label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-3 text-right"><?php echo $corteInfo['total_nosujeto_tk'];?></span>
	</div>
	<div class="row">
		<label class="col-xs-1"></label>
		<label class="col-xs-6"><strong>TOTAL TICKET</strong></label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-3 text-right"><?php echo $corteInfo['total_grabado_tk']+$corteInfo['total_exento_tk']+$corteInfo['total_nosujeto_tk'];?></span>
	</div>
	<hr></hr>
	<div class="row">
		<label class="col-xs-1"></label>
		<label class="col-xs-6">Total Gravadas</label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-3 text-right"><?php echo $corteInfo['total_grabado_fac'];?></span>
	</div>
	<div class="row">
		<label class="col-xs-1"></label>
		<label class="col-xs-6">Total Exentas</label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-3 text-right"><?php echo $corteInfo['total_exento_fac'];?></span>
	</div>
	<div class="row">
		<label class="col-xs-1"></label>
		<label class="col-xs-6">Total No Sujetas</label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-3 text-right"><?php echo $corteInfo['total_nosujeto_fac'];?></span>
	</div>
	<div class="row">
		<label class="col-xs-1"></label>
		<label class="col-xs-6"><strong>TOTAL FACTURA</strong></label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-3 text-right"><?php echo $corteInfo['total_grabado_fac']+$corteInfo['total_exento_fac']+$corteInfo['total_nosujeto_fac'];?></span>
	</div>
	<hr></hr>
	<div class="row">
		<label class="col-xs-1"></label>
		<label class="col-xs-6">Total Gravadas</label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-3 text-right"><?php echo $corteInfo['total_grabado_ccf'];?></span>
	</div>
	<div class="row">
		<label class="col-xs-1"></label>
		<label class="col-xs-6">Total Exentas</label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-3 text-right"><?php echo $corteInfo['total_exento_ccf'];?></span>
	</div>
	<div class="row">
		<label class="col-xs-1"></label>
		<label class="col-xs-6">Total No Sujetas</label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-3 text-right"><?php echo $corteInfo['total_nosujeto_ccf'];?></span>
	</div>
	<div class="row">
		<label class="col-xs-1"></label>
		<label class="col-xs-6"><strong>TOTAL CCF</strong></label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-3 text-right"><?php echo $corteInfo['total_grabado_ccf']+$corteInfo['total_exento_ccf']+$corteInfo['total_nosujeto_ccf'];?></span>
	</div>
	<hr></hr>
	<div class="row">
		<label class="col-xs-1"></label>
		<label class="col-xs-6"><strong>TOTAL DEVOLUCIONES</strong></label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-3 text-right">(<?php echo $corteInfo['total_devoluciones'];?>)</span>
	</div>
	<hr></hr>
	<div class="row">
		<label class="col-xs-1"></label>
		<label class="col-xs-6"><strong>VENTA TOTAL</strong></label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-3 text-right"><?php echo $corteInfo['total_grabado_tk']+$corteInfo['total_exento_tk']+$corteInfo['total_nosujeto_tk']+$corteInfo['total_grabado_fac']+$corteInfo['total_exento_fac']+$corteInfo['total_nosujeto_fac']+$corteInfo['total_grabado_ccf']+$corteInfo['total_exento_ccf']+$corteInfo['total_nosujeto_ccf']-$corteInfo['total_devoluciones'];?></span>
	</div>
	<!--
	<div class="row">
		<label class="col-xs-1"></label>
		<label class="col-xs-5">Ventas  S/Doc.</label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-4 text-right"><?php echo $corteInfo['ventasSD'];?></span>
	</div>
	<div class="row">
		<label class="col-xs-1">+</label>
		<label class="col-xs-5">Ventas  Fact.</label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-4 text-right"><?php echo $corteInfo['ventasFac'];?></span>
	</div>
	<div class="row">
		<label class="col-xs-1">+</label>
		<label class="col-xs-5">Ventas  CCF.</label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-4 text-right"><?php echo $corteInfo['ventasCCF'];?></span>
	</div>
	<div class="row">
		<label class="col-xs-1">=</label>
		<label class="col-xs-5">V. efectivo.</label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-4 text-right"><?php echo $corteInfo['ventasSD']+$corteInfo['ventasFac']+$corteInfo['ventasCCF'];?></span>
	</div>
	<div class="row">
		<label class="col-xs-1">-</label>
		<label class="col-xs-5">Devoluciones</label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-4 text-right">(<?php echo $corteInfo['devoluciones'];?>)</span>
	</div>
	<div class="row">
		<label class="col-xs-1">=</label>
		<label class="col-xs-5">Ingresos diarios</label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-4 text-right"><?php echo $corteInfo['ventasSD']+$corteInfo['ventasFac']+$corteInfo['ventasCCF']-$corteInfo['devoluciones'];?></span>
	</div>
	<div class="hr-line-dashed"></div>
	<div class="row">
		<label class="col-xs-1">+</label>
		<label class="col-xs-5">Cambio</label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-4 text-right"><?php echo $corteInfo['cambio'];?></span>
	</div>
	<div class="row">
		<label class="col-xs-1">=</label>
		<label class="col-xs-5">TOTAL</label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-4 text-right"><?php echo $corteInfo['ventasSD']+$corteInfo['ventasFac']+$corteInfo['ventasCCF']-$corteInfo['devoluciones']+$corteInfo['cambio'];?></span>
	</div>
	<div class="hr-line-dashed"></div>
	<div class="row">
		<label class="col-xs-1"></label>
		<label class="col-xs-5">Ventas cr&eacute;dito</label>
		<label class="col-xs-1">$</label>
		<span class="col-xs-4 text-right"><?php echo $corteInfo['ventasCredito'];?></span>
	</div>
	-->
	
	<div class="hr-line-dashed"></div>
	<div class="row text-center">
		<button class="btn btn-primary"> <i class="fa fa-print"></i> Imprimir</button>
		<button class="btn btn-danger" onclick="javascript:window.location.reload(true);"> <i class="fa fa-times"></i> Salir</button>
	</div>
</div>
<?php
	$this->load->library('printer');
	$this->load->library('enletras');
	
	$phpPrinter = new Printer();
	$phpInletters = new EnLetras();
	
	$acum = 0;
	
	if($corteInfo['tipo']==0 || $corteInfo['tipo']==1){
		$corte = "X";
	}else{
		$corte = "Z";
	}
	
	/*Init*/
	$printer = printer_open("EPSON TM-U950 Receipt");

	printer_set_option($printer, PRINTER_MODE, 'RAW');

	printer_start_doc($printer, 'Corte : '.$corte." ".$corteInfo['correlativo']);

	printer_start_page($printer);
	
	/*Body*/
	
	$font = printer_create_font('Arial', 10, 8, PRINTER_FW_BOLD, false, false, false, 0);	
	printer_select_font($printer, $font);
	
	$phpPrinter->printString($phpPrinter->cutString(strtoupper(utf8_decode($configs['NombreEmpresa'])),28),1,$printer,$acum,10,10);
	
	printer_delete_font($font);
	
	$font = printer_create_font('Arial', 10, 8, PRINTER_FW_THIN, false, false, false, 0);	
	printer_select_font($printer, $font);
	
	$phpPrinter->tabPrinter($acum,10);
	
	$phpPrinter->printString($phpPrinter->cutString(strtoupper(utf8_decode($configs['RazonSocialEmpresa'])),28),1,$printer,$acum,10,10);
	$phpPrinter->printString($phpPrinter->cutString(strtoupper(utf8_decode($configs['DireccionEmpresa'])),28),1,$printer,$acum,10,10);
	$phpPrinter->printString($phpPrinter->cutString(strtoupper(utf8_decode('NRC: '.$configs['NRCEmpresa'])),28),1,$printer,$acum,10,10);
	$phpPrinter->printString($phpPrinter->cutString(strtoupper(utf8_decode('NIT: '.$configs['NITEmpresa'])),28),1,$printer,$acum,10,10);
	$phpPrinter->printString($phpPrinter->cutString(strtoupper(utf8_decode('Autorizacion segun Resolucion')),28),1,$printer,$acum,10,10);
	$phpPrinter->printString($phpPrinter->cutString(strtoupper(utf8_decode('No '.$resolucion[0]->num_resolucion)),28),1,$printer,$acum,10,10);
	$phpPrinter->printString($phpPrinter->cutString(strtoupper(utf8_decode('Del '.$resolucion[0]->tiraje_desde)),28),1,$printer,$acum,10,10);
	$phpPrinter->printString($phpPrinter->cutString(strtoupper(utf8_decode('Al '.$resolucion[0]->tiraje_hasta)),28),1,$printer,$acum,10,10);
	//$phpPrinter->printString($phpPrinter->cutString(strtoupper(utf8_decode('Ticket '.$resolucion[0]->tiraje_actual)),28),1,$printer,$acum,10,10);
	$phpPrinter->printString($phpPrinter->cutString(strtoupper(utf8_decode('Caja: '.$cajaInfo[0]->nombre_caja)),28),1,$printer,$acum,10,10);
	$phpPrinter->printString($phpPrinter->cutString(strtoupper(utf8_decode('Vendedor: '.$vendedor[0]->nombre_usuario)),28),1,$printer,$acum,10,10);
	
	$phpPrinter->tabPrinter($acum,10);
	
	$phpPrinter->printString($phpPrinter->cutString(strtoupper(utf8_decode('CORTE '.$corte)),28),1,$printer,$acum,10,10);
	$phpPrinter->printString($phpPrinter->cutString(utf8_decode('Numero '.$corteInfo['correlativo']),28),1,$printer,$acum,10,10);
	
	$phpPrinter->tabPrinter($acum,10);
	
	$phpPrinter->printString(strtoupper(utf8_decode('fecha: ')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString(strtoupper(utf8_decode($corteInfo['fecha'])),2,$printer,$acum,10,0,80);
	
	$phpPrinter->tabPrinter($acum,10);
	
	$phpPrinter->printString(strtoupper(utf8_decode('TOTAL GRAVADO')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString($corteInfo['total_grabado_tk'],2,$printer,$acum,10,0,270);
	$phpPrinter->printString(strtoupper(utf8_decode('TOTAL EXENTO')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString($corteInfo['total_exento_tk'],2,$printer,$acum,10,0,270);
	$phpPrinter->printString(strtoupper(utf8_decode('TOTAL NO SUJETO')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString($corteInfo['total_nosujeto_tk'],2,$printer,$acum,10,0,270);
	$phpPrinter->printString(strtoupper(utf8_decode('TOTAL TICKETS')),2,$printer,$acum,10,10,0);
	$totaltickets = ($corteInfo['total_nosujeto_tk'] + $corteInfo['total_grabado_tk'] + $corteInfo['total_exento_tk']);
	$phpPrinter->printString($totaltickets,2,$printer,$acum,10,0,270);
	
	$phpPrinter->printString(strtoupper(utf8_decode('TOTAL GRAVADO')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString($corteInfo['total_grabado_ccf'],2,$printer,$acum,10,0,270);
	$phpPrinter->printString(strtoupper(utf8_decode('TOTAL EXENTO')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString($corteInfo['total_exento_ccf'],2,$printer,$acum,10,0,270);
	$phpPrinter->printString(strtoupper(utf8_decode('TOTAL NO SUJETO')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString($corteInfo['total_nosujeto_ccf'],2,$printer,$acum,10,0,270);
	$phpPrinter->printString(strtoupper(utf8_decode('TOTAL CCF')),2,$printer,$acum,10,10,0);
	$totalccf = ($corteInfo['total_nosujeto_ccf'] + $corteInfo['total_grabado_ccf'] + $corteInfo['total_exento_ccf']);
	$phpPrinter->printString($totalccf,2,$printer,$acum,10,0,270);
	
	$phpPrinter->printString(strtoupper(utf8_decode('TOTAL GRAVADO')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString($corteInfo['total_grabado_fac'],2,$printer,$acum,10,0,270);
	$phpPrinter->printString(strtoupper(utf8_decode('TOTAL EXENTO')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString($corteInfo['total_exento_fac'],2,$printer,$acum,10,0,270);
	$phpPrinter->printString(strtoupper(utf8_decode('TOTAL NO SUJETO')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString($corteInfo['total_nosujeto_fac'],2,$printer,$acum,10,0,270);
	$phpPrinter->printString(strtoupper(utf8_decode('TOTAL FACTURAS')),2,$printer,$acum,10,10,0);
	$totalfac = ($corteInfo['total_nosujeto_fac'] + $corteInfo['total_grabado_fac'] + $corteInfo['total_exento_fac']);
	$phpPrinter->printString($totalfac,2,$printer,$acum,10,0,270);
	
	$phpPrinter->printString(strtoupper(utf8_decode('DEVOLUCION TICKET')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString("(".$corteInfo['total_devolucion_ticket'].")",2,$printer,$acum,10,0,270);
	$phpPrinter->printString(strtoupper(utf8_decode('DEVOLUCION FACTURA')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString("(".$corteInfo['total_devolucion_factura'].")",2,$printer,$acum,10,0,270);
	$phpPrinter->printString(strtoupper(utf8_decode('DEVOLUCION CCF')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString("(".$corteInfo['total_devolucion_ccf'].")",2,$printer,$acum,10,0,270);
	$phpPrinter->printString(strtoupper(utf8_decode('TOTAL DEVOLUCIONES')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString("(".$corteInfo['total_devoluciones'].")",2,$printer,$acum,10,0,270);
	
	$phpPrinter->printString(strtoupper(utf8_decode('TOTAL VENTAS')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString(($totalccf+$totaltickets+$totalfac) - $corteInfo['total_devoluciones'],2,$printer,$acum,10,0,270);
	
	$phpPrinter->tabPrinter($acum,10);
	
	$phpPrinter->printString(strtoupper(utf8_decode('TRANS. REALIZADAS')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString($corteInfo['transacciones'],2,$printer,$acum,10,0,270);
	$phpPrinter->printString(strtoupper(utf8_decode('TICKETS EMITIDOS')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString($corteInfo['tickets'],2,$printer,$acum,10,0,270);
	$phpPrinter->printString(strtoupper(utf8_decode('CCF EMITIDOS')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString($corteInfo['ccfs'],2,$printer,$acum,10,0,270);
	$phpPrinter->printString(strtoupper(utf8_decode('FACTURAS EMITIDAS')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString($corteInfo['facs'],2,$printer,$acum,10,0,270);
	$phpPrinter->printString(strtoupper(utf8_decode('DEVOLUCIONES')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString($corteInfo['devs'],2,$printer,$acum,10,0,270);
	$phpPrinter->printString(strtoupper(utf8_decode('INICIO')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString($corteInfo['desde'],2,$printer,$acum,10,0,270);
	$phpPrinter->printString(strtoupper(utf8_decode('FINAL')),2,$printer,$acum,10,10,0);
	$phpPrinter->printString($corteInfo['hasta'],2,$printer,$acum,10,0,270);
	
	$phpPrinter->tabPrinter($acum,10);
	
	$phpPrinter->printString($phpPrinter->cutString(strtoupper(utf8_decode("*Operacion Finalizada*")),28),1,$printer,$acum,10,10);
	
	printer_delete_font($font);
	
	printer_end_page($printer);

	printer_end_doc($printer);

	printer_close($printer);
?>
