Commit 08c463d107a0d63675f9a53c591af8761ddb32ef

Authored by Eric Fernandez
Exists in master

Merge branch 'master' of https://debo.suite.repo/modulos-npm/foca-crear-nota-pedido

src/js/controller.js
1 angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', 1 angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
2 [ 2 [
3 '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', 3 '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService',
4 'focaModalService', 'focaSeguimientoService', 'notaPedidoBusinessService', 4 'focaModalService', 'focaSeguimientoService', 'notaPedidoBusinessService',
5 '$rootScope', 5 '$rootScope',
6 function( 6 function(
7 $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService, 7 $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService,
8 focaSeguimientoService, notaPedidoBusinessService, $rootScope 8 focaSeguimientoService, notaPedidoBusinessService, $rootScope
9 ) { 9 ) {
10 $scope.botonera = [ 10 $scope.botonera = [
11 {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, 11 {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}},
12 {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, 12 {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}},
13 {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, 13 {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}},
14 {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, 14 {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}},
15 { 15 {
16 texto: 'Precios y condiciones', 16 texto: 'Precios y condiciones',
17 accion: function() {$scope.abrirModalListaPrecio();}}, 17 accion: function() {$scope.abrirModalListaPrecio();}},
18 {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, 18 {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}},
19 {texto: '', accion: function() {}}, 19 {texto: '', accion: function() {}},
20 {texto: '', accion: function() {}} 20 {texto: '', accion: function() {}}
21 ]; 21 ];
22 $scope.datepickerAbierto = false; 22 $scope.datepickerAbierto = false;
23 23
24 $scope.show = false; 24 $scope.show = false;
25 $scope.cargando = true; 25 $scope.cargando = true;
26 $scope.dateOptions = { 26 $scope.dateOptions = {
27 maxDate: new Date(), 27 maxDate: new Date(),
28 minDate: new Date(2010, 0, 1) 28 minDate: new Date(2010, 0, 1)
29 }; 29 };
30 30
31 $scope.notaPedido = { 31 $scope.notaPedido = {
32 vendedor: {}, 32 vendedor: {},
33 cliente: {}, 33 cliente: {},
34 proveedor: {}, 34 proveedor: {},
35 domicilio: {dom: ''}, 35 domicilio: {dom: ''},
36 moneda: {}, 36 moneda: {},
37 cotizacion: {} 37 cotizacion: {}
38 }; 38 };
39 var monedaPorDefecto; 39 var monedaPorDefecto;
40 //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' 40 //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]'
41 crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) { 41 crearNotaPedidoService.getCotizacionByIdMoneda(1).then(function(res) {
42 monedaPorDefecto = { 42 monedaPorDefecto = {
43 id: res.data[0].ID, 43 id: res.data[0].ID,
44 detalle: res.data[0].DETALLE, 44 detalle: res.data[0].DETALLE,
45 simbolo: res.data[0].SIMBOLO, 45 simbolo: res.data[0].SIMBOLO,
46 cotizaciones: res.data[0].cotizaciones 46 cotizaciones: res.data[0].cotizaciones
47 }; 47 };
48 addCabecera('Moneda:', monedaPorDefecto.detalle); 48 addCabecera('Moneda:', monedaPorDefecto.detalle);
49 addCabecera('Fecha cotizacion:', 49 addCabecera('Fecha cotizacion:',
50 new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString()); 50 new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString());
51 addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].VENDEDOR); 51 addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].VENDEDOR);
52 $scope.notaPedido.moneda = monedaPorDefecto; 52 $scope.notaPedido.moneda = monedaPorDefecto;
53 $scope.notaPedido.cotizacion = monedaPorDefecto.cotizaciones[0]; 53 $scope.notaPedido.cotizacion = monedaPorDefecto.cotizaciones[0];
54 }); 54 });
55 55
56 $scope.cabecera = []; 56 $scope.cabecera = [];
57 $scope.showCabecera = true; 57 $scope.showCabecera = true;
58 58
59 $scope.now = new Date(); 59 $scope.now = new Date();
60 $scope.puntoVenta = '0000'; 60 $scope.puntoVenta = '0000';
61 $scope.comprobante = '00000000'; 61 $scope.comprobante = '00000000';
62 $scope.articulosTabla = []; 62 $scope.articulosTabla = [];
63 $scope.idLista = undefined; 63 $scope.idLista = undefined;
64 //La pantalla solo se usa para cargar pedidos 64 //La pantalla solo se usa para cargar pedidos
65 //var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); 65 //var notaPedidoTemp = crearNotaPedidoService.getNotaPedido();
66 66
67 crearNotaPedidoService.getPrecioCondicion().then( 67 crearNotaPedidoService.getPrecioCondicion().then(
68 function(res) { 68 function(res) {
69 $scope.precioCondiciones = res.data; 69 $scope.precioCondiciones = res.data;
70 } 70 }
71 ); 71 );
72 72
73 crearNotaPedidoService.getNumeroNotaPedido().then( 73 crearNotaPedidoService.getNumeroNotaPedido().then(
74 function(res) { 74 function(res) {
75 $scope.puntoVenta = rellenar(res.data.sucursal, 4); 75 $scope.puntoVenta = rellenar(res.data.sucursal, 4);
76 $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); 76 $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8);
77 }, 77 },
78 function(err) { 78 function(err) {
79 focaModalService.alert('La terminal no esta configurada correctamente'); 79 focaModalService.alert('La terminal no esta configurada correctamente');
80 console.info(err); 80 console.info(err);
81 } 81 }
82 ); 82 );
83 //La pantalla solo se usa para cargar pedidos 83 //La pantalla solo se usa para cargar pedidos
84 // if (notaPedidoTemp !== undefined) { 84 // if (notaPedidoTemp !== undefined) {
85 // notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); 85 // notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga);
86 // $scope.notaPedido = notaPedidoTemp; 86 // $scope.notaPedido = notaPedidoTemp;
87 // $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); 87 // $scope.notaPedido.flete = ($scope.notaPedido.flete).toString();
88 // $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); 88 // $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString();
89 // $scope.idLista = $scope.notaPedido.precioCondicion; 89 // $scope.idLista = $scope.notaPedido.precioCondicion;
90 // crearNotaPedidoService 90 // crearNotaPedidoService
91 // .getArticulosByIdNotaPedido($scope.notaPedido.id).then( 91 // .getArticulosByIdNotaPedido($scope.notaPedido.id).then(
92 // function(res) { 92 // function(res) {
93 // $scope.articulosTabla = res.data; 93 // $scope.articulosTabla = res.data;
94 // } 94 // }
95 // ); 95 // );
96 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO 96 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO
97 //(NO REQUERIDO EN ESTA VERSION) 97 //(NO REQUERIDO EN ESTA VERSION)
98 // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( 98 // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then(
99 // function(res) { 99 // function(res) {
100 // $scope.notaPedido.domicilio = res.data; 100 // $scope.notaPedido.domicilio = res.data;
101 // } 101 // }
102 // ); 102 // );
103 // } else { 103 // } else {
104 // $scope.notaPedido.fechaCarga = new Date(); 104 // $scope.notaPedido.fechaCarga = new Date();
105 // $scope.notaPedido.bomba = '0'; 105 // $scope.notaPedido.bomba = '0';
106 // $scope.notaPedido.flete = '0'; 106 // $scope.notaPedido.flete = '0';
107 // $scope.idLista = undefined; 107 // $scope.idLista = undefined;
108 // } 108 // }
109 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO 109 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO
110 // $scope.addNewDom = function() { 110 // $scope.addNewDom = function() {
111 // $scope.notaPedido.domicilio.push({ 'id': 0 }); 111 // $scope.notaPedido.domicilio.push({ 'id': 0 });
112 // }; 112 // };
113 // $scope.removeNewChoice = function(choice) { 113 // $scope.removeNewChoice = function(choice) {
114 // if ($scope.notaPedido.domicilio.length > 1) { 114 // if ($scope.notaPedido.domicilio.length > 1) {
115 // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( 115 // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex(
116 // function(c) { 116 // function(c) {
117 // return c.$$hashKey === choice.$$hashKey; 117 // return c.$$hashKey === choice.$$hashKey;
118 // } 118 // }
119 // ), 1); 119 // ), 1);
120 // } 120 // }
121 // }; 121 // };
122 122
123 $scope.crearNotaPedido = function() { 123 $scope.crearNotaPedido = function() {
124 if(!$scope.notaPedido.vendedor.codigo) { 124 if(!$scope.notaPedido.vendedor.codigo) {
125 focaModalService.alert('Ingrese Vendedor'); 125 focaModalService.alert('Ingrese Vendedor');
126 return; 126 return;
127 } else if(!$scope.notaPedido.cliente.cod) { 127 } else if(!$scope.notaPedido.cliente.cod) {
128 focaModalService.alert('Ingrese Cliente'); 128 focaModalService.alert('Ingrese Cliente');
129 return; 129 return;
130 } else if(!$scope.notaPedido.proveedor.codigo) { 130 } else if(!$scope.notaPedido.proveedor.codigo) {
131 focaModalService.alert('Ingrese Proveedor'); 131 focaModalService.alert('Ingrese Proveedor');
132 return; 132 return;
133 } else if(!$scope.notaPedido.moneda.id) { 133 } else if(!$scope.notaPedido.moneda.id) {
134 focaModalService.alert('Ingrese Moneda'); 134 focaModalService.alert('Ingrese Moneda');
135 return; 135 return;
136 } else if(!$scope.notaPedido.cotizacion.ID) { 136 } else if(!$scope.notaPedido.cotizacion.ID) {
137 focaModalService.alert('Ingrese Cotización'); 137 focaModalService.alert('Ingrese Cotización');
138 return; 138 return;
139 } else if(!$scope.plazosPagos) { 139 } else if(!$scope.plazosPagos) {
140 focaModalService.alert('Ingrese Precios y Condiciones'); 140 focaModalService.alert('Ingrese Precios y Condiciones');
141 return; 141 return;
142 } else if( 142 } else if(
143 $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null) 143 $scope.notaPedido.flete === undefined || $scope.notaPedido.flete === null)
144 { 144 {
145 focaModalService.alert('Ingrese Flete'); 145 focaModalService.alert('Ingrese Flete');
146 return; 146 return;
147 } else if(!$scope.notaPedido.domicilio.id) { 147 } else if(!$scope.notaPedido.domicilio.id) {
148 focaModalService.alert('Ingrese Domicilio'); 148 focaModalService.alert('Ingrese Domicilio');
149 return; 149 return;
150 } else if($scope.articulosTabla.length === 0) { 150 } else if($scope.articulosTabla.length === 0) {
151 focaModalService.alert('Debe cargar al menos un articulo'); 151 focaModalService.alert('Debe cargar al menos un articulo');
152 return; 152 return;
153 } 153 }
154 var date = new Date(); 154 var date = new Date();
155 var notaPedido = { 155 var notaPedido = {
156 id: 0, 156 id: 0,
157 fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) 157 fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000))
158 .toISOString().slice(0, 19).replace('T', ' '), 158 .toISOString().slice(0, 19).replace('T', ' '),
159 idVendedor: $scope.notaPedido.vendedor.codigo, 159 idVendedor: $scope.notaPedido.vendedor.codigo,
160 idCliente: $scope.notaPedido.cliente.cod, 160 idCliente: $scope.notaPedido.cliente.cod,
161 nombreCliente: $scope.notaPedido.cliente.nom, 161 nombreCliente: $scope.notaPedido.cliente.nom,
162 cuitCliente: $scope.notaPedido.cliente.cuit, 162 cuitCliente: $scope.notaPedido.cliente.cuit,
163 idProveedor: $scope.notaPedido.proveedor.codigo, 163 idProveedor: $scope.notaPedido.proveedor.codigo,
164 idDomicilio: $scope.notaPedido.domicilio.id, 164 idDomicilio: $scope.notaPedido.domicilio.id,
165 idCotizacion: $scope.notaPedido.cotizacion.ID, 165 idCotizacion: $scope.notaPedido.cotizacion.ID,
166 idPrecioCondicion: $scope.notaPedido.idPrecioCondicion, 166 idPrecioCondicion: $scope.notaPedido.idPrecioCondicion,
167 cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, 167 cotizacion: $scope.notaPedido.cotizacion.VENDEDOR,
168 flete: $scope.notaPedido.flete, 168 flete: $scope.notaPedido.flete,
169 fob: $scope.notaPedido.fob, 169 fob: $scope.notaPedido.fob,
170 bomba: $scope.notaPedido.bomba, 170 bomba: $scope.notaPedido.bomba,
171 kilometros: $scope.notaPedido.kilometros, 171 kilometros: $scope.notaPedido.kilometros,
172 estado: 0, 172 estado: 0,
173 total: $scope.getTotal() 173 total: $scope.getTotal()
174 }; 174 };
175 crearNotaPedidoService.crearNotaPedido(notaPedido).then( 175 crearNotaPedidoService.crearNotaPedido(notaPedido).then(
176 function(data) { 176 function(data) {
177 notaPedidoBusinessService.addArticulos($scope.articulosTabla, 177 notaPedidoBusinessService.addArticulos($scope.articulosTabla,
178 data.data.id, $scope.notaPedido.cotizacion.VENDEDOR); 178 data.data.id, $scope.notaPedido.cotizacion.VENDEDOR);
179 focaSeguimientoService.guardarPosicion('crear nota pedido', ''); 179 focaSeguimientoService.guardarPosicion('crear nota pedido', '');
180 var plazos = $scope.plazosPagos; 180 var plazos = $scope.plazosPagos;
181 181
182 for(var j = 0; j < plazos.length; j++) { 182 for(var j = 0; j < plazos.length; j++) {
183 var json = { 183 var json = {
184 idPedido: data.data.id, 184 idPedido: data.data.id,
185 dias: plazos[j].dias 185 dias: plazos[j].dias
186 }; 186 };
187 crearNotaPedidoService.crearPlazosParaNotaPedido(json); 187 crearNotaPedidoService.crearPlazosParaNotaPedido(json);
188 } 188 }
189 notaPedidoBusinessService.addEstado(data.data.id, 189 notaPedidoBusinessService.addEstado(data.data.id,
190 $scope.notaPedido.vendedor.codigo); 190 $scope.notaPedido.vendedor.codigo);
191 191
192 focaModalService.alert('Nota pedido creada'); 192 focaModalService.alert('Nota pedido creada');
193 $scope.cabecera = []; 193 $scope.cabecera = [];
194 addCabecera('Moneda:', $scope.notaPedido.moneda.detalle); 194 addCabecera('Moneda:', $scope.notaPedido.moneda.detalle);
195 addCabecera( 195 addCabecera(
196 'Fecha cotizacion:', 196 'Fecha cotizacion:',
197 $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy') 197 $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy')
198 ); 198 );
199 addCabecera('Cotizacion:', $scope.notaPedido.cotizacion.VENDEDOR); 199 addCabecera('Cotizacion:', $scope.notaPedido.cotizacion.VENDEDOR);
200 $scope.notaPedido.vendedor = {}; 200 $scope.notaPedido.vendedor = {};
201 $scope.notaPedido.cliente = {}; 201 $scope.notaPedido.cliente = {};
202 $scope.notaPedido.proveedor = {}; 202 $scope.notaPedido.proveedor = {};
203 $scope.notaPedido.domicilio = {}; 203 $scope.notaPedido.domicilio = {};
204 $scope.notaPedido.flete = null; 204 $scope.notaPedido.flete = null;
205 $scope.notaPedido.fob = null; 205 $scope.notaPedido.fob = null;
206 $scope.notaPedido.bomba = null; 206 $scope.notaPedido.bomba = null;
207 $scope.notaPedido.kilometros = null; 207 $scope.notaPedido.kilometros = null;
208 $scope.articulosTabla = []; 208 $scope.articulosTabla = [];
209 }, 209 },
210 function(error) { 210 function(error) {
211 focaModalService.alert('Hubo un error al crear la nota de pedido'); 211 focaModalService.alert('Hubo un error al crear la nota de pedido');
212 console.info(error); 212 console.info(error);
213 } 213 }
214 ); 214 );
215 }; 215 };
216 216
217 $scope.seleccionarArticulo = function() { 217 $scope.seleccionarArticulo = function() {
218 if ($scope.idLista === undefined) { 218 if ($scope.idLista === undefined) {
219 focaModalService.alert( 219 focaModalService.alert(
220 'Primero seleccione una lista de precio y condicion'); 220 'Primero seleccione una lista de precio y condicion');
221 return; 221 return;
222 } 222 }
223 var modalInstance = $uibModal.open( 223 var modalInstance = $uibModal.open(
224 { 224 {
225 ariaLabelledBy: 'Busqueda de Productos', 225 ariaLabelledBy: 'Busqueda de Productos',
226 templateUrl: 'modal-busqueda-productos.html', 226 templateUrl: 'modal-busqueda-productos.html',
227 controller: 'modalBusquedaProductosCtrl', 227 controller: 'modalBusquedaProductosCtrl',
228 resolve: { 228 resolve: {
229 parametroProducto: { 229 parametroProducto: {
230 idLista: $scope.idLista, 230 idLista: $scope.idLista,
231 cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, 231 cotizacion: $scope.notaPedido.cotizacion.VENDEDOR,
232 simbolo: $scope.notaPedido.moneda.simbolo 232 simbolo: $scope.notaPedido.moneda.simbolo
233 } 233 }
234 }, 234 },
235 size: 'lg' 235 size: 'lg'
236 } 236 }
237 ); 237 );
238 modalInstance.result.then( 238 modalInstance.result.then(
239 function(producto) { 239 function(producto) {
240 var newArt = 240 var newArt =
241 { 241 {
242 id: 0, 242 id: 0,
243 codigo: producto.codigo, 243 codigo: producto.codigo,
244 sector: producto.sector, 244 sector: producto.sector,
245 sectorCodigo: producto.sector + '-' + producto.codigo, 245 sectorCodigo: producto.sector + '-' + producto.codigo,
246 descripcion: producto.descripcion, 246 descripcion: producto.descripcion,
247 item: $scope.articulosTabla.length + 1, 247 item: $scope.articulosTabla.length + 1,
248 nombre: producto.descripcion, 248 nombre: producto.descripcion,
249 precio: parseFloat(producto.precio.toFixed(4)), 249 precio: parseFloat(producto.precio.toFixed(4)),
250 costoUnitario: producto.costo, 250 costoUnitario: producto.costo,
251 editCantidad: false, 251 editCantidad: false,
252 editPrecio: false 252 editPrecio: false
253 }; 253 };
254 $scope.articuloACargar = newArt; 254 $scope.articuloACargar = newArt;
255 $scope.cargando = false; 255 $scope.cargando = false;
256 }, function() { 256 }, function() {
257 // funcion ejecutada cuando se cancela el modal 257 // funcion ejecutada cuando se cancela el modal
258 } 258 }
259 ); 259 );
260 }; 260 };
261 261
262 $scope.seleccionarVendedor = function() { 262 $scope.seleccionarVendedor = function() {
263 var modalInstance = $uibModal.open( 263 var modalInstance = $uibModal.open(
264 { 264 {
265 ariaLabelledBy: 'Busqueda de Vendedores', 265 ariaLabelledBy: 'Busqueda de Vendedores',
266 templateUrl: 'modal-vendedores.html', 266 templateUrl: 'modal-vendedores.html',
267 controller: 'modalVendedoresCtrl', 267 controller: 'modalVendedoresCtrl',
268 size: 'lg' 268 size: 'lg'
269 } 269 }
270 ); 270 );
271 modalInstance.result.then( 271 modalInstance.result.then(
272 function(vendedor) { 272 function(vendedor) {
273 addCabecera('Vendedor:', vendedor.NomVen); 273 addCabecera('Vendedor:', vendedor.NomVen);
274 $scope.notaPedido.vendedor.codigo = vendedor.CodVen; 274 $scope.notaPedido.vendedor.codigo = vendedor.CodVen;
275 }, function() { 275 }, function() {
276 276
277 } 277 }
278 ); 278 );
279 }; 279 };
280 280
281 $scope.seleccionarProveedor = function() { 281 $scope.seleccionarProveedor = function() {
282 var modalInstance = $uibModal.open( 282 var modalInstance = $uibModal.open(
283 { 283 {
284 ariaLabelledBy: 'Busqueda de Proveedor', 284 ariaLabelledBy: 'Busqueda de Proveedor',
285 templateUrl: 'modal-proveedor.html', 285 templateUrl: 'modal-proveedor.html',
286 controller: 'focaModalProveedorCtrl', 286 controller: 'focaModalProveedorCtrl',
287 size: 'lg' 287 size: 'lg',
288 resolve: {
289 transportista: function() {
290 return false;
291 }
292 }
288 } 293 }
289 ); 294 );
290 modalInstance.result.then( 295 modalInstance.result.then(
291 function(proveedor) { 296 function(proveedor) {
292 $scope.notaPedido.proveedor.codigo = proveedor.COD; 297 $scope.notaPedido.proveedor.codigo = proveedor.COD;
293 addCabecera('Proveedor:', proveedor.NOM); 298 addCabecera('Proveedor:', proveedor.NOM);
294 }, function() { 299 }, function() {
295 300
296 } 301 }
297 ); 302 );
298 }; 303 };
299 304
300 $scope.seleccionarCliente = function() { 305 $scope.seleccionarCliente = function() {
301 306
302 var modalInstance = $uibModal.open( 307 var modalInstance = $uibModal.open(
303 { 308 {
304 ariaLabelledBy: 'Busqueda de Cliente', 309 ariaLabelledBy: 'Busqueda de Cliente',
305 templateUrl: 'foca-busqueda-cliente-modal.html', 310 templateUrl: 'foca-busqueda-cliente-modal.html',
306 controller: 'focaBusquedaClienteModalController', 311 controller: 'focaBusquedaClienteModalController',
307 size: 'lg' 312 size: 'lg'
308 } 313 }
309 ); 314 );
310 modalInstance.result.then( 315 modalInstance.result.then(
311 function(cliente) { 316 function(cliente) {
312 $scope.abrirModalDomicilios(cliente); 317 $scope.abrirModalDomicilios(cliente);
313 }, function() { 318 }, function() {
314 319
315 } 320 }
316 ); 321 );
317 }; 322 };
318 323
319 $scope.abrirModalDomicilios = function(cliente) { 324 $scope.abrirModalDomicilios = function(cliente) {
320 var modalInstanceDomicilio = $uibModal.open( 325 var modalInstanceDomicilio = $uibModal.open(
321 { 326 {
322 ariaLabelledBy: 'Busqueda de Domicilios', 327 ariaLabelledBy: 'Busqueda de Domicilios',
323 templateUrl: 'modal-domicilio.html', 328 templateUrl: 'modal-domicilio.html',
324 controller: 'focaModalDomicilioController', 329 controller: 'focaModalDomicilioController',
325 resolve: { idCliente: function() { return cliente.cod; }}, 330 resolve: { idCliente: function() { return cliente.cod; }},
326 size: 'lg', 331 size: 'lg',
327 } 332 }
328 ); 333 );
329 modalInstanceDomicilio.result.then( 334 modalInstanceDomicilio.result.then(
330 function(domicilio) { 335 function(domicilio) {
331 $scope.notaPedido.domicilio.id = domicilio.id; 336 $scope.notaPedido.domicilio.id = domicilio.id;
332 $scope.notaPedido.cliente = cliente; 337 $scope.notaPedido.cliente = cliente;
333 338
334 addCabecera('Cliente:', cliente.nom); 339 addCabecera('Cliente:', cliente.nom);
335 addCabecera('Domicilio:', domicilio.Calle + ' ' + domicilio.Numero); 340 addCabecera('Domicilio:', domicilio.Calle + ' ' + domicilio.Numero);
336 }, function() { 341 }, function() {
337 $scope.seleccionarCliente(); 342 $scope.seleccionarCliente();
338 return; 343 return;
339 } 344 }
340 ); 345 );
341 }; 346 };
342 347
343 $scope.mostrarFichaCliente = function() { 348 $scope.mostrarFichaCliente = function() {
344 $uibModal.open( 349 $uibModal.open(
345 { 350 {
346 ariaLabelledBy: 'Datos del Cliente', 351 ariaLabelledBy: 'Datos del Cliente',
347 templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', 352 templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html',
348 controller: 'focaCrearNotaPedidoFichaClienteController', 353 controller: 'focaCrearNotaPedidoFichaClienteController',
349 size: 'lg' 354 size: 'lg'
350 } 355 }
351 ); 356 );
352 }; 357 };
353 358
354 $scope.getTotal = function() { 359 $scope.getTotal = function() {
355 var total = 0; 360 var total = 0;
356 var arrayTempArticulos = $scope.articulosTabla; 361 var arrayTempArticulos = $scope.articulosTabla;
357 for (var i = 0; i < arrayTempArticulos.length; i++) { 362 for (var i = 0; i < arrayTempArticulos.length; i++) {
358 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; 363 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad;
359 } 364 }
360 return parseFloat(total.toFixed(2)); 365 return parseFloat(total.toFixed(2));
361 }; 366 };
362 367
363 $scope.getSubTotal = function() { 368 $scope.getSubTotal = function() {
364 if($scope.articuloACargar) { 369 if($scope.articuloACargar) {
365 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; 370 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
366 } 371 }
367 }; 372 };
368 373
369 $scope.abrirModalListaPrecio = function() { 374 $scope.abrirModalListaPrecio = function() {
370 var modalInstance = $uibModal.open( 375 var modalInstance = $uibModal.open(
371 { 376 {
372 ariaLabelledBy: 'Busqueda de Precio Condición', 377 ariaLabelledBy: 'Busqueda de Precio Condición',
373 templateUrl: 'modal-precio-condicion.html', 378 templateUrl: 'modal-precio-condicion.html',
374 controller: 'focaModalPrecioCondicionController', 379 controller: 'focaModalPrecioCondicionController',
375 size: 'lg' 380 size: 'lg'
376 } 381 }
377 ); 382 );
378 modalInstance.result.then( 383 modalInstance.result.then(
379 function(precioCondicion) { 384 function(precioCondicion) {
380 var cabecera = ''; 385 var cabecera = '';
381 var plazosConcat = ''; 386 var plazosConcat = '';
382 if(!Array.isArray(precioCondicion)) { 387 if(!Array.isArray(precioCondicion)) {
383 $scope.notaPedido.idPrecioCondicion = precioCondicion.id; 388 $scope.notaPedido.idPrecioCondicion = precioCondicion.id;
384 $scope.plazosPagos = precioCondicion.plazoPago; 389 $scope.plazosPagos = precioCondicion.plazoPago;
385 $scope.idLista = precioCondicion.idListaPrecio; 390 $scope.idLista = precioCondicion.idListaPrecio;
386 for(var i = 0; i < precioCondicion.plazoPago.length; i++) { 391 for(var i = 0; i < precioCondicion.plazoPago.length; i++) {
387 plazosConcat += precioCondicion.plazoPago[i].dias + ' '; 392 plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
388 } 393 }
389 cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); 394 cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim();
390 } else { //Cuando se ingresan los plazos manualmente 395 } else { //Cuando se ingresan los plazos manualmente
391 $scope.notaPedido.idPrecioCondicion = 0; 396 $scope.notaPedido.idPrecioCondicion = 0;
392 $scope.idLista = -1; //-1, el modal productos busca todos los productos 397 $scope.idLista = -1; //-1, el modal productos busca todos los productos
393 $scope.plazosPagos = precioCondicion; 398 $scope.plazosPagos = precioCondicion;
394 for(var j = 0; j < precioCondicion.length; j++) { 399 for(var j = 0; j < precioCondicion.length; j++) {
395 plazosConcat += precioCondicion[j].dias + ' '; 400 plazosConcat += precioCondicion[j].dias + ' ';
396 } 401 }
397 cabecera = 'Ingreso manual ' + plazosConcat.trim(); 402 cabecera = 'Ingreso manual ' + plazosConcat.trim();
398 } 403 }
399 $scope.articulosTabla = []; 404 $scope.articulosTabla = [];
400 addCabecera('Precios y condiciones:', cabecera); 405 addCabecera('Precios y condiciones:', cabecera);
401 }, function() { 406 }, function() {
402 407
403 } 408 }
404 ); 409 );
405 }; 410 };
406 411
407 $scope.abrirModalFlete = function() { 412 $scope.abrirModalFlete = function() {
408 var modalInstance = $uibModal.open( 413 var modalInstance = $uibModal.open(
409 { 414 {
410 ariaLabelledBy: 'Busqueda de Flete', 415 ariaLabelledBy: 'Busqueda de Flete',
411 templateUrl: 'modal-flete.html', 416 templateUrl: 'modal-flete.html',
412 controller: 'focaModalFleteController', 417 controller: 'focaModalFleteController',
413 size: 'lg', 418 size: 'lg',
414 resolve: { 419 resolve: {
415 parametrosFlete: 420 parametrosFlete:
416 function() { 421 function() {
417 return { 422 return {
418 flete: $scope.notaPedido.flete ? '1' : 423 flete: $scope.notaPedido.flete ? '1' :
419 ($scope.notaPedido.fob ? 'FOB' : 424 ($scope.notaPedido.fob ? 'FOB' :
420 ($scope.notaPedido.flete === undefined ? null : '0')), 425 ($scope.notaPedido.flete === undefined ? null : '0')),
421 bomba: $scope.notaPedido.bomba ? '1' : 426 bomba: $scope.notaPedido.bomba ? '1' :
422 ($scope.notaPedido.bomba === undefined ? null : '0'), 427 ($scope.notaPedido.bomba === undefined ? null : '0'),
423 kilometros: $scope.notaPedido.kilometros 428 kilometros: $scope.notaPedido.kilometros
424 }; 429 };
425 } 430 }
426 } 431 }
427 } 432 }
428 ); 433 );
429 modalInstance.result.then( 434 modalInstance.result.then(
430 function(datos) { 435 function(datos) {
431 $scope.notaPedido.flete = datos.flete; 436 $scope.notaPedido.flete = datos.flete;
432 $scope.notaPedido.fob = datos.FOB; 437 $scope.notaPedido.fob = datos.FOB;
433 $scope.notaPedido.bomba = datos.bomba; 438 $scope.notaPedido.bomba = datos.bomba;
434 $scope.notaPedido.kilometros = datos.kilometros; 439 $scope.notaPedido.kilometros = datos.kilometros;
435 440
436 addCabecera('Flete:', datos.flete ? 'Si' : 441 addCabecera('Flete:', datos.flete ? 'Si' :
437 ($scope.notaPedido.fob ? 'FOB' : 'No')); 442 ($scope.notaPedido.fob ? 'FOB' : 'No'));
438 if(datos.flete) { 443 if(datos.flete) {
439 addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); 444 addCabecera('Bomba:', datos.bomba ? 'Si' : 'No');
440 addCabecera('Kilometros:', datos.kilometros); 445 addCabecera('Kilometros:', datos.kilometros);
441 } else { 446 } else {
442 removeCabecera('Bomba:'); 447 removeCabecera('Bomba:');
443 removeCabecera('Kilometros:'); 448 removeCabecera('Kilometros:');
444 $scope.notaPedido.fob = false; 449 $scope.notaPedido.fob = false;
445 $scope.notaPedido.bomba = false; 450 $scope.notaPedido.bomba = false;
446 $scope.notaPedido.kilometros = null; 451 $scope.notaPedido.kilometros = null;
447 } 452 }
448 }, function() { 453 }, function() {
449 454
450 } 455 }
451 ); 456 );
452 }; 457 };
453 458
454 $scope.abrirModalMoneda = function() { 459 $scope.abrirModalMoneda = function() {
455 var modalInstance = $uibModal.open( 460 var modalInstance = $uibModal.open(
456 { 461 {
457 ariaLabelledBy: 'Busqueda de Moneda', 462 ariaLabelledBy: 'Busqueda de Moneda',
458 templateUrl: 'modal-moneda.html', 463 templateUrl: 'modal-moneda.html',
459 controller: 'focaModalMonedaController', 464 controller: 'focaModalMonedaController',
460 size: 'lg' 465 size: 'lg'
461 } 466 }
462 ); 467 );
463 modalInstance.result.then( 468 modalInstance.result.then(
464 function(moneda) { 469 function(moneda) {
465 $scope.abrirModalCotizacion(moneda); 470 $scope.abrirModalCotizacion(moneda);
466 }, function() { 471 }, function() {
467 472
468 } 473 }
469 ); 474 );
470 }; 475 };
471 476
472 $scope.abrirModalCotizacion = function(moneda) { 477 $scope.abrirModalCotizacion = function(moneda) {
473 var modalInstance = $uibModal.open( 478 var modalInstance = $uibModal.open(
474 { 479 {
475 ariaLabelledBy: 'Busqueda de Cotización', 480 ariaLabelledBy: 'Busqueda de Cotización',
476 templateUrl: 'modal-cotizacion.html', 481 templateUrl: 'modal-cotizacion.html',
477 controller: 'focaModalCotizacionController', 482 controller: 'focaModalCotizacionController',
478 size: 'lg', 483 size: 'lg',
479 resolve: {idMoneda: function() {return moneda.ID;}} 484 resolve: {idMoneda: function() {return moneda.ID;}}
480 } 485 }
481 ); 486 );
482 modalInstance.result.then( 487 modalInstance.result.then(
483 function(cotizacion) { 488 function(cotizacion) {
484 var articulosTablaTemp = $scope.articulosTabla; 489 var articulosTablaTemp = $scope.articulosTabla;
485 for(var i = 0; i < articulosTablaTemp.length; i++) { 490 for(var i = 0; i < articulosTablaTemp.length; i++) {
486 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * 491 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio *
487 $scope.notaPedido.cotizacion.VENDEDOR; 492 $scope.notaPedido.cotizacion.VENDEDOR;
488 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / 493 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio /
489 cotizacion.VENDEDOR; 494 cotizacion.VENDEDOR;
490 } 495 }
491 $scope.articulosTabla = articulosTablaTemp; 496 $scope.articulosTabla = articulosTablaTemp;
492 $scope.notaPedido.moneda = { 497 $scope.notaPedido.moneda = {
493 id: moneda.ID, 498 id: moneda.ID,
494 detalle: moneda.DETALLE, 499 detalle: moneda.DETALLE,
495 simbolo: moneda.SIMBOLO 500 simbolo: moneda.SIMBOLO
496 }; 501 };
497 $scope.notaPedido.cotizacion = cotizacion; 502 $scope.notaPedido.cotizacion = cotizacion;
498 addCabecera('Moneda:', moneda.DETALLE); 503 addCabecera('Moneda:', moneda.DETALLE);
499 addCabecera( 504 addCabecera(
500 'Fecha cotizacion:', 505 'Fecha cotizacion:',
501 $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') 506 $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
502 ); 507 );
503 addCabecera('Cotizacion:', cotizacion.VENDEDOR); 508 addCabecera('Cotizacion:', cotizacion.VENDEDOR);
504 }, function() { 509 }, function() {
505 510
506 } 511 }
507 ); 512 );
508 }; 513 };
509 514
510 $scope.agregarATabla = function(key) { 515 $scope.agregarATabla = function(key) {
511 if(key === 13) { 516 if(key === 13) {
512 if($scope.articuloACargar.cantidad === undefined || 517 if($scope.articuloACargar.cantidad === undefined ||
513 $scope.articuloACargar.cantidad === 0 || 518 $scope.articuloACargar.cantidad === 0 ||
514 $scope.articuloACargar.cantidad === null ) { 519 $scope.articuloACargar.cantidad === null ) {
515 focaModalService.alert('El valor debe ser al menos 1'); 520 focaModalService.alert('El valor debe ser al menos 1');
516 return; 521 return;
517 } 522 }
518 delete $scope.articuloACargar.sectorCodigo; 523 delete $scope.articuloACargar.sectorCodigo;
519 $scope.articulosTabla.push($scope.articuloACargar); 524 $scope.articulosTabla.push($scope.articuloACargar);
520 $scope.cargando = true; 525 $scope.cargando = true;
521 } 526 }
522 }; 527 };
523 528
524 $scope.quitarArticulo = function(key) { 529 $scope.quitarArticulo = function(key) {
525 $scope.articulosTabla.splice(key, 1); 530 $scope.articulosTabla.splice(key, 1);
526 }; 531 };
527 532
528 $scope.editarArticulo = function(key, articulo) { 533 $scope.editarArticulo = function(key, articulo) {
529 if(key === 13) { 534 if(key === 13) {
530 if(articulo.cantidad === null || articulo.cantidad === 0 || 535 if(articulo.cantidad === null || articulo.cantidad === 0 ||
531 articulo.cantidad === undefined) { 536 articulo.cantidad === undefined) {
532 focaModalService.alert('El valor debe ser al menos 1'); 537 focaModalService.alert('El valor debe ser al menos 1');
533 return; 538 return;
534 } 539 }
535 articulo.editCantidad = false; 540 articulo.editCantidad = false;
536 articulo.editPrecio = false; 541 articulo.editPrecio = false;
537 } 542 }
538 }; 543 };
539 544
540 $scope.cambioEdit = function(articulo, propiedad) { 545 $scope.cambioEdit = function(articulo, propiedad) {
541 if(propiedad === 'cantidad') { 546 if(propiedad === 'cantidad') {
542 articulo.editCantidad = true; 547 articulo.editCantidad = true;
543 } else if(propiedad === 'precio') { 548 } else if(propiedad === 'precio') {
544 articulo.editPrecio = true; 549 articulo.editPrecio = true;
545 } 550 }
546 }; 551 };
547 552
548 $scope.limpiarFlete = function() { 553 $scope.limpiarFlete = function() {
549 $scope.notaPedido.fleteNombre = ''; 554 $scope.notaPedido.fleteNombre = '';
550 $scope.notaPedido.chofer = ''; 555 $scope.notaPedido.chofer = '';
551 $scope.notaPedido.vehiculo = ''; 556 $scope.notaPedido.vehiculo = '';
552 $scope.notaPedido.kilometros = ''; 557 $scope.notaPedido.kilometros = '';
553 $scope.notaPedido.costoUnitarioKmFlete = ''; 558 $scope.notaPedido.costoUnitarioKmFlete = '';
554 $scope.choferes = ''; 559 $scope.choferes = '';
555 $scope.vehiculos = ''; 560 $scope.vehiculos = '';
556 }; 561 };
557 562
558 $scope.limpiarPantalla = function() { 563 $scope.limpiarPantalla = function() {
559 $scope.limpiarFlete(); 564 $scope.limpiarFlete();
560 $scope.notaPedido.flete = '0'; 565 $scope.notaPedido.flete = '0';
561 $scope.notaPedido.bomba = '0'; 566 $scope.notaPedido.bomba = '0';
562 $scope.notaPedido.precioCondicion = ''; 567 $scope.notaPedido.precioCondicion = '';
563 $scope.articulosTabla = []; 568 $scope.articulosTabla = [];
564 $scope.notaPedido.vendedor.nombre = ''; 569 $scope.notaPedido.vendedor.nombre = '';
565 $scope.notaPedido.cliente = {nombre: ''}; 570 $scope.notaPedido.cliente = {nombre: ''};
566 $scope.notaPedido.domicilio = {dom: ''}; 571 $scope.notaPedido.domicilio = {dom: ''};
567 $scope.domiciliosCliente = []; 572 $scope.domiciliosCliente = [];
568 }; 573 };
569 574
570 $scope.resetFilter = function() { 575 $scope.resetFilter = function() {
571 $scope.articuloACargar = {}; 576 $scope.articuloACargar = {};
572 $scope.cargando = true; 577 $scope.cargando = true;
573 }; 578 };
574 //Recibe aviso si el teclado está en uso 579 //Recibe aviso si el teclado está en uso
575 $rootScope.$on('usarTeclado', function(event, data) { 580 $rootScope.$on('usarTeclado', function(event, data) {
576 if(data) { 581 if(data) {
577 $scope.mostrarTeclado = true; 582 $scope.mostrarTeclado = true;
578 return; 583 return;
579 } 584 }
580 $scope.mostrarTeclado = false; 585 $scope.mostrarTeclado = false;
581 }) 586 });
587
582 $scope.selectFocus = function($event) { 588 $scope.selectFocus = function($event) {
583 // Si el teclado esta en uso no selecciona el valor 589 // Si el teclado esta en uso no selecciona el valor
584 if($scope.mostrarTeclado) { 590 if($scope.mostrarTeclado) {
585 return; 591 return;
586 } 592 }
587 $event.target.select(); 593 $event.target.select();
588 }; 594 };
589 595
590 $scope.salir = function() { 596 $scope.salir = function() {
591 $location.path('/'); 597 $location.path('/');
592 }; 598 };
593 599
594 $scope.parsearATexto = function(articulo) { 600 $scope.parsearATexto = function(articulo) {
595 articulo.cantidad = parseFloat(articulo.cantidad); 601 articulo.cantidad = parseFloat(articulo.cantidad);
596 articulo.precio = parseFloat(articulo.precio); 602 articulo.precio = parseFloat(articulo.precio);
597 }; 603 };
598 604
599 function addCabecera(label, valor) { 605 function addCabecera(label, valor) {
600 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 606 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
601 if(propiedad.length === 1) { 607 if(propiedad.length === 1) {
602 propiedad[0].valor = valor; 608 propiedad[0].valor = valor;
603 } else { 609 } else {
604 $scope.cabecera.push({label: label, valor: valor}); 610 $scope.cabecera.push({label: label, valor: valor});
605 } 611 }
606 } 612 }
607 613
608 function removeCabecera(label) { 614 function removeCabecera(label) {
609 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 615 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
610 if(propiedad.length === 1) { 616 if(propiedad.length === 1) {
611 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); 617 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1);
612 } 618 }
613 } 619 }
614 620
615 function rellenar(relleno, longitud) { 621 function rellenar(relleno, longitud) {
616 relleno = '' + relleno; 622 relleno = '' + relleno;
617 while (relleno.length < longitud) { 623 while (relleno.length < longitud) {
618 relleno = '0' + relleno; 624 relleno = '0' + relleno;
619 } 625 }
620 626
621 return relleno; 627 return relleno;
622 } 628 }
623 } 629 }
624 ] 630 ]
625 ) 631 )
626 .controller('notaPedidoListaCtrl', [ 632 .controller('notaPedidoListaCtrl', [
627 '$scope', 633 '$scope',
628 'crearNotaPedidoService', 634 'crearNotaPedidoService',
629 '$location', 635 '$location',
630 function($scope, crearNotaPedidoService, $location) { 636 function($scope, crearNotaPedidoService, $location) {
631 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { 637 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) {
632 $scope.notaPedidos = datos.data; 638 $scope.notaPedidos = datos.data;
633 }); 639 });
634 $scope.editar = function(notaPedido) { 640 $scope.editar = function(notaPedido) {
635 crearNotaPedidoService.setNotaPedido(notaPedido); 641 crearNotaPedidoService.setNotaPedido(notaPedido);
636 $location.path('/venta-nota-pedido/abm/'); 642 $location.path('/venta-nota-pedido/abm/');
637 }; 643 };
638 $scope.crearPedido = function() { 644 $scope.crearPedido = function() {
639 crearNotaPedidoService.clearNotaPedido(); 645 crearNotaPedidoService.clearNotaPedido();
640 $location.path('/venta-nota-pedido/abm/'); 646 $location.path('/venta-nota-pedido/abm/');
641 }; 647 };
642 } 648 }
643 ]) 649 ])
644 .controller('focaCrearNotaPedidoFichaClienteController', [ 650 .controller('focaCrearNotaPedidoFichaClienteController', [
645 '$scope', 651 '$scope',
646 'crearNotaPedidoService', 652 'crearNotaPedidoService',
647 '$location', 653 '$location',
648 function($scope, crearNotaPedidoService, $location) { 654 function($scope, crearNotaPedidoService, $location) {
649 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { 655 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) {
650 $scope.notaPedidos = datos.data; 656 $scope.notaPedidos = datos.data;
651 }); 657 });
652 $scope.editar = function(notaPedido) { 658 $scope.editar = function(notaPedido) {
653 crearNotaPedidoService.setNotaPedido(notaPedido); 659 crearNotaPedidoService.setNotaPedido(notaPedido);
654 $location.path('/venta-nota-pedido/abm/'); 660 $location.path('/venta-nota-pedido/abm/');
655 }; 661 };
656 $scope.crearPedido = function() { 662 $scope.crearPedido = function() {
657 crearNotaPedidoService.clearNotaPedido(); 663 crearNotaPedidoService.clearNotaPedido();
658 $location.path('/venta-nota-pedido/abm/'); 664 $location.path('/venta-nota-pedido/abm/');
659 }; 665 };
660 } 666 }
661 ]); 667 ]);
662 668