Example #1
0
        /// <summary>
        /// 管理员重新发送凭证邮件
        /// </summary>
        /// <param name="Id"></param>
        public JsonResult ExpenseAccountantCheckSendEmail(string Id)
        {
            var retModel = new JsonReturnModel();

            try
            {
                var expenseTripReimbursement = inn.newItem("b_TripReimbursementForm", "get");
                expenseTripReimbursement.setAttribute("id", Id);
                var result = expenseTripReimbursement.apply();
                if (!result.isError())
                {
                    string b_RecordNo = result.getProperty("b_recordno");
                    string b_Employee = result.getProperty("b_employee");
                    if (!string.IsNullOrEmpty(b_RecordNo) && !string.IsNullOrEmpty(b_Employee))
                    {
                        TripReimbursementBll.ExpenseAccountantCheckSendEmail(inn, b_Employee, b_RecordNo);
                    }
                }
            }
            catch (Exception ex)
            {
                retModel.AddError("errorMessage", ex.Message);
            }
            return(Json(retModel, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        /// <summary>
        /// 导出凭证清单
        /// </summary>
        /// <param name="searchValue"></param>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public FileResult ExportTripReimbursementByCondition(string searchValue, DateTime?startTime, DateTime?endTime, string status)
        {
            List <ApiExpenseReimbursementEntity> list = new List <ApiExpenseReimbursementEntity>();
            int total    = 0;
            var dataList = GetSearchTripReimbursementList(inn, Userinfo.Roles, out total, null, startTime, endTime, searchValue, status, Userinfo.UserName);

            if (dataList != null)
            {
                foreach (var item in dataList)
                {
                    if (string.IsNullOrEmpty(item.status))
                    {
                        item.status = "End";
                    }

                    if (item.status == "Expense Accountant Creation" || item.status == "End")
                    {
                        List <ApiExpenseReimbursementEntity> datas = TripReimbursementBll.SendTripReimbursementCreation(inn, item.id);
                        if (datas != null)
                        {
                            List <ApiExpenseReimbursementEntity> newApiEntity = new List <ApiExpenseReimbursementEntity>();
                            foreach (var data in datas)
                            {
                                if (data.b_TaxRate > 0)
                                {
                                    int             rateInt         = int.Parse((data.b_TaxRate.Value * double.Parse("100")).ToString());
                                    TaxCodeTypeList?obj             = EnumDescription.GetEnumByValue <TaxCodeTypeList>(rateInt);
                                    string          textDescription = EnumDescription.GetFieldText(obj);
                                    //根据描述获取对应的科目
                                    string subject = TaxCodeConfigureBll.GeTaxCodeConfigureByText(textDescription);

                                    data.DMBTR = data.b_TaxFreeAmount;
                                    ApiExpenseReimbursementEntity entity = new ApiExpenseReimbursementEntity();
                                    entity.BUKRS  = data.BUKRS;
                                    entity.XBLNR  = data.XBLNR;
                                    entity.BLDAT  = data.BLDAT;
                                    entity.BUDAT  = data.BUDAT;
                                    entity.BKTXT  = data.BKTXT;
                                    entity.NUMPG  = data.NUMPG;
                                    entity.PROTYP = data.PROTYP;
                                    entity.POSID  = data.POSID;
                                    entity.HKONT  = subject;
                                    entity.DMBTR  = data.b_Tax;
                                    entity.KOSTL  = "";
                                    entity.SGTXT  = data.SGTXT;
                                    entity.AUFNR  = data.AUFNR;
                                    newApiEntity.Add(data);
                                    newApiEntity.Add(entity);
                                }
                                else
                                {
                                    newApiEntity.Add(data);
                                }
                            }

                            //计算合计金额
                            ApiExpenseReimbursementEntity totalEntity = new ApiExpenseReimbursementEntity();
                            totalEntity.BUKRS = newApiEntity.First().BUKRS;
                            totalEntity.XBLNR = newApiEntity.First().XBLNR;
                            totalEntity.BLDAT = newApiEntity.First().BLDAT;
                            totalEntity.BUDAT = newApiEntity.First().BUDAT;
                            totalEntity.BKTXT = newApiEntity.First().b_StaffNo;
                            totalEntity.HKONT = "2241999999";
                            totalEntity.DMBTR = newApiEntity.Select(x => x.DMBTR).Sum();
                            newApiEntity.Add(totalEntity);
                            list.AddRange(newApiEntity);
                        }
                    }
                }
            }

            Stream ms = ExportTripReimbursementByData(list);

            return(File(ms, "application/vnd.ms-excel", "凭证清单" + ".xls"));
        }
Example #3
0
        /// <summary>
        /// 打印
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ViewResult Print(string id)
        {
            Item result = TripReimbursementBll.GetTripReimbursementObjById(inn, id);
            TripReimbursementModel model = new TripReimbursementModel();

            model.id                   = result.getProperty("id");
            model.b_RecordNo           = result.getProperty("b_recordno");
            model.b_CompanyCode        = result.getProperty("b_companycode");
            model.b_ReimbursementPlace = result.getProperty("b_reimbursementplace");
            model.b_IsBudgetary        = result.getProperty("b_isbudgetary") == "1" ? true : false;
            model.b_BudgetNumber       = result.getProperty("b_budgetnumber");
            model.b_Type               = result.getProperty("b_type");
            model.b_ApplicationDate    = DateTime.Parse(result.getProperty("b_applicationdate")).ToString("yyyy-MM-dd");
            model.b_IntalBusiness      = result.getProperty("b_intalbusiness") == "1" ? true : false;
            model.b_Preparer           = result.getProperty("b_preparer");
            model.b_PreparerNo         = result.getProperty("b_preparerno");
            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_Tel           = result.getProperty("b_tel");
            model.b_AmountInWords = result.getProperty("b_amountinwords");
            model.b_TotalAmount   = !string.IsNullOrEmpty(result.getProperty("b_totalamount")) ? decimal.Parse(result.getProperty("b_totalamount")) : 0;
            model.b_HotelInWords  = result.getProperty("b_hotelinwords");
            model.b_HotelAmount   = !string.IsNullOrEmpty(result.getProperty("b_hotelamount")) ? decimal.Parse(result.getProperty("b_hotelamount")) : 0;
            model.b_TrafInWords   = result.getProperty("b_trafinwords");
            model.b_TrafAmount    = !string.IsNullOrEmpty(result.getProperty("b_trafamount")) ? decimal.Parse(result.getProperty("b_trafamount")) : 0;
            model.b_MealInWords   = result.getProperty("b_mealinwords");
            model.b_MealAmount    = !string.IsNullOrEmpty(result.getProperty("b_mealamount")) ? decimal.Parse(result.getProperty("b_mealamount")) : 0;
            model.b_OthInWords    = result.getProperty("b_othinwords");
            model.b_OthAmount     = !string.IsNullOrEmpty(result.getProperty("b_othamount")) ? decimal.Parse(result.getProperty("b_othamount")) : 0;

            model.b_AdvancedAmount      = !string.IsNullOrEmpty(result.getProperty("b_advancedamount")) ? decimal.Parse(result.getProperty("b_advancedamount")) : 0;
            model.b_TotalExpense        = !string.IsNullOrEmpty(result.getProperty("b_totalexpense")) ? decimal.Parse(result.getProperty("b_totalexpense")) : 0;
            model.b_AmountInTotal       = result.getProperty("b_amountintotal");
            model.b_IsHangUp            = result.getProperty("b_ishangup") == "1" ? true : false;
            model.b_AttachmentsQuantity = !string.IsNullOrEmpty(result.getProperty("b_attachmentsquantity")) ? int.Parse(result.getProperty("b_attachmentsquantity")) : 0;
            model.b_LineLeader          = result.getProperty("b_lineleader");
            model.b_DeptLeader          = result.getProperty("b_deptleader");
            model.b_DivisionVP          = result.getProperty("b_divisionvp");
            model.OldRemark             = result.getProperty("b_remark");
            model.b_BTRecordNo          = result.getProperty("b_btrecordno");
            model.b_TravelBudget        = !string.IsNullOrEmpty(result.getProperty("b_travelbudget")) ? decimal.Parse(result.getProperty("b_travelbudget")) : 0;
            model.b_IsBeyondBudget      = result.getProperty("b_isbeyondbudget");
            model.b_IsBeyondBudget      = model.b_IsBeyondBudget == "1" ? "是" : "否";
            model.b_BeyondReason        = result.getProperty("b_beyondreason");

            //住宿费
            Item HeRelation = result.getRelationships("R_HotelExpense");

            if (HeRelation.getItemCount() > 0)
            {
                model.HotelExpenseItems = new List <HotelExpense>();

                for (int i = 0; i < HeRelation.getItemCount(); i++)
                {
                    Item         ItemObJ = HeRelation.getItemByIndex(i).getRelatedItem();
                    HotelExpense HeModel = new HotelExpense();
                    HeModel.id                 = ItemObJ.getProperty("id");
                    HeModel.b_StartDate        = !string.IsNullOrEmpty(ItemObJ.getProperty("b_startdate")) ? DateTime.Parse(ItemObJ.getProperty("b_startdate")).ToString("yyyy-MM-dd") : "";
                    HeModel.b_EndDate          = !string.IsNullOrEmpty(ItemObJ.getProperty("b_enddate")) ? DateTime.Parse(ItemObJ.getProperty("b_enddate")).ToString("yyyy-MM-dd") : "";
                    HeModel.b_ProjectName      = ItemObJ.getProperty("b_projectname");
                    HeModel.b_City             = ItemObJ.getProperty("b_city");
                    HeModel.b_Hotel            = ItemObJ.getProperty("b_hotel");
                    HeModel.b_Currency         = ItemObJ.getProperty("b_currency");
                    HeModel.b_Rate             = !string.IsNullOrEmpty(ItemObJ.getProperty("b_rate")) ? float.Parse(ItemObJ.getProperty("b_rate")) : 0;
                    HeModel.b_OriginalCurrency = !string.IsNullOrEmpty(ItemObJ.getProperty("b_originalcurrency")) ? decimal.Parse(ItemObJ.getProperty("b_originalcurrency")) : 0;
                    HeModel.b_Count            = !string.IsNullOrEmpty(ItemObJ.getProperty("b_days")) ? int.Parse(ItemObJ.getProperty("b_days")) : 0;
                    HeModel.b_TaxRate          = !string.IsNullOrEmpty(ItemObJ.getProperty("b_taxrate")) ? float.Parse(ItemObJ.getProperty("b_taxrate")) : 0;
                    HeModel.b_Tax              = !string.IsNullOrEmpty(ItemObJ.getProperty("b_tax")) ? decimal.Parse(ItemObJ.getProperty("b_tax")) : 0;
                    HeModel.b_TaxFreeAmount    = !string.IsNullOrEmpty(ItemObJ.getProperty("b_taxfreeamount")) ? decimal.Parse(ItemObJ.getProperty("b_taxfreeamount")) : 0;
                    HeModel.b_CNYSubtotal      = !string.IsNullOrEmpty(ItemObJ.getProperty("b_cnysubtotal")) ? decimal.Parse(ItemObJ.getProperty("b_cnysubtotal")) : 0;
                    model.HotelExpenseItems.Add(HeModel);
                }
            }

            //交通费
            Item TeRelation = result.getRelationships("R_TrafficExpense");

            if (TeRelation.getItemCount() > 0)
            {
                model.TrafficExpenseItems = new List <TrafficExpense>();

                for (int i = 0; i < TeRelation.getItemCount(); i++)
                {
                    Item           ItemObJ = TeRelation.getItemByIndex(i).getRelatedItem();
                    TrafficExpense TeModel = new TrafficExpense();
                    TeModel.id                 = ItemObJ.getProperty("id");
                    TeModel.b_StartDate        = !string.IsNullOrEmpty(ItemObJ.getProperty("b_startdate")) ? DateTime.Parse(ItemObJ.getProperty("b_startdate")).ToString("yyyy-MM-dd") : "";
                    TeModel.b_EndDate          = !string.IsNullOrEmpty(ItemObJ.getProperty("b_enddate")) ? DateTime.Parse(ItemObJ.getProperty("b_enddate")).ToString("yyyy-MM-dd") : "";
                    TeModel.b_ProjectName      = ItemObJ.getProperty("b_projectname");
                    TeModel.b_Type             = ItemObJ.getProperty("b_type");
                    TeModel.b_StartPoint       = ItemObJ.getProperty("b_startpoint");
                    TeModel.b_EndPoint         = ItemObJ.getProperty("b_endpoint");
                    TeModel.b_Currency         = ItemObJ.getProperty("b_currency");
                    TeModel.b_Rate             = !string.IsNullOrEmpty(ItemObJ.getProperty("b_rate")) ? float.Parse(ItemObJ.getProperty("b_rate")) : 0;
                    TeModel.b_OriginalCurrency = !string.IsNullOrEmpty(ItemObJ.getProperty("b_originalcurrency")) ? decimal.Parse(ItemObJ.getProperty("b_originalcurrency")) : 0;
                    TeModel.b_Count            = !string.IsNullOrEmpty(ItemObJ.getProperty("b_kilometre")) ? int.Parse(ItemObJ.getProperty("b_kilometre")) : 0;
                    TeModel.b_TaxRate          = !string.IsNullOrEmpty(ItemObJ.getProperty("b_taxrate")) ? float.Parse(ItemObJ.getProperty("b_taxrate")) : 0;
                    TeModel.b_Tax              = !string.IsNullOrEmpty(ItemObJ.getProperty("b_tax")) ? decimal.Parse(ItemObJ.getProperty("b_tax")) : 0;
                    TeModel.b_TaxFreeAmount    = !string.IsNullOrEmpty(ItemObJ.getProperty("b_taxfreeamount")) ? decimal.Parse(ItemObJ.getProperty("b_taxfreeamount")) : 0;
                    TeModel.b_CNYSubtotal      = !string.IsNullOrEmpty(ItemObJ.getProperty("b_cnysubtotal")) ? decimal.Parse(ItemObJ.getProperty("b_cnysubtotal")) : 0;
                    model.TrafficExpenseItems.Add(TeModel);
                }
            }

            //餐费及固定补贴
            Item MbRelation = result.getRelationships("R_Mealsandfixedsubsidies");

            if (MbRelation.getItemCount() > 0)
            {
                model.MealsSubsidiesItems = new List <Mealsandfixedsubsidies>();

                for (int i = 0; i < MbRelation.getItemCount(); i++)
                {
                    Item ItemObJ = MbRelation.getItemByIndex(i).getRelatedItem();
                    Mealsandfixedsubsidies MbModel = new Mealsandfixedsubsidies();
                    MbModel.id                = ItemObJ.getProperty("id");
                    MbModel.b_StartDate       = !string.IsNullOrEmpty(ItemObJ.getProperty("b_startdate")) ? DateTime.Parse(ItemObJ.getProperty("b_startdate")).ToString("yyyy-MM-dd") : "";
                    MbModel.b_EndDate         = !string.IsNullOrEmpty(ItemObJ.getProperty("b_enddate")) ? DateTime.Parse(ItemObJ.getProperty("b_enddate")).ToString("yyyy-MM-dd") : "";
                    MbModel.b_ProjectName     = ItemObJ.getProperty("b_projectname");
                    MbModel.b_Place           = ItemObJ.getProperty("b_place");
                    MbModel.b_CompanionAmount = ItemObJ.getProperty("b_companionamount");
                    MbModel.b_CompanionName   = ItemObJ.getProperty("b_companionname");
                    MbModel.b_Currency        = ItemObJ.getProperty("b_currency");
                    MbModel.b_Rate            = !string.IsNullOrEmpty(ItemObJ.getProperty("b_rate")) ? float.Parse(ItemObJ.getProperty("b_rate")) : 0;
                    MbModel.b_FixedSubsidy    = !string.IsNullOrEmpty(ItemObJ.getProperty("b_fixedsubsidy")) ? decimal.Parse(ItemObJ.getProperty("b_fixedsubsidy")) : 0;
                    MbModel.b_TaxRate         = !string.IsNullOrEmpty(ItemObJ.getProperty("b_taxrate")) ? float.Parse(ItemObJ.getProperty("b_taxrate")) : 0;
                    MbModel.b_Tax             = !string.IsNullOrEmpty(ItemObJ.getProperty("b_tax")) ? decimal.Parse(ItemObJ.getProperty("b_tax")) : 0;
                    MbModel.b_TaxFreeAmount   = !string.IsNullOrEmpty(ItemObJ.getProperty("b_taxfreeamount")) ? decimal.Parse(ItemObJ.getProperty("b_taxfreeamount")) : 0;
                    MbModel.b_CNYSubtotal     = !string.IsNullOrEmpty(ItemObJ.getProperty("b_cnysubtotal")) ? decimal.Parse(ItemObJ.getProperty("b_cnysubtotal")) : 0;
                    model.MealsSubsidiesItems.Add(MbModel);
                }
            }

            //其他
            Item OsRelation = result.getRelationships("R_Others");

            if (OsRelation.getItemCount() > 0)
            {
                model.OthersItems = new List <Others>();

                for (int i = 0; i < OsRelation.getItemCount(); i++)
                {
                    Item   ItemObJ = OsRelation.getItemByIndex(i).getRelatedItem();
                    Others OsModel = new Others();
                    OsModel.id                 = ItemObJ.getProperty("id");
                    OsModel.b_StartDate        = !string.IsNullOrEmpty(ItemObJ.getProperty("b_startdate")) ? DateTime.Parse(ItemObJ.getProperty("b_startdate")).ToString("yyyy-MM-dd") : "";
                    OsModel.b_EndDate          = !string.IsNullOrEmpty(ItemObJ.getProperty("b_enddate")) ? DateTime.Parse(ItemObJ.getProperty("b_enddate")).ToString("yyyy-MM-dd") : "";
                    OsModel.b_ProjectName      = ItemObJ.getProperty("b_projectname");
                    OsModel.b_Place            = ItemObJ.getProperty("b_place");
                    OsModel.b_Type             = ItemObJ.getProperty("b_type");
                    OsModel.b_Reason           = ItemObJ.getProperty("b_reason");
                    OsModel.b_Currency         = ItemObJ.getProperty("b_currency");
                    OsModel.b_Rate             = !string.IsNullOrEmpty(ItemObJ.getProperty("b_rate")) ? float.Parse(ItemObJ.getProperty("b_rate")) : 0;
                    OsModel.b_OriginalCurrency = !string.IsNullOrEmpty(ItemObJ.getProperty("b_originalcurrency")) ? decimal.Parse(ItemObJ.getProperty("b_originalcurrency")) : 0;
                    OsModel.b_Count            = !string.IsNullOrEmpty(ItemObJ.getProperty("b_count")) ? int.Parse(ItemObJ.getProperty("b_count")) : 0;
                    OsModel.b_TaxRate          = !string.IsNullOrEmpty(ItemObJ.getProperty("b_taxrate")) ? float.Parse(ItemObJ.getProperty("b_taxrate")) : 0;
                    OsModel.b_Tax              = !string.IsNullOrEmpty(ItemObJ.getProperty("b_tax")) ? decimal.Parse(ItemObJ.getProperty("b_tax")) : 0;
                    OsModel.b_TaxFreeAmount    = !string.IsNullOrEmpty(ItemObJ.getProperty("b_taxfreeamount")) ? decimal.Parse(ItemObJ.getProperty("b_taxfreeamount")) : 0;
                    OsModel.b_CNYSubtotal      = !string.IsNullOrEmpty(ItemObJ.getProperty("b_cnysubtotal")) ? decimal.Parse(ItemObJ.getProperty("b_cnysubtotal")) : 0;
                    model.OthersItems.Add(OsModel);
                }
            }

            //借款明细
            Item LnRelation = result.getRelationships("R_LoanItems");

            if (LnRelation.getItemCount() > 0)
            {
                model.LoanItems = new List <LoanItems>();

                for (int i = 0; i < LnRelation.getItemCount(); i++)
                {
                    Item      ItemObJ = LnRelation.getItemByIndex(i).getRelatedItem();
                    LoanItems LnModel = new LoanItems();
                    LnModel.id            = ItemObJ.getProperty("id");
                    LnModel.b_LoanOrderNo = ItemObJ.getProperty("b_loanorderno");
                    LnModel.b_Date        = !string.IsNullOrEmpty(ItemObJ.getProperty("b_date")) ? DateTime.Parse(ItemObJ.getProperty("b_date")).ToString("yyyy-MM-dd") : "";
                    LnModel.b_Borrower    = ItemObJ.getProperty("b_borrower");
                    LnModel.b_LoanAmount  = !string.IsNullOrEmpty(ItemObJ.getProperty("b_loanamount")) ? decimal.Parse(ItemObJ.getProperty("b_loanamount")) : 0;
                    LnModel.b_LoanReason  = ItemObJ.getProperty("b_loanreason");
                    model.LoanItems.Add(LnModel);
                }
            }

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