Ejemplo n.º 1
0
        private void gridTasks_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            long taskNum = PIn.Long(gridTasks.ListGridRows[e.Row].Tag.ToString());

            if (IsSelectionMode)
            {
                SelectedTaskNum = taskNum;
                DialogResult    = DialogResult.OK;
                return;
            }
            Task task = Tasks.GetOne(taskNum);

            if (task != null)
            {
                FormTaskEdit FormTE = new FormTaskEdit(task);
                FormTE.Show();
            }
            else
            {
                MsgBox.Show(this, "The task no longer exists.");
            }
        }
Ejemplo n.º 2
0
        private void butImport_Click(object sender, EventArgs e)
        {
            if (gridMain.SelectedIndices.Length != 1)
            {
                MsgBox.Show(this, "Please select one completed form from the list above first.");
                return;
            }
            long     sheetNum = PIn.Long(table.Rows[gridMain.SelectedIndices[0]]["SheetNum"].ToString());
            long     docNum   = PIn.Long(table.Rows[gridMain.SelectedIndices[0]]["DocNum"].ToString());
            Document doc      = null;

            if (docNum != 0)
            {
                doc = Documents.GetByNum(docNum);
                string extens = Path.GetExtension(doc.FileName);
                if (extens.ToLower() != ".pdf")
                {
                    MsgBox.Show(this, "Only pdf's and sheets can be imported into the database.");
                    return;
                }
            }
            Sheet sheet = null;

            if (sheetNum != 0)
            {
                sheet = Sheets.GetSheet(sheetNum);
                if (sheet.SheetType != SheetTypeEnum.PatientForm)
                {
                    MsgBox.Show(this, "For now, only sheets of type 'PatientForm' can be imported.");
                    return;
                }
            }
            FormSheetImport formSI = new FormSheetImport();

            formSI.SheetCur = sheet;
            formSI.DocCur   = doc;
            formSI.ShowDialog();
            //No need to refresh grid because no changes could have been made.
        }
Ejemplo n.º 3
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            //if(IsSelectionMode){
            //	if(table.Rows[e.Row]["appointment"].ToString()!=""){
            //		MsgBox.Show(this,"Already attached to an appointment.");
            //		return;
            //	}
            //	SelectedReqStudentNum=PIn.PInt(table.Rows[e.Row]["ReqStudentNum"].ToString());
            //	DialogResult=DialogResult.OK;
            //}
            //else{
            FormReqStudentEdit FormRSE = new FormReqStudentEdit();

            FormRSE.ReqCur = ReqStudents.GetOne(PIn.Long(table.Rows[e.Row]["ReqStudentNum"].ToString()));
            FormRSE.ShowDialog();
            if (FormRSE.DialogResult != DialogResult.OK)
            {
                return;
            }
            FillGrid();
            //}
        }
Ejemplo n.º 4
0
        private void menuItemGoTo_Click(object sender, EventArgs e)
        {
            if (gridMain.GetSelectedIndex() == -1)
            {
                MsgBox.Show(this, "Please select a lab case first.");
                return;
            }
            if (table.Rows[gridMain.GetSelectedIndex()]["AptNum"].ToString() == "0")
            {
                MsgBox.Show(this, "There are no appointments for unattached lab cases.");
                return;
            }
            Appointment apt = Appointments.GetOneApt(PIn.Long(table.Rows[gridMain.GetSelectedIndex()]["AptNum"].ToString()));

            if (apt.AptStatus == ApptStatus.UnschedList)
            {
                MsgBox.Show(this, "Cannot go to an unscheduled appointment");
                return;
            }
            GoToAptNum = apt.AptNum;
            Close();
        }
Ejemplo n.º 5
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            DataRow         row             = (DataRow)gridMain.Rows[e.Row].Tag;
            long            selectedLabCase = PIn.Long(row["LabCaseNum"].ToString());
            FormLabCaseEdit FormL           = new FormLabCaseEdit();

            FormL.CaseCur = LabCases.GetOne(selectedLabCase);
            FormL.ShowDialog();
            if (FormL.DialogResult != DialogResult.OK)
            {
                return;                //don't refresh unless we have to.  It messes up the user's ordering.
            }
            FillGrid();
            for (int i = 0; i < table.Rows.Count; i++)
            {
                if (table.Rows[i]["LabCaseNum"].ToString() == selectedLabCase.ToString())
                {
                    gridMain.SetSelected(i, true);
                    break;
                }
            }
        }
Ejemplo n.º 6
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (gridMain.GetSelectedIndex() == -1)
     {
         MsgBox.Show(this, "Please select an item first.");
         return;
     }
     for (int i = 0; i < gridMain.SelectedIndices.Length; i++)
     {
         DataRow row  = (DataRow)gridMain.ListGridRows[gridMain.SelectedIndices[i]].Tag;
         string  type = "";
         if (!string.IsNullOrWhiteSpace(row["AdjType"].ToString()))                      //It's an adjustment
         {
             type = "Adj";
         }
         else if (!string.IsNullOrWhiteSpace(row["ChargeType"].ToString()))                      //It's a payplan charge
         {
             type = "Pay Plan";
         }
         else                    //It's a procedure
         {
             type = "Proc";
         }
         long        priKey = PIn.Long(row["PriKey"].ToString());
         List <long> listPriKeys;
         if (DictSelectedItems.TryGetValue(type, out listPriKeys)) //If an entry with Proc or Adj already exists, grab its list
         {
             listPriKeys.Add(priKey);                              //Add the primary key to the list
         }
         else                                                      //No entry with Proc or Adj
         {
             DictSelectedItems.Add(type, new List <long>()
             {
                 priKey
             });                                                                         //Make a new dict entry
         }
     }
     DialogResult = DialogResult.OK;
 }
Ejemplo n.º 7
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            //only visible if IsSelectMode
            if (gridMain.SelectedIndices.Length == 0)
            {
                MessageBox.Show(Lan.g(this, "Please select an item first."));
                return;
            }
            if (gridMain.SelectedIndices.Length > 1)
            {
                MessageBox.Show(Lan.g(this, "Please select only one item first."));
                return;
            }
            InsPlan plan = InsPlans.GetPlan(PIn.Long(table.Rows[gridMain.SelectedIndices[0]]["PlanNum"].ToString()), null);

            if (!InsPlanExists(plan))
            {
                return;
            }
            SelectedPlan = plan;
            DialogResult = DialogResult.OK;
        }
