Exemple #1
0
        public override void Finish(TaskWorkStatus status, TaskWork task)
        {
            var info = RenewalInfo.Get(this.ProjectId);

            switch (status)
            {
            case TaskWorkStatus.K2ProcessApproved:
            {
                using (TransactionScope tranScope = new TransactionScope())
                {
                    ProjectProgress.SetProgress(ProjectId, "40%");
                    ProjectInfo.FinishNode(ProjectId, this.WorkflowCode, NodeCode.Finish);
                    var anlysisProj = ProjectInfo.FirstOrDefault(e => e.FlowCode == FlowCode.Renewal_Analysis &&
                                                                 e.Status == ProjectStatus.UnFinish && e.ProjectId == ProjectId);
                    if (anlysisProj != null)
                    {
                        info.GenerateSubmitTask(FlowCode.Renewal_Analysis);
                    }
                    else
                    {
                        //Renewal Tool重新Edit并完成后,系统自动重新生成一次Renewal Analysis文件
                        var anlysis = RenewalAnalysis.Get(ProjectId);
                        if (anlysis != null)
                        {
                            anlysis.GenerateAttachment();
                        }
                    }
                    tranScope.Complete();
                }
            }
            break;
            }
        }
Exemple #2
0
        public static RenewalPackageDTO InitPage(string projectId, string id = null)
        {
            RenewalPackageDTO dto = new RenewalPackageDTO();
            var entity            = RenewalPackage.Get(projectId, id);
            var project           = ProjectInfo.Get(projectId, FlowCode.Renewal_Package);
            var info = RenewalInfo.Get(projectId);

            entity.IsProjectFreezed = entity.CheckIfFreezeProject(projectId);
            entity.GenerateCover();
            var haveTask       = TaskWork.Any(t => t.RefID == projectId && t.TypeCode == FlowCode.Renewal_Package && t.Status == TaskWorkStatus.UnFinish && t.ReceiverAccount == ClientCookie.UserCode);
            var projectComment = ProjectComment.GetSavedComment(entity.Id, "RenewalPackage", ClientCookie.UserCode);
            var projectNode    = NodeInfo.GetNodeInfo(project.NodeCode);

            dto.Info             = info;
            dto.Entity           = entity;
            dto.Analysis         = RenewalAnalysis.Get(entity.AnalysisId.Value);
            dto.FinMeasureOutput = RenewalToolFinMeasureOutput.GetByToolId(entity.ToolId.Value);
            dto.Uploadable       = projectNode.Sequence >= 4 && ClientCookie.UserCode == dto.Info.AssetActorAccount;
            var editStatuses = new[] { ProjectStatus.Finished, ProjectStatus.Rejected };

            dto.ProjectComment = projectComment != null ? projectComment.Content : "";
            dto.Editable       = ProjectInfo.IsFlowEditable(projectId, FlowCode.Renewal_Package);
            dto.Recallable     = ProjectInfo.IsFlowRecallable(projectId, FlowCode.Renewal_Package);
            dto.Savable        = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_Package) && string.IsNullOrEmpty(id);
            if (entity.ProcInstId.HasValue)
            {
                var currentActivityName = K2FxContext.Current.GetCurrentActivityName(entity.ProcInstId.Value);
                dto.Rejectable = !entity.WorkflowNormalActors.Contains(currentActivityName);
            }
            dto.IsLindaLu = string.Compare(ClientCookie.UserCode, ConfigurationManager.AppSettings["AssetMgrCode"], true) == 0;
            return(dto);
        }
