protected void ibtnLogin_Click(object sender, ImageClickEventArgs e)
    {
        string usname = txtUer.Text;
        string pwd    = txtPwd.Text;


        BG_User user = BG_UserLogic.UserLogin(usname, pwd);

        if (user != null)
        {
            Session[Constant.UserID]   = user.UserID;       //用户ID
            Session[Constant.UserName] = user.UserName;     //用户名称
            Session[Constant.UserNum]  = user.UserNum;      //用户工号
            Session[Constant.UserLim]  = user.UserLim;      //用户权限
            Session[Constant.DepID]    = user.DepID;        //用户所属部门ID
            BG_Department department = BG_DepartmentManager.GetBG_DepartmentByDepID(user.DepID);
            Session[Constant.DepName] = department.DepName; //用户所属部门名称


            Response.Redirect("default.aspx", true);
        }
        else
        {
            X.Msg.Alert("Error", "密码或帐户名错误!").Show();
        }
    }
    //protected void btnLogin_Click(object sender, DirectEventArgs e)
    //{
    //    string usname = TextBox1.Text;
    //    string pwd = TextBox1.Text;


    //    BG_User user = BG_UserLogic.UserLogin(usname, pwd);
    //    if (user != null)
    //    {
    //        Session[Constant.UserID] = user.UserID;         //用户ID
    //        Session[Constant.UserName] = user.UserName;     //用户名称
    //        Session[Constant.UserNum] = user.UserNum;       //用户工号
    //        Session[Constant.UserLim] = user.UserLim;       //用户权限
    //        Session[Constant.DepID] = user.DepID;           //用户所属部门ID
    //        BG_Department department = BG_DepartmentManager.GetBG_DepartmentByDepID(user.DepID);
    //        Session[Constant.DepName] = department.DepName; //用户所属部门名称


    //        Response.Redirect("default.aspx", true);
    //    }
    //    else
    //    {
    //        X.Msg.Alert("Error", "密码或帐户名错误!").Show();

    //    }
    //}

    protected void ibtnLogin_Click(object sender, ImageClickEventArgs e)
    {
        string usname = txtUer.Text;
        string pwd    = txtPwd.Text;


        BG_User user = BG_UserLogic.UserLogin(usname, pwd);

        if (user != null)
        {
            Session[Constant.UserID]   = user.UserID;       //用户ID
            Session[Constant.UserName] = user.UserName;     //用户名称
            Session[Constant.UserNum]  = user.UserNum;      //用户工号
            Session[Constant.UserLim]  = user.UserLim;      //用户权限
            Session[Constant.DepID]    = user.DepID;        //用户所属部门ID
            BG_Department department = BG_DepartmentManager.GetBG_DepartmentByDepID(user.DepID);
            Session[Constant.DepName] = department.DepName; //用户所属部门名称
            Session["CurrentYear"]    = BG_SysSettingLogic.GetLastYear();
            Session["IsLogin"]        = 1;
            BG_User userd = new BG_User();
            user.IsLogin = 1;
            BG_UserManager.ModifyBG_User(userd);
            Session[Constant.listallocationstr] = GetXML().Trim();
            Response.Redirect("default.aspx", true);
        }
        else
        {
            X.Msg.Alert("Error", "密码或帐户名错误!").Show();
        }
    }
 private DataTable getnew(DataTable dt)
 {
     dt.Columns.Add("DepName");
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         dt.Rows[i]["DepName"] = BG_DepartmentManager.GetBG_DepartmentByDepID(common.IntSafeConvert(dt.Rows[i]["DepID"])).DepName;
     }
     return(dt);
 }
    public void ModifyDepartment(string depID)
    {
        int           DepID = StrToInt(depID);
        BG_Department dp    = BG_DepartmentManager.GetBG_DepartmentByDepID(DepID);

        hiddepid.Text  = DepID.ToString();
        txtEDName.Text = dp.DepName.ToString();
        if (dp.DepRem == null)
        {
            txtEDDes.Text = null;
        }
        txtEDDes.Text = dp.DepRem.ToString();
        WinEdit.Show();
    }
    public void DelDepartment(string depID)
    {
        int DepID = StrToInt(depID);

        if (BG_BudItemsLogic.GetAllMonByDepID(DepID, CurrentYear))
        {
            X.Msg.Alert("系统提示", "您已在该部门分配数据,无法删除此部门.").Show();
        }
        else
        {
            BG_DepartmentManager.DeleteBG_DepartmentByID(DepID);
        }
        DtDataBind();
    }
    protected void btnMod_DirectClick(object sender, DirectEventArgs e)
    {
        BG_Department dp = BG_DepartmentManager.GetBG_DepartmentByDepID(StrToInt(hiddepid.Text));

        if (BG_DepartmentLogic.GetBG_DepartmentByName(AdName.Text.Trim()) != null)
        {
            X.Msg.Alert("提示", "部门名称重复,请重新填写.").Show();
            return;
        }
        dp.DepName = txtEDName.Text.Trim().Replace(",", string.Empty).Replace(",", string.Empty);
        dp.DepRem  = txtEDDes.Text.Trim().Replace(",", string.Empty).Replace(",", string.Empty);
        BG_DepartmentManager.ModifyBG_Department(dp);
        txtEDName.Clear();
        hiddepid.Clear();
        txtEDDes.Clear();
        DtDataBind();
        reset.Reset();
        WinEdit.Close();
    }
    private void ApplyAlterDataBind()
    {
        DataTable dt = BGApplyReimburManager.GetApplyReimbur(arid); //BGPayIncomeManager.GetPayIncomeListByPIID(arid)

        if (dt.Rows.Count > 0)
        {
            //string PiName = dt.Rows[0]["PIEcoSubName"].ToString();
            //txtPro.Text = PiName;
            //ddlDepart.Text = dt.Rows[0]["DepID"].ToString();
            //txtARReiSinNum.Text = dt.Rows[0]["ARReiSinNum"].ToString();
            //ddlARExpType.Text = dt.Rows[0]["ARExpType"].ToString();
            //ddlARExpPro.SelectedItem.Value = dt.Rows[0]["ARExpPro"].ToString();
            txtBITime.Text = dt.Rows[0]["ARTime"].ToString();
            //ddlARExpSub.Text = dt.Rows[0][""].ToString();
            txtARRepDep.Text = dt.Rows[0]["ARRepDep"].ToString();
            txtARAgent.Text  = dt.Rows[0]["ARAgent"].ToString();
            txtARMon.Text    = Convert.ToDecimal(dt.Rows[0]["ARMon"]).ToString("f8").TrimEnd('0').TrimEnd('.');
            txtARExcu.Text   = dt.Rows[0]["ARExcu"].ToString();
            lbDepName.Text   = BG_DepartmentManager.GetBG_DepartmentByDepID(Convert.ToInt32(dt.Rows[0]["DepID"].ToString())).DepName;

            DataTable dt1    = BGReimDocumentsManager.GetReimDocuments(arid);
            string    RDType = string.Empty;
            if (dt1.Rows.Count > 0)
            {
                RDType        = dt1.Rows[0]["RDType"].ToString();
                lbRDType.Text = RDType;
            }

            //if (RDType == "")
            //{
            //    Response.Redirect("SearchTravelCost.aspx?arid=" + arid, true);
            //}
            //else if (RDType == "")
            //{
            //    Response.Redirect("SearchMediCost.aspx?arid=" + arid, true);
            //}
            //else if (RDType == "")
            //{
            //    Response.Redirect("SearchOtherCost.aspx?arid=" + arid, true);
            //}
        }
    }
    private void DepDataBind()
    {
        DataTable dt = new DataTable(); //BGDepartmentManager.GetDepByfadepid(depid);

        if (UserLimStr == "录入员")
        {
            cmbDep.Text    = BG_DepartmentManager.GetBG_DepartmentByDepID(depid).DepName;
            Execute.Hidden = false;
        }
        else
        {
            cmbDep.Enable(true);
            dt = BGDepartmentManager.GetDepByfadepid(AreaDepID);
            cmbDep.Items.Add(new Ext.Net.ListItem("全局", "0"));
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                //  cmbDepnaem.Items.Add(new Ext.Net.ListItem(depTable.Rows[i]["depName"].ToString(), depTable.Rows[i]["depID"].ToString()));
                cmbDep.Items.Add(new Ext.Net.ListItem(dt.Rows[i]["DepName"].ToString(), dt.Rows[i]["DepID"].ToString()));
            }
        }
    }
 protected void btnWinAdd_DirectClick(object sender, DirectEventArgs e)
 {
     if (AdName.Text != null)
     {
         if (BG_DepartmentLogic.GetBG_DepartmentByName(AdName.Text.Trim()) != null)
         {
             X.Msg.Alert("提示", "部门名称重复,请重新填写.").Show();
             return;
         }
         BG_Department dp = new BG_Department();
         dp.DepName = AdName.Text.ToString();
         dp.DepRem  = AdDes.Text.ToString();
         dp.FaDepID = AreaDepID;
         dp.DepLev  = 4;
         BG_DepartmentManager.AddBG_Department(dp);
         DtDataBind();
         resetform.Reset();
     }
     else
     {
         X.Msg.Alert("提示", "部门为必填项").Show();
     }
 }
