Home

Wednesday, May 27, 2015

Customer TIN ax 2012 R3

static void taxinfo(Args _args)
{
    CustTable                 VendTableloc;
    SalesTable                PurchTableloc;
    DirPartyTable             dirPartyTable;
    TaxRegistrationNumbers_IN TaxRegistrationNumbers_INloc;
    TaxInformation_IN         TaxInformation_INloc;
    LogisticsLocation         LogisticsLocationloc;
    DirPartyNamePrimaryAddressView DirPartyNamePrimaryAddressViewloc;
    TaxRegistration           TaxRegistration;
    DirPartyLocation          DirPartyLocationloc;
    SalesLine                 salesline;

    str S3_tin;

    select PurchTableloc where PurchTableloc.SalesId == "ICPL-000392";//this.getPurchId();
    select dirPartyTable join VendTableloc where VendTableloc.Party == dirPartyTable.RecId && VendTableloc.AccountNum == PurchTableloc.InvoiceAccount;
    select DirPartyLocationloc order by RecId asc where DirPartyLocationloc.Party == dirPartyTable.RecId;
    select LogisticsLocationloc where LogisticsLocationloc.RecId == DirPartyLocationloc.Location;
    select TaxInformation_INloc join TaxRegistrationNumbers_INloc where TaxInformation_INloc.RegistrationLocation == LogisticsLocationloc.RecId && TaxRegistrationNumbers_INloc.RecId == TaxInformation_INloc.TIN;
    S3_tin = TaxRegistrationNumbers_INloc.RegistrationNumber;

}

==============================================================================================================================================
by trainess
static void Salesname(Args _args)
{
    SalesTable SalesTable ;
    DirPartyTable DirPartyTable;
    LogisticsLocation LogisticsLocation;
    TaxInformation_IN TaxInformation_IN;
    TaxRegistrationNumbers_IN  TaxRegistrationNumbers_IN;

    select SalesName from  SalesTable where SalesTable.SalesId == '000855';

    {
        select DirPartyTable where DirPartyTable.Name == SalesTable.SalesName;

        {
            select  LogisticsLocation where DirPartyTable.PrimaryAddressLocation == LogisticsLocation.RecId;

            {
                select TaxInformation_IN where TaxInformation_IN.RegistrationLocation == LogisticsLocation.RecId;

                {
                   select TaxRegistrationNumbers_IN  where TaxInformation_IN.TIN == TaxRegistrationNumbers_IN.RecId;

                    info(strFmt("%1,Tin No = %2",SalesTable.SalesName, TaxRegistrationNumbers_IN.RegistrationNumber));//10024521001

                }
            }
    }
    }

}

Thursday, May 7, 2015

Dynamics Ax – Display the form with different colors for a particular control value


Create the form and add the combo box and change the enum type to SalesStatus and select the modified write the following code:
public boolean modified()
{
    boolean ret;
    ret = super();
    salesTable_ds.executeQuery();
    return ret;
}
and place the grid attach to the SalesTable and write the following methods on the form
public class FormRun extends ObjectRun
{
    QueryBuildrange     mySalesStatus;
}
public void displayOption(Common _record, FormRowDisplayOption _options)
{
    SalesTable prodtablelocal;
    prodtablelocal = _record;
    Switch(prodtablelocal.SalesStatus)
    {
    Case SalesStatus::Delivered:
    _options.backColor(65535); //Light Yellow
    _options.affectedElementsByControl(Salestable_SalesId.id());
    Break;
    Case SalesStatus::Invoiced:
    _options.backColor(8421631); //Light Red
    _options.affectedElementsByControl(Salestable_SalesId.id());
    Break;
    Case SalesStatus::Backorder:
    _options.backColor(65408); //Light Green
    //_options.affectedElementsByControl(Salestable_SalesId.id());
    _options.textColor(12582912);
    Break;
    }
}
public void executeQuery()
{
    ;
    if (comboBox.selection())
        mySalesStatus.value(QueryValue(comboBox.selection()));
    else
        mySalesStatus.value(" ");
    super();
}
public void init()
{
    super();
    mySalesStatus = this.query().dataSourceNo(1).addRange(fieldnum(SalesTable, SalesStatus));
    salestable_ds.executeQuery();
}
=================================================