Exemplo n.º 1
0
 /**
  * Perform Match
  *
  * @param bs bank statement
  * @return Message
  */
 private String match(MBankStatement bs) {
   if (m_matchers == null || bs == null) return "--";
   log.fine("match - " + bs);
   int count = 0;
   MBankStatementLine[] lines = bs.getLines(false);
   for (MBankStatementLine element : lines) {
     if (element.getC_Payment_ID() == 0) {
       match(element);
       count++;
     }
   }
   return String.valueOf(count);
 } //	match
  /**
   * Load Invoice Line.
   *
   * @param bs bank statement 4 amounts AMTTYPE_Payment AMTTYPE_Statement2 AMTTYPE_Charge
   *     AMTTYPE_Interest
   * @return DocLine Array
   */
  private DocLine[] loadLines(final MBankStatement bs) {
    ArrayList<DocLine> list = new ArrayList<DocLine>();
    MBankStatementLine[] lines = bs.getLines(false);
    for (int i = 0; i < lines.length; i++) {
      MBankStatementLine line = lines[i];
      DocLine_BankStatement docLine = new DocLine_BankStatement(line, this);
      // Set Date Acct
      if (i == 0) setDateAcct(line.getDateAcct());
      MPeriod period = MPeriod.get(getCtx(), line.getDateAcct(), line.getAD_Org_ID());
      if (period != null
          && period.isOpen(DOCTYPE_BankStatement, line.getDateAcct(), bs.getAD_Org_ID())) {
        docLine.setC_Period_ID(period.getC_Period_ID());
      }
      //
      list.add(docLine);
    }

    // Return Array
    DocLine[] dls = new DocLine[list.size()];
    list.toArray(dls);
    return dls;
  } // loadLines