Exemple #1
0
        public static string GetPriceTier(string uscode)
        {
            var financeData = DataSync_LDW_AM_STFinanceData2.Search(f => f.UsCode == uscode)
                              .OrderByDescending(e => e.FinanceYear)
                              .ThenByDescending(e => e.FinanceMonth)
                              .FirstOrDefault();
            string returnVal = "";

            if (financeData != null)
            {
                returnVal = financeData.Price_Tier;
            }
            return(returnVal);
        }
        public static List <string> GetYearMonths(string projectId, out string SelectedYearMonth)
        {
            var uscode          = RenewalInfo.FirstOrDefault(ci => ci.ProjectId == projectId).USCode;
            var yearMonthList   = DataSync_LDW_AM_STFinanceData2.Search(f => f.UsCode == uscode).Select(i => new { YearMonth = i.FinanceYear + "-" + i.FinanceMonth }).Distinct().OrderByDescending(i => i).Take(12).ToList().Select(i => { return(i.YearMonth); }).ToList();
            var ldw_financeData = LDW_FinanceData.Get(projectId);

            if (ldw_financeData != null)
            {
                SelectedYearMonth = ldw_financeData.FinanceYear + "-" + ldw_financeData.FinanceMonth;
            }
            else
            {
                SelectedYearMonth = yearMonthList.FirstOrDefault();
            }
            return(yearMonthList);
        }
        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);
        }