Sunday, October 26, 2014

Alert New in AX 2012

// Alert  New in AX

class SendEventAlert
{
}
static void sendAlerts_ItemMaster(str   _bodyMsg,str _subject,ItemId _item/*, UBMModelDeatils   _ubmModelDetails*/)
{
    // commented by Sangeeth
    EventNotificationSync   alert;
    MenuFunction            MenuFunction;
    str                     dataSourceName;
    HcmWorkerRecId          _hcmWorkerId;
    UserId                  _user;
    ;


   // _hcmWorkerId         = SalesQuotationTable::find(_ubmModelDetails.QuotationId).WorkerSalesTaker;
    _user                = DirPersonUser::findWorker(_hcmWorkerId).User;

    dataSourceName  =   tablestr(InventTable);
    MenuFunction    =   new MenuFunction(menuitemdisplaystr(EcoResProductPerCompanyListPage), MenuItemType::Display);
    alert           =   EventNotificationsync::newInfo(_subject,
                                                _bodyMsg,
                                                _bodyMsg,
                                                NoYes::Yes,
                                                curext(),
                                                InventTable::find(_item),
                                                dataSourceName,
                                                MenuFunction);



    alert.parmUserId(_user);

    alert.create();
}
static void sendAlerts_ModelDetails(str   _bodyMsg,str _subject/*, UBMModelReqNo _modelReqNo*/)
{
    // commented by Sangeeth
    EventNotificationSync   alert;
    MenuFunction            MenuFunction;

    str                     dataSourceName;
    SecurityRole    _securityRole;
    SecurityUserRole    _securityUserRole;
    ;

    //dataSourceName  =   tablestr(UBMModelDeatils);
   //// MenuFunction    =   new MenuFunction(menuitemdisplaystr(UBMModelDeatils), MenuItemType::Display);
    //alert           =   EventNotificationsync::newInfo(_subject,
                                                //_bodyMsg,
                                                //_bodyMsg,
                                                //NoYes::Yes,
                                                //curext(),
                                                //UBMModelDeatils::find(_modelReqNo),
                                                //dataSourceName,
                                                //MenuFunction);



    select _securityRole
        where _securityRole.Name == 'Estimator';

    while select _securityUserRole
            where _securityUserRole.SecurityRole == _securityRole.RecId
    {
        alert.parmUserId(_securityUserRole.User);
        alert.create();
    }
}
static void sendAlerts_SalesQuote(str   _bodyMsg,str _subject, PurchRFQCaseId _rFQCaseId)
{

    EventNotificationSync   alert;
    MenuFunction            MenuFunction;

    str                     dataSourceName;
    SecurityRole    _securityRole;
    SecurityUserRole    _securityUserRole;
    ;

    dataSourceName  =   tablestr(PurchRFQCaseTable);
    MenuFunction    =   new MenuFunction(menuitemdisplaystr(PurchRFQCaseTable), MenuItemType::Display);
    alert           =   EventNotificationsync::newInfo(_subject,
                                                _bodyMsg,
                                                _bodyMsg,
                                                NoYes::Yes,
                                                curext(),
                                                PurchRFQCaseTable::find(_rFQCaseId),
                                                dataSourceName,
                                                MenuFunction);



    select _securityRole
        where _securityRole.Name == 'Estimator';

    while select _securityUserRole
            where _securityUserRole.SecurityRole == _securityRole.RecId
    {
        alert.parmUserId(_securityUserRole.User);
        alert.create();
    }
}
static void sendAlerts_SendbyDivisionManagers(str   _bodyMsg,str _subject/*,UBMTmpSalesForecastEntryForm   _TmpSalesForecastEntryForm*/)
{
    // commented by Sangeeth
    EventNotificationSync       alert;
    MenuFunction                MenuFunction;
    str                         dataSourceName;
    UserId                      _user;
    HcmPositionRecId            _salesExecutivePosition,_salesManagerPosition;
    HcmWorkerRecId              _SalesManager;
    //UBMSalesForecastEntryForm       _salesForecastEntryForm;

    ;
    //select firstonly _salesForecastEntryForm
        //where _salesForecastEntryForm.RecId == _TmpSalesForecastEntryForm.Parantrecid;
    //_user = DirPersonUser::findWorker(_salesForecastEntryForm.EmployeeId).User;
//
    //dataSourceName  =   tablestr(UBMSalesForecastEntryForm);
    //MenuFunction    =   new MenuFunction(menuitemdisplaystr(UBMSalesForecastEntryForm), MenuItemType::Display);
    //alert           =   EventNotificationsync::newInfo(_subject,
                                                //_bodyMsg,
                                                //_bodyMsg,
                                                //NoYes::Yes,
                                                //curext(),
                                                //_salesForecastEntryForm,
                                                //dataSourceName,
                                                //MenuFunction);



    alert.parmUserId(_user);

    alert.create();
}
static void sendAlerts_SendbyRegManagers(str   _bodyMsg,str _subject/*,UBMTmpSalesForecastEntryForm   _salesForecastEntryForm*/)
{
    // commented by Sangeeth
    EventNotificationSync       alert;
    MenuFunction                MenuFunction;
    str                         dataSourceName;
    UserId                      _user;
    HcmPositionRecId            _salesExecutivePosition,_salesManagerPosition;
    HcmWorkerRecId              _SalesManager;
    HcmPositionWorkerAssignment _hcmPositionWorkerAssignment;
    ;
    select _hcmPositionWorkerAssignment
        where _hcmPositionWorkerAssignment.Worker == Global::currentWorker();
    _salesExecutivePosition = HcmPositionHierarchy::findByPosition(_hcmPositionWorkerAssignment.Position).ParentPosition;
    _SalesManager = HcmPositionWorkerAssignment::findByPosition(_salesExecutivePosition).Worker;
    _user = DirPersonUser::findWorker(_SalesManager).User;

    //dataSourceName  =   tablestr(UBMSalesForecastEntryForm);
    //MenuFunction    =   new MenuFunction(menuitemdisplaystr(UBMTMPSalesForecastEntryForm), MenuItemType::Display);
    //alert           =   EventNotificationsync::newInfo(_subject,
                                                //_bodyMsg,
                                                //_bodyMsg,
                                                //NoYes::Yes,
                                                //curext(),
                                                //_salesForecastEntryForm,
                                                //dataSourceName,
                                                //MenuFunction);



    alert.parmUserId(_user);

    alert.create();
}
static void sendAlerts_SendbySalesExecutive(str   _bodyMsg,str _subject/*,UBMSalesForecastEntryForm   _salesForecastEntryForm*/)
{
    // commented by Sangeeth
    EventNotificationSync       alert;
    MenuFunction                MenuFunction;
    str                         dataSourceName;
    UserId                      _user;
    HcmPositionRecId            _salesExecutivePosition,_salesManagerPosition;
    HcmWorkerRecId              _SalesManager;
    //UBMTmpSalesForecastEntryForm    _ubmTmpSalesForecastEntryForm;

    ;
   // _salesExecutivePosition = HcmPositionHierarchy::find(_salesForecastEntryForm.Positionrecid).ParentPosition;
    //select _ubmTmpSalesForecastEntryForm
        //where _ubmTmpSalesForecastEntryForm.Parantrecid == _salesForecastEntryForm.RecId;
    //_SalesManager = HcmPositionWorkerAssignment::findByPosition(_salesForecastEntryForm.Positionrecid).Worker;
    //_user = DirPersonUser::findWorker(_SalesManager).User;
//
    //dataSourceName  =   tablestr(UBMSalesForecastEntryForm);
    //MenuFunction    =   new MenuFunction(menuitemdisplaystr(UBMSalesForecastEntryForm), MenuItemType::Display);
    //alert           =   EventNotificationsync::newInfo(_subject,
                                                //_bodyMsg,
                                                //_bodyMsg,
                                                //NoYes::Yes,
                                                //curext(),
                                                //_ubmTmpSalesForecastEntryForm,
                                                //dataSourceName,
                                                //MenuFunction);



    alert.parmUserId(_user);

    alert.create();
}
static void sendAlerts_UpdatedSalesPrice( str   _bodyMsg,str _subject,QuotationId _quotationId )
{
    // commented by Sangeeth
    EventNotificationSync   alert;
    MenuFunction            MenuFunction;
    HcmWorkerRecId          _hcmWorkerId;
    UserId                  _user;
    SalesQuotationTable     _SalesQuotationTable;
   // EnquiryNo               _enquiryNo;
    str                     dataSourceName;
    ;
    //_enquiryNo           = SalesQuotationTable::find(_quotationId).UBMRefEnquiryNo;
    //_hcmWorkerId         = SalesQuotationTable::find(_enquiryNo).WorkerSalesTaker;
    _user                = DirPersonUser::findWorker(_hcmWorkerId).User;
    dataSourceName  =   tablestr(SalesQuotationTable);
    MenuFunction    =   new MenuFunction(menuitemdisplaystr(SalesQuotationTableDetails), MenuItemType::Display);
    alert           =   EventNotificationsync::newInfo(_subject,
                                                _bodyMsg,
                                                _bodyMsg,
                                                NoYes::Yes,
                                                curext(),
                                                SalesQuotationTable::find(_quotationId),
                                                dataSourceName,
                                                MenuFunction);



    alert.parmUserId(_user);

    alert.create();
}

