diff --git a/Data/Codpais/ESP/balance_accounts.csv b/Data/Codpais/ESP/balance_accounts.csv
index ad8d5d6..e59d14c 100644
--- a/Data/Codpais/ESP/balance_accounts.csv
+++ b/Data/Codpais/ESP/balance_accounts.csv
@@ -1,1213 +1,1213 @@
-codcuenta;idbalance
-2901;339
-2900;339
-2801;339
-201;339
-200;339
-290;340
-280;340
-20;340
-2902;341
-2802;341
-202;341
-2903;343
-2803;343
-203;343
-204;345
-2906;347
-2806;347
-206;347
-2905;349
-2805;349
-209;349
-205;349
-2911;351
-2910;351
-2811;351
-211;351
-210;351
-291;352
-281;352
-23;352
-21;352
-2919;353
-2918;353
-2917;353
-2916;353
-2915;353
-2914;353
-2913;353
-2912;353
-2819;353
-2818;353
-2817;353
-2816;353
-2815;353
-2814;353
-2813;353
-2812;353
-219;353
-218;353
-217;353
-216;353
-215;353
-214;353
-213;353
-212;353
-23;355
-2920;357
-220;357
-292;358
-282;358
-22;358
-2921;359
-282;359
-221;359
-293;361
-2494;361
-2493;361
-2404;361
-2403;361
-2954;362
-2953;362
-2944;362
-2943;362
-293;362
-2494;362
-2493;362
-2424;362
-2423;362
-2414;362
-2413;362
-2404;362
-2403;362
-2954;363
-2953;363
-2424;363
-2423;363
-2944;365
-2943;365
-2414;365
-2413;365
-259;371
-250;371
-2495;371
-2405;371
-298;372
-297;372
-2955;372
-2945;372
-26;372
-259;372
-258;372
-257;372
-255;372
-254;372
-253;372
-252;372
-251;372
-250;372
-2495;372
-2425;372
-2415;372
-2405;372
-298;373
-2955;373
-254;373
-253;373
-252;373
-2425;373
-297;375
-2945;375
-251;375
-2415;375
-255;377
-26;379
-258;379
-474;381
-474;382
-599;383
-584;383
-583;383
-582;383
-581;383
-580;383
-599;384
-584;384
-583;384
-582;384
-581;384
-580;384
-390;385
-30;385
-407;386
-39;386
-36;386
-35;386
-34;386
-33;386
-32;386
-31;386
-30;386
-392;387
-391;387
-32;387
-31;387
-394;389
-393;389
-34;389
-33;389
-395;391
-35;391
-396;393
-36;393
-407;395
-4935;397
-490;397
-437;397
-436;397
-435;397
-432;397
-431;397
-430;397
-493;398
-490;398
-437;398
-436;398
-435;398
-434;398
-433;398
-432;398
-431;398
-430;398
-4934;399
-4933;399
-434;399
-433;399
-5580;400
-5533;401
-5531;401
-44;401
-5533;402
-5531;402
-544;402
-472;402
-471;402
-470;402
-460;402
-44;402
-544;403
-460;403
-4709;405
-472;407
-471;407
-4708;407
-4700;407
-5585;409
-5580;409
-593;411
-5394;411
-5393;411
-5304;411
-5303;411
-5954;412
-5953;412
-5944;412
-5943;412
-593;412
-5394;412
-5393;412
-5354;412
-5353;412
-5344;412
-5343;412
-5334;412
-5333;412
-5324;412
-5323;412
-5314;412
-5313;412
-5304;412
-5303;412
-5954;413
-5953;413
-5344;413
-5343;413
-5324;413
-5323;413
-5944;415
-5943;415
-5334;415
-5333;415
-5314;415
-5313;415
-5524;419
-5523;419
-5354;419
-5353;419
-549;421
-540;421
-5395;421
-5305;421
-598;422
-597;422
-5955;422
-5945;422
-566;422
-565;422
-5593;422
-5590;422
-549;422
-548;422
-547;422
-546;422
-545;422
-543;422
-542;422
-541;422
-540;422
-5395;422
-5355;422
-5345;422
-5335;422
-5325;422
-5315;422
-5305;422
-598;423
-5955;423
-547;423
-543;423
-542;423
-5345;423
-5325;423
-597;425
-5945;425
-546;425
-541;425
-5335;425
-5315;425
-5593;427
-5590;427
-566;429
-565;429
-550;429
-548;429
-545;429
-5355;429
-567;431
-480;431
-567;432
-480;432
-575;433
-574;433
-573;433
-572;433
-571;433
-570;433
-57;434
-576;435
-992;437
-991;437
-900;437
-89;437
-800;437
-992;438
-991;438
-900;438
-89;438
-800;438
-910;441
-811;441
-810;441
-910;442
-810;442
-94;443
-94;444
-95;445
-85;445
-95;446
-85;446
-838;447
-835;447
-834;447
-833;447
-8300;447
-838;448
-835;448
-834;448
-833;448
-8300;448
-837;449
-836;449
-8301;449
-837;450
-836;450
-8301;450
-994;451
-993;451
-902;451
-802;451
-994;452
-993;452
-902;452
-802;452
-912;455
-813;455
-812;455
-912;456
-812;456
-84;457
-84;458
-102;461
-101;461
-100;461
-102;462
-101;462
-100;462
-1040;463
-1030;463
-1040;464
-1030;464
-110;465
-110;466
-1141;467
-112;467
-119;468
-115;468
-114;468
-113;468
-112;468
-119;469
-115;469
-1144;469
-1143;469
-1142;469
-1140;469
-113;469
-109;471
-108;471
-109;472
-108;472
-111;473
-111;474
-120;475
-121;476
-120;476
-121;477
-118;479
-118;480
-129;481
-129;482
-557;483
-557;484
-136;485
-133;485
-137;486
-1340;486
-133;486
-1341;487
-1340;487
-137;489
-135;489
-132;491
-131;491
-130;491
-132;492
-131;492
-130;492
-140;493
-14;494
-145;495
-146;497
-147;499
-143;499
-142;499
-141;499
-179;501
-178;501
-177;501
-170;502
-1605;502
-170;503
-1605;503
-174;504
-1625;504
-174;505
-1625;505
-189;506
-185;506
-180;506
-179;506
-178;506
-177;506
-176;506
-175;506
-173;506
-172;506
-171;506
-1635;506
-1615;506
-176;507
-189;509
-185;509
-180;509
-175;509
-173;509
-172;509
-171;509
-1635;509
-1615;509
-150;509
-1634;511
-1633;511
-1624;511
-1623;511
-1614;511
-1613;511
-1604;511
-1603;511
-1634;512
-1633;512
-1624;512
-1623;512
-1614;512
-1613;512
-1604;512
-1603;512
-479;513
-479;514
-181;515
-181;516
-589;517
-588;517
-587;517
-586;517
-585;517
-589;518
-588;518
-587;518
-586;518
-585;518
-529;519
-499;519
-529;520
-499;520
-506;521
-505;521
-501;521
-500;521
-527;522
-520;522
-5105;522
-527;523
-520;523
-5105;523
-524;524
-5125;524
-524;525
-5125;525
-569;526
-561;526
-560;526
-5598;526
-5595;526
-5566;526
-5565;526
-555;526
-5532;526
-5530;526
-5525;526
-551;526
-528;526
-526;526
-525;526
-523;526
-522;526
-521;526
-5145;526
-5135;526
-5115;526
-509;526
-506;526
-505;526
-501;526
-500;526
-194;526
-192;526
-190;526
-1044;526
-1034;526
-5598;527
-5595;527
-569;529
-561;529
-560;529
-5566;529
-5565;529
-555;529
-5532;529
-5530;529
-5525;529
-551;529
-528;529
-526;529
-525;529
-523;529
-522;529
-521;529
-5145;529
-5135;529
-5115;529
-509;529
-194;529
-192;529
-190;529
-1044;529
-1034;529
-5564;531
-5563;531
-5144;531
-5143;531
-5134;531
-5133;531
-5124;531
-5123;531
-5114;531
-5113;531
-5104;531
-5103;531
-5564;532
-5563;532
-5524;532
-5523;532
-5144;532
-5143;532
-5134;532
-5133;532
-5124;532
-5123;532
-5114;532
-5113;532
-5104;532
-5103;532
-406;533
-405;533
-401;533
-400;533
-406;534
-405;534
-404;534
-403;534
-401;534
-400;534
-404;535
-403;535
-477;536
-476;536
-475;536
-466;536
-465;536
-438;536
-41;536
-41;537
-466;539
-465;539
-4752;541
-477;543
-476;543
-4758;543
-4751;543
-4750;543
-438;545
-568;547
-485;547
-568;548
-485;548
-709;549
-708;549
-706;549
-704;549
-703;549
-702;549
-701;549
-700;549
-709;550
-708;550
-706;550
-705;550
-704;550
-703;550
-702;550
-701;550
-700;550
-705;551
-7956;553
-7955;553
-7952;553
-7951;553
-7956;554
-7955;554
-7952;554
-7951;554
-792;555
-791;555
-790;555
-692;555
-691;555
-690;555
-792;556
-791;556
-790;556
-772;556
-771;556
-770;556
-692;556
-691;556
-690;556
-672;556
-671;556
-670;556
-772;557
-771;557
-770;557
-672;557
-671;557
-670;557
-7601;559
-7600;559
-769;560
-767;560
-762;560
-761;560
-760;560
-7603;561
-7602;561
-76211;563
-76210;563
-76201;563
-76200;563
-7611;563
-7610;563
-769;565
-767;565
-76213;565
-76212;565
-76203;565
-76202;565
-7613;565
-7612;565
-6655;567
-6654;567
-6651;567
-6650;567
-6641;567
-6640;567
-6621;567
-6620;567
-6616;567
-6615;567
-6611;567
-6610;567
-669;568
-665;568
-664;568
-662;568
-661;568
-660;568
-669;569
-6657;569
-6656;569
-6653;569
-6652;569
-6643;569
-6642;569
-6624;569
-6623;569
-6622;569
-6618;569
-6617;569
-6613;569
-6612;569
-660;571
-7633;573
-7631;573
-7630;573
-6633;573
-6631;573
-6630;573
-763;574
-663;574
-7632;575
-6632;575
-768;577
-668;577
-768;578
-799;579
-798;579
-797;579
-796;579
-699;579
-698;579
-697;579
-696;579
-799;580
-798;580
-797;580
-796;580
-775;580
-773;580
-766;580
-699;580
-698;580
-697;580
-696;580
-675;580
-668;580
-667;580
-666;580
-775;581
-773;581
-766;581
-675;581
-673;581
-667;581
-666;581
-638;583
-633;583
-6301;583
-6300;583
-638;584
-633;584
-6301;584
-6300;584
-7930;585
-71;585
-6930;585
-7930;586
-71;586
-6930;586
-73;587
-73;588
-610;589
-6090;589
-6080;589
-6060;589
-600;589
-7933;590
-7932;590
-7931;590
-6933;590
-6932;590
-6931;590
-61;590
-609;590
-608;590
-607;590
-606;590
-602;590
-601;590
-600;590
-612;591
-611;591
-6092;591
-6091;591
-6082;591
-6081;591
-6062;591
-6061;591
-602;591
-601;591
-607;593
-7933;595
-7932;595
-7931;595
-6933;595
-6932;595
-6931;595
-75;597
-75;598
-747;598
-740;598
-747;599
-740;599
-6450;601
-641;601
-640;601
-64;602
-649;603
-643;603
-642;603
-7957;605
-7950;605
-6457;605
-644;605
-62;607
-7954;608
-794;608
-695;608
-694;608
-65;608
-639;608
-636;608
-634;608
-631;608
-62;608
-639;609
-636;609
-634;609
-631;609
-7954;611
-794;611
-695;611
-694;611
-650;611
-659;613
-651;613
-68;615
-68;616
-746;617
-746;618
-20;621
-280;621
-290;621
-21;622
-281;622
-291;622
-23;622
-22;623
-282;623
-292;623
-2403;624
-2404;624
-2413;624
-2414;624
-2423;624
-2424;624
-2493;624
-2494;624
-2933;624
-2934;624
-2943;624
-2944;624
-2953;624
-2954;624
-2405;625
-2415;625
-2425;625
-2495;625
-250;625
-251;625
-252;625
-253;625
-254;625
-255;625
-258;625
-259;625
-26;625
-2935;625
-2945;625
-2955;625
-296;625
-297;625
-298;625
-474;626
-;627
-30;628
-31;628
-32;628
-33;628
-34;628
-35;628
-36;628
-39;628
-407;628
-430;629
-431;629
-432;629
-433;629
-434;629
-435;629
-436;629
-437;629
-490;629
-493;629
-5580;630
-44;631
-460;631
-470;631
-471;631
-472;631
-544;631
-5303;632
-5304;632
-5313;632
-5314;632
-5323;632
-5324;632
-5333;632
-5334;632
-5343;632
-5344;632
-5353;632
-5354;632
-5393;632
-5394;632
-5523;632
-5524;632
-5933;632
-5934;632
-5943;632
-5944;632
-5953;632
-5954;632
-5305;633
-5315;633
-5325;633
-5335;633
-5345;633
-5355;633
-5395;633
-540;633
-541;633
-542;633
-543;633
-545;633
-546;633
-547;633
-548;633
-549;633
-551;633
-5525;633
-5590;633
-565;633
-566;633
-5935;633
-5945;633
-5955;633
-596;633
-597;633
-598;633
-480;634
-567;634
-57;635
-100;636
-101;636
-102;636
-1030;637
-1040;637
-110;638
-112;639
-113;639
-114;639
-119;639
-108;640
-109;640
-120;641
-121;641
-118;642
-129;643
-557;644
-130;646
-131;646
-132;646
-14;647
-1605;648
-170;648
-1625;649
-174;649
-1615;650
-1635;650
-171;650
-172;650
-173;650
-175;650
-176;650
-177;650
-179;650
-180;650
-185;650
-1603;651
-1604;651
-1613;651
-1614;651
-1623;651
-1624;651
-1633;651
-1634;651
-479;652
-181;653
-499;656
-529;656
-5105;657
-520;657
-527;657
-5125;658
-524;658
-1034;659
-1044;659
-190;659
-192;659
-194;659
-500;659
-505;659
-506;659
-509;659
-5115;659
-5135;659
-5145;659
-521;659
-522;659
-523;659
-525;659
-526;659
-528;659
-551;659
-5525;659
-555;659
-5565;659
-5566;659
-5595;659
-560;659
-561;659
-5103;660
-5104;660
-5113;660
-5114;660
-5123;660
-5124;660
-5133;660
-5134;660
-5143;660
-5144;660
-5523;660
-5524;660
-5563;660
-5564;660
-400;661
-401;661
-403;661
-404;661
-405;661
-406;661
-41;662
-438;662
-465;662
-475;662
-476;662
-477;662
-485;663
-568;663
-502;664
-507;664
-700;665
-701;665
-702;665
-703;665
-704;665
-705;665
-706;665
-708;665
-709;665
-6930;666
-71;666
-7930;666
-73;667
-600;668
-601;668
-602;668
-606;668
-607;668
-608;668
-609;668
-61;668
-6931;668
-6932;668
-6933;668
-7931;668
-7932;668
-7933;668
-740;669
-747;669
-75;669
-64;670
-62;671
-631;671
-634;671
-636;671
-639;671
-65;671
-694;671
-695;671
-794;671
-7954;671
-68;672
-746;673
-7951;674
-7952;674
-7955;674
-670;675
-671;675
-672;675
-690;675
-691;675
-692;675
-770;675
-771;675
-772;675
-790;675
-791;675
-792;675
-678;676
-778;676
-760;678
-761;678
-762;678
-769;678
-660;679
-661;679
-662;679
-665;679
-669;679
-663;680
-763;680
-668;681
-768;681
-666;682
-667;682
-673;682
-675;682
-696;682
-697;682
-698;682
-699;682
-766;682
-773;682
-775;682
-796;682
-797;682
-798;682
-799;682
-6300;683
-6301;683
-633;683
-638;683
-778;684
-701;684
-600;685
-602;685
-607;685
-621;685
-622;685
-623;685
-624;685
-625;685
-626;685
-627;685
-628;685
-629;685
-631;685
-640;685
-642;685
-662;685
-669;685
-681;685
\ No newline at end of file
+codcuenta;idbalance;restriccion
+2901;339;
+2900;339;
+2801;339;
+201;339;
+200;339;
+290;340;
+280;340;
+20;340;
+2902;341;
+2802;341;
+202;341;
+2903;343;
+2803;343;
+203;343;
+204;345;
+2906;347;
+2806;347;
+206;347;
+2905;349;
+2805;349;
+209;349;
+205;349;
+2911;351;
+2910;351;
+2811;351;
+211;351;
+210;351;
+291;352;
+281;352;
+23;352;
+21;352;
+2919;353;
+2918;353;
+2917;353;
+2916;353;
+2915;353;
+2914;353;
+2913;353;
+2912;353;
+2819;353;
+2818;353;
+2817;353;
+2816;353;
+2815;353;
+2814;353;
+2813;353;
+2812;353;
+219;353;
+218;353;
+217;353;
+216;353;
+215;353;
+214;353;
+213;353;
+212;353;
+23;355;
+2920;357;
+220;357;
+292;358;
+282;358;
+22;358;
+2921;359;
+282;359;
+221;359;
+293;361;
+2494;361;
+2493;361;
+2404;361;
+2403;361;
+2954;362;
+2953;362;
+2944;362;
+2943;362;
+293;362;
+2494;362;
+2493;362;
+2424;362;
+2423;362;
+2414;362;
+2413;362;
+2404;362;
+2403;362;
+2954;363;
+2953;363;
+2424;363;
+2423;363;
+2944;365;
+2943;365;
+2414;365;
+2413;365;
+259;371;
+250;371;
+2495;371;
+2405;371;
+298;372;
+297;372;
+2955;372;
+2945;372;
+26;372;
+259;372;
+258;372;
+257;372;
+255;372;
+254;372;
+253;372;
+252;372;
+251;372;
+250;372;
+2495;372;
+2425;372;
+2415;372;
+2405;372;
+298;373;
+2955;373;
+254;373;
+253;373;
+252;373;
+2425;373;
+297;375;
+2945;375;
+251;375;
+2415;375;
+255;377;
+26;379;
+258;379;
+474;381;
+474;382;
+599;383;
+584;383;
+583;383;
+582;383;
+581;383;
+580;383;
+599;384;
+584;384;
+583;384;
+582;384;
+581;384;
+580;384;
+390;385;
+30;385;
+407;386;
+39;386;
+36;386;
+35;386;
+34;386;
+33;386;
+32;386;
+31;386;
+30;386;
+392;387;
+391;387;
+32;387;
+31;387;
+394;389;
+393;389;
+34;389;
+33;389;
+395;391;
+35;391;
+396;393;
+36;393;
+407;395;
+4935;397;
+490;397;
+437;397;
+436;397;
+435;397;
+432;397;
+431;397;
+430;397;
+493;398;
+490;398;
+437;398;
+436;398;
+435;398;
+434;398;
+433;398;
+432;398;
+431;398;
+430;398;
+4934;399;
+4933;399;
+434;399;
+433;399;
+5580;400;
+5533;401;
+5531;401;
+44;401;
+5533;402;
+5531;402;
+544;402;
+472;402;
+471;402;
+470;402;
+460;402;
+44;402;
+544;403;
+460;403;
+4709;405;
+472;407;
+471;407;
+4708;407;
+4700;407;
+5585;409;
+5580;409;
+593;411;
+5394;411;
+5393;411;
+5304;411;
+5303;411;
+5954;412;
+5953;412;
+5944;412;
+5943;412;
+593;412;
+5394;412;
+5393;412;
+5354;412;
+5353;412;
+5344;412;
+5343;412;
+5334;412;
+5333;412;
+5324;412;
+5323;412;
+5314;412;
+5313;412;
+5304;412;
+5303;412;
+5954;413;
+5953;413;
+5344;413;
+5343;413;
+5324;413;
+5323;413;
+5944;415;
+5943;415;
+5334;415;
+5333;415;
+5314;415;
+5313;415;
+5524;419;
+5523;419;
+5354;419;
+5353;419;
+549;421;
+540;421;
+5395;421;
+5305;421;
+598;422;
+597;422;
+5955;422;
+5945;422;
+566;422;
+565;422;
+5593;422;
+5590;422;
+549;422;
+548;422;
+547;422;
+546;422;
+545;422;
+543;422;
+542;422;
+541;422;
+540;422;
+5395;422;
+5355;422;
+5345;422;
+5335;422;
+5325;422;
+5315;422;
+5305;422;
+598;423;
+5955;423;
+547;423;
+543;423;
+542;423;
+5345;423;
+5325;423;
+597;425;
+5945;425;
+546;425;
+541;425;
+5335;425;
+5315;425;
+5593;427;
+5590;427;
+566;429;
+565;429;
+550;429;
+548;429;
+545;429;
+5355;429;
+567;431;
+480;431;
+567;432;
+480;432;
+575;433;
+574;433;
+573;433;
+572;433;
+571;433;
+570;433;
+57;434;
+576;435;
+992;437;
+991;437;
+900;437;
+89;437;
+800;437;
+992;438;
+991;438;
+900;438;
+89;438;
+800;438;
+910;441;
+811;441;
+810;441;
+910;442;
+810;442;
+94;443;
+94;444;
+95;445;
+85;445;
+95;446;
+85;446;
+838;447;
+835;447;
+834;447;
+833;447;
+8300;447;
+838;448;
+835;448;
+834;448;
+833;448;
+8300;448;
+837;449;
+836;449;
+8301;449;
+837;450;
+836;450;
+8301;450;
+994;451;
+993;451;
+902;451;
+802;451;
+994;452;
+993;452;
+902;452;
+802;452;
+912;455;
+813;455;
+812;455;
+912;456;
+812;456;
+84;457;
+84;458;
+102;461;
+101;461;
+100;461;
+102;462;
+101;462;
+100;462;
+1040;463;
+1030;463;
+1040;464;
+1030;464;
+110;465;
+110;466;
+1141;467;
+112;467;
+119;468;
+115;468;
+114;468;
+113;468;
+112;468;
+119;469;
+115;469;
+1144;469;
+1143;469;
+1142;469;
+1140;469;
+113;469;
+109;471;
+108;471;
+109;472;
+108;472;
+111;473;
+111;474;
+120;475;
+121;476;
+120;476;
+121;477;
+118;479;
+118;480;
+129;481;
+129;482;
+557;483;
+557;484;
+136;485;
+133;485;
+137;486;
+1340;486;
+133;486;
+1341;487;
+1340;487;
+137;489;
+135;489;
+132;491;
+131;491;
+130;491;
+132;492;
+131;492;
+130;492;
+140;493;
+14;494;
+145;495;
+146;497;
+147;499;
+143;499;
+142;499;
+141;499;
+179;501;
+178;501;
+177;501;
+170;502;
+1605;502;
+170;503;
+1605;503;
+174;504;
+1625;504;
+174;505;
+1625;505;
+189;506;
+185;506;
+180;506;
+179;506;
+178;506;
+177;506;
+176;506;
+175;506;
+173;506;
+172;506;
+171;506;
+1635;506;
+1615;506;
+176;507;
+189;509;
+185;509;
+180;509;
+175;509;
+173;509;
+172;509;
+171;509;
+1635;509;
+1615;509;
+150;509;
+1634;511;
+1633;511;
+1624;511;
+1623;511;
+1614;511;
+1613;511;
+1604;511;
+1603;511;
+1634;512;
+1633;512;
+1624;512;
+1623;512;
+1614;512;
+1613;512;
+1604;512;
+1603;512;
+479;513;
+479;514;
+181;515;
+181;516;
+589;517;
+588;517;
+587;517;
+586;517;
+585;517;
+589;518;
+588;518;
+587;518;
+586;518;
+585;518;
+529;519;
+499;519;
+529;520;
+499;520;
+506;521;
+505;521;
+501;521;
+500;521;
+527;522;
+520;522;
+5105;522;
+527;523;
+520;523;
+5105;523;
+524;524;
+5125;524;
+524;525;
+5125;525;
+569;526;
+561;526;
+560;526;
+5598;526;
+5595;526;
+5566;526;
+5565;526;
+555;526;
+5532;526;
+5530;526;
+5525;526;
+551;526;
+528;526;
+526;526;
+525;526;
+523;526;
+522;526;
+521;526;
+5145;526;
+5135;526;
+5115;526;
+509;526;
+506;526;
+505;526;
+501;526;
+500;526;
+194;526;
+192;526;
+190;526;
+1044;526;
+1034;526;
+5598;527;
+5595;527;
+569;529;
+561;529;
+560;529;
+5566;529;
+5565;529;
+555;529;
+5532;529;
+5530;529;
+5525;529;
+551;529;
+528;529;
+526;529;
+525;529;
+523;529;
+522;529;
+521;529;
+5145;529;
+5135;529;
+5115;529;
+509;529;
+194;529;
+192;529;
+190;529;
+1044;529;
+1034;529;
+5564;531;
+5563;531;
+5144;531;
+5143;531;
+5134;531;
+5133;531;
+5124;531;
+5123;531;
+5114;531;
+5113;531;
+5104;531;
+5103;531;
+5564;532;
+5563;532;
+5524;532;
+5523;532;
+5144;532;
+5143;532;
+5134;532;
+5133;532;
+5124;532;
+5123;532;
+5114;532;
+5113;532;
+5104;532;
+5103;532;
+406;533;
+405;533;
+401;533;
+400;533;
+406;534;
+405;534;
+404;534;
+403;534;
+401;534;
+400;534;
+404;535;
+403;535;
+477;536;
+476;536;
+475;536;
+466;536;
+465;536;
+438;536;
+41;536;
+41;537;
+466;539;
+465;539;
+4752;541;
+477;543;
+476;543;
+4758;543;
+4751;543;
+4750;543;
+438;545;
+568;547;
+485;547;
+568;548;
+485;548;
+709;549;
+708;549;
+706;549;
+704;549;
+703;549;
+702;549;
+701;549;
+700;549;
+709;550;
+708;550;
+706;550;
+705;550;
+704;550;
+703;550;
+702;550;
+701;550;
+700;550;
+705;551;
+7956;553;
+7955;553;
+7952;553;
+7951;553;
+7956;554;
+7955;554;
+7952;554;
+7951;554;
+792;555;
+791;555;
+790;555;
+692;555;
+691;555;
+690;555;
+792;556;
+791;556;
+790;556;
+772;556;
+771;556;
+770;556;
+692;556;
+691;556;
+690;556;
+672;556;
+671;556;
+670;556;
+772;557;
+771;557;
+770;557;
+672;557;
+671;557;
+670;557;
+7601;559;
+7600;559;
+769;560;
+767;560;
+762;560;
+761;560;
+760;560;
+7603;561;
+7602;561;
+76211;563;
+76210;563;
+76201;563;
+76200;563;
+7611;563;
+7610;563;
+769;565;
+767;565;
+76213;565;
+76212;565;
+76203;565;
+76202;565;
+7613;565;
+7612;565;
+6655;567;
+6654;567;
+6651;567;
+6650;567;
+6641;567;
+6640;567;
+6621;567;
+6620;567;
+6616;567;
+6615;567;
+6611;567;
+6610;567;
+669;568;
+665;568;
+664;568;
+662;568;
+661;568;
+660;568;
+669;569;
+6657;569;
+6656;569;
+6653;569;
+6652;569;
+6643;569;
+6642;569;
+6624;569;
+6623;569;
+6622;569;
+6618;569;
+6617;569;
+6613;569;
+6612;569;
+660;571;
+7633;573;
+7631;573;
+7630;573;
+6633;573;
+6631;573;
+6630;573;
+763;574;
+663;574;
+7632;575;
+6632;575;
+768;577;
+668;577;
+768;578;
+799;579;
+798;579;
+797;579;
+796;579;
+699;579;
+698;579;
+697;579;
+696;579;
+799;580;
+798;580;
+797;580;
+796;580;
+775;580;
+773;580;
+766;580;
+699;580;
+698;580;
+697;580;
+696;580;
+675;580;
+668;580;
+667;580;
+666;580;
+775;581;
+773;581;
+766;581;
+675;581;
+673;581;
+667;581;
+666;581;
+638;583;
+633;583;
+6301;583;
+6300;583;
+638;584;
+633;584;
+6301;584;
+6300;584;
+7930;585;
+71;585;
+6930;585;
+7930;586;
+71;586;
+6930;586;
+73;587;
+73;588;
+610;589;
+6090;589;
+6080;589;
+6060;589;
+600;589;
+7933;590;
+7932;590;
+7931;590;
+6933;590;
+6932;590;
+6931;590;
+61;590;
+609;590;
+608;590;
+607;590;
+606;590;
+602;590;
+601;590;
+600;590;
+612;591;
+611;591;
+6092;591;
+6091;591;
+6082;591;
+6081;591;
+6062;591;
+6061;591;
+602;591;
+601;591;
+607;593;
+7933;595;
+7932;595;
+7931;595;
+6933;595;
+6932;595;
+6931;595;
+75;597;
+75;598;
+747;598;
+740;598;
+747;599;
+740;599;
+6450;601;
+641;601;
+640;601;
+64;602;
+649;603;
+643;603;
+642;603;
+7957;605;
+7950;605;
+6457;605;
+644;605;
+62;607;
+7954;608;
+794;608;
+695;608;
+694;608;
+65;608;
+639;608;
+636;608;
+634;608;
+631;608;
+62;608;
+639;609;
+636;609;
+634;609;
+631;609;
+7954;611;
+794;611;
+695;611;
+694;611;
+650;611;
+659;613;
+651;613;
+68;615;
+68;616;
+746;617;
+746;618;
+20;621;
+280;621;
+290;621;
+21;622;
+281;622;
+291;622;
+23;622;
+22;623;
+282;623;
+292;623;
+2403;624;
+2404;624;
+2413;624;
+2414;624;
+2423;624;
+2424;624;
+2493;624;
+2494;624;
+2933;624;
+2934;624;
+2943;624;
+2944;624;
+2953;624;
+2954;624;
+2405;625;
+2415;625;
+2425;625;
+2495;625;
+250;625;
+251;625;
+252;625;
+253;625;
+254;625;
+255;625;
+258;625;
+259;625;
+26;625;
+2935;625;
+2945;625;
+2955;625;
+296;625;
+297;625;
+298;625;
+474;626;
+;627;
+30;628;
+31;628;
+32;628;
+33;628;
+34;628;
+35;628;
+36;628;
+39;628;
+407;628;
+430;629;
+431;629;
+432;629;
+433;629;
+434;629;
+435;629;
+436;629;
+437;629;
+490;629;
+493;629;
+5580;630;
+44;631;
+460;631;
+470;631;
+471;631;
+472;631;
+544;631;
+5303;632;
+5304;632;
+5313;632;
+5314;632;
+5323;632;
+5324;632;
+5333;632;
+5334;632;
+5343;632;
+5344;632;
+5353;632;
+5354;632;
+5393;632;
+5394;632;
+5523;632;debe
+5524;632;debe
+5933;632;
+5934;632;
+5943;632;
+5944;632;
+5953;632;
+5954;632;
+5305;633;
+5315;633;
+5325;633;
+5335;633;
+5345;633;
+5355;633;
+5395;633;
+540;633;
+541;633;
+542;633;
+543;633;
+545;633;
+546;633;
+547;633;
+548;633;
+549;633;
+551;633;debe
+5525;633;debe
+5590;633;
+565;633;
+566;633;
+5935;633;
+5945;633;
+5955;633;
+596;633;
+597;633;
+598;633;
+480;634;
+567;634;
+57;635;
+100;636;
+101;636;
+102;636;
+1030;637;
+1040;637;
+110;638;
+112;639;
+113;639;
+114;639;
+119;639;
+108;640;
+109;640;
+120;641;
+121;641;
+118;642;
+129;643;
+557;644;
+130;646;
+131;646;
+132;646;
+14;647;
+1605;648;
+170;648;
+1625;649;
+174;649;
+1615;650;
+1635;650;
+171;650;
+172;650;
+173;650;
+175;650;
+176;650;
+177;650;
+179;650;
+180;650;
+185;650;
+1603;651;
+1604;651;
+1613;651;
+1614;651;
+1623;651;
+1624;651;
+1633;651;
+1634;651;
+479;652;
+181;653;
+499;656;
+529;656;
+5105;657;
+520;657;
+527;657;
+5125;658;
+524;658;
+1034;659;
+1044;659;
+190;659;
+192;659;
+194;659;
+500;659;
+505;659;
+506;659;
+509;659;
+5115;659;
+5135;659;
+5145;659;
+521;659;
+522;659;
+523;659;
+525;659;
+526;659;
+528;659;
+551;659;haber
+5525;659;haber
+555;659;
+5565;659;
+5566;659;
+5595;659;
+560;659;
+561;659;
+5103;660;
+5104;660;
+5113;660;
+5114;660;
+5123;660;
+5124;660;
+5133;660;
+5134;660;
+5143;660;
+5144;660;
+5523;660;haber
+5524;660;haber
+5563;660;
+5564;660;
+400;661;
+401;661;
+403;661;
+404;661;
+405;661;
+406;661;
+41;662;
+438;662;
+465;662;
+475;662;
+476;662;
+477;662;
+485;663;
+568;663;
+502;664;
+507;664;
+700;665;
+701;665;
+702;665;
+703;665;
+704;665;
+705;665;
+706;665;
+708;665;
+709;665;
+6930;666;
+71;666;
+7930;666;
+73;667;
+600;668;
+601;668;
+602;668;
+606;668;
+607;668;
+608;668;
+609;668;
+61;668;
+6931;668;
+6932;668;
+6933;668;
+7931;668;
+7932;668;
+7933;668;
+740;669;
+747;669;
+75;669;
+64;670;
+62;671;
+631;671;
+634;671;
+636;671;
+639;671;
+65;671;
+694;671;
+695;671;
+794;671;
+7954;671;
+68;672;
+746;673;
+7951;674;
+7952;674;
+7955;674;
+670;675;
+671;675;
+672;675;
+690;675;
+691;675;
+692;675;
+770;675;
+771;675;
+772;675;
+790;675;
+791;675;
+792;675;
+678;676;
+778;676;
+760;678;
+761;678;
+762;678;
+769;678;
+660;679;
+661;679;
+662;679;
+665;679;
+669;679;
+663;680;
+763;680;
+668;681;
+768;681;
+666;682;
+667;682;
+673;682;
+675;682;
+696;682;
+697;682;
+698;682;
+699;682;
+766;682;
+773;682;
+775;682;
+796;682;
+797;682;
+798;682;
+799;682;
+6300;683;
+6301;683;
+633;683;
+638;683;
+778;684;
+701;684;
+600;685;
+602;685;
+607;685;
+621;685;
+622;685;
+623;685;
+624;685;
+625;685;
+626;685;
+627;685;
+628;685;
+629;685;
+631;685;
+640;685;
+642;685;
+662;685;
+669;685;
+681;685;
diff --git a/Init.php b/Init.php
index ce81e0c..fd399e4 100644
--- a/Init.php
+++ b/Init.php
@@ -57,10 +57,37 @@ public function update(): void
$this->migrateOldBalances();
$this->migrateOldReports();
+ // rellenamos la restricción en las cuentas duplicadas de pymes de instalaciones ya existentes
+ $this->fillAccountsRestriccion();
+
// crea el role y permisos del plugin
$this->createRoleForPlugin();
}
+ private function fillAccountsRestriccion(): void
+ {
+ $db = new DataBase();
+ if (false === $db->tableExists('balance_accounts') || false === $db->tableExists('balance_codes')) {
+ return;
+ }
+
+ $restrictions = [
+ 'A-B-III' => ['debe', ['5523', '5524']],
+ 'A-B-IV' => ['debe', ['551', '5525']],
+ 'P-C-II-3' => ['haber', ['551', '5525']],
+ 'P-C-III' => ['haber', ['5523', '5524']],
+ ];
+
+ foreach ($restrictions as $codbalance => [$restriccion, $accounts]) {
+ $accountsList = implode(',', array_map([$db, 'var2str'], $accounts));
+ $sql = 'UPDATE balance_accounts SET restriccion = ' . $db->var2str($restriccion)
+ . ' WHERE (restriccion IS NULL OR restriccion = \'\')'
+ . ' AND codcuenta IN (' . $accountsList . ')'
+ . ' AND idbalance IN (SELECT id FROM balance_codes WHERE subtype = \'pymes\' AND codbalance = ' . $db->var2str($codbalance) . ');';
+ $db->exec($sql);
+ }
+ }
+
private function createRoleForPlugin(): void
{
// force table checks for Role and RoleAccess
diff --git a/Lib/Accounting/BalanceSheet.php b/Lib/Accounting/BalanceSheet.php
index 10e0759..4bbc0b7 100644
--- a/Lib/Accounting/BalanceSheet.php
+++ b/Lib/Accounting/BalanceSheet.php
@@ -243,6 +243,11 @@ protected function getAccountAmounts(BalanceCode $balance, BalanceAccount $model
}
}
+ if (false === $model->matchesRestriction($debe, $haber)) {
+ $this->amounts[$key] = 0.00;
+ return 0.00;
+ }
+
$total = $balance->calculate($debe, $haber);
$this->amounts[$key] = $total;
return $total;
diff --git a/Model/BalanceAccount.php b/Model/BalanceAccount.php
index c62678b..bb4695d 100644
--- a/Model/BalanceAccount.php
+++ b/Model/BalanceAccount.php
@@ -45,6 +45,23 @@ class BalanceAccount extends ModelClass
/** @var int */
public $idbalance;
+ /** @var string */
+ public $restriccion;
+
+ public function matchesRestriction(float $debe, float $haber): bool
+ {
+ switch ($this->restriccion) {
+ case 'debe':
+ return $debe > $haber;
+
+ case 'haber':
+ return $haber > $debe;
+
+ default:
+ return true;
+ }
+ }
+
public function getBalanceCode(): BalanceCode
{
$balanceCode = new DinBalanceCode();
@@ -86,6 +103,7 @@ public function test(): bool
// escapamos el html
$this->codcuenta = Tools::noHtml($this->codcuenta);
$this->desccuenta = Tools::noHtml($this->desccuenta);
+ $this->restriccion = Tools::noHtml($this->restriccion);
return parent::test();
}
diff --git a/Table/balance_accounts.xml b/Table/balance_accounts.xml
index 3ee958e..fd55e5a 100644
--- a/Table/balance_accounts.xml
+++ b/Table/balance_accounts.xml
@@ -25,6 +25,10 @@
integer
NO
+
+ restriccion
+ character varying(10)
+
balancescuentas_pkey
PRIMARY KEY (id)
diff --git a/Translation/es_ES.json b/Translation/es_ES.json
index 8bc8223..d190f97 100644
--- a/Translation/es_ES.json
+++ b/Translation/es_ES.json
@@ -235,6 +235,7 @@
"report-transport-p": "Este informe permite obtener el listado de cantidades y productos a cargar por un transportista seleccionado",
"reports-board": "Pizarra",
"reserves-results-exercises": "Reservas + Resultados ejercicios",
+ "restriction": "Restricción",
"result-after-taxes-rdi": "Resultado después de impuesto RDI",
"result-before-taxes-rai": "Resultado antes de impuesto RAI",
"result-exploitation": "Resultado de explotación",
diff --git a/XMLView/EditBalanceAccount.xml b/XMLView/EditBalanceAccount.xml
index 0094565..3b539cb 100644
--- a/XMLView/EditBalanceAccount.xml
+++ b/XMLView/EditBalanceAccount.xml
@@ -33,6 +33,12 @@
+
+
+ debe
+ haber
+
+
\ No newline at end of file