private void BindGrid()
    {
        int month = int.Parse(ddl_Month.SelectedValue);

        if (select_Client.SelectValue == "")
        {
            MessageBox.Show(this, "对不起,您必须选择一个客户进行填报!");
            return;
        }

        IList <SVM_JXCSummary> lists = SVM_JXCSummaryBLL.GetModelList("AccountMonth=" + month.ToString() + " AND Client=" + select_Client.SelectValue + @" AND Product IN (SELECT PDT_Product.ID FROM MCS_PUB.dbo.PDT_Product 
			            INNER JOIN MCS_Pub.dbo.PDT_Brand ON PDT_Product.Brand = PDT_Brand.ID AND PDT_Brand.IsOpponent="             + ViewState["IsOpponent"].ToString() + ")");

        if (lists.Count != 0)
        {
            gv_List.BindGrid(lists.OrderBy(p => p.ProductCode).ToList());
            ddl_Month.Enabled = false;
            bt_Load.Enabled   = false;
            if (lists.Where(p => p.ApproveFlag == 2).Count() > 0)
            {
                bt_Save.Enabled   = true;
                bt_Delete.Enabled = true;
            }
            bt_Return.Enabled = true;
        }
        else
        {
            MessageBox.Show(this, "对不起,当前客户初始化进销存数据失败,请检查是否正确设定了该客户的价表!");
            return;
        }
    }
    private void BindGrid()
    {
        int beginmonth = int.Parse(ddl_BeginMonth.SelectedValue);
        int endmonth   = int.Parse(ddl_EndMonth.SelectedValue);
        int pricelevel = int.Parse(MCSTabControl1.SelectedTabItem.Value);

        DataTable dt = null;

        if (select_Client.SelectValue != "")
        {
            dt = SVM_JXCSummaryBLL.GetSummaryListByClient(beginmonth, endmonth, pricelevel, int.Parse(select_Client.SelectValue), int.Parse(rbl_IsOpponent.SelectedValue));
        }
        else if (ViewState["ClientClassify"] != null)
        {
            dt = SVM_JXCSummaryBLL.GetSummaryListByClientClassify(beginmonth, endmonth, pricelevel,
                                                                  int.Parse(tr_OrganizeCity.SelectValue), (int)ViewState["ClientClassify"], int.Parse(rbl_IsOpponent.SelectedValue));
        }
        else
        {
            //MessageBox.Show(this, "请选择要查询进销存的客户!");
            //return;
        }

        if (rbl_ApproveFlag.SelectedValue != "0")
        {
            dt.DefaultView.RowFilter = "ApproveFlag='" + (rbl_ApproveFlag.SelectedValue == "1" ? "已审核" : "未审核") + "'";
        }
        gv_List.DataSource = dt.DefaultView;
        gv_List.DataBind();
    }
