Popular Posts

Monday 22 August 2011

Port Numbers in ax

AOS port numbers are essentially TCP/IP port numbers.  TCP/IP port numbers have a range from 1024 to 49151.  So in theory, you should be able to use port numbers from this range.

Another type of Ax Application Backup


There is no auto backup of application option in Dynamics AX.
In the past, I used DOS command script to do the following in the mid night when it was acceptable for AOS to be unavailable -
1) Stop the AOS
2) Delete .aoi file
3) Used Robocopy script to backup the application layer.
4) Restart AOS.
The beauty with Robocopy is - it is intelligent enough so that only those files which had its timestamp changed would be backed up.

Upgrading Ax4.0 to Ax2009 Bom error

I upgrade ax 4.0 to ax 2009.I saw item master ItemType field shows only Item,Service.But i saw in base enums itemType shows Item,Bom,Service.what should i do visible BOM on itemType lookup in item master?
Soloved This Problem
Manufacturing is a generic term for all production elements. Actually having opened it the BOM configuration is under logistics. If this is selected you should be able to see the BOM option on the item master and in inventory management. If it is selected and you still cannot see it you would need to trouble shoot the upgrade procedure as this is where the issue will lie.

Sending Mail Through X++

static void Email(Args _args)
{
    CustTable                   custTable;
    System.Text.StringBuilder   htmlTable;
    SysMailer                   mailer;
    ;

    htmlTable   = new System.Text.StringBuilder();
    htmlTable.Append(@"<Caption>Blue Company Customers");
    htmlTable.Append(@"</Caption></br>");
    htmlTable.Append("<TableBorder = 1>");
   
    while select custTable where custTable.CustGroup == '10'
    {
        htmlTable.Append("<TR ALIGN='CENTER'>");
        htmlTable.Append("<TD>");
        htmlTable.Append(custTable.AccountNum);
        htmlTable.Append("</TD>");
        htmlTable.Append("<TD>");
        htmlTable.Append(custTable.NameAlias);
        htmlTable.Append("</TD>");
        htmlTable.Append("</TR>");
    }
   
    htmlTable.Append("</TABLE>");

    mailer  = new SysMailer();
    mailer.htmlBody(htmlTable.ToString());
    mailer.subject("Automated Mail - Customers");
    mailer.fromAddress("kishorem@b2bsoftech.local");
    mailer.tos().appendAddress("chakradhar@b2bsoftech.local");
    mailer.SMTPRelayServer("192.168.4.67",87,"AXMail","1234",false);
    mailer.sendMail();
}

Wednesday 3 August 2011

Excel creation through x++ 1

static void nestingExcel(Args _args)
{
    SysExcelStyles          styles;
    SysExcelStyle           style;
    SysExcelFont            font;
    #AviFiles
    SysOperationProgress    progress = new SysOperationProgress();
    SysExcelApplication     sysExcelApplication;
    SysExcelWorkbooks       sysExcelWorkBooks;
    SysExcelWorkbook        sysExcelWorkBook;
    SysExcelWorkSheets      sysExcelWorkSheets;
    SysExcelWorkSheet       sysExcelWorkSheet;
    TvItemscrTable          scrTable;
    TvItemScrapLInes        scrLines;
    TvProdProfiles          prodProfiles;
    int                     j,k;
    int                     len[];
    ;
    sysExcelApplication     = SysExcelApplication::construct();
    sysExcelWorkBooks       = sysExcelApplication.workbooks();
    sysExcelWorkBook        = sysExcelWorkBooks.add();
    styles                  = sysExcelWorkBook.styles();
    style                   = styles.add("Header");
    font                    = style.font();
    font.bold(true);
    font.color(255);
    sysExcelWorkSheets      = sysExcelWorkbook.worksheets();
    sysExcelWorkSheet       = sysExcelWorkSheets.add(null,null,1);
    sysExcelWorkSheet       = sysExcelWorkSheets.add();
    sysExcelWorkSheet.name('PayRegister');
    sysExcelWorksheet.cells().item(1,1).value('ItemId');
    sysExcelWorksheet.cells().item(1,2).value('NoOfPieces');
    sysExcelWorksheet.cells().item(1,3).value('scrap%');
    sysExcelWorksheet.cells().item(1,4).value('combination');
    sysExcelWorksheet.cells().item(1,5).value('selected');
    sysExcelWorksheet.cells().item(1,6).value('Generated');
    j=7;
    while select prodProfiles order by ItemLength where  prodProfiles.salesid == 'SO-100402'
                            &&   prodProfiles.ItemId == 'MSA05005'
    {
        sysExcelWorksheet.cells().item(1,j).value(prodProfiles.ItemLength);
        len[prodProfiles.ItemLength]  = j;
        j++;
    }
    sysExcelWorksheet.rows().item(1).style("Header");
    sysExcelWorksheet.columns().autoFit();
    sysExcelApplication.displayAlerts(false);
    sysExcelApplication.visible(true);
    k =2;
    while select scrTable order by LineNum  where scrTable.ItemId   == 'MSA05005'
                        &&   scrTable.SalesId  == 'SO-100402'
                        &&   scrTable.Selected == noyes::Yes
    {
        sysExcelWorksheet.cells().item(k,1).value(scrTable.ItemId);
        sysExcelWorksheet.cells().item(k,2).value(scrTable.NoOfPieces);
        sysExcelWorksheet.cells().item(k,3).value(scrTable.ScrapPercent);
        sysExcelWorksheet.cells().item(k,4).value(scrTable.NoOfCombinations);
        sysExcelWorksheet.cells().item(k,5).value(enum2str(scrTable.Selected));
        sysExcelWorksheet.cells().item(k,6).value(enum2str(scrTable.Generated));
        while select scrLines where scrLines.ItemId   == 'MSA05005'
        &&   scrLines.SalesId  == 'SO-100402'
        &&  scrLines.RefLineNum == scrTable.LineNum
        {


            sysExcelWorksheet.cells().item(k,len[scrLines.Length]).value(scrLines.NoOfPieces);
        }
        k++;
    }
}