settlement double print fixed
This commit is contained in:
parent
eafbecafbd
commit
d239da7e72
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" project-jdk-name="jbr-21" project-jdk-type="JavaSDK" />
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="temurin-21" project-jdk-type="JavaSDK" />
|
||||||
</project>
|
</project>
|
||||||
@ -40,8 +40,8 @@ android {
|
|||||||
dimension = "env"
|
dimension = "env"
|
||||||
applicationIdSuffix = ".uat"
|
applicationIdSuffix = ".uat"
|
||||||
versionNameSuffix = "-UAT"
|
versionNameSuffix = "-UAT"
|
||||||
versionCode = 19
|
versionCode = 20
|
||||||
versionName = "3.7"
|
versionName = "3.8"
|
||||||
buildConfigField("String", "ENV", "\"UAT\"")
|
buildConfigField("String", "ENV", "\"UAT\"")
|
||||||
resValue("string", "app_name", "MOB-UAT")
|
resValue("string", "app_name", "MOB-UAT")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,3 +34,13 @@
|
|||||||
|
|
||||||
### version 3.7
|
### version 3.7
|
||||||
* auto-settlement for both P2 and P3
|
* 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
|
||||||
@ -10,7 +10,7 @@ import com.utsmyanmar.paylibs.utils.core_utils.SystemParamsOperation
|
|||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
|
|
||||||
object SettlementScheduler {
|
object SettlementScheduler {
|
||||||
private const val FALLBACK_ALERT_TIME = "23:30:00"
|
private const val FALLBACK_ALERT_TIME = "23:00:00"
|
||||||
private const val REQUEST_CODE = 100
|
private const val REQUEST_CODE = 100
|
||||||
|
|
||||||
fun schedule(context: Context): Boolean {
|
fun schedule(context: Context): Boolean {
|
||||||
|
|||||||
@ -267,7 +267,7 @@ fun DashboardScreen2(
|
|||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.height(10.dp))
|
Spacer(modifier = Modifier.height(10.dp))
|
||||||
Text(
|
Text(
|
||||||
text = "Released on : 06-Sep-2026",
|
text = "Released on : 16-Sep-2026",
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = Color.Gray,
|
color = Color.Gray,
|
||||||
modifier = Modifier.padding(horizontal = 16.dp)
|
modifier = Modifier.padding(horizontal = 16.dp)
|
||||||
|
|||||||
@ -18,7 +18,6 @@ import kotlinx.coroutines.flow.update
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.Calendar
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@HiltViewModel
|
@HiltViewModel
|
||||||
@ -33,7 +32,7 @@ class DashboardViewModel @Inject constructor(
|
|||||||
init {
|
init {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
repository.getLastTenTransactions().asFlow().collect { payDetails ->
|
repository.getLastTenTransactions().asFlow().collect { payDetails ->
|
||||||
val latestSettlement = payDetails.lastOrNull {
|
val latestSettlement = payDetails.firstOrNull {
|
||||||
it.transactionType == TransactionsType.SETTLEMENT.value
|
it.transactionType == TransactionsType.SETTLEMENT.value
|
||||||
}
|
}
|
||||||
val isCurrentBusinessSettlement = latestSettlement?.isCurrentBusinessSettlement() == true
|
val isCurrentBusinessSettlement = latestSettlement?.isCurrentBusinessSettlement() == true
|
||||||
@ -178,16 +177,6 @@ private fun buildDateTime(date: String?, time: String?): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun PayDetail.isCurrentBusinessSettlement(): Boolean {
|
private fun PayDetail.isCurrentBusinessSettlement(): Boolean {
|
||||||
if (transactionType != TransactionsType.SETTLEMENT.value) return false
|
return transactionType == TransactionsType.SETTLEMENT.value &&
|
||||||
if (TradeDate != SystemDateTime.getMMDD()) return false
|
TradeDate == SystemDateTime.getMMDD()
|
||||||
|
|
||||||
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,6 +1,7 @@
|
|||||||
package com.mob.utsmyanmar.ui.history_functions
|
package com.mob.utsmyanmar.ui.history_functions
|
||||||
|
|
||||||
import com.utsmyanmar.paylibs.model.PayDetail
|
import com.utsmyanmar.paylibs.model.PayDetail
|
||||||
|
import com.utsmyanmar.paylibs.model.SettleData
|
||||||
import com.utsmyanmar.paylibs.utils.POSUtil
|
import com.utsmyanmar.paylibs.utils.POSUtil
|
||||||
import com.utsmyanmar.paylibs.utils.enums.HostType
|
import com.utsmyanmar.paylibs.utils.enums.HostType
|
||||||
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType
|
import com.utsmyanmar.paylibs.utils.iso_utils.TransactionsType
|
||||||
@ -17,6 +18,10 @@ enum class HistoryHostPurpose {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal fun prepareReprintPayDetail(payDetail: PayDetail): PayDetail {
|
internal fun prepareReprintPayDetail(payDetail: PayDetail): PayDetail {
|
||||||
|
if (payDetail.settleDataObj == null) {
|
||||||
|
payDetail.settleDataObj = parseSettlementData(payDetail.settleList)
|
||||||
|
}
|
||||||
|
|
||||||
val suffix = "(REPRINT)"
|
val suffix = "(REPRINT)"
|
||||||
payDetail.transType = if (payDetail.transType.length >= 20) {
|
payDetail.transType = if (payDetail.transType.length >= 20) {
|
||||||
"${payDetail.transType}\n$suffix"
|
"${payDetail.transType}\n$suffix"
|
||||||
@ -26,6 +31,26 @@ internal fun prepareReprintPayDetail(payDetail: PayDetail): PayDetail {
|
|||||||
return 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 {
|
internal fun displayTransactionStatus(payDetail: PayDetail): String {
|
||||||
if (payDetail.transactionType == TransactionsType.REVERSAL.value) {
|
if (payDetail.transactionType == TransactionsType.REVERSAL.value) {
|
||||||
return if (payDetail.isNeedReversal) "REVERSAL FAILED" else "REVERSAL SUCCESS"
|
return if (payDetail.isNeedReversal) "REVERSAL FAILED" else "REVERSAL SUCCESS"
|
||||||
|
|||||||
@ -50,7 +50,7 @@ fun ReprintSettlementScreen(
|
|||||||
return@LaunchedEffect
|
return@LaunchedEffect
|
||||||
}
|
}
|
||||||
hasStarted = true
|
hasStarted = true
|
||||||
val detail = prepareReprintPayDetail(settlements.last())
|
val detail = prepareReprintPayDetail(settlements.first())
|
||||||
payDetail = detail
|
payDetail = detail
|
||||||
printSettlementReport(context, detail, onSuccess = onDone) {
|
printSettlementReport(context, detail, onSuccess = onDone) {
|
||||||
printFailed = true
|
printFailed = true
|
||||||
|
|||||||
@ -36,15 +36,21 @@ fun ProcessingRoute(
|
|||||||
settlementViewModel.startSettlementProcess()
|
settlementViewModel.startSettlementProcess()
|
||||||
}
|
}
|
||||||
|
|
||||||
LaunchedEffect(settlementStatus.status) {
|
LaunchedEffect(Unit) {
|
||||||
when(settlementStatus.status) {
|
settlementViewModel.events.collect { event ->
|
||||||
|
when (event) {
|
||||||
|
is com.mob.utsmyanmar.ui.settlement.SettlementEvent.ShowStatus -> {
|
||||||
|
when (event.status) {
|
||||||
TransactionStatus.ON_ERROR,
|
TransactionStatus.ON_ERROR,
|
||||||
TransactionStatus.ON_SUCCESS -> {
|
TransactionStatus.ON_SUCCESS -> {
|
||||||
onTransactionFinished()
|
onTransactionFinished()
|
||||||
sharedViewModel.payDetail.value = settlementViewModel.getPayDetail()
|
sharedViewModel.payDetail.value = settlementViewModel.getPayDetail()
|
||||||
onNavigateTransactionResult()
|
onNavigateTransactionResult()
|
||||||
}
|
}
|
||||||
else -> {}
|
else -> Unit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -253,7 +253,10 @@ class SettlementViewModel @Inject constructor(
|
|||||||
|
|
||||||
fun startSettlementProcess() {
|
fun startSettlementProcess() {
|
||||||
_uiState.update {
|
_uiState.update {
|
||||||
it.copy(isLoading = true)
|
it.copy(
|
||||||
|
status = null,
|
||||||
|
isLoading = true
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemParamsOperation.getInstance().getIncrementBatchNo()
|
SystemParamsOperation.getInstance().getIncrementBatchNo()
|
||||||
@ -466,6 +469,7 @@ class SettlementViewModel @Inject constructor(
|
|||||||
if (!errorFlag && settlementApproved) {
|
if (!errorFlag && settlementApproved) {
|
||||||
updateDB()
|
updateDB()
|
||||||
insertPayDetail(currentPayDetail)
|
insertPayDetail(currentPayDetail)
|
||||||
|
SystemParamsOperation.getInstance().setNeedSettlement(false)
|
||||||
postStatus(TransactionStatus.ON_SUCCESS)
|
postStatus(TransactionStatus.ON_SUCCESS)
|
||||||
} else {
|
} else {
|
||||||
postStatus(TransactionStatus.ON_ERROR)
|
postStatus(TransactionStatus.ON_ERROR)
|
||||||
|
|||||||
@ -128,7 +128,7 @@ 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 AND accountType != 'MPU'")
|
@Query("SELECT * FROM paydetail WHERE transactionType = 3 AND voucherNo <= :voucherNo ORDER BY PID DESC")
|
||||||
LiveData<List<PayDetail>> getLastSettlement(String voucherNo);
|
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 <= :voucherNo")
|
||||||
|
|||||||
@ -199,6 +199,11 @@ public class PrintXImpl extends BaseXPrint implements PrintX {
|
|||||||
this.callbackStatus = printXStatus;
|
this.callbackStatus = printXStatus;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (payDetail == null || payDetail.getSettleDataObj() == null) {
|
||||||
|
printXStatus.onFailure();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LogUtil.d(TAG, payDetail.getSettleDataObj().toString());
|
LogUtil.d(TAG, payDetail.getSettleDataObj().toString());
|
||||||
|
|
||||||
setHeight(0x12);
|
setHeight(0x12);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user