Beispiel #10
0
    public void Memberselect(string uid)
    {
        uid = uid.Contains("用户")?uid.Replace("用户", ""):uid;
        //FieldSet2.Hidden = !Radio4.Checked;
        TextField1.ReadOnly   = true;
        Session["TextField1"] = 0;
        if (uid.Length <= 0)
        {
            return;
        }
        hidUserID.Value = uid;
        chkClear();
        int     id   = StrToInt(uid);
        BG_User user = BG_UserManager.GetBG_UserByUserID(id);

        //BG_User user = BG_UserManager.GetBG_UserByUsid(id);
        if (user != null)
        {
            TextField1.Text = user.UserName;
            int depid = user.DepID;
            TextField3.Text = user.UserNum;
            TextField4.Text = user.UserIDNum;
            txtRem.Text     = user.UserRem;
            UserID.Text     = user.UserID.ToString();
            string limit = user.UserLim;
            if (common.IntSafeConvert(user.IsVIP.ToString().Substring(0, 1)) == 1)
            {
                Radio7.Checked = true;
            }
            else if (common.IntSafeConvert(user.IsVIP.ToString().Substring(0, 1)) == 0)
            {
                Radio8.Checked = true;
            }
            //else
            //{
            //    Radio19.Checked = true;
            //}
            if (user.ApplyRem.Length > 0 && user.ApplyRem.Substring(0, 1) == "1")
            {
                Radio9.Checked = true;
            }
            else
            {
                Radio9.Checked = false;
            }
            if (user.ApplyRem.Length > 0 && user.ApplyRem.Substring(1, 1) == "1")
            {
                Radio10.Checked = true;
            }
            else
            {
                Radio10.Checked = false;
            }
            if (user.ApplyRem.Length > 0 && user.ApplyRem.Substring(2, 1) == "1")
            {
                Radio11.Checked = true;
            }
            else
            {
                Radio11.Checked = false;
            }
            if (limit.Length >= 5)
            {
                if (limit.Substring(0, 1) == "1")
                {
                    Radio1.Checked = true;
                }
                if (limit.Substring(1, 1) == "1")
                {
                    Radio2.Checked = true;
                }
                if (limit.Substring(2, 1) == "1")
                {
                    Radio3.Checked = true;
                }
                if (limit.Substring(3, 1) == "1")
                {
                    Radio4.Checked = true;
                }
                if (limit.Substring(4, 1) == "1")
                {
                    Radio5.Checked = true;
                }
                if (limit.Substring(5, 1) == "1")
                {
                    Radio6.Checked = true;
                }
            }

            BG_Department dp = BG_DepartmentManager.GetBG_DepartmentByDepID(depid);
            if (dp != null)
            {
                //ComboBox1.RawValue = dp.DepName;
                ComboBox1.Text = dp.DepName;
                if (dp.DepName.Contains("局长基金"))
                {
                    Radio11.Enable(true);
                }
                else
                {
                    Radio11.Disable(true);
                }
            }
        }
    }
