コード例 #1
0
 public void DeleteImage(IList <Document> documents)
 {
     for (int i = 0; i < documents.Count; i++)
     {
         if (documents[i] == null)
         {
             continue;
         }
         try {
             DeleteDocument(documents[i]);
         }
         catch {
             if (verbose)
             {
                 Debug.WriteLine(Lan.g("ContrDocs", "Could not delete file. It may be in use elsewhere, or may have already been deleted."));
             }
         }
         Documents.Delete(documents[i]);
     }
 }
コード例 #2
0
        public Bitmap RetrieveImage(Document document)
        {
            if (Patient == null)
            {
                throw new NoActivePatientException();
            }

            if (document == null)
            {
                throw new ArgumentNullException("document");
            }

            try {
                return(OpenImage(document));
            }
            catch {
                MessageBox.Show(Lan.g("ContrDocs", "File not found") + document.FileName);
                return(null);
            }
        }
コード例 #3
0
ファイル: PrintPreview.cs プロジェクト: kjb7749/testImport
 private void OnPrint_Click()
 {
     if (!PrinterL.SetPrinter(Document, Sit))
     {
         return;
     }
     if (Document.OriginAtMargins)
     {
         //In the sheets framework,we had to set margins to 20 because of a bug in their preview control.
         //We now need to set it back to 0 for the actual printing.
         //Hopefully, this doesn't break anything else.
         Document.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
     }
     try{
         Document.Print();
     }
     catch (Exception e) {
         MessageBox.Show(Lan.g(this, "Error: ") + e.Message);
     }
     DialogResult = DialogResult.OK;
 }
コード例 #4
0
        private void butRunAllocatorTool_Click(object sender, EventArgs e)
        {
            if (!rbutIHaveRead.Checked)
            {
                PU.MB = Lan.g(this, "You must indicate that you have read the text in the box!");
                return;
            }

            if (MessageBox.Show("Do you want to run the batch allocation?", "Please Respond", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                FormWarnToCloseComputers fwc = new FormWarnToCloseComputers();
                if (fwc.ShowDialog() == DialogResult.Yes)
                {
                    Reporting.Allocators.MyAllocator1_ProviderPayment allocator1 = new OpenDental.Reporting.Allocators.MyAllocator1_ProviderPayment();
                    SecurityLogs.MakeLogEntry(OpenDentBusiness.Permissions.Setup, 0, "Started Batch Allocation For Provider Allocation Tool");
                    allocator1.StartBatchAllocation();
                    SecurityLogs.MakeLogEntry(OpenDentBusiness.Permissions.Setup, 0, "Finished Batch Allocation For Provider Allocation Tool");

                    List <string> commands = new List <string>();
                    if (!PrefC.ContainsKey(MyAllocator1_ProviderPayment.Pref_AllocatorProvider1_ToolHasRun))
                    {
                        commands.Add("INSERT INTO preference VALUES ('"
                                     + MyAllocator1_ProviderPayment.Pref_AllocatorProvider1_ToolHasRun + "','0')");
                    }
                    if (!PrefC.ContainsKey(MyAllocator1_ProviderPayment.Pref_AllocatorProvider1_Use))
                    {
                        commands.Add("INSERT INTO preference VALUES ('"
                                     + MyAllocator1_ProviderPayment.Pref_AllocatorProvider1_Use + "','0')");
                    }
                    if (commands.Count != 0)
                    {
                        Db.NonQOld(commands.ToArray());
                        Cache.Refresh(InvalidType.Prefs);
                    }
                    Prefs.UpdateRaw(MyAllocator1_ProviderPayment.Pref_AllocatorProvider1_ToolHasRun, "1");
                    Prefs.UpdateRaw(MyAllocator1_ProviderPayment.Pref_AllocatorProvider1_Use, "1");
                }
            }
            RefreshForm();
        }
コード例 #5
0
ファイル: ReportComplex.cs プロジェクト: kjb7749/testImport
        ///<summary>Adds a ReportObject with the given font, at the bottom-center of the Report Header Section.
        ///Should only be done after AddTitle.  You can add as many subtitles as you want.  Padding is added to the height only of the subtitle.</summary>
        public void AddSubTitle(string name, string subTitle, Font font, int padding)
        {
            ReportComplexEvent.Fire(new ODEventArgs("ReportComplexEvent", Lan.g("ReportComplex", "Adding SubTitle To Report") + "..."));
            Size size = new Size((int)(_grfx.MeasureString(subTitle, font).Width / _grfx.DpiX * 100 + 2)
                                 , (int)(_grfx.MeasureString(subTitle, font).Height / _grfx.DpiY * 100 + 2));
            int xPos;

            if (_isLandscape)
            {
                xPos  = 1100 / 2;
                xPos -= 50;
            }
            else
            {
                xPos  = 850 / 2;
                xPos -= 30;
            }
            xPos -= (int)(size.Width / 2);
            if (_sections[AreaSectionType.ReportHeader] == null)
            {
                _sections.Add(new Section(AreaSectionType.ReportHeader, 0));
            }
            //find the yPos+Height of the last reportObject in the Report Header section
            int yPos = 0;

            foreach (ReportObject reportObject in _reportObjects)
            {
                if (reportObject.SectionType != AreaSectionType.ReportHeader)
                {
                    continue;
                }
                if (reportObject.Location.Y + reportObject.Size.Height > yPos)
                {
                    yPos = reportObject.Location.Y + reportObject.Size.Height;
                }
            }
            _reportObjects.Add(new ReportObject(name, AreaSectionType.ReportHeader, new Point(xPos, yPos + padding), size, subTitle, font, ContentAlignment.MiddleCenter));
            _sections[AreaSectionType.ReportHeader].Height += (int)size.Height + padding;
        }
コード例 #6
0
        //these are temporary:
        //private static string vendorID="68";
        //private static string vendorPMScode="144";
        //private static string clientAccountNumber="8011";//the dental office number set by EHG
        //private static string creditCardChoices="MC,D,V,A";//MasterCard,Discover,Visa,AmericanExpress
        //private static string userName="";
        //private static string password="";

        ///<summary>Returns empty list if no errors.  Otherwise returns a list with error messages.</summary>
        public static List <string> Validate(long clinicNum)
        {
            List <string> listErrors   = new List <string>();
            Clinic        clinic       = Clinics.GetClinic(clinicNum);
            Ebill         eBillClinic  = Ebills.GetForClinic(clinicNum);
            Ebill         eBillDefault = Ebills.GetForClinic(0);
            EHG_Address   addressRemit = null;

            if (eBillClinic == null)
            {
                addressRemit = GetAddress(eBillDefault.RemitAddress, clinic);
            }
            else
            {
                addressRemit = GetAddress(eBillClinic.RemitAddress, clinic);
            }
            if (addressRemit.Address1.Trim().Length == 0 || addressRemit.City.Trim().Length == 0 ||
                addressRemit.State.Trim().Length == 0 || addressRemit.Zip.Trim().Length == 0)
            {
                listErrors.Add(Lan.g("EHG_Statements", "invalid") + " " + Lan.g("EHG_Statements", addressRemit.Source));
            }
            return(listErrors);
        }
コード例 #7
0
        private void butOK_Click(object sender, EventArgs e)
        {
            DataTable tableProvs = KPIDowntime.GetDowntime(dtpStart.Value, dtpEnd.Value);

            ReportComplex report = new ReportComplex(true, false);

            report.ReportName = Lan.g(this, "Provider Down-times");
            report.AddTitle("Title", Lan.g(this, "Provider Down-times"));
            report.AddSubTitle("Date", dtpStart.Value.ToShortDateString() + " - " + dtpEnd.Value.ToShortDateString());
            QueryObject query;

            query = report.AddQuery(tableProvs, "", "", SplitByKind.None, 0);
            query.AddColumn("Provider Number", 90, FieldValueType.String);
            query.AddColumn("Total Down-time", 100, FieldValueType.String);
            report.AddPageNum();
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
        }
コード例 #8
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (_isMouseDown)             //User right clicked while dragging appt around.
            {
                return;
            }
            //set selected index before firing the mouse down event.
            //figure out which appt mouse is on.  Start at end and work backwards
            int index = -1;

            for (int i = ListPinBoardItems.Count - 1; i >= 0; i--)
            {
                int top = 13 * i;
                if (e.Y < top || e.Y > top + ListPinBoardItems[i].BitmapAppt.Height)
                {
                    continue;
                }
                index = i;
                break;
            }
            bool changed = index != SelectedIndex;

            if (changed)
            {
                SelectedIndex = index;
            }
            base.OnMouseDown(e);
            if (changed)
            {
                Invalidate();
                OnSelectedIndexChanged();                //fires to parent, which sets selected appt in main area to -1.
            }
            //--Prepare to drag or show context menu-----------------------------------------------------
            if (SelectedIndex == -1)
            {
                return;
            }
            if (e.Button == MouseButtons.Right)
            {
                ContextMenu contextMenu  = new ContextMenu();
                MenuItem    menuItemProv = new MenuItem(Lan.g(this, "Change Provider"));
                menuItemProv.Click += new EventHandler(menuItemProv_Click);
                contextMenu.MenuItems.Add(menuItemProv);
                contextMenu.Show(this, e.Location);
                return;
            }
            _isMouseDown = true;
            OnPreparingToDragFromPinboard(ListPinBoardItems[SelectedIndex].DataRowAppt);            //this event goes to ContrAppt,
            //which then sends new bitmap here via SetBitmapTempPinAppt before the code below continues.
            //So, we have now set the size of contrTempPinAppt.
            contrTempPinAppt.Visible  = false;       //Visible flag gets flipped when the mouse moves. We are just preparing it to be shown here.
            _pointMouseOrigin         = e.Location;  //local pinboard coords.
            contrTempPinAppt.Location = new Point(
                this.Location.X + Parent.Location.X,
                this.Location.Y + Parent.Location.Y + SelectedIndex * 13);
            if (contrTempPinAppt.Right < this.Location.X + Parent.Location.X + _pointMouseOrigin.X)                         //appointment is very narrow
            {
                contrTempPinAppt.Left = this.Location.X + Parent.Location.X + _pointMouseOrigin.X - contrTempPinAppt.Width; //so move it to the right
            }
            _pointApptOrigin = contrTempPinAppt.Location;
        }
