Beispiel #1
0
        //  合同信息[from StoreContractInfo]
        public ActionResult StoreContractInfoByIDQuery(Guid _ID)
        {
            StoreContractInfo mStoreContractInfo = new StoreContractInfo();

            mStoreContractInfo = mStoreContractInfo.GetStoreContractInfo(_ID);
            string result = JsonConvert.SerializeObject(mStoreContractInfo);

            return(Content(result));
        }
Beispiel #2
0
        /////////////////////////////////////////////////////////////////////////////////


        #region //  StoreAllInfoQuery Test
        public ActionResult StoreAllInfoQuery(string _USCode)
        {
            List <StoreBasicInfo> lsStoreBasicInfo = new List <StoreBasicInfo>();
            StoreBasicInfo        mStoreBasicInfo  = new StoreBasicInfo();

            lsStoreBasicInfo = StoreBasicInfo.Search(o => o.StoreCode.Contains(_USCode)).ToList <StoreBasicInfo>();
            if (lsStoreBasicInfo.Count > 0)
            {
                mStoreBasicInfo = lsStoreBasicInfo[0];
            }

            List <StoreDevelop> lsStoreDevelop = new List <StoreDevelop>();
            StoreDevelop        mStoreDevelop  = new StoreDevelop();

            lsStoreDevelop = StoreDevelop.Search(o => o.StoreCode.Contains(_USCode)).ToList <StoreDevelop>();
            if (lsStoreDevelop.Count > 0)
            {
                mStoreDevelop = lsStoreDevelop[0];
            }

            List <StoreOps> lsStoreOp = new List <StoreOps>();
            StoreOps        mStoreOp  = new StoreOps();

            lsStoreOp = StoreOps.Search(o => o.StoreCode.Contains(_USCode)).ToList <StoreOps>();
            if (lsStoreOp.Count > 0)
            {
                mStoreOp = lsStoreOp[0];
            }

            List <StoreContractInfo> lsStoreContractInfo = new List <StoreContractInfo>();
            StoreContractInfo        mStoreContractInfo  = new StoreContractInfo();

            lsStoreContractInfo = StoreContractInfo.Search(o => o.StoreCode.Contains(_USCode)).ToList <StoreContractInfo>();
            if (lsStoreContractInfo.Count > 0)
            {
                mStoreContractInfo = lsStoreContractInfo[0];
            }

            var resultStoreAllInfo = new
            {
                StoreBasicInfo    = mStoreBasicInfo,
                StoreDevelop      = mStoreDevelop,
                StoreOp           = mStoreOp,
                StoreContractInfo = new
                {
                    StoreContractInfo         = mStoreContractInfo,
                    StoreContractRevision     = "",
                    StoreContractInfoAttached = ""
                }
            };

            string result = JsonConvert.SerializeObject(resultStoreAllInfo);

            return(Content(result));
        }
Beispiel #3
0
        /////////////////////////////////////////////////////////////////////////////////

        #region //  合同信息 Store ContractInfo

        //  租赁历史[from StoreContractInfo]
        public ActionResult StoreContractInfoListQuery(string _USCode)
        {
            var lsStoreContractInfo = new List <StoreContractInfo>();
            var bll = new StoreContractInfo();

            lsStoreContractInfo = bll.GetStoreContractInfo(_USCode);

            string result = JsonConvert.SerializeObject(lsStoreContractInfo);

            return(Content(result));
        }
Beispiel #4
0
        public IHttpActionResult GetAttachmentCount(string projectId)
        {
            var contrainfo   = StoreContractInfo.SearchByProject(projectId).FirstOrDefault();
            int?leaseRecapID = null;

            if (contrainfo != null)
            {
                leaseRecapID = contrainfo.LeaseRecapID ?? 0;
            }
            else
            {
                leaseRecapID = 0;
            }
            return(Ok(StoreContractInfoAttached.Count(c => c.LeaseRecapID == leaseRecapID.ToString())));
        }
Beispiel #5
0
        public IHttpActionResult GetStoreBasic(string usCode)
        {
            string _USCode = usCode;

            var lsStoreBasicInfo = new List <StoreBasicInfo>();
            var mStoreBasicInfo  = new StoreBasicInfo();

            lsStoreBasicInfo = StoreBasicInfo.Search(o => o.StoreCode.Contains(_USCode)).ToList <StoreBasicInfo>();
            if (lsStoreBasicInfo.Count > 0)
            {
                mStoreBasicInfo = lsStoreBasicInfo[0];
            }

            mStoreBasicInfo.ProjectContractRevision = StoreContractInfo.MappingProjectContractRevision(usCode);

            return(Ok(mStoreBasicInfo));
        }
Beispiel #6
0
        public static List <EmailSendingResultType> SendPackageApprovalEmail(RenewalInfo info, RenewalPackage entity, ApproveUsers approvers)
        {
            var project       = ProjectInfo.Get(entity.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 assetMgr      = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == entity.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetManager);
            var assetActor    = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == entity.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetActor);
            var assetRep      = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == entity.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetRep);
            var results       = new List <EmailSendingResultType>();

            using (EmailServiceClient emailClient = new EmailServiceClient())
            {
                List <SimpleEmployee> approveEmps = new List <SimpleEmployee> {
                    approvers.MarketMgr,
                    approvers.GM,
                    approvers.MDD,
                    approvers.FC,
                    approvers.MCCLAssetDtr
                };
                if (approvers.RegionalMgr != null)
                {
                    approveEmps.Add(approvers.RegionalMgr);
                }
                if (approvers.CDO != null)
                {
                    approveEmps.Add(approvers.CDO);
                }
                if (approvers.ManagingDirector != null)
                {
                    approveEmps.Add(approvers.ManagingDirector);
                }
                //邮件模板中的数据
                Dictionary <string, string> bodyValues = new Dictionary <string, string>();
                //邮件内容中的键值对
                bodyValues.Add("ApplicantName", ClientCookie.UserNameENUS);//--提交人
                bodyValues.Add("StoreCode", storeBasic.StoreCode);
                bodyValues.Add("StoreName", storeBasic.NameENUS + @" \ " + storeBasic.NameZHCN);
                bodyValues.Add("Actor", assetActor.UserNameENUS);     ////--呈递人
                //bodyValues.Add("WorkflowName", Constants.TempClosure_Package);////--流程名称
                bodyValues.Add("ProjectName", Constants.TempClosure); //项目名称
                var viewPage = string.Format("{0}/Renewal/Main#/Package/View/param?projectId={1}",
                                             HttpContext.Current.Request.Url.Authority, entity.ProjectId);
                bodyValues.Add("FormUrl", viewPage);
                Dictionary <string, string> templateFileds = entity.GetPrintTemplateFields();
                var approveRecords = ProjectComment.GetList("TempClosurePackage", entity.Id, ProjectCommentStatus.Submit).Select(pc => new SubmissionApprovalRecord
                {
                    OperatorID    = pc.UserAccount,
                    OperatorName  = pc.UserNameENUS,
                    OperatorTitle = pc.TitleNameENUS,
                    OperationDate = pc.CreateTime.HasValue ? pc.CreateTime.Value : DateTime.Now,
                    ActionName    = pc.ActivityName,
                    Comments      = pc.Content
                }).ToList();
                string imgPath = HtmlConversionUtility.HtmlConvertToPDF(HtmlTempalteType.Renewal, templateFileds, approveRecords);
                approveEmps.ForEach(e =>
                {
                    EmailMessage email           = new EmailMessage();
                    List <string> emailAddresses = new List <string>
                    {
                        e.Mail,
                        "*****@*****.**",
                        "*****@*****.**",
                        "*****@*****.**"
                    };
                    if (bodyValues.ContainsKey("ApproverName"))
                    {
                        bodyValues["ApproverName"] = e.NameENUS;
                    }
                    else
                    {
                        bodyValues.Add("ApproverName", e.NameENUS);//--提交人
                    }
                    email.EmailBodyValues = bodyValues;
                    email.To          = string.Join(";", emailAddresses);
                    email.Attachments = imgPath;
                    //var result =  emailClient.SendEmail(email);
                    results.Add(new EmailSendingResultType());
                });
                approvers.NoticeUsers.ForEach(e =>
                {
                    EmailMessage email           = new EmailMessage();
                    List <string> emailAddresses = new List <string>
                    {
                        e.Mail,
                        "*****@*****.**",
                        "*****@*****.**",
                        "*****@*****.**"
                    };
                    if (bodyValues.ContainsKey("ApproverName"))//--提交人
                    {
                        bodyValues["ApproverName"] = e.NameENUS;
                    }
                    else
                    {
                        bodyValues.Add("ApproverName", e.NameENUS);
                    }
                    email.EmailBodyValues = bodyValues;
                    email.To          = string.Join(";", emailAddresses);
                    email.Attachments = imgPath;
                    //var result = emailClient.SendEmail(email);
                    results.Add(new EmailSendingResultType());
                });
            }
            return(results);
        }
