Saturday, 2 September 2017

DYNAMICS AX 2012 INTERVIEW QUESTIONS PART 2

DYNAMICS AX 2012 INTERVIEW QUESTIONS PART 2


1. What are the classes, Tables, Forms and Methods used to post the Inventory.
2. What is the base class to send the on-boad E-mailing.
SysMailer and SysINetMail.
3. What are the storage Dimensions?
Site,WareHouse,PalletId,BatchNumber,SerialNumber
4. What are the Item Dimensions?
Configuration, size,Color
5. What is the difference between RunBase and RunBaseBatch?
RunBase: To create a job or an Action class – a program that carries out processes, such as accepting parameters from the user and then updating records in the database – you use the RunBase framework.
The framework is implemented by the RunBase application class and supplies many features, which include the following:
  • Query
  • Dialog, with persistence of the last values entered by the user
  • Validate
The RunBase class is a framework for classes that need a dialog for user interaction and that need the dialog values to be saved per user.
RunBaseBatch:  You can design your own batch job by extending the RunBaseBatch class. You can also write code to schedule the batch to run. The batch runs on the Application Object Server (AOS)
6. What is the difference between Insert and doinsert.
Insert(): To insert  the records into the database. Secure any related transactions with tts.
Doinsert():These methods should only be used under strict control because they bypass the following:
Any validations that have been set up.
Any code that was written in the insert, update, and delete methods.
7. What is the Runbase Stack?
8. Difference between sql and x++ statement–
SELECT-
1.Table buffer on the FROM in x++ clause ,not the table as in SQL
2.ORDER BY clause precedes the WHERE clause
3.! for negation ,not NOT as in SQL
4.&& and || for logical operator ,not AND or OR as in SQL.
5.* and ? for like wildcards ,not % and _ as in SQL.
JOIN CLAUSE-
1.Join clause has no ON keyword in x++,use WHERE instead
2.Default JOIN direction is left .
3.there are no LEFT and RIGHT keyword for JOIN in x++
4.The FROM clause is optional when:
-No column is listed or
-Only one table is listed in the SELECT in x++
select * FROM CustTable;
select CustTable;              both are same.
OTHERS-
1.The WHILE SELECT statement provides an automatic cursor for return rows in x++
2.There is no HAVING keyword in x++
3.No null values are return in x++
9. What is cluster installation?
Admin – Setup – Cluster Configuration
Click System administration > Setup > System > Cluster configuration.
You can distribute the user load in Microsoft Dynamics AX across multiple instances of Application Object Server (AOS) by creating a load balancing cluster.
10. Steps in creating number sequence?
Basic>Setup>NumberSequences> NumberSequences – Create a new number sequence.
Classes>NumberSequenceReference>LoadModule.
AR>Setup>parameters –  setup code.
Tables>CustParameters  – create method starts with numRefEDT.
Form>FormRun  – Create numberSequenceFormHandler method.
Form>FormDataSource  – Override create method.
11. Any module you are good at.    – AR,AP,Inventory,Production.
12. Collection classes
You cannot store objects in arrays or containers. The AX collection classes have been designed for storing objects. The classes are implemented in C++ to achieve the maximum performance (they are system classes).
ClassDescription
ArraySimilar to the array type except that it can hold values of any single type, including objects and records. Objects are accessed in a specific order.
ListContains elements that are accessed sequentially.
MapAssociates a key value with another value.
SetHolds values of any single type; used when order is important.
StructCan contain values of more than one type. Used to group information about a specific entity.
13. Tables in inventory?
InvetTable,InventTableModule,InventItemLocation, InventDim, InventTrans
BOMTable , WMSShipment.InventColor, InventSize
14. If you manipulate anything which layer would it affect?
The present layer where you are working and below of that layer.
15. What are the components in reports?
Methods , DataSources , Design.
16. How many types of classes are there?
System Classes and Application Classes.
117. Development tools?
Version control , Cross-reference, Code profiler, Debugger, Application Hierarchy Tree,Code Explorer, Reverse Engineer, Number of Records, Embedded Resources,  Wizards, Label.
18. Communication tools
19. Can you say few best practises in ax?
20. What is the difference between sql queries and dynamics queries.
Sql query is Select statement –
Dynamic query – AOT Query and Query class using x++.
21. What is the difference between x++ and c#?
X++ contains code and Sql select statements
C# contains only code.
22.  What are the link types in Ax?
Passive: Linked child data sources are not updated automatically. Updates of the child data source must be programmed on the active method of the master data source.
Delayed: A pause is inserted before linked child data sources are updated. This enables faster navigation in the parent data source because the records from child data sources are not updated immediately. For example, the user could be scrolling past several orders without immediately seeing each order lines.
Active: The child data source is updated immediately when a new record in the parent data source is selected. Continuous updates consume lots of resources.
InnerJoin: Selects records from the main table that have matching records in the joined table and vice versa. There is one record for each match. Records without related records in the other data source are eliminated from the result.
OuterJoin: Selects records from the main table whether they have matching records in the joined table.
And the other records also shown in the main table.
ExistJoin: Selects a record from the main table for each matching record in the joined table.
The differences between InnerJoin and ExistJoin are as follows:
–                      When the join type is ExistJoin, the search ends after the first match has been found.
–                      When the join type is InnerJoin, all matching records are searched for.
NotExistJoin: Select records from the main table that do not have a match in the joined table.
23. What can’t you store in containers
We can’t store objects in containers.
24. Difference between arrays and containers
An array can hold only items of same and its declared type. Containers store different types of data types at a time.
You can allocate memory space for an array and fill that space with values later, such as in a loop. This is efficient and performs well.
25. Logic for converting string to uppercase?
StrUpr() -Converts all the letters in a string to uppercase.
26.What is JumpRef()?
The user activates the Go to main table command from the shortcut menu on the control or by pressing CTRL+ALT+F4. The super() call opens the main table that contains data for the field.
27. D.B Abstract and final class.
Abstract forces the class to be derive subclass and final stops the class not to be derive or inheritance.
28. D.B ValidateWrite and write.
validateWrite(): Executed when a new or updated record is to be written.  Determines whether data is valid and ready to be written.
Write(): Executed when the user inserts a new record or updates an existing one. Calls theFormDataSource.validateWrite method and manages the database write operation.
29. What is dialoge class.
A dialog in AX is a simple form with a standardized layout, created by using the Dialog system class. Dialogs should allow users to enter some simple values.
Dialog Classes- DialogField, DialogGroup, DialogTabPage, DialogText, DialogWindow.
Dialog Methods – addField,addGroup,addTabPage,run,pack,unpack,
30. Pack and Unpack method?
Use the pack-unpack pattern to save and/or store the state of an object, and then later reinstantiate the same object.
Pack():create a pack method to read the state of the object and return it in a container suitable for saving or transporting between tiers. Reading the state of the object implies collecting the value of all its members. If the members are tables (records, cursors, temporary tables) or classes, it must also be possible to read their state.
Returns the state of the object as a container.
Unpack():create an unpack method that takes the packed state and reinitializes an object with it. Construct the object before creating an unpack method.
The unpack method takes the saved state of the object and reinitializes the object with it. It reinitializes the object members according to the values in the container, taking the supplied version number into account.
The method can return a Boolean that signals the result of the initialization process.
31. Architecture of MS dynamics AX.
Ax has the three tier  architecture    — 1 . client       2. AOS           3.DataBase.
32. Tell us about AIF(MSMQ).
Application Integration Framework (AIF) is the infrastructure within AX with which you can expose business logic or exchange data with other systems. AIF is comprised of three primary components:
1.Services – Enable you to expose business logic written in X++ as a service to be consumed by other applications. Within Microsoft Dynamics AX, you can create, customize, and publish services.
2.Document services – A specific implementation of services in which the Microsoft Dynamics AX business logic is exposed through document services.
3.Consume Web services – In Microsoft Dynamics AX, you can consume external Web services from your X++ code.
33. How to design a form in AX using X++?
The Form* classes enable you to manipulate, create, modify, or run forms by using X++ code. You can also modify forms during run time so, for example, one or more controls are hidden on a form, depending on the user’s selections in the preceding form.
The Form classes are all system classes and are prefixed with Form.
Form, FormRun, FormDesign, FormBuildDesign, FormDataSource, FormBuildDataSource, FormControl.
34. What is report builder?
You can create reports by using Report Builder for Microsoft SQL Server Reporting Services. You add information to the report from a report model.
When you create a report by using Report Builder for Microsoft SQL Server Reporting Services, you are using secure views of the tables available in the report model.
35. What is Index, properties in Index and types of Index?
An index is a table-specific database structure that speeds the retrieval of rows from a table. Indexes are used to improve the performance of data retrieval and to ensure the existence of unique records. It’s up to the database-specific query optimizer to use available indexes to facilitate efficient data retrieval.
Unique index and non-unique index.
36. Concept of Different Layer in AX.
syssypglsGlphfxsl1sl2sl3busbupvarvapcuscupusrusp
37. Difference between bound and unbound controls?
Form controls belong to one of three groups, depending on their data source as follows:
  • Bound control – associated with a field in an underlying table. Use bound controls to display, enter, and update values from fields in the database.
  • Unbound control – does not have a data source. Use unbound controls to display pictures and static text.
  • Calculated controls – uses a method as the data source. An example of a calculated control is the sum of two fields on a form.
