Hello,
some time ago we have developed a solution where when generating payment from customer payment journal with ER, we are saving the file directly to Azure storage.
But this is done manually with standard steps:
Open customer payment journal >> Functions >> Generate Payment.
We want to automate it, so we can Generate multiple customer payments with batch processing.
To test some solutions I have create controller and service classes.
In the service class I have the following code:
"jourNum" and "journNum2" are just Journal numbers for testing purposes on 2 different journals.
What is happening here is that "custVendSumForPaym.runOperation();" executes the logic (as by standard) to Generate the payment and if the ER format is setup, it sends it to ER for processing.
The problem we have here is that even though below while select loop goes through the both journal, at the end ER only picks up the first journal number for processing and therefore we only see 1 journal with "Sent" status and file in destination.
So, jourNum is selected and executed, goes through all the standard methods that is run by "custVendSumForPaym.runOperation();".
Then it comes back to while select and selects the journNum2 and goes through all the tandard methods that is run by "custVendSumForPaym.runOperation();".
When I debug (in batch) it kinda feels that process is over, but after about 1 minute, breakpoint is hit in some ER classes, where we see, that it is processing the file for jourNum only and then the process ends. jourNum2 isn't taken into account.
So, I guess, first question would be, if you maybe have better suggestion how to achieve to run "Generate payment" in batch for multiple journals (I could not find standard batch job for it), which would also use ER as it is setup.
Second questions would be, if you have any suggestions what to change in the code below, because it is kinda the only modification in this process. (There is a custom class to send files to Azure, but it processes the Stream that it will get)
while select journalTable
where journalTable.Posted == NoYes::No &&
journalTable.JournalNum == jourNum || journalTable.JournalNum == jourNum2
join journalTrans
where journalTrans.JournalNum == journalTable.JournalNum &&
(journalTrans.PaymentStatus == CustVendPaymStatus::None ||
journalTrans.PaymentStatus == CustVendPaymStatus::Rejected)
{
custVendSumForPaym = CustVendSumForPaym::newLedgerJournalTrans(journalTrans);
custVendSumForPaym.parmPaymMode(journalTrans.PaymMode);
custVendSumForPaym.parmBankAccountID(CustPaymModeTable::find(journalTrans.PaymMode).bankAccountTable().AccountID);
custVendSumForPaym.runOperation();
}