/**
  *  Output record line into file
  *
  *  @param      array		$array_selected_sorted      Array with list of field to export
  *  @param      resource	$objp                       A record from a fetch with all fields from select
  *  @param      Translate	$outputlangs                Object lang to translate values
  *  @param		array		$array_types				Array with types of fields
  * 	@return		int										<0 if KO, >0 if OK
  */
 function write_record($array_selected_sorted, $objp, $outputlangs, $array_types)
 {
     global $conf;
     // Create a format for the column headings
     if (!empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) {
         $outputlangs->charset_output = 'ISO-8859-1';
         // Because Excel 5 format is ISO
     }
     // Define first row
     $this->col = 0;
     foreach ($array_selected_sorted as $code => $value) {
         if (strpos($code, ' as ') == 0) {
             $alias = str_replace(array('.', '-'), '_', $code);
         } else {
             $alias = substr($code, strpos($code, ' as ') + 4);
         }
         if (empty($alias)) {
             dol_print_error('', 'Bad value for field with code=' . $code . '. Try to redefine export.');
         }
         $newvalue = $objp->{$alias};
         $newvalue = $this->excel_clean($newvalue);
         $typefield = isset($array_types[$code]) ? $array_types[$code] : '';
         // Traduction newvalue
         if (preg_match('/^\\((.*)\\)$/i', $newvalue, $reg)) {
             $newvalue = $outputlangs->transnoentities($reg[1]);
         } else {
             $newvalue = $outputlangs->convToOutputCharset($newvalue);
         }
         if (preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/i', $newvalue)) {
             if (!empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) {
                 $formatdate = $this->workbook->addformat();
                 $formatdate->set_num_format('yyyy-mm-dd');
                 //$formatdate->set_num_format(0x0f);
                 $arrayvalue = preg_split('/[.,]/', xl_parse_date($newvalue));
                 //print "x".$arrayvalue[0].'.'.strval($arrayvalue[1]).'<br>';
                 $newvalue = strval($arrayvalue[0]) . '.' . strval($arrayvalue[1]);
                 // $newvalue=strval(36892.521); directly does not work because . will be convert into , later
                 $this->worksheet->write($this->row, $this->col, $newvalue, PHPExcel_Shared_Date::PHPToExcel($formatdate));
             } else {
                 $newvalue = dol_stringtotime($newvalue);
                 $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, PHPExcel_Shared_Date::PHPToExcel($newvalue));
                 $coord = $this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row + 1)->getCoordinate();
                 $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('yyyy-mm-dd');
             }
         } elseif (preg_match('/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]$/i', $newvalue)) {
             if (!empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) {
                 $formatdatehour = $this->workbook->addformat();
                 $formatdatehour->set_num_format('yyyy-mm-dd hh:mm:ss');
                 //$formatdatehour->set_num_format(0x0f);
                 $arrayvalue = preg_split('/[.,]/', xl_parse_date($newvalue));
                 //print "x".$arrayvalue[0].'.'.strval($arrayvalue[1]).'<br>';
                 $newvalue = strval($arrayvalue[0]) . '.' . strval($arrayvalue[1]);
                 // $newvalue=strval(36892.521); directly does not work because . will be convert into , later
                 $this->worksheet->write($this->row, $this->col, $newvalue, $formatdatehour);
             } else {
                 $newvalue = dol_stringtotime($newvalue);
                 $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, PHPExcel_Shared_Date::PHPToExcel($newvalue));
                 $coord = $this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row + 1)->getCoordinate();
                 $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('yyyy-mm-dd h:mm:ss');
             }
         } else {
             if (!empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) {
                 $this->worksheet->write($this->row, $this->col, $newvalue);
             } else {
                 if ($typefield == 'Text' || $typefield == 'TextAuto') {
                     //$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->setValueExplicit($newvalue, PHPExcel_Cell_DataType::TYPE_STRING);
                     $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, (string) $newvalue);
                     $coord = $this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row + 1)->getCoordinate();
                     $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('@');
                     $this->workbook->getActiveSheet()->getStyle($coord)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
                 } else {
                     $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, $newvalue);
                 }
             }
         }
         $this->col++;
     }
     $this->row++;
     return 0;
 }
Ejemplo n.º 2
0
/**
 *  Show bank informations for PDF generation
 *
 *  @param	PDF			$pdf            		Object PDF
 *  @param  Translate	$outputlangs     		Object lang
 *  @param  int			$curx            		X
 *  @param  int			$cury            		Y
 *  @param  Account		$account         		Bank account object
 *  @param  int			$onlynumber      		Output only number (bank+desk+key+number according to country, but without name of bank and domiciliation)
 *  @param	int			$default_font_size		Default font size
 *  @return	float                               The Y PDF position
 */
