Go to the documentation of this file.
26 require
'../../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/compta/localtax/class/localtax.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/vat.lib.php';
32 $langs->loadLangs(array(
'compta',
'banks',
'bills'));
35 $action =
GETPOST(
"action",
"aZ09");
36 $cancel =
GETPOST(
'cancel',
'aZ09');
38 $refund =
GETPOST(
"refund",
"int");
43 $lttype =
GETPOST(
'localTaxType',
'int');
46 $socid =
GETPOST(
'socid',
'int');
48 $socid = $user->socid;
55 $hookmanager->initHooks(array(
'localtaxvatcard',
'globalcard'));
62 if ($cancel && !$id) {
63 header(
"Location: list.php?localTaxType=".$lttype);
67 if ($action ==
'add' && !$cancel) {
73 $object->accountid =
GETPOST(
"accountid",
'int');
74 $object->paymenttype =
GETPOST(
"paiementtype");
75 $object->datev = $datev;
76 $object->datep = $datep;
78 $object->label =
GETPOST(
"label");
79 $object->ltt = $lttype;
81 $ret = $object->addPayment($user);
84 header(
"Location: list.php?localTaxType=".$lttype);
89 $_GET[
"action"] =
"create";
94 if ($action ==
'delete') {
95 $result = $object->fetch($id);
97 if ($object->rappro == 0) {
100 $ret = $object->delete($user);
102 if ($object->fk_bank) {
104 $result = $accountline->fetch($object->fk_bank);
106 $result = $accountline->delete($user);
112 header(
"Location: ".DOL_URL_ROOT.
'/compta/localtax/list.php?localTaxType='.$object->ltt);
115 $object->error = $accountline->error;
124 $mesg =
'Error try do delete a line linked to a conciliated bank transaction';
135 $result = $object->fetch($id);
144 $title = $langs->trans(
"LT".$object->ltt).
" - ".$langs->trans(
"Card");
148 if ($action ==
'create') {
149 print
load_fiche_titre($langs->transcountry($lttype == 2 ?
"newLT2Payment" :
"newLT1Payment", $mysoc->country_code));
151 print
'<form name="add" action="'.$_SERVER[
"PHP_SELF"].
'" name="formlocaltax" method="post">'.
"\n";
152 print
'<input type="hidden" name="token" value="'.newToken().
'">';
153 print
'<input type="hidden" name="localTaxType" value="'.$lttype.
'">';
154 print
'<input type="hidden" name="action" value="add">';
158 print
'<table class="border centpercent">';
162 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"DatePayment").
'</td><td>';
163 print
$form->selectDate($datep,
"datep",
'',
'',
'',
'add', 1, 1);
167 print
'<tr><td class="fieldrequired">'.$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo")).
'</td><td>';
168 print
$form->selectDate($datev,
"datev",
'',
'',
'',
'add', 1, 1);
172 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td><td><input name="label" class="minwidth200" value="'.(
GETPOSTISSET(
"label") ?
GETPOST(
"label",
'', 2) : $langs->transcountry(($lttype == 2 ?
"LT2Payment" :
"LT1Payment"), $mysoc->country_code)).
'"></td></tr>';
175 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Amount").
'</td><td><input name="amount" size="10" value="'.
GETPOST(
"amount").
'"></td></tr>';
179 print
'<tr><td class="fieldrequired">'.$langs->trans(
"PaymentMode").
'</td><td>';
180 $form->select_types_paiements(
GETPOST(
"paiementtype"),
"paiementtype",
'', 0, 1, 0, 0, 1,
'maxwidth500 widthcentpercentminusx');
185 print
'<tr><td class="fieldrequired" id="label_fk_account">'.$langs->trans(
"Account").
'</td><td>';
186 print
img_picto(
'',
'bank_account',
'pictofixedwidth');
187 $form->select_comptes(
GETPOST(
"accountid",
"int"),
"accountid", 0,
"courant=1", 2,
'', 0,
'maxwidth500 widthcentpercentminusx');
191 print
'<tr><td>'.$langs->trans(
'Numero');
192 print
' <em>('.$langs->trans(
"ChequeOrTransferNumber").
')</em>';
193 print
'<td><input name="num_payment" type="text" value="'.GETPOST(
"num_payment").
'"></td></tr>'.
"\n";
198 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
199 print $hookmanager->resPrint;
205 print
$form->buttonsSaveCancel();
214 $head[$h][0] = DOL_URL_ROOT.
'/compta/localtax/card.php?id='.$object->id;
215 $head[$h][1] = $langs->trans(
'Card');
216 $head[$h][2] =
'card';
219 print
dol_get_fiche_head($head,
'card', $langs->transcountry(
"LT".$object->ltt, $mysoc->country_code), -1,
'payment');
221 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/localtax/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
223 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref,
'', 0,
'',
'');
225 print
'<div class="fichecenter">';
226 print
'<div class="underbanner clearboth"></div>';
228 print
'<table class="border centpercent">';
231 print
'<td class="titlefield">'.$langs->trans(
"Ref").
'</td><td>';
236 print
'<td>'.$langs->trans(
"DatePayment").
'</td><td>';
240 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo")).
'</td><td>';
244 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td>'.
price($object->amount).
'</td></tr>';
247 if ($object->fk_account > 0) {
249 $bankline->fetch($object->fk_bank);
252 print
'<td>'.$langs->trans(
'BankTransactionLine').
'</td>';
254 print $bankline->getNomUrl(1, 0,
'showall');
262 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
263 print $hookmanager->resPrint;
275 print
"<div class=\"tabsAction\">\n";
276 if ($object->rappro == 0) {
277 print
'<a class="butActionDelete" href="card.php?id='.$object->id.
'&action=delete&token='.
newToken().
'">'.$langs->trans(
"Delete").
'</a>';
279 print
'<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"LinkedToAConcialitedTransaction").
'">'.$langs->trans(
"Delete").
'</a>';
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.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
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.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
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.
isModEnabled($module)
Is Dolibarr module enabled.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
Class to manage bank transaction lines.
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.
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 local tax.