1074 lines
46 KiB
C#
1074 lines
46 KiB
C#
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;
|
|
using CommonLib;
|
|
using CommonLib.data;
|
|
using Lskj.Common;
|
|
using System.Data.SqlClient;
|
|
using DevExpress.XtraTab;
|
|
using Lskj.MyControl;
|
|
using DevExpress.Utils;
|
|
using DevExpress.XtraGrid.Views.Grid;
|
|
using DevExpress.XtraEditors;
|
|
using DevExpress.XtraBars;
|
|
using DevExpress.XtraGrid.Menu;
|
|
using DevExpress.Utils.Menu;
|
|
using DevExpress.XtraGrid.Columns;
|
|
using Lskj.MyControl.Panel_Chart;
|
|
using CommonLib.utils;
|
|
|
|
namespace Lskj.Report {
|
|
public partial class FrmMain : FormBase {
|
|
|
|
#region 主平台参数
|
|
public string ModuleDllId { get; set; }
|
|
public int AutoQuery { get; set; }
|
|
public string[] Params { get; set; }
|
|
#endregion
|
|
|
|
#region 私有属性
|
|
/// <summary>
|
|
/// The is column flag
|
|
/// </summary>
|
|
private bool isColumnFix;
|
|
private DataTable dtDllTab;
|
|
private int dllType;
|
|
private DataTable dtFileds;
|
|
private string Formkey;
|
|
private string SQL;
|
|
private string CondKey;
|
|
private string LeftGridSqlTag = string.Empty;
|
|
private DataRow tvLeftDataRow;
|
|
protected DataTable dtMainCond = new DataTable();
|
|
private DataTable dtSearchProject = new DataTable();
|
|
private MySearchCreateControl mcc = new MySearchCreateControl();
|
|
private string beforeSearchSQL;
|
|
/// <summary>
|
|
/// 数据库字段配置
|
|
/// </summary>
|
|
private DataRow mTabWordRow;
|
|
private string billModuleFile = string.Empty;
|
|
private string billPrintType = string.Empty;
|
|
private string billPrintSQL = string.Empty;
|
|
private string billPrintSQL1 = string.Empty;
|
|
private string billPrintSQL2 = string.Empty;
|
|
private int bottomHeight = 50;
|
|
private bool mInitFinish = false;
|
|
#endregion
|
|
|
|
#region 构造函数
|
|
public FrmMain() {
|
|
InitializeComponent();
|
|
|
|
this.SetStyle(ControlStyles.UserPaint, true);
|
|
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
|
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
|
|
|
//DevExpress.Skins.SkinManager.EnableFormSkins();
|
|
//DevExpress.XtraGrid.Localization.GridResLocalizer.Active = new Dxper.LocalizationCHS.Win.XtraGridCHS();
|
|
//DevExpress.XtraEditors.Controls.Localizer.Active = new Dxper.LocalizationCHS.Win.XtraEditorsCHS();
|
|
//DevExpress.XtraLayout.Localization.LayoutLocalizer.Active = new Dxper.LocalizationCHS.Win.XtraLayoutCHS();
|
|
//DevExpress.XtraPrinting.Localization.PreviewLocalizer.Active = new Dxper.LocalizationCHS.Win.XtraPrintingCHS();
|
|
this.Text = FormText;
|
|
//
|
|
gcMain.gridView.OptionsSelection.MultiSelect = true;
|
|
gcMain.gridView.OptionsSelection.MultiSelectMode = GridMultiSelectMode.CellSelect;
|
|
gcMain.gridView.OptionsBehavior.CopyToClipboardWithColumnHeaders = false;
|
|
|
|
gcMain.gridView.IndicatorWidth = 35;
|
|
//gcMain.gridView.PopupMenuShowing += new PopupMenuShowingEventHandler(gvMain_PopupMenuShowing);
|
|
PubClass.SelectCellCopy(this);
|
|
//gcMain.gridView.OptionsView.AllowCellMerge = true;
|
|
//gcMain.gridView.RowCellClick += new RowCellClickEventHandler(gvMain_RowCellClick);
|
|
gcMain.gridView.DoubleClick += new EventHandler(gvMain_DoubleClick);
|
|
gcMain.gridView.OptionsBehavior.Editable = false;
|
|
}
|
|
#endregion
|
|
|
|
private void gvMain_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
DataRow row = gcMain.gridView.GetDataRow(gcMain.gridView.FocusedRowHandle);
|
|
if (row != null)
|
|
{
|
|
foreach (XtraTabPage tab in tabMain.TabPages)
|
|
{
|
|
if (("" + tab.Tag).IndexOf("chart") <= 0)
|
|
{
|
|
GridControlEx gc = tab.Tag as GridControlEx;
|
|
gc.gridView.OptionsBehavior.Editable = false;
|
|
string sql = gc.gridView.Tag + "";
|
|
if (sql.IndexOf("{COLUMN_NAME}") != -1)
|
|
{
|
|
sql = sql.Replace("{COLUMN_NAME}", (gcMain.gridView as GridView).FocusedColumn.FieldName);
|
|
}
|
|
if (sql.IndexOf("{COLUMN_TITLE}") != -1)
|
|
{
|
|
sql = sql.Replace("{COLUMN_TITLE}", (gcMain.gridView as GridView).FocusedColumn.GetTextCaption());
|
|
}
|
|
string detailSql = PubClass.ReqSql(row, sql);
|
|
detailSql = PubClass.ReqSqlParam(detailSql, OperatorId, OperatorName);
|
|
//MessageBox.Show(detailSql);
|
|
//gc.SetDataSource(detailSql);
|
|
//上面的方式列会重置
|
|
DataTable dt=SqlHelper.ExecuteDataTable(detailSql);
|
|
gc.gridControl.DataSource = dt;
|
|
gc.gridView.BestFitColumns();
|
|
gc.gridView.Appearance.HeaderPanel.TextOptions.HAlignment = HorzAlignment.Center;
|
|
|
|
tab.Text = gc.GridText + "(" + gc.gridView.DataRowCount + ")";
|
|
if (gc.gridView.DataRowCount > 0)
|
|
{
|
|
tab.Appearance.Header.ForeColor = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
tab.Appearance.Header.ForeColor = Color.FromArgb(0, 0, 0);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Control[] ctr = this.Controls.Find((tab.Tag + "").Replace("p", ""), true);
|
|
if ((ctr != null) && (ctr.Length > 0))
|
|
{
|
|
Panel_Chart pc = ctr[0] as Panel_Chart;
|
|
if (pc != null)
|
|
{
|
|
string sql = pc.ConstSQL;
|
|
sql = PubClass.ReqSql(row, sql);
|
|
pc.SQL = sql;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#region 初始化数据
|
|
protected override void OnLoad(EventArgs e)
|
|
{
|
|
this.Text = FormText;
|
|
DLLCoid = string.IsNullOrEmpty(ModuleDllId) ? DLLCoid : ModuleDllId;
|
|
gcMain.gridView .Appearance.HeaderPanel.TextOptions.HAlignment = HorzAlignment.Center;
|
|
//加载模块信息
|
|
dtDllTab = SqlHelper.ExecuteDataSet("select * from p_systemDlltab where dllcoid='" + DLLCoid + "'").Tables[0];
|
|
if (dtDllTab != null && dtDllTab.Rows.Count > 0)
|
|
{
|
|
dllType = Convert.ToInt32(dtDllTab.Rows[0]["dllType"]);
|
|
SQL = dtDllTab.Rows[0]["SQL"] + "";
|
|
billPrintType = dtDllTab.Rows[0]["printType"].ToString();
|
|
billPrintSQL = dtDllTab.Rows[0]["printSQL"].ToString();
|
|
billPrintSQL1 = dtDllTab.Rows[0]["printSQL1"].ToString();
|
|
billPrintSQL2 = dtDllTab.Rows[0]["printSQL2"].ToString();
|
|
billModuleFile = dtDllTab.Rows[0]["printFile"].ToString();
|
|
bottomHeight = 50;
|
|
if (dtDllTab.Columns.Contains("bottomHeight"))
|
|
bottomHeight = Convert.ToInt32("0" + dtDllTab.Rows[0]["bottomHeight"]);
|
|
}
|
|
switch (dllType)
|
|
{
|
|
case DLLType.DllLeftTree:
|
|
LoadDllTree();
|
|
break;
|
|
case DLLType.DllLeftGrid:
|
|
LoadDllGrid();
|
|
|
|
string width = Lskj.PubUtils.INIHelper.Read("base_width_" + DLLCoid);
|
|
if (!string.IsNullOrEmpty(width))
|
|
{
|
|
pl_left.Width = Convert.ToInt32(width);
|
|
scLeft.SplitPosition = Convert.ToInt32(width);
|
|
}
|
|
else
|
|
{
|
|
pl_left.Width = Convert.ToInt32(dtDllTab.Rows[0]["leftWidth"]);
|
|
}
|
|
mInitFinish = true;
|
|
break;
|
|
case DLLType.DllLeft:
|
|
LoadDllDefault();
|
|
break;
|
|
}
|
|
//DataTable dtTag3 = SqlHelper.ExecuteDataTable(string.Format("select * from P_systemwordbooktab where tab='{0}' and fieldsqlTag=3", DLLCoid));
|
|
//if (dtTag3 != null && dtTag3.Rows.Count > 0)
|
|
// mTabWordRow = dtTag3.Rows[0];
|
|
LoadDllDeatil();
|
|
SearchCraeteControl();
|
|
|
|
InitMenu();
|
|
|
|
InitPrintMenu();
|
|
InitOperMenu();
|
|
|
|
//单据颜色
|
|
string colorSql = "select * from p_systemwordbookcolor where tab='" + DLLCoid + "'";
|
|
DataTable dtColor = SqlHelper.ExecuteDataSet(colorSql).Tables[0];
|
|
gcMain.RowColorCondtion = dtColor;
|
|
}
|
|
/// <summary>
|
|
/// 计算控件
|
|
/// </summary>
|
|
private void calcTopContent() {
|
|
|
|
}
|
|
/// <summary>
|
|
/// 打印
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void print_ItemClick(object sender, ItemClickEventArgs e) {
|
|
|
|
if (e.Item != null && string.IsNullOrWhiteSpace(e.Item.Tag + "")) return;
|
|
|
|
string tmpSql = string.IsNullOrEmpty(billPrintSQL) ? beforeSearchSQL : billPrintSQL;
|
|
string tmpSql1 = billPrintSQL1;
|
|
string tmpSql2 = billPrintSQL2;
|
|
string path = PubUtil.AbsolutelyPath + "lib/P_PubPrint.lsp";
|
|
string printFile = e.Item.Tag + "";
|
|
|
|
if (gcLeft.Visible)
|
|
{
|
|
if (string.IsNullOrEmpty(mcc.ActionSql))
|
|
{
|
|
//先查询数据在打印
|
|
XtraMessageBox.Show("先查询数据在打印", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
}
|
|
else
|
|
{
|
|
if (string.IsNullOrEmpty(billPrintType))
|
|
{
|
|
billPrintType = "1";
|
|
}
|
|
//tmpSql = "select " + OperatorId + " as OperatorId,'" + OperatorName + "' OperatorName,getdate() as CreateTime";
|
|
|
|
//tmpSql1 = mcc.ActionSql;
|
|
//tmpSql2 = mcc.ActionSql;
|
|
DataRow row = gcMain.gridView.GetFocusedDataRow();
|
|
tmpSql = PubClass.ReqSql(row, PubClass.ReqSqlParam(tmpSql, OperatorId, OperatorName));
|
|
tmpSql1 = PubClass.ReqSql(row, PubClass.ReqSqlParam(tmpSql1, OperatorId, OperatorName));
|
|
tmpSql2 = PubClass.ReqSql(row, PubClass.ReqSqlParam(tmpSql2, OperatorId, OperatorName));
|
|
PubUtil.LoadDelphiDll(path, path, printFile, tmpSql, tmpSql1, Convert.ToInt32(billPrintType), tmpSql2);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (string.IsNullOrEmpty(billPrintType))
|
|
{
|
|
billPrintType = "1";
|
|
}
|
|
if (string.IsNullOrEmpty(mcc.ActionSql))
|
|
{
|
|
// 先查询数据在打印
|
|
XtraMessageBox.Show("先查询数据在打印", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
}
|
|
else
|
|
{
|
|
DataRow row = gcMain.gridView.GetFocusedDataRow();
|
|
tmpSql = PubClass.ReqSql(row, PubClass.ReqSqlParam(tmpSql, OperatorId, OperatorName));
|
|
tmpSql1 = PubClass.ReqSql(row, PubClass.ReqSqlParam(tmpSql1, OperatorId, OperatorName));
|
|
tmpSql2 = PubClass.ReqSql(row, PubClass.ReqSqlParam(tmpSql2, OperatorId, OperatorName));
|
|
PubUtil.LoadDelphiDll(path, path, printFile, tmpSql, tmpSql1, Convert.ToInt32(billPrintType), tmpSql2);
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 初始常用工具
|
|
/// </summary>
|
|
public void InitPrintMenu() {
|
|
if (!string.IsNullOrEmpty(billModuleFile)) {
|
|
String[] strs = billModuleFile.Split('|');
|
|
for (int i = 0; i < strs.Length; i++) {
|
|
BarButtonItem bbi = new BarButtonItem();
|
|
int index = i + 1;
|
|
bbi.Caption = strs[i].Replace(".rmf", "");
|
|
bbi.Tag = strs[i];
|
|
bbi.ItemClick += new ItemClickEventHandler(print_ItemClick);
|
|
pMPrint.AddItem(bbi);
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 初始化常用功能
|
|
/// </summary>
|
|
public void InitOperMenu()
|
|
{
|
|
BarButtonItem bbi_export = new BarButtonItem();
|
|
bbi_export.Caption = "主表导出";
|
|
bbi_export.ItemClick += new ItemClickEventHandler(btnExport_Click);
|
|
|
|
BarButtonItem bbi_detail_export = new BarButtonItem();
|
|
bbi_detail_export.Caption = "明细导出";
|
|
bbi_detail_export.ItemClick += new ItemClickEventHandler(btnExportInfo_Click);
|
|
|
|
BarButtonItem bbi_print = new BarButtonItem();
|
|
bbi_print.Caption = "主表打印";
|
|
bbi_print.ItemClick += new ItemClickEventHandler(btnPrint_Click);
|
|
|
|
BarButtonItem bbi_detail_print = new BarButtonItem();
|
|
bbi_detail_print.Caption = "明细打印";
|
|
bbi_detail_print.ItemClick += new ItemClickEventHandler(btnPrintInfo_Click);
|
|
|
|
BarButtonItem bbi_word = new BarButtonItem();
|
|
bbi_word.Caption = "帮助文档";
|
|
bbi_word.ItemClick += new ItemClickEventHandler(btnHelp_Click);
|
|
|
|
if (tabMain.TabPages.Count == 0)
|
|
{
|
|
pm_oper.AddItem(bbi_export);
|
|
pm_oper.AddItem(bbi_print);
|
|
}
|
|
else
|
|
{
|
|
pm_oper.AddItem(bbi_export);
|
|
pm_oper.AddItem(bbi_detail_export);
|
|
pm_oper.AddItem(bbi_print);
|
|
pm_oper.AddItem(bbi_detail_print);
|
|
}
|
|
pm_oper.AddItem(bbi_word);
|
|
}
|
|
|
|
private void btnHelp_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
int id = 0;
|
|
object obj = SqlHelper.ExecuteScalar(CommandType.Text, "select dirid from P_fm_DirectoryTab where ParentId=3 and PID='" + DLLCoid + "'");
|
|
id = obj == null ? 0 : Convert.ToInt32(obj);
|
|
if (id == 0)
|
|
{
|
|
string sql = "insert into P_fm_DirectoryTab (sName,ParentId,creator,SpeciesNo,relationCode,PID) values('" + DLLCoid + "',3,1,'0201',0,'" + DLLCoid + "');select @@identity";
|
|
id = Convert.ToInt32(SqlHelper.ExecuteScalar(CommandType.Text, sql));
|
|
}
|
|
string[] args =
|
|
{
|
|
FormText,
|
|
OperatorId,
|
|
OperatorName,
|
|
Privilege,
|
|
DLLCoid,
|
|
ModuleId,
|
|
id.ToString()
|
|
};
|
|
IForm form = PubUtil.LoadDllForm2("Lskj.Attachment.dll", args);
|
|
form.SubForm.ShowDialog();
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
}
|
|
|
|
public void InitMenu() {
|
|
GridMenu gm = new GridMenu(FormText, OperatorId, OperatorName, Privilege, DLLCoid, "", gcMain.gridControl);
|
|
gm.BindGridMenu(DLLCoid);
|
|
gm.OnGridMenuClickRefreshData += new EventHandler(gm_OnGridMenuClickRefreshData);
|
|
|
|
if (mTabWordRow==null)//添加左边列表菜单
|
|
return;
|
|
string DllCoidLeft = mTabWordRow["fieldkey"].ToString();
|
|
GridMenu gm1 = new GridMenu(FormText, OperatorId, OperatorName, Privilege, DllCoidLeft, "", gcLeft);
|
|
gm1.DirId = dtDllTab.Rows[0]["dirid"] + "";
|
|
//gm1.filedKey = dtSystemwordbooktaNo["fieldname"].ToString();
|
|
gm1.BindGridMenu(DllCoidLeft);
|
|
gm1.OnGridMenuClickRefreshData += new EventHandler(gm_OnGridMenuClickRefreshDataLeft);
|
|
}
|
|
/// <summary>
|
|
/// 左边树刷新
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void gm_OnGridMenuClickRefreshDataLeft(object sender, EventArgs e)
|
|
{
|
|
refreshData();
|
|
}
|
|
|
|
private void gm_OnGridMenuClickRefreshData(object sender, EventArgs e)
|
|
{
|
|
//LoadDll();
|
|
refreshData();
|
|
//
|
|
}
|
|
|
|
private void gm_OnGridMenuClickRefreshDetailData(object sender, EventArgs e)
|
|
{
|
|
//LoadDll();
|
|
refreshData();
|
|
//
|
|
|
|
DataRow row = gcMain.gridView.GetDataRow(gcMain.gridView.FocusedRowHandle);
|
|
XtraTabPage tab = tabMain.SelectedTabPage;
|
|
//foreach (XtraTabPage tab in tabMain.TabPages)
|
|
//{
|
|
GridControlEx gc = tab.Tag as GridControlEx;
|
|
string sql = gc.gridView.Tag + "";
|
|
//string detailSql = PubClass.ReqSql(row, sql);
|
|
//detailSql = PubClass.ReqSqlParam(detailSql, OperatorId, OperatorName);
|
|
if (sql.IndexOf("{COLUMN_NAME}") != -1)
|
|
{
|
|
sql = sql.Replace("{COLUMN_NAME}", (gcMain.gridView as GridView).FocusedColumn.FieldName);
|
|
}
|
|
if (sql.IndexOf("{COLUMN_TITLE}") != -1)
|
|
{
|
|
sql = sql.Replace("{COLUMN_TITLE}", (gcMain.gridView as GridView).FocusedColumn.GetTextCaption());
|
|
}
|
|
string detailSql = PubClass.ReqSql(row, sql);
|
|
detailSql = PubClass.ReqSqlParam(detailSql, OperatorId, OperatorName);
|
|
gc.SetDataSource(detailSql);
|
|
gc.gridView.BestFitColumns();
|
|
gc.gridView.Appearance.HeaderPanel.TextOptions.HAlignment = HorzAlignment.Center;
|
|
// }
|
|
}
|
|
|
|
public void SearchCraeteControl() {
|
|
string sql = string.Format("exec p_getControlLocation '{0}','{1}','{2}'", CondKey, DLLCoid, OperatorName);
|
|
DataTable dt = SqlHelper.ExecuteDataSet(sql).Tables[0];
|
|
string condSql = string.Format("select * from p_systembillsourcecond where formKey='{0}'", CondKey);
|
|
mcc.LoginId = OperatorId;
|
|
mcc.ModuleId = ModuleId;
|
|
mcc.LoginName = OperatorName;
|
|
mcc.SearchSql = SQL;
|
|
mcc.ctr = pl_right_where;
|
|
mcc.gridEx = gcMain;
|
|
mcc.gce = gcMain.gridControl;
|
|
mcc.gcLeft = gcLeft;
|
|
mcc.tvLeft = tvList;
|
|
mcc.IsColumnFix = this.isColumnFix;
|
|
mcc.dllType = dllType;
|
|
mcc.LeftGridSqlTag = LeftGridSqlTag;
|
|
mcc.tvLeftDataRow = tvLeftDataRow;
|
|
mcc.condDt = SqlHelper.ExecuteDataSet(condSql).Tables[0];
|
|
mcc.otherParams = Params;
|
|
mcc.onSearchClick += new EventHandler(mcc_onSearchClick);
|
|
if (dt != null && dt.Rows.Count > 0) {
|
|
CreateControlModel cm = new CreateControlModel();
|
|
cm.dt = dt;
|
|
cm.ctr = pl_right_where;
|
|
cm.loginid = OperatorId;
|
|
cm.loginname = OperatorName;
|
|
int height = mcc.CreateControlByModel(cm);
|
|
pl_right_where.Height = height;
|
|
Control[] ctl = pl_right_where.Controls.Find("btnCondSearch", true);
|
|
if ((ctl != null) && (ctl.Length > 0)) {
|
|
(ctl[0] as SimpleButton).Width = 72;
|
|
pnlFunc.Left = (ctl[0] as SimpleButton).Left + 72;
|
|
pnlFunc.Top = (ctl[0] as SimpleButton).Top - 7;
|
|
}
|
|
else {
|
|
pnlFunc.Anchor = AnchorStyles.Right | AnchorStyles.Top;
|
|
}
|
|
}
|
|
if (AutoQuery == 1) {
|
|
mcc.runQuery();
|
|
}
|
|
}
|
|
|
|
private void mcc_onSearchClick(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(mcc.ActionSql))
|
|
{
|
|
this.beforeSearchSQL = mcc.ActionSql;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 加载左边是树
|
|
/// </summary>
|
|
public void LoadDllTree() {
|
|
tvList.BindTree(DLLCoid);
|
|
tvList.MyAfterSelect += new TreeViewEventHandler(tvList_TreeViewEventHandler);
|
|
tvList.Visible = true;
|
|
gcLeft.Visible = false;
|
|
LoadDll();
|
|
}
|
|
|
|
public void tvList_TreeViewEventHandler(object sender, TreeViewEventArgs e) {
|
|
if (e.Action == TreeViewAction.ByMouse) {
|
|
mcc.runQuery();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 加载左边Grid
|
|
/// </summary>
|
|
public void LoadDllGrid() {
|
|
DataTable dtGrid = SqlHelper.ExecuteDataSet("select * from p_systemwordbooktab where fieldsqlTag=3 and tab='" + DLLCoid + "'").Tables[0];
|
|
mTabWordRow = dtGrid.Rows[0];
|
|
if (dtGrid != null && dtGrid.Rows.Count > 0) {
|
|
string filedSql = dtGrid.Rows[0]["fieldsql"].ToString();
|
|
tvLeftDataRow = dtGrid.Rows[0];
|
|
LeftGridSqlTag = dtGrid.Rows[0]["fieldsqlid"].ToString();
|
|
filedSql = PubClass.ReqSqlParam(filedSql, OperatorId, OperatorName);
|
|
DataTable dtFiledSql = SqlHelper.ExecuteDataSet(filedSql).Tables[0];
|
|
gcLeft.DataSource = dtFiledSql;
|
|
string sql = "select * from p_systemwordbookgrid where fieldid=" + dtGrid.Rows[0]["Id"] + " and isnull(visible,0)=0 order by orderid";
|
|
PubControl.SetColumns3(gcLeft, sql);
|
|
}
|
|
tvList.Visible = false;
|
|
gcLeft.Visible = true;
|
|
LoadDll();
|
|
}
|
|
///<summary>
|
|
///刷新左边表格数据
|
|
/// </summary>
|
|
/// 加载一个列表
|
|
/// </summary>
|
|
public void refreshData()
|
|
{
|
|
if (gcLeft.Visible)
|
|
{
|
|
//记录之前选项
|
|
int oldSelect = gvLeft.FocusedRowHandle;
|
|
DataTable dtGrid = SqlHelper.ExecuteDataSet("select * from p_systemwordbooktab where fieldsqlTag=3 and tab='" + DLLCoid + "'").Tables[0];
|
|
if (dtGrid != null && dtGrid.Rows.Count > 0)
|
|
{
|
|
string filedSql = dtGrid.Rows[0]["fieldsql"].ToString();
|
|
filedSql = PubClass.ReqSqlParam(filedSql, OperatorId, OperatorName);
|
|
tvLeftDataRow = dtGrid.Rows[0];
|
|
LeftGridSqlTag = dtGrid.Rows[0]["fieldsqlid"].ToString();
|
|
DataTable dtFiledSql = SqlHelper.ExecuteDataSet(filedSql).Tables[0];
|
|
gcLeft.DataSource = dtFiledSql;
|
|
}
|
|
|
|
gvLeft.FocusedRowHandle = oldSelect;
|
|
}
|
|
int oldSelect1 = gcMain.gridView.FocusedRowHandle;
|
|
mcc.runQuery();
|
|
gcMain.gridView.FocusedRowHandle = oldSelect1;
|
|
}
|
|
public void LoadDllDefault() {
|
|
tvList.Visible = false;
|
|
gcLeft.Visible = false;
|
|
scLeft.Visible = false;
|
|
pl_left.Width = 0;
|
|
scLeft.Width = 0;
|
|
LoadDll();
|
|
}
|
|
/// <summary>
|
|
/// 加载明细
|
|
/// </summary>
|
|
public void LoadDllDeatil() {
|
|
tabMain.TabPages.Clear();
|
|
DataTable dtDetail = SqlHelper.ExecuteDataSet("select * from p_systemDlltabDetail where tab='" + DLLCoid + "' and isVisible=0 order by orderid").Tables[0];
|
|
bool hasChart = dtDetail.Columns.Contains("detailType");
|
|
foreach (DataRow row in dtDetail.Rows) {
|
|
XtraTabPage tabPage = new XtraTabPage();
|
|
tabPage.Text = row["detailName"] + "";
|
|
tabPage.Padding = new System.Windows.Forms.Padding(2);
|
|
hasChart = dtDetail.Columns.Contains("detailType");
|
|
if (hasChart)
|
|
hasChart = row["detailType"] + "" == "1";
|
|
if (!hasChart)
|
|
{
|
|
GridControlEx dgv = CreateDetailDgv(row);
|
|
dgv.GridText = row["detailName"] + "";
|
|
dgv.Name = "grid";
|
|
GridMenu gm = new GridMenu(FormText, OperatorId, OperatorName, Privilege, DLLCoid, "", dgv.gridControl);
|
|
gm.BindGridMenu(row["formKey"].ToString());
|
|
gm.OnGridMenuClickRefreshData += new EventHandler(gm_OnGridMenuClickRefreshDetailData);
|
|
tabPage.Controls.Add(dgv);
|
|
dgv.gridView.OptionsView.ShowFooter = true;
|
|
dgv.Dock = DockStyle.Fill;
|
|
|
|
tabPage.Tag = dgv;
|
|
}
|
|
else
|
|
{
|
|
tabPage.Tag = "pchart_" + row["id"];
|
|
|
|
Panel_Chart panel_ChartPage = new Panel_Chart();
|
|
tabPage.Controls.Add(panel_ChartPage);
|
|
panel_ChartPage.Dock = DockStyle.Fill;
|
|
panel_ChartPage.Name = "chart_" + row["id"];
|
|
panel_ChartPage.BringToFront();
|
|
panel_ChartPage.FormText = FormText;
|
|
panel_ChartPage.formKey = row["formKey"] + "";
|
|
panel_ChartPage.DLLCoid = DLLCoid;
|
|
panel_ChartPage.OperatorId = OperatorId;
|
|
panel_ChartPage.Privilege = Privilege;
|
|
panel_ChartPage.OperatorName = OperatorName;
|
|
String newSql = row["detailSQL"] + "";
|
|
newSql = PubClass.ReqSqlParam(newSql, OperatorId, OperatorName);
|
|
panel_ChartPage.ConstSQL = newSql;
|
|
|
|
GridMenu gm = new GridMenu(FormText, OperatorId, OperatorName, Privilege, DLLCoid, "", panel_ChartPage);
|
|
//gm.DirId = DirId;
|
|
string attachKey = row["formkey"] + "";
|
|
gm.BindGridMenuChart(attachKey);
|
|
|
|
}
|
|
tabMain.TabPages.Add(tabPage);
|
|
}
|
|
if (dtDetail != null && dtDetail.Rows.Count > 0) {
|
|
//gcMain.gridView.RowCellClick += new DevExpress.XtraGrid.Views.Grid.RowCellClickEventHandler(gvMain_RowCellClick);
|
|
if (bottomHeight <= 100)
|
|
pl_detail.Height = this.Height * bottomHeight / 100;
|
|
else
|
|
pl_detail.Height = bottomHeight;
|
|
//MessageBox.Show((this.Height * bottomHeight / 100).ToString());
|
|
gcMain.gridView.DoubleClick += new EventHandler(gvMain_DoubleClick);
|
|
}
|
|
else {
|
|
splitContainerControl1.PanelVisibility = SplitPanelVisibility.Panel1;
|
|
pl_detail.Visible = false;
|
|
pl_detail.Height = 0;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 点击显示明细信息
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void gvMain_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) {
|
|
DataRow row = gcMain.gridView.GetDataRow(e.RowHandle);
|
|
foreach (XtraTabPage tab in tabMain.TabPages) {
|
|
if ((""+tab.Tag).IndexOf("chart")<=0)
|
|
{
|
|
GridControlEx gc = tab.Tag as GridControlEx;
|
|
string sql = gc.gridView.Tag + "";
|
|
string detailSql = PubClass.ReqSql(row, sql);
|
|
detailSql = PubClass.ReqSqlParam(detailSql, OperatorId, OperatorName);
|
|
gc.SetDataSource(detailSql);
|
|
gc.gridView.Appearance.HeaderPanel.TextOptions.HAlignment = HorzAlignment.Center;
|
|
}
|
|
else
|
|
{
|
|
Control[] ctr = this.Controls.Find((tab.Tag+"").Replace("p",""), true);
|
|
if ((ctr != null) && (ctr.Length > 0))
|
|
{
|
|
Panel_Chart pc = ctr[0] as Panel_Chart;
|
|
if (pc != null)
|
|
{
|
|
string sql = pc.ConstSQL;
|
|
sql = PubClass.ReqSql(row, sql);
|
|
pc.SQL = sql;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public GridControlEx CreateDetailDgv(DataRow row) {
|
|
int detailId = Convert.ToInt32(row["Id"]);
|
|
string detailSql = Convert.ToString(row["detailSql"]);
|
|
SqlParameter[] p =
|
|
{
|
|
new SqlParameter("@modid",SqlDbType.VarChar,50),
|
|
new SqlParameter("@detailid",SqlDbType.Int,4),
|
|
new SqlParameter("@operatorname",SqlDbType.VarChar,50)
|
|
};
|
|
p[0].Value = DLLCoid;
|
|
p[1].Value = detailId;
|
|
p[2].Value = OperatorName;
|
|
dtFileds = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "p_getBaseModuleDetailField", "temp", p).Tables[0];
|
|
GridControlEx gcEx = new GridControlEx();
|
|
|
|
gcEx.ModuleKey = row["formkey"]+"";
|
|
gcEx.ModuleType = 2;
|
|
gcEx.FormKey = row["formkey"] + "";
|
|
|
|
detailSql = PubClass.ReqSqlParam(detailSql, OperatorId, OperatorName);
|
|
|
|
DataTable dtTable = gcEx.ResetColumns(dtFileds);
|
|
if (dtTable != null && dtTable.Rows.Count != 0)
|
|
{
|
|
gcEx.SetColumns(dtTable);
|
|
}
|
|
else
|
|
{
|
|
// 未配置列读取sql列
|
|
try
|
|
{
|
|
gcEx.IsColumnFix = true;
|
|
gcEx.SetColumns(detailSql);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
}
|
|
|
|
|
|
//gcEx.SetDataSource(detailSql);
|
|
gcEx.gridView.Tag = detailSql;
|
|
//gcEx.gridView.RowCellStyle += new RowCellStyleEventHandler(gridView_RowCellStyle);
|
|
gcEx.RowColorCondtion = SqlHelper.ExecuteDataSet(string.Format("select * from p_systemwordbookcolor where isnull(useflag,0)=0 and tab ='{0}' order by orderid", row["formkey"])).Tables[0];
|
|
return gcEx;
|
|
}
|
|
|
|
protected void gridView_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e) {
|
|
if (e.RowHandle >= 0) {
|
|
XtraTabPage tagpage = tabMain.SelectedTabPage;
|
|
if ((tagpage.Tag + "").IndexOf("chart") > 0)
|
|
return;
|
|
GridControlEx gce = tagpage.Tag as GridControlEx;
|
|
DataRow row = gce.gridView.GetDataRow(e.RowHandle);
|
|
//颜色集合
|
|
DataTable dt = gce.RowColorCondtion as DataTable;
|
|
//选择列
|
|
string cond = string.Empty;
|
|
string color = string.Empty;
|
|
string forecolor = string.Empty;
|
|
|
|
if (dt != null && dt.Rows.Count > 0 && row != null)
|
|
{
|
|
foreach (DataRow dr in dt.Rows) {
|
|
List<string> condition = PubClass.GetParamValue(dr["condition"].ToString());
|
|
cond = dr["condition"].ToString();
|
|
foreach (string item in condition) {
|
|
string filedName = item.Replace("{", "").Replace("}", "");
|
|
cond = cond.Replace(item, row[filedName].ToString());
|
|
}
|
|
cond = PubClass.SqlToCode(cond);
|
|
color = dr["backcolor"] + "";
|
|
forecolor = dr["forcecolor"].ToString() + "";
|
|
|
|
string obj = Evaluator.Eval(cond) + "";
|
|
if (obj.IndexOf("true", StringComparison.OrdinalIgnoreCase) != -1) {
|
|
if (!string.IsNullOrEmpty(color)) {
|
|
System.Drawing.Color color1 = System.Drawing.ColorTranslator.FromHtml(color);
|
|
e.Appearance.BackColor = color1;
|
|
}
|
|
if (!string.IsNullOrEmpty(forecolor)) {
|
|
System.Drawing.Color foreColor = System.Drawing.ColorTranslator.FromHtml(forecolor);
|
|
e.Appearance.ForeColor = foreColor;
|
|
|
|
}
|
|
FontStyle fst = new FontStyle();
|
|
if (dr["ifBold"].ToString() == "1") {
|
|
fst = fst | FontStyle.Bold;
|
|
}
|
|
if (dr["ifItalic"].ToString() == "1") {
|
|
fst = fst | FontStyle.Italic;
|
|
}
|
|
if (dr["ifStrickOut"].ToString() == "1") {
|
|
fst = fst | FontStyle.Strikeout;
|
|
}
|
|
if (dr["ifUnderLine"].ToString() == "1") {
|
|
fst = fst | FontStyle.Underline;
|
|
}
|
|
e.Appearance.Font = new Font(e.Appearance.Font, fst);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void gridView1_CustomDrawRowIndicator(object sender, RowIndicatorCustomDrawEventArgs e) {
|
|
e.Appearance.TextOptions.HAlignment = HorzAlignment.Center;
|
|
if (e.Info.IsRowIndicator) {
|
|
if (e.RowHandle >= 0) {
|
|
e.Info.DisplayText = (e.RowHandle + 1).ToString();
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 加载列表数据
|
|
/// </summary>
|
|
public void LoadDll() {
|
|
DataTable dtSystemdlltab = SqlHelper.ExecuteDataSet(string.Format("select * from p_systemdlltab where DllCoid='{0}'", DLLCoid)).Tables[0];
|
|
if (dtSystemdlltab.Rows.Count > 0) {
|
|
Formkey = dtSystemdlltab.Rows[0]["formKey"] + "";
|
|
CondKey = dtSystemdlltab.Rows[0]["CondKey"] + "";
|
|
}
|
|
SqlParameter[] p =
|
|
{
|
|
new SqlParameter("@modid",SqlDbType.VarChar,50),
|
|
new SqlParameter("@operatorname",SqlDbType.VarChar,50)
|
|
};
|
|
p[0].Value = DLLCoid;
|
|
p[1].Value = OperatorName;
|
|
dtFileds = SqlHelper.ExecuteDataSet(CommandType.StoredProcedure, "p_getBaseModuleField", "temp", p).Tables[0];
|
|
|
|
gcMain.ModuleKey = DLLCoid;
|
|
gcMain.ModuleType = 1;
|
|
gcMain.FormKey = Formkey;
|
|
|
|
DataTable dtTable = gcMain.ResetColumns(dtFileds);
|
|
if (dtTable != null && dtTable.Rows.Count > 0)
|
|
{
|
|
gcMain.SetColumns2(dtTable);
|
|
}
|
|
else
|
|
{
|
|
this.isColumnFix = true;
|
|
gcMain.SetColumns(PubClass.ReqSqlParam(SQL, ERPInfo.Instance.EmployeeId + "", ERPInfo.Instance.EmployeeName));
|
|
}
|
|
//PubControl.SetColumns(gcMain.gridControl, dtFileds);
|
|
//gcMain.gridView.RowCellStyle += new DevExpress.XtraGrid.Views.Grid.RowCellStyleEventHandler(gvMain_RowCellStyle);
|
|
dtMainCond = SqlHelper.ExecuteDataSet("select * from p_systemwordbookcolor where useflag=0 and tab='" + DLLCoid + "' order by orderid").Tables[0];
|
|
|
|
DataRow rowItem = dtMainCond.Select("1=1").FirstOrDefault(x => (x["condition"] + "").Contains("COLUMN_"));
|
|
if (rowItem != null)
|
|
{
|
|
gcMain.ReleaseEvent();
|
|
gcMain.gridView.RowCellStyle -= new DevExpress.XtraGrid.Views.Grid.RowCellStyleEventHandler(gvMain_RowCellStyle);
|
|
gcMain.gridView.RowCellStyle += new DevExpress.XtraGrid.Views.Grid.RowCellStyleEventHandler(gvMain_RowCellStyle);
|
|
|
|
}
|
|
|
|
//gcMain.gridView.RowStyle.;
|
|
|
|
}
|
|
protected void gvMain_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e) {
|
|
if (e.RowHandle >= 0) {
|
|
//选择列
|
|
string cond = string.Empty;
|
|
string color = string.Empty;
|
|
string forecolor = string.Empty;
|
|
DataRow row = gcMain.gridView.GetDataRow(e.RowHandle);
|
|
foreach (DataRow dr in dtMainCond.Rows) {
|
|
|
|
List<string> condition = PubClass.GetParamValue(dr["condition"].ToString());
|
|
cond = dr["condition"].ToString();
|
|
foreach (string item in condition) {
|
|
string filedName = item.Replace("{", "").Replace("}", "");
|
|
cond = cond.Replace(item, row[filedName].ToString());
|
|
}
|
|
cond = PubClass.SqlToCode(cond);
|
|
color = dr["backcolor"] + "";
|
|
forecolor = dr["forcecolor"].ToString() + "";
|
|
|
|
string obj = Evaluator.Eval(cond) + "";
|
|
if (obj.IndexOf("true", StringComparison.OrdinalIgnoreCase) != -1) {
|
|
if (!string.IsNullOrEmpty(color)) {
|
|
System.Drawing.Color color1 = System.Drawing.ColorTranslator.FromHtml(color);
|
|
e.Appearance.BackColor = color1;
|
|
}
|
|
if (!string.IsNullOrEmpty(forecolor)) {
|
|
System.Drawing.Color foreColor = System.Drawing.ColorTranslator.FromHtml(forecolor);
|
|
e.Appearance.ForeColor = foreColor;
|
|
|
|
}
|
|
FontStyle fst = new FontStyle();
|
|
if (dr["ifBold"].ToString() == "1") {
|
|
fst = fst | FontStyle.Bold;
|
|
}
|
|
if (dr["ifItalic"].ToString() == "1") {
|
|
fst = fst | FontStyle.Italic;
|
|
}
|
|
if (dr["ifStrickOut"].ToString() == "1") {
|
|
fst = fst | FontStyle.Strikeout;
|
|
}
|
|
if (dr["ifUnderLine"].ToString() == "1") {
|
|
fst = fst | FontStyle.Underline;
|
|
}
|
|
e.Appearance.Font = new Font(e.Appearance.Font, fst);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 释放资源
|
|
/// <summary>
|
|
/// 释放资源
|
|
/// </summary>
|
|
/// <param name="e"></param>
|
|
protected override void OnClosed(EventArgs e) {
|
|
if (!string.IsNullOrEmpty(ModuleId) && PubUtil.ModuleForms.ContainsKey(ModuleId)) {
|
|
DllModule dm = PubUtil.ModuleForms[ModuleId];
|
|
if (dm != null) {
|
|
dm.ModuleForm = null;
|
|
dm.ModuleInPtr = IntPtr.Zero;
|
|
PubUtil.ModuleForms.Remove(ModuleId);
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 导出数据
|
|
private void btnExport_Click(object sender, EventArgs e) {
|
|
PubClass.SaveXls(gcMain.gridControl);
|
|
}
|
|
#endregion
|
|
|
|
#region 打印
|
|
private void btnPrint_Click(object sender, EventArgs e) {
|
|
PubClass.Preview(gcMain.gridControl);
|
|
}
|
|
#endregion
|
|
|
|
#region 表格列扩展
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
public void gvMain_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e)
|
|
{
|
|
//判断是否是列标题的右键菜单
|
|
if (e.MenuType == GridMenuType.Column)
|
|
{
|
|
GridViewColumnMenu menu = e.Menu as GridViewColumnMenu;
|
|
string mergeCaption = "数据合并";
|
|
string gridMerge = "开启数据合并";
|
|
if (gcMain.gridView.OptionsView.AllowCellMerge)
|
|
gridMerge = "关闭数据合并";
|
|
if (e.HitInfo.Column.OptionsColumn.AllowMerge == DefaultBoolean.True)
|
|
mergeCaption = "取消合并";
|
|
DXMenuItem itemFixLeft = new DXMenuItem("冻结列(左)", OnFixLeftItemClick);
|
|
DXMenuItem itemFixRight = new DXMenuItem("冻结列(右)", OnFixRightItemClick);
|
|
DXMenuItem itemUnFix = new DXMenuItem("取消冻结", OnUnFixItemClick);
|
|
DXMenuItem gridMergeItem = new DXMenuItem(gridMerge, OnGridMergeItemClick);
|
|
DXMenuItem itemMerge = new DXMenuItem(mergeCaption, OnMergeItemClick);
|
|
|
|
itemFixLeft.Tag = itemFixRight.Tag = itemUnFix.Tag = e.HitInfo.Column;
|
|
itemFixLeft.Image = itemFixRight.Image = imageList1.Images["lock.png"];
|
|
itemUnFix.Image = imageList1.Images["unlock.png"];
|
|
itemMerge.Tag = e.HitInfo.Column;
|
|
gridMergeItem.Tag = gcMain.gridView;
|
|
|
|
if (e.HitInfo.Column.Fixed == FixedStyle.Left)
|
|
itemFixLeft.Enabled = false;
|
|
if (e.HitInfo.Column.Fixed == FixedStyle.Right)
|
|
itemFixRight.Enabled = false;
|
|
if (e.HitInfo.Column.Fixed == FixedStyle.None)
|
|
itemUnFix.Enabled = false;
|
|
itemMerge.Enabled = gcMain.gridView.OptionsView.AllowCellMerge;
|
|
|
|
itemFixLeft.BeginGroup = true;
|
|
|
|
menu.Items.Add(itemFixLeft);
|
|
menu.Items.Add(itemFixRight);
|
|
menu.Items.Add(itemUnFix);
|
|
gridMergeItem.BeginGroup = true;
|
|
menu.Items.Add(gridMergeItem);
|
|
menu.Items.Add(itemMerge);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 冻结列左侧
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnFixLeftItemClick(object sender, EventArgs e)
|
|
{
|
|
DXMenuItem item = sender as DXMenuItem;
|
|
GridColumn column = item.Tag as GridColumn;
|
|
column.Fixed = FixedStyle.Left;
|
|
}
|
|
/// <summary>
|
|
/// 冻结列右侧
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnFixRightItemClick(object sender, EventArgs e)
|
|
{
|
|
DXMenuItem item = sender as DXMenuItem;
|
|
GridColumn column = item.Tag as GridColumn;
|
|
column.Fixed = FixedStyle.Right;
|
|
}
|
|
/// <summary>
|
|
/// 取消冻结列
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnUnFixItemClick(object sender, EventArgs e)
|
|
{
|
|
DXMenuItem item = sender as DXMenuItem;
|
|
GridColumn column = item.Tag as GridColumn;
|
|
column.Fixed = FixedStyle.None;
|
|
column.VisibleIndex = column.AbsoluteIndex;
|
|
}
|
|
/// <summary>
|
|
/// 合并
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnMergeItemClick(object sender, EventArgs e)
|
|
{
|
|
|
|
DXMenuItem item = sender as DXMenuItem;
|
|
GridColumn column = item.Tag as GridColumn;
|
|
//column.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.True;
|
|
if (column.OptionsColumn.AllowMerge == DefaultBoolean.True)
|
|
column.OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.False;
|
|
else
|
|
column.OptionsColumn.AllowMerge = DevExpress.Utils.DefaultBoolean.True;
|
|
}
|
|
/// <summary>
|
|
/// 合并
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnGridMergeItemClick(object sender, EventArgs e)
|
|
{
|
|
|
|
DXMenuItem item = sender as DXMenuItem;
|
|
GridView grv = item.Tag as GridView;
|
|
//column.OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.True;
|
|
if (grv.OptionsView.AllowCellMerge == true)
|
|
grv.OptionsView.AllowCellMerge = false;
|
|
else
|
|
{
|
|
grv.OptionsView.AllowCellMerge = true;
|
|
MessageBox.Show("请注意:数据合并模式已开启,该模式下将不能进行区域选择、复制和粘贴\r\n要退出合并模式请再次点击进行切换");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
private void gvMain_KeyDown(object sender, KeyEventArgs e) {
|
|
if (sender != null && e != null)
|
|
{
|
|
if (e.Control & e.KeyCode == Keys.C)
|
|
{
|
|
//object obj = (sender as GridView).GetFocusedRowCellValue((sender as GridView).FocusedColumn);
|
|
object obj= this.gcMain.gridView.GetFocusedRowCellValue(this.gcMain.gridView.FocusedColumn);
|
|
if (obj != null)
|
|
{
|
|
Clipboard.SetDataObject(obj + "");
|
|
e.Handled = true;
|
|
}
|
|
//gcMain.gridView.CopyToClipboard();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void btnExportInfo_Click(object sender, EventArgs e) {
|
|
if (tabMain.TabPages.Count > 0) {
|
|
XtraTabPage tabPage = tabMain.SelectedTabPage;
|
|
Control[] ctrs = tabPage.Controls.Find("grid", true);
|
|
if (ctrs.Length > 0) {
|
|
GridControlEx gce = (GridControlEx)ctrs[0];
|
|
PubClass.SaveXls(gce.gridControl);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void btnPrintInfo_Click(object sender, EventArgs e) {
|
|
if (tabMain.TabPages.Count > 0) {
|
|
XtraTabPage tabPage = tabMain.SelectedTabPage;
|
|
Control[] ctrs = tabPage.Controls.Find("grid", true);
|
|
if (ctrs.Length > 0) {
|
|
GridControlEx gce = (GridControlEx)ctrs[0];
|
|
PubClass.Preview(gce.gridControl);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void tabMain_Click(object sender, EventArgs e) {
|
|
|
|
}
|
|
|
|
private void gvLeft_RowCellClick(object sender, RowCellClickEventArgs e) {
|
|
mcc.runQuery();
|
|
}
|
|
|
|
//private void gvLeft_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
|
|
//{
|
|
// //mcc.runQuery();
|
|
//}
|
|
|
|
private void pl_left_Resize(object sender, EventArgs e)
|
|
{
|
|
if (mInitFinish)
|
|
{
|
|
Lskj.PubUtils.INIHelper.Write("base_width_" + DLLCoid, pl_left.Width + "");
|
|
}
|
|
}
|
|
}
|
|
}
|