Commit 9d4fb6c4779378430ba70f57eb9d8e5b008d2e00

Authored by Marcelo Puebla
1 parent a7ee896113
Exists in master

Agregada funcionalidad para que si se editan los detalles del remito y se apreta…

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