19 Nisan 2013 Cuma

AXAPTA - Show company logo at reports

First you  have to upload company logo. For this:

From Basic->Setup->Company informations->Company logo upload your logo.

After that write code below which I found from  this address  as display method:

Display Bitmap CompanyLogo()
{
    CompanyInfo companyInfo = CompanyInfo::find();
    ;
    return CompanyImage::find(companyInfo.DataAreaId, companyInfo.TableId, companyInfo.RecId).Image;
}


Pull this method to header. Don't forget arrange Height and Width values manual and change ResizeBitmap property to Yes.

25 Mart 2013 Pazartesi

AXAPTA Read text file

...
    Filename                Filename;
    System.IO.StreamReader  readFile;
    System.String           line;

    int hwnd; 
    ; 
    hwnd = infolog.hwnd(); 
    Filename = WinApi::getOpenFileName(hwnd,['TXT files','*.txt'],"","Text Files");
//    Filename = WinApi::getOpenFileName(element.hWnd(),['TXT files','*.txt'],"","Text Files");
    if (!Filename)
        return;

    readFile = new System.IO.StreamReader(filename,System.Text.Encoding::get_UTF8());
    while (true)
    {
        line = readFile.ReadLine();

        if(System.String::IsNullOrEmpty(line))
           break;
        warning(line);
    }
       
    readFile.Close();
    readFile.Dispose();
...        



There are other ways, one of them is at Fatih Demirci's blog.

8 Şubat 2013 Cuma

6 Şubat 2013 Çarşamba

4 Şubat 2013 Pazartesi

AXAPTA - Catch tabbed dialog enter and exit

Use  pageActivated() for catch enter tabbed dialog, use allowPageDeactivate() for catch exit. I tried to use Lostfocus() and GotFocus() with no success.

31 Ocak 2013 Perşembe

AXAPTA - Send alert to a user

static void sendAlertToUser(UserId _UserId,EventSubject _Subject,EventMessage _Message)
{
    EventInbox        inbox;
    EventInboxId      inboxId;
    SysClientSessions sessions;
    ;
    inboxId = EventInbox::nextEventId();
    inbox.initValue();
    inbox.ShowPopup            = NoYes::Yes;
    inbox.Subject              = _Subject;
    inbox.Message              = _Message;
    inbox.SendEmail            = true;
    inbox.UserId               = _UserId;
    inbox.InboxId              = inboxId;
    inbox.AlertCreatedDateTime = DateTimeUtil::getSystemDateTime();
    inbox.insert();
}

AXAPTA - Create Sales Order with X++

...
    SalesTable                  salesTable;
    NumberSeq                   NumberSeq;
    SalesLine                   salesLine;
    AxSalesLine                 axSalesLine = new axSalesLine();
    AxSalesTable                axsalesTable = new axSalesTable();
    ;
...
    ttsbegin;
    axsalesTable.parmSalesId();
    if (ServiceOrder.CustName == "")
        axsalesTable.parmCustAccount(ServiceOrder.CustAccount);// Cust Account
    else
        axsalestable.parmOneTimeCustomer(Dialog_OneTime.value());

    axsalesTable.parmDlvMode(Dialog_DLVMode.value());
    axsalesTable.parmDlvTerm(Dialog_DLVTerm.value());
    axsalesTable.save();
    while select forupdate Lines where Lines.RepairJournalId == _RepairJournalId && Lines.SalesId == "" &&
        Lines.CSApproval == B_Approval::Approved && Lines.ItemId != "" && Lines.Qty > 0
    {
        axSalesLine = AxSalesLine::construct();
        axSalesLine.parmSalesId(axsalesTable.parmSalesId());
        axSalesLine.parmItemId(Lines.ItemId);
        axSalesLine.parmSalesQty(Lines.Qty);
        axSalesline.parmSalesPrice(Lines.ProjSalesPrice);
        axSalesline.parmCurrencyCode(Lines.ProjCurrencyCode);
        axSalesline.parmSalesUnit(Lines.Unit);
        Lines.SalesId = axsalesTable.parmSalesId();
        Lines.update();
        axSalesLine.save();
    }
    ttscommit;
...