Beispiel #7
0
        public IHttpActionResult DownLoadTemplate(string projectID)
        {
            var    current = System.Web.HttpContext.Current;
            string path    = SiteFilePath.Template_DIRECTORY + "\\" + SiteFilePath.Executive_Summary_Template;

            string tempFilePath = current.Server.MapPath("~/") + "Temp\\" + Guid.NewGuid() + ".xlsx";

            File.Copy(path, tempFilePath);
            var fileInfo      = new FileInfo(tempFilePath);
            var excelDirector = new ExcelDataInputDirector(fileInfo, ExcelDataInputType.ClosureExecutiveSummary);

            var closure   = ClosureInfo.GetByProjectId(projectID);
            var store     = StoreBasicInfo.GetStore(closure.USCode);
            var inputInfo = new ExcelInputDTO
            {
                StoreNameCN   = store.StoreBasicInfo.NameZHCN,
                USCode        = store.StoreBasicInfo.StoreCode,
                City          = store.StoreBasicInfo.CityENUS,
                Market        = store.StoreBasicInfo.MarketENUS,
                OpenDate      = store.StoreBasicInfo.OpenDate,
                Floor         = store.StoreSTLocation.Floor,
                TotalArea     = store.StoreSTLocation.TotalArea,
                TotalSeatsNo  = store.StoreSTLocation.TotalSeatsNo,
                BE            = store.StoreBEInfoList.Count,
                RentType      = store.StoreContractInfo.RentType,
                RentStructure = store.StoreContractInfo.RentStructure
            };


            var leaseRecapID = StoreContractInfo.SearchByProject(projectID).FirstOrDefault().LeaseRecapID ?? 0;
            var storeAtt     = StoreContractInfoAttached.Search(c => c.LeaseRecapID == leaseRecapID.ToString()).OrderByDescending(e => e.CreateDate).FirstOrDefault();

            if (storeAtt != null)
            {
                inputInfo.LeasingTerm = store.StoreContractInfo.LeasePurchaseTerm;
            }
            if (store.StoreContractInfo.RentCommencementDate.HasValue)
            {
                inputInfo.RentCommencementDate = store.StoreContractInfo.RentCommencementDate.Value;
            }

            if (store.StoreContractInfo.EndDate.HasValue)
            {
                inputInfo.LeaseExpirationDate = store.StoreContractInfo.EndDate.Value;
            }


            var toolEntity = ClosureTool.Get(closure.ProjectId);

            if (toolEntity != null)
            {
                if (toolEntity.TotalSales_Adjustment_RMB != null)
                {
                    inputInfo.TotalSales_TTM = string.Format("{0:f}", toolEntity.TotalSales_Adjustment_RMB);
                }
                if (toolEntity.CompSales_Adjustment != null)
                {
                    inputInfo.SalesComp_TTM = string.Format("{0:f}", toolEntity.CompSales_Adjustment);
                }
                if (toolEntity.CompCG_Adjustment != null)
                {
                    inputInfo.GCComp_TTM = string.Format("{0:f}", toolEntity.CompCG_Adjustment);
                }
                if (toolEntity.PAC_RMB_Adjustment != null)
                {
                    inputInfo.PAC_TTM = string.Format("{0:f}", toolEntity.PAC_RMB_Adjustment);
                }
                if (toolEntity.SOI_Adjustment != null)
                {
                    inputInfo.SOI_TTM = string.Format("{0:f}", toolEntity.SOI_Adjustment);
                }
                if (toolEntity.CashFlow_RMB_Adjustment != null)
                {
                    inputInfo.CASHFLOW_TTM = string.Format("{0:f}", toolEntity.CashFlow_RMB_Adjustment);
                }
                if (toolEntity.TotalSales_TTMY1 != null)
                {
                    inputInfo.TotalSales_TTMY1 = string.Format("{0:f}", toolEntity.TotalSales_TTMY1);
                }
                if (toolEntity.CompSales_TTMY1 != null)
                {
                    inputInfo.CompSales_TTMY1 = string.Format("{0:f}", toolEntity.CompSales_TTMY1);
                }
                if (toolEntity.CompGC_TTMY1 != null)
                {
                    inputInfo.CompGC_TTMY1 = string.Format("{0:f}", toolEntity.CompGC_TTMY1);
                }
                if (toolEntity.PAC_TTMY1 != null)
                {
                    inputInfo.PAC_TTMY1 = string.Format("{0:f}", toolEntity.PAC_TTMY1);
                }
                if (toolEntity.SOI_TTMY1 != null)
                {
                    inputInfo.SOI_TTMY1 = string.Format("{0:f}", toolEntity.SOI_TTMY1);
                }
                if (toolEntity.CashFlow_TTMY1 != null)
                {
                    inputInfo.CashFlow_TTMY1 = string.Format("{0:f}", toolEntity.CashFlow_TTMY1);
                }
                if (toolEntity.TotalSales_TTMY2 != null)
                {
                    inputInfo.TotalSales_TTMY2 = string.Format("{0:f}", toolEntity.TotalSales_TTMY2);
                }
                if (toolEntity.CompSales_TTMY2 != null)
                {
                    inputInfo.CompSales_TTMY2 = string.Format("{0:f}", toolEntity.CompSales_TTMY2);
                }
                if (toolEntity.CompGC_TTMY2 != null)
                {
                    inputInfo.CompGC_TTMY2 = string.Format("{0:f}", toolEntity.CompGC_TTMY2);
                }
                if (toolEntity.PAC_TTMY2 != null)
                {
                    inputInfo.PAC_TTMY2 = string.Format("{0:f}", toolEntity.PAC_TTMY2);
                }
                if (toolEntity.SOI_TTMY2 != null)
                {
                    inputInfo.SOI_TTMY2 = string.Format("{0:f}", toolEntity.SOI_TTMY2);
                }
                if (toolEntity.CashFlow_TTMY2 != null)
                {
                    inputInfo.CashFlow_TTMY2 = string.Format("{0:f}", toolEntity.CashFlow_TTMY2);
                }


                List <StoreBEInfo> remoteBeList   = new List <StoreBEInfo>();
                List <StoreBEInfo> attachedBeList = new List <StoreBEInfo>();
                StoreBEInfo        mds            = null;
                StoreBEInfo        mcCafe         = null;
                StoreBEInfo        hour24         = null;
                if (store.StoreBEInfoList.Count > 0)
                {
                    foreach (var beInfo in store.StoreBEInfoList)
                    {
                        switch (beInfo.BETypeName)
                        {
                        case "Remote Kiosk":
                            remoteBeList.Add(beInfo);
                            break;

                        case "Attached Kiosk":
                            attachedBeList.Add(beInfo);
                            break;

                        case "MDS":
                            mds = beInfo;
                            break;

                        case "McCafe":
                            mcCafe = beInfo;
                            break;

                        case "24 Hour":
                            hour24 = beInfo;
                            break;
                        }
                    }
                }
                if (remoteBeList.Count > 0)
                {
                    inputInfo.RemoteKiosk1_Status   = remoteBeList[0].IsSingleContract == 1 ? "Yes" : "No";
                    inputInfo.RemoteKiosk1_OpenDate = remoteBeList[0].LaunchDate;
                    if (remoteBeList.Count > 1)
                    {
                        inputInfo.RemoteKiosk2_Status   = remoteBeList[1].IsSingleContract == 1 ? "Yes" : "No";
                        inputInfo.RemoteKiosk2_OpenDate = remoteBeList[1].LaunchDate;

                        if (remoteBeList.Count > 2)
                        {
                            inputInfo.RemoteKiosk3_Status   = remoteBeList[2].IsSingleContract == 1 ? "Yes" : "No";
                            inputInfo.RemoteKiosk3_OpenDate = remoteBeList[2].LaunchDate;
                        }
                    }
                }

                if (attachedBeList.Count > 0)
                {
                    inputInfo.AttachedKiosk1_Status   = attachedBeList[0].IsSingleContract == 1 ? "Yes" : "No";
                    inputInfo.AttachedKiosk1_OpenDate = attachedBeList[0].LaunchDate;
                    if (attachedBeList.Count > 1)
                    {
                        inputInfo.AttachedKiosk2_Status   = attachedBeList[1].IsSingleContract == 1 ? "Yes" : "No";
                        inputInfo.AttachedKiosk2_OpenDate = attachedBeList[1].LaunchDate;

                        if (attachedBeList.Count > 2)
                        {
                            inputInfo.AttachedKiosk3_Status   = attachedBeList[2].IsSingleContract == 1 ? "Yes" : "No";
                            inputInfo.AttachedKiosk3_OpenDate = attachedBeList[2].LaunchDate;
                        }
                    }
                }
                if (mds != null)
                {
                    inputInfo.MDS_Status   = mds.IsSingleContract == 1 ? "Yes" : "No";
                    inputInfo.MDS_OpenDate = mds.LaunchDate;
                }
                if (mcCafe != null)
                {
                    inputInfo.McCafe_Status   = mcCafe.IsSingleContract == 1 ? "Yes" : "No";
                    inputInfo.McCafe_OpenDate = mcCafe.LaunchDate;
                }
                if (hour24 != null)
                {
                    inputInfo.TwentyFourHour_Status   = hour24.IsSingleContract == 1 ? "Yes" : "No";
                    inputInfo.TwentyFourHour_OpenDate = hour24.LaunchDate;
                }


                var woEntity = ClosureWOCheckList.Get(closure.ProjectId);
                if (woEntity != null)
                {
                    if (woEntity.LHI_NBV != null)
                    {
                        inputInfo.LHI_NBV = string.Format("{0:f}", woEntity.LHI_NBV);
                    }
                    if (woEntity.ESSD_NBV != null)
                    {
                        inputInfo.ESSD_NBV = string.Format("{0:f}", woEntity.ESSD_NBV);
                    }
                    if (woEntity.TotalCost_NBV != null)
                    {
                        inputInfo.TotalCost_NBV = string.Format("{0:f}", woEntity.TotalCost_NBV);
                    }
                }
            }

            excelDirector.Input(inputInfo);


            current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + DataConverter.ToHexString(SiteFilePath.Executive_Summary_Template));
            current.Response.ContentType = "application/octet-stream";
            current.Response.WriteFile("" + tempFilePath + "");
            current.Response.End();
            return(Ok());
        }
