fixed mini errors
This commit is contained in:
parent
d239da7e72
commit
907eab4e72
@ -40,8 +40,8 @@ android {
|
||||
dimension = "env"
|
||||
applicationIdSuffix = ".uat"
|
||||
versionNameSuffix = "-UAT"
|
||||
versionCode = 20
|
||||
versionName = "3.8"
|
||||
versionCode = 21
|
||||
versionName = "3.9"
|
||||
buildConfigField("String", "ENV", "\"UAT\"")
|
||||
resValue("string", "app_name", "MOB-UAT")
|
||||
}
|
||||
|
||||
@ -44,3 +44,8 @@
|
||||
* cardholder name adjust to 20 words
|
||||
* card masked in PrintPreview Screen
|
||||
* cash adv in settlement
|
||||
|
||||
### version 3.9
|
||||
* modified date/time in settlement status in home
|
||||
* fixed settlement status not updating
|
||||
* updated released date
|
||||
@ -17,7 +17,7 @@ data class DashboardUiState(
|
||||
val totalSaleCount: Int = 0,
|
||||
val totalSaleAmount: Long = 0L,
|
||||
val settlementStatusText: String = "Pending",
|
||||
val settlementDateTimeText: String = "--/-- --:--",
|
||||
val settlementDateTimeText: String = "--/--/----\n--:--:--",
|
||||
val isSyncing: Boolean = false,
|
||||
val syncStatusText: String = "Connecting to TMS server..."
|
||||
)
|
||||
|
||||
@ -171,9 +171,11 @@ private fun formatTypeLabel(raw: String): String = when {
|
||||
|
||||
// TradeDate = "MMDD", TradeTime = "HHmmss" (ISO 8583 fields 13 & 12)
|
||||
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')
|
||||
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 {
|
||||
|
||||
@ -18,8 +18,8 @@ class HistoryViewModel @Inject constructor(
|
||||
fun getLastTransaction(voucherNo: String): LiveData<List<PayDetail>> =
|
||||
repository.getLastTransaction(voucherNo)
|
||||
|
||||
fun getLastSettlement(voucherNo: String): LiveData<List<PayDetail>> =
|
||||
repository.getLastSettlement(voucherNo)
|
||||
fun getLastSettlement(): LiveData<List<PayDetail>> =
|
||||
repository.getLastSettlement()
|
||||
|
||||
fun getReviewBatchTransaction(batchNo: String): LiveData<List<PayDetail>> =
|
||||
repository.getReviewBatchTransaction(batchNo)
|
||||
|
||||
@ -27,7 +27,6 @@ import androidx.compose.ui.unit.dp
|
||||
import com.mob.utsmyanmar.ui.components.appbar.AppBar
|
||||
import com.mob.utsmyanmar.ui.theme.Color
|
||||
import com.utsmyanmar.paylibs.model.PayDetail
|
||||
import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation
|
||||
|
||||
@Composable
|
||||
fun ReprintSettlementScreen(
|
||||
@ -36,27 +35,43 @@ fun ReprintSettlementScreen(
|
||||
onDone: () -> Unit,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val voucherNo = SystemParamsOperation.getInstance().currentSerialNum
|
||||
val settlements by viewModel.getLastSettlement(voucherNo).observeAsState(emptyList())
|
||||
val settlements by viewModel.getLastSettlement().observeAsState()
|
||||
var payDetail by remember { mutableStateOf<PayDetail?>(null) }
|
||||
var hasStarted by remember { mutableStateOf(false) }
|
||||
var printFailed by remember { mutableStateOf(false) }
|
||||
var printFinished by remember { mutableStateOf(false) }
|
||||
|
||||
LaunchedEffect(settlements) {
|
||||
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()
|
||||
onBack()
|
||||
return@LaunchedEffect
|
||||
}
|
||||
hasStarted = true
|
||||
val detail = prepareReprintPayDetail(settlements.first())
|
||||
val detail = prepareReprintPayDetail(records.first())
|
||||
payDetail = detail
|
||||
printSettlementReport(context, detail, onSuccess = onDone) {
|
||||
printSettlementReport(context, detail, onSuccess = {
|
||||
printFinished = 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(
|
||||
containerColor = Color.IvoryBeige,
|
||||
topBar = {
|
||||
@ -77,7 +92,11 @@ fun ReprintSettlementScreen(
|
||||
Button(
|
||||
onClick = {
|
||||
payDetail?.let { detail ->
|
||||
printSettlementReport(context, detail, onSuccess = onDone) {
|
||||
printFailed = false
|
||||
printFinished = false
|
||||
printSettlementReport(context, detail, onSuccess = {
|
||||
printFinished = true
|
||||
}) {
|
||||
printFailed = true
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,8 +111,8 @@ class SettlementViewModel @Inject constructor(
|
||||
private val _events = Channel<SettlementEvent>(Channel.BUFFERED)
|
||||
val events = _events.receiveAsFlow()
|
||||
|
||||
fun getLastSettlement(voucherNo: String): LiveData<List<PayDetail>> {
|
||||
return repository.getLastSettlement(voucherNo)
|
||||
fun getLastSettlement(): LiveData<List<PayDetail>> {
|
||||
return repository.getLastSettlement()
|
||||
}
|
||||
|
||||
fun getSettlement(): LiveData<List<PayDetail>> {
|
||||
|
||||
@ -128,8 +128,8 @@ public interface PayDetailDao {
|
||||
@Query(("SELECT * FROM paydetail WHERE transactionType = 3 AND voucherNo IN(:voucherNo)"))
|
||||
LiveData<PayDetail> checkLastSettlement(String voucherNo);
|
||||
|
||||
@Query("SELECT * FROM paydetail WHERE transactionType = 3 AND voucherNo <= :voucherNo ORDER BY PID DESC")
|
||||
LiveData<List<PayDetail>> getLastSettlement(String voucherNo);
|
||||
@Query("SELECT * FROM paydetail WHERE transactionType = 3 ORDER BY PID DESC")
|
||||
LiveData<List<PayDetail>> getLastSettlement();
|
||||
|
||||
// @Query("SELECT * FROM paydetail WHERE transactionType != 10 AND voucherNo <= :voucherNo")
|
||||
@Query("SELECT * FROM paydetail WHERE transactionType != 10 AND voucherNo IN(:voucherNo)")
|
||||
|
||||
@ -99,7 +99,7 @@ public class Repository {
|
||||
|
||||
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);}
|
||||
|
||||
|
||||
@ -38,8 +38,8 @@ public class SystemParamsSettings implements Serializable {
|
||||
|
||||
private boolean checkExpSwitch = false;
|
||||
|
||||
// private String tmsAddress = "https://posmgmt.myanmarorientalbank.com/api/v1";
|
||||
private String tmsAddress = "https://sirius-nest.utsmyanmar.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 = "http://128.199.170.203";
|
||||
|
||||
private String terminalCapability = "E0E8C8";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user