Ejemplo n.º 8
0
        private void butAdd_Click(object sender, System.EventArgs e)
        {
            FormProvEdit FormP = new FormProvEdit();

            FormP.ProvCur = new Provider();
            if (gridMain.SelectedIndices.Length > 0)                                                                                            //place new provider after the first selected index. No changes are made to DB until after provider is actually inserted.
            {
                FormP.ProvCur.ItemOrder = Providers.GetProv(PIn.Long(table.Rows[gridMain.SelectedIndices[0]]["ProvNum"].ToString())).ItemOrder; //now two with this itemorder
            }
            else
            {
                FormP.ProvCur.ItemOrder = Providers.GetNextItemOrder();              //this is clumsy and needs rewrite.
            }
            if (groupDentalSchools.Visible && comboClass.SelectedIndex > 0)
            {
                FormP.ProvCur.SchoolClassNum = SchoolClasses.List[comboClass.SelectedIndex - 1].SchoolClassNum;
            }
            FormP.IsNew = true;
            FormP.ShowDialog();
            if (FormP.DialogResult != DialogResult.OK)
            {
                return;
            }
            //new provider has already been inserted into DB from FormP.
            Providers.MoveDownBelow(FormP.ProvCur);            //safe to run even if none selected.
            changed = true;
            FillGrid();
            gridMain.ScrollToEnd();
            for (int i = 0; i < table.Rows.Count; i++)      //ProviderC.ListLong.Count;i++) {
            {
                if (table.Rows[i]["ProvNum"].ToString() == FormP.ProvCur.ProvNum.ToString())
                {
                    //ProviderC.ListLong[i].ProvNum==FormP.ProvCur.ProvNum) {
                    gridMain.SetSelected(i, true);
                    break;
                }
            }
        }
Ejemplo n.º 9
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            InsPlan plan = InsPlans.GetPlan(PIn.Long(table.Rows[e.Row]["PlanNum"].ToString()), null);

            if (!InsPlanExists(plan))
            {
                return;
            }
            if (IsSelectMode)
            {
                SelectedPlan = plan.Copy();
                DialogResult = DialogResult.OK;
                return;
            }
            FormInsPlan FormIP = new FormInsPlan(plan, null, null);

            FormIP.ShowDialog();
            if (FormIP.DialogResult != DialogResult.OK)
            {
                return;
            }
            FillGrid();
        }
Ejemplo n.º 10
0
        ///<summary>Not possible if no security admin.</summary>
        private void butMove_Click(object sender, EventArgs e)
        {
            if (gridMain.SelectedIndices.Length != 1)
            {
                MsgBox.Show(this, "You must select exactly one provider to move patients from.");
                return;
            }
            if (comboProv.SelectedIndex == -1)
            {
                MsgBox.Show(this, "You must select exactly one provider to move patients to.");
                return;
            }
            Provider provFrom = Providers.GetProv(PIn.Long(table.Rows[gridMain.SelectedIndices[0]]["ProvNum"].ToString()));
            Provider provTo   = ProviderC.ListShort[comboProv.SelectedIndex];
            string   msg      = Lan.g(this, "Move all patients from") + " " + provFrom.GetLongDesc() + " " + Lan.g(this, "to") + " " + provTo.GetLongDesc() + "?";

            if (MessageBox.Show(msg, "", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                Patients.ChangeProviders(provFrom.ProvNum, provTo.ProvNum);
            }
            changed = true;
            FillGrid();
        }
Ejemplo n.º 11
0
        private void butDuplicate_Click(object sender, EventArgs e)
        {
            if (gridMain.GetSelectedIndex() == -1)
            {
                MsgBox.Show(this, "Please select an evaluation to duplicate");
                return;
            }
            //Creates a full copy of the EvaluationDef including all EvaluationCriterionDefs.
            EvaluationDef evalDefOld = EvaluationDefs.GetOne(PIn.Long(gridMain.Rows[gridMain.GetSelectedIndex()].Tag.ToString()));
            EvaluationDef evalDefNew = evalDefOld.Copy();

            evalDefNew.EvalTitle       += "-copy";
            evalDefNew.EvaluationDefNum = EvaluationDefs.Insert(evalDefNew);
            List <EvaluationCriterionDef> listCritDefs = EvaluationCriterionDefs.GetAllForEvaluationDef(evalDefOld.EvaluationDefNum);

            for (int i = 0; i < listCritDefs.Count; i++)
            {
                EvaluationCriterionDef critDefCopy = listCritDefs[i].Copy();
                critDefCopy.EvaluationDefNum = evalDefNew.EvaluationDefNum;
                EvaluationCriterionDefs.Insert(critDefCopy);
            }
            FillGrid();
        }
Ejemplo n.º 12
0
        private void FillFields()
        {
            long clinicNum = 0;

            if (PrefC.HasClinicsEnabled)
            {
                clinicNum = _listUserClinicNums[comboClinic.SelectedIndex];
            }
            textUsername.Text = ProgramProperties.GetPropValFromList(_listProgProps, PaySimple.PropertyDescs.PaySimpleApiUserName, clinicNum);
            textKey.Text      = ProgramProperties.GetPropValFromList(_listProgProps, PaySimple.PropertyDescs.PaySimpleApiKey, clinicNum);
            string payTypeDefNumCC  = ProgramProperties.GetPropValFromList(_listProgProps, PaySimple.PropertyDescs.PaySimplePayTypeCC, clinicNum);
            string payTypeDefNumACH = ProgramProperties.GetPropValFromList(_listProgProps, PaySimple.PropertyDescs.PaySimplePayTypeACH, clinicNum);

            checkPreventSavingNewCC.Checked = PIn.Bool(ProgramProperties.GetPropValFromList(_listProgProps,
                                                                                            PaySimple.PropertyDescs.PaySimplePreventSavingNewCC, clinicNum));
            _listPaymentTypeDefs = Defs.GetDefsForCategory(DefCat.PaymentTypes, true);
            comboPaymentTypeCC.Items.Clear();
            comboPaymentTypeCC.Items.AddDefs(_listPaymentTypeDefs);
            comboPaymentTypeCC.SetSelectedDefNum(PIn.Long(payTypeDefNumCC));
            comboPaymentTypeACH.Items.Clear();
            comboPaymentTypeACH.Items.AddDefs(_listPaymentTypeDefs);
            comboPaymentTypeACH.SetSelectedDefNum(PIn.Long(payTypeDefNumACH));
        }
Ejemplo n.º 13
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textDaysActual.errorProvider1.GetError(textDaysActual) != "" ||
         textDaysPublished.errorProvider1.GetError(textDaysPublished) != "")
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (PIn.Long(textDaysActual.Text) == 0)
     {
         MsgBox.Show(this, "Actual Days cannot be zero.");
         return;
     }
     if (textDescription.Text == "")
     {
         MsgBox.Show(this, "Please enter a description.");
         return;
     }
     LabTurnaroundCur.Description   = textDescription.Text;
     LabTurnaroundCur.DaysPublished = PIn.Int(textDaysPublished.Text);
     LabTurnaroundCur.DaysActual    = PIn.Int(textDaysActual.Text);
     DialogResult = DialogResult.OK;
 }
