| | |
| | | //{ |
| | | // return; |
| | | //} |
| | | double d = 0; |
| | | double ds = 0; |
| | | for (int i = 0; i < grdMain.RowCount; i++) |
| | | ClsCN SubCn = new ClsCN(); |
| | | DataSet DSet; |
| | | string sSql = ""; |
| | | string sWhere = ""; |
| | | string HParentID = ""; |
| | | //鏍戝舰鑺傜偣 |
| | | if (CurNode.Name.Trim().Length == 0) |
| | | { |
| | | d = d + DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[Fun_GetCol("鍗虫椂搴撳瓨")].Value); |
| | | ds = ds + DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[Fun_GetCol("閲戦")].Value); |
| | | HParentID = ""; |
| | | } |
| | | lblHSumQty.Text = " " + DBUtility.ClsPub.isDoule(d, 4) + " " ; |
| | | lblHSumMoney.Text = " " + DBUtility.ClsPub.isDoule(ds, 4) + " " ; |
| | | else |
| | | { |
| | | char c = Convert.ToChar(spChar); |
| | | string[] sr; |
| | | sr = CurNode.Text.Split(c); |
| | | HParentID = sr[0].ToString(); |
| | | } |
| | | //杩囨护鏉′欢 |
| | | if (frmCondition.SqlStr.Trim().Length == 0) |
| | | { |
| | | if (HParentID == "" || HParentID == "鐗╂枡璧勬枡" || HParentID == "浠撳簱璧勬枡") |
| | | { |
| | | sSql = "Select sum(鍗虫椂搴撳瓨) 鍗虫椂搴撳瓨,sum(閲戦) 閲戦 from " + ViewName + " where 1=1 " + sWhere + sDlgWhere + " "; |
| | | } |
| | | else |
| | | { |
| | | if (wl.Checked == false) |
| | | { |
| | | sSql = "Select sum(鍗虫椂搴撳瓨) 鍗虫椂搴撳瓨,sum(閲戦) 閲戦 from " + ViewName + " where 浠撳簱浠g爜 like '" + HParentID.ToString() + "%' " + sWhere + sDlgWhere + " "; |
| | | } |
| | | else |
| | | { |
| | | sSql = "Select sum(鍗虫椂搴撳瓨) 鍗虫椂搴撳瓨,sum(閲戦) 閲戦 from " + ViewName + " where 鐗╂枡浠g爜 like '" + HParentID.ToString() + "%' " + sWhere + sDlgWhere + " "; |
| | | } |
| | | |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //sSql = frmCondition.SqlStr + " " + sWhere + sDlgWhere + " "; |
| | | } |
| | | //鎵цSQL |
| | | try |
| | | { |
| | | DSet = SubCn.RunProcReturn(sSql, ViewName); |
| | | double d = DBUtility.ClsPub.isDoule(DSet.Tables[0].Rows[0]["鍗虫椂搴撳瓨"]); |
| | | double ds = DBUtility.ClsPub.isDoule(DSet.Tables[0].Rows[0]["閲戦"]); |
| | | lblHSumQty.Text = " " + DBUtility.ClsPub.isDoule(d, 4) + " "; |
| | | lblHSumMoney.Text = " " + DBUtility.ClsPub.isDoule(ds, 4) + " "; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | MessageBox.Show(e.Message); |
| | | return; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |