29 require
'../../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/tva.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/paymentvat.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/vat.lib.php';
39 include_once DOL_DOCUMENT_ROOT.
'/accountancy/class/accountingjournal.class.php';
43 $langs->loadLangs(array(
'compta',
'banks',
'bills'));
47 $action =
GETPOST(
"action",
"aZ09");
48 $confirm =
GETPOST(
'confirm',
'alpha');
49 $cancel =
GETPOST(
'cancel',
'aZ09');
50 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'myobjectcard';
51 $backtopage =
GETPOST(
'backtopage',
'alpha');
52 $backtopageforcancel =
GETPOST(
'backtopageforcancel',
'alpha');
54 $refund =
GETPOST(
"refund",
"int");
55 if (
GETPOSTISSET(
'auto_create_paiement') || $action ===
'add') {
56 $auto_create_payment =
GETPOST(
"auto_create_paiement",
"int");
58 $auto_create_payment = empty($conf->global->CREATE_NEW_VAT_WITHOUT_AUTO_PAYMENT);
69 $object =
new Tva($db);
71 $diroutputmassaction = $conf->tax->dir_output.
'/temp/massgeneration/'.$user->id;
72 $hookmanager->initHooks(array(
'taxvatcard',
'globalcard'));
75 $extrafields->fetch_name_optionals_label($object->table_element);
77 if (empty($action) && empty($id) && empty($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].
'/vat';
94 $socid =
GETPOST(
'socid',
'int');
96 $socid = $user->socid;
106 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
111 if ($cancel && !$id) {
112 header(
"Location: list.php");
116 if ($action ==
'setlib' && $user->rights->tax->charges->creer) {
118 $result = $object->setValueFrom(
'label',
GETPOST(
'lib',
'alpha'),
'',
'',
'text',
'', $user,
'TAX_MODIFY');
124 if ($action ==
'setdatev' && $user->rights->tax->charges->creer) {
126 $object->datev = $datev;
127 $result = $object->update($user);
136 if ($action ==
'setmode' && $user->rights->tax->charges->creer) {
138 $result = $object->setPaymentMethods(
GETPOST(
'mode_reglement_id',
'int'));
145 if ($action ==
'setbankaccount' && $user->rights->tax->charges->creer) {
147 $result = $object->setBankAccount(
GETPOST(
'fk_account',
'int'));
154 if ($action ==
'confirm_paid' && $user->rights->tax->charges->creer && $confirm ==
'yes') {
156 $result = $object->setPaid($user);
159 if ($action ==
'reopen' && $user->rights->tax->charges->creer) {
160 $result = $object->fetch($id);
162 $result = $object->setUnpaid($user);
164 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
172 if ($action ==
'add' && !$cancel) {
175 $object->fk_account =
GETPOST(
"accountid",
'int');
176 $object->type_payment =
GETPOST(
"type_payment",
'alphanohtml');
177 $object->num_payment =
GETPOST(
"num_payment",
'alphanohtml');
179 $object->datev = $datev;
180 $object->datep = $datep;
186 $object->amount = $amount;
187 $object->label =
GETPOST(
"label",
'alpha');
188 $object->note =
GETPOST(
"note",
'restricthtml');
189 $object->note_private =
GETPOST(
"note",
'restricthtml');
191 if (empty($object->datep)) {
192 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"DatePayment")),
null,
'errors');
195 if (empty($object->datev)) {
196 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"PeriodEndDate")),
null,
'errors');
199 if (!empty($auto_create_payment) && (empty($object->type_payment) || $object->type_payment < 0)) {
200 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"PaymentMode")),
null,
'errors');
203 if (empty($object->amount)) {
204 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Amount")),
null,
'errors');
207 if (!empty($auto_create_payment) && ($object->fk_account <= 0)) {
208 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"AccountToCredit")),
null,
'errors');
213 $ret = $object->create($user);
219 if (!empty($auto_create_payment) && !$error) {
224 $paiement->chid = $object->id;
225 $paiement->datepaye = $datep;
226 $paiement->amounts = array($object->id=>$amount);
227 $paiement->paiementtype =
GETPOST(
"type_payment",
'alphanohtml');
228 $paiement->num_payment =
GETPOST(
"num_payment",
'alphanohtml');
229 $paiement->note =
GETPOST(
"note",
'restricthtml');
232 $paymentid = $paiement->create($user, (
int)
GETPOST(
'closepaidtva'));
233 if ($paymentid < 0) {
241 $result = $paiement->addPaymentToBank($user,
'payment_vat',
'(VATPayment)',
GETPOST(
'accountid',
'int'),
'',
'');
242 if (!($result > 0)) {
255 header(
"Location: card.php?id=" . $object->id);
263 if ($action ==
'confirm_delete' && $confirm ==
'yes') {
264 $result = $object->fetch($id);
265 $totalpaid = $object->getSommePaiement();
267 if (empty($totalpaid)) {
270 $ret = $object->delete($user);
272 if ($object->fk_bank) {
274 $result = $accountline->fetch($object->fk_bank);
276 $result = $accountline->delete($user);
282 header(
"Location: ".DOL_URL_ROOT.
'/compta/tva/list.php');
285 $object->error = $accountline->error;
298 if ($action ==
'update' && !
GETPOST(
"cancel") && $user->rights->tax->charges->creer) {
301 if (empty($amount)) {
302 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Amount")),
null,
'errors');
304 } elseif (!is_numeric($amount)) {
305 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentities(
"Amount")),
null,
'errors');
308 $result = $object->fetch($id);
310 $object->amount = $amount;
312 $result = $object->update($user);
320 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
324 if ($action ==
'confirm_clone' && $confirm ==
'yes' && ($user->rights->tax->charges->creer)) {
331 if ($object->id > 0) {
332 $object->id = $object->ref =
null;
335 if (
GETPOST(
'clone_label',
'alphanohtml')) {
336 $object->label =
GETPOST(
'clone_label',
'alphanohtml');
338 $object->label = $langs->trans(
"CopyOf").
' '.$object->label;
342 if ($newdateperiod) {
343 $object->datev = $newdateperiod;
347 $id = $object->create($user);
352 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
376 $title = $langs->trans(
"VAT").
" - ".$langs->trans(
"Card");
382 $result = $object->fetch($id);
390 if ($action ==
'create') {
393 if (!empty($conf->use_javascript_ajax)) {
394 print
"\n".
'<script type="text/javascript">';
396 $(document).ready(function () {
397 let onAutoCreatePaiementChange = function () {
398 if($("#auto_create_paiement").is(":checked")) {
399 $("#label_fk_account").addClass("fieldrequired");
400 $("#label_type_payment").addClass("fieldrequired");
401 $(".hide_if_no_auto_create_payment").show();
403 $("#label_fk_account").removeClass("fieldrequired");
404 $("#label_type_payment").removeClass("fieldrequired");
405 $(".hide_if_no_auto_create_payment").hide();
408 $("#radiopayment").click(function() {
409 $("#label").val($(this).data("label"));
411 $("#radiorefund").click(function() {
412 $("#label").val($(this).data("label"));
415 $("#auto_create_paiement").click(function () {
416 onAutoCreatePaiementChange();
418 onAutoCreatePaiementChange();
422 print
'</script>'.
"\n";
425 print
'<form name="add" action="'.$_SERVER[
"PHP_SELF"].
'" name="formvat" method="post">';
426 print
'<input type="hidden" name="token" value="'.newToken().
'">';
427 print
'<input type="hidden" name="action" value="add">';
431 print
'<table class="border centpercent">';
433 print
'<tr><td class="titlefieldcreate fieldrequired">';
437 print
'<div id="selectmethod">';
438 print
'<label for="radiopayment">';
439 print
'<input type="radio" id="radiopayment" data-label="'.$langs->trans(
'VATPayment').
'" class="flat" name="refund" value="0"'.($refund ?
'' :
' checked="checked"').
'>';
441 print $langs->trans(
"Payment");
443 print
' ';
444 print
'<label for="radiorefund">';
445 print
'<input type="radio" id="radiorefund" data-label="'.$langs->trans(
'VATRefund').
'" class="flat" name="refund" value="1"'.($refund ?
' checked="checked"' :
'').
'>';
447 print $langs->trans(
"Refund");
456 $label = $langs->trans(
"VATRefund");
458 $label = $langs->trans(
"VATPayment");
460 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>';
462 print
'<tr><td class="titlefieldcreate fieldrequired">'.$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo")).
'</td><td>';
463 print
$form->selectDate((
GETPOST(
"datevmonth",
'int') ? $datev : -1),
"datev",
'',
'',
'',
'add', 1, 1);
467 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Amount").
'</td><td><input name="amount" class="right width75" value="'.
GETPOST(
"amount",
"alpha").
'"></td></tr>';
469 print
'<tr><td colspan="2"><hr></td></tr>';
472 print
'<tr><td><label for="auto_create_paiement">'.$langs->trans(
'AutomaticCreationPayment').
'</label></td>';
473 print
'<td><input id="auto_create_paiement" name="auto_create_paiement" type="checkbox" ' . (empty($auto_create_payment) ?
'' :
'checked="checked"') .
' value="1"></td></tr>'.
"\n";
475 print
'<tr class="hide_if_no_auto_create_payment">';
476 print
'<td class="fieldrequired">'.$langs->trans(
"DatePayment").
'</td><td>';
477 print
$form->selectDate($datep,
"datep",
'',
'',
'',
'add', 1, 1);
481 print
'<tr><td class="fieldrequired" id="label_type_payment">'.$langs->trans(
"PaymentMode").
'</td><td>';
482 $form->select_types_paiements(
GETPOST(
"type_payment",
'int'),
"type_payment",
'', 0, 1, 0, 0, 1,
'maxwidth500 widthcentpercentminusx');
488 print
'<tr><td class="fieldrequired" id="label_fk_account">'.$langs->trans(
"BankAccount").
'</td><td>';
489 print
img_picto(
'',
'bank_account',
'pictofixedwidth');
490 $form->select_comptes(
GETPOST(
"accountid",
'int'),
"accountid", 0,
"courant=1", 1,
'', 0,
'maxwidth500 widthcentpercentminusx');
495 print
'<tr class="hide_if_no_auto_create_payment"><td>'.$langs->trans(
'Numero');
496 print
' <em>('.$langs->trans(
"ChequeOrTransferNumber").
')</em>';
497 print
'<td><input name="num_payment" type="text" value="'.GETPOST(
"num_payment").
'"></td></tr>'.
"\n";
500 print
'<tr class="hide_if_no_auto_create_payment">';
501 print
'<td class="tdtop">'.$langs->trans(
"Comments").
'</td>';
502 print
'<td class="tdtop"><textarea name="note" wrap="soft" rows="'.ROWS_3.
'" class="quatrevingtpercent">'.
GETPOST(
'note',
'restricthtml').
'</textarea></td>';
507 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
508 print $hookmanager->resPrint;
514 print
'<div class="center">';
515 print
'<div class="hide_if_no_auto_create_payment paddingbottom">';
516 print
'<input type="checkbox" checked value="1" name="closepaidtva"> <span class="">'.$langs->trans(
"ClosePaidVATAutomatically").
'</span>';
520 print
'<input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'">';
521 print
' ';
522 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
532 $totalpaid = $object->getSommePaiement();
535 if ($action ===
'clone') {
536 $formquestion = array(
537 array(
'type' =>
'text',
'name' =>
'clone_label',
'label' => $langs->trans(
"Label"),
'value' => $langs->trans(
"CopyOf").
' '.$object->label),
541 $formquestion[] = array(
'type' =>
'date',
'name' =>
'clone_period',
'label' => $langs->trans(
"PeriodEndDate"),
'value' => -1);
543 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneVAT', $object->ref),
'confirm_clone', $formquestion,
'yes', 1, 240);
546 if ($action ==
'paid') {
547 $text = $langs->trans(
'ConfirmPayVAT');
548 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
'PayVAT'), $text,
"confirm_paid",
'',
'', 2);
551 if ($action ==
'delete') {
552 $text = $langs->trans(
'ConfirmDeleteVAT');
553 print
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'DeleteVAT'), $text,
'confirm_delete',
'',
'', 2);
556 if ($action ==
'edit') {
557 print
"<form name=\"charge\" action=\"".$_SERVER[
"PHP_SELF"].
"?id=$object->id&action=update\" method=\"post\">";
558 print
'<input type="hidden" name="token" value="'.newToken().
'">';
563 $morehtmlref =
'<div class="refidno">';
565 $morehtmlref .=
$form->editfieldkey(
"Label",
'lib', $object->label, $object, $user->rights->tax->charges->creer,
'string',
'', 0, 1);
566 $morehtmlref .=
$form->editfieldval(
"Label",
'lib', $object->label, $object, $user->rights->tax->charges->creer,
'string',
'',
null,
null,
'', 1);
568 $morehtmlref .=
'</div>';
570 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/tva/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
572 $object->totalpaid = $totalpaid;
574 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'',
'');
576 print
'<div class="fichecenter">';
577 print
'<div class="fichehalfleft">';
578 print
'<div class="underbanner clearboth"></div>';
580 print
'<table class="border centpercent">';
591 print
$form->editfieldkey(
$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo")),
'datev', $object->datev, $object, $user->rights->tax->charges->creer,
'day');
593 print
$form->editfieldval(
"PeriodEndDate",
'datev', $object->datev, $object, $user->rights->tax->charges->creer,
'day');
597 if ($action ==
'edit') {
598 print
'<tr><td class="fieldrequired">' . $langs->trans(
"Amount") .
'</td><td><input name="amount" size="10" value="' .
price($object->amount) .
'"></td></tr>';
600 print
'<tr><td>' . $langs->trans(
"Amount") .
'</td><td>' .
price($object->amount) .
'</td></tr>';
605 print
'<table class="nobordernopadding" width="100%"><tr><td>';
606 print $langs->trans(
'PaymentMode');
608 if ($action !=
'editmode') {
609 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>';
611 print
'</tr></table>';
613 if ($action ==
'editmode') {
614 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->type_payment,
'mode_reglement_id');
616 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->type_payment,
'none');
622 print
'<tr><td class="nowrap">';
623 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
624 print $langs->trans(
'BankAccount');
626 if ($action !=
'editbankaccount' && $user->rights->tax->charges->creer) {
627 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>';
629 print
'</tr></table>';
631 if ($action ==
'editbankaccount') {
632 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_account,
'fk_account', 1);
634 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_account,
'none');
642 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
643 print $hookmanager->resPrint;
649 print
'<div class="fichehalfright">';
659 $sql =
"SELECT p.rowid, p.num_paiement as num_payment, p.datep as dp, p.amount,";
660 $sql .=
" c.code as type_code,c.libelle as paiement_type,";
661 $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';
662 $sql .=
" FROM ".MAIN_DB_PREFIX.
"payment_vat as p";
663 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank as b ON p.fk_bank = b.rowid';
664 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank_account as ba ON b.fk_account = ba.rowid';
665 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as c ON p.fk_typepaiement = c.id";
666 $sql .=
", ".MAIN_DB_PREFIX.
"tva as tva";
667 $sql .=
" WHERE p.fk_tva = ".((int) $id);
668 $sql .=
" AND p.fk_tva = tva.rowid";
669 $sql .=
" AND tva.entity IN (".getEntity(
'tax').
")";
670 $sql .=
" ORDER BY dp DESC";
673 $resql = $db->query($sql);
677 $num = $db->num_rows(
$resql);
681 print
'<div class="div-table-responsive-no-min">';
682 print
'<table class="noborder paymenttable">';
683 print
'<tr class="liste_titre">';
684 print
'<td>'.$langs->trans(
"RefPayment").
'</td>';
685 print
'<td>'.$langs->trans(
"Date").
'</td>';
686 print
'<td>'.$langs->trans(
"Type").
'</td>';
688 print
'<td class="liste_titre right">'.$langs->trans(
'BankAccount').
'</td>';
690 print
'<td class="right">'.$langs->trans(
"Amount").
'</td>';
694 $bankaccountstatic =
new Account($db);
696 $objp = $db->fetch_object(
$resql);
698 print
'<tr class="oddeven"><td>';
699 print
'<a href="'.DOL_URL_ROOT.
'/compta/payment_vat/card.php?id='.$objp->rowid.
'">'.
img_object($langs->trans(
"Payment"),
"payment").
' '.$objp->rowid.
'</a>';
701 print
'<td>'.dol_print_date($db->jdate($objp->dp),
'day').
"</td>\n";
702 $labeltype = $langs->trans(
"PaymentType".$objp->type_code) != (
"PaymentType".$objp->type_code) ? $langs->trans(
"PaymentType".$objp->type_code) : $objp->paiement_type;
703 print
"<td>".$labeltype.
' '.$objp->num_payment.
"</td>\n";
705 $bankaccountstatic->id = $objp->baid;
706 $bankaccountstatic->ref = $objp->baref;
707 $bankaccountstatic->label = $objp->baref;
708 $bankaccountstatic->number = $objp->banumber;
709 $bankaccountstatic->currency_code = $objp->bacurrency_code;
712 $bankaccountstatic->account_number = $objp->account_number;
715 $accountingjournal->fetch($objp->fk_accountancy_journal);
716 $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
719 print
'<td class="right">';
720 if ($bankaccountstatic->id) {
721 print $bankaccountstatic->getNomUrl(1,
'transactions');
725 print
'<td class="right"><span class="amount">'.price($objp->amount).
"</span></td>\n";
727 $totalpaid += $objp->amount;
731 print
'<tr class="oddeven"><td><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
732 print
'<td></td><td></td><td></td><td></td>';
736 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AlreadyPaid").
" :</td><td class=\"right\">".
price($totalpaid).
"</td></tr>\n";
737 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AmountExpected").
" :</td><td class=\"right\">".
price($object->amount).
"</td></tr>\n";
739 $resteapayer = $object->amount - $totalpaid;
740 $cssforamountpaymentcomplete =
'amountpaymentcomplete';
742 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"RemainderToPay").
" :</td>";
743 print
'<td class="right'.($resteapayer ?
' amountremaintopay' : (
' '.$cssforamountpaymentcomplete)).
'">'.
price($resteapayer).
"</td></tr>\n";
756 print
'<div class="clearboth"></div>';
760 if ($action ==
'edit') {
761 print
$form->buttonsSaveCancel();
769 print
'<div class="tabsAction">'.
"\n";
771 if ($action !=
'edit') {
773 if ($object->paye && $user->rights->tax->charges->creer) {
774 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>";
778 if ($object->paye == 0 && $user->rights->tax->charges->creer) {
779 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>";
783 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) {
784 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>';
788 if ($object->paye == 0
790 (round($resteapayer) <= 0 && $object->amount > 0)
791 || (round($resteapayer) >= 0 && $object->amount < 0)
793 && $user->rights->tax->charges->creer) {
794 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>";
798 if ($user->rights->tax->charges->creer) {
799 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>";
802 if (!empty($user->rights->tax->charges->supprimer) && empty($totalpaid)) {
803 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id='.$object->id.
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
'</a></div>';
805 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans(
"DisabledBecausePayments"))).
'">'.$langs->trans(
"Delete").
'</a></div>';
813 if (
GETPOST(
'modelselected')) {
817 if ($action !=
'presend') {
818 print
'<div class="fichecenter"><div class="fichehalfleft">';
819 print
'<a name="builddoc"></a>';
821 $includedocgeneration = 1;
824 if ($includedocgeneration) {
826 $relativepath = $objref.
'/'.$objref.
'.pdf';
827 $filedir = $conf->tax->dir_output.
'/vat/'.$objref;
828 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
831 $delallowed = $user->rights->tax->charges->creer;
832 print $formfile->showdocuments(
'tax-vat', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
840 print
'</div><div class="fichehalfright">';
853 print
'</div></div>';
857 if (
GETPOST(
'modelselected')) {
863 $defaulttopic =
'InformationMessage';
864 $diroutput = $conf->tax->dir_output;
865 $trackid =
'vat'.$object->id;
867 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';