Sunday, May 28, 2017

Mapping two dataset fields in to one tablix in SSRS

//Mapping two dataset fields in to one tablix in SSRS

//Dataset - dataset1(Value1,Value2,Value3)
Dataset - dataset2(Value1,Value4)

SSRS design
Tablix (parent dataset- Dataset1)

//Requirement - In same tablix need to map dataset2 fields.

//Below Expression
=lookup(Field!Value1.Value,Fields!Value1.value,Fields!Value4.value,"Dataset2")

Vendor and Customer Invoice Settlement Number Marked Transaction

static void SettelementInvoiceNum(Args _args)
{
    LedgerJournalTrans  ledgerJournalTrans;
    CustVendFindSettlements custVendFindSettlements;
    TmpCustVendTrans            tmpCustVendTrans;
        str invoice;
    ;
    ledgerJournalTrans = LedgerJournalTrans::findRecId(5637161826,false);
    custVendFindSettlements = new CustVendFindSettlements(ModuleCustVend::Vend, ledgerJournalTrans);
    if (ledgerJournalTrans.ledgerJournalTable().JournalType == LedgerJournalType::VendPromissoryNoteRedraw ||
        ledgerJournalTrans.ledgerJournalTable().JournalType == LedgerJournalType::BankChequeReversal)
    {
        custVendFindSettlements.findSettledSettlements();
    }
    else
    {
        custVendFindSettlements.findSettlements();
    }
    tmpCustVendTrans.setTmpData(custVendFindSettlements.tmpCustVendTrans());
    while select tmpCustVendTrans
    {
        invoice += strFmt("%1,", tmpCustVendTrans.Invoice);
    }
    info(invoice);
}

VendSettlement      vendSettlement;
    VendTrans           vendTrans;
    VendTransOpen       vendTransOpen;
    CustVendOpenTransManager    manager;
    LedgerJournalTrans  ledgerJournalTrans;
    ;
    //If it is posted
    info("PMT00002749");
    while select vendSettlement
        where vendSettlement.AccountNum      == "V00566"
            && vendSettlement.OffsetTransVoucher == "PMT00002749"
    {
        select vendTrans
        where vendTrans.dataAreaId  == vendSettlement.TransCompany
        && vendTrans.RecId          == vendSettlement.TransRecId
        && vendTrans.AccountNum     == vendSettlement.AccountNum;
        info(vendTrans.Invoice);
    }
   
    //if it is open
    vendTrans.clear();
    info("PMT00002750");
    while select vendTransOpen
        where vendTransOpen.AccountNum      == "V00530"
    {
        if(SpecTrans::findByRef(vendTransOpen.dataAreaId,vendTransOpen.TableId,vendTransOpen.RecId))
        {
             select * from ledgerJournalTrans where ledgerJournalTrans.Voucher == "PMT00002750";
            manager = CustVendOpenTransManager::construct(ledgerJournalTrans);
            select vendTrans
                where vendTrans.AccountNum == vendTransOpen.AccountNum
                    && vendTrans.RecId  == vendTransOpen.RefRecId;
            manager.getTransMarked(vendtransopen);
            if(manager.getTransMarked(vendtransopen) == true)
            {
                info(vendTrans.Invoice);
            }
        }
    }

Get Caller Form name and caller name in AX Table,AX Class method ax 2012

//Get Caller Form name and caller name in AX Table method ax 2012
FormDataSource fds;
FormName fn;
FormRun     caller;
if (this.isFormDataSource())
{
    fds = this.dataSource() as FormDataSource;
    if (fds)
    {
        fn = fds.formRun().name();
 caller = fds.formRun().args().caller();
            if(caller.args().name() == formStr(<Form Name>))
            {
                //logic
            }
    }
}

Set configuration key run time based on user login

//Set configuration key run time based on user login

ConfigurationKeySet configurationKeySet;
if (!isConfigurationkeyEnabled(configurationKeyNum("")))
{
configurationKeySet = new ConfigurationKeySet();
configurationKeySet.loadSystemSetup();
configurationKeySet.enabled(configurationKeyNum(""), true);
SysDictConfigurationKey::save(configurationKeySet.pack());
SysSecurity::reload(true, true, false, true);
}

New fields Addeing in to AxBC class in ax 2012

// New fields in ax 2012