Esempio n. 3
0
    protected void bt_Approve_Click(object sender, EventArgs e)
    {
        int client = 0, month = 0;

        if (int.TryParse(select_Client.SelectValue, out client) && int.TryParse(ddl_Month.SelectedValue, out month))
        {
            SVM_JXCSummaryBLL.Approve(client, month, (int)Session["UserID"], int.Parse(rbl_IsOpponent.SelectedValue));
            MessageBox.ShowAndRedirect(this, "已将进销存设为审核通过!", "JXCSummary_List.aspx?ClientType=" + ViewState["ClientType"].ToString());
        }
    }
    private void BindGrid()
    {
        int month      = int.Parse(ddl_Month.SelectedValue);
        int pricelevel = int.Parse(MCSTabControl1.SelectedTabItem.Value);
        int supplier   = 0;

        if (!int.TryParse(select_Supplier.SelectValue, out supplier))
        {
            MessageBox.Show(this, "请选择要查询进销存的供货应或客户!");
            return;
        }

        if (rbl_DisplayType.SelectedValue == "1")
        {
            //按客户显示
            MCSTabControl1.Items[0].Visible = false;
            if (pricelevel == 0)
            {
                //按客户显示时,无按数量统计
                MCSTabControl1.SelectedIndex = 1;
                MCSTabControl1.SelectedIndex = 1;
                pricelevel = 1;
            }
            DataTable dt = SVM_JXCSummaryBLL.GetSummaryListBySupplier(month, month, pricelevel, supplier, int.Parse(rbl_IsOpponent.SelectedValue));

            MatrixTable.TableAddSummaryRow(dt, "OrganizeCityName",
                                           new string[] { "BeginningInventory", "PurchaseVolume", "TransitInventory", "RecallVolume", "SalesVolume",
                                                          "ReturnedVolume", "GiftVolume", "EndingInventory", "ComputInventory", "StaleInventory", "TransferInVolume", "TransferOutVolume" });
            gv_ListByClient.DataSource = dt;
            gv_ListByClient.DataBind();

            int lastrow = gv_ListByClient.Rows.Count - 1;
            if (gv_ListByClient.Rows[lastrow].Cells[1].Text == "总计")
            {
                gv_ListByClient.Rows[lastrow].Cells[0].Text = "";
            }
        }
        else
        {
            //按产品显示
            MCSTabControl1.Items[0].Visible = true;
            DataTable dt = SVM_JXCSummaryBLL.GetProductListBySupplier(supplier, month, pricelevel, int.Parse(rbl_IsOpponent.SelectedValue));
            dt.DefaultView.Sort = "ProductName ASC";
            MatrixTable.TableAddSummaryRow(dt, "ProductName",
                                           new string[] { "BeginningInventory", "PurchaseVolume", "TransitInventory", "RecallVolume", "SalesVolume",
                                                          "ReturnedVolume", "GiftVolume", "EndingInventory", "ComputInventory", "StaleInventory", "TransferInVolume", "TransferOutVolume" });

            dt.DefaultView.RowFilter    = "BeginningInventory + PurchaseVolume + TransitInventory + RecallVolume + SalesVolume + GiftVolume + ReturnedVolume + EndingInventory + StaleInventory+TransferInVolume+TransferOutVolume<>0";
            gv_ListByProduct.DataSource = dt.DefaultView;
            gv_ListByProduct.DataBind();
        }

        gv_ListByClient.Visible  = rbl_DisplayType.SelectedValue == "1";
        gv_ListByProduct.Visible = !gv_ListByClient.Visible;
    }
    protected void bt_Delete_Click(object sender, EventArgs e)
    {
        if (select_Client.SelectValue == "")
        {
            MessageBox.Show(this, "对不起,您必须选择一个客户!");
            return;
        }

        SVM_JXCSummaryBLL.DeleteJXC(int.Parse(select_Client.SelectValue), int.Parse(ddl_Month.SelectedValue));
        MessageBox.ShowAndRedirect(this, "删除成功!", "JXCSummary_List.aspx?ClientID=" + select_Client.SelectValue);
    }
 protected void bt_BathApprove_Click(object sender, EventArgs e)
 {
     foreach (GridViewRow gr in gv_List.Rows)
     {
         if (((CheckBox)gr.FindControl("chk_ID")).Checked == true)
         {
             int client = int.Parse(gv_List.DataKeys[gr.RowIndex]["Client"].ToString());
             int month  = int.Parse(gv_List.DataKeys[gr.RowIndex]["AccountMonth"].ToString());
             SVM_JXCSummaryBLL.Approve(client, month, (int)Session["UserID"], int.Parse(rbl_IsOpponent.SelectedValue));
         }
     }
     BindGrid();
 }
    protected decimal GetCompute(string differenceID)
    {
        int ID = 0; decimal computeinventory = 0;

        if (int.TryParse(differenceID, out ID))
        {
            SVM_InventoryDifferencesBLL bll = new SVM_InventoryDifferencesBLL(ID);
            DataTable dtCompute             = SVM_JXCSummaryBLL.GetSummaryListByClient(bll.Model.AccountMonth, bll.Model.AccountMonth, 1, bll.Model.Client, 1);
            computeinventory = dtCompute.Rows.Count > 0 ? Convert.ToDecimal(dtCompute.Rows[0]["ComputInventory"]) : 0;
            return(computeinventory);
        }
        return(computeinventory);
    }
