yxj
2022-08-24 22f568fdffb143c60fa26285aa334f03afc255c0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
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);
        }
 
    }
}