38. How to create runtime query?
You can create a query to retrieve data by using the query classes.
Query, QueryRun, QueryBuildDataSource, QueryBuildRange, QueryBuildLink,  QueryBuildDynaLink
39. What is optimistic concurrency control and Pessimistic Concurrency Control?
Optimistic Concurrency Control (OCC) helps increase database performance. Pessimistic Concurrency Control locks records as soon as they are fetched from the database for an update. However, Optimistic Concurrency only locks records from the time when the actual update is performed.
Following are the advantages of using OCC:
  • Fewer resources are used to hold the locks during the update process.
  • Records are locked for a shorter length of time.
  • Records remain available for other processes to update if they have been selected from the database but haven’t yet been updated.
The disadvantage of using OCC is that the update can fail if another process updates the same record. If the update fails, it must be retried. This can lead to a reduction in database performance.
OCC makes it possible for other processes to update a record even after it has been fetched. You can catch update conflicts by catching the UpdateConflict and UpdateConflictNotRecoveredexceptions.
40. What are transactions?
41. How to lock transactions?
42. What are macros?
Macros act as a container for defining variables used for frequent tasks. The purpose of macros is to make statements easy to reuse. A macro can’t be executed independently as a class.
An advantage macro is that the maintenance is done in only one place.
Three types of macros
Macro libraries – is a standalone macro that contains a collection of local macros.
Standalone macros – is created by using the macro node in the AOT.
Local macros  –  is declared with in a method.
43. What is the default link type property?   –    Delayed.
44. Default join in select statement (Queries) – innerJoin
45. Difference between validate write and validate field?
validateWrite(): Executed when a record is written to the database, before the data change is committed in the database.
validateField():Executed when you leave a field in a record. For example, after entering changes to a field on a grid control, you could click another field in that same record or on a different record. Or you could click another control on that same form.
The super() method invokes field validation checks, as guided by the value of the Validateproperty.
46. Do we have validate write and validate field in form level?
FormDataSource – validateWrite()
FormDataSourceField  – validate().
47. What are the methods required for posting a purchase order?
48. How to give null in select query?
Select table where table.field == “ ” ;
49. What is cache lookup and IsLookup what is it used for?
CacheLookup : Determines how to cache the records retrieved during a lookup operation.
Types –  None , NotInTTS, Found, FoundAndEmpty,EntireTable.
IsLookup : For report models, it specifies whether the table information is incorporated into other tables that reference it when a report model is generated.
For OLAP cubes, it determines whether to generate a consolidated dimension or a distinct dimension. You can specify one of the following values.
  • Yes – Indicates that attributes from the table are to be consolidated into the parent dimension (star schema).
  • No – Indicates that a separate dimension is to be generated for the table (snowflake schema).
