Browse Source

[FIX] widget_sale y widget_balance

Rodney Elpidio Enciso Arias 6 years ago
parent
commit
84e6d7ec5c

+ 11 - 8
static/src/js/charts/chart_ingreso_egreso.js

@@ -442,26 +442,29 @@ function chart_ingreso_egreso (widget) {
                 },
                 options: {
                     responsive: true,
+                    responsiveAnimationDuration:10,
+                    maintainAspectRatio:false,
                     legend: {
                         display: false,
                     },
                     title: {
                         display: false,
                     },
-                    layout: {
-                        padding: {
-                            top: 0,
-                            bottom: 45,
-                            left : 0,
-                            rigth: 0,
-                        }
-                    },
+                    // layout: {
+                    //     padding: {
+                    //         top: 0,
+                    //         bottom: 5,
+                    //         left : 0,
+                    //         rigth: 0,
+                    //     }
+                    // },
                     events: ['click'],
                     elements: {
                         line: {
                             tension: 0.000001
                         },
                     },
+
                 }
             });
         },

+ 10 - 8
static/src/js/charts/chart_ranking_customer.js

@@ -306,20 +306,22 @@ function chart_ranking_customer (widget) {
                 },
                 options: {
                     responsive: true,
+                    responsiveAnimationDuration:10,
+                    maintainAspectRatio:false,
                     legend: {
                         display: false,
                     },
                     title: {
                         display: false,
                     },
-                    layout: {
-                        padding: {
-                            top: 0,
-                            bottom: 45,
-                            left : 0,
-                            rigth: 0,
-                        }
-                    },
+                    // layout: {
+                    //     padding: {
+                    //         top: 0,
+                    //         bottom: 5,
+                    //         left : 0,
+                    //         rigth: 0,
+                    //     }
+                    // },
                     tooltips: {
                         callbacks: {
                             label: function(tooltipItem, data) {

+ 3 - 1
static/src/js/charts/chart_ranking_product.js

@@ -307,6 +307,8 @@ function chart_ranking_product (widget) {
                 },
                 options: {
                     responsive: true,
+                    responsiveAnimationDuration:10,
+                    maintainAspectRatio:false,
                     legend: {
                        display: false,
                     },
@@ -316,7 +318,7 @@ function chart_ranking_product (widget) {
                     layout: {
                         padding: {
                             top: 0,
-                            bottom: 40,
+                            bottom: 0,
                             left: 0,
                             rigth: 0,
                         }

+ 5 - 4
static/src/js/charts/chart_ranking_salesman.js

@@ -53,7 +53,7 @@ function chart_ranking_salesman (widget) {
                 return self.fetchResCurrency();
             }).then(function(ResCurrency) {
                 self.ResCurrency = ResCurrency;
-                return self.fetchProductRanking();
+                return self.fetchSalesmanRanking();
             });
         },
 
@@ -191,12 +191,11 @@ function chart_ranking_salesman (widget) {
             }));
         },
 
-        fetchProductRanking: function() {
+        fetchSalesmanRanking: function() {
             var self = this;
             var PosOrder;
             var AccountInvoice;
             var ranking = [];
-            console.log(self);
             var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
             for (var i = 0; i < self.ResUser.length; i++) {
                 var data = [];
@@ -289,6 +288,8 @@ function chart_ranking_salesman (widget) {
                 },
                 options: {
                     responsive: true,
+                    responsiveAnimationDuration:10,
+                    maintainAspectRatio:false,
                     title: {
                         display: false,
                     },
@@ -298,7 +299,7 @@ function chart_ranking_salesman (widget) {
                     layout: {
                         padding: {
                             top: 0,
-                            bottom: 40,
+                            bottom: 0,
                             left: 0,
                             rigth: 0,
                         }

+ 3 - 1
static/src/js/charts/chart_sale_by_store.js

@@ -529,6 +529,8 @@ function chart_sale_by_store (widget) {
                 },
                 options: {
                     responsive: true,
+                    responsiveAnimationDuration:10,
+                    maintainAspectRatio:false,
                     title: {
                         display: false,
                     },
@@ -538,7 +540,7 @@ function chart_sale_by_store (widget) {
                     layout: {
                         padding: {
                             top: 0,
-                            bottom: 45,
+                            bottom: 0,
                             left : 0,
                             rigth: 0,
                         }

+ 7 - 4
static/src/js/widgets/widget_balance.js

@@ -213,7 +213,7 @@ function widget_balance(widget) {
                     return item.id;
                 }));
                 return _.flatten(_.filter(self.AccountInvoice,function (inv) {
-                    return moment(inv.date_invoice).format('YYYY-MM-DD') === date & inv.type == 'in_invoice';
+                    return moment(inv.date_invoice).format('YYYY-MM-DD') === date & _.contains(journal_ids, inv.journal_id[0]);
                 }));
             }
         },
@@ -293,12 +293,15 @@ function widget_balance(widget) {
             var balance = 0;
             var array = [];
             var order = self.getTodayPosOrder();
-            
             var sale_invoice = self.getTodayAccountInvoice('sale');
             var sale_invoice_refund = self.getTodayAccountInvoice('sale_refund');
             var purchase_invoice = self.getTodayAccountInvoice('purchase');
-
             var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            
+            /* 
+                SALE INVOICE
+            */
+           
             if(order.length > 0){
                 amount_order = _.reduce(_.map(order, function (map) {
                     return map.amount_total;
@@ -329,7 +332,7 @@ function widget_balance(widget) {
             /* 
                 SALE INVOICE REFUND
             */
-            
+
             if(sale_invoice_refund.length > 0){
                 array = [];
                 _.each(sale_invoice_refund, function (item) {

+ 2 - 2
static/src/js/widgets/widget_sale.js

@@ -333,8 +333,8 @@ function widget_sale(widget) {
             var invoice_amount_refund = 0;
             var data = [];
             var pos_order = self.getTodayPosOrder();
-            var account_invoice = self.getThisWeekAccountInvoice('sale');
-            var account_invoice_refund = self.getThisWeekAccountInvoice('sale_refund');
+            var account_invoice = self.getTodayAccountInvoice('sale');
+            var account_invoice_refund = self.getTodayAccountInvoice('sale_refund');
             var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
             if(pos_order.length > 0){
                 pos_amount = _.reduce(_.map(pos_order, function (map) {

+ 4 - 2
static/src/xml/charts/chart_ingreso_egreso.xml

@@ -15,9 +15,11 @@
                 </ul>
             </div>
             <div class="widget-content">
-                <div class="chart-container">
+                <div class="container">
                     <h3 class="text-center">Flujo de caja</h3>
-                    <canvas></canvas>    
+                    <div class="container center-block" style="height:230px;width:90%;">
+                        <canvas></canvas>    
+                    </div>    
                 </div>
             </div>
         </t>

+ 5 - 3
static/src/xml/charts/chart_ranking_customer.xml

@@ -4,10 +4,12 @@
     <t t-name="ChartRankingCustomer">
         <t t-call="WidgetReportingBaseTemplate">
             <div class="widget-content">
-                <div class="chart-container">
+                <div class="container">
                     <h3 class="text-center">Ranking de Clientes</h3>
-                    <canvas></canvas>    
-                </div>
+                    <div class="container center-block" style="height:230px;width:100%;">
+                        <canvas></canvas>    
+                    </div>    
+                </div>    
             </div>
         </t>
     </t>

+ 4 - 2
static/src/xml/charts/chart_ranking_product.xml

@@ -3,9 +3,11 @@
     <t t-name="ChartRankingProduct">
         <t t-call="WidgetReportingBaseTemplate">
             <div class="widget-content">
-                <div class="chart-container">
+                <div class="container">
                     <h3 class="text-center">Ranking de Productos</h3>
-                    <canvas></canvas>    
+                    <div class="container center-block" style="height:230px;width:100%;">
+                        <canvas></canvas>    
+                    </div>    
                 </div>
             </div>
         </t>

+ 5 - 3
static/src/xml/charts/chart_ranking_salesman.xml

@@ -4,9 +4,11 @@
     <t t-name="ChartRankingSalesman">
         <t t-call="WidgetReportingBaseTemplate">
             <div class="widget-content">
-                <div class="chart-container">
-                    <h3 class="text-center">Vendedores</h3>
-                    <canvas></canvas>    
+                <div class="container">
+                    <h3 class="text-center">Ranking de Vendedores</h3>
+                    <div class="container center-block" style="height:230px;width:100%;">
+                        <canvas></canvas>    
+                    </div>    
                 </div>
             </div>
         </t>

+ 4 - 2
static/src/xml/charts/chart_sale_by_store.xml

@@ -15,9 +15,11 @@
                 </ul>
             </div>
             <div class="widget-content">
-                <div class="chart-container">
+                <div class="container">
                     <h3 class="text-center">Ventas por Sucursal</h3>
-                    <canvas></canvas>    
+                    <div class="container center-block" style="height:230px;width:100%;">
+                        <canvas></canvas>    
+                    </div>    
                 </div>
             </div>
         </t>