コード例 #9
0
        private void FillGrid()
        {
            Color needsAttnCol = OpenDental.SetupWizard.GetColor(ODSetupStatus.NeedsAttention);

            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            if (PrefC.HasClinicsEnabled)
            {
                col = new ODGridColumn(Lan.g("FormSetupWizard", "OpName"), 110);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("FormSetupWizard", "Abbrev"), 110);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("FormSetupWizard", "Clinic"), 110);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("FormSetupWizard", "ProvDentist"), 110);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("FormSetupWizard", "ProvHygienist"), 110);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("FormSetupWizard", "IsHygiene"), 60, HorizontalAlignment.Center);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("FormSetupWizard", "IsHidden"), 60, HorizontalAlignment.Center);
                gridMain.Columns.Add(col);
            }
            else
            {
                col = new ODGridColumn(Lan.g("FormSetupWizard", "OpName"), 135);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("FormSetupWizard", "Abbrev"), 120);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("FormSetupWizard", "ProvDentist"), 130);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("FormSetupWizard", "ProvHygienist"), 130);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("FormSetupWizard", "IsHygiene"), 80, HorizontalAlignment.Center);
                gridMain.Columns.Add(col);
                col = new ODGridColumn(Lan.g("FormSetupWizard", "IsHidden"), 80, HorizontalAlignment.Center);
                gridMain.Columns.Add(col);
            }
            //col = new ODGridColumn("Clinic",120);
            //gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;
            bool      IsAllComplete = true;

            if (_listOps.Count == 0)
            {
                IsAllComplete = false;
            }
            foreach (Operatory opCur in _listOps)
            {
                row = new ODGridRow();
                row.Cells.Add(opCur.OpName);
                if (string.IsNullOrEmpty(opCur.OpName))
                {
                    row.Cells[row.Cells.Count - 1].CellColor = needsAttnCol;
                    IsAllComplete = false;
                }
                row.Cells.Add(opCur.Abbrev);
                if (string.IsNullOrEmpty(opCur.Abbrev))
                {
                    row.Cells[row.Cells.Count - 1].CellColor = needsAttnCol;
                    IsAllComplete = false;
                }
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(Clinics.GetAbbr(opCur.ClinicNum));
                }
                //not a required field
                row.Cells.Add(Providers.GetAbbr(opCur.ProvDentist));
                //not a required field
                row.Cells.Add(Providers.GetAbbr(opCur.ProvHygienist));
                //not a required field
                row.Cells.Add(opCur.IsHygiene ? "X" : "");
                //not a required field
                row.Cells.Add(opCur.IsHidden ? "X" : "");
                //not a required field
                //row = new ODGridRow();
                //row.Cells.Add(opCur.OpName);
                //if(string.IsNullOrEmpty(opCur.OpName)) {
                //	row.Cells[row.Cells.Count-1].CellColor=needsAttnCol;
                //	IsAllComplete=false;
                //}
                row.Tag = opCur;
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
            if (IsAllComplete)
            {
                IsDone = true;
            }
            else
            {
                IsDone = false;
            }
        }
コード例 #10
0
        private void OnExport_Click()
        {
            SaveFileDialog saveFileDialog2 = new SaveFileDialog();

            saveFileDialog2.AddExtension = true;
            //saveFileDialog2.Title=Lan.g(this,"Select Folder to Save File To");
            saveFileDialog2.FileName = MyReport.ReportName + ".txt";
            if (!Directory.Exists(PrefC.GetString(PrefName.ExportPath)))
            {
                try{
                    Directory.CreateDirectory(PrefC.GetString(PrefName.ExportPath));
                    saveFileDialog2.InitialDirectory = PrefC.GetString(PrefName.ExportPath);
                }
                catch {
                    //initialDirectory will be blank
                }
            }
            else
            {
                saveFileDialog2.InitialDirectory = PrefC.GetString(PrefName.ExportPath);
            }
            //saveFileDialog2.DefaultExt="txt";
            saveFileDialog2.Filter      = "Text files(*.txt)|*.txt|Excel Files(*.xls)|*.xls|All files(*.*)|*.*";
            saveFileDialog2.FilterIndex = 0;
            if (saveFileDialog2.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            try{
                using (StreamWriter sw = new StreamWriter(saveFileDialog2.FileName, false)){
                    String line = "";
                    for (int i = 0; i < MyReport.ReportTable.Columns.Count; i++)
                    {
                        line += MyReport.ReportTable.Columns[i].Caption;
                        if (i < MyReport.ReportTable.Columns.Count - 1)
                        {
                            line += "\t";
                        }
                    }
                    sw.WriteLine(line);
                    string cell;
                    for (int i = 0; i < MyReport.ReportTable.Rows.Count; i++)
                    {
                        line = "";
                        for (int j = 0; j < MyReport.ReportTable.Columns.Count; j++)
                        {
                            cell  = MyReport.ReportTable.Rows[i][j].ToString();
                            cell  = cell.Replace("\r", "");
                            cell  = cell.Replace("\n", "");
                            cell  = cell.Replace("\t", "");
                            cell  = cell.Replace("\"", "");
                            line += cell;
                            if (j < MyReport.ReportTable.Columns.Count - 1)
                            {
                                line += "\t";
                            }
                        }
                        sw.WriteLine(line);
                    }
                }                //using
            }
            catch {
                MessageBox.Show(Lan.g(this, "File in use by another program.  Close and try again."));
                return;
            }
            MessageBox.Show(Lan.g(this, "File created successfully"));
        }
コード例 #11
0
        ///<summary>Submits the queries to the database and makes query objects for each query with the results.  Returns false if one of the queries failed.</summary>
        public bool SubmitQueries(bool isShowMessage = false)
        {
            bool     hasRows         = false;
            bool     hasReportServer = !string.IsNullOrEmpty(PrefC.ReportingServer.DisplayStr);
            Graphics grfx            = Graphics.FromImage(new Bitmap(1, 1));
            string   displayText;
            ReportObjectCollection newReportObjects = new ReportObjectCollection();

            _sections.Add(new Section(AreaSectionType.Query, 0));
            for (int i = 0; i < _reportObjects.Count; i++)
            {
                if (_reportObjects[i].ObjectType == ReportObjectType.QueryObject)
                {
                    QueryObject query = (QueryObject)_reportObjects[i];
                    if (!query.SubmitQuery())
                    {
                        _actionCloseReportProgress?.Invoke();
                        MsgBox.Show(this, "There was an error generating this report."
                                    + (hasReportServer ? "\r\nVerify or remove the report server connection settings and try again." : ""));
                        return(false);
                    }
                    if (query.ReportTable.Rows.Count == 0)
                    {
                        continue;
                    }
                    hasRows    = true;
                    TotalRows += query.ReportTable.Rows.Count;
                    //Check if the query needs to be split up into sub queries.  E.g. one payment report query split up via payment type.
                    if (!String.IsNullOrWhiteSpace(query.ColumnNameToSplitOn))
                    {
                        ReportComplexEvent.Fire(ODEventType.ReportComplex, Lan.g("ReportComplex", "Creating Splits Based On") + " " + query.ColumnNameToSplitOn + "...");
                        //The query needs to be split up into sub queries every time the ColumnNameToSplitOn cell changes.
                        //Therefore, we need to create a separate QueryObject for every time the cell value changes.
                        string lastCellValue = "";
                        query.IsLastSplit = false;
                        QueryObject newQuery = null;
                        for (int j = 0; j < query.ReportTable.Rows.Count; j++)
                        {
                            if (query.ReportTable.Rows[j][query.ColumnNameToSplitOn].ToString() == lastCellValue)
                            {
                                if (newQuery == null)
                                {
                                    newQuery = query.DeepCopyQueryObject();
                                    newQuery.AddInitialHeader(newQuery.GetGroupTitle().StaticText, newQuery.GetGroupTitle().Font);
                                }
                                newQuery.ReportTable.ImportRow(query.ReportTable.Rows[j]);
                            }
                            else
                            {
                                //Must happen the first time through
                                if (newQuery != null)
                                {
                                    switch (newQuery.SplitByKind)
                                    {
                                    case SplitByKind.None:
                                        return(false);

                                    case SplitByKind.Enum:
                                        if (newQuery.ListEnumNames == null)
                                        {
                                            return(false);
                                        }
                                        displayText = newQuery.ListEnumNames[PIn.Int(newQuery.ReportTable.Rows[0][query.ColumnNameToSplitOn].ToString())];
                                        newQuery.GetGroupTitle().Size       = new Size((int)(grfx.MeasureString(displayText, newQuery.GetGroupTitle().Font).Width / grfx.DpiX * 100 + 2), (int)(grfx.MeasureString(displayText, newQuery.GetGroupTitle().Font).Height / grfx.DpiY * 100 + 2));
                                        newQuery.GetGroupTitle().StaticText = displayText;
                                        break;

                                    case SplitByKind.Definition:
                                        if (newQuery.DictDefNames == null)
                                        {
                                            return(false);
                                        }
                                        if (newQuery.DictDefNames.ContainsKey(PIn.Long(newQuery.ReportTable.Rows[0][query.ColumnNameToSplitOn].ToString())))
                                        {
                                            displayText = newQuery.DictDefNames[PIn.Long(newQuery.ReportTable.Rows[0][query.ColumnNameToSplitOn].ToString())];
                                            newQuery.GetGroupTitle().Size       = new Size((int)(grfx.MeasureString(displayText, newQuery.GetGroupTitle().Font).Width / grfx.DpiX * 100 + 2), (int)(grfx.MeasureString(displayText, newQuery.GetGroupTitle().Font).Height / grfx.DpiY * 100 + 2));
                                            newQuery.GetGroupTitle().StaticText = displayText;
                                        }
                                        else
                                        {
                                            newQuery.GetGroupTitle().StaticText = "Undefined";
                                        }
                                        break;

                                    case SplitByKind.Date:
                                        displayText = PIn.Date(newQuery.ReportTable.Rows[0][query.ColumnNameToSplitOn].ToString()).ToShortDateString();
                                        newQuery.GetGroupTitle().StaticText = displayText;
                                        newQuery.GetGroupTitle().Size       = new Size((int)(grfx.MeasureString(displayText, newQuery.GetGroupTitle().Font).Width / grfx.DpiX * 100 + 2), (int)(grfx.MeasureString(displayText, newQuery.GetGroupTitle().Font).Height / grfx.DpiY * 100 + 2));
                                        break;

                                    case SplitByKind.Value:
                                        displayText = newQuery.ReportTable.Rows[0][query.ColumnNameToSplitOn].ToString();
                                        newQuery.GetGroupTitle().StaticText = displayText;
                                        newQuery.GetGroupTitle().Size       = new Size((int)(grfx.MeasureString(displayText, newQuery.GetGroupTitle().Font).Width / grfx.DpiX * 100 + 2), (int)(grfx.MeasureString(displayText, newQuery.GetGroupTitle().Font).Height / grfx.DpiY * 100 + 2));
                                        break;
                                    }
                                    newQuery.SubmitQuery();
                                    newReportObjects.Add(newQuery);
                                }
                                if (newQuery == null && query.GetGroupTitle().StaticText != "")
                                {
                                    newQuery = query.DeepCopyQueryObject();
                                    newQuery.ReportTable.ImportRow(query.ReportTable.Rows[j]);
                                    newQuery.AddInitialHeader(newQuery.GetGroupTitle().StaticText, newQuery.GetGroupTitle().Font);
                                }
                                else
                                {
                                    newQuery = query.DeepCopyQueryObject();
                                    newQuery.ReportTable.ImportRow(query.ReportTable.Rows[j]);
                                }
                            }
                            lastCellValue = query.ReportTable.Rows[j][query.ColumnNameToSplitOn].ToString();
                        }
                        switch (newQuery.SplitByKind)
                        {
                        case SplitByKind.None:
                            return(false);

                        case SplitByKind.Enum:
                            if (newQuery.ListEnumNames == null)
                            {
                                return(false);
                            }
                            displayText = newQuery.ListEnumNames[PIn.Int(newQuery.ReportTable.Rows[0][query.ColumnNameToSplitOn].ToString())];
                            newQuery.GetGroupTitle().Size       = new Size((int)(grfx.MeasureString(displayText, newQuery.GetGroupTitle().Font).Width / grfx.DpiX * 100 + 2), (int)(grfx.MeasureString(displayText, newQuery.GetGroupTitle().Font).Height / grfx.DpiY * 100 + 2));
                            newQuery.GetGroupTitle().StaticText = displayText;
                            break;

                        case SplitByKind.Definition:
                            if (newQuery.DictDefNames == null)
                            {
                                return(false);
                            }
                            if (newQuery.DictDefNames.ContainsKey(PIn.Long(newQuery.ReportTable.Rows[0][query.ColumnNameToSplitOn].ToString())))
                            {
                                displayText = newQuery.DictDefNames[PIn.Long(newQuery.ReportTable.Rows[0][query.ColumnNameToSplitOn].ToString())];
                                newQuery.GetGroupTitle().Size       = new Size((int)(grfx.MeasureString(displayText, newQuery.GetGroupTitle().Font).Width / grfx.DpiX * 100 + 2), (int)(grfx.MeasureString(displayText, newQuery.GetGroupTitle().Font).Height / grfx.DpiY * 100 + 2));
                                newQuery.GetGroupTitle().StaticText = displayText;
                            }
                            else
                            {
                                newQuery.GetGroupTitle().StaticText = Lans.g(this, "Undefined");
                            }
                            break;

                        case SplitByKind.Date:
                            newQuery.GetGroupTitle().StaticText = PIn.Date(newQuery.ReportTable.Rows[0][query.ColumnNameToSplitOn].ToString()).ToShortDateString();
                            break;

                        case SplitByKind.Value:
                            newQuery.GetGroupTitle().StaticText = newQuery.ReportTable.Rows[0][query.ColumnNameToSplitOn].ToString();
                            break;
                        }
                        newQuery.SubmitQuery();
                        newQuery.IsLastSplit = true;
                        newReportObjects.Add(newQuery);
                    }
                    else
                    {
                        newReportObjects.Add(_reportObjects[i]);
                    }
                }
                else
                {
                    newReportObjects.Add(_reportObjects[i]);
                }
            }
            if (!hasRows && isShowMessage)
            {
                _actionCloseReportProgress?.Invoke();
                MsgBox.Show(this, "The report has no results to show.");
                return(false);
            }
            _reportObjects = newReportObjects;
            return(true);
        }
コード例 #12
0
        private void FillGrid()
        {
            Cursor = Cursors.WaitCursor;
            gridMain.BeginUpdate();
            List <DisplayField> fields = DisplayFields.GetForCategory(DisplayFieldCategory.CEMTSearchPatients);

            if (gridMain.Columns.Count == 0)           //Init only once.
            {
                foreach (DisplayField field in fields)
                {
                    string heading = field.InternalName;
                    if (string.IsNullOrEmpty(heading))
                    {
                        heading = field.Description;
                    }
                    gridMain.Columns.Add(new ODGridColumn(heading, field.ColumnWidth));
                }
            }
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < _dataConnPats.Tables.Count; i++)
            {
                for (int j = 0; j < _dataConnPats.Tables[i].Rows.Count; j++)
                {
                    row = new ODGridRow();
                    foreach (DisplayField field in fields)
                    {
                        switch (field.InternalName)
                        {
                            #region Row Cell Filling
                        case "Conn":
                            row.Cells.Add(_dataConnPats.Tables[i].TableName);
                            break;

                        case "PatNum":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["PatNum"].ToString());
                            break;

                        case "LName":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["LName"].ToString());
                            break;

                        case "FName":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["FName"].ToString());
                            break;

                        case "SSN":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["SSN"].ToString());
                            break;

                        case "PatStatus":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["PatStatus"].ToString());
                            break;

                        case "Age":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["age"].ToString());
                            break;

                        case "City":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["City"].ToString());
                            break;

                        case "State":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["State"].ToString());
                            break;

                        case "Address":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["Address"].ToString());
                            break;

                        case "Wk Phone":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["WkPhone"].ToString());
                            break;

                        case "Email":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["Email"].ToString());
                            break;

                        case "ChartNum":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["ChartNumber"].ToString());
                            break;

                        case "MI":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["MiddleI"].ToString());
                            break;

                        case "Pref Name":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["Preferred"].ToString());
                            break;

                        case "Hm Phone":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["HmPhone"].ToString());
                            break;

                        case "Bill Type":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["BillingType"].ToString());
                            break;

                        case "Pri Prov":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["PriProv"].ToString());
                            break;

                        case "Birthdate":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["Birthdate"].ToString());
                            break;

                        case "Site":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["site"].ToString());
                            break;

                        case "Clinic":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["clinic"].ToString());
                            break;

                        case "Wireless Ph":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["WirelessPhone"].ToString());
                            break;

                        case "Sec Prov":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["SecProv"].ToString());
                            break;

                        case "LastVisit":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["lastVisit"].ToString());
                            break;

                        case "NextVisit":
                            row.Cells.Add(_dataConnPats.Tables[i].Rows[j]["nextVisit"].ToString());
                            break;
                            #endregion
                        }
                    }
                    row.Tag = ListConns.Find(x => ((x.ServerName + ", " + x.DatabaseName) == _dataConnPats.Tables[i].TableName || x.ServiceURI == _dataConnPats.Tables[i].TableName));
                    gridMain.Rows.Add(row);
                }
            }
            gridMain.EndUpdate();
            Cursor = Cursors.Default;
            if (_complConnAmt == ListConns.Count)
            {
                ODThread.QuitSyncThreadsByGroupName(1, "FetchPats");               //Clean up finished threads.
                butRefresh.Text    = Lans.g(this, "Refresh");
                labelFetch.Visible = false;
                if (!_hasWarningShown && _invalidConnsLog != "")
                {
                    _hasWarningShown = true;                  //Keeps the message box from showing up for subsequent threads.
                    MessageBox.Show(this, Lan.g(this, "Could not connect to the following servers") + ":" + _invalidConnsLog);
                }
            }
            else
            {
                butRefresh.Text    = Lans.g(this, "Stop Refresh");
                labelFetch.Visible = true;
            }
        }
コード例 #13
0
ファイル: FileStore.cs プロジェクト: luisurbinanet/apolloniax
        protected override void OnPatientStoreOpened(EventArgs e, object sender)
        {
            if (Patient.ImageFolder == "")             //creates new folder for patient if none present
            {
                string name   = Patient.LName + Patient.FName;
                string folder = "";
                for (int i = 0; i < name.Length; i++)
                {
                    if (Char.IsLetter(name, i))
                    {
                        folder += name.Substring(i, 1);
                    }
                }
                folder += Patient.PatNum.ToString();                //ensures unique name
                try {
                    Patient PatOld = Patient.Copy();
                    Patient.ImageFolder = folder;
                    patFolder           = ODFileUtils.CombinePaths(new string[] { FileStoreSettings.GetPreferredImagePath,
                                                                                  Patient.ImageFolder.Substring(0, 1).ToUpper(),
                                                                                  Patient.ImageFolder });
                    Directory.CreateDirectory(patFolder);
                    ImageStore.UpdatePatient(Patient, PatOld);
                }
                catch {
                    throw new Exception(Lan.g("ContrDocs", "Error.  Could not create folder for patient. "));
                    return;
                }
            }
            else              //patient folder already created once
            {
                patFolder = ODFileUtils.CombinePaths(new string[] { FileStoreSettings.GetPreferredImagePath,
                                                                    Patient.ImageFolder.Substring(0, 1).ToUpper(),
                                                                    Patient.ImageFolder });
            }
            if (!Directory.Exists(patFolder))             //this makes it more resiliant and allows copies
            //of the opendentaldata folder to be used in read-only situations.
            {
                try {
                    Directory.CreateDirectory(patFolder);
                }
                catch {
                    throw new Exception(Lan.g("ContrDocs", "Error.  Could not create folder for patient. "));
                }
            }
            //now find all files in the patient folder that are not in the db and add them
            DirectoryInfo di = new DirectoryInfo(patFolder);

            FileInfo[] fiList   = di.GetFiles();
            string[]   fileList = new string[fiList.Length];
            for (int i = 0; i < fileList.Length; i++)
            {
                fileList[i] = fiList[i].Name;
            }
            int countAdded = Documents.InsertMissing(Patient, fileList);

            if (countAdded > 0)
            {
                Debug.WriteLine(countAdded.ToString() + " documents found and added to the first category.");
            }
            //it will refresh in FillDocList
        }
