Fist changes to support deposit invoices

This commit is contained in:
Laurent Destailleur 2009-02-21 17:43:02 +00:00
parent eef7a7ec02
commit dbf8418e84
15 changed files with 165 additions and 79 deletions

View File

@ -572,9 +572,9 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
}
}
// Predefined invoice
if ($_POST['type'] == 0 && $_POST['fac_rec'] > 0)
{
// Si facture récurrente
$datefacture = dol_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$facture->socid = $_POST['socid'];
@ -593,7 +593,8 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
$facid = $facture->create($user);
}
if ($_POST['type'] == 0 && $_POST['fac_rec'] <= 0)
// Standard or deposit or proformat invoice
if (($_POST['type'] == 0 || $_POST['type'] == 3 || $_POST['type'] == 4) && $_POST['fac_rec'] <= 0)
{
$datefacture = dol_mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($datefacture))
@ -605,7 +606,6 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
if (! $error)
{
// Si facture standard
$facture->socid = $_POST['socid'];
$facture->type = $_POST['type'];
$facture->number = $_POST['facnumber'];
@ -615,12 +615,13 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
$facture->ref_client = $_POST['ref_client'];
$facture->modelpdf = $_POST['model'];
$facture->projetid = $_POST['projetid'];
$facture->cond_reglement_id = $_POST['cond_reglement_id'];
$facture->cond_reglement_id = ($_POST['type'] == 3?1:$_POST['cond_reglement_id']);
$facture->mode_reglement_id = $_POST['mode_reglement_id'];
$facture->amount = $_POST['amount'];
$facture->remise_absolue = $_POST['remise_absolue'];
$facture->remise_percent = $_POST['remise_percent'];
// If invoices lines already known
if (! $_POST['propalid'] && ! $_POST['commandeid'] && ! $_POST['contratid'])
{
for ($i = 1; $i <= $NBLINES; $i++)
@ -637,9 +638,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
}
else
{
/*
* Si creation depuis propale
*/
// If creation from proposal
if ($_POST['propalid'])
{
$facture->propalid = $_POST['propalid'];
@ -693,9 +692,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
}
}
/*
* Si création depuis commande
*/
// If creation from order
if ($_POST['commandeid'])
{
$facture->commandeid = $_POST['commandeid'];
@ -750,9 +747,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
}
}
/*
* Si création depuis contrat
*/
// If creation from contract
if ($_POST['contratid'])
{
$facture->contratid = $_POST['contratid'];
@ -1368,7 +1363,7 @@ if ($_GET['action'] == 'create')
$dateinvoice=empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
}
$absolute_discount=$soc->getAvailableDiscounts();
if (empty($cond_reglement_id)) $cond_reglement_id=1;
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="action" value="add">';
@ -1395,7 +1390,6 @@ if ($_GET['action'] == 'create')
}
// Factures prédéfinnies
// TODO Use instead invoice in llx_facture table with a particular status
if ($conf->global->FACTURE_ENABLE_RECUR)
{
if ($_GET['propalid'] == 0 && $_GET['commandeid'] == 0 && $_GET['contratid'] == 0)
@ -1472,18 +1466,38 @@ if ($_GET['action'] == 'create')
$optionsav.='</option>';
}
// Type
print '<tr><td valign="top">'.$langs->trans('Type').'</td><td colspan="2">';
print '<table class="nobordernopadding">'."\n";
print '<tr><td width="16px" valign="middle">';
// Standard invoice
print '<tr height="18"><td width="16px" valign="middle">';
print '<input type="radio" name="type" value="0"'.($_POST['type']==0?' checked="true"':'').'>';
print '</td><td valign="middle">';
$desc=$html->textwithhelp($langs->trans("InvoiceStandardAsk"),$langs->transnoentities("InvoiceStandardDesc"),1);
print $desc;
print '</td></tr>'."\n";
print '<tr><td valign="middle">';
// Deposit
print '<tr height="18"><td width="16px" valign="middle">';
print '<input type="radio" name="type" value="3"'.($_POST['type']==3?' checked="true"':'').'>';
print '</td><td valign="middle">';
$desc=$html->textwithhelp($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1);
print $desc;
print '</td></tr>'."\n";
// Proformat
if ($conf->global->FACTURE_USE_PROFORMAT)
{
print '<tr height="18"><td width="16px" valign="middle">';
print '<input type="radio" name="type" value="4"'.($_POST['type']==4?' checked="true"':'').'>';
print '</td><td valign="middle">';
$desc=$html->textwithhelp($langs->trans("InvoiceProformat"),$langs->transnoentities("InvoiceProformatDesc"),1);
print $desc;
print '</td></tr>'."\n";
}
// Replacement
print '<tr height="18"><td valign="middle">';
print '<input type="radio" name="type" value="1"'.($_POST['type']==1?' checked=true':'');
if (! $options) print ' disabled="true"';
print '>';
@ -1506,7 +1520,8 @@ if ($_GET['action'] == 'create')
print $desc;
print '</td></tr>'."\n";
print '<tr><td valign="middle">';
// Credit note
print '<tr height="18"><td valign="middle">';
print '<input type="radio" name="type" value="2"'.($_POST['type']==2?' checked=true':'');
if (! $optionsav) print ' disabled="true"';
print '>';
@ -1549,14 +1564,14 @@ if ($_GET['action'] == 'create')
$html->select_date($dateinvoice,'','','','',"add");
print '</td></tr>';
// Conditions de règlement
// Payment term
print '<tr><td nowrap>'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
$html->select_conditions_paiements($cond_reglement_id,'cond_reglement_id');
$html->select_conditions_paiements(isset($_POST['cond_reglement_id'])?$_POST['cond_reglement_id']:$cond_reglement_id,'cond_reglement_id');
print '</td></tr>';
// Mode de règlement
// Payment mode
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
$html->select_types_paiements($mode_reglement_id,'mode_reglement_id');
$html->select_types_paiements(isset($_POST['mode_reglement_id'])?$_POST['mode_reglement_id']:$mode_reglement_id,'mode_reglement_id');
print '</td></tr>';
// Project
@ -2938,7 +2953,9 @@ else
}
// Validate
if ($fac->statut == 0 && $num_lignes > 0 && (($fac->type < 2 && $fac->total_ttc >= 0) || ($fac->type == 2 && $fac->total_ttc <= 0)))
if ($fac->statut == 0 && $num_lignes > 0 &&
(($fac->type == 0 || $fac->type == 1 || $fac->type == 3 || $fac->type == 4) && $fac->total_ttc >= 0)
|| ($fac->type == 2 && $fac->total_ttc <= 0))
{
if ($user->rights->facture->valider)
{
@ -2972,7 +2989,7 @@ else
}
}
if ($conf->global->FACTURE_SHOW_SEND_REMINDER)
if ($conf->global->FACTURE_SHOW_SEND_REMINDER) // For backward compatibility
{
// Envoyer une relance
if (($fac->statut == 1 || $fac->statut == 2) && $resteapayer > 0 && $user->rights->facture->envoyer)
@ -2988,7 +3005,7 @@ else
}
}
// Emettre paiement
// Create payment
if ($fac->type != 2 && $fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement)
{
if ($facidnext)
@ -3008,28 +3025,34 @@ else
}
}
// Emettre remboursement ou Convertir en reduc
if ($fac->type == 2)
// Reverse back money or convert to reduction
if ($fac->type == 2 || $fac->type == 3)
{
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement)
// For credit note only
if ($fac->type == 2 && $fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement)
{
print '<a class="butAction" href="paiement.php?facid='.$fac->id.'&amp;action=create">'.$langs->trans('DoPaymentBack').'</a>';
}
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->creer && $fac->getSommePaiement() == 0)
// For credit note
if ($fac->type == 2 && $fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->creer && $fac->getSommePaiement() == 0)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&amp;action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a>';
}
// For deposit invoice
if ($fac->type == 3 && $fac->statut == 1 && $resteapayer == 0 && $user->rights->facture->creer)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&amp;action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a>';
}
}
// Classer 'payé'
// Classify payed (if not deposit and not credit note. Such invoice are "converted")
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement &&
(($fac->type != 2 && $resteapayer <= 0) || ($fac->type == 2 && $resteapayer >= 0)) )
(($fac->type != 2 && $fac->type != 3 && $resteapayer <= 0) || ($fac->type == 2 && $resteapayer >= 0)) )
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&amp;action=payed">'.$langs->trans('ClassifyPayed').'</a>';
}
// Classer 'fermée' (possible si validée et pas encore classée payée)
// Classift 'closed not completely payed' (possible si validée et pas encore classée payée)
if ($fac->statut == 1 && $fac->paye == 0 && $resteapayer > 0
&& $user->rights->facture->paiement)
{
@ -3052,13 +3075,13 @@ else
}
// Clone
if ($fac->type == 0 && $user->rights->facture->creer)
if (($fac->type == 0 || $fac->type == 3 || $fac->type == 4) && $user->rights->facture->creer)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&amp;action=clone&amp;object=invoice">'.$langs->trans("ToClone").'</a>';
}
// Clone as predefined
if ($conf->global->FACTURE_ENABLE_RECUR && $fac->type == 0 && $fac->statut == 0 && $user->rights->facture->creer)
if ($conf->global->FACTURE_ENABLE_RECUR && ($fac->type == 0 || $fac->type == 3 || $fac->type == 4) && $fac->statut == 0 && $user->rights->facture->creer)
{
if (! $facidnext)
{

View File

@ -76,7 +76,7 @@ if ($_POST['action'] == 'add_paiement' || $_POST['action'] == 'confirm_paiement'
$formquestion['text'] = img_warning($langs->trans("PaymentHigherThanReminderToPay")).' Attention, le montant de paiement pour une ou plusieurs facture est superieur au reste a payer.';
$formquestion['text'].='<br>Corriger votre saisie, sinon, confirmer et penser a creer un avoir du trop percu lors de la fermeture de chacune des factures surpayees.';
}
$formquestion[$i++]=array('type' => 'hidden','name' => $key, 'value' => $_POST[$key]);
}
}
@ -134,11 +134,11 @@ if ($_POST['action'] == 'confirm_paiement' && $_POST['confirm'] == 'yes')
$_POST['remonth'],
$_POST['reday'],
$_POST['reyear']);
if (! $error)
{
$db->begin();
// Creation de la ligne paiement
$paiement = new Paiement($db);
$paiement->datepaye = $datepaye;
@ -166,7 +166,7 @@ if ($_POST['action'] == 'confirm_paiement' && $_POST['confirm'] == 'yes')
$user,
$_POST['chqemetteur'],
$_POST['chqbank']);
// Mise a jour fk_bank dans llx_paiement.
// On connait ainsi le paiement qui a g<>n<EFBFBD>r<EFBFBD> l'<27>criture bancaire
if ($bank_line_id > 0)
@ -201,7 +201,7 @@ if ($_POST['action'] == 'confirm_paiement' && $_POST['confirm'] == 'yes')
{
$error++;
}
if ($error == 0)
{
$loc = DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$paiement_id;
@ -260,7 +260,7 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P
if ($_POST["action"] == 'add_paiement')
{
$i=0;
$formquestion[$i++]=array('type' => 'hidden','name' => 'facid', 'value' => $facture->id);
$formquestion[$i++]=array('type' => 'hidden','name' => 'socid', 'value' => $facture->socid);
$formquestion[$i++]=array('type' => 'hidden','name' => 'type', 'value' => $facture->type);
@ -324,7 +324,7 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P
print '<td><input name="chqbank" size="30" type="text" value="'.(empty($_POST['chqbank'])?'':$_POST['chqbank']).'"></td></tr>';
/*
* Liste factures impayees
* List of unpayed invoices
*/
$sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.type, ';
$sql.= $db->pdate('f.datef').' as df, ';
@ -333,14 +333,14 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
$sql.= ' WHERE f.fk_soc = '.$facture->socid;
$sql.= ' AND f.paye = 0';
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => non valid<69>e, Statut=2 => annul<75>e
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => not validated, Statut=2 => canceled
if ($facture->type != 2)
{
$sql .= ' AND type in (0,1)'; // Facture standard ou de remplacement
$sql .= ' AND type in (0,1,3)'; // Standard invoice, replacement, deposit
}
else
{
$sql .= ' AND type = 2';
$sql .= ' AND type = 2'; // If paying back a credit note, we show all credit notes
}
$sql .= ' GROUP BY f.facnumber';
$resql = $db->query($sql);
@ -375,9 +375,9 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P
$facturestatic->ref=$objp->facnumber;
$facturestatic->id=$objp->facid;
$facturestatic->type=$objp->type;
$creditnote=$facturestatic->getSommeCreditNote();
print '<tr '.$bc[$var].'>';
print '<td>';
@ -389,12 +389,12 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P
// Prix
print '<td align="right">'.price($objp->total_ttc).'</td>';
// Recu
print '<td align="right">'.price($objp->am);
if ($creditnote) print '+'.price($creditnote);
print '</td>';
// Reste a payer
print '<td align="right">'.price(price2num($objp->total_ttc - $objp->am - $creditnote,'MT')).'</td>';
@ -411,8 +411,8 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P
print ' '.img_warning($langs->trans("PaymentHigherThanReminderToPay"));
}
print '</td>';
print "</tr>\n";
$total+=$objp->total;
@ -425,7 +425,7 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P
{
// Print total
print '<tr class="liste_total">';
print '<td colspan="2" align="left">'.$langs->trans('TotalTTC').':</td>';
print '<td colspan="2" align="left">'.$langs->trans('TotalTTC').'</td>';
print '<td align="right"><b>'.price($total_ttc).'</b></td>';
print '<td align="right"><b>'.price($totalrecu);
if ($totalrecucreditnote) print '+'.price($totalrecucreditnote);
@ -476,7 +476,7 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P
/**
* \brief Affichage de la liste des paiement
* \brief Affichage de la liste des paiements
*/
if (! $_GET['action'] && ! $_POST['action'])
{
@ -491,7 +491,6 @@ if (! $_GET['action'] && ! $_POST['action'])
$sql .=', f.rowid as facid, c.libelle as paiement_type, p.num_paiement';
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement as p, '.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'c_paiement as c';
$sql .= ' WHERE p.fk_facture = f.rowid AND p.fk_paiement = c.id';
if ($socid)
{
$sql .= ' AND f.fk_soc = '.$socid;

View File

@ -52,7 +52,7 @@ class Facture extends CommonObject
var $id;
//! Id client
var $socid;
//! Objet societe client (à charger par fetch_client)
//! Objet societe client (to load with fetch_client method)
var $client;
var $number;
var $author;
@ -62,7 +62,7 @@ class Facture extends CommonObject
var $date_validation;
var $ref;
var $ref_client;
//! 0=Facture normale, 1=Facture remplacement, 2=Facture avoir, 3=Facture récurrente
//! 0=Standard invoice, 1=Replacement invoice, 2=Credit note invoice, 3=Deposit invoice, 4=Proformat invoice
var $type;
var $amount;
var $remise;
@ -77,7 +77,7 @@ class Facture extends CommonObject
var $statut;
//! 1 si facture payée COMPLETEMENT, 0 sinon (ce champ ne devrait plus servir car insuffisant)
var $paye;
//! id facture source si facture de remplacement ou avoir
//! id of source invoice if replacement invoice or credit note
var $fk_facture_source;
//! Fermeture apres paiement partiel: discount_vat, badcustomer, abandon
//! Fermeture alors que aucun paiement: replaced (si remplacé), abandon
@ -134,7 +134,7 @@ class Facture extends CommonObject
{
global $langs,$conf,$mysoc;
// Nettoyage paramètres
// Clean parameters
if (! $this->type) $this->type = 0;
$this->ref_client=trim($this->ref_client);
$this->note=trim($this->note);
@ -182,7 +182,7 @@ class Facture extends CommonObject
// Definition de la date limite
$datelim=$this->calculate_date_lim_reglement();
// Insertion dans la base
// Insert into database
$socid = $this->socid;
$amount = $this->amount;
$remise = $this->remise;
@ -198,7 +198,7 @@ class Facture extends CommonObject
$sql.= ' fk_facture_source, fk_user_author, fk_projet,';
$sql.= ' fk_cond_reglement, fk_mode_reglement, date_lim_reglement, model_pdf)';
$sql.= ' VALUES (';
$sql.= "'(PROV)', '".$this->type."', '".$socid."', ".$this->db->idate(mktime()).", '".$totalht."'";
$sql.= "'(PROV)', '".$this->type."', '".$socid."', ".$this->db->idate(gmmktime()).", '".$totalht."'";
$sql.= ",".($this->remise_absolue>0?$this->remise_absolue:'NULL');
$sql.= ",".($this->remise_percent>0?$this->remise_percent:'NULL');
$sql.= ",".$this->db->idate($this->date);
@ -470,12 +470,14 @@ class Facture extends CommonObject
}
$picto='bill';
if ($this->type == 1) $picto.='r';
if ($this->type == 2) $picto.='a';
if ($this->type == 1) $picto.='r'; // Replacement invoice
if ($this->type == 2) $picto.='a'; // Credit note
if ($this->type == 3) $picto.='d'; // Deposit invoice
$label=$langs->trans("ShowInvoice").': '.$this->ref;
if ($this->type == 1) $label=$langs->trans("ShowInvoiceReplace").': '.$this->ref;
if ($this->type == 2) $label=$langs->trans("ShowInvoiceAvoir").': '.$this->ref;
if ($this->type == 3) $label=$langs->trans("ShowInvoiceDeposit").': '.$this->ref;
if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
if ($withpicto && $withpicto != 2) $result.=' ';
@ -1965,6 +1967,7 @@ class Facture extends CommonObject
if ($this->type == 0) return $langs->trans("InvoiceStandard");
if ($this->type == 1) return $langs->trans("InvoiceReplacement");
if ($this->type == 2) return $langs->trans("InvoiceAvoir");
if ($this->type == 3) return $langs->trans("InvoiceDeposit");
return $langs->trans("Unknown");
}
@ -2008,6 +2011,7 @@ class Facture extends CommonObject
else
{
if ($type == 2) return $langs->trans('Bill'.$prefix.'StatusPayedBackOrConverted');
elseif ($type == 3) return $langs->trans('Bill'.$prefix.'StatusConverted');
else return $langs->trans('Bill'.$prefix.'StatusPayed');
}
}
@ -2025,6 +2029,7 @@ class Facture extends CommonObject
else
{
if ($type == 2) return $langs->trans('Bill'.$prefix.'StatusPayedBackOrConverted');
elseif ($type == 3) return $langs->trans('Bill'.$prefix.'StatusConverted');
else return $langs->trans('Bill'.$prefix.'StatusPayed');
}
}
@ -2042,6 +2047,7 @@ class Facture extends CommonObject
else
{
if ($type == 2) return img_picto($langs->trans('BillStatusPayedBackOrConverted'),'statut6').' '.$langs->trans('Bill'.$prefix.'StatusPayedBackOrConverted');
elseif ($type == 3) return img_picto($langs->trans('BillStatusConverted'),'statut6').' '.$langs->trans('Bill'.$prefix.'StatusConverted');
else return img_picto($langs->trans('BillStatusPayed'),'statut6').' '.$langs->trans('Bill'.$prefix.'StatusPayed');
}
}
@ -2059,6 +2065,7 @@ class Facture extends CommonObject
else
{
if ($type == 2) return img_picto($langs->trans('BillStatusPayedBackOrConverted'),'statut6');
elseif ($type == 3) return img_picto($langs->trans('BillStatusConverted'),'statut6');
else return img_picto($langs->trans('BillStatusPayed'),'statut6');
}
}
@ -2075,6 +2082,7 @@ class Facture extends CommonObject
else
{
if ($type == 2) return img_picto($langs->trans('BillStatusPayedBackOrConverted'),'statut6').' '.$langs->trans('BillStatusPayedBackOrConverted');
elseif ($type == 3) return img_picto($langs->trans('BillStatusConverted'),'statut6').' '.$langs->trans('BillStatusConverted');
else return img_picto($langs->trans('BillStatusPayed'),'statut6').' '.$langs->trans('BillStatusPayed');
}
}
@ -2092,6 +2100,7 @@ class Facture extends CommonObject
else
{
if ($type == 2) return $langs->trans('Bill'.$prefix.'StatusPayedBackOrConverted').' '.img_picto($langs->trans('BillStatusPayedBackOrConverted'),'statut6');
elseif ($type == 3) return $langs->trans('Bill'.$prefix.'StatusConverted').' '.img_picto($langs->trans('BillStatusConverted'),'statut6');
else return $langs->trans('Bill'.$prefix.'StatusPayed').' '.img_picto($langs->trans('BillStatusPayed'),'statut6');
}
}
@ -2628,7 +2637,7 @@ class Facture extends CommonObject
}
}
// Initialise paramètres
// Initialize parameters
$this->id=0;
$this->ref = 'SPECIMEN';
$this->specimen=1;

