Commit 30b737e03d833543294ddede498463b10378db0b

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'master'

Master

See merge request !58
1 /node_modules 1 /node_modules
2 /dist 2 /dist
3 package-lock\.json 3 package-lock\.json
4 /src/etc/develop.js 4 /src/etc/develop.js
5 tmp/ 5 tmp/
6 debug.log
6 7
1 foca-crear-cobranza 1 foca-crear-cobranz
2 2
1 const templateCache = require('gulp-angular-templatecache'); 1 const templateCache = require('gulp-angular-templatecache');
2 const clean = require('gulp-clean'); 2 const clean = require('gulp-clean');
3 const concat = require('gulp-concat'); 3 const concat = require('gulp-concat');
4 const htmlmin = require('gulp-htmlmin'); 4 const htmlmin = require('gulp-htmlmin');
5 const rename = require('gulp-rename'); 5 const rename = require('gulp-rename');
6 const uglify = require('gulp-uglify'); 6 const uglify = require('gulp-uglify');
7 const gulp = require('gulp'); 7 const gulp = require('gulp');
8 const pump = require('pump'); 8 const pump = require('pump');
9 const jshint = require('gulp-jshint'); 9 const jshint = require('gulp-jshint');
10 const replace = require('gulp-replace'); 10 const replace = require('gulp-replace');
11 const connect = require('gulp-connect'); 11 const connect = require('gulp-connect');
12 const header = require('gulp-header'); 12 const header = require('gulp-header');
13 const footer = require('gulp-footer'); 13 const footer = require('gulp-footer');
14 const gulpSequence = require('gulp-sequence');
14 15
15 var paths = { 16 var paths = {
16 srcJS: 'src/js/*.js', 17 srcJS: 'src/js/*.js',
17 srcViews: 'src/views/*.html', 18 srcViews: 'src/views/*.html',
18 specs: 'spec/*.js', 19 specs: 'spec/*.js',
19 tmp: 'tmp', 20 tmp: 'tmp',
20 dist: 'dist/' 21 dist: 'dist/'
21 }; 22 };
22 23
23 gulp.task('templates', ['clean'], function() { 24 gulp.task('uglify', gulpSequence('clean', ['templates', 'uglify-spec'], 'uglify-app'));
25
26
27 gulp.task('templates', function() {
24 return pump( 28 return pump(
25 [ 29 [
26 gulp.src(paths.srcViews), 30 gulp.src(paths.srcViews),
27 htmlmin(), 31 htmlmin(),
28 templateCache('views.js', { 32 templateCache('views.js', {
29 module: 'focaCrearCobranza', 33 module: 'focaCrearCobranza',
30 root: '' 34 root: ''
31 }), 35 }),
32 gulp.dest(paths.tmp) 36 gulp.dest(paths.tmp)
33 ] 37 ]
34 ); 38 );
35 }); 39 });
36 40
37 gulp.task('uglify', ['templates', 'uglify-spec'], function() { 41 gulp.task('uglify-app', function() {
38 return pump( 42 return pump(
39 [ 43 [
40 gulp.src([ 44 gulp.src([
41 paths.srcJS, 45 paths.srcJS,
42 'tmp/views.js' 46 'tmp/views.js'
43 ]), 47 ]),
44 concat('foca-crear-cobranza.js'), 48 concat('foca-crear-cobranza.js'),
45 replace('src/views/', ''), 49 replace('src/views/', ''),
46 gulp.dest(paths.tmp), 50 gulp.dest(paths.tmp),
47 rename('foca-crear-cobranza.min.js'), 51 rename('foca-crear-cobranza.min.js'),
48 uglify(), 52 uglify(),
49 gulp.dest(paths.dist) 53 gulp.dest(paths.dist)
50 54
51 ] 55 ]
52 ); 56 );
53 }); 57 });
54 58
55 gulp.task('uglify-spec', function() { 59 gulp.task('uglify-spec', function() {
56 return pump([ 60 return pump([
57 gulp.src(paths.specs), 61 gulp.src(paths.specs),
58 concat('foca-crear-cobranza.spec.js'), 62 concat('foca-crear-cobranza.spec.js'),
59 replace("src/views/", ''), 63 replace("src/views/", ''),
60 header("describe('Módulo foca-crear-cobranza', function() { \n"), 64 header("describe('Módulo foca-crear-cobranza', function() { \n"),
61 footer("});"), 65 footer("});"),
62 gulp.dest(paths.dist) 66 gulp.dest(paths.dist)
63 ]); 67 ]);
64 }); 68 });
65 69
66 gulp.task('clean', function() { 70 gulp.task('clean', function() {
67 return gulp.src(['tmp', 'dist'], {read: false}) 71 return gulp.src(['tmp', 'dist'], {read: false})
68 .pipe(clean()); 72 .pipe(clean());
69 }); 73 });
70 74
71 gulp.task('pre-commit', function() { 75 gulp.task('pre-commit', function() {
72 return pump( 76 return pump(
73 [ 77 [
74 gulp.src([paths.srcJS, paths.specs]), 78 gulp.src([paths.srcJS, paths.specs]),
75 jshint('.jshintrc'), 79 jshint('.jshintrc'),
76 jshint.reporter('default'), 80 jshint.reporter('default'),
77 jshint.reporter('fail') 81 jshint.reporter('fail')
78 ] 82 ]
79 ); 83 );
80 84
81 gulp.start('uglify'); 85 gulp.start('uglify');
82 }); 86 });
83 87
84 gulp.task('webserver', function() { 88 gulp.task('webserver', function() {
85 pump [ 89 pump [
86 connect.server({port: 3300, host: '0.0.0.0'}) 90 connect.server({port: 3300, host: '0.0.0.0'})
87 ] 91 ]
88 }); 92 });
89 93
90 gulp.task('clean-post-install', function() { 94 gulp.task('clean-post-install', function() {
91 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', 95 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js',
92 'index.html', 'test.html', 'spec'], {read: false}) 96 'index.html', 'test.html', 'spec'], {read: false})
93 .pipe(clean()); 97 .pipe(clean());
94 }); 98 });
95 99
96 gulp.task('default', ['webserver']); 100 gulp.task('default', ['webserver']);
97 101
98 gulp.task('watch', function() { 102 gulp.task('watch', function() {
99 gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); 103 gulp.watch([paths.srcJS, paths.srcViews], ['uglify']);
100 }); 104 });
101 105
spec/controllerSpec.js
1 describe('controladores módulo crear cobranza', function() { 1 describe('controladores módulo crear cobranza', function() {
2 2
3 var $controller; 3 var $controller;
4 4
5 beforeEach(function() { 5 beforeEach(function() {
6 6
7 module('focaCrearCobranza'); 7 module('focaCrearCobranza');
8 8
9 inject(function(_$controller_) { 9 inject(function(_$controller_) {
10 10
11 $controller = _$controller_; 11 $controller = _$controller_;
12 }); 12 });
13 }); 13 });
14 14
15 describe('Controlador cobranzaController', function() { 15 describe('Controlador cobranzaController', function() {
16 16
17 var $filter = function() { 17 var $filter = function() {
18 return function() { }; 18 return function() { };
19 }; 19 };
20 20
21 var $timeout = function() { }; 21 var $timeout = function() { };
22 22
23 it('existe el controlador cobranzaController', function() { 23 it('existe el controlador cobranzaController', function() {
24 24
25 //act 25 //act
26 var controlador = $controller('cobranzaController', { 26 var controlador = $controller('cobranzaController', {
27 $scope: { 27 $scope: {
28 $broadcast: function() { } 28 $broadcast: function() { },
29 $watch: function() { }
29 }, 30 },
30 $timeout: $timeout, 31 $timeout: $timeout,
31 $uibModal: {}, 32 $uibModal: {},
32 $location: {}, 33 $location: {},
33 focaCrearCobranzaService: { 34 focaCrearCobranzaService: {
34 getCotizacionByIdMoneda: function() { 35 getCotizacionByIdMoneda: function() {
35 return { 36 return {
36 then: function() { } 37 then: function() { }
37 }; 38 };
38 }, 39 },
39 getBotonera: function() { }, 40 getBotonera: function() { },
40 getNumeroRecibo: function() { 41 getNumeroRecibo: function() {
41 return { 42 return {
42 then: function() { } 43 then: function() { }
43 }; 44 };
44 } 45 }
45 }, 46 },
46 focaModalService: {}, 47 focaModalService: {},
47 $filter: $filter, 48 $filter: $filter,
48 focaSeguimientoService: {}, 49 focaSeguimientoService: {},
49 focaBotoneraLateralService: {}, 50 focaBotoneraLateralService: {},
50 APP: {}, 51 APP: {},
51 focaLoginService: {} 52 focaLoginService: {},
53 $localStorage: true
52 }); 54 });
53 55
54 //assert 56 //assert
55 expect(typeof controlador).toEqual('object'); 57 expect(typeof controlador).toEqual('object');
56 }); 58 });
57 59
58 it('function crearCobranza muestra alerta cuando no hay cliente', function() { 60 it('function crearCobranza muestra alerta cuando no hay cliente', function() {
59 61
60 //arrange 62 //arrange
61 var scope = { 63 var scope = {
62 $broadcast: function() { } 64 $broadcast: function() { },
65 $watch: function() { }
63 }; 66 };
64 var focaModalService = { 67 var focaModalService = {
65 alert: function() { } 68 alert: function() { }
66 }; 69 };
67 70
68 $controller('cobranzaController', { 71 $controller('cobranzaController', {
69 $scope: scope, 72 $scope: scope,
70 $timeout: $timeout, 73 $timeout: $timeout,
71 $uibModal: {}, 74 $uibModal: {},
72 $location: {}, 75 $location: {},
73 focaCrearCobranzaService: { 76 focaCrearCobranzaService: {
74 getCotizacionByIdMoneda: function() { 77 getCotizacionByIdMoneda: function() {
75 return { 78 return {
76 then: function() { } 79 then: function() { }
77 }; 80 };
78 }, 81 },
79 getBotonera: function() { }, 82 getBotonera: function() { },
80 getNumeroRecibo: function() { 83 getNumeroRecibo: function() {
81 return { 84 return {
82 then: function() { } 85 then: function() { }
83 }; 86 };
84 } 87 }
85 }, 88 },
86 focaModalService: focaModalService, 89 focaModalService: focaModalService,
87 $filter: $filter, 90 $filter: $filter,
88 focaSeguimientoService: {}, 91 focaSeguimientoService: {},
89 focaBotoneraLateralService: {}, 92 focaBotoneraLateralService: {},
90 APP: {}, 93 APP: {},
91 focaLoginService: {} 94 focaLoginService: {},
95 $localStorage: true
92 }); 96 });
93 97
94 //act 98 //act
95 spyOn(focaModalService, 'alert'); 99 spyOn(focaModalService, 'alert');
96 scope.crearCobranza(); 100 scope.crearCobranza();
97 101
98 //assert 102 //assert
99 expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Cliente'); 103 expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Cliente');
100 }); 104 });
101 105
102 it('function crearCobranza muestra alerta cuando no hay cobrador', function() { 106 it('function crearCobranza muestra alerta cuando no hay cobrador', function() {
103 107
104 //arrange 108 //arrange
105 var scope = { 109 var scope = {
106 $broadcast: function() { } 110 $broadcast: function() { },
111 $watch: function() { }
107 }; 112 };
108 var focaModalService = { 113 var focaModalService = {
109 alert: function() { } 114 alert: function() { }
110 }; 115 };
111 116
112 $controller('cobranzaController', { 117 $controller('cobranzaController', {
113 $scope: scope, 118 $scope: scope,
114 $timeout: $timeout, 119 $timeout: $timeout,
115 $uibModal: {}, 120 $uibModal: {},
116 $location: {}, 121 $location: {},
117 focaCrearCobranzaService: { 122 focaCrearCobranzaService: {
118 getCotizacionByIdMoneda: function() { 123 getCotizacionByIdMoneda: function() {
119 return { 124 return {
120 then: function() { } 125 then: function() { }
121 }; 126 };
122 }, 127 },
123 getBotonera: function() { }, 128 getBotonera: function() { },
124 getNumeroRecibo: function() { 129 getNumeroRecibo: function() {
125 return { 130 return {
126 then: function() { } 131 then: function() { }
127 }; 132 };
128 } 133 }
129 }, 134 },
130 focaModalService: focaModalService, 135 focaModalService: focaModalService,
131 $filter: $filter, 136 $filter: $filter,
132 focaSeguimientoService: {}, 137 focaSeguimientoService: {},
133 focaBotoneraLateralService: {}, 138 focaBotoneraLateralService: {},
134 APP: {}, 139 APP: {},
135 focaLoginService: {} 140 focaLoginService: {},
141 $localStorage: true
136 }); 142 });
137 scope.cobranza = { 143 scope.cobranza = {
138 cliente: { } 144 cliente: {
145 COD: true
146 },
147 cobrador: {}
139 }; 148 };
140 149
141 //act 150 //act
142 spyOn(focaModalService, 'alert'); 151 spyOn(focaModalService, 'alert');
143 scope.crearCobranza(); 152 scope.crearCobranza();
144 153
145 //assert 154 //assert
146 expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Cobrador'); 155 expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese Cobrador');
147 }); 156 });
148 157
149 it('function crearCobranza muestra alerta cuando no hay facturas', function() { 158 it('function crearCobranza muestra alerta cuando no hay facturas', function() {
150 159
151 //arrange 160 //arrange
152 var scope = { 161 var scope = {
153 $broadcast: function() { } 162 $broadcast: function() { },
163 $watch: function() { }
154 }; 164 };
155 var focaModalService = { 165 var focaModalService = {
156 alert: function() { } 166 alert: function() { }
157 }; 167 };
158 168
159 $controller('cobranzaController', { 169 $controller('cobranzaController', {
160 $scope: scope, 170 $scope: scope,
161 $timeout: $timeout, 171 $timeout: $timeout,
162 $uibModal: {}, 172 $uibModal: {},
163 $location: {}, 173 $location: {},
164 focaCrearCobranzaService: { 174 focaCrearCobranzaService: {
165 getCotizacionByIdMoneda: function() { 175 getCotizacionByIdMoneda: function() {
166 return { 176 return {
167 then: function() { } 177 then: function() { }
168 }; 178 };
169 }, 179 },
170 getBotonera: function() { }, 180 getBotonera: function() { },
171 getNumeroRecibo: function() { 181 getNumeroRecibo: function() {
172 return { 182 return {
173 then: function() { } 183 then: function() { }
174 }; 184 };
175 } 185 }
176 }, 186 },
177 focaModalService: focaModalService, 187 focaModalService: focaModalService,
178 $filter: $filter, 188 $filter: $filter,
179 focaSeguimientoService: {}, 189 focaSeguimientoService: {},
180 focaBotoneraLateralService: {}, 190 focaBotoneraLateralService: {},
181 APP: {}, 191 APP: {},
182 focaLoginService: {} 192 focaLoginService: {},
193 $localStorage: true
183 }); 194 });
184 scope.cobranza = { 195 scope.cobranza = {
185 cliente: { }, 196 cliente: {
186 cobrador: { } 197 COD: true
198 },
199 cobrador: {
200 NUM: true
201 },
202 facturas: []
187 }; 203 };
188 204
189 //act 205 //act
190 spyOn(focaModalService, 'alert'); 206 spyOn(focaModalService, 'alert');
191 scope.crearCobranza(); 207 scope.crearCobranza();
192 208
193 //assert 209 //assert
194 expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese al menos una factura'); 210 expect(focaModalService.alert).toHaveBeenCalledWith('Ingrese al menos una factura');
195 }); 211 });
196 212
197 it('crearCobranza muestra alerta cuando la diferencia no es 0', function() { 213 it('crearCobranza muestra alerta cuando la diferencia no es 0', function() {
198 214
199 //arrange 215 //arrange
200 var scope = { 216 var scope = {
201 $broadcast: function() { } 217 $broadcast: function() { },
218 $watch: function() { }
202 }; 219 };
203 var focaModalService = { 220 var focaModalService = {
204 alert: function() { } 221 alert: function() { }
205 }; 222 };
206 223
207 $controller('cobranzaController', { 224 $controller('cobranzaController', {
208 $scope: scope, 225 $scope: scope,
209 $timeout: $timeout, 226 $timeout: $timeout,
210 $uibModal: {}, 227 $uibModal: {},
211 $location: {}, 228 $location: {},
212 focaCrearCobranzaService: { 229 focaCrearCobranzaService: {
213 getCotizacionByIdMoneda: function() { 230 getCotizacionByIdMoneda: function() {
214 return { 231 return {
215 then: function() { } 232 then: function() { }
216 }; 233 };
217 }, 234 },
218 getBotonera: function() { }, 235 getBotonera: function() { },
219 getNumeroRecibo: function() { 236 getNumeroRecibo: function() {
220 return { 237 return {
221 then: function() { } 238 then: function() { }
222 }; 239 };
223 } 240 }
224 }, 241 },
225 focaModalService: focaModalService, 242 focaModalService: focaModalService,
226 $filter: $filter, 243 $filter: $filter,
227 focaSeguimientoService: {}, 244 focaSeguimientoService: {},
228 focaBotoneraLateralService: {}, 245 focaBotoneraLateralService: {},
229 APP: {}, 246 APP: {},
230 focaLoginService: {} 247 focaLoginService: {},
248 $localStorage: true
231 }); 249 });
232 scope.cobranza = { 250 scope.cobranza = {
233 cliente: {}, 251 cliente: {
234 cobrador: {}, 252 COD: true
235 moneda: { SIMBOLO: '' } 253 },
254 cobrador: {
255 NUM: true
256 },
257 cotizacion: {
258 moneda: { SIMBOLO: '' },
259 },
260 facturas: [1]
236 }; 261 };
237 scope.facturaTabla = [1]; 262 scope.facturaTabla = [1];
238 263
239 //act 264 //act
240 spyOn(focaModalService, 'alert'); 265 spyOn(focaModalService, 'alert');
241 spyOn(scope, 'getTotalCobrado').and.returnValue(1); 266 spyOn(scope, 'getTotalCobrado').and.returnValue(1);
242 spyOn(scope, 'getTotalDeuda').and.returnValue(1); 267 spyOn(scope, 'getTotalDeuda').and.returnValue(1);
243 scope.crearCobranza(); 268 scope.crearCobranza();
244 269
245 //assert 270 //assert
246 expect(focaModalService.alert).toHaveBeenCalledWith('La diferencia debe ser 0,00'); 271 expect(focaModalService.alert).toHaveBeenCalledWith('La diferencia debe ser 0,00');
247 }); 272 });
248 273
249 it('crearCobranza llama a startGuardar y guardarCobranza', function() { 274 it('crearCobranza llama a startGuardar y guardarCobranza', function() {
250 275
251 //arrange 276 //arrange
252 var scope = { 277 var scope = {
253 $broadcast: function() { } 278 $broadcast: function() { },
279 $watch: function() { }
254 }; 280 };
255 var focaBotoneraLateralService = { 281 var focaBotoneraLateralService = {
256 startGuardar: function() { } 282 startGuardar: function() { }
257 }; 283 };
258 var focaCrearCobranzaService = { 284 var focaCrearCobranzaService = {
259 guardarCobranza: function() { }, 285 guardarCobranza: function() { },
260 getCotizacionByIdMoneda: function() { 286 getCotizacionByIdMoneda: function() {
261 return { 287 return {
262 then: function() { } 288 then: function() { }
263 }; 289 };
264 }, 290 },
265 getBotonera: function() { }, 291 getBotonera: function() { },
266 getNumeroRecibo: function() { 292 getNumeroRecibo: function() {
267 return { 293 return {
268 then: function() { } 294 then: function() { }
269 }; 295 };
270 } 296 }
271 }; 297 };
272 298
273 $controller('cobranzaController', { 299 $controller('cobranzaController', {
274 $scope: scope, 300 $scope: scope,
275 $timeout: $timeout, 301 $timeout: $timeout,
276 $uibModal: {}, 302 $uibModal: {},
277 $location: {}, 303 $location: {},
278 focaCrearCobranzaService: focaCrearCobranzaService, 304 focaCrearCobranzaService: focaCrearCobranzaService,
279 focaModalService: {}, 305 focaModalService: {
306 alert: function() {}
307 },
280 $filter: $filter, 308 $filter: $filter,
281 focaSeguimientoService: {}, 309 focaSeguimientoService: {},
282 focaBotoneraLateralService: focaBotoneraLateralService, 310 focaBotoneraLateralService: focaBotoneraLateralService,
283 APP: {}, 311 APP: {},
284 focaLoginService: {} 312 focaLoginService: {},
313 $localStorage: true
285 }); 314 });
286 scope.cobranza = { 315 scope.cobranza = {
287 cliente: {}, 316 cliente: {
288 cobrador: {}, 317 COD: true
289 moneda: { SIMBOLO: '' }, 318 },
290 cotizacion: {} 319 cobrador: {
320 NUM: true
321 },
322 cotizacion: {
323 moneda: {
324 ID: true,
325 SIMBOLO: ''
326 }
327 },
328 facturas: [1],
329 cobros: [{
330 fecha: new Date(),
331 fechaPresentacion: new Date(),
332 fechaEmision: new Date(),
333 tipo: true,
334 banco: {
335 ID: true
336 },
337 localidad: {
338 ID: true,
339 NOMBRE: true
340 },
341 provincia: {
342 ID: true
343 }
344 }],
345 fecha: new Date()
291 }; 346 };
292 scope.facturaTabla = [1];
293 347
294 //act 348 //act
295 spyOn(focaBotoneraLateralService, 'startGuardar'); 349 spyOn(focaBotoneraLateralService, 'startGuardar');
296 spyOn(focaCrearCobranzaService, 'guardarCobranza') 350 spyOn(focaCrearCobranzaService, 'guardarCobranza')
297 .and.returnValue({ then: function() { } }); 351 .and.returnValue({ then: function() { } });
298 spyOn(scope, 'getTotalCobrado').and.returnValue(0); 352 spyOn(scope, 'getTotalCobrado').and.returnValue(0);
299 spyOn(scope, 'getTotalDeuda').and.returnValue(0); 353 spyOn(scope, 'getTotalDeuda').and.returnValue(0);
300 scope.crearCobranza(); 354 scope.crearCobranza();
301 355
302 //assert 356 //assert
303 expect(focaBotoneraLateralService.startGuardar).toHaveBeenCalled(); 357 expect(focaBotoneraLateralService.startGuardar).toHaveBeenCalled();
304 expect(focaCrearCobranzaService.guardarCobranza).toHaveBeenCalled(); 358 expect(focaCrearCobranzaService.guardarCobranza).toHaveBeenCalled();
305 }); 359 });
306 360
307 it('seleccionarCobros seatea cobroDeuda en false', function() { 361 it('seleccionarCobros seatea cobroDeuda en false', function() {
308 362
309 //arrange 363 //arrange
310 var scope = { 364 var scope = {
311 $broadcast: function() { } 365 $broadcast: function() { },
366 $watch: function() { }
312 }; 367 };
313 368
314 $controller('cobranzaController', { 369 $controller('cobranzaController', {
315 $scope: scope, 370 $scope: scope,
316 $timeout: $timeout, 371 $timeout: $timeout,
317 $uibModal: {}, 372 $uibModal: {},
318 $location: {}, 373 $location: {},
319 focaCrearCobranzaService: { 374 focaCrearCobranzaService: {
320 getCotizacionByIdMoneda: function() { 375 getCotizacionByIdMoneda: function() {
321 return { 376 return {
322 then: function() { } 377 then: function() { }
323 }; 378 };
324 }, 379 },
325 getBotonera: function() { }, 380 getBotonera: function() { },
326 getNumeroRecibo: function() { 381 getNumeroRecibo: function() {
327 return { 382 return {
328 then: function() { } 383 then: function() { }
329 }; 384 };
330 } 385 }
331 }, 386 },
332 focaModalService: {}, 387 focaModalService: {},
333 $filter: $filter, 388 $filter: $filter,
334 focaSeguimientoService: {}, 389 focaSeguimientoService: {},
335 focaBotoneraLateralService: {}, 390 focaBotoneraLateralService: {},
336 APP: {}, 391 APP: {},
337 focaLoginService: {} 392 focaLoginService: {},
393 $localStorage: true
338 }); 394 });
339 395
340 //act 396 //act
341 scope.seleccionarCobros(); 397 scope.seleccionarCobros();
342 398
343 //assert 399 //assert
344 expect(scope.cobroDeuda).toEqual(false); 400 expect(scope.cobroDeuda).toEqual(false);
345 }); 401 });
346 402
347 it('seleccionarComprobantes seatea cobroDeuda en true', function() { 403 it('seleccionarComprobantes seatea cobroDeuda en true', function() {
348 404
349 //arrange 405 //arrange
350 var scope = { 406 var scope = {
351 $broadcast: function() { } 407 $broadcast: function() { },
408 $watch: function() { }
352 }; 409 };
353 410
354 $controller('cobranzaController', { 411 $controller('cobranzaController', {
355 $scope: scope, 412 $scope: scope,
356 $timeout: $timeout, 413 $timeout: $timeout,
357 $uibModal: {}, 414 $uibModal: {},
358 $location: {}, 415 $location: {},
359 focaCrearCobranzaService: { 416 focaCrearCobranzaService: {
360 getCotizacionByIdMoneda: function() { 417 getCotizacionByIdMoneda: function() {
361 return { 418 return {
362 then: function() { } 419 then: function() { }
363 }; 420 };
364 }, 421 },
365 getBotonera: function() { }, 422 getBotonera: function() { },
366 getNumeroRecibo: function() { 423 getNumeroRecibo: function() {
367 return { 424 return {
368 then: function() { } 425 then: function() { }
369 }; 426 };
370 } 427 }
371 }, 428 },
372 focaModalService: {}, 429 focaModalService: {},
373 $filter: $filter, 430 $filter: $filter,
374 focaSeguimientoService: {}, 431 focaSeguimientoService: {},
375 focaBotoneraLateralService: {}, 432 focaBotoneraLateralService: {},
376 APP: {}, 433 APP: {},
377 focaLoginService: {} 434 focaLoginService: {},
435 $localStorage: true
378 }); 436 });
379 437
380 //act 438 //act
381 scope.seleccionarComprobantes(); 439 scope.seleccionarComprobantes();
382 440
383 //assert 441 //assert
384 expect(scope.cobroDeuda).toEqual(true); 442 expect(scope.cobroDeuda).toEqual(true);
385 }); 443 });
386 444
387 it('seleccionarCobranza levanta modal y setea datos', function(done) { 445 it('seleccionarCobranza levanta modal y setea datos', function(done) {
388 446
389 //arrange 447 //arrange
390 var scope = { 448 var scope = {
391 $broadcast: function() { } 449 $broadcast: function() { },
450 $watch: function() { }
392 }; 451 };
393 var uibModal = { 452 var uibModal = {
394 open: function() { } 453 open: function() { }
395 }; 454 };
396 455
397 $controller('cobranzaController', { 456 $controller('cobranzaController', {
398 $scope: scope, 457 $scope: scope,
399 $timeout: $timeout, 458 $timeout: $timeout,
400 $uibModal: uibModal, 459 $uibModal: uibModal,
401 $location: {}, 460 $location: {},
402 focaCrearCobranzaService: { 461 focaCrearCobranzaService: {
403 getCotizacionByIdMoneda: function() { 462 getCotizacionByIdMoneda: function() {
404 return { 463 return {
405 then: function() { } 464 then: function() { }
406 }; 465 };
407 }, 466 },
408 getBotonera: function() { }, 467 getBotonera: function() { },
409 getNumeroRecibo: function() { 468 getNumeroRecibo: function() {
410 return { 469 return {
411 then: function() { } 470 then: function() { }
412 }; 471 };
413 } 472 }
414 }, 473 },
415 focaModalService: {}, 474 focaModalService: {},
416 $filter: $filter, 475 $filter: $filter,
417 focaSeguimientoService: {}, 476 focaSeguimientoService: {},
418 focaBotoneraLateralService: {}, 477 focaBotoneraLateralService: {},
419 APP: {}, 478 APP: {},
420 focaLoginService: {} 479 focaLoginService: {},
480 $localStorage: true
421 }); 481 });
422 var respuesta = { facturas: 1, cobros: 2, cliente: { } }; 482 var respuesta = { facturas: 1, cobros: 2, cliente: { } };
423 var promesa = { result: Promise.resolve(respuesta) }; 483 var promesa = { result: Promise.resolve(respuesta) };
424 484
425 //act 485 //act
426 spyOn(uibModal, 'open').and.returnValue(promesa); 486 spyOn(uibModal, 'open').and.returnValue(promesa);
427 spyOn(scope, '$broadcast'); 487 spyOn(scope, '$broadcast');
428 scope.seleccionarCobranza(); 488 scope.seleccionarCobranza();
429 489
430 //assert 490 //assert
431 promesa.result.then(function() { 491 promesa.result.then(function() {
432 expect(uibModal.open).toHaveBeenCalled(); 492 expect(uibModal.open).toHaveBeenCalled();
433 expect(scope.$broadcast).toHaveBeenCalledWith('cleanCabecera'); 493 expect(scope.$broadcast).toHaveBeenCalledWith('cleanCabecera');
434 expect(scope.facturaTabla).toEqual(respuesta.facturas); 494 expect(scope.cobranza.facturas).toEqual(respuesta.facturas);
435 expect(scope.cobrosTabla).toEqual(respuesta.cobros); 495 expect(scope.cobranza.cobros).toEqual(respuesta.cobros);
436 done(); 496 done();
437 }); 497 });
438 }); 498 });
439 499
440 it('seleccionarCliente levanta modal y setea datos', function(done) { 500 it('seleccionarCliente levanta modal y setea datos', function(done) {
441 501
442 //arrange 502 //arrange
443 var scope = { 503 var scope = {
444 $broadcast: function() { } 504 $broadcast: function() { },
505 $watch: function() { }
445 }; 506 };
446 var uibModal = { 507 var uibModal = {
447 open: function() { } 508 open: function() { }
448 }; 509 };
449 510
450 $controller('cobranzaController', { 511 $controller('cobranzaController', {
451 $scope: scope, 512 $scope: scope,
452 $timeout: $timeout, 513 $timeout: $timeout,
453 $uibModal: uibModal, 514 $uibModal: uibModal,
454 $location: {}, 515 $location: {},
455 focaCrearCobranzaService: { 516 focaCrearCobranzaService: {
456 getCotizacionByIdMoneda: function() { 517 getCotizacionByIdMoneda: function() {
457 return { 518 return {
458 then: function() { } 519 then: function() { }
459 }; 520 };
460 }, 521 },
461 getBotonera: function() { }, 522 getBotonera: function() { },
462 getNumeroRecibo: function() { 523 getNumeroRecibo: function() {
463 return { 524 return {
464 then: function() { } 525 then: function() { }
465 }; 526 };
466 } 527 }
467 }, 528 },
468 focaModalService: {}, 529 focaModalService: {},
469 $filter: $filter, 530 $filter: $filter,
470 focaSeguimientoService: {}, 531 focaSeguimientoService: {},
471 focaBotoneraLateralService: {}, 532 focaBotoneraLateralService: {},
472 APP: {}, 533 APP: {},
473 focaLoginService: {} 534 focaLoginService: {},
535 $localStorage: true
474 }); 536 });
475 scope.cobranza = { 537 scope.cobranza = {
476 cobrador: {} 538 cobrador: {}
477 }; 539 };
478 var respuesta = { facturas: 1, cobros: 2, cliente: { } }; 540 var respuesta = { facturas: 1, cobros: 2, cliente: { } };
479 var promesa = { result: Promise.resolve(respuesta) }; 541 var promesa = { result: Promise.resolve(respuesta) };
480 542
481 //act 543 //act
482 spyOn(uibModal, 'open').and.returnValue(promesa); 544 spyOn(uibModal, 'open').and.returnValue(promesa);
483 spyOn(scope, '$broadcast'); 545 spyOn(scope, '$broadcast');
484 scope.seleccionarCliente(); 546 scope.seleccionarCliente();
485 547
486 //assert 548 //assert
487 promesa.result.then(function() { 549 promesa.result.then(function() {
488 expect(uibModal.open).toHaveBeenCalled(); 550 expect(uibModal.open).toHaveBeenCalled();
489 expect(scope.$broadcast).toHaveBeenCalled(); 551 expect(scope.$broadcast).toHaveBeenCalled();
490 done(); 552 done();
491 }); 553 });
492 }); 554 });
493 555
494 it('seleccionarFactura muestra alerta cuando no se seteo cliente', function() { 556 it('seleccionarFactura muestra alerta cuando no se seteo cliente', function() {
495 557
496 //arrange 558 //arrange
497 var scope = { 559 var scope = {
498 $broadcast: function() { } 560 $broadcast: function() { },
561 $watch: function() { }
499 }; 562 };
500 var focaModalService = { 563 var focaModalService = {
501 alert: function() { } 564 alert: function() { }
502 }; 565 };
503 566
504 $controller('cobranzaController', { 567 $controller('cobranzaController', {
505 $scope: scope, 568 $scope: scope,
506 $timeout: $timeout, 569 $timeout: $timeout,
507 $uibModal: {}, 570 $uibModal: {
571 open: function() {
572 return {
573 result: {
574 then: function() { }
575 }
576 };
577 }
578 },
508 $location: {}, 579 $location: {},
509 focaCrearCobranzaService: { 580 focaCrearCobranzaService: {
510 getCotizacionByIdMoneda: function() { 581 getCotizacionByIdMoneda: function() {
511 return { 582 return {
512 then: function() { } 583 then: function() { }
513 }; 584 };
514 }, 585 },
515 getBotonera: function() { }, 586 getBotonera: function() { },
516 getNumeroRecibo: function() { 587 getNumeroRecibo: function() {
517 return { 588 return {
518 then: function() { } 589 then: function() { }
519 }; 590 };
520 } 591 }
521 }, 592 },
522 focaModalService: focaModalService, 593 focaModalService: focaModalService,
523 $filter: $filter, 594 $filter: $filter,
524 focaSeguimientoService: {}, 595 focaSeguimientoService: {},
525 focaBotoneraLateralService: {}, 596 focaBotoneraLateralService: {},
526 APP: {}, 597 APP: {},
527 focaLoginService: {} 598 focaLoginService: {},
599 $localStorage: true
528 }); 600 });
529 601
530 //act 602 //act
531 spyOn(focaModalService, 'alert'); 603 spyOn(focaModalService, 'alert');
532 scope.seleccionarFactura(); 604 scope.seleccionarFactura();
533 605
534 //assert 606 //assert
535 expect(focaModalService.alert).toHaveBeenCalledWith('Seleccione primero un cliente'); 607 expect(focaModalService.alert).toHaveBeenCalledWith('Seleccione primero un cliente');
536 }); 608 });
537 609
538 it('seleccionarFactura levanta modal', function() { 610 it('seleccionarFactura levanta modal', function() {
539 611
540 //arrange 612 //arrange
541 var scope = { 613 var scope = {
542 $broadcast: function() { } 614 $broadcast: function() { },
615 $watch: function() { }
543 }; 616 };
544 var uibModal = { 617 var uibModal = {
545 open: function() { } 618 open: function() { }
546 }; 619 };
547 620
548 $controller('cobranzaController', { 621 $controller('cobranzaController', {
549 $scope: scope, 622 $scope: scope,
550 $timeout: $timeout, 623 $timeout: $timeout,
551 $uibModal: uibModal, 624 $uibModal: uibModal,
552 $location: {}, 625 $location: {},
553 focaCrearCobranzaService: { 626 focaCrearCobranzaService: {
554 getCotizacionByIdMoneda: function() { 627 getCotizacionByIdMoneda: function() {
555 return { 628 return {
556 then: function() { } 629 then: function() { }
557 }; 630 };
558 }, 631 },
559 getBotonera: function() { }, 632 getBotonera: function() { },
560 getNumeroRecibo: function() { 633 getNumeroRecibo: function() {
561 return { 634 return {
562 then: function() { } 635 then: function() { }
563 }; 636 };
564 } 637 }
565 }, 638 },
566 focaModalService: {}, 639 focaModalService: {
640 alert: function() {}
641 },
567 $filter: $filter, 642 $filter: $filter,
568 focaSeguimientoService: {}, 643 focaSeguimientoService: {},
569 focaBotoneraLateralService: {}, 644 focaBotoneraLateralService: {},
570 APP: {}, 645 APP: {},
571 focaLoginService: {} 646 focaLoginService: {},
647 $localStorage: true
572 }); 648 });
573 scope.cobranza = { 649 scope.cobranza = {
574 cliente: { } 650 cliente: {
651 COD: true
652 }
575 }; 653 };
576 654
577 var respuesta = { result: { then: function() { } } }; 655 var respuesta = { result: { then: function() { } } };
578 656
579 //act 657 //act
580 spyOn(uibModal, 'open').and.returnValue(respuesta); 658 spyOn(uibModal, 'open').and.returnValue(respuesta);
581 scope.seleccionarFactura(); 659 scope.seleccionarFactura();
582 660
583 //assert 661 //assert
584 expect(uibModal.open).toHaveBeenCalled(); 662 expect(uibModal.open).toHaveBeenCalled();
585 }); 663 });
586 664
587 it('seleccionarCheque levanta modal', function() { 665 it('seleccionarCheque levanta modal', function() {
588 666
589 //arrange 667 //arrange
590 var scope = { 668 var scope = {
591 $broadcast: function() { } 669 $broadcast: function() { },
670 $watch: function() { }
592 }; 671 };
593 var uibModal = { 672 var uibModal = {
594 open: function() { } 673 open: function() { }
595 }; 674 };
596 675
597 $controller('cobranzaController', { 676 $controller('cobranzaController', {
598 $scope: scope, 677 $scope: scope,
599 $timeout: $timeout, 678 $timeout: $timeout,
600 $uibModal: uibModal, 679 $uibModal: uibModal,
601 $location: {}, 680 $location: {},
602 focaCrearCobranzaService: { 681 focaCrearCobranzaService: {
603 getCotizacionByIdMoneda: function() { 682 getCotizacionByIdMoneda: function() {
604 return { 683 return {
605 then: function() { } 684 then: function() { }
606 }; 685 };
607 }, 686 },
608 getBotonera: function() { }, 687 getBotonera: function() { },
609 getNumeroRecibo: function() { 688 getNumeroRecibo: function() {
610 return { 689 return {
611 then: function() { } 690 then: function() { }
612 }; 691 };
613 } 692 }
614 }, 693 },
615 focaModalService: {}, 694 focaModalService: {},
616 $filter: $filter, 695 $filter: $filter,
617 focaSeguimientoService: {}, 696 focaSeguimientoService: {},
618 focaBotoneraLateralService: {}, 697 focaBotoneraLateralService: {},
619 APP: {}, 698 APP: {},
620 focaLoginService: {} 699 focaLoginService: {},
700 $localStorage: true
621 }); 701 });
622 scope.cobranza = { 702 scope.cobranza = {
623 cliente: { } 703 cliente: { }
624 }; 704 };
625 705
626 var respuesta = { result: { then: function() { } } }; 706 var respuesta = { result: { then: function() { } } };
627 707
628 //act 708 //act
629 spyOn(uibModal, 'open').and.returnValue(respuesta); 709 spyOn(uibModal, 'open').and.returnValue(respuesta);
630 scope.seleccionarCheque(); 710 scope.seleccionarCheque();
631 711
632 //assert 712 //assert
633 expect(uibModal.open).toHaveBeenCalled(); 713 expect(uibModal.open).toHaveBeenCalled();
634 }); 714 });
635 715
636 it('seleccionarEfectivo levanta modal', function() { 716 it('seleccionarEfectivo levanta modal', function() {
637 717
638 //arrange 718 //arrange
639 var scope = { 719 var scope = {
640 $broadcast: function() { } 720 $broadcast: function() { },
721 $watch: function() { }
641 }; 722 };
642 var uibModal = { 723 var uibModal = {
643 open: function() { } 724 open: function() { }
644 }; 725 };
645 726
646 $controller('cobranzaController', { 727 $controller('cobranzaController', {
647 $scope: scope, 728 $scope: scope,
648 $timeout: $timeout, 729 $timeout: $timeout,
649 $uibModal: uibModal, 730 $uibModal: uibModal,
650 $location: {}, 731 $location: {},
651 focaCrearCobranzaService: { 732 focaCrearCobranzaService: {
652 getCotizacionByIdMoneda: function() { 733 getCotizacionByIdMoneda: function() {
653 return { 734 return {
654 then: function() { } 735 then: function() { }
655 }; 736 };
656 }, 737 },
657 getBotonera: function() { }, 738 getBotonera: function() { },
658 getNumeroRecibo: function() { 739 getNumeroRecibo: function() {
659 return { 740 return {
660 then: function() { } 741 then: function() { }
661 }; 742 };
662 } 743 }
663 }, 744 },
664 focaModalService: {}, 745 focaModalService: {},
665 $filter: $filter, 746 $filter: $filter,
666 focaSeguimientoService: {}, 747 focaSeguimientoService: {},
667 focaBotoneraLateralService: {}, 748 focaBotoneraLateralService: {},
668 APP: {}, 749 APP: {},
669 focaLoginService: {} 750 focaLoginService: {},
751 $localStorage: true
670 }); 752 });
671 scope.cobranza = { 753 scope.cobranza = {
672 cliente: { } 754 cliente: { }
673 }; 755 };
674 756
675 var respuesta = { result: { then: function() { } } }; 757 var respuesta = { result: { then: function() { } } };
676 758
677 //act 759 //act
678 spyOn(uibModal, 'open').and.returnValue(respuesta); 760 spyOn(uibModal, 'open').and.returnValue(respuesta);
679 scope.seleccionarEfectivo(); 761 scope.seleccionarEfectivo();
680 762
681 //assert 763 //assert
682 expect(uibModal.open).toHaveBeenCalled(); 764 expect(uibModal.open).toHaveBeenCalled();
683 }); 765 });
684 766
685 it('seleccionarDetalles levanta modal', function() { 767 it('seleccionarDetalles levanta modal', function() {
686 768
687 //arrange 769 //arrange
688 var scope = { 770 var scope = {
689 $broadcast: function() { } 771 $broadcast: function() { },
772 $watch: function() { }
690 }; 773 };
691 var uibModal = { 774 var uibModal = {
692 open: function() { } 775 open: function() { }
693 }; 776 };
694 777
695 $controller('cobranzaController', { 778 $controller('cobranzaController', {
696 $scope: scope, 779 $scope: scope,
697 $timeout: $timeout, 780 $timeout: $timeout,
698 $uibModal: uibModal, 781 $uibModal: uibModal,
699 $location: {}, 782 $location: {},
700 focaCrearCobranzaService: { 783 focaCrearCobranzaService: {
701 getCotizacionByIdMoneda: function() { 784 getCotizacionByIdMoneda: function() {
702 return { 785 return {
703 then: function() { } 786 then: function() { }
704 }; 787 };
705 }, 788 },
706 getBotonera: function() { }, 789 getBotonera: function() { },
707 getNumeroRecibo: function() { 790 getNumeroRecibo: function() {
708 return { 791 return {
709 then: function() { } 792 then: function() { }
710 }; 793 };
711 } 794 }
712 }, 795 },
713 focaModalService: {}, 796 focaModalService: {},
714 $filter: $filter, 797 $filter: $filter,
715 focaSeguimientoService: {}, 798 focaSeguimientoService: {},
716 focaBotoneraLateralService: {}, 799 focaBotoneraLateralService: {},
717 APP: {}, 800 APP: {},
718 focaLoginService: {} 801 focaLoginService: {},
802 $localStorage: true
719 }); 803 });
720 scope.cobranza = { 804 scope.cobranza = {
721 cliente: { } 805 cliente: { }
722 }; 806 };
723 807
724 var respuesta = { result: { then: function() { } } }; 808 var respuesta = { result: { then: function() { } } };
725 809
726 //act 810 //act
727 spyOn(uibModal, 'open').and.returnValue(respuesta); 811 spyOn(uibModal, 'open').and.returnValue(respuesta);
728 scope.seleccionarDetalles(); 812 scope.seleccionarDetalles();
729 813
730 //assert 814 //assert
731 expect(uibModal.open).toHaveBeenCalled(); 815 expect(uibModal.open).toHaveBeenCalled();
732 }); 816 });
733 817
734 it('seleccionarMoneda levanta modal', function(done) { 818 it('seleccionarMoneda levanta modal', function(done) {
735 819
736 //arrange 820 //arrange
737 var scope = { 821 var scope = {
738 $broadcast: function() { } 822 $broadcast: function() { },
823 $watch: function() { }
739 }; 824 };
740 var focaModalService = { 825 var focaModalService = {
741 modal: function() { } 826 modal: function() { }
742 }; 827 };
743 828
744 $controller('cobranzaController', { 829 $controller('cobranzaController', {
745 $scope: scope, 830 $scope: scope,
746 $timeout: $timeout, 831 $timeout: $timeout,
747 $uibModal: {}, 832 $uibModal: {},
748 $location: {}, 833 $location: {},
749 focaCrearCobranzaService: { 834 focaCrearCobranzaService: {
750 getCotizacionByIdMoneda: function() { 835 getCotizacionByIdMoneda: function() {
751 return { 836 return {
752 then: function() { } 837 then: function() { }
753 }; 838 };
754 }, 839 },
755 getBotonera: function() { }, 840 getBotonera: function() { },
756 getNumeroRecibo: function() { 841 getNumeroRecibo: function() {
757 return { 842 return {
758 then: function() { } 843 then: function() { }
759 }; 844 };
760 } 845 }
761 }, 846 },
762 focaModalService: focaModalService, 847 focaModalService: focaModalService,
763 $filter: $filter, 848 $filter: $filter,
764 focaSeguimientoService: {}, 849 focaSeguimientoService: {},
765 focaBotoneraLateralService: {}, 850 focaBotoneraLateralService: {},
766 APP: {}, 851 APP: {},
767 focaLoginService: {} 852 focaLoginService: {},
853 $localStorage: true
768 }); 854 });
769 855
770 var respuesta = 1; 856 var respuesta = 1;
771 var promesa = Promise.resolve(respuesta); 857 var promesa = Promise.resolve(respuesta);
772 858
773 //act 859 //act
774 spyOn(focaModalService, 'modal').and.returnValue(promesa); 860 spyOn(focaModalService, 'modal').and.returnValue(promesa);
775 spyOn(scope, 'seleccionarCotizacion'); 861 spyOn(scope, 'seleccionarCotizacion');
776 scope.seleccionarMoneda(); 862 scope.seleccionarMoneda();
777 863
778 //assert 864 //assert
779 expect(focaModalService.modal).toHaveBeenCalled(); 865 expect(focaModalService.modal).toHaveBeenCalled();
780 promesa.then(function() { 866 promesa.then(function() {
781 expect(scope.seleccionarCotizacion).toHaveBeenCalled(); 867 expect(scope.seleccionarCotizacion).toHaveBeenCalled();
782 done(); 868 done();
783 }); 869 });
784 }); 870 });
785 871
786 it('seleccionarCotizacion levanta modal', function(done) { 872 it('seleccionarCotizacion levanta modal', function(done) {
787 873
788 //arrange 874 //arrange
789 var scope = { 875 var scope = {
790 $broadcast: function() { } 876 $broadcast: function() { },
877 $watch: function() { }
791 }; 878 };
792 var uibModal = { 879 var uibModal = {
793 open: function() { } 880 open: function() { }
794 }; 881 };
795 882
796 $controller('cobranzaController', { 883 $controller('cobranzaController', {
797 $scope: scope, 884 $scope: scope,
798 $timeout: $timeout, 885 $timeout: $timeout,
799 $uibModal: uibModal, 886 $uibModal: uibModal,
800 $location: {}, 887 $location: {},
801 focaCrearCobranzaService: { 888 focaCrearCobranzaService: {
802 getCotizacionByIdMoneda: function() { 889 getCotizacionByIdMoneda: function() {
803 return { 890 return {
804 then: function() { } 891 then: function() { }
805 }; 892 };
806 }, 893 },
807 getBotonera: function() { }, 894 getBotonera: function() { },
808 getNumeroRecibo: function() { 895 getNumeroRecibo: function() {
809 return { 896 return {
810 then: function() { } 897 then: function() { }
811 }; 898 };
812 } 899 }
813 }, 900 },
814 focaModalService: {}, 901 focaModalService: {},
815 $filter: $filter, 902 $filter: $filter,
816 focaSeguimientoService: {}, 903 focaSeguimientoService: {},
817 focaBotoneraLateralService: {}, 904 focaBotoneraLateralService: {},
818 APP: {}, 905 APP: {},
819 focaLoginService: {} 906 focaLoginService: {},
907 $localStorage: true
820 }); 908 });
821 909
822 var respuesta = 1; 910 var respuesta = 1;
823 var promesa = { result: Promise.resolve(respuesta) }; 911 var promesa = { result: Promise.resolve(respuesta) };
824 912
825 //act 913 //act
826 spyOn(uibModal, 'open').and.returnValue(promesa); 914 spyOn(uibModal, 'open').and.returnValue(promesa);
827 spyOn(scope, '$broadcast'); 915 spyOn(scope, '$broadcast');
828 scope.seleccionarCotizacion({ }); 916 scope.seleccionarCotizacion({ });
829 917
830 //assert 918 //assert
831 promesa.result.then(function() { 919 promesa.result.then(function() {
832 expect(uibModal.open).toHaveBeenCalled(); 920 expect(uibModal.open).toHaveBeenCalled();
833 expect(scope.$broadcast).toHaveBeenCalled(); 921 expect(scope.$broadcast).toHaveBeenCalled();
834 scope.cobranza.cotizacion = respuesta; 922 scope.cobranza.cotizacion = respuesta;
835 done(); 923 done();
836 }); 924 });
837 }); 925 });
838 926
839 it('seleccionarCobrador levanta modal', function(done) { 927 it('seleccionarCobrador levanta modal', function(done) {
840 928
841 //arrange 929 //arrange
842 var scope = { 930 var scope = {
843 $broadcast: function() { } 931 $broadcast: function() { },
932 $watch: function() { }
844 }; 933 };
845 var focaModalService = { 934 var focaModalService = {
846 modal: function() { } 935 modal: function() { }
847 }; 936 };
848 937
849 $controller('cobranzaController', { 938 $controller('cobranzaController', {
850 $scope: scope, 939 $scope: scope,
851 $timeout: $timeout, 940 $timeout: $timeout,
852 $uibModal: {}, 941 $uibModal: {},
853 $location: {}, 942 $location: {},
854 focaCrearCobranzaService: { 943 focaCrearCobranzaService: {
855 getCotizacionByIdMoneda: function() { 944 getCotizacionByIdMoneda: function() {
856 return { 945 return {
857 then: function() { } 946 then: function() { }
858 }; 947 };
859 }, 948 },
860 getBotonera: function() { }, 949 getBotonera: function() { },
861 getNumeroRecibo: function() { 950 getNumeroRecibo: function() {
862 return { 951 return {
863 then: function() { } 952 then: function() { }
864 }; 953 };
865 } 954 }
866 }, 955 },
867 focaModalService: focaModalService, 956 focaModalService: focaModalService,
868 $filter: $filter, 957 $filter: $filter,
869 focaSeguimientoService: {}, 958 focaSeguimientoService: {},
870 focaBotoneraLateralService: {}, 959 focaBotoneraLateralService: {},
871 APP: {}, 960 APP: {},
872 focaLoginService: {} 961 focaLoginService: {},
962 $localStorage: true
873 }); 963 });
874 964
875 var respuesta = 1; 965 var respuesta = 1;
876 var promesa = Promise.resolve(respuesta); 966 var promesa = Promise.resolve(respuesta);
877 967
878 //act 968 //act
879 spyOn(focaModalService, 'modal').and.returnValue(promesa); 969 spyOn(focaModalService, 'modal').and.returnValue(promesa);
880 spyOn(scope, '$broadcast'); 970 spyOn(scope, '$broadcast');
881 scope.seleccionarCobrador({ }); 971 scope.seleccionarCobrador({ });
882 972
883 //assert 973 //assert
884 promesa.then(function() { 974 promesa.then(function() {
885 expect(focaModalService.modal).toHaveBeenCalled(); 975 expect(focaModalService.modal).toHaveBeenCalled();
886 expect(scope.$broadcast).toHaveBeenCalled(); 976 expect(scope.$broadcast).toHaveBeenCalled();
887 scope.cobranza.cobrador = respuesta; 977 scope.cobranza.cobrador = respuesta;
888 done(); 978 done();
889 }); 979 });
890 }); 980 });
891 981
892 it('getTotalDeuda devuelve correcto', function() { 982 it('getTotalDeuda devuelve correcto', function() {
893 983
894 //arrange 984 //arrange
895 var scope = { 985 var scope = {
896 $broadcast: function() { } 986 $broadcast: function() { },
987 $watch: function() { }
897 }; 988 };
898 989
899 $controller('cobranzaController', { 990 $controller('cobranzaController', {
900 $scope: scope, 991 $scope: scope,
901 $timeout: $timeout, 992 $timeout: $timeout,
902 $uibModal: {}, 993 $uibModal: {},
903 $location: {}, 994 $location: {},
904 focaCrearCobranzaService: { 995 focaCrearCobranzaService: {
905 getCotizacionByIdMoneda: function() { 996 getCotizacionByIdMoneda: function() {
906 return { 997 return {
907 then: function() { } 998 then: function() { }
908 }; 999 };
909 }, 1000 },
910 getBotonera: function() { }, 1001 getBotonera: function() { },
911 getNumeroRecibo: function() { 1002 getNumeroRecibo: function() {
912 return { 1003 return {
913 then: function() { } 1004 then: function() { }
914 }; 1005 };
915 } 1006 }
916 }, 1007 },
917 focaModalService: {}, 1008 focaModalService: {},
918 $filter: $filter, 1009 $filter: $filter,
919 focaSeguimientoService: {}, 1010 focaSeguimientoService: {},
920 focaBotoneraLateralService: {}, 1011 focaBotoneraLateralService: {},
921 APP: {}, 1012 APP: {},
922 focaLoginService: {} 1013 focaLoginService: {},
1014 $localStorage: true
923 }); 1015 });
924 scope.facturaTabla = [{ IPA: 1 }]; 1016 scope.cobranza = {
1017 facturas: [{ IPA: 1 }]
1018 };
925 1019
926 //act 1020 //act
927 var esperado = 1; 1021 var esperado = 1;
928 var resultado = scope.getTotalDeuda(); 1022 var resultado = scope.getTotalDeuda();
929 1023
930 //assert 1024 //assert
931 expect(resultado).toEqual(esperado); 1025 expect(resultado).toEqual(esperado);
932 }); 1026 });
933 1027
934 it('getTotalCobrado devuelve correcto', function() { 1028 it('getTotalCobrado devuelve correcto', function() {
935 1029
936 //arrange 1030 //arrange
937 var scope = { 1031 var scope = {
938 $broadcast: function() { } 1032 $broadcast: function() { },
1033 $watch: function() { }
939 }; 1034 };
940 1035
941 $controller('cobranzaController', { 1036 $controller('cobranzaController', {
942 $scope: scope, 1037 $scope: scope,
943 $timeout: $timeout, 1038 $timeout: $timeout,
944 $uibModal: {}, 1039 $uibModal: {},
945 $location: {}, 1040 $location: {},
946 focaCrearCobranzaService: { 1041 focaCrearCobranzaService: {
947 getCotizacionByIdMoneda: function() { 1042 getCotizacionByIdMoneda: function() {
948 return { 1043 return {
949 then: function() { } 1044 then: function() { }
950 }; 1045 };
951 }, 1046 },
952 getBotonera: function() { }, 1047 getBotonera: function() { },
953 getNumeroRecibo: function() { 1048 getNumeroRecibo: function() {
954 return { 1049 return {
955 then: function() { } 1050 then: function() { }
956 }; 1051 };
957 } 1052 }
958 }, 1053 },
959 focaModalService: {}, 1054 focaModalService: {},
960 $filter: $filter, 1055 $filter: $filter,
961 focaSeguimientoService: {}, 1056 focaSeguimientoService: {},
962 focaBotoneraLateralService: {}, 1057 focaBotoneraLateralService: {},
963 APP: {}, 1058 APP: {},
964 focaLoginService: {} 1059 focaLoginService: {},
1060 $localStorage: true
965 }); 1061 });
966 scope.cobrosTabla = [{ importe: 1 }]; 1062 scope.cobranza = {
1063 cobros: [{ importe: 1 }]
1064 };
967 1065
968 //act 1066 //act
969 var esperado = 1; 1067 var esperado = 1;
970 var resultado = scope.getTotalCobrado(); 1068 var resultado = scope.getTotalCobrado();
971 1069
972 //assert 1070 //assert
973 expect(resultado).toEqual(esperado); 1071 expect(resultado).toEqual(esperado);
974 }); 1072 });
975 1073
976 it('getSubTotal devuelve correcto', function() { 1074 it('getSubTotal devuelve correcto', function() {
977 1075
978 //arrange 1076 //arrange
979 var scope = { 1077 var scope = {
980 $broadcast: function() { } 1078 $broadcast: function() { },
1079 $watch: function() { }
981 }; 1080 };
982 1081
983 $controller('cobranzaController', { 1082 $controller('cobranzaController', {
984 $scope: scope, 1083 $scope: scope,
985 $timeout: $timeout, 1084 $timeout: $timeout,
986 $uibModal: {}, 1085 $uibModal: {},
987 $location: {}, 1086 $location: {},
988 focaCrearCobranzaService: { 1087 focaCrearCobranzaService: {
989 getCotizacionByIdMoneda: function() { 1088 getCotizacionByIdMoneda: function() {
990 return { 1089 return {
991 then: function() { } 1090 then: function() { }
992 }; 1091 };
993 }, 1092 },
994 getBotonera: function() { }, 1093 getBotonera: function() { },
995 getNumeroRecibo: function() { 1094 getNumeroRecibo: function() {
996 return { 1095 return {
997 then: function() { } 1096 then: function() { }
998 }; 1097 };
999 } 1098 }
1000 }, 1099 },
1001 focaModalService: {}, 1100 focaModalService: {},
1002 $filter: $filter, 1101 $filter: $filter,
1003 focaSeguimientoService: {}, 1102 focaSeguimientoService: {},
1004 focaBotoneraLateralService: {}, 1103 focaBotoneraLateralService: {},
1005 APP: {}, 1104 APP: {},
1006 focaLoginService: {} 1105 focaLoginService: {},
1106 $localStorage: true
1007 }); 1107 });
1008 scope.articuloACargar = { 1108 scope.articuloACargar = {
1009 precio: 2, 1109 precio: 2,
1010 cantidad: 5 1110 cantidad: 5
1011 }; 1111 };
1012 1112
1013 //act 1113 //act
1014 var esperado = 10; 1114 var esperado = 10;
1015 var resultado = scope.getSubTotal(); 1115 var resultado = scope.getSubTotal();
1016 1116
1017 //assert 1117 //assert
1018 expect(resultado).toEqual(esperado); 1118 expect(resultado).toEqual(esperado);
1019 }); 1119 });
1020 1120
1021 it('salir lleva a la ruta correcta', function() { 1121 it('salir lleva a la ruta correcta', function() {
1022 1122
1023 inject(function($location) { 1123 inject(function($location) {
1024 1124
1025 //arrange 1125 //arrange
1026 var scope = { 1126 var scope = {
1027 $broadcast: function() { } 1127 $broadcast: function() { },
1128 $watch: function() { }
1028 }; 1129 };
1029 1130
1030 $controller('cobranzaController', { 1131 $controller('cobranzaController', {
1031 $scope: scope, 1132 $scope: scope,
1032 $timeout: $timeout, 1133 $timeout: $timeout,
1033 $uibModal: {}, 1134 $uibModal: {},
1034 $location: $location, 1135 $location: $location,
1035 focaCrearCobranzaService: { 1136 focaCrearCobranzaService: {
1036 getCotizacionByIdMoneda: function() { 1137 getCotizacionByIdMoneda: function() {
1037 return { 1138 return {
1038 then: function() { } 1139 then: function() { }
1039 }; 1140 };
1040 }, 1141 },
1041 getBotonera: function() { }, 1142 getBotonera: function() { },
1042 getNumeroRecibo: function() { 1143 getNumeroRecibo: function() {
1043 return { 1144 return {
1044 then: function() { } 1145 then: function() { }
1045 }; 1146 };
1046 } 1147 }
1047 }, 1148 },
1048 focaModalService: {}, 1149 focaModalService: {},
1049 $filter: $filter, 1150 $filter: $filter,
1050 focaSeguimientoService: {}, 1151 focaSeguimientoService: {},
1051 focaBotoneraLateralService: {}, 1152 focaBotoneraLateralService: {},
1052 APP: {}, 1153 APP: {},
1053 focaLoginService: {} 1154 focaLoginService: {},
1155 $localStorage: true
1054 }); 1156 });
1055 1157
1056 //act 1158 //act
1057 scope.salir(); 1159 scope.salir();
1058 1160
1059 //assert 1161 //assert
1060 expect($location.url()).toEqual('/'); 1162 expect($location.url()).toEqual('/');
1061 }); 1163 });
1062 }); 1164 });
1063 1165
1064 it('parsearATexto parsea correctamente', function() { 1166 it('parsearATexto parsea correctamente', function() {
1065 1167
1066 //arrange 1168 //arrange
1067 var scope = { 1169 var scope = {
1068 $broadcast: function() { } 1170 $broadcast: function() { },
1171 $watch: function() { }
1069 }; 1172 };
1070 1173
1071 $controller('cobranzaController', { 1174 $controller('cobranzaController', {
1072 $scope: scope, 1175 $scope: scope,
1073 $timeout: $timeout, 1176 $timeout: $timeout,
1074 $uibModal: {}, 1177 $uibModal: {},
1075 $location: {}, 1178 $location: {},
1076 focaCrearCobranzaService: { 1179 focaCrearCobranzaService: {
1077 getCotizacionByIdMoneda: function() { 1180 getCotizacionByIdMoneda: function() {
1078 return { 1181 return {
1079 then: function() { } 1182 then: function() { }
1080 }; 1183 };
1081 }, 1184 },
1082 getBotonera: function() { }, 1185 getBotonera: function() { },
1083 getNumeroRecibo: function() { 1186 getNumeroRecibo: function() {
1084 return { 1187 return {
1085 then: function() { } 1188 then: function() { }
1086 }; 1189 };
1087 } 1190 }
1088 }, 1191 },
1089 focaModalService: {}, 1192 focaModalService: {},
1090 $filter: $filter, 1193 $filter: $filter,
1091 focaSeguimientoService: {}, 1194 focaSeguimientoService: {},
1092 focaBotoneraLateralService: {}, 1195 focaBotoneraLateralService: {},
1093 APP: {}, 1196 APP: {},
1094 focaLoginService: {} 1197 focaLoginService: {},
1198 $localStorage: true
1095 }); 1199 });
1096 1200
1097 var parametro = { 1201 var parametro = {
1098 cantidad: '1', 1202 cantidad: '1',
1099 precio: '2' 1203 precio: '2'
1100 }; 1204 };
1101 1205
1102 //act 1206 //act
1103 scope.parsearATexto(parametro); 1207 scope.parsearATexto(parametro);
1104 1208
1105 //assert 1209 //assert
1106 expect(typeof parametro.cantidad).toEqual('number'); 1210 expect(typeof parametro.cantidad).toEqual('number');
1107 expect(typeof parametro.precio).toEqual('number'); 1211 expect(typeof parametro.precio).toEqual('number');
1108 }); 1212 });
1109 1213
1110 }); 1214 });
1111 }); 1215 });
src/js/controller.js
1 angular.module('focaCrearCobranza') .controller('cobranzaController', 1 angular.module('focaCrearCobranza') .controller('cobranzaController',
2 [ 2 [
3 '$scope', '$timeout', '$uibModal', '$location', 3 '$scope', '$timeout', '$uibModal', '$location',
4 'focaCrearCobranzaService', 'focaModalService', '$filter', 'focaSeguimientoService', 4 'focaCrearCobranzaService', 'focaModalService', '$filter', 'focaSeguimientoService',
5 'focaBotoneraLateralService', 'APP', 'focaLoginService', 5 'focaBotoneraLateralService', 'APP', 'focaLoginService', '$localStorage',
6 function($scope, $timeout, $uibModal, $location, focaCrearCobranzaService, 6 function($scope, $timeout, $uibModal, $location, focaCrearCobranzaService,
7 focaModalService, $filter, focaSeguimientoService, focaBotoneraLateralService, 7 focaModalService, $filter, focaSeguimientoService, focaBotoneraLateralService,
8 APP, loginService) 8 APP, loginService, $localStorage)
9 { 9 {
10 config(); 10 config();
11 11
12 function config() { 12 function config() {
13 $scope.datepickerAbierto = false; 13 $scope.datepickerAbierto = false;
14 $scope.cobroDeuda = true; 14 $scope.cobroDeuda = true;
15 $scope.show = false; 15 $scope.show = false;
16 $scope.cargando = true; 16 $scope.cargando = true;
17 $scope.fecha = new Date();
18 $scope.puntoVenta = $filter('rellenarDigitos')(0, 4); 17 $scope.puntoVenta = $filter('rellenarDigitos')(0, 4);
19 $scope.comprobante = $filter('rellenarDigitos')(0, 8); 18 $scope.comprobante = $filter('rellenarDigitos')(0, 8);
20 19
21 $scope.dateOptions = { 20 $scope.dateOptions = {
22 maxDate: new Date(), 21 maxDate: new Date(),
23 minDate: new Date(2010, 0, 1) 22 minDate: new Date(2010, 0, 1)
24 }; 23 };
25 24
26 var monedaPorDefecto; 25 var monedaPorDefecto;
27 //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' 26 //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]'
28 focaCrearCobranzaService.getCotizacionByIdMoneda(1).then(function(res) { 27 focaCrearCobranzaService.getCotizacionByIdMoneda(1).then(function(res) {
29 monedaPorDefecto = res.data[0]; 28 monedaPorDefecto = res.data[0];
30 29
31 $scope.cobranza.moneda = monedaPorDefecto; 30 $scope.cobranza.cotizacion = Object.assign(
32 $scope.inicial.cobranza.moneda = $scope.cobranza.moneda; 31 {moneda: monedaPorDefecto}, monedaPorDefecto.cotizaciones[0]
32 );
33 $scope.inicial.cotizacion = $scope.cobranza.cotizacion;
33 34
34 $scope.cobranza.cotizacion = monedaPorDefecto.cotizaciones[0];
35 $scope.inicial.cobranza.cotizacion = $scope.cobranza.cotizacion;
36 }); 35 });
37 36
38 $timeout(function() { 37 $timeout(function() {
39 focaBotoneraLateralService.showSalir(false); 38 focaBotoneraLateralService.showSalir(false);
40 focaBotoneraLateralService.showPausar(true); 39 focaBotoneraLateralService.showPausar(true);
41 focaBotoneraLateralService.showGuardar(true, $scope.crearCobranza); 40 focaBotoneraLateralService.showGuardar(true, $scope.crearCobranza);
42 focaBotoneraLateralService.addCustomButton('Salir', salir); 41 focaBotoneraLateralService.addCustomButton('Salir', salir);
43 }); 42 });
44 43
45 if (APP === 'cobranza') { 44 if (APP === 'cobranza') {
46 $scope.idCobrador = loginService.getLoginData().vendedorCobrador; 45 $scope.idCobrador = loginService.getLoginData().vendedorCobrador;
47 $scope.botonera = focaCrearCobranzaService.getBotonera($scope.idCobrador); 46 $scope.botonera = focaCrearCobranzaService.getBotonera($scope.idCobrador);
48 } else { 47 } else {
49 $scope.botonera = focaCrearCobranzaService.getBotonera(); 48 $scope.botonera = focaCrearCobranzaService.getBotonera();
50 } 49 }
51 50
52 init(); 51 init();
52 $timeout(function() {getLSCobranza();});
53 } 53 }
54 54
55 function init() { 55 function init() {
56 $scope.$broadcast('cleanCabecera'); 56 $scope.$broadcast('cleanCabecera');
57 57 $scope.cobranza = {
58 $scope.cobranza = {}; 58 fecha: new Date(),
59 $scope.facturaTabla = []; 59 cotizacion: {},
60 $scope.cobrosTabla = []; 60 facturas: [],
61 61 cobros: [],
62 cliente: {},
63 cobrador: {}
64 };
62 if (APP === 'cobranza') { 65 if (APP === 'cobranza') {
63 focaCrearCobranzaService.getCobradorById($scope.idCobrador).then( 66 focaCrearCobranzaService.getCobradorById($scope.idCobrador).then(
64 function(res) { 67 function(res) {
65 var cobrador = res.data; 68 var cobrador = res.data;
66 69
67 $scope.$broadcast('addCabecera', { 70 $scope.$broadcast('addCabecera', {
68 label: 'Cobrador:', 71 label: 'Cobrador:',
69 valor: $filter('rellenarDigitos')(cobrador.NUM, 3) + ' - ' + 72 valor: $filter('rellenarDigitos')(cobrador.NUM, 3) + ' - ' +
70 cobrador.NOM 73 cobrador.NOM
71 }); 74 });
72 75
73 $scope.cobranza.cobrador = cobrador; 76 $scope.cobranza.cobrador = cobrador;
74 $scope.inicial.cobranza.cobrador = $scope.cobranza.cobrador; 77 $scope.inicial.cobranza.cobrador = $scope.cobranza.cobrador;
75 } 78 }
76 ); 79 );
77 } 80 }
78 81
79 $scope.inicial = { 82 $scope.inicial = angular.copy($scope.cobranza);
80 cobranza: angular.copy($scope.cobranza),
81 facturaTabla: angular.copy($scope.facturaTabla),
82 cobrosTabla: angular.copy($scope.cobrosTabla)
83 };
84 83
85 focaCrearCobranzaService.getNumeroRecibo().then( 84 focaCrearCobranzaService.getNumeroRecibo().then(
86 function(res) { 85 function(res) {
87 $scope.puntoVenta = $filter('rellenarDigitos')( 86 $scope.puntoVenta = $filter('rellenarDigitos')(
88 res.data.sucursal, 4 87 res.data.sucursal, 4
89 ); 88 );
90 89
91 $scope.comprobante = $filter('rellenarDigitos')( 90 $scope.comprobante = $filter('rellenarDigitos')(
92 res.data.numeroRecibo, 8 91 res.data.numeroRecibo, 8
93 ); 92 );
94 }, 93 },
95 function(err) { 94 function(err) {
96 focaModalService.alert( 95 focaModalService.alert(
97 'La terminal no esta configurada correctamente' 96 'La terminal no esta configurada correctamente'
98 ); 97 );
99 console.info(err); 98 console.info(err);
100 } 99 }
101 ); 100 );
102 } 101 }
103 102
103 $scope.$watch('cobranza', function(newValue) {
104 focaBotoneraLateralService.setPausarData({
105 label: 'cobranza',
106 val: newValue
107 });
108 }, true);
109
104 $scope.crearCobranza = function() { 110 $scope.crearCobranza = function() {
105 if(!$scope.cobranza.cliente) { 111 if (!$scope.cobranza.cliente.COD) {
106 focaModalService.alert('Ingrese Cliente'); 112 focaModalService.alert('Ingrese Cliente');
107 return; 113 return;
108 } 114 }
109 if(!$scope.cobranza.cobrador) { 115 if (!$scope.cobranza.cobrador.NUM) {
110 focaModalService.alert('Ingrese Cobrador'); 116 focaModalService.alert('Ingrese Cobrador');
111 return; 117 return;
112 } 118 }
113 if($scope.facturaTabla.length < 1) { 119 if ($scope.cobranza.facturas.length < 1) {
114 focaModalService.alert('Ingrese al menos una factura'); 120 focaModalService.alert('Ingrese al menos una factura');
115 return; 121 return;
116 } 122 }
117 if($scope.getTotalCobrado() + $scope.getTotalDeuda() !== 0) { 123 if ($scope.getTotalCobrado() + $scope.getTotalDeuda() !== 0) {
118 focaModalService.alert('La diferencia debe ser ' + 124 focaModalService.alert('La diferencia debe ser ' +
119 $scope.cobranza.moneda.SIMBOLO + '0,00'); 125 $scope.cobranza.cotizacion.moneda.SIMBOLO + '0,00');
120 return; 126 return;
121 } 127 }
122 128
123 var cobranza = {}; 129 var cobranza = {};
124 var cheques = []; 130 var cheques = [];
125 var cuerpos = []; 131 var cuerpos = [];
126 var imgs = []; 132 var imgs = [];
127 var observacion; 133 var observacion;
128 //TODO: habilitar edición 134 //TODO: habilitar edición
129 $scope.editando = false; 135 $scope.editando = false;
130 focaBotoneraLateralService.startGuardar(); 136 focaBotoneraLateralService.startGuardar();
131 $scope.saveLoading = true; 137 $scope.saveLoading = true;
132 for(var i = 0; i < $scope.facturaTabla.length; i++) { 138 for(var i = 0; i < $scope.cobranza.facturas.length; i++) {
133 var cuerpoFactura = { 139 var cuerpoFactura = {
134 CYV: 'V', 140 CYV: 'V',
135 TIP: 'C', 141 TIP: 'C',
136 TCO: 'RC', 142 TCO: 'RC',
137 PVE: $scope.puntoVenta, 143 PVE: $scope.puntoVenta,
138 NCO: $scope.comprobante, 144 NCO: $scope.comprobante,
139 LOP: 'L', 145 LOP: 'L',
140 TIL: $scope.facturaTabla[i].TCO, 146 TIL: $scope.cobranza.facturas[i].TCO,
141 COM: $scope.facturaTabla[i].numeroFactura + '-' + 147 COM: $scope.cobranza.facturas[i].numeroFactura + '-' +
142 $filter('rellenarDigitos')($scope.facturaTabla[i].NCU,2), 148 $filter('rellenarDigitos')($scope.cobranza.facturas[i].NCU,2),
143 FEC: $scope.fecha.toISOString().slice(0, 19).replace('T', ' '), 149 FEC: new Date($scope.cobranza.fecha)
144 IMP: Math.abs($scope.facturaTabla[i].IPA), 150 .toISOString().slice(0, 19).replace('T', ' '),
151 IMP: Math.abs($scope.cobranza.facturas[i].IPA),
145 RES: 0,//caja de tesorería 152 RES: 0,//caja de tesorería
146 SUBM: 0, 153 SUBM: 0,
147 NCU: $scope.facturaTabla[i].NCU 154 NCU: $scope.cobranza.facturas[i].NCU
148 }; 155 };
149 cuerpos.push(cuerpoFactura); 156 cuerpos.push(cuerpoFactura);
150 157
151 } 158 }
152 159
153 for (var j = 0; j < $scope.cobrosTabla.length; j++) { 160 for (var j = 0; j < $scope.cobranza.cobros.length; j++) {
154 161
155 var efectivo = $scope.cobrosTabla[j].tipo === 'Efectivo'; 162 var efectivo = $scope.cobranza.cobros[j].tipo === 'Efectivo';
156 var cuerpoCobros = { 163 var cuerpoCobros = {
157 CYV: 'V', 164 CYV: 'V',
158 TIP: 'C', 165 TIP: 'C',
159 TCO: 'RC', 166 TCO: 'RC',
160 PVE: $scope.puntoVenta, 167 PVE: $scope.puntoVenta,
161 NCO: $scope.comprobante, 168 NCO: $scope.comprobante,
162 LOP: 'P', 169 LOP: 'P',
163 TIL: $scope.cobrosTabla[j].til, 170 TIL: $scope.cobranza.cobros[j].til,
164 COM: efectivo ? 'ef(COBRO EN EFECTIVO)' : $scope.cobrosTabla[j].tipo, 171 COM: efectivo ? 'ef(COBRO EN EFECTIVO)' : $scope.cobranza.cobros[j].tipo,
165 FEC: !$scope.cobrosTabla[j].fechaPresentacion ? 172 FEC: !$scope.cobranza.cobros[j].fechaPresentacion ?
166 $scope.cobrosTabla[j].fecha 173 new Date($scope.cobranza.cobros[j].fecha)
167 .toISOString().slice(0, 19).replace('T', ' ') : 174 .toISOString().slice(0, 19).replace('T', ' ') :
168 $scope.cobrosTabla[j].fechaPresentacion 175 new Date($scope.cobranza.cobros[j].fechaPresentacion)
169 .toISOString().slice(0, 19).replace('T', ' '), 176 .toISOString().slice(0, 19).replace('T', ' '),
170 IMP: Math.abs($scope.cobrosTabla[j].importe), 177 IMP: Math.abs($scope.cobranza.cobros[j].importe),
171 RES: 0,//caja de tesorería 178 RES: 0,//caja de tesorería
172 SUBM: 0 179 SUBM: 0
173 }; 180 };
174 cuerpos.push(cuerpoCobros); 181 cuerpos.push(cuerpoCobros);
175 182
176 if($scope.cobrosTabla[j].observacion) 183 if ($scope.cobranza.cobros[j].observacion)
177 observacion = $scope.cobrosTabla[j].observacion; 184 observacion = $scope.cobranza.cobros[j].observacion;
178 185
179 if($scope.cobrosTabla[j].banco) { 186 if ($scope.cobranza.cobros[j].banco) {
180 var cheque = { 187 var cheque = {
181 BCO: $scope.cobrosTabla[j].banco.ID, 188 BCO: $scope.cobranza.cobros[j].banco.ID,
182 NUM: $scope.comprobante, 189 NUM: $scope.comprobante,
183 FEP: $scope.cobrosTabla[j].fechaPresentacion 190 FEP: new Date($scope.cobranza.cobros[j].fechaPresentacion)
184 .toISOString().slice(0, 19).replace('T', ' '), 191 .toISOString().slice(0, 19).replace('T', ' '),
185 FEE: $scope.cobrosTabla[j].fechaEmision 192 FEE: new Date($scope.cobranza.cobros[j].fechaEmision)
186 .toISOString().slice(0, 19).replace('T', ' '), 193 .toISOString().slice(0, 19).replace('T', ' '),
187 LUG: $scope.cobrosTabla[j].localidad.NOMBRE, 194 LUG: $scope.cobranza.cobros[j].localidad.NOMBRE,
188 IMP: $scope.cobrosTabla[j].importe, 195 IMP: $scope.cobranza.cobros[j].importe,
189 LIB: $scope.cobrosTabla[j].librador, 196 LIB: $scope.cobranza.cobros[j].librador,
190 EST: 'C',//'D' depositado, 'E' entregado, 'C' en cartera 197 EST: 'C',//'D' depositado, 'E' entregado, 'C' en cartera
191 PCI: $scope.cobrosTabla[j].provincia.ID, 198 PCI: $scope.cobranza.cobros[j].provincia.ID,
192 LPLA: 0, 199 LPLA: 0,
193 PLA: 0, 200 PLA: 0,
194 VEN: $scope.cobranza.cobrador.id,//Id vendedor 201 VEN: $scope.cobranza.cobrador.id,//Id vendedor
195 CCLIE: $scope.cobranza.cliente.COD,//Id cliente 202 CCLIE: $scope.cobranza.cliente.COD,//Id cliente
196 REN: 0, 203 REN: 0,
197 PVEC: $scope.puntoVenta, 204 PVEC: $scope.puntoVenta,
198 NCOC: $scope.comprobante, 205 NCOC: $scope.comprobante,
199 OBSE: $scope.cobrosTabla[j].observaciones, 206 OBSE: $scope.cobranza.cobros[j].observaciones,
200 LUV: 0, 207 LUV: 0,
201 ORI: 've', 208 ORI: 've',
202 FER: '', 209 FER: '',
203 BIMP: 0, 210 BIMP: 0,
204 COMP: 'C ' +'RC ' + $scope.puntoVenta + '-' + $scope.comprobante, 211 COMP: 'C ' +'RC ' + $scope.puntoVenta + '-' + $scope.comprobante,
205 VAL_E: '',//Cuando egresa por ingresos y egresos en el numero de egreso 212 VAL_E: '',//Cuando egresa por ingresos y egresos en el numero de egreso
206 VAL_I: '',//Cuando Ingresa por ingresos y egresos en el numero ingreso 213 VAL_I: '',//Cuando Ingresa por ingresos y egresos en el numero ingreso
207 REC_CAJ: 'D', 214 REC_CAJ: 'D',
208 TIPO_C: 0,//?? 215 TIPO_C: 0,//??
209 SALDO_CAJ: 'S', 216 SALDO_CAJ: 'S',
210 FECHA_INGRESO: $scope.fecha 217 FECHA_INGRESO: new Date($scope.cobranza.fecha)
211 .toISOString().slice(0, 19).replace('T', ' '), 218 .toISOString().slice(0, 19).replace('T', ' '),
212 Vendedor_valor: 0, 219 Vendedor_valor: 0,
213 FAMILIA: 0, 220 FAMILIA: 0,
214 CUIT_LIB: '', 221 CUIT_LIB: '',
215 COD_LUG: $scope.cobrosTabla[j].localidad.ID,//código lugar 222 COD_LUG: $scope.cobranza.cobros[j].localidad.ID,//código lugar
216 SEN: '', 223 SEN: '',
217 NRC: 0, 224 NRC: 0,
218 COD_LARGO: '', 225 COD_LARGO: '',
219 VN: 0, 226 VN: 0,
220 ID_LECTOR: 0, 227 ID_LECTOR: 0,
221 NATHB: '' 228 NATHB: ''
222 }; 229 };
223 cheques.push(cheque); 230 cheques.push(cheque);
224 } 231 }
225 if ($scope.cobrosTabla[j].imgs) imgs = $scope.cobrosTabla[j].imgs; 232 if ($scope.cobranza.cobros[j].imgs) imgs = $scope.cobranza.cobros[j].imgs;
226 233
227 } 234 }
228 235
229 cobranza = { 236 cobranza = {
230 recibo: { 237 recibo: {
231 CYV: 'V', 238 CYV: 'V',
232 TIP: 'C', 239 TIP: 'C',
233 TCO: 'RC', 240 TCO: 'RC',
234 PVE: $scope.puntoVenta, //Sucursar, punto de venta 241 PVE: $scope.puntoVenta, //Sucursar, punto de venta
235 NCO: $scope.comprobante, //Numero de comprobante 242 NCO: $scope.comprobante, //Numero de comprobante
236 FEC: $scope.fecha.toISOString().slice(0, 19).replace('T', ' '), 243 FEC: new Date($scope.cobranza.fecha)
244 .toISOString().slice(0, 19).replace('T', ' '),
237 CLI: $scope.cobranza.cliente.COD, 245 CLI: $scope.cobranza.cliente.COD,
238 ATO: 0, //número de asiento 246 ATO: 0, //número de asiento
239 CFE: $scope.cobranza.cobrador.NOM, 247 CFE: $scope.cobranza.cobrador.NOM,
240 PLA: '',//Numero de planilla, sin uso 248 PLA: '',//Numero de planilla, sin uso
241 ID_MONEDA: $scope.cobranza.moneda.ID, 249 ID_MONEDA: $scope.cobranza.cotizacion.moneda.ID,
242 COTIZACION: $scope.cobranza.cotizacion.VENDEDOR, 250 COTIZACION: $scope.cobranza.cotizacion.VENDEDOR,
243 idCobrador: $scope.cobranza.cobrador.id 251 idCobrador: $scope.cobranza.cobrador.id
244 }, 252 },
245 cuerpo: cuerpos, 253 cuerpo: cuerpos,
246 cheques: cheques, 254 cheques: cheques,
247 acobypag: { 255 acobypag: {
248 CYV: 'V', 256 CYV: 'V',
249 COD: $scope.cobranza.cliente.COD, 257 COD: $scope.cobranza.cliente.COD,
250 FEP: $scope.fecha.toISOString().slice(0, 19).replace('T', ' '), 258 FEP: new Date($scope.cobranza.fecha)
259 .toISOString().slice(0, 19).replace('T', ' '),
251 TIP: 'C', 260 TIP: 'C',
252 TCO: 'RC', 261 TCO: 'RC',
253 SUC: $scope.puntoVenta, 262 SUC: $scope.puntoVenta,
254 NCO: $scope.comprobante, 263 NCO: $scope.comprobante,
255 IPA: $scope.getTotalCobrado(), 264 IPA: $scope.getTotalCobrado(),
256 SAL: '',//?? 265 SAL: '',//??
257 TCA: 1, 266 TCA: 1,
258 ZONA: 1, 267 ZONA: 1,
259 FPA: 2,//Forma de pago 268 FPA: 2,//Forma de pago
260 REC: 0, 269 REC: 0,
261 REP: 0, 270 REP: 0,
262 FER: null, 271 FER: null,
263 REM: 0, 272 REM: 0,
264 FRE: null,//?? 273 FRE: null,//??
265 PRO: 'N', 274 PRO: 'N',
266 FEV: $scope.fecha.toISOString().slice(0, 19).replace('T', ' ') 275 FEV: new Date($scope.cobranza.fecha)
276 .toISOString().slice(0, 19).replace('T', ' ')
267 }, 277 },
268 datosCobrador: { 278 datosCobrador: {
269 COD: $scope.cobranza.cobrador.NUM, 279 COD: $scope.cobranza.cobrador.NUM,
270 PVE: $scope.puntoVenta, 280 PVE: $scope.puntoVenta,
271 NUM: $scope.comprobante, 281 NUM: $scope.comprobante,
272 EST: 'C', 282 EST: 'C',
273 OBS: 'RC: ' + $scope.comprobante + '-' + $scope.fecha.toLocaleDateString(), 283 OBS: 'RC: ' + $scope.comprobante + '-' +
284 new Date($scope.cobranza.fecha).toLocaleDateString(),
274 DAT1: 'C', 285 DAT1: 'C',
275 CLI: $scope.cobranza.cliente.COD 286 CLI: $scope.cobranza.cliente.COD
276 }, 287 },
277 cliente: $scope.cobranza.cliente, 288 cliente: $scope.cobranza.cliente,
278 imgs: imgs, 289 imgs: imgs,
279 observacion: observacion 290 observacion: observacion
280 }; 291 };
281 //COPIO cobranzaMail Y A cobranza LE ELIMINO EL VALOR NCU DE LOS CUERPOS 292 //COPIO cobranzaMail Y A cobranza LE ELIMINO EL VALOR NCU DE LOS CUERPOS
282 var cobranzaMail = angular.copy(cobranza); 293 var cobranzaMail = angular.copy(cobranza);
283 cobranza.cuerpo = cobranza.cuerpo.map(function(c) { 294 cobranza.cuerpo = cobranza.cuerpo.map(function(c) {
284 if (c.NCU) delete c.NCU; 295 if (c.NCU) delete c.NCU;
285 return c; 296 return c;
286 }); 297 });
287 298
288 focaCrearCobranzaService 299 focaCrearCobranzaService
289 .guardarCobranza(cobranza) 300 .guardarCobranza(cobranza)
290 .then( 301 .then(
291 function(result) { 302 function(result) {
292 var cliente = angular.copy($scope.cobranza.cliente); 303 var cliente = angular.copy($scope.cobranza.cliente);
293 focaBotoneraLateralService.endGuardar(true); 304 focaBotoneraLateralService.endGuardar(true);
294 $scope.saveLoading = false; 305 $scope.saveLoading = false;
295 306
296 focaModalService 307 focaModalService
297 .prompt('Ingrese los emails separados por coma para enviar comprobante', 308 .prompt('Ingrese los emails separados por coma para enviar comprobante',
298 cliente.MAIL) 309 cliente.MAIL)
299 .then(function(res) { 310 .then(function(res) {
300 return Promise.all([ 311 return Promise.all([
301 focaCrearCobranzaService 312 focaCrearCobranzaService
302 .enviarComprobantePorMail(res, cobranzaMail), 313 .enviarComprobantePorMail(res, cobranzaMail),
303 focaCrearCobranzaService 314 focaCrearCobranzaService
304 .actualizarEmail(res, cliente.COD) 315 .actualizarEmail(res, cliente.COD)
305 ]); 316 ]);
306 }) 317 })
307 .then(function() { 318 .then(function() {
308 focaModalService.alert('Mensaje enviado correctamente'); 319 focaModalService.alert('Mensaje enviado correctamente');
309 }); 320 });
310 321
311 focaSeguimientoService.guardarPosicion( 322 focaSeguimientoService.guardarPosicion(
312 'Cobranza', 323 'Cobranza',
313 result.data, 324 result.data,
314 '' 325 ''
315 ); 326 );
316 327
317 init(); 328 init();
318 }, function(error) { 329 }, function(error) {
319 focaModalService.alert('Hubo un problema al cargar la cobranza'); 330 focaModalService.alert('Hubo un problema al cargar la cobranza');
320 focaBotoneraLateralService.endGuardar(); 331 focaBotoneraLateralService.endGuardar();
321 $scope.saveLoading = false; 332 $scope.saveLoading = false;
322 console.info(error); 333 console.info(error);
323 } 334 }
324 ); 335 );
325 }; 336 };
326 337
327 $scope.seleccionarCobros = function() { 338 $scope.seleccionarCobros = function() {
328 $scope.cobroDeuda = false; 339 $scope.cobroDeuda = false;
329 }; 340 };
330 341
331 $scope.seleccionarComprobantes = function() { 342 $scope.seleccionarComprobantes = function() {
332 $scope.cobroDeuda = true; 343 $scope.cobroDeuda = true;
333 }; 344 };
334 345
335 $scope.seleccionarCobranza = function() { 346 $scope.seleccionarCobranza = function() {
336 347
337 var modalInstance = $uibModal.open( 348 var modalInstance = $uibModal.open(
338 { 349 {
339 ariaLabelledBy: 'Busqueda de Cobranzas', 350 ariaLabelledBy: 'Busqueda de Cobranzas',
340 templateUrl: 'foca-modal-cobranza.html', 351 templateUrl: 'foca-modal-cobranza.html',
341 controller: 'focaModalCobranzaController', 352 controller: 'focaModalCobranzaController',
342 size: 'lg' 353 size: 'lg'
343 } 354 }
344 ); 355 );
345 modalInstance.result.then(function(cobranza) { 356 modalInstance.result.then(setearCobranza);
346 $scope.editando = true;
347 $scope.facturaTabla = [];
348 $scope.cobrosTabla = [];
349 $scope.$broadcast('cleanCabecera');
350
351 $scope.fecha = new Date(cobranza.fecha);
352
353 $scope.$broadcast('addCabecera', {
354 label: 'Cliente:',
355 valor: $filter('rellenarDigitos')(cobranza.cliente.COD, 5) + ' - ' +
356 cobranza.cliente.NOM
357 });
358 $scope.$broadcast('addCabecera', {
359 label: 'Cobrador:',
360 valor: cobranza.cobrador
361 //TODO: hacer la relación y traer el cobrador para poner su código
362 // valor: $filter('rellenarDigitos')(cobranza.cobrador.CodVen, 5) + ' - ' +
363 // cobranza.cobrador
364 });
365
366 $scope.facturaTabla = cobranza.facturas;
367 $scope.cobrosTabla = cobranza.cobros;
368 });
369 }; 357 };
370 358
371 $scope.seleccionarCliente = function() { 359 $scope.seleccionarCliente = function() {
372 if(!$scope.cobranza.cobrador) { 360 if(!$scope.cobranza.cobrador) {
373 focaModalService.alert('Ingrese primero cobrador'); 361 focaModalService.alert('Ingrese primero cobrador');
374 return; 362 return;
375 } 363 }
376 var modalInstance = $uibModal.open( 364 var modalInstance = $uibModal.open(
377 { 365 {
378 ariaLabelledBy: 'Busqueda de Cliente', 366 ariaLabelledBy: 'Busqueda de Cliente',
379 templateUrl: 'foca-busqueda-cliente-modal.html', 367 templateUrl: 'foca-busqueda-cliente-modal.html',
380 controller: 'focaBusquedaClienteModalController', 368 controller: 'focaBusquedaClienteModalController',
381 resolve: { 369 resolve: {
382 vendedor: function() { return null; } 370 vendedor: function() { return null; }
383 }, 371 },
384 size: 'lg' 372 size: 'lg'
385 } 373 }
386 ); 374 );
387 modalInstance.result.then( 375 modalInstance.result.then(
388 function(cliente) { 376 function(cliente) {
389 var clienteMayus = { 377 var clienteMayus = {
390 COD: cliente.cod, 378 COD: cliente.cod,
391 NOM: cliente.nom, 379 NOM: cliente.nom,
392 CUIT: cliente.cuit 380 CUIT: cliente.cuit
393 }; 381 };
394 382
395 $scope.$broadcast('addCabecera', { 383 $scope.$broadcast('addCabecera', {
396 label: 'Cliente:', 384 label: 'Cliente:',
397 valor: $filter('rellenarDigitos')(clienteMayus.COD, 5) + ' - ' + 385 valor: $filter('rellenarDigitos')(clienteMayus.COD, 5) + ' - ' +
398 clienteMayus.NOM 386 clienteMayus.NOM
399 }); 387 });
400 $scope.cobranza.cliente = clienteMayus; 388 $scope.cobranza.cliente = clienteMayus;
401 } 389 }
402 ); 390 );
403 }; 391 };
404 392
405 $scope.seleccionarFactura = function() { 393 $scope.seleccionarFactura = function() {
406 if(!$scope.cobranza.cliente) { 394 if (!$scope.cobranza.cliente.COD) {
407 focaModalService.alert('Seleccione primero un cliente'); 395 focaModalService.alert('Seleccione primero un cliente');
408 return; 396 return;
409 } 397 }
410 var modalInstance = $uibModal.open( 398 var modalInstance = $uibModal.open(
411 { 399 {
412 ariaLabelledBy: 'Busqueda de Facturas', 400 ariaLabelledBy: 'Busqueda de Facturas',
413 templateUrl: 'foca-modal-factura.html', 401 templateUrl: 'foca-modal-factura.html',
414 controller: 'focaModalFacturaController', 402 controller: 'focaModalFacturaController',
415 size: 'lg', 403 size: 'lg',
416 resolve: { 404 resolve: {
417 parametrosFactura: function() { 405 parametrosFactura: function() {
418 return { 406 return {
419 cliente: $scope.cobranza.cliente, 407 cliente: $scope.cobranza.cliente,
420 simbolo: $scope.cobranza.moneda.SIMBOLO, 408 simbolo: $scope.cobranza.cotizacion.moneda.SIMBOLO,
421 cotizacion: $scope.cobranza.cotizacion.VENDEDOR, 409 cotizacion: $scope.cobranza.cotizacion.VENDEDOR,
422 moneda: $scope.cobranza.moneda.ID 410 moneda: $scope.cobranza.cotizacion.moneda.ID
423 }; 411 };
424 } 412 }
425 } 413 }
426 } 414 }
427 ); 415 );
428 modalInstance.result.then( 416 modalInstance.result.then(
429 function(facturas) { 417 function(facturas) {
430 $scope.facturaTabla = $scope.facturaTabla.concat(facturas); 418 $scope.cobranza.facturas = $scope.cobranza.facturas.concat(facturas);
431 }, function() { 419 }, function() {
432 420
433 } 421 }
434 ); 422 );
435 }; 423 };
436 424
437 $scope.seleccionarCheque = function() { 425 $scope.seleccionarCheque = function() {
438 var modalInstance = $uibModal.open( 426 var modalInstance = $uibModal.open(
439 { 427 {
440 ariaLabelledBy: 'Carga de cheques', 428 ariaLabelledBy: 'Carga de cheques',
441 templateUrl: 'modal-cheque.html', 429 templateUrl: 'modal-cheque.html',
442 controller: 'focaModalChequeController', 430 controller: 'focaModalChequeController',
443 size: 'lg', 431 size: 'lg',
444 resolve: { 432 resolve: {
445 sugerido: function() { 433 sugerido: function() {
446 var sugerido = $scope.getTotalDeuda() + $scope.getTotalCobrado(); 434 var sugerido = $scope.getTotalDeuda() + $scope.getTotalCobrado();
447 return sugerido < 0 ? sugerido : null; 435 return sugerido < 0 ? sugerido : null;
448 } 436 }
449 } 437 }
450 } 438 }
451 ); 439 );
452 modalInstance.result.then( 440 modalInstance.result.then(
453 function(cheque) { 441 function(cheque) {
454 var cobro = { 442 var cobro = {
455 tipo: 'ch' + '(' + cheque.numero + ')' + ' ' + cheque.banco.desbco, 443 tipo: 'ch' + '(' + cheque.numero + ')' + ' ' + cheque.banco.desbco,
456 numero: cheque.numero, 444 numero: cheque.numero,
457 banco: cheque.banco, 445 banco: cheque.banco,
458 fecha: cheque.fechaEmision.toLocaleDateString() + '-' + 446 fecha: cheque.fechaEmision.toLocaleDateString() + '-' +
459 cheque.fechaPresentacion.toLocaleDateString(), 447 cheque.fechaPresentacion.toLocaleDateString(),
460 fechaPresentacion: cheque.fechaPresentacion, 448 fechaPresentacion: cheque.fechaPresentacion,
461 fechaEmision: cheque.fechaEmision, 449 fechaEmision: cheque.fechaEmision,
462 importe: cheque.importe * $scope.cobranza.cotizacion.VENDEDOR, 450 importe: cheque.importe * $scope.cobranza.cotizacion.VENDEDOR,
463 localidad: cheque.localidad, 451 localidad: cheque.localidad,
464 librador: cheque.librador, 452 librador: cheque.librador,
465 provincia: cheque.provincia, 453 provincia: cheque.provincia,
466 observaciones: cheque.observaciones, 454 observaciones: cheque.observaciones,
467 til: 'EF' 455 til: 'EF'
468 }; 456 };
469 $scope.cobrosTabla.push(cobro); 457 $scope.cobranza.cobros.push(cobro);
470 }, function() { 458 }, function() {
471 459
472 } 460 }
473 ); 461 );
474 }; 462 };
475 463
476 $scope.seleccionarEfectivo = function() { 464 $scope.seleccionarEfectivo = function() {
477 var modalInstance = $uibModal.open( 465 var modalInstance = $uibModal.open(
478 { 466 {
479 ariaLabelledBy: 'Carga de cheques', 467 ariaLabelledBy: 'Carga de cheques',
480 templateUrl: 'modal-efectivo.html', 468 templateUrl: 'modal-efectivo.html',
481 controller: 'focaModalEfectivoController', 469 controller: 'focaModalEfectivoController',
482 size: 'sm', 470 size: 'sm',
483 resolve: { 471 resolve: {
484 sugerido: function() { 472 sugerido: function() {
485 var sugerido = $scope.getTotalDeuda() + $scope.getTotalCobrado(); 473 var sugerido = $scope.getTotalDeuda() + $scope.getTotalCobrado();
486 return sugerido < 0 ? sugerido : null; 474 return sugerido < 0 ? sugerido : null;
487 } 475 }
488 } 476 }
489 } 477 }
490 ); 478 );
491 modalInstance.result.then( 479 modalInstance.result.then(
492 function(efectivo) { 480 function(efectivo) {
493 var cobro = { 481 var cobro = {
494 tipo: 'Efectivo', 482 tipo: 'Efectivo',
495 fecha: new Date(), 483 fecha: new Date(),
496 importe: efectivo * $scope.cobranza.cotizacion.VENDEDOR, 484 importe: efectivo * $scope.cobranza.cotizacion.VENDEDOR,
497 til: 'EF' 485 til: 'EF'
498 }; 486 };
499 $scope.cobrosTabla = $scope.cobrosTabla.filter(function(a) { 487 $scope.cobranza.cobros = $scope.cobranza.cobros.filter(function(a) {
500 return a.tipo !== 'Efectivo'; 488 return a.tipo !== 'Efectivo';
501 }); 489 });
502 $scope.cobrosTabla.push(cobro); 490 $scope.cobranza.cobros.push(cobro);
503 }, function() { 491 }, function() {
504 492
505 } 493 }
506 ); 494 );
507 }; 495 };
508 496
509 $scope.seleccionarDetalles = function() { 497 $scope.seleccionarDetalles = function() {
510 var modalInstance = $uibModal.open( 498 var modalInstance = $uibModal.open(
511 { 499 {
512 ariaLabelledBy: 'Carga de detalles', 500 ariaLabelledBy: 'Carga de detalles',
513 templateUrl: 'modal-detalles.html', 501 templateUrl: 'modal-detalles.html',
514 controller: 'focaModalDetallesController', 502 controller: 'focaModalDetallesController',
515 size: 'lg', 503 size: 'lg',
516 resolve: { 504 resolve: {
517 sugerido: function() { 505 sugerido: function() {
518 var sugerido = $scope.getTotalDeuda() + $scope.getTotalCobrado(); 506 var sugerido = $scope.getTotalDeuda() + $scope.getTotalCobrado();
519 return sugerido < 0 ? sugerido : null; 507 return sugerido < 0 ? sugerido : null;
520 } 508 }
521 } 509 }
522 } 510 }
523 ); 511 );
524 modalInstance.result.then( 512 modalInstance.result.then(
525 function(detalles) { 513 function(detalles) {
526 var cobro = { 514 var cobro = {
527 tipo: 'de(COBRO POR DETALLES)', 515 tipo: 'de(COBRO POR DETALLES)',
528 fecha: new Date(), 516 fecha: new Date(),
529 importe: detalles.monto * $scope.cobranza.cotizacion.VENDEDOR, 517 importe: detalles.monto * $scope.cobranza.cotizacion.VENDEDOR,
530 imgs: detalles.imgs, 518 imgs: detalles.imgs,
531 til: 'DE', 519 til: 'DE',
532 observacion: detalles.observacion 520 observacion: detalles.observacion
533 }; 521 };
534 var existe = false; 522 var existe = false;
535 523
536 $scope.cobrosTabla.forEach(function(c, idx) { 524 $scope.cobranza.cobros.forEach(function(c, idx) {
537 if (c.til === 'DE') { 525 if (c.til === 'DE') {
538 $scope.cobrosTabla[idx] = cobro; 526 $scope.cobranza.cobros[idx] = cobro;
539 existe = true; 527 existe = true;
540 } 528 }
541 }); 529 });
542 if (!existe) { 530 if (!existe) {
543 $scope.cobrosTabla.push(cobro); 531 $scope.cobranza.cobros.push(cobro);
544 } 532 }
545 }, function() {} 533 }, function() {}
546 ); 534 );
547 }; 535 };
548 536
549 $scope.seleccionarMoneda = function() { 537 $scope.seleccionarMoneda = function() {
550 var parametrosModal = { 538 var parametrosModal = {
551 titulo: 'Búsqueda de monedas', 539 titulo: 'Búsqueda de monedas',
552 query: '/moneda', 540 query: '/moneda',
553 columnas: [ 541 columnas: [
554 { 542 {
555 propiedad: 'DETALLE', 543 propiedad: 'DETALLE',
556 nombre: 'Nombre' 544 nombre: 'Nombre'
557 }, 545 },
558 { 546 {
559 propiedad: 'SIMBOLO', 547 propiedad: 'SIMBOLO',
560 nombre: 'Símbolo' 548 nombre: 'Símbolo'
561 } 549 }
562 ], 550 ],
563 size: 'md' 551 size: 'md'
564 }; 552 };
565 focaModalService.modal(parametrosModal).then( 553 focaModalService.modal(parametrosModal).then(
566 function(moneda) { 554 function(moneda) {
567 $scope.seleccionarCotizacion(moneda); 555 $scope.seleccionarCotizacion(moneda);
568 }, function() { 556 }, function() {
569 557
570 } 558 }
571 ); 559 );
572 }; 560 };
573 561
574 $scope.seleccionarCotizacion = function(moneda) { 562 $scope.seleccionarCotizacion = function(moneda) {
575 var modalInstance = $uibModal.open( 563 var modalInstance = $uibModal.open(
576 { 564 {
577 ariaLabelledBy: 'Busqueda de Cotización', 565 ariaLabelledBy: 'Busqueda de Cotización',
578 templateUrl: 'modal-cotizacion.html', 566 templateUrl: 'modal-cotizacion.html',
579 controller: 'focaModalCotizacionController', 567 controller: 'focaModalCotizacionController',
580 size: 'lg', 568 size: 'lg',
581 resolve: {idMoneda: function() {return moneda.ID;}} 569 resolve: {idMoneda: function() {return moneda.ID;}}
582 } 570 }
583 ); 571 );
584 modalInstance.result.then( 572 modalInstance.result.then(
585 function(cotizacion) { 573 function(cotizacion) {
586 $scope.cobranza.moneda = moneda; 574 $scope.cobranza.cotizacion.moneda = moneda;
587 $scope.cobranza.cotizacion = cotizacion; 575 $scope.cobranza.cotizacion = cotizacion;
588 if(moneda.DETALLE === 'PESOS ARGENTINOS') { 576 if (moneda.DETALLE === 'PESOS ARGENTINOS') {
589 $scope.$broadcast('removeCabecera', 'Moneda:'); 577 $scope.$broadcast('removeCabecera', 'Moneda:');
590 $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); 578 $scope.$broadcast('removeCabecera', 'Fecha cotizacion:');
591 $scope.$broadcast('removeCabecera', 'Cotizacion:'); 579 $scope.$broadcast('removeCabecera', 'Cotizacion:');
592 }else { 580 } else {
593 $scope.$broadcast('addCabecera', { 581 $scope.$broadcast('addCabecera', {
594 label: 'Moneda:', 582 label: 'Moneda:',
595 valor: moneda.DETALLE 583 valor: moneda.DETALLE
596 }); 584 });
597 $scope.$broadcast('addCabecera', { 585 $scope.$broadcast('addCabecera', {
598 label: 'Fecha cotizacion:', 586 label: 'Fecha cotizacion:',
599 valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') 587 valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
600 }); 588 });
601 $scope.$broadcast('addCabecera', { 589 $scope.$broadcast('addCabecera', {
602 label: 'Cotizacion:', 590 label: 'Cotizacion:',
603 valor: $filter('number')(cotizacion.VENDEDOR, '2') 591 valor: $filter('number')(cotizacion.VENDEDOR, '2')
604 }); 592 });
605 } 593 }
606 }, function() { 594 }, function() {
607 595
608 } 596 }
609 ); 597 );
610 }; 598 };
611 599
612 $scope.seleccionarCobrador = function() { 600 $scope.seleccionarCobrador = function() {
613 var parametrosModal = { 601 var parametrosModal = {
614 query: '/cobrador', 602 query: '/cobrador',
615 columnas: [ 603 columnas: [
616 { 604 {
617 propiedad: 'NUM', 605 propiedad: 'NUM',
618 nombre: 'Codigo', 606 nombre: 'Codigo',
619 filtro: { 607 filtro: {
620 nombre: 'rellenarDigitos', 608 nombre: 'rellenarDigitos',
621 parametro: 3 609 parametro: 3
622 } 610 }
623 }, 611 },
624 { 612 {
625 propiedad: 'NOM', 613 propiedad: 'NOM',
626 nombre: 'Nombre' 614 nombre: 'Nombre'
627 } 615 }
628 ], 616 ],
629 titulo:'Búsqueda de cobradores' 617 titulo:'Búsqueda de cobradores'
630 }; 618 };
631 focaModalService.modal(parametrosModal).then( 619 focaModalService.modal(parametrosModal).then(
632 function(cobrador) { 620 function(cobrador) {
633 $scope.$broadcast('addCabecera', { 621 $scope.$broadcast('addCabecera', {
634 label: 'Cobrador:', 622 label: 'Cobrador:',
635 valor: $filter('rellenarDigitos')(cobrador.NUM, 3) + ' - ' + 623 valor: $filter('rellenarDigitos')(cobrador.NUM, 3) + ' - ' +
636 cobrador.NOM 624 cobrador.NOM
637 }); 625 });
638 $scope.cobranza.cobrador = cobrador; 626 $scope.cobranza.cobrador = cobrador;
639 }, function() { 627 }, function() {
640 628
641 } 629 }
642 ); 630 );
643 }; 631 };
644 632
645 $scope.getTotalDeuda = function() { 633 $scope.getTotalDeuda = function() {
646 var total = 0; 634 var total = 0;
647 for (var i = 0; i < $scope.facturaTabla.length; i++) { 635 for (var i = 0; i < $scope.cobranza.facturas.length; i++) {
648 total += $scope.facturaTabla[i].IPA; 636 total += $scope.cobranza.facturas[i].IPA;
649 } 637 }
650 return parseFloat(total.toFixed(2)); 638 return parseFloat(total.toFixed(2));
651 }; 639 };
652 640
653 $scope.getTotalCobrado = function() { 641 $scope.getTotalCobrado = function() {
654 var total = 0; 642 var total = 0;
655 for (var i = 0; i < $scope.cobrosTabla.length; i++) { 643 for (var i = 0; i < $scope.cobranza.cobros.length; i++) {
656 total += $scope.cobrosTabla[i].importe; 644 total += $scope.cobranza.cobros[i].importe;
657 } 645 }
658 return parseFloat(total.toFixed(2)); 646 return parseFloat(total.toFixed(2));
659 }; 647 };
660 648
661 $scope.getSubTotal = function() { 649 $scope.getSubTotal = function() {
662 if ($scope.articuloACargar) { 650 if ($scope.articuloACargar) {
663 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; 651 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
664 } 652 }
665 }; 653 };
666 //Recibe aviso si el teclado está en uso 654 //Recibe aviso si el teclado está en uso
667 // $rootScope.$on('usarTeclado', function(event, data) { 655 // $rootScope.$on('usarTeclado', function(event, data) {
668 // if(data) { 656 // if(data) {
669 // $scope.mostrarTeclado = true; 657 // $scope.mostrarTeclado = true;
670 // return; 658 // return;
671 // } 659 // }
672 // $scope.mostrarTeclado = false; 660 // $scope.mostrarTeclado = false;
673 // }) 661 // })
674 $scope.selectFocus = function($event) { 662 $scope.selectFocus = function($event) {
675 //Si el teclado esta en uso no selecciona el valor 663 //Si el teclado esta en uso no selecciona el valor
676 // if($scope.mostrarTeclado) { 664 // if($scope.mostrarTeclado) {
677 // return; 665 // return;
678 // } 666 // }
679 $event.target.select(); 667 $event.target.select();
680 }; 668 };
681 669
682 $scope.salir = function() { 670 $scope.salir = function() {
683 $location.path('/'); 671 $location.path('/');
684 }; 672 };
685 673
686 $scope.parsearATexto = function(articulo) { 674 $scope.parsearATexto = function(articulo) {
687 articulo.cantidad = parseFloat(articulo.cantidad); 675 articulo.cantidad = parseFloat(articulo.cantidad);
688 articulo.precio = parseFloat(articulo.precio); 676 articulo.precio = parseFloat(articulo.precio);
689 }; 677 };
690 678
691 $scope.quitarFactura = function(key) { 679 $scope.quitarFactura = function(key) {
692 $scope.facturaTabla.splice(key, 1); 680 $scope.cobranza.facturas.splice(key, 1);
693 }; 681 };
694 682
695 $scope.quitarCobro = function(key) { 683 $scope.quitarCobro = function(key) {
696 $scope.cobrosTabla.splice(key, 1); 684 $scope.cobranza.cobros.splice(key, 1);
697 }; 685 };
698 686
699 function salir() { 687 function salir() {
700 var confirmacion = false; 688 var confirmacion = false;
701 689
702 angular.forEach($scope.inicial, function(valor, key) { 690 if (!angular.equals($scope.cobranza, $scope.inicial)) {
703 if (!angular.equals($scope[key], $scope.inicial[key])) { 691 confirmacion = true;
704 confirmacion = true; 692 }
705 }
706 });
707 693
708 if (confirmacion) { 694 if (confirmacion) {
709 focaModalService.confirm( 695 focaModalService.confirm(
710 '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' 696 '¿Está seguro de que desea salir? Se perderán todos los datos cargados.'
711 ).then(function(data) { 697 ).then(function(data) {
712 if (data) { 698 if (data) {
713 $location.path('/'); 699 $location.path('/');
714 } 700 }
715 }); 701 });
716 } else { 702 } else {
717 $location.path('/'); 703 $location.path('/');
718 } 704 }
719 } 705 }
706
707 function setearCobranza(cobranza) {
708 $scope.editando = true;
1 angular.module('focaCrearCobranza') 1 angular.module('focaCrearCobranza')
2 .service('focaCrearCobranzaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { 2 .service('focaCrearCobranzaService', ['$http', 'API_ENDPOINT',
3 function($http, API_ENDPOINT) {
3 return { 4 return {
4 getNumeroRecibo: function() { 5 getNumeroRecibo: function() {
5 return $http.get(API_ENDPOINT.URL + '/recibo/numero-siguiente'); 6 return $http.get(API_ENDPOINT.URL + '/recibo/numero-siguiente');
6 }, 7 },
7 getCotizacionByIdMoneda: function(id) { 8 getCotizacionByIdMoneda: function(id) {
8 return $http.get(API_ENDPOINT.URL + '/moneda/' + id); 9 return $http.get(API_ENDPOINT.URL + '/moneda/' + id);
9 }, 10 },
10 guardarCobranza: function(cobranza) { 11 guardarCobranza: function(cobranza) {
11 return $http.post(API_ENDPOINT.URL + '/recibo/guardar', cobranza); 12 return $http.post(API_ENDPOINT.URL + '/recibo/guardar', cobranza);
12 }, 13 },
13 getCobradorById: function(id) { 14 getCobradorById: function(id) {
14 return $http.get(API_ENDPOINT.URL + '/vendedor-cobrador/' + id); 15 return $http.get(API_ENDPOINT.URL + '/vendedor-cobrador/' + id);
15 }, 16 },
16 enviarComprobantePorMail: function(mail, data) { 17 enviarComprobantePorMail: function(mail, data) {
17 return $http.post(API_ENDPOINT.URL + '/mail/comprobante', 18 return $http.post(API_ENDPOINT.URL + '/mail/comprobante',
18 {receiver: mail, comprobante: data}); 19 {receiver: mail, comprobante: data});
19 }, 20 },
20 actualizarEmail: function(mail, idCliente) { 21 actualizarEmail: function(mail, idCliente) {
21 return $http.post(API_ENDPOINT.URL + '/cliente/update/email', 22 return $http.post(API_ENDPOINT.URL + '/cliente/update/email',
22 {mail: mail, id: idCliente}); 23 {mail: mail, id: idCliente});
23 }, 24 },
24 getBotonera: function(idCobrador) { 25 getBotonera: function(idCobrador) {
25 var result = [ 26 var result = [
26 { 27 {
27 label: 'Cliente', 28 label: 'Cliente',
28 image: 'cliente.png' 29 image: 'cliente.png'
29 }, 30 },
30 { 31 {
31 label: 'Comprobantes', 32 label: 'Comprobantes',
32 image: 'comprobante.png' 33 image: 'comprobante.png'
33 }, 34 },
34 { 35 {
35 label: 'Cobros', 36 label: 'Cobros',
36 image: 'cobros.png' 37 image: 'cobros.png'
37 }, 38 },
38 { 39 {
39 label: 'Moneda', 40 label: 'Moneda',
40 image: 'moneda.png' 41 image: 'moneda.png'
41 } 42 }
42 ]; 43 ];
43 if(!idCobrador) { 44 if(!idCobrador) {
44 var cobradorBoton = { 45 var cobradorBoton = {
45 label: 'Cobrador', 46 label: 'Cobrador',
46 image: 'cobrador.png' 47 image: 'cobrador.png'
47 }; 48 };
48 result.unshift(cobradorBoton); 49 result.unshift(cobradorBoton);
49 } 50 }
50 return result; 51 return result;
51 } 52 }
52 }; 53 };
53 }]); 54 }]);
54 55
src/views/cobranza.html
1 <div class="crear-nota-pedido foca-crear row"> 1 <div class="crear-nota-pedido foca-crear row">
2 <foca-cabecera-facturador 2 <foca-cabecera-facturador
3 titulo="'Recibo de cobranza'" 3 titulo="'Recibo de cobranza'"
4 numero="puntoVenta + '-' + comprobante" 4 numero="puntoVenta + '-' + comprobante"
5 fecha="fecha" 5 fecha="cobranza.fecha"
6 class="mb-0 col-lg-12" 6 class="mb-0 col-lg-12"
7 busqueda="seleccionarCobranza" 7 busqueda="seleccionarCobranza"
8 ></foca-cabecera-facturador> 8 ></foca-cabecera-facturador>
9 <div class="col-lg-12"> 9 <div class="col-lg-12">
10 <div class="row mt-4"> 10 <div class="row mt-4">
11 <div class="col-12 col-md-10 border border-light rounded"> 11 <div class="col-12 col-md-10 border border-light rounded">
12 <div class="row px-5 py-2 botonera-secundaria"> 12 <div class="row px-5 py-2 botonera-secundaria">
13 <div class="col-12"> 13 <div class="col-12">
14 <foca-botonera-facturador botones="botonera" extra="7" class="row"></foca-botonera-facturador> 14 <foca-botonera-facturador botones="botonera" extra="7" class="row"></foca-botonera-facturador>
15 </div> 15 </div>
16 </div> 16 </div>
17 <!-- PC --> 17 <!-- PC -->
18 <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="cobroDeuda"> 18 <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="cobroDeuda">
19 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> 19 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom">
20 <thead> 20 <thead>
21 <tr class="d-flex"> 21 <tr class="d-flex">
22 <th class="col-auto">#</th> 22 <th class="col-auto">#</th>
23 <th class="col">Comprobante</th> 23 <th class="col">Comprobante</th>
24 <th class="col">Fecha</th> 24 <th class="col">Fecha</th>
25 <th class="col">Importe</th> 25 <th class="col">Importe</th>
26 <th class="col-auto"> 26 <th class="col-auto">
27 <button 27 <button
28 class="btn btn-outline-light selectable" 28 class="btn btn-outline-light selectable"
29 ng-click="show = !show; masMenos()" 29 ng-click="show = !show; masMenos()"
30 > 30 >
31 <i 31 <i
32 class="fa fa-chevron-down" 32 class="fa fa-chevron-down"
33 ng-show="show" 33 ng-show="show"
34 aria-hidden="true" 34 aria-hidden="true"
35 > 35 >
36 </i> 36 </i>
37 <i 37 <i
38 class="fa fa-chevron-up" 38 class="fa fa-chevron-up"
39 ng-hide="show" 39 ng-hide="show"
40 aria-hidden="true"> 40 aria-hidden="true">
41 </i> 41 </i>
42 </button> 42 </button>
43 </th> 43 </th>
44 </th> 44 </th>
45 </tr> 45 </tr>
46 </thead> 46 </thead>
47 <tbody class="tabla-articulo-body"> 47 <tbody class="tabla-articulo-body">
48 <tr 48 <tr
49 ng-repeat="(key, factura) in facturaTabla" 49 ng-repeat="(key, factura) in cobranza.facturas"
50 class="d-flex" 50 class="d-flex"
51 ng-show="show || key == facturaTabla.length - 1" 51 ng-show="show || key == cobranza.facturas.length - 1"
52 > 52 >
53 <td ng-bind="key + 1" class="col-auto"></td> 53 <td ng-bind="key + 1" class="col-auto"></td>
54 <td class="col" ng-bind="factura.numeroFactura" 54 <td class="col" ng-bind="factura.numeroFactura"
55 ></td> 55 ></td>
56 <td class="col" ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></td> 56 <td class="col" ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></td>
57 <td 57 <td
58 class="col" 58 class="col"
59 ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) | 59 ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) |
60 number: 4"></td> 60 number: 4"></td>
61 <td class="text-center col-auto"> 61 <td class="text-center col-auto">
62 <button 62 <button
63 class="btn btn-outline-light" 63 class="btn btn-outline-light"
64 ng-click="quitarFactura(key)" 64 ng-click="quitarFactura(key)"
65 > 65 >
66 <i class="fa fa-trash"></i> 66 <i class="fa fa-trash"></i>
67 </button> 67 </button>
68 </td> 68 </td>
69 </tr> 69 </tr>
70 </tbody> 70 </tbody>
71 <tfoot> 71 <tfoot>
72 <tr ng-show="cargando" class="d-flex"> 72 <tr ng-show="cargando" class="d-flex">
73 <td class="col-2 border-top-0"> 73 <td class="col-2 border-top-0">
74 <a 74 <a
75 class="form-control form-control-sm btn btn-secondary" 75 class="form-control form-control-sm btn btn-secondary"
76 ng-click="seleccionarFactura()" 76 ng-click="seleccionarFactura()"
77 >Pendientes</a> 77 >Pendientes</a>
78 </td> 78 </td>
79 </tr> 79 </tr>
80 <tr class="d-flex"> 80 <tr class="d-flex">
81 <td class="col-auto px-1 border-top-0"> 81 <td class="col-auto px-1 border-top-0">
82 <strong>Comprobantes:</strong> 82 <strong>Comprobantes:</strong>
83 <a ng-bind="facturaTabla.length"></a> 83 <a ng-bind="cobranza.facturas.length"></a>
84 </td> 84 </td>
85 <td class="text-right ml-auto table-celda-total no-border-top"> 85 <td class="text-right ml-auto table-celda-total no-border-top">
86 <strong>Cancela:</strong> 86 <strong>Cancela:</strong>
87 </td> 87 </td>
88 <td class="table-celda-total text-right no-border-top"> 88 <td class="table-celda-total text-right no-border-top">
89 <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | 89 <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) |
90 currency: cobranza.moneda.SIMBOLO}}</strong> 90 currency: cobranza.moneda.SIMBOLO}}</strong>
91 </td> 91 </td>
92 <td class="text-right ml-auto table-celda-total no-border-top"> 92 <td class="text-right ml-auto table-celda-total no-border-top">
93 <strong>Total Cobrado:</strong> 93 <strong>Total Cobrado:</strong>
94 </td> 94 </td>
95 <td class="table-celda-total text-right no-border-top"> 95 <td class="table-celda-total text-right no-border-top">
96 <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | 96 <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) |
97 currency: cobranza.moneda.SIMBOLO}}</strong> 97 currency: cobranza.moneda.SIMBOLO}}</strong>
98 </td> 98 </td>
99 <td class="text-right ml-auto table-celda-total no-border-top"> 99 <td class="text-right ml-auto table-celda-total no-border-top">
100 <strong>DF:</strong> 100 <strong>DF:</strong>
101 </td> 101 </td>
102 <td class="table-celda-total text-right no-border-top mr-1"> 102 <td class="table-celda-total text-right no-border-top mr-1">
103 <strong>{{((getTotalCobrado() + getTotalDeuda()) / 103 <strong>{{((getTotalCobrado() + getTotalDeuda()) /
104 cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} 104 cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}
105 </strong> 105 </strong>
106 </td> 106 </td>
107 </tr> 107 </tr>
108 </tfoot> 108 </tfoot>
109 </table> 109 </table>
110 </div> 110 </div>
111 <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="!cobroDeuda"> 111 <div class="row grilla-articulo align-items-end d-none d-sm-flex" ng-show="!cobroDeuda">
112 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> 112 <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom">
113 <thead> 113 <thead>
114 <tr class="d-flex"> 114 <tr class="d-flex">
115 <th class="col-auto">#</th> 115 <th class="col-auto">#</th>
116 <th class="col">Cobro</th> 116 <th class="col">Cobro</th>
117 <th class="col">Fecha</th> 117 <th class="col">Fecha</th>
118 <th class="col">Importe</th> 118 <th class="col">Importe</th>
119 <th class="col-auto"> 119 <th class="col-auto">
120 <button 120 <button
121 class="btn btn-outline-light selectable" 121 class="btn btn-outline-light selectable"
122 ng-click="show = !show; masMenos()" 122 ng-click="show = !show; masMenos()"
123 > 123 >
124 <i 124 <i
125 class="fa fa-chevron-down" 125 class="fa fa-chevron-down"
126 ng-show="show" 126 ng-show="show"
127 aria-hidden="true" 127 aria-hidden="true"
128 > 128 >
129 </i> 129 </i>
130 <i 130 <i
131 class="fa fa-chevron-up" 131 class="fa fa-chevron-up"
132 ng-hide="show" 132 ng-hide="show"
133 aria-hidden="true"> 133 aria-hidden="true">
134 </i> 134 </i>
135 </button> 135 </button>
136 </th> 136 </th>
137 </th> 137 </th>
138 </tr> 138 </tr>
139 </thead> 139 </thead>
140 <tbody class="tabla-articulo-body"> 140 <tbody class="tabla-articulo-body">
141 <tr 141 <tr
142 ng-repeat="(key, cobro) in cobrosTabla" 142 ng-repeat="(key, cobro) in cobranza.cobros"
143 class="d-flex" 143 class="d-flex"
144 ng-show="show || key == cobrosTabla.length - 1" 144 ng-show="show || key == cobranza.cobros.length - 1"
145 > 145 >
146 <td ng-bind="key + 1" class="col-auto"></td> 146 <td ng-bind="key + 1" class="col-auto"></td>
147 <td class="col" ng-bind="cobro.tipo"></td> 147 <td class="col" ng-bind="cobro.tipo"></td>
148 <td class="col" ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></td> 148 <td class="col" ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></td>
149 <td 149 <td
150 class="col" 150 class="col"
151 ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) | 151 ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) |
152 currency: cobranza.moneda.SIMBOLO : 4"></td> 152 currency: cobranza.moneda.SIMBOLO : 4"></td>
153 <td class="text-center col-auto"> 153 <td class="text-center col-auto">
154 <button 154 <button
155 class="btn btn-outline-light" 155 class="btn btn-outline-light"
156 ng-click="quitarCobro(key)" 156 ng-click="quitarCobro(key)"
157 > 157 >
158 <i class="fa fa-trash"></i> 158 <i class="fa fa-trash"></i>
159 </button> 159 </button>
160 </td> 160 </td>
161 </tr> 161 </tr>
162 </tbody> 162 </tbody>
163 <tfoot> 163 <tfoot>
164 <tr ng-show="cargando" class="d-flex"> 164 <tr ng-show="cargando" class="d-flex">
165 <td class="col-2 border-top-0"> 165 <td class="col-2 border-top-0">
166 <a 166 <a
167 class="form-control form-control-sm btn btn-secondary" 167 class="form-control form-control-sm btn btn-secondary"
168 ng-click="seleccionarCheque()" 168 ng-click="seleccionarCheque()"
169 >Cheque</a> 169 >Cheque</a>
170 </td> 170 </td>
171 <td class="col-2 border-top-0"> 171 <td class="col-2 border-top-0">
172 <a 172 <a
173 class="form-control form-control-sm btn btn-secondary" 173 class="form-control form-control-sm btn btn-secondary"
174 ng-click="seleccionarEfectivo()" 174 ng-click="seleccionarEfectivo()"
175 >Efectivo</a> 175 >Efectivo</a>
176 </td> 176 </td>
177 <td class="col-2 border-top-0"> 177 <td class="col-2 border-top-0">
178 <a 178 <a
179 class="form-control form-control-sm btn btn-secondary" 179 class="form-control form-control-sm btn btn-secondary"
180 ng-click="seleccionarDetalles()" 180 ng-click="seleccionarDetalles()"
181 >Detalle</a> 181 >Detalle</a>
182 </td> 182 </td>
183 </tr> 183 </tr>
184 <tr class="d-flex"> 184 <tr class="d-flex">
185 <td class="col-auto px-1 border-top-0"> 185 <td class="col-auto px-1 border-top-0">
186 <strong>Cobros:</strong> 186 <strong>Cobros:</strong>
187 <a ng-bind="cobrosTabla.length"></a> 187 <a ng-bind="cobranza.cobros.length"></a>
188 </td> 188 </td>
189 <td class="text-right ml-auto table-celda-total no-border-top"> 189 <td class="text-right ml-auto table-celda-total no-border-top">
190 <strong>Cancela:</strong> 190 <strong>Cancela:</strong>
191 </td> 191 </td>
192 <td class="table-celda-total text-right no-border-top"> 192 <td class="table-celda-total text-right no-border-top">
193 <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | 193 <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) |
194 currency: cobranza.moneda.SIMBOLO}}</strong> 194 currency: cobranza.moneda.SIMBOLO}}</strong>
195 </td> 195 </td>
196 <td class="text-right ml-auto table-celda-total no-border-top"> 196 <td class="text-right ml-auto table-celda-total no-border-top">
197 <strong>Total Cobrado:</strong> 197 <strong>Total Cobrado:</strong>
198 </td> 198 </td>
199 <td class="table-celda-total text-right no-border-top"> 199 <td class="table-celda-total text-right no-border-top">
200 <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | 200 <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) |
201 currency: cobranza.moneda.SIMBOLO}}</strong> 201 currency: cobranza.moneda.SIMBOLO}}</strong>
202 </td> 202 </td>
203 <td class="text-right ml-auto table-celda-total no-border-top"> 203 <td class="text-right ml-auto table-celda-total no-border-top">
204 <strong>DF:</strong> 204 <strong>DF:</strong>
205 </td> 205 </td>
206 <td class="table-celda-total text-right no-border-top mr-1"> 206 <td class="table-celda-total text-right no-border-top mr-1">
207 <strong>{{((getTotalCobrado() + getTotalDeuda()) / 207 <strong>{{((getTotalCobrado() + getTotalDeuda()) /
208 cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}} 208 cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}
209 </strong> 209 </strong>
210 </td> 210 </td>
211 </tr> 211 </tr>
212 </tfoot> 212 </tfoot>
213 </table> 213 </table>
214 </div> 214 </div>
215 <!-- MOBILE --> 215 <!-- MOBILE -->
216 <div class="row d-sm-none mb-5"> 216 <div class="row d-sm-none mb-5">
217 <!-- FACTURAS --> 217 <!-- FACTURAS -->
218 <table class="table table-sm table-striped tabla-articulo mb-5" ng-show="cobroDeuda"> 218 <table class="table table-sm table-striped tabla-articulo mb-5" ng-show="cobroDeuda">
219 <thead> 219 <thead>
220 <tr class="d-flex"> 220 <tr class="d-flex">
221 <th class="">#</th> 221 <th class="">#</th>
222 <th class="col px-0"> 222 <th class="col px-0">
223 <div class="d-flex"> 223 <div class="d-flex">
224 <div class="col-4 px-1">Factura</div> 224 <div class="col-4 px-1">Factura</div>
225 <div class="col-4 px-1">Fecha</div> 225 <div class="col-4 px-1">Fecha</div>
226 <div class="col-4 px-1">Importe</div> 226 <div class="col-4 px-1">Importe</div>
227 </div> 227 </div>
228 </th> 228 </th>
229 <th class="text-center tamaño-boton"> 229 <th class="text-center tamaño-boton">
230 &nbsp; 230 &nbsp;
231 </th> 231 </th>
232 </tr> 232 </tr>
233 </thead> 233 </thead>
234 <tbody> 234 <tbody>
235 <tr 235 <tr
236 ng-repeat="(key, factura) in facturaTabla" 236 ng-repeat="(key, factura) in cobranza.facturas"
237 ng-show="show || key == facturaTabla.length - 1" 237 ng-show="show || key == cobranza.facturas.length - 1"
238 > 238 >
239 <td class="w-100 align-middle d-flex p-0"> 239 <td class="w-100 align-middle d-flex p-0">
240 <div class="align-middle p-1"> 240 <div class="align-middle p-1">
241 <span ng-bind="key+1" class="align-middle"></span> 241 <span ng-bind="key+1" class="align-middle"></span>
242 </div> 242 </div>
243 <div class="col px-0"> 243 <div class="col px-0">
244 <div class="d-flex"> 244 <div class="d-flex">
245 <div class="col-4 p-1"> 245 <div class="col-4 p-1">
246 <span ng-bind="factura.numeroFactura" 246 <span ng-bind="factura.numeroFactura"
247 ></span> 247 ></span>
248 </div> 248 </div>
249 <div class="col-4 p-1"> 249 <div class="col-4 p-1">
250 <span ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></span> 250 <span ng-bind="factura.FEP | date : 'dd/MM/yyyy'"></span>
251 </div> 251 </div>
252 <div class="col-4 p-1"> 252 <div class="col-4 p-1">
253 <span 253 <span
254 ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) | 254 ng-bind="(factura.IPA / cobranza.cotizacion.VENDEDOR) |
255 currency:cobranza.moneda.SIMBOLO : 4"></span> 255 currency:cobranza.moneda.SIMBOLO : 4"></span>
256 </div> 256 </div>
257 </div> 257 </div>
258 </div> 258 </div>
259 <div class="align-middle p-1"> 259 <div class="align-middle p-1">
260 <button 260 <button
261 class="btn btn-outline-light" 261 class="btn btn-outline-light"
262 ng-click="quitarFactura(key)" 262 ng-click="quitarFactura(key)"
263 > 263 >
264 <i class="fa fa-trash"></i> 264 <i class="fa fa-trash"></i>
265 </button> 265 </button>
266 </div> 266 </div>
267 </td> 267 </td>
268 </tr> 268 </tr>
269 </tbody> 269 </tbody>
270 <tfoot> 270 <tfoot>
271 <!-- SELECCIONAR PRODUCTO --> 271 <!-- SELECCIONAR PRODUCTO -->
272 <tr ng-show="cargando" class="d-flex"> 272 <tr ng-show="cargando" class="d-flex">
273 <td class="col-12"> 273 <td class="col-12">
274 <input 274 <input
275 placeholder="Seleccione Factura" 275 placeholder="Seleccione Factura"
276 class="form-control form-control-sm" 276 class="form-control form-control-sm"
277 readonly 277 readonly
278 ng-click="seleccionarFactura()" 278 ng-click="seleccionarFactura()"
279 /> 279 />
280 </td> 280 </td>
281 </tr> 281 </tr>
282 <!-- TOOGLE EXPANDIR --> 282 <!-- TOOGLE EXPANDIR -->
283 <tr> 283 <tr>
284 <td class="col"> 284 <td class="col">
285 <button 285 <button
286 class="btn btn-outline-light selectable w-100" 286 class="btn btn-outline-light selectable w-100"
287 ng-click="show = !show; masMenos()" 287 ng-click="show = !show; masMenos()"
288 ng-show="facturaTabla.length > 0" 288 ng-show="cobranza.facturas.length > 0"
289 > 289 >
290 <i 290 <i
291 class="fa fa-chevron-down" 291 class="fa fa-chevron-down"
292 ng-hide="show" 292 ng-hide="show"
293 aria-hidden="true" 293 aria-hidden="true"
294 > 294 >
295 </i> 295 </i>
296 <i 296 <i
297 class="fa fa-chevron-up" 297 class="fa fa-chevron-up"
298 ng-show="show" 298 ng-show="show"
299 aria-hidden="true"> 299 aria-hidden="true">
300 </i> 300 </i>
301 </button> 301 </button>
302 </td> 302 </td>
303 </tr> 303 </tr>
304 <!-- FOOTER --> 304 <!-- FOOTER -->
305 <tr class="d-flex"> 305 <tr class="d-flex">
306 <td class="align-middle no-border-top" colspan="2"> 306 <td class="align-middle no-border-top" colspan="2">
307 <strong>Cantidad Items:</strong> 307 <strong>Cantidad Items:</strong>
308 <a ng-bind="facturaTabla.length"></a> 308 <a ng-bind="cobranza.facturas.length"></a>
309 </td> 309 </td>
310 </tr> 310 </tr>
311 </tfoot> 311 </tfoot>
312 </table> 312 </table>
313 <!-- COBROS --> 313 <!-- COBROS -->
314 <table class="table table-sm table-striped tabla-articulo mb-5" ng-show="!cobroDeuda"> 314 <table class="table table-sm table-striped tabla-articulo mb-5" ng-show="!cobroDeuda">
315 <thead> 315 <thead>
316 <tr class="d-flex"> 316 <tr class="d-flex">
317 <th class="">#</th> 317 <th class="">#</th>
318 <th class="col px-0"> 318 <th class="col px-0">
319 <div class="d-flex"> 319 <div class="d-flex">
320 <div class="col-4 px-1">Cobro</div> 320 <div class="col-4 px-1">Cobro</div>
321 <div class="col-4 px-1">Fecha</div> 321 <div class="col-4 px-1">Fecha</div>
322 <div class="col-4 px-1">Importe</div> 322 <div class="col-4 px-1">Importe</div>
323 </div> 323 </div>
324 </th> 324 </th>
325 <th class="text-center tamaño-boton"> 325 <th class="text-center tamaño-boton">
326 &nbsp; 326 &nbsp;
327 </th> 327 </th>
328 </tr> 328 </tr>
329 </thead> 329 </thead>
330 <tbody> 330 <tbody>
331 <tr 331 <tr
332 ng-repeat="(key, cobro) in cobrosTabla" 332 ng-repeat="(key, cobro) in cobranza.cobros"
333 ng-show="show || key == cobrosTabla.length - 1" 333 ng-show="show || key == cobranza.cobros.length - 1"
334 > 334 >
335 <td class="w-100 align-middle d-flex p-0"> 335 <td class="w-100 align-middle d-flex p-0">
336 <div class="align-middle p-1"> 336 <div class="align-middle p-1">
337 <span ng-bind="key+1" class="align-middle"></span> 337 <span ng-bind="key+1" class="align-middle"></span>
338 </div> 338 </div>
339 <div class="col px-0"> 339 <div class="col px-0">
340 <div class="d-flex"> 340 <div class="d-flex">
341 <div class="col-4 p-1"> 341 <div class="col-4 p-1">
342 <span ng-bind="cobro.tipo" 342 <span ng-bind="cobro.tipo"
343 ></span> 343 ></span>
344 </div> 344 </div>
345 <div class="col-4 p-1"> 345 <div class="col-4 p-1">
346 <span ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></span> 346 <span ng-bind="cobro.fecha | date : 'dd/MM/yyyy'"></span>
347 </div> 347 </div>
348 <div class="col-4 p-1"> 348 <div class="col-4 p-1">
349 <span 349 <span
350 ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) | 350 ng-bind="(cobro.importe / cobranza.cotizacion.VENDEDOR) |
351 currency: cobranza.moneda.SIMBOLO : 4"></span> 351 currency: cobranza.moneda.SIMBOLO : 4"></span>
352 </div> 352 </div>
353 </div> 353 </div>
354 </div> 354 </div>
355 <div class="align-middle p-1"> 355 <div class="align-middle p-1">
356 <button 356 <button
357 class="btn btn-outline-light" 357 class="btn btn-outline-light"
358 ng-click="quitarCobro(key)" 358 ng-click="quitarCobro(key)"
359 > 359 >
360 <i class="fa fa-trash"></i> 360 <i class="fa fa-trash"></i>
361 </button> 361 </button>
362 </div> 362 </div>
363 </td> 363 </td>
364 </tr> 364 </tr>
365 </tbody> 365 </tbody>
366 <tfoot> 366 <tfoot>
367 <!-- SELECCIONAR PRODUCTO --> 367 <!-- SELECCIONAR PRODUCTO -->
368 <tr ng-show="cargando" class="d-flex"> 368 <tr ng-show="cargando" class="d-flex">
369 <td class="col-4"> 369 <td class="col-4">
370 <input 370 <input
371 placeholder="Cheque" 371 placeholder="Cheque"
372 class="form-control form-control-sm" 372 class="form-control form-control-sm"
373 readonly 373 readonly
374 ng-click="seleccionarCheque()" 374 ng-click="seleccionarCheque()"
375 /> 375 />
376 </td> 376 </td>
377 <td class="col-4"> 377 <td class="col-4">
378 <input 378 <input
379 placeholder="Efectivo" 379 placeholder="Efectivo"
380 class="form-control form-control-sm" 380 class="form-control form-control-sm"
381 readonly 381 readonly
382 ng-click="seleccionarEfectivo()" 382 ng-click="seleccionarEfectivo()"
383 /> 383 />
384 </td> 384 </td>
385 <td class="col-4"> 385 <td class="col-4">
386 <input 386 <input
387 placeholder="Detalles" 387 placeholder="Detalles"
388 class="form-control form-control-sm" 388 class="form-control form-control-sm"
389 readonly 389 readonly
390 ng-click="seleccionarDetalles()" 390 ng-click="seleccionarDetalles()"
391 /> 391 />
392 </td> 392 </td>
393 </tr> 393 </tr>
394 <!-- TOOGLE EXPANDIR --> 394 <!-- TOOGLE EXPANDIR -->
395 <tr> 395 <tr>
396 <td class="col"> 396 <td class="col">
397 <button 397 <button
398 class="btn btn-outline-light selectable w-100" 398 class="btn btn-outline-light selectable w-100"
399 ng-click="show = !show; masMenos()" 399 ng-click="show = !show; masMenos()"
400 ng-show="cobrosTabla.length > 0" 400 ng-show="cobranza.cobros.length > 0"
401 > 401 >
402 <i 402 <i
403 class="fa fa-chevron-down" 403 class="fa fa-chevron-down"
404 ng-hide="show" 404 ng-hide="show"
405 aria-hidden="true" 405 aria-hidden="true"
406 > 406 >
407 </i> 407 </i>
408 <i 408 <i
409 class="fa fa-chevron-up" 409 class="fa fa-chevron-up"
410 ng-show="show" 410 ng-show="show"
411 aria-hidden="true"> 411 aria-hidden="true">
412 </i> 412 </i>
413 </button> 413 </button>
414 </td> 414 </td>
415 </tr> 415 </tr>
416 <!-- FOOTER --> 416 <!-- FOOTER -->
417 <tr class="d-flex"> 417 <tr class="d-flex">
418 <td class="align-middle no-border-top col-6"> 418 <td class="align-middle no-border-top col-6">
419 <strong>Cantidad Items:</strong> 419 <strong>Cantidad Items:</strong>
420 <a ng-bind="cobrosTabla.length"></a> 420 <a ng-bind="cobranza.cobros.length"></a>
421 </td> 421 </td>
422 </tfoot> 422 </tfoot>
423 </table> 423 </table>
424 </tr> 424 </tr>
425 <!-- DEUDA, COBRADO, DIFERENCIA --> 425 <!-- DEUDA, COBRADO, DIFERENCIA -->
426 <table class="table-responsive fixed-bottom mb-5"> 426 <table class="table-responsive fixed-bottom mb-5">
427 <tr class="d-flex row"> 427 <tr class="d-flex row">
428 <td class="text-center ml-auto table-celda-total no-border-top col-4"> 428 <td class="text-center ml-auto table-celda-total no-border-top col-4">
429 <strong>Cancela:</strong> 429 <strong>Cancela:</strong>
430 </td> 430 </td>
431 <td class="text-center ml-auto table-celda-total no-border-top col-4"> 431 <td class="text-center ml-auto table-celda-total no-border-top col-4">
432 <strong>Cobrado:</strong> 432 <strong>Cobrado:</strong>
433 </td> 433 </td>
434 <td class="text-center ml-auto table-celda-total no-border-top col-4"> 434 <td class="text-center ml-auto table-celda-total no-border-top col-4">
435 <strong>Diferencia:</strong> 435 <strong>Diferencia:</strong>
436 </td> 436 </td>
437 <td class="table-celda-total text-center no-border-top col-4"> 437 <td class="table-celda-total text-center no-border-top col-4">
438 <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> 438 <strong>{{(getTotalDeuda() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong>
439 </td> 439 </td>
440 <td class="table-celda-total text-center no-border-top col-4"> 440 <td class="table-celda-total text-center no-border-top col-4">
441 <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> 441 <strong>{{(getTotalCobrado() / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong>
442 </td> 442 </td>
443 <td class="table-celda-total text-center no-border-top col-4"> 443 <td class="table-celda-total text-center no-border-top col-4">
444 <strong>{{((getTotalCobrado() + getTotalDeuda()) / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong> 444 <strong>{{((getTotalCobrado() + getTotalDeuda()) / cobranza.cotizacion.VENDEDOR) | currency: cobranza.moneda.SIMBOLO}}</strong>
445 </td> 445 </td>
446 </tr> 446 </tr>
447 </table> 447 </table>
448 </div> 448 </div>
449 </div> 449 </div>
450 </div> 450 </div>
451 </div> 451 </div>
452 <div class="row d-md-none fixed-bottom"> 452 <div class="row d-md-none fixed-bottom">
453 <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> 453 <div class="w-100 bg-dark d-flex px-3 acciones-mobile">
454 <span class="ml-3 text-muted" ng-click="salir()">Salir</span> 454 <span class="ml-3 text-muted" ng-click="salir()">Salir</span>
455 <span 455 <span
456 class="mr-3 ml-auto" 456 class="mr-3 ml-auto"
457 ng-class="saveLoading ? 'text-muted' : ''" 457 ng-class="saveLoading ? 'text-muted' : ''"
458 ng-click="crearCobranza()" 458 ng-click="crearCobranza()"
459 ng-show="!editando" 459 ng-show="!editando"
460 ladda="saveLoading" 460 ladda="saveLoading"
461 data-style="expand-left" 461 data-style="expand-left"
462 >Guardar</span> 462 >Guardar</span>
463 </div> 463 </div>
464 </div> 464 </div>
465 </div> 465 </div>
466 466