|
@@ -6,6 +6,7 @@ function report_bank_movements (reporting){
|
|
reporting.ReportBankMovementsWidget = reporting.Base.extend({
|
|
reporting.ReportBankMovementsWidget = reporting.Base.extend({
|
|
template: 'ReportBankMovements',
|
|
template: 'ReportBankMovements',
|
|
content:[],
|
|
content:[],
|
|
|
|
+ ResBank:[],
|
|
rowsData :[],
|
|
rowsData :[],
|
|
events:{
|
|
events:{
|
|
'click #toolbar > button' : 'clickOnAction',
|
|
'click #toolbar > button' : 'clickOnAction',
|
|
@@ -18,13 +19,14 @@ function report_bank_movements (reporting){
|
|
'click #Z' : 'factSearch',
|
|
'click #Z' : 'factSearch',
|
|
|
|
|
|
'click #Y' : 'factSearch',
|
|
'click #Y' : 'factSearch',
|
|
- 'click #sale' : 'factSearch',
|
|
|
|
- 'click #purchase' : 'factSearch',
|
|
|
|
- 'click #expense' : 'factSearch',
|
|
|
|
|
|
+ 'click #current-bank' : 'factSearch',
|
|
|
|
+ 'click #bankPaymentsType' : 'factSearch',
|
|
|
|
|
|
'click #W' : 'factSearch',
|
|
'click #W' : 'factSearch',
|
|
- 'click #open' : 'factSearch',
|
|
|
|
- 'click #paid' : 'factSearch',
|
|
|
|
|
|
+ 'click #available' : 'factSearch',
|
|
|
|
+ 'click #cashed' : 'factSearch',
|
|
|
|
+ 'click #negotiated' : 'factSearch',
|
|
|
|
+ 'click #renegotiated' : 'factSearch',
|
|
|
|
|
|
'change #from' : 'factSearch',
|
|
'change #from' : 'factSearch',
|
|
'change #to' : 'factSearch',
|
|
'change #to' : 'factSearch',
|
|
@@ -42,54 +44,60 @@ function report_bank_movements (reporting){
|
|
this.submitForm();
|
|
this.submitForm();
|
|
},
|
|
},
|
|
clickAnalysisDetail: function(e, row, $element, field){
|
|
clickAnalysisDetail: function(e, row, $element, field){
|
|
- if (field == 'number'){
|
|
|
|
|
|
+ if (field == 'create_date'){
|
|
this.do_action({
|
|
this.do_action({
|
|
- name:"Factura de proveedor",
|
|
|
|
|
|
+ name:"Detalles del Movimiento",
|
|
type: 'ir.actions.act_window',
|
|
type: 'ir.actions.act_window',
|
|
- res_model: "account.invoice",
|
|
|
|
|
|
+ res_model: "res.bank.payments",
|
|
views: [[false,'form']],
|
|
views: [[false,'form']],
|
|
target: 'new',
|
|
target: 'new',
|
|
- domain: [['type', '=', 'in_invoice'],['id','=', row.id]],
|
|
|
|
|
|
+ domain: [['id','=', row.id]],
|
|
context: {},
|
|
context: {},
|
|
flags: {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
|
|
flags: {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
|
|
res_id: row.id,
|
|
res_id: row.id,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- if (field == 'partner'){
|
|
|
|
|
|
+ if (field == 'bank'){
|
|
this.do_action({
|
|
this.do_action({
|
|
- name:"Registro",
|
|
|
|
|
|
+ name:"Registro Banco",
|
|
type: 'ir.actions.act_window',
|
|
type: 'ir.actions.act_window',
|
|
- res_model: "res.partner",
|
|
|
|
|
|
+ res_model: "res.bank",
|
|
views: [[false,'form']],
|
|
views: [[false,'form']],
|
|
target: 'new',
|
|
target: 'new',
|
|
- domain: [['id','=', row.partner_id]],
|
|
|
|
|
|
+ domain: [['id','=', row.bank_id]],
|
|
context: {},
|
|
context: {},
|
|
flags: {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
|
|
flags: {'form': {'action_buttons': false, 'options': {'mode': 'view'}}},
|
|
- res_id: row.partner_id,
|
|
|
|
|
|
+ res_id: row.bank_id,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
e.stopImmediatePropagation();
|
|
e.stopImmediatePropagation();
|
|
},
|
|
},
|
|
submitForm: function () {
|
|
submitForm: function () {
|
|
var self = this;
|
|
var self = this;
|
|
- self.fetchAccountInvoice().then(function(AccountInvoice) {
|
|
|
|
- return AccountInvoice;
|
|
|
|
- }).then(function (AccountInvoice) {
|
|
|
|
- self.AccountInvoice = AccountInvoice;
|
|
|
|
- // return self.fecthResStore();
|
|
|
|
- // }).then(function(ResStore){
|
|
|
|
- // self.ResStore = ResStore;
|
|
|
|
- // self.$el.find('#current-store').append('<option value="9999999">Todas las SUC.</option>');
|
|
|
|
- // _.each(ResStore,function(item){
|
|
|
|
- // self.$el.find('#current-store').append('<option value="' + item.id + '">' + item.name + '</option>');
|
|
|
|
- // });
|
|
|
|
- return self.fecthAccountJournal();
|
|
|
|
- }).then(function(AccountJournal){
|
|
|
|
- self.AccountJournal = AccountJournal;
|
|
|
|
|
|
+ self.fetchBankPayment().then(function(BankPayment) {
|
|
|
|
+ return BankPayment;
|
|
|
|
+ }).then(function (BankPayment) {
|
|
|
|
+ self.BankPayment = BankPayment;
|
|
|
|
+ return self.fecthResBank();
|
|
|
|
+ }).then(function(ResBank){
|
|
|
|
+ self.ResBank = ResBank;
|
|
|
|
+ self.$el.find('#current-bank').append('<option value="9999999">Todas los bancos</option>');
|
|
|
|
+ _.each(ResBank,function(item){
|
|
|
|
+ self.$el.find('#current-bank').append('<option value="' + item.id + '">' + item.name + '</option>');
|
|
|
|
+ });
|
|
|
|
+ return self.fetchResBankPaymentsType();
|
|
|
|
+ }).then(function(BankPaymentsType){
|
|
|
|
+ self.BankPaymentsType = BankPaymentsType;
|
|
|
|
+ self.$el.find('#current-bank-type').append('<option value="9999999">Todas los tipos</option>');
|
|
|
|
+ _.each(BankPaymentsType,function(item){
|
|
|
|
+ self.$el.find('#current-bank-type').append('<option value="' + item.id + '">' + item.name + '</option>');
|
|
|
|
+ });
|
|
return self.fetchResPartner();
|
|
return self.fetchResPartner();
|
|
}).then(function(ResPartner){
|
|
}).then(function(ResPartner){
|
|
self.ResPartner = ResPartner;
|
|
self.ResPartner = ResPartner;
|
|
self.search();
|
|
self.search();
|
|
|
|
+ self.searchBank();
|
|
|
|
+ self.searchBankPaymentsType();
|
|
return self.BuildTable();
|
|
return self.BuildTable();
|
|
});
|
|
});
|
|
},
|
|
},
|
|
@@ -128,41 +136,89 @@ function report_bank_movements (reporting){
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
- // fecthResStore: function(){
|
|
|
|
- // var self = this;
|
|
|
|
- // var defer = $.Deferred();
|
|
|
|
- // var field=['id', 'name'];
|
|
|
|
- // var ResStore = new instance.web.Model('res.store');
|
|
|
|
- // ResStore.query(field).all().then(function(results){
|
|
|
|
- // defer.resolve(results);
|
|
|
|
- // });
|
|
|
|
- // return defer;
|
|
|
|
- // },
|
|
|
|
|
|
+ fetchBankPayment: function () {
|
|
|
|
+ var self = this;
|
|
|
|
+ var field = ['id', 'create_date', 'number', 'name_holder', 'state', 'number_cta', 'currency_id', 'bank_id','date','partner_id','amount_payment','amount_receipt','amount_total','bank_payments_type_id'];
|
|
|
|
+ var defer = $.Deferred();
|
|
|
|
+ var BankPayment = new instance.web.Model('res.bank.payments');
|
|
|
|
+ BankPayment.query(field).filter().all().then(function (results) {
|
|
|
|
+ defer.resolve(results);
|
|
|
|
+ });
|
|
|
|
+ return defer;
|
|
|
|
+ },
|
|
|
|
|
|
- fecthAccountJournal: function(){
|
|
|
|
|
|
+ fecthResBank: function() {
|
|
var self = this;
|
|
var self = this;
|
|
var defer = $.Deferred();
|
|
var defer = $.Deferred();
|
|
- var field = ['id', 'name'];
|
|
|
|
- var domain = [['active','=',true],['type','in',['sale','purchase']]];
|
|
|
|
- var AccountJournal = new instance.web.Model('account.journal');
|
|
|
|
- AccountJournal.query(field).filter(domain).all().then(function(results){
|
|
|
|
|
|
+ var ResBank = new instance.web.Model('res.bank');
|
|
|
|
+ ResBank.query(['id', 'name', 'ruc', 'active']).filter([['active', '=', true]]).all().then(function (results) {
|
|
defer.resolve(results);
|
|
defer.resolve(results);
|
|
});
|
|
});
|
|
return defer;
|
|
return defer;
|
|
},
|
|
},
|
|
|
|
|
|
- fetchAccountInvoice: function () {
|
|
|
|
|
|
+ searchBank: function () {
|
|
|
|
+ var self = this;
|
|
|
|
+ var results = self.ResBank;
|
|
|
|
+ results = _.map(results, function (item) {
|
|
|
|
+ return {
|
|
|
|
+ label: item.id + '-'+ item.name + ' ' + self.valorNull(item.ruc),
|
|
|
|
+ value: item.id + '-'+ item.name + ' ' + self.valorNull(item.ruc)
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ self.$('#bank').autocomplete({
|
|
|
|
+ source: results,
|
|
|
|
+ minLength:0,
|
|
|
|
+ search: function(event, ui) {
|
|
|
|
+ if (!(self.$('#bank').val())){
|
|
|
|
+ self.factSearch();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ close: function( event, ui ) {
|
|
|
|
+ self.factSearch();
|
|
|
|
+ },
|
|
|
|
+ select: function(event, ui) {
|
|
|
|
+ self.factSearch();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ fetchResBankPaymentsType: function() {
|
|
var self = this;
|
|
var self = this;
|
|
- var filter = [['type','not in',['in_refund','out_refund']],['state','in',['open','paid']]];
|
|
|
|
- var field = ['id', 'type', 'number', 'origin', 'state', 'journal_id', 'currency_id', 'supplier_invoice_number','date_invoice','partner_id','amount_total','user_id','type','residual'];
|
|
|
|
var defer = $.Deferred();
|
|
var defer = $.Deferred();
|
|
- var AccountInvoice = new instance.web.Model('account.invoice');
|
|
|
|
- AccountInvoice.query(field).filter(filter).all().then(function (results) {
|
|
|
|
|
|
+ var ResBankPaymentsType = new instance.web.Model('res.bank.payments.type');
|
|
|
|
+ ResBankPaymentsType.query(['id', 'name', 'code', 'is_receipt', 'is_payment']).filter().all().then(function (results) {
|
|
defer.resolve(results);
|
|
defer.resolve(results);
|
|
});
|
|
});
|
|
return defer;
|
|
return defer;
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ searchBankPaymentsType: function () {
|
|
|
|
+ var self = this;
|
|
|
|
+ var results = self.ResBankPaymentsType;
|
|
|
|
+ results = _.map(results, function (item) {
|
|
|
|
+ return {
|
|
|
|
+ label: item.id + '-'+ item.name + ' ' + self.valorNull(item.code),
|
|
|
|
+ value: item.id + '-'+ item.name + ' ' + self.valorNull(item.code)
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ self.$('#bankPaymentsType').autocomplete({
|
|
|
|
+ source: results,
|
|
|
|
+ minLength:0,
|
|
|
|
+ search: function(event, ui) {
|
|
|
|
+ if (!(self.$('#bankPaymentsType').val())){
|
|
|
|
+ self.factSearch();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ close: function( event, ui ) {
|
|
|
|
+ self.factSearch();
|
|
|
|
+ },
|
|
|
|
+ select: function(event, ui) {
|
|
|
|
+ self.factSearch();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
fetchResPartner: function() {
|
|
fetchResPartner: function() {
|
|
var self = this;
|
|
var self = this;
|
|
var defer = $.Deferred();
|
|
var defer = $.Deferred();
|
|
@@ -207,72 +263,41 @@ function report_bank_movements (reporting){
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
|
|
- getAccountJournal: function (id) {
|
|
|
|
- var self = this;
|
|
|
|
- return _.filter(self.AccountJournal,function (item) {
|
|
|
|
- return item.id === id;
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
|
|
+ // getAccountJournal: function (id) {
|
|
|
|
+ // var self = this;
|
|
|
|
+ // return _.filter(self.AccountJournal,function (item) {
|
|
|
|
+ // return item.id === id;
|
|
|
|
+ // });
|
|
|
|
+ // },
|
|
|
|
|
|
BuildTable: function(){
|
|
BuildTable: function(){
|
|
var self = this;
|
|
var self = this;
|
|
var data = [];
|
|
var data = [];
|
|
- var AccountInvoice = self.AccountInvoice;
|
|
|
|
|
|
+ var BankPayment = self.BankPayment;
|
|
var amount_total_num;
|
|
var amount_total_num;
|
|
- var entry;
|
|
|
|
- var egress;
|
|
|
|
- var to_receive;
|
|
|
|
- var to_pay;
|
|
|
|
- var entry_num;
|
|
|
|
- var egress_num;
|
|
|
|
- var to_receive_num;
|
|
|
|
- var to_pay_num;
|
|
|
|
- var invoice_type;
|
|
|
|
- _.each(AccountInvoice, function(item){
|
|
|
|
- if (item.type == 'out_invoice') {
|
|
|
|
- entry = item.amount_total - item.residual;
|
|
|
|
- egress = 0;
|
|
|
|
- to_receive = item.residual;
|
|
|
|
- to_pay = 0;
|
|
|
|
- invoice_type = 'sale';
|
|
|
|
- } else {
|
|
|
|
- entry = 0;
|
|
|
|
- egress = item.amount_total - item.residual;
|
|
|
|
- to_receive = 0;
|
|
|
|
- to_pay = item.residual;
|
|
|
|
- if (item.origin == false) {
|
|
|
|
- invoice_type = 'expense';
|
|
|
|
- } else {
|
|
|
|
- invoice_type = 'purchase';
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // var store_id = self.getAccountJournal(item.journal_id[0]);
|
|
|
|
- // if(store_id.length > 0){
|
|
|
|
|
|
+ _.each(BankPayment, function(item){
|
|
data.push({
|
|
data.push({
|
|
id : item.id,
|
|
id : item.id,
|
|
number: item.number,
|
|
number: item.number,
|
|
|
|
+ titular: item.name_holder,
|
|
partner: item.partner_id[1],
|
|
partner: item.partner_id[1],
|
|
- date_invoice: moment(item.date_invoice).format("DD/MM/YYYY"),
|
|
|
|
- user: item.user_id[1],
|
|
|
|
|
|
+ create_date: moment(item.create_date).format("DD/MM/YYYY"),
|
|
|
|
+ number_cta: item.number_cta,
|
|
|
|
+ amount_payment: accounting.formatNumber(item.amount_payment,0,".",","),
|
|
|
|
+ amount_receipt: accounting.formatNumber(item.amount_receipt,0,".",","),
|
|
amount_total: accounting.formatNumber(item.amount_total,0,".",","),
|
|
amount_total: accounting.formatNumber(item.amount_total,0,".",","),
|
|
- entry: accounting.formatNumber(entry,0,".",","),
|
|
|
|
- egress: accounting.formatNumber(egress,0,".",","),
|
|
|
|
- to_receive: accounting.formatNumber(to_receive,0,".",","),
|
|
|
|
- to_pay: accounting.formatNumber(to_pay,0,".",","),
|
|
|
|
|
|
+ date_maturity: moment(item.date_maturity).format("DD/MM/YYYY"),
|
|
|
|
+ type_bank: item.bank_payments_type_id[1],
|
|
|
|
+ bank: item.bank_id[1],
|
|
state: item.state,
|
|
state: item.state,
|
|
- invoice_type: invoice_type,
|
|
|
|
- date: item.date_invoice,
|
|
|
|
- journal_id : item.journal_id[0],
|
|
|
|
- currency_id : item.currency_id[0],
|
|
|
|
|
|
+ date: item.create_date,
|
|
partner_id : item.partner_id[0],
|
|
partner_id : item.partner_id[0],
|
|
|
|
+ bank_id : item.bank_id[0],
|
|
|
|
+ bank_payments_type_id: item.bank_payments_type_id[0],
|
|
amount_total_num: item.amount_total,
|
|
amount_total_num: item.amount_total,
|
|
- entry_num: entry,
|
|
|
|
- egress_num: egress,
|
|
|
|
- to_receive_num: to_receive,
|
|
|
|
- to_pay_num: to_pay,
|
|
|
|
- // store_id: store_id[0].store_ids[0],
|
|
|
|
|
|
+ amount_payment_num: item.amount_payment,
|
|
|
|
+ amount_receipt_num: item.amount_receipt,
|
|
});
|
|
});
|
|
- // }
|
|
|
|
});
|
|
});
|
|
self.content = data;
|
|
self.content = data;
|
|
this.loadTable(data);
|
|
this.loadTable(data);
|
|
@@ -284,7 +309,9 @@ function report_bank_movements (reporting){
|
|
var desde = this.$el.find('#from').val();
|
|
var desde = this.$el.find('#from').val();
|
|
var hasta = this.$el.find('#to').val();
|
|
var hasta = this.$el.find('#to').val();
|
|
var partner = this.$el.find('#partner').val().split('-');
|
|
var partner = this.$el.find('#partner').val().split('-');
|
|
- // var store = this.$el.find('#current-store').val();
|
|
|
|
|
|
+
|
|
|
|
+ var bank = this.$el.find('#current-bank').val().split('-');
|
|
|
|
+ var bankPaymentsType = this.$el.find('#bankPaymentsType').val();
|
|
var content = self.content;
|
|
var content = self.content;
|
|
|
|
|
|
if ($('#A').is(":checked")){
|
|
if ($('#A').is(":checked")){
|
|
@@ -352,75 +379,62 @@ function report_bank_movements (reporting){
|
|
$('#datepicker').css('display','none');
|
|
$('#datepicker').css('display','none');
|
|
}
|
|
}
|
|
|
|
|
|
- if ($('#sale').is(":checked")){
|
|
|
|
- content = _.filter(content, function (inv){
|
|
|
|
- return inv.invoice_type == 'sale';
|
|
|
|
|
|
+ if (partner != ""){
|
|
|
|
+ content = _.filter(content, function(inv){
|
|
|
|
+ return inv.partner_id == partner[0];
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- if ($('#purchase').is(":checked")){
|
|
|
|
|
|
+ if ($('#available').is(":checked")){
|
|
content = _.filter(content, function (inv){
|
|
content = _.filter(content, function (inv){
|
|
- return inv.invoice_type == 'purchase';
|
|
|
|
|
|
+ return inv.state == 'available';
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- if ($('#expense').is(":checked")){
|
|
|
|
|
|
+ if ($('#cashed').is(":checked")){
|
|
content = _.filter(content, function (inv){
|
|
content = _.filter(content, function (inv){
|
|
- return inv.invoice_type == 'expense';
|
|
|
|
|
|
+ return inv.state == 'cashed';
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- if ($('#open').is(":checked")){
|
|
|
|
|
|
+ if ($('#negotiated').is(":checked")){
|
|
content = _.filter(content, function (inv){
|
|
content = _.filter(content, function (inv){
|
|
- return inv.state == 'open';
|
|
|
|
|
|
+ return inv.state == 'negotiated';
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- if ($('#paid').is(":checked")){
|
|
|
|
|
|
+ if ($('#renegotiated').is(":checked")){
|
|
content = _.filter(content, function (inv){
|
|
content = _.filter(content, function (inv){
|
|
- return inv.state == 'paid';
|
|
|
|
|
|
+ return inv.state == 'renegotiated';
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- if (partner != ""){
|
|
|
|
- content = _.filter(content, function(inv){
|
|
|
|
- return inv.partner_id == partner[0];
|
|
|
|
|
|
+ if(bank != 9999999){
|
|
|
|
+ content=_.filter(content, function (inv){
|
|
|
|
+ return inv.bank_id == bank[0];
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- // if(store != 9999999){
|
|
|
|
- // content=_.filter(content, function (inv){
|
|
|
|
- // return inv.store_id == store
|
|
|
|
- // });
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- var amount_entry_num = _.reduce(_.map(content,function(map){
|
|
|
|
- return(map.entry_num);
|
|
|
|
- }),function(memo, num){
|
|
|
|
- return memo + num;
|
|
|
|
- },0);
|
|
|
|
|
|
|
|
var amount_egress_num = _.reduce(_.map(content,function(map){
|
|
var amount_egress_num = _.reduce(_.map(content,function(map){
|
|
- return(map.egress_num);
|
|
|
|
|
|
+ return(map.amount_payment_num);
|
|
}),function(memo, num){
|
|
}),function(memo, num){
|
|
return memo + num;
|
|
return memo + num;
|
|
},0);
|
|
},0);
|
|
|
|
|
|
var amount_to_receive_num = _.reduce(_.map(content,function(map){
|
|
var amount_to_receive_num = _.reduce(_.map(content,function(map){
|
|
- return(map.to_receive_num);
|
|
|
|
|
|
+ return(map.amount_receipt_num);
|
|
}),function(memo, num){
|
|
}),function(memo, num){
|
|
return memo + num;
|
|
return memo + num;
|
|
},0);
|
|
},0);
|
|
|
|
|
|
- var amount_to_pay_num = _.reduce(_.map(content,function(map){
|
|
|
|
- return(map.to_pay_num);
|
|
|
|
|
|
+ var amount_entry_num = _.reduce(_.map(content,function(map){
|
|
|
|
+ return(map.amount_total_num);
|
|
}),function(memo, num){
|
|
}),function(memo, num){
|
|
return memo + num;
|
|
return memo + num;
|
|
},0);
|
|
},0);
|
|
|
|
|
|
content.push({
|
|
content.push({
|
|
- number: "Total",
|
|
|
|
- entry: accounting.formatNumber(amount_entry_num,0,".",","),
|
|
|
|
- egress: accounting.formatNumber(amount_egress_num,0,".",","),
|
|
|
|
- to_receive: accounting.formatNumber(amount_to_receive_num,0,".",","),
|
|
|
|
- to_pay: accounting.formatNumber(amount_to_pay_num,0,".",","),
|
|
|
|
|
|
+ create_date: "Totales",
|
|
|
|
+ amount_payment: accounting.formatNumber(amount_egress_num,0,".",","),
|
|
|
|
+ amount_receipt: accounting.formatNumber(amount_to_receive_num,0,".",","),
|
|
|
|
+ amount_total: accounting.formatNumber(amount_entry_num,0,".",","),
|
|
});
|
|
});
|
|
|
|
|
|
-
|
|
|
|
self.loadTable(content)
|
|
self.loadTable(content)
|
|
},
|
|
},
|
|
|
|
|
|
@@ -436,49 +450,6 @@ function report_bank_movements (reporting){
|
|
var rowsPdf=[];
|
|
var rowsPdf=[];
|
|
var rows=[];
|
|
var rows=[];
|
|
var rows = self.rowsData;
|
|
var rows = self.rowsData;
|
|
-
|
|
|
|
- var amount_total_num = _.reduce(_.map(rows,function(map){
|
|
|
|
- return(map.amount_total_num);
|
|
|
|
- }),function(memo, num){
|
|
|
|
- return memo + num;
|
|
|
|
- },0);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- var entry_num = _.reduce(_.map(rows,function(map){
|
|
|
|
- return(map.entry_num);
|
|
|
|
- }),function(memo, num){
|
|
|
|
- return memo + num;
|
|
|
|
- },0);
|
|
|
|
-
|
|
|
|
- var egress_num = _.reduce(_.map(rows,function(map){
|
|
|
|
- return(map.egress_num);
|
|
|
|
- }),function(memo, num){
|
|
|
|
- return memo + num;
|
|
|
|
- },0);
|
|
|
|
- var to_receive_num = _.reduce(_.map(rows,function(map){
|
|
|
|
- return(map.to_receive_num);
|
|
|
|
- }),function(memo, num){
|
|
|
|
- return memo + num;
|
|
|
|
- },0);
|
|
|
|
- var to_pay_num = _.reduce(_.map(rows,function(map){
|
|
|
|
- return(map.to_pay_num);
|
|
|
|
- }),function(memo, num){
|
|
|
|
- return memo + num;
|
|
|
|
- },0);
|
|
|
|
- if (rows.length > 0){
|
|
|
|
- rows.push({
|
|
|
|
- number : 'Totales',
|
|
|
|
- partner : '',
|
|
|
|
- date : '',
|
|
|
|
- user : '',
|
|
|
|
- amount_total: accounting.formatNumber(amount_total_num,0,".",","),
|
|
|
|
- entry: accounting.formatNumber(entry_num,0,".",","),
|
|
|
|
- egress: accounting.formatNumber(egress_num,0,".",","),
|
|
|
|
- to_receive: accounting.formatNumber(to_receive_num,0,".",","),
|
|
|
|
- to_pay: accounting.formatNumber(to_pay_num,0,".",","),
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
return rows;
|
|
return rows;
|
|
},
|
|
},
|
|
|
|
|
|
@@ -522,14 +493,16 @@ function report_bank_movements (reporting){
|
|
styles: { overflow: 'linebreak', fontSize: 8, columnWidth: 'wrap'},
|
|
styles: { overflow: 'linebreak', fontSize: 8, columnWidth: 'wrap'},
|
|
columnStyles: {
|
|
columnStyles: {
|
|
number : {columnWidth: '8px'},
|
|
number : {columnWidth: '8px'},
|
|
- partner : {columnWidth: '8px'},
|
|
|
|
- date : {columnWidth: '8px'},
|
|
|
|
- user : {columnWidth: '6px'},
|
|
|
|
- entry: {halign:'right',columnWidth: '11px'},
|
|
|
|
- egress: {halign:'right',columnWidth: '9px'},
|
|
|
|
- to_receive: {halign:'right',columnWidth: '9px'},
|
|
|
|
- to_pay: {halign:'right',columnWidth: '8px'},
|
|
|
|
- amount_total: {halign:'right',columnWidth: '11px'},
|
|
|
|
|
|
+ create_date : {columnWidth: '8px'},
|
|
|
|
+ titular : {columnWidth: '8px'},
|
|
|
|
+ number_cta : {columnWidth: '6px'},
|
|
|
|
+ type_bank : {columnWidth: '6px'},
|
|
|
|
+ amount_payment: {halign:'right',columnWidth: '8px'},
|
|
|
|
+ amount_receipt: {halign:'right',columnWidth: '8px'},
|
|
|
|
+ amount_total: {halign:'right',columnWidth: '8px'},
|
|
|
|
+ date_maturity: {halign:'right',columnWidth: '8px'},
|
|
|
|
+ bank_id: {halign:'right',columnWidth: '8px'},
|
|
|
|
+ state: {halign:'right',columnWidth: '8px'}
|
|
},
|
|
},
|
|
margin: { top: 20, horizontal: 7},
|
|
margin: { top: 20, horizontal: 7},
|
|
|
|
|
|
@@ -537,61 +510,21 @@ function report_bank_movements (reporting){
|
|
pdfDoc.setFontSize(12);
|
|
pdfDoc.setFontSize(12);
|
|
pdfDoc.setFontStyle('bold');
|
|
pdfDoc.setFontStyle('bold');
|
|
pdfDoc.setTextColor(40);
|
|
pdfDoc.setTextColor(40);
|
|
- pdfDoc.text('Histórico de Facturas', 80, 10);
|
|
|
|
|
|
+ pdfDoc.text('Histórico de Movimiento de Banco', 80, 10);
|
|
|
|
|
|
- var tipo = '';
|
|
|
|
- if ($('#Y').is(":checked")){
|
|
|
|
- tipo = tipo.concat(' Tipo de factura : Todas las facturas' );
|
|
|
|
- }
|
|
|
|
- if ($('#sale').is(":checked")){
|
|
|
|
- tipo = tipo.concat(' Tipo de factura : Ventas' );
|
|
|
|
- }
|
|
|
|
- if ($('#purchase').is(":checked")){
|
|
|
|
- tipo = tipo.concat(' Tipo de factura : Compras' );
|
|
|
|
- }
|
|
|
|
- if ($('#expense').is(":checked")){
|
|
|
|
- tipo = tipo.concat(' Tipo de factura : Gastos' );
|
|
|
|
- }
|
|
|
|
- pdfDoc.setFontSize(9);
|
|
|
|
- pdfDoc.setFontStyle('normal');
|
|
|
|
- pdfDoc.setTextColor(40)
|
|
|
|
- pdfDoc.text(6,14,tipo);
|
|
|
|
-
|
|
|
|
- var fecha = '';
|
|
|
|
- if ($('#X').is(":checked")){
|
|
|
|
- fecha = fecha.concat(' Filtro de fecha : Sin Filtros' );
|
|
|
|
- }
|
|
|
|
- if ($('#A').is(":checked")){
|
|
|
|
- fecha = fecha.concat(' Filtro de fecha : Hoy' );
|
|
|
|
- }
|
|
|
|
- if ($('#B').is(":checked")){
|
|
|
|
- fecha = fecha.concat(' Filtro de fecha : Ayer' );
|
|
|
|
- }
|
|
|
|
- if ($('#C').is(":checked")){
|
|
|
|
- fecha = fecha.concat(' Filtro de fecha : Mes Actual' );
|
|
|
|
- }
|
|
|
|
- if ($('#D').is(":checked")){
|
|
|
|
- fecha = fecha.concat(' Filtro de fecha : Mes Pasado' );
|
|
|
|
- }
|
|
|
|
- if ($('#Z').is(":checked")){
|
|
|
|
- if(desde.length > 0 || hasta.length > 0){
|
|
|
|
- if(desde){
|
|
|
|
- fecha=fecha.concat(' Desde: '+ desde);
|
|
|
|
- }
|
|
|
|
- if (hasta){
|
|
|
|
- fecha=fecha.concat(' Hasta: '+ hasta);
|
|
|
|
- }
|
|
|
|
|
|
+ if(desde.length > 0 || hasta.length > 0){
|
|
|
|
+ var fecha='';
|
|
|
|
+ if(desde){
|
|
|
|
+ fecha=fecha.concat(' Desde '+desde);
|
|
|
|
+ }
|
|
|
|
+ if (hasta){
|
|
|
|
+ fecha=fecha.concat(' Hasta '+hasta);
|
|
}
|
|
}
|
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
|
+ pdfDoc.setFontStyle('bold');
|
|
|
|
+ pdfDoc.setTextColor(40)
|
|
|
|
+ pdfDoc.text(fecha, data.settings.margin.left,14);
|
|
}
|
|
}
|
|
- pdfDoc.setFontSize(9);
|
|
|
|
- pdfDoc.setFontStyle('normal');
|
|
|
|
- pdfDoc.setTextColor(40)
|
|
|
|
- pdfDoc.text(6,18,fecha);
|
|
|
|
-
|
|
|
|
- pdfDoc.setFontSize(9);
|
|
|
|
- pdfDoc.setFontStyle('normal');
|
|
|
|
- pdfDoc.setTextColor(40)
|
|
|
|
- pdfDoc.text(150,14," Fecha de Expedición: " + hoy);
|
|
|
|
|
|
|
|
var str = " Pagina " + data.pageCount;
|
|
var str = " Pagina " + data.pageCount;
|
|
if (typeof pdfDoc.putTotalPages === 'function') {
|
|
if (typeof pdfDoc.putTotalPages === 'function') {
|