Merge pull request #13914 from aspangaro/12.0_a27
NEW Add employee in expense report binding page
This commit is contained in:
commit
be641c3d09
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
@ -342,37 +343,41 @@ if ($result) {
|
||||
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
$clickpicto = $form->showCheckAddButtons();
|
||||
print_liste_field_titre($clickpicto, '', '', '', '', '', '', '', 'center ');
|
||||
print "</tr>\n";
|
||||
|
||||
$thirdpartystatic=new Societe($db);
|
||||
$facture_static = new Facture($db);
|
||||
$product_static = new Product($db);
|
||||
$thirdpartystatic=new Societe($db);
|
||||
$facturestatic = new Facture($db);
|
||||
$productstatic = new Product($db);
|
||||
$accountingaccountstatic = new AccountingAccount($db);
|
||||
|
||||
while ($objp = $db->fetch_object($result)) {
|
||||
$codecompta = length_accountg($objp->account_number).' - <span class="opacitymedium">'.$objp->label_compte.'</span>';
|
||||
while ($objp = $db->fetch_object($result))
|
||||
{
|
||||
$accountingaccountstatic->account_number = $objp->account_number;
|
||||
$accountingaccountstatic->label = $objp->label_account;
|
||||
$accountingaccountstatic->labelshort = $objp->labelshort_account;
|
||||
|
||||
$facture_static->ref = $objp->ref;
|
||||
$facture_static->id = $objp->facid;
|
||||
$facture_static->type = $objp->ftype;
|
||||
$facturestatic->ref = $objp->ref;
|
||||
$facturestatic->id = $objp->facid;
|
||||
$facturestatic->type = $objp->ftype;
|
||||
|
||||
$thirdpartystatic->id = $objp->socid;
|
||||
$thirdpartystatic->name = $objp->name;
|
||||
$thirdpartystatic->client = $objp->client;
|
||||
$thirdpartystatic->fournisseur = $objp->fournisseur;
|
||||
$thirdpartystatic->code_client = $objp->code_client;
|
||||
$thirdpartystatic->code_compta_client = $objp->code_compta_client;
|
||||
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
|
||||
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
|
||||
$thirdpartystatic->email = $objp->email;
|
||||
$thirdpartystatic->country_code = $objp->country_code;
|
||||
$thirdpartystatic->id = $objp->socid;
|
||||
$thirdpartystatic->name = $objp->name;
|
||||
$thirdpartystatic->client = $objp->client;
|
||||
$thirdpartystatic->fournisseur = $objp->fournisseur;
|
||||
$thirdpartystatic->code_client = $objp->code_client;
|
||||
$thirdpartystatic->code_compta_client = $objp->code_compta_client;
|
||||
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
|
||||
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
|
||||
$thirdpartystatic->email = $objp->email;
|
||||
$thirdpartystatic->country_code = $objp->country_code;
|
||||
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
$product_static->label = $objp->product_label;
|
||||
$product_static->type = $objp->line_type;
|
||||
$productstatic->ref = $objp->product_ref;
|
||||
$productstatic->id = $objp->product_id;
|
||||
$productstatic->label = $objp->product_label;
|
||||
$productstatic->type = $objp->line_type;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -380,15 +385,15 @@ if ($result) {
|
||||
print '<td>'.$objp->rowid.'</td>';
|
||||
|
||||
// Ref Invoice
|
||||
print '<td class="nowraponall">'.$facture_static->getNomUrl(1).'</td>';
|
||||
print '<td class="nowraponall">'.$facturestatic->getNomUrl(1).'</td>';
|
||||
|
||||
// Date invoice
|
||||
print '<td class="center">'.dol_print_date($db->jdate($objp->datef), 'day').'</td>';
|
||||
|
||||
// Ref Product
|
||||
print '<td>';
|
||||
if ($product_static->id > 0) print $product_static->getNomUrl(1);
|
||||
if ($product_static->id > 0 && $objp->product_label) print '<br>';
|
||||
if ($productstatic->id > 0) print $productstatic->getNomUrl(1);
|
||||
if ($productstatic->id > 0 && $objp->product_label) print '<br>';
|
||||
if ($objp->product_label) print '<span class="opacitymedium">'.$objp->product_label.'</span>';
|
||||
print '</td>';
|
||||
|
||||
@ -415,8 +420,9 @@ if ($result) {
|
||||
|
||||
print '<td>'.$objp->tva_intra.'</td>';
|
||||
|
||||
print '<td>';
|
||||
print $codecompta.' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
|
||||
print '<td class="center">';
|
||||
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
print ' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
|
||||
@ -28,19 +28,22 @@ require '../../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta", "bills", "other", "accountancy", "trips", "productbatch"));
|
||||
$langs->loadLangs(array("compta", "bills", "other", "accountancy", "trips", "productbatch", "hrm"));
|
||||
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
$account_parent = GETPOST('account_parent', 'int');
|
||||
$changeaccount = GETPOST('changeaccount');
|
||||
// Search Getpost
|
||||
$search_login = GETPOST('search_login', 'alpha');
|
||||
$search_expensereport = GETPOST('search_expensereport', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
$search_desc = GETPOST('search_desc', 'alpha');
|
||||
@ -84,7 +87,8 @@ $formaccounting = new FormAccounting($db);
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_expensereport = '';
|
||||
$search_login = '';
|
||||
$search_expensereport = '';
|
||||
$search_label = '';
|
||||
$search_desc = '';
|
||||
$search_amount = '';
|
||||
@ -162,14 +166,21 @@ print '<script type="text/javascript">
|
||||
*/
|
||||
$sql = "SELECT er.ref, er.rowid as erid,";
|
||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht, erd.fk_code_ventilation, erd.tva_tx, erd.vat_src_code, erd.date,";
|
||||
$sql .= " aa.label, aa.account_number,";
|
||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label";
|
||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label,";
|
||||
$sql .= " u.rowid, u.login, u.lastname, u.firstname, u.email, u.gender, u.employee, u.photo, u.statut,";
|
||||
$sql .= " aa.label as label_account, aa.labelshort as labelshort_account, aa.account_number";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as er";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."accounting_account as aa";
|
||||
$sql .= " , ".MAIN_DB_PREFIX."expensereport_det as erd";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."expensereport_det as erd ON er.rowid = erd.fk_expensereport";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
||||
$sql .= " WHERE er.rowid = erd.fk_expensereport and er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <> 0 ";
|
||||
$sql .= " AND aa.rowid = erd.fk_code_ventilation";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = er.fk_user_author";
|
||||
$sql .= " WHERE erd.fk_code_ventilation > 0";
|
||||
$sql .= " AND er.entity IN (".getEntity('expensereport', 0).")"; // We don't share object for accountancy
|
||||
$sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")";
|
||||
// Add search filter like
|
||||
if (strlen(trim($search_login))) {
|
||||
$sql .= natural_search("u.login", $search_login);
|
||||
}
|
||||
if (strlen(trim($search_expensereport))) {
|
||||
$sql .= natural_search("er.ref", $search_expensereport);
|
||||
}
|
||||
@ -218,6 +229,7 @@ if ($result) {
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($search_login) $param .= '&search_login='.urlencode($search_login);
|
||||
if ($search_expensereport) $param .= "&search_expensereport=".urlencode($search_expensereport);
|
||||
if ($search_label) $param .= "&search_label=".urlencode($search_label);
|
||||
if ($search_desc) $param .= "&search_desc=".urlencode($search_desc);
|
||||
@ -250,7 +262,8 @@ if ($result) {
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.'"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td><input type="text" class="flat maxwidth50" name="search_expensereport" value="'.dol_escape_htmltag($search_expensereport).'"></td>';
|
||||
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
|
||||
print '<td class="liste_titre"></td>';
|
||||
@ -265,7 +278,6 @@ if ($result) {
|
||||
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50" name="search_amount" value="'.dol_escape_htmltag($search_amount).'"></td>';
|
||||
print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" placeholder="%" value="'.dol_escape_htmltag($search_vat).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>';
|
||||
print '<td class="liste_titre right"></td>';
|
||||
print '<td class="liste_titre right">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
@ -273,7 +285,8 @@ if ($result) {
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Employees", $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
|
||||
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
|
||||
print_liste_field_titre("DateValidation", $_SERVER["PHP_SELF"], "er.date_valid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
@ -283,27 +296,48 @@ if ($result) {
|
||||
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('');
|
||||
print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
$checkpicto = $form->showCheckAddButtons();
|
||||
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
|
||||
print "</tr>\n";
|
||||
|
||||
$expensereport_static = new ExpenseReport($db);
|
||||
$expensereportstatic = new ExpenseReport($db);
|
||||
$accountingaccountstatic = new AccountingAccount($db);
|
||||
$userstatic = new User($db);
|
||||
|
||||
while ($i < min($num_lines, $limit)) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$codeCompta = length_accountg($objp->account_number).' - <span class="opacitymedium">'.$objp->label.'</span>';
|
||||
|
||||
$expensereport_static->ref = $objp->ref;
|
||||
$expensereport_static->id = $objp->erid;
|
||||
$accountingaccountstatic->account_number = $objp->account_number;
|
||||
$accountingaccountstatic->label = $objp->label_account;
|
||||
$accountingaccountstatic->labelshort = $objp->labelshort_account;
|
||||
|
||||
$expensereportstatic->ref = $objp->ref;
|
||||
$expensereportstatic->id = $objp->erid;
|
||||
|
||||
$userstatic->id = $objp->rowid;
|
||||
$userstatic->ref = $objp->label;
|
||||
$userstatic->login = $objp->login;
|
||||
$userstatic->statut = $objp->statut;
|
||||
$userstatic->email = $objp->email;
|
||||
$userstatic->gender = $objp->gender;
|
||||
$userstatic->firstname = $objp->firstname;
|
||||
$userstatic->lastname = $objp->lastname;
|
||||
$userstatic->employee = $objp->employee;
|
||||
$userstatic->photo = $objp->photo;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Login
|
||||
print '<td class="nowraponall">';
|
||||
print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1);
|
||||
print '</td>';
|
||||
|
||||
// Line id
|
||||
print '<td>'.$objp->rowid.'</td>';
|
||||
|
||||
// Ref Invoice
|
||||
print '<td>'.$expensereport_static->getNomUrl(1).'</td>';
|
||||
// Ref Expense report
|
||||
print '<td>'.$expensereportstatic->getNomUrl(1).'</td>';
|
||||
|
||||
// Date validation
|
||||
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
|
||||
@ -312,21 +346,26 @@ if ($result) {
|
||||
|
||||
print '<td class="center">'.dol_print_date($db->jdate($objp->date), 'day').'</td>';
|
||||
|
||||
// Fees label
|
||||
print '<td class="tdoverflow">'.($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))).'</td>';
|
||||
|
||||
// Fees description -- Can be null
|
||||
print '<td>';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
|
||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
|
||||
print '</td>';
|
||||
|
||||
// Amount without taxes
|
||||
print '<td class="nowrap right">'.price($objp->total_ht).'</td>';
|
||||
|
||||
// Vat rate
|
||||
print '<td class="center">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>';
|
||||
|
||||
print '<td>'.$codeCompta.'</td>';
|
||||
|
||||
print '<td class="left"><a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
|
||||
// Accounting account affected
|
||||
print '<td class="center">';
|
||||
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
print ' <a class="editfielda reposition marginleftonly marginrightonly" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
require '../../main.inc.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.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.'/core/lib/accounting.lib.php';
|
||||
@ -35,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "trips", "productbatch"));
|
||||
$langs->loadLangs(array("bills", "companies", "compta", "accountancy", "other", "trips", "productbatch", "hrm"));
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
@ -50,6 +51,7 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always ''
|
||||
$mesCasesCochees = GETPOST('toselect', 'array');
|
||||
|
||||
// Search Getpost
|
||||
$search_login = GETPOST('search_login', 'alpha');
|
||||
$search_lineid = GETPOST('search_lineid', 'alpha');
|
||||
$search_expensereport = GETPOST('search_expensereport', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
@ -100,6 +102,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
|
||||
// Purge search criteria
|
||||
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_login = '';
|
||||
$search_expensereport = '';
|
||||
$search_label = '';
|
||||
$search_desc = '';
|
||||
@ -189,13 +192,18 @@ if (empty($chartaccountcode))
|
||||
$sql = "SELECT er.ref, er.rowid as erid, er.date_debut, er.date_valid,";
|
||||
$sql .= " erd.rowid, erd.fk_c_type_fees, erd.comments, erd.total_ht as price, erd.fk_code_ventilation, erd.tva_tx as tva_tx_line, erd.vat_src_code, erd.date,";
|
||||
$sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label, f.accountancy_code as code_buy,";
|
||||
$sql .= " u.rowid, u.login, u.lastname, u.firstname, u.email, u.gender, u.employee, u.photo, u.statut,";
|
||||
$sql .= " aa.rowid as aarowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as er";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."expensereport_det as erd ON er.rowid = erd.fk_expensereport";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = er.fk_user_author";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON f.accountancy_code = aa.account_number AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " WHERE er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0";
|
||||
// Add search filter like
|
||||
if (strlen(trim($search_login))) {
|
||||
$sql .= natural_search("u.login", $search_login);
|
||||
}
|
||||
if (strlen(trim($search_expensereport))) {
|
||||
$sql .= natural_search("er.ref", $search_expensereport);
|
||||
}
|
||||
@ -245,6 +253,7 @@ if ($result) {
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($search_login) $param .= '&search_login='.urlencode($search_login);
|
||||
if ($search_lineid) $param .= '&search_lineid='.urlencode($search_lineid);
|
||||
if ($search_day) $param .= '&search_day='.urlencode($search_day);
|
||||
if ($search_month) $param .= '&search_month='.urlencode($search_month);
|
||||
@ -289,6 +298,7 @@ if ($result) {
|
||||
|
||||
// We add search filter
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.'"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_expensereport" value="'.dol_escape_htmltag($search_expensereport).'"></td>';
|
||||
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
|
||||
@ -312,6 +322,7 @@ if ($result) {
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Employee", $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
|
||||
if (! empty($conf->global->ACCOUNTANCY_USE_EXPENSE_REPORT_VALIDATION_DATE)) {
|
||||
@ -331,6 +342,7 @@ if ($result) {
|
||||
|
||||
|
||||
$expensereport_static = new ExpenseReport($db);
|
||||
$userstatic = new User($db);
|
||||
$form = new Form($db);
|
||||
|
||||
while ($i < min($num_lines, $limit)) {
|
||||
@ -342,7 +354,23 @@ if ($result) {
|
||||
$expensereport_static->ref = $objp->ref;
|
||||
$expensereport_static->id = $objp->erid;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
$userstatic->id = $objp->rowid;
|
||||
$userstatic->ref = $objp->label;
|
||||
$userstatic->login = $objp->login;
|
||||
$userstatic->statut = $objp->statut;
|
||||
$userstatic->email = $objp->email;
|
||||
$userstatic->gender = $objp->gender;
|
||||
$userstatic->firstname = $objp->firstname;
|
||||
$userstatic->lastname = $objp->lastname;
|
||||
$userstatic->employee = $objp->employee;
|
||||
$userstatic->photo = $objp->photo;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Login
|
||||
print '<td class="nowraponall">';
|
||||
print $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1);
|
||||
print '</td>';
|
||||
|
||||
// Line id
|
||||
print '<td>'.$objp->rowid.'</td>';
|
||||
@ -370,6 +398,7 @@ if ($result) {
|
||||
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
|
||||
print '</td>';
|
||||
|
||||
// Amount without taxes
|
||||
print '<td class="nowrap right">';
|
||||
print price($objp->price);
|
||||
print '</td>';
|
||||
|
||||
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
@ -346,38 +347,42 @@ if ($result) {
|
||||
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||
$checkpicto = $form->showCheckAddButtons();
|
||||
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
|
||||
print "</tr>\n";
|
||||
|
||||
$thirdpartystatic = new Societe($db);
|
||||
$thirdpartystatic = new Societe($db);
|
||||
$facturefournisseur_static = new FactureFournisseur($db);
|
||||
$product_static = new ProductFournisseur($db);
|
||||
$productstatic = new ProductFournisseur($db);
|
||||
$accountingaccountstatic = new AccountingAccount($db);
|
||||
|
||||
while ($i < min($num_lines, $limit)) {
|
||||
while ($i < min($num_lines, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$codecompta = length_accountg($objp->account_number).' - <span class="opacitymedium">'.$objp->label.'</span>';
|
||||
$accountingaccountstatic->account_number = $objp->account_number;
|
||||
$accountingaccountstatic->label = $objp->label_account;
|
||||
$accountingaccountstatic->labelshort = $objp->labelshort_account;
|
||||
|
||||
$facturefournisseur_static->ref = $objp->ref;
|
||||
$facturefournisseur_static->id = $objp->facid;
|
||||
|
||||
$thirdpartystatic->id = $objp->socid;
|
||||
$thirdpartystatic->name = $objp->name;
|
||||
$thirdpartystatic->client = $objp->client;
|
||||
$thirdpartystatic->fournisseur = $objp->fournisseur;
|
||||
$thirdpartystatic->code_client = $objp->code_client;
|
||||
$thirdpartystatic->code_compta_client = $objp->code_compta_client;
|
||||
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
|
||||
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
|
||||
$thirdpartystatic->email = $objp->email;
|
||||
$thirdpartystatic->country_code = $objp->country_code;
|
||||
$thirdpartystatic->id = $objp->socid;
|
||||
$thirdpartystatic->name = $objp->name;
|
||||
$thirdpartystatic->client = $objp->client;
|
||||
$thirdpartystatic->fournisseur = $objp->fournisseur;
|
||||
$thirdpartystatic->code_client = $objp->code_client;
|
||||
$thirdpartystatic->code_compta_client = $objp->code_compta_client;
|
||||
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
|
||||
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
|
||||
$thirdpartystatic->email = $objp->email;
|
||||
$thirdpartystatic->country_code = $objp->country_code;
|
||||
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
$product_static->label = $objp->product_label;
|
||||
$product_static->type = $objp->line_type;
|
||||
$productstatic->ref = $objp->product_ref;
|
||||
$productstatic->id = $objp->product_id;
|
||||
$productstatic->label = $objp->product_label;
|
||||
$productstatic->type = $objp->line_type;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -425,8 +430,9 @@ if ($result) {
|
||||
|
||||
print '<td>'.$objp->tva_intra.'</td>';
|
||||
|
||||
print '<td>';
|
||||
print $codecompta.' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
|
||||
print '<td class="center">';
|
||||
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
print ' <a class="editfielda" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="'.$objp->rowid.'"/></td>';
|
||||
|
||||
@ -320,7 +320,7 @@ if ($result) {
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($search_societe) $param.='&search_societe='.urlencode($search_societe);
|
||||
if ($search_societe) $param .= '&search_societe='.urlencode($search_societe);
|
||||
if ($search_lineid) $param .= '&search_lineid='.urlencode($search_lineid);
|
||||
if ($search_day) $param .= '&search_day='.urlencode($search_day);
|
||||
if ($search_month) $param .= '&search_month='.urlencode($search_month);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user