Browse Source

[FIX] ajustes varios

Rodney Elpidio Enciso Arias 6 năm trước cách đây
mục cha
commit
ad791f3063

BIN
controller/helpers/account_invoice.pyc


+ 1 - 1
controller/helpers/pos_order.py

@@ -69,7 +69,7 @@ def get_pos_order():
                 'amount_untaxed': j[8],
                 'journal_id': j[9],
                 'store_id': j[10],
-                'company_id': j[11],
+                'company_id': j[11]
             } for j in r.cr.fetchall()
         ]
     else:

BIN
controller/helpers/pos_order.pyc


+ 24 - 22
static/src/js/reports/report_sale.js

@@ -266,17 +266,17 @@ function report_sale(reporting){
             var desde = self.$el.find('#from').val();
             var hasta = self.$el.find('#to').val();
 
-            var store_ids = _.flatten(_.map(self.ResStore, function (item) {
-                return item.id;
-            }));
-
-            var company_ids = _.flatten(_.map(self.ResCompany, function (item) {
-                return item.id;
-            }));
-
-            content = _.flatten(_.filter(content,function (item) {
-                return _.contains(store_ids, item.store_id) && _.contains(company_ids, item.company_id);
-            }));
+            if((store && store == 9999999)||(company && company == 9999999)){
+                var store_ids = _.flatten(_.map(self.ResStore, function (item) {
+                    return item.id;
+                }));
+                var company_ids = _.flatten(_.map(self.ResCompany, function (item) {
+                    return item.id;
+                }));
+                content = _.flatten(_.filter(content,function (item) {
+                    return _.contains(store_ids, item.store_id) && _.contains(company_ids, item.company_id);
+                }));
+            }
 
             if(company && company != 9999999){
                 content = _.flatten(_.filter(content,function (item) {
@@ -378,17 +378,17 @@ function report_sale(reporting){
             var desde = self.$el.find('#from').val();
             var hasta = self.$el.find('#to').val();
 
-            var store_ids = _.flatten(_.map(self.ResStore, function (item) {
-                return item.id;
-            }));
-
-            var company_ids = _.flatten(_.map(self.ResCompany, function (item) {
-                return item.id;
-            }));
-
-            content = _.flatten(_.filter(content,function (item) {
-                return _.contains(store_ids, item.store_id) && _.contains(company_ids, item.company_id);
-            }));
+            if((store && store == 9999999)||(company && company == 9999999)){
+                var store_ids = _.flatten(_.map(self.ResStore, function (item) {
+                    return item.id;
+                }));
+                var company_ids = _.flatten(_.map(self.ResCompany, function (item) {
+                    return item.id;
+                }));
+                content = _.flatten(_.filter(content,function (item) {
+                    return _.contains(store_ids, item.store_id) && _.contains(company_ids, item.company_id);
+                }));
+            }
 
             if(company && company != 9999999){
                 content = _.flatten(_.filter(content,function (item) {
@@ -483,6 +483,7 @@ function report_sale(reporting){
                 POS ORDER
             ==========================================
             */
+            var discount_amount;
             var PosOrder = self.getPosOrder();
             _.each(PosOrder, function(item){
                 var utc = moment.utc(item.date,'YYYY-MM-DD h:mm:ss A');
@@ -554,6 +555,7 @@ function report_sale(reporting){
                     */
                     date_no_format: moment(item.date).format('YYYY-MM-DD'),
                     residual_no_format:residual,
+                    discount_amount_no_format:item.discount_rate,
                     untaxed_no_format:item.amount - item.amount_tax,
                     tax_no_format:item.amount_tax,
                     total_no_format:item.amount,

+ 22 - 22
static/src/js/reports/report_sale_analytic.js

@@ -308,17 +308,17 @@ function report_sale_analytic(reporting){
             var desde = self.$el.find('#from').val();
             var hasta = self.$el.find('#to').val();
 
-            var store_ids = _.flatten(_.map(self.ResStore, function (item) {
-                return item.id;
-            }));
-
-            var company_ids = _.flatten(_.map(self.ResCompany, function (item) {
-                return item.id;
-            }));
-
-            content = _.flatten(_.filter(content,function (item) {
-                return _.contains(store_ids, item.store_id) && _.contains(company_ids, item.company_id);
-            }));
+            if((store && store == 9999999)||(company && company == 9999999)){
+                var store_ids = _.flatten(_.map(self.ResStore, function (item) {
+                    return item.id;
+                }));
+                var company_ids = _.flatten(_.map(self.ResCompany, function (item) {
+                    return item.id;
+                }));
+                content = _.flatten(_.filter(content,function (item) {
+                    return _.contains(store_ids, item.store_id) && _.contains(company_ids, item.company_id);
+                }));
+            }
 
             if(company && company != 9999999){
                 content = _.flatten(_.filter(content,function (item) {
@@ -452,17 +452,17 @@ function report_sale_analytic(reporting){
             var desde = self.$el.find('#from').val();
             var hasta = self.$el.find('#to').val();
 
-            var store_ids = _.flatten(_.map(self.ResStore, function (item) {
-                return item.id;
-            }));
-
-            var company_ids = _.flatten(_.map(self.ResCompany, function (item) {
-                return item.id;
-            }));
-
-            content = _.flatten(_.filter(content,function (item) {
-                return _.contains(store_ids, item.store_id) && _.contains(company_ids, item.company_id);
-            }));
+            if((store && store == 9999999)||(company && company == 9999999)){
+                var store_ids = _.flatten(_.map(self.ResStore, function (item) {
+                    return item.id;
+                }));
+                var company_ids = _.flatten(_.map(self.ResCompany, function (item) {
+                    return item.id;
+                }));
+                content = _.flatten(_.filter(content,function (item) {
+                    return _.contains(store_ids, item.store_id) && _.contains(company_ids, item.company_id);
+                }));
+            }
 
             if(company && company != 9999999){
                 content = _.flatten(_.filter(content,function (item) {

+ 19 - 0
static/src/reports/report_sale.xml

@@ -166,6 +166,25 @@
                     },0);
                     return accounting.formatNumber(total,decimal_places,thousands_separator,decimal_separator);
                 }
+                <!--
+                    DISCOUNT AMOUNT
+                -->
+                <!-- function DiscountFooter(rowsTable) {
+                    var decimal_places = 0;
+                    var thousands_separator = '.';
+                    var decimal_separator = ',';
+                    if(rowsTable.length > 0){
+                        decimal_places = rowsTable[0].decimal_places;
+                        thousands_separator = rowsTable[0].thousands_separator;
+                        decimal_separator = rowsTable[0].decimal_separator;
+                    }
+                    var total =  _.reduce(_.map(rowsTable,function(item){
+                        return item.discount_amount_no_format;
+                    }), function(memo, num){
+                        return memo + num;
+                    },0);
+                    return accounting.formatNumber(total,decimal_places,thousands_separator,decimal_separator);
+                } -->
                 <!--
                     UNTAXED
                 -->