static void CreateAxBCParmMethod(Args _args)
{
    axGenerateAxBCClass axGenerateAxBCClass;
    axGenerateAxBCClass = AxGenerateAxBCClass::newTableId(tablenum(InventTable));
    axGenerateAxBCClass.run();
}

Send Email using default AX outgoing mail table ax 2012

//Send Email using default AX outgoing mail table ax 2012
static void MailCheck4(Args _args)
{
    SysOutgoingEmailTable               outgoingEmailTable;
    SysOutgoingEmailData                outgoingEmailData;
    SysEmailItemId                      nextEmailItemId;
    Map                                 map;
    BinData                             binData = new BinData();
    container                           data;
    container                           embeddedBinaryData;
    Filename                            filePath;
    Filename                            filename;
    str                                 _filename = @"filepath and name.xlsx";
    Filename                            fileExtension;
    CLRObject                           ex;
    ;   
    try
    {
        ttsBegin;
        nextEmailItemId                                 = EventInbox::nextEventId();
        outgoingEmailTable.EmailItemId                  = nextEmailItemId;
        outgoingEmailTable.IsSystemEmail                = NoYes::No;
        outgoingEmailTable.Sender                       = "";
        outgoingEmailTable.SenderName                   = "";
        outgoingEmailTable.Recipient                    = "";
        outgoingEmailTable.Subject                      = SysEmailMessage::stringExpand("Test Mail", map);
        outgoingEmailTable.Priority                     = eMailPriority::High ;
        outgoingEmailTable.WithRetries                  = false;
        outgoingEmailTable.RetryNum                     = 2;
        outgoingEmailTable.UserId                       = curUserId();
        outgoingEmailTable.Status                       = SysEmailStatus::Unsent;
        outgoingEmailTable.Message                      = "Test mail don't reply";
        outgoingEmailTable.LatestStatusChangeDateTime   = DateTimeUtil::getSystemDateTime();
        outgoingEmailTable.insert();
   
        outgoingEmailData.clear();
        outgoingEmailData.EmailItemId                   = nextEmailItemId;
        outgoingEmailData.DataId                        = 1;
        outgoingEmailData.EmailDataType                 = SysEmailDataType::Attachment;
        binData.loadFile(_filename);
        embeddedBinaryData                              = binData.getData();
        outgoingEmailData.Data                          = embeddedBinaryData;
        [filePath, filename, fileExtension]             = Global::fileNameSplit(_filename);
        outgoingEmailData.FileName                      = filename;
        outgoingEmailData.FileExtension                 = fileExtension;   
        outgoingEmailData.insert();
        info("Mail added in to queue");
        ttsCommit;
    }
    catch
    {
        ex = CLRInterop::getLastException();
        while(ex != null)
        {
            error(ex.ToString());
            ex = ex.get_InnerException();
        }
    }
}

Adding new fields in On Hand Inventory form ax 2012 R2/R3

// Adding new fields in On Hand Inventory form ax 2012 R2/R3
//Create one View to link with inventTable
//Example - Inventory unit, purchase unit, Product name
Invent Table
 -> Inner Join (EcoResProduct)
  -> Inner Join (EcoResProductTransalation)
 -> Inner Join(InventTableModule as Invent)
 -> Inner Join(InventTableModule as Purchase)
Drag fields which want to display in on hand form and then item id field.
//Form
//InventOnHandItem
//DataSources - InventSum
//Method - ExecuteQuery
Code
//element.inventDimSetupObject().modifyQuery(inventSum_DS,inventDim_DS);//Commented by Sangeeth
    //Added by sangeeth
    element.inventDimSetupObject().modifyQuery(inventSum_DS,inventDim_DS
                        ,InventDetailView_DS);
    //End Code
