Simple SSRS RDP Report with DP Class and Contract Class in Ax 2012

SSRSScreen

Contract Class

class Bill_TabMethodContract
{
CustName custName;
Description address;
}

[DataMemberAttribute(“CustName”)]
public CustName parmCustName(CustName _custName = custName)
{
custName = _custName;
return custName;
}

DP Class

[ SRSReportQueryAttribute (querystr(Bill_TabMethod_SSRS)),
SRSReportParameterAttribute(classstr(Bill_TabMethodContract))
]
class Bill_TabMethodDP extends SRSReportDataProviderBase
{
Bill_TabMethodTmp bill_TabMethodTmp;

}

[SRSReportDataSetAttribute(“Bill_TabMethodTmp”)]
public bill_TabMethodTmp getBill_TabMethodTmp()
{
select * from bill_TabMethodTmp;
return bill_TabMethodTmp;
}

[SysEntryPointAttribute(false)]
public void processReport()
{
BIll_Child billChild;
BillChildParm billchildparm;

QueryRun queryRun;
Query query;
Bill_TabMethod billbuffer;
Bill_TabMethodContract srsBill_TabMethodContract;
CustName custName;
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;

query = this.parmQuery();

srsBill_TabMethodContract = this.parmDataContract() as Bill_TabMethodContract;
custName = srsBill_TabMethodContract.parmCustName();

// Add parameters to the query.
queryBuildDataSource = query.dataSourceTable(tablenum(Bill_TabMethod));

if(custName)
{
queryBuildRange = queryBuildDataSource.findRange(fieldnum(Bill_TabMethod, CustName));
if (!queryBuildRange)
{
queryBuildRange = queryBuildDataSource.addRange(fieldnum(Bill_TabMethod, CustName));
}
// If an account number has not been set, then use the parameter value to set it.
if(!queryBuildRange.value())
queryBuildRange.value(custName);
}

queryRun = new QueryRun(query);

while(queryRun.next())
{
billbuffer = queryRun.get(tableNum(Bill_TabMethod));

bill_TabMethodTmp.CustName=billbuffer.CustName;
bill_TabMethodTmp.ItemName=billbuffer.ItemName;
bill_TabMethodTmp.Price=billbuffer.Price;
bill_TabMethodTmp.Quatity=billbuffer.Quatity;
bill_TabMethodTmp.Discount=billbuffer.Discount;
bill_TabMethodTmp.Vat=billbuffer.Vat;
bill_TabMethodTmp.TotalAmt=billbuffer.TotalAmt;
bill_TabMethodTmp.NetAmt=billbuffer.NetAmt;

bill_TabMethodTmp.insert();

}

}

Advertisements

Mark all records in a grid by clicking button and use it as a Switch in Ax 2012

METHOD 1:

public class FormRun extends ObjectRun
{
boolean val;
}

void clicked()
{
Bill_TabMethod bill;

super();

if(val==false)
{
while select bill// where bill.ItemName==”Watch”
{
Bill_TabMethod_ds.findRecord(bill);
Bill_TabMethod_ds.mark(true);
}
val=true;
}

else
{
while select bill// where bill.ItemName==”Watch”
{
Bill_TabMethod_ds.findRecord(bill);
Bill_TabMethod_ds.mark(false);
}
val=false;
}
}

METHOD 2:

public class FormRun extends ObjectRun
{
boolean val;
}

void clicked()
{
Bill_TabMethod bill;

super();

if(val==false)
{
bill = Bill_TabMethod_ds.getFirst(0);
while(bill)
{
Bill_TabMethod_ds.findRecord(bill);
Bill_TabMethod_ds.mark(true);
bill = Bill_TabMethod_ds.getNext();
}
val=true;
}
else
{
bill = Bill_TabMethod_ds.getFirst(1);
while(bill)
{
Bill_TabMethod_ds.findRecord(bill);
Bill_TabMethod_ds.mark(false);
bill = Bill_TabMethod_ds.getNext();
}
val=false;
}
}