Пример #1
0
        //库存查询
        private void btnQty_Click(object sender, EventArgs e)
        {
            if (txtStorage.Text.Trim() == "")
            {
                this.ShowAlertMessage("请选择仓库!");
                return;
            }

            if (dtpBeginDate.Text.Trim() == "")
            {
                this.ShowAlertMessage("请选择截止日期!");
                return;
            }


            string strMaterialGuid = "";

            if (txtMaterialGuid.Tag != null)
            {
                strMaterialGuid = txtMaterialGuid.Tag.ToString();
            }

            string strMaterialType = "";

            if (txtMaterialType.Tag != null)
            {
                strMaterialType = txtMaterialType.Tag.ToString();
            }

            string strSupplierGuid = "";

            if (txtSupplier.Tag != null)
            {
                strSupplierGuid = txtSupplier.Tag.ToString();
            }



            StatReportManage StatReportManage = new StatReportManage();

            if (chkView.Checked == true)
            {
                DataTable dtl = new DataTable();
                dtl = StatReportManage.sp_GetInOutStorageSum(dtpBeginDate.Text + " 00:00:00", dtpEndDate.Text + " 23:59:59", strMaterialGuid, txtStorage.Tag.ToString(), strMaterialType, strSupplierGuid);
                gridControl1.DataSource = dtl;
            }
            else
            {
                //进出为0显示没勾上,期初进出结存都为0不显示也没勾上
                if (chkView2.Checked == false)
                {
                    DataTable dtl  = new DataTable();
                    DataTable dtl2 = new DataTable();
                    dtl  = StatReportManage.sp_GetInOutStorageSum(dtpBeginDate.Text + " 00:00:00", dtpEndDate.Text + " 23:59:59", strMaterialGuid, txtStorage.Tag.ToString(), strMaterialType, strSupplierGuid);
                    dtl2 = GetNewDataTable(dtl, " BQInOnlySum>0 or BQInOnlySum<0 or BQOutOnlySum>0 or BQOutOnlySum<0 ");
                    gridControl1.DataSource = dtl2;
                }
                else
                {
                    //进出为0显示没勾上,期初进出结存都为0不显示勾上了
                    if (chkView2.Checked == true)
                    {
                        DataTable dtl  = new DataTable();
                        DataTable dtl2 = new DataTable();
                        dtl  = StatReportManage.sp_GetInOutStorageSum(dtpBeginDate.Text + " 00:00:00", dtpEndDate.Text + " 23:59:59", strMaterialGuid, txtStorage.Tag.ToString(), strMaterialType, strSupplierGuid);
                        dtl2 = GetNewDataTable(dtl, " QCOnlySum>0 or QCOnlySum<0 or BQInOnlySum>0 or BQInOnlySum<0 or BQOutOnlySum>0 or BQOutOnlySum<0  ");
                        gridControl1.DataSource = dtl2;
                    }
                }
            }

            //权限判断
            if (rightgroupManage.IsOperateRightByUserID(SysParams.UserID, "IsDisplayPrice", "IsDisplayPrice") == false)
            {
                bandedGridView1.Columns["JCOnlyMoney"].Visible    = false;
                bandedGridView1.Columns["QCOnlyMoney"].Visible    = false;
                bandedGridView1.Columns["BQOutOnlyMoney"].Visible = false;
                bandedGridView1.Columns["BQInOnlyMoney"].Visible  = false;
            }
        }