Sunday, 15 May 2016

Open the Form with Grid View using x++ code

void clicked()
{
    Args args = new Args();
    super();
    args.record(InventTable);
    args.caller(this);
    args.formViewOption(FormViewOption::Grid); // Opens the form with Grid as default View
    new MenuFunction(menuitemDisplayStr(EcoResProductDetailsExtended), MenuItemType::Display).run(args);
}

Thursday, 12 May 2016

Copy the address from one customer to others customers

public void mergeDeliveryAddresses(CustAccount  custAccount,
                                   CustAccount  retCustAccount)
{
    CustTable custTable;
    DirParty dirParty;
    DirPartyPostalAddressView PostalAddress, PostalAddressDest;
    ;

    custTable = CustTable::find(custAccount);

    while select PostalAddress
        where PostalAddress.Party == CustTable.Party
    {
        buf2Buf(PostalAddress, PostalAddressDest);
        PostalAddressDest.Party = CustTable::find(retCustAccount).Party;
        PostalAddressDest.IsPrimary = NoYes::No;       
        PostalAddressDest.LocationName =  PostalAddress.LocationName;
        dirParty = DirParty::constructFromCommon(custTable);
        dirParty.createOrUpdatePostalAddress(PostalAddressDest);

    }


}

To Add Button click method to LP

How to add button clicked method to LP :

Set the property of Button in LP - "Display Target"  to "Client "

Tuesday, 10 May 2016

How to duplicate the SSRS report

We all know that we will have requirements to modify an existing SSRS report but would not like to alter the original, rather create a duplicate and work on it.
But, Do we have the option in AX 2012? The answer is “NO” and it’s a real problem/hectic job for a developer to create it from scratch. Even when we try to do this from visual studio 2010, it is not allowed to change the report name as it says it exists in another layer.
Well, I have created a utility to duplicate the SSRS reports from AX. It works all fine and gets built successfully and was able to render the data as well. Once the report is duplicated, you can change the design in Visual studio.
[Note: I have posted a recent article on Duplicating SSRS with the help of wizard with all its artifacts (DP classes, Contract, UIBuilder and CSharp project)] – Here is the link
This really helps the developer in not creating the DP classes, contract classes etc. and can customize the existing DP classes by adding the new fields in temp tables.
Below is them new utility walk through:
Go to Tools >> Business Intelligence Tools >> Create duplicate SSRS reports
image
This will open all existing SSRS reports in the picker
image
Select any report : a new dialog will open with the new report name as “CopyOf” select report Name, you can modify the report name here
based on your requirements.Click on Ok button.
image
A new report gets created in SSRS reports as shown below
image
Nice right! Now lets us open this in Visual studio 2010 and you can play with the design.
You can see the new report in the Application Explorer as shown below:
image
Add this report to your project and build it. It builds successfully and is ready for preview as well.
image

Below is the link to get the xpo of Duplicating SSRS report.
https://drive.google.com/open?id=0Bz2gDlDZfIivc2xVWHd3V0t0a2c

Thursday, 28 April 2016

Edit Methods

I) Edit Method in Form Level :

1. Form >> Class declaration

Map                             custPriceMap;
2 . Init method of form

custPriceMap= new map(Types::Int64, Types::Real);

Add new method Datasource ,

Edit Price CustPrice(boolean      _set ,
                    Salesline   _salesLine,
                    Price       _price)
{
    Price    price    = _price;
    ;
    if(_set)
    {
        custPriceMap.insert(_salesLine.RecId,_price);
        SalesLine.SalesPrice   = _price / (1-_salesLine.LinePercent/100)+ this.FET(_salesLine)+_salesLine.LineDisc;
        Salesline.modifiedField(fieldNum(SalesLine,SalesPrice));
        price = _price;
    }
    else
    {
        if (_salesLine.RecId && dkCustMap.exists(_salesLine.RecId))
        {
            price= custPriceMap.lookup(_salesLine.RecId);
        }
        else if (_salesLine.SalesPrice)
        {
            price = (_salesLine.SalesPrice-this.FET(_salesLine) - _salesline.LineDisc)*(1-_salesline.LinePercent/100);
            custPriceMap.insert(_salesLine.RecId,price);
        }
        else
        {
            price = 0;
        }

    }
    return price;
}

