PDF works with us letter format

This commit is contained in:
Laurent Destailleur 2011-08-31 14:42:47 +00:00
parent a58f41880d
commit 1aaf65c257
22 changed files with 374 additions and 204 deletions

View File

@ -453,7 +453,10 @@ foreach ($conf->file->dol_document_root as $dirroot)
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
if ($module->type == 'pdf')
{
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1);

View File

@ -248,7 +248,10 @@ if (is_resource($handle))
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
if ($module->type == 'pdf')
{
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1);

View File

@ -509,7 +509,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip.='<br>'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);

View File

@ -103,7 +103,7 @@ if ($action == 'specimenfacture') // For invoices
$facture = new FactureFournisseur($db);
$facture->initAsSpecimen();
$facture->thirdparty=$specimenthirdparty;
$facture->thirdparty=$specimenthirdparty; // Define who should has build the invoice (so the supplier)
// Charge le modele
$dir = "/includes/modules/supplier_invoice/pdf/";

View File

@ -474,8 +474,11 @@ foreach ($conf->file->dol_document_root as $dirroot)
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
$htmltooltip.='<br>'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
if ($module->type == 'pdf')
{
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1);
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1);

View File

@ -2162,26 +2162,40 @@ class Propal extends CommonObject
$line->subprice=100;
$line->price=100;
$line->tva_tx=19.6;
$line->total_ht=100;
$line->total_ttc=119.6;
$line->total_tva=19.6;
$line->localtax1_tx=0;
$line->localtax2_tx=0;
if ($xnbp == 2)
{
$line->total_ht=50;
$line->total_ttc=59.8;
$line->total_tva=9.8;
$line->remise_percent=50;
}
else
{
$line->total_ht=100;
$line->total_ttc=119.6;
$line->total_tva=19.6;
$line->remise_percent=00;
}
$prodid = rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
$this->lines[$xnbp]=$line;
$this->total_ht += $line->total_ht;
$this->total_tva += $line->total_tva;
$this->total_ttc += $line->total_ttc;
$xnbp++;
}
$this->amount_ht = $xnbp*100;
$this->total_ht = $xnbp*100;
$this->total_tva = $xnbp*19.6;
$this->total_ttc = $xnbp*119.6;
}
/**
* \brief Charge indicateurs this->nb de tableau de bord
* \return int <0 si ko, >0 si ok
* Charge indicateurs this->nb de tableau de bord
*
* @return int <0 si ko, >0 si ok
*/
function load_state_board()
{

View File

@ -453,7 +453,7 @@ class Commande extends CommonObject
function cloture($user)
{
global $conf, $langs;
$error=0;
if ($user->rights->commande->valider)
@ -2585,7 +2585,7 @@ class Commande extends CommonObject
{
global $user,$langs,$conf;
dol_syslog("Commande::initAsSpecimen");
dol_syslog(get_class($this)."::initAsSpecimen");
// Charge tableau des produits prodids
$prodids = array();
@ -2630,28 +2630,38 @@ class Commande extends CommonObject
$line->subprice=100;
$line->price=100;
$line->tva_tx=19.6;
$line->total_ht=100;
$line->total_ttc=119.6;
$line->total_tva=19.6;
$line->remise_percent=0;
if ($xnbp == 2)
{
$line->total_ht=50;
$line->total_ttc=59.8;
$line->total_tva=9.8;
$line->remise_percent=50;
}
else
{
$line->total_ht=100;
$line->total_ttc=119.6;
$line->total_tva=19.6;
$line->remise_percent=00;
}
$prodid = rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
$this->lines[$xnbp]=$line;
$xnbp++;
}
$this->total_ht += $line->total_ht;
$this->total_tva += $line->total_tva;
$this->total_ttc += $line->total_ttc;
$this->amount_ht = $xnbp*100;
$this->total_ht = $xnbp*100;
$this->total_tva = $xnbp*19.6;
$this->total_ttc = $xnbp*119.6;
$xnbp++;
}
}
/**
* \brief Charge indicateurs this->nb de tableau de bord
* \return int <0 si ko, >0 si ok
* Charge indicateurs this->nb de tableau de bord
*
* @return int <0 si ko, >0 si ok
*/
function load_state_board()
{
@ -2811,8 +2821,9 @@ class OrderLine
/**
* \brief Constructeur d'objets ligne de commande
* \param DB handler d'acces base de donnee
* Constructor
*
* @param DB handler d'acces base de donnee
*/
function OrderLine($DB)
{
@ -2820,8 +2831,9 @@ class OrderLine
}
/**
* \brief Load line order
* \param rowid id line order
* Load line order
*
* @param rowid id line order
*/
function fetch($rowid)
{
@ -2882,6 +2894,7 @@ class OrderLine
/**
* Delete line in database
*
* @return int <0 si ko, >0 si ok
*/
function delete()
@ -2912,9 +2925,10 @@ class OrderLine
}
/**
* \brief Insert line into database
* \param notrigger 1 = disable triggers
* \return int <0 if KO, >0 if OK
* Insert line into database
*
* @param notrigger 1 = disable triggers
* @return int <0 if KO, >0 if OK
*/
function insert($notrigger=0)
{
@ -3010,6 +3024,7 @@ class OrderLine
/**
* Mise a jour de l'objet ligne de commande en base
*
* @return int <0 si ko, >0 si ok
*/
function update($notrigger=0)
@ -3090,8 +3105,9 @@ class OrderLine
}
/**
* \brief Mise a jour de l'objet ligne de commande en base
* \return int <0 si ko, >0 si ok
* Mise a jour de l'objet ligne de commande en base
*
* @return int <0 si ko, >0 si ok
*/
function update_total()
{

View File

@ -3053,6 +3053,8 @@ class Facture extends CommonObject
{
global $user,$langs,$conf;
$now=dol_now();
$prodids = array();
$sql = "SELECT rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."product";
@ -3075,7 +3077,7 @@ class Facture extends CommonObject
$this->ref = 'SPECIMEN';
$this->specimen=1;
$this->socid = 1;
$this->date = time();
$this->date = $now;
$this->date_lim_reglement=$this->date+3600*24*30;
$this->cond_reglement_id = 1;
$this->cond_reglement_code = 'RECEP';
@ -3096,17 +3098,32 @@ class Facture extends CommonObject
$line->tva_tx=19.6;
$line->localtax1_tx=0;
$line->localtax2_tx=0;
$line->remise_percent=10;
$line->total_ht=90;
$line->total_ttc=107.64; // 90 * 1.196
$line->total_tva=17.64;
if ($xnbp == 2)
{
$line->total_ht=50;
$line->total_ttc=59.8;
$line->total_tva=9.8;
$line->remise_percent=50;
}
else
{
$line->total_ht=100;
$line->total_ttc=119.6;
$line->total_tva=19.6;
$line->remise_percent=00;
}
$prodid = rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
$this->lines[$xnbp]=$line;
$this->total_ht += $line->total_ht;
$this->total_tva += $line->total_tva;
$this->total_ttc += $line->total_ttc;
$xnbp++;
}
// Add a line "offered"
$line=new FactureLigne($this->db);
$line->desc=$langs->trans("Description")." ".$xnbp;
@ -3125,17 +3142,14 @@ class Facture extends CommonObject
$this->lines[$xnbp]=$line;
$xnbp++;
$this->amount_ht = $xnbp*90;
$this->total_ht = $xnbp*90;
$this->total_tva = $xnbp*90*0.196;
$this->total_ttc = $xnbp*90*1.196;
$xnbp++;
}
/**
* \brief Charge indicateurs this->nb de tableau de bord
* \return int <0 si ko, >0 si ok
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @param user Objet user
* @return int <0 if KO, >0 if OK
*/
function load_state_board()
{

View File

@ -242,7 +242,7 @@ class Expedition extends CommonObject
$result=$interface->run_triggers('SHIPPING_CREATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
$this->db->commit();
return $this->id;
}
@ -377,7 +377,7 @@ class Expedition extends CommonObject
$file = $conf->expedition->dir_output . "/" .get_exdir($expedition->id,2) . "/" . $this->id.".pdf";
$this->pdf_filename = $file;
// Tracking url
$this->GetUrlTrackingStatus($obj->tracking_number);
@ -415,7 +415,7 @@ class Expedition extends CommonObject
function valid($user)
{
global $conf, $langs;
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
dol_syslog("Expedition::valid");
@ -478,7 +478,7 @@ class Expedition extends CommonObject
if (! $error && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SHIPMENT)
{
require_once DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php";
$langs->load("agenda");
// Loop on each product line to add a stock movement
@ -760,7 +760,7 @@ class Expedition extends CommonObject
function delete()
{
global $conf, $langs, $user;
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
$this->db->begin();
@ -805,14 +805,14 @@ class Expedition extends CommonObject
}
}
}
// Call triggers
include_once(DOL_DOCUMENT_ROOT."/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('SHIPPING_DELETE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// End call triggers
// TODO il faut incrementer le stock si on supprime une expedition validee
return 1;
}
@ -908,9 +908,9 @@ class Expedition extends CommonObject
global $langs;
$result='';
$url = DOL_URL_ROOT.'/expedition/fiche.php?id='.$this->id;
if ($short) return $url;
$linkstart = '<a href="'.$url.'">';
@ -979,6 +979,8 @@ class Expedition extends CommonObject
{
global $user,$langs,$conf;
$now=dol_now();
dol_syslog("Expedition::initAsSpecimen");
// Charge tableau des produits prodids
@ -1004,14 +1006,16 @@ class Expedition extends CommonObject
// Initialise parametres
$this->id=0;
$this->ref = 'SPECIMEN';
$this->ref = 'SPECIMEN_SHIP';
$this->specimen=1;
$this->statut = 1;
if ($conf->livraison_bon->enabled)
{
$this->livraison_id = 0;
}
$this->date = time();
$this->livraison_id = 0;
$this->date = $now;
$this->date_creation = $now;
$this->date_valid = $now;
$this->date_delivery = $now;
$this->date_expedition = $now + 24*3600;
$this->entrepot_id = 0;
$this->fk_delivery_address = 0;
$this->socid = 1;

View File

@ -1670,6 +1670,8 @@ class CommandeFournisseur extends Commande
dol_syslog("CommandeFournisseur::initAsSpecimen");
$now=dol_now();
// Charge tableau des produits prodids
$prodids = array();
@ -1695,8 +1697,8 @@ class CommandeFournisseur extends Commande
$this->ref = 'SPECIMEN';
$this->specimen=1;
$this->socid = 1;
$this->date = time();
$this->date_commande = time();
$this->date = $now;
$this->date_commande = $now;
$this->date_lim_reglement=$this->date+3600*24*30;
$this->cond_reglement_code = 'RECEP';
$this->mode_reglement_code = 'CHQ';
@ -1715,27 +1717,37 @@ class CommandeFournisseur extends Commande
$line->tva_tx=19.6;
$line->localtax1_tx=0;
$line->localtax2_tx=0;
$line->remise_percent=10;
$line->total_ht=90;
$line->total_ttc=107.64; // 90 * 1.196
$line->total_tva=17.64;
if ($xnbp == 2)
{
$line->total_ht=50;
$line->total_ttc=59.8;
$line->total_tva=9.8;
$line->remise_percent=50;
}
else
{
$line->total_ht=100;
$line->total_ttc=119.6;
$line->total_tva=19.6;
$line->remise_percent=00;
}
$line->ref_fourn='SUPPLIER_REF_'.$xnbp;
$prodid = rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
$this->lines[$xnbp]=$line;
$this->total_ht += $line->total_ht;
$this->total_tva += $line->total_tva;
$this->total_ttc += $line->total_ttc;
$xnbp++;
}
$this->amount_ht = $xnbp*100;
$this->total_ht = $xnbp*100;
$this->total_tva = $xnbp*19.6;
$this->total_ttc = $xnbp*119.6;
}
/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @param user Objet user
* @return int <0 if KO, >0 if OK
*/

View File

@ -1231,6 +1231,7 @@ class FactureFournisseur extends Facture
// Initialise parametres
$this->id=0;
$this->ref = 'SPECIMEN';
$this->ref_supplier = 'SUPPLIER_REF_SPECIMEN';
$this->specimen=1;
$this->socid = 1;
$this->date = $now;
@ -1252,15 +1253,31 @@ class FactureFournisseur extends Facture
$line->tva_tx=19.6;
$line->localtax1_tx=0;
$line->localtax2_tx=0;
$line->remise_percent=10;
$line->total_ht=90;
$line->total_ttc=107.64; // 90 * 1.196
$line->total_tva=17.64;
$prodid = rand(1, $num_prods);
if ($xnbp == 2)
{
$line->total_ht=50;
$line->total_ttc=59.8;
$line->total_tva=9.8;
$line->remise_percent=50;
}
else
{
$line->total_ht=100;
$line->total_ttc=119.6;
$line->total_tva=19.6;
$line->remise_percent=00;
}
$prodid = rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
$line->product_type=0;
$this->lines[$xnbp]=$line;
$this->total_ht += $line->total_ht;
$this->total_tva += $line->total_tva;
$this->total_ttc += $line->total_ttc;
$xnbp++;
}

