30require
'../../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/tva.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/paymentvat.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/vat.lib.php';
39if (isModEnabled(
'accounting')) {
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");
56if (GETPOSTISSET(
'auto_create_paiement') || $action ===
'add') {
57 $auto_create_payment =
GETPOST(
"auto_create_paiement",
"int");
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);
78if (empty($action) && empty($id) && empty($ref)) {
83include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
85$permissiontoread = $user->rights->tax->charges->lire;
86$permissiontoadd = $user->rights->tax->charges->creer;
87$permissiontodelete = $user->rights->tax->charges->supprimer || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
88$permissionnote = $user->rights->tax->charges->creer;
89$permissiondellink = $user->rights->tax->charges->creer;
90$upload_dir = $conf->tax->multidir_output[isset($object->entity) ? $object->entity : 1].
'/vat';
93$socid =
GETPOST(
'socid',
'int');
94if (!empty($user->socid)) {
95 $socid = $user->socid;
97$result =
restrictedArea($user,
'tax', $object->id,
'tva',
'charges');
104$parameters = array(
'socid' => $socid);
105$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
110if (empty($reshook)) {
111 if ($cancel && !$id) {
112 header(
"Location: list.php");
116 if ($action ==
'setlib' && $user->hasRight(
'tax',
'charges',
'creer')) {
118 $result = $object->setValueFrom(
'label',
GETPOST(
'lib',
'alpha'),
'',
'',
'text',
'', $user,
'TAX_MODIFY');
124 if ($action ==
'setdatev' && $user->hasRight(
'tax',
'charges',
'creer')) {
126 $object->datev = $datev;
127 $result = $object->update($user);
136 if ($action ==
'setmode' && $user->hasRight(
'tax',
'charges',
'creer')) {
138 $result = $object->setPaymentMethods(
GETPOST(
'mode_reglement_id',
'int'));
145 if ($action ==
'setbankaccount' && $user->hasRight(
'tax',
'charges',
'creer')) {
147 $result = $object->setBankAccount(
GETPOST(
'fk_account',
'int'));
154 if ($action ==
'confirm_paid' && $user->hasRight(
'tax',
'charges',
'creer') && $confirm ==
'yes') {
156 $result = $object->setPaid($user);
159 if ($action ==
'reopen' && $user->hasRight(
'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->hasRight(
'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->hasRight(
'tax',
'charges',
'creer'))) {
331 if ($object->id > 0) {
332 $object->id = $object->ref =
null;
335 if (
GETPOST(
'amount',
'alphanohtml')) {
339 if (
GETPOST(
'clone_label',
'alphanohtml')) {
340 $object->label =
GETPOST(
'clone_label',
'alphanohtml');
342 $object->label = $langs->trans(
"CopyOf").
' '.$object->label;
346 if ($newdateperiod) {
347 $object->datev = $newdateperiod;
351 $id = $object->create($user);
356 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?id=".$id);
372 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
380$form =
new Form($db);
384$title = $langs->trans(
"VAT").
" - ".$langs->trans(
"Card");
389if ($action ==
'create') {
392 if (!empty($conf->use_javascript_ajax)) {
393 print
"\n".
'<script type="text/javascript">';
395 $(document).ready(function () {
396 let onAutoCreatePaiementChange = function () {
397 if($("#auto_create_paiement").is(":checked")) {
398 $("#label_fk_account").addClass("fieldrequired");
399 $("#label_type_payment").addClass("fieldrequired");
400 $(".hide_if_no_auto_create_payment").show();
402 $("#label_fk_account").removeClass("fieldrequired");
403 $("#label_type_payment").removeClass("fieldrequired");
404 $(".hide_if_no_auto_create_payment").hide();
407 $("#radiopayment").click(function() {
408 $("#label").val($(this).data("label"));
410 $("#radiorefund").click(function() {
411 $("#label").val($(this).data("label"));
414 $("#auto_create_paiement").click(function () {
415 onAutoCreatePaiementChange();
417 onAutoCreatePaiementChange();
421 print
'</script>'.
"\n";
424 print
'<form name="add" action="'.$_SERVER[
"PHP_SELF"].
'" name="formvat" method="post">';
425 print
'<input type="hidden" name="token" value="'.newToken().
'">';
426 print
'<input type="hidden" name="action" value="add">';
430 print
'<table class="border centpercent">';
432 print
'<tr><td class="titlefieldcreate fieldrequired">';
436 print
'<div id="selectmethod">';
437 print
'<label for="radiopayment">';
438 print
'<input type="radio" id="radiopayment" data-label="'.$langs->trans(
'VATPayment').
'" class="flat" name="refund" value="0"'.($refund ?
'' :
' checked="checked"').
'>';
440 print $langs->trans(
"Payment");
442 print
' ';
443 print
'<label for="radiorefund">';
444 print
'<input type="radio" id="radiorefund" data-label="'.$langs->trans(
'VATRefund').
'" class="flat" name="refund" value="1"'.($refund ?
' checked="checked"' :
'').
'>';
446 print $langs->trans(
"Refund");
455 $label = $langs->trans(
"VATRefund");
457 $label = $langs->trans(
"VATPayment");
459 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>';
461 print
'<tr><td class="titlefieldcreate fieldrequired">'.$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo")).
'</td><td>';
462 print $form->selectDate((
GETPOST(
"datevmonth",
'int') ? $datev : -1),
"datev",
'',
'',
'',
'add', 1, 1);
466 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Amount").
'</td><td><input name="amount" class="right width75" value="'.
GETPOST(
"amount",
"alpha").
'"></td></tr>';
468 print
'<tr><td colspan="2"><hr></td></tr>';
471 print
'<tr><td><label for="auto_create_paiement">'.$langs->trans(
'AutomaticCreationPayment').
'</label></td>';
472 print
'<td><input id="auto_create_paiement" name="auto_create_paiement" type="checkbox" ' . (empty($auto_create_payment) ?
'' :
'checked="checked"') .
' value="1"></td></tr>'.
"\n";
474 print
'<tr class="hide_if_no_auto_create_payment">';
475 print
'<td class="fieldrequired">'.$langs->trans(
"DatePayment").
'</td><td>';
476 print $form->selectDate($datep,
"datep",
'',
'',
'',
'add', 1, 1);
480 print
'<tr><td class="fieldrequired" id="label_type_payment">'.$langs->trans(
"PaymentMode").
'</td><td>';
481 print $form->select_types_paiements(
GETPOST(
"type_payment",
'int'),
"type_payment",
'', 0, 1, 0, 0, 1,
'maxwidth500 widthcentpercentminusx', 1);
485 if (isModEnabled(
"banque")) {
487 print
'<tr><td class="fieldrequired" id="label_fk_account">'.$langs->trans(
"BankAccount").
'</td><td>';
488 print
img_picto(
'',
'bank_account',
'pictofixedwidth');
489 $form->select_comptes(
GETPOST(
"accountid",
'int'),
"accountid", 0,
"courant=1", 1,
'', 0,
'maxwidth500 widthcentpercentminusx');
494 print
'<tr class="hide_if_no_auto_create_payment"><td>'.$langs->trans(
'Numero');
495 print
' <em>('.$langs->trans(
"ChequeOrTransferNumber").
')</em>';
496 print
'<td><input name="num_payment" type="text" value="'.GETPOST(
"num_payment").
'"></td></tr>'.
"\n";
499 print
'<tr class="hide_if_no_auto_create_payment">';
500 print
'<td class="tdtop">'.$langs->trans(
"Comments").
'</td>';
501 print
'<td class="tdtop"><textarea name="note" wrap="soft" rows="'.ROWS_3.
'" class="quatrevingtpercent">'.
GETPOST(
'note',
'restricthtml').
'</textarea></td>';
505 $parameters = array();
506 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
507 print $hookmanager->resPrint;
513 print
'<div class="center">';
514 print
'<div class="hide_if_no_auto_create_payment paddingbottom">';
515 print
'<input type="checkbox" checked value="1" name="closepaidtva"> <span class="">'.$langs->trans(
"ClosePaidVATAutomatically").
'</span>';
519 print
'<input type="submit" class="button button-save" value="'.$langs->trans(
"Save").
'">';
520 print
' ';
521 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);
543 $formquestion[] = array(
'type' =>
'text',
'name' =>
'amount',
'label' => $langs->trans(
"Amount"),
'value' =>
price($object->amount),
'morecss' =>
'width100');
545 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmCloneVAT', $object->ref),
'confirm_clone', $formquestion,
'yes', 1, 240);
548 if ($action ==
'paid') {
549 $text = $langs->trans(
'ConfirmPayVAT');
550 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
"?id=".$object->id, $langs->trans(
'PayVAT'), $text,
"confirm_paid",
'',
'', 2);
553 if ($action ==
'delete') {
554 $text = $langs->trans(
'ConfirmDeleteVAT');
555 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $langs->trans(
'DeleteVAT'), $text,
'confirm_delete',
'',
'', 2);
558 if ($action ==
'edit') {
559 print
'<form name="charge" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="POST">';
560 print
'<input type="hidden" name="token" value="'.newToken().
'">';
561 print
'<input type="hidden" name="action" value="update">';
564 $parameters = array(
'formConfirm' => $formconfirm);
565 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
566 if (empty($reshook)) {
567 $formconfirm .= $hookmanager->resPrint;
568 } elseif ($reshook > 0) {
569 $formconfirm = $hookmanager->resPrint;
572 print
dol_get_fiche_head($head,
'card', $langs->trans(
"VATPayment"), -1,
'payment', 0,
'',
'', 0,
'', 1);
577 $morehtmlref =
'<div class="refidno">';
579 $morehtmlref .= $form->editfieldkey(
"Label",
'lib', $object->label, $object, $user->hasRight(
'tax',
'charges',
'creer'),
'string',
'', 0, 1);
580 $morehtmlref .= $form->editfieldval(
"Label",
'lib', $object->label, $object, $user->hasRight(
'tax',
'charges',
'creer'),
'string',
'',
null,
null,
'', 1);
582 $morehtmlref .=
'</div>';
584 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/tva/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
586 $object->totalpaid = $totalpaid;
588 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'',
'');
590 print
'<div class="fichecenter">';
591 print
'<div class="fichehalfleft">';
592 print
'<div class="underbanner clearboth"></div>';
594 print
'<table class="border centpercent">';
605 print $form->editfieldkey($form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo")),
'datev', $object->datev, $object, $user->hasRight(
'tax',
'charges',
'creer'),
'day');
607 print $form->editfieldval(
"PeriodEndDate",
'datev', $object->datev, $object, $user->hasRight(
'tax',
'charges',
'creer'),
'day');
611 if ($action ==
'edit') {
612 print
'<tr><td class="fieldrequired">' . $langs->trans(
"Amount") .
'</td><td><input name="amount" size="10" value="' .
price($object->amount) .
'"></td></tr>';
614 print
'<tr><td>' . $langs->trans(
"Amount") .
'</td><td>' .
price($object->amount) .
'</td></tr>';
619 print
'<table class="nobordernopadding" width="100%"><tr><td>';
620 print $langs->trans(
'PaymentMode');
622 if ($action !=
'editmode') {
623 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>';
625 print
'</tr></table>';
627 if ($action ==
'editmode') {
628 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->type_payment,
'mode_reglement_id');
630 $form->form_modes_reglement($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->type_payment,
'none');
635 if (isModEnabled(
"banque")) {
636 print
'<tr><td class="nowrap">';
637 print
'<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
638 print $langs->trans(
'BankAccount');
640 if ($action !=
'editbankaccount' && $user->hasRight(
'tax',
'charges',
'creer')) {
641 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>';
643 print
'</tr></table>';
645 if ($action ==
'editbankaccount') {
646 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_account,
'fk_account', 1);
648 $form->formSelectAccount($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->fk_account,
'none');
655 $parameters = array();
656 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
657 print $hookmanager->resPrint;
663 print
'<div class="fichehalfright">';
666 if (isModEnabled(
"banque")) {
673 $sql =
"SELECT p.rowid, p.num_paiement as num_payment, p.datep as dp, p.amount,";
674 $sql .=
" c.code as type_code,c.libelle as paiement_type,";
675 $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';
676 $sql .=
" FROM ".MAIN_DB_PREFIX.
"payment_vat as p";
677 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank as b ON p.fk_bank = b.rowid';
678 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'bank_account as ba ON b.fk_account = ba.rowid';
679 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as c ON p.fk_typepaiement = c.id";
680 $sql .=
", ".MAIN_DB_PREFIX.
"tva as tva";
681 $sql .=
" WHERE p.fk_tva = ".((int) $id);
682 $sql .=
" AND p.fk_tva = tva.rowid";
683 $sql .=
" AND tva.entity IN (".getEntity(
'tax').
")";
684 $sql .=
" ORDER BY dp DESC";
687 $resql = $db->query($sql);
691 $num = $db->num_rows($resql);
695 print
'<div class="div-table-responsive-no-min">';
696 print
'<table class="noborder paymenttable">';
697 print
'<tr class="liste_titre">';
698 print
'<td>'.$langs->trans(
"RefPayment").
'</td>';
699 print
'<td>'.$langs->trans(
"Date").
'</td>';
700 print
'<td>'.$langs->trans(
"Type").
'</td>';
701 if (isModEnabled(
"banque")) {
702 print
'<td class="liste_titre right">'.$langs->trans(
'BankAccount').
'</td>';
704 print
'<td class="right">'.$langs->trans(
"Amount").
'</td>';
708 $bankaccountstatic =
new Account($db);
710 $objp = $db->fetch_object($resql);
712 print
'<tr class="oddeven"><td>';
713 print
'<a href="'.DOL_URL_ROOT.
'/compta/payment_vat/card.php?id='.$objp->rowid.
'">'.
img_object($langs->trans(
"Payment"),
"payment").
' '.$objp->rowid.
'</a>';
715 print
'<td>'.dol_print_date($db->jdate($objp->dp),
'day').
"</td>\n";
716 $labeltype = $langs->trans(
"PaymentType".$objp->type_code) !=
"PaymentType".$objp->type_code ? $langs->trans(
"PaymentType".$objp->type_code) : $objp->paiement_type;
717 print
"<td>".$labeltype.
' '.$objp->num_payment.
"</td>\n";
718 if (isModEnabled(
"banque")) {
719 $bankaccountstatic->id = $objp->baid;
720 $bankaccountstatic->ref = $objp->baref;
721 $bankaccountstatic->label = $objp->baref;
722 $bankaccountstatic->number = $objp->banumber;
723 $bankaccountstatic->currency_code = $objp->bacurrency_code;
725 if (isModEnabled(
'accounting')) {
726 $bankaccountstatic->account_number = $objp->account_number;
729 $accountingjournal->fetch($objp->fk_accountancy_journal);
730 $bankaccountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1,
'', 1);
733 print
'<td class="right">';
734 if ($bankaccountstatic->id) {
735 print $bankaccountstatic->getNomUrl(1,
'transactions');
739 print
'<td class="right"><span class="amount">'.price($objp->amount).
"</span></td>\n";
741 $totalpaid += $objp->amount;
745 print
'<tr class="oddeven"><td><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
746 print
'<td></td><td></td><td></td><td></td>';
750 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AlreadyPaid").
" :</td><td class=\"right\">".
price($totalpaid).
"</td></tr>\n";
751 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"AmountExpected").
" :</td><td class=\"right\">".
price($object->amount).
"</td></tr>\n";
753 $resteapayer = $object->amount - $totalpaid;
754 $cssforamountpaymentcomplete =
'amountpaymentcomplete';
756 print
'<tr><td colspan="'.$nbcols.
'" class="right">'.$langs->trans(
"RemainderToPay").
" :</td>";
757 print
'<td class="right'.($resteapayer ?
' amountremaintopay' : (
' '.$cssforamountpaymentcomplete)).
'">'.
price($resteapayer).
"</td></tr>\n";
770 print
'<div class="clearboth"></div>';
774 if ($action ==
'edit') {
775 print $form->buttonsSaveCancel();
783 print
'<div class="tabsAction">'.
"\n";
785 if ($action !=
'edit') {
787 if ($object->paye && $user->hasRight(
'tax',
'charges',
'creer')) {
788 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>";
792 if ($object->paye == 0 && $user->hasRight(
'tax',
'charges',
'creer')) {
793 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>";
797 if ($object->paye == 0 && ((
price2num($object->amount) < 0 &&
price2num($resteapayer,
'MT') < 0) || (
price2num($object->amount) > 0 &&
price2num($resteapayer,
'MT') > 0)) && $user->hasRight(
'tax',
'charges',
'creer')) {
798 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>';
802 if ($object->paye == 0
804 (round($resteapayer) <= 0 && $object->amount > 0)
805 || (round($resteapayer) >= 0 && $object->amount < 0)
807 && $user->hasRight(
'tax',
'charges',
'creer')) {
808 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>";
812 if ($user->hasRight(
'tax',
'charges',
'creer')) {
813 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>";
816 if ($user->hasRight(
'tax',
'charges',
'supprimer') && empty($totalpaid)) {
817 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id='.$object->id.
'&action=delete&token='.newToken().
'">'.$langs->trans(
"Delete").
'</a></div>';
819 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans(
"DisabledBecausePayments"))).
'">'.$langs->trans(
"Delete").
'</a></div>';
827 if (
GETPOST(
'modelselected')) {
831 if ($action !=
'presend') {
832 print
'<div class="fichecenter"><div class="fichehalfleft">';
833 print
'<a name="builddoc"></a>';
835 $includedocgeneration = 1;
838 if ($includedocgeneration) {
840 $relativepath = $objref.
'/'.$objref.
'.pdf';
841 $filedir = $conf->tax->dir_output.
'/vat/'.$objref;
842 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
845 $delallowed = $user->rights->tax->charges->creer;
846 print $formfile->showdocuments(
'tax-vat', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'',
'',
'', $langs->defaultlang);
854 print
'</div><div class="fichehalfright">';
867 print
'</div></div>';
871 if (
GETPOST(
'modelselected')) {
877 $defaulttopic =
'InformationMessage';
878 $diroutput = $conf->tax->dir_output;
879 $trackid =
'vat'.$object->id;
881 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage bank accounts.
Class to manage bank transaction lines.
Class to manage accounting journals.
Class to manage payments of social contributions.
Put here description of your class.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
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)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.