fixed mini errors

This commit is contained in:
moon 2026-09-16 17:12:48 +06:30
parent d239da7e72
commit 907eab4e72
10 changed files with 48 additions and 22 deletions

View File

@ -40,8 +40,8 @@ android {
dimension = "env" dimension = "env"
applicationIdSuffix = ".uat" applicationIdSuffix = ".uat"
versionNameSuffix = "-UAT" versionNameSuffix = "-UAT"
versionCode = 20 versionCode = 21
versionName = "3.8" versionName = "3.9"
buildConfigField("String", "ENV", "\"UAT\"") buildConfigField("String", "ENV", "\"UAT\"")
resValue("string", "app_name", "MOB-UAT") resValue("string", "app_name", "MOB-UAT")
} }

View File

@ -43,4 +43,9 @@
* fixed terminal disable/enable screen shaking * fixed terminal disable/enable screen shaking
* cardholder name adjust to 20 words * cardholder name adjust to 20 words
* card masked in PrintPreview Screen * card masked in PrintPreview Screen
* cash adv in settlement * cash adv in settlement
### version 3.9
* modified date/time in settlement status in home
* fixed settlement status not updating
* updated released date

View File

@ -17,7 +17,7 @@ data class DashboardUiState(
val totalSaleCount: Int = 0, val totalSaleCount: Int = 0,
val totalSaleAmount: Long = 0L, val totalSaleAmount: Long = 0L,
val settlementStatusText: String = "Pending", val settlementStatusText: String = "Pending",
val settlementDateTimeText: String = "--/-- --:--", val settlementDateTimeText: String = "--/--/----\n--:--:--",
val isSyncing: Boolean = false, val isSyncing: Boolean = false,
val syncStatusText: String = "Connecting to TMS server..." val syncStatusText: String = "Connecting to TMS server..."
) )

View File

