Exemplo n.º 1
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            long  sheetNum = (long)gridMain.Rows[e.Row].Tag;
            Sheet sheet    = Sheets.GetSheet(sheetNum);

            FormSheetFillEdit.ShowForm(sheet, delegate { FillGrid(); });            //We must refresh the grid because the web form clicked might have been deleted by the user.
        }
Exemplo n.º 2
0
        private void butSlip_Click(object sender, EventArgs e)
        {
            int idx = gridMain.GetSelectedIndex();

            if (idx == -1)
            {
                MsgBox.Show(this, "Please select a referral first");
                return;
            }
            Referral referral = ReferralL.GetReferral(((RefAttach)gridMain.ListGridRows[idx].Tag).ReferralNum);

            if (referral == null)
            {
                return;
            }
            SheetDef sheetDef;

            if (referral.Slip == 0)
            {
                sheetDef = SheetsInternal.GetSheetDef(SheetInternalType.ReferralSlip);
            }
            else
            {
                sheetDef = SheetDefs.GetSheetDef(referral.Slip);
            }
            Sheet sheet = SheetUtil.CreateSheet(sheetDef, PatNum);

            SheetParameter.SetParameter(sheet, "PatNum", PatNum);
            SheetParameter.SetParameter(sheet, "ReferralNum", referral.ReferralNum);
            SheetFiller.FillFields(sheet);
            SheetUtil.CalculateHeights(sheet);
            FormSheetFillEdit.ShowForm(sheet);
        }
Exemplo n.º 3
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            FormSheetPicker FormS = new FormSheetPicker();

            FormS.SheetType = SheetTypeEnum.ExamSheet;
            FormS.ShowDialog();
            if (FormS.DialogResult != DialogResult.OK)
            {
                return;
            }
            SheetDef sheetDef;
            Sheet    sheet = null;       //only useful if not Terminal

            for (int i = 0; i < FormS.SelectedSheetDefs.Count; i++)
            {
                sheetDef = FormS.SelectedSheetDefs[i];
                sheet    = SheetUtil.CreateSheet(sheetDef, PatNum);
                SheetParameter.SetParameter(sheet, "PatNum", PatNum);
                SheetFiller.FillFields(sheet);
                SheetUtil.CalculateHeights(sheet, this.CreateGraphics());
            }
            FormSheetFillEdit FormSF = new FormSheetFillEdit(sheet);

            FormSF.ShowDialog();
            if (FormSF.DialogResult == DialogResult.OK)
            {
                FillGrid();
                gridMain.SetSelected(false);                         //unselect all rows
                gridMain.SetSelected(gridMain.Rows.Count - 1, true); //Select the newly added row. Always last, since ordered by date.
            }
        }
Exemplo n.º 4
0
 ///<summary>Used in both modes.  Loads the list of sheets into the listbox.  Then launches the first sheet and goes through the sequence of sheets.  If user clicks cancel, the seqeunce will exit.  If not IsSimpleMode, then the TerminalManager can also send a signal to immediately terminate the sequence.</summary>
 private void LoadPatient()
 {
     SheetList = Sheets.GetForTerminal(PatNum);
     listForms.Items.Clear();
     if (SheetList.Count == 0)
     {
         return;
     }
     for (int i = 0; i < SheetList.Count; i++)
     {
         listForms.Items.Add(SheetList[i].Description);
     }
     for (int i = 0; i < SheetList.Count; i++)
     {
         //we want the very freshest copy of the sheet, so we go straight to the database for it
         Sheet sheet = Sheets.GetSheet(SheetList[i].SheetNum);
         formSheetFillEdit = new FormSheetFillEdit(sheet);
         formSheetFillEdit.IsInTerminal = true;
         if (!IsSimpleMode)
         {
             formSheetFillEdit.TerminalListenShut = true;
         }
         formSheetFillEdit.ShowDialog();
         if (formSheetFillEdit.DialogResult != DialogResult.OK) //either patient clicked cancel, or in not IsSimpleMode a close signal was received.
         {
             return;                                            //breaks out of looping through sheets.
         }
     }
 }
Exemplo n.º 5
0
 private void butAdd_Click(object sender,EventArgs e)
 {
     FormSheetPicker FormS=new FormSheetPicker();
     FormS.SheetType=SheetTypeEnum.PatientForm;
     FormS.ShowDialog();
     if(FormS.DialogResult!=DialogResult.OK) {
         return;
     }
     SheetDef sheetDef;
     Sheet sheet=null;//only useful if not Terminal
     for(int i=0;i<FormS.SelectedSheetDefs.Count;i++) {
         sheetDef=FormS.SelectedSheetDefs[i];
         sheet=SheetUtil.CreateSheet(sheetDef,PatNum);
         SheetParameter.SetParameter(sheet,"PatNum",PatNum);
         SheetFiller.FillFields(sheet);
         SheetUtil.CalculateHeights(sheet,this.CreateGraphics());
         if(FormS.TerminalSend) {
             sheet.InternalNote="";//because null not ok
             sheet.ShowInTerminal=(byte)(Sheets.GetBiggestShowInTerminal(PatNum)+1);
             Sheets.SaveNewSheet(sheet);//save each sheet.
         }
     }
     if(FormS.TerminalSend) {
         //do not show a dialog now.
         //User will need to click the terminal button.
         FillGrid();
     }
     else{
         FormSheetFillEdit FormSF=new FormSheetFillEdit(sheet);
         FormSF.ShowDialog();
         if(FormSF.DialogResult==DialogResult.OK) {
             FillGrid();
         }
     }
 }
Exemplo n.º 6
0
        private void butSlip_Click(object sender, EventArgs e)
        {
            int idx = gridMain.GetSelectedIndex();

            if (idx == -1)
            {
                MsgBox.Show(this, "Please select a referral first");
                return;
            }
            Referral referral = Referrals.GetReferral(RefAttachList[idx].ReferralNum);
            SheetDef sheetDef;

            if (referral.Slip == 0)
            {
                sheetDef = SheetsInternal.GetSheetDef(SheetInternalType.ReferralSlip);
            }
            else
            {
                sheetDef = SheetDefs.GetSheetDef(referral.Slip);
            }
            Sheet sheet = SheetUtil.CreateSheet(sheetDef, PatNum);

            SheetParameter.SetParameter(sheet, "PatNum", PatNum);
            SheetParameter.SetParameter(sheet, "ReferralNum", referral.ReferralNum);
            SheetFiller.FillFields(sheet);
            SheetUtil.CalculateHeights(sheet, this.CreateGraphics());
            FormSheetFillEdit FormS = new FormSheetFillEdit(sheet);

            FormS.ShowDialog();
            //grid will not be refilled, so no need to reselect.
        }
Exemplo n.º 7
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            //Sheets
            long  sheetNum = sheetList[e.Row].SheetNum;       // PIn.Long(table.Rows[e.Row]["SheetNum"].ToString());
            Sheet sheet    = Sheets.GetSheet(sheetNum);       //must use this to get fields

            FormSheetFillEdit.ShowForm(sheet, FormSheetFillEdit_Grid_FormClosing);
        }
Exemplo n.º 8
0
 private void butView_Click(object sender, EventArgs e)
 {
     //only visible if there is already a sheet.
     if (!SaveRx())
     {
         return;
     }
     SheetFields.GetFieldsAndParameters(sheet);
     FormSheetFillEdit.ShowForm(sheet, FormSheetFillEdit_FormClosing);
 }
Exemplo n.º 9
0
        private void listSheets_DoubleClick(object sender, EventArgs e)
        {
            if (listSheets.SelectedIndex == -1)
            {
                return;
            }
            Sheet sheet = SheetList[listSheets.SelectedIndex];

            SheetFields.GetFieldsAndParameters(sheet);
            FormSheetFillEdit.ShowForm(sheet, delegate { FillSheets(); });
        }
Exemplo n.º 10
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            FormSheetPicker FormS = new FormSheetPicker();

            FormS.SheetType = SheetTypeEnum.PatientForm;
            FormS.ShowDialog();
            if (FormS.DialogResult != DialogResult.OK)
            {
                return;
            }
            SheetDef sheetDef;
            Sheet    sheet = null;       //only useful if not Terminal
            bool     isPatUsingEClipboard = MobileAppDevices.PatientIsAlreadyUsingDevice(PatNum);

            for (int i = 0; i < FormS.SelectedSheetDefs.Count; i++)
            {
                sheetDef = FormS.SelectedSheetDefs[i];
                if (FormS.TerminalSend && isPatUsingEClipboard && !sheetDef.HasMobileLayout)
                {
                    if (!MsgBox.Show(MsgBoxButtons.YesNo, $"The patient is currently using an eClipboard to fill out forms, but the " +
                                     $"{sheetDef.Description} sheet does not have a mobile layout and cannot be used with eClipboard. " +
                                     $"If you add this form to the patient's list it will not be shown in eClipboard. Do you still want to add this form?"))
                    {
                        continue;
                    }
                }
                sheet = SheetUtil.CreateSheet(sheetDef, PatNum);
                SheetParameter.SetParameter(sheet, "PatNum", PatNum);
                SheetFiller.FillFields(sheet);
                SheetUtil.CalculateHeights(sheet);
                if (FormS.TerminalSend)
                {
                    sheet.InternalNote   = "";                //because null not ok
                    sheet.ShowInTerminal = (byte)(Sheets.GetBiggestShowInTerminal(PatNum) + 1);
                    Sheets.SaveNewSheet(sheet);               //save each sheet.
                    //Push new sheet to eClipboard.
                    if (isPatUsingEClipboard && sheetDef.HasMobileLayout)
                    {
                        OpenDentBusiness.WebTypes.PushNotificationUtils.CI_AddSheet(sheet.PatNum, sheet.SheetNum);
                    }
                }
            }
            if (FormS.TerminalSend)
            {
                //do not show a dialog now.  User will need to click the terminal button.
                FillGrid();
                Signalods.SetInvalid(InvalidType.Kiosk);
            }
            else if (sheet != null)
            {
                FormSheetFillEdit.ShowForm(sheet, FormSheetFillEdit_FormClosing);
            }
        }
Exemplo n.º 11
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            //Sheets
            long              sheetNum = sheetList[e.Row].SheetNum; // PIn.Long(table.Rows[e.Row]["SheetNum"].ToString());
            Sheet             sheet    = Sheets.GetSheet(sheetNum); //must use this to get fields
            FormSheetFillEdit FormSF   = new FormSheetFillEdit(sheet);

            FormSF.ShowDialog();
            if (FormSF.DialogResult == DialogResult.OK)
            {
                FillGrid();
            }
        }
Exemplo n.º 12
0
        private void butPrint_Click(object sender, System.EventArgs e)
        {
            if (textDate.errorProvider1.GetError(textDate) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            if (IsNew)
            {
                if (!SaveToDB())
                {
                    return;
                }
            }
            else             //not new
                             //Only allowed to change date and bank account info, NOT attached checks.
                             //We enforce security here based on date displayed, not date entered.
                             //If user is trying to change date without permission:
            {
                DateTime date = PIn.Date(textDate.Text);
                if (Security.IsAuthorized(Permissions.DepositSlips, date, true))
                {
                    if (!SaveToDB())
                    {
                        return;
                    }
                }
                //if security.NotAuthorized, then it simply skips the save process before printing
            }
            SheetDef        sheetDef         = null;
            List <SheetDef> depositSheetDefs = SheetDefs.GetCustomForType(SheetTypeEnum.DepositSlip);

            if (depositSheetDefs.Count > 0)
            {
                sheetDef = depositSheetDefs[0];
                SheetDefs.GetFieldsAndParameters(sheetDef);
            }
            else
            {
                sheetDef = SheetsInternal.DepositSlip();
            }
            Sheet sheet = SheetUtil.CreateSheet(sheetDef, 0);

            SheetParameter.SetParameter(sheet, "DepositNum", DepositCur.DepositNum);
            SheetFiller.FillFields(sheet);
            SheetUtil.CalculateHeights(sheet, this.CreateGraphics());
            FormSheetFillEdit FormSF = new FormSheetFillEdit(sheet);

            FormSF.ShowDialog();
            DialogResult = DialogResult.OK;          //this is imporant, since we don't want to insert the deposit slip twice.
        }
Exemplo n.º 13
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            if (table.Rows[e.Row]["DocNum"].ToString() != "0")
            {
                long docNum = PIn.Long(table.Rows[e.Row]["DocNum"].ToString());
                GotoModule.GotoImage(PatNum, docNum);
                return;
            }
            //Sheets
            long  sheetNum = PIn.Long(table.Rows[e.Row]["SheetNum"].ToString());
            Sheet sheet    = Sheets.GetSheet(sheetNum);

            FormSheetFillEdit.ShowForm(sheet, FormSheetFillEdit_FormClosing);
        }
