Primer commit del sistema avantika sin cambios
This commit is contained in:
403
modules/pedidos-acuse.php
Executable file
403
modules/pedidos-acuse.php
Executable file
@@ -0,0 +1,403 @@
|
||||
<?php
|
||||
|
||||
$empresa->AuthUser();
|
||||
|
||||
include_once(DOC_ROOT.'/pdf/dompdf_config.inc.php');
|
||||
|
||||
$pedidoId = $_GET['pedidoId'];
|
||||
|
||||
$pedido->setPedidoId($pedidoId);
|
||||
$info = $pedido->Info();
|
||||
|
||||
$rfc->setRfcId(1);
|
||||
$infE = $util->EncodeRow($rfc->Info());
|
||||
|
||||
$direccion = $infE['calle'];
|
||||
|
||||
if($infE['noExt'] != '')
|
||||
$direccion .= ' No. Ext. '.$infE['noExt'];
|
||||
if($infE['noInt'] != '')
|
||||
$direccion .= ', No. Int. '.$infE['noInt'];
|
||||
if($infE['colonia'] != '')
|
||||
$direccion .= ', Col. '.$infE['colonia'];
|
||||
// if($infE['localidad'] != '')
|
||||
// $direccion .= ', '.$infE['localidad'];
|
||||
// if($infE['ciudad'] != '')
|
||||
// $direccion .= ', '.$infE['ciudad'];
|
||||
if($infE['municipio'] != '')
|
||||
$direccion .= ', '.$infE['municipio'];
|
||||
if($infE['estado'] != '')
|
||||
$direccion .= ', '.$infE['estado'];
|
||||
if($infE['codigoPostal'] != '')
|
||||
$direccion .= 'C.P. '.$infE['codigoPostal'];
|
||||
|
||||
$infE['direccion'] = $direccion;
|
||||
|
||||
$proveedor->setProveedorId($info['proveedorId']);
|
||||
$infPv = $util->EncodeRow($proveedor->Info());
|
||||
|
||||
$fecha = date('d-m-Y',strtotime($info['fecha']));
|
||||
$fecha = $util->FormatDateDMMMY($fecha);
|
||||
$info['fecha'] = $fecha;
|
||||
|
||||
$fechaEntrega = date('d-m-Y',strtotime($info['fechaEntrega']));
|
||||
$info['fechaEntrega'] = $util->FormatDateDMMMY($fechaEntrega);
|
||||
|
||||
/*
|
||||
if($info['metodoCompra'] == 'conIva')
|
||||
$info['metodoCompra'] = 'IVA Incluido';
|
||||
else
|
||||
$info['metodoCompra'] = 'IVA No Incluido';
|
||||
*/
|
||||
//Productos
|
||||
|
||||
$resProducts = $pedido->GetProductos();
|
||||
|
||||
$sugerencias = 0;
|
||||
$subtotalP = 0;
|
||||
$products = array();
|
||||
foreach($resProducts as $card){
|
||||
|
||||
$prodCatId = $card['prodCatId'];
|
||||
$prodSubcatId = $card['prodSubcatId'];
|
||||
$productoId = $card['productoId'];
|
||||
|
||||
$card['productoId'] = $productoId;
|
||||
$card['prodCatId'] = $prodCatId;
|
||||
$card['prodSubcatId'] = $prodSubcatId;
|
||||
|
||||
$prodCat->setProdCatId($prodCatId);
|
||||
$card['departamento'] = $prodCat->GetNameById();
|
||||
|
||||
$prodSubcat->setProdSubcatId($prodSubcatId);
|
||||
$card['linea'] = $prodSubcat->GetNameById();
|
||||
|
||||
$producto->setProductoId($productoId);
|
||||
$infP = $producto->Info();
|
||||
$card['modelo'] = $infP['modelo'];
|
||||
$card['imagen'] = $infP['imagen'];
|
||||
$card['codigoBarra'] = $infP['codigoBarra'];
|
||||
|
||||
$card['atributos'] = $producto->GetAtributosAll();
|
||||
|
||||
if($card['prendasComp'] == 1)
|
||||
$card['cantidad'] = $card['totalLote'] * $card['cantLotes'];
|
||||
else
|
||||
$card['cantidad'] = $card['prendasRec'];
|
||||
|
||||
$totalP = $card['costo'] * $card['cantidad'];
|
||||
$card['total'] = number_format($totalP,2,'.','');
|
||||
|
||||
$subtotalP += $totalP;
|
||||
|
||||
$card['subtotales'] = $subtotales;
|
||||
|
||||
$products[] = $card;
|
||||
|
||||
}//foreach
|
||||
|
||||
if($info['fechaFolio'] == "0000-00-00")
|
||||
{
|
||||
$fechaP = "---";
|
||||
}
|
||||
else
|
||||
{
|
||||
$fechaP = date('d-m-Y',strtotime($info['fechaFolio']));
|
||||
}
|
||||
|
||||
if($info['fechaOrdenCompIng'] == "0000-00-00")
|
||||
{
|
||||
$fechaP1 = "---";
|
||||
}
|
||||
else
|
||||
{
|
||||
$fechaP1 = date('d-m-Y',strtotime($info['fechaOrdenCompIng']));
|
||||
}
|
||||
|
||||
if($info['fechaOrdenCompIng'] == "0000-00-00")
|
||||
{
|
||||
$horaP1 = "---";
|
||||
}
|
||||
else
|
||||
{
|
||||
$horaP1 = date('H:i:s',strtotime($info['fechaOrdenCompIng']));
|
||||
}
|
||||
|
||||
if($fechaP1 == "---")
|
||||
{
|
||||
$fechaV = "---";
|
||||
}
|
||||
else
|
||||
{
|
||||
$fechaV = date('d-m-Y',strtotime($fechaP1.' + 90 days'));
|
||||
}
|
||||
|
||||
$porcDesc = $info['porcPub'] + $info['porcFlete'] + $info['porcDes'] + $info['porcEsp'];
|
||||
|
||||
$foliosP = array();
|
||||
if($info['folioProv'])
|
||||
$foliosP[] = $info['folioProv'];
|
||||
if($info['folioProv2'])
|
||||
$foliosP[] = $info['folioProv2'];
|
||||
if($info['folioProv3'])
|
||||
$foliosP[] = $info['folioProv3'];
|
||||
if($info['folioProv4'])
|
||||
$foliosP[] = $info['folioProv4'];
|
||||
if($info['folioProv5'])
|
||||
$foliosP[] = $info['folioProv5'];
|
||||
|
||||
$foliosProv = implode('<br>',$foliosP);
|
||||
|
||||
//HTML - PDF
|
||||
|
||||
$html .= '
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body{
|
||||
font-family:Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size:10px;
|
||||
}
|
||||
.titulo {
|
||||
color: #FFFFFF;
|
||||
font-family: Verdana, Arial, Helvetica, sans-serif;
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table width="550" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td width="430">
|
||||
<p><b>CEDIS <br>
|
||||
COMERCIALIZADORA NOVOMODA, S.A. DE C.V.</b><br />
|
||||
'.$infE['direccion'].'
|
||||
</td>
|
||||
<td>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<table width="550" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<table width="550" border="1" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td width="" align="center"><b>ORDEN COMPRA</b></td>
|
||||
<td width="15%" align="center"><b>FECHA EXP.</b></td>
|
||||
<td width="15%" align="center"><b>CONDICIONES</b></td>
|
||||
<td width="15%" align="center"><b>FECHA VECTO.</b></td>
|
||||
<td width="15%" align="center"><b>FACT/REM.</b></td>
|
||||
<td width="15%" align="center"><b>FECHA REG.</b></td>
|
||||
<td width="15%" align="center"><b>HORA REG.</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="15" align="center">'.$info['noPedido'].'</td>
|
||||
<td align="center">'.$fechaP.'</td>
|
||||
<td align="center">90 Dias</td>
|
||||
<td align="center">'.$fechaV.'</td>
|
||||
<td align="center">'.$foliosProv.'</td>
|
||||
<td align="center">'.$fechaP.'</td>
|
||||
<td align="center">'.$horaP1.'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><b>NO. PROV.</b></td>
|
||||
<td align="center"><b>T. MONEDA.</b></td>
|
||||
<td align="center"><b>CONC. INV.</b></td>
|
||||
<td align="center"><b>CONC. CXP.</b></td>
|
||||
<td align="center"><b></b></td>
|
||||
<td align="center"><b></b></td>
|
||||
<td align="center"><b></b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="15" align="center">'.$info['proveedorId'].'</td>
|
||||
<td align="center">MONEDA NACIONAL</td>
|
||||
<td align="center">ENT X COMPR</td>
|
||||
<td align="center">COMPRAS</td>
|
||||
<td align="center"> --- </td>
|
||||
<td align="center"> --- </td>
|
||||
<td align="center"> --- </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
//DATOS DEL PROVEEDOR
|
||||
|
||||
$html .= '
|
||||
<table width="550" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td colspan="4" align="center" bgcolor="#809829"><span class="titulo">DATOS DEL PROVEEDOR</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="23%"><b>Razón Social</b></td>
|
||||
<td width="26%">'.$infPv['nombre'].'</td>
|
||||
<td width="27%"><b>Calle</b></td>
|
||||
<td width="">'.$infPv['calle'].'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>RFC</b></td>
|
||||
<td>'.$infPv['rfc'].'</td>
|
||||
<td><b>Colonia</b></td>
|
||||
<td>'.$infPv['colonia'].'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Teléfonos</b></td>
|
||||
<td>'.$infPv['phone'].'</td>
|
||||
<td><b>Delegación o Municipio</b></td>
|
||||
<td>'.$infPv['municipio'].'</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>C.P.</b></td>
|
||||
<td>'.$infS['codigoPostal'].'</td>
|
||||
<td><b>Estado</b></td>
|
||||
<td>'.$infS['estado'].'</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
//PRODUCTOS
|
||||
|
||||
$html .= '
|
||||
<br>
|
||||
<table width="550" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td colspan="5" align="center" bgcolor="#809829"><span class="titulo">PRODUCTOS</span></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>';
|
||||
|
||||
$html .= '
|
||||
<table width="550" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td width="13%" align="center" bgcolor="#CCCCCC">CODIGO BARRA</td>
|
||||
<td width="" align="center" bgcolor="#CCCCCC">DESCRIPCION</td>
|
||||
<td width="10%" align="center" bgcolor="#CCCCCC">T.U.</td>
|
||||
<td width="10%" align="center" bgcolor="#CCCCCC">CANTIDAD</td>
|
||||
<td width="10%" align="center" bgcolor="#CCCCCC">PRECIO</td>
|
||||
<td width="10%" align="center" bgcolor="#CCCCCC">DESCUENTOS</td>
|
||||
<td width="10%" align="center" bgcolor="#CCCCCC">IMP. BRUTO</td>
|
||||
<td width="10%" align="center" bgcolor="#CCCCCC">IMP. NETO</td>
|
||||
</tr>';
|
||||
|
||||
$cantTotal = 0;
|
||||
$totalGlobal = 0;
|
||||
$descGlobal = 0;
|
||||
foreach($products as $res){
|
||||
|
||||
$impBruto = $res['total'];
|
||||
|
||||
$totalDesc = $impBruto * ($porcDesc/100);
|
||||
$descGlobal += $totalDesc;
|
||||
|
||||
$impNeto = $impBruto - $totalDesc;
|
||||
|
||||
$html .= '
|
||||
<tr>
|
||||
<td align="center">'.$res['codigoBarra'].'</td>
|
||||
<td align="left">'.$res['modelo'].'</td>
|
||||
<td align="center">Pza.</td>
|
||||
<td align="center">'.number_format($res['cantidad'],0).'</td>
|
||||
<td align="center">$'.number_format($res['costo'],2).'</td>
|
||||
<td align="center">'.$porcDesc.'%</td>
|
||||
<td align="center">$'.number_format($impBruto,2).'</td>
|
||||
<td align="right">$'.number_format($impNeto,2).'</td>
|
||||
</tr>';
|
||||
|
||||
$cantTotal += $res['cantidad'];
|
||||
$impBrutoG += $impBruto;
|
||||
$impNetoG += $impNeto;
|
||||
|
||||
}//foreach
|
||||
|
||||
$html .= '
|
||||
<tr>
|
||||
<td align="center"></td>
|
||||
<td align="center"></td>
|
||||
<td align="center">TOTALES</td>
|
||||
<td align="center">'.number_format($cantTotal,0).'</td>
|
||||
<td align="center"></td>
|
||||
<td align="center"></td>
|
||||
<td align="center">$'.number_format($impBrutoG,2).'</td>
|
||||
<td align="right">$'.number_format($impNetoG,2).'</td>
|
||||
</tr>
|
||||
';
|
||||
|
||||
$html .= '</table>';
|
||||
|
||||
//TOTALES
|
||||
|
||||
if($info['subtotal2'] > 0){
|
||||
$info['subtotal'] = $info['subtotal2'];
|
||||
$info['iva'] = $info['iva2'];
|
||||
$info['total'] = $info['total2'];
|
||||
}
|
||||
|
||||
$ivaPorc = 16;
|
||||
|
||||
if($porcDesc > 0){
|
||||
$info['subtotal'] = $impNetoG;
|
||||
$info['iva'] = $impNetoG * ($ivaPorc/100);
|
||||
$info['total'] = $info['subtotal'] + $info['iva'];
|
||||
}
|
||||
|
||||
if($info['metodoCompra'] == 'sinIva')
|
||||
$info['total'] = $impNetoG;
|
||||
|
||||
$info['subtotal'] = number_format($info['subtotal'],2);
|
||||
$info['iva'] = number_format($info['iva'],2);
|
||||
$info['total'] = number_format($info['total'],2);
|
||||
|
||||
$html .= '
|
||||
<br>
|
||||
<table width="550" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td colspan="5" align="center" bgcolor="#809829"><span class="titulo">TOTALES</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="20%"></td>
|
||||
<td width=""></td>
|
||||
<td width="16%"> </td>
|
||||
<td width="16%" valign="top">';
|
||||
|
||||
if($porcDesc > 0)
|
||||
$html .= '<b>DESCUENTO</b> <br>';
|
||||
|
||||
if($info['metodoCompra'] == 'conIva')
|
||||
$html .= '<b>SUBTOTAL</b> <br>
|
||||
<b>IVA '.$ivaPorc.'%</b> <br>';
|
||||
|
||||
$html .= '<b>TOTAL</b>';
|
||||
|
||||
|
||||
$html .= '
|
||||
</td>
|
||||
<td width="16%" align="right" valign="top">';
|
||||
|
||||
if($porcDesc > 0)
|
||||
$html .= '$'.number_format($descGlobal,2).'<br>';
|
||||
|
||||
if($info['metodoCompra'] == 'conIva')
|
||||
$html .= '$'.$info['subtotal'].'<br>
|
||||
$'.$info['iva'].'<br>';
|
||||
|
||||
$html .= '$'.$info['total'].'
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
';
|
||||
|
||||
$dompdf = new DOMPDF();
|
||||
$dompdf->set_paper('letter');
|
||||
$dompdf->load_html($html);
|
||||
$dompdf->render();
|
||||
|
||||
$dompdf->stream('acuse_recibo.pdf', array('Attachment'=>0));
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user