Commit 60be8ea2bc0a38f644a06f68a5b2405049daa7fc

Authored by Luigi
1 parent ad95f17eba
Exists in master

Arreglo alerta al editar campos del producto

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