Exemplo n.º 14
0
        private void listForms_DoubleClick(object sender, EventArgs e)
        {
            //this might be used after the patient has completed all the forms and wishes to review or alter one of them
            if (listForms.SelectedIndex == -1)
            {
                return;
            }
            Sheet sheet = Sheets.GetSheet(_listSheets[listForms.SelectedIndex].SheetNum);

            _formSheetFillEdit = new FormSheetFillEdit(sheet);
            _formSheetFillEdit.IsInTerminal = true;
            _formSheetFillEdit.ShowDialog();
            LoadPatient(true);            //this will verify that this patient is still loaded in this kiosk and refresh the list of forms for the patient
        }
Exemplo n.º 15
0
        /*private void buttonEmail_Click(object sender,EventArgs e) {
         *      int CurPatNum=CaseCur.PatNum;
         *      EmailMessage message=new EmailMessage();
         *      message.PatNum=CurPatNum;
         *      Patient pat=Patients.GetPat(CurPatNum);
         *      message.ToAddress="";//pat.Email;
         *      message.FromAddress=PrefC.GetString(PrefName.EmailSenderAddress");
         *      message.Subject=Lan.g(this,"RE: ")+pat.GetNameFL();
         *      FormEmailMessageEdit FormE=new FormEmailMessageEdit(message);
         *      FormE.IsNew=true;
         *      FormE.ShowDialog();
         *
         * }*/

        private void butSlip_Click(object sender, EventArgs e)
        {
            if (sheet == null)           //create new
            {
                if (!SaveToDb())
                {
                    return;
                }
                Laboratory lab = ListLabs[listLab.SelectedIndex];
                SheetDef   sheetDef;
                if (lab.Slip == 0)
                {
                    sheetDef = SheetsInternal.GetSheetDef(SheetInternalType.LabSlip);
                }
                else
                {
                    sheetDef = SheetDefs.GetSheetDef(lab.Slip);
                }
                sheet = SheetUtil.CreateSheet(sheetDef, CaseCur.PatNum);
                SheetParameter.SetParameter(sheet, "PatNum", CaseCur.PatNum);
                SheetParameter.SetParameter(sheet, "LabCaseNum", CaseCur.LabCaseNum);
                SheetFiller.FillFields(sheet);
                SheetUtil.CalculateHeights(sheet, this.CreateGraphics());
                FormSheetFillEdit FormS = new FormSheetFillEdit(sheet);
                FormS.ShowDialog();
                //if(FormS.DialogResult!=DialogResult.OK) {
                //	sheet=null;
                //	return;
                //}
            }
            else              //edit existing
            {
                SheetFields.GetFieldsAndParameters(sheet);
                FormSheetFillEdit FormS = new FormSheetFillEdit(sheet);
                FormS.ShowDialog();
                //if(FormS.DialogResult!=DialogResult.OK) {
                //	return;
                //}
            }
            //refresh
            sheet = Sheets.GetLabSlip(CaseCur.PatNum, CaseCur.LabCaseNum);
            if (sheet == null)
            {
                butSlip.Text = Lan.g(this, "New Slip");
            }
            else
            {
                butSlip.Text = Lan.g(this, "Edit Slip");
            }
        }
Exemplo n.º 16
0
        private void listForms_DoubleClick(object sender, EventArgs e)
        {
            //this might be used after the patient has completed all the forms and wishes to review or alter one of them
            if (listForms.SelectedIndex == -1)
            {
                return;
            }
            Sheet sheet = Sheets.GetSheet(SheetList[listForms.SelectedIndex].SheetNum);

            formSheetFillEdit = new FormSheetFillEdit(sheet);
            formSheetFillEdit.IsInTerminal = true;
            formSheetFillEdit.ShowDialog();
            //no point in refreshing the list because patient cannot edit description or delete sheet.
        }
Exemplo n.º 17
0
        private void butView_Click(object sender, EventArgs e)
        {
            Sheet sheet;

            if (_isWebForm)
            {
                sheet = SheetUtil.CreateSheetFromWebSheet(0, _webFormsSheet);
            }
            else
            {
                sheet = _sheetCemt;
            }
            FormSheetFillEdit.ShowForm(sheet, isReadOnly: true);
        }
Exemplo n.º 18
0
		private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			if(table.Rows[e.Row]["DocNum"].ToString()!="0") {
				long docNum=PIn.Long(table.Rows[e.Row]["DocNum"].ToString());
				GotoModule.GotoImage(PatNum,docNum); 
				return;
			}
			//Sheets
			long sheetNum=PIn.Long(table.Rows[e.Row]["SheetNum"].ToString());
			Sheet sheet=Sheets.GetSheet(sheetNum);
			FormSheetFillEdit FormSF=new FormSheetFillEdit(sheet);
			FormSF.ShowDialog();
			if(FormSF.DialogResult==DialogResult.OK) {
				FillGrid();
			}
		}
Exemplo n.º 19
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            //Images
            //Hold onto docNum so Image module refresh persists selection when closing FormPatientForms.
            DocNum = PIn.Long(table.Rows[e.Row]["DocNum"].ToString());          //Set to 0 if not a Document, i.e. a Sheet.
            if (DocNum != 0)
            {
                GotoModule.GotoImage(PatNum, DocNum);
                return;
            }
            //Sheets
            long  sheetNum = PIn.Long(table.Rows[e.Row]["SheetNum"].ToString());
            Sheet sheet    = Sheets.GetSheet(sheetNum);

            FormSheetFillEdit.ShowForm(sheet, FormSheetFillEdit_FormClosing);
        }
Exemplo n.º 20
0
        private void butView_Click(object sender, EventArgs e)
        {
            //only visible if there is already a sheet.
            if (!SaveRx())
            {
                return;
            }
            SheetFields.GetFieldsAndParameters(sheet);
            FormSheetFillEdit FormSF = new FormSheetFillEdit(sheet);

            FormSF.ShowDialog();
            if (FormSF.DialogResult == DialogResult.OK)
            {
                DialogResult = DialogResult.OK;
            }
            //if user clicked cancel, then we can just stay in this form.
        }
Exemplo n.º 21
0
        private void butCopy_Click(object sender, EventArgs e)
        {
            if (gridMain.SelectedIndices.Length != 1)
            {
                MsgBox.Show(this, "Please select one completed sheet from the list above first.");
                return;
            }
            long sheetNum = PIn.Long(table.Rows[gridMain.SelectedIndices[0]]["SheetNum"].ToString());

            if (sheetNum == 0)
            {
                MsgBox.Show(this, "Must select a sheet.");
                return;
            }
            Sheet sheet  = Sheets.GetSheet(sheetNum);
            Sheet sheet2 = sheet.Copy();

            sheet2.DateTimeSheet = DateTime.Now;
            sheet2.SheetFields   = new List <SheetField>(sheet.SheetFields);
            for (int i = 0; i < sheet2.SheetFields.Count; i++)
            {
                sheet2.SheetFields[i].IsNew = true;
                if (sheet2.SheetFields[i].FieldType == SheetFieldType.SigBox)
                {
                    sheet2.SheetFields[i].FieldValue = "";                  //clear signatures
                }
                //no need to set SheetNums here.  That's done from inside FormSheetFillEdit
            }
            sheet2.IsNew = true;
            FormSheetFillEdit FormSF = new FormSheetFillEdit(sheet2);

            FormSF.ShowDialog();
            if (FormSF.DialogResult == DialogResult.OK)
            {
                FillGrid();
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    if (table.Rows[i]["SheetNum"].ToString() == sheet2.SheetNum.ToString())
                    {
                        gridMain.SetSelected(i, true);
                    }
                }
                SecurityLogs.MakeLogEntry(Permissions.Copy, PatNum, "Patient form " + sheet.Description + " from " + sheet.DateTimeSheet.ToString() + " copied");
            }
        }
Exemplo n.º 22
0
        /*private void buttonEmail_Click(object sender,EventArgs e) {
         *      int CurPatNum=CaseCur.PatNum;
         *      EmailMessage message=new EmailMessage();
         *      message.PatNum=CurPatNum;
         *      Patient pat=Patients.GetPat(CurPatNum);
         *      message.ToAddress="";//pat.Email;
         *      message.FromAddress=PrefC.GetString(PrefName.EmailSenderAddress");
         *      message.Subject=Lan.g(this,"RE: ")+pat.GetNameFL();
         *      FormEmailMessageEdit FormE=new FormEmailMessageEdit(message);
         *      FormE.IsNew=true;
         *      FormE.ShowDialog();
         *
         * }*/

        private void butSlip_Click(object sender, EventArgs e)
        {
            if (sheet == null)           //create new
            {
                if (!SaveToDb())
                {
                    return;
                }
                Laboratory lab = ListLabs[listLab.SelectedIndex];
                SheetDef   sheetDef;
                if (lab.Slip == 0)
                {
                    sheetDef = SheetsInternal.GetSheetDef(SheetInternalType.LabSlip);
                }
                else
                {
                    sheetDef = SheetDefs.GetSheetDef(lab.Slip);
                }
                sheet = SheetUtil.CreateSheet(sheetDef, CaseCur.PatNum);
                SheetParameter.SetParameter(sheet, "PatNum", CaseCur.PatNum);
                SheetParameter.SetParameter(sheet, "LabCaseNum", CaseCur.LabCaseNum);
                SheetFiller.FillFields(sheet);
                SheetUtil.CalculateHeights(sheet, this.CreateGraphics());
                FormSheetFillEdit FormS = new FormSheetFillEdit(sheet);
                FormS.ShowDialog();
            }
            else              //edit existing
            {
                SheetFields.GetFieldsAndParameters(sheet);
                FormSheetFillEdit FormS = new FormSheetFillEdit(sheet);
                FormS.ShowDialog();
            }
            //refresh
            sheet = Sheets.GetLabSlip(CaseCur.PatNum, CaseCur.LabCaseNum);
            if (sheet == null)
            {
                butSlip.Text = Lan.g(this, "New Slip");
            }
            else
            {
                butSlip.Text      = Lan.g(this, "Edit Slip");
                butCancel.Enabled = false;              //user can still click X to close window, but we do handle that as well.
            }
        }
Exemplo n.º 23
0
        private void butLettersPreview_Click(object sender, EventArgs e)
        {
            //Create letters. loop through each row and insert information into sheets,
            //take all the sheets and add to one giant pdf for preview.
            if (gridMain.SelectedIndices.Length == 0)
            {
                MsgBox.Show(this, "Please select patient(s) first.");
                return;
            }
            FormSheetPicker FormS = new FormSheetPicker();

            FormS.SheetType = SheetTypeEnum.PatientLetter;
            FormS.ShowDialog();
            if (FormS.DialogResult != DialogResult.OK)
            {
                return;
            }
            SheetDef sheetDef;
            Sheet    sheet = null;

            for (int i = 0; i < FormS.SelectedSheetDefs.Count; i++)
            {
                PdfDocument       document        = new PdfDocument();
                FormSheetFillEdit FormSF          = null;
                PdfPage           page            = new PdfPage();
                string            filePathAndName = "";
                for (int j = 0; j < gridMain.SelectedIndices.Length; j++)
                {
                    page     = document.AddPage();
                    sheetDef = FormS.SelectedSheetDefs[i];
                    sheet    = SheetUtil.CreateSheet(sheetDef, PIn.Long(table.Rows[gridMain.SelectedIndices[j]]["PatNum"].ToString()));
                    SheetParameter.SetParameter(sheet, "PatNum", PIn.Long(table.Rows[gridMain.SelectedIndices[j]]["PatNum"].ToString()));
                    SheetFiller.FillFields(sheet);
                    SheetUtil.CalculateHeights(sheet, this.CreateGraphics());
                    FormSF = new FormSheetFillEdit(sheet);
                    SheetPrinting.CreatePdfPage(sheet, page);
                }
                filePathAndName = Path.ChangeExtension(Path.GetTempFileName(), ".pdf");
                document.Save(filePathAndName);
                Process.Start(filePathAndName);
                DialogResult = DialogResult.OK;
            }
        }
