1
wtt
2 天以前 db658b16ef882ddcd56c4fea35aae42d0473b57d
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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DBUtility;
using SQLHelper;
 
namespace LMES
{
    public partial class Frm_Show : Form
    {
        public Frm_Show()
        {
            InitializeComponent();
        }
        public OAM.OA_WorkLinkBill oFrm;
        
 
        private void ClearTool()
        {
            cg.CheckState = CheckState.Unchecked; 
            xs.CheckState = CheckState.Unchecked;
            kf.CheckState = CheckState.Unchecked;  
            jh.CheckState = CheckState.Unchecked;  
            sc.CheckState = CheckState.Unchecked;
            cj.CheckState = CheckState.Unchecked;
            oa.CheckState = CheckState.Unchecked; 
            tx.CheckState = CheckState.Unchecked;
            gy.CheckState = CheckState.Unchecked;
            xt.CheckState = CheckState.Unchecked; 
            oa.CheckState = CheckState.Unchecked; 
            mj.CheckState = CheckState.Unchecked;
            Zp.CheckState = CheckState.Unchecked; 
            sb.CheckState = CheckState.Unchecked;
            pz.CheckState = CheckState.Unchecked;
            sup.CheckState = CheckState.Unchecked;
            pay.CheckState = CheckState.Unchecked;
        }
 
        private void SetTool(ToolStripButton oBr)
        {
            oBr.CheckState = CheckState.Checked;
            //显示子项目
            grdList.Rows.Clear();
            DataSet oDs;
            Pub_Class.ClsSqlHelper oCn = new Pub_Class.ClsSqlHelper();
            oDs = oCn.RunProcReturn("select * from xt_xtgnb where sjgnbm='" + oBr.Name + "' and menulist=1  Order by gnbm", "xt_xtgnb");
            if (oDs == null || oDs.Tables[0].Rows.Count == 0)
            {
                return;
            }
            for (int i = 0; i < oDs.Tables[0].Rows.Count; i++)
            {
                grdList.Rows.Add();
                grdList.Rows[i].Cells["NameCol"].Value = oDs.Tables[0].Rows[i]["gnmc"].ToString();
                grdList.Rows[i].Cells["IDCol"].Value = oDs.Tables[0].Rows[i]["gnbm"].ToString();
                //如果未购买则显示灰色
                if (DBUtility.ClsPub.isBool(oDs.Tables[0].Rows[i]["buyFlag"]) != true)
                {
                    grdList.Rows[i].DefaultCellStyle.ForeColor = Color.LightGray;
                }
                else
                {
                    grdList.Rows[i].DefaultCellStyle.ForeColor = Color.Black;
                }
                //
            }
            //默认将第一项目 显示出 下级项目
            if (oDs.Tables[0].Rows.Count >= 0)
            {
                
                ShowSubItems(0);
            }
        }
 
        //设置主菜单
        private void ShowMainMenu()
        {
            InitTool();
        }
 
        private void SetPic()
        {
            //Image img = System.Drawing.Image.FromFile(ClsPub.AppPath + @"/MainToolPic.jpg"); ;
            //panel3.BackgroundImage = img;
        }
 
        private void Frm_Show_Load(object sender, EventArgs e)
        {
            SetPic();
            ClearTool();
            //SetTool(cg);
            //设置主菜单
            ShowMainMenu();
            //设置当前用户和企业
            SetUserName();
            //
            ShowMsg();
        }
 
        private void SetUserName()
        {
            lblAccountName.Text = "本机IP:" + DBUtility.ClsPub.IPAddress;
            lblUserName.Text = "Windows用户:" + DBUtility.ClsPub.ComputerName;
            lblDate.Text = BLL.ClsDateToNongli.GetChineseDateTime(DateTime.Today);
        }
 
        private void grdList_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
        {
            e.Handled = true;
            e.PaintBackground(e.CellBounds, true);
            e.PaintContent(e.CellBounds);
 
        }
 