Exemple #3
0
        public Dictionary <string, string> GetPrintTemplateFields()
        {
            var project       = ProjectInfo.Get(this.ProjectId, FlowCode.Renewal_Package);
            var storeBasic    = StoreBasicInfo.GetStorInfo(project.USCode);
            var storeContract = StoreContractInfo.Search(c => c.StoreCode == project.USCode).OrderByDescending(c => c.CreatedTime).FirstOrDefault();
            var info          = RenewalInfo.Get(ProjectId);
            var flowInfo      = FlowInfo.Get(FlowCode.Renewal);
            var analysis      = RenewalAnalysis.Get(this.AnalysisId.Value) ?? new RenewalAnalysis();
            var finOutput     = RenewalToolFinMeasureOutput.GetByToolId(this.ToolId.Value);
            Dictionary <string, string> templateFileds = new Dictionary <string, string>();

            templateFileds.Add("WorkflowName", flowInfo.NameENUS);
            templateFileds.Add("ProjectID", ProjectId);
            templateFileds.Add("USCode", storeBasic.StoreCode);
            templateFileds.Add("Region", storeBasic.Region);
            templateFileds.Add("StoreNameEN", storeBasic.NameENUS);
            templateFileds.Add("Market", storeBasic.Market);
            templateFileds.Add("City", storeBasic.CityZHCN);
            templateFileds.Add("StoreNameCN", storeBasic.NameZHCN);
            templateFileds.Add("StoreAge", Math.Floor((DateTime.Now - storeBasic.OpenDate).TotalDays / 365D).ToString());
            templateFileds.Add("OpenDate", storeBasic.OpenDate.ToString("yyyy-MM-dd"));
            templateFileds.Add("CloseDate", storeBasic.CloseDate.HasValue ? (storeBasic.CloseDate.Value.Year != 1900 ? storeBasic.CloseDate.Value.ToString("yyyy-MM-dd") : "") : "");

            if (storeContract != null)
            {
                templateFileds.Add("CurrentLeaseENDYear", storeContract.EndYear);
            }
            else
            {
                templateFileds.Add("CurrentLeaseENDYear", "");
            }

            templateFileds.Add("AssetsManager", info.AssetManagerNameENUS);
            templateFileds.Add("AssetsActor", info.AssetActorNameENUS);
            templateFileds.Add("AssetsRep", info.AssetRepNameENUS);
            templateFileds.Add("NewLeaseENDYear", info.NewLeaseEndDate.HasValue ? info.NewLeaseEndDate.Value.ToString("yyyy") : "");
            templateFileds.Add("ClosureDate", storeBasic.CloseDate.HasValue ? (storeBasic.CloseDate.Value.Year != 1900 ? storeBasic.CloseDate.Value.ToString("yyyy-MM-dd") : "") : "");
            templateFileds.Add("FairMarketRentPerAppraisal", analysis.FairMarketRentAmount.HasValue ? DataConverter.ToMoney(analysis.FairMarketRentAmount.Value) : "");
            templateFileds.Add("LeaseTenureAndTerm", analysis.LeaseTenureAndTerm);
            templateFileds.Add("DR1stTYAmount", analysis.DR1stTYAmount.HasValue ? DataConverter.ToMoney(analysis.DR1stTYAmount.Value) : "");
            templateFileds.Add("FreeRentalPeriod", analysis.FreeRentalPeriod);
            templateFileds.Add("RentDeviation", analysis.RentDeviation.HasValue ? DataConverter.ToPercentage(analysis.RentDeviation.Value.ToString()) : "");
            templateFileds.Add("RentStructureUR", analysis.RentStructure);
            templateFileds.Add("MFStructureUR", analysis.MFStructureNew);
            if (finOutput != null)
            {
                templateFileds.Add("AnnualRentExpenseLY", DataConverter.ToMoney(finOutput.AnnualRentExpenseLY));
                templateFileds.Add("AnnualRentExpenseYr1", DataConverter.ToMoney(finOutput.AnnualRentExpenseLY));
                templateFileds.Add("AnnualRentExpenseAvg", DataConverter.ToMoney(finOutput.AnnualRentExpenseLY));
                templateFileds.Add("RentAsProdSalesLY", DataConverter.ToPercentage(finOutput.RentAsProdSalesLY));
                templateFileds.Add("RentAsProdSalesYr1", DataConverter.ToPercentage(finOutput.RentAsProdSalesYr1));
                templateFileds.Add("RentAsProdSalesAvg", DataConverter.ToPercentage(finOutput.RentAsProdSalesAvg));
                templateFileds.Add("OccupancyProdSalesLY", DataConverter.ToPercentage(finOutput.OccupancyProdSalesLY));
                templateFileds.Add("OccupancyProdSalesYr1", DataConverter.ToPercentage(finOutput.OccupancyProdSalesYr1));
                templateFileds.Add("OccupancyProdSalesAvg", DataConverter.ToPercentage(finOutput.OccupancyProdSalesAvg));
                templateFileds.Add("SOIProdSalesLY", DataConverter.ToPercentage(finOutput.SOIProdSalesLY));
                templateFileds.Add("SOIProdSalesYr1", DataConverter.ToPercentage(finOutput.SOIProdSalesYr1));
                templateFileds.Add("SOIProdSalesAvg", DataConverter.ToPercentage(finOutput.SOIProdSalesAvg));
                templateFileds.Add("CashROILY", DataConverter.ToPercentage(finOutput.CashROILY));
                templateFileds.Add("CashROIYr1", DataConverter.ToPercentage(finOutput.CashROIYr1));
                templateFileds.Add("CashROIAvg", DataConverter.ToPercentage(finOutput.CashROIAvg));
            }
            else
            {
                templateFileds.Add("AnnualRentExpenseLY", "");
                templateFileds.Add("AnnualRentExpenseYr1", "");
                templateFileds.Add("AnnualRentExpenseAvg", "");
                templateFileds.Add("RentAsProdSalesLY", "");
                templateFileds.Add("RentAsProdSalesYr1", "");
                templateFileds.Add("RentAsProdSalesAvg", "");
                templateFileds.Add("OccupancyProdSalesLY", "");
                templateFileds.Add("OccupancyProdSalesYr1", "");
                templateFileds.Add("OccupancyProdSalesAvg", "");
                templateFileds.Add("SOIProdSalesLY", "");
                templateFileds.Add("SOIProdSalesYr1", "");
                templateFileds.Add("SOIProdSalesAvg", "");
                templateFileds.Add("CashROILY", "");
                templateFileds.Add("CashROIYr1", "");
                templateFileds.Add("CashROIAvg", "");
            }

            return(templateFileds);
        }