Exemplo n.º 24
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            if (table.Rows[e.Row]["DocNum"].ToString() != "0")
            {
                long docNum = PIn.Long(table.Rows[e.Row]["DocNum"].ToString());
                GotoModule.GotoImage(PatNum, docNum);
                return;
            }
            //Sheets
            long              sheetNum = PIn.Long(table.Rows[e.Row]["SheetNum"].ToString());
            Sheet             sheet    = Sheets.GetSheet(sheetNum);
            FormSheetFillEdit FormSF   = new FormSheetFillEdit(sheet);

            FormSF.ShowDialog();
            if (FormSF.DialogResult == DialogResult.OK)
            {
                FillGrid();
            }
        }
Exemplo n.º 25
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            FormSheetPicker FormS = new FormSheetPicker();

            FormS.SheetType = SheetTypeEnum.PatientForm;
            FormS.ShowDialog();
            if (FormS.DialogResult != DialogResult.OK)
            {
                return;
            }
            SheetDef sheetDef;
            Sheet    sheet = null;       //only useful if not Terminal

            for (int i = 0; i < FormS.SelectedSheetDefs.Count; i++)
            {
                sheetDef = FormS.SelectedSheetDefs[i];
                sheet    = SheetUtil.CreateSheet(sheetDef, PatNum);
                SheetParameter.SetParameter(sheet, "PatNum", PatNum);
                SheetFiller.FillFields(sheet);
                SheetUtil.CalculateHeights(sheet, this.CreateGraphics());
                if (FormS.TerminalSend)
                {
                    sheet.InternalNote   = "";                //because null not ok
                    sheet.ShowInTerminal = (byte)(Sheets.GetBiggestShowInTerminal(PatNum) + 1);
                    Sheets.SaveNewSheet(sheet);               //save each sheet.
                }
            }
            if (FormS.TerminalSend)
            {
                //do not show a dialog now.
                //User will need to click the terminal button.
                FillGrid();
            }
            else
            {
                FormSheetFillEdit FormSF = new FormSheetFillEdit(sheet);
                FormSF.ShowDialog();
                if (FormSF.DialogResult == DialogResult.OK)
                {
                    FillGrid();
                }
            }
        }
Exemplo n.º 26
0
        private void AutoShowSheets()
        {
            //only autoshowsheets if IsSimpleMode or the patient is set/changed
            List <long> listSheetNumsFilled = new List <long>();
            long        patNumCur           = PatNum;
            long        sheetNumCur         = _listSheets?.FirstOrDefault()?.SheetNum ?? 0; //defaults to 0, if 0 no sheet will display

            while (patNumCur == PatNum && sheetNumCur > 0)                                  //if patient is changed or no more sheets to display, break out of loop
            {
                Sheet sheetCur = Sheets.GetSheet(sheetNumCur);                              //we want the very freshest copy of the sheet, so we go straight to the database for it
                _formSheetFillEdit = new FormSheetFillEdit(sheetCur);
                _formSheetFillEdit.IsInTerminal = true;
                _formSheetFillEdit.ShowDialog();
                if (_formSheetFillEdit.DialogResult != DialogResult.OK)
                {
                    break;                    //either patient clicked cancel, or NOT IsSimpleMode and a close signal was received, break out of loop
                }
                listSheetNumsFilled.Add(sheetNumCur);
                sheetNumCur = _listSheets?.FirstOrDefault(x => !listSheetNumsFilled.Contains(x.SheetNum))?.SheetNum ?? 0;            //default to 0
            }
        }
Exemplo n.º 27
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            FormSheetPicker FormS = new FormSheetPicker();

            FormS.SheetType = SheetTypeEnum.ExamSheet;
            FormS.ShowDialog();
            if (FormS.DialogResult != DialogResult.OK)
            {
                return;
            }
            SheetDef sheetDef;
            Sheet    sheet = null;       //only useful if not Terminal

            for (int i = 0; i < FormS.SelectedSheetDefs.Count; i++)
            {
                sheetDef = FormS.SelectedSheetDefs[i];
                sheet    = SheetUtil.CreateSheet(sheetDef, PatNum);
                SheetParameter.SetParameter(sheet, "PatNum", PatNum);
                SheetFiller.FillFields(sheet);
                SheetUtil.CalculateHeights(sheet);
            }
            FormSheetFillEdit.ShowForm(sheet, FormSheetFillEdit_Add_FormClosing);
        }
Exemplo n.º 28
0
        public static bool Trigger <T>(AutomationTrigger trigger, List <string> procCodes, long patNum, long aptNum = 0, T triggerObj = default(T))
        {
            if (patNum == 0)           //Could happen for OpenPatient trigger
            {
                return(false);
            }
            List <Automation> listAutomations = Automations.GetDeepCopy();
            bool automationHappened           = false;

            for (int i = 0; i < listAutomations.Count; i++)
            {
                if (listAutomations[i].Autotrigger != trigger)
                {
                    continue;
                }
                if (trigger == AutomationTrigger.CompleteProcedure || trigger == AutomationTrigger.ScheduleProcedure)
                {
                    if (procCodes == null || procCodes.Count == 0)
                    {
                        continue;                        //fail silently
                    }
                    string[] arrayCodes = listAutomations[i].ProcCodes.Split(',');
                    if (procCodes.All(x => !arrayCodes.Contains(x)))
                    {
                        continue;
                    }
                }
                //matching automation item has been found
                //Get possible list of conditions that exist for this automation item
                List <AutomationCondition> autoConditionsList = AutomationConditions.GetListByAutomationNum(listAutomations[i].AutomationNum);
                if (autoConditionsList.Count > 0 && !CheckAutomationConditions(autoConditionsList, patNum, triggerObj))
                {
                    continue;
                }
                SheetDef          sheetDef;
                Sheet             sheet;
                FormSheetFillEdit FormSF;
                Appointment       aptNew;
                Appointment       aptOld;
                switch (listAutomations[i].AutoAction)
                {
                case AutomationAction.CreateCommlog:
                    if (Plugins.HookMethod(null, "AutomationL.Trigger_CreateCommlog_start", patNum, aptNum, listAutomations[i].CommType,
                                           listAutomations[i].MessageContent, trigger))
                    {
                        automationHappened = true;
                        continue;
                    }
                    Commlog commlogCur = new Commlog();
                    commlogCur.PatNum       = patNum;
                    commlogCur.CommDateTime = DateTime.Now;
                    commlogCur.CommType     = listAutomations[i].CommType;
                    commlogCur.Note         = listAutomations[i].MessageContent;
                    commlogCur.Mode_        = CommItemMode.None;
                    commlogCur.UserNum      = Security.CurUser.UserNum;
                    commlogCur.IsNew        = true;
                    FormCommItem commItemView = new FormCommItem(commlogCur);
                    commItemView.ShowDialog();
                    automationHappened = true;
                    continue;

                case AutomationAction.PopUp:
                    MessageBox.Show(listAutomations[i].MessageContent);
                    automationHappened = true;
                    continue;

                case AutomationAction.PopUpThenDisable10Min:
                    Plugins.HookAddCode(null, "AutomationL.Trigger_PopUpThenDisable10Min_begin", listAutomations[i], procCodes, patNum);
                    long automationNum      = listAutomations[i].AutomationNum;
                    bool hasAutomationBlock = FormOpenDental.DicBlockedAutomations.ContainsKey(automationNum);
                    if (hasAutomationBlock && FormOpenDental.DicBlockedAutomations[automationNum].ContainsKey(patNum))                             //Automation block exist for current patient.
                    {
                        continue;
                    }
                    if (hasAutomationBlock)
                    {
                        FormOpenDental.DicBlockedAutomations[automationNum].Add(patNum, DateTime.Now.AddMinutes(10)); //Disable for 10 minutes.
                    }
                    else                                                                                              //Add automationNum to higher level dictionary .
                    {
                        FormOpenDental.DicBlockedAutomations.Add(automationNum,
                                                                 new Dictionary <long, DateTime>()
                        {
                            { patNum, DateTime.Now.AddMinutes(10) }                                           //Disable for 10 minutes.
                        });
                    }
                    MessageBox.Show(listAutomations[i].MessageContent);
                    automationHappened = true;
                    continue;

                case AutomationAction.PrintPatientLetter:
                case AutomationAction.ShowExamSheet:
                case AutomationAction.ShowConsentForm:
                    sheetDef = SheetDefs.GetSheetDef(listAutomations[i].SheetDefNum);
                    sheet    = SheetUtil.CreateSheet(sheetDef, patNum);
                    SheetParameter.SetParameter(sheet, "PatNum", patNum);
                    SheetFiller.FillFields(sheet);
                    SheetUtil.CalculateHeights(sheet);
                    FormSF = new FormSheetFillEdit(sheet);
                    FormSF.ShowDialog();
                    automationHappened = true;
                    continue;

                case AutomationAction.PrintReferralLetter:
                    long referralNum = RefAttaches.GetReferralNum(patNum);
                    if (referralNum == 0)
                    {
                        MsgBox.Show("Automations", "This patient has no referral source entered.");
                        automationHappened = true;
                        continue;
                    }
                    sheetDef = SheetDefs.GetSheetDef(listAutomations[i].SheetDefNum);
                    sheet    = SheetUtil.CreateSheet(sheetDef, patNum);
                    SheetParameter.SetParameter(sheet, "PatNum", patNum);
                    SheetParameter.SetParameter(sheet, "ReferralNum", referralNum);
                    //Don't fill these params if the sheet doesn't use them.
                    if (sheetDef.SheetFieldDefs.Any(x =>
                                                    (x.FieldType == SheetFieldType.Grid && x.FieldName == "ReferralLetterProceduresCompleted") ||
                                                    (x.FieldType == SheetFieldType.Special && x.FieldName == "toothChart")))
                    {
                        List <Procedure> listProcs = Procedures.GetCompletedForDateRange(DateTime.Today, DateTime.Today
                                                                                         , listPatNums: new List <long>()
                        {
                            patNum
                        }
                                                                                         , includeNote: true
                                                                                         , includeGroupNote: true
                                                                                         );
                        if (sheetDef.SheetFieldDefs.Any(x => x.FieldType == SheetFieldType.Grid && x.FieldName == "ReferralLetterProceduresCompleted"))
                        {
                            SheetParameter.SetParameter(sheet, "CompletedProcs", listProcs);
                        }
                        if (sheetDef.SheetFieldDefs.Any(x => x.FieldType == SheetFieldType.Special && x.FieldName == "toothChart"))
                        {
                            SheetParameter.SetParameter(sheet, "toothChartImg", SheetPrinting.GetToothChartHelper(patNum, false, listProceduresFilteredOverride: listProcs));
                        }
                    }
                    SheetFiller.FillFields(sheet);
                    SheetUtil.CalculateHeights(sheet);
                    FormSF = new FormSheetFillEdit(sheet);
                    FormSF.ShowDialog();
                    automationHappened = true;
                    continue;

                case AutomationAction.SetApptASAP:
                    aptNew = Appointments.GetOneApt(aptNum);
                    if (aptNew == null)
                    {
                        MsgBox.Show("Automations", "Invalid appointment for automation.");
                        automationHappened = true;
                        continue;
                    }
                    aptOld          = aptNew.Copy();
                    aptNew.Priority = ApptPriority.ASAP;
                    Appointments.Update(aptNew, aptOld);                           //Appointments S-Class handles Signalods
                    continue;

                case AutomationAction.SetApptType:
                    aptNew = Appointments.GetOneApt(aptNum);
                    if (aptNew == null)
                    {
                        MsgBox.Show("Automations", "Invalid appointment for automation.");
                        automationHappened = true;
                        continue;
                    }
                    aptOld = aptNew.Copy();
                    aptNew.AppointmentTypeNum = listAutomations[i].AppointmentTypeNum;
                    AppointmentType aptTypeCur = AppointmentTypes.GetFirstOrDefault(x => x.AppointmentTypeNum == aptNew.AppointmentTypeNum);
                    if (aptTypeCur != null)
                    {
                        aptNew.ColorOverride = aptTypeCur.AppointmentTypeColor;
                        aptNew.Pattern       = AppointmentTypes.GetTimePatternForAppointmentType(aptTypeCur);
                        List <Procedure> listProcs = Appointments.ApptTypeMissingProcHelper(aptNew, aptTypeCur, new List <Procedure>());
                        Procedures.UpdateAptNums(listProcs.Select(x => x.ProcNum).ToList(), aptNew.AptNum, aptNew.AptStatus == ApptStatus.Planned);
                    }
                    Appointments.Update(aptNew, aptOld);                           //Appointments S-Class handles Signalods
                    continue;

                case AutomationAction.PatRestrictApptSchedTrue:
                    if (!Security.IsAuthorized(Permissions.PatientApptRestrict, true))
                    {
                        SecurityLogs.MakeLogEntry(Permissions.PatientApptRestrict, patNum, "Attempt to restrict patient scheduling was blocked due to lack of user permission.");
                        continue;
                    }
                    PatRestrictions.Upsert(patNum, PatRestrict.ApptSchedule);
                    automationHappened = true;
                    continue;

                case AutomationAction.PatRestrictApptSchedFalse:
                    if (!Security.IsAuthorized(Permissions.PatientApptRestrict, true))
                    {
                        SecurityLogs.MakeLogEntry(Permissions.PatientApptRestrict, patNum, "Attempt to allow patient scheduling was blocked due to lack of user permission.");
                        continue;
                    }
                    PatRestrictions.RemovePatRestriction(patNum, PatRestrict.ApptSchedule);
                    automationHappened = true;
                    continue;

                case AutomationAction.PrintRxInstruction:
                    List <RxPat> listRx = (List <RxPat>)(object) triggerObj;
                    if (listRx == null)
                    {
                        //Got here via a pre-existing trigger that doesn't pass in triggerObj.  We now block creation of automation triggers that could get
                        //here via code that does not pass in triggerObj.
                        continue;
                    }
                    //We go through each new Rx where the patient note isn't blank.
                    //There should only usually be one new rx, but we'll loop just in case.
                    foreach (RxPat rx in listRx.Where(x => !string.IsNullOrWhiteSpace(x.PatientInstruction)))
                    {
                        //This logic is an exact copy of FormRxManage.butPrintSelect_Click()'s logic when 1 Rx is selected.
                        //If this is updated, that method needs to be updated as well.
                        sheetDef = SheetDefs.GetSheetDef(listAutomations[i].SheetDefNum);
                        sheet    = SheetUtil.CreateSheet(sheetDef, patNum);
                        SheetParameter.SetParameter(sheet, "RxNum", rx.RxNum);
                        SheetFiller.FillFields(sheet);
                        SheetUtil.CalculateHeights(sheet);
                        FormSF = new FormSheetFillEdit(sheet);
                        FormSF.ShowDialog();
                        automationHappened = true;
                    }
                    continue;

                case AutomationAction.ChangePatStatus:
                    Patient pat    = Patients.GetPat(patNum);
                    Patient patOld = pat.Copy();
                    pat.PatStatus = listAutomations[i].PatStatus;
                    //Don't allow changing status from Archived if this is a merged patient.
                    if (patOld.PatStatus != pat.PatStatus &&
                        patOld.PatStatus == PatientStatus.Archived &&
                        PatientLinks.WasPatientMerged(patOld.PatNum))
                    {
                        MsgBox.Show("FormPatientEdit", "Not allowed to change the status of a merged patient.");
                        continue;
                    }
                    switch (pat.PatStatus)
                    {
                    case PatientStatus.Deceased:
                        if (patOld.PatStatus != PatientStatus.Deceased)
                        {
                            List <Appointment> listFutureAppts = Appointments.GetFutureSchedApts(pat.PatNum);
                            if (listFutureAppts.Count > 0)
                            {
                                string apptDates = string.Join("\r\n", listFutureAppts.Take(10).Select(x => x.AptDateTime.ToString()));
                                if (listFutureAppts.Count > 10)
                                {
                                    apptDates += "(...)";
                                }
                                if (MessageBox.Show(
                                        Lan.g("FormPatientEdit", "This patient has scheduled appointments in the future") + ":\r\n" + apptDates + "\r\n"
                                        + Lan.g("FormPatientEdit", "Would you like to delete them and set the patient to Deceased?"),
                                        Lan.g("FormPatientEdit", "Delete future appointments?"),
                                        MessageBoxButtons.YesNo) == DialogResult.Yes)
                                {
                                    foreach (Appointment appt in listFutureAppts)
                                    {
                                        Appointments.Delete(appt.AptNum, true);
                                    }
                                }
                                else
                                {
                                    continue;
                                }
                            }
                        }
                        break;
                    }
                    //Re-activate or disable recalls depending on the the status that the patient is changing to.
                    Patients.UpdateRecalls(pat, patOld, "ChangePatStatus automation");
                    if (Patients.Update(pat, patOld))
                    {
                        SecurityLogs.MakeLogEntry(Permissions.PatientEdit, patNum, "Patient status changed from " + patOld.PatStatus.GetDescription() +
                                                  " to " + listAutomations[i].PatStatus.GetDescription() + " through ChangePatStatus automation.");
                    }
                    automationHappened = true;
                    continue;
                }
            }
            return(automationHappened);
        }
