/** * Define array with couple subtitution key => subtitution value * * @param $mysoc * @param $outputlangs Language object for output */ function get_substitutionarray_mysoc($mysoc,$outputlangs) { global $conf; if (empty($mysoc->forme_juridique) && ! empty($mysoc->forme_juridique_code)) { $mysoc->forme_juridique=getFormeJuridiqueLabel($mysoc->forme_juridique_code); } $logotouse=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small; return array( 'mycompany_logo'=>$logotouse, 'mycompany_name'=>$mysoc->name, 'mycompany_email'=>$mysoc->email, 'mycompany_phone'=>$mysoc->phone, 'mycompany_fax'=>$mysoc->fax, 'mycompany_address'=>$mysoc->address, 'mycompany_zip'=>$mysoc->zip, 'mycompany_town'=>$mysoc->town, 'mycompany_country'=>$outputlangs->transnoentitiesnoconv("Country".$mysoc->pays_code), 'mycompany_country_code'=>$mysoc->pays_code, 'mycompany_web'=>$mysoc->url, 'mycompany_juridicalstatus'=>$mysoc->forme_juridique, 'mycompany_capital'=>$mysoc->capital, 'mycompany_barcode'=>$mysoc->gencod, 'mycompany_idprof1'=>$mysoc->idprof1, 'mycompany_idprof2'=>$mysoc->idprof2, 'mycompany_idprof3'=>$mysoc->idprof3, 'mycompany_idprof4'=>$mysoc->idprof4, 'mycompany_vatnumber'=>$mysoc->tva_intra, 'mycompany_note'=>$mysoc->note ); }
/** * Show footer of company in HTML pages * * @param $fromcompany * @param $langs */ function html_print_paypal_footer($fromcompany,$langs) { global $conf; // Juridical status $line1=""; if ($fromcompany->forme_juridique_code) { $line1.=($line1?" - ":"").$langs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code)); } // Capital if ($fromcompany->capital) { $line1.=($line1?" - ":"").$langs->transnoentities("CapitalOf",$fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->monnaie); } // Prof Id 1 if ($fromcompany->idprof1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->idprof2)) { $field=$langs->transcountrynoentities("ProfId1",$fromcompany->pays_code); if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; $line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof1); } // Prof Id 2 if ($fromcompany->idprof2) { $field=$langs->transcountrynoentities("ProfId2",$fromcompany->pays_code); if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; $line1.=($line1?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof2); } // Second line of company infos $line2=""; // Prof Id 3 if ($fromcompany->idprof3) { $field=$langs->transcountrynoentities("ProfId3",$fromcompany->pays_code); if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; $line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof3); } // Prof Id 4 if ($fromcompany->idprof4) { $field=$langs->transcountrynoentities("ProfId4",$fromcompany->pays_code); if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; $line2.=($line2?" - ":"").$field.": ".$langs->convToOutputCharset($fromcompany->idprof4); } // IntraCommunautary VAT if ($fromcompany->tva_intra != '') { $line2.=($line2?" - ":"").$langs->transnoentities("VATIntraShort").": ".$langs->convToOutputCharset($fromcompany->tva_intra); } print '<br><br><hr>'."\n"; print '<center><font style="font-size: 10px;">'."\n"; print $fromcompany->nom.'<br>'; print $line1.'<br>'; print $line2; print '</font></center>'."\n"; }
/** * Show footer of page for PDF generation * * @param PDF $pdf The PDF factory * @param Translate $outputlangs Object lang for output * @param string $paramfreetext Constant name of free text * @param Societe $fromcompany Object company * @param int $marge_basse Margin bottom we use for the autobreak * @param int $marge_gauche Margin left (no more used) * @param int $page_hauteur Page height (no more used) * @param Object $object Object shown in PDF * @param int $showdetails Show company details into footer. This param seems to not be used by standard version. (1=Show address, 2=Show managers, 3=Both) * @param int $hidefreetext 1=Hide free text, 0=Show free text * @return int Return height of bottom margin including footer text */ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails = 0, $hidefreetext = 0) { global $conf, $user; $outputlangs->load("dict"); $line = ''; $dims = $pdf->getPageDimensions(); // Line of free text if (empty($hidefreetext) && !empty($conf->global->{$paramfreetext})) { // Make substitution $substitutionarray = array('__FROM_NAME__' => $fromcompany->name, '__FROM_EMAIL__' => $fromcompany->email, '__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_HT__' => $object->total_ht, '__TOTAL_VAT__' => $object->total_vat); complete_substitutions_array($substitutionarray, $outputlangs, $object); $newfreetext = make_substitutions($conf->global->{$paramfreetext}, $substitutionarray); $line .= $outputlangs->convToOutputCharset($newfreetext); } // First line of company infos $line1 = ""; $line2 = ""; $line3 = ""; $line4 = ""; if ($showdetails) { // Company name if ($fromcompany->name) { $line1 .= ($line1 ? " - " : "") . $outputlangs->transnoentities("RegisteredOffice") . ": " . $fromcompany->name; } // Address if ($fromcompany->address) { $line1 .= ($line1 ? " - " : "") . $fromcompany->address; } // Zip code if ($fromcompany->zip) { $line1 .= ($line1 ? " - " : "") . $fromcompany->zip; } // Town if ($fromcompany->town) { $line1 .= ($line1 ? " " : "") . $fromcompany->town; } // Phone if ($fromcompany->phone) { $line1 .= ($line1 ? " - " : "") . $outputlangs->transnoentities("Phone") . ": " . $fromcompany->phone; } // Fax if ($fromcompany->fax) { $line1 .= ($line1 ? " - " : "") . $outputlangs->transnoentities("Fax") . ": " . $fromcompany->fax; } // URL if ($fromcompany->url) { $line2 .= ($line2 ? " - " : "") . $fromcompany->url; } // Email if ($fromcompany->email) { $line2 .= ($line2 ? " - " : "") . $fromcompany->email; } } if ($showdetails || $fromcompany->country_code == 'DE') { // Managers if ($fromcompany->managers) { $line2 .= ($line2 ? " - " : "") . $fromcompany->managers; } } // Line 3 of company infos // Juridical status if ($fromcompany->forme_juridique_code) { $line3 .= ($line3 ? " - " : "") . $outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code)); } // Capital if ($fromcompany->capital) { $tmpamounttoshow = price2num($fromcompany->capital); // This field is a free string if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) { $line3 .= ($line3 ? " - " : "") . $outputlangs->transnoentities("CapitalOf", price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency)); } else { $line3 .= ($line3 ? " - " : "") . $outputlangs->transnoentities("CapitalOf", $tmpamounttoshow, $outputlangs); } } // Prof Id 1 if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) { $field = $outputlangs->transcountrynoentities("ProfId1", $fromcompany->country_code); if (preg_match('/\\((.*)\\)/i', $field, $reg)) { $field = $reg[1]; } $line3 .= ($line3 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof1); } // Prof Id 2 if ($fromcompany->idprof2) { $field = $outputlangs->transcountrynoentities("ProfId2", $fromcompany->country_code); if (preg_match('/\\((.*)\\)/i', $field, $reg)) { $field = $reg[1]; } $line3 .= ($line3 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof2); } // Line 4 of company infos // Prof Id 3 if ($fromcompany->idprof3) { $field = $outputlangs->transcountrynoentities("ProfId3", $fromcompany->country_code); if (preg_match('/\\((.*)\\)/i', $field, $reg)) { $field = $reg[1]; } $line4 .= ($line4 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof3); } // Prof Id 4 if ($fromcompany->idprof4) { $field = $outputlangs->transcountrynoentities("ProfId4", $fromcompany->country_code); if (preg_match('/\\((.*)\\)/i', $field, $reg)) { $field = $reg[1]; } $line4 .= ($line4 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof4); } // IntraCommunautary VAT if ($fromcompany->tva_intra != '') { $line4 .= ($line4 ? " - " : "") . $outputlangs->transnoentities("VATIntraShort") . ": " . $outputlangs->convToOutputCharset($fromcompany->tva_intra); } $pdf->SetFont('', '', 7); $pdf->SetDrawColor(224, 224, 224); // The start of the bottom of this page footer is positioned according to # of lines $freetextheight = 0; if ($line) { //$line="eee<br>\nfd<strong>sf</strong>sdf<br>\nghfghg<br>"; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { $width = 20000; $align = 'L'; // By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text. if (!empty($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT)) { $width = 200; $align = 'C'; } $freetextheight = $pdf->getStringHeight($width, $line); } else { $freetextheight = pdfGetHeightForHtmlContent($pdf, dol_htmlentitiesbr($line, 1, 'UTF-8', 0)); // New method (works for HTML content) //print '<br>'.$freetextheight;exit; } } $marginwithfooter = $marge_basse + $freetextheight + (!empty($line1) ? 3 : 0) + (!empty($line2) ? 3 : 0) + (!empty($line3) ? 3 : 0) + (!empty($line4) ? 3 : 0); $posy = $marginwithfooter + 0; if ($line) { $pdf->SetXY($dims['lm'], -$posy); if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { $pdf->MultiCell(0, 3, $line, 0, $align, 0); } else { $pdf->writeHTMLCell($pdf->page_largeur - $pdf->margin_left - $pdf->margin_right, $freetextheight, $dims['lm'], $dims['hk'] - $marginwithfooter, dol_htmlentitiesbr($line, 1, 'UTF-8', 0)); } $posy -= $freetextheight; } $pdf->SetY(-$posy); $pdf->line($dims['lm'], $dims['hk'] - $posy, $dims['wk'] - $dims['rm'], $dims['hk'] - $posy); $posy--; if (!empty($line1)) { $pdf->SetFont('', 'B', 7); $pdf->SetXY($dims['lm'], -$posy); $pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line1, 0, 'C', 0); $posy -= 3; $pdf->SetFont('', '', 7); } if (!empty($line2)) { $pdf->SetFont('', 'B', 7); $pdf->SetXY($dims['lm'], -$posy); $pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line2, 0, 'C', 0); $posy -= 3; $pdf->SetFont('', '', 7); } if (!empty($line3)) { $pdf->SetXY($dims['lm'], -$posy); $pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line3, 0, 'C', 0); } if (!empty($line4)) { $posy -= 3; $pdf->SetXY($dims['lm'], -$posy); $pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line4, 0, 'C', 0); } // Show page nb only on iso languages (so default Helvetica font) if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { $pdf->SetXY(-20, -$posy); //print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit; if (empty($conf->global->MAIN_USE_FPDF)) { $pdf->MultiCell(13, 2, $pdf->PageNo() . '/' . $pdf->getAliasNbPages(), 0, 'R', 0); } else { $pdf->MultiCell(13, 2, $pdf->PageNo() . '/{nb}', 0, 'R', 0); } } return $marginwithfooter; }
/** * Show footer of company in HTML pages * * @param Societe $fromcompany Third party * @param Translate $langs Output language * @return void */ function html_print_paybox_footer($fromcompany, $langs) { global $conf; // Juridical status $line1 = ""; if ($fromcompany->forme_juridique_code) { $line1 .= ($line1 ? " - " : "") . getFormeJuridiqueLabel($fromcompany->forme_juridique_code); } // Capital if ($fromcompany->capital) { $line1 .= ($line1 ? " - " : "") . $langs->transnoentities("CapitalOf", $fromcompany->capital) . " " . $langs->transnoentities("Currency" . $conf->currency); } // Prof Id 1 if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) { $field = $langs->transcountrynoentities("ProfId1", $fromcompany->country_code); if (preg_match('/\\((.*)\\)/i', $field, $reg)) { $field = $reg[1]; } $line1 .= ($line1 ? " - " : "") . $field . ": " . $fromcompany->idprof1; } // Prof Id 2 if ($fromcompany->idprof2) { $field = $langs->transcountrynoentities("ProfId2", $fromcompany->country_code); if (preg_match('/\\((.*)\\)/i', $field, $reg)) { $field = $reg[1]; } $line1 .= ($line1 ? " - " : "") . $field . ": " . $fromcompany->idprof2; } // Second line of company infos $line2 = ""; // Prof Id 3 if ($fromcompany->idprof3) { $field = $langs->transcountrynoentities("ProfId3", $fromcompany->country_code); if (preg_match('/\\((.*)\\)/i', $field, $reg)) { $field = $reg[1]; } $line2 .= ($line2 ? " - " : "") . $field . ": " . $fromcompany->idprof3; } // Prof Id 4 if ($fromcompany->idprof4) { $field = $langs->transcountrynoentities("ProfId4", $fromcompany->country_code); if (preg_match('/\\((.*)\\)/i', $field, $reg)) { $field = $reg[1]; } $line2 .= ($line2 ? " - " : "") . $field . ": " . $fromcompany->idprof4; } // IntraCommunautary VAT if ($fromcompany->tva_intra != '') { $line2 .= ($line2 ? " - " : "") . $langs->transnoentities("VATIntraShort") . ": " . $fromcompany->tva_intra; } print '<br><br><hr>' . "\n"; print '<div class="center"><font style="font-size: 10px;">' . "\n"; print $fromcompany->name . '<br>'; print $line1 . '<br>'; print $line2; print '</font></div>' . "\n"; }
/** * Show footer of page for PDF generation * * @param PDF &$pdf The PDF factory * @param Translate $outputlangs Object lang for output * @param string $paramfreetext Constant name of free text * @param Societe $fromcompany Object company * @param int $marge_basse Margin bottom * @param int $marge_gauche Margin left * @param int $page_hauteur Page height * @param Object $object Object shown in PDF * @param int $showdetails Show company details * @return void */ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails = 0) { global $conf, $user; $outputlangs->load("dict"); $line = ''; // Line of free text if (!empty($conf->global->{$paramfreetext})) { // Make substitution $substitutionarray = array('__FROM_NAME__' => $fromcompany->nom, '__FROM_EMAIL__' => $fromcompany->email, '__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_HT__' => $object->total_ht, '__TOTAL_VAT__' => $object->total_vat); complete_substitutions_array($substitutionarray, $outputlangs, $object); $newfreetext = make_substitutions($conf->global->{$paramfreetext}, $substitutionarray); $line .= $outputlangs->convToOutputCharset($newfreetext); } // First line of company infos if ($showdetails) { $line1 = ""; // Company name if ($fromcompany->name) { $line1 .= ($line1 ? " - " : "") . $outputlangs->transnoentities("RegisteredOffice") . ": " . $fromcompany->name; } // Address if ($fromcompany->address) { $line1 .= ($line1 ? " - " : "") . $fromcompany->address; } // Zip code if ($fromcompany->zip) { $line1 .= ($line1 ? " - " : "") . $fromcompany->zip; } // Town if ($fromcompany->town) { $line1 .= ($line1 ? " " : "") . $fromcompany->town; } // Phone if ($fromcompany->phone) { $line1 .= ($line1 ? " - " : "") . $outputlangs->transnoentities("Phone") . ": " . $fromcompany->phone; } // Fax if ($fromcompany->fax) { $line1 .= ($line1 ? " - " : "") . $outputlangs->transnoentities("Fax") . ": " . $fromcompany->fax; } $line2 = ""; // URL if ($fromcompany->url) { $line2 .= ($line2 ? " - " : "") . $fromcompany->url; } // Email if ($fromcompany->email) { $line2 .= ($line2 ? " - " : "") . $fromcompany->email; } } // Line 3 of company infos $line3 = ""; // Juridical status if ($fromcompany->forme_juridique_code) { $line3 .= ($line3 ? " - " : "") . $outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code)); } // Capital if ($fromcompany->capital) { $line3 .= ($line3 ? " - " : "") . $outputlangs->transnoentities("CapitalOf", $fromcompany->capital) . " " . $outputlangs->transnoentities("Currency" . $conf->currency); } // Prof Id 1 if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) { $field = $outputlangs->transcountrynoentities("ProfId1", $fromcompany->country_code); if (preg_match('/\\((.*)\\)/i', $field, $reg)) { $field = $reg[1]; } $line3 .= ($line3 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof1); } // Prof Id 2 if ($fromcompany->idprof2) { $field = $outputlangs->transcountrynoentities("ProfId2", $fromcompany->country_code); if (preg_match('/\\((.*)\\)/i', $field, $reg)) { $field = $reg[1]; } $line3 .= ($line3 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof2); } // Line 4 of company infos $line4 = ""; // Prof Id 3 if ($fromcompany->idprof3) { $field = $outputlangs->transcountrynoentities("ProfId3", $fromcompany->country_code); if (preg_match('/\\((.*)\\)/i', $field, $reg)) { $field = $reg[1]; } $line4 .= ($line4 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof3); } // Prof Id 4 if ($fromcompany->idprof4) { $field = $outputlangs->transcountrynoentities("ProfId4", $fromcompany->country_code); if (preg_match('/\\((.*)\\)/i', $field, $reg)) { $field = $reg[1]; } $line4 .= ($line4 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof4); } // IntraCommunautary VAT if ($fromcompany->tva_intra != '') { $line4 .= ($line4 ? " - " : "") . $outputlangs->transnoentities("VATIntraShort") . ": " . $outputlangs->convToOutputCharset($fromcompany->tva_intra); } $pdf->SetFont('', '', 7); $pdf->SetDrawColor(224, 224, 224); // On positionne le debut du bas de page selon nbre de lignes de ce bas de page $nbofline = dol_nboflines_bis($line, 0, $outputlangs->charset_output); //print 'nbofline='.$nbofline; exit; //print 'e'.$line.'t'.dol_nboflines($line);exit; $posy = $marge_basse + $nbofline * 3 + (!empty($line1) ? 3 : 0) + (!empty($line2) ? 3 : 0) + (!empty($line3) ? 3 : 0) + (!empty($line4) ? 3 : 0); if ($line) { $pdf->SetXY($marge_gauche, -$posy); $width = 20000; $align = 'L'; // By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text. if ($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT) { $width = 200; $align = 'C'; } $pdf->MultiCell($width, 3, $line, 0, $align, 0); $posy -= $nbofline * 3; // 6 of ligne + 3 of MultiCell } $pdf->SetY(-$posy); $pdf->line($marge_gauche, $page_hauteur - $posy, 200, $page_hauteur - $posy); $posy--; if (!empty($line1)) { $pdf->SetFont('', 'B', 7); $pdf->SetXY($marge_gauche, -$posy); $pdf->MultiCell(200, 2, $line1, 0, 'C', 0); $posy -= 3; $pdf->SetFont('', '', 7); } if (!empty($line2)) { $pdf->SetFont('', 'B', 7); $pdf->SetXY($marge_gauche, -$posy); $pdf->MultiCell(200, 2, $line2, 0, 'C', 0); $posy -= 3; $pdf->SetFont('', '', 7); } if (!empty($line3)) { $pdf->SetXY($marge_gauche, -$posy); $pdf->MultiCell(200, 2, $line3, 0, 'C', 0); } if (!empty($line4)) { $posy -= 3; $pdf->SetXY($marge_gauche, -$posy); $pdf->MultiCell(200, 2, $line4, 0, 'C', 0); } // Show page nb only on iso languages (so default Helvetica font) if (pdf_getPDFFont($outputlangs) == 'Helvetica') { $pdf->SetXY(-20, -$posy); $pdf->MultiCell(11, 2, $pdf->PageNo() . '/' . $pdf->getAliasNbPages(), 0, 'R', 0); //print 'xxx'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit; } }
print '</table>'; print '<br>'; // Identifiants de la societe (propre au pays) print '<form name="formsoc" method="post">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<table class="noborder" width="100%">'; print '<tr class="liste_titre"><td>' . $langs->trans("CompanyIds") . '</td><td>' . $langs->trans("Value") . '</td></tr>'; $var = true; // Capital $var = !$var; print '<tr ' . $bc[$var] . '><td width="35%">' . $langs->trans("Capital") . '</td><td>'; print $conf->global->MAIN_INFO_CAPITAL . '</td></tr>'; // Forme juridique $var = !$var; print '<tr ' . $bc[$var] . '><td width="35%">' . $langs->trans("JuridicalStatus") . '</td><td>'; print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE); print '</td></tr>'; // ProfId1 if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') { $var = !$var; print '<tr ' . $bc[$var] . '><td width="35%">' . $langs->transcountry("ProfId1", $mysoc->country_code) . '</td><td>'; if (!empty($conf->global->MAIN_INFO_SIREN)) { print $conf->global->MAIN_INFO_SIREN; if ($mysoc->country_code == 'FR') { print ' <a href="http://avis-situation-sirene.insee.fr/avisitu/jsp/avis.jsp" target="_blank">' . $langs->trans("Check") . '</a>'; } } else { print ' '; } print '</td></tr>'; }