Esempio n. 8
0
    private void BindGrid()
    {
        int month = int.Parse(ddl_Month.SelectedValue);

        if (select_Client.SelectValue == "")
        {
            MessageBox.Show(this, "对不起,您必须选择一个客户进行查询!");
            return;
        }
        string condition = "AccountMonth=" + month.ToString() + " AND Client=" + select_Client.SelectValue;

        if (ddl_Classify.SelectedValue != "0")
        {
            condition += " AND Product IN (SELECT ID FROM MCS_PUB.dbo.PDT_Product WHERE Classify=" + ddl_Classify.SelectedValue + ")";
        }
        else if (ddl_Brand.SelectedValue != "0")
        {
            condition += " AND Product IN (SELECT ID FROM MCS_PUB.dbo.PDT_Product WHERE Brand=" + ddl_Brand.SelectedValue + ")";
        }
        else
        {
            condition += @" AND SVM_JXCSummary.Product IN (SELECT PDT_Product.ID FROM MCS_PUB.dbo.PDT_Product 
			            INNER JOIN MCS_Pub.dbo.PDT_Brand ON PDT_Product.Brand = PDT_Brand.ID AND PDT_Brand.IsOpponent="             + rbl_IsOpponent.SelectedValue + ")";
        }
        IList <SVM_JXCSummary> lists = SVM_JXCSummaryBLL.GetModelList(condition);

        gv_List.BindGrid(lists.Where(p => Math.Abs(p.BeginningInventory) + Math.Abs(p.PurchaseVolume) + Math.Abs(p.TransitInventory) + Math.Abs(p.RecallVolume) +
                                     Math.Abs(p.SalesVolume) + Math.Abs(p.GiftVolume) + Math.Abs(p.ReturnedVolume) + Math.Abs(p.EndingInventory) + Math.Abs(p.StaleInventory) +
                                     Math.Abs(p.TransferInVolume) + Math.Abs(p.TransferOutVolume) + Math.Abs(p.ExpiredInventory) > 0).OrderBy(p => p.SubUnit).ToList());

        if (lists.Count > 0 && lists.Where(p => p.ApproveFlag == 2).Count() > 0)
        {
            bt_Edit.Enabled    = true;
            bt_Approve.Enabled = true;
        }
        else
        {
            bt_Edit.Enabled    = false;
            bt_Approve.Enabled = false;
        }
    }
Esempio n. 9
0
    public string GetSalesVolume(int Product)
    {
        PDT_Product            p       = new PDT_ProductBLL(Product).Model;
        IList <SVM_JXCSummary> jxclist = SVM_JXCSummaryBLL.GetModelList("AccountMonth=" + ((int)ViewState["Month"] - 1).ToString() + " AND Client=" + ViewState["ClientID"].ToString() + " AND Product=" + Product.ToString());

        if (jxclist.Count != 1)
        {
            return("");
        }

        int quantity = jxclist[0].PurchaseVolume;

        if (quantity == 0)
        {
            return("0");
        }
        string packing1 = DictionaryBLL.GetDicCollections("PDT_Packaging")[p.TrafficPackaging.ToString()].ToString();
        string packing2 = DictionaryBLL.GetDicCollections("PDT_Packaging")[p.Packaging.ToString()].ToString();

        return((quantity / p.ConvertFactor).ToString() + packing1 + " " + (quantity % p.ConvertFactor).ToString() + packing2);
    }
