IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

SAP Crystal Reports Discussion :

[CR XI] calcul de temps à partir d'un calendrier


Sujet :

SAP Crystal Reports

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    66
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 66
    Points : 60
    Points
    60
    Par défaut [CR XI] calcul de temps à partir d'un calendrier
    Bonjour,

    Je souhaite effectuer un calcul de temps de traitement d'un dossiers de support à partir d'un calendrier (jours et heures ouvrés). Je ne vois pas comment procéder. Si quelqu'un a un exemple d'utilisation de calendrier dans un état Crystal Reports XI?

    Cordialement

  2. #2
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    145
    Détails du profil
    Informations personnelles :
    Localisation : Luxembourg

    Informations forums :
    Inscription : Avril 2007
    Messages : 145
    Points : 78
    Points
    78
    Par défaut
    Dans ton traitement de dossier de support, as-tu une date de création et de résolution?? Tu pourrais alors utiliser des formules...

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    66
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 66
    Points : 60
    Points
    60
    Par défaut
    C'est ce que je souhaite effectuer mais en me basant sur un calendrier qui prend en compte les jours et heures ouvrés ainsi que les jours fériés.

  4. #4
    Membre éclairé
    Avatar de kikidrome
    Profil pro
    Inscrit en
    Décembre 2004
    Messages
    861
    Détails du profil
    Informations personnelles :
    Localisation : France, Drôme (Rhône Alpes)

    Informations forums :
    Inscription : Décembre 2004
    Messages : 861
    Points : 685
    Points
    685
    Par défaut
    hello
    j'ai fait quelque chose de ce style en utilisant une table access dans laquelle, je définissais les jours fériés.
    Pour les samedi et dmanches, tu as
    DayOfWeek (date)

  5. #5
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    66
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 66
    Points : 60
    Points
    60
    Par défaut
    Merci kikidrome,

    Mais il faut aussi que je me base par rapport à une plage horaires,

    Cordialement
    Battl14

  6. #6
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    66
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 66
    Points : 60
    Points
    60
    Par défaut Résolution
    Bonjour,
    Voici la formule que j'ai fait avec l'aide du support BO. Le developpement est un peu disgracieux mais il y a l'intergration des jours fériés jusqu'en 2014, les horaires d'ouvertures et les weekends
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    DatetimeVar FirstDateTime:= {dtOpened}; 
    DatetimeVar LastDateTime:= {dtEnd}; 
    TimeVar BusinessStartTime:= Time(09,00,00); 
    TimeVar BusinessEndTime:= Time(18,00,00); 
     
    DateVar NewYearsDay2007:=Date(2007,01,01);
    DateVar LundiPaques2007:=Date(2007,04,09);
    DateVar fetedutravail2007:=Date(2007,05,01);
    DateVar victoire2007:=Date(2007,05,08);
    DateVar Ascension2007:=Date(2007,05,17);
    DateVar fetenat2007:=Date(2007,07,14);
    DateVar Assomption2007:=Date(2007,08,15);
    DateVar Toussaint2007:=Date(2007,11,01);
    DateVar Armistice2007:=Date(2007,11,11);
    DateVar Noel2007:=Date(2007,12,25);
     
    DateVar NewYearsDay2008:=Date(2008,01,01);
    DateVar LundiPaques2008:=Date(2008,03,24);
    DateVar fetedutravail2008:=Date(2008,05,01);
    DateVar victoire2008:=Date(2008,05,08);
    DateVar fetenat2008:=Date(2008,07,14);
    DateVar Assomption2008:=Date(2008,08,15);
    DateVar Toussaint2008:=Date(2008,11,01);
    DateVar Armistice2008:=Date(2008,11,11);
    DateVar Noel2008:=Date(2008,07,04);
     
    DateVar NewYearsDay2009:=Date(2009,01,01);
    DateVar LundiPaques2009:=Date(2009,04,13);
    DateVar fetedutravail2009:=Date(2009,05,01);
    DateVar victoire2009:=Date(2009,05,08);
    DateVar Ascension2009:=Date(2009,05,21);
    DateVar fetenat2009:=Date(2009,07,14);
    DateVar Assomption2009:=Date(2009,08,15);
    DateVar Toussaint2009:=Date(2009,11,01);
    DateVar Armistice2009:=Date(2009,11,11);
    DateVar Noel2009:=Date(2009,12,25);
     
    DateVar NewYearsDay2010:=Date(2010,01,01);
    DateVar LundiPaques2010:=Date(2010,04,05);
    DateVar fetedutravail2010:=Date(2010,05,01);
    DateVar victoire2010:=Date(2010,05,08);
    DateVar Ascension2010:=Date(2010,05,13);
    DateVar fetenat2010:=Date(2010,07,14);
    DateVar Assomption2010:=Date(2010,08,15);
    DateVar Toussaint2010:=Date(2010,11,01);
    DateVar Armistice2010:=Date(2010,11,11);
    DateVar Noel2010:=Date(2010,12,25);
     
    DateVar NewYearsDay2011:=Date(2011,01,01);
    DateVar LundiPaques2011:=Date(2011,04,25);
    DateVar fetedutravail2011:=Date(2011,05,01);
    DateVar victoire2011:=Date(2011,05,08);
    DateVar Ascension2011:=Date(2011,06,02);
    DateVar fetenat2011:=Date(2011,07,14);
    DateVar Assomption2011:=Date(2011,08,15);
    DateVar Toussaint2011:=Date(2011,11,01);
    DateVar Armistice2011:=Date(2011,11,11);
    DateVar Noel2011:=Date(2011,12,25);
     
    DateVar NewYearsDay2012:=Date(2012,01,01);
    DateVar LundiPaques2012:=Date(2012,04,09);
    DateVar fetedutravail2012:=Date(2012,05,01);
    DateVar victoire2012:=Date(2012,05,08);
    DateVar Ascension2012:=Date(2012,05,17);
    DateVar fetenat2012:=Date(2012,07,14);
    DateVar Assomption2012:=Date(2012,08,15);
    DateVar Toussaint2012:=Date(2012,11,01);
    DateVar Armistice2012:=Date(2012,11,11);
    DateVar Noel2012:=Date(2012,12,25);
     
    DateVar NewYearsDay2013:=Date(2013,01,01);
    DateVar LundiPaques2013:=Date(2013,04,01);
    DateVar fetedutravail2013:=Date(2013,05,01);
    DateVar victoire2013:=Date(2013,05,08);
    DateVar Ascension2013:=Date(2013,05,09);
    DateVar fetenat2013:=Date(2013,07,14);
    DateVar Assomption2013:=Date(2013,08,15);
    DateVar Toussaint2013:=Date(2013,11,01);
    DateVar Armistice2013:=Date(2013,11,11);
    DateVar Noel2013:=Date(2013,12,25);
     
    DateVar NewYearsDay2014:=Date(2014,01,01);
    DateVar LundiPaques2014:=Date(2014,04,21);
    DateVar fetedutravail2014:=Date(2014,05,01);
    DateVar victoire2014:=Date(2014,05,08);
    DateVar Ascension2014:=Date(2014,05,29);
    DateVar fetenat2014:=Date(2014,07,14);
    DateVar Assomption2014:=Date(2014,08,15);
    DateVar Toussaint2014:=Date(2014,11,01);
    DateVar Armistice2014:=Date(2014,11,11);
    DateVar Noel2014:=Date(2014,12,25);
     
    Numbervar HoursInADay:= (BusinessEndTime - BusinessStartTime)/3600;
    Numbervar Days;
    Numbervar Weekends;
    Numbervar Finaldays;
    DateVar StartDate;
    DateVar EndDate;
    NumberVar halfdays;
    NumberVar fulldays;
    NumberVar hours;
    NumberVar Holidays:=0;
    timevar TrueStartTime;
    timevar TrueEndTime;
     
     
    IF FirstDateTime <=Date(0,0,0) or LastDateTime <=Date(0,0,0) then hours:= 0
     
    ELSE
    (
    if time(FirstDateTime) in BusinessStartTime to BusinessEndTime then 
        FirstDateTime:= FirstDateTime
    else if time(FirstDateTime) > BusinessEndTime then 
        FirstDateTime:= datetime(date(FirstDateTime)+1, BusinessStartTime)
    else if time(FirstDateTime) < BusinessStartTime then 
        FirstDateTime:= datetime(date(FirstDateTime), BusinessStartTime);
     
    if time(LastDateTime) in BusinessStartTime to BusinessEndTime then 
        LastDateTime:= LastDateTime
    else if time(LastDateTime) > BusinessEndTime then 
        LastDateTime:= datetime(date(LastDateTime), BusinessEndTime)
    else if time(LastDateTime) < BusinessStartTime then 
        LastDateTime:= datetime(date(LastDateTime)-1, BusinessEndTime);
     
    If DayOfWeek(FirstDateTime) = 7 Then 
        StartDate := date(FirstDateTime) + 2
    Else If DayOfWeek(FirstDateTime) = 1 Then 
        StartDate := date(FirstDateTime) + 1
    Else StartDate:=date(FirstDateTime);
     
    If DayOfWeek(LastDateTime) = 7 Then 
        EndDate := date(LastDateTime) + 2
    Else If DayOfWeek(LastDateTime) = 1 Then 
        EndDate := date(LastDateTime) + 1
    Else EndDate := date(LastDateTime);
     
    Days:= (EndDate - StartDate)+1;
     
    if Days >= 7 then 
        WeekEnds := (Round((Days/7),0))*2
    else if DayOfWeek(StartDate) > DayOfWeek(EndDate) then 
        WeekEnds := 2
    else WeekEnds := 0;
     
    If dayofweek(NewYearsDay2007) <> 7 and dayofweek(NewYearsDay2007) <> 1 then
    (
        If NewYearsDay2007 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Armistice2007) <> 7 and dayofweek(Armistice2007) <> 1 then
    (
        If Armistice2007 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(fetenat2008) <> 7 and dayofweek(fetenat2008) <> 1 then
    (
        If fetenat2008 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(LundiPaques2007) <> 7 and dayofweek(LundiPaques2007) <> 1 then
    (
        If LundiPaques2007 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Noel2007) <> 7 and dayofweek(Noel2007) <> 1 then
    (
        If Noel2007 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Assomption2008) <> 7 and dayofweek(Assomption2008) <> 1 then
    (
        If Assomption2008 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(fetedutravail2007) <> 7 and dayofweek(fetedutravail2007) <> 1 then
    (
        If fetedutravail2007 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(NewYearsDay2008) <> 7 and dayofweek(NewYearsDay2008) <> 1 then
    (
        If NewYearsDay2008 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Armistice2008) <> 7 and dayofweek(Armistice2008) <> 1 then
    (
        If Armistice2008 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(victoire2007) <> 7 and dayofweek(victoire2007) <> 1 then
    (
        If victoire2007 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(LundiPaques2008) <> 7 and dayofweek(LundiPaques2008) <> 1 then
    (
        If LundiPaques2008 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Noel2008) <> 7 and dayofweek(Noel2008) <> 1 then
    (
        If Noel2008 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Ascension2007) <> 7 and dayofweek(Ascension2007) <> 1 then
    (
        If Ascension2007 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(fetedutravail2008) <> 7 and dayofweek(fetedutravail2008) <> 1 then
    (
        If fetedutravail2008 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(NewYearsDay2009) <> 7 and dayofweek(NewYearsDay2009) <> 1 then
    (
        If NewYearsDay2009 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(fetenat2007) <> 7 and dayofweek(fetenat2007) <> 1 then
    (
        If fetenat2007 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(victoire2008) <> 7 and dayofweek(victoire2008) <> 1 then
    (
        If victoire2008 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(LundiPaques2009) <> 7 and dayofweek(LundiPaques2009) <> 1 then
    (
        If LundiPaques2009 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Assomption2007) <> 7 and dayofweek(Assomption2007) <> 1 then
    (
        If Assomption2007 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(fetedutravail2009) <> 7 and dayofweek(fetedutravail2009) <> 1 then
    (
        If fetedutravail2009 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Toussaint2007) <> 7 and dayofweek(Toussaint2007) <> 1 then
    (
        If Toussaint2007 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Toussaint2008) <> 7 and dayofweek(Toussaint2008) <> 1 then
    (
        If Toussaint2008 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(victoire2009) <> 7 and dayofweek(victoire2009) <> 1 then
    (
        If victoire2009 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Ascension2009) <> 7 and dayofweek(Ascension2009) <> 1 then
    (
        If Ascension2009 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(fetenat2009) <> 7 and dayofweek(fetenat2009) <> 1 then
    (
        If fetenat2009 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Assomption2009) <> 7 and dayofweek(Assomption2009) <> 1 then
    (
        If Assomption2009 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Toussaint2009) <> 7 and dayofweek(Toussaint2009) <> 1 then
    (
        If Toussaint2009 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Armistice2009) <> 7 and dayofweek(Armistice2009) <> 1 then
    (
        If Armistice2009 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Noel2009) <> 7 and dayofweek(Noel2009) <> 1 then
    (
        If Noel2009 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(NewYearsDay2010) <> 7 and dayofweek(NewYearsDay2010) <> 1 then
    (
        If NewYearsDay2010 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(LundiPaques2010) <> 7 and dayofweek(LundiPaques2010) <> 1 then
    (
        If LundiPaques2010 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(fetedutravail2010) <> 7 and dayofweek(fetedutravail2010) <> 1 then
    (
        If fetedutravail2010 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(victoire2010) <> 7 and dayofweek(victoire2010) <> 1 then
    (
        If victoire2010 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Ascension2010) <> 7 and dayofweek(Ascension2010) <> 1 then
    (
        If Ascension2010 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(fetenat2010) <> 7 and dayofweek(fetenat2010) <> 1 then
    (
        If fetenat2010 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Assomption2010) <> 7 and dayofweek(Assomption2010) <> 1 then
    (
        If Assomption2010 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Toussaint2010) <> 7 and dayofweek(Toussaint2010) <> 1 then
    (
        If Toussaint2010 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Armistice2010) <> 7 and dayofweek(Armistice2010) <> 1 then
    (
        If Armistice2010 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Noel2010) <> 7 and dayofweek(Noel2010) <> 1 then
    (
        If Noel2010 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(NewYearsDay2011) <> 7 and dayofweek(NewYearsDay2011) <> 1 then
    (
        If NewYearsDay2011 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(LundiPaques2011) <> 7 and dayofweek(LundiPaques2011) <> 1 then
    (
        If LundiPaques2011 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(fetedutravail2011) <> 7 and dayofweek(fetedutravail2011) <> 1 then
    (
        If fetedutravail2011 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(victoire2011) <> 7 and dayofweek(victoire2011) <> 1 then
    (
        If victoire2011 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Ascension2011) <> 7 and dayofweek(Ascension2011) <> 1 then
    (
        If Ascension2011 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(fetenat2011) <> 7 and dayofweek(fetenat2011) <> 1 then
    (
        If fetenat2011 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Assomption2011) <> 7 and dayofweek(Assomption2011) <> 1 then
    (
        If Assomption2011 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Toussaint2011) <> 7 and dayofweek(Toussaint2011) <> 1 then
    (
        If Toussaint2011 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Armistice2011) <> 7 and dayofweek(Armistice2011) <> 1 then
    (
        If Armistice2011 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Noel2011) <> 7 and dayofweek(Noel2011) <> 1 then
    (
        If Noel2011 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(NewYearsDay2012) <> 7 and dayofweek(NewYearsDay2012) <> 1 then
    (
        If NewYearsDay2012 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(LundiPaques2012) <> 7 and dayofweek(LundiPaques2012) <> 1 then
    (
        If LundiPaques2012 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(fetedutravail2012) <> 7 and dayofweek(fetedutravail2012) <> 1 then
    (
        If fetedutravail2012 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(victoire2012) <> 7 and dayofweek(victoire2012) <> 1 then
    (
        If victoire2012 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Ascension2012) <> 7 and dayofweek(Ascension2012) <> 1 then
    (
        If Ascension2012 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(fetenat2012) <> 7 and dayofweek(fetenat2012) <> 1 then
    (
        If fetenat2012 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Assomption2012) <> 7 and dayofweek(Assomption2012) <> 1 then
    (
        If Assomption2012 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Toussaint2012) <> 7 and dayofweek(Toussaint2012) <> 1 then
    (
        If Toussaint2012 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Armistice2012) <> 7 and dayofweek(Armistice2012) <> 1 then
    (
        If Armistice2012 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Noel2012) <> 7 and dayofweek(Noel2012) <> 1 then
    (
        If Noel2012 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(NewYearsDay2013) <> 7 and dayofweek(NewYearsDay2013) <> 1 then
    (
        If NewYearsDay2013 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(LundiPaques2013) <> 7 and dayofweek(LundiPaques2013) <> 1 then
    (
        If LundiPaques2013 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(fetedutravail2013) <> 7 and dayofweek(fetedutravail2013) <> 1 then
    (
        If fetedutravail2013 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(victoire2013) <> 7 and dayofweek(victoire2013) <> 1 then
    (
        If victoire2013 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Ascension2013) <> 7 and dayofweek(Ascension2013) <> 1 then
    (
        If Ascension2013 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(fetenat2013) <> 7 and dayofweek(fetenat2013) <> 1 then
    (
        If fetenat2013 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Assomption2013) <> 7 and dayofweek(Assomption2013) <> 1 then
    (
        If Assomption2013 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Toussaint2013) <> 7 and dayofweek(Toussaint2013) <> 1 then
    (
        If Toussaint2013 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Armistice2013) <> 7 and dayofweek(Armistice2013) <> 1 then
    (
        If Armistice2013 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Noel2013) <> 7 and dayofweek(Noel2013) <> 1 then
    (
        If Noel2013 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(NewYearsDay2014) <> 7 and dayofweek(NewYearsDay2014) <> 1 then
    (
        If NewYearsDay2014 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(LundiPaques2014) <> 7 and dayofweek(LundiPaques2014) <> 1 then
    (
        If LundiPaques2014 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(fetedutravail2014) <> 7 and dayofweek(fetedutravail2014) <> 1 then
    (
        If fetedutravail2014 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(victoire2014) <> 7 and dayofweek(victoire2014) <> 1 then
    (
        If victoire2014 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Ascension2014) <> 7 and dayofweek(Ascension2014) <> 1 then
    (
        If Ascension2014 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(fetenat2014) <> 7 and dayofweek(fetenat2014) <> 1 then
    (
        If fetenat2014 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Assomption2014) <> 7 and dayofweek(Assomption2014) <> 1 then
    (
        If Assomption2014 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Toussaint2014) <> 7 and dayofweek(Toussaint2014) <> 1 then
    (
        If Toussaint2014 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Armistice2014) <> 7 and dayofweek(Armistice2014) <> 1 then
    (
        If Armistice2014 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If dayofweek(Noel2014) <> 7 and dayofweek(Noel2014) <> 1 then
    (
        If Noel2014 in StartDate to EndDate then 
            Holidays:=Holidays + 1;
    );
     
    If DayOfWeek(LastDateTime) = 7 then 
    FinalDays:= FinalDays - 1;
    If DayOfWeek(LastDateTime) = 1 then 
    FinalDays:= FinalDays - 2;
     
    FinalDays:= Days - Holidays - WeekEnds;
     
    If DayOfWeek(FirstDateTime) = 7 Then 
        FirstDateTime := datetime(date(FirstDateTime) + 2, BusinessStartTime)
    Else If DayOfWeek(FirstDateTime) = 1 Then 
        FirstDateTime := datetime(date(FirstDateTime) + 1, BusinessStartTime);
     
    If DayOfWeek(LastDateTime) = 7 Then 
        LastDateTime := datetime(date(LastDateTime) + 2,BusinessStartTime)
    Else If DayOfWeek(LastDateTime) = 1 Then 
        LastDateTime := datetime(date(LastDateTime) + 1, BusinessStartTime);
     
    If FinalDays <= 1 then
    (
        if date(FirstDateTime) = date(LastDateTime) then
        (
            if time(FirstDateTime) >= BusinessStartTime then 
                TrueStartTime:= time(FirstDateTime)
            else TrueStartTime:= BusinessStartTime;
     
            if time(LastDateTime) <= BusinessEndTime then 
                TrueEndTime:= time(LastDateTime)
            else TrueEndTime:= BusinessEndTime
        )
        else TrueStarttime:= BusinessStartTime;
     
        if time(LastDateTime) <= BusinessEndTime then TrueEndTime:= time(LastDateTime)
        else TrueEndTime:= BusinessEndTime;
     
        hours:= (TrueEndTime-TrueStartTime)/3600;
    )
     
    Else 
    (
    halfdays:= ((BusinessEndTime - time(FirstDateTime)) /3600 + (time(LastDateTime) - BusinessStartTime)
    /3600);
    fulldays:= (FinalDays-2) * HoursInADay; 
    hours:= halfdays + fulldays;
    );
    );
     
    hours;
    Cordialement
    battl14

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. calcule de temps a partir d'un fichier CSV
    Par AI_LINUX dans le forum Calcul scientifique
    Réponses: 2
    Dernier message: 10/05/2015, 18h28
  2. Réponses: 3
    Dernier message: 27/08/2010, 07h20
  3. Calcul de temps à partir des cellules cochées
    Par mimi62 dans le forum Excel
    Réponses: 6
    Dernier message: 23/08/2010, 21h30
  4. [MFC] : CTime ? Calcul de temps d'éxécution
    Par jonzuzu dans le forum MFC
    Réponses: 10
    Dernier message: 25/05/2004, 14h22
  5. Réponses: 8
    Dernier message: 18/09/2002, 03h20

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo