Exemple #1
0
 /**
  * PDF line renderer
  *
  * @param PDF $pdf
  *
  * @return void
  */
 function render($pdf)
 {
     if ($this->x1 == ".") {
         $this->x1 = $pdf->GetX();
     }
     if ($this->y1 == ".") {
         $this->y1 = $pdf->GetY();
     }
     if ($this->x2 == ".") {
         $this->x2 = $pdf->getMaxLineWidth();
     }
     if ($this->y2 == ".") {
         $this->y2 = $pdf->GetY();
     }
     if ($pdf->getRTL()) {
         $pdf->Line($pdf->getPageWidth() - $this->x1, $this->y1, $pdf->getPageWidth() - $this->x2, $this->y2);
     } else {
         $pdf->Line($this->x1, $this->y1, $this->x2, $this->y2);
     }
 }
$pdf->SetTextColor(0);
//$temp = str_replace(' ', ' ', PRINT_INVOICE_ORDERNR);
$pdf->Text(20, 95, PRINT_INVOICE_HEADING);
// Rechnungsdatum
$temp = str_replace(' ', ' ', PRINT_INVOICE_DATE);
$pdf->Text(165, 95, $temp . tep_date_short($order->info['date_purchased']));
// Fälligkeitsdatum
//$temp2 = str_replace(' ', ' ', ENTRY_INVOICE_DATE_ZAHLBAR);
//$pdf->Text(171,99,$temp2 . tep_date_short_add($order->info['date_purchased'], 'day' , ZAHLUNGSFAELLIGKEIT));
// Falzmarke
$pdf->SetY(105);
$pdf->SetX(20);
$x = 10;
$y = $pdf->GetY();
$pdf->SetLineWidth(0.25);
$pdf->Line($x, $y, $this->w - $this->rMargin, $y);
// Rechnungstext 1
$pdf->SetFont('Arial', '', 8);
$pdf->SetTextColor(0);
$pdf->SetY(100);
$pdf->Cell(15);
$text['edit_invoice_text'] = str_replace("<br>", '', $text['edit_invoice_text']);
$pdf->MultiCell(200, 4, $text['edit_invoice_text'], 0, 'L');
$pdf->SetFont('Arial', 'B', 8);
$pdf->SetTextColor(0);
// Auftragsnummer
$temp = str_replace('&nbsp;', ' ', ENTRY_INVOICE_AUFTRAG_ID);
$pdf->Text(20, 120, $temp . tep_db_input($oID));
// Kundenummer
$temp = str_replace('&nbsp;', ' ', ENTRY_INVOICE_COSTUMER_ID);
$pdf->Text(165, 120, $temp . $the_customers_id);
Exemple #3
0
}
$nombre = "<b>Descripción del reporte</b>";
$img = "imagenes/log.jpg";
//Antes de pasar los datos al PDF, hay que pasar las variables por la función html_entity_decode para decodificar los caracteres especiales, los acentos y las ñ
// Siempre y cuando los datos extraídos de la BD sean UTF8 (no lo probe con otra codificación)
$nombre = html_entity_decode($nombre);
$descripcion = html_entity_decode($descripcion);
//Creamos una nueva instancia de la clase
$pdf = new PDF();
//Añádimos la primera página
$pdf->AddPage();
$pdf->Image('log.jpg', 8, 8, 30);
$pdf->Ln(12);
$pdf->SetFont('Helvetica', '', 20);
//$pdf->Ln(12);
$pdf->Line(10, 30, 200, 30);
$pdf->SetFontSize(17);
$pdf->SetTextColor(44, 62, 80);
$pdf->WriteHTML("Online Computer Shop");
$pdf->SetTextColor(0);
$pdf->SetLeftMargin(155);
$pdf->SetFontSize(14);
$pdf->Ln(-15);
$pdf->WriteHTML("<br><br><b>Fecha:</b> " . date("d/m/Y", time() - 25200));
$pdf->WriteHTML("<br><b>Hora:</b> " . date("H:i:s", time() - 25200) . "\n\n");
$pdf->SetLeftMargin(10);
$pdf->Ln(14);
// Otra parte importante, luego de pasar las variables por la función html_entity_decode, para que se vean bien los acentos y las ñ, hay que pasarlas por otra
// función que es utf8_decode
$pdf->SetFontSize(14);
$pdf->WriteHTML(utf8_decode($nombre));
$pdf->Ln(4);
$pdf->Cell(0, 0, utf8_decode('- Judiciales:'), 0, 0, 'L', false);
//descuento por reposo
$pdf->text(80, 94, "Gs: ");
$pdf->text(90, 94, number_format($Judicial), 0, '', '.');
$pdf->Ln(4);
$pdf->Cell(0, 0, utf8_decode('- Otros Descuentos:'), 0, 0, 'L', false);
//descuentos Judiciales esto es otros descuentos
$pdf->text(80, 98, "Gs: ");
$pdf->text(90, 98, number_format($Odescuentos), 0, '', '.');
$pdf->Ln(4);
$pdf->Cell(0, 0, utf8_decode('- Total Descuentos:'), 0, 0, 'L', false);
//aqui si fijamos el descuento de judiciales..
$pdf->text(152, 102, 'Gs:');
$pdf->text(158, 102, number_format($IPS + $Ausencia + $Permiso + $ASO + $Reposo + $Judicial + $Odescuentos), 0, '', '.');
$pdf->Line(158, 103, 177, 103);
$pdf->Ln(4);
$pdf->Cell(0, 0, utf8_decode('Saldo a Cobrar:'), 0, 0, 'L', false);
//salario a cobrar
$pdf->Ln(4);
$pdf->Cell(0, 0, utf8_decode('Son:'), 0, 0, 'L', false);
$pdf->text(20, 110, convertirMonto((int) $Neto));
$pdf->text(152, 110, 'Gs:');
$pdf->text(158, 110, number_format($Neto), 0, '', '.');
$pdf->Line(158, 111, 177, 111);
$pdf->Line(158, 112, 177, 112);
//Table header
/*$pdf->Cell(20,10,'SIAPE',1,0,'L',1);
$pdf->Cell(50,10,'Nome',1,1,'L',1);*/
$pdf->Output();
$pdf->Close();
$pdf->SetY(167);
$pdf->SetX(280);
$pdf->Cell(25, 5, '100', 0, 0, 'L');
$pdf->SetY(167);
$pdf->SetX(290);
$pdf->Cell(25, 5, '105', 0, 0, 'L');
$pdf->SetY(167);
$pdf->SetX(300);
$pdf->Cell(25, 5, '110', 0, 0, 'L');
$pdf->SetY(180);
$pdf->SetX(80);
$pdf->Cell(25, 5, '1:200,000', 0, 0, 'L');
if ($graphtax1 > 0) {
    $pdf->SetLineWidth(2);
    $pdf->SetDrawColor(255, 0, 0);
    $pdf->Line(80, 70, 80 + $graphtax1, 70);
}
$pdf->SetY(67);
$pdf->SetX(80 + $graphtax1 + 3);
$pdf->Cell(25, 5, 'Year ' . $dateprev . ' (' . number_format($sumtax1[0], 2) . ')', 0, 0, 'L');
if ($graphtax2 > 0) {
    $pdf->SetLineWidth(2);
    $pdf->SetDrawColor(255, 100, 0);
    $pdf->Line(80, 75, 80 + $graphtax2, 75);
}
$pdf->SetY(72);
$pdf->SetX(80 + $graphtax2 + 3);
$pdf->Cell(25, 5, 'Year ' . $datenext . ' (' . number_format($sumtax2[0], 2) . ')', 0, 0, 'L');
if ($graphfee1 > 0) {
    $pdf->SetLineWidth(2);
    $pdf->SetDrawColor(0, 255, 0);
Exemple #6
0
        $oList_sub = mysql_query("select * from m_iku_sub WHERE ta = '{$th}' and kdunitkerja = '480000' and no_iku = '{$row['no_iku']}' order by no_iku_sub");
        while ($row_sub = mysql_fetch_array($oList_sub)) {
            $iku_sub = $iku_sub . nmalfa($row_sub['no_iku_sub']) . '. ' . $row_sub['nm_iku_sub'] . "\n";
        }
        $arrIku = $pdf->SplitToArray($w1[2], $ln, trim($iku_sub));
    } else {
        $arrIku = $pdf->SplitToArray($w1[2], $ln, '[IKU ' . $row['no_iku'] . '] ' . trim($row['nm_iku']));
    }
    if ($max < count($arrSasaran)) {
        $max = count($arrSasaran);
    }
    if ($max < count($arrIku)) {
        $max = count($arrIku);
    }
    if ($kd_sasaran != $row['no_sasaran']) {
        $pdf->Line($margin, $pdf->GetY(), $margin + $w1[0] + $w1[1] + $w1[2], $pdf->GetY());
    }
    if ($kd_sasaran == $row['no_sasaran']) {
        $pdf->Line($margin + $w1[0] + $w1[1], $pdf->GetY(), $margin + $w1[0] + $w1[1] + $w1[2], $pdf->GetY());
    }
    $kd_sasaran = $row['no_sasaran'];
    for ($i = 0; $i < $max; $i++) {
        $pdf->SetX($margin + $w1[0]);
        $pdf->Cell($w1[1], $ln, $arrSasaran[$i], 'LR', 0, 'L');
        $pdf->SetX($margin + $w1[0] + $w1[1]);
        $pdf->Cell($w1[2], $ln, $arrIku[$i], 'LR', 1, 'L');
    }
}
$pdf->Line($margin, $pdf->GetY(), $margin + $w1[0] + $w1[1] + $w1[2], $pdf->GetY());
$pdf->SetDisplayMode('real');
$pdf->Output('doc.pdf', 'I');
        }
    }
}
$pdf->Write(5, $identity . "Nummer: " . $bookdata[passport]);
$pdf->SetXY(100, 100);
$pdf->Write(5, $bookdata[agency] . ", " . $bookdata[issue_date]);
$pdf->SetXY(100, 105);
$pdf->Write(5, $bookdata[zip] . " " . $bookdata[city]);
$pdf->SetXY(100, 110);
$pdf->Write(5, $bookdata[street]);
$pdf->SetXY(100, 115);
$pdf->Write(5, $bookdata[country]);
$pdf->SetXY(100, 120);
$pdf->Write(5, $bookdata[children]);
// Table
$pdf->Line(10, 60, 190, 60);
$pdf->Line(10, 65, 190, 65);
$pdf->Line(10, 70, 190, 70);
$pdf->Line(10, 75, 190, 75);
$pdf->Line(10, 80, 190, 80);
$pdf->Line(10, 85, 190, 85);
$pdf->Line(10, 90, 190, 90);
$pdf->Line(10, 95, 190, 95);
$pdf->Line(10, 100, 190, 100);
$pdf->Line(10, 105, 190, 105);
$pdf->Line(10, 110, 190, 110);
$pdf->Line(10, 115, 190, 115);
$pdf->Line(10, 120, 190, 120);
$pdf->Line(10, 125, 190, 125);
$pdf->Line(100, 60, 100, 125);
// signs
function home__memberlist_printview()
{
    global $base_url, $files_dir, $config;
    // $content='<html><head><meta http-equiv="Content-Type" content="application/pdf; charset=utf-8" />';
    // drupal_add_css(BOOTSTRAP.'/css/bootstrap.min.css');
    // drupal_add_css(CHURCHDB.'/cdb_printview.css');
    // $content=$content.drupal_get_header();
    if (!user_access("view memberliste", "churchdb")) {
        addErrorMessage(t("no.permission.for", t("list.of.members")));
        return " ";
    }
    require_once ASSETS . '/fpdf17/fpdf.php';
    $compact = true;
    if (isset($_GET["compact"])) {
        $compact = $_GET["compact"];
    }
    // Instanciation of inherited class
    $pdf = new PDF('P', 'mm', 'A4');
    $pdf->AliasNbPages();
    $pdf->AddPage();
    $pdf->SetFont('Arial', '', 9);
    $res = home_getMemberList();
    $pdf->SetLineWidth(0.4);
    $pdf->SetDrawColor(200, 200, 200);
    $fields = _home__memberlist_getSettingFields()->fields;
    foreach ($res as $p) {
        $pdf->Line(8, $pdf->GetY() - 1, 204, $pdf->GetY() - 1);
        $pdf->Cell(10, 10, "", 0);
        if ($p->imageurl == null || !file_exists("{$files_dir}/fotos/{$p->imageurl}")) {
            $p->imageurl = "nobody.gif";
        }
        $pdf->Image("{$files_dir}/fotos/{$p->imageurl}", $pdf->GetX() - 10, $pdf->GetY() + 1, 9);
        $pdf->Cell(2);
        $pdf->Cell(13, 9, $p->anrede, 0, 0, 'L');
        $pdf->Cell(48, 9, utf8_decode("{$p->name}, {$p->vorname}"), 0, 0, 'L');
        $pdf->Cell(45, 9, utf8_decode("{$p->strasse}"), 0, 0, 'L');
        // TODO: second occurence of code part - whats this for?
        $birthday = "";
        if ($p->geburtsdatum != null) {
            if ($p->year < 7000) {
                $birthday = "{$p->day}.{$p->month}.";
            }
            if ($p->year != 1004 && $fields["memberlist_birthday_full"]->getValue()) {
                if ($p->year < 7000) {
                    $birthday = $birthday . $p->year;
                } else {
                    $birthday = $birthday . $p->year - 7000;
                }
            }
        }
        $pdf->Cell(20, 9, $birthday, 0, 0, 'L');
        if ($fields["memberlist_telefonprivat"]->getValue() && $p->telefonprivat != "") {
            $pdf->Cell(30, 9, $p->telefonprivat, 0, 0, 'L');
        } else {
            if ($fields["memberlist_telefongeschaeftlich"]->getValue() && $p->telefongeschaeftlich != "") {
                $pdf->Cell(30, 9, $p->telefongeschaeftlich, 0, 0, 'L');
            } else {
                if ($fields["memberlist_telefongeschaeftlich"]->getValue() && $p->fax != "") {
                    $pdf->Cell(30, 9, $p->fax . " (Fax)", 0, 0, 'L');
                } else {
                    $pdf->Cell(30, 9, "", 0, 0, 'L');
                }
            }
        }
        if ($fields["memberlist_telefonhandy"]->getValue() && $p->telefonhandy != "") {
            $pdf->Cell(30, 9, $p->telefonhandy, 0, 0, 'L');
        }
        // Zeilenumbruch
        $pdf->Ln(5);
        $pdf->Cell(73);
        $pdf->Cell(48, 10, "{$p->plz} " . utf8_decode($p->ort), 0, 0, 'L');
        $pdf->Cell(17);
        if ($fields["memberlist_email"]->getValue() && $p->email != "") {
            $pdf->SetFont('Arial', '', 8);
            $pdf->Cell(30, 9, $p->email);
            $pdf->SetFont('Arial', '', 9);
        }
        $pdf->Ln(12);
    }
    $pdf->Output(t("list.of.members") . '.pdf', 'I');
}
$dOrderJum = mysql_fetch_assoc($nOrderJum);
$pdf = new PDF('P', 'mm', 'A4');
$pdf->AddPage();
$pdf->Ln();
$path = 'images/logo.jpg';
$pdf->Image($path, 15, 3, 20);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetY(10);
$pdf->Cell(190, 5, 'Daftar Perbandingan Harga', 0, 1, 'C');
$pdf->Ln();
$pdf->SetFont('Arial', 'B', 8);
$pdf->Cell(190, 5, $nodph, 0, 0, 'C');
$pdf->SetX(180);
$pdf->Cell(1, 5, 'Date : ' . tanggalnormal($dOrder['tanggal']), 0, 1, 'L');
$pdf->Ln();
$pdf->Line(10, 30, 200, 30);
$pdf->SetFont('Arial', '', 7);
$pdf->Ln();
$pdf->Cell(15, 5, 'Nama PT.', 0, 0, 'L');
$pdf->Cell(10, 5, ':', 0, 0, 'C');
$pdf->Cell(80, 5, $nmOrg[$kdPt[$dOrder['nopp']]], 0, 0, 'L');
$pdf->Cell(15, 5, 'Dept', 0, 0, 'L');
$pdf->Cell(10, 5, ':', 0, 0, 'C');
$pdf->Cell(10, 5, $nmOrg[substr($dOrder['nopp'], 15, 4)], 0, 1, 'L');
$pdf->Cell(15, 5, 'No.PP.', 0, 0, 'L');
$pdf->Cell(10, 5, ':', 0, 0, 'C');
$pdf->Cell(80, 5, $dOrder['nopp'], 0, 0, 'L');
$pdf->Cell(15, 5, 'Qty', 0, 0, 'L');
$pdf->Cell(10, 5, ':', 0, 0, 'C');
$pdf->Cell(10, 5, $dOrderJum['jumlah'], 0, 1, 'L');
$pdf->Cell(15, 5, '', 0, 0, 'L');
$arrPaguDipa = $pdf->SplitToArray($w[2], $ln, number_format($row['jml_anggaran_dipa'], "0", ",", "."));
$arrPaguIni = $pdf->SplitToArray($w[3], $ln, number_format($row['jml_anggaran_indikatif'], "0", ",", "."));
if ($max < count($arrUraian)) {
    $max = count($arrUraian);
}
for ($i = 0; $i < $max; $i++) {
    $pdf->SetX($margin);
    $pdf->Cell($w[0], $ln, $arrKode[$i], 'LR', 0, 'C');
    $pdf->SetX($margin + $w[0]);
    $pdf->Cell($w[1], $ln, $arrUraian[$i], 'LR', 0, 'L');
    $pdf->SetX($margin + $w[0] + $w[1]);
    $pdf->Cell($w[2], $ln, $arrPaguDipa[$i], 'LR', 0, 'R');
    $pdf->SetX($margin + $w[0] + $w[1] + $w[2]);
    $pdf->Cell($w[3], $ln, $arrPaguIni[$i], 'LR', 1, 'R');
}
$pdf->Line($margin, $pdf->GetY(), $margin + $w[0] + $w[1] + $w[2] + $w[3], $pdf->GetY());
switch ($xlevel) {
    case '1':
        $sql = "SELECT kddept,kdunit,kdprogram, SUM(jml_anggaran_renstra) as jml_anggaran_renstra, SUM(jml_anggaran_dipa) as jml_anggaran_dipa, SUM(jml_anggaran_indikatif) as jml_anggaran_indikatif FROM thbp_kak_kegiatan WHERE th = '{$th}' GROUP BY concat(kddept,kdunit,kdprogram) ORDER BY concat(kddept,kdunit,kdprogram)";
        break;
    case '5':
        $sql = "SELECT kddept,kdunit,kdprogram, SUM(jml_anggaran_renstra) as jml_anggaran_renstra, SUM(jml_anggaran_dipa) as jml_anggaran_dipa, SUM(jml_anggaran_indikatif) as jml_anggaran_indikatif FROM thbp_kak_kegiatan WHERE kdunitkerja = '{$xkdunit}' and th = '{$th}' GROUP BY concat(kddept,kdunit,kdprogram) ORDER BY concat(kddept,kdunit,kdprogram)";
        break;
    case '6':
        $sql = "SELECT kddept,kdunit,kdprogram, SUM(jml_anggaran_renstra) as jml_anggaran_renstra, SUM(jml_anggaran_dipa) as jml_anggaran_dipa, SUM(jml_anggaran_indikatif) as jml_anggaran_indikatif FROM thbp_kak_kegiatan WHERE left(kdunitkerja,3) = '{$kddeputi_i}' and th = '{$th}' GROUP BY concat(kddept,kdunit,kdprogram) ORDER BY concat(kddept,kdunit,kdprogram)";
        break;
    default:
        $sql = "SELECT kddept,kdunit,kdprogram, SUM(jml_anggaran_renstra) as jml_anggaran_renstra, SUM(jml_anggaran_dipa) as jml_anggaran_dipa, SUM(jml_anggaran_indikatif) as jml_anggaran_indikatif FROM thbp_kak_kegiatan WHERE th = '{$th}' GROUP BY concat(kddept,kdunit,kdprogram) ORDER BY concat(kddept,kdunit,kdprogram)";
        break;
}
$oProgram = mysql_query($sql);
Exemple #11
0
       $pdf->SetY(285);
       $pdf->Cell(150,12,'>>> --- SEGUE SU PAGINA SUCCESSIVA --- >>>',1,1,'C');
       $pdf->AddPage();
    }
}
$piede='il cliente';
$pdf->Cell(150,8,'TOTALE RISCOSSO',1,0,'R');
$pdf->Cell(40,8,gaz_format_number($importo),1,1,'R',1);

