// UI builder Sample
--> all lookup
as Multi Select
--> Based on
legal entity PurchaseOrder Number will return for selected Legalentities
--> Based One
multiple select lookup another multiselect lookup will appear
example here :
Based on
--> Brand
dialog ,category value appear based on brand names..
public class FulFillmentUIBuilder extends
SrsReportDataContractUIBuilder
{
DialogField
dialogBrand;
DialogField
dialogLegalEntiy;
DialogField
dialogWarehouse;
DialogField
dialogMAFFSeason;
DialogField
dialogBrandSeason;
DialogField
dialogCategory;
DialogField
dialogdivision;
DialogField dialogGroup;
DialogField
dialogsubGroup;
DialogField
dialogpurchId;
//FulfillmentContract contract;
}
public void
Brand(FormStringControl _control)
{
Query query = new Query();
QueryBuildDataSource DS;
Container cont;
DS =
query.addDataSource(tableNum(EcoResCategory));
DS.addRange(fieldNum(EcoResCategory,Level)).value('3');
DS.addSelectionField(fieldNum(EcoResCategory,Name));
SysLookupMultiSelectGrid::lookup(query,_control,_control,cont);
}
public void
BrandSeason(FormStringControl _control)
{
Query query = new Query();
QueryBuildDataSource DS;
Container cont;
DS =
query.addDataSource(tableNum(SupplementaryHierarchy));
DS.addSelectionField(fieldNum(SupplementaryHierarchy,BrandSeason));
DS.addGroupByField(fieldNum(SupplementaryHierarchy,BrandSeason));
SysLookupMultiSelectGrid::lookup(query, _control,_control,cont);
}
///
<summary>
/// Builds the UI
of the repor input dialog
///
</summary>
///
<remarks>
/// This remark
has been overriddento build two nested groups that have a radio button style
///
</remarks>
public void
build()
{
FulfillmentContract contract;
super();
contract = this.dataContractObject()as FulfillmentContract;
dialogBrand =
this.bindInfo().getDialogField(contract,methodStr( FulfillmentContract,parmBrand));
dialogLegalEntiy = this.bindInfo().getDialogField(contract,methodStr( FulfillmentContract,parmLegalEntity));
dialogWarehouse =
this.bindinfo().getDialogField(contract,methodStr( FulfillmentContract,parmWarehouse));
dialogMAFFSeason = this.bindInfo().getDialogField(contract,methodStr( FulfillmentContract,parmMAFFSeason));
dialogBrandSeason = this.bindInfo().getDialogField(contract,methodStr( FulfillmentContract,parmBrandSeason));
dialogCategory =
this.bindInfo().getDialogField(contract,methodStr( FulfillmentContract,parmcategory));
dialogdivision =
this.bindInfo().getDialogField(contract,methodStr( FulfillmentContract,parmDivision));
dialogGroup =
this.bindInfo().getDialogField(contract,methodStr( FulfillmentContract,parmGroup));
dialogsubGroup =
this.bindInfo().getDialogField(contract,methodStr( FulfillmentContract,parmsubGroup));
dialogpurchId =
this.bindInfo().getDialogField(contract,methodstr( FulfillmentContract,parmpurchid));
}
public void
Category(FormStringControl _control,Container _cont)
{
Query query = new Query();
List
_list = New List(Types::String);
ListIterator lt;
int
i;
QueryBuildDataSource DS;
Container cont,contBrand;
str brandname;
str
100 brandFilterName;
EcoResCategory ecoresCategory,ecorescat;
DS =
query.addDataSource(tableNum(EcoResCategory));
//info(strFmt("%1",dialogBrand.value()));
brandname = dialogBrand.value();
if(brandname !="")
{
_list = Global::strSplit(brandname,";");
lt = new ListIterator(_list);
while(lt.more())
{
contBrand += lt.value();
lt.next();
}
for(i = 1;i <= conLen(contBrand);i++)
{
//info(strFmt("%1",conPeek(contBrand,i)));
brandFilterName = conPeek(contBrand,i);
Select ecorescategory where ecorescategory.Name ==
brandFilterName;
while select ecorescat where
ecorescat.ParentCategory == ecorescategory.RecId
{
//info(strFmt("%1",ecorescat.Name));
DS.addRange(fieldNum(EcoResCategory,Name)).value(ecorescat.Name);
}
}
DS.addSelectionField(fieldNum(EcoResCategory,Name));
SysLookupMultiSelectGrid::lookup(query,_control,_control,_cont);
}
else
{
DS.addRange(fieldNum(EcoResCategory,Level)).value('4');
DS.addSelectionField(fieldNum(EcoResCategory,Name));
SysLookupMultiSelectGrid::lookup(query, _control,_control,_cont);
}
}
public void
Division(FormStringControl _control)
{
Query query = new Query();
List
_list = New List(Types::String);
ListIterator lt;
int
i;
QueryBuildDataSource DS;
Container cont,contCat;
str
CatName;
str
100 CatFilterName;
EcoResCategory ecoresCategory,ecorescat;
DS =
query.addDataSource(tableNum(EcoResCategory));
//info(strFmt("%1",dialogCategory.value()));
CatName = dialogCategory.value();
if(CatName !="")
{
_list = Global::strSplit(CatName,";");
lt = new ListIterator(_list);
while(lt.more())
{
contCat += lt.value();
lt.next();
}
for(i = 1;i <= conLen(contCat);i++)
{
//info(strFmt("%1",conPeek(contBrand,i)));
CatFilterName = conPeek(contCat,i);
Select ecorescategory where ecorescategory.Name ==
CatFilterName;
while select ecorescat where
ecorescat.ParentCategory == ecorescategory.RecId
{
//info(strFmt("%1",ecorescat.Name));
DS.addRange(fieldNum(EcoResCategory,Name)).value(ecorescat.Name);
}
}
DS.addSelectionField(fieldNum(EcoResCategory,Name));
SysLookupMultiSelectGrid::lookup(query,
_control,_control,cont);
}
else
{
DS.addRange(fieldNum(EcoResCategory,Level)).value('5');
DS.addSelectionField(fieldNum(EcoResCategory,Name));
SysLookupMultiSelectGrid::lookup(query,
_control,_control,cont);
}
}
public void
GroupCat(FormStringControl _control)
{
Query query = new Query();
List
_list = New List(Types::String);
ListIterator lt;
int
i;
QueryBuildDataSource DS;
Container cont,contCat;
str
100 GroupFilterName;
EcoResCategory ecoresCategory,ecorescat;
DS =
query.addDataSource(tableNum(EcoResCategory));
//info(strFmt("%1",dialogCategory.value()));
GroupFilterName
= dialogdivision.value();
if(GroupFilterName !="")
{
_list = Global::strSplit(GroupFilterName,";");
lt = new ListIterator(_list);
while(lt.more())
{
contCat += lt.value();
lt.next();
}
for(i = 1;i <= conLen(contCat);i++)
{
//info(strFmt("%1",conPeek(contBrand,i)));
GroupFilterName = conPeek(contCat,i);
Select ecorescategory where ecorescategory.Name ==
GroupFilterName;
while select ecorescat where
ecorescat.ParentCategory == ecorescategory.RecId
{
//info(strFmt("%1",ecorescat.Name));
DS.addRange(fieldNum(EcoResCategory,Name)).value(ecorescat.Name);
}
}
DS.addSelectionField(fieldNum(EcoResCategory,Name));
SysLookupMultiSelectGrid::lookup(query,
_control,_control,cont);
}
else
{
DS.addRange(fieldNum(EcoResCategory,Level)).value('6');
DS.addSelectionField(fieldNum(EcoResCategory,Name));
SysLookupMultiSelectGrid::lookup(query,
_control,_control,cont);
}
}
public void
LegalEntity(FormStringControl _control)
{
//Query query = new Query(queryStr(Query5));
Query query = new Query();
QueryBuildDataSource DS;
Container cont;
DS =
query.addDataSource(tableNum(DataArea));
DS.addSelectionField(fieldNum(DataArea,Id));
DS.addSelectionField(fieldNum(DataArea,Name));
SysLookupMultiSelectGrid::lookup(query, _control,_control,cont);
}
public void
MAFFBrandSeason(FormStringControl _control,Container _cont)
{
Query query = new Query();
QueryBuildDataSource DS;
Container cont;
DS =
query.addDataSource(tableNum(RetailSeasonTable));
DS.addSelectionField(fieldNum(RetailSeasonTable,SeasonCode));
SysLookupMultiSelectGrid::lookup(query, _control,_control,cont);
}
public void
postBuild()
{
super();
dialogCategory = this.bindInfo().getDialogField(this.dataContractObject(),methodStr( FulfillmentContract,parmcategory));
dialogCategory.registerOverrideMethod(methodStr(FormStringControl,
lookup),methodStr( FulFillmentUIBuilder,Category),this);
dialogDivision = this.bindInfo().getDialogField(this.dataContractObject(),methodStr( FulfillmentContract,parmDivision));
dialogDivision.registerOverrideMethod(methodStr(FormStringControl,
lookup),methodStr( FulFillmentUIBuilder,Division),this);
dialogGroup =
this.bindInfo().getDialogField(this.dataContractObject(),methodStr( FulfillmentContract,parmGroup));
dialogGroup.registerOverrideMethod(methodStr(FormStringControl,
lookup),methodStr( FulFillmentUIBuilder,GroupCat),this);
dialogsubGroup =
this.bindInfo().getDialogField(this.dataContractObject(),methodStr( FulfillmentContract,parmSubGroup));
dialogsubGroup.registerOverrideMethod(methodStr(FormStringControl,
lookup),methodStr( FulFillmentUIBuilder,SubGroup),this);
}
public void
postRun()
{
super();
dialogBrand.registerOverrideMethod(methodStr(FormStringControl,
lookup),methodStr( FulFillmentUIBuilder,
Brand),this);
dialogWarehouse.registerOverrideMethod(methodStr(FormStringControl,
lookup),methodStr( FulFillmentUIBuilder,Warehouse),this);
dialogLegalEntiy.registerOverrideMethod(methodStr(FormStringControl,
lookup),methodStr( FulFillmentUIBuilder,LegalEntity),this);
dialogPurchId.registerOverrideMethod(methodStr(FormStringControl,
lookup),methodStr( FulFillmentUIBuilder,
PurchaseOrder),this);
dialogMAFFSeason.registerOverrideMethod(methodStr(FormStringControl,
lookup),methodStr( FulFillmentUIBuilder,
MAFFBrandSeason),this);
dialogBrandSeason.registerOverrideMethod(methodStr(FormStringControl,
lookup),methodStr( FulFillmentUIBuilder,
BrandSeason),this);
}
public void
PurchaseOrder(FormStringControl _control,Container _cont)
{
Query query = new Query();
QueryBuildDataSource DS;
List
_list = New List(Types::String);
ListIterator lt;
PurchTable purchTable,purchtab;
int
i,j,k,l;
str
100 LegalEntity,conlegal,conlegalTo,conPurch;
container con,conlegalEntity;
POLookup POLookup;
if
(dialogLegalEntiy.value() == "")
{
checkFailed("Legal Entity Must be filled In");
}
else
{
delete_from POLookup;
LegalEntity = dialogLegalEntiy.value();
_list = Global::strSplit(LegalEntity,";");
lt = new ListIterator(_list);
while(lt.more())
{
con += lt.value();
lt.next();
}
for(i = 1;i <= conLen(con);i++)
{
conlegal = conPeek(con,i);
if (conlegal == curext())
{
while select purchtab where
purchtab.dataAreaId == conlegal
{
conlegalEntity +=
purchtab.PurchId;
}
purchtab.clear();
}
else
{
changeCompany(conlegal)
{
while select purchTable
where purchTable.dataAreaId == conlegal
{
conlegalEntity += purchTable.PurchId;
}
purchTable.clear();
}
}
}
for(k = 1;k <= conLen(conlegalEntity);k++)
{
conPurch = conPeek(conlegalEntity,k);
POLookup.PurchaseOrder
= conPurch;
// POLookup.CompanyName
= conlegalTo;
POLookup.insert();
}
DS = query.addDataSource(tableNum( POLookup));
DS.addSelectionField(fieldNum(
POLookup,PurchaseOrder));
//DS.addSelectionField(fieldNum(
POLookup,CompanyName));
SysLookupMultiSelectGrid::lookup(query,
_control,_control,_cont);
}
}
public void
SubGroup(FormStringControl _control)
{
Query query = new Query();
List
_list = New List(Types::String);
ListIterator lt;
int
i;
QueryBuildDataSource DS;
Container cont,contCat;
str
CatName;
str
100 CatFilterName;
EcoResCategory ecoresCategory,ecorescat;
DS =
query.addDataSource(tableNum(EcoResCategory));
//info(strFmt("%1",dialogGroup.value()));
CatName = dialogGroup.value();
if(CatName !="")
{
_list = Global::strSplit(CatName,";");
lt = new ListIterator(_list);
while(lt.more())
{
contCat += lt.value();
lt.next();
}
for(i = 1;i <= conLen(contCat);i++)
{
//info(strFmt("%1",conPeek(contBrand,i)));
CatFilterName = conPeek(contCat,i);
Select ecorescategory where ecorescategory.Name ==
CatFilterName;
while select ecorescat where
ecorescat.ParentCategory == ecorescategory.RecId
{
//info(strFmt("%1",ecorescat.Name));
DS.addRange(fieldNum(EcoResCategory,Name)).value(ecorescat.Name);
}
}
DS.addSelectionField(fieldNum(EcoResCategory,Name));
SysLookupMultiSelectGrid::lookup(query,
_control,_control,cont);
}
else
{
DS.addRange(fieldNum(EcoResCategory,Level)).value('7');
DS.addSelectionField(fieldNum(EcoResCategory,Name));
SysLookupMultiSelectGrid::lookup(query,
_control,_control,cont);
}
}
public void
Warehouse(FormStringControl _control)
{
Query query = new Query();
QueryBuildDataSource DS;
Container cont;
DS =
query.addDataSource(tableNum(InventLocation));
DS.addSelectionField(fieldNum(InventLocation,InventLocationId));
DS.addSelectionField(fieldNum(InventLocation,Name));
SysLookupMultiSelectGrid::lookup(query, _control,_control,cont);
}
No comments:
Post a Comment