Esempio n. 10
0
    protected decimal GetSubJXC(string fieldname, int product)
    {
        if ((int)ViewState["ClientType"] != 3)
        {
            if ((gv_List.Columns[gv_List.Columns.Count - 1].Visible && fieldname == "GiftVolume") ||
                (gv_List.Columns[gv_List.Columns.Count - 2].Visible && fieldname == "PurchaseVolume") ||
                (gv_List.Columns[gv_List.Columns.Count - 3].Visible && fieldname == "ReturnedVolume"))
            {
                int month      = int.Parse(ddl_Month.SelectedValue);
                int pricelevel = int.Parse(MCSTabControl1.SelectedTabItem.Value);
                int supplier   = int.Parse(select_Client.SelectValue);

                return(SVM_JXCSummaryBLL.GetMonthSummaryBySupplier(month, pricelevel, supplier, fieldname, product, int.Parse(rbl_IsOpponent.SelectedValue)));
            }
            else
            {
                return(0);
            }
        }
        return(0);
    }
    private void ComputDiffInfo(SVM_InventoryDifferencesBLL bll)
    {
        #region 计算差异率
        decimal computeinventory = 0, totaldiffvalue = 0, totalabsdiffvalue = 0, absdiffrate = 0, lastdiffvalue = 0;

        DataTable dt = SVM_JXCSummaryBLL.GetSummaryListByClient(bll.Model.AccountMonth, bll.Model.AccountMonth, 1, bll.Model.Client, bll.Model["IsCXP"] == "2" ? 1 : 9);
        computeinventory = dt.Rows.Count > 0 ? Convert.ToDecimal(dt.Rows[0]["ComputInventory"]) : 0;
        totaldiffvalue   = bll.Items.Sum(p => p.FactoryPrice * p.Quantity);

        totalabsdiffvalue = bll.Items.Sum(p => p.FactoryPrice * Math.Abs(p.Quantity));
        absdiffrate       = computeinventory == 0 ? 0 : (totalabsdiffvalue / computeinventory) * 100;

        lastdiffvalue = bll.GetOPIInventory();

        ViewState["ComputeInventory"]  = computeinventory;
        ViewState["TotalDiffValue"]    = totaldiffvalue;
        ViewState["TotalAbsDiffValue"] = totalabsdiffvalue;  //绝对差异额
        ViewState["AbsDiffRate"]       = absdiffrate;        //绝对差异率
        ViewState["LastDiffValue"]     = lastdiffvalue;

        lb_DifferenceInfo.Text = string.Format("实时库存额:{0:0.00},上期(截止20日)库存额:{2:0.00},本次盈亏额:{1:0.00}", computeinventory, totaldiffvalue, lastdiffvalue);
        #endregion
    }
    protected void bt_Load_Click(object sender, EventArgs e)
    {
        int client = int.Parse(select_Client.SelectValue);
        int month  = int.Parse(ddl_Month.SelectedValue);

        IList <SVM_JXCSummary> lists = SVM_JXCSummaryBLL.GetModelList("AccountMonth=" + month.ToString() +
                                                                      " AND Client=" + client.ToString() + @" AND Product IN (SELECT PDT_Product.ID FROM MCS_PUB.dbo.PDT_Product 
			            INNER JOIN MCS_Pub.dbo.PDT_Brand ON PDT_Product.Brand = PDT_Brand.ID AND PDT_Brand.IsOpponent="             + ViewState["IsOpponent"].ToString() + ")");

        if (lists.Count > 0 && lists.Where(p => p.ApproveFlag == 2).Count() == 0)
        {
            MessageBox.ShowAndRedirect(this, "对不起,该月份进销存数据已被审核通过,不可再填报!",
                                       "JXCSummary_Detail.aspx?ClientID=" + client.ToString() + "&AccountMonth=" + month.ToString());
            return;
        }
        else
        {
            ddl_Month.Enabled = false;
            SVM_JXCSummaryBLL.Init(client, month, (int)ViewState["IsOpponent"]);

            gv_List.PageIndex = 0;
            BindGrid();
        }
    }
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow row in gv_List.Rows)
        {
            int id = (int)gv_List.DataKeys[row.RowIndex]["ID"];
            SVM_JXCSummaryBLL jxc = new SVM_JXCSummaryBLL(id);
            if (jxc.Model == null) continue;

            string productname = row.Cells[2].Text; //new PDT_ProductBLL(jxc.Model.Product, true).Model.ShortName;

            TextBox tbx = null;
            int quantity = 0;

            tbx = (TextBox)row.FindControl("tbx_PurchaseVolume");
            if (tbx != null && int.TryParse(tbx.Text, out quantity))
            {
                jxc.Model.PurchaseVolume = quantity;
            }
            else if (tbx != null && tbx.Text != "")
            {
                tbx.Focus();
                MessageBox.Show(this, productname + "的“本期进货数量”格式填写错误,必须为整型!");
                return;
            }

            tbx = (TextBox)row.FindControl("tbx_RecallVolume");
            if (tbx != null && int.TryParse(tbx.Text, out quantity))
            {
                jxc.Model.RecallVolume = quantity;
            }
            else if (tbx != null && tbx.Text != "")
            {
                tbx.Focus();
                MessageBox.Show(this, productname + "的“下游退货”数量格式填写错误,必须为整型!");
                return;
            }

            tbx = (TextBox)row.FindControl("tbx_SalesVolume");
            if (tbx != null && int.TryParse(tbx.Text, out quantity))
            {
                jxc.Model.SalesVolume = quantity;
            }
            else if (tbx != null && tbx.Text != "")
            {
                tbx.Focus();
                MessageBox.Show(this, productname + "的“本期销售”数量格式填写错误,必须为整型!");
                return;
            }

            tbx = (TextBox)row.FindControl("tbx_GiftVolume");
            if (tbx != null && int.TryParse(tbx.Text, out quantity))
            {
                jxc.Model.GiftVolume = quantity;
            }
            else if (tbx != null && tbx.Text != "")
            {
                tbx.Focus();
                MessageBox.Show(this, productname + "的“发出买赠”格式填写错误,必须为整型!");
                return;
            }

            tbx = (TextBox)row.FindControl("tbx_ReturnedVolume");
            if (tbx != null && int.TryParse(tbx.Text, out quantity))
            {
                jxc.Model.ReturnedVolume = quantity;
            }
            else if (tbx != null && tbx.Text != "")
            {
                tbx.Focus();
                MessageBox.Show(this, productname + "的“退货数量”数量格式填写错误,必须为整型!");
                return;
            }

            tbx = (TextBox)row.FindControl("tbx_EndingInventory");
            if (tbx != null && int.TryParse(tbx.Text, out quantity))
            {
                jxc.Model.EndingInventory = quantity;
            }
            else if (tbx != null && tbx.Text != "")
            {
                tbx.Focus();
                MessageBox.Show(this, productname + "的“期末实际盘存”数量格式填写错误,必须为整型!");
                return;
            }

            tbx = (TextBox)row.FindControl("tbx_StaleInventory");
            if (tbx != null && int.TryParse(tbx.Text, out quantity))
            {
                jxc.Model.StaleInventory = quantity;
            }
            else if (tbx != null && tbx.Text != "")
            {
                tbx.Focus();
                MessageBox.Show(this, productname + "的“界期品库存”数量格式填写错误,必须为整型!");
                return;
            }

            //非促销店本期销售默认为本期进货
            if (Header.Attributes["WebPageSubCode"] == "ClientClassify=4" && !bEditSalesVolume)
                jxc.Model.SalesVolume = jxc.Model.PurchaseVolume - jxc.Model.ReturnedVolume;

            jxc.Update();
        }

        SVM_JXCSummaryBLL.ComputInventory(int.Parse(select_Client.SelectValue), int.Parse(ddl_Month.SelectedValue));
        BindGrid();

        MessageBox.Show(this, "保存成功!");
    }
    protected decimal GetSubJXC(int month, int supplier, string fieldname)
    {
        int pricelevel = int.Parse(MCSTabControl1.SelectedTabItem.Value);

        return(SVM_JXCSummaryBLL.GetMonthSummaryBySupplier(month, pricelevel, supplier, fieldname, int.Parse(rbl_IsOpponent.SelectedValue)));
    }
    protected void bt_Save_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow row in gv_List.Rows)
        {
            int id = (int)gv_List.DataKeys[row.RowIndex]["ID"];
            SVM_JXCSummaryBLL jxc = new SVM_JXCSummaryBLL(id);
            if (jxc.Model == null)
            {
                continue;
            }

            string productname = row.Cells[2].Text; //new PDT_ProductBLL(jxc.Model.Product, true).Model.ShortName;

            TextBox tbx      = null;
            int     quantity = 0;

            tbx = (TextBox)row.FindControl("tbx_PurchaseVolume");
            if (tbx != null && int.TryParse(tbx.Text, out quantity))
            {
                jxc.Model.PurchaseVolume = quantity;
            }
            else if (tbx != null && tbx.Text != "")
            {
                tbx.Focus();
                MessageBox.Show(this, productname + "的“本期进货数量”格式填写错误,必须为整型!");
                return;
            }

            tbx = (TextBox)row.FindControl("tbx_RecallVolume");
            if (tbx != null && int.TryParse(tbx.Text, out quantity))
            {
                jxc.Model.RecallVolume = quantity;
            }
            else if (tbx != null && tbx.Text != "")
            {
                tbx.Focus();
                MessageBox.Show(this, productname + "的“下游退货”数量格式填写错误,必须为整型!");
                return;
            }

            tbx = (TextBox)row.FindControl("tbx_SalesVolume");
            if (tbx != null && int.TryParse(tbx.Text, out quantity))
            {
                jxc.Model.SalesVolume = quantity;
            }
            else if (tbx != null && tbx.Text != "")
            {
                tbx.Focus();
                MessageBox.Show(this, productname + "的“本期销售”数量格式填写错误,必须为整型!");
                return;
            }

            tbx = (TextBox)row.FindControl("tbx_GiftVolume");
            if (tbx != null && int.TryParse(tbx.Text, out quantity))
            {
                jxc.Model.GiftVolume = quantity;
            }
            else if (tbx != null && tbx.Text != "")
            {
                tbx.Focus();
                MessageBox.Show(this, productname + "的“发出买赠”格式填写错误,必须为整型!");
                return;
            }

            tbx = (TextBox)row.FindControl("tbx_ReturnedVolume");
            if (tbx != null && int.TryParse(tbx.Text, out quantity))
            {
                jxc.Model.ReturnedVolume = quantity;
            }
            else if (tbx != null && tbx.Text != "")
            {
                tbx.Focus();
                MessageBox.Show(this, productname + "的“退货数量”数量格式填写错误,必须为整型!");
                return;
            }

            tbx = (TextBox)row.FindControl("tbx_EndingInventory");
            if (tbx != null && int.TryParse(tbx.Text, out quantity))
            {
                jxc.Model.EndingInventory = quantity;
            }
            else if (tbx != null && tbx.Text != "")
            {
                tbx.Focus();
                MessageBox.Show(this, productname + "的“期末实际盘存”数量格式填写错误,必须为整型!");
                return;
            }

            tbx = (TextBox)row.FindControl("tbx_StaleInventory");
            if (tbx != null && int.TryParse(tbx.Text, out quantity))
            {
                jxc.Model.StaleInventory = quantity;
            }
            else if (tbx != null && tbx.Text != "")
            {
                tbx.Focus();
                MessageBox.Show(this, productname + "的“界期品库存”数量格式填写错误,必须为整型!");
                return;
            }

            //非促销店本期销售默认为本期进货
            if (Header.Attributes["WebPageSubCode"] == "ClientClassify=4" && !bEditSalesVolume)
            {
                jxc.Model.SalesVolume = jxc.Model.PurchaseVolume - jxc.Model.ReturnedVolume;
            }

            jxc.Update();
        }

        SVM_JXCSummaryBLL.ComputInventory(int.Parse(select_Client.SelectValue), int.Parse(ddl_Month.SelectedValue));
        BindGrid();

        MessageBox.Show(this, "保存成功!");
    }
    protected bool bEditStaleInventory  = false;    //是否可填报 界期品库存

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            #region 获取页面参数
            if (Request.QueryString["ClientID"] != null)
            {
                ViewState["ClientID"] = Int32.Parse(Request.QueryString["ClientID"]);
                Session["ClientID"]   = ViewState["ClientID"];
            }
            else if (Session["ClientID"] != null)
            {
                ViewState["ClientID"] = Int32.Parse(Session["ClientID"].ToString());
            }

            ViewState["IsOpponent"] = Request.QueryString["IsOpponent"] == null ? 1 : int.Parse(Request.QueryString["IsOpponent"]);
            #endregion

            BindDropDown();

            if (Request.QueryString["AccountMonth"] != null)
            {
                ddl_Month.SelectedValue = Request.QueryString["AccountMonth"];
            }

            if (ViewState["ClientID"] != null)
            {
                CM_ClientBLL client = new CM_ClientBLL((int)ViewState["ClientID"]);

                #region 载入客户信息
                ViewState["ClientType"]   = client.Model.ClientType;
                select_Client.SelectValue = ViewState["ClientID"].ToString();
                select_Client.SelectText  = client.Model.FullName;
                select_Client.PageUrl     = "~/SubModule/CM/PopSearch/Search_SelectClient.aspx?ClientType=" +
                                            client.Model.ClientType.ToString() + "&OrganizeCity=" + client.Model.OrganizeCity.ToString();
                tr_OrganizeCity.SelectValue = client.Model.OrganizeCity.ToString();

                select_Client.Enabled   = false;
                tr_OrganizeCity.Enabled = false;

                #region 判断传入客户参数的客户类别
                if (client.Model.ClientType == 2 && client.Model["DIClassify"] == "1")
                {
                    Header.Attributes["WebPageSubCode"] = "ClientClassify=1";    //1:经销商
                }
                else if (client.Model.ClientType == 2 && client.Model["DIClassify"] != "1")
                {
                    Header.Attributes["WebPageSubCode"] = "ClientClassify=2";    //2:分销商
                }
                else if (client.Model.ClientType == 3 && client.Model["IsPromote"] == "1")
                {
                    Header.Attributes["WebPageSubCode"] = "ClientClassify=3";    //3:促销门店
                }
                else
                {
                    Header.Attributes["WebPageSubCode"] = "ClientClassify=4";    //4:非促销门店
                }
                #endregion

                #region 获取填报权限
                int    module  = 0;
                string extCode = "";      //分销商、返利店的进销存填报动作权限的后缀为2
                switch (Header.Attributes["WebPageSubCode"])
                {
                case "ClientClassify=1":            //1:经销商
                    module = 1220;
                    break;

                case "ClientClassify=2":            //2:分销商
                    module  = 1220;
                    extCode = "2";
                    break;

                case "ClientClassify=3":            //3:促销店
                    module = 1120;
                    break;

                case "ClientClassify=4":            //4:返利店
                    module  = 1120;
                    extCode = "2";
                    break;
                }

                ViewState["bEditPurchaseVolume"]  = Right_Assign_BLL.GetAccessRight((string)Session["UserName"], module, "EditPurchaseVolume" + extCode);
                ViewState["bEditSalesVolume"]     = Right_Assign_BLL.GetAccessRight((string)Session["UserName"], module, "EditSalesVolume" + extCode);
                ViewState["bEditRecallVolume"]    = Right_Assign_BLL.GetAccessRight((string)Session["UserName"], module, "EditRecallVolume" + extCode);
                ViewState["bEditReturnedVolume"]  = Right_Assign_BLL.GetAccessRight((string)Session["UserName"], module, "EditReturnedVolume" + extCode);
                ViewState["bEditGiftVolume"]      = Right_Assign_BLL.GetAccessRight((string)Session["UserName"], module, "EditGiftVolume" + extCode);
                ViewState["bEditEndingInventory"] = Right_Assign_BLL.GetAccessRight((string)Session["UserName"], module, "EditEndingInventory" + extCode);
                ViewState["bEditStaleInventory"]  = Right_Assign_BLL.GetAccessRight((string)Session["UserName"], module, "EditStaleInventory" + extCode);

                bEditPurchaseVolume  = (bool)ViewState["bEditPurchaseVolume"];
                bEditSalesVolume     = (bool)ViewState["bEditSalesVolume"];
                bEditRecallVolume    = (bool)ViewState["bEditRecallVolume"];
                bEditReturnedVolume  = (bool)ViewState["bEditReturnedVolume"];
                bEditGiftVolume      = (bool)ViewState["bEditGiftVolume"];
                bEditEndingInventory = (bool)ViewState["bEditEndingInventory"];
                bEditStaleInventory  = (bool)ViewState["bEditStaleInventory"];
                #endregion

                if (Request.QueryString["AccountMonth"] != null) //||
                //AC_AccountMonthBLL.GetMonthByDate(DateTime.Today.AddDays(-7)) < AC_AccountMonthBLL.GetMonthByDate(DateTime.Today) ||
                //AC_AccountMonthBLL.GetMonthByDate(DateTime.Today.AddDays(+7)) > AC_AccountMonthBLL.GetMonthByDate(DateTime.Today))
                {
                    //有指定会计月,或当前为月初前7天或是月末前7天,默认开始填报
                    int month = int.Parse(ddl_Month.SelectedValue);
                    SVM_JXCSummaryBLL.Init(int.Parse(select_Client.SelectValue), month, (int)ViewState["IsOpponent"]);
                    BindGrid();
                }
                #endregion
            }
            else
            {
                Response.Redirect("~/SubModule/desktop.aspx");
            }
        }

        #region 获取权限
        bEditPurchaseVolume  = (bool)ViewState["bEditPurchaseVolume"];
        bEditSalesVolume     = (bool)ViewState["bEditSalesVolume"];
        bEditRecallVolume    = (bool)ViewState["bEditRecallVolume"];
        bEditReturnedVolume  = (bool)ViewState["bEditReturnedVolume"];
        bEditGiftVolume      = (bool)ViewState["bEditGiftVolume"];
        bEditEndingInventory = (bool)ViewState["bEditEndingInventory"];
        bEditStaleInventory  = (bool)ViewState["bEditStaleInventory"];
        #endregion
    }