Browse Source

[FIX] limpieza de codigo

Rodney Elpidio Enciso Arias 6 years ago
parent
commit
5ff3d4ce2f

+ 0 - 434
models.py

@@ -2,280 +2,6 @@
 
 from openerp import models, fields, api
 
-class AccountInvoice(models.Model):
-	_inherit = 'account.invoice'
-
-	############################################################
-	#	ACCOUNT INVOICE
-	############################################################
-
-	@api.model
-	def getAccountInvoice(self,domain):
-		AccountInvoice = self.env['account.invoice'].search(domain)
-		decimal_precision = self.env['decimal.precision'].precision_get('Account')
-		values = []
-		for invoice in AccountInvoice:
-			values.append({
-				'id': invoice.id,
-				'type': invoice.type,
-				'state': invoice.state,
-				'number': invoice.number,
-				'journal_id': [
-					invoice.journal_id.id,
-					invoice.journal_id.name
-				],
-				'invoice_currency': [
-					invoice.currency_id.id,
-					invoice.currency_id.name,
-					invoice.currency_id.rate
-				],
-				'company_currency': [
-					invoice.company_id.currency_id.id,
-					invoice.company_id.currency_id.name,
-					invoice.company_id.currency_id.rate
-				],
-				'date_invoice': invoice.date_invoice,
-				'partner_id': [
-					invoice.partner_id.id,
-					invoice.partner_id.name,
-					invoice.partner_id.ruc,
-				],
-				'supplier_invoice_number': invoice.supplier_invoice_number,
-				'user_id': [
-					invoice.user_id.id,
-					invoice.user_id.name
-				],
-                'period_id': [
-                	invoice.period_id.id,
-                	invoice.period_id.name
-                ],
-                'amount_untaxed': invoice.amount_untaxed,
-                'residual': invoice.residual,
-                'amount_tax': invoice.amount_tax,
-				'amount_total': invoice.amount_total,
-				'amount_untaxed_currency': invoice.amount_untaxed * (invoice.company_id.currency_id.rate / invoice.currency_id.rate),
-				'residual_currency': invoice.residual * (invoice.company_id.currency_id.rate / invoice.currency_id.rate),
-				'amount_tax_currency': invoice.amount_tax * (invoice.company_id.currency_id.rate / invoice.currency_id.rate),
-				'amount_total_currency': invoice.amount_total * (invoice.company_id.currency_id.rate / invoice.currency_id.rate),
-			})
-
-		return values
-
-	############################################################
-	#	POS ORDER
-	############################################################
-
-	@api.model
-	def getPosOrder(self,domain):
-		PosOrder = self.env['pos.order'].search(domain)
-		decimal_precision = self.env['decimal.precision'].precision_get('Account')
-		values = []
-		for order in PosOrder:
-			values.append({
-				'id': order.id,
-				'name': order.name,
-				'date_order': order.date_order,
-				'pricelist_id':[
-					order.pricelist_id.id,
-					order.pricelist_id.name,
-				],
-				'partner_id': [
-					order.partner_id.id,
-					order.partner_id.name,
-					order.partner_id.ruc,
-				],
-				'user_id': [
-					order.user_id.id,
-					order.user_id.name
-				],
-				'order_currency': [
-					order.pricelist_id.currency_id.id,
-					order.pricelist_id.currency_id.name,
-					order.pricelist_id.currency_id.rate
-				],
-				'company_currency': [
-					order.company_id.currency_id.id,
-					order.company_id.currency_id.name,
-					order.company_id.currency_id.rate
-				],
-                'amount_tax': order.amount_tax,
-                'amount_total': order.amount_total,
-				'amount_tax_currency': order.amount_tax * (order.company_id.currency_id.rate / order.pricelist_id.currency_id.rate),
-				'amount_total_currency': order.amount_total * (order.company_id.currency_id.rate / order.pricelist_id.currency_id.rate),
-			})
-
-		return values
-
-class AccountInvoiceLine(models.Model):
-	_inherit = 'account.invoice.line'
-
-	############################################################
-	#	ACCOUNT INVOICE LINE
-	############################################################
-
-	@api.model
-	def getAccountInvoiceLine(self,domain):
-		AccountInvoiceLine = self.env['account.invoice.line'].search(domain)
-		decimal_precision = self.env['decimal.precision'].precision_get('Account')
-		values = []
-		for line in AccountInvoiceLine:
-			values.append({
-				'id': line.id,
-				'invoice_id':line.invoice_id.id,
-				'number':line.invoice_id.number,
-				'supplier_invoice_number':line.invoice_id.supplier_invoice_number,
-				'date_invoice': line.invoice_id.date_invoice,
-				'user_id': [
-					line.invoice_id.user_id.id,
-					line.invoice_id.user_id.name,
-				],
-				'partner_id': [
-					line.invoice_id.partner_id.id,
-					line.invoice_id.partner_id.name,
-				],
-				'product_id': [
-					line.product_id.id,
-					line.product_id.display_name,
-					line.product_id.categ_id.complete_name,
-				],
-				'price_unit': line.price_unit,
-				'price_subtotal': line.price_subtotal,
-				'quantity': line.quantity,
-				'company_currency':[
-					line.invoice_id.company_id.currency_id.id,
-					line.invoice_id.company_id.currency_id.name,
-					line.invoice_id.company_id.currency_id.rate,
-				],
-				'invoice_currency':[
-					line.invoice_id.currency_id.id,
-					line.invoice_id.currency_id.name,
-					line.invoice_id.currency_id.rate,
-				],
-				'price_unit_currency': round(line.price_unit * (line.invoice_id.company_id.currency_id.rate / line.invoice_id.currency_id.rate),decimal_precision),
-				'price_subtotal_currency': round(line.price_subtotal * (line.invoice_id.company_id.currency_id.rate / line.invoice_id.currency_id.rate),decimal_precision),
-				'tax_currency': round((line.price_unit * (line.invoice_id.company_id.currency_id.rate / line.invoice_id.currency_id.rate) * line.quantity) - line.price_subtotal * (line.invoice_id.company_id.currency_id.rate / line.invoice_id.currency_id.rate),decimal_precision),
-				'amount_currency': round((line.quantity * line.price_unit) * (line.invoice_id.company_id.currency_id.rate / line.invoice_id.currency_id.rate),decimal_precision),
-			})
-
-		return values
-
-	############################################################
-	#	POS ORDER LINE
-	############################################################
-
-	@api.model
-	def getPosOrderLine(self,domain):
-		PosOrderLine = self.env['pos.order.line'].search(domain)
-		decimal_precision = self.env['decimal.precision'].precision_get('Account')
-		values = []
-		for line in PosOrderLine:
-			values.append({
-				'id': line.id,
-				'order_id': [
-					line.order_id.id,
-					line.order_id.name
-				],
-				'product_id': [
-					line.product_id.id,
-					line.product_id.display_name,
-				],
-				'qty': line.qty,
-				'create_date': line.create_date,
-				'user_id': [
-					line.order_id.user_id.id,
-					line.order_id.user_id.name
-				],
-				'partner_id': [
-					line.order_id.partner_id.id,
-					line.order_id.partner_id.name
-				],
-				'company_currency':[
-					line.order_id.company_id.currency_id.id,
-					line.order_id.company_id.currency_id.name,
-					line.order_id.company_id.currency_id.rate,
-				],
-				'order_currency':[
-					line.order_id.pricelist_id.currency_id.id,
-					line.order_id.pricelist_id.currency_id.name,
-					line.order_id.pricelist_id.currency_id.rate,
-				],
-				'price_unit': line.price_unit,
-				'price_subtotal': line.price_subtotal,
-				'price_subtotal_incl': line.price_subtotal_incl,
-				'price_unit_currency': round(line.price_unit * (line.order_id.company_id.currency_id.rate / line.order_id.pricelist_id.currency_id.rate),decimal_precision),
-				'price_subtotal_currency': round(line.price_subtotal * (line.order_id.company_id.currency_id.rate / line.order_id.pricelist_id.currency_id.rate),decimal_precision),
-				'price_subtotal_incl_currency': round(line.price_subtotal_incl * (line.order_id.company_id.currency_id.rate / line.order_id.pricelist_id.currency_id.rate),decimal_precision),
-				# 'amount_currency': round(line.price_subtotal_incl * (line.order_id.company_id.currency_id.rate / line.order_id.pricelist_id.currency_id.rate),decimal_precision)
-			})
-
-		return values
-
-class AccountJournal(models.Model):
-	_inherit = 'account.journal'
-
-	@api.model
-	def getAccountJournal(self,domain):
-		AccountJournal = self.env['account.journal'].search(domain)
-		values = []
-		for journal in AccountJournal:
-			values.append({
-				'id': journal.id,
-				'name': journal.name,
-				'store_ids': [
-					journal.store_ids.id,
-				],
-				'company_id': [
-					journal.company_id.id,
-					journal.company_id.name
-				],
-			})
-
-		return values
-
-class ResCompany(models.Model):
-	_inherit = 'res.company'
-
-	@api.model
-	def getResCompany(self,domain):
-		ResCompany = self.env['res.company'].search(domain)
-		values = []
-		for company in ResCompany:
-			values.append({
-				'id': company.id,
-				'name': company.name,
-				'currency_id': [
-					company.currency_id.id,
-					company.currency_id.name,
-				],
-				'company_ruc': company.partner_id.ruc,
-				'phone': company.phone,
-				'logo': company.logo,
-			})
-
-		return values
-
-class ResCurrency(models.Model):
-	_inherit = 'res.currency'
-
-	@api.model
-	def getResCurrency(self,domain):
-		ResCurrency = self.env['res.currency'].search(domain)
-		values = []
-		for currency in ResCurrency:
-			values.append({
-				'id': currency.id,
-				'name': currency.name,
-				'symbol': currency.symbol,
-				'rate_silent': currency.rate_silent,
-				'base': currency.base,
-				'decimal_separator': currency.decimal_separator,
-				'decimal_places': currency.decimal_places,
-				'thousands_separator': currency.thousands_separator,
-				'symbol_position': currency.symbol_position,
-			})
-
-		return values
-
 class ResPartner(models.Model):
 	_inherit = 'res.partner'
 
