Search in sources :

Example 6 with I_C_BankStatementLine

use of org.compiere.model.I_C_BankStatementLine in project metasfresh-webui-api by metasfresh.

the class C_BankStatement_ReconcileWithSinglePayment method paymentLookupProvider.

@ProcessParamLookupValuesProvider(parameterName = PARAM_C_Payment_ID, numericKey = true, lookupSource = DocumentLayoutElementFieldDescriptor.LookupSource.lookup, lookupTableName = I_C_Payment.Table_Name)
private LookupValuesList paymentLookupProvider() {
    if (bpartnerId == null) {
        return LookupValuesList.EMPTY;
    }
    final I_C_BankStatementLine bankStatementLine = getSingleSelectedBankStatementLine();
    final int limit = 20;
    final Set<PaymentId> paymentIds = bankStatementPaymentBL.findEligiblePaymentIds(bankStatementLine, bpartnerId, limit);
    return LookupDataSourceFactory.instance.searchInTableLookup(I_C_Payment.Table_Name).findByIdsOrdered(paymentIds);
}
Also used : PaymentId(de.metas.payment.PaymentId) I_C_BankStatementLine(org.compiere.model.I_C_BankStatementLine) ProcessParamLookupValuesProvider(de.metas.ui.web.process.descriptor.ProcessParamLookupValuesProvider)

Example 7 with I_C_BankStatementLine

use of org.compiere.model.I_C_BankStatementLine in project metasfresh-webui-api by metasfresh.

the class C_BankStatement_UnReconcileLine method checkSingleLineSelectedWhichIsReconciled.

private final ProcessPreconditionsResolution checkSingleLineSelectedWhichIsReconciled(@NonNull final IProcessPreconditionsContext context) {
    // there should be a single line selected
    final Set<TableRecordReference> bankStatemementLineRefs = context.getSelectedIncludedRecords();
    if (bankStatemementLineRefs.size() != 1) {
        return ProcessPreconditionsResolution.rejectWithInternalReason("a single line shall be selected");
    }
    final TableRecordReference bankStatemementLineRef = bankStatemementLineRefs.iterator().next();
    final BankStatementLineId bankStatementLineId = BankStatementLineId.ofRepoId(bankStatemementLineRef.getRecord_ID());
    final I_C_BankStatementLine line = bankStatementBL.getLineById(bankStatementLineId);
    if (!line.isReconciled()) {
        return ProcessPreconditionsResolution.rejectWithInternalReason("line shall be reconciled");
    }
    return ProcessPreconditionsResolution.accept();
}
Also used : TableRecordReference(org.adempiere.util.lang.impl.TableRecordReference) I_C_BankStatementLine(org.compiere.model.I_C_BankStatementLine) BankStatementLineId(de.metas.banking.BankStatementLineId)

Aggregations

I_C_BankStatementLine (org.compiere.model.I_C_BankStatementLine)7 BankStatementLineId (de.metas.banking.BankStatementLineId)2 PaymentId (de.metas.payment.PaymentId)2 TableRecordReference (org.adempiere.util.lang.impl.TableRecordReference)2 I_C_BankStatement (org.compiere.model.I_C_BankStatement)2 BPartnerId (de.metas.bpartner.BPartnerId)1 DocStatus (de.metas.document.engine.DocStatus)1 ProcessParamLookupValuesProvider (de.metas.ui.web.process.descriptor.ProcessParamLookupValuesProvider)1 AdempiereException (org.adempiere.exceptions.AdempiereException)1 FillMandatoryException (org.adempiere.exceptions.FillMandatoryException)1