public void AddReimbursement([FromBody] ReimbursementItem reimbursementData)
        {
            ReimbursementInfo newReimbursement = new ReimbursementInfo();

            newReimbursement = _mapper.Map <ReimbursementItem, ReimbursementInfo>(reimbursementData);

            _unitofWork.ReimbursementRepository.Add(newReimbursement);
            int i = _unitofWork.Complete();
        }
        public void UpdateReimbursement([FromBody] ReimbursementItem reimbursementData)
        {
            ReimbursementInfo newReimbursement = _unitofWork.ReimbursementRepository.Get(reimbursementData.ReimbursementInfoId);

            newReimbursement.ReimbursementInfoId       = reimbursementData.ReimbursementInfoId;
            newReimbursement.ProjectCode               = reimbursementData.ProjectCode;
            newReimbursement.PurposeofTravel           = reimbursementData.PurposeofTravel;
            newReimbursement.EmployeeId                = reimbursementData.EmployeeId;
            newReimbursement.EmployeeName              = reimbursementData.EmployeeName;
            newReimbursement.BandWorkLevel             = reimbursementData.BandWorkLevel;
            newReimbursement.ClientName                = reimbursementData.ClientName;
            newReimbursement.CostCenter                = reimbursementData.CostCenter;
            newReimbursement.DateofArrival             = reimbursementData.DateofArrival;
            newReimbursement.DateofDeparture           = reimbursementData.DateofDeparture;
            newReimbursement.Designation               = reimbursementData.Designation;
            newReimbursement.FlightChargesReimbursed   = reimbursementData.FlightChargesReimbursed;
            newReimbursement.LocationofTravel          = reimbursementData.LocationofTravel;
            newReimbursement.TravelBillabletoCustomer  = reimbursementData.TravelBillabletoCustomer;
            newReimbursement.TravelExpenseReimbursed   = reimbursementData.TravelExpenseReimbursed;
            newReimbursement.AnyOtherExpenseReimbursed = reimbursementData.AnyOtherExpenseReimbursed;

            int i = _unitofWork.Complete();
        }
        public ReimbursementItem GetReimbursementById(int Id)
        {
            ReimbursementItem reimbursementData = _mapper.Map <ReimbursementInfo, ReimbursementItem>(_unitofWork.ReimbursementRepository.Get(Id));

            return(reimbursementData);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 打印
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ViewResult Print(string id)
        {
            Item result = ExpenseReimbursementBll.GetExpenseReimbursementObjById(inn, id);
            //拆解数据
            ExpenseReimbursementModel model = new ExpenseReimbursementModel();

            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_Preparer            = result.getProperty("b_preparer");
            model.b_PreparerNo          = result.getProperty("b_preparerno");
            model.b_ApplicationDate     = DateTime.Parse(result.getProperty("b_applicationdate")).ToString("yyyy-MM-dd");
            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_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_DueCompany          = result.getProperty("b_duecompany");
            model.b_IsHangUp            = result.getProperty("b_ishangup") == "1" ? true : false;
            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_Type                = result.getProperty("b_type");
            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_DepartmentLeader    = result.getProperty("b_departmentleader");
            model.b_DivisionVP          = result.getProperty("b_divisionvp");
            model.OldRemark             = result.getProperty("b_remark");

            //报销明细
            Item Relation = result.getRelationships("R_ReimbursementItem");

            if (Relation.getItemCount() > 0)
            {
                model.ReimbursementItems = new List <ReimbursementItem>();
                for (int i = 0; i < Relation.getItemCount(); i++)
                {
                    Item ItemObJ = Relation.getItemByIndex(i).getRelatedItem();
                    ReimbursementItem itemModel = new ReimbursementItem();
                    itemModel.Id                 = ItemObJ.getProperty("id");
                    itemModel.b_Date             = !string.IsNullOrEmpty(ItemObJ.getProperty("b_date")) ? DateTime.Parse(ItemObJ.getProperty("b_date")).ToString("yyyy-MM-dd") : "";
                    itemModel.b_CategoryNumber   = ItemObJ.getProperty("b_categorynumber");
                    itemModel.b_ProjectName      = ItemObJ.getProperty("b_projectname");
                    itemModel.b_BudgetNumber     = ItemObJ.getProperty("b_budgetnumber");
                    itemModel.b_Currency         = ItemObJ.getProperty("b_currency");
                    itemModel.b_Rate             = !string.IsNullOrEmpty(ItemObJ.getProperty("b_rate")) ? float.Parse(ItemObJ.getProperty("b_rate")) : 0;
                    itemModel.b_OriginalCurrency = !string.IsNullOrEmpty(ItemObJ.getProperty("b_originalcurrency")) ? decimal.Parse(ItemObJ.getProperty("b_originalcurrency")) : 0;
                    itemModel.b_Count            = !string.IsNullOrEmpty(ItemObJ.getProperty("b_count")) ? int.Parse(ItemObJ.getProperty("b_count")) : 0;
                    itemModel.b_TaxRate          = !string.IsNullOrEmpty(ItemObJ.getProperty("b_taxrate")) ? float.Parse(ItemObJ.getProperty("b_taxrate")) : 0;
                    itemModel.b_Tax              = !string.IsNullOrEmpty(ItemObJ.getProperty("b_tax")) ? decimal.Parse(ItemObJ.getProperty("b_tax")) : 0;
                    itemModel.b_TaxFreeAmount    = !string.IsNullOrEmpty(ItemObJ.getProperty("b_taxfreeamount")) ? decimal.Parse(ItemObJ.getProperty("b_taxfreeamount")) : 0;
                    itemModel.b_CNYSubtotal      = !string.IsNullOrEmpty(ItemObJ.getProperty("b_cnysubtotal")) ? decimal.Parse(ItemObJ.getProperty("b_cnysubtotal")) : 0;
                    model.ReimbursementItems.Add(itemModel);
                }
            }

            //借款明细
            Item loanItemRelation = result.getRelationships("R_LoanItem");

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

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