29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formsocialcontrib.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/paymentsocialcontribution.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/tax.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
39if (isModEnabled(
'project')) {
40 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
41 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
43if (isModEnabled(
'accounting')) {
44 include_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
48$langs->loadLangs(array(
'compta',
'bills',
'banks',
'hrm'));
52$action =
GETPOST(
'action',
'aZ09');
53$confirm =
GETPOST(
'confirm',
'alpha');
54$cancel =
GETPOST(
'cancel',
'aZ09');
55$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'myobjectcard';
56$backtopage =
GETPOST(
'backtopage',
'alpha');
57$backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
58$lineid =
GETPOST(
'lineid',
'int');
60$fk_project = (
GETPOST(
'fk_project') ?
GETPOST(
'fk_project',
'int') : 0);
64$label =
GETPOST(
'label',
'alpha');
65$actioncode =
GETPOST(
'actioncode');
66$fk_user =
GETPOST(
'userid',
'int') > 0 ?
GETPOST(
'userid',
'int') : 0;
69$hookmanager->initHooks(array(
'taxcard',
'globalcard'));
74$diroutputmassaction = $conf->tax->dir_output.
'/temp/massgeneration/'.$user->id;
75$hookmanager->initHooks(array(
'taxsocialcontributioncard',
'globalcard'));
77if (empty($action) && empty($id) && empty($ref)) {
83 $object->fetch($id, $ref);
86$permissiontoread = $user->rights->tax->charges->lire;
87$permissiontoadd = $user->rights->tax->charges->creer;
88$permissiontodelete = $user->rights->tax->charges->supprimer || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
89$permissionnote = $user->rights->tax->charges->creer;
90$permissiondellink = $user->rights->tax->charges->creer;
91$upload_dir = $conf->tax->multidir_output[isset($object->entity) ? $object->entity : 1];
94$socid =
GETPOST(
'socid',
'int');
96 $socid = $user->socid;
98$result =
restrictedArea($user,
'tax', $object->id,
'chargesociales',
'charges');
106$parameters = array(
'socid' => $socid);
107$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
112if (empty($reshook)) {
114 if ($action ==
'confirm_paid' && $permissiontoadd && $confirm ==
'yes') {
115 $result = $object->setPaid($user);
118 if ($action ==
'reopen' && $user->rights->tax->charges->creer) {
120 $result = $object->setUnpaid($user);
122 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
131 if ($action ==
'classin' && $permissiontoadd) {
132 $object->setProject(
GETPOST(
'fk_project'));
135 if ($action ==
'setfk_user' && $permissiontoadd) {
136 $object->fk_user = $fk_user;
137 $object->update($user);
140 if ($action ==
'setlib' && $permissiontoadd) {
141 $result = $object->setValueFrom(
'libelle',
GETPOST(
'lib'),
'',
'',
'text',
'', $user,
'TAX_MODIFY');
148 if ($action ==
'setmode' && $permissiontoadd) {
149 $result = $object->setPaymentMethods(
GETPOST(
'mode_reglement_id',
'int'));
156 if ($action ==
'setbankaccount' && $permissiontoadd) {
157 $result = $object->setBankAccount(
GETPOST(
'fk_account',
'int'));
164 if ($action ==
'confirm_delete' && $permissiontodelete && $confirm ==
'yes') {
165 $totalpaid = $object->getSommePaiement();
166 if (empty($totalpaid)) {
167 $result = $object->delete($user);
169 header(
"Location: list.php");
181 if ($action ==
'add' && $permissiontoadd) {
185 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Date")),
null,
'errors');
187 } elseif (!$dateperiod) {
188 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Period")),
null,
'errors');
190 } elseif (!($actioncode > 0)) {
191 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Type")),
null,
'errors');
193 } elseif (empty($amount)) {
194 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Amount")),
null,
'errors');
196 } elseif (!is_numeric($amount)) {
197 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentities(
"Amount")),
null,
'errors');
200 $object->type = $actioncode;
201 $object->label =
GETPOST(
'label',
'alpha');
202 $object->date_ech = $dateech;
203 $object->periode = $dateperiod;
204 $object->amount = $amount;
205 $object->fk_user = $fk_user;
206 $object->mode_reglement_id = (int)
GETPOST(
'mode_reglement_id',
'int');
207 $object->fk_account = (int)
GETPOST(
'fk_account',
'int');
208 $object->fk_project = (int)
GETPOST(
'fk_project',
'int');
210 $id = $object->create($user);
219 if ($action ==
'update' && !$cancel && $permissiontoadd) {
223 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Date")),
null,
'errors');
225 } elseif (!$dateperiod) {
226 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Period")),
null,
'errors');
228 } elseif (empty($amount)) {
229 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Amount")),
null,
'errors');
231 } elseif (!is_numeric($amount)) {
232 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentities(
"Amount")),
null,
'errors');
235 $result = $object->fetch($id);
237 $object->date_ech = $dateech;
238 $object->periode = $dateperiod;
239 $object->amount = $amount;
240 $object->fk_user = $fk_user;
242 $result = $object->update($user);
250 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
254 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontoadd) {
257 $originalId = $object->id;
259 if ($object->id > 0) {
260 $object->id = $object->ref =
null;
262 if (
GETPOST(
'amount',
'alphanohtml')) {
266 if (
GETPOST(
'clone_label',
'alphanohtml')) {
267 $object->label =
GETPOST(
'clone_label',
'alphanohtml');
269 $object->label = $langs->trans(
"CopyOf").
' '.$object->label;
272 if (
GETPOST(
'clone_for_next_month',
'int')) {
279 if ($newdateperiod) {
280 $object->periode = $newdateperiod;
281 if (empty($newdateech)) {
282 $object->date_ech = $object->periode;
286 $object->date_ech = $newdateech;
287 if (empty($newdateperiod)) {
290 $object->periode = $object->date_ech;
295 $resultcheck = $object->check();
297 $id = $object->create($user);
302 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
318 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
326$form =
new Form($db);
329$bankaccountstatic =
new Account($db);
330if (isModEnabled(
'project')) {
336$title = $langs->trans(
"SocialContribution").
' - '.$langs->trans(
"Card");
337$help_url =
'EN:Module_Taxes_and_social_contributions|FR:Module_Taxes_et_charges_spéciales|ES:Módulo Impuestos y cargas sociales (IVA, impuestos)';
342if ($action ==
'create') {
345 print
'<form name="charge" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
346 print
'<input type="hidden" name="token" value="'.newToken().
'">';
347 print
'<input type="hidden" name="action" value="add">';
351 print
'<table class="border centpercent tableforfieldcreate">';
355 print
'<td class="titlefieldcreate fieldrequired">';
356 print $langs->trans(
"Label");
358 print
'<td><input type="text" name="label" class="flat minwidth300" value="'.dol_escape_htmltag(
GETPOST(
'label',
'alpha')).
'" autofocus></td>';
363 print
'<td class="fieldrequired">';
364 print $langs->trans(
"Type");
367 $formsocialcontrib->select_type_socialcontrib(
GETPOST(
"actioncode",
'alpha') ?
GETPOST(
"actioncode",
'alpha') :
'',
'actioncode', 1);
373 print
'<td class="fieldrequired">';
374 print $langs->trans(
"Date");
377 print $form->selectDate(!empty($dateech) ? $dateech :
'-1',
'ech', 0, 0, 0,
'charge', 1, 1);
383 print
'<td class="fieldrequired">';
384 print $form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo"));
387 print $form->selectDate(!empty($dateperiod) ? $dateperiod :
'-1',
'period', 0, 0, 0,
'charge', 1);
393 print
'<td class="fieldrequired">';
394 print $langs->trans(
"Amount");
396 print
'<td><input type="text" size="6" name="amount" class="flat" value="'.dol_escape_htmltag(
GETPOST(
'amount',
'alpha')).
'"></td>';
401 print $langs->trans(
'Employee');
403 print
'<td>'.img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
'',
'userid', 1).
'</td></tr>';
406 if (isModEnabled(
'project')) {
410 $langs->load(
"projects");
412 print
'<tr><td>'.$langs->trans(
"Project").
'</td><td>';
414 print
img_picto(
'',
'project',
'class="pictofixedwidth"').$formproject->select_projects(-1, $fk_project,
'fk_project', 0, 0, 1, 1, 0, 0, 0,
'', 1);
420 print
'<tr><td>'.$langs->trans(
'DefaultPaymentMode').
'</td><td colspan="2">';
421 $form->select_types_paiements(
GETPOST(
'mode_reglement_id',
'int'),
'mode_reglement_id');
425 if (isModEnabled(
"banque")) {
426 print
'<tr><td>'.$langs->trans(
'DefaultBankAccount').
'</td><td colspan="2">';
427 print
img_picto(
'',
'bank_account',
'class="pictofixedwidth"').$form->select_comptes(
GETPOST(
'fk_account',
'int'),
'fk_account', 0,
'', 2,
'', 0,
'', 1);
435 print
'<div class="center">';
436 print
'<input type="submit" class="button button-add" value="'.$langs->trans(
"Add").
'">';
437 print
' ';
438 print
'<input type="button" class="button button-cancel" value="'.$langs->trans(
"Cancel").
'" onClick="history.go(-1)">';
451 $totalpaid = $object->getSommePaiement();
454 if ($action ===
'clone') {
455 $formquestion = array(
456 array(
'type' =>
'text',
'name' =>
'clone_label',
'label' => $langs->trans(
"Label"),
'value' => $langs->trans(
"CopyOf").
' '.$object->label,
'tdclass'=>
'fieldrequired'),
458 if (!empty($conf->global->TAX_ADD_CLONE_FOR_NEXT_MONTH_CHECKBOX)) {
459 $formquestion[] = array(
'type' =>
'checkbox',
'name' =>
'clone_for_next_month',
'label' => $langs->trans(
"CloneTaxForNextMonth"),
'value' => 1);
461 $formquestion[] = array(
'type' =>
'date',
'datenow'=>1,
'name' =>
'clone_date_ech',
'label' => $langs->trans(
"Date"),
'value' => -1);
462 $formquestion[] = array(
'type' =>
'date',
'name' =>
'clone_period',
'label' => $langs->trans(
"PeriodEndDate"),
'value' => -1);
463 $formquestion[] = array(
'type' =>
'text',
'name' =>
'amount',
'label' => $langs->trans(
"Amount"),
'value' =>
price($object->amount),
'morecss' =>
'width100');
466 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneTax', $object->ref),
'confirm_clone', $formquestion,
'yes', 1, 280);
470 if ($action ==
'paid') {
471 $text = $langs->trans(
'ConfirmPaySocialContribution');
472 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
'PaySocialContribution'), $text,
"confirm_paid",
'',
'', 2);
476 if ($action ==
'delete') {
477 $text = $langs->trans(
'ConfirmDeleteSocialContribution');
478 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'DeleteSocialContribution'), $text,
'confirm_delete',
'',
'', 2);
481 if ($action ==
'edit') {
482 print
'<form name="charge" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="POST">';
483 print
'<input type="hidden" name="token" value="'.newToken().
'">';
484 print
'<input type="hidden" name="action" value="update">';
487 $parameters = array(
'formConfirm' => $formconfirm,
'lineid' => $lineid);
488 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
489 if (empty($reshook)) {
490 $formconfirm .= $hookmanager->resPrint;
491 } elseif ($reshook > 0) {
492 $formconfirm = $hookmanager->resPrint;
498 print
dol_get_fiche_head($head,
'card', $langs->trans(
"SocialContribution"), -1,
'bill', 0,
'',
'', 0,
'', 1);
505 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/sociales/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
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 && $object->fk_user > 0) {
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 ($object->fk_user > 0) {
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>';
544 if (isModEnabled(
'project')) {
545 $langs->load(
"projects");
546 $morehtmlref .=
'<br>';
547 if ($permissiontoadd) {
548 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
549 if ($action !=
'classify') {
550 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.newToken().
'&id='.((int) $object->id).
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
552 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action ==
'classify' ?
'fk_project' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
554 if (!empty($object->fk_project)) {
556 $proj->fetch($object->fk_project);
557 $morehtmlref .= $proj->getNomUrl(1);
559 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
564 $morehtmlref .=
'</div>';
568 $object->totalpaid = $totalpaid;
570 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'', $morehtmlright);
572 print
'<div class="fichecenter">';
573 print
'<div class="fichehalfleft">';
574 print
'<div class="underbanner clearboth"></div>';
576 print
'<table class="border centpercent tableforfield">';
579 print
'<tr><td class="titlefield">';
580 print $langs->trans(
"Type").
"</td><td>".$object->type_label.
"</td>";
584 if ($action ==
'edit') {
585 print
'<tr><td>'.$langs->trans(
"Date").
"</td><td>";
586 print $form->selectDate($object->date_ech,
'ech', 0, 0, 0,
'charge', 1, 1);
589 print
"<tr><td>".$langs->trans(
"Date").
"</td><td>".
dol_print_date($object->date_ech,
'day').
"</td></tr>";
593 print
"<tr><td>".$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo")).
"</td>";
595 if ($action ==
'edit') {
596 print $form->selectDate($object->periode,
'period', 0, 0, 0,
'charge', 1);
603 if ($action ==
'edit') {
604 print
'<tr><td>'.$langs->trans(
"AmountTTC").
"</td><td>";
605 print
'<input type="text" name="amount" size="12" class="flat" value="'.price($object->amount).
'">';
608 print
'<tr><td>'.$langs->trans(
"AmountTTC").
'</td><td><span class="amount">'.
price($object->amount, 0, $langs, 1, -1, -1, $conf->currency).
'</span></td></tr>';
613 print
'<table class="nobordernopadding" width="100%"><tr><td>';
614 print $langs->trans(
'DefaultPaymentMode');
616 if ($action !=
'editmode') {
617 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>';
619 print
'</tr></table>';
621 if ($action ==
'editmode') {
622 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->mode_reglement_id,
'mode_reglement_id',
'', 1, 1);
624 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->mode_reglement_id,
'none');
629 if (isModEnabled(
"banque")) {
630 print
'<tr><td class="nowrap">';
631 print
'<table class="centpercent nobordernopadding"><tr><td class="nowrap">';
632 print $langs->trans(
'DefaultBankAccount');
634 if ($action !=
'editbankaccount' && $user->rights->tax->charges->creer) {
635 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>';
637 print
'</tr></table>';
639 if ($action ==
'editbankaccount') {
640 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_account,
'fk_account', 1);
642 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_account,
'none');
649 $parameters = array();
650 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
651 print $hookmanager->resPrint;
656 print
'<div class="fichehalfright">';
658 print
'<div class="underbanner clearboth"></div>';
661 if (isModEnabled(
"banque")) {
668 $sql =
"SELECT p.rowid, p.num_paiement as num_payment, p.datep as dp, p.amount,";
669 $sql .=
" c.code as type_code,c.libelle as paiement_type,";
670 $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';
671 $sql .=
" FROM ".MAIN_DB_PREFIX.
"paiementcharge as p";
672 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank as b ON p.fk_bank = b.rowid';
673 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank_account as ba ON b.fk_account = ba.rowid';
674 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as c ON p.fk_typepaiement = c.id";
675 $sql .=
", ".MAIN_DB_PREFIX.
"chargesociales as cs";
676 $sql .=
" WHERE p.fk_charge = ".((int) $id);
677 $sql .=
" AND p.fk_charge = cs.rowid";
678 $sql .=
" AND cs.entity IN (".getEntity(
'sc').
")";
679 $sql .=
" ORDER BY dp DESC";
682 $resql = $db->query($sql);
686 $num = $db->num_rows($resql);
690 print
'<div class="div-table-responsive-no-min">';
691 print
'<table class="noborder paymenttable">';
692 print
'<tr class="liste_titre">';
693 print
'<td>'.$langs->trans(
"RefPayment").
'</td>';
694 print
'<td>'.$langs->trans(
"Date").
'</td>';
695 print
'<td>'.$langs->trans(
"Type").
'</td>';
696 if (isModEnabled(
"banque")) {
697 print
'<td class="liste_titre right">'.$langs->trans(
'BankAccount').
'</td>';
699 print
'<td class="right">'.$langs->trans(
"Amount").
'</td>';
706 $objp = $db->fetch_object($resql);
708 $paymentsocialcontributiontmp->id = $objp->rowid;
709 $paymentsocialcontributiontmp->ref = $objp->rowid;
710 $paymentsocialcontributiontmp->datep = $db->jdate($objp->dp);
712 print
'<tr class="oddeven"><td>';
713 print $paymentsocialcontributiontmp->getNomUrl(1);
716 print
'<td>'.dol_print_date($db->jdate($objp->dp),
'day').
"</td>\n";
717 $labeltype = $langs->trans(
"PaymentType".$objp->type_code) != (
"PaymentType".$objp->type_code) ? $langs->trans(
"PaymentType".$objp->type_code) : $objp->paiement_type;
718 print
"<td>".$labeltype.
' '.$objp->num_payment.
"</td>\n";
719 if (isModEnabled(
"banque")) {
720 $bankaccountstatic->id = $objp->baid;
721 $bankaccountstatic->ref = $objp->baref;
722 $bankaccountstatic->label = $objp->baref;
723 $bankaccountstatic->number = $objp->banumber;
724 $bankaccountstatic->currency_code = $objp->bacurrency_code;
726 if (isModEnabled(
'accounting')) {
727 $bankaccountstatic->account_number = $objp->account_number;
730 $accountingjournal->fetch($objp->fk_accountancy_journal);
731 $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
734 print
'<td class="right">';
735 if ($bankaccountstatic->id) {
736 print $bankaccountstatic->getNomUrl(1,
'transactions');
740 print
'<td class="right"><span class="amount">'.price($objp->amount).
"</span></td>\n";
742 $totalpaid += $objp->amount;
746 print
'<tr class="oddeven"><td><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
747 print
'<td></td><td></td><td></td><td></td>';
751 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AlreadyPaid").
' :</td><td class="right">'.
price($totalpaid).
"</td></tr>\n";
752 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AmountExpected").
' :</td><td class="right">'.
price($object->amount).
"</td></tr>\n";
754 $resteapayer = $object->amount - $totalpaid;
755 $cssforamountpaymentcomplete =
'amountpaymentcomplete';
757 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"RemainderToPay").
" :</td>";
758 print
'<td class="right'.($resteapayer ?
' amountremaintopay' : (
' '.$cssforamountpaymentcomplete)).
'">'.
price($resteapayer).
"</td></tr>\n";
771 print
'<div class="clearboth"></div>';
775 if ($action ==
'edit') {
776 print $form->buttonsSaveCancel();
785 if ($action !=
'edit') {
786 print
'<div class="tabsAction">'.
"\n";
789 if ($object->paye && $user->rights->tax->charges->creer) {
790 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>';
794 if ($object->paye == 0 && $user->rights->tax->charges->creer) {
795 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>';
799 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) {
800 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>";
804 if ($object->paye == 0 && round($resteapayer) <= 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=paid&token='.newToken().
'">'.$langs->trans(
"ClassifyPaid").
'</a></div>';
809 if ($user->rights->tax->charges->creer) {
810 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>";
814 if ($user->rights->tax->charges->supprimer && empty($totalpaid)) {
815 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>';
817 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans(
"DisabledBecausePayments"))).
'">'.$langs->trans(
"Delete").
'</a></div>';
825 if (
GETPOST(
'modelselected')) {
829 if ($action !=
'presend') {
830 print
'<div class="fichecenter"><div class="fichehalfleft">';
831 print
'<a name="builddoc"></a>';
833 $includedocgeneration = 1;
836 if ($includedocgeneration) {
838 $relativepath = $objref.
'/'.$objref.
'.pdf';
839 $filedir = $conf->tax->dir_output.
'/'.$objref;
840 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
843 $delallowed = $user->rights->tax->charges->creer;
844 print $formfile->showdocuments(
'tax', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
852 print
'</div><div class="fichehalfright">';
865 print
'</div></div>';
869 if (
GETPOST(
'modelselected')) {
875 $defaulttopic =
'InformationMessage';
876 $diroutput = $conf->tax->dir_output;
877 $trackid =
'sc'.$object->id;
879 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
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.
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='', $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_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.
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).
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
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.