public string TravelReimbursementAdd(T_OA_TRAVELREIMBURSEMENT TravelReimbursement, List <T_OA_REIMBURSEMENTDETAIL> portDetail)
 {
     using (TravelReimbursementBLL TrBll = new TravelReimbursementBLL())
     {
         string returnStr = "";
         if (!this.IsExistTravelReimbursementBySportid(TravelReimbursement.CLAIMSWERE, TravelReimbursement.T_OA_BUSINESSTRIP.BUSINESSTRIPID))
         {
             if (!this.IsExistTravelReimbursement(TravelReimbursement.CLAIMSWERE, TravelReimbursement.TRAVELREIMBURSEMENTID))
             {
                 if (!TrBll.TravelReimbursementAdd(TravelReimbursement, portDetail))
                 {
                     returnStr = "添加数据失败";
                 }
             }
             else
             {
                 returnStr = "出差报销已经存在,请勿重复添加";
             }
         }
         else
         {
             returnStr = "出差报销已经存在,请勿重复添加";
         }
         return(returnStr);
     }
 }
 public T_OA_TRAVELREIMBURSEMENT GetTravelReimbursementById(string TravelReimbursementID)
 {
     using (TravelReimbursementBLL TrBll = new TravelReimbursementBLL())
     {
         T_OA_TRAVELREIMBURSEMENT TravelReimbursement = TrBll.GetTravelReimbursementById(TravelReimbursementID);
         return(TravelReimbursement != null ? TravelReimbursement : null);
     }
 }
 public string UpdateNoClaims(T_OA_TRAVELREIMBURSEMENT TravelNoClaims, List <T_OA_REIMBURSEMENTDETAIL> portDetail, string FormType)
 {
     using (TravelReimbursementBLL TrBll = new TravelReimbursementBLL())
     {
         string result = "";
         if (!TrBll.UpdateNoClaims(TravelNoClaims, portDetail, FormType))
         {
             result = "修改数据失败!";
         }
         return(result);
     }
 }
 public string UpdateNoClaims(T_OA_TRAVELREIMBURSEMENT TravelNoClaims, List<T_OA_REIMBURSEMENTDETAIL> portDetail, string FormType)
 {
     using (TravelReimbursementBLL TrBll = new TravelReimbursementBLL())
     {
         string result = "";
         if (!TrBll.UpdateNoClaims(TravelNoClaims, portDetail, FormType))
         {
             result = "修改数据失败!";
         }
         return result;
     }
 }
 private void NewMaster_Golbal()
 {
     TravelReimbursement_Golbal            = new T_OA_TRAVELREIMBURSEMENT();
     TravelReimbursement_Golbal.CHECKSTATE = ((int)CheckStates.UnSubmit).ToString();
     ReimbursementTime.Text                         = System.DateTime.Now.ToShortDateString();
     TravelReimbursement_Golbal.OWNERID             = Common.CurrentLoginUserInfo.EmployeeID;
     TravelReimbursement_Golbal.OWNERNAME           = Common.CurrentLoginUserInfo.EmployeeName;
     TravelReimbursement_Golbal.OWNERPOSTID         = Common.CurrentLoginUserInfo.UserPosts[0].PostID;
     TravelReimbursement_Golbal.OWNERPOSTNAME       = Common.CurrentLoginUserInfo.UserPosts[0].PostName;
     TravelReimbursement_Golbal.OWNERDEPARTMENTID   = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
     TravelReimbursement_Golbal.OWNERDEPARTMENTNAME = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentName;
     TravelReimbursement_Golbal.OWNERCOMPANYID      = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
     TravelReimbursement_Golbal.OWNERCOMPANYNAME    = Common.CurrentLoginUserInfo.UserPosts[0].CompanyName;
     TravelReimbursement_Golbal.POSTLEVEL           = Common.CurrentLoginUserInfo.UserPosts[0].PostLevel.ToString();
 }
 public string TravelReimbursementAddSimple(T_OA_TRAVELREIMBURSEMENT TravelReimbursement, List <T_OA_REIMBURSEMENTDETAIL> portDetail, string busnid)
 {
     using (TravelReimbursementBLL TrBll = new TravelReimbursementBLL())
     {
         string returnStr = "";
         if (!TrBll.TravelReimbursementAdd(TravelReimbursement, portDetail))
         {
             returnStr = "添加数据失败";
         }
         else
         {
             TrBll.DeleteTheSameTravelreimbursement(busnid);
         }
         return(returnStr);
     }
 }
        private void NewMaster_Golbal()
        {
            TravelReimbursement_Golbal = new T_OA_TRAVELREIMBURSEMENT();
            TravelReimbursement_Golbal.CHECKSTATE = ((int)CheckStates.UnSubmit).ToString();
            ReimbursementTime.Text = System.DateTime.Now.ToShortDateString();
            TravelReimbursement_Golbal.OWNERID = Common.CurrentLoginUserInfo.EmployeeID;
            TravelReimbursement_Golbal.OWNERNAME = Common.CurrentLoginUserInfo.EmployeeName;
            TravelReimbursement_Golbal.OWNERPOSTID = Common.CurrentLoginUserInfo.UserPosts[0].PostID;
            TravelReimbursement_Golbal.OWNERPOSTNAME = Common.CurrentLoginUserInfo.UserPosts[0].PostName;
            TravelReimbursement_Golbal.OWNERDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
            TravelReimbursement_Golbal.OWNERDEPARTMENTNAME = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentName;
            TravelReimbursement_Golbal.OWNERCOMPANYID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
            TravelReimbursement_Golbal.OWNERCOMPANYNAME = Common.CurrentLoginUserInfo.UserPosts[0].CompanyName;
            TravelReimbursement_Golbal.POSTLEVEL = Common.CurrentLoginUserInfo.UserPosts[0].PostLevel.ToString();

        }