Ejemplo n.º 14
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (textPaperCopies.errorProvider1.GetError(textPaperCopies) != "")
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (checkEmailPat.Checked && textEmailPat.Text == "")
     {
         MsgBox.Show(this, "Please enter an email address or uncheck the email box.");
         return;
     }
     if (Email2Visible)
     {
         if (checkEmail2.Checked && textEmail2.Text == "")
         {
             MsgBox.Show(this, "Please enter an email address or uncheck the email box.");
             return;
         }
     }
     if (PIn.Long(textPaperCopies.Text) == 0 &&
         !checkEmailPat.Checked &&
         !checkEmail2.Checked)
     {
         MsgBox.Show(this, "There are no output methods selected.");
         return;
     }
     PaperCopies          = PIn.Int(textPaperCopies.Text);
     EmailPatOrLab        = checkEmailPat.Checked;
     EmailPatOrLabAddress = textEmailPat.Text;
     if (Email2Visible)
     {
         Email2        = checkEmail2.Checked;
         Email2Address = textEmail2.Text;
     }
     DialogResult = DialogResult.OK;
 }
Ejemplo n.º 15
0
		private void comboStatus_SelectionChangeCommitted(object sender, System.EventArgs e) {
			if(grid.SelectedIndices.Length==0){
				return;//because user could never initiate this action.
			}
			Appointment apt;
			Cursor=Cursors.WaitCursor;
			long[] selectedApts=new long[grid.SelectedIndices.Length];
			for(int i=0;i<grid.SelectedIndices.Length;i++){
				selectedApts[i]=PIn.Long(Table.Rows[grid.SelectedIndices[i]]["AptNum"].ToString());
			}
			for(int i=0;i<grid.SelectedIndices.Length;i++){
				apt=Appointments.GetOneApt(PIn.Long(Table.Rows[grid.SelectedIndices[i]]["AptNum"].ToString()));
				Appointment aptOld=apt.Clone();
				int selectedI=comboStatus.SelectedIndex;
				apt.Confirmed=DefC.Short[(int)DefCat.ApptConfirmed][selectedI].DefNum;
				try{
					Appointments.Update(apt,aptOld);
				}
				catch(ApplicationException ex){
					Cursor=Cursors.Default;
					MessageBox.Show(ex.Message);
					return;
				}
			}
			FillMain();
			//reselect all the apts
			for(int i=0;i<Table.Rows.Count;i++){
				for(int j=0;j<selectedApts.Length;j++){
					if(PIn.Long(Table.Rows[i]["AptNum"].ToString())==selectedApts[j]){
						grid.SetSelected(i,true);
					}
				}
			}
			SetFamilyColors();
			comboStatus.SelectedIndex=-1;
			Cursor=Cursors.Default;
		}
Ejemplo n.º 16
0
		private void butReport_Click(object sender, System.EventArgs e) {
			if(!Security.IsAuthorized(Permissions.UserQuery)) {
				return;
			}
		  if(Table.Rows.Count==0){
        MessageBox.Show(Lan.g(this,"There are no appointments in the list.  Must have at least one to run report."));    
        return;
      }
			long[] aptNums;
      if(grid.SelectedIndices.Length==0){
				aptNums=new long[Table.Rows.Count];
        for(int i=0;i<aptNums.Length;i++){
          aptNums[i]=PIn.Long(Table.Rows[i]["AptNum"].ToString());
        }
      }
      else{
				aptNums=new long[grid.SelectedIndices.Length];
        for(int i=0;i<aptNums.Length;i++){
          aptNums[i]=PIn.Long(Table.Rows[grid.SelectedIndices[i]]["AptNum"].ToString());
        }
      }
      FormRpConfirm FormC=new FormRpConfirm(aptNums);
      FormC.ShowDialog(); 
		}
Ejemplo n.º 17
0
		private void SetFamilyColors(){
			if(grid.SelectedIndices.Length!=1){
				for(int i=0;i<grid.Rows.Count;i++){
					grid.Rows[i].ColorText=Color.Black;
				}
				grid.Invalidate();
				return;
			}
			long guar=PIn.Long(Table.Rows[grid.SelectedIndices[0]]["Guarantor"].ToString());
			int famCount=0;
			for(int i=0;i<grid.Rows.Count;i++){
				if(PIn.Long(Table.Rows[i]["Guarantor"].ToString())==guar){
					famCount++;
					grid.Rows[i].ColorText=Color.Red;
				}
				else{
					grid.Rows[i].ColorText=Color.Black;
				}
			}
			if(famCount==1){//only the highlighted patient is red at this point
				grid.Rows[grid.SelectedIndices[0]].ColorText=Color.Black;
			}
			grid.Invalidate();
		}
Ejemplo n.º 18
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            DataRow row  = (DataRow)gridMain.ListGridRows[e.Row].Tag;
            string  type = "";

            if (!string.IsNullOrWhiteSpace(row["AdjType"].ToString()))                  //It's an adjustment
            {
                type = "Adj";
            }
            else if (!string.IsNullOrWhiteSpace(row["ChargeType"].ToString()))                  //It's a payplan charge
            {
                type = "Pay Plan";
            }
            else                //It's a procedure
            {
                type = "Proc";
            }
            DictSelectedItems.Clear();
            DictSelectedItems.Add(type, new List <long>()
            {
                PIn.Long(row["PriKey"].ToString())
            });                                                                                             //Add the clicked-on entry
            DialogResult = DialogResult.OK;
        }
Ejemplo n.º 19
0
 ///<summary>Called when we want to refresh form list and data. Also calls FillGrid().
 ///Set hasFilters to true when we want to refresh and apply current filters.</summary>
 private void RefreshAndFillGrid()
 {
     _listAllEtrans = new List <Etrans>();
     if (ValidateFields())
     {
         DataTable table = Etranss.RefreshHistory(_reportDateFrom, _reportDateTo, new List <EtransType>()
         {
             EtransType.ERA_835
         });
         foreach (DataRow row in table.Rows)
         {
             Etrans etrans = new Etrans();
             etrans.EtransNum            = PIn.Long(row["EtransNum"].ToString());
             etrans.ClaimNum             = PIn.Long(row["ClaimNum"].ToString());
             etrans.Note                 = row["Note"].ToString();
             etrans.EtransMessageTextNum = PIn.Long(row["EtransMessageTextNum"].ToString());
             etrans.TranSetId835         = row["TranSetId835"].ToString();
             etrans.UserNum              = Security.CurUser.UserNum;
             etrans.DateTimeTrans        = PIn.DateT(row["dateTimeTrans"].ToString());
             _listAllEtrans.Add(etrans);
         }
     }
     FilterAndFillGrid(true);
 }