50. Difference between table and views?
A Microsoft Dynamics AX view is a virtual table that contains the data records and fields that are specified by a query.Like a table, a view uses fields and rows to represent data records. However, the data in a view is not stored as a database object but is dynamically created when the view is accessed. A view uses a query to retrieve data fields from one or more database tables.
When you create a view, the view definition is generated and stored in the database. When that view is accessed, the view dynamically retrieves the data that satisfies the view definition.
Views are read-only. The data fields and tables that a view uses cannot be updated from that view.
BenefitDescription
Focused dataA view enables you to retrieve and return only the data that is relevant for a particular user or scenario.
Customized dataA view enables you use a complex query to create a highly-customized set of data. For example, a view often represents data as a single table that was retrieved from multiple joined tables and used many conditions.
PerformanceA view can improve performance by returning only relevant fields to the user. In addition, a view definition is compiled which may provide better performance than calling an equivalently complex query.
51. In which case delete_from and delete() have same result?
When deleting only one record in the table.
52. Explain sales/purchase order processes in AX.
53. Can you just tell the table properties that you can remember?
55. Explain different types of reports?
AOT Reports , Using X++ – Report classes, Using Report wizard.
56. Primary Key in tables (In dynamics AX don’t have primary key)
57. What is the default index for a table?
The system index is created on the RecId and DataAreaId fields if the DataAreaId field exists. Otherwise the system index is created on the RecId field. You can see system indexes in the database but they aren’t visible in the AOT.
58. What are all the add- on tools you used in Dynamics AX (It’s an indirect question for AIF)
59. Did you work with EP (Enterprise Portal & Workflow) how can you implement this features into your projects?60. Difference between this and element?
this & element: this can be used in any objects to reference the current object and member methods.
In forms the collection of objects is contained within a FormRun object. You can reference members in the outer formrun object by using the element reference.
If your code is placed at the top level there are no functional difference between this and element.
If your code is placed in a formdatasource but this will reference the datasource but element will reference the formrun.
You cannot use element to refer table or class object.

