Ejemplo n.º 1
0
        private void PrintPatientInfo()
        {
            PrintDocument pd = new PrintDocument();

            pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
            pd.DefaultPageSettings.Margins = new Margins(25, 25, 40, 40);
            if (pd.DefaultPageSettings.PrintableArea.Height == 0)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
            }
            try {
                                #if DEBUG
                FormRpPrintPreview pView = new FormRpPrintPreview();
                pView.printPreviewControl2.Document = pd;
                pView.ShowDialog();
                                #else
                if (PrinterL.SetPrinter(pd, PrintSituation.Default, _patCur.PatNum, "Patient portal login information printed"))
                {
                    pd.Print();
                }
                                #endif
            }
            catch {
                MessageBox.Show(Lan.g(this, "Printer not available"));
            }
        }
Ejemplo n.º 2
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            //only visible in Message mode.
            pagesPrinted = 0;
            PrintDocument pd = new PrintDocument();

            pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
            pd.DefaultPageSettings.Margins = new Margins(25, 25, 40, 80);
            //pd.OriginAtMargins=true;
            if (pd.DefaultPageSettings.PrintableArea.Height == 0)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
            }
            headingPrinted = false;
            try {
                                #if DEBUG
                FormRpPrintPreview pView = new FormRpPrintPreview();
                pView.printPreviewControl2.Document = pd;
                pView.ShowDialog();
                                #else
                if (PrinterL.SetPrinter(pd, PrintSituation.Default, EtransCur.PatNum, "Electronic benefit request from " + EtransCur.DateTimeTrans.ToShortDateString() + " printed"))
                {
                    pd.Print();
                }
                                #endif
            }
            catch {
                MessageBox.Show(Lan.g(this, "Printer not available"));
            }
        }
Ejemplo n.º 3
0
 ///<summary>Preview is only used for debugging.</summary>
 public void PrintReport(bool justPreview)
 {
     pd2            = new PrintDocument();
     pd2.PrintPage += new PrintPageEventHandler(this.pd2_PrintPage);
     pd2.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
     pd2.OriginAtMargins             = true;
     if (pd2.DefaultPageSettings.PrintableArea.Height == 0)
     {
         pd2.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
     }
     isPrinting = true;
     FillGrid();
     try {
         if (justPreview)
         {
             FormRpPrintPreview pView = new FormRpPrintPreview();
             pView.printPreviewControl2.Document = pd2;
             pView.ShowDialog();
         }
         else
         {
             if (PrinterL.SetPrinter(pd2, PrintSituation.Default))
             {
                 pd2.Print();
             }
         }
     }
     catch {
         MessageBox.Show(Lan.g(this, "Printer not available"));
     }
     isPrinting = false;
     FillGrid();
 }
Ejemplo n.º 4
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            _pagesPrinted = 0;
            PrintDocument pd = new PrintDocument();

            pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
            pd.DefaultPageSettings.Margins = new Margins(25, 25, 40, 40);
            if (pd.DefaultPageSettings.PrintableArea.Height == 0)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
            }
            if (gridMain.WidthAllColumns > 800)
            {
                //a new feature will need to be implemented to handle when columns widths are greater than 1050
                pd.DefaultPageSettings.Landscape = true;
            }
            _headingPrinted = false;
            try {
#if DEBUG
                FormRpPrintPreview pView = new FormRpPrintPreview();
                pView.printPreviewControl2.Document = pd;
                pView.ShowDialog();
#else
                if (PrinterL.SetPrinter(pd, PrintSituation.Default, 0, "Ortho chart printed"))
                {
                    pd.Print();
                }
#endif
            }
            catch {
                MessageBox.Show(Lan.g(this, "Printer not available"));
            }
        }
Ejemplo n.º 5
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            _pagesPrinted = 0;
            PrintDocument pd = new PrintDocument();

            pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
            pd.DefaultPageSettings.Margins   = new Margins(25, 25, 40, 40);
            pd.DefaultPageSettings.Landscape = true;
            if (pd.DefaultPageSettings.PrintableArea.Height == 0)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
            }
            _headingPrinted = false;
            try {
#if DEBUG
                FormRpPrintPreview pView = new FormRpPrintPreview();
                pView.printPreviewControl2.Document = pd;
                pView.ShowDialog();
#else
                if (PrinterL.SetPrinter(pd, PrintSituation.Default, 0, "Incomplete Procedure Notes report printed"))
                {
                    pd.Print();
                }
#endif
            }
            catch (Exception ex) {
                FriendlyException.Show(Lan.g(this, "Printer not available"), ex);
            }
        }
