34require
'../../main.inc.php';
35require_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/tva.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/paymentsocialcontribution.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formsocialcontrib.class.php';
43if (isModEnabled(
'accounting')) {
44 include_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
50$hookmanager->initHooks(array(
'specialexpensesindex'));
53$langs->loadLangs(array(
'compta',
'bills',
'hrm'));
56$search_sc_type =
GETPOST(
'search_sc_type',
'intcomma');
57$optioncss =
GETPOST(
'optioncss',
'alpha');
60$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
61$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
63if (empty($page) || $page < 0) {
66$offset = $limit * $page;
70 $sortfield =
"cs.date_ech";
78 $socid = $user->socid;
80$result =
restrictedArea($user,
'tax',
'',
'chargesociales',
'charges');
88if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
99$tva_static =
new Tva($db);
102$userstatic =
new User($db);
103$sal_static =
new Salary($db);
104$accountstatic =
new Account($db);
108$title = $langs->trans(
"SocialContributionsPayments");
115if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
116 $param .=
'&contextpage='.urlencode($contextpage);
118if ($limit > 0 && $limit != $conf->liste_limit) {
119 $param .=
'&limit='.((int) $limit);
122 $param .=
'&sortfield='.urlencode($sortfield);
125 $param .=
'&sortorder='.urlencode($sortorder);
128 $param .=
'&year='.urlencode((
string) ($year));
130if ($search_sc_type) {
131 $param .=
'&search_sc_type='.urlencode((
string) ($search_sc_type));
133if ($optioncss !=
'') {
134 $param .=
'&optioncss='.urlencode($optioncss);
138print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
139if ($optioncss !=
'') {
140 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
142print
'<input type="hidden" name="token" value="'.newToken().
'">';
143print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
144print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
145print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
146print
'<input type="hidden" name="page" value="'.$page.
'">';
148$sql =
"SELECT c.id, c.libelle as type_label,";
149$sql .=
" cs.rowid, cs.libelle as label_sc, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total, cs.paye,";
150$sql .=
" pc.rowid as pid, pc.datep, pc.amount as totalpaid, pc.num_paiement as num_payment, pc.fk_bank,";
151$sql .=
" pct.code as payment_code,";
152$sql .=
" u.rowid as uid, u.lastname, u.firstname, u.email, u.login, u.admin, u.statut,";
153$sql .=
" ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,";
154$sql .=
" aj.label as account_journal";
155$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_chargesociales as c,";
156$sql .=
" ".MAIN_DB_PREFIX.
"chargesociales as cs";
157$sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"paiementcharge as pc ON pc.fk_charge = cs.rowid";
158$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as pct ON pc.fk_typepaiement = pct.id";
159$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank as b ON pc.fk_bank = b.rowid";
160$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank_account as ba ON b.fk_account = ba.rowid";
161$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_journal as aj ON ba.fk_accountancy_journal = aj.rowid";
162$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON u.rowid = cs.fk_user";
163$sql .=
" WHERE cs.fk_type = c.id";
164$sql .=
" AND cs.entity IN (".getEntity(
"tax").
")";
165if ($search_sc_type > 0) {
166 $sql .=
" AND cs.fk_type = ".((int) $search_sc_type);
176if ($sortfield !==
null
177 && preg_match(
'/^(cs|c|pc|pct|u|ba)\./', $sortfield)
179 $sql .= $db->order($sortfield, $sortorder);
183$nbtotalofrecords =
'';
185 $resql = $db->query($sql);
186 $nbtotalofrecords = $db->num_rows($resql);
187 if (($page * $limit) > $nbtotalofrecords) {
193if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
194 $num = $nbtotalofrecords;
197 $sql .= $db->plimit($limit + 1, $offset);
200 $resql = $db->query($sql);
206 $num = $db->num_rows($resql);
212print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'object_payment', 0, $nav,
'', $limit, 0);
214print
'<table class="noborder centpercent">';
216print
'<tr class="liste_titre">';
217print
'<td class="liste_titre"></td>';
218print
'<td class="liste_titre"></td>';
219print
'<td class="liste_titre">';
220$formsocialcontrib->select_type_socialcontrib(GETPOSTISSET(
"search_sc_type") ? $search_sc_type :
'',
'search_sc_type', 1, 0, 0,
'minwidth200 maxwidth300');
222print
'<td class="liste_titre"></td>';
223print
'<td class="liste_titre"></td>';
224print
'<td class="liste_titre"></td>';
225print
'<td class="liste_titre"></td>';
226print
'<td class="liste_titre"></td>';
227print
'<td class="liste_titre"></td>';
228if (isModEnabled(
"bank")) {
229 print
'<td class="liste_titre"></td>';
230 print
'<td class="liste_titre"></td>';
232print
'<td class="liste_titre"></td>';
233print
'<td class="liste_titre center">';
234$searchpicto = $form->showFilterButtons();
239print
'<tr class="liste_titre">';
240print_liste_field_titre(
"RefPayment", $_SERVER[
"PHP_SELF"],
"pc.rowid",
"", $param,
'', $sortfield, $sortorder);
241print_liste_field_titre(
"SocialContribution", $_SERVER[
"PHP_SELF"],
"c.libelle",
"", $param,
'', $sortfield, $sortorder);
242print_liste_field_titre(
"TypeContrib", $_SERVER[
"PHP_SELF"],
"cs.fk_type",
"", $param,
'', $sortfield, $sortorder);
243print_liste_field_titre(
"PeriodEndDate", $_SERVER[
"PHP_SELF"],
"cs.periode",
"", $param,
'', $sortfield, $sortorder,
'center ');
244print_liste_field_titre(
"DatePayment", $_SERVER[
"PHP_SELF"],
"pc.datep",
"", $param,
'', $sortfield, $sortorder,
'center ');
246print_liste_field_titre(
"PaymentMode", $_SERVER[
"PHP_SELF"],
"pct.code",
"", $param,
'', $sortfield, $sortorder);
247print_liste_field_titre(
"Numero", $_SERVER[
"PHP_SELF"],
"pc.num_paiement",
"", $param,
'', $sortfield, $sortorder,
'',
'ChequeOrTransferNumber');
248if (isModEnabled(
"bank")) {
249 print_liste_field_titre(
"BankTransactionLine", $_SERVER[
"PHP_SELF"],
"pc.fk_bank",
"", $param,
'', $sortfield, $sortorder);
250 print_liste_field_titre(
"BankAccount", $_SERVER[
"PHP_SELF"],
"ba.label",
"", $param,
"", $sortfield, $sortorder);
252print_liste_field_titre(
"ExpectedToPay", $_SERVER[
"PHP_SELF"],
"cs.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
253print_liste_field_titre(
"PayedByThisPayment", $_SERVER[
"PHP_SELF"],
"pc.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
267while ($i < min($num, $limit)) {
268 $obj = $db->fetch_object($resql);
270 $payment_sc_static->id = $obj->pid;
271 $payment_sc_static->ref = $obj->pid;
272 $payment_sc_static->datep = $db->jdate($obj->datep);
274 $socialcontrib->id = $obj->rowid;
275 $socialcontrib->ref = empty($obj->label_sc) ? $obj->type_label : $obj->label_sc;
276 $socialcontrib->paye = $obj->paye;
279 $socialcontrib->label = empty($obj->label_sc) ? $obj->type_label : $obj->label_sc;
280 $socialcontrib->type_label = $obj->type_label;
282 print
'<tr class="oddeven">';
284 print
'<td class="nowraponall">'.$payment_sc_static->getNomUrl(1).
"</td>\n";
286 print
'<td class="tdoverflowmax250">';
287 print $socialcontrib->getNomUrl(1,
'');
290 print
'<td title="'.dol_escape_htmltag($obj->type_label).
'" class="tdoverflowmax300">'.$obj->type_label.
'</td>';
292 $date = $obj->periode;
294 $date = $obj->date_ech;
296 print
'<td class="center">'.dol_print_date($date,
'day').
'</td>';
298 print
'<td class="center">'.dol_print_date($db->jdate($obj->datep),
'day').
'</td>';
302 if (!empty($obj->uid)) {
303 $userstatic->id = $obj->uid;
304 $userstatic->lastname = $obj->lastname;
305 $userstatic->firstname = $obj->firstname;
306 $userstatic->admin = $obj->admin;
307 $userstatic->login = $obj->login;
308 $userstatic->email = $obj->email;
309 $userstatic->status = $obj->statut;
310 print $userstatic->getNomUrl(1);
316 if ($obj->payment_code) {
317 $labelpayment = $langs->trans(
"PaymentTypeShort".$obj->payment_code);
319 print
'<td class="tdoverflowmax150" title="'.$labelpayment.
'">';
323 print
'<td>'.$obj->num_payment.
'</td>';
326 if (isModEnabled(
"bank")) {
328 print
'<td class="nowraponall">';
329 $accountlinestatic->id = $obj->fk_bank;
330 print $accountlinestatic->getNomUrl(1);
333 print
'<td class="nowraponall">';
335 $accountstatic->id = $obj->bid;
336 $accountstatic->ref = $obj->bref;
337 $accountstatic->number = $obj->bnumber;
338 $accountstatic->label = $obj->blabel;
339 $accountstatic->iban = $obj->iban;
340 $accountstatic->bic = $obj->bic;
341 $accountstatic->currency_code = $langs->trans(
"Currency".$obj->currency_code);
342 $accountstatic->clos = $obj->clos;
344 if (isModEnabled(
'accounting')) {
345 $accountstatic->account_number = $obj->account_number;
346 $accountstatic->accountancy_journal = $obj->account_journal;
348 print $accountstatic->getNomUrl(1);
356 print
'<td class="right"><span class="amount">'.price($obj->total).
'</span></td>';
359 print
'<td class="right">';
360 if ($obj->totalpaid) {
361 print
'<span class="amount">'.price($obj->totalpaid).
'</span>';
369 $total += $obj->total;
370 $totalpaid += $obj->totalpaid;
375print
'<tr class="liste_total"><td colspan="3" class="liste_total">'.$langs->trans(
"Total").
'</td>';
376print
'<td class="liste_total right"></td>';
377print
'<td align="center" class="liste_total"> </td>';
378print
'<td align="center" class="liste_total"> </td>';
379print
'<td align="center" class="liste_total"> </td>';
380print
'<td align="center" class="liste_total"> </td>';
381print
'<td align="center" class="liste_total"> </td>';
382if (isModEnabled(
"bank")) {
386print
'<td class="liste_total right">'.price($totalpaid).
"</td>";
395$parameters = array(
'user' => $user);
396$reshook = $hookmanager->executeHooks(
'dashboardSpecialBills', $parameters,
$object);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage bank accounts.
Class to manage bank transaction lines.
Class for managing the social charges.
Class to manage payments of social contributions.
Class to manage salary payments.
Class to manage VAT - Value-added tax (also known in French as TVA - Taxe sur la valeur ajoutée)
Class to manage Dolibarr users.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.