We can use this in Fetch or init in Report:
if(element.args().dataset() == tableNum(SalesTable))
{
salesTable = element.args().record();
salesId = salesTable.SalesId;
}
This blog is for Dynamics AX (AXAPTA) Developers,this will help you for your development issues. This site contains some Microsoft Dynamics AX X++ Codes for use in your day to day use.
26 July 2010
Barcode for Invent Serial Id
Reference Report:
INV->Reports->Labels->Serial number lable(RFID)
RFIDInventSerialLabels
INV->Reports->Labels->Serial number lable(RFID)
RFIDInventSerialLabels
21 July 2010
Validation for Field in Form level
Form->DS->Field->Validate()
public boolean validate()
{
boolean ret;
ret = super();
ret = Salestable.validateInventSite();
return ret;
}
-->
SalesTable->Methods->UserDefined Method
public boolean validateInventSite()
{
boolean ret = true;
SalesTable st;
if(this.DPT_NumberSequenceGroupId != this.InventSiteId)
{
ret = false;
info("Not allow to change the site");
}
return ret;
}
--------------------
public boolean validate()
{
boolean ret;
ret = super();
ret = Salestable.validateInventSite();
return ret;
}
-->
SalesTable->Methods->UserDefined Method
public boolean validateInventSite()
{
boolean ret = true;
SalesTable st;
if(this.DPT_NumberSequenceGroupId != this.InventSiteId)
{
ret = false;
info("Not allow to change the site");
}
return ret;
}
--------------------
17 July 2010
New Number Sequence for existing module AX 2009
New Number Sequence for existing module
1.Creare a EDT
2.Create a table
3.Class modify(NumberSeqReference_customer.. ->loadmodule())
4.table modify(salesParameter..purchParameters->numRefSalesId())
5.Create NumberSequence formtat(basic-setup-numbersequence)
6.Select the Reference field(basic-setup-ref)
(To use existing numberSequence in new form follow from the 7th step.)
7.Form modify(custTable..)Method-numberSeqFormHandler().
8.FormDatasource methods Modify(CustTable-DS-Create(),Write())
9.Open the form create new field.
1.Creare a EDT
2.Create a table
3.Class modify(NumberSeqReference_customer.. ->loadmodule())
4.table modify(salesParameter..purchParameters->numRefSalesId())
5.Create NumberSequence formtat(basic-setup-numbersequence)
6.Select the Reference field(basic-setup-ref)
(To use existing numberSequence in new form follow from the 7th step.)
7.Form modify(custTable..)Method-numberSeqFormHandler().
8.FormDatasource methods Modify(CustTable-DS-Create(),Write())
9.Open the form create new field.
16 July 2010
TO pop up the Field Like Sales crete order
Form: Sales crete order->Datasource
//SalesCreateOrderForm is class this return True
if (salesCreateOrderForm.lookupCustAccount())
{
salesTable_custAccount.setFocus();
salesTable_custAccount.lookup();
}
//SalesCreateOrderForm is class this return True
if (salesCreateOrderForm.lookupCustAccount())
{
salesTable_custAccount.setFocus();
salesTable_custAccount.lookup();
}
14 July 2010
numerals to text convert amout in rupees in axapta AX 2009 AX 2012 or Amount In words amount value to indian rupees word format
To change Numarals to text.
EX: 100 changed to One hundred Rupees Only
Global method:
static TempStr amountInWords(real _num)
{
int numOfPennies = (decround(frac(_num), 2) * 100) mod 100;
real test = _num - frac(_num);
int numOfTenths;
str 20 ones[19], tenths[9], hundreds, thousands, millions, billions, trillions;
int64 temp;
str 200 returntxt;
real modOperator(real a1, real a2)
{
int tmpi;
real tmp1, tmp2;
tmp1 = a1 / a2;
tmpi = real2int(tmp1);
tmp2 = tmpi;
return (tmp1 - tmp2)*a2;
}
real checkPower(real _test, int64 _power)
{
int64 numOfPower;
if (_test >= _power)
{
numOfPower = _test div _power;
if (numOfPower >= 100)
{
temp = numOfPower div 100;
returntxt = returntxt + ' ' + ones[temp] + ' ' + hundreds;
numOfPower = numOfPower mod 100;
}
if (numOfPower >= 20)
{
temp = numOfPower div 10;
returntxt = returntxt + ' ' + tenths[temp];
numOfPower = numOfPower mod 10;
}
if (numOfPower >= 1)
{
returntxt = returntxt + ' ' + ones[numOfPower];
numOfPower = numOfPower mod 10;
}
switch(_power)
{
case 1000000000000 :
{
returntxt = returntxt + ' ' + trillions;
_test = modOperator(_test, 1000000000000.00);
break;
}
case 1000000000 :
{
returntxt = returntxt + ' ' + billions;
_test = modOperator(_test, 1000000000);
break;
}
case 1000000 :
{
returntxt = returntxt + ' ' + millions;
_test = modOperator(_test, 1000000);
break;
}
case 1000 :
{
returntxt = returntxt + ' ' + thousands;
_test = modOperator(_test, 1000);
break;
}
case 100 :
{
returntxt = returntxt + ' ' + hundreds;
_test = modOperator(_test, 100);
break;
}
}
}
return _test;
}
ones[1] = "@SYS26620";
ones[2] = "@SYS26621";
ones[3] = "@SYS26622";
ones[4] = "@SYS26626";
ones[5] = "@SYS26627";
ones[6] = "@SYS26628";
ones[7] = "@SYS26629";
ones[8] = "@SYS26630";
ones[9] = "@SYS26631";
ones[10] = "@SYS26632";
ones[11] = "@SYS26633";
ones[12] = "@SYS26634";
ones[13] = "@SYS26635";
ones[14] = "@SYS26636";
ones[15] = "@SYS26637";
ones[16] = "@SYS26638";
ones[17] = "@SYS26639";
ones[18] = "@SYS26640";
ones[19] = "@SYS26641";
tenths[1] = 'Not used';
tenths[2] = "@SYS26643";
tenths[3] = "@SYS26644";
tenths[4] = "@SYS26645";
tenths[5] = "@SYS26646";
tenths[6] = "@SYS26647";
tenths[7] = "@SYS26648";
tenths[8] = "@SYS26649";
tenths[9] = "@SYS26650";
hundreds = "@SYS26651";
thousands = "@SYS26652";
millions = "@SYS26653";
billions = "@SYS26654";
trillions = "@SYS101697";
test = checkPower(test, 1000000000000);
test = checkPower(test, 1000000000);
test = checkPower(test, 1000000);
test = checkPower(test, 1000);
test = checkPower(test, 100);
if (test >= 20)
{
numOfTenths = test div 10;
returntxt = returntxt + ' ' + tenths[numofTenths];
numOfTenths = numOfTenths mod 10;
test = test mod 10;
}
if (test >= 1)
{
numOfTenths = real2int(test);
returntxt = returntxt + ' ' + ones[numOfTenths];
}
if (numOfPennies)
{
returntxt = '***' + returntxt + ' ' + "Rupees"+" "+"@SYS5534" + ' ' + numeralsToTxt(numOfPennies);
}
else
{
returntxt = '***' + returntxt + ' ' + "Rupees" + ' ' + "@SYP1450";
}
return returntxt;
}
EX: 100 changed to One hundred Rupees Only
Global method:
static TempStr amountInWords(real _num)
{
int numOfPennies = (decround(frac(_num), 2) * 100) mod 100;
real test = _num - frac(_num);
int numOfTenths;
str 20 ones[19], tenths[9], hundreds, thousands, millions, billions, trillions;
int64 temp;
str 200 returntxt;
real modOperator(real a1, real a2)
{
int tmpi;
real tmp1, tmp2;
tmp1 = a1 / a2;
tmpi = real2int(tmp1);
tmp2 = tmpi;
return (tmp1 - tmp2)*a2;
}
real checkPower(real _test, int64 _power)
{
int64 numOfPower;
if (_test >= _power)
{
numOfPower = _test div _power;
if (numOfPower >= 100)
{
temp = numOfPower div 100;
returntxt = returntxt + ' ' + ones[temp] + ' ' + hundreds;
numOfPower = numOfPower mod 100;
}
if (numOfPower >= 20)
{
temp = numOfPower div 10;
returntxt = returntxt + ' ' + tenths[temp];
numOfPower = numOfPower mod 10;
}
if (numOfPower >= 1)
{
returntxt = returntxt + ' ' + ones[numOfPower];
numOfPower = numOfPower mod 10;
}
switch(_power)
{
case 1000000000000 :
{
returntxt = returntxt + ' ' + trillions;
_test = modOperator(_test, 1000000000000.00);
break;
}
case 1000000000 :
{
returntxt = returntxt + ' ' + billions;
_test = modOperator(_test, 1000000000);
break;
}
case 1000000 :
{
returntxt = returntxt + ' ' + millions;
_test = modOperator(_test, 1000000);
break;
}
case 1000 :
{
returntxt = returntxt + ' ' + thousands;
_test = modOperator(_test, 1000);
break;
}
case 100 :
{
returntxt = returntxt + ' ' + hundreds;
_test = modOperator(_test, 100);
break;
}
}
}
return _test;
}
ones[1] = "@SYS26620";
ones[2] = "@SYS26621";
ones[3] = "@SYS26622";
ones[4] = "@SYS26626";
ones[5] = "@SYS26627";
ones[6] = "@SYS26628";
ones[7] = "@SYS26629";
ones[8] = "@SYS26630";
ones[9] = "@SYS26631";
ones[10] = "@SYS26632";
ones[11] = "@SYS26633";
ones[12] = "@SYS26634";
ones[13] = "@SYS26635";
ones[14] = "@SYS26636";
ones[15] = "@SYS26637";
ones[16] = "@SYS26638";
ones[17] = "@SYS26639";
ones[18] = "@SYS26640";
ones[19] = "@SYS26641";
tenths[1] = 'Not used';
tenths[2] = "@SYS26643";
tenths[3] = "@SYS26644";
tenths[4] = "@SYS26645";
tenths[5] = "@SYS26646";
tenths[6] = "@SYS26647";
tenths[7] = "@SYS26648";
tenths[8] = "@SYS26649";
tenths[9] = "@SYS26650";
hundreds = "@SYS26651";
thousands = "@SYS26652";
millions = "@SYS26653";
billions = "@SYS26654";
trillions = "@SYS101697";
test = checkPower(test, 1000000000000);
test = checkPower(test, 1000000000);
test = checkPower(test, 1000000);
test = checkPower(test, 1000);
test = checkPower(test, 100);
if (test >= 20)
{
numOfTenths = test div 10;
returntxt = returntxt + ' ' + tenths[numofTenths];
numOfTenths = numOfTenths mod 10;
test = test mod 10;
}
if (test >= 1)
{
numOfTenths = real2int(test);
returntxt = returntxt + ' ' + ones[numOfTenths];
}
if (numOfPennies)
{
returntxt = '***' + returntxt + ' ' + "Rupees"+" "+"@SYS5534" + ' ' + numeralsToTxt(numOfPennies);
}
else
{
returntxt = '***' + returntxt + ' ' + "Rupees" + ' ' + "@SYP1450";
}
return returntxt;
}
13 July 2010
eccNo in report through Programmable section
Programmable section->
//BP Deviation Documented
display TaxRegistrationNumberExcise_IN eccNumber()
{
CompanyInfo companyInfo;
;
companyInfo = CompanyInfo::find();
//select companyInfo;
return companyInfo.ECCNumber_IN;
}
---
//BP Deviation documented
display TaxRegistrationNumber_IN tinNo()
{
;
select TIN_IN from custTable
where custTable.AccountNum == salesTable.CustAccount
&& salesTable.SalesId == salesId;
return custTable.TIN_IN;
}
//BP Deviation Documented
display TaxRegistrationNumberExcise_IN eccNumber()
{
CompanyInfo companyInfo;
;
companyInfo = CompanyInfo::find();
//select companyInfo;
return companyInfo.ECCNumber_IN;
}
---
//BP Deviation documented
display TaxRegistrationNumber_IN tinNo()
{
;
select TIN_IN from custTable
where custTable.AccountNum == salesTable.CustAccount
&& salesTable.SalesId == salesId;
return custTable.TIN_IN;
}
Subscribe to:
Posts (Atom)
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-...
-
{ "Message" : "Please verify that the user is valid and set up correctly." } Sol: System Administration > Se...
-
Please click here to access Custom Workflow step by step process:
-
FormRun formRun = sender.formRun(); Object inventTrans_ds = formRun.dataSource(formDataSourceStr(InventMarking,InventTransO...