Beispiel #1
0
        /// <summary>
        /// 根据ID 集合获取相应的服务信息
        /// </summary>
        public void GetServicesByIds(HttpContext context)
        {
            var serviceIds = context.Request.QueryString["ids"];

            if (!string.IsNullOrEmpty(serviceIds))
            {
                var serList = new ivt_service_dal().GetServiceList($" and id in({serviceIds})");
                if (serList != null && serList.Count > 0)
                {
                    List <ServiceDto> serDtoList = new List <ServiceDto>();
                    var accBll = new CompanyBLL();
                    var dDal   = new d_general_dal();
                    var dccDal = new d_cost_code_dal();
                    serList.ForEach(_ => {
                        var thisDto = new ServiceDto()
                        {
                            id             = _.id,
                            name           = _.name,
                            description    = _.description,
                            unit_cost      = (_.unit_cost ?? 0),
                            unit_price     = (_.unit_price ?? 0),
                            cost_code_id   = _.cost_code_id,
                            period_type_id = _.period_type_id,
                            vendor_id      = _.vendor_account_id,
                        };
                        if (_.vendor_account_id != null)
                        {
                            var thisVendor = accBll.GetCompany((long)_.vendor_account_id);
                            if (thisVendor != null)
                            {
                                thisDto.vendor_name = thisVendor.name;
                            }
                        }
                        if (_.period_type_id != null)
                        {
                            var thisType = dDal.FindNoDeleteById((long)_.period_type_id);
                            if (thisType != null)
                            {
                                thisDto.period_type_name = thisType.name;
                            }
                        }
                        var thisCode = dccDal.FindNoDeleteById(_.cost_code_id);
                        if (thisCode != null)
                        {
                            thisDto.cost_code_name = thisCode.name;
                        }
                        serDtoList.Add(thisDto);
                    });

                    context.Response.Write(new EMT.Tools.Serialize().SerializeJson(serDtoList));
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 根据 物料代码Id 和 角色ID返回相关费率
        /// </summary>
        public decimal?GetRateByCodeAndRole(long cost_code_id, long role_id)
        {
            decimal?rate         = null;
            var     dccDal       = new d_cost_code_dal();
            var     srDal        = new sys_role_dal();
            var     thisCostCode = dccDal.FindNoDeleteById(cost_code_id);
            var     thisRole     = srDal.FindNoDeleteById(role_id);

            if (thisCostCode != null && thisRole != null)
            {
                switch (thisCostCode.billing_method_id)
                {
                case (int)DicEnum.WORKTYPE_BILLING_METHOD.USE_ROLE_RATE:
                    rate = thisRole.hourly_rate;
                    break;

                case (int)DicEnum.WORKTYPE_BILLING_METHOD.FLOAT_ROLE_RATE:
                    if (thisCostCode.rate_adjustment != null)
                    {
                        rate = (thisRole.hourly_rate + thisCostCode.rate_adjustment);
                    }
                    break;

                case (int)DicEnum.WORKTYPE_BILLING_METHOD.RIDE_ROLE_RATE:
                    if (thisCostCode.rate_multiplier != null)
                    {
                        rate = (thisRole.hourly_rate * thisCostCode.rate_multiplier);
                    }
                    break;

                case (int)DicEnum.WORKTYPE_BILLING_METHOD.USE_UDF_ROLE_RATE:
                    if (thisCostCode.custom_rate != null)
                    {
                        rate = thisCostCode.custom_rate;
                    }
                    break;

                case (int)DicEnum.WORKTYPE_BILLING_METHOD.BY_TIMES:
                    if (thisCostCode.flat_rate != null)
                    {
                        rate = thisCostCode.flat_rate;
                    }
                    break;

                default:
                    break;
                }
            }
            return(rate);
        }
Beispiel #3
0
 /// <summary>
 /// 根据id获取相关代码
 /// </summary>
 public d_cost_code GetCodeById(long id)
 {
     return(_dal.FindNoDeleteById(id));
 }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var eid = Request.QueryString["id"];
                thisReport = new sdk_expense_report_dal().FindNoDeleteById(long.Parse(eid));
                if (thisReport != null)
                {
                    creRes = new sys_resource_dal().FindNoDeleteById(thisReport.create_user_id);
                    if (thisReport.submit_user_id != null)
                    {
                        subRes = new sys_resource_dal().FindNoDeleteById((long)thisReport.submit_user_id);
                    }
                    var chooseDateString = Request.QueryString["startDate"];
                    if (!string.IsNullOrEmpty(chooseDateString))
                    {
                        chooseStartDate = GetMonday(DateTime.Parse(chooseDateString));
                    }
                    var allExpList = new sdk_expense_dal().GetExpByReport(thisReport.id);
                    if (allExpList != null && allExpList.Count > 0)
                    {
                        if (chooseStartDate != null)
                        {
                            expList = allExpList.Where(_ => _.add_date >= chooseStartDate && _.add_date <= ((DateTime)chooseStartDate).AddDays(6)).ToList();
                        }
                    }
                    #region 完善日期下拉框信息
                    GetSelect();  // 获取日期下拉框
                    var choese = dateList.FirstOrDefault(_ => _.select == 1);
                    if (choese == null)
                    {
                        dateList.Add(new DictionaryEntryDto()
                        {
                            select = 1, show = "选择日期", val = ""
                        });
                    }
                    else
                    {
                        dateList.Add(new DictionaryEntryDto()
                        {
                            show = "选择日期", val = ""
                        });
                    }
                    dateList = dateList.OrderBy(_ => _.val).ToList();
                    #endregion

                    if (expList != null && expList.Count > 0)
                    {
                        var dccDal = new d_cost_code_dal();
                        // 获取到招待相关的费用
                        entertainList = expList.Where(_ =>
                        {
                            if (_.cost_code_id != null)
                            {
                                var thisCost = dccDal.FindNoDeleteById((long)_.cost_code_id);
                                if (thisCost != null && thisCost.expense_type_id == (int)DicEnum.EXPENSE_TYPE.ENTERTAINMENT_EXPENSES)
                                {
                                    return(true);
                                }
                            }
                            return(false);
                        }).ToList();

                        if (entertainList != null && entertainList.Count > 0)
                        {
                            noEntertainList = expList.Where(_ => !entertainList.Any(el => el.id == _.id)).ToList();
                        }
                        else
                        {
                            noEntertainList = expList;
                        }
                    }
                }
                else
                {
                    Response.Write($"<script>alerl('未查询到相关报表,请刷新页面后重试!');window.close();</script>");
                }
            }
            catch (Exception msg)
            {
                Response.Write($"<script>alerl('{msg.Message}');</script>");
            }
        }