Ejemplo n.º 1
0
 ///<summary>Exports a fee schedule.  Called only in FormFeeSchedTools. Fires FeeSchedEvents for a progress bar.</summary>
 public static void ExportFeeSchedule(long feeSchedNum, long clinicNum, long provNum, string fileName)
 {
     //No need to check RemotingRole; no call to db.
     //CreateText will overwrite any content if the file already exists.
     using (StreamWriter sr = File.CreateText(fileName)) {
         //Get every single procedure code from the cache which will already be ordered by ProcCat and then ProcCode.
         //Even if the code does not have a fee, include it in the export because that will trigger a 'deletion' when importing over other schedules.
         int rowNum = 0;
         List <ProcedureCode> listProcCodes = ProcedureCodes.GetListDeep();
         List <Fee>           listFees      = Fees.GetListForScheds(feeSchedNum, clinicNum, provNum);//gets best matches
         foreach (ProcedureCode procCode in listProcCodes)
         {
             //Get the best matching fee (not exact match) for the current selections.
             Fee fee = Fees.GetFee(procCode.CodeNum, feeSchedNum, clinicNum, provNum, listFees);
             sr.Write(procCode.ProcCode + "\t");
             if (fee != null && fee.Amount != -1)
             {
                 sr.Write(fee.Amount.ToString("n"));
             }
             sr.Write("\t");
             sr.Write(procCode.AbbrDesc + "\t");
             sr.WriteLine(procCode.Descript);
             double percent = ((rowNum * 1.0) / listProcCodes.Count * 100);
             FeeSchedEvent.Fire(ODEventType.FeeSched, new ProgressBarHelper(
                                    "Exporting fees, please wait...", percent.ToString(), blockValue: (int)percent, progressStyle: ProgBarStyle.Continuous));
             rowNum++;
         }
     }
 }