View File

@ -224,10 +224,11 @@ class CommActionRapport
}
/**
* \brief Affiche en-tete facture
* \param pdf Objet PDF
* \param outputlang Objet lang cible
* \param pagenb Page nb
* Show page head
*
* @param pdf Objet PDF
* @param outputlang Objet lang cible
* @param pagenb Page nb
*/
function _pagehead(&$pdf, $outputlangs, $pagenb)
{
@ -243,8 +244,12 @@ class CommActionRapport
$pdf->SetFont('','B',10);
$pdf->SetXY($this->marge_gauche, $this->marge_haute);
$pdf->MultiCell(120, 1, $outputlangs->convToOutputCharset($this->title), 0, 'L', 0);
$pdf->SetXY($this->page_largeur-$this->marge_droite-40, $this->marge_haute);
$pdf->MultiCell(40, 1, $pagenb.'/{nb}', 0, 'R', 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;

View File

@ -378,8 +378,12 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$pdf->MultiCell(200, 2, $line2, 0, 'C', 0);
}
$pdf->SetXY(-20,-$posy);
$pdf->MultiCell(11, 2, $pdf->PageNo().'/{nb}', 0, 'R', 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);
}
}
}

View File

@ -54,9 +54,13 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$this->type = 'pdf';
$formatarray=pdf_getFormat();
$this->page_largeur = round($formatarray['height']/2);
$this->page_hauteur = $formatarray['width'];
$this->page_largeur = $formatarray['width'];
$this->page_hauteur = round($formatarray['height']/2);
$this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=10;
$this->marge_droite=10;
$this->marge_haute=10;
$this->marge_basse=10;
$this->option_logo = 1; // Affiche logo
@ -162,7 +166,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Sending"));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins(10, 10, 10);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0);
$pdf->SetFont('','', $default_font_size - 3);
@ -177,11 +181,11 @@ Class pdf_expedition_merou extends ModelePdfExpedition
//Initialisation des coordonnees
$tab_top = 53;
$tab_height = 70;
$tab_height = $this->page_hauteur - 78;
$pdf->SetFillColor(240,240,240);
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 3);
$pdf->SetXY (10, $tab_top + 5 );
$pdf->SetXY(10, $tab_top + 5);
$iniY = $pdf->GetY();
$curY = $pdf->GetY();
$nexY = $pdf->GetY();
@ -295,10 +299,11 @@ Class pdf_expedition_merou extends ModelePdfExpedition
}
/**
* \brief Show footer of page
* \param pdf PDF factory
* \param object Object invoice
* \param outputlangs Object lang for output
* Show footer of page
*
* @param pdf PDF factory
* @param object Object invoice
* @param outputlangs Object lang for output
*/
function _pagefoot(&$pdf, $object, $outputlangs)
{
@ -310,8 +315,13 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ToAndDate") , 0, 'C');
$pdf->SetXY(120,-23);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("NameAndSignature") , 0, 'C');
$pdf->SetXY(-10,-10);
$pdf->MultiCell(10, 3, $pdf->PageNo().'/{nb}', 0, 'R');
// Show page nb only on iso languages (so default Helvetica font)
//if (pdf_getPDFFont($outputlangs) == 'Helvetica')
//{
// $pdf->SetXY(-10,-10);
// $pdf->MultiCell(11, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
//}
}