Ejemplo n.º 20
0
        ///<summary>Gets all unsent claims in the database between the user entered date range and with the appropriate user selected filters.</summary>
        private void FillGrid()
        {
            if (!ValidateFilters())
            {
                return;
            }
            List <long> listClinicNums = GetSelectedClinicNums();
            DataTable   table          = RpClaimNotSent.GetClaimsNotSent(_startDate, _endDate, listClinicNums, false
                                                                         , (ClaimNotSentStatuses)comboBoxInsFilter.SelectedItem);//this query can get slow with a large number of clinics (like NADG)

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

            if (PrefC.HasClinicsEnabled)
            {
                col = new ODGridColumn(Lan.g(gridMain.TranslationName, "Clinic"), 90);
                gridMain.Columns.Add(col);
            }
            col = new ODGridColumn(Lan.g(gridMain.TranslationName, "Date of Service"), 90, GridSortingStrategy.DateParse);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(gridMain.TranslationName, "Claim Type"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(gridMain.TranslationName, "Claim Status"), 100);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(gridMain.TranslationName, "Patient Name"), 150);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(gridMain.TranslationName, "Carrier Name"), 150);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(gridMain.TranslationName, "Claim Fee"), 90, GridSortingStrategy.AmountParse);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(gridMain.TranslationName, "Proc Codes"), 100);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                row = new ODGridRow();
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(table.Rows[i]["Clinic"].ToString());
                }
                DateTime dateService = PIn.Date(table.Rows[i]["DateService"].ToString());
                row.Cells.Add(dateService.ToShortDateString());
                string type = table.Rows[i]["ClaimType"].ToString();
                switch (type)
                {
                case "P":
                    type = "Pri";
                    break;

                case "S":
                    type = "Sec";
                    break;

                case "PreAuth":
                    type = "Preauth";
                    break;

                case "Other":
                    type = "Other";
                    break;

                case "Cap":
                    type = "Cap";
                    break;

                case "Med":
                    type = "Medical";                          //For possible future use.
                    break;

                default:
                    type = "Error";                          //Not allowed to be blank.
                    break;
                }
                row.Cells.Add(type);
                row.Cells.Add(table.Rows[i]["ClaimStatus"].ToString());
                row.Cells.Add(table.Rows[i]["Patient Name"].ToString());
                row.Cells.Add(table.Rows[i]["CarrierName"].ToString());
                row.Cells.Add(PIn.Double(table.Rows[i]["ClaimFee"].ToString()).ToString("c"));
                row.Cells.Add(table.Rows[i]["ProcCodes"].ToString());
                UnsentInsClaim unsentClaim = new UnsentInsClaim();
                unsentClaim.ClaimNum = PIn.Long(table.Rows[i]["ClaimNum"].ToString());
                unsentClaim.PatNum   = PIn.Long(table.Rows[i]["PatNum"].ToString());
                ClaimTracking claimTrackingCur = _listNewClaimTrackings.FirstOrDefault(x => x.ClaimNum == unsentClaim.ClaimNum);
                if (claimTrackingCur != null)
                {
                    unsentClaim.ClaimTrackingNum = claimTrackingCur.ClaimTrackingNum;
                }
                row.Tag = unsentClaim;
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Ejemplo n.º 21
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" ||
                textDateTo.errorProvider1.GetError(textDateTo) != ""
                )
            {
                MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
                return;
            }
            DateTime FromDate;
            DateTime ToDate;

            if (textDateFrom.Text == "")
            {
                MessageBox.Show(Lan.g(this, "From Date cannot be left blank."));
                return;
            }
            FromDate = PIn.Date(textDateFrom.Text);
            if (textDateTo.Text == "")
            {
                ToDate = DateTime.MaxValue.AddDays(-1);
            }
            else
            {
                ToDate = PIn.Date(textDateTo.Text);
            }
            //Create the file and first row--------------------------------------------------------
            List <ProgramProperty> ForProgram = ProgramProperties.GetForProgram(ProgramCur.ProgramNum);
            ProgramProperty        PPCur      = ProgramProperties.GetCur(ForProgram, "Export Path");
            string fileName = PPCur.PropertyValue + "Appt.txt";

            if (!Directory.Exists(PPCur.PropertyValue))
            {
                Directory.CreateDirectory(PPCur.PropertyValue);
            }
            StreamWriter sr = File.CreateText(fileName);

            sr.WriteLine("\"LastName\",\"FirstName\",\"PatientNumber\",\"HomePhone\",\"WorkNumber\","
                         + "\"EmailAddress\",\"SendEmail\",\"Address\",\"Address2\",\"City\",\"State\",\"Zip\","
                         + "\"ApptDate\",\"ApptTime\",\"ApptReason\",\"DoctorNumber\",\"DoctorName\",\"IsNewPatient\",\"WirelessPhone\"");
            DataTable table     = HouseCallsQueries.GetHouseCalls(FromDate, ToDate);
            bool      usePatNum = false;

            PPCur = ProgramProperties.GetCur(ForProgram, "Enter 0 to use PatientNum, or 1 to use ChartNum");;
            if (PPCur.PropertyValue == "0")
            {
                usePatNum = true;
            }
            DateTime aptDT;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][0].ToString())) + "\",");     //0-LastName
                if (table.Rows[i][2].ToString() != "")                                         //if Preferred Name exists
                {
                    sr.Write("\"" + Dequote(PIn.String(table.Rows[i][2].ToString())) + "\","); //2-PrefName
                }
                else
                {
                    sr.Write("\"" + Dequote(PIn.String(table.Rows[i][1].ToString())) + "\",");                //1-FirstName
                }
                if (usePatNum)
                {
                    sr.Write("\"" + table.Rows[i][3].ToString() + "\",");                //3-PatNum
                }
                else
                {
                    sr.Write("\"" + Dequote(PIn.String(table.Rows[i][4].ToString())) + "\","); //4-ChartNumber
                }
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][5].ToString())) + "\",");     //5-HomePhone
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][6].ToString())) + "\",");     //6-WorkNumber
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][7].ToString())) + "\",");     //7-EmailAddress
                if (table.Rows[i][7].ToString() != "")                                         //if an email exists
                {
                    sr.Write("\"T\",");                                                        //SendEmail
                }
                else
                {
                    sr.Write("\"F\",");
                }
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][8].ToString())) + "\",");  //8-Address
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][9].ToString())) + "\",");  //9-Address2
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][10].ToString())) + "\","); //10-City
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][11].ToString())) + "\","); //11-State
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][12].ToString())) + "\","); //12-Zip
                aptDT = PIn.DateT(table.Rows[i][13].ToString());
                sr.Write("\"" + aptDT.ToString("MM/dd/yyyy") + "\",");                      //13-ApptDate
                sr.Write("\"" + aptDT.ToString("hh:mm tt") + "\",");                        //13-ApptTime eg 01:30 PM
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][14].ToString())) + "\","); //14-ApptReason
                sr.Write("\"" + table.Rows[i][15].ToString() + "\",");                      //15-DoctorNumber. might possibly be 0
                //15-DoctorName. Can handle 0 without any problem.
                sr.Write("\"" + Dequote(Providers.GetLName(PIn.Long(table.Rows[i][15].ToString()))) + "\",");
                if (table.Rows[i][16].ToString() == "1")   //16-IsNewPatient
                {
                    sr.Write("\"T\",");                    //SendEmail
                }
                else
                {
                    sr.Write("\"F\",");
                }
                sr.Write("\"" + Dequote(PIn.String(table.Rows[i][17].ToString())) + "\""); //17-WirelessPhone
                sr.WriteLine();                                                            //Must be last.
            }
            sr.Close();
            MessageBox.Show("Done");
            DialogResult = DialogResult.OK;
        }
