Пример #1
0
        public static List <SelectItem> GetSelectYearMonth(string uscode)
        {
            var financeData = DataSync_LDW_AM_STFinanceData.Search(f => f.UsCode == uscode)
                              .Distinct()
                              .OrderByDescending(e => e.FinanceYear)
                              .ThenByDescending(e => e.FinanceMonth).Take(12).ToList();
            List <SelectItem> returnList = new List <SelectItem>();
            var index = 0;

            foreach (var item in financeData)
            {
                SelectItem sItem     = new SelectItem();
                var        yearMonth = item.FinanceYear + "-" + item.FinanceMonth;
                sItem.Name  = yearMonth;
                sItem.Value = item.Total_Sales_TTM;
                if (index == 0)
                {
                    sItem.Selected = true;
                }
                else
                {
                    sItem.Selected = false;
                }
                index++;
                returnList.Add(sItem);
            }
            return(returnList);
        }
Пример #2
0
        public static string GetTTFinanceData(string uscode)
        {
            var financeData = DataSync_LDW_AM_STFinanceData.Search(f => f.UsCode == uscode)
                              .OrderByDescending(e => e.FinanceYear)
                              .ThenByDescending(e => e.FinanceMonth)
                              .FirstOrDefault();

            string returnVal = "";

            if (financeData != null)
            {
                returnVal = financeData.Total_Sales_TTM;
            }
            return(returnVal);
        }
Пример #3
0
        public FinancialPreanalysis LoadFinancialPreanalysisInfo()
        {
            var stFinanceData =
                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;

            using (var context = GetDb())
            {
                var query = from financeData in context.DataSync_LDW_AM_STFinanceData
                            join financeData2 in context.DataSync_LDW_AM_STFinanceData2
                            on new { financeData.UsCode, financeData.FinanceYear, financeData.FinanceMonth } equals
                new { financeData2.UsCode, financeData2.FinanceYear, financeData2.FinanceMonth }
                where financeData.FinanceMonth == latestMonth
                select new
                {
                    TTMSales         = financeData == null ? "" : financeData.Total_Sales_TTM,
                    ROI              = financeData2 == null ? "" : financeData2.C_ROI_TTM,
                    CurrentPriceTier = financeData2 == null ? "" : financeData2.Price_Tier
                };

                var result = query.FirstOrDefault();

                return(new FinancialPreanalysis()
                {
                    TTMSales = result.TTMSales.As <decimal>(),
                    ROI = result.ROI,
                    CurrentPriceTier = result.CurrentPriceTier
                });
            }
        }