View File

@ -292,6 +292,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
/**
* Show header of document
*
* @param pdf Object PDF
* @param object Object commercial proposal
* @param showaddress 0=no, 1=yes
@ -371,36 +372,36 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$posx=100;
$posy=$this->marge_haute;
$pdf->SetFont('','B', $default_font_size + 3);
$pdf->SetFont('','B', $default_font_size + 2);
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$title=$outputlangs->transnoentities("SendingSheet");
$pdf->MultiCell(100, 4, $title, '' , 'R');
$posy+=1;
$pdf->SetFont('','', $default_font_size + 2);
$pdf->SetFont('','', $default_font_size + 1);
$posy+=5;
$posy+=4;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("RefSending") ." : ".$object->ref, '', 'R');
//Date Expedition
$posy+=5;
$posy+=4;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date_delivery,"%d %b %Y",false,$outputlangs,true), '', 'R');
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date_creation,"daytext",false,$outputlangs,true), '', 'R');
if (! empty($object->client->code_client))
{
$posy+=5;
$posy+=4;
$pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R');
}
$pdf->SetFont('','', $default_font_size + 4);
$pdf->SetFont('','', $default_font_size + 3);
$Yoff=25;
// Add list of linked orders
@ -428,7 +429,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$pdf->MultiCell(60, 2, $outputlangs->transnoentities("RefOrder") ." : ".$outputlangs->transnoentities($text), 0, 'R');
$Yoff = $Yoff+4;
$pdf->SetXY($this->page_largeur - $this->marge_droite - 60,$Yoff);
$pdf->MultiCell(60, 2, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->commande->date,"%d %b %Y",false,$outputlangs,true), 0, 'R');
$pdf->MultiCell(60, 2, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->commande->date,"daytext",false,$outputlangs,true), 0, 'R');
}
}

View File

@ -48,8 +48,9 @@ class pdf_oursin extends ModelePDFFactures
/**
* \brief Constructeur
* \param db Database handler
* Constructor
*
* @param DoliDB $db Handler access data base
*/
function pdf_oursin($db)
{

View File

@ -43,8 +43,8 @@ class pdf_propale_jaune extends ModelePDFPropales
/**
* Constructor
*
* @param db Database access handler
*
* @param DoliDB $db Handler access data base
*/
function pdf_propale_jaune($db)
{

View File

@ -36,10 +36,29 @@ require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
*/
class pdf_canelle extends ModelePDFSuppliersInvoices
{
var $db;
var $name;
var $description;
var $type;
var $phpmin = array(4,3,0); // Minimum version of PHP required by module
var $version = 'dolibarr';
var $page_largeur;
var $page_hauteur;
var $format;
var $marge_gauche;
var $marge_droite;
var $marge_haute;
var $marge_basse;
var $emetteur; // Objet societe qui emet
/**
* \brief Constructor
* \param db Handler access data base
* Constructor
*
* @param DoliDB $db Handler access data base
*/
function pdf_canelle($db,$object)
{
@ -768,49 +787,45 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
if ($showaddress)
{
// Receive email
$posy=42;
$hautcadre=40;
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche,$posy-5);
$pdf->MultiCell(66,5, $outputlangs->transnoentities("BillTo").":",0,"L");
$pdf->SetXY($this->marge_gauche,$posy);
$pdf->SetFillColor(230,230,230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
// Nom emetteur
$carac_emetteur_name=$outputlangs->convToOutputCharset($mysoc->name);
$pdf->SetTextColor(0,0,60);
$pdf->SetFont('','B', $default_font_size);
$pdf->SetXY($this->marge_gauche+2,$posy+3);
$pdf->MultiCell(80, 4, $carac_emetteur_name, 0, 'L');
// Sender properties
$carac_emetteur = pdf_build_address($outputlangs,$mysoc);
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->marge_gauche+2,$posy+8);
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
// Client destinataire
// 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(100, 4, $outputlangs->transnoentities("Supplier").":");
//
$client = new Societe($this->db);
$client->fetch($object->socid);
$object->client = $client;
//
$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);
// Cadre client destinataire
$pdf->rect(100, $posy, 100, $hautcadre);
// 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');
// Show sender information
$pdf->SetXY($posx+2,$posy+8);
$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('external','BILLING');
if (sizeof($arrayidcontact) > 0)
{
$usecontact=true;
$result=$object->fetch_contact($arrayidcontact[0]);
}
// Recipient name
if (! empty($usecontact))
@ -827,14 +842,27 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target');
// Show customer/recipient
$pdf->SetXY(102,$posy+3);
// Show recipient
$posy=42;
$posx=$this->page_largeur-$this->marge_droite-100;
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(80,5, $outputlangs->transnoentities("BillTo").":",0,'L');
$pdf->rect($posx, $posy, 100, $hautcadre);
// Show recipient name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(96,4, $carac_client_name, 0, 'L');
// Show recipient information
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY(102,$posy+8);
$pdf->MultiCell(96,4, $carac_client, 0, 'L');
$pdf->SetXY($posx+2,$posy+8);
$pdf->MultiCell(86,4, $carac_client, 0, 'L');
}
}

View File

@ -38,10 +38,29 @@ require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
*/
class pdf_muscadet extends ModelePDFSuppliersOrders
{
var $db;
var $name;
var $description;
var $type;
var $phpmin = array(4,3,0); // Minimum version of PHP required by module
var $version = 'dolibarr';
var $page_largeur;
var $page_hauteur;
var $format;
var $marge_gauche;
var $marge_droite;
var $marge_haute;
var $marge_basse;
var $emetteur; // Objet societe qui emet
/**
* \brief Constructeur
* \param db Handler acces base de donnee
* Constructor
*
* @param DoliDB $db Handler access data base
*/
function pdf_muscadet($db)
{
@ -96,6 +115,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
/**
* Write the order as a document onto disk
*
* @param object Object invoice to build (or id if old method)
* @param outputlangs Lang object for output language
* @return int 1=OK, 0=KO
@ -698,49 +718,45 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
if ($showaddress)
{
// Show sender address
$posy=42;
$hautcadre=40;
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('','', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche,$posy-5);
$pdf->MultiCell(66,5, $outputlangs->transnoentities("BillTo").":",0,'L');
$pdf->SetXY($this->marge_gauche,$posy);
$pdf->SetFillColor(230,230,230);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
// Nom emetteur
$carac_emetteur_name=$outputlangs->convToOutputCharset($mysoc->name);
$pdf->SetTextColor(0,0,60);
$pdf->SetFont('','B', $default_font_size);
$pdf->SetXY($this->marge_gauche+2,$posy+3);
$pdf->MultiCell(80, 4, $carac_emetteur_name, 0, 'L');
// Sender properties
$carac_emetteur = pdf_build_address($outputlangs,$mysoc);
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->marge_gauche+2,$posy+8);
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
// Client destinataire
// 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(96, 4, $outputlangs->transnoentities("Supplier").":");
//
$client = new Societe($this->db);
$client->fetch($object->socid);
$object->client = $client;
//
$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);
// Cadre client destinataire
$pdf->rect(100, $posy, 100, $hautcadre);
// 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');
// Show sender information
$pdf->SetXY($posx+2,$posy+8);
$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('external','BILLING');
if (sizeof($arrayidcontact) > 0)
{
$usecontact=true;
$result=$object->fetch_contact($arrayidcontact[0]);
}
// Recipient name
if (! empty($usecontact))
@ -757,14 +773,27 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target');
// Show customer/recipient
$pdf->SetXY(102,$posy+3);
// Show recipient
$posy=42;
$posx=$this->page_largeur-$this->marge_droite-100;
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(80,5, $outputlangs->transnoentities("BillTo").":",0,'L');
$pdf->rect($posx, $posy, 100, $hautcadre);
// Show recipient name
$pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size);
$pdf->MultiCell(96,4, $carac_client_name, 0, 'L');
// Show recipient information
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY(102,$posy+8);
$pdf->MultiCell(96,4, $carac_client, 0, 'L');
$pdf->SetXY($posx+2,$posy+8);
$pdf->MultiCell(86,4, $carac_client, 0, 'L');
}
}

View File

@ -78,9 +78,9 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
// We need to instantiate fpdi object (instead of tcpdf) to use merging features. But we can disable it.
if (empty($conf->global->MAIN_DISABLE_FPDI)) require_once(FPDFI_PATH.'fpdi.php');
$arrayformat=pdf_getFormat();
$format=array($arrayformat['width'],$arrayformat['height']);
$metric=$arrayformat['unit'];
//$arrayformat=pdf_getFormat();
//$format=array($arrayformat['width'],$arrayformat['height']);
//$metric=$arrayformat['unit'];
// Protection et encryption du pdf
if ($conf->global->PDF_SECURITY_ENCRYPTION)

View File

@ -398,7 +398,7 @@ class Livraison extends CommonObject
}
}
}
// Set new ref and current status
if (! $error)
{
@ -717,6 +717,8 @@ class Livraison extends CommonObject
{
global $user,$langs,$conf;
$now=dol_now();
// Charge tableau des produits prodids
$prodids = array();
$sql = "SELECT rowid";
@ -738,10 +740,10 @@ class Livraison extends CommonObject
// Initialise parametres
$this->id=0;
$this->ref = 'SPECIMEN';
$this->ref = 'SPECIMEN_RECEIPT';
$this->specimen=1;
$this->socid = 1;
$this->date_delivery = time();
$this->date_delivery = $now;
$this->note_public='SPECIMEN';
$i=0;

View File

@ -2492,9 +2492,13 @@ class Societe extends CommonObject
$this->nom = $this->name; // For backward compatibility
$this->specimen=1;
$this->cp='99999';
$this->zip='99999';
$this->ville='MyTown';
$this->town='MyTown';
$this->pays_id=1;
$this->country_id=1;
$this->pays_code='FR';
$this->country_code='FR';
$this->code_client='CC-'.dol_print_date($now,'dayhourlog');
$this->code_fournisseur='SC-'.dol_print_date($now,'dayhourlog');