Exemple #4
0
        private bool CheckIfNeedCDOApproval()
        {
            var analysis = RenewalAnalysis.Get(this.AnalysisId.Value);

            return(analysis.RentDeviation.HasValue ? Math.Abs(analysis.RentDeviation.Value * 100) > 10 : false);
        }
Exemple #5
0
        public void UpdateFromProjectList()
        {
            using (TransactionScope tranScope = new TransactionScope())
            {
                var oldInfo  = RenewalInfo.Get(this.ProjectId);
                var consInfo = RenewalConsInfo.Get(this.ProjectId);
                var analysis = RenewalAnalysis.Get(this.ProjectId);
                analysis.LeaseTenureAndTerm = string.Format("{0} years,from {1:yyyy-MM-dd} to {2:yyyy-MM-dd}", this.RenewalYears, this.NewLeaseStartDate, this.NewLeaseEndDate);
                analysis.Update();
                if (oldInfo.NeedProjectCostEst != this.NeedProjectCostEst)
                {
                    consInfo.HasReinvenstment = this.NeedProjectCostEst;
                    consInfo.Update();
                    if (ProjectInfo.IsFlowFinished(this.ProjectId, FlowCode.Renewal_Letter) &&
                        ProjectInfo.IsFlowFinished(this.ProjectId, FlowCode.Renewal_LLNegotiation))
                    {
                        if (!this.NeedProjectCostEst)
                        {
                            TaskWork.Cancel(e => e.RefID == this.ProjectId && e.Status == TaskWorkStatus.UnFinish && e.TypeCode == FlowCode.Renewal_ConsInfo);
                            ProjectInfo.FinishProject(this.ProjectId, FlowCode.Renewal_ConsInfo);
                            if (!ProjectInfo.IsFlowFinished(this.ProjectId, FlowCode.Renewal_Tool))
                            {
                                if (!TaskWork.Any(e => e.RefID == this.ProjectId && e.Status == TaskWorkStatus.UnFinish && e.TypeCode == FlowCode.Renewal_Tool))
                                {
                                    GenerateSubmitTask(FlowCode.Renewal_Tool);
                                }
                            }
                        }
                        else
                        {
                            ProjectInfo.Reset(this.ProjectId, FlowCode.Renewal_ConsInfo);

                            GenerateSubmitTask(FlowCode.Renewal_ConsInfo);
                            if (!ProjectInfo.IsFlowFinished(this.ProjectId, FlowCode.Renewal_Tool))
                            {
                                TaskWork.Cancel(e => e.RefID == this.ProjectId && e.TypeCode == FlowCode.Renewal_Tool && e.Status == TaskWorkStatus.UnFinish);
                                ProjectInfo.Reset(this.ProjectId, FlowCode.Renewal_Tool);
                            }
                        }
                    }
                }

                if (oldInfo.RenewalYears != this.RenewalYears)
                {
                    if (ProjectInfo.IsFlowFinished(ProjectId, FlowCode.Renewal_Analysis))
                    {
                        if (this.RenewalYears <= 2)
                        {
                            TaskWork.Finish(e => e.RefID == this.ProjectId && e.Status == TaskWorkStatus.UnFinish && e.TypeCode == FlowCode.Renewal_ClearanceReport);
                            ProjectInfo.FinishProject(this.ProjectId, FlowCode.Renewal_ClearanceReport);
                        }
                        else
                        {
                            if (!TaskWork.Any(e => e.RefID == ProjectId && e.TypeCode == FlowCode.Renewal_ClearanceReport && e.Status == TaskWorkStatus.UnFinish))
                            {
                                GenerateSubmitTask(FlowCode.Renewal_ClearanceReport);
                            }
                        }
                    }
                }
                this.Update();
                tranScope.Complete();
            }
        }