Browse Source

[ADD] nuevos graficos

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

+ 12 - 0
data/charts_data.xml

@@ -22,5 +22,17 @@
         <record model="chart.list" id="chart_ChartPurchaseExpense">
             <field name="name">ChartPurchaseExpense</field>
         </record>
+        <record model="chart.list" id="widget_WidgetPosOrder">
+            <field name="name">WidgetPosOrder</field>
+        </record>
+        <record model="chart.list" id="widget_WidgetBalance">
+            <field name="name">WidgetBalance</field>
+        </record>
+        <record model="chart.list" id="widget_WidgetExpense">
+            <field name="name">WidgetExpense</field>
+        </record>
+        <record model="chart.list" id="widget_WidgetPurchase">
+            <field name="name">WidgetPurchase</field>
+        </record>
     </data>
 </openerp>

+ 35 - 0
static/src/css/dashboard.css

@@ -12,10 +12,44 @@
     flex-direction: column;
     justify-content: center;
     padding: 1em;
+    color:#1e88e5;
     border-bottom: 3px solid #1e88e5;
     background-color: #fff;
     overflow-y: hidden !important;
 }
+
+
+/*Compras*/
+
+.grid-stack-item-content.reporting-dashboard.purchase {
+    color: #4caf50;
+    border-bottom: 3px solid #4caf50;
+}
+.grid-stack-item-content.reporting-dashboard.purchase > .widget-content > a {
+    color: #4caf50;
+}
+
+/*Gastos*/
+
+.grid-stack-item-content.reporting-dashboard.expense {
+    color: #ef6c00;
+    border-bottom: 3px solid #ef6c00;
+}
+.grid-stack-item-content.reporting-dashboard.expense > .widget-content > a {
+    color: #ef6c00;
+}
+
+/*Balance*/
+
+.grid-stack-item-content.reporting-dashboard.balance {
+    color:#009688;
+    border-bottom: 3px solid #009688;
+}
+.grid-stack-item-content.reporting-dashboard.balance > .widget-content > a {
+    color: #009688;
+}
+
+
 .grid-stack-item-content.reporting-dashboard > .widget-title {
     font-size: 12pt;
     font-weight: bold;
@@ -36,4 +70,5 @@
 .grid-stack-item-content.reporting-dashboard > .widget-content > a {
     font-size: 24pt;
     font-weight: bold;
+    color: #0288d1;
 }

+ 106 - 1
static/src/js/dashboard.js

@@ -25,6 +25,111 @@ function dashboard_reporting_widget (instance, widget) {
         renderWidgets: function () { 
             var self = this;
 
+             // *************************** Ventas
+            var wWidgetPosOrder = new widgets.WidgetPosOrderWidget(self);
+            wWidgetPosOrder.fetchCurrentUser().then(function(CurrentUser){
+                return CurrentUser;
+            }).then(function(CurrentUser){
+                wWidgetPosOrder.fetchResUser(CurrentUser).then(function(chart_ids){
+                    return chart_ids;
+                }).then(function(chart_ids){
+                    var charts = chart_ids[0].chart_ids;
+                    wWidgetPosOrder.fetchChartList(charts).then(function(ChartList){
+                        return ChartList;
+                    }).then(function(ChartList){
+                        var chart =  _.flatten(_.filter(ChartList,function (inv) {
+                            return inv.name == 'WidgetPosOrder';
+                        }));
+                        if(chart.length > 0){
+                            wWidgetPosOrder.renderElement();
+                            wWidgetPosOrder.start();
+                            self.grid.addWidget(wWidgetPosOrder.$el, 0, 0, wWidgetPosOrder.size.width,  wWidgetPosOrder.size.height, true);
+                        }
+                    });
+                });
+            });
+            
+            // *************************** Compras
+            var wWidgetPurchase = new widgets.WidgetPurchaseWidget(self);
+            wWidgetPosOrder.fetchCurrentUser().then(function(CurrentUser){
+                return CurrentUser;
+            }).then(function(CurrentUser){
+                wWidgetPosOrder.fetchResUser(CurrentUser).then(function(chart_ids){
+                    return chart_ids;
+                }).then(function(chart_ids){
+                    var charts = chart_ids[0].chart_ids;
+                    wWidgetPosOrder.fetchChartList(charts).then(function(ChartList){
+                        return ChartList;
+                    }).then(function(ChartList){
+                        var chart =  _.flatten(_.filter(ChartList,function (inv) {
+                            return inv.name == 'WidgetPurchase';
+                        }));
+                        if(chart.length > 0){
+                            wWidgetPurchase.renderElement();
+                            wWidgetPurchase.start();
+                            self.grid.addWidget(wWidgetPurchase.$el, 0, 0, wWidgetPurchase.size.width,  wWidgetPurchase.size.height, true);
+                        }
+                    });
+                });
+            });
+            
+            // *************************** Gastos
+            var wWidgetExpense = new widgets.WidgetExpenseWidget(self);
+            wWidgetPosOrder.fetchCurrentUser().then(function(CurrentUser){
+                return CurrentUser;
+            }).then(function(CurrentUser){
+                wWidgetPosOrder.fetchResUser(CurrentUser).then(function(chart_ids){
+                    return chart_ids;
+                }).then(function(chart_ids){
+                    var charts = chart_ids[0].chart_ids;
+                    wWidgetPosOrder.fetchChartList(charts).then(function(ChartList){
+                        return ChartList;
+                    }).then(function(ChartList){
+                        var chart =  _.flatten(_.filter(ChartList,function (inv) {
+                            return inv.name == 'WidgetExpense';
+                        }));
+                        if(chart.length > 0){
+                            wWidgetExpense.renderElement();
+                            wWidgetExpense.start();
+                            self.grid.addWidget(wWidgetExpense.$el, 0, 0, wWidgetExpense.size.width,  wWidgetExpense.size.height, true);
+                        }
+                    });
+                });
+            });           
+        
+
+            // *************************** Balance
+            var wWidgetBalance = new widgets.WidgetBalanceWidget(self);
+            wWidgetPosOrder.fetchCurrentUser().then(function(CurrentUser){
+                return CurrentUser;
+            }).then(function(CurrentUser){
+                wWidgetPosOrder.fetchResUser(CurrentUser).then(function(chart_ids){
+                    return chart_ids;
+                }).then(function(chart_ids){
+                    var charts = chart_ids[0].chart_ids;
+                    wWidgetPosOrder.fetchChartList(charts).then(function(ChartList){
+                        return ChartList;
+                    }).then(function(ChartList){
+                        var chart =  _.flatten(_.filter(ChartList,function (inv) {
+                            return inv.name == 'WidgetBalance';
+                        }));
+                        if(chart.length > 0){
+                            wWidgetBalance.renderElement();
+                            wWidgetBalance.start();
+                            self.grid.addWidget(wWidgetBalance.$el, 0, 0, wWidgetBalance.size.width,  wWidgetBalance.size.height, true);
+                        }
+                    });
+                });
+            });
+
+
+
+
+
+
+
+            
+
             // **************************** Historico de Facturas
             var wChartInvoice = new widgets.ChartInvoiceWidget(self);
             wChartInvoice.fetchCurrentUser().then(function(CurrentUser){
@@ -167,7 +272,7 @@ function dashboard_reporting_widget (instance, widget) {
                         }
                     });
                 });
-            });            
+            });  
         }
     });
 }

+ 4 - 0
static/src/js/main.js

@@ -17,6 +17,10 @@ openerp.eiru_reporting_dashboard = function (instance) {
         chart_pos_order_salesman(dashboard);
         chart_pos_order(dashboard);
         chart_purchase_expense(dashboard);
+        widget_pos_order(dashboard);
+        widget_purchase(dashboard);
+        widget_expense(dashboard);
+        widget_balance(dashboard);
     }catch(e){
         // error
     }

+ 1 - 1
static/src/js/widgets/chart_invoice.js

@@ -38,7 +38,7 @@ function chart_invoice (widget) {
                 return AccountInvoice;
             }).then(function (AccountInvoice) {
                 self.AccountInvoice = AccountInvoice;
-                return self.showWeeks();
+                return self.showMonths();
             });
         },
 

+ 1 - 1
static/src/js/widgets/chart_pos_order.js

@@ -39,7 +39,7 @@ function chart_pos_order (widget) {
                 return PosOrder;
             }).then(function (PosOrder) {
                 self.PosOrder = PosOrder;
-                return self.showWeek();
+                return self.showMonth();
             });
         },
 

+ 1 - 1
static/src/js/widgets/chart_purchase_expense.js

@@ -40,7 +40,7 @@ function chart_purchase_expense (widget) {
                 return AccountInvoice;
             }).then(function (AccountInvoice) {
                 self.AccountInvoice = AccountInvoice;
-                return self.showWeek();
+                return self.showMonth();
             });
         },
 

+ 282 - 0
static/src/js/widgets/widget_balance.js

