1 package org.kuali.ole.deliver.bo;
2
3 import org.kuali.ole.OLEConstants;
4 import org.kuali.ole.deliver.form.PatronBillReviewForm;
5 import org.kuali.rice.krad.service.KRADServiceLocator;
6
7 import java.util.ArrayList;
8 import java.util.HashMap;
9 import java.util.List;
10 import java.util.Map;
11
12
13
14
15
16
17
18
19 public class PatronBillReview {
20
21 public List<PatronBillReviewForm> getPatronBill() {
22 List<PatronBillReviewForm> patronBillPayments = new ArrayList<PatronBillReviewForm>();
23 Map reviewMap = new HashMap();
24 reviewMap.put("reviewed", 'N');
25 List<PatronBillPayment> patronBillPaymentList = (List<PatronBillPayment>) KRADServiceLocator.getBusinessObjectService().findMatching(PatronBillPayment.class, reviewMap);
26 for (PatronBillPayment patronBillPayment : patronBillPaymentList) {
27 String itemBarcode = "";
28 PatronBillReviewForm patronBillReviewForm = new PatronBillReviewForm();
29 patronBillReviewForm.setBillNumber(patronBillPayment.getBillNumber());
30 patronBillReviewForm.setBillDate(patronBillPayment.getBillDate());
31 patronBillReviewForm.setPatronId(patronBillPayment.getPatronId());
32
33
34 patronBillReviewForm.setTotalAmount(patronBillPayment.getTotalAmount().bigDecimalValue());
35 Map itemMap = new HashMap();
36 itemMap.put(OLEConstants.OlePatron.BILL_PAYMENT_ID, patronBillPayment.getBillNumber());
37 List<FeeType> feeTypes = (List<FeeType>) KRADServiceLocator.getBusinessObjectService().findMatching(FeeType.class, itemMap);
38 if (feeTypes.size() > 0) {
39 for (int i = 0; i < feeTypes.size(); i++) {
40 itemBarcode += feeTypes.get(i).getItemBarcode();
41 itemBarcode += OLEConstants.OlePatron.ITEMBARCODE_SEPARATOR;
42 }
43 itemBarcode = itemBarcode.substring(0, (itemBarcode.lastIndexOf(OLEConstants.OlePatron.ITEMBARCODE_SEPARATOR)));
44 }
45 patronBillReviewForm.setItemBarcode(itemBarcode);
46 patronBillPayments.add(patronBillReviewForm);
47 }
48 return patronBillPayments;
49 }
50
51 public List<PatronBillReviewForm> getPatronReviewedBill() {
52 List<PatronBillReviewForm> patronBillPayments = new ArrayList<PatronBillReviewForm>();
53 Map reviewMap = new HashMap();
54 reviewMap.put("reviewed", 'Y');
55 List<PatronBillPayment> patronBillPaymentList = (List<PatronBillPayment>) KRADServiceLocator.getBusinessObjectService().findMatching(PatronBillPayment.class, reviewMap);
56 for (PatronBillPayment patronBillPayment : patronBillPaymentList) {
57 String itemBarcode = "";
58 PatronBillReviewForm patronBillReviewForm = new PatronBillReviewForm();
59 patronBillReviewForm.setBillNumber(patronBillPayment.getBillNumber());
60 patronBillReviewForm.setBillDate(patronBillPayment.getBillDate());
61 patronBillReviewForm.setPatronId(patronBillPayment.getPatronId());
62
63
64 patronBillReviewForm.setTotalAmount(patronBillPayment.getTotalAmount().bigDecimalValue());
65 Map itemMap = new HashMap();
66 itemMap.put(OLEConstants.OlePatron.BILL_PAYMENT_ID, patronBillPayment.getBillNumber());
67 List<FeeType> feeTypes = (List<FeeType>) KRADServiceLocator.getBusinessObjectService().findMatching(FeeType.class, itemMap);
68 if (feeTypes.size() > 0) {
69 for (int i = 0; i < feeTypes.size(); i++) {
70 itemBarcode += feeTypes.get(i).getItemBarcode();
71 itemBarcode += OLEConstants.OlePatron.ITEMBARCODE_SEPARATOR;
72 }
73 itemBarcode = itemBarcode.substring(0, (itemBarcode.lastIndexOf(OLEConstants.OlePatron.ITEMBARCODE_SEPARATOR)));
74 }
75 patronBillReviewForm.setItemBarcode(itemBarcode);
76 patronBillPayments.add(patronBillReviewForm);
77 }
78 return patronBillPayments;
79 }
80 }