|
@@ -0,0 +1,906 @@
|
|
|
+openerp.workorder_printbioelectric = function (instance, local) {
|
|
|
+ local.widgetInstance = null;
|
|
|
+ local.parentInstance = null;
|
|
|
+
|
|
|
+ local.WorkOrderbioelectricWidget = instance.Widget.extend({
|
|
|
+ template : "workorder_printbioelectric.WorkOrderbioelectric",
|
|
|
+ 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.fecthRepairWorkorder(id).then(function(RepairWorkorder){
|
|
|
+ return RepairWorkorder;
|
|
|
+ }).then(function(RepairWorkorder){
|
|
|
+ self.RepairWorkorder = RepairWorkorder;
|
|
|
+ return self.fecthRepairWorkorderLine();
|
|
|
+ }).then(function(RepairWorkorderLine){
|
|
|
+ self.RepairWorkorderLine = RepairWorkorderLine;
|
|
|
+ return self.fecthRepairPedidosorderLine();
|
|
|
+ }).then(function(RepairPedidosorderLine){
|
|
|
+ self.RepairPedidosorderLine = RepairPedidosorderLine;
|
|
|
+ return self.fecthRepairResumenorderLine();
|
|
|
+ }).then(function(RepairResumenorderLine){
|
|
|
+ self.RepairResumenorderLine = RepairResumenorderLine;
|
|
|
+ return self.fecthRepairCalidadorderLine();
|
|
|
+ }).then(function(RepairCalidadorderLine){
|
|
|
+ self.RepairCalidadorderLine = RepairCalidadorderLine;
|
|
|
+ return self.fecthRepairSugerenciaorderLine();
|
|
|
+ }).then(function(RepairSugerenciaorderLine){
|
|
|
+ self.RepairSugerenciaorderLine = RepairSugerenciaorderLine;
|
|
|
+ return self.fecthRepairProblemasorderLine();
|
|
|
+ }).then(function(RepairProblemasorderLine){
|
|
|
+ self.RepairProblemasorderLine = RepairProblemasorderLine;
|
|
|
+ return self.fetchRepairWorkorderConsumed();
|
|
|
+ }).then(function(RepairWorkorderConsumed){
|
|
|
+ self.RepairWorkorderConsumed = RepairWorkorderConsumed;
|
|
|
+ return self.drawPDF();
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ },
|
|
|
+
|
|
|
+ fecthRepairWorkorder: function(id){
|
|
|
+ var domain=[['id','=', id]];
|
|
|
+ var RepairWorkorder = new instance.web.Model('repair.workorderimproved');
|
|
|
+ return RepairWorkorder.call('getRepairWorkorder',[domain], {
|
|
|
+ context: new instance.web.CompoundContext()
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ fecthRepairWorkorderLine: function () {
|
|
|
+ var self = this;
|
|
|
+ var workorder_ids = _.flatten(_.map(self.RepairWorkorder,function(map){
|
|
|
+ return map.id;
|
|
|
+ }));
|
|
|
+ var domain=[['workorder_id','in',workorder_ids]];
|
|
|
+ var RepairWorkorderLine = new instance.web.Model('repair.workorderimproved.line');
|
|
|
+ return RepairWorkorderLine.call('getRepairWorkorderLine',[domain], {
|
|
|
+ context: new instance.web.CompoundContext()
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ fecthRepairPedidosorderLine: function () {
|
|
|
+ var self = this;
|
|
|
+ var workorder_ids = _.flatten(_.map(self.RepairWorkorder,function(map){
|
|
|
+ return map.id;
|
|
|
+ }));
|
|
|
+ var domain=[['workorder_id','in',workorder_ids]];
|
|
|
+ var RepairPedidosorderLine = new instance.web.Model('repair.pedidosorderimproved.line');
|
|
|
+ return RepairPedidosorderLine.call('getRepairPedidosorderLine',[domain], {
|
|
|
+ context: new instance.web.CompoundContext()
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ fecthRepairResumenorderLine: function () {
|
|
|
+ var self = this;
|
|
|
+ var workorder_ids = _.flatten(_.map(self.RepairWorkorder,function(map){
|
|
|
+ return map.id;
|
|
|
+ }));
|
|
|
+ var domain=[['workorder_id','in',workorder_ids]];
|
|
|
+ var RepairResumenorderLine = new instance.web.Model('repair.resumenorderimproved.line');
|
|
|
+ return RepairResumenorderLine.call('getRepairResumenorderLine',[domain], {
|
|
|
+ context: new instance.web.CompoundContext()
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ fecthRepairCalidadorderLine: function () {
|
|
|
+ var self = this;
|
|
|
+ var workorder_ids = _.flatten(_.map(self.RepairWorkorder,function(map){
|
|
|
+ return map.id;
|
|
|
+ }));
|
|
|
+ var domain=[['workorder_id','in',workorder_ids]];
|
|
|
+ var RepairCalidadorderLine = new instance.web.Model('repair.calidadorderimproved.line');
|
|
|
+ return RepairCalidadorderLine.call('getRepairCalidadorderLine',[domain], {
|
|
|
+ context: new instance.web.CompoundContext()
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ fecthRepairSugerenciaorderLine: function () {
|
|
|
+ var self = this;
|
|
|
+ var workorder_ids = _.flatten(_.map(self.RepairWorkorder,function(map){
|
|
|
+ return map.id;
|
|
|
+ }));
|
|
|
+ var domain=[['workorder_id','in',workorder_ids]];
|
|
|
+ var RepairSugerenciaorderLine = new instance.web.Model('repair.sugerenciaorderimproved.line');
|
|
|
+ return RepairSugerenciaorderLine.call('getRepairSugerenciaorderLine',[domain], {
|
|
|
+ context: new instance.web.CompoundContext()
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ fecthRepairProblemasorderLine: function () {
|
|
|
+ var self = this;
|
|
|
+ var workorder_ids = _.flatten(_.map(self.RepairWorkorder,function(map){
|
|
|
+ return map.id;
|
|
|
+ }));
|
|
|
+ var domain=[['workorder_id','in',workorder_ids]];
|
|
|
+ var RepairProblemasorderLine = new instance.web.Model('repair.problemasorderimproved.line');
|
|
|
+ return RepairProblemasorderLine.call('getRepairProblemasorderLine',[domain], {
|
|
|
+ context: new instance.web.CompoundContext()
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ fetchRepairWorkorderConsumed: function () {
|
|
|
+ var self = this;
|
|
|
+ var workorder_ids = _.flatten(_.map(self.RepairWorkorder,function(map){
|
|
|
+ return map.id;
|
|
|
+ }));
|
|
|
+ var domain=[['workorder_id','in',workorder_ids]];
|
|
|
+ var RepairWorkorderConsumed = new instance.web.Model('repair.workorderimproved.consumed');
|
|
|
+ return RepairWorkorderConsumed.call('getRepairWorkorderConsumed',[domain], {
|
|
|
+ context: new instance.web.CompoundContext()
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ drawPDF:function(){
|
|
|
+ var self = this;
|
|
|
+ var doc = self.RepairWorkorder.shift();
|
|
|
+
|
|
|
+ var docItem = [];
|
|
|
+ var docWorkItem = [];
|
|
|
+ var getColumns = [];
|
|
|
+ var getColumns1 = [];
|
|
|
+ var getColumnsMaterial = [];
|
|
|
+ var docWorkItem1 = [];
|
|
|
+ var docWorkItem2 = [];
|
|
|
+ var docWorkItem4 = [];
|
|
|
+ var docWorkItem5 = [];
|
|
|
+ var docWorkItem6 = [];
|
|
|
+ var docWorkItem7 = [];
|
|
|
+ var docWorkItem8 = [];
|
|
|
+ var getColumnsMaterial1 = [];
|
|
|
+ var getColumnsMaterial2 = [];
|
|
|
+ var getColumnsMaterial4 = [];
|
|
|
+ var getColumnsMaterial5 = [];
|
|
|
+ var getColumnsMaterial6 = [];
|
|
|
+ var getColumnsMaterial7 = [];
|
|
|
+ var getColumnsMaterial8 = [];
|
|
|
+
|
|
|
+ var pdfDoc = new jsPDF();
|
|
|
+ pdfDoc.addImage("data:image/png;base64," + doc.company_logo, 'PNG',12,5,45,15);
|
|
|
+
|
|
|
+
|
|
|
+ /*
|
|
|
+ =============================================================
|
|
|
+ OBTENER LINEAS DEL PEDIDO INICIAL
|
|
|
+ =============================================================
|
|
|
+ */
|
|
|
+ var RepairWorkorderLine = self.RepairWorkorderLine;
|
|
|
+ for (var i = 0; i < RepairWorkorderLine.length; i++) {
|
|
|
+ docItem.push({
|
|
|
+ xnumber : i + 1,
|
|
|
+ product : RepairWorkorderLine[i].description,
|
|
|
+ brand : RepairWorkorderLine[i].brand,
|
|
|
+ number : RepairWorkorderLine[i].number
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ getColumns.push({
|
|
|
+ title : 'A',
|
|
|
+ dataKey: 'xnumber',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+
|
|
|
+ getColumns.push({
|
|
|
+ title : 'Pedido inicial del cliente L: logrado EP: en proceso P: pendiente',
|
|
|
+ dataKey: 'product',
|
|
|
+ align: 'left',
|
|
|
+ });
|
|
|
+ getColumns.push({
|
|
|
+ title : 'Cant.',
|
|
|
+ dataKey: 'brand',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ getColumns.push({
|
|
|
+ title : 'Estado',
|
|
|
+ dataKey: 'number',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ var RepairProblemasorderLine = self.RepairProblemasorderLine;
|
|
|
+ if(RepairProblemasorderLine.length > 0){
|
|
|
+ for (var i = 0; i < RepairProblemasorderLine.length; i++) {
|
|
|
+ docWorkItem.push({
|
|
|
+ xnumber : i + 1,
|
|
|
+ description : RepairProblemasorderLine[i].description
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ getColumnsMaterial.push({
|
|
|
+ title : 'B',
|
|
|
+ dataKey: 'xnumber',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ getColumnsMaterial.push({
|
|
|
+ title : 'Problemas o sintomas encontrados',
|
|
|
+ dataKey: 'description',
|
|
|
+ align: 'left',
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ docWorkItem.push({
|
|
|
+ xnumber : '-',
|
|
|
+ description : '-'
|
|
|
+ });
|
|
|
+ getColumnsMaterial.push({
|
|
|
+ title : 'B',
|
|
|
+ dataKey: 'xnumber',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ getColumnsMaterial.push({
|
|
|
+ title : 'Problemas o sintomas encontrados',
|
|
|
+ dataKey: 'description',
|
|
|
+ align: 'left',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ var RepairPedidosorderLine = self.RepairPedidosorderLine;
|
|
|
+ if(RepairPedidosorderLine.length > 0){
|
|
|
+ for (var x = 0; x < RepairPedidosorderLine.length; x++) {
|
|
|
+ docWorkItem1.push({
|
|
|
+ xnumber : x+1,
|
|
|
+ description : RepairPedidosorderLine[x].description,
|
|
|
+ brand : RepairPedidosorderLine[x].brand,
|
|
|
+ number : RepairPedidosorderLine[x].number
|
|
|
+ });
|
|
|
+ }
|
|
|
+ getColumnsMaterial1.push({
|
|
|
+ title : 'C',
|
|
|
+ dataKey: 'xnumber',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ getColumnsMaterial1.push({
|
|
|
+ title : 'Pedido adicional para servicio extra L: logrado EP: en proceso P: pendiente',
|
|
|
+ dataKey: 'description',
|
|
|
+ align: 'left',
|
|
|
+ });
|
|
|
+ getColumnsMaterial1.push({
|
|
|
+ title : 'Cant.',
|
|
|
+ dataKey: 'quantity',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ getColumnsMaterial1.push({
|
|
|
+ title : 'Estado',
|
|
|
+ dataKey: 'number',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ docWorkItem1.push({
|
|
|
+ xnumber : '-',
|
|
|
+ description : '-',
|
|
|
+ quantity : '-',
|
|
|
+ number : '-'
|
|
|
+ });
|
|
|
+ getColumnsMaterial1.push({
|
|
|
+ title : 'C',
|
|
|
+ dataKey: 'xnumber',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ getColumnsMaterial1.push({
|
|
|
+ title : 'Pedido adicional para servicio extra L: logrado EP: en proceso P: pendiente',
|
|
|
+ dataKey: 'description',
|
|
|
+ align: 'left',
|
|
|
+ });
|
|
|
+ getColumnsMaterial1.push({
|
|
|
+ title : 'Cant.',
|
|
|
+ dataKey: 'quantity',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ getColumnsMaterial1.push({
|
|
|
+ title : 'Estado',
|
|
|
+ dataKey: 'number',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ var RepairWorkorderConsumed = self.RepairWorkorderConsumed;
|
|
|
+ if(RepairWorkorderConsumed.length > 0){
|
|
|
+ for (var r = 0; r < RepairWorkorderConsumed.length; r++) {
|
|
|
+ docWorkItem5.push({
|
|
|
+ xnumber : r+1,
|
|
|
+ description : RepairWorkorderConsumed[r].description
|
|
|
+ });
|
|
|
+ }
|
|
|
+ getColumnsMaterial5.push({
|
|
|
+ title : 'D',
|
|
|
+ dataKey: 'xnumber',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ getColumnsMaterial5.push({
|
|
|
+ title : 'Lista de materiales proveidos por Bioelectric',
|
|
|
+ dataKey: 'description',
|
|
|
+ align: 'left',
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ docWorkItem5.push({
|
|
|
+ xnumber : '-',
|
|
|
+ description : '-'
|
|
|
+ });
|
|
|
+ getColumnsMaterial5.push({
|
|
|
+ title : 'D',
|
|
|
+ dataKey: 'xnumber',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ getColumnsMaterial5.push({
|
|
|
+ title : 'Lista de materiales proveidos por Bioelectric',
|
|
|
+ dataKey: 'description',
|
|
|
+ align: 'left',
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ var RepairCalidadorderLine = self.RepairCalidadorderLine;
|
|
|
+ if(RepairCalidadorderLine.length > 0){
|
|
|
+ for (var y = 0; y < RepairCalidadorderLine.length; y++) {
|
|
|
+ docWorkItem2.push({
|
|
|
+ xnumber : y+1,
|
|
|
+ description : RepairCalidadorderLine[y].description,
|
|
|
+ quantity : RepairCalidadorderLine[y].quantity,
|
|
|
+ number : RepairCalidadorderLine[y].number
|
|
|
+ });
|
|
|
+ }
|
|
|
+ getColumnsMaterial2.push({
|
|
|
+ title : 'E',
|
|
|
+ dataKey: 'xnumber',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ getColumnsMaterial2.push({
|
|
|
+ title : 'Ensayos y control de calidad realizados a los trabajos o equipos entregados al cliente',
|
|
|
+ dataKey: 'description',
|
|
|
+ align: 'left',
|
|
|
+ });
|
|
|
+ getColumnsMaterial2.push({
|
|
|
+ title : 'Ficha',
|
|
|
+ dataKey: 'quantity',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ getColumnsMaterial2.push({
|
|
|
+ title : 'Lacre',
|
|
|
+ dataKey: 'number',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ docWorkItem2.push({
|
|
|
+ xnumber : '-',
|
|
|
+ description : '-',
|
|
|
+ quantity : '-',
|
|
|
+ number : '-'
|
|
|
+ });
|
|
|
+ getColumnsMaterial2.push({
|
|
|
+ title : 'E',
|
|
|
+ dataKey: 'xnumber',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ getColumnsMaterial2.push({
|
|
|
+ title : 'Ensayos y control de calidad realizados a los trabajos o equipos entregados al cliente',
|
|
|
+ dataKey: 'description',
|
|
|
+ align: 'left',
|
|
|
+ });
|
|
|
+ getColumnsMaterial2.push({
|
|
|
+ title : 'Ficha',
|
|
|
+ dataKey: 'quantity',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ getColumnsMaterial2.push({
|
|
|
+ title : 'Lacre',
|
|
|
+ dataKey: 'number',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ var RepairResumenorderLine = self.RepairResumenorderLine;
|
|
|
+ if(RepairResumenorderLine.length > 0){
|
|
|
+ for (var t = 0; t < RepairResumenorderLine.length; t++) {
|
|
|
+ docWorkItem7.push({
|
|
|
+ xnumber : t+1,
|
|
|
+ description : RepairResumenorderLine[t].description
|
|
|
+ });
|
|
|
+ }
|
|
|
+ getColumnsMaterial7.push({
|
|
|
+ title : 'F',
|
|
|
+ dataKey: 'xnumber',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ getColumnsMaterial7.push({
|
|
|
+ title : 'Estado final de equipos y sistemas entregados al cliente luego de terminar los trabajos',
|
|
|
+ dataKey: 'description',
|
|
|
+ align: 'left',
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ docWorkItem7.push({
|
|
|
+ xnumber : '-',
|
|
|
+ description : '-'
|
|
|
+ });
|
|
|
+ getColumnsMaterial7.push({
|
|
|
+ title : 'F',
|
|
|
+ dataKey: 'xnumber',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ getColumnsMaterial7.push({
|
|
|
+ title : 'Estado final de equipos y sistemas entregados al cliente luego de terminar los trabajos',
|
|
|
+ dataKey: 'description',
|
|
|
+ align: 'left',
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ var RepairSugerenciaorderLine = self.RepairSugerenciaorderLine;
|
|
|
+ if(RepairSugerenciaorderLine.length > 0){
|
|
|
+ for (var z = 0; z < RepairSugerenciaorderLine.length; z++) {
|
|
|
+ docWorkItem8.push({
|
|
|
+ xnumber : z+1,
|
|
|
+ description : RepairSugerenciaorderLine[z].description
|
|
|
+ });
|
|
|
+ }
|
|
|
+ getColumnsMaterial8.push({
|
|
|
+ title : 'G',
|
|
|
+ dataKey: 'xnumber',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ getColumnsMaterial8.push({
|
|
|
+ title : 'Sugerencias y pendientes',
|
|
|
+ dataKey: 'description',
|
|
|
+ align: 'left',
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ docWorkItem8.push({
|
|
|
+ xnumber : '-',
|
|
|
+ description : '-'
|
|
|
+ });
|
|
|
+ getColumnsMaterial8.push({
|
|
|
+ title : 'G',
|
|
|
+ dataKey: 'xnumber',
|
|
|
+ align: 'center',
|
|
|
+ });
|
|
|
+ getColumnsMaterial8.push({
|
|
|
+ title : 'Sugerencias y pendientes',
|
|
|
+ dataKey: 'description',
|
|
|
+ align: 'left',
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ pdfDoc.autoTable(getColumns, docItem, {
|
|
|
+ theme: 'grid',
|
|
|
+ styles: {
|
|
|
+ overflow: 'linebreak',
|
|
|
+ columnWidth: 'auto',
|
|
|
+ fontSize: 7,
|
|
|
+
|
|
|
+ },
|
|
|
+ headerStyles: {
|
|
|
+ fillColor: [255, 255, 255],
|
|
|
+ borderColor: [150, 152, 154],
|
|
|
+ color: 'black',
|
|
|
+ fontStyle: 'bold',
|
|
|
+ textColor: [0, 0, 0],
|
|
|
+ fontSize: 9
|
|
|
+ },
|
|
|
+ columnStyles: {
|
|
|
+ xnumber : {halign:'center',columnWidth: '4px'},
|
|
|
+ product : {columnWidth: '8px',fontStyle: 'bold'},
|
|
|
+ brand : {halign:'center', columnWidth: '8px'},
|
|
|
+ number : {halign:'center',columnWidth: '8px'},
|
|
|
+ },
|
|
|
+ margin: { top: 60, horizontal: 12},
|
|
|
+
|
|
|
+
|
|
|
+ addPageContent: function (data) {
|
|
|
+
|
|
|
+ /*
|
|
|
+ ====================================================================
|
|
|
+ CABECERA
|
|
|
+ ====================================================================
|
|
|
+ */
|
|
|
+
|
|
|
+ // pdfDoc.setFontSize(8);
|
|
|
+ // pdfDoc.setFontStyle('bold');
|
|
|
+ // pdfDoc.setTextColor(40);
|
|
|
+ // pdfDoc.text(14,26,doc.company_address);
|
|
|
+ //
|
|
|
+ // pdfDoc.setFontSize(8);
|
|
|
+ // pdfDoc.setFontStyle('bold');
|
|
|
+ // pdfDoc.setTextColor(40);
|
|
|
+ // pdfDoc.text(14,30,'Cel.: ' + doc.company_phone);
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(14);
|
|
|
+ pdfDoc.setFontStyle('bold');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(105,10,'INFORME TÉCNICO DE TRABAJO');
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(12);
|
|
|
+ pdfDoc.setFontStyle('normal');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(125,23, doc.vat);
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(13);
|
|
|
+ pdfDoc.setFontStyle('bold');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(130,17,'Nº ' + doc.name);
|
|
|
+
|
|
|
+ pdfDoc.setDrawColor('150', '152', '154');
|
|
|
+ pdfDoc.rect(13, 25, pdfDoc.internal.pageSize.getWidth() - 26 , 26, 'S');
|
|
|
+
|
|
|
+ /*
|
|
|
+ ====================================================================
|
|
|
+ PRIMERA SECCION
|
|
|
+ ====================================================================
|
|
|
+ */
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('bold');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(14,32,'Fecha: ' + moment(doc.order_date).format('DD/MM/YYYY'));
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('bold');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(47,32,'Cliente: ');
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('normal');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(61,32, doc.partner_name);
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('bold');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(149,32,'R.U.C. N°: ');
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('normal');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(168,32, doc.partner_ruc);
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('bold');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(14,37,'Presupuesto: ');
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('bold');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(49,37,'Obra: ');
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(9);
|
|
|
+ pdfDoc.setFontStyle('normal');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(60,37,self.valorNull(doc.name_obra));
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('bold');
|
|
|
+ pdfDoc.setTextColor(10);
|
|
|
+ pdfDoc.text(151,37,'Inicio: ' );
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('normal');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ var fecha = moment(doc.planned_start_date).subtract(4, 'hours').format('DD/MM/YYYY HH:mm');
|
|
|
+ pdfDoc.text(166, 37, fecha);
|
|
|
+
|
|
|
+
|
|
|
+ // pdfDoc.text(166,37, moment(doc.planned_start_date).format('DD/MM/YYYY hh:mm'));
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('bold');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(14,42,'Factura N°: ');
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('normal');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(33,42,self.valorNull(doc.nro_factura));
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('bold');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(75,42,'Pedido por: ');
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('normal');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(95,42, doc.contacto_obra);
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('bold');
|
|
|
+ pdfDoc.setTextColor(10);
|
|
|
+ pdfDoc.text(151,42,'Fin: ');
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('normal');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ var end_fecha = moment(doc.planned_end_date).subtract(4, 'hours').format('DD/MM/YYYY HH:mm');
|
|
|
+ pdfDoc.text(166, 42, end_fecha);
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('bold');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(14,47,'Local: ');
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('normal');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(29,47,self.valorNull(doc.name_local));
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('bold');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(75,47,'Técnico: ');
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('normal');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(90,47, doc.responsable);
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('bold');
|
|
|
+ pdfDoc.setTextColor(10);
|
|
|
+ pdfDoc.text(151,47,'Móvil: ');
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(10);
|
|
|
+ pdfDoc.setFontStyle('normal');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(168,47, doc.movil);
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(12);
|
|
|
+ pdfDoc.setFontStyle('bold');
|
|
|
+ pdfDoc.setTextColor(40);
|
|
|
+ pdfDoc.text(77,58,'DETALLES DE ASISTENCIA');
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ /*
|
|
|
+ =============================================================
|
|
|
+ Problemas o sintomas encontrados
|
|
|
+ =============================================================
|
|
|
+ */
|
|
|
+ var finalY = pdfDoc.autoTable.previous.finalY;
|
|
|
+ pdfDoc.autoTable(getColumnsMaterial, docWorkItem, {
|
|
|
+ theme: 'grid',
|
|
|
+ startY: finalY + 3,
|
|
|
+ styles: {
|
|
|
+ overflow: 'linebreak',
|
|
|
+ columnWidth: 'auto',
|
|
|
+ fontSize: 8,
|
|
|
+
|
|
|
+ },
|
|
|
+ headerStyles: {
|
|
|
+ fillColor: [255, 255, 255],
|
|
|
+ borderColor: [150, 152, 154],
|
|
|
+ fontSize: 9,
|
|
|
+ textColor: [0, 0, 0]
|
|
|
+ },
|
|
|
+ columnStyles: {
|
|
|
+ xnmumber : {columnWidth: '4px',halign: 'center'},
|
|
|
+ description: {columnWidth: '8px', halign: 'left'},
|
|
|
+ quantity : {columnWidth: '8px', halign: 'center'},
|
|
|
+ number : {columnWidth: '8px', halign: 'center'},
|
|
|
+ },
|
|
|
+ margin: {horizontal: 12},
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ /*
|
|
|
+ =============================================================
|
|
|
+ Pedido adicional para servicio extra
|
|
|
+ =============================================================
|
|
|
+ */
|
|
|
+ var finalY = pdfDoc.autoTable.previous.finalY;
|
|
|
+ pdfDoc.autoTable(getColumnsMaterial1, docWorkItem1, {
|
|
|
+ theme: 'grid',
|
|
|
+ startY: finalY + 3,
|
|
|
+ styles: {
|
|
|
+ overflow: 'linebreak',
|
|
|
+ columnWidth: 'auto',
|
|
|
+ fontSize: 8,
|
|
|
+
|
|
|
+ },
|
|
|
+ headerStyles: {
|
|
|
+ fillColor: [255, 255, 255],
|
|
|
+ borderColor: [150, 152, 154],
|
|
|
+ fontSize: 9,
|
|
|
+ textColor: [0, 0, 0]
|
|
|
+ },
|
|
|
+ columnStyles: {
|
|
|
+ xnmumber : {columnWidth: '4px',halign: 'center'},
|
|
|
+ description: {columnWidth: '24px', halign: 'left'},
|
|
|
+ },
|
|
|
+ margin: {horizontal: 12},
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /*
|
|
|
+ =============================================================
|
|
|
+ Lista de materiales proveidos por Bioelectric
|
|
|
+ =============================================================
|
|
|
+ */
|
|
|
+ var finalY = pdfDoc.autoTable.previous.finalY;
|
|
|
+ pdfDoc.autoTable(getColumnsMaterial5, docWorkItem5, {
|
|
|
+ theme: 'grid',
|
|
|
+ startY: finalY + 3,
|
|
|
+ styles: {
|
|
|
+ overflow: 'linebreak',
|
|
|
+ columnWidth: 'auto',
|
|
|
+ fontSize: 8,
|
|
|
+
|
|
|
+ },
|
|
|
+ headerStyles: {
|
|
|
+ fillColor: [255, 255, 255],
|
|
|
+ borderColor: [150, 152, 154],
|
|
|
+ fontSize: 9,
|
|
|
+ textColor: [0, 0, 0]
|
|
|
+ },
|
|
|
+ columnStyles: {
|
|
|
+ xnmumber : {columnWidth: '4px',halign: 'center'},
|
|
|
+ description: {columnWidth: '24px', halign: 'left'},
|
|
|
+ },
|
|
|
+ margin: {horizontal: 12},
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ /*
|
|
|
+ =============================================================
|
|
|
+ Ensayos y control de calidad realizados a los trabajos o equipos entregados al cliente
|
|
|
+ =============================================================
|
|
|
+ */
|
|
|
+ var finalY = pdfDoc.autoTable.previous.finalY;
|
|
|
+ pdfDoc.autoTable(getColumnsMaterial2, docWorkItem2, {
|
|
|
+ theme: 'grid',
|
|
|
+ startY: finalY + 3,
|
|
|
+ styles: {
|
|
|
+ overflow: 'linebreak',
|
|
|
+ columnWidth: 'auto',
|
|
|
+ fontSize: 8,
|
|
|
+
|
|
|
+ },
|
|
|
+ headerStyles: {
|
|
|
+ fillColor: [255, 255, 255],
|
|
|
+ borderColor: [150, 152, 154],
|
|
|
+ fontSize: 9,
|
|
|
+ textColor: [0, 0, 0]
|
|
|
+ },
|
|
|
+ columnStyles: {
|
|
|
+ xnmumber : {columnWidth: '4px',halign: 'center'},
|
|
|
+ description: {columnWidth: '24px', halign: 'left'},
|
|
|
+ },
|
|
|
+ margin: {horizontal: 12},
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ /*
|
|
|
+ =============================================================
|
|
|
+ Estado final de equipos y sistemas entregados al cliente luego de terminar los trabajos
|
|
|
+ =============================================================
|
|
|
+ */
|
|
|
+ var finalY = pdfDoc.autoTable.previous.finalY;
|
|
|
+ pdfDoc.autoTable(getColumnsMaterial7, docWorkItem7, {
|
|
|
+ theme: 'grid',
|
|
|
+ startY: finalY + 3,
|
|
|
+ styles: {
|
|
|
+ overflow: 'linebreak',
|
|
|
+ columnWidth: 'auto',
|
|
|
+ fontSize: 8,
|
|
|
+
|
|
|
+ },
|
|
|
+ headerStyles: {
|
|
|
+ fillColor: [255, 255, 255],
|
|
|
+ borderColor: [150, 152, 154],
|
|
|
+ fontSize: 9,
|
|
|
+ textColor: [0, 0, 0]
|
|
|
+ },
|
|
|
+ columnStyles: {
|
|
|
+ xnmumber : {columnWidth: '4px', halign: 'center'},
|
|
|
+ description: {columnWidth: '8px', halign: 'left'},
|
|
|
+ quantity : {columnWidth: '8px', halign: 'center'},
|
|
|
+ number : {columnWidth: '8px', halign: 'center'},
|
|
|
+ },
|
|
|
+ margin: {horizontal: 12},
|
|
|
+ });
|
|
|
+
|
|
|
+ /*
|
|
|
+ =============================================================
|
|
|
+ SUGERENCIAS Y PENDIENTES
|
|
|
+ =============================================================
|
|
|
+ */
|
|
|
+ var finalY = pdfDoc.autoTable.previous.finalY;
|
|
|
+ pdfDoc.autoTable(getColumnsMaterial8, docWorkItem8, {
|
|
|
+ theme: 'grid',
|
|
|
+ startY: finalY + 3,
|
|
|
+ styles: {
|
|
|
+ overflow: 'linebreak',
|
|
|
+ columnWidth: 'auto',
|
|
|
+ fontSize: 8,
|
|
|
+
|
|
|
+ },
|
|
|
+ headerStyles: {
|
|
|
+ fillColor: [255, 255, 255],
|
|
|
+ borderColor: [150, 152, 154],
|
|
|
+ fontSize: 9,
|
|
|
+ textColor: [0, 0, 0]
|
|
|
+ },
|
|
|
+ columnStyles: {
|
|
|
+ xnmumber : {columnWidth: '4px',halign: 'center'},
|
|
|
+ description: {columnWidth: '24px', halign: 'left'},
|
|
|
+ },
|
|
|
+ margin: {horizontal: 12},
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(9);
|
|
|
+ pdfDoc.setFontStyle('bold');
|
|
|
+ pdfDoc.setTextColor(10);
|
|
|
+ pdfDoc.text(14,pdfDoc.autoTable.previous.finalY + 5,'Mantenimiento próximo: ');
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(9);
|
|
|
+ pdfDoc.setFontStyle('normal');
|
|
|
+ pdfDoc.setTextColor(10);
|
|
|
+ pdfDoc.text(60,pdfDoc.autoTable.previous.finalY + 5,self.valorNull(moment(doc.date_service).format('DD/MM/YYYY')));
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(9);
|
|
|
+ pdfDoc.setFontStyle('bold');
|
|
|
+ pdfDoc.setTextColor(10);
|
|
|
+ pdfDoc.text(14,pdfDoc.autoTable.previous.finalY + 11,'Firma de conformidad de cliente o encargado: ............................................. Sello: ');
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(9);
|
|
|
+ pdfDoc.setFontStyle('normal');
|
|
|
+ pdfDoc.setTextColor(10);
|
|
|
+ pdfDoc.text(14,pdfDoc.autoTable.previous.finalY + 17,'Aclaración: ................................. C.I.N°: ....................');
|
|
|
+
|
|
|
+
|
|
|
+ pdfDoc.setFontSize(9);
|
|
|
+ pdfDoc.setFontStyle('bold');
|
|
|
+ pdfDoc.setTextColor(10);
|
|
|
+ pdfDoc.text(14,pdfDoc.autoTable.previous.finalY + 23,'Firma de técnico responsable: ..................................................................... Sello: ');
|
|
|
+
|
|
|
+
|
|
|
+ pdfDoc.save('Informe técnico de trabajo.pdf');
|
|
|
+ },
|
|
|
+ });
|
|
|
+ if (instance.web && instance.web.FormView) {
|
|
|
+ instance.web.FormView.include({
|
|
|
+ load_form: function (record) {
|
|
|
+ this._super.apply(this, arguments);
|
|
|
+ if (this.model !== 'repair.workorderimproved') return;
|
|
|
+ local.parentInstance = this;
|
|
|
+ if (local.widgetInstance) {
|
|
|
+ local.widgetInstance.updateId(record.id);
|
|
|
+ }
|
|
|
+ local.widgetInstance = new local.WorkOrderbioelectricWidget(this);
|
|
|
+ var elemento = this.$el.find('.oe_form_sheet.oe_form_sheet_width');
|
|
|
+ elemento = elemento.find('.oe_right.oe_button_box.workorderbioelectric_button_box');
|
|
|
+ local.widgetInstance.appendTo(elemento);
|
|
|
+ local.widgetInstance.updateId(record.id);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+};
|