|
@@ -24,6 +24,9 @@ function report_saledecorart_utility_analytic(reporting){
|
|
|
'click #C' : 'fectSearch',
|
|
|
'click #D' : 'fectSearch',
|
|
|
'click #Z' : 'fectSearch',
|
|
|
+ 'click #W' : 'fectSearch',
|
|
|
+ 'click #paid' : 'fectSearch',
|
|
|
+ 'click #open' : 'fectSearch',
|
|
|
'change #current-store': 'fectSearch',
|
|
|
'change #current-journal': 'fectSearch',
|
|
|
'change #current-category' : 'fectSearch',
|
|
@@ -297,7 +300,7 @@ function report_saledecorart_utility_analytic(reporting){
|
|
|
// Invoice (FACTURAS)
|
|
|
fetchInvoiceV2: function () {
|
|
|
var self = this;
|
|
|
- var filter ="[['state', 'in',['open']],['type', '=', 'out_invoice']";
|
|
|
+ var filter ="[['state', 'in',['open','paid']],['type', '=', 'out_invoice']";
|
|
|
var journal_ids = _.flatten(_.map(self.AccountJournal, function (item) {
|
|
|
return item.id;
|
|
|
}));
|
|
@@ -512,6 +515,7 @@ function report_saledecorart_utility_analytic(reporting){
|
|
|
var data=[];
|
|
|
var CurrencyBase = self.getResCurrency(self.resCompany[0].currency_id[0]).shift();
|
|
|
var item;
|
|
|
+ var state;
|
|
|
var invoice=[];
|
|
|
var voucher=[];
|
|
|
var product;
|
|
@@ -519,6 +523,14 @@ function report_saledecorart_utility_analytic(reporting){
|
|
|
for (var i = 0; i < this.invoiceLines.length; i++) {
|
|
|
item = this.invoiceLines[i];
|
|
|
invoice = this.getInvoice(item.id);
|
|
|
+
|
|
|
+ if(invoice.state=='open'){
|
|
|
+ state = 'Abierto'
|
|
|
+ }
|
|
|
+ if(invoice.state=='paid'){
|
|
|
+ state = 'Pagado'
|
|
|
+ }
|
|
|
+
|
|
|
var currency = self.getResCurrency(invoice.currency_id[0]).shift();
|
|
|
voucher = self.getAccountMoveLine(invoice.number);
|
|
|
var x = voucher.length;
|
|
@@ -555,11 +567,10 @@ function report_saledecorart_utility_analytic(reporting){
|
|
|
partner_name : invoice.partner_id[1],
|
|
|
category_name : product.categ_id.complete_name,
|
|
|
category_id : product.categ_id.id,
|
|
|
- attribute_ids : product.attribute_ids,
|
|
|
- attribute_value_ids : product.atribute_value_ids,
|
|
|
user_id : self.valorNull(invoice.user_id[0]),
|
|
|
user_name : invoice.user_id[1],
|
|
|
store_id : store_id[0].store_ids[0],
|
|
|
+ state: state,
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -590,8 +601,7 @@ function report_saledecorart_utility_analytic(reporting){
|
|
|
var product = this.$el.find('#product').val().split('-');
|
|
|
var categ_ids = [];
|
|
|
var category = self.$el.find('#current-category').val();
|
|
|
- var attribute = self.$el.find('#current-attribute').val();
|
|
|
- var attribute_value = self.$el.find('#current-attribute-value').val();
|
|
|
+ var state = self.$el.find('#current-state').val();
|
|
|
var desde =this.$el.find('#from').val();
|
|
|
var hasta =this.$el.find('#to').val();
|
|
|
var store = this.$el.find('#current-store').val();
|
|
@@ -636,6 +646,16 @@ function report_saledecorart_utility_analytic(reporting){
|
|
|
}else{
|
|
|
$('#datepicker').css('display','none');
|
|
|
}
|
|
|
+ if ($('#paid').is(":checked")){
|
|
|
+ content = _.filter(content, function (inv){
|
|
|
+ return inv.state == 'Pagado';
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if ($('#open').is(":checked")){
|
|
|
+ content = _.filter(content, function (inv){
|
|
|
+ return inv.state == 'Abierto';
|
|
|
+ });
|
|
|
+ }
|
|
|
if (partner != ""){
|
|
|
content = _.filter(content, function(inv){
|
|
|
return inv.partner_id == partner[0];
|
|
@@ -699,16 +719,10 @@ function report_saledecorart_utility_analytic(reporting){
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- if(attribute && attribute != 9999999 && attribute_value == 9999999){
|
|
|
- content = _.filter(content,function (inv) {
|
|
|
- return _.contains(inv.attribute_ids, parseInt(attribute));
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- if(attribute_value && attribute_value != 9999999){
|
|
|
- content = _.filter(content,function (inv) {
|
|
|
- return _.contains(inv.attribute_value_ids, parseFloat(attribute_value));
|
|
|
- });
|
|
|
+ if(state && state != 9999999){
|
|
|
+ content = _.flatten(_.filter(content,function (item) {
|
|
|
+ return item.state == state;
|
|
|
+ }));
|
|
|
}
|
|
|
|
|
|
var quantity_tot_total = _.reduce(_.map(content,function(map){
|
|
@@ -854,6 +868,7 @@ function report_saledecorart_utility_analytic(reporting){
|
|
|
utility : {halign:'right',columnWidth: 17},
|
|
|
utilidad : {halign:'right',columnWidth: 17},
|
|
|
user_name : {columnWidth: 15},
|
|
|
+ state:{columnWidth: 12},
|
|
|
},
|
|
|
margin: { top: 16, horizontal: 7},
|
|
|
addPageContent: function (data) {
|
|
@@ -891,7 +906,7 @@ function report_saledecorart_utility_analytic(reporting){
|
|
|
if (typeof pdfDoc.putTotalPages === 'function') {
|
|
|
pdfDoc.putTotalPages(totalPagesExp);
|
|
|
}
|
|
|
- pdfDoc.save('Análisis de facturas de venta.pdf')
|
|
|
+ pdfDoc.save('Análisis de utilidad de líneas de facturas de venta.pdf')
|
|
|
},
|
|
|
});
|
|
|
}
|