Compare commits
3 Commits
4a2a7fca67
...
8b49927b79
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b49927b79 | ||
|
|
cb96ccb7ca | ||
|
|
18eda34bff |
@ -226,10 +226,15 @@ public class TransactionSummaryFragment extends DataBindingFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private SettleData processTransactionData(List<PayDetail> payDetailList, SimpleDateFormat formatter,
|
private SettleData processTransactionData(List<PayDetail> payDetailList,
|
||||||
Date yesterday, Date start, Date end) {
|
SimpleDateFormat formatter,
|
||||||
|
Date yesterday,
|
||||||
|
Date start,
|
||||||
|
Date end) {
|
||||||
try {
|
try {
|
||||||
// Create a local helper class for readable mutability
|
// ✅ IMPORTANT: clear old data
|
||||||
|
filteredLists.clear();
|
||||||
|
|
||||||
class Counter {
|
class Counter {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
long amount = 0L;
|
long amount = 0L;
|
||||||
@ -252,37 +257,32 @@ public class TransactionSummaryFragment extends DataBindingFragment {
|
|||||||
Counter preAuthCompVoid = new Counter();
|
Counter preAuthCompVoid = new Counter();
|
||||||
Counter refund = new Counter();
|
Counter refund = new Counter();
|
||||||
|
|
||||||
|
// ✅ Use ONE consistent format
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy HH:mm", Locale.getDefault());
|
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy HH:mm", Locale.getDefault());
|
||||||
|
|
||||||
for (PayDetail pay : payDetailList) {
|
for (PayDetail pay : payDetailList) {
|
||||||
try {
|
try {
|
||||||
Date transDate = formatter.parse(pay.getTransDate());
|
// ✅ Combine date + time correctly
|
||||||
if ((transDate.after(start) || transDate.equals(start)) &&
|
|
||||||
(transDate.before(end) || transDate.equals(end))) {
|
|
||||||
filteredLists.add(pay);
|
|
||||||
}
|
|
||||||
} catch (ParseException e) {
|
|
||||||
LogUtil.e(TAG, "Error parsing transaction date: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LogUtil.d(TAG, "Filtered transactions count: " + filteredLists.size());
|
|
||||||
|
|
||||||
// Process filtered transactions
|
|
||||||
for (PayDetail pay : filteredLists) {
|
|
||||||
try {
|
|
||||||
Date currentDate = sdf.parse(pay.transDate + " " + pay.transTime);
|
Date currentDate = sdf.parse(pay.transDate + " " + pay.transTime);
|
||||||
|
|
||||||
if ((currentDate.after(start) || currentDate.equals(start)) &&
|
if (currentDate == null) continue;
|
||||||
(currentDate.before(end) || currentDate.equals(end))) {
|
|
||||||
|
// ✅ Correct inclusive range check
|
||||||
|
if (!currentDate.before(start) && !currentDate.after(end)) {
|
||||||
|
|
||||||
|
// ✅ Keep filtered list for printing
|
||||||
|
filteredLists.add(pay);
|
||||||
|
|
||||||
if (sharedViewModel.hostType.getValue() == HostType.QR) {
|
if (sharedViewModel.hostType.getValue() == HostType.QR) {
|
||||||
|
|
||||||
if (pay.getTransactionType() == TransactionsType.MMQR.value && pay.getQrTransStatus() == 1) {
|
if (pay.getTransactionType() == TransactionsType.MMQR.value && pay.getQrTransStatus() == 1) {
|
||||||
wave.inc(pay.amount);
|
wave.inc(pay.amount);
|
||||||
} else if (pay.getTransactionType() == TransactionsType.MMQR_REFUND.value && pay.getQrTransStatus() == 1) {
|
} else if (pay.getTransactionType() == TransactionsType.MMQR_REFUND.value && pay.getQrTransStatus() == 1) {
|
||||||
waveRefund.inc(pay.amount);
|
waveRefund.inc(pay.amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (sharedViewModel.hostType.getValue() == HostType.MPU) {
|
} else if (sharedViewModel.hostType.getValue() == HostType.MPU) {
|
||||||
|
|
||||||
if (pay.getTransactionType() == TransactionsType.VOID.value) {
|
if (pay.getTransactionType() == TransactionsType.VOID.value) {
|
||||||
voidTran.inc(pay.amount);
|
voidTran.inc(pay.amount);
|
||||||
} else if (pay.getTransactionType() == TransactionsType.SALE.value) {
|
} else if (pay.getTransactionType() == TransactionsType.SALE.value) {
|
||||||
@ -302,11 +302,14 @@ public class TransactionSummaryFragment extends DataBindingFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
LogUtil.e(TAG, "Error parsing transaction datetime: " + e.getMessage());
|
LogUtil.e(TAG, "Error parsing transaction datetime: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LogUtil.d(TAG, "Filtered transactions count: " + filteredLists.size());
|
||||||
|
|
||||||
return new SettleData(
|
return new SettleData(
|
||||||
sale.count, sale.amount,
|
sale.count, sale.amount,
|
||||||
wave.count, wave.amount,
|
wave.count, wave.amount,
|
||||||
@ -319,6 +322,7 @@ public class TransactionSummaryFragment extends DataBindingFragment {
|
|||||||
refund.count, refund.amount,
|
refund.count, refund.amount,
|
||||||
waveRefund.count, waveRefund.amount
|
waveRefund.count, waveRefund.amount
|
||||||
);
|
);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.e(TAG, "Error processing transaction data: " + e.getMessage());
|
LogUtil.e(TAG, "Error processing transaction data: " + e.getMessage());
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -524,7 +524,7 @@ public abstract class BaseXPrint {
|
|||||||
printer.appendPrnStr("BTH NO:" + batchNum, fontNormal, AlignEnum.LEFT,false);
|
printer.appendPrnStr("BTH NO:" + batchNum, fontNormal, AlignEnum.LEFT,false);
|
||||||
} else {
|
} else {
|
||||||
// printer.printColumnsString(new String[]{"BATCH NO :" + batchNum, "INV NO: " + invoiceNo}, new int[]{2, 2}, new int[]{0, 2}, null);
|
// printer.printColumnsString(new String[]{"BATCH NO :" + batchNum, "INV NO: " + invoiceNo}, new int[]{2, 2}, new int[]{0, 2}, null);
|
||||||
printer.appendPrnStr("BTH NO:" + batchNum + " TRACE NO:" + traceNo, fontNormal, AlignEnum.LEFT,false);
|
printer.appendPrnStr("BTH NO:" + batchNum + " INV NO:" + invoiceNo, fontNormal, AlignEnum.LEFT,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// printer.appendPrnStr("\n", fontNormal, AlignEnum.LEFT,false);
|
// printer.appendPrnStr("\n", fontNormal, AlignEnum.LEFT,false);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user