Hirerachy position and QueryToRDP Report Example


// based on the Hirerachy position value ill display
static void hirerachypositionandReportQuerytoRdp(Args _args)
{
     str UserId;

    // Hierarchy position test class
    // HierarchyPosition Table
    /*class RecursionPosition
    {
        str UserId;
    }
    void recursiveCallProj(HcmPositionRecid    _position = 0)
    {
    HcmPositionHierarchy HcmPositionHierarchy;
    HierarchyPosition   hierarchyPosition;
    HcmPosition         posi;
    HcmWorker           work;
    int64               recid;
    ;
    while select HcmPositionHierarchy
    where HcmPositionHierarchy.ParentPosition == _position
    {
        // setprefix("1");
        //info(strFmt("%1",HcmPositionHierarchy.Position));
        select Posi where posi.RecId == HcmPositionHierarchy.Position;
        recid = hcmposition::getWorker(posi.RecId);
        select work where work.RecId == recid;
        hierarchyPosition.Position = work.RecId;
        hierarchyPosition.userid = curuserid();
        hierarchyPosition.insert();

        this.recursiveCallProj(HcmPositionHierarchy.Position);

        }
        }
    public static void postion(str userid = curUserId())
    {
    HcmPositionRecid        _position; //= 5637144597;
    HcmPositionHierarchy    HcmPositionHierarchy;
    RecursionPosition       RecursionPosition;
    HcmPosition             posi;
    int64                   recid;
    HcmWorker               work;
    HierarchyPosition   hierarchyPosition;
    //str UserId;

    ;
    //UserId = user;
    _position = HcmPositionWorkerAssignment::getActivePositionWorkerAssignment(HcmWorker::find(HcmWorker::userId2Worker(userid)).RecId).Position;
    //_position = HcmPositionWorkerAssignment::getActivePositionWorkerAssignment(HcmWorker::findByPersonnelNumber(personnelno).RecId).Position;
    RecursionPosition = new RecursionPosition();


    while select HcmPositionHierarchy
    where HcmPositionHierarchy.Position == _position
    {
        info(strFmt("%1",HcmPositionHierarchy.Position));
        select Posi where posi.RecId == HcmPositionHierarchy.Position;
        recid = hcmposition::getWorker(posi.RecId);
        select work where work.RecId == recid;
        hierarchyPosition.Position = work.RecId;
        hierarchyPosition.userid = curUserId();
        hierarchyPosition.insert();


        RecursionPosition.recursiveCallProj(HcmPositionHierarchy.Position);

    }


    }
    // Example QUery report to RDP Report class Example
    [
    SRSReportQueryAttribute(queryStr(UBMSalesEnquiryTable))
    ]





// Query TO rdp

    class UBMSalesEnquiryRegisterDP extends SRSReportDataProviderBase
    {

        UBMSalesEnquiryRegisterTmp     SalesEnquiryRegisterTmp;

    }
    private Query buildQuery(
    Query           _query,
    str             _worker)
    {

        // Add the date range on all three data sources to allow SQL to restrict the records as much as possible prior to processing
        _query.dataSourceTable(tableNum(SalesQuotationTable), 1).addRange(fieldNum(SalesQuotationTable, WorkerSalesResponsible)).value(_worker);

        return _query;
    }
    [SRSReportDataSetAttribute("UBMSalesEnquiryRegisterTmp")]
    public UBMSalesEnquiryRegisterTmp getUBMSalesEnquiryRegisterTmp()
    {
        select * from SalesEnquiryRegisterTmp;
        return  SalesEnquiryRegisterTmp;
    }
    [SysEntryPointAttribute(false)]
    public void processReport()
    {
    QueryRun                queryRun;
    SalesQuotationTable     salesQuotationTable;
    HcmWorker               hcmWorker;
    str                     workerHirerchy;
    //helper.amountRemainSalesPhysical(this.SalesTableRecId);

    HierarchyPosition    hierarchyPosition;
    boolean     first = true;


    delete_from hierarchyPosition;

    RecursionPosition::postion();


    while select hierarchyPosition //where currency.CurrencyCode like "E*"
    {
        if(first)
        {
            workerHirerchy = strFmt("%1,",hierarchyPosition.Position);
            first = false;
        }
        else
        {

            workerHirerchy += strFmt("%1,",hierarchyPosition.Position);
        }

    }

    queryRun = new QueryRun(this.buildQuery(this.parmQuery(),workerHirerchy));

    //queryRun = new QueryRun(this.parmQuery());

    while (queryRun.next())
    {
        salesQuotationTable                                 = queryRun.get(tableNum(SalesQuotationTable));

        SalesEnquiryRegisterTmp.QuotationId                        = salesQuotationTable.QuotationId;
        SalesEnquiryRegisterTmp.QuotationName                      = salesQuotationTable.QuotationName;
        SalesEnquiryRegisterTmp.CreateDate                         = salesQuotationTable.createDate();
        SalesEnquiryRegisterTmp.CustomerRef                        = salesQuotationTable.CustomerRef;
        SalesEnquiryRegisterTmp.CustName                           = salesQuotationTable.customerName();
        SalesEnquiryRegisterTmp.LineAmount                         = salesQuotationTable.lineAmount();
        SalesEnquiryRegisterTmp.UBMrefenquiryno                    = salesQuotationTable.UBMrefenquiryno;
        SalesEnquiryRegisterTmp.VendName                           = salesQuotationTable.VendName();
        SalesEnquiryRegisterTmp.MOE                                = salesQuotationTable.SalesOriginId;
        SalesEnquiryRegisterTmp.QuotationStatus                    = salesQuotationTable.QuotationStatus;
        SalesEnquiryRegisterTmp.ReasonId                           = salesQuotationTable.ReasonId;
        SalesEnquiryRegisterTmp.UBMEnquiryDate                     = salesQuotationTable.UBMEnquiryDate;
        SalesEnquiryRegisterTmp.WorkerSalesResponsible             = HcmWorker::find(salesQuotationTable.WorkerSalesResponsible).name();
        SalesEnquiryRegisterTmp.QuotationCategory                  = salesQuotationTable.QuotationCategory;
        SalesEnquiryRegisterTmp.Competitor                         = " ";
        SalesEnquiryRegisterTmp.insert();


    }


}*/
}

