Tuesday 30 July 2013

Trade and Logistics:--Product information management:

Trade and Logistics:
         Trade and logistics including 4 modules
1. Product information management- material ,stock product,Non-stok products(direct orders)
2.procurement and sourcing-purchase orders,vendors,Trade(Purchase) agreements
3.sales and marketing- sales orders, customers, Trade( sales ) Agreements
4.inventory and warehouse management- site, warehouse, location ,pallet, on hand inventory, stock calculation
Ex:
Site-chennai
Warehouse- tnagar,adyar,chrompet,nungambakkam

Diagram:

Site-warehouse-location-aisle-shelf-rack-bin

1.     Product information management:
Path: Pim-setup-dimension group

This module having 3 dimension groups
1.Product Dimension Group
2.Storage Dimension Group
3.Tracking Dimension Group

1.Product Dimension Group:
1.configuration
2.size
3.colour
4.style

2.Storage Dimension Group:
1.site(M)
2.warehouse(M)
3.location
4.palletId

3.Tracking Dimension Group:
1.Batch Number(M)
2.serial number


Products 2 types:
1.      Products- no product dimension group
2.      Product master-product + storage + tracking dimension group

For purchase:
Product receipt-physiacl
Invoice-financial

For sales:
 Packing slip-physical
Invoice-financial

Item delivery:

FIFO- first in first out (date)
FEFO-first expiry first out
Weighted sum- sum of avg of all items of unit price

Witout releasing product, up to it is a general product with doesn’t having any transactions
If we release the product then that product or item having transactions related to financial and physical
When we relaseing the products we can give the company name






Friday 26 July 2013

file handling in ax

