private void btnTemperaturePaint_Click(object sender, EventArgs e) { MultiColHeaderDgv printTempreturelist = dgv_Tempreturelist; /* * MultiColHeaderDgv printTempreturelist = new MultiColHeaderDgv(); * * int count = dgv_Tempreturelist.Columns.Count; * * DataGridViewColumn[] columns = new DataGridViewColumn[count]; * dgv_Tempreturelist.Columns.CopyTo(columns, 0); * printTempreturelist.Columns.AddRange(columns); * * printTempreturelist.DataSource = dgv_Tempreturelist.DataSource; */ printTempreturelist.Columns["Col_DY"].Visible = false; printDocument1.DocumentName = "打印记录体温单"; printDocument1.PrinterSettings = printDialog1.PrinterSettings; printDocument1.DefaultPageSettings = printDialog1.PrinterSettings.DefaultPageSettings; printDocument1.DefaultPageSettings.Margins = new Margins(30, 30, 30, 30); dataGridViewPrint = new DataGridViewPrint(printTempreturelist, printDocument1, true, false, "", new Font("黑体", 18, FontStyle.Bold, GraphicsUnit.Point), Color.Blue, false); PrintPreviewDialog printPreviewDialog = new PrintPreviewDialog(); printPreviewDialog.Document = printDocument1; printPreviewDialog.ShowDialog(); printTempreturelist.Columns["Col_DY"].Visible = true; }
private void PintCertificate() { DataGridView dgv = new DataGridView(); dgv.Columns.Add("Name", "姓名"); dgv.Columns.Add("ToTime", "抵店日期"); dgv.Columns.Add("OutTime", "抵店时间"); dgv.Columns.Add("ConsumeName", "消费项目"); dgv.Columns.Add("UnitPrice", "单价"); dgv.Columns.Add("Unit", "单位"); dgv.Columns.Add("Number", "消费数量"); dgv.Columns.Add("TotalMoney", "应收"); //dgv.Columns["Name"].Width = dgvConsumeDetail.Columns["Name"].Width; dgv.Columns["ConsumeName"].Width = dgvConsumeDetail.Columns["ConsumeName"].Width; dgv.Columns["UnitPrice"].Width = dgvConsumeDetail.Columns["UnitPrice"].Width; dgv.Columns["Unit"].Width = dgvConsumeDetail.Columns["Unit"].Width; dgv.Columns["Number"].Width = dgvConsumeDetail.Columns["Number"].Width; dgv.Columns["TotalMoney"].Width = dgvConsumeDetail.Columns["TotalMoney"].Width; dgv.Width = dgv.Columns["ConsumeName"].Width + dgv.Columns["UnitPrice"].Width + dgv.Columns["Unit"].Width + dgv.Columns["Number"].Width + dgv.Columns["TotalMoney"].Width; dgv.AllowUserToAddRows = true; int i = 0; foreach (DataGridViewRow dgvr in dgvConsumeDetail.Rows) { dgv.Rows.Add(); dgv.Rows[i].Cells["ConsumeName"].Value = dgvr.Cells["ConsumeName"].Value; dgv.Rows[i].Cells["UnitPrice"].Value = dgvr.Cells["UnitPrice"].Value; dgv.Rows[i].Cells["Unit"].Value = dgvr.Cells["Unit"].Value; dgv.Rows[i].Cells["Number"].Value = dgvr.Cells["Number"].Value; dgv.Rows[i].Cells["TotalMoney"].Value = dgvr.Cells["TotalMoney"].Value; i++; } dgv.Rows.Add(); dgv.Rows[i].Cells["ConsumeName"].Value = "合计:"; dgv.Rows[i].Cells["UnitPrice"].Value = txtTotal.Text; dgv.Rows[i].Cells["Unit"].Value = "押金:"; dgv.Rows[i].Cells["Number"].Value = lblDeposit.Text; dgv.Rows[i].Cells["TotalMoney"].Value = "找零:" + (double.Parse(lblDeposit.Text) - double.Parse(txtTotal.Text)).ToString(); if (dgvConsumeDetail.Rows.Count > 0) { PrintInfo bPrint = new PrintInfo(); PrintModel mPrint = new PrintModel(); mPrint = bPrint.GetPrintModel(new PrintModel(this.Name), new ObjectControls(MCtrl.ByPrintNo)); CommonModel mComm = new CommonModel(); mPrint = bPrint.GetPrintSet(mPrint, new Object[] { UserInfo }); DataGridViewPrint dgvp = new DataGridViewPrint(new DataGridView[] { dgv }); dgvp.GetPrintConfig = mPrint; dgvp.Print(true, false); } }
private void PintCertificate() { DataGridView dgv = new DataGridView(); dgv.Columns.Add("ConsumeName", "消费项目"); dgv.Columns.Add("UnitPrice", "单价"); dgv.Columns.Add("Unit", "单位"); dgv.Columns.Add("Number", "消费数量"); dgv.Columns.Add("TotalMoney", "应收"); dgv.Columns["ConsumeName"].Width = dgvConsumeDetail.Columns["ConsumeName"].Width; dgv.Columns["UnitPrice"].Width = dgvConsumeDetail.Columns["UnitPrice"].Width; dgv.Columns["Unit"].Width = dgvConsumeDetail.Columns["Unit"].Width; dgv.Columns["Number"].Width = dgvConsumeDetail.Columns["Number"].Width; dgv.Columns["TotalMoney"].Width = dgvConsumeDetail.Columns["TotalMoney"].Width; dgv.Width = dgv.Columns["ConsumeName"].Width + dgv.Columns["UnitPrice"].Width + dgv.Columns["Unit"].Width + dgv.Columns["Number"].Width + dgv.Columns["TotalMoney"].Width; dgv.AllowUserToAddRows = false; int i = 0; foreach (DataGridViewRow dgvr in dgvConsumeDetail.Rows) { dgv.Rows.Add(); dgv.Rows[i].Cells["ConsumeName"].Value = dgvr.Cells["ConsumeName"].Value; dgv.Rows[i].Cells["UnitPrice"].Value = dgvr.Cells["UnitPrice"].Value; dgv.Rows[i].Cells["Unit"].Value = dgvr.Cells["Unit"].Value; dgv.Rows[i].Cells["Number"].Value = dgvr.Cells["Number"].Value; dgv.Rows[i].Cells["TotalMoney"].Value = dgvr.Cells["TotalMoney"].Value; i++; } dgv.Rows.Add(); //dgv.Rows[i].Cells["ConsumeName"].Value = "合计:"; //dgv.Rows[i].Cells["UnitPrice"].Value = dTotal.ToString(); //dgv.Rows[i].Cells["Unit"].Value = "找零:"; //dgv.Rows[i].Cells["Number"].Value = listCustomerStay[0].Deposit - dTotal; dgv.Rows[i].Cells["ConsumeName"].Value = "合计:"; dgv.Rows[i].Cells["UnitPrice"].Value = dTotal.ToString(); dgv.Rows[i].Cells["Unit"].Value = "押金:"; dgv.Rows[i].Cells["Number"].Value = +listCustomerStay[0].Deposit; dgv.Rows[i].Cells["TotalMoney"].Value = "找零:" + (listCustomerStay[0].Deposit - dTotal).ToString(); if (dgvConsumeDetail.Rows.Count > 0) { PrintInfo bPrint = new PrintInfo(); PrintModel mPrint = new PrintModel(); mPrint = bPrint.GetPrintModel(new PrintModel("FormPayMoney"), new ObjectControls(MCtrl.ByPrintNo)); CommonModel mComm = new CommonModel(); mPrint = bPrint.GetPrintSet(mPrint, new Object[] { UserInfo }); DataGridViewPrint dgvp = new DataGridViewPrint(new DataGridView[] { dgv }); dgvp.GetPrintConfig = mPrint; dgvp.Print(true, false); } }
private void btnPrint_Click(object sender, EventArgs e) { //显示打印对话框 PrintDialog MyDlg = new PrintDialog(); MyDlg.Document = this.printDoc; if (MyDlg.ShowDialog().Equals(DialogResult.OK)) { //显示打印预览对话框 dp = new DataGridViewPrint(this.dgvData, this.printDoc, true, true, "科室基药汇总", "", new System.Drawing.Font("Tahoma", 18, FontStyle.Bold, GraphicsUnit.Point), Color.Black, true); PrintPreviewDialog a = new PrintPreviewDialog(); a.Document = this.printDoc; a.ShowDialog(); } }
private void pbtnPrint_Click(object sender, EventArgs e) { if (cmn.CheckEOF(listCustomerStay)) { PrintModel mPrint = new PrintModel(); mPrint = bPrint.GetPrintModel(new PrintModel(this.Name), new ObjectControls(MCtrl.ByPrintNo)); CommonModel mComm = new CommonModel(); mComm.StartDate = GetDateTimePickValue(dtpStart, cboHourS); mComm.EndDate = GetDateTimePickValue(dtpEnd, cboHourE); mPrint = bPrint.GetPrintSet(mPrint, new Object[] { UserInfo, mComm }); DataGridViewPrint dgvp = new DataGridViewPrint(new DataGridView[] { dgvIncomeInfo }); dgvp.GetPrintConfig = mPrint; dgvp.Print(true, true); } }
private void btnExTemperaturePaint_Click(object sender, EventArgs e) { printDialog1.ShowDialog(); return; MultiColHeaderDgv printTempreturelist = dgv_Tempreturelist; /* * MultiColHeaderDgv printTempreturelist = new MultiColHeaderDgv(); * * int count = dgv_Tempreturelist.Columns.Count; * DataGridViewColumn[] columns = new DataGridViewColumn[count]; * * dgv_Tempreturelist.Columns.CopyTo(columns, 0); * printTempreturelist.Columns.AddRange(columns); * printTempreturelist.DataSource = dgv_Tempreturelist.DataSource; */ printTempreturelist.Columns["Col_DY"].Visible = false; CheckAllCellException(); foreach (DataGridViewRow row in dgv_Tempreturelist.Rows) { if (m_exceptionRows.Exists(exception => exception.Equals(row.Index))) { row.Visible = true; } else { row.Visible = false; } } printDocument1.DocumentName = "打印记录体温单"; printDocument1.PrinterSettings = printDialog1.PrinterSettings; printDocument1.DefaultPageSettings = printDialog1.PrinterSettings.DefaultPageSettings; printDocument1.DefaultPageSettings.Margins = new Margins(30, 30, 30, 30); dataGridViewPrint = new DataGridViewPrint(printTempreturelist, printDocument1, true, false, "", new Font("黑体", 18, FontStyle.Bold, GraphicsUnit.Point), Color.Blue, false); PrintPreviewDialog printPreviewDialog = new PrintPreviewDialog(); printPreviewDialog.Document = printDocument1; printPreviewDialog.ShowDialog(); printTempreturelist.Columns["Col_DY"].Visible = true; foreach (DataGridViewRow row in dgv_Tempreturelist.Rows) { row.Visible = true; } }
private void pbtnPrint_Click(object sender, EventArgs e) { if (dgv.Rows.Count > 0) { PrintInfo bPrint = new PrintInfo(); PrintModel mPrint = new PrintModel(); mPrint = bPrint.GetPrintModel(new PrintModel(FormName), new ObjectControls(MCtrl.ByPrintNo)); CommonModel mComm = new CommonModel(); mComm.StartDate = StartTime; mComm.EndDate = EndTime; mPrint = bPrint.GetPrintSet(mPrint, new Object[] { mUserInfo, mComm }); DataGridViewPrint dgvp = new DataGridViewPrint(new DataGridView[] { dgv }); dgvp.GetPrintConfig = mPrint; dgvp.Print(ShowDialog, DrawLine); } }