コード例 #14
0
		private void FillClinics() {
			if(!Db.HasDatabaseConnection && !Security.IsUserLoggedIn) {
				return;
			}
			try {
				if(!PrefC.HasClinicsEnabled) {
					Visible=false;
					return;
				}
				Items.Clear();
				List<Clinic> listClinics=Clinics.GetForUserod(Security.CurUser);
				if(!Security.CurUser.ClinicIsRestricted || listClinics.Count > 1) {
					Items.Add(new ODBoxItem<Clinic>(Lan.g("ComboBoxClinicMulti","All"),new Clinic { Abbr=Lan.g("ComboBoxClinicMulti","All"),
						Description=Lan.g("ComboBoxClinicMulti","All"),ClinicNum=CLINIC_NUM_ALL }));
				}
				if(!Security.CurUser.ClinicIsRestricted) {
					Items.Add(new ODBoxItem<Clinic>(Lan.g("ComboBoxClinicMulti",HqDescription),new Clinic { Abbr=Lan.g("ComboBoxClinicMulti",HqDescription),
						Description=Lan.g("ComboBoxClinicMulti",HqDescription),ClinicNum=0 }));
				}
				foreach(Clinic clinic in listClinics.OrderBy(x => x.Abbr)) {
					Items.Add(new ODBoxItem<Clinic>(clinic.Abbr,clinic));
				}
				if(Items.Count > 0) {
					ListSelectedClinicNums=new List<long> { Clinics.ClinicNum };
				}
			}
			catch(Exception ex) {
				ex.DoNothing();
			}
		}
コード例 #15
0
 private void FillControl()
 {
     labelClinicName.Text = Signup.ClinicNum != 0 ? Clinics.GetDesc(Signup.ClinicNum) : Lan.g(this, "Headquarters");
     labelEnabled.Text    = Signup.IsEnabled ? Lan.g(this, "Enabled") : Lan.g(this, "Disabled");
     FillGrid();
 }
コード例 #16
0
        private bool CheckTableStatus()
        {
            bool rValOK_TO_RUN = false;

            if (!TableExists(TABLENAME))
            {
                DialogResult dr = MessageBox.Show(Lan.g(this, "The Table for holding provider split infomation generated\n"
                                                        + "by MyAllocator1 does not exist."
                                                        + "Creation of this table is required create set up allocation by provider\n"
                                                        + "according to the rules in MyAllocator1.\n\n"
                                                        + "Do you want to create this table?"), Lan.g(this, "Create Table"), MessageBoxButtons.YesNoCancel);
                if (dr == DialogResult.Yes)
                {
                    Db.NonQOld(MyAllocator1_ProviderPayment.CreatTableString(OpenDentBusiness.DatabaseType.MySql));
                }
            }
            rValOK_TO_RUN = TableExists(TABLENAME);
            return(rValOK_TO_RUN);
        }
コード例 #17
0
        /// <summary>
        /// Returns a list of guarantors that require allocation.
        /// Will look for a half finished job from previous.
        /// Returns null if user does not want to continue a suspended job.
        /// </summary>
        private int[] Generate_GuarantorList_ToAllocate()
        {
            int[] rValue = null;
            // Check status of an incomplete last run.  Did it complete well?
            string TempTableName   = TABLENAME + "_temp";
            bool   TempTableExists = TableExists(TempTableName);

            int[]      FullyProcessedGuarantors     = null;
            int[]      PartiallyProcessedGuarantors = null;
            List <int> OD_Guarantors = new List <int>();
            List <int> OD_Guarantors_NeedProcessing = null;           // new List<int>();

            // Find fully processed Guarantors
            #region Check with users on continuing an incomplete batch run
            if (TempTableExists)
            {
                DialogResult dr = MessageBox.Show(Lan.g(this, "Processing was incomplete during last\n"
                                                        + "run of the batch allocation process. Do you want to start over?\n"
                                                        + "This will likely result in a loss of data but the data will\n"
                                                        + "be rebuilt\n\nDO YOU WANT TO START OVER?"), "Warning", MessageBoxButtons.YesNo);
                if (dr == DialogResult.Yes)                // THEY Want to START OVER --DROP TABLE AND RECREATE
                {
                    string dropCommand = "DROP TABLE " + TABLENAME + "_temp";
                    Db.NonQOld(dropCommand);
                    dropCommand = "DROP TABLE " + TABLENAME;
                    Db.NonQOld(dropCommand);
                    Db.NonQOld(CreatTableString(OpenDentBusiness.DatabaseType.MySql));
                    Db.NonQOld(Create_AP_temp_table_string(OpenDentBusiness.DatabaseType.MySql));
                }
                if (dr == DialogResult.No)                // Don't want to start over
                {
                    DialogResult dr2 = MessageBox.Show(Lan.g(this, "Do you want to continue from where you left of?\n"
                                                             + "If you state no the allocation process will be aborted.\n\nContinue?"),
                                                       Lan.g(this, "Continue?"), MessageBoxButtons.YesNo);
                    if (dr2 == DialogResult.No)
                    {
                        return(null);                        // don't want to continue
                    }
                }
            }
            else             // Temp table does not exists so create it!
            {
                Db.NonQOld(Create_AP_temp_table_string(OpenDentBusiness.DatabaseType.MySql));
            }
            #endregion
            //  Here is what needs to be done:
            //		1) Find Guarantors with incomplete processing
            //		2) Drop the entries in the allocation_provier table associated with this guarantor
            //		3) Set _temp table Status for this guarantor
            //		4) Generate a list of unprocessed guarantors.

            // continuing
            #region Handle Incomplete Proccessed Guarantors
            string cmd2 = "SELECT tempIndex, Guarantor, AllocStatus FROM " + TempTableName
                          + " WHERE AllocStatus = " + ((int)ProcessingState.Started_and_Incomplete).ToString();
            DataTable dt = Db.GetTableOld(cmd2);
            if (dt.Rows.Count != 0)
            {
                string deleteCommand1 = "DELETE FROM " + TABLENAME + " WHERE ";
                string updateCommand1 = "UPDATE " + TABLENAME + "_temp SET AllocStatus = " + ((int)ProcessingState.NeverStarted).ToString() + "\n WHERE ";
                PartiallyProcessedGuarantors = new int[dt.Rows.Count];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    PartiallyProcessedGuarantors[i] = Int32.Parse(dt.Rows[i][1].ToString());
                    deleteCommand1 += "\nGuarantor = " + PartiallyProcessedGuarantors[i].ToString() + "\n";
                    updateCommand1 += "\nGuarantor = " + PartiallyProcessedGuarantors[i].ToString() + "\n";
                    if (i < dt.Rows.Count - 1)
                    {
                        deleteCommand1 += "OR ";
                        updateCommand1 += "OR ";
                    }
                }
                Db.NonQOld(deleteCommand1);                // deletes entries from allocation_provider
                Db.NonQOld(updateCommand1);                // updates status in allocation_provider_temp
            }
            #endregion
            #region Generate a list of unprocessed guarantors
            string ProccessedGuarantors_command = "SELECT Guarantor FROM " + TABLENAME + "_temp WHERE AllocStatus = "
                                                  + ((int)ProcessingState.Complete);
            DataTable dt3            = Db.GetTableOld(ProccessedGuarantors_command);
            DataTable dtODGuarantors = Db.GetTableOld("SELECT DISTINCT(Guarantor) FROM Patient");
            for (int i = 0; i < dtODGuarantors.Rows.Count; i++)
            {
                OD_Guarantors.Add(Int32.Parse(dtODGuarantors.Rows[i][0].ToString()));
            }
            if (dt3.Rows.Count != 0)
            {
                FullyProcessedGuarantors     = new int[dt3.Rows.Count];
                OD_Guarantors_NeedProcessing = new List <int>();
                OD_Guarantors_NeedProcessing.AddRange(OD_Guarantors);
                for (int i = 0; i < dt3.Rows.Count; i++)
                {
                    FullyProcessedGuarantors[i] = Int32.Parse(dt3.Rows[i][0].ToString());
                    if (OD_Guarantors_NeedProcessing.Contains(FullyProcessedGuarantors[i]))
                    {
                        OD_Guarantors_NeedProcessing.Remove(FullyProcessedGuarantors[i]);
                    }
                }
            }
            else
            {
                OD_Guarantors_NeedProcessing = OD_Guarantors;
            }
            #endregion

            if (OD_Guarantors_NeedProcessing != null)
            {
                rValue = OD_Guarantors_NeedProcessing.ToArray();
            }
            return(rValue);
        }
コード例 #18
0
 public UserControlSetupWizComplete(string name)
 {
     InitializeComponent();
     labelDone.Text = Lan.g(this, "Congratulations! You have finished setting up your " + name + "!");
     labelEnd.Text  = "\r\n" + Lan.g(this, "You can always go back through this setup wizard if you need to make any modifications to your " + name + ".");
 }
