--- /tmp/dsg/dolibarr/htdocs/compta/charges/github_index.php
+++ /tmp/dsg/dolibarr/htdocs/compta/charges/client_index.php
@@ -51,7 +51,7 @@
$mode = GETPOST("mode", 'alpha');
$year = GETPOST("year", 'int');
$filtre = GETPOST("filtre", 'alpha');
-if (!$year) { $year = date("Y", time()); }
+if (!$year && $mode != 'sconly') { $year = date("Y", time()); }
$search_account = GETPOST('search_account', 'int');
@@ -80,10 +80,12 @@
llxHeader('', $langs->trans("SpecialExpensesArea"));
$title = $langs->trans("SpecialExpensesArea");
+if ($mode == 'sconly') $title = $langs->trans("SocialContributionsPayments");
$param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
+if ($mode == 'sconly') $param = '&mode=sconly';
if ($sortfield) $param .= '&sortfield='.$sortfield;
if ($sortorder) $param .= '&sortorder='.$sortorder;
@@ -99,18 +101,32 @@
print ' ';
print ' ';
-$nav = ($year ? ''.img_previous($langs->trans("Previous"), 'class="valignbottom"')." ".$langs->trans("Year").' '.$year.' '.img_next($langs->trans("Next"), 'class="valignbottom"')." " : "");
-print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'object_payment', 0, $nav, '', $limit, 1);
+$nav = '';
+if ($mode != 'sconly')
+{
+ $nav = ($year ? ''.img_previous($langs->trans("Previous"), 'class="valignbottom"')." ".$langs->trans("Year").' '.$year.' '.img_next($langs->trans("Next"), 'class="valignbottom"')." " : "");
+ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'object_payment', 0, $nav, '', $limit, 1);
+}
+else
+{
+ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'object_payment', 0, $nav, '', $limit, 0);
+}
if ($year) $param .= '&year='.$year;
-print ''.$langs->trans("DescTaxAndDividendsArea").' ';
-print " ";
+if ($mode != 'sconly')
+{
+ print ''.$langs->trans("DescTaxAndDividendsArea").' ';
+ print " ";
+}
if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
{
// Social contributions only
- print load_fiche_titre($langs->trans("SocialContributionsPayments").($year ? ' ('.$langs->trans("Year").' '.$year.')' : ''), '', '');
+ if ($mode != 'sconly')
+ {
+ print load_fiche_titre($langs->trans("SocialContributionsPayments").($year ? ' ('.$langs->trans("Year").' '.$year.')' : ''), '', '');
+ }
print '
';
print '';
@@ -121,7 +137,7 @@
print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "pc.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "pc.datep", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "pct.code", "", $param, '', $sortfield, $sortorder);
- if (!empty($conf->banque->enabled)) print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
+ if (!empty($conf->banque->enabled)) print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pc.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print " \n";
@@ -186,27 +202,28 @@
print ''.$payment_sc_static->getNomUrl(1)." \n";
// Date payment
print ''.dol_print_date($db->jdate($obj->datep), 'day').' ';
- // Type payment
- print '';
- if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
- print $obj->num_payment.' ';
+ // Type payment
+ print '';
+ if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
+ print $obj->num_payment.' ';
// Account
- if (!empty($conf->banque->enabled))
- {
- print '';
- if ($obj->fk_bank > 0)
- {
- //$accountstatic->fetch($obj->fk_bank);
- $accountstatic->id = $obj->bid;
- $accountstatic->ref = $obj->bref;
- $accountstatic->number = $obj->bnumber;
- $accountstatic->accountancy_number = $obj->account_number;
- $accountstatic->accountancy_journal = $obj->accountancy_journal;
- $accountstatic->label = $obj->blabel;
- print $accountstatic->getNomUrl(1);
- } else print ' ';
- print ' ';
- }
+ if (!empty($conf->banque->enabled))
+ {
+ print '';
+ if ($obj->fk_bank > 0)
+ {
+ //$accountstatic->fetch($obj->fk_bank);
+ $accountstatic->id = $obj->bid;
+ $accountstatic->ref = $obj->bref;
+ $accountstatic->number = $obj->bnumber;
+ $accountstatic->accountancy_number = $obj->account_number;
+ $accountstatic->accountancy_journal = $obj->accountancy_journal;
+ $accountstatic->label = $obj->blabel;
+ print $accountstatic->getNomUrl(1);
+ }
+ else print ' ';
+ print ' ';
+ }
// Paid
print '';
if ($obj->totalpaye) print price($obj->totalpaye);
@@ -218,15 +235,17 @@
$totalpaye = $totalpaye + $obj->totalpaye;
$i++;
}
- print ' '.$langs->trans("Total").' ';
- print ' '; // A total here has no sense
- print ' ';
- print ' ';
- print ' ';
- if (!empty($conf->banque->enabled)) print ' ';
- print ''.price($totalpaye)." ";
+ print ''.$langs->trans("Total").' ';
+ print ' '; // A total here has no sense
+ print ' ';
+ print ' ';
+ print ' ';
+ if (!empty($conf->banque->enabled)) print ' ';
+ print ''.price($totalpaye)." ";
print " ";
- } else {
+ }
+ else
+ {
dol_print_error($db);
}
print '
';
@@ -235,110 +254,116 @@
// VAT
if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
{
- print " ";
-
- $tva = new Tva($db);
-
- print load_fiche_titre($langs->trans("VATPayments").($year ? ' ('.$langs->trans("Year").' '.$year.')' : ''), '', '');
-
- $sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm, pv.fk_bank,";
- $sql .= " pct.code as payment_code,";
- $sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel";
- $sql .= " FROM ".MAIN_DB_PREFIX."tva as pv";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pv.fk_bank = b.rowid";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pv.fk_typepayment = pct.id";
- $sql .= " WHERE pv.entity IN (".getEntity("tax").")";
- if ($year > 0)
+ if (!$mode || $mode != 'sconly')
{
- // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
- // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
- $sql .= " AND pv.datev between '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."'";
- }
- if (preg_match('/^pv\./', $sortfield)) $sql .= $db->order($sortfield, $sortorder);
-
- $result = $db->query($sql);
- if ($result)
- {
- $num = $db->num_rows($result);
- $i = 0;
- $total = 0;
- print '';
- print '';
- print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "pv.datev", "", $param, 'width="140px"', $sortfield, $sortorder);
- print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "pv.label", "", $param, '', $sortfield, $sortorder);
- print_liste_field_titre("ExpectedToPay", $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'class="right"', $sortfield, $sortorder);
- print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "pv.rowid", "", $param, '', $sortfield, $sortorder);
- print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "pv.datev", "", $param, 'align="center"', $sortfield, $sortorder);
- print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "pct.code", "", $param, '', $sortfield, $sortorder);
- if (!empty($conf->banque->enabled)) print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
- print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'class="right"', $sortfield, $sortorder);
- print " \n";
- $var = 1;
- while ($i < $num)
- {
- $obj = $db->fetch_object($result);
-
- $total = $total + $obj->amount;
-
-
- print '';
- print ''.dol_print_date($db->jdate($obj->dm), 'day').' '."\n";
-
- print "".$obj->label." \n";
-
- print ''.price($obj->amount)." ";
-
- // Ref payment
- $tva_static->id = $obj->rowid;
- $tva_static->ref = $obj->rowid;
- print ''.$tva_static->getNomUrl(1)." \n";
-
- // Date
- print ''.dol_print_date($db->jdate($obj->dm), 'day')." \n";
-
- // Type payment
- print '';
- if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
- print $obj->num_payment.' ';
-
- // Account
- if (!empty($conf->banque->enabled))
- {
- print '';
- if ($obj->fk_bank > 0)
- {
- //$accountstatic->fetch($obj->fk_bank);
- $accountstatic->id = $obj->bid;
- $accountstatic->ref = $obj->bref;
- $accountstatic->number = $obj->bnumber;
- $accountstatic->accountancy_number = $obj->account_number;
- $accountstatic->accountancy_journal = $obj->accountancy_journal;
- $accountstatic->label = $obj->blabel;
- print $accountstatic->getNomUrl(1);
- } else print ' ';
- print ' ';
- }
-
- // Paid
- print ''.price($obj->amount)." ";
- print " \n";
-
- $i++;
- }
- print ''.$langs->trans("Total").' ';
- print ''.price($total).' ';
- print ' ';
- print ' ';
- print ' ';
- print ' ';
- print ''.price($total)." ";
- print " ";
-
- print "
";
- $db->free($result);
- } else {
- dol_print_error($db);
+ print " ";
+
+ $tva = new Tva($db);
+
+ print load_fiche_titre($langs->trans("VATPayments").($year ? ' ('.$langs->trans("Year").' '.$year.')' : ''), '', '');
+
+ $sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm, pv.fk_bank,";
+ $sql .= " pct.code as payment_code,";
+ $sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel";
+ $sql .= " FROM ".MAIN_DB_PREFIX."tva as pv";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON pv.fk_bank = b.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pct ON pv.fk_typepayment = pct.id";
+ $sql .= " WHERE pv.entity IN (".getEntity("tax").")";
+ if ($year > 0)
+ {
+ // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
+ // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
+ $sql .= " AND pv.datev between '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."'";
+ }
+ if (preg_match('/^pv\./', $sortfield)) $sql .= $db->order($sortfield, $sortorder);
+
+ $result = $db->query($sql);
+ if ($result)
+ {
+ $num = $db->num_rows($result);
+ $i = 0;
+ $total = 0;
+ print '';
+ print '';
+ print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "pv.datev", "", $param, 'width="140px"', $sortfield, $sortorder);
+ print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "pv.label", "", $param, '', $sortfield, $sortorder);
+ print_liste_field_titre("ExpectedToPay", $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'class="right"', $sortfield, $sortorder);
+ print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "pv.rowid", "", $param, '', $sortfield, $sortorder);
+ print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "pv.datev", "", $param, 'align="center"', $sortfield, $sortorder);
+ print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "pct.code", "", $param, '', $sortfield, $sortorder);
+ if (!empty($conf->banque->enabled)) print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
+ print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'class="right"', $sortfield, $sortorder);
+ print " \n";
+ $var = 1;
+ while ($i < $num)
+ {
+ $obj = $db->fetch_object($result);
+
+ $total = $total + $obj->amount;
+
+
+ print '';
+ print ''.dol_print_date($db->jdate($obj->dm), 'day').' '."\n";
+
+ print "".$obj->label." \n";
+
+ print ''.price($obj->amount)." ";
+
+ // Ref payment
+ $tva_static->id = $obj->rowid;
+ $tva_static->ref = $obj->rowid;
+ print ''.$tva_static->getNomUrl(1)." \n";
+
+ // Date
+ print ''.dol_print_date($db->jdate($obj->dm), 'day')." \n";
+
+ // Type payment
+ print '';
+ if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
+ print $obj->num_payment.' ';
+
+ // Account
+ if (!empty($conf->banque->enabled))
+ {
+ print '';
+ if ($obj->fk_bank > 0)
+ {
+ //$accountstatic->fetch($obj->fk_bank);
+ $accountstatic->id = $obj->bid;
+ $accountstatic->ref = $obj->bref;
+ $accountstatic->number = $obj->bnumber;
+ $accountstatic->accountancy_number = $obj->account_number;
+ $accountstatic->accountancy_journal = $obj->accountancy_journal;
+ $accountstatic->label = $obj->blabel;
+ print $accountstatic->getNomUrl(1);
+ }
+ else print ' ';
+ print ' ';
+ }
+
+ // Paid
+ print ''.price($obj->amount)." ";
+ print " \n";
+
+ $i++;
+ }
+ print ''.$langs->trans("Total").' ';
+ print ''.price($total).' ';
+ print ' ';
+ print ' ';
+ print ' ';
+ print ' ';
+ print ''.price($total)." ";
+ print " ";
+
+ print "
";
+ $db->free($result);
+ }
+ else
+ {
+ dol_print_error($db);
+ }
}
}
@@ -347,92 +372,94 @@
{
$j = 1;
$numlt = 3;
-} elseif ($mysoc->localtax1_assuj == "1")
+}
+elseif ($mysoc->localtax1_assuj == "1")
{
$j = 1;
$numlt = 2;
-} elseif ($mysoc->localtax2_assuj == "1")
+}
+elseif ($mysoc->localtax2_assuj == "1")
{
$j = 2;
$numlt = 3;
-} else {
+}
+else
+{
$j = 0;
$numlt = 0;
}
while ($j < $numlt)
{
- print " ";
-
- $tva = new Tva($db);
-
- print load_fiche_titre($langs->transcountry(($j == 1 ? "LT1Payments" : "LT2Payments"), $mysoc->country_code).($year ? ' ('.$langs->trans("Year").' '.$year.')' : ''), '', '');
-
-
- $sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm, pv.datep as dp";
- $sql .= " FROM ".MAIN_DB_PREFIX."localtax as pv";
- $sql .= " WHERE pv.entity = ".$conf->entity." AND localtaxtype = ".$j;
- if ($year > 0)
+ if (!$mode || $mode != 'sconly')
{
- // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
- // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
- $sql .= " AND pv.datev between '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."'";
+ print " ";
+
+ $tva = new Tva($db);
+
+ print load_fiche_titre($langs->transcountry(($j == 1 ? "LT1Payments" : "LT2Payments"), $mysoc->country_code).($year ? ' ('.$langs->trans("Year").' '.$year.')' : ''), '', '');
+
+
+ $sql = "SELECT pv.rowid, pv.amount, pv.label, pv.datev as dm, pv.datep as dp";
+ $sql .= " FROM ".MAIN_DB_PREFIX."localtax as pv";
+ $sql .= " WHERE pv.entity = ".$conf->entity." AND localtaxtype = ".$j;
+ if ($year > 0)
+ {
+ // Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
+ // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire
+ $sql .= " AND pv.datev between '".$db->idate(dol_get_first_day($year, 1, false))."' AND '".$db->idate(dol_get_last_day($year, 12, false))."'";
+ }
+ if (preg_match('/^pv/', $sortfield)) $sql .= $db->order($sortfield, $sortorder);
+
+ $result = $db->query($sql);
+ if ($result)
+ {
+ $num = $db->num_rows($result);
+ $i = 0;
+ $total = 0;
+ print '';
+ print '';
+ print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "pv.datev", "", $param, 'width="120"', $sortfield, $sortorder);
+ print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "pv.label", "", $param, '', $sortfield, $sortorder);
+ print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "pv.rowid", "", $param, '', $sortfield, $sortorder);
+ print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "pv.datep", "", $param, 'align="center"', $sortfield, $sortorder);
+ print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'class="right"', $sortfield, $sortorder);
+ print " \n";
+
+ while ($i < $num)
+ {
+ $obj = $db->fetch_object($result);
+
+ $total = $total + $obj->amount;
+
+ print '';
+ print ''.dol_print_date($db->jdate($obj->dm), 'day').' '."\n";
+
+ print "".$obj->label." \n";
+
+ // Ref payment
+ $tva_static->id = $obj->rowid;
+ $tva_static->ref = $obj->rowid;
+ print ''.$tva_static->getNomUrl(1)." \n";
+
+ print ''.dol_print_date($db->jdate($obj->dp), 'day')." \n";
+ print ''.price($obj->amount)." ";
+ print " \n";
+
+ $i++;
+ }
+ print ''.$langs->trans("Total").' ';
+ print ''.price($total)." ";
+ print " ";
+
+ print "
";
+ $db->free($result);
+ }
+ else
+ {
+ dol_print_error($db);
+ }
}
- if (preg_match('/^pv/', $sortfield)) $sql .= $db->order($sortfield, $sortorder);
-
- $result = $db->query($sql);
- if ($result)
- {
- $num = $db->num_rows($result);
- $i = 0;
- $total = 0;
- print '';
- print '';
- print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "pv.datev", "", $param, 'width="120"', $sortfield, $sortorder);
- print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "pv.label", "", $param, '', $sortfield, $sortorder);
- print_liste_field_titre("ExpectedToPay", $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'class="right"', $sortfield, $sortorder);
- print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], "pv.rowid", "", $param, '', $sortfield, $sortorder);
- print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "pv.datep", "", $param, 'align="center"', $sortfield, $sortorder);
- print_liste_field_titre("PayedByThisPayment", $_SERVER["PHP_SELF"], "pv.amount", "", $param, 'class="right"', $sortfield, $sortorder);
- print " \n";
-
- while ($i < $num)
- {
- $obj = $db->fetch_object($result);
-
- $total = $total + $obj->amount;
-
- print '';
- print ''.dol_print_date($db->jdate($obj->dm), 'day').' '."\n";
-
- print "".$obj->label." \n";
-
- print ''.price($obj->amount)." ";
-
- // Ref payment
- $tva_static->id = $obj->rowid;
- $tva_static->ref = $obj->rowid;
- print ''.$tva_static->getNomUrl(1)." \n";
-
- print ''.dol_print_date($db->jdate($obj->dp), 'day')." \n";
- print ''.price($obj->amount)." ";
- print " \n";
-
- $i++;
- }
- print ''.$langs->trans("Total").' ';
- print ''.price($total)." ";
- print ' ';
- print ' ';
- print ''.price($total)." ";
- print " ";
-
- print "
";
- $db->free($result);
- } else {
- dol_print_error($db);
- }
-
$j++;
}
@@ -441,6 +468,8 @@
/*
if (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read))
{
+ if (!$mode || $mode != 'sconly')
+ {
$sal = new PaymentSalary($db);
print " ";
@@ -521,7 +550,8 @@
$accountstatic->accountancy_journal = $obj->accountancy_journal;
$accountstatic->label = $obj->blabel;
print $accountstatic->getNomUrl(1);
- } else print ' ';
+ }
+ else print ' ';
print '';
}
@@ -539,9 +569,12 @@
$db->free($result);
print " ";
- } else {
+ }
+ else
+ {
dol_print_error($db);
}
+ }
}
*/