@@ -63,6 +63,8 @@ public class PaymentHistory extends BaseProcessor implements PactsConstants {
63
63
public static final String XLS_FORMAT = "xls" ;
64
64
public static final String FULL_LIST = "full_list" ;
65
65
public static final String PAYMENTS = "payments" ;
66
+ public static final String OWED_PAYMENTS = "owedPayments" ;
67
+ public static final String TOTAL_OWED_PAYMENTS = "totalOwedPayments" ;
66
68
67
69
/**
68
70
* <p>A <code>String</code> providing the name for request attribute holding the ID of a payment method preferred by
@@ -150,9 +152,17 @@ protected void businessProcessing() throws TCWebException {
150
152
151
153
List <BasePayment > removeNonPending = new ArrayList <BasePayment >();
152
154
155
+ List <Long > owedPayments = new ArrayList <Long >();
156
+ double totalOwedPayments = 0.0 ;
157
+ Date currentDate = new Date ();
158
+
153
159
for (BasePayment payment : payments ) {
154
160
if (payment .getPaymentType () == 3 || payment .getPaymentType () == 5 ) {
155
161
removePayments .add (payment );
162
+ } else if ((payment .getCurrentStatus ().equals (PaymentStatusFactory .createStatus (PaymentStatus .OWED_PAYMENT_STATUS ))) &&
163
+ !(payment .getDueDate ().after (currentDate ))) {
164
+ owedPayments .add (payment .getId ());
165
+ totalOwedPayments += payment .getNetAmount ();
156
166
} else {
157
167
if (!(payment .getCurrentStatus ().equals (PaymentStatusFactory .createStatus (PaymentStatus .OWED_PAYMENT_STATUS ))) &&
158
168
!(payment .getCurrentStatus ().equals (PaymentStatusFactory .createStatus (PaymentStatus .ENTERED_INTO_PAYMENT_SYSTEM_PAYMENT_STATUS ))) &&
@@ -184,6 +194,8 @@ protected void businessProcessing() throws TCWebException {
184
194
getRequest ().setAttribute ("NUM_TOTAL" , payments .size ());
185
195
getRequest ().setAttribute ("NUM_PER_PAGE" , numRecords );
186
196
getRequest ().setAttribute ("NUM_PENDING" , pendingPayments );
197
+ getRequest ().setAttribute ("OWED_PAYMENTS" , owedPayments );
198
+ getRequest ().setAttribute ("TOTAL_OWED_PAYMENTS" , totalOwedPayments );
187
199
188
200
if (exportToExcel ) {
189
201
produceXLS (payments );
0 commit comments