Beispiel #8
0
        public IHttpActionResult GenExecutiveSummaty(ClosureExecutiveSummary entity)
        {
            if (!ClosureExecutiveSummary.Any(i => i.ProjectId == entity.ProjectId && i.IsHistory == false))
            {
                if (entity.Id == Guid.Empty || entity.Id == null)
                {
                    entity.Id = Guid.NewGuid();
                }
                entity.CreateTime     = DateTime.Now;
                entity.CreatorAccount = ClientCookie.UserCode;
                ClosureExecutiveSummary.Add(entity);
            }
            else
            {
                ClosureExecutiveSummary.Update(entity);
            }

            var    current          = System.Web.HttpContext.Current;
            string path             = SiteFilePath.Template_DIRECTORY + "\\" + SiteFilePath.Executive_Summary_Template;
            string internalFileName = Guid.NewGuid() + ".xlsx";
            string filePath         = SiteFilePath.UploadFiles_DIRECTORY + "\\" + internalFileName;

            File.Copy(path, filePath);
            var fileInfo         = new FileInfo(filePath);
            var excelPMTDirector = new ExcelDataInputDirector(fileInfo, ExcelDataInputType.ClosureExecutiveSummary);

            var closure   = ClosureInfo.GetByProjectId(entity.ProjectId);
            var store     = StoreBasicInfo.GetStore(closure.USCode);
            var inputInfo = new ExcelInputDTO
            {
                StoreNameCN        = store.StoreBasicInfo.NameZHCN,
                USCode             = store.StoreBasicInfo.StoreCode,
                City               = store.StoreBasicInfo.CityENUS,
                Market             = store.StoreBasicInfo.MarketENUS,
                OpenDate           = store.StoreBasicInfo.OpenDate,
                Floor              = store.StoreSTLocation.Floor,
                TotalArea          = store.StoreSTLocation.TotalArea,
                TotalSeatsNo       = store.StoreSTLocation.TotalSeatsNo,
                BE                 = store.StoreBEInfoList.Count,
                RentType           = store.StoreContractInfo.RentType,
                RentStructure      = store.StoreContractInfo.RentStructure,
                MiniMarket         = entity.MiniMarket,
                StoreLocation      = entity.StoreLocation,
                CurrentSituation   = entity.CurrentSituation,
                NegotiationHistory = entity.NegotiationHistory,
                ProposedSolution   = entity.ProposedSolution,
                SalesTransfer      = entity.SalesTransfer
            };


            var leaseRecapID = StoreContractInfo.SearchByProject(entity.ProjectId).FirstOrDefault().LeaseRecapID ?? 0;
            var storeAtt     = StoreContractInfoAttached.Search(c => c.LeaseRecapID == leaseRecapID.ToString()).OrderByDescending(e => e.CreateDate).FirstOrDefault();

            if (storeAtt != null)
            {
                inputInfo.LeasingTerm = store.StoreContractInfo.LeasePurchaseTerm;
            }
            if (store.StoreContractInfo.RentCommencementDate.HasValue)
            {
                inputInfo.RentCommencementDate = store.StoreContractInfo.RentCommencementDate.Value;
            }

            if (store.StoreContractInfo.EndDate.HasValue)
            {
                inputInfo.LeaseExpirationDate = store.StoreContractInfo.EndDate.Value;
            }


            var toolEntity = ClosureTool.Get(closure.ProjectId);

            if (toolEntity != null)
            {
                if (toolEntity.TotalSales_Adjustment_RMB != null)
                {
                    inputInfo.TotalSales_TTM = string.Format("{0:f}", toolEntity.TotalSales_Adjustment_RMB);
                }
                if (toolEntity.CompSales_Adjustment != null)
                {
                    inputInfo.SalesComp_TTM = string.Format("{0:f}", toolEntity.CompSales_Adjustment);
                }
                if (toolEntity.CompCG_Adjustment != null)
                {
                    inputInfo.GCComp_TTM = string.Format("{0:f}", toolEntity.CompCG_Adjustment);
                }
                if (toolEntity.PAC_Adjustment != null)
                {
                    inputInfo.PAC_TTM = string.Format("{0:f}", toolEntity.PAC_Adjustment);
                }
                if (toolEntity.SOI_Adjustment != null)
                {
                    inputInfo.SOI_TTM = string.Format("{0:f}", toolEntity.SOI_Adjustment);
                }
                if (toolEntity.CashFlow_RMB_Adjustment != null)
                {
                    inputInfo.CASHFLOW_TTM = string.Format("{0:f}", toolEntity.CashFlow_RMB_Adjustment);
                }
                if (toolEntity.TotalSales_TTMY1 != null)
                {
                    inputInfo.TotalSales_TTMY1 = string.Format("{0:f}", toolEntity.TotalSales_TTMY1);
                }
                if (toolEntity.CompSales_TTMY1 != null)
                {
                    inputInfo.CompSales_TTMY1 = string.Format("{0:f}", toolEntity.CompSales_TTMY1);
                }
                if (toolEntity.CompGC_TTMY1 != null)
                {
                    inputInfo.CompGC_TTMY1 = string.Format("{0:f}", toolEntity.CompGC_TTMY1);
                }
                if (toolEntity.PAC_TTMY1 != null)
                {
                    inputInfo.PAC_TTMY1 = string.Format("{0:f}", toolEntity.PAC_TTMY1);
                }
                if (toolEntity.SOI_TTMY1 != null)
                {
                    inputInfo.SOI_TTMY1 = string.Format("{0:f}", toolEntity.SOI_TTMY1);
                }
                if (toolEntity.CashFlow_TTMY1 != null)
                {
                    inputInfo.CashFlow_TTMY1 = string.Format("{0:f}", toolEntity.CashFlow_TTMY1);
                }
                if (toolEntity.TotalSales_TTMY2 != null)
                {
                    inputInfo.TotalSales_TTMY2 = string.Format("{0:f}", toolEntity.TotalSales_TTMY2);
                }
                if (toolEntity.CompSales_TTMY2 != null)
                {
                    inputInfo.CompSales_TTMY2 = string.Format("{0:f}", toolEntity.CompSales_TTMY2);
                }
                if (toolEntity.CompGC_TTMY2 != null)
                {
                    inputInfo.CompGC_TTMY2 = string.Format("{0:f}", toolEntity.CompGC_TTMY2);
                }
                if (toolEntity.PAC_TTMY2 != null)
                {
                    inputInfo.PAC_TTMY2 = string.Format("{0:f}", toolEntity.PAC_TTMY2);
                }
                if (toolEntity.SOI_TTMY2 != null)
                {
                    inputInfo.SOI_TTMY2 = string.Format("{0:f}", toolEntity.SOI_TTMY2);
                }
                if (toolEntity.CashFlow_TTMY2 != null)
                {
                    inputInfo.CashFlow_TTMY2 = string.Format("{0:f}", toolEntity.CashFlow_TTMY2);
                }


                List <StoreBEInfo> remoteBeList   = new List <StoreBEInfo>();
                List <StoreBEInfo> attachedBeList = new List <StoreBEInfo>();
                StoreBEInfo        mds            = null;
                StoreBEInfo        mcCafe         = null;
                StoreBEInfo        hour24         = null;
                if (store.StoreBEInfoList.Count > 0)
                {
                    foreach (var beInfo in store.StoreBEInfoList)
                    {
                        switch (beInfo.BETypeName)
                        {
                        case "Remote Kiosk":
                            remoteBeList.Add(beInfo);
                            break;

                        case "Attach Kiosk":
                            attachedBeList.Add(beInfo);
                            break;

                        case "MDS":
                            mds = beInfo;
                            break;

                        case "McCafe":
                            mcCafe = beInfo;
                            break;

                        case "24 Hour":
                            hour24 = beInfo;
                            break;
                        }
                    }
                }
                inputInfo.RemoteKiosk1_Status   = "No";
                inputInfo.RemoteKiosk2_Status   = "No";
                inputInfo.RemoteKiosk3_Status   = "No";
                inputInfo.AttachedKiosk1_Status = "No";
                inputInfo.AttachedKiosk2_Status = "No";
                inputInfo.AttachedKiosk3_Status = "No";
                inputInfo.MDS_Status            = "No";
                inputInfo.McCafe_Status         = "No";
                inputInfo.TwentyFourHour_Status = "No";

                if (remoteBeList.Count > 0)
                {
                    inputInfo.RemoteKiosk1_Status   = "Yes";
                    inputInfo.RemoteKiosk1_OpenDate = remoteBeList[0].LaunchDate;
                    if (remoteBeList.Count > 1)
                    {
                        inputInfo.RemoteKiosk2_Status   = "Yes";
                        inputInfo.RemoteKiosk2_OpenDate = remoteBeList[1].LaunchDate;

                        if (remoteBeList.Count > 2)
                        {
                            inputInfo.RemoteKiosk3_Status   = "Yes";
                            inputInfo.RemoteKiosk3_OpenDate = remoteBeList[2].LaunchDate;
                        }
                    }
                }

                if (attachedBeList.Count > 0)
                {
                    inputInfo.AttachedKiosk1_Status   = "Yes";
                    inputInfo.AttachedKiosk1_OpenDate = attachedBeList[0].LaunchDate;
                    if (attachedBeList.Count > 1)
                    {
                        inputInfo.AttachedKiosk2_Status   = "Yes";
                        inputInfo.AttachedKiosk2_OpenDate = attachedBeList[1].LaunchDate;

                        if (attachedBeList.Count > 2)
                        {
                            inputInfo.AttachedKiosk3_Status   = "Yes";
                            inputInfo.AttachedKiosk3_OpenDate = attachedBeList[2].LaunchDate;
                        }
                    }
                }
                if (mds != null)
                {
                    inputInfo.MDS_Status   = "Yes";
                    inputInfo.MDS_OpenDate = mds.LaunchDate;
                }
                if (mcCafe != null)
                {
                    inputInfo.McCafe_Status   = "Yes";
                    inputInfo.McCafe_OpenDate = mcCafe.LaunchDate;
                }
                if (hour24 != null)
                {
                    inputInfo.TwentyFourHour_Status   = "Yes";
                    inputInfo.TwentyFourHour_OpenDate = hour24.LaunchDate;
                }


                var woEntity = ClosureWOCheckList.Get(closure.ProjectId);
                if (woEntity != null)
                {
                    if (woEntity.LHI_NBV != null)
                    {
                        inputInfo.LHI_NBV = string.Format("{0:f}", woEntity.LHI_NBV);
                    }
                    if (woEntity.ESSD_NBV != null)
                    {
                        inputInfo.ESSD_NBV = string.Format("{0:f}", woEntity.ESSD_NBV);
                    }
                    if (woEntity.TotalCost_NBV != null)
                    {
                        inputInfo.TotalCost_NBV = string.Format("{0:f}", woEntity.TotalCost_NBV);
                    }
                }
            }

            excelPMTDirector.Input(inputInfo);

            Attachment att = Attachment.GetAttachment("ClosureExecutiveSummary", entity.Id.ToString(), "Template");

            if (att == null)
            {
                att = new Attachment();
                att.RefTableName    = "ClosureExecutiveSummary";
                att.RefTableID      = entity.Id.ToString();
                att.CreateTime      = DateTime.Now;
                att.ID              = Guid.NewGuid();
                att.TypeCode        = "Template";
                att.CreatorID       = ClientCookie.UserCode;
                att.CreatorNameENUS = ClientCookie.UserNameENUS;
                att.CreatorNameZHCN = ClientCookie.UserNameZHCN;
                att.Name            = SiteFilePath.Executive_Summary_Template;
                att.InternalName    = internalFileName;
                att.Extension       = fileInfo.Extension;
                att.Length          = Convert.ToInt32(fileInfo.Length);
                att.RequirementId   = new Guid("79258ffb-c2ef-4eff-897d-ba8376c90071");
                Attachment.Add(att);
            }
            else
            {
                att.CreateTime      = DateTime.Now;
                att.CreatorID       = ClientCookie.UserCode;
                att.CreatorNameENUS = ClientCookie.UserNameENUS;
                att.CreatorNameZHCN = ClientCookie.UserNameZHCN;
                att.Name            = SiteFilePath.Executive_Summary_Template;
                att.InternalName    = internalFileName;
                att.Extension       = fileInfo.Extension;
                att.Length          = Convert.ToInt32(fileInfo.Length);
                att.RequirementId   = new Guid("79258ffb-c2ef-4eff-897d-ba8376c90071");
                Attachment.Update(att);
            }

            ProjectInfo.FinishNode(entity.ProjectId, FlowCode.Closure_ExecutiveSummary, NodeCode.Closure_ExecutiveSummary_Generate);

            return(Ok());
        }
