Merge pull request #13471 from atm-florianm/NEW_add_author_column_on_invoice_list_and_supplier_invoice_list
NEW: "author" column in the client/supplier invoice lists
This commit is contained in:
commit
bb9a4324d1
@ -87,6 +87,7 @@ $search_montant_vat = GETPOST('search_montant_vat', 'alpha');
|
|||||||
$search_montant_localtax1 = GETPOST('search_montant_localtax1', 'alpha');
|
$search_montant_localtax1 = GETPOST('search_montant_localtax1', 'alpha');
|
||||||
$search_montant_localtax2 = GETPOST('search_montant_localtax2', 'alpha');
|
$search_montant_localtax2 = GETPOST('search_montant_localtax2', 'alpha');
|
||||||
$search_montant_ttc = GETPOST('search_montant_ttc', 'alpha');
|
$search_montant_ttc = GETPOST('search_montant_ttc', 'alpha');
|
||||||
|
$search_login=GETPOST('search_login', 'alpha');
|
||||||
$search_multicurrency_code = GETPOST('search_multicurrency_code', 'alpha');
|
$search_multicurrency_code = GETPOST('search_multicurrency_code', 'alpha');
|
||||||
$search_multicurrency_tx = GETPOST('search_multicurrency_tx', 'alpha');
|
$search_multicurrency_tx = GETPOST('search_multicurrency_tx', 'alpha');
|
||||||
$search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'alpha');
|
$search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'alpha');
|
||||||
@ -186,6 +187,7 @@ $arrayfields = array(
|
|||||||
'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax1_assuj == "1"), 'position'=>110),
|
'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax1_assuj == "1"), 'position'=>110),
|
||||||
'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax2_assuj == "1"), 'position'=>120),
|
'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>($mysoc->localtax2_assuj == "1"), 'position'=>120),
|
||||||
'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0, 'position'=>130),
|
'f.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0, 'position'=>130),
|
||||||
|
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>135),
|
||||||
'dynamount_payed'=>array('label'=>"Received", 'checked'=>0, 'position'=>140),
|
'dynamount_payed'=>array('label'=>"Received", 'checked'=>0, 'position'=>140),
|
||||||
'rtp'=>array('label'=>"Rest", 'checked'=>0, 'position'=>150), // Not enabled by default because slow
|
'rtp'=>array('label'=>"Rest", 'checked'=>0, 'position'=>150), // Not enabled by default because slow
|
||||||
'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>160),
|
'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>160),
|
||||||
@ -248,6 +250,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
|
|||||||
$search_montant_localtax1 = '';
|
$search_montant_localtax1 = '';
|
||||||
$search_montant_localtax2 = '';
|
$search_montant_localtax2 = '';
|
||||||
$search_montant_ttc = '';
|
$search_montant_ttc = '';
|
||||||
|
$search_login='';
|
||||||
$search_multicurrency_code = '';
|
$search_multicurrency_code = '';
|
||||||
$search_multicurrency_tx = '';
|
$search_multicurrency_tx = '';
|
||||||
$search_multicurrency_montant_ht = '';
|
$search_multicurrency_montant_ht = '';
|
||||||
@ -400,6 +403,7 @@ $sql = 'SELECT';
|
|||||||
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
||||||
$sql .= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
|
$sql .= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
|
||||||
$sql .= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
|
$sql .= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
|
||||||
|
$sql .= ' f.fk_user_author,';
|
||||||
$sql .= ' f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva as multicurrency_total_vat, f.multicurrency_total_ttc,';
|
$sql .= ' f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva as multicurrency_total_vat, f.multicurrency_total_ttc,';
|
||||||
$sql .= ' f.datef as df, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,';
|
$sql .= ' f.datef as df, f.date_lim_reglement as datelimite, f.module_source, f.pos_source,';
|
||||||
$sql .= ' f.paye as paye, f.fk_statut, f.close_code,';
|
$sql .= ' f.paye as paye, f.fk_statut, f.close_code,';
|
||||||
@ -409,7 +413,8 @@ $sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.
|
|||||||
$sql .= " typent.code as typent_code,";
|
$sql .= " typent.code as typent_code,";
|
||||||
$sql .= " state.code_departement as state_code, state.nom as state_name,";
|
$sql .= " state.code_departement as state_code, state.nom as state_name,";
|
||||||
$sql .= " country.code as country_code,";
|
$sql .= " country.code as country_code,";
|
||||||
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
|
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
|
||||||
|
$sql .= " u.login";
|
||||||
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
|
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
|
||||||
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
|
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
|
||||||
if (!$sall) $sql .= ', SUM(pf.amount) as dynamount_payed, SUM(pf.multicurrency_amount) as multicurrency_dynamount_payed';
|
if (!$sall) $sql .= ', SUM(pf.amount) as dynamount_payed, SUM(pf.multicurrency_amount) as multicurrency_dynamount_payed';
|
||||||
@ -441,6 +446,7 @@ if ($search_user > 0)
|
|||||||
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
|
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||||
}
|
}
|
||||||
|
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'user AS u ON f.fk_user_author = u.rowid';
|
||||||
$sql .= ' WHERE f.fk_soc = s.rowid';
|
$sql .= ' WHERE f.fk_soc = s.rowid';
|
||||||
$sql .= ' AND f.entity IN ('.getEntity('invoice').')';
|
$sql .= ' AND f.entity IN ('.getEntity('invoice').')';
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
@ -482,6 +488,7 @@ if ($search_multicurrency_tx != '') $sql .= natural_search('f.multicurrency_tx',
|
|||||||
if ($search_multicurrency_montant_ht != '') $sql .= natural_search('f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
|
if ($search_multicurrency_montant_ht != '') $sql .= natural_search('f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
|
||||||
if ($search_multicurrency_montant_vat != '') $sql .= natural_search('f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
|
if ($search_multicurrency_montant_vat != '') $sql .= natural_search('f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
|
||||||
if ($search_multicurrency_montant_ttc != '') $sql .= natural_search('f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
|
if ($search_multicurrency_montant_ttc != '') $sql .= natural_search('f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
|
||||||
|
if ($search_login) $sql .= natural_search('u.login', $search_login);
|
||||||
if ($search_categ_cus > 0) $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
|
if ($search_categ_cus > 0) $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
|
||||||
if ($search_categ_cus == -2) $sql .= " AND cc.fk_categorie IS NULL";
|
if ($search_categ_cus == -2) $sql .= " AND cc.fk_categorie IS NULL";
|
||||||
if ($search_status != '-1' && $search_status != '')
|
if ($search_status != '-1' && $search_status != '')
|
||||||
@ -608,6 +615,7 @@ if ($resql)
|
|||||||
if ($search_zip) $param .= '&search_zip='.urlencode($search_zip);
|
if ($search_zip) $param .= '&search_zip='.urlencode($search_zip);
|
||||||
if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale);
|
if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale);
|
||||||
if ($search_user > 0) $param .= '&search_user='.urlencode($search_user);
|
if ($search_user > 0) $param .= '&search_user='.urlencode($search_user);
|
||||||
|
if ($search_login) $param .= '&search_login='.urlencode($search_login);
|
||||||
if ($search_product_category > 0) $param .= '&search_product_category='.urlencode($search_product_category);
|
if ($search_product_category > 0) $param .= '&search_product_category='.urlencode($search_product_category);
|
||||||
if ($search_montant_ht != '') $param .= '&search_montant_ht='.urlencode($search_montant_ht);
|
if ($search_montant_ht != '') $param .= '&search_montant_ht='.urlencode($search_montant_ht);
|
||||||
if ($search_montant_vat != '') $param .= '&search_montant_vat='.urlencode($search_montant_vat);
|
if ($search_montant_vat != '') $param .= '&search_montant_vat='.urlencode($search_montant_vat);
|
||||||
@ -906,6 +914,13 @@ if ($resql)
|
|||||||
print '<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).'">';
|
print '<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
if (! empty($arrayfields['u.login']['checked']))
|
||||||
|
{
|
||||||
|
// Author
|
||||||
|
print '<td class="liste_titre" align="center">';
|
||||||
|
print '<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
if (!empty($arrayfields['f.retained_warranty']['checked']))
|
if (!empty($arrayfields['f.retained_warranty']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre" align="right">';
|
print '<td class="liste_titre" align="right">';
|
||||||
@ -1029,6 +1044,7 @@ if ($resql)
|
|||||||
if (!empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, 'class="right"', $sortfield, $sortorder);
|
if (!empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||||
if (!empty($arrayfields['f.total_localtax2']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax2']['label'], $_SERVER['PHP_SELF'], 'f.localtax2', '', $param, 'class="right"', $sortfield, $sortorder);
|
if (!empty($arrayfields['f.total_localtax2']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax2']['label'], $_SERVER['PHP_SELF'], 'f.localtax2', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||||
if (!empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.total_ttc', '', $param, 'class="right"', $sortfield, $sortorder);
|
if (!empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.total_ttc', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||||
|
if (!empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||||
if (!empty($arrayfields['f.retained_warranty']['checked'])) print_liste_field_titre($arrayfields['f.retained_warranty']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder);
|
if (!empty($arrayfields['f.retained_warranty']['checked'])) print_liste_field_titre($arrayfields['f.retained_warranty']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder);
|
||||||
if (!empty($arrayfields['dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
if (!empty($arrayfields['dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||||
if (!empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
if (!empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||||
@ -1054,6 +1070,7 @@ if ($resql)
|
|||||||
|
|
||||||
$projectstatic = new Project($db);
|
$projectstatic = new Project($db);
|
||||||
$discount = new DiscountAbsolute($db);
|
$discount = new DiscountAbsolute($db);
|
||||||
|
$userstatic = new User($db);
|
||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
@ -1374,6 +1391,18 @@ if ($resql)
|
|||||||
$totalarray['val']['f.total_ttc'] += $obj->total_ttc;
|
$totalarray['val']['f.total_ttc'] += $obj->total_ttc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Author
|
||||||
|
if (! empty($arrayfields['u.login']['checked']))
|
||||||
|
{
|
||||||
|
$userstatic->id = $obj->fk_user_author;
|
||||||
|
$userstatic->login = $obj->login;
|
||||||
|
print '<td align="center">';
|
||||||
|
if ($userstatic->id) print $userstatic->getLoginUrl(1);
|
||||||
|
else print ' ';
|
||||||
|
print "</td>\n";
|
||||||
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($arrayfields['f.retained_warranty']['checked']))
|
if (!empty($arrayfields['f.retained_warranty']['checked']))
|
||||||
{
|
{
|
||||||
print '<td align="right">'.(!empty($obj->retained_warranty) ?price($obj->retained_warranty).'%' : ' ').'</td>';
|
print '<td align="right">'.(!empty($obj->retained_warranty) ?price($obj->retained_warranty).'%' : ' ').'</td>';
|
||||||
|
|||||||
@ -84,6 +84,7 @@ $search_montant_vat = GETPOST('search_montant_vat', 'alpha');
|
|||||||
$search_montant_localtax1 = GETPOST('search_montant_localtax1', 'alpha');
|
$search_montant_localtax1 = GETPOST('search_montant_localtax1', 'alpha');
|
||||||
$search_montant_localtax2 = GETPOST('search_montant_localtax2', 'alpha');
|
$search_montant_localtax2 = GETPOST('search_montant_localtax2', 'alpha');
|
||||||
$search_montant_ttc = GETPOST('search_montant_ttc', 'alpha');
|
$search_montant_ttc = GETPOST('search_montant_ttc', 'alpha');
|
||||||
|
$search_login=GETPOST('search_login', 'alpha');
|
||||||
$search_multicurrency_code = GETPOST('search_multicurrency_code', 'alpha');
|
$search_multicurrency_code = GETPOST('search_multicurrency_code', 'alpha');
|
||||||
$search_multicurrency_tx = GETPOST('search_multicurrency_tx', 'alpha');
|
$search_multicurrency_tx = GETPOST('search_multicurrency_tx', 'alpha');
|
||||||
$search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'alpha');
|
$search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'alpha');
|
||||||
@ -170,6 +171,7 @@ $arrayfields = array(
|
|||||||
'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax1_assuj == "1"),
|
'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax1_assuj == "1"),
|
||||||
'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax2_assuj == "1"),
|
'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax2_assuj == "1"),
|
||||||
'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
|
'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
|
||||||
|
'u.login'=>array('label'=>"Author", 'checked'=>1),
|
||||||
'dynamount_payed'=>array('label'=>$langs->trans("Payed"), 'checked'=>0),
|
'dynamount_payed'=>array('label'=>$langs->trans("Payed"), 'checked'=>0),
|
||||||
'rtp'=>array('label'=>$langs->trans("Rest"), 'checked'=>0),
|
'rtp'=>array('label'=>$langs->trans("Rest"), 'checked'=>0),
|
||||||
'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||||
@ -230,6 +232,7 @@ if (empty($reshook))
|
|||||||
$search_montant_localtax1 = '';
|
$search_montant_localtax1 = '';
|
||||||
$search_montant_localtax2 = '';
|
$search_montant_localtax2 = '';
|
||||||
$search_montant_ttc = '';
|
$search_montant_ttc = '';
|
||||||
|
$search_login='';
|
||||||
$search_multicurrency_code = '';
|
$search_multicurrency_code = '';
|
||||||
$search_multicurrency_tx = '';
|
$search_multicurrency_tx = '';
|
||||||
$search_multicurrency_montant_ht = '';
|
$search_multicurrency_montant_ht = '';
|
||||||
@ -288,11 +291,13 @@ $sql .= " f.total_ht, f.total_ttc, f.total_tva as total_vat, f.paye as paye, f.f
|
|||||||
$sql .= " f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,";
|
$sql .= " f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,";
|
||||||
$sql .= ' f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva as multicurrency_total_vat, f.multicurrency_total_ttc,';
|
$sql .= ' f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva as multicurrency_total_vat, f.multicurrency_total_ttc,';
|
||||||
$sql .= " f.note_public, f.note_private,";
|
$sql .= " f.note_public, f.note_private,";
|
||||||
|
$sql .= " f.fk_user_author,";
|
||||||
$sql .= " s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,";
|
$sql .= " s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,";
|
||||||
$sql .= " typent.code as typent_code,";
|
$sql .= " typent.code as typent_code,";
|
||||||
$sql .= " state.code_departement as state_code, state.nom as state_name,";
|
$sql .= " state.code_departement as state_code, state.nom as state_name,";
|
||||||
$sql .= " country.code as country_code,";
|
$sql .= " country.code as country_code,";
|
||||||
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
|
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
|
||||||
|
$sql .= " u.login";
|
||||||
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
|
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
|
||||||
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
|
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
|
||||||
if (!$search_all) $sql .= ', SUM(pf.amount) as dynamount_payed';
|
if (!$search_all) $sql .= ', SUM(pf.amount) as dynamount_payed';
|
||||||
@ -321,6 +326,7 @@ if ($search_user > 0)
|
|||||||
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
|
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||||
}
|
}
|
||||||
|
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'user AS u ON f.fk_user_author = u.rowid';
|
||||||
$sql .= ' WHERE f.fk_soc = s.rowid';
|
$sql .= ' WHERE f.fk_soc = s.rowid';
|
||||||
$sql .= ' AND f.entity IN ('.getEntity('facture_fourn').')';
|
$sql .= ' AND f.entity IN ('.getEntity('facture_fourn').')';
|
||||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
@ -359,6 +365,7 @@ if ($search_multicurrency_tx != '') $sql .= natural_search('f.multicurrency_tx',
|
|||||||
if ($search_multicurrency_montant_ht != '') $sql .= natural_search('f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
|
if ($search_multicurrency_montant_ht != '') $sql .= natural_search('f.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
|
||||||
if ($search_multicurrency_montant_vat != '') $sql .= natural_search('f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
|
if ($search_multicurrency_montant_vat != '') $sql .= natural_search('f.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
|
||||||
if ($search_multicurrency_montant_ttc != '') $sql .= natural_search('f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
|
if ($search_multicurrency_montant_ttc != '') $sql .= natural_search('f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
|
||||||
|
if ($search_login) $sql .= natural_search('u.login', $search_login);
|
||||||
if ($search_status != '' && $search_status >= 0) $sql .= " AND f.fk_statut = ".$db->escape($search_status);
|
if ($search_status != '' && $search_status >= 0) $sql .= " AND f.fk_statut = ".$db->escape($search_status);
|
||||||
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode."";
|
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode."";
|
||||||
$sql .= dolSqlDateFilter("f.datef", $day, $month, $year);
|
$sql .= dolSqlDateFilter("f.datef", $day, $month, $year);
|
||||||
@ -470,6 +477,7 @@ if ($resql)
|
|||||||
if ($search_type != '') $param .= '&search_type='.urlencode($search_type);
|
if ($search_type != '') $param .= '&search_type='.urlencode($search_type);
|
||||||
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
||||||
if ($search_company) $param .= '&search_company='.urlencode($search_company);
|
if ($search_company) $param .= '&search_company='.urlencode($search_company);
|
||||||
|
if ($search_login) $param .= '&search_login='.urlencode($search_login);
|
||||||
if ($search_montant_ht != '') $param .= '&search_montant_ht='.urlencode($search_montant_ht);
|
if ($search_montant_ht != '') $param .= '&search_montant_ht='.urlencode($search_montant_ht);
|
||||||
if ($search_montant_vat != '') $param .= '&search_montant_vat='.urlencode($search_montant_vat);
|
if ($search_montant_vat != '') $param .= '&search_montant_vat='.urlencode($search_montant_vat);
|
||||||
if ($search_montant_localtax1 != '') $param .= '&search_montant_localtax1='.urlencode($search_montant_localtax1);
|
if ($search_montant_localtax1 != '') $param .= '&search_montant_localtax1='.urlencode($search_montant_localtax1);
|
||||||
@ -759,6 +767,13 @@ if ($resql)
|
|||||||
print '<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).'">';
|
print '<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
if (! empty($arrayfields['u.login']['checked']))
|
||||||
|
{
|
||||||
|
// Author
|
||||||
|
print '<td class="liste_titre" align="center">';
|
||||||
|
print '<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
if (!empty($arrayfields['dynamount_payed']['checked']))
|
if (!empty($arrayfields['dynamount_payed']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre right">';
|
print '<td class="liste_titre right">';
|
||||||
@ -869,6 +884,7 @@ if ($resql)
|
|||||||
if (!empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, '', $sortfield, $sortorder, 'right ');
|
if (!empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||||
if (!empty($arrayfields['f.total_localtax2']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax2']['label'], $_SERVER['PHP_SELF'], 'f.localtax2', '', $param, '', $sortfield, $sortorder, 'right ');
|
if (!empty($arrayfields['f.total_localtax2']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax2']['label'], $_SERVER['PHP_SELF'], 'f.localtax2', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||||
if (!empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.total_ttc', '', $param, '', $sortfield, $sortorder, 'right ');
|
if (!empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.total_ttc', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||||
|
if (!empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||||
if (!empty($arrayfields['dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right ');
|
if (!empty($arrayfields['dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||||
if (!empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right ');
|
if (!empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||||
if (!empty($arrayfields['f.multicurrency_code']['checked'])) print_liste_field_titre($arrayfields['f.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_code', '', $param, '', $sortfield, $sortorder);
|
if (!empty($arrayfields['f.multicurrency_code']['checked'])) print_liste_field_titre($arrayfields['f.multicurrency_code']['label'], $_SERVER['PHP_SELF'], 'f.multicurrency_code', '', $param, '', $sortfield, $sortorder);
|
||||||
@ -893,6 +909,7 @@ if ($resql)
|
|||||||
$facturestatic = new FactureFournisseur($db);
|
$facturestatic = new FactureFournisseur($db);
|
||||||
$supplierstatic = new Fournisseur($db);
|
$supplierstatic = new Fournisseur($db);
|
||||||
$projectstatic = new Project($db);
|
$projectstatic = new Project($db);
|
||||||
|
$userstatic = new User($db);
|
||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0)
|
||||||
{
|
{
|
||||||
@ -1131,6 +1148,18 @@ if ($resql)
|
|||||||
$totalarray['val']['f.total_ttc'] += $obj->total_ttc;
|
$totalarray['val']['f.total_ttc'] += $obj->total_ttc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Author
|
||||||
|
if (! empty($arrayfields['u.login']['checked']))
|
||||||
|
{
|
||||||
|
$userstatic->id = $obj->fk_user_author;
|
||||||
|
$userstatic->login = $obj->login;
|
||||||
|
print '<td align="center">';
|
||||||
|
if ($userstatic->id) print $userstatic->getLoginUrl(1);
|
||||||
|
else print ' ';
|
||||||
|
print "</td>\n";
|
||||||
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($arrayfields['dynamount_payed']['checked']))
|
if (!empty($arrayfields['dynamount_payed']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="right nowrap">'.(!empty($totalpay) ?price($totalpay, 0, $langs) : ' ').'</td>'; // TODO Use a denormalized field
|
print '<td class="right nowrap">'.(!empty($totalpay) ?price($totalpay, 0, $langs) : ' ').'</td>'; // TODO Use a denormalized field
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user