if ($pdf->GetY() <= 135)
    {
    $pdf->SetY(140);
    $pdf->SetFont('helvetica','',8);
    $pdf->MultiCell(190,4,'Copia per il cliente',0,'C',0);
    $pdf->Ln(8);
    $pdf->Line(0,145,210,145);
    $pdf->Header();
    }
 else   $pdf->AddPage();
$rs_rig = gaz_dbi_dyn_query("*", $gTables['rigbro'], "id_tes like '$testat'","id_tes desc");
$importo = 0;
while ($rigo = gaz_dbi_fetch_array($rs_rig)) {
    if ($pdf->GetY() <= 280) {
          $pdf->Cell(150,8,$rigo['descri'],1,0,'L');
          $pdf->Cell(40,8,gaz_format_number($rigo['prelis']),1,1,'R');
          $importo += $rigo['prelis'];
    } else {
       $pdf->SetY(285);
       $pdf->Cell(190,12,'>>> --- SEGUE SU PAGINA SUCCESSIVA --- >>>',1,1,'C');
       $pdf->AddPage();
    }
 /**
  * Fonction realisant une croix aux 4 coins des cartes
  *
  * @param PDF	$pdf				PDF
  * @param int	$x1					X1
  * @param int	$y1					Y1
  * @param int	$x2					X2
  * @param int	$y2					Y2
  * @param int	$epaisseur			Epaisseur
  * @param int	$taille             Size
  * @return void
  */
 function _Croix(&$pdf, $x1 = 0, $y1 = 0, $x2 = 210, $y2 = 297, $epaisseur = 1, $taille = 4)
 {
     $pdf->SetDrawColor(192, 192, 192);
     $pdf->SetLineWidth($epaisseur);
     $lg = $taille / 2;
     // croix haut gauche
     $pdf->Line($x1, $y1 - $lg, $x1, $y1 + $lg);
     $pdf->Line($x1 - $lg, $y1, $x1 + $lg, $y1);
     // croix bas gauche
     $pdf->Line($x1, $y2 - $lg, $x1, $y2 + $lg);
     $pdf->Line($x1 - $lg, $y2, $x1 + $lg, $y2);
     // croix haut droit
     $pdf->Line($x2, $y1 - $lg, $x2, $y1 + $lg);
     $pdf->Line($x2 - $lg, $y1, $x2 + $lg, $y1);
     // croix bas droit
     $pdf->Line($x2, $y2 - $lg, $x2, $y2 + $lg);
     $pdf->Line($x2 - $lg, $y2, $x2 + $lg, $y2);
     $pdf->SetDrawColor(0, 0, 0);
 }
Exemple #13
0
	reset($auxcod);
	foreach ($auxcod as $cod) {
		if (!empty($cod)){
			//Salva as informações da ficha de autorização no BD
			$sqla = "INSERT INTO autorizacao_codigoconvenio (codautorizacao, codconvenio) VALUES ('$resultc[0]', '$cod');";
			// Executa o comando SQL
			mysql_query($sqla);
		}
	}
	
	//Instanciação da classe herdada
    $pdf=new PDF("L","mm","A4"); //P->Retrato, L->Paisagem; mm-> milímetros; A4-> padrão da folha
    //$pdf = new MEM_IMAGE;
    $pdf->AliasNbPages(); //Recebe o total de páginas
    $pdf->AddPage(); //Coloca uma página em branco
    $pdf->Line(148,0,148,210); //Adiciona a linha no centro da pagina
    
                    //BLOCO DO NOME GUIA DE PROCEDIMENTOS
    //-----------------------------------------------------------------------------------------------
    $pdf->SetFont('Arial','B',12);
    $pdf->Cell(33);
    $pdf->Cell(70,10,utf8_decode('Guia de Autorização'),0,0,'C');
    $pdf->SetX(180);
    $pdf->Cell(70,10,utf8_decode('Guia de Autorização'),0,0,'C');
    //-----------------------------------------------------------------------------------------------
                    
                    //BLOCO DA LINHA
    //-----------------------------------------------------------------------------------------------
    $pdf->SetFont('Arial','U',8);
    $pdf->Ln(3);
    $pdf->Cell(50,10,'                                                                                                                                                                            ',0,0);
     $pdf->Cell($breite, 4, '', 0, 1, 'C');
     $ic++;
 }
 while ($count[$ic] and $einzel[$ie] and $count[$ic]->tln_nr > $einzel[$ie]->tln_nr) {
     $pdf->Cell($breite1, 4, ' ', 0, 0);
     $ztext = utf8_decode("Ergebnis übersprungen, da Spieler nicht in Aufstellung ");
     $ztext .= ' Verein:' . $einzel[$ie]->zps . ' Mitglied:' . $einzel[$ie]->spieler;
     $ztext .= ' Durchgang:' . $einzel[$ie]->dg . ' Runde:' . $einzel[$ie]->runde;
     $ztext .= ' Brett:' . $einzel[$ie]->brett . ' Erg:' . $einzel[$ie]->punkte;
     $pdf->Cell(50, 4, $ztext, 0, 1, 'L');
     $ie++;
 }
 $x = $pdf->GetX();
 $y = $pdf->GetY();
 if ($o_nr == 0 or $mannschaft[$m]->sg_zps <= "0") {
     $pdf->Line($x + $breite1, $y + 2, $x + 170, $y + 2);
 } else {
     $pdf->Line($x + $breite1, $y + 2, $x + 178, $y + 2);
 }
 $pdf->Cell(8, 4, '', 0, 1, 'C');
 $pdf->Cell($breite1, 4, ' ', 0, 0);
 $pdf->Cell(12, 4, JText::_('TEAM_TOTAL'), 0, 0, 'C');
 if ($o_nr == 0 or $mannschaft[$m]->sg_zps <= "0") {
     $pdf->Cell(40, 4, '', 0, 0);
 } else {
     $pdf->Cell(48, 4, '', 0, 0);
 }
 $pdf->Cell(10, 4, '', 0, 0, 'R');
 $pktsumme = 0;
 $spl = 0;
 for ($c = 0; $c < $mannschaft[$m]->dg; $c++) {
 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);
     }
 }
        $max = count($arrJabatan);
    }
    if ($max < count($arrNama)) {
        $max = count($arrNama);
    }
    for ($i = 0; $i < $max; $i++) {
        $pdf->SetX($margin);
        $pdf->Cell($w1[0], $ln, $arrNo[$i], 'LR', 0, 'C');
        $pdf->SetX($margin + $w1[0]);
        $pdf->Cell($w1[1], $ln, $arrUnit[$i], 'LR', 0, 'L');
        $pdf->SetX($margin + $w1[0] + $w1[1]);
        $pdf->Cell($w1[2], $ln, $arrNama[$i], 'LR', 0, 'L');
        $pdf->SetX($margin + $w1[0] + $w1[1] + $w1[2]);
        $pdf->Cell($w1[3], $ln, $arrGol[$i], 'LR', 0, 'C');
        $pdf->SetX($margin + $w1[0] + $w1[1] + $w1[2] + $w1[3]);
        $pdf->Cell($w1[4], $ln, $arrJabatan[$i], 'LR', 0, 'L');
        $pdf->SetX($margin + $w1[0] + $w1[1] + $w1[2] + $w1[3] + $w1[4]);
        $pdf->Cell($w1[5], $ln, $arrGrade[$i], 'LR', 1, 'C');
    }
    $pdf->Line($margin, $pdf->GetY(), $margin + $w1[0] + $w1[1] + $w1[2] + $w1[3] + $w1[4] + $w1[5], $pdf->GetY());
    if ($pdf->GetY() >= 270) {
        $pdf->Line($margin, $pdf->GetY(), $margin + $w1[0] + $w1[1] + $w1[2] + $w1[3] + $w1[4] + $w1[5], $pdf->GetY());
        $pdf->AddPage();
        $pdf->Line($margin, $pdf->GetY(), $margin + $w1[0] + $w1[1] + $w1[2] + $w1[3] + $w1[4] + $w1[5], $pdf->GetY());
    }
}
$pdf->SetFont($font, '', $size - 3);
$pdf->SetX($margin + $w[0]);
$pdf->Cell($w[1], $ln, 'Dicetak tgl. ' . date('d-m-Y H:i:s'), '', 1, 'L');
$pdf->SetDisplayMode('real');
$pdf->Output('doc.pdf', 'I');
{
    function Footer()
    {
        $this->SetY(-10);
        $this->SetX(5);
        $this->SetFont('helvetica', 'I', 5);
        $this->Cell(48, 5, utf8_decode("Fecha Impresión " . Date::today()), 0, 0, 'L');
        $this->Cell(48, 5, utf8_decode('Página') . $this->PageNo() . '/{nb}', 0, 0, 'R');
    }
}
$pdf = new PDF('P', 'mm', array(105, 148));
$pdf->AliasNbPages();
for ($i = 0; $i < 2; $i++) {
    $pdf->AddPage();
    $pdf->Rect(10, 10, 85, 128);
    $pdf->Line(10, 20, 95, 20);
    $pdf->Line(10, 30, 95, 30);
    $pdf->SetFont('helvetica', 'B', 7);
    $pdf->SetFillColor(120, 120, 120);
    $pdf->SetTextColor(255, 255, 255);
    $pdf->SetX(10);
    $pdf->SetY(10);
    $pdf->Cell(85, 10, utf8_decode($this->planillaDataDet[0]['id_personal'] . " - " . $this->planillaDataDet[0]['nombre_personal']), 1, 0, 'C', true);
    $pdf->Ln(13);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->Cell(15, 5, utf8_decode('BOLETA INFORMATIVA DETALLE'), 0, 0, 'L');
    $pdf->Ln(10);
    $pdf->Cell(65, 5, utf8_decode('Básico ' . $this->planillaDataDet[0]['nom_planilla'] . ' ( ' . $this->planillaDataDet[0]['periodo'] . ' )'), 0, 0, 'L');
    $pdf->Cell(20, 5, utf8_decode($this->planillaDataDet[0]['neto_total'] + $this->planillaDataDet[0]['monto_asig_familiar'] + $this->planillaDataDet[0]['otros_descuentos']), 0, 0, 'R');
    $pdf->Ln(5);
    $pdf->Cell(15, 5, utf8_decode('DESCUENTOS'), 0, 0, 'L');
Exemple #18
0
$pdf->Image('../../css/images/ristek.jpg', 90, 25, 30, 30, 'jpg');
$y = $pdf->GetY() + 30;
$pdf->SetY($y);
$pdf->Cell(0, 10, 'KERANGKA ACUAN KERJA', '', 1, 'C');
$pdf->Cell(0, 10, 'KEGIATAN', '', 1, 'C');
$pdf->SetFont($font, 'B', $size + 6);
$pdf->Cell(0, 10, 'Tahun Anggaran ' . $Kegiatan_bp['th'], '', 1, 'C');
$y = $pdf->GetY() + 10;
$pdf->SetXY($margin + $w[0], $y);
$pdf->Cell($w[1] + $w[2] + $w[3], $ln, '', '', 1, 'C');
$max = 0;
$arrNmGiat = $pdf->SplitToArray($w[2], $ln, trim(nm_giat($Kegiatan_bp['kdgiat'])));
if ($max < count($arrNmGiat)) {
    $max = count($arrNmGiat);
}
$pdf->Line($margin + $w[0], $pdf->GetY(), $margin + $w[0] + $w[1] + $w[2] + $w[3], $pdf->GetY());
$pdf->SetX($margin + $w[0]);
$pdf->Cell($w[1] + $w[2] + $w[3], $ln - 2, '', 'LR', 1, 'L');
$pdf->SetFont($font, 'B', $size + 5);
for ($i = 0; $i < $max; $i++) {
    $pdf->SetX($margin + $w[0]);
    $pdf->Cell($w[1], $ln, '', 'L', 0, 'L');
    $pdf->SetX($margin + $w[0] + $w[1]);
    $pdf->Cell($w[2], $ln, $arrNmGiat[$i], '', 0, 'C');
    $pdf->SetX($margin + $w[0] + $w[1] + $w[2]);
    $pdf->Cell($w[3], $ln, '', 'R', 1, 'L');
}
$pdf->SetX($margin + $w[0]);
$pdf->Cell($w[1] + $w[2] + $w[3], $ln - 2, '', 'LR', 1, 'L');
$pdf->Line($margin + $w[0], $pdf->GetY(), $margin + $w[0] + $w[1] + $w[2] + $w[3], $pdf->GetY());
$pdf->SetFont($font, 'B', $size + 3);
Exemple #19
0
 $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);
     $pdf->Text(165, $pdf->GetY(), $fecha);
     $pdf->cell(0, 6.5, '', 0, 1);
 }
 $pdf->cell(0, 8, '', 0, 1);
 $pdf->Output();