Ejemplo n.º 6
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            pagesPrinted = 0;
            PrintDocument pd = new PrintDocument();

            pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
            pd.DefaultPageSettings.Margins = new Margins(25, 25, 40, 40);
            //pd.OriginAtMargins=true;
            pd.DefaultPageSettings.Landscape = false;
            if (pd.DefaultPageSettings.PrintableArea.Height == 0)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
            }
            headingPrinted = false;
            try {
                                #if DEBUG
                FormRpPrintPreview pView = new FormRpPrintPreview();
                pView.printPreviewControl2.Document = pd;
                pView.ShowDialog();
                                #else
                if (PrinterL.SetPrinter(pd, PrintSituation.Default, 0, "Referred procedure tracking list printed"))
                {
                    pd.Print();
                }
                                #endif
            }
            catch {
                MessageBox.Show(Lan.g(this, "Printer not available"));
            }
        }
Ejemplo n.º 7
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            if (_tableOrderItems.Rows.Count < 1)
            {
                MsgBox.Show(this, "Supply list is Empty.");
                return;
            }
            _pagesPrinted   = 0;
            _headingPrinted = false;
            _pd2            = new PrintDocument();
            _pd2.DefaultPageSettings.Margins = new Margins(50, 50, 40, 30);
            _pd2.PrintPage += new PrintPageEventHandler(pd2_PrintPage);
            if (_pd2.DefaultPageSettings.PrintableArea.Height == 0)
            {
                _pd2.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
            }
#if DEBUG
            FormRpPrintPreview pView = new FormRpPrintPreview();
            pView.printPreviewControl2.Document = _pd2;
            pView.ShowDialog();
#else
            if (PrinterL.SetPrinter(_pd2, PrintSituation.Default, 0, "Supplies order from " + _listOrders[gridOrders.GetSelectedIndex()].DatePlaced.ToShortDateString() + " printed"))
            {
                try{
                    _pd2.Print();
                }
                catch {
                    MsgBox.Show(this, "Printer not available");
                }
            }
#endif
        }
Ejemplo n.º 8
0
 private void butPrint_Click(object sender, EventArgs e)
 {
     pagesPrinted  = 0;
     pd            = new PrintDocument();
     pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
     pd.DefaultPageSettings.Margins = new Margins(25, 25, 40, 40);
     //pd.OriginAtMargins=true;
     pd.DefaultPageSettings.Landscape = true;
     if (pd.DefaultPageSettings.PrintableArea.Height == 0)
     {
         pd.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
     }
     headingPrinted = false;
                 #if DEBUG
     FormPrintPreview printPreview = new FormPrintPreview(PrintSituation.Default, pd, 1, 0, "Audit trail printed");
     printPreview.ShowDialog();
                 #else
     try {
         if (PrinterL.SetPrinter(pd, PrintSituation.Default, 0, "Audit trail printed"))
         {
             pd.Print();
         }
     }
     catch {
         MessageBox.Show(Lan.g(this, "Printer not available"));
     }
                 #endif
 }
Ejemplo n.º 9
0
 private void butPrint_Click(object sender, EventArgs e)
 {
     pagesPrinted  = 0;
     pd            = new PrintDocument();
     pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
     pd.DefaultPageSettings.Margins = new Margins(25, 25, 40, 40);
     //pd.OriginAtMargins=true;
     if (pd.DefaultPageSettings.PrintableArea.Height == 0)
     {
         pd.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
     }
     headingPrinted = false;
                 #if DEBUG
     FormRpPrintPreview pView = new FormRpPrintPreview();
     pView.printPreviewControl2.Document = pd;
     pView.ShowDialog();
                 #else
     if (!PrinterL.SetPrinter(pd, PrintSituation.Default))
     {
         return;
     }
     try{
         pd.Print();
     }
     catch {
         MsgBox.Show(this, "Printer not available");
     }
                 #endif
 }