Super();
//Class
Class->InventDimCtrl_Frm_OnHand
Method-> modifyQuery
Create new optional argument in ModifyQuery method
Code
public void modifyQuery(
    FormDataSource _inventSum_DS,
    FormDataSource _inventDim_DS,
    //Added by Sangeeth
    FormDataSource  _InventDetail_DS = null
    //End Code
    )
{
QueryBuildDataSource    qbsInventDetailLookup;//Added by Sangeeth
code logic:
in ModifyQuery Method at last write below code
//Added by Sangeeth
    if(_InventDetail_DS != null)
    {
        qbsInventDetailLookup = query.dataSourceName(_InventDetail_DS.name());
        qbr = SysQuery::findOrCreateRange(qbsInventDetailLookup, fieldnum(InventDetailView, LanguageId));
        qbr.value(queryValue(CompanyInfo::languageId()));
        qbsInventDetailLookup.addGroupByField(fieldNum(InventDetailView, Name));
        qbsInventDetailLookup.addGroupByField(fieldNum(InventDetailView,InventUnit));
        qbsInventDetailLookup.addGroupByField(fieldNum(InventDetailView,PurchUnit));
        qbsSum = _InventDetail_DS.query().datasourceTable(tablenum(InventTable));
        qbsSum.addGroupByField(fieldNum(InventTable,ItemId));
        qbsSum.addGroupByField(fieldNum(InventTable,Product));
    }
    //End Code

Get Sales Agreement Price Without standard method in AX

Public Price GetSalesAgreementPrice(ItemId          itemRelation,
                                    CustAccount     accountRelation,
                                    InventdimId     dimId = "",
                                    PriceType       relation =  PriceType::PriceSales
                                    )
{
    PriceDiscTable      priceDiscTable;
    ;
    if(!dimId)
    {
        priceDiscTable.clear();
        select * from  priceDiscTable
                    where priceDiscTable.Relation  == relation               
                            && priceDiscTable.ItemCode == TableGroupAll::Table
                                && priceDiscTable.ItemRelation       == itemRelation
                                    && priceDiscTable.AccountCode ==  TableGroupAll::All;
        if (priceDiscTable)
        {
            return priceDiscTable.Amount;
        }
        priceDiscTable.clear();
        select * from  priceDiscTable
                where priceDiscTable.Relation          == relation
                    && priceDiscTable.AccountCode        == TableGroupAll::Table 
                        && priceDiscTable.AccountRelation    == accountRelation
                            &&  priceDiscTable.ItemCode           == TableGroupAll::Table
                                && priceDiscTable.ItemRelation       == itemRelation;
        if (priceDiscTable)
        {
            return priceDiscTable.Amount;
        }
        priceDiscTable.clear();
        select * from  priceDiscTable
                where priceDiscTable.Relation           == relation
                    && priceDiscTable.ItemCode           == TableGroupAll::All
                        && priceDiscTable.AccountCode ==  TableGroupAll::Table
                            && priceDiscTable.AccountRelation    == accountRelation ;
        if (priceDiscTable)
        {
            return priceDiscTable.Amount;
        }
        priceDiscTable.clear();
        select * from  priceDiscTable
                where priceDiscTable.Relation           == relation
                    && priceDiscTable.ItemCode           == TableGroupAll::Table
                        && priceDiscTable.AccountRelation    == CustTable::find(accountRelation).CustGroup
                            && priceDiscTable.AccountCode ==  TableGroupAll::GroupId
                                && priceDiscTable.ItemRelation       == itemRelation;
        if (priceDiscTable)
        {
            return priceDiscTable.Amount;
        }
        priceDiscTable.clear();
        select * from  priceDiscTable
                where priceDiscTable.Relation           == relation
                    && priceDiscTable.ItemCode           == TableGroupAll::All
                        && priceDiscTable.AccountRelation    == CustTable::find(accountRelation).CustGroup
                            && priceDiscTable.AccountCode ==  TableGroupAll::GroupId ;
        if (priceDiscTable)
        {
            return priceDiscTable.Amount;
        }
        priceDiscTable.clear();
        select * from  priceDiscTable
                where priceDiscTable.Relation           == relation
                    && priceDiscTable.ItemCode           == TableGroupAll::GroupId
                        && priceDiscTable.AccountRelation    == CustTable::find(accountRelation).CustGroup
                            && priceDiscTable.AccountCode ==  TableGroupAll::GroupId
                                && priceDiscTable.ItemRelation       == InventTable::find(itemRelation).itemGroupId();
        if (priceDiscTable)
        {
            return priceDiscTable.Amount;
        }

    }
    else
    {
        priceDiscTable.clear();
        select * from  priceDiscTable
                    where priceDiscTable.Relation  == relation               
                            && priceDiscTable.ItemCode == TableGroupAll::Table
                                && priceDiscTable.ItemRelation       == itemRelation
                                    && priceDiscTable.AccountCode ==  TableGroupAll::All
                                        && priceDiscTable.InventDimId == dimId;
        if (priceDiscTable)
        {
            return priceDiscTable.Amount;
        }
        priceDiscTable.clear();
        select * from  priceDiscTable
                where priceDiscTable.Relation          == relation
                    && priceDiscTable.AccountCode        == TableGroupAll::Table 
                        && priceDiscTable.AccountRelation    == accountRelation
                            &&  priceDiscTable.ItemCode           == TableGroupAll::Table
                                && priceDiscTable.ItemRelation       == itemRelation
                                    && priceDiscTable.InventDimId == dimId;
        if (priceDiscTable)
        {
            return priceDiscTable.Amount;
        }
        priceDiscTable.clear();
        select * from  priceDiscTable
                where priceDiscTable.Relation           == relation
                    && priceDiscTable.ItemCode           == TableGroupAll::All
                        && priceDiscTable.AccountCode ==  TableGroupAll::Table
                            && priceDiscTable.AccountRelation    == accountRelation
                                && priceDiscTable.InventDimId == dimId;
        if (priceDiscTable)
        {
            return priceDiscTable.Amount;
        }
        priceDiscTable.clear();
        select * from  priceDiscTable
                where priceDiscTable.Relation           == relation
                    && priceDiscTable.ItemCode           == TableGroupAll::Table
                        && priceDiscTable.AccountRelation    == CustTable::find(accountRelation).CustGroup
                            && priceDiscTable.AccountCode ==  TableGroupAll::GroupId
                                && priceDiscTable.ItemRelation       == itemRelation
                                    && priceDiscTable.InventDimId == dimId;
        if (priceDiscTable)
        {
            return priceDiscTable.Amount;
        }
        priceDiscTable.clear();
        select * from  priceDiscTable
                where priceDiscTable.Relation           == relation
                    && priceDiscTable.ItemCode           == TableGroupAll::All
                        && priceDiscTable.AccountRelation    == CustTable::find(accountRelation).CustGroup
                            && priceDiscTable.AccountCode ==  TableGroupAll::GroupId
                                && priceDiscTable.InventDimId == dimId;
        if (priceDiscTable)
        {
            return priceDiscTable.Amount;
        }
        priceDiscTable.clear();
        select * from  priceDiscTable
                where priceDiscTable.Relation           == relation
                    && priceDiscTable.ItemCode           == TableGroupAll::GroupId
                        && priceDiscTable.AccountRelation    == CustTable::find(accountRelation).CustGroup
                            && priceDiscTable.AccountCode ==  TableGroupAll::GroupId
                                && priceDiscTable.ItemRelation       == InventTable::find(itemRelation).itemGroupId()
                                    && priceDiscTable.InventDimId == dimId;
        if (priceDiscTable)
        {
            return priceDiscTable.Amount;
        }
    }
    return 0;
}

AX partial Purchase Order Product receipt

static void AXpartialPurchaseOrder(Args _args)
{
    PurchFormLetter             purchFormLetter;
    PurchFormletterParmData     purchFormLetterParmData;
    PurchParmUpdate             purchParmUpdate;
    PurchParmTable              purchParmTable;
    PurchParmLine               purchParmLine;
    PurchTable                  purchTable;
    PurchLine                   purchLine;
    ;
    ttsBegin;
    while select purchTable where purchTable.PurchId == "00000258"
    {
        purchFormLetterParmData = PurchFormletterParmData::newData(
             DocumentStatus::PackingSlip,
            VersioningUpdateType::Initial);
        purchFormLetterParmData.parmOnlyCreateParmUpdate(true);
        purchFormLetterParmData.createData(false);
        purchParmUpdate = purchFormLetterParmData.parmParmUpdate();
        purchParmTable.clear();
        purchParmTable.TransDate                = SystemDateGet();
        purchParmTable.Ordering                 = DocumentStatus::PackingSlip;
        purchParmTable.ParmJobStatus            = ParmJobStatus::Waiting;
        purchParmTable.Num                      = "TestP1";
        purchParmTable.PurchId                  = purchTable.PurchId;
        purchParmTable.PurchName                = purchTable.PurchName;
        purchParmTable.DeliveryName             = purchTable.DeliveryName;
        purchParmTable.DeliveryPostalAddress    = purchTable.DeliveryPostalAddress;
        purchParmTable.OrderAccount             = purchTable.OrderAccount;
        purchParmTable.CurrencyCode             = purchTable.CurrencyCode;
        purchParmTable.InvoiceAccount           = purchTable.InvoiceAccount;
        purchParmTable.ParmId                   = purchParmUpdate.ParmId;
        purchParmTable.insert();
        while select purchLine
            where purchLine.PurchId == purchTable.PurchId
        {
            purchParmLine.clear();
            purchParmLine.InitFromPurchLine(purchLine);
            purchParmLine.ReceiveNow    = purchLine.PurchQty;
            purchParmLine.ParmId        = purchParmTable.ParmId;
            purchParmLine.TableRefId    = purchParmTable.TableRefId;
            purchParmLine.setQty(DocumentStatus::PackingSlip, false, true);
            purchParmLine.setLineAmount();
            purchParmLine.insert();
        }
        purchFormLetter = PurchFormLetter::construct(DocumentStatus::PackingSlip);
        purchFormLetter.transDate(systemDateGet());
        purchFormLetter.proforma(false);
        purchFormLetter.specQty(PurchUpdate::All);
        purchFormLetter.purchTable(purchTable);
        purchFormLetter.parmParmTableNum(purchParmTable.ParmId);
        purchFormLetter.parmId(purchParmTable.ParmId);
        purchFormLetter.purchParmUpdate(purchFormLetterParmData.parmParmUpdate());
        purchFormLetter.run();
    }
    ttsCommit;
}

Update customer based on Selection fields in AX

static void updateCustomerStd(Args _args)
{
    CustTable   custTable,getcustTable;
   
    //Function to set customer record
    CustTable createCustTable(CustTable   _custTable)
    {
        AxCustTable     axCustTable;
        SysDictTable    sysDictTable = new SysDictTable(tableNum(CustTable));
        int             i;
        int             fieldCnt;
        FieldId         fieldId;
        ;
        ttsbegin;
        axCustTable = AxCustTable::constructValidateInput(_custTable);
        fieldCnt = sysDictTable.fieldCntWithoutSys();
        for (i=1;i <= fieldCnt;i++)
        {
            fieldId = sysDictTable.fieldCnt2Id(i);
            if (fieldNum(CustTable, AccountNum) != fieldId)
                axCustTable.setFieldAsTouched(fieldId);
        }
        axCustTable.save();
        ttscommit;
        return axCustTable.custTable();
    }
    ;
    ttsBegin;
    select forupdate custTable;
    info(custTable.AccountNum + " " + custTable.CustGroup + " " + custTable.InvoiceAccount);
    custTable.CustGroup = "Corporate";
    custTable.InvoiceAccount = "CH0000239";
    getcustTable = createCustTable(custTable);
    info(getcustTable.AccountNum + " " + getcustTable.CustGroup + " " + getcustTable.InvoiceAccount);
    ttsCommit;
}

Deploy EP sites

cd C:\Program Files\Microsoft Dynamics AX\60\Setup


AxUpdatePortal -updateWebSites -iisreset -verbose > "C:\EPUpdate.log"

Recover Deleted Sales Order in AX

static void RecoverDeletedSalesOrder(Args _args)
{
    SalesTableDelete    salesTableDelete;
    SalesLineDelete     salesLineDelete;
    SalesTable          salesTable;
    SalesLine           salesLine;
    ;
    SalesTableDelete = SalesTableDelete::find('', true);
    ttsbegin;
    switch (salesTableDelete.Cancelled)
    {
        case Voided::Voided :
            salesTable  = conpeek(salesTableDelete.SalesTable, 1);
            salesTable.insert();
            while select forupdate salesLineDelete where salesLineDelete.SalesId == salesTableDelete.SalesId
            {
                salesLine = conpeek(salesLineDelete.SalesLine, 1);
                salesLine.insert();
            }
            salesTableDelete.delete();
            break;
        case Voided::linesVoided :
            while select forupdate salesLineDelete where salesLineDelete.SalesId == salesTableDelete.SalesId
            {
                salesLine = conpeek(salesLineDelete.SalesLine, 1);
                salesLine.insert();
                salesLineDelete.delete();
            }
            salesTableDelete.delete();
            break;
   }
   ttscommit;
}

Recover Deleted Purchase Order in AX

static void RecoverDeletedPurchasOrder(Args _args)
{
    PurchTableDelete    purchTableDelete;
    PurchLineDelete     purchLineDelete;
    PurchTable          purchTable;
    PurchLine           purchLine;
    ;
    purchTableDelete = PurchTableDelete::find('', true);
    ttsbegin;
    switch (purchTableDelete.Cancelled)
    {
        case Voided::Voided :
            purchTable  = conpeek(purchTableDelete.PurchTable, 1);
            purchTable.insert();
            while select forupdate purchLineDelete where purchLineDelete.PurchId == purchTableDelete.PurchId
            {
                purchLine = conpeek(purchLineDelete.PurchLine, 1);
                purchLine.insert();
            }
            purchTableDelete.delete();
            break;
        case Voided::linesVoided :
            while select forupdate purchLineDelete where purchLineDelete.PurchId == purchTableDelete.PurchId
            {
                purchLine = conpeek(purchLineDelete.PurchLine, 1);
                purchLine.insert();
                purchLineDelete.delete();
            }
            purchTableDelete.delete();
            break;
   }
   ttscommit;
}

Batch Process from AX job x++

static void BatchProcessJob(Args _args)
{
    BatchHeader batHeader;
    BatchInfo batInfo;
    RunBaseBatch rbbTask;
    str ParmCaption = "test Process job";
    SysRecurrenceData     sysRecurrenceData = SysRecurrence::defaultRecurrence();   
    ;
    rbbTask = new CDataDownloadprocess();
//sysRecurrenceData = SysRecurrence::setRecurrenceEndAfter(sysRecurrenceData, 3);
    sysRecurrenceData = SysRecurrence::setRecurrenceStartDateTime(sysRecurrenceData,DateTimeUtil::newDateTime(mkDate(28,03,2017),str2time("07:30")));
    sysRecurrenceData = SysRecurrence::setRecurrenceNoEnd(sysRecurrenceData);
    sysRecurrenceData = SysRecurrence::setRecurrenceUnit(sysRecurrenceData,SysRecurrenceUnit::Day,1);
    batInfo = rbbTask.batchInfo();
    //rbbTask.run();
    batInfo.parmCaption(ParmCaption);
    batInfo.parmGroupId("");
    batHeader = BatchHeader ::construct();
    batHeader.addTask(rbbTask);
    batHeader.parmRecurrenceData(sysRecurrenceData);
    batHeader.save();
    info(strFmt("'%1' batch scheduled.", ParmCaption));
    /*BatchHeader batHeader;
    BatchInfo batInfo;
    RunBaseBatch rbbTask;
    str sParmCaption = "Process job";
    ;
    rbbTask = new CDataDownloadprocess();
    batInfo = rbbTask.batchInfo();
    batInfo.parmCaption(sParmCaption);
    batInfo.parmGroupId("");
    batHeader = BatchHeader ::construct();
    batHeader.addTask(rbbTask);
    batHeader.save();
    info(strFmt("'%1' batch scheduled.", ParmCaption));*/
}

Inventory Marking X++

static void San_MarkInventTrans(InventTransId _inventTransId,InventTransId _refInventTransId,InventQty _qtyTomark)
{
    InventTrans             issueInventTrans;
    TmpInventTransMark      tmpInventTransMask;
    Map                     mapMarkNow;
    container               conget;
    real                    qty;
    Map                     mapMark;
    MapEnumerator           mapEnumerator;
    InventTransOriginId issueInventTransOriginId    = InventTransOrigin::findByInventTransId(_inventTransId).RecId;
    InventTransOriginId receiptInventTransOriginId  = InventTransOrigin::findByInventTransId(_refInventTransId).RecId;
    InventQty qtyToMark = _qtyTomark;
    ttsBegin;
    issueInventTrans = InventTrans::findByInventTransOrigin(issueInventTransOriginId);
    [conget, qty] = TmpInventTransMark::packTmpMark(
        InventTransOrigin::find(issueInventTransOriginId),
        issueInventTrans.inventDim(),
        issueInventTrans.Qty);
    mapMark = Map::create(conget);
    mapEnumerator = mapMark.getEnumerator();
    while (mapEnumerator.moveNext())
    {
        tmpInventTransMask = mapEnumerator.currentValue();
        if (tmpInventTransMask.InventTransOrigin == receiptInventTransOriginId)
        {
            tmpInventTransMask.QtyMarkNow = qtyToMark;
            tmpInventTransMask.QtyRemain -= tmpInventTransMask.QtyMarkNow;
            mapMarkNow = new Map(Types::Int64, Types::Record);
            mapMarkNow.insert(tmpInventTransMask.RecId, tmpInventTransMask);
            TmpInventTransMark::updateTmpMark(
                issueInventTransOriginId,
                issueInventTrans.inventDim(),
                -qtyToMark,
                mapMarkNow.pack());
        }
    }
    ttsCommit;
}

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...