|
@@ -83,9 +83,6 @@ function report_customer_ratings(reporting){
|
|
|
_.each(AccountPeriod,function(item){
|
|
|
self.$el.find('#current-period').append('<option value="' + item.id + '">' + item.name + '</option>');
|
|
|
});
|
|
|
- return self.fetchResCurrency();
|
|
|
- }).then(function(ResCurrency){
|
|
|
- self.ResCurrency = ResCurrency;
|
|
|
return self.fetchResPartner();
|
|
|
}).then(function(ResPartner){
|
|
|
self.ResPartner = ResPartner;
|
|
@@ -123,6 +120,9 @@ function report_customer_ratings(reporting){
|
|
|
return self.fetchAccountMoveLine();
|
|
|
}).then(function (AccountMoveLine){
|
|
|
self.AccountMoveLine = AccountMoveLine;
|
|
|
+ return self.fetchResCurrency();
|
|
|
+ }).then(function(ResCurrency){
|
|
|
+ self.ResCurrency = ResCurrency;
|
|
|
return self.BuildTable();
|
|
|
});
|
|
|
},
|
|
@@ -529,7 +529,6 @@ function report_customer_ratings(reporting){
|
|
|
var Currency = self.getResCurrency(item.invoice_currency[0]).shift();
|
|
|
|
|
|
_.each(AccountMoveLine, function(index){
|
|
|
-
|
|
|
var date;
|
|
|
|
|
|
var state = 'Vencido';
|
|
@@ -648,7 +647,52 @@ function report_customer_ratings(reporting){
|
|
|
});
|
|
|
|
|
|
self.content = data;
|
|
|
+ self.CallCharts(data, CurrencyBase);
|
|
|
self.loadTable(data);
|
|
|
+ },
|
|
|
+
|
|
|
+ CallCharts: function(data,CurrencyBase){
|
|
|
+ var self = this;
|
|
|
+ var state = $('#current-state').val();
|
|
|
+ /*
|
|
|
+ ================================================
|
|
|
+ GRAFICO DE BARRAS
|
|
|
+ ================================================
|
|
|
+ */
|
|
|
+ var BarChart = new model.eiru_reports.ReportChartWidget(self);
|
|
|
+ var rank = 10;
|
|
|
+ var item;
|
|
|
+ var label = [];
|
|
|
+ var body = [];
|
|
|
+ for (var i = 0; i < rank; i++) {
|
|
|
+ if (data[i]){
|
|
|
+ item = data[i];
|
|
|
+ }else{
|
|
|
+ item = {};
|
|
|
+ item.partner_name = "N/A";
|
|
|
+ item.max_days_of_delay=0;
|
|
|
+ item.due_qty=0;
|
|
|
+ item.amount_no_format=0;
|
|
|
+ }
|
|
|
+
|
|
|
+ label.push(item.partner_name.trim());
|
|
|
+ if(state == 'day_of_delay'){
|
|
|
+ body.push(item.max_days_of_delay);
|
|
|
+ CurrencyBase.symbol = "Días atrasados: ";
|
|
|
+ };
|
|
|
+ if(state == 'due_qty'){
|
|
|
+ body.push(item.due_qty);
|
|
|
+ CurrencyBase.symbol = "Cuotas vencidas: ";
|
|
|
+ }
|
|
|
+ if(state == 'amount_delay'){
|
|
|
+ body.push(item.amount_no_format);
|
|
|
+ };
|
|
|
+
|
|
|
+ }
|
|
|
+ $('.chart-container').empty();
|
|
|
+ $('.chart-container').html('<canvas class="reporting-chart"></canvas>');
|
|
|
+ BarChart.BuildBarChart(data,CurrencyBase,label,body);
|
|
|
+
|
|
|
self.$el.find('.report-form').css('display','block');
|
|
|
self.$el.find('.search-form').unblock();
|
|
|
self.$el.find('.report-form').unblock();
|