diff --git a/ChangeLog b/ChangeLog index 06266a52bb4..94926a0c0e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ $Id:$ ***** ChangeLog for 3.1.1 compared to 3.1.0 ***** +- New: Add option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS - Fix: Removed warnings during install diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 2687e318a4e..4711ecf7c60 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1946,10 +1946,16 @@ else if ($object->paye) $resteapayer=0; $resteapayeraffiche=$resteapayer; - //$filterabsolutediscount="fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice - //$filtercreditnote="fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice - $filterabsolutediscount="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')"; - $filtercreditnote="fk_facture_source IS NOT NULL AND description <> '(DEPOSIT)'"; + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) + { + $filterabsolutediscount="fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice + $filtercreditnote="fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice + } + else + { + $filterabsolutediscount="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')"; + $filtercreditnote="fk_facture_source IS NOT NULL AND description <> '(DEPOSIT)'"; + } $absolute_discount=$soc->getAvailableDiscounts('',$filterabsolutediscount); $absolute_creditnote=$soc->getAvailableDiscounts('',$filtercreditnote); diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 999409cfb36..3e81f7e3a16 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -36,8 +36,7 @@ $langs->load("bills"); // Security check $socid = GETPOST("socid"); if ($user->societe_id > 0) $socid = $user->societe_id; -if (!$user->rights->compta->resultat->lire && !$user->rights->accounting->comptarapport->lire) -accessforbidden(); +if (!$user->rights->compta->resultat->lire && !$user->rights->accounting->comptarapport->lire) accessforbidden(); // Date range $year=GETPOST("year"); @@ -109,6 +108,8 @@ if ($modecompta=="CREANCES-DETTES") $period=$html->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$html->select_date($date_end,'date_end',0,0,0,'',1,0,1); //$periodlink=''.img_previous().' '.img_next().''; $description=$langs->trans("RulesResultDue"); + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); + else $description.= $langs->trans("DepositsAreIncluded"); $builddate=time(); //$exportlink=$langs->trans("NotYetAvailable"); } @@ -137,14 +138,19 @@ print "\n"; */ print '
| ';
- //if (! $filter || $filter=="fk_facture_source IS NULL") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount),$langs->transnoentities("Currency".$conf->monnaie)).': '; // If we want deposit to be substracted to payments only and not to total of final invoice
- if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount),$langs->transnoentities("Currency".$conf->monnaie)).': ';
- else print $langs->trans("CompanyHasCreditNote",price($amount),$langs->transnoentities("Currency".$conf->monnaie)).': ';
- // print $langs->trans("AvailableGlobalDiscounts").': ';
+ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
+ {
+ if (! $filter || $filter=="fk_facture_source IS NULL") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount),$langs->transnoentities("Currency".$conf->currency)).': '; // If we want deposit to be substracted to payments only and not to total of final invoice
+ else print $langs->trans("CompanyHasCreditNote",price($amount),$langs->transnoentities("Currency".$conf->monnaie)).': ';
+ }
+ else
+ {
+ if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount),$langs->transnoentities("Currency".$conf->currency)).': ';
+ else print $langs->trans("CompanyHasCreditNote",price($amount),$langs->transnoentities("Currency".$conf->monnaie)).': ';
+ }
$newfilter='fk_facture IS NULL AND fk_facture_line IS NULL'; // Remises disponibles
if ($filter) $newfilter.=' AND ('.$filter.')';
$nbqualifiedlines=$this->select_remises($selected,$htmlname,$newfilter,$socid,$maxvalue);
diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang
index b1e399af7ef..de69bd50c39 100644
--- a/htdocs/langs/en_US/compta.lang
+++ b/htdocs/langs/en_US/compta.lang
@@ -102,16 +102,21 @@ SeeReportInInputOutputMode=See report %sIncomes-Expenses%s said cash a
SeeReportInDueDebtMode=See report %sClaims-Debts%s said commitment accounting for a calculation on issued invoices
RulesResultDue=- Amounts shown are with all taxes included - It includes outstanding invoices, expenses and VAT whether they are paid or not. - It is based on the validation date of invoices and VAT and on the due date for expenses. RulesResultInOut=- Amounts shown are with all taxes included - It includes the real payments made on invoices, expenses and VAT. - It is based on the payment dates of the invoices, expenses anf VAT. -RulesCADue=- It includes the client's due invoices (except deposit invoices) whether they are paid or not. - It is based on the validation date of these invoices. +RulesCADue=- It includes the client's due invoices whether they are paid or not. - It is based on the validation date of these invoices. RulesCAIn=- It includes all the effective payments of invoices received from clients. - It is based on the payment date of these invoices +DepositsAreNotIncluded=- Deposit invoices are nor included +DepositsAreIncluded=- Deposit invoices are included +LT2ReportByCustomersInInputOutputModeES=Report by third party IRPF VATReportByCustomersInInputOutputMode=Report by the customer VAT collected and paid (VAT receipt) VATReportByCustomersInDueDebtMode=Report by the customer VAT collected and paid (VAT rate) VATReportByQuartersInInputOutputMode=Report by rate of the VAT collected and paid (VAT receipt) VATReportByQuartersInDueDebtMode=Report by rate of the VAT collected and paid (VAT rate) SeeVATReportInInputOutputMode=See report %sVAT encasement%s for a standard calculation SeeVATReportInDueDebtMode=See report %sVAT on flow%s for a calculation with an option on the flow -RulesVATIn=For services, the report includes the VAT regulations actually received or issued on the basis of the date of payment. - For material assets, it includes the VAT invoices on the basis of the invoice date. -RulesVATDue=For services, the report includes VAT invoices due, paid or not, based on the invoice date. - For material assets, it includes the VAT invoices, based on the invoice date. +RulesVATInServices=- For services, the report includes the VAT regulations actually received or issued on the basis of the date of payment. - For material assets, it includes the VAT invoices on the basis of the invoice date. +RulesVATInProducts=- For material assets, it includes the VAT invoices on the basis of the invoice date. +RulesVATDueServices=- For services, the report includes VAT invoices due, paid or not, based on the invoice date. +RulesVATDueProducts=- For material assets, it includes the VAT invoices, based on the invoice date. OptionVatInfoModuleComptabilite=Note: For material assets, it should use the date of delivery to be more fair. PercentOfInvoice=%%/invoice NotUsedForGoods=Not used on goods diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang index 1bd9a474680..c9000d7d7af 100644 --- a/htdocs/langs/fr_FR/compta.lang +++ b/htdocs/langs/fr_FR/compta.lang @@ -102,16 +102,21 @@ SeeReportInInputOutputMode=Voir le rapport %sRecettes-Dépenses%s dit SeeReportInDueDebtMode=Voir le rapport %sCréances-Dettes%s dit comptabilité d'engagement pour un calcul sur les factures émises RulesResultDue=- Les montants affichés sont les montants taxe incluse - Il inclut les factures, charges et tva dues, qu'elles soient payées ou non. - Il se base sur la date de validation pour les factures et la tva et sur la date d'échéance pour les charges. RulesResultInOut=- Les montants affichés sont les montants taxe incluse - Il inclut les règlements effectivement réalisés pour les factures, les charges et la TVA. - Il se base sur la date de règlement de ces factures, charges et TVA. -RulesCADue=- Il inclut les factures clients dues (hors facture accompte), qu'elles soient payées ou non. - Il se base sur la date de validation de ces factures. +RulesCADue=- Il inclut les factures clients dues, qu'elles soient payées ou non. - Il se base sur la date de validation de ces factures. RulesCAIn=- Il inclut les règlements effectivement reçus des factures clients. - Il se base sur la date de règlement de ces factures +DepositsAreNotIncluded=- Les factures d'accomptes ne sont pas incluses +DepositsAreIncluded=- Les factures d'accomptes sont incluses +LT2ReportByCustomersInInputOutputModeES=Rapport par client des IRPF VATReportByCustomersInInputOutputMode=Rapport par client des TVA collectées et payées (TVA sur encaissement) VATReportByCustomersInDueDebtMode=Rapport par client des TVA collectées et payées (TVA sur débit) VATReportByQuartersInInputOutputMode=Rapport par taux des TVA collectées et payées (TVA sur encaissement) VATReportByQuartersInDueDebtMode=Rapport par taux des TVA collectées et payées (TVA sur débit) SeeVATReportInInputOutputMode=Voir le rapport %sTVA encaissement%s pour mode de calcul standard SeeVATReportInDueDebtMode=Voir le rapport %sTVA sur débit%s pour mode de calcul avec option sur les débits -RulesVATIn=- Pour les services, le rapport inclut les TVA des règlements effectivement reçus ou émis en se basant sur la date du règlement. - Pour les biens matériels, il inclut les TVA des factures en se basant sur la date de facture. -RulesVATDue=- Pour les services, le rapport inclut les TVA des factures dues, payées ou non en se basant sur la date de facture. - Pour les biens matériels, il inclut les TVA des factures en se basant sur la date de facture. +RulesVATInServices=- Pour les services, le rapport inclut les TVA des règlements effectivement reçus ou émis en se basant sur la date du règlement. +RulesVATInProducts=- Pour les biens matériels, il inclut les TVA des factures en se basant sur la date de facture. +RulesVATDueServices=- Pour les services, le rapport inclut les TVA des factures dues, payées ou non en se basant sur la date de facture. +RulesVATDueProducts=- Pour les biens matériels, il inclut les TVA des factures en se basant sur la date de facture. OptionVatInfoModuleComptabilite=Remarque : Pour les biens matériels, il faudrait utiliser la date de livraison pour être plus juste. PercentOfInvoice=%%/facture NotUsedForGoods=Non utilisé pour les biens diff --git a/htdocs/lib/tax.lib.php b/htdocs/lib/tax.lib.php index 806f6793c55..4b7e681daf6 100644 --- a/htdocs/lib/tax.lib.php +++ b/htdocs/lib/tax.lib.php @@ -81,10 +81,8 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction $sql.= " ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE f.entity = " . $conf->entity; $sql.= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely) - $sql.= " AND (f.type = 0"; // Standard - $sql.= " OR f.type = 1"; // Replacement - $sql.= " OR f.type = 2)"; // Credit note - //$sql.= " OR f.type = 3"; // We do not include deposit + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)"; + else $sql.= " AND f.type IN (0,1,2,3)"; if ($y && $m) { $sql.= " AND f.datef >= '".$db->idate(dol_get_first_day($y,$m,false))."'"; @@ -120,10 +118,8 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction $sql.= " FROM ".MAIN_DB_PREFIX.$invoicetable." as f, ".MAIN_DB_PREFIX.$invoicetable." as fd, ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE "; $sql.= " f.fk_statut in (2)"; // Paid (partially or completely) - $sql.= " AND (f.type = 0"; // Standard - $sql.= " OR f.type = 1"; // Replacement - $sql.= " OR f.type = 2)"; // Credit note - //$sql.= " OR f.type = 3"; // We do not include deposit + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)"; + else $sql.= " AND f.type IN (0,1,2,3)"; if ($y && $m) { $sql.= " AND f.datef >= '".$db->idate(dol_get_first_day($y,$m,false))."'"; @@ -238,10 +234,8 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql.= " WHERE f.entity = " . $conf->entity; $sql.= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely) - $sql.= " AND (f.type = 0"; // Standard - $sql.= " OR f.type = 1"; // Replacement - $sql.= " OR f.type = 2)"; // Credit note - //$sql.= " OR f.type = 3"; // We do not include deposit + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)"; + else $sql.= " AND f.type IN (0,1,2,3)"; $sql.= " AND f.rowid = d.".$fk_facture; if ($y && $m) { @@ -279,23 +273,14 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, $sql.= " f.facnumber as facnum, f.type, f.total_ttc as ftotal_ttc,"; $sql.= " p.rowid as pid, p.ref as pref, p.fk_product_type as ptype,"; $sql.= " 0 as payment_id, 0 as payment_amount"; -// $sql.= " pf.".$fk_payment." as payment_id, pf.amount as payment_amount"; $sql.= " FROM ".MAIN_DB_PREFIX.$invoicetable." as f,"; -// $sql.= " ".MAIN_DB_PREFIX.$paymentfacturetable." as pf,"; -// $sql.= " ".MAIN_DB_PREFIX.$paymenttable." as pa,"; $sql.= " ".MAIN_DB_PREFIX.$invoicedettable." as d" ; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql.= " WHERE f.entity = " . $conf->entity; $sql.= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely) - $sql.= " AND (f.type = 0"; // Standard - $sql.= " OR f.type = 1"; // Replacement - $sql.= " OR f.type = 2)"; // Credit note - //$sql.= " OR f.type = 3"; // We do not include deposit + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)"; + else $sql.= " AND f.type IN (0,1,2,3)"; $sql.= " AND f.rowid = d.".$fk_facture; -// $sql.= " AND pf.".$fk_facture2." = f.rowid"; -// $sql.= " AND pa.rowid = pf.".$fk_payment; -// $sql.= " AND pa.datep >= '".$y."0101000000' AND pa.datep <= '".$y."1231235959'"; -// $sql.= " AND (date_format(pa.datep,'%m') > ".(($q-1)*3)." AND date_format(pa.datep,'%m') <= ".($q*3).")"; if ($y && $m) { $sql.= " AND f.datef >= '".$db->idate(dol_get_first_day($y,$m,false))."'"; @@ -399,10 +384,8 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql.= " WHERE f.entity = " . $conf->entity; $sql.= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely) - $sql.= " AND (f.type = 0"; // Standard - $sql.= " OR f.type = 1"; // Replacement - $sql.= " OR f.type = 2)"; // Credit note - //$sql.= " OR f.type = 3"; // We do not include deposit + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)"; + else $sql.= " AND f.type IN (0,1,2,3)"; $sql.= " AND f.rowid = d.".$fk_facture; if ($y && $m) { @@ -448,10 +431,8 @@ function vat_by_date($db, $y, $q, $date_start, $date_end, $modetax, $direction, $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid"; $sql.= " WHERE f.entity = " . $conf->entity; $sql.= " AND f.fk_statut in (1,2)"; // Paid (partially or completely) - $sql.= " AND (f.type = 0"; // Standard - $sql.= " OR f.type = 1"; // Replacement - $sql.= " OR f.type = 2)"; // Credit note - //$sql.= " OR f.type = 3"; // We do not include deposit + if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2)"; + else $sql.= " AND f.type IN (0,1,2,3)"; $sql.= " AND f.rowid = d.".$fk_facture;; $sql.= " AND pf.".$fk_facture2." = f.rowid"; $sql.= " AND pa.rowid = pf.".$fk_payment; |