100 lines
3.4 KiB
C#
100 lines
3.4 KiB
C#
using EAS.Services;
|
|
using FastReport;
|
|
using SOH.BLL;
|
|
using SOH.Entities.DTO;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace SOH.ShouFei
|
|
{
|
|
public partial class frmPrintXiaoPiao : SOH.Window.baseChildForm
|
|
{
|
|
public bool showview = false;
|
|
public frmPrintXiaoPiao()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void init(dto_xpdy xpdy,string lx)
|
|
{
|
|
DataTable dt = new DataTable();
|
|
dt.Columns.Add("fdmc", typeof(string));
|
|
dt.Columns.Add("tm", typeof(string));
|
|
dt.Columns.Add("xm", typeof(string));
|
|
dt.Columns.Add("dw", typeof(string));
|
|
dt.Columns.Add("xb", typeof(string));
|
|
dt.Columns.Add("nl", typeof(string));
|
|
dt.Columns.Add("xj", typeof(string));
|
|
dt.Columns.Add("yhk", typeof(string));
|
|
dt.Columns.Add("zfb", typeof(string));
|
|
dt.Columns.Add("weixin", typeof(string));
|
|
dt.Columns.Add("sfxm", typeof(string));
|
|
dt.Columns.Add("sfsj", typeof(string));
|
|
dt.Columns.Add("sfje", typeof(string));
|
|
dt.Columns.Add("czy", typeof(string));
|
|
DataRow dr = dt.NewRow();
|
|
dr["fdmc"] = xpdy.fdmc;
|
|
dr["tm"] = xpdy.tm;
|
|
dr["xm"] = xpdy.xm;
|
|
dr["dw"] = xpdy.dw;
|
|
dr["xb"] = xpdy.v_xb;
|
|
dr["nl"] = xpdy.nl;
|
|
dr["xj"] = (Convert.ToDouble(xpdy.xj)*0.01).ToString();
|
|
dr["yhk"] = (Convert.ToDouble(xpdy.yhk) * 0.01).ToString();
|
|
dr["zfb"] = (Convert.ToDouble(xpdy.zfb) * 0.01).ToString();
|
|
dr["weixin"] = (Convert.ToDouble(xpdy.weixin) * 0.01).ToString();
|
|
dr["sfxm"] = xpdy.sfxm;
|
|
dr["sfsj"] = xpdy.sfsj;
|
|
dr["sfje"] = (Convert.ToDouble(xpdy.sfje) * 0.01).ToString();
|
|
dr["czy"] = xpdy.czy;
|
|
dt.Rows.Add(dr);
|
|
|
|
Report r = new Report();
|
|
r.Load(System.Windows.Forms.Application.StartupPath + "\\report\\report_xiaopiao.frx");
|
|
r.RegisterData(dt, "xpDt");
|
|
r.SetParameterValue("lx", lx);
|
|
r.Preview = printpreview;
|
|
r.Refresh();
|
|
r.Show();
|
|
}
|
|
|
|
public void print()
|
|
{
|
|
if (printpreview.Report == null)
|
|
{
|
|
MessageBox.Show("请先初始化数据!");
|
|
return;
|
|
}
|
|
if (showview)
|
|
{
|
|
if (!this.Visible)
|
|
{
|
|
this.Show();
|
|
//printpreview.Report.Show();
|
|
}
|
|
return;
|
|
}
|
|
btn_print_Click(null, null);
|
|
}
|
|
|
|
private void btn_print_Click(object sender, EventArgs e)
|
|
{
|
|
string printname = "";
|
|
System.Configuration.Configuration cm = System.Configuration.ConfigurationManager.OpenExeConfiguration(AppDomain.CurrentDomain.BaseDirectory + "\\local.ext");
|
|
printname = cm.AppSettings.Settings["xpdyjmc"].Value;
|
|
if (!string.IsNullOrEmpty(printname))
|
|
{
|
|
printpreview.Report.PrintSettings.Printer = printname;
|
|
}
|
|
printpreview.Report.PrintSettings.ShowDialog = false;
|
|
printpreview.Report.Print();
|
|
}
|
|
}
|
|
}
|