Code_C_Calculette_CFE_2021.c 70.4 KB
Newer Older
bureau.si-pro-dap3 dgfip's avatar
bureau.si-pro-dap3 dgfip committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <stdio.h>
#include <math.h>
#include <string.h>


#include "cfe-struc.h"

#define	TRUE	1
#define	FALSE	0



static double arrondi (double donn)
{
	donn=floor(donn + 0.5);
	return donn;
}


static double CalcUneecotis(double ebase,double etaux)
{
	double prod;
	prod=arrondi(ebase*etaux/100000/100);
	return prod;
}


short cfecalc2021 (struct e1 *etaux,struct e2 *ebase,struct e3 *eindic,struct s1 *ecotis, FILE *efrescc)


{
double  NbAnLis  =  5;
double	avfr ;
double  tp;
double	cnp;
double  frais;
double  zttpxc;
double  zztpxc;
double  cbmincne;
double  zttpxs;
double  zztpxs;
double  cbminsy;
double  zttpxe;
double  zztpxe;
double  cbminepci;
double  zttpxt;
double  zztpxt;
double  cbmintse;
double  cexmapi;
double  cexmapicvae;
double  cbminmapi;
double  cextasa;
double  cextasacvae;
double  cbmintasa;
double  zttpxf;
double  zztpxf;
double  fraisbmin;
double  basemini;
double  zonea;
double  zoneaC;
double  zoneaE;
double  zoneavC;
double  zoneavE;
double  zoneb;
double  zonebC;
double  zonebE;
double  zonebvC;
double  zonebvE;
double  zonec;
double  zoned;
double  zonee;
double  zonef;
double  zoneg;
double  zoneh;
double  drfixe;
double  farexo;
double  fdnvexo;
short	trace			=	FALSE;
short	corse			=	FALSE;
short	alsace_moselle	=	FALSE;
short	depdom			=	FALSE;
short	moselle			=	FALSE;
short	grand_lyon   	=	FALSE;
short	st_mart     	=	FALSE;
short   non_auto_entr   =   FALSE;
short   df_seul         =   FALSE;
double	tcm;
double  zttpx;
double  zztpx;
double  F1_cne;
double  F2_cne;
double  F1_epci;
double  F2_epci;
double  DegExoC;
double  DegExoE;
double  DegExocvaeC;
double  DegExocvaeE;

char naf[39][6]=
{
"4939C",
"5030Z",
"5110Z",
"5510Z",
"5520Z",
"5530Z",
"5610A",
"5610B",
"5610C",
"5621Z",
"5629A",
"5629B",
"5630Z",
"5911A",
"5911B",
"5911C",
"5914Z",
"7420Z",
"7721Z",
"7911Z",
"7912Z",
"7990Z",
"8230Z",
"8551Z",
"8552Z",
"9001Z",
"9002Z",
"9003A",
"9004Z",
"9102Z",
"9103Z",
"9104Z",
"9311Z",
"9312Z",
"9313Z",
"9319Z",
"9321Z",
"9329Z",
"9604Z"
};
int i;
short	DegrevementNaf =	FALSE;
const double  LimiteCA = 1.50000000e8;



       avfr=0;
	   tp=0;
	   cnp=0;
	   frais=0;

if (strncmp(eindic->c_csdi,"2A0",sizeof(eindic->c_csdi)) == 0 ||
	strncmp(eindic->c_csdi,"2B0",sizeof(eindic->c_csdi)) == 0 )
{
	corse=TRUE;
}

if (strncmp(eindic->c_csdi,"971",sizeof(eindic->c_csdi)) == 0 &&
	strncmp(eindic->c_ctcn,"127",sizeof(eindic->c_ctcn)) == 0 )
{
	st_mart=TRUE;
}

if (strncmp(eindic->c_csdi,"690",sizeof(eindic->c_csdi)) == 0 &&
	strncmp(eindic->c_ctcngr,"300",sizeof(eindic->c_ctcngr)) == 0 )
{
	grand_lyon=TRUE;
}

trace = (efrescc && eindic &&  1 == eindic->s_zttpzz);

if (strncmp(eindic->c_csdi,"570",sizeof(eindic->c_csdi))==0 ||
	strncmp(eindic->c_csdi,"670",sizeof(eindic->c_csdi))==0 ||
	strncmp(eindic->c_csdi,"680",sizeof(eindic->c_csdi))==0 )
{
	alsace_moselle=TRUE;
}

if (strncmp(eindic->c_csdi,"570",sizeof(eindic->c_csdi))==0 )
{
	moselle=TRUE;
}

if (strncmp(eindic->c_csdi,"971",sizeof(eindic->c_csdi))==0 ||
	strncmp(eindic->c_csdi,"972",sizeof(eindic->c_csdi))==0 ||
	strncmp(eindic->c_csdi,"973",sizeof(eindic->c_csdi))==0 ||
	strncmp(eindic->c_csdi,"974",sizeof(eindic->c_csdi))==0 )
{
	depdom=TRUE;
}

if  ((eindic->s_zteice != 0) || (eindic->d_zteimi == 0 || eindic->c_cieimi != "1"))	
{
	non_auto_entr=TRUE;
}

if (strncmp(eindic->c_cicos,"1",sizeof(eindic->c_cicos))==0)
{
	df_seul=TRUE;
}

for (i=0 ; !DegrevementNaf && i<NbNaf+1 ; i++)
	DegrevementNaf = strncmp(eindic->c_cnac3,naf[i],sizeof(eindic->c_cnac3))==0;
DegrevementNaf = DegrevementNaf && (eindic->d_ztet47 < LimiteCA);


if (trace)
{
	fprintf (efrescc," [- CFECALC2021.C debut -]\n");
	fprintf (efrescc," ************************\n");
	if (grand_lyon)
	{
		fprintf (efrescc,"GRAND LYON\n");
		fprintf (efrescc,"DIRECTION\n");
		fprintf (efrescc,"		c_csdi =%s\n",eindic->c_csdi);
		fprintf (efrescc,"CTCNGR\n");
		fprintf (efrescc,"		c_ctcngr =%s\n",eindic->c_ctcngr);
	}
	else
    {
		fprintf (efrescc,"PAS GRAND LYON\n");
		fprintf (efrescc,"DIRECTION\n");
		fprintf (efrescc,"		c_csdi =%s\n",eindic->c_csdi);
		fprintf (efrescc,"CTCNGR\n");
		fprintf (efrescc,"		c_ctcngr =%s\n",eindic->c_ctcngr);
	}
}




if (df_seul)
{
	if (trace)
	{
		fprintf (efrescc,"********************************\n");
		fprintf (efrescc,"B. IMPOSITION AU DROIT FIXE SEUL\n");
		fprintf (efrescc,"********************************\n");
		fprintf (efrescc," INDICATEUR DROIT FIXE SEUL\n");
		fprintf (efrescc,"		 c_cicos=%s\n",eindic->c_cicos);
		fprintf (efrescc," CODE DIRECTION\n");
		fprintf (efrescc,"		c_csdi=%s\n",eindic->c_csdi);
	}

    if  (non_auto_entr)
	{	
	    ecotis->d_ztchma=etaux->s_ztchdf;
		if (trace)
		{
			fprintf (efrescc,"	a. Indicateurs auto-entrepreneur(s_zteice)(d_zteimi) (c_cieimi) \n");
			fprintf (efrescc,"   ***   \n");
			fprintf (efrescc,"		s_zteice =%d\n",eindic->s_zteice);
			fprintf (efrescc,"		d_zteimi =%.0f\n",eindic->d_zteimi);
			fprintf (efrescc,"		c_cieimi =%s\n",eindic->c_cieimi);
			fprintf (efrescc,"     1*  Non Auto-entrepreneur Montant cotisation avant frais (D_ZTCHMA)\n");
			fprintf (efrescc,"     *   \n");
			fprintf (efrescc,"		d_ztchma =(%d)\n",etaux->s_ztchdf);
			fprintf (efrescc,"		D_ZTCHMA =%.0f\n",ecotis->d_ztchma);
		}
	}

	if (!alsace_moselle)
	{
		ecotis->d_zzchma=arrondi(ecotis->d_ztchma*0.054);
		ecotis->d_zzchmd=arrondi(ecotis->d_ztchma*0.036);
		if (trace)
		{
			fprintf (efrescc,"	FAR TCMA	- Autres departements\n");
			fprintf (efrescc,"	   FAR TCMA =5,4%% de la cotisation avant frais\n");
			fprintf (efrescc,"		D_ZZCHMA= arrondi(%.0f x 5,4%%)\n",ecotis->d_ztchma);
			fprintf (efrescc,"	FDNV TCMA	- Autres departements\n");
			fprintf (efrescc,"	   FDNV TCMA =3,6%% de la cotisation avant frais\n");
			fprintf (efrescc,"		D_ZZCHMD= arrondi(%.0f x 3,6%%)\n",ecotis->d_ztchma);
		}
	}

	if (alsace_moselle)
	{
		ecotis->d_zzchma=arrondi(ecotis->d_ztchma*3/100);
		ecotis->d_zzchmd=arrondi(ecotis->d_ztchma*5/100);
		if (trace)
		{
			fprintf (efrescc,"   FAR TCMA	- Departements d'Alsace-Moselle (570,670 et 680)\n");
			fprintf (efrescc,"		*FAR TCMA = 3%% de la cotisation avant frais\n");
			fprintf (efrescc,"		D_ZZCHMA= arrondi(%.0f x 3%%)\n",ecotis->d_ztchma);
			fprintf (efrescc,"   FDNV TCMA	- Departements d'Alsace-Moselle (570,670 et 680)\n");
			fprintf (efrescc,"		*FDNV TCMA = 5%% de la cotisation avant frais\n");
			fprintf (efrescc,"		D_ZZCHMD= arrondi(%.0f x 5%%)\n",ecotis->d_ztchma);
		}
	}
	
	ecotis->d_ztchm=ecotis->d_ztchma+ecotis->d_zzchma+ecotis->d_zzchmd;
	ecotis->d_zttpct=ecotis->d_ztchm;
	ecotis->d_zttpcp=ecotis->d_ztchm;
	if (trace)
	{
		fprintf (efrescc,"	c. Montant cotisation apres frais (D_ZTCHM)\n");
		fprintf (efrescc,"   ***   \n");
		fprintf (efrescc,"		*cotisation TCM apres frais=somme de la cotisation avant frais et des frais de\n");
		fprintf (efrescc,"     		gestion\n");
		fprintf (efrescc,"		 D_ZTCHM= %.0f + %.0f + %.0f \n",ecotis->d_ztchma,ecotis->d_zzchma,ecotis->d_zzchmd);
		fprintf (efrescc,"		 D_ZTCHM=%.0f\n",ecotis->d_ztchm);
		fprintf (efrescc,"		*cotisation mise en recouvrement=Somme a payer=cotisation apres frais de\n");
		fprintf (efrescc,"     	gestion\n");
		fprintf (efrescc,"		 D_ZTTPCT=%.0f\n",ecotis->d_zttpct);
		fprintf (efrescc,"		Somme a payer D_ZTTPCP=%.0f\n",ecotis->d_zttpcp);
		fprintf (efrescc,"	    FIN    					\n");
	}
return 0;
	
}

if (trace)
{
	fprintf (efrescc,"C. IMPOSITION << NORMALE >>\n");
	fprintf (efrescc,"****************************\n");
	fprintf (efrescc,"   ***   \n");
}

if (!st_mart)
{
	basemini = 0;
	if (corse)
	{
		basemini=arrondi(etaux->d_ztbsbm * 0.75);
		if (trace)
		{
			fprintf (efrescc,"		a) Departements de Corse (2A0 et 2B0)\n");
			fprintf (efrescc,"		*Base de cotisation minimale=75%% de la base \n");
			fprintf (efrescc,"		d_ztbsbm=arrondi(%.0f x 75%%)\n",etaux->d_ztbsbm);
		}
	}
	else
	{
		basemini = etaux->d_ztbsbm;
		if (trace)
		{
			fprintf (efrescc,"		b) Autres departements \n");
			fprintf (efrescc,"		*Base de cotisation minimale=84%% de la base apres base mini\n");
			fprintf (efrescc,"		d_ztbsbm=%.0f \n",etaux->d_ztbsbm);
		}
	}


	zttpxc = 0;
	zztpxc = 0;
	cbmincne = 0;
	ecotis->d_ztcnct=CalcUneecotis(ebase->d_ztbsco,etaux->d_ztcntp);
	zttpxc=CalcUneecotis(ebase->d_zzcnex,etaux->d_ztcntp);
	zztpxc=CalcUneecotis(ebase->d_zxcnex,etaux->d_ztcntp);
	cbmincne=CalcUneecotis(basemini,etaux->d_ztcntp);
	if (trace)
	{
		fprintf (efrescc,"   ***   \n");
		fprintf (efrescc,"	1. cotisations commune(d_ztcnct),cotisation exoneree commune(zttpxc)\n");
		fprintf (efrescc,"   ***   \n");
		fprintf (efrescc,"	* cotisation commune=produit de la ebase taxable commune par le etaux de\n");
		fprintf (efrescc,"     	taxation commune divise par 10 000 000\n");
		fprintf (efrescc,"	 d_ztcnct=CalcUneecotis(%.0f,%.0f)\n",ebase->d_ztbsco,etaux->d_ztcntp);
		fprintf (efrescc,"	 D_ZTCNCT=%.0f\n",ecotis->d_ztcnct);
		fprintf (efrescc,"	* cotisation exoneree commune =produit de la ebase exoneree commune par le etaux de\n");
		fprintf (efrescc,"     	taxation commune divise par 10 000 000\n");
		fprintf (efrescc,"	 zttpxc=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zzcnex,etaux->d_ztcntp);
		fprintf (efrescc,"	 zttpxc=%.0f\n",zttpxc);
		fprintf (efrescc,"	* cotisation exoneree commune CVAE=produit de la ebase exoneree commune CVAE par le etaux \n");
		fprintf (efrescc,"     	de taxation commune divise par 10 000 000\n");
		fprintf (efrescc,"	1. cotisations  exoneree commune CVAE(zztpxc)\n");
		fprintf (efrescc,"	 zztpxc=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zxcnex,etaux->d_ztcntp);
		fprintf (efrescc,"	 zztpxc=%.0f\n",zztpxc);
		fprintf (efrescc,"	* cotisation sur ebase minimum cne =produit de la ebase minimum commune par le etaux de\n");
		fprintf (efrescc,"     	taxation commune divise par 10 000 000\n");
		fprintf (efrescc,"	1. cotisations sur ebase minimum commune(cbmincne)\n");
		fprintf (efrescc,"	 cbmincne=CalcUneecotis(%.0f,%.0f)\n",basemini,etaux->d_ztcntp);
		fprintf (efrescc,"	 CBMINCNE=%.0f\n",cbmincne);
	}

	zttpxs = 0;
	zztpxs = 0;
	cbminsy = 0;
	if (etaux->d_ztcnsy > 0)
	{
		ecotis->d_ztcncs=CalcUneecotis(ebase->d_ztbsco,etaux->d_ztcnsy);
		zttpxs=CalcUneecotis(ebase->d_zzcnex,etaux->d_ztcnsy);
		zztpxs=CalcUneecotis(ebase->d_zxcnex,etaux->d_ztcnsy);
		cbminsy=CalcUneecotis(basemini,etaux->d_ztcnsy);
		if (trace)
		{
			fprintf (efrescc,"   ***   \n");
			fprintf (efrescc,"	1.2 cotisations syndicat(d_ztcncs),cotisation exoneree syndicat(zttpxs)\n");
			fprintf (efrescc,"   ***   \n");
			fprintf (efrescc,"	* cotisation syndicat=produit de la ebase taxable syndicale par le etaux de\n");
			fprintf (efrescc,"     	taxation syndicat divise par 10 000 000\n");
			fprintf (efrescc,"	 d_ztcncs=CalcUneecotis(%.0f,%.0f)\n",ebase->d_ztbsco,etaux->d_ztcnsy);
			fprintf (efrescc,"	 D_ZTCNCS=%.0f\n",ecotis->d_ztcncs);
			fprintf (efrescc,"	* cotisation exoneree syndicat =produit de la ebase exoneree commune par le etaux de\n");
			fprintf (efrescc,"     	taxation syndicat divise par 10 000 000\n");
			fprintf (efrescc,"	 zttpxs=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zzcnex,etaux->d_ztcnsy);
			fprintf (efrescc,"	 zttpxs=%.0f\n",zttpxs);
			fprintf (efrescc,"	* cotisation exoneree syndicat CVAE=produit de la ebase exoneree commune CVAE par le\n");
			fprintf (efrescc,"     	etaux de taxation syndicat divise par 10 000 000\n");
			fprintf (efrescc,"	1. cotisations  exoneree syndicat CVAE(zztpxs)\n");
			fprintf (efrescc,"	 zztpxs=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zxcnex,etaux->d_ztcnsy);
			fprintf (efrescc,"	 zztpxs=%.0f\n",zztpxs);
			fprintf (efrescc,"	*1.3.cotisation sur ebase minimum syndicat =produit de la ebase minimum syndicat par le etaux de\n");
			fprintf (efrescc,"     	taxation syndicat divise par 10 000 000\n");
			fprintf (efrescc,"	 cbminsy=CalcUneecotis(%.0f,%.0f)\n",basemini,etaux->d_ztcnsy);
			fprintf (efrescc,"	 CBMINSY=%.0f\n",cbminsy);
		}
	}


	if (trace)
	{
		fprintf (efrescc,"          ***   \n");
	    fprintf (efrescc,"	    	*indicateur code TSE(s_ztcnep) \n");
		fprintf (efrescc,"		 s_ztcnep=%d\n",eindic->s_ztcnep);
		fprintf (efrescc,"******************************************** \n");
	}
	ecotis->d_ztcnce = 0;
	zttpxt = 0;
	zztpxt= 0;
	ecotis->d_zttpgp = 0;
	zttpxt = 0;
	zztpxt = 0;
	cbmintse = 0;
	if (eindic->s_ztcnep == 1)
	{
		if (trace)
		{
			fprintf (efrescc,"   ***   \n");
			fprintf (efrescc,"	2. TAUX TSE (D_ZTCH,)\n");
			fprintf (efrescc,"   ***   \n");
			fprintf (efrescc,"		*Taux TSE=Taux TSE - Taux TASARIF\n");
			fprintf (efrescc,"		 d_ztch=%.0f-%.0f)\n",etaux->d_ztch,etaux->d_ztcht3);
		}
		etaux->d_ztch=etaux->d_ztch-etaux->d_ztcht3;
		ecotis->d_ztcnce=CalcUneecotis(ebase->d_ztbsts,etaux->d_ztch);
		if (trace)
		{
  			fprintf (efrescc,"		 D_ZTCH=%.0f\n",etaux->d_ztch);
			fprintf (efrescc,"   ***   \n");
			fprintf (efrescc,"	2. cotisations TSE (D_ZTCNCE,)\n");
			fprintf (efrescc,"   ***   \n");
			fprintf (efrescc,"		* cotisation TSE=produit de la ebase TSE par le etaux de taxation TSE\n");
			fprintf (efrescc,"     		divise par 10 000 000\n");
			fprintf (efrescc,"		 d_ztcnce=CalcUneecotis(%.0f,%.0f)\n",ebase->d_ztbsts,etaux->d_ztch);
			fprintf (efrescc,"		 D_ZTCNCE=%.0f\n",ecotis->d_ztcnce);
		}

		if (trace)
		{
			fprintf (efrescc,"  ***   \n");
			fprintf (efrescc,"	 cotisations exoneree TSE (zttpxt) \n");
			fprintf (efrescc,"		*** INDICATEURS***\n");
			fprintf (efrescc,"		*****************\n");
			fprintf (efrescc,"		 C_CICUU=%s\n",etaux->c_cicuu);
			fprintf (efrescc,"		***\n");
			fprintf (efrescc,"		*** ZONE        ***\n");	
			fprintf (efrescc,"		 C_CIETZ=%s\n",eindic->c_cietz);
			fprintf (efrescc,"		*****************\n");
		}
		if ((strncmp(etaux->c_cicuu,"U",sizeof(etaux->c_cicuu)) == 0) || (strncmp(eindic->c_cietz, "Z",sizeof(eindic->c_cietz)) == 0) || (strncmp(eindic->c_cietz, "O",sizeof(eindic->c_cietz)) == 0))
		{
			zttpxt=CalcUneecotis(ebase->d_zzcuex,etaux->d_ztch);
			zztpxt=CalcUneecotis(ebase->d_zxcuex,etaux->d_ztch);
			if (trace)
			{
				fprintf (efrescc,"	 *cotisation exoneree tse =produit de la ebase exoneree epci par le etaux de\n");
				fprintf (efrescc,"     	taxation tse divise par 10 000 000\n");
				fprintf (efrescc,"	 zttpxt=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zzcuex,etaux->d_ztch);
				fprintf (efrescc,"	 zttpxt=%.0f\n",zttpxt);
				fprintf (efrescc,"	 *cotisation exoneree tse cvae =produit de la ebase exoneree epci cvae par\n");
				fprintf (efrescc,"     	le etaux de taxation tse divise par 10 000 000\n");
				fprintf (efrescc,"	 zztpxt=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zxcuex,etaux->d_ztch);
				fprintf (efrescc,"	 zztpxt=%.0f\n",zztpxt);
			}
		}
		else
		{
		    zttpxt=CalcUneecotis(ebase->d_zzcnex,etaux->d_ztch);
			zztpxt=CalcUneecotis(ebase->d_zxcnex,etaux->d_ztch);
			if (trace)
			{
				fprintf (efrescc,"	 *cotisation exoneree tse =produit de la ebase exoneree epci par le etaux de\n");
				fprintf (efrescc,"     	taxation tse divise par 10 000 000\n");
				fprintf (efrescc,"	 zttpxt=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zzcnex,etaux->d_ztch);
				fprintf (efrescc,"	 zttpxt=%.0f\n",zttpxt);
				fprintf (efrescc,"	 *cotisation exoneree tse cvae =produit de la ebase exoneree epci cvae par\n");
				fprintf (efrescc,"     	le etaux de taxation tse divise par 10 000 000\n");
				fprintf (efrescc,"	 zztpxt=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zxcnex,etaux->d_ztch);
				fprintf (efrescc,"	 zztpxt=%.0f\n",zztpxt);
			}
		}

		cbmintse=CalcUneecotis(basemini,etaux->d_ztch);
		if (trace)
		{
			fprintf (efrescc,"	*cotisation sur ebase minimum TSE =produit de la ebase minimum TSE par le etaux de\n");
			fprintf (efrescc,"     	taxation tse divise par 10 000 000\n");
			fprintf (efrescc,"	Cotisations sur ebase minimum TSE(cbmintse)\n");
			fprintf (efrescc,"	 cbmintse=CalcUneecotis(%.0f,%.0f)\n",basemini,etaux->d_ztch);
			fprintf (efrescc,"	 CBMINTSE=%.0f\n",cbmintse);
		}

		ecotis->d_zttpgp=CalcUneecotis(ebase->d_ztbsts,etaux->d_ztchgp);
		if (trace)
		{
			fprintf (efrescc,"	Cotisations  TSE Grand Paris (D_ZTTPGP)\n");
			fprintf (efrescc,"	 d_zttpgp=CalcUneecotis(%.0f,%.0f)\n",ebase->d_ztbsts,etaux->d_ztchgp);
			fprintf (efrescc,"	 D_ZTTPGP=%.0f\n",ecotis->d_zttpgp);
		}
	}

	cextasa = 0;
	cextasacvae = 0;
	cbmintasa= 0;
	cexmapi = 0;
	cexmapicvae = 0;
	cbminmapi = 0;
	if (trace)
	{
		fprintf (efrescc,"          ***   \n");
	    fprintf (efrescc,"	    	*indicateur code TSE(s_ztcnep) \n");
		fprintf (efrescc,"		 s_ztcnep=%d\n",eindic->s_ztcnep);
		fprintf (efrescc,"******************************************** \n");
	}
	if  (eindic->s_ztcnep == 1)
	{
		ecotis->d_ztrgif=CalcUneecotis(ebase->d_ztbsif,etaux->d_ztcht3);
		if (trace)
		{
			fprintf (efrescc,"	 *cotisation TASARIF=produit de la ebase tasarif par le etaux\n");
			fprintf (efrescc,"     	de taxation TASARIF divise par 10 000 000\n");
			fprintf (efrescc,"	 ecotis->d_ztrgif=CalcUneecotis(%.0f,%.0f)\n",ebase->d_ztbsif,etaux->d_ztcht3);
			fprintf (efrescc,"	 D_ZTRGIF=%.0f\n",ecotis->d_ztrgif);
		}

		if ((strncmp(etaux->c_cicuu,"U",sizeof(etaux->c_cicuu)) == 0) || (strncmp(eindic->c_cietz, "Z",sizeof(eindic->c_cietz)) == 0) || (strncmp(eindic->c_cietz, "O",sizeof(eindic->c_cietz)) == 0))
		{
			cextasa=CalcUneecotis(ebase->d_zzcuex,etaux->d_ztcht3);
			cextasacvae=CalcUneecotis(ebase->d_zxcuex,etaux->d_ztcht3);
			if (trace)
			{
				fprintf (efrescc,"	 *cotisation exoneree TASARIF =produit de la ebase TASARIF par le etaux de\n");
				fprintf (efrescc,"     	taxation TASARIF divise par 10 000 000\n");
				fprintf (efrescc,"	 cextasa=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zzcuex,etaux->d_ztcht3);
				fprintf (efrescc,"	 CEXTASA=%.0f\n",cextasa);
				fprintf (efrescc,"	 *cotisation exoneree TASARIF CVAE=produit de la ebase exoneree TASARIF cvae par\n");
				fprintf (efrescc,"     	le etaux de taxation TASARIF divise par 10 000 000\n");
				fprintf (efrescc,"	 cextasacvae=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zxcuex,etaux->d_ztcht3);
				fprintf (efrescc,"	 CEXTASACVAE=%.0f\n",cextasacvae);
			}
		}
		else
		{
			cextasa=CalcUneecotis(ebase->d_zzcnex,etaux->d_ztcht3);
			cextasacvae=CalcUneecotis(ebase->d_zxcnex,etaux->d_ztcht3);
			if (trace)
			{
				fprintf (efrescc,"	 *cotisation exoneree TASARIF =produit de la ebase exoneree commune par le etaux de\n");
				fprintf (efrescc,"     	taxation TASARIF divise par 10 000 000\n");
				fprintf (efrescc,"	 cextasa=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zzcnex,etaux->d_ztcht3);
				fprintf (efrescc,"	 CEXTASA=%.0f\n",cextasa);
				fprintf (efrescc,"	 *cotisation exoneree TASARIF cvae=produit de la ebase exoneree commune cvae par le etaux\n");
				fprintf (efrescc,"     	de taxation TASARIF divise par 10 000 000\n");
				fprintf (efrescc,"	 cextasacvae=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zxcnex,etaux->d_ztcht3);
				fprintf (efrescc,"	 CEXTASACVAE=%.0f\n",cextasacvae);
			}
		}

		cbmintasa=CalcUneecotis(basemini,etaux->d_ztcht3);
		if (trace)
		{
			fprintf (efrescc,"	*cotisation sur ebase minimum TASARIF =produit de la ebase minimum TASARIF par le etaux de\n");
			fprintf (efrescc,"     	taxation TASARIF divise par 10 000 000\n");
			fprintf (efrescc,"	Cotisations sur ebase minimum TASARIF(cbmintasa)\n");
			fprintf (efrescc,"	 cbmintasa=CalcUneecotis(%.0f,%.0f)\n",basemini,etaux->d_ztcht3);
			fprintf (efrescc,"	 CBMINTASA=%.0f\n",cbmintasa);
		}
	}	

	if (trace)
	{
		fprintf (efrescc,"  ** INDICATEUR Collectivite TGEMAPI **\n");					
        fprintf (efrescc,"      C_CITPAI =%s\n",eindic->c_citpai);
	}

	if ((strncmp(eindic->c_citpai, "E",sizeof(eindic->c_citpai)) == 0) || (strncmp(eindic->c_citpai, "C",sizeof(eindic->c_citpai)) == 0))
	{
		ecotis->d_ztcuge=CalcUneecotis(ebase->d_ztbsge,etaux->d_ztcht4);
		if (trace)
		{
			fprintf (efrescc,"	 *cotisation TGEMAPI=produit de la ebase tgemapi par le etaux\n");
			fprintf (efrescc,"     	de taxation TGMAPI divise par 10 000 000\n");
			fprintf (efrescc,"	 ecotis->d_ztcuge=CalcUneecotis(%.0f,%.0f)\n",ebase->d_ztbsge,etaux->d_ztcht4);
			fprintf (efrescc,"	 D_ZTCUGE=%.0f\n",ecotis->d_ztcuge);
		}
		if ((strncmp(etaux->c_cicuu,"U",sizeof(etaux->c_cicuu)) == 0) || (strncmp(eindic->c_cietz, "Z",sizeof(eindic->c_cietz)) == 0) || (strncmp(eindic->c_cietz, "O",sizeof(eindic->c_cietz)) == 0))
		{
			cexmapi=CalcUneecotis(ebase->d_zzcuex,etaux->d_ztcht4);
			cexmapicvae=CalcUneecotis(ebase->d_zxcuex,etaux->d_ztcht4);
			if (trace)
			{
				fprintf (efrescc,"	 *cotisation exoneree TGEMAPI =produit de la ebase TGEMAPI par le etaux de\n");
				fprintf (efrescc,"     	taxation TGEMAPI divise par 10 000 000\n");
				fprintf (efrescc,"	 cexmapi=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zzcuex,etaux->d_ztcht4);
				fprintf (efrescc,"	 CEXMAPI=%.0f\n",cexmapi);
				fprintf (efrescc,"	 *cotisation exoneree TGEMAPI CVAE=produit de la ebase exoneree TGEMAPI cvae par\n");
				fprintf (efrescc,"     	le etaux de taxation TGEMAPI divise par 10 000 000\n");
				fprintf (efrescc,"	 cexmapicvae=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zxcuex,etaux->d_ztcht4);
				fprintf (efrescc,"	 CEXMAPICVAE=%.0f\n",cexmapicvae);
			}
		}
		else
		{
			cexmapi=CalcUneecotis(ebase->d_zzcnex,etaux->d_ztcht4);
			cexmapicvae=CalcUneecotis(ebase->d_zxcnex,etaux->d_ztcht4);
			if (trace)
			{
				fprintf (efrescc,"	 *cotisation exoneree TGEMAPI =produit de la ebase exoneree commune par le etaux de\n");
				fprintf (efrescc,"     	taxation TGEMAPI divise par 10 000 000\n");
				fprintf (efrescc,"	 cexmapi=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zzcnex,etaux->d_ztcht4);
				fprintf (efrescc,"	 CEXMAPI=%.0f\n",cexmapi);
				fprintf (efrescc,"	 *cotisation exoneree TGEMAPI cvae=produit de la ebase exoneree commune cvae par le etaux\n");
				fprintf (efrescc,"     	de taxation TGEMAPI divise par 10 000 000\n");
				fprintf (efrescc,"	 cexmapicvae=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zxcnex,etaux->d_ztcht4);
				fprintf (efrescc,"	 CEXMAPICVAE=%.0f\n",cexmapicvae);
			}
		}

		cbminmapi=CalcUneecotis(basemini,etaux->d_ztcht4);
		if (trace)
		{
			fprintf (efrescc,"	*cotisation sur ebase minimum TGEMAPI =produit de la ebase minimum TGEMAPI par le etaux de\n");
			fprintf (efrescc,"     	taxation TGEMAPI divise par 10 000 000\n");
			fprintf (efrescc,"	Cotisations sur ebase minimum TGEMAPI(cbminmapi)\n");
			fprintf (efrescc,"	 cbminmapi=CalcUneecotis(%.0f,%.0f)\n",basemini,etaux->d_ztcht4);
			fprintf (efrescc,"	 CBMINMAPI=%.0f\n",cbminmapi);
		}
	}	

	zttpxe = 0;
	zztpxe = 0;
	cbminepci = 0;

	ecotis->d_ztcncg=CalcUneecotis(ebase->d_ztbsgp,etaux->d_ztcngp);
	zttpxe=CalcUneecotis(ebase->d_zzcuex,etaux->d_ztcngp);
	zztpxe=CalcUneecotis(ebase->d_zxcuex,etaux->d_ztcngp);
	cbminepci=CalcUneecotis(basemini,etaux->d_ztcngp);

	if (trace)
	{
		fprintf (efrescc,"   ***   \n");
		fprintf (efrescc,"	3. cotisations EPCI (D_ZTCNCG)\n");
		fprintf (efrescc,"   ***   \n");
		fprintf (efrescc,"		*cotisation EPCI=produit de la ebase taxable EPCI par le etaux de taxation\n");
		fprintf (efrescc,"     	EPCI divise par 10 000 000\n");
		fprintf (efrescc,"		 d_ztcncg=CalcUneecotis(%.0f,%.0f)\n",ebase->d_ztbsgp,etaux->d_ztcngp);
		fprintf (efrescc,"		 D_ZTCNCG=%.2f\n",ecotis->d_ztcncg);
		fprintf (efrescc,"	*cotisation exoneree EPCI=produit de la ebase exoneree EPCI par le etaux de\n");
		fprintf (efrescc,"     	taxation EPCI divise par 10 000 000\n");
		fprintf (efrescc,"	 zttpxe=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zzcuex,etaux->d_ztcngp);
		fprintf (efrescc,"	 zttpxe=%.0f\n",zttpxe);
		fprintf (efrescc,"	*cotisation exoneree EPCI CVAE=produit de la base exoneree EPCI CVAE par le etaux de \n");
		fprintf (efrescc,"     	taxation EPCI divise par 10 000 000\n");
		fprintf (efrescc,"	1. cotisations  exoneree EPCI CVAE(zztpxe)\n");
		fprintf (efrescc,"	 zztpxe=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zxcuex,etaux->d_ztcngp);
		fprintf (efrescc,"	 zztpxe=%.0f\n",zztpxe);
		fprintf (efrescc,"	*cotisation sur ebase minimum EPCI =produit de la ebase minimum EPCI par le etaux de\n");
		fprintf (efrescc,"     	taxation EPCI divise par 10 000 000\n");
		fprintf (efrescc,"	1. cotisations sur ebase minimum EPCI(cbminepci)\n");
		fprintf (efrescc,"	 cbminepci=CalcUneecotis(%.0f,%.0f)\n",basemini,etaux->d_ztcngp);
		fprintf (efrescc,"	 CBMINEPCI=%.0f\n",cbminepci);
	}

	ecotis->d_zttpav=ecotis->d_ztcnct +			
				ecotis->d_ztcncs +
				ecotis->d_ztcncg +
				ecotis->d_ztcnce +
				ecotis->d_ztcuge +
				ecotis->d_ztrgif;
	ecotis->d_zttpx=zttpxc+zttpxs+zttpxt+cexmapi+cextasa+zttpxe;
	ecotis->d_zztpx=zztpxc+zztpxs+zztpxt+cexmapicvae+cextasacvae+zztpxe;
				
	if (trace)
	{
		fprintf (efrescc,"   ***   \n");
		fprintf (efrescc,"	5. cotisations CFE avant frais de gestion (D_ZTTPAV\n");
		fprintf (efrescc,"   ***   \n");
		fprintf (efrescc,"		*cotisation CFE avant frais=somme des cotisations \n");
		fprintf (efrescc,"     	commune, syndicat,  TSE et EPCI\n");
		fprintf (efrescc," d_zttpav=%.0f + %.0f + %.0f + %.0f + %.0f \n",ecotis->d_ztcnct,ecotis->d_ztcncs,ecotis->d_ztcncg,ecotis->d_ztcnce,ecotis->d_ztcuge,ecotis->d_ztrgif);
		fprintf (efrescc," D_ZTTPAV=%.0f\n",ecotis->d_zttpav);
		fprintf (efrescc,"		*cotisation exoneree CFE avant frais=somme des cotisations exo\n");
		fprintf (efrescc,"     	commune, syndicat,  TSE et EPCI\n");
		fprintf (efrescc," d_zttpx=%.0f+%.0f + %.0f + %.0f + %.0f + %.0f \n",zttpxc,zttpxs,zttpxt,cexmapi,cextasa,zttpxe);
		fprintf (efrescc," D_ZTTPX=%.0f\n",ecotis->d_zttpx);
		fprintf (efrescc,"		*cotisation exo CVAE avant frais=somme des cotisations exo CVAE\n");
		fprintf (efrescc,"     	commune, syndicat,  TSE et EPCI\n");
		fprintf (efrescc," d_zztpx=%.0f+%.0f + %.0f + %.0f + %.0f + %.0f \n",zztpxc,zztpxs,zztpxt,cexmapicvae,cextasacvae,zztpxe);
		fprintf (efrescc," D_ZZTPX=%.0f\n",ecotis->d_zztpx);
	}
				

	ecotis->d_ztchci=CalcUneecotis(ebase->d_ztbsci,etaux->d_ztcnci);
	ecotis->d_zttpxi=CalcUneecotis(ebase->d_zzchxi,etaux->d_ztcnci);

	if (trace)
	{
		fprintf (efrescc,"   ***   \n");
		fprintf (efrescc,"	6. COTISATION TCCI BRUTE AVANT FRAIS DE GESTION (D_ZTCHCI)\n");
		fprintf (efrescc,"   ***   \n");
		fprintf (efrescc,"		*COTISATION TCCI=produit de la ebase taxable TCCI par le etaux de taxation\n");
		fprintf (efrescc,"     	TCCI divise par 10 000 00\n");
		fprintf (efrescc,"		*COTISATION TCCI=produit de la ebase taxable TCCI par le etaux de taxation\n");
		fprintf (efrescc,"     	TCCI divise par 10 000 000\n");
		fprintf (efrescc,"		 d_ztchci=CalcUneecotis(%.0f,%.0f)\n",ebase->d_ztbsci,etaux->d_ztcnci);
		fprintf (efrescc,"		 D_ZTCHCI=%.0f\n",ecotis->d_ztchci);
		fprintf (efrescc,"		*COTISATION TCCI EXONEREE=produit de la ebase taxable TCCI par le etaux de taxation\n");
		fprintf (efrescc,"     	TCCI divise par 10 000 000\n");
		fprintf (efrescc,"		 d_zttpxi=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zzchxi,etaux->d_ztcnci);
		fprintf (efrescc,"		 D_ZTTPXI=%.0f\n",ecotis->d_zttpxi);
	}


	drfixe=0;
	if (!non_auto_entr)
	{
		ecotis->d_ztchma=0;
		ecotis->d_ztchcm=0;
		if (trace)
		{
			fprintf (efrescc,"     a)*  Auto-entrepreneur \n");
			fprintf (efrescc,"     *   \n");
			fprintf (efrescc,"		D_ZTCHMA =%.0f\n",ecotis->d_ztchma);
			fprintf (efrescc,"		D_ZTCHCM =%.0f\n",ecotis->d_ztchcm);
		}
	}
	else
	{
		if (trace)
		{
			fprintf (efrescc,"          ***   \n");
			fprintf (efrescc,"		b) Toutes communes \n");
			fprintf (efrescc,"          ***   \n");
			fprintf (efrescc,"	    	*indicateur droit additionnel(s_ztcoda) \n");
			fprintf (efrescc,"		 s_ztcoda=%d\n",eindic->s_ztcoda);
			fprintf (efrescc,"******************************************** \n");
		}
		if (eindic->s_ztcoda==1)
		{	
			ecotis->d_ztchcm=CalcUneecotis(ebase->d_ztbscm,etaux->d_ztch4);
			ecotis->d_zttpxm=CalcUneecotis(ebase->d_zzchxm,etaux->d_ztch4);
			if (trace)
			{
				fprintf (efrescc,"		 Droit additionnel (D_ZTCHCM)\n");
				fprintf (efrescc,"		* cotisation droit additionnel=produit de la ebase TCM par le etaux de\n");
				fprintf (efrescc,"     	taxation TCM divise par 10 000 000\n");
				fprintf (efrescc,"		 d_ztchcm=CalcUneecotis(%.0f,%.0f)\n",ebase->d_ztbscm,etaux->d_ztch4);
				fprintf (efrescc,"		 D_ZTCHCM=%.0f\n",ecotis->d_ztchcm);
				fprintf (efrescc,"		 Droit additionnel exonere (D_ZTTPXM)\n");
				fprintf (efrescc,"		* cotisation droit additionnel exonere=produit de la ebase TCM par le etaux de\n");
				fprintf (efrescc,"     	taxation TCM divise par 10 000 000\n");
				fprintf (efrescc,"		 d_zttpxm=CalcUneecotis(%.0f,%.0f)\n",ebase->d_zzchxm,etaux->d_ztch4);
				fprintf (efrescc,"		 D_ZTTPXM=%.0f\n",ecotis->d_zttpxm);
			}
		}
		if (trace)
		{
			fprintf (efrescc,"		 Droit fixe \n");
			fprintf (efrescc,"		*indicateur droit fixe(s_ztcodf) \n");
			fprintf (efrescc,"		 s_ztcodf=%d\n",eindic->s_ztcodf);
			fprintf (efrescc,"******************************************** \n");
		}
		if (eindic->s_ztcodf==1)
		{
			if (trace)
			{
				fprintf (efrescc,"	a. Indicateurs auto-entrepreneur(s_zteice)(d_zteimi) (c_cieimi) \n");
				fprintf (efrescc,"   ***   \n");
				fprintf (efrescc,"		s_zteice =%d\n",eindic->s_zteice);
				fprintf (efrescc,"		d_zteimi =%.0f\n",eindic->d_zteimi);
				fprintf (efrescc,"		c_cieimi =%s\n",eindic->c_cieimi); 	
			}
			drfixe=etaux->s_ztchdf;
			if (trace)
			{	
				fprintf (efrescc,"     Montant droit fixe \n");
				fprintf (efrescc,"     *   \n");
				fprintf (efrescc,"		droit fixe =(%.d)\n",etaux->s_ztchdf);
				fprintf (efrescc,"		DRFIXE =%.0f\n",drfixe);
			}
		}
	}



		ecotis->d_ztcnlt=ecotis->d_ztcnct-NbAnLis*ebase->d_zzcnct;
		if (ecotis->d_ztcnlt<0) ecotis->d_ztcnlt=0;
		ecotis->d_ztcnls=ecotis->d_ztcncs-NbAnLis*ebase->d_zzcncs;
		if (ecotis->d_ztcnls<0) ecotis->d_ztcnls=0;
		ecotis->d_ztcnlg=ecotis->d_ztcncg-NbAnLis*ebase->d_zzcncg;
		if (ecotis->d_ztcnlg<0) ecotis->d_ztcnlg=0;
		ecotis->d_ztcnle=ecotis->d_ztcnce-NbAnLis*ebase->d_zzcnce;
		if (ecotis->d_ztcnle<0) ecotis->d_ztcnle=0;
		ecotis->d_ztcule=ecotis->d_ztcuge-NbAnLis*ebase->d_zzcuge;
		if (ecotis->d_ztcule<0) ecotis->d_ztcule=0;
		ecotis->d_ztrglf=ecotis->d_ztrgif-NbAnLis*ebase->d_zzrgif;
		if (ecotis->d_ztrglf<0) ecotis->d_ztrglf=0;
		if (eindic->s_ztimci==1)
		{
			ecotis->d_ztchli=ecotis->d_ztchci-NbAnLis*ebase->d_zzchci;
			if (ecotis->d_ztchli<0) ecotis->d_ztchli=0;
		}
		else
		{
			ecotis->d_ztchli=0;
		}
		if (eindic->s_ztcoda==1)
		{	
			ecotis->d_ztchlm=ecotis->d_ztchcm-NbAnLis*ebase->d_zzchcm;
			if (ecotis->d_ztchlm<0) ecotis->d_ztchlm=0;
		}
		else
		{
			ecotis->d_ztchlm=0;
		}
		if (trace)
		{
			fprintf (efrescc,"   * calcul avec lissage *   \n");
			fprintf (efrescc,"		nombre anne =%.0f\n",NbAnLis);
			fprintf (efrescc,"		assujetti tcci =%d\n",eindic->s_ztimci);
			fprintf (efrescc,"		assujetti DA =%d\n",eindic->s_ztcoda);
			fprintf (efrescc,"		D_ZTCNCT =%.0f\n",ecotis->d_ztcnct);
			fprintf (efrescc,"		D_ZZCNCT =%.0f\n",ebase->d_zzcnct);
			fprintf (efrescc,"		D_ZTCNLT =%.0f\n",ecotis->d_ztcnlt);
			fprintf (efrescc,"		D_ZTCNCS =%.0f\n",ecotis->d_ztcncs);
			fprintf (efrescc,"		D_ZZCNCS =%.0f\n",ebase->d_zzcncs);
			fprintf (efrescc,"		D_ZTCNLS =%.0f\n",ecotis->d_ztcnls);
			fprintf (efrescc,"		D_ZTCNCG =%.0f\n",ecotis->d_ztcncg);
			fprintf (efrescc,"		D_ZZCNCG =%.0f\n",ebase->d_zzcncg);
			fprintf (efrescc,"		D_ZTCNLG =%.0f\n",ecotis->d_ztcnlg);
			fprintf (efrescc,"		D_ZTCNCE =%.0f\n",ecotis->d_ztcnce);
			fprintf (efrescc,"		D_ZZCNCE =%.0f\n",ebase->d_zzcnce);
			fprintf (efrescc,"		D_ZTCNLE =%.0f\n",ecotis->d_ztcnle);
			fprintf (efrescc,"		D_ZTCUGE =%.0f\n",ecotis->d_ztcuge);
			fprintf (efrescc,"		D_ZZCUGE =%.0f\n",ebase->d_zzcuge);
			fprintf (efrescc,"		D_ZTCULE =%.0f\n",ecotis->d_ztcule);
			fprintf (efrescc,"		D_ZTRGIF =%.0f\n",ecotis->d_ztrgif);
			fprintf (efrescc,"		D_ZZRGIF =%.0f\n",ebase->d_zzrgif);
			fprintf (efrescc,"		D_ZTRGLF =%.0f\n",ecotis->d_ztrglf);
			fprintf (efrescc,"		D_ZTCHCI =%.0f\n",ecotis->d_ztchci);
			fprintf (efrescc,"		D_ZZCHCI =%.0f\n",ebase->d_zzchci);
			fprintf (efrescc,"		D_ZTCHLI =%.0f\n",ecotis->d_ztchli);
			fprintf (efrescc,"		D_ZTCHCM =%.0f\n",ecotis->d_ztchcm);
			fprintf (efrescc,"		D_ZZCHCM =%.0f\n",ebase->d_zzchcm);
			fprintf (efrescc,"		D_ZTCHLM =%.0f\n",ecotis->d_ztchlm);
		}
		ecotis->d_zttpav=ecotis->d_ztcnlt +			
							ecotis->d_ztcnls +
							ecotis->d_ztcnlg +
							ecotis->d_ztcnle +
							ecotis->d_ztcule +
							ecotis->d_ztrglf;
		if (trace)
		{
			fprintf (efrescc,"   * cotisation CFE lissee avant frais *   \n");
			fprintf (efrescc,"		D_ZTTPAV =%.0f\n",ecotis->d_zttpav);
		}


	if (trace)
	{
		fprintf (efrescc,"		* cotisation TCM avant frais \n");
		fprintf (efrescc,"		 d_ztchma=%.0f+%.0f \n",ecotis->d_ztchlm,drfixe);
	}
	ecotis->d_ztchma=ecotis->d_ztchlm + drfixe;
	if (trace)
	{
		fprintf (efrescc,"		 D_ZTCHMA=%.0f\n",ecotis->d_ztchma);
	}

	ecotis->d_zytpgp = ecotis->d_zttpgp;
	if (trace)
	{
		fprintf (efrescc,"		* cotisation TSE grand Paris non lisse \n");
		fprintf (efrescc,"		 d_zytpgp=%.0f \n",ecotis->d_zytpgp);
	}
	if (trace)
	{
		fprintf (efrescc,"		* cotisation TSE grand Paris lisse \n");
		fprintf (efrescc,"		 d_zttpgp=%.0f*%.0f/%.0f \n",ecotis->d_zttpgp,ecotis->d_ztcnle,ecotis->d_ztcnce);
	}
	if (!(ecotis->d_ztcnce == 0))
	{
		ecotis->d_zttpgp=arrondi(ecotis->d_zytpgp * ecotis->d_ztcnle / ecotis->d_ztcnce);
	}
	else
	{
		ecotis->d_zttpgp=0;
	}
	if (trace)
	{
		fprintf (efrescc,"		 D_ZTTPGP=%.0f\n",ecotis->d_zttpgp);
	}


	if (trace)
	{
		fprintf (efrescc,"   ***   \n");
		fprintf (efrescc,"	10. Lissage dormant\n");
		fprintf (efrescc,"   ***   \n");
	}


	if (trace)
	{
		fprintf (efrescc,"   ***   \n");
		fprintf (efrescc,"	11. Cotisations exonerees dormantes lissees \n");
		fprintf (efrescc,"   ***   \n");
	}
		if (trace)
		{
			fprintf (efrescc,"   * calcul avec lissage dormant *   \n");
			fprintf (efrescc,"		ZTTPXC =%.0f\n",zttpxc);
			fprintf (efrescc,"		ZTTPXS =%.0f\n",zttpxs);
			fprintf (efrescc,"		ZTTPXE =%.0f\n",zttpxe);
			fprintf (efrescc,"		ZTTPXT =%.0f\n",zttpxt);
			fprintf (efrescc,"		CEXMAPI =%.0f\n",cexmapi);
			fprintf (efrescc,"		CEXTASA =%.0f\n",cextasa);
			fprintf (efrescc,"		D_ZTTPXI =%.0f\n",ecotis->d_zttpxi);
			fprintf (efrescc,"		D_ZTTPXM =%.0f\n",ecotis->d_zttpxm);
		}
		zttpxc=zttpxc-NbAnLis*ebase->d_zxcnct;
		if (zttpxc<0) zttpxc=0;
		zttpxs=zttpxs-NbAnLis*ebase->d_zxcncs;
		if (zttpxs<0) zttpxs=0;
		zttpxe=zttpxe-NbAnLis*ebase->d_zxcncg;
		if (zttpxe<0) zttpxe=0;
		zttpxt=zttpxt-NbAnLis*ebase->d_zxcnce;
		if (zttpxt<0) zttpxt=0;
		cexmapi=cexmapi-NbAnLis*ebase->d_zxcuge;
		if (cexmapi<0) cexmapi=0;
		cextasa=cextasa-NbAnLis*ebase->d_zxrgif;
		if (cextasa<0) cextasa=0;
		if (eindic->s_ztimci==1)
		{
			ecotis->d_zttpli=ecotis->d_zttpxi-NbAnLis*ebase->d_zxchci;
			if (ecotis->d_zttpli<0) ecotis->d_zttpli=0;
		}
		else
		{
			ecotis->d_zttpli=0;
		}
		if (eindic->s_ztcoda==1)
		{	
			ecotis->d_zttplm=ecotis->d_zttpxm-NbAnLis*ebase->d_zxchcm;
			if (ecotis->d_zttplm<0) ecotis->d_zttplm=0;
		}
		else
		{
			ecotis->d_zttplm=0;
		}
		if (trace)
		{
			fprintf (efrescc,"		ZXCNCT =%.0f\n",ebase->d_zxcnct);
			fprintf (efrescc,"		ZTTPXC =%.0f\n",zttpxc);
			fprintf (efrescc,"		ZXCNCS =%.0f\n",ebase->d_zxcncs);
			fprintf (efrescc,"		ZTTPXS =%.0f\n",zttpxs);
			fprintf (efrescc,"		ZXCNCG =%.0f\n",ebase->d_zxcncg);
			fprintf (efrescc,"		ZTTPXE =%.0f\n",zttpxe);
			fprintf (efrescc,"		ZXCNCE =%.0f\n",ebase->d_zxcnce);
			fprintf (efrescc,"		ZTTPXT =%.0f\n",zttpxt);
			fprintf (efrescc,"		ZXCUGE =%.0f\n",ebase->d_zxcuge);
			fprintf (efrescc,"		CEXMAPI =%.0f\n",cexmapi);
			fprintf (efrescc,"		ZXRGIF =%.0f\n",ebase->d_zxrgif);
			fprintf (efrescc,"		CEXTASA =%.0f\n",cextasa);
			fprintf (efrescc,"		ZXCHCI =%.0f\n",ebase->d_zxchci);
			fprintf (efrescc,"		D_ZTTPLI =%.0f\n",ecotis->d_zttpli);
			fprintf (efrescc,"		ZXCHCM =%.0f\n",ebase->d_zxchcm);
			fprintf (efrescc,"		D_ZTTPLM =%.0f\n",ecotis->d_zttplm);
		}
		zttpx=zttpxc+zttpxs+zttpxt+cextasa+cexmapi+zttpxe;
		if (trace)
		{
			fprintf (efrescc,"   * cotisation exoneree lissee avant frais *   \n");
			fprintf (efrescc,"		ZTTPX =%.0f\n",zttpx);
		}


	if (trace)
	{
		fprintf (efrescc,"   ***   \n");
		fprintf (efrescc,"	12. Lissage dormant CVAE \n");
		fprintf (efrescc,"   ***   \n");
	}

	if (trace)
	{
		fprintf (efrescc,"   ***   \n");