using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Text;
|
using System.Windows.Forms;
|
using System.Runtime.InteropServices;
|
using gregn6Lib;
|
using SQLHelper;
|
|
namespace BLL
|
{
|
public partial class Xt_ICInventoryDlg : Form
|
{
|
public Xt_ICInventoryDlg()
|
{
|
InitializeComponent();
|
}
|
public DBUtility.frm_B_BillQueryCondition_New frmCondition;
|
const string ViewName = "h_v_Xt_ICInventoryDlg";
|
const string ModCaption = "即使库存查询";
|
//
|
public string sWhere = "";
|
//
|
Pub_Class.ClsGridListSum oSumGrid = new Pub_Class.ClsGridListSum();
|
//
|
private void initGrid()
|
{
|
DBUtility.Xt_BaseBillFun.initGridList(grdMain, this.Name);
|
}
|
//
|
|
private void Display()
|
{
|
ClsCN SubCn = new ClsCN();
|
DataSet DSet;
|
string sSql = "";
|
try
|
{
|
//过滤条件
|
sSql = "select * from " + ViewName + sWhere + " order by 物料代码,仓库代码";
|
//
|
DSet = SubCn.RunProcReturn(sSql, "h_v_Xt_ICInventoryDlg", ref DBUtility.ClsPub.sExeReturnInfo);
|
//生成首行标题
|
if (DSet == null || DSet.Tables[0].Rows.Count ==0 )
|
{
|
//MessageBox.Show("没有返回任何结果,尝试再次查询!" + DBUtility.ClsPub.sExeReturnInfo);
|
return;
|
}
|
//释放冻结
|
//DBUtility.Xt_BaseBillFun.CancelFrozenCol(grdMain);
|
//绑定
|
grdMain.DataSource = DSet.Tables[0].DefaultView;
|
//设置合计列
|
string sTotalCol = "";
|
sTotalCol = DBUtility.Gy_BaseFun.GetTotalCols(DSet);
|
string[] sT;
|
sT = sTotalCol.Split(Convert.ToChar(","));
|
oSumGrid.BuildTotalCols(sT);
|
//
|
//冻结
|
//int FrCol = DBUtility.ClsPub.isInt(frmCondition.txtFrozenCol.Text);
|
//string s = "";
|
//DBUtility.Xt_BaseBillFun.DisplayGrid(grdMain, this.Name, s, FrCol);
|
//画线
|
//GraphLine();
|
|
DBUtility.Xt_BaseBillFun.GetGrid(grdMain, this.Name);
|
//
|
Total();
|
}
|
catch (Exception e)
|
{
|
MessageBox.Show("显示失败!"+e.Message);
|
}
|
}
|
|
//合计 list
|
private void Total()
|
{
|
if (grdMain.Rows.Count > 0 && grdMain.ColumnCount > 0)
|
{
|
oSumGrid.SetGridsum();
|
oSumGrid.Total();
|
}
|
}
|
private void timer1_Tick(object sender, EventArgs e)
|
{
|
timer1.Enabled = false;
|
//initGrid();
|
Display();
|
}
|
|
private void tc_Click(object sender, EventArgs e)
|
{
|
this.Close();
|
}
|
|
private void sx_Click(object sender, EventArgs e)
|
{
|
timer1.Enabled = true;
|
}
|
|
private void dj_Click(object sender, EventArgs e)
|
{
|
Sub_ShowBill();
|
}
|
|
private void Sub_ShowBill()
|
{
|
|
}
|
|
private Int32 Fun_GetCol(string sCol)
|
{
|
return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdMain);
|
}
|
|
private void Xt_ICInventoryDlg_Load(object sender, EventArgs e)
|
{
|
//
|
this.Text = ModCaption;
|
lblCaption.Text = ModCaption;
|
oSumGrid.ogrdMain = grdMain; //初始化 list
|
oSumGrid.oGridsum = grdSum; //list
|
initGrid();
|
}
|
|
|
private void cx_Click(object sender, EventArgs e)
|
{
|
|
Display();
|
}
|
|
private void xz_Click(object sender, EventArgs e)
|
{
|
|
}
|
|
private void sc_Click(object sender, EventArgs e)
|
{
|
Sub_DeleteBill();
|
}
|
//删除
|
private void Sub_DeleteBill()
|
{
|
|
}
|
|
private void timer2_Tick(object sender, EventArgs e)
|
{
|
timer2.Enabled = false;
|
|
timer1.Enabled = true;
|
}
|
|
private void yl_Click(object sender, EventArgs e)
|
{
|
|
}
|
|
private void bclk_Click(object sender, EventArgs e)
|
{
|
//保存列宽
|
DBUtility.Xt_BaseBillFun.SaveGrid(grdMain, this.Name);
|
}
|
|
private void mrlk_Click(object sender, EventArgs e)
|
{
|
DBUtility.Xt_BaseBillFun.DefaultGridView(grdMain, this.Name);
|
}
|
//划线
|
private void GraphLine()
|
{
|
int MainIDCol = Fun_GetCol("hmainid");
|
int SubIDCol = Fun_GetCol("hsubid");
|
string s ="";
|
long n = 0;
|
DBUtility.Xt_BaseBillFun.GraphLine(grdMain, MainIDCol, SubIDCol, s, ref n);
|
//显示
|
lbldj.Text = "查询出 " + n.ToString() + " 张单据";
|
lbljl.Text = "共有 " + grdMain.RowCount.ToString() + " 条记录";
|
|
}
|
//设置网格
|
private void SetDataGrid(int BRow, int BCol, int ERow, int ECol, string sText)
|
{
|
for (int i = BRow; i <= ERow; i++)
|
{
|
for (int j = BCol; j <= ECol; j++)
|
{
|
grdMain.Rows[i].Cells[j].Value = DBNull.Value;
|
}
|
}
|
|
}
|
|
//审核
|
private void sh_Click(object sender, EventArgs e)
|
{
|
this.Sub_CheckBill();
|
}
|
//审核单据
|
private void Sub_CheckBill()
|
{
|
|
}
|
//反审单据
|
private void Sub_AbandonCheck()
|
{
|
|
}
|
//反审核
|
private void qsh_Click(object sender, EventArgs e)
|
{
|
Sub_AbandonCheck();
|
}
|
|
private void grdMain_DoubleClick(object sender, EventArgs e)
|
{
|
Sub_ShowBill();
|
}
|
|
private void grdMain_Paint(object sender, PaintEventArgs e)
|
{
|
GraphicsGrid();
|
}
|
|
private void GraphicsGrid()
|
{
|
|
Graphics g = grdMain.CreateGraphics();
|
Pen p = new Pen(Color.Black);
|
p.Width = 1;
|
int lWidth;
|
if (grdMain.RowHeadersVisible)
|
lWidth = grdMain.RowHeadersWidth;
|
else
|
lWidth = 0;
|
foreach (DataGridViewColumn col in grdMain.Columns)
|
{
|
lWidth += col.Width;
|
}
|
int sWidth;
|
if (grdMain.ColumnHeadersVisible)
|
sWidth = grdMain.ColumnHeadersHeight;
|
else
|
sWidth = 0;
|
foreach (DataGridViewRow col in grdMain.Rows)
|
{
|
sWidth += col.Height;
|
if (col.Index == grdMain.RowCount - 1)
|
{
|
g.DrawLine(p, new Point(0, sWidth), new Point(lWidth, sWidth));
|
}
|
}
|
}
|
|
private void grdMain_DoubleClick_1(object sender, EventArgs e)
|
{
|
Sub_ShowBill();
|
}
|
|
private void grdMain_Paint_1(object sender, PaintEventArgs e)
|
{
|
GraphicsGrid();
|
}
|
|
private void grdMain_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e) //list 先定义事件
|
{
|
Total();
|
}
|
|
private void grdMain_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e) //list 先定义事件
|
{
|
Total();
|
}
|
|
private void grdMain_RowHeadersWidthChanged(object sender, EventArgs e) //list 先定义事件
|
{
|
Total();
|
}
|
}
|
}
|