29 require
'../../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formsocialcontrib.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/paymentsocialcontribution.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/tax.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
37 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
39 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
40 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
43 include_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
47 $langs->loadLangs(array(
'compta',
'bills',
'banks',
'hrm'));
51 $action =
GETPOST(
'action',
'aZ09');
52 $confirm =
GETPOST(
'confirm',
'alpha');
53 $cancel =
GETPOST(
'cancel',
'aZ09');
54 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'myobjectcard';
55 $backtopage =
GETPOST(
'backtopage',
'alpha');
56 $backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
57 $lineid =
GETPOST(
'lineid',
'int');
59 $fk_project = (
GETPOST(
'fk_project') ?
GETPOST(
'fk_project',
'int') : 0);
63 $label =
GETPOST(
'label',
'alpha');
64 $actioncode =
GETPOST(
'actioncode');
65 $fk_user =
GETPOST(
'userid',
'int');
68 $hookmanager->initHooks(array(
'taxcard',
'globalcard'));
73 $diroutputmassaction = $conf->tax->dir_output.
'/temp/massgeneration/'.$user->id;
74 $hookmanager->initHooks(array(
'taxsocialcontributioncard',
'globalcard'));
76 if (empty($action) && empty($id) && empty($ref)) {
85 $permissiontoread = $user->rights->tax->charges->lire;
86 $permissiontoadd = $user->rights->tax->charges->creer;
87 $permissiontodelete = $user->rights->tax->charges->supprimer || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
88 $permissionnote = $user->rights->tax->charges->creer;
89 $permissiondellink = $user->rights->tax->charges->creer;
90 $upload_dir = $conf->tax->multidir_output[isset($object->entity) ? $object->entity : 1];
93 $socid =
GETPOST(
'socid',
'int');
95 $socid = $user->socid;
97 $result =
restrictedArea($user,
'tax', $object->id,
'chargesociales',
'charges');
106 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
112 if ($action ==
'confirm_paid' && $user->rights->tax->charges->creer && $confirm ==
'yes') {
114 $result = $object->setPaid($user);
117 if ($action ==
'reopen' && $user->rights->tax->charges->creer) {
118 $result = $object->fetch($id);
120 $result = $object->setUnpaid($user);
122 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
131 if ($action ==
'classin' && $user->rights->tax->charges->creer) {
133 $object->setProject(
GETPOST(
'fk_project'));
136 if ($action ==
'setfk_user' && $user->rights->tax->charges->creer) {
138 $object->fk_user = $fk_user;
139 $object->update($user);
142 if ($action ==
'setlib' && $user->rights->tax->charges->creer) {
144 $result = $object->setValueFrom(
'libelle',
GETPOST(
'lib'),
'',
'',
'text',
'', $user,
'TAX_MODIFY');
151 if ($action ==
'setmode' && $user->rights->tax->charges->creer) {
153 $result = $object->setPaymentMethods(
GETPOST(
'mode_reglement_id',
'int'));
160 if ($action ==
'setbankaccount' && $user->rights->tax->charges->creer) {
162 $result = $object->setBankAccount(
GETPOST(
'fk_account',
'int'));
169 if ($action ==
'confirm_delete' && $confirm ==
'yes') {
171 $totalpaid = $object->getSommePaiement();
172 if (empty($totalpaid)) {
173 $result = $object->delete($user);
175 header(
"Location: list.php");
187 if ($action ==
'add' && $user->rights->tax->charges->creer) {
191 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Date")),
null,
'errors');
193 } elseif (!$dateperiod) {
194 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Period")),
null,
'errors');
196 } elseif (!($actioncode > 0)) {
197 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Type")),
null,
'errors');
199 } elseif (empty($amount)) {
200 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Amount")),
null,
'errors');
202 } elseif (!is_numeric($amount)) {
203 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentities(
"Amount")),
null,
'errors');
206 $object->type = $actioncode;
207 $object->label =
GETPOST(
'label',
'alpha');
208 $object->date_ech = $dateech;
209 $object->periode = $dateperiod;
210 $object->amount = $amount;
211 $object->fk_user = $fk_user;
212 $object->mode_reglement_id = (int)
GETPOST(
'mode_reglement_id',
'int');
213 $object->fk_account = (int)
GETPOST(
'fk_account',
'int');
214 $object->fk_project = (int)
GETPOST(
'fk_project',
'int');
216 $id = $object->create($user);
225 if ($action ==
'update' && !
GETPOST(
"cancel") && $user->rights->tax->charges->creer) {
229 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Date")),
null,
'errors');
231 } elseif (!$dateperiod) {
232 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Period")),
null,
'errors');
234 } elseif (empty($amount)) {
235 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Amount")),
null,
'errors');
237 } elseif (!is_numeric($amount)) {
238 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentities(
"Amount")),
null,
'errors');
241 $result = $object->fetch($id);
243 $object->date_ech = $dateech;
244 $object->periode = $dateperiod;
245 $object->amount = $amount;
246 $object->fk_user = $fk_user;
248 $result = $object->update($user);
256 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
260 if ($action ==
'confirm_clone' && $confirm ==
'yes' && ($user->rights->tax->charges->creer)) {
267 if ($object->id > 0) {
268 $object->id = $object->ref =
null;
270 if (
GETPOST(
'amount',
'alphanohtml')) {
274 if (
GETPOST(
'clone_label',
'alphanohtml')) {
275 $object->label =
GETPOST(
'clone_label',
'alphanohtml');
277 $object->label = $langs->trans(
"CopyOf").
' '.$object->label;
280 if (
GETPOST(
'clone_for_next_month',
'int')) {
287 if ($newdateperiod) {
288 $object->periode = $newdateperiod;
289 if (empty($newdateech)) {
290 $object->date_ech = $object->periode;
294 $object->date_ech = $newdateech;
295 if (empty($newdateperiod)) {
298 $object->periode = $object->date_ech;
303 $resultcheck = $object->check();
305 $id = $object->create($user);
310 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
336 $bankaccountstatic =
new Account($db);
341 $title = $langs->trans(
"SocialContribution").
' - '.$langs->trans(
"Card");
342 $help_url =
'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)';
347 if ($action ==
'create') {
350 print
'<form name="charge" method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
351 print
'<input type="hidden" name="token" value="'.newToken().
'">';
352 print
'<input type="hidden" name="action" value="add">';
356 print
'<table class="border centpercent">';
360 print
'<td class="titlefieldcreate fieldrequired">';
361 print $langs->trans(
"Label");
363 print
'<td><input type="text" name="label" class="flat minwidth300" value="'.dol_escape_htmltag(
GETPOST(
'label',
'alpha')).
'" autofocus></td>';
368 print
'<td class="fieldrequired">';
369 print $langs->trans(
"Type");
372 $formsocialcontrib->select_type_socialcontrib(
GETPOST(
"actioncode",
'alpha') ?
GETPOST(
"actioncode",
'alpha') :
'',
'actioncode', 1);
378 print
'<td class="fieldrequired">';
379 print $langs->trans(
"Date");
382 print
$form->selectDate(!empty($dateech) ? $dateech :
'-1',
'ech', 0, 0, 0,
'charge', 1, 1);
388 print
'<td class="fieldrequired">';
389 print
$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo"));
392 print
$form->selectDate(!empty($dateperiod) ? $dateperiod :
'-1',
'period', 0, 0, 0,
'charge', 1);
398 print
'<td class="fieldrequired">';
399 print $langs->trans(
"Amount");
401 print
'<td><input type="text" size="6" name="amount" class="flat" value="'.dol_escape_htmltag(
GETPOST(
'amount',
'alpha')).
'"></td>';
406 print $langs->trans(
'Employee');
408 print
'<td>'.img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers($fk_user,
'userid', 1).
'</td></tr>';
415 $langs->load(
"projects");
417 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
419 print
img_picto(
'',
'project',
'class="pictofixedwidth"').$formproject->select_projects(-1, $fk_project,
'fk_project', 0, 0, 1, 1, 0, 0, 0,
'', 1);
425 print
'<tr><td>'.$langs->trans(
'DefaultPaymentMode').
'</td><td colspan="2">';
426 $form->select_types_paiements(
GETPOST(
'mode_reglement_id',
'int'),
'mode_reglement_id');
431 print
'<tr><td>'.$langs->trans(
'DefaultBankAccount').
'</td><td colspan="2">';
432 print
img_picto(
'',
'bank_account',
'class="pictofixedwidth"').$form->select_comptes(
GETPOST(
'fk_account',
'int'),
'fk_account', 0,
'', 2,
'', 0,
'', 1);
440 print
'<div class="center">';
441 print
'<input type="submit" class="button button-add" value="'.$langs->trans(
"Add").
'">';
442 print
' ';
443 print
'<input type="button" class="button button-cancel" value="'.$langs->trans(
"Cancel").
'" onClick="javascript:history.go(-1)">';
452 $result = $object->fetch($id);
459 $totalpaid = $object->getSommePaiement();
462 if ($action ===
'clone') {
463 $formquestion = array(
464 array(
'type' =>
'text',
'name' =>
'clone_label',
'label' => $langs->trans(
"Label"),
'value' => $langs->trans(
"CopyOf").
' '.$object->label,
'tdclass'=>
'fieldrequired'),
466 if (!empty($conf->global->TAX_ADD_CLONE_FOR_NEXT_MONTH_CHECKBOX)) {
467 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'clone_for_next_month',
'label' => $langs->trans(
"CloneTaxForNextMonth"),
'value' => 1);
469 $formquestion[] = array(
'type' =>
'date',
'datenow'=>1,
'name' =>
'clone_date_ech',
'label' => $langs->trans(
"Date"),
'value' => -1);
470 $formquestion[] = array(
'type' =>
'date',
'name' =>
'clone_period',
'label' => $langs->trans(
"PeriodEndDate"),
'value' => -1);
471 $formquestion[] = array(
'type' =>
'text',
'name' =>
'amount',
'label' => $langs->trans(
"Amount"),
'value' =>
price($object->amount),
'morecss' =>
'width100');
474 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneTax', $object->ref),
'confirm_clone', $formquestion,
'yes', 1, 280);
478 if ($action ==
'paid') {
479 $text = $langs->trans(
'ConfirmPaySocialContribution');
480 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
'PaySocialContribution'), $text,
"confirm_paid",
'',
'', 2);
484 if ($action ==
'delete') {
485 $text = $langs->trans(
'ConfirmDeleteSocialContribution');
486 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'DeleteSocialContribution'), $text,
'confirm_delete',
'',
'', 2);
489 if ($action ==
'edit') {
490 print
"<form name=\"charge\" action=\"".$_SERVER[
"PHP_SELF"].
"?id=$object->id&action=update\" method=\"post\">";
491 print
'<input type="hidden" name="token" value="'.newToken().
'">';
495 $reshook = $hookmanager->executeHooks(
'formConfirm',
$parameters, $object, $action);
496 if (empty($reshook)) {
498 } elseif ($reshook > 0) {
505 print
dol_get_fiche_head($head,
'card', $langs->trans(
"SocialContribution"), -1,
'bill');
507 $morehtmlref =
'<div class="refidno">';
509 $morehtmlref .=
$form->editfieldkey(
"Label",
'lib', $object->label, $object, $user->rights->tax->charges->creer,
'string',
'', 0, 1);
510 $morehtmlref .=
$form->editfieldval(
"Label",
'lib', $object->label, $object, $user->rights->tax->charges->creer,
'string',
'',
null,
null,
'', 1);
513 if ($action !=
'editfk_user') {
514 if ($object->getSommePaiement() > 0 && !empty($object->fk_user)) {
515 $userstatic =
new User($db);
516 $result = $userstatic->fetch($object->fk_user);
518 $morehtmlref .=
'<br>' .$langs->trans(
'Employee').
' : '.$userstatic->getNomUrl(1);
521 $morehtmlref .=
'<br>' .
$form->editfieldkey(
"Employee",
'fk_user', $object->label, $object, $user->rights->salaries->write,
'string',
'', 0, 1);
522 if (!empty($object->fk_user)) {
523 $userstatic =
new User($db);
524 $result = $userstatic->fetch($object->fk_user);
526 $morehtmlref .= $userstatic->getNomUrl(1);
534 $morehtmlref .=
'<br>'.$langs->trans(
'Employee').
' : ';
535 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
536 $morehtmlref .=
'<input type="hidden" name="action" value="setfk_user">';
537 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
538 $morehtmlref .=
$form->select_dolusers($object->fk_user,
'userid', 1);
539 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
540 $morehtmlref .=
'</form>';
545 $langs->load(
"projects");
546 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
547 if ($user->rights->tax->charges->creer) {
548 if ($action !=
'classify') {
549 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
551 if ($action ==
'classify') {
553 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
554 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
555 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
556 $morehtmlref .= $formproject->select_projects(0, $object->fk_project,
'fk_project', 0, 0, 1, 0, 1, 0, 0,
'', 1);
557 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
558 $morehtmlref .=
'</form>';
560 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, 0, $object->fk_project,
'none', 0, 0, 0, 1);
563 if (!empty($object->fk_project)) {
565 $proj->fetch($object->fk_project);
566 $morehtmlref .=
' : '.$proj->getNomUrl(1);
568 $morehtmlref .=
' - '.$proj->title;
575 $morehtmlref .=
'</div>';
579 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
581 $object->totalpaid = $totalpaid;
583 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'', $morehtmlright);
585 print
'<div class="fichecenter">';
586 print
'<div class="fichehalfleft">';
587 print
'<div class="underbanner clearboth"></div>';
589 print
'<table class="border centpercent">';
592 print
'<tr><td class="titlefield">';
593 print $langs->trans(
"Type").
"</td><td>".$object->type_label.
"</td>";
597 if ($action ==
'edit') {
598 print
'<tr><td>'.$langs->trans(
"Date").
"</td><td>";
599 print
$form->selectDate($object->date_ech,
'ech', 0, 0, 0,
'charge', 1, 1);
602 print
"<tr><td>".$langs->trans(
"Date").
"</td><td>".
dol_print_date($object->date_ech,
'day').
"</td></tr>";
606 print
"<tr><td>".$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo")).
"</td>";
608 if ($action ==
'edit') {
609 print
$form->selectDate($object->periode,
'period', 0, 0, 0,
'charge', 1);
616 if ($action ==
'edit') {
617 print
'<tr><td>'.$langs->trans(
"AmountTTC").
"</td><td>";
618 print
'<input type="text" name="amount" size="12" class="flat" value="'.price($object->amount).
'">';
621 print
'<tr><td>'.$langs->trans(
"AmountTTC").
'</td><td><span class="amount">'.
price($object->amount, 0, $langs, 1, -1, -1, $conf->currency).
'</span></td></tr>';
626 print
'<table class="nobordernopadding" width="100%"><tr><td>';
627 print $langs->trans(
'DefaultPaymentMode');
629 if ($action !=
'editmode') {
630 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editmode&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->trans(
'SetMode'), 1).
'</a></td>';
632 print
'</tr></table>';
634 if ($action ==
'editmode') {
635 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->mode_reglement_id,
'mode_reglement_id');
637 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->mode_reglement_id,
'none');
643 print
'<tr><td class="nowrap">';
644 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
645 print $langs->trans(
'DefaultBankAccount');
647 if ($action !=
'editbankaccount' && $user->rights->tax->charges->creer) {
648 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editbankaccount&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->trans(
'SetBankAccount'), 1).
'</a></td>';
650 print
'</tr></table>';
652 if ($action ==
'editbankaccount') {
653 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_account,
'fk_account', 1);
655 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_account,
'none');
663 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
664 print $hookmanager->resPrint;
669 print
'<div class="fichehalfright">';
679 $sql =
"SELECT p.rowid, p.num_paiement as num_payment, p.datep as dp, p.amount,";
680 $sql .=
" c.code as type_code,c.libelle as paiement_type,";
681 $sql .=
' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.currency_code as bacurrency_code, ba.fk_accountancy_journal';
682 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiementcharge as p";
683 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank as b ON p.fk_bank = b.rowid';
684 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank_account as ba ON b.fk_account = ba.rowid';
685 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as c ON p.fk_typepaiement = c.id";
686 $sql .=
", ".MAIN_DB_PREFIX.
"chargesociales as cs";
687 $sql .=
" WHERE p.fk_charge = ".((int) $id);
688 $sql .=
" AND p.fk_charge = cs.rowid";
689 $sql .=
" AND cs.entity IN (".getEntity(
'sc').
")";
690 $sql .=
" ORDER BY dp DESC";
693 $resql = $db->query($sql);
697 $num = $db->num_rows(
$resql);
701 print
'<div class="div-table-responsive-no-min">';
702 print
'<table class="noborder paymenttable">';
703 print
'<tr class="liste_titre">';
704 print
'<td>'.$langs->trans(
"RefPayment").
'</td>';
705 print
'<td>'.$langs->trans(
"Date").
'</td>';
706 print
'<td>'.$langs->trans(
"Type").
'</td>';
708 print
'<td class="liste_titre right">'.$langs->trans(
'BankAccount').
'</td>';
710 print
'<td class="right">'.$langs->trans(
"Amount").
'</td>';
717 $objp = $db->fetch_object(
$resql);
719 $paymentsocialcontributiontmp->id = $objp->rowid;
720 $paymentsocialcontributiontmp->ref = $objp->rowid;
721 $paymentsocialcontributiontmp->datep = $db->jdate($objp->dp);
723 print
'<tr class="oddeven"><td>';
724 print $paymentsocialcontributiontmp->getNomUrl(1);
727 print
'<td>'.dol_print_date($db->jdate($objp->dp),
'day').
"</td>\n";
728 $labeltype = $langs->trans(
"PaymentType".$objp->type_code) != (
"PaymentType".$objp->type_code) ? $langs->trans(
"PaymentType".$objp->type_code) : $objp->paiement_type;
729 print
"<td>".$labeltype.
' '.$objp->num_payment.
"</td>\n";
731 $bankaccountstatic->id = $objp->baid;
732 $bankaccountstatic->ref = $objp->baref;
733 $bankaccountstatic->label = $objp->baref;
734 $bankaccountstatic->number = $objp->banumber;
735 $bankaccountstatic->currency_code = $objp->bacurrency_code;
738 $bankaccountstatic->account_number = $objp->account_number;
741 $accountingjournal->fetch($objp->fk_accountancy_journal);
742 $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
745 print
'<td class="right">';
746 if ($bankaccountstatic->id) {
747 print $bankaccountstatic->getNomUrl(1,
'transactions');
751 print
'<td class="right"><span class="amount">'.price($objp->amount).
"</span></td>\n";
753 $totalpaid += $objp->amount;
757 print
'<tr class="oddeven"><td><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
758 print
'<td></td><td></td><td></td><td></td>';
762 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AlreadyPaid").
' :</td><td class="right">'.
price($totalpaid).
"</td></tr>\n";
763 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AmountExpected").
' :</td><td class="right">'.
price($object->amount).
"</td></tr>\n";
765 $resteapayer = $object->amount - $totalpaid;
766 $cssforamountpaymentcomplete =
'amountpaymentcomplete';
768 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"RemainderToPay").
" :</td>";
769 print
'<td class="right'.($resteapayer ?
' amountremaintopay' : (
' '.$cssforamountpaymentcomplete)).
'">'.
price($resteapayer).
"</td></tr>\n";
782 print
'<div class="clearboth"></div>';
786 if ($action ==
'edit') {
787 print
$form->buttonsSaveCancel();
796 if ($action !=
'edit') {
797 print
'<div class="tabsAction">'.
"\n";
800 if ($object->paye && $user->rights->tax->charges->creer) {
801 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/compta/sociales/card.php?id='.$object->id.
'&action=reopen&token='.
newToken().
'">'.$langs->trans(
"ReOpen").
'</a></div>';
805 if ($object->paye == 0 && $user->rights->tax->charges->creer) {
806 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/compta/sociales/card.php?id='.$object->id.
'&action=edit&token='.
newToken().
'">'.$langs->trans(
"Modify").
'</a></div>';
810 if ($object->paye == 0 && ((
price2num($object->amount) < 0 &&
price2num($resteapayer,
'MT') < 0) || (
price2num($object->amount) > 0 &&
price2num($resteapayer,
'MT') > 0)) && $user->rights->tax->charges->creer) {
811 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/compta/paiement_charge.php?id='.$object->id.
'&action=create&token='.
newToken().
'">'.$langs->trans(
"DoPayment").
"</a></div>";
815 if ($object->paye == 0 && round($resteapayer) <= 0 && $user->rights->tax->charges->creer) {
816 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/compta/sociales/card.php?id='.$object->id.
'&action=paid&token='.
newToken().
'">'.$langs->trans(
"ClassifyPaid").
'</a></div>';
820 if ($user->rights->tax->charges->creer) {
821 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/compta/sociales/card.php?id='.$object->id.
'&action=clone&token='.
newToken().
'">'.$langs->trans(
"ToClone").
"</a></div>";
825 if ($user->rights->tax->charges->supprimer && empty($totalpaid)) {
826 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="'.DOL_URL_ROOT.
'/compta/sociales/card.php?id='.$object->id.
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
'</a></div>';
828 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans(
"DisabledBecausePayments"))).
'">'.$langs->trans(
"Delete").
'</a></div>';
836 if (
GETPOST(
'modelselected')) {
840 if ($action !=
'presend') {
841 print
'<div class="fichecenter"><div class="fichehalfleft">';
842 print
'<a name="builddoc"></a>';
844 $includedocgeneration = 1;
847 if ($includedocgeneration) {
849 $relativepath = $objref.
'/'.$objref.
'.pdf';
850 $filedir = $conf->tax->dir_output.
'/'.$objref;
851 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
854 $delallowed = $user->rights->tax->charges->creer;
855 print $formfile->showdocuments(
'tax', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
863 print
'</div><div class="fichehalfright">';
876 print
'</div></div>';
880 if (
GETPOST(
'modelselected')) {
886 $defaulttopic =
'InformationMessage';
887 $diroutput = $conf->tax->dir_output;
888 $trackid =
'sc'.$object->id;
890 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
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 accounting accounts.
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 projects.
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_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
isModEnabled($module)
Is Dolibarr module enabled.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
$formconfirm
if ($action == 'delbookkeepingyear') {
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.
tax_prepare_head(ChargeSociales $object)
Prepare array with list of tabs.