diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 77294a3c459..aa6f3cfec07 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -302,6 +302,14 @@ else if ($action == 'setpaymentterm' && $user->rights->facture->creer)
$result=$object->update($user);
if ($result < 0) dol_print_error($db,$object->error);
}
+else if ($action == 'setrevenuestamp' && $user->rights->facture->creer)
+{
+ $object->fetch($id);
+ $object->revenuestamp=GETPOST('revenuestamp');
+ $result=$object->update($user);
+ $object->update_price(1);
+ if ($result < 0) dol_print_error($db,$object->error);
+}
else if ($action == 'setremisepercent' && $user->rights->facture->creer)
{
$object->fetch($id);
@@ -2745,6 +2753,7 @@ else if ($id > 0 || ! empty($ref))
/*
* List of payments
*/
+ $selleruserevenustamp=empty($conf->global->MAIN_USE_REVENUE_STAMP)?0:1; // TODO Add method societe->useRevenueStamp() to look into table llx_c_revenue_stamp if there is one line for country
$sign=1;
if ($object->type == 2) $sign=-1;
@@ -2752,11 +2761,10 @@ else if ($id > 0 || ! empty($ref))
$nbrows=8; $nbcols=2;
if (! empty($conf->projet->enabled)) $nbrows++;
if (! empty($conf->banque->enabled)) $nbcols++;
-
- //Local taxes
if($mysoc->localtax1_assuj=="1") $nbrows++;
if($mysoc->localtax2_assuj=="1") $nbrows++;
-
+ if ($selleruserevenustamp) $nbrows++;
+
print '
';
print '';
@@ -3042,6 +3050,33 @@ else if ($id > 0 || ! empty($ref))
print '| '.price($object->total_localtax2,1,'',1,-1,-1,$conf->currency).' | ';
}
+ // Revenue stamp
+ if ($selleruserevenustamp) // Test company use revenue stamp
+ {
+ print '| ';
+ print '';
+ print ' | ';
+ if ($action == 'editrevenuestamp')
+ {
+ print '';
+ }
+ else
+ {
+ print price($object->revenuestamp,1,'',1,-1,-1,$conf->currency);
+ }
+ print ' | ';
+ }
+
+ // Total with tax
print '| '.$langs->trans('AmountTTC').' | '.price($object->total_ttc,1,'',1,-1,-1,$conf->currency).' | ';
// Statut
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index f3427ee5d4b..38995fdebb9 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -75,6 +75,7 @@ class Facture extends CommonInvoice
var $total_ht=0;
var $total_tva=0;
var $total_ttc=0;
+ var $revenuestamp;
var $note; // deprecated
var $note_private;
var $note_public;
@@ -795,7 +796,8 @@ class Facture extends CommonInvoice
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
- $sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount,f.tva, f.localtax1, f.localtax2, f.total,f.total_ttc,f.remise_percent,f.remise_absolue,f.remise';
+ $sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount,f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp';
+ $sql.= ', f.remise_percent, f.remise_absolue, f.remise';
$sql.= ', f.datef as df';
$sql.= ', f.date_lim_reglement as dlr';
$sql.= ', f.datec as datec';
@@ -841,6 +843,7 @@ class Facture extends CommonInvoice
$this->total_localtax1 = $obj->localtax1;
$this->total_localtax2 = $obj->localtax2;
$this->total_ttc = $obj->total_ttc;
+ $this->revenuestamp = $obj->revenuestamp;
$this->paye = $obj->paye;
$this->close_code = $obj->close_code;
$this->close_note = $obj->close_note;
@@ -1050,6 +1053,7 @@ class Facture extends CommonInvoice
$sql.= " localtax2=".(isset($this->total_localtax2)?$this->total_localtax2:"null").",";
$sql.= " total=".(isset($this->total_ht)?$this->total_ht:"null").",";
$sql.= " total_ttc=".(isset($this->total_ttc)?$this->total_ttc:"null").",";
+ $sql.= " revenuestamp=".((isset($this->revenuestamp) && $this->revenuestamp != '')?$this->revenuestamp:"null").",";
$sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").",";
$sql.= " fk_user_author=".(isset($this->user_author)?$this->user_author:"null").",";
$sql.= " fk_user_valid=".(isset($this->fk_user_valid)?$this->fk_user_valid:"null").",";
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index dcd96ed6734..79a471a0251 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -1509,9 +1509,6 @@ abstract class CommonObject
$this->total_localtax2 += $obj->total_localtax2;
$this->total_ttc += $obj->total_ttc;
- // Add revenue stamp to total
- $this->total_ttc += isset($this->revenuestamp)?$this->revenuestamp:0;
-
// Check if there is a global invoice tax for this vat rate
// FIXME: We should have no database access into this function. Also localtax 7 seems to have problem so i add condition to avoid it into standard usage without loosing it.
if (! empty($conf->global->MAIN_USE_LOCALTAX_TYPE_7))
@@ -1559,6 +1556,9 @@ abstract class CommonObject
$i++;
}
+ // Add revenue stamp to total
+ $this->total_ttc += isset($this->revenuestamp)?$this->revenuestamp:0;
+
$this->db->free($resql);
// Now update global field total_ht, total_ttc and tva
diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang
index 785f131b61b..1ce21c7a8f6 100644
--- a/htdocs/langs/en_US/bills.lang
+++ b/htdocs/langs/en_US/bills.lang
@@ -390,6 +390,7 @@ AllCompletelyPayedInvoiceWillBeClosed=All invoice with no remain to pay will be
ToMakePayment=Pay
ToMakePaymentBack=Pay back
ListOfYourUnpaidInvoices=List of unpaid invoices
+RevenueStamp=Revenue stamp
##### Types de contacts #####
TypeContact_facture_internal_SALESREPFOLL=Representative following-up customer invoice
TypeContact_facture_external_BILLING=Customer invoice contact
diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang
index 51424be1cbf..e5955167dd8 100644
--- a/htdocs/langs/fr_FR/bills.lang
+++ b/htdocs/langs/fr_FR/bills.lang
@@ -387,6 +387,7 @@ AllCompletelyPayedInvoiceWillBeClosed=Toutes les factures avec un reste à payer
ToMakePayment=Payer
ToMakePaymentBack=Rembourser
ListOfYourUnpaidInvoices=Liste des factures impayées
+RevenueStamp=Timbre fiscal
##### Types de contacts #####
TypeContact_facture_internal_SALESREPFOLL=Responsable suivi facture client
TypeContact_facture_external_BILLING=Contact client facturation
|