Exemple #1
0
        /// <summary>
        /// 取得新计算时工人工资及明细
        /// </summary>
        /// <param name="BeginDate"></param>
        /// <param name="EndDate"></param>
        /// <returns></returns>
        public DataSet GetTemPay(DateTime BeginDate, DateTime EndDate)
        {
            DataSet ds = dal.GetTemPay(BeginDate, EndDate);

            Hownet.Model.Pay modP = new Hownet.Model.Pay();
            ds.Tables[0].Columns.Add("OneDate", typeof(string));
            ds.Tables[0].Columns.Add("TwoDate", typeof(string));
            ds.Tables[0].Columns.Add("NowMoney", typeof(decimal));
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                ds.Tables[0].Rows[i]["OneDate"] = BeginDate.ToString("yyyy年MM月dd日");
                ds.Tables[0].Rows[i]["TwoDate"] = EndDate.ToString("yyyy年MM月dd日");
                if (ds.Tables[0].Rows[i]["Month"].ToString() != "")
                {
                    modP.Month = decimal.Parse(ds.Tables[0].Rows[i]["Month"].ToString());
                }
                else
                {
                    modP.Month = 0;
                }
                if (ds.Tables[0].Rows[i]["Payment"].ToString() != "")
                {
                    modP.Payment = decimal.Parse(ds.Tables[0].Rows[i]["Payment"].ToString());
                }
                else
                {
                    modP.Payment = 0;
                }
                if (ds.Tables[0].Rows[i]["BoardWages"].ToString() != "")
                {
                    modP.BoardWages = decimal.Parse(ds.Tables[0].Rows[i]["BoardWages"].ToString());
                }
                else
                {
                    modP.BoardWages = 0;
                }
                if (ds.Tables[0].Rows[i]["Repair"].ToString() != "")
                {
                    modP.Repair = decimal.Parse(ds.Tables[0].Rows[i]["Repair"].ToString());
                }
                else
                {
                    modP.Repair = 0;
                }
                ds.Tables[0].Rows[i]["NowMoney"] = modP.Month + modP.Repair - modP.BoardWages - modP.Payment;
            }
            return(ds);
        }
Exemple #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Hownet.Model.Pay model)
 {
     dal.Update(model);
 }
Exemple #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Hownet.Model.Pay model)
 {
     return(dal.Add(model));
 }
Exemple #4
0
        /// <summary>
        /// 取得工人工资及明细
        /// </summary>
        /// <param name="MainID"></param>
        /// <returns></returns>
        public DataSet GetEmpPay(int MainID)
        {
            DataSet ds = dal.GetEmpPay(MainID);

            Hownet.Model.Pay modP = new Hownet.Model.Pay();
            ds.Tables[0].Columns.Add("OneDate", typeof(string));
            ds.Tables[0].Columns.Add("TwoDate", typeof(string));
            ds.Tables[0].Columns.Add("NowMoney", typeof(decimal));
            //ds.Tables[0].Columns.Add("FullAttendance", typeof(decimal));
            //ds.Tables[0].Columns.Add("Fine", typeof(decimal));
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                ds.Tables[0].Rows[i]["OneDate"] = ((DateTime)(ds.Tables[0].Rows[i]["BegingDate"])).ToString("yyyy年MM月dd日");
                ds.Tables[0].Rows[i]["TwoDate"] = ((DateTime)(ds.Tables[0].Rows[i]["EndDate"])).ToString("yyyy年MM月dd日");
                if (ds.Tables[0].Rows[i]["Month"].ToString() != "")
                {
                    modP.Month = decimal.Parse(ds.Tables[0].Rows[i]["Month"].ToString());
                }
                else
                {
                    modP.Month = 0;
                }
                if (ds.Tables[0].Rows[i]["Repair"].ToString() != "")
                {
                    modP.Repair = decimal.Parse(ds.Tables[0].Rows[i]["Repair"].ToString());
                }
                else
                {
                    modP.Repair = 0;
                }
                if (ds.Tables[0].Rows[i]["Payment"].ToString() != "")
                {
                    modP.Payment = decimal.Parse(ds.Tables[0].Rows[i]["Payment"].ToString());
                }
                else
                {
                    modP.Payment = 0;
                }
                if (ds.Tables[0].Rows[i]["BoardWages"].ToString() != "")
                {
                    modP.BoardWages = decimal.Parse(ds.Tables[0].Rows[i]["BoardWages"].ToString());
                }
                else
                {
                    modP.BoardWages = 0;
                }
                if (ds.Tables[0].Rows[i]["FullAttendance"].ToString() != "")
                {
                    modP.FullAttendance = decimal.Parse(ds.Tables[0].Rows[i]["FullAttendance"].ToString());
                }
                else
                {
                    modP.FullAttendance = 0;
                }
                if (ds.Tables[0].Rows[i]["Fine"].ToString() != "")
                {
                    modP.Fine = decimal.Parse(ds.Tables[0].Rows[i]["Fine"].ToString());
                }
                else
                {
                    modP.Fine = 0;
                }
                if (ds.Tables[0].Rows[i]["Deposit"].ToString() != "")
                {
                    modP.Deposit = decimal.Parse(ds.Tables[0].Rows[i]["Deposit"].ToString());
                }
                else
                {
                    modP.Deposit = 0;
                }
                ds.Tables[0].Rows[i]["NowMoney"] = modP.Month + modP.Repair - modP.BoardWages - modP.Payment + modP.FullAttendance - modP.Fine - modP.Deposit;
            }
            return(ds);
        }