        private void grdSub_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
        {
            e.Handled = true;
            e.PaintBackground(e.CellBounds, true);
            e.PaintContent(e.CellBounds);
        }
 
        private void ShowSubItems(int sRow)
        {
            grdSub.Rows.Clear();
            DataSet oDs;
            Pub_Class.ClsSqlHelper oCn = new Pub_Class.ClsSqlHelper();
            oDs = oCn.RunProcReturn("select * from xt_xtgnb where sjgnbm='" + grdList.Rows[sRow].Cells["IDCol"].Value + "' and menulist=1 Order by gnbm", "xt_xtgnb");
            if (oDs == null || oDs.Tables[0].Rows.Count == 0)
            {
                return;
            }
            for (int i = 0; i < oDs.Tables[0].Rows.Count; i++)
            {
                grdSub.Rows.Add();
                grdSub.Rows[i].Cells["SubNameCol"].Value = oDs.Tables[0].Rows[i]["gnmc"].ToString();
                grdSub.Rows[i].Cells["SubNumberCol"].Value = oDs.Tables[0].Rows[i]["gnsy"].ToString();
                grdSub.Rows[i].Cells["SubIDCol"].Value = oDs.Tables[0].Rows[i]["gnbm"].ToString();
                //如果未购买则显示灰色
                if (DBUtility.ClsPub.isBool(oDs.Tables[0].Rows[i]["buyFlag"]) != true)
                {
                    grdSub.Rows[i].DefaultCellStyle.ForeColor = Color.LightGray;
                }
                else
                {
                    grdSub.Rows[i].DefaultCellStyle.ForeColor = Color.Black;
                }
                //
            }
        }
 
        private void grdList_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (grdList.CurrentCell == null)
            {
                return;
            }
            ShowSubItems(grdList.CurrentCell.RowIndex);
        }
 
