using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using BaseSet; using System.Windows.Forms; namespace OAM { public partial class frm_MeetingBilllist : Form { public frm_MeetingBill ofrm_MeetingBill = new frm_MeetingBill(); TreeNode CurNode = new TreeNode(); //ÏÔʾÁбí private void Display() // »ÃÐÄ { SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); DataSet DSet; string sSql = ""; string sWhere = ""; //sSql = "Select * from h_v_EmployeeConList order by ͨѶ¼´úÂë"; string oHInterID = CurNode.Name.Replace("T", ""); if (oHInterID == "") { oHInterID = "hmainid"; } if (CurNode.Text == "»áÒé¼ÍÒª") { sSql = "Select * from h_v_Oa_MeetingbillList where 1=1 order by ÏîÄ¿´úÂë"; DSet = SubCn.RunProcReturn(sSql, "h_v_Oa_MeetingbillList", ref DBUtility.ClsPub.sExeReturnInfo); // if (DSet == null) { MessageBox.Show("ÏÔʾʧ°Ü£¡Ô­Òò£º" + DBUtility.ClsPub.sExeReturnInfo); return; } grdMain.DataSource = DSet.Tables[0].DefaultView; DBUtility.Gy_BaseFun.DisplayGrid(grdMain, this.Name); return; } sSql = "Select * from h_v_Oa_MeetingbillList where hmainid=" + oHInterID + " order by ÏîÄ¿´úÂë"; //Ö´ÐÐSQL DSet = SubCn.RunProcReturn(sSql, "h_v_Oa_MeetingbillList", ref DBUtility.ClsPub.sExeReturnInfo); // if (DSet == null) { MessageBox.Show("ÏÔʾʧ°Ü£¡Ô­Òò£º" + DBUtility.ClsPub.sExeReturnInfo); return; } grdMain.DataSource = DSet.Tables[0].DefaultView; DBUtility.Gy_BaseFun.DisplayGrid(grdMain, this.Name); // } private void cmdLoadTree_Click(object sender, EventArgs e) { Display(); //Gy_Department_Load(sender, e); //LoadTree(TreeView, imageList1, this.Text); } public frm_MeetingBilllist() { InitializeComponent(); } private void InitUI() { DBUtility.Xt_BaseBillFun.initGridList(grdMain, this.Name); } public string ViewName = ""; private void cmdQuery_Click(object sender, EventArgs e) { Refresh1(); } private void Refresh1() { SQLHelper.ClsCN SubCn = new SQLHelper.ClsCN(); DataSet DSet; string sSql = ""; string sWhere = ""; sSql = "Select * from h_v_Oa_MeetingbillList where ¹æ¸ñÐͺŠlike '%" + txtHModel.Text + "%' "; //Ö´ÐÐSQL DSet = SubCn.RunProcReturn(sSql, "h_v_Oa_MeetingbillList", ref DBUtility.ClsPub.sExeReturnInfo); // if (DSet == null) { MessageBox.Show("ÏÔʾʧ°Ü£¡Ô­Òò£º" + DBUtility.ClsPub.sExeReturnInfo); return; } grdMain.DataSource = DSet.Tables[0].DefaultView; DBUtility.Gy_BaseFun.DisplayGrid(grdMain, this.Name); } private void sx_Click(object sender, EventArgs e) { Refresh1(); Display(); } private void frm_MeetingBilllist_Load(object sender, EventArgs e) { dtpHDate.Value = DateTime.Today.AddDays(-20); dtpHEDate.Value = DateTime.Today; InitUI(); Refresh1(); } private void xz_Click(object sender, EventArgs e) { frm_MeetingBill ofrm_MeetingBill = new frm_MeetingBill(); ofrm_MeetingBill.HInterID = 0; ofrm_MeetingBill.zt = true; ofrm_MeetingBill.ShowDialog(); Refresh1(); Display(); } private void dj_Click(object sender, EventArgs e) { if (grdMain.CurrentRow == null) { MessageBox.Show("ûÓÐÑ¡ÔñÏîÄ¿£¡"); return; } int col = Fun_GetCol("FitemID"); ofrm_MeetingBill.id = grdMain.Rows[grdMain.CurrentRow.Index].Cells[col].Value.ToString(); Int64 sInterID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells["hmainid"].Value); ofrm_MeetingBill.HInterID = sInterID; ofrm_MeetingBill.zt = false; ofrm_MeetingBill.ShowDialog(); Refresh1(); Display(); } private void sc_Click(object sender, EventArgs e) { if (!DBUtility.ClsPub.Security_Log("OA_Manager", 1, true, DBUtility.ClsPub.CurUserName)) { return; } if (grdMain.CurrentRow == null) { MessageBox.Show("ûÓÐÑ¡ÔñÏîÄ¿£¡"); return; } SQLHelper.ClsCN oCn=new SQLHelper.ClsCN(); Int64 sInterID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells["hmainid"].Value); if (MessageBox.Show("È·¶¨ÒªÉ¾³ýµ±Ç°µ¥¾Ý£¿", "Ìáʾ", MessageBoxButtons.OKCancel) == DialogResult.OK) { oCn.RunProc(" Delete from OA_MeetingBill where HInterID=" + sInterID.ToString()); Refresh1(); Display(); } } private void yl_Click(object sender, EventArgs e) { frm_MeetingItemList ofrm_MeetingItemList = new frm_MeetingItemList(); ofrm_MeetingItemList.Show(); //frm_MeetingItem ofrm_MeetingItem = new frm_MeetingItem(); //ofrm_MeetingItem.ShowDialog(); } private void dy_Click(object sender, EventArgs e) { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); try { //MessageBox.Show("ûÓÐÕÒµ½·´À¡ÏîÄ¿£¡"); //´ÓÒì³£·´À¡µ¼Èë½ñÈÕÊý¾Ý Int64 HMeetID; DataSet ds = oCn.RunProcReturn("select * from oa_meetingitem where hnumber='001' ", "oa_meetingitem"); if (ds == null || ds.Tables[0].Rows.Count == 0) { MessageBox.Show("ûÓÐ[001]·´À¡ÏîÄ¿£¡"); return; } HMeetID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HItemID"]); oCn.BeginTran(); oCn.RunProc("delete from oa_meetingbill where HMeetID=" + HMeetID.ToString() + " and isnull(hchecker,'')='' and HType='1' and HDate=convert(varchar(10),getdate(),120) ");//ɾ³ý¸ÃÏîÄ¿µÄδÑéÖ¤µ±ÈÕ¼ÍÒª oCn.RunProc("exec h_p_OA_FKInfoToMeeting " + HMeetID.ToString() + ",'" + DBUtility.ClsPub.CurUserName + "'"); oCn.Commit(); MessageBox.Show("µ¼Èë³É¹¦£¡"); } catch (Exception e1) { oCn.RollBack(); MessageBox.Show("µ¼Èëʧ°Ü£¡" + e1.Message); } } private Int32 Fun_GetCol(string sCol) { return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdMain); } private void grdMain_DoubleClick(object sender, EventArgs e) { if (grdMain.CurrentRow == null) { MessageBox.Show("ûÓÐÑ¡ÔñÏîÄ¿£¡"); return; } else { int col = Fun_GetCol("FitemID"); ofrm_MeetingBill.id = grdMain.Rows[grdMain.CurrentRow.Index].Cells[col].Value.ToString(); Int64 sInterID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells["hmainid"].Value); ofrm_MeetingBill.HInterID = sInterID; ofrm_MeetingBill.zt = false; ofrm_MeetingBill.ShowDialog(); Refresh1(); Display(); } } private void sh_Click(object sender, EventArgs e) { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); if (grdMain.CurrentRow == null) { return; } else { int HCheckercol = Fun_GetCol("HChecker"); string HChecker1 = grdMain.Rows[grdMain.CurrentRow.Index].Cells[HCheckercol].Value.ToString(); if (HChecker1 == "") { int col = Fun_GetCol("HInterID"); string id = grdMain.Rows[grdMain.CurrentRow.Index].Cells[col].Value.ToString(); oCn.RunProc("Update Oa_Meetingbill set " + "HChecker= '" + Pub_Class.ClsPub.CurUserName + "'" + ",HCheckDate='" + DateTime.Now.ToString() + "'Where HInterID = " + id + "", ref DBUtility.ClsPub.sExeReturnInfo); MessageBox.Show("ÒÑÑéÖ¤£¡"); Display(); } else { MessageBox.Show("´Ëµ¥¾ÝÒÑÑéÖ¤¹ý£¡"); } } } private void tc_Click(object sender, EventArgs e) { this.Close(); } private void dc_Click(object sender, EventArgs e) { } private void qsh_Click(object sender, EventArgs e) { SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); if (grdMain.CurrentRow == null) { return; } else { int HCheckercol = Fun_GetCol("HChecker"); string HChecker1 = grdMain.Rows[grdMain.CurrentRow.Index].Cells[HCheckercol].Value.ToString(); if (HChecker1 == "") { MessageBox.Show("´Ëµ¥¾ÝδÑéÖ¤¹ý£¡"); } else { int col = Fun_GetCol("HInterID"); string id = grdMain.Rows[grdMain.CurrentRow.Index].Cells[col].Value.ToString(); oCn.RunProc("Update Oa_Meetingbill set " + "HChecker= ''" + ",HCheckDate=null Where HInterID = " + id + "", ref DBUtility.ClsPub.sExeReturnInfo); MessageBox.Show("Òѻָ´£¡"); Display(); } } } private void set_Click(object sender, EventArgs e) { } private void timer1_Tick(object sender, EventArgs e) { timer1.Enabled = false; Display(); } 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); } } }