Monday, June 29, 2015

How to write a job to print coming 5 Tuesdays with date using X++

You can print the coming 5 Tuesday with the help built in Date function :- 

static void dayofweek(Args _arg)
{
    date d = today();
    str s;
    int i;
    ;
    i= dayOfWk(d);
    switch( i )
    {
        case 1:
            d = d + 1;
            break;
        case 2:
            d = d+7;
            break;
        case 3:
           d = d+6;
            break;
        case 4:
           d = d+5;
            break;
        case 5:
           d = d+4;
            break;
        case 6:
           d = d+3;
            break;
       case 7:
           d = d+2;
            break;        
         
    }

    for(i=1;i<=5;i++)
    {
    s=dayName(dayOfWk(d));  
    info(strFmt('  %1 %2' , d , s));
        d = d+7;
    }
 
}


No comments:

Post a Comment

How to enable the dimension fields based on the Item selected on the form.

[Form] public class KMTShipFromWarehouses extends FormRun {     InventDimCtrl_Frm_EditDimensions        inventDimFormSetup;     /// &l...