Skip to content

Commit

Permalink
Finish feature/OP-735
Browse files Browse the repository at this point in the history
OP-735: fixed 'restoring claim' functionality
  • Loading branch information
dragos-dobre authored Jun 14, 2022
2 parents 7f010b4 + 058196a commit b497e5a
Showing 1 changed file with 49 additions and 4 deletions.
53 changes: 49 additions & 4 deletions IMIS/Claim.aspx.vb
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ Partial Public Class Claim
End Function
Private Sub B_SAVE_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles B_SAVE.Click
Dim chkSaveClaimItems, chkSaveClaim, chkSaveClaimServices As Integer
Dim oldClaimId As Integer
eClaim.ClaimID = hfClaimID.Value
If CType(Me.Master.FindControl("hfDirty"), HiddenField).Value = True Then

Expand All @@ -550,6 +551,9 @@ Partial Public Class Claim
'Added by Salumu 05092019 setting claim status to entered, review and feedback to idle for rejected claims
'Starts
If CInt(Session("RestoreMode")) = True Then
'In all cases for restoring claims the initial claim must be unchanged'
oldClaimId = eClaim.ClaimID
eClaim.ClaimID = 0
If Not eClaim.ClaimStatus = 1 Then
eClaim.ClaimStatus = 2
eClaim.ReviewStatus = 1
Expand Down Expand Up @@ -763,6 +767,43 @@ Partial Public Class Claim
End If
Next

'get items/services - copy to new restored claim'
If CInt(Session("RestoreMode")) = True Then
Dim eClaimItemsCopied As New IMIS_EN.tblClaimItems
Dim eClaimServicesCopied As New IMIS_EN.tblClaimServices
Dim eItemCopied As New IMIS_EN.tblItems
Dim eServiceCopied As New IMIS_EN.tblServices

Dim ds As New DataSet
Dim dt As DataTable

ds = claim.getClaimServiceAndItems(oldClaimId)
dt = ds.Tables("ClaimedServices")
For Each row As DataRow In dt.Rows
eClaimServicesCopied.tblClaim = eClaim
eClaimServicesCopied.tblServices = eServiceCopied
eClaimServicesCopied.tblServices.ServiceID = row.Item("ServiceID")
eClaimServicesCopied.QtyProvided = row.Item("QtyProvided")
eClaimServicesCopied.PriceAsked = row.Item("PriceAsked")
eClaimServicesCopied.Explanation = row.Item("Explanation")
eClaimServicesCopied.AuditUserID = eClaim.AuditUserID
chkSaveClaimServices = claim.SaveClaimServices(eClaimServicesCopied)
Next row

dt = ds.Tables("ClaimedItems")
For Each row As DataRow In dt.Rows
eClaimItemsCopied.tblClaim = eClaim
eClaimItemsCopied.tblItems = eItemCopied
eClaimItemsCopied.tblItems.ItemID = row.Item("ItemID")
eClaimItemsCopied.QtyProvided = row.Item("QtyProvided")
eClaimItemsCopied.PriceAsked = row.Item("PriceAsked")
eClaimItemsCopied.Explanation = row.Item("Explanation")
eClaimItemsCopied.AuditUserID = eClaim.AuditUserID
chkSaveClaimItems = claim.SaveClaimItems(eClaimItemsCopied)
Next row

End If

ServiceItemGridBinding()
AfterSaveMessages(chkSaveClaim, chkSaveClaimItems, chkSaveClaimServices)
tdPrintW.Visible = eClaim.ClaimID > 0
Expand Down Expand Up @@ -980,12 +1021,16 @@ Partial Public Class Claim
Session("RestoreMode") = RestoreMode
If Session("RestoreMode") = True Then
Dim claimCodePrefix As String = IMIS_EN.AppConfiguration.ClaimCodePrefix
If Not claimCodePrefix Is Nothing Then
txtCLAIMCODEData.Text = claimCodePrefix + eClaim.ClaimCode
If eClaim.ClaimStatus = 1 Then
If Not claimCodePrefix Is Nothing Then
txtCLAIMCODEData.Text = claimCodePrefix + eClaim.ClaimCode
Else
txtCLAIMCODEData.Text = "@" + eClaim.ClaimCode
End If
btnRestore.Visible = False
Else
txtCLAIMCODEData.Text = "@" + eClaim.ClaimCode
txtCLAIMCODEData.Text = ""
End If
btnRestore.Visible = False
End If
Catch ex As Exception
imisgen.Alert(imisgen.getMessage("M_ERRORMESSAGE"), pnlButtons, alertPopupTitle:="IMIS")
Expand Down

0 comments on commit b497e5a

Please sign in to comment.