Beispiel #9
0
        public IHttpActionResult GetStoreProfitabilityAndLeaseInfo(string projectId, string pageType = "")
        {
            StoreProfitabilityAndLeaseInfo store = new StoreProfitabilityAndLeaseInfo();
            var reimageSummary = ReimageSummary.FirstOrDefault(e => e.ProjectId == projectId && e.IsHistory == false);

            if (reimageSummary != null)
            {
                store =
                    StoreProfitabilityAndLeaseInfo.FirstOrDefault(e => e.RefId == reimageSummary.Id);
            }
            if (store != null)
            {
                if (store.Id != 0)
                {
                    pageType = "save";
                }
            }
            if (pageType == "")
            {
                //var resultStoreAllInfo = storeBll.GetStoreDetailsByEID(eid, usCode);

                var reimageInfo       = ReimageInfo.FirstOrDefault(e => e.ProjectId == projectId);
                var storeBasicInfo    = StoreBasicInfo.FirstOrDefault(e => e.StoreCode == reimageInfo.USCode);
                var storeContractInfo = StoreContractInfo.FirstOrDefault(e => e.StoreCode == reimageInfo.USCode);
                int Year = 0;
                if (storeContractInfo != null)
                {
                    if (storeContractInfo.EndDate != null)
                    {
                        DateTime dtNow = DateTime.Now;
                        Year = int.Parse(storeContractInfo.EndDate.ToString().Split('/')[2].Substring(0, 4)) - dtNow.Year;
                    }
                }
                //var stFinanceData =
                //   Mcdonalds.AM.DataAccess.DataSync_LDW_AM_STFinanceData.OrderByDescending(e => e.FinanceYear == DateTime.Now.Year.ToString(),
                //       e => e.FinanceMonth).FirstOrDefault();
                //if (stFinanceData == null)
                //{
                //    throw new Exception("Could not get the latest finance month data!");
                //}
                //var latestMonth = stFinanceData.FinanceMonth;
                //var data = Mcdonalds.AM.DataAccess.DataSync_LDW_AM_STFinanceData.FirstOrDefault(e => e.FinanceYear == DateTime.Now.Year.ToString() && e.FinanceMonth == latestMonth && e.UsCode == stFinanceData.UsCode);

                //store.AsOf =DateTime.Parse(DateTime.Now.Year + "/" + latestMonth + "/01");
                //store.TTMSales = data.Total_Sales_TTM.As<decimal>();
                //store.TTMSOIPercent = data.SOIPct_TTM.As<decimal>();
                if (store == null)
                {
                    store = new StoreProfitabilityAndLeaseInfo();
                }
                DateTime?dt = storeBasicInfo.ReImageDate;
                if (dt != null)
                {
                    if (dt.ToString().Substring(0, 8) == "1/1/1900")
                    {
                        dt = null;
                    }
                }
                store.LastRemodelDate     = dt;
                store.RemainingLeaseYears = Year;
            }
            return(Ok(store));
        }
