|
@@ -93,9 +93,6 @@ function report_customer_payment (reporting){
|
|
|
}else{
|
|
|
self.$el.find('.company').css('display','none');
|
|
|
}
|
|
|
- return self.fetchAccountVoucher();
|
|
|
- }).then(function (AccountVoucher) {
|
|
|
- self.AccountVoucher = AccountVoucher;
|
|
|
return self.fetchResCurrency();
|
|
|
}).then(function(ResCurrency){
|
|
|
self.ResCurrency = ResCurrency;
|
|
@@ -119,8 +116,11 @@ function report_customer_payment (reporting){
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- this.fetchAccountInvoice().then(function(AccountInvoice) {
|
|
|
- return AccountInvoice;
|
|
|
+ this.fetchAccountVoucher().then(function(AccountVoucher) {
|
|
|
+ return AccountVoucher;
|
|
|
+ }).then(function (AccountVoucher){
|
|
|
+ self.AccountVoucher = AccountVoucher;
|
|
|
+ return self.fetchAccountInvoice();
|
|
|
}).then(function(AccountInvoice){
|
|
|
self.AccountInvoice = AccountInvoice;
|
|
|
return self.fetchAccountInvoiceLine();
|
|
@@ -153,13 +153,55 @@ function report_customer_payment (reporting){
|
|
|
|
|
|
fetchAccountVoucher: function () {
|
|
|
var self = this;
|
|
|
- var defer = $.Deferred();
|
|
|
+ var date = self.$el.find('#current-date').val();
|
|
|
+ var desde = self.$el.find('#from').val();
|
|
|
+ var hasta = self.$el.find('#to').val();
|
|
|
+
|
|
|
+ var domain = [
|
|
|
+ ['state', 'in',['posted']],
|
|
|
+ ];
|
|
|
+
|
|
|
+ if(date && date != 9999999){
|
|
|
+
|
|
|
+ if(desde){
|
|
|
+ var date = desde.split('/')
|
|
|
+ date = (date[2]+"-"+date[1]+"-"+date[0]);
|
|
|
+ domain.push(['date_voucher','>=',date]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(hasta){
|
|
|
+ var date = hasta.split('/')
|
|
|
+ date = (date[2]+"-"+date[1]+"-"+date[0]);
|
|
|
+ domain.push(['date','<=',date]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(date == 'today'){
|
|
|
+ var today = moment().format('YYYY-MM-DD');
|
|
|
+ domain.push(['date','=',today]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(date == 'yesterday'){
|
|
|
+ var yesterday = moment().add(-1,'days').format('YYYY-MM-DD');
|
|
|
+ domain.push(['date','=',yesterday]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(date == 'currentMonth'){
|
|
|
+ var currentMonth = moment().format('YYYY-MM');
|
|
|
+ domain.push(['date','like',currentMonth]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(date == 'lastMonth'){
|
|
|
+ var lastMonth = moment().add(-1,'months').format('YYYY-MM');
|
|
|
+ domain.push(['date','like',lastMonth]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
var AccountVoucher = new model.web.Model('account.voucher');
|
|
|
- AccountVoucher.query(['id', 'number','reference','seq_invoice','partner_id','employee_id', 'employee_id2','journal_id','amount','date','number']).filter([['state', '=', 'posted']]).all().then(function(results){
|
|
|
- defer.resolve(results);
|
|
|
+ return AccountVoucher.call('getAccountVoucherDental',[domain], {
|
|
|
+ context: new model.web.CompoundContext()
|
|
|
});
|
|
|
- return defer;
|
|
|
},
|
|
|
+
|
|
|
fetchResPartner: function () {
|
|
|
var self = this;
|
|
|
var defer = $.Deferred();
|
|
@@ -182,6 +224,7 @@ function report_customer_payment (reporting){
|
|
|
});
|
|
|
return defer;
|
|
|
},
|
|
|
+
|
|
|
fetchAccountJournal: function () {
|
|
|
var self = this;
|
|
|
var defer = $.Deferred();
|
|
@@ -280,9 +323,6 @@ function report_customer_payment (reporting){
|
|
|
var CurrencyBase = self.getResCurrency(self.ResCompany[0].currency_id[0]).shift();
|
|
|
};
|
|
|
|
|
|
- var item;
|
|
|
- var producto;
|
|
|
-
|
|
|
var invoice;
|
|
|
var amount_in;
|
|
|
_.each(AccountVoucher, function(item){
|
|
@@ -315,14 +355,14 @@ function report_customer_payment (reporting){
|
|
|
number: item.number,
|
|
|
seq_invoice: self.valorNull(item.seq_invoice),
|
|
|
journal: item.journal_id[1],
|
|
|
- date_voucher: moment(item.date).format("DD/MM/YYYY"),
|
|
|
+ date_voucher: moment(item.date).format('YYYY-MM-DD'),
|
|
|
partner: item.partner_id[1],
|
|
|
product_name : line_item.product_id.name,
|
|
|
amount_in: accounting.formatMoney(total_price,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
|
|
|
total_comision: accounting.formatMoney(tcomision,'', CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
|
|
|
date: item.date,
|
|
|
- empl_name: item.employee_id[1],
|
|
|
- employee_name: item.employee_id2[1],
|
|
|
+ empl_name: self.valorNull(item.employee_id[1]),
|
|
|
+ employee_name: self.valorNull(item.employee_id2[1]),
|
|
|
journal_id: item.journal_id[0],
|
|
|
partner_id: item.partner_id[0],
|
|
|
|