Commit b2922d83786c4e311162ed0e809bbe214ee07e13

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'master'

Master (pmarco)

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