Compare commits

..

No commits in common. "88a5d064b56bae3a9db3657c9d10b452032d47a0" and "ddd64fb48d2a1d39cfd7039aad4c4b72aa68a631" have entirely different histories.

2 changed files with 54 additions and 114 deletions

View File

@ -77,35 +77,6 @@
tools:text="000045" />
</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 -->
<LinearLayout

View File

@ -45,7 +45,6 @@ import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
@ -857,37 +856,30 @@ public abstract class BaseXPrint {
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) {
// Summary holder (total + count per currency)
class CurrencySummary {
long total = 0;
int count = 0;
if (hostType == HostType.MPU || hostType == HostType.VISA_MASTER) {
// Use the same line-by-line style as QR detail report
} else if (hostType == HostType.QR) {
// 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) {
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) {
boolean isDecimalEnabledCard = SystemParamsOperation.getInstance().getDecimalEnable();
printString("CARD TYPE:" + pay.getAccountType());
printString("CARD NO :" + PrintUtils.getInstance().maskCardNumberPciDss(pay.getCardNo()));
printString("TRACE NO :" + pay.getVoucherNo());
@ -896,10 +888,11 @@ public abstract class BaseXPrint {
printString("TYPE :" + pay.getTransType().replace("_", " "));
printString("AMOUNT :" +
(isNeedMinusSign
? "-" + PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabledCard)
: PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabledCard))
+ " " + currency);
? "-" + PrintUtils.getInstance()
.getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabledCard)
: PrintUtils.getInstance()
.getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabledCard))
+ " " + "MMK");
dotBreak();
} else if (hostType == HostType.QR) {
@ -909,86 +902,62 @@ public abstract class BaseXPrint {
printString("SOURCE :" +
(pay.getTransactionType() == TransactionsType.MMQR_REFUND.value
? "QR PAYMENT"
: pay.getCustomerMobile()));
: pay.getCustomerMobile())
);
// printString("TXN NAME:" + pay.getTransType().replace("_", " "));
printString("DATE :" + POSUtil.getInstance().formatDisplayDate(pay.getTransDate()) + " " + pay.getTransTime());
printString("TRACE NO:" + pay.getVoucherNo());
if (pay.getTransactionType() == TransactionsType.MMQR_REFUND.value) {
printString("RRN :" + pay.getReferNo());
}
printString("AMOUNT :" +
(isNeedMinusSign
? "-" + PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabledQr)
: PrintUtils.getInstance().getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabledQr))
+ " " + currency);
? "-" + PrintUtils.getInstance()
.getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabled)
: PrintUtils.getInstance()
.getSeparatorNumberFormat(pay.getAmount(), isDecimalEnabled))
+ " " +"MMK");
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);
// =============================
// ACCUMULATE TOTAL + COUNT PER CURRENCY
// =============================
CurrencySummary summary = currencyMap.getOrDefault(currency, new CurrencySummary());
if (isNeedMinusSign) {
summary.total -= pay.getAmount();
totalAmount -= pay.getAmount();
} else {
summary.total += pay.getAmount();
totalAmount += pay.getAmount();
}
}
summary.count++; // count per currency
currencyMap.put(currency, summary);
}
// =============================
// PRINT SUMMARY
// =============================
if (hostType == HostType.MPU || hostType == HostType.VISA_MASTER) {
boolean isDecimalEnabled = SystemParamsOperation.getInstance().getDecimalEnable();
print2ColumnsString("CARD", "");
print3ColumnsString("TYPE ", "COUNT", "AMOUNT");
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
);
}
print3ColumnsString("CARD", " " + countStringFormat(lists.size()), "MMK " + PrintUtils.getInstance().getSeparatorNumberFormat(totalAmount, isDecimalEnabled), true);
} else if (hostType == HostType.QR) {
boolean isDecimalEnabled = SystemParamsOperation.getInstance().isQrDecimalEnable();
print2ColumnsString("PAYMENT", "");
print3ColumnsString("TYPE ", "COUNT", "AMOUNT");
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(1);
print3ColumnsString("QR PAY", " "+ countStringFormat(lists.size()), "MMK " + PrintUtils.getInstance().getSeparatorNumberFormat(totalAmount, isDecimalEnabled), true);
}
// emptyLine(2);
}
protected void printQRSettlementTransDetail(List<QRSettleData> lists) {