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; }
public void delete(Bill bill) { if (bill.getType() == TransactionType.Invoice) bill.cancel(); _gateway.delete(bill); }
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); }