@@ -306,163 +32,3 @@ class ResPartner(models.Model):
 			})
 
 		return values
-
-class ProductProduct(models.Model):
-	_inherit = 'product.product'
-
-	############################################################
-	#	PRODUCT PRODUCT
-	############################################################
-
-	@api.model
-	def getProductProduct(self,domain):
-		ProductProduct = self.env['product.product'].search(domain)
-		values = []
-		for product in ProductProduct:
-			attributeValuesLines = map(lambda x: x.id, product.attribute_value_ids)
-			attributeIDS = []
-			for arttIds in self.env['product.attribute.value'].search([('id', 'in', attributeValuesLines)]):
-				attributeIDS.append(arttIds.attribute_id.id)
-
-			try:
-				brand = product.product_brand_id.id
-			except:
-				brand = ''
-
-			values.append({
-				'id': product.id,
-				'name': product.name,
-				'display_name': product.display_name,
-				'standard_price': product.standard_price,
-				'lst_price': product.lst_price,
-				'categ_id': {
-					'id': product.categ_id.id,
-					'name': product.categ_id.name,
-					'complete_name': product.categ_id.complete_name,
-				},
-				'product_brand_id': brand,
-				'atribute_value_ids': attributeValuesLines,
-				'attribute_ids': attributeIDS
-			})
-
-		return values
-
-	############################################################
-	#	PRODUCT BRAND
-	############################################################
-
-	@api.model
-	def getProductBrand(self,domain):
-		ProductBrand = self.env['product.brand'].search(domain)
-		values = []
-		for brand in ProductBrand:
-			values.append({
-				'id': brand.id,
-				'name': brand.name,
-			})
-
-		return values
-
-class ProductCategory(models.Model):
-	_inherit = 'product.category'
-
-	@api.model
-	def getProductCategory(self,domain):
-		ProductCategory = self.env['product.category'].search(domain)
-		values = []
-		for category in ProductCategory:
-			values.append({
-				'id': category.id,
-				'name': category.name,
-				'display_name': category.display_name,
-				'parent_id': [
-					category.parent_id.id,
-					category.parent_id.name,
-				],
-			})
-
-		return values
-
-class ProductAttribute(models.Model):
-	_inherit = 'product.attribute'
-
-	@api.model
-	def getProductAttribute(self,domain):
-		ProductAttribute = self.env['product.attribute'].search(domain)
-		values = []
-		for attribute in ProductAttribute:
-			values.append({
-				'id': attribute.id,
-				'name': attribute.name,
-			})
-
-		return values
-
-class ProductAttributeValue(models.Model):
-	_inherit = 'product.attribute.value'
-
-	@api.model
-	def getProductAttributeValue(self,domain):
-		ProductAttributeValue = self.env['product.attribute.value'].search(domain)
-		values = []
-		for value in ProductAttributeValue:
-			values.append({
-				'id': value.id,
-				'name': value.name,
-				'attribute_id': [
-					value.attribute_id.id,
-					value.attribute_id.name,
-				],
-			})
-
-		return values
-
-class StockLocation(models.Model):
-	_inherit = 'stock.location'
-
-	@api.model
-	def getStockLocation(self,domain):
-		StockLocation = self.env['stock.location'].search(domain)
-		values = []
-		for location in StockLocation:
-			values.append({
-				'id': location.id,
-				'name': location.name,
-				'display_name': location.display_name,
-				'company_id': [
-					location.company_id.id,
-					location.company_id.name,
-				],
-				'store_id': [
-					location.store_id.id,
-					location.store_id.name,
-				],
-				'usage': location.usage,
-			})
-
-		return values
-
-class StockQuant(models.Model):
-	_inherit = 'stock.quant'
-
-	@api.model
-	def getStockQuant(self,domain):
-		StockQuant = self.env['stock.quant'].search(domain)
-		values = []
-		for quant in StockQuant:
-			values.append({
-				'id': quant.id,
-				'name': quant.name,
-				'display_name': quant.display_name,
-				'location_id': [
-					quant.location_id.id,
-					quant.location_id.name,
-				],
-				'product_id': [
-					quant.product_id.id,
-					quant.product_id.name,
-				],
-				'qty': quant.qty,
-			})
-
-		return values