Item Price Analysis Code %%%

// Item Price Analysis Code %%%

 InventTable         inventTable;
    InventTrans         inventTrans;
    InventSum               inventSum;
    Query                   query;
    QueryBuildDataSource    qbds;
    QueryBuildRange         qbrItemid,qbrItemGroup;
    QueryRun                qr;
    DimensionAttributeValueSetStorage   dimStorage;
    InventTableModule       inventTableModule;
    CustInvoiceTrans        custInvoiceTransMax,custInvoiceTrans,custInvoiceTransMin;
    InventTransOrigin       inventTransOrigin;
    Amount                  amount,minPrice,amountDiv,sales25,sales50,sales75,sales100;
    int i;

    super();
    delete_from itempriceAnalysis;
    query = new Query();
    qbds = query.addDataSource(tableNum(InventTable));
    _item = ItemId.valueStr();
    _itemBuyerGroup = ItemGroup.valueStr();
    _subDivision = SubDivision.valueStr();
    if(_item)
    {
        qbrItemid = qbds.addRange(fieldNum(InventTable,ItemId));
        qbrItemid.value(strReplace(_item,";",","));
    }
    if(_itemBuyerGroup)
    {
        qbrItemGroup = qbds.addRange(fieldNum(InventTable,ItemBuyerGroupId));
        qbrItemGroup.value(strReplace(_itemBuyerGroup,";",","));
    }
    qr = new QueryRun(query);
    while(qr.next())
    {
        inventTable = qr.get(tableNum(InventTable));

        dimStorage = DimensionAttributeValueSetStorage::find(inventTable.DefaultDimension);
        itempriceAnalysis.clear();
        if (_subDivision && (_subDivision!= dimStorage.getDisplayValueByDimensionAttribute(DimensionAttribute::findByName('SubDivisions').RecId)))
        {
                continue;
        }
        itempriceAnalysis.SubDivision = dimStorage.getDisplayValueByDimensionAttribute(DimensionAttribute::findByName('SubDivisions').RecId);
        itempriceAnalysis.ItemId = inventTable.ItemId;
        itempriceAnalysis.ItemBuyerGroupId = inventTable.ItemBuyerGroupId;
        itempriceAnalysis.ItemName = inventTable.itemName();
        select inventSum where inventSum.ItemId == inventTable.ItemId;
        itempriceAnalysis.CurrentUnitCost = inventSum.averageCostPrice();

        select * from inventTrans order by RecId desc
                where inventTrans.ItemId == inventTable.ItemId
                        && inventTrans.StatusReceipt == StatusReceipt::Purchased
                join inventTransOrigin where inventTransOrigin.RecId == inventTrans.InventTransOrigin
                                && inventTransOrigin.ReferenceCategory == InventTransType::Purch;
             itempriceAnalysis.LastPurchasePrice =  inventTrans.costValue();

        select minof(SalesPrice) from custInvoiceTransMin
                where custInvoiceTransMin.ItemId == inventTable.ItemId;
            itempriceAnalysis.LowestSalesPrice = custInvoiceTransMin.SalesPrice;

        select maxOf(SalesPrice) from custInvoiceTransMax
                where custInvoiceTransMax.ItemId == inventTable.ItemId;
            itempriceAnalysis.HighestSalesPrice = custInvoiceTransMax.SalesPrice;
           amount = custInvoiceTransMax.SalesPrice - custInvoiceTransMin.SalesPrice;

        amountDiv   = amount/4;
        //if (amountDiv != 0.00)
        //{
            minPrice    = custInvoiceTransMin.SalesPrice;
            sales25     = minPrice + amountDiv;
            sales50     = sales25 + amountDiv;
            sales75     = sales50 + amountDiv;
            sales100    = sales75 + amountDiv;


        while select custInvoiceTrans
                where custInvoiceTrans.ItemID == inventTable.ItemId
        {

            if(custInvoiceTrans.SalesPrice >= minPrice && custInvoiceTrans.SalesPrice <= sales25)
                itempriceAnalysis.SalesValue25 += custInvoiceTrans.LineAmount;
            if(custInvoiceTrans.SalesPrice > sales25 && custInvoiceTrans.SalesPrice <= sales50)
                itempriceAnalysis.SalesValue50 += custInvoiceTrans.LineAmount;
             if(custInvoiceTrans.SalesPrice > sales50 && custInvoiceTrans.SalesPrice <= sales75)
                itempriceAnalysis.SalesValue75 += custInvoiceTrans.LineAmount;
             if(custInvoiceTrans.SalesPrice > sales75 && custInvoiceTrans.SalesPrice <= sales100)
                itempriceAnalysis.SalesValue100 += custInvoiceTrans.LineAmount;

        }

        //}

        itempriceAnalysis.insert();

    }
    ItemPriceAnalysisTmp_ds.research();
    ItemPriceAnalysisTmp_ds.refresh();

