Exemplo n.º 1
0
        /// <summary>
        /// 获取出差单
        /// </summary>
        /// <param name="b_Employee"></param>
        /// <returns></returns>
        public JsonResult GetTravelRecordNo(string b_Employee = "")
        {
            var retModel = new JsonReturnModel();

            try
            {
                List <BusinessTravelModel> returnList = new List <BusinessTravelModel>();
                List <B_BUSINESSTRAVEL>    list       = BusinessTravelDA.GetBusinessTravelByEmployee(b_Employee);
                foreach (var item in list)
                {
                    BusinessTravelModel model = new BusinessTravelModel();
                    model.b_DocumentNo      = item.B_DOCUMENTNO;
                    model.b_ApplicationDate = item.B_APPLICATIONDATE.GetValueOrDefault().ToString("yyyy-MM-dd");
                    model.b_Type            = item.B_TYPE;
                    model.b_ProjectName     = string.IsNullOrEmpty(item.B_PROJECTNAME) ? "" : item.B_PROJECTNAME;
                    model.b_Destination     = item.B_DESTINATION;
                    returnList.Add(model);
                }
                retModel.data = returnList;
            }
            catch (Exception ex)
            {
                retModel.AddError("errorMessage", ex.Message);
            }
            return(Json(retModel, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 导出凭证清单
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        private Stream ExportBusinessTravelByData(List <BusinessTravelModel> dataList)
        {
            HSSFWorkbook workbook = new HSSFWorkbook();

            ISheet sheet = workbook.CreateSheet();
            // 设置字体
            IFont headfont = workbook.CreateFont();

            headfont.FontName = "微软雅黑";

            // 建表头
            IRow row = sheet.CreateRow(0);

            row.CreateCell(0).CellStyle.SetFont(headfont);
            row.CreateCell(0).SetCellValue("单号");
            row.CreateCell(1).SetCellValue("申请日期");
            row.CreateCell(2).SetCellValue("申请部门");
            row.CreateCell(3).SetCellValue("申请人");
            row.CreateCell(4).SetCellValue("项目名称");
            row.CreateCell(5).SetCellValue("目的地");
            row.CreateCell(6).SetCellValue("流程状态");

            dataList = dataList.OrderByDescending(x => x.b_DocumentNo).ToList();
            for (var i = 0; i < dataList.Count; i++)
            {
                BusinessTravelModel model = dataList[i];
                IRow rowItem = sheet.CreateRow(i + 1);
                rowItem.CreateCell(0).SetCellValue(model.b_DocumentNo);
                rowItem.CreateCell(1).SetCellValue(model.nb_ApplicationDate.ToString());
                rowItem.CreateCell(2).SetCellValue(model.b_Dept);
                rowItem.CreateCell(3).SetCellValue(model.b_Employee);
                rowItem.CreateCell(4).SetCellValue(model.b_ProjectName);
                rowItem.CreateCell(5).SetCellValue(model.b_Destination);
                model.status = Common.GetStatus(model.Id);
                model.status = Common.GetChineseValueByParam(model.status, "BTManageWorkFlow", "WorkFlow");
                rowItem.CreateCell(6).SetCellValue(model.status);
            }
            MemoryStream ms = new MemoryStream();

            workbook.Write(ms);
            ms.Seek(0, SeekOrigin.Begin);
            return(ms);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 打印
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ViewResult Print(string id)
        {
            Item result = BusinessTravelBll.GetBusinessTravelObjById(inn, id);
            BusinessTravelModel model = new BusinessTravelModel();

            model.Id                    = result.getProperty("id");
            model.b_DocumentNo          = result.getProperty("b_documentno");
            model.b_CompanyCode         = result.getProperty("b_companycode");
            model.b_Location            = result.getProperty("b_location");
            model.b_ApplicationDate     = DateTime.Parse(result.getProperty("b_applicationdate")).ToString("yyyy-MM-dd");
            model.b_TripType            = result.getProperty("b_triptype");
            model.b_Type                = result.getProperty("b_type");
            model.b_Preparer            = result.getProperty("b_preparer");
            model.b_Employee            = result.getProperty("b_employee");
            model.b_StaffNo             = result.getProperty("b_staffno");
            model.b_Position            = result.getProperty("b_position");
            model.b_Dept                = result.getProperty("b_dept");
            model.b_CostCenter          = result.getProperty("b_costcenter");
            model.b_Mobile              = result.getProperty("b_mobile");
            model.b_ProjectName         = result.getProperty("b_projectname");
            model.b_Destination         = result.getProperty("b_destination");
            model.b_SeniorManager       = result.getProperty("b_seniormanager");
            model.b_Director            = result.getProperty("b_director");
            model.b_VP                  = result.getProperty("b_vp");
            model.b_TravelDate          = DateTime.Parse(result.getProperty("b_traveldate")).ToString("yyyy-MM-dd");
            model.b_EstimatedReturnDate = DateTime.Parse(result.getProperty("b_estimatedreturndate")).ToString("yyyy-MM-dd");
            model.b_Purpose             = result.getProperty("b_purpose");
            model.b_TravelSchedule      = result.getProperty("b_travelschedule");
            model.b_TravelBudget        = !string.IsNullOrEmpty(result.getProperty("b_travelbudget")) ? decimal.Parse(result.getProperty("b_travelbudget")) : 0;
            model.b_FlightIsssue        = result.getProperty("b_flightisssue");
            model.b_FlightBooking       = result.getProperty("b_flightbooking");
            model.b_HotelBooking        = result.getProperty("b_hotelbooking");
            model.b_Didi                = result.getProperty("b_didi");
            model.b_Others              = result.getProperty("b_others");
            model.b_OtherContent        = result.getProperty("b_othercontent");
            model.b_IsHangUp            = result.getProperty("b_ishangup") == "1" ? true : false;
            model.b_HangUpActivityName  = result.getProperty("b_hangupactivityname");
            model.OldRemark             = result.getProperty("b_remark");
            model.b_TrafficExpense      = !string.IsNullOrEmpty(result.getProperty("b_trafficexpense")) ? decimal.Parse(result.getProperty("b_trafficexpense")) : 0;
            model.b_HotelExpense        = !string.IsNullOrEmpty(result.getProperty("b_hotelexpense")) ? decimal.Parse(result.getProperty("b_hotelexpense")) : 0;
            model.b_FixedSubsidy        = !string.IsNullOrEmpty(result.getProperty("b_fixedsubsidy")) ? decimal.Parse(result.getProperty("b_fixedsubsidy")) : 0;
            model.b_OtherExpenses       = !string.IsNullOrEmpty(result.getProperty("b_otherexpenses")) ? decimal.Parse(result.getProperty("b_otherexpenses")) : 0;
            model.b_DidiMoney           = !string.IsNullOrEmpty(result.getProperty("b_didimoney")) ? decimal.Parse(result.getProperty("b_didimoney")) : 0;
            model.b_DidiAddMoney        = !string.IsNullOrEmpty(result.getProperty("b_didiaddmoney")) ? decimal.Parse(result.getProperty("b_didiaddmoney")) : 0;

            //机票代订
            Item Relation = result.getRelationships("R_FlightBooking");

            if (Relation.getItemCount() > 0)
            {
                model.FlightBookingItems = new List <FlightBooking>();
                for (int i = 0; i < Relation.getItemCount(); i++)
                {
                    Item          ItemObJ   = Relation.getItemByIndex(i).getRelatedItem();
                    FlightBooking itemModel = new FlightBooking();
                    itemModel.Id                 = ItemObJ.getProperty("id");
                    itemModel.b_FirstName        = ItemObJ.getProperty("b_firstname");
                    itemModel.b_LastName         = ItemObJ.getProperty("b_lastname");
                    itemModel.b_IDType           = ItemObJ.getProperty("b_idtype");
                    itemModel.b_IDCardNo         = ItemObJ.getProperty("b_idcardno");
                    itemModel.b_Nationality      = ItemObJ.getProperty("b_nationality");
                    itemModel.b_PassportNumber   = ItemObJ.getProperty("b_passportnumber");
                    itemModel.b_Dateofexpiration = !string.IsNullOrEmpty(ItemObJ.getProperty("b_dateofexpiration")) ? DateTime.Parse(ItemObJ.getProperty("b_dateofexpiration")).ToString("yyyy-MM-dd") : "";
                    itemModel.b_Dateofbirth      = ItemObJ.getProperty("b_dateofbirth");
                    itemModel.b_Address          = ItemObJ.getProperty("b_address");
                    itemModel.b_Gooff            = ItemObJ.getProperty("b_gooff");
                    itemModel.b_Goplace          = ItemObJ.getProperty("b_goplace");
                    itemModel.b_Flightnumber     = ItemObJ.getProperty("b_flightnumber");
                    model.FlightBookingItems.Add(itemModel);
                }
            }

            //酒店代订
            Item HotelRelation = result.getRelationships("R_HotelBooking");

            if (HotelRelation.getItemCount() > 0)
            {
                model.HotelBookingItems = new List <HotelBooking>();
                for (int i = 0; i < HotelRelation.getItemCount(); i++)
                {
                    Item         ItemObJ  = HotelRelation.getItemByIndex(i).getRelatedItem();
                    HotelBooking itemHote = new HotelBooking();
                    itemHote.Id                = ItemObJ.getProperty("id");
                    itemHote.b_Checkindate     = !string.IsNullOrEmpty(ItemObJ.getProperty("b_checkindate")) ? DateTime.Parse(ItemObJ.getProperty("b_checkindate")).ToString("yyyy-MM-dd") : "";
                    itemHote.b_Leavedate       = !string.IsNullOrEmpty(ItemObJ.getProperty("b_leavedate")) ? DateTime.Parse(ItemObJ.getProperty("b_leavedate")).ToString("yyyy-MM-dd") : "";
                    itemHote.b_Specificaddress = ItemObJ.getProperty("b_specificaddress");
                    model.HotelBookingItems.Add(itemHote);
                }
            }

            //日志信息
            model.HistoryList = GetBusinessTravelHistoryList(id);
            foreach (var item in model.HistoryList)
            {
                item.Created_on = item.Create_onStr.GetValueOrDefault().ToString("yyyy-MM-dd HH:mm:ss");
            }
            return(View("~/Views/BusinessTravel/PrintBusinessTravel.cshtml", model));
        }