Beispiel #1
0
        private void printTransactionReportbutton_Click(object sender, EventArgs e)
        {
            TransactionBLL          aTransactionBll = new TransactionBLL();
            List <TransationReport> aReports        = new List <TransationReport>();

            aReports = (List <TransationReport>)inventoryTransactionDataGridView.DataSource;

            if (aReports == null)
            {
                MessageBox.Show("No data Available Into GridView");
                return;
            }
            int           printlenght = aReports.Count;
            PrintDocument doc         = new TextDocument(aTransactionBll.PrintTransactionReport(aReports), printlenght);

            //ViewReport aReport = new ViewReport();
            printReportLogoType = 1;
            doc.PrintPage      += this.Doc_PrintPage;
            doc.DefaultPageSettings.Landscape = true;

            PrintDialog dlgSettings = new PrintDialog();

            dlgSettings.UseEXDialog = true;
            dlgSettings.Document    = doc;

            if (dlgSettings.ShowDialog() == DialogResult.OK)
            {
                doc.Print();
            }
        }