コード例 #1
0
 /**
  *  Show top header of page.
  *
  *  @param	PDF			$pdf     		Object PDF
  *  @param  FactureFournisseur		$object     	Object to show
  *  @param  int	    	$showaddress    0=no, 1=yes
  *  @param  Translate	$outputlangs	Object lang for output
  *  @return	void
  */
 function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
 {
     global $langs, $conf, $mysoc;
     $outputlangs->load("main");
     $outputlangs->load("bills");
     $outputlangs->load("orders");
     $outputlangs->load("companies");
     $default_font_size = pdf_getPDFFontSize($outputlangs);
     // Do not add the BACKGROUND as this is for suppliers
     //pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
     $pdf->SetTextColor(0, 0, 60);
     $pdf->SetFont('', 'B', $default_font_size + 3);
     $posy = $this->marge_haute;
     $posx = $this->page_largeur - $this->marge_droite - 100;
     $pdf->SetXY($this->marge_gauche, $posy);
     // Logo
     /*
     		$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
     		if ($mysoc->logo)
     		{
     			if (is_readable($logo))
     			{
     			    $height=pdf_getHeightForLogo($logo);
     			    $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height);	// width=0 (auto)
     			}
     			else
     			{
     				$pdf->SetTextColor(200,0,0);
     				$pdf->SetFont('','B', $default_font_size - 2);
     				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
     				$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
     			}
     		}
     		else
     		{*/
     $text = $this->emetteur->name;
     $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
     //}
     $pdf->SetFont('', 'B', $default_font_size + 3);
     $pdf->SetXY($posx, $posy);
     $pdf->SetTextColor(0, 0, 60);
     $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierInvoice") . " " . $outputlangs->convToOutputCharset($object->ref), '', 'R');
     $posy += 1;
     if ($object->ref_supplier) {
         $posy += 4;
         $pdf->SetFont('', 'B', $default_font_size);
         $pdf->SetXY($posx, $posy);
         $pdf->SetTextColor(0, 0, 60);
         $pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefSupplier") . " : " . $object->ref_supplier, '', 'R');
         $posy += 1;
     }
     $pdf->SetFont('', '', $default_font_size - 1);
     if (!empty($conf->global->PDF_SHOW_PROJECT)) {
         $object->fetch_projet();
         if (!empty($object->project->ref)) {
             $posy += 4;
             $pdf->SetXY($posx, $posy);
             $langs->load("projects");
             $pdf->SetTextColor(0, 0, 60);
             $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Project") . " : " . (empty($object->project->ref) ? '' : $object->projet->ref), '', 'R');
         }
     }
     if ($object->date) {
         $posy += 4;
         $pdf->SetXY($posx, $posy);
         $pdf->SetTextColor(0, 0, 60);
         $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date") . " : " . dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R');
     } else {
         $posy += 4;
         $pdf->SetXY($posx, $posy);
         $pdf->SetTextColor(255, 0, 0);
         $pdf->MultiCell(100, 4, strtolower($outputlangs->transnoentities("OrderToProcess")), '', 'R');
     }
     if ($object->thirdparty->code_fournisseur) {
         $posy += 4;
         $pdf->SetXY($posx, $posy);
         $pdf->SetTextColor(0, 0, 60);
         $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierCode") . " : " . $outputlangs->transnoentities($object->thirdparty->code_fournisseur), '', 'R');
     }
     $posy += 1;
     $pdf->SetTextColor(0, 0, 60);
     // Show list of linked objects
     $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
     if ($showaddress) {
         // Sender properties
         $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
         // Show sender
         $posy = 42;
         $posx = $this->marge_gauche;
         if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
             $posx = $this->page_largeur - $this->marge_droite - 80;
         }
         $hautcadre = 40;
         // Show sender frame
         $pdf->SetTextColor(0, 0, 0);
         $pdf->SetFont('', '', $default_font_size - 2);
         $pdf->SetXY($posx, $posy - 5);
         $pdf->MultiCell(66, 5, $outputlangs->transnoentities("BillFrom") . ":", 0, 'L');
         $pdf->SetXY($posx, $posy);
         $pdf->SetFillColor(230, 230, 230);
         $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
         $pdf->SetTextColor(0, 0, 60);
         // Show sender name
         $pdf->SetXY($posx + 2, $posy + 3);
         $pdf->SetFont('', 'B', $default_font_size);
         $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
         $posy = $pdf->getY();
         // Show sender information
         $pdf->SetXY($posx + 2, $posy);
         $pdf->SetFont('', '', $default_font_size - 1);
         $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
         // If BILLING contact defined on invoice, we use it
         $usecontact = false;
         $arrayidcontact = $object->getIdContact('internal', 'BILLING');
         if (count($arrayidcontact) > 0) {
             $usecontact = true;
             $result = $object->fetch_contact($arrayidcontact[0]);
         }
         //Recipient name
         // On peut utiliser le nom de la societe du contact
         if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
             $thirdparty = $object->contact;
         } else {
             $thirdparty = $mysoc;
         }
         $carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
         $carac_client = pdf_build_address($outputlangs, $this->emetteur, $mysoc, !empty($object->contact) ? $object->contact : null, $usecontact, 'target');
         // Show recipient
         $widthrecbox = 100;
         if ($this->page_largeur < 210) {
             $widthrecbox = 84;
         }
         // To work with US executive format
         $posy = 42;
         $posx = $this->page_largeur - $this->marge_droite - $widthrecbox;
         if (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) {
             $posx = $this->marge_gauche;
         }
         // Show recipient frame
         $pdf->SetTextColor(0, 0, 0);
         $pdf->SetFont('', '', $default_font_size - 2);
         $pdf->SetXY($posx + 2, $posy - 5);
         $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("BillTo") . ":", 0, 'L');
         $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre);
         // Show recipient name
         $pdf->SetXY($posx + 2, $posy + 3);
         $pdf->SetFont('', 'B', $default_font_size);
         $pdf->MultiCell($widthrecbox, 4, $carac_client_name, 0, 'L');
         $posy = $pdf->getY();
         // Show recipient information
         $pdf->SetFont('', '', $default_font_size - 1);
         $pdf->SetXY($posx + 2, $posy);
         $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
     }
 }