예제 #1
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
                                );
        }
예제 #2
0
        private void butReport_Click(object sender, System.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;
            }
            ReportComplex report       = new ReportComplex(true, false);
            Font          font         = new Font("Tahoma", 9);
            Font          fontTitle    = new Font("Tahoma", 17, FontStyle.Bold);
            Font          fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);

            report.ReportName = Lan.g(this, "Birthdays");
            report.AddTitle("Title", Lan.g(this, "Birthdays"), fontTitle);
            report.AddSubTitle("PracTitle", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            report.AddSubTitle("Date", dateFrom.ToShortDateString() + " - " + dateTo.ToShortDateString(), fontSubTitle);
            QueryObject query = report.AddQuery(RpBirthday.GetBirthdayTable(dateFrom, dateTo), "", "", SplitByKind.None, 1, true);

            query.AddColumn("LName", 90, FieldValueType.String, font);
            query.AddColumn("FName", 90, FieldValueType.String, font);
            query.AddColumn("Preferred", 90, FieldValueType.String, font);
            query.AddColumn("Address", 90, FieldValueType.String, font);
            query.AddColumn("Address2", 90, FieldValueType.String, font);
            query.AddColumn("City", 75, FieldValueType.String, font);
            query.AddColumn("State", 60, FieldValueType.String, font);
            query.AddColumn("Zip", 75, FieldValueType.String, font);
            query.AddColumn("Birthdate", 75, FieldValueType.Date, font);
            query.GetColumnDetail("Birthdate").StringFormat = "d";
            query.AddColumn("Age", 45, FieldValueType.Integer, font);
            report.AddPageNum(font);
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
예제 #3
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;
            pd                             = new PrintDocument();
            pd.PrintPage                  += new PrintPageEventHandler(this.pdCards_PrintPage);
            pd.OriginAtMargins             = true;
            pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
            if (PrefC.GetLong(PrefName.RecallPostcardsPerSheet) == 1)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("Postcard", 400, 600);
                pd.DefaultPageSettings.Landscape = true;
            }
            else if (PrefC.GetLong(PrefName.RecallPostcardsPerSheet) == 3)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("Postcard", 850, 1100);
            }
            else              //4
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("Postcard", 850, 1100);
                pd.DefaultPageSettings.Landscape = true;
            }
            printPreview = new FormPrintPreview(PrintSituation.Postcard, pd,
                                                (int)Math.Ceiling((double)BirthdayTable.Rows.Count / (double)PrefC.GetLong(PrefName.RecallPostcardsPerSheet)), 0, "Birthday report postcards printed");
            printPreview.ShowDialog();
        }