예제 #1
0
  public Collection<Bill> getByClientID(int clientID) {
    Collection<Bill> all = _gateway.getAll();
    ArrayList<Bill> results = new ArrayList<Bill>();
    Client client;

    for (Bill q : all) {
      client = q.getClient();

      if (client != null && client.getID() == clientID) {
        results.add(q);
      }
    }

    return results;
  }
예제 #2
0
  public void delete(Bill bill) {
    if (bill.getType() == TransactionType.Invoice) bill.cancel();

    _gateway.delete(bill);
  }
예제 #3
0
  public void insertStubData() {
    for (Client client : _dao.clientGateway().getAll()) {
      Bill bill = new Bill();

      bill.setClient(client);
      bill.setDescription("Test Quote ");
      bill.getProducts()
          .add(new BillProduct(new Product("Product 1", "Test", 10), bill.getID(), 9));
      insert(bill);
    }

    Bill bill = new Bill();

    bill.setType(TransactionType.Invoice);
    ArrayList<Client> clients = new ArrayList<Client>(_dao.clientGateway().getAll());
    Client client = clients.get(0);
    bill.setClient(client);
    bill.setDescription("Test Invoice");
    bill.getProducts().add(new BillProduct(new Product("Product 2", "Test 2", 8), bill.getID(), 8));
    insert(bill);
  }