printer disable in reprint settlement

This commit is contained in:
moon 2026-03-20 12:07:13 +06:30
parent 95d50ec3a7
commit 49e787a56c
5 changed files with 18 additions and 3 deletions

View File

@ -53,6 +53,7 @@ public class ManagementFunctionFragment extends DataBindingFragment {
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
sharedViewModel.printerDisabled.setValue(!SystemParamsOperation.getInstance().getPrinterEnabled());
setToolBarTitleWithBackIcon(getString(R.string.title_select_function)); setToolBarTitleWithBackIcon(getString(R.string.title_select_function));
} }

View File

@ -86,6 +86,7 @@ public class QRSettlementTransactionFragment extends DataBindingFragment impleme
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
sharedViewModel.printerDisabled.setValue(!SystemParamsOperation.getInstance().getPrinterEnabled());
setToolBarTitleWithBackIcon(getString(R.string.title_qr_settlement)); setToolBarTitleWithBackIcon(getString(R.string.title_qr_settlement));
String merchantName = SystemParamsOperation.getInstance().getMerchantName(); String merchantName = SystemParamsOperation.getInstance().getMerchantName();
@ -134,7 +135,7 @@ public class QRSettlementTransactionFragment extends DataBindingFragment impleme
managementViewModel.detailReportLayoutLoadingVisibility.setValue(8); managementViewModel.detailReportLayoutLoadingVisibility.setValue(8);
managementViewModel.detailReportLayoutVisibility.setValue(8); managementViewModel.detailReportLayoutVisibility.setValue(8);
managementViewModel.detailReportLayoutViewVisibility.setValue(0); managementViewModel.detailReportLayoutViewVisibility.setValue(0);
managementViewModel.detailReportBottomLayoutVisibility.setValue(0); managementViewModel.detailReportBottomLayoutVisibility.setValue(isLastSettlementPrinterDisabled() ? 8 : 0);
} }
private void showEmptyDataView() { private void showEmptyDataView() {
@ -149,6 +150,13 @@ public class QRSettlementTransactionFragment extends DataBindingFragment impleme
managementViewModel.cardTypeDR.setValue("QR PAY"); managementViewModel.cardTypeDR.setValue("QR PAY");
} }
private boolean isLastSettlementPrinterDisabled() {
Boolean printerDisabled = sharedViewModel.printerDisabled.getValue();
return sharedViewModel.getTransMenu().getValue() == TransMenu.LAST_SETTLEMENT
&& printerDisabled != null
&& printerDisabled;
}
private void observeQRTransactions() { private void observeQRTransactions() {
managementViewModel.getTransactionHistory().observe(getViewLifecycleOwner(), payDetailList -> { managementViewModel.getTransactionHistory().observe(getViewLifecycleOwner(), payDetailList -> {
if (payDetailList != null) { if (payDetailList != null) {
@ -385,4 +393,4 @@ public class QRSettlementTransactionFragment extends DataBindingFragment impleme
} }
} }
} }

View File

@ -88,6 +88,8 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
boolean printerDisabled = !SystemParamsOperation.getInstance().getPrinterEnabled();
sharedViewModel.printerDisabled.setValue(printerDisabled);
if(sharedViewModel.getTransMenu().getValue() == TransMenu.LAST_SETTLEMENT) { if(sharedViewModel.getTransMenu().getValue() == TransMenu.LAST_SETTLEMENT) {
setToolBarTitleWithBackIcon(getString(R.string.txt_subtitle_reprint_last_settle_report)); setToolBarTitleWithBackIcon(getString(R.string.txt_subtitle_reprint_last_settle_report));
@ -103,6 +105,8 @@ public class SettlementTransactionFragment extends DataBindingFragment implement
if(sharedViewModel.getTransMenu().getValue() == TransMenu.REVIEW_BATCH){ if(sharedViewModel.getTransMenu().getValue() == TransMenu.REVIEW_BATCH){
settlementViewModel.btmLayout.setValue(8); settlementViewModel.btmLayout.setValue(8);
} else if(sharedViewModel.getTransMenu().getValue() == TransMenu.LAST_SETTLEMENT && printerDisabled) {
settlementViewModel.btmLayout.setValue(8);
} else { } else {
settlementViewModel.btmLayout.setValue(0); settlementViewModel.btmLayout.setValue(0);
} }

View File

@ -3,6 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<data> <data>
<import type="android.view.View" />
<variable <variable
name="sharedViewModel" name="sharedViewModel"
type="com.utsmm.kbz.ui.core_viewmodel.SharedViewModel" /> type="com.utsmm.kbz.ui.core_viewmodel.SharedViewModel" />
@ -93,6 +94,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="12dp" android:layout_marginBottom="12dp"
android:visibility="@{sharedViewModel.printerDisabled ? View.GONE : View.VISIBLE}"
app:cardCornerRadius="12dp" app:cardCornerRadius="12dp"
app:cardElevation="0dp" app:cardElevation="0dp"
app:cardBackgroundColor="@color/white" app:cardBackgroundColor="@color/white"

View File

@ -224,7 +224,7 @@ public abstract class BaseXPrint {
if (settleData.getCashAdvanceCount() != 0) if (settleData.getCashAdvanceCount() != 0)
print3ColumnsString("CASH ADVANCE ", countStringFormat(settleData.getCashAdvanceCount()), PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getCashAdvanceAmount())); print3ColumnsString("CASH ADVANCE ", countStringFormat(settleData.getCashAdvanceCount()), PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getCashAdvanceAmount()));
print3ColumnsString("REFUND ", countStringFormat(settleData.getRefundCount()), "- " + PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getRefundAmount())); print3ColumnsString("REFUND ", countStringFormat(settleData.getRefundCount()), "- " + PrintUtils.getInstance().getSeparatorNumberFormat(settleData.getRefundAmount()));
print3ColumnsString("TOTAL(MMK) ", countStringFormat(totalCount), PrintUtils.getInstance().getSeparatorNumberFormat(totalAmount)); print3ColumnsString("TOTAL"+ "(" + "MMK" +")" + " ", countStringFormat(totalCount), PrintUtils.getInstance().getSeparatorNumberFormat(totalAmount));
emptyLine(2); emptyLine(2);