Commit 65f5241a8ecf2083b71cd770a897a923494dc316

Authored by Jose Pinto
Exists in master

Merge branch 'master' into 'master'

Master

See merge request !36
src/js/controller.js
1 angular.module('focaCrearRemito') .controller('remitoController', 1 angular.module('focaCrearRemito') .controller('remitoController',
2 [ 2 [
3 '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', '$timeout', 3 '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', '$timeout',
4 'focaModalService', 'remitoBusinessService', '$rootScope', 'focaBotoneraLateralService', 4 'focaModalService', 'remitoBusinessService', '$rootScope', 'focaBotoneraLateralService',
5 '$localStorage',
5 function( 6 function(
6 $scope, $uibModal, $location, $filter, crearRemitoService, $timeout, focaModalService, 7 $scope, $uibModal, $location, $filter, crearRemitoService, $timeout, focaModalService,
7 remitoBusinessService, $rootScope, focaBotoneraLateralService) 8 remitoBusinessService, $rootScope, focaBotoneraLateralService, $localStorage)
8 { 9 {
9 config(); 10 config();
10 11
11 function config() { 12 function config() {
12 $scope.botonera = crearRemitoService.getBotonera(); 13 $scope.botonera = crearRemitoService.getBotonera();
13 $scope.isNumber = angular.isNumber; 14 $scope.isNumber = angular.isNumber;
14 $scope.datepickerAbierto = false; 15 $scope.datepickerAbierto = false;
15 $scope.show = false; 16 $scope.show = false;
16 $scope.cargando = true; 17 $scope.cargando = true;
17 $scope.now = new Date(); 18 $scope.now = new Date();
18 $scope.puntoVenta = rellenar(0, 4); 19 $scope.puntoVenta = rellenar(0, 4);
19 $scope.comprobante = rellenar(0, 8); 20 $scope.comprobante = rellenar(0, 8);
20 $scope.dateOptions = { 21 $scope.dateOptions = {
21 maxDate: new Date(), 22 maxDate: new Date(),
22 minDate: new Date(2010, 0, 1) 23 minDate: new Date(2010, 0, 1)
23 }; 24 };
24 25
25 var monedaPorDefecto; 26 var monedaPorDefecto;
26 //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' 27 //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]'
27 crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { 28 crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) {
28 monedaPorDefecto = res.data[0]; 29 monedaPorDefecto = res.data[0];
29 30
30 $scope.remito.moneda = monedaPorDefecto; 31 $scope.remito.cotizacion = Object.assign(
31 $scope.inicial.remito.moneda = $scope.remito.moneda; 32 {moneda: monedaPorDefecto}, monedaPorDefecto.cotizaciones[0]
32 33 );
33 $scope.remito.cotizacion = monedaPorDefecto.cotizaciones[0]; 34 $scope.inicial.cotizacion = $scope.remito.cotizacion;
34 $scope.inicial.remito.cotizacion = $scope.remito.cotizacion; 35 $scope.cotizacionPorDefecto = angular.copy($scope.remito.cotizacion);
35 }); 36 });
36 37
37 //SETEO BOTONERA LATERAL 38 //SETEO BOTONERA LATERAL
38 $timeout(function() { 39 $timeout(function() {
39 focaBotoneraLateralService.showSalir(false); 40 focaBotoneraLateralService.showSalir(false);
40 focaBotoneraLateralService.showPausar(true); 41 focaBotoneraLateralService.showPausar(true);
41 focaBotoneraLateralService.showGuardar(true, $scope.crearRemito); 42 focaBotoneraLateralService.showGuardar(true, $scope.crearRemito);
42 focaBotoneraLateralService.addCustomButton('Salir', salir); 43 focaBotoneraLateralService.addCustomButton('Salir', salir);
43 }); 44 });
44 45
45 init(); 46 init();
47 $timeout(function() {getLSRemito();});
46 } 48 }
47 49
48 function init() { 50 function init() {
49 $scope.$broadcast('cleanCabecera'); 51 $scope.$broadcast('cleanCabecera');
50 52
51 $scope.remito = { 53 $scope.remito = {
52 id: 0, 54 id: 0,
53 estado: 0, 55 estado: 0,
54 vendedor: {}, 56 vendedor: {},
55 cliente: {}, 57 cliente: {},
56 proveedor: {}, 58 proveedor: {},
57 domicilio: {dom: ''}, 59 domicilio: {dom: ''},
58 moneda: {}, 60 moneda: {},
59 cotizacion: {} 61 cotizacion: $scope.cotizacionPorDefecto || {},
62 articulosRemito: []
60 }; 63 };
61 64
62 $scope.notaPedido = { 65 $scope.notaPedido = {
63 id: 0 66 id: 0
64 }; 67 };
65 68
66 $scope.articulosTabla = []; 69 $scope.remito.articulosRemito = [];
67 $scope.idLista = undefined; 70 $scope.idLista = undefined;
68 71
69 crearRemitoService.getNumeroRemito().then( 72 crearRemitoService.getNumeroRemito().then(
70 function(res) { 73 function(res) {
71 $scope.puntoVenta = rellenar(res.data.sucursal, 4); 74 $scope.puntoVenta = rellenar(res.data.sucursal, 4);
72 $scope.comprobante = rellenar(res.data.numeroRemito, 8); 75 $scope.comprobante = rellenar(res.data.numeroRemito, 8);
73 }, 76 },
74 function(err) { 77 function(err) {
75 focaModalService.alert('La terminal no esta configurada correctamente'); 78 focaModalService.alert('La terminal no esta configurada correctamente');
76 console.info(err); 79 console.info(err);
77 } 80 }
78 ); 81 );
79 82
80 $scope.inicial = { 83 $scope.inicial = angular.copy($scope.remito);
81 remito: angular.copy($scope.remito),
82 notaPedido: angular.copy($scope.notaPedido),
83 articulosTabla: angular.copy($scope.articulosTabla),
84 idLista: angular.copy($scope.idLista)
85 };
86 } 84 }
87 85
86 $scope.$watch('remito', function(newValue, oldValue) {
87 focaBotoneraLateralService.setPausarData({
88 label: 'remito',
89 val: newValue
90 });
91 }, true);
92
88 $scope.seleccionarNotaPedido = function() { 93 $scope.seleccionarNotaPedido = function() {
89 if(varlidarRemitoFacturado()) { 94 if(varlidarRemitoFacturado()) {
90 var modalInstance = $uibModal.open( 95 var modalInstance = $uibModal.open(
91 { 96 {
92 ariaLabelledBy: 'Busqueda de Nota de Pedido', 97 ariaLabelledBy: 'Busqueda de Nota de Pedido',
93 templateUrl: 'foca-modal-nota-pedido.html', 98 templateUrl: 'foca-modal-nota-pedido.html',
94 controller: 'focaModalNotaPedidoController', 99 controller: 'focaModalNotaPedidoController',
95 size: 'lg', 100 size: 'lg',
96 resolve: { 101 resolve: {
97 usadoPor: function() { return 'remito'; }, 102 usadoPor: function() { return 'remito'; },
98 idVendedor: function() { return null; } 103 idVendedor: function() { return null; }
99 } 104 }
100 } 105 }
101 ); 106 );
102 modalInstance.result.then( 107 modalInstance.result.then(
103 function(notaPedido) { 108 function(notaPedido) {
104 //añado cabeceras 109 //añado cabeceras
105 $scope.notaPedido.id = notaPedido.id; 110 $scope.notaPedido.id = notaPedido.id;
106 $scope.$broadcast('removeCabecera', 'Bomba:'); 111 $scope.$broadcast('removeCabecera', 'Bomba:');
107 $scope.$broadcast('removeCabecera', 'Kilometros:'); 112 $scope.$broadcast('removeCabecera', 'Kilometros:');
108 var cabeceras = [ 113 var cabeceras = [
109 { 114 {
110 label: 'Moneda:', 115 label: 'Moneda:',
111 valor: notaPedido.cotizacion.moneda.DETALLE 116 valor: notaPedido.cotizacion.moneda.DETALLE
112 }, 117 },
113 { 118 {
114 label: 'Fecha cotizacion:', 119 label: 'Fecha cotizacion:',
115 valor: $filter('date')(notaPedido.cotizacion.FECHA, 120 valor: $filter('date')(notaPedido.cotizacion.FECHA,
116 'dd/MM/yyyy') 121 'dd/MM/yyyy')
117 }, 122 },
118 { 123 {
119 label: 'Cotizacion:', 124 label: 'Cotizacion:',
120 valor: $filter('number')(notaPedido.cotizacion.VENDEDOR, 125 valor: $filter('number')(notaPedido.cotizacion.VENDEDOR,
121 '2') 126 '2')
122 }, 127 },
123 { 128 {
124 label: 'Cliente:', 129 label: 'Cliente:',
125 valor: $filter('rellenarDigitos')(notaPedido.cliente.COD, 3) + 130 valor: $filter('rellenarDigitos')(notaPedido.cliente.COD, 3) +
126 ' - ' + notaPedido.cliente.NOM 131 ' - ' + notaPedido.cliente.NOM
127 }, 132 },
128 { 133 {
129 label: 'Domicilio:', 134 label: 'Domicilio:',
130 valor: notaPedido.domicilioStamp 135 valor: notaPedido.domicilioStamp
131 }, 136 },
132 { 137 {
133 label: 'Vendedor:', 138 label: 'Vendedor:',
134 valor: $filter('rellenarDigitos')( 139 valor: $filter('rellenarDigitos')(
135 notaPedido.vendedor.NUM, 3 140 notaPedido.vendedor.NUM, 3
136 ) + ' - ' + notaPedido.vendedor.NOM 141 ) + ' - ' + notaPedido.vendedor.NOM
137 }, 142 },
138 { 143 {
139 label: 'Proveedor:', 144 label: 'Proveedor:',
140 valor: $filter('rellenarDigitos') 145 valor: $filter('rellenarDigitos')
141 (notaPedido.proveedor.COD, 5) + ' - ' + 146 (notaPedido.proveedor.COD, 5) + ' - ' +
142 notaPedido.proveedor.NOM 147 notaPedido.proveedor.NOM
143 }, 148 },
144 { 149 {
145 label: 'Precio condicion:', 150 label: 'Precio condicion:',
146 valor: valorPrecioCondicion() + ' ' + 151 valor: valorPrecioCondicion() + ' ' +
147 remitoBusinessService 152 remitoBusinessService
148 .plazoToString(notaPedido.notaPedidoPlazo) 153 .plazoToString(notaPedido.notaPedidoPlazo)
149 }, 154 },
150 { 155 {
151 label: 'Flete:', 156 label: 'Flete:',
152 valor: notaPedido.fob === 1 ? 'FOB' : ( 157 valor: notaPedido.fob === 1 ? 'FOB' : (
153 notaPedido.flete === 1 ? 'Si' : 'No') 158 notaPedido.flete === 1 ? 'Si' : 'No')
154 } 159 }
155 ]; 160 ];
156 161
157 function valorPrecioCondicion() { 162 function valorPrecioCondicion() {
158 if(notaPedido.idPrecioCondicion > 0) { 163 if(notaPedido.idPrecioCondicion > 0) {
159 return notaPedido.precioCondicion.nombre; 164 return notaPedido.precioCondicion.nombre;
160 }else { 165 }else {
161 return 'Ingreso Manual'; 166 return 'Ingreso Manual';
162 } 167 }
163 } 168 }
164 169
165 if(notaPedido.flete === 1) { 170 if(notaPedido.flete === 1) {
166 var cabeceraBomba = { 171 var cabeceraBomba = {
167 label: 'Bomba:', 172 label: 'Bomba:',
168 valor: notaPedido.bomba === 1 ? 'Si' : 'No' 173 valor: notaPedido.bomba === 1 ? 'Si' : 'No'
169 }; 174 };
170 if(notaPedido.kilometros) { 175 if(notaPedido.kilometros) {
171 var cabeceraKilometros = { 176 var cabeceraKilometros = {
172 label: 'Kilometros:', 177 label: 'Kilometros:',
173 valor: notaPedido.kilometros 178 valor: notaPedido.kilometros
174 }; 179 };
175 cabeceras.push(cabeceraKilometros); 180 cabeceras.push(cabeceraKilometros);
176 } 181 }
177 cabeceras.push(cabeceraBomba); 182 cabeceras.push(cabeceraBomba);
178 } 183 }
179 184
185 delete notaPedido.id;
186 $scope.remito = notaPedido;
187 $scope.remito.id = 0;
188 $scope.remito.remitoPlazo = notaPedido.notaPedidoPlazo;
189
180 for(var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) { 190 for(var i = notaPedido.articulosNotaPedido.length - 1; i >= 0; i--) {
181 notaPedido.articulosNotaPedido[i].id = 0; 191 notaPedido.articulosNotaPedido[i].id = 0;
182 } 192 }
183 193
184 $scope.articulosTabla = notaPedido.articulosNotaPedido; 194 $scope.remito.articulosRemito = notaPedido.articulosNotaPedido;
185 remitoBusinessService.calcularArticulos($scope.articulosTabla, 195 remitoBusinessService.calcularArticulos($scope.remito.articulosRemito,
186 notaPedido.cotizacion.VENDEDOR); 196 notaPedido.cotizacion.VENDEDOR);
187 197
188 if(notaPedido.idPrecioCondicion > 0) { 198 if(notaPedido.idPrecioCondicion > 0) {
189 $scope.idLista = notaPedido.precioCondicion.idListaPrecio; 199 $scope.idLista = notaPedido.precioCondicion.idListaPrecio;
190 }else { 200 }else {
191 $scope.idLista = -1; 201 $scope.idLista = -1;
192 } 202 }
193 203
194 delete notaPedido.id;
195 $scope.remito = notaPedido;
196 $scope.remito.id = 0;
197 $scope.remito.moneda = notaPedido.cotizacion.moneda;
198 $scope.plazosPagos = notaPedido.notaPedidoPlazo;
199 enableObservaciones(notaPedido.observaciones ? true : false); 204 enableObservaciones(notaPedido.observaciones ? true : false);
200 addArrayCabecera(cabeceras); 205 addArrayCabecera(cabeceras);
201 206
202 }, function() { 207 }, function() {
203 // funcion ejecutada cuando se cancela el modal 208 // funcion ejecutada cuando se cancela el modal
204 } 209 }
205 ); 210 );
206 } 211 }
207 }; 212 };
208 213
209 $scope.seleccionarRemito = function() { 214 $scope.seleccionarRemito = function() {
210 var modalInstance = $uibModal.open( 215 var modalInstance = $uibModal.open(
211 { 216 {
212 ariaLabelledBy: 'Busqueda de Remito', 217 ariaLabelledBy: 'Busqueda de Remito',
213 templateUrl: 'foca-modal-remito.html', 218 templateUrl: 'foca-modal-remito.html',
214 controller: 'focaModalRemitoController', 219 controller: 'focaModalRemitoController',
215 size: 'lg', 220 size: 'lg',
216 resolve: {usadoPor: function() {return 'remito';}} 221 resolve: {usadoPor: function() {return 'remito';}}
217 } 222 }
218 ); 223 );
219 modalInstance.result.then( 224 modalInstance.result.then(
220 function(remito) { 225 setearRemito, function() {
221 //añado cabeceras
222 $scope.$broadcast('removeCabecera', 'Moneda:');
223 $scope.$broadcast('removeCabecera', 'Fecha cotizacion:');
224 $scope.$broadcast('removeCabecera', 'Cotizacion:');
225 var cabeceras = [
226 {
227 label: 'Moneda:',
228 valor: remito.cotizacion.moneda.DETALLE
229 },
230 {
231 label: 'Fecha cotizacion:',
232 valor: $filter('date')(remito.cotizacion.FECHA,
233 'dd/MM/yyyy')
234 },
235 {
236 label: 'Cotizacion:',
237 valor: $filter('number')(remito.cotizacion.VENDEDOR,
238 '2')
239 },
240 {
241 label: 'Cliente:',
242 valor: $filter('rellenarDigitos')(remito.cliente.COD, 3) + ' - ' +
243 remito.cliente.NOM
244 },
245 {
246 label: 'Domicilio:',
247 valor: remito.domicilioStamp
248 },
249 {
250 label: 'Vendedor:',
251 valor: $filter('rellenarDigitos')(remito.vendedor.NUM, 3) +
252 ' - ' + remito.vendedor.NOM
253 },
254 {
255 label: 'Proveedor:',
256 valor: $filter('rellenarDigitos')(remito.proveedor.COD, 5) +
257 ' - ' + remito.proveedor.NOM
258 },
259 {
260 label: 'Flete:',
261 valor: remito.fob === 1 ? 'FOB' : (
262 remito.flete === 1 ? 'Si' : 'No')
263 },
264 {
265 label: 'Precio condicion:',
266 valor: valorPrecioCondicion() + ' ' +
267 remitoBusinessService.plazoToString(remito.remitoPlazo)
268 }
269 ];
270 function valorPrecioCondicion() {
271 if(remito.idPrecioCondicion > 0) {
272 return remito.precioCondicion.nombre;
273 }else {
274 return 'Ingreso Manual';
275 }
276 }
277
278 if(remito.flete === 1) {
279 var cabeceraBomba = {
280 label: 'Bomba',
281 valor: remito.bomba === 1 ? 'Si' : 'No'
282 };
283 if(remito.kilometros) {
284 var cabeceraKilometros = {
285 label: 'Kilometros',
286 valor: remito.kilometros
287 };
288 cabeceras.push(cabeceraKilometros);
289 }
290 cabeceras.push(cabeceraBomba);
291 }
292 $scope.articulosTabla = remito.articulosRemito;
293 remitoBusinessService.calcularArticulos($scope.articulosTabla,
294 remito.cotizacion.VENDEDOR);
295 if(remito.idPrecioCondicion > 0) {
296 $scope.idLista = remito.precioCondicion.idListaPrecio;
297 }else {
298 $scope.idLista = -1;
299 }
300 $scope.puntoVenta = rellenar(remito.sucursal, 4);
301 $scope.comprobante = rellenar(remito.numeroRemito, 8);
302 $scope.remito = remito;
303 $scope.remito.moneda = remito.cotizacion.moneda;
304 $scope.plazosPagos = remito.remitoPlazo;
305 addArrayCabecera(cabeceras);
306 }, function() {
307 // funcion ejecutada cuando se cancela el modal 226 // funcion ejecutada cuando se cancela el modal
308 } 227 }
309 ); 228 );
310 }; 229 };
311 230
312 //validacion por domicilio y por plazo pago 231 //validacion por domicilio y por plazo pago
313 $scope.crearRemito = function() { 232 $scope.crearRemito = function() {
314 if(!$scope.remito.vendedor) { 233 if (!$scope.remito.vendedor) {
315 focaModalService.alert('Ingrese Vendedor'); 234 focaModalService.alert('Ingrese Vendedor');
316 return; 235 return;
317 }else if(!$scope.remito.cliente) { 236 } else if (!$scope.remito.cliente) {
318 focaModalService.alert('Ingrese Cliente'); 237 focaModalService.alert('Ingrese Cliente');
319 return; 238 return;
320 }else if(!$scope.remito.proveedor) { 239 } else if (!$scope.remito.proveedor) {
321 focaModalService.alert('Ingrese Proveedor'); 240 focaModalService.alert('Ingrese Proveedor');
322 return; 241 return;
323 }else if(!$scope.remito.moneda.id && !$scope.remito.moneda.ID) { 242 } else if (!$scope.remito.cotizacion.moneda.id && !$scope.remito.cotizacion.moneda.ID) {
324 focaModalService.alert('Ingrese Moneda'); 243 focaModalService.alert('Ingrese Moneda');
325 return; 244 return;
326 }else if(!$scope.remito.cotizacion.ID) { 245 } else if (!$scope.remito.cotizacion.ID) {
327 focaModalService.alert('Ingrese Cotización'); 246 focaModalService.alert('Ingrese Cotización');
328 return; 247 return;
329 }else if( 248 } else if (
330 $scope.remito.flete === undefined || $scope.remito.flete === null) 249 $scope.remito.flete === undefined || $scope.remito.flete === null)
331 { 250 {
332 focaModalService.alert('Ingrese Flete'); 251 focaModalService.alert('Ingrese Flete');
333 return; 252 return;
334 }else if($scope.articulosTabla.length === 0) { 253 } else if ($scope.remito.articulosRemito.length === 0) {
335 focaModalService.alert('Debe cargar al menos un articulo'); 254 focaModalService.alert('Debe cargar al menos un articulo');
336 return; 255 return;
337 } 256 }
338 focaBotoneraLateralService.startGuardar(); 257 focaBotoneraLateralService.startGuardar();
339 $scope.saveLoading = true; 258 $scope.saveLoading = true;
340 var save = { 259 var save = {
341 remito: { 260 remito: {
342 id: $scope.remito.id, 261 id: $scope.remito.id,
343 fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '), 262 fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '),
344 idCliente: $scope.remito.cliente.COD, 263 idCliente: $scope.remito.cliente.COD,
345 nombreCliente: $scope.remito.cliente.NOM, 264 nombreCliente: $scope.remito.cliente.NOM,
346 cuitCliente: $scope.remito.cliente.CUIT, 265 cuitCliente: $scope.remito.cliente.CUIT,
347 responsabilidadIvaCliente: 0,//TODO, 266 responsabilidadIvaCliente: 0,//TODO,
348 descuento: 0,//TODO, 267 descuento: 0,//TODO,
349 importeNeto: 0,//TODO 268 importeNeto: 0,//TODO
350 importeExento: 0,//TODO 269 importeExento: 0,//TODO
351 importeIva: 0,//TODO 270 importeIva: 0,//TODO
352 importeIvaServicios: 0,//TODO 271 importeIvaServicios: 0,//TODO
353 importeImpuestoInterno: 0,//TODO 272 importeImpuestoInterno: 0,//TODO
354 importeImpuestoInterno1: 0,//TODO 273 importeImpuestoInterno1: 0,//TODO
355 importeImpuestoInterno2: 0,//TODO 274 importeImpuestoInterno2: 0,//TODO
356 percepcion: 0,//TODO 275 percepcion: 0,//TODO
357 percepcionIva: 0,//TODO 276 percepcionIva: 0,//TODO
358 redondeo: 0,//TODO 277 redondeo: 0,//TODO
359 total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, 278 total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR,
360 numeroNotaPedido: $scope.remito.numeroNotaPedido, 279 numeroNotaPedido: $scope.remito.numeroNotaPedido,
361 anulado: false, 280 anulado: false,
362 planilla: 0,//TODO 281 planilla: 0,//TODO
363 lugar: 0,//TODO 282 lugar: 0,//TODO
364 cuentaMadre: 0,// 283 cuentaMadre: 0,//
365 cuentaContable: 0,//TODO 284 cuentaContable: 0,//TODO
366 asiento: 0,//TODO 285 asiento: 0,//TODO
367 e_hd: '',//TODO 286 e_hd: '',//TODO
368 c_hd: '', 287 c_hd: '',
369 numeroLiquidoProducto: 0,//TODO 288 numeroLiquidoProducto: 0,//TODO
370 idVendedor: $scope.remito.idVendedor, 289 idVendedor: $scope.remito.idVendedor,
371 idProveedor: $scope.remito.idProveedor, 290 idProveedor: $scope.remito.idProveedor,
372 idDomicilio: $scope.remito.idDomicilio, 291 idDomicilio: $scope.remito.idDomicilio,
373 idCotizacion: $scope.remito.cotizacion.ID, 292 idCotizacion: $scope.remito.cotizacion.ID,
374 idPrecioCondicion: $scope.remito.idPrecioCondicion, 293 idPrecioCondicion: $scope.remito.idPrecioCondicion,
375 flete: $scope.remito.flete, 294 flete: $scope.remito.flete,
376 fob: $scope.remito.fob, 295 fob: $scope.remito.fob,
377 bomba: $scope.remito.bomba, 296 bomba: $scope.remito.bomba,
378 kilometros: $scope.remito.kilometros, 297 kilometros: $scope.remito.kilometros,
379 domicilioStamp: $scope.remito.domicilioStamp, 298 domicilioStamp: $scope.remito.domicilioStamp,
380 estado: 0,//TODO 299 estado: 0,//TODO
381 destinoVenta: 0,//TODO 300 destinoVenta: 0,//TODO
382 operacionTipo: 0//TODO 301 operacionTipo: 0//TODO
383 }, 302 },
384 notaPedido: $scope.notaPedido 303 notaPedido: $scope.notaPedido
385 }; 304 };
386 305
387 crearRemitoService.crearRemito(save).then( 306 crearRemitoService.crearRemito(save).then(
388 function(data) { 307 function(data) {
389 remitoBusinessService.addArticulos($scope.articulosTabla, 308 remitoBusinessService.addArticulos($scope.remito.articulosRemito,
390 data.data.id, $scope.remito.cotizacion.VENDEDOR); 309 data.data.id, $scope.remito.cotizacion.COTIZACION);
391 310
392 focaBotoneraLateralService.endGuardar(true); 311 focaBotoneraLateralService.endGuardar(true);
393 $scope.saveLoading = false; 312 $scope.saveLoading = false;
394 313
395 //TODO: updatear plazos 314 //TODO: updatear plazos
396 if($scope.remito.id === 0) { 315 if($scope.remito.id === 0) {
397 $scope.remito.id = data.data.id; 316 var plazos = $scope.remito.remitoPlazo;
398 var plazos = $scope.plazosPagos;
399 317
400 for(var j = 0; j < plazos.length; j++) { 318 for(var j = 0; j < plazos.length; j++) {
401 var json = { 319 var json = {
402 idRemito: $scope.remito.id, 320 idRemito: $scope.remito.id,
403 dias: plazos[j].dias 321 dias: plazos[j].dias
404 }; 322 };
405 crearRemitoService.crearPlazosParaRemito(json); 323 crearRemitoService.crearPlazosParaRemito(json);
406 } 324 }
407 } 325 }
408 326
409 $uibModal.open({ 327 $uibModal.open({
410 templateUrl: 'remito-comprobante.html', 328 templateUrl: 'remito-comprobante.html',
411 controller: 'focaRemitoComprobanteController', 329 controller: 'focaRemitoComprobanteController',
412 resolve: { 330 resolve: {
413 parametros: { 331 parametros: {
414 idRemito: data.data.id 332 idRemito: data.data.id
415 } 333 }
416 } 334 }
417 }); 335 });
418 336
419 init(); 337 init();
420 338
421 }, function(error) { 339 }, function(error) {
422 focaModalService.alert('Hubo un error al crear el remito'); 340 focaModalService.alert('Hubo un error al crear el remito');
423 focaBotoneraLateralService.endGuardar(); 341 focaBotoneraLateralService.endGuardar();
424 $scope.saveLoading = false; 342 $scope.saveLoading = false;
425 console.info(error); 343 console.info(error);
426 } 344 }
427 ); 345 );
428 }; 346 };
429 347
430 $scope.seleccionarProductos = function() { 348 $scope.seleccionarProductos = function() {
431 if($scope.idLista === undefined) { 349 if($scope.idLista === undefined) {
432 focaModalService.alert( 350 focaModalService.alert(
433 'Primero seleccione una lista de precio y condicion'); 351 'Primero seleccione una lista de precio y condicion');
434 return; 352 return;
435 } 353 }
436 var modalInstance = $uibModal.open( 354 var modalInstance = $uibModal.open(
437 { 355 {
438 ariaLabelledBy: 'Busqueda de Productos', 356 ariaLabelledBy: 'Busqueda de Productos',
439 templateUrl: 'modal-busqueda-productos.html', 357 templateUrl: 'modal-busqueda-productos.html',
440 controller: 'modalBusquedaProductosCtrl', 358 controller: 'modalBusquedaProductosCtrl',
441 resolve: { 359 resolve: {
442 parametroProducto: { 360 parametroProducto: {
443 idLista: $scope.idLista, 361 idLista: $scope.idLista,
444 cotizacion: $scope.remito.cotizacion.COTIZACION, 362 cotizacion: $scope.remito.cotizacion.COTIZACION,
445 simbolo: $scope.remito.moneda.simbolo 363 simbolo: $scope.remito.cotizacion.moneda.simbolo
446 } 364 }
447 }, 365 },
448 size: 'lg' 366 size: 'lg'
449 } 367 }
450 ); 368 );
451 modalInstance.result.then( 369 modalInstance.result.then(
452 function(producto) { 370 function(producto) {
453 var newArt = 371 var newArt =
454 { 372 {
455 id: 0, 373 id: 0,
456 codigo: producto.codigo, 374 codigo: producto.codigo,
457 sector: producto.sector, 375 sector: producto.sector,
458 sectorCodigo: producto.sector + '-' + producto.codigo, 376 sectorCodigo: producto.sector + '-' + producto.codigo,
459 descripcion: producto.descripcion, 377 descripcion: producto.descripcion,
460 item: $scope.articulosTabla.length + 1, 378 item: $scope.remito.articulosRemito.length + 1,
461 nombre: producto.descripcion, 379 nombre: producto.descripcion,
462 precio: parseFloat(producto.precio.toFixed(4)), 380 precio: parseFloat(producto.precio.toFixed(4)),
463 costoUnitario: producto.costo, 381 costoUnitario: producto.costo,
464 editCantidad: false, 382 editCantidad: false,
465 editPrecio: false, 383 editPrecio: false,
466 rubro: producto.CodRub, 384 rubro: producto.CodRub,
467 exentoUnitario: producto.precio, 385 exentoUnitario: producto.precio,
468 ivaUnitario: producto.IMPIVA, 386 ivaUnitario: producto.IMPIVA,
469 impuestoInternoUnitario: producto.ImpInt, 387 impuestoInternoUnitario: producto.ImpInt,
470 impuestoInterno1Unitario: producto.ImpInt2, 388 impuestoInterno1Unitario: producto.ImpInt2,
471 impuestoInterno2Unitario: producto.ImpInt3, 389 impuestoInterno2Unitario: producto.ImpInt3,
472 precioLista: producto.precio, 390 precioLista: producto.precio,
473 combustible: 1, 391 combustible: 1,
474 facturado: 0 392 facturado: 0
475 }; 393 };
476 $scope.articuloACargar = newArt; 394 $scope.articuloACargar = newArt;
477 $scope.cargando = false; 395 $scope.cargando = false;
478 }, function() { 396 }, function() {
479 // funcion ejecutada cuando se cancela el modal 397 // funcion ejecutada cuando se cancela el modal
480 } 398 }
481 ); 399 );
482 }; 400 };
483 401
484 $scope.seleccionarPuntosDeDescarga = function() { 402 $scope.seleccionarPuntosDeDescarga = function() {
485 if(!$scope.remito.cliente.COD || !$scope.remito.domicilio.id) { 403 if(!$scope.remito.cliente.COD || !$scope.remito.domicilio.id) {
486 focaModalService.alert('Primero seleccione un cliente y un domicilio'); 404 focaModalService.alert('Primero seleccione un cliente y un domicilio');
487 return; 405 return;
488 }else { 406 }else {
489 var modalInstance = $uibModal.open( 407 var modalInstance = $uibModal.open(
490 { 408 {
491 ariaLabelledBy: 'Búsqueda de Puntos de descarga', 409 ariaLabelledBy: 'Búsqueda de Puntos de descarga',
492 templateUrl: 'modal-punto-descarga.html', 410 templateUrl: 'modal-punto-descarga.html',
493 controller: 'focaModalPuntoDescargaController', 411 controller: 'focaModalPuntoDescargaController',
494 size: 'lg', 412 size: 'lg',
495 resolve: { 413 resolve: {
496 filters: { 414 filters: {
497 idDomicilio: $scope.remito.domicilio.id, 415 idDomicilio: $scope.remito.domicilio.id,
498 idCliente: $scope.remito.cliente.COD, 416 idCliente: $scope.remito.cliente.COD,
499 articulos: $scope.articulosTabla, 417 articulos: $scope.remito.articulosRemito,
500 puntosDescarga: $scope.remito.domicilio.puntosDescarga 418 puntosDescarga: $scope.remito.domicilio.puntosDescarga
501 } 419 }
502 } 420 }
503 } 421 }
504 ); 422 );
505 modalInstance.result.then( 423 modalInstance.result.then(
506 function(puntosDescarga) { 424 function(puntosDescarga) {
507 $scope.remito.puntosDescarga = puntosDescarga; 425 $scope.remito.puntosDescarga = puntosDescarga;
508 426
509 //AGREGO PUNTOS DE DESCARGA A CABECERA 427 //AGREGO PUNTOS DE DESCARGA A CABECERA
510 var puntosStamp = ''; 428 var puntosStamp = '';
511 puntosDescarga.forEach(function(punto, idx, arr) { 429 puntosDescarga.forEach(function(punto, idx, arr) {
512 puntosStamp += punto.descripcion; 430 puntosStamp += punto.descripcion;
513 if((idx + 1) !== arr.length) puntosStamp += ', '; 431 if((idx + 1) !== arr.length) puntosStamp += ', ';
514 }); 432 });
515 433
516 $scope.$broadcast('addCabecera', { 434 $scope.$broadcast('addCabecera', {
517 label: 'Puntos de descarga:', 435 label: 'Puntos de descarga:',
518 valor: puntosStamp 436 valor: puntosStamp
519 }); 437 });
520 }, function() { 438 }, function() {
521 $scope.abrirModalDomicilios($scope.cliente); 439 $scope.abrirModalDomicilios($scope.cliente);
522 } 440 }
523 ); 441 );
524 } 442 }
525 }; 443 };
526 444
527 $scope.seleccionarVendedor = function() { 445 $scope.seleccionarVendedor = function() {
528 if(varlidarRemitoFacturado()) { 446 if(varlidarRemitoFacturado()) {
529 var parametrosModal = { 447 var parametrosModal = {
530 titulo: 'Búsqueda vendedores', 448 titulo: 'Búsqueda vendedores',
531 query: '/vendedor', 449 query: '/vendedor',
532 columnas: [ 450 columnas: [
533 { 451 {
534 propiedad: 'NUM', 452 propiedad: 'NUM',
535 nombre: 'Código', 453 nombre: 'Código',
536 filtro: { 454 filtro: {
537 nombre: 'rellenarDigitos', 455 nombre: 'rellenarDigitos',
538 parametro: 3 456 parametro: 3
539 } 457 }
540 }, 458 },
541 { 459 {
542 propiedad: 'NOM', 460 propiedad: 'NOM',
543 nombre: 'Nombre' 461 nombre: 'Nombre'
544 } 462 }
545 ], 463 ],
546 size: 'md' 464 size: 'md'
547 }; 465 };
548 focaModalService.modal(parametrosModal).then( 466 focaModalService.modal(parametrosModal).then(
549 function(vendedor) { 467 function(vendedor) {
550 $scope.$broadcast('addCabecera',{ 468 $scope.$broadcast('addCabecera',{
551 label: 'Vendedor:', 469 label: 'Vendedor:',
552 valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' + 470 valor: $filter('rellenarDigitos')(vendedor.NUM, 3) + ' - ' +
553 vendedor.NOM 471 vendedor.NOM
554 }); 472 });
555 $scope.remito.idVendedor = vendedor.id; 473 $scope.remito.idVendedor = vendedor.id;
556 $scope.vendedor = vendedor; 474 $scope.remito.vendedor = vendedor;
557 }, function() { 475 }, function() {
558 476
559 } 477 }
560 ); 478 );
561 } 479 }
562 }; 480 };
563 481
564 $scope.seleccionarProveedor = function() { 482 $scope.seleccionarProveedor = function() {
565 if(varlidarRemitoFacturado()) { 483 if(varlidarRemitoFacturado()) {
566 var parametrosModal = { 484 var parametrosModal = {
567 titulo: 'Búsqueda de Proveedor', 485 titulo: 'Búsqueda de Proveedor',
568 query: '/proveedor', 486 query: '/proveedor',
569 columnas: [ 487 columnas: [
570 { 488 {
571 nombre: 'Código', 489 nombre: 'Código',
572 propiedad: 'COD', 490 propiedad: 'COD',
573 filtro: { 491 filtro: {
574 nombre: 'rellenarDigitos', 492 nombre: 'rellenarDigitos',
575 parametro: 5 493 parametro: 5
576 } 494 }
577 }, 495 },
578 { 496 {
579 nombre: 'Nombre', 497 nombre: 'Nombre',
580 propiedad: 'NOM' 498 propiedad: 'NOM'
581 }, 499 },
582 { 500 {
583 nombre: 'CUIT', 501 nombre: 'CUIT',
584 propiedad: 'CUIT' 502 propiedad: 'CUIT'
585 } 503 }
586 ], 504 ],
587 tipo: 'POST', 505 tipo: 'POST',
588 json: {razonCuitCod: ''} 506 json: {razonCuitCod: ''}
589 }; 507 };
590 focaModalService.modal(parametrosModal).then( 508 focaModalService.modal(parametrosModal).then(
591 function(proveedor) { 509 function(proveedor) {
510 $scope.remito.proveedor = proveedor;
592 $scope.remito.idProveedor = proveedor.COD; 511 $scope.remito.idProveedor = proveedor.COD;
512
593 $scope.$broadcast('addCabecera',{ 513 $scope.$broadcast('addCabecera',{
594 label: 'Proveedor:', 514 label: 'Proveedor:',
595 valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + 515 valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' +
596 proveedor.NOM 516 proveedor.NOM
597 }); 517 });
598 }, function() { 518 }, function() {
599 519
600 } 520 }
601 ); 521 );
602 } 522 }
603 }; 523 };
604 524
605 $scope.seleccionarCliente = function() { 525 $scope.seleccionarCliente = function() {
606 if(!$scope.vendedor) { 526 if (!$scope.remito.vendedor) {
607 focaModalService.alert('Primero seleccione un vendedor'); 527 focaModalService.alert('Primero seleccione un vendedor');
608 return; 528 return;
609 } 529 }
610 530
611 if(varlidarRemitoFacturado()) { 531 if (varlidarRemitoFacturado()) {
612 var modalInstance = $uibModal.open( 532 var modalInstance = $uibModal.open(
613 { 533 {
614 ariaLabelledBy: 'Busqueda de Cliente', 534 ariaLabelledBy: 'Busqueda de Cliente',
615 templateUrl: 'foca-busqueda-cliente-modal.html', 535 templateUrl: 'foca-busqueda-cliente-modal.html',
616 controller: 'focaBusquedaClienteModalController', 536 controller: 'focaBusquedaClienteModalController',
617 resolve: { 537 resolve: {
618 vendedor: function() { return $scope.vendedor; } 538 vendedor: function() { return $scope.remito.vendedor; }
619 }, 539 },
620 size: 'lg' 540 size: 'lg'
621 } 541 }
622 ); 542 );
623 modalInstance.result.then( 543 modalInstance.result.then(
624 function(cliente) { 544 function(cliente) {
625 $scope.abrirModalDomicilios(cliente); 545 $scope.abrirModalDomicilios(cliente);
626 $scope.cliente = cliente; 546 $scope.cliente = cliente;
627 }, function() { 547 }, function() {
628 548
629 } 549 }
630 ); 550 );
631 } 551 }
632 }; 552 };
633 553
634 $scope.abrirModalDomicilios = function(cliente) { 554 $scope.abrirModalDomicilios = function(cliente) {
635 var modalInstanceDomicilio = $uibModal.open( 555 var modalInstanceDomicilio = $uibModal.open(
636 { 556 {
637 ariaLabelledBy: 'Busqueda de Domicilios', 557 ariaLabelledBy: 'Busqueda de Domicilios',
638 templateUrl: 'modal-domicilio.html', 558 templateUrl: 'modal-domicilio.html',
639 controller: 'focaModalDomicilioController', 559 controller: 'focaModalDomicilioController',
640 size: 'lg', 560 size: 'lg',
641 resolve: { 561 resolve: {
642 idCliente: function() { return cliente.cod; }, 562 idCliente: function() { return cliente.cod; },
643 esNuevo: function() { return cliente.esNuevo; } 563 esNuevo: function() { return cliente.esNuevo; }
644 } 564 }
645 } 565 }
646 ); 566 );
647 modalInstanceDomicilio.result.then( 567 modalInstanceDomicilio.result.then(
648 function(domicilio) { 568 function(domicilio) {
649 $scope.remito.domicilio = domicilio; 569 $scope.remito.domicilio = domicilio;
650 $scope.remito.cliente = { 570 $scope.remito.cliente = {
651 COD: cliente.cod, 571 COD: cliente.cod,
652 CUIT: cliente.cuit, 572 CUIT: cliente.cuit,
653 NOM: cliente.nom, 573 NOM: cliente.nom,
654 MAIL: cliente.mail 574 MAIL: cliente.mail
655 }; 575 };
656 576
657 577
658 var domicilioStamp = 578 var domicilioStamp =
659 domicilio.Calle + ' ' + domicilio.Numero + ', ' + 579 domicilio.Calle + ' ' + domicilio.Numero + ', ' +
660 domicilio.Localidad + ', ' + domicilio.Provincia; 580 domicilio.Localidad + ', ' + domicilio.Provincia;
661 $scope.remito.domicilioStamp = domicilioStamp; 581 $scope.remito.domicilioStamp = domicilioStamp;
662 582
663 $scope.$broadcast('addCabecera',{ 583 $scope.$broadcast('addCabecera',{
664 label: 'Cliente:', 584 label: 'Cliente:',
665 valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom 585 valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom
666 }); 586 });
667 $scope.$broadcast('addCabecera',{ 587 $scope.$broadcast('addCabecera',{
668 label: 'Domicilio:', 588 label: 'Domicilio:',
669 valor: domicilioStamp 589 valor: domicilioStamp
670 }); 590 });
671 591
672 if(domicilio.verPuntos) { 592 if(domicilio.verPuntos) {
673 delete $scope.remito.domicilio.verPuntos; 593 delete $scope.remito.domicilio.verPuntos;
674 $scope.seleccionarPuntosDeDescarga(); 594 $scope.seleccionarPuntosDeDescarga();
675 }else { 595 }else {
676 crearRemitoService 596 crearRemitoService
677 .getPuntosDescargaByClienDom(domicilio.id, cliente.cod) 597 .getPuntosDescargaByClienDom(domicilio.id, cliente.cod)
678 .then(function(res) { 598 .then(function(res) {
679 if(res.data.length) $scope.seleccionarPuntosDeDescarga(); 599 if(res.data.length) $scope.seleccionarPuntosDeDescarga();
680 }); 600 });
681 } 601 }
682 }, function() { 602 }, function() {
683 $scope.seleccionarCliente(); 603 $scope.seleccionarCliente();
684 return; 604 return;
685 } 605 }
686 ); 606 );
687 }; 607 };
688 608
689 $scope.mostrarFichaCliente = function() { 609 $scope.mostrarFichaCliente = function() {
690 $uibModal.open( 610 $uibModal.open(
691 { 611 {
692 ariaLabelledBy: 'Datos del Cliente', 612 ariaLabelledBy: 'Datos del Cliente',
693 templateUrl: 'foca-crear-remito-ficha-cliente.html', 613 templateUrl: 'foca-crear-remito-ficha-cliente.html',
694 controller: 'focaCrearRemitoFichaClienteController', 614 controller: 'focaCrearRemitoFichaClienteController',
695 size: 'lg' 615 size: 'lg'
696 } 616 }
697 ); 617 );
698 }; 618 };
699 619
700 $scope.getTotal = function() { 620 $scope.getTotal = function() {
701 var total = 0; 621 var total = 0;
702 var arrayTempArticulos = $scope.articulosTabla; 622 var arrayTempArticulos = $scope.remito.articulosRemito;
703 for(var i = 0; i < arrayTempArticulos.length; i++) { 623 for(var i = 0; i < arrayTempArticulos.length; i++) {
704 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; 624 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad;
705 } 625 }
706 return parseFloat(total.toFixed(2)); 626 return parseFloat(total.toFixed(2));
707 }; 627 };
708 628
709 $scope.getSubTotal = function() { 629 $scope.getSubTotal = function() {
710 if($scope.articuloACargar) { 630 if($scope.articuloACargar) {
711 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; 631 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
712 } 632 }
713 }; 633 };
714 634
715 $scope.seleccionarPreciosYCondiciones = function() { 635 $scope.seleccionarPreciosYCondiciones = function() {
716 if(varlidarRemitoFacturado()) { 636 if(varlidarRemitoFacturado()) {
717 var modalInstance = $uibModal.open( 637 var modalInstance = $uibModal.open(
718 { 638 {
719 ariaLabelledBy: 'Busqueda de Precio Condición', 639 ariaLabelledBy: 'Busqueda de Precio Condición',
720 templateUrl: 'modal-precio-condicion.html', 640 templateUrl: 'modal-precio-condicion.html',
721 controller: 'focaModalPrecioCondicionController', 641 controller: 'focaModalPrecioCondicionController',
722 size: 'lg' 642 size: 'lg'
723 } 643 }
724 ); 644 );
725 modalInstance.result.then( 645 modalInstance.result.then(
726 function(precioCondicion) { 646 function(precioCondicion) {
727 var cabecera = ''; 647 var cabecera = '';
728 var plazosConcat = ''; 648 var plazosConcat = '';
729 if(!Array.isArray(precioCondicion)) { 649 if(!Array.isArray(precioCondicion)) {
730 $scope.remito.idPrecioCondicion = precioCondicion.id; 650 $scope.remito.idPrecioCondicion = precioCondicion.id;
731 $scope.plazosPagos = precioCondicion.plazoPago; 651 $scope.remito.remitoPlazo = precioCondicion.plazoPago;
732 $scope.idLista = precioCondicion.idListaPrecio; 652 $scope.idLista = precioCondicion.idListaPrecio;
733 for(var i = 0; i < precioCondicion.plazoPago.length; i++) { 653 for(var i = 0; i < precioCondicion.plazoPago.length; i++) {
734 plazosConcat += precioCondicion.plazoPago[i].dias + ' '; 654 plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
735 } 655 }
736 cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) + 656 cabecera = $filter('rellenarDigitos')(precioCondicion.id, 4) +
737 ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim(); 657 ' - ' + precioCondicion.nombre + ' ' + plazosConcat.trim();
738 }else { //Cuando se ingresan los plazos manualmente 658 }else { //Cuando se ingresan los plazos manualmente
739 $scope.remito.idPrecioCondicion = 0; 659 $scope.remito.idPrecioCondicion = 0;
740 //-1, el modal productos busca todos los productos 660 //-1, el modal productos busca todos los productos
741 $scope.idLista = -1; 661 $scope.idLista = -1;
742 $scope.plazosPagos = precioCondicion; 662 $scope.remito.remitoPlazo = precioCondicion;
743 for(var j = 0; j < precioCondicion.length; j++) { 663 for(var j = 0; j < precioCondicion.length; j++) {
744 plazosConcat += precioCondicion[j].dias + ' '; 664 plazosConcat += precioCondicion[j].dias + ' ';
745 } 665 }
746 cabecera = 'Ingreso manual ' + plazosConcat.trim(); 666 cabecera = 'Ingreso manual ' + plazosConcat.trim();
747 } 667 }
748 $scope.articulosTabla = []; 668 $scope.remito.articulosRemito = [];
749 $scope.$broadcast('addCabecera',{ 669 $scope.$broadcast('addCabecera',{
750 label: 'Precios y condiciones:', 670 label: 'Precios y condiciones:',
751 valor: cabecera 671 valor: cabecera
752 }); 672 });
673
674 $scope.remito.precioCondicion = precioCondicion;
753 }, function() { 675 }, function() {
754 676
755 } 677 }
756 ); 678 );
757 } 679 }
758 }; 680 };
759 681
760 $scope.seleccionarFlete = function() { 682 $scope.seleccionarFlete = function() {
761 if(varlidarRemitoFacturado()) { 683 if(varlidarRemitoFacturado()) {
762 var modalInstance = $uibModal.open( 684 var modalInstance = $uibModal.open(
763 { 685 {
764 ariaLabelledBy: 'Busqueda de Flete', 686 ariaLabelledBy: 'Busqueda de Flete',
765 templateUrl: 'modal-flete.html', 687 templateUrl: 'modal-flete.html',
766 controller: 'focaModalFleteController', 688 controller: 'focaModalFleteController',
767 size: 'lg', 689 size: 'lg',
768 resolve: { 690 resolve: {
769 parametrosFlete: 691 parametrosFlete:
770 function() { 692 function() {
771 return { 693 return {
772 flete: $scope.remito.flete ? '1' : 694 flete: $scope.remito.flete ? '1' :
773 ($scope.remito.fob ? 'FOB' : 695 ($scope.remito.fob ? 'FOB' :
774 ($scope.remito.flete === undefined ? null : '0')), 696 ($scope.remito.flete === undefined ? null : '0')),
775 bomba: $scope.remito.bomba ? '1' : 697 bomba: $scope.remito.bomba ? '1' :
776 ($scope.remito.bomba === undefined ? null : '0'), 698 ($scope.remito.bomba === undefined ? null : '0'),
777 kilometros: $scope.remito.kilometros 699 kilometros: $scope.remito.kilometros
778 }; 700 };
779 } 701 }
780 } 702 }
781 } 703 }
782 ); 704 );
783 modalInstance.result.then( 705 modalInstance.result.then(
784 function(datos) { 706 function(datos) {
785 $scope.remito.flete = datos.flete; 707 $scope.remito.flete = datos.flete;
786 $scope.remito.fob = datos.FOB; 708 $scope.remito.fob = datos.FOB;
787 $scope.remito.bomba = datos.bomba; 709 $scope.remito.bomba = datos.bomba;
788 $scope.remito.kilometros = datos.kilometros; 710 $scope.remito.kilometros = datos.kilometros;
789 711
790 $scope.$broadcast('addCabecera',{ 712 $scope.$broadcast('addCabecera',{
791 label: 'Flete:', 713 label: 'Flete:',
792 valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No') 714 valor: datos.flete ? 'Si' : ($scope.remito.fob ? 'FOB' : 'No')
793 }); 715 });
794 if(datos.flete) { 716 if(datos.flete) {
795 $scope.$broadcast('addCabecera',{ 717 $scope.$broadcast('addCabecera',{
796 label: 'Bomba:', 718 label: 'Bomba:',
797 valor: datos.bomba ? 'Si' : 'No' 719 valor: datos.bomba ? 'Si' : 'No'
798 }); 720 });
799 $scope.$broadcast('addCabecera',{ 721 $scope.$broadcast('addCabecera',{
800 label: 'Kilometros:', 722 label: 'Kilometros:',
801 valor: datos.kilometros 723 valor: datos.kilometros
802 }); 724 });
803 }else { 725 }else {
804 $scope.$broadcast('removeCabecera', 'Bomba:'); 726 $scope.$broadcast('removeCabecera', 'Bomba:');
805 $scope.$broadcast('removeCabecera', 'Kilometros:'); 727 $scope.$broadcast('removeCabecera', 'Kilometros:');
806 $scope.remito.fob = false; 728 $scope.remito.fob = false;
807 $scope.remito.bomba = false; 729 $scope.remito.bomba = false;
808 $scope.remito.kilometros = null; 730 $scope.remito.kilometros = null;
809 } 731 }
810 }, function() { 732 }, function() {
811 733
812 } 734 }
813 ); 735 );
814 } 736 }
815 }; 737 };
816 738
817 $scope.seleccionarMoneda = function() { 739 $scope.seleccionarMoneda = function() {
818 if(varlidarRemitoFacturado()) { 740 if(varlidarRemitoFacturado()) {
819 var parametrosModal = { 741 var parametrosModal = {
820 titulo: 'Búsqueda de monedas', 742 titulo: 'Búsqueda de monedas',
821 query: '/moneda', 743 query: '/moneda',
822 columnas: [ 744 columnas: [
823 { 745 {
824 propiedad: 'DETALLE', 746 propiedad: 'DETALLE',
825 nombre: 'Nombre' 747 nombre: 'Nombre'
826 }, 748 },
827 { 749 {
828 propiedad: 'SIMBOLO', 750 propiedad: 'SIMBOLO',
829 nombre: 'Símbolo' 751 nombre: 'Símbolo'
830 } 752 }
831 ], 753 ],
832 size: 'md' 754 size: 'md'
833 }; 755 };
834 focaModalService.modal(parametrosModal).then( 756 focaModalService.modal(parametrosModal).then(
835 function(moneda) { 757 function(moneda) {
836 $scope.abrirModalCotizacion(moneda); 758 $scope.abrirModalCotizacion(moneda);
837 }, function() { 759 }, function() {
838 760
839 } 761 }
840 ); 762 );
841 } 763 }
842 }; 764 };
843 765
844 $scope.seleccionarObservaciones = function() { 766 $scope.seleccionarObservaciones = function() {
845 focaModalService 767 focaModalService
846 .prompt('Ingrese observaciones', $scope.remito.observaciones, true, true) 768 .prompt('Observaciones', $scope.remito.observaciones, true, true)
847 .then(function(observaciones) { 769 .then(function(observaciones) {
848 $scope.remito.observaciones = observaciones; 770 $scope.remito.observaciones = observaciones;
849 }); 771 });
850 }; 772 };
851 773
852 $scope.abrirModalCotizacion = function(moneda) { 774 $scope.abrirModalCotizacion = function(moneda) {
853 var modalInstance = $uibModal.open( 775 var modalInstance = $uibModal.open(
854 { 776 {
855 ariaLabelledBy: 'Busqueda de Cotización', 777 ariaLabelledBy: 'Busqueda de Cotización',
856 templateUrl: 'modal-cotizacion.html', 778 templateUrl: 'modal-cotizacion.html',
857 controller: 'focaModalCotizacionController', 779 controller: 'focaModalCotizacionController',
858 size: 'lg', 780 size: 'lg',
859 resolve: {idMoneda: function() {return moneda.ID;}} 781 resolve: {idMoneda: function() {return moneda.ID;}}
860 } 782 }
861 ); 783 );
862 modalInstance.result.then( 784 modalInstance.result.then(
863 function(cotizacion) { 785 function(cotizacion) {
864 var articulosTablaTemp = $scope.articulosTabla; 786 var articulosTablaTemp = $scope.remito.articulosRemito;
865 for(var i = 0; i < articulosTablaTemp.length; i++) { 787 for(var i = 0; i < articulosTablaTemp.length; i++) {
866 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * 788 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio *
867 $scope.remito.cotizacion.COTIZACION; 789 $scope.remito.cotizacion.COTIZACION;
868 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / 790 articulosTablaTemp[i].precio = articulosTablaTemp[i].precio /
869 cotizacion.COTIZACION; 791 cotizacion.COTIZACION;
870 } 792 }
871 $scope.articulosTabla = articulosTablaTemp; 793 $scope.remito.articulosRemito = articulosTablaTemp;
872 $scope.remito.moneda = moneda; 794 $scope.remito.cotizacion.moneda = moneda;
873 $scope.remito.cotizacion = cotizacion; 795 $scope.remito.cotizacion = cotizacion;
874 if(moneda.DETALLE === 'PESOS ARGENTINOS') { 796 if(moneda.DETALLE === 'PESOS ARGENTINOS') {
875 $scope.$broadcast('removeCabecera', 'Moneda:'); 797 $scope.$broadcast('removeCabecera', 'Moneda:');
876 $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); 798 $scope.$broadcast('removeCabecera', 'Fecha cotizacion:');
877 $scope.$broadcast('removeCabecera', 'Cotizacion:'); 799 $scope.$broadcast('removeCabecera', 'Cotizacion:');
878 }else { 800 }else {
879 $scope.$broadcast('addCabecera',{ 801 $scope.$broadcast('addCabecera',{
880 label: 'Moneda:', 802 label: 'Moneda:',
881 valor: moneda.DETALLE 803 valor: moneda.DETALLE
882 }); 804 });
883 $scope.$broadcast('addCabecera',{ 805 $scope.$broadcast('addCabecera',{
884 label: 'Fecha cotizacion:', 806 label: 'Fecha cotizacion:',
885 valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') 807 valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
886 }); 808 });
887 $scope.$broadcast('addCabecera',{ 809 $scope.$broadcast('addCabecera',{
888 label: 'Cotizacion:', 810 label: 'Cotizacion:',
889 valor: $filter('number')(cotizacion.COTIZACION, '2') 811 valor: $filter('number')(cotizacion.COTIZACION, '2')
890 }); 812 });
891 } 813 }
892 }, function() { 814 }, function() {
893 815
894 } 816 }
895 ); 817 );
896 }; 818 };
897 819
898 $scope.agregarATabla = function(key) { 820 $scope.agregarATabla = function(key) {
899 if(key === 13) { 821 if(key === 13) {
900 if($scope.articuloACargar.cantidad === undefined || 822 if($scope.articuloACargar.cantidad === undefined ||
901 $scope.articuloACargar.cantidad === 0 || 823 $scope.articuloACargar.cantidad === 0 ||
902 $scope.articuloACargar.cantidad === null ) { 824 $scope.articuloACargar.cantidad === null ) {
903 focaModalService.alert('El valor debe ser al menos 1'); 825 focaModalService.alert('El valor debe ser al menos 1');
904 return; 826 return;
905 } 827 }
906 delete $scope.articuloACargar.sectorCodigo; 828 delete $scope.articuloACargar.sectorCodigo;
907 $scope.articulosTabla.push($scope.articuloACargar); 829 $scope.remito.articulosRemito.push($scope.articuloACargar);
908 $scope.cargando = true; 830 $scope.cargando = true;
909 } 831 }
910 }; 832 };
911 833
912 $scope.quitarArticulo = function(key) { 834 $scope.quitarArticulo = function(key) {
913 $scope.articulosTabla.splice(key, 1); 835 $scope.remito.articulosRemito.splice(key, 1);
914 }; 836 };
915 837
916 $scope.editarArticulo = function(key, articulo) { 838 $scope.editarArticulo = function(key, articulo) {
917 if(key === 13) { 839 if(key === 13) {
918 if(articulo.cantidad === null || articulo.cantidad === 0 || 840 if(articulo.cantidad === null || articulo.cantidad === 0 ||
919 articulo.cantidad === undefined) { 841 articulo.cantidad === undefined) {
920 focaModalService.alert('El valor debe ser al menos 1'); 842 focaModalService.alert('El valor debe ser al menos 1');
921 return; 843 return;
922 } 844 }
923 articulo.editCantidad = false; 845 articulo.editCantidad = false;
924 articulo.editPrecio = false; 846 articulo.editPrecio = false;
925 } 847 }
926 }; 848 };
927 849
928 $scope.cambioEdit = function(articulo, propiedad) { 850 $scope.cambioEdit = function(articulo, propiedad) {
929 if(propiedad === 'cantidad') { 851 if(propiedad === 'cantidad') {
930 articulo.editCantidad = true; 852 articulo.editCantidad = true;
931 }else if(propiedad === 'precio') { 853 }else if(propiedad === 'precio') {
932 articulo.editPrecio = true; 854 articulo.editPrecio = true;
933 } 855 }
934 }; 856 };
935 857
936 $scope.limpiarFlete = function() { 858 $scope.limpiarFlete = function() {
937 $scope.remito.fleteNombre = ''; 859 $scope.remito.fleteNombre = '';
938 $scope.remito.chofer = ''; 860 $scope.remito.chofer = '';
939 $scope.remito.vehiculo = ''; 861 $scope.remito.vehiculo = '';
940 $scope.remito.kilometros = ''; 862 $scope.remito.kilometros = '';
941 $scope.remito.costoUnitarioKmFlete = ''; 863 $scope.remito.costoUnitarioKmFlete = '';
942 $scope.choferes = ''; 864 $scope.choferes = '';
943 $scope.vehiculos = ''; 865 $scope.vehiculos = '';
944 }; 866 };
945 867
946 $scope.limpiarPantalla = function() { 868 $scope.limpiarPantalla = function() {
947 $scope.limpiarFlete(); 869 $scope.limpiarFlete();
948 $scope.remito.flete = '0'; 870 $scope.remito.flete = '0';
949 $scope.remito.bomba = '0'; 871 $scope.remito.bomba = '0';
950 $scope.remito.precioCondicion = ''; 872 $scope.remito.precioCondicion = '';
951 $scope.articulosTabla = []; 873 $scope.remito.articulosRemito = [];
952 $scope.remito.vendedor.nombre = ''; 874 $scope.remito.vendedor.nombre = '';
953 $scope.remito.cliente = {nombre: ''}; 875 $scope.remito.cliente = {nombre: ''};
954 $scope.remito.domicilio = {dom: ''}; 876 $scope.remito.domicilio = {dom: ''};
955 $scope.domiciliosCliente = []; 877 $scope.domiciliosCliente = [];
956 }; 878 };
957 879
958 $scope.resetFilter = function() { 880 $scope.resetFilter = function() {
959 $scope.articuloACargar = {}; 881 $scope.articuloACargar = {};
960 $scope.cargando = true; 882 $scope.cargando = true;
961 }; 883 };
962 //Recibe aviso si el teclado está en uso 884 //Recibe aviso si el teclado está en uso
963 $rootScope.$on('usarTeclado', function(event, data) { 885 $rootScope.$on('usarTeclado', function(event, data) {
964 if(data) { 886 if(data) {
965 $scope.mostrarTeclado = true; 887 $scope.mostrarTeclado = true;
966 return; 888 return;
967 } 889 }
968 $scope.mostrarTeclado = false; 890 $scope.mostrarTeclado = false;
969 }); 891 });
970 892
971 $scope.selectFocus = function($event) { 893 $scope.selectFocus = function($event) {
972 // Si el teclado esta en uso no selecciona el valor 894 // Si el teclado esta en uso no selecciona el valor
973 if($scope.mostrarTeclado) { 895 if($scope.mostrarTeclado) {
974 return; 896 return;
975 } 897 }
976 $event.target.select(); 898 $event.target.select();
977 }; 899 };
978 900
979 function addArrayCabecera(array) { 901 function addArrayCabecera(array) {
980 for(var i = 0; i < array.length; i++) { 902 for(var i = 0; i < array.length; i++) {
981 $scope.$broadcast('addCabecera',{ 903 $scope.$broadcast('addCabecera',{
982 label: array[i].label, 904 label: array[i].label,
983 valor: array[i].valor 905 valor: array[i].valor
984 }); 906 });
985 } 907 }
986 } 908 }
987 909
988 function rellenar(relleno, longitud) { 910 function rellenar(relleno, longitud) {
989 relleno = '' + relleno; 911 relleno = '' + relleno;
990 while (relleno.length < longitud) { 912 while (relleno.length < longitud) {
991 relleno = '0' + relleno; 913 relleno = '0' + relleno;
992 } 914 }
993 915
994 return relleno; 916 return relleno;
995 } 917 }
996 918
997 function varlidarRemitoFacturado() { 919 function varlidarRemitoFacturado() {
998 if($scope.remito.estado !== 5) { 920 if($scope.remito.estado !== 5) {
999 return true; 921 return true;
1000 }else { 922 }else {
1001 focaModalService.alert('No se puede editar un remito facturado'); 923 focaModalService.alert('No se puede editar un remito facturado');
1002 return false(); 924 return false();
1003 } 925 }
1004 } 926 }
1005 927
1006 function salir() { 928 function salir() {
1007 var confirmacion = false; 929 var confirmacion = false;
1008 930
1009 angular.forEach($scope.inicial, function(valor, key) { 931 if (!angular.equals($scope.remito, $scope.inicial)) {
1010 if (!angular.equals($scope[key], $scope.inicial[key])) { 932 confirmacion = true;
1011 confirmacion = true; 933 }
1012 }
1013 });
1014 934
1015 if (confirmacion) { 935 if (confirmacion) {
1016 focaModalService.confirm( 936 focaModalService.confirm(
1017 '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' 937 '¿Está seguro de que desea salir? Se perderán todos los datos cargados.'
1018 ).then(function(data) { 938 ).then(function(data) {
1019 if (data) { 939 if (data) {
1020 $location.path('/'); 940 $location.path('/');
1021 } 941 }
1022 }); 942 });
1023 } else { 943 } else {
1024 $location.path('/'); 944 $location.path('/');
1025 } 945 }
1026 } 946 }
1027 947
1028 function enableObservaciones(val) { 948 function enableObservaciones(val) {
1029 var boton = $scope.botonera.filter(function(botonObs) { 949 var boton = $scope.botonera.filter(function(botonObs) {
1030 return botonObs.label === 'Observaciones'; 950 return botonObs.label === 'Observaciones';
1031 }); 951 });
1032 952
1033 boton[0].disable = !val; 953 boton[0].disable = !val;
1034 } 954 }
955
956 function setearRemito(remito) {
957 //añado cabeceras
958 $scope.$broadcast('removeCabecera', 'Moneda:');
959 $scope.$broadcast('removeCabecera', 'Fecha cotizacion:');
960 $scope.$broadcast('removeCabecera', 'Cotizacion:');
961
962 var cabeceras = [];
963
964 if (remito.cotizacion.ID) {
965 cabeceras.push({
966 label: 'Moneda:',
967 valor: remito.cotizacion.moneda.DETALLE
1 angular.module('focaCrearRemito') 1 angular.module('focaCrearRemito')
2 .service('crearRemitoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { 2 .service('crearRemitoService', ['$http', 'API_ENDPOINT',
3 function($http, API_ENDPOINT) {
3 var route = API_ENDPOINT.URL; 4 var route = API_ENDPOINT.URL;
4 return { 5 return {
5 crearRemito: function(remito) { 6 crearRemito: function(remito) {
6 // TODO: Cambiar para usar el servicio /remito 7 // TODO: Cambiar para usar el servicio /remito
7 return $http.post(route + '/remito', remito); 8 return $http.post(route + '/remito', remito);
8 }, 9 },
9 getRemitoById: function(id) { 10 getRemitoById: function(id) {
10 return $http.get(route + '/remito/obtener/' + id); 11 return $http.get(route + '/remito/obtener/' + id);
11 }, 12 },
12 obtenerRemito: function() { 13 obtenerRemito: function() {
13 return $http.get(route +'/nota-pedido'); 14 return $http.get(route +'/nota-pedido');
14 }, 15 },
15 setRemito: function(remito) { 16 setRemito: function(remito) {
16 this.remito = remito; 17 this.remito = remito;
17 }, 18 },
18 clearRemito: function() { 19 clearRemito: function() {
19 this.remito = undefined; 20 this.remito = undefined;
20 }, 21 },
21 getRemito: function() { 22 getRemito: function() {
22 return this.remito; 23 return this.remito;
23 }, 24 },
24 getArticulosByIdRemito: function(id) { 25 getArticulosByIdRemito: function(id) {
25 return $http.get(route+'/articulos/nota-pedido/'+id); 26 return $http.get(route+'/articulos/nota-pedido/'+id);
26 }, 27 },
27 crearArticulosParaRemito: function(articuloRemito) { 28 crearArticulosParaRemito: function(articuloRemito) {
28 return $http.post(route + '/articulos/remito', 29 return $http.post(route + '/articulos/remito',
29 {articuloRemito: articuloRemito}); 30 {articuloRemito: articuloRemito});
30 }, 31 },
31 getDomiciliosByIdRemito: function(id) { 32 getDomiciliosByIdRemito: function(id) {
32 return $http.get(route +'/nota-pedido/'+id+'/domicilios'); 33 return $http.get(route +'/nota-pedido/'+id+'/domicilios');
33 }, 34 },
34 getDomiciliosByIdCliente: function(id) { 35 getDomiciliosByIdCliente: function(id) {
35 var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) 36 var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega)
36 return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); 37 return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id );
37 }, 38 },
38 getPrecioCondicion: function() { 39 getPrecioCondicion: function() {
39 return $http.get(route + '/precio-condicion'); 40 return $http.get(route + '/precio-condicion');
40 }, 41 },
41 getPrecioCondicionById: function(id) { 42 getPrecioCondicionById: function(id) {
42 return $http.get(route + '/precio-condicion/' + id); 43 return $http.get(route + '/precio-condicion/' + id);
43 }, 44 },
44 getPlazoPagoByPrecioCondicion: function(id) { 45 getPlazoPagoByPrecioCondicion: function(id) {
45 return $http.get(route + '/plazo-pago/precio-condicion/'+ id); 46 return $http.get(route + '/plazo-pago/precio-condicion/'+ id);
46 }, 47 },
47 crearFlete: function(flete) { 48 crearFlete: function(flete) {
48 return $http.post(route + '/flete', {flete : flete}); 49 return $http.post(route + '/flete', {flete : flete});
49 }, 50 },
50 crearPlazosParaRemito: function(plazos) { 51 crearPlazosParaRemito: function(plazos) {
51 return $http.post(route + '/plazo-pago/remito', plazos); 52 return $http.post(route + '/plazo-pago/remito', plazos);
52 }, 53 },
53 getCotizacionByIdMoneda: function(id) { 54 getCotizacionByIdMoneda: function(id) {
54 return $http.get(route + '/moneda/' + id); 55 return $http.get(route + '/moneda/' + id);
55 }, 56 },
56 crearEstadoParaRemito: function(estado) { 57 crearEstadoParaRemito: function(estado) {
57 return $http.post(route + '/estado', {estado: estado}); 58 return $http.post(route + '/estado', {estado: estado});
58 }, 59 },
59 getNumeroRemito: function() { 60 getNumeroRemito: function() {
60 return $http.get(route + '/remito/numero-siguiente'); 61 return $http.get(route + '/remito/numero-siguiente');
61 }, 62 },
62 imprimirRemitoByIdRemito: function(idRemito, original) { 63 imprimirRemitoByIdRemito: function(idRemito, original) {
63 var tipo = original ? '/original' : ''; 64 var tipo = original ? '/original' : '';
64 return $http.get(route + '/remito/comprobante/' + idRemito + tipo, { 65 return $http.get(route + '/remito/comprobante/' + idRemito + tipo, {
65 responseType: 'arraybuffer' 66 responseType: 'arraybuffer'
66 }); 67 });
67 }, 68 },
68 getPuntosDescargaByClienDom: function(idDomicilio, idCliente) { 69 getPuntosDescargaByClienDom: function(idDomicilio, idCliente) {
69 return $http.get(API_ENDPOINT.URL + '/punto-descarga/' + 70 return $http.get(API_ENDPOINT.URL + '/punto-descarga/' +
70 idDomicilio + '/' + idCliente); 71 idDomicilio + '/' + idCliente);
71 }, 72 },
72 enviarCorreo: function(options) { 73 enviarCorreo: function(options) {
73 return $http.post(API_ENDPOINT.URL + '/remito/mail', options); 74 return $http.post(API_ENDPOINT.URL + '/remito/mail', options);
74 }, 75 },
75 getBotonera: function() { 76 getBotonera: function() {
76 return [ 77 return [
77 { 78 {
78 label: 'Nota pedido', 79 label: 'Nota pedido',
79 image: 'notaDePedido.png' 80 image: 'notaDePedido.png'
80 }, 81 },
81 { 82 {
82 label: 'Vendedor', 83 label: 'Vendedor',
83 image: 'vendedor.png' 84 image: 'vendedor.png'
84 }, 85 },
85 { 86 {
86 label: 'Cliente', 87 label: 'Cliente',
87 image: 'cliente.png' 88 image: 'cliente.png'
88 }, 89 },
89 { 90 {
90 label: 'Proveedor', 91 label: 'Proveedor',
91 image: 'proveedor.png' 92 image: 'proveedor.png'
92 }, 93 },
93 { 94 {
94 label: 'Moneda', 95 label: 'Moneda',
95 image: 'moneda.png' 96 image: 'moneda.png'
96 }, 97 },
97 { 98 {
98 label: 'Precios y condiciones', 99 label: 'Precios y condiciones',
99 image: 'precios-condiciones.png' 100 image: 'precios-condiciones.png'
100 }, 101 },
101 { 102 {
102 label: 'Flete', 103 label: 'Flete',
103 image: 'flete.png' 104 image: 'flete.png'
104 }, 105 },
105 { 106 {
106 label: 'Productos', 107 label: 'Productos',
107 image: 'productos.png' 108 image: 'productos.png'
108 }, 109 },
109 { 110 {
110 label: 'Observaciones', 111 label: 'Observaciones',
111 image: 'productos.png', 112 image: 'productos.png',
112 disable: true 113 disable: true
113 } 114 }
114 ]; 115 ];
115 } 116 }
116 }; 117 };
117 }]); 118 }]);
118 119
src/views/remito.html
1 <div class="crear-nota-remito foca-crear row"> 1 <div class="crear-nota-remito foca-crear row">
2 <foca-cabecera-facturador 2 <foca-cabecera-facturador
3 titulo="'Remito'" 3 titulo="'Remito'"
4 numero="puntoVenta + '-' + comprobante" 4 numero="puntoVenta + '-' + comprobante"
5 fecha="now" 5 fecha="now"
6 class="mb-0 col-lg-12" 6 class="mb-0 col-lg-12"
7 busqueda="seleccionarRemito" 7 busqueda="seleccionarRemito"
8 ></foca-cabecera-facturador> 8 ></foca-cabecera-facturador>
9 <div class="col-lg-12"> 9 <div class="col-lg-12">
10 <div class="row mt-4"> 10 <div class="row mt-4">
11 <div class="col-12 col-md-10 col-lg-10 border border-light rounded"> 11 <div class="col-12 col-md-10 col-lg-10 border border-light rounded">
12 <div class="row p-1 botonera-secundaria px-5 py-2"> 12 <div class="row p-1 botonera-secundaria px-5 py-2">
13 <div class="col-12"> 13 <div class="col-12">
14 <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador> 14 <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador>
15 </div> 15 </div>
16 </div> 16 </div>
17 <!-- PC --> 17 <!-- PC -->
18 <div class="row grilla-articulo align-items-end d-none d-sm-flex"> 18 <div class="row grilla-articulo align-items-end d-none d-sm-flex">
19 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> 19 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom">
20 <thead> 20 <thead>
21 <tr class="d-flex"> 21 <tr class="d-flex">
22 <th class="">#</th> 22 <th class="">#</th>
23 <th class="col">Código</th> 23 <th class="col">Código</th>
24 <th class="col-4">Descripción</th> 24 <th class="col-4">Descripción</th>
25 <th class="col text-right">Cantidad</th> 25 <th class="col text-right">Cantidad</th>
26 <th class="col text-right">Precio Unitario</th> 26 <th class="col text-right">Precio Unitario</th>
27 <th class="col text-right">SubTotal</th> 27 <th class="col text-right">SubTotal</th>
28 <th class="text-right"> 28 <th class="text-right">
29 <button 29 <button
30 class="btn btn-outline-light selectable" 30 class="btn btn-outline-light selectable"
31 ng-click="show = !show; masMenos()" 31 ng-click="show = !show; masMenos()"
32 > 32 >
33 <i 33 <i
34 class="fa fa-chevron-down" 34 class="fa fa-chevron-down"
35 ng-show="show" 35 ng-show="show"
36 aria-hidden="true" 36 aria-hidden="true"
37 > 37 >
38 </i> 38 </i>
39 <i 39 <i
40 class="fa fa-chevron-up" 40 class="fa fa-chevron-up"
41 ng-hide="show" 41 ng-hide="show"
42 aria-hidden="true"> 42 aria-hidden="true">
43 </i> 43 </i>
44 </button> 44 </button>
45 </th> 45 </th>
46 </tr> 46 </tr>
47 </thead> 47 </thead>
48 <tbody class="tabla-articulo-body"> 48 <tbody class="tabla-articulo-body">
49 <tr 49 <tr
50 ng-repeat="(key, articulo) in articulosTabla" 50 ng-repeat="(key, articulo) in remito.articulosRemito"
51 ng-show="show || key == (articulosTabla.length - 1)" 51 ng-show="show || key == (remito.articulosRemito.length - 1)"
52 class="d-flex" 52 class="d-flex"
53 > 53 >
54 <td ng-bind="key + 1"></td> 54 <td ng-bind="key + 1"></td>
55 <td 55 <td
56 class="col" 56 class="col"
57 ng-bind="articulo.sector + '-' + articulo.codigo" 57 ng-bind="articulo.sector + '-' + articulo.codigo"
58 ></td> 58 ></td>
59 <td 59 <td
60 class="col-4" 60 class="col-4"
61 ng-bind="articulo.descripcion" 61 ng-bind="articulo.descripcion"
62 ></td> 62 ></td>
63 <td class="col text-right"> 63 <td class="col text-right">
64 <input 64 <input
65 ng-show="articulo.editCantidad" 65 ng-show="articulo.editCantidad"
66 ng-model="articulo.cantidad" 66 ng-model="articulo.cantidad"
67 class="form-control" 67 class="form-control"
68 foca-tipo-input 68 foca-tipo-input
69 min="1" 69 min="1"
70 foca-focus="articulo.editCantidad" 70 foca-focus="articulo.editCantidad"
71 ng-keypress="editarArticulo($event.keyCode, articulo)" 71 ng-keypress="editarArticulo($event.keyCode, articulo)"
72 ng-focus="selectFocus($event)" 72 ng-focus="selectFocus($event)"
73 teclado-virtual 73 teclado-virtual
74 > 74 >
75 <i 75 <i
76 class="selectable" 76 class="selectable"
77 ng-click="cambioEdit(articulo, 'cantidad')" 77 ng-click="cambioEdit(articulo, 'cantidad')"
78 ng-hide="articulo.editCantidad" 78 ng-hide="articulo.editCantidad"
79 ng-bind="articulo.cantidad"> 79 ng-bind="articulo.cantidad">
80 </i> 80 </i>
81 </td> 81 </td>
82 <td class="col text-right"> 82 <td class="col text-right">
83 <input 83 <input
84 ng-show="articulo.editPrecio" 84 ng-show="articulo.editPrecio"
85 ng-model="articulo.precio" 85 ng-model="articulo.precio"
86 class="form-control" 86 class="form-control"
87 foca-tipo-input 87 foca-tipo-input
88 min="1" 88 min="1"
89 step="0.0001" 89 step="0.0001"
90 foca-focus="articulo.editPrecio" 90 foca-focus="articulo.editPrecio"
91 ng-keypress="editarArticulo($event.keyCode, articulo)" 91 ng-keypress="editarArticulo($event.keyCode, articulo)"
92 ng-focus="selectFocus($event)" 92 ng-focus="selectFocus($event)"
93 teclado-virtual 93 teclado-virtual
94 > 94 >
95 <i 95 <i
96 class="selectable" 96 class="selectable"
97 ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" 97 ng-click="idLista == -1 && cambioEdit(articulo, 'precio')"
98 ng-hide="articulo.editPrecio" 98 ng-hide="articulo.editPrecio"
99 ng-bind="articulo.precio | number: 4"> 99 ng-bind="articulo.precio | number: 4">
100 </i> 100 </i>
101 </td> 101 </td>
102 <td 102 <td
103 class="col text-right" 103 class="col text-right"
104 ng-bind="(articulo.precio * articulo.cantidad) | number: 2"> 104 ng-bind="(articulo.precio * articulo.cantidad) | number: 2">
105 </td> 105 </td>
106 <td class="text-center"> 106 <td class="text-center">
107 <button 107 <button
108 class="btn btn-outline-light" 108 class="btn btn-outline-light"
109 ng-click="quitarArticulo(key)" 109 ng-click="quitarArticulo(key)"
110 > 110 >
111 <i class="fa fa-trash"></i> 111 <i class="fa fa-trash"></i>
112 </button> 112 </button>
113 </td> 113 </td>
114 </tr> 114 </tr>
115 </tbody> 115 </tbody>
116 <tfoot> 116 <tfoot>
117 <tr ng-show="!cargando" class="d-flex"> 117 <tr ng-show="!cargando" class="d-flex">
118 <td 118 <td
119 class="align-middle" 119 class="align-middle"
120 ng-bind="articulosTabla.length + 1" 120 ng-bind="remito.articulosRemito.length + 1"
121 ></td> 121 ></td>
122 <td class="col"> 122 <td class="col">
123 <input 123 <input
124 class="form-control" 124 class="form-control"
125 ng-model="articuloACargar.sectorCodigo" 125 ng-model="articuloACargar.sectorCodigo"
126 readonly 126 readonly
127 > 127 >
128 </td> 128 </td>
129 <td class="col-4 tabla-articulo-descripcion"> 129 <td class="col-4 tabla-articulo-descripcion">
130 <input 130 <input
131 class="form-control" 131 class="form-control"
132 ng-model="articuloACargar.descripcion" 132 ng-model="articuloACargar.descripcion"
133 readonly 133 readonly
134 > 134 >
135 </td> 135 </td>
136 <td class="col text-right"> 136 <td class="col text-right">
137 <input 137 <input
138 class="form-control" 138 class="form-control"
139 foca-tipo-input 139 foca-tipo-input
140 min="1" 140 min="1"
141 ng-model="articuloACargar.cantidad" 141 ng-model="articuloACargar.cantidad"
142 foca-focus="!cargando" 142 foca-focus="!cargando"
143 esc-key="resetFilter()" 143 esc-key="resetFilter()"
144 ng-keypress="agregarATabla($event.keyCode)" 144 ng-keypress="agregarATabla($event.keyCode)"
145 teclado-virtual 145 teclado-virtual
146 > 146 >
147 </td> 147 </td>
148 <td class="col text-right"> 148 <td class="col text-right">
149 <input 149 <input
150 class="form-control" 150 class="form-control"
151 ng-value="articuloACargar.precio | number: 4" 151 ng-value="articuloACargar.precio | number: 4"
152 ng-show="idLista != -1" 152 ng-show="idLista != -1"
153 readonly 153 readonly
154 > 154 >
155 <input 155 <input
156 class="form-control" 156 class="form-control"
157 foca-tipo-input 157 foca-tipo-input
158 step="0.0001" 158 step="0.0001"
159 ng-model="articuloACargar.precio" 159 ng-model="articuloACargar.precio"
160 esc-key="resetFilter()" 160 esc-key="resetFilter()"
161 ng-keypress="agregarATabla($event.keyCode)" 161 ng-keypress="agregarATabla($event.keyCode)"
162 ng-show="idLista == -1" 162 ng-show="idLista == -1"
163 teclado-virtual 163 teclado-virtual
164 > 164 >
165 </td> 165 </td>
166 <td class="col text-right"> 166 <td class="col text-right">
167 <input 167 <input
168 class="form-control" 168 class="form-control"
169 ng-value="getSubTotal() | number: 2" 169 ng-value="getSubTotal() | number: 2"
170 readonly 170 readonly
171 ></td> 171 ></td>
172 <td class="text-center align-middle"> 172 <td class="text-center align-middle">
173 <button 173 <button
174 class="btn btn-outline-light" 174 class="btn btn-outline-light"
175 ng-click="agregarATabla(13)" 175 ng-click="agregarATabla(13)"
176 > 176 >
177 <i class="fa fa-save"></i> 177 <i class="fa fa-save"></i>
178 </button> 178 </button>
179 </td> 179 </td>
180 </tr> 180 </tr>
181 181
182 <tr class="d-flex"> 182 <tr class="d-flex">
183 <td colspan="4" class="no-border-top"> 183 <td colspan="4" class="no-border-top">
184 <strong>Items:</strong> 184 <strong>Items:</strong>
185 <a ng-bind="articulosTabla.length"></a> 185 <a ng-bind="remito.articulosRemito.length"></a>
186 </td> 186 </td>
187 <td class="text-right ml-auto table-celda-total no-border-top"> 187 <td class="text-right ml-auto table-celda-total no-border-top">
188 <h3>Total:</h3> 188 <h3>Total:</h3>
189 </td> 189 </td>
190 <td class="table-celda-total text-right no-border-top" colspan="1"> 190 <td class="table-celda-total text-right no-border-top" colspan="1">
191 <h3>{{getTotal() | currency: remito.moneda.SIMBOLO}}</h3> 191 <h3>{{getTotal() | currency: remito.moneda.SIMBOLO}}</h3>
192 </td> 192 </td>
193 <td class="text-right no-border-top"> 193 <td class="text-right no-border-top">
194 <button 194 <button
195 type="button" 195 type="button"
196 class="btn btn-default btn-sm" 196 class="btn btn-default btn-sm"
197 > 197 >
198 Totales 198 Totales
199 </button> 199 </button>
200 </td> 200 </td>
201 </tr> 201 </tr>
202 </tfoot> 202 </tfoot>
203 </table> 203 </table>
204 </div> 204 </div>
205 205
206 <!-- MOBILE --> 206 <!-- MOBILE -->
207 <div class="row d-sm-none"> 207 <div class="row d-sm-none">
208 <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile"> 208 <table class="table table-sm table-striped tabla-articulo margin-bottom-mobile">
209 <thead> 209 <thead>
210 <tr class="d-flex"> 210 <tr class="d-flex">
211 <th class="">#</th> 211 <th class="">#</th>
212 <th class="col px-0"> 212 <th class="col px-0">
213 <div class="d-flex"> 213 <div class="d-flex">
214 <div class="col-4 px-1">Código</div> 214 <div class="col-4 px-1">Código</div>
215 <div class="col-8 px-1">Descripción</div> 215 <div class="col-8 px-1">Descripción</div>
216 </div> 216 </div>
217 <div class="d-flex"> 217 <div class="d-flex">
218 <div class="col-3 px-1">Cantidad</div> 218 <div class="col-3 px-1">Cantidad</div>
219 <div class="col px-1 text-right">P. Uni.</div> 219 <div class="col px-1 text-right">P. Uni.</div>
220 <div class="col px-1 text-right">Subtotal</div> 220 <div class="col px-1 text-right">Subtotal</div>
221 </div> 221 </div>
222 </th> 222 </th>
223 <th class="text-center tamaño-boton"> 223 <th class="text-center tamaño-boton">
224 &nbsp; 224 &nbsp;
225 </th> 225 </th>
226 </tr> 226 </tr>
227 </thead> 227 </thead>
228 <tbody> 228 <tbody>
229 <tr 229 <tr
230 ng-repeat="(key, articulo) in articulosTabla" 230 ng-repeat="(key, articulo) in remito.articulosRemito"
231 ng-show="show || key == articulosTabla.length - 1" 231 ng-show="show || key == remito.articulosRemito.length - 1"
232 > 232 >
233 <td class="w-100 align-middle d-flex p-0"> 233 <td class="w-100 align-middle d-flex p-0">
234 <div class="align-middle p-1"> 234 <div class="align-middle p-1">
235 <span ng-bind="key+1" class="align-middle"></span> 235 <span ng-bind="key+1" class="align-middle"></span>
236 </div> 236 </div>
237 <div class="col px-0"> 237 <div class="col px-0">
238 <div class="d-flex"> 238 <div class="d-flex">
239 <div class="col-4 px-1"> 239 <div class="col-4 px-1">
240 <span 240 <span
241 ng-bind="articulo.sector + '-' + articulo.codigo" 241 ng-bind="articulo.sector + '-' + articulo.codigo"
242 ></span> 242 ></span>
243 </div> 243 </div>
244 <div class="col-8 px-1"> 244 <div class="col-8 px-1">
245 <span 245 <span
246 ng-bind="'x' + articulo.cantidad" 246 ng-bind="'x' + articulo.cantidad"
247 ng-hide="articulo.editCantidad" 247 ng-hide="articulo.editCantidad"
248 ></span> 248 ></span>
249 <i 249 <i
250 class="fa fa-pencil text-white-50" 250 class="fa fa-pencil text-white-50"
251 aria-hidden="true" 251 aria-hidden="true"
252 ng-hide="articulo.editCantidad" 252 ng-hide="articulo.editCantidad"
253 ng-click="articulo.editCantidad = true" 253 ng-click="articulo.editCantidad = true"
254 ></i> 254 ></i>
255 <input 255 <input
256 ng-show="articulo.editCantidad" 256 ng-show="articulo.editCantidad"
257 ng-model="articulo.cantidad" 257 ng-model="articulo.cantidad"
258 class="form-control" 258 class="form-control"
259 foca-tipo-input 259 foca-tipo-input
260 min="1" 260 min="1"
261 step="0.001" 261 step="0.001"
262 foca-focus="articulo.editCantidad" 262 foca-focus="articulo.editCantidad"
263 ng-keypress="editarArticulo($event.keyCode, articulo)" 263 ng-keypress="editarArticulo($event.keyCode, articulo)"
264 ng-focus="selectFocus($event)" 264 ng-focus="selectFocus($event)"
265 > 265 >
266 </div> 266 </div>
267 </div> 267 </div>
268 <div class="d-flex"> 268 <div class="d-flex">
269 <div class="col-3 px-1"> 269 <div class="col-3 px-1">
270 <span ng-bind="'x' + articulo.cantidad"></span> 270 <span ng-bind="'x' + articulo.cantidad"></span>
271 </div> 271 </div>
272 <div class="col px-1 text-right"> 272 <div class="col px-1 text-right">
273 <span ng-bind="articulo.precio | currency: remito.moneda.SIMBOLO : 4"></span> 273 <span ng-bind="articulo.precio | currency: remito.moneda.SIMBOLO : 4"></span>
274 </div> 274 </div>
275 <div class="col px-1 text-right"> 275 <div class="col px-1 text-right">
276 <span 276 <span
277 ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.SIMBOLO" 277 ng-bind="(articulo.precio * articulo.cantidad) | currency: remito.moneda.SIMBOLO"
278 > 278 >
279 </span> 279 </span>
280 </div> 280 </div>
281 </div> 281 </div>
282 </div> 282 </div>
283 <div class="align-middle p-1"> 283 <div class="align-middle p-1">
284 <button 284 <button
285 class="btn btn-outline-light" 285 class="btn btn-outline-light"
286 ng-click="quitarArticulo(key)" 286 ng-click="quitarArticulo(key)"
287 > 287 >
288 <i class="fa fa-trash"></i> 288 <i class="fa fa-trash"></i>
289 </button> 289 </button>
290 </div> 290 </div>
291 </td> 291 </td>
292 </tr> 292 </tr>
293 </tbody> 293 </tbody>
294 <tfoot> 294 <tfoot>
295 <!-- CARGANDO ITEM --> 295 <!-- CARGANDO ITEM -->
296 <tr ng-show="!cargando" class="d-flex"> 296 <tr ng-show="!cargando" class="d-flex">
297 <td 297 <td
298 class="align-middle p-1" 298 class="align-middle p-1"
299 ng-bind="articulosTabla.length + 1" 299 ng-bind="remito.articulosRemito.length + 1"
300 ></td> 300 ></td>
301 <td class="col p-0"> 301 <td class="col p-0">
302 <div class="d-flex"> 302 <div class="d-flex">
303 <div class="col-4 px-1"> 303 <div class="col-4 px-1">
304 <span 304 <span
305 ng-bind="articuloACargar.sectorCodigo" 305 ng-bind="articuloACargar.sectorCodigo"
306 ></span> 306 ></span>
307 </div> 307 </div>
308 <div class="col-8 px-1"> 308 <div class="col-8 px-1">
309 <span ng-bind="articuloACargar.descripcion"></span> 309 <span ng-bind="articuloACargar.descripcion"></span>
310 </div> 310 </div>
311 </div> 311 </div>
312 <div class="d-flex"> 312 <div class="d-flex">
313 <div class="col-3 px-1 m-1"> 313 <div class="col-3 px-1 m-1">
314 <input 314 <input
315 class="form-control p-1" 315 class="form-control p-1"
316 foca-tipo-input 316 foca-tipo-input
317 min="1" 317 min="1"
318 ng-model="articuloACargar.cantidad" 318 ng-model="articuloACargar.cantidad"
319 foca-focus="!cargando" 319 foca-focus="!cargando"
320 ng-keypress="agregarATabla($event.keyCode)" 320 ng-keypress="agregarATabla($event.keyCode)"
321 style="height: auto; line-height: 1.1em" 321 style="height: auto; line-height: 1.1em"
322 > 322 >
323 </div> 323 </div>
324 <div class="col px-1 text-right"> 324 <div class="col px-1 text-right">
325 <span ng-bind="articuloACargar.precio | currency: remito.moneda.SIMBOLO : 4"></span> 325 <span ng-bind="articuloACargar.precio | currency: remito.moneda.SIMBOLO : 4"></span>
326 </div> 326 </div>
327 <div class="col px-1 text-right"> 327 <div class="col px-1 text-right">
328 <span 328 <span
329 ng-bind="getSubTotal() | currency: remito.moneda.SIMBOLO" 329 ng-bind="getSubTotal() | currency: remito.moneda.SIMBOLO"
330 > 330 >
331 </span> 331 </span>
332 </div> 332 </div>
333 </div> 333 </div>
334 </td> 334 </td>
335 <td class="text-center align-middle"> 335 <td class="text-center align-middle">
336 <button 336 <button
337 class="btn btn-outline-light" 337 class="btn btn-outline-light"
338 ng-click="agregarATabla(13)" 338 ng-click="agregarATabla(13)"
339 > 339 >
340 <i class="fa fa-save"></i> 340 <i class="fa fa-save"></i>
341 </button> 341 </button>
342 </td> 342 </td>
343 </tr> 343 </tr>
344 <!-- TOOGLE EXPANDIR --> 344 <!-- TOOGLE EXPANDIR -->
345 <tr> 345 <tr>
346 <td class="col"> 346 <td class="col">
347 <button 347 <button
348 class="btn btn-outline-light selectable w-100" 348 class="btn btn-outline-light selectable w-100"
349 ng-click="show = !show; masMenos()" 349 ng-click="show = !show; masMenos()"
350 ng-show="articulosTabla.length > 0" 350 ng-show="remito.articulosRemito.length > 0"
351 > 351 >
352 <i 352 <i
353 class="fa fa-chevron-down" 353 class="fa fa-chevron-down"
354 ng-hide="show" 354 ng-hide="show"
355 aria-hidden="true" 355 aria-hidden="true"
356 > 356 >
357 </i> 357 </i>
358 <i 358 <i
359 class="fa fa-chevron-up" 359 class="fa fa-chevron-up"
360 ng-show="show" 360 ng-show="show"
361 aria-hidden="true"> 361 aria-hidden="true">
362 </i> 362 </i>
363 </button> 363 </button>
364 </td> 364 </td>
365 </tr> 365 </tr>
366 <!-- FOOTER --> 366 <!-- FOOTER -->
367 <tr class="d-flex"> 367 <tr class="d-flex">
368 <td class="align-middle no-border-top" colspan="2"> 368 <td class="align-middle no-border-top" colspan="2">
369 <strong>Cantidad Items:</strong> 369 <strong>Cantidad Items:</strong>
370 <a ng-bind="articulosTabla.length"></a> 370 <a ng-bind="remito.articulosRemito.length"></a>
371 </td> 371 </td>
372 <td class="text-right ml-auto table-celda-total no-border-top"> 372 <td class="text-right ml-auto table-celda-total no-border-top">
373 <h3>Total:</h3> 373 <h3>Total:</h3>
374 </td> 374 </td>
375 <td class="table-celda-total text-right no-border-top"> 375 <td class="table-celda-total text-right no-border-top">
376 <h3>{{getTotal() | currency: remito.moneda.SIMBOLO}}</h3> 376 <h3>{{getTotal() | currency: remito.moneda.SIMBOLO}}</h3>
377 </td> 377 </td>
378 </tr> 378 </tr>
379 </tfoot> 379 </tfoot>
380 </table> 380 </table>
381 </div> 381 </div>
382 </div> 382 </div>
383 </div> 383 </div>
384 </div> 384 </div>
385 <div class="row d-md-none fixed-bottom"> 385 <div class="row d-md-none fixed-bottom">
386 <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> 386 <div class="w-100 bg-dark d-flex px-3 acciones-mobile">
387 <span class="ml-3 text-muted" ng-click="salir()">Salir</span> 387 <span class="ml-3 text-muted" ng-click="salir()">Salir</span>
388 <span 388 <span
389 class="mr-3 ml-auto" 389 class="mr-3 ml-auto"
390 ng-class="saveLoading ? 'text-muted' : ''" 390 ng-class="saveLoading ? 'text-muted' : ''"
391 ng-click="crearRemito()" 391 ng-click="crearRemito()"
392 ladda="saveLoading" 392 ladda="saveLoading"
393 data-style="expand-left" 393 data-style="expand-left"
394 >Guardar</span> 394 >Guardar</span>
395 </div> 395 </div>
396 </div> 396 </div>
397 </div> 397 </div>
398 398