Ver Fonte

[ADD] Nuevos Filtros

Rodney Enciso Arias há 7 anos atrás
pai
commit
06c4ccfa26
2 ficheiros alterados com 116 adições e 18 exclusões
  1. 54 6
      static/src/js/reports/report_balance.js
  2. 62 12
      static/src/reports/report_balance.xml

+ 54 - 6
static/src/js/reports/report_balance.js

@@ -16,6 +16,12 @@ function report_balance (reporting){
         // event
         events:{
             'click #toolbar > button' : 'clickOnAction',
+            'click #X' : 'factSearch',
+            'click #A' : 'factSearch',
+            'click #B' : 'factSearch',
+            'click #C' : 'factSearch',
+            'click #D' : 'factSearch',
+            'click #Z' : 'factSearch',
             'change #from' : 'factSearch',
             'change #to' : 'factSearch',
             'click-row.bs.table #table ' : 'ckickAnalysisDetail',
@@ -196,22 +202,64 @@ function report_balance (reporting){
         // Buscar
         factSearch: function(){
             var self = this;
+            var hoy = moment().format('YYYY-MM-DD');
             var desde =this.$el.find('#from').val();
             var hasta =this.$el.find('#to').val();
             var customer= this.$el.find('#customer').val().split('-');
             var content = self.content;
-            if (desde.length > 0){
-                var date= desde.split('/');
+
+            if ($('#A').is(":checked")){
+                content = _.filter(content, function (inv){
+                    return inv.date == hoy;
+                });
+            }
+            if ($('#B').is(":checked")){
+                var date = hoy.split('-');
+                var ayer = date[2] - 1;
+                date.splice(2,0);
+                date[2] = '0'+ayer;
                 content = _.filter(content, function (inv){
-                    return inv.date >= (date[2]+"-"+date[1]+"-"+date[0]);
+                    return inv.date == date[0]+'-'+date[1]+'-'+date[2];
                 });
             }
-            if (hasta.length > 0){
-                var date= hasta.split('/');
+            if ($('#C').is(":checked")){
+                var date = hoy.split('-');
                 content = _.filter(content, function (inv){
-                    return inv.date <= (date[2]+"-"+date[1]+"-"+date[0]);
+                    var mes = inv.date.split('-');
+                    return mes[0]+'-'+mes[1] == date[0]+'-'+date[1];
                 });
             }
+            if ($('#D').is(":checked")){
+                var date = hoy.split('-');
+                var mes = date[1] - 1;
+                date.splice(1,0);
+                if(date[1] < 10){
+                    date[1] = '0'+mes;
+                }else{
+                    date[1] = mes;
+                }
+                content = _.filter(content, function (inv){
+                    var mes = inv.date.split('-');
+                    return mes[0]+'-'+mes[1] == date[0]+'-'+date[1];
+                });
+            }
+            if ($('#Z').is(":checked")){
+                $('#datepicker').css('display','block');
+                if (desde.length > 0){
+                    var date= desde.split('/');
+                    content = _.filter(content, function (inv){
+                        return inv.date >= (date[2]+"-"+date[1]+"-"+date[0]);
+                    });
+                }
+                if (hasta.length > 0){
+                    var date= hasta.split('/');
+                    content = _.filter(content, function (inv){
+                        return inv.date <= (date[2]+"-"+date[1]+"-"+date[0]);
+                    });
+                }
+            }else{
+                $('#datepicker').css('display','none');
+            }
             if (customer != ""){
                 content = _.filter(content, function(inv){
                     return inv.partner_id == customer[0];

+ 62 - 12
static/src/reports/report_balance.xml

@@ -4,22 +4,72 @@
         <div class="report_view">
             <div class="reporting_page_header">
                 <h1>Balance de Sumas y Saldos</h1>
-                <div id="volver"></div>
+                <!-- <div id="volver"></div> -->
+            </div>
+            <button type="button" class="oe_button oe_form_button oe_highlight" aria-label="Left Align" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">FILTRAR
+            </button>
+            <div class="collapse" id="collapseExample">
+                <div class="card card-body">
+                    <br/>
+                    <div class="row">
+                        <div class="col-xs-6">
+                            <div class="panel panel-default">
+                                <div class="panel-heading">Fechas</div>
+                                <div class="panel-body">
+                                    <ul>
+                                        <li>
+                                            <input type="radio" name="valores" id="X" value="X" checked="checked"/> 
+                                            <label for="X">Sin Filtro</label>  
+                                        </li>
+                                        <li>
+                                            <input type="radio" name="valores" id="A" value="A"/> 
+                                            <label for="A">Hoy</label>  
+                                        </li>
+                                        <li>
+                                            <input type="radio" name="valores" id="B" value="B"/>
+                                            <label for="B">Ayer</label>
+                                        </li>
+                                        <li>
+                                            <input type="radio" name="valores" id="C" value="C"/>
+                                            <label for="C">Mes Actual</label>
+                                        </li>
+                                        <li>
+                                            <input type="radio" name="valores" id="D" value="D"/>
+                                            <label for="D">Mes Pasado</label>
+                                        </li>
+                                        <li>
+                                            <input type="radio" name="valores" id="Z" value="Z"/>
+                                            <label for="Z">Busqueda Avanzada</label>
+                                        </li>
+                                    </ul>
+                                    <div id="datepicker" style="display:none;" class="container">
+                                        <label for="from">Desde: </label>
+                                        <input type="text"  id="from" name="from"/>
+                                        <label for="to" >Hasta: </label>
+                                        <input type="text"  id="to" name="to" />    
+                                    </div>
+                                    
+                                </div>
+                            </div> 
+                        </div>
+                        <div class="col-xs-6">
+                            <div class="panel panel-default">
+                                <div class="panel-heading">Características</div>
+                                <div class="panel-body">
+                                    <label for="customer"> Buscar cliente / proveedor:  </label>
+                                    <input id="customer" type="text" class="form-control ui-autocomplete-input" autocomplete="off" placeholder="Nombre/ CI/ Ruc"/> 
+                                </div>
+                            </div> 
+                        </div>
+                    </div>
+                </div>
             </div>
-            <div id="toolbar">
-
-                <label for="from">Desde: </label>
-                <input type="text"  id="from" name="from"/>
-
-                <label for="to" >Hasta: </label>
-                <input type="text"  id="to" name="to" />
 
-                <label for="customer"> Buscar:  </label>
-                <input id="customer" type="text" class="ui-autocomplete-input" autocomplete="off" placeholder="Nombre/ CI/ Ruc"/>
 
-                <button class="oe_button oe_form_button oe_highlight btn-block" value="pdf">PDF</button>
-                
+            <div id="toolbar">
+                <button class="oe_button oe_form_button oe_highlight btn-block" value="pdf">PDF</button> 
             </div>
+            
             <table id="table" class="table_paint_first_row"
                 data-pagination="true"
                 data-toggle="table"