hjkhghopjkertteerterterterertertrtoirh
bnmbertsurhetertertertertertertertpdf'tdfg
/
home
/
distin10n
/
public_html
/
Upload FileeE
HOME
<?php require('fpdf.php'); include('connect.php'); //include ("num2words.php"); $gid = $_GET['id']; $pref = $_GET['pref']; $id = $pref.$gid; $docname = "Pedido #".$id.".pdf"; class PDF extends FPDF { protected $col = 0; // Current column protected $y0; // Ordinate of column start function Header() { // Page header global $title; include("connect.php"); $gid = $_GET['id']; $pref = $_GET['pref']; $id = $pref.$gid; $rPedido = mysqli_query($connection, "SELECT * FROM pedidos_head WHERE id = '$gid' AND idrand = '$pref'"); while ($dataHead = mysqli_fetch_array($rPedido)) { $phUsuario = $dataHead["usuario"]; $phTotal = $dataHead["total"]; $phDireccion = $dataHead["direccion"]; $phFecha = $dataHead["fecha_pedido"]; } $sqlshop1 = mysqli_query($connection, "SELECT * FROM usuarios WHERE username = '$phUsuario'"); while ($usdat = mysqli_fetch_array($sqlshop1)) { $tienda1 = $usdat["tienda"]; } $this->SetFont('Arial','B',14); if ($tienda1 == 'DIR') { $this->Cell(60,20,$this->Image('images/pdf_logo_dei.jpg', $this->GetX(), $this->GetY(),55,18,'JPG'),0,0,'C',0); //55 y 18 eran 60 y 20 } else if ($tienda1 == 'TITOS') { $this->Cell(60,20,$this->Image('images/pdf_logo_titos.jpg', $this->GetX(), $this->GetY(),55,18,'JPG'),0,0,'C',0); } else if ($tienda1 == 'CASABONITA') { $this->Cell(60,20,$this->Image('images/pdf_logo_casabonita.jpg', $this->GetX(), $this->GetY(),55,18,'JPG'),0,0,'C',0); } else { $this->Cell(60,20,$this->Image('images/pdf_logo_dei.jpg', $this->GetX(), $this->GetY(),55,18,'JPG'),0,0,'C',0); } //$this->Cell(60,20,$this->Image('images/item_default_s.jpg', $this->GetX(), $this->GetY()),1,0,'C',0); $this->Cell(5,20,"",0,0,'C',0); if ($tienda1 == 'DIR') { $this->Cell(60,20,$this->Image('images/pdf_logo_dir.jpg', $this->GetX(), $this->GetY(),55,18,'JPG'),0,0,'C',0); } else { $this->Cell(60,20,$this->Image('images/pdf_logo_empty.jpg', $this->GetX(), $this->GetY(),55,18,'JPG'),0,0,'C',0); } $this->Cell(5,20,"",0,0,'C',0); $this->Cell(60,10,"Pedido No.".$id,0,0,'R',0); $this->Ln(); $this->Cell(130,10,"",0,0,'C',0); $this->SetFont('Arial','B',12); $this->Cell(60,6,"Fecha Pedido: ".$phFecha,0,0,'R',0); $this->Ln(); $this->Cell(190,3,"",0,0,'L',0); $this->Ln(); $this->y0 = $this->GetY(); GLOBAL $phUsuario; } function Footer() { include ("connect.php"); $gidn2 = $_GET['id']; $prefn2 = $_GET['pref']; $idn2 = $prefn2.$gidn2; $rPedidon2 = mysqli_query($connection, "SELECT * FROM pedidos_head WHERE id = '$gidn2' AND idrand = '$prefn2'"); while ($dataHeadn2 = mysqli_fetch_array($rPedidon2)) { $phUsuarion2 = $dataHeadn2["usuario"]; } $sqlshop2 = mysqli_query($connection, "SELECT * FROM usuarios WHERE username = '$phUsuarion2'"); while ($usdatn2 = mysqli_fetch_array($sqlshop2)) { $tienda2 = $usdatn2["tienda"]; } // Page footer $this->SetY(-15); $this->SetFont('Arial','IB',10); $this->SetTextColor(128); if ($tienda2 == 'DIR') { $this->Cell(189,5,"www.distincionenregalos.com",0,0,'C'); } else if ($tienda2 == 'TITOS') { $this->Cell(189,5,"www.novedadestitos.com",0,0,'C'); } else if ($tienda2 == 'CASABONITA') { $this->Cell(189,5,"www.casa-bonita.com",0,0,'C'); } $this->SetFont('Arial','I',8); $this->Cell(1,5,utf8_decode('Página ').$this->PageNo().'/{nb}',0,0,'R'); } function SetCol($col) { // Set position at a given column $this->col = $col; $x = 10+$col*65; $this->SetLeftMargin($x); $this->SetX($x); } function AcceptPageBreak() { // Method accepting or not automatic page break if($this->col<2) { // Go to next column $this->SetCol($this->col+1); // Set ordinate to top $this->SetY($this->y0); // Keep on page return false; } else { // Go back to first column $this->SetCol(0); // Page break return true; } } function ChapterTitle() { // Title include ("connect.php"); $gid = $_GET['id']; $pref = $_GET['pref']; $id = $pref.$gid; $rPedido = mysqli_query($connection, "SELECT * FROM pedidos_head WHERE id = '$gid' AND idrand = '$pref'"); while ($dataHead = mysqli_fetch_array($rPedido)) { $phUsuario = $dataHead["usuario"]; $phTotal = $dataHead["total"]; $phDireccion = $dataHead["direccion"]; $phFecha = $dataHead["fecha_pedido"]; } if (!isset($totalpzs)) {$totalpzs = 0;} $qPzs = mysqli_query($connection, "SELECT * FROM pedidos_body WHERE head_rand = '$pref' AND usuario = '$phUsuario' "); while ($qp = mysqli_fetch_array($qPzs)) { $cantpzs = $qp["cantidad"]; $modelq = $qp["modelo"]; //$totalpzs = $totalpzs + $cantpzs; $qcant = mysqli_query($connection, "SELECT * FROM productos WHERE modelo = '$modelq'"); while ($qc = mysqli_fetch_array($qcant)) { $piezass = $qc["piezas"]; $piezass2 = $piezass*$cantpzs; $totalpzs = $totalpzs + $piezass2; } } $rUserData = mysqli_query($connection, "SELECT * FROM usuarios WHERE username = '$phUsuario'"); while ($usrDat = mysqli_fetch_array($rUserData)) { $udNombre = $usrDat["nombre"]; $udApellido = $usrDat["apellido"]; $udEmpresa = $usrDat["empresa"]; $udTel = $usrDat["telefono"]; $udCel = $usrDat["celular"]; $udMail = $usrDat["email"]; } $nombrecompleto = utf8_decode($udNombre." ".$udApellido); if (strlen($udEmpresa) > 0) { $empresa = $udEmpresa; } else { $empresa = "Nada"; } /*$cantLetra = num2letras($phTotal); $cents = substr("$phTotal",-2); $cantTotalLetra = strtoupper($cantLetra.' PESOS '.$cents.'/100 M.N.');*/ $intTotal = intval($phTotal); $cents = substr("$phTotal",-2); $formatterES = new NumberFormatter("es", NumberFormatter::SPELLOUT); $cantTotalLetra = strtoupper($formatterES->format($intTotal).' PESOS '.$cents.'/100 M.N.'); $qahorro = mysqli_query($connection, "SELECT * FROM pedidos_body WHERE head_rand = '$pref' AND usuario = '$phUsuario' ORDER BY id"); while ($aq = mysqli_fetch_array($qahorro)) { $prodCant = $aq["cantidad"]; $prodPrecio = $aq["precio"]; $prodPrecDesc = $aq["precio_descuento"]; if (!isset($ahorro)) { $ahorro = 0; } if ($prodPrecDesc > 0) { $cantidadDescuent = ($prodPrecio * $prodPrecDesc) / 100; $preciofinal = $prodPrecio - $cantidadDescuent; $importeitem = $preciofinal * $prodCant; //$ahorro = ($ahorro + $cantidadDescuent) * $prodCant; } else { $cantidadDescuent = 0; $importeitem = $prodPrecio * $prodCant; //$ahorro = 0; } $ahorro = $ahorro + ($cantidadDescuent * $prodCant); } //$ahorroTotal = number_format($phTotal - $ahorro,2); /////Inicia datos pedido///// $this->SetFont('Arial','B',14); $this->Cell(190,7,"DATOS DEL PEDIDO",0,0,'C',0); $this->Ln(); $this->SetFont('Arial','B',10); $this->Cell(17,4,"CLIENTE: ",0,0,'L',0); $this->SetFont('Arial','',10); $this->Cell(100,4,$nombrecompleto." (".$phUsuario.")",0,0,'L',0); $this->Cell(1,4,"",0,0,'L',0); $this->SetFont('Arial','B',10); $this->Cell(11,4,"MAIL: ",0,0,'L',0); $this->SetFont('Arial','',10); $this->Cell(62,4,$udMail,0,0,'L',0); /*$this->Cell(1,4,"",1,0,'L',0); $this->Cell(30,4,"",1,0,'L',0);*/ /*$this->SetFont('Arial','B',10); $this->Cell(9,4,"TEL: ",0,0,'L',0); $this->SetFont('Arial','',10); $this->Cell(21,4,$udCel,0,0,'L',0);*/ $this->Ln(); $this->SetFont('Arial','B',10); $this->Cell(22,4,"DOMICILIO: ",0,0,'L',0); $this->SetFont('Arial','',10); //$this->Cell(168,4,$phDireccion,0,0,'L',0); $this->Cell(138,4,utf8_decode($phDireccion),0,0,'L',0); // $this->SetFont('Arial','B',10); $this->Cell(9,4,"TEL: ",0,0,'L',0); $this->SetFont('Arial','',10); $this->Cell(21,4,$udCel,0,0,'L',0); $this->Ln(); $this->SetFont('Arial','B',10); $this->Cell(14,4,"TOTAL: ",0,0,'L',0); $this->SetFont('Arial','',10); $this->Cell(67,4,"$".number_format($phTotal,2),0,0,'L',0); $this->Cell(1,4,"",0,0,'L',0); $this->SetFont('Arial','B',10); $this->Cell(34,4,"TOTAL DE PIEZAS: ",0,0,'L',0); $this->SetFont('Arial','',10); $this->Cell(15,4,$totalpzs." PZ",0,0,'L',0); $this->Cell(1,4,"",0,0,'L',0); if ($ahorro > 0) { $this->SetFont('Arial','B',10); $this->SetTextColor(40,50,194); $this->Cell(18,4,"AHORRO: ",0,0,'L',0); $this->SetTextColor(0,0,0); $this->SetFont('Arial','',10); //////////////////// $totalsiniva = $phTotal / 1.16; $cantiva = $phTotal - $totalsiniva; $qH3 = mysqli_query($connection, "SELECT * FROM pedidos_body WHERE head_rand = '$pref' AND usuario = '$phUsuario' ORDER BY id"); while ($dataProd3 = mysqli_fetch_array($qH3)) { $prodModel2 = $dataProd3["modelo"]; $prodCant2 = $dataProd3["cantidad"]; $prodPrecio2 = $dataProd3["precio"]; $prodPrecDesc2 = $dataProd3["precio_descuento"]; if ($prodPrecDesc2 > 0) { $cantidadDescuent2 = ($prodPrecio2 * $prodPrecDesc2) / 100; $preciofinal2 = $prodPrecio2 - $cantidadDescuent2; $importe2 = $preciofinal2 * $prodCant2; } else { $importe2 = $prodPrecio2 * $prodCant2; } if (!isset($totalimp2)) { $totalimp2 = 0; } $totalimp2 = $totalimp2 + $importe2; } $qCupExist2 = mysqli_query($connection, "SELECT * FROM pedidos_head WHERE id = '$gid' AND idrand = '$pref'"); while ($qce2 = mysqli_fetch_array($qCupExist2)) { $qceCupon2 = $qce2["cupon"]; } $usCup2 = mysqli_query($connection, "SELECT * FROM cupones WHERE codigo_cupon = '$qceCupon2'"); while ($quc2 = mysqli_fetch_array($usCup2)) { $descPercent2 = $quc2["descuento"]; } $totalrestardesc = $totalimp2; if (isset($qceCupon2) && isset($descPercent2)) { $cantdesccupon2 = ($totalrestardesc * $descPercent2) / 100; } //////////////////// //$this->Cell(40,4,"$".number_format($ahorro,2),0,0,'L',0); if (!isset($cantdesccupon2)) { $cantdesccupon2 = 0; } if ($cantdesccupon2 > 0) { $ahorrototal = $ahorro + $cantdesccupon2; //$this->Cell(40,4,"$".number_format($ahorrototal,2)."($".number_format($ahorro,2)." + $".number_format($cantdesccupon2,2).")",0,0,'L',0); $this->Cell(40,4,"$".number_format($ahorrototal,2),0,0,'L',0); } else { $this->Cell(40,4,"$".number_format($ahorro,2),0,0,'L',0); } } else { $this->SetFont('Arial','B',10); $this->Cell(18,4,"",0,0,'L',0); $this->SetFont('Arial','',10); $this->Cell(40,4,"",0,0,'L',0); } $this->Ln(); $this->SetFont('Arial','B',10); $this->Cell(43,4,"CANTIDAD CON LETRA: ",0,0,'L',0); $this->SetFont('Arial','',10); $this->Cell(147,4,utf8_decode($cantTotalLetra),0,0,'L',0); $this->Ln(); $this->Cell(190,1,"",0,0,'L',0); $this->Ln(); /////Termina datos pedido///// // Save ordinate $this->y0 = $this->GetY(); } function ChapterBody() { include("connect.php"); $gid = $_GET['id']; $pref = $_GET['pref']; $id = $pref.$gid; $qPedido = mysqli_query($connection, "SELECT * FROM pedidos_head WHERE id = '$gid' AND idrand = '$pref'"); while ($dh = mysqli_fetch_array($qPedido)) { $piUsuario = $dh["usuario"]; } $qbProduct = mysqli_query($connection, "SELECT * FROM pedidos_body WHERE head_rand = '$pref' AND usuario = '$piUsuario' ORDER BY id"); while ($dataProd = mysqli_fetch_array($qbProduct)) { $prodModel = $dataProd["modelo"]; $prodCant = $dataProd["cantidad"]; $prodPrecio = $dataProd["precio"]; $prodPrecDesc = $dataProd["precio_descuento"]; $prodCol = $dataProd["color"]; if (strlen($prodCol) > 0) { $col = " *c"; } else { $col = ""; } if (file_exists("articulos/".$prodModel."_s.jpg")) { $miniatura = "articulos/".$prodModel."_s.jpg"; } else { $miniatura = "images/item_default_s.jpg"; } //$contador += 1; //Imagen articulo $this->Cell(1,58,"",0,0,'C',0); $this->SetDrawColor(225,225,225); $this->Cell(58,58,$this->Image($miniatura, $this->GetX(), $this->GetY(), 58, 58, 'JPG'),1,0,'C',0); $this->Cell(1,58,"",0,0,'C',0); $this->Ln(); //Descripcion e info articulo $this->SetFont('Arial','B',10); $this->Cell(60,4,$prodModel." (x".$prodCant.$col.")",0,0,'C',0); $this->Ln(); $qProd = mysqli_query($connection, "SELECT * FROM productos WHERE modelo = '$prodModel' ORDER BY id"); while ($dProd = mysqli_fetch_array($qProd)) { $piDescripcion = utf8_decode($dProd["descripcion"]); $piUM = $dProd["unidad_medida"]; $piPZ = $dProd["piezas"]; $this->SetFont('Arial','',8); //$this->Cell(60,3,utf8_decode(mb_strimwidth($piDescripcion,0,44)),0,1,'C',0); $this->Cell(60,2,substr($piDescripcion,0,44),0,1,'C',0); $precioUnitario = $prodPrecio / $piPZ; $this->Cell(60,3,$piPZ." ".$piUM." / $ Unit: ".number_format($precioUnitario,2)." / $ Set: ".number_format($prodPrecio,2)."",0,1,'C',0); if ($prodPrecDesc > 0) { $this->SetFont('Arial','B',8); $desc = ($prodPrecio * $prodPrecDesc) / 100; $precioDescuento = $prodPrecio - $desc; $precioUnitDesc = $precioDescuento / $piPZ; $precioDescuento2 = round($precioDescuento,1,PHP_ROUND_HALF_UP); $precioUnitDesc2 = round($precioUnitDesc,1,PHP_ROUND_HALF_UP); $this->SetTextColor(244,67,54); /*if ($prodPrecDesc <= 20) { $textOferta = "P. MAYORISTA "; } else if ($prodPrecDesc > 20) { $textOferta = "OFERTA! "; }*/ IF ($prodPrecDesc >= 20) { $textOferta="OFERTA! "; } else { $textOferta=""; } $this->Cell(60,2,$textOferta." $ Unit: ".number_format($precioUnitDesc,2)." / $ Set: ".number_format($precioDescuento2,2),0,1,'C',0); $this->SetTextColor(0,0,0); $importe = $precioDescuento * $prodCant; $importee = round($importe,1,PHP_ROUND_HALF_UP); } else { $this->Cell(60,2,"",0,1,'C',0); $importe = $prodPrecio*$prodCant; } $this->SetFont('Arial','B',8); $this->Cell(60,3,"IMPORTE: $".number_format($importe,2),0,1,'C',0); $this->Cell(60,2,"",0,0,'C',0); $this->Ln(); } } /*$this->Ln(20); $this->SetFont('Arial','',10); for ($i=0; $i < 190; $i++) { $this->Cell(1,3,"-",0,0,'C',0); } $this->Ln(); $this->SetFont('Arial','B',12); $this->Cell(190,5,"www.distincionenregalos.com",0,1,'R',0); $this->SetFont('Arial','',10); $this->Cell(190,4,utf8_decode("Te invitamos a conocer nuestra Sala de Exhibición"),0,1,'R',0); $this->Cell(190,4,"ubicada en Riva Palacio No.40, Col. La Bandera,",0,1,'R',0); $this->Cell(190,4,utf8_decode("Guadalajara, Jalisco, México. C.P. 44450"),0,1,'R',0); $this->Ln(); $this->Cell(190,4,"Whatsapp: 33 2078 7803",0,1,'R',0); $this->Cell(190,4,"Tel(s). 01 (33) 3345 0315 | 1378 8585",0,1,'R',0); $this->Cell(190,4,"1378 8555 | 3654 0874",0,1,'R',0); $this->Cell(190,4,"ventas@distincionenregalos.com",0,1,'R',0); $this->Cell(190,4,utf8_decode("Facebook: Distinción Internacional en Regalos"),0,1,'R',0);*/ //$this->Cell(190,4,"Instagram: @DIR",1,1,'R',0); //LISTADO DE PRODUCTOS DEL PEDIDO $this->SetCol(0); $this->AddPage(); $this->ChapterTitle(); $this->Ln(4); $this->SetFont('Arial','B',10); $this->Cell(10,5,"CANT.",0,0,'C',0); $this->Cell(25,5,"MODELO",0,0,'C',0); $this->Cell(3,5,"",0,0,'C',0); $this->Cell(85,5,"DESCRIPCION",0,0,'C',0); $this->Cell(22,5,"COSTO SET",0,0,'C',0); $this->Cell(25,5,"OFERTA SET",0,0,'C',0); $this->Cell(20,5,"IMPORTE",0,0,'C',0); $this->Ln(); if (!isset($contadorItems)) { $contadorItems = 0; } $qH2 = mysqli_query($connection, "SELECT * FROM pedidos_body WHERE head_rand = '$pref' AND usuario = '$piUsuario' ORDER BY id"); while ($dataProd2 = mysqli_fetch_array($qH2)) { $prodModel = $dataProd2["modelo"]; $prodCant = $dataProd2["cantidad"]; $prodPrecio = $dataProd2["precio"]; $prodPrecDesc = $dataProd2["precio_descuento"]; $prodColor = $dataProd2["color"]; $contadorItems = $contadorItems + 1; $prodq = mysqli_query($connection, "SELECT * FROM productos WHERE modelo = '$prodModel' ORDER BY id"); while ($dp = mysqli_fetch_array($prodq)) { //$piDescripcion2 = utf8_decode($dp["descripcion"]); $piDescripcion2 = utf8_decode($dp["descripcion"]); } $this->SetFont('Arial','',9); $this->Cell(10,5,$prodCant,0,0,'C',0); $this->Cell(25,5,$prodModel,0,0,'R',0); $this->Cell(3,5,"",0,0,'C',0); //$this->Cell(85,5,mb_strimwidth($piDescripcion2,0,58),0,0,'L',0); $this->Cell(85,5,substr($piDescripcion2,0,54),0,0,'L',0); $this->Cell(22,5,"$".number_format($prodPrecio,2),0,0,'R',0); if ($prodPrecDesc > 0) { $cantidadDescuent = ($prodPrecio * $prodPrecDesc) / 100; $preciofinal = $prodPrecio - $cantidadDescuent; $preciofinal2 = round($preciofinal,1,PHP_ROUND_HALF_UP); $this->Cell(25,5,"$".number_format($preciofinal2,2),0,0,'R',0); $importe = $preciofinal * $prodCant; } else { $this->Cell(25,5,"-",0,0,'R',0); //$importe = number_format($prodPrecio * $prodCant,2); $importe = $prodPrecio * $prodCant; } $importee2 = round($importe,1,PHP_ROUND_HALF_UP); $this->Cell(20,5,"$".number_format($importee2,2),0,0,'R',0); $this->Ln(); if (strlen($prodColor) > 0) { $this->Cell(10,2.5,"",0,0,'C',0); $this->Cell(25,2.5,"",0,0,'C',0); $this->Cell(3,2.5,"",0,0,'C',0); $this->SetFont('Arial','BI',10); $this->Cell(12,2.5,"[Color: ",0,0,'L',0); $this->SetFont('Arial','I',10); $this->Cell(73,2.5,$prodColor."]",0,0,'L',0); $this->Cell(22,2.5,"",0,0,'C',0); $this->Cell(25,2.5,"",0,0,'C',0); $this->Cell(20,2.5,"",0,1,'C',0); $this->SetFont('Arial','B',10); } if ($contadorItems >= 40) { $this->SetCol(0); $this->AddPage(); $this->Cell(190,5,"",0,1,'L',0); $this->Cell(190,5,"",0,1,'L',0); //$this->Cell(190,5,"",0,1,'L',0); //$this->Cell(190,5,"",0,1,'L',0); $this->Ln(4); $contadorItems = 0; } if (!isset($totalimp)) { $totalimp = 0; } $totalimp = $totalimp + $importee2; if (!isset($totalpzs)) { $totalpzs = 0; } $totalpzs = $totalpzs + $prodCant; } $this->Cell(190,2,"",0,0,'R',0); $this->Ln(); $this->SetFont('Arial','B',10); $this->Cell(170,5,"SUBTOTAL",0,0,'R',0); $this->SetFont('Arial','',9); $this->Cell(20,5,"$".number_format(round($totalimp,1,PHP_ROUND_HALF_UP),2),0,0,'R',0); $this->Ln(); $qCupExist = mysqli_query($connection, "SELECT * FROM pedidos_head WHERE id = '$gid' AND idrand = '$pref'"); while ($qce = mysqli_fetch_array($qCupExist)) { $qceCupon = $qce["cupon"]; $notas = $qce["notas"]; } $usCup = mysqli_query($connection, "SELECT * FROM cupones WHERE codigo_cupon = '$qceCupon'"); while ($quc = mysqli_fetch_array($usCup)) { $descPercent = $quc["descuento"]; } if (isset($qceCupon) && isset($descPercent)) { $cantdesccupon = ($totalimp * $descPercent) / 100; $this->SetFont('Arial','B',10); $this->Cell(170,5,"CUPONES Y DESCUENTOS",0,0,'R',0); $this->SetFont('Arial','',9); $this->Cell(20,5,"-$".number_format($cantdesccupon,2),0,0,'R',0); $this->Ln(); $this->SetFont('Arial','',8); $this->Cell(170,3,$qceCupon." (-".$descPercent."%)",0,0,'R',0); $this->Cell(20,3,"",0,0,'R',0); $this->Ln(); $subtotalccupon = $totalimp - $cantdesccupon; $this->SetFont('Arial','B',10); $this->Cell(170,5,"NUEVO SUBTOTAL",0,0,'R',0); $this->SetFont('Arial','',9); $this->Cell(20,5,"$".number_format($subtotalccupon,2),0,0,'R',0); $this->Ln(); } /*$rPedido2 = mysqli_query($connection, "SELECT * FROM pedidos_head WHERE id = '$gid' AND idrand = '$pref'"); while ($dataHead2 = mysqli_fetch_array($rPedido2)) { $phTotal2 = $dataHead2["total"]; } $iva2 = $totalimp * .16; $subtotalcupon = $phTotal2 - $iva2; $cupondesccant = $phTotal2 - $subtotalcupon; if ($cupondesccant > 0) { $this->SetFont('Arial','B',10); $this->Cell(170,5,"CUPONES Y DESCUENTOS",0,0,'R',0); $this->SetFont('Arial','',9); $this->Cell(20,5,"-$".$cupondesc,0,0,'R',0); $this->Ln(); $this->SetFont('Arial','B',10); $this->Cell(170,5,"NUEVO SUBTOTAL",0,0,'R',0); $this->SetFont('Arial','',9); $this->Cell(20,5,"$".$subtotalcupon,0,0,'R',0); $this->Ln(); }*/ /*$cuponesdescuentos = ($phTotal2 - $totalimp); if ($cuponesdescuentos > 0) { $this->SetFont('Arial','B',10); $this->Cell(170,5,"CUPONES Y DESCUENTOS",0,0,'R',0); $this->SetFont('Arial','',9); $this->Cell(20,5,"-$".$cuponesdescuentos,0,0,'R',0); $this->Ln(); }*/ $this->SetFont('Arial','B',10); $this->Cell(170,5,"IVA",0,0,'R',0); $this->SetFont('Arial','',9); if (isset($subtotalccupon) > 0) { $iva = $subtotalccupon * .16; } else { $iva = $totalimp * .16; } $this->Cell(20,5,"$".number_format($iva,2),0,0,'R',0); $this->Ln(); $this->SetFont('Arial','B',10); $this->Cell(170,5,"TOTAL",0,0,'R',0); $this->SetFont('Arial','',9); if (isset($subtotalccupon) > 0) { $totalconiva = $subtotalccupon + $iva; } else { $totalconiva = $totalimp + $iva; } $this->Cell(20,5,"$".number_format($totalconiva,2),0,0,'R',0); $this->Ln(); // $queryEnvio = mysqli_query($connection, "SELECT * FROM pedidos_head WHERE id = '$gid' AND idrand = '$pref'"); while ($qenv = mysqli_fetch_array($queryEnvio)) { $pedidoPaqueteria = $qenv["acepta_envio"]; } if (strlen($pedidoPaqueteria) > 0 && $pedidoPaqueteria == 'Paquetexpress') { $qprecioenv = mysqli_query($connection, "SELECT * FROM info_envios WHERE activo = '1' "); while ($qpenv = mysqli_fetch_array($qprecioenv)) { $precioActual = $qpenv["precio_actual"]; $costoExtra = $qpenv["costo_extra"]; } $this->SetFont('Arial','B',10); $this->Cell(170,5,utf8_decode("ENVÍO"),0,0,'R',0); $this->SetFont('Arial','',9); $this->Cell(20,5,"$".number_format($precioActual,2),0,0,'R',0); $this->Ln(); $this->SetFont('Arial','B',10); $this->Cell(170,5,utf8_decode("TOTAL CON ENVÍO"),0,0,'R',0); $this->SetFont('Arial','',9); $this->Cell(20,5,"$".number_format($totalconiva+$precioActual,2),0,0,'R',0); $this->Ln(); } // if (strlen($notas) > 1) { $this->Ln(); $this->SetFont('Arial','BI',11); $this->Cell(190,5,"NOTAS: ",0,1,'L',0); $this->SetFont('Arial','I',11); $this->MultiCell(190,5,utf8_decode($notas),0,'L',0); } if ($contadorItems >= 30) { $this->SetCol(0); $this->AddPage(); //$contadorItems = 0; } $this->Ln(5); $this->SetFont('Arial','',10); for ($i=0; $i < 190; $i++) { $this->Cell(1,3,"_",0,0,'C',0); } $this->Ln(); include ("connect.php"); $gidn3 = $_GET['id']; $prefn3 = $_GET['pref']; $idn3 = $prefn3.$gidn3; $rPedidon3 = mysqli_query($connection, "SELECT * FROM pedidos_head WHERE id = '$gidn3' AND idrand = '$prefn3'"); while ($dataHeadn3 = mysqli_fetch_array($rPedidon3)) { $phUsuarion3 = $dataHeadn3["usuario"]; } $sqlshop3 = mysqli_query($connection, "SELECT * FROM usuarios WHERE username = '$phUsuarion3'"); while ($usdatn3 = mysqli_fetch_array($sqlshop3)) { $tienda3 = $usdatn3["tienda"]; } if ($tienda3 == 'DIR') { $url = "www.distincionenregalos.com"; $dir1 = "ubicada en Riva Palacio No.40, Col. La Bandera,"; $dir2 = "Guadalajara, Jalisco, México. C.P. 44450"; $whatsapp = "Whatsapp: 33 2078 7803"; $tel = "Tel(s). 01 (33) 3345 0315 | 1378 8585"; $tel2 = "1378 8555 | 3654 0874"; $mail = "ventas@distincionenregalos.com"; $fb = "Facebook: Distinción Internacional en Regalos"; $ig = "Instagram: @decoracionesexclusivas"; } else if ($tienda3 == 'TITOS') { $url = "www.novedadestitos.com"; $dir1 = "ubicada en C. Álvaro Obregón 539-A, Col. San Juan de Dios,"; $dir2 = "Guadalajara, Jalisco, México. C.P. 44360"; $whatsapp = "Whatsapp: 33 2078 6422"; $tel = "Tel(s). 01 (33) 3617 1196"; $tel2 = " "; $mail = "ventas@distincionenregalos.com"; $fb = "Facebook: Novedades tito's"; $ig = "Instagram: -"; } else if ($tienda3 == 'CASABONITA') { $url = "www.casa-bonita.com"; $dir1 = "ubicada en C. Álvaro Obregón 24, Col. San Juan de Dios,"; $dir2 = "Guadalajara, Jalisco, México. C.P. 44360"; $whatsapp = "Whatsapp: 33 2078 2528"; $tel = "Tel(s). 01 (33) 3586 5470"; $tel2 = " "; $mail = "ventas@distincionenregalos.com"; $fb = "Facebook: Casa Bonita"; $ig = "Instagram: -"; } else { $url = "www.distincionenregalos.com"; $dir1 = "ubicada en Riva Palacio No.40, Col. La Bandera,"; $dir2 = "Guadalajara, Jalisco, México. C.P. 44450"; $whatsapp = "Whatsapp: 33 2078 7803"; $tel = "Tel(s). 01 (33) 3345 0315 | 1378 8585"; $tel2 = "1378 8555 | 3654 0874"; $mail = "ventas@distincionenregalos.com"; $fb = "Facebook: Distinción Internacional en Regalos"; $ig = "Instagram: @decoracionesexclusivas"; } $this->SetFont('Arial','B',12); $this->Cell(190,5,$url,0,1,'R',0); $this->SetFont('Arial','',10); $this->Cell(190,4,utf8_decode("Te invitamos a conocer nuestra Sala de Exhibición"),0,1,'R',0); $this->Cell(190,4,utf8_decode($dir1),0,1,'R',0); $this->Cell(190,4,utf8_decode($dir2),0,1,'R',0); $this->Ln(); $this->Cell(190,4,$whatsapp,0,1,'R',0); $this->Cell(190,4,$tel,0,1,'R',0); $this->Cell(190,4,$tel2,0,1,'R',0); $this->Cell(190,4,$mail,0,1,'R',0); $this->Cell(190,4,utf8_decode($fb),0,1,'R',0); $this->Cell(190,4,$ig,0,1,'R',0); //Terminar cuerpo del documento $this->SetCol(0); // Go back to first column } function PrintChapter() { // Add chapter $this->AddPage(); $this->ChapterTitle(); $this->ChapterBody(); } } $pdf = new PDF(); $pdf->AliasNbPages(); $tid = $_GET['id']; $tpref = $_GET['pref']; $title = 'PEDIDO NO.'.$tpref.$tid; $pdf->SetTitle($title); $pdf->SetAuthor('Decoraciones Exclusivas de Importacion'); $pdf->PrintChapter(1); $pdf->Output($docname, 'I'); ?>