コード例 #19
0
        private void btnImportForms_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            XmlDocument x = new XmlDocument();

            AddResults("Downloading new patient list...");
            try
            {
                x.Load(sURL);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Cannot access account.\r\n\r\nPlease make sure URL, username and password are correct.\r\n\r\nContact www.NewPatientForm.com for help.\r\n\r\n" + ex.Message);
                this.Close();
                return;
            }

            if (x.DocumentElement.ChildNodes.Count == 0)
            {
                MessageBox.Show("No new patients.");
                this.Close();
                return;
            }

            //Now that we have loaded all the new patient forms, loop through
            //each patient, import the xml and store the pdf file
            foreach (XmlNode ndeMessage in x.DocumentElement.ChildNodes)
            {
                string sPatientName = "";

                try
                {
                    sPatientName += ndeMessage.SelectSingleNode("PatientIdentification/NameLast").InnerText;
                }
                catch
                {
                    AddResults("No lastname found.");
                }

                try
                {
                    sPatientName += ", " + ndeMessage.SelectSingleNode("PatientIdentification/NameFirst").InnerText;
                }
                catch
                {
                    AddResults("No firstname found.");
                }

                if (MessageBox.Show("Do you want to import information for " + sPatientName + " ?", "", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    AddResults("Adding patient " + sPatientName);

                    string sPDF = "";

                    try
                    {
                        sPDF = ndeMessage.SelectSingleNode("PatientIdentification/NewPatientForm").InnerText;
                    }
                    catch
                    {
                        AddResults("No pdf form found.");
                    }

                    //We have the encoded pdf in sPDF string so lets
                    //delete that node and try to import the patient
                    ndeMessage.SelectSingleNode("PatientIdentification").RemoveChild(ndeMessage.SelectSingleNode("PatientIdentification/NewPatientForm"));

                    FormImportXML frmX = new FormImportXML();
                    frmX.textMain.Text = ndeMessage.OuterXml;
                    frmX.butOK_Click(null, null);


                    //The patient info is entered, let's save the pdf document to the images folder

                    try
                    {
                        //We'll be working with a document

                        //First make sure we have a directory and
                        //everything is up to date
                        ContrDocs cd = new ContrDocs();

                        cd.RefreshModuleData(frmX.existingPatOld.PatNum);


                        Document DocCur = new Document();

                        OpenFileDialog openFileDialog = new OpenFileDialog();
                        DocCur.FileName    = ".pdf";
                        DocCur.DateCreated = DateTime.Today;

                        //Find the category, hopefully 'Patient Information'
                        //otherwise, just default to first one
                        int iCategory = iCategory = DefB.Short[(int)DefCat.ImageCats][0].DefNum;;
                        for (int i = 0; i < DefB.Short[(int)DefCat.ImageCats].Length; i++)
                        {
                            if (DefB.Short[(int)DefCat.ImageCats][i].ItemName == "Patient Information")
                            {
                                iCategory = DefB.Short[(int)DefCat.ImageCats][i].DefNum;
                            }
                        }
                        DocCur.DocCategory = iCategory;
                        DocCur.ImgType     = ImageType.Document;
                        DocCur.Description = "New Patient Form";
                        DocCur.WithPat     = cd.PatCur.PatNum;
                        Documents.Insert(DocCur, cd.PatCur);//this assigns a filename and saves to db


                        try
                        {
                            // Convert the Base64 UUEncoded input into binary output.
                            byte[] binaryData = System.Convert.FromBase64String(sPDF);

                            // Write out the decoded data.
                            System.IO.FileStream outFile = new System.IO.FileStream(cd.patFolder + DocCur.FileName, System.IO.FileMode.Create, System.IO.FileAccess.Write);
                            outFile.Write(binaryData, 0, binaryData.Length);
                            outFile.Close();
                            //Above is the code to save the file to a particular directory from NewPatientForm.com
                        }
                        catch
                        {
                            MessageBox.Show(Lan.g(this, "Unable to write pdf file to disk."));
                            Documents.Delete(DocCur);
                        }
                    }
                    catch
                    {
                        AddResults("Could not save pdf file to patient's file.");
                    }

                    AddResults("Done writing pdf file to disk");
                }
                else
                {
                    AddResults("Cacelled import for " + sPatientName + ".");
                }
            }
            this.Cursor = Cursors.Default;
            MessageBox.Show("Import complete.\r\n\r\nIf any form imports were cancelled or unsuccessful\r\nthey will need to be imported manually.");

            btnImportForms.Enabled = false;
            //clear form instanciations
        }
コード例 #20
0
        ///<summary>Adds the xml for one statement.</summary>
        public static void GenerateOneStatement(XmlWriter writer, Statement stmt, Patient pat, Family fam, DataSet dataSet)
        {
            Patient guar = fam.ListPats[0];

            writer.WriteStartElement("Statement");
            //writer.WriteAttributeString("CreditCardChoice",PrefC.GetString(PrefName.BillingElectCreditCardChoices"));
            //remit address----------------------------------------------------------
            writer.WriteStartElement("RemitAddress");
            if (PrefC.HasClinicsEnabled && Clinics.GetCount() > 0 &&         //if using clinics
                Clinics.GetClinic(guar.ClinicNum) != null)                 //and this guar is assigned to a clinic
            {
                Clinic clinic = Clinics.GetClinic(guar.ClinicNum);
                writer.WriteElementString("Name", clinic.Description);
                writer.WriteElementString("Address", clinic.Address);
                writer.WriteElementString("Address2", clinic.Address2);
                writer.WriteElementString("City", clinic.City);
                writer.WriteElementString("State", clinic.State);
                writer.WriteElementString("Zip", clinic.Zip);
                string phone = "";
                if (clinic.Phone.Length == 10)
                {
                    phone = "(" + clinic.Phone.Substring(0, 3) + ")" + clinic.Phone.Substring(3, 3) + "-" + clinic.Phone.Substring(6);
                }
                writer.WriteElementString("Phone", phone);
            }
            else             //not using clinics
            {
                writer.WriteElementString("Name", PrefC.GetString(PrefName.PracticeTitle));
                writer.WriteElementString("Address", PrefC.GetString(PrefName.PracticeAddress));
                writer.WriteElementString("Address2", PrefC.GetString(PrefName.PracticeAddress2));
                writer.WriteElementString("City", PrefC.GetString(PrefName.PracticeCity));
                writer.WriteElementString("State", PrefC.GetString(PrefName.PracticeST));
                writer.WriteElementString("Zip", PrefC.GetString(PrefName.PracticeZip));
                writer.WriteElementString("Phone", PrefC.GetString(PrefName.PracticePhone));
            }
            writer.WriteEndElement();            //RemitAddress
            //Patient-------------------------------------------------------------------------------
            writer.WriteStartElement("Patient");
            writer.WriteElementString("Name", guar.GetNameFLFormal());
            writer.WriteElementString("AccountNum", guar.PatNum.ToString());
            writer.WriteElementString("Address", guar.Address);
            writer.WriteElementString("Address2", guar.Address2);
            writer.WriteElementString("City", guar.City);
            writer.WriteElementString("State", guar.State);
            writer.WriteElementString("Zip", guar.Zip);
            writer.WriteEndElement();            //Patient
            //Account summary-----------------------------------------------------------------------
            writer.WriteStartElement("AccountSummary");
            if (PrefC.GetLong(PrefName.StatementsCalcDueDate) == -1)
            {
                writer.WriteElementString("DueDate", Lan.g("FormRpStatement", "Upon Receipt"));
            }
            else
            {
                DateTime dueDate = DateTime.Today.AddDays(PrefC.GetLong(PrefName.StatementsCalcDueDate));
                writer.WriteElementString("DueDate", dueDate.ToString("MM/dd/yyyy"));
            }
            writer.WriteElementString("StatementDate", stmt.DateSent.ToString("MM/dd/yyyy"));
            DataTable tableAccount = null;

            for (int i = 0; i < dataSet.Tables.Count; i++)
            {
                if (dataSet.Tables[i].TableName.StartsWith("account"))
                {
                    tableAccount = dataSet.Tables[i];
                }
            }
            //on a regular printed statement, the amount due at the top might be different from the balance at the middle right.
            //This is because of payment plan balances.
            //But in e-bills, there is only one amount due.
            //Insurance estimate is already subtracted, and payment plan balance is already added.
            double amountDue = guar.BalTotal;

            //add payplan due amt:
            for (int m = 0; m < dataSet.Tables["misc"].Rows.Count; m++)
            {
                if (dataSet.Tables["misc"].Rows[m]["descript"].ToString() == "payPlanDue")
                {
                    amountDue += PIn.Double(dataSet.Tables["misc"].Rows[m]["value"].ToString());
                }
            }
            if (PrefC.GetBool(PrefName.BalancesDontSubtractIns))
            {
                writer.WriteElementString("EstInsPayments", "");                         //optional.
            }
            else                                                                         //this is typical
            {
                writer.WriteElementString("EstInsPayments", guar.InsEst.ToString("F2")); //optional.
                amountDue -= guar.InsEst;
            }
            InstallmentPlan installPlan = InstallmentPlans.GetOneForFam(guar.PatNum);

            if (installPlan != null)
            {
                //show lesser of normal total balance or the monthly payment amount.
                if (installPlan.MonthlyPayment < amountDue)
                {
                    amountDue = installPlan.MonthlyPayment;
                }
            }
            writer.WriteElementString("AmountDue", amountDue.ToString("F2"));
            writer.WriteElementString("Bal_0_30", guar.Bal_0_30.ToString("F2"));
            writer.WriteElementString("Bal_31_60", guar.Bal_31_60.ToString("F2"));
            writer.WriteElementString("Bal_61_90", guar.Bal_61_90.ToString("F2"));
            writer.WriteElementString("BalOver90", guar.BalOver90.ToString("F2"));
            writer.WriteEndElement();            //AccountSummary
            //Notes-----------------------------------------------------------------------------------
            writer.WriteStartElement("Notes");
            if (stmt.NoteBold != "")
            {
                writer.WriteStartElement("Note");
                writer.WriteAttributeString("FgColor", ColorToHexString(Color.DarkRed));
                writer.WriteCData(stmt.NoteBold);
                writer.WriteEndElement();                //Note
            }
            if (stmt.Note != "")
            {
                writer.WriteStartElement("Note");
                writer.WriteAttributeString("FgColor", ColorToHexString(Color.Black));
                writer.WriteCData(stmt.Note);
                writer.WriteEndElement();        //Note
            }
            writer.WriteEndElement();            //Notes
            //Detail items------------------------------------------------------------------------------
            writer.WriteStartElement("DetailItems");
            string descript;
            string fulldesc;
            string procCode;
            string tth;

            string[]      lineArray;
            List <string> lines;
            DateTime      date;
            int           seq = 0;

            for (int i = 0; i < tableAccount.Rows.Count; i++)
            {
                procCode  = tableAccount.Rows[i]["ProcCode"].ToString();
                tth       = tableAccount.Rows[i]["tth"].ToString();
                descript  = tableAccount.Rows[i]["description"].ToString();
                fulldesc  = procCode + " " + tth + " " + descript;
                lineArray = fulldesc.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
                lines     = new List <string>(lineArray);
                //We assume that the line limit is 40 char.
                if (lines[0].Length > 40)
                {
                    string newline = lines[0].Substring(40);
                    lines[0] = lines[0].Substring(0, 40);       //first half
                    lines.Insert(1, newline);                   //second half
                }
                for (int li = 0; li < lines.Count; li++)
                {
                    writer.WriteStartElement("Item");
                    writer.WriteAttributeString("sequence", seq.ToString());
                    if (li == 0)
                    {
                        date = (DateTime)tableAccount.Rows[i]["DateTime"];
                        writer.WriteElementString("Date", date.ToString("MM/dd/yyyy"));
                        writer.WriteElementString("PatientName", tableAccount.Rows[i]["patient"].ToString());
                    }
                    else
                    {
                        writer.WriteElementString("Date", "");
                        writer.WriteElementString("PatientName", "");
                    }
                    writer.WriteElementString("Description", lines[li]);
                    if (li == 0)
                    {
                        writer.WriteElementString("Charges", tableAccount.Rows[i]["charges"].ToString());
                        writer.WriteElementString("Credits", tableAccount.Rows[i]["credits"].ToString());
                        writer.WriteElementString("Balance", tableAccount.Rows[i]["balance"].ToString());
                    }
                    else
                    {
                        writer.WriteElementString("Charges", "");
                        writer.WriteElementString("Credits", "");
                        writer.WriteElementString("Balance", "");
                    }
                    writer.WriteEndElement();                    //Item
                    seq++;
                }
            }
            writer.WriteEndElement();            //DetailItems
            writer.WriteEndElement();            //Statement
        }
