Filter form with button query in x++ ;
1. Di Declaration
form
public class
FormRun extends ObjectRun
{
str periodTaxStr;
str taxTypeStr;
str currencyStr;
str exportStr;
str returnStr;
Container KRE_ID_Tax_VATMarkCon;
QueryBuildDataSource
qbdsKRE_ID_Tax_VAT;
QueryBuildDataSource
qbdsCustInvoiceJourView;
QueryBuildDataSource
qbdsProjInvoiceJour;
QueryBuildDataSource
qbdsProjInvoiceJourView;
QueryBuildRange qRange1, qRange2, qRange3, qRange4,
qRange5, qRange6, qRange7;
TaxID_form
TaxID_Form;
Counter postCount;
}
2. Create button requery
void requery()
{
;
element.removeMarks();
periodTaxStr = TaxPeriodCtrl.dateValue() ?
strfmt("%1..%2",
dateStartMth(TaxPeriodCtrl.dateValue()),
dateEndMth(TaxPeriodCtrl.dateValue())) :
SysQuery::valueUnlimited();
taxTypeStr = TaxTypeCtrl.selection() == PjAllSederhanaStandar::All ?
SysQuery::valueUnlimited() :
(TaxTypeCtrl.selection() == PjAllSederhanaStandar::Sederhana ?
SysQuery::value(PjSederhanaStandar::Sederhana) :
SysQuery::value(PjSederhanaStandar::Standar));
currencyStr = CurrencyCtrl.valueStr() ?
SysQuery::value(CurrencyCtrl.valueStr()) :
SysQuery::valueUnlimited();
exportStr
= ExportLocalCtrl.selection() == PjAllEksporLokal::All ?
SysQuery::valueUnlimited() :
(ExportLocalCtrl.selection() == PjAllEksporLokal::Ekspor ?
SysQuery::value(NoYes::Yes) :
SysQuery::value(NoYes::No));
returnStr
= ReturnStatusCtrl.selection() == PjStatusRetur::All ?
SysQuery::valueNot('all') :
SysQuery::value(ReturnStatusCtrl.selection());
KRE_ID_Tax_VAT_DS.executeQuery();
}
3. Create Init in the Datasource method
public void
init()
{
QueryBuildDataSource
qbdsTaxList;
QueryBuildDataSource
qbdsTaxTable;
KRE_ID_Tax_VATSource
KRE_ID_Tax_VATSource;
KRE_ID_Tax_CodeType
KRE_ID_Tax_CodeType;
;
super();
if (element.args().menuItemType() ==
MenuItemType::Display && (element.args().menuItemName() == menuitemDisplayStr(KRE_ID_TaxIncomingEdit)))
{
select * from
KRE_ID_Tax_VAT where KRE_ID_Tax_VAT.ID_Tax_VATSource ==
KRE_ID_Tax_VATSource::Incoming
exists join
KRE_ID_Tax_VATLines where
KRE_ID_Tax_VATLines.ID_Tax_Invoice == KRE_ID_Tax_VAT.ID_Tax_Invoice;
}
else
{
if (element.args().menuItemType() ==
MenuItemType::Display && (element.args().menuItemName() == menuitemDisplayStr(KRE_ID_TaxoutgoingEdit)))
{
select * from
KRE_ID_Tax_VAT where
KRE_ID_Tax_VAT.ID_Tax_VATSource == KRE_ID_Tax_VATSource::Outgoing
exists join KRE_ID_Tax_VATLines where KRE_ID_Tax_VATLines.ID_Tax_Invoice ==
KRE_ID_Tax_VAT.ID_Tax_Invoice;
}
}
//qRange1 =
this.queryBuildDataSource().addRange(fieldnum(KRE_ID_Tax_VAT,
ID_Tax_Transdate));//.value(periodTaxStr);
qRange1 =
this.queryBuildDataSource().addRange(fieldNum(KRE_ID_Tax_VAT,
ID_Tax_InvoiceDate));
qRange2 =
this.queryBuildDataSource().addRange(fieldnum(KRE_ID_Tax_VAT,
ID_Tax_Currencycode));
qRange3 =
this.queryBuildDataSource().addRange(fieldnum(KRE_ID_Tax_VAT,
ID_Tax_isexport));
qRange4 =
this.queryBuildDataSource().addRange(fieldnum(KRE_ID_Tax_VAT,
typeinvoice));
qRange5 =
this.queryBuildDataSource().addRange(fieldnum(KRE_ID_Tax_VAT,
TaxCode));
qRange6 =
this.queryBuildDataSource().addRange(fieldnum(KRE_ID_Tax_VAT,
TaxCodeType));
qRange7 =
this.queryBuildDataSource().addRange(fieldnum(KRE_ID_Tax_VAT,
is_Delete));
}
4. Create Execute query in the Datasource method
public void
executeQuery()
{
qRange1.value(periodTaxStr);
qRange2.value(currencyStr);
qRange3.value(exportStr);
qrange4.value(returnStr);
qrange5.value(SysQuery::valueNotEmptyString());
KRE_ID_Tax_VATLines_ds.executeQuery();
super();
}
0 comments:
Post a Comment