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(
'amount',
'alphanohtml')) {
340 if (
GETPOST(
'clone_label',
'alphanohtml')) {
341 $object->label =
GETPOST(
'clone_label',
'alphanohtml');
343 $object->label = $langs->trans(
"CopyOf").
' '.$object->label;
347 if ($newdateperiod) {
348 $object->datev = $newdateperiod;
352 $id = $object->create($user);
357 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
381 $title = $langs->trans(
"VAT").
" - ".$langs->trans(
"Card");
387 $result = $object->fetch($id);
395 if ($action ==
'create') {
398 if (!empty($conf->use_javascript_ajax)) {
399 print
"\n".
'<script type="text/javascript">';
401 $(document).ready(function () {
402 let onAutoCreatePaiementChange = function () {
403 if($("#auto_create_paiement").is(":checked")) {
404 $("#label_fk_account").addClass("fieldrequired");
405 $("#label_type_payment").addClass("fieldrequired");
406 $(".hide_if_no_auto_create_payment").show();
408 $("#label_fk_account").removeClass("fieldrequired");
409 $("#label_type_payment").removeClass("fieldrequired");
410 $(".hide_if_no_auto_create_payment").hide();
413 $("#radiopayment").click(function() {
414 $("#label").val($(this).data("label"));
416 $("#radiorefund").click(function() {
417 $("#label").val($(this).data("label"));
420 $("#auto_create_paiement").click(function () {
421 onAutoCreatePaiementChange();
423 onAutoCreatePaiementChange();
427 print
'</script>'.
"\n";
430 print
'<form name="add" action="'.$_SERVER[
"PHP_SELF"].
'" name="formvat" method="post">';
431 print
'<input type="hidden" name="token" value="'.newToken().
'">';
432 print
'<input type="hidden" name="action" value="add">';
436 print
'<table class="border centpercent">';
438 print
'<tr><td class="titlefieldcreate fieldrequired">';
442 print
'<div id="selectmethod">';
443 print
'<label for="radiopayment">';
444 print
'<input type="radio" id="radiopayment" data-label="'.$langs->trans(
'VATPayment').
'" class="flat" name="refund" value="0"'.($refund ?
'' :
' checked="checked"').
'>';
446 print $langs->trans(
"Payment");
448 print
' ';
449 print
'<label for="radiorefund">';
450 print
'<input type="radio" id="radiorefund" data-label="'.$langs->trans(
'VATRefund').
'" class="flat" name="refund" value="1"'.($refund ?
' checked="checked"' :
'').
'>';
452 print $langs->trans(
"Refund");
461 $label = $langs->trans(
"VATRefund");
463 $label = $langs->trans(
"VATPayment");
465 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>';
467 print
'<tr><td class="titlefieldcreate fieldrequired">'.$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo")).
'</td><td>';
468 print
$form->selectDate((
GETPOST(
"datevmonth",
'int') ? $datev : -1),
"datev",
'',
'',
'',
'add', 1, 1);
472 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Amount").
'</td><td><input name="amount" class="right width75" value="'.
GETPOST(
"amount",
"alpha").
'"></td></tr>';
474 print
'<tr><td colspan="2"><hr></td></tr>';
477 print
'<tr><td><label for="auto_create_paiement">'.$langs->trans(
'AutomaticCreationPayment').
'</label></td>';
478 print
'<td><input id="auto_create_paiement" name="auto_create_paiement" type="checkbox" ' . (empty($auto_create_payment) ?
'' :
'checked="checked"') .
' value="1"></td></tr>'.
"\n";
480 print
'<tr class="hide_if_no_auto_create_payment">';
481 print
'<td class="fieldrequired">'.$langs->trans(
"DatePayment").
'</td><td>';
482 print
$form->selectDate($datep,
"datep",
'',
'',
'',
'add', 1, 1);
486 print
'<tr><td class="fieldrequired" id="label_type_payment">'.$langs->trans(
"PaymentMode").
'</td><td>';
487 print
$form->select_types_paiements(
GETPOST(
"type_payment",
'int'),
"type_payment",
'', 0, 1, 0, 0, 1,
'maxwidth500 widthcentpercentminusx', 1);
493 print
'<tr><td class="fieldrequired" id="label_fk_account">'.$langs->trans(
"BankAccount").
'</td><td>';
494 print
img_picto(
'',
'bank_account',
'pictofixedwidth');
495 $form->select_comptes(
GETPOST(
"accountid",
'int'),
"accountid", 0,
"courant=1", 1,
'', 0,
'maxwidth500 widthcentpercentminusx');
500 print
'<tr class="hide_if_no_auto_create_payment"><td>'.$langs->trans(
'Numero');
501 print
' <em>('.$langs->trans(
"ChequeOrTransferNumber").
')</em>';
502 print
'<td><input name="num_payment" type="text" value="'.GETPOST(
"num_payment").
'"></td></tr>'.
"\n";
505 print
'<tr class="hide_if_no_auto_create_payment">';
506 print
'<td class="tdtop">'.$langs->trans(
"Comments").
'</td>';
507 print
'<td class="tdtop"><textarea name="note" wrap="soft" rows="'.ROWS_3.
'" class="quatrevingtpercent">'.
GETPOST(
'note',
'restricthtml').
'</textarea></td>';
512 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
513 print $hookmanager->resPrint;
519 print
'<div class="center">';
520 print
'<div class="hide_if_no_auto_create_payment paddingbottom">';
521 print
'<input type="checkbox" checked value="1" name="closepaidtva"> <span class="">'.$langs->trans(
"ClosePaidVATAutomatically").
'</span>';
525 print
'<input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'">';
526 print
' ';
527 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
537 $totalpaid = $object->getSommePaiement();
540 if ($action ===
'clone') {
541 $formquestion = array(
542 array(
'type' =>
'text',
'name' =>
'clone_label',
'label' => $langs->trans(
"Label"),
'value' => $langs->trans(
"CopyOf").
' '.$object->label),
546 $formquestion[] = array(
'type' =>
'date',
'name' =>
'clone_period',
'label' => $langs->trans(
"PeriodEndDate"),
'value' => -1);
547 $formquestion[] = array(
'type' =>
'text',
'name' =>
'amount',
'label' => $langs->trans(
"Amount"),
'value' =>
price($object->amount),
'morecss' =>
'width100');
549 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneVAT', $object->ref),
'confirm_clone', $formquestion,
'yes', 1, 240);
552 if ($action ==
'paid') {
553 $text = $langs->trans(
'ConfirmPayVAT');
554 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
'PayVAT'), $text,
"confirm_paid",
'',
'', 2);
557 if ($action ==
'delete') {
558 $text = $langs->trans(
'ConfirmDeleteVAT');
559 print
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'DeleteVAT'), $text,
'confirm_delete',
'',
'', 2);
562 if ($action ==
'edit') {
563 print
"<form name=\"charge\" action=\"".$_SERVER[
"PHP_SELF"].
"?id=$object->id&action=update\" method=\"post\">";
564 print
'<input type="hidden" name="token" value="'.newToken().
'">';
569 $morehtmlref =
'<div class="refidno">';
571 $morehtmlref .=
$form->editfieldkey(
"Label",
'lib', $object->label, $object, $user->rights->tax->charges->creer,
'string',
'', 0, 1);
572 $morehtmlref .=
$form->editfieldval(
"Label",
'lib', $object->label, $object, $user->rights->tax->charges->creer,
'string',
'',
null,
null,
'', 1);
574 $morehtmlref .=
'</div>';
576 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/tva/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
578 $object->totalpaid = $totalpaid;
580 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'',
'');
582 print
'<div class="fichecenter">';
583 print
'<div class="fichehalfleft">';
584 print
'<div class="underbanner clearboth"></div>';
586 print
'<table class="border centpercent">';
597 print
$form->editfieldkey(
$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo")),
'datev', $object->datev, $object, $user->rights->tax->charges->creer,
'day');
599 print
$form->editfieldval(
"PeriodEndDate",
'datev', $object->datev, $object, $user->rights->tax->charges->creer,
'day');
603 if ($action ==
'edit') {
604 print
'<tr><td class="fieldrequired">' . $langs->trans(
"Amount") .
'</td><td><input name="amount" size="10" value="' .
price($object->amount) .
'"></td></tr>';
606 print
'<tr><td>' . $langs->trans(
"Amount") .
'</td><td>' .
price($object->amount) .
'</td></tr>';
611 print
'<table class="nobordernopadding" width="100%"><tr><td>';
612 print $langs->trans(
'PaymentMode');
614 if ($action !=
'editmode') {
615 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>';
617 print
'</tr></table>';
619 if ($action ==
'editmode') {
620 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->type_payment,
'mode_reglement_id');
622 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->type_payment,
'none');
628 print
'<tr><td class="nowrap">';
629 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
630 print $langs->trans(
'BankAccount');
632 if ($action !=
'editbankaccount' && $user->rights->tax->charges->creer) {
633 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>';
635 print
'</tr></table>';
637 if ($action ==
'editbankaccount') {
638 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_account,
'fk_account', 1);
640 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_account,
'none');
648 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
649 print $hookmanager->resPrint;
655 print
'<div class="fichehalfright">';
665 $sql =
"SELECT p.rowid, p.num_paiement as num_payment, p.datep as dp, p.amount,";
666 $sql .=
" c.code as type_code,c.libelle as paiement_type,";
667 $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';
668 $sql .=
" FROM ".MAIN_DB_PREFIX.
"payment_vat as p";
669 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank as b ON p.fk_bank = b.rowid';
670 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank_account as ba ON b.fk_account = ba.rowid';
671 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as c ON p.fk_typepaiement = c.id";
672 $sql .=
", ".MAIN_DB_PREFIX.
"tva as tva";
673 $sql .=
" WHERE p.fk_tva = ".((int) $id);
674 $sql .=
" AND p.fk_tva = tva.rowid";
675 $sql .=
" AND tva.entity IN (".getEntity(
'tax').
")";
676 $sql .=
" ORDER BY dp DESC";
679 $resql = $db->query(
$sql);
683 $num = $db->num_rows($resql);
687 print
'<div class="div-table-responsive-no-min">';
688 print
'<table class="noborder paymenttable">';
689 print
'<tr class="liste_titre">';
690 print
'<td>'.$langs->trans(
"RefPayment").
'</td>';
691 print
'<td>'.$langs->trans(
"Date").
'</td>';
692 print
'<td>'.$langs->trans(
"Type").
'</td>';
694 print
'<td class="liste_titre right">'.$langs->trans(
'BankAccount').
'</td>';
696 print
'<td class="right">'.$langs->trans(
"Amount").
'</td>';
700 $bankaccountstatic =
new Account($db);
702 $objp = $db->fetch_object($resql);
704 print
'<tr class="oddeven"><td>';
705 print
'<a href="'.DOL_URL_ROOT.
'/compta/payment_vat/card.php?id='.$objp->rowid.
'">'.
img_object($langs->trans(
"Payment"),
"payment").
' '.$objp->rowid.
'</a>';
707 print
'<td>'.dol_print_date($db->jdate($objp->dp),
'day').
"</td>\n";
708 $labeltype = $langs->trans(
"PaymentType".$objp->type_code) != (
"PaymentType".$objp->type_code) ? $langs->trans(
"PaymentType".$objp->type_code) : $objp->paiement_type;
709 print
"<td>".$labeltype.
' '.$objp->num_payment.
"</td>\n";
711 $bankaccountstatic->id = $objp->baid;
712 $bankaccountstatic->ref = $objp->baref;
713 $bankaccountstatic->label = $objp->baref;
714 $bankaccountstatic->number = $objp->banumber;
715 $bankaccountstatic->currency_code = $objp->bacurrency_code;
718 $bankaccountstatic->account_number = $objp->account_number;
721 $accountingjournal->fetch($objp->fk_accountancy_journal);
722 $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
725 print
'<td class="right">';
726 if ($bankaccountstatic->id) {
727 print $bankaccountstatic->getNomUrl(1,
'transactions');
731 print
'<td class="right"><span class="amount">'.price($objp->amount).
"</span></td>\n";
733 $totalpaid += $objp->amount;
737 print
'<tr class="oddeven"><td><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
738 print
'<td></td><td></td><td></td><td></td>';
742 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AlreadyPaid").
" :</td><td class=\"right\">".
price($totalpaid).
"</td></tr>\n";
743 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AmountExpected").
" :</td><td class=\"right\">".
price($object->amount).
"</td></tr>\n";
745 $resteapayer = $object->amount - $totalpaid;
746 $cssforamountpaymentcomplete =
'amountpaymentcomplete';
748 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"RemainderToPay").
" :</td>";
749 print
'<td class="right'.($resteapayer ?
' amountremaintopay' : (
' '.$cssforamountpaymentcomplete)).
'">'.
price($resteapayer).
"</td></tr>\n";
762 print
'<div class="clearboth"></div>';
766 if ($action ==
'edit') {
767 print
$form->buttonsSaveCancel();
775 print
'<div class="tabsAction">'.
"\n";
777 if ($action !=
'edit') {
779 if ($object->paye && $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=reopen&token='.
newToken().
'">'.$langs->trans(
"ReOpen").
"</a></div>";
784 if ($object->paye == 0 && $user->rights->tax->charges->creer) {
785 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>";
789 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) {
790 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>';
794 if ($object->paye == 0
796 (round($resteapayer) <= 0 && $object->amount > 0)
797 || (round($resteapayer) >= 0 && $object->amount < 0)
799 && $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=paid">'.$langs->trans(
"ClassifyPaid").
"</a></div>";
804 if ($user->rights->tax->charges->creer) {
805 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>";
808 if (!empty($user->rights->tax->charges->supprimer) && empty($totalpaid)) {
809 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id='.$object->id.
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
'</a></div>';
811 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans(
"DisabledBecausePayments"))).
'">'.$langs->trans(
"Delete").
'</a></div>';
819 if (
GETPOST(
'modelselected')) {
823 if ($action !=
'presend') {
824 print
'<div class="fichecenter"><div class="fichehalfleft">';
825 print
'<a name="builddoc"></a>';
827 $includedocgeneration = 1;
830 if ($includedocgeneration) {
832 $relativepath = $objref.
'/'.$objref.
'.pdf';
833 $filedir = $conf->tax->dir_output.
'/vat/'.$objref;
834 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
837 $delallowed = $user->rights->tax->charges->creer;
838 print $formfile->showdocuments(
'tax-vat', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
846 print
'</div><div class="fichehalfright">';
859 print
'</div></div>';
863 if (
GETPOST(
'modelselected')) {
869 $defaulttopic =
'InformationMessage';
870 $diroutput = $conf->tax->dir_output;
871 $trackid =
'vat'.$object->id;
873 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';