Compare commits
No commits in common. "907eab4e72897f4d75bf0d1f8a4bafae4b820f81" and "eafbecafbd9c4cb87dc6398e85351359deaba253" have entirely different histories.
907eab4e72
...
eafbecafbd
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="temurin-21" project-jdk-type="JavaSDK" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" project-jdk-name="jbr-21" project-jdk-type="JavaSDK" />
|
||||
</project>
|
||||
@ -40,8 +40,8 @@ android {
|
||||
dimension = "env"
|
||||
applicationIdSuffix = ".uat"
|
||||
versionNameSuffix = "-UAT"
|
||||
versionCode = 21
|
||||
versionName = "3.9"
|
||||
versionCode = 19
|
||||
versionName = "3.7"
|
||||
buildConfigField("String", "ENV", "\"UAT\"")
|
||||
resValue("string", "app_name", "MOB-UAT")
|
||||
}
|
||||
|
||||
@ -34,18 +34,3 @@
|
||||
|
||||
### version 3.7
|
||||
* auto-settlement for both P2 and P3
|
||||
|
||||
### version 3.8
|
||||
* Slip design modified
|
||||
* Continue Button hide in transactions success
|
||||
* date format 2026 aligned in paper slip
|
||||
* fixed 2 paper roll out after settlement
|
||||
* fixed terminal disable/enable screen shaking
|
||||
* 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
|
||||
@ -10,7 +10,7 @@ import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation
|
||||
import java.util.Calendar
|
||||
|
||||
object SettlementScheduler {
|
||||
private const val FALLBACK_ALERT_TIME = "23:00:00"
|
||||
private const val FALLBACK_ALERT_TIME = "23:30:00"
|
||||
private const val REQUEST_CODE = 100
|
||||
|
||||
fun schedule(context: Context): Boolean {
|
||||
|
||||
@ -267,7 +267,7 @@ fun DashboardScreen2(
|
||||
)
|
||||
Spacer(modifier = Modifier.height(10.dp))
|
||||
Text(
|
||||
text = "Released on : 16-Sep-2026",
|
||||
text = "Released on : 06-Sep-2026",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = Color.Gray,
|
||||
modifier = Modifier.padding(horizontal = 16.dp)
|
||||
|
||||
@ -17,7 +17,7 @@ data class DashboardUiState(
|
||||
val totalSaleCount: Int = 0,
|
||||
val totalSaleAmount: Long = 0L,
|
||||
val settlementStatusText: String = "Pending",
|
||||
val settlementDateTimeText: String = "--/--/----\n--:--:--",
|
||||
val settlementDateTimeText: String = "--/-- --:--",
|
||||
val isSyncing: Boolean = false,
|
||||
val syncStatusText: String = "Connecting to TMS server..."
|
||||
)
|
||||
|
||||
@ -18,6 +18,7 @@ import kotlinx.coroutines.flow.update
|
||||
import kotlinx.coroutines.launch
|
||||
import java.math.BigDecimal
|
||||
import java.text.DecimalFormat
|
||||
import java.util.Calendar
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
@ -32,7 +33,7 @@ class DashboardViewModel @Inject constructor(
|
||||
init {
|
||||
viewModelScope.launch {
|
||||
repository.getLastTenTransactions().asFlow().collect { payDetails ->
|
||||
val latestSettlement = payDetails.firstOrNull {
|
||||
val latestSettlement = payDetails.lastOrNull {
|
||||
it.transactionType == TransactionsType.SETTLEMENT.value
|
||||
}
|
||||
val isCurrentBusinessSettlement = latestSettlement?.isCurrentBusinessSettlement() == true
|
||||
@ -171,14 +172,22 @@ 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 "--/--/----\n--:--:--"
|
||||
val d = date?.padStart(4, '0')?.takeIf { it.length >= 4 } ?: return "--/-- --:--"
|
||||
val t = (time ?: "").padStart(6, '0')
|
||||
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)}"
|
||||
return "${d.take(2)}/${d.drop(2).take(2)} ${t.take(2)}:${t.drop(2).take(2)}"
|
||||
}
|
||||
|
||||
private fun PayDetail.isCurrentBusinessSettlement(): Boolean {
|
||||
return transactionType == TransactionsType.SETTLEMENT.value &&
|
||||
TradeDate == SystemDateTime.getMMDD()
|
||||
if (transactionType != TransactionsType.SETTLEMENT.value) return false
|
||||
if (TradeDate != SystemDateTime.getMMDD()) return false
|
||||
|
||||
val now = Calendar.getInstance()
|
||||
val cutoff = Calendar.getInstance().apply {
|
||||
set(Calendar.HOUR_OF_DAY, 23)
|
||||
set(Calendar.MINUTE, 0)
|
||||
set(Calendar.SECOND, 0)
|
||||
set(Calendar.MILLISECOND, 0)
|
||||
}
|
||||
|
||||
return now.before(cutoff)
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.mob.utsmyanmar.ui.history_functions
|
||||
|
||||
import com.utsmyanmar.paylibs.model.PayDetail
|
||||
import com.utsmyanmar.paylibs.model.SettleData
|
||||
import com.utsmyanmar.paylibs.utils.POSUtil
|
||||
import com.utsmyanmar.paylibs.utils.enums.HostType
|
||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType
|
||||
@ -18,10 +17,6 @@ enum class HistoryHostPurpose {
|
||||
}
|
||||
|
||||
internal fun prepareReprintPayDetail(payDetail: PayDetail): PayDetail {
|
||||
if (payDetail.settleDataObj == null) {
|
||||
payDetail.settleDataObj = parseSettlementData(payDetail.settleList)
|
||||
}
|
||||
|
||||
val suffix = "(REPRINT)"
|
||||
payDetail.transType = if (payDetail.transType.length >= 20) {
|
||||
"${payDetail.transType}\n$suffix"
|
||||
@ -31,26 +26,6 @@ internal fun prepareReprintPayDetail(payDetail: PayDetail): PayDetail {
|
||||
return payDetail
|
||||
}
|
||||
|
||||
private fun parseSettlementData(value: String): SettleData? {
|
||||
val parts = value.split("-")
|
||||
if (parts.size < 4) return null
|
||||
|
||||
fun count(index: Int): Int = parts[index]
|
||||
.substringBefore(":")
|
||||
.toIntOrNull() ?: 0
|
||||
|
||||
fun amount(index: Int): Long = parts[index]
|
||||
.substringAfter(":")
|
||||
.toLongOrNull() ?: 0L
|
||||
|
||||
return SettleData(
|
||||
count(0), amount(0),
|
||||
count(3), amount(3),
|
||||
count(2), amount(2),
|
||||
count(1), amount(1)
|
||||
)
|
||||
}
|
||||
|
||||
internal fun displayTransactionStatus(payDetail: PayDetail): String {
|
||||
if (payDetail.transactionType == TransactionsType.REVERSAL.value) {
|
||||
return if (payDetail.isNeedReversal) "REVERSAL FAILED" else "REVERSAL SUCCESS"
|
||||
|
||||
@ -18,8 +18,8 @@ class HistoryViewModel @Inject constructor(
|
||||
fun getLastTransaction(voucherNo: String): LiveData<List<PayDetail>> =
|
||||
repository.getLastTransaction(voucherNo)
|
||||
|
||||
fun getLastSettlement(): LiveData<List<PayDetail>> =
|
||||
repository.getLastSettlement()
|
||||
fun getLastSettlement(voucherNo: String): LiveData<List<PayDetail>> =
|
||||
repository.getLastSettlement(voucherNo)
|
||||
|
||||
fun getReviewBatchTransaction(batchNo: String): LiveData<List<PayDetail>> =
|
||||
repository.getReviewBatchTransaction(batchNo)
|
||||
|
||||
@ -27,6 +27,7 @@ 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(
|
||||
@ -35,43 +36,27 @@ fun ReprintSettlementScreen(
|
||||
onDone: () -> Unit,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val settlements by viewModel.getLastSettlement().observeAsState()
|
||||
val voucherNo = SystemParamsOperation.getInstance().currentSerialNum
|
||||
val settlements by viewModel.getLastSettlement(voucherNo).observeAsState(emptyList())
|
||||
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
|
||||
val records = settlements ?: return@LaunchedEffect
|
||||
if (records.isEmpty()) {
|
||||
if (settlements.isEmpty()) {
|
||||
Toast.makeText(context, "No transactions to print.", Toast.LENGTH_SHORT).show()
|
||||
onBack()
|
||||
return@LaunchedEffect
|
||||
}
|
||||
hasStarted = true
|
||||
val detail = prepareReprintPayDetail(records.first())
|
||||
val detail = prepareReprintPayDetail(settlements.last())
|
||||
payDetail = detail
|
||||
printSettlementReport(context, detail, onSuccess = {
|
||||
printFinished = true
|
||||
}) {
|
||||
printSettlementReport(context, detail, onSuccess = onDone) {
|
||||
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 = {
|
||||
@ -92,11 +77,7 @@ fun ReprintSettlementScreen(
|
||||
Button(
|
||||
onClick = {
|
||||
payDetail?.let { detail ->
|
||||
printFailed = false
|
||||
printFinished = false
|
||||
printSettlementReport(context, detail, onSuccess = {
|
||||
printFinished = true
|
||||
}) {
|
||||
printSettlementReport(context, detail, onSuccess = onDone) {
|
||||
printFailed = true
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,21 +36,15 @@ fun ProcessingRoute(
|
||||
settlementViewModel.startSettlementProcess()
|
||||
}
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
settlementViewModel.events.collect { event ->
|
||||
when (event) {
|
||||
is com.mob.utsmyanmar.ui.settlement.SettlementEvent.ShowStatus -> {
|
||||
when (event.status) {
|
||||
TransactionStatus.ON_ERROR,
|
||||
TransactionStatus.ON_SUCCESS -> {
|
||||
onTransactionFinished()
|
||||
sharedViewModel.payDetail.value = settlementViewModel.getPayDetail()
|
||||
onNavigateTransactionResult()
|
||||
}
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
LaunchedEffect(settlementStatus.status) {
|
||||
when(settlementStatus.status) {
|
||||
TransactionStatus.ON_ERROR,
|
||||
TransactionStatus.ON_SUCCESS -> {
|
||||
onTransactionFinished()
|
||||
sharedViewModel.payDetail.value = settlementViewModel.getPayDetail()
|
||||
onNavigateTransactionResult()
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -111,8 +111,8 @@ class SettlementViewModel @Inject constructor(
|
||||
private val _events = Channel<SettlementEvent>(Channel.BUFFERED)
|
||||
val events = _events.receiveAsFlow()
|
||||
|
||||
fun getLastSettlement(): LiveData<List<PayDetail>> {
|
||||
return repository.getLastSettlement()
|
||||
fun getLastSettlement(voucherNo: String): LiveData<List<PayDetail>> {
|
||||
return repository.getLastSettlement(voucherNo)
|
||||
}
|
||||
|
||||
fun getSettlement(): LiveData<List<PayDetail>> {
|
||||
@ -253,10 +253,7 @@ class SettlementViewModel @Inject constructor(
|
||||
|
||||
fun startSettlementProcess() {
|
||||
_uiState.update {
|
||||
it.copy(
|
||||
status = null,
|
||||
isLoading = true
|
||||
)
|
||||
it.copy(isLoading = true)
|
||||
}
|
||||
|
||||
SystemParamsOperation.getInstance().getIncrementBatchNo()
|
||||
@ -469,7 +466,6 @@ class SettlementViewModel @Inject constructor(
|
||||
if (!errorFlag && settlementApproved) {
|
||||
updateDB()
|
||||
insertPayDetail(currentPayDetail)
|
||||
SystemParamsOperation.getInstance().setNeedSettlement(false)
|
||||
postStatus(TransactionStatus.ON_SUCCESS)
|
||||
} else {
|
||||
postStatus(TransactionStatus.ON_ERROR)
|
||||
|
||||
@ -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 ORDER BY PID DESC")
|
||||
LiveData<List<PayDetail>> getLastSettlement();
|
||||
@Query("SELECT * FROM paydetail WHERE transactionType = 3 AND voucherNo <= :voucherNo AND accountType != 'MPU'")
|
||||
LiveData<List<PayDetail>> getLastSettlement(String voucherNo);
|
||||
|
||||
// @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() { return payDetailDao.getLastSettlement();}
|
||||
public LiveData<List<PayDetail>> getLastSettlement(String voucherNo) { return payDetailDao.getLastSettlement(voucherNo);}
|
||||
|
||||
public LiveData<List<PayDetail>> getLastTransaction(String voucherNo) { return payDetailDao.getLastTransaction(voucherNo);}
|
||||
|
||||
|
||||
@ -199,11 +199,6 @@ public class PrintXImpl extends BaseXPrint implements PrintX {
|
||||
this.callbackStatus = printXStatus;
|
||||
|
||||
try {
|
||||
if (payDetail == null || payDetail.getSettleDataObj() == null) {
|
||||
printXStatus.onFailure();
|
||||
return;
|
||||
}
|
||||
|
||||
LogUtil.d(TAG, payDetail.getSettleDataObj().toString());
|
||||
|
||||
setHeight(0x12);
|
||||
|
||||
@ -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