Search in sources :

Example 1 with MRefList

use of org.compiere.model.MRefList in project adempiere by adempiere.

the class MRefListTest method testGet.

public void testGet() throws Exception {
    //
    // Should be found
    MRefList rl = MRefList.get(getCtx(), X_AD_Table.ACCESSLEVEL_AD_Reference_ID, X_AD_Table.ACCESSLEVEL_Organization, getTrxName());
    assertNotNull(rl);
    assertEquals("Should be found", X_AD_Table.ACCESSLEVEL_Organization, rl.getValue());
    //
    // Should not be found
    rl = MRefList.get(getCtx(), 7654321, "7654321", getTrxName());
    assertNull("Should not be found", rl);
}
Also used : MRefList(org.compiere.model.MRefList)

Example 2 with MRefList

use of org.compiere.model.MRefList 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@";
}
Also used : MRefList(org.compiere.model.MRefList) MPaymentBatch(org.compiere.model.MPaymentBatch) List(java.util.List) MRefList(org.compiere.model.MRefList) BigDecimal(java.math.BigDecimal)

Aggregations

MRefList (org.compiere.model.MRefList)2 BigDecimal (java.math.BigDecimal)1 List (java.util.List)1 MPaymentBatch (org.compiere.model.MPaymentBatch)1