Пример #1
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.
            }
        }
Пример #2
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();
         }
     }
 }
Пример #3
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;
            List <Sheet> listSheets = new List <Sheet>();         //for saving

            for (int i = 0; i < FormS.SelectedSheetDefs.Count; i++)
            {
                PdfDocument document        = new PdfDocument();
                PdfPage     page            = new PdfPage();
                string      filePathAndName = "";
                for (int j = 0; j < gridMain.SelectedIndices.Length; j++)
                {
                    sheetDef = FormS.SelectedSheetDefs[i];
                    sheet    = SheetUtil.CreateSheet(sheetDef, PIn.Long(((DataRow)gridMain.SelectedGridRows[j].Tag)["PatNum"].ToString()));
                    SheetParameter.SetParameter(sheet, "PatNum", PIn.Long(((DataRow)gridMain.SelectedGridRows[j].Tag)["PatNum"].ToString()));
                    SheetFiller.FillFields(sheet);
                    sheet.SheetFields.Sort(SheetFields.SortDrawingOrderLayers);
                    SheetUtil.CalculateHeights(sheet);
                    SheetPrinting.PagesPrinted = 0;                  //Clear out the pages printed variable before printing all pages for this pdf.
                    int pageCount = Sheets.CalculatePageCount(sheet, SheetPrinting.PrintMargin);
                    for (int k = 0; k < pageCount; k++)
                    {
                        page = document.AddPage();
                        SheetPrinting.CreatePdfPage(sheet, page, null);
                    }
                    listSheets.Add(sheet);
                }
                filePathAndName = PrefC.GetRandomTempFile(".pdf");
                document.Save(filePathAndName);
                if (ODBuild.IsWeb())
                {
                    ThinfinityUtils.HandleFile(filePathAndName);
                }
                else
                {
                    Process.Start(filePathAndName);
                }
                DialogResult = DialogResult.OK;
            }
            if (MsgBox.Show(this, MsgBoxButtons.YesNo, "Would you like to save the sheets for the selected patients?"))
            {
                Sheets.SaveNewSheetList(listSheets);
            }
        }
Пример #4
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            FormSheetPicker FormS = new FormSheetPicker();

            FormS.SheetType       = SheetTypeEnum.PatientForm;
            FormS.HideKioskButton = true;
            FormS.ShowDialog();
            if (FormS.DialogResult != DialogResult.OK)
            {
                return;
            }
            //Make sure each selected sheet contains FName, LName, and Birthdate.
            foreach (SheetDef selectedSheetDef in FormS.SelectedSheetDefs)             //There will always only be one
            {
                if (!WebFormL.VerifyRequiredFieldsPresent(selectedSheetDef))
                {
                    return;
                }
            }
            Cursor = Cursors.WaitCursor;
            foreach (SheetDef selectedSheetDef in FormS.SelectedSheetDefs)
            {
                WebFormL.LoadImagesToSheetDef(selectedSheetDef);
                WebFormL.TryAddOrUpdateSheetDef(this, selectedSheetDef, true);
            }
            FillGrid();
            Cursor = Cursors.Default;
        }
Пример #5
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            FormSheetPicker FormS = new FormSheetPicker();

            FormS.SheetType       = SheetTypeEnum.PatientForm;
            FormS.HideKioskButton = true;
            FormS.ShowDialog();
            if (FormS.DialogResult != DialogResult.OK)
            {
                return;
            }
            Cursor = Cursors.WaitCursor;
            if (!TestWebServiceExists())
            {
                Cursor = Cursors.Default;
                MsgBox.Show(this, "Either the web service is not available or the WebHostSynch URL is incorrect");
                return;
            }
            for (int i = 0; i < FormS.SelectedSheetDefs.Count; i++)
            {
                LoadImagesToSheetDef(FormS.SelectedSheetDefs[i]);
                wh.Timeout = 300000;               //for slow connections more timeout is provided. The  default is 100 seconds i.e 100000
                wh.UpLoadSheetDef(RegistrationKey, FormS.SelectedSheetDefs[i]);
            }
            FillGrid();
            Cursor = Cursors.Default;
        }