function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0, $default_font_size = 10)
{
    global $mysoc, $conf;
    $diffsizetitle = empty($conf->global->PDF_DIFFSIZE_TITLE) ? 3 : $conf->global->PDF_DIFFSIZE_TITLE;
    $diffsizecontent = empty($conf->global->PDF_DIFFSIZE_CONTENT) ? 4 : $conf->global->PDF_DIFFSIZE_CONTENT;
    $pdf->SetXY($curx, $cury);
    if (empty($onlynumber)) {
        $pdf->SetFont('', 'B', $default_font_size - $diffsizetitle);
        $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByTransferOnThisBankAccount') . ':', 0, 'L', 0);
        $cury += 4;
    }
    $outputlangs->load("banks");
    // Use correct name of bank id according to country
    $bickey = "BICNumber";
    if ($account->getCountryCode() == 'IN') {
        $bickey = "SWIFT";
    }
    // Get format of bank account according to its country
    $usedetailedbban = $account->useDetailedBBAN();
    //$onlynumber=0; $usedetailedbban=1; // For tests
    if ($usedetailedbban) {
        $savcurx = $curx;
        if (empty($onlynumber)) {
            $pdf->SetFont('', '', $default_font_size - $diffsizecontent);
            $pdf->SetXY($curx, $cury);
            $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Bank") . ': ' . $outputlangs->convToOutputCharset($account->bank), 0, 'L', 0);
            $cury += 3;
        }
        if (empty($conf->global->PDF_BANK_HIDE_NUMBER_SHOW_ONLY_BICIBAN)) {
            // Note:
            // bank = code_banque (FR), sort code (GB, IR. Example: 12-34-56)
            // desk = code guichet (FR), used only when $usedetailedbban = 1
            // number = account number
            // key = check control key used only when $usedetailedbban = 1
            if (empty($onlynumber)) {
                $pdf->line($curx + 1, $cury + 1, $curx + 1, $cury + 6);
            }
            if ($usedetailedbban == 1) {
                $fieldstoshow = array('bank', 'desk', 'number', 'key');
                if ($conf->global->BANK_SHOW_ORDER_OPTION == 1) {
                    $fieldstoshow = array('bank', 'desk', 'key', 'number');
                }
            } else {
                if ($usedetailedbban == 2) {
                    $fieldstoshow = array('bank', 'number');
                } else {
                    dol_print_error('', 'Value returned by function useDetailedBBAN not managed');
                }
            }
            foreach ($fieldstoshow as $val) {
                if ($val == 'bank') {
                    // Bank code
                    $tmplength = 18;
                    $pdf->SetXY($curx, $cury + 4);
                    $pdf->SetFont('', '', $default_font_size - 3);
                    $pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->code_banque), 0, 'C', 0);
                    $pdf->SetXY($curx, $cury + 1);
                    $curx += $tmplength;
                    $pdf->SetFont('', 'B', $default_font_size - 4);
                    $pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankCode"), 0, 'C', 0);
                    if (empty($onlynumber)) {
                        $pdf->line($curx, $cury + 1, $curx, $cury + 7);
                    }
                }
                if ($val == 'desk') {
                    // Desk
                    $tmplength = 18;
                    $pdf->SetXY($curx, $cury + 4);
                    $pdf->SetFont('', '', $default_font_size - 3);
                    $pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->code_guichet), 0, 'C', 0);
                    $pdf->SetXY($curx, $cury + 1);
                    $curx += $tmplength;
                    $pdf->SetFont('', 'B', $default_font_size - 4);
                    $pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("DeskCode"), 0, 'C', 0);
                    if (empty($onlynumber)) {
                        $pdf->line($curx, $cury + 1, $curx, $cury + 7);
                    }
                }
                if ($val == 'number') {
                    // Number
                    $tmplength = 24;
                    $pdf->SetXY($curx, $cury + 4);
                    $pdf->SetFont('', '', $default_font_size - 3);
                    $pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->number), 0, 'C', 0);
                    $pdf->SetXY($curx, $cury + 1);
                    $curx += $tmplength;
                    $pdf->SetFont('', 'B', $default_font_size - 4);
                    $pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankAccountNumber"), 0, 'C', 0);
                    if (empty($onlynumber)) {
                        $pdf->line($curx, $cury + 1, $curx, $cury + 7);
                    }
                }
                if ($val == 'key') {
                    // Key
                    $tmplength = 13;
                    $pdf->SetXY($curx, $cury + 4);
                    $pdf->SetFont('', '', $default_font_size - 3);
                    $pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->cle_rib), 0, 'C', 0);
                    $pdf->SetXY($curx, $cury + 1);
                    $curx += $tmplength;
                    $pdf->SetFont('', 'B', $default_font_size - 4);
                    $pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankAccountNumberKey"), 0, 'C', 0);
                    if (empty($onlynumber)) {
                        $pdf->line($curx, $cury + 1, $curx, $cury + 7);
                    }
                }
            }
            $curx = $savcurx;
            $cury += 8;
        }
    } else {
        $pdf->SetFont('', 'B', $default_font_size - $diffsizecontent);
        $pdf->SetXY($curx, $cury);
        $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Bank") . ': ' . $outputlangs->convToOutputCharset($account->bank), 0, 'L', 0);
        $cury += 3;
        $pdf->SetFont('', 'B', $default_font_size - $diffsizecontent);
        $pdf->SetXY($curx, $cury);
        $pdf->MultiCell(100, 3, $outputlangs->transnoentities("BankAccountNumber") . ': ' . $outputlangs->convToOutputCharset($account->number), 0, 'L', 0);
        $cury += 3;
        if ($diffsizecontent <= 2) {
            $cury += 1;
        }
    }
    $pdf->SetFont('', '', $default_font_size - $diffsizecontent);
    if (empty($onlynumber) && !empty($account->domiciliation)) {
        $pdf->SetXY($curx, $cury);
        $val = $outputlangs->transnoentities("Residence") . ': ' . $outputlangs->convToOutputCharset($account->domiciliation);
        $pdf->MultiCell(100, 3, $val, 0, 'L', 0);
        //$nboflines=dol_nboflines_bis($val,120);
        //$cury+=($nboflines*3)+2;
        $tmpy = $pdf->getStringHeight(100, $val);
        $cury += $tmpy;
    }
    if (!empty($account->proprio)) {
        $pdf->SetXY($curx, $cury);
        $val = $outputlangs->transnoentities("BankAccountOwner") . ': ' . $outputlangs->convToOutputCharset($account->proprio);
        $pdf->MultiCell(100, 3, $val, 0, 'L', 0);
        $tmpy = $pdf->getStringHeight(100, $val);
        $cury += $tmpy;
    } else {
        if (!$usedetailedbban) {
            $cury += 1;
        }
    }
    // Use correct name of bank id according to country
    $ibankey = "IBANNumber";
    if ($account->getCountryCode() == 'IN') {
        $ibankey = "IFSC";
    }
    if (!empty($account->iban)) {
        //Remove whitespaces to ensure we are dealing with the format we expect
        $ibanDisplay_temp = str_replace(' ', '', $outputlangs->convToOutputCharset($account->iban));
        $ibanDisplay = "";
        $nbIbanDisplay_temp = dol_strlen($ibanDisplay_temp);
        for ($i = 0; $i < $nbIbanDisplay_temp; $i++) {
            $ibanDisplay .= $ibanDisplay_temp[$i];
            if ($i % 4 == 3 && $i > 0) {
                $ibanDisplay .= " ";
            }
        }
        $pdf->SetFont('', 'B', $default_font_size - 3);
        $pdf->SetXY($curx, $cury);
        $pdf->MultiCell(100, 3, $outputlangs->transnoentities($ibankey) . ': ' . $ibanDisplay, 0, 'L', 0);
        $cury += 3;
    }
    if (!empty($account->bic)) {
        $pdf->SetFont('', 'B', $default_font_size - 3);
        $pdf->SetXY($curx, $cury);
        $pdf->MultiCell(100, 3, $outputlangs->transnoentities($bickey) . ': ' . $outputlangs->convToOutputCharset($account->bic), 0, 'L', 0);
    }
    return $pdf->getY();
}
Ejemplo n.º 3
0
 /**
  *	Output record line into file
  *
  *  @param     	array		$array_selected_sorted      Array with list of field to export
  *  @param     	resource	$objp                       A record from a fetch with all fields from select
  *  @param     	Translate	$outputlangs    			Object lang to translate values
  *  @param		array		$array_types				Array with types of fields
  * 	@return		int										<0 if KO, >0 if OK
  */
 function write_record($array_selected_sorted, $objp, $outputlangs, $array_types)
 {
     global $conf;
     if (!empty($conf->global->EXPORT_CSV_FORCE_CHARSET)) {
         $outputlangs->charset_output = $conf->global->EXPORT_CSV_FORCE_CHARSET;
     } else {
         $outputlangs->charset_output = 'ISO-8859-1';
     }
     $this->col = 0;
     foreach ($array_selected_sorted as $code => $value) {
         if (strpos($code, ' as ') == 0) {
             $alias = str_replace(array('.', '-'), '_', $code);
         } else {
             $alias = substr($code, strpos($code, ' as ') + 4);
         }
         if (empty($alias)) {
             dol_print_error('', 'Bad value for field with key=' . $code . '. Try to redefine export.');
         }
         $newvalue = $outputlangs->convToOutputCharset($objp->{$alias});
         // objp->$alias must be utf8 encoded as any var in memory	// newvalue is now $outputlangs->charset_output encoded
         $typefield = isset($array_types[$code]) ? $array_types[$code] : '';
         // Translation newvalue
         if (preg_match('/^\\((.*)\\)$/i', $newvalue, $reg)) {
             $newvalue = $outputlangs->transnoentities($reg[1]);
         }
         $newvalue = $this->csv_clean($newvalue, $outputlangs->charset_output);
         if (preg_match('/^Select:/i', $typefield, $reg) && ($typefield = substr($typefield, 7))) {
             $array = unserialize($typefield);
             $array = $array['options'];
             $newvalue = $array[$newvalue];
         }
         fwrite($this->handle, $newvalue . $this->separator);
         $this->col++;
     }
     fwrite($this->handle, "\n");
     return 0;
 }
 /**
  * Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0)
  *
  * @param	PDF			$pdf			PDF reference
  * @param	Translate	$outputlangs	Output langs
  * @param	array		$param			Associative array containing label content and optional parameters
  * @return	void
  */
 function addSticker(&$pdf, $outputlangs, $param)
 {
     global $mysoc, $conf;
     $textleft = $param['textleft'];
     $header = $param['textheader'];
     $footer = $param['textfooter'];
     $textright = $param['textright'];
     $code = $param['code'];
     $encoding = $param['encoding'];
     $is2d = $param['is2d'];
     // We are in a new page, then we must add a page
     if ($this->_COUNTX == 0 && $this->_COUNTY == 0 and !$this->_First == 1) {
         $pdf->AddPage();
     }
     $this->_First = 0;
     $_PosX = $this->_Margin_Left + $this->_COUNTX * ($this->_Width + $this->_X_Space);
     $_PosY = $this->_Margin_Top + $this->_COUNTY * ($this->_Height + $this->_Y_Space);
     // Define logo
     $logo = $conf->mycompany->dir_output . '/logos/' . $mysoc->logo;
     if (!is_readable($logo)) {
         $logo = '';
         if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) {
             $logo = $conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small;
         } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output . '/logos/' . $mysoc->logo)) {
             $logo = $conf->mycompany->dir_output . '/logos/' . $mysoc->logo;
         }
     }
     $xleft = 2;
     $ytop = 2;
     // Top
     if ($header != '') {
         $pdf->SetXY($_PosX + $xleft, $_PosY + 1);
         // Only 1 mm and not ytop for top text
         $pdf->Cell($this->_Width - 2 * $xleft, $this->_Line_Height, $outputlangs->convToOutputCharset($header), 0, 1, 'C');
     }
     $ytop += empty($header) ? 0 : 1 + $this->_Line_Height;
     // Define widthtouse and heighttouse
     $pageMargins = $pdf->getMargins();
     $maxwidthtouse = round($this->_Width - 2 * $xleft);
     $maxheighttouse = round($this->_Height - 2 * $ytop);
     $maxheighttouse -= empty($footer) ? 0 : 1 + $this->_Line_Height;
     $defaultratio = $maxwidthtouse / $maxheighttouse;
     $widthtouse = $maxwidthtouse;
     $heighttouse = $maxheighttouse;
     $logoHeight = $heighttouse;
     $logoWidth = $heighttouse;
     //var_dump($this->_Width.'x'.$this->_Height.' with border and scale '.$imgscale.' => max '.$maxwidthtouse.'x'.$maxheighttouse.' => We use '.$widthtouse.'x'.$heighttouse);exit;
     // Center
     if ($textright == '') {
         // Output left area
         if ($textleft == '%LOGO%' && $logo) {
             $pdf->Image($logo, $_PosX + $xleft, $_PosY + $ytop, 0, $logoHeight);
         } else {
             if ($code && !empty($encoding)) {
                 $this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX + $xleft, $_PosY + $ytop, $widthtouse, $heighttouse);
             } else {
                 $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop);
                 $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L');
             }
         }
     } else {
         if ($textleft != '' && $textright != '') {
             if (($textleft == '%LOGO%' || $textleft == '%PHOTO%' || $textleft == '%BARCODE%') && !strstr($textright, '%')) {
                 if ($textleft == '%LOGO%' && $logo) {
                     $pdf->Image($logo, $_PosX + $xleft, $_PosY + $ytop, $widthtouse / 2, 0);
                 } else {
                     if ($code && !empty($encoding)) {
                         $this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX + $xleft, $_PosY + $ytop, $widthtouse / 2, $heighttouse);
                     }
                 }
                 $pdf->SetXY($_PosX + $widthtouse / 2, $_PosY + $ytop);
                 $pdf->MultiCell($widthtouse / 2, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R');
             } else {
                 if (($textright == '%LOGO%' || $textright == '%PHOTO%' || $textright == '%BARCODE%') && !strstr($textleft, '%')) {
                     if ($textright == '%LOGO%' && $logo) {
                         $pdf->Image($logo, $_PosX + $widthtouse / 2, $_PosY + $ytop, $widthtouse / 2, 0);
                     } else {
                         if ($code && !empty($encoding)) {
                             $this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX + $widthtouse / 2, $_PosY + $ytop, $widthtouse / 2, $heighttouse);
                         }
                     }
                     $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop);
                     $pdf->MultiCell($widthtouse / 2, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L');
                 } else {
                     if ($textleft == '%LOGO%') {
                         if ($logo) {
                             $pdf->Image($logo, $_PosX + $xleft, $_PosY + $ytop, 0, $logoHeight);
                         }
                         if ($code && !empty($encoding)) {
                             $this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX + $xleft + $logoWidth + 1, $_PosY + $ytop, $widthtouse - $logoWidth - 1, $heighttouse);
                         } else {
                             $pdf->SetXY($_PosX + $xleft + $logoWidth + 1, $_PosY + $ytop);
                             $pdf->MultiCell($widthtouse - $logoWidth1 - 1, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R');
                         }
                     } else {
                         if ($textright == '%LOGO%') {
                             if ($logo) {
                                 $pdf->Image($logo, $_PosX + $xleft + $widthtouse - $logoWidth + 1, $_PosY + $ytop, 0, $logoHeight);
                             }
                             if ($code && !empty($encoding)) {
                                 $this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX + $xleft, $_PosY + $ytop, $widthtouse - $logoWidth - 1, $heighttouse);
                             } else {
                                 $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop);
                                 $pdf->MultiCell($widthtouse - $logoWidth - 1, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L');
                             }
                         } else {
                             $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop);
                             $pdf->MultiCell(round($this->_Width / 2), $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L');
                             $pdf->SetXY($_PosX + round($this->_Width / 2), $_PosY + $ytop);
                             $pdf->MultiCell(round($this->_Width / 2) - 2, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R');
                         }
                     }
                 }
             }
         } else {
             // Output right area
             if ($textright == '%LOGO%' && $logo) {
                 $pdf->Image($logo, $_PosX + $this->_Width - $widthtouse - $xleft, $_PosY + $ytop, 0, $logoHeight);
             } else {
                 if ($code && !empty($encoding)) {
                     $this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX + $this->_Width - $widthtouse - $xleft, $_PosY + $ytop, $widthtouse, $heighttouse);
                 } else {
                     $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop);
                     $pdf->MultiCell($this->_Width - $xleft, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R');
                 }
             }
         }
     }
     // Bottom
     if ($footer != '') {
         $pdf->SetXY($_PosX, $_PosY + $this->_Height - $this->_Line_Height - 1);
         $pdf->Cell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($footer), 0, 1, 'C');
     }
     //print "$_PosY+$this->_Height-$this->_Line_Height-1<br>\n";
     $this->_COUNTY++;
     if ($this->_COUNTY == $this->_Y_Number) {
         // Si on est en bas de page, on remonte le 'curseur' de position
         $this->_COUNTX++;
         $this->_COUNTY = 0;
     }
     if ($this->_COUNTX == $this->_X_Number) {
         // Si on est en bout de page, alors on repart sur une nouvelle page
         $this->_COUNTX = 0;
         $this->_COUNTY = 0;
     }
 }
