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';
57$langs->loadLangs(array(
'compta',
'bills',
'hrm'));
60$hookmanager->initHooks(array(
'specialexpensesindex'));
64$search_sc_type =
GETPOST(
'search_sc_type',
'intcomma');
65$optioncss =
GETPOST(
'optioncss',
'alpha');
68$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
69$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
71if (empty($page) || $page < 0) {
74$offset = $limit * $page;
78 $sortfield =
"cs.date_ech";
86 $socid = $user->socid;
88$result =
restrictedArea($user,
'tax',
'',
'chargesociales',
'charges');
96if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
107$tva_static =
new Tva($db);
110$userstatic =
new User($db);
111$sal_static =
new Salary($db);
112$accountstatic =
new Account($db);
116$title = $langs->trans(
"SocialContributionsPayments");
123if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
124 $param .=
'&contextpage='.urlencode($contextpage);
126if ($limit > 0 && $limit !=
$conf->liste_limit) {
127 $param .=
'&limit='.((int) $limit);
130 $param .=
'&sortfield='.urlencode($sortfield);
133 $param .=
'&sortorder='.urlencode($sortorder);
136 $param .=
'&year='.urlencode((
string) ($year));
138if ($search_sc_type) {
139 $param .=
'&search_sc_type='.urlencode((
string) ($search_sc_type));
141if ($optioncss !=
'') {
142 $param .=
'&optioncss='.urlencode($optioncss);
146print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
147if ($optioncss !=
'') {
148 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
150print
'<input type="hidden" name="token" value="'.newToken().
'">';
151print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
152print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
153print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
154print
'<input type="hidden" name="page" value="'.$page.
'">';
156$sql =
"SELECT c.id, c.libelle as type_label,";
157$sql .=
" cs.rowid, cs.libelle as label_sc, cs.fk_type as type, cs.periode, cs.date_ech, cs.amount as total, cs.paye,";
158$sql .=
" pc.rowid as pid, pc.datep, pc.amount as totalpaid, pc.num_paiement as num_payment, pc.fk_bank,";
159$sql .=
" pct.code as payment_code,";
160$sql .=
" u.rowid as uid, u.lastname, u.firstname, u.email, u.login, u.admin, u.statut,";
161$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,";
162$sql .=
" aj.label as account_journal";
163$sql .=
" FROM ".MAIN_DB_PREFIX.
"c_chargesociales as c,";
164$sql .=
" ".MAIN_DB_PREFIX.
"chargesociales as cs";
165$sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"paiementcharge as pc ON pc.fk_charge = cs.rowid";
166$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as pct ON pc.fk_typepaiement = pct.id";
167$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank as b ON pc.fk_bank = b.rowid";
168$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"bank_account as ba ON b.fk_account = ba.rowid";
169$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_journal as aj ON ba.fk_accountancy_journal = aj.rowid";
170$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u ON u.rowid = cs.fk_user";
171$sql .=
" WHERE cs.fk_type = c.id";
172$sql .=
" AND cs.entity IN (".getEntity(
"tax").
")";
173if ($search_sc_type > 0) {
174 $sql .=
" AND cs.fk_type = ".((int) $search_sc_type);
184if ($sortfield !==
null
185 && preg_match(
'/^(cs|c|pc|pct|u|ba)\./', $sortfield)
187 $sql .= $db->order($sortfield, $sortorder);
191$nbtotalofrecords =
'';
194 $resql = $db->query($sql);
195 $nbtotalofrecords = $db->num_rows($resql);
196 if (($page * $limit) > $nbtotalofrecords) {
202if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
203 $num = $nbtotalofrecords;
206 $sql .= $db->plimit($limit + 1, $offset);
209 $resql = $db->query($sql);
215 $num = $db->num_rows($resql);
221print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num, $nbtotalofrecords,
'object_payment', 0, $nav,
'', $limit, 0);
223print
'<table class="noborder centpercent">';
225print
'<tr class="liste_titre">';
226print
'<td class="liste_titre"></td>';
227print
'<td class="liste_titre"></td>';
228print
'<td class="liste_titre">';
229$formsocialcontrib->select_type_socialcontrib(GETPOSTISSET(
"search_sc_type") ? $search_sc_type :
'',
'search_sc_type', 1, 0, 0,
'minwidth200 maxwidth300');
231print
'<td class="liste_titre"></td>';
232print
'<td class="liste_titre"></td>';
233print
'<td class="liste_titre"></td>';
234print
'<td class="liste_titre"></td>';
235print
'<td class="liste_titre"></td>';
236print
'<td class="liste_titre"></td>';
237if (isModEnabled(
"bank")) {
238 print
'<td class="liste_titre"></td>';
239 print
'<td class="liste_titre"></td>';
241print
'<td class="liste_titre"></td>';
242print
'<td class="liste_titre center">';
243$searchpicto = $form->showFilterButtons();
248print
'<tr class="liste_titre">';
249print_liste_field_titre(
"RefPayment", $_SERVER[
"PHP_SELF"],
"pc.rowid",
"", $param,
'', $sortfield, $sortorder);
250print_liste_field_titre(
"SocialContribution", $_SERVER[
"PHP_SELF"],
"c.libelle",
"", $param,
'', $sortfield, $sortorder);
251print_liste_field_titre(
"TypeContrib", $_SERVER[
"PHP_SELF"],
"cs.fk_type",
"", $param,
'', $sortfield, $sortorder);
252print_liste_field_titre(
"PeriodEndDate", $_SERVER[
"PHP_SELF"],
"cs.periode",
"", $param,
'', $sortfield, $sortorder,
'center ');
253print_liste_field_titre(
"DatePayment", $_SERVER[
"PHP_SELF"],
"pc.datep",
"", $param,
'', $sortfield, $sortorder,
'center ');
255print_liste_field_titre(
"PaymentMode", $_SERVER[
"PHP_SELF"],
"pct.code",
"", $param,
'', $sortfield, $sortorder);
256print_liste_field_titre(
"Numero", $_SERVER[
"PHP_SELF"],
"pc.num_paiement",
"", $param,
'', $sortfield, $sortorder,
'',
'ChequeOrTransferNumber');
257if (isModEnabled(
"bank")) {
258 print_liste_field_titre(
"BankTransactionLine", $_SERVER[
"PHP_SELF"],
"pc.fk_bank",
"", $param,
'', $sortfield, $sortorder);
259 print_liste_field_titre(
"BankAccount", $_SERVER[
"PHP_SELF"],
"ba.label",
"", $param,
"", $sortfield, $sortorder);
261print_liste_field_titre(
"ExpectedToPay", $_SERVER[
"PHP_SELF"],
"cs.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
262print_liste_field_titre(
"PayedByThisPayment", $_SERVER[
"PHP_SELF"],
"pc.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
276while ($i < min($num, $limit)) {
277 $obj = $db->fetch_object($resql);
279 $payment_sc_static->id = $obj->pid;
280 $payment_sc_static->ref = $obj->pid;
281 $payment_sc_static->datep = $db->jdate($obj->datep);
283 $socialcontrib->id = $obj->rowid;
284 $socialcontrib->ref = empty($obj->label_sc) ? $obj->type_label : $obj->label_sc;
285 $socialcontrib->paye = $obj->paye;
288 $socialcontrib->label = empty($obj->label_sc) ? $obj->type_label : $obj->label_sc;
289 $socialcontrib->type_label = $obj->type_label;
291 print
'<tr class="oddeven">';
293 print
'<td class="nowraponall">'.$payment_sc_static->getNomUrl(1).
"</td>\n";
295 print
'<td class="tdoverflowmax250">';
296 print $socialcontrib->getNomUrl(1,
'');
299 print
'<td title="'.dol_escape_htmltag($obj->type_label).
'" class="tdoverflowmax300">'.$obj->type_label.
'</td>';
301 $date = $obj->periode;
303 $date = $obj->date_ech;
305 print
'<td class="center">'.dol_print_date($date,
'day').
'</td>';
307 print
'<td class="center">'.dol_print_date($db->jdate($obj->datep),
'day').
'</td>';
311 if (!empty($obj->uid)) {
312 $userstatic->id = $obj->uid;
313 $userstatic->lastname = $obj->lastname;
314 $userstatic->firstname = $obj->firstname;
315 $userstatic->admin = $obj->admin;
316 $userstatic->login = $obj->login;
317 $userstatic->email = $obj->email;
318 $userstatic->status = $obj->statut;
319 print $userstatic->getNomUrl(1);
325 if ($obj->payment_code) {
326 $labelpayment = $langs->trans(
"PaymentTypeShort".$obj->payment_code);
328 print
'<td class="tdoverflowmax150" title="'.$labelpayment.
'">';
332 print
'<td>'.$obj->num_payment.
'</td>';
335 if (isModEnabled(
"bank")) {
337 print
'<td class="nowraponall">';
338 $accountlinestatic->id = $obj->fk_bank;
339 print $accountlinestatic->getNomUrl(1);
342 print
'<td class="nowraponall">';
344 $accountstatic->id = $obj->bid;
345 $accountstatic->ref = $obj->bref;
346 $accountstatic->number = $obj->bnumber;
347 $accountstatic->label = $obj->blabel;
348 $accountstatic->iban = $obj->iban;
349 $accountstatic->bic = $obj->bic;
350 $accountstatic->currency_code = $langs->trans(
"Currency".$obj->currency_code);
351 $accountstatic->clos = $obj->clos;
353 if (isModEnabled(
'accounting')) {
354 $accountstatic->account_number = $obj->account_number;
355 $accountstatic->accountancy_journal = $obj->account_journal;
357 print $accountstatic->getNomUrl(1);
365 print
'<td class="right"><span class="amount">'.price($obj->total).
'</span></td>';
368 print
'<td class="right">';
369 if ($obj->totalpaid) {
370 print
'<span class="amount">'.price($obj->totalpaid).
'</span>';
378 $total += $obj->total;
379 $totalpaid += $obj->totalpaid;
384print
'<tr class="liste_total"><td colspan="3" class="liste_total">'.$langs->trans(
"Total").
'</td>';
385print
'<td class="liste_total right"></td>';
386print
'<td align="center" class="liste_total"> </td>';
387print
'<td align="center" class="liste_total"> </td>';
388print
'<td align="center" class="liste_total"> </td>';
389print
'<td align="center" class="liste_total"> </td>';
390print
'<td align="center" class="liste_total"> </td>';
391if (isModEnabled(
"bank")) {
395print
'<td class="liste_total right">'.price($totalpaid).
"</td>";
404$parameters = array(
'user' => $user);
405$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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.