AX 2012 INTERVIEW QUESTIONS PART

AX 2012 INTERVIEW QUESTIONS PART 1

1)      Tell about your Self.
2)      What kind of Customizations you have done.
3)      How you will create Table in Ax. In that Table how you will define Indexes, Relations, Delete Actions and Methods. Tell me the steps First what you will do, First you will define Indexes or Relations. Why?
4)      What is Naming Conventions in Ax?
5)      What is Index? How many types of Indexes are there? What is unique index and non-unique?
6)      What is Cluster Index?
7)      What is Cache Look Up? More Questions on regarding Cache Look Up?
8)      What is FormRef?
9)      What is Configuration Key? Why need of configuration keys?
10)  What is Security Key?
11)  What is Record Level Security?
12)  How the ax is providing security. What are the ways?
13)  Types of Relations.
14)  Types of Delete Actions.
15)  What kind of methods you will create will create a Particular Table?
16)  What is Table Collections?
17)  How you will create different Environments like Aos1, Aos2……………..so on……
18)  For Example: 150 users are Accessing Aos1.How you will assign users to Aos2 for that what you required. More Questions on regarding AOS
19)  Tell me the Invent Table Form Data sources?
20)  Invent Dim Table What it stores?
21)  What is Table Group? When you creating new tables in ax by default what is the Table Group?
22)   Can you tell me the Sales Table, Table Group? What it consists
23)  How you will do the SSRS Repots in AX?
24)  What are all the New Features are added in Ax 2009?
25)  How to install Ax 2009? What it Require? How you will install in Win XP & Vista? More Questions on regarding Ax Installation.
26)  What is Workflow? How you will do this? Ex: For Po how to configure Workflow? Steps…..
27)  For New Module how to Achieve Workflow. Steps. more Questions on regarding WF
28)  How you will configure Workflow For AR
29)  How to install Workflow. What it requires (software’s).
30)  Weather Workflow requires EP?
31)  What is EP? What it requires (software’s). More Questions on regarding EP.
32)  What is Number Sequence? How you will do that? Number Sequence Steps…
33)  How you configure Number Sequence in Ax? For Example I created one record in ABC Form. I didn’t save the record. I just deleted the record. In that Case what will happen? What comes next….
34)  What is Global Address Book?
35)  How can you use the Global Address Book?
36)  How can you Create New Employee?
37)  What is the use of Virtual Companies?
38)  At form Level how you will define Query Build Classes. How you will do that
39)  Tell me Form Level Data Source Methods.
40)   What is Execute Query
41)  What is Init at form Methods
42)  Types of Inventory Dimensions?
43)  Types of Item Dimensions?
44)  Types of Storage Dimensions?
45)  Types of Dimensions in Ax?
46)  How to define Composite Queries in Ax?
47)  Number Sequence Classes.
48)  Types of Link Types?
49)  Inner Join and Exists Join?
50)  Oops Concepts?
51)  What is inheritance?
52)  Types of Inheritance?
53)  What is Abstract Class in Ax? How you will define?
54)  What is interface?
55)  Tell me Interfaces Classes in Ax?
56)  What is RunBase?
57)  Where we can create item in Ax2012?
58)  Difference between change company and cross company?
59)  What is surrogatekey in 2012?
60)  How to import data one application to another application?
61)  Differences in 2009 and 2012?

Wednesday, 30 August 2017

How to get Company information and tax information using X++ code in Ax 2012

 How to get Company information and tax information using X++ code in Ax 2012


static void CompanyInformation(Args _args)
{
    CompanyInfo     Company;
    ;
    Company = CompanyInfo::find();
    info(strFmt("Company Name : %1", Company.Name));
    info(strFmt("Company Phone : %1", Company.phone()));
    info(strFmt("Company Phone : %1", Company.telefax()));
    info(strFmt("Company Address : %1", Company.postalAddress().Address));
}
How to get Company full name using x++ code 
str     countryName;

countryName= logisticsAddressCountryRegion::name(countryRegionId);