Ejemplo n.º 5
0
 /**
  * On imprime une etiquette
  *
  * @param    PDF	    &$pdf		    PDF
  * @param    string     $textleft       Textleft
  * @param    string     $header         Header
  * @param    string     $footer         Footer
  * @param    Translate  $outputlangs    Output langs
  * @param    string     $textright      Text right
  * @return   void
  */
 function Add_PDF_card(&$pdf, $textleft, $header, $footer, $outputlangs, $textright = '')
 {
     global $mysoc, $conf, $langs;
     // We are in a new page, then we must add a page
     if ($this->_COUNTX == 0 and $this->_COUNTY == 0 and !$this->_First == 1) {
         $pdf->AddPage();
     }
     $this->_First = 0;
     $_PosX = $this->_Margin_Left + $this->_COUNTX * ($this->_Width + $this->_X_Space);
     $_PosY = $this->_Margin_Top + $this->_COUNTY * ($this->_Height + $this->_Y_Space);
     // Define logo
     $logo = $conf->mycompany->dir_output . '/logos/' . $mysoc->logo;
     if (!is_readable($logo)) {
         $logo = '';
         if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) {
             $logo = $conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small;
         } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output . '/logos/' . $mysoc->logo)) {
             $logo = $conf->mycompany->dir_output . '/logos/' . $mysoc->logo;
         }
     }
     // Define photo
     $photo = '';
     // Define background image
     $backgroundimage = '';
     // Print lines
     if ($this->code == "CARD") {
         $this->Tformat = $this->_Avery_Labels["CARD"];
         //$this->_Pointille($pdf,$_PosX,$_PosY,$_PosX+$this->_Width,$_PosY+$this->_Height,0.3,25);
         $this->_Croix($pdf, $_PosX, $_PosY, $_PosX + $this->_Width, $_PosY + $this->_Height, 0.1, 10);
     }
     // Background
     if ($backgroundimage) {
         $pdf->image($backgroundimage, $_PosX, $_PosY, $this->_Width, $this->_Height);
     }
     // Top
     if ($header != '') {
         if ($this->code == "CARD") {
             $pdf->SetDrawColor(128, 128, 128);
             $pdf->Line($_PosX, $_PosY + $this->_Line_Height + 1, $_PosX + $this->_Width, $_PosY + $this->_Line_Height + 1);
             $pdf->SetDrawColor(0, 0, 0);
         }
         $pdf->SetXY($_PosX, $_PosY + 1);
         $pdf->Cell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($header), 0, 1, 'C');
     }
     // Middle
     if ($textright == '') {
         if ($textleft == '%LOGO%' && $logo) {
             $this->Image($logo, $_PosX + 2, $_PosY + 3 + $this->_Line_Height, 20);
         } else {
             if ($textleft == '%PHOTO%' && $photo) {
                 $this->Image($photo, $_PosX + 2, $_PosY + 3 + $this->_Line_Height, 20);
             } else {
                 $pdf->SetXY($_PosX + 3, $_PosY + 3 + $this->_Line_Height);
                 $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L');
             }
         }
     } else {
         if ($textleft != '' && $textright != '') {
             if ($textleft == '%LOGO%' || $textleft == '%PHOTO%') {
                 if ($textleft == '%LOGO%' && $logo) {
                     $pdf->Image($logo, $_PosX + 2, $_PosY + 3 + $this->_Line_Height, 20);
                 } else {
                     if ($textleft == '%PHOTO%' && $photo) {
                         $pdf->Image($photo, $_PosX + 2, $_PosY + 3 + $this->_Line_Height, 20);
                     }
                 }
                 $pdf->SetXY($_PosX + 21, $_PosY + 3 + $this->_Line_Height);
                 $pdf->MultiCell($this->_Width - 22, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R');
             } else {
                 if ($textright == '%LOGO%' || $textright == '%PHOTO%') {
                     if ($textright == '%LOGO%' && $logo) {
                         $pdf->Image($logo, $_PosX + $this->_Width - 21, $_PosY + 3 + $this->_Line_Height, 20);
                     } else {
                         if ($textright == '%PHOTO%' && $photo) {
                             $pdf->Image($photo, $_PosX + $this->_Width - 21, $_PosY + 3 + $this->_Line_Height, 20);
                         }
                     }
                     $pdf->SetXY($_PosX + 2, $_PosY + 3 + $this->_Line_Height);
                     $pdf->MultiCell($this->_Width - 22, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L');
                 } else {
                     $pdf->SetXY($_PosX + 2, $_PosY + 3 + $this->_Line_Height);
                     $pdf->MultiCell(round($this->_Width / 2), $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L');
                     $pdf->SetXY($_PosX + round($this->_Width / 2), $_PosY + 3 + $this->_Line_Height);
                     $pdf->MultiCell(round($this->_Width / 2) - 2, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R');
                 }
             }
         } else {
             if ($textright == '%LOGO%' && $logo) {
                 $this->Image($logo, $_PosX + $this->_Width - 21, $_PosY + 1, 20);
             } else {
                 if ($textright == '%PHOTO%' && $photo) {
                     $this->Image($photo, $_PosX + $this->_Width - 21, $_PosY + 1, 20);
                 } else {
                     $pdf->SetXY($_PosX + 2, $_PosY + 3 + $this->_Line_Height);
                     $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R');
                 }
             }
         }
     }
     // Bottom
     if ($footer != '') {
         if ($this->code == "CARD") {
             $pdf->SetDrawColor(128, 128, 128);
             $pdf->Line($_PosX, $_PosY + $this->_Height - $this->_Line_Height - 2, $_PosX + $this->_Width, $_PosY + $this->_Height - $this->_Line_Height - 2);
             $pdf->SetDrawColor(0, 0, 0);
         }
         $pdf->SetXY($_PosX, $_PosY + $this->_Height - $this->_Line_Height - 1);
         $pdf->Cell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($footer), 0, 1, 'C');
     }
     //print "$_PosY+$this->_Height-$this->_Line_Height-1<br>\n";
     $this->_COUNTY++;
     if ($this->_COUNTY == $this->_Y_Number) {
         // Si on est en bas de page, on remonte le 'curseur' de position
         $this->_COUNTX++;
         $this->_COUNTY = 0;
     }
     if ($this->_COUNTX == $this->_X_Number) {
         // Si on est en bout de page, alors on repart sur une nouvelle page
         $this->_COUNTX = 0;
         $this->_COUNTY = 0;
     }
 }
Ejemplo n.º 6
0
 /**
  * Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0)
  * - %LOGO% is replace with company logo
  * - %PHOTO% is replace with photo provided as parameter
  *
  * @param	PDF			$pdf			PDF reference
  * @param	string		$textleft		Text left
  * @param	string		$header			Header
  * @param	string		$footer			Footer
  * @param	Translate	$outputlangs	Output langs
  * @param	string		$textright		Text right
  * @param	string		$photo			Photo (full path to image file used as replacement for key %PHOTOS% into left, right, header or footer text)
  * @return	void
  */
 function Add_PDF_label(&$pdf, $textleft, $header, $footer, $outputlangs, $textright = '', $photo = '')
 {
     global $mysoc, $conf, $langs;
     global $forceimgscalewidth, $forceimgscaleheight;
     $imgscalewidth = empty($forceimgscalewidth) ? 0.3 : $forceimgscalewidth;
     // Scale of image for width (1=Full width of sticker)
     $imgscaleheight = empty($forceimgscalewidth) ? 0.5 : $forceimgscalewidth;
     // Scale of image for height (1=Full height of sticker)
     // We are in a new page, then we must add a page
     if ($this->_COUNTX == 0 && $this->_COUNTY == 0 and !$this->_First == 1) {
         $pdf->AddPage();
     }
     $this->_First = 0;
     $_PosX = $this->_Margin_Left + $this->_COUNTX * ($this->_Width + $this->_X_Space);
     $_PosY = $this->_Margin_Top + $this->_COUNTY * ($this->_Height + $this->_Y_Space);
     // Define logo
     $logo = $conf->mycompany->dir_output . '/logos/' . $mysoc->logo;
     if (!is_readable($logo)) {
         $logo = '';
         if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) {
             $logo = $conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small;
         } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output . '/logos/' . $mysoc->logo)) {
             $logo = $conf->mycompany->dir_output . '/logos/' . $mysoc->logo;
         }
     }
     // Define photo
     if (!empty($photo)) {
         if (!is_readable($photo)) {
             $photo = '';
         }
     }
     // Define background image
     $backgroundimage = '';
     // Print lines
     if ($this->code == "CARD") {
         $this->Tformat = $this->_Avery_Labels["CARD"];
         //$this->_Pointille($pdf,$_PosX,$_PosY,$_PosX+$this->_Width,$_PosY+$this->_Height,0.3,25);
         $this->_Croix($pdf, $_PosX, $_PosY, $_PosX + $this->_Width, $_PosY + $this->_Height, 0.1, 10);
     }
     // Background
     if ($backgroundimage) {
         $pdf->image($backgroundimage, $_PosX, $_PosY, $this->_Width, $this->_Height);
     }
     $xleft = 2;
     $ytop = 2;
     // Top
     if ($header != '') {
         if ($this->code == "CARD") {
             $pdf->SetDrawColor(128, 128, 128);
             $pdf->Line($_PosX, $_PosY + $this->_Line_Height + 1, $_PosX + $this->_Width, $_PosY + $this->_Line_Height + 1);
             // Only 1 mm and not ytop for top text
             $pdf->SetDrawColor(0, 0, 0);
         }
         $pdf->SetXY($_PosX + $xleft, $_PosY + 1);
         // Only 1 mm and not ytop for top text
         $pdf->Cell($this->_Width - 2 * $xleft, $this->_Line_Height, $outputlangs->convToOutputCharset($header), 0, 1, 'C');
     }
     $ytop += empty($header) ? 0 : 1 + $this->_Line_Height;
     // Define widthtouse and heighttouse
     $maxwidthtouse = round(($this->_Width - 2 * $xleft) * $imgscalewidth);
     $maxheighttouse = round(($this->_Height - 2 * $ytop) * $imgscaleheight);
     $defaultratio = $maxwidthtouse / $maxheighttouse;
     $widthtouse = $maxwidthtouse;
     $heighttouse = 0;
     // old value for image
     $tmp = dol_getImageSize($photo, false);
     if ($tmp['height']) {
         $imgratio = $tmp['width'] / $tmp['height'];
         if ($imgratio >= $defaultratio) {
             $widthtouse = $maxwidthtouse;
             $heighttouse = round($widthtouse / $imgratio);
         } else {
             $heightouse = $maxheighttouse;
             $widthtouse = round($heightouse * $imgratio);
         }
     }
     //var_dump($this->_Width.'x'.$this->_Height.' with border and scale '.$imgscale.' => max '.$maxwidthtouse.'x'.$maxheighttouse.' => We use '.$widthtouse.'x'.$heighttouse);exit;
     // Center
     if ($textright == '') {
         // Output left area
         if ($textleft == '%LOGO%' && $logo) {
             $pdf->Image($logo, $_PosX + $xleft, $_PosY + $ytop, $widthtouse, $heighttouse);
         } else {
             if ($textleft == '%PHOTO%' && $photo) {
                 $pdf->Image($photo, $_PosX + $xleft, $_PosY + $ytop, $widthtouse, $heighttouse);
             } else {
                 $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop);
                 $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L');
             }
         }
     } else {
         if ($textleft != '' && $textright != '') {
             if ($textleft == '%LOGO%' || $textleft == '%PHOTO%') {
                 if ($textleft == '%LOGO%' && $logo) {
                     $pdf->Image($logo, $_PosX + $xleft, $_PosY + $ytop, $widthtouse, $heighttouse);
                 } else {
                     if ($textleft == '%PHOTO%' && $photo) {
                         $pdf->Image($photo, $_PosX + $xleft, $_PosY + $ytop, $widthtouse, $heighttouse);
                     }
                 }
                 $pdf->SetXY($_PosX + $xleft + $widthtouse + 1, $_PosY + $ytop);
                 $pdf->MultiCell($this->_Width - $xleft - $xleft - $widthtouse - 1, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R');
             } else {
                 if ($textright == '%LOGO%' || $textright == '%PHOTO%') {
                     if ($textright == '%LOGO%' && $logo) {
                         $pdf->Image($logo, $_PosX + $this->_Width - $widthtouse - $xleft, $_PosY + $ytop, $widthtouse, $heighttouse);
                     } else {
                         if ($textright == '%PHOTO%' && $photo) {
                             $pdf->Image($photo, $_PosX + $this->_Width - $widthtouse - $xleft, $_PosY + $ytop, $widthtouse, $heighttouse);
                         }
                     }
                     $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop);
                     $pdf->MultiCell($this->_Width - $widthtouse - $xleft - $xleft - 1, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L');
                 } else {
                     $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop);
                     $pdf->MultiCell(round($this->_Width / 2), $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L');
                     $pdf->SetXY($_PosX + round($this->_Width / 2), $_PosY + $ytop);
                     $pdf->MultiCell(round($this->_Width / 2) - 2, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R');
                 }
             }
         } else {
             // Output right area
             if ($textright == '%LOGO%' && $logo) {
                 $pdf->Image($logo, $_PosX + $this->_Width - $widthtouse - $xleft, $_PosY + $ytop, $widthtouse, $heighttouse);
             } else {
                 if ($textright == '%PHOTO%' && $photo) {
                     $pdf->Image($photo, $_PosX + $this->_Width - $widthtouse - $xleft, $_PosY + $ytop, $widthtouse, $heighttouse);
                 } else {
                     $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop);
                     $pdf->MultiCell($this->_Width - $xleft, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R');
                 }
             }
         }
     }
     // Bottom
     if ($footer != '') {
         if ($this->code == "CARD") {
             $pdf->SetDrawColor(128, 128, 128);
             $pdf->Line($_PosX, $_PosY + $this->_Height - $this->_Line_Height - 2, $_PosX + $this->_Width, $_PosY + $this->_Height - $this->_Line_Height - 2);
             $pdf->SetDrawColor(0, 0, 0);
         }
         $pdf->SetXY($_PosX, $_PosY + $this->_Height - $this->_Line_Height - 1);
         $pdf->Cell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($footer), 0, 1, 'C');
     }
     //print "$_PosY+$this->_Height-$this->_Line_Height-1<br>\n";
     $this->_COUNTY++;
     if ($this->_COUNTY == $this->_Y_Number) {
         // Si on est en bas de page, on remonte le 'curseur' de position
         $this->_COUNTX++;
         $this->_COUNTY = 0;
     }
     if ($this->_COUNTX == $this->_X_Number) {
         // Si on est en bout de page, alors on repart sur une nouvelle page
         $this->_COUNTX = 0;
         $this->_COUNTY = 0;
     }
 }