Ejemplo n.º 10
0
        //Copied from FormRpOutstandingIns.cs
        private void butPrint_Click(object sender, EventArgs e)
        {
            _pagesPrinted = 0;
            PrintDocument pd = new PrintDocument();

            pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
            pd.DefaultPageSettings.Margins = new Margins(25, 25, 40, 40);
            //pd.DefaultPageSettings.Landscape=!checkIgnoreCustom.Checked;//If we are including custom tracking, print in landscape mode.
            if (pd.DefaultPageSettings.PrintableArea.Height == 0)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
            }
            _headingPrinted = false;
            try {
#if DEBUG
                FormRpPrintPreview pView = new FormRpPrintPreview();
                pView.printPreviewControl2.Document = pd;
                pView.ShowDialog();
#else
                if (PrinterL.SetPrinter(pd, PrintSituation.Default, 0, "Outstanding insurance report printed"))
                {
                    pd.Print();
                }
#endif
            }
            catch {
                MessageBox.Show(Lan.g(this, "Printer not available"));
            }
        }
Ejemplo n.º 11
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            _pagesPrintedCount = 0;
            PrintDocument pd = new PrintDocument();

            pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
            pd.DefaultPageSettings.Margins = new Margins(25, 25, 50, 50);
            //pd.OriginAtMargins=true;
            pd.DefaultPageSettings.Landscape = false;
            if (pd.DefaultPageSettings.PrintableArea.Height == 0)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
            }
            _isHeadingPrinted = false;
            try {
#if DEBUG
                FormRpPrintPreview formPreview = new FormRpPrintPreview();
                formPreview.printPreviewControl2.Document = pd;
                formPreview.ShowDialog();
#else
                if (PrinterL.SetPrinter(pd, PrintSituation.Default, 0, "Electronic remittance advice (ERA) printed"))
                {
                    pd.Print();
                }
#endif
            }
            catch {
                MessageBox.Show(Lan.g(this, "Printer not available"));
            }
        }
Ejemplo n.º 12
0
        private void Print_Click()
        {
            PrintDocument pd = new PrintDocument();

            pd.DocumentName                  = viewer.SourceFile;
            pd.PrinterSettings.FromPage      = 1;
            pd.PrinterSettings.ToPage        = viewer.PageCount;
            pd.PrinterSettings.MaximumPage   = viewer.PageCount;
            pd.PrinterSettings.MinimumPage   = 1;
            pd.DefaultPageSettings.Landscape = viewer.PageWidth > viewer.PageHeight;
            pd.DefaultPageSettings.Margins   = new Margins(50, 50, 50, 50);     //Half-inch all around.
            //This prevents a bug caused by some printer drivers not reporting their papersize.
            //But remember that other countries use A4 paper instead of 8 1/2 x 11.
            if (pd.DefaultPageSettings.PrintableArea.Height == 0)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
            }
            try{
                if (PrinterL.SetPrinter(pd, PrintSituation.Default))
                {
                    if (pd.PrinterSettings.PrintRange == PrintRange.Selection)
                    {
                        pd.PrinterSettings.FromPage = viewer.PageCurrent;
                    }
                    viewer.Print(pd);
                }
            }
            catch {
                MessageBox.Show(Lan.g(this, "Printer not available"));
            }
        }
Ejemplo n.º 13
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            PrintDocument pd = new PrintDocument();

            pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
            pd.DefaultPageSettings.Margins = new Margins(25, 25, 40, 40);
            //pd.OriginAtMargins=true;
            if (pd.DefaultPageSettings.PrintableArea.Height == 0)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
            }
                        #if DEBUG
            FormRpPrintPreview pView = new FormRpPrintPreview();
            pView.printPreviewControl2.Document = pd;
            pView.ShowDialog();
                        #else
            if (!PrinterL.SetPrinter(pd, PrintSituation.Default, 0, "Printed patient list from EHR"))
            {
                return;
            }
            try{
                pd.Print();
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
#endif
        }
Ejemplo n.º 14
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            if (gridMain.Rows.Count < 1)
            {
                MsgBox.Show(this, "Supply list is Empty.");
                return;
            }
            pagesPrinted   = 0;
            headingPrinted = false;
            pd2            = new PrintDocument();
            pd2.DefaultPageSettings.Margins = new Margins(50, 50, 40, 30);
            pd2.PrintPage += new PrintPageEventHandler(pd2_PrintPage);
            if (pd2.DefaultPageSettings.PrintableArea.Height == 0)
            {
                pd2.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
            }
#if DEBUG
            FormRpPrintPreview pView = new FormRpPrintPreview();
            pView.printPreviewControl2.Document = pd2;
            pView.ShowDialog();
#else
            if (PrinterL.SetPrinter(pd2, PrintSituation.Default, 0, "Supplies list printed"))
            {
                try{
                    pd2.Print();
                }
                catch {
                    MsgBox.Show(this, "Printer not available");
                }
            }
#endif
        }
Ejemplo n.º 15
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            PrintDocument pd = new PrintDocument();          //TODO: Implement ODprintout pattern - MigraDoc

            if (!PrinterL.SetPrinter(pd, PrintSituation.Default, 0, "Reconcile list printed"))
            {
                return;                //User cancelled.
            }
            pd.DefaultPageSettings.Margins = new Margins(25, 25, 40, 40);
            if (pd.DefaultPageSettings.PrintableArea.Height == 0)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
            }
            MigraDoc.DocumentObjectModel.Document             doc      = CreatePrintDocument(pd);
            MigraDoc.Rendering.Printing.MigraDocPrintDocument printdoc = new MigraDoc.Rendering.Printing.MigraDocPrintDocument();
            MigraDoc.Rendering.DocumentRenderer renderer = new MigraDoc.Rendering.DocumentRenderer(doc);
            renderer.PrepareDocument();
            printdoc.PrinterSettings = pd.PrinterSettings;
            printdoc.Renderer        = renderer;
#if DEBUG
            FormRpPrintPreview pView = new FormRpPrintPreview(printdoc);
            pView.ShowDialog();
#else
            printdoc.Print();
#endif
        }
Ejemplo n.º 16
0
 private void butPrint_Click(object sender, EventArgs e)
 {
     pd2            = new PrintDocument();
     pd2.PrintPage += new PrintPageEventHandler(this.pd2_PrintPage);
     pd2.DefaultPageSettings.Margins = new Margins(75, 75, 50, 100);
     if (pd2.DefaultPageSettings.PrintableArea.Height == 0)
     {
         pd2.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
     }
     linesPrinted = 0;
     try {
                         #if DEBUG
         FormRpPrintPreview pView = new FormRpPrintPreview();
         pView.printPreviewControl2.Document = pd2;
         pView.ShowDialog();
                         #else
         if (PrinterL.SetPrinter(pd2, PrintSituation.Default, EtransCur.PatNum, "Etrans message text from " + EtransCur.DateTimeTrans.ToShortDateString() + " printed"))
         {
             pd2.Print();
         }
                         #endif
     }
     catch {
         MessageBox.Show(Lan.g(this, "Printer not available"));
     }
     EtransCur.Note = Lan.g(this, "Printed") + textNote.Text;
     Etranss.Update(EtransCur);
     DialogResult = DialogResult.OK;
 }
Ejemplo n.º 17
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            PrintDocument pd = new PrintDocument();

            pd.PrintPage += new PrintPageEventHandler(this.pd2_PrintPage);
            if (PrinterL.SetPrinter(pd, PrintSituation.Default, 0, "Employee time graph printed"))
            {
                pd.Print();
            }
        }
Ejemplo n.º 18
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            PrintDocument pd2 = new PrintDocument();

            pd2.PrintPage                  += new PrintPageEventHandler(this.pd2_PrintPage);
            pd2.OriginAtMargins             = true;
            pd2.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
            if (!PrinterL.SetPrinter(pd2, PrintSituation.TPPerio, PatCur.PatNum, "Graphical perio chart printed"))
            {
                return;
            }
            pd2.Print();
        }
Ejemplo n.º 19
0
        ///<summary>Surround with try/catch.</summary>
        public static void PrintBatch(List <Sheet> sheetBatch)
        {
            //currently no validation for parameters in a batch because of the way it was created.
            //could validate field names here later.
            SheetList     = sheetBatch;
            sheetsPrinted = 0;
            PrintDocument pd = new PrintDocument();

            pd.OriginAtMargins = true;
            pd.PrintPage      += new PrintPageEventHandler(pd_PrintPage);
            if (sheetBatch[0].Width > 0 && sheetBatch[0].Height > 0)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("Default", sheetBatch[0].Width, sheetBatch[0].Height);
            }
            PrintSituation sit = PrintSituation.Default;

            pd.DefaultPageSettings.Landscape = sheetBatch[0].IsLandscape;
            switch (sheetBatch[0].SheetType)
            {
            case SheetTypeEnum.LabelPatient:
            case SheetTypeEnum.LabelCarrier:
            case SheetTypeEnum.LabelReferral:
                sit = PrintSituation.LabelSingle;
                break;

            case SheetTypeEnum.ReferralSlip:
                sit = PrintSituation.Default;
                break;
            }
            //later: add a check here for print preview.
                        #if DEBUG
            pd.DefaultPageSettings.Margins = new Margins(20, 20, 0, 0);
            FormPrintPreview printPreview = new FormPrintPreview(sit, pd, SheetList.Count, 0, "Batch of " + sheetBatch[0].Description + " printed");
            printPreview.ShowDialog();
                        #else
            try {
                if (!PrinterL.SetPrinter(pd, sit, 0, "Batch of " + sheetBatch[0].Description + " printed"))
                {
                    return;
                }
                pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
                pd.Print();
            }
            catch (Exception ex) {
                throw ex;
                //MessageBox.Show(Lan.g("Sheet","Printer not available"));
            }
                        #endif
        }
Ejemplo n.º 20
0
 private void butPrint_Click(object sender, EventArgs e)
 {
     if (tabControl.SelectedIndex == 1 && gridOrder.GetSelectedIndex() == -1)
     {
         MsgBox.Show(this, "Please select an order first.");
         return;
     }
     if (tabControl.SelectedIndex == 0 && gridSupplyMain.Rows.Count == 0)
     {
         MsgBox.Show(this, "The list is empty.");
         return;
     }
     pagesPrinted   = 0;
     headingPrinted = false;
     pd2            = new PrintDocument();
     pd2.DefaultPageSettings.Margins = new Margins(50, 50, 40, 30);
     if (tabControl.SelectedIndex == 0)          //main list
     {
         pd2.PrintPage += new PrintPageEventHandler(pd2_PrintPageMain);
     }
     else             //one order
     {
         pd2.PrintPage += new PrintPageEventHandler(pd2_PrintPageOrder);
     }
     if (pd2.DefaultPageSettings.PrintableArea.Height == 0)
     {
         pd2.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
     }
                 #if DEBUG
     FormRpPrintPreview pView = new FormRpPrintPreview();
     pView.printPreviewControl2.Document = pd2;
     pView.ShowDialog();
                 #else
     if (PrinterL.SetPrinter(pd2, PrintSituation.Default))
     {
         try{
             pd2.Print();
         }
         catch {
             MsgBox.Show(this, "Printer not available");
         }
     }
                 #endif
 }
Ejemplo n.º 21
0
        ///<summary></summary>
        public void PrintReport(bool justPreview)
        {
            pd2            = new PrintDocument();
            pd2.PrintPage += new PrintPageEventHandler(this.pd2_PrintPage);
//			pd2.DefaultPageSettings.Margins= new Margins(10,40,40,60);
            try {
                if (justPreview)
                {
                    printPreviewControl2.Document = pd2;
                }
                else if (PrinterL.SetPrinter(pd2, PrintSituation.Default, 0, "Print screen printed"))
                {
                    pd2.Print();
                }
            }
            catch {
                MessageBox.Show(Lan.g(this, "Printer not available"));
            }
        }
Ejemplo n.º 22
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            MigraDoc.DocumentObjectModel.Document             doc      = CreatePrintDocument();
            MigraDoc.Rendering.Printing.MigraDocPrintDocument printdoc = new MigraDoc.Rendering.Printing.MigraDocPrintDocument();
            MigraDoc.Rendering.DocumentRenderer renderer = new MigraDoc.Rendering.DocumentRenderer(doc);
            renderer.PrepareDocument();
            printdoc.Renderer = renderer;
#if DEBUG
            FormRpPrintPreview pView = new FormRpPrintPreview();
            pView.printPreviewControl2.Document = printdoc;
            pView.ShowDialog();
#else
            //Always prints to the Windows default printer.
            if (PrinterL.SetPrinter(pd2, PrintSituation.Default, 0, "Reconcile list printed"))
            {
                printdoc.Print();
            }
#endif
        }
Ejemplo n.º 23
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            if (textOnlineLink.Text == "")
            {
                MsgBox.Show(this, "Online Access Link required. Please press Get Link.");
                return;
            }
            if (textOnlinePassword.Text == "")
            {
                MessageBox.Show("Password required. Please generate a new password.");
                return;
            }
            if (!PasswordIsValid())             //this gives a messagebox if invalid
            {
                return;
            }
            //Then, print the info that the patient will be given in order for them to log in online.
            PrintDocument pd = new PrintDocument();

            pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
            pd.DefaultPageSettings.Margins = new Margins(25, 25, 40, 40);
            if (pd.DefaultPageSettings.PrintableArea.Height == 0)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
            }
            try {
                                #if !DEBUG
                FormRpPrintPreview pView = new FormRpPrintPreview();
                pView.printPreviewControl2.Document = pd;
                pView.ShowDialog();
                                #else
                if (PrinterL.SetPrinter(pd, PrintSituation.Default))
                {
                    pd.Print();
                }
                                #endif
            }
            catch {
                MessageBox.Show(Lan.g(this, "Printer not available"));
            }
        }
