28 February 2011

Table methods - task 17

Table methods using ValidateWrite() ValidateDelete() initValue() ModifiedField()

Click Here to download the XPO with ID values

initValue()
This method executes while creating new record to initialize a value, here I am assigning user id to the userID field.

public void initValue()
{
super();

this.UserId = curuserid();
}

ValidateDelete()
while deleting a record if we want to put any validation we can use this method. Here once I delete a record populating a info that deleted record.

public boolean validateDelete()
{
boolean ret;

ret = super();

info(this.AccountNum);

return ret;
}

ValidateWrite()
This method will get to fire when we update a record. here I am using to check mandatory field for address AccountNum

public boolean validateWrite()
{
boolean ret;
;

if(this.Address != "")

ret = super();
else
warning(" Please fill the address value");

return ret;
}

ModifiedField()
This method will execute if modified a record value, this works based on the field value.
Here I am using to fill the name field value according to the AccountNum

public void modifiedField(fieldId _fieldId)
{
CustTable ct;
;
super(_fieldId);

switch(_fieldId)
{
case fieldNum(Cust_new,AccountNum) :
{
this.Name = CustTable::find(this.AccountNum).Name;

}
break;
}

}

25 February 2011

working with Task form method

Task() in form
The task is using keys want to do some even
Here using CTRL+G I am closing the form.
so I am using task method.
public int task(int _taskId)
{
int ret;

ret = super(_taskId);// task Id will get keys ID value
if(_taskId == 2855)
element.close();

return ret;
}

Layer wise object find UtilElements

UtilElements
static void Test_UsrTable_Find(Args _args)
{
Utilelements utilElements;
;
while select utilElements where utilElements.recordType == UtilElementType::Table
&& utilElements.utilLevel == utilentryLevel::usr
{
info(utilElements.name);
}

}

22 February 2011

working with args

1.This is user defined form name is Test_form
this is form is calling in Address table.
Test_form->init()

If(element.args().dataset() == tablenum(address))
{
info("this is calling from address form");
}
--
2.This is user defined form name is Test_Form_two
this is form is calling in Address table.

Test_Form_two-> init()
Public void init()
{
Address address;
;
If(element.args().dataset() == tablenum(address))
{

info("this is calling from address form");
address = element.args().record();
info(address.name));
//here getting the address table selected record and storing in address TB
//while initiating the form displaying info.
}

}

10 February 2011

AX Versions list and Application and Kernel versions

AX Versions list and Application and Kernel versions

Find method ()

Find Task 10 click here to download XPO with out ID values

FInd In Table:
public void modifiedField(fieldId _fieldId)
{
;
super(_fieldId);
switch(_fieldId)
{
case fieldNum(Cust_new,AccountNum) :
{
this.Name = CustTable::find(this.AccountNum).Name;
}
break;
}
}
--
Find in Form:
Form->DS->Field->modified()
public void modified()
{
CustTable ct;
;
super();

Cust_new.Name = CustTable::find(Cust_new.AccountNum).Name;
// Or we can use following code
//ct = CustTable::find(Cust_new.AccountNum);
//Cust_new.Name = ct.Name;
}

AX Instent Message on all forms Task 8

Task 8 Click here to download the xpo With ID values.

08 February 2011

Tax Invoice Report excise invoice report