Company Tax details using X++ code
IEC
display TaxRegistrationNumber_IN  tax_IEC()
{
    TaxInformation_IN        taxInformation_IN;

    taxInformation_IN   = TaxInformation_IN::findDefaultbyLocation(LogisticsPostalAddress::findRecId(this.PrimaryAddressLocation).Location);

    return TaxRegistrationNumbers_IN::find(taxInformation_IN.IECRegistrationNumberTable).RegistrationNumber;
}

Service Tax (STC)
display TaxRegistrationNumber_IN  tax_STC()
{
    TaxInformation_IN        taxInformation_IN;

    taxInformation_IN   = TaxInformation_IN::findDefaultbyLocation(LogisticsPostalAddress::findRecId(this.PrimaryAddressLocation).Location);

    return TaxRegistrationNumbers_IN::find(taxInformation_IN.STCRegistrationNumberTable).RegistrationNumber;

}

Vendor STC number
public str vendorSTC(AccountNum   _accountNum)
{
    VendTable           vendTable;
    DirPartyTable       dirPartyTable;
    LogisticsLocation   logisticsLocation;
    TaxInformation_IN   taxInformation_IN;

    select vendTable where vendTable.AccountNum == _accountNum
        join dirPartyTable
            where dirPartyTable.RecId == vendTable.Party
        join logisticsLocation
            where logisticsLocation.RecId == dirPartyTable.PrimaryAddressLocation;


    taxInformation_IN   = TaxInformation_IN::findDefaultbyLocation(logisticsLocation.RecId);

    return TaxRegistrationNumbers_IN::find(taxInformation_IN.STCRegistrationNumberTable).RegistrationNumber;


}


Tax Identification number (TIN)
display TaxRegistrationNumber_IN  tax_TIN()
{
    TaxInformation_IN        taxInformation_IN;

    taxInformation_IN   = TaxInformation_IN::findDefaultbyLocation(LogisticsPostalAddress::findRecId(this.PrimaryAddressLocation).Location);

    return TaxRegistrationNumbers_IN::find(taxInformation_IN.TIN).RegistrationNumber;

}

Tax Account number(TAN) or PAN

display TaxRegistrationNumber_IN  tax_TAN()
{
    TaxInformation_IN           taxInformation_IN;
    utcDateTime                 fromDate, toDate;
    TaxRegistrationNumbers_IN   TaxRegistrationNumbers_IN;

    fromDate = DateTimeUtil::getSystemDateTime();
    toDate = DateTimeUtil::maxValue();

    taxInformation_IN   = TaxInformation_IN::findDefaultbyLocation(LogisticsPostalAddress::findByLocationAndValidDateTime_IN(this.PrimaryAddressLocation, fromDate, toDate).Location);
    select firstFast TaxRegistrationNumbers_IN
            where TaxRegistrationNumbers_IN.RecId   == taxInformation_IN.TAN
                &&   TaxRegistrationNumbers_IN.TaxType == TaxType_IN::None;

    return TaxRegistrationNumbers_IN.RegistrationNumber;
}

// Company GSTINNumber 
   select companyInfo where companyInfo.DataArea == curext()
           join dirpartytable where dirpartytable.PartyNumber == companyInfo.PartyNumber
               join dirPartyLocation where dirPartyLocation.Party == dirpartytable.RecId
                   join logisticsLocation where logisticsLocation.RecId == dirPartyLocation.Location
                      join taxInformation_IN where taxInformation_IN.RegistrationLocation == logisticsLocation.RecId
                                                              && taxInformation_IN.IsPrimary == NoYes::Yes;

  tmp.comapanyGSTINNumber = TaxRegistrationNumbers_IN::find(taxInformation_IN.GSTIN).RegistrationNumber;

 //Vendor GSTINNumber
  select vendtable1 where vendtable1.AccountNum==vendtable.AccountNum
          join dirPartyLocation where dirPartyLocation.Party == vendtable1.Party
              join logisticsLocation where logisticsLocation.RecId == dirPartyLocation.Location
                   join taxInformation_IN where taxInformation_IN.RegistrationLocation == logisticsLocation.RecId
                                                          && taxInformation_IN.IsPrimary == NoYes::Yes;

     tmp.vendorGSTINNumber = TaxRegistrationNumbers_IN::find(taxInformation_IN.GSTIN).RegistrationNumber;

  // CGST , SGST & IGST numbers with rates.
  select firstOnly HSNCode, SAC from taxDocumentRowTransaction_IN
          join RecId, DiscountAmount from taxDocumentRowTransaction
               where taxDocumentRowTransaction.RecId == taxDocumentRowTransaction_IN.TaxDocumentRowTransactionRecId
               && taxDocumentRowTransaction.TransactionHeaderTableId == vendInvoiceinfotable.TableId
               && taxDocumentRowTransaction.TransactionHeaderRecId == vendInvoiceinfotable.RecId
               && taxDocumentRowTransaction.TransactionLineTableId == vendInvoiceinfoline.TableId
               && taxDocumentRowTransaction.TransactionLineRecId == vendInvoiceinfoline.RecId;

      if(taxDocumentRowTransaction.RecId)
     {
           while select taxDocumentComponentTransaction

            where taxDocumentComponentTransaction.TaxDocumentRowTransactionRecId == taxDocumentRowTransaction.RecId
         {
               if(taxDocumentComponentTransaction.TaxCode =="CGST")
               {
                     tmp.CGST_TaxRate = taxDocumentComponentTransaction.TaxRate*100;
                     tmp.CGST = taxDocumentComponentTransaction.TaxAmountCur;
               }
              if(taxDocumentComponentTransaction.TaxCode == "SGST")
              {
                    tmp.SGST_Taxrate = taxDocumentComponentTransaction.TaxRate*100;
                    tmp.SGST = taxDocumentComponentTransaction.TaxAmountCur;
              }
             if(taxDocumentComponentTransaction.TaxCode == "IGST")
             {
                   tmp.IGST_Taxrate = taxDocumentComponentTransaction.TaxRate*100;
                   tmp.IGST = taxDocumentComponentTransaction.TaxAmountCur;
             }
       }
   }



