From 38853f048a24e4236a164f7567612d8211ddc602 Mon Sep 17 00:00:00 2001 From: sniedzielski Date: Tue, 7 Jun 2022 13:52:42 +0200 Subject: [PATCH 1/2] OP-735: fixed 'restoring claim' functionality --- IMIS/Claim.aspx.vb | 55 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/IMIS/Claim.aspx.vb b/IMIS/Claim.aspx.vb index ce1ee250..711d2dbc 100644 --- a/IMIS/Claim.aspx.vb +++ b/IMIS/Claim.aspx.vb @@ -537,7 +537,9 @@ Partial Public Class Claim Return "Continue" End Function Private Sub B_SAVE_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles B_SAVE.Click + Dim eClaimBeforeRestore As New IMIS_EN.tblClaim Dim chkSaveClaimItems, chkSaveClaim, chkSaveClaimServices As Integer + Dim oldClaimId As Integer eClaim.ClaimID = hfClaimID.Value If CType(Me.Master.FindControl("hfDirty"), HiddenField).Value = True Then @@ -550,6 +552,10 @@ 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' + 'eClaimBeforeRestore = eClaim' + oldClaimId = eClaim.ClaimID + eClaim.ClaimID = 0 If Not eClaim.ClaimStatus = 1 Then eClaim.ClaimStatus = 2 eClaim.ReviewStatus = 1 @@ -763,6 +769,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 @@ -980,12 +1023,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") From 058196aeab01c9c8c7947a13ca38acd26c7a8239 Mon Sep 17 00:00:00 2001 From: sniedzielski Date: Tue, 7 Jun 2022 13:54:27 +0200 Subject: [PATCH 2/2] OP-735: removed unused variable --- IMIS/Claim.aspx.vb | 2 -- 1 file changed, 2 deletions(-) diff --git a/IMIS/Claim.aspx.vb b/IMIS/Claim.aspx.vb index 711d2dbc..6cb0c8f0 100644 --- a/IMIS/Claim.aspx.vb +++ b/IMIS/Claim.aspx.vb @@ -537,7 +537,6 @@ Partial Public Class Claim Return "Continue" End Function Private Sub B_SAVE_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles B_SAVE.Click - Dim eClaimBeforeRestore As New IMIS_EN.tblClaim Dim chkSaveClaimItems, chkSaveClaim, chkSaveClaimServices As Integer Dim oldClaimId As Integer eClaim.ClaimID = hfClaimID.Value @@ -553,7 +552,6 @@ Partial Public Class Claim 'Starts If CInt(Session("RestoreMode")) = True Then 'In all cases for restoring claims the initial claim must be unchanged' - 'eClaimBeforeRestore = eClaim' oldClaimId = eClaim.ClaimID eClaim.ClaimID = 0 If Not eClaim.ClaimStatus = 1 Then