II) Edit Method in Table Level :

Edit boolean Marked(boolean      _set ,
                    boolean       _mark)
{
    FinderRecords   finderrec;
    boolean mark = _mark;
    finderrec   =   FinderRecords::findByFinderNo(this.FinderNumber,_set);
    if(_set)
    {
        ttsBegin;
        finderrec.Mark  =   _mark;
        finderrec.update();
        ttsCommit;
    }
    else
    {
        mark = finderrec.mark;
    }
    return mark;
}

Mark the First record in child grid whenever you change the selection of Parent grid.

In child data source - >> methods

public void linkActive()
{
    FinderRecords   finderrec;
    super();
     finderrec   =   FinderRecords_ds.getFirst();

    if(finderrec)
    {
    FinderRecords_ds.findRecord(finderrec);
        FinderRecords_ds.mark(true);
    }
}

Monday, 4 April 2016

Functional Session

Product Information Management  - Creation of Product.

Product - Ex: laptop

Product master - have size/ configuration / color etc can be selected
================================================================================
Product information management >> setup >> product dimension group>>

  1. Product dimension groups - Come for product master ( color/size / cofiguration) - Attributes of the product

  1. Storage dimension group - Where you store Product
Site - DLF
WH - Genpact / columbus
Location - Conference room
Pallet ID - Trays we place goods which have some no.

  1. Tracking dimension Group : Once the product is sold, if we want to track them we use this dimension.

Batch No. - It can be different for each product . Group of Products  which are manufactured together with same components.
Serial no. - It may be unique for the product.

===============================================================================
Product Type :  - Item/ Bom
  1. Create Product
Select Product Type / product number - 1001 , Product name / search name >> click Ok.

Create Product Master :

Product Type - Item / product sub type - Product master / Product No - 1002 /

The data in Invent table is available throughout the companies.

Select Item >> Release Product  On Action pane >> then select company for which companies you want to release .

Then you can view them in Release Product Forms …  ( which show data specific to the company)

Open the Release Product >> select the product  >> click validate which let you know the mandatory set up that is specified for the product.

Click on Dimension Groups >>

Select

Item model groups:

Whether it is service/ product ( field Stocked Product - checked determines it is stocked product/ whether

Ii)Financial negative inventory
Purchased the item/ bill doesn't come stil we can sell

Iii) Quarantine management -  Check quality/ etc come and take eg : BULB

Finance related thing - how costing Happens.

Physical update

Registration requirements - First item need to reg
Receiving requirements - unless packing slip is done it cannot be invoiced in  PO
Picking , shipment , invoice - for SO

Picking Requirements  Deduction requirements - which makes some transactions mandatory for SO.

Item Group  : Whenever you purchase / sell you need some financial transactions should happen. So the a/cs which should effect on particular transaction.

Even in inventory it is of unit each/ while selling may be different.
Eg: pencil can be manufactured as each/ but while selling it may be of box

Whenever you are purchasing or selling - the unit may be different . We set it in Sell - Unit. So we need to set Conversion from Manage inventory unit - sell unit.

Go to view details >> Unit and define Unit conversion.

Product - we don’t have Product dimension group/ only we have storage and track dimension  group

If we create product/ product master from Release product form/ then it is released for that company…


Inventory Journals :
Inventory Mangement>> Journals >>

  1. Movement Journal :
When journal is added - / posted we get on hand  for that product

  1. Inventory Adjustment : We don't want to give A/ c in Inventory adjustment.
( Item group  -Inventory >>  Reciept / profit ac will be taken by default.

Inventory >> Dimension Display >> check the inventory dimensions you want to see in lines section.