-
Notifications
You must be signed in to change notification settings - Fork 0
/
PatChrgChanges.cs
130 lines (121 loc) · 4.38 KB
/
PatChrgChanges.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Configuration;
using OleDBDataManager;
namespace PCUConsole
{
class PatChrgChanges : PCUCost
{//PatChrgChanges is invoked when the user clicks the "Annual GetItemChanges" button on the PatientChargeUpdate UI
#region Class Variables
private NameValueCollection ConfigData = null;
private string connectStr = "";
#region Parameters
public Hashtable DollarLimits
{
set { dollarLimits = value; }
}
public Hashtable MultiplierValu
{
set { multiplierValu = value; }
}
public string Location
{
set { location = value; }
}
public string ConnectString
{
set { connectStr = value; }
}
public string SQLSelect
{
set { sqlSelect = value; }
}
public bool Verbose
{
set { verbose = value; }
}
public bool Debug
{
set { debug = value; }
}
#endregion
#endregion
public PatChrgChanges()
{
if (trace) lm.Write("TRACE: PatChrgChanges.PatChrgChanges(constructor)");
// /////PRODUCTION HERE...
ODMDataSetFactory = new ODMDataFactory();
ConfigData = (NameValueCollection)ConfigurationSettings.GetConfig("PatientChargeUpdate");
biAdminConnectStr = ConfigData.Get("cnctBIAdmin");
mpousConnectStr = ConfigData.Get("cnctMPOUS");
OkToUpdate = Convert.ToBoolean(ConfigData.Get("updateTables"));
/// ///// ... to HERE
}
public void SetNewPatientCharges()
{//FULL UPDATE
if (trace) lm.Write("TRACE: PatChrgChanges.SetNewPatientCharges()");
uwmConnectStr = connectStr;
try
{
if (itemCost.Tables.Count < 1)
{
GetCurrentItemCost();
if (verbose)
Console.WriteLine(itemCost.Tables[0].Rows.Count + " records" + Environment.NewLine +
"Calculating New Prices");
}
if (patientPrice.Count == 0)
CalculatePrice();
//if (location.Equals("mpous")) ///////////////redirects to MPOUS changes
// UpdateMPOUSCharges();
else
{
UpdatePatientCharge();
}
}
catch (Exception ex)
{
lm.Write(ex.Message);
}
}
private void UpdateMPOUSCharges()
{
//if (trace) lm.Write("TRACE: PatChrgChanges.UpdateMPOUSCharges()");
//PointOfUse pou = new PointOfUse();
//pou.Verbose = verbose;
//pou.Debug = debug;
//pou.PriceToPatient = patientPrice; //key= HEMM item_id value= new PatPrice
//pou.ProcessMPOUSChanges();
//pou.RefreshPreviousValues();
}
private void UpdatePatientCharge()
{//FULL UPDATE
if (trace) lm.Write("TRACE: PatChrgChanges.UpdatePatientCharge()");
PatientCharges pc = new PatientCharges();
if (debug)
pc.ConnectStr = biAdminConnectStr; //use for TEST
else
{
pc.ConnectStr = ConfigData.Get("cnctHEMM_HMC"); //////// USE THIS FOR PRODUCTION
}
pc.PatientPrice = patientPrice;
pc.Debug = debug;
pc.Trace = trace;
pc.Verbose = verbose;
// pc.UpdateCharges(); //Used to test this application - COMMENT OUT TO PREVENT UPDATING uwm_BIAdmin.dbo.uwm_SLOC_ITEM -
if (OkToUpdate)
{
pc.UpdateCharges();
RefreshPreviousValuTable();
}
else
{
foreach (int itemID in patientPrice.Keys)
{
lm.Write("UPDATE VALUE:" + TAB + "(id-PC$) " + itemID.ToString() + TAB + pc.FormatDollarValue(patientPrice[itemID].ToString()));
}
}
}
}
}