public ActionResult PaymentTypeCustomTable(long?contractId, long?serviceTypeId, int paymentTypeId, bool isEdit)
        {
            PaymentTypeCustomTableViewModel paymentTypeCustomTableViewModel = new PaymentTypeCustomTableViewModel();

            if (isEdit)
            {
                PaymentTypeCustomTable paymentTypeCustomTableForPost = new PaymentTypeCustomTable
                {
                    ServiceTypeId = serviceTypeId,
                    ContractId    = contractId,
                    PaymentTypeId = paymentTypeId,
                    UserName      = GetCurrentUserName()
                };

                //Get the Name of User logged in
                PaymentTypeCustomTable customPaymentTypeInfo = PostApiResponse <PaymentTypeCustomTable>(Constants.PaymentTypeCustomTable,
                                                                                                        Constants.GetPaymentTypeCustomTable,
                                                                                                        paymentTypeCustomTableForPost);

                paymentTypeCustomTableViewModel = AutoMapper.Mapper.Map <PaymentTypeCustomTable, PaymentTypeCustomTableViewModel>(customPaymentTypeInfo);
            }
            paymentTypeCustomTableViewModel.ContractId    = contractId;
            paymentTypeCustomTableViewModel.ServiceTypeId = serviceTypeId;
            paymentTypeCustomTableViewModel.PaymentTypeId = paymentTypeId;
            paymentTypeCustomTableViewModel.IsEdit        = isEdit;
            paymentTypeCustomTableViewModel.ModuleId      = Convert.ToByte(EnumHelperLibrary.GetFieldInfoFromEnum(Enums.Modules.CustomPaymentModeling).FieldIdentityNumber);
            return(View(paymentTypeCustomTableViewModel));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds the edit.
 /// </summary>
 /// <param name="paymentTypeCustomTable">The payment type custom table.</param>
 /// <returns></returns>
 public long AddEdit(PaymentTypeCustomTable paymentTypeCustomTable)
 {
     if (paymentTypeCustomTable != null)
     {
         long paymentTypeDetailId;
         _command = _database.GetStoredProcCommand("AddEditCustomTablePayment");
         _database.AddInParameter(_command, "@PaymentTypeDetailID", DbType.Int64, paymentTypeCustomTable.PaymentTypeDetailId);
         _database.AddInParameter(_command, "@Expression", DbType.String, paymentTypeCustomTable.Expression);
         _database.AddInParameter(_command, "@DocumentId", DbType.Int64, paymentTypeCustomTable.DocumentId);
         _database.AddInParameter(_command, "@ClaimFieldId", DbType.Int64, paymentTypeCustomTable.ClaimFieldId);
         _database.AddInParameter(_command, "@PaymentTypeID ", DbType.Int64, paymentTypeCustomTable.PaymentTypeId);
         _database.AddInParameter(_command, "@ContractID", DbType.Int64, paymentTypeCustomTable.ContractId);
         _database.AddInParameter(_command, "@ContractServiceTypeID", DbType.Int64, paymentTypeCustomTable.ServiceTypeId);
         _database.AddInParameter(_command, "@UserName", DbType.String,
                                  paymentTypeCustomTable.UserName);
         _database.AddInParameter(_command, "@MultiplierFirst", DbType.String, paymentTypeCustomTable.MultiplierFirst);
         _database.AddInParameter(_command, "@MultiplierSecond", DbType.String, paymentTypeCustomTable.MultiplierSecond);
         _database.AddInParameter(_command, "@MultiplierThird", DbType.String, paymentTypeCustomTable.MultiplierThird);
         _database.AddInParameter(_command, "@MultiplierFour", DbType.String, paymentTypeCustomTable.MultiplierFourth);
         _database.AddInParameter(_command, "@MultiplierOther", DbType.String, paymentTypeCustomTable.MultiplierOther);
         _database.AddInParameter(_command, "@IsObserveServiceUnit", DbType.Boolean, paymentTypeCustomTable.IsObserveServiceUnit);
         _database.AddInParameter(_command, "@ObserveServiceUnitLimit", DbType.String, paymentTypeCustomTable.ObserveServiceUnitLimit);
         _database.AddInParameter(_command, "@IsPerDayOfStay", DbType.Boolean, paymentTypeCustomTable.IsPerDayOfStay);
         _database.AddInParameter(_command, "@IsPerCode", DbType.Boolean, paymentTypeCustomTable.IsPerCode);
         long.TryParse(Convert.ToString(_database.ExecuteScalar(_command)), out paymentTypeDetailId);
         return(paymentTypeDetailId);
     }
     return(0);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// updating custom payment result details
 /// </summary>
 /// <param name="claimPaymentResult">payment result to be updated</param>
 /// <param name="smartBox">user entered smart box variables</param>
 /// <param name="paymentTypeBase">user entered custom payment details</param>
 public void UpdateCustomTableDetails(PaymentResult claimPaymentResult, SmartBox smartBox,
                                      PaymentTypeCustomTable paymentTypeBase)
 {
     claimPaymentResult.IntermediateAdjudicatedValue = smartBox.CAA;
     claimPaymentResult.CustomExpressionResult       = claimPaymentResult.AdjudicatedValue;
     claimPaymentResult.IsFormulaError   = paymentTypeBase.IsFormulaError;
     claimPaymentResult.CustomExpression = string.Format("{0}{1}{2}", Constants.StartSquareBracket,
                                                         paymentTypeBase.Expression, Constants.EndSquareBracket);
     claimPaymentResult.CustomExpandedExpression = paymentTypeBase.ExpandedExpression;
     paymentTypeBase.IsFormulaError = false;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// updating custom payment result details
        /// </summary>
        /// <param name="claimPaymentResult">payment result to be updated</param>
        /// <param name="smartBox">user entered smart box variables</param>
        /// <param name="paymentTypeBase">user entered custom payment details</param>
        /// <param name="occurence">The occurence.</param>
        public static void UpdateCustomTableDetails(PaymentResult claimPaymentResult, SmartBox smartBox,
                                                    PaymentTypeCustomTable paymentTypeBase, int occurence = 0)
        {
            claimPaymentResult.IntermediateAdjudicatedValue = smartBox.CAA;
            claimPaymentResult.CustomExpressionResult       = claimPaymentResult.AdjudicatedValue;
            claimPaymentResult.IsFormulaError   = paymentTypeBase.IsFormulaError;
            claimPaymentResult.CustomExpression = string.Format("{0}{1}{2}", Constants.StartSquareBracket,
                                                                paymentTypeBase.Expression, Constants.EndSquareBracket);
            claimPaymentResult.CustomExpandedExpression = paymentTypeBase.ExpandedExpression;
            paymentTypeBase.IsFormulaError = false;
            if (occurence > 0)
            {
                claimPaymentResult.CustomExpressionResult     = paymentTypeBase.FormulaExpressionResult;
                claimPaymentResult.MultiplierExpressionResult = paymentTypeBase.MultiplierExpressionResult;
                claimPaymentResult.IsMultiplierFormulaError   = paymentTypeBase.IsMultiplierFormulaError;
                claimPaymentResult.Multiplier = paymentTypeBase.Multiplier;
                switch (occurence)
                {
                case 1:
                    claimPaymentResult.MultiplierExpandedExpression = Constants.FirstMultiplier + paymentTypeBase.MultiplierExpandedExpression + Constants.Equals + paymentTypeBase.MultiplierExpressionResult + (paymentTypeBase.IsMultiplierFormulaError ? Constants.FormulaError : string.Empty);
                    break;

                case 2:
                    claimPaymentResult.MultiplierExpandedExpression += ((string.IsNullOrWhiteSpace(claimPaymentResult.MultiplierExpandedExpression)) ? string.Empty : Constants.Comma) + Constants.SecondMultiplier + paymentTypeBase.MultiplierExpandedExpression + Constants.Equals + paymentTypeBase.MultiplierExpressionResult + (paymentTypeBase.IsMultiplierFormulaError ? Constants.FormulaError : string.Empty);
                    break;

                case 3:
                    claimPaymentResult.MultiplierExpandedExpression += ((string.IsNullOrWhiteSpace(claimPaymentResult.MultiplierExpandedExpression)) ? string.Empty : Constants.Comma) + Constants.ThirdMultiplier + paymentTypeBase.MultiplierExpandedExpression + Constants.Equals + paymentTypeBase.MultiplierExpressionResult + (paymentTypeBase.IsMultiplierFormulaError ? Constants.FormulaError : string.Empty);
                    break;

                case 4:
                    claimPaymentResult.MultiplierExpandedExpression += ((string.IsNullOrWhiteSpace(claimPaymentResult.MultiplierExpandedExpression)) ? string.Empty : Constants.Comma) + Constants.FourthMultiplier + paymentTypeBase.MultiplierExpandedExpression + Constants.Equals + paymentTypeBase.MultiplierExpressionResult + (paymentTypeBase.IsMultiplierFormulaError ? Constants.FormulaError : string.Empty);
                    break;

                default:
                    claimPaymentResult.MultiplierExpandedExpression += string.IsNullOrWhiteSpace(claimPaymentResult.MultiplierExpandedExpression) || !claimPaymentResult.MultiplierExpandedExpression.Contains(Constants.OthersMultiplier) ? (((string.IsNullOrWhiteSpace(claimPaymentResult.MultiplierExpandedExpression)) ? string.Empty : Constants.Comma) + Constants.OthersMultiplier + paymentTypeBase.MultiplierExpandedExpression + Constants.Equals + paymentTypeBase.MultiplierExpressionResult + (paymentTypeBase.IsMultiplierFormulaError ? Constants.FormulaError : string.Empty)) : string.Empty;
                    break;
                }
                claimPaymentResult.LimitExpressionResult   = paymentTypeBase.LimitExpressionResult;
                claimPaymentResult.IsLimitError            = paymentTypeBase.IsLimitError;
                claimPaymentResult.LimitExpandedExpression = paymentTypeBase.LimitExpandedExpression;
                paymentTypeBase.IsLimitError             = false;
                paymentTypeBase.IsMultiplierFormulaError = false;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Gets the payment type custom table details.
        /// </summary>
        /// <param name="paymentTypeCustomTable">The payment type custom table.</param>
        /// <returns></returns>
        public PaymentTypeCustomTable GetPaymentTypeCustomTableDetails(PaymentTypeCustomTable paymentTypeCustomTable)
        {
            if (paymentTypeCustomTable != null)
            {
                // Initialize the Stored Procedure
                _command = _database.GetStoredProcCommand("GetServiceLinesandPaymentTypes");
                // Pass parameters to Stored Procedure(i.e., @ParamName), add values for
                _database.AddInParameter(_command, "@PaymentTypeID ", DbType.Int64, paymentTypeCustomTable.PaymentTypeId);
                _database.AddInParameter(_command, "@ContractID", DbType.Int64, paymentTypeCustomTable.ContractId);
                _database.AddInParameter(_command, "@ContractServiceTypeID", DbType.Int64,
                                         paymentTypeCustomTable.ServiceTypeId);
                _database.AddInParameter(_command, "@ServiceLineTypeId", DbType.Int64, 0);
                _database.AddInParameter(_command, "@UserName", DbType.String, paymentTypeCustomTable.UserName);

                // Retrieve the results of the Stored Procedure in Data set
                DataSet paymentTypeCustomDataSet = _database.ExecuteDataSet(_command);
                if (paymentTypeCustomDataSet != null && paymentTypeCustomDataSet.Tables.Count > 0)
                {
                    //populating ContractBasicInfo data
                    if (paymentTypeCustomDataSet.Tables[0].Rows != null && paymentTypeCustomDataSet.Tables[0] != null && paymentTypeCustomDataSet.Tables[0].Rows.Count > 0)
                    {
                        PaymentTypeCustomTable paymentTypeCustomTableDetails = new PaymentTypeCustomTable
                        {
                            Expression              = Convert.ToString(paymentTypeCustomDataSet.Tables[0].Rows[0]["Formula"]),
                            DocumentId              = Convert.ToInt64(paymentTypeCustomDataSet.Tables[0].Rows[0]["ClaimFieldDocId"]),
                            PaymentTypeDetailId     = Convert.ToInt64(paymentTypeCustomDataSet.Tables[0].Rows[0]["PaymentTypeDetailID"]),
                            ClaimFieldId            = Convert.ToInt64(paymentTypeCustomDataSet.Tables[0].Rows[0]["ClaimFieldId"]),
                            MultiplierFirst         = Convert.ToString(paymentTypeCustomDataSet.Tables[0].Rows[0]["MultiplierFirst"]),
                            MultiplierSecond        = Convert.ToString(paymentTypeCustomDataSet.Tables[0].Rows[0]["MultiplierSecond"]),
                            MultiplierThird         = Convert.ToString(paymentTypeCustomDataSet.Tables[0].Rows[0]["MultiplierThird"]),
                            MultiplierFourth        = Convert.ToString(paymentTypeCustomDataSet.Tables[0].Rows[0]["MultiplierFour"]),
                            MultiplierOther         = Convert.ToString(paymentTypeCustomDataSet.Tables[0].Rows[0]["MultiplierOther"]),
                            IsObserveServiceUnit    = Convert.ToBoolean(paymentTypeCustomDataSet.Tables[0].Rows[0]["IsObserveServiceUnit"]),
                            ObserveServiceUnitLimit = Convert.ToString(paymentTypeCustomDataSet.Tables[0].Rows[0]["ObserveServiceUnitLimit"]),
                            IsPerDayOfStay          = Convert.ToBoolean(paymentTypeCustomDataSet.Tables[0].Rows[0]["IsPerDayOfStay"]),
                            IsPerCode = Convert.ToBoolean(paymentTypeCustomDataSet.Tables[0].Rows[0]["IsPerCode"])
                        };
                        return(paymentTypeCustomTableDetails);
                    }
                }
            }

            return(null);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Gets the payment type fee schedules.
        /// </summary>
        /// <param name="contractServiceTypeId">The contract service type identifier.</param>
        /// <param name="dtCustomPaymentTable">The dt fee schedule table.</param>
        /// <param name="dtDoc">The dt document.</param>
        /// <param name="dtDocValues">The dt document values.</param>
        /// <returns></returns>
        public static PaymentTypeCustomTable GetPaymentType(long contractServiceTypeId, DataTable dtCustomPaymentTable,
                                                            DataTable dtDoc, DataTable dtDocValues)
        {
            PaymentTypeCustomTable paymentTypeCustomTable = null;

            if (dtCustomPaymentTable != null && dtCustomPaymentTable.Rows.Count > 0)
            {
                paymentTypeCustomTable = (from DataRow row in dtCustomPaymentTable.Rows
                                          where (Convert.ToInt64(DBNull.Value == row["ContractServiceTypeID"]
                        ? (long?)null
                        : Convert.ToInt64(
                                                                     row["ContractServiceTypeID"])) == contractServiceTypeId)
                                          select new PaymentTypeCustomTable
                {
                    ClaimFieldDocId =
                        Convert.ToInt64(row["ClaimFieldDocID"]),
                    ContractId = DBNull.Value == row["ContractId"]
                            ? (long?)null
                            : Convert.ToInt64(
                        row["ContractId"]),
                    ServiceTypeId = DBNull.Value ==
                                    row["ContractServiceTypeID"]
                            ? (long?)null
                            : Convert.ToInt64(
                        row["ContractServiceTypeID"]),
                    PaymentTypeId = (byte)Enums.PaymentTypeCodes.CustomTableFormulas,
                    ClaimFieldId =
                        DBNull.Value == row["ClaimFieldId"] ? (long?)null : Convert.ToInt64(row["ClaimFieldId"]),
                    Expression = DBNull.Value == row["Formula"] ? null : Convert.ToString(row["Formula"]),
                    ClaimFieldDoc = GetClaimFieldDoc(
                        Convert.ToInt64(row["ClaimFieldDocID"]), dtDoc, dtDocValues),
                    MultiplierFirst = DBNull.Value == row["MultiplierFirst"] ? null : Convert.ToString(row["MultiplierFirst"]),
                    MultiplierSecond = DBNull.Value == row["MultiplierSecond"] ? null : Convert.ToString(row["MultiplierSecond"]),
                    MultiplierThird = DBNull.Value == row["MultiplierThird"] ? null : Convert.ToString(row["MultiplierThird"]),
                    MultiplierFourth = DBNull.Value == row["MultiplierFour"] ? null : Convert.ToString(row["MultiplierFour"]),
                    MultiplierOther = DBNull.Value == row["MultiplierOther"] ? null : Convert.ToString(row["MultiplierOther"]),
                    ObserveServiceUnitLimit = DBNull.Value == row["ObserveServiceUnitLimit"] ? null : Convert.ToString(row["ObserveServiceUnitLimit"]),
                    IsObserveServiceUnit = Convert.ToBoolean(row["IsObserveServiceUnit"]),
                    IsPerDayOfStay = Convert.ToBoolean(row["IsPerDayOfStay"]),
                    IsPerCode = Convert.ToBoolean(row["IsPerCode"])
                }).FirstOrDefault();
                if (paymentTypeCustomTable != null)
                {
                    List <ICondition> conditions    = new List <ICondition>();
                    ICondition        conditionCode = new Condition
                    {
                        ConditionOperator = (int)Enums.ConditionOperation.EqualTo,
                        OperandIdentifier = (int?)paymentTypeCustomTable.ClaimFieldId,
                        RightOperand      =
                            (int?)paymentTypeCustomTable.ClaimFieldId == 6
                                ? string.Join(";",
                                              paymentTypeCustomTable.ClaimFieldDoc.ClaimFieldValues.Select(
                                                  x =>
                                                  x.Identifier.Replace(Constants.Apostrophe + Constants.Apostrophe,
                                                                       Constants.Apostrophe)
                                                  .Replace(Constants.MaskCommaInValue, Constants.Comma)))
                                : string.Join(",",
                                              paymentTypeCustomTable.ClaimFieldDoc.ClaimFieldValues.Select(
                                                  x =>
                                                  x.Identifier.Replace(Constants.Apostrophe + Constants.Apostrophe,
                                                                       Constants.Apostrophe)
                                                  .Replace(Constants.MaskCommaInValue, Constants.Comma))).Replace(" ", "")
                    };
                    conditionCode = UpdatePropertyAndOperand(conditionCode);
                    conditions.Add(conditionCode);
                    paymentTypeCustomTable.Conditions = conditions;
                }
            }
            return(paymentTypeCustomTable);
        }
 public PaymentTypeCustomTable GetPaymentTypeCustomTable(PaymentTypeCustomTable paymentTypeCustomTable)
 {
     return((PaymentTypeCustomTable)_paymentTypeCustomTableLogic.GetPaymentType(paymentTypeCustomTable));
 }
 public long AddEdit(PaymentTypeCustomTable paymentTypeCustomTable)
 {
     return(_paymentTypeCustomTableLogic.AddEditPaymentType(paymentTypeCustomTable));
 }
        public JsonResult AddEdit(PaymentTypeCustomTableViewModel paymentTypeCustomTableViewModel)
        {
            long paymentDetailId = 0;
            bool isValidated     = true;
            bool isMultiplier    = false;

            string[] resultFormula = new string[7];
            if (paymentTypeCustomTableViewModel.DocumentId != null)
            {
                PaymentTypeCustomTable customTable =
                    AutoMapper.Mapper.Map <PaymentTypeCustomTableViewModel, PaymentTypeCustomTable>(
                        paymentTypeCustomTableViewModel);
                customTable.Expression = Utilities.Replace(customTable.Expression, Constants.NewLine, string.Empty);

                customTable.ExpandedExpression = Utilities.Replace(customTable.ExpandedExpression, Constants.NewLine,
                                                                   string.Empty);
                Dictionary <string, string> tableHeader = new Dictionary <string, string>();
                for (int i = 0; i < paymentTypeCustomTableViewModel.TableHeaders.Count; i++)
                {
                    tableHeader[
                        paymentTypeCustomTableViewModel.TableHeaders.ElementAt(i)
                        .Key.Replace(Constants.ReplaceDotString, Constants.Dot)] =
                        paymentTypeCustomTableViewModel.TableHeaders.ElementAt(i).Value;
                }
                paymentTypeCustomTableViewModel.TableHeaders = tableHeader;

                //send particular id for highlighting the text box if formula validation fails.
                if (!Utilities.ValidateExpression(paymentTypeCustomTableViewModel.Expression,
                                                  paymentTypeCustomTableViewModel.TableHeaders))
                {
                    resultFormula[0] = "#txtChooseFormula";
                    isMultiplier     = true;
                    isValidated      = false;
                }
                //send particular id for highlighting the text box if multiplier first validation fails.
                if (customTable.MultiplierFirst != null)
                {
                    customTable.MultiplierFirst = Utilities.Replace(customTable.MultiplierFirst, Constants.NewLine, string.Empty);
                    if (!Utilities.ValidateExpression(paymentTypeCustomTableViewModel.MultiplierFirst,
                                                      paymentTypeCustomTableViewModel.TableHeaders))
                    {
                        resultFormula[1] = "#txt-first-multiplier";
                        isMultiplier     = true;
                        isValidated      = false;
                    }
                }
                //send particular id for highlighting the text box if multiplier second validation fails.
                if (customTable.MultiplierSecond != null)
                {
                    customTable.MultiplierSecond = Utilities.Replace(customTable.MultiplierSecond, Constants.NewLine, string.Empty);
                    if (!Utilities.ValidateExpression(paymentTypeCustomTableViewModel.MultiplierSecond,
                                                      paymentTypeCustomTableViewModel.TableHeaders))
                    {
                        resultFormula[2] = "#txt-second-multiplier";
                        isMultiplier     = true;
                        isValidated      = false;
                    }
                }
                //send particular id for highlighting the text box if multiplier third validation fails.
                if (customTable.MultiplierThird != null)
                {
                    customTable.MultiplierThird = Utilities.Replace(customTable.MultiplierThird, Constants.NewLine, string.Empty);
                    if (!Utilities.ValidateExpression(paymentTypeCustomTableViewModel.MultiplierThird,
                                                      paymentTypeCustomTableViewModel.TableHeaders))
                    {
                        resultFormula[3] = "#txt-third-multiplier";
                        isMultiplier     = true;
                        isValidated      = false;
                    }
                }
                //send particular id for highlighting the text box if multiplier forth validation fails.
                if (customTable.MultiplierFourth != null)
                {
                    customTable.MultiplierFourth = Utilities.Replace(customTable.MultiplierFourth, Constants.NewLine, string.Empty);
                    if (!Utilities.ValidateExpression(paymentTypeCustomTableViewModel.MultiplierFourth,
                                                      paymentTypeCustomTableViewModel.TableHeaders))
                    {
                        resultFormula[4] = "#txt-fourth-multiplier";
                        isMultiplier     = true;
                        isValidated      = false;
                    }
                }
                //send particular id for highlighting the text box if multiplier others validation fails.
                if (customTable.MultiplierOther != null)
                {
                    customTable.MultiplierOther = Utilities.Replace(customTable.MultiplierOther, Constants.NewLine, string.Empty);
                    if (!Utilities.ValidateExpression(paymentTypeCustomTableViewModel.MultiplierOther,
                                                      paymentTypeCustomTableViewModel.TableHeaders))
                    {
                        resultFormula[5] = "#txt-others-multiplier";
                        isMultiplier     = true;
                        isValidated      = false;
                    }
                }
                //send particular id for highlighting the text box if observe service unit limit validation fails.
                if (customTable.ObserveServiceUnitLimit != null)
                {
                    customTable.ObserveServiceUnitLimit = Utilities.Replace(customTable.ObserveServiceUnitLimit, Constants.NewLine, string.Empty);
                    if (!Utilities.ValidateExpression(paymentTypeCustomTableViewModel.ObserveServiceUnitLimit,
                                                      paymentTypeCustomTableViewModel.TableHeaders))
                    {
                        resultFormula[6] = "#input-limit";
                        isMultiplier     = true;
                        isValidated      = false;
                    }
                }
                if (isValidated)
                {
                    customTable.UserName = GetCurrentUserName();
                    paymentDetailId      = PostApiResponse <long>(Constants.PaymentTypeCustomTable,
                                                                  Convert.ToString(Enums.Action.AddEdit), customTable);
                }
            }
            return(Json(new { success = isMultiplier, Id = paymentDetailId, documentId = paymentTypeCustomTableViewModel.DocumentId, resultFormula }));
        }