Add hidden option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS(cherry picked from
commit 77870d0557)
Conflicts:
htdocs/compta/resultat/clientfourn.php
htdocs/compta/stats/cabyuser.php
htdocs/compta/stats/casoc.php
htdocs/compta/stats/index.php
htdocs/compta/stats/prev.php
htdocs/compta/tva/clients.php
htdocs/core/class/html.form.class.php
htdocs/langs/en_US/compta.lang
htdocs/langs/fr_FR/compta.lang
This commit is contained in:
parent
16b1dcd49c
commit
032db89caa
@ -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
|
||||
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
|
||||
$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 "</tr>\n";
|
||||
*/
|
||||
print '<tr><td colspan="4">'.$langs->trans("CustomersInvoices").'</td></tr>';
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
if ($modecompta == 'CREANCES-DETTES')
|
||||
{
|
||||
$sql = "SELECT s.nom, s.rowid as socid, sum(f.total) as amount_ht, sum(f.total_ttc) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.fk_statut in (1,2)";
|
||||
$sql.= " AND f.fk_statut IN (1,2)";
|
||||
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 ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
|
||||
* vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
|
||||
@ -274,9 +280,13 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.fk_statut in (1,2)";
|
||||
$sql.= " AND f.fk_statut IN (1,2)";
|
||||
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 ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT s.nom, s.rowid as socid, date_format(p.datep,'%Y-%m') as dm, sum(pf.amount) as amount_ttc";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."paiementfourn as p";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf";
|
||||
@ -302,8 +312,10 @@ if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$var=true;
|
||||
if ($num > 0) {
|
||||
while ($i < $num) {
|
||||
if ($num > 0)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
|
||||
@ -321,7 +333,8 @@ if ($result) {
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]><td> </td>";
|
||||
print '<td colspan="3">'.$langs->trans("None").'</td>';
|
||||
@ -345,7 +358,8 @@ print '</tr>';
|
||||
|
||||
print '<tr><td colspan="4">'.$langs->trans("SocialContributions").'</td></tr>';
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
if ($modecompta == 'CREANCES-DETTES')
|
||||
{
|
||||
$sql = "SELECT c.libelle as nom, sum(s.amount) as amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as s";
|
||||
@ -353,7 +367,8 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql.= " AND c.deductible = 0";
|
||||
if ($date_start && $date_end) $sql.= " AND s.date_ech >= '".$db->idate($date_start)."' AND s.date_ech <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
$sql = "SELECT c.libelle as nom, sum(p.amount) as amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as s";
|
||||
@ -413,7 +428,8 @@ print '</tr>';
|
||||
|
||||
print '<tr><td colspan="4">'.$langs->trans("SocialContributions").'</td></tr>';
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
if ($modecompta == 'CREANCES-DETTES')
|
||||
{
|
||||
$sql = "SELECT c.libelle as nom, sum(s.amount) as amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as s";
|
||||
@ -423,7 +439,8 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY c.libelle DESC";
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
$sql = "SELECT c.libelle as nom, sum(p.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as s";
|
||||
@ -507,11 +524,13 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
$amount=0;
|
||||
$sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.tva) as amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " WHERE f.fk_statut in (1,2)";
|
||||
$sql.= " WHERE f.fk_statut IN (1,2)";
|
||||
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 ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= " ORDER BY dm DESC";
|
||||
$sql.= " ORDER BY dm";
|
||||
|
||||
dol_syslog("get vat to pay sql=".$sql);
|
||||
$result=$db->query($sql);
|
||||
@ -524,9 +543,9 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$amount = $amount - $obj->amount;
|
||||
$total_ht = $total_ht - $obj->amount;
|
||||
//$total_ht = $total_ht - $obj->amount;
|
||||
$total_ttc = $total_ttc - $obj->amount;
|
||||
$subtotal_ht = $subtotal_ht - $obj->amount;
|
||||
//$subtotal_ht = $subtotal_ht - $obj->amount;
|
||||
$subtotal_ttc = $subtotal_ttc - $obj->amount;
|
||||
$i++;
|
||||
}
|
||||
@ -536,7 +555,7 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
}
|
||||
print "<tr $bc[$var]><td> </td>";
|
||||
print "<td>".$langs->trans("VATToPay")."</td>\n";
|
||||
if ($modecompta == 'CREANCES-DETTES') print "<td align=\"right\">".price($amount)."</td>\n";
|
||||
print "<td align=\"right\"> </td>\n";
|
||||
print "<td align=\"right\">".price($amount)."</td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
@ -544,11 +563,13 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
$amount=0;
|
||||
$sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.total_tva) as amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql.= " WHERE f.fk_statut in (1,2)";
|
||||
$sql.= " WHERE f.fk_statut IN (1,2)";
|
||||
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 ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= " ORDER BY dm DESC";
|
||||
$sql.= " ORDER BY dm";
|
||||
|
||||
dol_syslog("get vat received back sql=".$sql);
|
||||
$result=$db->query($sql);
|
||||
@ -561,9 +582,9 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$amount = $amount + $obj->amount;
|
||||
$total_ht = $total_ht + $obj->amount;
|
||||
//$total_ht = $total_ht + $obj->amount;
|
||||
$total_ttc = $total_ttc + $obj->amount;
|
||||
$subtotal_ht = $subtotal_ht + $obj->amount;
|
||||
//$subtotal_ht = $subtotal_ht + $obj->amount;
|
||||
$subtotal_ttc = $subtotal_ttc + $obj->amount;
|
||||
|
||||
$i++;
|
||||
@ -574,7 +595,7 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
}
|
||||
print "<tr $bc[$var]><td> </td>";
|
||||
print "<td>".$langs->trans("VATToCollect")."</td>\n";
|
||||
if ($modecompta == 'CREANCES-DETTES') print "<td align=\"right\">".price($amount)."</td>\n";
|
||||
print "<td align=\"right\"> </td>\n";
|
||||
print "<td align=\"right\">".price($amount)."</td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
@ -663,8 +684,8 @@ else
|
||||
if ($mysoc->tva_assuj != 'franchise') // Assujeti
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
if ($modecompta == 'CREANCES-DETTES') print '<td colspan="3" align="right">'.price(price2num($subtotal_ht)).'</td>';
|
||||
print '<td colspan="3" align="right">'.price(price2num($subtotal_ttc)).'</td>';
|
||||
if ($modecompta == 'CREANCES-DETTES') print '<td colspan="3" align="right"> </td>';
|
||||
print '<td colspan="3" align="right">'.price(price2num($subtotal_ttc,'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -59,13 +59,15 @@ llxHeader();
|
||||
$html=new Form($db);
|
||||
|
||||
// Affiche en-tete du rapport
|
||||
if ($modecompta=="CREANCES-DETTES")
|
||||
if ($modecompta == 'CREANCES-DETTES')
|
||||
{
|
||||
$nom=$langs->trans("AnnualSummaryDueDebtMode");
|
||||
$nom.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
$period="$year_start - $year_end";
|
||||
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
|
||||
$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");
|
||||
}
|
||||
@ -86,13 +88,18 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl
|
||||
*/
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
if ($modecompta == 'CREANCES-DETTES')
|
||||
{
|
||||
$sql = "SELECT sum(f.total) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.fk_statut in (1,2)";
|
||||
} else {
|
||||
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)";
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
|
||||
* vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
|
||||
@ -130,7 +137,8 @@ else {
|
||||
}
|
||||
|
||||
// On ajoute les paiements clients anciennes version, non lies par paiement_facture
|
||||
if ($modecompta != 'CREANCES-DETTES') {
|
||||
if ($modecompta != 'CREANCES-DETTES')
|
||||
{
|
||||
$sql = "SELECT sum(p.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
@ -170,11 +178,16 @@ if ($modecompta != 'CREANCES-DETTES') {
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
if ($modecompta == 'CREANCES-DETTES')
|
||||
{
|
||||
$sql = "SELECT sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql.= " WHERE f.fk_statut IN (1,2)";
|
||||
} else {
|
||||
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)";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT sum(pf.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
@ -213,13 +226,16 @@ else {
|
||||
*/
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
if ($modecompta == 'CREANCES-DETTES')
|
||||
{
|
||||
// TVA a payer
|
||||
$sql = "SELECT sum(f.tva) as amount, date_format(f.datef,'%Y-%m') as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " WHERE f.fk_statut IN (1,2)";
|
||||
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.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY dm DESC";
|
||||
$sql.= " GROUP BY dm";
|
||||
|
||||
dol_syslog("get vat to pay sql=".$sql);
|
||||
$result=$db->query($sql);
|
||||
@ -244,6 +260,8 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql = "SELECT sum(f.total_tva) as amount, date_format(f.datef,'%Y-%m') as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql.= " WHERE f.fk_statut IN (1,2)";
|
||||
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.entity = ".$conf->entity;
|
||||
$sql.= " GROUP BY dm";
|
||||
|
||||
@ -327,14 +345,16 @@ else {
|
||||
*/
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
if ($modecompta == 'CREANCES-DETTES')
|
||||
{
|
||||
$sql = "SELECT c.libelle as nom, date_format(s.date_ech,'%Y-%m') as dm, sum(s.amount) as amount_ht, sum(s.amount) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as s";
|
||||
$sql.= " WHERE s.fk_type = c.id";
|
||||
$sql.= " AND c.deductible = 0";
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
$sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount_ht, sum(p.amount) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as s";
|
||||
@ -502,7 +522,8 @@ print '<tr class="liste_total"><td>'.$langs->trans("Profit").'</td>';
|
||||
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
{
|
||||
print '<td align="right" colspan="2"> ';
|
||||
if (isset($totentrees[$annee]) || isset($totsorties[$annee])) {
|
||||
if (isset($totentrees[$annee]) || isset($totsorties[$annee]))
|
||||
{
|
||||
print price($totentrees[$annee]-$totsorties[$annee]).'</td>';
|
||||
// print '<td> </td>';
|
||||
}
|
||||
@ -511,8 +532,8 @@ print "</tr>\n";
|
||||
|
||||
print "</table>";
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date: 2011/08/03 00:46:31 $ - $Revision: 1.49 $');
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@ -110,6 +110,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="<a href='".$_SERVER["PHP_SELF"]."?year=".($year-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year+1)."&modecompta=".$modecompta."'>".img_next()."</a>";
|
||||
$description=$langs->trans("RulesCADue");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
|
||||
else $description.= $langs->trans("DepositsAreIncluded");
|
||||
$builddate=time();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
}
|
||||
@ -119,6 +121,7 @@ else {
|
||||
$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="<a href='".$_SERVER["PHP_SELF"]."?year=".($year-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year+1)."&modecompta=".$modecompta."'>".img_next()."</a>";
|
||||
$description=$langs->trans("RulesCAIn");
|
||||
$description.= $langs->trans("DepositsAreIncluded");
|
||||
$builddate=time();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
}
|
||||
@ -135,13 +138,9 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
$sql = "SELECT u.rowid as rowid, u.name as name, u.firstname as firstname, sum(f.total) as amount, sum(f.total_ttc) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.fk_user_author = u.rowid";
|
||||
$sql.= " WHERE f.fk_statut in (1,2) ";
|
||||
$sql.= " AND (";
|
||||
$sql.= " f.type = 0"; // Standard
|
||||
$sql.= " OR f.type = 1"; // Replacement
|
||||
$sql.= " OR f.type = 2"; // Credit note
|
||||
$sql.= " OR f.type = 3"; // Deposit
|
||||
$sql.= ")";
|
||||
$sql.= " WHERE f.fk_statut in (1,2)";
|
||||
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 ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
else
|
||||
@ -303,7 +302,8 @@ if (sizeof($amount))
|
||||
|
||||
print "</table>";
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date: 2011/07/31 22:23:13 $ - $Revision: 1.41 $');
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@ -43,8 +43,7 @@ if (! $sortfield) $sortfield="nom";
|
||||
// Security check
|
||||
$socid = isset($_REQUEST["socid"])?$_REQUEST["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");
|
||||
@ -104,6 +103,7 @@ else
|
||||
llxHeader();
|
||||
|
||||
$html=new Form($db);
|
||||
$thirdparty_static=new Societe($db);
|
||||
|
||||
// Affiche en-tete de rapport
|
||||
if ($modecompta=="CREANCES-DETTES")
|
||||
@ -113,6 +113,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='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
|
||||
$description=$langs->trans("RulesCADue");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
|
||||
else $description.= $langs->trans("DepositsAreIncluded");
|
||||
$builddate=time();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
}
|
||||
@ -122,6 +124,7 @@ else {
|
||||
$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='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
|
||||
$description=$langs->trans("RulesCAIn");
|
||||
$description.= $langs->trans("DepositsAreIncluded");
|
||||
$builddate=time();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
}
|
||||
@ -138,12 +141,8 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " WHERE f.fk_statut in (1,2)";
|
||||
$sql.= " AND (";
|
||||
$sql.= " f.type = 0"; // Standard
|
||||
$sql.= " OR f.type = 1"; // Replacement
|
||||
$sql.= " OR f.type = 2"; // Credit note
|
||||
$sql.= " OR f.type = 3"; // Deposit
|
||||
$sql.= ")";
|
||||
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.fk_soc = s.rowid";
|
||||
if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
@ -189,7 +188,7 @@ else {
|
||||
// On ajoute les paiements anciennes version, non lies par paiement_facture
|
||||
if ($modecompta != 'CREANCES-DETTES')
|
||||
{
|
||||
$sql = "SELECT 'Autres' as nom, '0' as idp, sum(p.amount) as amount_ttc";
|
||||
$sql = "SELECT '0' as socid, 'Autres' as name, sum(p.amount) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."paiement as p";
|
||||
@ -199,8 +198,8 @@ if ($modecompta != 'CREANCES-DETTES')
|
||||
$sql.= " AND b.fk_account = ba.rowid";
|
||||
$sql.= " AND ba.entity = ".$conf->entity;
|
||||
if ($date_start && $date_end) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||
$sql.= " GROUP BY nom, idp";
|
||||
$sql.= " ORDER BY nom";
|
||||
$sql.= " GROUP BY socid, name";
|
||||
$sql.= " ORDER BY name";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
@ -222,6 +221,7 @@ if ($modecompta != 'CREANCES-DETTES')
|
||||
}
|
||||
|
||||
|
||||
// Show array
|
||||
$i = 0;
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
print "<tr class=\"liste_titre\">";
|
||||
@ -262,7 +262,10 @@ if (sizeof($amount))
|
||||
// Third party
|
||||
$fullname=$name[$key];
|
||||
if ($key > 0) {
|
||||
$linkname='<a href="'.DOL_URL_ROOT.'/societe/soc.php?socid='.$key.'">'.img_object($langs->trans("ShowCompany"),'company').' '.$fullname.'</a>';
|
||||
$thirdparty_static->id=$key;
|
||||
$thirdparty_static->name=$fullname;
|
||||
$thirdparty_static->client=1;
|
||||
$linkname=$thirdparty_static->getNomUrl(1,'customer');
|
||||
}
|
||||
else {
|
||||
$linkname=$langs->trans("PaymentsNotLinkedToInvoice");
|
||||
@ -310,7 +313,8 @@ if (sizeof($amount))
|
||||
print "</table>";
|
||||
print '<br>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date: 2011/07/31 22:23:14 $ - $Revision: 1.49 $');
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -42,8 +42,7 @@ $userid=GETPOST('userid');
|
||||
$socid=GETPOST('socid');
|
||||
// Security check
|
||||
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();
|
||||
|
||||
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
|
||||
$modecompta = $conf->compta->mode;
|
||||
@ -65,6 +64,8 @@ if ($modecompta=="CREANCES-DETTES")
|
||||
$period="$year_start - $year_end";
|
||||
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
|
||||
$description=$langs->trans("RulesCADue");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
|
||||
else $description.= $langs->trans("DepositsAreIncluded");
|
||||
$builddate=time();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
}
|
||||
@ -74,6 +75,7 @@ else {
|
||||
$period="$year_start - $year_end";
|
||||
$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start-1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year_start=".($year_start+1)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
|
||||
$description=$langs->trans("RulesCAIn");
|
||||
$description.= $langs->trans("DepositsAreIncluded");
|
||||
$builddate=time();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
}
|
||||
@ -82,17 +84,16 @@ if (! empty($modecompta)) $moreparam['modecompta']=$modecompta;
|
||||
report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,$moreparam);
|
||||
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
if ($modecompta == 'CREANCES-DETTES')
|
||||
{
|
||||
$sql = "SELECT date_format(f.datef,'%Y-%m') as dm, sum(f.total) as amount, sum(f.total_ttc) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " WHERE f.fk_statut in (1,2)";
|
||||
$sql.= " AND (";
|
||||
$sql.= " f.type = 0"; // Standard
|
||||
$sql.= " OR f.type = 1"; // Replacement
|
||||
$sql.= " OR f.type = 2"; // Credit note
|
||||
$sql.= " OR f.type = 3"; // Deposit
|
||||
$sql.= ")";
|
||||
} else {
|
||||
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)";
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
|
||||
* vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
|
||||
@ -132,7 +133,8 @@ else {
|
||||
}
|
||||
|
||||
// On ajoute les paiements anciennes version, non lies par paiement_facture
|
||||
if ($modecompta != 'CREANCES-DETTES') {
|
||||
if ($modecompta != 'CREANCES-DETTES')
|
||||
{
|
||||
$sql = "SELECT date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount_ttc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
@ -146,7 +148,8 @@ if ($modecompta != 'CREANCES-DETTES') {
|
||||
$sql.= " ORDER BY dm";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
@ -161,7 +164,8 @@ if ($modecompta != 'CREANCES-DETTES') {
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
@ -497,8 +501,7 @@ print "</table>";
|
||||
|
||||
*/
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date: 2011/07/31 22:23:13 $ - $Revision: 1.51 $');
|
||||
|
||||
?>
|
||||
|
||||
@ -114,10 +114,14 @@ if ($modetax==1) // Calculate on invoice for goods and services
|
||||
//$nom.='<br>('.$langs->trans("SeeVATReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modetax=0">','</a>').')';
|
||||
$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=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start-1)."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+1)."&modetax=".$modetax."'>".img_next()."</a>":"");
|
||||
$description=$langs->trans("RulesVATDue");
|
||||
$description=$langs->trans("RulesVATDueServices");
|
||||
$description.='<br>';
|
||||
$description.=$langs->trans("RulesVATDueProducts");
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||
if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
$description.=$fsearch;
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
|
||||
else $description.='<br>'.$langs->trans("DepositsAreIncluded");
|
||||
$description.=$fsearch;
|
||||
$description.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||
$builddate=time();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
@ -137,9 +141,14 @@ if ($modetax==0) // Invoice for goods, payment for services
|
||||
//$nom.='<br>('.$langs->trans("SeeVATReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modetax=1">','</a>').')';
|
||||
$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=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start-1)."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+1)."&modetax=".$modetax."'>".img_next()."</a>":"");
|
||||
$description=$langs->trans("RulesVATIn");
|
||||
$description=$langs->trans("RulesVATInServices");
|
||||
$description.=' '.$langs->trans("DepositsAreIncluded");
|
||||
$description.='<br>';
|
||||
$description.=$langs->trans("RulesVATInProducts");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded");
|
||||
else $description.=' '.$langs->trans("DepositsAreIncluded");
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||
if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
$description.=$fsearch;
|
||||
$description.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||
$builddate=time();
|
||||
@ -202,7 +211,8 @@ if (is_array($coll_list))
|
||||
print "<td nowrap>".$i."</td>";
|
||||
$company_static->id=$coll->socid;
|
||||
$company_static->nom=$coll->nom;
|
||||
print '<td nowrap>'.$company_static->getNomUrl(1).'</td>';
|
||||
$company_static->client=1;
|
||||
print '<td nowrap>'.$company_static->getNomUrl(1,'customer').'</td>';
|
||||
$find = array(' ','.');
|
||||
$replace = array('','');
|
||||
print "<td nowrap>".$intra."</td>";
|
||||
@ -279,7 +289,8 @@ if (is_array($coll_list))
|
||||
print "<td nowrap>".$i."</td>";
|
||||
$company_static->id=$coll->socid;
|
||||
$company_static->nom=$coll->nom;
|
||||
print '<td nowrap>'.$company_static->getNomUrl(1).'</td>';
|
||||
$company_static->fournisseur=1;
|
||||
print '<td nowrap>'.$company_static->getNomUrl(1,'supplier').'</td>';
|
||||
$find = array(' ','.');
|
||||
$replace = array('','');
|
||||
print "<td nowrap>".$intra."</td>";
|
||||
@ -324,7 +335,7 @@ else
|
||||
print '</table>';
|
||||
|
||||
|
||||
$db->close();
|
||||
llxFooter();
|
||||
|
||||
llxFooter('$Date: 2011/08/03 00:46:25 $ - $Revision: 1.32 $');
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@ -134,9 +134,13 @@ if ($modetax==1) // Calculate on invoice for goods and services
|
||||
if ($nextquarter < 4) $nextquarter++;
|
||||
else { $nextquarter=1; $nextyear++; }
|
||||
//$periodlink=($prevyear?"<a href='".$_SERVER["PHP_SELF"]."?year=".$prevyear."&q=".$prevquarter."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".$nextyear."&q=".$nextquarter."&modetax=".$modetax."'>".img_next()."</a>":"");
|
||||
$description=$langs->trans("RulesVATDue");
|
||||
$description=$langs->trans("RulesVATDueServices");
|
||||
$description.='<br>';
|
||||
$description.=$langs->trans("RulesVATDueProducts");
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||
if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
|
||||
else $description.='<br>'.$langs->trans("DepositsAreIncluded");
|
||||
$description.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||
$description.=$fsearch;
|
||||
$builddate=time();
|
||||
@ -164,9 +168,14 @@ if ($modetax==0) // Invoice for goods, payment for services
|
||||
if ($nextquarter < 4) $nextquarter++;
|
||||
else { $nextquarter=1; $nextyear++; }
|
||||
//$periodlink=($prevyear?"<a href='".$_SERVER["PHP_SELF"]."?year=".$prevyear."&q=".$prevquarter."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".$nextyear."&q=".$nextquarter."&modetax=".$modetax."'>".img_next()."</a>":"");
|
||||
$description=$langs->trans("RulesVATIn");
|
||||
$description=$langs->trans("RulesVATInServices");
|
||||
$description.=' '.$langs->trans("DepositsAreIncluded");
|
||||
$description.='<br>';
|
||||
$description.=$langs->trans("RulesVATInProducts");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded");
|
||||
else $description.=' '.$langs->trans("DepositsAreIncluded");
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||
if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
$description.=$fsearch;
|
||||
$description.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||
$builddate=time();
|
||||
@ -350,6 +359,12 @@ else
|
||||
{
|
||||
if ($type) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
if (preg_match('/^\((.*)\)$/',$fields['descr'],$reg))
|
||||
{
|
||||
if ($reg[1]=='DEPOSIT') $fields['descr']=$langs->transnoentitiesnoconv('Deposit');
|
||||
elseif ($reg[1]=='CREDIT_NOTE') $fields['descr']=$langs->transnoentitiesnoconv('CreditNote');
|
||||
else $fields['descr']=$langs->transnoentitiesnoconv($reg[1]);
|
||||
}
|
||||
print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']),16);
|
||||
|
||||
// Show range
|
||||
|
||||
@ -2447,10 +2447,16 @@ class Form
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td nowrap="nowrap">';
|
||||
//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);
|
||||
|
||||
@ -102,16 +102,21 @@ SeeReportInInputOutputMode=See report <b>%sIncomes-Expenses%s</b> said <b>cash a
|
||||
SeeReportInDueDebtMode=See report <b>%sClaims-Debts%s</b> said <b>commitment accounting</b> for a calculation on issued invoices
|
||||
RulesResultDue=- Amounts shown are with all taxes included<br>- It includes outstanding invoices, expenses and VAT whether they are paid or not. <br>- 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<br>- It includes the real payments made on invoices, expenses and VAT. <br>- It is based on the payment dates of the invoices, expenses anf VAT.<br>
|
||||
RulesCADue=- It includes the client's due invoices (except deposit invoices) whether they are paid or not. <br>- It is based on the validation date of these invoices. <br>
|
||||
RulesCADue=- It includes the client's due invoices whether they are paid or not. <br>- It is based on the validation date of these invoices. <br>
|
||||
RulesCAIn=- It includes all the effective payments of invoices received from clients.<br>- It is based on the payment date of these invoices<br>
|
||||
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 <b>%sVAT encasement%s</b> for a standard calculation
|
||||
SeeVATReportInDueDebtMode=See report <b>%sVAT on flow%s</b> 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.<br>- 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.<br>- 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.<br>- 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
|
||||
|
||||
@ -102,16 +102,21 @@ SeeReportInInputOutputMode=Voir le rapport <b>%sRecettes-Dépenses%s</b> dit <b>
|
||||
SeeReportInDueDebtMode=Voir le rapport <b>%sCréances-Dettes%s</b> dit <b>comptabilité d'engagement</b> pour un calcul sur les factures émises
|
||||
RulesResultDue=- Les montants affichés sont les montants taxe incluse<br>- Il inclut les factures, charges et tva dues, qu'elles soient payées ou non.<br>- Il se base sur la date de validation pour les factures et la tva et sur la date d'échéance pour les charges.<br>
|
||||
RulesResultInOut=- Les montants affichés sont les montants taxe incluse<br>- Il inclut les règlements effectivement réalisés pour les factures, les charges et la TVA.<br>- Il se base sur la date de règlement de ces factures, charges et TVA.<br>
|
||||
RulesCADue=- Il inclut les factures clients dues (hors facture accompte), qu'elles soient payées ou non.<br>- Il se base sur la date de validation de ces factures.<br>
|
||||
RulesCADue=- Il inclut les factures clients dues, qu'elles soient payées ou non.<br>- Il se base sur la date de validation de ces factures.<br>
|
||||
RulesCAIn=- Il inclut les règlements effectivement reçus des factures clients.<br>- Il se base sur la date de règlement de ces factures<br>
|
||||
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 <b>%sTVA encaissement%s</b> pour mode de calcul standard
|
||||
SeeVATReportInDueDebtMode=Voir le rapport <b>%sTVA sur débit%s</b> 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.<br>- 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.<br>- 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
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user