Exemplo n.º 29
0
		private void butPreviewSheets() {
			if(StmtCur.DocNum!=0 && checkIsSent.Checked) {//initiallySent && checkIsSent.Checked){
				//launch existing archive pdf
				Cursor=Cursors.WaitCursor;
				Patient pat=Patients.GetPat(StmtCur.PatNum);
				string patFolder=ImageStore.GetPatientFolder(pat,ImageStore.GetPreferredAtoZpath());
				if(!File.Exists(ImageStore.GetFilePath(Documents.GetByNum(StmtCur.DocNum),patFolder))) {
					Cursor=Cursors.Default;
					MsgBox.Show(this,"File not found: " + Documents.GetByNum(StmtCur.DocNum).FileName);
					return;
				}
				Process.Start(ImageStore.GetFilePath(Documents.GetByNum(StmtCur.DocNum),patFolder));
				Cursor=Cursors.Default;
			}
			else {//was not initially sent, or else user has unchecked the sent box
				if(!SaveToDb()) { 
					return;
				}
				SheetDef sheetDef=SheetUtil.GetStatementSheetDef();
				Sheet sheet=SheetUtil.CreateSheet(sheetDef,StmtCur.PatNum,StmtCur.HidePayment);
				SheetFiller.FillFields(sheet,StmtCur);
				SheetUtil.CalculateHeights(sheet,Graphics.FromImage(new Bitmap(sheet.HeightPage,sheet.WidthPage)),StmtCur,true,40,60);
				//print directly to PDF here, and save it.
				FormSheetFillEdit FormSFE=new FormSheetFillEdit(sheet);
				FormSFE.Stmt=StmtCur;
				FormSFE.IsStatement=true;
				FormSFE.ShowDialog();
			}
		}
Exemplo n.º 30
0
        public static bool Trigger <T>(AutomationTrigger trigger, List <string> procCodes, long patNum, long aptNum = 0, T triggerObj = default(T))
        {
            if (patNum == 0)           //Could happen for OpenPatient trigger
            {
                return(false);
            }
            List <Automation> listAutomations = Automations.GetDeepCopy();
            bool automationHappened           = false;

            for (int i = 0; i < listAutomations.Count; i++)
            {
                if (listAutomations[i].Autotrigger != trigger)
                {
                    continue;
                }
                if (trigger == AutomationTrigger.CompleteProcedure || trigger == AutomationTrigger.ScheduleProcedure)
                {
                    if (procCodes == null || procCodes.Count == 0)
                    {
                        continue;                        //fail silently
                    }
                    string[] arrayCodes = listAutomations[i].ProcCodes.Split(',');
                    if (procCodes.All(x => !arrayCodes.Contains(x)))
                    {
                        continue;
                    }
                }
                //matching automation item has been found
                //Get possible list of conditions that exist for this automation item
                List <AutomationCondition> autoConditionsList = AutomationConditions.GetListByAutomationNum(listAutomations[i].AutomationNum);
                if (autoConditionsList.Count > 0 && !CheckAutomationConditions(autoConditionsList, patNum, triggerObj))
                {
                    continue;
                }
                SheetDef          sheetDef;
                Sheet             sheet;
                FormSheetFillEdit FormSF;
                Appointment       aptNew;
                Appointment       aptOld;
                switch (listAutomations[i].AutoAction)
                {
                case AutomationAction.CreateCommlog:
                    if (Plugins.HookMethod(null, "AutomationL.Trigger_CreateCommlog_start", patNum, aptNum, listAutomations[i].CommType,
                                           listAutomations[i].MessageContent))
                    {
                        automationHappened = true;
                        continue;
                    }
                    Commlog commlogCur = new Commlog();
                    commlogCur.PatNum       = patNum;
                    commlogCur.CommDateTime = DateTime.Now;
                    commlogCur.CommType     = listAutomations[i].CommType;
                    commlogCur.Note         = listAutomations[i].MessageContent;
                    commlogCur.Mode_        = CommItemMode.None;
                    commlogCur.UserNum      = Security.CurUser.UserNum;
                    FormCommItem commItemView = new FormCommItem();
                    commItemView.ShowDialog(new CommItemModel()
                    {
                        CommlogCur = commlogCur
                    }, new CommItemController(commItemView)
                    {
                        IsNew = true
                    });
                    automationHappened = true;
                    continue;

                case AutomationAction.PopUp:
                    MessageBox.Show(listAutomations[i].MessageContent);
                    automationHappened = true;
                    continue;

                case AutomationAction.PopUpThenDisable10Min:
                    long automationNum      = listAutomations[i].AutomationNum;
                    bool hasAutomationBlock = FormOpenDental.DicBlockedAutomations.ContainsKey(automationNum);
                    if (hasAutomationBlock && FormOpenDental.DicBlockedAutomations[automationNum].ContainsKey(patNum))                             //Automation block exist for current patient.
                    {
                        continue;
                    }
                    if (hasAutomationBlock)
                    {
                        FormOpenDental.DicBlockedAutomations[automationNum].Add(patNum, DateTime.Now.AddMinutes(10)); //Disable for 10 minutes.
                    }
                    else                                                                                              //Add automationNum to higher level dictionary .
                    {
                        FormOpenDental.DicBlockedAutomations.Add(automationNum,
                                                                 new Dictionary <long, DateTime>()
                        {
                            { patNum, DateTime.Now.AddMinutes(10) }                                           //Disable for 10 minutes.
                        });
                    }
                    MessageBox.Show(listAutomations[i].MessageContent);
                    automationHappened = true;
                    continue;

                case AutomationAction.PrintPatientLetter:
                case AutomationAction.ShowExamSheet:
                case AutomationAction.ShowConsentForm:
                    sheetDef = SheetDefs.GetSheetDef(listAutomations[i].SheetDefNum);
                    sheet    = SheetUtil.CreateSheet(sheetDef, patNum);
                    SheetParameter.SetParameter(sheet, "PatNum", patNum);
                    SheetFiller.FillFields(sheet);
                    SheetUtil.CalculateHeights(sheet);
                    FormSF = new FormSheetFillEdit(sheet);
                    FormSF.ShowDialog();
                    automationHappened = true;
                    continue;

                case AutomationAction.PrintReferralLetter:
                    long referralNum = RefAttaches.GetReferralNum(patNum);
                    if (referralNum == 0)
                    {
                        MsgBox.Show("Automations", "This patient has no referral source entered.");
                        automationHappened = true;
                        continue;
                    }
                    sheetDef = SheetDefs.GetSheetDef(listAutomations[i].SheetDefNum);
                    sheet    = SheetUtil.CreateSheet(sheetDef, patNum);
                    SheetParameter.SetParameter(sheet, "PatNum", patNum);
                    SheetParameter.SetParameter(sheet, "ReferralNum", referralNum);
                    //Don't fill these params if the sheet doesn't use them.
                    if (sheetDef.SheetFieldDefs.Any(x =>
                                                    (x.FieldType == SheetFieldType.Grid && x.FieldName == "ReferralLetterProceduresCompleted") ||
                                                    (x.FieldType == SheetFieldType.Special && x.FieldName == "toothChart")))
                    {
                        List <Procedure> listProcs = Procedures.GetCompletedForDateRange(DateTime.Today, DateTime.Today
                                                                                         , listPatNums: new List <long>()
                        {
                            patNum
                        }
                                                                                         , includeNote: true
                                                                                         , includeGroupNote: true
                                                                                         );
                        if (sheetDef.SheetFieldDefs.Any(x => x.FieldType == SheetFieldType.Grid && x.FieldName == "ReferralLetterProceduresCompleted"))
                        {
                            SheetParameter.SetParameter(sheet, "CompletedProcs", listProcs);
                        }
                        if (sheetDef.SheetFieldDefs.Any(x => x.FieldType == SheetFieldType.Special && x.FieldName == "toothChart"))
                        {
                            SheetParameter.SetParameter(sheet, "toothChartImg", SheetPrinting.GetToothChartHelper(patNum, false, listProceduresFilteredOverride: listProcs));
                        }
                    }
                    SheetFiller.FillFields(sheet);
                    SheetUtil.CalculateHeights(sheet);
                    FormSF = new FormSheetFillEdit(sheet);
                    FormSF.ShowDialog();
                    automationHappened = true;
                    continue;

                case AutomationAction.SetApptASAP:
                    aptNew = Appointments.GetOneApt(aptNum);
                    if (aptNew == null)
                    {
                        MsgBox.Show("Automations", "Invalid appointment for automation.");
                        automationHappened = true;
                        continue;
                    }
                    aptOld          = aptNew.Copy();
                    aptNew.Priority = ApptPriority.ASAP;
                    Appointments.Update(aptNew, aptOld);                           //Appointments S-Class handles Signalods
                    continue;

                case AutomationAction.SetApptType:
                    aptNew = Appointments.GetOneApt(aptNum);
                    if (aptNew == null)
                    {
                        MsgBox.Show("Automations", "Invalid appointment for automation.");
                        automationHappened = true;
                        continue;
                    }
                    aptOld = aptNew.Copy();
                    aptNew.AppointmentTypeNum = listAutomations[i].AppointmentTypeNum;
                    AppointmentType aptTypeCur = AppointmentTypes.GetFirstOrDefault(x => x.AppointmentTypeNum == aptNew.AppointmentTypeNum);
                    if (aptTypeCur != null)
                    {
                        aptNew.ColorOverride = aptTypeCur.AppointmentTypeColor;
                    }
                    Appointments.Update(aptNew, aptOld);                           //Appointments S-Class handles Signalods
                    continue;

                case AutomationAction.PatRestrictApptSchedTrue:
                    if (!Security.IsAuthorized(Permissions.PatientApptRestrict, true))
                    {
                        SecurityLogs.MakeLogEntry(Permissions.PatientApptRestrict, patNum, "Attempt to restrict patient scheduling was blocked due to lack of user permission.");
                        continue;
                    }
                    PatRestrictions.Upsert(patNum, PatRestrict.ApptSchedule);
                    automationHappened = true;
                    continue;

                case AutomationAction.PatRestrictApptSchedFalse:
                    if (!Security.IsAuthorized(Permissions.PatientApptRestrict, true))
                    {
                        SecurityLogs.MakeLogEntry(Permissions.PatientApptRestrict, patNum, "Attempt to allow patient scheduling was blocked due to lack of user permission.");
                        continue;
                    }
                    PatRestrictions.RemovePatRestriction(patNum, PatRestrict.ApptSchedule);
                    automationHappened = true;
                    continue;
                }
            }
            return(automationHappened);
        }