BIN
models.pyc


+ 0 - 274
static/src/js/chart.js

@@ -1,274 +0,0 @@
-function chart(reporting) {
-    "use strict";
-
-    var model = openerp;
-
-    reporting.ReportChartWidget = reporting.Base.extend({
-        BuildLineChart: function (label,data,CurrencyBase) {
-            var self = this;
-            Chart.scaleService.updateScaleDefaults('linear', {
-                ticks: {
-                    callback: function(tick) {
-                        return tick.toLocaleString('de-DE');
-                    }
-                }
-            });
-            Chart.defaults.global.tooltips.callbacks.label = function(tooltipItem, data) {
-                var dataset = data.datasets[tooltipItem.datasetIndex];
-                var datasetLabel = dataset.label || '';
-                return datasetLabel +  dataset.data[tooltipItem.index].toLocaleString('de-DE');
-            };
-            var chart = new Chart($(".reporting-chart"), {
-                type: 'line',
-                data: {
-                    labels: label,
-                    datasets: [
-                        {
-                            label: false,
-                            data: data,
-                            backgroundColor: '#bbdefb',
-                            borderColor: '#0288d1',
-                            borderWidth: 1,
-                            fill: true,
-                        }
-                    ]
-                },
-                options: {
-                    responsive: true,
-                    responsiveAnimationDuration:10,
-                    maintainAspectRatio:false,
-                    title: {
-                        display: false,
-                    },
-                    hover: {
-                        mode: 'nearest',
-                        intersect: true
-                    },
-                    legend: {
-                       display: false,
-                    },
-                    layout: {
-                        padding: {
-                            top: 0,
-                            bottom: 0,
-                            left : 0,
-                            rigth: 0,
-                        }
-                    },
-                    events: ['click'],
-                    tooltips: {
-                        callbacks: {
-                            label: function(tooltipItem, data) {
-                                var label = data.datasets[tooltipItem.datasetIndex].label || '';
-
-                                if (label) {
-                                    label += ': ';
-                                }
-                                label += accounting.formatMoney(tooltipItem.yLabel, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
-                                return label;
-                            }
-                        }
-                    }
-                }
-            });
-        },
-        fetchBarChart: function (data,CurrencyBase,label,body) {
-            var self = this;
-            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.product = "N/A";
-            //         item.amount = 0;
-            //     }
-            //     label.push(item.product.trim());
-            //     body.push(item.amount);;
-            // }
-
-            Chart.scaleService.updateScaleDefaults('linear', {
-              ticks: {
-                callback: function(tick) {
-                    return tick.toLocaleString('de-DE');
-                }
-              }
-            });
-            Chart.defaults.global.tooltips.callbacks.label = function(tooltipItem, data) {
-                var dataset = data.datasets[tooltipItem.datasetIndex];
-                var datasetLabel = dataset.label || '';
-                return datasetLabel +  dataset.data[tooltipItem.index].toLocaleString('de-DE');
-            };
-
-            var coloR = [];
-            coloR.push('#1976d2');
-            coloR.push('#e53935');
-            coloR.push('#9575cd');
-            coloR.push('#009688');
-            coloR.push('#43a047');
-            coloR.push('#cddc39');
-            coloR.push('#f9a825');
-            coloR.push('#ff5722');
-            coloR.push('#6d4c41');
-            coloR.push('#ffff00');
-
-            var chart = new Chart($(".reporting-chart"), {
-                type: 'horizontalBar',
-                data: {
-                    labels: label,
-                    datasets: [
-                        {
-                            label: false,
-                            data: body,
-                            backgroundColor: coloR,
-                            fill: true,
-                        }
-                    ]
-                },
-                options: {
-                    responsive: true,
-                    responsiveAnimationDuration:10,
-                    maintainAspectRatio:false,
-                    title: {
-                        display: false,
-                    },
-                    hover: {
-                        mode: 'nearest',
-                        intersect: true
-                    },
-                    legend: {
-                       display: false,
-                    },
-                    layout: {
-                        padding: {
-                            top: 0,
-                            bottom: 0,
-                            left : 0,
-                            rigth: 0,
-                        }
-                    },
-                    tooltips: {
-                        callbacks: {
-                            label: function(tooltipItem, data) {
-                                var label = data.datasets[tooltipItem.datasetIndex].label || '';
-
-                                if (label) {
-                                    label += ': ';
-                                }
-                                label += accounting.formatMoney(tooltipItem.xLabel, CurrencyBase.symbol, CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator);
-                                return label;
-                            }
-                        }
-                    },
-                    events: ['click'],
-                }
-            });
-        },
-        fetchPieChart: function (data,CurrencyBase,label,body) {
-            var self = this;
-            // var rank = 9;
-            // var item;
-            // var label = [];
-            // var body = [];
-            //
-            // var amount_total = _.reduce(_.map(data, function (map) {
-            //     return map.amount
-            // }), function (meno,num) {
-            //     return meno + num
-            // }, 0);
-            //
-            // for (var i = 0; i < rank; i++) {
-            //     if (data[i]){
-            //         item = data[i];
-            //     }else{
-            //         item = {};
-            //         item.product = "N/A";
-            //         item.amount = 0;
-            //     }
-            //     label.push(item.product.trim());
-            //     body.push((item.amount/amount_total)*100);
-            // }
-            //
-            // var num = 0;
-            // for (var i = 9; i < data.length; i++) {
-            //     num += data[i].amount;
-            // }
-            //
-            // if(num > 0){
-            //     label.push('Otros productos');
-            //     body.push((num/amount_total)*100);
-            // }
-
-            var coloR = [];
-            coloR.push('#1976d2');
-            coloR.push('#e53935');
-            coloR.push('#9575cd');
-            coloR.push('#009688');
-            coloR.push('#43a047');
-            coloR.push('#cddc39');
-            coloR.push('#f9a825');
-            coloR.push('#ff5722');
-            coloR.push('#6d4c41');
-            coloR.push('#ffff00');
-
-            var chart = new Chart($(".reporting-pie-chart"), {
-                type: 'pie',
-                data: {
-                    labels: label,
-                    datasets: [
-                        {
-                            label: false,
-                            data: body,
-                            backgroundColor: coloR,
-                            fill: true,
-                        }
-                    ]
-                },
-
-                options: {
-                    responsive: true,
-                    responsiveAnimationDuration:10,
-                    maintainAspectRatio:false,
-                    hover: {
-                        mode: 'nearest',
-                        intersect: true
-                    },
-                    legend: {
-                       position: 'right',
-                    },
-                    layout: {
-                        padding: {
-                            top: 0,
-                            bottom: 0,
-                            left : 0,
-                            rigth: 0,
-                        }
-                    },
-                    tooltips: {
-                        callbacks: {
-                            label: function(tooltipItem, data) {
-                                var label = data.datasets[tooltipItem.datasetIndex].label || '';
-                                if (label) {
-                                    label += ': ';
-                                }
-                                label += accounting.formatMoney(data.datasets[0].data[tooltipItem.index],{
-                                    symbol: "%",
-                                    format: "%v%s",
-                                    precision: 2,
-                                    thousand: ".",
-                                    decimal: ","
-                                });
-                                return label;
-                            }
-                        }
-                    },
-                    events: ['click'],
-                }
-            });
-        },
-    });
-}

+ 0 - 40
static/src/js/datepicker.js

@@ -1,40 +0,0 @@
-function datepicker(reporting) {
-    "use strict";
-
-    var model = openerp;
-
-    reporting.ReportDatePickerWidget = reporting.Base.extend({
-        fecthFecha: function() {
-            var to;
-            var dateFormat1 = "mm/dd/yy",
-            from = $( "#from" )
-            .datepicker({
-                dateFormat: "dd/mm/yy",
-                changeMonth: true,
-                numberOfMonths: 1,
-            })
-            .on( "change", function() {
-                to.datepicker( "option", "minDate", getDate(this), "dd/mm/yyyy");
-            });
-            to = $( "#to" ).datepicker({
-                dateFormat: "dd/mm/yy",
-                defaultDate: "+7d",
-                changeMonth: true,
-                numberOfMonths: 1,
-            })
-            .on( "change", function() {
-                from.datepicker( "option", "maxDate", getDate(this));
-            });
-            function getDate( element ) {
-                var fechaSel =element.value.split('/');
-                var date;
-                try {
-                    date = $.datepicker.parseDate( dateFormat1, (fechaSel[1]+"/"+fechaSel[0]+"/"+fechaSel[2]));
-                } catch( error ) {
-                    date = null;
-                }
-                return date;
-            }
-        },
-    });
-}

+ 0 - 3
static/src/js/main.js

@@ -6,9 +6,6 @@ openerp.eiru_reports_odontoimagen = function (instance) {
     reporting_base(instance,reporting);
 
     try {
-        pdf(reporting);
-        chart(reporting);
-        datepicker(reporting);
         report_doctor_ranking(reporting);
     } catch (e) {
         // ignorar error

+ 0 - 397
static/src/js/pdf.js

@@ -1,397 +0,0 @@
-function pdf(reporting) {
-    "use strict";
-
-    var model = openerp;
-
-    reporting.ReportPdfWidget = reporting.Base.extend({
-        drawPDF: function (getColumns,row,ResCompany,pdf_title,pdf_type,pdf_name,pdf_columnStyles) {
-            var self = this;
-            var base64Img = 'data:image/png;base64,' + ResCompany.logo;
-            var hoy = moment().format('DD/MM/YYYY');
-            var totalPagesExp = "{total_pages_count_string}";
-            var pdfDoc = new jsPDF(pdf_type);
-            console.log(getColumns);
-            pdfDoc.autoTable(getColumns, row, {
-                // showHeader: 'firstPage',
-                theme: 'grid',
-                styles: {
-                    overflow: 'linebreak',
-                    columnWidth: 'auto',
-                    fontSize: 7,
-                },
-                headerStyles: {
-                    fillColor: [76, 133, 248],
-                    fontSize: 9
-                },
-                columnStyles: pdf_columnStyles,
-                margin: { top: 20, horizontal: 7},
-                addPageContent: function (data) {
-                    pdfDoc.addImage(base64Img, 'png', 7, 2, 0, 15);
-                    if(pdf_type == 'l'){
-                        pdfDoc.setFontSize(12);
-                        pdfDoc.setFontStyle('bold');
-                        pdfDoc.setTextColor(40);
-                        pdfDoc.text(pdf_title,130,10);
-                    }else{
-                        pdfDoc.setFontSize(12);
-                        pdfDoc.setFontStyle('bold');
-                        pdfDoc.setTextColor(40);
-                        pdfDoc.text(pdf_title,80,10);
-                    }
-                    pdfDoc.setFontSize(9);
-                    pdfDoc.setFontStyle('normal');
-                    pdfDoc.setTextColor(40)
-                    pdfDoc.text(pdfDoc.internal.pageSize.getWidth() - 55, 14," Fecha de Expedición: " + hoy);
-
-                    /*===========
-                        FOOTER
-                    ===========*/
-                    var str = "Página " + data.pageCount;
-                    if (typeof pdfDoc.putTotalPages === 'function') {
-                        str = str + " de " + totalPagesExp;
-                    }
-                    pdfDoc.setFontSize(9);
-                    pdfDoc.setFontStyle('bold');
-                    pdfDoc.setTextColor(40);
-                    var pageHeight = pdfDoc.internal.pageSize.height || pdfDoc.internal.pageSize.getHeight();
-                    pdfDoc.text(str, pdfDoc.internal.pageSize.getWidth() - 55, pageHeight - 5);
-                }
-            });
-            if (typeof pdfDoc.putTotalPages === 'function') {
-                pdfDoc.putTotalPages(totalPagesExp);
-            }
-            row.pop();
-            if(model.printer_bridge){
-                var data = pdfDoc.output('datauristring');
-                model.printer_bridge.print(data);
-                return;
-            }
-            pdfDoc.save(pdf_name + hoy + '.pdf');
-        },
-
-        drawSaleJournalPDF: function (getColumns,row,ResCompany,pdf_title,pdf_type,pdf_name,pdf_columnStyles,desde,hasta) {
-            var self = this;
-            var base64Img = 'data:image/png;base64,' + ResCompany.logo;
-            var hoy = moment().format('DD/MM/YYYY');
-            var totalPagesExp = "{total_pages_count_string}";
-            var pdfDoc = new jsPDF(pdf_type);
-
-            /*
-            ==============================================
-                PRIMERA COLUMNA
-            ==============================================
-            */
-
-            // Title
-            pdfDoc.setFontSize(15);
-            pdfDoc.setFontStyle('bold');
-            pdfDoc.setTextColor(40);
-            pdfDoc.text(pdf_title,7,10);
-
-            // DEL
-            pdfDoc.setFontSize(10);
-            pdfDoc.setFontStyle('normal');
-            pdfDoc.setTextColor(40);
-            pdfDoc.text('DEL: ' + desde,7,20);
-
-            // AL
-            pdfDoc.setFontSize(10);
-            pdfDoc.setFontStyle('normal');
-            pdfDoc.setTextColor(40);
-            pdfDoc.text('AL: ' + hasta ,7,24);
-
-            /*
-            ==============================================
-                SEGUNDA COLUMNA
-            ==============================================
-            */
-
-            // CODIGO DESDE
-            pdfDoc.setFontSize(10);
-            pdfDoc.setFontStyle('normal');
-            pdfDoc.setTextColor(40);
-            pdfDoc.text('Código Desde: ' + 1 ,50,20);
-
-            // CODIGO HASTA
-            pdfDoc.setFontSize(10);
-            pdfDoc.setFontStyle('normal');
-            pdfDoc.setTextColor(40);
-            pdfDoc.text('Código Hasta: ' + (row.length - 1),50,24);
-
-            /*
-            ==============================================
-                QUINTA COLUMNA
-            ==============================================
-            */
-
-            // Empresa
-            pdfDoc.setFontSize(10);
-            pdfDoc.setFontStyle('normal');
-            pdfDoc.setTextColor(40);
-            pdfDoc.text('Empresa: ' + ResCompany.name ,100,20);
-
-            // RUC
-            pdfDoc.setFontSize(10);
-            pdfDoc.setFontStyle('normal');
-            pdfDoc.setTextColor(40);
-            pdfDoc.text('R.U.C: ' + ResCompany.company_ruc ,100,24);
-
-            /*
-            ==============================================
-                CREACION DEL PDF
-            ==============================================
-            */
-
-            pdfDoc.autoTable(getColumns, row, {
-                showHeader: 'false',
-                theme: 'grid',
-
-                drawRow: function (row, data) {
-                    if(pdf_type == "l"){
-                        if (row.index === 0) {
-                            pdfDoc.setTextColor(40);
-                            pdfDoc.setFontSize(8);
-                            pdfDoc.setFontStyle('bold');
-                            // Documento
-                            pdfDoc.rect(data.settings.margin.left, row.y, 52, 8, 'S');
-                            // Clientes
-                            pdfDoc.rect(59, row.y, 72, 8, 'S');
-                            // Total de Ventas
-                            pdfDoc.rect(131, row.y, 162, 8, 'S');
-                            pdfDoc.autoTableText("DOCUMENTO", 33, row.y + row.height / 2, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            pdfDoc.autoTableText("CLIENTES", 95, row.y + row.height / 2, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            pdfDoc.autoTableText("TOTAL DE VENTAS", 210, row.y + row.height / 2, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // NUM
-                            pdfDoc.rect(data.settings.margin.left, row.y + 8, 31, 8, 'S');
-                            pdfDoc.autoTableText("NUM", 22, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // FECHA
-                            pdfDoc.rect(38, row.y + 8, 21, 8, 'S');
-                            pdfDoc.autoTableText("FECHA", 47, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // RAZON SOCIAL
-                            pdfDoc.rect(59, row.y + 8, 52, 8, 'S');
-                            pdfDoc.autoTableText("RAZON SOCIAL", 83, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // RUC
-                            pdfDoc.rect(111, row.y + 8, 20, 8, 'S');
-                            pdfDoc.autoTableText("RUC", 120, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // GRAVADAS
-                            pdfDoc.rect(131, row.y + 8, 28, 8, 'S');
-                            pdfDoc.autoTableText("GRAVADAS", 145, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // %
-                            pdfDoc.rect(159, row.y + 8, 9, 8, 'S');
-                            pdfDoc.autoTableText("%", 163, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // IMPUESTOS
-                            pdfDoc.rect(168, row.y + 8, 25, 8, 'S');
-                            pdfDoc.autoTableText("IMPUESTOS", 180, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // EXENTAS
-                            pdfDoc.rect(193, row.y + 8, 30, 8, 'S');
-                            pdfDoc.autoTableText("EXENTAS", 209, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // Ret IVA
-                            pdfDoc.rect(223, row.y + 8, 20, 8, 'S');
-                            pdfDoc.autoTableText("Ret IVA", 232, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // Ret Renta
-                            pdfDoc.rect(243, row.y + 8, 20, 8, 'S');
-                            pdfDoc.autoTableText("Ret RENTA", 253, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // TOTAL
-                            pdfDoc.rect(263, row.y + 8, 30, 8, 'S');
-                            pdfDoc.autoTableText("TOTAL", 276, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            data.cursor.y += 16;
-                        };
-                    }else{
-                        if (row.index === 0) {
-                            pdfDoc.setTextColor(40);
-                            pdfDoc.setFontSize(8);
-                            pdfDoc.setFontStyle('bold');
-                            // Documento
-                            pdfDoc.rect(data.settings.margin.left, row.y, 43, 8, 'S');
-                            // Clientes
-                            pdfDoc.rect(50, row.y, 53, 8, 'S');
-                            // Total de Ventas
-                            pdfDoc.rect(103, row.y, 100, 8, 'S');
-                            pdfDoc.autoTableText("DOCUMENTO", 29, row.y + row.height / 2, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            pdfDoc.autoTableText("CLIENTES", 77, row.y + row.height / 2, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            pdfDoc.autoTableText("TOTAL DE VENTAS",148, row.y + row.height / 2, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // NUM
-                            pdfDoc.setFontSize(6);
-                            pdfDoc.rect(data.settings.margin.left, row.y + 8, 27, 8, 'S');
-                            pdfDoc.autoTableText("NUM", 21, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // FECHA
-                            pdfDoc.rect(34, row.y + 8, 16, 8, 'S');
-                            pdfDoc.autoTableText("FECHA", 42, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // RAZON SOCIAL
-                            pdfDoc.rect(50, row.y + 8, 35, 8, 'S');
-                            pdfDoc.autoTableText("RAZON SOCIAL", 68, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // RUC
-                            pdfDoc.rect(85, row.y + 8, 18, 8, 'S');
-                            pdfDoc.autoTableText("RUC", 95, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // GRAVADAS
-                            pdfDoc.rect(103, row.y + 8, 20, 8, 'S');
-                            pdfDoc.autoTableText("GRAVADAS", 113, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // %
-                            pdfDoc.rect(123, row.y + 8, 5, 8, 'S');
-                            pdfDoc.autoTableText("%", 126, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // IMPUESTOS
-                            pdfDoc.rect(128, row.y + 8, 15, 8, 'S');
-                            pdfDoc.autoTableText("IMPUESTOS", 136, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // EXENTAS
-                            pdfDoc.rect(143, row.y + 8, 20, 8, 'S');
-                            pdfDoc.autoTableText("EXENTAS", 152, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // Ret IVA
-                            pdfDoc.rect(163, row.y + 8, 10, 8, 'S');
-                            pdfDoc.autoTableText("Ret", 168, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            pdfDoc.autoTableText("IVA", 168, row.y + row.height / 2 + 10, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // Ret Renta
-                            pdfDoc.rect(173, row.y + 8, 10, 8, 'S');
-                            pdfDoc.autoTableText("Ret", 179, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            pdfDoc.autoTableText("RENTA", 178, row.y + row.height / 2 + 10, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            // TOTAL
-                            pdfDoc.rect(183, row.y + 8, 20, 8, 'S');
-                            pdfDoc.autoTableText("TOTAL", 192, row.y + row.height / 2 + 8, {
-                                halign: 'center',
-                                valign: 'middle'
-                            });
-                            data.cursor.y += 16;
-                        };
-                    }
-                },
-
-                drawCell: function(cell, data) {
-                    var rows = data.table.rows;
-                    if (data.row.index == rows.length - 1) {
-                        pdfDoc.setFillColor(200, 200, 255);
-                    }
-                },
-
-                styles: {
-                    overflow: 'linebreak',
-                    columnWidth: 'auto',
-                    fontSize: 7,
-                },
-                headerStyles: {
-                    fillColor: [76, 133, 248],
-                    fontSize: 9
-                },
-
-                columnStyles: pdf_columnStyles,
-                margin: { top: 28, horizontal: 7},
-
-                addPageContent: function (data) {
-                    /*===========
-                        FOOTER
-                    ===========*/
-                    var str = "Página " + data.pageCount;
-                    if (typeof pdfDoc.putTotalPages === 'function') {
-                        str = str + " de " + totalPagesExp;
-                    }
-                    pdfDoc.setFontSize(9);
-                    pdfDoc.setFontStyle('bold');
-                    pdfDoc.setTextColor(40);
-                    var pageHeight = pdfDoc.internal.pageSize.height || pdfDoc.internal.pageSize.getHeight();
-                    pdfDoc.text(str, pdfDoc.internal.pageSize.getWidth() - 55, pageHeight - 5);
-                }
-            });
-
-            pdfDoc.setFontSize(9);
-            pdfDoc.setFontStyle('bold');
-            pdfDoc.setTextColor(40);
-            pdfDoc.text('Listado concluido', 7, pdfDoc.autoTable.previous.finalY + 5);
-
-            if (typeof pdfDoc.putTotalPages === 'function') {
-                pdfDoc.putTotalPages(totalPagesExp);
-            }
-            row.pop();
-            if(model.printer_bridge){
-                var data = pdfDoc.output('datauristring');
-                model.printer_bridge.print(data);
-                return;
-            }
-            pdfDoc.save(pdf_name + hoy + '.pdf');
-        },
-    });
-}

+ 0 - 26
static/src/js/reports/report_doctor_ranking.js

@@ -511,32 +511,6 @@ function report_doctor_ranking(reporting){
             }
         },
 
-        updateAttributeSelections: function () {
-            var self = this;
-            var attribute = self.$el.find('#current-attribute').val();
-            if(attribute != 9999999){
-                /*=============================
-                    ATTRIBUTE VALUE SELECTION
-                =============================*/
-                var attribute_value = self.$el.find('#current-attribute-value').empty();
-                self.$el.find('#current-attribute-value').append('<option value="9999999">Todos los valores de atributos</option>');
-                _.each(self.ProductAttributeValue,function(item){
-                    if(parseFloat(attribute) == item.attribute_id[0]){
-                        self.$el.find('#current-attribute-value').append('<option value="' + item.id + '">' + item.name + '</option>');
-                    }
-                });
-            }else{
-                /*=============================
-                    ATTRIBUTE VALUE SELECTION
-                =============================*/
-                var attribute_value = self.$el.find('#current-attribute-value').empty();
-                self.$el.find('#current-attribute-value').append('<option value="9999999">Todos los valores de atributos</option>');
-                _.each(self.ProductAttributeValue,function(item){
-                    self.$el.find('#current-attribute-value').append('<option value="' + item.id + '">' + item.name + '</option>');
-                });
-            }
-        },
-
         updateJournalSelections: function () {
             var self = this;
             var store = self.$el.find('#current-store').val();

+ 1 - 4
templates.xml

@@ -7,10 +7,7 @@
                 <!-- configuration < main > -->
                 <script type="text/javascript" src="/eiru_reports_odontoimagen/static/src/js/main.js" />
                 <script type="text/javascript" src="/eiru_reports_odontoimagen/static/src/js/reporting_base.js" />
-                <script type="text/javascript" src="/eiru_reports_odontoimagen/static/src/js/pdf.js" />
-                <script type="text/javascript" src="/eiru_reports_odontoimagen/static/src/js/chart.js" />
-                <script type="text/javascript" src="/eiru_reports_odontoimagen/static/src/js/datepicker.js" />
-
+                <!-- Ranking de Doctores -->
                 <script type="text/javascript" src="/eiru_reports_odontoimagen/static/src/js/reports/report_doctor_ranking.js"/>
 
             </xpath>