Sunday, November 23, 2014

Count of day without Friday,saturday in ax 2012

// Count of day without Friday,saturday

static void San_DateFriSat(Args _args)
{
    date d,f,g;
    int i,months,day,countday;
    d = mkDate(01,12,2014);
    f = mkDate(31,12,2014);
    g = nextMth(f);  
    months = intvNo(g,d,intvScale::Day);
    //info(strfmt("%1",months));
    for (i=0;i<= months;i++)
    {
        day = dayOfwk(d);
        //info(strfmt("Weekday number - %1",day));
        if (day == 1 || day == 2 || day == 3 || day == 4 || day ==7)
        {
             countday++;  
        }
        d = d +1;
    }
    info(strFmt("%1",countday));
   
}

No comments:

Post a Comment

Search hierarchy for a match (TableALLGroup) X++

  Table1 ppt;  select firstonly ppt  order ItemCode, ItemRelation, AccountCode, AccountRelation where      (ppt.ItemCode == TableGroupAll::T...