Пример #6
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            FormSheetPicker FormS = new FormSheetPicker();

            FormS.SheetType       = SheetTypeEnum.PatientForm;
            FormS.HideKioskButton = true;
            FormS.ShowDialog();
            if (FormS.DialogResult != DialogResult.OK)
            {
                return;
            }
            //Make sure each selected sheet contains FName, LName, and Birthdate.
            for (int i = 0; i < FormS.SelectedSheetDefs.Count; i++)       //There will always only be one
            {
                if (!WebFormL.VerifyRequiredFieldsPresent(FormS.SelectedSheetDefs[i]))
                {
                    return;
                }
            }
            Cursor = Cursors.WaitCursor;
            if (!TestWebServiceExists())
            {
                Cursor = Cursors.Default;
                MsgBox.Show(this, "Either the web service is not available or the WebHostSynch URL is incorrect");
                return;
            }
            for (int i = 0; i < FormS.SelectedSheetDefs.Count; i++)       //There will always only be one
            {
                WebFormL.LoadImagesToSheetDef(FormS.SelectedSheetDefs[i]);
                wh.Timeout = 300000;               //for slow connections more timeout is provided. The  default is 100 seconds i.e 100000
                wh.UpLoadSheetDef(RegistrationKey, FormS.SelectedSheetDefs[i]);
            }
            FillGrid();
            Cursor = Cursors.Default;
        }
Пример #7
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            FormSheetPicker FormS = new FormSheetPicker();

            FormS.SheetType       = SheetTypeEnum.PatientForm;
            FormS.HideKioskButton = true;
            FormS.ShowDialog();
            if (FormS.DialogResult != DialogResult.OK)
            {
                return;
            }
            //Make sure each selected sheet contains FName, LName, and Birthdate.
            for (int i = 0; i < FormS.SelectedSheetDefs.Count; i++)       //There will always only be one
            {
                bool hasFName     = false;
                bool hasLName     = false;
                bool hasBirthdate = false;
                for (int j = 0; j < FormS.SelectedSheetDefs[i].SheetFieldDefs.Count; j++)
                {
                    if (FormS.SelectedSheetDefs[i].SheetFieldDefs[j].FieldType != SheetFieldType.InputField)
                    {
                        continue;
                    }
                    if (FormS.SelectedSheetDefs[i].SheetFieldDefs[j].FieldName == "FName")
                    {
                        hasFName = true;
                    }
                    else if (FormS.SelectedSheetDefs[i].SheetFieldDefs[j].FieldName == "LName")
                    {
                        hasLName = true;
                    }
                    else if (FormS.SelectedSheetDefs[i].SheetFieldDefs[j].FieldName == "Birthdate")
                    {
                        hasBirthdate = true;
                    }
                }
                if (!hasFName || !hasLName || !hasBirthdate)
                {
                    MessageBox.Show(Lan.g(this, "The sheet called ") + "\"" + FormS.SelectedSheetDefs[i].Description + "\""
                                    + Lan.g(this, " does not contain all three required fields: LName, FName, and Birthdate."));
                    return;
                }
            }
            Cursor = Cursors.WaitCursor;
            if (!TestWebServiceExists())
            {
                Cursor = Cursors.Default;
                MsgBox.Show(this, "Either the web service is not available or the WebHostSynch URL is incorrect");
                return;
            }
            for (int i = 0; i < FormS.SelectedSheetDefs.Count; i++)       //There will always only be one
            {
                LoadImagesToSheetDef(FormS.SelectedSheetDefs[i]);
                wh.Timeout = 300000;               //for slow connections more timeout is provided. The  default is 100 seconds i.e 100000
                wh.UpLoadSheetDef(RegistrationKey, FormS.SelectedSheetDefs[i]);
            }
            FillGrid();
            Cursor = Cursors.Default;
        }
