Commit 2aeb5fc11ddc627bc6001fc16c5f6b12f3996226

Authored by Luigi
1 parent c4b114ffad
Exists in master and in 1 other branch develop

Seleccion de IVA segun sus tipo Factura

src/js/controller.js
1 angular.module('focaBusquedaCliente') 1 angular.module('focaBusquedaCliente')
2 .controller('focaBusquedaClienteModalController', [ 2 .controller('focaBusquedaClienteModalController', [
3 '$uibModalInstance', 'focaBusquedaClienteService', '$scope', '$filter', 3 '$uibModalInstance', 'focaBusquedaClienteService', '$scope', '$filter',
4 '$uibModal', 'focaModalService', '$timeout', 'vendedor', 'cobrador', 4 '$uibModal', 'focaModalService', '$timeout', 'vendedor', 'cobrador',
5 function($uibModalInstance, focaBusquedaClienteService, $scope, $filter, 5 function($uibModalInstance, focaBusquedaClienteService, $scope, $filter,
6 $uibModal, focaModalService, $timeout, vendedor, cobrador) { 6 $uibModal, focaModalService, $timeout, vendedor, cobrador) {
7 7
8 $scope.cobrador = cobrador ? cobrador : {}; 8 $scope.cobrador = cobrador ? cobrador : {};
9 $scope.vendedor = vendedor ? vendedor : {}; 9 $scope.vendedor = vendedor ? vendedor : {};
10 $scope.filters = ''; 10 $scope.filters = '';
11 $scope.primerBusqueda = false; 11 $scope.primerBusqueda = false;
12 // pagination 12 // pagination
13 $scope.numPerPage = 10; 13 $scope.numPerPage = 10;
14 $scope.currentPage = 1; 14 $scope.currentPage = 1;
15 $scope.filteredClientes = []; 15 $scope.filteredClientes = [];
16 $scope.currentPageClientes = []; 16 $scope.currentPageClientes = [];
17 $scope.selectedClientes = -1; 17 $scope.selectedClientes = -1;
18 $scope.ingreso = false; 18 $scope.ingreso = false;
19 $scope.regexCuit = new RegExp(/\b(20|23|24|27|30|33|34)(\D)?[0-9]{8}(\D)?[0-9]/); 19 $scope.regexCuit = new RegExp(/\b(20|23|24|27|30|33|34)(\D)?[0-9]{8}(\D)?[0-9]/);
20 $scope.focused = 1; 20 $scope.focused = 1;
21 21
22 $scope.cliente = { 22 $scope.cliente = {
23 COD: 0, 23 COD: 0,
24 ES_MAY: true, 24 ES_MAY: true,
25 cuit1: '', 25 cuit1: '',
26 cuit2: '', 26 cuit2: '',
27 cuit3: '', 27 cuit3: '',
28 provincia: { 28 provincia: {
29 NOMBRE: '' 29 NOMBRE: ''
30 }, 30 },
31 localidad: { 31 localidad: {
32 NOMBRE: '' 32 NOMBRE: ''
33 }, 33 },
34 iva: { 34 iva: {
35 NOMBRE: '' 35 NOMBRE: ''
36 }, 36 },
37 actividad: { 37 actividad: {
38 NOM: '' 38 NOM: ''
39 }, 39 },
40 zona: { 40 zona: {
41 NOM: '' 41 NOM: ''
42 }, 42 },
43 tipoFactura: { 43 tipoFactura: {
44 NOMBRE: '' 44 NOMBRE: ''
45 }, 45 },
46 tipoComprobante: { 46 tipoComprobante: {
47 NOMBRE: '' 47 NOMBRE: ''
48 }, 48 },
49 formaPago: { 49 formaPago: {
50 NOMBRE: '' 50 NOMBRE: ''
51 }, 51 },
52 cobrador: { 52 cobrador: {
53 NomVen: '' 53 NomVen: ''
54 } 54 }
55 }; 55 };
56 56
57 $scope.busquedaPress = function(key) { 57 $scope.busquedaPress = function(key) {
58 if (key === 13) { 58 if (key === 13) {
59 var funcion; 59 var funcion;
60 if ($scope.vendedor.id) { 60 if ($scope.vendedor.id) {
61 funcion = 'obtenerClientesPorNombreOCuitByVendedor'; 61 funcion = 'obtenerClientesPorNombreOCuitByVendedor';
62 } else if ($scope.cobrador.id) { 62 } else if ($scope.cobrador.id) {
63 funcion = 'obtenerClientesPorNombreOCuitByCobrador'; 63 funcion = 'obtenerClientesPorNombreOCuitByCobrador';
64 } else { 64 } else {
65 funcion = 'obtenerClientesPorNombreOCuit'; 65 funcion = 'obtenerClientesPorNombreOCuit';
66 } 66 }
67 67
68 68
69 $scope.searchLoading = true; 69 $scope.searchLoading = true;
70 focaBusquedaClienteService 70 focaBusquedaClienteService
71 [funcion]($scope.filters, $scope.vendedor.id || $scope.cobrador.id) 71 [funcion]($scope.filters, $scope.vendedor.id || $scope.cobrador.id)
72 .then( 72 .then(
73 function(res) { 73 function(res) {
74 $scope.primerBusqueda = true; 74 $scope.primerBusqueda = true;
75 $scope.clientes = res.data; 75 $scope.clientes = res.data;
76 $scope.search(true); 76 $scope.search(true);
77 primera(); 77 primera();
78 $scope.searchLoading = false; 78 $scope.searchLoading = false;
79 }); 79 });
80 } 80 }
81 }; 81 };
82 82
83 $scope.search = function (pressed) { 83 $scope.search = function (pressed) {
84 if ($scope.primerBusqueda) { 84 if ($scope.primerBusqueda) {
85 $scope.filteredClientes = $filter('filter')( 85 $scope.filteredClientes = $filter('filter')(
86 $scope.clientes, {$: $scope.filters} 86 $scope.clientes, {$: $scope.filters}
87 ); 87 );
88 88
89 if (pressed && $scope.filteredClientes.length === 0) { 89 if (pressed && $scope.filteredClientes.length === 0) {
90 $timeout(function() { 90 $timeout(function() {
91 angular.element('#search')[0].focus(); 91 angular.element('#search')[0].focus();
92 $scope.filters = ''; 92 $scope.filters = '';
93 }); 93 });
94 } 94 }
95 95
96 $scope.lastPage = Math.ceil( 96 $scope.lastPage = Math.ceil(
97 $scope.filteredClientes.length / $scope.numPerPage 97 $scope.filteredClientes.length / $scope.numPerPage
98 ); 98 );
99 99
100 $scope.resetPage(); 100 $scope.resetPage();
101 } 101 }
102 }; 102 };
103 103
104 $scope.resetPage = function () { 104 $scope.resetPage = function () {
105 $scope.currentPage = 1; 105 $scope.currentPage = 1;
106 $scope.selectPage(1); 106 $scope.selectPage(1);
107 }; 107 };
108 108
109 $scope.selectPage = function (page) { 109 $scope.selectPage = function (page) {
110 var start = (page - 1) * $scope.numPerPage; 110 var start = (page - 1) * $scope.numPerPage;
111 var end = start + $scope.numPerPage; 111 var end = start + $scope.numPerPage;
112 $scope.paginas = []; 112 $scope.paginas = [];
113 $scope.paginas = calcularPages(page); 113 $scope.paginas = calcularPages(page);
114 $scope.currentPageClientes = $scope.filteredClientes.slice(start, end); 114 $scope.currentPageClientes = $scope.filteredClientes.slice(start, end);
115 $scope.currentPage = page; 115 $scope.currentPage = page;
116 }; 116 };
117 117
118 $scope.select = function(cliente, esNuevo = false) { 118 $scope.select = function(cliente, esNuevo = false) {
119 cliente.esNuevo = esNuevo; 119 cliente.esNuevo = esNuevo;
120 $uibModalInstance.close(cliente); 120 $uibModalInstance.close(cliente);
121 }; 121 };
122 122
123 $scope.cancel = function() { 123 $scope.cancel = function() {
124 if ($scope.ingreso) { 124 if ($scope.ingreso) {
125 $scope.ingreso = false; 125 $scope.ingreso = false;
126 } else { 126 } else {
127 $uibModalInstance.dismiss('cancel'); 127 $uibModalInstance.dismiss('cancel');
128 } 128 }
129 }; 129 };
130 130
131 $scope.busquedaDown = function(key) { 131 $scope.busquedaDown = function(key) {
132 if (key === 40) { 132 if (key === 40) {
133 primera(key); 133 primera(key);
134 } 134 }
135 }; 135 };
136 136
137 $scope.itemCliente = function(key) { 137 $scope.itemCliente = function(key) {
138 if (key === 38) { 138 if (key === 38) {
139 anterior(key); 139 anterior(key);
140 } 140 }
141 141
142 if (key === 40) { 142 if (key === 40) {
143 siguiente(key); 143 siguiente(key);
144 } 144 }
145 145
146 if (key === 37) { 146 if (key === 37) {
147 retrocederPagina(); 147 retrocederPagina();
148 } 148 }
149 149
150 if (key === 39) { 150 if (key === 39) {
151 avanzarPagina(); 151 avanzarPagina();
152 } 152 }
153 }; 153 };
154 154
155 $scope.focus = function(val) { 155 $scope.focus = function(val) {
156 $scope.focused = val; 156 $scope.focused = val;
157 }; 157 };
158 158
159 $scope.next = function(key) { 159 $scope.next = function(key) {
160 if (key === 13) $scope.focused++; 160 if (key === 13) $scope.focused++;
161 }; 161 };
162 162
163 $scope.seleccionarProvincia = function(key) { 163 $scope.seleccionarProvincia = function(key) {
164 if (key === 13) { 164 if (key === 13) {
165 var parametrosModal = { 165 var parametrosModal = {
166 query: '/provincia', 166 query: '/provincia',
167 columnas: [ 167 columnas: [
168 { 168 {
169 propiedad: 'ID', 169 propiedad: 'ID',
170 nombre: 'Codigo', 170 nombre: 'Codigo',
171 filtro: { 171 filtro: {
172 nombre: 'rellenarDigitos', 172 nombre: 'rellenarDigitos',
173 parametro: 3 173 parametro: 3
174 } 174 }
175 }, 175 },
176 { 176 {
177 propiedad: 'NOMBRE', 177 propiedad: 'NOMBRE',
178 nombre: 'Nombre' 178 nombre: 'Nombre'
179 } 179 }
180 ], 180 ],
181 titulo:'Búsqueda de provincias', 181 titulo:'Búsqueda de provincias',
182 size: 'md' 182 size: 'md'
183 }; 183 };
184 focaModalService.modal(parametrosModal).then(function(provincia) { 184 focaModalService.modal(parametrosModal).then(function(provincia) {
185 $scope.cliente.provincia = provincia; 185 $scope.cliente.provincia = provincia;
186 $timeout(function() { 186 $timeout(function() {
187 $scope.focused = 4; 187 $scope.focused = 4;
188 }); 188 });
189 }, function() { 189 }, function() {
190 //TODO: función llamada cuando cancela el modal 190 //TODO: función llamada cuando cancela el modal
191 }); 191 });
192 } 192 }
193 }; 193 };
194 $scope.seleccionarLocalidad = function(key) { 194 $scope.seleccionarLocalidad = function(key) {
195 if ($scope.cliente.provincia.ID === undefined) { 195 if ($scope.cliente.provincia.ID === undefined) {
196 focaModalService.alert('Seleccione una provincia'); 196 focaModalService.alert('Seleccione una provincia');
197 return; 197 return;
198 } 198 }
199 if (key === 13) { 199 if (key === 13) {
200 var parametrosModal = { 200 var parametrosModal = {
201 query: '/localidad/' + $scope.cliente.provincia.ID, 201 query: '/localidad/' + $scope.cliente.provincia.ID,
202 columnas: [ 202 columnas: [
203 { 203 {
204 propiedad: 'ID', 204 propiedad: 'ID',
205 nombre: 'Código', 205 nombre: 'Código',
206 filtro: { 206 filtro: {
207 nombre: 'rellenarDigitos', 207 nombre: 'rellenarDigitos',
208 parametro: 3 208 parametro: 3
209 } 209 }
210 }, 210 },
211 { 211 {
212 propiedad: 'NOMBRE', 212 propiedad: 'NOMBRE',
213 nombre: 'Nombre' 213 nombre: 'Nombre'
214 } 214 }
215 ], 215 ],
216 titulo:'Búsqueda de localidades', 216 titulo:'Búsqueda de localidades',
217 size: 'md' 217 size: 'md'
218 }; 218 };
219 focaModalService.modal(parametrosModal).then(function(localidad) { 219 focaModalService.modal(parametrosModal).then(function(localidad) {
220 $scope.cliente.localidad = localidad; 220 $scope.cliente.localidad = localidad;
221 $timeout(function() { 221 $timeout(function() {
222 $scope.focused = 5; 222 $scope.focused = 5;
223 }); 223 });
224 }, function() { 224 }, function() {
225 //TODO: función llamada cuando cancela el modal 225 //TODO: función llamada cuando cancela el modal
226 }); 226 });
227 } 227 }
228 }; 228 };
229 $scope.seleccionarIva = function(key) { 229 $scope.seleccionarIva = function(key) {
230 if (key === 13) { 230 if (key === 13) {
231 var parametrosModal = { 231 var parametrosModal = {
232 query: '/iva', 232 query: '/iva',
233 columnas: [ 233 columnas: [
234 { 234 {
235 propiedad: 'ID', 235 propiedad: 'ID',
236 nombre: 'Código', 236 nombre: 'Código',
237 filtro: { 237 filtro: {
238 nombre: 'rellenarDigitos', 238 nombre: 'rellenarDigitos',
239 parametro: 3 239 parametro: 3
240 } 240 }
241 }, 241 },
242 { 242 {
243 propiedad: 'NOMBRE', 243 propiedad: 'NOMBRE',
244 nombre: 'Nombre' 244 nombre: 'Nombre'
245 } 245 }
246 ], 246 ],
247 titulo:'Búsqueda de responsabilidad ante el IVA', 247 titulo:'Búsqueda de responsabilidad ante el IVA',
248 size: 'md' 248 size: 'md'
249 }; 249 };
250 focaModalService.modal(parametrosModal).then( 250 focaModalService.modal(parametrosModal).then(
251 function(iva) { 251 function(iva) {
252 $scope.cliente.iva = iva; 252 $scope.cliente.iva = iva;
253 $timeout(function() { 253 $timeout(function() {
254 $scope.focused = 12; 254 $scope.focused = 12;
255 }); 255 });
256 }, function() { 256 }, function() {
257 // funcion ejecutada cuando se cancela el modal 257 // funcion ejecutada cuando se cancela el modal
258 }); 258 });
259 } 259 }
260 }; 260 };
261 $scope.seleccionarActividad = function(key) { 261 $scope.seleccionarActividad = function(key) {
262 if (key === 13) { 262 if (key === 13) {
263 var parametrosModal = { 263 var parametrosModal = {
264 query: '/actividad', 264 query: '/actividad',
265 columnas: [ 265 columnas: [
266 { 266 {
267 propiedad: 'ID', 267 propiedad: 'ID',
268 nombre: 'Código', 268 nombre: 'Código',
269 filtro: { 269 filtro: {
270 nombre: 'rellenarDigitos', 270 nombre: 'rellenarDigitos',
271 parametro: 3 271 parametro: 3
272 } 272 }
273 }, 273 },
274 { 274 {
275 propiedad: 'NOM', 275 propiedad: 'NOM',
276 nombre: 'Nombre' 276 nombre: 'Nombre'
277 } 277 }
278 ], 278 ],
279 titulo: 'Búsqueda de actividades', 279 titulo: 'Búsqueda de actividades',
280 size: 'md' 280 size: 'md'
281 }; 281 };
282 focaModalService.modal(parametrosModal).then( 282 focaModalService.modal(parametrosModal).then(
283 function(actividad) { 283 function(actividad) {
284 $scope.cliente.actividad = actividad; 284 $scope.cliente.actividad = actividad;
285 $timeout(function() { 285 $timeout(function() {
286 $scope.focused = 7; 286 $scope.focused = 7;
287 }); 287 });
288 }, function() { 288 }, function() {
289 // funcion ejecutada cuando se cancela el modal 289 // funcion ejecutada cuando se cancela el modal
290 }); 290 });
291 } 291 }
292 }; 292 };
293 $scope.seleccionarZona = function(key) { 293 $scope.seleccionarZona = function(key) {
294 if (key === 13) { 294 if (key === 13) {
295 var parametrosModal = { 295 var parametrosModal = {
296 query: '/zona', 296 query: '/zona',
297 columnas: [ 297 columnas: [
298 { 298 {
299 propiedad: 'ID', 299 propiedad: 'ID',
300 nombre: 'Código', 300 nombre: 'Código',
301 filtro: { 301 filtro: {
302 nombre: 'rellenarDigitos', 302 nombre: 'rellenarDigitos',
303 parametro: 3 303 parametro: 3
304 } 304 }
305 }, 305 },
306 { 306 {
307 propiedad: 'NOM', 307 propiedad: 'NOM',
308 nombre: 'Nombre' 308 nombre: 'Nombre'
309 } 309 }
310 ], 310 ],
311 titulo: 'Búsqueda de zonas', 311 titulo: 'Búsqueda de zonas',
312 size: 'md' 312 size: 'md'
313 }; 313 };
314 focaModalService.modal(parametrosModal).then( 314 focaModalService.modal(parametrosModal).then(
315 function(zona) { 315 function(zona) {
316 $scope.cliente.zona = zona; 316 $scope.cliente.zona = zona;
317 $timeout(function() { 317 $timeout(function() {
318 $scope.focused = 6; 318 $scope.focused = 6;
319 }); 319 });
320 }, function() { 320 }, function() {
321 // funcion ejecutada cuando se cancela el modal 321 // funcion ejecutada cuando se cancela el modal
322 }); 322 });
323 } 323 }
324 }; 324 };
325 $scope.seleccionarTipoFactura = function(key) { 325 $scope.seleccionarTipoFactura = function(key) {
326 if (key === 13) { 326 if (key === 13) {
327 var parametrosModal = { 327 if ($scope.cliente.iva.ID == 1) {
328 query: '/tipo-factura', 328 var datos = [
329 columnas: [
330 { 329 {
331 propiedad: 'ID', 330 id: 'A',
332 nombre: 'Código' 331 nombre: 'Factura A'
333 }, 332 },
334 { 333 {
335 propiedad: 'NOMBRE', 334 id: 'M',
336 nombre: 'Nombre' 335 nombre: 'Factura M'
336 },
337 {
338 id: 'R',
339 nombre: 'Remito'
337 } 340 }
338 ], 341 ];
339 titulo: 'Búsqueda de tipos de factura', 342 focaModalService.modal({
340 size: 'md' 343 titulo: 'Seleccionar Factura',
341 }; 344 data: datos,
342 focaModalService.modal(parametrosModal).then( 345 size: 'md',
343 function(tipoFactura) { 346 columnas: [
344 $scope.cliente.tipoFactura = tipoFactura; 347 {
345 $timeout(function() { 348 propiedad: 'id',
346 $scope.focused = 13; 349 nombre: 'Codigo'
347 }); 350 },
348 }, function() { 351 {
349 // funcion ejecutada cuando se cancela el modal 352 propiedad: 'nombre',
353 nombre: 'Factura'
354 }
355 ],
356 }).then(function(res) {
357 $scope.cliente.tipoFactura.NOMBRE = res.nombre;
358 });
359 } else if ($scope.cliente.iva.ID == 3 || $scope.cliente.iva.ID == 4 || $scope.cliente.iva.ID == 5) {
360 var datos2 = [
361 {
362 id: 'B',
363 nombre: 'Factura B'
364 },
365 {
366 id: 'R',
367 nombre: 'Remito'
368 }
369 ];
370 focaModalService.modal({
371 titulo: 'Seleccionar Factura',
372 data: datos2,
373 size: 'md',
374 columnas: [
375 {
376 propiedad: 'id',
377 nombre: 'Codigo'
378 },
379 {
380 propiedad: 'nombre',
381 nombre: 'Factura'
382 }
383 ],
384 }).then(function(res) {
385 $scope.cliente.tipoFactura.NOMBRE = res.nombre;
350 }); 386 });
387 }
351 } 388 }
352 }; 389 };
353 $scope.seleccionarTipoComprobante = function(key) { 390 $scope.seleccionarTipoComprobante = function(key) {
354 if (key === 13) { 391 if (key === 13) {
355 var parametrosModal = { 392 var parametrosModal = {
356 query: '/tipo-comprobante', 393 query: '/tipo-comprobante',
357 columnas: [ 394 columnas: [
358 { 395 {
359 propiedad: 'ID', 396 propiedad: 'ID',
360 nombre: 'Código' 397 nombre: 'Código'
361 }, 398 },
362 { 399 {
363 propiedad: 'NOMBRE', 400 propiedad: 'NOMBRE',
364 nombre: 'Nombre' 401 nombre: 'Nombre'
365 } 402 }
366 ], 403 ],
367 titulo: 'Búsqueda de tipos de comprobante', 404 titulo: 'Búsqueda de tipos de comprobante',
368 size: 'md' 405 size: 'md'
369 }; 406 };
370 focaModalService.modal(parametrosModal).then( 407 focaModalService.modal(parametrosModal).then(
371 function(tipoComprobante) { 408 function(tipoComprobante) {
372 $scope.cliente.tipoComprobante = tipoComprobante; 409 $scope.cliente.tipoComprobante = tipoComprobante;
373 $timeout(function() { 410 $timeout(function() {
374 $scope.focused = 17; 411 $scope.focused = 17;
375 }); 412 });
376 }, function() { 413 }, function() {
377 // funcion ejecutada cuando se cancela el modal 414 // funcion ejecutada cuando se cancela el modal
378 }); 415 });
379 } 416 }
380 }; 417 };
381 $scope.seleccionarFormaPago = function(key) { 418 $scope.seleccionarFormaPago = function(key) {
382 if (key === 13) { 419 if (key === 13) {
383 var parametrosModal = { 420 var parametrosModal = {
384 query: '/forma-pago', 421 query: '/forma-pago',
385 columnas: [ 422 columnas: [
386 { 423 {
387 propiedad: 'ID', 424 propiedad: 'ID',
388 nombre: 'Código', 425 nombre: 'Código',
389 filtro: { 426 filtro: {
390 nombre: 'rellenarDigitos', 427 nombre: 'rellenarDigitos',
391 parametro: 3 428 parametro: 3
392 } 429 }
393 }, 430 },
394 { 431 {
395 propiedad: 'NOMBRE', 432 propiedad: 'NOMBRE',
396 nombre: 'Nombre' 433 nombre: 'Nombre'
397 } 434 }
398 ], 435 ],
399 titulo: 'Búsqueda de formas de pago', 436 titulo: 'Búsqueda de formas de pago',
400 size: 'md' 437 size: 'md'
401 }; 438 };
402 focaModalService.modal(parametrosModal).then( 439 focaModalService.modal(parametrosModal).then(
403 function(formaPago) { 440 function(formaPago) {
404 $scope.cliente.formaPago = formaPago; 441 $scope.cliente.formaPago = formaPago;
405 }, function() { 442 }, function() {
406 // funcion ejecutada cuando se cancela el modal 443 // funcion ejecutada cuando se cancela el modal
407 }); 444 });
408 } 445 }
409 }; 446 };
410 $scope.seleccionarCobrador = function(key) { 447 $scope.seleccionarCobrador = function(key) {
411 if (key === 13) { 448 if (key === 13) {
412 var parametrosModal = { 449 var parametrosModal = {
413 query: '/cobrador', 450 query: '/cobrador',
414 columnas: [ 451 columnas: [
415 { 452 {
416 propiedad: 'NUM', 453 propiedad: 'NUM',
417 nombre: 'Código' 454 nombre: 'Código'
418 }, 455 },
419 { 456 {
420 propiedad: 'NOM', 457 propiedad: 'NOM',
421 nombre: 'Nombre' 458 nombre: 'Nombre'
422 } 459 }
423 ], 460 ],
424 titulo: 'Búsqueda de cobradores', 461 titulo: 'Búsqueda de cobradores',
425 size: 'md' 462 size: 'md'
426 }; 463 };
427 focaModalService.modal(parametrosModal).then( 464 focaModalService.modal(parametrosModal).then(
428 function(cobrador) { 465 function(cobrador) {
429 $scope.cliente.cobrador = cobrador; 466 $scope.cliente.cobrador = cobrador;
430 }, function() { 467 }, function() {
431 // funcion ejecutada cuando se cancela el modal 468 // funcion ejecutada cuando se cancela el modal
432 }); 469 });
433 } 470 }
434 }; 471 };
435 472
436 $scope.pasarCampoCuit = function(numeroCuit) { 473 $scope.pasarCampoCuit = function(numeroCuit) {
437 if (numeroCuit === 1 && $scope.cliente.cuit1.length === 2) { 474 if (numeroCuit === 1 && $scope.cliente.cuit1.length === 2) {
438 $scope.cuitActivo = 2; 475 $scope.cuitActivo = 2;
439 } else if ( numeroCuit === 2 && $scope.cliente.cuit2.length === 8) { 476 } else if ( numeroCuit === 2 && $scope.cliente.cuit2.length === 8) {
440 $scope.cuitActivo = 3; 477 $scope.cuitActivo = 3;
441 } 478 }
442 }; 479 };
443 480
444 $scope.guardar = function() { 481 $scope.guardar = function() {
445
446 if (!$scope.cliente.NOM) { 482 if (!$scope.cliente.NOM) {
447 focaModalService.alert('Ingrese Nombre'); 483 focaModalService.alert('Ingrese Nombre');
448 return; 484 return;
449 } else if (!$scope.cliente.CPO) { 485 } else if (!$scope.cliente.CPO) {
450 focaModalService.alert('Ingrese Codigo Postal'); 486 focaModalService.alert('Ingrese Codigo Postal');
451 return; 487 return;
452 } else if (!$scope.cliente.provincia.NOMBRE) { 488 } else if (!$scope.cliente.provincia.NOMBRE) {
453 focaModalService.alert('Seleccione una provincia'); 489 focaModalService.alert('Seleccione una provincia');
454 return; 490 return;
455 } else if (!$scope.cliente.DOM) { 491 } else if (!$scope.cliente.DOM) {
456 focaModalService.alert('Ingrese Domicilio'); 492 focaModalService.alert('Ingrese Domicilio');
457 return; 493 return;
458 } else if (!$scope.cliente.localidad.NOMBRE) { 494 } else if (!$scope.cliente.localidad.NOMBRE) {
459 focaModalService.alert('Seleccione una localidad'); 495 focaModalService.alert('Seleccione una localidad');
460 return; 496 return;
461 } else if (!$scope.cliente.zona.NOM) { 497 } else if (!$scope.cliente.zona.NOM) {
462 focaModalService.alert('Seleccione una zona'); 498 focaModalService.alert('Seleccione una zona');
463 return; 499 return;
464 } else if (!$scope.cliente.actividad.NOM) { 500 } else if (!$scope.cliente.actividad.NOM) {
465 focaModalService.alert('Seleccione actividad'); 501 focaModalService.alert('Seleccione actividad');
466 return; 502 return;
467 } else if (!$scope.cliente.cobrador.NUM) { 503 } else if (!$scope.cliente.cobrador.NUM) {
468 focaModalService.alert('Seleccione un cobrador'); 504 focaModalService.alert('Seleccione un cobrador');
469 return; 505 return;
470 } else if (!$scope.cliente.TEL) { 506 } else if (!$scope.cliente.TEL) {
471 focaModalService.alert('Ingrese un numero de telefono'); 507 focaModalService.alert('Ingrese un numero de telefono');
472 return; 508 return;
473 } else if (!$scope.cliente.iva.NOMBRE) { 509 } else if (!$scope.cliente.iva.NOMBRE) {
474 focaModalService.alert('Seleccione responsabilidad ante el IVA'); 510 focaModalService.alert('Seleccione responsabilidad ante el IVA');
475 return; 511 return;
476 } else if (!$scope.cliente.tipoFactura.NOMBRE) { 512 } else if (!$scope.cliente.tipoFactura.NOMBRE) {
477 focaModalService.alert('Seleccione tipo de Factura'); 513 focaModalService.alert('Seleccione tipo de Factura');
478 return; 514 return;
479 } else if (!$scope.cliente.cuit1 && !$scope.cliente.cuit2 && !$scope.cliente.cuit3) { 515 } else if (!$scope.cliente.cuit1 && !$scope.cliente.cuit2 && !$scope.cliente.cuit3) {
480 focaModalService.alert('Ingresar CUIT'); 516 focaModalService.alert('Ingresar CUIT');
481 return; 517 return;
482 } else if (!$scope.regexCuit.test($scope.cliente.cuit1 + $scope.cliente.cuit2 + $scope.cliente.cuit3) ) { 518 } else if (!$scope.regexCuit.test($scope.cliente.cuit1 + $scope.cliente.cuit2 + $scope.cliente.cuit3) ) {
483 focaModalService.alert('Debe ingresar CUIT con formato: XX-XXXXXXXX-X'); 519 focaModalService.alert('Debe ingresar CUIT con formato: XX-XXXXXXXX-X');
484 return; 520 return;
485 } else if (!$scope.cliente.tipoComprobante.NOMBRE) { 521 } else if (!$scope.cliente.tipoComprobante.NOMBRE) {
486 focaModalService.alert('Seleccione un Comprobante'); 522 focaModalService.alert('Seleccione un Comprobante');
487 return; 523 return;
488 } else if (!$scope.cliente.formaPago.NOMBRE) { 524 } else if (!$scope.cliente.formaPago.NOMBRE) {
489 focaModalService.alert('Seleccione una forma de pago'); 525 focaModalService.alert('Seleccione una forma de pago');
490 return; 526 return;
491 } 527 }
492 528
493 529
494 var cliente = crearCopia(); 530 var cliente = crearCopia();
495 531
496 focaBusquedaClienteService 532 focaBusquedaClienteService
497 .guardarCliente(cliente) 533 .guardarCliente(cliente)
498 .then(function(res) { 534 .then(function(res) {
499 var cliente = { 535 var cliente = {
500 cod: res.data.COD, 536 cod: res.data.COD,
501 cuit: res.data.CUIT, 537 cuit: res.data.CUIT,
502 esNuevo: res.data.esNuevo, 538 esNuevo: res.data.esNuevo,
503 nom: res.data.NOM 539 nom: res.data.NOM
504 }; 540 };
505 $scope.select(cliente, true); 541 $scope.select(cliente, true);
506 }); 542 });
507 }; 543 };
508 544
509 function crearCopia(){ 545 function crearCopia(){
510 var cliente = angular.copy($scope.cliente); 546 var cliente = angular.copy($scope.cliente);
511 547
512 cliente.PCX = cliente.provincia.ID; 548 cliente.PCX = cliente.provincia.ID;
513 cliente.LOX = cliente.localidad.ID; 549 cliente.LOX = cliente.localidad.ID;
514 cliente.IVA = cliente.iva.ID; 550 cliente.IVA = cliente.iva.ID;
515 cliente.ACT = cliente.actividad.ID; 551 cliente.ACT = cliente.actividad.ID;
516 cliente.ZON = cliente.zona.ID; 552 cliente.ZON = cliente.zona.ID;
517 cliente.TIP = cliente.tipoFactura.ID; 553 cliente.TIP = cliente.tipoFactura.ID;
518 cliente.TCO = cliente.tipoComprobante.ID; 554 cliente.TCO = cliente.tipoComprobante.ID;
519 cliente.FPA = cliente.formaPago.ID; 555 cliente.FPA = cliente.formaPago.ID;
520 cliente.VEN = vendedor.ID; 556 cliente.VEN = vendedor.ID;
521 cliente.CUIT = cliente.cuit1 + cliente.cuit2 + cliente.cuit3; 557 cliente.CUIT = cliente.cuit1 + cliente.cuit2 + cliente.cuit3;
522 cliente.idCobrador = cliente.cobrador.ID; 558 cliente.idCobrador = cliente.cobrador.ID;
523 559
524 delete cliente.provincia; 560 delete cliente.provincia;
525 delete cliente.localidad; 561 delete cliente.localidad;
526 delete cliente.iva; 562 delete cliente.iva;
527 delete cliente.actividad; 563 delete cliente.actividad;
528 delete cliente.zona; 564 delete cliente.zona;
529 delete cliente.tipoFactura; 565 delete cliente.tipoFactura;
530 delete cliente.tipoComprobante; 566 delete cliente.tipoComprobante;
531 delete cliente.formaPago; 567 delete cliente.formaPago;
532 delete cliente.cobrador; 568 delete cliente.cobrador;
533 delete cliente.cuit1; 569 delete cliente.cuit1;
534 delete cliente.cuit2; 570 delete cliente.cuit2;
535 delete cliente.cuit3; 571 delete cliente.cuit3;
536 572
537 return cliente; 573 return cliente;
538 } 574 }
539 575
540 function calcularPages(paginaActual) { 576 function calcularPages(paginaActual) {
541 var paginas = []; 577 var paginas = [];
542 paginas.push(paginaActual); 578 paginas.push(paginaActual);
543 579
544 if (paginaActual - 1 > 1) { 580 if (paginaActual - 1 > 1) {
545 581
546 paginas.unshift(paginaActual - 1); 582 paginas.unshift(paginaActual - 1);
547 if (paginaActual - 2 > 1) { 583 if (paginaActual - 2 > 1) {
548 paginas.unshift(paginaActual - 2); 584 paginas.unshift(paginaActual - 2);
549 } 585 }
550 } 586 }
551 587
552 if (paginaActual + 1 < $scope.lastPage) { 588 if (paginaActual + 1 < $scope.lastPage) {
553 paginas.push(paginaActual + 1); 589 paginas.push(paginaActual + 1);
554 if (paginaActual + 2 < $scope.lastPage) { 590 if (paginaActual + 2 < $scope.lastPage) {
555 paginas.push(paginaActual + 2); 591 paginas.push(paginaActual + 2);
556 } 592 }
557 } 593 }
558 594
559 if (paginaActual !== 1) { 595 if (paginaActual !== 1) {
560 paginas.unshift(1); 596 paginas.unshift(1);
561 } 597 }
562 598
563 if (paginaActual !== $scope.lastPage) { 599 if (paginaActual !== $scope.lastPage) {
564 paginas.push($scope.lastPage); 600 paginas.push($scope.lastPage);
565 } 601 }
566 602
567 return paginas; 603 return paginas;
568 } 604 }
569 605
570 function primera() { 606 function primera() {
571 $scope.selectedClientes = 0; 607 $scope.selectedClientes = 0;
572 } 608 }
573 609
574 function anterior() { 610 function anterior() {
575 if ($scope.selectedClientes === 0 && $scope.currentPage > 1) { 611 if ($scope.selectedClientes === 0 && $scope.currentPage > 1) {
576 retrocederPagina(); 612 retrocederPagina();
577 } else { 613 } else {
578 $scope.selectedClientes--; 614 $scope.selectedClientes--;
579 } 615 }
580 } 616 }
581 617
582 function siguiente() { 618 function siguiente() {
583 if ($scope.selectedClientes < $scope.currentPageClientes.length - 1 ) { 619 if ($scope.selectedClientes < $scope.currentPageClientes.length - 1 ) {
584 $scope.selectedClientes++; 620 $scope.selectedClientes++;
585 } else { 621 } else {
586 avanzarPagina(); 622 avanzarPagina();
587 } 623 }
588 } 624 }
589 625
590 function retrocederPagina() { 626 function retrocederPagina() {
591 if ($scope.currentPage > 1) { 627 if ($scope.currentPage > 1) {
592 $scope.selectPage($scope.currentPage - 1); 628 $scope.selectPage($scope.currentPage - 1);
593 $scope.selectedClientes = $scope.numPerPage - 1; 629 $scope.selectedClientes = $scope.numPerPage - 1;
594 } 630 }
595 } 631 }
596 632
597 function avanzarPagina() { 633 function avanzarPagina() {
598 if ($scope.currentPage < $scope.lastPage) { 634 if ($scope.currentPage < $scope.lastPage) {
599 $scope.selectPage($scope.currentPage + 1); 635 $scope.selectPage($scope.currentPage + 1);
600 $scope.selectedClientes = 0; 636 $scope.selectedClientes = 0;
601 } 637 }
602 } 638 }
603 639
604 } 640 }
src/views/foca-busqueda-cliente-modal.html
1 <div class="modal-header py-1"> 1 <div class="modal-header py-1">
2 <div class="row w-100"> 2 <div class="row w-100">
3 <div class="col-lg-4 col-7"> 3 <div class="col-lg-4 col-7">
4 <h5 class="modal-title my-1" ng-hide="ingreso">Búsqueda de Cliente</h5> 4 <h5 class="modal-title my-1" ng-hide="ingreso">Búsqueda de Cliente</h5>
5 <h5 class="modal-title my-1" ng-show="ingreso">Crear Cliente</h5> 5 <h5 class="modal-title my-1" ng-show="ingreso">Crear Cliente</h5>
6 </div> 6 </div>
7 <div ng-show="ingreso" class="col-lg-6 col-5 front-index"> 7 <div ng-show="ingreso" class="col-lg-6 col-5 front-index">
8 <div class="custom-control custom-checkbox mt-2"> 8 <div class="custom-control custom-checkbox mt-2">
9 <input 9 <input
10 type="checkbox" 10 type="checkbox"
11 class="custom-control-input" 11 class="custom-control-input"
12 id="checkProspecto" 12 id="checkProspecto"
13 ng-model="cliente.ES_PROS"> 13 ng-model="cliente.ES_PROS">
14 <label class="custom-control-label" for="checkProspecto">¿Es prospecto?</label> 14 <label class="custom-control-label" for="checkProspecto">¿Es prospecto?</label>
15 </div> 15 </div>
16 </div> 16 </div>
17 <div class="input-group col-lg-6 offset-lg-2 pr-0 my-2"> 17 <div class="input-group col-lg-6 offset-lg-2 pr-0 my-2">
18 <button 18 <button
19 class="btn btn-outline-primary mr-2" 19 class="btn btn-outline-primary mr-2"
20 ng-click="ingreso = true" 20 ng-click="ingreso = true"
21 ng-show="!ingreso && vendedor.NUM" 21 ng-show="!ingreso && vendedor.NUM"
22 title="Nuevo"> 22 title="Nuevo">
23 <i class="fa fa-plus" aria-hidden="true"></i> 23 <i class="fa fa-plus" aria-hidden="true"></i>
24 </button> 24 </button>
25 <input 25 <input
26 ladda="searchLoading" 26 ladda="searchLoading"
27 type="text" 27 type="text"
28 class="form-control form-control-sm" 28 class="form-control form-control-sm"
29 id="search" 29 id="search"
30 placeholder="Busqueda" 30 placeholder="Busqueda"
31 ng-model="filters" 31 ng-model="filters"
32 ng-change="search()" 32 ng-change="search()"
33 ng-keydown="busquedaDown($event.keyCode)" 33 ng-keydown="busquedaDown($event.keyCode)"
34 ng-keypress="busquedaPress($event.keyCode)" 34 ng-keypress="busquedaPress($event.keyCode)"
35 foca-focus="selectedClientes == -1" 35 foca-focus="selectedClientes == -1"
36 ng-focus="selectedClientes = -1" 36 ng-focus="selectedClientes = -1"
37 teclado-virtual 37 teclado-virtual
38 ng-hide="ingreso" 38 ng-hide="ingreso"
39 > 39 >
40 <div class="input-group-append" ng-hide="ingreso"> 40 <div class="input-group-append" ng-hide="ingreso">
41 <button 41 <button
42 ladda="searchLoading" 42 ladda="searchLoading"
43 data-spinner-color="#FF0000" 43 data-spinner-color="#FF0000"
44 class="btn btn-outline-secondary" 44 class="btn btn-outline-secondary"
45 type="button" 45 type="button"
46 ng-click="busquedaPress(13)"> 46 ng-click="busquedaPress(13)">
47 <i class="fa fa-search" aria-hidden="true"></i> 47 <i class="fa fa-search" aria-hidden="true"></i>
48 </button> 48 </button>
49 </div> 49 </div>
50 </div> 50 </div>
51 </div> 51 </div>
52 </div> 52 </div>
53 <div class="modal-body" id="modal-body"> 53 <div class="modal-body" id="modal-body">
54 54
55 <div ng-show="!primerBusqueda && !ingreso"> 55 <div ng-show="!primerBusqueda && !ingreso">
56 Debe realizar una primer búsqueda. 56 Debe realizar una primer búsqueda.
57 </div> 57 </div>
58 58
59 <table ng-show="primerBusqueda && !ingreso" class="table table-striped table-sm"> 59 <table ng-show="primerBusqueda && !ingreso" class="table table-striped table-sm">
60 <thead> 60 <thead>
61 <tr> 61 <tr>
62 <th>Código</th> 62 <th>Código</th>
63 <th>Nombre</th> 63 <th>Nombre</th>
64 <th>CUIT</th> 64 <th>CUIT</th>
65 <th></th> 65 <th></th>
66 </tr> 66 </tr>
67 </thead> 67 </thead>
68 <tbody> 68 <tbody>
69 <tr ng-show="currentPageClientes.length == 0 && primerBusqueda"> 69 <tr ng-show="currentPageClientes.length == 0 && primerBusqueda">
70 <td colspan="4"> 70 <td colspan="4">
71 No se encontraron resultados. 71 No se encontraron resultados.
72 </td> 72 </td>
73 </tr> 73 </tr>
74 <tr 74 <tr
75 class="selectable" 75 class="selectable"
76 ng-repeat="(key, cliente) in currentPageClientes" 76 ng-repeat="(key, cliente) in currentPageClientes"
77 ng-click="select(cliente)"> 77 ng-click="select(cliente)">
78 <td ng-bind="('00000'+cliente.cod).slice(-5)"></td> 78 <td ng-bind="('00000'+cliente.cod).slice(-5)"></td>
79 <td ng-bind="cliente.nom"></td> 79 <td ng-bind="cliente.nom"></td>
80 <td ng-bind="cliente.cuit"></td> 80 <td ng-bind="cliente.cuit"></td>
81 <td> 81 <td>
82 <button 82 <button
83 type="button" 83 type="button"
84 class="btn btn-xs p-1 float-right" 84 class="btn btn-xs p-1 float-right"
85 ng-class="{ 85 ng-class="{
86 'btn-secondary': selectedClientes != key, 86 'btn-secondary': selectedClientes != key,
87 'btn-primary': selectedClientes == key 87 'btn-primary': selectedClientes == key
88 }" 88 }"
89 ng-click="select(cliente)" 89 ng-click="select(cliente)"
90 foca-focus="selectedClientes == {{key}}" 90 foca-focus="selectedClientes == {{key}}"
91 ng-keydown="itemCliente($event.keyCode)" 91 ng-keydown="itemCliente($event.keyCode)"
92 > 92 >
93 <i class="fa fa-circle-thin" aria-hidden="true"></i> 93 <i class="fa fa-circle-thin" aria-hidden="true"></i>
94 </button> 94 </button>
95 </td> 95 </td>
96 </tr> 96 </tr>
97 </tbody> 97 </tbody>
98 </table> 98 </table>
99 99
100 <form name="formCliente"> 100 <form name="formCliente">
101 <uib-tabset class="tabs-right" ng-show="ingreso"> 101 <uib-tabset class="tabs-right" ng-show="ingreso">
102 <uib-tab heading="Datos cliente"> 102 <uib-tab heading="Datos cliente">
103 <div class="row"> 103 <div class="row">
104 <div class="col-3"> 104 <div class="col-3">
105 <label>Código</label> 105 <label>Código</label>
106 <input 106 <input
107 type="text" 107 type="text"
108 class="form-control form-control-sm" 108 class="form-control form-control-sm"
109 ng-model="cliente.codigo" 109 ng-model="cliente.codigo"
110 readonly 110 readonly
111 /> 111 />
112 </div> 112 </div>
113 <div class="col-9"> 113 <div class="col-9">
114 <label>Nombre</label> 114 <label>Nombre</label>
115 <input 115 <input
116 type="text" 116 type="text"
117 class="form-control form-control-sm" 117 class="form-control form-control-sm"
118 ng-model="cliente.NOM" 118 ng-model="cliente.NOM"
119 teclado-virtual 119 teclado-virtual
120 placeholder="Ingrese nombre" 120 placeholder="Ingrese nombre"
121 ng-required="true" 121 ng-required="true"
122 foca-focus="focused == 1 || ingreso" 122 foca-focus="focused == 1 || ingreso"
123 ng-focus="focus(1)" 123 ng-focus="focus(1)"
124 ng-keypress="next($event.keyCode)" 124 ng-keypress="next($event.keyCode)"
125 /> 125 />
126 </div> 126 </div>
127 </div> 127 </div>
128 <div class="row"> 128 <div class="row">
129 <div class="col-md-9 col-12"> 129 <div class="col-md-9 col-12">
130 <label>Domicilio</label> 130 <label>Domicilio</label>
131 <input 131 <input
132 type="text" 132 type="text"
133 class="form-control form-control-sm" 133 class="form-control form-control-sm"
134 ng-model="cliente.DOM" 134 ng-model="cliente.DOM"
135 teclado-virtual 135 teclado-virtual
136 placeholder="Ingrese domicilio" 136 placeholder="Ingrese domicilio"
137 ng-required="true" 137 ng-required="true"
138 ng-focus="focus(2)" 138 ng-focus="focus(2)"
139 foca-focus="focused == 2" 139 foca-focus="focused == 2"
140 ng-keypress="next($event.keyCode)" 140 ng-keypress="next($event.keyCode)"
141 /> 141 />
142 </div> 142 </div>
143 <div class="col-md-3 col-12"> 143 <div class="col-md-3 col-12">
144 <label>Código postal</label> 144 <label>Código postal</label>
145 <input 145 <input
146 type="text" 146 type="text"
147 class="form-control form-control-sm" 147 class="form-control form-control-sm"
148 ng-model="cliente.CPO" 148 ng-model="cliente.CPO"
149 placeholder="Ingrese CP" 149 placeholder="Ingrese CP"
150 ng-required="true" 150 ng-required="true"
151 ng-focus="focus(3)" 151 ng-focus="focus(3)"
152 foca-focus="focused == 3" 152 foca-focus="focused == 3"
153 ng-keypress="next($event.keyCode)" 153 ng-keypress="next($event.keyCode)"
154 teclado-virtual 154 teclado-virtual
155 /> 155 />
156 </div> 156 </div>
157 </div> 157 </div>
158 <div class="row"> 158 <div class="row">
159 <div class="col-md-6 col-12"> 159 <div class="col-md-6 col-12">
160 <label>Provincia</label> 160 <label>Provincia</label>
161 <div class="input-group"> 161 <div class="input-group">
162 <input 162 <input
163 type="text" 163 type="text"
164 class="form-control form-control-sm" 164 class="form-control form-control-sm"
165 ng-model="cliente.provincia.NOMBRE" 165 ng-model="cliente.provincia.NOMBRE"
166 ng-keypress="seleccionarProvincia($event.keyCode)" 166 ng-keypress="seleccionarProvincia($event.keyCode)"
167 placeholder="Seleccione provincia" 167 placeholder="Seleccione provincia"
168 ng-required="true" 168 ng-required="true"
169 ng-focus="focus(4)" 169 ng-focus="focus(4)"
170 foca-focus="focused == 4" 170 foca-focus="focused == 4"
171 teclado-virtual 171 teclado-virtual
172 /> 172 />
173 <div class="input-group-append"> 173 <div class="input-group-append">
174 <button 174 <button
175 ladda="searchLoading" 175 ladda="searchLoading"
176 class="btn btn-outline-secondary form-control-sm" 176 class="btn btn-outline-secondary form-control-sm"
177 type="button" 177 type="button"
178 ng-click="seleccionarProvincia(13)" 178 ng-click="seleccionarProvincia(13)"
179 > 179 >
180 <i class="fa fa-search" aria-hidden="true"></i> 180 <i class="fa fa-search" aria-hidden="true"></i>
181 </button> 181 </button>
182 </div> 182 </div>
183 </div> 183 </div>
184 </div> 184 </div>
185 <div class="col-md-6 col-12"> 185 <div class="col-md-6 col-12">
186 <label>Localidad</label> 186 <label>Localidad</label>
187 <div class="input-group"> 187 <div class="input-group">
188 <input 188 <input
189 type="text" 189 type="text"
190 class="form-control form-control-sm" 190 class="form-control form-control-sm"
191 ng-model="cliente.localidad.NOMBRE" 191 ng-model="cliente.localidad.NOMBRE"
192 ng-keypress="seleccionarLocalidad($event.keyCode)" 192 ng-keypress="seleccionarLocalidad($event.keyCode)"
193 placeholder="Seleccione localidad" 193 placeholder="Seleccione localidad"
194 ng-required="true" 194 ng-required="true"
195 foca-focus="focused == 5" 195 foca-focus="focused == 5"
196 ng-focus="focus(5)" 196 ng-focus="focus(5)"
197 teclado-virtual 197 teclado-virtual
198 /> 198 />
199 <div class="input-group-append"> 199 <div class="input-group-append">
200 <button 200 <button
201 ladda="searchLoading" 201 ladda="searchLoading"
202 class="btn btn-outline-secondary form-control-sm" 202 class="btn btn-outline-secondary form-control-sm"
203 type="button" 203 type="button"
204 ng-click="seleccionarLocalidad(13)" 204 ng-click="seleccionarLocalidad(13)"
205 > 205 >
206 <i class="fa fa-search" aria-hidden="true"></i> 206 <i class="fa fa-search" aria-hidden="true"></i>
207 </button> 207 </button>
208 </div> 208 </div>
209 </div> 209 </div>
210 </div> 210 </div>
211 </div> 211 </div>
212 <div class="row"> 212 <div class="row">
213 <div class="col-md-6 col-12"> 213 <div class="col-md-6 col-12">
214 <label>Zona</label> 214 <label>Zona</label>
215 <div class="input-group"> 215 <div class="input-group">
216 <input 216 <input
217 type="text" 217 type="text"
218 class="form-control form-control-sm" 218 class="form-control form-control-sm"
219 ng-model="cliente.zona.NOM" 219 ng-model="cliente.zona.NOM"
220 ng-keypress="seleccionarZona($event.keyCode)" 220 ng-keypress="seleccionarZona($event.keyCode)"
221 placeholder="Seleccione zona" 221 placeholder="Seleccione zona"
222 ng-required="true" 222 ng-required="true"
223 ng-focus="focus(6)" 223 ng-focus="focus(6)"
224 foca-focus="focused == 6" 224 foca-focus="focused == 6"
225 teclado-virtual 225 teclado-virtual
226 /> 226 />
227 <div class="input-group-append"> 227 <div class="input-group-append">
228 <button 228 <button
229 ladda="searchLoading" 229 ladda="searchLoading"
230 class="btn btn-outline-secondary form-control-sm" 230 class="btn btn-outline-secondary form-control-sm"
231 type="button" 231 type="button"
232 ng-click="seleccionarZona(13)" 232 ng-click="seleccionarZona(13)"
233 > 233 >
234 <i class="fa fa-search" aria-hidden="true"></i> 234 <i class="fa fa-search" aria-hidden="true"></i>
235 </button> 235 </button>
236 </div> 236 </div>
237 </div> 237 </div>
238 </div> 238 </div>
239 <div class="col-md-6 col-12"> 239 <div class="col-md-6 col-12">
240 <label> Actividad </label> 240 <label> Actividad </label>
241 <div class="input-group"> 241 <div class="input-group">
242 <input 242 <input
243 type="text" 243 type="text"
244 class="form-control form-control-sm" 244 class="form-control form-control-sm"
245 ng-model="cliente.actividad.NOM" 245 ng-model="cliente.actividad.NOM"
246 ng-keypress="seleccionarActividad($event.keyCode)" 246 ng-keypress="seleccionarActividad($event.keyCode)"
247 placeholder="Seleccione actividad" 247 placeholder="Seleccione actividad"
248 ng-required="true" 248 ng-required="true"
249 ng-focus="focus(7)" 249 ng-focus="focus(7)"
250 foca-focus="focused == 7" 250 foca-focus="focused == 7"
251 teclado-virtual 251 teclado-virtual
252 /> 252 />
253 <div class="input-group-append"> 253 <div class="input-group-append">
254 <button 254 <button
255 ladda="searchLoading" 255 ladda="searchLoading"
256 class="btn btn-outline-secondary form-control-sm" 256 class="btn btn-outline-secondary form-control-sm"
257 type="button" 257 type="button"
258 ng-click="seleccionarActividad(13)" 258 ng-click="seleccionarActividad(13)"
259 > 259 >
260 <i class="fa fa-search" aria-hidden="true"></i> 260 <i class="fa fa-search" aria-hidden="true"></i>
261 </button> 261 </button>
262 </div> 262 </div>
263 </div> 263 </div>
264 </div> 264 </div>
265 </div> 265 </div>
266 <div class="row"> 266 <div class="row">
267 <div class="col-md-6 col-12"> 267 <div class="col-md-6 col-12">
268 <label>Cobrador</label> 268 <label>Cobrador</label>
269 <div class="input-group"> 269 <div class="input-group">
270 <input 270 <input
271 type="text" 271 type="text"
272 class="form-control form-control-sm" 272 class="form-control form-control-sm"
273 ng-model="cliente.cobrador.NOM" 273 ng-model="cliente.cobrador.NOM"
274 ng-keypress="seleccionarCobrador($event.keyCode)" 274 ng-keypress="seleccionarCobrador($event.keyCode)"
275 placeholder="Seleccione cobrador" 275 placeholder="Seleccione cobrador"
276 ng-focus="focus(8)" 276 ng-focus="focus(8)"
277 foca-focus="focused == 8" 277 foca-focus="focused == 8"
278 teclado-virtual 278 teclado-virtual
279 /> 279 />
280 <div class="input-group-append"> 280 <div class="input-group-append">
281 <button 281 <button
282 ladda="searchLoading" 282 ladda="searchLoading"
283 class="btn btn-outline-secondary form-control-sm" 283 class="btn btn-outline-secondary form-control-sm"
284 type="button" 284 type="button"
285 ng-click="seleccionarCobrador(13)" 285 ng-click="seleccionarCobrador(13)"
286 > 286 >
287 <i class="fa fa-search" aria-hidden="true"></i> 287 <i class="fa fa-search" aria-hidden="true"></i>
288 </button> 288 </button>
289 </div> 289 </div>
290 </div> 290 </div>
291 </div> 291 </div>
292 <div class="col-md-6 col-12"> 292 <div class="col-md-6 col-12">
293 <label>Vendedor</label> 293 <label>Vendedor</label>
294 <div class="input-group"> 294 <div class="input-group">
295 <input 295 <input
296 type="text" 296 type="text"
297 class="form-control form-control-sm" 297 class="form-control form-control-sm"
298 ng-model="vendedor.NOM" 298 ng-model="vendedor.NOM"
299 disabled="true" 299 disabled="true"
300 /> 300 />
301 </div> 301 </div>
302 </div> 302 </div>
303 <div class="col-md-6 col-12"> 303 <div class="col-md-6 col-12">
304 <label>Email</label> 304 <label>Email</label>
305 <div class="input-group"> 305 <div class="input-group">
306 <input 306 <input
307 type="email" 307 type="email"
308 class="form-control form-control-sm" 308 class="form-control form-control-sm"
309 placeholder="Ingrese Email" 309 placeholder="Ingrese Email"
310 ng-model="cliente.MAIL" 310 ng-model="cliente.MAIL"
311 ng-required="true" 311 ng-required="true"
312 ng-keypress="next($event.keyCode)" 312 ng-keypress="next($event.keyCode)"
313 ng-focus="focus(10)" 313 ng-focus="focus(10)"
314 foca-focus="focused == 10" 314 foca-focus="focused == 10"
315 teclado-virtual> 315 teclado-virtual>
316 </div> 316 </div>
317 </div> 317 </div>
318 <div class="col-md-6 col-12"> 318 <div class="col-md-6 col-12">
319 <label>Telefono</label> 319 <label>Telefono</label>
320 <div class="input-group"> 320 <div class="input-group">
321 <input 321 <input
322 type="text" 322 type="text"
323 class="form-control form-control-sm" 323 class="form-control form-control-sm"
324 placeholder="Ingrese Telefono" 324 placeholder="Ingrese Telefono"
325 ng-model="cliente.TEL" 325 ng-model="cliente.TEL"
326 ng-required="true" 326 ng-required="true"
327 ng-keypress="next($event.keyCode)" 327 ng-keypress="next($event.keyCode)"
328 ng-focus="focus(11)" 328 ng-focus="focus(11)"
329 foca-focus="focused == 11" 329 foca-focus="focused == 11"
330 teclado-virtual> 330 teclado-virtual>
331 </div> 331 </div>
332 </div> 332 </div>
333 </div> 333 </div>
334 <div class="row"> 334 <div class="row">
335 <div class="col-6 d-flex"> 335 <div class="col-6 d-flex">
336 <div class="custom-control custom-checkbox mt-auto"> 336 <div class="custom-control custom-checkbox mt-auto">
337 <input 337 <input
338 type="checkbox" 338 type="checkbox"
339 class="custom-control-input" 339 class="custom-control-input"
340 id="checkDistribuidor" 340 id="checkDistribuidor"
341 ng-model="cliente.ES_MAY" 341 ng-model="cliente.ES_MAY"
342 checked 342 checked
343 disabled="disabled"> 343 disabled="disabled">
344 <label class="custom-control-label" for="checkDistribuidor">¿Este cliente es distribuidor?</label> 344 <label class="custom-control-label" for="checkDistribuidor">¿Este cliente es distribuidor?</label>
345 </div> 345 </div>
346 </div> 346 </div>
347 </div> 347 </div>
348 </uib-tab> 348 </uib-tab>
349 <uib-tab heading="Datos impositivos"> 349 <uib-tab heading="Datos impositivos">
350 <div class="row"> 350 <div class="row">
351 <div class="col-md-7 col-12"> 351 <div class="col-md-7 col-12">
352 <label>Responsabilidad ante el IVA</label> 352 <label>Responsabilidad ante el IVA</label>
353 <div class="input-group"> 353 <div class="input-group">
354 <input 354 <input
355 type="text" 355 type="text"
356 class="form-control form-control-sm" 356 class="form-control form-control-sm"
357 placeholder="Ingrese responsabilidad ante el IVA" 357 placeholder="Seleccione responsabilidad ante el IVA"
358 ng-model="cliente.iva.NOMBRE" 358 ng-model="cliente.iva.NOMBRE"
359 ng-keypress="seleccionarIva($event.keyCode)" 359 ng-keypress="seleccionarIva($event.keyCode)"
360 ng-required="true" 360 ng-required="true"
361 ng-focus="focus(12)" 361 ng-focus="focus(12)"
362 foca-focus="focused == 12" 362 foca-focus="focused == 12"
363 teclado-virtual 363 teclado-virtual
364 /> 364 />
365 <div class="input-group-append"> 365 <div class="input-group-append">
366 <button 366 <button
367 ladda="searchLoading" 367 ladda="searchLoading"
368 class="btn btn-outline-secondary form-control-sm" 368 class="btn btn-outline-secondary form-control-sm"
369 type="button" 369 type="button"
370 ng-click="seleccionarIva(13)" 370 ng-click="seleccionarIva(13)"
371 > 371 >
372 <i class="fa fa-search" aria-hidden="true"></i> 372 <i class="fa fa-search" aria-hidden="true"></i>
373 </button> 373 </button>
374 </div> 374 </div>
375 </div> 375 </div>
376 </div> 376 </div>
377 <div class="col-md-5 col-12"> 377 <div class="col-md-5 col-12">
378 <label>Factura que emite</label> 378 <label>Factura que emite</label>
379 <div class="input-group"> 379 <div class="input-group">
380 <input 380 <input
381 type="text" 381 type="text"
382 class="form-control form-control-sm" 382 class="form-control form-control-sm"
383 placeholder="Ingrese factura que emite" 383 placeholder="Seleccione factura que emite"
384 ng-model="cliente.tipoFactura.NOMBRE" 384 ng-model="cliente.tipoFactura.NOMBRE"
385 ng-required="true" 385 ng-required="true"
386 ng-keypress="seleccionarTipoFactura(13)" 386 ng-keypress="seleccionarTipoFactura(13)"
387 ng-focus="focus(13)" 387 ng-focus="focus(13)"
388 foca-focus="focused == 13" 388 foca-focus="focused == 13"
389 teclado-virtual> 389 teclado-virtual>
390 <div class="input-group-append"> 390 <div class="input-group-append">
391 <button 391 <button
392 ladda="searchLoading" 392 ladda="searchLoading"
393 class="btn btn-outline-secondary form-control-sm" 393 class="btn btn-outline-secondary form-control-sm"
394 type="button" 394 type="button"
395 ng-click="seleccionarTipoFactura(13)" 395 ng-click="seleccionarTipoFactura(13)"
396 > 396 >
397 <i class="fa fa-search" aria-hidden="true"></i> 397 <i class="fa fa-search" aria-hidden="true"></i>
398 </button> 398 </button>
399 </div> 399 </div>
400 </div> 400 </div>
401 </div> 401 </div>
402 </div> 402 </div>
403 403
404 <div class="row"> 404 <div class="row">
405 <div class= "col-md-4 col-12"> 405 <div class= "col-md-4 col-12">
406 <label>CUIT</label> 406 <label>CUIT</label>
407 <div class="d-flex"> 407 <div class="d-flex">
408 <input 408 <input
409 type="text" 409 type="text"
410 class="form-control form-control-sm col-2" 410 class="form-control form-control-sm col-2"
411 maxlength="2" 411 maxlength="2"
412 ng-model="cliente.cuit1" 412 ng-model="cliente.cuit1"
413 ng-required="true" 413 ng-required="true"
414 ng-keypress="pasarCampoCuit(1)" 414 ng-keypress="pasarCampoCuit(1)"
415 ng-focus="focus(14)" 415 ng-focus="focus(14)"
416 foca-focus="focused == 14" 416 foca-focus="focused == 14"
417 teclado-virtual 417 teclado-virtual
418 > 418 >
419 <span class="m-1"> - </span> 419 <span class="m-1"> - </span>
420 <input 420 <input
421 type="text" 421 type="text"
422 class="form-control form-control-sm col-5" 422 class="form-control form-control-sm col-5"
423 maxlength="8" 423 maxlength="8"
424 ng-keypress="pasarCampoCuit(2)" 424 ng-keypress="pasarCampoCuit(2)"
425 ng-model="cliente.cuit2" 425 ng-model="cliente.cuit2"
426 ng-required="true" 426 ng-required="true"
427 ng-focus="focus(15)" 427 ng-focus="focus(15)"
428 foca-focus="cuitActivo == 2 || focused == 15" 428 foca-focus="cuitActivo == 2 || focused == 15"
429 teclado-virtual 429 teclado-virtual
430 > 430 >
431 <span class="m-1"> - </span> 431 <span class="m-1"> - </span>
432 <input 432 <input
433 type="text" 433 type="text"
434 class="form-control form-control-sm col-2" 434 class="form-control form-control-sm col-2"
435 maxlength="1" 435 maxlength="1"
436 ng-keypress="pasarCampoCuit(3)" 436 ng-keypress="pasarCampoCuit(3)"
437 ng-model="cliente.cuit3" 437 ng-model="cliente.cuit3"
438 ng-required="true" 438 ng-required="true"
439 ng-focus="focus(16)" 439 ng-focus="focus(16)"
440 foca-focus="cuitActivo == 3 || focused == 16" 440 foca-focus="cuitActivo == 3 || focused == 16"
441 teclado-virtual 441 teclado-virtual
442 > 442 >
443 </div> 443 </div>
444 </div> 444 </div>
445 <div class="col-md-4 col-12"> 445 <div class="col-md-4 col-12">
446 <label>Clase de comprobante</label> 446 <label>Clase de comprobante</label>
447 <div class="input-group"> 447 <div class="input-group">
448 <input 448 <input
449 type="text" 449 type="text"
450 class="form-control form-control-sm" 450 class="form-control form-control-sm"
451 placeholder="Seleccione clase de comprobante" 451 placeholder="Seleccione clase de comprobante"
452 ng-keypress="seleccionarTipoComprobante($event.keyCode)" 452 ng-keypress="seleccionarTipoComprobante($event.keyCode)"
453 ng-model="cliente.tipoComprobante.NOMBRE" 453 ng-model="cliente.tipoComprobante.NOMBRE"
454 ng-required="true" 454 ng-required="true"
455 ng-focus="focus(17)" 455 ng-focus="focus(17)"
456 foca-focus="focused == 17" 456 foca-focus="focused == 17"
457 teclado-virtual> 457 teclado-virtual>
458 <div class="input-group-append"> 458 <div class="input-group-append">
459 <button 459 <button
460 ladda="searchLoading" 460 ladda="searchLoading"
461 class="btn btn-outline-secondary form-control-sm" 461 class="btn btn-outline-secondary form-control-sm"
462 type="button" 462 type="button"
463 ng-click="seleccionarTipoComprobante(13)" 463 ng-click="seleccionarTipoComprobante(13)"
464 > 464 >
465 <i class="fa fa-search" aria-hidden="true"></i> 465 <i class="fa fa-search" aria-hidden="true"></i>
466 </button> 466 </button>
467 </div> 467 </div>
468 </div> 468 </div>
469 </div> 469 </div>
470 <div class="col-md-4 col-12"> 470 <div class="col-md-4 col-12">
471 <label>Forma de pago</label> 471 <label>Forma de pago</label>
472 <div class="input-group"> 472 <div class="input-group">
473 <input 473 <input
474 type="text" 474 type="text"
475 class="form-control form-control-sm" 475 class="form-control form-control-sm"
476 placeholder="Seleccione forma de pago" 476 placeholder="Seleccione forma de pago"
477 ng-model="cliente.formaPago.NOMBRE" 477 ng-model="cliente.formaPago.NOMBRE"
478 ng-required="true" 478 ng-required="true"
479 ng-keypress="seleccionarFormaPago($event.keyCode)" 479 ng-keypress="seleccionarFormaPago($event.keyCode)"
480 ng-focus="focus(18)" 480 ng-focus="focus(18)"
481 foca-focus="focused == 18" 481 foca-focus="focused == 18"
482 teclado-virtual> 482 teclado-virtual>
483 <div class="input-group-append"> 483 <div class="input-group-append">
484 <button 484 <button
485 ladda="searchLoading" 485 ladda="searchLoading"
486 class="btn btn-outline-secondary form-control-sm" 486 class="btn btn-outline-secondary form-control-sm"
487 type="button" 487 type="button"
488 ng-click="seleccionarFormaPago(13)" 488 ng-click="seleccionarFormaPago(13)"
489 > 489 >
490 <i class="fa fa-search" aria-hidden="true"></i> 490 <i class="fa fa-search" aria-hidden="true"></i>
491 </button> 491 </button>
492 </div> 492 </div>
493 </div> 493 </div>
494 </div> 494 </div>
495 </div> 495 </div>
496 </uib-tab> 496 </uib-tab>
497 </uib-tabset> 497 </uib-tabset>
498 </form> 498 </form>
499 </div> 499 </div>
500 <div class="modal-footer py-1"> 500 <div class="modal-footer py-1">
501 <nav ng-show="currentPageClientes.length > 0 && primerBusqueda && !ingreso" class="mr-auto"> 501 <nav ng-show="currentPageClientes.length > 0 && primerBusqueda && !ingreso" class="mr-auto">
502 <ul class="pagination pagination-sm mb-0"> 502 <ul class="pagination pagination-sm mb-0">
503 <li class="page-item" ng-class="{'disabled': currentPage == 1}"> 503 <li class="page-item" ng-class="{'disabled': currentPage == 1}">
504 <a class="page-link" href="javascript:void()" ng-click="selectPage(currentPage - 1)"> 504 <a class="page-link" href="javascript:void()" ng-click="selectPage(currentPage - 1)">
505 <span aria-hidden="true">&laquo;</span> 505 <span aria-hidden="true">&laquo;</span>
506 <span class="sr-only">Anterior</span> 506 <span class="sr-only">Anterior</span>
507 </a> 507 </a>
508 </li> 508 </li>
509 <li 509 <li
510 class="page-item" 510 class="page-item"
511 ng-repeat="pagina in paginas" 511 ng-repeat="pagina in paginas"
512 ng-class="{'active': pagina == currentPage}" 512 ng-class="{'active': pagina == currentPage}"
513 > 513 >
514 <a 514 <a
515 class="page-link" 515 class="page-link"
516 href="javascript:void()" 516 href="javascript:void()"
517 ng-click="selectPage(pagina)" 517 ng-click="selectPage(pagina)"
518 ng-bind="pagina" 518 ng-bind="pagina"
519 ></a> 519 ></a>
520 </li> 520 </li>
521 <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> 521 <li class="page-item" ng-class="{'disabled': currentPage == lastPage}">
522 <a class="page-link" href="javascript:void()" ng-click="selectPage(currentPage + 1)"> 522 <a class="page-link" href="javascript:void()" ng-click="selectPage(currentPage + 1)">
523 <span aria-hidden="true">&raquo;</span> 523 <span aria-hidden="true">&raquo;</span>
524 <span class="sr-only">Siguiente</span> 524 <span class="sr-only">Siguiente</span>
525 </a> 525 </a>
526 </li> 526 </li>
527 </ul> 527 </ul>
528 </nav> 528 </nav>
529 <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> 529 <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button>
530 <button 530 <button
531 class="btn btn-sm btn-primary" 531 class="btn btn-sm btn-primary"
532 type="button" 532 type="button"
533 ng-show="ingreso" 533 ng-show="ingreso"
534 ng-click="guardar()" 534 ng-click="guardar()"
535 >Guardar</button> 535 >Guardar</button>
536 </div> 536 </div>
537 537