Get Default Dimension Value through X++ by default dimension field



// Get Default Dimension Value through X++ by deafault dimension field

dimStorage = DimensionAttributeValueSetStorage::find(salesline.DefaultDimension);

            str  = dimStorage.getDisplayValueByDimensionAttribute(dimensionAttribute::findByName('Divisions').RecId);
           str  = dimStorage.getDisplayValueByDimensionAttribute(dimensionAttribute::findByName('SubDivisions').RecId);
           str  = dimStorage.getDisplayValueByDimensionAttribute(dimensionAttribute::findByName('Provinces').RecId);

Form to Form Args passing in Ax 2012

\\ Form to Form Args passing in Ax 2012

Form 1:
public class FormRun extends ObjectRun
{
   FirstForm FirstForm;
}
    Args args;
    FormRun formRun;
    ;
    super();
    args = new args(formstr(FormSecond));
    args.record(FormFirstTable);
    formrun = classfactory.formrunclass(args);
    formrun.init();
    formrun.run();
    formrun.wait();
    formrun.detach();


Form 2:
public class FormRun extends ObjectRun
{
    FormFirstTable _FormFirstTable;
}

public void init()
{
    super();
    _FormFirstTable = element.args().record();
    FormSecondTable_ds.query().dataSourceTable(Tablenum(FormSecondTable)).addRange(fieldNum(FormSecondTable,SecondForm)).value(SysQuery::value(_FormFirstTable.FirstForm));
}