Tax Invoice Report
click here to import xpo with ID values
----
public class ReportRun extends ObjectRun
{
CustInvoiceJour custInvoiceJour;
CustInvoiceTrans custInvoiceTrans;
TaxTrans taxTrans;
TaxData taxData;
SalesTable salesTable;
SalesLine salesLine;
SalesParmTable salesParmTable;
MarkupTrans markupTrans;
InventTrans inventTrans;
InventDim inventDim;
InventSerialId _InventSerialId;
ConfigTable configTable;

SalesId salesId;
TaxAmount bED;
TaxValue bEDTaxValue;
TaxAmount pEdCess;
TaxValue pEdCessTaxValue;
TaxAmount sECess;
TaxValue sECessTaxValue;
TaxAmount cSTorVAT;
TaxValue cSTorTaxValue;
MarkupValue mCharges;

real subTotal;
real sumofTotalAssessableValue;
real grandTotal;
real decOfGTotal;
real realOfGTotal;
real gGrandTotal;
real roundOff;
InventSerialId serial;
str ser;
Counter counter;
Counter counter1;
counter cnt;
real quantity;


//
InventSite inventSite;
Address address;
Addressing siteAddress;

ItemId itemid;
ConfigId config;

}
----
public void init()
{
;

try
{
if(element.args().parm())
{
this.query().dataSourceTable(tablenum(CustInvoiceJour)).addRange(fieldnum(CustInvoiceJour,SalesId)).value(element.args().parm());
salesId = element.args().parm();
this.query().userUpdate(false);
this.query().interactive(false);
super();
}
}
catch(exception::Error)
{
info("@GSY97");
}
// for SLNo
counter = 0;
cnt = 1;
}
----
public boolean fetch()
{
str s;

boolean ret;

ret = super();

// select sum(AssessableValue_IN) from salesLine
// where salesLine.SalesId == salesId;
//
// sumofTotalAssessableValue = salesLine.AssessableValue_IN;

select sum(AssessableValue_IN) from custInvoiceTrans
where custInvoiceTrans.SalesId == salesId;

sumofTotalAssessableValue = custInvoiceTrans.AssessableValue_IN;


select Value from markupTrans
join custInvoiceJour
where markupTrans.TransRecId == custInvoiceJour.RecId
&& markupTrans.TransTableId == custInvoiceJour.TableId
&& markupTrans.MarkupCode == "@SYS1655"
&& custInvoiceJour.SalesId == salesId;

MCharges = markupTrans.Value;

while select sum(TaxAmount) from taxTrans
group by TaxCode
join custInvoiceJour
where taxTrans.Voucher == custInvoiceJour.LedgerVoucher
&& taxTrans.TransDate == custInvoiceJour.InvoiceDate
&& custInvoiceJour.SalesId == salesId
{
if(taxTrans.TaxCode == "@GSY106")
{
bED = taxTrans.TaxAmount;
select taxData
where taxData.TaxCode == "@GSY106";
bEDTaxValue = taxData.TaxValue;
}
if(taxTrans.TaxCode == "@GSY107")
{
pEdCess = taxTrans.TaxAmount;
select taxData
where taxData.TaxCode == "@GSY107";
pEdCessTaxValue = taxData.TaxValue;
}
if(taxTrans.TaxCode == "@GSY108")
{
sECess = taxTrans.TaxAmount;
select taxData
where taxData.TaxCode == "@GSY108";
sECessTaxValue = taxData.TaxValue;
}
if(taxTrans.TaxCode == "@GSY81")
{
cSTorVAT = taxTrans.TaxAmount;
select taxData
where taxData.TaxCode == "@GSY81";
cSTorTaxValue = taxData.TaxValue;
}
else if(taxTrans.TaxCode == "@GSY109")
{
cSTorVAT = taxTrans.TaxAmount;
select taxData
where taxData.TaxCode == "@GSY109";
cSTorTaxValue = taxData.TaxValue;
}

}

subTotal = sumofTotalAssessableValue + (-bED) + (-pEdCess) + (-sECess);

grandTotal = subTotal + (-cSTorVAT) + mCharges;

decOfGTotal = (decround(frac(grandTotal), 2));
realOfGTotal = grandTotal - decOfGTotal;

if(decOfGTotal >= 0.50)
{
gGrandTotal = realOfGTotal + 1;
roundOff = gGrandTotal - grandTotal;
}

else
{
gGrandTotal = grandTotal - decOfGTotal;
roundOff = -decOfGTotal;
}

// select inventTrans
// join custInvoiceTrans
// where inventTrans.TransRefId == salesId
// join inventDim
// where inventDim.inventDimId == inventTrans.inventDimId;
//
// serial = inventDim.inventSerialId;
//

//while select inventTrans
// join custInvoiceTrans
// where inventTrans.TransRefId == salesId
// join inventDim
// where inventDim.inventDimId == inventTrans.inventDimId
// {
// // _InventSerialId = inventDim.inventSerialId;
// this.send(inventDim);
// }

element.execute(3);
element.execute(6);
//element.execute(4);
while select custInvoiceTrans
where custInvoiceTrans.SalesId == salesId
{
element.execute(4);
}

while select inventTrans
//join custInvoiceTrans where custinvoiceTrans.SalesId == salesId
where inventTrans.TransRefId == salesId


{
while select inventDim where inventDim.inventDimId == inventTrans.inventDimId
{

//this.send(inventDim);


itemid = inventTrans.ItemId;



element.execute(5);

}
}


while select configTable where configTable.ItemId == inventTrans.ItemId
&& configTable.ConfigId == inventDim.configId
{
// techDesc = configTable.TechnicalDescription;
//this.send(configTable);
element.execute(5);
}

//addres for site



// while select salesLine
// where salesLine.SalesId == salesId
// {
// itemid = salesLine.ItemId;
// element.execute(4);
// }


element.execute(1);
return ret;

}
----
For tax fields IN programable section