Ejemplo n.º 24
0
 private void OnPrint_Click()
 {
     if (!PrinterL.SetPrinter(Document, PrintSituation.TPPerio))
     {
         return;
     }
     if (Document.OriginAtMargins)
     {
         //In the sheets framework,we had to set margins to 20 because of a bug in their preview control.
         //We now need to set it back to 0 for the actual printing.
         //Hopefully, this doesn't break anything else.
         Document.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
     }
     try{
         Document.Print();
     }
     catch (Exception e) {
         MessageBox.Show(Lan.g(this, "Error: ") + e.Message);
     }
     DialogResult = DialogResult.OK;
 }
Ejemplo n.º 25
0
        private void PrintReceipt(string receiptStr)
        {
            string[] receiptLines = receiptStr.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
            MigraDoc.DocumentObjectModel.Document doc = new MigraDoc.DocumentObjectModel.Document();
            doc.DefaultPageSetup.PageWidth   = Unit.FromInch(3.0);
            doc.DefaultPageSetup.PageHeight  = Unit.FromInch(0.181 * receiptLines.Length + 0.56);     //enough to print receipt text plus 9/16 inch (0.56) extra space at bottom.
            doc.DefaultPageSetup.TopMargin   = Unit.FromInch(0.25);
            doc.DefaultPageSetup.LeftMargin  = Unit.FromInch(0.25);
            doc.DefaultPageSetup.RightMargin = Unit.FromInch(0.25);
            MigraDoc.DocumentObjectModel.Font bodyFontx = MigraDocHelper.CreateFont(8, false);
            bodyFontx.Name = FontFamily.GenericMonospace.Name;
            MigraDoc.DocumentObjectModel.Section section = doc.AddSection();
            Paragraph       par       = section.AddParagraph();
            ParagraphFormat parformat = new ParagraphFormat();

            parformat.Alignment = ParagraphAlignment.Left;
            parformat.Font      = bodyFontx;
            par.Format          = parformat;
            par.AddFormattedText(receiptStr, bodyFontx);
            MigraDoc.Rendering.Printing.MigraDocPrintDocument printdoc = new MigraDoc.Rendering.Printing.MigraDocPrintDocument();
            MigraDoc.Rendering.DocumentRenderer renderer = new MigraDoc.Rendering.DocumentRenderer(doc);
            renderer.PrepareDocument();
            printdoc.Renderer = renderer;
            //TODO: Implement ODprintout pattern - MigraDoc
#if DEBUG
            FormRpPrintPreview pView = new FormRpPrintPreview(printdoc);
            pView.ShowDialog();
#else
            try {
                if (PrinterL.SetPrinter(pd2, PrintSituation.Receipt, _patCur.PatNum, "PaySimple receipt printed"))
                {
                    printdoc.PrinterSettings = pd2.PrinterSettings;
                    printdoc.Print();
                }
            }
            catch (Exception ex) {
                MessageBox.Show(Lan.g(this, "Printer not available.") + "\r\n" + Lan.g(this, "Original error") + ": " + ex.Message);
            }
#endif
        }
Ejemplo n.º 26
0
 private void OnPrint_Click()
 {
     //TODO: Implement ODprintout pattern
     if (!PrinterL.SetPrinter(Document, PrintSituation.TPPerio, TPcur.PatNum, "Signed treatment plan from " + TPcur.DateTP.ToShortDateString() + " printed"))
     {
         return;
     }
     if (Document.OriginAtMargins)
     {
         //In the sheets framework,we had to set margins to 20 because of a bug in their preview control.
         //We now need to set it back to 0 for the actual printing.
         //Hopefully, this doesn't break anything else.
         Document.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
     }
     try{
         Document.Print();
     }
     catch (Exception e) {
         MessageBox.Show(Lan.g(this, "Error: ") + e.Message);
     }
     DialogResult = DialogResult.OK;
 }