Get Worker Dept from Worker in ax 2012

// Get Worker Dept from Worker in ax 

display Name WorkerDepartmentName()
{
    HcmWorker               hcmWorker;
    str                     deptName;

    select RecId from hcmWorker
            where hcmWorker.RecId == this.UpdatedByWorker;

     deptName = hcmWorker.primaryDepartmentName();

    return deptName;

}

Tutorial Runbase batch class auto mail for customer open Invoice to customer

 // Tutorial Runbase batch class auto mail for customer open Invoice to customer

static void San_CustomerOpenInvoiceMail(Args _args)
{
        CustTransOpen                   custTransOpen,custTO;
    CustTrans                       custTrans,custT;
    CustTable                       custtable;
    SysMailer                       mail;
    str                             senderEmail,name,Accountno;
    str                             recipientEmail,recipientEmail2;
    str                             messageText, leavetype,letterTemplate;
    str                             cc, to, body, sub;
    int                             i,j=0;
    int64                           countrecid;
    container                       dataAccountNum,dataInvoice,dataDueDate,dataTransDate,dataInvoiceAmount,dataAmountNotSettled;

    mail = new SysMailer();

    sub                 =  strfmt("Regarding Customer Open Invoice payment Pending Request");
    senderEmail         =  'bharathi@cbizol.com';
   // recipientEmail    = 'sangeethr90@gmail.com';

     while select custtable
                where custtable.AccountNum like "1101"
    {

        if(custtable.AccountNum)
        {
                j =0;
                while select custTransOpen
                            where custTransOpen.AccountNum == custtable.AccountNum
                {
                    j ++;
                }
                if(j == 0)
                {
                    continue;
                }
                if(j >0)
                {
                    dataAccountNum          = conNull();
                    dataInvoice             = conNull();
                    dataDueDate             = conNull();
                    dataTransDate           = conNull();
                    dataInvoiceAmount       = conNull();
                    dataAmountNotSettled    = conNull();

                    while select custTO where custTO.AccountNum == custtable.AccountNum
                                            && custTO.AmountCur > 0.00
                            join custT where custT.AccountNum == custTO.AccountNum
                                            && custT.RecId == custTO.RefRecId
                    {
                        //info(strFmt("%1 -%2",custT.Invoice,custTO.AccountNum));
                        name                    = CustTable::find(custTO.AccountNum).name();
                        Accountno               = custTO.AccountNum;
                        recipientEmail          = 'sangeeth@cbizol.com';//CustTable::find(custTO.AccountNum).email();
                        dataAccountNum          += [custTO.AccountNum];
                        dataInvoice             += [custT.Invoice];
                        dataDueDate             += [custTO.DueDate];
                        dataTransDate           += [custTO.TransDate];
                        dataInvoiceAmount       += [custTO.AmountCur];
                        dataAmountNotSettled    += [custTO.AmountCur];

                        body            = "<html><body>"+ strfmt("Dear %1",name + "<br/><br>"+
                                            strfmt("\n Open Invoice Requested for the  Customer Account  (%1) and Reminder on %2",Accountno,today()) + "<br/><br>");
                        body            = Body + "<html> <body><table border='1'>";
                        body            = body+  "<tr><th>" +   "Invoice Number"    +"</th>";
                        body            = body+  "<th>" +   "Due Date"    +"</th>";
                        body            = body+  "<th>" +   "Trans Date"    +"</th>";
                        body            = body+  "<th>" +   "Invoice Amount"    +"</th>";
                        body            = body+  "<th>" +   "Amount Not Settled"    +"</th></tr>";
                        for(i = 1;i <= conLen(dataAccountNum); i++)
                        {
                            body            = body+  "<tr><td>" + strfmt("%1",conPeek(dataInvoice,i))    +"</td>";
                            body            = body+  "<td>" + strfmt("%1",conPeek(dataDueDate,i))    +"</td>";
                            body            = body+  "<td>" +  strfmt("%1",conPeek(dataTransDate,i))    +"</td>";
                            body            = body+  "<td>" +  strfmt("%1",conPeek(dataInvoiceAmount,i))    +"</td>";
                            body            = body+  "<td>" +  strfmt("%1",conPeek(dataAmountNotSettled,i))    +"</td></tr>";
                        }

                      }
                            Body                = Body + "</table>";
                            Body                = Body + strfmt("<br/><br/><b>Note:This is a system generated email.Please do not reply to this mail.</b> </body></html>");
                            mail.quickSend(senderEmail, recipientEmail,sub,body);
                }
        }
    }

}



Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...