30require
'../../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formsocialcontrib.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/paymentsocialcontribution.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/tax.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
49require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
51 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
52 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
57$langs->loadLangs(array(
'compta',
'bills',
'banks',
'hrm'));
61$action =
GETPOST(
'action',
'aZ09');
62$confirm =
GETPOST(
'confirm',
'alpha');
63$cancel =
GETPOST(
'cancel',
'alpha');
64$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'chargesocialescard';
65$backtopage =
GETPOST(
'backtopage',
'alpha');
66$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
74$label =
GETPOST(
'label',
'alpha');
79$hookmanager->initHooks(array(
'taxcard',
'globalcard'));
83$diroutputmassaction =
$conf->tax->dir_output.
'/temp/massgeneration/'.$user->id;
84$hookmanager->initHooks(array(
'taxsocialcontributioncard',
'globalcard'));
86if (empty($action) && empty($id) && empty($ref)) {
95$permissiontoread = $user->hasRight(
'tax',
'charges',
'lire');
96$permissiontoadd = $user->hasRight(
'tax',
'charges',
'creer');
97$permissiontodelete = $user->hasRight(
'tax',
'charges',
'supprimer') || ($permissiontoadd && isset(
$object->status) &&
$object->status == $object::STATUS_UNPAID);
98$permissionnote = $user->hasRight(
'tax',
'charges',
'creer');
99$permissiondellink = $user->hasRight(
'tax',
'charges',
'creer');
105 $socid = $user->socid;
114$parameters = array(
'socid' => $socid);
115$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
117 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
120if (empty($reshook)) {
122 if ($action ==
'confirm_paid' && $permissiontoadd && $confirm ==
'yes') {
123 $result =
$object->setPaid($user);
126 if ($action ==
'reopen' && $user->hasRight(
'tax',
'charges',
'creer')) {
128 $result =
$object->setUnpaid($user);
130 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
139 if ($action ==
'classin' && $permissiontoadd) {
143 if ($action ==
'setfk_user' && $permissiontoadd) {
145 $result =
$object->update($user);
151 if ($action ==
'setlib' && $permissiontoadd) {
152 $result =
$object->setValueFrom(
'libelle',
GETPOST(
'lib'),
'',
null,
'text',
'', $user,
'TAX_MODIFY');
159 if ($action ==
'setmode' && $permissiontoadd) {
167 if ($action ==
'setbankaccount' && $permissiontoadd) {
175 if ($action ==
'confirm_delete' && $permissiontodelete && $confirm ==
'yes') {
176 $totalpaid =
$object->getSommePaiement();
177 if (empty($totalpaid)) {
179 $result =
$object->delete($user);
181 header(
"Location: list.php");
187 setEventMessages($langs->trans(
'DisabledBecausePayments'),
null,
'errors');
193 if ($action ==
'add' && $permissiontoadd) {
197 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Date")),
null,
'errors');
199 } elseif (!$dateperiod) {
200 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Period")),
null,
'errors');
202 } elseif (!($actioncode > 0)) {
203 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Type")),
null,
'errors');
205 } elseif (empty($amount)) {
206 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Amount")),
null,
'errors');
208 } elseif (!is_numeric($amount)) {
209 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentities(
"Amount")),
null,
'errors');
215 $object->periode = $dateperiod;
222 $object->paye = ChargeSociales::STATUS_UNPAID;
229 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
235 if ($action ==
'update' && !$cancel && $permissiontoadd) {
239 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Date")),
null,
'errors');
241 } elseif (!$dateperiod) {
242 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Period")),
null,
'errors');
244 } elseif (empty($amount)) {
245 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Amount")),
null,
'errors');
247 } elseif (!is_numeric($amount)) {
248 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentities(
"Amount")),
null,
'errors');
258 $object->periode = $dateperiod;
262 $result =
$object->update($user);
275 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
279 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontoadd) {
288 if (
GETPOST(
'amount',
'alphanohtml')) {
292 if (
GETPOST(
'clone_label',
'alphanohtml')) {
306 if ($newdateperiod) {
307 $object->period = $newdateperiod;
308 if (empty($newdateech)) {
313 $object->date_ech = $newdateech;
314 if (empty($newdateperiod)) {
322 $resultcheck =
$object->check();
329 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
340 dol_print_error($db,
$object->error);
345 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
353$form =
new Form($db);
356$bankaccountstatic =
new Account($db);
361$title = $langs->trans(
"SocialContribution").
' - '.$langs->trans(
"Card");
362$help_url =
'EN:Module_Taxes_and_social_contributions|FR:Module_Taxes_et_charges_spéciales|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)';
369if ($action ==
'create') {
372 print
'<form name="charge" method="POST" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
373 print
'<input type="hidden" name="token" value="'.newToken().
'">';
374 print
'<input type="hidden" name="action" value="add">';
378 print
'<table class="border centpercent tableforfieldcreate">';
382 print
'<td class="titlefieldcreate fieldrequired">';
383 print $langs->trans(
"Label");
385 print
'<td><input type="text" name="label" class="flat minwidth300" value="'.dol_escape_htmltag(
GETPOST(
'label',
'alpha')).
'" autofocus></td>';
390 print
'<td class="fieldrequired">';
391 print $langs->trans(
"Type");
394 $formsocialcontrib->select_type_socialcontrib(
GETPOST(
'actioncode',
'alpha') ?
GETPOSTINT(
'actioncode') : 0,
'actioncode', 1);
400 print
'<td class="fieldrequired">';
401 print $langs->trans(
"Date");
404 print $form->selectDate(!empty($dateech) ? $dateech :
'-1',
'ech', 0, 0, 0,
'charge', 1, 1);
410 print
'<td class="fieldrequired">';
411 print $form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo"));
414 print $form->selectDate(!empty($dateperiod) ? $dateperiod :
'-1',
'period', 0, 0, 0,
'charge', 1);
420 print
'<td class="fieldrequired">';
421 print $langs->trans(
"Amount");
423 print
'<td><input type="text" size="6" name="amount" class="flat" value="'.dol_escape_htmltag(
GETPOST(
'amount',
'alpha')).
'"></td>';
428 print $langs->trans(
'Employee');
430 print
'<td>'.img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
'',
'userid', 1).
'</td></tr>';
437 $langs->load(
"projects");
439 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
441 print img_picto(
'',
'project',
'class="pictofixedwidth"').$formproject->select_projects(-1, (
string) $fk_project,
'fk_project', 0, 0, 1, 1, 0, 0, 0,
'', 1);
447 print
'<tr><td>'.$langs->trans(
'DefaultPaymentMode').
'</td><td colspan="2">';
448 $form->select_types_paiements((
string)
GETPOSTINT(
'mode_reglement_id'),
'mode_reglement_id');
453 print
'<tr><td>'.$langs->trans(
'DefaultBankAccount').
'</td><td colspan="2">';
454 print img_picto(
'',
'bank_account',
'class="pictofixedwidth"').$form->select_comptes(
GETPOSTINT(
'fk_account'),
'fk_account', 0,
'', 2,
'', 0,
'', 1);
462 print
'<div class="center">';
463 print
'<input type="submit" class="button button-add" value="'.$langs->trans(
"Add").
'">';
464 print
' ';
465 print
'<input type="button" class="button button-cancel" value="'.$langs->trans(
"Cancel").
'" onClick="history.go(-1)">';
478 $totalpaid =
$object->getSommePaiement();
481 if ($action ===
'clone') {
482 $formquestion = array(
483 array(
'type' =>
'text',
'name' =>
'clone_label',
'label' => $langs->trans(
"Label"),
'value' => $langs->trans(
"CopyOf").
' '.
$object->label,
'tdclass' =>
'fieldrequired'),
486 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'clone_for_next_month',
'label' => $langs->trans(
"CloneTaxForNextMonth"),
'value' => 1);
488 $formquestion[] = array(
'type' =>
'date',
'datenow' => 1,
'name' =>
'clone_date_ech',
'label' => $langs->trans(
"Date"),
'value' => -1);
489 $formquestion[] = array(
'type' =>
'date',
'name' =>
'clone_period',
'label' => $langs->trans(
"PeriodEndDate"),
'value' => -1);
490 $formquestion[] = array(
'type' =>
'text',
'name' =>
'amount',
'label' => $langs->trans(
"Amount"),
'value' =>
price(
$object->amount),
'morecss' =>
'width100');
493 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneTax',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1, 0);
497 if ($action ==
'paid') {
498 $text = $langs->trans(
'ConfirmPaySocialContribution');
499 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
'PaySocialContribution'), $text,
"confirm_paid",
'',
'', 2);
503 if ($action ==
'delete') {
504 $text = $langs->trans(
'ConfirmDeleteSocialContribution');
505 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'DeleteSocialContribution'), $text,
'confirm_delete',
'',
'', 2);
508 if ($action ==
'edit') {
509 print
'<form name="charge" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST">';
510 print
'<input type="hidden" name="token" value="'.newToken().
'">';
511 print
'<input type="hidden" name="action" value="update">';
514 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
515 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
516 if (empty($reshook)) {
517 $formconfirm .= $hookmanager->resPrint;
518 } elseif ($reshook > 0) {
519 $formconfirm = $hookmanager->resPrint;
523 print
dol_get_fiche_head($head,
'card', $langs->trans(
"SocialContribution"), -1,
$object->picto, 0,
'',
'', 0,
'', ($action ==
'edit' ? 0 : 1));
530 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
532 $morehtmlref =
'<div class="refidno">';
534 $morehtmlref .= $form->editfieldkey(
"Label",
'lib',
$object->label, $object, $user->hasRight(
'tax',
'charges',
'creer'),
'string',
'', 0, 1);
535 $morehtmlref .= $form->editfieldval(
"Label",
'lib',
$object->label, $object, $user->hasRight(
'tax',
'charges',
'creer'),
'string',
'',
null,
null,
'', 1);
538 if ($action !=
'editfk_user') {
540 $userstatic =
new User($db);
541 $result = $userstatic->fetch(
$object->fk_user);
543 $morehtmlref .=
'<br>' .$langs->trans(
'Employee').
' : '.$userstatic->getNomUrl(-1);
546 $morehtmlref .=
'<br>' . $form->editfieldkey(
"Employee",
'fk_user',
$object->label, $object, $user->hasRight(
'salaries',
'write'),
'string',
'', 0, 1);
548 $userstatic =
new User($db);
549 $result = $userstatic->fetch(
$object->fk_user);
551 $morehtmlref .= $userstatic->getNomUrl(-1);
553 dol_print_error($db);
559 $morehtmlref .=
'<br>'.$langs->trans(
'Employee').
' : ';
560 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
561 $morehtmlref .=
'<input type="hidden" name="action" value="setfk_user">';
562 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
563 $morehtmlref .= $form->select_dolusers(
$object->fk_user,
'userid', 1);
564 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
565 $morehtmlref .=
'</form>';
570 $langs->load(
"projects");
571 $morehtmlref .=
'<br>';
572 if ($permissiontoadd) {
573 $morehtmlref .= img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
574 if ($action !=
'classify') {
575 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.((int)
$object->id).
'">'.img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
577 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, -1, (
string)
$object->fk_project, ($action ==
'classify' ?
'fk_project' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
579 if (!empty(
$object->fk_project)) {
581 $proj->fetch(
$object->fk_project);
582 $morehtmlref .= $proj->getNomUrl(1);
584 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
589 $morehtmlref .=
'</div>';
593 $object->totalpaid = $totalpaid;
595 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'',
'', 0, $morehtmlright);
597 print
'<div class="fichecenter">';
598 print
'<div class="fichehalfleft">';
599 print
'<div class="underbanner clearboth"></div>';
601 print
'<table class="border centpercent tableforfield">';
604 print
'<tr><td class="titlefield">';
605 print $langs->trans(
"Type").
"</td><td>";
606 if ($action ==
'edit' &&
$object->getSommePaiement() == 0) {
608 $formsocialcontrib->select_type_socialcontrib($actionPostValue ? $actionPostValue :
$object->
type,
'actioncode', 1);
612 print
' <pan class="opacitymedium">('.$langs->trans(
"AccountancyCode").
': '.(empty(
$object->type_accountancy_code) ? $langs->trans(
"Unknown") :
length_accountg(
$object->type_accountancy_code)).
')</span>';
620 if ($action ==
'edit') {
621 print
'<tr><td>'.$langs->trans(
"Date").
"</td><td>";
622 print $form->selectDate(
$object->date_ech,
'ech', 0, 0, 0,
'charge', 1, 1);
625 print
"<tr><td>".$langs->trans(
"Date").
"</td><td>".
dol_print_date(
$object->date_ech,
'day').
"</td></tr>";
629 print
"<tr><td>".$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo")).
"</td>";
631 if ($action ==
'edit') {
632 print $form->selectDate(
$object->period,
'period', 0, 0, 0,
'charge', 1);
639 if ($action ==
'edit') {
640 print
'<tr><td>'.$langs->trans(
"AmountTTC").
"</td><td>";
641 print
'<input type="text" name="amount" size="12" class="flat" value="'.price(
$object->amount).
'">';
644 print
'<tr><td>'.$langs->trans(
"AmountTTC").
'</td><td><span class="amount">'.
price(
$object->amount, 0, $langs, 1, -1, -1,
$conf->currency).
'</span></td></tr>';
649 print
'<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
650 print $langs->trans(
'DefaultPaymentMode');
652 if ($action !=
'editmode') {
653 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>';
655 print
'</tr></table>';
657 if ($action ==
'editmode') {
658 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
string)
$object->mode_reglement_id,
'mode_reglement_id',
'', 1, 1);
660 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
string)
$object->mode_reglement_id,
'none');
666 print
'<tr><td class="nowrap">';
667 print
'<table class="centpercent nobordernopadding"><tr><td class="nowrap">';
668 print $langs->trans(
'DefaultBankAccount');
670 if ($action !=
'editbankaccount' && $user->hasRight(
'tax',
'charges',
'creer')) {
671 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>';
673 print
'</tr></table>';
675 if ($action ==
'editbankaccount') {
676 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
string)
$object->fk_account,
'fk_account', 1);
678 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
string)
$object->fk_account,
'none');
685 $parameters = array();
686 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
687 print $hookmanager->resPrint;
692 print
'<div class="fichehalfright">';
694 print
'<div class="underbanner clearboth"></div>';
704 $sql =
"SELECT p.rowid, p.num_paiement as num_payment, p.datep as dp, p.amount,";
705 $sql .=
" c.code as type_code,c.libelle as paiement_type,";
706 $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';
707 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiementcharge as p";
708 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank as b ON p.fk_bank = b.rowid';
709 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank_account as ba ON b.fk_account = ba.rowid';
710 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as c ON p.fk_typepaiement = c.id";
711 $sql .=
", ".MAIN_DB_PREFIX.
"chargesociales as cs";
712 $sql .=
" WHERE p.fk_charge = ".((int) $id);
713 $sql .=
" AND p.fk_charge = cs.rowid";
714 $sql .=
" AND cs.entity IN (".getEntity(
'sc').
")";
715 $sql .=
" ORDER BY dp DESC";
718 $resql = $db->query($sql);
722 $num = $db->num_rows($resql);
725 print
'<div class="div-table-responsive-no-min">';
726 print
'<table class="noborder paymenttable">';
727 print
'<tr class="liste_titre">';
728 print
'<td>'.$langs->trans(
"RefPayment").
'</td>';
729 print
'<td>'.$langs->trans(
"Date").
'</td>';
730 print
'<td>'.$langs->trans(
"Type").
'</td>';
732 print
'<td class="liste_titre right">'.$langs->trans(
'BankAccount').
'</td>';
734 print
'<td class="right">'.$langs->trans(
"Amount").
'</td>';
741 $objp = $db->fetch_object($resql);
743 $paymentsocialcontributiontmp->id = $objp->rowid;
744 $paymentsocialcontributiontmp->ref = $objp->rowid;
745 $paymentsocialcontributiontmp->datep = $db->jdate($objp->dp);
747 print
'<tr class="oddeven"><td>';
748 print $paymentsocialcontributiontmp->getNomUrl(1);
751 print
'<td>'.dol_print_date($db->jdate($objp->dp),
'day').
"</td>\n";
752 $labeltype = $langs->trans(
"PaymentType".$objp->type_code) !=
"PaymentType".$objp->type_code ? $langs->trans(
"PaymentType".$objp->type_code) : $objp->paiement_type;
753 print
"<td>".$labeltype.
' '.$objp->num_payment.
"</td>\n";
755 $bankaccountstatic->id = $objp->baid;
756 $bankaccountstatic->ref = $objp->baref;
757 $bankaccountstatic->label = $objp->baref;
758 $bankaccountstatic->number = $objp->banumber;
759 $bankaccountstatic->currency_code = $objp->bacurrency_code;
762 $bankaccountstatic->account_number = $objp->account_number;
765 $accountingjournal->fetch($objp->fk_accountancy_journal);
766 $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
769 print
'<td class="right">';
770 if ($bankaccountstatic->id) {
771 print $bankaccountstatic->getNomUrl(1,
'transactions');
775 print
'<td class="right"><span class="amount">'.price($objp->amount).
"</span></td>\n";
777 $totalpaid += $objp->amount;
781 print
'<tr class="oddeven"><td><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
782 print
'<td></td><td></td><td></td><td></td>';
786 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AlreadyPaid").
' :</td><td class="right nowraponall">'.
price($totalpaid).
"</td></tr>\n";
787 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AmountExpected").
' :</td><td class="right nowraponall">'.
price(
$object->amount).
"</td></tr>\n";
789 $resteapayer =
$object->amount - $totalpaid;
790 $cssforamountpaymentcomplete =
'amountpaymentcomplete';
792 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"RemainderToPay").
" :</td>";
793 print
'<td class="right nowraponall'.($resteapayer ?
' amountremaintopay' : (
' '.$cssforamountpaymentcomplete)).
'">'.
price($resteapayer).
"</td></tr>\n";
800 dol_print_error($db);
806 print
'<div class="clearboth"></div>';
810 if ($action ==
'edit') {
811 print $form->buttonsSaveCancel();
820 if ($action !=
'edit') {
821 print
'<div class="tabsAction">'.
"\n";
824 if (
$object->paye && $user->hasRight(
'tax',
'charges',
'creer')) {
825 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>';
829 if (
$object->paye == 0 && $user->hasRight(
'tax',
'charges',
'creer')) {
830 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>';
835 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>";
839 if (
$object->paye == 0 && round($resteapayer) <= 0 && $user->hasRight(
'tax',
'charges',
'creer')) {
840 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>';
844 if ($user->hasRight(
'tax',
'charges',
'creer')) {
845 print
'<div class="inline-block divButAction">'.dolGetButtonAction($langs->trans(
"ToClone"), $langs->trans(
"ToClone"),
'clone', DOL_URL_ROOT.
'/compta/sociales/card.php?id='.
$object->id.
'&action=clone&token='.
newToken(),
'',
true, array(
'attr' => array(
'class' =>
'reposition'))).
'</div>';
849 if ($user->hasRight(
'tax',
'charges',
'supprimer') && empty($totalpaid)) {
850 print
'<div class="inline-block divButAction">'.dolGetButtonAction($langs->trans(
"Delete"), $langs->trans(
"Delete"),
'delete', DOL_URL_ROOT.
'/compta/sociales/card.php?id='.
$object->id.
'&action=delete&token='.
newToken(),
'',
true, array(
'attr' => array(
'class' =>
'reposition'))).
'</div>'.
"\n";
852 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans(
"DisabledBecausePayments"))).
'">'.$langs->trans(
"Delete").
'</a></div>';
860 if (
GETPOST(
'modelselected')) {
864 if ($action !=
'edit' && $action !=
'presend') {
865 print
'<div class="fichecenter"><div class="fichehalfleft">';
866 print
'<a name="builddoc"></a>';
868 $includedocgeneration = 1;
871 if ($includedocgeneration) {
873 $relativepath = $objref.
'/'.$objref.
'.pdf';
874 $filedir =
$conf->tax->dir_output.
'/'.$objref;
875 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
877 $delallowed = $user->hasRight(
'tax',
'charges',
'creer');
878 print $formfile->showdocuments(
'tax', $objref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
886 print
'</div><div class="fichehalfright">';
899 print
'</div></div>';
903 if (
GETPOST(
'modelselected')) {
909 $defaulttopic =
'InformationMessage';
910 $diroutput =
$conf->tax->dir_output;
911 $trackid =
'sc'.$object->id;
913 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
916 dol_print_error(
null,
$object->error);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
$propal type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage bank accounts.
Class to manage accounting journals.
Class for managing the social charges.
Class to manage payments of social contributions.
Class to manage projects.
Class to manage Dolibarr users.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0, $tz='')
Add a delay to a date.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
price2num($amount, $rounding='', $option=0, $currencycode='')
Function that return a number with universal decimal format (decimal separator is '.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
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.
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, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.
tax_prepare_head(ChargeSociales $object)
Prepare array with list of tabs.