Commit bccae4161bd25db81bdb79afbf70d07bfcebf584

Authored by Jose Pinto
1 parent 76108ce85b
Exists in master

ok validacion al editar precio y cantidad articulos remito

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