Ejemplo n.º 27
0
 ///<summary>Preview is only used for debugging.</summary>
 public void PrintReport(bool justPreview)
 {
     pd2            = new PrintDocument();
     pd2.PrintPage += new PrintPageEventHandler(this.pd2_PrintPage);
     pd2.DefaultPageSettings.Margins = new Margins(25, 25, 40, 40);
     if (gridMain.WidthAllColumns > 800)
     {
         pd2.DefaultPageSettings.Landscape = true;
     }
     //pd2.DefaultPageSettings.Margins=new Margins(0,0,0,0);
     //pd2.OriginAtMargins=true;
     if (pd2.DefaultPageSettings.PrintableArea.Height == 0)
     {
         pd2.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
     }
     isPrinting = true;
     FillGrid();
     try {
         if (justPreview)
         {
             FormRpPrintPreview pView = new FormRpPrintPreview();
             pView.printPreviewControl2.Document = pd2;
             pView.ShowDialog();
         }
         else
         {
             if (PrinterL.SetPrinter(pd2, PrintSituation.Default, 0, "Accounting transaction history for " + _acctCur.Description + " printed"))
             {
                 pd2.Print();
             }
         }
     }
     catch {
         MessageBox.Show(Lan.g(this, "Printer not available"));
     }
     isPrinting = false;
     FillGrid();
 }
Ejemplo n.º 28
0
        private void PrintReceipt(string receiptStr)
        {
            string[] receiptLines = receiptStr.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
            MigraDoc.DocumentObjectModel.Document doc = new MigraDoc.DocumentObjectModel.Document();
            doc.DefaultPageSetup.PageWidth   = Unit.FromInch(3.0);
            doc.DefaultPageSetup.PageHeight  = Unit.FromInch(0.181 * receiptLines.Length + 0.56);     //enough to print receipt text plus 9/16 inch (0.56) extra space at bottom.
            doc.DefaultPageSetup.TopMargin   = Unit.FromInch(0.25);
            doc.DefaultPageSetup.LeftMargin  = Unit.FromInch(0.25);
            doc.DefaultPageSetup.RightMargin = Unit.FromInch(0.25);
            MigraDoc.DocumentObjectModel.Font bodyFontx = MigraDocHelper.CreateFont(8, false);
            bodyFontx.Name = FontFamily.GenericMonospace.Name;
            MigraDoc.DocumentObjectModel.Section section = doc.AddSection();
            Paragraph       par       = section.AddParagraph();
            ParagraphFormat parformat = new ParagraphFormat();

            parformat.Alignment = ParagraphAlignment.Left;
            parformat.Font      = bodyFontx;
            par.Format          = parformat;
            par.AddFormattedText(receiptStr, bodyFontx);
            MigraDoc.Rendering.Printing.MigraDocPrintDocument printdoc = new MigraDoc.Rendering.Printing.MigraDocPrintDocument();
            MigraDoc.Rendering.DocumentRenderer renderer = new MigraDoc.Rendering.DocumentRenderer(doc);
            renderer.PrepareDocument();
            printdoc.Renderer = renderer;
            //we might want to surround some of this with a try-catch
#if DEBUG
            FormRpPrintPreview pView = new FormRpPrintPreview();
            pView.printPreviewControl2.Document = printdoc;
            pView.ShowDialog();
#else
            if (PrinterL.SetPrinter(pd2, PrintSituation.Receipt, PatCur.PatNum, "PayConnect receipt printed"))
            {
                printdoc.PrinterSettings = pd2.PrinterSettings;
                printdoc.Print();
            }
#endif
        }
Ejemplo n.º 29
0
        private void Print_Click()
        {
            PrintDocument pd = new PrintDocument();

            pd.DocumentName                  = viewer.SourceFile;
            pd.PrinterSettings.FromPage      = 1;
            pd.PrinterSettings.ToPage        = viewer.PageCount;
            pd.PrinterSettings.MaximumPage   = viewer.PageCount;
            pd.PrinterSettings.MinimumPage   = 1;
            pd.DefaultPageSettings.Landscape = viewer.PageWidth > viewer.PageHeight;
            try{
                if (PrinterL.SetPrinter(pd, PrintSituation.Default, 0, "Report printed " + pd.DocumentName))
                {
                    if (pd.PrinterSettings.PrintRange == PrintRange.Selection)
                    {
                        pd.PrinterSettings.FromPage = viewer.PageCurrent;
                    }
                    viewer.Print(pd);
                }
            }
            catch {
                MessageBox.Show(Lan.g(this, "Printer not available"));
            }
        }