View File

@ -938,6 +938,8 @@ class pdf_crabe extends ModelePDFFactures
$title=$outputlangs->transnoentities("Invoice");
if ($object->type == 1) $title=$outputlangs->transnoentities("InvoiceReplacement");
if ($object->type == 2) $title=$outputlangs->transnoentities("InvoiceAvoir");
if ($object->type == 3) $title=$outputlangs->transnoentities("InvoiceDeposit");
if ($object->type == 4) $title=$outputlangs->transnoentities("InvoiceProFormat");
$pdf->MultiCell(100, 4, $title, '' , 'R');
$pdf->SetFont('Arial','B',12);

View File

@ -131,7 +131,7 @@ class pdf_oursin extends ModelePDFFactures
$ret=$fac->fetch($id);
}
$fac->fetch_client();
$deja_regle = $fac->getSommePaiement();
$amount_credit_not_included = $fac->getSommeCreditNote();
@ -931,21 +931,59 @@ class pdf_oursin extends ModelePDFFactures
/*
* ref facture
*/
$posy=65;
$posy=70;
$pdf->SetFont('Arial','B',13);
$pdf->SetXY($this->marges['g'],$posy);
$pdf->SetXY($this->marges['g'],$posy-5);
$pdf->SetTextColor(0,0,0);
$pdf->MultiCell(100, 10, $outputlangs->transnoentities("Bill").' '.$outputlangs->transnoentities("Of").' '.dol_print_date($fac->date,"%d %B %Y",false,$outputlangs,true), '' , 'L');
$title=$outputlangs->transnoentities("Invoice");
if ($object->type == 1) $title=$outputlangs->transnoentities("InvoiceReplacement");
if ($object->type == 2) $title=$outputlangs->transnoentities("InvoiceAvoir");
if ($object->type == 3) $title=$outputlangs->transnoentities("InvoiceDeposit");
if ($object->type == 4) $title=$outputlangs->transnoentities("InvoiceProFormat");
$pdf->MultiCell(100, 10, $title.' '.$outputlangs->transnoentities("Of").' '.dol_print_date($fac->date,"day",false,$outputlangs,true), '' , 'L');
$pdf->SetFont('Arial','B',11);
$pdf->SetXY($this->marges['g'],$posy+5);
$pdf->SetXY($this->marges['g'],$posy);
$pdf->SetTextColor(22,137,210);
$pdf->MultiCell(100, 10, $outputlangs->transnoentities("RefBill")." : " . $outputlangs->transnoentities($fac->ref), '', 'L');
$pdf->SetTextColor(0,0,0);
$posy+=4;
$facidnext=$object->getIdReplacingInvoice('validated');
if ($object->type == 0 && $facidnext)
{
$objectreplacing=new Facture($this->db);
$objectreplacing->fetch($facidnext);
$posy+=4;
$pdf->SetXY($this->marges['g'],$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ReplacementByInvoice").' : '.$outputlangs->convToOutputCharset($objectreplacing->ref), '', 'L');
}
if ($object->type == 1)
{
$objectreplaced=new Facture($this->db);
$objectreplaced->fetch($object->fk_facture_source);
$posy+=4;
$pdf->SetXY($this->marges['g'],$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ReplacementInvoice").' : '.$outputlangs->convToOutputCharset($objectreplaced->ref), '', 'L');
}
if ($object->type == 2)
{
$objectreplaced=new Facture($this->db);
$objectreplaced->fetch($object->fk_facture_source);
$posy+=4;
$pdf->SetXY($this->marges['g'],$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CorrectionInvoice").' : '.$outputlangs->convToOutputCharset($objectreplaced->ref), '', 'L');
}
if ($object->type != 2)
{
$posy+=8;
$pdf->SetXY($this->marges['g'],$posy+5);
$posy+=5;
$pdf->SetXY($this->marges['g'],$posy);
$pdf->SetFont('Arial','',9);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("DateEcheance")." : " . dol_print_date($object->date_lim_reglement,"day",false,$outputlangs,true), '', 'L');
}
@ -953,12 +991,12 @@ class pdf_oursin extends ModelePDFFactures
if ($object->client->code_client)
{
$posy+=4;
$pdf->SetXY($this->marges['g'],$posy+5);
$pdf->SetXY($this->marges['g'],$posy);
$pdf->SetFont('Arial','',9);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $object->client->code_client, '', 'L');
}
/*
* ref propal
*/
@ -975,7 +1013,7 @@ class pdf_oursin extends ModelePDFFactures
if ($objp->ref)
{
$posy+=4;
$pdf->SetXY($this->marges['g'],$posy+5);
$pdf->SetXY($this->marges['g'],$posy);
$pdf->SetFont('Arial','',9);
$pdf->MultiCell(60, 3, $outputlangs->transnoentities("RefProposal")." : ".$objp->ref);
}

View File

@ -13,6 +13,12 @@ BillsStatisticsSuppliers=Suppliers' invoices statistics
InvoiceStandard=Standard invoice
InvoiceStandardAsk=Standard invoice
InvoiceStandardDesc=This kind of invoice is the common invoice.
InvoiceDeposit=Deposit invoice
InvoiceDepositAsk=Deposit invoice
InvoiceDepositDesc=This kind of invoice is done when a deposit has been received.
InvoiceProFormat=Proformat invoice
InvoiceProFormatAsk=Proformat invoice
InvoiceProFormatDesc=<b>Proformat invoice</b> is an image of a true invoice but has no accountancy value.
InvoiceReplacement=Replacement invoice. Must replace invoice with reference
InvoiceReplacementAsk=Replacement invoice for invoice
InvoiceReplacementDesc=<b>Replacement invoice</b> is used to cancel and replace completely an invoice with no payment already received.<br><br>Note: Only invoice with no payment on it can be replaced. If not closed, it will be automatically closed to 'abandonned'.
@ -49,7 +55,7 @@ PaymentsBack=Payments back
DatePayment=Payment date
DeletePayment=Delete payment
ConfirmDeletePayment=Are you sure you want to delete this payment ?
ConfirmConvertToReduc=Do you want to convert this credit note into absolute discount ?<br>The amount of this credit note will so be saved among all discounts and could be used as a discount for a current or a future invoice for this customer.
ConfirmConvertToReduc=Do you want to convert this credit note or deposit into an absolute discount ?<br>The amount will so be saved among all discounts and could be used as a discount for a current or a future invoice for this customer.
SupplierPayments=Suppliers payments
ReceivedPayments=Received payments
ReceivedCustomersPayments=Payments received from customers
@ -87,6 +93,7 @@ BillStatus=Invoice status
BillStatusDraft=Draft (needs to be validated)
BillStatusPayed=Payed
BillStatusPayedBackOrConverted=Payed or converted into discount
BillStatusConverted=Converted into discount
BillStatusCanceled=Abandonned
BillStatusValidated=Validated (needs to be payed)
BillStatusStarted=Started
@ -160,6 +167,7 @@ ShowBill=Show invoice
ShowInvoice=Show invoice
ShowInvoiceReplace=Show replacing invoice
ShowInvoiceAvoir=Show credit note
ShowInvoiceDeposit=Show deposit invoice
ShowPayment=Show payment
File=File
AlreadyPayed=Already payed

View File

@ -14,6 +14,12 @@ BillsStatisticsSuppliers=Statistiques factures fournisseurs
InvoiceStandard=Facture standard
InvoiceStandardAsk=Facture standard
InvoiceStandardDesc=Ce type de facture est la facture traditionnelle. On l'appelle aussi <b>facture de doit</b> (du verbe devoir).
InvoiceDeposit=Facture d'accompte
InvoiceDepositAsk=Facture d'accompte
InvoiceDepositDesc=La <b>facture d'accompte</b> est le type de facture faite suite à réception d'un accompte.
InvoiceProFormat=Facture proformat
InvoiceProFormatAsk=Facture proformat
InvoiceProFormatDesc=La <b>facture proformat</b> est une image de facture définitive mais qui n'a aucune valeure comptable.
InvoiceReplacement=Facture de remplacement
InvoiceReplacementAsk=Facture de remplacement de la facture
InvoiceReplacementDesc=La <b>facture de remplacement</b> sert à annuler et remplacer une facture existante sur laquelle aucun paiement n'a encore eu lieu.<br><br>Rem: Seule une facture sans aucun paiement peut être remplacée. Si cette dernière n'est pas fermée, elle le sera automatiquement au statut 'abandonnée'.
@ -49,7 +55,7 @@ PaymentsBack=Remboursements
DatePayment=Date paiement
DeletePayment=Supprimer le paiement
ConfirmDeletePayment=Etes vous sur de vouloir supprimer ce paiement ?
ConfirmConvertToReduc=Voulez-vous convertir cet avoir en réduction future ?<br>Le montant de cet avoir sera alors stocké en réduction fixe en attente pour le client. Cette dernière pourra être utilisée pour réduire le montant d'une facture en cours ou prochaine de ce client.
ConfirmConvertToReduc=Voulez-vous convertir cet avoir ou accompte en réduction future ?<br>Le montant sera alors stocké en réduction fixe en attente pour le client. Cette dernière pourra être utilisée pour réduire le montant d'une facture en cours ou prochaine de ce client.
SupplierPayments=Réglements fournisseurs
ReceivedPayments=Réglements reçus
ReceivedCustomersPayments=Réglements reçus du client
@ -87,6 +93,7 @@ BillStatus=État de la facture
BillStatusDraft=Brouillon (à valider)
BillStatusPayed=Payée
BillStatusPayedBackOrConverted=Remboursé ou converti en réduction
BillStatusConverted=Converti en réduction
BillStatusCanceled=Abandonnée
BillStatusValidated=Validée (à payer)
BillStatusStarted=Réglement commencé
@ -160,6 +167,7 @@ ShowBill=Afficher facture
ShowInvoice=Afficher facture
ShowInvoiceReplace=Afficher facture de remplacement
ShowInvoiceAvoir=Afficher facture avoir
ShowInvoiceDeposit=Afficher facture d'accompte
ShowPayment=Afficher réglement
File=Fichier
AlreadyPayed=Déjà réglé

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -41,7 +41,6 @@ insert into llx_cond_reglement(rowid, code, sortorder, active, libelle, libelle_
insert into llx_cond_reglement(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (3,'30DENDMONTH', 3,1, '30 jours fin de mois','Réglement à 30 jours fin de mois',1,30);
insert into llx_cond_reglement(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (4,'60D', 4,1, '60 jours','Réglement à 60 jours',0,60);
insert into llx_cond_reglement(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (5,'60DENDMONTH', 5,1, '60 jours fin de mois','Réglement à 60 jours fin de mois',1,60);
insert into llx_cond_reglement(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (6,'PROFORMA', 6,1, 'Proforma','Réglement avant livraison',0,0);
--