private void PDFPreview_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F11) { PrintForm pf = new PrintForm(this, strPath, Common.Util.CommonTeisu.SIZE_A4, false); pf.ShowDialog(this); if (this.printFlg == Common.Util.CommonTeisu.ACTION_PREVIEW) { pf.execPreview(strPath); pf.ShowDialog(this); } else if (this.printFlg == Common.Util.CommonTeisu.ACTION_PRINT) { pf.execPrint(null, strPath, Common.Util.CommonTeisu.SIZE_B4, Common.Util.CommonTeisu.YOKO, false); pf.Close(); pf.Dispose(); } } else if (e.KeyCode == Keys.F12) { this.Close(); } }
/// <summary> /// 打印 /// </summary> public void PrintDocument(decimal currInpatient, DataLoader dataLoader) { try { threeMeasureDrawHepler = new ThreeMeasureDrawHepler(currInpatient, dataLoader); PrintForm printDocumentForm = new PrintForm(threeMeasureDrawHepler); printDocumentForm.DefaultPageSize = m_DefaultPrintSize; printDocumentForm.ShowDialog(); } catch (Exception ex) { throw ex; } }
private void PrintButton_Click(object sender, EventArgs e) { string bmpFile = @"..\..\src\printout.bmp"; //https://stackoverflow.com/questions/4246905/print-print-preview-a-bitmap-in-c-sharp using (Bitmap bmp = new Bitmap(panel1.Width, panel1.Height)) using (PrintForm pf = new PrintForm(bmp)) { Rectangle r = new Rectangle(0, 0, panel1.Width, panel1.Height); panel1.DrawToBitmap(bmp, r); //fails when: // run more than once bmp.Save(bmpFile); pf.ShowDialog(this); } }
internal void OutputCertificateCompletion() { try { if (ExistsRecord) { _print = new PrintForm(); _print.Document = new CertificateCompletion(Item.Number); _print.ShowDialog(); } } catch (Exception ex) { ShowError(ex.Message); } }
internal void OutputAcceptanceTransferOwnershipCertificate() { try { if (ExistsRecord) { _print = new PrintForm(); _print.Document = new AcceptanceTransferOwnershipCertificate(Item.Number); _print.ShowDialog(); } } catch (Exception ex) { ShowError(ex.Message); } }
internal void OutputJopTicket() { try { if (ExistsRecord) { _print = new PrintForm(); _print.Document = new JobTicket(Item.Number); _print.ShowDialog(); } } catch (Exception ex) { ShowError(ex.Message); } }
/// <summary> /// 打印 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Print_Click(object sender, EventArgs e) { try { //DataTable dt = gridControlMain.DataSource as DataTable; //DataTable dtTemp = dt.Clone(); //foreach (DataRow dr in dt.Rows) //{ // if (dr["SELECT"].ToString().ToUpper() == "TRUE") // { // DataRow drTemp = dtTemp.NewRow(); // drTemp.ItemArray = dr.ItemArray; // dtTemp.Rows.Add(drTemp); // } //} //dtTemp.AcceptChanges(); if (Selection.selection.Count > 0) { if (Selection.selection.Cast <DataRowView>().ToList().Count > 280) { if (DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("打印预览最多只能28页,是否继续?", "打印预览", DrectSoft.Common.Ctrs.DLG.MyMessageBoxButtons.YesNo) == DialogResult.Yes) { PrintForm printForm = new PrintForm(Selection.selection.Cast <DataRowView>().ToList(), radio_CardType.SelectedIndex); printForm.WindowState = FormWindowState.Maximized; printForm.ShowDialog(); } } else { PrintForm printForm = new PrintForm(Selection.selection.Cast <DataRowView>().ToList(), radio_CardType.SelectedIndex); printForm.WindowState = FormWindowState.Maximized; printForm.ShowDialog(); } } else { MessageBox.Show("请选择需要打印的记录"); } } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
public static void Main() { RibbonBarItem rbItem1 = MotherForm.RibbonBarItems["學生", "資料統計"]; rbItem1["報表"]["成績相關報表"]["評量成績通知單(測試版)"].Enable = UserAcl.Current["JH.Student.HsinChuExamScore_JH_Student"].Executable; rbItem1["報表"]["成績相關報表"]["評量成績通知單(測試版)"].Click += delegate { if (K12.Presentation.NLDPanels.Student.SelectedSource.Count > 0) { PrintForm pf = new PrintForm(K12.Presentation.NLDPanels.Student.SelectedSource); pf.ShowDialog(); } else { FISCA.Presentation.Controls.MsgBox.Show("請選擇選學生"); return; } }; RibbonBarItem rbItem2 = MotherForm.RibbonBarItems["班級", "資料統計"]; rbItem2["報表"]["成績相關報表"]["評量成績通知單(測試版)"].Enable = UserAcl.Current["JH.Student.HsinChuExamScore_JH_Class"].Executable; rbItem2["報表"]["成績相關報表"]["評量成績通知單(測試版)"].Click += delegate { if (K12.Presentation.NLDPanels.Class.SelectedSource.Count > 0) { List <string> StudentIDList = Utility.GetClassStudentIDList1ByClassID(K12.Presentation.NLDPanels.Class.SelectedSource); PrintForm pf = new PrintForm(StudentIDList); pf.ShowDialog(); } else { FISCA.Presentation.Controls.MsgBox.Show("請選擇選班級"); return; } }; // 評量成績通知單 Catalog catalog1a = RoleAclSource.Instance["學生"]["功能按鈕"]; catalog1a.Add(new RibbonFeature("JH.Student.HsinChuExamScore_JH_Student", "評量成績通知單(測試版)")); // 評量成績通知單 Catalog catalog1b = RoleAclSource.Instance["班級"]["功能按鈕"]; catalog1b.Add(new RibbonFeature("JH.Student.HsinChuExamScore_JH_Class", "評量成績通知單(測試版)")); }
public static void PrintImage(Image img) { if (Program.Settings.DontShowPrintSettingsDialog) { using (PrintHelper printHelper = new PrintHelper(img)) { printHelper.Settings = Program.Settings.PrintSettings; printHelper.Print(); } } else { using (PrintForm printForm = new PrintForm(img, Program.Settings.PrintSettings)) { printForm.ShowDialog(); } } }
public override bool Export(PwExportInfo pwExportInfo, Stream sOutput, IStatusLogger slLogger) { PrintForm dlg = new PrintForm(); dlg.InitEx(pwExportInfo.DataGroup, false); if (dlg.ShowDialog() == DialogResult.OK) { StreamWriter sw = new StreamWriter(sOutput, Encoding.UTF8); sw.Write(dlg.GeneratedHtml); sw.Close(); return(true); } return(false); }
public override bool Export(PwExportInfo pwExportInfo, Stream sOutput, IStatusLogger slLogger) { PrintForm dlg = new PrintForm(); dlg.InitEx(pwExportInfo.DataGroup, false, -1); if (dlg.ShowDialog() == DialogResult.OK) { byte[] pb = Encoding.UTF8.GetBytes(dlg.GeneratedHtml); sOutput.Write(pb, 0, pb.Length); sOutput.Close(); return(true); } return(false); }
public void Print() { //打印单科会诊信息 if (m_ConsultTypeID == "6501") { PrintForm form = new PrintForm(m_ConsultationEntity); form.StartPosition = FormStartPosition.CenterScreen; form.ShowDialog(); } //保存多科会诊信息 else { if (m_UCConsultationMultiply == null) return; else m_UCConsultationMultiply.Print(); } }
private void buttonDailyReport_Click(object sender, EventArgs e) { var dt = new DataTable(); var UsedClass = new BasicClass(); SqlParameter[] param = new SqlParameter[1]; param[0] = new SqlParameter("@InvoiceFilter", SqlDbType.NVarChar, 150); param[0].Value = BasicClass.UserName; dt = UsedClass.selectdata("Casher_Select_Invoices_with_all_Information", param); var crp = new Reports.DailyCasherReport(); //CrystalDecisions.CrystalReports.Engine.TextObject invoiceType = (CrystalDecisions.CrystalReports.Engine.TextObject) crp.ReportDefinition.Sections["Section2"].ReportObjects["Text15"]; //invoiceType.Text = textBoxInvoiceNo.Text; crp.SetDataSource(dt); PrintForm form = new PrintForm(); form.crystalReportViewer1.ReportSource = crp; form.ShowDialog(); }
public override bool Export(PwExportInfo pwExportInfo, Stream sOutput, IStatusLogger slLogger) { PrintForm dlg = new PrintForm(); dlg.InitEx(pwExportInfo.DataGroup, false, -1); bool bResult = false; if (dlg.ShowDialog() == DialogResult.OK) { byte[] pb = StrUtil.Utf8.GetBytes(dlg.GeneratedHtml); sOutput.Write(pb, 0, pb.Length); sOutput.Close(); bResult = true; } UIUtil.DestroyForm(dlg); return(bResult); }
private void buttonPrintInvoice_Click(object sender, EventArgs e) { var UsedClass = new BasicClass(); var dt = new DataTable(); //if ( dataGridViewItems.Rows.Count > 0 || textBoxInvoiceNO.Text != "" ) //{ if (textBoxCustomerName.Text == "") { MessageBox.Show("يرجى ادخال أسم الزبون", "Message"); textBoxCustomerName.Focus(); } else { SqlParameter[] param = new SqlParameter[2]; param[0] = new SqlParameter("@InvoiceNo", SqlDbType.Int); param[1] = new SqlParameter("@CustomerName", SqlDbType.NVarChar, 250); //param[0].Value = textBoxInvoiceNO.Text; param[0].Value = 51; param[1].Value = textBoxCustomerName.Text.Trim(); dt = UsedClass.selectdata("Casher_PrintForma", param); if (dt.Rows.Count > 0) { var crp = new Reports.PurshaceReport(); //CrystalDecisions.CrystalReports.Engine.TextObject invoiceType = (CrystalDecisions.CrystalReports.Engine.TextObject) crp.ReportDefinition.Sections["Section2"].ReportObjects["Text15"]; //invoiceType.Text = textBoxInvoiceNO.Text; crp.SetDataSource(dt); PrintForm form = new PrintForm(); form.crystalReportViewer1.ReportSource = crp; form.ShowDialog(); } else { MessageBox.Show("لا توجد بيانات لعرضها", "MESSAGE"); } } //} }
private void buttonInvoicePrint_Click(object sender, EventArgs e) { var UsedClass = new BasicClass(); var dt = new DataTable(); SqlParameter[] param = new SqlParameter[2]; param[0] = new SqlParameter("@InvoiceNo", SqlDbType.Int); param[1] = new SqlParameter("@CustomerName", SqlDbType.NVarChar, 250); param[0].Value = int.Parse(textBoxInvoiceNo.Text); param[1].Value = textBoxCustomerName.Text.Trim(); dt = UsedClass.selectdata("Casher_PrintForma", param); var crp = new Reports.CrystalReport1(); CrystalDecisions.CrystalReports.Engine.TextObject invoiceType = (CrystalDecisions.CrystalReports.Engine.TextObject)crp.ReportDefinition.Sections["Section2"].ReportObjects["Text15"]; invoiceType.Text = textBoxInvoiceNo.Text; crp.SetDataSource(dt); PrintForm form = new PrintForm(); form.crystalReportViewer1.ReportSource = crp; form.ShowDialog(); //crp.PrintToPrinter ( 1 , false , 0 , 0 ); }
/// <summary> /// 提交数据 /// </summary> private void SubmitData() { model.CastId = manager.GetMaxId(); model.CusNum = txt_CardNumber.Text.Trim(); model.MemberId = "0"; model.CardID = "0"; model.PriceAmount = Convert.ToDecimal(txt_PayableAmount.Text.Trim()); model.PaymentAmount = Convert.ToDecimal(txt_PaymentAmount.Text.Trim()); model.ChangeAmount = Convert.ToDecimal(txt_ChangeAmount.Text.Trim()); model.CreateTime = CommTools.GetDateFormatStrot2(DateTime.Now); model.CusType = this.cmb_CunsumeType.Text; model.CreateTime = CommTools.GetDateFormatStrot2(DateTime.Now); model.Peoples = txt_PeoPles.Text.Trim(); model.CusCount = txt_CunsumeCount.Text.Trim(); model.TypeName = cmb_PayType.Text.Trim(); model.Prices = txt_PriceAmount.Text.Trim(); model.Des = "单次消费"; model.AddUserName = MainForm.userName; model.CusState = 0; int isAdd = manager.Add(model); MessageBox.Show("单号:" + txt_CardNumber.Text.Trim() + " 消费" + (isAdd > 0 ? "成功!" : "失败!")); //StringBuilder sb = new StringBuilder(); //string content = Regex.Replace(CommTools.GetString(cmb_CunsumeType.Text.Trim(), 8), @" ", " "); //string coi = Regex.Replace(CommTools.GetString(txt_CunsumeCount.Text.Trim(), 6), @" ", " "); //string coi2 = Regex.Replace(CommTools.GetString(txt_PriceAmount.Text.Trim(), 6), @" ", " "); //string coi3 = Regex.Replace(CommTools.GetString(txt_PaymentAmount.Text.Trim(), 6), @" ", " "); //sb.Append(content + coi + coi2 + coi3); CommTools.AddSystemLog("添加", "单次消费:" + txt_CardNumber.Text.Trim() + " 消费信息 " + this.cmb_CunsumeType.Text + "添加" + (isAdd > 0 ? "成功!" : "失败!")); //string mes = CommTools.GetPrintStr(MainForm.PrintTitle, model.CusNum, MainForm.PrintAddress, MainForm.PrintPhone, MainForm.PrintEnd, Convert.ToDouble(model.PriceAmount), Convert.ToDouble(model.PaymentAmount), sb.ToString(), txt_PeoPles.Text.Trim()); //MessageBox.Show(mes); PrintForm pf=new PrintForm (model.CusNum,cmb_CunsumeType.Text.Trim(),txt_CunsumeCount.Text.Trim(),txt_PriceAmount.Text.Trim(),txt_PayableAmount.Text.Trim(),txt_PeoPles.Text.Trim(),txt_PayableAmount.Text.Trim(),txt_PaymentAmount.Text.Trim(),txt_ChangeAmount.Text.Trim(),cmb_PayType.Text.Trim()); pf.ShowDialog(); this.Close(); //CunsumeCastModel cunsumeCastModel=new CunsumeCastModel(); //cunsumeCastModel.Id = cunsumeCastManager.GetMaxId(); //cunsumeCastModel.ChangeAmount = Convert.ToDecimal(this.txt_ChangeAmount.Text); //cunsumeCastModel.Count = Convert.ToInt32(this.txt_CunsumeCount.Text); //cunsumeCastModel.CreateTime = this.dtp_AddTime.Value; //cunsumeCastModel.CusType = this.cmb_CunsumeType.Text; //cunsumeCastModel.MemberId = Convert.ToInt32(txt_CardNumber.Text.Trim()); //cunsumeCastModel.PayableAmount = Convert.ToDecimal(this.txt_PayableAmount.Text); //cunsumeCastModel.PriceAmount = Convert.ToDecimal(this.txt_PriceAmount.Text); //cunsumeCastModel.TransactDate = this.dtp_AddTime.Value; //int result = this.cunsumeCastManager.Add(cunsumeCastModel); //CommTools.AddSystemLog("单次消费", "卡号:" + this.txt_CardNumber.Text + "消费:" + this.txt_PayableAmount.Text + (result > 0 ? "成功" : "失败")); //MessageBox.Show("卡号:"+this.txt_CardNumber.Text+"消费:"+this.txt_PayableAmount.Text+(result>0?"成功":"失败")); //this.Close(); }
private void btnPrint_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { List <string> vinList = new List <string>(); this.dgvCljbxx.DefaultView.PostEditor(); DataTable dtVIN = (DataTable)this.dgvCljbxx.DataSource; if (dtVIN != null && dtVIN.Rows.Count > 0) { for (int i = 0; i < dtVIN.Rows.Count; i++) { bool result = false; bool.TryParse(dtVIN.Rows[i]["check"].ToString(), out result); if (result) { string vin = (string)dtVIN.Rows[i]["vin"]; vinList.Add(vin); } } } if (vinList == null || vinList.Count != 1) { MessageBox.Show("选择一条打印数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } try { this.gridView1.PostEditor(); List <PrintModel> printModelList = new List <PrintModel>(); DataTable dt = (DataTable)dgvCljbxx.DataSource; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["check"].ToString() == "True") { PrintModel printModel = new PrintModel(); printModel.Qcscqy = dt.Rows[i]["QCSCQY"].ToString() == "" ? dt.Rows[i]["JKQCZJXS"].ToString() : dt.Rows[i]["QCSCQY"].ToString(); printModel.Clxh = dt.Rows[i]["CLXH"].ToString(); printModel.Zczbzl = dt.Rows[i]["ZCZBZL"].ToString(); string strRllx = dt.Rows[i]["RLLX"].ToString(); printModel.Qdxs = dt.Rows[i]["QDXS"].ToString(); printModel.Zdsjzzl = dt.Rows[i]["ZDSJZZL"].ToString(); #region if (strRllx == "汽油" || strRllx == "柴油" || strRllx == "两用燃料" || strRllx == "双燃料" || strRllx == "气体燃料") { try { string strPamSql = "SELECT A.PARAM_VALUE,A.PARAM_CODE,B.PARAM_NAME FROM RLLX_PARAM_ENTITY A, RLLX_PARAM B WHERE A.PARAM_CODE = B.PARAM_CODE AND A.VIN ='" + dt.Rows[i]["VIN"].ToString() + "'"; DataSet dsPam = AccessHelper.ExecuteDataSet(AccessHelper.conn, strPamSql, null); for (int j = 0; j < dsPam.Tables[0].Rows.Count; j++) { string strCode = dsPam.Tables[0].Rows[j]["PARAM_CODE"].ToString(); string strValue = dsPam.Tables[0].Rows[j]["PARAM_VALUE"].ToString(); if (strCode == "CT_FDJXH") { printModel.Fdjxh = strValue; } if (strCode == "CT_PL") { printModel.Pl = strValue; } if (strCode == "CT_BSQXS") { printModel.Bsqlx = strValue; } if (strCode == "CT_QTXX") { printModel.Qtxx = strValue; } if (strCode == "CT_EDGL") { printModel.Edgl = strValue; } if (strCode == "CT_SJGKRLXHL") { printModel.Sj = strValue; } if (strCode == "CT_SQGKRLXHL") { printModel.Sq = strValue; } if (strCode == "CT_ZHGKRLXHL") { printModel.Zh = strValue; } } } catch (Exception ex) { throw ex; }; printModel.Rllx = "传统能源"; } if (strRllx == "插电式混合动力") { try { string strPamSql = "SELECT A.PARAM_VALUE,A.PARAM_CODE,B.PARAM_NAME FROM RLLX_PARAM_ENTITY A, RLLX_PARAM B WHERE A.PARAM_CODE = B.PARAM_CODE AND A.VIN ='" + dt.Rows[i]["VIN"].ToString() + "'"; DataSet dsPam = AccessHelper.ExecuteDataSet(AccessHelper.conn, strPamSql, null); for (int j = 0; j < dsPam.Tables[0].Rows.Count; j++) { string strCode = dsPam.Tables[0].Rows[j]["PARAM_CODE"].ToString(); string strValue = dsPam.Tables[0].Rows[j]["PARAM_VALUE"].ToString(); if (strCode == "CDS_HHDL_FDJXH") { printModel.Fdjxh = strValue; } if (strCode == "CDS_HHDL_PL") { printModel.Pl = strValue; } if (strCode == "CDS_HHDL_BSQXS") { printModel.Bsqlx = strValue; } if (strCode == "CT_QTXX") { printModel.Qtxx = strValue; } if (strCode == "CDS_HHDL_EDGL") { printModel.Edgl = strValue; } if (strCode == "CDS_HHDL_ZHGKRLXHL") { printModel.Zh = strValue; } } } catch (Exception) { } } if (strRllx == "非插电式混合动力") { try { string strPamSql = "SELECT A.PARAM_VALUE,A.PARAM_CODE,B.PARAM_NAME FROM RLLX_PARAM_ENTITY A, RLLX_PARAM B WHERE A.PARAM_CODE = B.PARAM_CODE AND A.VIN ='" + dt.Rows[i]["VIN"].ToString() + "'"; DataSet dsPam = AccessHelper.ExecuteDataSet(AccessHelper.conn, strPamSql, null); for (int j = 0; j < dsPam.Tables[0].Rows.Count; j++) { string strCode = dsPam.Tables[0].Rows[j]["PARAM_CODE"].ToString(); string strValue = dsPam.Tables[0].Rows[j]["PARAM_VALUE"].ToString(); if (strCode == "FCDS_HHDL_FDJXH") { printModel.Fdjxh = strValue; } if (strCode == "FCDS_HHDL_PL") { printModel.Pl = strValue; } if (strCode == "FCDS_HHDL_BSQXS") { printModel.Bsqlx = strValue; } if (strCode == "CT_QTXX") { printModel.Qtxx = strValue; } if (strCode == "FCDS_HHDL_EDGL") { printModel.Edgl = strValue; } if (strCode == "FCDS_HHDL_SJGKRLXHL") { printModel.Sj = strValue; } if (strCode == "FCDS_HHDL_SQGKRLXHL") { printModel.Sq = strValue; } if (strCode == "FCDS_HHDL_ZHGKRLXHL") { printModel.Zh = strValue; } } } catch (Exception) { } } if (strRllx == "纯电动") { try { string strPamSql = "SELECT A.PARAM_VALUE,A.PARAM_CODE,B.PARAM_NAME FROM RLLX_PARAM_ENTITY A, RLLX_PARAM B WHERE A.PARAM_CODE = B.PARAM_CODE AND A.VIN ='" + dt.Rows[i]["VIN"].ToString() + "'"; DataSet dsPam = AccessHelper.ExecuteDataSet(AccessHelper.conn, strPamSql, null); for (int j = 0; j < dsPam.Tables[0].Rows.Count; j++) { string strCode = dsPam.Tables[0].Rows[j]["PARAM_CODE"].ToString(); string strValue = dsPam.Tables[0].Rows[j]["PARAM_VALUE"].ToString(); if (strCode == "CT_QTXX") { printModel.Qtxx = strValue; } if (strCode == "CDD_QDDJEDGL") { printModel.Edgl = strValue; } } } catch (Exception) { } } if (strRllx == "燃料电池") { try { string strPamSql = "SELECT A.PARAM_VALUE,A.PARAM_CODE,B.PARAM_NAME FROM RLLX_PARAM_ENTITY A, RLLX_PARAM B WHERE A.PARAM_CODE = B.PARAM_CODE AND A.VIN ='" + dt.Rows[i]["VIN"].ToString() + "'"; DataSet dsPam = AccessHelper.ExecuteDataSet(AccessHelper.conn, strPamSql, null); for (int j = 0; j < dsPam.Tables[0].Rows.Count; j++) { string strCode = dsPam.Tables[0].Rows[j]["PARAM_CODE"].ToString(); string strValue = dsPam.Tables[0].Rows[j]["PARAM_VALUE"].ToString(); if (strCode == "CT_QTXX") { printModel.Qtxx = strValue; } if (strCode == "RLDC_QDDJEDGL") { printModel.Edgl = strValue; } if (strCode == "RLDC_ZHGKHQL") { printModel.Zh = strValue; } } } catch (Exception) { } } printModel.Rllx = strRllx; #endregion printModel.Bah = dt.Rows[i]["VIN"].ToString(); printModel.Qysj = DateTime.Now.ToShortDateString(); printModelList.Add(printModel); } } Utils.printModel = printModelList; PrintForm pf = new PrintForm(); pf.ShowDialog(); } catch (Exception ex) { throw ex; } }
//打印 private void btnPrint_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { this.gvCLJBXX.PostEditor(); List <PrintModel> printModelList = new List <PrintModel>(); DataTable dt = (DataTable)gcCLJBXX.DataSource; if (dt != null) { var dSelected = dt.Copy(); dSelected.Clear(); for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["check"].ToString() == "True") { dSelected.Rows.Add(dt.Rows[i].ItemArray); PrintModel printModel = new PrintModel() { Qcscqy = dt.Rows[i]["QCSCQY"].ToString() == "" ? dt.Rows[i]["JKQCZJXS"].ToString() : dt.Rows[i]["QCSCQY"].ToString(), Clxh = dt.Rows[i]["CLXH"].ToString(), Zczbzl = dt.Rows[i]["ZCZBZL"].ToString(), Qdxs = dt.Rows[i]["QDXS"].ToString(), Zdsjzzl = dt.Rows[i]["ZDSJZZL"].ToString() }; string strRllx = dt.Rows[i]["RLLX"].ToString(); if (strRllx == "汽油" || strRllx == "柴油" || strRllx == "两用燃料" || strRllx == "双燃料") { try { DataSet dsPam = OracleHelper.ExecuteDataSet(OracleHelper.conn, String.Format("SELECT A.PARAM_VALUE,A.PARAM_CODE,B.PARAM_NAME FROM RLLX_PARAM_ENTITY A, RLLX_PARAM B WHERE A.PARAM_CODE = B.PARAM_CODE AND A.VIN ='{0}'", dt.Rows[i]["VIN"]), null); for (int j = 0; j < dsPam.Tables[0].Rows.Count; j++) { string strCode = dsPam.Tables[0].Rows[j]["PARAM_CODE"].ToString(); string strValue = dsPam.Tables[0].Rows[j]["PARAM_VALUE"].ToString(); if (strCode == "CT_FDJXH") { printModel.Fdjxh = strValue; } if (strCode == "CT_PL") { printModel.Pl = strValue; } if (strCode == "CT_BSQXS") { printModel.Bsqlx = strValue; } if (strCode == "CT_QTXX") { printModel.Qtxx = strValue; } if (strCode == "CT_EDGL") { printModel.Edgl = strValue; } if (strCode == "CT_SJGKRLXHL") { printModel.Sj = strValue; } if (strCode == "CT_SQGKRLXHL") { printModel.Sq = strValue; } if (strCode == "CT_ZHGKRLXHL") { printModel.Zh = strValue; } } } catch (Exception ex) { throw ex; }; } printModel.Rllx = strRllx; printModel.Bah = dt.Rows[i]["VIN"].ToString(); printModel.Qysj = DateTime.Now.ToShortDateString(); printModelList.Add(printModel); } } if (dSelected.Rows.Count != 1) { MessageBox.Show(String.Format("每次只能操作一条记录,您选择了{0}条!", dSelected.Rows.Count), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } else { MessageBox.Show(String.Format("没有可以操作的记录"), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } Utils.printModel = printModelList; using (PrintForm pf = new PrintForm()) { pf.ShowDialog(); } } catch (Exception ex) { throw ex; } }
private void btn_OK_Click(object sender, EventArgs e) { errorProvider1.Clear(); if (txt_PaymentAmount.Text.Trim() == "") { errorProvider1.SetError(txt_PaymentAmount, "请输入正确的金额!"); return; } try { Convert.ToDecimal(txt_PaymentAmount.Text.Trim()); } catch (Exception) { errorProvider1.SetError(txt_PaymentAmount, "请输入正确的金额!"); return; } model.CastId = manager.GetMaxId(); model.MemberId = addMemberModel.MemberID.ToString(); model.PriceAmount = Convert.ToDecimal(txt_PriceAmount.Text.Trim()); model.PaymentAmount = Convert.ToDecimal(txt_PaymentAmount.Text.Trim()); model.ChangeAmount = Convert.ToDecimal(txt_ChangeAmount.Text.Trim()); model.CreateTime = CommTools.GetDateFormatStrot2(DateTime.Now); model.AddTypeName = addMemberModel.CardType; model.CardID = addMemberModel.CardID; model.TypeName =cmb_PayType.Text.Trim(); model.Des = "售卡"; model.AddUserName = MainForm.userName; model.CusType = MainForm.CusType; model.CusState = 0; int isAdd = manager.Add(model); MessageBox.Show("会员:" + addMemberModel.Name + " 消费" + (isAdd > 0 ? "成功!" : "失败!")); CommTools.AddSystemLog("添加", "会员:" + addMemberModel.Name + " 消费信息 " + addMemberModel.CardType + "添加" + (isAdd > 0 ? "成功!" : "失败!")); PrintForm pf = new PrintForm(model.CusNum, model.AddTypeName, "1", txt_PriceAmount.Text.Trim(), txt_PriceAmount.Text.Trim(), "1", txt_PriceAmount.Text.Trim(), txt_PaymentAmount.Text.Trim(), txt_ChangeAmount.Text.Trim(), cmb_PayType.Text.Trim()); pf.ShowDialog(); this.Close(); }
private void DoAfterCaptureJobs() { if (Info.TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.AddImageEffects)) { tempImage = TaskHelpers.AddImageEffects(tempImage, Info.TaskSettings); } if (Info.TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.AddWatermark) && Info.TaskSettings.ImageSettings.WatermarkConfig != null) { Info.TaskSettings.ImageSettings.WatermarkConfig.Apply(tempImage); } if (Info.TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.AnnotateImage)) { tempImage = TaskHelpers.AnnotateImage(tempImage); } if (Info.TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.CopyImageToClipboard)) { ClipboardHelpers.CopyImage(tempImage); DebugHelper.WriteLine("CopyImageToClipboard"); } if (Info.TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.SendImageToPrinter)) { if (Program.Settings.DontShowPrintSettingsDialog) { using (PrintHelper printHelper = new PrintHelper(tempImage)) { printHelper.Settings = Program.Settings.PrintSettings; printHelper.Print(); } } else { using (PrintForm printForm = new PrintForm(tempImage, Program.Settings.PrintSettings)) { printForm.ShowDialog(); } } } if (Info.TaskSettings.AfterCaptureJob.HasFlagAny(AfterCaptureTasks.SaveImageToFile, AfterCaptureTasks.SaveImageToFileWithDialog, AfterCaptureTasks.UploadImageToHost)) { using (tempImage) { ImageData imageData = TaskHelpers.PrepareImage(tempImage, Info.TaskSettings); Data = imageData.ImageStream; Info.FileName = Path.ChangeExtension(Info.FileName, imageData.ImageFormat.GetDescription()); if (Info.TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.SaveImageToFile)) { string filePath = TaskHelpers.CheckFilePath(Info.TaskSettings.CaptureFolder, Info.FileName, Info.TaskSettings); if (!string.IsNullOrEmpty(filePath)) { Info.FilePath = filePath; imageData.Write(Info.FilePath); DebugHelper.WriteLine("SaveImageToFile: " + Info.FilePath); } } if (Info.TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.SaveImageToFileWithDialog)) { using (SaveFileDialog sfd = new SaveFileDialog()) { if (string.IsNullOrEmpty(lastSaveAsFolder) || !Directory.Exists(lastSaveAsFolder)) { lastSaveAsFolder = Info.TaskSettings.CaptureFolder; } sfd.InitialDirectory = lastSaveAsFolder; sfd.FileName = Info.FileName; sfd.DefaultExt = Path.GetExtension(Info.FileName).Substring(1); sfd.Filter = string.Format("*{0}|*{0}|All files (*.*)|*.*", Path.GetExtension(Info.FileName)); sfd.Title = "Choose a folder to save " + Path.GetFileName(Info.FileName); if (sfd.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(sfd.FileName)) { Info.FilePath = sfd.FileName; lastSaveAsFolder = Path.GetDirectoryName(Info.FilePath); imageData.Write(Info.FilePath); DebugHelper.WriteLine("SaveImageToFileWithDialog: " + Info.FilePath); } } } if (Info.TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.SaveThumbnailImageToFile)) { string thumbnailFilename, thumbnailFolder; if (!string.IsNullOrEmpty(Info.FilePath)) { thumbnailFilename = Path.GetFileName(Info.FilePath); thumbnailFolder = Path.GetDirectoryName(Info.FilePath); } else { thumbnailFilename = Info.FileName; thumbnailFolder = Info.TaskSettings.CaptureFolder; } Info.ThumbnailFilePath = TaskHelpers.CreateThumbnail(tempImage, thumbnailFolder, thumbnailFilename, Info.TaskSettings); if (!string.IsNullOrEmpty(Info.ThumbnailFilePath)) { DebugHelper.WriteLine("SaveThumbnailImageToFile: " + Info.ThumbnailFilePath); } } if (Info.TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.CopyFileToClipboard) && !string.IsNullOrEmpty(Info.FilePath) && File.Exists(Info.FilePath)) { ClipboardHelpers.CopyFile(Info.FilePath); } else if (Info.TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.CopyFilePathToClipboard) && !string.IsNullOrEmpty(Info.FilePath)) { ClipboardHelpers.CopyText(Info.FilePath); } if (Info.TaskSettings.AfterCaptureJob.HasFlag(AfterCaptureTasks.PerformActions) && Info.TaskSettings.ExternalPrograms != null && !string.IsNullOrEmpty(Info.FilePath) && File.Exists(Info.FilePath)) { var actions = Info.TaskSettings.ExternalPrograms.Where(x => x.IsActive); if (actions.Count() > 0) { if (Data != null) { Data.Dispose(); } foreach (ExternalProgram fileAction in actions) { fileAction.Run(Info.FilePath); } Data = new FileStream(Info.FilePath, FileMode.Open, FileAccess.Read, FileShare.Read); } } } } }
private void btnPrint_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (this.gvCljbxx.DataSource == null || ((DataTable)this.gvCljbxx.DataSource).Rows.Count < 1) { MessageBox.Show("当前没有数据可以操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (GridControlHelper.SelectedItems(this.gvCljbxx).Rows.Count != 1) { MessageBox.Show("当前只能操作一条记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } try { this.gvCljbxx.PostEditor(); List <PrintModel> printModelList = new List <PrintModel>(); DataTable dt = GridControlHelper.SelectedItems(this.gvCljbxx); if (dt.Rows[0]["check"].ToString() == "True") { PrintModel printModel = new PrintModel() { Qcscqy = dt.Rows[0]["QCSCQY"].ToString() == "" ? dt.Rows[0]["JKQCZJXS"].ToString() : dt.Rows[0]["QCSCQY"].ToString(), Clxh = dt.Rows[0]["CLXH"].ToString(), Zczbzl = dt.Rows[0]["ZCZBZL"].ToString() }; string strRllx = dt.Rows[0]["RLLX"].ToString(); printModel.Qdxs = dt.Rows[0]["QDXS"].ToString(); printModel.Zdsjzzl = dt.Rows[0]["ZDSJZZL"].ToString(); #region if (strRllx == "汽油" || strRllx == "柴油" || strRllx == "两用燃料" || strRllx == "双燃料") { try { string strPamSql = String.Format("SELECT A.PARAM_VALUE,A.PARAM_CODE,B.PARAM_NAME FROM RLLX_PARAM_ENTITY A, RLLX_PARAM B WHERE A.PARAM_CODE = B.PARAM_CODE AND A.VIN ='{0}'", dt.Rows[0]["VIN"]); DataSet dsPam = AccessHelper.ExecuteDataSet(AccessHelper.conn, strPamSql, null); for (int j = 0; j < dsPam.Tables[0].Rows.Count; j++) { string strCode = dsPam.Tables[0].Rows[j]["PARAM_CODE"].ToString(); string strValue = dsPam.Tables[0].Rows[j]["PARAM_VALUE"].ToString(); if (strCode == "CT_FDJXH") { printModel.Fdjxh = strValue; } if (strCode == "CT_PL") { printModel.Pl = strValue; } if (strCode == "CT_BSQXS") { printModel.Bsqlx = strValue; } if (strCode == "CT_QTXX") { printModel.Qtxx = strValue; } if (strCode == "CT_EDGL") { printModel.Edgl = strValue; } if (strCode == "CT_SJGKRLXHL") { printModel.Sj = strValue; } if (strCode == "CT_SQGKRLXHL") { printModel.Sq = strValue; } if (strCode == "CT_ZHGKRLXHL") { printModel.Zh = strValue; } } } catch (Exception) { }; } if (strRllx == "插电式混合动力") { try { string strPamSql = String.Format("SELECT A.PARAM_VALUE,A.PARAM_CODE,B.PARAM_NAME FROM RLLX_PARAM_ENTITY A, RLLX_PARAM B WHERE A.PARAM_CODE = B.PARAM_CODE AND A.VIN ='{0}'", dt.Rows[0]["VIN"]); DataSet dsPam = AccessHelper.ExecuteDataSet(AccessHelper.conn, strPamSql, null); for (int j = 0; j < dsPam.Tables[0].Rows.Count; j++) { string strCode = dsPam.Tables[0].Rows[j]["PARAM_CODE"].ToString(); string strValue = dsPam.Tables[0].Rows[j]["PARAM_VALUE"].ToString(); if (strCode == "CDS_HHDL_FDJXH") { printModel.Fdjxh = strValue; } if (strCode == "CDS_HHDL_PL") { printModel.Pl = strValue; } if (strCode == "CDS_HHDL_BSQXS") { printModel.Bsqlx = strValue; } if (strCode == "CT_QTXX") { printModel.Qtxx = strValue; } if (strCode == "CDS_HHDL_EDGL") { printModel.Edgl = strValue; } if (strCode == "CDS_HHDL_ZHGKRLXHL") { printModel.Zh = strValue; } } } catch (Exception) { }; } if (strRllx == "非插电式混合动力") { try { string strPamSql = String.Format("SELECT A.PARAM_VALUE,A.PARAM_CODE,B.PARAM_NAME FROM RLLX_PARAM_ENTITY A, RLLX_PARAM B WHERE A.PARAM_CODE = B.PARAM_CODE AND A.VIN ='{0}'", dt.Rows[0]["VIN"]); DataSet dsPam = AccessHelper.ExecuteDataSet(AccessHelper.conn, strPamSql, null); for (int j = 0; j < dsPam.Tables[0].Rows.Count; j++) { string strCode = dsPam.Tables[0].Rows[j]["PARAM_CODE"].ToString(); string strValue = dsPam.Tables[0].Rows[j]["PARAM_VALUE"].ToString(); if (strCode == "FCDS_HHDL_FDJXH") { printModel.Fdjxh = strValue; } if (strCode == "FCDS_HHDL_PL") { printModel.Pl = strValue; } if (strCode == "FCDS_HHDL_BSQXS") { printModel.Bsqlx = strValue; } if (strCode == "CT_QTXX") { printModel.Qtxx = strValue; } if (strCode == "FCDS_HHDL_EDGL") { printModel.Edgl = strValue; } if (strCode == "FCDS_HHDL_SJGKRLXHL") { printModel.Sj = strValue; } if (strCode == "FCDS_HHDL_SQGKRLXHL") { printModel.Sq = strValue; } if (strCode == "FCDS_HHDL_ZHGKRLXHL") { printModel.Zh = strValue; } } } catch (Exception) { }; } if (strRllx == "纯电动") { try { string strPamSql = String.Format("SELECT A.PARAM_VALUE,A.PARAM_CODE,B.PARAM_NAME FROM RLLX_PARAM_ENTITY A, RLLX_PARAM B WHERE A.PARAM_CODE = B.PARAM_CODE AND A.VIN ='{0}'", dt.Rows[0]["VIN"]); DataSet dsPam = AccessHelper.ExecuteDataSet(AccessHelper.conn, strPamSql, null); for (int j = 0; j < dsPam.Tables[0].Rows.Count; j++) { string strCode = dsPam.Tables[0].Rows[j]["PARAM_CODE"].ToString(); string strValue = dsPam.Tables[0].Rows[j]["PARAM_VALUE"].ToString(); if (strCode == "CT_QTXX") { printModel.Qtxx = strValue; } if (strCode == "CDD_QDDJEDGL") { printModel.Edgl = strValue; } } } catch (Exception) { }; } if (strRllx == "燃料电池") { try { string strPamSql = String.Format("SELECT A.PARAM_VALUE,A.PARAM_CODE,B.PARAM_NAME FROM RLLX_PARAM_ENTITY A, RLLX_PARAM B WHERE A.PARAM_CODE = B.PARAM_CODE AND A.VIN ='{0}'", dt.Rows[0]["VIN"]); DataSet dsPam = AccessHelper.ExecuteDataSet(AccessHelper.conn, strPamSql, null); for (int j = 0; j < dsPam.Tables[0].Rows.Count; j++) { string strCode = dsPam.Tables[0].Rows[j]["PARAM_CODE"].ToString(); string strValue = dsPam.Tables[0].Rows[j]["PARAM_VALUE"].ToString(); if (strCode == "CT_QTXX") { printModel.Qtxx = strValue; } if (strCode == "RLDC_QDDJEDGL") { printModel.Edgl = strValue; } if (strCode == "RLDC_ZHGKHQL") { printModel.Zh = strValue; } } } catch (Exception) { }; } printModel.Rllx = strRllx; #endregion printModel.Bah = dt.Rows[0]["VIN"].ToString(); printModel.Qysj = DateTime.Now.ToShortDateString(); printModelList.Add(printModel); } Utils.printModel = printModelList; using (PrintForm pf = new PrintForm()) { pf.ShowDialog(); } } catch (Exception) { MessageBox.Show("打印出错!", "异常", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_Print_Click(object sender, EventArgs e) { reportDlg.ShowDialog(); }