Beispiel #11
0
    protected void submit_DirectClick(object sender, DirectEventArgs e)
    {
        txtshow.Text = "";
        int           depid   = common.IntSafeConvert(cmbDep.SelectedItem.Value);
        List <object> strlist = new List <object>();
        string        depname = "";
        string        name    = "";
        decimal       mon     = 0;

        if (depid == 0 && cmbPPA.SelectedItem.Value == "全部")
        {
            DataTable dt = BG_EstimatesAllocationLogic.GetALLEAMon(common.IntSafeConvert(CurrentYear));
            //for (int i = 0; i < dt.Rows.Count; i++)
            //{
            //    depname = BG_DepartmentManager.GetBG_DepartmentByDepID(common.IntSafeConvert(dt.Rows[i]["depid"])).DepName;
            //    name = BG_PayIncomeManager.GetBG_PayIncomeByPIID(common.IntSafeConvert(dt.Rows[i]["PIID"])).PIEcoSubName;
            //    strlist.Add(new { depname = depname, name = name, mon = mon });
            //}
            if (dt.Rows.Count <= 0)
            {
                strlist.Clear();
                string message = "没有查询到数据";
                txtshow.Text = message;
            }
            else
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    depname = BG_DepartmentManager.GetBG_DepartmentByDepID(common.IntSafeConvert(dt.Rows[i]["DepID"])).DepName;
                    name    = BG_PayIncomeManager.GetBG_PayIncomeByPIID(common.IntSafeConvert(dt.Rows[i]["PIID"])).PIEcoSubName;
                    mon     = ParToDecimal.ParToDel(dt.Rows[i]["BEAMon"].ToString());
                    strlist.Add(new { depname = depname, name = name, mon = mon });
                }
            }
        }
        else if (depid == 0 && cmbPPA.SelectedItem.Value != "全部")
        {
            name = cmbPPA.SelectedItem.Value;
            string    bgpi  = BG_BudItemsLogic.GetBG_PayIncomeByname(name);
            string[]  slist = bgpi.Split(',');
            DataTable dt1   = new DataTable();
            for (int i = 0; i < slist.Count(); i++)
            {
                int piid = common.IntSafeConvert(slist[i]);
                dt1 = BG_EstimatesAllocationLogic.GetEAMonDTbyPIID(common.IntSafeConvert(CurrentYear), piid);
                if (dt1.Rows.Count > 0)
                {
                    for (int j = 0; j < dt1.Rows.Count; j++)
                    {
                        depname = BG_DepartmentManager.GetBG_DepartmentByDepID(common.IntSafeConvert(dt1.Rows[j]["DepID"])).DepName;
                        mon    += ParToDecimal.ParToDel(dt1.Rows[j]["BEAMon"].ToString());
                        strlist.Add(new { depname = depname, name = name, mon = mon });
                    }
                }
            }
            if (strlist.Count <= 0)
            {
                strlist.Clear();
                string message = "没有查询到数据";
                txtshow.Text = message;
            }
        }
        else if (depid != 0 && cmbPPA.SelectedItem.Value == "全部")
        {
            depname = cmbDep.SelectedItem.Text;
            DataTable dt = BG_EstimatesAllocationLogic.GetEAMonDTbyDepID(common.IntSafeConvert(CurrentYear), common.IntSafeConvert(cmbDep.SelectedItem.Value));
            if (dt.Rows.Count <= 0)
            {
                strlist.Clear();
                string message = "没有查询到数据";
                txtshow.Text = message;
            }
            else
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    name = BG_PayIncomeManager.GetBG_PayIncomeByPIID(common.IntSafeConvert(dt.Rows[i]["PIID"])).PIEcoSubName;
                    mon  = ParToDecimal.ParToDel(dt.Rows[i]["BEAMon"].ToString());
                    strlist.Add(new { depname = depname, name = name, mon = mon });
                }
            }
        }
        else
        {
            name = cmbPPA.SelectedItem.Value;
            string    bgpi  = BG_BudItemsLogic.GetBG_PayIncomeByname(name);
            string[]  slist = bgpi.Split(',');
            DataTable dt1   = new DataTable();
            for (int i = 0; i < slist.Count(); i++)
            {
                int piid = common.IntSafeConvert(slist[i]);
                mon += BG_EstimatesAllocationLogic.GetEAMon(depid, piid, common.IntSafeConvert(CurrentYear));
            }
            if (mon <= 0)
            {
                strlist.Clear();
                string message = "没有查询到数据";
                txtshow.Text = message;
            }
            else
            {
                depname = cmbDep.SelectedItem.Text;
                strlist.Add(new { depname = depname, name = name, mon = mon });
            }
        }
        DivideStore.DataSource = strlist;
        DivideStore.DataBind();
    }
    private void ApplyLimitStoreBind()
    {
        int    month  = common.IntSafeConvert(cmbmonth.SelectedItem.Value);
        string months = "";

//        if (month == 1)
//        {
//            X.Msg.Alert("提示", "一月无法查询").Show();
//        }
//        else
        if (month - 1 < 10)
        {
            months = "0" + (month - 1).ToString();
        }
        else
        {
            months = (month - 1).ToString();
        }
        string    yearMonth = cmbyear.SelectedItem.Value + "-" + months;
        string    now       = cmbyear.SelectedItem.Value + "-" + cmbmonth.SelectedItem.Value;
        decimal   total     = 0;
        DataTable dtpay     = BG_MonPayPlanGenerateLogic.GetMonPay(common.IntSafeConvert(CurrentYear), DepID);

        for (int i = 0; i < dtpay.Rows.Count; i++)
        {
            total += ParToDecimal.ParToDel(dtpay.Rows[i][1].ToString()) + ParToDecimal.ParToDel(dtpay.Rows[i][2].ToString());
        }
        DataTable dt = new DataTable();

        dt.Columns.Add("depName");
        dt.Columns.Add("totalBG");
        dt.Columns.Add("LastmonthBalance");
        dt.Columns.Add("Application");
        dt.Columns.Add("CurrentAvailable");
        dt.Columns.Add("Execute");
        if ((UserLimStr == "录入员"))
        {
            Execute.Hidden = false;
            DataRow dr = dt.NewRow();
            dr["depName"] =
                BG_DepartmentManager.GetBG_DepartmentByDepID(common.IntSafeConvert(depid)).DepName;
            dr["totalBG"] = total * 10000;
            decimal sq = BG_MonPayPlanGenerateLogic.GetsqMont(now,
                                                              depid);
            //decimal sx = BG_MonPayPlanGenerateLogic.GetbxMon(now,depid);
            dr["LastmonthBalance"] = (total - sq) * 10000;
            decimal s_q = BG_MonPayPlanGenerateLogic.GetsqMon(now, depid);
            dr["Application"] = s_q * 10000;
            decimal extdc = 0;
            if (!BG_ApplyReimburLogic.ISApplyBackMon(yearMonth, DepID))
            {
                extdc = BG_ApplyReimburLogic.ApplyMon(now, DepID);
            }
            else
            {
                extdc = BG_ApplyReimburLogic.ApplyMon(now, DepID) -
                        BG_ApplyReimburLogic.ApplyBackMon(yearMonth, DepID);
            }
            dr["Execute"]          = extdc * 10000;
            dr["CurrentAvailable"] = (sq - extdc) * 10000;

            dt.Rows.Add(dr);
        }
        else
        {
            int deptid = 0;
            deptid = common.IntSafeConvert(cmbDep.SelectedItem.Value);

            if (deptid > 0)
            {
                DataRow dr = dt.NewRow();
                dr["depName"] =
                    BG_DepartmentManager.GetBG_DepartmentByDepID(common.IntSafeConvert(deptid)).DepName;
                dr["totalBG"] = total * 10000;
                decimal sq = BG_MonPayPlanGenerateLogic.GetsqMont(yearMonth, deptid);
                //decimal sx = BG_MonPayPlanGenerateLogic.GetbxMon(yearMonth,deptid);
                dr["LastmonthBalance"] = (total - sq) * 10000;
                decimal s_q = BG_MonPayPlanGenerateLogic.GetsqMon(now, deptid);
                dr["Application"]      = s_q * 10000;
                dr["CurrentAvailable"] = (sq) * 10000;
                dt.Rows.Add(dr);
            }
            else
            {
                DataTable dtdep = BG_MonPayPlanGenerateLogic.GetMonByTime(yearMonth);
                if (dtdep == null)
                {
                }
                else
                {
                    for (int i = 0; i < dtdep.Rows.Count; i++)
                    {
                        DataRow dr = dt.NewRow();
                        dr["depName"] =
                            BG_DepartmentManager.GetBG_DepartmentByDepID(common.IntSafeConvert(dtdep.Rows[i]["Deptid"]))
                            .DepName;
                        dr["totalBG"] = total * 10000;
                        decimal sq = BG_MonPayPlanGenerateLogic.GetsqMont(yearMonth,
                                                                          common.IntSafeConvert(dtdep.Rows[i]["Deptid"]));
                        //decimal sx = BG_MonPayPlanGenerateLogic.GetbxMon(yearMonth, common.IntSafeConvert(dtdep.Rows[i]["Deptid"]));
                        dr["LastmonthBalance"] = (total - sq) * 10000;
                        decimal s_q = BG_MonPayPlanGenerateLogic.GetsqMon(now,
                                                                          common.IntSafeConvert(dtdep.Rows[i]["Deptid"]));
                        dr["Application"]      = s_q * 10000;
                        dr["CurrentAvailable"] = (sq) * 10000;
                        dt.Rows.Add(dr);
                    }
                }
            }
        }
        if (dt.Rows.Count == 0)
        {
            X.Msg.Alert("提示", yearMonth + "没有查询到数据!").Show();
        }
        ApplyLimit.DataSource = dt;
        ApplyLimit.DataBind();
    }
