protected void bt_Sign_Click(object sender, EventArgs e)
 {
     int orderid = 0;
     int opstaff = Int32.Parse(Session["UserID"].ToString());
     //遍历DataGrid获得checked的ID
     foreach (GridViewRow item in gv_List.Rows)
     {
         if (((CheckBox)item.FindControl("cb_CheckID")).Checked == true)
         {
             orderid = Int32.Parse(this.gv_List.DataKeys[item.RowIndex].Value.ToString());
             CSO_SampleOfferBLL h = new CSO_SampleOfferBLL(orderid);
             if (h.Model.OfferMode == 1 && h.Model.ConfirmState == 3 && h.Model.TrackStaff == opstaff && DateTime.Parse(h.Model.InsertTime.ToShortDateString()) != DateTime.Today && DateTime.Parse(h.Model.InsertTime.AddDays(7).ToShortDateString()) >= DateTime.Today)
             {
                 h.SignConfirmOffer(opstaff);
             }
         }
     }
     BindGrid();
 }
    protected void bt_Sign_Click(object sender, EventArgs e)
    {
        int orderid = 0;
        int opstaff = Int32.Parse(Session["UserID"].ToString());

        //遍历DataGrid获得checked的ID
        foreach (GridViewRow item in gv_List.Rows)
        {
            if (((CheckBox)item.FindControl("cb_CheckID")).Checked == true)
            {
                orderid = Int32.Parse(this.gv_List.DataKeys[item.RowIndex].Value.ToString());
                CSO_SampleOfferBLL h = new CSO_SampleOfferBLL(orderid);
                if (h.Model.OfferMode == 1 && h.Model.ConfirmState == 3 && h.Model.TrackStaff == opstaff && DateTime.Parse(h.Model.InsertTime.ToShortDateString()) != DateTime.Today && DateTime.Parse(h.Model.InsertTime.AddDays(7).ToShortDateString()) >= DateTime.Today)
                {
                    h.SignConfirmOffer(opstaff);
                }
            }
        }
        BindGrid();
    }
    protected void bt_Balance_Click(object sender, EventArgs e)
    {
        int _city = 0, _distributor = 0, _trackstaff = 0, _offerman = 0;
        int _month = 0;

        int.TryParse(ddl_AccountMonth.SelectedValue, out _month);
        DateTime dtBegin = DateTime.Parse(this.tbx_begin.Text);
        DateTime dtEnd   = DateTime.Parse(this.tbx_end.Text).AddDays(1).AddSeconds(-1);

        int.TryParse(tr_OrganizeCity.SelectValue, out _city);
        int.TryParse(select_Client.SelectValue, out _distributor);
        int.TryParse(select_Staff.SelectValue, out _trackstaff);
        int.TryParse(select_Doctor.SelectValue, out _offerman);

        if (_city == 0)
        {
            MessageBox.Show(this, "请选择要提取的管理区域");
            return;
        }

        if (new Addr_OrganizeCityBLL(_city).Model.Level < 3)
        {
            MessageBox.Show(this, "提取的管理区域必须为营业部或办事处!");
            return;
        }

        int ret = CSO_SampleOfferBLL.BalanceFee(_city, _month, dtBegin, dtEnd, _distributor, _trackstaff, _offerman, (int)Session["UserID"]);

        if (ret == -1)
        {
            MessageBox.Show(this, "没有可提取的费用记录!");
            return;
        }

        if (ret > 0)
        {
            MessageBox.ShowAndRedirect(this, "成功提取营养教育结算单!", "CSO_OfferBalanceDetail.aspx?OfferBalanceID=" + ret.ToString());
        }
    }