|
@@ -10,41 +10,40 @@ openerp.eiru_reporting = function (instance, local) {
|
|
},
|
|
},
|
|
reports: [
|
|
reports: [
|
|
{
|
|
{
|
|
- title: 'Resumen de Ingreso',
|
|
|
|
- description: 'Permite visualizar de forma global el ingreso obtenido de la empresa.',
|
|
|
|
|
|
+ title: 'Resumen de ingresos',
|
|
|
|
+ description: 'Permite visualizar de forma global los ingresos obtenidos por la empresa.',
|
|
action: 'ReportResumenIngreso'
|
|
action: 'ReportResumenIngreso'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: 'Resumen de Egreso',
|
|
|
|
- description: 'Permite visualizar de forma global el Egreso de la Empresa.',
|
|
|
|
|
|
+ title: 'Resumen de egresos',
|
|
|
|
+ description: 'Permite visualizar de forma global los egresos realizado por la empresa.',
|
|
action: 'ReportResumenEngreso'
|
|
action: 'ReportResumenEngreso'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: 'Análisis de Utilidad',
|
|
|
|
- description: 'Permite visualizar la utilidad de los productos en las facturas.',
|
|
|
|
|
|
+ title: 'Utilidad de facturas detalladas',
|
|
|
|
+ description: 'Permite visualizar la ganancia de cada ítem de las facturas detalladamente.',
|
|
action: 'ReportInvoiceUtility'
|
|
action: 'ReportInvoiceUtility'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: 'Listado de Stock por Ubicacion',
|
|
|
|
- description: 'Permite visualizar un listado de productos activos.',
|
|
|
|
- action: 'ReportStockLocation'
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: 'Listado de Compras',
|
|
|
|
- description: 'Permite visualizar un listado de Compras.',
|
|
|
|
|
|
+ title: 'Histórico de compras',
|
|
|
|
+ description: 'Permite visualizar un histórico de compras realizado por la empresa.',
|
|
action: 'AllPurchases'
|
|
action: 'AllPurchases'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- title: 'Listado de Gastos',
|
|
|
|
- description: 'Permite visualizar un listado de Gastos.',
|
|
|
|
|
|
+ title: 'Histórico de gastos',
|
|
|
|
+ description: 'Permite visualizar un histórico de gastos realizado por la empresa.',
|
|
action: 'ReposrtExpenses'
|
|
action: 'ReposrtExpenses'
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ title: 'Listado de productos por ubicación',
|
|
|
|
+ description: 'Permite visualizar un listado de productos activos.',
|
|
|
|
+ action: 'ReportStockLocation'
|
|
}
|
|
}
|
|
],
|
|
],
|
|
start: function () {
|
|
start: function () {
|
|
},
|
|
},
|
|
|
|
|
|
clickOnReport: function (e) {
|
|
clickOnReport: function (e) {
|
|
-
|
|
|
|
var templateName = this.$el.find(e.target).val();
|
|
var templateName = this.$el.find(e.target).val();
|
|
this.renderReport(templateName);
|
|
this.renderReport(templateName);
|
|
},
|
|
},
|
|
@@ -97,6 +96,7 @@ openerp.eiru_reporting = function (instance, local) {
|
|
// volver
|
|
// volver
|
|
volver: function(){
|
|
volver: function(){
|
|
this.$el.find('#volver').empty();
|
|
this.$el.find('#volver').empty();
|
|
|
|
+ this.$el.find('#grafico').empty();
|
|
this.$el.find('.bootstrap-table').show({
|
|
this.$el.find('.bootstrap-table').show({
|
|
effect: 'drop',
|
|
effect: 'drop',
|
|
direction: 'down',
|
|
direction: 'down',
|
|
@@ -467,7 +467,7 @@ openerp.eiru_reporting = function (instance, local) {
|
|
pdfDoc.setFontSize(12);
|
|
pdfDoc.setFontSize(12);
|
|
pdfDoc.setFontStyle('bold');
|
|
pdfDoc.setFontStyle('bold');
|
|
pdfDoc.setTextColor(40);
|
|
pdfDoc.setTextColor(40);
|
|
- pdfDoc.text('Análisis de Utilidad '+ sucusal, data.settings.margin.left, 10);
|
|
|
|
|
|
+ pdfDoc.text('Utilidad de facturas detalladas por '+ sucusal, data.settings.margin.left, 10);
|
|
|
|
|
|
if(desde.length > 0 || hasta.length > 0){
|
|
if(desde.length > 0 || hasta.length > 0){
|
|
var fecha='';
|
|
var fecha='';
|
|
@@ -498,13 +498,17 @@ openerp.eiru_reporting = function (instance, local) {
|
|
if (typeof pdfDoc.putTotalPages === 'function') {
|
|
if (typeof pdfDoc.putTotalPages === 'function') {
|
|
pdfDoc.putTotalPages(totalPagesExp);
|
|
pdfDoc.putTotalPages(totalPagesExp);
|
|
}
|
|
}
|
|
- pdfDoc.save('Analisis de utilidad.pdf')
|
|
|
|
|
|
+ pdfDoc.save('Utilidad de facturas detalladas.pdf')
|
|
},
|
|
},
|
|
// Chart Filter
|
|
// Chart Filter
|
|
fectCharFilter: function(){
|
|
fectCharFilter: function(){
|
|
var self = this;
|
|
var self = this;
|
|
var dataBody=[];
|
|
var dataBody=[];
|
|
var dataHeader=[];
|
|
var dataHeader=[];
|
|
|
|
+
|
|
|
|
+ var canvas="<canvas id='graf_resume'></canvas>";
|
|
|
|
+ this.$el.find('#grafico').append(canvas);
|
|
|
|
+
|
|
_.each(self.accountJournal, function(journal){
|
|
_.each(self.accountJournal, function(journal){
|
|
dataHeader.push(journal.name);
|
|
dataHeader.push(journal.name);
|
|
var utility=_.reduce(_.map(_.filter(self.rowsData, function (inv){ return inv.journal_id == journal.id}),function(item){
|
|
var utility=_.reduce(_.map(_.filter(self.rowsData, function (inv){ return inv.journal_id == journal.id}),function(item){
|
|
@@ -526,18 +530,13 @@ openerp.eiru_reporting = function (instance, local) {
|
|
},
|
|
},
|
|
// Chart
|
|
// Chart
|
|
drawChart: function (dataHeader,dataBody) {
|
|
drawChart: function (dataHeader,dataBody) {
|
|
- var company = _.map(self.resCompany, function (map) {
|
|
|
|
- return map.currency_id[1];
|
|
|
|
- });
|
|
|
|
- var barChart = new Chart(this.$el.find('canvas'), {
|
|
|
|
- // type:"doughnut",
|
|
|
|
-
|
|
|
|
- type: 'bar',
|
|
|
|
|
|
+ var barChart = new Chart(this.$el.find('#graf_resume'), {
|
|
|
|
+ type: 'doughnut',
|
|
data: {
|
|
data: {
|
|
labels: dataHeader,
|
|
labels: dataHeader,
|
|
datasets: [
|
|
datasets: [
|
|
{
|
|
{
|
|
- label: "Utilidad "+company,
|
|
|
|
|
|
+ labels: dataHeader,
|
|
backgroundColor: [
|
|
backgroundColor: [
|
|
'rgba(255, 99, 132, 0.2)',
|
|
'rgba(255, 99, 132, 0.2)',
|
|
'rgba(54, 162, 235, 0.2)',
|
|
'rgba(54, 162, 235, 0.2)',
|
|
@@ -556,7 +555,13 @@ openerp.eiru_reporting = function (instance, local) {
|
|
data: dataBody,
|
|
data: dataBody,
|
|
}
|
|
}
|
|
]
|
|
]
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ options: {
|
|
|
|
+ maintainAspectRatio: false,
|
|
|
|
+ layout: {
|
|
|
|
+ padding: 30
|
|
|
|
+ }
|
|
|
|
+ },
|
|
});
|
|
});
|
|
},
|
|
},
|
|
});
|
|
});
|
|
@@ -569,6 +574,7 @@ openerp.eiru_reporting = function (instance, local) {
|
|
dataVoucher:[],
|
|
dataVoucher:[],
|
|
currencyRate:[],
|
|
currencyRate:[],
|
|
companyCurrency:[],
|
|
companyCurrency:[],
|
|
|
|
+ modules:[],
|
|
|
|
|
|
events:{
|
|
events:{
|
|
'click #toolbar > button' : 'clickOnAction',
|
|
'click #toolbar > button' : 'clickOnAction',
|
|
@@ -589,6 +595,49 @@ openerp.eiru_reporting = function (instance, local) {
|
|
self.fecthFecha();
|
|
self.fecthFecha();
|
|
self.fecthInitial();
|
|
self.fecthInitial();
|
|
},
|
|
},
|
|
|
|
+ // Redirecionar
|
|
|
|
+ renderReport: function () {
|
|
|
|
+ var self = this;
|
|
|
|
+
|
|
|
|
+ var container = this.$el.closest('.oe_form_sheet.oe_form_sheet_width');
|
|
|
|
+ this.$el.closest('.report_view').remove();
|
|
|
|
+ container.find('.report_view').show({
|
|
|
|
+ effect: 'fade',
|
|
|
|
+ duration: 200,
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // Verificar el modelo
|
|
|
|
+ checkModel : function(model){
|
|
|
|
+ var self = this;
|
|
|
|
+ return _.filter(self.modules,function(item){return item === model});
|
|
|
|
+ },
|
|
|
|
+ // Lanzar el mensaje
|
|
|
|
+ showMensaje : function(modelos){
|
|
|
|
+ $("#dialog" ).dialog({
|
|
|
|
+ autoOpen: true,
|
|
|
|
+ resizable: false,
|
|
|
|
+ modal: true,
|
|
|
|
+ title: 'Atención',
|
|
|
|
+ width: 500,
|
|
|
|
+ open: function() {
|
|
|
|
+ $(this).html('Lo sentimos , pero no contás con las configuraciones adecuado para manipular este informe.\nPóngase en contacto con el administrador del sistema (referencia : '+modelos+' )');
|
|
|
|
+ },
|
|
|
|
+ show: {
|
|
|
|
+ effect: "fade",
|
|
|
|
+ duration: 200
|
|
|
|
+ },
|
|
|
|
+ hide: {
|
|
|
|
+ effect: "fade",
|
|
|
|
+ duration: 200
|
|
|
|
+ },
|
|
|
|
+ buttons: {
|
|
|
|
+ Aceptar: function() {
|
|
|
|
+ $(this).dialog('close');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return
|
|
|
|
+ },
|
|
// Fecha
|
|
// Fecha
|
|
fecthFecha: function() {
|
|
fecthFecha: function() {
|
|
var to;
|
|
var to;
|
|
@@ -624,6 +673,8 @@ openerp.eiru_reporting = function (instance, local) {
|
|
// Metodo inicial
|
|
// Metodo inicial
|
|
fecthInitial: function(){
|
|
fecthInitial: function(){
|
|
var self = this;
|
|
var self = this;
|
|
|
|
+ self.modules = instance._modules;
|
|
|
|
+
|
|
self.fecthJournalStore().then(function(accountJournal){
|
|
self.fecthJournalStore().then(function(accountJournal){
|
|
self.accountJournal=accountJournal;
|
|
self.accountJournal=accountJournal;
|
|
return accountJournal;
|
|
return accountJournal;
|
|
@@ -650,13 +701,21 @@ openerp.eiru_reporting = function (instance, local) {
|
|
self.companyCurrency = companyCurrency;
|
|
self.companyCurrency = companyCurrency;
|
|
return self.fecthDataVoucher(self.accountVoucher,self.accountJournal);
|
|
return self.fecthDataVoucher(self.accountVoucher,self.accountJournal);
|
|
});
|
|
});
|
|
|
|
+ return self.renderReport()
|
|
},
|
|
},
|
|
// Journal
|
|
// Journal
|
|
fecthJournalStore: function(){
|
|
fecthJournalStore: function(){
|
|
var self = this;
|
|
var self = this;
|
|
var defer = $.Deferred();
|
|
var defer = $.Deferred();
|
|
|
|
+ var modules = self.checkModel('multi_store');
|
|
|
|
+ if (modules.length <= 0){
|
|
|
|
+ self.showMensaje('multi_store');
|
|
|
|
+ return defer;
|
|
|
|
+ }
|
|
|
|
+
|
|
var journal = new instance.web.Model('res.store');
|
|
var journal = new instance.web.Model('res.store');
|
|
var field=['id', 'name','out_invoice_id','journal_ids'];
|
|
var field=['id', 'name','out_invoice_id','journal_ids'];
|
|
|
|
+
|
|
journal.query(field).order_by('id').all().then(function(results){
|
|
journal.query(field).order_by('id').all().then(function(results){
|
|
defer.resolve(results);
|
|
defer.resolve(results);
|
|
});
|
|
});
|
|
@@ -1016,6 +1075,7 @@ openerp.eiru_reporting = function (instance, local) {
|
|
dataVoucher:[],
|
|
dataVoucher:[],
|
|
currencyRate:[],
|
|
currencyRate:[],
|
|
resCompany:[],
|
|
resCompany:[],
|
|
|
|
+ modules:[],
|
|
events:{
|
|
events:{
|
|
'click #toolbar > button' : 'clickOnAction',
|
|
'click #toolbar > button' : 'clickOnAction',
|
|
'change #current-journal': 'fectSearch',
|
|
'change #current-journal': 'fectSearch',
|
|
@@ -1035,6 +1095,49 @@ openerp.eiru_reporting = function (instance, local) {
|
|
self.fecthFecha();
|
|
self.fecthFecha();
|
|
self.fecthInitial();
|
|
self.fecthInitial();
|
|
},
|
|
},
|
|
|
|
+ // Redirecionar
|
|
|
|
+ renderReport: function () {
|
|
|
|
+ var self = this;
|
|
|
|
+
|
|
|
|
+ var container = this.$el.closest('.oe_form_sheet.oe_form_sheet_width');
|
|
|
|
+ this.$el.closest('.report_view').remove();
|
|
|
|
+ container.find('.report_view').show({
|
|
|
|
+ effect: 'fade',
|
|
|
|
+ duration: 200,
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ // Verificar el modelo
|
|
|
|
+ checkModel : function(model){
|
|
|
|
+ var self = this;
|
|
|
|
+ return _.filter(self.modules,function(item){return item === model});
|
|
|
|
+ },
|
|
|
|
+ // Lanzar el mensaje
|
|
|
|
+ showMensaje : function(modelos){
|
|
|
|
+ $("#dialog" ).dialog({
|
|
|
|
+ autoOpen: true,
|
|
|
|
+ resizable: false,
|
|
|
|
+ modal: true,
|
|
|
|
+ title: 'Atención',
|
|
|
|
+ width: 500,
|
|
|
|
+ open: function() {
|
|
|
|
+ $(this).html('Lo sentimos , pero no contás con las configuraciones adecuado para manipular este informe.\nPóngase en contacto con el administrador del sistema (referencia : '+modelos+' )');
|
|
|
|
+ },
|
|
|
|
+ show: {
|
|
|
|
+ effect: "fade",
|
|
|
|
+ duration: 200
|
|
|
|
+ },
|
|
|
|
+ hide: {
|
|
|
|
+ effect: "fade",
|
|
|
|
+ duration: 200
|
|
|
|
+ },
|
|
|
|
+ buttons: {
|
|
|
|
+ Aceptar: function() {
|
|
|
|
+ $(this).dialog('close');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return
|
|
|
|
+ },
|
|
// Fecha
|
|
// Fecha
|
|
fecthFecha: function() {
|
|
fecthFecha: function() {
|
|
var to;
|
|
var to;
|
|
@@ -1070,6 +1173,7 @@ openerp.eiru_reporting = function (instance, local) {
|
|
// Metodo inicial
|
|
// Metodo inicial
|
|
fecthInitial: function(){
|
|
fecthInitial: function(){
|
|
var self = this;
|
|
var self = this;
|
|
|
|
+ self.modules = instance._modules;
|
|
self.fecthJournalStore().then(function(accountJournal){
|
|
self.fecthJournalStore().then(function(accountJournal){
|
|
self.accountJournal=accountJournal;
|
|
self.accountJournal=accountJournal;
|
|
return accountJournal;
|
|
return accountJournal;
|
|
@@ -1096,7 +1200,7 @@ openerp.eiru_reporting = function (instance, local) {
|
|
self.resCompany = resCompany;
|
|
self.resCompany = resCompany;
|
|
return self.fecthDataVoucher(self.accountVoucher,self.accountJournal);
|
|
return self.fecthDataVoucher(self.accountVoucher,self.accountJournal);
|
|
});
|
|
});
|
|
- return false;
|
|
|
|
|
|
+ return self.renderReport();
|
|
},
|
|
},
|
|
// company_curency
|
|
// company_curency
|
|
fecthComanyCurrency: function(){
|
|
fecthComanyCurrency: function(){
|
|
@@ -1114,8 +1218,15 @@ openerp.eiru_reporting = function (instance, local) {
|
|
fecthJournalStore: function(){
|
|
fecthJournalStore: function(){
|
|
var self = this;
|
|
var self = this;
|
|
var defer = $.Deferred();
|
|
var defer = $.Deferred();
|
|
|
|
+ var modules = self.checkModel('multi_store');
|
|
|
|
+ if (modules.length <= 0){
|
|
|
|
+ self.showMensaje('multi_store');
|
|
|
|
+ return defer;
|
|
|
|
+ }
|
|
|
|
+
|
|
var journal = new instance.web.Model('res.store');
|
|
var journal = new instance.web.Model('res.store');
|
|
var field=['id', 'name','out_invoice_id','journal_ids'];
|
|
var field=['id', 'name','out_invoice_id','journal_ids'];
|
|
|
|
+
|
|
journal.query(field).order_by('id').all().then(function(results){
|
|
journal.query(field).order_by('id').all().then(function(results){
|
|
defer.resolve(results);
|
|
defer.resolve(results);
|
|
});
|
|
});
|