Esempio n. 1
0
    }
}
$pdf = new PDF('P', 'mm', array(76, 300));
date_default_timezone_set('America/Guayaquil');
$fecha = date('Y-m-d H:i:s', time());
$pdf->AddPage();
$pdf->SetMargins(0, 0, 0, 0);
$pdf->Ln(0);
$pdf->SetFont('Arial', '', 10);
$sql = pg_query("select id_factura_venta,num_factura,nombre_empresa,telefono_empresa,direccion_empresa,email_empresa,pagina_web,ruc_empresa,nombres_cli,identificacion,direccion_cli,telefono,ciudad,fecha_actual,forma_pago,fecha_cancelacion,nombre_usuario,apellido_usuario,direccion_cli from factura_venta,clientes,empresa,usuario where factura_venta.id_cliente=clientes.id_cliente and empresa.id_empresa=factura_venta.id_empresa and factura_venta.id_usuario=usuario.id_usuario and factura_venta.id_factura_venta='{$_GET['id']}'");
$numfilas = pg_num_rows($sql);
for ($i = 0; $i < $numfilas; $i++) {
    $fila = pg_fetch_row($sql);
    $pdf->SetFont('Arial', '', 10);
    $pdf->SetX(0);
    $pdf->Text(2, 3, utf8_decode('' . "RUC:"), 0, 'C', 0);
    ////CLIENTE (X,Y)
    $pdf->Text(20, 3, utf8_decode('' . strtoupper($fila[9])), 0, 'C', 0);
    ////CLIENTE (X,Y)
    $pdf->Text(2, 8, utf8_decode('' . "CLIENTE:"), 0, 'C', 0);
    ////CLIENTE (X,Y)
    $pdf->Text(20, 8, utf8_decode('' . strtoupper($fila[8])), 0, 'C', 0);
    ////CLIENTE (X,Y)
    $pdf->Text(2, 13, utf8_decode('' . "DIR.:"), 0, 'C', 0);
    ////CLIENTE (X,Y)
    $pdf->Text(20, 13, utf8_decode('' . strtoupper($fila[18])), 0, 'C', 0);
    ////CLIENTE (X,Y)
    $pdf->Text(2, 18, utf8_decode('' . "FECHA.:"), 0, 'C', 0);
    ////CLIENTE (X,Y)
    $pdf->Text(20, 18, utf8_decode('' . strtoupper($fila[13])), 0, 'C', 0);
    ////CLIENTE (X,Y)
Esempio n. 2
0
    $cliente = $row[10];
    $ci_ruc = $row[9];
    $direccion = $row[11];
    $telefono = $row[12];
    $fecha = $row[2];
    $nro_fac = substr($row[1], 8);
    $iva0 = $row[3];
    $iva12 = $row[4];
    $iva_venta = $row[5];
    $descuento_venta = $row[6];
    $total_venta = $row[7];
    $estado = $row[13];
}
/////////header
$pdf->SetFont('Arial', 'B', 10);
$pdf->Text(113, 21, maxCaracter(utf8_decode($nro_fac), 20), 1, 0, 'L', 0);
$pdf->Text(265, 21, maxCaracter(utf8_decode($nro_fac), 20), 1, 0, 'L', 0);
/////////medio
$pdf->SetFont('Amble-Regular', '', 9);
$pdf->Text(30, 48, maxCaracter(utf8_decode($cliente), 80), 1, 0, 'L', 0);
/////cliente
$pdf->Text(30, 55, maxCaracter(utf8_decode($direccion), 35), 1, 0, 'L', 0);
////direccion
$pdf->Text(113, 55, maxCaracter(utf8_decode($telefono), 20), 1, 0, 'L', 0);
////telefono
$pdf->Text(30, 62, maxCaracter(utf8_decode($ci_ruc), 20), 1, 0, 'L', 0);
////ruc ci
$pdf->Text(113, 62, maxCaracter(utf8_decode($fecha), 20), 1, 0, 'L', 0);
/////fecha
$pdf->Text(180, 48, maxCaracter(utf8_decode($cliente), 80), 1, 0, 'L', 0);
/////cliente
    $direccion = $row[11];
    $telefono = $row[12];
    $fecha = $row[2];
    $nro_fac = substr($row[1], 8);
    $iva0 = $row[3];
    $iva12 = $row[4];
    $iva_venta = $row[5];
    $descuento_venta = $row[6];
    $total_venta = $row[7];
    $estado = $row[13];
}
/////////header
$pdf->SetFont('Arial', 'B', 10);
/////////medio
$pdf->SetFont('Amble-Regular', '', 10);
$pdf->Text(30, 42, maxCaracter(utf8_decode($cliente), 80), 1, 0, 'L', 0);
/////cliente
$pdf->Text(30, 48, maxCaracter(utf8_decode($fecha), 20), 1, 0, 'L', 0);
/////fecha
$pdf->Text(30, 53, maxCaracter(utf8_decode($direccion), 35), 1, 0, 'L', 0);
////direccion
$pdf->Text(155, 42, maxCaracter(utf8_decode($ci_ruc), 20), 1, 0, 'L', 0);
////ruc ci
$pdf->Text(155, 48, maxCaracter(utf8_decode($telefono), 20), 1, 0, 'L', 0);
////telefono
if ($estado == 'Pasivo') {
    $pdf->SetTextColor(249, 33, 33);
    $pdf->RotatedImage('../images/circle.png', 110, 42, 30, 10, 45);
    $pdf->RotatedText(120, 41, 'ANULADO!', 45);
    $pdf->RotatedImage('../images/circle.png', 260, 42, 30, 10, 45);
    $pdf->RotatedText(269, 41, 'ANULADO!', 45);
Esempio n. 4
0
 $pdf->Cell(40, 12, 'Grado di apprendimento ', 0, 0, 'R', 1);
 $pdf->Rect($x, $y, 40, 12);
 $pdf->Rect($pdf->GetX(), $pdf->GetY(), 135, 12);
 $pdf->SetFont('abalc', '', 9);
 $pdf->Cell(27, 6, 'Gravemente insuff.', 0, 0, 'C');
 $pdf->Cell(27, 6, 'Insufficiente', 0, 0, 'C');
 $pdf->Cell(27, 6, 'Sufficiente', 0, 0, 'C');
 $pdf->Cell(27, 6, 'Buono', 0, 0, 'C');
 $pdf->Cell(27, 6, 'Ottimo', 0, 1, 'C');
 $pdf->Rect(70, $pdf->GetY(), 3, 3);
 $pdf->Rect(97, $pdf->GetY(), 3, 3);
 $pdf->Rect(124, $pdf->GetY(), 3, 3);
 $pdf->Rect(151, $pdf->GetY(), 3, 3);
 $pdf->Rect(178, $pdf->GetY(), 3, 3);
 $pdf->Rect($x, $y + 12, 175, 8);
 $pdf->Text($x + 2, $y + 17, "Note:");
 $y += 20;
 $pdf->SetXY($x, $y);
 $pdf->Rect($x, $y, 40, 12, 'DF');
 $pdf->SetFont('abac', '', 10);
 $pdf->Cell(40, 5, 'Abilità acquisite ', 0, 1, 'R');
 $pdf->SetFont('abalc', '', 8);
 $pdf->MultiCell(39, 3, 'Capacità di rendersi autonomo nello svolgere i compiti assegnati', 0, 'R');
 $pdf->Rect($x + 40, $y, 135, 12);
 $pdf->SetXY($x + 40, $y);
 $pdf->SetFont('abalc', '', 9);
 $pdf->Cell(27, 6, 'Gravemente insuff.', 0, 0, 'C');
 $pdf->Cell(27, 6, 'Insufficiente', 0, 0, 'C');
 $pdf->Cell(27, 6, 'Sufficiente', 0, 0, 'C');
 $pdf->Cell(27, 6, 'Buono', 0, 0, 'C');
 $pdf->Cell(27, 6, 'Ottimo', 0, 2, 'C');
Esempio n. 5
0
    $cliente = $row[10];
    $ci_ruc = $row[9];
    $direccion = $row[11];
    $telefono = $row[12];
    $fecha = $row[2];
    $nro_fac = substr($row[1], 8);
    $iva0 = $row[3];
    $iva12 = $row[4];
    $iva_venta = $row[5];
    $descuento_venta = $row[6];
    $total_venta = $row[7];
    $estado = $row[13];
}
/////////header
$pdf->SetFont('Arial', 'B', 10);
$pdf->Text(113, 21, maxCaracter(utf8_decode($nro_fac), 20), 1, 0, 'L', 0);
$pdf->Text(265, 21, maxCaracter(utf8_decode($nro_fac), 20), 1, 0, 'L', 0);
/////////medio
$pdf->SetFont('Amble-Regular', '', 10);
$pdf->Text(30, 48, maxCaracter(utf8_decode($cliente), 80), 1, 0, 'L', 0);
/////cliente
$pdf->Text(30, 55, maxCaracter(utf8_decode($direccion), 50), 1, 0, 'L', 0);
////direccion
$pdf->Text(113, 55, maxCaracter(utf8_decode($telefono), 20), 1, 0, 'L', 0);
////telefono
$pdf->Text(30, 62, maxCaracter(utf8_decode($ci_ruc), 20), 1, 0, 'L', 0);
////ruc ci
$pdf->Text(113, 62, maxCaracter(utf8_decode($fecha), 20), 1, 0, 'L', 0);
/////fecha
$pdf->Text(180, 48, maxCaracter(utf8_decode($cliente), 80), 1, 0, 'L', 0);
/////cliente
Esempio n. 6
0
            $code .= $codes[$p[$i - 1]][$barcode[$i]];
        }
        $code .= '01010';
        for ($i = 7; $i <= 12; $i++) {
            $code .= $codes['C'][$barcode[$i]];
        }
        $code .= '101';
        //Draw bars
        for ($i = 0; $i < strlen($code); $i++) {
            if ($code[$i] == '1') {
                $this->Rect($x + $i * $w, $y, $w, $h, 'F');
            }
        }
        //Print text uder barcode
        $this->SetFont('Arial', '', 5);
        $this->Text($x + 7, $y + $h + 6 / $this->k, substr($barcode, -$len));
    }
}
$pdf = new PDF();
//define('EURO',chr(128));
$pdf = new PDF(L, mm, array(29, 18));
$pdf->Open();
$pdf->AddPage();
$pdf->SetFont('Arial', '', 5);
$pdf->Text(2, 3, $descripcion);
$pdf->EAN13(1, 4, $codigobarras);
$pdf->SetFont('Arial', '', 7);
$pdf->Text(1, 16, "Ref.: " . $referencia);
//$pdf->SetFont('Arial','',9);
//$pdf->Text(5,23,"PVP: ".$precio." ".EURO);
$pdf->Output();
 $pdf->setFont('Arial', 'B', '16');
 $po = key($sscc_po_list);
 $shipping_address = array();
 $shipping_address[] = $orders_data[$po]['customer_shipping_address'];
 $shipping_address[] = $orders_data[$po]['customer_shipping_address2'];
 $shipping_address[] = $orders_data[$po]['customer_shipping_postcode'] . " " . $orders_data[$po]['customer_shipping_city'];
 $shipping_address[] = $orders_data[$po]['customer_shipping_country'];
 $shipping_address[] = "[" . $orders_data[$po]['customer_shipping_id'] . "]";
 $shipping_address_text = implode("\n", $shipping_address);
 $pdf->MultiCell(100, $lineheight + 2, $shipping_address_text);
 $ypos += 40;
 $asn_code = "ASN" . $asns[$sscc];
 $pdf->drawPackageBarcode($asn_code, $boxes_tab_env, $ypos, 0, $barcode_width);
 $ypos += 24;
 $pdf->setFont('Arial', '', '15');
 $pdf->Text($boxes_tab_env, $ypos, $asn_code);
 $ypos += 10;
 $pdf->setFont('Arial', 'B', '17');
 $pdf->Text($boxes_tab_env, $ypos, 'SSCC #:');
 $ypos += 2;
 $pdf->drawPackageBarcode($sscc, $boxes_tab_env, $ypos, 0, $barcode_width);
 $ypos += 24;
 $pdf->setFont('Arial', '', '15');
 $pdf->Text($boxes_tab_env, $ypos, $sscc);
 $ypos += 20;
 $pdf->setFont('Arial', 'B', '14');
 $pdf->Text($boxes_tab_env, $ypos, "From:");
 $pdf->Line($boxes_tab_env + 39, $ypos + 1, 150, $ypos + 1, $solid_style_med);
 $pdf->setFont('Arial', '', '12');
 $pdf->Text($boxes_tab_env + 45, $ypos, $jng_from);
 $ypos += 10;
     if ($is_product_field) {
         $pdf->SetFont($pdf->font, NORMAL, $pdf->invoice_font_size);
     }
 }
 $Y_Table_Position += $pdf->lines_height;
 if ($attributes) {
     //Print attributes
     $pdf->SetFont($pdf->font, ITALIC, 9);
     $x = $x_pos[$products_field_item] + 2;
     $w = $products_field_width - 2;
     $y = $Y_Table_Position + $pdf->lines_height * 0.6;
     for ($a = 0, $m = $attributes - 1; $a <= $m; $a++) {
         $current_attribute = $current_product_attributes[$a];
         $txt = '- ' . $current_attribute['option'] . COLON_BLANK . $current_attribute['value'];
         $txt = fit_string($txt, $w);
         $pdf->Text($x, $y, $txt);
         $y += $pdf->lines_height;
     }
     $pdf->SetFont($pdf->font, NORMAL, $pdf->invoice_font_size);
     //$pdf->SetY($Y_Table_Position+$attributes*$pdf->lines_height);
     $Y_Table_Position += $pdf->lines_height * $attributes;
 }
 $item_count++;
 //Check for products overflow (i.e.: more then one page required
 $break_page = $item_count % $invoice_items_per_page == 0;
 if ($break_page) {
     if ($i != $n) {
         //Overflow if more products to come!
         new_page();
     }
 }
    $telefono = $row[12];
    $ciudad = $row[13];
    $pago = $row[14];
    $fecha = $row[2];
    $nro_fac = substr($row[1], 8);
    $iva0 = $row[3];
    $iva12 = $row[4];
    $iva_venta = $row[5];
    $descuento_venta = $row[6];
    $total_venta = $row[7];
    $estado = $row[15];
}
// Cabezera Factura
$pdf->SetFont('Arial', 'B', 10);
$pdf->SetFont('Amble-Regular', '', 10);
$pdf->Text(30, 77, maxCaracter(utf8_decode($cliente), 50), 1, 0, 'L', 0);
/////cliente
$pdf->Text(30, 82, maxCaracter(utf8_decode($ci_ruc), 20), 1, 0, 'L', 0);
/////identificacion
$pdf->Text(30, 87, maxCaracter(utf8_decode($direccion), 35), 1, 0, 'L', 0);
////direccion
$pdf->Text(30, 93, maxCaracter(utf8_decode($telefono), 35), 1, 0, 'L', 0);
////telefono
$pdf->Text(88, 92, maxCaracter(utf8_decode($ciudad), 35), 1, 0, 'L', 0);
////ciudad
$pdf->Text(165, 77, maxCaracter(utf8_decode($fecha), 20), 1, 0, 'L', 0);
////fecha
$pdf->Text(165, 82, maxCaracter(utf8_decode($pago), 20), 1, 0, 'L', 0);
////forma pago
if ($estado == 'Pasivo') {
    $pdf->SetTextColor(249, 33, 33);
$troca = 1;
$cabec = false;
for ($i = 0; $i < $numrows; $i++) {
    //   $pdf->setx(5);
    if ($pdf->GetY() > $pdf->h - 30 || $troca != 0) {
        //   if ($linha++ > 45 ){
        $troca = 0;
        $linha = 0;
        $pdf->AddPage();
        $pdf->setxy(5, 35);
        $X = 5;
        $Y = 38;
        $pdf->SetFont('Arial', 'B', 8);
        if (!$cabec) {
            $pdf->Cell(0, 21, '', "TB", 0, 'C');
            $pdf->Text($X, $Y, "Numcgm:");
            $pdf->Text($X + 40, $Y, $outros);
            $pdf->Text($X, $Y + 4, "Nome:");
            $pdf->Text($X, $Y + 8, "CNPJ/CPF:");
            $pdf->Text($X + 45, $Y + 8, "Identidade:");
            $pdf->Text($X, $Y + 12, "Endereço:");
            $pdf->Text($X + 110, $Y + 12, "Número:");
            $pdf->Text($X + 155, $Y + 12, "Complemento:");
            $pdf->Text($X, $Y + 16, "Município:");
            $pdf->Text($X + 55, $Y + 16, "UF:");
            $pdf->SetFont('Arial', 'I', 8);
            $pdf->Text($X + 18, $Y, pg_result($dados, 0, "z01_numcgm"));
            $pdf->Text($X + 18, $Y + 4, pg_result($dados, 0, "z01_nome"));
            $pdf->Text($X + 18, $Y + 8, db_cgccpf(pg_result($dados, 0, "z01_cgccpf")));
            $pdf->Text($X + 18 + 45, $Y + 8, pg_result($dados, 0, "z01_ident"));
            $pdf->Text($X + 18, $Y + 12, pg_result($dados, 0, "z01_ender"));
    }
}
$pdf = new PDF('P', 'mm', 'a4');
$pdf->AddPage();
$pdf->SetMargins(10, 0, 0, 0);
$pdf->AliasNbPages();
$pdf->SetAutoPageBreak(true, 10);
$pdf->AddFont('Amble-Regular', '', 'Amble-Regular.php');
$pdf->SetFont('Amble-Regular', '', 10);
$pdf->Rect(25, 25, 165, 40, 'D');
////3 INFO TRIBUTARIA
$pdf->SetY(33);
$pdf->SetX(85);
$pdf->multiCell(180, 6, utf8_decode('SERVICIO RENTAS INTERNAS'), 0);
//NOMBRE cliente
$pdf->Text(60, 45, utf8_decode('RUC: '));
//ruc cliente
$pdf->Text(42, 50, utf8_decode('RAZON SOCIAL: '));
//ruc cliente
$pdf->Text(48, 55, utf8_decode('IMPUESTOL: '));
//ruc cliente
$pdf->Text(40, 60, utf8_decode('PERIODO FISCAL: '));
//ruc cliente
$pdf->Rect(25, 65, 165, 10, 'D');
////3 INFO TRIBUTARIA
$pdf->SetY(67);
$pdf->SetX(25);
$pdf->multiCell(130, 6, utf8_decode('CAMPO'), 0);
//NOMBRE cliente
$pdf->Text(70, 71, utf8_decode('DESCRIPCIÓN'));
//ruc cliente
Esempio n. 12
0
    // Position von 1.5 cm von unten
    $this->SetY(-19);
}
// Übernahme class
$pdf = new PDF();
$pdf->AliasNbPages();
// Abstände auf der seite setzen
$pdf->SetMargins(4, 2, 4);
// Hinzufügen der 1. Seite
$pdf->AddPage();
// Adressfeld mit Absender und Rechnungsanschrift
$pdf->SetX(0);
$pdf->SetY(58);
$pdf->SetFont('Arial', '', 6);
$pdf->SetTextColor(0);
$pdf->Text(20, 50, SHOPBETREIBER . ' *' . SHOPSTRASSE . ' *' . SHOPSTADT);
$pdf->SetFont('Arial', '', 9);
$pdf->SetTextColor(0);
$pdf->Cell(20);
$pdf->MultiCell(70, 3.3, tep_address_format($order->billing['format_id'], $order->billing, '', '', "\n"), 0, 'L');
// Lieferanschrift
/*
    $pdf->SetFont('Arial','B',8);
$pdf->SetTextColor(0);
$pdf->Text(117,71,ENTRY_SHIP_TO);
$pdf->SetX(0);
$pdf->SetY(74);
    $pdf->Cell(115);
*/
// Barcode
/* if (BARCODE_RECHNUNG == 'ja'){
Esempio n. 13
0
while ($row = pg_fetch_row($sql)) {
    $cliente = $row[10];
    $ci_ruc = $row[9];
    $direccion = $row[12];
    $telefono = $row[11];
    $fecha = $row[2];
    $nro_fac = substr($row[1], 8);
    $iva0 = $row[3];
    $iva12 = $row[4];
    $iva_venta = $row[5];
    $descuento_venta = $row[6];
    $total_venta = $row[7];
}
/////////header
$pdf->SetFont('Arial', 'B', 10);
$pdf->Text(113, 21, maxCaracter(utf8_decode($nro_fac), 20), 1, 0, 'L', 0);
/////////medio
$pdf->SetFont('Amble-Regular', '', 10);
$pdf->Text(30, 48, maxCaracter(utf8_decode($cliente), 80), 1, 0, 'L', 0);
/////cliente
$pdf->Text(30, 55, maxCaracter(utf8_decode($direccion), 50), 1, 0, 'L', 0);
////direccion
$pdf->Text(113, 55, maxCaracter(utf8_decode($telefono), 20), 1, 0, 'L', 0);
////telefono
$pdf->Text(30, 62, maxCaracter(utf8_decode($ci_ruc), 20), 1, 0, 'L', 0);
////ruc ci
$pdf->Text(113, 62, maxCaracter(utf8_decode($fecha), 20), 1, 0, 'L', 0);
/////fecha
////////detalles
$sql = pg_query("select id_detalle_deventa,id_devolucion_venta,productos.cod_productos,cantidad,precio_venta,descuento_producto,total_venta,articulo from detalle_devolucion_venta,productos where detalle_devolucion_venta.cod_productos=productos.cod_productos and id_devolucion_venta='{$_GET['id']}' and productos.incluye_iva = 'No'");
$yy = 76;
     // Position von 1.5 cm von unten
     $this->SetY(-19);
 }
 // Übernahme class
 $pdf = new PDF();
 $pdf->AliasNbPages();
 // Abstände auf der seite setzen
 $pdf->SetMargins(4, 2, 4);
 // Hinzufügen der 1. Seite
 $pdf->AddPage();
 // Adressfeld mit Absender und Rechnungsanschrift
 $pdf->SetX(0);
 $pdf->SetY(58);
 $pdf->SetFont('Arial', '', 6);
 $pdf->SetTextColor(0);
 $pdf->Text(20, 50, utf8_decode(SHOPBETREIBER) . ' *' . utf8_decode(SHOPSTRASSE) . ' *' . utf8_decode(SHOPSTADT));
 $pdf->SetFont('Arial', '', 9);
 $pdf->SetTextColor(0);
 $pdf->Cell(20);
 $pdf->MultiCell(70, 3.3, iconv('UTF-8', 'windows-1252', tep_address_format($order->billing['format_id'], $order->billing, '', '', "\n")), 0, 'L');
 // Lieferanschrift
 /*
     $pdf->SetFont('Arial','B',8);
 $pdf->SetTextColor(0);
 $pdf->Text(117,71,ENTRY_SHIP_TO);
 $pdf->SetX(0);
 $pdf->SetY(74);
     $pdf->Cell(115);
 */
 // Barcode
 /* if (BARCODE_RECHNUNG == 'ja'){
Esempio n. 15
0
 if (isset($_POST['alumnos']) && isset($_POST['checkbox'])) {
     $pdf->fondoverde($x, $y);
 } elseif ($anyos >= '18' or strstr($row_Recordset1[1], "B-") == TRUE and strlen($row_Recordset1[5]) < "54") {
     $pdf->fondonaranja($x, $y);
     $pdf->uno($x, $y);
 } else {
     $pdf->fondoverde($x, $y);
     $naranja = 0;
 }
 #Hasta aquí el fondo, ahora el texto:
 // CABECERA
 $pdf->Image('./carnet/junta.png', $x + 3, $y + 4, 24);
 $pdf->Image('./carnet/consejeria.png', $x + 57, $y + 4, 24);
 $pdf->SetTextColor(59, 113, 59);
 $pdf->SetFont('Arial', 'B', 7);
 $pdf->Text(33 + $x, 6.1 + $y, $curso);
 $pdf->SetFont('Arial', 'B', 5);
 $pdf->Text(57.2 + $x, 7.7 + $y, $config['centro_denominacion']);
 $pdf->SetTextColor(0, 0, 0);
 $longnie = strlen($claveal);
 $dplz = 0;
 if ($longnie < 7) {
     $dplz = 4;
 }
 $pdf->Rect(2 + $x, 12 + $y, 23, 30, 'F');
 #$pdf->Rect(46+$x,36+$y,33,11,F);
 $fileExtension = ".jpg";
 $foto_al = "../fotos/" . $claveal . ".jpg";
 if (file_exists($foto_al)) {
     $pdf->Image($foto_al, 2.5 + $x, 12.5 + $y, 22);
 }
Esempio n. 16
0
         parent::__construct('L', 'mm', 'A4');
         //parent::__construct('P','mm','Letter');
     }
 }
 //Creación del objeto de la clase heredada
 $pdf = new PDF();
 $pdf->SetTopMargin(5.4);
 $pdf->SetLeftMargin(1.5);
 $pdf->AliasNbPages();
 $pdf->SetFont('Arial', '', 9);
 $pdf->AddPage();
 $pdf->Ln();
 //Construcción de la tabla a mostrar
 $pdf->SetY(90);
 $pdf->SetFont('Arial', 'b', 10);
 $pdf->Text(20, 80, iconv('utf-8', 'cp1252', 'N°'));
 $pdf->Text(28, 80, iconv('utf-8', 'cp1252', 'R.U.C'));
 $pdf->Text(50, 80, iconv('utf-8', 'cp1252', 'Razón Social'));
 $pdf->Text(110, 80, iconv('utf-8', 'cp1252', 'Dirección'));
 $pdf->Text(175, 80, iconv('utf-8', 'cp1252', 'Teléfono'));
 $pdf->Text(200, 80, iconv('utf-8', 'cp1252', 'E-mail'));
 $pdf->Text(263, 80, iconv('utf-8', 'cp1252', 'Estado'));
 $pdf->SetFont('Arial', '', 8);
 $pdf->Line(20, 82, 275, 82);
 $pdf->Line(20, 83, 275, 83);
 $j = 0;
 $Total = 0;
 foreach ($fila as $key) {
     $j = $j + 1;
     $pdf->Text(20, $pdf->GetY(), $j);
     $pdf->Text(28, $pdf->GetY(), iconv('utf-8', 'cp1252', $key[0]));
            $code .= $codes[$p[$i - 1]][$barcode[$i]];
        }
        $code .= '01010';
        for ($i = 7; $i <= 12; $i++) {
            $code .= $codes['C'][$barcode[$i]];
        }
        $code .= '101';
        //Draw bars
        for ($i = 0; $i < strlen($code); $i++) {
            if ($code[$i] == '1') {
                $this->Rect($x + $i * $w, $y, $w, $h, 'F');
            }
        }
        //Print text uder barcode
        $this->SetFont('Arial', '', 5);
        $this->Text($x + 7, $y + $h + 6 / $this->k, substr($barcode, -$len));
    }
}
$pdf = new PDF();
define('EURO', chr(128));
$pdf = new PDF(P, mm, array(29, 25));
$pdf->Open();
$pdf->AddPage();
$pdf->SetFont('Arial', '', 5);
$pdf->Text(2, 3, $descripcion);
$pdf->EAN13(1, 4, $codigobarras);
$pdf->SetFont('Arial', '', 7);
$pdf->Text(1, 19, "Ref.: " . $referencia);
$pdf->SetFont('Arial', '', 9);
$pdf->Text(5, 23, "PVP: " . $precio . " " . EURO);
$pdf->Output();
Esempio n. 18
0
        //6
        $this->Line(10, 73, 205, 73);
        $this->Line(10, 170, 205, 170);
    }
    //Page footer
    function Footer()
    {
    }
}
//Instanciation of inherited class
$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage('P', 'Letter');
$pdf->SetFont('Arial', '', 10);
//table title
$pdf->Text(12, 64, 'NO');
$pdf->Text(22, 64, 'ITEM');
$pdf->Text(22, 67, 'CODE');
$pdf->Text(42, 64, 'DESCRIPTION');
$pdf->Text(137, 64, 'QTY');
$pdf->Text(152, 64, 'UOM');
$pdf->Text(167, 64, 'UNIT');
$pdf->Text(167, 67, 'PRICE');
$pdf->Text(187, 64, 'EXT.');
$pdf->Text(187, 67, 'PRICE');
$starting = 82;
////////////
$count = '0';
//SQL  //gives the following
//   doc_number, quantity, unit_price, extended_price, item_id, doc_number, branch_id, currency, doc_date, branchLocation, branchNo, branchName, description, unit_of_measure, supplier_1, supplierContact, supplierNum, supplierName, supplierAddress
$sql = "SELECT B.`doc_number`, B.`quantity`, B.`unit_price`, B.`extended_price`,B.`item_id`,B.`description`,\r\n            A.`doc_number`, A.`branch_id`, A.`currency`, date_format(A.doc_date, '%D %M, %Y') as doc_date, A.payment, A.delivery, A.discount, A.total, A.special_instruction, A.mof_number,\r\n            C.`location`as branchLocation, C.`phone_no` as branchNo, C.`name` as branchName,\r\n            D.`unit_of_measure`,\r\n            F.name as requester,\r\n            G.country AS currency,\r\n            A.supplier_1, A.supplier_2, A.supplier_3, E.contact_person as supplierContact, E.contact as supplierNum, E.name as supplierName, E.line_1 as add1, E.line_2 as add2, E.line_3 as add3, E.fax_no\r\n            FROM purchases A, currencies G, purchase_details B, branches C, inv_items D, suppliers E, users F\r\n            WHERE A.doc_number='{$doc_num}'\r\n            AND B.doc_number = A.doc_number\r\n            AND F.username = A.requester\r\n            AND A.branch_id = C.id\r\n            AND A.supplier_1 = E.id\r\n            AND B.item_id = D.id\r\n            AND A.currency = G.id\r\n            LIMIT 0,{$limit}";
Esempio n. 19
0
$contador = 0;
$desplazamiento = 0;
$contador20 = 0;
while ($contador < mysql_num_rows($rs_lineas)) {
    $descripcion = mysql_result($rs_lineas, $contador, "descripcion_corta");
    $referencia = mysql_result($rs_lineas, $contador, "referencia");
    $codigobarras = mysql_result($rs_lineas, $contador, "codigobarras");
    $descripcion = substr($descripcion, 0, 31);
    $precio = mysql_result($rs_lineas, $contador, "precio_tienda");
    $precio = number_format($precio, 2, ",", ".");
    $cantidad = mysql_result($rs_lineas, $contador, "cantidad");
    $contador2 = 0;
    while ($contador2 < $cantidad) {
        $contador20++;
        $pdf->SetFont('Arial', '', 5);
        $pdf->Text(2, 3 + $desplazamiento, $descripcion);
        $pdf->EAN13(1, 4 + $desplazamiento, $codigobarras);
        $pdf->SetFont('Arial', '', 7);
        $pdf->Text(1, 19 + $desplazamiento, "Ref.: " . $referencia);
        $pdf->SetFont('Arial', '', 9);
        $pdf->Text(1, 23 + $desplazamiento, "PVP: " . $precio . " " . EURO);
        $desplazamiento = $desplazamiento + 27;
        $contador2++;
        //aqui se pregunta si han llegado a 20 etiquetas para hacer el salto de página
        //si quieres modificarlo ya sabes que tienes que cambiar también en alto arriba
        if ($contador20 == 20) {
            $desplazamiento = 0;
            $pdf->AddPage();
            $contador20 = 0;
        }
    }
Esempio n. 20
0
 public function imprimirgastostransporte($id)
 {
     if (isset($id) && is_numeric($id)) {
         $Gastos = $this->informes_model->TraeGastosTransporte($id);
         if (!is_null($Gastos)) {
             if ($Gastos->num_rows() == 0) {
                 redirect(site_url(), 'refresh');
             }
         } else {
             redirect(site_url(), 'refresh');
         }
     } else {
         redirect(site_url(), 'refresh');
     }
     $pdf = new PDF();
     $pdf->AddPage();
     $Detalle = $this->informes_model->TraeRegistro($id, 'GT');
     $pdf->Image(base_url('public/images/logo.jpg'), 10, 15, 70, 15);
     $pdf->SetFont('Arial', 'B', 10);
     #ENCABEZADO
     $pdf->Text(180, 45, 'DO-69-F');
     $pdf->Text(70, 48, 'FORMATO REPORTE GASTOS DE TRANSPORTE');
     $pdf->Text(75, 55, 'FUNDACIÓN UNIVERSITARIA MARÍA CANO');
     $pdf->Text(78, 60, 'PROGRAMA DE INGENIERÍA DE SISTEMAS');
     $pdf->SetFont('Arial', '', 10);
     $pdf->Text(10, 65, 'Período: ' . (date('m', strtotime($Detalle->FECHA_REGISTRO)) > 6 ? 2 : 1) . ' Semestre ' . date('Y', strtotime($Detalle->FECHA_REGISTRO)));
     $pdf->Text(10, 75, 'Páguese a nombre de: ' . $this->session->userdata('NOMBRE_USUARIO') . '   C.C ' . number_format($this->session->userdata('DOCUMENTO'), 0, ',', ','));
     #Headers
     $pdf->SetFont('Arial', 'B', 9);
     $pdf->SetXY(5, 82);
     $pdf->Cell(25, 10, 'FECHA', 1, 0, 'C');
     $pdf->SetXY(30, 82);
     $pdf->Cell(50, 10, 'LUGAR', 1, 0, 'C');
     $pdf->SetXY(80, 82);
     $pdf->Cell(40, 10, 'ACTIVIDAD', 1, 0, 'C');
     $pdf->SetXY(120, 82);
     $pdf->MultiCell(34, 5, 'NÚMERO DE DESPLAZAMIENTOS', 1, 'C');
     $pdf->SetXY(154, 82);
     $pdf->MultiCell(25, 5, 'VALOR UNITARIO', 1, 'C');
     $pdf->SetXY(179, 82);
     $pdf->MultiCell(27, 10, 'VALOR TOTAL', 1, 'C');
     $pdf->SetFont('Arial', '', 9);
     $pdf->SetWidths([25, 50, 40, 34, 25, 27]);
     $pdf->SetAligns(['C', 'C', 'C', 'C', 'C']);
     $Total = 0;
     foreach ($Gastos->result() as $gasto) {
         $pdf->SetX(5);
         $pdf->Row([Fecha($gasto->FECHA_GASTO), utf8_encode($gasto->LUGAR), utf8_encode($gasto->ACTIVIDAD), $gasto->NUMERO_DESPLAZAMIENTOS, number_format($gasto->VALOR_UNITARIO, 0, '', ','), number_format($gasto->VALOR_TOTAL, 0, '', ',')]);
         $Total += $gasto->VALOR_TOTAL;
     }
     $pdf->SetFont('Arial', 'B', 9);
     $pdf->SetX(5);
     $pdf->Row(['', '', '', '', 'Total', number_format($Total, 0, '', ',')]);
     #Footer
     $pdf->Text(25, $pdf->GetY() + 20, 'Firma Coordinador de Práctica');
     $pdf->Line(10, $pdf->GetY() + 15, 90, $pdf->GetY() + 15);
     $pdf->Text(140, $pdf->GetY() + 20, 'CENTRO DE PRÁCTICAS');
     $pdf->Output();
     $pdf->Cell($pdf->PageNo());
 }
Esempio n. 21
0
            }
        }
        //Print text uder barcode
        $this->SetFont('Arial', '', 14);
        $this->Text($x + 27, $y + $h + 15 / $this->k, substr($barcode, -$len));
    }
}
$pdf = new PDF();
$pdf = new PDF('P', 'mm', array(210, 148.5));
QRcode::png($detalle, '/tmp/qr.png', 'L', 3, 2);
$pdf->Open();
$pdf->AddPage();
$pdf->SetFont('times', '', 5);
//$pdf->Text(0,1,"._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ." );
$pdf->SetFont('times', '', 16);
$pdf->Text(60, 6, $nombrelegal);
$pdf->SetFont('Arial', '', 9);
$pdf->Text(5, 10, $descripcion1);
$pdf->Text(5, 14, $descripcion2);
$pdf->Image('/tmp/qr.png', 55, 14, 92, 92, 'PNG', '');
$pdf->EAN13(4, 16.5, $codigobarras);
$pdf->SetFont('helvetica', '', 14);
$pdf->Text(9, 80, $paginaweb);
$pdf->SetFont('times', '', 5);
$pdf->Text(0, 105, "._ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _.");
$pdf->SetFont('times', '', 16);
$pdf->Text(60, 111, $nombrelegal);
$pdf->SetFont('Arial', '', 9);
$pdf->Text(5, 115, $descripcion1);
$pdf->Text(5, 119, $descripcion2);
$pdf->Image('/tmp/qr.png', 55, 119, 92, 92, 'PNG', '');
Esempio n. 22
0
         parent::__construct('P', 'mm', 'A4');
         //parent::__construct('P','mm','Letter');
     }
 }
 //Creación del objeto de la clase heredada
 $pdf = new PDF();
 $pdf->SetTopMargin(5.4);
 $pdf->SetLeftMargin(1.5);
 $pdf->AliasNbPages();
 $pdf->SetFont('Arial', '', 9);
 $inicio = 16;
 $datos = 44;
 $pdf->AddPage();
 $pdf->SetY(20);
 $pdf->SetFont('Arial', '', 15);
 $pdf->Text($inicio, $pdf->GetY(), iconv('utf-8', 'cp1252', 'START TEC - PERÚ'));
 $pdf->Image('images/www.png', $inicio, 21, 35, 20, 'png');
 //Cuadro de serie y numero correlativo
 $pdf->SetXY(135, 17);
 $pdf->Line(135, 17, 196, 17);
 $pdf->Cell(61, 25, '', "LR", 0, "R");
 $pdf->Line(135, 42, 196, 42);
 $pdf->SetY(23);
 $pdf->SetFont('Arial', 'b', 14);
 $pdf->Text(139, $pdf->GetY(), iconv('utf-8', 'cp1252', 'R.U.C. N° 20395834584'));
 $pdf->SetY(30);
 $pdf->SetTextColor(255, 0, 0);
 if ($url[4] == "boleta") {
     $pdf->Text(142, $pdf->GetY(), iconv('utf-8', 'cp1252', 'BOLETA DE VENTA'));
 } else {
     $pdf->Text(153, $pdf->GetY(), iconv('utf-8', 'cp1252', 'FACTURA'));
 $ypos += $lineheight;
 $pdf->Line($boxes_tab_env, $ypos, 80, $ypos);
 $ypos += 15;
 $pdf->setXY($margin_env + 70, $ypos);
 $pdf->setFont('Arial', 'B', '14');
 $shipping_address = $orders_data[$po]['customer_shipping_address'] . "\n";
 $shipping_address .= $orders_data[$po]['customer_shipping_address2'] . "\n";
 $shipping_address .= $orders_data[$po]['customer_shipping_postcode'] . " " . $orders_data[$po]['customer_shipping_city'] . "\n";
 $shipping_address .= $orders_data[$po]['customer_shipping_country'] . "\n";
 $shipping_address .= "[" . $orders_data[$po]['customer_shipping_id'] . "]";
 $pdf->MultiCell(100, $lineheight + 2, $shipping_address);
 $ypos += 45;
 $pdf->OrderBarcode($po, $boxes_tab_env, $ypos, 0, $barcode_height);
 $ypos += $barcode_height + 2;
 $pdf->setFont('Arial', 'B', '19');
 $pdf->Text($boxes_tab_env, $ypos - 1, "PO # {$po}");
 //FILL DATA (HARDCODED)
 $pdf->setFont('Arial', '', '12');
 $pdf->Text($boxes_tab_env + 39, $ypos + 8, $jng_from);
 $pdf->Text($boxes_tab_env + 45, $ypos + 18, '197');
 $pdf->setFont('Arial', 'B', '14');
 $ypos += 10;
 $pdf->Text($boxes_tab_env, $ypos, "From:");
 $pdf->Line($boxes_tab_env + 39, $ypos + 1, 150, $ypos + 1, $solid_style_med);
 $ypos += 10;
 $pdf->Text($boxes_tab_env, $ypos, "Product Group:");
 $pdf->Line($boxes_tab_env + 39, $ypos + 1, 150, $ypos + 1, $solid_style_med);
 $ypos += 10;
 $pdf->Text($boxes_tab_env, $ypos, "ASN:");
 $pdf->Line($boxes_tab_env + 39, $ypos + 1, 150, $ypos + 1, $solid_style_med);
 $ypos += 10;
Esempio n. 24
0
$pdf->Ln(5);
///////////////
$pdf->SetTextColor(70, 119, 159);
$sql = pg_query("select id_factura_venta,num_factura,nombre_empresa,telefono_empresa,direccion_empresa,email_empresa,pagina_web,ruc_empresa,nombres_cli,identificacion,direccion_cli,telefono,ciudad,fecha_actual,forma_pago,fecha_cancelacion,nombre_usuario,apellido_usuario from factura_venta,clientes,empresa,usuario where factura_venta.id_cliente=clientes.id_cliente and empresa.id_empresa=factura_venta.id_empresa and factura_venta.id_usuario=usuario.id_usuario and factura_venta.id_factura_venta='{$_GET['id']}'");
$numfilas = pg_num_rows($sql);
for ($i = 0; $i < $numfilas; $i++) {
    $fila = pg_fetch_row($sql);
    $pdf->SetX(130);
    $pdf->SetFillColor(255, 255, 255);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->Cell(55, 10, '', 0, 1, 'C', 'true');
    $pdf->SetX(130);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->SetFont('Arial', '', 8);
    $pdf->Cell(55, 50, '', 0, 1, 'C');
    $pdf->Text(25, 76, utf8_decode('' . strtoupper($fila[8])), 0, 'C', 0);
    ////CLIENTE (X,Y)
    $pdf->Text(25, 82, utf8_decode('' . strtoupper($fila[9])), 0, 'C', 0);
    ////RUC (X,Y)
    $pdf->Text(25, 88, utf8_decode('' . strtoupper($fila[10])), 0, 'C', 0);
    ///DIRECCION (X,Y)
    $pdf->Text(25, 94, utf8_decode('' . strtoupper($fila[11])), 0, 'C', 0);
    ///TELEFONO(X,Y)
    $pdf->Text(115, 94, utf8_decode('' . strtoupper($fila[12])), 0, 'C', 0);
    ///CIUDAD(X,Y)
    $pdf->Text(180, 76, utf8_decode(strtoupper($fila[13])), 0, 'C', 0);
    ///FECHA EMISION (X,Y)
    $pdf->Text(180, 82, utf8_decode(strtoupper($fila[14])), 0, 'C', 0);
    ////FORMA PAGO (X,Y)
    $pdf->Text(183, 88, utf8_decode(strtoupper($fila[15])), 0, 'C', 0);
    ///FECHA VENCIMIENTO (X,Y)
$pdf->MultiCell( 0  , 0 , iconv( 'UTF-8','cp874' ,'                                                             '.'http://www.tawanchai-foundation.org/'  ));
$pdf->setXY($abs_x , $y_absolute +  ($r*36)  );
$pdf->SetFont('angsana','I',15);
$pdf->MultiCell( 0  , 0 , iconv( 'UTF-8','cp874' , '                                                        '.'Registration date : '.$today  ));
*/
$pdf->setXY($abs_x, $y_absolute + $r * 33);
$pdf->SetTextColor(0, 0, 255);
#blue color
$pdf->SetFont('angsana', '', 14);
$pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', '                      ' . 'ใบเสร็จอิเล็กทรอนิกส์ฉบับนี้สามารถนำไปเบิกจ่ายค่าลงทะเบียนจากต้นสังกัดคืนได้'));
$pdf->SetTextColor(0);
$pdf->setXY($abs_x, $y_absolute + $r * 34);
$pdf->SetFont('angsana', '', 13);
$pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', '              ' . ' 8th Annual Meeting of the Thai Cleft Lip-Palate and Craniofacial Association: Internation Congress '));
$pdf->setXY($abs_x, $y_absolute + $r * 35);
$pdf->SetFont('angsana', '', 13);
$pdf->MultiCell(0, 0, iconv('UTF-8', 'cp874', '                                                              ' . 'http://www.thaicleft2015.org'));
////Put watermark
$pdf->SetFont('angsana', 'B', 60);
$pdf->SetTextColor(211, 211, 211);
//red,green,blue   211,211,211  gray color
$pdf->Rotate(30, 150, 150);
//angle
$pdf->Text(99, 125, 'THAICleft 2015');
// x,y
/*
$pdf->setXY($abs_x , $y_absolute +  ($r*36)  );
$pdf->SetFont('angsana','I',15);
$pdf->MultiCell( 0  , 0 , iconv( 'UTF-8','cp874' , '                                                        '.'Registration date : '.$today  ));
*/
$pdf->Output();
Esempio n. 26
0
    // Position von 1.5 cm von unten
    $this->SetY(-19);
}
// Übernahme class
$pdf = new PDF();
$pdf->AliasNbPages();
// Abstände auf der seite setzen
$pdf->SetMargins(4, 2, 4);
// Hinzufügen der 1. Seite
$pdf->AddPage();
// Adressfeld mit Absender und Rechnungsanschrift
$pdf->SetX(0);
$pdf->SetY(58);
$pdf->SetFont('Arial', '', 6);
$pdf->SetTextColor(0);
$pdf->Text(20, 50, SHOPBETREIBER . ' *' . SHOPSTRASSE . ' *' . SHOPSTADT);
$pdf->SetFont('Arial', '', 9);
$pdf->SetTextColor(0);
$pdf->Cell(20);
$pdf->MultiCell(70, 3.3, tep_address_format($order->billing['format_id'], $order->billing, '', '', "\n"), 0, 'L');
// Lieferanschrift
/*
    $pdf->SetFont('Arial','B',8);
$pdf->SetTextColor(0);
$pdf->Text(117,71,ENTRY_SHIP_TO);
$pdf->SetX(0);
$pdf->SetY(74);
    $pdf->Cell(115);
*/
// Barcode
/* if (BARCODE_RECHNUNG == 'ja'){
Esempio n. 27
0
         parent::__construct('P', 'mm', 'A4');
         //parent::__construct('P','mm','Letter');
     }
 }
 //Creación del objeto de la clase heredada
 $pdf = new PDF();
 $pdf->SetTopMargin(5.4);
 $pdf->SetLeftMargin(1.5);
 $pdf->AliasNbPages();
 $pdf->SetFont('Arial', '', 9);
 $pdf->AddPage();
 $pdf->Ln();
 //Construcción de la tabla a mostrar
 $pdf->SetY(90);
 $pdf->SetFont('Arial', 'b', 11);
 $pdf->Text(23, 80, iconv('utf-8', 'cp1252', 'Item'));
 $pdf->Text(35, 80, iconv('utf-8', 'cp1252', 'Productos'));
 $pdf->Text(125, 80, 'Total Ventas');
 $pdf->Text(167, 80, iconv('utf-8', 'cp1252', 'Fecha'));
 $pdf->SetFont('Arial', '', 10);
 $pdf->Line(20, 82, 190, 82);
 $pdf->Line(20, 83, 190, 83);
 $j = 0;
 foreach ($fila as $key) {
     $j = $j + 1;
     $productos = iconv('utf-8', 'cp1252', $key[0]);
     $TotalVentas = iconv('utf-8', 'cp1252', $key[1]);
     $fecha = date_format(date_create($key[2]), 'd/m/Y');
     $pdf->Text(25, $pdf->GetY(), $j);
     $pdf->Text(35, $pdf->GetY(), $productos);
     $pdf->Text(135, $pdf->GetY(), $TotalVentas);
 function constructPIContent($pdf, $output, $order, $ignoreStockStatusDepot, $print_per_orders)
 {
     /*  NOTES!!!!!!!!!!!!!!!!
      *  if $print_per_orders == false, $order should contain "collections of orders"
      *  elseif $print_per_orders == true, $order should contain "one order only"
      */
     use_class('Product');
     use_class('ProductAttribute');
     global $class_pm, $class_pb, $product_categories_name, $DIAMOND_BRAND_IDS;
     if ($print_per_orders) {
         $orders[] = $order;
     } else {
         $orders = $order;
     }
     //echo "<pre>";var_dump($orders);die();
     $margin = 5;
     $fontsize_big = '9';
     $fontsize_med = '8';
     $fontsize_sml = '7';
     $fontsize_tny = '5';
     $barcode_width = 32;
     $barcode_pos = 210 - $margin - $barcode_width - 1;
     $element_name_max_chars = 30;
     if ($output == 'F') {
         //PRODUCE PDF FILE PER ITEM (MULTI PDF FILE PER ORDER)
         $pdf = new PDF('P', 'mm', 'A4');
         $pdf->setTitle('Production Instruction');
         $pdf->SetAuthor('JULIE GRACE / Bonofactum');
         $pdf->SetCreator('k-Auto Generated PDF');
         $pdf->SetDisplayMode('real');
         $pdf->SetAutoPageBreak(false);
         $pdf->AliasNbPages();
         $pdf->SetFillColor(191, 191, 191);
     }
     //start looping orders
     foreach ($orders as $order) {
         $o = $order['detail'];
         $is_ottob2b = $o['jng_sp_id'] == '11' || strpos(strtolower($o['customer']), 'otto b2b') !== false;
         foreach ($order['items'] as $oiid => $i) {
             if ($i['status'] < 8) {
                 $this->pi_printed[strtolower($o['type'])][] = $oiid;
             }
             $obj_product = new Product($i['products_id']);
             $is_gold_product = $obj_product->metal_stamp_code > 0 && $obj_product->metal_stamp_code != 925;
             $pdf->pi_number = $o['id'];
             if ($this->duplex_printing && isset($item_page_count) && $item_page_count % 2 != 0) {
                 $pdf->AddPage();
             }
             $pdf->AddPage();
             $item_page_count = 1;
             $product_key = $i['products_id'] . '-' . $i['articles_id'];
             $product_qty = intval($i['quantity']);
             $p = $this->products[$product_key];
             $is_elli_premium = $p['p']['products_brand_id'] == '29';
             $is_diamore = in_array($p['p']['products_brand_id'], $DIAMOND_BRAND_IDS);
             $is_pearl = $p['p']['products_brand_id'] == '7';
             $ean = $this->products_ean[$product_key];
             $product_complexity = strtoupper(productComplexityName($p['p']['complexity']));
             $order_type_code = '';
             if (strtoupper($o['type']) == 'DP') {
                 $order_type_code = strtoupper($o['type']);
                 $otc_width = 12;
             } else {
                 $order_type_code = $o['customer_type'];
                 $otc_width = 20;
             }
             $pdf->OrderBarcode($o['type'], $oiid, $barcode_pos, $margin, $barcode_width);
             $pdf->setFont('Arial', 'B', '12');
             $YPOS = $margin;
             $lineheight = 4;
             //ORDER TYPE CODE (JG,SP,DP)
             $pdf->SetXY($barcode_pos - $otc_width, 10);
             $pdf->Cell(100, $lineheight, $order_type_code);
             //PROCESS DATE
             $pdf->setFont('Arial', 'B', $fontsize_big);
             $process_date = date('d M Y', strtotime($i['prod_target_in']));
             $pdf->SetXY($barcode_pos, 22);
             $pdf->Cell($barcode_width, $lineheight, $process_date, 0, 2, 'R');
             //PRODUCT COMPLEXITY
             $pdf->setFont('Arial', 'B', '12');
             $pdf->SetXY($barcode_pos, 22 + $lineheight + 5);
             $pdf->Cell($barcode_width, $lineheight, $product_complexity, 0, 2, 'R');
             //PAGE HEADER
             $margin_orderinfo = $margin + 50;
             $pdf->SetXY($margin_orderinfo, $YPOS);
             $pdf->Cell(100, $lineheight, 'Production Instruction ' . $o['id'] . ' (' . $i['counter'] . ') - print ' . ($i['print_count'] + 1));
             $YPOS += $lineheight + 1;
             //ORDER INFORMATION
             $lineheight = 3.5;
             $orderilbl = array();
             $orderinfo = array();
             $orderilbl[] = 'Ship To (Country)';
             $orderinfo[] = ': ' . trim($o['shipto_name']) . ($o['shipto_address'] != '' ? ' (' . $o['shipto_address'] . ')' : '');
             //Show shipping window date only for order which using amazon logistic
             if (in_array($o['jng_sp_id'], array_keys(getSalesPartnerUseAmazonLogistic())) && isset($i['shipping_window_open'])) {
                 $orderilbl[] = 'Shipping Window Date';
                 $orderinfo[] = ': ' . date('d. M Y', strtotime($i['shipping_window_open']));
             }
             /* Moved to below barcode
                $orderilbl[] = 'Process Date';
                $orderinfo[] = ': '.date('d. M Y', strtotime($i['prod_target_in']));
                 */
             $orderilbl[] = 'Customer Name';
             $vip_status = $o['customer_is_vip'] ? ' ( VIP )' : '';
             if ($is_ottob2b) {
                 $orderinfo[] = ': OTTO B2B';
             } else {
                 $orderinfo[] = ': ' . $o['customer'] . $vip_status;
             }
             //$orderilbl[] = 'Order Source / Customer Name';
             //$orderinfo[] = ': '.$o['customer_type'].' / '.$o['customer'];
             //$orderilbl[] = 'Product Qty x EAN (ID / Code)';
             //$orderinfo[] = ': '.intval($i['quantity']).' x '.$ean.' ('.$p['p']['products_id'].' / '.$p['p']['products_model'].')';
             $orderilbl[] = 'Product Qty x EAN';
             $orderinfo[] = ': ' . $product_qty . ' x ' . $ean;
             $pdf->setFont('Arial', '', $fontsize_med);
             $pdf->setXY($margin_orderinfo, $YPOS);
             $pdf->MultiCell(50, $lineheight, implode("\n", $orderilbl));
             $pdf->setXY($margin_orderinfo + 30, $YPOS);
             $pdf->MultiCell(100, $lineheight, implode("\n", $orderinfo));
             $maxline = count($orderilbl);
             $YPOS += $maxline * $lineheight + 10;
             //STOCK PREPARATION
             $pdf->setFont('Arial', 'B', $fontsize_big);
             if ($i['stock_status'] == 'D' && !$ignoreStockStatusDepot) {
                 //USE DEPOT STOCK
                 $lineheight = 6;
                 $pdf->SetXY($margin + 1, $YPOS);
                 $pdf->Cell(100, $lineheight, 'Depot Stock', 1, 0, 'C', true);
                 $YPOS += $lineheight + 3;
             } elseif ($i['stock_status'] == 'P') {
                 //USE FINISH GOOD STOCK
                 $lineheight = 6;
                 $pdf->SetXY($margin + 1, $YPOS);
                 $pdf->Cell(100, $lineheight, 'Finish Good', 1, 0, 'C', true);
                 $YPOS += $lineheight + 3;
             } else {
                 //USE ELEMENTS STOCK
                 $lineheight = 4;
                 $pdf->SetXY($margin, $YPOS);
                 $pdf->Cell(100, $lineheight, 'Elements Preparation');
                 $YPOS += $lineheight + 1;
                 $pue_total = count($p['elements']);
                 $pue_rows = ceil($pue_total / 2);
                 $max_rows_el_per_page_1 = 12;
                 //MAX ROWS ELEMENT ON PAGE 1
                 $max_rows_el_per_page_n = 14;
                 //MAX ROWS ELEMENT ON NEXT PAGE
                 $max_rows_el_per_page = $max_rows_el_per_page_1;
                 $pue_counter = 0;
                 $pue_number = 0;
                 $rowpos = $YPOS;
                 $colpos = $margin + 1;
                 $colheight = 20;
                 $col_subcol_width = array();
                 $col_subcol_width[1] = 6;
                 //          $col_subcol_width[2] = $colheight;
                 $col_subcol_width[2] = 20;
                 $col_subcol_width[3] = 10;
                 $col_subcol_width[4] = 51;
                 $col_subcol_width[5] = 10;
                 $col_subcol_imgepos = $col_subcol_width[1];
                 $col_subcol_infopos = $col_subcol_width[1] + $col_subcol_width[2] + $col_subcol_width[3];
                 $colwidth = array_sum($col_subcol_width);
                 $print_header_el = false;
                 foreach ($p['elements'] as $element) {
                     if ($pue_counter == 0 || $print_header_el) {
                         $lineheight = 5;
                         $pdf->setXY($colpos, $rowpos);
                         $pdf->setFont('Arial', 'B', $fontsize_med);
                         $pdf->Cell($col_subcol_width[1], $lineheight, 'No', 1, 0, 'C', true);
                         $pdf->Cell($col_subcol_width[2], $lineheight, 'Image', 1, 0, 'C', true);
                         $pdf->Cell($col_subcol_width[3], $lineheight, 'ID', 1, 0, 'C', true);
                         $pdf->Cell($col_subcol_width[4], $lineheight, 'Info', 1, 0, 'C', true);
                         $pdf->Cell($col_subcol_width[5], $lineheight, 'Qty', 1, 0, 'C', true);
                         $rowpos += $lineheight;
                     }
                     $pue_counter++;
                     $pue_number++;
                     $e = $this->elements[$element['elements_id']];
                     $element_image = $this->getImageForPDF($e->image, '80', '80');
                     $element_info = array();
                     $element_info['n'] = substr($e->detail['name'], 0, $element_name_max_chars) . (strlen($e->detail['name']) > $element_name_max_chars ? '...' : '');
                     //var_dump($e->attributes); exit;
                     $element_info['c'] = $e->attributes['color']['name'];
                     //$element_info['s'] = $e->attributes['size']['name'];
                     $material_name = array();
                     $material_name = explode(',', $e->attributes['material']['name']);
                     $element_info['m'] = count($material_name) > 1 ? $material_name[1] : $material_name[0];
                     $element_info['sh'] = '';
                     if (!eregi('other', $e->attributes['size']['name'])) {
                         $element_info['sh'] = $e->attributes['size']['name'];
                     }
                     if (!eregi('other', $e->attributes['shape']['name'])) {
                         if ($element_info['sh'] != '') {
                             $element_info['sh'] .= '.';
                         }
                         $element_info['sh'] .= $e->attributes['shape']['name'];
                     }
                     //$element_info['h'] = $e->attributes['shape']['name'];
                     if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_hammer'] == '1') {
                         $element_info['f'][] = 'Hammered';
                     }
                     if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_brush'] == '1') {
                         $element_info['f'][] = 'Brushed';
                     }
                     if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_oxid'] == '1') {
                         $element_info['f'][] = 'Oxidized/No Antitarnish';
                     }
                     if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_goldplate'] == '1') {
                         $element_info['f'][] = 'Yellow Goldplated';
                     }
                     if ($this->products[$product_key]['elements'][$element['elements_id']]['finishing_rosegoldplate'] == '1') {
                         $element_info['f'][] = 'Rose Goldplate';
                     }
                     $element_info['f'] = count($element_info['f']) > 0 ? implode(',', $element_info['f']) : '';
                     if ($element_image != '') {
                         $pdf->Image($element_image, $colpos + $col_subcol_imgepos, $rowpos, $col_subcol_width[2]);
                     }
                     $pdf->setXY($colpos, $rowpos);
                     $pdf->setFont('Arial', '', $fontsize_med);
                     $pdf->Cell($col_subcol_width[1], $colheight, $pue_number, 1, 0, 'C', true);
                     $pdf->Cell($col_subcol_width[2], $colheight, '', 1, 0, 'C');
                     $pdf->Cell($col_subcol_width[3], $colheight, $element['elements_id'], 1, 0, 'C');
                     $pdf->Cell($col_subcol_width[4], $colheight, '', 1, 0, 'C');
                     $pdf->Cell($col_subcol_width[5], 10, $product_qty * $element['quantity'], 1, 0, 'C');
                     $pdf->setXY($colpos + $col_subcol_width[1] + $col_subcol_width[2] + $col_subcol_width[3] + $col_subcol_width[4], $rowpos + 10);
                     $pdf->SetTextColor(209, 209, 209);
                     $pdf->setFont('Arial', 'B', $fontsize_big + 2);
                     $pdf->Cell($col_subcol_width[5], 10, 'QC', 1, 0, 'C');
                     $pdf->SetTextColor(0, 0, 0);
                     $pdf->setFont('Arial', '', $fontsize_med);
                     //$pdf->setXY($colpos + $col_subcol_infopos, $rowpos);
                     //$pdf->MultiCell($col_subcol_width[4], 4, implode("\n", $element_info), 0, 'C');
                     $rowpos_incol = $rowpos + 1;
                     //TODO: make column table could wrapped for text and have flexible height, for example please find this reference : http://www.fpdf.de/downloads/addons/3/
                     $ei_labels = array('s' => 'Size: ', 'm' => 'Material: ', 'h' => 'Shape: ');
                     foreach ($element_info as $key => $ei) {
                         if ($ei != '') {
                             if ($key == 'c') {
                                 $pdf->setFont('Arial', 'B', $fontsize_big + 2);
                                 $lineheight = 4;
                             } elseif ($key == 'f') {
                                 $pdf->setFont('Arial', 'B', $fontsize_big);
                                 $lineheight = 4;
                             } else {
                                 $pdf->setFont('Arial', '', $fontsize_med);
                                 $lineheight = 3.5;
                             }
                             if (array_key_exists($key, $ei_labels)) {
                                 $ei = $ei_labels[$key] . $ei;
                             }
                             $pdf->setXY($colpos + $col_subcol_infopos, $rowpos_incol);
                             $pdf->Cell($col_subcol_width[4], $lineheight, $ei, 0, 0, 'C');
                             $rowpos_incol += $lineheight;
                         }
                     }
                     if ($pue_rows > $max_rows_el_per_page) {
                         //IF ELEMENT USED MORE THAN MAX ROWS ELEMENT COULD FIT PER PAGE
                         $n_rows = $max_rows_el_per_page;
                     } else {
                         $n_rows = $pue_rows;
                     }
                     if ($pue_counter == $n_rows) {
                         $colpos = $margin + $colwidth + 5;
                         $rowpos = $YPOS;
                         $print_header_el = true;
                     } else {
                         $print_header_el = false;
                         $rowpos += $colheight;
                         if ($pue_counter % $max_rows_el_per_page == 0 && $pue_counter / $max_rows_el_per_page > 1) {
                             //IF ELEMENT USED REACH THE END OF PAGE AND THERE STILL ELEMENT NEED TO BE PRINTED
                             $pdf->AddPage();
                             if ($pdf->PageNo() > 1) {
                                 $max_rows_el_per_page = $max_rows_el_per_page_n;
                             }
                             //SET MARGIN TO THE VERY TOP OF PAGE
                             $colpos = $margin + 1;
                             $rowpos = $margin;
                             $YPOS = $rowpos;
                             $pue_rows = ceil(($pue_total - $pue_number) / 2);
                             //RECALCULATE THE REST OF ELEMENTS THAT COULD DIVIDED INTO 2 COLUMNS
                             $pue_counter = 0;
                         }
                     }
                 }
                 $YPOS += 5 + 3 + $pue_rows * $colheight;
             }
             //PRODUCT INFORMATION
             if ($pue_rows > 9) {
                 $pdf->AddPage();
                 $item_page_count++;
                 $YPOS = $margin;
             }
             $lineheight = 4;
             $imgbig_width = 60;
             $imgsml_width = 25;
             $rowpos = $YPOS;
             $colpos = $margin + 1;
             $pdf->SetXY($margin, $YPOS);
             $pdf->setFont('Arial', 'B', $fontsize_big);
             $pdf->Cell(100, $lineheight, 'Product Information');
             $YPOS += $lineheight + 1;
             $rowpos = $YPOS;
             $imgbig = $this->getImageForPDF($p['p']['products_image'], '', '212');
             //if($imgbig!='') $pdf->Image($imgbig, $colpos, $rowpos, $imgbig_width);
             if ($imgbig != '') {
                 $colposmainimage = $colpos;
                 $image_metadata = getimagesize($imgbig);
                 //MAKE IMAGE CENTERED WHEN SIZE IS PORTRAIT
                 if ($image_metadata[0] == 147) {
                     $colposmainimage = $colpos + 9;
                 }
                 $pdf->Image($imgbig, $colposmainimage, $rowpos, 0, $imgbig_width);
             }
             $pdf->Rect($colpos, $rowpos, $imgbig_width, $imgbig_width);
             $rowpos_main_image = $YPOS + $imgbig_width + 2;
             $rowpos = $YPOS;
             $img_h_resized = 0;
             //SHOW LOGO DIAMORE AND ELLI PREMIUM FOR NON OTTO B2B ORDERS
             if ($i['products_id'] > 0 && ($is_diamore || $is_elli_premium)) {
                 $pb = $class_pb->retrieveDetail($p['p']['products_brand_id']);
                 $img_path = DIR_WS_IMAGES . $pb['brand_image'];
                 $imgsize = getimagesize($img_path);
                 $img_w = $imgsize[0];
                 $img_h = $imgsize[1];
                 $h_ratio = $img_h / $img_w;
                 $img_w_resized = 50;
                 $img_h_resized = $img_w_resized * $h_ratio;
                 $pdf->Image($img_path, 150, $YPOS, $img_w_resized, $img_h_resized);
             }
             /*USE IMAGE DIAMOND
               if($class_pm->productContainMaterials($i['products_id'], 52)) {
                   $img_path = FPDF_IMGPATH.'diamond.jpg';
                   $imgsize = getimagesize($img_path);
                   $img_w = $imgsize[0];
                   $img_h = $imgsize[1];
                   $h_ratio = $img_h/$img_w;
                   $img_w_resized = 40;
                   $img_h_resized = $img_w_resized * $h_ratio;
                   $pdf->Image($img_path,165,$YPOS,$img_w_resized,$img_h_resized);
               }
                */
             if ($is_gold_product) {
                 $lineheight = 6;
                 $leftpos = 150;
                 $rowpos = $YPOS + $img_h_resized + 2;
                 $pdf->SetFontSize($fontsize_big + 5);
                 $pdf->SetXY($leftpos, $rowpos);
                 $pdf->Cell(50, $lineheight, 'G O L D', 0, 2, 'C');
             }
             //SPECIAL TREATMENT
             $product_finishing_array_st = ProductAttribute::getOldStylesFunction()->retrieveList(ProductAttribute::GROUP_ID_PRODUCT_FINISHING);
             $finishing_product_st = ProductAttribute::displayAttributeName($i['products_id'], ProductAttribute::GROUP_ID_PRODUCT_FINISHING, '2');
             //echo "<pre>";var_dump($finishing_product_st);die();
             if (empty($finishing_product_st)) {
                 unset($finishing_product_st);
             }
             if ($finishing_product_st == NULL) {
                 $isset_product_finishing = false;
             } else {
                 $isset_product_finishing = true;
             }
             if (!$is_diamore && !$is_elli_premium) {
                 if ($isset_product_finishing) {
                     $rowpos = $YPOS + $img_h_resized;
                     $lineheight = 6;
                     $leftpos = 150;
                     //special treament
                     $pdf->SetFontSize($fontsize_big + 3);
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->Cell(50, $lineheight, 'SPECIAL TREATMENT', 0, 2, 'C');
                     if ($i['products_id'] > 0 && ($is_gold_product || $is_pearl)) {
                         if ($is_gold_product) {
                             //gold
                             $rowpos = $rowpos + 7;
                             $pdf->SetFontSize($fontsize_big + 1);
                             $pdf->SetXY($leftpos, $rowpos);
                             $pdf->Cell(50, $lineheight, 'G O L D', 0, 2, 'C');
                         }
                         /*
                                                     if ($is_elli_premium) {
                            $products_used_materials = $class_pm->retrieveProductMaterialsUsed($i['products_id']);
                            if (in_array(52, $products_used_materials)) {
                                $rowpos = $rowpos + 5;
                                $pdf->SetFontSize($fontsize_big+1);
                                $pdf->SetXY($leftpos, $rowpos);
                                $pdf->Cell(50, $lineheight, 'D I A M O N D', 0, 2, 'C');
                            }
                            if (in_array(5, $products_used_materials)) {
                                $rowpos = $rowpos + 5;
                                $pdf->SetFontSize($fontsize_big+1);
                                $pdf->SetXY($leftpos, $rowpos);
                                $pdf->Cell(50, $lineheight, 'P E A R L', 0, 2, 'C');
                            }
                                                     }
                                                     if ($is_diamore) {
                            //diamore
                            $rowpos = $rowpos + 5;
                            $pdf->SetFontSize($fontsize_big+1);
                            $pdf->SetXY($leftpos, $rowpos);
                            $pdf->Cell(50, $lineheight, 'D I A M O N D', 0, 2, 'C');
                                                     }
                         * 
                         */
                         if ($is_pearl) {
                             //pearl
                             $rowpos = $rowpos + 5;
                             $pdf->SetFontSize($fontsize_big + 1);
                             $pdf->SetXY($leftpos, $rowpos);
                             $pdf->Cell(50, $lineheight, 'P E A R L', 0, 2, 'C');
                         }
                     }
                     //$pdf->Rect(150, 120, $img_w_resized, 30);
                 }
             }
             $leftpos = $colpos + $imgbig_width + 2;
             $rowpos = $YPOS;
             $lineheight = 4;
             $linesep = 1;
             $pilbl = array();
             $pinfo = array();
             $pilbl[] = 'Product Category';
             $pinfo[] = ': ' . $product_categories_name[$p['categories_id']];
             $pilbl[] = 'Product ID';
             $pinfo[] = ': ' . $i['products_id'];
             $pilbl[] = 'Product Code';
             $pinfo[] = ': ' . $p['p']['products_model'];
             /* HIDE PRICE (REQUESTED BY CANTY & WAYAN TO PREVENT SMITH SPOTTED THE PRICE)
                $pilbl[] = 'Product Price';
                $pinfo[] = ': '.displayCurrency('EUR', $p['p']['products_price']);
                 */
             if ($p['length'] > 0) {
                 $pilbl[] = 'Product Length';
                 $pinfo[] = ': ' . textLength($p['length']);
             }
             $pilbl[] = 'Product Quantity';
             $pinfo[] = ': ' . $product_qty;
             $lbl_width = 30;
             $pdf->SetXY($leftpos, $rowpos);
             $pdf->setFont('Arial', 'B', $fontsize_big);
             $pdf->MultiCell($lbl_width, $lineheight + $linesep, implode("\n", $pilbl), 0, 'L');
             $pdf->SetXY($leftpos + $lbl_width, $rowpos);
             $pdf->MultiCell($lbl_width, $lineheight + $linesep, implode("\n", $pinfo), 0, 'L');
             $rowpos += count($pilbl) * ($lineheight + $linesep) + 2 * $linesep;
             //                $pdf->SetXY($leftpos, $rowpos);
             //                $pdf->setFont('Arial','B',$fontsize_med);
             //                $prodinfo = 'Product ID: '.$p['p']['products_id'];
             //                $pdf->Cell(100, $lineheight, $prodinfo);
             //                $rowpos += $lineheight + $linesep;
             //                $pdf->SetXY($leftpos, $rowpos);
             //                $pdf->setFont('Arial','B',$fontsize_med);
             //                $prodinfo = 'Product Code: '.$p['p']['products_model'];
             //                $pdf->Cell(100, $lineheight, $prodinfo);
             //                $rowpos += $lineheight + $linesep;
             //                if($p['length']>0) {
             //                    $pdf->SetXY($leftpos, $rowpos);
             //                    $pdf->setFont('Arial','B',$fontsize_med);
             //                    $prodinfo = 'Product Length: '.textLength($p['length']);
             //                    $pdf->Cell(100, $lineheight, $prodinfo);
             //                    $rowpos += $lineheight + $linesep;
             //                }
             $pdf->SetXY($leftpos, $rowpos);
             $pdf->setFont('Arial', 'B', $fontsize_big);
             $pdf->Cell(100, $lineheight, 'Product Name:');
             $rowpos += $lineheight;
             $pdf->SetXY($leftpos, $rowpos);
             $pdf->setFont('Arial', '', $fontsize_big);
             $pdf->Cell(100, $lineheight, $p['pd'][2]['products_name']);
             $rowpos += $lineheight + 2 * $linesep;
             if ($p['pnc']['production_instruction_id'] != '') {
                 $rowpos += $lineheight;
                 $piids = explode(",", $p['pnc']['production_instruction_id']);
                 $pdf->SetXY($leftpos, $rowpos);
                 $pdf->setFont('Arial', 'B', $fontsize_big);
                 $pdf->Cell(100, $lineheight, 'Production Instruction:');
                 $pdf->setFont('Arial', '');
                 $pims = array();
                 //MERGE ALL MANUAL PI THAT ATTACHED TO PRODUCT
                 foreach ($piids as $piid) {
                     $pim = new production_instruction_manual($piid);
                     $pi_temp = "\n" . $pim->cat_name . ' - ' . $pim->name;
                     if (trim($pim->description) != '') {
                         $pi_temp .= "\n" . $pim->description;
                     }
                     $pims[] = $pi_temp;
                 }
                 //EXPLODE EACH MANUAL PI WITH LINE FEED
                 $pi_manual = implode("\n", $pims);
                 $rowpos += $lineheight;
                 $pdf->SetXY($leftpos, $rowpos);
                 $pdf->MultiCell(0, $lineheight, trim($pi_manual), 0, 'L');
                 $manpi_rows = explode("\n", trim($pi_manual));
                 //            $rowpos += $lineheight * 3;
             } else {
                 if ($p['pnc']['products_instruction'] != '') {
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->setFont('Arial', 'B', $fontsize_big);
                     $pdf->Cell(100, $lineheight, 'Production Instruction:');
                     $pdf->setFont('Arial', '');
                     $rowpos += $lineheight;
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->MultiCell(0, $lineheight, $p['pnc']['products_instruction'], 0, 'L');
                     $manpi_rows = explode("\n", $p['pnc']['products_instruction']);
                     //$rowpos += ceil(($lineheight-1)*count($manpi_rows));
                 }
             }
             $rowpos_manpi = $pdf->GetY();
             $rowpos = $rowpos_manpi + 5;
             $leftpos = $colpos + $imgbig_width + 2;
             $rowpos_addimage = 0;
             $nei = 0;
             if (strtoupper($o['type']) == 'JG' && $i['custom_img'] != '') {
                 //$imgcus_width = 37; //150px
                 $imgcus_width = $imgsml_width;
                 //100px
                 $imgcus = $this->getImageForPDF($i['custom_img'], '100', '100');
                 if ($imgcus != '') {
                     $pdf->Image($imgcus, $leftpos, $rowpos, $imgcus_width);
                     $pdf->Rect($leftpos, $rowpos, $imgcus_width, $imgcus_width);
                 }
                 $leftpos += $imgcus_width + 2;
                 //                } elseif((count($p['pei'])>0 && ($p['categories_id']==2||$p['categories_id']==3||$p['categories_id']==30)) || (count($p['pei'])>1 && $p['categories_id']==9)) {
                 //Show Extra Images only for NL,BL,SETS OR CH that have 2 extra images (only show 1st extra_images)
             } elseif (count($p['pei']) > 0) {
                 //                    show extra images for all categories since tends now extra images is used for explain detailly of a product
                 $rowpos = $YPOS + $imgbig_width + 2;
                 $pdf->SetXY($margin, $rowpos);
                 $pdf->setFont('Arial', 'B', $fontsize_big);
                 $pdf->Cell(100, $lineheight, 'Additional Images');
                 $rowpos += $lineheight + 1;
                 foreach ($p['pei'] as $pei) {
                     $nei++;
                     //                        if($p['categories_id']==9 && $nei>1) continue;    //display only 1st extra image for CH
                     $reset_leftpos = true;
                     if ($is_diamore) {
                         //IF DIAMORE PRODUCTS
                         $print_image = false;
                         if (($p['categories_id'] == 2 || $p['categories_id'] == 30) && in_array($nei, array(1, 3))) {
                             $print_image = true;
                         }
                         if ($p['categories_id'] == 4 && in_array($nei, array(2, 3))) {
                             $print_image = true;
                         }
                         if (($p['categories_id'] == 29 || $p['categories_id'] == 3) && in_array($nei, array(1, 2))) {
                             $print_image = true;
                         }
                         if (($p['categories_id'] == 9 || $p['categories_id'] == 28) && in_array($nei, array(1))) {
                             $print_image = true;
                         }
                         if ($print_image) {
                             $leftpos = $colpos;
                             if ($rowpos > 214) {
                                 $pdf->show_footer_page_info = true;
                                 $pdf->AddPage();
                                 $YPOS = $margin + 5;
                                 $rowpos = $YPOS;
                                 $rowpos_manpi = $YPOS;
                             }
                             $imgsml = $this->getImageForPDF($pei, '212', '212');
                             if ($imgsml != '') {
                                 $pdf->Image($imgsml, $leftpos, $rowpos, $imgbig_width);
                                 $pdf->Rect($leftpos, $rowpos, $imgbig_width, $imgbig_width);
                                 $rowpos += $imgbig_width + 2;
                             }
                         }
                     } else {
                         //IF NOT DIAMORE PRODUCTS
                         $check_nei = $nei % 2;
                         if ($check_nei == 1) {
                             if ($nei != 1) {
                                 $reset_leftpos = false;
                                 //print additional image using 2 columns when manual pi is exceeded bottom of main image
                                 if ($nei > 2 && $rowpos_manpi > $rowpos_main_image) {
                                     $rowpos += $imgsml_width + 2;
                                     $reset_leftpos = true;
                                 }
                             }
                         } else {
                             $reset_leftpos = false;
                         }
                         if ($reset_leftpos) {
                             $leftpos = $colpos;
                         } else {
                             $leftpos += $imgsml_width + 2;
                         }
                         $imgsml = $this->getImageForPDF($pei, '100', '100');
                         if ($imgsml != '') {
                             $pdf->Image($imgsml, $leftpos, $rowpos, $imgsml_width);
                             $pdf->Rect($leftpos, $rowpos, $imgsml_width, $imgsml_width);
                             //$rowpos += $imgsml_width + 2;
                         }
                     }
                 }
                 if ($is_diamore) {
                     //IF DIAMORE PRODUCTS
                     $rowpos_addimage = $rowpos + 2;
                 } else {
                     $rowpos_addimage = $rowpos + $imgsml_width + 2;
                     $leftpos += $imgsml_width + 2;
                 }
             }
             //CUSTOMIZE PRODUCTS & PRINTED GIFT VOUCHER FROM JULIE & GRACE
             if (strtoupper($o['type']) == 'JG') {
                 if (strpos($p['p']['products_model'], 'GIFT-P') !== false) {
                     $gift_amount = substr($p['p']['products_model'], 7);
                     $cgq_query = "SELECT c.coupon_code, c.coupon_amount, c.coupon_expire_date FROM coupon_gv_queue cgq";
                     $cgq_query .= " LEFT JOIN coupons c ON c.coupon_id=cgq.coupon_id";
                     $cgq_query .= " WHERE cgq.order_id={$o['id']} AND cgq.amount={$gift_amount}";
                     $cgq_result = tep_db_query($cgq_query);
                     $vouchers = array();
                     while ($row = tep_db_fetch_array($cgq_result)) {
                         $vouchers[] = $row;
                     }
                     $vcounter = 0;
                     foreach ($vouchers as $v) {
                         $vcounter++;
                         $pdf->SetXY($leftpos, $rowpos);
                         $pdf->setFont('Arial', 'B', $fontsize_med);
                         $pdf->Cell(100, $lineheight, 'Voucher ' . $vcounter . ':');
                         $rowpos += $lineheight;
                         $vilbl = array();
                         $vinfo = array();
                         $vilbl[] = '- Code';
                         $vinfo[] = ': ' . $v['coupon_code'];
                         $vilbl[] = '- Amount';
                         $vinfo[] = ': ' . number_format($v['coupon_amount'], 0) . ' EUR';
                         $vilbl[] = '- Expired Date';
                         $vinfo[] = ': ' . date('d. M Y', strtotime($v['coupon_expire_date']));
                         $pdf->setFont('Arial', '', $fontsize_med);
                         $pdf->SetXY($leftpos, $rowpos);
                         $pdf->MultiCell($lbl_width, $lineheight, implode("\n", $vilbl));
                         $pdf->SetXY($leftpos + $lbl_width, $rowpos);
                         $pdf->MultiCell(100, $lineheight, implode("\n", $vinfo));
                         $rowpos += count($vilbl) * $lineheight + 2 * $linesep;
                     }
                 }
                 if ($i['custom_text'] != '') {
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->setFont('Arial', 'B', $fontsize_big);
                     $pdf->Cell(100, $lineheight, 'Custom Text:');
                     $rowpos += $lineheight;
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->setFont('Arial', '', 12);
                     $pdf->MultiCell(0, 4, $i['custom_text']);
                     $rowpos += 2 * $lineheight + 2 * $linesep;
                 }
                 if ($i['custom_img'] != '') {
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->setFont('Arial', 'B', $fontsize_big);
                     $pdf->Cell(100, $lineheight, 'Custom Image:');
                     $rowpos += $lineheight;
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->setFont('Arial', '', $fontsize_big);
                     $pdf->Cell(0, $lineheight, basename($i['custom_img']));
                     $rowpos += $lineheight + 2 * $linesep;
                 }
                 if ($i['custom_imgcm'] != '') {
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->setFont('Arial', 'B', $fontsize_big);
                     $pdf->Cell(100, $lineheight, 'Custom Image Comment:');
                     $rowpos += $lineheight;
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->setFont('Arial', '', $fontsize_big);
                     $pdf->MultiCell(0, $lineheight, basename($i['custom_imgcm']), 0, 'L');
                 }
             } else {
                 if ($p['article']['text'] != '') {
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->setFont('Arial', 'B', $fontsize_big);
                     $pdf->Cell(100, $lineheight, 'Custom Text:');
                     $rowpos += $lineheight;
                     $pdf->SetXY($leftpos, $rowpos);
                     $pdf->setFont('Arial', '', 12);
                     $pdf->MultiCell(0, 4, $p['article']['text']);
                     $rowpos += 2 * $lineheight + 2 * $linesep;
                 }
             }
             //$YPOS += (($rowpos>($YPOS+$imgbig_width)) ? $rowpos : $imgbig_width) + 10;    //CHANGE THIS TO BELOW
             //if($rowpos>($YPOS+$imgbig_width)) $YPOS = $rowpos + 5;
             //else $YPOS += $imgbig_width + 10;
             if (in_array($p['p']['products_brand_id'], $DIAMOND_BRAND_IDS)) {
                 if ($rowpos_manpi > $rowpos_addimage) {
                     $YPOS = $rowpos_manpi + 5;
                 } elseif ($rowpos_addimage > $rowpos_manpi) {
                     $YPOS = $rowpos_addimage + 15;
                 }
                 //if manual pi printed smaller than displayed additional images
                 if ($rowpos_main_image > $rowpos_manpi && $nei == 0) {
                     $YPOS = $rowpos_main_image + 5;
                 }
                 //if manual pi printed smaller than displayed main images and theres no additional images printed
                 if ($rowpos_manpi == $rowpos_addimage) {
                     $YPOS = $rowpos_manpi;
                 }
                 //if manual pi printed and additional images were the same row height
             } else {
                 if ($rowpos_manpi > $rowpos_addimage) {
                     $YPOS = $rowpos_manpi + 5;
                 } elseif ($rowpos_addimage > $rowpos_manpi) {
                     $YPOS = $rowpos_addimage + 5;
                 }
                 //if manual pi printed smaller than displayed additional images
                 if ($rowpos_main_image > $rowpos_manpi && $nei == 0) {
                     $YPOS = $rowpos_main_image + 5;
                 }
                 //if manual pi printed smaller than displayed main images and theres no additional images printed
                 if ($rowpos_manpi == $rowpos_addimage) {
                     $YPOS = $rowpos_manpi;
                 }
                 //if manual pi printed and additional images were the same row height
             }
             //PRODUCTION
             if ($YPOS > 240) {
                 $pdf->show_footer_page_info = true;
                 $pdf->AddPage();
                 $YPOS = $margin + 5;
             }
             $lineheight = 5;
             $pdf->SetXY($margin, $YPOS);
             $pdf->setFont('Arial', 'B', $fontsize_big);
             $pdf->Cell(100, $lineheight, 'Production');
             $YPOS += $lineheight + 1;
             //IF NEED NEW QC COLUMN, ONLY NEED TO ADD BELOW ARRAY
             $col = array();
             $col[1] = 'Workshop';
             $col[2] = 'Beading';
             $col[3] = 'Enamel';
             $col[4] = 'Ferido';
             $col[5] = 'Packing';
             $leftpos = $margin + 1;
             $pdf->setXY($leftpos, $YPOS);
             $qc_table_max_width = 198;
             $colwidth = number_format($qc_table_max_width / count($col), 1);
             //$colwidth = 39.6;
             foreach ($col as $cval) {
                 $pdf->Cell($colwidth, $lineheight, $cval, 1, 0, 'C', true);
             }
             $YPOS += $lineheight;
             $leftpos = $margin + 1;
             $pdf->setFont('Arial', 'B', $fontsize_big + 5);
             $pdf->SetTextColor(209, 209, 209);
             $pdf->setXY($leftpos, $YPOS);
             for ($x = 1; $x <= count($col); $x++) {
                 $pdf->Cell($colwidth, 15, 'QC', 1, 0, 'C');
             }
             //PRODUCT FINISHING
             //echo "<pre>";var_dump($finishing);die();
             $finishing = array();
             /* UPDATE: NOW WE USE PRODUCTS FINISHING IN PRODUCT ATTRIBUTES TO 
                   FLAG WHETHER THE PRODUCTS NEEDS RHODIUM OR MICRON
                */
             /* RHODIUM RULES
                   Rule1: OttoB2B, Elli Premium which Silver "without plated" and whitegold product
                   Rule2: Diamore
                */
             /*
                             $rhodium_rule1 = ( ($is_ottob2b || $is_elli_premium) 
                    && ($obj_product->metal_stamp_code == Product::METAL_STAMP_CODE_925 
                        || $obj_product->metal_stamp_info == Product::METAL_STAMP_INFO_WHITEGOLD) );
                             $rhodium_rule2 = $is_diamore;
             */
             //$rhodium_and_micron_rule = in_array_r($finishing_product, $product_finishing_array);
             //if ($rhodium_rule1 || $rhodium_rule2) {
             //if ($rhodium_and_micron_rule) {
             //$finishing[] = 'Rhodium';
             //}
             $is_partial_plated = $p['p']['is_partial_plated'] == '1';
             $is_goldplated = false;
             foreach ($p['finishing'] as $ftext => $fval) {
                 if ($fval) {
                     $is_goldplated = $fval == 'Goldplated' || $fval == 'Rose Goldplate';
                     if ($is_partial_plated) {
                         if ($fval == 'Goldplated' || $fval == 'Rose Goldplate') {
                             continue;
                         }
                     }
                     //OttoB2B and Elli Premium goldplated products need to be added with 1.5 micron
                     /*
                     if (($is_ottob2b || $is_elli_premium) 
                             && ($fval == 'Goldplated' || $fval == 'Rose Goldplate')) {
                         $ftext .= ' 1.5 micron';
                     }
                     */
                     $finishing[] = $ftext;
                 }
             }
             if ($is_partial_plated) {
                 //OttoB2B and Elli Premium goldplated products need to be added with 1.5 micron
                 //if (($is_ottob2b || $is_elli_premium)
                 //$finishing_micron_key = array_search('micron', $finishing);
                 //if ($finishing_micron_key !== false
                 //&& ($fval == 'Goldplated' || $fval == 'Rose Goldplate')) {
                 //$finishing[] = 'Partial Plated 1.5 micron';
                 //} else {
                 $finishing[] = 'Partial Plated';
                 //}
             }
             $product_finishing_array = ProductAttribute::getOldStylesFunction()->retrieveList(ProductAttribute::GROUP_ID_PRODUCT_FINISHING);
             $finishing_product = ProductAttribute::displayAttributeName($i['products_id'], ProductAttribute::GROUP_ID_PRODUCT_FINISHING, '2');
             if (!empty($finishing_product)) {
                 $finishing[] = $finishing_product;
             }
             /*
             if ($is_goldplated || $is_partial_plated) {
                 //If using plating, removed finishing Rhodium since it will antitarnished as standard for plated products
                 $finishing_rhodium_key = array_search('Rhodium', $finishing);
                 if ($finishing_rhodium_key !== false) {
                     unset($finishing[$finishing_rhodium_key]);
                 }
             }
             */
             //echo "<pre>";var_dump($finishing);die();
             if (count($finishing) > 0) {
                 if ($YPOS > 250) {
                     $pdf->show_footer_page_info = true;
                     $pdf->AddPage();
                     $YPOS = $margin + 5;
                 }
                 $finishing = implode(', ', $finishing);
                 $pdf->SetTextColor(0, 0, 0);
                 $YPOS += $lineheight + 15;
                 $lineheight = 4;
                 $pdf->SetXY($margin, $YPOS);
                 $pdf->setFont('Arial', 'B', $fontsize_big);
                 $pdf->Cell(100, $lineheight, 'Product Finishing');
                 $YPOS += $lineheight + 1;
                 $lineheight = 15;
                 $colwidth = array();
                 $colwidth[1] = 178;
                 $colwidth[2] = 20;
                 $leftpos = $margin + 1;
                 $pdf->setXY($leftpos, $YPOS);
                 $pdf->setFont('Arial', 'B', $fontsize_big + 5);
                 $pdf->Cell($colwidth[1], $lineheight, $finishing, 1, 2, 'C');
                 $leftpos += $colwidth[1];
                 $pdf->setXY($leftpos, $YPOS);
                 $pdf->SetTextColor(209, 209, 209);
                 $pdf->Cell($colwidth[2], $lineheight, 'QC', 1, 2, 'C');
             }
             $pdf->SetTextColor(0, 0, 0);
             //PRODUCT GOLD WEIGHT CHECK (PGWC)
             if ($is_gold_product) {
                 if ($YPOS > 220) {
                     $pdf->show_footer_page_info = true;
                     $pdf->AddPage();
                     $YPOS = $margin + 5;
                 }
                 $YPOS += $lineheight + 15;
                 $lineheight = 5;
                 $pdf->SetXY($margin, $YPOS);
                 $pdf->setFont('Arial', 'B', $fontsize_big);
                 $pdf->Cell(100, $lineheight, 'Product Gold Weight Check');
                 $YPOS += $lineheight + 1;
                 $gold_weight_check_process = array();
                 $gold_weight_check_process["Safe-WH"] = 'Safe to WH';
                 $gold_weight_check_process["WH-QC"] = 'WH to QC';
                 $gold_weight_check_process["QC-GS"] = 'QC to Goldsmith';
                 $gold_weight_check_process["GS-QC"] = 'Goldsmith to QC';
                 $leftpos = $margin + 1;
                 $pdf->SetXY($leftpos, $YPOS);
                 $gwc_table_max_width = $qc_table_max_width;
                 $n_col_weight_check = 8;
                 $colwidth = number_format($gwc_table_max_width / $n_col_weight_check, 1);
                 foreach ($gold_weight_check_process as $key => $val) {
                     if ($key == "QC-GS" || $key == "GS-QC") {
                         $pdf->Cell($colwidth * 3, $lineheight, $val, 1, 0, 'C', true);
                     } else {
                         $pdf->Cell($colwidth, $lineheight, $val, 1, 0, 'C', true);
                     }
                 }
                 //Draw PGWC Total Weight Box
                 $YPOS += $lineheight;
                 $leftpos = $margin + 1;
                 $pdf->setFont('Arial', 'B', $fontsize_sml);
                 $pdf->SetTextColor(209, 209, 209);
                 $pdf->SetXY($leftpos, $YPOS);
                 $gw_colheight_big = 10;
                 $gw_colheight_sml = number_format($gw_colheight_big / 2, 1);
                 for ($x = 1; $x <= $n_col_weight_check; $x++) {
                     if ($x == 1) {
                         $pdf->Cell($colwidth, $gw_colheight_sml, 'GW:', 1, 2, 'L');
                         $pdf->SetX($leftpos);
                         $pdf->Cell($colwidth, $gw_colheight_sml, 'NW:', 1, 0, 'L');
                     } else {
                         if ($x == 2) {
                             $pdf->SetXY($leftpos + $colwidth, $YPOS);
                         }
                         $box_start = $x == $n_col_weight_check ? 2 : 0;
                         $pdf->Cell($colwidth, $gw_colheight_sml, "Total Weight", 'LR', $box_start, 'C');
                     }
                 }
                 $pdf->SetX($leftpos + $colwidth);
                 for ($x = 2; $x <= $n_col_weight_check; $x++) {
                     $box_start = $x == $n_col_weight_check ? 2 : 0;
                     $pdf->Cell($colwidth, $gw_colheight_sml, '', 'LR', $box_start, 'C');
                 }
                 //Draw PGWC Total Signature Box
                 $colwidth_signature = number_format($colwidth / 2, 1);
                 $pdf->SetX($leftpos);
                 $pdf->SetFontSize($fontsize_med);
                 foreach ($gold_weight_check_process as $key => $val) {
                     if ($key == "QC-GS" || $key == "GS-QC") {
                         $loop = 3;
                     } else {
                         $loop = 1;
                     }
                     list($lsign, $rsign) = explode("-", $key);
                     for ($x = 1; $x <= $loop; $x++) {
                         $pdf->Cell($colwidth_signature, $gw_colheight_big, $lsign, 1, 0, 'C');
                         $pdf->Cell($colwidth_signature, $gw_colheight_big, $rsign, 1, 0, 'C');
                     }
                 }
                 $YPOS += $lineheight - 2 + $gw_colheight_big * 2;
                 $pdf->setFont('Arial', '', $fontsize_sml);
                 $pdf->Text($leftpos, $YPOS, 'GW: Total Weight of Gold Elements');
                 $YPOS += $lineheight - 2;
                 $pdf->Text($leftpos, $YPOS, 'NW: Total Weight of Non-Gold Elements');
                 //Draw PGWC Dust Box
                 if ($YPOS > 250) {
                     $pdf->show_footer_page_info = true;
                     $pdf->AddPage();
                     $YPOS = $margin + 5;
                 }
                 $YPOS += $lineheight;
                 $pdf->SetXY($leftpos, $YPOS);
                 $pdf->setFont('Arial', 'B', $fontsize_big);
                 $pdf->SetTextColor(0, 0, 0);
                 $pdf->Cell($colwidth, $lineheight, 'Dust', 1, 2, 'C', true);
                 $pdf->SetFontSize($fontsize_sml);
                 $pdf->SetTextColor(209, 209, 209);
                 $pdf->Cell($colwidth, $gw_colheight_sml, 'Total Weight', 'LR', 2, 'C');
                 $pdf->Cell($colwidth, $gw_colheight_sml, '', 'LR', 2, 'C');
                 $pdf->Cell($colwidth_signature, $gw_colheight_big, 'QC', 1, 0, 'C');
                 $pdf->Cell($colwidth_signature, $gw_colheight_big, 'GS', 1, 0, 'C');
             }
             $pdf->SetTextColor(0, 0, 0);
             //ENGRAVING ORDER SLIP
             global $ENGRAVED_PRODUCTS;
             if (strtoupper($o['type']) == 'JG' && in_array($i['products_id'], $ENGRAVED_PRODUCTS)) {
                 if ($this->duplex_printing && $item_page_count % 2 != 0) {
                     $pdf->AddPage();
                     $item_page_count++;
                 }
                 $pdf->AddPage();
                 $item_page_count++;
                 $lineheight = 4;
                 $midpage = 148.5;
                 $rowpos = $margin + 10;
                 //repeat 2 times
                 for ($s = 1; $s <= 2; $s++) {
                     if ($s == 2) {
                         $rowpos = $midpage + 10;
                         $slipinfo = 'Face2Face';
                     } else {
                         $slipinfo = 'Bonofactum';
                     }
                     $colpos = $margin + 1;
                     $pdf->OrderBarcode($o['type'], $oiid, $barcode_pos, $rowpos, $barcode_width);
                     $pdf->SetXY($margin, $rowpos);
                     $pdf->setFont('Arial', 'B', '12');
                     $pdf->Cell(100, $lineheight, 'Engraving Order Slip (' . $slipinfo . ')');
                     $rowpos += $lineheight + 5;
                     $rowpos_fixed = $rowpos;
                     if ($imgbig != '') {
                         $pdf->Image($imgbig, $colpos, $rowpos, $imgbig_width);
                     }
                     $pdf->Rect($colpos, $rowpos, $imgbig_width, $imgbig_width);
                     $colpos += $imgbig_width + 5;
                     $es_ilbl_width = 30;
                     $es_ilbl = array();
                     $es_info = array();
                     $es_ilbl[] = 'Order By';
                     $es_info[] = ': Bonofactum';
                     $es_ilbl[] = 'Order Date';
                     $es_info[] = ': ' . date('d. M Y');
                     $es_ilbl[] = 'Order Quantity';
                     $es_info[] = ': ' . $product_qty;
                     $pdf->setFont('Arial', 'B', $fontsize_med);
                     $pdf->SetXY($colpos, $rowpos);
                     $pdf->MultiCell($es_ilbl_width, $lineheight, implode("\n", $es_ilbl));
                     $pdf->SetXY($colpos + $es_ilbl_width, $rowpos);
                     $pdf->MultiCell($es_ilbl_width * 2, $lineheight, implode("\n", $es_info));
                     $rowpos += (count($es_ilbl) + 1) * $lineheight + 1;
                     $pdf->SetXY($colpos, $rowpos);
                     $pdf->Cell(100, $lineheight, 'Custom Text');
                     $rowpos += $lineheight + 1;
                     $pdf->SetDrawColor(128, 128, 128);
                     $pdf->Rect($colpos + 1, $rowpos, 132, 30);
                     $pdf->SetDrawColor(0, 0, 0);
                     if ($i['custom_text'] != '') {
                         $pdf->SetXY($colpos + 3, $rowpos + 3);
                         $pdf->setFont('Arial', 'B', '12');
                         $pdf->MultiCell(100, $lineheight, $i['custom_text']);
                     }
                     $rowpos = $rowpos_fixed + $imgbig_width + 5;
                     if ($i['custom_img'] != '') {
                         $leftpos = $margin + 1;
                         if ($imgcus != '') {
                             $pdf->Image($imgcus, $leftpos, $rowpos, $imgcus_width);
                             $pdf->Rect($leftpos, $rowpos, $imgcus_width, $imgcus_width);
                         }
                         $leftpos += $imgcus_width + 2;
                         $pdf->setXY($leftpos, $rowpos);
                         $pdf->setFont('Arial', 'B', $fontsize_med);
                         $pdf->Cell(100, $lineheight, 'Custom Image:');
                         $rowpos += $lineheight;
                         $pdf->setXY($leftpos, $rowpos);
                         $pdf->setFont('Arial', '', $fontsize_med);
                         $pdf->Cell(100, $lineheight, basename($i['custom_img']));
                         $rowpos += $lineheight + 1;
                         $pdf->setXY($leftpos, $rowpos);
                         $pdf->setFont('Arial', 'B', $fontsize_med);
                         $pdf->Cell(100, $lineheight, 'Graving Request:');
                         $rowpos += $lineheight;
                         $engraving_options_pos = $leftpos + $lineheight + 1;
                         $engraving_options = array();
                         $engraving_options[] = 'Full (gravir penuh)';
                         $engraving_options[] = 'Centered (gravir tengah, atas dan bawah kosong)';
                         $engraving_options[] = 'Bottom (gravir bawah penuh, atas kosong)';
                         $pdf->setXY($engraving_options_pos, $rowpos);
                         $pdf->setFont('Arial', '', $fontsize_med);
                         $pdf->MultiCell(100, $lineheight, implode("\n", $engraving_options));
                         $cb_sep = 0.5;
                         $cbsize = $lineheight - $cb_sep;
                         $leftpos += 1;
                         $pdf->SetDrawColor(128, 128, 128);
                         foreach ($engraving_options as $eo) {
                             $pdf->Rect($leftpos, $rowpos, $cbsize, $cbsize);
                             $rowpos += $lineheight;
                         }
                         $pdf->SetDrawColor(0, 0, 0);
                     }
                 }
                 $pdf->Line($margin, $midpage, 210 - $margin, $midpage);
             }
             if ($i['print_count'] == '0' || $i['print_count'] == '') {
                 $this->qty_total_first_printed++;
             }
         }
         //end looping items
     }
     //end looping orders
     if ($output == 'F') {
         $filename = $this->filename != '' ? $this->filename : DIR_FS_MINIERP . DIR_WS_GATEWAY . "ready_orders/" . strtoupper($o['type']) . '/' . strtoupper($o['type']) . '-' . $oiid;
         //            $priority_rule_1 = in_array($o['jng_sp_id'], $sp_using_red_paper);
         //            $priority_rule_2 = $o['customer_is_vip'];
         $priority_rule_1 = $o['priority'] == '1';
         //            if($priority_rule_1 || $priority_rule_2 || $priority_rule_3) $filename .= '-RED';
         if ($priority_rule_1 && $this->filename == '') {
             $filename .= '-RED';
         }
         $pdf->Output($filename . '.pdf', $output);
     }
 }