Ejemplo n.º 7
0
 /**
  *	Output record line into file
  *
  *  @param     	array		$array_selected_sorted      Array with list of field to export
  *  @param     	resource	$objp                       A record from a fetch with all fields from select
  *  @param     	Translate	$outputlangs    			Object lang to translate values
  * 	@return		int										<0 if KO, >0 if OK
  */
 function write_record($array_selected_sorted, $objp, $outputlangs)
 {
     global $conf;
     if (!empty($conf->global->EXPORT_CSV_FORCE_CHARSET)) {
         $outputlangs->charset_output = $conf->global->EXPORT_CSV_FORCE_CHARSET;
     } else {
         $outputlangs->charset_output = 'ISO-8859-1';
     }
     $this->col = 0;
     foreach ($array_selected_sorted as $code => $value) {
         $alias = str_replace(array('.', '-'), '_', $code);
         if (empty($alias)) {
             dol_print_error('', 'Bad value for field with key=' . $code . '. Try to redefine export.');
         }
         $newvalue = $outputlangs->convToOutputCharset($objp->{$alias});
         // Translation newvalue
         if (preg_match('/^\\((.*)\\)$/i', $newvalue, $reg)) {
             $newvalue = $outputlangs->transnoentities($reg[1]);
         }
         $newvalue = $this->csv_clean($newvalue, $outputlangs->charset_output);
         fwrite($this->handle, $newvalue . $this->separator);
         $this->col++;
     }
     fwrite($this->handle, "\n");
     return 0;
 }
