public void addClaimResultLine(string patientId, string itemNumber, string bodyPart, DateTime serviceDate, decimal fee, decimal benefit, string responseCode) { string data = ""; string dateservice = ""; string feeamount = ""; string benefitamount = ""; string zerofill = "00000000"; patientId = Right((zerofill + patientId), 2); itemNumber = Right(zerofill + itemNumber, 4); bodyPart = Right(zerofill + bodyPart, 2); // dateservice = serviceDate.ToString("DDMM"); // Get fee into 012500" format for 125.00 feeamount = "00000000" + (fee * System.Convert.ToDecimal(100)).ToString(); feeamount = Left(feeamount, feeamount.IndexOf('.')); feeamount = Right(feeamount, 6); benefitamount = "00000000" + (benefit * System.Convert.ToDecimal(100)).ToString(); benefitamount = Left(benefitamount, benefitamount.IndexOf('.')); benefitamount = Right(benefitamount, 6); responseCode = Right((zerofill + responseCode), 2); // Claim Data format stored as a string array to help serialisation //Format is + Separator // Patient Id + ItemNumber + BodyPart + DDMM + FeeAmount) data = patientId + itemNumber + bodyPart + dateservice + feeamount + benefitamount + responseCode; ClaimDetails.Add(data); TransactionAmount += fee; }
public void addClaimLine(string patientId, string itemNumber, string bodyPart, DateTime serviceDate, decimal fee) { string data = ""; string dateservice = ""; string feeamount = "00"; string zerofill = "00000000"; string errorMessage = ""; errorMessage += validatePatientId(patientId); errorMessage += validateItemNumber(itemNumber); errorMessage += validateBodyPart(bodyPart); errorMessage += validateFeeAmount(fee); errorMessage += validateServiceDate(serviceDate); if (errorMessage.Length > 0) { throw new InvalidCastException(errorMessage); } patientId = Right((zerofill + patientId ?? "00".Trim()), 2); //itemNumber = Right(zerofill + itemNumber ?? "0000".Trim(), 4); itemNumber = Left(itemNumber + new string(' ', 4), 4); bodyPart = Right(zerofill + bodyPart ?? "00".Trim(), 2); // if (!isNumeric(patientId)) { patientId = "00"; throw new InvalidCastException("Invalid patient id, PatientID must contain numeric values only eg 00"); } if (!isSpaceAlphaNumeric(itemNumber)) { itemNumber = "0000"; throw new InvalidCastException("Invalid Item Number, Item Number must only contain AlphaNumeric values only eg A-Z, a-z, 0-9, and spaces"); } if (!isAlphaNumeric(bodyPart)) { itemNumber = "00"; throw new InvalidCastException("Invalid Bodypart id, Bodypart must contain numeric values only eg 11"); } dateservice = Right(zerofill + serviceDate.Day.ToString(), 2) + Right(zerofill + serviceDate.Month.ToString(), 2); // Get fee into 012500" format for 125.00 feeamount = "00000000" + (fee * System.Convert.ToDecimal(100)).ToString(); if (feeamount.IndexOf('.') > 0) { feeamount = Left(feeamount, feeamount.IndexOf('.')); } feeamount = Right(feeamount, 6); // Claim Data format stored as a string array to help serialisation //Format is + Separator // Patient Id + ItemNumber + BodyPart + DDMM + FeeAmount) data = patientId + itemNumber + bodyPart + dateservice + feeamount; ClaimDetails.Add(data); TransactionAmount += fee; }