Ejemplo n.º 1
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            DataGridView DataSource = new DataGridView();
            List <int>   Columns    = new List <int>();
            string       Title      = "";

            DataSource = dataGridView1;

            DataSource.DataSource = dgvPage.GetData();

            Title += "查询状态:" + this.cbxSearchRange.Text;
            Title += "    ";
            Title += "查询日期:" + DateTime.Now.ToShortDateString();
            Title += "    ";
            Title += "共计" + DataSource.Rows.Count.ToString() + "张当票";
            Title += "    ";
            DDUser newUser = new DDUser("AccountName", MainForm.AccountName);

            Title += "查询人:" + newUser.UserName;

            Columns.Add(dataGridView1.Columns["TicketNumber"].Index);
            Columns.Add(dataGridView1.Columns["CustomerName"].Index);
            Columns.Add(dataGridView1.Columns["StartDate"].Index);
            Columns.Add(dataGridView1.Columns["EndDate"].Index);
            Columns.Add(dataGridView1.Columns["TotalAmount"].Index);
            Columns.Add(dataGridView1.Columns["TotalCount"].Index);
            Columns.Add(dataGridView1.Columns["StatusID"].Index);



            PrintDataGrid frmPrintDataGrid = new PrintDataGrid(Title, DataSource, Columns);

            SetForGridViewPage();
        }
Ejemplo n.º 2
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            DataGridView DataSource = new DataGridView();
            List <int>   Columns    = new List <int>();
            string       Title      = "";

            DataSource            = dataGridView1;
            DataSource.DataSource = dgvPage.GetData().ToTable();

            Title += "查询状态:" + this.cbxSearchRange.Text;
            Title += "    ";
            Title += "查询日期:" + DateTime.Now.ToShortDateString();
            Title += "    ";
            Title += "共计" + DataSource.Rows.Count.ToString() + "件当品";
            Title += "    ";
            DDUser newUser = new DDUser("AccountName", MainForm.AccountName);

            Title += "查询人:" + newUser.UserName;

            Columns.Add(dataGridView1.Columns["TicketNumber"].Index);
            Columns.Add(dataGridView1.Columns["FirstClass"].Index);
            Columns.Add(dataGridView1.Columns["SecondClass"].Index);
            Columns.Add(dataGridView1.Columns["Description"].Index);
            Columns.Add(dataGridView1.Columns["Weight"].Index);
            Columns.Add(dataGridView1.Columns["TotalCount"].Index);
            Columns.Add(dataGridView1.Columns["Price"].Index);
            Columns.Add(dataGridView1.Columns["FeeRate"].Index);
            Columns.Add(dataGridView1.Columns["InterestRate"].Index);
            Columns.Add(dataGridView1.Columns["Remark"].Index);



            PrintDataGrid frmPrintDataGrid = new PrintDataGrid(Title, DataSource, Columns);

            SetForGridViewPage();
        }