Merge branch 'k' into duel_settlement
This commit is contained in:
commit
88a5d064b5
@ -77,6 +77,35 @@
|
|||||||
tools:text="000045" />
|
tools:text="000045" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingVertical="4dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Currency"
|
||||||
|
android:textColor="@color/colorPrimary"
|
||||||
|
android:textSize="13sp"
|
||||||
|
android:fontFamily="monospace"
|
||||||
|
android:textAlignment="center"
|
||||||
|
tools:text="Currency" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@{POSUtil.getInstance().currencyCodeToText(payDetail.currencyCode)}"
|
||||||
|
android:textColor="@color/colorPrimary"
|
||||||
|
android:textSize="13sp"
|
||||||
|
android:fontFamily="monospace"
|
||||||
|
android:textAlignment="center"
|
||||||
|
tools:text="MMK" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- Data Row 3: Transaction Type and Amount -->
|
<!-- Data Row 3: Transaction Type and Amount -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|||||||
@ -45,6 +45,7 @@ import java.time.format.DateTimeFormatter;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -856,30 +857,37 @@ public abstract class BaseXPrint {
|
|||||||
printer.appendPrnStr(new String(new char[29]).replace("\0", "."), fontNormal, AlignEnum.CENTER, false);
|
printer.appendPrnStr(new String(new char[29]).replace("\0", "."), fontNormal, AlignEnum.CENTER, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class CurrencySummary {
|
||||||
|
long total = 0;
|
||||||
|
int count = 0;
|
||||||
|
}
|
||||||
protected void printTransDetailReport(List<PayDetail> lists, HostType hostType) {
|
protected void printTransDetailReport(List<PayDetail> lists, HostType hostType) {
|
||||||
|
|
||||||
|
// ✅ Summary holder (total + count per currency)
|
||||||
if (hostType == HostType.MPU || hostType == HostType.VISA_MASTER) {
|
class CurrencySummary {
|
||||||
// Use the same line-by-line style as QR detail report
|
long total = 0;
|
||||||
} else if (hostType == HostType.QR) {
|
int count = 0;
|
||||||
// print2ColumnsString("PAYMENT NAME", "");
|
|
||||||
// print2ColumnsString("DATE", "TIME");
|
|
||||||
// print2ColumnsString("TRANSACTION", "TRACE NO");
|
|
||||||
// print2ColumnsString("TRXN ID", "");
|
|
||||||
// print2ColumnsString("AMOUNT", "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, CurrencySummary> currencyMap = new HashMap<>();
|
||||||
// breakingLine();
|
|
||||||
|
|
||||||
long totalAmount = 0;
|
|
||||||
|
|
||||||
for (PayDetail pay : lists) {
|
for (PayDetail pay : lists) {
|
||||||
boolean isNeedMinusSign = pay.getTransactionType() == TransactionsType.VOID.value || pay.getTransactionType() == TransactionsType.REFUND.value || pay.getTransactionType() == TransactionsType.MMQR_REFUND.value;
|
|
||||||
boolean isDecimalEnabled = SystemParamsOperation.getInstance().isQrDecimalEnable();
|
|
||||||
|
|
||||||
|
boolean isNeedMinusSign =
|
||||||
|
pay.getTransactionType() == TransactionsType.VOID.value ||
|
||||||
|
pay.getTransactionType() == TransactionsType.REFUND.value ||
|
||||||
|
pay.getTransactionType() == TransactionsType.MMQR_REFUND.value;
|
||||||
|
|
||||||
|
boolean isDecimalEnabledQr = SystemParamsOperation.getInstance().isQrDecimalEnable();
|
||||||
|
String currency = currencyCodeToText(pay.getCurrencyCode());
|
||||||
|
|
||||||
|
// =============================
|
||||||
|
// PRINT DETAIL
|
||||||
|
// =============================
|
||||||
if (hostType == HostType.MPU || hostType == HostType.VISA_MASTER) {
|
if (hostType == HostType.MPU || hostType == HostType.VISA_MASTER) {
|
||||||
|
|
||||||
boolean isDecimalEnabledCard = SystemParamsOperation.getInstance().getDecimalEnable();
|
boolean isDecimalEnabledCard = SystemParamsOperation.getInstance().getDecimalEnable();
|
||||||
|
|
||||||
printString("CARD TYPE:" + pay.getAccountType());
|
printString("CARD TYPE:" + pay.getAccountType());
|
||||||
printString("CARD NO :" + PrintUtils.getInstance().maskCardNumberPciDss(pay.getCardNo()));
|
printString("CARD NO :" + PrintUtils.getInstance().maskCardNumberPciDss(pay.getCardNo()));
|
||||||
printString("TRACE NO :" + pay.getVoucherNo());
|
printString("TRACE NO :" + pay.getVoucherNo());
|
||||||
@ -887,12 +895,11 @@ public abstract class BaseXPrint {
|
|||||||
printString("DATE :" + POSUtil.getInstance().formatDisplayDate(pay.getTransDate()) + " " + pay.getTransTime());
|
printString("DATE :" + POSUtil.getInstance().formatDisplayDate(pay.getTransDate()) + " " + pay.getTransTime());
|
||||||
printString("TYPE :" + pay.getTransType().replace("_", " "));
|
printString("TYPE :" + pay.getTransType().replace("_", " "));
|
||||||
printString("AMOUNT :" +
|
printString("AMOUNT :" +
|
||||||
(isNeedMinusSign
|
(isNeedMinusSign
|
||||||
? "-" + PrintUtils.getInstance()
|
? "-" + PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabledCard)
|
||||||
.getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabledCard)
|
: PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabledCard))
|
||||||
: PrintUtils.getInstance()
|
+ " " + currency);
|
||||||
.getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabledCard))
|
|
||||||
+ " " + "MMK");
|
|
||||||
dotBreak();
|
dotBreak();
|
||||||
|
|
||||||
} else if (hostType == HostType.QR) {
|
} else if (hostType == HostType.QR) {
|
||||||
@ -900,64 +907,88 @@ public abstract class BaseXPrint {
|
|||||||
printString("TRANS ID:" + pay.getQrTransId());
|
printString("TRANS ID:" + pay.getQrTransId());
|
||||||
printString("STATUS :" + pay.getTC());
|
printString("STATUS :" + pay.getTC());
|
||||||
printString("SOURCE :" +
|
printString("SOURCE :" +
|
||||||
(pay.getTransactionType() == TransactionsType.MMQR_REFUND.value
|
(pay.getTransactionType() == TransactionsType.MMQR_REFUND.value
|
||||||
? "QR PAYMENT"
|
? "QR PAYMENT"
|
||||||
: pay.getCustomerMobile())
|
: pay.getCustomerMobile()));
|
||||||
);
|
|
||||||
// printString("TXN NAME:" + pay.getTransType().replace("_", " "));
|
|
||||||
printString("DATE :" + POSUtil.getInstance().formatDisplayDate(pay.getTransDate()) + " " + pay.getTransTime());
|
printString("DATE :" + POSUtil.getInstance().formatDisplayDate(pay.getTransDate()) + " " + pay.getTransTime());
|
||||||
printString("TRACE NO:" + pay.getVoucherNo());
|
printString("TRACE NO:" + pay.getVoucherNo());
|
||||||
|
|
||||||
if (pay.getTransactionType() == TransactionsType.MMQR_REFUND.value) {
|
if (pay.getTransactionType() == TransactionsType.MMQR_REFUND.value) {
|
||||||
printString("RRN :" + pay.getReferNo());
|
printString("RRN :" + pay.getReferNo());
|
||||||
}
|
}
|
||||||
|
|
||||||
printString("AMOUNT :" +
|
printString("AMOUNT :" +
|
||||||
(isNeedMinusSign
|
(isNeedMinusSign
|
||||||
? "-" + PrintUtils.getInstance()
|
? "-" + PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabledQr)
|
||||||
.getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabled)
|
: PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabledQr))
|
||||||
: PrintUtils.getInstance()
|
+ " " + currency);
|
||||||
.getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabled))
|
|
||||||
+ " " +"MMK");
|
|
||||||
dotBreak();
|
dotBreak();
|
||||||
|
|
||||||
// if (pay.getTransactionType() == TransactionsType.MMQR_REFUND.value) {
|
|
||||||
// print2ColumnsString("QR PAYMENT", "");
|
|
||||||
// } else {
|
|
||||||
// print2ColumnsString(pay.getCustomerMobile(), "");
|
|
||||||
// }
|
|
||||||
// print2ColumnsString(pay.getTransDate(), pay.getTransTime());
|
|
||||||
// print2ColumnsString(pay.getTransType().replace("_", " "), pay.getVoucherNo());
|
|
||||||
// if (pay.getTransactionType() == TransactionsType.MMQR_REFUND.value) {
|
|
||||||
// print2ColumnsString(pay.getReferNo() + "(RRN)", "");
|
|
||||||
// print2ColumnsString(isNeedMinusSign ? "-" + PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabled) : "" + PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabled), "");
|
|
||||||
// } else {
|
|
||||||
// print2ColumnsString(pay.getQrTransId(), "");
|
|
||||||
// print2ColumnsString(isNeedMinusSign ? "-" + PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabled) : "" + PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabled) , "");
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
emptyLine(1);
|
emptyLine(1);
|
||||||
|
|
||||||
|
// =============================
|
||||||
|
// ✅ ACCUMULATE TOTAL + COUNT PER CURRENCY
|
||||||
|
// =============================
|
||||||
|
CurrencySummary summary = currencyMap.getOrDefault(currency, new CurrencySummary());
|
||||||
|
|
||||||
if (isNeedMinusSign) {
|
if (isNeedMinusSign) {
|
||||||
totalAmount -= pay.getAmount();
|
summary.total -= pay.getAmount();
|
||||||
} else {
|
} else {
|
||||||
totalAmount += pay.getAmount();
|
summary.total += pay.getAmount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
summary.count++; // ✅ count per currency
|
||||||
|
|
||||||
|
currencyMap.put(currency, summary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// =============================
|
||||||
|
// PRINT SUMMARY
|
||||||
|
// =============================
|
||||||
if (hostType == HostType.MPU || hostType == HostType.VISA_MASTER) {
|
if (hostType == HostType.MPU || hostType == HostType.VISA_MASTER) {
|
||||||
|
|
||||||
boolean isDecimalEnabled = SystemParamsOperation.getInstance().getDecimalEnable();
|
boolean isDecimalEnabled = SystemParamsOperation.getInstance().getDecimalEnable();
|
||||||
|
|
||||||
print2ColumnsString("CARD", "");
|
print2ColumnsString("CARD", "");
|
||||||
print3ColumnsString("TYPE ", "COUNT", "AMOUNT");
|
print3ColumnsString("TYPE ", "COUNT", "AMOUNT");
|
||||||
print3ColumnsString("CARD", " " + countStringFormat(lists.size()), "MMK " + PrintUtils.getInstance().getSeparatorNumberFormat(totalAmount, isDecimalEnabled), true);
|
|
||||||
|
for (Map.Entry<String, CurrencySummary> entry : currencyMap.entrySet()) {
|
||||||
|
|
||||||
|
String currency = entry.getKey();
|
||||||
|
CurrencySummary summary = entry.getValue();
|
||||||
|
|
||||||
|
print3ColumnsString(
|
||||||
|
"CARD",
|
||||||
|
" " + countStringFormat(summary.count),
|
||||||
|
currency + " " + PrintUtils.getInstance()
|
||||||
|
.getSeparatorNumberFormat(summary.total, isDecimalEnabled),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (hostType == HostType.QR) {
|
} else if (hostType == HostType.QR) {
|
||||||
|
|
||||||
boolean isDecimalEnabled = SystemParamsOperation.getInstance().isQrDecimalEnable();
|
boolean isDecimalEnabled = SystemParamsOperation.getInstance().isQrDecimalEnable();
|
||||||
|
|
||||||
print2ColumnsString("PAYMENT", "");
|
print2ColumnsString("PAYMENT", "");
|
||||||
print3ColumnsString("TYPE ", "COUNT", "AMOUNT");
|
print3ColumnsString("TYPE ", "COUNT", "AMOUNT");
|
||||||
// emptyLine(1);
|
|
||||||
print3ColumnsString("QR PAY", " "+ countStringFormat(lists.size()), "MMK " + PrintUtils.getInstance().getSeparatorNumberFormat(totalAmount, isDecimalEnabled), true);
|
for (Map.Entry<String, CurrencySummary> entry : currencyMap.entrySet()) {
|
||||||
|
|
||||||
|
String currency = entry.getKey();
|
||||||
|
CurrencySummary summary = entry.getValue();
|
||||||
|
|
||||||
|
print3ColumnsString(
|
||||||
|
"QR PAY",
|
||||||
|
" " + countStringFormat(summary.count),
|
||||||
|
currency + " " + PrintUtils.getInstance()
|
||||||
|
.getSeparatorNumberFormat(summary.total, isDecimalEnabled),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// emptyLine(2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void printQRSettlementTransDetail(List<QRSettleData> lists) {
|
protected void printQRSettlementTransDetail(List<QRSettleData> lists) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user