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('
',$foliosP); //HTML - PDF $html .= '

CEDIS
COMERCIALIZADORA NOVOMODA, S.A. DE C.V.

'.$infE['direccion'].'


ORDEN COMPRA FECHA EXP. CONDICIONES FECHA VECTO. FACT/REM. FECHA REG. HORA REG.
'.$info['noPedido'].' '.$fechaP.' 90 Dias '.$fechaV.' '.$foliosProv.' '.$fechaP.' '.$horaP1.'
NO. PROV. T. MONEDA. CONC. INV. CONC. CXP.
'.$info['proveedorId'].' MONEDA NACIONAL ENT X COMPR COMPRAS --- --- ---
'; //DATOS DEL PROVEEDOR $html .= '
DATOS DEL PROVEEDOR
Razón Social '.$infPv['nombre'].' Calle '.$infPv['calle'].'
RFC '.$infPv['rfc'].' Colonia '.$infPv['colonia'].'
Teléfonos '.$infPv['phone'].' Delegación o Municipio '.$infPv['municipio'].'
C.P. '.$infS['codigoPostal'].' Estado '.$infS['estado'].'
'; //PRODUCTOS $html .= '
PRODUCTOS

'; $html .= ' '; $cantTotal = 0; $totalGlobal = 0; $descGlobal = 0; foreach($products as $res){ $impBruto = $res['total']; $totalDesc = $impBruto * ($porcDesc/100); $descGlobal += $totalDesc; $impNeto = $impBruto - $totalDesc; $html .= ' '; $cantTotal += $res['cantidad']; $impBrutoG += $impBruto; $impNetoG += $impNeto; }//foreach $html .= ' '; $html .= '
CODIGO BARRA DESCRIPCION T.U. CANTIDAD PRECIO DESCUENTOS IMP. BRUTO IMP. NETO
'.$res['codigoBarra'].' '.$res['modelo'].' Pza. '.number_format($res['cantidad'],0).' $'.number_format($res['costo'],2).' '.$porcDesc.'% $'.number_format($impBruto,2).' $'.number_format($impNeto,2).'
TOTALES '.number_format($cantTotal,0).' $'.number_format($impBrutoG,2).' $'.number_format($impNetoG,2).'
'; //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 .= '
TOTALES
  '; if($porcDesc > 0) $html .= 'DESCUENTO
'; if($info['metodoCompra'] == 'conIva') $html .= 'SUBTOTAL
IVA '.$ivaPorc.'%
'; $html .= 'TOTAL'; $html .= '
'; if($porcDesc > 0) $html .= '$'.number_format($descGlobal,2).'
'; if($info['metodoCompra'] == 'conIva') $html .= '$'.$info['subtotal'].'
$'.$info['iva'].'
'; $html .= '$'.$info['total'].'
'; $dompdf = new DOMPDF(); $dompdf->set_paper('letter'); $dompdf->load_html($html); $dompdf->render(); $dompdf->stream('acuse_recibo.pdf', array('Attachment'=>0)); exit; ?>