Exemple #20
0
 $titulo = utf8_decode("Resumen de Factura Por Cliente y Empresas");
 $pdf = new PDF();
 $pdf->SetCompression(true);
 $pdf->AliasNbPages();
 $pdf->SetFont('Arial', '', 10);
 $sqa = "select \n\t\tISNULL(REF5CLI_FAC,'NO DEFINIDO') as EMPRESA,\n\t\tNOMBRE_CLI AS CLIENTE,\n\t\tCOUNT(*) AS CANT,\n\t\tSUM(ISNULL(TOTAL_FAC,0)) AS TOTAL,\n\t\tSUM(ISNULL(TOTAL_FAC,0))-SUM(ISNULL(ANTICIPO_EXP,0)) AS MSEG,\n\t\tSUM(ANTICIPO_EXP) AS MPAC\n\t\tfrom Tbfacturacion3\n\t\tinner join TbClientes\n\t\ton codigo_cli=cliente_fac\n\t\tLEFT JOIN TBEXPEDIENTES ON\n\t\tCONVERT(NVARCHAR,CODIGO_EXP) = pedido_fac\n\t\tWHERE (CONVERT(DATE,FECHA_FAC) BETWEEN CONVERT(DATE,'{$ddesde}') AND CONVERT(DATE,'{$dhasta}'))\n\t\tand status_fac=" . ($sts == 1 ? '1' : '0') . "\n\t\t" . ($emp ? " AND REF5CLI_FAC IN (SELECT nombre_emp FROM TbEmpresas WHERE CODIGO_EMP='{$emp}')" : "") . "\n\t\t" . ($cli ? " AND CODIGO_CLI='{$cli}'" : "") . "\n\t\tGROUP BY REF5CLI_FAC, nombre_cli\n\t\tORDER BY " . ($groupby ? $groupby : ' NOMBRE_CLI');
 $lastGroup = "";
 //putxt($sqa);
 $sql = mssql_query($sqa);
 $pp = 0;
 while ($row = mssql_fetch_array($sql)) {
     if ($pp == 0 || $pdf->GetY() > 240) {
         $pdf->AddPage();
         $pp++;
         $pdf->Ln(4);
         $pdf->Line(10, $pdf->GetY(), 200, $pdf->GetY());
         $pdf->Ln(2);
         if ($ddesde) {
             if ($pdf->GetX() > 160) {
                 $pdf->Ln();
             }
             $pdf->Cell(47, 4, toStr('Fecha desde: ' . date('d/m/Y', strtotime($ddesde))));
             $pdf->Cell(47, 4, toStr('Fecha hasta: ' . date('d/m/Y', strtotime($dhasta))));
         }
         if ($cli) {
             if ($pdf->GetX() > 120) {
                 $pdf->Ln();
             }
             $pdf->Cell(94, 4, toStr('Cliente: ' . $cli . ' ' . $nombre_cli));
         }
         if ($emp) {
}
for ($i = 0; $i < $max; $i++) {
    $pdf->SetX($margin);
    $pdf->Cell($w1[0], $ln, $arrNo_1[$i], 'LR', 0, 'C');
    $pdf->SetX($margin + $w1[0]);
    $pdf->Cell($w1[1], $ln, $arrLabel_1[$i], 'LR', 0, 'L');
    $pdf->SetX($margin + $w1[0] + $w1[1]);
    $pdf->Cell($w1[2], $ln, $arrField_1[$i], 'LR', 0, 'L');
    $pdf->SetX($margin + $w1[0] + $w1[1] + $w1[2]);
    $pdf->Cell($w1[3], $ln, $arrNo_2[$i], 'LR', 0, 'C');
    $pdf->SetX($margin + $w1[0] + $w1[1] + $w1[2] + $w1[3]);
    $pdf->Cell($w1[4], $ln, $arrLabel_2[$i], 'LR', 0, 'L');
    $pdf->SetX($margin + $w1[0] + $w1[1] + $w1[2] + $w1[3] + $w1[4]);
    $pdf->Cell($w1[5], $ln, $arrField_2[$i], 'LR', 1, 'L');
}
$pdf->Line($margin, $pdf->GetY(), $margin + $w1[0] + $w1[1] + $w1[2] + $w1[3] + $w1[4] + $w1[5], $pdf->GetY());
$pdf->Ln() * 2;
$pdf->SetFont($font, 'B', $size);
$pdf->SetX($margin + $w[0]);
$pdf->Cell($w[1], $ln, 'B. TARGET DAN REALISASI', '', 1, 'L');
$w2 = array(7, 35, 12, 12, 12, 10, 12, 12, 12);
$pdf->SetFont($font, 'B', $size - 4);
$pdf->SetX($margin);
$pdf->Cell($w2[0], $ln * 3, 'NO.', $border, 0, 'C');
$pdf->SetX($margin + $w2[0]);
$pdf->Cell($w2[1], $ln * 3, 'III. KEGIATAN TUGAS JABATAN', $border, 0, 'L');
$pdf->SetFont($font, 'B', $size - 4);
$y = $pdf->GetY();
$pdf->SetXY($margin + $w2[0] + $w2[1], $y);
$pdf->Cell($w2[2], $ln * 2, 'ANGKA', $noborder, 0, 'C');
$pdf->SetXY($margin + $w2[0] + $w2[1], $y + 6);
 $dbh = new PDO('mysql:host=localhost;port=3306;dbname=empresas', 'root', '43vivienda', array(PDO::ATTR_PERSISTENT => false));
 $sql = "SELECT *, DATE_FORMAT(fecha_registro,'%d/%m/%Y %H:%i:%s') as fecharegistro\r\n            FROM consultores\r\n            WHERE id={$id}";
 $stmt = $dbh->prepare($sql);
 $stmt->execute();
 while ($rs = $stmt->fetch(PDO::FETCH_OBJ)) {
     $pdf = new PDF('P', 'mm', 'Letter');
     $pdf->SetMargins(15, 10, 5);
     $pdf->AddPage();
     $pdf->SetFont('helvetica', 'B', 14);
     $pdf->Ln(5);
     $pdf->Cell(195, 5, utf8_decode('CERTIFICADO DE HABILITACIÓN'), 0, FALSE, 'C');
     $pdf->Ln(4);
     $pdf->SetFont('helvetica', '', 10);
     $pdf->Cell(195, 5, utf8_decode('CODIGO: ') . $rs->id, 0, FALSE, 'C');
     $style = array('width' => 1, 'cap' => 'butt', 'join' => 'miter', 'dash' => '10, 20, 5, 10', 'phase' => 30, 'color' => array(255, 0, 0));
     $pdf->Line(15, 45, 195, 45, $style);
     $pdf->Ln(10);
     $pdf->SetWidths(array(60, 120));
     $pdf->SetAligns(array('L', 'L'));
     //$pdf->Row(array());
     $pdf->MultiCell(180, 5, utf8_decode("El presente documento certifica la habilitación del Consultor " . strtoupper($rs->nombre_completo) . ". para la participación en distintos proyectos dependientes de la Agencia Estatal de Vivienda, con todos los derechos y que ello conlleva."), 0, 'J');
     $pdf->Ln(10);
     $pdf->SetFont('helvetica', '', 8);
     $pdf->Row(array('NOMBRE DEL CONSULTOR', strtoupper($rs->nombre_completo)));
     $pdf->Row(array('CI', $rs->ci));
     $pdf->Row(array('PROFESION', $rs->profesion));
     $pdf->Row(array('PROCEDENCIA', $rs->procedencia));
     $pdf->Row(array('TELEFONO/CELULAR', $rs->telefonos . " / " . $rs->celular));
     $pdf->Row(array(utf8_decode('CORREO ELECTRÓNICO'), $rs->mail));
     $pdf->Row(array('FECHA DE REGISTRO', $rs->fecharegistro));
     $pdf->SetFont('helvetica', 'B', 8);
         $totalliability2 = $totalliability2 + abs($lastbalance2);
         break;
     case "7E":
         //if(strtoupper($accounts_nameori)=="RETAIN EARNING"){
         $totalequity1 = $totalequity1 + abs($lastbalance1);
         $totalequity2 = $totalequity2 + abs($lastbalance2);
         //}else{
         //$totalequity1=$totalequity1+$lastbalance1;
         //$totalequity2=$totalequity2+$lastbalance2;
         //}
         break;
 }
 //when reach new category, print the summary
 if ($currentcategory != $classtype) {
     $ypos = $pdf->GetY();
     $pdf->Line($w[0], $ypos, $marginx + $w[0] + $w[1] + $w[2], $ypos);
     $pdf->SetFont($defaultfont, '', $defaultfontsize);
     $summaryamt = "";
     switch ($currentcategory) {
         case "5A":
             $pdf->SetFont($defaultfont, 'B', $defaultfontsize + 1);
             $pdf->Cell($w[0], $defaultfontheight, "Total Asset:", 0, 0, "L");
             $summaryamt = number_format($totalasset1, 2);
             $pdf->Cell($w[1], $defaultfontheight, $summaryamt, 0, 0, "R");
             $summaryamt = number_format($totalasset2, 2);
             $pdf->Cell($w[2], $defaultfontheight, $summaryamt, 0, 0, "R");
             break;
         case "6L":
             $pdf->Cell($w[0], $defaultfontheight, "", 0, 0, "L");
             $summaryamt = number_format($totalliability1, 2);
             $pdf->Cell($w[1], $defaultfontheight, $summaryamt, 0, 0, "R");
     $pdf->Cell($breite1, $zelle - 1, ' ', 0, 0);
     //		$ztext = utf8_decode("Ergebnis übersprungen, da Spieler nicht in Aufstellung ");
     //		$ztext .= ' Verein:'.$einzel[$ie]->zps.' Mitglied:'.$einzel[$ie]->spieler.' PKZ:'.$einzel[$ie]->PKZ;
     //		$ztext .= ' Durchgang:'.$einzel[$ie]->dg.' Runde:'.$einzel[$ie]->runde;
     //		$ztext .= ' Brett:'.$einzel[$ie]->brett.' Erg:'.$einzel[$ie]->punkte;
     $ztext = utf8_decode(JText::_('TEAM_WARNING'));
     $ztext .= JText::_('TEAM_CLUB') . $einzel[$ie]->zps . JText::_('TEAM_MEMBER') . $einzel[$ie]->spieler . JText::_('TEAM_PKZ') . $einzel[$ie]->PKZ;
     $ztext .= JText::_('TEAM_DG') . $einzel[$ie]->dg . JText::_('TEAM_ROUND') . $einzel[$ie]->runde;
     $ztext .= JText::_('TEAM_BOARD') . $einzel[$ie]->brett . JText::_('TEAM_RESULT2') . $einzel[$ie]->punkte;
     $pdf->Cell(50, $zelle - 1, $ztext, 0, 1, 'L', $fc);
     $ie++;
 }
 $x = $pdf->GetX();
 $y = $pdf->GetY();
 if ($o_nr == 0 or $mannschaft[0]->sg_zps <= "0") {
     $pdf->Line($x + $breite1, $y + 2, $x + $pdf_width - 8, $y + 2);
 } else {
     $pdf->Line($x + $breite1, $y + 2, $x + $pdf_width, $y + 2);
 }
 $pdf->Cell(8, $zelle, '', 0, 1, 'C');
 $pdf->Cell($breite1, $zelle, ' ', 0, 0);
 $pdf->Cell(12, $zelle, JText::_('TEAM_TOTAL'), 1, 0, 'C', 1);
 if ($o_nr == 0 or $mannschaft[0]->sg_zps <= "0") {
     $pdf->Cell(40, $zelle, '', 0, 0, 'C', 0);
 } else {
     $pdf->Cell(48, $zelle, '', 0, 0, 'C', 0);
 }
 $pdf->Cell(10, $zelle, '', 0, 0, 'R');
 $pkt = 0;
 $spl = 0;
 for ($c = 0; $c < $mannschaft[0]->dg; $c++) {
     $max = count($arrIndikator);
 }
 if ($max < count($arrAksi_1)) {
     $max = count($arrAksi_1);
 }
 if ($max < count($arrAksi_2)) {
     $max = count($arrAksi_2);
 }
 if ($max < count($arrAksi_3)) {
     $max = count($arrAksi_3);
 }
 if ($max < count($arrAksi_4)) {
     $max = count($arrAksi_4);
 }
 if ($kdsasaran != $row['no_sasaran']) {
     $pdf->Line($margin, $pdf->GetY(), $margin + $w1[0] + $w1[1] + $w1[2] + $w1[3] + $w1[4] + $w1[5] + $w1[6] + $w1[7] + $w1[8] + $w1[9] + $w1[10], $pdf->GetY());
 }
 if ($kdsasaran == $row['no_sasaran']) {
     $pdf->Line($margin + $w1[0], $pdf->GetY(), $margin + $w1[0] + $w1[1] + $w1[2] + $w1[3] + $w1[4] + $w1[5] + $w1[6] + $w1[7] + $w1[8] + $w1[9] + $w1[10], $pdf->GetY());
 }
 $kdsasaran = $row['no_sasaran'];
 for ($i = 0; $i < $max; $i++) {
     $pdf->SetX($margin);
     $pdf->Cell($w1[0], $ln, $arrSasaran[$i], 'LR', 0, 'L');
     $pdf->SetX($margin + $w1[0]);
     $pdf->Cell($w1[1], $ln, $arrIndikator[$i], 'LR', 0, 'L');
     $pdf->SetX($margin + $w1[0] + $w1[1]);
     $pdf->Cell($w1[2], $ln, $arrTarget[$i], 'LR', 0, 'C');
     $pdf->SetX($margin + $w1[0] + $w1[1] + $w1[2]);
     $pdf->Cell($w1[3], $ln, $arrCapaian_1[$i], 'LR', 0, 'C');
     $pdf->SetX($margin + $w1[0] + $w1[1] + $w1[2] + $w1[3]);
$qu = mysql_query($sql);
while ($Kelompok = mysql_fetch_array($qu)) {
    $pdf->SetFont($font, 'B', $size - 1);
    $max = 0;
    $arrNo = $pdf->SplitToArray($w2[0], $ln, nmromawi($Kelompok['kdkelompok']));
    $arrUraian = $pdf->SplitToArray($w2[1] + $w2[2] + $w2[3] + $w2[4] + $w2[5] + $w2[6], $ln, trim(nm_kelompok_bantu($kdjab, $Kelompok['kdkelompok'])));
    if ($max < count($arrUraian)) {
        $max = count($arrUraian);
    }
    for ($i = 0; $i < $max; $i++) {
        $pdf->SetX($margin);
        $pdf->Cell($w2[0], $ln, $arrNo[$i], 'LR', 0, 'C');
        $pdf->SetX($margin + $w2[0]);
        $pdf->Cell($w2[1] + $w2[2] + $w2[3] + $w2[4] + $w2[5] + $w2[6], $ln, $arrUraian[$i], 'LR', 1, 'L');
    }
    $pdf->Line($margin, $pdf->GetY(), $margin + $w2[0] + $w2[1] + $w2[2] + $w2[3] + $w2[4] + $w2[5] + $w2[6], $pdf->GetY());
    $pdf->SetFont($font, '', $size - 2);
    $sql_item = "SELECT * FROM t_bantu WHERE kdjab = '{$kdjab}' and kdkelompok = '{$Kelompok['kdkelompok']}' ORDER BY kditem";
    $qu_item = mysql_query($sql_item);
    while ($Item = mysql_fetch_array($qu_item)) {
        $max = 0;
        $arrNo = $pdf->SplitToArray($w2[0], $ln, $Item['kditem']);
        $arrUraian = $pdf->SplitToArray($w2[1], $ln, trim($Item['nmitem']));
        $arrSatuanAK = $pdf->SplitToArray($w2[2], $ln, trim($Item['angka_kredit']));
        if ($Item['mak_target'] == -1) {
            $arrBatasan = $pdf->SplitToArray($w2[3], $ln, $Item['min_target'] . ' - tidak ada batasan');
        } else {
            $arrBatasan = $pdf->SplitToArray($w2[3], $ln, $Item['min_target'] . ' - ' . $Item['mak_target']);
        }
        $arrSatuan = $pdf->SplitToArray($w2[6], $ln, trim($Item['satuan']));
        if ($max < count($arrUraian)) {
                $pdf->Cell($cellsize, $cell_height, $p_weekly['past']);
                $pdf->setFont('Arial', '', '10');
                $pdf->setXY($cellsizecollweek + 2, $ypos + 8);
                $pdf->Cell($cellsize, $cell_height, $p_weekly['range_date']);
                $ypostTotal = $ypos + 13;
                foreach ($p_weekly['sales'] as $sales) {
                    $pdf->setXY($cellsizecollweek + 2, $ypostTotal);
                    $pdf->Cell($cellsize_half, $cell_height, $sales['name'] . ':');
                    $pdf->Cell($cellsize_half - 4, $cell_height, $sales['total'], 0, 0, 'R');
                    $ypostTotal += 5;
                }
                $line_ypos = $ypos + 43.5;
                $line_xpos_start = $cellsizecollweek + 2;
                $line_xpos_end = $cellsizecollweek + ($cellsize - 2);
                $pdf->SetDrawColor(200, 200, 200);
                $pdf->Line($line_xpos_start, $line_ypos, $line_xpos_end, $line_ypos);
                $pdf->SetDrawColor(0, 0, 0);
                $pdf->setXY($cellsizecollweek + 2, $ypos + 45);
                $pdf->Cell($cellsize_half, $cell_height, 'Total Sold:');
                $pdf->Cell($cellsize_half - 4, $cell_height, $p_weekly['total_sold'], 0, 0, 'R');
                $cellsizecollweek += $cellsize;
            }
            $ypos += 55;
            $pdf->setXY($cellstart, $ypos);
            $cellsizecollweek = $cellsize + $margin;
            $firstorder = false;
        }
        $no = 1;
    }
}
if ($_POST['keep_file']) {
 $ev_height = 170;
 $dash_style = array('width' => 0.1, 'dash' => '2, 2');
 $solid_style = array('width' => 0.2, 'dash' => 0);
 $solid_style_med = array('width' => 0.4, 'dash' => 0);
 $pdf->Rect($margin_env, $ypos, $ev_width, $ev_height, 'D', array('all' => $dash_style));
 $pdf->setXY($margin_env + 10, $ypos + 5);
 $pdf->setFont('Arial', '', '12');
 //FILL JNG ADDRESS HEADER
 $jng_from = "JULIE & GRACE ({$sp_detail['jng_id']})";
 $hamburg_office_address = "{$jng_from}\n";
 $hamburg_office_address .= JNG_ADDRESS_STREET . "\n";
 $hamburg_office_address .= JNG_ADDRESS_ZIPCODE . " " . JNG_ADDRESS_CITY . "\n";
 $hamburg_office_address .= JNG_ADDRESS_COUNTRY;
 $pdf->MultiCell(100, $lineheight, $hamburg_office_address);
 $ypos = +30;
 $pdf->Line($boxes_tab_env, $ypos, 80, $ypos, $solid_style);
 $ypos += $lineheight;
 $pdf->Line($boxes_tab_env, $ypos, 80, $ypos);
 $ypos += $lineheight;
 $pdf->Line($boxes_tab_env, $ypos, 80, $ypos);
 $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);
 $pdf->SetFont('helvetica', '', 10);
 $date = date('Y-m-d H:i:s');
 $pdf->Cell(195, 5, utf8_decode('USUARIO: ') . $user, 0, FALSE, 'C');
 $pdf->Ln(3);
 $pdf->Cell(195, 6, utf8_decode('CRITERIOS DE BUSQUEDA'), 0, FALSE, 'C');
 $pdf->Ln(3);
 $pdf->Cell(195, 7, utf8_decode('MONTO DEL PROYECTO: ') . $montodato, 0, FALSE, 'C');
 $pdf->Ln(3);
 $pdf->Cell(195, 8, utf8_decode('UBICACION DEL PROYECTO: ') . $departamento, 0, FALSE, 'C');
 $pdf->Ln(4);
 $pdf->Cell(195, 8, utf8_decode('DATOS TOMADOS DE LOS ') . $anios . utf8_decode(' ULTIMOS AÑOS DE EXPERIENCIA'), 0, FALSE, 'C');
 $pdf->Ln(4);
 $pdf->Cell(195, 8, utf8_decode('RELACION EXPERIENCIA GENERAL : ESPECIFICA (') . $dato11 . ':' . $dato12 . ')', 0, FALSE, 'C');
 $style = array('width' => 1, 'cap' => 'butt', 'join' => 'miter', 'dash' => '10, 20, 5, 10', 'phase' => 30, 'color' => array(255, 0, 0));
 $pdf->Ln(3);
 $pdf->Line(15, 60, 195, 60, $style);
 $pdf->Ln(10);
 $pdf->SetWidths(array(10, 120));
 $pdf->SetAligns(array('L', 'L'));
 //$pdf->Row(array());
 $pdf->SetFont('helvetica', '', 8);
 $stmt = $dbh->prepare($sql);
 $stmt->execute();
 $data = array();
 $cont = 0;
 $header = array('ENTIDAD', 'NIT', 'MATRICULA', 'TELEFONO', 'CORREO', 'MONTO_GEN', 'MONTO_ESP', 'TIEMPO_GEN', 'TIEMPO_ESP');
 while ($rs = $stmt->fetch(PDO::FETCH_ASSOC)) {
     //$data[] = array($rs[nombre_proponente],$rs[nit],$rs[matricula],$rs[celular],$rs[mail],$rs[montog],$rs[montoesp],$rs[tiempomeses]);
     $entidad = $rs['nombre_proponente'];
     $nit = $rs['nit'];
     $matricula = $rs['matricula'];
Exemple #30
0
    $arrAlasan = $pdf->SplitToArray($w[2], $hhh, trim($List['alasan']));
    if ($max < count($arrUraian)) {
        $max = count($arrUraian);
    }
    if ($max < count($arrAlasan)) {
        $max = count($arrAlasan);
    }
    for ($i = 0; $i < $max; $i++) {
        $pdf->SetX($marginL);
        $pdf->Cell($w[0], $hhh, $arrNomor[$i], 'LR', 0, 'C');
        $pdf->SetX($marginL + $w[0]);
        $pdf->Cell($w[1], $hhh, $arrUraian[$i], 'LR', 0, 'L');
        $pdf->SetX($marginL + $w[0] + $w[1]);
        $pdf->Cell($w[2], $hhh, $arrAlasan[$i], 'LR', 1, 'L');
    }
    $pdf->Line($marginL, $pdf->GetY(), $marginL + $w[0] + $w[1] + $w[2], $pdf->GetY());
}
# akhir while
$pdf->SetFont($font, 'B', $fsize2);
$w = array(12, 3, 235);
$pdf->Ln();
$pdf->SetX($marginL);
$pdf->Cell($w[0] + $w[1] + $w[2], $hh, 'Tugas dan Fungsi Kementerian Riset dan Teknologi', $noborder, 1, 'L');
$pdf->SetX($marginL);
$pdf->Cell($w[0], $hh, 'Tugas', $noborder, 0, 'L');
$pdf->SetX($marginL + $w[0]);
$pdf->Cell($w[1], $hh, ':', $noborder, 0, 'C');
$pdf->SetFont($font, '', $fsize2);
$pdf->SetX($marginL + $w[0] + $w[1]);
$pdf->MultiCell($w[2], $hh, tugas_unit($kdunit), $noborder, 1, 'L');
$pdf->Ln();