Task #1378 : show only the ledger of a given type

This commit is contained in:
Dany De Bontridder 2017-12-17 18:47:21 +01:00
parent 28b2bce30b
commit 689dfc28be
3 changed files with 46 additions and 1 deletions

View file

@ -3002,4 +3002,44 @@ function pin (object_id) {
);
$('pin_'+object_id).firstChild.innerHTML="≊";
}
}
/**
* Show only the rows into the table (p_table_id) with the attribute (p_attribute_name) and if this attribute
* has the value of (attribut_value)
* @param p_table_id table id
* @param p_attribute_name the name of the attribute
* @param p_attribute_value the value of the attribute we want to show
*/
function show_only_row(p_table_id,p_attribute_name,p_attribute_value)
{
if ( ! $(p_table_id)) {
throw "Invalide table id"
}
var mTable=$(p_table_id) ;
var ncount=mTable.rows.length
for (var i = 0;i < ncount;i++) {
var mRow=mTable.rows[i];
if (mRow.getAttribute(p_attribute_name) != undefined && mRow.getAttribute(p_attribute_name)!=p_attribute_value){
mRow.hide();
} else {
mRow.show();
}
}
}
/**
* Show all the rows into the table (p_table_id)
* @param p_table_id table id
*/
function show_all_row(p_table_id)
{
if ( ! $(p_table_id)) {
throw "Invalide table id"
}
var mTable=$(p_table_id) ;
var ncount=mTable.rows.length
for (var i = 0;i < ncount;i++) {
var mRow=mTable.rows[i];
mRow.show();
}
}

View file

@ -159,6 +159,11 @@ switch ($sa)
// Display list of ledgers
//////////////////////////////////////////////////////////////////////////
if ( $show_menu == 1 ) {
echo HtmlInput::anchor_action(_("Tout"), 'show_all_row(\'cfgledger_table_id\')','ledger_all_bt','smallbutton ');
echo HtmlInput::anchor_action(_("Financier"), 'show_only_row(\'cfgledger_table_id\',\'ledger_type\',\'FIN\')','ledger_fin_bt','smallbutton ');
echo HtmlInput::anchor_action(_("Achat"), 'show_only_row(\'cfgledger_table_id\',\'ledger_type\',\'ACH\')','ledger_ach_bt','smallbutton ');
echo HtmlInput::anchor_action(_("Opérations Diverses"), 'show_only_row(\'cfgledger_table_id\',\'ledger_type\',\'ODS\')','ledger_ods_bt','smallbutton ');
echo HtmlInput::anchor_action(_("Vente"), 'show_only_row(\'cfgledger_table_id\',\'ledger_type\',\'VEN\')','ledger_ven_bt','smallbutton ');
echo '<div class="content">';
echo $ledger->listing();
echo '</div>';

View file

@ -2617,7 +2617,7 @@ class Acc_Ledger extends jrn_def_sql
{
$l_line=Database::fetch_array($ret, $i);
$url=$base_url."&sa=detail&p_jrn=".$l_line['jrn_def_id'];
$r.=sprintf('<TR><TD><A HREF="%s">%s</A></TD></TR>', $url,
$r.=sprintf('<TR ledger_type="%s"><TD><A HREF="%s">%s</A></TD></TR>', $l_line['jrn_def_type'],$url,
h($l_line['jrn_def_name']).' ('.$l_line['jrn_def_type'].')');
}
$r.="</TABLE>";