Ejemplo n.º 22
0
        private void FillGrid()
        {
            if (textDateTo.errorProvider1.GetError(textDateTo) != "" || textDateFrom.errorProvider1.GetError(textDateFrom) != "")               //Test To and From dates
            {
                MsgBox.Show(this, "Please enter valid To and From dates.");
                return;
            }
            DateFrom = PIn.Date(textDateFrom.Text);
            DateTo   = PIn.Date(textDateTo.Text);
            if (DateTo < DateFrom)
            {
                MsgBox.Show(this, "Date To cannot be before Date From.");
                return;
            }
//todo: checkbox
            RefAttachList = RefAttaches.RefreshForReferralProcTrack(DateFrom, DateTo, checkComplete.Checked);
            Table         = Procedures.GetReferred(DateFrom, DateTo, checkComplete.Checked);
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn(Lan.g(this, "Patient"), 125);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Referred To"), 125);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Description"), 125);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Note"), 125);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Date Referred"), 86);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Date Done"), 86);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Status"), 84);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;
            DateTime  date;

            for (int i = 0; i < Table.Rows.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(Patients.GetPat(PIn.Long(Table.Rows[i]["PatNum"].ToString())).GetNameLF());
                row.Cells.Add(Table.Rows[i]["LName"].ToString() + ", " + Table.Rows[i]["FName"].ToString() + " " + Table.Rows[i]["MName"].ToString());
                row.Cells.Add(ProcedureCodes.GetLaymanTerm(PIn.Long(Table.Rows[i]["CodeNum"].ToString())));
                row.Cells.Add(Table.Rows[i]["Note"].ToString());
                date = PIn.Date(Table.Rows[i]["RefDate"].ToString());
                if (date.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(date.ToShortDateString());
                }
                date = PIn.Date(Table.Rows[i]["DateProcComplete"].ToString());
                if (date.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(date.ToShortDateString());
                }
                ReferralToStatus refStatus = (ReferralToStatus)PIn.Int(Table.Rows[i]["RefToStatus"].ToString());
                if (refStatus == ReferralToStatus.None)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(refStatus.ToString());
                }
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Ejemplo n.º 23
0
        ///<summary>Set all fields of this control. This is an alternative to constructing an entirely new instance.
        ///All uses of this control currently construct as Visible=false so that is the default here.</summary>
        public void ResetData(DataRow rowApt, DataTable tableApptFields, DataTable tablePatFields, Point location, bool visible = false)
        {
            DataRoww        = rowApt;
            TableApptFields = tableApptFields;
            TablePatFields  = tablePatFields;
            Pattern         = PIn.String(DataRoww["Pattern"].ToString());
            PatternShowing  = ApptSingleDrawing.GetPatternShowing(Pattern);
            Location        = location;
            Size            = ApptSingleDrawing.SetSize(Pattern);
            //These controls are always drawn as their Shadow bitmap.
            //They never actually render as a control.
            //Always set Visible to false here so that parent panel/form doesn't account for them when drawings it's controls.
            //In the case where it is a draggable control or on the pinboard, then it will be set to Visible=true.
            Visible = visible;
            //These are used heavily so deserialize here once to save time when accessing.
            AptNum           = PIn.Long(DataRoww["AptNum"].ToString());
            PatNum           = PIn.Long(DataRoww["PatNum"].ToString());
            AptDateTime      = PIn.DateT(DataRoww["AptDateTime"].ToString());
            OpNum            = PIn.Long(DataRoww["Op"].ToString());
            ClinicNum        = PIn.Long(DataRoww["ClinicNum"].ToString());
            ProvNum          = PIn.Long(DataRoww["ProvNum"].ToString());
            ProvHyg          = PIn.Long(DataRoww["ProvHyg"].ToString());
            Confirmed        = PIn.Long(DataRoww["Confirmed"].ToString());
            IsHygiene        = PIn.Bool(DataRoww["IsHygiene"].ToString());
            GrossProduction  = PIn.Decimal(DataRoww["productionVal"].ToString());
            WriteoffPPO      = PIn.Decimal(DataRoww["writeoffPPO"].ToString());
            AdjustmentTotal  = PIn.Decimal(DataRoww["adjustmentTotal"].ToString());
            ImageFolder      = PIn.String(DataRoww["ImageFolder"].ToString());
            PatientName      = PIn.String(DataRoww["patientName"].ToString());
            AptDate          = PIn.String(DataRoww["aptDate"].ToString());
            AptDay           = PIn.String(DataRoww["aptDay"].ToString());
            AptLength        = PIn.String(DataRoww["aptLength"].ToString());
            AptTime          = PIn.String(DataRoww["aptTime"].ToString());
            Email            = PIn.String(DataRoww["Email"].ToString());
            Language         = PIn.String(DataRoww["language"].ToString());
            ReferralTo       = PIn.String(DataRoww["referralTo"].ToString());
            ReferralFrom     = PIn.String(DataRoww["referralFrom"].ToString());
            ApptModNote      = PIn.String(DataRoww["apptModNote"].ToString());
            FamFinUrgNote    = PIn.String(DataRoww["famFinUrgNote"].ToString());
            AddrNote         = PIn.String(DataRoww["addrNote"].ToString());
            Insurance        = PIn.String(DataRoww["insurance"].ToString());
            ContactMethods   = PIn.String(DataRoww["contactMethods"].ToString());
            WirelessPhone    = PIn.String(DataRoww["wirelessPhone"].ToString());
            WkPhone          = PIn.String(DataRoww["wkPhone"].ToString());
            HmPhone          = PIn.String(DataRoww["hmPhone"].ToString());
            Age              = PIn.String(DataRoww["age"].ToString());
            BillingType      = PIn.String(DataRoww["billingType"].ToString());
            ChartNumber      = PIn.String(DataRoww["chartNumber"].ToString());
            Note             = PIn.String(DataRoww["Note"].ToString());
            Procs            = PIn.String(DataRoww["procs"].ToString());
            Lab              = PIn.String(DataRoww["lab"].ToString());
            MedUrgNote       = PIn.String(DataRoww["MedUrgNote"].ToString());
            PreMedFlag       = PIn.String(DataRoww["preMedFlag"].ToString());
            ConfirmedFromDef = PIn.String(DataRoww["confirmed"].ToString());
            Production       = PIn.String(DataRoww["production"].ToString());
            Provider         = PIn.String(DataRoww["provider"].ToString());
            ApptStatus aptStatus;

            if (Enum.TryParse(PIn.String(DataRoww["AptStatus"].ToString()), out aptStatus))
            {
                AptStatus = aptStatus;
            }
            else
            {
                AptStatus = ApptStatus.None;
            }
            ApptPriority priority;

            if (Enum.TryParse(PIn.String(DataRoww["Priority"].ToString()), out priority))
            {
                Priority = priority;
            }
            else
            {
                Priority = ApptPriority.Normal;
            }
        }
