예제 #1
0
 public double getSubTotal() {
   double sum = 0.0;
   for (TicketLineInfo line : m_aLines) {
     sum += line.getSubValue();
   }
   return sum;
 }
예제 #2
0
  public TicketInfo copyTicket() {
    TicketInfo t = new TicketInfo();

    t.tickettype = tickettype;
    t.m_iTicketId = m_iTicketId;
    t.m_iTicketNCF = m_iTicketNCF; // NCF
    t.m_dDate = m_dDate;
    t.m_sActiveCash = m_sActiveCash;
    t.attributes = (Properties) attributes.clone();
    t.m_User = m_User;
    t.m_Customer = m_Customer;

    t.m_aLines = new ArrayList<TicketLineInfo>();
    for (TicketLineInfo l : m_aLines) {
      t.m_aLines.add(l.copyTicketLine());
    }
    t.refreshLines();

    t.payments = new LinkedList<PaymentInfo>();
    for (PaymentInfo p : payments) {
      t.payments.add(p.copyPayment());
    }

    // taxes are not copied, must be calculated again.

    return t;
  }
예제 #3
0
  public double getArticlesCount() {
    double dArticles = 0.0;
    TicketLineInfo oLine;

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

    return dArticles;
  }
예제 #4
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;
  }
예제 #5
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()]);
  }
예제 #6
0
 public void setLine(int index, TicketLineInfo oLine) {
   oLine.setTicket(m_sId, index);
   m_aLines.set(index, oLine);
 }
예제 #7
0
  public void addLine(TicketLineInfo oLine) {

    oLine.setTicket(m_sId, m_aLines.size());
    m_aLines.add(oLine);
  }