For multiple Phone numbers and fax Details

static void Companywithmultiplephonenumber(Args _args)
{
 
    DirPartyContactInfoView         contactInfoView;
    CompanyInfo companyinfo;
 
    companyinfo = CompanyInfo::find();
    info(strfmt("%1",companyinfo.Name));
 
  while  select  contactInfoView
        where
             contactInfoView.Type == LogisticsElectronicAddressMethodType::Phone
            || contactInfoView.Type == LogisticsElectronicAddressMethodType::Fax
            && contactInfoView.Party == companyinfo.RecId
    {
         
        if(contactInfoView.Type == LogisticsElectronicAddressMethodType::Phone)
        {
            info(strFmt("Description - %1   Phone -             %2",contactInfoView.LocationName,contactInfoView.Locator));
        }
        else
        {
            info(strFmt("Description - %1   Fax - %2",contactInfoView.LocationName,contactInfoView.Locator));
        }  
    }
}



static void CompanyInfo(Args _args)
{
    DirPartyContactInfoView         contactInfoView,contactInfoPhone,contactInfoFax;
    Name                            LocationName,Phone,Fax;
    description255                  contactAddress;
    CompanyInfo                     companyInfo = CompanyInfo::find();
    container                       CompanyLogo = FormLetter::companyLogo();
    Name                            PrintedBy   = xUserInfo::find(false,curUserId()).name;

    while  select contactInfoView group by LocationName
        where contactInfoView.Party == companyinfo.RecId
     {
           LocationName = contactInfoView.LocationName;

         select contactInfoPhone where contactInfoPhone.Party == companyinfo.RecId
         && contactInfoPhone.Type == LogisticsElectronicAddressMethodType::Phone
         && contactInfoPhone.LocationName == LocationName;

         if(contactInfoPhone)
         {
             Phone     = contactInfoPhone.Locator;
         }
         select contactInfoFax where contactInfoFax.Party == companyinfo.RecId
         && contactInfoFax.Type == LogisticsElectronicAddressMethodType::Fax
         && contactInfoFax.LocationName == LocationName;

         if(contactInfoFax)
         {
            Fax       = contactInfoFax.Locator;
         }

         contactAddress += LocationName + " Tel: " + Phone + " Fax: " + Fax + " " +'\n';


    }
    info(strFmt("ContactAddress = %1 , ExcutedBy = %2",contactAddress,PrintedBy));
}

Thursday, 24 August 2017

How to Validate GSTIN Number in ax 2012

How to Validate GSTIN Number in ax 2012

What is GSTIN - Goods & Services Tax Identification Number?

All the business entities registering under GST will be provided a unique identification number known as GSTIN or GST Identification Number. 

Currently any dealer registered under state VAT law has a unique TIN number assigned to him by state tax authorities. Similarly, service tax registration number is assigned to a service provider by Central Board of Excise and Customs (CBEC). 

Under GST regime, all these parties will come under one single authority and the different identification numbers will be replaced by a single type of registration number for everyone (GSTIN). This will ensure better administration by the authority and greater compliance by taxpayers and hopefully improve tax collection.

Let’s understand the structure of GST Identification Number:

