Search operation : all, paid or unpaid, including the CSV export and
the filter
This commit is contained in:
parent
c3e7bc0c31
commit
9e5b19d6d3
6 changed files with 44 additions and 26 deletions
|
|
@ -1298,7 +1298,9 @@ function manage_search_filter(p_obj) {
|
|||
* @see Acc_Ledger_Search
|
||||
*/
|
||||
function save_filter(p_div,p_dossier) {
|
||||
var elt=['ledger_type','nb_jrn','date_start','date_end','date_paid_start','date_paid_end','desc','amount_min','amount_max','qcode','accounting'];
|
||||
var elt=['ledger_type','nb_jrn','date_start','date_end',
|
||||
'date_paid_start','date_paid_end','desc','amount_min','amount_max','qcode','accounting',
|
||||
'operation_filter'];
|
||||
var eltValue={};
|
||||
eltValue['gDossier']=p_dossier;
|
||||
eltValue['op']="save_filter";
|
||||
|
|
@ -1322,8 +1324,6 @@ function save_filter(p_div,p_dossier) {
|
|||
|
||||
}
|
||||
}
|
||||
//unpaid
|
||||
eltValue['unpaid']=$(p_div+"unpaid").checked;
|
||||
new Ajax.Request('ajax_misc.php', {
|
||||
method:"POST",
|
||||
parameters:eltValue,
|
||||
|
|
@ -1361,7 +1361,8 @@ function load_filter(p_div,p_dossier,p_filter_id) {
|
|||
try {
|
||||
var answer=req.responseJSON;
|
||||
console.log(answer);
|
||||
var elt=['ledger_type','date_start','date_end','date_paid_start','date_paid_end','desc','amount_min','amount_max','qcode','accounting'];
|
||||
var elt=['ledger_type','date_start','date_end','date_paid_start','date_paid_end',
|
||||
'desc','amount_min','amount_max','qcode','accounting','operation_filter'];
|
||||
for (var i=0;i<elt.length;i++) {
|
||||
var idx=elt[i];
|
||||
$(p_div+idx).value=answer[elt[i]];
|
||||
|
|
@ -1386,12 +1387,7 @@ function load_filter(p_div,p_dossier,p_filter_id) {
|
|||
eltHidden.setAttribute("value",answer.r_jrn[i]);
|
||||
eltLedgerId.appendChild(eltHidden);
|
||||
}
|
||||
if ( answer.unpaid == 'false') {
|
||||
$(p_div+"unpaid").checked=false;
|
||||
}
|
||||
if ( answer.unpaid == 'true') {
|
||||
$(p_div+"unpaid").checked=true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (e) {
|
||||
|
|
@ -1411,7 +1407,7 @@ identification element UL manage{div}
|
|||
*/
|
||||
|
||||
function delete_filter (p_div,p_dossier,p_filter_id) {
|
||||
new Ajax.Request("ajax_misc",{
|
||||
new Ajax.Request("ajax_misc.php",{
|
||||
parameters:{"gDossier":p_dossier,"div":p_div,"filter_id":p_filter_id,'op':"delete_search_operation"},
|
||||
method:"POST",
|
||||
onSuccess:function (req) {
|
||||
|
|
@ -1456,5 +1452,5 @@ function reset_filter(p_div) {
|
|||
eltLedgerId.appendChild(eltHidden);
|
||||
|
||||
// By default , unpaid is uncked
|
||||
$(p_div+"unpaid").checked=false;
|
||||
$(p_div+"operation_filter").value="all";
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ if ($op=='save_filter')
|
|||
$http->post("date_paid_start", 'string', NULL));
|
||||
$new->setp("date_paid_end", $http->post("date_paid_end", 'string', NULL));
|
||||
$new->setp("ledger_type", $http->post("ledger_type", 'string'));
|
||||
$new->setp("unpaid", $http->post("unpaid", 'string', NULL));
|
||||
$new->setp("operation_filter", $http->post("operation_filter", 'string', NULL));
|
||||
$new->setp("filter_name", h($http->post("filter_name", 'string')));
|
||||
$aJrn=[];
|
||||
$max=$http->post("nb_jrn");
|
||||
|
|
|
|||
|
|
@ -204,15 +204,23 @@ class Acc_Ledger_Search
|
|||
$f_accounting->set_attribute('account', $this->div.'accounting');
|
||||
$info=Icon_Action::infobulle(13);
|
||||
|
||||
$f_paid=new ICheckbox('unpaid', null, $this->div.'unpaid');
|
||||
$f_paid->selected=(isset($_REQUEST['unpaid']))?true:false;
|
||||
// Status of the operation : paid, unpaid or all
|
||||
$f_paid=new ISelect('operation_filter', null, $this->div.'operation_filter');
|
||||
$f_paid->value=array(["value"=>'all',"label"=>_("Toutes")],
|
||||
["value"=>'unpaid',"label"=>_("Non payées")],
|
||||
["value"=>'paid',"label"=>_("Payées")]
|
||||
);
|
||||
$f_paid->selected=$http->request("operation_filter","string","all");
|
||||
|
||||
$r.=dossier::hidden();
|
||||
$r.=HtmlInput::hidden('ledger_type', $this->type,
|
||||
$this->div."ledger_type");
|
||||
$r.=HtmlInput::hidden('ac', $_REQUEST['ac']);
|
||||
$r.=HtmlInput::hidden('ac', $http->request('ac'));
|
||||
|
||||
// to avoid to find a given operation
|
||||
if (isset($_REQUEST['hide_operation']))
|
||||
$r.=HtmlInput::hidden("hide_operation", $_REQUEST['hide_operation']);
|
||||
$r.=HtmlInput::hidden("hide_operation", $http->request('hide_operation'));
|
||||
|
||||
ob_start();
|
||||
$search_filter=$this->build_search_filter();
|
||||
require_once NOALYSS_TEMPLATE.'/ledger_search.php';
|
||||
|
|
@ -526,12 +534,26 @@ class Acc_Ledger_Search
|
|||
$and=" and ";
|
||||
}
|
||||
|
||||
// Only the unpaid
|
||||
if (isset($unpaid))
|
||||
{
|
||||
$fil_paid=$and.SQL_LIST_UNPAID_INVOICE;
|
||||
$and=" and ";
|
||||
// Only the unpaid, paid or all
|
||||
if ( isset($operation_filter)) {
|
||||
switch ($operation_filter) {
|
||||
case "unpaid":
|
||||
$fil_paid=$and."(jr_rapt is null or jr_rapt = '') and jr_valid = true ";
|
||||
$and=" and ";
|
||||
break;
|
||||
case "all":
|
||||
$fil_paid="";
|
||||
break;
|
||||
case "paid":
|
||||
$fil_paid=$and."(jr_rapt is not null or jr_rapt = 'paid') and jr_valid = true ";
|
||||
$and=" and ";
|
||||
break;
|
||||
default:
|
||||
throw new Exception(_("ALS01 Etat inconnu"),10);
|
||||
|
||||
}
|
||||
}
|
||||
// Operations which must not be seen in the result
|
||||
if ( isset ($hide_operation) && trim($hide_operation) !="")
|
||||
{
|
||||
$fil_hide_operation=$and.sprintf( ' jr_id not in (%s)',sql_string($hide_operation));
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) {
|
|||
if ( ! defined ("SYSINFO_DISPLAY")) {
|
||||
define ("SYSINFO_DISPLAY",TRUE);
|
||||
}
|
||||
define ("DBVERSION",140);
|
||||
define ("DBVERSION",141);
|
||||
define ("MONO_DATABASE",25);
|
||||
define ("DBVERSIONREPO",18);
|
||||
define ('NOTFOUND','--not found--');
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class User_filter_SQL extends Noalyss_SQL
|
|||
, "date_paid_end"=>"date_paid_end"
|
||||
, "ledger_type"=>"ledger_type"
|
||||
, "all_ledger"=>"all_ledger"
|
||||
,"unpaid"=>"unpaid"
|
||||
,"operation_filter"=>"operation_filter"
|
||||
,'filter_name'=>"filter_name"
|
||||
);
|
||||
/*
|
||||
|
|
@ -76,7 +76,7 @@ class User_filter_SQL extends Noalyss_SQL
|
|||
, "date_paid_end"=>"text"
|
||||
, "ledger_type"=>"text"
|
||||
, "all_ledger"=>"numeric"
|
||||
,"unpaid"=>"text"
|
||||
,"operation_filter"=>"text"
|
||||
,"filter_name"=>"text"
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ echo $f_accounting->input(); ?>
|
|||
|
||||
<tr>
|
||||
<td style="text-align:right;width:30em">
|
||||
<?php echo _('Et uniquement non payées')?>
|
||||
<?php echo _('Statut')?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue