コード例 #1
0
 /**
  * Create Payment for BankStatement
  *
  * @param bsl bank statement Line
  * @return Message
  * @throws Exception if not successful
  */
 private String createPayment(MBankStatementLine bsl) throws Exception {
   if (bsl == null || bsl.getC_Payment_ID() != 0) return "--";
   log.debug(bsl.toString());
   if (bsl.getC_Invoice_ID() == 0 && bsl.getC_BPartner_ID() == 0)
     throw new AdempiereUserError("@NotFound@ @C_Invoice_ID@ / @C_BPartner_ID@");
   //
   MBankStatement bs = new MBankStatement(getCtx(), bsl.getC_BankStatement_ID(), get_TrxName());
   //
   MPayment payment =
       createPayment(
           bsl.getC_Invoice_ID(),
           bsl.getC_BPartner_ID(),
           bsl.getC_Currency_ID(),
           bsl.getStmtAmt(),
           bsl.getTrxAmt(),
           bs.getC_BP_BankAccount_ID(),
           bsl.getStatementLineDate(),
           bsl.getDateAcct(),
           bsl.getDescription(),
           bsl.getAD_Org_ID());
   if (payment == null) throw new AdempiereSystemError("Could not create Payment");
   //	update statement
   bsl.setPayment(payment);
   bsl.save();
   //
   String retString = "@C_Payment_ID@ = " + payment.getDocumentNo();
   if (payment.getOverUnderAmt().signum() != 0)
     retString += " - @OverUnderAmt@=" + payment.getOverUnderAmt();
   return retString;
 } //	createPayment
コード例 #2
0
  /**
   * Load Specific Document Details
   *
   * @return error message or null
   */
  @Override
  protected String loadDocumentDetails() {
    MBankStatement bs = (MBankStatement) getPO();
    setDateDoc(bs.getStatementDate());
    setDateAcct(bs.getStatementDate()); // Overwritten on Line Level
    setC_BP_BankAccount_ID(bs.getC_BP_BankAccount_ID());
    // Amounts
    setAmount(AMTTYPE_Gross, bs.getStatementDifference());

    // Set Bank Account Info (Currency)
    final I_C_BP_BankAccount ba = getC_BP_BankAccount(); // shall not be null
    setC_Currency_ID(ba.getC_Currency_ID());

    // Contained Objects
    p_lines = loadLines(bs);
    log.fine("Lines=" + p_lines.length);
    return null;
  } // loadDocumentDetails