29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/compta/localtax/class/localtax.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/vat.lib.php';
44$langs->loadLangs(array(
'compta',
'banks',
'bills'));
47$action =
GETPOST(
"action",
"aZ09");
48$cancel =
GETPOST(
'cancel',
'alpha');
60 $socid = $user->socid;
63$hookmanager->initHooks(array(
'localtaxvatcard',
'globalcard'));
69$permissiontoadd = $user->hasRight(
'tax',
'charges',
'creer');
70$permissiontodelete = $user->hasRight(
'tax',
'charges',
'supprimer');
78 header(
"Location: list.php?localTaxType=".$lttype);
82if ($action ==
'add' && !$cancel && $permissiontoadd) {
96 $ret =
$object->addPayment($user);
99 header(
"Location: list.php?localTaxType=".$lttype);
109if ($action ==
'delete' && $permissiontodelete) {
120 $result = $accountline->fetch(
$object->fk_bank);
122 $result = $accountline->delete($user);
130 header(
"Location: ".DOL_URL_ROOT.
'/compta/localtax/list.php?localTaxType='.
$object->ltt);
133 $object->error = $accountline !==
null ? $accountline->error :
"No account line / no bank identified found";
142 $mesg =
'Error try do delete a line linked to a conciliated bank transaction';
143 setEventMessages($mesg,
null,
'errors');
161$title = $langs->trans(
"LT".
$object->ltt).
" - ".$langs->trans(
"Card");
165if ($action ==
'create') {
169 print
load_fiche_titre($langs->transcountry($lttype == 2 ?
"newLT2Payment" :
"newLT1Payment",
$mysoc->country_code));
171 print
'<form name="add" action="'.$_SERVER[
"PHP_SELF"].
'" name="formlocaltax" method="post">'.
"\n";
172 print
'<input type="hidden" name="token" value="'.newToken().
'">';
173 print
'<input type="hidden" name="localTaxType" value="'.$lttype.
'">';
174 print
'<input type="hidden" name="action" value="add">';
178 print
'<table class="border centpercent">';
182 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"DatePayment").
'</td><td>';
183 print $form->selectDate($datep,
"datep", 0, 0, 0,
'add', 1, 1);
187 print
'<tr><td class="fieldrequired">'.$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo")).
'</td><td>';
188 print $form->selectDate($datev,
"datev", 0, 0, 0,
'add', 1, 1);
192 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td><td><input name="label" class="minwidth200" value="'.(
GETPOSTISSET(
"label") ?
GETPOST(
"label",
'alphanohtml', 2) : $langs->transcountry(($lttype == 2 ?
"LT2Payment" :
"LT1Payment"),
$mysoc->country_code)).
'"></td></tr>';
195 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Amount").
'</td><td><input name="amount" size="10" value="'.
GETPOST(
"amount").
'"></td></tr>';
199 print
'<tr><td class="fieldrequired">'.$langs->trans(
"PaymentMode").
'</td><td>';
200 print $form->select_types_paiements(
GETPOST(
"paiementtype"),
"paiementtype",
'', 0, 1, 0, 0, 1,
'maxwidth500 widthcentpercentminusx', 1);
205 print
'<tr><td class="fieldrequired" id="label_fk_account">'.$langs->trans(
"BankAccount").
'</td><td>';
206 print img_picto(
'',
'bank_account',
'class="pictofixedwidth"');
207 $form->select_comptes(
GETPOSTINT(
"accountid"),
"accountid", 0,
"(courant:=:1)", 2,
'', 0,
'maxwidth500 widthcentpercentminusx');
211 print
'<tr><td>'.$langs->trans(
'Numero');
212 print
' <em>('.$langs->trans(
"ChequeOrTransferNumber").
')</em>';
213 print
'<td><input name="num_payment" type="text" value="'.GETPOST(
"num_payment").
'"></td></tr>'.
"\n";
217 $parameters = array();
218 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
219 print $hookmanager->resPrint;
225 print $form->buttonsSaveCancel();
235 $head[$h][0] = DOL_URL_ROOT.
'/compta/localtax/card.php?id='.
$object->id;
236 $head[$h][1] = $langs->trans(
'Card');
237 $head[$h][2] =
'card';
240 print
dol_get_fiche_head($head,
'card', $langs->transcountry(
"LT".$object->ltt,
$mysoc->country_code), -1,
'payment');
242 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/localtax/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
244 dol_banner_tab($object,
'id', $linkback);
246 print
'<div class="fichecenter">';
247 print
'<div class="underbanner clearboth"></div>';
249 print
'<table class="border centpercent">';
252 print
'<td class="titlefield">'.$langs->trans(
"Ref").
'</td><td>';
257 print
'<td>'.$langs->trans(
"DatePayment").
'</td><td>';
261 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"PeriodEndDate"), $langs->trans(
"LastDayTaxIsRelatedTo")).
'</td><td>';
265 print
'<tr><td>'.$langs->trans(
"Amount").
'</td><td>'.
price(
$object->amount).
'</td></tr>';
270 $bankline->fetch(
$object->fk_bank);
273 print
'<td>'.$langs->trans(
'BankTransactionLine').
'</td>';
275 print $bankline->getNomUrl(1, 0,
'showall');
282 $parameters = array();
283 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
284 print $hookmanager->resPrint;
296 print
"<div class=\"tabsAction\">\n";
298 print dolGetButtonAction($langs->trans(
"Delete"), $langs->trans(
"Delete"),
'delete',
'card.php?id='.$object->id.
'&action=delete&token='.
newToken(),
'',
true, array(
'attr' => array(
'class' =>
'reposition'))).
"\n";
300 print
'<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"LinkedToAConcialitedTransaction").
'">'.$langs->trans(
"Delete").
'</a>';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage bank transaction lines.
Class to manage local tax.
recordNotFound($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Displays an error page when a record is not found.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.