Decimal GetManAdjAmtCHG(int i, string yrmo, string exprCHG, string programcd, string plancode, string tier, string priortier) { Decimal amt = 0; Decimal amtprev, amtprev1, amtprev2, amtcur; string adjyrmo; IPBA_DAL dobj = new IPBA_DAL(); switch (exprCHG) { case "-1": amt = dobj.GetRate(yrmo, programcd, plancode, priortier); break; case "1": amt = dobj.GetRate(yrmo, programcd, plancode, tier); break; case "1-": adjyrmo = GetYRMO(yrmo, (-1)); amt = dobj.GetRate(yrmo, programcd, plancode, tier); break; case "A+1": adjyrmo = GetYRMO(yrmo, (-1)); amtcur = dobj.GetRate(yrmo, programcd, plancode, tier); amtprev = dobj.GetRate(adjyrmo, programcd, plancode, priortier); if (i == 1) { amt = dobj.GetRate(yrmo, programcd, plancode, tier); } else { amt = (amtcur - amtprev); } break; case "2A+1": adjyrmo = GetYRMO(yrmo, (-1)); amtcur = dobj.GetRate(yrmo, programcd, plancode, tier); amtprev = dobj.GetRate(adjyrmo, programcd, plancode, priortier); adjyrmo = GetYRMO(yrmo, (-2)); amtprev1 = dobj.GetRate(adjyrmo, programcd, plancode, priortier); if (i == 1) { amt = dobj.GetRate(yrmo, programcd, plancode, tier); } else if (i == 2) { amt = amtcur - amtprev; } else { amt = amtcur - amtprev1; } break; case "3A+1": adjyrmo = GetYRMO(yrmo, (-1)); amtcur = dobj.GetRate(yrmo, programcd, plancode, tier); amtprev = dobj.GetRate(adjyrmo, programcd, plancode, priortier); adjyrmo = GetYRMO(yrmo, (-2)); amtprev1 = dobj.GetRate(adjyrmo, programcd, plancode, priortier); adjyrmo = GetYRMO(yrmo, (-3)); amtprev2 = dobj.GetRate(adjyrmo, programcd, plancode, priortier); if (i == 1) { amt = dobj.GetRate(yrmo, programcd, plancode, tier); } else if (i == 2) { amt = amtcur - amtprev; } else if (i == 3) { amt = amtcur - amtprev1; } else { amt = amtcur - amtprev2; } break; } return(amt); }
DataSet GetCobraAdjustments(string yrmo, string plancode) { IPBA_DAL dobj = new IPBA_DAL(); System.Type typeDecimal = System.Type.GetType("System.Decimal"); DataSet dsTemp = new DataSet(); dsTemp.Clear(); DataSet dsCobAdj = new DataSet(); dsCobAdj.Clear(); DataTable tblCobAdj = dsCobAdj.Tables.Add("Table"); DataRow row1; DataColumn col; Decimal amt, amt1, rate, adjamt; String prevyrmo, comments, recordYrmo; Boolean found; int months; col = new DataColumn("Py"); tblCobAdj.Columns.Add(col); col = new DataColumn("Class"); tblCobAdj.Columns.Add(col); col = new DataColumn("Type"); tblCobAdj.Columns.Add(col); col = new DataColumn("SSN"); tblCobAdj.Columns.Add(col); col = new DataColumn("Name"); tblCobAdj.Columns.Add(col); col = new DataColumn("YRMO"); tblCobAdj.Columns.Add(col); col = new DataColumn("Tier"); tblCobAdj.Columns.Add(col); col = new DataColumn("Comments"); tblCobAdj.Columns.Add(col); col = new DataColumn("Months"); tblCobAdj.Columns.Add(col); col = new DataColumn("Rate", typeDecimal); tblCobAdj.Columns.Add(col); col = new DataColumn("typecd"); tblCobAdj.Columns.Add(col); dsTemp = dobj.GetCobraAdjData(yrmo, plancode); foreach (DataRow row in dsTemp.Tables[0].Rows) { amt = Decimal.Parse(row["Rate"].ToString()); if (amt == 0) { continue; } adjamt = amt; recordYrmo = row["CoveragePeriod"].ToString(); found = false; months = 1; for (int i = 1; i < 12; i++) { amt1 = (System.Math.Abs(amt)) / i; prevyrmo = IPBAImport.getPrevYRMO(i - 1, recordYrmo); rate = dobj.GetRate(prevyrmo, row["Class"].ToString(), plancode, row["Tier"].ToString()); if (rate.Equals(amt1)) { adjamt = (amt) / i; months = i; recordYrmo = prevyrmo; found = true; break; } } if (found) { if (amt > 0) { comments = "COBRA RETRO PAYMENT - EFF DT: " + row["Eff Dt"].ToString(); } else { comments = "COBRA RETRO CREDIT - EFF DT: " + row["Eff Dt"].ToString(); } } else { comments = "COBRA ADJUSTMENT - EFF DT: " + row["Eff Dt"].ToString(); } for (int j = 0; j < months; j++) { row1 = tblCobAdj.NewRow(); row1["Py"] = yrmo.Substring(0, 4); row1["Class"] = row["Class"]; row1["Type"] = row["Type"]; row1["SSN"] = row["SSN"]; row1["Name"] = row["Name"]; row1["YRMO"] = recordYrmo; row1["Tier"] = row["Tier"]; row1["Comments"] = comments; if (amt > 0) { row1["Months"] = 1; } else { row1["Months"] = -1; } row1["Rate"] = adjamt; row1["typecd"] = "RETRO"; tblCobAdj.Rows.Add(row1); } } dsTemp.Clear(); return(dsCobAdj); }
public DataSet GetSummaryRpt(string yrmo, string plancode) { IPBA_DAL dobj = new IPBA_DAL(); string tierexp; int count = 0; string[] typecds = { "STD", "CHG", "RETRO", "MANCHG", "MANRETRO" }; string[] programs = { "Active", "Active Pilot", "COBRA", "COBRA Pilot", "Retiree", "Retiree Pilot" }; string[] tiercds = { "E", "C", "S", "F" }; DataSet dsTemp = new DataSet(); dsTemp.Clear(); DataSet dsTemp1 = new DataSet(); dsTemp1.Clear(); DataSet dsSum = new DataSet(); dsSum.Clear(); System.Type typeDecimal = System.Type.GetType("System.Decimal"); System.Type typeInt = System.Type.GetType("System.Int32"); DataTable tblSum = dsSum.Tables.Add("Summary"); DataRow row; DataColumn col; col = new DataColumn("PlanYr"); tblSum.Columns.Add(col); col = new DataColumn("Classification"); tblSum.Columns.Add(col); col = new DataColumn("Coverage Tier"); tblSum.Columns.Add(col); col = new DataColumn("Emps", typeInt); tblSum.Columns.Add(col); col = new DataColumn("Rate", typeDecimal); tblSum.Columns.Add(col); col = new DataColumn("Total", typeDecimal); tblSum.Columns.Add(col); dsTemp = dobj.GetDetData(yrmo, plancode); dsTemp1 = dobj.GetAdjData(yrmo, plancode); dsTemp.Merge(dsTemp1); dsTemp1.Clear(); dsTemp1 = GetCobraAdjustments(yrmo, plancode); dsTemp.Merge(dsTemp1); dsTemp1.Clear(); dsTemp1 = GetManualAdjustments(yrmo, plancode); dsTemp.Merge(dsTemp1); dsTemp1.Clear(); foreach (string typecd in typecds) { foreach (string program in programs) { foreach (string tiercd in tiercds) { tierexp = GetTierExp(tiercd, program); count = GetEmpCount(typecd, program, tiercd, dsTemp); if (count != 0) { row = tblSum.NewRow(); row["PlanYr"] = yrmo.Substring(0, 4); row["Classification"] = GetClassification(typecd, program); row["Coverage Tier"] = tierexp; row["Emps"] = count; row["Rate"] = dobj.GetRate(yrmo, program, plancode, tiercd); if (typecd.Equals("CHG") || typecd.Equals("MANCHG")) { row["Total"] = count * dobj.GetRate(yrmo, program, plancode, tiercd); } else { row["Total"] = GetTotalAmt(typecd, program, tiercd, dsTemp); } tblSum.Rows.Add(row); } if (typecd.Equals("CHG") || typecd.Equals("MANCHG")) { tierexp = GetTierExp(tiercd, program); count = GetEmpCountPriorCHG(typecd, program, tiercd, dsTemp); if (count != 0) { row = tblSum.NewRow(); row["PlanYr"] = yrmo.Substring(0, 4); row["Classification"] = GetClassification(typecd, program); row["Coverage Tier"] = tierexp; row["Emps"] = (-1) * count; row["Rate"] = dobj.GetRate(yrmo, program, plancode, tiercd); row["Total"] = (-1) * count * dobj.GetRate(yrmo, program, plancode, tiercd); tblSum.Rows.Add(row); } } } count = GetEmpCount(typecd, program, dsTemp); if (count != 0) { row = tblSum.NewRow(); row["Classification"] = "***"; row["Coverage Tier"] = "SUB TOTAL:"; row["Emps"] = GetSumEmpCount(GetClassification(typecd, program), dsSum); row["Total"] = GetTotalAmt(typecd, program, dsTemp); tblSum.Rows.Add(row); } } } if (tblSum.Rows.Count > 0) { row = tblSum.NewRow(); row["Classification"] = "*****"; row["Coverage Tier"] = "GRAND TOTAL:"; row["Emps"] = GetSumEmpCount(dsSum); row["Total"] = GetTotalAmt(dsTemp); tblSum.Rows.Add(row); } return(dsSum); }
DataSet GetManualAdjustments(string yrmo, string plancode) { IPBA_DAL dobj = new IPBA_DAL(); WashRules wobj = new WashRules(); DataSet dsTemp = new DataSet(); dsTemp.Clear(); DataSet dsManAdj = new DataSet(); dsManAdj.Clear(); DataTable tblManAdj = dsManAdj.Tables.Add("Table"); DataRow row1; DataColumn col; System.Type typeDecimal = System.Type.GetType("System.Decimal"); col = new DataColumn("Py"); tblManAdj.Columns.Add(col); col = new DataColumn("Class"); tblManAdj.Columns.Add(col); col = new DataColumn("Type"); tblManAdj.Columns.Add(col); col = new DataColumn("SSN"); tblManAdj.Columns.Add(col); col = new DataColumn("Name"); tblManAdj.Columns.Add(col); col = new DataColumn("YRMO"); tblManAdj.Columns.Add(col); col = new DataColumn("PriorTier"); tblManAdj.Columns.Add(col); col = new DataColumn("Tier"); tblManAdj.Columns.Add(col); col = new DataColumn("Comments"); tblManAdj.Columns.Add(col); col = new DataColumn("Months"); tblManAdj.Columns.Add(col); col = new DataColumn("Rate", typeDecimal); tblManAdj.Columns.Add(col); col = new DataColumn("typecd"); tblManAdj.Columns.Add(col); col = new DataColumn("flag"); tblManAdj.Columns.Add(col); DateTime effdt; string exprCHG, yrmocalc; int months; string _flag = ""; dsTemp = dobj.GetManAdjData(yrmo, plancode, "NEW"); foreach (DataRow row in dsTemp.Tables[0].Rows) { effdt = Convert.ToDateTime(row["Eff Dt"]); months = wobj.washRuleADD(effdt, yrmo, plancode); _flag = ""; if (MaxMonExceeded(plancode, "NEW", yrmo, effdt)) { _flag = "*"; } if (months != 0) { for (int i = 1; i <= months; i++) { row1 = tblManAdj.NewRow(); row1["Py"] = yrmo.Substring(0, 4); row1["Class"] = row["Class"]; row1["Type"] = row["Type"]; row1["SSN"] = row["SSN"]; row1["Name"] = row["Name"]; row1["YRMO"] = GetYRMO(yrmo, (i - 1)); row1["Tier"] = row["Tier"]; if (row["Class"].ToString().Equals("COBRA") || row["Class"].ToString().Equals("COBRA Pilot")) { if (row["Comments"].ToString().Contains("NEW ENROLLEE EFF: ")) { row1["Comments"] = row["Comments"].ToString().Replace("NEW ENROLLEE EFF: ", "COBRA RETRO PAYMENT - EFF DT: "); } else { row1["Comments"] = row["Comments"].ToString().Replace("RETRO CVG EFF: ", "COBRA RETRO PAYMENT - EFF DT: "); } } else { row1["Comments"] = row["Comments"]; } row1["Months"] = 1; row1["Rate"] = dobj.GetRate(GetYRMO(yrmo, (i - 1)), row["Class"].ToString(), plancode, row["Tier"].ToString()); row1["typecd"] = row["typecd"]; row1["flag"] = _flag; tblManAdj.Rows.Add(row1); } } } dsTemp.Clear(); dsTemp = dobj.GetManAdjData(yrmo, plancode, "TERM"); foreach (DataRow row in dsTemp.Tables[0].Rows) { effdt = Convert.ToDateTime(row["Eff Dt"]); months = wobj.washRuleTERM(effdt, yrmo, plancode); _flag = ""; if (MaxMonExceeded(plancode, "TERM", yrmo, effdt)) { _flag = "*"; } if (months != 0) { for (int i = 1; i <= System.Math.Abs(months); i++) { if (months < 0) { yrmocalc = GetYRMO(yrmo, i); } else { yrmocalc = yrmo; } row1 = tblManAdj.NewRow(); row1["Py"] = yrmo.Substring(0, 4); row1["Class"] = row["Class"]; row1["Type"] = row["Type"]; row1["SSN"] = row["SSN"]; row1["Name"] = row["Name"]; row1["YRMO"] = yrmocalc; row1["Tier"] = row["Tier"]; if (row["Class"].ToString().Equals("COBRA") || row["Class"].ToString().Equals("COBRA Pilot")) { if (months < 0) { row1["Comments"] = row["Comments"].ToString().Replace("TERMINATED CVG EFF: ", "COBRA RETRO CREDIT - EFF DT: "); } else { row1["Comments"] = row["Comments"].ToString().Replace("TERMINATED CVG EFF: ", "COBRA RETRO PAYMENT - EFF DT: "); } } else { row1["Comments"] = row["Comments"]; } if (months < 0) { row1["Months"] = -1; row1["Rate"] = (-1) * dobj.GetRate(yrmocalc, row["Class"].ToString(), plancode, row["Tier"].ToString()); } else { row1["Months"] = 1; row1["Rate"] = dobj.GetRate(yrmocalc, row["Class"].ToString(), plancode, row["Tier"].ToString()); } row1["typecd"] = row["typecd"]; row1["flag"] = _flag; tblManAdj.Rows.Add(row1); } } } dsTemp.Clear(); dsTemp = dobj.GetManAdjData(yrmo, plancode, "CHG"); foreach (DataRow row in dsTemp.Tables[0].Rows) { effdt = Convert.ToDateTime(row["Eff Dt"]); exprCHG = wobj.washRuleCHG(effdt, yrmo, plancode); months = GetMonthsManAdjCHG(exprCHG); _flag = ""; if (MaxMonExceeded(plancode, "CHG", yrmo, effdt)) { _flag = "*"; } for (int i = 1; i <= months; i++) { row1 = tblManAdj.NewRow(); row1["Py"] = yrmo.Substring(0, 4); row1["Class"] = row["Class"]; row1["Type"] = row["Type"]; row1["SSN"] = row["SSN"]; row1["Name"] = row["Name"]; row1["YRMO"] = GetYRMO(yrmo, (i - 1)); row1["PriorTier"] = row["PriorTier"]; row1["Tier"] = row["Tier"]; row1["Comments"] = row["Comments"]; row1["Months"] = 1; row1["Rate"] = GetManAdjAmtCHG(i, yrmo, exprCHG, row["Class"].ToString(), plancode, row["Tier"].ToString(), row["PriorTier"].ToString()); row1["typecd"] = row["typecd"]; row1["flag"] = _flag; tblManAdj.Rows.Add(row1); if (exprCHG.Equals("1-")) { continue; } } } dsTemp.Clear(); return(dsManAdj); }