Esempio n. 29
0
            $code .= $codes['C'][$barcode[$i]];
        }
        $code .= '101';
        //Draw bars
        for ($i = 0; $i < strlen($code); $i++) {
            if ($code[$i] == '1') {
                $this->Rect($x + $i * $w, $y, $w, $h, 'F');
            }
        }
        //Print text uder barcode
        $this->SetFont('Arial', '', 5);
        $this->Text($x + 7, $y + $h + 6 / $this->k, substr($barcode, -$len));
    }
}
$pdf = new PDF();
define('EURO', $simbolomoneda);
$pdf = new PDF(P, mm, array(29, 25));
$pdf->Open();
$pdf->AddPage();
$pdf->SetFont('Arial', '', 5);
$pdf->Text(2, 3, $descripcion);
$pdf->EAN13(1, 4, $codigobarras);
/* por el momento no necesito que la etiqueta de código de barras muestre el precio o la referencia del producto.
  
$pdf->SetFont('Arial','',7);
$pdf->Text(1,19,"Ref.: ".$referencia);  
$pdf->SetFont('Arial','',9);    
$pdf->Text(1,23,"PVP: ".$precio." ".EURO);

*/
$pdf->Output();
Esempio n. 30
0
//Disable automatic page break
$pdf->SetAutoPageBreak(false);
//Add first page
$pdf->AddPage('L', array(85.59999999999999, 54));
#$pdf->AddPage('L',array(215.9,355.6));
//print column titles for the actual page
$row = mysql_fetch_array($result = mysql_query("select Nombre,apellidop,apellidom,fechanac,domicilio,claveelector,curp,numero from crede where folio='" . $id . "'"));
$Nombre = utf8_decode($row['Nombre']);
$ApellidoP = utf8_decode($row['apellidop']);
$ApellidoM = utf8_decode($row['apellidom']);
$Domicilio = utf8_decode($row['domicilio']);
$numero = utf8_decode($row['numero']);
$curp = utf8_decode($row['curp']);
$NombreCompleto = $Nombre . " " . $ApellidoP . " " . $ApellidoM;
$pdf->SetFont('Arial', '', 9);
$pdf->Text(18, 45, $NombreCompleto);
$pdf->Text(18, 51, $Domicilio . " " . $numero);
$conca = substr($id, 2, 4);
#	$conca=$id.$parte;
$totalCaracteres = strlen($conca);
$fontSize = 7;
$marge = 0.7;
// between barcode and hri in pixel
$x = 56.2;
// barcode center
$y = 35.5;
// barcode center
$height = 6.0;
// barcode height in 1D ; module size in 2D
$width = 0.5;
// barcode height in 1D ; not use in 2D