Commit 73f747ccef1b290501987379ae4f503edaaf7af6

Authored by Eric Fernandez
1 parent d6d63dae0f
Exists in master

propiedades nuevas articulos

Showing 1 changed file with 10 additions and 1 deletions   Show diff stats
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 domicilioStamp: $scope.notaPedido.domicilioStamp, 172 domicilioStamp: $scope.notaPedido.domicilioStamp,
173 estado: 0, 173 estado: 0,
174 total: $scope.getTotal() 174 total: $scope.getTotal()
175 }; 175 };
176 crearNotaPedidoService.crearNotaPedido(notaPedido).then( 176 crearNotaPedidoService.crearNotaPedido(notaPedido).then(
177 function(data) { 177 function(data) {
178 notaPedidoBusinessService.addArticulos($scope.articulosTabla, 178 notaPedidoBusinessService.addArticulos($scope.articulosTabla,
179 data.data.id, $scope.notaPedido.cotizacion.VENDEDOR); 179 data.data.id, $scope.notaPedido.cotizacion.VENDEDOR);
180 focaSeguimientoService.guardarPosicion('crear nota pedido', ''); 180 focaSeguimientoService.guardarPosicion('crear nota pedido', '');
181 var plazos = $scope.plazosPagos; 181 var plazos = $scope.plazosPagos;
182 182
183 for(var j = 0; j < plazos.length; j++) { 183 for(var j = 0; j < plazos.length; j++) {
184 var json = { 184 var json = {
185 idPedido: data.data.id, 185 idPedido: data.data.id,
186 dias: plazos[j].dias 186 dias: plazos[j].dias
187 }; 187 };
188 crearNotaPedidoService.crearPlazosParaNotaPedido(json); 188 crearNotaPedidoService.crearPlazosParaNotaPedido(json);
189 } 189 }
190 notaPedidoBusinessService.addEstado(data.data.id, 190 notaPedidoBusinessService.addEstado(data.data.id,
191 $scope.notaPedido.vendedor.codigo); 191 $scope.notaPedido.vendedor.codigo);
192 192
193 focaModalService.alert('Nota pedido creada'); 193 focaModalService.alert('Nota pedido creada');
194 $scope.cabecera = []; 194 $scope.cabecera = [];
195 addCabecera('Moneda:', $scope.notaPedido.moneda.detalle); 195 addCabecera('Moneda:', $scope.notaPedido.moneda.detalle);
196 addCabecera( 196 addCabecera(
197 'Fecha cotizacion:', 197 'Fecha cotizacion:',
198 $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy') 198 $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy')
199 ); 199 );
200 addCabecera('Cotizacion:', $scope.notaPedido.cotizacion.VENDEDOR); 200 addCabecera('Cotizacion:', $scope.notaPedido.cotizacion.VENDEDOR);
201 $scope.notaPedido.vendedor = {}; 201 $scope.notaPedido.vendedor = {};
202 $scope.notaPedido.cliente = {}; 202 $scope.notaPedido.cliente = {};
203 $scope.notaPedido.proveedor = {}; 203 $scope.notaPedido.proveedor = {};
204 $scope.notaPedido.domicilio = {}; 204 $scope.notaPedido.domicilio = {};
205 $scope.notaPedido.flete = null; 205 $scope.notaPedido.flete = null;
206 $scope.notaPedido.fob = null; 206 $scope.notaPedido.fob = null;
207 $scope.notaPedido.bomba = null; 207 $scope.notaPedido.bomba = null;
208 $scope.notaPedido.kilometros = null; 208 $scope.notaPedido.kilometros = null;
209 $scope.articulosTabla = []; 209 $scope.articulosTabla = [];
210 }, 210 },
211 function(error) { 211 function(error) {
212 focaModalService.alert('Hubo un error al crear la nota de pedido'); 212 focaModalService.alert('Hubo un error al crear la nota de pedido');
213 console.info(error); 213 console.info(error);
214 } 214 }
215 ); 215 );
216 }; 216 };
217 217
218 $scope.seleccionarArticulo = function() { 218 $scope.seleccionarArticulo = function() {
219 if ($scope.idLista === undefined) { 219 if ($scope.idLista === undefined) {
220 focaModalService.alert( 220 focaModalService.alert(
221 'Primero seleccione una lista de precio y condicion'); 221 'Primero seleccione una lista de precio y condicion');
222 return; 222 return;
223 } 223 }
224 var modalInstance = $uibModal.open( 224 var modalInstance = $uibModal.open(
225 { 225 {
226 ariaLabelledBy: 'Busqueda de Productos', 226 ariaLabelledBy: 'Busqueda de Productos',
227 templateUrl: 'modal-busqueda-productos.html', 227 templateUrl: 'modal-busqueda-productos.html',
228 controller: 'modalBusquedaProductosCtrl', 228 controller: 'modalBusquedaProductosCtrl',
229 resolve: { 229 resolve: {
230 parametroProducto: { 230 parametroProducto: {
231 idLista: $scope.idLista, 231 idLista: $scope.idLista,
232 cotizacion: $scope.notaPedido.cotizacion.VENDEDOR, 232 cotizacion: $scope.notaPedido.cotizacion.VENDEDOR,
233 simbolo: $scope.notaPedido.moneda.simbolo 233 simbolo: $scope.notaPedido.moneda.simbolo
234 } 234 }
235 }, 235 },
236 size: 'lg' 236 size: 'lg'
237 } 237 }
238 ); 238 );
239 modalInstance.result.then( 239 modalInstance.result.then(
240 function(producto) { 240 function(producto) {
241 var newArt = 241 var newArt =
242 { 242 {
243 id: 0, 243 id: 0,
244 codigo: producto.codigo, 244 codigo: producto.codigo,
245 sector: producto.sector, 245 sector: producto.sector,
246 sectorCodigo: producto.sector + '-' + producto.codigo, 246 sectorCodigo: producto.sector + '-' + producto.codigo,
247 descripcion: producto.descripcion, 247 descripcion: producto.descripcion,
248 item: $scope.articulosTabla.length + 1, 248 item: $scope.articulosTabla.length + 1,
249 nombre: producto.descripcion, 249 nombre: producto.descripcion,
250 precio: parseFloat(producto.precio.toFixed(4)), 250 precio: parseFloat(producto.precio.toFixed(4)),
251 costoUnitario: producto.costo, 251 costoUnitario: producto.costo,
252 editCantidad: false, 252 editCantidad: false,
253 editPrecio: false 253 editPrecio: false,
254 rubro: producto.CodRub,
255 exentoUnitario: producto.precio,
256 ivaUnitario: producto.IMPIVA,
257 impuestoInternoUnitario: producto.ImpInt,
258 impuestoInterno1Unitario: producto.ImpInt2,
259 impuestoInterno2Unitario: producto.ImpInt3,
260 precioLista: producto.precio,
261 combustible: 1,
262 facturado: 0
254 }; 263 };
255 $scope.articuloACargar = newArt; 264 $scope.articuloACargar = newArt;
256 $scope.cargando = false; 265 $scope.cargando = false;
257 }, function() { 266 }, function() {
258 // funcion ejecutada cuando se cancela el modal 267 // funcion ejecutada cuando se cancela el modal
259 } 268 }
260 ); 269 );
261 }; 270 };
262 271
263 $scope.seleccionarVendedor = function() { 272 $scope.seleccionarVendedor = function() {
264 var modalInstance = $uibModal.open( 273 var modalInstance = $uibModal.open(
265 { 274 {
266 ariaLabelledBy: 'Busqueda de Vendedores', 275 ariaLabelledBy: 'Busqueda de Vendedores',
267 templateUrl: 'modal-vendedores.html', 276 templateUrl: 'modal-vendedores.html',
268 controller: 'modalVendedoresCtrl', 277 controller: 'modalVendedoresCtrl',
269 size: 'lg' 278 size: 'lg'
270 } 279 }
271 ); 280 );
272 modalInstance.result.then( 281 modalInstance.result.then(
273 function(vendedor) { 282 function(vendedor) {
274 addCabecera('Vendedor:', vendedor.NomVen); 283 addCabecera('Vendedor:', vendedor.NomVen);
275 $scope.notaPedido.vendedor.codigo = vendedor.CodVen; 284 $scope.notaPedido.vendedor.codigo = vendedor.CodVen;
276 }, function() { 285 }, function() {
277 286
278 } 287 }
279 ); 288 );
280 }; 289 };
281 290
282 $scope.seleccionarProveedor = function() { 291 $scope.seleccionarProveedor = function() {
283 var modalInstance = $uibModal.open( 292 var modalInstance = $uibModal.open(
284 { 293 {
285 ariaLabelledBy: 'Busqueda de Proveedor', 294 ariaLabelledBy: 'Busqueda de Proveedor',
286 templateUrl: 'modal-proveedor.html', 295 templateUrl: 'modal-proveedor.html',
287 controller: 'focaModalProveedorCtrl', 296 controller: 'focaModalProveedorCtrl',
288 size: 'lg', 297 size: 'lg',
289 resolve: { 298 resolve: {
290 transportista: function() { 299 transportista: function() {
291 return false; 300 return false;
292 } 301 }
293 } 302 }
294 } 303 }
295 ); 304 );
296 modalInstance.result.then( 305 modalInstance.result.then(
297 function(proveedor) { 306 function(proveedor) {
298 $scope.notaPedido.proveedor.codigo = proveedor.COD; 307 $scope.notaPedido.proveedor.codigo = proveedor.COD;
299 addCabecera('Proveedor:', proveedor.NOM); 308 addCabecera('Proveedor:', proveedor.NOM);
300 }, function() { 309 }, function() {
301 310
302 } 311 }
303 ); 312 );
304 }; 313 };
305 314
306 $scope.seleccionarCliente = function() { 315 $scope.seleccionarCliente = function() {
307 316
308 var modalInstance = $uibModal.open( 317 var modalInstance = $uibModal.open(
309 { 318 {
310 ariaLabelledBy: 'Busqueda de Cliente', 319 ariaLabelledBy: 'Busqueda de Cliente',
311 templateUrl: 'foca-busqueda-cliente-modal.html', 320 templateUrl: 'foca-busqueda-cliente-modal.html',
312 controller: 'focaBusquedaClienteModalController', 321 controller: 'focaBusquedaClienteModalController',
313 size: 'lg' 322 size: 'lg'
314 } 323 }
315 ); 324 );
316 modalInstance.result.then( 325 modalInstance.result.then(
317 function(cliente) { 326 function(cliente) {
318 $scope.abrirModalDomicilios(cliente); 327 $scope.abrirModalDomicilios(cliente);
319 }, function() { 328 }, function() {
320 329
321 } 330 }
322 ); 331 );
323 }; 332 };
324 333
325 $scope.abrirModalDomicilios = function(cliente) { 334 $scope.abrirModalDomicilios = function(cliente) {
326 var modalInstanceDomicilio = $uibModal.open( 335 var modalInstanceDomicilio = $uibModal.open(
327 { 336 {
328 ariaLabelledBy: 'Busqueda de Domicilios', 337 ariaLabelledBy: 'Busqueda de Domicilios',
329 templateUrl: 'modal-domicilio.html', 338 templateUrl: 'modal-domicilio.html',
330 controller: 'focaModalDomicilioController', 339 controller: 'focaModalDomicilioController',
331 resolve: { idCliente: function() { return cliente.cod; }}, 340 resolve: { idCliente: function() { return cliente.cod; }},
332 size: 'lg', 341 size: 'lg',
333 } 342 }
334 ); 343 );
335 modalInstanceDomicilio.result.then( 344 modalInstanceDomicilio.result.then(
336 function(domicilio) { 345 function(domicilio) {
337 $scope.notaPedido.domicilio.id = domicilio.id; 346 $scope.notaPedido.domicilio.id = domicilio.id;
338 $scope.notaPedido.cliente = cliente; 347 $scope.notaPedido.cliente = cliente;
339 addCabecera('Cliente:', cliente.nom); 348 addCabecera('Cliente:', cliente.nom);
340 var domicilioStamp = 349 var domicilioStamp =
341 domicilio.Calle + ' ' + domicilio.Numero + ', ' + 350 domicilio.Calle + ' ' + domicilio.Numero + ', ' +
342 domicilio.Localidad + ', ' + domicilio.Provincia; 351 domicilio.Localidad + ', ' + domicilio.Provincia;
343 $scope.notaPedido.domicilioStamp = domicilioStamp; 352 $scope.notaPedido.domicilioStamp = domicilioStamp;
344 addCabecera('Domicilio:', domicilioStamp); 353 addCabecera('Domicilio:', domicilioStamp);
345 }, function() { 354 }, function() {
346 $scope.seleccionarCliente(); 355 $scope.seleccionarCliente();
347 return; 356 return;
348 } 357 }
349 ); 358 );
350 }; 359 };
351 360
352 $scope.mostrarFichaCliente = function() { 361 $scope.mostrarFichaCliente = function() {
353 $uibModal.open( 362 $uibModal.open(
354 { 363 {
355 ariaLabelledBy: 'Datos del Cliente', 364 ariaLabelledBy: 'Datos del Cliente',
356 templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', 365 templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html',
357 controller: 'focaCrearNotaPedidoFichaClienteController', 366 controller: 'focaCrearNotaPedidoFichaClienteController',
358 size: 'lg' 367 size: 'lg'
359 } 368 }
360 ); 369 );
361 }; 370 };
362 371
363 $scope.getTotal = function() { 372 $scope.getTotal = function() {
364 var total = 0; 373 var total = 0;
365 var arrayTempArticulos = $scope.articulosTabla; 374 var arrayTempArticulos = $scope.articulosTabla;
366 for (var i = 0; i < arrayTempArticulos.length; i++) { 375 for (var i = 0; i < arrayTempArticulos.length; i++) {
367 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; 376 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad;
368 } 377 }
369 return parseFloat(total.toFixed(2)); 378 return parseFloat(total.toFixed(2));
370 }; 379 };
371 380
372 $scope.getSubTotal = function() { 381 $scope.getSubTotal = function() {
373 if($scope.articuloACargar) { 382 if($scope.articuloACargar) {
374 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; 383 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
375 } 384 }
376 }; 385 };
377 386
378 $scope.abrirModalListaPrecio = function() { 387 $scope.abrirModalListaPrecio = function() {
379 var modalInstance = $uibModal.open( 388 var modalInstance = $uibModal.open(
380 { 389 {
381 ariaLabelledBy: 'Busqueda de Precio Condición', 390 ariaLabelledBy: 'Busqueda de Precio Condición',
382 templateUrl: 'modal-precio-condicion.html', 391 templateUrl: 'modal-precio-condicion.html',
383 controller: 'focaModalPrecioCondicionController', 392 controller: 'focaModalPrecioCondicionController',
384 size: 'lg' 393 size: 'lg'
385 } 394 }
386 ); 395 );
387 modalInstance.result.then( 396 modalInstance.result.then(
388 function(precioCondicion) { 397 function(precioCondicion) {
389 var cabecera = ''; 398 var cabecera = '';
390 var plazosConcat = ''; 399 var plazosConcat = '';
391 if(!Array.isArray(precioCondicion)) { 400 if(!Array.isArray(precioCondicion)) {
392 $scope.notaPedido.idPrecioCondicion = precioCondicion.id; 401 $scope.notaPedido.idPrecioCondicion = precioCondicion.id;
393 $scope.plazosPagos = precioCondicion.plazoPago; 402 $scope.plazosPagos = precioCondicion.plazoPago;
394 $scope.idLista = precioCondicion.idListaPrecio; 403 $scope.idLista = precioCondicion.idListaPrecio;
395 for(var i = 0; i < precioCondicion.plazoPago.length; i++) { 404 for(var i = 0; i < precioCondicion.plazoPago.length; i++) {
396 plazosConcat += precioCondicion.plazoPago[i].dias + ' '; 405 plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
397 } 406 }
398 cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); 407 cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim();
399 } else { //Cuando se ingresan los plazos manualmente 408 } else { //Cuando se ingresan los plazos manualmente
400 $scope.notaPedido.idPrecioCondicion = 0; 409 $scope.notaPedido.idPrecioCondicion = 0;
401 $scope.idLista = -1; //-1, el modal productos busca todos los productos 410 $scope.idLista = -1; //-1, el modal productos busca todos los productos
402 $scope.plazosPagos = precioCondicion; 411 $scope.plazosPagos = precioCondicion;
403 for(var j = 0; j < precioCondicion.length; j++) { 412 for(var j = 0; j < precioCondicion.length; j++) {
404 plazosConcat += precioCondicion[j].dias + ' '; 413 plazosConcat += precioCondicion[j].dias + ' ';
405 } 414 }
406 cabecera = 'Ingreso manual ' + plazosConcat.trim(); 415 cabecera = 'Ingreso manual ' + plazosConcat.trim();
407 } 416 }
408 $scope.articulosTabla = []; 417 $scope.articulosTabla = [];
409 addCabecera('Precios y condiciones:', cabecera); 418 addCabecera('Precios y condiciones:', cabecera);
410 }, function() { 419 }, function() {
411 420
412 } 421 }
413 ); 422 );
414 }; 423 };
415 424
416 $scope.abrirModalFlete = function() { 425 $scope.abrirModalFlete = function() {
417 var modalInstance = $uibModal.open( 426 var modalInstance = $uibModal.open(
418 { 427 {
419 ariaLabelledBy: 'Busqueda de Flete', 428 ariaLabelledBy: 'Busqueda de Flete',
420 templateUrl: 'modal-flete.html', 429 templateUrl: 'modal-flete.html',
421 controller: 'focaModalFleteController', 430 controller: 'focaModalFleteController',
422 size: 'lg', 431 size: 'lg',
423 resolve: { 432 resolve: {
424 parametrosFlete: 433 parametrosFlete:
425 function() { 434 function() {
426 return { 435 return {
427 flete: $scope.notaPedido.flete ? '1' : 436 flete: $scope.notaPedido.flete ? '1' :
428 ($scope.notaPedido.fob ? 'FOB' : 437 ($scope.notaPedido.fob ? 'FOB' :
429 ($scope.notaPedido.flete === undefined ? null : '0')), 438 ($scope.notaPedido.flete === undefined ? null : '0')),
430 bomba: $scope.notaPedido.bomba ? '1' : 439 bomba: $scope.notaPedido.bomba ? '1' :
431 ($scope.notaPedido.bomba === undefined ? null : '0'), 440 ($scope.notaPedido.bomba === undefined ? null : '0'),
432 kilometros: $scope.notaPedido.kilometros 441 kilometros: $scope.notaPedido.kilometros
433 }; 442 };
434 } 443 }
435 } 444 }
436 } 445 }
437 ); 446 );
438 modalInstance.result.then( 447 modalInstance.result.then(
439 function(datos) { 448 function(datos) {
440 $scope.notaPedido.flete = datos.flete; 449 $scope.notaPedido.flete = datos.flete;
441 $scope.notaPedido.fob = datos.FOB; 450 $scope.notaPedido.fob = datos.FOB;
442 $scope.notaPedido.bomba = datos.bomba; 451 $scope.notaPedido.bomba = datos.bomba;
443 $scope.notaPedido.kilometros = datos.kilometros; 452 $scope.notaPedido.kilometros = datos.kilometros;
444 453
445 addCabecera('Flete:', datos.flete ? 'Si' : 454 addCabecera('Flete:', datos.flete ? 'Si' :
446 ($scope.notaPedido.fob ? 'FOB' : 'No')); 455 ($scope.notaPedido.fob ? 'FOB' : 'No'));
447 if(datos.flete) { 456 if(datos.flete) {
448 addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); 457 addCabecera('Bomba:', datos.bomba ? 'Si' : 'No');
449 addCabecera('Kilometros:', datos.kilometros); 458 addCabecera('Kilometros:', datos.kilometros);
450 } else { 459 } else {
451 removeCabecera('Bomba:'); 460 removeCabecera('Bomba:');
452 removeCabecera('Kilometros:'); 461 removeCabecera('Kilometros:');
453 $scope.notaPedido.fob = false; 462 $scope.notaPedido.fob = false;
454 $scope.notaPedido.bomba = false; 463 $scope.notaPedido.bomba = false;
455 $scope.notaPedido.kilometros = null; 464 $scope.notaPedido.kilometros = null;
456 } 465 }
457 }, function() { 466 }, function() {
458 467
459 } 468 }
460 ); 469 );
461 }; 470 };
462 471
463 $scope.abrirModalMoneda = function() { 472 $scope.abrirModalMoneda = function() {
464 var modalInstance = $uibModal.open( 473 var modalInstance = $uibModal.open(
465 { 474 {
466 ariaLabelledBy: 'Busqueda de Moneda', 475 ariaLabelledBy: 'Busqueda de Moneda',
467 templateUrl: 'modal-moneda.html', 476 templateUrl: 'modal-moneda.html',
468 controller: 'focaModalMonedaController', 477 controller: 'focaModalMonedaController',
469 size: 'lg' 478 size: 'lg'
470 } 479 }
471 ); 480 );
472 modalInstance.result.then( 481 modalInstance.result.then(
473 function(moneda) { 482 function(moneda) {
474 $scope.abrirModalCotizacion(moneda); 483 $scope.abrirModalCotizacion(moneda);
475 }, function() { 484 }, function() {
476 485
477 } 486 }
478 ); 487 );
479 }; 488 };
480 489
481 $scope.abrirModalCotizacion = function(moneda) { 490 $scope.abrirModalCotizacion = function(moneda) {
482 var modalInstance = $uibModal.open( 491 var modalInstance = $uibModal.open(
483 { 492 {
484 ariaLabelledBy: 'Busqueda de Cotización', 493 ariaLabelledBy: 'Busqueda de Cotización',
485 templateUrl: 'modal-cotizacion.html', 494 templateUrl: 'modal-cotizacion.html',
486 controller: 'focaModalCotizacionController', 495 controller: 'focaModalCotizacionController',
487 size: 'lg', 496 size: 'lg',
488 resolve: {idMoneda: function() {return moneda.ID;}} 497 resolve: {idMoneda: function() {return moneda.ID;}}
489 } 498 }
490 ); 499 );
491 modalInstance.result.then( 500 modalInstance.result.then(
492 function(cotizacion) { 501 function(cotizacion) {
493 var articulosTablaTemp = $scope.articulosTabla; 502 var articulosTablaTemp = $scope.articulosTabla;
494 for(var i = 0; i < articulosTablaTemp.length; i++) { 503 for(var i = 0; i < articulosTablaTemp.length; i++) {
495 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * 504 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio *
496 $scope.notaPedido.cotizacion.VENDEDOR; 505 $scope.notaPedido.cotizacion.VENDEDOR;
497 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / 506 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio /
498 cotizacion.VENDEDOR; 507 cotizacion.VENDEDOR;
499 } 508 }
500 $scope.articulosTabla = articulosTablaTemp; 509 $scope.articulosTabla = articulosTablaTemp;
501 $scope.notaPedido.moneda = { 510 $scope.notaPedido.moneda = {
502 id: moneda.ID, 511 id: moneda.ID,
503 detalle: moneda.DETALLE, 512 detalle: moneda.DETALLE,
504 simbolo: moneda.SIMBOLO 513 simbolo: moneda.SIMBOLO
505 }; 514 };
506 $scope.notaPedido.cotizacion = cotizacion; 515 $scope.notaPedido.cotizacion = cotizacion;
507 addCabecera('Moneda:', moneda.DETALLE); 516 addCabecera('Moneda:', moneda.DETALLE);
508 addCabecera( 517 addCabecera(
509 'Fecha cotizacion:', 518 'Fecha cotizacion:',
510 $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') 519 $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
511 ); 520 );
512 addCabecera('Cotizacion:', cotizacion.VENDEDOR); 521 addCabecera('Cotizacion:', cotizacion.VENDEDOR);
513 }, function() { 522 }, function() {
514 523
515 } 524 }
516 ); 525 );
517 }; 526 };
518 527
519 $scope.agregarATabla = function(key) { 528 $scope.agregarATabla = function(key) {
520 if(key === 13) { 529 if(key === 13) {
521 if($scope.articuloACargar.cantidad === undefined || 530 if($scope.articuloACargar.cantidad === undefined ||
522 $scope.articuloACargar.cantidad === 0 || 531 $scope.articuloACargar.cantidad === 0 ||
523 $scope.articuloACargar.cantidad === null ) { 532 $scope.articuloACargar.cantidad === null ) {
524 focaModalService.alert('El valor debe ser al menos 1'); 533 focaModalService.alert('El valor debe ser al menos 1');
525 return; 534 return;
526 } 535 }
527 delete $scope.articuloACargar.sectorCodigo; 536 delete $scope.articuloACargar.sectorCodigo;
528 $scope.articulosTabla.push($scope.articuloACargar); 537 $scope.articulosTabla.push($scope.articuloACargar);
529 $scope.cargando = true; 538 $scope.cargando = true;
530 } 539 }
531 }; 540 };
532 541
533 $scope.quitarArticulo = function(key) { 542 $scope.quitarArticulo = function(key) {
534 $scope.articulosTabla.splice(key, 1); 543 $scope.articulosTabla.splice(key, 1);
535 }; 544 };
536 545
537 $scope.editarArticulo = function(key, articulo) { 546 $scope.editarArticulo = function(key, articulo) {
538 if(key === 13) { 547 if(key === 13) {
539 if(articulo.cantidad === null || articulo.cantidad === 0 || 548 if(articulo.cantidad === null || articulo.cantidad === 0 ||
540 articulo.cantidad === undefined) { 549 articulo.cantidad === undefined) {
541 focaModalService.alert('El valor debe ser al menos 1'); 550 focaModalService.alert('El valor debe ser al menos 1');
542 return; 551 return;
543 } 552 }
544 articulo.editCantidad = false; 553 articulo.editCantidad = false;
545 articulo.editPrecio = false; 554 articulo.editPrecio = false;
546 } 555 }
547 }; 556 };
548 557
549 $scope.cambioEdit = function(articulo, propiedad) { 558 $scope.cambioEdit = function(articulo, propiedad) {
550 if(propiedad === 'cantidad') { 559 if(propiedad === 'cantidad') {
551 articulo.editCantidad = true; 560 articulo.editCantidad = true;
552 } else if(propiedad === 'precio') { 561 } else if(propiedad === 'precio') {
553 articulo.editPrecio = true; 562 articulo.editPrecio = true;
554 } 563 }
555 }; 564 };
556 565
557 $scope.limpiarFlete = function() { 566 $scope.limpiarFlete = function() {
558 $scope.notaPedido.fleteNombre = ''; 567 $scope.notaPedido.fleteNombre = '';
559 $scope.notaPedido.chofer = ''; 568 $scope.notaPedido.chofer = '';
560 $scope.notaPedido.vehiculo = ''; 569 $scope.notaPedido.vehiculo = '';
561 $scope.notaPedido.kilometros = ''; 570 $scope.notaPedido.kilometros = '';
562 $scope.notaPedido.costoUnitarioKmFlete = ''; 571 $scope.notaPedido.costoUnitarioKmFlete = '';
563 $scope.choferes = ''; 572 $scope.choferes = '';
564 $scope.vehiculos = ''; 573 $scope.vehiculos = '';
565 }; 574 };
566 575
567 $scope.limpiarPantalla = function() { 576 $scope.limpiarPantalla = function() {
568 $scope.limpiarFlete(); 577 $scope.limpiarFlete();
569 $scope.notaPedido.flete = '0'; 578 $scope.notaPedido.flete = '0';
570 $scope.notaPedido.bomba = '0'; 579 $scope.notaPedido.bomba = '0';
571 $scope.notaPedido.precioCondicion = ''; 580 $scope.notaPedido.precioCondicion = '';
572 $scope.articulosTabla = []; 581 $scope.articulosTabla = [];
573 $scope.notaPedido.vendedor.nombre = ''; 582 $scope.notaPedido.vendedor.nombre = '';
574 $scope.notaPedido.cliente = {nombre: ''}; 583 $scope.notaPedido.cliente = {nombre: ''};
575 $scope.notaPedido.domicilio = {dom: ''}; 584 $scope.notaPedido.domicilio = {dom: ''};
576 $scope.domiciliosCliente = []; 585 $scope.domiciliosCliente = [];
577 }; 586 };
578 587
579 $scope.resetFilter = function() { 588 $scope.resetFilter = function() {
580 $scope.articuloACargar = {}; 589 $scope.articuloACargar = {};
581 $scope.cargando = true; 590 $scope.cargando = true;
582 }; 591 };
583 //Recibe aviso si el teclado está en uso 592 //Recibe aviso si el teclado está en uso
584 $rootScope.$on('usarTeclado', function(event, data) { 593 $rootScope.$on('usarTeclado', function(event, data) {
585 if(data) { 594 if(data) {
586 $scope.mostrarTeclado = true; 595 $scope.mostrarTeclado = true;
587 return; 596 return;
588 } 597 }
589 $scope.mostrarTeclado = false; 598 $scope.mostrarTeclado = false;
590 }); 599 });
591 600
592 $scope.selectFocus = function($event) { 601 $scope.selectFocus = function($event) {
593 // Si el teclado esta en uso no selecciona el valor 602 // Si el teclado esta en uso no selecciona el valor
594 if($scope.mostrarTeclado) { 603 if($scope.mostrarTeclado) {
595 return; 604 return;
596 } 605 }
597 $event.target.select(); 606 $event.target.select();
598 }; 607 };
599 608
600 $scope.salir = function() { 609 $scope.salir = function() {
601 $location.path('/'); 610 $location.path('/');
602 }; 611 };
603 612
604 $scope.parsearATexto = function(articulo) { 613 $scope.parsearATexto = function(articulo) {
605 articulo.cantidad = parseFloat(articulo.cantidad); 614 articulo.cantidad = parseFloat(articulo.cantidad);
606 articulo.precio = parseFloat(articulo.precio); 615 articulo.precio = parseFloat(articulo.precio);
607 }; 616 };
608 617
609 function addCabecera(label, valor) { 618 function addCabecera(label, valor) {
610 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 619 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
611 if(propiedad.length === 1) { 620 if(propiedad.length === 1) {
612 propiedad[0].valor = valor; 621 propiedad[0].valor = valor;
613 } else { 622 } else {
614 $scope.cabecera.push({label: label, valor: valor}); 623 $scope.cabecera.push({label: label, valor: valor});
615 } 624 }
616 } 625 }
617 626
618 function removeCabecera(label) { 627 function removeCabecera(label) {
619 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); 628 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
620 if(propiedad.length === 1) { 629 if(propiedad.length === 1) {
621 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); 630 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1);
622 } 631 }
623 } 632 }
624 633
625 function rellenar(relleno, longitud) { 634 function rellenar(relleno, longitud) {
626 relleno = '' + relleno; 635 relleno = '' + relleno;
627 while (relleno.length < longitud) { 636 while (relleno.length < longitud) {
628 relleno = '0' + relleno; 637 relleno = '0' + relleno;
629 } 638 }
630 639
631 return relleno; 640 return relleno;
632 } 641 }
633 } 642 }
634 ] 643 ]
635 ) 644 )
636 .controller('notaPedidoListaCtrl', [ 645 .controller('notaPedidoListaCtrl', [
637 '$scope', 646 '$scope',
638 'crearNotaPedidoService', 647 'crearNotaPedidoService',
639 '$location', 648 '$location',
640 function($scope, crearNotaPedidoService, $location) { 649 function($scope, crearNotaPedidoService, $location) {
641 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { 650 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) {
642 $scope.notaPedidos = datos.data; 651 $scope.notaPedidos = datos.data;
643 }); 652 });
644 $scope.editar = function(notaPedido) { 653 $scope.editar = function(notaPedido) {
645 crearNotaPedidoService.setNotaPedido(notaPedido); 654 crearNotaPedidoService.setNotaPedido(notaPedido);
646 $location.path('/venta-nota-pedido/abm/'); 655 $location.path('/venta-nota-pedido/abm/');
647 }; 656 };
648 $scope.crearPedido = function() { 657 $scope.crearPedido = function() {
649 crearNotaPedidoService.clearNotaPedido(); 658 crearNotaPedidoService.clearNotaPedido();
650 $location.path('/venta-nota-pedido/abm/'); 659 $location.path('/venta-nota-pedido/abm/');
651 }; 660 };
652 } 661 }
653 ]) 662 ])
654 .controller('focaCrearNotaPedidoFichaClienteController', [ 663 .controller('focaCrearNotaPedidoFichaClienteController', [
655 '$scope', 664 '$scope',
656 'crearNotaPedidoService', 665 'crearNotaPedidoService',
657 '$location', 666 '$location',
658 function($scope, crearNotaPedidoService, $location) { 667 function($scope, crearNotaPedidoService, $location) {
659 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { 668 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) {
660 $scope.notaPedidos = datos.data; 669 $scope.notaPedidos = datos.data;
661 }); 670 });
662 $scope.editar = function(notaPedido) { 671 $scope.editar = function(notaPedido) {
663 crearNotaPedidoService.setNotaPedido(notaPedido); 672 crearNotaPedidoService.setNotaPedido(notaPedido);
664 $location.path('/venta-nota-pedido/abm/'); 673 $location.path('/venta-nota-pedido/abm/');
665 }; 674 };
666 $scope.crearPedido = function() { 675 $scope.crearPedido = function() {
667 crearNotaPedidoService.clearNotaPedido(); 676 crearNotaPedidoService.clearNotaPedido();
668 $location.path('/venta-nota-pedido/abm/'); 677 $location.path('/venta-nota-pedido/abm/');
669 }; 678 };
670 } 679 }
671 ]); 680 ]);
672 681