31require
'../../main.inc.php';
32require_once DOL_DOCUMENT_ROOT .
'/compta/tva/class/tva.class.php';
33require_once DOL_DOCUMENT_ROOT .
'/compta/tva/class/tva.class.php';
34require_once DOL_DOCUMENT_ROOT .
'/compta/tva/class/paymentvat.class.php';
35require_once DOL_DOCUMENT_ROOT .
'/compta/bank/class/account.class.php';
36require_once DOL_DOCUMENT_ROOT .
'/salaries/class/paymentsalary.class.php';
37require_once DOL_DOCUMENT_ROOT .
'/core/lib/date.lib.php';
40$langs->loadLangs(array(
'compta',
'bills'));
42$mode =
GETPOST(
"mode",
'alpha');
44$filtre =
GETPOST(
"filtre",
'alpha');
45$optioncss =
GETPOST(
'optioncss',
'alpha');
46if (!$year && $mode !=
'tvaonly') {
47 $year = date(
"Y", time());
51$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
52$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
54if (empty($page) || $page == -1) {
57$offset = $limit * $page;
61 $sortfield =
"ptva.datep";
71 $socid = $user->socid;
81$tva_static =
new Tva($db);
87llxHeader(
'', $langs->trans(
"VATExpensesArea"));
89$title = $langs->trans(
"VATPayments");
92if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
93 $param .=
'&contextpage=' . $contextpage;
95if ($limit > 0 && $limit != $conf->liste_limit) {
96 $param .=
'&limit=' . $limit;
99 $param .=
'&sortfield=' . $sortfield;
102 $param .=
'&sortorder=' . $sortorder;
108 $param .=
'&year=' . $year;
111$sql =
"SELECT tva.rowid, tva.label as label, b.fk_account, ptva.fk_bank";
112$sql .=
", tva.datev";
113$sql .=
", tva.amount as total,";
114$sql .=
" ptva.rowid as pid, ptva.datep, ptva.amount as totalpaid, ptva.num_paiement as num_payment,";
115$sql .=
" pct.code as payment_code";
116$sql .=
" FROM " . MAIN_DB_PREFIX .
"tva as tva,";
117$sql .=
" " . MAIN_DB_PREFIX .
"payment_vat as ptva";
118$sql .=
" INNER JOIN " . MAIN_DB_PREFIX .
"bank as b ON (b.rowid = ptva.fk_bank)";
119$sql .=
" INNER JOIN " . MAIN_DB_PREFIX .
"bank_account as bank ON (bank.rowid = b.fk_account)";
120$sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"c_paiement as pct ON ptva.fk_typepaiement = pct.id";
121$sql .=
" WHERE ptva.fk_tva = tva.rowid";
122$sql .=
" AND tva.entity = " . $conf->entity;
131if (preg_match(
'/^cs\./', $sortfield)
132 || preg_match(
'/^tva\./', $sortfield)
133 || preg_match(
'/^ptva\./', $sortfield)
134 || preg_match(
'/^pct\./', $sortfield)
135 || preg_match(
'/^bank\./', $sortfield)) {
136 $sql .= $db->order($sortfield, $sortorder);
141dol_syslog(
"compta/tva/payments.php: select payment", LOG_DEBUG);
142$resql = $db->query($sql);
144 $num = $db->num_rows($resql);
150print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $num,
'title_accountancy', 0,
'',
'', $limit);
152if (isModEnabled(
'tax') && $user->hasRight(
'tax',
'charges',
'lire')) {
153 print
'<form method="POST" action="' . $_SERVER[
"PHP_SELF"] .
'">';
154 if ($optioncss !=
'') {
155 print
'<input type="hidden" name="optioncss" value="' . $optioncss .
'">';
157 print
'<input type="hidden" name="token" value="' .
newToken() .
'">';
158 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
159 print
'<input type="hidden" name="sortfield" value="' . $sortfield .
'">';
160 print
'<input type="hidden" name="sortorder" value="' . $sortorder .
'">';
161 print
'<input type="hidden" name="page" value="' . $page .
'">';
162 print
'<input type="hidden" name="mode" value="' . $mode .
'">';
164 print
'<div class="div-table-responsive">';
165 print
'<table class="noborder centpercent">';
166 print
'<tr class="liste_titre">';
167 print_liste_field_titre(
"RefPayment", $_SERVER[
"PHP_SELF"],
"ptva.rowid",
"", $param,
'', $sortfield, $sortorder);
168 print_liste_field_titre(
"VATDeclaration", $_SERVER[
"PHP_SELF"],
"tva.rowid",
"", $param,
'', $sortfield, $sortorder);
170 print_liste_field_titre(
"PeriodEndDate", $_SERVER[
"PHP_SELF"],
"tva.datev",
"", $param,
'', $sortfield, $sortorder,
'nowraponall');
171 print_liste_field_titre(
"DatePayment", $_SERVER[
"PHP_SELF"],
"ptva.datep",
"", $param,
'align="center"', $sortfield, $sortorder);
172 print_liste_field_titre(
"PaymentMode", $_SERVER[
"PHP_SELF"],
"pct.code",
"", $param,
'', $sortfield, $sortorder);
173 print_liste_field_titre(
"Numero", $_SERVER[
"PHP_SELF"],
"ptva.num_paiement",
"", $param,
'', $sortfield, $sortorder,
'',
'ChequeOrTransferNumber');
174 if (isModEnabled(
"bank")) {
175 print_liste_field_titre(
"BankTransactionLine", $_SERVER[
"PHP_SELF"],
"ptva.fk_bank",
"", $param,
'', $sortfield, $sortorder);
176 print_liste_field_titre(
"BankAccount", $_SERVER[
"PHP_SELF"],
"bank.ref",
"", $param,
'', $sortfield, $sortorder);
179 print_liste_field_titre(
"ExpectedToPay", $_SERVER[
"PHP_SELF"],
"tva.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
180 print_liste_field_titre(
"PayedByThisPayment", $_SERVER[
"PHP_SELF"],
"ptva.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
183 $sql =
"SELECT tva.rowid, tva.label as label, b.fk_account, ptva.fk_bank";
184 $sql .=
", tva.datev";
185 $sql .=
", tva.amount as total,";
186 $sql .=
" ptva.rowid as pid, ptva.datep, ptva.amount as totalpaid, ptva.num_paiement as num_payment,";
187 $sql .=
" pct.code as payment_code";
188 $sql .=
" FROM " . MAIN_DB_PREFIX .
"tva as tva,";
189 $sql .=
" " . MAIN_DB_PREFIX .
"payment_vat as ptva";
190 $sql .=
" INNER JOIN " . MAIN_DB_PREFIX .
"bank as b ON (b.rowid = ptva.fk_bank)";
191 $sql .=
" INNER JOIN " . MAIN_DB_PREFIX .
"bank_account as bank ON (bank.rowid = b.fk_account)";
192 $sql .=
" LEFT JOIN " . MAIN_DB_PREFIX .
"c_paiement as pct ON ptva.fk_typepaiement = pct.id";
193 $sql .=
" WHERE ptva.fk_tva = tva.rowid";
194 $sql .=
" AND tva.entity = " . $conf->entity;
203 if (preg_match(
'/^cs\./', $sortfield)
204 || preg_match(
'/^tva\./', $sortfield)
205 || preg_match(
'/^ptva\./', $sortfield)
206 || preg_match(
'/^pct\./', $sortfield)
207 || preg_match(
'/^bank\./', $sortfield)) {
208 $sql .= $db->order($sortfield, $sortorder);
212 $num = $db->num_rows($resql);
218 while ($i < min($num, $limit)) {
219 $obj = $db->fetch_object($resql);
221 $tva->id = $obj->rowid;
222 $tva->ref = $obj->rowid;
223 $tva->label = $obj->label;
225 $payment_vat_static->id = $obj->pid;
226 $payment_vat_static->ref = $obj->pid;
228 print
'<tr class="oddeven">';
231 print
'<td>' . $payment_vat_static->getNomUrl(1) .
"</td>\n";
235 print $tva->getNomUrl(1,
'20');
242 $date = $db->jdate($obj->datev);
243 print
'<td class="center nowraponall">' .
dol_print_date($date,
'day') .
'</td>';
246 $datep = $db->jdate($obj->datep);
247 print
'<td class="center nowraponalls">' .
dol_print_date($datep,
'day') .
'</td>';
250 $labelpaymenttype =
'';
251 if ($obj->payment_code) {
252 $labelpaymenttype = $langs->trans(
"PaymentTypeShort" . $obj->payment_code) .
' ';
255 print
'<td class="tdoverflowmax100" title="' .
dol_escape_htmltag($labelpaymenttype) .
'">';
262 if (isModEnabled(
"bank")) {
265 $accountlinestatic->id = $obj->fk_bank;
266 print $accountlinestatic->getNomUrl(1);
272 $account->fetch($obj->fk_account);
273 print $account->getNomUrl(1);
278 print
'<td class="right"><span class="amount">' .
price($obj->total) .
'</span></td>';
281 print
'<td class="right"><span class="amount">';
282 if ($obj->totalpaid) {
283 print
price($obj->totalpaid);
285 print
'</span></td>';
288 $total = $total + $obj->total;
289 $totalpaid = $totalpaid + $obj->totalpaid;
294 print
'<tr class="liste_total"><td colspan="3" class="liste_total">' . $langs->trans(
"Total") .
'</td>';
295 print
'<td class="liste_total right"></td>';
296 print
'<td class="center liste_total"> </td>';
297 print
'<td class="center liste_total"> </td>';
298 if (isModEnabled(
"bank")) {
299 print
'<td class="center liste_total"> </td>';
300 print
'<td class="center liste_total"> </td>';
302 print
'<td class="center liste_total"> </td>';
303 print
'<td class="center liste_total"> </td>';
304 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()
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.
Put here description of your class.
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.
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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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_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...
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.