Ejemplo n.º 24
0
        private void butImport_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            OpenFileDialog Dlg = new OpenFileDialog();

            if (Directory.Exists(@"C:\X-Charge\"))
            {
                Dlg.InitialDirectory = @"C:\X-Charge\";
            }
            else if (Directory.Exists(@"C:\"))
            {
                Dlg.InitialDirectory = @"C:\";
            }
            if (Dlg.ShowDialog() != DialogResult.OK)
            {
                Cursor = Cursors.Default;
                return;
            }
            if (!File.Exists(Dlg.FileName))
            {
                Cursor = Cursors.Default;
                MsgBox.Show(this, "File not found");
                return;
            }
            XChargeTransaction trans = new XChargeTransaction();

            string[]           fields;
            XChargeTransaction transCheck;

            using (StreamReader sr = new StreamReader(Dlg.FileName)) {
                Cursor = Cursors.WaitCursor;
                string line = sr.ReadLine();
                while (line != null)
                {
                    fields = line.Split(new string[1] {
                        ","
                    }, StringSplitOptions.None);
                    if (fields.Length < 16)
                    {
                        continue;
                    }
                    trans.TransType = fields[0];
                    fields[1]       = fields[1].Replace("$", "");
                    if (fields[1].Contains("("))
                    {
                        fields[1] = fields[1].TrimStart('(');
                        fields[1] = fields[1].TrimEnd(')');
                        fields[1] = fields[1].Insert(0, "-");
                    }
                    trans.Amount              = PIn.Double(fields[1]);
                    trans.CCEntry             = fields[2];
                    trans.PatNum              = PIn.Long(fields[3].Substring(3));     //remove "PAT" from the beginning of the string
                    trans.Result              = fields[4];
                    trans.ClerkID             = fields[5];
                    trans.ResultCode          = fields[7];
                    trans.Expiration          = fields[8];
                    trans.CCType              = fields[9];
                    trans.CreditCardNum       = fields[10];
                    trans.BatchNum            = fields[11];
                    trans.ItemNum             = fields[12];
                    trans.ApprCode            = fields[13];
                    trans.TransactionDateTime = PIn.Date(fields[14]).AddHours(PIn.Double(fields[15].Substring(0, 2))).AddMinutes(PIn.Double(fields[15].Substring(3, 2)));
                    if (trans.BatchNum == "" || trans.ItemNum == "")
                    {
                        line = sr.ReadLine();
                        continue;
                    }
                    transCheck = XChargeTransactions.CheckByBatchItem(trans.BatchNum, trans.ItemNum);
                    if (transCheck == trans)
                    {
                        XChargeTransactions.Delete(transCheck.XChargeTransactionNum);
                        XChargeTransactions.Insert(trans);
                    }
                    else
                    {
                        XChargeTransactions.Insert(trans);
                    }
                    line = sr.ReadLine();
                }
            }
            Cursor = Cursors.Default;
            MsgBox.Show(this, "Done.");
        }
Ejemplo n.º 25
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (gridMain.ListGridRows.Count == 0)
            {
                MsgBox.Show(this, "No rows to fix.");
                return;
            }
            //if(comboFeeSchedNew.SelectedIndex==0) {
            //	MsgBox.Show(this,"No rows to fix.");
            //	return;
            //}
            if (gridMain.SelectedIndices.Length == 0)
            {
                gridMain.SetSelected(true);
            }
            if (!MsgBox.Show(this, true, "Change the fee schedule for all selected plans to the new fee schedule?"))
            {
                return;
            }
            InputBox passBox = new InputBox("To prevent accidental changes, please enter password.  It can be found in our manual.");

            passBox.ShowDialog();            //
            if (passBox.DialogResult != DialogResult.OK)
            {
                return;
            }
            if (passBox.textResult.Text != "fee")
            {
                MsgBox.Show(this, "Incorrect password.");
                return;
            }
            Cursor = Cursors.WaitCursor;
            long   employerNum;
            string carrierName;
            string groupNum;
            string groupName;
            long   newFeeSchedNum = 0;

            if (comboFeeSchedNew.SelectedIndex != 0)
            {
                newFeeSchedNum = FeeSchedsForType[comboFeeSchedNew.SelectedIndex - 1].FeeSchedNum;
            }
            long oldFeeSchedNum;
            long rowsChanged = 0;

            for (int i = 0; i < gridMain.SelectedIndices.Length; i++)
            {
                oldFeeSchedNum = PIn.Long(table.Rows[gridMain.SelectedIndices[i]]["feeSched"].ToString());
                if (oldFeeSchedNum == newFeeSchedNum)
                {
                    continue;
                }
                employerNum  = PIn.Long(table.Rows[gridMain.SelectedIndices[i]]["EmployerNum"].ToString());
                carrierName  = table.Rows[gridMain.SelectedIndices[i]]["CarrierName"].ToString();
                groupNum     = table.Rows[gridMain.SelectedIndices[i]]["GroupNum"].ToString();
                groupName    = table.Rows[gridMain.SelectedIndices[i]]["GroupName"].ToString();
                rowsChanged += InsPlans.SetFeeSched(employerNum, carrierName, groupNum, groupName, newFeeSchedNum,
                                                    (FeeScheduleType)(listType.SelectedIndex));
            }
            FillGrid();
            Cursor = Cursors.Default;
            MessageBox.Show(Lan.g(this, "Plans changed: ") + rowsChanged.ToString());
        }
Ejemplo n.º 26
0
        private void FillGridMain()
        {
            //Get filters from user input
            string firstName = "";

            if (textFName.Text != "")
            {
                firstName = textFName.Text;
            }
            string lastName = "";

            if (textLName.Text != "")
            {
                lastName = textLName.Text;
            }
            int patNum = 0;

            try {
                if (textPatNum.Text != "")
                {
                    patNum = PIn.Int(textPatNum.Text);
                }
            }
            catch {
                MsgBox.Show(this, "Invalid PatNum");
                return;
            }
            long provNum = 0;

            if (comboProv.SelectedIndex != 0)
            {
                provNum = _listProviders[comboProv.SelectedIndex - 1].ProvNum;
            }
            long clinicNum = 0;

            if (PrefC.HasClinicsEnabled && comboClinic.SelectedIndex != 0)
            {
                clinicNum = _listClinics[comboClinic.SelectedIndex - 1].ClinicNum;
            }
            long siteNum = 0;

            if (!PrefC.GetBool(PrefName.EasyHidePublicHealth) && comboSite.SelectedIndex != 0)
            {
                siteNum = _listSites[comboSite.SelectedIndex - 1].SiteNum;
            }
            //Get table
            _table = Patients.GetExportList(patNum, firstName, lastName, provNum, clinicNum, siteNum);
            //Create grid
            //Patient Name | Primary Provider | Date Last Visit | Clinic | Site
            gridMain.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn("PatNum", 60);
            col.SortingStrategy = GridSortingStrategy.AmountParse;
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Patient Name", 200);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Primary Provider", 110);
            gridMain.Columns.Add(col);
            if (!PrefC.GetBool(PrefName.EasyNoClinics))
            {
                col = new ODGridColumn("Clinic", 110);
                gridMain.Columns.Add(col);
            }
            if (!PrefC.GetBool(PrefName.EasyHidePublicHealth))
            {
                col = new ODGridColumn("Site", 110);
                gridMain.Columns.Add(col);
            }
            //Fill grid
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < _table.Rows.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(_table.Rows[i]["PatNum"].ToString());
                row.Cells.Add(_table.Rows[i]["LName"].ToString() + ", " + _table.Rows[i]["FName"].ToString());
                row.Cells.Add(_table.Rows[i]["Provider"].ToString());
                if (PrefC.HasClinicsEnabled)
                {
                    row.Cells.Add(_table.Rows[i]["Clinic"].ToString());
                }
                if (!PrefC.GetBool(PrefName.EasyHidePublicHealth))
                {
                    row.Cells.Add(_table.Rows[i]["Site"].ToString());
                }
                row.Tag = PIn.Long(_table.Rows[i]["PatNum"].ToString());
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Ejemplo n.º 27
0
 private void PatSelected()
 {
     SelectedPatNum = PIn.Long(table.Rows[gridMain.GetSelectedIndex()]["PatNum"].ToString());
     DialogResult   = DialogResult.OK;
 }
Ejemplo n.º 28
0
 private void ContrApptSingle_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     ClickedAptNum = PIn.Long(DataRoww["AptNum"].ToString());
 }
Ejemplo n.º 29
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            if (!TryToSaveData())
            {
                return;
            }
            SheetCur = Sheets.GetSheet(SheetCur.SheetNum);
            //whether this is a new sheet, or one pulled from the database,
            //it will have the extra parameter we are looking for.
            //A new sheet will also have a PatNum parameter which we will ignore.
            FormSheetOutputFormat FormS = new FormSheetOutputFormat();

            if (SheetCur.SheetType == SheetTypeEnum.ReferralSlip ||
                SheetCur.SheetType == SheetTypeEnum.ReferralLetter)
            {
                FormS.PaperCopies = 2;
            }
            else
            {
                FormS.PaperCopies = 1;
            }
            if (SheetCur.PatNum != 0 &&
                SheetCur.SheetType != SheetTypeEnum.DepositSlip)
            {
                Patient pat = Patients.GetPat(SheetCur.PatNum);
                if (SheetCur.SheetType == SheetTypeEnum.LabSlip)
                {
                    FormS.IsForLab = true;                  //Changes label to "E-mail to Lab:"
                }
                else if (pat.Email != "")
                {
                    FormS.EmailPatOrLabAddress = pat.Email;
                    //No need to email to a patient for sheet types: LabelPatient (0), LabelCarrier (1), LabelReferral (2), ReferralSlip (3), LabelAppointment (4), Rx (5), Consent (6), ReferralLetter (8), ExamSheet (13), DepositSlip (14)
                    //The data is too private to email unencrypted for sheet types: PatientForm (9), RoutingSlip (10), MedicalHistory (11), LabSlip (12)
                    //A patient might want email for the following sheet types and the data is not very private: PatientLetter (7)
                    if (SheetCur.SheetType == SheetTypeEnum.PatientLetter)
                    {
                        //This just defines the default selection. The user can manually change selections in FormSheetOutputFormat.
                        FormS.EmailPatOrLab = true;
                        FormS.PaperCopies--;
                    }
                }
            }
            Referral referral = null;

            if (SheetCur.SheetType == SheetTypeEnum.ReferralSlip ||
                SheetCur.SheetType == SheetTypeEnum.ReferralLetter)
            {
                FormS.Email2Visible = true;
                SheetParameter parameter = SheetParameter.GetParamByName(SheetCur.Parameters, "ReferralNum");
                if (parameter == null)              //it can be null sometimes because of old bug in db.
                {
                    FormS.Email2Visible = false;    //prevents trying to attach email to nonexistent referral.
                }
                else
                {
                    long referralNum = PIn.Long(parameter.ParamValue.ToString());
                    referral = Referrals.GetReferral(referralNum);
                    if (referral.EMail != "")
                    {
                        FormS.Email2Address = referral.EMail;
                        FormS.Email2        = true;
                        FormS.PaperCopies--;
                    }
                }
            }
            else
            {
                FormS.Email2Visible = false;
            }
            FormS.ShowDialog();
            if (FormS.DialogResult != DialogResult.OK)
            {
                return;
            }
            if (FormS.PaperCopies > 0)
            {
                SheetPrinting.Print(SheetCur, FormS.PaperCopies, RxIsControlled);
            }
            EmailMessage message;
            Random       rnd        = new Random();
            string       attachPath = EmailMessages.GetEmailAttachPath();
            string       fileName;
            string       filePathAndName;
            EmailAddress emailAddress;
            Patient      patCur = Patients.GetPat(SheetCur.PatNum);

            if (patCur == null)
            {
                emailAddress = EmailAddresses.GetByClinic(0);
            }
            else
            {
                emailAddress = EmailAddresses.GetByClinic(patCur.ClinicNum);
            }
            //Graphics g=this.CreateGraphics();
            if (FormS.EmailPatOrLab)
            {
                fileName        = DateTime.Now.ToString("yyyyMMdd") + "_" + DateTime.Now.TimeOfDay.Ticks.ToString() + rnd.Next(1000).ToString() + ".pdf";
                filePathAndName = ODFileUtils.CombinePaths(attachPath, fileName);
                SheetPrinting.CreatePdf(SheetCur, filePathAndName);
                //Process.Start(filePathAndName);
                message             = new EmailMessage();
                message.PatNum      = SheetCur.PatNum;
                message.ToAddress   = FormS.EmailPatOrLabAddress;
                message.FromAddress = emailAddress.SenderAddress;              //Can be blank just as it could with the old pref.
                message.Subject     = SheetCur.Description.ToString();         //this could be improved
                EmailAttach attach        = new EmailAttach();
                string      shortFileName = Regex.Replace(SheetCur.Description.ToString(), @"[^\w'@-_()&]", "");
                attach.DisplayedFileName = shortFileName + ".pdf";
                attach.ActualFileName    = fileName;
                message.Attachments.Add(attach);
                FormEmailMessageEdit FormE = new FormEmailMessageEdit(message);
                FormE.IsNew = true;
                FormE.ShowDialog();
            }
            if ((SheetCur.SheetType == SheetTypeEnum.ReferralSlip ||
                 SheetCur.SheetType == SheetTypeEnum.ReferralLetter) &&
                FormS.Email2)
            {
                //email referral
                fileName        = DateTime.Now.ToString("yyyyMMdd") + "_" + DateTime.Now.TimeOfDay.Ticks.ToString() + rnd.Next(1000).ToString() + ".pdf";
                filePathAndName = ODFileUtils.CombinePaths(attachPath, fileName);
                SheetPrinting.CreatePdf(SheetCur, filePathAndName);
                //Process.Start(filePathAndName);
                message             = new EmailMessage();
                message.PatNum      = SheetCur.PatNum;
                message.ToAddress   = FormS.Email2Address;
                message.FromAddress = emailAddress.SenderAddress;                                         //Can be blank just as it could with the old pref.
                message.Subject     = Lan.g(this, "RE: ") + Patients.GetLim(SheetCur.PatNum).GetNameLF(); //works even if patnum invalid
                //SheetCur.Description.ToString()+" to "+Referrals.GetNameFL(referral.ReferralNum);//this could be improved
                EmailAttach attach        = new EmailAttach();
                string      shortFileName = Regex.Replace(SheetCur.Description.ToString(), @"[^\w,'@-_()&]", "");
                attach.DisplayedFileName = shortFileName + ".pdf";
                attach.ActualFileName    = fileName;
                message.Attachments.Add(attach);
                FormEmailMessageEdit FormE = new FormEmailMessageEdit(message);
                FormE.IsNew = true;
                FormE.ShowDialog();
            }
            //g.Dispose();
            DialogResult = DialogResult.OK;
        }
