<?php
namespace Noahtech\Sistemas\InterjamaBundle\Handler;
use Noahtech\Sistemas\InterjamaBundle\Entity\McMovimiento;
use Noahtech\Sistemas\InterjamaBundle\Utils\Constants;
use Noahtech\Sistemas\InterjamaBundle\Utils\EmailsMessages;
use Noahtech\Sistemas\InterjamaBundle\Utils\Encrypt;
use DateInterval;
use DateTime;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpFoundation\Request;
use Noahtech\Sistemas\InterjamaBundle\Utils\PDF;
use Symfony\Component\HttpFoundation\Response;
use Exception;
use Afip;
date_default_timezone_set('America/Argentina/Buenos_Aires');
class McMovimientoHandler extends BaseHandler {
public function __construct(ContainerInterface $container, EntityManagerInterface $entityManager) {
$this->container = $container;
$this->entityManager = $entityManager;
$this->repository = $entityManager->getRepository(McMovimiento::class);
}
public function search($offset, $limit, $sortField, $sortDirection, $searchParam) {
$lp = $this->repository->search($offset, $limit, $sortField, $sortDirection, $searchParam);
$movimientos = $this->toarray($lp->getListado(), 'movimiento');
$lp->setListado($movimientos);
return $lp;
}
public function updateFacturado(McMovimiento $movimiento) {
$movimiento->setFacturado(true);
return $this->update($movimiento, $movimiento->getId());
}
public function saveFromAtencionPrecarga($monedaId, $cajaId, $tipoPago, $total, $usuario, $precarga = null) {
$caja = $this->container->get("Noahtech\Sistemas\InterjamaBundle\Handler\McCajaHandler")->getCajaById((int)$cajaId);
$moneda = $this->container->get("Noahtech\Sistemas\InterjamaBundle\Handler\McMonedaHandler")->getMonedaById((int)$monedaId);
$tipo = 'Ingreso';
$tipoDetalle = 'Atención trámite';
$modalidad = $tipoPago;
$monto = (float)$total;
$detalle = 'Movimiento generado por la atención de una precarga.';
if (!is_null($precarga->getId())) {
$movimiento = $this->repository->findOneByPrecarga($precarga->getId());
if (!is_null($movimiento)) {
$movimiento->setFechaActualizacion(new DateTime());
//Hay que restar de monto final de la caja lo que se ingreso
$deleteOperacionCaja = $this->container->get("Noahtech\Sistemas\InterjamaBundle\Handler\McCajaHandler")->saveOperacionCaja($movimiento->getCaja(), 'Egreso', $movimiento->getMonto(), $movimiento->getModalidad(), $movimiento->getMoneda()->getId());
} else {
$movimiento = new McMovimiento();
$movimiento->setFechaCreacion(new DateTime());
}
} else {
$movimiento = new McMovimiento();
$movimiento->setFechaCreacion(new DateTime());
}
$movimiento->setCaja($caja);
$movimiento->setUsuario($usuario);
$movimiento->setTipo($tipo);
$movimiento->setTipoDetalle($tipoDetalle);
$movimiento->setMonto($monto);
$movimiento->setMoneda($moneda);
$movimiento->setModalidad($modalidad);
$movimiento->setDetalle($detalle);
$movimiento->setPrecarga($precarga);
$movimiento = $this->save($movimiento);
$operacionCaja = $this->container->get("Noahtech\Sistemas\InterjamaBundle\Handler\McCajaHandler")->saveOperacionCaja($caja, $tipo, $monto, $modalidad, (int)$monedaId);
return $movimiento;
}
public function getMovimientoFromRequest(Request $request, $usuario, $cajaId, int $id = null) {
$tipo = $request->request->get('tipo');
$tipoDetalle = $request->request->get('tipo_detalle');
$monto = (float)$request->request->get('monto');
$monedaId = $request->request->get('moneda');
$modalidad = $request->request->get('modalidad');
$detalle = $request->request->get('detalle');
$devolucion = $request->request->get('devolucion');
$caja = $this->container->get("Noahtech\Sistemas\InterjamaBundle\Handler\McCajaHandler")->getCajaById((int)$cajaId);
$moneda = $this->container->get("Noahtech\Sistemas\InterjamaBundle\Handler\McMonedaHandler")->getMonedaById((int)$monedaId);
$monedaNacional = $this->container->get("Noahtech\Sistemas\InterjamaBundle\Handler\McMonedaHandler")->getMonedaById(1);
$choferId = $request->request->get('chofer');
$empresaId = $request->request->get('empresa');
$cotizacion = $request->request->get('cotizacion');
$montoDevolucion = (!is_null($request->request->get('monto_devolucion'))) ? (float)$request->request->get('monto_devolucion') : null;
if (!is_null($choferId)) {
$chofer = $this->container->get("Noahtech\Sistemas\InterjamaBundle\Handler\McChoferHandler")->getChoferById((int)$choferId);
} else {
$chofer = null;
}
if (!is_null($empresaId)) {
$cliente = $this->container->get("Noahtech\Sistemas\InterjamaBundle\Handler\McClienteHandler")->getClienteById((int)$empresaId);
} else {
$cliente = null;
}
if (is_null($id)) {
if ($tipo != 'Cambio de divisas') {
//Valido que si es un egreso de dinero no sea superior al monto final de la caja
$movimiento = new McMovimiento();
$movimiento->setFechaCreacion(new DateTime());
$operacionCaja = $this->container->get("Noahtech\Sistemas\InterjamaBundle\Handler\McCajaHandler")->saveOperacionCaja($caja, $tipo, $monto, $modalidad, (int)$monedaId);
$movimiento->setCaja($caja);
$movimiento->setCliente($cliente);
$movimiento->setChofer($chofer);
$movimiento->setUsuario($usuario);
$movimiento->setTipo($tipo);
$movimiento->setTipoDetalle($tipoDetalle);
$movimiento->setMonto($monto);
$movimiento->setMoneda($moneda);
$movimiento->setModalidad($modalidad);
$movimiento->setDetalle($detalle);
$movimiento->setDevolucion($devolucion);
$movimiento->setMontoDevolucion($montoDevolucion);
$movimiento = $this->save($movimiento);
if (!is_null($request->request->get('movimiento_devolver'))) {
$movimientoEgreso = $this->repository->findOneById((int)$request->request->get('movimiento_devolver'));
$movimientoEgreso->setMontoDevolucion($montoDevolucion);
$this->save($movimientoEgreso);
}
return $movimiento;
} else {
//Validar el si el egreso es viable
$operacionCaja = $this->container->get("Noahtech\Sistemas\InterjamaBundle\Handler\McCajaHandler")->saveOperacionDivisasCaja($caja, $tipo, $tipoDetalle, $monto, $modalidad, (int)$monedaId, $cotizacion);
if ($tipoDetalle == 'Compra') {
//Ingreso
$movimientoIngreso = new McMovimiento();
$movimientoIngreso->setFechaCreacion(new DateTime());
$movimientoIngreso->setTipo('Ingreso');
$movimientoIngreso->setCaja($caja);
$movimientoIngreso->setCliente($cliente);
$movimientoIngreso->setChofer($chofer);
$movimientoIngreso->setUsuario($usuario);
$movimientoIngreso->setTipoDetalle($tipoDetalle);
$movimientoIngreso->setMonto($monto);
$movimientoIngreso->setMoneda($moneda);
$movimientoIngreso->setModalidad($modalidad);
$movimientoIngreso->setDetalle($detalle);
$movimientoIngreso->setDevolucion($devolucion);
$movimientoIngreso = $this->save($movimientoIngreso);
//Egreso
$movimientoEgreso = new McMovimiento();
$movimientoEgreso->setFechaCreacion(new DateTime());
$movimientoEgreso->setTipo('Egreso');
$movimientoEgreso->setCaja($caja);
$movimientoEgreso->setCliente($cliente);
$movimientoEgreso->setChofer($chofer);
$movimientoEgreso->setUsuario($usuario);
$movimientoEgreso->setTipoDetalle($tipoDetalle);
$movimientoEgreso->setMonto((float)$cotizacion);
$movimientoEgreso->setMoneda($monedaNacional);
$movimientoEgreso->setModalidad($modalidad);
$movimientoEgreso->setDetalle($detalle);
$movimientoEgreso->setDevolucion($devolucion);
$movimientoEgreso = $this->save($movimientoEgreso);
return $movimientoEgreso;
} else {
//Ingreso
$movimientoIngreso = new McMovimiento();
$movimientoIngreso->setFechaCreacion(new DateTime());
$movimientoIngreso->setTipo('Ingreso');
$movimientoIngreso->setCaja($caja);
$movimientoIngreso->setCliente($cliente);
$movimientoIngreso->setChofer($chofer);
$movimientoIngreso->setUsuario($usuario);
$movimientoIngreso->setTipoDetalle($tipoDetalle);
$movimientoIngreso->setMonto((float)$cotizacion);
$movimientoIngreso->setMoneda($monedaNacional);
$movimientoIngreso->setModalidad($modalidad);
$movimientoIngreso->setDetalle($detalle);
$movimientoIngreso->setDevolucion($devolucion);
$movimientoIngreso = $this->save($movimientoIngreso);
//Egreso
$movimientoEgreso = new McMovimiento();
$movimientoEgreso->setFechaCreacion(new DateTime());
$movimientoEgreso->setTipo('Egreso');
$movimientoEgreso->setCaja($caja);
$movimientoEgreso->setCliente($cliente);
$movimientoEgreso->setChofer($chofer);
$movimientoEgreso->setUsuario($usuario);
$movimientoEgreso->setTipoDetalle($tipoDetalle);
$movimientoEgreso->setMonto($monto);
$movimientoEgreso->setMoneda($moneda);
$movimientoEgreso->setModalidad($modalidad);
$movimientoEgreso->setDetalle($detalle);
$movimientoEgreso->setDevolucion($devolucion);
$movimientoEgreso = $this->save($movimientoEgreso);
return $movimientoEgreso;
}
}
}
}
public function save(McMovimiento $movimiento) {
$movimiento = $this->repository->save($movimiento);
$movimiento = $this->toarray($movimiento, "movimiento");
return $movimiento;
}
public function update(McMovimiento $movimiento, $id) {
$movimiento = $this->repository->update($movimiento);
$movimiento = $this->toarray($movimiento, "movimiento");
return $movimiento;
}
public function getById($id) {
$movimiento = $this->repository->findOneById($id);
$movimiento = $this->toarray($movimiento, "movimiento");
return $movimiento;
}
public function getMovimientoById($id) {
return $this->repository->findOneById($id);
}
public function numeroAddZero($nro) {
$numero = "";
$nro1 = strlen((string)$nro);
switch($nro1) {
case 1:
$numero = "000000" . $nro;
break;
case 2:
$numero = "00000" . $nro;
break;
case 3:
$numero = "0000" . $nro;
break;
case 4:
$numero = "000" . $nro;
break;
case 5:
$numero = "00" . $nro;
break;
case 6:
$numero = "0" . $nro;
break;
case 7:
$numero = $nro;
break;
}
return $numero;
}
public function descargaReciboMovimientoPdf($id) {
$movimiento = $this->getById($id);
$numero = $this->numeroAddZero($movimiento['id']);
$fecha = date("d/m/Y H:m", strtotime($movimiento['fecha_creacion']));
$empresa = (isset($movimiento['cliente']['id'])) ? $movimiento['cliente']['razon_social'] : null;
$chofer = (isset($movimiento['chofer']['id'])) ? $movimiento['chofer']['nombre'] .' '. $movimiento['chofer']['apellido'] : null;
$devolucion = ($movimiento['devolucion']) ? 'Si' : 'No';
$montoDevolucion = (is_null($movimiento['monto_devolucion'])) ? 0 : $movimiento['monto_devolucion'];
// create new PDF document
$pdf = new PDF();
$pdf->SetTitle("Comprobante Movimiento");
$pdf->SetSubject("Comprobante Movimiento");
$pdf->setFontSubsetting(true);
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
$pdf->SetFont('helvetica', '', 11, '', true);
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->setPrintFooter(false);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->AddPage('P', 'A4');
$html = <<<EOD
<h1> Comprobante - Movimiento</h1>
<table table border="0.5">
<tr>
<th style="background-color: grey;"> Código</th>
<td><b> {$numero}</b></td>
</tr>
<tr>
<th style="background-color: grey;"> Tipo</th>
<td><b> {$movimiento['caja']['tipo']}</b></td>
</tr>
<tr>
<th style="background-color: grey;"> Fecha</th>
<td><b> {$fecha}</b></td>
</tr>
</table>
<br/>
<br/>
<br/>
<table border="0.5">
<tr>
<th style="background-color: grey;"> Tipo</th>
<td><b> {$movimiento['tipo']}</b></td>
</tr>
<tr>
<th style="background-color: grey;"> Tipo detalle</th>
<td><b> {$movimiento['tipo_detalle']}</b></td>
</tr>
<tr>
<th style="background-color: grey;"> Moneda</th>
<td><b> {$movimiento['moneda']['nombre']}</b></td>
</tr>
<tr>
<th style="background-color: grey;"> Monto</th>
<td><b> {$movimiento['monto']}</b></td>
</tr>
<tr>
<th style="background-color: grey;"> Modalidad de pago</th>
<td><b> {$movimiento['modalidad']}</b></td>
</tr>
<tr>
<th style="background-color: grey;"> Detalle del movimiento</th>
<td><b> {$movimiento['detalle']}</b></td>
</tr>
<tr>
<th style="background-color: grey;"> Empresa</th>
<td><b> {$empresa}</b></td>
</tr>
<tr>
<th style="background-color: grey;"> Chofer</th>
<td><b> {$chofer}</b></td>
</tr>
<tr>
<th style="background-color: grey;"> Con devolución</th>
<td><b> {$devolucion}</b></td>
</tr>
<tr>
<th style="background-color: grey;"> Monto devolución</th>
<td><b> {$montoDevolucion}</b></td>
</tr>
</table>
EOD;
$pdf->writeHTML($html, true, false, false, false, '');
return new Response($pdf->Output("Comprobante", "S"), 200, array(
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'attachment; filename="Movimiento-Comprobante.pdf"'
)
);
}
public function descargaReciboPdf($id) {
$movimiento = $this->getById((int)$id);
$fechaHoy = date('d-m-Y');
$anio = substr($movimiento['fecha_creacion'], 0, 4);
$fechaHoy = date('d-m-Y');
// create new PDF document
$pdf = new PDF();
$pdf->SetTitle("Recibo Movimiento");
$pdf->SetSubject("Recibo Movimiento");
$pdf->setFontSubsetting(true);
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
$pdf->SetFont('helvetica', '', 9, '', true);
$pdf->SetMargins(5, 5, 5);
$pdf->SetHeaderMargin(0);
$pdf->SetFooterMargin(0);
$pdf->setPrintFooter(false);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->AddPage('P', 'A4');
$html = <<<EOD
<div style="border: 0.5px solid black; text-align: center;">ORIGINAL</div>
<div style="border: 0.5px solid black; float:left; clear:none;">
<div style="text-align: center;">RECIBO</div><br>
<strong style="text-align: left;">INTERJAMA S.R.L</strong><br>
<strong style="text-align: left;">Razón Social: </strong>INTERJAMA S.R.L<br>
<strong style="text-align: left;">Domicilio comercial: </strong>Alvear 495 Piso:2 Dpto:C - San Salvador de Jujuy - Jujuy<br>
<strong style="text-align: left;">Condición frente al IVA: IVA Responsable Inscripto</strong><br>
<strong style="text-align: right;">Fecha de Emisión: {$fechaHoy}</strong><br>
<strong style="text-align: left;">CUIT: </strong>30714865044<br>
<strong style="text-align: left;">Ingresos Brutos: </strong>A-1-55049<br>
<strong style="text-align: left;">Fecha de Inicio de Actividad: </strong>01/07/2015
</div>
<div style="width: 100%; border: 0.5px solid black; margin-top: 1px;">
<strong style="margin-left: 10px;">Preriodo Facturado Desde:</strong> {$fechaHoy} <strong style="margin-left: 90px;">Hasta:</strong> {$fechaHoy} <strong style="margin-left: 200px;">Fecha de Vto. para el pago:</strong> {$fechaHoy}
</div>
<div style="width: 100%; border: 0.5px solid black; margin-top: 1px;">
<strong style="text-align: left;">CUIT:</strong> {$movimiento['cliente']['cuit']}<br>
<strong style="text-align: left;">Appelidoy Nombre / Razón Social</strong> {$movimiento['cliente']['razon_social']}<br>
<strong style="text-align: left;">Condición frente al IVA:</strong> {$movimiento['cliente']['condicion_iva']}<br>
<strong style="text-align: left;">Condición de venta:</strong> {$movimiento['modalidad']}
</div>
<br/>
<table border="0.5">
<tr style="background-color: grey;">
<th> Cantidad</th>
<th> Movimiento</th>
<th> Detalle</th>
<th> Moneda</th>
<th> Importe</th>
<th> Subtotal</th>
</tr>
<tr>
<td> 1,00</td>
<td> Ingreso/Devolución</td>
<td> {$movimiento['tipo_detalle']}</td>
<td> {$movimiento['moneda']['nombre']}</td>
<td> {$movimiento['monto_devolucion']}</td>
<td> {$movimiento['monto_devolucion']}</td>
</tr>
</table>
<br/>
<br/>
<table border="0.5">
<tr>
<th><strong>Subtotal: $</strong> <span style="margin-left: 60px;">{$movimiento['monto_devolucion']}</span></th>
<th><strong>Importe Total: $</strong> <span style="margin-left: 60px;">{$movimiento['monto_devolucion']}</span></th>
</tr>
</table>
EOD;
$pdf->writeHTML($html, true, false, false, false, '');
return new Response($pdf->Output("Recibo", "S"), 200, array(
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'attachment; filename="Movimiento-Recibo.pdf"'
)
);
}
public function descargaFacturaAfipPdf($id, $factura) {
$movimiento = $this->getById($id);
if (is_null($movimiento['facturado']) || !$movimiento['facturado']) {
$movimientoObj = $this->getMovimientoById((int)$id);
$fechaHoy = date('d/m/Y');
$tipoFactura = "A";
$afip = new Afip(array(
'CUIT' => 27332574049,
'cert' => 'tramite/cert',
'key' => 'tramite/key'
));
if ($factura == 'A') {
try {
$last_voucher = $afip->ElectronicBilling->GetLastVoucher(1,1);
} catch (Exception $e) {
return "Servicio de AFIP momentaneamente no disponible.";
}
} elseif ($factura == 'B') {
try {
$last_voucher = $afip->ElectronicBilling->GetLastVoucher(1,6);
} catch (Exception $e) {
return "Servicio de AFIP momentaneamente no disponible.";
}
}
$valfac = $last_voucher + 1;
$nroComprobante = $this->numeroAddZero($valfac);
$ptoVta = "0001";
$neto = round($tramite['importe'] / 1.21, 2);
$iva = round($neto * 0.21, 2);
//Se arma factura A
$data = array(
'CantReg' => 1, // Cantidad de comprobantes a registrar
'PtoVta' => 1, // Punto de venta
'Concepto' => 1, // Concepto del Comprobante: (1)Productos, (2)Servicios, (3)Productos y Servicios
'DocTipo' => 80, // Tipo de documento del comprador (99 consumidor final, ver tipos disponibles)
'DocNro' => $movimiento['cliente']['cuit'], // Número de documento del comprador (0 consumidor final)
'CbteDesde' => $valfac, // Número de comprobante o numero del primer comprobante en caso de ser mas de uno
'CbteHasta' => $valfac, // Número de comprobante o numero del último comprobante en caso de ser mas de uno
'CbteFch' => intval(date('Ymd')), // (Opcional) Fecha del comprobante (yyyymmdd) o fecha actual si es nulo
'ImpTotal' => $movimiento['monto'], // Importe total del comprobante
'ImpTotConc' => 0, // Importe neto no gravado
'ImpNeto' => $neto, // Importe neto gravado
'ImpOpEx' => 0, // Importe exento de IVA
'ImpIVA' => $iva, //Importe total de IVA
'ImpTrib' => 0, //Importe total de tributos
'MonId' => 'PES', //Tipo de moneda usada en el comprobante (ver tipos disponibles)('PES' para pesos argentinos)
'MonCotiz' => 1, // Cotización de la moneda usada (1 para pesos argentinos)
'Iva' => array( // (Opcional) Alícuotas asociadas al comprobante
array(
'Id' => 5, // Id del tipo de IVA (5 para 21%)(ver tipos disponibles)
'BaseImp' => $neto, // Base imponible
'Importe' => $iva // Importe
)
),
);
if ($factura == 'A') {
$data['CbteTipo'] = 1;
$codigo = 'Código 01';
} elseif ($factura == 'B') {
$data['CbteTipo'] = 6;
$tipoFactura = "B";
$codigo = 'Código 06';
} else {
//Se arma factura E de exportación
}
try {
$res = $afip->ElectronicBilling->CreateVoucher($data);
$this->container->get("Noahtech\Sistemas\InterjamaBundle\Handler\McFacturaHandler")->saveFacturaMovimiento($movimientoObj, $tipoFactura, $res, $nroComprobante);
$this->updateFacturado($movimientoObj);
} catch (Exception $e) {
return $e->getMessage();
}
$res['CAE']; //CAE asignado el comprobante
$res['CAEFchVto']; //Fecha de vencimiento del CAE (yyyy-mm-dd)
// Fin de sección de factura de AFIP
//Creacion del PDF
// create new PDF document
$pdf = new PDF();
$pdf->SetTitle("Movimiento");
$pdf->SetSubject("Movimiento");
$pdf->setFontSubsetting(true);
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
$pdf->SetFont('helvetica', '', 9, '', true);
$pdf->SetMargins(5, 5, 5);
$pdf->SetHeaderMargin(0);
$pdf->SetFooterMargin(0);
$pdf->SetPrintFooter(false);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->AddPage('P', 'A4');
// Datos de la empresa emisora de la factura
$html = <<<EOD
<table style="width: 100%; border-top: 1px solid black;border-left: 1px solid black;border-right: 1px solid black;">
<tr>
<th style="text-align: left">
<span></span><br>
<img src="app/images/interjama-logo.jpeg" alt="Interjama" width="300" height="100" />
</th>
<th style="text-align: center">
<span style="font-size: 30px; font-weight: bold;">{$tipoFactura}</span><br>
<span style="font-size: 10px;">{$codigo}</span>
</th>
<th style="text-align: center">
<span></span><br>
<span style="font-size: 12px; font-weight: bold;">Factura</span><br>
<span style="font-size: 12px; font-weight: bold;">Nº {$nroComprobante}</span><br>
<span style="font-size: 12px; font-weight: bold;">{$fechaHoy}</span>
</th>
</tr>
</table>
<table style="width: 100%; border-bottom: 1px solid black;border-left: 1px solid black;border-right: 1px solid black;">
<tr>
<th style="text-align: left; border-right: 1px solid black">
<strong style="text-align: left;">Razón Social: </strong>INTERJAMA S.R.L.<br>
<strong style="text-align: left;">Punto de venta: {$ptoVta} Comp. Nro: {$nroComprobante}</strong><br>
<strong style="text-align: left;">Domicilio comercial: </strong>Alvear 495 Piso:2 Dpto:C - San Salvador de Jujuy - Jujuy<br>
<strong style="text-align: left;">Sitio web: </strong>www.interjama.com<br>
</th>
<th style="text-align: left">
<strong style="text-align: left;">Condición frente al IVA: IVA Responsable Inscripto</strong><br>
<strong style="text-align: left;">CUIT: </strong>30714865044<br>
<strong style="text-align: left;">Ingresos Brutos: </strong>A-1-55049<br>
<strong style="text-align: left;">Fecha de Inicio de Actividad: </strong>01/07/2015
</th>
</tr>
</table>
<br/>
<div style="width: 100%; border: 0.5px solid black; margin-top: 2px;">
<strong style="margin-left: 10px;">Preriodo Facturado Desde:</strong> {$fechaHoy} <strong style="margin-left: 90px;">Hasta:</strong> {$fechaHoy} <strong style="margin-left: 200px;">Fecha de Vto. para el pago:</strong> {$fechaHoy}
</div>
<div style="width: 100%; border: 0.5px solid black; margin-top: 2px;">
<strong style="text-align: left;">CUIT:</strong> {$movimiento['cliente']['cuit']}<br>
<strong style="text-align: left;">Appelidoy Nombre / Razón Social</strong> {$movimiento['cliente']['razon_social']}<br>
<strong style="text-align: left;">Condición frente al IVA:</strong> {$movimiento['cliente']['condicion_iva']}<br>
<strong style="text-align: left;">Condición de venta:</strong> Contado
</div>
<div style="width: 100%; border: 0.5px solid black; margin-top: 2px;">
<strong style="margin-left: 10px;">Referencia Comercial:</strong> CONTROL DE PESAJE
</div>
<br/>
<table border="0.5">
<tr style="background-color: grey;">
<th>Cantidad</th>
<th>Producto / Servicio</th>
<th>U. Medida</th>
<th>Precio Uni.</th>
<th>% Bonif.</th>
<th>Imp. Bonif.</th>
<th>Subtotal</th>
</tr>
<tr>
<td> 1,00</td>
<td> Imngreso-devolución</td>
<td> Otras unidades</td>
<td> {$movimiento['monto_devolucion']}</td>
<td> 0,00</td>
<td> 0,00</td>
<td> {$movimiento['monto_devolucion']}</td>
</tr>
</table>
<br/>
<br/>
<table border="0.5">
<tr>
<th>
<strong>Subtotal: $</strong> <span style="margin-left: 60px;">{$movimiento['monto_devolucion']}</span>
</th>
<th>
<strong>Importe Otros Tributos: $</strong> <span style="margin-left: 84px;">0,00</span>
</th>
<th>
<strong>Importe Total: $</strong> <span style="margin-left: 60px;">{$movimiento['monto_devolucion']}</span>
</th>
</tr>
</table>
<div style="width: 100%; border: 0.5px solid black; margin-top: 2px;">
<span style="margin-left: 10px; font-style: italic;">"SERVICIOS ALTERNATIVOS EN COMERCIO EXTERIOR - SEGURIDAD PRIVADA - OBRAS DE INGENIERIA CIVIL-"</span>
</div>
<div style="float:right; margin-top: 2px; text-align: right;">
<strong>CAE Nº:</strong> {$res['CAE']}<br>
<strong>Fecha Vto. de CAE:</strong> {$res['CAEFchVto']}
</div>
<br/>
<table style="width: 100%;">
<tr>
<th>
<img src="app/images/qr.png" alt="Código QR" width="50" height="50"/>
</th>
<th>
<img src="app/images/afip-logo.png" alt="Código QR" width="50" height="15"/><br>
<span><b>Comprobante Autorizado</b></span>
</th>
<th>
</th>
<th>
</th>
</tr>
</table>
EOD;
$pdf->writeHTML($html, true, false, false, false, '');
return new Response($pdf->Output("Tramite-Factura", "S"), 200, array(
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'attachment; filename="Movimiento-Recibo.pdf"'
)
);
} else {
throw new HttpException(409, "El movimiento ya se encuentra facturado.");
}
}
public function getAllMovimientosByCaja($cajaId) {
$movimientos = $this->repository->getAllMovimientosByCaja($cajaId);
return $this->toarray($movimientos, 'movimiento');
}
}