use of org.compiere.model.MPaymentBatch in project adempiere by adempiere.
the class GenerateWithdrawal method doIt.
@Override
protected String doIt() throws Exception {
MPaymentBatch paymentBatchFrom = new MPaymentBatch(getCtx(), 0, get_TrxName());
paymentBatchFrom.setName(getDescription());
paymentBatchFrom.setProcessingDate(getTransactionDate());
paymentBatchFrom.saveEx();
MPaymentBatch paymentBatchTo = new MPaymentBatch(getCtx(), 0, get_TrxName());
paymentBatchTo.setName(getDescription());
paymentBatchTo.setProcessingDate(getTransactionDate());
paymentBatchTo.saveEx();
List<MRefList> refLists = (List<MRefList>) getInstancesForSelection(get_TrxName());
refLists.stream().forEach(refList -> {
BigDecimal amount = getSelectionAsBigDecimal(refList.get_ID(), "TT_Amount");
String referenceNo = getSelectionAsString(refList.get_ID(), "TT_ReferenceNo");
if (amount.signum() > 0) {
createPayment(getBankAccountId(), getPOSTerminalId(), getBusinessPartnerId(), getDocumentNo(), paymentBatchFrom.getDocumentNo(), referenceNo, getDocumentTypeId(), getChargeId(), refList.getValue(), getCurrencyId(), amount, getTransactionDate(), getAccountDate(), false, paymentBatchFrom.get_ID());
createPayment(getTransferCashtrxtoId(), getPOSTerminalId(), getBusinessPartnerId(), getDocumentNo(), referenceNo, paymentBatchTo.getDocumentNo(), getCounterDocumentTypeId(), getChargeId(), refList.getValue(), getCurrencyId(), amount, getTransactionDate(), getAccountDate(), true, paymentBatchTo.get_ID());
}
});
return "@Ok@";
}
Aggregations