Skip to content

Instantly share code, notes, and snippets.

@bayramcetin
Created December 29, 2022 10:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bayramcetin/f72503d8897272baeadbf3f47bef8045 to your computer and use it in GitHub Desktop.
Save bayramcetin/f72503d8897272baeadbf3f47bef8045 to your computer and use it in GitHub Desktop.
Dialog Lookup Override Method
class ETGExportDeclarationIdUpdate
{
CustPackingSlipJour CustPackingSlipJour;
FRTExportDeclarationId exportDeclarationId;
public void lookupExportDeclarationId(FormStringControl _formControl)
{
Query query = new Query();
QueryBuildDataSource queryBuildDataSource = query.addDataSource(tableNum(FRTExportDeclarationTable));
QueryBuildRange qbrCustInvoiceId = queryBuildDataSource.addRange(fieldNum(FRTExportDeclarationTable, CustInvoiceId));
qbrCustInvoiceId.value(SysQuery::valueEmptyString());
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(FRTExportDeclarationTable), _formControl, true);
sysTableLookup.addLookupfield(fieldNum(FRTExportDeclarationTable, ExportDeclarationId));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
private boolean dialog()
{
Dialog dialog = new Dialog("İhracat dosya kodu güncelle");
DialogField field = dialog.addField(extendedTypeStr(FRTExportDeclarationId));
field.registerOverrideMethod(methodStr(FormStringControl, lookup),
methodStr(ETGExportDeclarationIdUpdate, lookupExportDeclarationId), this);
if(dialog.run())
{
if (!field.value())
throw warning("İhracat dosya kodu giriniz.");
exportDeclarationId = field.value();
return true;
}
return false;
}
public void run()
{
if(this.dialog() && CustPackingSlipJour)
{
ttsbegin;
CustPackingSlipJour.selectForUpdate(true);
CustPackingSlipJour.ETGExportDeclarationId = exportDeclarationId;
CustPackingSlipJour.update();
ttscommit;
info("İhracat dosya kodu güncellendi.");
}
}
public CustPackingSlipJour parmCustPackingSlipJour(CustPackingSlipJour _CustPackingSlipJour = CustPackingSlipJour)
{
CustPackingSlipJour = _CustPackingSlipJour;
return CustPackingSlipJour;
}
public static void main(Args args)
{
if (! args || ! args.dataset() || ! args.record() ||
args.record().TableId != tablenum(CustPackingSlipJour) )
{
throw error(Error::missingRecord(funcname()));
}
ETGExportDeclarationIdUpdate etgExportDeclarationIdUpdate = new ETGExportDeclarationIdUpdate();
etgExportDeclarationIdUpdate.parmCustPackingSlipJour(args.record());
etgExportDeclarationIdUpdate.run();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment