How to get a number sequence for the POS module.
1. Create an element in base enum NumberSeqModule as POSModule.
 
2. Create a class NumberSeqReference_POSModule
 
public class NumberSeqReference_POS extends NumberSeqReference
{
}
 
3. Create two methods inside the class LoadModule() and NumberSeqModule().
 
protected void loadModule()
{
NumberSequenceReference numRef;
;
numRef.DataTypeId = typeId2ExtendedTypeId(typeid(POSRegisterID));
//POSRegisterId is the Extended data type
numRef.ConfigurationKeyId = configurationkeynum(logisticsBasic);
numRef.ReferenceHelp = literalstr("For POS Register ID");
numRef.WizardManual = NoYes::No;
numRef.WizardAllowChangeDown = NoYes::No;
numRef.WizardAllowChangeUp = NoYes::No;
numRef.SortField = 1;
this.create(numRef);
}
static NumberSeqModule numberSeqModule()
{
return NumberSeqModule::POSModule;// this is the element in base enum that you have created before
}
 
4. Modify the NumberSeqReference Class and change the Construct() and ModuleList()
 
//construct:
// POS addition begin
case (NumberSeqReference_POS::numberSeqModule()): return new NumberSeqReference_POS(_module);
// POS addition end
//Module List:
// POS Begin
moduleList += NumberSeqReference_POS::numberSeqModule();
// POS End
 
5. Create a class on the POSTableForm
 
public class FormRun extends ObjectRun
{
NumberSeqFormHandler numberSeqFormHandler;
}
 
6.Create a Method in the Table POSRegisterTable as numRefPOS()
 
client server static NumberSequenceReference numRefPOS()
{
return NumberSeqReference::findReference(typeId2ExtendedTypeId(typeid(POSRegisterId)));
}
 
7. Create a new method for the class
 
NumberSeqFormHandler numberSeqFormHandler()
{
if (!numberSeqFormHandler)
{
numberSeqFormHandler = NumberSeqFormHandler::newForm(POSRegisterTable::numRefPOS()
.NumberSequence,
element,
POSRegisterTable_DS,
fieldnum(POSRegisterTable, RegisterId)
);
}
return numberSeqFormHandler;
}
 
8. Override create method on the POSRegisterTable in the datasource methods
 
void create(boolean append = false,
boolean extern = false) // If created externally
{
;
super(append);
if (!extern)
{
element.numberSeqFormHandler().formMethodDataSourceCreate();
}
}
 
9. Override write method on the POSRegisterTable in the datasource methods
 
void write()
{
boolean updateCurrency;
NoYes newRecord;
;
super();
element.numberSeqFormHandler().formMethodDataSourceWrite();
}
 
10. Override delete method on the POSRegisterTable in the datasource methods
 
void delete()
{
FormDataSource callerDataSource;
;
element.numberSeqFormHandler().formMethodDataSourceDelete();
if (!posRegisterTable.RecId)
{
DirParty::showHideMessageBar(element,posRegisterTable,true);
}
super();
if (element.args() && element.args().dataset() == tablenum(smmBusRelTable))
{
callerDataSource = element.args().record().dataSource();
if (callerDataSource)
{
callerDataSource.executeQuery();
}
}
}
 
No comments:
Post a Comment