コード例 #21
0
        ///<summary>Adds the xml for one statement. Validation is performed here. Throws an exception if there is a validation failure.</summary>
        public static void GenerateOneStatement(XmlWriter writer, Statement stmt, Patient pat, Family fam, DataSet dataSet)
        {
            DataTable tableMisc    = dataSet.Tables["misc"];
            DataTable tableAccount = dataSet.Tables.OfType <DataTable>().FirstOrDefault(x => x.TableName.StartsWith("account"));
            Patient   guar         = fam.ListPats[0];

            if (!Regex.IsMatch(guar.State, "^[A-Z]{2}$"))
            {
                throw new ApplicationException(Lan.g("EHG_Statements", "Guarantor state must be two uppercase characters.") + " " + guar.FName + " " + guar.LName + " #" + guar.PatNum);
            }
            writer.WriteStartElement("EisStatement");
            writer.WriteAttributeString("OutputFormat", "StmOut_Blue6Col");
            writer.WriteAttributeString("CreditCardChoice", PrefC.GetString(PrefName.BillingElectCreditCardChoices));
            writer.WriteStartElement("Patient");
            writer.WriteElementString("Name", guar.GetNameFLFormal());
            writer.WriteElementString("Account", guar.PatNum.ToString());
            writer.WriteElementString("Address1", guar.Address);
            writer.WriteElementString("Address2", guar.Address2);
            writer.WriteElementString("City", guar.City);
            writer.WriteElementString("State", guar.State);
            writer.WriteElementString("Zip", guar.Zip);
            writer.WriteElementString("EMail", guar.Email);
            //Account summary-----------------------------------------------------------------------
            writer.WriteStartElement("AccountSummary");
            if (stmt.DateRangeFrom.Year < 1880)           //make up a statement date.
            {
                writer.WriteElementString("PriorStatementDate", DateTime.Today.AddMonths(-1).ToString("MM/dd/yyyy"));
            }
            else
            {
                writer.WriteElementString("PriorStatementDate", stmt.DateRangeFrom.AddDays(-1).ToString("MM/dd/yyyy"));
            }
            DateTime dueDate;

            if (PrefC.GetLong(PrefName.StatementsCalcDueDate) == -1)
            {
                dueDate = DateTime.Today.AddDays(10);
            }
            else
            {
                dueDate = DateTime.Today.AddDays(PrefC.GetLong(PrefName.StatementsCalcDueDate));
            }
            writer.WriteElementString("DueDate", dueDate.ToString("MM/dd/yyyy"));
            writer.WriteElementString("StatementDate", stmt.DateSent.ToString("MM/dd/yyyy"));
            double balanceForward = tableMisc.Rows.OfType <DataRow>().Where(x => x["descript"].ToString() == "balanceForward")
                                    .Select(x => PIn.Double(x["value"].ToString())).FirstOrDefault();//defaults to 0

            writer.WriteElementString("PriorBalance", balanceForward.ToString("F2"));
            writer.WriteElementString("RunningBalance", "");      //for future use
            writer.WriteElementString("PerPayAdj", "");           //optional
            writer.WriteElementString("InsPayAdj", "");           //optional
            writer.WriteElementString("Adjustments", "");         //for future use
            double charges = tableAccount.Rows.OfType <DataRow>().Sum(x => PIn.Double(x["chargesDouble"].ToString()));

            writer.WriteElementString("NewCharges", charges.ToString("F2")); //optional
            writer.WriteElementString("FinanceCharges", "");                 //for future use
            double credits = tableAccount.Rows.OfType <DataRow>().Sum(x => PIn.Double(x["creditsDouble"].ToString()));

            writer.WriteElementString("Credits", credits.ToString("F2"));
            //On a regular printed statement, the amount due at the top might be different from the balance at the middle right due to payplan balances.
            //But in e-bills, there is only one amount due.  Insurance estimate is already subtracted, and payment plan balance is already added.
            double amountDue = guar.BalTotal;

            if (PrefC.GetInt(PrefName.PayPlansVersion) == 1)           //with version 2, payplan debits/credits are aged individually and are included in guar.BalTotal
            {
                amountDue += tableMisc.Rows.OfType <DataRow>().Where(x => x["descript"].ToString() == "payPlanDue")
                             .Select(x => PIn.Double(x["value"].ToString())).DefaultIfEmpty(0).Sum();           //add payplan(s) due amt
            }
            double insEst = 0;

            if (!PrefC.GetBool(PrefName.BalancesDontSubtractIns))             //this is typical
            {
                insEst = guar.InsEst;
            }
            InstallmentPlan installPlan = InstallmentPlans.GetOneForFam(guar.PatNum);

            if (installPlan != null && installPlan.MonthlyPayment < (amountDue - insEst))
            {
                amountDue = installPlan.MonthlyPayment;
                insEst    = 0;
            }
            writer.WriteElementString("EstInsPayments", insEst.ToString("F2"));    //optional.
            writer.WriteElementString("PatientShare", (amountDue - insEst).ToString("F2"));
            writer.WriteElementString("CurrentBalance", amountDue.ToString("F2")); //this is ambiguous.  It seems to be AmountDue, but it could be 0-30 days aging
            writer.WriteElementString("PastDue30", guar.Bal_31_60.ToString("F2")); //optional
            writer.WriteElementString("PastDue60", guar.Bal_61_90.ToString("F2")); //optional
            writer.WriteElementString("PastDue90", guar.BalOver90.ToString("F2")); //optional
            writer.WriteElementString("PastDue120", "");                           //optional
            writer.WriteEndElement();                                              //AccountSummary
            //Notes-----------------------------------------------------------------------------------
            writer.WriteStartElement("Notes");
            if (stmt.NoteBold != "")
            {
                writer.WriteStartElement("Note");
                writer.WriteAttributeString("FgColor", "Red"); //ColorToHexString(Color.DarkRed));
                //writer.WriteAttributeString("BgColor",ColorToHexString(Color.White));
                writer.WriteCData(stmt.NoteBold.Left(500));    //Limit of 500 char on notes.
                writer.WriteEndElement();                      //Note
            }
            if (stmt.Note != "")
            {
                writer.WriteStartElement("Note");
                //writer.WriteAttributeString("FgColor",ColorToHexString(Color.Black));
                //writer.WriteAttributeString("BgColor",ColorToHexString(Color.White));
                writer.WriteCData(stmt.Note.Left(500)); //Limit of 500 char on notes.
                writer.WriteEndElement();               //Note
            }
            writer.WriteEndElement();                   //Notes
            //Detail items------------------------------------------------------------------------------
            writer.WriteStartElement("DetailItems");
            List <string> lines;
            int           seq = 0;
            //Jessica at DentalXchange says limit is 120.  Specs say limit is 30.
            //If we send more than 50 characters, DentalXChange will break the line at the 50th character, even if it is in the middle of a word, and wrap
            //the rest of the line, so up to 70 chars onto line 2, which could easily extend past the end of the description field.  The wrapped line will
            //also have a different line spacing than if sent as a separate xml element.  See the examples in
            //...\Programmers Documents\eClaims Clearinghouse and Carrier Specific Details\DentalXChange ClaimConnect\ClaimConnect - EHG - WebClaim\EHG Statements\Examples
            //Example: original description:
            //line 1: 'D6103 5  bone graft for repair of periimplant defect - does not include flap entry and closure.  Placement of a barrier membrane or biologic materials to aid in osseous regeneration are reported separately'
            //version 16.2 sent as:
            //line 1: 'D6103 5  bone graft for repair of periimplant defect - does not include flap entry and closure.  Placement of a barrier '
            //line 2: 'membrane or biologic materials to aid in osseous regeneration are reported separately'
            //DentalXChange displayed lines as (with line 2 extended past the end of the description field):
            //line 1: 'D6103 5 bone graft for repair of periimplant defe -'
            //line 2: 'ct - does not include flap entry and closure. Placement of a barrier'
            //line 3: 'membrane or biologic materials to aid in osseous r -'
            //line 4: 'egeneration are reported separately'
            //version 16.3 and up sent and displayed as:
            //line 1: 'D6103 5  bone graft for repair of periimplant'
            //line 2: 'defect - does not include flap entry and closure.'
            //line 3: 'Placement of a barrier membrane or biologic'
            //line 4: 'materials to aid in osseous regeneration are'
            //line 5: 'reported separately'
            const int lineMaxLen = 50;
            int       firstIndexNewLine;
            string    lineCur;

            foreach (DataRow rowCur in tableAccount.Rows)
            {
                //There are frequently CRs within a procedure description for things like ins est.
                lines = string.Join(" ", new[] { rowCur["ProcCode"].ToString(), rowCur["tth"].ToString(), rowCur["description"].ToString() })
                        .Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToList();
                for (int li = 0; li < lines.Count; li++)
                {
                    lineCur = lines[li];
                    if (lineCur.Length < 1 || lineCur.All(x => char.IsWhiteSpace(x)))                   //nothing to write
                    {
                        continue;
                    }
                    writer.WriteStartElement("DetailItem");                    //has a child item. We won't add optional child note
                    writer.WriteAttributeString("sequence", seq.ToString());
                    writer.WriteStartElement("Item");
                    writer.WriteElementString("Date", li == 0?PIn.Date(rowCur["DateTime"].ToString()).ToString("MM/dd/yyyy"):"");
                    writer.WriteElementString("PatientName", li == 0?rowCur["patient"].ToString():"");
                    if (lineCur.Length > lineMaxLen)
                    {
                        firstIndexNewLine = lineMaxLen;
                        for (int c = lineMaxLen - 2; c > -1; c--)                 //-2, 1 for length to index and 1 so we can safely check index and index+1
                        {
                            if (!char.IsWhiteSpace(lineCur[c]) && char.IsWhiteSpace(lineCur[c + 1]))
                            {
                                firstIndexNewLine = c + 1;
                                break;
                            }
                        }
                        lines.Insert(li + 1, lineCur.Substring(firstIndexNewLine).Trim());
                        lines[li] = lineCur.Left(firstIndexNewLine);
                    }
                    writer.WriteStartElement("Description");
                    writer.WriteCData(lines[li]);                //CData to allow any string, including punctuation, syntax characters and special characters.
                    writer.WriteEndElement();                    //Description
                    writer.WriteElementString("Charges", li == 0?rowCur["charges"].ToString():"");
                    writer.WriteElementString("Credits", li == 0?rowCur["credits"].ToString():"");
                    writer.WriteElementString("Balance", li == 0?rowCur["balance"].ToString():"");
                    writer.WriteEndElement();                    //Item
                    writer.WriteEndElement();                    //DetailItem
                    seq++;
                }
                #region Notes Don't Display On Statements

                /*The code below just didn't work because notes don't get displayed on the statement.
                 * linedesc=lines[0];
                 * note="";
                 * if(linedesc.Length>30) {
                 *      note=linedesc.Substring(30);
                 *      linedesc=linedesc.Substring(0,30);
                 * }
                 * for(int l=1;l<lines.Length;l++) {
                 *      if(note!="") {
                 *              note+="\r\n";
                 *      }
                 *      note+=lines[l];
                 * }
                 *
                 * if(note!="") {
                 *      writer.WriteStartElement("Note");
                 *      //we're not going to specify colors here since they're optional
                 *      writer.WriteCData(note);
                 *      writer.WriteEndElement();//Note
                 * }*/
                #endregion Notes Don't Display On Statements
            }
            writer.WriteEndElement();            //DetailItems
            writer.WriteEndElement();            //Patient
            writer.WriteEndElement();            //EisStatement
        }
