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(); }
private void btnPrint_Click(object sender, EventArgs e) { //if (SetupThePrinting()) //{ // MyPrintDocument.Print(); //} DataGridView DataSource = new DataGridView(); List <int> Columns = new List <int>(); string Title = ""; DataSource = dataGridView1; Title += "查询日期:" + DateTime.Now.ToShortDateString(); Title += " "; DDUser newUser = new DDUser("AccountName", MainForm.AccountName); Title += "查询人:" + newUser.UserName; Columns.Add(dataGridView1.Columns["ClassName"].Index); Columns.Add(dataGridView1.Columns["ServiceFee"].Index); Columns.Add(dataGridView1.Columns["ReturnFee"].Index); Columns.Add(dataGridView1.Columns["OverdueFee"].Index); Columns.Add(dataGridView1.Columns["InterestFee"].Index); Columns.Add(dataGridView1.Columns["TotalFee"].Index); Columns.Add(dataGridView1.Columns["Reckoning"].Index); if (Type == 0) { PrintDataGrid frmPrintDataGrid = new PrintDataGrid(Title, DataSource, Columns, "QueryByTaking1.dd"); } else if (Type == 1) { PrintDataGrid frmPrintDataGrid = new PrintDataGrid(Title, DataSource, Columns, "QueryByTaking2.dd"); } }
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(); }