Esempio n. 1
0
        ///<summary></summary>
        public static void PrintAppointment(long aptNum)
        {
            SheetDef        sheetDef;
            List <SheetDef> customSheetDefs = SheetDefs.GetCustomForType(SheetTypeEnum.LabelAppointment);

            if (customSheetDefs.Count == 0)
            {
                sheetDef = SheetsInternal.GetSheetDef(SheetInternalType.LabelAppointment);
            }
            else
            {
                sheetDef = customSheetDefs[0];
                SheetDefs.GetFieldsAndParameters(sheetDef);
            }
            Sheet sheet = SheetUtil.CreateSheet(sheetDef);

            SheetParameter.SetParameter(sheet, "AptNum", aptNum);
            SheetFiller.FillFields(sheet);
            try {
                SheetPrinting.Print(sheet);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
        private void PrintClickHelper(bool isPreviewMode)
        {
            Sheet sheet = SheetUtil.CreateSheet(SheetDefs.GetInternalOrCustom(SheetInternalType.ERA));

            SheetParameter.GetParamByName(sheet.Parameters, "ERA").ParamValue = _x835;         //Required param
            SheetFiller.FillFields(sheet);
            SheetPrinting.Print(sheet, isPreviewMode: isPreviewMode);
        }
Esempio n. 3
0
        public static void PrintPatientLFPatNum(long patNum)
        {
            SheetDef sheetDef = SheetsInternal.GetSheetDef(SheetInternalType.LabelPatientLFPatNum);
            Sheet    sheet    = SheetUtil.CreateSheet(sheetDef);

            SheetParameter.SetParameter(sheet, "PatNum", patNum);
            SheetFiller.FillFields(sheet);
            try {
                SheetPrinting.Print(sheet);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 4
0
        public static void PrintCustomPatient(long patNum, SheetDef sheetDef)
        {
            SheetDefs.GetFieldsAndParameters(sheetDef);
            Sheet sheet = SheetUtil.CreateSheet(sheetDef);

            SheetParameter.SetParameter(sheet, "PatNum", patNum);
            SheetFiller.FillFields(sheet);
            try {
                SheetPrinting.Print(sheet);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 5
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            Sheet sheet = SheetUtil.CreateSheet(SheetDefs.GetInternalOrCustom(SheetInternalType.ERA));
            X835  x835  = _x835.Copy();

            x835.ListClaimsPaid = new List <Hx835_Claim>()
            {
                _claimPaid
            };                                                                                      //Only print the current claim.
            SheetParameter.GetParamByName(sheet.Parameters, "ERA").ParamValue = x835;               //Required param
            SheetParameter.GetParamByName(sheet.Parameters, "IsSingleClaimPaid").ParamValue = true; //Value is null if not set
            SheetFiller.FillFields(sheet);
            SheetPrinting.Print(sheet, isPreviewMode: true);
        }
Esempio n. 6
0
        public static void PrintText(long patNum, string text)
        {
            SheetDef sheetDef = SheetsInternal.GetSheetDef(SheetInternalType.LabelText);
            Sheet    sheet    = SheetUtil.CreateSheet(sheetDef);

            SheetParameter.SetParameter(sheet, "PatNum", patNum);
            sheet.Parameters.Add(new SheetParameter(false, "text"));
            SheetParameter.SetParameter(sheet, "text", text);
            SheetFiller.FillFields(sheet);
            try {
                SheetPrinting.Print(sheet);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 7
0
        ///<summary></summary>
        public static void PrintPat(long patNum)
        {
            SheetDef sheetDef = SheetsInternal.GetSheetDef(SheetInternalType.LabelPatientMail);

            if (PrefC.GetLong(PrefName.LabelPatientDefaultSheetDefNum) != 0)           //Try to use custom label sheet.
            {
                try {
                    sheetDef = SheetDefs.GetSheetDef(PrefC.GetLong(PrefName.LabelPatientDefaultSheetDefNum));
                }
                catch {                //The default label could not be retrieved so just use the internal sheet.
                }
            }
            Sheet sheet = SheetUtil.CreateSheet(sheetDef);

            SheetParameter.SetParameter(sheet, "PatNum", patNum);
            SheetFiller.FillFields(sheet);
            try{
                SheetPrinting.Print(sheet);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 8
0
        ///<summary></summary>
        public static void PrintPat(long patNum)
        {
            SheetDef sheetDef;

            if (PrefC.GetLong(PrefName.LabelPatientDefaultSheetDefNum) == 0)
            {
                sheetDef = SheetsInternal.GetSheetDef(SheetInternalType.LabelPatientMail);
            }
            else
            {
                sheetDef = SheetDefs.GetSheetDef(PrefC.GetLong(PrefName.LabelPatientDefaultSheetDefNum));
            }
            Sheet sheet = SheetUtil.CreateSheet(sheetDef);

            SheetParameter.SetParameter(sheet, "PatNum", patNum);
            SheetFiller.FillFields(sheet);
            try{
                SheetPrinting.Print(sheet);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 9
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            if (!TryToSaveData())
            {
                return;
            }
            SheetCur = Sheets.GetSheet(SheetCur.SheetNum);
            //whether this is a new sheet, or one pulled from the database,
            //it will have the extra parameter we are looking for.
            //A new sheet will also have a PatNum parameter which we will ignore.
            FormSheetOutputFormat FormS = new FormSheetOutputFormat();

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

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

            if (patCur == null)
            {
                emailAddress = EmailAddresses.GetByClinic(0);
            }
            else
            {
                emailAddress = EmailAddresses.GetByClinic(patCur.ClinicNum);
            }
            //Graphics g=this.CreateGraphics();
            if (FormS.EmailPatOrLab)
            {
                fileName        = DateTime.Now.ToString("yyyyMMdd") + "_" + DateTime.Now.TimeOfDay.Ticks.ToString() + rnd.Next(1000).ToString() + ".pdf";
                filePathAndName = ODFileUtils.CombinePaths(attachPath, fileName);
                SheetPrinting.CreatePdf(SheetCur, filePathAndName);
                //Process.Start(filePathAndName);
                message             = new EmailMessage();
                message.PatNum      = SheetCur.PatNum;
                message.ToAddress   = FormS.EmailPatOrLabAddress;
                message.FromAddress = emailAddress.SenderAddress;              //Can be blank just as it could with the old pref.
                message.Subject     = SheetCur.Description.ToString();         //this could be improved
                EmailAttach attach        = new EmailAttach();
                string      shortFileName = Regex.Replace(SheetCur.Description.ToString(), @"[^\w'@-_()&]", "");
                attach.DisplayedFileName = shortFileName + ".pdf";
                attach.ActualFileName    = fileName;
                message.Attachments.Add(attach);
                FormEmailMessageEdit FormE = new FormEmailMessageEdit(message);
                FormE.IsNew = true;
                FormE.ShowDialog();
            }
            if ((SheetCur.SheetType == SheetTypeEnum.ReferralSlip ||
                 SheetCur.SheetType == SheetTypeEnum.ReferralLetter) &&
                FormS.Email2)
            {
                //email referral
                fileName        = DateTime.Now.ToString("yyyyMMdd") + "_" + DateTime.Now.TimeOfDay.Ticks.ToString() + rnd.Next(1000).ToString() + ".pdf";
                filePathAndName = ODFileUtils.CombinePaths(attachPath, fileName);
                SheetPrinting.CreatePdf(SheetCur, filePathAndName);
                //Process.Start(filePathAndName);
                message             = new EmailMessage();
                message.PatNum      = SheetCur.PatNum;
                message.ToAddress   = FormS.Email2Address;
                message.FromAddress = emailAddress.SenderAddress;                                         //Can be blank just as it could with the old pref.
                message.Subject     = Lan.g(this, "RE: ") + Patients.GetLim(SheetCur.PatNum).GetNameLF(); //works even if patnum invalid
                //SheetCur.Description.ToString()+" to "+Referrals.GetNameFL(referral.ReferralNum);//this could be improved
                EmailAttach attach        = new EmailAttach();
                string      shortFileName = Regex.Replace(SheetCur.Description.ToString(), @"[^\w,'@-_()&]", "");
                attach.DisplayedFileName = shortFileName + ".pdf";
                attach.ActualFileName    = fileName;
                message.Attachments.Add(attach);
                FormEmailMessageEdit FormE = new FormEmailMessageEdit(message);
                FormE.IsNew = true;
                FormE.ShowDialog();
            }
            //g.Dispose();
            DialogResult = DialogResult.OK;
        }
Esempio n. 10
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            if (!TryToSaveData())
            {
                return;
            }
            SheetCur = Sheets.GetSheet(SheetCur.SheetNum);
            //whether this is a new sheet, or one pulled from the database,
            //it will have the extra parameter we are looking for.
            //A new sheet will also have a PatNum parameter which we will ignore.
            FormSheetOutputFormat FormS = new FormSheetOutputFormat();

            if (SheetCur.SheetType == SheetTypeEnum.ReferralSlip ||
                SheetCur.SheetType == SheetTypeEnum.ReferralLetter)
            {
                FormS.PaperCopies = 2;
            }
            else
            {
                FormS.PaperCopies = 1;
            }
            if (SheetCur.PatNum != 0 &&
                SheetCur.SheetType != SheetTypeEnum.DepositSlip)
            {
                Patient pat = Patients.GetPat(SheetCur.PatNum);
                if (SheetCur.SheetType == SheetTypeEnum.LabSlip)
                {
                    FormS.IsForLab = true;                  //Changes label to "E-mail to Lab:"
                }
                else if (pat.Email != "")
                {
                    FormS.EmailPatOrLabAddress = pat.Email;
                    FormS.EmailPatOrLab        = true;
                    FormS.PaperCopies--;
                }
            }
            Referral referral = null;

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

            //Graphics g=this.CreateGraphics();
            if (FormS.EmailPatOrLab)
            {
                fileName        = DateTime.Now.ToString("yyyyMMdd") + "_" + DateTime.Now.TimeOfDay.Ticks.ToString() + rnd.Next(1000).ToString() + ".pdf";
                filePathAndName = ODFileUtils.CombinePaths(attachPath, fileName);
                SheetPrinting.CreatePdf(SheetCur, filePathAndName);
                //Process.Start(filePathAndName);
                message             = new EmailMessage();
                message.PatNum      = SheetCur.PatNum;
                message.ToAddress   = FormS.EmailPatOrLabAddress;
                message.FromAddress = PrefC.GetString(PrefName.EmailSenderAddress);
                message.Subject     = SheetCur.Description.ToString();          //this could be improved
                EmailAttach attach        = new EmailAttach();
                string      shortFileName = Regex.Replace(SheetCur.Description.ToString(), @"[^\w'@-_()&]", "");
                attach.DisplayedFileName = shortFileName + ".pdf";
                attach.ActualFileName    = fileName;
                message.Attachments.Add(attach);
                FormEmailMessageEdit FormE = new FormEmailMessageEdit(message);
                FormE.IsNew = true;
                FormE.ShowDialog();
            }
            if ((SheetCur.SheetType == SheetTypeEnum.ReferralSlip ||
                 SheetCur.SheetType == SheetTypeEnum.ReferralLetter) &&
                FormS.Email2)
            {
                //email referral
                fileName        = DateTime.Now.ToString("yyyyMMdd") + "_" + DateTime.Now.TimeOfDay.Ticks.ToString() + rnd.Next(1000).ToString() + ".pdf";
                filePathAndName = ODFileUtils.CombinePaths(attachPath, fileName);
                SheetPrinting.CreatePdf(SheetCur, filePathAndName);
                //Process.Start(filePathAndName);
                message             = new EmailMessage();
                message.PatNum      = SheetCur.PatNum;
                message.ToAddress   = FormS.Email2Address;
                message.FromAddress = PrefC.GetString(PrefName.EmailSenderAddress);
                message.Subject     = SheetCur.Description.ToString() + " to " + Referrals.GetNameFL(referral.ReferralNum);      //this could be improved
                EmailAttach attach        = new EmailAttach();
                string      shortFileName = Regex.Replace(SheetCur.Description.ToString(), @"[^\w,'@-_()&]", "");
                attach.DisplayedFileName = shortFileName + ".pdf";
                attach.ActualFileName    = fileName;
                message.Attachments.Add(attach);
                FormEmailMessageEdit FormE = new FormEmailMessageEdit(message);
                FormE.IsNew = true;
                FormE.ShowDialog();
            }
            //g.Dispose();
            DialogResult = DialogResult.OK;
        }
Esempio n. 11
0
        private void FormTPsign_Load(object sender, System.EventArgs e)
        {
            //this window never comes up for new TP.  Always saved ahead of time.
            if (!Security.IsAuthorized(Permissions.TreatPlanSign, TPcur.DateTP))
            {
                butOK.Enabled = false;
                signatureBoxWrapper.Enabled         = false;
                signatureBoxWrapperPractice.Enabled = false;
                textTypeSig.Enabled         = false;
                textTypeSigPractice.Enabled = false;
            }
            _hasSigPractice = (SheetTP == null ? false : (SheetTP.SheetFields.Any(x => x.FieldType == SheetFieldType.SigBoxPractice) && DoPrintUsingSheets));
            LayoutToolBar();
            ToolBarMain.Buttons["FullPage"].Pushed = true;
            previewContr.Location = new Point(0, ToolBarMain.Bottom);
            previewContr.Size     = new Size(ClientRectangle.Width, ClientRectangle.Height - ToolBarMain.Height - panelSig.Height);
            if (Document == null)           //Only set when not pringing using sheets, shet via a MigraDoc.
            //TODO:Implement ODprintout pattern - MigraDoc
            //Just signing the TP, there is no way to print a Treat' Plan from the Sign TP window so suppress the printer dialogs.
            //Users will click the Print TP button from the Treat' Plan module when they want to print.
            {
                PrinterL.ControlPreviewOverride = previewContr;              //Sets the printdoc to previewContr.Document after validation. Otherwise shows error.
                SheetPrinting.Print(SheetTP, isPrintDocument: false, isPreviewMode: true);
                if (ODprintout.CurPrintout.SettingsErrorCode != PrintoutErrorCode.Success)
                {
                    DialogResult = DialogResult.Cancel;
                    return;
                }
                Document = ODprintout.CurPrintout.PrintDoc;
            }
            else              //MigraDoc
            {
                if (Document.DefaultPageSettings.PrintableArea.Height == 0)
                {
                    Document.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
                }
                previewContr.Document = Document;
            }
            SetSize();
            ToolBarMain.Buttons["PageNum"].Text = (previewContr.StartPage + 1).ToString()
                                                  + " / " + TotalPages.ToString();
            proctpList = ProcTPs.RefreshForTP(TPcur.TreatPlanNum);
            //Fill TP signature
            signatureBoxWrapper.SignatureMode = UI.SignatureBoxWrapper.SigMode.TreatPlan;
            string keyData = TreatPlans.GetKeyDataForSignatureHash(TPcur, proctpList);

            signatureBoxWrapper.FillSignature(TPcur.SigIsTopaz, keyData, TPcur.Signature);
            SheetField sheetField;

            if (SheetTP != null)
            {
                sheetField = SheetTP.SheetFields.FirstOrDefault(x => x.FieldType == SheetFieldType.SigBox);
                if (sheetField != null && !string.IsNullOrEmpty(sheetField.FieldName))
                {
                    labelSig.Text = $"{sheetField.FieldName} sign here --->";
                }
                sheetField = SheetTP.GetSheetFieldByName("SignatureText");
                if (sheetField != null)
                {
                    textTypeSig.Text     = TPcur.SignatureText;
                    labelTypeSig.Visible = true;
                    textTypeSig.Visible  = true;
                }
            }
            //Fill TP practice signature if printing using sheets
            if (_hasSigPractice)
            {
                signatureBoxWrapperPractice.Visible       = true;
                labelSigPractice.Visible                  = true;
                signatureBoxWrapperPractice.SignatureMode = UI.SignatureBoxWrapper.SigMode.TreatPlan;
                signatureBoxWrapperPractice.FillSignature(TPcur.SigIsTopaz, keyData, TPcur.SignaturePractice);
                sheetField = SheetTP.SheetFields.FirstOrDefault(x => x.FieldType == SheetFieldType.SigBoxPractice);
                if (sheetField != null && !string.IsNullOrEmpty(sheetField.FieldName))
                {
                    labelSigPractice.Text = $"{sheetField.FieldName} sign here --->";
                }
                sheetField = SheetTP.GetSheetFieldByName("SignaturePracticeText");
                if (sheetField != null)
                {
                    textTypeSigPractice.Text     = TPcur.SignaturePracticeText;
                    labelTypeSigPractice.Visible = true;                  //defaulted to be hidden
                    textTypeSigPractice.Visible  = true;
                }
            }
        }