Exemplo n.º 31
0
 private void menuLetter_Click(object sender,System.EventArgs e)
 {
     if(((MenuItem)sender).Tag==null) {
         return;
     }
     Patient pat=Patients.GetPat(CurPatNum);
     if(((MenuItem)sender).Tag.GetType()==typeof(string)) {
         if(((MenuItem)sender).Tag.ToString()=="Merge") {
             FormLetterMerges FormL=new FormLetterMerges(pat);
             FormL.ShowDialog();
         }
         //if(((MenuItem)sender).Tag.ToString()=="Stationery") {
         //	FormCommunications.PrintStationery(pat);
         //}
     }
     if(((MenuItem)sender).Tag.GetType()==typeof(Referral)) {
         Referral refer=(Referral)((MenuItem)sender).Tag;
         FormSheetPicker FormS=new FormSheetPicker();
         FormS.SheetType=SheetTypeEnum.ReferralLetter;
         FormS.ShowDialog();
         if(FormS.DialogResult!=DialogResult.OK){
             return;
         }
         SheetDef sheetDef=FormS.SelectedSheetDefs[0];
         Sheet sheet=SheetUtil.CreateSheet(sheetDef,CurPatNum);
         SheetParameter.SetParameter(sheet,"PatNum",CurPatNum);
         SheetParameter.SetParameter(sheet,"ReferralNum",refer.ReferralNum);
         SheetFiller.FillFields(sheet);
         SheetUtil.CalculateHeights(sheet,this.CreateGraphics());
         FormSheetFillEdit FormSF=new FormSheetFillEdit(sheet);
         FormSF.ShowDialog();
         if(FormSF.DialogResult==DialogResult.OK) {
             RefreshCurrentModule();
         }
         //FormLetters FormL=new FormLetters(pat);
         //FormL.ReferralCur=refer;
         //FormL.ShowDialog();
     }
 }
Exemplo n.º 32
0
		private void butPrint_Click(object sender, System.EventArgs e) {
			if(textDate.errorProvider1.GetError(textDate)!="") {
				MsgBox.Show(this,"Please fix data entry errors first.");
				return;
			}
			if(IsNew){
				if(!SaveToDB()) {
					return;
				}
			}
			else{//not new
				//Only allowed to change date and bank account info, NOT attached checks.
				//We enforce security here based on date displayed, not date entered.
				//If user is trying to change date without permission:
				DateTime date=PIn.Date(textDate.Text);
				if(Security.IsAuthorized(Permissions.DepositSlips,date,true)){
					if(!SaveToDB()) {
						return;
					}
				}
				//if security.NotAuthorized, then it simply skips the save process before printing
			}
			SheetDef sheetDef=null;
			List <SheetDef> depositSheetDefs=SheetDefs.GetCustomForType(SheetTypeEnum.DepositSlip);
			if(depositSheetDefs.Count>0){
				sheetDef=depositSheetDefs[0];
				SheetDefs.GetFieldsAndParameters(sheetDef);
			}
			else{
				sheetDef=SheetsInternal.DepositSlip();
			}
			Sheet sheet=SheetUtil.CreateSheet(sheetDef,0);
			SheetParameter.SetParameter(sheet,"DepositNum",DepositCur.DepositNum);
			SheetFiller.FillFields(sheet);
			SheetUtil.CalculateHeights(sheet,this.CreateGraphics());
			FormSheetFillEdit FormSF=new FormSheetFillEdit(sheet);
			FormSF.ShowDialog();
			DialogResult=DialogResult.OK;//this is imporant, since we don't want to insert the deposit slip twice.
		}
Exemplo n.º 33
0
		private void butAdd_Click(object sender,EventArgs e) {
			FormSheetPicker FormS=new FormSheetPicker();
			FormS.SheetType=SheetTypeEnum.ExamSheet;
			FormS.ShowDialog();
			if(FormS.DialogResult!=DialogResult.OK) {
				return;
			}
			SheetDef sheetDef;
			Sheet sheet=null;//only useful if not Terminal
			for(int i=0;i<FormS.SelectedSheetDefs.Count;i++) {
				sheetDef=FormS.SelectedSheetDefs[i];
				sheet=SheetUtil.CreateSheet(sheetDef,PatNum);
				SheetParameter.SetParameter(sheet,"PatNum",PatNum);
				SheetFiller.FillFields(sheet);
				SheetUtil.CalculateHeights(sheet,this.CreateGraphics());
			}
			FormSheetFillEdit FormSF=new FormSheetFillEdit(sheet);
			FormSF.ShowDialog();
			if(FormSF.DialogResult==DialogResult.OK) {
				FillGrid();
				gridMain.SetSelected(false);//unselect all rows
				gridMain.SetSelected(gridMain.Rows.Count-1,true);//Select the newly added row. Always last, since ordered by date.
			}
		}
Exemplo n.º 34
0
 private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e)
 {
     long sheetNum=(long)gridMain.Rows[e.Row].Tag;
     Sheet sheet=Sheets.GetSheet(sheetNum);
     FormSheetFillEdit FormSF=new FormSheetFillEdit(sheet);
     FormSF.ShowDialog();
     //FillGrid();//We must refresh the grid because the web form clicked might have been deleted by the user.
 }
Exemplo n.º 35
0
		private void listForms_DoubleClick(object sender,EventArgs e) {
			//this might be used after the patient has completed all the forms and wishes to review or alter one of them
			if(listForms.SelectedIndex==-1) {
				return;
			}
			Sheet sheet=Sheets.GetSheet(SheetList[listForms.SelectedIndex].SheetNum);
			formSheetFillEdit=new FormSheetFillEdit(sheet);
			formSheetFillEdit.IsInTerminal=true;
			formSheetFillEdit.ShowDialog();
			//no point in refreshing the list because patient cannot edit description or delete sheet.
		}
Exemplo n.º 36
0
		private void gridComm_CellDoubleClick(object sender,OpenDental.UI.ODGridClickEventArgs e) {
			//TODO: transition this to checking the Tag object.
			int row=e.Row;
			if(!this.checkShowFamilyComm.Checked) {//if only showing entries for one patient instead of intermingled family entries
				int i;
				for(row=0,i=0;row<DataSetMain.Tables["Commlog"].Rows.Count;row++) {
					//Matching FName is not perfect because children can have the same names as parents.
					//But it does currently match the logic for display, so it will at least select the right row when double clicked.
					if(DataSetMain.Tables["Commlog"].Rows[row]["patName"].ToString()==PatCur.FName
						|| DataSetMain.Tables["Commlog"].Rows[row]["patName"].ToString()=="") {
						if(i==e.Row) {
							break;
						}
						i++;
					}
				}
			}
			if(DataSetMain.Tables["Commlog"].Rows[row]["CommlogNum"].ToString()!="0") {
				Commlog CommlogCur=
					Commlogs.GetOne(PIn.Long(DataSetMain.Tables["Commlog"].Rows[row]["CommlogNum"].ToString()));
				FormCommItem FormCI=new FormCommItem(CommlogCur);
				FormCI.ShowDialog();
				if(FormCI.DialogResult==DialogResult.OK) {
					ModuleSelected(PatCur.PatNum);
				}
			}
			else if(DataSetMain.Tables["Commlog"].Rows[row]["EmailMessageNum"].ToString()!="0") {
				EmailMessage email=
					EmailMessages.GetOne(PIn.Long(DataSetMain.Tables["Commlog"].Rows[row]["EmailMessageNum"].ToString()));
				FormEmailMessageEdit FormE=new FormEmailMessageEdit(email);
				FormE.ShowDialog();
				if(FormE.DialogResult==DialogResult.OK) {
					ModuleSelected(PatCur.PatNum);
				}
			}
			else if(DataSetMain.Tables["Commlog"].Rows[row]["FormPatNum"].ToString()!="0") {
				FormPat form=FormPats.GetOne(PIn.Long(DataSetMain.Tables["Commlog"].Rows[row]["FormPatNum"].ToString()));
				FormFormPatEdit FormP=new FormFormPatEdit();
				FormP.FormPatCur=form;
				FormP.ShowDialog();
				if(FormP.DialogResult==DialogResult.OK) {
					ModuleSelected(PatCur.PatNum);
				}
			}
			else if(DataSetMain.Tables["Commlog"].Rows[row]["SheetNum"].ToString()!="0") {
				Sheet sheet=Sheets.GetSheet(PIn.Long(DataSetMain.Tables["Commlog"].Rows[row]["SheetNum"].ToString()));
				FormSheetFillEdit FormSFE=new FormSheetFillEdit(sheet);
				FormSFE.ShowDialog();
				if(FormSFE.DialogResult==DialogResult.OK) {
					ModuleSelected(PatCur.PatNum);
				}
			}
		}