Beispiel #10
0
        public static List <EmailSendingResultType> SendPackageApprovalEmail(TempClosureInfo tempClosureInfo, TempClosurePackage entity, ApproveUsers approvers)
        {
            var project       = ProjectInfo.Get(entity.ProjectId, FlowCode.TempClosure_ClosurePackage);
            var storeBasic    = StoreBasicInfo.GetStorInfo(project.USCode);
            var storeContract = StoreContractInfo.Search(c => c.StoreCode == project.USCode).OrderByDescending(c => c.CreatedTime).FirstOrDefault();
            var assetMgr      = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == entity.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetManager);
            var assetActor    = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == entity.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetActor);
            var assetRep      = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == entity.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetRep);
            var results       = new List <EmailSendingResultType>();

            using (EmailServiceClient emailClient = new EmailServiceClient())
            {
                List <SimpleEmployee> approveEmps = new List <SimpleEmployee> {
                    approvers.MarketMgr,
                    approvers.GM,
                    approvers.MDD,
                    approvers.FC,
                    approvers.VPGM
                    //approvers.MCCLAssetMgr,
                    //approvers.MCCLAssetDtr
                };
                if (approvers.RegionalMgr != null)
                {
                    approveEmps.Add(approvers.RegionalMgr);
                }
                //邮件模板中的数据
                Dictionary <string, string> bodyValues = new Dictionary <string, string>();
                //邮件内容中的键值对
                bodyValues.Add("ApplicantName", ClientCookie.UserNameENUS);//--提交人
                bodyValues.Add("StoreCode", storeBasic.StoreCode);
                bodyValues.Add("StoreName", storeBasic.NameENUS + @" \ " + storeBasic.NameZHCN);
                bodyValues.Add("Actor", assetActor.UserNameENUS);     ////--呈递人
                //bodyValues.Add("WorkflowName", Constants.TempClosure_Package);////--流程名称
                bodyValues.Add("ProjectName", Constants.TempClosure); //项目名称
                var viewPage = string.Format("{0}/TempClosure/Main#/ClosurePackage/View/param?projectId={1}",
                                             HttpContext.Current.Request.Url.Authority, entity.ProjectId);
                bodyValues.Add("FormUrl", viewPage);
                Dictionary <string, string> templateFileds = new Dictionary <string, string>();
                var flowInfo = FlowInfo.Get(FlowCode.TempClosure);
                templateFileds.Add("WorkflowName", flowInfo.NameENUS);
                templateFileds.Add("ProjectID", entity.ProjectId);
                templateFileds.Add("USCode", storeBasic.StoreCode);
                templateFileds.Add("City", storeBasic.CityZHCN);
                templateFileds.Add("Region", storeBasic.Region);
                templateFileds.Add("StoreNameEN", storeBasic.NameENUS);
                templateFileds.Add("Market", storeBasic.Market);
                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"));
                var storeInfo = StoreBasicInfo.GetStore(project.USCode);

                if (!string.IsNullOrEmpty(storeInfo.StoreContractInfo.EndYear))
                {
                    templateFileds.Add("CurrentLeaseENDYear", (int.Parse(storeInfo.StoreContractInfo.EndYear) - storeInfo.CurrentYear).ToString());
                }
                else
                {
                    templateFileds.Add("CurrentLeaseENDYear", "");
                }

                if (assetMgr != null)
                {
                    templateFileds.Add("AssetsManager", assetMgr.UserNameENUS);
                }
                templateFileds.Add("AssetsActor", assetActor.UserNameENUS);
                templateFileds.Add("AssetsRep", assetRep.UserNameENUS);
                templateFileds.Add("ClosureDate", tempClosureInfo.ActualTempClosureDate.ToString("yyyy-MM-dd"));
                templateFileds.Add("LeaseExpireDate", tempClosureInfo.LeaseExpireDate.HasValue ? tempClosureInfo.LeaseExpireDate.Value.ToString("yyyy-MM-dd") : "");
                templateFileds.Add("ReOpenDate", tempClosureInfo.ActualReopenDate.ToString("yyyy-MM-dd"));
                templateFileds.Add("RentFreeTerm", string.IsNullOrEmpty(entity.RentReliefClause) ? "否" : "是");
                templateFileds.Add("RentFreeStartDate", entity.RentReliefStartDate.HasValue ? entity.RentReliefStartDate.Value.ToString("yyyy-MM-dd") : "");
                templateFileds.Add("RentFreeEndDate", entity.RentReliefEndDate.HasValue ? entity.RentReliefEndDate.Value.ToString("yyyy-MM-dd") : "");
                templateFileds.Add("FreeRentTerm", entity.RentReliefClause);
                var approveRecords = ProjectComment.GetList("TempClosurePackage", entity.Id, ProjectCommentStatus.Submit).Select(pc => new SubmissionApprovalRecord
                {
                    OperatorID    = pc.UserAccount,
                    OperatorName  = pc.UserNameENUS,
                    OperatorTitle = pc.TitleNameENUS,
                    OperationDate = pc.CreateTime.HasValue ? pc.CreateTime.Value : DateTime.Now,
                    ActionName    = pc.ActivityName,
                    Comments      = pc.Content
                }).ToList();
                string imgPath = HtmlConversionUtility.HtmlConvertToPDF(HtmlTempalteType.TempClosure, templateFileds, approveRecords);
                approveEmps.ForEach(e =>
                {
                    EmailMessage email           = new EmailMessage();
                    List <string> emailAddresses = new List <string>
                    {
                        e.Mail,
                        "*****@*****.**",
                        "*****@*****.**",
                        "*****@*****.**"
                    };
                    if (bodyValues.ContainsKey("ApproverName"))
                    {
                        bodyValues["ApproverName"] = e.NameENUS;
                    }
                    else
                    {
                        bodyValues.Add("ApproverName", e.NameENUS);//--提交人
                    }
                    email.EmailBodyValues = bodyValues;
                    email.To          = string.Join(";", emailAddresses);
                    email.Attachments = imgPath;
                    //var result =  emailClient.SendEmail(email);
                    results.Add(new EmailSendingResultType());
                });
                approvers.NoticeUsers.ForEach(e =>
                {
                    EmailMessage email           = new EmailMessage();
                    List <string> emailAddresses = new List <string>
                    {
                        e.Mail,
                        "*****@*****.**",
                        "*****@*****.**",
                        "*****@*****.**"
                    };
                    if (bodyValues.ContainsKey("ApproverName"))//--提交人
                    {
                        bodyValues["ApproverName"] = e.NameENUS;
                    }
                    else
                    {
                        bodyValues.Add("ApproverName", e.NameENUS);
                    }
                    email.EmailBodyValues = bodyValues;
                    email.To          = string.Join(";", emailAddresses);
                    email.Attachments = imgPath;
                    //var result = emailClient.SendEmail(email);
                    results.Add(new EmailSendingResultType());
                });
            }
            return(results);
        }
 public void MappingProjectContractRevisionTest()
 {
     var revision = StoreContractInfo.MappingProjectContractRevision("1960005");
 }
