예제 #1
0
        // GET: SearchTripReimbursement
        public ActionResult Index()
        {
            List <string> listRoleName = IdentityDA.GetIdentityByUserName(Userinfo.UserName);

            if (listRoleName.Contains("SAP导出"))
            {
                ViewBag.CanExport = true;
            }
            else
            {
                ViewBag.CanExport = false;
            }

            ViewBag.CurrentName = Common.GetLanguageValueByParam("查询差旅报销", "TRCommon", "TRItemType", ViewBag.language);
            return(View("~/Views/TripReimbursement/SearchTripReimbursement.cshtml"));
        }
        /// <summary>
        /// 查询数据
        /// </summary>
        /// <param name="para"></param>
        /// <param name="searchValue"></param>
        /// <returns></returns>
        public JsonResult GetSearchPrManageList(DataTableParameter para, string searchValue, DateTime?startTime, DateTime?endTime, string status)
        {
            int total    = 0;
            var dataList = GetSearchPrManageList(inn, Userinfo.Roles, out total, para, searchValue, startTime, endTime, status);
            //获取当前人员角色信息
            List <string> listRoleName = IdentityDA.GetIdentityByUserName(Userinfo.UserName);

            if (dataList != null)
            {
                foreach (var item in dataList)
                {
                    item.status       = Common.GetItemStatus(item.id);
                    item.b_RaisedDate = item.nb_RaisedDate.ToString("yyyy-MM-dd");
                    if (item.status != "End")
                    {
                        var result = ActivityDA.GetActivityByItemId(inn, item.id, "innovator.B_PRMANAGE");
                        if (!result.isError())
                        {
                            item.activityId = result.getItemByIndex(0).getProperty("activityid");
                            item.AuditorStr = ActivityDA.GetActivityOperator(inn, item.activityId);
                            item.AuditorStr = "<div style='width:180px;word-wrap:break-word;'>" + item.AuditorStr + "</div>";
                        }
                    }
                    string strHtml   = "<div class='row'><div class='col-md-6'>{0}</div><div class='col-md-6' style='text-align:right'>{1}</div></div>";
                    string linkAList = "<a class='glyphicon glyphicon-eye-open detail' title='详情' id='" + item.id + "' ></a>";
                    linkAList += "&nbsp;&nbsp;<a class='glyphicon glyphicon-list-alt history' title='日志' id='" + item.id + "' ></a>";
                    linkAList += "&nbsp;&nbsp;<a class='glyphicon glyphicon-asterisk workflow' title='流程' id='" + item.id + "' ItemStatus='" + item.status + "' b_VersionNo='" + item.b_VersionNo + "'></a>";
                    if (item.b_Buyer == Userinfo.UserName || listRoleName.Contains("采购员") || listRoleName.Contains("PRReader") || listRoleName.Contains("采购部接收PR") || listRoleName.Contains("财务分析员") || listRoleName.Contains("财务经理") || listRoleName.Contains("财务总监") || listRoleName.Contains("CFO") || Userinfo.LoginName == "admin" || item.b_Applicant == Userinfo.UserName)
                    {
                        linkAList += "&nbsp;&nbsp;<a class='glyphicon glyphicon-print Print' title='打印' id='" + item.id + "'></a>";
                    }
                    strHtml           = string.Format(strHtml, item.b_PrRecordNo, linkAList);
                    item.b_PrRecordNo = strHtml;
                    item.status       = Common.GetChineseValueByParam(item.status, "PrManageWorkFlow", "WorkFlow", Userinfo.language);
                }
            }
            return(Json(new
            {
                sEcho = para.sEcho,
                iTotalRecords = total,
                iTotalDisplayRecords = total,
                aaData = dataList
            }, JsonRequestBehavior.AllowGet));
        }
        // GET: SearchPrManage
        public ActionResult Index()
        {
            List <string> listRoleName = IdentityDA.GetIdentityByUserName(Userinfo.UserName);

            //if (listRoleName.Contains("采购员") || listRoleName.Contains("PRReader") || listRoleName.Contains("采购部接收PR") || Userinfo.LoginName == "admin")
            //{
            //    ViewBag.CanExport = true;
            //}
            //else
            //{
            //    ViewBag.CanExport = false;
            //}

            if (listRoleName.Contains("Purchaser Export"))
            {
                ViewBag.CanExport = true;
            }
            else
            {
                ViewBag.CanExport = false;
            }
            ViewBag.CurrentName = Common.GetLanguageValueByParam("查询", "CommonName", "Common", ViewBag.language);
            return(View("~/Views/PrManage/SearchPrManage.cshtml"));
        }
        /// <summary>
        /// 打印
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ViewResult Print(string id)
        {
            Item result = PrManageBll.GetPrManageObjById(inn, id);
            //拆解数据
            PrManageModel model = new PrManageModel();

            model.id                   = result.getProperty("id");
            model.b_PrRecordNo         = result.getProperty("b_prrecordno");
            model.b_PrType             = result.getProperty("b_prtype");
            model.b_BusinessDepartment = result.getProperty("b_businessdepartment");
            model.b_Budget             = decimal.Parse(result.getProperty("b_budget"));
            model.b_ApplicantId        = result.getProperty("b_applicantid");
            model.b_Applicant          = result.getProperty("b_applicant");
            model.b_RaisedDate         = DateTime.Parse(result.getProperty("b_raiseddate")).ToString("yyyy-MM-dd");
            model.b_EmailAddress       = result.getProperty("b_emailaddress");
            model.b_PhoneNo            = result.getProperty("b_phoneno");
            model.b_ProjectName        = result.getProperty("b_projectname");
            model.b_BudgetCode         = result.getProperty("b_budgetcode");
            model.b_ProjectLeader      = result.getProperty("b_projectleader");
            model.b_ProjectManager     = result.getProperty("b_projectmanager");
            model.b_ProjectDirector    = result.getProperty("b_projectdirector");
            model.b_BudgetStatus       = result.getProperty("b_budgetstatus");
            model.b_BuyerId            = result.getProperty("b_buyerid");
            model.b_Buyer              = result.getProperty("b_buyer");
            model.b_UrgentPurchase     = result.getProperty("b_urgentpurchase") == "0" ? false : true;
            model.b_RepetitivePurchase = result.getProperty("b_repetitivepurchase") == "0" ? false : true;
            model.b_AuthorizedPurchase = result.getProperty("b_authorizedpurchase") == "0" ? false : true;
            //model.b_SourcedSupplier = result.getProperty("b_sourcedsupplier");
            //model.b_ContractPrice = result.getProperty("b_contractprice");
            //model.b_PoNo = result.getProperty("b_pono");
            //model.b_ContractProperty = result.getProperty("b_contractproperty");
            model.b_PurchaseContent  = result.getProperty("b_purchasecontent");
            model.b_ContractParty    = result.getProperty("b_contractparty");
            model.b_ApplicantAddress = result.getProperty("b_applicantaddress");
            model.b_IsSingleSupplier = result.getProperty("b_issinglesupplier") == "0" ? false : true;
            model.b_ContractType     = result.getProperty("b_contracttype");
            model.b_DeptManager      = result.getProperty("b_deptmanager");
            model.b_DeptDirector     = result.getProperty("b_deptdirector");
            model.b_CostCenter       = result.getProperty("b_costcenter");
            model.b_PurchasingReason = result.getProperty("b_purchasingreason");
            model.b_AdditionalBudget = result.getProperty("b_additionalbudget");
            model.b_DeptVP           = result.getProperty("b_deptvp");
            model.UserName           = Userinfo.UserName;
            model.status             = Common.GetItemStatus(id);
            Item Relation = result.getRelationships("b_RequestInfo");

            if (Relation.getItemCount() > 0)
            {
                model.PrManageItems = new List <PrManageItem>();
                for (int i = 0; i < Relation.getItemCount(); i++)
                {
                    Item         ItemObJ   = Relation.getItemByIndex(i).getRelatedItem();
                    PrManageItem itemModel = new PrManageItem();
                    itemModel.id                      = ItemObJ.getProperty("id");
                    itemModel.b_No                    = ItemObJ.getProperty("b_no");
                    itemModel.b_RequestList           = ItemObJ.getProperty("b_requestlist");
                    itemModel.b_SpecificationQuantity = ItemObJ.getProperty("b_specificationquantity");
                    itemModel.b_ProjectNo             = ItemObJ.getProperty("b_projectno");
                    itemModel.b_TaskNo                = ItemObJ.getProperty("b_taskno");
                    itemModel.b_Qty                   = int.Parse(ItemObJ.getProperty("b_qty"));
                    itemModel.b_Unit                  = ItemObJ.getProperty("b_unit");
                    model.PrManageItems.Add(itemModel);
                }
            }
            List <string> listRoleName = IdentityDA.GetIdentityByUserName(Userinfo.UserName);

            model.IsPurchasingAuth = false;

            if (model.UserName == model.b_Buyer || listRoleName.Contains("采购员") || listRoleName.Contains("采购部接收PR") || listRoleName.Contains("PRReader") || Userinfo.LoginName == "admin")
            {
                model.IsPurchasingAuth = true;
                //询价信息
                Item quotationRelation = result.getRelationships("b_QuotationItem");
                if (quotationRelation.getItemCount() > 0)
                {
                    model.PrQuotationItems = new List <PrQuotationItem>();
                    for (int i = 0; i < quotationRelation.getItemCount(); i++)
                    {
                        Item            itemObj   = quotationRelation.getItemByIndex(i).getRelatedItem();
                        PrQuotationItem itemModel = new PrQuotationItem();
                        itemModel.id          = itemObj.getProperty("id");
                        itemModel.b_Supplier  = itemObj.getProperty("b_supplier");
                        itemModel.b_Quotation = itemObj.getProperty("b_quotation");
                        itemModel.b_Remarks   = itemObj.getProperty("b_remarks");
                        model.PrQuotationItems.Add(itemModel);
                    }
                }

                //获取重复信息
                Item repeatedPurchasing = result.getRelationships("b_RepeatedPurchasing");
                if (repeatedPurchasing.getItemCount() > 0)
                {
                    model.PrRepeateItems = new List <PrRepeateItem>();
                    for (int i = 0; i < repeatedPurchasing.getItemCount(); i++)
                    {
                        Item          itemObj   = repeatedPurchasing.getItemByIndex(i).getRelatedItem();
                        PrRepeateItem itemModel = new PrRepeateItem();
                        itemModel.id                 = itemObj.getProperty("id");
                        itemModel.b_PrRecordNo       = itemObj.getProperty("b_prrecordno");
                        itemModel.b_PreviousSupplier = itemObj.getProperty("b_previoussupplier");
                        itemModel.b_ContractNo       = itemObj.getProperty("b_contractno");
                        //itemModel.b_ContractPrice = itemObj.getProperty("b_contractprice");
                        itemModel.b_PreviousBuyer = itemObj.getProperty("b_previousbuyer");
                        model.PrRepeateItems.Add(itemModel);
                    }
                }

                //获取挑选的供应商
                Item b_ChoiceSuppliers = result.getRelationships("b_ChoiceSuppliers");
                if (b_ChoiceSuppliers.getItemCount() > 0)
                {
                    model.PrChoiceSupplierItems = new List <PrChoiceSupplierItem>();
                    for (int i = 0; i < b_ChoiceSuppliers.getItemCount(); i++)
                    {
                        Item itemObj = b_ChoiceSuppliers.getItemByIndex(i).getRelatedItem();
                        PrChoiceSupplierItem itemModel = new PrChoiceSupplierItem();
                        itemModel.id                 = itemObj.getProperty("id");
                        itemModel.b_Supplier         = itemObj.getProperty("b_supplier");
                        itemModel.b_ContractPrice    = itemObj.getProperty("b_contractprice");
                        itemModel.b_PoNo             = itemObj.getProperty("b_pono");
                        itemModel.b_ContractProperty = itemObj.getProperty("b_contractproperty");
                        itemModel.b_PaymentClause    = itemObj.getProperty("b_paymentclause");
                        model.PrChoiceSupplierItems.Add(itemModel);
                    }
                }
            }
            model.HistoryList = GetPrManageHistoryList(model.id);
            foreach (var item in model.HistoryList)
            {
                item.Created_on = item.Create_onStr.GetValueOrDefault().ToString("yyyy-MM-dd HH:mm:ss");
                item.ItemStatus = Common.GetChineseValueByParam(item.ItemStatus, "PrManageWorkFlow", "WorkFlow", Userinfo.language);
                item.OperateStr = Common.GetChineseValueByParam(item.OperateStr, "PrManageWorkFlow", "WorkFlow", Userinfo.language);
            }
            return(View("~/Views/PrManage/PrintPrManage.cshtml", model));
        }