瀏覽代碼

Para imprimir pagare cemobo

Sebas 5 年之前
當前提交
0de2522fc4
共有 11 個文件被更改,包括 1563 次插入0 次删除
  1. 1 0
      .gitignore
  2. 2 0
      __init__.py
  3. 22 0
      __openerp__.py
  4. 143 0
      models.py
  5. 二進制
      static/description/icon.png
  6. 4 0
      static/src/css/style.css
  7. 608 0
      static/src/js/main (copia).js
  8. 747 0
      static/src/js/main.js
  9. 8 0
      static/src/xml/main.xml
  10. 18 0
      views/account_invoice_view.xml
  11. 10 0
      views/template.xml

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+*.pyc

+ 2 - 0
__init__.py

@@ -0,0 +1,2 @@
+# -*- coding: utf-8 -*-
+import models

+ 22 - 0
__openerp__.py

@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+{
+    'name' : 'Impresion de pagare Cemobo',
+    'version' : '1.0',
+    'description' : """
+Este modulo Permite realizar impresión del pagare Cemobo
+    """,
+    'author' : 'Eiru',
+    'category' : 'Service',
+    'depends' : [
+        'account',
+        'eiru_num2word',
+        'partner_extra_data_crifin',
+    ],
+    'data' : [
+        'views/template.xml',
+        'views/account_invoice_view.xml'
+    ],
+    'qweb' : ['static/src/xml/*.xml',],
+    'installable' : True,
+    'auto_install' : False,
+}

+ 143 - 0
models.py

@@ -0,0 +1,143 @@
+# -*- coding: utf-8 -*-
+
+from openerp import models, fields, api
+
+class AccountInvoice(models.Model):
+	_inherit = 'account.invoice'
+
+	@api.model
+	def getAccountInvoicePagare(self,domain):
+		AccountInvoice = self.env['account.invoice'].search(domain)
+		values = []
+		for invoice in AccountInvoice:
+			values.append({
+                # ID
+				'id': invoice.id,
+                'number': invoice.number,
+                'origin': invoice.origin,
+                'date_invoice': invoice.date_invoice,
+                'user_name': invoice.user_id.name,
+                'amount_untaxed': invoice.amount_untaxed,
+                'amount_tax': invoice.amount_untaxed,
+                'amount_total': invoice.amount_total,
+				'comment': invoice.comment,
+
+                # PARTNER INFO
+				'partner_id':[{
+					'id': invoice.partner_id.id,
+					'name': invoice.partner_id.name,
+					'ruc': invoice.partner_id.ruc,
+					'address': invoice.partner_id.street,
+					'city': invoice.partner_id.city,
+					'barrio': invoice.partner_id.street2,
+					'email': invoice.partner_id.email,
+					'estado_civil': invoice.partner_id.estado_civil,
+	                'phone': invoice.partner_id.phone,
+	                'mobile': invoice.partner_id.mobile,
+					'trab_empresa': invoice.partner_id.trab_empresa,
+					'trab_telefono': invoice.partner_id.trab_telefono,
+					'trab_street': invoice.partner_id.trab_street,
+	                'trab_city': invoice.partner_id.trab_city,
+	                'trab_cargo': invoice.partner_id.trab_cargo,
+					'trab_antiguedad_a': invoice.partner_id.trab_antiguedad_a,
+					'trab_antiguedad_m': invoice.partner_id.trab_antiguedad_m,
+					'casa_propia': invoice.partner_id.casa_propia,
+				    'casa_alquiler': invoice.partner_id.casa_alquiler,
+					'trab_salario': invoice.partner_id.trab_salario,
+					'conyuge_id':[{
+					        'cony_id': invoice.partner_id.conyuge_id.id,
+							'cony_name': invoice.partner_id.conyuge_id.name,
+							'cony_ruc': invoice.partner_id.conyuge_id.ruc,
+			                'cony_phone': invoice.partner_id.conyuge_id.phone,
+			                'cony_mobile': invoice.partner_id.conyuge_id.mobile,
+							'cony_city': invoice.partner_id.conyuge_id.city,
+							'cony_street': invoice.partner_id.conyuge_id.street,
+			                'cony_trab_empresa': invoice.partner_id.conyuge_id.trab_empresa,
+			                'cony_trab_telefono': invoice.partner_id.conyuge_id.trab_telefono,
+					}],
+					'ref_personal_ids': [{
+						'id': refPartner.id,
+						'name': refPartner.name,
+						'phone': refPartner.phone,
+					    'email': refPartner.email,
+					} for refPartner in invoice.partner_id.ref_personal_ids],
+
+					'ref_comercial_ids': [{
+						'id': comPartner.id,
+						'name': comPartner.name,
+						'phone': comPartner.phone,
+					} for comPartner in invoice.partner_id.ref_comercial_ids],
+
+				}],
+                # COMPANY INFO
+				'company_id': [{
+					'id':invoice.user_id.company_id.id,
+	                'name': invoice.user_id.company_id.name,
+	                'logo': invoice.user_id.company_id.logo,
+	                'phone': invoice.user_id.company_id.phone,
+				}],
+				# CURRENCY INFO
+				'currency_id':[{
+					'id': invoice.currency_id.id,
+					'name': invoice.currency_id.name,
+					'symbol': invoice.currency_id.symbol,
+					'thousands_separator': invoice.currency_id.thousands_separator,
+					'decimal_separator': invoice.currency_id.decimal_separator,
+					'decimal_places': invoice.currency_id.decimal_places,
+					'symbol_position': invoice.currency_id.symbol,
+				}],
+			})
+
+		return values
+
+	@api.model
+	def getAccountInvoicePagareQuota(self,domain):
+		AccountInvoice = self.env['account.invoice'].search(domain)
+		AccountMoveLine = self.env['account.move.line'].search([('move_id','=',AccountInvoice.number),('debit','>',0)],order='date_maturity')
+
+		i = 1
+		x = len(AccountMoveLine)
+		values = []
+
+		for line in AccountMoveLine:
+			amount = 0
+			value = 0
+			state = 'No pagado'
+			if(line.reconcile_ref != False):
+				if(line.amount_residual == 0):
+					state = 'Pagado'
+
+				if(line.amount_residual > 0):
+					value = line.debit - line.amount_residual
+					state = 'Amortizado'
+
+			values.append({
+				'date': line.date_maturity,
+				'name': 'Cuota ' + str(i) + ' / ' + str(x),
+				'state': state,
+				'value': value,
+				'amount': line.debit,
+				'residual': line.amount_residual,
+				'tot_cuota': str(x),
+			})
+			i = i + 1
+
+		return values
+
+class AccountInvoiceLine(models.Model):
+	_inherit = 'account.invoice.line'
+
+	@api.model
+	def getAccountInvoiceLinePagare(self,domain):
+		AccountInvoiceLine = self.env['account.invoice.line'].search(domain)
+		values = []
+		for line in AccountInvoiceLine:
+			values.append({
+				'id': line.id,
+                'name': line.name,
+                'quantity': line.quantity,
+                'price_unit': line.price_unit,
+                'price_subtotal': line.price_subtotal,
+			})
+
+		return values