@@ -0,0 +1,282 @@
+function widget_balance(widget) {
+    "use strict";
+
+    var model = openerp;
+
+    widget.WidgetBalanceWidget = widget.Base.extend({
+        template: 'WidgetBalance',
+
+        events: {
+            'click .today': 'showToday',
+            'click .thisWeek': 'showThisWeek',
+            'click .thisMonth': 'showThisMonth',
+        },
+
+        init: function (parent) {
+            this._super(parent, {
+                width: 3,
+                height: 2
+            });
+        },
+
+        start: function () {
+            var self = this;
+            self.fetchInitial();
+        },
+
+        fetchInitial: function(){
+            var self = this;
+            self.$el.find('#morosidad').block({
+                message: null,
+                overlayCSS: {
+                    backgroundColor: '#FAFAFA'
+                }
+            });
+            self.$el.find('.widget-content.widget-loading').css('display','flex');
+
+            self.fetchAccountInvoice().then(function (AccountInvoice) {
+                return AccountInvoice;
+            }).then(function (AccountInvoice) {
+                self.AccountInvoice = AccountInvoice;
+                return self.fetchPosOrder();
+            }).then(function(PosOrder) {
+                self.PosOrder = PosOrder;
+                return self.fetchResCompany();
+            }).then(function(ResCompany) {
+                self.ResCompany = ResCompany;
+                return self.fetchResCurrecy();
+            }).then(function(ResCurrecy) {
+                self.ResCurrecy = ResCurrecy;
+                return self.showThisMonth();
+            });
+        },
+
+        // Usuario Logeado
+        fetchCurrentUser: function() {
+            var self = this;
+            var ResUser = new model.web.Model('res.users');
+            return ResUser.call('get_user', {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        // Lista de Graficos disponibles para el usuario
+        fetchResUser: function(id) {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name','chart_ids'];
+            var domain = [['id','=',id]];
+            var ResUser = new model.web.Model('res.users');
+            ResUser.query(fields).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+
+            return defer;
+        },
+
+        // Obtener detalles de la lista de graficos
+        fetchChartList: function(chart_ids) {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name'];
+            var domain = [['id','in',chart_ids]];
+            var ChartList = new model.web.Model('chart.list');
+            ChartList.query(fields).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        fetchAccountInvoice: function() {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id', 'name', 'date_invoice', 'amount_total'];
+            var domain = [['state', 'not in', ['draft','cancel']],['type','=','in_invoice']];
+            var AccountInvoice = new model.web.Model('account.invoice');
+            AccountInvoice.query(fields).filter(domain).all().then(function(results) {
+                defer.resolve(results);
+            });
+
+            return defer;
+        },
+
+        fetchPosOrder: function() {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id', 'name', 'date_order', 'amount_total'];
+            var domain = [['state', 'not in', ['draft','cancel']]];
+            var PosOrder = new model.web.Model('pos.order');
+            PosOrder.query(fields).filter(domain).all().then(function(results) {
+                defer.resolve(results);
+            });
+
+            return defer;
+        },
+
+        fetchResCompany: function() {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name', 'currency_id'];
+            var domain = [['id', '=', 1]];
+            var ResCompany = new model.web.Model('res.company');
+            ResCompany.query(fields).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+
+            return defer;
+        },
+
+        fetchResCurrecy : function(){
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name', 'symbol', 'rate_silent', 'base', 'decimal_separator', 'decimal_places', 'thousands_separator', 'symbol_position'];
+            var domain = [['active', '=', true]];
+            var ResCurrecy = new model.web.Model('res.currency');
+            ResCurrecy.query(fields).filter(domain).all().then(function(results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        getResCurrency: function (id) {
+            var self = this;
+            return _.filter(self.ResCurrecy,function (item) {
+                return item.id === id;
+            })
+        },
+
+        // Facturas
+
+        getTodayAccountInvoice:function() {
+            var self = this;
+            var date = moment().format('YYYY-MM-DD');
+            return _.flatten(_.filter(self.AccountInvoice,function (inv) {
+                return moment(inv.date_invoice).format('YYYY-MM-DD') === date;
+            }));
+        },
+
+        getThisWeekAccountInvoice:function() {
+            var self = this;
+            var week = moment().week();
+            return _.flatten(_.filter(self.AccountInvoice,function (inv) {
+                return moment(inv.date_invoice).week() === week & moment(inv.date_invoice).format('YYYY')=== moment().format('YYYY');
+            }));
+        },
+
+        getThisMonthAccountInvoice:function() {
+            var self = this;
+            return _.flatten(_.filter(self.AccountInvoice,function (inv) {
+                return moment(inv.date_invoice).format('YYYY-MM')=== moment().format('YYYY-MM');
+            }));
+        },
+
+        // POS Orders
+        
+        getTodayPosOrder:function() {
+            var self = this;
+            var date = moment().format('YYYY-MM-DD');
+            return _.flatten(_.filter(self.PosOrder,function (inv) {
+                return moment(inv.date_order).format('YYYY-MM-DD') === date;
+            }));
+        },
+
+        getThisWeekPosOrder:function() {
+            var self = this;
+            var week = moment().week();
+            return _.flatten(_.filter(self.PosOrder,function (inv) {
+                return moment(inv.date_order).week() === week & moment(inv.date_order).format('YYYY')=== moment().format('YYYY');
+            }));
+        },
+
+        getThisMonthPosOrder:function() {
+            var self = this;
+            return _.flatten(_.filter(self.PosOrder,function (inv) {
+                return moment(inv.date_order).format('YYYY-MM')=== moment().format('YYYY-MM');
+            }));
+        }, 
+
+        showToday: function () {
+            var self = this;
+            var amount_order = 0;
+            var amount_invoice = 0;
+            var balance = 0;
+            var data = [];
+            var order = self.getTodayPosOrder();
+            var invoice = self.getTodayAccountInvoice();
+            var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            if(order.length > 0){
+                amount_order = _.reduce(_.map(order, function (map) {
+                    return map.amount_total;
+                }), function (memo, num) {
+                    return memo + num;
+                });
+            }
+            if(invoice.length > 0){
+                amount_invoice = _.reduce(_.map(invoice, function (map) {
+                    return map.amount_total;
+                }), function (memo, num) {
+                    return memo + num;
+                });
+            }
+            balance = amount_order - amount_invoice;
+            self.$el.find('.widget-content.widget-loading').css('display','none');
+            self.$el.find('.widget-content').find('a').text(accounting.formatMoney(balance, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+        },
+
+        showThisWeek: function () {
+            var self = this;
+            var amount_order = 0;
+            var amount_invoice = 0;
+            var balance = 0;
+            var data = [];
+            var order = self.getThisWeekPosOrder();
+            var invoice = self.getThisWeekAccountInvoice();
+            var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            if(order.length > 0){
+                amount_order = _.reduce(_.map(order, function (map) {
+                    return map.amount_total;
+                }), function (memo, num) {
+                    return memo + num;
+                });
+            }
+            if(invoice.length > 0){
+                amount_invoice = _.reduce(_.map(invoice, function (map) {
+                    return map.amount_total;
+                }), function (memo, num) {
+                    return memo + num;
+                });
+            }
+            balance = amount_order - amount_invoice;
+            self.$el.find('.widget-content.widget-loading').css('display','none');
+            self.$el.find('.widget-content').find('a').text(accounting.formatMoney(balance, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+        },
+
+        showThisMonth: function () {
+            var self = this;
+            var amount_order = 0;
+            var amount_invoice = 0;
+            var balance = 0;
+            var data = [];
+            var order = self.getThisMonthPosOrder();
+            var invoice = self.getThisMonthAccountInvoice();
+            var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            if(order.length > 0){
+                amount_order = _.reduce(_.map(order, function (map) {
+                    return map.amount_total;
+                }), function (memo, num) {
+                    return memo + num;
+                });
+            }
+            if(invoice.length > 0){
+                amount_invoice = _.reduce(_.map(invoice, function (map) {
+                    return map.amount_total;
+                }), function (memo, num) {
+                    return memo + num;
+                });
+            }
+            balance = amount_order - amount_invoice;
+            self.$el.find('.widget-content.widget-loading').css('display','none');
+            self.$el.find('.widget-content').find('a').text(accounting.formatMoney(balance, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+        },
+    });
+}

+ 206 - 0
static/src/js/widgets/widget_expense.js

@@ -0,0 +1,206 @@
+function widget_expense(widget) {
+    "use strict";
+
+    var model = openerp;
+
+    widget.WidgetExpenseWidget = widget.Base.extend({
+        template: 'WidgetExpense',
+
+        events: {
+            'click .today': 'showToday',
+            'click .thisWeek': 'showThisWeek',
+            'click .thisMonth': 'showThisMonth',
+        },
+
+        init: function (parent) {
+            this._super(parent, {
+                width: 3,
+                height: 2
+            });
+        },
+
+        start: function () {
+            var self = this;
+            self.fetchInitial();
+        },
+
+        fetchInitial: function(){
+            var self = this;
+            self.$el.find('#morosidad').block({
+                message: null,
+                overlayCSS: {
+                    backgroundColor: '#FAFAFA'
+                }
+            });
+            self.$el.find('.widget-content.widget-loading').css('display','flex');
+
+            self.fetchAccountInvoice().then(function (AccountInvoice) {
+                return AccountInvoice;
+            }).then(function (AccountInvoice) {
+                self.AccountInvoice = AccountInvoice;
+                return self.fetchResCompany();
+            }).then(function(ResCompany) {
+                self.ResCompany = ResCompany;
+                return self.fetchResCurrecy();
+            }).then(function(ResCurrecy) {
+                self.ResCurrecy = ResCurrecy;
+                return self.showThisMonth();
+            });
+        },
+
+        // Usuario Logeado
+        fetchCurrentUser: function() {
+            var self = this;
+            var ResUser = new model.web.Model('res.users');
+            return ResUser.call('get_user', {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        // Lista de Graficos disponibles para el usuario
+        fetchResUser: function(id) {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name','chart_ids'];
+            var domain = [['id','=',id]];
+            var ResUser = new model.web.Model('res.users');
+            ResUser.query(fields).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+
+            return defer;
+        },
+
+        // Obtener detalles de la lista de graficos
+        fetchChartList: function(chart_ids) {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name'];
+            var domain = [['id','in',chart_ids]];
+            var ChartList = new model.web.Model('chart.list');
+            ChartList.query(fields).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        fetchAccountInvoice: function() {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id', 'name', 'date_invoice', 'amount_total'];
+            var domain = [['state', 'not in', ['draft','cancel']],['origin','=',false],['type','=','in_invoice']];
+            var AccountInvoice = new model.web.Model('account.invoice');
+            AccountInvoice.query(fields).filter(domain).all().then(function(results) {
+                defer.resolve(results);
+            });
+
+            return defer;
+        },
+
+        fetchResCompany: function() {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name', 'currency_id'];
+            var domain = [['id', '=', 1]];
+            var ResCompany = new model.web.Model('res.company');
+            ResCompany.query(fields).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+
+            return defer;
+        },
+
+        fetchResCurrecy : function(){
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name', 'symbol', 'rate_silent', 'base', 'decimal_separator', 'decimal_places', 'thousands_separator', 'symbol_position'];
+            var domain = [['active', '=', true]];
+            var ResCurrecy = new model.web.Model('res.currency');
+            ResCurrecy.query(fields).filter(domain).all().then(function(results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        getResCurrency: function (id) {
+            var self = this;
+            return _.filter(self.ResCurrecy,function (item) {
+                return item.id === id;
+            })
+        },
+
+        getTodayAccountInvoice:function() {
+            var self = this;
+            var date = moment().format('YYYY-MM-DD');
+            return _.flatten(_.filter(self.AccountInvoice,function (inv) {
+                return moment(inv.date_invoice).format('YYYY-MM-DD') === date;
+            }));
+        },
+
+        getThisWeekAccountInvoice:function() {
+            var self = this;
+            var week = moment().week();
+            return _.flatten(_.filter(self.AccountInvoice,function (inv) {
+                return moment(inv.date_invoice).week() === week & moment(inv.date_invoice).format('YYYY')=== moment().format('YYYY');
+            }));
+        },
+
+        getThisMonthAccountInvoice:function() {
+            var self = this;
+            return _.flatten(_.filter(self.AccountInvoice,function (inv) {
+                return moment(inv.date_invoice).format('YYYY-MM')=== moment().format('YYYY-MM');
+            }));
+        },
+
+        showToday: function () {
+            var self = this;
+            var amount = 0;
+            var data = [];
+            var invoice = self.getTodayAccountInvoice();
+            var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            if(invoice.length > 0){
+                amount = _.reduce(_.map(invoice, function (map) {
+                    return map.amount_total;
+                }), function (memo, num) {
+                    return memo + num;
+                });
+            }
+            self.$el.find('.widget-content.widget-loading').css('display','none');
+            self.$el.find('.widget-content').find('a').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+        },
+
+        showThisWeek: function () {
+            var self = this;
+            var amount = 0;
+            var data = [];
+            var invoice = self.getThisWeekAccountInvoice();
+            var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            if(invoice.length > 0){
+                amount = _.reduce(_.map(invoice, function (map) {
+                    return map.amount_total;
+                }), function (memo, num) {
+                    return memo + num;
+                });
+            }
+            self.$el.find('.widget-content.widget-loading').css('display','none');
+            self.$el.find('.widget-content').find('a').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+        },
+
+        showThisMonth: function () {
+            var self = this;
+            var amount = 0;
+            var data = [];
+            var invoice = self.getThisMonthAccountInvoice();
+            var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            if(invoice.length > 0){
+                amount = _.reduce(_.map(invoice, function (map) {
+                    return map.amount_total;
+                }), function (memo, num) {
+                    return memo + num;
+                });
+            }
+            self.$el.find('.widget-content.widget-loading').css('display','none');
+            self.$el.find('.widget-content').find('a').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+        },
+    });
+}

+ 206 - 0
static/src/js/widgets/widget_pos_order.js

@@ -0,0 +1,206 @@
+function widget_pos_order(widget) {
+    "use strict";
+
+    var model = openerp;
+
+    widget.WidgetPosOrderWidget = widget.Base.extend({
+        template: 'WidgetPosOrder',
+
+        events: {
+            'click .today': 'showToday',
+            'click .thisWeek': 'showThisWeek',
+            'click .thisMonth': 'showThisMonth',
+        },
+
+        init: function (parent) {
+            this._super(parent, {
+                width: 3,
+                height: 2
+            });
+        },
+
+        start: function () {
+            var self = this;
+            self.fetchInitial();
+        },
+
+        fetchInitial: function(){
+            var self = this;
+            self.$el.find('#morosidad').block({
+                message: null,
+                overlayCSS: {
+                    backgroundColor: '#FAFAFA'
+                }
+            });
+            self.$el.find('.widget-content.widget-loading').css('display','flex');
+
+            self.fetchPosOrder().then(function (PosOrder) {
+                return PosOrder;
+            }).then(function (PosOrder) {
+                self.PosOrder = PosOrder;
+                return self.fetchResCompany();
+            }).then(function(ResCompany) {
+                self.ResCompany = ResCompany;
+                return self.fetchResCurrecy();
+            }).then(function(ResCurrecy) {
+                self.ResCurrecy = ResCurrecy;
+                return self.showThisMonth();
+            });
+        },
+
+        // Usuario Logeado
+        fetchCurrentUser: function() {
+            var self = this;
+            var ResUser = new model.web.Model('res.users');
+            return ResUser.call('get_user', {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        // Lista de Graficos disponibles para el usuario
+        fetchResUser: function(id) {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name','chart_ids'];
+            var domain = [['id','=',id]];
+            var ResUser = new model.web.Model('res.users');
+            ResUser.query(fields).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+
+            return defer;
+        },
+
+        // Obtener detalles de la lista de graficos
+        fetchChartList: function(chart_ids) {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name'];
+            var domain = [['id','in',chart_ids]];
+            var ChartList = new model.web.Model('chart.list');
+            ChartList.query(fields).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        fetchPosOrder: function() {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id', 'name', 'date_order', 'amount_total'];
+            var domain = [['state', 'not in', ['draft','cancel']]];
+            var PosOrder = new model.web.Model('pos.order');
+            PosOrder.query(fields).filter(domain).all().then(function(results) {
+                defer.resolve(results);
+            });
+
+            return defer;
+        },
+
+        fetchResCompany: function() {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name', 'currency_id'];
+            var domain = [['id', '=', 1]];
+            var ResCompany = new model.web.Model('res.company');
+            ResCompany.query(fields).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+
+            return defer;
+        },
+
+        fetchResCurrecy : function(){
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name', 'symbol', 'rate_silent', 'base', 'decimal_separator', 'decimal_places', 'thousands_separator', 'symbol_position'];
+            var domain = [['active', '=', true]];
+            var ResCurrecy = new model.web.Model('res.currency');
+            ResCurrecy.query(fields).filter(domain).all().then(function(results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        getResCurrency: function (id) {
+            var self = this;
+            return _.filter(self.ResCurrecy,function (item) {
+                return item.id === id;
+            })
+        },
+
+        getTodayPosOrder:function() {
+            var self = this;
+            var date = moment().format('YYYY-MM-DD');
+            return _.flatten(_.filter(self.PosOrder,function (inv) {
+                return moment(inv.date_order).format('YYYY-MM-DD') === date;
+            }));
+        },
+
+        getThisWeekPosOrder:function() {
+            var self = this;
+            var week = moment().week();
+            return _.flatten(_.filter(self.PosOrder,function (inv) {
+                return moment(inv.date_order).week() === week & moment(inv.date_order).format('YYYY')=== moment().format('YYYY');
+            }));
+        },
+
+        getThisMonthPosOrder:function() {
+            var self = this;
+            return _.flatten(_.filter(self.PosOrder,function (inv) {
+                return moment(inv.date_order).format('YYYY-MM')=== moment().format('YYYY-MM');
+            }));
+        },
+
+        showToday: function () {
+            var self = this;
+            var amount = 0;
+            var data = [];
+            var pos_order = self.getTodayPosOrder();
+            var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            if(pos_order.length > 0){
+                amount = _.reduce(_.map(pos_order, function (map) {
+                    return map.amount_total;
+                }), function (memo, num) {
+                    return memo + num;
+                });
+            }
+            self.$el.find('.widget-content.widget-loading').css('display','none');
+            self.$el.find('.widget-content').find('a').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+        },
+
+        showThisWeek: function () {
+            var self = this;
+            var amount = 0;
+            var data = [];
+            var pos_order = self.getThisWeekPosOrder();
+            var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            if(pos_order.length > 0){
+                amount = _.reduce(_.map(pos_order, function (map) {
+                    return map.amount_total;
+                }), function (memo, num) {
+                    return memo + num;
+                });
+            }
+            self.$el.find('.widget-content.widget-loading').css('display','none');
+            self.$el.find('.widget-content').find('a').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+        },
+
+        showThisMonth: function () {
+            var self = this;
+            var amount = 0;
+            var data = [];
+            var pos_order = self.getThisMonthPosOrder();
+            var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            if(pos_order.length > 0){
+                amount = _.reduce(_.map(pos_order, function (map) {
+                    return map.amount_total;
+                }), function (memo, num) {
+                    return memo + num;
+                });
+            }
+            self.$el.find('.widget-content.widget-loading').css('display','none');
+            self.$el.find('.widget-content').find('a').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+        },
+    });
+}

+ 206 - 0
static/src/js/widgets/widget_purchase.js

@@ -0,0 +1,206 @@
+function widget_purchase(widget) {
+    "use strict";
+
+    var model = openerp;
+
+    widget.WidgetPurchaseWidget = widget.Base.extend({
+        template: 'WidgetPurchase',
+
+        events: {
+            'click .today': 'showToday',
+            'click .thisWeek': 'showThisWeek',
+            'click .thisMonth': 'showThisMonth',
+        },
+
+        init: function (parent) {
+            this._super(parent, {
+                width: 3,
+                height: 2
+            });
+        },
+
+        start: function () {
+            var self = this;
+            self.fetchInitial();
+        },
+
+        fetchInitial: function(){
+            var self = this;
+            self.$el.find('#morosidad').block({
+                message: null,
+                overlayCSS: {
+                    backgroundColor: '#FAFAFA'
+                }
+            });
+            self.$el.find('.widget-content.widget-loading').css('display','flex');
+
+            self.fetchAccountInvoice().then(function (AccountInvoice) {
+                return AccountInvoice;
+            }).then(function (AccountInvoice) {
+                self.AccountInvoice = AccountInvoice;
+                return self.fetchResCompany();
+            }).then(function(ResCompany) {
+                self.ResCompany = ResCompany;
+                return self.fetchResCurrecy();
+            }).then(function(ResCurrecy) {
+                self.ResCurrecy = ResCurrecy;
+                return self.showThisMonth();
+            });
+        },
+
+        // Usuario Logeado
+        fetchCurrentUser: function() {
+            var self = this;
+            var ResUser = new model.web.Model('res.users');
+            return ResUser.call('get_user', {
+                context: new model.web.CompoundContext()
+            });
+        },
+
+        // Lista de Graficos disponibles para el usuario
+        fetchResUser: function(id) {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name','chart_ids'];
+            var domain = [['id','=',id]];
+            var ResUser = new model.web.Model('res.users');
+            ResUser.query(fields).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+
+            return defer;
+        },
+
+        // Obtener detalles de la lista de graficos
+        fetchChartList: function(chart_ids) {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name'];
+            var domain = [['id','in',chart_ids]];
+            var ChartList = new model.web.Model('chart.list');
+            ChartList.query(fields).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        fetchAccountInvoice: function() {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id', 'name', 'date_invoice', 'amount_total'];
+            var domain = [['state', 'not in', ['draft','cancel']],['origin','!=',false],['type','=','in_invoice']];
+            var AccountInvoice = new model.web.Model('account.invoice');
+            AccountInvoice.query(fields).filter(domain).all().then(function(results) {
+                defer.resolve(results);
+            });
+
+            return defer;
+        },
+
+        fetchResCompany: function() {
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name', 'currency_id'];
+            var domain = [['id', '=', 1]];
+            var ResCompany = new model.web.Model('res.company');
+            ResCompany.query(fields).filter(domain).all().then(function (results) {
+                defer.resolve(results);
+            });
+
+            return defer;
+        },
+
+        fetchResCurrecy : function(){
+            var self = this;
+            var defer = $.Deferred();
+            var fields = ['id','name', 'symbol', 'rate_silent', 'base', 'decimal_separator', 'decimal_places', 'thousands_separator', 'symbol_position'];
+            var domain = [['active', '=', true]];
+            var ResCurrecy = new model.web.Model('res.currency');
+            ResCurrecy.query(fields).filter(domain).all().then(function(results) {
+                defer.resolve(results);
+            });
+            return defer;
+        },
+
+        getResCurrency: function (id) {
+            var self = this;
+            return _.filter(self.ResCurrecy,function (item) {
+                return item.id === id;
+            })
+        },
+
+        getTodayAccountInvoice:function() {
+            var self = this;
+            var date = moment().format('YYYY-MM-DD');
+            return _.flatten(_.filter(self.AccountInvoice,function (inv) {
+                return moment(inv.date_invoice).format('YYYY-MM-DD') === date;
+            }));
+        },
+
+        getThisWeekAccountInvoice:function() {
+            var self = this;
+            var week = moment().week();
+            return _.flatten(_.filter(self.AccountInvoice,function (inv) {
+                return moment(inv.date_invoice).week() === week & moment(inv.date_invoice).format('YYYY')=== moment().format('YYYY');
+            }));
+        },
+
+        getThisMonthAccountInvoice:function() {
+            var self = this;
+            return _.flatten(_.filter(self.AccountInvoice,function (inv) {
+                return moment(inv.date_invoice).format('YYYY-MM')=== moment().format('YYYY-MM');
+            }));
+        },
+
+        showToday: function () {
+            var self = this;
+            var amount = 0;
+            var data = [];
+            var invoice = self.getTodayAccountInvoice();
+            var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            if(invoice.length > 0){
+                amount = _.reduce(_.map(invoice, function (map) {
+                    return map.amount_total;
+                }), function (memo, num) {
+                    return memo + num;
+                });
+            }
+            self.$el.find('.widget-content.widget-loading').css('display','none');
+            self.$el.find('.widget-content').find('a').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+        },
+
+        showThisWeek: function () {
+            var self = this;
+            var amount = 0;
+            var data = [];
+            var invoice = self.getThisWeekAccountInvoice();
+            var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            if(invoice.length > 0){
+                amount = _.reduce(_.map(invoice, function (map) {
+                    return map.amount_total;
+                }), function (memo, num) {
+                    return memo + num;
+                });
+            }
+            self.$el.find('.widget-content.widget-loading').css('display','none');
+            self.$el.find('.widget-content').find('a').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+        },
+
+        showThisMonth: function () {
+            var self = this;
+            var amount = 0;
+            var data = [];
+            var invoice = self.getThisMonthAccountInvoice();
+            var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
+            if(invoice.length > 0){
+                amount = _.reduce(_.map(invoice, function (map) {
+                    return map.amount_total;
+                }), function (memo, num) {
+                    return memo + num;
+                });
+            }
+            self.$el.find('.widget-content.widget-loading').css('display','none');
+            self.$el.find('.widget-content').find('a').text(accounting.formatMoney(amount, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator))
+        },
+    });
+}

+ 20 - 15
static/src/xml/widgets/chart_invoice.xml

@@ -3,21 +3,26 @@
     <t t-name="ChartInvoice">
         <t t-call="WidgetReportingBaseTemplate">
             <h2  class="widget-title">
-                <i class="fa fa-bar-chart" aria-hidden="true"></i>
-                <span>Historico de facturas</span>
-                <div class="col-xs-6 col-xs-offset-10">
-                    <div class="btn-group">
-                        <a type="button" class="btn btn-default">Filtrar</a>
-                        <a type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-                        <span class="caret"></span>
-                        <span class="sr-only">Toggle Dropdown</span>
-                        </a>
-                        <ul class="dropdown-menu dropdown-menu-right">
-                            <li><a class="days">15 dias</a></li>
-                            <li><a class="month">Meses</a></li>
-                            <li role="separator" class="divider"></li>
-                            <li><a class="week">Esta Semana</a></li>
-                        </ul>
+                <div class="row">
+                    <div class="col-xs-6">
+                        <i class="fa fa-bar-chart" aria-hidden="true"></i>
+                        <span>Ventas</span> 
+                    </div>
+                    <div class="col-xs-6">
+                        <div class="col-xs-6 col-xs-offset-9">
+                            <div class="btn-group btn-group-xs">
+                                <a type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+                                <span class="caret"></span>
+                                <span class="sr-only">Toggle Dropdown</span>
+                                </a>
+                                <ul class="dropdown-menu dropdown-menu-right">
+                                    <li><a class="days">15 dias</a></li>
+                                    <li><a class="month">Meses</a></li>
+                                    <li role="separator" class="divider"></li>
+                                    <li><a class="week">Esta Semana</a></li>
+                                </ul>
+                            </div>
+                        </div>
                     </div>
                 </div>
             </h2>

+ 20 - 15
static/src/xml/widgets/chart_pos_order.xml

@@ -4,21 +4,26 @@
     <t t-name="ChartPosOrder">
         <t t-call="WidgetReportingBaseTemplate">
             <h2  class="widget-title">
-                <i class="fa fa-bar-chart" aria-hidden="true"></i>
-                <span>Ventas</span>
-                <div class="col-xs-6 col-xs-offset-10">
-                    <div class="btn-group">
-                        <a type="button" class="btn btn-default">Filtrar</a>
-                        <a type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-                        <span class="caret"></span>
-                        <span class="sr-only">Toggle Dropdown</span>
-                        </a>
-                        <ul class="dropdown-menu dropdown-menu-right">
-                            <li><a class="days">15 dias</a></li>
-                            <li><a class="month">Meses</a></li>
-                            <li role="separator" class="divider"></li>
-                            <li><a class="week">Esta Semana</a></li>
-                        </ul>
+                <div class="row">
+                    <div class="col-xs-6">
+                        <i class="fa fa-bar-chart" aria-hidden="true"></i>
+                        <span>Ventas</span> 
+                    </div>
+                    <div class="col-xs-6">
+                        <div class="col-xs-6 col-xs-offset-9">
+                            <div class="btn-group btn-group-xs">
+                                <a type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+                                <span class="caret"></span>
+                                <span class="sr-only">Toggle Dropdown</span>
+                                </a>
+                                <ul class="dropdown-menu dropdown-menu-right">
+                                    <li><a class="days">15 dias</a></li>
+                                    <li><a class="month">Meses</a></li>
+                                    <li role="separator" class="divider"></li>
+                                    <li><a class="week">Esta Semana</a></li>
+                                </ul>
+                            </div>
+                        </div>
                     </div>
                 </div>
             </h2>

+ 20 - 15
static/src/xml/widgets/chart_purchase_expense.xml

@@ -4,21 +4,26 @@
     <t t-name="ChartPurchaseExpense">
         <t t-call="WidgetReportingBaseTemplate">
             <h2  class="widget-title">
-                <i class="fa fa-bar-chart" aria-hidden="true"></i>
-                <span> Compras y Gastos </span>
-                <div class="col-xs-6 col-xs-offset-10">
-                    <div class="btn-group">
-                        <a type="button" class="btn btn-default">Filtrar</a>
-                        <a type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-                        <span class="caret"></span>
-                        <span class="sr-only">Toggle Dropdown</span>
-                        </a>
-                        <ul class="dropdown-menu dropdown-menu-right">
-                            <li><a class="days">15 dias</a></li>
-                            <li><a class="month">Meses</a></li>
-                            <li role="separator" class="divider"></li>
-                            <li><a class="week">Esta Semana</a></li>
-                        </ul>
+                <div class="row">
+                    <div class="col-xs-6">
+                        <i class="fa fa-bar-chart" aria-hidden="true"></i>
+                        <span>Compras y Gastos</span> 
+                    </div>
+                    <div class="col-xs-6">
+                        <div class="col-xs-6 col-xs-offset-9">
+                            <div class="btn-group btn-group-xs">
+                                <a type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+                                <span class="caret"></span>
+                                <span class="sr-only">Toggle Dropdown</span>
+                                </a>
+                                <ul class="dropdown-menu dropdown-menu-right">
+                                    <li><a class="days">15 dias</a></li>
+                                    <li><a class="month">Meses</a></li>
+                                    <li role="separator" class="divider"></li>
+                                    <li><a class="week">Esta Semana</a></li>
+                                </ul>
+                            </div>
+                        </div>
                     </div>
                 </div>
             </h2>

+ 38 - 0
static/src/xml/widgets/widget_balance.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="WidgetBalance">
+        <div>
+            <div class="grid-stack-item-content reporting-dashboard balance">
+                <h2 class="widget-title">
+                    <div class="row">
+                        <div class="col-xs-6">
+                           <i class="fa fa-money" aria-hidden="true"> </i>
+                            Beneficio
+                        </div>
+                        <div class="col-xs-6">
+                            <div class="col-xs-6 col-xs-offset-9">
+                                <div class="btn-group btn-group-xs">
+                                    <a type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+                                    <span class="caret"></span>
+                                    <span class="sr-only">Toggle Dropdown</span>
+                                    </a>
+                                    <ul class="dropdown-menu dropdown-menu-right">
+                                        <li><a class="today">Hoy</a></li>
+                                        <li><a class="thisWeek">Esta Semana</a></li>
+                                        <li><a class="thisMonth">Este Mes</a></li>
+                                    </ul>
+                                </div>
+                            </div>  
+                        </div>
+                    </div>
+                </h2>
+                <div class="widget-content">
+                    <a></a>
+                </div>
+                <div class="widget-content widget-loading">
+                    <i class='fa fa-cog fa-spin fa-3x fa-fw'></i>
+                </div>
+            </div>
+        </div>
+    </t>
+</template>

+ 38 - 0
static/src/xml/widgets/widget_expense.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="WidgetExpense">
+        <div>
+            <div class="grid-stack-item-content reporting-dashboard expense">
+                <h2 class="widget-title">
+                    <div class="row">
+                        <div class="col-xs-6">
+                           <i class="fa fa-money" aria-hidden="true"> </i>
+                            Gastos 
+                        </div>
+                        <div class="col-xs-6">
+                            <div class="col-xs-6 col-xs-offset-9">
+                                <div class="btn-group btn-group-xs">
+                                    <a type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+                                    <span class="caret"></span>
+                                    <span class="sr-only">Toggle Dropdown</span>
+                                    </a>
+                                    <ul class="dropdown-menu dropdown-menu-right">
+                                        <li><a class="today">Hoy</a></li>
+                                        <li><a class="thisWeek">Esta Semana</a></li>
+                                        <li><a class="thisMonth">Este Mes</a></li>
+                                    </ul>
+                                </div>
+                            </div>  
+                        </div>
+                    </div>
+                </h2>
+                <div class="widget-content">
+                    <a></a>
+                </div>
+                <div class="widget-content widget-loading">
+                    <i class='fa fa-cog fa-spin fa-3x fa-fw'></i>
+                </div>
+            </div>
+        </div>
+    </t>
+</template>

+ 38 - 0
static/src/xml/widgets/widget_pos_order.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="WidgetPosOrder">
+        <div>
+            <div class="grid-stack-item-content reporting-dashboard sale">
+                <h2 class="widget-title">
+                    <div class="row">
+                        <div class="col-xs-6">
+                           <i class="fa fa-money" aria-hidden="true"> </i>
+                            Ventas 
+                        </div>
+                        <div class="col-xs-6">
+                            <div class="col-xs-6 col-xs-offset-9">
+                                <div class="btn-group btn-group-xs">
+                                    <a type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+                                    <span class="caret"></span>
+                                    <span class="sr-only">Toggle Dropdown</span>
+                                    </a>
+                                    <ul class="dropdown-menu dropdown-menu-right">
+                                        <li><a class="today">Hoy</a></li>
+                                        <li><a class="thisWeek">Esta Semana</a></li>
+                                        <li><a class="thisMonth">Este Mes</a></li>
+                                    </ul>
+                                </div>
+                            </div>  
+                        </div>
+                    </div>
+                </h2>
+                <div class="widget-content">
+                    <a></a>
+                </div>
+                <div class="widget-content widget-loading">
+                    <i class='fa fa-cog fa-spin fa-3x fa-fw'></i>
+                </div>
+            </div>
+        </div>
+    </t>
+</template>

+ 38 - 0
static/src/xml/widgets/widget_purchase.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="WidgetPurchase">
+        <div>
+            <div class="grid-stack-item-content reporting-dashboard purchase">
+                <h2 class="widget-title">
+                    <div class="row">
+                        <div class="col-xs-6">
+                           <i class="fa fa-money" aria-hidden="true"> </i>
+                            Compras 
+                        </div>
+                        <div class="col-xs-6">
+                            <div class="col-xs-6 col-xs-offset-9">
+                                <div class="btn-group btn-group-xs">
+                                    <a type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+                                    <span class="caret"></span>
+                                    <span class="sr-only">Toggle Dropdown</span>
+                                    </a>
+                                    <ul class="dropdown-menu dropdown-menu-right">
+                                        <li><a class="today">Hoy</a></li>
+                                        <li><a class="thisWeek">Esta Semana</a></li>
+                                        <li><a class="thisMonth">Este Mes</a></li>
+                                    </ul>
+                                </div>
+                            </div>  
+                        </div>
+                    </div>
+                </h2>
+                <div class="widget-content">
+                    <a></a>
+                </div>
+                <div class="widget-content widget-loading">
+                    <i class='fa fa-cog fa-spin fa-3x fa-fw'></i>
+                </div>
+            </div>
+        </div>
+    </t>
+</template>

+ 4 - 0
templates.xml

@@ -19,6 +19,10 @@
                 <script type="text/javascript" src="/eiru_reporting_dashboard/static/src/js/widgets/chart_pos_order_salesman.js" />
                 <script type="text/javascript" src="/eiru_reporting_dashboard/static/src/js/widgets/chart_pos_order.js" />
                 <script type="text/javascript" src="/eiru_reporting_dashboard/static/src/js/widgets/chart_purchase_expense.js" />
+                <script type="text/javascript" src="/eiru_reporting_dashboard/static/src/js/widgets/widget_pos_order.js" />
+                <script type="text/javascript" src="/eiru_reporting_dashboard/static/src/js/widgets/widget_purchase.js" />
+                <script type="text/javascript" src="/eiru_reporting_dashboard/static/src/js/widgets/widget_expense.js" />
+                <script type="text/javascript" src="/eiru_reporting_dashboard/static/src/js/widgets/widget_balance.js" />
 
                 <!-- Dashboard Main  -->
                 <script type="text/javascript" src="/eiru_reporting_dashboard/static/src/js/dashboard.js" />