//BP Deviation documented
display real bED()
{
;

return -bED;
}
--
//BP Deviation documented
display real pEdCess()
{
;

return -pEdCess;
}
--
-----
//BP Deviation Documented
display Addressing siteAddr()
{


;
while select salesTable
where salesTable.SalesId == salesId
join inventSite where inventSite.SiteId == salesTable.InventSiteId
join address where address.Name == inventSite.SiteId
{
siteAddress = address.Address;
}


return siteAddress;
}
------
//BP Deviation Documented
display InvoiceId invoiceId()
{
;

select InvoiceId from custInvoiceJour
where custInvoiceJour.SalesId == salesId;

return custInvoiceJour.InvoiceId;
}
-----

07 February 2011

How to filter the report values based on condition with dialog Task 7

How to filter the report values based on condition with dialog Task 7
to download xpo file click here Import with out ID values

In report->

public class ReportRun extends ObjectRun
{
DialogField dialogField,dialogField2;
Counter cnt,cnt2;

}
-----------
public Object dialog(Object _dialog)
{

DialogRunbase dialog = _dialog;
;
dialog.addGroup("Returned Count");
dialog.caption("IR-ROC");
dialogField = dialog.addFieldValue(typeid(Counter),"RO Count","RO Count");


return dialog;
}
-----------
boolean getFromDialog()
{
;
cnt = dialogField.value();

return true;
}
-----------
public boolean fetch()
{
PDITable PDITable_Innter; // Table buffer

;
while select PDITable group by ContactNo // PDITable is Report Datasource
{
cnt2 = 0;
if(PDITable.ContactNo)
{
while select PDITable_Innter where PDITable_Innter.ContactNo == PDITable.ContactNo
{
if(PDITable_Innter.PDIStatus == PDIStatus::Returned)
{
cnt2 += 1;
if(cnt2 >= cnt)
{
this.send(PDITable);
break;
}
}

}

}
}

return true;
}

New sales id generation based on the Number sequence group Multiple Number Sequence

New sales id generation based on the Number sequence group Multiple Number Sequence Task 6
click here to download XPO
import with ID values.

04 February 2011

To Apply Color to a Field in Form

Select a Field in Design -> Properties-> Color Schema : RGB and
Change the BackGroundColor & ForeGroundColor

03 February 2011

Setup Alerts in Dynamics Ax

How to Setup Alerts in Dynamics Ax 4.0
To get screen shots doc click here
Step By step Process:
INTRODUCTION


This article describes how to set up Business Alerts in Microsoft Dynamics AX 4.0. This article also describes how to set the e-mail address from which Business Alert e-mail messages are sent.

MORE INFORMATION

Configure a user account to receive alerts