Exemplo n.º 37
0
		private void menuConsent_Click(object sender,EventArgs e) {
			SheetDef sheetDef=(SheetDef)(((MenuItem)sender).Tag);
			SheetDefs.GetFieldsAndParameters(sheetDef);
			Sheet sheet=SheetUtil.CreateSheet(sheetDef,PatCur.PatNum);
			SheetParameter.SetParameter(sheet,"PatNum",PatCur.PatNum);
			SheetFiller.FillFields(sheet);
			Graphics g=this.CreateGraphics();
			SheetUtil.CalculateHeights(sheet,g);
			g.Dispose();
			FormSheetFillEdit FormS=new FormSheetFillEdit(sheet);
			FormS.ShowDialog();
			ModuleSelected(PatCur.PatNum);
		}
Exemplo n.º 38
0
		private void Tool_Consent_Click() {
			List<SheetDef> listSheets=SheetDefs.GetCustomForType(SheetTypeEnum.Consent);
			if(listSheets.Count>0){
				MsgBox.Show(this,"Please use dropdown list.");
				return;
			}
			SheetDef sheetDef=SheetsInternal.GetSheetDef(SheetInternalType.Consent);
			Sheet sheet=SheetUtil.CreateSheet(sheetDef,PatCur.PatNum);
			SheetParameter.SetParameter(sheet,"PatNum",PatCur.PatNum);
			SheetFiller.FillFields(sheet);
			Graphics g=this.CreateGraphics();
			SheetUtil.CalculateHeights(sheet,g);
			g.Dispose();
			FormSheetFillEdit FormS=new FormSheetFillEdit(sheet);
			FormS.ShowDialog();
			ModuleSelected(PatCur.PatNum);
		}
Exemplo n.º 39
0
		private void gridComm_CellDoubleClick(object sender,OpenDental.UI.ODGridClickEventArgs e) {
			int row=(int)gridComm.Rows[e.Row].Tag;
			if(DataSetMain.Tables["Commlog"].Rows[row]["CommlogNum"].ToString()!="0") {
				Commlog CommlogCur=
					Commlogs.GetOne(PIn.Long(DataSetMain.Tables["Commlog"].Rows[row]["CommlogNum"].ToString()));
				FormCommItem FormCI=new FormCommItem(CommlogCur);
				FormCI.ShowDialog();
				if(FormCI.DialogResult==DialogResult.OK) {
					ModuleSelected(PatCur.PatNum);
				}
			}
			else if(DataSetMain.Tables["Commlog"].Rows[row]["EmailMessageNum"].ToString()!="0") {
				EmailMessage email=
					EmailMessages.GetOne(PIn.Long(DataSetMain.Tables["Commlog"].Rows[row]["EmailMessageNum"].ToString()));
				if(email.SentOrReceived==EmailSentOrReceived.WebMailReceived
					|| email.SentOrReceived==EmailSentOrReceived.WebMailRecdRead
					|| email.SentOrReceived==EmailSentOrReceived.WebMailSent
					|| email.SentOrReceived==EmailSentOrReceived.WebMailSentRead) 
				{
					//web mail uses special secure messaging portal
					FormWebMailMessageEdit FormWMME=new FormWebMailMessageEdit(PatCur.PatNum,email.EmailMessageNum);
					if(FormWMME.ShowDialog()==DialogResult.OK) {
						ModuleSelected(PatCur.PatNum);
					}
				}
				else {
					FormEmailMessageEdit FormE=new FormEmailMessageEdit(email);
					FormE.ShowDialog();
					if(FormE.DialogResult==DialogResult.OK) {
						ModuleSelected(PatCur.PatNum);
					}
				}
			}
			else if(DataSetMain.Tables["Commlog"].Rows[row]["FormPatNum"].ToString()!="0") {
				FormPat form=FormPats.GetOne(PIn.Long(DataSetMain.Tables["Commlog"].Rows[row]["FormPatNum"].ToString()));
				FormFormPatEdit FormP=new FormFormPatEdit();
				FormP.FormPatCur=form;
				FormP.ShowDialog();
				if(FormP.DialogResult==DialogResult.OK) {
					ModuleSelected(PatCur.PatNum);
				}
			}
			else if(DataSetMain.Tables["Commlog"].Rows[row]["SheetNum"].ToString()!="0") {
				Sheet sheet=Sheets.GetSheet(PIn.Long(DataSetMain.Tables["Commlog"].Rows[row]["SheetNum"].ToString()));
				FormSheetFillEdit FormSFE=new FormSheetFillEdit(sheet);
				FormSFE.ShowDialog();
				if(FormSFE.DialogResult==DialogResult.OK) {
					ModuleSelected(PatCur.PatNum);
				}
			}
		}
Exemplo n.º 40
0
		private void gridProg_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			Chartscrollval=gridProg.ScrollValue;
			DataRow row=(DataRow)gridProg.Rows[e.Row].Tag;
			if(row["ProcNum"].ToString()!="0"){
				if(checkAudit.Checked){
					MsgBox.Show(this,"Not allowed to edit procedures when in audit mode.");
					return;
				}
				Procedure proc=Procedures.GetOneProc(PIn.Long(row["ProcNum"].ToString()),true);
				if(ProcedureCodes.GetStringProcCode(proc.CodeNum)==ProcedureCodes.GroupProcCode){
					FormProcGroup FormP=new FormProcGroup();		
					List<ProcGroupItem> groupItemList=ProcGroupItems.GetForGroup(proc.ProcNum);
					List<Procedure> procList=new List<Procedure>();
					for(int i=0;i<groupItemList.Count;i++){
						procList.Add(Procedures.GetOneProc(groupItemList[i].ProcNum,false));
					}
					FormP.GroupCur=proc;
					FormP.GroupItemList=groupItemList;
					FormP.ProcList=procList;
					FormP.ShowDialog();
					if(FormP.DialogResult==DialogResult.OK){
						ModuleSelected(PatCur.PatNum);
						FillProgNotes();
					}
					return;
				}
				else{
					FormProcEdit FormP=new FormProcEdit(proc,PatCur,FamCur);
					Plugins.HookAddCode(this, "ContrChart.gridProg_CellDoubleClick_proc", proc, FormP);
					if(!FormP.IsDisposed) { //Form might be disposed by the above hook.
						FormP.ShowDialog();
					} 
					Plugins.HookAddCode(this, "ContrChart.gridProg_CellDoubleClick_proc2", proc, FormP);
					if(FormP.DialogResult!=DialogResult.OK) {
						return;
					}
				}
			}
			else if(row["CommlogNum"].ToString()!="0"){
				Commlog comm=Commlogs.GetOne(PIn.Long(row["CommlogNum"].ToString()));
				FormCommItem FormC=new FormCommItem(comm);
				FormC.ShowDialog();
				if(FormC.DialogResult!=DialogResult.OK){
					return;
				}
			}
			else if(row["RxNum"].ToString()!="0") {
				RxPat rx=RxPats.GetRx(PIn.Long(row["RxNum"].ToString()));
				FormRxEdit FormRxE=new FormRxEdit(PatCur,rx);
				FormRxE.ShowDialog();
				if(FormRxE.DialogResult!=DialogResult.OK){
					return;
				}
			}
			else if(row["LabCaseNum"].ToString()!="0") {
				LabCase lab=LabCases.GetOne(PIn.Long(row["LabCaseNum"].ToString()));
				FormLabCaseEdit FormL=new FormLabCaseEdit();
				FormL.CaseCur=lab;
				FormL.ShowDialog();
				//needs to always refresh due to complex ok/cancel
			}
			else if(row["TaskNum"].ToString()!="0") {
				Task task=Tasks.GetOne(PIn.Long(row["TaskNum"].ToString()));
				if(task==null) {
					MsgBox.Show(this,"This task has been deleted by another user.");
				}
				else {
					FormTaskEdit FormT=new FormTaskEdit(task,task.Copy());
					FormT.Closing+=new CancelEventHandler(TaskGoToEvent);
					FormT.Show();//non-modal
				}
			}
			else if(row["AptNum"].ToString()!="0") {
				//Appointment apt=Appointments.GetOneApt(
				FormApptEdit FormA=new FormApptEdit(PIn.Long(row["AptNum"].ToString()));
				//PinIsVisible=false
				FormA.IsInChartModule=true;
				FormA.ShowDialog();
				if(FormA.CloseOD) {
					((Form)this.Parent).Close();
					return;
				}
				if(FormA.DialogResult!=DialogResult.OK) {
					return;
				}
			}
			else if(row["EmailMessageNum"].ToString()!="0") {
				EmailMessage msg=EmailMessages.GetOne(PIn.Long(row["EmailMessageNum"].ToString()));
				if(msg.SentOrReceived==EmailSentOrReceived.WebMailReceived
					|| msg.SentOrReceived==EmailSentOrReceived.WebMailRecdRead
					|| msg.SentOrReceived==EmailSentOrReceived.WebMailSent
					|| msg.SentOrReceived==EmailSentOrReceived.WebMailSentRead) 
				{
					//web mail uses special secure messaging portal
					FormWebMailMessageEdit FormWMME=new FormWebMailMessageEdit(PatCur.PatNum,msg.EmailMessageNum);
					if(FormWMME.ShowDialog()!=DialogResult.OK) {
						return;
					}
				}
				else {
					FormEmailMessageEdit FormE=new FormEmailMessageEdit(msg);
					FormE.ShowDialog();
					if(FormE.DialogResult!=DialogResult.OK) {
						return;
					}
				}
			}
			else if(row["SheetNum"].ToString()!="0") {
				Sheet sheet=Sheets.GetSheet(PIn.Long(row["SheetNum"].ToString()));
				FormSheetFillEdit FormSFE=new FormSheetFillEdit(sheet);
				FormSFE.ShowDialog();
				if(FormSFE.DialogResult!=DialogResult.OK) {
					return;
				}
			}
			else if(row["FormPatNum"].ToString()!="0"){
				FormPat form=FormPats.GetOne(PIn.Long(row["FormPatNum"].ToString()));
				FormFormPatEdit FormP=new FormFormPatEdit();
				FormP.FormPatCur=form;
				FormP.ShowDialog();
				if(FormP.DialogResult==DialogResult.OK)
				{
					ModuleSelected(PatCur.PatNum);//Why is this called here and down 3 lines? Do we need the Allocator, or should we return here?
				}
			}
			ModuleSelected(PatCur.PatNum);
			Reporting.Allocators.MyAllocator1_ProviderPayment.AllocateWithToolCheck(this.PatCur.Guarantor);
		}
Exemplo n.º 41
0
 private void butLettersPreview_Click(object sender,EventArgs e)
 {
     //Create letters. loop through each row and insert information into sheets,
     //take all the sheets and add to one giant pdf for preview.
     if(gridMain.SelectedIndices.Length==0) {
         MsgBox.Show(this,"Please select patient(s) first.");
         return;
     }
     FormSheetPicker FormS=new FormSheetPicker();
     FormS.SheetType=SheetTypeEnum.PatientLetter;
     FormS.ShowDialog();
     if(FormS.DialogResult!=DialogResult.OK) {
         return;
     }
     SheetDef sheetDef;
     Sheet sheet=null;
     for(int i=0;i<FormS.SelectedSheetDefs.Count;i++) {
         PdfDocument document=new PdfDocument();
         FormSheetFillEdit FormSF=null;
         PdfPage page=new PdfPage();
         string filePathAndName="";
         for(int j=0;j<gridMain.SelectedIndices.Length;j++) {
             page=document.AddPage();
             sheetDef=FormS.SelectedSheetDefs[i];
             sheet=SheetUtil.CreateSheet(sheetDef,PIn.Long(table.Rows[gridMain.SelectedIndices[j]]["PatNum"].ToString()));
             SheetParameter.SetParameter(sheet,"PatNum",PIn.Long(table.Rows[gridMain.SelectedIndices[j]]["PatNum"].ToString()));
             SheetFiller.FillFields(sheet);
             SheetUtil.CalculateHeights(sheet,this.CreateGraphics());
             FormSF=new FormSheetFillEdit(sheet);
             SheetPrinting.CreatePdfPage(sheet,page);
         }
         filePathAndName=Path.ChangeExtension(Path.GetTempFileName(),".pdf");
         document.Save(filePathAndName);
         Process.Start(filePathAndName);
         DialogResult=DialogResult.OK;
     }
 }
