30 require
'../../main.inc.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/tva.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/paymentvat.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/vat.lib.php';
40 include_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
44 $langs->loadLangs(array(
'compta',
'banks',
'bills'));
48 $action =
GETPOST(
"action",
"aZ09");
49 $confirm =
GETPOST(
'confirm',
'alpha');
50 $cancel =
GETPOST(
'cancel',
'aZ09');
51 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'myobjectcard';
52 $backtopage =
GETPOST(
'backtopage',
'alpha');
53 $backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
55 $refund =
GETPOST(
"refund",
"int");
56 if (
GETPOSTISSET(
'auto_create_paiement') || $action ===
'add') {
57 $auto_create_payment =
GETPOST(
"auto_create_paiement",
"int");
59 $auto_create_payment = empty($conf->global->CREATE_NEW_VAT_WITHOUT_AUTO_PAYMENT);
70 $object =
new Tva($db);
72 $diroutputmassaction = $conf->tax->dir_output.
'/temp/massgeneration/'.$user->id;
73 $hookmanager->initHooks(array(
'taxvatcard',
'globalcard'));
76 $extrafields->fetch_name_optionals_label($object->table_element);
78 if (empty($action) && empty($id) && empty($ref)) {
87 $permissiontoread = $user->rights->tax->charges->lire;
88 $permissiontoadd = $user->rights->tax->charges->creer;
89 $permissiontodelete = $user->rights->tax->charges->supprimer || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
90 $permissionnote = $user->rights->tax->charges->creer;
91 $permissiondellink = $user->rights->tax->charges->creer;
92 $upload_dir = $conf->tax->multidir_output[isset($object->entity) ? $object->entity : 1].
'/vat';
95 $socid =
GETPOST(
'socid',
'int');
97 $socid = $user->socid;
107 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
112 if ($cancel && !$id) {
113 header(
"Location: list.php");
117 if ($action ==
'setlib' && $user->rights->tax->charges->creer) {
119 $result = $object->setValueFrom(
'label',
GETPOST(
'lib',
'alpha'),
'',
'',
'text',
'', $user,
'TAX_MODIFY');
125 if ($action ==
'setdatev' && $user->rights->tax->charges->creer) {
127 $object->datev = $datev;
128 $result = $object->update($user);
137 if ($action ==
'setmode' && $user->rights->tax->charges->creer) {
139 $result = $object->setPaymentMethods(
GETPOST(
'mode_reglement_id',
'int'));
146 if ($action ==
'setbankaccount' && $user->rights->tax->charges->creer) {
148 $result = $object->setBankAccount(
GETPOST(
'fk_account',
'int'));
155 if ($action ==
'confirm_paid' && $user->rights->tax->charges->creer && $confirm ==
'yes') {
157 $result = $object->setPaid($user);
160 if ($action ==
'reopen' && $user->rights->tax->charges->creer) {
161 $result = $object->fetch($id);
163 $result = $object->setUnpaid($user);
165 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
173 if ($action ==
'add' && !$cancel) {
176 $object->fk_account =
GETPOST(
"accountid",
'int');
177 $object->type_payment =
GETPOST(
"type_payment",
'alphanohtml');
178 $object->num_payment =
GETPOST(
"num_payment",
'alphanohtml');
180 $object->datev = $datev;
181 $object->datep = $datep;
187 $object->amount = $amount;
188 $object->label =
GETPOST(
"label",
'alpha');
189 $object->note =
GETPOST(
"note",
'restricthtml');
190 $object->note_private =
GETPOST(
"note",
'restricthtml');
192 if (empty($object->datep)) {
193 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"DatePayment")),
null,
'errors');
196 if (empty($object->datev)) {
197 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"PeriodEndDate")),
null,
'errors');
200 if (!empty($auto_create_payment) && (empty($object->type_payment) || $object->type_payment < 0)) {
201 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"PaymentMode")),
null,
'errors');
204 if (empty($object->amount)) {
205 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Amount")),
null,
'errors');
208 if (!empty($auto_create_payment) && ($object->fk_account <= 0)) {
209 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"AccountToCredit")),
null,
'errors');
214 $ret = $object->create($user);
220 if (!empty($auto_create_payment) && !$error) {
225 $paiement->chid = $object->id;
226 $paiement->datepaye = $datep;
227 $paiement->amounts = array($object->id=>$amount);
228 $paiement->paiementtype =
GETPOST(
"type_payment",
'alphanohtml');
229 $paiement->num_payment =
GETPOST(
"num_payment",
'alphanohtml');
230 $paiement->note =
GETPOST(
"note",
'restricthtml');
233 $paymentid = $paiement->create($user, (
int)
GETPOST(
'closepaidtva'));
234 if ($paymentid < 0) {
242 $result = $paiement->addPaymentToBank($user,
'payment_vat',
'(VATPayment)',
GETPOST(
'accountid',
'int'),
'',
'');
243 if (!($result > 0)) {
256 header(
"Location: card.php?id=" . $object->id);
264 if ($action ==
'confirm_delete' && $confirm ==
'yes') {
265 $result = $object->fetch($id);
266 $totalpaid = $object->getSommePaiement();
268 if (empty($totalpaid)) {
271 $ret = $object->delete($user);
273 if ($object->fk_bank) {
275 $result = $accountline->fetch($object->fk_bank);
277 $result = $accountline->delete($user);
283 header(
"Location: ".DOL_URL_ROOT.
'/compta/tva/list.php');
286 $object->error = $accountline->error;
299 if ($action ==
'update' && !
GETPOST(
"cancel") && $user->rights->tax->charges->creer) {
302 if (empty($amount)) {
303 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Amount")),
null,
'errors');
305 } elseif (!is_numeric($amount)) {
306 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentities(
"Amount")),
null,
'errors');
309 $result = $object->fetch($id);
311 $object->amount = $amount;
313 $result = $object->update($user);
321 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
325 if ($action ==
'confirm_clone' && $confirm ==
'yes' && ($user->rights->tax->charges->creer)) {
332 if ($object->id > 0) {
333 $object->id = $object->ref =
null;
336 if (
GETPOST(
'clone_label',
'alphanohtml')) {
337 $object->label =
GETPOST(
'clone_label',
'alphanohtml');
339 $object->label = $langs->trans(
"CopyOf").
' '.$object->label;
343 if ($newdateperiod) {
344 $object->datev = $newdateperiod;
348 $id = $object->create($user);
353 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
377 $title = $langs->trans(
"VAT").
" - ".$langs->trans(
"Card");
383 $result = $object->fetch($id);
391 if ($action ==
'create') {
394 if (!empty($conf->use_javascript_ajax)) {
395 print
"\n".
'<script type="text/javascript">';
397 $(document).ready(function () {
398 let onAutoCreatePaiementChange = function () {
399 if($("#auto_create_paiement").is(":checked")) {
400 $("#label_fk_account").addClass("fieldrequired");
401 $("#label_type_payment").addClass("fieldrequired");
402 $(".hide_if_no_auto_create_payment").show();
404 $("#label_fk_account").removeClass("fieldrequired");
405 $("#label_type_payment").removeClass("fieldrequired");
406 $(".hide_if_no_auto_create_payment").hide();
409 $("#radiopayment").click(function() {
410 $("#label").val($(this).data("label"));
412 $("#radiorefund").click(function() {
413 $("#label").val($(this).data("label"));
416 $("#auto_create_paiement").click(function () {
417 onAutoCreatePaiementChange();
419 onAutoCreatePaiementChange();
423 print
'</script>'.
"\n";
426 print
'<form name="add" action="'.$_SERVER[
"PHP_SELF"].
'" name="formvat" method="post">';
427 print
'<input type="hidden" name="token" value="'.newToken().
'">';
428 print
'<input type="hidden" name="action" value="add">';
432 print
'<table class="border centpercent">';
434 print
'<tr><td class="titlefieldcreate fieldrequired">';
438 print
'<div id="selectmethod">';
439 print
'<label for="radiopayment">';
440 print
'<input type="radio" id="radiopayment" data-label="'.$langs->trans(
'VATPayment').
'" class="flat" name="refund" value="0"'.($refund ?
'' :
' checked="checked"').
'>';
442 print $langs->trans(
"Payment");
444 print
' ';
445 print
'<label for="radiorefund">';
446 print
'<input type="radio" id="radiorefund" data-label="'.$langs->trans(
'VATRefund').
'" class="flat" name="refund" value="1"'.($refund ?
' checked="checked"' :
'').
'>';
448 print $langs->trans(
"Refund");
457 $label = $langs->trans(
"VATRefund");
459 $label = $langs->trans(
"VATPayment");
461 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Label").
'</td><td><input class="minwidth300" name="label" id="label" value="'.(
GETPOSTISSET(
"label") ?
GETPOST(
"label",
'', 2) : $label).
'" autofocus></td></tr>';
463 print
'<tr><td class="titlefieldcreate fieldrequired">'.$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo")).
'</td><td>';
464 print
$form->selectDate((
GETPOST(
"datevmonth",
'int') ? $datev : -1),
"datev",
'',
'',
'',
'add', 1, 1);
468 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Amount").
'</td><td><input name="amount" class="right width75" value="'.
GETPOST(
"amount",
"alpha").
'"></td></tr>';
470 print
'<tr><td colspan="2"><hr></td></tr>';
473 print
'<tr><td><label for="auto_create_paiement">'.$langs->trans(
'AutomaticCreationPayment').
'</label></td>';
474 print
'<td><input id="auto_create_paiement" name="auto_create_paiement" type="checkbox" ' . (empty($auto_create_payment) ?
'' :
'checked="checked"') .
' value="1"></td></tr>'.
"\n";
476 print
'<tr class="hide_if_no_auto_create_payment">';
477 print
'<td class="fieldrequired">'.$langs->trans(
"DatePayment").
'</td><td>';
478 print
$form->selectDate($datep,
"datep",
'',
'',
'',
'add', 1, 1);
482 print
'<tr><td class="fieldrequired" id="label_type_payment">'.$langs->trans(
"PaymentMode").
'</td><td>';
483 print
$form->select_types_paiements(
GETPOST(
"type_payment",
'int'),
"type_payment",
'', 0, 1, 0, 0, 1,
'maxwidth500 widthcentpercentminusx', 1);
489 print
'<tr><td class="fieldrequired" id="label_fk_account">'.$langs->trans(
"BankAccount").
'</td><td>';
490 print
img_picto(
'',
'bank_account',
'pictofixedwidth');
491 $form->select_comptes(
GETPOST(
"accountid",
'int'),
"accountid", 0,
"courant=1", 1,
'', 0,
'maxwidth500 widthcentpercentminusx');
496 print
'<tr class="hide_if_no_auto_create_payment"><td>'.$langs->trans(
'Numero');
497 print
' <em>('.$langs->trans(
"ChequeOrTransferNumber").
')</em>';
498 print
'<td><input name="num_payment" type="text" value="'.GETPOST(
"num_payment").
'"></td></tr>'.
"\n";
501 print
'<tr class="hide_if_no_auto_create_payment">';
502 print
'<td class="tdtop">'.$langs->trans(
"Comments").
'</td>';
503 print
'<td class="tdtop"><textarea name="note" wrap="soft" rows="'.ROWS_3.
'" class="quatrevingtpercent">'.
GETPOST(
'note',
'restricthtml').
'</textarea></td>';
508 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
509 print $hookmanager->resPrint;
515 print
'<div class="center">';
516 print
'<div class="hide_if_no_auto_create_payment paddingbottom">';
517 print
'<input type="checkbox" checked value="1" name="closepaidtva"> <span class="">'.$langs->trans(
"ClosePaidVATAutomatically").
'</span>';
521 print
'<input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'">';
522 print
' ';
523 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
533 $totalpaid = $object->getSommePaiement();
536 if ($action ===
'clone') {
537 $formquestion = array(
538 array(
'type' =>
'text',
'name' =>
'clone_label',
'label' => $langs->trans(
"Label"),
'value' => $langs->trans(
"CopyOf").
' '.$object->label),
542 $formquestion[] = array(
'type' =>
'date',
'name' =>
'clone_period',
'label' => $langs->trans(
"PeriodEndDate"),
'value' => -1);
544 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneVAT', $object->ref),
'confirm_clone', $formquestion,
'yes', 1, 240);
547 if ($action ==
'paid') {
548 $text = $langs->trans(
'ConfirmPayVAT');
549 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
'PayVAT'), $text,
"confirm_paid",
'',
'', 2);
552 if ($action ==
'delete') {
553 $text = $langs->trans(
'ConfirmDeleteVAT');
554 print
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'DeleteVAT'), $text,
'confirm_delete',
'',
'', 2);
557 if ($action ==
'edit') {
558 print
"<form name=\"charge\" action=\"".$_SERVER[
"PHP_SELF"].
"?id=$object->id&action=update\" method=\"post\">";
559 print
'<input type="hidden" name="token" value="'.newToken().
'">';
564 $morehtmlref =
'<div class="refidno">';
566 $morehtmlref .=
$form->editfieldkey(
"Label",
'lib', $object->label, $object, $user->rights->tax->charges->creer,
'string',
'', 0, 1);
567 $morehtmlref .=
$form->editfieldval(
"Label",
'lib', $object->label, $object, $user->rights->tax->charges->creer,
'string',
'',
null,
null,
'', 1);
569 $morehtmlref .=
'</div>';
571 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/tva/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
573 $object->totalpaid = $totalpaid;
575 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'',
'');
577 print
'<div class="fichecenter">';
578 print
'<div class="fichehalfleft">';
579 print
'<div class="underbanner clearboth"></div>';
581 print
'<table class="border centpercent">';
592 print
$form->editfieldkey(
$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo")),
'datev', $object->datev, $object, $user->rights->tax->charges->creer,
'day');
594 print
$form->editfieldval(
"PeriodEndDate",
'datev', $object->datev, $object, $user->rights->tax->charges->creer,
'day');
598 if ($action ==
'edit') {
599 print
'<tr><td class="fieldrequired">' . $langs->trans(
"Amount") .
'</td><td><input name="amount" size="10" value="' .
price($object->amount) .
'"></td></tr>';
601 print
'<tr><td>' . $langs->trans(
"Amount") .
'</td><td>' .
price($object->amount) .
'</td></tr>';
606 print
'<table class="nobordernopadding" width="100%"><tr><td>';
607 print $langs->trans(
'PaymentMode');
609 if ($action !=
'editmode') {
610 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>';
612 print
'</tr></table>';
614 if ($action ==
'editmode') {
615 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->type_payment,
'mode_reglement_id');
617 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->type_payment,
'none');
623 print
'<tr><td class="nowrap">';
624 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
625 print $langs->trans(
'BankAccount');
627 if ($action !=
'editbankaccount' && $user->rights->tax->charges->creer) {
628 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>';
630 print
'</tr></table>';
632 if ($action ==
'editbankaccount') {
633 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_account,
'fk_account', 1);
635 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_account,
'none');
643 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
644 print $hookmanager->resPrint;
650 print
'<div class="fichehalfright">';
660 $sql =
"SELECT p.rowid, p.num_paiement as num_payment, p.datep as dp, p.amount,";
661 $sql .=
" c.code as type_code,c.libelle as paiement_type,";
662 $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';
663 $sql .=
" FROM ".MAIN_DB_PREFIX.
"payment_vat as p";
664 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank as b ON p.fk_bank = b.rowid';
665 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank_account as ba ON b.fk_account = ba.rowid';
666 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as c ON p.fk_typepaiement = c.id";
667 $sql .=
", ".MAIN_DB_PREFIX.
"tva as tva";
668 $sql .=
" WHERE p.fk_tva = ".((int) $id);
669 $sql .=
" AND p.fk_tva = tva.rowid";
670 $sql .=
" AND tva.entity IN (".getEntity(
'tax').
")";
671 $sql .=
" ORDER BY dp DESC";
674 $resql = $db->query($sql);
678 $num = $db->num_rows(
$resql);
682 print
'<div class="div-table-responsive-no-min">';
683 print
'<table class="noborder paymenttable">';
684 print
'<tr class="liste_titre">';
685 print
'<td>'.$langs->trans(
"RefPayment").
'</td>';
686 print
'<td>'.$langs->trans(
"Date").
'</td>';
687 print
'<td>'.$langs->trans(
"Type").
'</td>';
689 print
'<td class="liste_titre right">'.$langs->trans(
'BankAccount').
'</td>';
691 print
'<td class="right">'.$langs->trans(
"Amount").
'</td>';
695 $bankaccountstatic =
new Account($db);
697 $objp = $db->fetch_object(
$resql);
699 print
'<tr class="oddeven"><td>';
700 print
'<a href="'.DOL_URL_ROOT.
'/compta/payment_vat/card.php?id='.$objp->rowid.
'">'.
img_object($langs->trans(
"Payment"),
"payment").
' '.$objp->rowid.
'</a>';
702 print
'<td>'.dol_print_date($db->jdate($objp->dp),
'day').
"</td>\n";
703 $labeltype = $langs->trans(
"PaymentType".$objp->type_code) != (
"PaymentType".$objp->type_code) ? $langs->trans(
"PaymentType".$objp->type_code) : $objp->paiement_type;
704 print
"<td>".$labeltype.
' '.$objp->num_payment.
"</td>\n";
706 $bankaccountstatic->id = $objp->baid;
707 $bankaccountstatic->ref = $objp->baref;
708 $bankaccountstatic->label = $objp->baref;
709 $bankaccountstatic->number = $objp->banumber;
710 $bankaccountstatic->currency_code = $objp->bacurrency_code;
713 $bankaccountstatic->account_number = $objp->account_number;
716 $accountingjournal->fetch($objp->fk_accountancy_journal);
717 $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
720 print
'<td class="right">';
721 if ($bankaccountstatic->id) {
722 print $bankaccountstatic->getNomUrl(1,
'transactions');
726 print
'<td class="right"><span class="amount">'.price($objp->amount).
"</span></td>\n";
728 $totalpaid += $objp->amount;
732 print
'<tr class="oddeven"><td><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
733 print
'<td></td><td></td><td></td><td></td>';
737 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AlreadyPaid").
" :</td><td class=\"right\">".
price($totalpaid).
"</td></tr>\n";
738 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AmountExpected").
" :</td><td class=\"right\">".
price($object->amount).
"</td></tr>\n";
740 $resteapayer = $object->amount - $totalpaid;
741 $cssforamountpaymentcomplete =
'amountpaymentcomplete';
743 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"RemainderToPay").
" :</td>";
744 print
'<td class="right'.($resteapayer ?
' amountremaintopay' : (
' '.$cssforamountpaymentcomplete)).
'">'.
price($resteapayer).
"</td></tr>\n";
757 print
'<div class="clearboth"></div>';
761 if ($action ==
'edit') {
762 print
$form->buttonsSaveCancel();
770 print
'<div class="tabsAction">'.
"\n";
772 if ($action !=
'edit') {
774 if ($object->paye && $user->rights->tax->charges->creer) {
775 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/compta/tva/card.php?id='.$object->id.
'&action=reopen&token='.
newToken().
'">'.$langs->trans(
"ReOpen").
"</a></div>";
779 if ($object->paye == 0 && $user->rights->tax->charges->creer) {
780 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/compta/tva/card.php?id='.$object->id.
'&action=edit&token='.
newToken().
'">'.$langs->trans(
"Modify").
"</a></div>";
784 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) {
785 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/compta/paiement_vat.php?id='.$object->id.
'&action=create&token='.
newToken().
'">'.$langs->trans(
"DoPayment").
'</a></div>';
789 if ($object->paye == 0
791 (round($resteapayer) <= 0 && $object->amount > 0)
792 || (round($resteapayer) >= 0 && $object->amount < 0)
794 && $user->rights->tax->charges->creer) {
795 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/compta/tva/card.php?id='.$object->id.
'&token='.
newToken().
'&action=paid">'.$langs->trans(
"ClassifyPaid").
"</a></div>";
799 if ($user->rights->tax->charges->creer) {
800 print
'<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.
'/compta/tva/card.php?id='.$object->id.
'&token='.
newToken().
'&action=clone">'.$langs->trans(
"ToClone").
"</a></div>";
803 if (!empty($user->rights->tax->charges->supprimer) && empty($totalpaid)) {
804 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id='.$object->id.
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
'</a></div>';
806 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans(
"DisabledBecausePayments"))).
'">'.$langs->trans(
"Delete").
'</a></div>';
814 if (
GETPOST(
'modelselected')) {
818 if ($action !=
'presend') {
819 print
'<div class="fichecenter"><div class="fichehalfleft">';
820 print
'<a name="builddoc"></a>';
822 $includedocgeneration = 1;
825 if ($includedocgeneration) {
827 $relativepath = $objref.
'/'.$objref.
'.pdf';
828 $filedir = $conf->tax->dir_output.
'/vat/'.$objref;
829 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
832 $delallowed = $user->rights->tax->charges->creer;
833 print $formfile->showdocuments(
'tax-vat', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
841 print
'</div><div class="fichehalfright">';
854 print
'</div></div>';
858 if (
GETPOST(
'modelselected')) {
864 $defaulttopic =
'InformationMessage';
865 $diroutput = $conf->tax->dir_output;
866 $trackid =
'vat'.$object->id;
868 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage bank accounts.
Class to manage bank transaction lines.
Class to manage accounting accounts.
Class to manage payments of social contributions.
Put here description of your class.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
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.
vat_prepare_head($object)
Prepare array with list of tabs.