32require
'../../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/tva.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/paymentsocialcontribution.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formsocialcontrib.class.php';
41if (isModEnabled(
'accounting')) {
42 include_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
48$hookmanager->initHooks(array(
'specialexpensesindex'));
51$langs->loadLangs(array(
'compta',
'bills',
'hrm'));
54$search_sc_type =
GETPOST(
'search_sc_type',
'int');
55$optioncss =
GETPOST(
'optioncss',
'alpha');
57$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
58$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
59$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
60$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
61if (empty($page) || $page < 0) {
64$offset = $limit * $page;
68 $sortfield =
"cs.date_ech";
76 $socid = $user->socid;
78$result =
restrictedArea($user,
'tax',
'',
'chargesociales',
'charges');
86if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
97$tva_static =
new Tva($db);
100$userstatic =
new User($db);
101$sal_static =
new Salary($db);
102$accountstatic =
new Account($db);
106$title = $langs->trans(
"SocialContributionsPayments");
113if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
114 $param .=
'&contextpage='.urlencode($contextpage);
116if ($limit > 0 && $limit != $conf->liste_limit) {
117 $param .=
'&limit='.((int) $limit);
120 $param .=
'&sortfield='.urlencode($sortfield);
123 $param .=
'&sortorder='.urlencode($sortorder);
126 $param .=
'&year='.urlencode($year);
128if ($search_sc_type) {
129 $param .=
'&search_sc_type='.urlencode($search_sc_type);
131if ($optioncss !=
'') {
132 $param .=
'&optioncss='.urlencode($optioncss);
136print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
137if ($optioncss !=
'') {
138 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
140print
'<input type="hidden" name="token" value="'.newToken().
'">';
141print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
142print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
143print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
144print
'<input type="hidden" name="page" value="'.$page.
'">';
146$sql =
"SELECT c.id, c.libelle as type_label,";
147$sql .=
" cs.rowid, cs.libelle as label_sc, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total, cs.paye,";
148$sql .=
" pc.rowid as pid, pc.datep, pc.amount as totalpaid, pc.num_paiement as num_payment, pc.fk_bank,";
149$sql .=
" pct.code as payment_code,";
150$sql .=
" u.rowid as uid, u.lastname, u.firstname, u.email, u.login, u.admin, u.statut,";
151$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,";
152$sql .=
" aj.label as account_journal";
153$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_chargesociales as c,";
154$sql .=
" ".MAIN_DB_PREFIX.
"chargesociales as cs";
155$sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"paiementcharge as pc ON pc.fk_charge = cs.rowid";
156$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as pct ON pc.fk_typepaiement = pct.id";
157$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank as b ON pc.fk_bank = b.rowid";
158$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank_account as ba ON b.fk_account = ba.rowid";
159$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_journal as aj ON ba.fk_accountancy_journal = aj.rowid";
160$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON u.rowid = cs.fk_user";
161$sql .=
" WHERE cs.fk_type = c.id";
162$sql .=
" AND cs.entity IN (".getEntity(
"tax").
")";
163if ($search_sc_type > 0) {
164 $sql .=
" AND cs.fk_type = ".((int) $search_sc_type);
174if (preg_match(
'/^cs\./', $sortfield)
175 || preg_match(
'/^c\./', $sortfield)
176 || preg_match(
'/^pc\./', $sortfield)
177 || preg_match(
'/^pct\./', $sortfield)
178 || preg_match(
'/^u\./', $sortfield)
179 || preg_match(
'/^ba\./', $sortfield)) {
180 $sql .= $db->order($sortfield, $sortorder);
184$nbtotalofrecords =
'';
186 $resql = $db->query($sql);
187 $nbtotalofrecords = $db->num_rows($resql);
188 if (($page * $limit) > $nbtotalofrecords) {
194if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
195 $num = $nbtotalofrecords;
198 $sql .= $db->plimit($limit + 1, $offset);
201 $resql = $db->query($sql);
207 $num = $db->num_rows($resql);
213print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'object_payment', 0, $nav,
'', $limit, 0);
215print
'<table class="noborder centpercent">';
217print
'<tr class="liste_titre">';
218print
'<td class="liste_titre"></td>';
219print
'<td class="liste_titre"></td>';
220print
'<td class="liste_titre">';
221$formsocialcontrib->select_type_socialcontrib(GETPOSTISSET(
"search_sc_type") ? $search_sc_type :
'',
'search_sc_type', 1, 0, 0,
'minwidth200 maxwidth300');
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>';
228print
'<td class="liste_titre"></td>';
229if (isModEnabled(
"banque")) {
230 print
'<td class="liste_titre"></td>';
231 print
'<td class="liste_titre"></td>';
233print
'<td class="liste_titre"></td>';
234print
'<td class="liste_titre center">';
235$searchpicto = $form->showFilterButtons();
240print
'<tr class="liste_titre">';
241print_liste_field_titre(
"RefPayment", $_SERVER[
"PHP_SELF"],
"pc.rowid",
"", $param,
'', $sortfield, $sortorder);
242print_liste_field_titre(
"SocialContribution", $_SERVER[
"PHP_SELF"],
"c.libelle",
"", $param,
'', $sortfield, $sortorder);
243print_liste_field_titre(
"TypeContrib", $_SERVER[
"PHP_SELF"],
"cs.fk_type",
"", $param,
'', $sortfield, $sortorder);
244print_liste_field_titre(
"PeriodEndDate", $_SERVER[
"PHP_SELF"],
"cs.periode",
"", $param,
'', $sortfield, $sortorder,
'center ');
245print_liste_field_titre(
"DatePayment", $_SERVER[
"PHP_SELF"],
"pc.datep",
"", $param,
'', $sortfield, $sortorder,
'center ');
247print_liste_field_titre(
"PaymentMode", $_SERVER[
"PHP_SELF"],
"pct.code",
"", $param,
'', $sortfield, $sortorder);
248print_liste_field_titre(
"Numero", $_SERVER[
"PHP_SELF"],
"pc.num_paiement",
"", $param,
'', $sortfield, $sortorder,
'',
'ChequeOrTransferNumber');
249if (isModEnabled(
"banque")) {
250 print_liste_field_titre(
"BankTransactionLine", $_SERVER[
"PHP_SELF"],
"pc.fk_bank",
"", $param,
'', $sortfield, $sortorder);
253print_liste_field_titre(
"ExpectedToPay", $_SERVER[
"PHP_SELF"],
"cs.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
254print_liste_field_titre(
"PayedByThisPayment", $_SERVER[
"PHP_SELF"],
"pc.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
268while ($i < min($num, $limit)) {
269 $obj = $db->fetch_object($resql);
271 $payment_sc_static->id = $obj->pid;
272 $payment_sc_static->ref = $obj->pid;
273 $payment_sc_static->datep = $db->jdate($obj->datep);
275 $socialcontrib->id = $obj->rowid;
276 $socialcontrib->ref = empty($obj->label_sc) ? $obj->type_label : $obj->label_sc;
277 $socialcontrib->paye = $obj->paye;
280 $socialcontrib->label = empty($obj->label_sc) ? $obj->type_label : $obj->label_sc;
281 $socialcontrib->type_label = $obj->type_label;
283 print
'<tr class="oddeven">';
285 print
'<td class="nowraponall">'.$payment_sc_static->getNomUrl(1).
"</td>\n";
287 print
'<td class="tdoverflowmax250">';
288 print $socialcontrib->getNomUrl(1,
'');
291 print
'<td title="'.dol_escape_htmltag($obj->type_label).
'" class="tdoverflowmax300">'.$obj->type_label.
'</td>';
293 $date = $obj->periode;
295 $date = $obj->date_ech;
297 print
'<td class="center">'.dol_print_date($date,
'day').
'</td>';
299 print
'<td class="center">'.dol_print_date($db->jdate($obj->datep),
'day').
'</td>';
303 if (!empty($obj->uid)) {
304 $userstatic->id = $obj->uid;
305 $userstatic->lastname = $obj->lastname;
306 $userstatic->firstname = $obj->firstname;
307 $userstatic->admin = $obj->admin;
308 $userstatic->login = $obj->login;
309 $userstatic->email = $obj->email;
310 $userstatic->statut = $obj->statut;
311 print $userstatic->getNomUrl(1);
317 if ($obj->payment_code) {
318 $labelpayment = $langs->trans(
"PaymentTypeShort".$obj->payment_code);
320 print
'<td class="tdoverflowmax150" title="'.$labelpayment.
'">';
324 print
'<td>'.$obj->num_payment.
'</td>';
327 if (isModEnabled(
"banque")) {
329 print
'<td class="nowraponall">';
330 $accountlinestatic->id = $obj->fk_bank;
331 print $accountlinestatic->getNomUrl(1);
334 print
'<td class="nowraponall">';
336 $accountstatic->id = $obj->bid;
337 $accountstatic->ref = $obj->bref;
338 $accountstatic->number = $obj->bnumber;
339 $accountstatic->label = $obj->blabel;
340 $accountstatic->iban = $obj->iban;
341 $accountstatic->bic = $obj->bic;
342 $accountstatic->currency_code = $langs->trans(
"Currency".$obj->currency_code);
343 $accountstatic->clos = $obj->clos;
345 if (isModEnabled(
'accounting')) {
346 $accountstatic->account_number = $obj->account_number;
347 $accountstatic->accountancy_journal = $obj->account_journal;
349 print $accountstatic->getNomUrl(1);
357 print
'<td class="right"><span class="amount">'.price($obj->total).
'</span></td>';
360 print
'<td class="right">';
361 if ($obj->totalpaid) {
362 print
'<span class="amount">'.price($obj->totalpaid).
'</span>';
370 $total = $total + $obj->total;
371 $totalpaid = $totalpaid + $obj->totalpaid;
376print
'<tr class="liste_total"><td colspan="3" class="liste_total">'.$langs->trans(
"Total").
'</td>';
377print
'<td class="liste_total right"></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>';
382print
'<td align="center" class="liste_total"> </td>';
383if (isModEnabled(
"banque")) {
387print
'<td class="liste_total right">'.price($totalpaid).
"</td>";
396$parameters = array(
'user' => $user);
397$reshook = $hookmanager->executeHooks(
'dashboardSpecialBills', $parameters, $object);
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage bank accounts.
Class to manage bank transaction lines.
Classe permettant la gestion des paiements des charges La tva collectee n'est calculee que sur les fa...
Class to manage payments of social contributions.
Class to manage salary payments.
Put here description of your class.
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.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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.