added grand total for both currencies at settlement print
This commit is contained in:
parent
997aa33d98
commit
81eaa80299
@ -13,39 +13,6 @@
|
||||
</DropdownSelection>
|
||||
<DialogSelection />
|
||||
</SelectionState>
|
||||
<SelectionState runConfigName="unitTest">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2026-01-20T10:19:44.274945Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=0123456789ABCDEF" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
<DialogSelection />
|
||||
</SelectionState>
|
||||
<SelectionState runConfigName="androidTest">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2026-01-20T10:19:44.274945Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=0123456789ABCDEF" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
<DialogSelection />
|
||||
</SelectionState>
|
||||
<SelectionState runConfigName="main">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2026-01-20T10:19:44.274945Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=0123456789ABCDEF" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
<DialogSelection />
|
||||
</SelectionState>
|
||||
</selectionStates>
|
||||
</component>
|
||||
</project>
|
||||
@ -212,6 +212,9 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
|
||||
caCount = payDetail.getSettleDataObj().getCashAdvanceCount();
|
||||
caAmount = payDetail.getSettleDataObj().getCashAdvanceAmount();
|
||||
|
||||
voidCount = payDetail.getSettleDataObj().getVoidSaleCount();
|
||||
voidAmount = payDetail.getSettleDataObj().getVoidSaleAmount();
|
||||
|
||||
applyStoredCurrencyBreakdown(payDetail);
|
||||
|
||||
settlementViewModel.isNoData.setValue(false);
|
||||
@ -294,6 +297,7 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
|
||||
|
||||
setSettlementViewModelData(saleCount,saleAmount,preCount,preAmount,refundCount,refundAmount,caCount,caAmount);
|
||||
settlementViewModel.setPayDetails(payDetails);
|
||||
applyDeleteTransToUi(settlementViewModel.deleteTrans);
|
||||
|
||||
|
||||
} else {
|
||||
@ -302,6 +306,7 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
|
||||
sharedViewModel.setAmount(POSUtil.getInstance().getDecimalAmountSeparatorFormat(0));
|
||||
|
||||
setSettlementViewModelData(saleCount,saleAmount,preCount,preAmount,refundCount,refundAmount,caCount,caAmount);
|
||||
applyDeleteTransToUi(settlementViewModel.deleteTrans);
|
||||
}
|
||||
});
|
||||
|
||||
@ -348,22 +353,83 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
|
||||
@Override
|
||||
public void onChanged(List<PayDetail> payDetails) {
|
||||
settlementViewModel.deleteTrans.clear();
|
||||
voidCount = 0;
|
||||
voidAmount = 0L;
|
||||
if(payDetails != null) {
|
||||
if (payDetails != null) {
|
||||
settlementViewModel.deleteTrans.addAll(payDetails);
|
||||
for (PayDetail pay : payDetails) {
|
||||
if (pay.getTransactionType() == TransactionType.VOID && !pay.isCanceled) {
|
||||
voidCount++;
|
||||
voidAmount += pay.getAmount();
|
||||
}
|
||||
}
|
||||
if (voidCount > 0 && Boolean.TRUE.equals(settlementViewModel.isNoData.getValue())) {
|
||||
settlementViewModel.isNoData.setValue(false);
|
||||
}
|
||||
applyDeleteTransToUi(settlementViewModel.deleteTrans);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void applyDeleteTransToUi(List<PayDetail> deleteList) {
|
||||
voidCount = 0;
|
||||
voidAmount = 0L;
|
||||
mmkBucket.voidCount = 0;
|
||||
mmkBucket.voidAmount = 0L;
|
||||
usdBucket.voidCount = 0;
|
||||
usdBucket.voidAmount = 0L;
|
||||
|
||||
int canceledSaleCount = 0;
|
||||
long canceledSaleAmount = 0L;
|
||||
int canceledMmkCount = 0;
|
||||
long canceledMmkAmount = 0L;
|
||||
int canceledUsdCount = 0;
|
||||
long canceledUsdAmount = 0L;
|
||||
|
||||
if (deleteList != null) {
|
||||
for (PayDetail pay : deleteList) {
|
||||
if (pay.getTransactionType() == TransactionType.VOID && !pay.isCanceled) {
|
||||
voidCount++;
|
||||
voidAmount += pay.getAmount();
|
||||
CurrencyBucket bucket = getCurrencyBucket(pay.getCurrencyCode());
|
||||
bucket.voidCount++;
|
||||
bucket.voidAmount += pay.getAmount();
|
||||
} else if (pay.getTransactionType() == TransactionType.SALE && pay.isCanceled) {
|
||||
canceledSaleCount++;
|
||||
canceledSaleAmount += pay.getAmount();
|
||||
if ("USD".equals(normalizeCurrency(pay.getCurrencyCode()))) {
|
||||
canceledUsdCount++;
|
||||
canceledUsdAmount += pay.getAmount();
|
||||
} else {
|
||||
canceledMmkCount++;
|
||||
canceledMmkAmount += pay.getAmount();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
settlementViewModel.sale_count.setValue(saleCount + canceledSaleCount);
|
||||
settlementViewModel.sale_amount.setValue(saleAmount + canceledSaleAmount);
|
||||
settlementViewModel.sale_breakdown.setValue(buildBreakdownText(
|
||||
mmkBucket.saleCount + canceledMmkCount,
|
||||
mmkBucket.saleAmount + canceledMmkAmount,
|
||||
usdBucket.saleCount + canceledUsdCount,
|
||||
usdBucket.saleAmount + canceledUsdAmount));
|
||||
|
||||
settlementViewModel.void_count.setValue(voidCount);
|
||||
settlementViewModel.void_amount.setValue(voidAmount);
|
||||
settlementViewModel.void_breakdown.setValue(buildVoidBreakdownText(
|
||||
mmkBucket.voidCount, mmkBucket.voidAmount,
|
||||
usdBucket.voidCount, usdBucket.voidAmount));
|
||||
|
||||
if (sharedViewModel.getTransMenu().getValue() == TransMenu.REVIEW_BATCH) {
|
||||
SettleData settleData = new SettleData(
|
||||
saleCount + canceledSaleCount,
|
||||
saleAmount + canceledSaleAmount,
|
||||
preCount, preAmount, refundCount, refundAmount, caCount, caAmount);
|
||||
settleData.setVoidSaleCount(voidCount);
|
||||
settleData.setVoidSaleAmount(voidAmount);
|
||||
TradeData tradeData = Params.newTrade(false);
|
||||
PayDetail payDetail = tradeData.getPayDetail();
|
||||
payDetail.setSettleDataObj(settleData);
|
||||
payDetail.setTransactionType(TransactionsType.BATCH_TOTAL.value);
|
||||
payDetail.setTransType(TransactionsType.BATCH_TOTAL.name);
|
||||
sharedViewModel.payDetail.setValue(payDetail);
|
||||
}
|
||||
|
||||
if (voidCount > 0 && Boolean.TRUE.equals(settlementViewModel.isNoData.getValue())) {
|
||||
settlementViewModel.isNoData.setValue(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void resetSettlementCounters() {
|
||||
@ -384,6 +450,8 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
|
||||
private void setSettlementViewModelData(int saleCount,long saleAmount,int preCount,long preAmount,int refundCount,long refundAmount,int caCount,long caAmount) {
|
||||
settlementViewModel.sale_count.setValue(saleCount);
|
||||
settlementViewModel.sale_amount.setValue(saleAmount);
|
||||
settlementViewModel.void_count.setValue(voidCount);
|
||||
settlementViewModel.void_amount.setValue(voidAmount);
|
||||
settlementViewModel.pre_count.setValue(preCount);
|
||||
settlementViewModel.pre_amount.setValue(preAmount);
|
||||
settlementViewModel.refund_count.setValue(refundCount);
|
||||
@ -391,11 +459,14 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
|
||||
settlementViewModel.ca_count.setValue(caCount);
|
||||
settlementViewModel.ca_amount.setValue(caAmount);
|
||||
settlementViewModel.sale_breakdown.setValue(buildBreakdownText(mmkBucket.saleCount, mmkBucket.saleAmount, usdBucket.saleCount, usdBucket.saleAmount));
|
||||
settlementViewModel.void_breakdown.setValue(buildVoidBreakdownText(mmkBucket.voidCount, mmkBucket.voidAmount, usdBucket.voidCount, usdBucket.voidAmount));
|
||||
settlementViewModel.pre_breakdown.setValue(buildBreakdownText(mmkBucket.preCount, mmkBucket.preAmount, usdBucket.preCount, usdBucket.preAmount));
|
||||
settlementViewModel.refund_breakdown.setValue(buildBreakdownText(mmkBucket.refundCount, mmkBucket.refundAmount, usdBucket.refundCount, usdBucket.refundAmount));
|
||||
settlementViewModel.ca_breakdown.setValue(buildBreakdownText(mmkBucket.caCount, mmkBucket.caAmount, usdBucket.caCount, usdBucket.caAmount));
|
||||
if(sharedViewModel.getTransMenu().getValue() == TransMenu.REVIEW_BATCH) {
|
||||
SettleData settleData = new SettleData(saleCount,saleAmount,preCount,preAmount,refundCount,refundAmount,caCount,caAmount);
|
||||
settleData.setVoidSaleCount(voidCount);
|
||||
settleData.setVoidSaleAmount(voidAmount);
|
||||
TradeData tradeData = Params.newTrade(false);
|
||||
PayDetail payDetail = tradeData.getPayDetail();
|
||||
payDetail.setSettleDataObj(settleData);
|
||||
@ -418,6 +489,8 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
|
||||
private void resetCurrencyBucket(CurrencyBucket bucket) {
|
||||
bucket.saleCount = 0;
|
||||
bucket.saleAmount = 0L;
|
||||
bucket.voidCount = 0;
|
||||
bucket.voidAmount = 0L;
|
||||
bucket.preCount = 0;
|
||||
bucket.preAmount = 0L;
|
||||
bucket.refundCount = 0;
|
||||
@ -454,6 +527,11 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
|
||||
+ " USD " + usdCount + " / " + POSUtil.getInstance().getDecimalAmountSeparatorFormat(usdAmount);
|
||||
}
|
||||
|
||||
private String buildVoidBreakdownText(int mmkCount, long mmkAmount, int usdCount, long usdAmount) {
|
||||
return "MMK " + mmkCount + " / - " + POSUtil.getInstance().getDecimalAmountSeparatorFormat(mmkAmount)
|
||||
+ " USD " + usdCount + " / - " + POSUtil.getInstance().getDecimalAmountSeparatorFormat(usdAmount);
|
||||
}
|
||||
|
||||
private CurrencyBucket getCurrencyBucket(String currencyCode) {
|
||||
return "USD".equals(normalizeCurrency(currencyCode)) ? usdBucket : mmkBucket;
|
||||
}
|
||||
@ -474,6 +552,8 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
|
||||
CurrencyBucket bucket = "USD".equals(normalizedCurrency) ? usdBucket : mmkBucket;
|
||||
bucket.saleCount = saleCount;
|
||||
bucket.saleAmount = saleAmount;
|
||||
bucket.voidCount = voidCount;
|
||||
bucket.voidAmount = voidAmount;
|
||||
bucket.preCount = preCount;
|
||||
bucket.preAmount = preAmount;
|
||||
bucket.refundCount = refundCount;
|
||||
@ -489,6 +569,9 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
|
||||
if ("SALE".equals(transType)) {
|
||||
bucket.saleCount++;
|
||||
bucket.saleAmount += item.getAmount();
|
||||
} else if ("VOID SALE".equals(transType) || "VOID_SALE".equals(transType)) {
|
||||
bucket.voidCount++;
|
||||
bucket.voidAmount += item.getAmount();
|
||||
} else if ("PREAUTH COMPLETION".equals(transType) || "PRE_AUTH_COMPLETE".equals(transType)) {
|
||||
bucket.preCount++;
|
||||
bucket.preAmount += item.getAmount();
|
||||
@ -619,8 +702,19 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
|
||||
private void updateData() {
|
||||
PayDetail payDetail = settlementViewModel.getPayDetail();
|
||||
|
||||
List<PayDetail> cardSettleSource = new ArrayList<>();
|
||||
if (cardTransactionsList != null && !cardTransactionsList.isEmpty()) {
|
||||
payDetail.setCardSettleData(CardSettleData.convertFromPayDetail(cardTransactionsList));
|
||||
cardSettleSource.addAll(cardTransactionsList);
|
||||
}
|
||||
for (PayDetail pay : settlementViewModel.deleteTrans) {
|
||||
if (pay.getTransactionType() == TransactionType.VOID && !pay.isCanceled) {
|
||||
cardSettleSource.add(pay);
|
||||
} else if (pay.getTransactionType() == TransactionType.SALE && pay.isCanceled) {
|
||||
cardSettleSource.add(pay);
|
||||
}
|
||||
}
|
||||
if (!cardSettleSource.isEmpty()) {
|
||||
payDetail.setCardSettleData(CardSettleData.convertFromPayDetail(cardSettleSource));
|
||||
}
|
||||
|
||||
if (qrTransactionsList != null && !qrTransactionsList.isEmpty()) {
|
||||
|
||||
@ -135,6 +135,9 @@ public class SettlementViewModel extends ViewModel {
|
||||
sale_count.setValue(0);
|
||||
sale_amount.setValue(0L);
|
||||
sale_breakdown.setValue("");
|
||||
void_count.setValue(0);
|
||||
void_amount.setValue(0L);
|
||||
void_breakdown.setValue("");
|
||||
pre_count.setValue(0);
|
||||
pre_amount.setValue(0L);
|
||||
pre_breakdown.setValue("");
|
||||
|
||||
@ -3,6 +3,8 @@ package com.utsmm.kbz.ui.settlement.model;
|
||||
public class CurrencyBucket {
|
||||
public int saleCount;
|
||||
public long saleAmount;
|
||||
public int voidCount;
|
||||
public long voidAmount;
|
||||
public int preCount;
|
||||
public long preAmount;
|
||||
public int refundCount;
|
||||
@ -31,6 +33,14 @@ public class CurrencyBucket {
|
||||
this.saleAmount = saleAmount;
|
||||
}
|
||||
|
||||
public void setVoidCount(int voidCount) {
|
||||
this.voidCount = voidCount;
|
||||
}
|
||||
|
||||
public void setVoidAmount(long voidAmount) {
|
||||
this.voidAmount = voidAmount;
|
||||
}
|
||||
|
||||
public void setPreCount(int preCount) {
|
||||
this.preCount = preCount;
|
||||
}
|
||||
@ -63,6 +73,14 @@ public class CurrencyBucket {
|
||||
return saleAmount;
|
||||
}
|
||||
|
||||
public int getVoidCount() {
|
||||
return voidCount;
|
||||
}
|
||||
|
||||
public long getVoidAmount() {
|
||||
return voidAmount;
|
||||
}
|
||||
|
||||
public int getPreCount() {
|
||||
return preCount;
|
||||
}
|
||||
|
||||
@ -127,6 +127,69 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/colorLightGray"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="19dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/rubik_regular"
|
||||
android:text="@string/txt_subtitle_void"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/rubik_regular"
|
||||
android:text="@={settleViewModel.void_count+``}"
|
||||
tools:text="1"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/rubik_regular"
|
||||
android:text="@{`- ` + POSUtil.getInstance().getDecimalAmountSeparatorFormat(settleViewModel.void_amount)}"
|
||||
tools:text="- 500.00"
|
||||
android:textAlignment="textEnd"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:fontFamily="@font/rubik_regular"
|
||||
android:text="@{settleViewModel.void_breakdown}"
|
||||
android:textColor="@color/colorTextContent"
|
||||
android:textSize="12sp"
|
||||
tools:text="MMK 1 / - 500.00 USD 0 / - 0.00" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@ -24,7 +24,7 @@ public final class TerminalKeyUtil {
|
||||
|
||||
// private static final byte[] main_key_data = ByteUtil.hexStr2Bytes("B4D74774CC846CAFF6D1AAAC2EB79CFF".toUpperCase()); // KBZ UAT
|
||||
// private static final byte[] main_key_usd_data = ByteUtil.hexStr2Bytes("3f4bcac6cc559ab12bbbc5a51118f3f5".toUpperCase()); // KBZ UAT
|
||||
private static final byte[] main_key_data = ByteUtil.hexStr2Bytes("3F4BCAC6CC559AB12BBBC5A51118F3F5".toUpperCase());
|
||||
private static final byte[] main_key_data = ByteUtil.hexStr2Bytes("b4d74774cc846caff6d1aaac2eb79cff".toUpperCase());
|
||||
// private static final byte[] main_key_data = ByteUtil.hexStr2Bytes("e121249099a677e8b7d4f6a9d49fe8d1".toUpperCase()); // MPU
|
||||
private static final byte[] work_key_data = new byte[16];
|
||||
public static void initNexKey() {
|
||||
@ -50,7 +50,7 @@ public final class TerminalKeyUtil {
|
||||
// int result = pinPad.dukptKeyInject(9, DukptKeyTypeEnum.IPEK,IPEKByte,16,KSNByte);
|
||||
// int result = pinPad.dukptKeyInject(9, DukptKeyTypeEnum.BDK,IPEKByte,16,ksn);
|
||||
|
||||
// LogUtil.d(TAG, "save tmk key result: "+result);
|
||||
LogUtil.d(TAG, "save tmk key result: "+result);
|
||||
// LogUtil.d(TAG, "save tmk kcv: "+ByteUtil.bytes2HexStr(kcv));
|
||||
|
||||
// byte[] encryptedPIK = SystemParamsOperation.getInstance().getKeyPIK().get(0);
|
||||
|
||||
@ -265,57 +265,25 @@ public abstract class BaseXPrint {
|
||||
|
||||
dotBreak();
|
||||
|
||||
boolean isDuelCurrency = SystemParamsOperation.getInstance().getDuelCurrencyStatus();
|
||||
|
||||
printer.appendPrnStr("GRAND TOTAL", fontLarge, AlignEnum.LEFT, true);
|
||||
emptyLine(1);
|
||||
|
||||
if (isDuelCurrency) {
|
||||
Map<String, CurrencySettlementSummary> currencyMap = buildCurrencySummaries(cardSettleDataList);
|
||||
if (currencyMap.size() > 1) {
|
||||
for (Map.Entry<String, CurrencySettlementSummary> entry : currencyMap.entrySet()) {
|
||||
printSettlementCurrencySection(entry.getKey(), entry.getValue());
|
||||
}
|
||||
dotBreak();
|
||||
} else {
|
||||
printSingleSettleSummary(cardSettleDataList, isDecimalEnabled);
|
||||
}
|
||||
} else {
|
||||
printSingleSettleSummary(cardSettleDataList, isDecimalEnabled);
|
||||
Map<String, CurrencySettlementSummary> currencyMap = buildCurrencySummaries(cardSettleDataList);
|
||||
for (Map.Entry<String, CurrencySettlementSummary> entry : orderedCurrencySummaries(currencyMap)) {
|
||||
printSettlementCurrencySection(entry.getKey(), entry.getValue());
|
||||
}
|
||||
emptyLine(1);
|
||||
}
|
||||
|
||||
private void printSingleSettleSummary(List<CardSettleData> cardSettleDataList, boolean isDecimalEnabled) {
|
||||
Map<String, CurrencySettlementSummary> currencyMap = buildCurrencySummaries(cardSettleDataList);
|
||||
SystemParamsOperation sp = SystemParamsOperation.getInstance();
|
||||
if (currencyMap.size() == 1) {
|
||||
Map.Entry<String, CurrencySettlementSummary> entry = currencyMap.entrySet().iterator().next();
|
||||
printSettlementCurrencySection(entry.getKey(), entry.getValue());
|
||||
} else {
|
||||
SettleData settleData = new SettleData();
|
||||
for (CardSettleData csd : cardSettleDataList) {
|
||||
applyCardSettlementSummary(settleData, csd);
|
||||
}
|
||||
print3ColumnsString("TRX TYPE ", "CNT", "AMOUNT");
|
||||
print3ColumnsString("SALE ", countStringFormat(settleData.getSaleCount()), PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getSaleAmount(), isDecimalEnabled));
|
||||
if(sp.getVoidStatus()){
|
||||
print3ColumnsString("VOID SALE ", countStringFormat(settleData.getVoidSaleCount()), "- " + PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getVoidSaleAmount(), isDecimalEnabled));
|
||||
}
|
||||
if(sp.getPreAuthStatus()){
|
||||
print3ColumnsString("PREAUTH COMP ", countStringFormat(settleData.getPreAuthCompCount()), PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getPreAuthCompAmount(), isDecimalEnabled));
|
||||
}
|
||||
if(sp.getCashAdvanceStatus()){
|
||||
print3ColumnsString("CASH ADV ", countStringFormat(settleData.getCashAdvanceCount()), PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getCashAdvanceAmount(), isDecimalEnabled));
|
||||
}
|
||||
if(sp.getRefundStatus()){
|
||||
print3ColumnsString("REFUND ", countStringFormat(settleData.getRefundCount()), "- " + PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getRefundAmount(), isDecimalEnabled));
|
||||
}
|
||||
dotBreak();
|
||||
long totalAmount = settleData.getSaleAmount() + settleData.getPreAuthCompAmount() + settleData.getCashAdvanceAmount()
|
||||
- settleData.getVoidSaleAmount() - settleData.getRefundAmount();
|
||||
print2ColumnsString("TOTAL", PrintUtils.getInstance().getSeparatorNumberFormat(totalAmount, isDecimalEnabled));
|
||||
}
|
||||
private List<Map.Entry<String, CurrencySettlementSummary>> orderedCurrencySummaries(
|
||||
Map<String, CurrencySettlementSummary> currencyMap) {
|
||||
List<Map.Entry<String, CurrencySettlementSummary>> entries = new ArrayList<>(currencyMap.entrySet());
|
||||
entries.sort((left, right) -> {
|
||||
int leftOrder = "MMK".equals(left.getKey()) ? 0 : ("USD".equals(left.getKey()) ? 1 : 2);
|
||||
int rightOrder = "MMK".equals(right.getKey()) ? 0 : ("USD".equals(right.getKey()) ? 1 : 2);
|
||||
return Integer.compare(leftOrder, rightOrder);
|
||||
});
|
||||
return entries;
|
||||
}
|
||||
|
||||
private Map<String, CurrencySettlementSummary> buildCurrencySummaries(List<CardSettleData> cardSettleDataList) {
|
||||
@ -332,25 +300,6 @@ public abstract class BaseXPrint {
|
||||
return currencyMap;
|
||||
}
|
||||
|
||||
private void applyCardSettlementSummary(SettleData settleData, CardSettleData cardSettleData) {
|
||||
String transType = cardSettleData.getTransType() == null ? "" : cardSettleData.getTransType().trim().toUpperCase(Locale.getDefault());
|
||||
long amount = cardSettleData.getAmount();
|
||||
|
||||
if ("SALE".equals(transType)) {
|
||||
settleData.setSaleCount(settleData.getSaleCount() + 1);
|
||||
settleData.setSaleAmount(settleData.getSaleAmount() + amount);
|
||||
} else if ("PREAUTH COMPLETION".equals(transType) || "PRE_AUTH_COMPLETE".equals(transType)) {
|
||||
settleData.setPreAuthCompCount(settleData.getPreAuthCompCount() + 1);
|
||||
settleData.setPreAuthCompAmount(settleData.getPreAuthCompAmount() + amount);
|
||||
} else if ("REFUND".equals(transType)) {
|
||||
settleData.setRefundCount(settleData.getRefundCount() + 1);
|
||||
settleData.setRefundAmount(settleData.getRefundAmount() + amount);
|
||||
} else if ("CASH_OUT".equals(transType) || "CASH_ADVANCE".equals(transType)) {
|
||||
settleData.setCashAdvanceCount(settleData.getCashAdvanceCount() + 1);
|
||||
settleData.setCashAdvanceAmount(settleData.getCashAdvanceAmount() + amount);
|
||||
}
|
||||
}
|
||||
|
||||
protected void printMMQRReport(List<QRSettleData> qrList) {
|
||||
if (qrList == null || qrList.isEmpty()) return;
|
||||
|
||||
@ -395,30 +344,35 @@ public abstract class BaseXPrint {
|
||||
}
|
||||
|
||||
private void printSettlementCurrencySection(String currencyLabel, CurrencySettlementSummary summary) {
|
||||
// if (!summary.hasAnyValue()) {
|
||||
// return;
|
||||
// }
|
||||
boolean isDecimalEnabled = SystemParamsOperation.getInstance().getDecimalEnable();
|
||||
SystemParamsOperation sp = SystemParamsOperation.getInstance();
|
||||
|
||||
int totalCount = summary.saleCount + summary.preAuthCompCount + summary.refundCount + summary.cashAdvanceCount;
|
||||
long totalAmount = summary.saleAmount + summary.preAuthCompAmount + summary.cashAdvanceAmount - summary.refundAmount;
|
||||
long totalAmount = summary.saleAmount + summary.preAuthCompAmount + summary.cashAdvanceAmount
|
||||
- summary.voidSaleAmount - summary.refundAmount;
|
||||
|
||||
emptyLine(1);
|
||||
printString("CURRENCY : " + currencyLabel, true);
|
||||
print3ColumnsString("TRX TYPE ", "CNT", "AMOUNT");
|
||||
print3ColumnsString("SALE ", countStringFormat(summary.saleCount), PrintUtils.getInstance().getSeparatorNumberFormat(summary.saleAmount, isDecimalEnabled));
|
||||
if(sp.getPreAuthStatus()){
|
||||
print3ColumnsString("PREAUTH COMP ", countStringFormat(summary.preAuthCompCount), PrintUtils.getInstance().getSeparatorNumberFormat(summary.preAuthCompAmount, isDecimalEnabled));
|
||||
printString("Currency = '" + currencyLabel + "'", true);
|
||||
print3ColumnsString("TXN Type ", "CNT", "AMOUNT");
|
||||
print3ColumnsString("SALE ", countStringFormat(summary.saleCount),
|
||||
PrintUtils.getInstance().getSeparatorNumberFormat(summary.saleAmount, isDecimalEnabled));
|
||||
if (sp.getVoidStatus()) {
|
||||
print3ColumnsString("VOID SALE ", countStringFormat(summary.voidSaleCount),
|
||||
"- " + PrintUtils.getInstance().getSeparatorNumberFormat(summary.voidSaleAmount, isDecimalEnabled));
|
||||
}
|
||||
if (summary.cashAdvanceCount != 0) {
|
||||
if(sp.getCashAdvanceStatus()){
|
||||
print3ColumnsString("CASH ADV ", countStringFormat(summary.cashAdvanceCount), PrintUtils.getInstance().getSeparatorNumberFormat(summary.cashAdvanceAmount, isDecimalEnabled));
|
||||
}
|
||||
if (sp.getPreAuthStatus()) {
|
||||
print3ColumnsString("PREAUTH COMP ", countStringFormat(summary.preAuthCompCount),
|
||||
PrintUtils.getInstance().getSeparatorNumberFormat(summary.preAuthCompAmount, isDecimalEnabled));
|
||||
}
|
||||
if(sp.getRefundStatus()){
|
||||
print3ColumnsString("REFUND ", countStringFormat(summary.refundCount), "- " + PrintUtils.getInstance().getSeparatorNumberFormat(summary.refundAmount, isDecimalEnabled));
|
||||
if (sp.getCashAdvanceStatus()) {
|
||||
print3ColumnsString("CASH ADV ", countStringFormat(summary.cashAdvanceCount),
|
||||
PrintUtils.getInstance().getSeparatorNumberFormat(summary.cashAdvanceAmount, isDecimalEnabled));
|
||||
}
|
||||
print3ColumnsString("TOTAL(" + currencyLabel + ") ", countStringFormat(totalCount), PrintUtils.getInstance().getSeparatorNumberFormat(totalAmount, isDecimalEnabled));
|
||||
if (sp.getRefundStatus()) {
|
||||
print3ColumnsString("REFUND ", countStringFormat(summary.refundCount),
|
||||
"- " + PrintUtils.getInstance().getSeparatorNumberFormat(summary.refundAmount, isDecimalEnabled));
|
||||
}
|
||||
dotBreak();
|
||||
print2ColumnsString("TOTAL", PrintUtils.getInstance().getSeparatorNumberFormat(totalAmount, isDecimalEnabled));
|
||||
}
|
||||
|
||||
private void applyCardSettlementSummary(CurrencySettlementSummary summary, CardSettleData cardSettleData) {
|
||||
@ -428,6 +382,9 @@ public abstract class BaseXPrint {
|
||||
if ("SALE".equals(transType)) {
|
||||
summary.saleCount++;
|
||||
summary.saleAmount += amount;
|
||||
} else if ("VOID SALE".equals(transType) || "VOID_SALE".equals(transType)) {
|
||||
summary.voidSaleCount++;
|
||||
summary.voidSaleAmount += amount;
|
||||
} else if ("PREAUTH COMPLETION".equals(transType) || "PRE_AUTH_COMPLETE".equals(transType)) {
|
||||
summary.preAuthCompCount++;
|
||||
summary.preAuthCompAmount += amount;
|
||||
@ -455,6 +412,8 @@ public abstract class BaseXPrint {
|
||||
private static class CurrencySettlementSummary {
|
||||
int saleCount;
|
||||
long saleAmount;
|
||||
int voidSaleCount;
|
||||
long voidSaleAmount;
|
||||
int preAuthCompCount;
|
||||
long preAuthCompAmount;
|
||||
int refundCount;
|
||||
@ -463,8 +422,8 @@ public abstract class BaseXPrint {
|
||||
long cashAdvanceAmount;
|
||||
|
||||
boolean hasAnyValue() {
|
||||
return saleCount > 0 || preAuthCompCount > 0 || refundCount > 0 || cashAdvanceCount > 0
|
||||
|| saleAmount > 0 || preAuthCompAmount > 0 || refundAmount > 0 || cashAdvanceAmount > 0;
|
||||
return saleCount > 0 || voidSaleCount > 0 || preAuthCompCount > 0 || refundCount > 0 || cashAdvanceCount > 0
|
||||
|| saleAmount > 0 || voidSaleAmount > 0 || preAuthCompAmount > 0 || refundAmount > 0 || cashAdvanceAmount > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user