Work on revenue stamp
This commit is contained in:
parent
c8d6e9e44a
commit
90025f9c13
@ -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 '<td rowspan="'.$nbrows.'" colspan="2" valign="top">';
|
||||
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
@ -3042,6 +3050,33 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '<td align="right" colspan="3" nowrap>'.price($object->total_localtax2,1,'',1,-1,-1,$conf->currency).'</td></tr>';
|
||||
}
|
||||
|
||||
// Revenue stamp
|
||||
if ($selleruserevenustamp) // Test company use revenue stamp
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('RevenueStamp');
|
||||
print '</td>';
|
||||
if ($action != 'editrevenuestamp' && ! empty($object->brouillon) && $user->rights->facture->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editrevenuestamp&facid='.$object->id.'">'.img_edit($langs->trans('SetRevenuStamp'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3" align="right">';
|
||||
if ($action == 'editrevenuestamp')
|
||||
{
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setrevenuestamp">';
|
||||
print '<input type="text" class="flat" size="4" name="revenuestamp" value="'.price2num($object->revenuestamp).'">';
|
||||
print ' <input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print price($object->revenuestamp,1,'',1,-1,-1,$conf->currency);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Total with tax
|
||||
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td align="right" colspan="3" nowrap>'.price($object->total_ttc,1,'',1,-1,-1,$conf->currency).'</td></tr>';
|
||||
|
||||
// Statut
|
||||
|
||||
@ -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").",";
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user