Beispiel #1
0
        private void menuPreviewJournal_Click(object sender, System.EventArgs e)
        {
            if (patient != null && selectedPatientRow != null)
            {
                //TODO: Should only be possible to print visitnotes??
                DataSet dsPrintJournal = new DataSet();
                dsPrintJournal.Merge(selectedPatientRow.Row.GetChildRows("PatientNotes"));
                dsPrintJournal.Tables[0].DefaultView.Sort = "visitdatetime DESC";

                printJournal.SetContent(patient, dsPrintJournal.Tables[0].DefaultView);

                printPreviewDialog.Document = printJournal.PrintDocument;

                System.Windows.Forms.PrintPreviewControl printPreviewControl = new PrintPreviewControl();
                foreach (Control c in printPreviewDialog.Controls)
                {
                    if (c.GetType() == printPreviewControl.GetType())
                        printPreviewControl = (System.Windows.Forms.PrintPreviewControl)c;
                }
                if (printPreviewControl != null)
                    printPreviewControl.Zoom = 1.0;

                printPreviewDialog.ShowDialog();

            }
            else
                MessageBox.Show("Välj en patient att skriva ut journal för", "Kunde ej skriva ut journal");
        }
        private void btnPrintPreview_Click(object sender, System.EventArgs e)
        {
            System.Windows.Forms.CurrencyManager cm = (CurrencyManager)BindingContext[dgReceipt.DataSource,dgReceipt.DataMember];
            System.Data.DataView dvJoined = (System.Data.DataView) cm.List;
            System.Data.DataView dv;
            if (selectedRows.Count > 0)
            {
                System.Data.DataSet ds = Utils.SelectedRowsDataSet(dvJoined, selectedRows);
                dv = ds.Tables[0].DefaultView;
            }
            else
                dv = dvJoined;

            dv.Sort = "visitdatetime DESC";

            Utils.PatientNote[] patientNotesArray = Utils.CreatePatientNotesArray(database, dv);
            printReceipt.SetContent(patientNotesArray);
            printPreviewDialog.Document = printReceipt.PrintDocument;
            System.Windows.Forms.PrintPreviewControl printPreviewControl = new PrintPreviewControl();
            foreach (Control c in printPreviewDialog.Controls)
            {
                if (c.GetType() == printPreviewControl.GetType())
                    printPreviewControl = (System.Windows.Forms.PrintPreviewControl)c;
            }
            if (printPreviewControl != null)
                printPreviewControl.Zoom = 1.0;
            printPreviewDialog.ShowDialog();
        }
Beispiel #3
0
        private void btnPrintPreview_Click(object sender, System.EventArgs e)
        {
            System.Windows.Forms.CurrencyManager cm;

            if (tabControl.SelectedIndex == 0)
                cm = (CurrencyManager)BindingContext[dgToPrimula.DataSource,dgToPrimula.DataMember];
            else
                cm = (CurrencyManager)BindingContext[dgInPrimula.DataSource,dgInPrimula.DataMember];

            System.Data.DataView dv = (System.Data.DataView) cm.List;

            Utils.PatientNote[] patientNotesArray = Utils.CreatePatientNotesArray(database, dv);
            printPrimula.SetContent(patientNotesArray, nrofVisitsTotal ,nrofVisitsFreecard ,nrofVisitsPatientPays, nrofVisitsYouth);
            printPreviewDialog.Document = printPrimula.PrintDocument;
            System.Windows.Forms.PrintPreviewControl printPreviewControl = new PrintPreviewControl();
            foreach (Control c in printPreviewDialog.Controls)
            {
                if (c.GetType() == printPreviewControl.GetType())
                    printPreviewControl = (System.Windows.Forms.PrintPreviewControl)c;
            }
            if (printPreviewControl != null)
                printPreviewControl.Zoom = 1.0;

            printPreviewDialog.ShowDialog();
        }