Exemple #8
0
        /// <summary>
        /// 根据传回的XML,添加出差申请信息
        /// </summary>
        /// <param name="xele"></param>
        public static string TravelmanagementAddFromEngine(string strXml,string newTravelreimbursementID)
        { 
            try
            {

                string strEmployeeID = string.Empty;
                string strOwnerID = string.Empty;
                string strOwnerPostID = string.Empty;
                string strOwnerDepartmentID = string.Empty;
                string strOwnerCompanyID = string.Empty;
                string strClaimsWereName = string.Empty;
                string strCheckState = string.Empty;
                string strTEL = string.Empty;
                string strBusinesStripId = string.Empty;
                string strTravelreimbursementId = string.Empty;
                StringReader strRdr = new StringReader(strXml);
                XmlReader xr = XmlReader.Create(strRdr);
                while (xr.Read())
                {
                    if (xr.NodeType == XmlNodeType.Element)
                    {
                        string elementName = xr.Name;
                        if (elementName == "Paras" || elementName == "System")
                        {
                            while (xr.Read())
                            {
                                string type = xr.NodeType.ToString();
                                #region                               
                                if (xr["Name"] != null)
                                {
                                    if (xr["Name"].ToUpper() == "OWNERPOSTID")
                                    {
                                        strOwnerPostID = xr["Value"];
                                    }
                                    if (xr["Name"].ToUpper() == "OWNERID")
                                    {
                                        strOwnerID = xr["Value"];
                                    }
                                    if (xr["Name"].ToUpper() == "OWNERDEPARTMENTID")
                                    {
                                        strOwnerDepartmentID = xr["Value"];
                                    }
                                    if (xr["Name"].ToUpper() == "OWNERCOMPANYID")
                                    {
                                        strOwnerCompanyID = xr["Value"];
                                    }
                                    if (xr["Name"].ToUpper() == "BUSINESSTRIPID")
                                    {
                                        strBusinesStripId = xr["Value"];
                                    }
                                    if (xr["Name"].ToUpper() == "TRAVELREIMBURSEMENTID")
                                    {
                                        strTravelreimbursementId = xr["Value"];
                                    }
                                }                              
                            
                                #endregion
                            }
                        }
                    }
                }

                doc = new SmtOAPersonOffice();
                //string employeeid = strEmployeeID.Replace("{", "").Replace("}", "");
                T_OA_BUSINESSTRIP buip = doc.GetTravelmanagementById(strBusinesStripId);
                T_OA_TRAVELREIMBURSEMENT entity = new T_OA_TRAVELREIMBURSEMENT();
                entity.TRAVELREIMBURSEMENTID = newTravelreimbursementID;//Guid.NewGuid().ToString();
                entity.T_OA_BUSINESSTRIP = buip;
                entity.T_OA_BUSINESSTRIP.BUSINESSTRIPID = buip.BUSINESSTRIPID;
                entity.CLAIMSWERE = buip.OWNERID;
                entity.CLAIMSWERENAME = buip.OWNERNAME;
                entity.REIMBURSEMENTTIME = DateTime.Now;
                entity.CHECKSTATE = "0";
                entity.TEL = buip.TEL;
                entity.CREATEDATE = buip.UPDATEDATE;
                entity.OWNERID = buip.OWNERID;
                entity.OWNERNAME = buip.OWNERNAME;
                entity.OWNERPOSTID = buip.OWNERPOSTID;
                entity.OWNERDEPARTMENTID = buip.OWNERDEPARTMENTID;
                entity.OWNERCOMPANYID = buip.OWNERCOMPANYID;
                entity.CREATEUSERID = buip.CREATEUSERID;
                entity.CREATEUSERNAME = buip.CREATEUSERNAME;
                entity.CREATEPOSTID = buip.CREATEPOSTID;
                entity.CREATEDEPARTMENTID = buip.CREATEDEPARTMENTID;
                entity.CREATECOMPANYID = buip.CREATECOMPANYID;
                entity.OWNERPOSTNAME = buip.OWNERPOSTNAME;
                entity.OWNERDEPARTMENTNAME = buip.OWNERDEPARTMENTNAME;
                entity.OWNERCOMPANYNAME = buip.OWNERCOMPANYNAME;
                entity.POSTLEVEL = buip.POSTLEVEL;
                entity.STARTCITYNAME = buip.STARTCITYNAME;
                entity.ENDCITYNAME = buip.ENDCITYNAME;
                if (buip.REMARKS == "工作计划生成" || buip.ISFROMWP=="1")
                {
                    entity.ISFROMWP = "1";
                }
                Tracer.Debug("出差终审自动生成出差报销:" + entity.OWNERNAME
                    + "-" + entity.OWNERPOSTNAME
                    + "-" + entity.OWNERDEPARTMENTNAME
                    + "-" + entity.OWNERCOMPANYNAME
                    + "-岗位级别:" + entity.POSTLEVEL
                    + "-开始城市:" + entity.STARTCITYNAME
                    + "-结束城市:" + entity.ENDCITYNAME);
                //添加子表数据
                EmployeeWS.V_EMPLOYEEDETAIL emp = new EmployeeWS.V_EMPLOYEEDETAIL();
                EmployeeWS.PersonnelServiceClient cinet = new EmployeeWS.PersonnelServiceClient();//人事服务(查询员工岗位级别用)
                List<T_OA_CANTAKETHEPLANELINE> PlaneObj = new List<T_OA_CANTAKETHEPLANELINE>();
                List<T_OA_TAKETHESTANDARDTRANSPORT> StandardObj = new List<T_OA_TAKETHESTANDARDTRANSPORT>();

                emp = cinet.GetEmployeeDetailViewByID(entity.OWNERID);//根据员工ID查询出岗位级别
                postLevel = emp.EMPLOYEEPOSTS.Where(s => s.POSTID == buip.OWNERPOSTID).FirstOrDefault().POSTLEVEL.ToString();//获取出差人的岗位级别
                var companyId = emp.EMPLOYEEPOSTS.Where(s => s.CompanyID == buip.OWNERCOMPANYID).FirstOrDefault().CompanyID.ToString();//获取出差人的所属公司
                T_OA_TRAVELSOLUTIONS travelsolutions = doc.GetTravelSolutionByCompanyID(entity.OWNERCOMPANYID, ref PlaneObj, ref StandardObj);//出差方案
                if (travelsolutions != null)
                {
                    solutionID = travelsolutions.TRAVELSOLUTIONSID;//出差方案ID
                }
                List<T_OA_BUSINESSTRIPDETAIL> TravelDetail = doc.GetBusinesstripDetail(strBusinesStripId);
                List<T_OA_REIMBURSEMENTDETAIL> TrDetail = new List<T_OA_REIMBURSEMENTDETAIL>();//出差报销子表
                List<string> cityscode = new List<string>();
                double BusinessDays = 0;
                int i = 0;
                double total = 0;
                #region
                //foreach (var detail in TravelDetail)
                for (int j = 0; j < TravelDetail.Count();j++ )
                {
                    var detail = TravelDetail[i];
                    i++;
                    double toodays = 0;

                    //计算本次出差的时间
                    List<string> list = new List<string>
                        {
                             detail.BUSINESSDAYS
                        };
                    if (detail.BUSINESSDAYS != null)
                    {
                        double totalHours = System.Convert.ToDouble(list[0]);

                        BusinessDays += totalHours;//总天数
                        toodays = totalHours;//单条数据的天数
                    }
                    double tresult = toodays;//计算本次出差的总天数

                    T_OA_REIMBURSEMENTDETAIL TrListInfo = new T_OA_REIMBURSEMENTDETAIL();
                    TrListInfo.REIMBURSEMENTDETAILID = Guid.NewGuid().ToString();

                    TrListInfo.STARTDATE = detail.STARTDATE;//开始时间
                    TrListInfo.ENDDATE = detail.ENDDATE;//结束时间
                    TrListInfo.BUSINESSDAYS = detail.BUSINESSDAYS;//出差天数
                    TrListInfo.DEPCITY = detail.DEPCITY;//出发城市
                    TrListInfo.DESTCITY = detail.DESTCITY;//目标城市
                    TrListInfo.PRIVATEAFFAIR = detail.PRIVATEAFFAIR;//是否私事
                    TrListInfo.GOOUTTOMEET = detail.GOOUTTOMEET;//外出开会
                    TrListInfo.COMPANYCAR = detail.COMPANYCAR;//公司派车
                    TrListInfo.TYPEOFTRAVELTOOLS = detail.TYPEOFTRAVELTOOLS;//交通工具类型
                    TrListInfo.TAKETHETOOLLEVEL = detail.TAKETHETOOLLEVEL;//交通工具级别
                    TrListInfo.CREATEDATE = Convert.ToDateTime(buip.UPDATEDATE);//创建时间
                    TrListInfo.CREATEUSERNAME = buip.CREATEUSERNAME;//创建人
                    cityscode.Add(TrListInfo.DESTCITY);

                    T_OA_AREAALLOWANCE entareaallowance = new T_OA_AREAALLOWANCE();
                    string cityValue = cityscode[i - 1];//目标城市值
                    entareaallowance = GetAllowanceByCityValue(cityValue);

                    #region 根据本次出差的总天数,根据天数获取相应的补贴
                    if (travelsolutions != null)
                    {
                        if (tresult <= int.Parse(travelsolutions.MINIMUMINTERVALDAYS))//本次出差总时间小于等于设定天数的报销标准
                        {
                            if (entareaallowance != null)
                            {
                                if (detail.BUSINESSDAYS != null)
                                {
                                    if (detail.PRIVATEAFFAIR == "1")//如果是私事不予报销
                                    {
                                        TrListInfo.TRANSPORTATIONSUBSIDIES = 0;//交通补贴
                                    }
                                    else if (detail.GOOUTTOMEET == "1" || detail.COMPANYCAR == "1")//如果是开会或者是公司派车,交通费没有
                                    {
                                        TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                    }
                                    else
                                    {
                                        if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准
                                        {
                                            if (entareaallowance.TRANSPORTATIONSUBSIDIES != null)
                                            {
                                                TrListInfo.TRANSPORTATIONSUBSIDIES = decimal.Parse((Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES) * toodays).ToString());
                                            }
                                        }
                                        else
                                        {
                                            TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                        }
                                    }
                                }

                                if (detail.BUSINESSDAYS != null)
                                {
                                    if (detail.PRIVATEAFFAIR == "1")//餐费补贴
                                    {
                                        TrListInfo.MEALSUBSIDIES = 0;
                                    }
                                    else if (detail.GOOUTTOMEET == "1")//如果是开会
                                    {
                                        TrListInfo.MEALSUBSIDIES = 0;
                                    }
                                    else
                                    {
                                        if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准
                                        {
                                            TrListInfo.MEALSUBSIDIES = decimal.Parse((Convert.ToDouble(entareaallowance.MEALSUBSIDIES) * toodays).ToString());
                                        }
                                        else
                                        {
                                            TrListInfo.MEALSUBSIDIES = 0;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (int.Parse(postLevel) <= 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准
                            {
                                TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                TrListInfo.MEALSUBSIDIES = 0;
                            }
                        }
                    }
                    #endregion

                    #region 如果出差天数大于设定的最大天数,按驻外标准获取补贴
                    if (travelsolutions != null)
                    {
                        if (tresult > int.Parse(travelsolutions.MAXIMUMRANGEDAYS))
                        {
                            if (entareaallowance != null)
                            {
                                double DbTranceport = Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES);
                                double DbMeal = Convert.ToDouble(entareaallowance.MEALSUBSIDIES);
                                double tfSubsidies = Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES) * (Convert.ToDouble(travelsolutions.INTERVALRATIO) / 100);
                                double mealSubsidies = Convert.ToDouble(entareaallowance.MEALSUBSIDIES) * (Convert.ToDouble(travelsolutions.INTERVALRATIO) / 100);

                                if (detail.BUSINESSDAYS != null)
                                {
                                    if (detail.PRIVATEAFFAIR == "1")//如果是私事不予报销
                                    {
                                        TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                    }
                                    else if (detail.GOOUTTOMEET == "1" || detail.COMPANYCAR == "1")//如果是开会或者是公司派车,交通费没有
                                    {
                                        TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                    }
                                    else
                                    {
                                        if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准
                                        {
                                            double minmoney = Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) * DbTranceport;
                                            double middlemoney = (Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS) - Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS)) * tfSubsidies;
                                            double lastmoney = (tresult - Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS)) * Convert.ToDouble(entareaallowance.OVERSEASSUBSIDIES);
                                            TrListInfo.TRANSPORTATIONSUBSIDIES = decimal.Parse((minmoney + middlemoney + lastmoney).ToString());
                                        }
                                        else
                                        {
                                            TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                        }
                                    }
                                }

                                if (detail.BUSINESSDAYS != null)
                                {
                                    if (detail.PRIVATEAFFAIR == "1")//如果是私事不予报销
                                    {
                                        TrListInfo.MEALSUBSIDIES = 0;
                                    }
                                    else if (detail.GOOUTTOMEET == "1")//如果是开会
                                    {
                                        TrListInfo.MEALSUBSIDIES = 0;
                                    }
                                    else
                                    {
                                        if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准
                                        {
                                            double minmoney = Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) * DbMeal;
                                            double middlemoney = (Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS) - Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS)) * mealSubsidies;
                                            double lastmoney = (tresult - Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS)) * Convert.ToDouble(entareaallowance.OVERSEASSUBSIDIES);
                                            TrListInfo.MEALSUBSIDIES = decimal.Parse((minmoney + middlemoney + lastmoney).ToString());

                                        }
                                        else
                                        {
                                            TrListInfo.MEALSUBSIDIES = 0;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (int.Parse(postLevel) <= 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准
                            {
                                TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                TrListInfo.MEALSUBSIDIES = 0;
                            }
                        }
                    }
                    #endregion



                #region 如果出差时间大于设定的最小天数并且小于设定的最大天数的报销标准
                if (travelsolutions != null)
                {
                    if (tresult >= Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) && tresult <= Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS))
                    {
                        if (entareaallowance != null)
                        {
                            double DbTranceport = Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES);
                            double DbMeal = Convert.ToDouble(entareaallowance.MEALSUBSIDIES);
                            double tfSubsidies = Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES) * (Convert.ToDouble(travelsolutions.INTERVALRATIO) / 100);
                            double mealSubsidies = Convert.ToDouble(entareaallowance.MEALSUBSIDIES) * (Convert.ToDouble(travelsolutions.INTERVALRATIO) / 100);

                            if (detail.BUSINESSDAYS != null)
                            {
                                if (detail.PRIVATEAFFAIR == "1")//如果是私事不予报销
                                {
                                    TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                }
                                else if (detail.GOOUTTOMEET == "1" || detail.COMPANYCAR == "1")//如果是开会或者是公司派车,交通费没有
                                {
                                    TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                }
                                else
                                {
                                    if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准
                                    {
                                        double minmoney = Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) * DbTranceport;
                                        double middlemoney = (tresult - Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS)) * tfSubsidies;
                                        TrListInfo.TRANSPORTATIONSUBSIDIES = decimal.Parse((minmoney + middlemoney).ToString());
                                    }
                                    else
                                    {
                                        TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                    }
                                }
                            }

                            if (detail.BUSINESSDAYS != null)
                            {
                                if (detail.PRIVATEAFFAIR == "1")//如果是私事不予报销
                                {
                                    TrListInfo.MEALSUBSIDIES = 0;
                                }
                                else if (detail.GOOUTTOMEET == "1")//如果是开会
                                {
                                    TrListInfo.MEALSUBSIDIES = 0;
                                }
                                else
                                {
                                    if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准
                                    {
                                        //最小区间段金额
                                        double minmoney = Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) * DbMeal;
                                        //中间区间段金额
                                        double middlemoney = (tresult - Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS)) * mealSubsidies;
                                        TrListInfo.MEALSUBSIDIES = decimal.Parse((minmoney + middlemoney).ToString());
                                    }
                                    else
                                    {
                                        TrListInfo.MEALSUBSIDIES = 0;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        if (int.Parse(postLevel) <= 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准
                        {
                            TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                            TrListInfo.MEALSUBSIDIES = 0;
                        }
                    }
                }
                total += Convert.ToDouble(TrListInfo.TRANSPORTATIONSUBSIDIES + TrListInfo.MEALSUBSIDIES);
                entity.THETOTALCOST = decimal.Parse(total.ToString());//差旅费用总和
                entity.REIMBURSEMENTOFCOSTS = decimal.Parse(total.ToString());//报销费用总和

                #endregion

                TrDetail.Add(TrListInfo);
                }
                #endregion

                string result = BusinessDays.ToString(); //计算本次出差的总时间,超过24小时天数加1
                entity.COMPUTINGTIME = result;//总时间

                //doc.TravelReimbursementAdd(entity, TrDetail);
                doc.TravelReimbursementAddSimple(entity, TrDetail,strBusinesStripId);


                return null;//entity.TRAVELREIMBURSEMENTID;
            }
            catch (Exception e)
            {
                string abc = "<OA>Message=[" + e.Message + "]" + "<OA>Source=[" + e.Source + "]<OA>StackTrace=[" + e.StackTrace + "]<OA>TargetSite=[" + e.TargetSite + "]";
                Tracer.Debug(abc);
                return abc;
            }
        }
        private string GetXmlString(T_OA_TRAVELREIMBURSEMENT Info, string StrSource)
        {
            string goouttomeet   = string.Empty;
            string privateaffair = string.Empty;
            string companycar    = string.Empty;
            string isagent       = string.Empty;
            string path          = string.Empty;
            string chargetype    = string.Empty;
            string ExtTotal      = "";

            if (fbCtr.ListDetail.Count() > 0)
            {
                decimal totalMoney = this.fbCtr.ListDetail.Sum(item =>
                {
                    return((item.Entity as T_FB_EXTENSIONORDERDETAIL).APPLIEDMONEY);
                });
                ExtTotal = totalMoney.ToString();
            }

            SMT.SaaS.MobileXml.MobileXml      mx = new MobileXml.MobileXml();
            SMT.SaaS.MobileXml.AutoDictionary ad = new MobileXml.AutoDictionary();

            List <SMT.SaaS.MobileXml.AutoDictionary> AutoList = new List <SMT.SaaS.MobileXml.AutoDictionary>();

            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "CHECKSTATE", TravelReimbursement_Golbal.CHECKSTATE, GetCheckState(TravelReimbursement_Golbal.CHECKSTATE)));        //审核状态
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "BUSINESSTRIPID", businesstrID, string.Empty));                                                                     //出差申请ID
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "AVAILABLECREDIT", UsableMoney, string.Empty));                                                                     //可用额度
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "REIMBURSEMENTSTANDARDS", textStandards.Text, string.Empty));                                                       //报销标准
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "REIMBURSEMENTOFCOSTS", fbCtr.Order.TOTALMONEY.ToString(), string.Empty));                                          //报销总计
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "POSTLEVEL", EmployeePostLevel, string.Empty));                                                                     //出差人的岗位级别
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "CONTENT", TravelReimbursement_Golbal.CONTENT, TravelReimbursement_Golbal.CONTENT));                                //报告内容
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "REMARKS", TravelReimbursement_Golbal.REMARKS, string.Empty));                                                      //备注
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "PAYMENTINFO", fbCtr.Order.PAYMENTINFO, string.Empty));                                                             //支付信息
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "PAYTARGET", ExtTotal, string.Empty));                                                                              //小计
            StrPayInfo = txtPAYMENTINFO.Text.ToString();
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "PAYMENTINFO", StrPayInfo, string.Empty));                                                                          //支付信息
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "TRAVLEAREAALLOWANCE", textStandards.Text, string.Empty));                                                          //报销标准
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "AttachMent", TravelReimbursement_Golbal.TRAVELREIMBURSEMENTID, TravelReimbursement_Golbal.TRAVELREIMBURSEMENTID)); //附件

            if (!string.IsNullOrEmpty(TravelReimbursement_Golbal.NOBUDGETCLAIMS))                                                                                                 //报销单号
            {
                AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "NOBUDGETCLAIMS", TravelReimbursement_Golbal.NOBUDGETCLAIMS, string.Empty));                                    //报销单号
            }
            if (TravelReimbursement_Golbal.CLAIMSWERE != null && !string.IsNullOrEmpty(EmployeeName))                                                                             //报销人
            {
                AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "CLAIMSWERE", TravelReimbursement_Golbal.CLAIMSWERE, EmployeeName + "-" + postName + "-" + depName + "-" + companyName));
            }
            if (TravelReimbursement_Golbal.OWNERID != null && !string.IsNullOrEmpty(EmployeeName))//所属人
            {
                AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "OWNERID", TravelReimbursement_Golbal.OWNERID, EmployeeName));
            }
            if (TravelReimbursement_Golbal.OWNERCOMPANYID != null && !string.IsNullOrEmpty(companyName))//所属公司
            {
                AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "OWNERCOMPANYID", TravelReimbursement_Golbal.OWNERCOMPANYID, companyName));
            }
            if (TravelReimbursement_Golbal.OWNERDEPARTMENTID != null && !string.IsNullOrEmpty(depName))//所属部门
            {
                AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "OWNERDEPARTMENTID", TravelReimbursement_Golbal.OWNERDEPARTMENTID, depName));
            }
            if (TravelReimbursement_Golbal.OWNERPOSTID != null && !string.IsNullOrEmpty(postName))//所属岗位
            {
                AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "OWNERPOSTID", TravelReimbursement_Golbal.OWNERPOSTID, postName));
            }
            foreach (T_OA_REIMBURSEMENTDETAIL objDetail in TravelDetailList_Golbal) //填充子表
            {
                if (objDetail.BUSINESSDAYS != null)                                 //出差天数
                {
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "BUSINESSDAYS", objDetail.BUSINESSDAYS, objDetail.BUSINESSDAYS, objDetail.REIMBURSEMENTDETAILID));
                }
                if (objDetail.THENUMBEROFNIGHTS != null)//住宿天数
                {
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "THENUMBEROFNIGHTS", objDetail.THENUMBEROFNIGHTS, objDetail.THENUMBEROFNIGHTS, objDetail.REIMBURSEMENTDETAILID));
                }
                if (objDetail.DEPCITY != null)
                {
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "DEPCITY", objDetail.DEPCITY, SMT.SaaS.FrameworkUI.Common.Utility.GetCityName(objDetail.DEPCITY), objDetail.REIMBURSEMENTDETAILID));
                }
                if (objDetail.DESTCITY != null)
                {
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "DESTCITY", objDetail.DESTCITY, SMT.SaaS.FrameworkUI.Common.Utility.GetCityName(objDetail.DESTCITY), objDetail.REIMBURSEMENTDETAILID));
                }
                if (TravelReimbursement_Golbal.CREATEUSERID != null)//创建人
                {
                    AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "OWNERID", TravelReimbursement_Golbal.CREATEUSERID, Common.CurrentLoginUserInfo.EmployeeName, objDetail.REIMBURSEMENTDETAILID));
                }
                if (TravelReimbursement_Golbal.UPDATEUSERID != null)//修改人
                {
                    AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "OWNERID", TravelReimbursement_Golbal.UPDATEUSERID, Common.CurrentLoginUserInfo.EmployeeName, objDetail.REIMBURSEMENTDETAILID));
                }
                if (objDetail.OTHERCOSTS != null)
                {
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "OTHERCOSTS", objDetail.OTHERCOSTS.ToString(), string.Empty, objDetail.REIMBURSEMENTDETAILID));
                }
                else //如果没有其他费用就传空值给Xml
                {
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "OTHERCOSTS", string.Empty, string.Empty, objDetail.REIMBURSEMENTDETAILID));
                }
                if (objDetail.PRIVATEAFFAIR != null)
                {
                    if (objDetail.PRIVATEAFFAIR == "0")//是否私事
                    {
                        privateaffair = "否";
                    }
                    else
                    {
                        privateaffair = "是";
                    }
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "PRIVATEAFFAIR", objDetail.PRIVATEAFFAIR, privateaffair, objDetail.REIMBURSEMENTDETAILID));
                }
                if (objDetail.GOOUTTOMEET != null)
                {
                    if (objDetail.GOOUTTOMEET == "0")//内部会议\培训
                    {
                        goouttomeet = "否";
                    }
                    else
                    {
                        goouttomeet = "是";
                    }
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "GOOUTTOMEET", objDetail.GOOUTTOMEET, goouttomeet, objDetail.REIMBURSEMENTDETAILID));
                }
                if (objDetail.COMPANYCAR != null)
                {
                    if (objDetail.COMPANYCAR == "0")//是否是公司派车
                    {
                        companycar = "否";
                    }
                    else
                    {
                        companycar = "是";
                    }
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "COMPANYCAR", objDetail.COMPANYCAR, companycar, objDetail.REIMBURSEMENTDETAILID));
                }
                if (objDetail.TYPEOFTRAVELTOOLS != null)
                {
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "TYPEOFTRAVELTOOLS", objDetail.TYPEOFTRAVELTOOLS, GetTypeName(objDetail.TYPEOFTRAVELTOOLS), objDetail.REIMBURSEMENTDETAILID));
                }
                if (objDetail.TAKETHETOOLLEVEL != null)
                {
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "TAKETHETOOLLEVEL", objDetail.TAKETHETOOLLEVEL, GetLevelName(objDetail.TAKETHETOOLLEVEL, GetTypeId(objDetail.TYPEOFTRAVELTOOLS)), objDetail.REIMBURSEMENTDETAILID));
                }
            }
            ObservableCollection <Object> TrListObj = new ObservableCollection <Object>();

            foreach (var item in TravelDetailList_Golbal)
            {
                TrListObj.Add(item);
            }

            if (fbCtr.ListDetail.Count > 0)//获取算控件中的数据
            {
                //SMT.Saas.Tools.FBServiceWS.T_FB_EXTENSIONALORDER entext = fbCtr
                //fbCtr.Order.REMARK
                string StrType = "";
                if (fbCtr.Order.REMARK != null)
                {
                    AutoList.Add(basedata("T_FB_EXTENSIONORDERDETAIL", "FBREMARK", fbCtr.Order.REMARK, fbCtr.Order.REMARK, fbCtr.Order.EXTENSIONALORDERID)); //科目报销备注

                    AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "FBREMARK", fbCtr.Order.REMARK, fbCtr.Order.REMARK));                                  //科目报销备注,同时加入主表
                }
                if (fbCtr.Order.APPLYTYPE == 1)
                {
                    StrType = "个人费用报销";
                }
                if (fbCtr.Order.APPLYTYPE == 2)
                {
                    StrType = "冲借款";
                }
                if (!string.IsNullOrEmpty(StrType))
                {
                    AutoList.Add(basedata("T_FB_EXTENSIONORDERDETAIL", "EXTENSIONTYPE", StrType, StrType, fbCtr.Order.EXTENSIONALORDERID)); //科目报销备注
                    AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "EXTENSIONTYPE", StrType, StrType));                                  //科目报销备注,同时加入主表
                }
                foreach (FBEntity item in fbCtr.ListDetail)                                                                                 //预算费用报销明细
                {
                    SMT.Saas.Tools.FBServiceWS.T_FB_EXTENSIONORDERDETAIL entTemp = item.Entity as SMT.Saas.Tools.FBServiceWS.T_FB_EXTENSIONORDERDETAIL;

                    TrListObj.Add(entTemp);

                    if (entTemp.CHARGETYPE != null)
                    {
                        if (entTemp.CHARGETYPE.ToString() == "1")
                        {
                            chargetype = "个人预算费用";
                        }
                        else
                        {
                            chargetype = "部门预算费用";
                        }
                        AutoList.Add(basedata("T_FB_EXTENSIONORDERDETAIL", "CHARGETYPE", entTemp.CHARGETYPE.ToString(), chargetype, entTemp.EXTENSIONORDERDETAILID));                       //费用类型
                    }
                    AutoList.Add(basedata("T_FB_EXTENSIONORDERDETAIL", "SUBJECTCODE", entTemp.T_FB_SUBJECT.SUBJECTCODE, entTemp.T_FB_SUBJECT.SUBJECTCODE, entTemp.EXTENSIONORDERDETAILID)); //科目编号
                    AutoList.Add(basedata("T_FB_EXTENSIONORDERDETAIL", "SUBJECTNAME", entTemp.T_FB_SUBJECT.SUBJECTNAME, entTemp.T_FB_SUBJECT.SUBJECTNAME, entTemp.EXTENSIONORDERDETAILID)); //科目名称
                    AutoList.Add(basedata("T_FB_EXTENSIONORDERDETAIL", "USABLEMONEY", entTemp.USABLEMONEY.ToString(), entTemp.USABLEMONEY.ToString(), entTemp.EXTENSIONORDERDETAILID));     //可用金额
                    AutoList.Add(basedata("T_FB_EXTENSIONORDERDETAIL", "REMARK", entTemp.REMARK, entTemp.REMARK, entTemp.EXTENSIONORDERDETAILID));                                          //摘要
                    AutoList.Add(basedata("T_FB_EXTENSIONORDERDETAIL", "APPLIEDMONEY", entTemp.APPLIEDMONEY.ToString(), entTemp.APPLIEDMONEY.ToString(), entTemp.EXTENSIONORDERDETAILID));  //申领金额
                }
            }
            //冲借款明细

            if (fbCtr.ListBorrowDetail.Count() > 0)
            {
                foreach (T_FB_CHARGEAPPLYREPAYDETAIL item in fbCtr.ListBorrowDetail)//预算费用报销明细
                {
                    TrListObj.Add(item);

                    if (item.REPAYTYPE != null)
                    {
                        switch (item.REPAYTYPE.ToString())
                        {
                        case "1":
                            chargetype = "现金还普通借款";
                            break;

                        case "2":
                            chargetype = "现金还备用金借款";
                            break;

                        case "3":
                            chargetype = "现金还专项借款";
                            break;
                        }
                        AutoList.Add(basedata("T_FB_CHARGEAPPLYREPAYDETAIL", "CHARGETYPE", item.REPAYTYPE.ToString(), chargetype, item.CHARGEAPPLYREPAYDETAILID));//费用类型
                    }
                    if (item.BORROWMONEY != null)
                    {
                        AutoList.Add(basedata("T_FB_CHARGEAPPLYREPAYDETAIL", "BORROWMONEY", item.BORROWMONEY.ToString(), item.BORROWMONEY.ToString(), item.CHARGEAPPLYREPAYDETAILID));//科目编号
                    }

                    AutoList.Add(basedata("T_FB_CHARGEAPPLYREPAYDETAIL", "REMARK", item.REMARK, item.REMARK, item.CHARGEAPPLYREPAYDETAILID));//摘要
                    if (item.REPAYMONEY != null)
                    {
                        AutoList.Add(basedata("T_FB_CHARGEAPPLYREPAYDETAIL", "REPAYMONEY", item.REPAYMONEY.ToString(), item.REPAYMONEY.ToString(), item.CHARGEAPPLYREPAYDETAILID));//申领金额
                    }
                }
            }
            //string a = mx.TableToXml(Info, TrListObj, StrSource, AutoList);
            string a = mx.TableToXmlForTravel(Info, TrListObj, StrSource, AutoList);

            return(a);
        }
