Skip to content

Instantly share code, notes, and snippets.

@bayramcetin
Created September 23, 2022 14:33
Show Gist options
  • Save bayramcetin/e4e24fcc5cb57a80fbd6732ba4c54c22 to your computer and use it in GitHub Desktop.
Save bayramcetin/e4e24fcc5cb57a80fbd6732ba4c54c22 to your computer and use it in GitHub Desktop.
SSRS report data provider class
[
SRSReportParameterAttribute(classStr(ETGVendorPaymentOrderReportContract))
]
public class ETGVendorPaymentOrderReportDP extends SrsReportDataProviderPreProcessTempDB
{
ETGVendorPaymentOrderReportTmp tmp;
[SRSReportDataSetAttribute(tableStr(ETGVendorPaymentOrderReportTmp))]
public ETGVendorPaymentOrderReportTmp getTmp()
{
select tmp;
return tmp;
}
public void processReport()
{
ETGVendorPaymentOrderReportContract contract;
LedgerJournalId ledgerJournalId;
LedgerJournalTrans ledgerJournalTrans, ledgerJournalTransTotal;
VendTable vendTable;
VendBankAccount vendBankAccount;
BankAccountTable bankAccountTable;
PaxBankBranchTable paxBankBranchTable;
BankAccountID bankAccountID;
CompanyName companyName;
int i;
// Set the user connection to use on tables.
// This is needed because the createdTransactionId is different for the report than the default connection.
tmp.setConnection(this.parmUserConnection());
contract = this.parmDataContract() as ETGVendorPaymentOrderReportContract;
ledgerJournalId = contract.parmLedgerJournalId();
companyName = CompanyInfo::find().name();
select count(RecId) from ledgerJournalTransTotal
where ledgerJournalTransTotal.JournalNum == ledgerJournalId;
while select ledgerJournalTrans
where ledgerJournalTrans.JournalNum == ledgerJournalId
{
i++;
tmp.clear();
tmp.CompanyName = companyName;
tmp.LineNum = i;
tmp.TotalLine = ledgerJournalTransTotal.RecId;
tmp.TransDate = ledgerJournalTrans.TransDate;
tmp.CurrencyCode = ledgerJournalTrans.CurrencyCode;
tmp.Amount = ledgerJournalTrans.AmountCurCredit;
tmp.PaymMode = ledgerJournalTrans.PaymMode;
tmp.Txt = ledgerJournalTrans.Txt;
VendAccount vendAccount = LedgerDynamicAccountHelper::getAccountNumberFromDynamicAccount(ledgerJournalTrans.LedgerDimension);
vendTable = VendTable::find(vendAccount);
vendBankAccount = VendBankAccount::find(vendTable.AccountNum, vendTable.BankAccount);
paxBankBranchTable = PaxBankBranchTable::findByRecId(vendBankAccount.PAXBankBranchRecId);
tmp.TitleIban = strFmt("%1 / %2 / %3", vendTable.name(), vendBankAccount.BankIBAN, vendBankAccount.AccountNum);
tmp.BankBranch = strFmt("%1 / %2", vendBankAccount.Name, paxBankBranchTable.BranchName);
tmp.VATNum = vendTable.VATNum;
bankAccountID = LedgerDynamicAccountHelper::getAccountNumberFromDynamicAccount(ledgerJournalTrans.OffsetLedgerDimension);
bankAccountTable = BankAccountTable::find(bankAccountID);
paxBankBranchTable = PaxBankBranchTable::findByRecId(bankAccountTable.PAXBankBranchRecId);
tmp.Name = strFmt("%1 %2", paxBankBranchTable.BranchName, paxBankBranchTable.BankBranchId);
tmp.IBAN = bankAccountTable.IBAN;
tmp.insert();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment