Beispiel #1
0
        /// <summary>
        /// 计算只需订餐的伙食费
        /// </summary>
        /// <param name="date"></param>
        public void CaicMoneyNoEat(DateTime date)
        {
            DataTable dt = dal.GetIDList(date).Tables[0];

            if (dt.Rows.Count > 0)
            {
                Hownet.BLL.OtherType          bllOT = new OtherType();
                List <Hownet.Model.OtherType> list = bllOT.DataTableToList(bllOT.GetTypeList("伙食扣费").Tables[0]);
                decimal ZhaoCan, WuCan, WanCan, NotEat, NotOrder;
                bool    IsCaic = false;
                bool    IsCaicDay = false;
                bool    IsDay = false;
                ZhaoCan = WuCan = WanCan = NotEat = NotOrder = 0;
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i].Name == "早餐")
                    {
                        ZhaoCan = Convert.ToDecimal(list[i].Value);
                    }
                    if (list[i].Name == "午餐")
                    {
                        WuCan = Convert.ToDecimal(list[i].Value);
                    }
                    else if (list[i].Name == "晚餐")
                    {
                        WanCan = Convert.ToDecimal(list[i].Value);
                    }
                    //else if (list[i].Name == "订餐后未吃")
                    //    NotEat = Convert.ToDecimal(list[i].Value);
                    //else if (list[i].Name == "未订餐吃饭")
                    //    NotOrder = Convert.ToDecimal(list[i].Value);
                    //else if (list[i].Name == "以下要扣费")
                    //    IsCaic = (list[i].Value == "1");
                    else if (list[i].Name == "计时不扣正常餐费")
                    {
                        IsCaicDay = (list[i].Value == "1");
                    }
                }
                dal.CaicMoneyNotEat(ZhaoCan, WuCan, WanCan, IsDay, date);
            }
        }
Beispiel #2
0
        public void CaicMoney(DateTime date)
        {
            DataTable dt = dal.GetIDList(date).Tables[0];

            if (dt.Rows.Count > 0)
            {
                Hownet.BLL.OtherType          bllOT = new OtherType();
                List <Hownet.Model.OtherType> list = bllOT.DataTableToList(bllOT.GetTypeList("伙食扣费").Tables[0]);
                decimal ZhaoCan, WuCan, WanCan, NotEat, NotOrder;
                bool    IsCaic = false;
                bool    IsCaicDay = false;
                bool    IsDay = false;
                ZhaoCan = WuCan = WanCan = NotEat = NotOrder = 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);
                    }
                    else if (list[i].Name == "订餐后未吃")
                    {
                        NotEat = Convert.ToDecimal(list[i].Value);
                    }
                    else if (list[i].Name == "未订餐吃饭")
                    {
                        NotOrder = Convert.ToDecimal(list[i].Value);
                    }
                    else if (list[i].Name == "以下要扣费")
                    {
                        IsCaic = (list[i].Value == "1");
                    }
                    else if (list[i].Name == "计时不扣正常餐费")
                    {
                        IsCaicDay = (list[i].Value == "1");
                    }
                }

                if (NotEat > 0 || NotOrder > 0)
                {
                    Hownet.BLL.MiniEmp bllME = new MiniEmp();
                    DataTable          dtt   = bllME.GetDayList().Tables[0];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        IsDay = false;
                        if (IsCaicDay)//当有设置了计时不扣正常餐费,并且当前员工为计时工时,IsDay为真
                        {
                            if (dtt.Select("(ID=" + dt.Rows[i]["EmployeeID"] + ")").Length > 0)
                            {
                                IsDay = true;
                            }
                        }
                        UpMoney(Convert.ToInt32(dt.Rows[i]["ID"]), ZhaoCan, WuCan, WanCan, NotEat, NotOrder, IsCaic, IsDay);
                    }
                }
                else
                {
                    dal.CaicMoneyNotEat(ZhaoCan, WuCan, WanCan, IsCaicDay, date);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// 审核/弃审入库单
        /// </summary>
        /// <param name="ID">入库单ID</param>
        /// <param name="t">真为审核出库,假为弃审入库</param>
        public void Verify(int ID, bool t, int Depot)
        {
            Hownet.BLL.ProduceSellInfo bllPSI = new ProduceSellInfo();
            Hownet.BLL.Repertory       bllRep = new Repertory();
            Hownet.BLL.MaterielList    bllML  = new MaterielList();
            Hownet.BLL.RepertoryList   bllRL  = new RepertoryList();
            Hownet.Model.RepertoryList modRL  = new Model.RepertoryList();
            //Hownet.BLL.Measure bllMea = new Measure();
            Hownet.Model.Repertory              modRep = new Hownet.Model.Repertory();
            Hownet.Model.MaterielList           modML  = new Hownet.Model.MaterielList();
            List <Hownet.Model.ProduceSellInfo> li     = bllPSI.DataTableToList(bllPSI.GetList("(MainID=" + ID + ")").Tables[0]);

            Hownet.BLL.AmountInfo   bllAI = new AmountInfo();
            Hownet.Model.AmountInfo modAI;
            Hownet.BLL.OtherType    bllOT = new OtherType();
            DataTable dtOT      = bllOT.GetList("(Name='仓储单位')").Tables[0];
            int       measureid = 0;

            if (dtOT.Rows.Count > 0)
            {
                measureid = Convert.ToInt32(dtOT.Rows[0]["Value"]);
            }
            //DataTable dt = bllMea.GetList("(Name='件')").Tables[0];
            //if (dt.Rows.Count > 0)
            //    modRep.MeasureID = int.Parse(dt.Rows[0]["ID"].ToString());
            //else
            //    modRep.MeasureID = 0;
            for (int i = 0; i < li.Count; i++)
            {
                try
                {
                    modAI             = bllAI.GetModel(li[i].SalesInfoID);
                    modRep.BrandID    = modML.BrandID = li[i].BrandID;
                    modRep.ColorID    = modML.ColorID = li[i].ColorID;
                    modRep.ColorOneID = modML.ColorOneID = li[i].ColorOneID;
                    modRep.ColorTwoID = modML.ColorTwoID = li[i].ColorTwoID;
                    modRep.SizeID     = modML.SizeID = li[i].SizeID;
                    if (measureid > 0)
                    {
                        modRep.MeasureID = modML.MeasureID = measureid;
                    }
                    else
                    {
                        modRep.MeasureID = modML.MeasureID = li[i].MeasureID;
                    }
                    modRep.MaterielID   = modML.MaterielID = li[i].MaterielID;
                    modRep.Amount       = li[i].Amount;
                    modRep.DepartmentID = Depot;

                    if (li[i].MListID == 0)
                    {
                        modRep.MListID = li[i].MListID = bllML.GetID(modML);
                        bllPSI.Update(li[i]);
                    }
                    else
                    {
                        modRep.MListID = li[i].MListID;
                    }

                    if (li[i].RepertoryID == 0)
                    {
                        if (Depot > 0)
                        {
                            bllRep.InOrOut(modRep, !t);
                        }
                    }
                    if (li[i].RepertoryID > 0)
                    {
                        modRep = bllRep.GetModel(li[i].RepertoryID);
                        if (t)
                        {
                            modRep.Amount -= li[i].Amount;
                        }
                        else
                        {
                            modRep.Amount += li[i].Amount;
                        }
                        bllRep.Update(modRep);
                    }

                    if (li[i].RepertoryListID > 0)
                    {
                        modRL = bllRL.GetModel(li[i].RepertoryListID);
                        if (t)
                        {
                            modRL.Amount -= li[i].Amount;
                        }
                        else
                        {
                            modRL.Amount += li[i].Amount;
                        }
                        bllRL.Update(modRL);
                    }
                    if (modAI != null)
                    {
                        modAI.NotAmount = Convert.ToInt32(li[i].Amount);
                        bllAI.UpNotAmount(modAI, t);
                    }
                }

                catch (Exception ex)
                {
                }
            }
        }
Beispiel #4
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());
            }
        }
        /// <summary>
        /// 审核/弃审入库单
        /// </summary>
        /// <param name="ID">入库单ID</param>
        /// <param name="t">真为审核入库,假为弃审出库</param>
        public void Verify(int ID, bool t, int VerifyMan, int DepotID, int TypeID)
        {
            if (TypeID == (int)Enums.TableType.P2D)
            {
                try
                {
                    Hownet.BLL.Product2DepotInfo bllP2DI = new Product2DepotInfo();
                    Hownet.BLL.AmountInfo        bllAI   = new AmountInfo();
                    Hownet.BLL.Repertory         bllRep  = new Repertory();
                    Hownet.BLL.MaterielList      bllML   = new MaterielList();
                    Hownet.BLL.Materiel          bllMat  = new Materiel();
                    Hownet.Model.AmountInfo      modAI   = new Hownet.Model.AmountInfo();
                    Hownet.Model.Repertory       modRep  = new Model.Repertory();
                    Hownet.Model.MaterielList    modML   = new Hownet.Model.MaterielList();
                    Hownet.BLL.RepertoryList     bllRL   = new RepertoryList();
                    Hownet.Model.RepertoryList   modRL   = new Model.RepertoryList();
                    DataTable dtRL = new DataTable();
                    Hownet.Model.Product2Depot modP2D = GetModel(ID);
                    DataTable dtP2DI = bllP2DI.GetList("(MainID=" + ID + ")").Tables[0];
                    List <Hownet.Model.Product2DepotInfo> li = bllP2DI.DataTableToList(bllP2DI.GetList("(MainID=" + ID + ")").Tables[0]);
                    modAI.TableTypeID = 1;
                    Hownet.BLL.OtherType bllOT = new Hownet.BLL.OtherType();
                    DataTable            dtOT  = bllOT.GetTypeList("成品单位").Tables[0];
                    decimal one = 1;
                    decimal two = 1;
                    int     dM  = 0;

                    if (dtOT.Rows.Count > 0)
                    {
                        one = Convert.ToDecimal(dtOT.Select("(Name='车间换算')")[0]["Value"]);
                        two = Convert.ToDecimal(dtOT.Select("(Name='仓储换算')")[0]["Value"]);
                        dM  = Convert.ToInt32(dtOT.Select("(Name='仓储单位')")[0]["Value"]);
                    }


                    for (int i = 0; i < li.Count; i++)
                    {
                        modRep = new Model.Repertory();
                        modRep.DepartmentID = DepotID;
                        modRep.BrandName    = modRep.ColorName = modRep.ColorOneName = modRep.ColorTwoName = modRep.CompanyName = modRep.DeparmentName = modRep.DepotInfoName = modRep.MaterielName = modRep.MeasureName = modRep.Remark = modRep.SizeName = modRep.SpecName = modRep.SupplierName = modRep.SupplierSN = string.Empty;

                        modRep.BrandID    = modML.BrandID = li[i].BrandID;
                        modRep.ColorID    = modML.ColorID = li[i].ColorID;
                        modRep.ColorOneID = modML.ColorOneID = li[i].ColorOneID;
                        modRep.ColorTwoID = modML.ColorTwoID = li[i].ColorTwoID;
                        modRep.SizeID     = modML.SizeID = li[i].SizeID;
                        modRep.MaterielID = modML.MaterielID = li[i].MaterielID;
                        modRep.MeasureID  = modML.MeasureID = bllMat.GetModel(li[i].MaterielID).MeasureID;
                        modAI.MainID      = li[i].TaskID;
                        modRep.Amount     = modAI.NotAmount = li[i].Amount;
                        modRep.MListID    = modAI.MListID = li[i].MListID;
                        if (li[i].MListID == 0)
                        {
                            modAI.MListID = li[i].MListID = bllML.GetID(modML);
                            bllP2DI.Update(li[i]);
                            if (dM > 0)
                            {
                                modML.MeasureID = dM;
                            }
                            modRep.MListID = bllML.GetID(modML);
                        }
                        else
                        {
                            if (dM > 0)
                            {
                                modML.MeasureID = dM;
                            }
                            modRep.MListID = bllML.GetID(modML);
                        }
                        if (li[i].TaskID > 0)
                        {
                            if (t)
                            {
                                if (one > 1 || two > 1)
                                {
                                    modAI.Amount -= ((int)(li[i].Amount * two / one));
                                }
                                else
                                {
                                    modAI.Amount -= li[i].Amount;
                                }
                                if (modAI.Amount < 0)
                                {
                                    modAI.Amount = 0;
                                }
                            }
                            else
                            {
                                if (one > 1 || two > 1)
                                {
                                    modAI.Amount += ((int)(li[i].Amount * two / one));
                                }
                                else
                                {
                                    modAI.Amount += li[i].Amount;
                                }
                            }


                            bllAI.UpNotAmount(modAI, t);
                        }
                        if (dM > 0)
                        {
                            modRep.MeasureID = dM;
                        }
                        else
                        {
                            modRep.MeasureID = modML.MeasureID;
                        }
                        modRep.ID = bllRep.InOrOut(modRep, t);
                        if (li[i].DepotInfoID > 0)
                        {
                            dtRL = bllRL.GetList("(BatchNumber=" + li[i].MListID + ") And (DepotInfoID=" + li[i].DepotInfoID + ")").Tables[0];

                            if (dtRL.Rows.Count == 0)
                            {
                                if (t)
                                {
                                    modRL               = new Model.RepertoryList();
                                    modRL.A             = 1;
                                    modRL.NotAmount     = modRL.Amount = li[i].Amount;
                                    modRL.BatchNumber   = li[i].MListID;
                                    modRL.DateTime      = DateTime.Now;
                                    modRL.DepotInfoID   = li[i].DepotInfoID;
                                    modRL.DepotInfoName = string.Empty;
                                    modRL.ID            = 0;
                                    modRL.IsEnd         = false;
                                    modRL.MainID        = modRep.ID;
                                    modRL.PlanID        = 0;
                                    modRL.QRID          = li[i].MListID.ToString();
                                    modRL.Remark        = string.Empty;
                                    modRL.SpecID        = 0;
                                    modRL.SpecName      = string.Empty;
                                    modRL.StockListID   = 0;
                                    bllRL.Add(modRL);
                                }
                            }
                            else if (dtRL.Rows.Count == 1)
                            {
                                modRL = bllRL.GetModel(Convert.ToInt32(dtRL.Rows[0]["ID"]));
                                if (t)
                                {
                                    modRL.Amount += li[i].Amount;
                                }
                                else
                                {
                                    modRL.Amount -= li[i].Amount;
                                }
                                bllRL.Update(modRL);
                            }
                            else if (dtRL.Rows.Count > 1)
                            {
                                List <Hownet.Model.RepertoryList> liRL = bllRL.DataTableToList(dtRL);
                                for (int j = 1; j < liRL.Count; j++)
                                {
                                    liRL[0].Amount += liRL[j].Amount;
                                    bllRL.Delete(liRL[j].ID);
                                }
                                if (t)
                                {
                                    liRL[0].Amount += li[i].Amount;
                                }
                                else
                                {
                                    liRL[0].Amount -= li[i].Amount;
                                }
                                bllRL.Update(liRL[0]);
                            }
                        }
                    }
                    if (t)
                    {
                        modP2D.IsVerify   = 3;
                        modP2D.VerifyDate = DateTime.Today;
                        modP2D.VerifyMan  = VerifyMan;
                    }
                    else
                    {
                        modP2D.IsVerify   = 1;
                        modP2D.VerifyDate = DateTime.Parse("1900-1-1");
                        modP2D.VerifyMan  = 0;
                    }
                    Update(modP2D);
                }
                catch (Exception ex)
                {
                }
            }
            else if (TypeID == (int)Enums.TableType.P2Pack)
            {
                try
                {
                    Hownet.BLL.Product2DepotInfo bllP2DI = new Product2DepotInfo();
                    Hownet.BLL.AmountInfo        bllAI   = new AmountInfo();
                    Hownet.BLL.PackAmount        bllPA   = new PackAmount();
                    Hownet.BLL.MaterielList      bllML   = new MaterielList();
                    Hownet.BLL.Materiel          bllMat  = new Materiel();
                    Hownet.Model.AmountInfo      modAI   = new Hownet.Model.AmountInfo();
                    Hownet.Model.PackAmount      modPA   = new Hownet.Model.PackAmount();
                    Hownet.Model.MaterielList    modML   = new Hownet.Model.MaterielList();
                    Hownet.Model.Product2Depot   modP2D  = GetModel(ID);
                    Hownet.BLL.OtherType         bllOT   = new OtherType();
                    DataTable dtOT          = bllOT.GetTypeList("成品单位").Tables[0];
                    int       TaskMeasureID = 0;
                    DataRow[] drs           = dtOT.Select("(Name='车间单位')");
                    if (drs.Length == 1)
                    {
                        TaskMeasureID = Convert.ToInt32(drs[0]["Value"]);
                    }
                    List <Hownet.Model.Product2DepotInfo> li = bllP2DI.DataTableToList(bllP2DI.GetList("(MainID=" + ID + ")").Tables[0]);
                    modAI.TableTypeID  = 1;
                    modPA.DepartmentID = DepotID;
                    for (int i = 0; i < li.Count; i++)
                    {
                        if (li[i].MaterielID > 0)
                        {
                            modPA.BrandID    = modML.BrandID = li[i].BrandID;
                            modPA.ColorID    = modML.ColorID = li[i].ColorID;
                            modPA.ColorOneID = modML.ColorOneID = li[i].ColorOneID;
                            modPA.ColorTwoID = modML.ColorTwoID = li[i].ColorTwoID;
                            modPA.SizeID     = modML.SizeID = li[i].SizeID;
                            modPA.MaterielID = modML.MaterielID = li[i].MaterielID;
                            modML.MeasureID  = bllMat.GetModel(li[i].MaterielID).MeasureID;
                            if (TaskMeasureID > 0)
                            {
                                modPA.MeasureID = TaskMeasureID;
                            }
                            else
                            {
                                modPA.MeasureID = modML.MeasureID;
                            }
                            modAI.MainID = li[i].TaskID;
                            modPA.PlanID = li[i].TaskID;
                            modPA.Remark = string.Empty;
                            modPA.Amount = modAI.NotAmount = li[i].Amount;

                            if (li[i].ColorID > 0 && li[i].SizeID > 0)
                            {
                                if (li[i].MListID == 0)
                                {
                                    modAI.MListID = modPA.MListID = li[i].MListID = bllML.GetID(modML);
                                    bllP2DI.Update(li[i]);
                                }
                                else
                                {
                                    modAI.MListID = modPA.MListID = li[i].MListID;
                                }
                                bllAI.UpNotAmount(modAI, t);
                                bllPA.InOrOut(modPA, t);
                            }
                        }
                        else
                        {
                            bllP2DI.Delete(li[i].ID);
                        }
                    }
                    if (t)
                    {
                        modP2D.IsVerify   = 3;
                        modP2D.VerifyDate = DateTime.Today;
                        modP2D.VerifyMan  = VerifyMan;
                    }
                    else
                    {
                        modP2D.IsVerify   = 1;
                        modP2D.VerifyDate = DateTime.Parse("1900-1-1");
                        modP2D.VerifyMan  = 0;
                    }
                    Update(modP2D);
                }
                catch (Exception ex)
                {
                }
            }
        }
        public DataSet GetSchedule(int TaskID, int MaterielID, DateTime dt1, DateTime dt2, int PWID)
        {
            Hownet.BLL.ProductWorkingInfo bllPWI = new ProductWorkingInfo();
            Hownet.BLL.WorkTicketInfo     bllWTI = new WorkTicketInfo();
            Hownet.BLL.AmountInfo         bllAI  = new AmountInfo();
            Hownet.BLL.OtherType          bllOT  = new OtherType();
            Hownet.BLL.Materiel           bllM   = new Materiel();
            DataTable dtOT = bllOT.GetTypeList("进度工序").Tables[0];
            DataTable dt   = new DataTable();

            dt.TableName = "dt";
            dt.Columns.Add("款号", typeof(string));
            dt.Columns.Add("颜色", typeof(int));
            dt.Columns.Add("尺码", typeof(int));
            dt.Columns.Add("未领", typeof(int));
            for (int i = 0; i < dtOT.Rows.Count; i++)
            {
                dt.Columns.Add(dtOT.Rows[i]["Name"].ToString(), typeof(int));
            }
            dt.Columns.Add("合计", typeof(int));
            int     _colCount = dt.Columns.Count;
            int     _Amount   = 0;
            int     _aaa      = 0;
            DataSet ds        = new DataSet();

            ds.DataSetName = "ds";
            if (TaskID > 0)
            {
                #region  制单
                Hownet.Model.ProductTaskMain modPTM = GetModel(TaskID);
                if (modPTM.IsTicket)
                {
                    try
                    {
                        DataTable             dtAI  = bllAI.GetColorSize(TaskID, 1).Tables[0];
                        DataTable             dtPWI = bllPWI.GetTopList(1, "(MainID=" + modPTM.PWorkingID + ") And (IsTicket=1)", "Orders").Tables[0];
                        Hownet.Model.Materiel modM  = bllM.GetModel(modPTM.MaterielID);
                        for (int i = 0; i < dtAI.Rows.Count; i++)
                        {
                            _Amount = 0;
                            DataRow dr = dt.NewRow();
                            dr["款号"] = modM.Name;
                            dr["颜色"] = dtAI.Rows[i]["ColorID"];
                            dr["尺码"] = dtAI.Rows[i]["SizeID"];
                            _aaa     = bllWTI.GetNotAmountByOrders(TaskID, Convert.ToInt32(dtAI.Rows[i]["ColorID"]), Convert.ToInt32(dtAI.Rows[i]["SizeID"]), Convert.ToInt32(dtPWI.Rows[0]["WorkingID"]));
                            if (_aaa > 0)
                            {
                                dr["未领"] = _Amount = _aaa;
                            }
                            else
                            {
                                dr["未领"] = DBNull.Value;
                            }
                            for (int j = 0; j < dtOT.Rows.Count; j++)
                            {
                                _aaa = bllWTI.GetNotAmountByOrders(TaskID, Convert.ToInt32(dtAI.Rows[i]["ColorID"]), Convert.ToInt32(dtAI.Rows[i]["SizeID"]), Convert.ToInt32(dtOT.Rows[j]["Value"]));
                                if (_aaa > 0)
                                {
                                    dr[j + 4] = _aaa;
                                }
                                else
                                {
                                    dr[j + 4] = DBNull.Value;
                                }
                                _Amount += _aaa;
                            }
                            dr[_colCount - 1] = _Amount;
                            dt.Rows.Add(dr);
                        }
                        DataRow drr = dt.NewRow();
                        drr[0]  = modM.Name + "小计";
                        drr[1]  = 0;
                        drr[2]  = 0;
                        _Amount = 0;
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            if (dt.Rows[i][3].ToString() != string.Empty)
                            {
                                _Amount += Convert.ToInt32(dt.Rows[i][3]);
                            }
                        }
                        drr[3] = _Amount;
                        //  _Amount=0;
                        for (int i = 0; i < dtOT.Rows.Count; i++)
                        {
                            drr[i + 4] = bllWTI.GetNotAmountByOrders(TaskID, 0, 0, Convert.ToInt32(dtOT.Rows[i]["Value"]));
                            _Amount   += Convert.ToInt32(drr[i + 4]);
                        }
                        drr[_colCount - 1] = _Amount;
                        dt.Rows.Add(drr);
                        ds.Tables.Add(dt);
                    }
                    catch (Exception ex)
                    {
                    }
                }
                #endregion
            }
            else if (MaterielID > 0)
            {
                try
                {
                    DataTable             dtAI  = GetSumAmount(dt1, dt2, MaterielID, PWID).Tables[0];
                    DataTable             dtPWI = bllPWI.GetTopList(1, "(MainID=" + PWID + ") And (IsTicket=1)", "Orders").Tables[0];
                    Hownet.Model.Materiel modM  = bllM.GetModel(MaterielID);
                    for (int i = 0; i < dtAI.Rows.Count; i++)
                    {
                        _Amount = 0;
                        DataRow dr = dt.NewRow();
                        dr["款号"] = modM.Name;
                        dr["颜色"] = dtAI.Rows[i]["ColorID"];
                        dr["尺码"] = dtAI.Rows[i]["SizeID"];


                        _aaa = bllWTI.GetNotAmountByMateriel(dt1, dt2, MaterielID, Convert.ToInt32(dtAI.Rows[i]["ColorID"]), Convert.ToInt32(dtAI.Rows[i]["SizeID"]), Convert.ToInt32(dtPWI.Rows[0]["WorkingID"]));
                        if (_aaa > 0)
                        {
                            dr["未领"] = _Amount = _aaa;
                        }
                        else
                        {
                            dr["未领"] = DBNull.Value;
                        }
                        for (int j = 0; j < dtOT.Rows.Count; j++)
                        {
                            _aaa = bllWTI.GetNotAmountByMateriel(dt1, dt2, MaterielID, Convert.ToInt32(dtAI.Rows[i]["ColorID"]), Convert.ToInt32(dtAI.Rows[i]["SizeID"]), Convert.ToInt32(dtOT.Rows[j]["Value"]));
                            if (_aaa > 0)
                            {
                                dr[j + 4] = _aaa;
                            }
                            else
                            {
                                dr[j + 4] = DBNull.Value;
                            }
                            _Amount += _aaa;
                        }
                        dr[_colCount - 1] = _Amount;
                        dt.Rows.Add(dr);
                    }
                    DataRow drr = dt.NewRow();
                    drr[0]  = modM.Name + "小计";
                    drr[1]  = 0;
                    drr[2]  = 0;
                    _Amount = 0;
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (dt.Rows[i][3].ToString() != string.Empty)
                        {
                            _Amount += Convert.ToInt32(dt.Rows[i][3]);
                        }
                    }
                    drr[3] = _Amount;
                    //  _Amount=0;
                    for (int i = 0; i < dtOT.Rows.Count; i++)
                    {
                        drr[i + 4] = bllWTI.GetNotAmountByMateriel(dt1, dt2, MaterielID, 0, 0, Convert.ToInt32(dtOT.Rows[i]["Value"]));
                        _Amount   += Convert.ToInt32(drr[i + 4]);
                    }
                    drr[_colCount - 1] = _Amount;
                    dt.Rows.Add(drr);
                    ds.Tables.Add(dt);
                }
                catch (Exception ex)
                {
                }
            }
            return(ds);
        }