Kita akan membuat form baru di modul Procurement and sourching. Kita bilang form ini form Berita Acara.
form ini mempunyai datasource BeritaAcaratable. dengan fields :
- BeritaacaraId
- Transdate
- Description
- Buat Extended data type BeritaacaraId.
- Di Class NumberSeqModulePurchaseOrder/Loadmodule, tambahkan code berikut.
//start husna
datatype.parmDatatypeId(extendedTypeNum(BeritaacaraId));
datatype.parmReferenceHelp(literalStr("Berita acara"));
datatype.parmWizardIsContinuous(true);
datatype.parmWizardIsManual(NoYes::No);
datatype.parmWizardIsChangeDownAllowed(NoYes::No);
datatype.parmWizardIsChangeUpAllowed(NoYes::No);
datatype.parmSortField(999999);
datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
this.create(datatype);
//end husna
3. Di table PurchParameter/Methods/ tambahkan methods berikut :
//add Husna 20220113
static client server NumberSequenceReference numRefBeritaAcara()
{
return NumberSeqReference::findReference(extendedTypeNum(BeritaacaraId));
}
4. Buat job untuk memanggil module tambahan dan Extended data yang dibuat tadi. Job seperti berikut :
static void loadNumSeqPurchDemo(Args _args)
{
//define the class variable
NumberSeqModulePurchaseOrder seqMod = new NumberSeqModulePurchaseOrder();
//load the number sequences that were not generated
seqMod.load();
}
5. Buke menu Organization administration/Common/Number sequences/Number sequences. Klik tombol Generate. Pilih/cari reference modul "Berita acara" dan Company yang akan dipakai. Disana akan terbaca Sequence number ID yang related pada Berita Acara. klik OK
6. Buka modul Procurement and Sourching/Setup/Procurement parameter. Buka Tab Sequence number. disana akan ada reference baru, Berita Acara dengan Sequence Id nya.
7. Buat Form Berita Acara. lengkap dengan table/datasourcenya (BeritaAcaraTable).
8. Di Form BeritaAcara/Methods/, overide method close() dan numberSeqFormHandler()
public void close()
{
if (numberSeqFormHandler)
{
numberSeqFormHandler.formMethodClose();
}
super();
}
NumberSeqFormHandler numberSeqFormHandler()
{
if (!numberSeqFormHandler)
{
//create a reference of number sequence form handler class specifying the EDT, Data source name and the field of the table
numberSeqFormHandler = NumberSeqFormHandler::newForm(NumberSeqReference::findReference(extendedtypenum(PSMGRNRevisionId)).NumberSequenceId, element,PSMGRNRevisiontable_DS,fieldnum(PSMGRNRevisiontable,PSMGRNRevisionId));
}
return numberSeqFormHandler;
}
9. Di Datasource overwrite methods :
public void create(boolean _append = false)
{
element.numberSeqFormHandler().formMethodDataSourceCreatePre();
super(_append);
element.numberSeqFormHandler().formMethodDataSourceCreate(true);
}
public void write()
{
super();
element.numberSeqFormHandler().formMethodDataSourceWrite();
}
public boolean validateWrite()
{
boolean ret;
ret = super();
ret = element.numberSeqFormHandler().formMethodDataSourceValidateWrite(ret) && ret;
return ret;
}
public void linkActive()
{
element.numberSeqFormHandler().formMethodDataSourceLinkActive();
super();
}
//untuk method deleted() dipakai jika ada table lines/detail
public void deleted()
{
//element.numberSeqFormHandler().formMethodDataSourceDelete();
super();
}
Tidak ada komentar:
Posting Komentar