//MWTRN EXECUTE PROCEDURE sp_ModifyTableProperty( 'MWTRN', 'Table_Auto_Create', 'False', 'APPEND_FAIL', 'MWTRNfail'); EXECUTE PROCEDURE sp_ModifyTableProperty( 'MWTRN', 'Table_Permission_Level', '2', 'APPEND_FAIL', 'MWTRNfail'); EXECUTE PROCEDURE sp_ModifyTableProperty( 'MWTRN', 'Triggers_Disabled', 'False', 'APPEND_FAIL', 'MWTRNfail'); EXECUTE PROCEDURE sp_ModifyTableProperty( 'MWTRN', 'Table_Trans_Free', 'False', 'APPEND_FAIL', 'MWTRNfail'); EXECUTE PROCEDURE sp_ModifyTableProperty( 'MWTRN', 'Table_WEB_delta', 'False', 'APPEND_FAIL', 'MWTRNfail'); //Triggers CREATE TRIGGER MWTRNUPDATE_AUD ON MWTRN BEFORE UPDATE BEGIN Declare NC Cursor as Select * from __New; Declare OC Cursor as Select * from __Old; Declare nString String; Declare oString String; Declare @UName String; Declare iIdx Integer; Open NC; Fetch NC; Open OC; Fetch OC; Set nString = (Select User() from System.iota); iIdx = POSITION('mwmw' IN nString); IF (iIdx > 1) THEN nString = SUBSTRING(nString, 1, iIdx-1); ENDIF; Set @UName = nString; --(Select User() from System.iota); Set nString = ''; Set nString = nString + 'Entry: "' + Trim(Convert(OC.[Entry Number], SQL_Char)) + '" '; Set nString = nString + 'Chart Number: "' + Trim(OC.[Chart Number]) + '" '; Set nString = nString + 'Procedure: "' + Trim(OC.[Procedure Code]) + '" '; Set nString = nString + 'Amount: "' + Trim(Convert(OC.[Amount], SQL_Char)) + '"'; if (OC.[Case Number] <> NC.[Case Number]) then Set nString = nString + char(9) + 'Case Number: "' + Trim(Convert(OC.[Case Number], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Case Number], SQL_Char)) + '"'; endif; if (OC.[Claim Number] <> NC.[Claim Number]) then Set nString = nString + char(9) + 'Claim Number: "' + Trim(Convert(OC.[Claim Number], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Claim Number], SQL_Char)) + '"'; endif; if (OC.[Date From] <> NC.[Date From]) then Set nString = nString + char(9) + 'Date From: "' + Trim(Convert(OC.[Date From], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Date From], SQL_Char)) + '"'; endif; if (OC.[Date To] <> NC.[Date To]) then Set nString = nString + char(9) + 'Date To: "' + Trim(Convert(OC.[Date To], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Date To], SQL_Char)) + '"'; endif; if (OC.[Document Number] <> NC.[Document Number]) then Set nString = nString + char(9) + 'Document Number: "' + Trim(OC.[Document Number]) + '" changed to "' + Trim(NC.[Document Number]) + '"'; endif; if (OC.[Description] <> NC.[Description]) then Set nString = nString + char(9) + 'Description: "' + Trim(OC.[Description]) + '" changed to "' + Trim(NC.[Description]) + '"'; endif; if (OC.[Attending Provider] <> NC.[Attending Provider]) then Set nString = nString + char(9) + 'Attending Provider: "' + Trim(OC.[Attending Provider]) + '" changed to "' + Trim(NC.[Attending Provider]) + '"'; endif; if (OC.[Procedure Code] <> NC.[Procedure Code]) then Set nString = nString + char(9) + 'Procedure Code: "' + Trim(OC.[Procedure Code]) + '" changed to "' + Trim(NC.[Procedure Code]) + '"'; endif; if (OC.[Transaction Type] <> NC.[Transaction Type]) then Set nString = nString + char(9) + 'Transaction Type: "' + Trim(OC.[Transaction Type]) + '" changed to "' + Trim(NC.[Transaction Type]) + '"'; endif; if (OC.[Insurance Category] <> NC.[Insurance Category]) then Set nString = nString + char(9) + 'Insurance Category: "' + Trim(OC.[Insurance Category]) + '" changed to "' + Trim(NC.[Insurance Category]) + '"'; endif; if (OC.[Modifier 1] <> NC.[Modifier 1]) then Set nString = nString + char(9) + 'Modifier 1: "' + Trim(OC.[Modifier 1]) + '" changed to "' + Trim(NC.[Modifier 1]) + '"'; endif; if (OC.[Modifier 2] <> NC.[Modifier 2]) then Set nString = nString + char(9) + 'Modifier 2: "' + Trim(OC.[Modifier 2]) + '" changed to "' + Trim(NC.[Modifier 2]) + '"'; endif; if (OC.[Modifier 3] <> NC.[Modifier 3]) then Set nString = nString + char(9) + 'Modifier 3: "' + Trim(OC.[Modifier 3]) + '" changed to "' + Trim(NC.[Modifier 3]) + '"'; endif; if (OC.[Modifier 4] <> NC.[Modifier 4]) then Set nString = nString + char(9) + 'Modifier 4: "' + Trim(OC.[Modifier 4]) + '" changed to "' + Trim(NC.[Modifier 4]) + '"'; endif; if (OC.[Place of Service] <> NC.[Place of Service]) then Set nString = nString + char(9) + 'Place of Service: "' + Trim(OC.[Place of Service]) + '" changed to "' + Trim(NC.[Place of Service]) + '"'; endif; if (OC.[Type of Service] <> NC.[Type of Service]) then Set nString = nString + char(9) + 'Type of Service: "' + Trim(OC.[Type of Service]) + '" changed to "' + Trim(NC.[Type of Service]) + '"'; endif; if (OC.[Visit Number] <> NC.[Visit Number]) then Set nString = nString + char(9) + 'Visit Number: "' + Trim(Convert(OC.[Visit Number], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Visit Number], SQL_Char)) + '"'; endif; if (OC.[Visit Total in Series] <> NC.[Visit Total in Series]) then Set nString = nString + char(9) + 'Visit Total in Series: "' + Trim(Convert(OC.[Visit Total in Series], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Visit Total in Series], SQL_Char)) + '"'; endif; if (OC.[Visit Series ID] <> NC.[Visit Series ID]) then Set nString = nString + char(9) + 'Visit Series ID: "' + Trim(OC.[Visit Series ID]) + '" changed to "' + Trim(NC.[Visit Series ID]) + '"'; endif; if (OC.[Units] <> NC.[Units]) then Set nString = nString + char(9) + 'Units: "' + Trim(Convert(OC.[Units], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Units], SQL_Char)) + '"'; endif; if (OC.[Minutes] <> NC.[Minutes]) then Set nString = nString + char(9) + 'Minutes: "' + Trim(Convert(OC.[Minutes], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Minutes], SQL_Char)) + '"'; endif; if (OC.[Amount] <> NC.[Amount]) then Set nString = nString + char(9) + 'Amount: "' + Trim(Convert(OC.[Amount], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Amount], SQL_Char)) + '"'; endif; if (OC.[Price Indicator] <> NC.[Price Indicator]) then Set nString = nString + char(9) + 'Price Indicator: "' + Trim(OC.[Price Indicator]) + '" changed to "' + Trim(NC.[Price Indicator]) + '"'; endif; if (OC.[Diagnosis 1] <> NC.[Diagnosis 1]) then if (OC.[Diagnosis 1] = True) then Set nString = nString + char(9) + 'Diagnosis 1: "True" changed to "False"'; else Set nString = nString + char(9) + 'Diagnosis 1: "False" changed to "True"'; endif; endif; if (OC.[Diagnosis 2] <> NC.[Diagnosis 2]) then if (OC.[Diagnosis 2] = True) then Set nString = nString + char(9) + 'Diagnosis 2: "True" changed to "False"'; else Set nString = nString + char(9) + 'Diagnosis 2: "False" changed to "True"'; endif; endif; if (OC.[Diagnosis 3] <> NC.[Diagnosis 3]) then if (OC.[Diagnosis 3] = True) then Set nString = nString + char(9) + 'Diagnosis 3: "True" changed to "False"'; else Set nString = nString + char(9) + 'Diagnosis 3: "False" changed to "True"'; endif; endif; if (OC.[Diagnosis 4] <> NC.[Diagnosis 4]) then if (OC.[Diagnosis 4] = True) then Set nString = nString + char(9) + 'Diagnosis 4: "True" changed to "False"'; else Set nString = nString + char(9) + 'Diagnosis 4: "False" changed to "True"'; endif; endif; if (OC.[Claim Item Rejected] <> NC.[Claim Item Rejected]) then if (OC.[Claim Item Rejected] = True) then Set nString = nString + char(9) + 'Claim Item Rejected: "True" changed to "False"'; else Set nString = nString + char(9) + 'Claim Item Rejected: "False" changed to "True"'; endif; endif; if (OC.[Accept Assignment 1] <> NC.[Accept Assignment 1]) then if (OC.[Accept Assignment 1] = True) then Set nString = nString + char(9) + 'Accept Assignment 1: "True" changed to "False"'; else Set nString = nString + char(9) + 'Accept Assignment 1: "False" changed to "True"'; endif; endif; if (OC.[Accept Assignment 2] <> NC.[Accept Assignment 2]) then if (OC.[Accept Assignment 2] = True) then Set nString = nString + char(9) + 'Accept Assignment 2: "True" changed to "False"'; else Set nString = nString + char(9) + 'Accept Assignment 2: "False" changed to "True"'; endif; endif; if (OC.[Accept Assignment 3] <> NC.[Accept Assignment 3]) then if (OC.[Accept Assignment 3] = True) then Set nString = nString + char(9) + 'Accept Assignment 3: "True" changed to "False"'; else Set nString = nString + char(9) + 'Accept Assignment 3: "False" changed to "True"'; endif; endif; if (OC.[Date of First Statement] <> NC.[Date of First Statement]) then Set nString = nString + char(9) + 'Date of First Statement: "' + Trim(Convert(OC.[Date of First Statement], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Date of First Statement], SQL_Char)) + '"'; endif; if (OC.[Date of Second Statement] <> NC.[Date of Second Statement]) then Set nString = nString + char(9) + 'Date of Second Statement: "' + Trim(Convert(OC.[Date of Second Statement], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Date of Second Statement], SQL_Char)) + '"'; endif; if (OC.[Date of Last Statement] <> NC.[Date of Last Statement]) then Set nString = nString + char(9) + 'Date of Last Statement: "' + Trim(Convert(OC.[Date of Last Statement], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Date of Last Statement], SQL_Char)) + '"'; endif; if (OC.[Billed to Insured 1] <> NC.[Billed to Insured 1]) then if (OC.[Billed to Insured 1] = True) then Set nString = nString + char(9) + 'Billed to Insured 1: "True" changed to "False"'; else Set nString = nString + char(9) + 'Billed to Insured 1: "False" changed to "True"'; endif; endif; if (OC.[Billed to Insured 2] <> NC.[Billed to Insured 2]) then if (OC.[Billed to Insured 2] = True) then Set nString = nString + char(9) + 'Billed to Insured 2: "True" changed to "False"'; else Set nString = nString + char(9) + 'Billed to Insured 2: "False" changed to "True"'; endif; endif; if (OC.[Billed to Insured 3] <> NC.[Billed to Insured 3]) then if (OC.[Billed to Insured 3] = True) then Set nString = nString + char(9) + 'Billed to Insured 3: "True" changed to "False"'; else Set nString = nString + char(9) + 'Billed to Insured 3: "False" changed to "True"'; endif; endif; if (OC.[Guarantor Paid] <> NC.[Guarantor Paid]) then if (OC.[Guarantor Paid] = True) then Set nString = nString + char(9) + 'Guarantor Paid: "True" changed to "False"'; else Set nString = nString + char(9) + 'Guarantor Paid: "False" changed to "True"'; endif; endif; if (OC.[Insurance 1 Paid] <> NC.[Insurance 1 Paid]) then if (OC.[Insurance 1 Paid] = True) then Set nString = nString + char(9) + 'Insurance 1 Paid: "True" changed to "False"'; else Set nString = nString + char(9) + 'Insurance 1 Paid: "False" changed to "True"'; endif; endif; if (OC.[Insurance 2 Paid] <> NC.[Insurance 2 Paid]) then if (OC.[Insurance 2 Paid] = True) then Set nString = nString + char(9) + 'Insurance 2 Paid: "True" changed to "False"'; else Set nString = nString + char(9) + 'Insurance 2 Paid: "False" changed to "True"'; endif; endif; if (OC.[Insurance 3 Paid] <> NC.[Insurance 3 Paid]) then if (OC.[Insurance 3 Paid] = True) then Set nString = nString + char(9) + 'Insurance 3 Paid: "True" changed to "False"'; else Set nString = nString + char(9) + 'Insurance 3 Paid: "False" changed to "True"'; endif; endif; if (OC.[Guarantor Amount Paid] <> NC.[Guarantor Amount Paid]) then Set nString = nString + char(9) + 'Guarantor Amount Paid: "' + Trim(Convert(OC.[Guarantor Amount Paid], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Guarantor Amount Paid], SQL_Char)) + '"'; endif; if (OC.[Insurance 1 Amount Paid] <> NC.[Insurance 1 Amount Paid]) then Set nString = nString + char(9) + 'Insurance 1 Amount Paid: "' + Trim(Convert(OC.[Insurance 1 Amount Paid], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Insurance 1 Amount Paid], SQL_Char)) + '"'; endif; if (OC.[Insurance 2 Amount Paid] <> NC.[Insurance 2 Amount Paid]) then Set nString = nString + char(9) + 'Insurance 2 Amount Paid: "' + Trim(Convert(OC.[Insurance 2 Amount Paid], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Insurance 2 Amount Paid], SQL_Char)) + '"'; endif; if (OC.[Insurance 3 Amount Paid] <> NC.[Insurance 3 Amount Paid]) then Set nString = nString + char(9) + 'Insurance 3 Amount Paid: "' + Trim(Convert(OC.[Insurance 3 Amount Paid], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Insurance 3 Amount Paid], SQL_Char)) + '"'; endif; if (OC.[Guarantor Responsible] <> NC.[Guarantor Responsible]) then if (OC.[Guarantor Responsible] = True) then Set nString = nString + char(9) + 'Guarantor Responsible: "True" changed to "False"'; else Set nString = nString + char(9) + 'Guarantor Responsible: "False" changed to "True"'; endif; endif; if (OC.[Insurance 1 Responsible] <> NC.[Insurance 1 Responsible]) then if (OC.[Insurance 1 Responsible] = True) then Set nString = nString + char(9) + 'Insurance 1 Responsible: "True" changed to "False"'; else Set nString = nString + char(9) + 'Insurance 1 Responsible: "False" changed to "True"'; endif; endif; if (OC.[Insurance 2 Responsible] <> NC.[Insurance 2 Responsible]) then if (OC.[Insurance 2 Responsible] = True) then Set nString = nString + char(9) + 'Insurance 2 Responsible: "True" changed to "False"'; else Set nString = nString + char(9) + 'Insurance 2 Responsible: "False" changed to "True"'; endif; endif; if (OC.[Insurance 3 Responsible] <> NC.[Insurance 3 Responsible]) then if (OC.[Insurance 3 Responsible] = True) then Set nString = nString + char(9) + 'Insurance 3 Responsible: "True" changed to "False"'; else Set nString = nString + char(9) + 'Insurance 3 Responsible: "False" changed to "True"'; endif; endif; if (OC.[Who Paid] <> NC.[Who Paid]) then Set nString = nString + char(9) + 'Who Paid: "' + Trim(OC.[Who Paid]) + '" changed to "' + Trim(NC.[Who Paid]) + '"'; endif; if (OC.[Documentation Type] <> NC.[Documentation Type]) then Set nString = nString + char(9) + 'Documentation Type: "' + Trim(OC.[Documentation Type]) + '" changed to "' + Trim(NC.[Documentation Type]) + '"'; endif; if (OC.[Attorney Paid] <> NC.[Attorney Paid]) then if (OC.[Attorney Paid] = True) then Set nString = nString + char(9) + 'Attorney Paid: "True" changed to "False"'; else Set nString = nString + char(9) + 'Attorney Paid: "False" changed to "True"'; endif; endif; if (OC.[Attorney Amount Paid] <> NC.[Attorney Amount Paid]) then Set nString = nString + char(9) + 'Attorney Amount Paid: "' + Trim(Convert(OC.[Attorney Amount Paid], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Attorney Amount Paid], SQL_Char)) + '"'; endif; if (OC.[Attorney Responsible] <> NC.[Attorney Responsible]) then if (OC.[Attorney Responsible] = True) then Set nString = nString + char(9) + 'Attorney Responsible: "True" changed to "False"'; else Set nString = nString + char(9) + 'Attorney Responsible: "False" changed to "True"'; endif; endif; if (OC.[Adjustment Amount] <> NC.[Adjustment Amount]) then Set nString = nString + char(9) + 'Adjustment Amount: "' + Trim(Convert(OC.[Adjustment Amount], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Adjustment Amount], SQL_Char)) + '"'; endif; if (OC.[User Code] <> NC.[User Code]) then Set nString = nString + char(9) + 'User Code: "' + Trim(OC.[User Code]) + '" changed to "' + Trim(NC.[User Code]) + '"'; endif; if (OC.[Allowed Amount] <> NC.[Allowed Amount]) then Set nString = nString + char(9) + 'Allowed Amount: "' + Trim(Convert(OC.[Allowed Amount], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Allowed Amount], SQL_Char)) + '"'; endif; if (OC.[Diagnosis Code 1] <> NC.[Diagnosis Code 1]) then Set nString = nString + char(9) + 'Diagnosis Code 1: "' + Trim(OC.[Diagnosis Code 1]) + '" changed to "' + Trim(NC.[Diagnosis Code 1]) + '"'; endif; if (OC.[Diagnosis Code 2] <> NC.[Diagnosis Code 2]) then Set nString = nString + char(9) + 'Diagnosis Code 2: "' + Trim(OC.[Diagnosis Code 2]) + '" changed to "' + Trim(NC.[Diagnosis Code 2]) + '"'; endif; if (OC.[Diagnosis Code 3] <> NC.[Diagnosis Code 3]) then Set nString = nString + char(9) + 'Diagnosis Code 3: "' + Trim(OC.[Diagnosis Code 3]) + '" changed to "' + Trim(NC.[Diagnosis Code 3]) + '"'; endif; if (OC.[Diagnosis Code 4] <> NC.[Diagnosis Code 4]) then Set nString = nString + char(9) + 'Diagnosis Code 4: "' + Trim(OC.[Diagnosis Code 4]) + '" changed to "' + Trim(NC.[Diagnosis Code 4]) + '"'; endif; if (OC.[CC Entry Number] <> NC.[CC Entry Number]) then Set nString = nString + char(9) + 'CC Entry Number: "' + Trim(Convert(OC.[CC Entry Number], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[CC Entry Number], SQL_Char)) + '"'; endif; if (OC.[Tooth Number] <> NC.[Tooth Number]) then Set nString = nString + char(9) + 'Tooth Number: "' + Trim(OC.[Tooth Number]) + '" changed to "' + Trim(NC.[Tooth Number]) + '"'; endif; if (OC.[Tooth Surface] <> NC.[Tooth Surface]) then Set nString = nString + char(9) + 'Tooth Surface: "' + Trim(OC.[Tooth Surface]) + '" changed to "' + Trim(NC.[Tooth Surface]) + '"'; endif; if (OC.[Mouth Quadrant] <> NC.[Mouth Quadrant]) then Set nString = nString + char(9) + 'Mouth Quadrant: "' + Trim(OC.[Mouth Quadrant]) + '" changed to "' + Trim(NC.[Mouth Quadrant]) + '"'; endif; if (OC.[Deposit ID] <> NC.[Deposit ID]) then Set nString = nString + char(9) + 'Deposit ID: "' + Trim(Convert(OC.[Deposit ID], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Deposit ID], SQL_Char)) + '"'; endif; if (OC.[Check Number] <> NC.[Check Number]) then Set nString = nString + char(9) + 'Check Number: "' + Trim(OC.[Check Number]) + '" changed to "' + Trim(NC.[Check Number]) + '"'; endif; if (OC.[Unapplied Amount] <> NC.[Unapplied Amount]) then Set nString = nString + char(9) + 'Unapplied Amount: "' + Trim(Convert(OC.[Unapplied Amount], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Unapplied Amount], SQL_Char)) + '"'; endif; if (OC.[Facility] <> NC.[Facility]) then Set nString = nString + char(9) + 'Facility: "' + Trim(OC.[Facility]) + '" changed to "' + Trim(NC.[Facility]) + '"'; endif; if (OC.[Procedure Description] <> NC.[Procedure Description]) then Set nString = nString + char(9) + 'Procedure Description: "' + Trim(OC.[Procedure Description]) + '" changed to "' + Trim(NC.[Procedure Description]) + '"'; endif; if (OC.[Diagnosis 1 Description] <> NC.[Diagnosis 1 Description]) then Set nString = nString + char(9) + 'Diagnosis 1 Description: "' + Trim(OC.[Diagnosis 1 Description]) + '" changed to "' + Trim(NC.[Diagnosis 1 Description]) + '"'; endif; if (OC.[Diagnosis 2 Description] <> NC.[Diagnosis 2 Description]) then Set nString = nString + char(9) + 'Diagnosis 2 Description: "' + Trim(OC.[Diagnosis 2 Description]) + '" changed to "' + Trim(NC.[Diagnosis 2 Description]) + '"'; endif; if (OC.[Diagnosis 3 Description] <> NC.[Diagnosis 3 Description]) then Set nString = nString + char(9) + 'Diagnosis 3 Description: "' + Trim(OC.[Diagnosis 3 Description]) + '" changed to "' + Trim(NC.[Diagnosis 3 Description]) + '"'; endif; if (OC.[Diagnosis 4 Description] <> NC.[Diagnosis 4 Description]) then Set nString = nString + char(9) + 'Diagnosis 4 Description: "' + Trim(OC.[Diagnosis 4 Description]) + '" changed to "' + Trim(NC.[Diagnosis 4 Description]) + '"'; endif; if (OC.[Statement Number] <> NC.[Statement Number]) then Set nString = nString + char(9) + 'Statement Number: "' + Trim(Convert(OC.[Statement Number], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Statement Number], SQL_Char)) + '"'; endif; if (OC.[Claim Rejection Code] <> NC.[Claim Rejection Code]) then Set nString = nString + char(9) + 'Claim Rejection Code: "' + Trim(OC.[Claim Rejection Code]) + '" changed to "' + Trim(NC.[Claim Rejection Code]) + '"'; endif; if (OC.[Copay_Status_Code] <> NC.[Copay_Status_Code]) then Set nString = nString + char(9) + 'Copay_Status_Code: "' + Trim(OC.[Copay_Status_Code]) + '" changed to "' + Trim(NC.[Copay_Status_Code]) + '"'; endif; if (OC.[Quantity_Qualifier] <> NC.[Quantity_Qualifier]) then Set nString = nString + char(9) + 'Quantity_Qualifier: "' + Trim(OC.[Quantity_Qualifier]) + '" changed to "' + Trim(NC.[Quantity_Qualifier]) + '"'; endif; if (OC.[Quantity] <> NC.[Quantity]) then Set nString = nString + char(9) + 'Quantity: "' + Trim(Convert(OC.[Quantity], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Quantity], SQL_Char)) + '"'; endif; if (OC.[Copayment_Required] <> NC.[Copayment_Required]) then if (OC.[Copayment_Required] = True) then Set nString = nString + char(9) + 'Copayment Required: "True" changed to "False"'; else Set nString = nString + char(9) + 'Copayment Required: "False" changed to "True"'; endif; endif; if (OC.[Copayment_Paid] <> NC.[Copayment_Paid]) then if (OC.[Copayment_Paid] = True) then Set nString = nString + char(9) + 'Copayment Paid: "True" changed to "False"'; else Set nString = nString + char(9) + 'Copayment Paid: "False" changed to "True"'; endif; endif; if (OC.[Copayment_Expected_Amount] <> NC.[Copayment_Expected_Amount]) then Set nString = nString + char(9) + 'Copayment Expected Amount: "' + Trim(Convert(OC.[Copayment_Expected_Amount], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Copayment_Expected_Amount], SQL_Char)) + '"'; endif; if (OC.[Copayment_Amount_Paid] <> NC.[Copayment_Amount_Paid]) then Set nString = nString + char(9) + 'Copayment Amount Paid: "' + Trim(Convert(OC.[Copayment_Amount_Paid], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[Copayment_Amount_Paid], SQL_Char)) + '"'; endif; if (OC.[Primary_RunID] <> NC.[Primary_RunID]) then Set nString = nString + char(9) + 'Primary Run ID: "' + Trim(OC.[Primary_RunID]) + '" changed to "' + Trim(NC.[Primary_RunID]) + '"'; endif; if (OC.[Secondary_RunID] <> NC.[Secondary_RunID]) then Set nString = nString + char(9) + 'Secondary Run ID: "' + Trim(OC.[Secondary_RunID]) + '" changed to "' + Trim(NC.[Secondary_RunID]) + '"'; endif; if (OC.[Tertiary_RunID] <> NC.[Tertiary_RunID]) then Set nString = nString + char(9) + 'Tertiary Run ID: "' + Trim(OC.[Tertiary_RunID]) + '" changed to "' + Trim(NC.[Tertiary_RunID]) + '"'; endif; if (OC.[Principal_Procedure] <> NC.[Principal_Procedure]) then if (OC.[Principal_Procedure] = True) then Set nString = nString + char(9) + 'Principal Procedure: "True" changed to "False"'; else Set nString = nString + char(9) + 'Principal Procedure: "False" changed to "True"'; endif; endif; if (OC.[Diagnosis_Code5] <> NC.[Diagnosis_Code5]) then Set nString = nString + char(9) + 'Diagnosis Code 5: "' + Trim(OC.[Diagnosis_Code5]) + '" changed to "' + Trim(NC.[Diagnosis_Code5]) + '"'; endif; if (OC.[Diagnosis_Code6] <> NC.[Diagnosis_Code6]) then Set nString = nString + char(9) + 'Diagnosis Code 6: "' + Trim(OC.[Diagnosis_Code6]) + '" changed to "' + Trim(NC.[Diagnosis_Code6]) + '"'; endif; if (OC.[Diagnosis_Code7] <> NC.[Diagnosis_Code7]) then Set nString = nString + char(9) + 'Diagnosis Code 7: "' + Trim(OC.[Diagnosis_Code7]) + '" changed to "' + Trim(NC.[Diagnosis_Code7]) + '"'; endif; if (OC.[Diagnosis_Code8] <> NC.[Diagnosis_Code8]) then Set nString = nString + char(9) + 'Diagnosis Code 8: "' + Trim(OC.[Diagnosis_Code8]) + '" changed to "' + Trim(NC.[Diagnosis_Code8]) + '"'; endif; if (OC.[Diagnosis_5] <> NC.[Diagnosis_5]) then if (OC.[Diagnosis_5] = True) then Set nString = nString + char(9) + 'Diagnosis 5: "True" changed to "False"'; else Set nString = nString + char(9) + 'Diagnosis 5: "False" changed to "True"'; endif; endif; if (OC.[Diagnosis_6] <> NC.[Diagnosis_6]) then if (OC.[Diagnosis_6] = True) then Set nString = nString + char(9) + 'Diagnosis 6: "True" changed to "False"'; else Set nString = nString + char(9) + 'Diagnosis 6: "False" changed to "True"'; endif; endif; if (OC.[Diagnosis_7] <> NC.[Diagnosis_7]) then if (OC.[Diagnosis_7] = True) then Set nString = nString + char(9) + 'Diagnosis 7: "True" changed to "False"'; else Set nString = nString + char(9) + 'Diagnosis 7: "False" changed to "True"'; endif; endif; if (OC.[Diagnosis_8] <> NC.[Diagnosis_8]) then if (OC.[Diagnosis_8] = True) then Set nString = nString + char(9) + 'Diagnosis 8: "True" changed to "False"'; else Set nString = nString + char(9) + 'Diagnosis 8: "False" changed to "True"'; endif; endif; if (OC.[UB04_Box49] <> NC.[UB04_Box49]) then Set nString = nString + char(9) + 'UB04 Box 49: "' + Trim(OC.[UB04_Box49]) + '" changed to "' + Trim(NC.[UB04_Box49]) + '"'; endif; if (OC.[Diagnosis_5_Description] <> NC.[Diagnosis_5_Description]) then Set nString = nString + char(9) + 'Diagnosis 5 Description: "' + Trim(OC.[Diagnosis_5_Description]) + '" changed to "' + Trim(NC.[Diagnosis_5_Description]) + '"'; endif; if (OC.[Diagnosis_6_Description] <> NC.[Diagnosis_6_Description]) then Set nString = nString + char(9) + 'Diagnosis 6 Description: "' + Trim(OC.[Diagnosis_6_Description]) + '" changed to "' + Trim(NC.[Diagnosis_6_Description]) + '"'; endif; if (OC.[Diagnosis_7_Description] <> NC.[Diagnosis_7_Description]) then Set nString = nString + char(9) + 'Diagnosis 7 Description: "' + Trim(OC.[Diagnosis_7_Description]) + '" changed to "' + Trim(NC.[Diagnosis_7_Description]) + '"'; endif; if (OC.[Diagnosis_8_Description] <> NC.[Diagnosis_8_Description]) then Set nString = nString + char(9) + 'Diagnosis 8 Description: "' + Trim(OC.[Diagnosis_8_Description]) + '" changed to "' + Trim(NC.[Diagnosis_8_Description]) + '"'; endif; if (OC.[Diagnosis_Code1_POA] <> NC.[Diagnosis_Code1_POA]) then Set nString = nString + char(9) + 'Diagnosis Code 1 POA: "' + Trim(OC.[Diagnosis_Code1_POA]) + '" changed to "' + Trim(NC.[Diagnosis_Code1_POA]) + '"'; endif; if (OC.[Diagnosis_Code2_POA] <> NC.[Diagnosis_Code2_POA]) then Set nString = nString + char(9) + 'Diagnosis Code 2 POA: "' + Trim(OC.[Diagnosis_Code2_POA]) + '" changed to "' + Trim(NC.[Diagnosis_Code2_POA]) + '"'; endif; if (OC.[Diagnosis_Code3_POA] <> NC.[Diagnosis_Code3_POA]) then Set nString = nString + char(9) + 'Diagnosis Code 3 POA: "' + Trim(OC.[Diagnosis_Code3_POA]) + '" changed to "' + Trim(NC.[Diagnosis_Code3_POA]) + '"'; endif; if (OC.[Diagnosis_Code4_POA] <> NC.[Diagnosis_Code4_POA]) then Set nString = nString + char(9) + 'Diagnosis Code 4 POA: "' + Trim(OC.[Diagnosis_Code4_POA]) + '" changed to "' + Trim(NC.[Diagnosis_Code4_POA]) + '"'; endif; if (OC.[Diagnosis_Code5_POA] <> NC.[Diagnosis_Code5_POA]) then Set nString = nString + char(9) + 'Diagnosis Code 5 POA: "' + Trim(OC.[Diagnosis_Code5_POA]) + '" changed to "' + Trim(NC.[Diagnosis_Code5_POA]) + '"'; endif; if (OC.[Diagnosis_Code6_POA] <> NC.[Diagnosis_Code6_POA]) then Set nString = nString + char(9) + 'Diagnosis Code 6 POA: "' + Trim(OC.[Diagnosis_Code6_POA]) + '" changed to "' + Trim(NC.[Diagnosis_Code6_POA]) + '"'; endif; if (OC.[Diagnosis_Code7_POA] <> NC.[Diagnosis_Code7_POA]) then Set nString = nString + char(9) + 'Diagnosis Code 7 POA: "' + Trim(OC.[Diagnosis_Code7_POA]) + '" changed to "' + Trim(NC.[Diagnosis_Code7_POA]) + '"'; endif; if (OC.[Diagnosis_Code8_POA] <> NC.[Diagnosis_Code8_POA]) then Set nString = nString + char(9) + 'Diagnosis Code 8 POA: "' + Trim(OC.[Diagnosis_Code8_POA]) + '" changed to "' + Trim(NC.[Diagnosis_Code8_POA]) + '"'; endif; if (OC.[Primary_UB_Not_Covered] <> NC.[Primary_UB_Not_Covered]) then if (OC.[Primary_UB_Not_Covered] = True) then Set nString = nString + char(9) + 'Primary UB Not Covered: "True" changed to "False"'; else Set nString = nString + char(9) + 'Primary UB Not Covered: "False" changed to "True"'; endif; endif; if (OC.[Secondary_UB_Not_Covered] <> NC.[Secondary_UB_Not_Covered]) then if (OC.[Secondary_UB_Not_Covered] = True) then Set nString = nString + char(9) + 'Secondary UB Not Covered: "True" changed to "False"'; else Set nString = nString + char(9) + 'Secondary UB Not Covered: "False" changed to "True"'; endif; endif; if (OC.[Tertiary_UB_Not_Covered] <> NC.[Tertiary_UB_Not_Covered]) then if (OC.[Tertiary_UB_Not_Covered] = True) then Set nString = nString + char(9) + 'Tertiary UB Not Covered: "True" changed to "False"'; else Set nString = nString + char(9) + 'Tertiary UB Not Covered: "False" changed to "True"'; endif; endif; if (OC.[Revenue_Code] <> NC.[Revenue_Code]) then Set nString = nString + char(9) + 'Revenue Code: "' + Trim(OC.[Revenue_Code]) + '" changed to "' + Trim(NC.[Revenue_Code]) + '"'; endif; if (OC.[NDCCode] <> NC.[NDCCode]) then Set nString = nString + char(9) + 'NDC Code: "' + Trim(OC.[NDCCode]) + '" changed to "' + Trim(NC.[NDCCode]) + '"'; endif; if (OC.[NDCUnitPrice] <> NC.[NDCUnitPrice]) then Set nString = nString + char(9) + 'NDC Unit Price: "' + Trim(Convert(OC.[NDCUnitPrice], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[NDCUnitPrice], SQL_Char)) + '"'; endif; if (OC.[NDCUnitCount] <> NC.[NDCUnitCount]) then Set nString = nString + char(9) + 'NDC Unit Count: "' + Trim(Convert(OC.[NDCUnitCount], SQL_Char)) + '" changed to "' + Trim(Convert(NC.[NDCUnitCount], SQL_Char)) + '"'; endif; if (OC.[NDCUnitMeasurement] <> NC.[NDCUnitMeasurement]) then Set nString = nString + char(9) + 'NDC Unit Measurement: "' + Trim(OC.[NDCUnitMeasurement]) + '" changed to "' + Trim(NC.[NDCUnitMeasurement]) + '"'; endif; if (OC.[NDCPrescriptionNumber] <> NC.[NDCPrescriptionNumber]) then Set nString = nString + char(9) + 'NDC Prescription Number: "' + Trim(OC.[NDCPrescriptionNumber]) + '" changed to "' + Trim(NC.[NDCPrescriptionNumber]) + '"'; endif; Insert into MWAudM([Table], [User], [Action], NDCApplication, [Chart Number], [Date Modified], Details) Values('Transaction', @UName, 'UPDATE', 0, Trim(OC.[Chart Number]), Now(), nString); END PRIORITY 1; CREATE TRIGGER MWTRNDELETE_AUD ON MWTRN BEFORE DELETE BEGIN Declare OC Cursor as Select * from __Old; Declare nString String; Declare @UName String; Declare iIdx Integer; Open OC; Fetch OC; Set nString = (Select User() from System.iota); iIdx = POSITION('mwmw' IN nString); IF (iIdx > 1) THEN nString = SUBSTRING(nString, 1, iIdx-1); ENDIF; Set @UName = nString; --(Select User() from System.iota); Set nString = ''; Set nString = nString + 'Entry: "' + Trim(Convert(OC.[Entry Number], SQL_Char)) + '" '; Set nString = nString + 'Chart Number: "' + Trim(OC.[Chart Number]) + '" '; Set nString = nString + 'Procedure: "' + Trim(OC.[Procedure Code]) + '" '; Set nString = nString + 'Amount: "' + Trim(Convert(OC.[Amount], SQL_Char)) + '"'; Insert into MWAudM([Table], [User], [Action], NDCApplication, [Chart Number], [Date Modified], Details) Values('Transaction', @UName, 'DELETE', 0, Trim(OC.[Chart Number]), Now(), nString); END PRIORITY 1;