You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
103 lines
4.0 KiB
103 lines
4.0 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using DevExpress.XtraEditors;
|
|
using ICSSoft.Base.Language.Tool;
|
|
using ICSSoft.Base.UserControl.FormControl;
|
|
using ICSSoft.Base.UserControl.MessageControl;
|
|
using ICSSoft.Base.Config.AppConfig;
|
|
using ICSSoft.Base.Config.DBHelper;
|
|
|
|
namespace ICSSoft.Base.Lable.PrintTool
|
|
{
|
|
public partial class FormPrintLog : DevExpress.XtraEditors.XtraForm
|
|
{
|
|
private string _PrintTableName = "";
|
|
public FormPrintLog(string printTableName)
|
|
{
|
|
InitializeComponent();
|
|
_PrintTableName = printTableName;
|
|
BindGrd();
|
|
}
|
|
private void BindGrd()
|
|
{
|
|
string sql = @" SELECT l.LableName AS [打印模板] ,
|
|
a.PrintPointName AS [打印地点] ,
|
|
a.PrintName AS [打印机] ,
|
|
b.UserName AS [打印人] ,
|
|
CONVERT(VARCHAR(16), a.PrintDate, 21) AS [打印时间]
|
|
FROM dbo.Sys_LableTask a
|
|
LEFT JOIN dbo.Sys_User b ON a.PrintUserID = b.ID
|
|
LEFT JOIN dbo.Sys_Lables l ON a.LableID = l.ID
|
|
WHERE a.PrintFlag=1 AND a.WorkPointCode='{0}' AND ISNULL(a.PrintTableName,'')='{1}'";
|
|
sql = string.Format(sql, AppConfig.WorkPointCode, _PrintTableName);
|
|
DataTable data = DBHelper.ExecuteDataset(AppConfig.FrameConnectString, CommandType.Text, sql).Tables[0] ;
|
|
grdDetail.DataSource = data;
|
|
}
|
|
private void grvDetail_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
|
|
{
|
|
if (e.RowHandle < 0)
|
|
return;
|
|
e.Info.DisplayText = (e.RowHandle + 1).ToString();
|
|
}
|
|
|
|
private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
{
|
|
List<LangObj> langList = new List<LangObj>();
|
|
FormOutExcel foe = new FormOutExcel();
|
|
if (foe.ShowDialog() == DialogResult.OK)
|
|
{
|
|
try
|
|
{
|
|
string outtype = foe._OutType;
|
|
string exceltype = foe._ExcelType;
|
|
string filename = foe._FileName;
|
|
string url = foe._Url;
|
|
string sheetname = foe._SheetName;
|
|
if (outtype.ToLower() == "excel")
|
|
{
|
|
DevExpress.XtraPrinting.XlsExportOptions op = new DevExpress.XtraPrinting.XlsExportOptions();
|
|
op.SheetName = sheetname;
|
|
grdDetail.MainView.ExportToXls((url + "\\" + filename + (exceltype == "2003" ? ".xls" : ".xlsx")), op);
|
|
}
|
|
else
|
|
{
|
|
grdDetail.MainView.ExportToPdf(url + "\\" + filename + ".pdf");
|
|
}
|
|
LangObj langObj = new LangObj();
|
|
langObj.LConvertString = "输出成功";
|
|
langObj.LParameters = new object[] { };
|
|
langList.Add(langObj);
|
|
if (langList.Count > 0)
|
|
{
|
|
MessageDialog messBox = new MessageDialog(0, langList);
|
|
messBox.ShowDialog();
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LangObj langObj = new LangObj();
|
|
langObj.LConvertString = ex.Message;
|
|
langObj.LParameters = new object[] { };
|
|
langList.Add(langObj);
|
|
if (langList.Count > 0)
|
|
{
|
|
MessageDialog messBox = new MessageDialog(2, langList);
|
|
messBox.ShowDialog();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|