コード例 #22
0
ファイル: Carestream.cs プロジェクト: royedwards/DRDNet
        ///<summary></summary>
        public static void SendData(Program ProgramCur, Patient pat)
        {
            string path = Programs.GetProgramPath(ProgramCur);

            if (pat == null)
            {
                MsgBox.Show("Carestream", "Please select a patient first.");
                return;
            }
            string infoFile = ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Patient.ini path");

            if (infoFile.Length > 150)
            {
                MsgBox.Show("Carestream", "Patient.ini file folder path too long.  Must be 150 characters or less.");
                return;
            }
            string id = "";

            if (ProgramProperties.GetPropVal(ProgramCur.ProgramNum, "Enter 0 to use PatientNum, or 1 to use ChartNum") == "0")
            {
                id = pat.PatNum.ToString();
            }
            else
            {
                id = pat.ChartNumber;
            }
            try {
                using (StreamWriter sw = new StreamWriter(infoFile, false)) {            //Create file if does not exist.  Overwrite contents if exists.
                    sw.WriteLine("[PATIENT]");
                    sw.WriteLine("ID=" + Tidy(id, 15));
                    sw.WriteLine("FIRSTNAME=" + Tidy(pat.FName, 255));
                    if (!string.IsNullOrEmpty(pat.Preferred))
                    {
                        sw.WriteLine("COMMONNAME=" + Tidy(pat.Preferred, 255));
                    }
                    sw.WriteLine("LASTNAME=" + Tidy(pat.LName, 255));
                    if (!string.IsNullOrEmpty(pat.MiddleI))
                    {
                        sw.WriteLine("MIDDLENAME=" + Tidy(pat.MiddleI, 255));
                    }
                    if (pat.Birthdate.Year > 1880)
                    {
                        sw.WriteLine("DOB=" + pat.Birthdate.ToString("yyyyMMdd"));
                    }
                    if (pat.Gender == PatientGender.Female)
                    {
                        sw.Write("GENDER=F");
                    }
                    else if (pat.Gender == PatientGender.Male)
                    {
                        sw.Write("GENDER=M");
                    }
                }
            }
            catch (Exception ex) {
                MessageBox.Show(Lan.g("Carestream", "Unable to write to file") + ": " + infoFile + "\r\n" + Lan.g("Carestream", "Error") + ": " + ex.Message);
                return;
            }
            try {
                string arguments = @"-I """ + infoFile + @"""";
                Process.Start(path, arguments);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #23
0
        ///<summary>Prints one section other than details at the specified x and y position on the page.  The math to decide whether it will fit on the current page is done ahead of time. There is no mechanism for splitting a section across multiple pages.</summary>
        private void PrintSection(Graphics g, Section section, int xPos, int yPos)
        {
            ReportObject textObject;
            ReportObject fieldObject;
            //LineObject lineObject;
            //BoxObject boxObject;
            StringFormat strFormat;           //used each time text is drawn to handle alignment issues
            //string rawText="";//the raw text for a given field as taken from the database
            string displayText = "";          //The formatted text to print

            foreach (ReportObject reportObject in MyReport.ReportObjects)
            {
                //todo later: check for lines and boxes that span multiple sections.
                if (reportObject.SectionName != section.Name)
                {
                    continue;
                }
                if (reportObject.ObjectKind == ReportObjectKind.TextObject)
                {
                    textObject = reportObject;
                    strFormat  = ReportObject.GetStringFormat(textObject.TextAlign);
                    RectangleF layoutRect = new RectangleF(xPos + textObject.Location.X
                                                           , yPos + textObject.Location.Y
                                                           , textObject.Size.Width, textObject.Size.Height);
                    g.DrawString(textObject.StaticText, textObject.Font, Brushes.Black, layoutRect, strFormat);
                }
                else if (reportObject.ObjectKind == ReportObjectKind.FieldObject)
                {
                    fieldObject = reportObject;
                    strFormat   = ReportObject.GetStringFormat(fieldObject.TextAlign);
                    RectangleF layoutRect = new RectangleF(xPos + fieldObject.Location.X
                                                           , yPos + fieldObject.Location.Y
                                                           , fieldObject.Size.Width, fieldObject.Size.Height);
                    displayText = "";
                    if (fieldObject.FieldKind == FieldDefKind.SummaryField)
                    {
                        displayText = fieldObject.GetSummaryValue
                                          (MyReport.ReportTable, MyReport.DataFields.IndexOf
                                              (fieldObject.SummarizedField))
                                      .ToString(fieldObject.FormatString);
                    }
                    else if (fieldObject.FieldKind == FieldDefKind.SpecialField)
                    {
                        if (fieldObject.SpecialType == SpecialFieldType.PageNofM)                      //not functional yet
                        //displayText=Lan.g(this,"Page")+" "+(pagesPrinted+1).ToString()
                        //	+Lan.g(
                        {
                        }
                        else if (fieldObject.SpecialType == SpecialFieldType.PageNumber)
                        {
                            displayText = Lan.g(this, "Page") + " " + (pagesPrinted + 1).ToString();
                        }
                    }
                    g.DrawString(displayText, fieldObject.Font, Brushes.Black, layoutRect, strFormat);
                }
                //incomplete: else if lines
                //incomplete: else if boxes.
            }            //foreach reportObject
                         //sectionsPrinted=sectionIndex+1;//mark current section as printed.
                         //MessageBox.Show(pagesPrinted.ToString()+","+sectionsPrinted.ToString());
                         //yPos+=section.Height;//set current yPos to the bottom of the section just printed.
        }
コード例 #24
0
        ///<summary>Returns true if the communications were successful, and false if they failed. Both sends and retrieves.</summary>
        public static bool Launch(Clearinghouse clearhouse, int batchNum)
        {
            clearinghouse = clearhouse;
            //Before this function is called, the X12 file for the current batch has already been generated in
            //the clearinghouse export folder. The export folder will also contain batch files which have failed
            //to upload from previous attempts and we must attempt to upload these older batch files again if
            //there are any.
            //Step 1: Retrieve reports regarding the existing pending claim statuses.
            //Step 2: Send new claims in a new batch.
            bool success = true;
            //Connect to the Denti-Cal SFTP server.
            Session     session = null;
            Channel     channel = null;
            ChannelSftp ch      = null;
            JSch        jsch    = new JSch();

            try {
                session = jsch.getSession(clearinghouse.LoginID, remoteHost);
                session.setPassword(clearinghouse.Password);
                Hashtable config = new Hashtable();
                config.Add("StrictHostKeyChecking", "no");
                session.setConfig(config);
                session.connect();
                channel = session.openChannel("sftp");
                channel.connect();
                ch = (ChannelSftp)channel;
            }
            catch (Exception ex) {
                MessageBox.Show(Lan.g("DentiCal", "Connection Failed") + ": " + ex.Message);
                return(false);
            }
            try {
                string homeDir = "/Home/" + clearhouse.LoginID + "/";
                //At this point we are connected to the Denti-Cal SFTP server.
                if (batchNum == 0)                //Retrieve reports.
                {
                    if (!Directory.Exists(clearhouse.ResponsePath))
                    {
                        throw new Exception("Clearinghouse response path is invalid.");
                    }
                    //Only retrieving reports so do not send new claims.
                    string retrievePath = homeDir + "out/";
                    Tamir.SharpSsh.java.util.Vector fileList = ch.ls(retrievePath);
                    for (int i = 0; i < fileList.Count; i++)
                    {
                        string listItem = fileList[i].ToString().Trim();
                        if (listItem[0] == 'd')
                        {
                            continue;                            //Skip directories and focus on files.
                        }
                        Match  fileNameMatch  = Regex.Match(listItem, ".*\\s+(.*)$");
                        string getFileName    = fileNameMatch.Result("$1");
                        string getFilePath    = retrievePath + getFileName;
                        string exportFilePath = CodeBase.ODFileUtils.CombinePaths(clearhouse.ResponsePath, getFileName);
                        Tamir.SharpSsh.java.io.InputStream fileStream = null;
                        FileStream exportFileStream = null;
                        try {
                            fileStream       = ch.get(getFilePath);
                            exportFileStream = File.Open(exportFilePath, FileMode.Create, FileAccess.Write);                        //Creates or overwrites.
                            byte[] dataBytes = new byte[4096];
                            int    numBytes  = fileStream.Read(dataBytes, 0, dataBytes.Length);
                            while (numBytes > 0)
                            {
                                exportFileStream.Write(dataBytes, 0, numBytes);
                                numBytes = fileStream.Read(dataBytes, 0, dataBytes.Length);
                            }
                        }
                        catch {
                            success = false;
                        }
                        finally {
                            if (exportFileStream != null)
                            {
                                exportFileStream.Dispose();
                            }
                            if (fileStream != null)
                            {
                                fileStream.Dispose();
                            }
                        }
                        if (success)
                        {
                            //Removed the processed report from the Denti-Cal SFTP so it does not get processed again in the future.
                            try {
                                ch.rm(getFilePath);
                            }
                            catch {
                            }
                        }
                    }
                }
                else                   //Send batch of claims.
                {
                    if (!Directory.Exists(clearhouse.ExportPath))
                    {
                        throw new Exception("Clearinghouse export path is invalid.");
                    }
                    string[] files = Directory.GetFiles(clearhouse.ExportPath);
                    for (int i = 0; i < files.Length; i++)
                    {
                        //First upload the batch file to a temporary file name. Denti-Cal does not process file names unless they start with the Login ID.
                        //Uploading to a temporary file and then renaming the file allows us to avoid partial file uploads if there is connection loss.
                        string tempRemoteFilePath = homeDir + "in/temp_" + Path.GetFileName(files[i]);
                        ch.put(files[i], tempRemoteFilePath);
                        //Denti-Cal requires the file name to start with the Login ID followed by a period and end with a .txt extension.
                        //The middle part of the file name can be anything.
                        string remoteFilePath = homeDir + "in/" + clearhouse.LoginID + "." + Path.GetFileName(files[i]);
                        ch.rename(tempRemoteFilePath, remoteFilePath);
                        File.Delete(files[i]);                        //Remove the processed file.
                    }
                }
            }
            catch {
                success = false;
            }
            finally {
                //Disconnect from the Denti-Cal SFTP server.
                channel.disconnect();
                ch.disconnect();
                session.disconnect();
            }
            return(success);
        }
コード例 #25
0
ファイル: TigerView.cs プロジェクト: kjb7749/testImport
 ///<summary>
 ///This is the new version of SendData that should be linux compliant.
 ///Advoids the kernal32.WritePrivateProfileString call
 ///</summary>
 public static void SendData(Program ProgramCur,Patient pat)
 {
     string path=Programs.GetProgramPath(ProgramCur);
     List<ProgramProperty> ForProgram =ProgramProperties.GetForProgram(ProgramCur.ProgramNum);
     ProgramProperty PPCur=ProgramProperties.GetCur(ForProgram,"Tiger1.ini path");
     string bDayFormat=ProgramProperties.GetCur(ForProgram,"Birthdate format (default MM/dd/yy)").PropertyValue;
     iniFile=PPCur.PropertyValue;
     System.Collections.Hashtable htKeyVals=new Hashtable();
     if(pat!=null) {
         if(!File.Exists(iniFile)) {
             MessageBox.Show("Could not find "+iniFile);
             return;
         }
         htKeyVals["LastName"]=pat.LName;
         htKeyVals["FirstName"]=pat.FName;
         //Patient Id can be any string format.
         PPCur=ProgramProperties.GetCur(ForProgram,"Enter 0 to use PatientNum, or 1 to use ChartNum");
         if(PPCur.PropertyValue=="0") {
             htKeyVals["PatientID"]=pat.PatNum.ToString();
         }
         else {
             htKeyVals["PatientID"]=pat.ChartNumber;
         }
         htKeyVals["PatientSSN"]=pat.SSN;
         //WriteValue("SubscriberSSN",pat);
         if(pat.Gender==PatientGender.Female) {
             htKeyVals["Gender"]="Female";
         }
         else {
             htKeyVals["Gender"]="Male";
         }
         htKeyVals["DOB"]=pat.Birthdate.ToString(bDayFormat);
         //WriteValue("ClaimID",pat);??huh
         htKeyVals["AddrStreetNo"]=pat.Address;
         //WriteValue("AddrStreetName",pat);??
         //WriteValue("AddrSuiteNo",pat);??
         htKeyVals["AddrCity"]=pat.City;
         htKeyVals["AddrState"]=pat.State;
         htKeyVals["AddrZip"]=pat.Zip;
         htKeyVals["PhHome"]=LimitLength(pat.HmPhone,13);
         htKeyVals["PhWork"]=LimitLength(pat.WkPhone,13);
         if(!WritePrivatePofileString2("Slave",htKeyVals,iniFile)) {
             MessageBox.Show(Lan.g(null,"Unable to start external program: ")+path);
         }
         else {
             try {
                 Process.Start(path,ProgramCur.CommandLine);
             }
             catch {
                 MessageBox.Show(path+" is not available.");
             }
         }
     }//if patient is loaded
     else {
         try {
             Process.Start(path);//should start TigerView without bringing up a pt.
         }
         catch {
             MessageBox.Show(path+" is not available.");
         }
     }
 }
コード例 #26
0
ファイル: Eclaims.cs プロジェクト: steev90/opendental
        ///<summary>Supply a list of ClaimSendQueueItems. Called from FormClaimSend.  Can only send to one clearinghouse at a time.  Able to send just send one claim.  Cannot include Canadian.</summary>
        public static void SendBatch(List <ClaimSendQueueItem> queueItems, Clearinghouse clearhouse, EnumClaimMedType medType)
        {
            string messageText = "";

            if (clearhouse.Eformat == ElectronicClaimFormat.Canadian)
            {
                MsgBox.Show("Eclaims", "Cannot send Canadian claims as part of Eclaims.SendBatch.");
                return;
            }
            //get next batch number for this clearinghouse
            int batchNum = Clearinghouses.GetNextBatchNumber(clearhouse);

            //---------------------------------------------------------------------------------------
            //Create the claim file for this clearinghouse
            if (clearhouse.Eformat == ElectronicClaimFormat.x837D_4010 ||
                clearhouse.Eformat == ElectronicClaimFormat.x837D_5010_dental ||
                clearhouse.Eformat == ElectronicClaimFormat.x837_5010_med_inst)
            {
                messageText = x837Controller.SendBatch(queueItems, batchNum, clearhouse, medType);
            }
            else if (clearhouse.Eformat == ElectronicClaimFormat.Renaissance)
            {
                messageText = Renaissance.SendBatch(queueItems, batchNum);
            }
            else if (clearhouse.Eformat == ElectronicClaimFormat.Dutch)
            {
                messageText = Dutch.SendBatch(queueItems, batchNum);
            }
            else
            {
                messageText = "";      //(ElectronicClaimFormat.None does not get sent)
            }
            if (messageText == "")     //if failed to create claim file properly,
            {
                return;                //don't launch program or change claim status
            }
            //----------------------------------------------------------------------------------------
            //Launch Client Program for this clearinghouse if applicable
            if (clearhouse.CommBridge == EclaimsCommBridge.None)
            {
                AttemptLaunch(clearhouse, batchNum);
            }
            else if (clearhouse.CommBridge == EclaimsCommBridge.WebMD)
            {
                if (!WebMD.Launch(clearhouse, batchNum))
                {
                    MessageBox.Show(Lan.g("Eclaims", "Error sending."));
                    return;
                }
            }
            else if (clearhouse.CommBridge == EclaimsCommBridge.BCBSGA)
            {
                if (!BCBSGA.Launch(clearhouse, batchNum))
                {
                    MessageBox.Show(Lan.g("Eclaims", "Error sending."));
                    return;
                }
            }
            else if (clearhouse.CommBridge == EclaimsCommBridge.Renaissance)
            {
                AttemptLaunch(clearhouse, batchNum);
            }
            else if (clearhouse.CommBridge == EclaimsCommBridge.ClaimConnect)
            {
                if (!ClaimConnect.Launch(clearhouse, batchNum))
                {
                    MessageBox.Show(Lan.g("Eclaims", "Error sending."));
                    return;
                }
            }
            else if (clearhouse.CommBridge == EclaimsCommBridge.RECS)
            {
                if (!RECS.Launch(clearhouse, batchNum))
                {
                    MessageBox.Show("Claim file created, but could not launch RECS client.");
                    //continue;
                }
            }
            else if (clearhouse.CommBridge == EclaimsCommBridge.Inmediata)
            {
                if (!Inmediata.Launch(clearhouse, batchNum))
                {
                    MessageBox.Show("Claim file created, but could not launch Inmediata client.");
                    //continue;
                }
            }
            else if (clearhouse.CommBridge == EclaimsCommBridge.AOS)           // added by SPK 7/13/05
            {
                if (!AOS.Launch(clearhouse, batchNum))
                {
                    MessageBox.Show("Claim file created, but could not launch AOS Communicator.");
                    //continue;
                }
            }
            else if (clearhouse.CommBridge == EclaimsCommBridge.PostnTrack)
            {
                AttemptLaunch(clearhouse, batchNum);
            }
            else if (clearhouse.CommBridge == EclaimsCommBridge.MercuryDE)
            {
                if (!MercuryDE.Launch(clearhouse, batchNum))
                {
                    MsgBox.Show("Eclaims", "Error sending.");
                    return;
                }
            }
            else if (clearhouse.CommBridge == EclaimsCommBridge.ClaimX)
            {
                if (!ClaimX.Launch(clearhouse, batchNum))
                {
                    MessageBox.Show("Claim file created, but encountered an error while launching ClaimX Client.");
                }
            }
            else if (clearhouse.CommBridge == EclaimsCommBridge.EmdeonMedical)
            {
                if (!EmdeonMedical.Launch(clearhouse, batchNum, medType))
                {
                    MessageBox.Show(Lan.g("Eclaims", "Error sending."));
                    return;
                }
            }
            else if (clearhouse.CommBridge == EclaimsCommBridge.DentiCal)
            {
                if (!DentiCal.Launch(clearhouse, batchNum))
                {
                    return;                    //Error message was already shown inside of the DentiCal class.
                }
            }
            else if (clearhouse.CommBridge == EclaimsCommBridge.NHS)
            {
                if (!NHS.Launch(clearhouse, batchNum))
                {
                    MessageBox.Show(Lan.g("Eclaims", "Error sending."));
                    return;
                }
            }
            //----------------------------------------------------------------------------------------
            //finally, mark the claims sent. (only if not Canadian)
            EtransType etype = EtransType.ClaimSent;

            if (clearhouse.Eformat == ElectronicClaimFormat.Renaissance)
            {
                etype = EtransType.Claim_Ren;
            }
            if (clearhouse.Eformat != ElectronicClaimFormat.Canadian)
            {
                for (int j = 0; j < queueItems.Count; j++)
                {
                    Etrans etrans = Etranss.SetClaimSentOrPrinted(queueItems[j].ClaimNum, queueItems[j].PatNum, clearhouse.ClearinghouseNum, etype, batchNum);
                    Etranss.SetMessage(etrans.EtransNum, messageText);
                }
            }
        }