Exemple #1
0
 private void FillGrid()
 {
     try {
         string xmlData = File.ReadAllText(textBillingXmlPath.Text);
         xmlData = xmlData.Replace(" ", "");
         XmlDocument xml = new XmlDocument();
         xml.LoadXml(xmlData);
         XmlNode divNode   = xml.FirstChild;
         XmlNode tableNode = divNode.FirstChild;
         RefreshGridColumns();
         gridBillingList.BeginUpdate();
         gridBillingList.Rows.Clear();
         for (int i = 1; i < tableNode.ChildNodes.Count; i++)            //Skip the first row, because it contains the column names.
         {
             ODGridRow gr     = new ODGridRow();
             XmlNode   trNode = tableNode.ChildNodes[i];
             //0 PatNum
             string shortName           = trNode.ChildNodes[1].InnerText;
             int    accountIdStartIndex = shortName.IndexOf("-") + 1;
             int    accountIdLength     = shortName.Substring(accountIdStartIndex).LastIndexOf("-");
             string accountId           = shortName.Substring(accountIdStartIndex, accountIdLength);
             int    patNumLength        = accountId.IndexOf("-");
             string patNumStr           = PIn.String(accountId.Substring(0, patNumLength));
             if (patNumStr == "6566")             //Account 6566 corresponds to our software key in the training database. These accounts are test accounts.
             {
                 continue;                        //Do not show OD test accounts.
             }
             long patNum = PIn.Long(patNumStr);
             gr.Cells.Add(new ODGridCell(patNumStr));
             //1 NPI
             string npi = PIn.String(trNode.ChildNodes[8].InnerText);
             gr.Cells.Add(new ODGridCell(npi));
             //2 YearMonthAdded
             gr.Cells.Add(new ODGridCell(trNode.ChildNodes[9].InnerText));
             //3 Type
             gr.Cells.Add(new ODGridCell(trNode.ChildNodes[10].InnerText));
             //4 IsNew
             List <RepeatCharge> RepeatChargesCur   = RepeatCharges.GetForNewCrop(patNum);
             RepeatCharge        repeatChargeForNpi = GetRepeatChargeForNPI(RepeatChargesCur, npi);
             gr.Cells.Add(new ODGridCell((repeatChargeForNpi == null)?"X":""));
             //5 PracticeTitle
             gr.Cells.Add(new ODGridCell(trNode.ChildNodes[0].InnerText));
             //6 FirstLastName
             gr.Cells.Add(new ODGridCell(trNode.ChildNodes[2].InnerText));
             gridBillingList.Rows.Add(gr);
         }
         gridBillingList.EndUpdate();
     }
     catch (Exception ex) {
         MessageBox.Show("There is something wrong with the input file. Try again. If issue persists, then contact a programmer: " + ex.Message);
     }
 }
Exemple #2
0
        private void butProcess_Click(object sender, EventArgs e)
        {
            if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "This will add a new repeating charge for each provider in the list above"
                             + " who is new (does not already have a repeating charge), based on PatNum and NPI.  Continue?"))
            {
                return;
            }
            Cursor = Cursors.WaitCursor;
            int numChargesAdded = 0;
            int numSkipped      = 0;

            for (int i = 0; i < gridBillingList.Rows.Count; i++)
            {
                long   patNum      = PIn.Long(gridBillingList.Rows[i].Cells[0].Text);
                string npi         = PIn.String(gridBillingList.Rows[i].Cells[1].Text);
                string billingType = gridBillingList.Rows[i].Cells[3].Text;
                List <RepeatCharge> repeatChargesNewCrop = RepeatCharges.GetForNewCrop(patNum);
                RepeatCharge        repeatCur            = GetRepeatChargeForNPI(repeatChargesNewCrop, npi);
                if (repeatCur == null)               //No such repeating charge exists yet for the given npi.
                //We consider the provider a new provider and create a new repeating charge.
                {
                    string   yearMonth         = gridBillingList.Rows[i].Cells[2].Text;
                    int      yearBilling       = PIn.Int(yearMonth.Substring(0, 4));    //The year chosen by the OD employee when running the NewCrop Billing report.
                    int      monthBilling      = PIn.Int(yearMonth.Substring(4));       //The month chosen by the OD employee when running the NewCrop Billing report.
                    int      dayOtherCharges   = GetChargeDayOfMonth(patNum);           //The day of the month that the customer already has other repeating charges. Keeps their billing simple (one bill per month for all charges).
                    DateTime dateNewCropCharge = new DateTime(yearBilling, monthBilling, dayOtherCharges);
                    if (dateNewCropCharge < DateTime.Today.AddMonths(-3))               //Just in case the user runs an older report.
                    {
                        numSkipped++;
                        continue;
                    }
                    repeatCur           = new RepeatCharge();
                    repeatCur.IsNew     = true;
                    repeatCur.PatNum    = patNum;
                    repeatCur.ProcCode  = GetProcCodeForNewCharge(repeatChargesNewCrop);
                    repeatCur.ChargeAmt = 15;                  //15$/month
                    repeatCur.DateStart = dateNewCropCharge;
                    repeatCur.Note      = "NPI=" + npi;
                    repeatCur.IsEnabled = true;
                    RepeatCharges.Insert(repeatCur);
                    numChargesAdded++;
                }
                else                   //The repeating charge for NewCrop billing already exists for the given npi.
                {
                    DateTime dateEndLastMonth = (new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1)).AddDays(-1);
                    if (billingType == "B" || billingType == "N")                 //The provider sent eRx last month.
                    {
                        if (repeatCur.DateStop.Year > 2010)                       //NewCrop support for this provider was disabled at one point, but has been used since.
                        {
                            if (repeatCur.DateStop < dateEndLastMonth)            //If the stop date is in the future or already at the end of the month, then we cannot presume that there will be a charge next month.
                            {
                                repeatCur.DateStop = dateEndLastMonth;            //Make sure the recent use is reflected in the end date.
                                RepeatCharges.Update(repeatCur);
                            }
                        }
                    }
                    else if (billingType == "U")                   //The provider did not send eRx last month, but did send eRx two months ago.
                    //Customers must call in to disable repeating charges, they are not disabled automatically.
                    {
                    }
                    else
                    {
                        throw new Exception("Unknown NewCrop Billing type " + billingType);
                    }
                }
            }
            FillGrid();
            Cursor = Cursors.Default;
            string msg = "Done. Number of provider charges added: " + numChargesAdded;

            if (numSkipped > 0)
            {
                msg += Environment.NewLine + "Number skipped due to old DateBilling (over 3 months ago): " + numSkipped;
            }
            MessageBox.Show(msg);
        }