31 require
'../../main.inc.php';
32 require_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/tva.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/tva.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/compta/tva/class/paymentvat.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/salaries/class/paymentsalary.class.php';
37 require_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');
46 if (!$year && $mode !=
'tvaonly') {
47 $year = date(
"Y", time());
50 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
51 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
52 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
54 if (empty($page) || $page == -1) {
57 $offset = $limit * $page;
58 $pageprev = $page - 1;
59 $pagenext = $page + 1;
61 $sortfield =
"ptva.datep";
67 $object =
new Tva($db);
71 $socid = $user->socid;
81 $tva_static =
new Tva($db);
87 llxHeader(
'', $langs->trans(
"VATExpensesArea"));
89 $title = $langs->trans(
"VATPayments");
92 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
93 $param .=
'&contextpage='.$contextpage;
95 if ($limit > 0 && $limit != $conf->liste_limit) {
96 $param .=
'&limit='.$limit;
99 $param .=
'&sortfield='.$sortfield;
102 $param .=
'&sortorder='.$sortorder;
106 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
107 if ($optioncss !=
'') {
108 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
110 print
'<input type="hidden" name="token" value="'.newToken().
'">';
111 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
112 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
113 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
114 print
'<input type="hidden" name="page" value="'.$page.
'">';
115 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
119 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines,
'title_accountancy', 0,
'',
'', $limit);
122 $param .=
'&year='.$year;
125 if (
isModEnabled(
'tax') && $user->rights->tax->charges->lire) {
126 print
'<div class="div-table-responsive">';
127 print
'<table class="noborder centpercent">';
128 print
'<tr class="liste_titre">';
129 print_liste_field_titre(
"RefPayment", $_SERVER[
"PHP_SELF"],
"ptva.rowid",
"", $param,
'', $sortfield, $sortorder);
130 print_liste_field_titre(
"VATDeclaration", $_SERVER[
"PHP_SELF"],
"tva.rowid",
"", $param,
'', $sortfield, $sortorder);
132 print_liste_field_titre(
"PeriodEndDate", $_SERVER[
"PHP_SELF"],
"tva.datev",
"", $param,
'', $sortfield, $sortorder,
'nowraponall');
133 print_liste_field_titre(
"DatePayment", $_SERVER[
"PHP_SELF"],
"ptva.datep",
"", $param,
'align="center"', $sortfield, $sortorder);
134 print_liste_field_titre(
"PaymentMode", $_SERVER[
"PHP_SELF"],
"pct.code",
"", $param,
'', $sortfield, $sortorder);
135 print_liste_field_titre(
"Numero", $_SERVER[
"PHP_SELF"],
"ptva.num_paiement",
"", $param,
'', $sortfield, $sortorder,
'',
'ChequeOrTransferNumber');
137 print_liste_field_titre(
"BankTransactionLine", $_SERVER[
"PHP_SELF"],
"ptva.fk_bank",
"", $param,
'', $sortfield, $sortorder);
138 print_liste_field_titre(
"BankAccount", $_SERVER[
"PHP_SELF"],
"bank.ref",
"", $param,
'', $sortfield, $sortorder);
141 print_liste_field_titre(
"ExpectedToPay", $_SERVER[
"PHP_SELF"],
"tva.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
142 print_liste_field_titre(
"PayedByThisPayment", $_SERVER[
"PHP_SELF"],
"ptva.amount",
"", $param,
'class="right"', $sortfield, $sortorder);
145 $sql =
"SELECT tva.rowid, tva.label as label, b.fk_account, ptva.fk_bank";
146 $sql .=
", tva.datev";
147 $sql .=
", tva.amount as total,";
148 $sql .=
" ptva.rowid as pid, ptva.datep, ptva.amount as totalpaid, ptva.num_paiement as num_payment,";
149 $sql .=
" pct.code as payment_code";
150 $sql .=
" FROM ".MAIN_DB_PREFIX.
"tva as tva,";
151 $sql .=
" ".MAIN_DB_PREFIX.
"payment_vat as ptva";
152 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"bank as b ON (b.rowid = ptva.fk_bank)";
153 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"bank_account as bank ON (bank.rowid = b.fk_account)";
154 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_paiement as pct ON ptva.fk_typepaiement = pct.id";
155 $sql .=
" WHERE ptva.fk_tva = tva.rowid";
156 $sql .=
" AND tva.entity = ".$conf->entity;
165 if (preg_match(
'/^cs\./', $sortfield)
166 || preg_match(
'/^tva\./', $sortfield)
167 || preg_match(
'/^ptva\./', $sortfield)
168 || preg_match(
'/^pct\./', $sortfield)
169 || preg_match(
'/^bank\./', $sortfield)) {
170 $sql .= $db->order($sortfield, $sortorder);
175 dol_syslog(
"compta/tva/payments.php: select payment", LOG_DEBUG);
176 $resql = $db->query($sql);
178 $num = $db->num_rows(
$resql);
184 while ($i < min($num, $limit)) {
185 $obj = $db->fetch_object(
$resql);
187 $tva->id = $obj->rowid;
188 $tva->ref = $obj->rowid;
189 $tva->label = $obj->label;
191 $payment_vat_static->id = $obj->pid;
192 $payment_vat_static->ref = $obj->pid;
194 print
'<tr class="oddeven">';
197 print
'<td>'.$payment_vat_static->getNomUrl(1).
"</td>\n";
201 print $tva->getNomUrl(1,
'20');
205 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->label).
'">'.
dol_escape_htmltag($obj->label).
'</td>';
208 $date = $db->jdate($obj->datev);
209 print
'<td class="center nowraponall">'.dol_print_date($date,
'day').
'</td>';
212 $datep = $db->jdate($obj->datep);
213 print
'<td class="center nowraponalls">'.dol_print_date($datep,
'day').
'</td>';
216 $labelpaymenttype =
'';
217 if ($obj->payment_code) {
218 $labelpaymenttype = $langs->trans(
"PaymentTypeShort".$obj->payment_code).
' ';
221 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labelpaymenttype).
'">';
226 print
'<td>'.dol_escape_htmltag($obj->num_payment).
'</td>';
231 $accountlinestatic->id = $obj->fk_bank;
232 print $accountlinestatic->getNomUrl(1);
238 $account->fetch($obj->fk_account);
239 print $account->getNomUrl(1);
244 print
'<td class="right"><span class="amount">'.price($obj->total).
'</span></td>';
247 print
'<td class="right"><span class="amount">';
248 if ($obj->totalpaid) {
249 print
price($obj->totalpaid);
251 print
'</span></td>';
254 $total = $total + $obj->total;
255 $totalnb = $totalnb + $obj->nb;
256 $totalpaid = $totalpaid + $obj->totalpaid;
261 print
'<tr class="liste_total"><td colspan="3" class="liste_total">'.$langs->trans(
"Total").
'</td>';
262 print
'<td class="liste_total right"></td>';
263 print
'<td align="center" class="liste_total"> </td>';
264 print
'<td align="center" class="liste_total"> </td>';
266 print
'<td align="center" class="liste_total"> </td>';
267 print
'<td align="center" class="liste_total"> </td>';
269 print
'<td align="center" class="liste_total"> </td>';
270 print
'<td align="center" class="liste_total"> </td>';
271 print
'<td class="liste_total right">'.price($totalpaid).
"</td>";
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.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
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.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
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.
print_barre_liste($titre, $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.
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_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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.