Ejemplo n.º 30
0
		private void butText_Click(object sender,EventArgs e) {
			long patNum;
			string wirelessPhone;
			YN txtMsgOk;
			if(grid.Rows.Count==0) {
				MsgBox.Show(this,"There are no Patients in the table.  Must have at least one.");
				return;
			}
			if(PrefC.GetLong(PrefName.ConfirmStatusTextMessaged)==0) {
				MsgBox.Show(this,"You need to set a status first for confirmation text messages in the Recall Setup window.");
				return;
			}
			if(grid.SelectedIndices.Length==0) {//None selected. Select all of type text that are not yet confirmed by text message.
				ContactMethod cmeth;
				for(int i=0;i<Table.Rows.Count;i++) {
					cmeth=(ContactMethod)PIn.Int(Table.Rows[i]["PreferConfirmMethod"].ToString());
					if(cmeth!=ContactMethod.TextMessage) {
						continue;
					}
					if(Table.Rows[i]["confirmed"].ToString()==DefC.GetName(DefCat.ApptConfirmed,PrefC.GetLong(PrefName.ConfirmStatusTextMessaged))) {//Already confirmed by text
						continue;
					}
					if(!Table.Rows[i]["contactMethod"].ToString().StartsWith("Text:")) {//Check contact method
						continue;
					}
					grid.SetSelected(i,true);
				}
				if(grid.SelectedIndices.Length==0) {
					MsgBox.Show(this,"All patients of text message type have been sent confirmations.");
					return;
				}
			}
			//deselect the ones that do not have text messages specified or are not OK to send texts to or have already been texted
			int skipped=0;
			for(int i=grid.SelectedIndices.Length-1;i>=0;i--) {
				wirelessPhone=Table.Rows[grid.SelectedIndices[i]]["WirelessPhone"].ToString();
				if(wirelessPhone=="") {//Check for wireless number
					skipped++;
					grid.SetSelected(grid.SelectedIndices[i],false);
					continue;
				}
				txtMsgOk=(YN)PIn.Int(Table.Rows[grid.SelectedIndices[i]]["TxtMsgOk"].ToString());
				if(txtMsgOk==YN.Unknown	&& PrefC.GetBool(PrefName.TextMsgOkStatusTreatAsNo)) {//Check if OK to text
					skipped++;
					grid.SetSelected(grid.SelectedIndices[i],false);
					continue;
				}
				if(txtMsgOk==YN.No){//Check if OK to text
					skipped++;
					grid.SetSelected(grid.SelectedIndices[i],false);
					continue;
				}
			}
			if(grid.SelectedIndices.Length==0) {
				MsgBox.Show(this,"None of the selected patients have wireless phone numbers and are OK to text.");
				return;
			}
			if(skipped>0) {
				MessageBox.Show(Lan.g(this,"Selected patients skipped: ")+skipped.ToString());
			}
			if(!MsgBox.Show(this,MsgBoxButtons.YesNo,"Send text message to all of the selected patients?")) {
				return;
			}
			Cursor=Cursors.WaitCursor;
			FormTxtMsgEdit FormTME=new FormTxtMsgEdit();
			string message="";
			//Appointment apt;
			for(int i=0;i<grid.SelectedIndices.Length;i++){
				patNum=PIn.Long(Table.Rows[grid.SelectedIndices[i]]["PatNum"].ToString());
				wirelessPhone=PIn.String(Table.Rows[grid.SelectedIndices[i]]["WirelessPhone"].ToString());
				txtMsgOk=((YN)PIn.Int(Table.Rows[grid.SelectedIndices[i]]["TxtMsgOk"].ToString()));
				message=PrefC.GetString(PrefName.ConfirmTextMessage);
				message=message.Replace("[NameF]",Table.Rows[grid.SelectedIndices[i]]["nameF"].ToString());
				message=message.Replace("[NameFL]",Table.Rows[grid.SelectedIndices[i]]["nameFL"].ToString());
				message=message.Replace("[date]",((DateTime)Table.Rows[grid.SelectedIndices[i]]["AptDateTime"]).ToShortDateString());
				message=message.Replace("[time]",((DateTime)Table.Rows[grid.SelectedIndices[i]]["AptDateTime"]).ToShortTimeString());
				FormTME.SendText(patNum,wirelessPhone,message,txtMsgOk);
				Appointments.SetConfirmed(PIn.Long(Table.Rows[grid.SelectedIndices[i]]["AptNum"].ToString()),PrefC.GetLong(PrefName.ConfirmStatusTextMessaged));
			}
			FillMain();
			Cursor=Cursors.Default;
		}