Beispiel #12
0
        public override void Input(ExcelWorksheet worksheet, ExcelInputDTO inputInfo)
        {
            var projectInfo = ProjectInfo.FirstOrDefault(e => e.ProjectId == inputInfo.ProjectId);

            if (projectInfo == null)
            {
                throw new Exception("Cannot find the project info!");
            }
            var store = StoreBasicInfo.Search(e => e.StoreCode == projectInfo.USCode).FirstOrDefault();

            if (store == null)
            {
                throw new Exception("Cannot find Store info!");
            }

            var reimageSummary = BaseWFEntity.GetWorkflowEntity(inputInfo.ProjectId, FlowCode.Reimage_Summary) as ReimageSummary;

            if (reimageSummary == null)
            {
                throw new Exception("Cannot find Reimage Summary Info!");
            }
            var storeSTLocation = StoreSTLocation.GetStoreSTLocation(projectInfo.USCode);
            var storeLeaseInfo  = new StoreProfitabilityAndLeaseInfo();
            var reimageConsInfo = ReimageConsInfo.GetConsInfo(inputInfo.ProjectId);
            var reinvestment    = ReinvestmentBasicInfo.FirstOrDefault(e => e.ConsInfoID == reimageConsInfo.Id);

            if (reimageSummary != null)
            {
                storeLeaseInfo =
                    StoreProfitabilityAndLeaseInfo.FirstOrDefault(e => e.RefId == reimageSummary.Id);
                if (storeLeaseInfo != null)
                {
                    if (storeLeaseInfo.LastRemodelDate.HasValue && storeLeaseInfo.LastRemodelDate.Value.ToString("yyyy-MM-dd") != "1900-01-01")
                    {
                        worksheet.Cells["B43"].Value = storeLeaseInfo.LastRemodelDate;
                    }
                    worksheet.Cells["B44"].Value = storeLeaseInfo.RemainingLeaseYears;

                    worksheet.Cells["B46"].Value = storeLeaseInfo.TTMSOIPercent / 100;
                    worksheet.Cells["B47"].Value = storeLeaseInfo.AsOf;
                    worksheet.Cells["B48"].Value = reimageSummary.OperationRequirements;
                    var financial = FinancialPreanalysis.FirstOrDefault(e => e.RefId == reimageSummary.Id);
                    worksheet.Cells["B49"].Value = TryParseDecimal(financial.TotalSalesInc);
                    worksheet.Cells["B45"].Value = financial.TTMSales;
                    worksheet.Cells["B50"].Value = TryParseDecimal(financial.StoreCM) * 100 + "%";
                    worksheet.Cells["B51"].Value = financial.CurrentPriceTier;
                    worksheet.Cells["B52"].Value = string.IsNullOrEmpty(financial.SPTAR) ? 0 : financial.SPTAR.As <decimal>();
                    worksheet.Cells["B53"].Value = financial.PriceTierafterReimage;
                }
                //worksheet.Cells["E4"].Value = financial.MarginInc;
            }
            else
            {
                var reimageInfo       = ReimageInfo.FirstOrDefault(e => e.ProjectId == inputInfo.ProjectId);
                var storeBasicInfo    = StoreBasicInfo.FirstOrDefault(e => e.StoreCode == reimageInfo.USCode);
                var storeContractInfo = StoreContractInfo.FirstOrDefault(e => e.StoreCode == reimageInfo.USCode);
                int Year = 0;
                if (storeContractInfo != null)
                {
                    if (storeContractInfo.EndDate != null)
                    {
                        DateTime dtNow = DateTime.Now;
                        Year = int.Parse(storeContractInfo.EndDate.ToString().Split('/')[2].Substring(0, 4)) - dtNow.Year;
                    }
                }

                DateTime?dt = storeBasicInfo.ReImageDate;
                if (dt != null)
                {
                    if (dt.ToString().Substring(0, 8) == "1/1/1900")
                    {
                        dt = null;
                    }
                }
                worksheet.Cells["B43"].Value = dt;
                worksheet.Cells["B44"].Value = Year;
                //storeLeaseInfo.LastRemodelDate = dt;
                //storeLeaseInfo.RemainingLeaseYears = Year;
            }
            ReinvestmentCost cost = ReinvestmentCost.FirstOrDefault(e => e.ConsInfoID == reimageConsInfo.Id);

            worksheet.Cells["B2"].Value = store.Region;
            worksheet.Cells["B3"].Value = store.StoreCode;
            if (reinvestment != null)
            {
                worksheet.Cells["B8"].Value  = TryParseDecimal(reinvestment.RightSizingSeatNo);
                worksheet.Cells["B11"].Value = TryParseDecimal(reinvestment.EstimatedSeatNo);
                worksheet.Cells["B41"].Value = reinvestment.GBDate;
                worksheet.Cells["B42"].Value = reinvestment.ConsCompletionDate;
            }
            if (cost != null)
            {
                worksheet.Cells["B13"].Value = TryParseDecimal(cost.DesignFee);
                worksheet.Cells["B14"].Value = TryParseDecimal(cost.PublicBudget);
                worksheet.Cells["B15"].Value = TryParseDecimal(cost.BuildingFacade);
                worksheet.Cells["B16"].Value = TryParseDecimal(cost.SiteBudget);
                worksheet.Cells["B17"].Value = TryParseDecimal(cost.BuildingWork);
                worksheet.Cells["B18"].Value = TryParseDecimal(cost.PlumbingSystem);
                worksheet.Cells["B19"].Value = TryParseDecimal(cost.ElectricalSystem);
                worksheet.Cells["B20"].Value = TryParseDecimal(cost.HVACDuctSystem);
                worksheet.Cells["B21"].Value = TryParseDecimal(cost.Signage);
                worksheet.Cells["B22"].Value = TryParseDecimal(cost.Seating);
                worksheet.Cells["B23"].Value = TryParseDecimal(cost.Decor);
                worksheet.Cells["B24"].Value = TryParseDecimal(cost.Kiosk);
                worksheet.Cells["B25"].Value = TryParseDecimal(cost.McCafe);
                worksheet.Cells["B26"].Value = TryParseDecimal(cost.MDS);
                worksheet.Cells["B27"].Value = TryParseDecimal(cost.Playland);
                worksheet.Cells["B28"].Value = TryParseDecimal(cost.KitchenCapacityUpgrade);
                worksheet.Cells["B29"].Value = TryParseDecimal(cost.BuildingWorks);
                worksheet.Cells["B30"].Value = TryParseDecimal(cost.KitchenEquipment);
                worksheet.Cells["B31"].Value = TryParseDecimal(cost.HVAC);
                worksheet.Cells["B32"].Value = TryParseDecimal(cost.Plumbing);
                worksheet.Cells["B33"].Value = TryParseDecimal(cost.ElectricDistribution);
                worksheet.Cells["B34"].Value = TryParseDecimal(cost.Structure);
                worksheet.Cells["B35"].Value = TryParseDecimal(cost.Others);
                worksheet.Cells["B36"].Value = TryParseDecimal(cost.LHIPMAct);
                worksheet.Cells["B37"].Value = TryParseDecimal(cost.SignagePMAct);
                worksheet.Cells["B38"].Value = TryParseDecimal(cost.EquipmentPMAct);
                worksheet.Cells["B39"].Value = TryParseDecimal(cost.SeatingPackagePMAct);
                worksheet.Cells["B40"].Value = TryParseDecimal(cost.DecorPMAct);
            }
            worksheet.Cells["B5"].Value = storeSTLocation.TotalArea.As <decimal>();
            worksheet.Cells["B6"].Value = store.ProvinceZHCN;
            worksheet.Cells["B7"].Value = store.NameZHCN;

            worksheet.Cells["B4"].Value  = TryParseDecimal(storeSTLocation.TotalSeatsNo);
            worksheet.Cells["B9"].Value  = TryParseDecimal(storeSTLocation.KitchenArea);
            worksheet.Cells["B10"].Value = store.CityZHCN;

            if (!string.IsNullOrEmpty(storeSTLocation.DesignStyle))
            {
                var dict = Dictionary.FirstOrDefault(i => i.Code == storeSTLocation.DesignStyle);
                if (dict != null)
                {
                    worksheet.Cells["B12"].Value = dict.NameZHCN;
                }
                else
                {
                    worksheet.Cells["B12"].Value = storeSTLocation.DesignStyle;
                }
            }
            //worksheet.Cells["B24"].Value = reimageSummary.ReinvestmentBasicInfo.NewKiosk;
            //worksheet.Cells["B25"].Value = reimageSummary.ReinvestmentBasicInfo.NewMcCafe;
            //worksheet.Cells["B26"].Value = reimageSummary.ReinvestmentBasicInfo.NewMDS;
            //worksheet.Cells["B41"].Value = reimageSummary.ReinvestmentBasicInfo.GBDate;
            //worksheet.Cells["B42"].Value = reimageSummary.ReinvestmentBasicInfo.ConsCompletionDate;


            worksheet.Cells["B10"].Value = store.CityZHCN;
            //worksheet.Cells["B11"].Value = inputInfo.StoreType;
            //worksheet.Cells["B12"].Value = inputInfo.StoreType;
            //worksheet.Cells["B13"].Value = inputInfo.StoreType;
            //worksheet.Cells["B14"].Value = inputInfo.StoreType;
            //worksheet.Cells["B15"].Value = inputInfo.StoreType;
            //worksheet.Cells["B16"].Value = inputInfo.StoreType;
            //worksheet.Cells["B17"].Value = inputInfo.StoreType;
            //worksheet.Cells["B18"].Value = inputInfo.StoreType;
            //worksheet.Cells["B19"].Value = inputInfo.StoreType;
            //worksheet.Cells["B20"].Value = inputInfo.StoreType;
            //worksheet.Cells["B21"].Value = inputInfo.StoreType;
            //worksheet.Cells["B22"].Value = inputInfo.StoreType;
            //worksheet.Cells["B23"].Value = inputInfo.StoreType;

            //worksheet.Cells["B27"].Value = inputInfo.StoreType;
            //worksheet.Cells["B28"].Value = inputInfo.StoreType;
            //worksheet.Cells["B29"].Value = inputInfo.StoreType;
            //worksheet.Cells["B30"].Value = inputInfo.StoreType;
            //worksheet.Cells["B31"].Value = inputInfo.StoreType;
            //worksheet.Cells["B32"].Value = inputInfo.StoreType;
            //worksheet.Cells["B33"].Value = inputInfo.StoreType;
            //worksheet.Cells["B34"].Value = inputInfo.StoreType;
            //worksheet.Cells["B35"].Value = inputInfo.StoreType;
            //worksheet.Cells["B36"].Value = inputInfo.StoreType;
            //worksheet.Cells["B37"].Value = inputInfo.StoreType;
            //worksheet.Cells["B38"].Value = inputInfo.StoreType;
            //worksheet.Cells["B39"].Value = inputInfo.StoreType;
            //worksheet.Cells["B40"].Value = inputInfo.StoreType;

            //if (reimageSummary.StoreProfitabilityAndLeaseInfo != null)
            //{
            //    worksheet.Cells["B43"].Value = reimageSummary.StoreProfitabilityAndLeaseInfo.LastRemodelDate;
            //    worksheet.Cells["B44"].Value = reimageSummary.StoreProfitabilityAndLeaseInfo.RemainingLeaseYears;
            //    worksheet.Cells["B45"].Value = reimageSummary.StoreProfitabilityAndLeaseInfo.TTMSales;
            //    worksheet.Cells["B46"].Value = reimageSummary.StoreProfitabilityAndLeaseInfo.TTMSOIPercent;
            //    worksheet.Cells["B47"].Value = reimageSummary.StoreProfitabilityAndLeaseInfo.AsOf;
            //}

            ////worksheet.Cells["B48"].Value = reimageSummary.OperationRequirements;
            //if (reimageSummary.FinancialPreanalysis != null)
            //{
            //    worksheet.Cells["B49"].Value = reimageSummary.FinancialPreanalysis.TotalSalesInc;
            //    worksheet.Cells["B50"].Value = reimageSummary.FinancialPreanalysis.StoreCM;
            //    worksheet.Cells["B51"].Value = reimageSummary.FinancialPreanalysis.CurrentPriceTier;
            //    worksheet.Cells["B52"].Value = reimageSummary.FinancialPreanalysis.ISDWIP;
            //    worksheet.Cells["B53"].Value = reimageSummary.FinancialPreanalysis.SPTAR;

            //}
        }