Exemple #10
0
        /// <summary>
        /// 根据传回的XML,添加出差申请信息
        /// </summary>
        /// <param name="xele"></param>
        public static string TravelmanagementAddFromEngine(string strXml, string newTravelreimbursementID)
        {
            try
            {
                string       strEmployeeID        = string.Empty;
                string       strOwnerID           = string.Empty;
                string       strOwnerPostID       = string.Empty;
                string       strOwnerDepartmentID = string.Empty;
                string       strOwnerCompanyID    = string.Empty;
                string       strClaimsWereName    = string.Empty;
                string       strCheckState        = string.Empty;
                string       strTEL                   = string.Empty;
                string       strBusinesStripId        = string.Empty;
                string       strTravelreimbursementId = string.Empty;
                StringReader strRdr                   = new StringReader(strXml);
                XmlReader    xr = XmlReader.Create(strRdr);
                while (xr.Read())
                {
                    if (xr.NodeType == XmlNodeType.Element)
                    {
                        string elementName = xr.Name;
                        if (elementName == "Paras" || elementName == "System")
                        {
                            while (xr.Read())
                            {
                                string type = xr.NodeType.ToString();
                                #region
                                if (xr["Name"] != null)
                                {
                                    if (xr["Name"].ToUpper() == "OWNERPOSTID")
                                    {
                                        strOwnerPostID = xr["Value"];
                                    }
                                    if (xr["Name"].ToUpper() == "OWNERID")
                                    {
                                        strOwnerID = xr["Value"];
                                    }
                                    if (xr["Name"].ToUpper() == "OWNERDEPARTMENTID")
                                    {
                                        strOwnerDepartmentID = xr["Value"];
                                    }
                                    if (xr["Name"].ToUpper() == "OWNERCOMPANYID")
                                    {
                                        strOwnerCompanyID = xr["Value"];
                                    }
                                    if (xr["Name"].ToUpper() == "BUSINESSTRIPID")
                                    {
                                        strBusinesStripId = xr["Value"];
                                    }
                                    if (xr["Name"].ToUpper() == "TRAVELREIMBURSEMENTID")
                                    {
                                        strTravelreimbursementId = xr["Value"];
                                    }
                                }

                                #endregion
                            }
                        }
                    }
                }

                doc = new SmtOAPersonOffice();
                //string employeeid = strEmployeeID.Replace("{", "").Replace("}", "");
                T_OA_BUSINESSTRIP        buip   = doc.GetTravelmanagementById(strBusinesStripId);
                T_OA_TRAVELREIMBURSEMENT entity = new T_OA_TRAVELREIMBURSEMENT();
                entity.TRAVELREIMBURSEMENTID            = newTravelreimbursementID;//Guid.NewGuid().ToString();
                entity.T_OA_BUSINESSTRIP                = buip;
                entity.T_OA_BUSINESSTRIP.BUSINESSTRIPID = buip.BUSINESSTRIPID;
                entity.CLAIMSWERE        = buip.OWNERID;
                entity.CLAIMSWERENAME    = buip.OWNERNAME;
                entity.REIMBURSEMENTTIME = DateTime.Now;
                entity.CHECKSTATE        = "0";
                entity.TEL                 = buip.TEL;
                entity.CREATEDATE          = buip.UPDATEDATE;
                entity.OWNERID             = buip.OWNERID;
                entity.OWNERNAME           = buip.OWNERNAME;
                entity.OWNERPOSTID         = buip.OWNERPOSTID;
                entity.OWNERDEPARTMENTID   = buip.OWNERDEPARTMENTID;
                entity.OWNERCOMPANYID      = buip.OWNERCOMPANYID;
                entity.CREATEUSERID        = buip.CREATEUSERID;
                entity.CREATEUSERNAME      = buip.CREATEUSERNAME;
                entity.CREATEPOSTID        = buip.CREATEPOSTID;
                entity.CREATEDEPARTMENTID  = buip.CREATEDEPARTMENTID;
                entity.CREATECOMPANYID     = buip.CREATECOMPANYID;
                entity.OWNERPOSTNAME       = buip.OWNERPOSTNAME;
                entity.OWNERDEPARTMENTNAME = buip.OWNERDEPARTMENTNAME;
                entity.OWNERCOMPANYNAME    = buip.OWNERCOMPANYNAME;
                entity.POSTLEVEL           = buip.POSTLEVEL;
                entity.STARTCITYNAME       = buip.STARTCITYNAME;
                entity.ENDCITYNAME         = buip.ENDCITYNAME;
                Tracer.Debug("出差终审自动生成出差报销:" + entity.OWNERNAME
                             + "-" + entity.OWNERPOSTNAME
                             + "-" + entity.OWNERDEPARTMENTNAME
                             + "-" + entity.OWNERCOMPANYNAME
                             + "-岗位级别:" + entity.POSTLEVEL
                             + "-开始城市:" + entity.STARTCITYNAME
                             + "-结束城市:" + entity.ENDCITYNAME);
                //添加子表数据
                EmployeeWS.V_EMPLOYEEDETAIL          emp         = new EmployeeWS.V_EMPLOYEEDETAIL();
                EmployeeWS.PersonnelServiceClient    cinet       = new EmployeeWS.PersonnelServiceClient();//人事服务(查询员工岗位级别用)
                List <T_OA_CANTAKETHEPLANELINE>      PlaneObj    = new List <T_OA_CANTAKETHEPLANELINE>();
                List <T_OA_TAKETHESTANDARDTRANSPORT> StandardObj = new List <T_OA_TAKETHESTANDARDTRANSPORT>();

                emp       = cinet.GetEmployeeDetailViewByID(entity.OWNERID);                                                                   //根据员工ID查询出岗位级别
                postLevel = emp.EMPLOYEEPOSTS.Where(s => s.POSTID == buip.OWNERPOSTID).FirstOrDefault().POSTLEVEL.ToString();                  //获取出差人的岗位级别
                var companyId = emp.EMPLOYEEPOSTS.Where(s => s.CompanyID == buip.OWNERCOMPANYID).FirstOrDefault().CompanyID.ToString();        //获取出差人的所属公司
                T_OA_TRAVELSOLUTIONS travelsolutions = doc.GetTravelSolutionByCompanyID(entity.OWNERCOMPANYID, ref PlaneObj, ref StandardObj); //出差方案
                if (travelsolutions != null)
                {
                    solutionID = travelsolutions.TRAVELSOLUTIONSID;//出差方案ID
                }
                List <T_OA_BUSINESSTRIPDETAIL>  TravelDetail = doc.GetBusinesstripDetail(strBusinesStripId);
                List <T_OA_REIMBURSEMENTDETAIL> TrDetail     = new List <T_OA_REIMBURSEMENTDETAIL>();//出差报销子表
                List <string> cityscode    = new List <string>();
                double        BusinessDays = 0;
                int           i            = 0;
                double        total        = 0;
                #region
                //foreach (var detail in TravelDetail)
                for (int j = 0; j < TravelDetail.Count(); j++)
                {
                    var detail = TravelDetail[i];
                    i++;
                    double toodays = 0;

                    //计算本次出差的时间
                    List <string> list = new List <string>
                    {
                        detail.BUSINESSDAYS
                    };
                    if (detail.BUSINESSDAYS != null)
                    {
                        double totalHours = System.Convert.ToDouble(list[0]);

                        BusinessDays += totalHours; //总天数
                        toodays       = totalHours; //单条数据的天数
                    }
                    double tresult = toodays;       //计算本次出差的总天数

                    T_OA_REIMBURSEMENTDETAIL TrListInfo = new T_OA_REIMBURSEMENTDETAIL();
                    TrListInfo.REIMBURSEMENTDETAILID = Guid.NewGuid().ToString();

                    TrListInfo.STARTDATE         = detail.STARTDATE;                    //开始时间
                    TrListInfo.ENDDATE           = detail.ENDDATE;                      //结束时间
                    TrListInfo.BUSINESSDAYS      = detail.BUSINESSDAYS;                 //出差天数
                    TrListInfo.DEPCITY           = detail.DEPCITY;                      //出发城市
                    TrListInfo.DESTCITY          = detail.DESTCITY;                     //目标城市
                    TrListInfo.PRIVATEAFFAIR     = detail.PRIVATEAFFAIR;                //是否私事
                    TrListInfo.GOOUTTOMEET       = detail.GOOUTTOMEET;                  //外出开会
                    TrListInfo.COMPANYCAR        = detail.COMPANYCAR;                   //公司派车
                    TrListInfo.TYPEOFTRAVELTOOLS = detail.TYPEOFTRAVELTOOLS;            //交通工具类型
                    TrListInfo.TAKETHETOOLLEVEL  = detail.TAKETHETOOLLEVEL;             //交通工具级别
                    TrListInfo.CREATEDATE        = Convert.ToDateTime(buip.UPDATEDATE); //创建时间
                    TrListInfo.CREATEUSERNAME    = buip.CREATEUSERNAME;                 //创建人
                    cityscode.Add(TrListInfo.DESTCITY);

                    T_OA_AREAALLOWANCE entareaallowance = new T_OA_AREAALLOWANCE();
                    string             cityValue        = cityscode[i - 1];//目标城市值
                    entareaallowance = GetAllowanceByCityValue(cityValue);

                    #region 根据本次出差的总天数,根据天数获取相应的补贴
                    if (travelsolutions != null)
                    {
                        if (tresult <= int.Parse(travelsolutions.MINIMUMINTERVALDAYS))//本次出差总时间小于等于设定天数的报销标准
                        {
                            if (entareaallowance != null)
                            {
                                if (detail.BUSINESSDAYS != null)
                                {
                                    if (detail.PRIVATEAFFAIR == "1")                                //如果是私事不予报销
                                    {
                                        TrListInfo.TRANSPORTATIONSUBSIDIES = 0;                     //交通补贴
                                    }
                                    else if (detail.GOOUTTOMEET == "1" || detail.COMPANYCAR == "1") //如果是开会或者是公司派车,交通费没有
                                    {
                                        TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                    }
                                    else
                                    {
                                        if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准
                                        {
                                            if (entareaallowance.TRANSPORTATIONSUBSIDIES != null)
                                            {
                                                TrListInfo.TRANSPORTATIONSUBSIDIES = decimal.Parse((Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES) * toodays).ToString());
                                            }
                                        }
                                        else
                                        {
                                            TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                        }
                                    }
                                }

                                if (detail.BUSINESSDAYS != null)
                                {
                                    if (detail.PRIVATEAFFAIR == "1")//餐费补贴
                                    {
                                        TrListInfo.MEALSUBSIDIES = 0;
                                    }
                                    else if (detail.GOOUTTOMEET == "1")//如果是开会
                                    {
                                        TrListInfo.MEALSUBSIDIES = 0;
                                    }
                                    else
                                    {
                                        if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准
                                        {
                                            TrListInfo.MEALSUBSIDIES = decimal.Parse((Convert.ToDouble(entareaallowance.MEALSUBSIDIES) * toodays).ToString());
                                        }
                                        else
                                        {
                                            TrListInfo.MEALSUBSIDIES = 0;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (int.Parse(postLevel) <= 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准
                            {
                                TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                TrListInfo.MEALSUBSIDIES           = 0;
                            }
                        }
                    }
                    #endregion

                    #region 如果出差天数大于设定的最大天数,按驻外标准获取补贴
                    if (travelsolutions != null)
                    {
                        if (tresult > int.Parse(travelsolutions.MAXIMUMRANGEDAYS))
                        {
                            if (entareaallowance != null)
                            {
                                double DbTranceport  = Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES);
                                double DbMeal        = Convert.ToDouble(entareaallowance.MEALSUBSIDIES);
                                double tfSubsidies   = Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES) * (Convert.ToDouble(travelsolutions.INTERVALRATIO) / 100);
                                double mealSubsidies = Convert.ToDouble(entareaallowance.MEALSUBSIDIES) * (Convert.ToDouble(travelsolutions.INTERVALRATIO) / 100);

                                if (detail.BUSINESSDAYS != null)
                                {
                                    if (detail.PRIVATEAFFAIR == "1")//如果是私事不予报销
                                    {
                                        TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                    }
                                    else if (detail.GOOUTTOMEET == "1" || detail.COMPANYCAR == "1")//如果是开会或者是公司派车,交通费没有
                                    {
                                        TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                    }
                                    else
                                    {
                                        if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准
                                        {
                                            double minmoney    = Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) * DbTranceport;
                                            double middlemoney = (Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS) - Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS)) * tfSubsidies;
                                            double lastmoney   = (tresult - Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS)) * Convert.ToDouble(entareaallowance.OVERSEASSUBSIDIES);
                                            TrListInfo.TRANSPORTATIONSUBSIDIES = decimal.Parse((minmoney + middlemoney + lastmoney).ToString());
                                        }
                                        else
                                        {
                                            TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                        }
                                    }
                                }

                                if (detail.BUSINESSDAYS != null)
                                {
                                    if (detail.PRIVATEAFFAIR == "1")//如果是私事不予报销
                                    {
                                        TrListInfo.MEALSUBSIDIES = 0;
                                    }
                                    else if (detail.GOOUTTOMEET == "1")//如果是开会
                                    {
                                        TrListInfo.MEALSUBSIDIES = 0;
                                    }
                                    else
                                    {
                                        if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准
                                        {
                                            double minmoney    = Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) * DbMeal;
                                            double middlemoney = (Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS) - Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS)) * mealSubsidies;
                                            double lastmoney   = (tresult - Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS)) * Convert.ToDouble(entareaallowance.OVERSEASSUBSIDIES);
                                            TrListInfo.MEALSUBSIDIES = decimal.Parse((minmoney + middlemoney + lastmoney).ToString());
                                        }
                                        else
                                        {
                                            TrListInfo.MEALSUBSIDIES = 0;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (int.Parse(postLevel) <= 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准
                            {
                                TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                TrListInfo.MEALSUBSIDIES           = 0;
                            }
                        }
                    }
                    #endregion



                    #region 如果出差时间大于设定的最小天数并且小于设定的最大天数的报销标准
                    if (travelsolutions != null)
                    {
                        if (tresult >= Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) && tresult <= Convert.ToDouble(travelsolutions.MAXIMUMRANGEDAYS))
                        {
                            if (entareaallowance != null)
                            {
                                double DbTranceport  = Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES);
                                double DbMeal        = Convert.ToDouble(entareaallowance.MEALSUBSIDIES);
                                double tfSubsidies   = Convert.ToDouble(entareaallowance.TRANSPORTATIONSUBSIDIES) * (Convert.ToDouble(travelsolutions.INTERVALRATIO) / 100);
                                double mealSubsidies = Convert.ToDouble(entareaallowance.MEALSUBSIDIES) * (Convert.ToDouble(travelsolutions.INTERVALRATIO) / 100);

                                if (detail.BUSINESSDAYS != null)
                                {
                                    if (detail.PRIVATEAFFAIR == "1")//如果是私事不予报销
                                    {
                                        TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                    }
                                    else if (detail.GOOUTTOMEET == "1" || detail.COMPANYCAR == "1")//如果是开会或者是公司派车,交通费没有
                                    {
                                        TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                    }
                                    else
                                    {
                                        if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准
                                        {
                                            double minmoney    = Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) * DbTranceport;
                                            double middlemoney = (tresult - Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS)) * tfSubsidies;
                                            TrListInfo.TRANSPORTATIONSUBSIDIES = decimal.Parse((minmoney + middlemoney).ToString());
                                        }
                                        else
                                        {
                                            TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                        }
                                    }
                                }

                                if (detail.BUSINESSDAYS != null)
                                {
                                    if (detail.PRIVATEAFFAIR == "1")//如果是私事不予报销
                                    {
                                        TrListInfo.MEALSUBSIDIES = 0;
                                    }
                                    else if (detail.GOOUTTOMEET == "1")//如果是开会
                                    {
                                        TrListInfo.MEALSUBSIDIES = 0;
                                    }
                                    else
                                    {
                                        if (int.Parse(postLevel) > 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准
                                        {
                                            //最小区间段金额
                                            double minmoney = Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS) * DbMeal;
                                            //中间区间段金额
                                            double middlemoney = (tresult - Convert.ToDouble(travelsolutions.MINIMUMINTERVALDAYS)) * mealSubsidies;
                                            TrListInfo.MEALSUBSIDIES = decimal.Parse((minmoney + middlemoney).ToString());
                                        }
                                        else
                                        {
                                            TrListInfo.MEALSUBSIDIES = 0;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (int.Parse(postLevel) <= 8)//当前用户的岗位级别小于副部长及以上级别的补贴标准
                            {
                                TrListInfo.TRANSPORTATIONSUBSIDIES = 0;
                                TrListInfo.MEALSUBSIDIES           = 0;
                            }
                        }
                    }
                    total += Convert.ToDouble(TrListInfo.TRANSPORTATIONSUBSIDIES + TrListInfo.MEALSUBSIDIES);
                    entity.THETOTALCOST         = decimal.Parse(total.ToString()); //差旅费用总和
                    entity.REIMBURSEMENTOFCOSTS = decimal.Parse(total.ToString()); //报销费用总和

                    #endregion

                    TrDetail.Add(TrListInfo);
                }
                #endregion

                string result = BusinessDays.ToString(); //计算本次出差的总时间,超过24小时天数加1
                entity.COMPUTINGTIME = result;           //总时间

                //doc.TravelReimbursementAdd(entity, TrDetail);
                doc.TravelReimbursementAddSimple(entity, TrDetail, strBusinesStripId);


                return(null);//entity.TRAVELREIMBURSEMENTID;
            }
            catch (Exception e)
            {
                string abc = "<OA>Message=[" + e.Message + "]" + "<OA>Source=[" + e.Source + "]<OA>StackTrace=[" + e.StackTrace + "]<OA>TargetSite=[" + e.TargetSite + "]";
                Tracer.Debug(abc);
                return(abc);
            }
        }