二進制
static/description/icon.png


+ 4 - 0
static/src/css/style.css

@@ -0,0 +1,4 @@
+.pagare_button_box {
+    width: auto;
+    float: left;
+}

文件差異過大導致無法顯示
+ 608 - 0
static/src/js/main (copia).js


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

@@ -0,0 +1,747 @@
+openerp.pagare_cemobo = function (instance, local) {
+    local.widgetInstance = null;
+    local.parentInstance = null;
+
+    local.PagareCemoboWidget = instance.Widget.extend({
+        template : "pagare_cemobo.PagareCemobo",
+        jsonDoc:[],
+
+        init:function(parent){
+            this._super(parent);
+        },
+
+        updateId : function(id){
+            var self = this;
+            self.id=id;
+        },
+
+        start: function () {
+            var self = this;
+            this.$el.click(function (e) {
+                self.fecthInitial();
+            });
+        },
+
+        valorNull:function(dato){
+            var valor ="";
+            if (dato){
+                if(dato == true && typeof dato == 'boolean'){
+                    valor=" ";
+                }else{
+                    valor=dato;
+                }
+            }
+            return valor;
+        },
+
+        fecthInitial: function(){
+            var id= openerp.webclient._current_state.id;
+            var self = this;
+            self.fetchAccountInvoice(id).then(function(AccountInvoice){
+                return AccountInvoice;
+            }).then(function(AccountInvoice){
+                self.AccountInvoice = AccountInvoice;
+                return self.fetchAccountInvoiceQuota(id);
+            }).then(function(AccountInvoiceQuota){
+                self.AccountInvoiceQuota = AccountInvoiceQuota;
+                return self.fetchAccountInvoiceLine();
+            }).then(function(AccountInvoiceLine){
+                self.AccountInvoiceLine = AccountInvoiceLine;
+                return self.drawPDF();
+            });
+            return false;
+        },
+
+        fetchAccountInvoice: function(id){
+            var domain=[['id','=', id]];
+            var AccountInvoice = new instance.web.Model('account.invoice');
+            return AccountInvoice.call('getAccountInvoicePagare',[domain], {
+                context: new instance.web.CompoundContext()
+            });
+        },
+
+        fetchAccountInvoiceQuota: function(id){
+            var domain=[['id','=', id]];
+            var AccountInvoice = new instance.web.Model('account.invoice');
+            return AccountInvoice.call('getAccountInvoicePagareQuota',[domain], {
+                context: new instance.web.CompoundContext()
+            });
+        },
+
+        fetchAccountInvoiceLine: function () {
+            var self = this;
+            var invoice_ids = _.flatten(_.map(self.AccountInvoice,function(map){
+                return map.id;
+            }));
+            var domain=[['invoice_id','in',invoice_ids]];
+            var AccountInvoiceLine = new instance.web.Model('account.invoice.line');
+            return AccountInvoiceLine.call('getAccountInvoiceLinePagare',[domain], {
+                context: new instance.web.CompoundContext()
+            });
+        },
+
+        drawPDF:function(){
+            var self = this;
+            var AccountInvoice = self.AccountInvoice;
+            var CurrencyBase = self.AccountInvoice[0].currency_id[0];
+            var docItem = [];
+            var docQuotaItem = [];
+            var getColumns = [];
+            var getColumnsQuota = [];
+
+            var pdfDoc = new jsPDF("p","mm","a4");
+            // pdfDoc.addImage("data:image/png;base64," + AccountInvoice[0].company_id[0].logo, 'PNG',10,10,20,15);
+            pdfDoc.addImage("data:image/png;base64," + AccountInvoice[0].company_id[0].logo, 'png', 10, 10, 50, 30);
+
+            _.each(self.AccountInvoiceLine, function(item){
+                docItem.push({
+                    name : item.name,
+                    quantity : item.quantity,
+                    price_unit : accounting.formatMoney(item.price_unit,'',CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                    price_subtotal : accounting.formatMoney(item.price_subtotal,'',CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                });
+            });
+            getColumns.push({
+                title : 'Descripción',
+                halign: 'center',
+                dataKey: 'name'
+            });
+            getColumns.push({
+                title : 'Cantidad',
+                halign: 'center',
+                dataKey: 'quantity'
+            });
+            getColumns.push({
+                title : 'Precio Unitario',
+                halign: 'center',
+                dataKey: 'price_unit'
+            });
+            getColumns.push({
+                title : 'subtotal',
+                halign: 'center',
+                dataKey: 'price_subtotal'
+            });
+
+            pdfDoc.autoTable(getColumns, docItem, {
+                theme: 'grid',
+                styles: {
+                    overflow: 'linebreak',
+                    columnWidth: 'auto',
+                    fontSize: 7
+                },
+                headerStyles: {
+                    textColor: 20,
+                    fillColor: null,
+                    lineWidth: 0.1,
+                    fontSize: 9
+                },
+                columnStyles: {
+                    name : {columnWidth: 'auto'},
+                    quantity : {columnWidth: 25, halign:'right'},
+                    price_unit : {columnWidth: 25, halign:'right'},
+                    price_subtotal : {columnWidth: 25, halign:'right'},
+                },
+
+                margin: { top: 80, horizontal: 10},
+
+                addPageContent: function (data) {
+
+                    // pdfDoc.setFontSize(11);
+                    // pdfDoc.setFontStyle('bold');
+                    // pdfDoc.setTextColor(20);
+                    // pdfDoc.text(40, 13,'Empresa: ');
+                    // pdfDoc.setFontSize(11);
+                    // pdfDoc.setFontStyle('normal');
+                    // pdfDoc.text(60, 13, 'M&S CEMOBO');
+
+                    pdfDoc.setFontSize(11);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(20);
+                    pdfDoc.text(120, 13,'Número de Operación: ');
+                    pdfDoc.setFontSize(11);
+                    pdfDoc.setFontStyle('normal');
+                    pdfDoc.text(165, 13, AccountInvoice[0].origin);
+
+                    pdfDoc.setFontSize(11);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(20);
+                    pdfDoc.text(120, 18,'Número de Documento: ');
+                    pdfDoc.setFontSize(11);
+                    pdfDoc.setFontStyle('normal');
+                    pdfDoc.text(165, 18, AccountInvoice[0].number);
+
+                    pdfDoc.setFontSize(11);
+                    pdfDoc.setFontStyle('bold');
+                    pdfDoc.setTextColor(20);
+                    pdfDoc.text(120, 23,'Responsable: ');
+                    pdfDoc.setFontSize(11);
+                    pdfDoc.setFontStyle('normal');
+                    pdfDoc.text(147, 23, AccountInvoice[0].user_name);
+
+                    // Cuadro principal
+                    //pdfDoc.rect(10, 30, pdfDoc.internal.pageSize.getWidth() - 20 , 40, 'S');
+                    pdfDoc.rect(10, 40, pdfDoc.internal.pageSize.getWidth() - 20 , 40, 'S');
+                    // Cuadro fecha de emision
+                    pdfDoc.rect(10, 40, 80, 7, 'S');
+                    pdfDoc.setFontSize(8);
+                    pdfDoc.setFontStyle('normal');
+                    pdfDoc.setTextColor(20);
+                    pdfDoc.text(12, 44,'Fecha de emisión: ');
+                    pdfDoc.text(45, 44,  moment(AccountInvoice[0].date_invoice).format('DD/MM/YYYY'));
+                    // RUC / Documento de identidad No.
+                    pdfDoc.rect(10, 47, pdfDoc.internal.pageSize.getWidth() - 20, 7, 'S');
+                    pdfDoc.text(12, 52,'RUC / Documento de Identidad No.: ' + AccountInvoice[0].partner_id[0].ruc);
+                    // Nombre o Razon Social
+                    pdfDoc.rect(10, 54, pdfDoc.internal.pageSize.getWidth() - 20, 7, 'S');
+                    pdfDoc.text(12, 59,'Nombre o Razón Social: ' + AccountInvoice[0].partner_id[0].name);
+                    // Telefono
+                    pdfDoc.rect(10, 61, 95, 7, 'S');
+                    pdfDoc.text(12, 65,'Teléfono: ' + self.valorNull(AccountInvoice[0].partner_id[0].phone));
+                    //
+                    // Direccion
+                    pdfDoc.rect(105, 61, 95, 7, 'S');
+                    pdfDoc.text(107, 65,'Direccion: ' + self.valorNull(AccountInvoice[0].partner_id[0].address));
+
+                }
+            });
+
+
+            _.each(self.AccountInvoiceQuota, function(item){
+                docQuotaItem.push({
+                    date : moment(item.date).format('DD/MM/YYYY'),
+                    name : item.name,
+                    amount : accounting.formatMoney(item.amount,'',CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                });
+            });
+            getColumnsQuota.push({
+                title : 'Fecha',
+                halign: 'center',
+                dataKey: 'date'
+            });
+            getColumnsQuota.push({
+                title : 'Descripción',
+                halign: 'center',
+                dataKey: 'name'
+            });
+            getColumnsQuota.push({
+                title : 'Valor de la Cuota',
+                halign: 'center',
+                dataKey: 'amount'
+            });
+
+
+            var finalY = pdfDoc.autoTable.previous.finalY;
+
+            pdfDoc.setFontSize(10);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.setTextColor(40);
+            pdfDoc.text(10,finalY + 5,'Total: ' + accounting.formatMoney(AccountInvoice[0].amount_total,CurrencyBase.symbol,CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator));
+
+            pdfDoc.setFontSize(10);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.setTextColor(40);
+            pdfDoc.text(85,finalY + 15,'Información de Cuotas ');
+
+            pdfDoc.autoTable(getColumnsQuota, docQuotaItem, {
+                theme: 'grid',
+                startY: finalY + 20,
+                styles: {
+                    overflow: 'linebreak',
+                    columnWidth: 'auto',
+                    fontSize: 7,
+
+                },
+                headerStyles: {
+                    textColor: 20,
+                    fillColor: null,
+                    lineWidth: 0.1,
+                    fontSize: 9
+                },
+                columnStyles: {
+                    date : {columnWidth: 'auto', halign: 'center'},
+                    name : {columnWidth: 'auto', halign: 'center'},
+                    amount : {columnWidth: 'auto', halign: 'right'}
+                },
+                margin: {horizontal: 10},
+                addPageContent: function (data) {
+                    // pdfDoc.setFontSize(10);
+                    // pdfDoc.setFontStyle('bold');
+                    // pdfDoc.setTextColor(40);
+                    // pdfDoc.text(85,finalY + 15,'Información de Cuotas ');
+                    //
+                    // pdfDoc.setFontSize(10);
+                    // pdfDoc.setFontStyle('bold');
+                    // pdfDoc.setTextColor(40);
+                    // pdfDoc.text(10,finalY + 5,'Total: ' + accounting.formatMoney(AccountInvoice[0].amount_total,CurrencyBase.symbol,CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator));
+                }
+            });
+
+            var finalY1 = pdfDoc.autoTable.previous.finalY;
+
+            pdfDoc.setFontSize(10);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.setTextColor(40);
+            pdfDoc.text(10,finalY1 + 5,'Total: ' + accounting.formatMoney(AccountInvoice[0].amount_total,CurrencyBase.symbol,CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator));
+
+
+            pdfDoc.addPage();
+            pdfDoc.setTextColor(40);
+            i=0
+            _.each(self.AccountInvoiceQuota, function(item){
+
+            pdfDoc.setFontSize(14);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.text(80,15+i,'CEMOBO');
+            pdfDoc.setFontSize(12);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.rect(10, 18+i, 95, 0, 'S');
+            pdfDoc.text(12,23+i,'Número de Operación:' + AccountInvoice[0].origin);
+            pdfDoc.setFontSize(12);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.rect(105, 18+i, 95, 0, 'S');
+            pdfDoc.text(110,23+i,'Fecha de Operación: ' + moment(AccountInvoice[0].date_invoice).format('DD/MM/YYYY'));
+            pdfDoc.setFontSize(12);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.text(12,28+i,'C.I. N°: ' + self.valorNull(AccountInvoice[0].partner_id[0].ruc));
+            pdfDoc.setFontSize(12);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.text(110,28+i,'Vendedor: ' + self.valorNull(AccountInvoice[0].user_name));
+            pdfDoc.setFontSize(12);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.text(12,33+i,'Cliente: ' + self.valorNull(AccountInvoice[0].partner_id[0].name));
+            pdfDoc.rect(10, 35+i, 95, 0, 'S');
+            pdfDoc.setFontSize(12);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.text(12,43+i,'Cuota N°:' + item.name);
+            pdfDoc.rect(105, 35+i, 95, 0, 'S');
+            pdfDoc.setFontSize(12);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.text(110,43+i,'Vence: ' + moment(item.date).format('DD/MM/YYYY'));
+            pdfDoc.setFontSize(12);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.text(12,49+i,'Monto Cuota:' + item.amount);
+            pdfDoc.setFontSize(12);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.text(110,56+i,'Firma: _ _ _ _ _ _ _ _ _');
+
+              i=i+55
+              if (i>220) {
+                 pdfDoc.addPage();
+                 i=0
+              }
+            });
+
+            pdfDoc.addPage();
+
+            pdfDoc.addImage("data:image/png;base64," + AccountInvoice[0].company_id[0].logo, 'png', 10, 10, 50, 30);
+            pdfDoc.setFontSize(16);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.setTextColor(40);
+            pdfDoc.text(80,25,'PAGARE A LA ORDEN');
+
+            pdfDoc.setFontSize(10);
+            pdfDoc.setFontStyle('normal');
+            pdfDoc.setTextColor(40);
+            pdfDoc.rect(10, 45, 95, 7, 'S');
+            pdfDoc.text(12,50,'Número de Operación: ' + AccountInvoice[0].origin);
+            pdfDoc.rect(105, 45, 95, 7, 'S');
+            pdfDoc.text(110,50,'Fecha de Operación: ' + moment(AccountInvoice[0].date_invoice).format('DD/MM/YYYY'));
+            pdfDoc.rect(10, 55, 95, 7, 'S');
+            pdfDoc.setFontSize(10);
+            pdfDoc.setFontStyle('normal');
+            pdfDoc.text(12,60,'Monto a pagar: ' + accounting.formatMoney(AccountInvoice[0].amount_total,CurrencyBase.symbol,CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator));
+            pdfDoc.rect(105, 55, 95, 7, 'S');
+            pdfDoc.setFontSize(10);
+            pdfDoc.setFontStyle('normal');
+            _.each(self.AccountInvoiceQuota, function(item){
+                varfecha=item.date;
+            });
+            pdfDoc.text(110,60,'Vencimiento: ' + moment(varfecha).format('DD/MM/YYYY'));
+            var total_in_letters = instance.web.num2word(AccountInvoice[0].amount_total);
+            pdfDoc.rect(10, 65, pdfDoc.internal.pageSize.getWidth() - 15 , 16,'S');
+            pdfDoc.setFontSize(11);
+            pdfDoc.setFontStyle('normal');
+            pdfDoc.text(12,70,'Pagaré a la orden de CEMOBO.');
+            pdfDoc.setFontSize(10.5);
+            pdfDoc.setFontStyle('normal');
+            pdfDoc.text(12,75,'La suma de Guaraníes: ' );
+            pdfDoc.setFontSize(10.5);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.text(12,79, total_in_letters);
+            pdfDoc.rect(10, 81, pdfDoc.internal.pageSize.getWidth() - 15 , 60,'S');
+            pdfDoc.setFontSize(11);
+            pdfDoc.setFontStyle('normal');
+            var paragraph="Queda expresamente convenido que la falta de pago de este pagaré me (nos) constituirá en mora automáticamente, sin necesidad de interpelación judicial o extrajudicial alguna, devengando durante el tiempo de la mora un interés del ....%, un interés moratorio del ....% y una comisión del ....% por el simple retardo sin que esto implique prórroga del plazo de la obligación. Asimismo me (nos) obligamos a pagar cualquier gasto en que incurra el acreedor con relación a este préstamo, en caso de que el mismo sea reclamado por la vía judicial o extrajudicial. El simple vencimiento establecerá mora, autorizando la inclusión de nombre personal o Razón Social que represento, a la base de datos de Informconf, conforme a lo establecido en la Ley 168/01, como también para que se pueda proveer la información a terceros interesados. A los efectos legales y procesales nos sometemos a la jurisdicción de los Tribunales de Ciudad del Este y renunciando a cualquier otra que pudiera corresponder las partes constituyen domicilio real y especial en los lugares señalados en el presente documento.";
+            pdfDoc.text(paragraph,12,87,{maxWidth:188,align:'justify'});
+
+            pdfDoc.setFontSize(10);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.setTextColor(40);
+            pdfDoc.text(10,165,'DEUDOR');
+            pdfDoc.text(110,165,'CO-DEUDOR');
+
+            pdfDoc.setFontSize(9);
+            pdfDoc.setFontStyle('normal');
+            pdfDoc.setTextColor(40);
+            pdfDoc.text(10,175,'Nombre y Apellido: ' + AccountInvoice[0].partner_id[0].name);
+            pdfDoc.text(110,175,'Nombre y Apellido:');
+            pdfDoc.text(10,180,'RUC / DNI: ' + self.valorNull(AccountInvoice[0].partner_id[0].ruc));
+            pdfDoc.text(110,180,'RUC / DNI:');
+            pdfDoc.text(10,185,'Domicilio: ' + self.valorNull(AccountInvoice[0].partner_id[0].address));
+            pdfDoc.text(110,185,'Domicilio:');
+            pdfDoc.text(10,195,'Telefono: ' + self.valorNull(AccountInvoice[0].partner_id[0].phone));
+            pdfDoc.text(110,195,'Telefono:');
+            pdfDoc.text(10,200,'Celular: ' + self.valorNull(AccountInvoice[0].partner_id[0].mobile));
+            pdfDoc.text(110,200,'Celular:');
+            pdfDoc.text(10,210,'Firma: ');
+            pdfDoc.text(110,210,'Firma:');
+
+            pdfDoc.addPage();
+
+            pdfDoc.addImage("data:image/png;base64," + AccountInvoice[0].company_id[0].logo, 'png', 10, 10, 50, 30);
+
+            pdfDoc.setFontSize(11);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.setTextColor(20);
+            pdfDoc.text(80, 25,'SOLICITUD DE LINEA DE CREDITO');
+
+            pdfDoc.text(91, 30,'Empresa: Cemobo');
+            pdfDoc.setFontSize(10);
+            pdfDoc.setFontStyle('normal');
+            pdfDoc.setTextColor(40);
+            pdfDoc.rect(10, 45, 95, 7, 'S');
+            pdfDoc.text(12,50,'SUCURSAL: ' );
+            pdfDoc.rect(105, 45, 95, 7, 'S');
+            pdfDoc.text(110,50,'Fecha de Operación: ' + moment(AccountInvoice[0].date_invoice).format('DD/MM/YYYY'));
+            pdfDoc.rect(10, 55, 95, 7, 'S');
+            pdfDoc.setFontSize(10);
+            pdfDoc.setFontStyle('normal');
+            pdfDoc.text(12,60,'Vendedor: ' + AccountInvoice[0].user_name);
+            pdfDoc.setFontSize(10);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.setTextColor(40);
+            pdfDoc.text(10, 72,'Datos del Cliente o Empresa');
+
+            // Cuadro principal
+            pdfDoc.rect(10, 80, pdfDoc.internal.pageSize.getWidth() - 20 , 35, 'S');
+            // Cuadro fecha de emision
+            pdfDoc.rect(10, 80, 95, 7, 'S');
+            pdfDoc.setFontSize(8);
+            pdfDoc.setFontStyle('normal');
+            pdfDoc.setTextColor(20);
+            pdfDoc.text(12, 84,'Fecha de emisión: ');
+            pdfDoc.text(45, 84,  moment(AccountInvoice[0].date_invoice).format('DD/MM/YYYY'));
+            // RUC / Documento de identidad No.
+            pdfDoc.rect(105, 80, 95, 7, 'S');
+            pdfDoc.text(125, 84,'RUC / Doc. de Identidad No.: ' + AccountInvoice[0].partner_id[0].ruc);
+            // Nombre o Razon Social
+            pdfDoc.rect(10, 87, 95, 7, 'S');
+            pdfDoc.text(12, 92,'Nombre o Razón Social: ' + AccountInvoice[0].partner_id[0].name);
+            // Telefono
+            pdfDoc.rect(105, 87, 95, 7, 'S');
+            pdfDoc.text(125, 92,'Teléfono: ' + self.valorNull(AccountInvoice[0].partner_id[0].phone));
+
+            // Direccion
+            pdfDoc.rect(10, 94, 95, 7, 'S');
+            pdfDoc.text(12, 98,'Direccion: ' + self.valorNull(AccountInvoice[0].partner_id[0].address));
+
+            // celular
+            pdfDoc.rect(105, 94, 95, 7, 'S');
+            pdfDoc.text(125, 98,'Celular: ' + self.valorNull(AccountInvoice[0].partner_id[0].mobile));
+
+            // Direccion
+            pdfDoc.rect(10, 101, 95, 7, 'S');
+            pdfDoc.text(12, 105,'Barrio: ' + self.valorNull(AccountInvoice[0].partner_id[0].barrio));
+
+            // celular
+            pdfDoc.rect(105, 101, 95, 7, 'S');
+            pdfDoc.text(125, 105,'Ciudad: ' + self.valorNull(AccountInvoice[0].partner_id[0].city));
+
+            // Direccion
+            pdfDoc.rect(10, 108, 95, 7, 'S');
+            pdfDoc.text(12, 112,'Estado Civil: ' + self.valorNull(AccountInvoice[0].partner_id[0].estado_civil));
+
+            // celular
+            pdfDoc.rect(105, 108, 95, 7, 'S');
+            pdfDoc.text(125, 112,'Email: ' + self.valorNull(AccountInvoice[0].partner_id[0].email));
+
+            var tipo;
+            if(AccountInvoice[0].partner_id[0].casa_propia == true){
+                   tipo = "Vivienda Propia";
+               }else{
+                   tipo = "Vivienda Alquilada";
+            }
+            // TIPO DE VIVIENDA
+            pdfDoc.rect(10, 115, 95, 7, 'S');
+            pdfDoc.text(12, 119,'Tipo de Vivienda: ' + self.valorNull(tipo));
+
+            // celular
+            pdfDoc.rect(105, 115, 95, 7, 'S');
+            // pdfDoc.text(125, 100,'Vivienda Alquilada: ' + self.valorNull(AccountInvoice[0].partner_id[0].casa_alquiler));
+
+            // Direccion
+            pdfDoc.rect(10, 122, 95, 7, 'S');
+            pdfDoc.text(12, 126,'Empresa o Lugar de Trabajo: ' + self.valorNull(AccountInvoice[0].partner_id[0].trab_empresa));
+
+            // celular
+            pdfDoc.rect(105, 122, 95, 7, 'S');
+            pdfDoc.text(125, 126,'Teléfono: ' + self.valorNull(AccountInvoice[0].partner_id[0].trab_telefono));
+
+            // Direccion
+            pdfDoc.rect(10, 129, 95, 7, 'S');
+            pdfDoc.text(12, 133,'Dirección: ' + self.valorNull(AccountInvoice[0].partner_id[0].trab_street));
+
+            // celular
+            pdfDoc.rect(105, 129, 95, 7, 'S');
+            pdfDoc.text(125, 133,'Ciudad: ' + self.valorNull(AccountInvoice[0].partner_id[0].trab_city));
+
+            // Direccion
+            pdfDoc.rect(10, 136, 95, 7, 'S');
+            pdfDoc.text(12, 140,'Cargo: ' + self.valorNull(AccountInvoice[0].partner_id[0].trab_cargo));
+
+            // celular
+            pdfDoc.rect(105, 136, 95, 7, 'S');
+            pdfDoc.text(125, 140,'Antiguedad: ' + self.valorNull(AccountInvoice[0].partner_id[0].trab_antiguedad_a) + ',' + self.valorNull(AccountInvoice[0].partner_id[0].trab_antiguedad_m));
+
+            // salario
+            pdfDoc.rect(10, 143, 95, 7, 'S');
+            pdfDoc.text(12, 147,'Salario: ' + self.valorNull(AccountInvoice[0].partner_id[0].trab_salario));
+
+            // ref
+            // pdfDoc.rect(105, 133, 95, 7, 'S');
+            // pdfDoc.text(125, 137,'Vivienda Alquilada: ' + self.valorNull(AccountInvoice[0].partner_id[0].casa_alquiler));
+
+            pdfDoc.setFontSize(8);
+            pdfDoc.setFontStyle('normal');
+            pdfDoc.text(12,160,'Referencias Comerciales:');
+
+            i=0;
+            _.each(AccountInvoice[0].partner_id[0].ref_comercial_ids,function(item){
+                pdfDoc.setFontSize(8);
+                pdfDoc.setFontStyle('normal');
+                pdfDoc.text(12+i,165, '' + item.name);
+                pdfDoc.text(55+i,165, '' + item.phone);
+                i=95;
+            });
+
+            pdfDoc.setFontSize(8);
+            pdfDoc.setFontStyle('normal');
+            pdfDoc.text(12,190,'Referencias Personales:');
+
+            i=0;
+            _.each(AccountInvoice[0].partner_id[0].ref_personal_ids,function(item){
+                pdfDoc.setFontSize(8);
+                pdfDoc.setFontStyle('normal');
+                pdfDoc.text(12+i,195, '- ' + item.email);
+                pdfDoc.text(30+i,195, '' + item.name);
+                pdfDoc.text(65+i,195, '' + item.phone);
+                i=95;
+
+            });
+
+
+            pdfDoc.addPage();
+            var monto_cuota;
+            var AccountInvoiceQuota;
+            var tot_cuota;
+            for (var i = 0; i < self.AccountInvoiceQuota.length; i++) {
+            // _.each(self.AccountInvoiceQuota, function(item){
+                // AccountInvoiceQuota = self.productProduct[i];
+                if (i==1) {
+                    AccountInvoiceQuota = self.AccountInvoiceQuota[i];
+                    monto_cuota=AccountInvoiceQuota.amount;
+                    tot_cuota=AccountInvoiceQuota.tot_cuota;
+                }
+                // x=x+1
+            }
+
+            pdfDoc.setFontSize(10);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.text(12,20,'Línea de crédito solicitado: '  + accounting.formatMoney(AccountInvoice[0].amount_total,CurrencyBase.symbol,CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator));
+
+            pdfDoc.setFontSize(10);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.text(115,20,'Condición de venta: ' + accounting.formatMoney(monto_cuota,CurrencyBase.symbol,CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator) + 'x' + tot_cuota);
+
+            pdfDoc.setFontSize(10);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.text(12,25,'Tipos de garantías: ' + self.valorNull(AccountInvoice[0].comment));
+
+
+            var self = this;
+            var AccountInvoice = self.AccountInvoice;
+            var CurrencyBase = self.AccountInvoice[0].currency_id[0];
+            var docItem = [];
+            var docQuotaItem = [];
+            var getColumns = [];
+            var getColumnsQuota = [];
+
+            var finalY = pdfDoc.autoTable.previous.finalY;
+            _.each(self.AccountInvoiceLine, function(item){
+                startY: finalY + 2,
+                docItem.push({
+                    name : item.name,
+                    quantity : item.quantity,
+                    price_unit : accounting.formatMoney(item.price_unit,'',CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                    price_subtotal : accounting.formatMoney(item.price_subtotal,'',CurrencyBase.decimal_places, CurrencyBase.thousands_separator, CurrencyBase.decimal_separator),
+                });
+            });
+
+            getColumns.push({
+                 title : 'Descripción',
+                 dataKey: 'name'
+            });
+
+            getColumns.push({
+                title : 'Cantidad',
+                dataKey: 'quantity'
+            });
+            getColumns.push({
+                title : 'Precio Unitario',
+                dataKey: 'price_unit'
+            });
+            getColumns.push({
+                title : 'Subtotal',
+                dataKey: 'price_subtotal'
+            });
+
+
+            pdfDoc.autoTable(getColumns, docItem, {
+                 theme: 'grid',
+                 styles: {
+                    overflow: 'linebreak',
+                    columnWidth: 'auto',
+                    fontSize: 7
+                },
+                headerStyles: {
+                    textColor: 20,
+                    fillColor: null,
+                    lineWidth: 0.1,
+                    fontSize: 9
+                },
+                columnStyles: {
+                     name : {columnWidth: 'auto'},
+                     quantity : {columnWidth: 30, halign:'right'},
+                     price_unit : {columnWidth: 30, halign:'right'},
+                     price_subtotal : {columnWidth: 30, halign:'right'},
+                 },
+
+                margin: { top: 28, horizontal: 10},
+            });
+
+            finalTABLE = pdfDoc.autoTable.previous.finalY;
+
+            pdfDoc.setFontSize(10);
+            pdfDoc.setFontStyle('normal');
+            var paragraph= "En ciertas condiciones de venta y bajo el criterio de la empresa, el cheque diferido  no se tomara como pago efectivo (no tendrá emisión de recibo) y se tomara como garantia de pago hasta su cobro efectivo con la respectiva emisión del recibo de pago.";
+            pdfDoc.text(paragraph,12,finalTABLE+5,{maxWidth:188,align:'justify'});
+
+            var paragraph= "Por el presente instrumento le(s) autorizo(amos) de forma expresa e irrevocable, otorgando suficiente mandato en los términos de los Art. 917 inc. A del Código Civil Paraguayo, para que por propia cuenta o a través empresas especializadas de nuestro medio, puedan recabar información en plaza referente a mi(nuestra) situación patrimonial solvencia económica, o el cumplimiento de nuestras obligaciones comerciales, así como también a la verificación confirmación y/o certificación de los datos por mi(nosotros) proveídos a fin de que puedan contar con los elementos de juicio y análisis necesarios para la concesión del crédito que me(nos) encuentro(amos) gestionando ante LA EMPRESA  Cemobo. De igual manera, en los mismos términos le(s) autorizo(amos) para que en caso de un atraso superior a los 90 días en el pago del presente crédito o de cualquier otra deuda pendiente que mantenga(mos) con esa empresa, incluyan mi(nuestro) nombre personal o Razón Social que represento(amos) en en Registro General de Morosos de INFORMCONF o de cualquier otra entidad encargada para tales efectos, como así también, proporcionar esa información a terceros interesados. La eliminación de dicho registro se realizará de acuerdo a los términos establecidos en la Ley 1.682 y sus modificaciones. De igual manera reconozco(emos) y acepto(amos) que la EMPRESA  Cemobo podrá ceder sus derechos derivados del presente contrato y de los pagares de la deuda ya sea mediante una cesión de derechos o venta de cartera o cualquier otra forma permitida por la ley a lo que presto(amos) desde ahora y por le presente documento consentimiento expreso e irrevocable a dichas cesiones y transferencias incluyendo las correspondientes garantías que se pudieren haber constituido a favor de LA EMPRESA, en respaldo de las obligaciones. LA EMPRESA Cemobo puede transferir a terceros, de manera total o parcial, sus derechos y obligaciones emergentes del Contrato.";
+            pdfDoc.text(paragraph,12,finalTABLE + 18,{maxWidth:188,align:'justify'});
+
+            pdfDoc.setFontSize(10);
+            pdfDoc.setFontStyle('bold');
+            pdfDoc.text(12,finalTABLE + 100,'PLANO DE UBICACIÓN DEL NEGOCIO/DOMICILIO:');
+
+            // ref
+            pdfDoc.rect(12, finalTABLE + 105, 15, 15, 'S');
+
+            // ref
+            pdfDoc.rect(35, finalTABLE + 105, 15, 15, 'S');
+
+            // ref
+            pdfDoc.rect(58, finalTABLE + 105, 15, 15, 'S');
+
+            // ref
+            pdfDoc.rect(118, finalTABLE + 105, 15, 15, 'S');
+
+            // ref
+            pdfDoc.rect(141, finalTABLE + 105, 15, 15, 'S');
+
+            // ref
+            pdfDoc.rect(164, finalTABLE + 105, 15, 15, 'S');
+
+            // ref
+            pdfDoc.rect(12, finalTABLE + 125, 15, 15, 'S');
+            //
+            // // ref
+            pdfDoc.rect(35, finalTABLE + 125, 15, 15, 'S');
+            //
+            // // ref
+            pdfDoc.rect(58, finalTABLE + 125, 15, 15, 'S');
+            //
+            //
+            // ref
+            pdfDoc.rect(118, finalTABLE + 125, 15, 15, 'S');
+            //
+            // ref
+            pdfDoc.rect(141, finalTABLE + 125, 15, 15, 'S');
+            //
+            // ref
+            pdfDoc.rect(164, finalTABLE + 125, 15, 15, 'S');
+            //
+            // ref
+            pdfDoc.rect(12, finalTABLE + 145, 15, 15, 'S');
+
+            // ref
+            pdfDoc.rect(35, finalTABLE + 145, 15, 15, 'S');
+            //
+            // ref
+            pdfDoc.rect(58, finalTABLE + 145, 15, 15, 'S');
+
+            // ref
+            pdfDoc.rect(118, finalTABLE + 145, 15, 15, 'S');
+            //
+            // ref
+            pdfDoc.rect(141, finalTABLE + 145, 15, 15, 'S');
+            //
+            // ref
+            pdfDoc.rect(164, finalTABLE + 145, 15, 15, 'S');
+
+
+
+               pdfDoc.addPage();
+               finalTABLE = pdfDoc.autoTable.previous.finalY;
+
+               pdfDoc.setFontSize(9);
+               pdfDoc.setFontStyle('bold');
+               var paragraph="Declaramos que los datos consignados en esta solicitud de CEMOBO; son fiel reflejo de nuestra situación.";
+               pdfDoc.text(paragraph,12, 15,{maxWidth:188,align:'justify'});
+
+               pdfDoc.setFontSize(9);
+               pdfDoc.setFontStyle('normal');
+               pdfDoc.setTextColor(40);
+               pdfDoc.text(12,25,'Firma del Solicitante: _ _ _ _ _ _ _ _ _ _ _ _ _');
+
+               pdfDoc.setFontSize(9);
+               pdfDoc.setFontStyle('normal');
+               pdfDoc.setTextColor(40);
+               pdfDoc.text(12,35,'Aclaración de Firma y N° de C.I.N°: _ _ _ _ _ _ _ _ _ _ _ _');
+
+               pdfDoc.setFontSize(9);
+               pdfDoc.setFontStyle('normal');
+               pdfDoc.setTextColor(40);
+               pdfDoc.text(12,45,'Sello de la Empresa:');
+
+
+
+            pdfDoc.save('pagare.pdf');
+        },
+    });
+    if (instance.web && instance.web.FormView) {
+        instance.web.FormView.include({
+            load_form: function (record) {
+                this._super.apply(this, arguments);
+                if (this.model !== 'account.invoice') return;
+                local.parentInstance = this;
+                if (local.widgetInstance) {
+                    local.widgetInstance.updateId(record.id);
+                }
+                local.widgetInstance = new local.PagareCemoboWidget(this);
+                var elemento = this.$el.find('.oe_form').find('.pagare_button_box');
+                local.widgetInstance.appendTo(elemento);
+                local.widgetInstance.updateId(record.id);
+            }
+        });
+    }
+};

+ 8 - 0
static/src/xml/main.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="pagare_cemobo.PagareCemobo">
+        <button class="print_pagare_cemobo oe_button oe_form_button oe_highlight">
+            <div> Imprimir Pagare</div>
+        </button>
+    </t>
+</template>

+ 18 - 0
views/account_invoice_view.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+	<data>
+        <record model="ir.ui.view" id="account_invoice_button">
+            <field name="name">account.invoice.button</field>
+            <field name="model">account.invoice</field>
+            <field name="inherit_id" ref="account.invoice_form"/>
+            <field name="arch" type="xml">
+				<xpath expr="//button[@name='invoice_print']" position="replace">
+					<div class="pagare_button_box" attrs="{'invisible': [('state','not in',['open','paid'])]}"></div>
+				</xpath>
+				<xpath expr="//button[@name='action_invoice_sent']" position="attributes">
+					<attribute name="invisible">1</attribute>
+				</xpath>
+            </field>
+        </record>
+	</data>
+</openerp>

+ 10 - 0
views/template.xml

@@ -0,0 +1,10 @@
+<openerp>
+    <data>
+        <template id="pagare_cemobo.assets_backend" name="pagare_cemobo_assets" inherit_id="eiru_assets.assets">
+            <xpath expr="." position="inside">
+                <link rel="stylesheet" href="/pagare_cemobo/static/src/css/style.css"/>
+                <script type="text/javascript" src="/pagare_cemobo/static/src/js/main.js"/>
+            </xpath>
+        </template>
+    </data>
+</openerp>

部分文件因文件數量過多而無法顯示