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 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
80 $search_all =
GETPOST(
"search_all",
'alpha');
82 foreach ($object->fields as $key => $val) {
83 if (
GETPOST(
'search_'.$key,
'alpha')) {
84 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
88 if (empty($action) && empty($id) && empty($ref)) {
97 $permissiontoread = $user->rights->tax->charges->lire;
98 $permissiontoadd = $user->rights->tax->charges->creer;
99 $permissiontodelete = $user->rights->tax->charges->supprimer || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
100 $permissionnote = $user->rights->tax->charges->creer;
101 $permissiondellink = $user->rights->tax->charges->creer;
102 $upload_dir = $conf->tax->multidir_output[isset($object->entity) ? $object->entity : 1].
'/vat';
105 $socid =
GETPOST(
'socid',
'int');
107 $socid = $user->socid;
116 $parameters = array();
117 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
122 if ($cancel && !$id) {
123 header(
"Location: list.php");
127 if ($action ==
'setlib' && $user->rights->tax->charges->creer) {
129 $result = $object->setValueFrom(
'label',
GETPOST(
'lib',
'alpha'),
'',
'',
'text',
'', $user,
'TAX_MODIFY');
135 if ($action ==
'setdatev' && $user->rights->tax->charges->creer) {
137 $object->datev = $datev;
138 $result = $object->update($user);
147 if ($action ==
'setmode' && $user->rights->tax->charges->creer) {
149 $result = $object->setPaymentMethods(
GETPOST(
'mode_reglement_id',
'int'));
156 if ($action ==
'setbankaccount' && $user->rights->tax->charges->creer) {
158 $result = $object->setBankAccount(
GETPOST(
'fk_account',
'int'));
165 if ($action ==
'confirm_paid' && $user->rights->tax->charges->creer && $confirm ==
'yes') {
167 $result = $object->setPaid($user);
170 if ($action ==
'reopen' && $user->rights->tax->charges->creer) {
171 $result = $object->fetch($id);
173 $result = $object->setUnpaid($user);
175 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
183 if ($action ==
'add' && !$cancel) {
186 $object->fk_account =
GETPOST(
"accountid",
'int');
187 $object->type_payment =
GETPOST(
"type_payment",
'alphanohtml');
188 $object->num_payment =
GETPOST(
"num_payment",
'alphanohtml');
190 $object->datev = $datev;
191 $object->datep = $datep;
197 $object->amount = $amount;
198 $object->label =
GETPOST(
"label",
'alpha');
199 $object->note =
GETPOST(
"note",
'restricthtml');
200 $object->note_private =
GETPOST(
"note",
'restricthtml');
202 if (empty($object->datep)) {
203 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"DatePayment")), null,
'errors');
206 if (empty($object->datev)) {
207 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"PeriodEndDate")), null,
'errors');
210 if (!empty($auto_create_payment) && (empty($object->type_payment) || $object->type_payment < 0)) {
211 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"PaymentMode")), null,
'errors');
214 if (empty($object->amount)) {
215 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Amount")), null,
'errors');
218 if (!empty($auto_create_payment) && ($object->fk_account <= 0)) {
219 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"AccountToCredit")), null,
'errors');
224 $ret = $object->create($user);
230 if (!empty($auto_create_payment) && !$error) {
235 $paiement->chid = $object->id;
236 $paiement->datepaye = $datep;
237 $paiement->amounts = array($object->id=>$amount);
238 $paiement->paiementtype =
GETPOST(
"type_payment",
'alphanohtml');
239 $paiement->num_payment =
GETPOST(
"num_payment",
'alphanohtml');
240 $paiement->note =
GETPOST(
"note",
'restricthtml');
243 $paymentid = $paiement->create($user, (
int)
GETPOST(
'closepaidtva'));
244 if ($paymentid < 0) {
252 $result = $paiement->addPaymentToBank($user,
'payment_vat',
'(VATPayment)',
GETPOST(
'accountid',
'int'),
'',
'');
253 if (!($result > 0)) {
266 header(
"Location: card.php?id=" . $object->id);
274 if ($action ==
'confirm_delete' && $confirm ==
'yes') {
275 $result = $object->fetch($id);
276 $totalpaid = $object->getSommePaiement();
278 if (empty($totalpaid)) {
281 $ret = $object->delete($user);
283 if ($object->fk_bank) {
285 $result = $accountline->fetch($object->fk_bank);
287 $result = $accountline->delete($user);
293 header(
"Location: ".DOL_URL_ROOT.
'/compta/tva/list.php');
296 $object->error = $accountline->error;
309 if ($action ==
'update' && !
GETPOST(
"cancel") && $user->rights->tax->charges->creer) {
312 if (empty($amount)) {
313 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Amount")), null,
'errors');
315 } elseif (!is_numeric($amount)) {
316 setEventMessages($langs->trans(
"ErrorFieldMustBeANumeric", $langs->transnoentities(
"Amount")), null,
'errors');
319 $result = $object->fetch($id);
321 $object->amount = $amount;
323 $result = $object->update($user);
331 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
335 if ($action ==
'confirm_clone' && $confirm ==
'yes' && ($user->rights->tax->charges->creer)) {
342 if ($object->id > 0) {
343 $object->id = $object->ref = null;
346 if (
GETPOST(
'clone_label',
'alphanohtml')) {
347 $object->label =
GETPOST(
'clone_label',
'alphanohtml');
349 $object->label = $langs->trans(
"CopyOf").
' '.$object->label;
353 if ($newdateperiod) {
354 $object->datev = $newdateperiod;
358 $id = $object->create($user);
363 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
387 $title = $langs->trans(
"VAT").
" - ".$langs->trans(
"Card");
393 $result = $object->fetch($id);
401 if ($action ==
'create') {
404 if (!empty($conf->use_javascript_ajax)) {
405 print
"\n".
'<script type="text/javascript">';
407 $(document).ready(function () {
408 let onAutoCreatePaiementChange = function () {
409 if($("#auto_create_paiement").is(":checked")) {
410 $("#label_fk_account").addClass("fieldrequired");
411 $("#label_type_payment").addClass("fieldrequired");
412 $(".hide_if_no_auto_create_payment").show();
414 $("#label_fk_account").removeClass("fieldrequired");
415 $("#label_type_payment").removeClass("fieldrequired");
416 $(".hide_if_no_auto_create_payment").hide();
419 $("#radiopayment").click(function() {
420 $("#label").val($(this).data("label"));
422 $("#radiorefund").click(function() {
423 $("#label").val($(this).data("label"));
426 $("#auto_create_paiement").click(function () {
427 onAutoCreatePaiementChange();
429 onAutoCreatePaiementChange();
433 print
'</script>'.
"\n";
436 print
'<form name="add" action="'.$_SERVER[
"PHP_SELF"].
'" name="formvat" method="post">';
437 print
'<input type="hidden" name="token" value="'.newToken().
'">';
438 print
'<input type="hidden" name="action" value="add">';
442 print
'<table class="border centpercent">';
444 print
'<tr><td class="titlefieldcreate fieldrequired">';
448 print
'<div id="selectmethod">';
449 print
'<label for="radiopayment">';
450 print
'<input type="radio" id="radiopayment" data-label="'.$langs->trans(
'VATPayment').
'" class="flat" name="refund" value="0"'.($refund ?
'' :
' checked="checked"').
'>';
452 print $langs->trans(
"Payment");
454 print
' ';
455 print
'<label for="radiorefund">';
456 print
'<input type="radio" id="radiorefund" data-label="'.$langs->trans(
'VATRefund').
'" class="flat" name="refund" value="1"'.($refund ?
' checked="checked"' :
'').
'>';
458 print $langs->trans(
"Refund");
467 $label = $langs->trans(
"VATRefund");
469 $label = $langs->trans(
"VATPayment");
471 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>';
473 print
'<tr><td class="titlefieldcreate fieldrequired">'.$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo")).
'</td><td>';
474 print
$form->selectDate((
GETPOST(
"datevmonth",
'int') ? $datev : -1),
"datev",
'',
'',
'',
'add', 1, 1);
478 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Amount").
'</td><td><input name="amount" class="right width75" value="'.
GETPOST(
"amount",
"alpha").
'"></td></tr>';
480 print
'<tr><td colspan="2"><hr></td></tr>';
483 print
'<tr><td><label for="auto_create_paiement">'.$langs->trans(
'AutomaticCreationPayment').
'</label></td>';
484 print
'<td><input id="auto_create_paiement" name="auto_create_paiement" type="checkbox" ' . (empty($auto_create_payment) ?
'' :
'checked="checked"') .
' value="1"></td></tr>'.
"\n";
486 print
'<tr class="hide_if_no_auto_create_payment">';
487 print
'<td class="fieldrequired">'.$langs->trans(
"DatePayment").
'</td><td>';
488 print
$form->selectDate($datep,
"datep",
'',
'',
'',
'add', 1, 1);
492 print
'<tr><td class="fieldrequired" id="label_type_payment">'.$langs->trans(
"PaymentMode").
'</td><td>';
493 $form->select_types_paiements(
GETPOST(
"type_payment",
'int'),
"type_payment",
'', 0, 1, 0, 0, 1,
'maxwidth500 widthcentpercentminusx');
499 print
'<tr><td class="fieldrequired" id="label_fk_account">'.$langs->trans(
"BankAccount").
'</td><td>';
500 print
img_picto(
'',
'bank_account',
'pictofixedwidth');
501 $form->select_comptes(
GETPOST(
"accountid",
'int'),
"accountid", 0,
"courant=1", 1,
'', 0,
'maxwidth500 widthcentpercentminusx');
506 print
'<tr class="hide_if_no_auto_create_payment"><td>'.$langs->trans(
'Numero');
507 print
' <em>('.$langs->trans(
"ChequeOrTransferNumber").
')</em>';
508 print
'<td><input name="num_payment" type="text" value="'.GETPOST(
"num_payment").
'"></td></tr>'.
"\n";
511 print
'<tr class="hide_if_no_auto_create_payment">';
512 print
'<td class="tdtop">'.$langs->trans(
"Comments").
'</td>';
513 print
'<td class="tdtop"><textarea name="note" wrap="soft" rows="'.ROWS_3.
'" class="quatrevingtpercent">'.
GETPOST(
'note',
'restricthtml').
'</textarea></td>';
517 $parameters = array();
518 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
519 print $hookmanager->resPrint;
525 print
'<div class="center">';
526 print
'<div class="hide_if_no_auto_create_payment paddingbottom">';
527 print
'<input type="checkbox" checked value="1" name="closepaidtva"> <span class="">'.$langs->trans(
"ClosePaidVATAutomatically").
'</span>';
531 print
'<input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'">';
532 print
' ';
533 print
'<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
543 $totalpaid = $object->getSommePaiement();
546 if ($action ===
'clone') {
547 $formquestion = array(
548 array(
'type' =>
'text',
'name' =>
'clone_label',
'label' => $langs->trans(
"Label"),
'value' => $langs->trans(
"CopyOf").
' '.$object->label),
552 $formquestion[] = array(
'type' =>
'date',
'name' =>
'clone_period',
'label' => $langs->trans(
"PeriodEndDate"),
'value' => -1);
554 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneVAT', $object->ref),
'confirm_clone', $formquestion,
'yes', 1, 240);
557 if ($action ==
'paid') {
558 $text = $langs->trans(
'ConfirmPayVAT');
559 print
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
'PayVAT'), $text,
"confirm_paid",
'',
'', 2);
562 if ($action ==
'delete') {
563 $text = $langs->trans(
'ConfirmDeleteVAT');
564 print
$form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'DeleteVAT'), $text,
'confirm_delete',
'',
'', 2);
567 if ($action ==
'edit') {
568 print
"<form name=\"charge\" action=\"".$_SERVER[
"PHP_SELF"].
"?id=$object->id&action=update\" method=\"post\">";
569 print
'<input type="hidden" name="token" value="'.newToken().
'">';
574 $morehtmlref =
'<div class="refidno">';
576 $morehtmlref .=
$form->editfieldkey(
"Label",
'lib', $object->label, $object, $user->rights->tax->charges->creer,
'string',
'', 0, 1);
577 $morehtmlref .=
$form->editfieldval(
"Label",
'lib', $object->label, $object, $user->rights->tax->charges->creer,
'string',
'', null, null,
'', 1);
579 $morehtmlref .=
'</div>';
581 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/tva/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
583 $object->totalpaid = $totalpaid;
585 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'',
'');
587 print
'<div class="fichecenter">';
588 print
'<div class="fichehalfleft">';
589 print
'<div class="underbanner clearboth"></div>';
591 print
'<table class="border centpercent">';
602 print
$form->editfieldkey(
$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo")),
'datev', $object->datev, $object, $user->rights->tax->charges->creer,
'day');
604 print
$form->editfieldval(
"PeriodEndDate",
'datev', $object->datev, $object, $user->rights->tax->charges->creer,
'day');
608 if ($action ==
'edit') {
609 print
'<tr><td class="fieldrequired">' . $langs->trans(
"Amount") .
'</td><td><input name="amount" size="10" value="' .
price($object->amount) .
'"></td></tr>';
611 print
'<tr><td>' . $langs->trans(
"Amount") .
'</td><td>' .
price($object->amount) .
'</td></tr>';
616 print
'<table class="nobordernopadding" width="100%"><tr><td>';
617 print $langs->trans(
'PaymentMode');
619 if ($action !=
'editmode') {
620 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>';
622 print
'</tr></table>';
624 if ($action ==
'editmode') {
625 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->type_payment,
'mode_reglement_id');
627 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->type_payment,
'none');
633 print
'<tr><td class="nowrap">';
634 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
635 print $langs->trans(
'BankAccount');
637 if ($action !=
'editbankaccount' && $user->rights->tax->charges->creer) {
638 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>';
640 print
'</tr></table>';
642 if ($action ==
'editbankaccount') {
643 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_account,
'fk_account', 1);
645 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_account,
'none');
652 $parameters = array();
653 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
654 print $hookmanager->resPrint;
660 print
'<div class="fichehalfright">';
670 $sql =
"SELECT p.rowid, p.num_paiement as num_payment, p.datep as dp, p.amount,";
671 $sql .=
" c.code as type_code,c.libelle as paiement_type,";
672 $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';
673 $sql .=
" FROM ".MAIN_DB_PREFIX.
"payment_vat as p";
674 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank as b ON p.fk_bank = b.rowid';
675 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank_account as ba ON b.fk_account = ba.rowid';
676 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as c ON p.fk_typepaiement = c.id";
677 $sql .=
", ".MAIN_DB_PREFIX.
"tva as tva";
678 $sql .=
" WHERE p.fk_tva = ".((int) $id);
679 $sql .=
" AND p.fk_tva = tva.rowid";
680 $sql .=
" AND tva.entity IN (".getEntity(
'tax').
")";
681 $sql .=
" ORDER BY dp DESC";
684 $resql = $db->query($sql);
688 $num = $db->num_rows(
$resql);
692 print
'<div class="div-table-responsive-no-min">';
693 print
'<table class="noborder paymenttable">';
694 print
'<tr class="liste_titre">';
695 print
'<td>'.$langs->trans(
"RefPayment").
'</td>';
696 print
'<td>'.$langs->trans(
"Date").
'</td>';
697 print
'<td>'.$langs->trans(
"Type").
'</td>';
699 print
'<td class="liste_titre right">'.$langs->trans(
'BankAccount').
'</td>';
701 print
'<td class="right">'.$langs->trans(
"Amount").
'</td>';
705 $bankaccountstatic =
new Account($db);
707 $objp = $db->fetch_object(
$resql);
709 print
'<tr class="oddeven"><td>';
710 print
'<a href="'.DOL_URL_ROOT.
'/compta/payment_vat/card.php?id='.$objp->rowid.
'">'.
img_object($langs->trans(
"Payment"),
"payment").
' '.$objp->rowid.
'</a>';
712 print
'<td>'.dol_print_date($db->jdate($objp->dp),
'day').
"</td>\n";
713 $labeltype = $langs->trans(
"PaymentType".$objp->type_code) != (
"PaymentType".$objp->type_code) ? $langs->trans(
"PaymentType".$objp->type_code) : $objp->paiement_type;
714 print
"<td>".$labeltype.
' '.$objp->num_payment.
"</td>\n";
716 $bankaccountstatic->id = $objp->baid;
717 $bankaccountstatic->ref = $objp->baref;
718 $bankaccountstatic->label = $objp->baref;
719 $bankaccountstatic->number = $objp->banumber;
720 $bankaccountstatic->currency_code = $objp->bacurrency_code;
723 $bankaccountstatic->account_number = $objp->account_number;
726 $accountingjournal->fetch($objp->fk_accountancy_journal);
727 $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
730 print
'<td class="right">';
731 if ($bankaccountstatic->id) {
732 print $bankaccountstatic->getNomUrl(1,
'transactions');
736 print
'<td class="right"><span class="amount">'.price($objp->amount).
"</span></td>\n";
738 $totalpaid += $objp->amount;
742 print
'<tr class="oddeven"><td><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
743 print
'<td></td><td></td><td></td><td></td>';
747 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AlreadyPaid").
" :</td><td class=\"right\">".
price($totalpaid).
"</td></tr>\n";
748 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AmountExpected").
" :</td><td class=\"right\">".
price($object->amount).
"</td></tr>\n";
750 $resteapayer = $object->amount - $totalpaid;
751 $cssforamountpaymentcomplete =
'amountpaymentcomplete';
753 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"RemainderToPay").
" :</td>";
754 print
'<td class="right'.($resteapayer ?
' amountremaintopay' : (
' '.$cssforamountpaymentcomplete)).
'">'.
price($resteapayer).
"</td></tr>\n";
767 print
'<div class="clearboth"></div>';
771 if ($action ==
'edit') {
772 print
$form->buttonsSaveCancel();
780 print
'<div class="tabsAction">'.
"\n";
782 if ($action !=
'edit') {
784 if ($object->paye && $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=reopen&token='.
newToken().
'">'.$langs->trans(
"ReOpen").
"</a></div>";
789 if ($object->paye == 0 && $user->rights->tax->charges->creer) {
790 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>";
794 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) {
795 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>';
799 if ($object->paye == 0
801 (round($resteapayer) <= 0 && $object->amount > 0)
802 || (round($resteapayer) >= 0 && $object->amount < 0)
804 && $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=paid">'.$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/tva/card.php?id='.$object->id.
'&token='.
newToken().
'&action=clone">'.$langs->trans(
"ToClone").
"</a></div>";
813 if (!empty($user->rights->tax->charges->supprimer) && empty($totalpaid)) {
814 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id='.$object->id.
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
'</a></div>';
816 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans(
"DisabledBecausePayments"))).
'">'.$langs->trans(
"Delete").
'</a></div>';
824 if (
GETPOST(
'modelselected')) {
828 if ($action !=
'presend') {
829 print
'<div class="fichecenter"><div class="fichehalfleft">';
830 print
'<a name="builddoc"></a>';
832 $includedocgeneration = 1;
835 if ($includedocgeneration) {
837 $relativepath = $objref.
'/'.$objref.
'.pdf';
838 $filedir = $conf->tax->dir_output.
'/vat/'.$objref;
839 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
842 $delallowed = $user->rights->tax->charges->creer;
843 print $formfile->showdocuments(
'tax-vat', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
851 print
'</div><div class="fichehalfright">';
864 print
'</div></div>';
868 if (
GETPOST(
'modelselected')) {
874 $defaulttopic =
'InformationMessage';
875 $diroutput = $conf->tax->dir_output;
876 $trackid =
'vat'.$object->id;
878 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
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...
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage bank transaction lines.
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.
Class to manage bank accounts.
Put here description of your class.
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...
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form...
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
restrictedArea($user, $features, $objectid=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.
if(isModEnabled('facture')&&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur')&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)&&$user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice')&&$user->rights->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->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
vat_prepare_head($object)
Prepare array with list of tabs.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage payments of social contributions.
isModEnabled($module)
Is Dolibarr module enabled.
Class to manage accounting accounts.
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.