Add selectable columns for extra payments
This commit is contained in:
parent
e7088810aa
commit
870443a099
@ -2,6 +2,7 @@
|
|||||||
/* Copyright (C) 2017-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
/* Copyright (C) 2017-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||||
|
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -29,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("compta", "banks", "bills", "accountancy"));
|
$langs->loadLangs(array("compta", "banks", "bills", "accountancy"));
|
||||||
@ -44,11 +46,14 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
|||||||
$search_ref = GETPOST('search_ref', 'int');
|
$search_ref = GETPOST('search_ref', 'int');
|
||||||
$search_user = GETPOST('search_user', 'alpha');
|
$search_user = GETPOST('search_user', 'alpha');
|
||||||
$search_label = GETPOST('search_label', 'alpha');
|
$search_label = GETPOST('search_label', 'alpha');
|
||||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
|
$search_datep_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
|
||||||
$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
|
$search_datep_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
|
||||||
|
$search_datev_start = dol_mktime(0, 0, 0, GETPOST('search_date_value_startmonth', 'int'), GETPOST('search_date_value_startday', 'int'), GETPOST('search_date_value_startyear', 'int'));
|
||||||
|
$search_datev_end = dol_mktime(23, 59, 59, GETPOST('search_date_value_endmonth', 'int'), GETPOST('search_date_value_endday', 'int'), GETPOST('search_date_value_endyear', 'int'));
|
||||||
$search_amount_deb = GETPOST('search_amount_deb', 'alpha');
|
$search_amount_deb = GETPOST('search_amount_deb', 'alpha');
|
||||||
$search_amount_cred = GETPOST('search_amount_cred', 'alpha');
|
$search_amount_cred = GETPOST('search_amount_cred', 'alpha');
|
||||||
$search_account = GETPOST('search_account', 'int');
|
$search_bank_account = GETPOST('search_account', 'int');
|
||||||
|
$search_bank_entry = GETPOST('search_bank_entry', 'int');
|
||||||
$search_accountancy_account = GETPOST("search_accountancy_account");
|
$search_accountancy_account = GETPOST("search_accountancy_account");
|
||||||
if ($search_accountancy_account == - 1) $search_accountancy_account = '';
|
if ($search_accountancy_account == - 1) $search_accountancy_account = '';
|
||||||
$search_accountancy_subledger = GETPOST("search_accountancy_subledger");
|
$search_accountancy_subledger = GETPOST("search_accountancy_subledger");
|
||||||
@ -81,18 +86,51 @@ if (!GETPOST('typeid'))
|
|||||||
|
|
||||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_ref = "";
|
$search_ref = '';
|
||||||
$search_label = "";
|
$search_label = '';
|
||||||
$search_date_start = '';
|
$search_datep_start = '';
|
||||||
$search_date_end = '';
|
$search_datep_end = '';
|
||||||
$search_amount_deb = "";
|
$search_datev_start = '';
|
||||||
$search_amount_cred = "";
|
$search_datev_end = '';
|
||||||
$search_account = '';
|
$search_amount_deb = '';
|
||||||
|
$search_amount_cred = '';
|
||||||
|
$search_bank_account = '';
|
||||||
|
$search_bank_entry = '';
|
||||||
$search_accountancy_account = '';
|
$search_accountancy_account = '';
|
||||||
$search_accountancy_subledger = '';
|
$search_accountancy_subledger = '';
|
||||||
$typeid = "";
|
$typeid = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Definition of fields for lists
|
||||||
|
$arrayfields = array(
|
||||||
|
'ref' =>array('label'=>"Ref", 'checked'=>1, 'position'=>100),
|
||||||
|
'label' =>array('label'=>"Label", 'checked'=>1, 'position'=>110),
|
||||||
|
'datep' =>array('label'=>"DatePayment", 'checked'=>1, 'position'=>120),
|
||||||
|
'datev' =>array('label'=>"DateValue", 'checked'=>1, 'position'=>130),
|
||||||
|
'type' =>array('label'=>"PaymentMode", 'checked'=>1, 'position'=>140),
|
||||||
|
'project' =>array('label'=>"Project", 'checked'=>1, 'position'=>200, "enabled"=>!empty($conf->projet->enabled)),
|
||||||
|
'bank' =>array('label'=>"BankAccount", 'checked'=>1, 'position'=>300, "enabled"=>!empty($conf->banque->enabled)),
|
||||||
|
'entry' =>array('label'=>"BankTransactionLine", 'checked'=>1, 'position'=>310, "enabled"=>!empty($conf->banque->enabled)),
|
||||||
|
'account' =>array('label'=>"AccountAccountingShort", 'checked'=>1, 'position'=>400, "enabled"=>!empty($conf->accounting->enabled)),
|
||||||
|
'subledger' =>array('label'=>"SubledgerAccount", 'checked'=>1, 'position'=>410, "enabled"=>!empty($conf->accounting->enabled)),
|
||||||
|
'debit' =>array('label'=>"Debit", 'checked'=>1, 'position'=>500),
|
||||||
|
'credit' =>array('label'=>"Credit", 'checked'=>1, 'position'=>510),
|
||||||
|
);
|
||||||
|
|
||||||
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook)) {
|
||||||
|
// Selection of new fields
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -101,11 +139,15 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
$formaccounting = new FormAccounting($db);
|
if ($arrayfields['account']['checked'] || $arrayfields['subledger']['checked']) $formaccounting = new FormAccounting($db);
|
||||||
$variousstatic = new PaymentVarious($db);
|
if ($arrayfields['bank']['checked'] && !empty($conf->accounting->enabled)) $accountingjournal = new AccountingJournal($db);
|
||||||
$accountstatic = new Account($db);
|
if ($arrayfields['ref']['checked']) $variousstatic = new PaymentVarious($db);
|
||||||
|
if ($arrayfields['bank']['checked']) $accountstatic = new Account($db);
|
||||||
|
if ($arrayfields['project']['checked']) $proj = new Project($db);
|
||||||
|
if ($arrayfields['entry']['checked']) $bankline = new AccountLine($db);
|
||||||
|
if ($arrayfields['account']['checked']) $accountingaccount = new AccountingAccount($db);
|
||||||
|
|
||||||
$sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code, v.subledger_account,";
|
$sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code, v.subledger_account, v.fk_projet as fk_project,";
|
||||||
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
|
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
|
||||||
$sql .= " pst.code as payment_code";
|
$sql .= " pst.code as payment_code";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
$sql .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
||||||
@ -117,11 +159,14 @@ $sql .= " WHERE v.entity IN (".getEntity('payment_various').")";
|
|||||||
// Search criteria
|
// Search criteria
|
||||||
if ($search_ref) $sql .= " AND v.rowid=".$db->escape($search_ref);
|
if ($search_ref) $sql .= " AND v.rowid=".$db->escape($search_ref);
|
||||||
if ($search_label) $sql .= natural_search(array('v.label'), $search_label);
|
if ($search_label) $sql .= natural_search(array('v.label'), $search_label);
|
||||||
if ($search_date_start) $sql .= " AND v.datep >= '".$db->idate($search_date_start)."'";
|
if ($search_datep_start) $sql .= " AND v.datep >= '".$db->idate($search_datep_start)."'";
|
||||||
if ($search_date_end) $sql .= " AND v.datep <= '".$db->idate($search_date_end)."'";
|
if ($search_datep_end) $sql .= " AND v.datep <= '".$db->idate($search_datep_end)."'";
|
||||||
|
if ($search_datev_start) $sql .= " AND v.datev >= '".$db->idate($search_datev_start)."'";
|
||||||
|
if ($search_datev_end) $sql .= " AND v.datev <= '".$db->idate($search_datev_end)."'";
|
||||||
if ($search_amount_deb) $sql .= natural_search("v.amount", $search_amount_deb, 1);
|
if ($search_amount_deb) $sql .= natural_search("v.amount", $search_amount_deb, 1);
|
||||||
if ($search_amount_cred) $sql .= natural_search("v.amount", $search_amount_cred, 1);
|
if ($search_amount_cred) $sql .= natural_search("v.amount", $search_amount_cred, 1);
|
||||||
if ($search_account > 0) $sql .= " AND b.fk_account=".$db->escape($search_account);
|
if ($search_bank_account > 0) $sql .= " AND b.fk_account=".$db->escape($search_bank_account);
|
||||||
|
if ($search_bank_entry > 0) $sql .= " AND b.fk_account=".$db->escape($search_bank_account);
|
||||||
if ($search_accountancy_account > 0) $sql .= " AND v.accountancy_code=".$db->escape($search_accountancy_account);
|
if ($search_accountancy_account > 0) $sql .= " AND v.accountancy_code=".$db->escape($search_accountancy_account);
|
||||||
if ($search_accountancy_subledger > 0) $sql .= " AND v.subledger_account=".$db->escape($search_accountancy_subledger);
|
if ($search_accountancy_subledger > 0) $sql .= " AND v.subledger_account=".$db->escape($search_accountancy_subledger);
|
||||||
if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid;
|
if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid;
|
||||||
@ -154,10 +199,10 @@ if ($result)
|
|||||||
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
||||||
if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start);
|
if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start);
|
||||||
if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end);
|
if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end);
|
||||||
if ($typeid > 0) $param .= '&typeid='.urlencode($typeid);
|
if ($typeid > 0) $param .= '&typeid='.urlencode($typeid);
|
||||||
if ($search_amount_deb) $param .= '&search_amount_deb='.urlencode($search_amount_deb);
|
if ($search_amount_deb) $param .= '&search_amount_deb='.urlencode($search_amount_deb);
|
||||||
if ($search_amount_cred) $param .= '&search_amount_cred='.urlencode($search_amount_cred);
|
if ($search_amount_cred) $param .= '&search_amount_cred='.urlencode($search_amount_cred);
|
||||||
if ($search_account > 0) $param .= '&search_amount='.urlencode($search_account);
|
if ($search_bank_account > 0) $param .= '&search_amount='.urlencode($search_bank_account);
|
||||||
if ($search_accountancy_account > 0) $param .= '&search_accountancy_account='.urlencode($search_accountancy_account);
|
if ($search_accountancy_account > 0) $param .= '&search_accountancy_account='.urlencode($search_accountancy_account);
|
||||||
if ($search_accountancy_subledger > 0) $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger);
|
if ($search_accountancy_subledger > 0) $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger);
|
||||||
|
|
||||||
@ -177,59 +222,104 @@ if ($result)
|
|||||||
print '<input type="hidden" name="action" value="list">';
|
print '<input type="hidden" name="action" value="list">';
|
||||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
|
|
||||||
print_barre_liste($langs->trans("MenuVariousPayment"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
print_barre_liste($langs->trans("MenuVariousPayment"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||||
|
|
||||||
|
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||||
|
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||||
|
|
||||||
print '<div class="div-table-responsive">';
|
print '<div class="div-table-responsive">';
|
||||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|
||||||
|
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<td class="liste_titre left">';
|
if ($arrayfields['ref']['checked']) {
|
||||||
print '<input class="flat" type="text" size="3" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
print '<td class="liste_titre left">';
|
||||||
print '</td>';
|
print '<input class="flat" type="text" size="3" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
if ($arrayfields['label']['checked']) {
|
||||||
|
|
||||||
// Date
|
|
||||||
print '<td class="liste_titre center">';
|
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('From').' ';
|
|
||||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
|
|
||||||
print '</div>';
|
|
||||||
print '<div class="nowrap">';
|
|
||||||
print $langs->trans('to').' ';
|
|
||||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
|
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Type
|
|
||||||
print '<td class="liste_titre left">';
|
|
||||||
$form->select_types_paiements($typeid, 'typeid', '', 0, 1, 1, 16);
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Account
|
|
||||||
if (!empty($conf->banque->enabled))
|
|
||||||
{
|
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
$form->select_comptes($search_account, 'search_account', 0, '', 1);
|
print '<input type="text" class="flat" size="10" name="search_label" value="'.dol_escape_htmltag($search_label).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Payment date
|
||||||
|
if ($arrayfields['datep']['checked']) {
|
||||||
|
print '<td class="liste_titre center">';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('From').' ';
|
||||||
|
print $form->selectDate($search_datep_start ? $search_datep_start : -1, 'search_date_start', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to').' ';
|
||||||
|
print $form->selectDate($search_datep_end ? $search_datep_end : -1, 'search_date_end', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Value date
|
||||||
|
if ($arrayfields['datev']['checked']) {
|
||||||
|
print '<td class="liste_titre center">';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('From').' ';
|
||||||
|
print $form->selectDate($search_datev_start ? $search_datev_start : -1, 'search_date_value_start', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to').' ';
|
||||||
|
print $form->selectDate($search_datev_end ? $search_datev_end : -1, 'search_date_value_end', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Payment type
|
||||||
|
if ($arrayfields['type']['checked']) {
|
||||||
|
print '<td class="liste_titre left">';
|
||||||
|
$form->select_types_paiements($typeid, 'typeid', '', 0, 1, 1, 16);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Project
|
||||||
|
if ($arrayfields['project']['checked']) {
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
// TODO
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bank account
|
||||||
|
if ($arrayfields['bank']['checked']) {
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
$form->select_comptes($search_bank_account, 'search_account', 0, '', 1);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bank entry
|
||||||
|
if ($arrayfields['entry']['checked']) {
|
||||||
|
print '<td class="liste_titre right">';
|
||||||
|
print '<input name="search_bank_entry" class="flat" type="text" size="8" value="'.$search_bank_entry.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accounting account
|
// Accounting account
|
||||||
if (!empty($conf->accounting->enabled))
|
if ($arrayfields['account']['checked']) {
|
||||||
{
|
|
||||||
// Accounting account
|
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array(), 1, 1, 'maxwidth200');
|
print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array(), 1, 1, 'maxwidth200');
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
// Subledger account
|
// Subledger account
|
||||||
|
if ($arrayfields['subledger']['checked']) {
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, 'maxwidth200');
|
print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, 'maxwidth200');
|
||||||
@ -238,31 +328,50 @@ if ($result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Debit
|
// Debit
|
||||||
print '<td class="liste_titre right"><input name="search_amount_deb" class="flat" type="text" size="8" value="'.$search_amount_deb.'"></td>';
|
if ($arrayfields['debit']['checked']) {
|
||||||
|
print '<td class="liste_titre right">';
|
||||||
|
print '<input name="search_amount_deb" class="flat" type="text" size="8" value="'.$search_amount_deb.'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
// Credit
|
// Credit
|
||||||
print '<td class="liste_titre right"><input name="search_amount_cred" class="flat" type="text" size="8" value="'.$search_amount_cred.'"></td>';
|
if ($arrayfields['credit']['checked']) {
|
||||||
|
print '<td class="liste_titre right">';
|
||||||
|
print '<input name="search_amount_cred" class="flat" type="text" size="8" value="'.$search_amount_cred.'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
print '<td class="liste_titre maxwidthsearch">';
|
print '<td class="liste_titre maxwidthsearch">';
|
||||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||||
print $searchpicto;
|
print $searchpicto;
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print "</tr>\n";
|
print '</tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "v.rowid", "", $param, "", $sortfield, $sortorder);
|
|
||||||
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "v.label", "", $param, '', $sortfield, $sortorder, 'left ');
|
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep,v.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
|
||||||
print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'left ');
|
if ($arrayfields['ref']['checked']) print_liste_field_titre($arrayfields['ref']['label'], $_SERVER["PHP_SELF"], 'v.rowid', '', $param, '', $sortfield, $sortorder);
|
||||||
if (!empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
|
if ($arrayfields['label']['checked']) print_liste_field_titre($arrayfields['label']['label'], $_SERVER["PHP_SELF"], 'v.label', '', $param, '', $sortfield, $sortorder, 'left ');
|
||||||
if (!empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccountingShort", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left ');
|
if ($arrayfields['datep']['checked']) print_liste_field_titre($arrayfields['datep']['label'], $_SERVER["PHP_SELF"], 'v.datep,v.rowid', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||||
if (!empty($conf->accounting->enabled)) print_liste_field_titre("SubledgerAccount", $_SERVER["PHP_SELF"], "v.subledger_account", "", $param, '', $sortfield, $sortorder, 'left ');
|
if ($arrayfields['datev']['checked']) print_liste_field_titre($arrayfields['datev']['label'], $_SERVER["PHP_SELF"], 'v.datev,v.rowid', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||||
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right ');
|
if ($arrayfields['type']['checked']) print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], 'type', '', $param, '', $sortfield, $sortorder, 'left ');
|
||||||
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right ');
|
if ($arrayfields['project']['checked']) print_liste_field_titre($arrayfields['project']['label'], $_SERVER["PHP_SELF"], 'fk_project', '', $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
|
if ($arrayfields['bank']['checked']) print_liste_field_titre($arrayfields['bank']['label'], $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder);
|
||||||
print "</tr>\n";
|
if ($arrayfields['entry']['checked']) print_liste_field_titre($arrayfields['entry']['label'], $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder);
|
||||||
|
if ($arrayfields['account']['checked']) print_liste_field_titre($arrayfields['account']['label'], $_SERVER["PHP_SELF"], 'v.accountancy_code', '', $param, '', $sortfield, $sortorder, 'left ');
|
||||||
|
if ($arrayfields['subledger']['checked']) print_liste_field_titre($arrayfields['subledger']['label'], $_SERVER["PHP_SELF"], 'v.subledger_account', '', $param, '', $sortfield, $sortorder, 'left ');
|
||||||
|
if ($arrayfields['debit']['checked']) print_liste_field_titre($arrayfields['debit']['label'], $_SERVER["PHP_SELF"], 'v.amount', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||||
|
if ($arrayfields['credit']['checked']) print_liste_field_titre($arrayfields['credit']['label'], $_SERVER["PHP_SELF"], 'v.amount', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||||
|
|
||||||
|
// Fields from hook
|
||||||
|
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||||
|
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
|
||||||
$totalarray = array();
|
$totalarray = array();
|
||||||
@ -272,28 +381,53 @@ if ($result)
|
|||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
$variousstatic->id = $obj->rowid;
|
// No
|
||||||
$variousstatic->ref = $obj->rowid;
|
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
|
||||||
|
print '<td>'.(($offset * $limit) + $i).'</td>';
|
||||||
|
}
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print "<td>".$variousstatic->getNomUrl(1)."</td>\n";
|
if ($arrayfields['ref']['checked']) {
|
||||||
if (!$i) $totalarray['nbfield']++;
|
$variousstatic->id = $obj->rowid;
|
||||||
|
$variousstatic->ref = $obj->rowid;
|
||||||
|
print "<td>".$variousstatic->getNomUrl(1)."</td>";
|
||||||
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Label payment
|
// Label payment
|
||||||
print "<td>".dol_trunc($obj->label, 40)."</td>\n";
|
if ($arrayfields['label']['checked']) {
|
||||||
if (!$i) $totalarray['nbfield']++;
|
print "<td>".dol_trunc($obj->label, 40)."</td>";
|
||||||
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Date payment
|
// Date payment
|
||||||
print '<td class="center">'.dol_print_date($db->jdate($obj->datep), 'day')."</td>\n";
|
if ($arrayfields['datep']['checked']) {
|
||||||
if (!$i) $totalarray['nbfield']++;
|
print '<td class="center">'.dol_print_date($obj->datep, 'day')."</td>";
|
||||||
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Date value
|
||||||
|
if ($arrayfields['datev']['checked']) {
|
||||||
|
print '<td class="center">'.dol_print_date($obj->datev, 'day')."</td>";
|
||||||
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
|
if ($arrayfields['type']['checked']) {
|
||||||
if (!$i) $totalarray['nbfield']++;
|
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
|
||||||
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Account
|
// Project
|
||||||
if (!empty($conf->banque->enabled))
|
if ($arrayfields['project']['checked']) {
|
||||||
{
|
$proj->fetch($obj->fk_project);
|
||||||
|
print '<td>'.$proj->getNomUrl(1).'</td>';
|
||||||
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bank account
|
||||||
|
if ($arrayfields['bank']['checked']) {
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($obj->bid > 0)
|
if ($obj->bid > 0)
|
||||||
{
|
{
|
||||||
@ -303,22 +437,27 @@ if ($result)
|
|||||||
|
|
||||||
if (!empty($conf->accounting->enabled)) {
|
if (!empty($conf->accounting->enabled)) {
|
||||||
$accountstatic->account_number = $obj->bank_account_number;
|
$accountstatic->account_number = $obj->bank_account_number;
|
||||||
|
|
||||||
$accountingjournal = new AccountingJournal($db);
|
|
||||||
$accountingjournal->fetch($obj->accountancy_journal);
|
$accountingjournal->fetch($obj->accountancy_journal);
|
||||||
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
|
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$accountstatic->label = $obj->blabel;
|
$accountstatic->label = $obj->blabel;
|
||||||
print $accountstatic->getNomUrl(1);
|
print $accountstatic->getNomUrl(1);
|
||||||
} else print ' ';
|
} else {
|
||||||
print '</td>';
|
print ' ';
|
||||||
if (!$i) $totalarray['nbfield']++;
|
print '</td>';
|
||||||
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bank entry
|
||||||
|
if ($arrayfields['entry']['checked']) {
|
||||||
|
$bankline->fetch($obj->fk_bank);
|
||||||
|
print '<td>'.$bankline->getNomUrl(1).'</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accounting account
|
// Accounting account
|
||||||
if (!empty($conf->accounting->enabled)) {
|
if ($arrayfields['account']['checked']) {
|
||||||
$accountingaccount = new AccountingAccount($db);
|
|
||||||
$accountingaccount->fetch('', $obj->accountancy_code, 1);
|
$accountingaccount->fetch('', $obj->accountancy_code, 1);
|
||||||
|
|
||||||
print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
|
print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 1).'</td>';
|
||||||
@ -326,38 +465,42 @@ if ($result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Accounting subledger account
|
// Accounting subledger account
|
||||||
if (!empty($conf->accounting->enabled))
|
if ($arrayfields['subledger']['checked']) {
|
||||||
{
|
|
||||||
print '<td>'.length_accounta($obj->subledger_account).'</td>';
|
print '<td>'.length_accounta($obj->subledger_account).'</td>';
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debit
|
// Debit
|
||||||
print '<td class="nowrap right">';
|
if ($arrayfields['debit']['checked']) {
|
||||||
if ($obj->sens == 0)
|
print '<td class="nowrap right">';
|
||||||
{
|
if ($obj->sens == 0)
|
||||||
print price($obj->amount);
|
{
|
||||||
$totalarray['val']['total_deb'] += $obj->amount;
|
print price($obj->amount);
|
||||||
|
$totalarray['val']['total_deb'] += $obj->amount;
|
||||||
|
}
|
||||||
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_deb';
|
||||||
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (!$i) $totalarray['nbfield']++;
|
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_deb';
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Credit
|
// Credit
|
||||||
print '<td class="nowrap right">';
|
if ($arrayfields['credit']['checked']) {
|
||||||
if ($obj->sens == 1)
|
print '<td class="nowrap right">';
|
||||||
{
|
if ($obj->sens == 1)
|
||||||
print price($obj->amount);
|
{
|
||||||
$totalarray['val']['total_cred'] += $obj->amount;
|
print price($obj->amount);
|
||||||
|
$totalarray['val']['total_cred'] += $obj->amount;
|
||||||
|
}
|
||||||
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_cred';
|
||||||
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (!$i) $totalarray['nbfield']++;
|
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_cred';
|
|
||||||
print '</td>';
|
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
|
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>";
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user