Exemple #11
0
        private void InitFBControl(T_OA_TRAVELREIMBURSEMENT Travel)
        {
            if (OpenFrom == "FromMVC")
            {
                this.InitFB = true;
                return;                         //从mvc打卡,不使用预算科目
            }
            fbCtr.submitFBFormTypes = formType; //将FormType赋给FB
            if (formType == FormTypes.Resubmit)
            {
                fbCtr.submitFBFormTypes = FormTypes.Edit;
            }
            //fbCtr.SetRemarkVisiblity(Visibility.Collapsed);//隐藏预算控件中的备注
            fbCtr.SetApplyTypeVisiblity(Visibility.Collapsed);                                      //隐藏支付类型
            fbCtr.TravelSubject = new FrameworkUI.FBControls.TravelSubject();
            fbCtr.ApplyType     = FrameworkUI.FBControls.ChargeApplyControl.ApplyTypes.ChargeApply; //费用报销

            if (formType == FormTypes.New)
            {
                fbCtr.Order.ORDERID        = "";
                fbCtr.strExtOrderModelCode = "CCBX";
            }
            else
            {
                fbCtr.Order.ORDERID        = TravelReimbursement_Golbal.TRAVELREIMBURSEMENTID;//费用对象
                fbCtr.strExtOrderModelCode = "CCBX";
            }
            fbCtr.Order.CREATECOMPANYID      = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
            fbCtr.Order.CREATECOMPANYNAME    = Common.CurrentLoginUserInfo.UserPosts[0].CompanyName;
            fbCtr.Order.CREATEDEPARTMENTID   = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
            fbCtr.Order.CREATEDEPARTMENTNAME = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentName;
            fbCtr.Order.CREATEPOSTID         = Common.CurrentLoginUserInfo.UserPosts[0].PostID;
            fbCtr.Order.CREATEPOSTNAME       = Common.CurrentLoginUserInfo.UserPosts[0].PostName;
            fbCtr.Order.CREATEUSERID         = Common.CurrentLoginUserInfo.EmployeeID;
            fbCtr.Order.CREATEUSERNAME       = Common.CurrentLoginUserInfo.EmployeeName;
            if (Travel != null)                                               //新增获取出差报告的时候用的是报告人的信息
            {
                fbCtr.Order.OWNERCOMPANYID      = Travel.OWNERCOMPANYID;      //出差人所属公司ID
                fbCtr.Order.OWNERCOMPANYNAME    = Travel.OWNERCOMPANYNAME;    //出差人所属公司名称
                fbCtr.Order.OWNERDEPARTMENTID   = Travel.OWNERDEPARTMENTID;   //出差人所属部门ID
                fbCtr.Order.OWNERDEPARTMENTNAME = Travel.OWNERDEPARTMENTNAME; //出差人所属部门名称
                fbCtr.Order.OWNERPOSTID         = Travel.OWNERPOSTID;         //出差人所属工岗位ID
                fbCtr.Order.OWNERPOSTNAME       = Travel.OWNERPOSTNAME;       //出差人所属岗位名称
                fbCtr.Order.OWNERID             = Travel.OWNERID;             //出差人ID
                fbCtr.Order.OWNERNAME           = Travel.OWNERNAME;           //出差人姓名
            }
            else//修改、查看、审核的时候获取的是报销人的信息
            {
                MessageBox.Show("没有获取到出差报销人相关组织架构信息,请联系管理员!");
                return;
            }
            fbCtr.Order.UPDATEUSERID   = Common.CurrentLoginUserInfo.EmployeeID;
            fbCtr.Order.UPDATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName;

            if (formType == FormTypes.Audit || formType == FormTypes.Browse)
            {
                fbCtr.strExtOrderModelCode = "CCBX";
                fbCtr.InitData(false);
            }
            else
            {
                if (formType == FormTypes.New && Travel != null)
                {
                    fbCtr.InitData();
                    this.RefreshUI(RefreshedTypes.ShowProgressBar);
                }
                else if (formType == FormTypes.Edit || formType == FormTypes.Resubmit && Travel != null)
                {
                    fbCtr.InitData();
                    this.RefreshUI(RefreshedTypes.ShowProgressBar);
                }
            }
        }
 public string TravelReimbursementAddSimple(T_OA_TRAVELREIMBURSEMENT TravelReimbursement, List<T_OA_REIMBURSEMENTDETAIL> portDetail,string busnid)
 {
     using (TravelReimbursementBLL TrBll = new TravelReimbursementBLL())
     {
         string returnStr = "";
         if (!TrBll.TravelReimbursementAdd(TravelReimbursement, portDetail))
         {
             returnStr = "添加数据失败";
         }
         else
         {
             TrBll.DeleteTheSameTravelreimbursement(busnid);
         }
         return returnStr;
     }
 }
 public string TravelReimbursementAdd(T_OA_TRAVELREIMBURSEMENT TravelReimbursement, List<T_OA_REIMBURSEMENTDETAIL> portDetail)
 {
     using (TravelReimbursementBLL TrBll = new TravelReimbursementBLL())
     {
         string returnStr = "";
         if (!this.IsExistTravelReimbursementBySportid(TravelReimbursement.CLAIMSWERE, TravelReimbursement.T_OA_BUSINESSTRIP.BUSINESSTRIPID))
         {
             if (!this.IsExistTravelReimbursement(TravelReimbursement.CLAIMSWERE, TravelReimbursement.TRAVELREIMBURSEMENTID))
             {
                 if (!TrBll.TravelReimbursementAdd(TravelReimbursement, portDetail))
                 {
                     returnStr = "添加数据失败";
                 }
             }
             else
             {
                 returnStr = "出差报销已经存在,请勿重复添加";
             }
         }
         else
         {
             returnStr = "出差报销已经存在,请勿重复添加";
         }
         return returnStr;
     }
 }
        private string GetXmlString(T_OA_TRAVELREIMBURSEMENT Info, string StrSource)
        {
            string goouttomeet = string.Empty;
            string privateaffair = string.Empty;
            string companycar = string.Empty;
            string isagent = string.Empty;
            string path = string.Empty;
            string chargetype = string.Empty;
            string ExtTotal = "";
            if (fbCtr.ListDetail.Count() > 0)
            {
                decimal totalMoney = this.fbCtr.ListDetail.Sum(item =>
                {
                    return (item.Entity as T_FB_EXTENSIONORDERDETAIL).APPLIEDMONEY;
                });
                ExtTotal = totalMoney.ToString();
            }

            SMT.SaaS.MobileXml.MobileXml mx = new MobileXml.MobileXml();
            SMT.SaaS.MobileXml.AutoDictionary ad = new MobileXml.AutoDictionary();

            List<SMT.SaaS.MobileXml.AutoDictionary> AutoList = new List<SMT.SaaS.MobileXml.AutoDictionary>();
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "CHECKSTATE", TravelReimbursement_Golbal.CHECKSTATE, GetCheckState(TravelReimbursement_Golbal.CHECKSTATE)));//审核状态
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "BUSINESSTRIPID", businesstrID, string.Empty));//出差申请ID
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "AVAILABLECREDIT", UsableMoney, string.Empty));//可用额度
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "REIMBURSEMENTSTANDARDS", textStandards.Text, string.Empty));//报销标准
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "REIMBURSEMENTOFCOSTS", fbCtr.Order.TOTALMONEY.ToString(), string.Empty));//报销总计
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "POSTLEVEL", EmployeePostLevel, string.Empty));//出差人的岗位级别
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "CONTENT", TravelReimbursement_Golbal.CONTENT, TravelReimbursement_Golbal.CONTENT));//报告内容
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "REMARKS", TravelReimbursement_Golbal.REMARKS, string.Empty));//备注
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "PAYMENTINFO", fbCtr.Order.PAYMENTINFO, string.Empty));//支付信息
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "PAYTARGET", ExtTotal, string.Empty));//小计
            StrPayInfo = txtPAYMENTINFO.Text.ToString();
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "PAYMENTINFO", StrPayInfo, string.Empty));//支付信息 
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "TRAVLEAREAALLOWANCE", textStandards.Text, string.Empty));//报销标准
            AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "AttachMent", TravelReimbursement_Golbal.TRAVELREIMBURSEMENTID, TravelReimbursement_Golbal.TRAVELREIMBURSEMENTID));//附件

            if (!string.IsNullOrEmpty(TravelReimbursement_Golbal.NOBUDGETCLAIMS))//报销单号
            {
                AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "NOBUDGETCLAIMS", TravelReimbursement_Golbal.NOBUDGETCLAIMS, string.Empty));//报销单号
            }
            if (TravelReimbursement_Golbal.CLAIMSWERE != null && !string.IsNullOrEmpty(EmployeeName))//报销人
            {
                AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "CLAIMSWERE", TravelReimbursement_Golbal.CLAIMSWERE, EmployeeName + "-" + postName + "-" + depName + "-" + companyName));
            }
            if (TravelReimbursement_Golbal.OWNERID != null && !string.IsNullOrEmpty(EmployeeName))//所属人
            {
                AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "OWNERID", TravelReimbursement_Golbal.OWNERID, EmployeeName));
            }
            if (TravelReimbursement_Golbal.OWNERCOMPANYID != null && !string.IsNullOrEmpty(companyName))//所属公司
            {
                AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "OWNERCOMPANYID", TravelReimbursement_Golbal.OWNERCOMPANYID, companyName));
            }
            if (TravelReimbursement_Golbal.OWNERDEPARTMENTID != null && !string.IsNullOrEmpty(depName))//所属部门
            {
                AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "OWNERDEPARTMENTID", TravelReimbursement_Golbal.OWNERDEPARTMENTID, depName));
            }
            if (TravelReimbursement_Golbal.OWNERPOSTID != null && !string.IsNullOrEmpty(postName))//所属岗位
            {
                AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "OWNERPOSTID", TravelReimbursement_Golbal.OWNERPOSTID, postName));
            }
            foreach (T_OA_REIMBURSEMENTDETAIL objDetail in TravelDetailList_Golbal)//填充子表
            {
                if (objDetail.BUSINESSDAYS != null)//出差天数
                {
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "BUSINESSDAYS", objDetail.BUSINESSDAYS, objDetail.BUSINESSDAYS, objDetail.REIMBURSEMENTDETAILID));
                }
                if (objDetail.THENUMBEROFNIGHTS != null)//住宿天数
                {
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "THENUMBEROFNIGHTS", objDetail.THENUMBEROFNIGHTS, objDetail.THENUMBEROFNIGHTS, objDetail.REIMBURSEMENTDETAILID));
                }
                if (objDetail.DEPCITY != null)
                {
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "DEPCITY", objDetail.DEPCITY, SMT.SaaS.FrameworkUI.Common.Utility.GetCityName(objDetail.DEPCITY), objDetail.REIMBURSEMENTDETAILID));
                }
                if (objDetail.DESTCITY != null)
                {
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "DESTCITY", objDetail.DESTCITY, SMT.SaaS.FrameworkUI.Common.Utility.GetCityName(objDetail.DESTCITY), objDetail.REIMBURSEMENTDETAILID));
                }
                if (TravelReimbursement_Golbal.CREATEUSERID != null)//创建人
                {
                    AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "OWNERID", TravelReimbursement_Golbal.CREATEUSERID, Common.CurrentLoginUserInfo.EmployeeName, objDetail.REIMBURSEMENTDETAILID));
                }
                if (TravelReimbursement_Golbal.UPDATEUSERID != null)//修改人
                {
                    AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "OWNERID", TravelReimbursement_Golbal.UPDATEUSERID, Common.CurrentLoginUserInfo.EmployeeName, objDetail.REIMBURSEMENTDETAILID));
                }
                if (objDetail.OTHERCOSTS != null)
                {
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "OTHERCOSTS", objDetail.OTHERCOSTS.ToString(), string.Empty, objDetail.REIMBURSEMENTDETAILID));
                }
                else //如果没有其他费用就传空值给Xml
                {
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "OTHERCOSTS", string.Empty, string.Empty, objDetail.REIMBURSEMENTDETAILID));
                }
                if (objDetail.PRIVATEAFFAIR != null)
                {
                    if (objDetail.PRIVATEAFFAIR == "0")//是否私事
                    {
                        privateaffair = "否";
                    }
                    else
                    {
                        privateaffair = "是";
                    }
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "PRIVATEAFFAIR", objDetail.PRIVATEAFFAIR, privateaffair, objDetail.REIMBURSEMENTDETAILID));
                }
                if (objDetail.GOOUTTOMEET != null)
                {
                    if (objDetail.GOOUTTOMEET == "0")//内部会议\培训
                    {
                        goouttomeet = "否";
                    }
                    else
                    {
                        goouttomeet = "是";
                    }
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "GOOUTTOMEET", objDetail.GOOUTTOMEET, goouttomeet, objDetail.REIMBURSEMENTDETAILID));
                }
                if (objDetail.COMPANYCAR != null)
                {
                    if (objDetail.COMPANYCAR == "0")//是否是公司派车
                    {
                        companycar = "否";
                    }
                    else
                    {
                        companycar = "是";
                    }
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "COMPANYCAR", objDetail.COMPANYCAR, companycar, objDetail.REIMBURSEMENTDETAILID));
                }
                if (objDetail.TYPEOFTRAVELTOOLS != null)
                {
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "TYPEOFTRAVELTOOLS", objDetail.TYPEOFTRAVELTOOLS, GetTypeName(objDetail.TYPEOFTRAVELTOOLS), objDetail.REIMBURSEMENTDETAILID));
                }
                if (objDetail.TAKETHETOOLLEVEL != null)
                {
                    AutoList.Add(basedata("T_OA_REIMBURSEMENTDETAIL", "TAKETHETOOLLEVEL", objDetail.TAKETHETOOLLEVEL, GetLevelName(objDetail.TAKETHETOOLLEVEL, GetTypeId(objDetail.TYPEOFTRAVELTOOLS)), objDetail.REIMBURSEMENTDETAILID));
                }
            }
            ObservableCollection<Object> TrListObj = new ObservableCollection<Object>();
            foreach (var item in TravelDetailList_Golbal)
            {
                TrListObj.Add(item);
            }

            if (fbCtr.ListDetail.Count > 0)//获取算控件中的数据
            {
                //SMT.Saas.Tools.FBServiceWS.T_FB_EXTENSIONALORDER entext = fbCtr
                //fbCtr.Order.REMARK
                string StrType = "";
                if (fbCtr.Order.REMARK != null)
                {
                    AutoList.Add(basedata("T_FB_EXTENSIONORDERDETAIL", "FBREMARK", fbCtr.Order.REMARK, fbCtr.Order.REMARK, fbCtr.Order.EXTENSIONALORDERID));//科目报销备注

                    AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "FBREMARK", fbCtr.Order.REMARK, fbCtr.Order.REMARK));//科目报销备注,同时加入主表
                }
                if (fbCtr.Order.APPLYTYPE == 1)
                {
                    StrType = "个人费用报销";
                }
                if (fbCtr.Order.APPLYTYPE == 2)
                {
                    StrType = "冲借款";
                }
                if (!string.IsNullOrEmpty(StrType))
                {
                    AutoList.Add(basedata("T_FB_EXTENSIONORDERDETAIL", "EXTENSIONTYPE", StrType, StrType, fbCtr.Order.EXTENSIONALORDERID));//科目报销备注
                    AutoList.Add(basedata("T_OA_TRAVELREIMBURSEMENT", "EXTENSIONTYPE", StrType, StrType));//科目报销备注,同时加入主表
                }
                foreach (FBEntity item in fbCtr.ListDetail)//预算费用报销明细
                {
                    SMT.Saas.Tools.FBServiceWS.T_FB_EXTENSIONORDERDETAIL entTemp = item.Entity as SMT.Saas.Tools.FBServiceWS.T_FB_EXTENSIONORDERDETAIL;

                    TrListObj.Add(entTemp);

                    if (entTemp.CHARGETYPE != null)
                    {
                        if (entTemp.CHARGETYPE.ToString() == "1")
                        {
                            chargetype = "个人预算费用";
                        }
                        else
                        {
                            chargetype = "部门预算费用";
                        }
                        AutoList.Add(basedata("T_FB_EXTENSIONORDERDETAIL", "CHARGETYPE", entTemp.CHARGETYPE.ToString(), chargetype, entTemp.EXTENSIONORDERDETAILID));//费用类型
                    }
                    AutoList.Add(basedata("T_FB_EXTENSIONORDERDETAIL", "SUBJECTCODE", entTemp.T_FB_SUBJECT.SUBJECTCODE, entTemp.T_FB_SUBJECT.SUBJECTCODE, entTemp.EXTENSIONORDERDETAILID));//科目编号
                    AutoList.Add(basedata("T_FB_EXTENSIONORDERDETAIL", "SUBJECTNAME", entTemp.T_FB_SUBJECT.SUBJECTNAME, entTemp.T_FB_SUBJECT.SUBJECTNAME, entTemp.EXTENSIONORDERDETAILID));//科目名称
                    AutoList.Add(basedata("T_FB_EXTENSIONORDERDETAIL", "USABLEMONEY", entTemp.USABLEMONEY.ToString(), entTemp.USABLEMONEY.ToString(), entTemp.EXTENSIONORDERDETAILID));//可用金额
                    AutoList.Add(basedata("T_FB_EXTENSIONORDERDETAIL", "REMARK", entTemp.REMARK, entTemp.REMARK, entTemp.EXTENSIONORDERDETAILID));//摘要
                    AutoList.Add(basedata("T_FB_EXTENSIONORDERDETAIL", "APPLIEDMONEY", entTemp.APPLIEDMONEY.ToString(), entTemp.APPLIEDMONEY.ToString(), entTemp.EXTENSIONORDERDETAILID));//申领金额
                }
            }
            //冲借款明细

            if (fbCtr.ListBorrowDetail.Count() > 0)
            {

                foreach (T_FB_CHARGEAPPLYREPAYDETAIL item in fbCtr.ListBorrowDetail)//预算费用报销明细
                {
                    TrListObj.Add(item);

                    if (item.REPAYTYPE != null)
                    {
                        switch (item.REPAYTYPE.ToString())
                        {
                            case "1":
                                chargetype = "现金还普通借款";
                                break;
                            case "2":
                                chargetype = "现金还备用金借款";
                                break;
                            case "3":
                                chargetype = "现金还专项借款";
                                break;

                        }
                        AutoList.Add(basedata("T_FB_CHARGEAPPLYREPAYDETAIL", "CHARGETYPE", item.REPAYTYPE.ToString(), chargetype, item.CHARGEAPPLYREPAYDETAILID));//费用类型
                    }
                    if (item.BORROWMONEY != null)
                    {
                        AutoList.Add(basedata("T_FB_CHARGEAPPLYREPAYDETAIL", "BORROWMONEY", item.BORROWMONEY.ToString(), item.BORROWMONEY.ToString(), item.CHARGEAPPLYREPAYDETAILID));//科目编号
                    }

                    AutoList.Add(basedata("T_FB_CHARGEAPPLYREPAYDETAIL", "REMARK", item.REMARK, item.REMARK, item.CHARGEAPPLYREPAYDETAILID));//摘要
                    if (item.REPAYMONEY != null)
                    {
                        AutoList.Add(basedata("T_FB_CHARGEAPPLYREPAYDETAIL", "REPAYMONEY", item.REPAYMONEY.ToString(), item.REPAYMONEY.ToString(), item.CHARGEAPPLYREPAYDETAILID));//申领金额
                    }
                }
            }
            //string a = mx.TableToXml(Info, TrListObj, StrSource, AutoList);
            string a = mx.TableToXmlForTravel(Info, TrListObj, StrSource, AutoList);

            return a;
        }
        private void InitFBControl(T_OA_TRAVELREIMBURSEMENT Travel, bool isFromWP)
        {
            if (OpenFrom == "FromMVC")
            {
                this.InitFB = true;
                return;//从mvc打卡,不使用预算科目
            }
            if (isFromWP)
            {
                fbCtr.FromFB = false;
                fbCtr.strBussinessTripID = Travel.T_OA_BUSINESSTRIP.BUSINESSTRIPID;
            }
            fbCtr.submitFBFormTypes = formType;//将FormType赋给FB
            if (formType == FormTypes.Resubmit)
            {
                fbCtr.submitFBFormTypes = FormTypes.Edit;
            }
            //fbCtr.SetRemarkVisiblity(Visibility.Collapsed);//隐藏预算控件中的备注
            //fbCtr.SetApplyTypeVisiblity(Visibility.Collapsed);//隐藏支付类型
            fbCtr.TravelSubject = new FrameworkUI.FBControls.TravelSubject();
            fbCtr.ApplyType = FrameworkUI.FBControls.ChargeApplyControl.ApplyTypes.ChargeApply;//费用报销

            if (formType == FormTypes.New)
            {
                fbCtr.ExtensionalOrder.ORDERID = "";
                fbCtr.strExtOrderModelCode = "CCBX";
            }
            else
            {
                fbCtr.ExtensionalOrder.ORDERID = TravelReimbursement_Golbal.TRAVELREIMBURSEMENTID;//费用对象
                fbCtr.strExtOrderModelCode = "CCBX";
            }
            fbCtr.ExtensionalOrder.CREATECOMPANYID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
            fbCtr.ExtensionalOrder.CREATECOMPANYNAME = Common.CurrentLoginUserInfo.UserPosts[0].CompanyName;
            fbCtr.ExtensionalOrder.CREATEDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
            fbCtr.ExtensionalOrder.CREATEDEPARTMENTNAME = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentName;
            fbCtr.ExtensionalOrder.CREATEPOSTID = Common.CurrentLoginUserInfo.UserPosts[0].PostID;
            fbCtr.ExtensionalOrder.CREATEPOSTNAME = Common.CurrentLoginUserInfo.UserPosts[0].PostName;
            fbCtr.ExtensionalOrder.CREATEUSERID = Common.CurrentLoginUserInfo.EmployeeID;
            fbCtr.ExtensionalOrder.CREATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName;
            if (Travel != null)//新增获取出差报告的时候用的是报告人的信息
            {
                fbCtr.ExtensionalOrder.OWNERCOMPANYID = Travel.OWNERCOMPANYID;//出差人所属公司ID
                fbCtr.ExtensionalOrder.OWNERCOMPANYNAME = Travel.OWNERCOMPANYNAME;//出差人所属公司名称
                fbCtr.ExtensionalOrder.OWNERDEPARTMENTID = Travel.OWNERDEPARTMENTID;//出差人所属部门ID
                fbCtr.ExtensionalOrder.OWNERDEPARTMENTNAME = Travel.OWNERDEPARTMENTNAME;//出差人所属部门名称
                fbCtr.ExtensionalOrder.OWNERPOSTID = Travel.OWNERPOSTID;//出差人所属工岗位ID
                fbCtr.ExtensionalOrder.OWNERPOSTNAME = Travel.OWNERPOSTNAME;//出差人所属岗位名称
                fbCtr.ExtensionalOrder.OWNERID = Travel.OWNERID;//出差人ID
                fbCtr.ExtensionalOrder.OWNERNAME = Travel.OWNERNAME;//出差人姓名
            }
            else//修改、查看、审核的时候获取的是报销人的信息
            {
                MessageBox.Show("没有获取到出差报销人相关组织架构信息,请联系管理员!");
                return;
            }
            fbCtr.ExtensionalOrder.UPDATEUSERID = Common.CurrentLoginUserInfo.EmployeeID;
            fbCtr.ExtensionalOrder.UPDATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName;

            if (formType == FormTypes.Audit || formType == FormTypes.Browse)
            {
                fbCtr.strExtOrderModelCode = "CCBX";
                fbCtr.QueryTravelSubjectData(false);
            }
            else
            {
                if (formType == FormTypes.New && Travel != null)
                {
                    fbCtr.InitData();
                    this.RefreshUI(RefreshedTypes.ShowProgressBar);
                }
                else if (formType == FormTypes.Edit || formType == FormTypes.Resubmit && Travel != null)
                {
                    fbCtr.InitData(); 
                    this.RefreshUI(RefreshedTypes.ShowProgressBar);
                }
            }
        }