Пример #4
0
        public static TTMFinanceData GetFinanceData(string projectId, string financeYear = "", string financeMonth = "")
        {
            var ldw_FinanceData = LDW_FinanceData.Get(projectId);
            var ttmData         = new TTMFinanceData();

            if (string.IsNullOrEmpty(financeYear) && string.IsNullOrEmpty(financeMonth) && ldw_FinanceData != null)
            {
                ttmData.Accounting       = DataConverter.ToDecimal(ldw_FinanceData.Accounting_TTM);
                ttmData.DepreciationEssd = DataConverter.ToDecimal(ldw_FinanceData.Depreciation_Essd_TTM);
                ttmData.DepreciationLhi  = DataConverter.ToDecimal(ldw_FinanceData.Depreciation_LHI_TTM);
                ttmData.NonProductCosts  = DataConverter.ToDecimal(ldw_FinanceData.Non_Product_Costs_TTM);
                ttmData.NonProductSales  = DataConverter.ToDecimal(ldw_FinanceData.Non_Product_Sales_TTM);
                ttmData.Insurance        = DataConverter.ToDecimal(ldw_FinanceData.Insurance_TTM);

                ttmData.InterestEssd     = DataConverter.ToDecimal(ldw_FinanceData.Interest_Essd_TTM);
                ttmData.InterestLhi      = DataConverter.ToDecimal(ldw_FinanceData.Interest_LHI_TTM);
                ttmData.OtherIncExp      = DataConverter.ToDecimal(ldw_FinanceData.Other_Exp_TTM);
                ttmData.Pac              = DataConverter.ToDecimal(ldw_FinanceData.Pac_TTM);
                ttmData.ProductSales     = DataConverter.ToDecimal(ldw_FinanceData.ProductSales_TTM);
                ttmData.Rent             = DataConverter.ToDecimal(ldw_FinanceData.Rent_TTM);
                ttmData.ServiceFee       = DataConverter.ToDecimal(ldw_FinanceData.Service_Fee_TTM);
                ttmData.TaxesAndLicenses = DataConverter.ToDecimal(ldw_FinanceData.Taxes_Licenses_TTM);
                ttmData.CompSales        = DataConverter.ToDecimal(ldw_FinanceData.comp_sales_ttm);
            }
            else
            {
                var yearMonthObj = StoreSTMonthlyFinaceInfoTTM.FirstOrDefault(f => true);
                if (string.IsNullOrEmpty(financeYear))
                {
                    if (yearMonthObj != null && !string.IsNullOrEmpty(yearMonthObj.TTMValue))
                    {
                        financeYear = yearMonthObj.TTMValue.Substring(0, yearMonthObj.TTMValue.IndexOf('-'));
                    }
                    else
                    {
                        financeYear = Utils.GetLatestYear();
                    }
                }
                if (string.IsNullOrEmpty(financeMonth))
                {
                    if (yearMonthObj != null && !string.IsNullOrEmpty(yearMonthObj.TTMValue))
                    {
                        financeMonth = yearMonthObj.TTMValue.Substring(yearMonthObj.TTMValue.IndexOf('-') + 1);
                    }
                    else
                    {
                        financeMonth = Utils.GetLatestMonth();
                    }
                }
                var uscode       = RenewalInfo.Get(projectId).USCode;
                var storeId      = StoreBasicInfo.Search(s => s.StoreCode.Equals(uscode)).Select(id => id.StoreID).FirstOrDefault();
                var financeData  = DataSync_LDW_AM_STFinanceData.FirstOrDefault(f => f.UsCode == uscode && f.FinanceYear.Equals(financeYear) && f.FinanceMonth.Equals(financeMonth));
                var financeData2 = DataSync_LDW_AM_STFinanceData2.FirstOrDefault(f => f.UsCode == uscode && f.FinanceYear.Equals(financeYear) && f.FinanceMonth.Equals(financeMonth));
                var re           = DataSync_LDW_AM_STMonthlyFinaceInfo.Search(f => f.StoreID == storeId).OrderByDescending(f => f.Year).FirstOrDefault();

                ttmData.Accounting       = DataConverter.ToDecimal(financeData2.Accounting_TTM);
                ttmData.DepreciationEssd = DataConverter.ToDecimal(financeData2.Depreciation_Essd_TTM);
                ttmData.DepreciationLhi  = DataConverter.ToDecimal(financeData2.Depreciation_LHI_TTM);
                ttmData.NonProductCosts  = DataConverter.ToDecimal(financeData2.Non_Product_Costs_TTM);
                ttmData.NonProductSales  = DataConverter.ToDecimal(financeData2.Non_Product_Sales_TTM);
                ttmData.Insurance        = DataConverter.ToDecimal(financeData2.Insurance_TTM);
                ttmData.InterestEssd     = DataConverter.ToDecimal(financeData2.Interest_Essd_TTM);
                ttmData.InterestLhi      = DataConverter.ToDecimal(financeData2.Interest_LHI_TTM);
                ttmData.OtherIncExp      = DataConverter.ToDecimal(financeData2.Other_Exp_TTM);
                ttmData.Pac              = DataConverter.ToDecimal(financeData2.Pac_TTM);
                ttmData.ProductSales     = DataConverter.ToDecimal(financeData.ProductSales_TTM);
                ttmData.Rent             = DataConverter.ToDecimal(financeData2.Rent_TTM);
                ttmData.ServiceFee       = DataConverter.ToDecimal(financeData2.Service_Fee_TTM);
                ttmData.TaxesAndLicenses = DataConverter.ToDecimal(financeData2.Taxes_Licenses_TTM);
                ttmData.CompSales        = DataConverter.ToDecimal(financeData2.comp_sales_ttm);
            }
            return(ttmData);
        }