@ -171,9 +171,11 @@ private fun formatTypeLabel(raw: String): String = when {
// TradeDate = "MMDD", TradeTime = "HHmmss" (ISO 8583 fields 13 & 12) // TradeDate = "MMDD", TradeTime = "HHmmss" (ISO 8583 fields 13 & 12)
private fun buildDateTime(date: String?, time: String?): String { private fun buildDateTime(date: String?, time: String?): String {
val d = date?.padStart(4, '0')?.takeIf { it.length >= 4 } ?: return "--/-- --:--" val d = date?.padStart(4, '0')?.takeIf { it.length >= 4 }
?: return "--/--/----\n--:--:--"
val t = (time ?: "").padStart(6, '0') val t = (time ?: "").padStart(6, '0')
return "${d.take(2)}/${d.drop(2).take(2)} ${t.take(2)}:${t.drop(2).take(2)}" return "${d.drop(2).take(2)}/${d.take(2)}/${SystemDateTime.getYYYY()}\n" +
"${t.take(2)}:${t.drop(2).take(2)}:${t.drop(4).take(2)}"
} }
private fun PayDetail.isCurrentBusinessSettlement(): Boolean { private fun PayDetail.isCurrentBusinessSettlement(): Boolean {

View File

@ -18,8 +18,8 @@ class HistoryViewModel @Inject constructor(
fun getLastTransaction(voucherNo: String): LiveData<List<PayDetail>> = fun getLastTransaction(voucherNo: String): LiveData<List<PayDetail>> =
repository.getLastTransaction(voucherNo) repository.getLastTransaction(voucherNo)
fun getLastSettlement(voucherNo: String): LiveData<List<PayDetail>> = fun getLastSettlement(): LiveData<List<PayDetail>> =
repository.getLastSettlement(voucherNo) repository.getLastSettlement()
fun getReviewBatchTransaction(batchNo: String): LiveData<List<PayDetail>> = fun getReviewBatchTransaction(batchNo: String): LiveData<List<PayDetail>> =
repository.getReviewBatchTransaction(batchNo) repository.getReviewBatchTransaction(batchNo)

View File

@ -27,7 +27,6 @@ import androidx.compose.ui.unit.dp
import com.mob.utsmyanmar.ui.components.appbar.AppBar import com.mob.utsmyanmar.ui.components.appbar.AppBar
import com.mob.utsmyanmar.ui.theme.Color import com.mob.utsmyanmar.ui.theme.Color
import com.utsmyanmar.paylibs.model.PayDetail import com.utsmyanmar.paylibs.model.PayDetail
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation
@Composable @Composable
fun ReprintSettlementScreen( fun ReprintSettlementScreen(
@ -36,27 +35,43 @@ fun ReprintSettlementScreen(
onDone: () -> Unit, onDone: () -> Unit,
) { ) {
val context = LocalContext.current val context = LocalContext.current
val voucherNo = SystemParamsOperation.getInstance().currentSerialNum val settlements by viewModel.getLastSettlement().observeAsState()
val settlements by viewModel.getLastSettlement(voucherNo).observeAsState(emptyList())
var payDetail by remember { mutableStateOf<PayDetail?>(null) } var payDetail by remember { mutableStateOf<PayDetail?>(null) }
var hasStarted by remember { mutableStateOf(false) } var hasStarted by remember { mutableStateOf(false) }
var printFailed by remember { mutableStateOf(false) } var printFailed by remember { mutableStateOf(false) }
var printFinished by remember { mutableStateOf(false) }
LaunchedEffect(settlements) { LaunchedEffect(settlements) {
if (hasStarted) return@LaunchedEffect if (hasStarted) return@LaunchedEffect
if (settlements.isEmpty()) { val records = settlements ?: return@LaunchedEffect
if (records.isEmpty()) {
Toast.makeText(context, "No transactions to print.", Toast.LENGTH_SHORT).show() Toast.makeText(context, "No transactions to print.", Toast.LENGTH_SHORT).show()
onBack() onBack()
return@LaunchedEffect return@LaunchedEffect
} }
hasStarted = true hasStarted = true
val detail = prepareReprintPayDetail(settlements.first()) val detail = prepareReprintPayDetail(records.first())
payDetail = detail payDetail = detail
printSettlementReport(context, detail, onSuccess = onDone) { printSettlementReport(context, detail, onSuccess = {
printFinished = true
}) {
printFailed = true printFailed = true
} }
} }
LaunchedEffect(printFinished) {
if (printFinished) onDone()
}
LaunchedEffect(hasStarted, printFailed, printFinished) {
if (!hasStarted || printFailed || printFinished) return@LaunchedEffect
// Some Sunmi firmware prints successfully without sending onPrintResult.
kotlinx.coroutines.delay(8_000)
if (!printFailed && !printFinished) {
printFinished = true
}
}
Scaffold( Scaffold(
containerColor = Color.IvoryBeige, containerColor = Color.IvoryBeige,
topBar = { topBar = {
@ -77,7 +92,11 @@ fun ReprintSettlementScreen(
Button( Button(
onClick = { onClick = {
payDetail?.let { detail -> payDetail?.let { detail ->
printSettlementReport(context, detail, onSuccess = onDone) { printFailed = false
printFinished = false
printSettlementReport(context, detail, onSuccess = {
printFinished = true
}) {
printFailed = true printFailed = true
} }
} }

View File

@ -111,8 +111,8 @@ class SettlementViewModel @Inject constructor(
private val _events = Channel<SettlementEvent>(Channel.BUFFERED) private val _events = Channel<SettlementEvent>(Channel.BUFFERED)
val events = _events.receiveAsFlow() val events = _events.receiveAsFlow()
fun getLastSettlement(voucherNo: String): LiveData<List<PayDetail>> { fun getLastSettlement(): LiveData<List<PayDetail>> {
return repository.getLastSettlement(voucherNo) return repository.getLastSettlement()
} }
fun getSettlement(): LiveData<List<PayDetail>> { fun getSettlement(): LiveData<List<PayDetail>> {

View File

@ -128,8 +128,8 @@ public interface PayDetailDao {
@Query(("SELECT * FROM paydetail WHERE transactionType = 3 AND voucherNo IN(:voucherNo)")) @Query(("SELECT * FROM paydetail WHERE transactionType = 3 AND voucherNo IN(:voucherNo)"))
LiveData<PayDetail> checkLastSettlement(String voucherNo); LiveData<PayDetail> checkLastSettlement(String voucherNo);
@Query("SELECT * FROM paydetail WHERE transactionType = 3 AND voucherNo <= :voucherNo ORDER BY PID DESC") @Query("SELECT * FROM paydetail WHERE transactionType = 3 ORDER BY PID DESC")
LiveData<List<PayDetail>> getLastSettlement(String voucherNo); LiveData<List<PayDetail>> getLastSettlement();
// @Query("SELECT * FROM paydetail WHERE transactionType != 10 AND voucherNo <= :voucherNo") // @Query("SELECT * FROM paydetail WHERE transactionType != 10 AND voucherNo <= :voucherNo")
@Query("SELECT * FROM paydetail WHERE transactionType != 10 AND voucherNo IN(:voucherNo)") @Query("SELECT * FROM paydetail WHERE transactionType != 10 AND voucherNo IN(:voucherNo)")

View File

@ -99,7 +99,7 @@ public class Repository {
public LiveData<List<PayDetail>> getTransactionHistory(){ return payDetailDao.getTransactionHistory();} public LiveData<List<PayDetail>> getTransactionHistory(){ return payDetailDao.getTransactionHistory();}
public LiveData<List<PayDetail>> getLastSettlement(String voucherNo) { return payDetailDao.getLastSettlement(voucherNo);} public LiveData<List<PayDetail>> getLastSettlement() { return payDetailDao.getLastSettlement();}
public LiveData<List<PayDetail>> getLastTransaction(String voucherNo) { return payDetailDao.getLastTransaction(voucherNo);} public LiveData<List<PayDetail>> getLastTransaction(String voucherNo) { return payDetailDao.getLastTransaction(voucherNo);}

View File

@ -38,8 +38,8 @@ public class SystemParamsSettings implements Serializable {
private boolean checkExpSwitch = false; private boolean checkExpSwitch = false;
// private String tmsAddress = "https://posmgmt.myanmarorientalbank.com/api/v1"; private String tmsAddress = "https://posmgmt.myanmarorientalbank.com/api/v1";
private String tmsAddress = "https://sirius-nest.utsmyanmar.com/api/v1"; // private String tmsAddress = "https://sirius-nest.utsmyanmar.com/api/v1";
// private String tmsAddress = "http://128.199.170.203"; // private String tmsAddress = "http://128.199.170.203";
private String terminalCapability = "E0E8C8"; private String terminalCapability = "E0E8C8";