Пример #8
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);
            }
        }
Пример #9
0
        private void butUpdate_Click(object sender, EventArgs e)
        {
            if (gridMain.SelectedIndices.Length < 1)
            {
                MsgBox.Show(this, "Please select an item from the grid first.");
                return;
            }
            if (gridMain.SelectedIndices.Length > 1)
            {
                MsgBox.Show(this, "Please select one web form at a time.");
                return;
            }
            webforms_sheetdef wf_sheetDef = (webforms_sheetdef)gridMain.Rows[gridMain.SelectedIndices[0]].Tag;
            SheetDef          sheetDef    = SheetDefs.GetFirstOrDefault(x => x.SheetDefNum == wf_sheetDef.SheetDefNum);

            if (sheetDef == null)           //This web form has never had a SheetDefNum assigned or the sheet has been deleted.
            {
                MsgBox.Show(this, "This Web Form is not linked to a valid Sheet.  Please select the correct Sheet that this Web Form should be linked to.");
                FormSheetPicker FormS = new FormSheetPicker();
                FormS.SheetType       = SheetTypeEnum.PatientForm;
                FormS.HideKioskButton = true;
                FormS.ShowDialog();
                if (FormS.DialogResult != DialogResult.OK || FormS.SelectedSheetDefs.Count == 0)
                {
                    return;
                }
                sheetDef = FormS.SelectedSheetDefs.FirstOrDefault();
            }
            else              //sheetDef not null
            {
                SheetDefs.GetFieldsAndParameters(sheetDef);
            }
            if (!WebFormL.VerifyRequiredFieldsPresent(sheetDef))
            {
                return;
            }
            Cursor = Cursors.WaitCursor;
            if (!TestWebServiceExists())
            {
                Cursor = Cursors.Default;
                MsgBox.Show(this, "Either the web service is not available or the WebHostSynch URL is incorrect");
                return;
            }
            WebFormL.LoadImagesToSheetDef(sheetDef);
            wh.UpdateSheetDef(RegistrationKey, wf_sheetDef.WebSheetDefID, sheetDef);
            FillGrid();
            Cursor = Cursors.Default;
        }
Пример #10
0
        private void butUpdate_Click(object sender, EventArgs e)
        {
            if (gridMain.SelectedIndices.Length < 1)
            {
                MsgBox.Show(this, "Please select an item from the grid first.");
                return;
            }
            if (gridMain.SelectedIndices.Length > 1)
            {
                MsgBox.Show(this, "Please select one web form at a time.");
                return;
            }
            WebForms_SheetDef wf_sheetDef = gridMain.SelectedTag <WebForms_SheetDef>();
            SheetDef          sheetDef    = SheetDefs.GetFirstOrDefault(x => x.SheetDefNum == wf_sheetDef.SheetDefNum);

            if (sheetDef == null)           //This web form has never had a SheetDefNum assigned or the sheet has been deleted.
            {
                MsgBox.Show(this, "This Web Form is not linked to a valid Sheet.  Please select the correct Sheet that this Web Form should be linked to.");
                FormSheetPicker FormS = new FormSheetPicker();
                FormS.SheetType       = SheetTypeEnum.PatientForm;
                FormS.HideKioskButton = true;
                FormS.ShowDialog();
                if (FormS.DialogResult != DialogResult.OK || FormS.SelectedSheetDefs.Count == 0)
                {
                    return;
                }
                sheetDef = FormS.SelectedSheetDefs.FirstOrDefault();
            }
            else              //sheetDef not null
            {
                SheetDefs.GetFieldsAndParameters(sheetDef);
            }
            if (!WebFormL.VerifyRequiredFieldsPresent(sheetDef))
            {
                return;
            }
            Cursor = Cursors.WaitCursor;
            WebFormL.LoadImagesToSheetDef(sheetDef);
            WebFormL.TryAddOrUpdateSheetDef(this, sheetDef, false, new List <WebForms_SheetDef> {
                wf_sheetDef
            });
            FillGrid();
            Cursor = Cursors.Default;
        }
