33require
'../../main.inc.php';
34require_once DOL_DOCUMENT_ROOT .
'/compta/tva/class/tva.class.php';
35require_once DOL_DOCUMENT_ROOT .
'/compta/tva/class/tva.class.php';
36require_once DOL_DOCUMENT_ROOT .
'/compta/tva/class/paymentvat.class.php';
37require_once DOL_DOCUMENT_ROOT .
'/compta/bank/class/account.class.php';
38require_once DOL_DOCUMENT_ROOT .
'/salaries/class/paymentsalary.class.php';
39require_once DOL_DOCUMENT_ROOT .
'/core/lib/date.lib.php';
50$langs->loadLangs(array(
'compta',
'bills'));
52$mode =
GETPOST(
"mode",
'alpha');
54$filtre =
GETPOST(
"filtre",
'alpha');
55$optioncss =
GETPOST(
'optioncss',
'alpha');
56if (!$year && $mode !=
'tvaonly') {
57 $year = date(
"Y", time());
61$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
62$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
64if (empty($page) || $page == -1) {
67$offset = $limit * $page;
70if (empty($sortfield)) {
71 $sortfield =
"ptva.datep";
81 $socid = $user->socid;
91$tva_static =
new Tva($db);
97llxHeader(
'', $langs->trans(
"VATExpensesArea"));
99$title = $langs->trans(
"VATPayments");
102if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
103 $param .=
'&contextpage=' . $contextpage;
105if ($limit > 0 && $limit !=
$conf->liste_limit) {
106 $param .=
'&limit=' . $limit;
109 $param .=
'&sortfield=' . $sortfield;
112 $param .=
'&sortorder=' . $sortorder;
118 $param .=
'&year=' . $year;
121$sql =
"SELECT tva.rowid, tva.label as label, b.fk_account, ptva.fk_bank";
122$sql .=
", tva.datev";
123$sql .=
", tva.amount as total,";
124$sql .=
" ptva.rowid as pid, ptva.datep, ptva.amount as totalpaid, ptva.num_paiement as num_payment,";
125$sql .=
" pct.code as payment_code";
126$sql .=
" FROM " . MAIN_DB_PREFIX .
"tva as tva,";
127$sql .=
" " . MAIN_DB_PREFIX .
"payment_vat as ptva";
128$sql .=
" INNER JOIN " . MAIN_DB_PREFIX .
"bank as b ON (b.rowid = ptva.fk_bank)";
129$sql .=
" INNER JOIN " . MAIN_DB_PREFIX .
"bank_account as bank ON (bank.rowid = b.fk_account)";
130$sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"c_paiement as pct ON ptva.fk_typepaiement = pct.id";
131$sql .=
" WHERE ptva.fk_tva = tva.rowid";
132$sql .=
" AND tva.entity = " .
$conf->entity;
141if (preg_match(
'/^cs\./', $sortfield)
142 || preg_match(
'/^tva\./', $sortfield)
143 || preg_match(
'/^ptva\./', $sortfield)
144 || preg_match(
'/^pct\./', $sortfield)
145 || preg_match(
'/^bank\./', $sortfield)) {
146 $sql .= $db->order($sortfield, $sortorder);
151dol_syslog(
"compta/tva/payments.php: select payment", LOG_DEBUG);
152$resql = $db->query($sql);
154 $num = $db->num_rows($resql);
160print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $num,
'title_accountancy', 0,
'',
'', $limit);
162if (isModEnabled(
'tax') && $user->hasRight(
'tax',
'charges',
'lire')) {
163 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
164 if ($optioncss !=
'') {
165 print
'<input type="hidden" name="optioncss" value="' . $optioncss .
'">';
167 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
168 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
169 print
'<input type="hidden" name="sortfield" value="' . $sortfield .
'">';
170 print
'<input type="hidden" name="sortorder" value="' . $sortorder .
'">';
171 print
'<input type="hidden" name="page" value="' . $page .
'">';
172 print
'<input type="hidden" name="mode" value="' . $mode .
'">';
174 print
'<div class="div-table-responsive">';
175 print
'<table class="noborder centpercent">';
176 print
'<tr class="liste_titre">';
177 print_liste_field_titre(
"RefPayment", $_SERVER[
"PHP_SELF"],
"ptva.rowid",
"", $param,
'', $sortfield, $sortorder);
178 print_liste_field_titre(
"VATDeclaration", $_SERVER[
"PHP_SELF"],
"tva.rowid",
"", $param,
'', $sortfield, $sortorder);
180 print_liste_field_titre(
"PeriodEndDate", $_SERVER[
"PHP_SELF"],
"tva.datev",
"", $param,
'', $sortfield, $sortorder,
'nowraponall');
181 print_liste_field_titre(
"DatePayment", $_SERVER[
"PHP_SELF"],
"ptva.datep",
"", $param,
'align="center"', $sortfield, $sortorder);
182 print_liste_field_titre(
"PaymentMode", $_SERVER[
"PHP_SELF"],
"pct.code",
"", $param,
'', $sortfield, $sortorder);
183 print_liste_field_titre(
"Numero", $_SERVER[
"PHP_SELF"],
"ptva.num_paiement",
"", $param,
'', $sortfield, $sortorder,
'',
'ChequeOrTransferNumber');
184 if (isModEnabled(
"bank")) {
185 print_liste_field_titre(
"BankTransactionLine", $_SERVER[
"PHP_SELF"],
"ptva.fk_bank",
"", $param,
'', $sortfield, $sortorder);
186 print_liste_field_titre(
"BankAccount", $_SERVER[
"PHP_SELF"],
"bank.ref",
"", $param,
'', $sortfield, $sortorder);
189 print_liste_field_titre(
"ExpectedToPay", $_SERVER[
"PHP_SELF"],
"tva.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
190 print_liste_field_titre(
"PayedByThisPayment", $_SERVER[
"PHP_SELF"],
"ptva.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
193 $sql =
"SELECT tva.rowid, tva.label as label, b.fk_account, ptva.fk_bank";
194 $sql .=
", tva.datev";
195 $sql .=
", tva.amount as total,";
196 $sql .=
" ptva.rowid as pid, ptva.datep, ptva.amount as totalpaid, ptva.num_paiement as num_payment,";
197 $sql .=
" pct.code as payment_code";
198 $sql .=
" FROM " . MAIN_DB_PREFIX .
"tva as tva,";
199 $sql .=
" " . MAIN_DB_PREFIX .
"payment_vat as ptva";
200 $sql .=
" INNER JOIN " . MAIN_DB_PREFIX .
"bank as b ON (b.rowid = ptva.fk_bank)";
201 $sql .=
" INNER JOIN " . MAIN_DB_PREFIX .
"bank_account as bank ON (bank.rowid = b.fk_account)";
202 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"c_paiement as pct ON ptva.fk_typepaiement = pct.id";
203 $sql .=
" WHERE ptva.fk_tva = tva.rowid";
204 $sql .=
" AND tva.entity = " .
$conf->entity;
213 if ($sortfield !==
null
214 && preg_match(
'/^(cs|tva|ptva|pct|bank)\./', $sortfield)
216 $sql .= $db->order($sortfield, $sortorder);
220 $num = $db->num_rows($resql);
226 while ($i < min($num, $limit)) {
227 $obj = $db->fetch_object($resql);
229 $tva->id = $obj->rowid;
230 $tva->ref = $obj->rowid;
231 $tva->label = $obj->label;
233 $payment_vat_static->id = $obj->pid;
234 $payment_vat_static->ref = $obj->pid;
236 print
'<tr class="oddeven">';
239 print
'<td>' . $payment_vat_static->getNomUrl(1) .
"</td>\n";
243 print $tva->getNomUrl(1,
'20');
250 $date = $db->jdate($obj->datev);
251 print
'<td class="center nowraponall">' .
dol_print_date($date,
'day') .
'</td>';
254 $datep = $db->jdate($obj->datep);
255 print
'<td class="center nowraponall">' .
dol_print_date($datep,
'day') .
'</td>';
258 $labelpaymenttype =
'';
259 if ($obj->payment_code) {
260 $labelpaymenttype = $langs->trans(
"PaymentTypeShort" . $obj->payment_code) .
' ';
263 print
'<td class="tdoverflowmax100" title="' .
dol_escape_htmltag($labelpaymenttype) .
'">';
270 if (isModEnabled(
"bank")) {
273 $accountlinestatic->id = $obj->fk_bank;
274 print $accountlinestatic->getNomUrl(1);
280 $account->fetch($obj->fk_account);
281 print $account->getNomUrl(1);
286 print
'<td class="right"><span class="amount">' .
price($obj->total) .
'</span></td>';
289 print
'<td class="right"><span class="amount">';
290 if ($obj->totalpaid) {
291 print
price($obj->totalpaid);
293 print
'</span></td>';
296 $total += $obj->total;
297 $totalpaid += $obj->totalpaid;
302 print
'<tr class="liste_total"><td colspan="3" class="liste_total">' . $langs->trans(
"Total") .
'</td>';
303 print
'<td class="liste_total right"></td>';
304 print
'<td class="center liste_total"> </td>';
305 print
'<td class="center liste_total"> </td>';
306 if (isModEnabled(
"bank")) {
307 print
'<td class="center liste_total"> </td>';
308 print
'<td class="center liste_total"> </td>';
310 print
'<td class="center liste_total"> </td>';
311 print
'<td class="center liste_total"> </td>';
312 print
'<td class="liste_total right">' .
price($totalpaid) .
"</td>";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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 accounts.
Class to manage bank transaction lines.
Class to manage payments of salaries.
Class to manage payments of social contributions.
Class to manage VAT - Value-added tax (also known in French as TVA - Taxe sur la valeur ajoutée)
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
newToken()
Return the value of token currently saved into session with name 'newtoken'.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.