Beispiel #13
0
        //private string GetCellValue(decimal? val)
        //{
        //    string result = string.Empty;
        //    if (val.HasValue)
        //    {
        //        result = val.Value.ToString("f2");
        //    }
        //    return result;
        //}
        public override void Input(OfficeOpenXml.ExcelWorksheet worksheet, ExcelInputDTO inputInfo)
        {
            var         closureInfo   = ClosureInfo.GetByProjectId(inputInfo.ProjectId);
            var         storeInfo     = StoreBasicInfo.FirstOrDefault(s => s.StoreCode == closureInfo.USCode);
            var         storeContract = StoreContractInfo.Get(storeInfo.StoreCode);
            ClosureTool closureTool   = ClosureTool.Get(inputInfo.ProjectId);

            //ClosureWOCheckList closureWoCheckList = ClosureWOCheckList.Get(inputInfo.ProjectId);
            worksheet.Cells["B2"].Value = storeInfo.Market;
            worksheet.Cells["B3"].Value = storeInfo.StoreCode;
            worksheet.Cells["B4"].Value = storeInfo.NameZHCN;

            worksheet.Cells["B5"].Value = storeInfo.OpenDate.ToString("yyyy-MM-dd");
            if (storeContract != null)
            {
                worksheet.Cells["B6"].Value = storeContract.PartyAFullName;
                worksheet.Cells["B7"].Value = storeContract.EndDate.HasValue ? storeContract.EndDate.Value.ToString("yyyy-MM-dd") : "";
            }
            worksheet.Cells["B8"].Value = closureInfo.ClosureTypeNameZHCN;

            if (closureInfo.ActualCloseDate != null)
            {
                worksheet.Cells["B9"].Value = closureInfo.ActualCloseDate.Value.ToString("yyyy-MM-dd");
            }
            worksheet.Cells["B10"].Value = closureTool.Product_Sales_RMB_Adjustment;
            worksheet.Cells["B11"].Value = closureTool.PAC_RMB_Adjustment;


            worksheet.Cells["B12"].Value = closureTool.Rent_RMB_Adjustment;



            worksheet.Cells["B13"].Value = closureTool.DepreciationLHI_RMB_Adjustment;


            worksheet.Cells["B14"].Value = closureTool.InterestLHI_RMB_Adjustment;



            //INTEREST LHI
            // worksheet.Cells[15, 2].Value = closureTool..ToString();

            worksheet.Cells["B15"].Value = closureTool.ServiceFee_RMB_Adjustment;


            worksheet.Cells["B16"].Value = closureTool.Accounting_RMB_Adjustment;


            worksheet.Cells["B17"].Value = closureTool.Accounting_RMB_Adjustment;


            worksheet.Cells["B18"].Value = closureTool.TaxesLicenses_RMB_Adjustment;


            worksheet.Cells["B19"].Value = closureTool.Depreciation_ESSD_RMB_Adjustment;


            worksheet.Cells["B20"].Value = closureTool.Interest_ESSD_RMB_Adjustment;


            worksheet.Cells["B21"].Value = closureTool.OtherIncExp_RMB_Adjustment;

            worksheet.Cells["B22"].Value = closureTool.NonProduct_Sales_RMB_Adjustment;
            worksheet.Cells["B23"].Value = closureTool.NonProduct_Costs_RMB_Adjustment;
            worksheet.Cells["B24"].Value = closureTool.CompSalesMacket_Adjustment;
            worksheet.Cells["B25"].Value = closureTool.CompCG_Adjustment;
            worksheet.Cells["B26"].Value = closureTool.CompCGMacket_Adjustment;
            worksheet.Cells["B27"].Value = closureTool.PACMarket_Adjustment;
            worksheet.Cells["B28"].Value = closureTool.SOIMarket_Adjustment;
            worksheet.Cells["B29"].Value = closureTool.TotalSales_TTMY1;
            worksheet.Cells["B30"].Value = closureTool.CompSales_TTMY1;
            worksheet.Cells["B31"].Value = closureTool.CompSales_Market_TTMY1;
            worksheet.Cells["B32"].Value = closureTool.CompGC_TTMY1;
            worksheet.Cells["B33"].Value = closureTool.CompGCMarket_TTMY1;

            worksheet.Cells["B34"].Value = closureTool.PAC_TTMY1;
            worksheet.Cells["B35"].Value = closureTool.PACMarket_TTMY1;

            worksheet.Cells["B36"].Value = closureTool.SOI_TTMY1;
            worksheet.Cells["B37"].Value = closureTool.SOIMarket_TTMY1;

            worksheet.Cells["B38"].Value = closureTool.CashFlow_TTMY1;
            worksheet.Cells["B39"].Value = closureTool.TotalSales_TTMY2;
            //sheet.Cells[36, 2].Value = closureTool.cashflow.ToString();


            worksheet.Cells["B40"].Value = closureTool.CompSales_TTMY2;
            worksheet.Cells["B41"].Value = closureTool.CompSales_Market_TTMY2;

            worksheet.Cells["B42"].Value = closureTool.CompGC_TTMY2;
            worksheet.Cells["B43"].Value = closureTool.CompGCMarket_TTMY2;

            worksheet.Cells["B44"].Value = closureTool.PAC_TTMY2;
            worksheet.Cells["B45"].Value = closureTool.PACMarket_TTMY2;

            worksheet.Cells["B46"].Value = closureTool.SOI_TTMY2;
            worksheet.Cells["B47"].Value = closureTool.SOIMarket_TTMY2;

            worksheet.Cells["B48"].Value = closureTool.CashFlow_TTMY2;
            worksheet.Cells["B49"].Value = DateTime.Now.Year + " July";
            var woEntity = ClosureWOCheckList.Get(closureTool.ProjectId);

            if (woEntity != null)
            {
                worksheet.Cells["B50"].Value = woEntity.RE_Original;
                worksheet.Cells["B51"].Value = woEntity.LHI_Original;
                worksheet.Cells["B52"].Value = woEntity.ESSD_Original;
                worksheet.Cells["B53"].Value = woEntity.RE_NBV;
                worksheet.Cells["B54"].Value = woEntity.LHI_NBV;
                worksheet.Cells["B55"].Value = woEntity.ESSD_NBV;
                worksheet.Cells["B56"].Value = woEntity.EquipmentTransfer;
                worksheet.Cells["B57"].Value = woEntity.ClosingCost;
            }

            var list = ClosureToolImpactOtherStore.Search(e => e.ClosureId == closureTool.Id).AsNoTracking().ToList();

            if (list.Count > 0)
            {
                worksheet.Cells["B58"].Value = list[0].StoreCode;
                worksheet.Cells["B59"].Value = list[0].NameZHCN;
                worksheet.Cells["B60"].Value = list[0].ImpactSaltes;
            }

            if (list.Count > 1)
            {
                worksheet.Cells["B61"].Value = list[1].StoreCode;
                worksheet.Cells["B62"].Value = list[1].NameZHCN;
                worksheet.Cells["B63"].Value = list[1].ImpactSaltes;
            }



            worksheet.Cells["B64"].Value = closureTool.McppcoMargin;


            worksheet.Cells["B65"].Value = closureTool.MccpcoCashFlow;

            worksheet.Cells["B66"].Value = closureTool.Compensation;


            worksheet.Cells["B67"].Value = closureTool.CompAssumption;


            worksheet.Cells["B68"].Value = closureTool.CashflowGrowth;

            if (closureTool.IsOptionOffered.HasValue)
            {
                worksheet.Cells["B69"].Value = closureTool.IsOptionOffered.Value ? "Yes" : "No";
            }
            worksheet.Cells["B70"].Value = closureTool.LeaseTerm;


            worksheet.Cells["B71"].Value = closureTool.Investment;


            worksheet.Cells["B72"].Value = closureTool.NPVRestaurantCashflows;

            if (closureTool.Yr1SOI != null)
            {
                worksheet.Cells["B73"].Value = closureTool.Yr1SOI;
            }

            if (closureTool.Yr1SOI != null)
            {
                worksheet.Cells["B74"].Value = closureTool.IRR;
            }

            if (closureTool.ConclusionComment != null)
            {
                worksheet.Cells["B76"].Value = closureTool.ConclusionComment;
            }
        }
Beispiel #14
0
        public IHttpActionResult GetAttachments(string projectId)
        {
            var leaseRecapID = StoreContractInfo.SearchByProject(projectId).FirstOrDefault().LeaseRecapID ?? 0;

            return(Ok(StoreContractInfoAttached.Search(c => c.LeaseRecapID == leaseRecapID.ToString()).ToList()));
        }
Beispiel #15
0
 public IHttpActionResult StoreSearch(string usCode)
 {
     return(Ok(StoreContractInfo.GetContractByUsCode(usCode)));
 }