Esempio n. 1
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)
                {
                }
            }
        }
Esempio n. 2
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());
            }
        }