Commit 4c52cedd85c2e98e1ef60ad526779962fe1c583c

Authored by Luigi
1 parent 4d8b804210
Exists in master

Validacion al ingresar cantidad

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