Exemplo n.º 42
0
        /*private void buttonEmail_Click(object sender,EventArgs e) {
            int CurPatNum=CaseCur.PatNum;
            EmailMessage message=new EmailMessage();
            message.PatNum=CurPatNum;
            Patient pat=Patients.GetPat(CurPatNum);
            message.ToAddress="";//pat.Email;
            message.FromAddress=PrefC.GetString(PrefName.EmailSenderAddress");
            message.Subject=Lan.g(this,"RE: ")+pat.GetNameFL();
            FormEmailMessageEdit FormE=new FormEmailMessageEdit(message);
            FormE.IsNew=true;
            FormE.ShowDialog();

        }*/
        private void butSlip_Click(object sender,EventArgs e)
        {
            if(sheet==null) {//create new
                if(!SaveToDb()) {
                    return;
                }
                Laboratory lab=ListLabs[listLab.SelectedIndex];
                SheetDef sheetDef;
                if(lab.Slip==0){
                    sheetDef=SheetsInternal.GetSheetDef(SheetInternalType.LabSlip);
                }
                else{
                    sheetDef=SheetDefs.GetSheetDef(lab.Slip);
                }
                sheet=SheetUtil.CreateSheet(sheetDef,CaseCur.PatNum);
                SheetParameter.SetParameter(sheet,"PatNum",CaseCur.PatNum);
                SheetParameter.SetParameter(sheet,"LabCaseNum",CaseCur.LabCaseNum);
                SheetFiller.FillFields(sheet);
                SheetUtil.CalculateHeights(sheet,this.CreateGraphics());
                FormSheetFillEdit FormS=new FormSheetFillEdit(sheet);
                FormS.ShowDialog();
                //if(FormS.DialogResult!=DialogResult.OK) {
                //	sheet=null;
                //	return;
                //}
            }
            else {//edit existing
                SheetFields.GetFieldsAndParameters(sheet);
                FormSheetFillEdit FormS=new FormSheetFillEdit(sheet);
                FormS.ShowDialog();
                //if(FormS.DialogResult!=DialogResult.OK) {
                //	return;
                //}
            }
            //refresh
            sheet=Sheets.GetLabSlip(CaseCur.PatNum,CaseCur.LabCaseNum);
            if(sheet==null) {
                butSlip.Text=Lan.g(this,"New Slip");
            }
            else {
                butSlip.Text=Lan.g(this,"Edit Slip");
            }
        }
Exemplo n.º 43
0
		private void butCopy_Click(object sender,EventArgs e) {
			if(gridMain.SelectedIndices.Length !=1) {
				MsgBox.Show(this,"Please select one completed sheet from the list above first.");
				return;
			}
			long sheetNum=PIn.Long(table.Rows[gridMain.SelectedIndices[0]]["SheetNum"].ToString());
			if(sheetNum==0) {
				MsgBox.Show(this,"Must select a sheet.");
				return;
			}
			Sheet sheet=Sheets.GetSheet(sheetNum);
			Sheet sheet2=sheet.Copy();
			sheet2.DateTimeSheet=DateTime.Now;
			sheet2.SheetFields=new List<SheetField>(sheet.SheetFields);
			for(int i=0;i<sheet2.SheetFields.Count;i++){
				sheet2.SheetFields[i].IsNew=true;
				if(sheet2.SheetFields[i].FieldType==SheetFieldType.SigBox){
					sheet2.SheetFields[i].FieldValue="";//clear signatures
				}
				//no need to set SheetNums here.  That's done from inside FormSheetFillEdit
			}
			sheet2.IsNew=true;
			FormSheetFillEdit FormSF=new FormSheetFillEdit(sheet2);
			FormSF.ShowDialog();
			if(FormSF.DialogResult==DialogResult.OK) {
				FillGrid();
				for(int i=0;i<table.Rows.Count;i++){
					if(table.Rows[i]["SheetNum"].ToString()==sheet2.SheetNum.ToString()){
						gridMain.SetSelected(i,true);
					}
				}
				SecurityLogs.MakeLogEntry(Permissions.Copy,PatNum,"Patient form "+sheet.Description+" from "+sheet.DateTimeSheet.ToString()+" copied");
			}
		}
Exemplo n.º 44
0
 private void butSlip_Click(object sender,EventArgs e)
 {
     int idx=gridMain.GetSelectedIndex();
     if(idx==-1){
         MsgBox.Show(this,"Please select a referral first");
         return;
     }
     Referral referral=Referrals.GetReferral(RefAttachList[idx].ReferralNum);
     SheetDef sheetDef;
     if(referral.Slip==0){
         sheetDef=SheetsInternal.GetSheetDef(SheetInternalType.ReferralSlip);
     }
     else{
         sheetDef=SheetDefs.GetSheetDef(referral.Slip);
     }
     Sheet sheet=SheetUtil.CreateSheet(sheetDef,PatNum);
     SheetParameter.SetParameter(sheet,"PatNum",PatNum);
     SheetParameter.SetParameter(sheet,"ReferralNum",referral.ReferralNum);
     SheetFiller.FillFields(sheet);
     SheetUtil.CalculateHeights(sheet,this.CreateGraphics());
     FormSheetFillEdit FormS=new FormSheetFillEdit(sheet);
     FormS.ShowDialog();
     //grid will not be refilled, so no need to reselect.
 }
Exemplo n.º 45
0
        private void butView_Click(object sender, EventArgs e)
        {
            Sheet sheet = SheetUtil.CreateSheetFromWebSheet(0, _sheetAndSheetField);

            FormSheetFillEdit.ShowForm(sheet, isReadOnly: true);
        }
Exemplo n.º 46
0
		private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			//Sheets
			long sheetNum=sheetList[e.Row].SheetNum;// PIn.Long(table.Rows[e.Row]["SheetNum"].ToString());
			Sheet sheet=Sheets.GetSheet(sheetNum);//must use this to get fields
			FormSheetFillEdit FormSF=new FormSheetFillEdit(sheet);
			FormSF.ShowDialog();
			if(FormSF.DialogResult==DialogResult.OK) {
				FillGrid();
			}
		}
Exemplo n.º 47
0
		///<summary>ProcCodes will be null unless trigger is CompleteProcedure.  This routine will generally fail silently.  Will return true if a trigger happened.</summary>
		public static bool Trigger(AutomationTrigger trigger,List<string> procCodes,long patNum) {
			if(patNum==0) {//Could happen for OpenPatient trigger
				return false;
			}
			bool automationHappened=false;
			for(int i=0;i<Automations.Listt.Count;i++) {
				if(Automations.Listt[i].Autotrigger!=trigger) {
					continue;
				}
				if(trigger==AutomationTrigger.CompleteProcedure) {
					if(procCodes==null) {
						continue;//fail silently
					}
					bool codeFound=false;
					string[] arrayCodes=Automations.Listt[i].ProcCodes.Split(',');
					for(int p=0;p<procCodes.Count;p++) {
						for(int a=0;a<arrayCodes.Length;a++) {
							if(arrayCodes[a]==procCodes[p]) {
								codeFound=true;
								break;
							}
						}
					}
					if(!codeFound) {
						continue;
					}
				}
				//matching automation item has been found
				//Get possible list of conditions that exist for this automation item
				List<AutomationCondition> autoConditionsList=AutomationConditions.GetListByAutomationNum(Automations.Listt[i].AutomationNum);
				if(Automations.Listt[i].AutoAction==AutomationAction.CreateCommlog) {
					if(autoConditionsList.Count>0) {
						if(!CheckAutomationConditions(autoConditionsList,patNum)) {
							continue;
						}
					}
					Commlog CommlogCur=new Commlog();
					CommlogCur.PatNum=patNum;
					CommlogCur.CommDateTime=DateTime.Now;
					CommlogCur.CommType=Automations.Listt[i].CommType;
					CommlogCur.Note=Automations.Listt[i].MessageContent;
					CommlogCur.Mode_=CommItemMode.None;
					CommlogCur.UserNum=Security.CurUser.UserNum;
					FormCommItem FormCI=new FormCommItem(CommlogCur);
					FormCI.IsNew=true;
					FormCI.ShowDialog();
					automationHappened=true;
				}
				else if(Automations.Listt[i].AutoAction==AutomationAction.PopUp) {
					if(autoConditionsList.Count>0) {
						if(!CheckAutomationConditions(autoConditionsList,patNum)) {
							continue;
						}
					}
					MessageBox.Show(Automations.Listt[i].MessageContent);
					automationHappened=true;
				}
				else if(Automations.Listt[i].AutoAction==AutomationAction.PrintPatientLetter) {
					if(autoConditionsList.Count>0) {
						if(!CheckAutomationConditions(autoConditionsList,patNum)) {
							continue;
						}
					}
					SheetDef sheetDef=SheetDefs.GetSheetDef(Automations.Listt[i].SheetDefNum);
					Sheet sheet=SheetUtil.CreateSheet(sheetDef,patNum);
					SheetParameter.SetParameter(sheet,"PatNum",patNum);
					//SheetParameter.SetParameter(sheet,"ReferralNum",referral.ReferralNum);
					SheetFiller.FillFields(sheet);
					using(Bitmap bmp=new Bitmap(100,100)) {//a dummy bitmap for the graphics object
						using(Graphics g=Graphics.FromImage(bmp)) {
							SheetUtil.CalculateHeights(sheet,g);
						}
					}
					FormSheetFillEdit FormSF=new FormSheetFillEdit(sheet);
					FormSF.ShowDialog();
					automationHappened=true;
				}
				else if(Automations.Listt[i].AutoAction==AutomationAction.PrintReferralLetter) {
					if(autoConditionsList.Count>0) {
						if(!CheckAutomationConditions(autoConditionsList,patNum)) {
							continue;
						}
					}
					long referralNum=RefAttaches.GetReferralNum(patNum);
					if(referralNum==0) {
						MsgBox.Show("Automations","This patient has no referral source entered.");
						automationHappened=true;
						continue;
					}
					SheetDef sheetDef=SheetDefs.GetSheetDef(Automations.Listt[i].SheetDefNum);
					Sheet sheet=SheetUtil.CreateSheet(sheetDef,patNum);
					SheetParameter.SetParameter(sheet,"PatNum",patNum);
					SheetParameter.SetParameter(sheet,"ReferralNum",referralNum);
					SheetFiller.FillFields(sheet);
					using(Bitmap bmp=new Bitmap(100,100)) {//a dummy bitmap for the graphics object
						using(Graphics g=Graphics.FromImage(bmp)) {
							SheetUtil.CalculateHeights(sheet,g);
						}
					}
					FormSheetFillEdit FormSF=new FormSheetFillEdit(sheet);
					FormSF.ShowDialog();
					automationHappened=true;
				}
				else if(Automations.Listt[i].AutoAction==AutomationAction.ShowExamSheet) {
					if(autoConditionsList.Count>0) {
						if(!CheckAutomationConditions(autoConditionsList,patNum)) {
							continue;
						}
					}
					SheetDef sheetDef=SheetDefs.GetSheetDef(Automations.Listt[i].SheetDefNum);
					Sheet sheet=SheetUtil.CreateSheet(sheetDef,patNum);
					SheetParameter.SetParameter(sheet,"PatNum",patNum);
					SheetFiller.FillFields(sheet);
					using(Bitmap bmp=new Bitmap(100,100)) {//a dummy bitmap for the graphics object
						using(Graphics g=Graphics.FromImage(bmp)) {
							SheetUtil.CalculateHeights(sheet,g);
						}
					}
					FormSheetFillEdit FormSF=new FormSheetFillEdit(sheet);
					FormSF.ShowDialog();
					automationHappened=true;
				}
			}
			return automationHappened;
		}
Exemplo n.º 48
0
		///<summary>Used in both modes.  Loads the list of sheets into the listbox.  Then launches the first sheet and goes through the sequence of sheets.  If user clicks cancel, the seqeunce will exit.  If not IsSimpleMode, then the TerminalManager can also send a signal to immediately terminate the sequence.</summary>
		private void LoadPatient() {
			SheetList=Sheets.GetForTerminal(PatNum);
			listForms.Items.Clear();
			if(SheetList.Count==0){
				return;
			}
			for(int i=0;i<SheetList.Count;i++) {
				listForms.Items.Add(SheetList[i].Description);
			}
			for(int i=0;i<SheetList.Count;i++) {
				//we want the very freshest copy of the sheet, so we go straight to the database for it
				Sheet sheet=Sheets.GetSheet(SheetList[i].SheetNum);
				formSheetFillEdit=new FormSheetFillEdit(sheet);
				formSheetFillEdit.IsInTerminal=true;
				if(!IsSimpleMode){
					formSheetFillEdit.TerminalListenShut=true;
				}
				formSheetFillEdit.ShowDialog();
				if(formSheetFillEdit.DialogResult!=DialogResult.OK) {//either patient clicked cancel, or in not IsSimpleMode a close signal was received.
					return;//breaks out of looping through sheets.
				}
			}
		}
Exemplo n.º 49
0
 private void listSheets_DoubleClick(object sender,EventArgs e)
 {
     if(listSheets.SelectedIndex==-1){
         return;
     }
     Sheet sheet=SheetList[listSheets.SelectedIndex];
     SheetFields.GetFieldsAndParameters(sheet);
     FormSheetFillEdit FormS=new FormSheetFillEdit(sheet);
     FormS.ShowDialog();
     FillSheets();
 }
Exemplo n.º 50
0
		private void butView_Click(object sender,EventArgs e) {
			//only visible if there is already a sheet.
			if(!SaveRx()){
				return;
			}
			SheetFields.GetFieldsAndParameters(sheet);
			FormSheetFillEdit FormSF=new FormSheetFillEdit(sheet);
			FormSF.ShowDialog();
			if(FormSF.DialogResult==DialogResult.OK){
				DialogResult=DialogResult.OK;
			}
			//if user clicked cancel, then we can just stay in this form.
		}
Exemplo n.º 51
0
		/*private void buttonEmail_Click(object sender,EventArgs e) {
			int CurPatNum=CaseCur.PatNum;
			EmailMessage message=new EmailMessage();
			message.PatNum=CurPatNum;
			Patient pat=Patients.GetPat(CurPatNum);
			message.ToAddress="";//pat.Email;
			message.FromAddress=PrefC.GetString(PrefName.EmailSenderAddress");
			message.Subject=Lan.g(this,"RE: ")+pat.GetNameFL();
			FormEmailMessageEdit FormE=new FormEmailMessageEdit(message);
			FormE.IsNew=true;
			FormE.ShowDialog();

		}*/

		private void butSlip_Click(object sender,EventArgs e) {
			if(sheet==null) {//create new
				if(!SaveToDb()) {
					return;
				}
				Laboratory lab=ListLabs[listLab.SelectedIndex];
				SheetDef sheetDef;
				if(lab.Slip==0){
					sheetDef=SheetsInternal.GetSheetDef(SheetInternalType.LabSlip);
				}
				else{
					sheetDef=SheetDefs.GetSheetDef(lab.Slip);
				}
				sheet=SheetUtil.CreateSheet(sheetDef,CaseCur.PatNum);
				SheetParameter.SetParameter(sheet,"PatNum",CaseCur.PatNum);
				SheetParameter.SetParameter(sheet,"LabCaseNum",CaseCur.LabCaseNum);
				SheetFiller.FillFields(sheet);
				SheetUtil.CalculateHeights(sheet,this.CreateGraphics());
				FormSheetFillEdit FormS=new FormSheetFillEdit(sheet);
				FormS.ShowDialog();
			}
			else {//edit existing
				SheetFields.GetFieldsAndParameters(sheet);
				FormSheetFillEdit FormS=new FormSheetFillEdit(sheet);
				FormS.ShowDialog();
			}
			//refresh
			sheet=Sheets.GetLabSlip(CaseCur.PatNum,CaseCur.LabCaseNum);
			if(sheet==null) {
				butSlip.Text=Lan.g(this,"New Slip");
			}
			else {
				butSlip.Text=Lan.g(this,"Edit Slip");
				butCancel.Enabled=false;//user can still click X to close window, but we do handle that as well.
			}
		}
Exemplo n.º 52
0
 private void OnLetter_Click()
 {
     FormSheetPicker FormS=new FormSheetPicker();
     FormS.SheetType=SheetTypeEnum.PatientLetter;
     FormS.ShowDialog();
     if(FormS.DialogResult!=DialogResult.OK){
         return;
     }
     SheetDef sheetDef=FormS.SelectedSheetDefs[0];
     Sheet sheet=SheetUtil.CreateSheet(sheetDef,CurPatNum);
     SheetParameter.SetParameter(sheet,"PatNum",CurPatNum);
     //SheetParameter.SetParameter(sheet,"ReferralNum",referral.ReferralNum);
     SheetFiller.FillFields(sheet);
     SheetUtil.CalculateHeights(sheet,this.CreateGraphics());
     FormSheetFillEdit FormSF=new FormSheetFillEdit(sheet);
     FormSF.ShowDialog();
     if(FormSF.DialogResult==DialogResult.OK) {
         RefreshCurrentModule();
     }
     //Patient pat=Patients.GetPat(CurPatNum);
     //FormLetters FormL=new FormLetters(pat);
     //FormL.ShowDialog();
 }
Exemplo n.º 53
0
        ///<summary>ProcCodes will be null unless trigger is CompleteProcedure.  This routine will generally fail silently.  Will return true if a trigger happened.</summary>
        public static bool Trigger(AutomationTrigger trigger, List <string> procCodes, long patNum)
        {
            if (patNum == 0)           //Could happen for OpenPatient trigger
            {
                return(false);
            }
            bool automationHappened = false;

            for (int i = 0; i < Automations.Listt.Count; i++)
            {
                if (Automations.Listt[i].Autotrigger != trigger)
                {
                    continue;
                }
                if (trigger == AutomationTrigger.CompleteProcedure)
                {
                    if (procCodes == null)
                    {
                        continue;                        //fail silently
                    }
                    bool     codeFound  = false;
                    string[] arrayCodes = Automations.Listt[i].ProcCodes.Split(',');
                    for (int p = 0; p < procCodes.Count; p++)
                    {
                        for (int a = 0; a < arrayCodes.Length; a++)
                        {
                            if (arrayCodes[a] == procCodes[p])
                            {
                                codeFound = true;
                                break;
                            }
                        }
                    }
                    if (!codeFound)
                    {
                        continue;
                    }
                }
                //matching automation item has been found
                //Get possible list of conditions that exist for this automation item
                List <AutomationCondition> autoConditionsList = AutomationConditions.GetListByAutomationNum(Automations.Listt[i].AutomationNum);
                if (Automations.Listt[i].AutoAction == AutomationAction.CreateCommlog)
                {
                    if (autoConditionsList.Count > 0)
                    {
                        if (!CheckAutomationConditions(autoConditionsList, patNum))
                        {
                            continue;
                        }
                    }
                    Commlog CommlogCur = new Commlog();
                    CommlogCur.PatNum       = patNum;
                    CommlogCur.CommDateTime = DateTime.Now;
                    CommlogCur.CommType     = Automations.Listt[i].CommType;
                    CommlogCur.Note         = Automations.Listt[i].MessageContent;
                    CommlogCur.Mode_        = CommItemMode.None;
                    CommlogCur.UserNum      = Security.CurUser.UserNum;
                    FormCommItem FormCI = new FormCommItem(CommlogCur);
                    FormCI.IsNew = true;
                    FormCI.ShowDialog();
                    automationHappened = true;
                }
                else if (Automations.Listt[i].AutoAction == AutomationAction.PopUp)
                {
                    if (autoConditionsList.Count > 0)
                    {
                        if (!CheckAutomationConditions(autoConditionsList, patNum))
                        {
                            continue;
                        }
                    }
                    MessageBox.Show(Automations.Listt[i].MessageContent);
                    automationHappened = true;
                }
                else if (Automations.Listt[i].AutoAction == AutomationAction.PrintPatientLetter)
                {
                    if (autoConditionsList.Count > 0)
                    {
                        if (!CheckAutomationConditions(autoConditionsList, patNum))
                        {
                            continue;
                        }
                    }
                    SheetDef sheetDef = SheetDefs.GetSheetDef(Automations.Listt[i].SheetDefNum);
                    Sheet    sheet    = SheetUtil.CreateSheet(sheetDef, patNum);
                    SheetParameter.SetParameter(sheet, "PatNum", patNum);
                    //SheetParameter.SetParameter(sheet,"ReferralNum",referral.ReferralNum);
                    SheetFiller.FillFields(sheet);
                    using (Bitmap bmp = new Bitmap(100, 100)) {                //a dummy bitmap for the graphics object
                        using (Graphics g = Graphics.FromImage(bmp)) {
                            SheetUtil.CalculateHeights(sheet, g);
                        }
                    }
                    FormSheetFillEdit FormSF = new FormSheetFillEdit(sheet);
                    FormSF.ShowDialog();
                    automationHappened = true;
                }
                else if (Automations.Listt[i].AutoAction == AutomationAction.PrintReferralLetter)
                {
                    if (autoConditionsList.Count > 0)
                    {
                        if (!CheckAutomationConditions(autoConditionsList, patNum))
                        {
                            continue;
                        }
                    }
                    long referralNum = RefAttaches.GetReferralNum(patNum);
                    if (referralNum == 0)
                    {
                        MsgBox.Show("Automations", "This patient has no referral source entered.");
                        automationHappened = true;
                        continue;
                    }
                    SheetDef sheetDef = SheetDefs.GetSheetDef(Automations.Listt[i].SheetDefNum);
                    Sheet    sheet    = SheetUtil.CreateSheet(sheetDef, patNum);
                    SheetParameter.SetParameter(sheet, "PatNum", patNum);
                    SheetParameter.SetParameter(sheet, "ReferralNum", referralNum);
                    SheetFiller.FillFields(sheet);
                    using (Bitmap bmp = new Bitmap(100, 100)) {                //a dummy bitmap for the graphics object
                        using (Graphics g = Graphics.FromImage(bmp)) {
                            SheetUtil.CalculateHeights(sheet, g);
                        }
                    }
                    FormSheetFillEdit FormSF = new FormSheetFillEdit(sheet);
                    FormSF.ShowDialog();
                    automationHappened = true;
                }
                else if (Automations.Listt[i].AutoAction == AutomationAction.ShowExamSheet)
                {
                    if (autoConditionsList.Count > 0)
                    {
                        if (!CheckAutomationConditions(autoConditionsList, patNum))
                        {
                            continue;
                        }
                    }
                    SheetDef sheetDef = SheetDefs.GetSheetDef(Automations.Listt[i].SheetDefNum);
                    Sheet    sheet    = SheetUtil.CreateSheet(sheetDef, patNum);
                    SheetParameter.SetParameter(sheet, "PatNum", patNum);
                    SheetFiller.FillFields(sheet);
                    using (Bitmap bmp = new Bitmap(100, 100)) {                //a dummy bitmap for the graphics object
                        using (Graphics g = Graphics.FromImage(bmp)) {
                            SheetUtil.CalculateHeights(sheet, g);
                        }
                    }
                    FormSheetFillEdit FormSF = new FormSheetFillEdit(sheet);
                    FormSF.ShowDialog();
                    automationHappened = true;
                }
            }
            return(automationHappened);
        }