Thursday, 19 November 2020

PURCHASE LINE DISCOUNT price of trade agreement D365 code X++ get linediscount

 GET TRADE AGREEMENT PURCHASE line discount x++ CODE D365

WITH THE BELOW CODE YOU CAN GET THE CURRENT TRADE AGREEMENT line discount OF A GIVEN PURCHASE ORDER LINE IN D365.

 public static price findPurchLineDisc(Purchline _purchline, VendAccount _vendAccount, InventDimId _inventDimId)

    {

        InventTable inventTable = InventTable::find(_purchline.ItemId);

        VendTable vendTable = VendTable::find(_vendAccount);

        InventDim inventDimItem = InventDim::find(_inventDimId);

        UnitOfMeasureSymbol     unitId          = inventTable.inventTableModuleInvent().UnitId;

        PriceDisc_LineDisc      priceDisc_LineDisc;


        priceDisc_LineDisc = PriceDisc_LineDisc::construct();

        priceDisc_LineDisc.parmModuleType(ModuleInventPurchSales::Purch);

        priceDisc_LineDisc.parmItemId(inventTable.ItemId);

        priceDisc_LineDisc.parmInventDim(inventDimItem);

        priceDisc_LineDisc.parmUnitID(unitId);

        priceDisc_LineDisc.parmDiscDate(DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone()));

        priceDisc_LineDisc.parmQty(1);

        priceDisc_LineDisc.parmAccountNum(vendTable.AccountNum);

        priceDisc_LineDisc.parmItemLineDiscCode(_purchline.itemLineDisc());

        priceDisc_LineDisc.parmCurrencyCode(Ledger::accountingCurrency(CompanyInfo::current()));

        return priceDisc_LineDisc.discPct();

    }

Thanks,
Vikas Mehta

PURCHASE price of trade agreement D365 code X++ get purchase trade agreement price

GET TRADE AGREEMENT PURCHASE PRICE x++ CODE D365

WITH THE BELOW CODE YOU CAN GET THE CURRENT TRADE AGREEMENT PRICE OF A A GIVEN PURCHASE ORDER LINE IN D365.


 public static price findPurchPrice(ItemId _itemId, VendAccount _vendAccount, InventDimId _inventDimId)

    {

        InventTable inventTable = InventTable::find(_itemId);

        VendTable vendTable = VendTable::find(_vendAccount);

        InventDim inventDimItem = InventDim::find(_inventDimId);

        UnitOfMeasureSymbol     unitId          = inventTable.inventTableModuleInvent().UnitId;

        PriceDisc priceDisc;

        Price retprice;


        PriceDiscParameters parameters = PriceDiscParameters::construct();


        parameters.parmModuleType(ModuleInventPurchSales::Purch);

        parameters.parmItemId(inventTable.ItemId);

        parameters.parmInventDim(inventDimItem);

        parameters.parmUnitID(unitId);

        parameters.parmPriceDiscDate(DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone()));

        parameters.parmQty(1);

        parameters.parmAccountNum(vendTable.AccountNum);

        parameters.parmCurrencyCode(vendTable.Currency);

        priceDisc = PriceDisc::newFromPriceDiscParameters(parameters);

        

        // From Trade agreement

        if (priceDisc.findPrice(vendTable.PriceGroup))

        {

            retPrice = priceDisc.price();

        }

        //From Item

        else if (priceDisc.findItemPrice())

        {

            retPrice = priceDisc.price();

        }

        return retprice;

    }

Thanks,
Vikas Mehta

SALES price of trade agreement D365 code X++ get SALES trade agreement price

 GET TRADE AGREEMENT SALES PRICE x++ CODE D365

WITH THE BELOW CODE YOU CAN GET THE CURRENT TRADE AGREEMENT PRICE OF A A GIVEN SALES ORDER LINE IN D365.

public static price findPurchPrice(ItemId _itemId, CustAccount _custAccount, InventDimId _inventDimId)

    {

        InventTable inventTable = InventTable::find(_itemId);

        CustTable custTable = CustTable::find(_custAccount);

        InventDim inventDimItem = InventDim::find(_inventDimId);

        UnitOfMeasureSymbol     unitId          = inventTable.inventTableModuleInvent().UnitId;

        PriceDisc priceDisc;

        Price retprice;


        PriceDiscParameters parameters = PriceDiscParameters::construct();


        parameters.parmModuleType(ModuleInventPurchSales::Sales);

        parameters.parmItemId(inventTable.ItemId);

        parameters.parmInventDim(inventDimItem);

        parameters.parmUnitID(unitId);

        parameters.parmPriceDiscDate(DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone()));

        parameters.parmQty(1);

        parameters.parmAccountNum(custTable.AccountNum);

        parameters.parmCurrencyCode(custTable.Currency);

        priceDisc = PriceDisc::newFromPriceDiscParameters(parameters);

        

        // From Trade agreement

        if (priceDisc.findPrice(vendTable.PriceGroup))

        {

            retPrice = priceDisc.price();

        }

        //From Item

        else if (priceDisc.findItemPrice())

        {

            retPrice = priceDisc.price();

        }

        return retprice;

    }

Thanks,
Vikas Mehta

Tuesday, 3 November 2020

import a new model in d365 ModelUtil.exe

IMPORT A MODEL IN D365

Below are the steps to import a new model in D365 Finance and operation 

1)      Copy model files with .axmodel in any folder preferably in c: \Temp

Install a model in a development environment

To install a model file in a development environment, use the ModelUtil.exe tool and the -import directive.

Console
ModelUtil.exe -import -metadatastorepath=[path of the metadata store where model should be imported] -file=[full path of the file to import]

If the model already exists in your development environment, you must first delete it by using the -delete directive.

Console
ModelUtil.exe -delete -metadatastorepath=[path of the metadata store] -modelname=[name of the model to delete]

Sample Example : Model name is Vikas


ModelUtil.exe -import -metadatastorepath=K:\AOSService\PackagesLocalDirectory -modelname="Vikas" -file=c:\temp\Vikas.axmodel


Note : in this case the path is K:\AOSService\PackagesLocalDirectory 

and the model name is : Vikas 

and the path from which it will import the model file is "c:\temp\Vikas.axmodel".

So you will have to first save the model file @c:\temp\ folder....you can keep any other folder too as per your wish :)


If the model is imported successfully you can see a folder named Vikas at the below path K:\AOSService\PackagesLocalDirectory .


After the model is imported do a full build with Synchronization.

After that check for below in menus

Dynamics 365>Addins > Create project from conflicts select the model.

click ok .

In case of any issues then fix the points.


Thanks,

Vikas Mehta.

Monday, 2 November 2020

how to hide a parameter in contract class in D365 sysoperation

 how to hide a parameter in contract class

Many times you get into situation where you want to add a parameter but hide it from the user .

In that case you can simple add the below signature/attribute above the class.

  [DataMemberAttribute,  SysOperationControlVisibilityAttribute(false)]

    public ItemId parmItemid(ItemId _itemid = itemId)

    {

        itemid = _itemid;

        return itemid;

    }


Thanks!!!!!!!!!!!

AZURE INTERVIEW QUESTIONS AND ANSWERS

AZURE INTERVIEW QUESTIONS AND ANSWERES 2021 2. What is cloud computing? Explanation:  It is the use of servers on the internet to “store...