Ejemplo n.º 30
0
        private void butPrint_Click(object sender, System.EventArgs e)
        {
#if DISABLE_MICROSOFT_OFFICE
            MessageBox.Show(this, "This version of Open Dental does not support Microsoft Word.");
            return;
#endif
            if (listLetters.SelectedIndex == -1)
            {
                MsgBox.Show(this, "Please select a letter first.");
                return;
            }
            LetterMerge letterCur = ListForCat[listLetters.SelectedIndex];
            letterCur.ImageFolder = comboImageCategory.SelectedTag <Def>().DefNum;
            string templateFile = ODFileUtils.CombinePaths(PrefC.GetString(PrefName.LetterMergePath), letterCur.TemplateName);
            string dataFile     = ODFileUtils.CombinePaths(PrefC.GetString(PrefName.LetterMergePath), letterCur.DataFileName);
            if (!File.Exists(templateFile))
            {
                MsgBox.Show(this, "Template file does not exist.");
                return;
            }
            PrintDocument pd = new PrintDocument();
            if (!PrinterL.SetPrinter(pd, PrintSituation.Default, PatCur.PatNum, "Letter merge " + letterCur.Description + " printed"))
            {
                return;
            }
            if (!CreateDataFile(dataFile, letterCur))
            {
                return;
            }
            Word.MailMerge wrdMailMerge;
            //Create an instance of Word.
            Word.Application WrdApp;
            try {
                WrdApp = LetterMerges.WordApp;
            }
            catch {
                MsgBox.Show(this, "Error.  Is MS Word installed?");
                return;
            }
            //Open a document.
            Object oName = templateFile;
            wrdDoc = WrdApp.Documents.Open(ref oName, ref oMissing, ref oMissing,
                                           ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                                           ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
            wrdDoc.Select();
            wrdMailMerge = wrdDoc.MailMerge;
            //Attach the data file.
            wrdDoc.MailMerge.OpenDataSource(dataFile, ref oMissing, ref oMissing, ref oMissing,
                                            ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
                                            ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
            wrdMailMerge.Destination = Word.WdMailMergeDestination.wdSendToPrinter;
            //WrdApp.ActivePrinter=pd.PrinterSettings.PrinterName;
            //replaced with following 4 lines due to MS bug that changes computer default printer
            object   oWBasic   = WrdApp.WordBasic;
            object[] oWBValues = new object[] { pd.PrinterSettings.PrinterName, 1 };
            String[] sWBNames  = new String[] { "Printer", "DoNotSetAsSysDefault" };
            oWBasic.GetType().InvokeMember("FilePrintSetup", BindingFlags.InvokeMethod, null, oWBasic, oWBValues, null, null, sWBNames);
            wrdMailMerge.Execute(ref oFalse);
            if (letterCur.ImageFolder != 0)           //if image folder exist for this letter, save to AtoZ folder
            {
                try {
                    wrdDoc.Select();
                    wrdMailMerge.Destination = Word.WdMailMergeDestination.wdSendToNewDocument;
                    wrdMailMerge.Execute(ref oFalse);
                    WrdApp.Activate();
                    string tempFilePath = ODFileUtils.CreateRandomFile(Path.GetTempPath(), GetFileExtensionForWordDoc(templateFile));
                    Object oFileName    = tempFilePath;
                    WrdApp.ActiveDocument.SaveAs(oFileName);                    //save the document
                    WrdApp.ActiveDocument.Close();
                    SaveToImageFolder(tempFilePath, letterCur);
                }
                catch (Exception ex) {
                    FriendlyException.Show(Lan.g(this, "Error saving file to the Image module:") + "\r\n" + ex.Message, ex);
                }
            }
            //Close the original form document since just one record.
            wrdDoc.Saved = true;
            wrdDoc.Close(ref oFalse, ref oMissing, ref oMissing);
            //At this point, Word remains open with no documents.
            WrdApp.WindowState = Word.WdWindowState.wdWindowStateMinimize;
            wrdMailMerge       = null;
            wrdDoc             = null;
            Commlog CommlogCur = new Commlog();
            CommlogCur.CommDateTime   = DateTime.Now;
            CommlogCur.CommType       = Commlogs.GetTypeAuto(CommItemTypeAuto.MISC);
            CommlogCur.Mode_          = CommItemMode.Mail;
            CommlogCur.SentOrReceived = CommSentOrReceived.Sent;
            CommlogCur.PatNum         = PatCur.PatNum;
            CommlogCur.Note           = "Letter sent: " + letterCur.Description + ". ";
            CommlogCur.UserNum        = Security.CurUser.UserNum;
            Commlogs.Insert(CommlogCur);
            DialogResult = DialogResult.OK;
        }