Ejemplo n.º 8
0
/**
 *  Show bank informations for PDF generation
 *
 *  @param	PDF			&$pdf            		Object PDF
 *  @param  Translate	$outputlangs     		Object lang
 *  @param  int			$curx            		X
 *  @param  int			$cury            		Y
 *  @param  Account		$account         		Bank account object
 *  @param  int			$onlynumber      		Output only number
 *  @param	int			$default_font_size		Default font size
 *  @return	void
 */
function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0, $default_font_size = 10)
{
    global $mysoc, $conf;
    $pdf->SetXY($curx, $cury);
    if (empty($onlynumber)) {
        $pdf->SetFont('', 'B', $default_font_size - 3);
        $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByTransferOnThisBankAccount') . ':', 0, 'L', 0);
        $cury += 4;
    }
    $outputlangs->load("banks");
    // Get format of bank account according to its country
    $usedetailedbban = $account->useDetailedBBAN();
    //$onlynumber=0; $usedetailedbban=0; // For tests
    if ($usedetailedbban) {
        $savcurx = $curx;
        if (empty($onlynumber)) {
            $pdf->SetFont('', '', $default_font_size - 4);
            $pdf->SetXY($curx, $cury);
            $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Bank") . ': ' . $outputlangs->convToOutputCharset($account->bank), 0, 'L', 0);
            $cury += 3;
        }
        if (empty($onlynumber)) {
            $pdf->line($curx + 1, $cury + 1, $curx + 1, $cury + 8);
        }
        if ($usedetailedbban == 1) {
            $fieldstoshow = array('bank', 'desk', 'number', 'key');
            if ($conf->global->BANK_SHOW_ORDER_OPTION == 1) {
                $fieldstoshow = array('bank', 'desk', 'key', 'number');
            }
        } else {
            if ($usedetailedbban == 2) {
                $fieldstoshow = array('bank', 'number');
            } else {
                dol_print_error('', 'Value returned by function useDetailedBBAN not managed');
            }
        }
        foreach ($fieldstoshow as $val) {
            if ($val == 'bank') {
                // Bank code
                $tmplength = 18;
                $pdf->SetXY($curx, $cury + 5);
                $pdf->SetFont('', '', $default_font_size - 3);
                $pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->code_banque), 0, 'C', 0);
                $pdf->SetXY($curx, $cury + 1);
                $curx += $tmplength;
                $pdf->SetFont('', 'B', $default_font_size - 4);
                $pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankCode"), 0, 'C', 0);
                if (empty($onlynumber)) {
                    $pdf->line($curx, $cury + 1, $curx, $cury + 8);
                }
            }
            if ($val == 'desk') {
                // Desk
                $tmplength = 18;
                $pdf->SetXY($curx, $cury + 5);
                $pdf->SetFont('', '', $default_font_size - 3);
                $pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->code_guichet), 0, 'C', 0);
                $pdf->SetXY($curx, $cury + 1);
                $curx += $tmplength;
                $pdf->SetFont('', 'B', $default_font_size - 4);
                $pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("DeskCode"), 0, 'C', 0);
                if (empty($onlynumber)) {
                    $pdf->line($curx, $cury + 1, $curx, $cury + 8);
                }
            }
            if ($val == 'number') {
                // Number
                $tmplength = 24;
                $pdf->SetXY($curx, $cury + 5);
                $pdf->SetFont('', '', $default_font_size - 3);
                $pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->number), 0, 'C', 0);
                $pdf->SetXY($curx, $cury + 1);
                $curx += $tmplength;
                $pdf->SetFont('', 'B', $default_font_size - 4);
                $pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankAccountNumber"), 0, 'C', 0);
                if (empty($onlynumber)) {
                    $pdf->line($curx, $cury + 1, $curx, $cury + 8);
                }
            }
            if ($val == 'key') {
                // Key
                $tmplength = 13;
                $pdf->SetXY($curx, $cury + 5);
                $pdf->SetFont('', '', $default_font_size - 3);
                $pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($account->cle_rib), 0, 'C', 0);
                $pdf->SetXY($curx, $cury + 1);
                $curx += $tmplength;
                $pdf->SetFont('', 'B', $default_font_size - 4);
                $pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities("BankAccountNumberKey"), 0, 'C', 0);
                if (empty($onlynumber)) {
                    $pdf->line($curx, $cury + 1, $curx, $cury + 8);
                }
            }
        }
        $curx = $savcurx;
        $cury += 10;
    } else {
        $pdf->SetFont('', 'B', 6);
        $pdf->SetXY($curx, $cury);
        $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Bank") . ': ' . $outputlangs->convToOutputCharset($account->bank), 0, 'L', 0);
        $cury += 3;
        $pdf->SetFont('', 'B', 6);
        $pdf->SetXY($curx, $cury);
        $pdf->MultiCell(100, 3, $outputlangs->transnoentities("BankAccountNumber") . ': ' . $outputlangs->convToOutputCharset($account->number), 0, 'L', 0);
        $cury += 3;
    }
    // Use correct name of bank id according to country
    $ibankey = "IBANNumber";
    $bickey = "BICNumber";
    if ($account->getCountryCode() == 'IN') {
        $ibankey = "IFSC";
    }
    if ($account->getCountryCode() == 'IN') {
        $bickey = "SWIFT";
    }
    $pdf->SetFont('', '', 6);
    if (empty($onlynumber) && !empty($account->domiciliation)) {
        $pdf->SetXY($curx, $cury);
        $val = $outputlangs->transnoentities("Residence") . ': ' . $outputlangs->convToOutputCharset($account->domiciliation);
        $pdf->MultiCell(100, 3, $val, 0, 'L', 0);
        $nboflines = dol_nboflines_bis($val, 120);
        //print $nboflines;exit;
        $cury += $nboflines * 2 + 2;
    } else {
        if (!$usedetailedbban) {
            $cury += 1;
        }
    }
    $pdf->SetXY($curx, $cury);
    $pdf->MultiCell(100, 3, $outputlangs->transnoentities($ibankey) . ': ' . $outputlangs->convToOutputCharset($account->iban), 0, 'L', 0);
    $pdf->SetXY($curx, $cury + 3);
    $pdf->MultiCell(100, 3, $outputlangs->transnoentities($bickey) . ': ' . $outputlangs->convToOutputCharset($account->bic), 0, 'L', 0);
    return $pdf->getY();
}
 /**
  *  Show top header of page.
  *
  * 	@param	PDF			$pdf     		Object PDF
  *  @param  Translate	$outputlangs	Object lang for output
  * 	@param	int			$pagenb			Page nb
  *  @return	void
  */
 function _pagehead(&$pdf, $outputlangs, $pagenb)
 {
     global $conf, $langs;
     // Do not add the BACKGROUND as this is a report
     //pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
     // New page
     $pdf->AddPage();
     // Show title
     $pdf->SetFont('', 'B', 10);
     $pdf->SetXY($this->marge_gauche, $this->marge_haute);
     $pdf->MultiCell(120, 1, $outputlangs->convToOutputCharset($this->title), 0, 'L', 0);
     // Show page nb only on iso languages (so default Helvetica font)
     if (pdf_getPDFFont($outputlangs) == 'Helvetica') {
         $pdf->SetXY($this->page_largeur - $this->marge_droite - 40, $this->marge_haute);
         $pdf->MultiCell(40, 1, $pagenb . '/' . $pdf->getAliasNbPages(), 0, 'R', 0);
     }
     $y = $pdf->GetY() + 2;
     $pdf->Rect($this->marge_gauche, $y, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $this->page_hauteur - $this->marge_haute - $this->marge_basse);
     $y = $pdf->GetY() + 1;
     return $y;
 }