Exemple #5
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Hownet.Model.Pay> DataTableToList(DataTable dt)
        {
            List <Hownet.Model.Pay> modelList = new List <Hownet.Model.Pay>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Hownet.Model.Pay model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.Pay();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["Remain"] != null && dt.Rows[n]["Remain"].ToString() != "")
                    {
                        model.Remain = decimal.Parse(dt.Rows[n]["Remain"].ToString());
                    }
                    if (dt.Rows[n]["EmployeeID"] != null && dt.Rows[n]["EmployeeID"].ToString() != "")
                    {
                        model.EmployeeID = int.Parse(dt.Rows[n]["EmployeeID"].ToString());
                    }
                    if (dt.Rows[n]["Month"] != null && dt.Rows[n]["Month"].ToString() != "")
                    {
                        model.Month = decimal.Parse(dt.Rows[n]["Month"].ToString());
                    }
                    if (dt.Rows[n]["Payment"] != null && dt.Rows[n]["Payment"].ToString() != "")
                    {
                        model.Payment = decimal.Parse(dt.Rows[n]["Payment"].ToString());
                    }
                    if (dt.Rows[n]["BoardWages"] != null && dt.Rows[n]["BoardWages"].ToString() != "")
                    {
                        model.BoardWages = decimal.Parse(dt.Rows[n]["BoardWages"].ToString());
                    }
                    if (dt.Rows[n]["Repair"] != null && dt.Rows[n]["Repair"].ToString() != "")
                    {
                        model.Repair = decimal.Parse(dt.Rows[n]["Repair"].ToString());
                    }
                    if (dt.Rows[n]["LastRemain"] != null && dt.Rows[n]["LastRemain"].ToString() != "")
                    {
                        model.LastRemain = decimal.Parse(dt.Rows[n]["LastRemain"].ToString());
                    }
                    if (dt.Rows[n]["MainID"] != null && dt.Rows[n]["MainID"].ToString() != "")
                    {
                        model.MainID = int.Parse(dt.Rows[n]["MainID"].ToString());
                    }
                    if (dt.Rows[n]["Fact"] != null && dt.Rows[n]["Fact"].ToString() != "")
                    {
                        model.Fact = decimal.Parse(dt.Rows[n]["Fact"].ToString());
                    }
                    if (dt.Rows[n]["IsEnd"] != null && dt.Rows[n]["IsEnd"].ToString() != "")
                    {
                        if ((dt.Rows[n]["IsEnd"].ToString() == "1") || (dt.Rows[n]["IsEnd"].ToString().ToLower() == "true"))
                        {
                            model.IsEnd = true;
                        }
                        else
                        {
                            model.IsEnd = false;
                        }
                    }
                    if (dt.Rows[n]["FullAttendance"] != null && dt.Rows[n]["FullAttendance"].ToString() != "")
                    {
                        model.FullAttendance = decimal.Parse(dt.Rows[n]["FullAttendance"].ToString());
                    }
                    if (dt.Rows[n]["Fine"] != null && dt.Rows[n]["Fine"].ToString() != "")
                    {
                        model.Fine = decimal.Parse(dt.Rows[n]["Fine"].ToString());
                    }
                    if (dt.Rows[n]["Deposit"] != null && dt.Rows[n]["Deposit"].ToString() != "")
                    {
                        model.Deposit = decimal.Parse(dt.Rows[n]["Deposit"].ToString());
                    }
                    if (dt.Rows[n]["Add1"] != null && dt.Rows[n]["Add1"].ToString() != "")
                    {
                        model.Add1 = decimal.Parse(dt.Rows[n]["Add1"].ToString());
                    }
                    if (dt.Rows[n]["Add2"] != null && dt.Rows[n]["Add2"].ToString() != "")
                    {
                        model.Add2 = decimal.Parse(dt.Rows[n]["Add2"].ToString());
                    }
                    if (dt.Rows[n]["Add3"] != null && dt.Rows[n]["Add3"].ToString() != "")
                    {
                        model.Add3 = decimal.Parse(dt.Rows[n]["Add3"].ToString());
                    }
                    if (dt.Rows[n]["Add4"] != null && dt.Rows[n]["Add4"].ToString() != "")
                    {
                        model.Add4 = decimal.Parse(dt.Rows[n]["Add4"].ToString());
                    }
                    if (dt.Rows[n]["Add5"] != null && dt.Rows[n]["Add5"].ToString() != "")
                    {
                        model.Add5 = decimal.Parse(dt.Rows[n]["Add5"].ToString());
                    }
                    if (dt.Rows[n]["Jian1"] != null && dt.Rows[n]["Jian1"].ToString() != "")
                    {
                        model.Jian1 = decimal.Parse(dt.Rows[n]["Jian1"].ToString());
                    }
                    if (dt.Rows[n]["Jian2"] != null && dt.Rows[n]["Jian2"].ToString() != "")
                    {
                        model.Jian2 = decimal.Parse(dt.Rows[n]["Jian2"].ToString());
                    }
                    if (dt.Rows[n]["Jian3"] != null && dt.Rows[n]["Jian3"].ToString() != "")
                    {
                        model.Jian3 = decimal.Parse(dt.Rows[n]["Jian3"].ToString());
                    }
                    if (dt.Rows[n]["Jian4"] != null && dt.Rows[n]["Jian4"].ToString() != "")
                    {
                        model.Jian4 = decimal.Parse(dt.Rows[n]["Jian4"].ToString());
                    }
                    if (dt.Rows[n]["Jian5"] != null && dt.Rows[n]["Jian5"].ToString() != "")
                    {
                        model.Jian5 = decimal.Parse(dt.Rows[n]["Jian5"].ToString());
                    }
                    if (dt.Rows[n]["ActualMonth"] != null && dt.Rows[n]["ActualMonth"].ToString() != "")
                    {
                        model.ActualMonth = decimal.Parse(dt.Rows[n]["ActualMonth"].ToString());
                    }
                    if (dt.Rows[n]["NotFact"] != null && dt.Rows[n]["NotFact"].ToString() != "")
                    {
                        if ((dt.Rows[n]["NotFact"].ToString() == "1") || (dt.Rows[n]["NotFact"].ToString().ToLower() == "true"))
                        {
                            model.NotFact = true;
                        }
                        else
                        {
                            model.NotFact = false;
                        }
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemple #6
0
        /// <summary>
        /// 将统计出的工资金额插入到工资总表
        /// </summary>
        /// <param name="MainID"></param>
        public void PayMoney(byte[] bb, int MainID)
        {
            DataTable dt = Hownet.BLL.BaseFile.ZipDt.Byte2Ds(bb).Tables[0];

            //dal.PayMoney(MainID);
            Hownet.BLL.Pay   bllP = new Pay();
            Hownet.Model.Pay modP;
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                modP            = new Hownet.Model.Pay();
                modP.MainID     = MainID;
                modP.EmployeeID = int.Parse(dt.Rows[i]["EmployeeID"].ToString());
                if (dt.Rows[i]["BoardWages"].ToString() != "")
                {
                    modP.BoardWages = decimal.Parse(dt.Rows[i]["BoardWages"].ToString());
                }
                //else
                //    modP.BoardWages = 0;
                if (dt.Rows[i]["Repair"].ToString() != "")
                {
                    modP.Repair = decimal.Parse(dt.Rows[i]["Repair"].ToString());
                }
                //else
                //    modP.Repair = DBNull.Value;
                if (dt.Rows[i]["Payment"].ToString() != "")
                {
                    modP.Payment = decimal.Parse(dt.Rows[i]["Payment"].ToString());
                }
                //else
                //    modP.Payment = DBNull.Value;
                if (dt.Rows[i]["Month"].ToString() != "")
                {
                    modP.Month = decimal.Parse(dt.Rows[i]["Month"].ToString());
                }
                //else
                //    modP.Month = 0;
                if (dt.Rows[i]["LastRemain"].ToString() != "")
                {
                    modP.LastRemain = decimal.Parse(dt.Rows[i]["LastRemain"].ToString());
                }
                //else
                //    modP.LastRemain = 0;
                object obj = dt.Rows[i]["Remain"];
                if (dt.Rows[i]["Remain"].ToString() != "")
                {
                    modP.Remain = decimal.Parse(dt.Rows[i]["Remain"].ToString());
                }
                if (dt.Rows[i]["Fact"].ToString() != "")
                {
                    modP.Fact = decimal.Parse(dt.Rows[i]["Fact"].ToString());
                }
                modP.IsEnd = false;
                int a = int.Parse(dt.Rows[i]["A"].ToString());
                if (a == 3)
                {
                    bllP.Add(modP);
                }
                else if (a == 2)
                {
                    modP.ID = int.Parse(dt.Rows[i]["ID"].ToString());
                    bllP.Update(modP);
                }
            }
        }
