28 require
'../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formsocialcontrib.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/paymentsocialcontribution.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/tax.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
38 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
39 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
42 include_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
46 $langs->loadLangs(array(
'compta',
'bills',
'banks',
'hrm'));
50 $action =
GETPOST(
'action',
'aZ09');
51 $confirm =
GETPOST(
'confirm',
'alpha');
52 $cancel =
GETPOST(
'cancel',
'aZ09');
53 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'myobjectcard';
54 $backtopage =
GETPOST(
'backtopage',
'alpha');
55 $backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
56 $lineid =
GETPOST(
'lineid',
'int');
58 $fk_project = (
GETPOST(
'fk_project') ?
GETPOST(
'fk_project',
'int') : 0);
62 $label =
GETPOST(
'label',
'alpha');
63 $actioncode =
GETPOST(
'actioncode');
64 $fk_user =
GETPOST(
'userid',
'int');
67 $hookmanager->initHooks(array(
'taxcard',
'globalcard'));
72 $diroutputmassaction = $conf->tax->dir_output.
'/temp/massgeneration/'.$user->id;
73 $hookmanager->initHooks(array(
'taxsocialcontributioncard',
'globalcard'));
75 if (empty($action) && empty($id) && empty($ref)) {
84 $permissiontoread = $user->rights->tax->charges->lire;
85 $permissiontoadd = $user->rights->tax->charges->creer;
86 $permissiontodelete = $user->rights->tax->charges->supprimer || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
87 $permissionnote = $user->rights->tax->charges->creer;
88 $permissiondellink = $user->rights->tax->charges->creer;
89 $upload_dir = $conf->tax->multidir_output[isset($object->entity) ? $object->entity : 1];
92 $socid =
GETPOST(
'socid',
'int');
94 $socid = $user->socid;
96 $result =
restrictedArea($user,
'tax', $object->id,
'chargesociales',
'charges');
105 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
111 if ($action ==
'confirm_paid' && $user->rights->tax->charges->creer && $confirm ==
'yes') {
113 $result = $object->setPaid($user);
116 if ($action ==
'reopen' && $user->rights->tax->charges->creer) {
117 $result = $object->fetch($id);
119 $result = $object->setUnpaid($user);
121 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
130 if ($action ==
'classin' && $user->rights->tax->charges->creer) {
132 $object->setProject(
GETPOST(
'fk_project'));
135 if ($action ==
'setfk_user' && $user->rights->tax->charges->creer) {
137 $object->fk_user = $fk_user;
138 $object->update($user);
141 if ($action ==
'setlib' && $user->rights->tax->charges->creer) {
143 $result = $object->setValueFrom(
'libelle',
GETPOST(
'lib'),
'',
'',
'text',
'', $user,
'TAX_MODIFY');
150 if ($action ==
'setmode' && $user->rights->tax->charges->creer) {
152 $result = $object->setPaymentMethods(
GETPOST(
'mode_reglement_id',
'int'));
159 if ($action ==
'setbankaccount' && $user->rights->tax->charges->creer) {
161 $result = $object->setBankAccount(
GETPOST(
'fk_account',
'int'));
168 if ($action ==
'confirm_delete' && $confirm ==
'yes') {
170 $totalpaid = $object->getSommePaiement();
171 if (empty($totalpaid)) {
172 $result = $object->delete($user);
174 header(
"Location: list.php");
186 if ($action ==
'add' && $user->rights->tax->charges->creer) {
190 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Date")),
null,
'errors');
192 } elseif (!$dateperiod) {
193 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Period")),
null,
'errors');
195 } elseif (!($actioncode > 0)) {
196 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Type")),
null,
'errors');
198 } elseif (empty($amount)) {
199 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Amount")),
null,
'errors');
201 } elseif (!is_numeric($amount)) {
202 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentities(
"Amount")),
null,
'errors');
205 $object->type = $actioncode;
206 $object->label =
GETPOST(
'label',
'alpha');
207 $object->date_ech = $dateech;
208 $object->periode = $dateperiod;
209 $object->amount = $amount;
210 $object->fk_user = $fk_user;
211 $object->mode_reglement_id = (int)
GETPOST(
'mode_reglement_id',
'int');
212 $object->fk_account = (int)
GETPOST(
'fk_account',
'int');
213 $object->fk_project = (int)
GETPOST(
'fk_project',
'int');
215 $id = $object->create($user);
224 if ($action ==
'update' && !
GETPOST(
"cancel") && $user->rights->tax->charges->creer) {
228 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Date")),
null,
'errors');
230 } elseif (!$dateperiod) {
231 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Period")),
null,
'errors');
233 } elseif (empty($amount)) {
234 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Amount")),
null,
'errors');
236 } elseif (!is_numeric($amount)) {
237 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentities(
"Amount")),
null,
'errors');
240 $result = $object->fetch($id);
242 $object->date_ech = $dateech;
243 $object->periode = $dateperiod;
244 $object->amount = $amount;
245 $object->fk_user = $fk_user;
247 $result = $object->update($user);
255 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
259 if ($action ==
'confirm_clone' && $confirm ==
'yes' && ($user->rights->tax->charges->creer)) {
266 if ($object->id > 0) {
267 $object->id = $object->ref =
null;
269 if (
GETPOST(
'amount',
'alphanohtml')) {
273 if (
GETPOST(
'clone_label',
'alphanohtml')) {
274 $object->label =
GETPOST(
'clone_label',
'alphanohtml');
276 $object->label = $langs->trans(
"CopyOf").
' '.$object->label;
279 if (
GETPOST(
'clone_for_next_month',
'int')) {
286 if ($newdateperiod) {
287 $object->periode = $newdateperiod;
288 if (empty($newdateech)) {
289 $object->date_ech = $object->periode;
293 $object->date_ech = $newdateech;
294 if (empty($newdateperiod)) {
297 $object->periode = $object->date_ech;
302 $resultcheck = $object->check();
304 $id = $object->create($user);
309 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
335 $bankaccountstatic =
new Account($db);
340 $title = $langs->trans(
"SocialContribution").
' - '.$langs->trans(
"Card");
341 $help_url =
'EN:Module_Taxes_and_social_contributions|FR:Module Taxes et dividendes|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)';
346 if ($action ==
'create') {
349 print
'<form name="charge" method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
350 print
'<input type="hidden" name="token" value="'.newToken().
'">';
351 print
'<input type="hidden" name="action" value="add">';
355 print
'<table class="border centpercent">';
359 print
'<td class="titlefieldcreate fieldrequired">';
360 print $langs->trans(
"Label");
362 print
'<td><input type="text" name="label" class="flat minwidth300" value="'.dol_escape_htmltag(
GETPOST(
'label',
'alpha')).
'" autofocus></td>';
367 print
'<td class="fieldrequired">';
368 print $langs->trans(
"Type");
371 $formsocialcontrib->select_type_socialcontrib(
GETPOST(
"actioncode",
'alpha') ?
GETPOST(
"actioncode",
'alpha') :
'',
'actioncode', 1);
377 print
'<td class="fieldrequired">';
378 print $langs->trans(
"Date");
381 print
$form->selectDate(!empty($dateech) ? $dateech :
'-1',
'ech', 0, 0, 0,
'charge', 1, 1);
387 print
'<td class="fieldrequired">';
388 print
$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo"));
391 print
$form->selectDate(!empty($dateperiod) ? $dateperiod :
'-1',
'period', 0, 0, 0,
'charge', 1);
397 print
'<td class="fieldrequired">';
398 print $langs->trans(
"Amount");
400 print
'<td><input type="text" size="6" name="amount" class="flat" value="'.dol_escape_htmltag(
GETPOST(
'amount',
'alpha')).
'"></td>';
405 print $langs->trans(
'Employee');
407 print
'<td>'.img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers($fk_user,
'userid', 1).
'</td></tr>';
414 $langs->load(
"projects");
416 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
418 print
img_picto(
'',
'project',
'class="pictofixedwidth"').$formproject->select_projects(-1, $fk_project,
'fk_project', 0, 0, 1, 1, 0, 0, 0,
'', 1);
424 print
'<tr><td>'.$langs->trans(
'DefaultPaymentMode').
'</td><td colspan="2">';
425 $form->select_types_paiements(
GETPOST(
'mode_reglement_id',
'int'),
'mode_reglement_id');
430 print
'<tr><td>'.$langs->trans(
'DefaultBankAccount').
'</td><td colspan="2">';
431 print
img_picto(
'',
'bank_account',
'class="pictofixedwidth"').$form->select_comptes(
GETPOST(
'fk_account',
'int'),
'fk_account', 0,
'', 2,
'', 0,
'', 1);
439 print
'<div class="center">';
440 print
'<input type="submit" class="button button-add" value="'.$langs->trans(
"Add").
'">';
441 print
' ';
442 print
'<input type="button" class="button button-cancel" value="'.$langs->trans(
"Cancel").
'" onClick="javascript:history.go(-1)">';
451 $result = $object->fetch($id);
458 $totalpaid = $object->getSommePaiement();
461 if ($action ===
'clone') {
462 $formquestion = array(
463 array(
'type' =>
'text',
'name' =>
'clone_label',
'label' => $langs->trans(
"Label"),
'value' => $langs->trans(
"CopyOf").
' '.$object->label,
'tdclass'=>
'fieldrequired'),
465 if (!empty($conf->global->TAX_ADD_CLONE_FOR_NEXT_MONTH_CHECKBOX)) {
466 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'clone_for_next_month',
'label' => $langs->trans(
"CloneTaxForNextMonth"),
'value' => 1);
468 $formquestion[] = array(
'type' =>
'date',
'datenow'=>1,
'name' =>
'clone_date_ech',
'label' => $langs->trans(
"Date"),
'value' => -1);
469 $formquestion[] = array(
'type' =>
'date',
'name' =>
'clone_period',
'label' => $langs->trans(
"PeriodEndDate"),
'value' => -1);
470 $formquestion[] = array(
'type' =>
'text',
'name' =>
'amount',
'label' => $langs->trans(
"Amount"),
'value' =>
price($object->amount),
'morecss' =>
'width100');
473 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneTax', $object->ref),
'confirm_clone', $formquestion,
'yes', 1, 280);
477 if ($action ==
'paid') {
478 $text = $langs->trans(
'ConfirmPaySocialContribution');
479 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
'PaySocialContribution'), $text,
"confirm_paid",
'',
'', 2);
483 if ($action ==
'delete') {
484 $text = $langs->trans(
'ConfirmDeleteSocialContribution');
485 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'DeleteSocialContribution'), $text,
'confirm_delete',
'',
'', 2);
488 if ($action ==
'edit') {
489 print
"<form name=\"charge\" action=\"".$_SERVER[
"PHP_SELF"].
"?id=$object->id&action=update\" method=\"post\">";
490 print
'<input type="hidden" name="token" value="'.newToken().
'">';
494 $reshook = $hookmanager->executeHooks(
'formConfirm',
$parameters, $object, $action);
495 if (empty($reshook)) {
497 } elseif ($reshook > 0) {
504 print
dol_get_fiche_head($head,
'card', $langs->trans(
"SocialContribution"), -1,
'bill');
506 $morehtmlref =
'<div class="refidno">';
508 $morehtmlref .=
$form->editfieldkey(
"Label",
'lib', $object->label, $object, $user->rights->tax->charges->creer,
'string',
'', 0, 1);
509 $morehtmlref .=
$form->editfieldval(
"Label",
'lib', $object->label, $object, $user->rights->tax->charges->creer,
'string',
'',
null,
null,
'', 1);
512 if ($action !=
'editfk_user') {
513 if ($object->getSommePaiement() > 0 && !empty($object->fk_user)) {
514 $userstatic =
new User($db);
515 $result = $userstatic->fetch($object->fk_user);
517 $morehtmlref .=
'<br>' .$langs->trans(
'Employee').
' : '.$userstatic->getNomUrl(1);
520 $morehtmlref .=
'<br>' .
$form->editfieldkey(
"Employee",
'fk_user', $object->label, $object, $user->rights->salaries->write,
'string',
'', 0, 1);
521 if (!empty($object->fk_user)) {
522 $userstatic =
new User($db);
523 $result = $userstatic->fetch($object->fk_user);
525 $morehtmlref .= $userstatic->getNomUrl(1);
533 $morehtmlref .=
'<br>'.$langs->trans(
'Employee').
' : ';
534 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
535 $morehtmlref .=
'<input type="hidden" name="action" value="setfk_user">';
536 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
537 $morehtmlref .=
$form->select_dolusers($object->fk_user,
'userid', 1);
538 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
539 $morehtmlref .=
'</form>';
544 $langs->load(
"projects");
545 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
546 if ($user->rights->tax->charges->creer) {
547 if ($action !=
'classify') {
548 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
550 if ($action ==
'classify') {
552 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
553 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
554 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
555 $morehtmlref .= $formproject->select_projects(0, $object->fk_project,
'fk_project', 0, 0, 1, 0, 1, 0, 0,
'', 1);
556 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
557 $morehtmlref .=
'</form>';
559 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, 0, $object->fk_project,
'none', 0, 0, 0, 1);
562 if (!empty($object->fk_project)) {
564 $proj->fetch($object->fk_project);
565 $morehtmlref .=
' : '.$proj->getNomUrl(1);
567 $morehtmlref .=
' - '.$proj->title;
574 $morehtmlref .=
'</div>';
578 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
580 $object->totalpaid = $totalpaid;
582 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'', $morehtmlright);
584 print
'<div class="fichecenter">';
585 print
'<div class="fichehalfleft">';
586 print
'<div class="underbanner clearboth"></div>';
588 print
'<table class="border centpercent">';
591 print
'<tr><td class="titlefield">';
592 print $langs->trans(
"Type").
"</td><td>".$object->type_label.
"</td>";
596 if ($action ==
'edit') {
597 print
'<tr><td>'.$langs->trans(
"Date").
"</td><td>";
598 print
$form->selectDate($object->date_ech,
'ech', 0, 0, 0,
'charge', 1, 1);
601 print
"<tr><td>".$langs->trans(
"Date").
"</td><td>".
dol_print_date($object->date_ech,
'day').
"</td></tr>";
605 print
"<tr><td>".$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo")).
"</td>";
607 if ($action ==
'edit') {
608 print
$form->selectDate($object->periode,
'period', 0, 0, 0,
'charge', 1);
615 if ($action ==
'edit') {
616 print
'<tr><td>'.$langs->trans(
"AmountTTC").
"</td><td>";
617 print
'<input type="text" name="amount" size="12" class="flat" value="'.price($object->amount).
'">';
620 print
'<tr><td>'.$langs->trans(
"AmountTTC").
'</td><td><span class="amount">'.
price($object->amount, 0, $langs, 1, -1, -1, $conf->currency).
'</span></td></tr>';
625 print
'<table class="nobordernopadding" width="100%"><tr><td>';
626 print $langs->trans(
'DefaultPaymentMode');
628 if ($action !=
'editmode') {
629 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>';
631 print
'</tr></table>';
633 if ($action ==
'editmode') {
634 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->mode_reglement_id,
'mode_reglement_id');
636 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->mode_reglement_id,
'none');
642 print
'<tr><td class="nowrap">';
643 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
644 print $langs->trans(
'DefaultBankAccount');
646 if ($action !=
'editbankaccount' && $user->rights->tax->charges->creer) {
647 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>';
649 print
'</tr></table>';
651 if ($action ==
'editbankaccount') {
652 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_account,
'fk_account', 1);
654 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_account,
'none');
662 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
663 print $hookmanager->resPrint;
668 print
'<div class="fichehalfright">';
678 $sql =
"SELECT p.rowid, p.num_paiement as num_payment, p.datep as dp, p.amount,";
679 $sql .=
" c.code as type_code,c.libelle as paiement_type,";
680 $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';
681 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiementcharge as p";
682 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank as b ON p.fk_bank = b.rowid';
683 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank_account as ba ON b.fk_account = ba.rowid';
684 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as c ON p.fk_typepaiement = c.id";
685 $sql .=
", ".MAIN_DB_PREFIX.
"chargesociales as cs";
686 $sql .=
" WHERE p.fk_charge = ".((int) $id);
687 $sql .=
" AND p.fk_charge = cs.rowid";
688 $sql .=
" AND cs.entity IN (".getEntity(
'sc').
")";
689 $sql .=
" ORDER BY dp DESC";
692 $resql = $db->query($sql);
696 $num = $db->num_rows(
$resql);
700 print
'<div class="div-table-responsive-no-min">';
701 print
'<table class="noborder paymenttable">';
702 print
'<tr class="liste_titre">';
703 print
'<td>'.$langs->trans(
"RefPayment").
'</td>';
704 print
'<td>'.$langs->trans(
"Date").
'</td>';
705 print
'<td>'.$langs->trans(
"Type").
'</td>';
707 print
'<td class="liste_titre right">'.$langs->trans(
'BankAccount').
'</td>';
709 print
'<td class="right">'.$langs->trans(
"Amount").
'</td>';
716 $objp = $db->fetch_object(
$resql);
718 $paymentsocialcontributiontmp->id = $objp->rowid;
719 $paymentsocialcontributiontmp->ref = $objp->rowid;
720 $paymentsocialcontributiontmp->datep = $db->jdate($objp->dp);
722 print
'<tr class="oddeven"><td>';
723 print $paymentsocialcontributiontmp->getNomUrl(1);
726 print
'<td>'.dol_print_date($db->jdate($objp->dp),
'day').
"</td>\n";
727 $labeltype = $langs->trans(
"PaymentType".$objp->type_code) != (
"PaymentType".$objp->type_code) ? $langs->trans(
"PaymentType".$objp->type_code) : $objp->paiement_type;
728 print
"<td>".$labeltype.
' '.$objp->num_payment.
"</td>\n";
730 $bankaccountstatic->id = $objp->baid;
731 $bankaccountstatic->ref = $objp->baref;
732 $bankaccountstatic->label = $objp->baref;
733 $bankaccountstatic->number = $objp->banumber;
734 $bankaccountstatic->currency_code = $objp->bacurrency_code;
737 $bankaccountstatic->account_number = $objp->account_number;
740 $accountingjournal->fetch($objp->fk_accountancy_journal);
741 $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
744 print
'<td class="right">';
745 if ($bankaccountstatic->id) {
746 print $bankaccountstatic->getNomUrl(1,
'transactions');
750 print
'<td class="right"><span class="amount">'.price($objp->amount).
"</span></td>\n";
752 $totalpaid += $objp->amount;
756 print
'<tr class="oddeven"><td><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
757 print
'<td></td><td></td><td></td><td></td>';
761 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AlreadyPaid").
' :</td><td class="right">'.
price($totalpaid).
"</td></tr>\n";
762 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AmountExpected").
' :</td><td class="right">'.
price($object->amount).
"</td></tr>\n";
764 $resteapayer = $object->amount - $totalpaid;
765 $cssforamountpaymentcomplete =
'amountpaymentcomplete';
767 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"RemainderToPay").
" :</td>";
768 print
'<td class="right'.($resteapayer ?
' amountremaintopay' : (
' '.$cssforamountpaymentcomplete)).
'">'.
price($resteapayer).
"</td></tr>\n";
781 print
'<div class="clearboth"></div>';
785 if ($action ==
'edit') {
786 print
$form->buttonsSaveCancel();
795 if ($action !=
'edit') {
796 print
'<div class="tabsAction">'.
"\n";
799 if ($object->paye && $user->rights->tax->charges->creer) {
800 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>';
804 if ($object->paye == 0 && $user->rights->tax->charges->creer) {
805 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>';
809 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) {
810 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>";
814 if ($object->paye == 0 && round($resteapayer) <= 0 && $user->rights->tax->charges->creer) {
815 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>';
819 if ($user->rights->tax->charges->creer) {
820 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>";
824 if ($user->rights->tax->charges->supprimer && empty($totalpaid)) {
825 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>';
827 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans(
"DisabledBecausePayments"))).
'">'.$langs->trans(
"Delete").
'</a></div>';
835 if (
GETPOST(
'modelselected')) {
839 if ($action !=
'presend') {
840 print
'<div class="fichecenter"><div class="fichehalfleft">';
841 print
'<a name="builddoc"></a>';
843 $includedocgeneration = 1;
846 if ($includedocgeneration) {
848 $relativepath = $objref.
'/'.$objref.
'.pdf';
849 $filedir = $conf->tax->dir_output.
'/'.$objref;
850 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
853 $delallowed = $user->rights->tax->charges->creer;
854 print $formfile->showdocuments(
'tax', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
862 print
'</div><div class="fichehalfright">';
875 print
'</div></div>';
879 if (
GETPOST(
'modelselected')) {
885 $defaulttopic =
'InformationMessage';
886 $diroutput = $conf->tax->dir_output;
887 $trackid =
'sc'.$object->id;
889 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';