[DataContractAttribute]
class DDDAPBatchCoverSheetContract
{
LedgerJournalId ledgerJournalId;
[DataMemberAttribute("LedgerJournalId")]
public LedgerJournalId parmLedgerJournalId(LedgerJournalId _vendAccountNum = ledgerJournalId)
{
ledgerJournalId = _vendAccountNum;
return ledgerJournalId;
}
}
------------------------********************---------------------------
class DDDAPBatchCoverSheetController extends SrsReportRunController implements BatchRetryable
{
protected void prePromptModifyContract()
{
LedgerJournalTable ledgerJournalTable;
LedgerJournalTrans LedgerJournalTrans;
DDDAPBatchCoverSheetContract contract;
contract = this.parmReportContract().parmRdpContract() as DDDAPBatchCoverSheetContract;
if (args.record() && args.dataset() == tableNum(ledgerJournalTable))
{
ledgerJournalTable = args.record();
contract.parmLedgerJournalId(ledgerJournalTable.JournalNum);
}
else
{
LedgerJournalTrans = args.record();
contract.parmLedgerJournalId(LedgerJournalTrans.JournalNum);
}
}
static void main(Args _args)
{
DDDAPBatchCoverSheetController controller = new DDDAPBatchCoverSheetController();
controller.parmReportName(ssrsReportStr(DDDAPBatchCoverSheetReport, Report));
controller.parmArgs(_args);
Controller.parmShowDialog(false);
controller.parmDialogCaption("@DDD:APBatchCoverSheet");
controller.startOperation();
}
[Hookable(false)]
public final boolean isRetryable()
{
return true;
}
}
-----------------------------------------------------************----------------------
[SRSReportParameterAttribute(classStr(DDDAPBatchCoverSheetContract))]
class DDDAPBatchCoverSheetDP extends SRSReportDataProviderBase
{
DDDAPBatchCoverSheetContract contract;
DDDAPBatchCoverSheetTemp batchCoverSheetTemp;
[SRSReportDataSetAttribute("DDDAPBatchCoverSheetTemp")]
public DDDAPBatchCoverSheetTemp getDDDAPBatchCoverSheetTemp()
{
select batchCoverSheetTemp;
return batchCoverSheetTemp;
}
public void processReport()
{
Query query;
QueryRun qRun;
Ledgerjournaltable ledgerjournaltable;
LedgerJournalId ledgerJournalId;
#Define.BarCodeSplit('split')
#Define.EmptySpace(' ')
#Define.Batch('BATCH')
#Define.BATCHDRAFT('BATCH DRAFT')
contract = this.parmDataContract() as DDDAPBatchCoverSheetContract;
ledgerJournalId = contract.parmLedgerJournalId();
query= new Query();
query.addDataSource(tableNum(Ledgerjournaltable)).addRange(fieldNum(Ledgerjournaltable,JournalNum)).value(ledgerJournalId);
qRun = new QueryRun(query);
while(qRun.next())
{
ledgerjournaltable = qRun.get(tableNum(ledgerjournaltable));
batchCoverSheetTemp.BatchStatic = ledgerjournaltable.Posted? #Batch :#BATCHDRAFT;
batchCoverSheetTemp.Company = ledgerjournaltable.DataAreaId;
batchCoverSheetTemp.BatchDate = DateTimeUtil::date(ledgerjournaltable.CreatedDateTime);
batchCoverSheetTemp.BatchNumber = ledgerjournaltable.JournalNum;
batchCoverSheetTemp.TotalCountOfInvoices = this.countOfInvoices(ledgerjournaltable);
this.vendorsList(ledgerjournaltable);
if (ledgerjournaltable.Posted)
{
BarcodeCode39 barcode = Barcode::construct(BarcodeType::Code39);
BarcodeCode128 barCodeSplit = Barcode::construct(BarcodeType::Code128);
str message = strFmt('%1',batchCoverSheetTemp.Company + #EmptySpace +
batchCoverSheetTemp.BatchNumber +#EmptySpace+ strfmt('%1',batchCoverSheetTemp.BatchDate));
barcode.string(true, message);
barcode.encode();
barCodeSplit.string(true, #BarCodeSplit);
barCodeSplit.encode();
batchCoverSheetTemp.BarCode = barcode.barcodeStr();
batchCoverSheetTemp.BarCodeStatic = barCodeSplit.barcodeStr();
}
batchCoverSheetTemp.insert();
}
}
public int countOfInvoices(ledgerjournaltable _ledgerjournaltable)
{
LedgerJournalTrans ledgerJournalTransInv;
int numberOfInvoices;
while select Invoice from ledgerJournalTransInv group by Invoice
where ledgerJournalTransInv.JournalNum == _ledgerjournaltable.JournalNum
&& ledgerJournalTransInv.Invoice !=''
{
numberOfInvoices += 1;
}
return numberOfInvoices;
}
public void vendorsList(ledgerjournaltable _ledgerjournaltable)
{
LedgerJournalTrans ledgerJournalTrans;
vendTable vendTable;
#Define.Saparater(',')
while select ledgerJournalTrans group by LedgerDimension
where ledgerJournalTrans.JournalNum == _ledgerjournaltable.JournalNum
&& ledgerJournalTrans.AccountType == LedgerJournalACType::Vend
{
vendTable = VendTable::findByLedgerDimension(ledgerJournalTrans.parmLedgerDimension());
batchCoverSheetTemp.Vendors = (!batchCoverSheetTemp.Vendors)? vendTable.AccountNum : batchCoverSheetTemp.Vendors +#Saparater + vendTable.AccountNum;
}
}
}
-------------------------------------------***************---------------------------------
class DDDLedgerJournalTableFormEventHandler
{
[FormEventHandler(formStr(LedgerJournalTable), FormEventType::Initialized),
SuppressBPWarning('BPParameterNotUsed', 'False positive')]
public static void LedgerJournalTable_OnInitialized(xFormRun sender, FormEventArgs e)
{
FormRun element = sender;
FormControl batchCoverSheetDraft = element.design(0).controlName(formControlStr(LedgerJournalTable, DDDAPBatchCoverSheetDraftReport));
FormControl batchCoverSheetFinal = element.design(0).controlName(formControlStr(LedgerJournalTable, DDDAPBatchCoverSheetFinalReport));
batchCoverSheetDraft.visible(false);
batchCoverSheetFinal.visible(false);
}
[FormDataSourceEventHandler(formDataSourceStr(LedgerJournalTable, LedgerJournalTable), FormDataSourceEventType::Activated),
SuppressBPWarning('BPParameterNotUsed', 'False positive')]
public static void LedgerJournalTable_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
LedgerJournalTable ledgerJournalTable = sender.cursor();
FormRun element = sender.formRun();
FormControl batchCoverSheetDraft = element.design(0).controlName(formControlStr(LedgerJournalTable, DDDAPBatchCoverSheetDraftReport));
FormControl batchCoverSheetFinal = element.design(0).controlName(formControlStr(LedgerJournalTable, DDDAPBatchCoverSheetFinalReport));
batchCoverSheetDraft.visible(ledgerJournalTable.Posted == NoYes::No && ledgerJournalTable.JournalType == LedgerJournalType::VendInvoiceRegister);
batchCoverSheetFinal.visible(ledgerJournalTable.Posted == NoYes::Yes && ledgerJournalTable.JournalType == LedgerJournalType::VendInvoiceRegister);
}
}
------------------------------------------------*******************--------------
class DDDLedgerJournalTransVendInvoiceFormEventHandler
{
[FormEventHandler(formStr(LedgerJournalTransVendInvoice), FormEventType::Initialized),
SuppressBPWarning('BPParameterNotUsed', 'False positive')]
public static void LedgerJournalTransVendInvoice_OnInitialized(xFormRun sender, FormEventArgs e)
{
FormRun element = sender;
FormControl batchCoverSheetDraft = element.design(0).controlName(formControlStr(LedgerJournalTransVendInvoice, DDDAPBatchCoverSheetDraftReport));
FormControl batchCoverSheetFinal = element.design(0).controlName(formControlStr(LedgerJournalTransVendInvoice, DDDAPBatchCoverSheetFinalReport));
batchCoverSheetDraft.visible(false);
batchCoverSheetFinal.visible(false);
}
[FormDataSourceEventHandler(formDataSourceStr(LedgerJournalTransVendInvoice, LedgerJournalTrans), FormDataSourceEventType::Activated),
SuppressBPWarning('BPParameterNotUsed', 'False positive')]
public static void LedgerJournalTrans_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
LedgerJournalTrans ledgerJournalTrans = sender.cursor();
FormRun element = sender.formRun();
LedgerJournalTable ledgerjournalTable = ledgerjournalTable::find(ledgerJournalTrans.JournalNum);
FormControl batchCoverSheetDraft = element.design(0).controlName(formControlStr(LedgerJournalTransVendInvoice, DDDAPBatchCoverSheetDraftReport));
FormControl batchCoverSheetFinal = element.design(0).controlName(formControlStr(LedgerJournalTransVendInvoice, DDDAPBatchCoverSheetFinalReport));
batchCoverSheetDraft.visible(ledgerJournalTable.Posted == NoYes::No && ledgerJournalTable.JournalType == LedgerJournalType::VendInvoiceRegister);
batchCoverSheetFinal.visible(ledgerJournalTable.Posted == NoYes::Yes && ledgerJournalTable.JournalType == LedgerJournalType::VendInvoiceRegister);
}
}
No comments:
Post a Comment