Exemple #7
0
        public DataSet GetTemPayByPW(DateTime BeginDate, DateTime EndDate, int EmployeeID)
        {
            try
            {
                Hownet.BLL.OtherType          bllOT = new OtherType();
                List <Hownet.Model.OtherType> list  = bllOT.DataTableToList(bllOT.GetTypeList("伙食扣费").Tables[0]);
                DataTable dtPaySet = bllOT.GetNumValue().Tables[0];

                decimal ZhaoCan, WuCan, WanCan, Month;
                ZhaoCan = WuCan = WanCan = Month = 0;
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i].Name == "早餐")
                    {
                        ZhaoCan = Convert.ToDecimal(list[i].Value);
                    }
                    else if (list[i].Name == "午餐")
                    {
                        WuCan = Convert.ToDecimal(list[i].Value);
                    }
                    else if (list[i].Name == "晚餐")
                    {
                        WanCan = Convert.ToDecimal(list[i].Value);
                    }
                }

                DataSet                 ds    = dal.GetTemPayByPW(BeginDate, EndDate, EmployeeID);
                Hownet.BLL.MiniEmp      bllME = new MiniEmp();
                DataTable               dtEMP = bllME.GetWorkList().Tables[0];
                Hownet.Model.Pay        modP  = new Hownet.Model.Pay();
                Hownet.BLL.PayCosts     bllPC = new PayCosts();
                Hownet.BLL.SysTem       bllST = new SysTem();
                Hownet.BLL.OrderingList bllOL = new OrderingList();
                Hownet.Model.SysTem     modST = bllST.GetModel(bllST.GetMaxId() - 1);
                DataTable               dtPC  = bllPC.GetListByDay(BeginDate, EndDate, EmployeeID).Tables[0];
                ds.Tables[0].Columns.Add("OneDate", typeof(string));
                ds.Tables[0].Columns.Add("TwoDate", typeof(string));
                ds.Tables[0].Columns.Add("NowMoney", typeof(decimal));
                ds.Tables[0].Columns.Add("FullAttendance", typeof(decimal));
                ds.Tables[0].Columns.Add("Fine", typeof(decimal));
                ds.Tables[0].Columns.Add("Deposit", typeof(decimal));
                ds.Tables[0].Columns.Add("Add1", typeof(decimal));
                ds.Tables[0].Columns.Add("Add2", typeof(decimal));
                ds.Tables[0].Columns.Add("Add3", typeof(decimal));
                ds.Tables[0].Columns.Add("Add4", typeof(decimal));
                ds.Tables[0].Columns.Add("Add5", typeof(decimal));
                ds.Tables[0].Columns.Add("Jian1", typeof(decimal));
                ds.Tables[0].Columns.Add("Jian2", typeof(decimal));
                ds.Tables[0].Columns.Add("Jian3", typeof(decimal));
                ds.Tables[0].Columns.Add("Jian4", typeof(decimal));
                ds.Tables[0].Columns.Add("Jian5", typeof(decimal));
                ds.Tables[0].Columns.Add("ActualMonth", typeof(decimal));
                ds.Tables[0].Columns.Add("NotFact", typeof(bool));
                ds.Tables["Info"].Columns.Add("Money", typeof(decimal));
                decimal price  = 0;
                decimal amount = 0;
                for (int i = 0; i < ds.Tables["Info"].Rows.Count; i++)
                {
                    price  = 0;
                    amount = 0;
                    if (ds.Tables["Info"].Rows[i]["Amount"].ToString() != "")
                    {
                        amount = decimal.Parse(ds.Tables["Info"].Rows[i]["Amount"].ToString());
                    }
                    if (ds.Tables["Info"].Rows[i]["Price"].ToString() != "")
                    {
                        price = decimal.Parse(ds.Tables["Info"].Rows[i]["Price"].ToString());
                    }
                    ds.Tables["Info"].Rows[i]["Money"] = (price * amount).ToString("N4");
                }
                ds.Tables["NoDefault"].Columns.Add("Money", typeof(decimal));

                if ((modST.DoubleNotDefaultWTNum > 0))
                {
                    for (int i = 0; i < ds.Tables["NoDefault"].Rows.Count; i++)
                    {
                        price  = 0;
                        amount = 0;
                        if (ds.Tables["NoDefault"].Rows[i]["Amount"].ToString() != "")
                        {
                            amount = decimal.Parse(ds.Tables["NoDefault"].Rows[i]["Amount"].ToString());
                        }
                        if (ds.Tables["NoDefault"].Rows[i]["Price"].ToString() != "")
                        {
                            price = decimal.Parse(ds.Tables["NoDefault"].Rows[i]["Price"].ToString());
                        }
                        ds.Tables["NoDefault"].Rows[i]["Money"] = (price * amount).ToString("N4");
                    }
                }
                else
                {
                    ds.Tables["NoDefault"].Rows.Clear();
                }
                int     AllowedCount = 0;
                decimal ErrorMoney   = 0;
                if (modST.AutoCaicBoardWages)
                {
                    // bllOL.CaicMoney(EndDate.AddDays(1));
                    AllowedCount = Convert.ToInt32(bllOT.GetList("(Name='允许违规次数')").Tables[0].Rows[0]["Value"]);
                    ErrorMoney   = Convert.ToDecimal(bllOT.GetList("(Name='订餐后未吃')").Tables[0].Rows[0]["Value"]);
                }
                DataRow[] drs;
                DataRow[] ddrs;
                DataRow[] drMEs;
                try
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        ds.Tables[0].Rows[i]["OneDate"] = BeginDate.ToString("yyyy年MM月dd日");
                        ds.Tables[0].Rows[i]["TwoDate"] = EndDate.ToString("yyyy年MM月dd日");
                        if (ds.Tables[0].Rows[i]["Month"].ToString() != "")
                        {
                            modP.Month = decimal.Parse(ds.Tables[0].Rows[i]["Month"].ToString());
                        }
                        else
                        {
                            modP.Month = 0;
                        }
                        drs   = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=62) ");
                        drMEs = dtEMP.Select("(ID=" + ds.Tables[0].Rows[i]["EmployeeID"] + ")");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Payment"] = drs[0]["Money"];
                            modP.Payment = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Payment = 0;
                        }
                        if (modST.AutoCaicBoardWages)
                        {
                            modP.BoardWages = bllOL.GetMoney(Convert.ToInt32(ds.Tables[0].Rows[i]["EmployeeID"]), BeginDate, EndDate.AddDays(1), AllowedCount, ErrorMoney, ZhaoCan, WuCan, WanCan);
                            ds.Tables[0].Rows[i]["BoardWages"] = modP.BoardWages;
                        }
                        else
                        {
                            if (drMEs.Length > 0)
                            {
                                modP.BoardWages = Convert.ToDecimal(drMEs[0]["BoardWages"]);// bllME.GetModel(Convert.ToInt32(ds.Tables[0].Rows[i]["EmployeeID"])).BoardWages;
                                ds.Tables[0].Rows[i]["BoardWages"] = modP.BoardWages;
                            }
                            if (modP.BoardWages == 0)
                            {
                                drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=61)");
                                if (drs.Length > 0)
                                {
                                    ds.Tables[0].Rows[i]["BoardWages"] = drs[0]["Money"];
                                    modP.BoardWages = decimal.Parse(drs[0]["Money"].ToString());
                                }
                                else
                                {
                                    modP.BoardWages = 0;
                                }
                            }
                        }
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=60)");//计算补贴
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Repair"] = drs[0]["Money"];
                            modP.Repair = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Repair = 0;
                        }
                        if (modST.DoubleNotDefaultWTNum > 0)
                        {
                            ddrs = ds.Tables["NoDefault"].Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"] + ")");//计算非默认工种的补贴
                            if (ddrs.Length > 0)
                            {
                                for (int m = 0; m < ddrs.Length; m++)
                                {
                                    modP.Repair += Convert.ToDecimal(ddrs[m]["Money"]) * modST.DoubleNotDefaultWTNum;
                                }
                                ds.Tables[0].Rows[i]["Repair"] = modP.Repair;
                            }
                        }
                        if (dtPaySet.Rows.Count > 0)//有工资提成设置
                        {
                            if (drMEs.Length > 0)
                            {
                                if (Convert.ToBoolean(drMEs[0]["IsCaicTiCheng"]))
                                {
                                    Month = Convert.ToDecimal(ds.Tables[0].Rows[i]["Month"]);
                                    if (Month > Convert.ToInt32(dtPaySet.Rows[0][0]))//超过最高提成,直接添加
                                    {
                                        modP.Repair += Month * Convert.ToDecimal(dtPaySet.Rows[0][1]);
                                        ds.Tables[0].Rows[i]["Repair"] = modP.Repair;
                                    }
                                    else if (Month > Convert.ToInt32(dtPaySet.Rows[dtPaySet.Rows.Count - 1][0]))//小于最高提成额度但又大于最低提成额度,然后从大向小比较,
                                    {
                                        for (int j = 0; j < dtPaySet.Rows.Count; j++)
                                        {
                                            if (Month > Convert.ToDecimal(dtPaySet.Rows[j][0]))
                                            {
                                                modP.Repair += Month * Convert.ToDecimal(dtPaySet.Rows[j][1]);
                                                ds.Tables[0].Rows[i]["Repair"] = modP.Repair;
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=91)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["FullAttendance"] = drs[0]["Money"];
                            modP.FullAttendance = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.FullAttendance = 0;
                        }

                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=92)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Fine"] = drs[0]["Money"];
                            modP.Fine = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Fine = 0;
                        }


                        //drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=92)");
                        //if (drs.Length > 0)
                        //{
                        //    ds.Tables[0].Rows[i]["Fine"] = drs[0]["Money"];
                        //    modP.Deposit = decimal.Parse(drs[0]["Money"].ToString());
                        //}
                        //else
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=109)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Deposit"] = drs[0]["Money"];
                            modP.Deposit = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Deposit = 0;
                        }
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=7)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Add1"] = drs[0]["Money"];
                            modP.Add1 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Add1 = 0;
                        }

                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=8)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Add2"] = drs[0]["Money"];
                            modP.Add2 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Add2 = 0;
                        }
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=9)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Add3"] = drs[0]["Money"];
                            modP.Add3 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Add3 = 0;
                        }
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=10)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Add4"] = drs[0]["Money"];
                            modP.Add4 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Add4 = 0;
                        }
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=11)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Add5"] = drs[0]["Money"];
                            modP.Add5 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Add5 = 0;
                        }

                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=12)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Jian1"] = drs[0]["Money"];
                            modP.Jian1 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Jian1 = 0;
                        }

                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=13)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Jian2"] = drs[0]["Money"];
                            modP.Jian2 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Jian2 = 0;
                        }
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=14)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Jian3"] = drs[0]["Money"];
                            modP.Jian3 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Jian3 = 0;
                        }
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=15)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Jian4"] = drs[0]["Money"];
                            modP.Jian4 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Jian4 = 0;
                        }
                        drs = dtPC.Select("(EmployeeID=" + ds.Tables[0].Rows[i]["EmployeeID"].ToString() + ") and (TypeID=16)");
                        if (drs.Length > 0)
                        {
                            ds.Tables[0].Rows[i]["Jian5"] = drs[0]["Money"];
                            modP.Jian5 = decimal.Parse(drs[0]["Money"].ToString());
                        }
                        else
                        {
                            modP.Jian5 = 0;
                        }
                        ds.Tables[0].Rows[i]["ActualMonth"] = ds.Tables[0].Rows[i]["Month"];
                        ds.Tables[0].Rows[i]["NotFact"]     = false;
                        // ds.Tables[0].Rows[i]["NowMoney"] = modP.Month + modP.Repair - modP.BoardWages - modP.Payment + modP.FullAttendance - modP.Fine - modP.Deposit;
                    }
                }
                catch (Exception ex)
                {
                }

                return(ds);
            }
            catch (Exception ex)
            {
                return(new DataSet());
            }
        }