Пример #11
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();
                }
            }
        }
Пример #12
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;
            }
        }
Пример #13
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);
        }
Пример #14
0
 private void butAdd_Click(object sender,EventArgs e)
 {
     FormSheetPicker FormS=new FormSheetPicker();
     FormS.SheetType=SheetTypeEnum.PatientForm;
     FormS.HideKioskButton=true;
     FormS.ShowDialog();
     if(FormS.DialogResult!=DialogResult.OK) {
         return;
     }
     Cursor=Cursors.WaitCursor;
     if(!TestWebServiceExists()) {
         Cursor=Cursors.Default;
         MsgBox.Show(this,"Either the web service is not available or the WebHostSynch URL is incorrect");
         return;
     }
     for(int i=0;i<FormS.SelectedSheetDefs.Count;i++) {
         LoadImagesToSheetDef(FormS.SelectedSheetDefs[i]);
         wh.Timeout=300000; //for slow connections more timeout is provided. The  default is 100 seconds i.e 100000
         wh.UpLoadSheetDef(RegistrationKey,FormS.SelectedSheetDefs[i]);
     }
     FillGrid();
     Cursor=Cursors.Default;
 }
Пример #15
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();
 }
Пример #16
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();
     }
 }
Пример #17
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.
			}
		}
Пример #18
0
		private void butAdd_Click(object sender,EventArgs e) {
			FormSheetPicker FormS=new FormSheetPicker();
			FormS.SheetType=SheetTypeEnum.PatientForm;
			FormS.HideKioskButton=true;
			FormS.ShowDialog();
			if(FormS.DialogResult!=DialogResult.OK) {
				return;
			}
			//Make sure each selected sheet contains FName, LName, and Birthdate.
			for(int i=0;i<FormS.SelectedSheetDefs.Count;i++) {//There will always only be one
				bool hasFName=false;
				bool hasLName=false;
				bool hasBirthdate=false;
				for(int j=0;j<FormS.SelectedSheetDefs[i].SheetFieldDefs.Count;j++) {
					if(FormS.SelectedSheetDefs[i].SheetFieldDefs[j].FieldType!=SheetFieldType.InputField) {
						continue;
					}
					if(FormS.SelectedSheetDefs[i].SheetFieldDefs[j].FieldName=="FName") {
						hasFName=true;
					}
					else if(FormS.SelectedSheetDefs[i].SheetFieldDefs[j].FieldName=="LName") {
						hasLName=true;
					}
					else if(FormS.SelectedSheetDefs[i].SheetFieldDefs[j].FieldName=="Birthdate") {
						hasBirthdate=true;
					}
				}
				if(!hasFName || !hasLName || !hasBirthdate) {
					MessageBox.Show(Lan.g(this,"The sheet called ")+"\""+FormS.SelectedSheetDefs[i].Description+"\""
			      +Lan.g(this," does not contain all three required fields: LName, FName, and Birthdate."));
					return;
				}
			}
			Cursor=Cursors.WaitCursor;
			if(!TestWebServiceExists()) {
				Cursor=Cursors.Default;
				MsgBox.Show(this,"Either the web service is not available or the WebHostSynch URL is incorrect");
				return;
			}
			for(int i=0;i<FormS.SelectedSheetDefs.Count;i++) {//There will always only be one
				LoadImagesToSheetDef(FormS.SelectedSheetDefs[i]);
				wh.Timeout=300000; //for slow connections more timeout is provided. The  default is 100 seconds i.e 100000
				wh.UpLoadSheetDef(RegistrationKey,FormS.SelectedSheetDefs[i]);
			}
			FillGrid();
			Cursor=Cursors.Default;
		}
Пример #19
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;
     }
 }