Every taxpayer will be assigned a state-wise PAN-based Goods and Services Taxpayer Identification Number (GSTIN) which will be 15 digit long.
The first two digits of GSTIN will represent the state code according to Indian Census 2011. Each state has a unique two digit code like “27” for Maharashtra and “10” for Bihar.
The next ten digits of GSTIN will be the PAN number of the taxpayer.
13th digit indicates the number of registrations an entity has within a state for the same PAN. 

It will be an alpha-numeric number (first 1-9 and then A-Z) and will be assigned on the basis of number of registrations a legal entity (having the same PAN) has within one state. 

For example, if a legal entity has single or one registration only within a state then it will be assigned the number “1” as 13th digit of the GSTIN. If the same legal entity gets another or second registration for a second business vertical within the same state, then the 13th digit of GSTIN assigned to this entity will become “2”. Similarly, if an entity has 11 registrations in the same state then it will be assigned letter “B” in the 13th place. This way up to 35 business verticals of any legal entity can be registered within a state using this system.
The fourteenth digit currently has no use and therefore will be “Z” by default.
The last digit will be a check code which will be used for detection of errors.


Will existing taxpayers under Central Excise or Service Tax or State VAT have to apply for fresh registration under GST?

The answer is no. All the taxpayers with PAN validated from CBDT’s database are not required to apply for fresh registration under GST. They can get provisional GSTIN from GST portal with a validity of 6 months so that they can provide relevant data as per GST registration form. 

Once they complete data filing process, their provisional registration will get converted into regular registration. After this, further notification by relevant tax authorities will be issued for giving timelines. 

However, the service tax assesses having centralized registration will have to apply for a fresh registration in the respective states wherever they operate their businesses.

