예제 #1
0
  public TicketTaxInfo getTaxLine(TaxInfo tax) {

    for (TicketTaxInfo taxline : taxes) {
      if (tax.getId().equals(taxline.getTaxInfo().getId())) {
        return taxline;
      }
    }

    return new TicketTaxInfo(tax);
  }
예제 #2
0
  public double getTax() {

    double sum = 0.0;
    if (hasTaxesCalculated()) {
      for (TicketTaxInfo tax : taxes) {
        sum += tax.getTax(); // Taxes are already rounded...
      }
    } else {
      for (TicketLineInfo line : m_aLines) {
        sum += line.getTax();
      }
    }
    return sum;
  }
예제 #3
0
  public TicketTaxInfo[] getTaxLines() {

    Map<String, TicketTaxInfo> m = new HashMap<String, TicketTaxInfo>();

    TicketLineInfo oLine;
    for (Iterator<TicketLineInfo> i = m_aLines.iterator(); i.hasNext(); ) {
      oLine = i.next();

      TicketTaxInfo t = m.get(oLine.getTaxInfo().getId());
      if (t == null) {
        t = new TicketTaxInfo(oLine.getTaxInfo());
        m.put(t.getTaxInfo().getId(), t);
      }
      t.add(oLine.getSubValue());
    }

    // return dSuma;
    Collection<TicketTaxInfo> avalues = m.values();
    return avalues.toArray(new TicketTaxInfo[avalues.size()]);
  }