Commit 7ac95183a619851146c3981962c90f523ac52cd9

Authored by Eric Fernandez
1 parent 580b199d2d
Exists in master

espacio innecesario

Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
src/js/controller.js
1 angular.module('focaCrearNotaPedido') 1 angular.module('focaCrearNotaPedido')
2 .controller('notaPedidoCtrl', 2 .controller('notaPedidoCtrl',
3 ['$scope', '$uibModal', 'crearNotaPedidoService', 'focaModalService', 3 ['$scope', '$uibModal', 'crearNotaPedidoService', 'focaModalService',
4 function($scope, $uibModal, crearNotaPedidoService, focaModalService) { 4 function($scope, $uibModal, crearNotaPedidoService, focaModalService) {
5 $scope.show = false; 5 $scope.show = false;
6 $scope.cargando = true; 6 $scope.cargando = true;
7 $scope.dateOptions = { 7 $scope.dateOptions = {
8 maxDate: new Date(), 8 maxDate: new Date(),
9 minDate: new Date(2010, 0, 1) 9 minDate: new Date(2010, 0, 1)
10 }; 10 };
11 $scope.notaPedido = { 11 $scope.notaPedido = {
12 vendedor: {}, 12 vendedor: {},
13 cliente: {}, 13 cliente: {},
14 domicilio: { dom: ''} 14 domicilio: { dom: ''}
15 }; 15 };
16 $scope.articulosTabla = []; 16 $scope.articulosTabla = [];
17 var idLista; 17 var idLista;
18 var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); 18 var notaPedidoTemp = crearNotaPedidoService.getNotaPedido();
19 crearNotaPedidoService.getPrecioCondicion().then( 19 crearNotaPedidoService.getPrecioCondicion().then(
20 function(res) { 20 function(res) {
21 $scope.precioCondiciones = res.data; 21 $scope.precioCondiciones = res.data;
22 } 22 }
23 ); 23 );
24 if (notaPedidoTemp !== undefined) { 24 if (notaPedidoTemp !== undefined) {
25 notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); 25 notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga);
26 $scope.notaPedido = notaPedidoTemp; 26 $scope.notaPedido = notaPedidoTemp;
27 $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); 27 $scope.notaPedido.flete = ($scope.notaPedido.flete).toString();
28 $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); 28 $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString();
29 idLista = $scope.notaPedido.precioCondicion; 29 idLista = $scope.notaPedido.precioCondicion;
30 crearNotaPedidoService 30 crearNotaPedidoService
31 .getArticulosByIdNotaPedido($scope.notaPedido.id).then( 31 .getArticulosByIdNotaPedido($scope.notaPedido.id).then(
32 function(res) { 32 function(res) {
33 $scope.articulosTabla = res.data; 33 $scope.articulosTabla = res.data;
34 } 34 }
35 ); 35 );
36 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO 36 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO
37 //(NO REQUERIDO EN ESTA VERSION) 37 //(NO REQUERIDO EN ESTA VERSION)
38 // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( 38 // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then(
39 // function(res) { 39 // function(res) {
40 // $scope.notaPedido.domicilio = res.data; 40 // $scope.notaPedido.domicilio = res.data;
41 // } 41 // }
42 // ); 42 // );
43 } else { 43 } else {
44 $scope.notaPedido.fechaCarga = new Date(); 44 $scope.notaPedido.fechaCarga = new Date();
45 $scope.notaPedido.bomba = '0'; 45 $scope.notaPedido.bomba = '0';
46 $scope.notaPedido.flete = '0'; 46 $scope.notaPedido.flete = '0';
47 idLista = undefined; 47 idLista = undefined;
48 } 48 }
49 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO 49 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO
50 // $scope.addNewDom = function() { 50 // $scope.addNewDom = function() {
51 // $scope.notaPedido.domicilio.push({ 'id': 0 }); 51 // $scope.notaPedido.domicilio.push({ 'id': 0 });
52 // }; 52 // };
53 // $scope.removeNewChoice = function(choice) { 53 // $scope.removeNewChoice = function(choice) {
54 // if ($scope.notaPedido.domicilio.length > 1) { 54 // if ($scope.notaPedido.domicilio.length > 1) {
55 // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( 55 // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex(
56 // function(c) { 56 // function(c) {
57 // return c.$$hashKey === choice.$$hashKey; 57 // return c.$$hashKey === choice.$$hashKey;
58 // } 58 // }
59 // ), 1); 59 // ), 1);
60 // } 60 // }
61 // }; 61 // };
62 $scope.crearNotaPedido = function() { 62 $scope.crearNotaPedido = function() {
63 if($scope.articulosTabla.length === 0) { 63 if($scope.articulosTabla.length === 0) {
64 focaModalService.alert('Debe cargar almenos un articulo'); 64 focaModalService.alert('Debe cargar almenos un articulo');
65 return; 65 return;
66 } 66 }
67 if($scope.notaPedido.domicilio.id === undefined) { 67 if($scope.notaPedido.domicilio.id === undefined) {
68 $scope.notaPedido.domicilio.id = 0; 68 $scope.notaPedido.domicilio.id = 0;
69 } 69 }
70 var date = new Date(); 70 var date = new Date();
71 var notaPedido = { 71 var notaPedido = {
72 id: 0, 72 id: 0,
73 fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) 73 fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000))
74 .toISOString().slice(0, 19).replace('T', ' '), 74 .toISOString().slice(0, 19).replace('T', ' '),
75 vendedor: $scope.notaPedido.vendedor.nombre, 75 vendedor: $scope.notaPedido.vendedor.nombre,
76 idCliente: $scope.notaPedido.cliente.id, 76 idCliente: $scope.notaPedido.cliente.id,
77 domicilio: $scope.notaPedido.domicilio, 77 domicilio: $scope.notaPedido.domicilio,
78 precioCondicion: $scope.notaPedido.precioCondicion, 78 precioCondicion: $scope.notaPedido.precioCondicion,
79 bomba: $scope.notaPedido.bomba, 79 bomba: $scope.notaPedido.bomba,
80 flete: $scope.notaPedido.flete, 80 flete: $scope.notaPedido.flete,
81 total: $scope.getTotal() 81 total: $scope.getTotal()
82 }; 82 };
83 crearNotaPedidoService.crearNotaPedido(notaPedido).then( 83 crearNotaPedidoService.crearNotaPedido(notaPedido).then(
84 function(data) { 84 function(data) {
85 focaModalService.alert('Nota pedido creada'); 85 focaModalService.alert('Nota pedido creada');
86 if($scope.notaPedido.flete === 1) { 86 if($scope.notaPedido.flete === 1) {
87 var flete = { 87 var flete = {
88 idNotaPedido: data.data.id, 88 idNotaPedido: data.data.id,
89 idTransportista: $scope.notaPedido.fleteId, 89 idTransportista: $scope.notaPedido.fleteId,
90 idChofer: $scope.notaPedido.chofer.id, 90 idChofer: $scope.notaPedido.chofer.id,
91 idVehiculo: $scope.notaPedido.vehiculo.id, 91 idVehiculo: $scope.notaPedido.vehiculo.id,
92 kilometros: $scope.notaPedido.kilometros, 92 kilometros: $scope.notaPedido.kilometros,
93 costoKilometro: $scope.notaPedido.costoUnitarioKmFlete 93 costoKilometro: $scope.notaPedido.costoUnitarioKmFlete
94 }; 94 };
95 crearNotaPedidoService.crearFlete(flete); 95 crearNotaPedidoService.crearFlete(flete);
96 } 96 }
97 var articulosNotaPedido = $scope.articulosTabla; 97 var articulosNotaPedido = $scope.articulosTabla;
98 for(var i = 0; i < articulosNotaPedido.length; i++) { 98 for(var i = 0; i < articulosNotaPedido.length; i++) {
99 delete articulosNotaPedido[i].edit; 99 delete articulosNotaPedido[i].edit;
100 articulosNotaPedido[i].idNotaPedido = data.data.id; 100 articulosNotaPedido[i].idNotaPedido = data.data.id;
101 crearNotaPedidoService 101 crearNotaPedidoService
102 .crearArticulosParaNotaPedido(articulosNotaPedido[i]); 102 .crearArticulosParaNotaPedido(articulosNotaPedido[i]);
103 } 103 }
104 $scope.limpiarPantalla(); 104 $scope.limpiarPantalla();
105 } 105 }
106 ); 106 );
107 }; 107 };
108 $scope.seleccionarArticulo = function() { 108 $scope.seleccionarArticulo = function() {
109 if (idLista === undefined) { 109 if (idLista === undefined) {
110 focaModalService.alert( 110 focaModalService.alert(
111 'primero seleccione una lista de precio y condicion'); 111 'primero seleccione una lista de precio y condicion');
112 return; 112 return;
113 } 113 }
114 var modalInstance = $uibModal.open( 114 var modalInstance = $uibModal.open(
115 { 115 {
116 ariaLabelledBy: 'Busqueda de Productos', 116 ariaLabelledBy: 'Busqueda de Productos',
117 templateUrl: 'modal-busqueda-productos.html', 117 templateUrl: 'modal-busqueda-productos.html',
118 controller: 'modalBusquedaProductosCtrl', 118 controller: 'modalBusquedaProductosCtrl',
119 resolve: { idLista: function() { return idLista; } }, 119 resolve: { idLista: function() { return idLista; } },
120 size: 'lg' 120 size: 'lg'
121 } 121 }
122 ); 122 );
123 modalInstance.result.then( 123 modalInstance.result.then(
124 function(producto) { 124 function(producto) {
125 var newArt = 125 var newArt =
126 { 126 {
127 id: 0, 127 id: 0,
128 codigo: producto.codigo, 128 codigo: producto.codigo,
129 sector: producto.sector, 129 sector: producto.sector,
130 descripcion: producto.descripcion, 130 descripcion: producto.descripcion,
131 item: $scope.articulosTabla.length + 1, 131 item: $scope.articulosTabla.length + 1,
132 nombre: producto.descripcion, 132 nombre: producto.descripcion,
133 precio: producto.precio.toFixed(2), 133 precio: producto.precio.toFixed(2),
134 costoUnitario: producto.costo, 134 costoUnitario: producto.costo,
135 edit: false 135 edit: false
136 }; 136 };
137 $scope.articuloACargar = newArt; 137 $scope.articuloACargar = newArt;
138 $scope.cargando = false; 138 $scope.cargando = false;
139 }, function() { 139 }, function() {
140 // funcion ejecutada cuando se cancela el modal 140 // funcion ejecutada cuando se cancela el modal
141 } 141 }
142 ); 142 );
143 }; 143 };
144 $scope.seleccionarVendedor = function() { 144 $scope.seleccionarVendedor = function() {
145 var modalInstance = $uibModal.open( 145 var modalInstance = $uibModal.open(
146 { 146 {
147 ariaLabelledBy: 'Busqueda de Vendedores', 147 ariaLabelledBy: 'Busqueda de Vendedores',
148 templateUrl: 'modal-vendedores.html', 148 templateUrl: 'modal-vendedores.html',
149 controller: 'modalVendedoresCtrl', 149 controller: 'modalVendedoresCtrl',
150 size: 'lg' 150 size: 'lg'
151 } 151 }
152 ); 152 );
153 modalInstance.result.then( 153 modalInstance.result.then(
154 function(vendedor) { 154 function(vendedor) {
155 $scope.notaPedido.vendedor.nombre = vendedor.NomVen; 155 $scope.notaPedido.vendedor.nombre = vendedor.NomVen;
156 }, function() { 156 }, function() {
157 157
158 } 158 }
159 ); 159 );
160 }; 160 };
161 $scope.seleccionarPetrolera = function() { 161 $scope.seleccionarPetrolera = function() {
162 var modalInstance = $uibModal.open( 162 var modalInstance = $uibModal.open(
163 { 163 {
164 ariaLabelledBy: 'Busqueda de Petrolera', 164 ariaLabelledBy: 'Busqueda de Petrolera',
165 templateUrl: 'modal-petroleras.html', 165 templateUrl: 'modal-petroleras.html',
166 controller: 'modalPetrolerasCtrl', 166 controller: 'modalPetrolerasCtrl',
167 size: 'lg' 167 size: 'lg'
168 } 168 }
169 ); 169 );
170 modalInstance.result.then( 170 modalInstance.result.then(
171 function(petrolera) { 171 function(petrolera) {
172 $scope.notaPedido.petrolera = petrolera.NOM; 172 $scope.notaPedido.petrolera = petrolera.NOM;
173 }, function() { 173 }, function() {
174 174
175 } 175 }
176 ); 176 );
177 }; 177 };
178 $scope.seleccionarCliente = function() { 178 $scope.seleccionarCliente = function() {
179 var modalInstance = $uibModal.open( 179 var modalInstance = $uibModal.open(
180 { 180 {
181 ariaLabelledBy: 'Busqueda de Cliente', 181 ariaLabelledBy: 'Busqueda de Cliente',
182 templateUrl: 'foca-busqueda-cliente-modal.html', 182 templateUrl: 'foca-busqueda-cliente-modal.html',
183 controller: 'focaBusquedaClienteModalController', 183 controller: 'focaBusquedaClienteModalController',
184 size: 'lg' 184 size: 'lg'
185 } 185 }
186 ); 186 );
187 modalInstance.result.then( 187 modalInstance.result.then(
188 function(cliente) { 188 function(cliente) {
189 $scope.limpiarPantalla(); 189 $scope.limpiarPantalla();
190 $scope.notaPedido.cliente.nombre = cliente.nom; 190 $scope.notaPedido.cliente.nombre = cliente.nom;
191 $scope.notaPedido.cliente.id = cliente.cod; 191 $scope.notaPedido.cliente.id = cliente.cod;
192 crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( 192 crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then(
193 function(data) { 193 function(data) {
194 if(data.data.length === 0){ 194 if(data.data.length === 0){
195 focaModalService 195 focaModalService
196 .alert('El cliente no tienen domicilios de entrega') 196 .alert('El cliente no tienen domicilios de entrega')
197 .then( 197 .then(
198 function() { 198 function() {
199 $scope.seleccionarCliente(); 199 $scope.seleccionarCliente();
200 $scope.notaPedido.cliente = {nombre: ''}; 200 $scope.notaPedido.cliente = {nombre: ''};
201 } 201 }
202 ); 202 );
203 return; 203 return;
204 } 204 }
205 $scope.domiciliosCliente = data.data; 205 $scope.domiciliosCliente = data.data;
206 } 206 }
207 ); 207 );
208 }, function() { 208 }, function() {
209 209
210 } 210 }
211 ); 211 );
212 }; 212 };
213 $scope.mostrarFichaCliente = function() { 213 $scope.mostrarFichaCliente = function() {
214 $uibModal.open( 214 $uibModal.open(
215 { 215 {
216 ariaLabelledBy: 'Datos del Cliente', 216 ariaLabelledBy: 'Datos del Cliente',
217 templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', 217 templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html',
218 controller: 'focaCrearNotaPedidoFichaClienteController', 218 controller: 'focaCrearNotaPedidoFichaClienteController',
219 size: 'lg' 219 size: 'lg'
220 } 220 }
221 ); 221 );
222 }; 222 };
223 $scope.getTotal = function() { 223 $scope.getTotal = function() {
224 var total = 0; 224 var total = 0;
225 var arrayTempArticulos = $scope.articulosTabla; 225 var arrayTempArticulos = $scope.articulosTabla;
226 for (var i = 0; i < arrayTempArticulos.length; i++) { 226 for (var i = 0; i < arrayTempArticulos.length; i++) {
227 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; 227 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad;
228 } 228 }
229 return total.toFixed(2); 229 return total.toFixed(2);
230 }; 230 };
231 $scope.getSubTotal = function() { 231 $scope.getSubTotal = function() {
232 if($scope.articuloACargar) { 232 if($scope.articuloACargar) {
233 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; 233 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
234 } 234 }
235 }; 235 };
236 $scope.abrirModalListaPrecio = function() { 236 $scope.abrirModalListaPrecio = function() {
237 var modalInstance = $uibModal.open( 237 var modalInstance = $uibModal.open(
238 { 238 {
239 ariaLabelledBy: 'Busqueda de Precio Condición', 239 ariaLabelledBy: 'Busqueda de Precio Condición',
240 templateUrl: 'modal-precio-condicion.html', 240 templateUrl: 'modal-precio-condicion.html',
241 controller: 'focaModalPrecioCondicionController', 241 controller: 'focaModalPrecioCondicionController',
242 size: 'lg' 242 size: 'lg'
243 } 243 }
244 ); 244 );
245 modalInstance.result.then( 245 modalInstance.result.then(
246 function(precioCondicion) { 246 function(precioCondicion) {
247 $scope.notaPedido.precioCondicion = precioCondicion.nombre; 247 $scope.notaPedido.precioCondicion = precioCondicion.nombre;
248 idLista = precioCondicion.idListaPrecio; 248 idLista = precioCondicion.idListaPrecio;
249 $scope.articulosTabla = []; 249 $scope.articulosTabla = [];
250 }, function() { 250 }, function() {
251 251
252 } 252 }
253 ); 253 );
254 }; 254 };
255 $scope.abrirModalFlete = function() { 255 $scope.abrirModalFlete = function() {
256 if($scope.notaPedido.flete === '1') { 256 if($scope.notaPedido.flete === '1') {
257 var modalInstance = $uibModal.open( 257 var modalInstance = $uibModal.open(
258 { 258 {
259 ariaLabelledBy: 'Busqueda de Flete', 259 ariaLabelledBy: 'Busqueda de Flete',
260 templateUrl: 'modal-flete.html', 260 templateUrl: 'modal-flete.html',
261 controller: 'focaModalFleteController', 261 controller: 'focaModalFleteController',
262 size: 'lg' 262 size: 'lg'
263 } 263 }
264 ); 264 );
265 modalInstance.result.then( 265 modalInstance.result.then(
266 function(flete) { 266 function(flete) {
267 $scope.limpiarFlete(); 267 $scope.limpiarFlete();
268 $scope.notaPedido.fleteNombre = flete.nombre; 268 $scope.notaPedido.fleteNombre = flete.nombre;
269 $scope.notaPedido.fleteId = flete.id; 269 $scope.notaPedido.fleteId = flete.id;
270 $scope.choferes = flete.chofer; 270 $scope.choferes = flete.chofer;
271 $scope.vehiculos = flete.vehiculo; 271 $scope.vehiculos = flete.vehiculo;
272 }, function() { 272 }, function() {
273 273
274 } 274 }
275 ); 275 );
276 } 276 }
277 }; 277 };
278 $scope.agregarATabla = function(key) { 278 $scope.agregarATabla = function(key) {
279 if(key === 13) { 279 if(key === 13) {
280 if($scope.articuloACargar.cantidad === undefined || 280 if($scope.articuloACargar.cantidad === undefined ||
281 $scope.articuloACargar.cantidad === 0 || 281 $scope.articuloACargar.cantidad === 0 ||
282 $scope.articuloACargar.cantidad === null ){ 282 $scope.articuloACargar.cantidad === null ){
283 focaModalService.alert('El valor debe ser al menos 1'); 283 focaModalService.alert('El valor debe ser al menos 1');
284 return; 284 return;
285 } 285 }
286 $scope.articulosTabla.unshift($scope.articuloACargar); 286 $scope.articulosTabla.unshift($scope.articuloACargar);
287 $scope.cargando = true; 287 $scope.cargando = true;
288 } 288 }
289 }; 289 };
290 $scope.quitarArticulo = function(key) { 290 $scope.quitarArticulo = function(key) {
291 $scope.articulosTabla.splice(key, 1); 291 $scope.articulosTabla.splice(key, 1);
292 }; 292 };
293 $scope.editarArticulo = function(key, articulo) { 293 $scope.editarArticulo = function(key, articulo) {
294 if(key === 13) { 294 if(key === 13) {
295 if(articulo.cantidad === null || articulo.cantidad === 0 || 295 if(articulo.cantidad === null || articulo.cantidad === 0 ||
296 articulo.cantidad === undefined){ 296 articulo.cantidad === undefined){
297 focaModalService.alert('El valor debe ser al menos 1'); 297 focaModalService.alert('El valor debe ser al menos 1');
298 return; 298 return;
299 } 299 }
300 articulo.edit = false; 300 articulo.edit = false;
301 } 301 }
302 }; 302 };
303 $scope.cambioEdit = function(articulo) { 303 $scope.cambioEdit = function(articulo) {
304 articulo.edit = true; 304 articulo.edit = true;
305 }; 305 };
306 $scope.limpiarFlete = function() { 306 $scope.limpiarFlete = function() {
307 $scope.notaPedido.fleteNombre = ''; 307 $scope.notaPedido.fleteNombre = '';
308 $scope.notaPedido.chofer = ''; 308 $scope.notaPedido.chofer = '';
309 $scope.notaPedido.vehiculo = ''; 309 $scope.notaPedido.vehiculo = '';
310 $scope.notaPedido.kilometros = ''; 310 $scope.notaPedido.kilometros = '';
311 $scope.notaPedido.costoUnitarioKmFlete = ''; 311 $scope.notaPedido.costoUnitarioKmFlete = '';
312 $scope.choferes = ''; 312 $scope.choferes = '';
313 $scope.vehiculos = ''; 313 $scope.vehiculos = '';
314 }; 314 };
315 $scope.limpiarPantalla = function() { 315 $scope.limpiarPantalla = function() {
316 $scope.limpiarFlete(); 316 $scope.limpiarFlete();
317 $scope.notaPedido.flete = '0'; 317 $scope.notaPedido.flete = '0';
318 $scope.notaPedido.bomba = '0'; 318 $scope.notaPedido.bomba = '0';
319 $scope.notaPedido.precioCondicion = ''; 319 $scope.notaPedido.precioCondicion = '';
320 $scope.articulosTabla = []; 320 $scope.articulosTabla = [];
321 $scope.notaPedido.vendedor.nombre = ''; 321 $scope.notaPedido.vendedor.nombre = '';
322 $scope.notaPedido.cliente = {nombre: ''}; 322 $scope.notaPedido.cliente = {nombre: ''};
323 $scope.notaPedido.domicilio = {dom: ''}; 323 $scope.notaPedido.domicilio = {dom: ''};
324 $scope.domiciliosCliente = []; 324 $scope.domiciliosCliente = [];
325 }; 325 };
326 $scope.resetFilter = function() { 326 $scope.resetFilter = function() {
327 $scope.articuloACargar = {}; 327 $scope.articuloACargar = {};
328 $scope.cargando = true; 328 $scope.cargando = true;
329 }; 329 };
330 $scope.selectFocus = function ($event) { 330 $scope.selectFocus = function ($event) {
331 $event.target.select(); 331 $event.target.select();
332 }; 332 };
333 } 333 }
334 ] 334 ]
335 ) 335 )
336 .controller('notaPedidoListaCtrl', [ 336 .controller('notaPedidoListaCtrl', [
337 '$scope', 337 '$scope',
338 'crearNotaPedidoService', 338 'crearNotaPedidoService',
339 '$location', 339 '$location',
340 function($scope, crearNotaPedidoService, $location) { 340 function($scope, crearNotaPedidoService, $location) {
341 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { 341 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) {
342 $scope.notaPedidos = datos.data; 342 $scope.notaPedidos = datos.data;
343 }); 343 });
344 $scope.editar = function(notaPedido) { 344 $scope.editar = function(notaPedido) {
345 crearNotaPedidoService.setNotaPedido(notaPedido); 345 crearNotaPedidoService.setNotaPedido(notaPedido);
346 $location.path('/venta-nota-pedido/abm/'); 346 $location.path('/venta-nota-pedido/abm/');
347 }; 347 };
348 $scope.crearPedido = function() { 348 $scope.crearPedido = function() {
349 crearNotaPedidoService.clearNotaPedido(); 349 crearNotaPedidoService.clearNotaPedido();
350 $location.path('/venta-nota-pedido/abm/'); 350 $location.path('/venta-nota-pedido/abm/');
351 }; 351 };
352 } 352 }
353 ]) 353 ])
354 .controller('focaCrearNotaPedidoFichaClienteController', [ 354 .controller('focaCrearNotaPedidoFichaClienteController', [
355 '$scope', 355 '$scope',
356 'crearNotaPedidoService', 356 'crearNotaPedidoService',
357 '$location', 357 '$location',
358 function($scope, crearNotaPedidoService, $location) { 358 function($scope, crearNotaPedidoService, $location) {
359 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { 359 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) {
360 $scope.notaPedidos = datos.data; 360 $scope.notaPedidos = datos.data;
361 }); 361 });
362 $scope.editar = function(notaPedido) { 362 $scope.editar = function(notaPedido) {
363 crearNotaPedidoService.setNotaPedido(notaPedido); 363 crearNotaPedidoService.setNotaPedido(notaPedido);
364 $location.path('/venta-nota-pedido/abm/'); 364 $location.path('/venta-nota-pedido/abm/');
365 }; 365 };
366 $scope.crearPedido = function() { 366 $scope.crearPedido = function() {
367 crearNotaPedidoService.clearNotaPedido(); 367 crearNotaPedidoService.clearNotaPedido();
368 $location.path('/venta-nota-pedido/abm/'); 368 $location.path('/venta-nota-pedido/abm/');
369 }; 369 };
370 } 370 }
371 ]); 371 ]);
372 372