To configure a user account to receive alerts, follow these steps:
1. In the Navigation Pane, click Administration, and then click Users.
2. Select a user, and then click User Options.
3. Verify that the e-mail address where you want the user to receive alerts is in the E-mail field.
4. In the Receive alerts every (minutes) box, type 1.
5. In the Pop-up link destination list, click To alert.
6. In the Send alert as e-mail message list, click Define on each alert rule.
7. In the Show pop-ups list, click Define on each alert rule, and then click Apply.
8. Close the Options window.

Add the "E-mail distributor batch" job

The "E-mail distributor batch" job is the batch job that monitors and sends e-mail messages. To add the "E-mail distributor" batch job, follow these steps:
1. In the Navigation Pane, click Administration, expand Periodic, expand E-mail processing, and then click Batch.
2. In the "E-mail distributor batch" window, click Recurrence.
3. In the Recurrence window, click No end date.
4. Click Minutes.
5. In the Count box, type 1, and then click OK.
6. In the "E-mail distributor batch" window, click to select the Batch processing check box, and then click OK.Note You receive an Infolog message that resembles the following message:
Information: The E-mail distributor batch job is added to the batch queue.
7. Click Close to close the Infolog dialog box.
8. On the Tools menu, click Development tools, and then click Application Hierarchy Tree.
9. Expand Forms, and then double-click Tutorial_EventProcessor.
10. On the Tutorial_EventProcessor form, click Start, and then verify that the status is In waiting.

Set up a new alert rule

Alert rules define when alerts are sent and how they are received. To set up a new alert rule, follow these steps:
1. In the Navigation Pane, click General ledger, and then click Chart of accounts.
2. On the Overview tab, right-click a cell in the Account name column, and then click Create alert rule.
3. In the Alert me when area, select the field that you want to monitor with this alert rule in the Field list. For example, select Account name.
4. In the Event list, select the event that you want to trigger an alert. For example, select has changed.
5. In the Alert me for area, select the All records in Ledger chart of accounts option.
6. In the Alert me until area, select the No end date option.
7. In the Alert who area, select the user account that you want to receive this alert in the User ID list.
8. In the Also alert me by area, click to select the Show pop-ups check box.
9. Click to select the Send e-mail check box, and then click OK.
10. Close the "Manage alert rules" window.

Test the alert

To test the alert that you have set up, follow these steps:
1. In the Navigation Pane, click General ledger, and then click Chart of accounts.
2. On the Overview tab, change the name of the account for which you set up a new alert.
3. In the Navigation Pane, click Administration, click Periodic, click E-mail processing, and then click E-mail sending status.
4. The "E-mail sending status" window shows e-mail alerts that have been sent.

Set the e-mail address from which alerts are sent

You can set the e-mail address from which alerts are sent by selecting an e-mail template. To do this, follow these steps:
1. In the Navigation Pane, click Basic, click Alerts, and then click Alert parameters.
2. In the E-mail ID list, select the e-mail template from which you want e-mail alerts to be sent.

Descending order in Form Task 5

To show the record in Descending order Task 5
IN the form-> DS-> init()
1 write the following code:
this.query().dataSourceNo(1).addSortField(fieldnum(DatasourceTable , field), SortOrder::Descending);
Example:
this.query().dataSourceNo(1).addSortField(fieldnum(CustTable,AccountNum) ,SortOrder::Descending);

2 In DS-> ExecuteQuery()
while select CustTable order by AccountNum desc
{
}

02 February 2011

How to get the Main TableForm From Another Form Task 4

To get the GoTo Main Tableform in another form Task 4

Create an EDT -> with relation EDT == Table1.column
use the Created EDT in the table2 add the field to table2from now when you do go to main table for that field in the table2 form then actually it will take you to the table1From.

Add the table1Form to display menuItem; click here to download a xpo for sample example import xpo with out ID values

To Disable a Record in Form by Unchecking a Check BOX in that record Task 3

create a new method in form methods

void method1()
{
if(datasourcename.checbox == noyes::Yes)
{
datasource_ds.allowedit(false)
}
else
{
datasource_ds.allowedit(true)
}
}

Now call this method in your datasource active method and in the checkbox field's modified method

01 February 2011

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension->...