//protected void ddl_DI_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    select_DI.Visible = ddl_DI.SelectedIndex == 0;
    //    tbx_DICode.Visible = ddl_DI.SelectedIndex != 0;
    //}
    //protected void ddl_RT_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    select_RT.Visible = ddl_RT.SelectedIndex == 0;
    //    tbx_RTCode.Visible = ddl_RT.SelectedIndex != 0;
    //}
    protected void bt_Submit_Click(object sender, EventArgs e)
    {
        int _month = AC_AccountMonthBLL.GetMonthByDate(DateTime.Now) - 1;
        foreach (GridViewRow row in gv_ListDetail.Rows)
        {
            int hasid = int.Parse(gv_ListDetail.DataKeys[row.RowIndex][0].ToString());

            bool usefullnow = (row.FindControl("cbx_id") as CheckBox).Checked;
            if (usefullnow)
            {
                if (hasid == 0)
                {
                    SVM_MYSaleInFlagBLL _item = new SVM_MYSaleInFlagBLL();
                    _item.Model.ClientID = int.Parse(gv_ListDetail.DataKeys[row.RowIndex][1].ToString());
                    _item.Model.AccountMonth = _month;
                    _item.Model.ApproveFlag = 2;
                    _item.Add();
                }

            }
            else
            {
                if (hasid != 0)
                {
                    SVM_MYSaleInFlagBLL _item = new SVM_MYSaleInFlagBLL(hasid);
                    _item.Delete(hasid);
                }

            }
        }
        MessageBox.ShowAndRedirect(this, "提交成功!", "MYSaleInFlagEdit.aspx");
    }
    //protected void ddl_DI_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    select_DI.Visible = ddl_DI.SelectedIndex == 0;
    //    tbx_DICode.Visible = ddl_DI.SelectedIndex != 0;
    //}
    //protected void ddl_RT_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    select_RT.Visible = ddl_RT.SelectedIndex == 0;
    //    tbx_RTCode.Visible = ddl_RT.SelectedIndex != 0;
    //}
    protected void bt_Submit_Click(object sender, EventArgs e)
    {
        int _month = AC_AccountMonthBLL.GetMonthByDate(DateTime.Now) - 1;

        foreach (GridViewRow row in gv_ListDetail.Rows)
        {
            int hasid = int.Parse(gv_ListDetail.DataKeys[row.RowIndex][0].ToString());

            bool usefullnow = (row.FindControl("cbx_id") as CheckBox).Checked;
            if (usefullnow)
            {
                if (hasid == 0)
                {
                    SVM_MYSaleInFlagBLL _item = new SVM_MYSaleInFlagBLL();
                    _item.Model.ClientID     = int.Parse(gv_ListDetail.DataKeys[row.RowIndex][1].ToString());
                    _item.Model.AccountMonth = _month;
                    _item.Model.ApproveFlag  = 2;
                    _item.Add();
                }
            }
            else
            {
                if (hasid != 0)
                {
                    SVM_MYSaleInFlagBLL _item = new SVM_MYSaleInFlagBLL(hasid);
                    _item.Delete(hasid);
                }
            }
        }
        MessageBox.ShowAndRedirect(this, "提交成功!", "MYSaleInFlagEdit.aspx");
    }
예제 #3
0
    private DataTable GetExtTable()
    {
        int _beginmonth = int.Parse(ddl_BeginMonth.SelectedValue);
        int _endmonth   = int.Parse(ddl_EndMonth.SelectedValue);
        int _city       = 0;

        if (tr_OrganizeCity.SelectValue != "")
        {
            _city = int.Parse(tr_OrganizeCity.SelectValue);
        }
        string Condition = "";
        int    _staff    = 0;

        if (select_Staff.SelectValue != "")
        {
            _staff = int.Parse(select_Staff.SelectValue);
        }

        //if (ddl_DI.SelectedValue == "0")
        //{
        if (select_DI.SelectValue != "0" && select_DI.SelectValue != "")
        {
            Condition += " AND Supplier.ID =" + select_DI.SelectValue;
        }
        //}
        //else
        //{
        //    if (tbx_DICode.Text != "")
        //    {
        //        Condition += (ddl_DI.SelectedValue == "1" ? " AND Supplier.FullName" : " AND Supplier.Code") + " LIKE '%" + tbx_DICode.Text.Trim() + "%'";
        //    }
        //}
        //if (ddl_RT.SelectedValue == "0")
        //{
        if (select_RT.SelectValue != "0" && select_RT.SelectValue != "")
        {
            Condition += " AND CM_Client.ID =" + select_RT.SelectValue;
        }
        //}
        //else
        //{
        //    if (tbx_RTCode.Text != "")
        //    {
        //        Condition += (ddl_RT.SelectedValue == "1" ? " AND CM_Client.FullName" : " AND CM_Client.Code") + " LIKE '%" + tbx_RTCode.Text.Trim() + "%'";
        //    }
        //}

        return(SVM_MYSaleInFlagBLL.GetRPTSummary(_beginmonth, _endmonth, _city, _staff, Condition));
    }
    private void BindGrid()
    {
        int _month = int.Parse(ddl_Month.SelectedValue);
        int _staff = 0;

        if (select_Staff.SelectValue != "")
        {
            _staff = int.Parse(select_Staff.SelectValue);
        }
        #region 编辑查询条件
        int _city = 1;
        if (tr_OrganizeCity.SelectValue != "")
        {
            _city = int.Parse(tr_OrganizeCity.SelectValue);
        }
        string RTCondition = "", DICondition = "";
        //if (ddl_DI.SelectedValue == "0")
        //{
        if (select_DI.SelectValue != "0" && select_DI.SelectValue != "")
        {
            DICondition += " AND Supplier.ID =" + select_DI.SelectValue;
        }
        //}
        //else
        //{
        //    if (tbx_DICode.Text != "")
        //    {
        //        DICondition += (ddl_DI.SelectedValue == "1" ? " AND Supplier.FullName" : " AND Supplier.Code") + " LIKE '%" + tbx_DICode.Text.Trim() + "%'";
        //    }
        //}
        //if (ddl_RT.SelectedValue == "0")
        //{
        if (select_RT.SelectValue != "0" && select_RT.SelectValue != "")
        {
            RTCondition += " AND CM_Client.ID =" + select_RT.SelectValue;
        }
        //}
        //else
        //{
        //    if (tbx_RTCode.Text != "")
        //    {
        //        RTCondition += (ddl_RT.SelectedValue == "1" ? " AND CM_Client.FullName" : " AND CM_Client.Code") + " LIKE '%" + tbx_RTCode.Text.Trim() + "%'";
        //    }
        //}
        #endregion


        Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"]);
        if (staff.Model.Position == 211 ||
            staff.Model.Position == 212 ||
            staff.Model.Position == 209 ||
            staff.Model.Position == 210)
        {
            if (_month == AC_AccountMonthBLL.GetMonthByDate(DateTime.Now) - 1)
            {
                string[] allowdays = Addr_OrganizeCityParamBLL.GetValueByType(1, 25).Replace(" ", "").Split(new char[] { ',', ',', ';', ';' });
                if (allowdays.Contains(DateTime.Now.Day.ToString()))
                {
                    bt_Submit.Visible = true;
                    cbx_Head.Visible  = true;
                }
            }
        }
        DataTable dt = SVM_MYSaleInFlagBLL.GetList(_month, _city, _staff, DICondition, RTCondition);
        lt_RTCount.Text          = dt.Rows.Count.ToString();
        gv_ListDetail.DataSource = dt;
        gv_ListDetail.BindGrid();
    }