static void ValidateGSTIN(Args _args)
{
    str RegistrationNumber;

    RegistrationNumber ="24AACHA6869P1Z1";

    #define.alphabets('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
    #define.numbers('0123456789')
    #define.15(15)
    #define.20(20)

    if(
    (strkeep(substr(RegistrationNumber, 1, 2), #numbers) != substr(RegistrationNumber, 1, 2)) ||
    (strkeep(substr(RegistrationNumber, 3, 5), #alphabets)   != substr(RegistrationNumber, 3, 5)) ||
    (strkeep(substr(RegistrationNumber, 8, 4), #numbers) != substr(RegistrationNumber, 8, 4)) ||
    (strkeep(substr(RegistrationNumber, 12, 1), #alphabets)   != substr(RegistrationNumber, 12, 1)) ||
    (strlen(RegistrationNumber)   != #15 ) ||
    (strkeep(substr(RegistrationNumber, 13, 1), #numbers)   != substr(RegistrationNumber, 13, 1)) ||
    (strkeep(substr(RegistrationNumber, 14, 1), #alphabets)   != substr(RegistrationNumber, 14, 1))
    //Number or Charactor
    //(strkeep(substr(RegistrationNumber, 15, 1), #numbers)   != substr(RegistrationNumber, 15, 1))
    //(strkeep(substr(RegistrationNumber, 15, 1), #alphabets)   != substr(RegistrationNumber, 15, 1))
    )
    {
        info("Registration Number must be 2 Number, 5 Charactors, 4 Numbers, 1 Charactor, 1 Number, 1 Charactor, Last Char Number or Alpha");
    }
    else
    {
        info(strFmt("Valid GSTTIN Numbet - %1",RegistrationNumber));
    }

}

How to get PAN From GSTIN in ax 2012

How to get PAN From GSTIN in ax 2012

What is Goods and Services Identification number (GSTIN)?

All the business entities registering under GST will be provided a unique identification number known as GSTIN or GST Identification Number.

Currently any dealer registered under state value added tax (VAT) law has a unique TIN number assigned to him by state tax authorities. Similarly, Service Tax Registration Number is assigned to a service provider by Central Board of Excise and Customs (CBEC).

Under GST regime, all these parties will come under one single authority and the different identification numbers(IN) that will be replaced by a single type of registration number for everyone i.e.,  Goods and Services Identification number (GSTIN). This will ensure better administration by the authority and greater compliance by taxpayers and hopefully improve tax collection.

The first 2 digits of the 15 digit GSTIN will represent the state code.
The next 10 digits will be the PAN number of person or firm engaged in Business.
As proposed the State Code as defined under the Indian Census 2011 would be adopted In the GSTIN. As per the terms of the Indian Census 2011, every State has been allotted a unique two digit code. For 01 for Jammu and Kashmir, 02 for Himachal Pradesh, 03 for Punjab.
The 13th would represent the number of registrations an entity has with in a state under the same PAN. It will be an alpha-numeric number (first 1-9 and then A-Z) and will be assigned on the basis of a number of registrations a legal entity (having the same PAN) in the same state.

What is Permanent account number ( PAN )

Permanent Account Number (PAN) is a ten-digit alphanumeric number, issued in the form of a laminated tamper proof card, by the Income Tax Department of India.

The Permanent Account Number (PAN) is unique to an individual or entity and it is valid across India. Permanent Account Number once allotted to an individual or entity is unaffected by a change of name, address within or across states in India or other factors.

Meaning of PAN card

A typical Permanent Account Number is would look like AFZPK7190K... The logic behind the array of numbers and alphabets is as follows: 

First three characters i.e. "AFZ" in the above PAN are alphabetic series running from AAA to ZZZ. 
Fourth character i.e. "P" in the above PAN represents the status of the PAN holder.

"P" stands for Individual.
"F" stands for Firm.
"C" stands for Company.
"H" stands for HUF. 
"A" stands for AOP. 
"T" stands for TRUST etc.

Fifth character i.e. "K" in the above PAN represents first character of the PAN holder's last name/surname.
Next four characters i.e. "7190" in the above PAN are sequential number running from 0001 to 9999.
Last character i.e. "K" in the above PAN is an alphabetic check digit.

static void GetPANFromGSTIN(Args _args)
{
    str RegistrationNumber;

    RegistrationNumber ="24AACHA6869P1ZA";
    RegistrationNumber = substr(RegistrationNumber,3,strLen(RegistrationNumber)-5);
    info(strFmt("%1",RegistrationNumber));
}

Labels

#veryusefulcode (1) AIF (8) AOT Maps (1) Args (1) Ax 2009 Reports (2) AX 2012 navigation (1) Ax 2012 Interview Questions (1) AX 7 (2) AX Architecture (1) Ax Backup (1) AX Workflow (2) AX2012 (1) AX2012 R2 (1) Ax2012R3 (1) AX2012R3 Dynamics Connector Step by Step Installation and Configuration (1) AX2012R3 EP Step by Step Installation and Configuration EP R3 (1) AX2012R3 HelpServer Step by Step Installation and Configuration (1) AX2012R3 Rapid Start Connector Step by Step Installation and Configuration (1) AX2012R3 Report Server and Analysis Server Step by Step Installation and Configuration (1) AX7 (1) Best practices (1) Blocking user to enter (1) Collection Classes (1) Container (1) D365FO (3) Data Migration Frame Work ax 2012R3 (1) Deleting duplicate Record from Table – Ax2012 (1) Delivery due date notification workflow in Ax 2012 (1) Development Steps EP (1) Dimensions (1) DIXF (1) DMF in Ax 2012 R3 (1) Dynamics Ax 2012 Interview Questions (1) DYNAMICS AX 2012 INTERVIEW QUESTIONS PART 2 (1) DYNAMICS AX 7 (1) EDT relation Migration Tool (1) EP AX 2012 (1) Ep Lookup (1) Error (1) Event Handler (1) F5 (1) File Handling (4) Filter on AX2012 Listpage (1) filtering (2) financial dimensions in AX 2012 (3) form (1) images (1) Installation and Configration (4) Installation and Configuration (11) Installation of Management Reporter 2012 for AX 2012 (1) Interaction class in ax 2012 (1) Interview Question (1) Interview Questions For Ax 2012 (1) Invent DIm (1) Jobs (2) license (1) List page and form menuitem enable code (1) Methods (1) microsoft Dynamics AX 365FO (1) Number Sequence Generation – AX 2012 (5) Number Sequence2012 (1) OLTP-OLAP (1) Passing Args (1) Passing form caller and menu item caller in ax 2012 (1) Passing Multiple Records Args (1) Posting in Ax 2012 (1) POSTING PURCHASE ORDER (1) Query (1) Query Filter Form (2) Query Ranges in X++ (1) Question and Answer (1) Report (1) Reports Controller class (1) RLS in ax 2009 (1) SALES ORDER IMPORT/EXPORT FRAMEWORK BY DMF (1) Security (1) security roles (1) Security Sysqueryrangeutil (1) Sharepoint 2016 (1) SQL SERVER (1) SSRS (2) SSRS Reports Controller class (2) Table collections & Virtual company (1) Time (1) TIPS AND TRICKS (1) Web service AIF (3) Web Services on IIS (AIF) Step by Step Installation and Configuration (1) workflow ax2012 (1) Workflow installation (1) Workflow Method (3) X++ (1)