Beispiel #13
0
    //protected void GetSelect_DirectClick(object sender, DirectEventArgs e)
    //{
    //    string Strincome = Hidselector.Value.ToString();
    //    string[] income = Strincome.Split(',');
    //    DataTable dt = null;
    //    dt.Columns.Add();
    //    for (int i = 0; i < income.Count(); i++)
    //    {

    //    }
    //}

    protected void RemoteEdit(object sender, RemoteEditEventArgs e)
    {
        if (ParToDecimal.ParToDel(HidSupp.Text.ToString()) < 0 || ParToDecimal.ParToDel(HidBAA.Text.ToString()) < 0)
        {
            if (ParToDecimal.ParToDel(HidSupp.Text) < 0)
            {
                X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show(); return;
            }
            if (ParToDecimal.ParToDel(HidBAA.Text) < 0)
            {
                X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show(); return;
            }
        }
        e.Accept = true;
        string[]   idStrArr = HidSlist.Text.ToString().TrimEnd('&').Split('&');
        List <int> slist    = new List <int>();

        foreach (string item in idStrArr)
        {
            int IntId = common.IntSafeConvert(item);
            if (!slist.Contains(IntId))
            {
                slist.Add(IntId);
            }
        }
        int        piid = common.IntSafeConvert(e.NodeID);
        RowChanges rc   = e.Changes[0];

        //if (rc.Value<float>() <= 0 && rc.OldValue<float>() <= 0)
        //{
        //    X.Msg.Alert("提示", "填写数字不能为0").Show();
        //    return;
        //}
        if (e.Json == null)
        {
            return;
        }

        if (!slist.Contains(piid))
        {
            X.Msg.Alert("提示", "此处不可填写,请填写到正确位置").Show();
            return;
        }
        else
        {
            int                 year    = common.IntSafeConvert(CurrentYear);
            decimal             baamon  = 0;
            decimal             suppmon = 0;
            BG_BudgetAllocation bg      = BG_BudgetAllocationLogic.GetMonDT(year, piid, depid);
            if (bg == null)
            {
                BG_BudgetAllocation bgadd = new BG_BudgetAllocation();
                foreach (RowChanges change in e.Changes)
                {
                    if (change.Field == "BAAMon" && change.IsDirty <float>())
                    {
                        bgadd.BAAMon = ParToDecimal.ParToDel(change.Value <float>().ToString());
                        baamon       = ParToDecimal.ParToDel(HidBAA.Text.ToString()) - bgadd.BAAMon;
                        if (baamon < 0)
                        {
                            X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show();
                            rc.SetValue(rc.OldValue <float>());
                            return;
                        }
                    }
                    else if (change.Field == "SuppMon" && change.IsDirty <float>())
                    {
                        bgadd.SuppMon = ParToDecimal.ParToDel(change.Value <float>().ToString());
                        suppmon       = ParToDecimal.ParToDel(HidSupp.Text) - bgadd.SuppMon;
                        if (suppmon < 0)
                        {
                            X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show();
                            rc.SetValue(rc.OldValue <float>());
                            return;
                        }
                    }
                }
                bgadd.PIID    = piid;
                bgadd.BAAYear = year;
                bgadd.DepID   = depid;

                if (BG_BudgetAllocationManager.AddBG_BudgetAllocation(bgadd).BAAID > 0)
                {
                    BG_BudgetAllocationHis bgBudgetAllocationHis = new BG_BudgetAllocationHis();
                    bgBudgetAllocationHis.BAAID      = bgadd.BAAID;
                    bgBudgetAllocationHis.NewBAAMon  = bgadd.BAAMon;
                    bgBudgetAllocationHis.Crtime     = DateTime.Now;
                    bgBudgetAllocationHis.DepID      = bgadd.DepID;
                    bgBudgetAllocationHis.PIID       = bgadd.PIID;
                    bgBudgetAllocationHis.NewSuppMon = bgadd.SuppMon;
                    bgBudgetAllocationHis.UserOp     = UserName;
                    bgBudgetAllocationHis.OldBAAMon  = rc.Field == "BAAMon" && rc.IsDirty <float>()
                        ? (decimal)rc.OldValue <float>()
                        : bgadd.BAAMon;
                    bgBudgetAllocationHis.OldSuppMon = rc.Field == "SuppMon" && rc.IsDirty <float>()
                        ? (decimal)rc.OldValue <float>()
                        : bgadd.SuppMon;
                    bgBudgetAllocationHis.AddBAAMon  = bgBudgetAllocationHis.NewBAAMon - bgBudgetAllocationHis.OldBAAMon;
                    bgBudgetAllocationHis.AddSuppMon = bgBudgetAllocationHis.NewSuppMon - bgBudgetAllocationHis.OldSuppMon;
                    bgBudgetAllocationHis.DepName    = BG_DepartmentManager.GetBG_DepartmentByDepID(bgadd.DepID).DepName;
                    BG_BudgetAllocationHisManager.AddBG_BudgetAllocationHis(bgBudgetAllocationHis);
                }
                DtDataBind();

                //if (baamon < 0 || suppmon < 0)
                //{
                //    if (baamon > 0)
                //    {
                //        X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show();
                //        rc.SetValue(rc.OldValue<float>());
                //    }
                //    else if (suppmon > 0)
                //    {
                //        X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show();
                //        rc.SetValue(rc.OldValue<float>());
                //    }
                //    else
                //    {
                //        X.Msg.Alert("提示", "追加余额或总余额不足,请核实后修改数据!").Show();
                //        rc.SetValue(rc.OldValue<float>());
                //    }

                //}
                //else
                //{
                //    BG_BudgetAllocationManager.AddBG_BudgetAllocation(bgadd);
                //    DtDataBind();
                //}
            }
            else
            {
                decimal Mon    = BG_MonPayPlanGenerateLogic.GetMonPayYear(piid, depid, year);
                decimal UseMon = BG_ApplyReimburLogic.GetARUseMon(piid, depid, year);
                //if (ParToDecimal.ParToDel(rc.OldValue<float>().ToString()) - ParToDecimal.ParToDel(rc.Value<float>().ToString())-(Mon - UseMon) > 0)
                //{
                if (Mon > 0)
                {
                    X.Msg.Alert("提示", "分配金额小于期初分配金额,会影响月度用款申请及预算执行!").Show();
                }
                foreach (RowChanges change in e.Changes)
                {
                    if (change.Field == "BAAMon" && change.IsDirty <float>())
                    {
                        bg.BAAMon = ParToDecimal.ParToDel(change.Value <float>().ToString());
                        baamon    = ParToDecimal.ParToDel(HidBAA.Text.ToString()) + ParToDecimal.ParToDel(change.OldValue <float>().ToString()) - bg.BAAMon;
                        if (baamon < 0)
                        {
                            X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show();
                            rc.SetValue(rc.OldValue <float>());
                            return;
                        }
                    }
                    else if (change.Field == "SuppMon" && change.IsDirty <float>())
                    {
                        bg.SuppMon = ParToDecimal.ParToDel(change.Value <float>().ToString());
                        suppmon    = ParToDecimal.ParToDel(HidSupp.Text.ToString()) + ParToDecimal.ParToDel(change.OldValue <float>().ToString()) - bg.SuppMon;
                        if (suppmon < 0)
                        {
                            X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show();
                            rc.SetValue(rc.OldValue <float>());
                            return;
                        }
                    }
                }
                //}
                if (BG_BudgetAllocationManager.ModifyBG_BudgetAllocation(bg))
                {
                    BG_BudgetAllocationHis bgBudgetAllocationHis = new BG_BudgetAllocationHis();
                    bgBudgetAllocationHis.BAAID      = bg.BAAID;
                    bgBudgetAllocationHis.NewBAAMon  = bg.BAAMon;
                    bgBudgetAllocationHis.Crtime     = DateTime.Now;
                    bgBudgetAllocationHis.DepID      = bg.DepID;
                    bgBudgetAllocationHis.PIID       = bg.PIID;
                    bgBudgetAllocationHis.NewSuppMon = bg.SuppMon;
                    bgBudgetAllocationHis.UserOp     = UserName;
                    bgBudgetAllocationHis.OldBAAMon  = rc.Field == "BAAMon" && rc.IsDirty <float>()
                        ? (decimal)rc.OldValue <float>()
                        : bg.BAAMon;
                    bgBudgetAllocationHis.OldSuppMon = rc.Field == "SuppMon" && rc.IsDirty <float>()
                        ? (decimal)rc.OldValue <float>()
                        : bg.SuppMon;
                    bgBudgetAllocationHis.AddBAAMon  = bgBudgetAllocationHis.NewBAAMon - bgBudgetAllocationHis.OldBAAMon;
                    bgBudgetAllocationHis.AddSuppMon = bgBudgetAllocationHis.NewSuppMon - bgBudgetAllocationHis.OldSuppMon;
                    bgBudgetAllocationHis.DepName    = BG_DepartmentManager.GetBG_DepartmentByDepID(bg.DepID).DepName;
                    BG_BudgetAllocationHisManager.AddBG_BudgetAllocationHis(bgBudgetAllocationHis);
                }
                DtDataBind();
                //if (baamon < 0 || suppmon < 0)
                //{
                //    if (baamon > 0)
                //    {
                //        X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show();
                //        rc.SetValue(rc.OldValue<float>());
                //    }
                //    else if (suppmon > 0)
                //    {
                //        X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show();
                //        rc.SetValue(rc.OldValue<float>());
                //    }
                //    else
                //    {
                //        X.Msg.Alert("提示", "追加余额或总余额不足,请核实后修改数据!").Show();
                //        rc.SetValue(rc.OldValue<float>());
                //    }

                //}
                //else
                //{
                //    BG_BudgetAllocationManager.ModifyBG_BudgetAllocation(bg);
                //    DtDataBind();
                //}

                #region 8-8   修改后总分配额不能少于已经审核通过的金额
                //if (Mon - ParToDecimal.ParToDel(rc.OldValue<float>().ToString()) + ParToDecimal.ParToDel(rc.Value<float>().ToString()) - UseMon < 0)
                //{
                //    X.Msg.Alert("提示", "修改后总分配额不能少于已经审核通过的金额").Show();
                //    rc.SetValue(rc.OldValue<float>());
                //}
                //else
                //{
                //    foreach (RowChanges change in e.Changes)
                //    {
                //        if (change.Field == "BAAMon" && change.IsDirty<float>())
                //        {
                //            bg.BAAMon = ParToDecimal.ParToDel(change.Value<float>().ToString());
                //            baamon = ParToDecimal.ParToDel(HidBAA.Text.ToString()) + ParToDecimal.ParToDel(change.OldValue<float>().ToString()) - bg.BAAMon;

                //        }
                //        else if (change.Field == "SuppMon" && change.IsDirty<float>())
                //        {
                //            bg.SuppMon = ParToDecimal.ParToDel(change.Value<float>().ToString());
                //            suppmon = ParToDecimal.ParToDel(HidSupp.Text.ToString()) + ParToDecimal.ParToDel(change.OldValue<float>().ToString()) - bg.SuppMon;

                //        }
                //    }
                //    if (baamon < 0 || suppmon < 0)
                //    {
                //        if (baamon > 0)
                //        {
                //            X.Msg.Alert("提示", "超过追加余额,请核实后修改数据!").Show();
                //            rc.SetValue(rc.OldValue<float>());
                //        }
                //        else if (suppmon > 0)
                //        {
                //            X.Msg.Alert("提示", "超过总余额,请核实后修改数据!").Show();
                //            rc.SetValue(rc.OldValue<float>());
                //        }
                //        else
                //        {
                //            X.Msg.Alert("提示", "追加余额或总余额不足,请核实后修改数据!").Show();
                //            rc.SetValue(rc.OldValue<float>());
                //        }

                //    }
                //    else
                //    {
                //        BG_BudgetAllocationManager.ModifyBG_BudgetAllocation(bg);
                //        DtDataBind();
                //    }
                //}
                #endregion
            }
        }
        HidBind();
        TPPayIncome.Listeners.AddScript("GetTotal();");
    }
Beispiel #14
0
    private List <object> GetListStr()
    {
        txtshow.Text = "";
        int           depid    = common.IntSafeConvert(cmbDep.SelectedItem.Value);
        List <object> strlist  = new List <object>();
        int           piidflag = 0;
        string        depname  = "";
        string        name     = "";
        decimal       mon      = 0;
        decimal       supp     = 0;

        if (depid == 0 && DropDownFieldDv.Text.ToString() == "全部")
        {
            DataTable dt = BG_BudgetAllocationLogic.GetALLAAMon(common.IntSafeConvert(CurrentYear));
            //for (int i = 0; i < dt.Rows.Count; i++)
            //{
            //    depname = BG_DepartmentManager.GetBG_DepartmentByDepID(common.IntSafeConvert(dt.Rows[i]["depid"])).DepName;
            //    name = BG_PayIncomeManager.GetBG_PayIncomeByPIID(common.IntSafeConvert(dt.Rows[i]["PIID"])).PIEcoSubName;
            //    strlist.Add(new { depname = depname, name = name, mon = mon });
            //}
            if (dt.Rows.Count <= 0)
            {
                strlist.Clear();
                string message = "没有查询到数据";
                txtshow.Text = message;
            }
            else
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    piidflag = common.IntSafeConvert(dt.Rows[i]["PIID"]);
                    depname  = BG_DepartmentManager.GetBG_DepartmentByDepID(common.IntSafeConvert(dt.Rows[i]["DepID"])).DepName;
                    name     = BG_PayIncomeManager.GetBG_PayIncomeByPIID(common.IntSafeConvert(dt.Rows[i]["PIID"])).PIEcoSubName;
                    mon      = ParToDecimal.ParToDel(dt.Rows[i]["BAAMon"].ToString());
                    supp     = ParToDecimal.ParToDel(dt.Rows[i]["SuppMon"].ToString());
                    strlist.Add(new { piidflag = piidflag, depname = depname, name = name, mon = mon, supp = supp });
                }
            }
        }
        else if (depid == 0 && DropDownFieldDv.Text.ToString() != "全部")
        {
            name = DropDownFieldDv.Text.ToString();
            DataTable dt   = BGDepartmentManager.GetDepByfadepid(AreaDepID);
            string    bgpi = BG_BudItemsLogic.GetBG_PayIncomeByname(name);
            if (name == "工资福利支出" || name == "商品和服务支出" || name == "对个人和家庭补助支出" || name == "其他资本性支出")
            {
                DataTable dta = BG_BudgetAllocationLogic.GetALLAAMon(common.IntSafeConvert(CurrentYear));
                //for (int i = 0; i < dta.Rows.Count; i++)
                //{
                //    depname = BG_DepartmentManager.GetBG_DepartmentByDepID(common.IntSafeConvert(dta.Rows[i]["depid"])).DepName;
                //    name = BG_PayIncomeManager.GetBG_PayIncomeByPIID(common.IntSafeConvert(dta.Rows[i]["PIID"])).PIEcoSubName;
                //    strlist.Add(new { depname = depname, name = name, mon = mon });
                //}
                if (dta.Rows.Count <= 0)
                {
                    strlist.Clear();
                    string message = "没有查询到数据";
                    txtshow.Text = message;
                }
                else
                {
                    for (int i = 0; i < dta.Rows.Count; i++)
                    {
                        piidflag = common.IntSafeConvert(dta.Rows[i]["PIID"]);
                        depname  = BG_DepartmentManager.GetBG_DepartmentByDepID(common.IntSafeConvert(dta.Rows[i]["DepID"])).DepName;
                        name     = BG_PayIncomeManager.GetBG_PayIncomeByPIID(common.IntSafeConvert(dta.Rows[i]["PIID"])).PIEcoSubName;
                        mon      = ParToDecimal.ParToDel(dta.Rows[i]["BAAMon"].ToString());
                        supp     = ParToDecimal.ParToDel(dta.Rows[i]["SuppMon"].ToString());
                        strlist.Add(new { piidflag = piidflag, depname = depname, name = name, mon = mon, supp = supp });
                    }
                }
            }

            string[]  slist = bgpi.Split(',');
            DataTable dt1   = new DataTable();
            for (int i = 0; i < slist.Count(); i++)
            {
                int piid = common.IntSafeConvert(slist[i]);
                dt1 = BG_BudgetAllocationLogic.GetAAMonDTbyPIID(common.IntSafeConvert(CurrentYear), piid);
                if (dt1.Rows.Count > 0)
                {
                    for (int j = 0; j < dt1.Rows.Count; j++)
                    {
                        depname = BG_DepartmentManager.GetBG_DepartmentByDepID(common.IntSafeConvert(dt1.Rows[j]["DepID"])).DepName;
                        mon    += ParToDecimal.ParToDel(dt1.Rows[j]["BAAMon"].ToString());
                        supp   += ParToDecimal.ParToDel(dt1.Rows[j]["SuppMon"].ToString());
                        strlist.Add(new { piidflag = piid, depname = depname, name = name, mon = mon, supp = supp });
                    }
                }
            }
            if (strlist.Count <= 0)
            {
                strlist.Clear();
                string message = "没有查询到数据";
                txtshow.Text = message;
            }
        }
        else if (depid != 0 && DropDownFieldDv.Text.ToString() == "全部")
        {
            depname = cmbDep.SelectedItem.Text;
            DataTable dt = BG_BudgetAllocationLogic.GetAAMonDTbyDepID(common.IntSafeConvert(CurrentYear), common.IntSafeConvert(cmbDep.SelectedItem.Value));
            if (dt.Rows.Count <= 0)
            {
                strlist.Clear();
                string message = "没有查询到数据";
                txtshow.Text = message;
            }
            else
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    piidflag = common.IntSafeConvert(dt.Rows[i]["PIID"]);
                    name     = BG_PayIncomeManager.GetBG_PayIncomeByPIID(piidflag).PIEcoSubName;
                    mon      = ParToDecimal.ParToDel(dt.Rows[i]["BAAMon"].ToString());
                    supp     = ParToDecimal.ParToDel(dt.Rows[i]["SuppMon"].ToString());
                    strlist.Add(new { piidflag = piidflag, depname = depname, name = name, mon = mon, supp = supp });
                }
            }
        }
        else
        {
            name = DropDownFieldDv.Text.ToString();
            if (name == "工资福利支出" || name == "商品和服务支出" || name == "对个人和家庭补助支出" || name == "其他资本性支出")
            {
                depname = cmbDep.SelectedItem.Text;
                DataTable dta = BG_BudgetAllocationLogic.GetAAMonDTbyDepID(common.IntSafeConvert(CurrentYear), common.IntSafeConvert(cmbDep.SelectedItem.Value));
                if (dta.Rows.Count <= 0)
                {
                    strlist.Clear();
                    string message = "没有查询到数据";
                    txtshow.Text = message;
                }
                else
                {
                    for (int i = 0; i < dta.Rows.Count; i++)
                    {
                        piidflag = common.IntSafeConvert(dta.Rows[i]["PIID"]);
                        name     = BG_PayIncomeManager.GetBG_PayIncomeByPIID(piidflag).PIEcoSubName;
                        mon      = ParToDecimal.ParToDel(dta.Rows[i]["BAAMon"].ToString());
                        supp     = ParToDecimal.ParToDel(dta.Rows[i]["SuppMon"].ToString());
                        strlist.Add(new { piidflag = piidflag, depname = depname, name = name, mon = mon, supp = supp });
                    }
                }
            }
            string    bgpi  = BG_BudItemsLogic.GetBG_PayIncomeByname(name);
            string[]  slist = bgpi.Split(',');
            DataTable dt    = new DataTable();
            for (int i = 0; i < slist.Count(); i++)
            {
                int piid = common.IntSafeConvert(slist[i]);
                dt = BG_BudgetAllocationLogic.GetAAMon(depid, piid, common.IntSafeConvert(CurrentYear));
                if (dt.Rows.Count > 0)
                {
                    mon  += ParToDecimal.ParToDel(dt.Rows[0]["BAAMon"].ToString());
                    supp += ParToDecimal.ParToDel(dt.Rows[0]["SuppMon"].ToString());
                }
                mon  += 0;
                supp += 0;
            }

            if (dt.Rows.Count <= 0)
            {
                strlist.Clear();
                string message = "没有查询到数据";
                txtshow.Text = message;
            }
            else
            {
                depname = cmbDep.SelectedItem.Text;
                strlist.Add(new { piidflag = common.IntSafeConvert(slist[0]), depname = depname, name = name, mon = mon, supp = supp });
            }
        }
        string  str     = "";
        decimal summon  = 0;
        decimal sumsupp = 0;

        for (int i = 0; i < strlist.Count; i++)
        {
            str      = strlist[i].ToString();
            summon  += Getmon(str, "mon");
            sumsupp += Getmon(str, "supp");
        }
        strlist.Add(new { piidflag = 0, depname = "总计", name = "", mon = summon, supp = sumsupp });
        return(strlist);
    }