30require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formsocialcontrib.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/paymentsocialcontribution.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/tax.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/accounting.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
42if (isModEnabled(
'project')) {
43 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
44 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
56$langs->loadLangs(array(
'compta',
'bills',
'banks',
'hrm'));
60$action =
GETPOST(
'action',
'aZ09');
61$confirm =
GETPOST(
'confirm',
'alpha');
62$cancel =
GETPOST(
'cancel',
'aZ09');
63$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'myobjectcard';
64$backtopage =
GETPOST(
'backtopage',
'alpha');
65$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
73$label =
GETPOST(
'label',
'alpha');
78$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->rights->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);
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) {
148 if ($action ==
'setlib' && $permissiontoadd) {
149 $result =
$object->setValueFrom(
'libelle',
GETPOST(
'lib'),
'',
null,
'text',
'', $user,
'TAX_MODIFY');
156 if ($action ==
'setmode' && $permissiontoadd) {
164 if ($action ==
'setbankaccount' && $permissiontoadd) {
172 if ($action ==
'confirm_delete' && $permissiontodelete && $confirm ==
'yes') {
173 $totalpaid =
$object->getSommePaiement();
174 if (empty($totalpaid)) {
175 $result =
$object->delete($user);
177 header(
"Location: list.php");
189 if ($action ==
'add' && $permissiontoadd) {
193 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Date")),
null,
'errors');
195 } elseif (!$dateperiod) {
196 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Period")),
null,
'errors');
198 } elseif (!($actioncode > 0)) {
199 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Type")),
null,
'errors');
201 } elseif (empty($amount)) {
202 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Amount")),
null,
'errors');
204 } elseif (!is_numeric($amount)) {
205 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentities(
"Amount")),
null,
'errors');
211 $object->periode = $dateperiod;
218 $object->paye = ChargeSociales::STATUS_UNPAID;
228 if ($action ==
'update' && !$cancel && $permissiontoadd) {
232 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Date")),
null,
'errors');
234 } elseif (!$dateperiod) {
235 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Period")),
null,
'errors');
237 } elseif (empty($amount)) {
238 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Amount")),
null,
'errors');
240 } elseif (!is_numeric($amount)) {
241 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentities(
"Amount")),
null,
'errors');
251 $object->periode = $dateperiod;
255 $result =
$object->update($user);
268 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
272 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontoadd) {
281 if (
GETPOST(
'amount',
'alphanohtml')) {
285 if (
GETPOST(
'clone_label',
'alphanohtml')) {
299 if ($newdateperiod) {
300 $object->period = $newdateperiod;
301 if (empty($newdateech)) {
306 $object->date_ech = $newdateech;
307 if (empty($newdateperiod)) {
315 $resultcheck =
$object->check();
322 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
338 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
346$form =
new Form($db);
349$bankaccountstatic =
new Account($db);
350if (isModEnabled(
'project')) {
354$title = $langs->trans(
"SocialContribution").
' - '.$langs->trans(
"Card");
355$help_url =
'EN:Module_Taxes_and_social_contributions|FR:Module_Taxes_et_charges_spéciales|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)';
362if ($action ==
'create') {
365 print
'<form name="charge" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
366 print
'<input type="hidden" name="token" value="'.newToken().
'">';
367 print
'<input type="hidden" name="action" value="add">';
371 print
'<table class="border centpercent tableforfieldcreate">';
375 print
'<td class="titlefieldcreate fieldrequired">';
376 print $langs->trans(
"Label");
378 print
'<td><input type="text" name="label" class="flat minwidth300" value="'.dol_escape_htmltag(
GETPOST(
'label',
'alpha')).
'" autofocus></td>';
383 print
'<td class="fieldrequired">';
384 print $langs->trans(
"Type");
387 $formsocialcontrib->select_type_socialcontrib(
GETPOST(
'actioncode',
'alpha') ?
GETPOST(
'actioncode',
'alpha') :
'',
'actioncode', 1);
393 print
'<td class="fieldrequired">';
394 print $langs->trans(
"Date");
397 print $form->selectDate(!empty($dateech) ? $dateech :
'-1',
'ech', 0, 0, 0,
'charge', 1, 1);
403 print
'<td class="fieldrequired">';
404 print $form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo"));
407 print $form->selectDate(!empty($dateperiod) ? $dateperiod :
'-1',
'period', 0, 0, 0,
'charge', 1);
413 print
'<td class="fieldrequired">';
414 print $langs->trans(
"Amount");
416 print
'<td><input type="text" size="6" name="amount" class="flat" value="'.dol_escape_htmltag(
GETPOST(
'amount',
'alpha')).
'"></td>';
421 print $langs->trans(
'Employee');
423 print
'<td>'.img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
'',
'userid', 1).
'</td></tr>';
426 if (isModEnabled(
'project')) {
430 $langs->load(
"projects");
432 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
434 print
img_picto(
'',
'project',
'class="pictofixedwidth"').$formproject->select_projects(-1, $fk_project,
'fk_project', 0, 0, 1, 1, 0, 0, 0,
'', 1);
440 print
'<tr><td>'.$langs->trans(
'DefaultPaymentMode').
'</td><td colspan="2">';
441 $form->select_types_paiements(
GETPOSTINT(
'mode_reglement_id'),
'mode_reglement_id');
445 if (isModEnabled(
"bank")) {
446 print
'<tr><td>'.$langs->trans(
'DefaultBankAccount').
'</td><td colspan="2">';
447 print
img_picto(
'',
'bank_account',
'class="pictofixedwidth"').$form->select_comptes(
GETPOSTINT(
'fk_account'),
'fk_account', 0,
'', 2,
'', 0,
'', 1);
455 print
'<div class="center">';
456 print
'<input type="submit" class="button button-add" value="'.$langs->trans(
"Add").
'">';
457 print
' ';
458 print
'<input type="button" class="button button-cancel" value="'.$langs->trans(
"Cancel").
'" onClick="history.go(-1)">';
471 $totalpaid =
$object->getSommePaiement();
474 if ($action ===
'clone') {
475 $formquestion = array(
476 array(
'type' =>
'text',
'name' =>
'clone_label',
'label' => $langs->trans(
"Label"),
'value' => $langs->trans(
"CopyOf").
' '.
$object->label,
'tdclass' =>
'fieldrequired'),
479 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'clone_for_next_month',
'label' => $langs->trans(
"CloneTaxForNextMonth"),
'value' => 1);
481 $formquestion[] = array(
'type' =>
'date',
'datenow' => 1,
'name' =>
'clone_date_ech',
'label' => $langs->trans(
"Date"),
'value' => -1);
482 $formquestion[] = array(
'type' =>
'date',
'name' =>
'clone_period',
'label' => $langs->trans(
"PeriodEndDate"),
'value' => -1);
483 $formquestion[] = array(
'type' =>
'text',
'name' =>
'amount',
'label' => $langs->trans(
"Amount"),
'value' =>
price(
$object->amount),
'morecss' =>
'width100');
486 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneTax',
$object->ref),
'confirm_clone', $formquestion,
'yes', 1, 280);
490 if ($action ==
'paid') {
491 $text = $langs->trans(
'ConfirmPaySocialContribution');
492 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".
$object->id, $langs->trans(
'PaySocialContribution'), $text,
"confirm_paid",
'',
'', 2);
496 if ($action ==
'delete') {
497 $text = $langs->trans(
'ConfirmDeleteSocialContribution');
498 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
'DeleteSocialContribution'), $text,
'confirm_delete',
'',
'', 2);
501 if ($action ==
'edit') {
502 print
'<form name="charge" action="'.$_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'" method="POST">';
503 print
'<input type="hidden" name="token" value="'.newToken().
'">';
504 print
'<input type="hidden" name="action" value="update">';
507 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
508 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters,
$object, $action);
509 if (empty($reshook)) {
510 $formconfirm .= $hookmanager->resPrint;
511 } elseif ($reshook > 0) {
512 $formconfirm = $hookmanager->resPrint;
516 print
dol_get_fiche_head($head,
'card', $langs->trans(
"SocialContribution"), -1,
'bill', 0,
'',
'', 0,
'', 1);
523 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
525 $morehtmlref =
'<div class="refidno">';
527 $morehtmlref .= $form->editfieldkey(
"Label",
'lib',
$object->label,
$object, $user->hasRight(
'tax',
'charges',
'creer'),
'string',
'', 0, 1);
528 $morehtmlref .= $form->editfieldval(
"Label",
'lib',
$object->label,
$object, $user->hasRight(
'tax',
'charges',
'creer'),
'string',
'',
null,
null,
'', 1);
531 if ($action !=
'editfk_user') {
533 $userstatic =
new User($db);
534 $result = $userstatic->fetch(
$object->fk_user);
536 $morehtmlref .=
'<br>' .$langs->trans(
'Employee').
' : '.$userstatic->getNomUrl(1);
539 $morehtmlref .=
'<br>' . $form->editfieldkey(
"Employee",
'fk_user',
$object->label,
$object, $user->hasRight(
'salaries',
'write'),
'string',
'', 0, 1);
541 $userstatic =
new User($db);
542 $result = $userstatic->fetch(
$object->fk_user);
544 $morehtmlref .= $userstatic->getNomUrl(1);
552 $morehtmlref .=
'<br>'.$langs->trans(
'Employee').
' : ';
553 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'">';
554 $morehtmlref .=
'<input type="hidden" name="action" value="setfk_user">';
555 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
556 $morehtmlref .= $form->select_dolusers(
$object->fk_user,
'userid', 1);
557 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
558 $morehtmlref .=
'</form>';
562 if (isModEnabled(
'project')) {
563 $langs->load(
"projects");
564 $morehtmlref .=
'<br>';
565 if ($permissiontoadd) {
566 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
567 if ($action !=
'classify') {
568 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.((int)
$object->id).
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
570 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (!
getDolGlobalString(
'PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ?
$object->socid : -1),
$object->fk_project, ($action ==
'classify' ?
'fk_project' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
572 if (!empty(
$object->fk_project)) {
574 $proj->fetch(
$object->fk_project);
575 $morehtmlref .= $proj->getNomUrl(1);
577 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
582 $morehtmlref .=
'</div>';
586 $object->totalpaid = $totalpaid;
588 dol_banner_tab(
$object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'',
'', 0, $morehtmlright);
590 print
'<div class="fichecenter">';
591 print
'<div class="fichehalfleft">';
592 print
'<div class="underbanner clearboth"></div>';
594 print
'<table class="border centpercent tableforfield">';
597 print
'<tr><td class="titlefieldmiddle">';
598 print $langs->trans(
"Type").
"</td><td>";
599 if ($action ==
'edit' &&
$object->getSommePaiement() == 0) {
601 $formsocialcontrib->select_type_socialcontrib($actionPostValue ? $actionPostValue :
$object->
type,
'actioncode', 1);
604 if (isModEnabled(
"accounting")) {
605 print
' <pan class="opacitymedium">('.$langs->trans(
"AccountancyCode").
': '.(empty(
$object->type_accountancy_code) ? $langs->trans(
"Unknown") :
length_accountg(
$object->type_accountancy_code)).
')</span>';
613 if ($action ==
'edit') {
614 print
'<tr><td>'.$langs->trans(
"Date").
"</td><td>";
615 print $form->selectDate(
$object->date_ech,
'ech', 0, 0, 0,
'charge', 1, 1);
618 print
"<tr><td>".$langs->trans(
"Date").
"</td><td>".
dol_print_date(
$object->date_ech,
'day').
"</td></tr>";
622 print
"<tr><td>".$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo")).
"</td>";
624 if ($action ==
'edit') {
625 print $form->selectDate(
$object->period,
'period', 0, 0, 0,
'charge', 1);
632 if ($action ==
'edit') {
633 print
'<tr><td>'.$langs->trans(
"AmountTTC").
"</td><td>";
634 print
'<input type="text" name="amount" size="12" class="flat" value="'.price(
$object->amount).
'">';
637 print
'<tr><td>'.$langs->trans(
"AmountTTC").
'</td><td><span class="amount">'.
price(
$object->amount, 0, $langs, 1, -1, -1,
$conf->currency).
'</span></td></tr>';
642 print
'<table class="nobordernopadding" width="100%"><tr><td>';
643 print $langs->trans(
'DefaultPaymentMode');
645 if ($action !=
'editmode') {
646 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>';
648 print
'</tr></table>';
650 if ($action ==
'editmode') {
651 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->mode_reglement_id,
'mode_reglement_id',
'', 1, 1);
653 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->mode_reglement_id,
'none');
658 if (isModEnabled(
"bank")) {
659 print
'<tr><td class="nowrap">';
660 print
'<table class="centpercent nobordernopadding"><tr><td class="nowrap">';
661 print $langs->trans(
'DefaultBankAccount');
663 if ($action !=
'editbankaccount' && $user->hasRight(
'tax',
'charges',
'creer')) {
664 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>';
666 print
'</tr></table>';
668 if ($action ==
'editbankaccount') {
669 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_account,
'fk_account', 1);
671 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->fk_account,
'none');
678 $parameters = array();
679 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
680 print $hookmanager->resPrint;
685 print
'<div class="fichehalfright">';
687 print
'<div class="underbanner clearboth"></div>';
690 if (isModEnabled(
"bank")) {
697 $sql =
"SELECT p.rowid, p.num_paiement as num_payment, p.datep as dp, p.amount,";
698 $sql .=
" c.code as type_code,c.libelle as paiement_type,";
699 $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';
700 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiementcharge as p";
701 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank as b ON p.fk_bank = b.rowid';
702 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank_account as ba ON b.fk_account = ba.rowid';
703 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as c ON p.fk_typepaiement = c.id";
704 $sql .=
", ".MAIN_DB_PREFIX.
"chargesociales as cs";
705 $sql .=
" WHERE p.fk_charge = ".((int) $id);
706 $sql .=
" AND p.fk_charge = cs.rowid";
707 $sql .=
" AND cs.entity IN (".getEntity(
'sc').
")";
708 $sql .=
" ORDER BY dp DESC";
711 $resql = $db->query($sql);
715 $num = $db->num_rows($resql);
719 print
'<div class="div-table-responsive-no-min">';
720 print
'<table class="noborder paymenttable">';
721 print
'<tr class="liste_titre">';
722 print
'<td>'.$langs->trans(
"RefPayment").
'</td>';
723 print
'<td>'.$langs->trans(
"Date").
'</td>';
724 print
'<td>'.$langs->trans(
"Type").
'</td>';
725 if (isModEnabled(
"bank")) {
726 print
'<td class="liste_titre right">'.$langs->trans(
'BankAccount').
'</td>';
728 print
'<td class="right">'.$langs->trans(
"Amount").
'</td>';
735 $objp = $db->fetch_object($resql);
737 $paymentsocialcontributiontmp->id = $objp->rowid;
738 $paymentsocialcontributiontmp->ref = $objp->rowid;
739 $paymentsocialcontributiontmp->datep = $db->jdate($objp->dp);
741 print
'<tr class="oddeven"><td>';
742 print $paymentsocialcontributiontmp->getNomUrl(1);
745 print
'<td>'.dol_print_date($db->jdate($objp->dp),
'day').
"</td>\n";
746 $labeltype = $langs->trans(
"PaymentType".$objp->type_code) !=
"PaymentType".$objp->type_code ? $langs->trans(
"PaymentType".$objp->type_code) : $objp->paiement_type;
747 print
"<td>".$labeltype.
' '.$objp->num_payment.
"</td>\n";
748 if (isModEnabled(
"bank")) {
749 $bankaccountstatic->id = $objp->baid;
750 $bankaccountstatic->ref = $objp->baref;
751 $bankaccountstatic->label = $objp->baref;
752 $bankaccountstatic->number = $objp->banumber;
753 $bankaccountstatic->currency_code = $objp->bacurrency_code;
755 if (isModEnabled(
'accounting')) {
756 $bankaccountstatic->account_number = $objp->account_number;
759 $accountingjournal->fetch($objp->fk_accountancy_journal);
760 $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
763 print
'<td class="right">';
764 if ($bankaccountstatic->id) {
765 print $bankaccountstatic->getNomUrl(1,
'transactions');
769 print
'<td class="right"><span class="amount">'.price($objp->amount).
"</span></td>\n";
771 $totalpaid += $objp->amount;
775 print
'<tr class="oddeven"><td><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
776 print
'<td></td><td></td><td></td><td></td>';
780 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AlreadyPaid").
' :</td><td class="right nowraponall">'.
price($totalpaid).
"</td></tr>\n";
781 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AmountExpected").
' :</td><td class="right nowraponall">'.
price(
$object->amount).
"</td></tr>\n";
783 $resteapayer =
$object->amount - $totalpaid;
784 $cssforamountpaymentcomplete =
'amountpaymentcomplete';
786 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"RemainderToPay").
" :</td>";
787 print
'<td class="right nowraponall'.($resteapayer ?
' amountremaintopay' : (
' '.$cssforamountpaymentcomplete)).
'">'.
price($resteapayer).
"</td></tr>\n";
800 print
'<div class="clearboth"></div>';
804 if ($action ==
'edit') {
805 print $form->buttonsSaveCancel();
814 if ($action !=
'edit') {
815 print
'<div class="tabsAction">'.
"\n";
818 if (
$object->paye && $user->hasRight(
'tax',
'charges',
'creer')) {
819 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>';
823 if (
$object->paye == 0 && $user->hasRight(
'tax',
'charges',
'creer')) {
824 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>';
829 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>";
833 if (
$object->paye == 0 && round($resteapayer) <= 0 && $user->hasRight(
'tax',
'charges',
'creer')) {
834 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>';
838 if ($user->hasRight(
'tax',
'charges',
'creer')) {
839 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>";
843 if ($user->hasRight(
'tax',
'charges',
'supprimer') && empty($totalpaid)) {
844 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>';
846 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans(
"DisabledBecausePayments"))).
'">'.$langs->trans(
"Delete").
'</a></div>';
854 if (
GETPOST(
'modelselected')) {
858 if ($action !=
'presend') {
859 print
'<div class="fichecenter"><div class="fichehalfleft">';
860 print
'<a name="builddoc"></a>';
862 $includedocgeneration = 1;
865 if ($includedocgeneration) {
867 $relativepath = $objref.
'/'.$objref.
'.pdf';
868 $filedir =
$conf->tax->dir_output.
'/'.$objref;
869 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
871 $delallowed = $user->hasRight(
'tax',
'charges',
'creer');
872 print $formfile->showdocuments(
'tax', $objref, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
880 print
'</div><div class="fichehalfright">';
893 print
'</div></div>';
897 if (
GETPOST(
'modelselected')) {
903 $defaulttopic =
'InformationMessage';
904 $diroutput =
$conf->tax->dir_output;
905 $trackid =
'sc'.$object->id;
907 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
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.
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)
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...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
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.