//恢复 private void button2_Click(object sender, EventArgs e) { Dictionary <string, ObjItem> drX = this.dataGView2.getRowData(); Dictionary <string, ObjItem> drZ = this.dataGView1.getRowData(); if (drX != null) { if (drX["状态"].ToString() == "1") { EQMonthAccountEdit form = new EQMonthAccountEdit(drZ, drX, 2); form.ShowDialog(); this.dataGView1.reLoad(new object[] { His.his.Choscode }); dataGView1_SelectionChanged(null, null); YJFlagJudge(); } else { WJs.alert("折旧记录为无效的数据,无法进行恢复操作!"); return; } } else { WJs.alert("请选择需要恢复的设备折旧记录!"); return; } }
//月结 private void button1_Click(object sender, EventArgs e) { Dictionary <string, ObjItem> dr = this.dataGView1.getRowData();//获取主表数据 List <Dictionary <string, ObjItem> > drList = this.dataGView2.GetData(); //如果为空,则这个里面肯定不包含对应的自动折旧记录和状态为1的折旧记录 if (drList == null || drList.Count == 0) { EQMonthAccountEdit form = new EQMonthAccountEdit(dr, null, 1); form.ShowDialog(); this.dataGView1.reLoad(new object[] { His.his.Choscode }); dataGView1_SelectionChanged(null, null); YJFlagJudge(); } else { foreach (Dictionary <string, ObjItem> item in drList) { if (item["状态"].ToString() == "1") { WJs.alert("该期间划分里包含状态为1(有效)的设备折旧记录,无法进行月结!"); return; } } //经过循环,没有状态为1的设备折旧记录,可以月结 EQMonthAccountEdit form = new EQMonthAccountEdit(dr, null, 1); form.ShowDialog(); this.dataGView1.reLoad(new object[] { His.his.Choscode }); dataGView1_SelectionChanged(null, null); YJFlagJudge(); } }
private void dataGView2_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { Dictionary <string, ObjItem> drX = this.dataGView2.getRowData(); Dictionary <string, ObjItem> drZ = this.dataGView1.getRowData(); if (drX != null) { EQMonthAccountEdit form = new EQMonthAccountEdit(drZ, drX, 0); form.ShowDialog(); } else { WJs.alert("请双击要查看的设备折旧记录!"); return; } }