32 require
'../../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/tva.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/paymentsocialcontribution.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/salaries/class/salary.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
39 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formsocialcontrib.class.php';
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');
61 if (empty($page) || $page < 0) {
64 $offset = $limit * $page;
65 $pageprev = $page - 1;
66 $pagenext = $page + 1;
68 $sortfield =
"cs.date_ech";
76 $socid = $user->socid;
78 $result =
restrictedArea($user,
'tax',
'',
'chargesociales',
'charges');
86 if (
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");
113 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
114 $param .=
'&contextpage='.urlencode($contextpage);
116 if ($limit > 0 && $limit != $conf->liste_limit) {
117 $param .=
'&limit='.urlencode($limit);
120 $param .=
'&sortfield='.urlencode($sortfield);
123 $param .=
'&sortorder='.urlencode($sortorder);
126 $param .=
'&year='.urlencode($year);
128 if ($search_sc_type) {
129 $param .=
'&search_sc_type='.urlencode($search_sc_type);
131 if ($optioncss !=
'') {
132 $param .=
'&optioncss='.urlencode($optioncss);
136 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
137 if ($optioncss !=
'') {
138 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
140 print
'<input type="hidden" name="token" value="'.newToken().
'">';
141 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
142 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
143 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
144 print
'<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").
")";
163 if ($search_sc_type > 0) {
164 $sql .=
" AND cs.fk_type = ".((int) $search_sc_type);
174 if (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);
185 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
186 $resql = $db->query($sql);
198 $sql .= $db->plimit($limit + 1, $offset);
201 $resql = $db->query($sql);
207 $num = $db->num_rows(
$resql);
213 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
'', $num,
$nbtotalofrecords,
'object_payment', 0, $nav,
'', $limit, 0);
215 print
'<table class="noborder centpercent">';
217 print
'<tr class="liste_titre">';
218 print
'<td class="liste_titre"></td>';
219 print
'<td class="liste_titre"></td>';
220 print
'<td class="liste_titre">';
221 $formsocialcontrib->select_type_socialcontrib(
GETPOSTISSET(
"search_sc_type") ? $search_sc_type :
'',
'search_sc_type', 1, 0, 0,
'minwidth200 maxwidth300');
223 print
'<td class="liste_titre"></td>';
224 print
'<td class="liste_titre"></td>';
225 print
'<td class="liste_titre"></td>';
226 print
'<td class="liste_titre"></td>';
227 print
'<td class="liste_titre"></td>';
228 print
'<td class="liste_titre"></td>';
230 print
'<td class="liste_titre"></td>';
231 print
'<td class="liste_titre"></td>';
233 print
'<td class="liste_titre"></td>';
234 print
'<td class="liste_titre center">';
235 $searchpicto =
$form->showFilterButtons();
240 print
'<tr class="liste_titre">';
241 print_liste_field_titre(
"RefPayment", $_SERVER[
"PHP_SELF"],
"pc.rowid",
"", $param,
'', $sortfield, $sortorder);
242 print_liste_field_titre(
"SocialContribution", $_SERVER[
"PHP_SELF"],
"c.libelle",
"", $param,
'', $sortfield, $sortorder);
243 print_liste_field_titre(
"TypeContrib", $_SERVER[
"PHP_SELF"],
"cs.fk_type",
"", $param,
'', $sortfield, $sortorder);
244 print_liste_field_titre(
"PeriodEndDate", $_SERVER[
"PHP_SELF"],
"cs.periode",
"", $param,
'', $sortfield, $sortorder,
'center ');
245 print_liste_field_titre(
"DatePayment", $_SERVER[
"PHP_SELF"],
"pc.datep",
"", $param,
'', $sortfield, $sortorder,
'center ');
247 print_liste_field_titre(
"PaymentMode", $_SERVER[
"PHP_SELF"],
"pct.code",
"", $param,
'', $sortfield, $sortorder);
248 print_liste_field_titre(
"Numero", $_SERVER[
"PHP_SELF"],
"pc.num_paiement",
"", $param,
'', $sortfield, $sortorder,
'',
'ChequeOrTransferNumber');
250 print_liste_field_titre(
"BankTransactionLine", $_SERVER[
"PHP_SELF"],
"pc.fk_bank",
"", $param,
'', $sortfield, $sortorder);
253 print_liste_field_titre(
"ExpectedToPay", $_SERVER[
"PHP_SELF"],
"cs.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
254 print_liste_field_titre(
"PayedByThisPayment", $_SERVER[
"PHP_SELF"],
"pc.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
268 while ($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->label_sc).
'" class="tdoverflowmax300">'.$obj->label_sc.
'</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>';
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;
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;
376 print
'<tr class="liste_total"><td colspan="3" class="liste_total">'.$langs->trans(
"Total").
'</td>';
377 print
'<td class="liste_total right"></td>';
378 print
'<td align="center" class="liste_total"> </td>';
379 print
'<td align="center" class="liste_total"> </td>';
380 print
'<td align="center" class="liste_total"> </td>';
381 print
'<td align="center" class="liste_total"> </td>';
382 print
'<td align="center" class="liste_total"> </td>';
387 print
'<td class="liste_total right">'.price($totalpaid).
"</td>";
396 $parameters = array(
'user' => $user);
397 $reshook = $hookmanager->executeHooks(
'dashboardSpecialBills', $parameters, $object);
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
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.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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...
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
$nbtotalofrecords
Count total nb of records.
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.