        private void grdSub_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (grdSub.CurrentCell == null)
            {
                return;
            }
            //判断颜色
            if (grdSub.Rows[grdSub.CurrentCell.RowIndex].DefaultCellStyle.ForeColor == Color.LightGray)
            {
                MessageBox.Show("对不起,您尚未购买本模块,请求不被允许!");
                return;
            }
            //
            string gnmc = grdSub.Rows[grdSub.CurrentCell.RowIndex].Cells["SubNameCol"].Value.ToString();
            string gnsy = grdSub.Rows[grdSub.CurrentCell.RowIndex].Cells["SubNumberCol"].Value.ToString();
            string gnbm = grdSub.Rows[grdSub.CurrentCell.RowIndex].Cells["SubIDCol"].Value.ToString();
            ClsShowMod oMod = new ClsShowMod();
            oMod.Zxxymk(gnsy.ToLower().Trim(), gnbm.ToLower().Trim(),gnmc.Trim() ,this.MdiParent);
        }
 
        private void ShowMsg()
        {
            DataSet oDs;
            Pub_Class.ClsSqlHelper oCn = new Pub_Class.ClsSqlHelper();
            oDs = oCn.RunProcReturn("h_p_OA_EmpMinMessageList " +  DBUtility.ClsPub.CurUserName.ToString(), "xt_xtgnb");
            if (oDs != null)
            {
                grdList1.DataSource = oDs.Tables[0].DefaultView;
                //grdList2.DataSource = oDs.Tables[0].DefaultView;
                grdList1.Columns[0].Visible = false;
                grdList1.Columns[1].Visible = false;
               
            }
            //
 
            oDs = oCn.RunProcReturn("exec h_p_OA_WorkBillList " +  DBUtility.ClsPub.CurUserName.ToString(), "xt_xtgnb");
            if (oDs == null)
            {
                return;
            }
            grdList2.DataSource = oDs.Tables[0].DefaultView;
            grdList2.Columns[0].Visible = false;
            grdList2.Columns[1].Visible = false;
           
            //
            DBUtility.ClsPub.GetGridView(this.grdList1, this.Name + "grdList1", DBUtility.ClsPub.AppPath);
            DBUtility.ClsPub.GetGridView(this.grdList2, this.Name + "grdList2", DBUtility.ClsPub.AppPath);
        }
 
        private void Frm_Show_FormClosing(object sender, FormClosingEventArgs e)
        {
 
            DBUtility.ClsPub.SaveGridView(this.grdList1, this.Name + "grdList1", DBUtility.ClsPub.AppPath);
            DBUtility.ClsPub.SaveGridView(this.grdList2, this.Name + "grdList2", DBUtility.ClsPub.AppPath);
        }
        //
        private Int32 Fun_GetCol(string sCol)
        {
            return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdList2);
        }
        //双击显示grdList1
        private void grdList1_DoubleClick(object sender, EventArgs e)
        {
            //Int64 lngBillKey = 0;
            //if (grdList1.CurrentRow == null)
            //    return;
            //lngBillKey = DBUtility.ClsPub.isLong(grdList1.Rows[grdList1.CurrentRow.Index].Cells[Fun_GetCol("hmainid")].Value);
            //if (lngBillKey == 0)
            //    return;
            //DAL.ClsOA_EmpMinMessage oBill = new DAL.ClsOA_EmpMinMessage();
            //if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
            //{
            //    oFrm = new OAM.OA_EmpMinMessage();
            //    oFrm.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
            //    oFrm.BillOld = oBill;
            //    oFrm.ShowDialog();
            //}
 
        }
        //双击显示grdList2
        private void grdList2_DoubleClick(object sender, EventArgs e)
        {
            Int64 lngBillKey = 0;
            if (grdList2.CurrentRow == null)
                return;
            lngBillKey = DBUtility.ClsPub.isLong(grdList2.Rows[grdList2.CurrentRow.Index].Cells[Fun_GetCol("hmainid")].Value);
            if (lngBillKey == 0)
                return;
            DAL.ClsOA_WorkLinkBill oBill = new DAL.ClsOA_WorkLinkBill();
            if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
            {
                oFrm = new OAM.OA_WorkLinkBill();
                oFrm.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
                oFrm.BillOld = oBill;
                oFrm.ShowDialog();
            }
        }
 
       
 
        private void gy_Click(object sender, EventArgs e)
        {
            ClearTool();
            SetTool(gy);
        }
 
        private void cg_Click(object sender, EventArgs e)
        {
            ClearTool();
            SetTool(cg);
        }
 
        private void xs_Click(object sender, EventArgs e)
        {
            ClearTool();
            SetTool(xs);
        }
 
        private void ck_Click(object sender, EventArgs e)
        {
            ClearTool();
            SetTool(kf);
        }
         
 
        private void jh_Click(object sender, EventArgs e)
        {
            ClearTool();
            SetTool(jh);
        }
 
        private void sc_Click(object sender, EventArgs e)
        {
            ClearTool();
            SetTool(sc);
        }
 
        private void cj_Click(object sender, EventArgs e)
        {
            ClearTool();
            SetTool(cj);
        }
         
        private void tx_Click(object sender, EventArgs e)
        {
            ClearTool();
            SetTool(tx);
        }
 
        private void xt_Click(object sender, EventArgs e)
        {
            ClearTool();
            SetTool(xt);
        } 
         
 
        private void oa_Click(object sender, EventArgs e)
        {
            ClearTool();
            SetTool(oa);
        }
 
 
        ClsCN oCn = new ClsCN();
        public const int MaxNum = 100;
        public int NowNum = 0;
 
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (NowNum > MaxNum)
            {
                NowNum = 0;
                FindCheckBill();
            }
            else
            {
                NowNum++;
            }
        }
 
 
        //查询待审核单据
        private void FindCheckBill()
        {
            try
            {
                DataSet ds;
                ds = oCn.RunProcReturn("exec h_p_Xt_GetNeedMessageList '" + ClsPub.CurUserName + "'", "xt_xtgnb");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    return;
                }
                else
                {
                    ShowMessage(ClsPub.isLong(ds.Tables[0].Rows[0]["HInterID"]), ds.Tables[0].Rows[0]["单据号"].ToString(), ds.Tables[0].Rows[0]["单据类型"].ToString(), ds.Tables[0].Rows[0]["单据类型名称"].ToString());
                }
            }
            catch (Exception e)
            {
                return;
            }
 
        }
 
        //显示消息框
        private void ShowMessage(Int64 HInterID, string HBillNo, string HBillType, string HBillTypeName)
        {
            OA_MessageBox oBox = new OA_MessageBox();
            int x = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Width - 300;
            int y = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Size.Height - 230;
            oBox.SetDesktopLocation(x, y);
            oBox.HInterID = HInterID;
            oBox.HBillNo = HBillNo;
            oBox.HBillType = HBillType;
            oBox.HBillTypeName = HBillTypeName;
            timer1.Enabled = false;
            oBox.ShowDialog();
            timer1.Enabled = true;
        }
         
 
        public void InitTool()
        {
            ClsCN ocn = new ClsCN();
            DataSet ds = new DataSet();
            string sh = "";
            ds = ocn.RunProcReturn("select hname from Xt_MainMenuSet where HShowFlag=0", "Xt_MainMenuSet");
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                sh = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["hname"]);
                Sub_HideButton(this.toolStrip2, sh);
            }
 
 
        }
 
        //隐藏按钮
        public void Sub_HideButton(ToolStrip otool, string sName)
        {
            
            foreach (object ct in otool.Items)
            {
                if (ct.GetType().Name == "ToolStripButton")
                {
                    if (((System.Windows.Forms.ToolStripButton)ct).Tag.ToString().Trim() == sName)
                    {
                        ((System.Windows.Forms.ToolStripButton)ct).Visible = false;
                    }
                }
                if (ct.GetType().Name == "ToolStripSeparator")
                {
                    if (((System.Windows.Forms.ToolStripSeparator)ct).Tag.ToString().Trim() == sName)
                    {
                        ((System.Windows.Forms.ToolStripSeparator)ct).Visible = false;
                    }
                }
            }
        }
 
        private void kq_Click(object sender, EventArgs e)
        {
            ClearTool();
            SetTool(mj);
        }
 
        private void pct_Click(object sender, EventArgs e)
        {
            ClearTool();
            SetTool(Zp);
        }
         
 
        private void lblMore2_Click(object sender, EventArgs e)
        {
            //morebt oMo = new morebt();
 
            //oMo.Huoqu(1);
            //oMo.ShowDialog();
        }
 
 
        private void lblMore_Click(object sender, EventArgs e)
        {
            //morebt oMo = new morebt();
 
            //oMo.Huoqu(0);
            //oMo.ShowDialog();
        }
 
        private void sb_Click(object sender, EventArgs e)
        {
            ClearTool();
            SetTool(sb);
        }
 
         
 
        private void pz_Click(object sender, EventArgs e)
        {
            ClearTool();
            SetTool(pz);
        }
 
        private void sup_Click(object sender, EventArgs e)
        {
            ClearTool();
            SetTool(sup);
        }
 
        private void pBarCodeEdit_Click(object sender, EventArgs e)
        {
            WarM.Sc_ICMOToBarCode oSc_ICMOToBarCode = new WarM.Sc_ICMOToBarCode();
            oSc_ICMOToBarCode.ModCaption = "条码快速生成";
            oSc_ICMOToBarCode.ShowDialog();
        }
 
        private void pay_Click(object sender, EventArgs e)
        {
            ClearTool();
            SetTool(pay);
        }
    }
}