Writing to a Text File
static void textFileWrite(Args _args)
{
TextBuffer tb = new TextBuffer();
;
tb.appendText(“Hello World!”);
tb.appendText(“\nWelcome to MIT”);
tb.appendText(“\nHyderabad”);
tb.toFile(“c:\\Sample.txt”);
}
Reading from a Text File
static void textFileRead(Args _args)
{
TextBuffer tb = new TextBuffer();
;
if(WinApi::fileExists(“c:\\Sample.txt”))
{
tb.fromFile(“c:\\Sample.txt”);
info(tb.getText());
}
else
{
info(“No file exists”);
}
}
Writing to a CSV File
static void cSVFileWrite(Args _args)
{
CommaIO commaIO;
Container readCon;
FileIOPermission fio;
FileDemo ct;
;
commaIO = new CommaIO(“c:\\FileDemo.csv”, “w”);
commaIO.outFieldDelimiter(“,”);
commaIO.outRecordDelimiter(“\r\n”);
if(commaIO)
{
while select ct
{
commaIO.write(ct.Id,ct.Name);
}
}
}
Reading from a CSV File
static void cSVFileRead(Args _args)
{
CommaIO commaIO;
Container readCon;
FileIOPermission fio;
FileDemo ct;
;
if(!WinAPI::fileExists(“c:\\FileDemo.csv”))
{
throw error(“File not available”);
}
fio = new FileIOPermission(“c:\\FileDemo.csv”, “r”);
fio.assert();
commaIO = new CommaIO(“c:\\FileDemo.csv”, “r”);
commaIO.inFieldDelimiter(“,”);
commaIO.inRecordDelimiter(“\r\n”);
if(commaIO)
{
while(CommaIO.status() == IO_Status::Ok)
{
readCon = commaIO.read();
if(conlen(readcon) > 0)
{
ct.Id = conpeek(readcon, 1);
ct.Name = conpeek(readcon, 2);
ct.insert();
}
}
}
}
Writing to a XML File
static void writeXML(Args _args)
{
XMLTextWriter xw;
FileDemo ct;
;
xw = XMLTextWriter::newFile(“c:\\FileDemo.xml”);
xw.writeStartDocument();
xw.writeStartElement(“Details”);
while select ct
{
xw.writeStartElement(“CustomerDetails”);
xw.writeElementString(“Id”,ct.Id);
xw.writeElementString(“Name”,ct.Name);
xw.writeEndElement();
}
xw.writeEndElement();
xw.writeEndDocument();
xw.close();
}
Reading from a XML File
static void readingXML(Args _args)
{
XMLDocument xmlDoc = XMLDocument::newFile(“c:\\FileDemo.xml”);
int i, nooftags;
;
nooftags = xmlDoc.getElementsByTagName(“CustomerDetails”).length();
for(i=0; i<nooftags; i++)
{
info(strfmt(“%1″, xmlDoc.getElementsByTagName(“Id”).item(i).text()));
info(strfmt(“%1″, xmlDoc.getElementsByTagName(“Name”).item(i).text()));
}
}
TableData_to_File
static void TableData_to_File(Args _args)
{
commaIO commaIO;
container readLine;
CustTable k;
FileIOPermission fio;
FileName nameOfTheFile = “c:\\anil.txt”; //csv
;
fio = new FileIOPermission(nameOfTheFile, ‘w’);// read – r, write – w, append – a
fio.assert(); // demand
commaIO = new commaIO(nameOfTheFile,’w');
commaIO.outFieldDelimiter(‘,’); // \t | // outFieldDelimiter
commaIo.outRecordDelimiter(‘\r\n’); // OutRecorDelimiter
commaIO.writeExp(["Accno", "AccountStatement", "CommissionGroup","DefaultDimention"]);
while select k
{
commaIO.writeExp([k.AccountNum,
k.AccountStatement,k.CommissionGroup,k.DefaultDimension]);
}
CodeAccessPermission::revertAssert();
}
TableDataFrom_File
static void TableDataFrom_File(Args _args)
{
commaIO commaIO;
container readLine;
Tab2 k;
FileIOPermission fio;
FileName nameOfTheFile = “c:\\anil.txt”; //csv
;
if (winapi::fileExists(nameOfTheFile) == false)
throw error(strfmt(“file %1 not found”, nameOfTheFile) );
fio = new FileIOPermission(nameOfTheFile, ‘r’);// read – r, write – w, append – a
fio.assert(); // demand
commaIO = new commaIO(nameOfTheFile,’r');
commaIO.inFieldDelimiter(‘,’); // \t – tab, | // outFieldDelimiter
commaIo.inRecordDelimiter(‘\r\n’); // OutRecorDelimiter – read line by line
ttsbegin;
if(commaIO)
{
while(commaIO.status() == IO_status::Ok)
{
readLine = commaIO.read(); //writeExp
if (conlen(readLine) > 1) // check whether there are values in the next line
{
k.Address = conpeek(readLine,1);
k.DName = conpeek(readLine, 2);
k.insert();
}
}
}
ttscommit;
CodeAccessPermission::revertAssert();
}


Dimensions:

Dimension are 2 types:
1.default dimension
2.ledger dimension

We will create dimension by 2 types
1.       Through form
2.       Through X++ coding by using classes
Difference between default dimension and ledger dimension:
Default dimension
Ledger dimension
1.       Dimension set storage class
2.       AXDimensionUtilClass::
(getdimension() method)
3.       Ex:   Formate
3008-CostCentre-100
         -Department-Physics
         -Purpose-Others
Here 3008 is vendor or customer

Here we store the dimension in to a unique int64 field i.e DefaultDimension Field.
Ex:62556020(dim value)


We are using the struct class for upadating the dimension combinations
We will take dimensions in to container and run the loop


1.LedgerContract(MainAccount)Class
2.DimensionAttributeContract Class
3.Ex:  Formate
   MainAccount-costCentre-Department-Purpose
         600100-100-physics-others

Here there we create relaton main account with ledger contract


Thursday 25 July 2013

Adding 2 Datasources in a query(join mode )

static void CustTableSales1(Args _args)
{
    Query       query;
    QueryRun    queryrun;
    QueryBuildDataSource    qbds1,qbds2;
    QueryBuildRange         qbr1,qbr2;
    CustTable               custTable;
    ;
    query   = new query();
    qbds1   =   query.addDataSource(tablenum(CustTable));
    qbds1.addSortField(fieldnum(custTable,AccountNum),Sortorder::Descending);
    qbr1    = qbds1.addRange(fieldnum(custTable,custGroup));
    qbr1.value(queryvalue('10'));
    qbr2    =  qbds1.addRange(fieldnum(custTable,Blocked));
    qbr2.value(queryvalue(CustVendorBlocked::No));
    qbds2   = qbds1.addDataSource(tablenum(SalesTable));
    qbds2.relations(false);
    qbds2.joinMode(joinmode::ExistsJoin);
    qbds2.addLink(fieldnum(CustTable,AccountNum),fieldnum(SalesTable,CustAccount));
    queryrun    = new queryrun(query);
    while(queryrun.next())
    {
        custTable   = queryrun.get(tablenum(custTable));
        info(strfmt('%1 – %2',custtable.AccountNum,custTable.name()));
    }

}

Processreport() method without getparameters() method with 2 ranges:

Processreport() method without getparameters() method with 2 ranges:

[SysEntryPointAttribute(false)]
public void processReport()
{
    QueryRun queryRun;
    Query query;
    CustTable custTable;
    TestContractClass testContractClass;
    AccountNum accountNum;
    CustGroupId     custGroupId;
    QueryBuildDataSource queryBuildDataSource;
    QueryBuildRange queryBuildRange;
    query = this.parmQuery();
    TestContractClass = this.parmDataContract() as TestContractClass;
    accountNum = testContractClass.parmAccountNum();
    custGroupId = testContractClass.parmCustGroupId();
   
    // Add parameters to the query.
    queryBuildDataSource = query.dataSourceTable(tablenum(CustTable));
    if(accountNum)
      queryBuildRange = queryBuildDataSource.findRange(fieldnum(CustTable, AccountNum));
    if(custGroupId)
        queryBuildRange = queryBuildDataSource.findRange(fieldnum(CustTable, custGroup));
    if (!queryBuildRange)
    {
    queryBuildRange = queryBuildDataSource.addRange(fieldnum(CustTable, AccountNum));
        queryBuildRange = queryBuildDataSource.addRange(fieldnum(CustTable, custGroup));
    }
    // If an account number has not been set, then use the parameter value to set it.
    if(!queryBuildRange.value())
    {
    queryBuildRange.value(accountNum);
    queryBuildRange.value(custGroupId);
    }
   
    queryRun = new QueryRun(query);
    while(queryRun.next())
    {
    custTable = queryRun.get(tableNum(CustTable));
    this.insertTmpTable(CustTable);
    }

}

Processreport() method without getreport parameters() method SSRS:


Processreport() method without getreport parameters() method SSRS:

[
SysEntryPointAttribute(false)]
public void processReport()
{
QueryRun queryRun;
Query query;
CustTable custTable;
SRSRDPCustTableContractClass srsRDPCustTableContractClass;
AccountNum accountNum;
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
query = this.parmQuery();
srsRDPCustTableContractClass = this.parmDataContract() as SRSRDPCustTableContractClass;
accountNum = srsRDPCustTableContractClass.parmAccountNum();
// Add parameters to the query.
queryBuildDataSource = query.dataSourceTable(tablenum(CustTable));
if(accountNum)
{
queryBuildRange = queryBuildDataSource.findRange(fieldnum(CustTable, AccountNum));
if (!queryBuildRange)
{
queryBuildRange = queryBuildDataSource.addRange(fieldnum(CustTable, AccountNum));
}
// If an account number has not been set, then use the parameter value to set it.
if(!queryBuildRange.value())
queryBuildRange.value(accountNum);
}
queryRun = new QueryRun(query);
while(queryRun.next())
{
custTable = queryRun.get(tableNum(CustTable));
this.insertTmpTable(CustTable);
}

}

Date difference calculation

c = DateTimeUtil::getDifference(_CaseDetailBase.ClosedDateTime,
                                _CaseDetailBase.createdDateTime);


CaseTimeTmp.TotalTime = c/(24*60*60);

Axapta Short cut Keys


Use global Axapta shortcut keys

Printing and saving
Press
To save an application object
CTRL+S
To print an application object
CTRL+P

Cut, copy and paste
Press
To cut an application object
CTRL+X (SHIFT+DEL)
To copy an application object
CTRL+C (CRTL+INS)
To paste an application object
CTRL+V (SHIFT+INS)

Opening...
Press
Open the drop-down list for a combo-box
ALT+DOWN ARROW
Open the local menu for the current field
SHIFT+F10
To open the Application Object Tree
CTRL+D

Closing...
Press
Close the active window
F4
Exit Microsoft Axapta
ALT+F4
Close form
ESC
Close the drop-down list for a combo-box
ALT+UP ARROW

Getting Help
Press
To get Help on an application object
F1
To display What's this? Help on an application object
SHIFT+F1

Stop method execution
Press
To stop method execution (break)
CTRL+BREAK

Toggle....
Press
Toggle between
CTRL+SPACE
Toggle between the insert and the overwrite settings
INSERT

Docking windows....
Press
Toggle the docking feature for the window
ALT+F5
Move focus to the next docking window
ALT+F6
Move focus to the previous docking window
SHIFT+ALT+F6

Clipboard...
Press
Cut the selection and put it on the clipboard
CTRL+X SHIFT+DELETE
Copy the selection, and put it on the clipboard
CTRL+C CTRL+INSERT
Insert clipboard contents
CTRL+V SHIFT+INSERT

Find
Press
Repeat the last find
F3

Navigation...
Press
Move the cursor one line up
UP ARROW
Move the cursor one line down
DOWN ARROW
Go to the top of this page
CTRL+PAGE UP
Go to the bottom of this page
CTRL+PAGE DOWN
Go to the start of the line/page/file
HOME
Go to the end of the line/page/file
END
Move the cursor one line up, and block
SHIFT+UP ARROW
Move the cursor one line down, and block
SHIFT+DOWN ARROW
Move the cursor one character to the left, and block
SHIFT+LEFT ARROW
Move the cursor one character to the right, and block
SHIFT+RIGHT ARROW
Go to the top of this page, and block
SHIFT+PAGE UP
Go to the bottom of this page, and block
SHIFT+PAGE DOWN

Actions
Press
Cancel changes
CTRL+Q
Activate the local menu from the menu bar
F10
Free all data and indexes saved in the computers storage system
CTRL+O



Use shortcut keys in forms to locate records

Filter functions
Press
Apply the value in the current field as a filter for the current data
CTRL+K
To set up a filter
CTRL+F3
To clear a filter
CTRL+SHIFT+F3

Locating records
Press
To create a new record
CTRL+N
To find the first record
CTRL+HOME
To find the last record
CTRL+END

Deleting records

Delete the current line
CTRL+L
To delete a record
ALT+F9

Field navigation
Press
Open a form where the related record is selected
CTRL+ALT+F4
Show the previous page of records (only effective in grids)
PAGE UP
Show the next page of records (Only effective in grids)
PAGE DOWN
Display the previous page of records
ALT+F7
Display the next page of records
ALT+F8
Restore the active record
F5
Open the node in edit/view mode
CTRL+SHIFT+F2
Go to the last record
CTRL+END
Go to the first record
CTRL+HOME
To go to first field
CTRL-SHIFT-HOME
To go to last field
CTRL+SHIFT+END
To go to previous field
SHIFT+TAB
To go to previous tab
CTRL+SHIFT+TAB
To go to next tab
TAB
To go to previous group
CTRL+PAGE UP
To go to next group
CTRL+PAGE DOWN


Use shortcut keys in the Application Object Tree

When you want to...
Press
Extend , or reduce the selection
CTRL+SPACEBAR
Open AOT
CTRL+D
Rename an application object
F2
Save as
CTRL+ALT+S
Save all
CTRL+SHIFT+S
Select all
CTRL+A
Filter Records
CTRL+F3
Edit node
CTRL+SHIFT+F2
Jump to the next error message
F4
Open an application object
CTRL+O
Compile an application object
F7
Go to the previous node
UP
Go to the next node
DOWN
Move the node up
ALT+UP
Move the node down
ALT+DOWN
Expand the current node
RIGHT
Collapse the current node
LEFT
Expand the current node as much as possible
Keypad *
Expand or reduce the selection
CTRL+SPACE
Collapse the current node as much as possible
-





When you want to...
Press
Save as
CRTL+ALT+S
Display Field Help
ALT+DOWN ARROW
Delete
Delete
Select all
CRTL+A
Select area
ALT+A
Select columns
ALT+O
Select lines
ALT+L
Delete line
CTRL+L
Delete to end of line
CTRL+SHIFT+L
Save text as
ALT+S
Insert file
CTRL+ALT+H
Run a script
ALT+M
Delete word to the left
CTRL+BACKSPACE
Abort Tab and discard all changes since the last save
F6
Abort Tab and save changes
F8
Remove all breakpoints
CTRL+SHIFT+F9
Insert or remove a breakpoint
F9
Enable or disable a breakpoint
CTRL+F9
Remove all breakpoints
CTRL+SHIFT+F9
Indent selection
TAB
Extend selection/remove indent
SHIFT+TAB
Open Help on a class
F1
Delete the previous word
CTRL+BACKSPACE
Open the Find/Replace dialog
CTRL+F
Find the next occurrence
F3
Compile
F7
Compile and close a method
F8
Set and delete a breakpoint
F9
Replace
CTRL+R
Jump to a method
CTRL+SHIFT+SPACEBAR
Mark a column
ALT+O

To undo and redo
Press
Undo selection
ALT+U
Undo
CTRL+Z (latest ten actions)
Redo
CTRL+Y (latest ten actions)

To go to...
Press
Specified page or line
CTRL+G
Next page
PgUp
Previous page
PgDn
Top
CTRL+HOME
Bottom
CTRL+END
Start of line/page/file
HOME
End of line/page/file
END
One word to the left
CTRL+LEFT ARROW
One word to the right
CTRL+RIGHT ARROW
Previous page, and block
SHIFT+PgUp
Next page, and block
SHIFT+PgDn
Top, and block
CTRL+SHIFT+HOME
End, and block
CTRL+SHIFT+END
Start of the line/page/file, and block
SHIFT+HOME
End of the line/page/file, and block
SHIFT+END
One word to the left, and block
CTRL+SHIFT+LEFT ARROW
One word to the right, and block
CTRL+SHIFT+RIGHT ARROW
The next method
CRTL+TAB
The previous method
CTRL+SHIFT+TAB

To look up...
Press
Breakpoints
SHIFT+F9
A label
CTRL+ALT+SPACEBAR
A Definition
CTRL+SHIFT+SPACEBAR
Properties and methods
CTRL+SPACEBAR


To list...
Press

Application Objects
SHIFT+F11

Extended Data Types
CTRL+T

Tables
F2

Classes
F12

Types
F4

Enums
F11

Reserved words
SHIFT+F2

Built-in functions
SHIFT+F4

Use shortcut keys in the reportviewer
Action
Press
Go there the specified page or line
CTRL+G
Go to the start of the line/page/file
HOME
Go to the end of the line/page/file
END
Go to the start of the line/page/file, and block
SHIFT+HOME
Go to the end of the line/page/file, and block
SHIFT+END
Go to the previous page
SHIFT+PAGE UP
Go to the next page
SHIFT+PAGE DOWN
Go to the first page
CTRL+ PAGE UP
Go to the last page
CTRL+ PAGE DOWN
Display the previous page of records
ALT+F7
Display the next page of records
ALT+F8


When you want to...
Press
Go to a specified page or line
CTRL+G
Enable or disable a breakpoint
CTRL+F9
Remove all breakpoints
CTRL+SHIFT+F9
Toggle exploded or unexploded source
F3
Run the debugger
F5
Set or delete a breakpoint
F9
Show breakpoint table
SHIFT+F9
Step into
F8
Step over
SHIFT+F8
Step return
CTRL+F8
Open or close the variables window
ALT+2
Open or close call stack window
ALT+3
Open or close system variable window
ALT+4
Switch line numbers on/off
F4