Пример #1
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
        }
Пример #2
0
 private void butPrint_Click(object sender, EventArgs e)
 {
     _pagesPrinted = 0;
     ODprintout.InvalidMinDefaultPageWidth = 0;
     //No print previews, since this form is in and of itself a print preview.
     PrinterL.TryPrint(pd_PrintPage, margins: new Margins(50, 50, 50, 50), duplex: Duplex.Horizontal);
 }
Пример #3
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"));
            }
        }
Пример #4
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
        }
Пример #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);
            }
        }
Пример #6
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"));
            }
        }
Пример #7
0
 private void butPrint_Click(object sender, EventArgs e)
 {
     _gridPageCur       = 0;
     _gridPrintProgress = EraProcPrintingProgress.DocumentHeader;
     PrinterL.TryPrintOrDebugRpPreview(pd_PrintPage, Lan.g(this, "Printed 835 Procedure") + ((_proc.ProcNum == 0)?"":(" " + _proc.ProcNum)),
                                       printoutOrientation: PrintoutOrientation.Landscape);
 }
Пример #8
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();
 }
Пример #9
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"));
            }
        }
Пример #10
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;
 }
        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
        }
Пример #12
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"));
            }
        }
Пример #13
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
 }
Пример #14
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
 }
Пример #15
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"));
            }
        }
Пример #16
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"));
            }
        }
Пример #17
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"));
            }
        }
Пример #18
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
        }
Пример #19
0
        private void butPostcards_Click(object sender, EventArgs e)
        {
            if (!validDateFrom.IsValid || !validDateTo.IsValid)
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            DateTime dateFrom = PIn.Date(validDateFrom.Text);
            DateTime dateTo   = PIn.Date(validDateTo.Text);

            if (dateTo < dateFrom)
            {
                MsgBox.Show(this, "To date cannot be before From date.");
                return;
            }
            if (dateFrom.AddYears(1) <= dateTo)
            {
                MsgBox.Show(this, "Date range must not exceed 1 year.");
                return;
            }
            BirthdayTable = RpBirthday.GetBirthdayTable(dateFrom, dateTo);
            if (BirthdayTable.Rows.Count == 0)
            {
                MsgBox.Show(this, "No postcards to preview.");
                return;
            }
            pagesPrinted    = 0;
            patientsPrinted = 0;
            PaperSize           paperSize;
            PrintoutOrientation orient = PrintoutOrientation.Default;

            if (PrefC.GetLong(PrefName.RecallPostcardsPerSheet) == 1)
            {
                paperSize = new PaperSize("Postcard", 400, 600);
                orient    = PrintoutOrientation.Landscape;
            }
            else if (PrefC.GetLong(PrefName.RecallPostcardsPerSheet) == 3)
            {
                paperSize = new PaperSize("Postcard", 850, 1100);
            }
            else              //4
            {
                paperSize = new PaperSize("Postcard", 850, 1100);
                orient    = PrintoutOrientation.Landscape;
            }
            int totalPages = (int)Math.Ceiling((double)BirthdayTable.Rows.Count / (double)PrefC.GetLong(PrefName.RecallPostcardsPerSheet));

            PrinterL.TryPreview(pdCards_PrintPage,
                                Lan.g(this, "Birthday report postcards printed"),
                                PrintSituation.Postcard,
                                new Margins(0, 0, 0, 0),
                                PrintoutOrigin.AtMargin,
                                paperSize,
                                orient,
                                totalPages
                                );
        }
Пример #20
0
 ///<summary></summary>
 public FormRpPrintPreview(ODprintout printout) : this()
 {
     if (printout.SettingsErrorCode != PrintoutErrorCode.Success)
     {
         PrinterL.ShowError(printout);
         this.DialogResult = DialogResult.Cancel;
         return;
     }
     _printPreviewControl2.Document = printout.PrintDoc;
 }
Пример #21
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();
            }
        }
Пример #22
0
 private void butPrint_Click(object sender, EventArgs e)
 {
     _pagesPrintedCount = 0;
     _isHeadingPrinted  = false;
     PrinterL.TryPrintOrDebugRpPreview(pd_PrintPage,
                                       Lan.g(this, "Electronic remittance advice (ERA) printed"),
                                       PrintoutOrientation.Portrait,
                                       margins: new Margins(25, 25, 50, 50)
                                       );
 }
Пример #23
0
 private void butPrint_Click(object sender,EventArgs e)
 {
     if(gridMain.ListGridRows.Count<1) {
         MsgBox.Show(this,"Supply list is Empty.");
         return;
     }
     pagesPrinted=0;
     headingPrinted=false;
     PrinterL.TryPrintOrDebugRpPreview(pd2_PrintPage,Lan.g(this,"Supplies list printed"),margins:new Margins(50,50,40,30));
 }
Пример #24
0
 private void butPrint_Click(object sender, EventArgs e)
 {
     PrinterL.TryPrint(pd2_PrintPage,
                       Lan.g(this, "Graphical perio chart printed"),
                       _patCur.PatNum,
                       PrintSituation.TPPerio,
                       new Margins(0, 0, 0, 0),
                       PrintoutOrigin.AtMargin
                       );
 }
Пример #25
0
 private void butPrint_Click(object sender, EventArgs e)
 {
     if (gridMain.ListGridRows.Count < 1)
     {
         MsgBox.Show(this, "Nothing to print.");
         return;
     }
     pagesPrinted   = 0;
     headingPrinted = false;
     PrinterL.TryPrintOrDebugRpPreview(pd_PrintPage, Lan.g(this, "Lab case list printed"), PrintoutOrientation.Landscape);
 }
Пример #26
0
 private void butPrint_Click(object sender, EventArgs e)
 {
     if (gridMain.ListGridRows.Count == 0)
     {
         MsgBox.Show(this, "Grid is empty.");
         return;
     }
     _pagesPrinted   = 0;
     _headingPrinted = false;
     PrinterL.TryPrintOrDebugRpPreview(pd_PrintPage, Lan.g(this, "Service date view printed"), PrintoutOrientation.Landscape);
 }
Пример #27
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            curPrintPage = 0;
            PrintoutOrientation orient = (landscape?PrintoutOrientation.Landscape:PrintoutOrientation.Portrait);

            if (PrinterL.TryPrint(pd1_PrintPage, printoutOrigin: PrintoutOrigin.AtMargin, printoutOrientation: orient))
            {
                numTimesPrinted++;
            }
            printerGraph = null;
            Display();
        }
Пример #28
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();
        }
Пример #29
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
        }
Пример #30
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;
     PrinterL.TryPrintOrDebugRpPreview(
         pd2_PrintPage,
         Lan.g(this, "Supplies order from") + " " + _listSupplyOrders[gridOrders.GetSelectedIndex()].DatePlaced.ToShortDateString() + " " + Lan.g(this, "printed"),
         margins: new Margins(50, 50, 40, 30)
         );
 }