Forráskód Böngészése

Eiru reports pack ajustes

SEBAS 1 éve
szülő
commit
8b772c209c
1 módosított fájl, 61 hozzáadás és 12 törlés
  1. 61 12
      static/src/js/reports/report_product_pack_pos.js

+ 61 - 12
static/src/js/reports/report_product_pack_pos.js

@@ -26,7 +26,6 @@ function report_product_pack_pos (reporting) {
             'click #Z' : 'factSearch',
             'change #from' : 'factSearch',
             'change #to': 'factSearch',
-
             'click #Y' : 'factSearch',
             'click-row.bs.table #table ' : 'clickAnalysisDetail',
         },
@@ -295,25 +294,26 @@ function report_product_pack_pos (reporting) {
             var last_month = moment().add(-1, 'months').format('YYYY-MM');
             var desde = self.$el.find('#from').val();
             var hasta = self.$el.find('#to').val();
-            var PosOrderLine = self.PosOrderLine;
+            var content = self.PosOrderLine;
 
             if ($('#A').is(":checked")){
-                PosOrderLine = _.filter(PosOrderLine, function (inv){
+                content = _.filter(content, function (inv){
                     return moment(inv.create_date).format('YYYY-MM-DD') == today;
                 });
             }
             if ($('#B').is(":checked")){
-                PosOrderLine = _.filter(PosOrderLine, function (inv){
+                content = _.filter(content, function (inv){
                     return moment(inv.create_date).format('YYYY-MM-DD') == yesterday;
                 });
             }
             if ($('#C').is(":checked")){
-                PosOrderLine = _.filter(PosOrderLine, function (inv){
+                content = _.filter(content, function (inv){
+
                     return moment(inv.create_date).format('YYYY-MM') == month;
                 });
             }
             if ($('#D').is(":checked")){
-                PosOrderLine = _.filter(PosOrderLine, function (inv){
+                content = _.filter(content, function (inv){
                     return moment(inv.create_date).format('YYYY-MM') == last_month;
                 });
             }
@@ -322,13 +322,14 @@ function report_product_pack_pos (reporting) {
                 $('#datepicker').css('display','block');
                 if (desde.length > 0){
                     var date = desde.split('/');
-                    PosOrderLine = _.filter(PosOrderLine, function (inv){
+                    content = _.filter(content, function (inv){
                         return moment(inv.create_date).format('YYYY-MM-DD') >= (date[2]+"-"+date[1]+"-"+date[0]);
                     });
+
                 }
                 if (hasta.length > 0){
                     var date= hasta.split('/');
-                    PosOrderLine = _.filter(PosOrderLine, function (inv){
+                    content = _.filter(content, function (inv){
                         return moment(inv.create_date).format('YYYY-MM-DD') <= (date[2]+"-"+date[1]+"-"+date[0]);
                     });
                 }
@@ -336,9 +337,10 @@ function report_product_pack_pos (reporting) {
                 $('#datepicker').css('display','none');
             }
 
-            return _.flatten(_.filter(PosOrderLine,function (inv) {
+            return _.flatten(_.filter(content,function (inv) {
                 return inv.product_id[0] === product_id;
             }));
+
         },
 
 
@@ -439,10 +441,57 @@ function report_product_pack_pos (reporting) {
         },
 
         factSearch: function(){
-            var self = this;
+          var self = this;
+          var today = moment().format('YYYY-MM-DD');
+          var yesterday = moment().add(-1, 'days').format('YYYY-MM-DD');
+          var month = moment().format('YYYY-MM');
+          var last_month = moment().add(-1, 'months').format('YYYY-MM');
+          var product = this.$el.find('#product').val().split('-');
+          var desde = self.$el.find('#from').val();
+          var hasta = self.$el.find('#to').val();
+          var content = self.content;
+
+          //
+          // if ($('#A').is(":checked")){
+          //   content = _.filter(content, function (inv){
+          //       return moment(inv.create_date).format('YYYY-MM-DD') == today;
+          //   });
+          // }
+          // if ($('#B').is(":checked")){
+          //   content = _.filter(content, function (inv){
+          //       return moment(inv.create_date).format('YYYY-MM-DD') == yesterday;
+          //   });
+          // }
+          // if ($('#C').is(":checked")){
+          //   content = _.filter(content, function (inv){
+          //       return moment(inv.create_date).format('YYYY-MM') == month;
+          //   });
+          // }
+          // if ($('#D').is(":checked")){
+          //   content = _.filter(content, function (inv){
+          //       return moment(inv.create_date).format('YYYY-MM') == last_month;
+          //   });
+          // }
+          //
+          // if ($('#Z').is(":checked")){
+          //   $('#datepicker').css('display','block');
+          //   if (desde.length > 0){
+          //       var date= desde.split('/');
+          //       content = _.filter(content, function (inv){
+          //           console.log(inv.create_date);
+          //           return inv.create_date >= (date[2]+"-"+date[1]+"-"+date[0]);
+          //       });
+          //   }
+          //   if (hasta.length > 0){
+          //       var date= hasta.split('/');
+          //       content = _.filter(content, function (inv){
+          //           return inv.create_date <= (date[2]+"-"+date[1]+"-"+date[0]);
+          //       });
+          //   }
+          // }else{
+          //   $('#datepicker').css('display','none');
+          // }
 
-            var product = this.$el.find('#product').val().split('-');
-            var content = self.content;
 
             if (product != ""){
                 content = _.filter(content, function(inv){