コード例 #1
0
        public static bool BenifitCalculationOfPeriod(GLBenifitCalcsInfo benifitInfo)
        {
            if (benifitInfo.FK_GEPeriodID.HasValue == false || benifitInfo.GLBenifitCalcID == Guid.Empty)
            {
                return(false);
            }

            GEPeriodsInfo period = new GEPeriodsController().GetObjectByID(benifitInfo.FK_GEPeriodID.Value) as GEPeriodsInfo;

            if (period == null)
            {
                return(false);
            }

            DateTime startDate = new DateTime(period.Year.Value, period.Month.Value, 1);
            DateTime endDate   = startDate.AddMonths(1).AddSeconds(-10);

            BenifitCalculationOfRange(benifitInfo, startDate, endDate);

            if (BusinessObjectHelper.IsModifiedObject(benifitInfo))
            {
                new GLBenifitCalcsController().UpdateObject(benifitInfo);
                return(true);
            }
            return(false);
        }
コード例 #2
0
        public static GLBenifitCalcsInfo BenifitCalculationOfRange(DateTime?startDate, DateTime?endDate)
        {
            GLBenifitCalcsInfo benifitInfo = new GLBenifitCalcsInfo();

            BenifitCalculationOfRange(benifitInfo, startDate, endDate);
            return(benifitInfo);
        }
コード例 #3
0
        public void LoadData( )
        {
            GLBenifitCalcsInfo benifit1 = null; //=FinancialProvider.BenifitCalculationOfRange( Time.StartDate , Time.EndDate );
            GLBenifitCalcsInfo benifit2 = null; //=FinancialProvider.BenifitCalculationOfRange( Time.StartDate , Time.EndDate );

            if (Time.StatisticType == FinanceStatisticType.Year)
            {
                benifit1 = FinancialProvider.BenifitCalculationOfRange(Time.StartDate, Time.EndDate);
                benifit2 = FinancialProvider.BenifitCalculationOfRange(Time.StartDate.AddYears(-1), Time.EndDate.AddYears(-1));
            }
            else if (Time.StatisticType == FinanceStatisticType.Quater)
            {
                benifit1 = FinancialProvider.BenifitCalculationOfRange(Time.StartDate, Time.EndDate);
                benifit2 = FinancialProvider.BenifitCalculationOfRange(Time.StartDate.AddMonths(-3), Time.EndDate.AddMonths(-3));
            }
            else if (Time.StatisticType == FinanceStatisticType.RangeDate)
            {
                benifit1 = FinancialProvider.BenifitCalculationOfRange(Time.StartDate, Time.EndDate);
                benifit2 = FinancialProvider.BenifitCalculationOfRange(DateTime.MinValue, Time.StartDate.AddSeconds(-1));
            }
            if (benifit1 == null || benifit2 == null)
            {
                return;
            }

            if (DataList.ContainsKey("01"))
            {
                DataList["01"].Current = benifit1.RevenueGrossSale;
                DataList["01"].Past    = benifit2.RevenueGrossSale;
            }
            if (DataList.ContainsKey("02"))
            {
                DataList["02"].Current = benifit1.RevenueDecrease;
                DataList["02"].Past    = benifit2.RevenueDecrease;
            }
            if (DataList.ContainsKey("10"))
            {
                DataList["10"].Current = benifit1.RevenueNetSale;
                DataList["10"].Past    = benifit2.RevenueNetSale;
            }
            if (DataList.ContainsKey("11"))
            {
                DataList["11"].Current = benifit1.CostOfGoodSolved;
                DataList["11"].Past    = benifit2.CostOfGoodSolved;
            }
            if (DataList.ContainsKey("20"))
            {
                DataList["20"].Current = benifit1.BenifitGrossSale;
                DataList["20"].Past    = benifit2.BenifitGrossSale;
            }
            if (DataList.ContainsKey("21"))
            {
                DataList["21"].Current = benifit1.RevenueCommercial;
                DataList["21"].Past    = benifit2.RevenueCommercial;
            }
            if (DataList.ContainsKey("22"))
            {
                DataList["22"].Current = benifit1.CostCommercial;
                DataList["22"].Past    = benifit2.CostCommercial;
            }
            if (DataList.ContainsKey("24"))
            {
                DataList["24"].Current = benifit1.CostSale;
                DataList["24"].Past    = benifit2.CostSale;
            }
            if (DataList.ContainsKey("25"))
            {
                DataList["25"].Current = benifit1.CostManage;
                DataList["25"].Past    = benifit2.CostManage;
            }
            if (DataList.ContainsKey("30"))
            {
                DataList["30"].Current = benifit1.BenifitNet;
                DataList["30"].Past    = benifit2.BenifitNet;
            }
            if (DataList.ContainsKey("31"))
            {
                DataList["31"].Current = benifit1.RevenueOthers;
                DataList["31"].Past    = benifit2.RevenueOthers;
            }
            if (DataList.ContainsKey("32"))
            {
                DataList["32"].Current = benifit1.CostOthers;
                DataList["32"].Past    = benifit2.CostOthers;
            }
            if (DataList.ContainsKey("40"))
            {
                DataList["40"].Current = benifit1.BenifitOthers;
                DataList["40"].Past    = benifit2.BenifitOthers;
            }
            if (DataList.ContainsKey("50"))
            {
                DataList["50"].Current = benifit1.BenifitBeforeTax;
                DataList["50"].Past    = benifit2.BenifitBeforeTax;
            }
            if (DataList.ContainsKey("51"))
            {
                DataList["51"].Current = benifit1.CostIncomeTax;
                DataList["51"].Past    = benifit2.CostIncomeTax;
            }
            if (DataList.ContainsKey("52"))
            {
                DataList["52"].Current = benifit1.CostIncomeTaxDelay;
                DataList["52"].Past    = benifit2.CostIncomeTaxDelay;
            }
            if (DataList.ContainsKey("60"))
            {
                DataList["60"].Current = benifit1.Benifit;
                DataList["60"].Past    = benifit2.Benifit;
            }

            this.gridControl1.DataSource = BindDataList;
            this.gridControl1.RefreshDataSource();


            if (Time.StatisticType == FinanceStatisticType.Year)
            {
                lblTime.Text       = "Năm " + Time.StartDate.Year;
                colCurrent.Caption = "Năm nay";
                colPast.Caption    = "Năm trước";
            }
            else if (Time.StatisticType == FinanceStatisticType.Quater)
            {
                if (Time.StartDate.Month <= 3)
                {
                    lblTime.Text = "Quý I" + " Năm " + Time.StartDate.Year;
                }
                if (4 <= Time.StartDate.Month && Time.StartDate.Month <= 6)
                {
                    lblTime.Text = "Quý II" + " Năm " + Time.StartDate.Year;
                }
                if (7 <= Time.StartDate.Month && Time.StartDate.Month <= 9)
                {
                    lblTime.Text = "Quý III" + " Năm " + Time.StartDate.Year;
                }
                if (10 <= Time.StartDate.Month && Time.StartDate.Month <= 12)
                {
                    lblTime.Text = "Quý IV" + " Năm " + Time.StartDate.Year;
                }

                colCurrent.Caption = "Quý này";
                colPast.Caption    = "Quý trước";
            }
            else if (Time.StatisticType == FinanceStatisticType.RangeDate)
            {
                lblTime.Text = "";
                if (Time.StartDate != DateTime.MinValue)
                {
                    lblTime.Text = "Từ ngày " + Time.StartDate.ToString("dd/MM/yyyy");
                }
                if (Time.EndDate != DateTime.MaxValue)
                {
                    lblTime.Text += " đến ngày " + Time.EndDate.ToString("dd/MM/yyyy");
                }

                colCurrent.Caption = "Kỳ này";
                colPast.Caption    = "Kỳ trước";
            }
        }
コード例 #4
0
        public static void PostBenifitCalculation(GLBenifitCalcsInfo mainObject)
        {
            if (mainObject.FK_GEPeriodID.HasValue == false || mainObject.GLBenifitCalcID == Guid.Empty)
            {
                return;
            }

            if (AccountingProvider.GetAccountID("911") == Guid.Empty)
            {
                return;
            }

            if (mainObject.FK_GLJournalVoucherID != Guid.Empty)
            {
                new GLJournalEntrysController().RealDeleteObjectsByFK("FK_GLJournalVoucherID", mainObject.FK_GLJournalVoucherID.Value);
                Guid iID = mainObject.FK_GLJournalVoucherID.Value;
                mainObject.FK_GLJournalVoucherID = null;
                new GLBenifitCalcsController().UpdateObject(mainObject);
                new GLJournalVouchersController().RealDeleteObject(iID);
            }

            DateTime startDate = PeriodProvider.GetFirstDay(mainObject.FK_GEPeriodID.Value);
            DateTime endDate   = PeriodProvider.GetLastDay(mainObject.FK_GEPeriodID.Value);

            #region Voucher
            GLJournalVouchersController voucherCtrl = new GLJournalVouchersController();
            GLJournalVouchersInfo       voucher     = new GLJournalVouchersInfo();
            BusinessObjectHelper.CopyObject(mainObject, voucher, false);

            //voucher.FK_GLVoucherTypeID="BenifitCalc";
            voucher.ERPVoucherID        = mainObject.GLBenifitCalcID;
            voucher.ERPVoucherTableName = "GLBenifitCalcs";
            voucher.JournalDate         = endDate;

            voucher.ApprovalStatus = ABCCommon.ABCConstString.ApprovalTypeApproved;

            voucher.Remark = String.Format("Xác định kết quả kinh doanh tháng {0}/{1}", startDate.Month, startDate.Year);

            voucherCtrl.CreateObject(voucher);

            mainObject.FK_GLJournalVoucherID = voucher.GLJournalVoucherID;
            mainObject.ApprovalStatus        = ABCCommon.ABCConstString.ApprovalTypeApproved;
            new GLBenifitCalcsController().UpdateObject(mainObject);
            #endregion

            Guid Acc911ID = AccountingProvider.GetAccountID("911");

            GLJournalEntrysController  entryCtrl = new GLJournalEntrysController();
            List <GLJournalEntrysInfo> lstEntrys = new List <GLJournalEntrysInfo>();

            String strRemark = String.Format(" tháng {0}/{1}", startDate.Month, startDate.Year);


            if (AccountingProvider.GetAccountID("511") != Guid.Empty)
            {
                lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("511"), Acc911ID, true, startDate, endDate, "", "Kết chuyển doanh thu thuần bán hàng" + strRemark));
            }
            if (AccountingProvider.GetAccountID("512") != Guid.Empty)
            {
                lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("512"), Acc911ID, true, startDate, endDate, "", "Kết chuyển doanh thu thuần bán hàng nội bộ" + strRemark));
            }

            if (AccountingProvider.GetAccountID("632") != Guid.Empty)
            {
                lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("632"), Acc911ID, true, startDate, endDate, "", "Kết chuyển giá vốn hàng bán" + strRemark));
            }

            if (AccountingProvider.GetAccountID("515") != Guid.Empty)
            {
                lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("515"), Acc911ID, true, startDate, endDate, "", "Kết chuyển doanh thu hoạt động tài chính" + strRemark));
            }

            if (AccountingProvider.GetAccountID("635") != Guid.Empty)
            {
                lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("635"), Acc911ID, true, startDate, endDate, "", "Kết chuyển chi phí tài chính" + strRemark));
            }

            if (AccountingProvider.GetAccountID("641") != Guid.Empty)
            {
                lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("641"), Acc911ID, true, startDate, endDate, "", "Kết chuyển chi phí bán hàng" + strRemark));
            }

            if (AccountingProvider.GetAccountID("642") != Guid.Empty)
            {
                lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("642"), Acc911ID, true, startDate, endDate, "", "Kết chuyển chi phí quản lý doanh nghiệp" + strRemark));
            }

            if (AccountingProvider.GetAccountID("711") != Guid.Empty)
            {
                lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("711"), Acc911ID, true, startDate, endDate, "", "Kết chuyển thu nhập khác" + strRemark));
            }

            if (AccountingProvider.GetAccountID("811") != Guid.Empty)
            {
                lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("811"), Acc911ID, true, startDate, endDate, "", "Kết chuyển chi phí khác" + strRemark));
            }

            if (AccountingProvider.GetAccountID("8211") != Guid.Empty)
            {
                lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("8211"), Acc911ID, true, startDate, endDate, "", "Kết chuyển chi phí thuế TNDN phải nộp" + strRemark));
            }

            if (AccountingProvider.GetAccountID("8212") != Guid.Empty)
            {
                lstEntrys.AddRange(GenerateCloseEntrys(AccountingProvider.GetAccountID("8212"), Acc911ID, true, startDate, endDate, "", "Kết chuyển chi phí thuế TNDN hoãn lại" + strRemark));
            }

            foreach (GLJournalEntrysInfo entry in lstEntrys)
            {
                if (AccountForReCalcList.Contains(entry.FK_GLAccountID_Debit) == false)
                {
                    AccountForReCalcList.Add(entry.FK_GLAccountID_Debit);
                }
                if (AccountForReCalcList.Contains(entry.FK_GLAccountID_Credit) == false)
                {
                    AccountForReCalcList.Add(entry.FK_GLAccountID_Credit);
                }

                entry.FK_GLJournalVoucherID = voucher.GLJournalVoucherID;
                entry.JournalDate           = endDate;
                entry.ApprovalStatus        = ABCCommon.ABCConstString.ApprovalTypeApproved;
                entryCtrl.CreateObject(entry);
            }

            lstEntrys.Clear();

            if (AccountingProvider.GetAccountID("4212") != Guid.Empty)
            {
                lstEntrys.AddRange(GenerateCloseEntrys(Acc911ID, AccountingProvider.GetAccountID("4212"), true, startDate, endDate, "", "Kết chuyển Lợi Nhuận" + strRemark));
            }
            foreach (GLJournalEntrysInfo entry in lstEntrys)
            {
                if (AccountForReCalcList.Contains(entry.FK_GLAccountID_Debit) == false)
                {
                    AccountForReCalcList.Add(entry.FK_GLAccountID_Debit);
                }
                if (AccountForReCalcList.Contains(entry.FK_GLAccountID_Credit) == false)
                {
                    AccountForReCalcList.Add(entry.FK_GLAccountID_Credit);
                }

                entry.FK_GLJournalVoucherID = voucher.GLJournalVoucherID;
                entry.JournalDate           = endDate;
                entry.ApprovalStatus        = ABCCommon.ABCConstString.ApprovalTypeApproved;
                entryCtrl.CreateObject(entry);
            }

            BenifitCalculationOfPeriod(mainObject);
        }
コード例 #5
0
        public static void BenifitCalculate( )
        {
            object   objTime       = BusinessObjectController.GetData(String.Format(@"SELECT MAX(JournalDate) FROM GLJournalEntrys WHERE ABCStatus ='Alive'  AND (EntryType IS NULL OR  EntryType != '{0}')", ABCCommon.ABCConstString.EntryTypePeriodEnding));
            DateTime currentPeriod = Convert.ToDateTime(objTime.ToString());

            if (currentPeriod == null || currentPeriod.Year <= 1000)
            {
                return;
            }

            AccountForReCalcList.Clear();

            GLBenifitCalcsController benifitCalcCtrl = new GLBenifitCalcsController();

            List <BusinessObject> lstPeriods = new GEPeriodsController().GetListAllObjects();

            foreach (GEPeriodsInfo period in lstPeriods)
            {
                if (period.Period.HasValue == false || period.Closed)
                {
                    continue;
                }

                GLBenifitCalcsInfo benifitInfo = benifitCalcCtrl.GetObjectByColumn("FK_GEPeriodID", period.GEPeriodID) as GLBenifitCalcsInfo;
                if (benifitInfo == null)
                {
                    DateTime dtStart = new DateTime(SystemProvider.AppConfig.StartDate.Value.Year, SystemProvider.AppConfig.StartDate.Value.Month, 1);
                    if (dtStart <= period.Period.Value && period.Period.Value <= currentPeriod)
                    {
                        benifitInfo = new GLBenifitCalcsInfo();
                        benifitInfo.FK_GEPeriodID  = period.GEPeriodID;
                        benifitInfo.Month          = period.Month;
                        benifitInfo.Year           = period.Year;
                        benifitInfo.Period         = period.Period;
                        benifitInfo.ApprovalStatus = ABCCommon.ABCConstString.ApprovalTypeNew;
                        benifitCalcCtrl.CreateObject(benifitInfo);

                        if (BenifitCalculationOfPeriod(benifitInfo))
                        {
                            if (period.Period.Value.Year != currentPeriod.Year || period.Period.Value.Month != currentPeriod.Month)
                            {
                                PostBenifitCalculation(benifitInfo);
                            }
                        }
                    }
                }
                else
                {
                    if (period.Period.Value.Year == currentPeriod.Year && period.Period.Value.Month == currentPeriod.Month)
                    {
                        BenifitCalculationOfPeriod(benifitInfo);
                    }
                    else
                    {
                        if (period.Period.Value.AddMonths(1).Year == currentPeriod.Year && period.Period.Value.AddMonths(1).Month == currentPeriod.Month)
                        {
                            if (BenifitCalculationOfPeriod(benifitInfo) || benifitInfo.ApprovalStatus != ABCCommon.ABCConstString.ApprovalTypeApproved)
                            {
                                PostBenifitCalculation(benifitInfo);
                            }
                        }
                    }
                }
            }

            foreach (Guid iAccountID in AccountForReCalcList)
            {
                AccountingProvider.CalculateAccount(iAccountID);
            }

            DataCachingProvider.RefreshLookupTable("GLJournalVouchers");
        }
コード例 #6
0
        public static void BenifitCalculationOfRange(GLBenifitCalcsInfo benifitInfo, DateTime?startDate, DateTime?endDate)
        {
            #region BenifitGrossSale

            #region RevenueGrossSale
            benifitInfo.RevenueGrossSale = 0;
            if (AccountingProvider.GetAccountID("511") != Guid.Empty)
            {
                benifitInfo.RevenueGrossSale += AccountingProvider.GetCreditAmount(AccountingProvider.GetAccountID("511"), startDate, endDate, " (EntryType IS NULL OR EntryType != 'PeriodEnding') ", true);
                benifitInfo.RevenueGrossSale -= AccountingProvider.GetDebitAmount(AccountingProvider.GetAccountID("511"), startDate, endDate, " (EntryType IS NULL OR EntryType != 'PeriodEnding') ", true);
            }
            if (AccountingProvider.GetAccountID("512") != Guid.Empty)
            {
                benifitInfo.RevenueGrossSale += AccountingProvider.GetCreditAmount(AccountingProvider.GetAccountID("512"), startDate, endDate, " (EntryType IS NULL OR EntryType != 'PeriodEnding') ", true);
                benifitInfo.RevenueGrossSale -= AccountingProvider.GetDebitAmount(AccountingProvider.GetAccountID("512"), startDate, endDate, " (EntryType IS NULL OR EntryType != 'PeriodEnding') ", true);
            }
            #endregion

            #region RevenueDecrease
            benifitInfo.RevenueDecreaseTax = 0;
            benifitInfo.RevenueDecreaseCommercialDiscount = 0;
            benifitInfo.RevenueDecreaseSaleDiscount       = 0;
            benifitInfo.RevenueDecreaseReturnGood         = 0;

            #region RevenueDecreaseTax
            if (AccountingProvider.GetAccountID("3332") != Guid.Empty)
            {
                if (AccountingProvider.GetAccountID("511") != Guid.Empty)
                {
                    benifitInfo.RevenueDecreaseTax += AccountingProvider.GetJournalAmount(AccountingProvider.GetAccountID("511"),
                                                                                          AccountingProvider.GetAccountID("3332")
                                                                                          , startDate, endDate, " (EntryType IS NULL OR EntryType != 'PeriodEnding') ", true);
                }

                if (AccountingProvider.GetAccountID("512") != Guid.Empty)
                {
                    benifitInfo.RevenueDecreaseTax += AccountingProvider.GetJournalAmount(AccountingProvider.GetAccountID("512"),
                                                                                          AccountingProvider.GetAccountID("3332")
                                                                                          , startDate, endDate, " (EntryType IS NULL OR EntryType != 'PeriodEnding') ", true);
                }
            }

            if (AccountingProvider.GetAccountID("3333") != Guid.Empty)
            {
                if (AccountingProvider.GetAccountID("511") != Guid.Empty)
                {
                    benifitInfo.RevenueDecreaseTax += AccountingProvider.GetJournalAmount(AccountingProvider.GetAccountID("511"),
                                                                                          AccountingProvider.GetAccountID("3333")
                                                                                          , startDate, endDate, " (EntryType IS NULL OR EntryType != 'PeriodEnding') ", true);
                }
                if (AccountingProvider.GetAccountID("512") != Guid.Empty)
                {
                    benifitInfo.RevenueDecreaseTax += AccountingProvider.GetJournalAmount(AccountingProvider.GetAccountID("512"),
                                                                                          AccountingProvider.GetAccountID("3333")
                                                                                          , startDate, endDate, " (EntryType IS NULL OR EntryType != 'PeriodEnding') ", true);
                }
            }
            #endregion

            #region RevenueDecreaseCommercialDiscount
            if (AccountingProvider.GetAccountID("521") != Guid.Empty)
            {
                if (AccountingProvider.GetAccountID("511") != Guid.Empty)
                {
                    benifitInfo.RevenueDecreaseCommercialDiscount += AccountingProvider.GetJournalAmount(AccountingProvider.GetAccountID("511"),
                                                                                                         AccountingProvider.GetAccountID("521")
                                                                                                         , startDate, endDate, " (EntryType IS NULL OR EntryType != 'PeriodEnding') ", true);
                }
                if (AccountingProvider.GetAccountID("512") != Guid.Empty)
                {
                    benifitInfo.RevenueDecreaseCommercialDiscount += AccountingProvider.GetJournalAmount(AccountingProvider.GetAccountID("512"),
                                                                                                         AccountingProvider.GetAccountID("521")
                                                                                                         , startDate, endDate, " (EntryType IS NULL OR EntryType != 'PeriodEnding') ", true);
                }
            }
            #endregion

            #region RevenueDecreaseSaleDiscount
            if (AccountingProvider.GetAccountID("532") != Guid.Empty)
            {
                if (AccountingProvider.GetAccountID("511") != Guid.Empty)
                {
                    benifitInfo.RevenueDecreaseSaleDiscount += AccountingProvider.GetJournalAmount(AccountingProvider.GetAccountID("511"),
                                                                                                   AccountingProvider.GetAccountID("532")
                                                                                                   , startDate, endDate, " (EntryType IS NULL OR EntryType != 'PeriodEnding') ", true);
                }
                if (AccountingProvider.GetAccountID("512") != Guid.Empty)
                {
                    benifitInfo.RevenueDecreaseSaleDiscount += AccountingProvider.GetJournalAmount(AccountingProvider.GetAccountID("512"),
                                                                                                   AccountingProvider.GetAccountID("532")
                                                                                                   , startDate, endDate, " (EntryType IS NULL OR EntryType != 'PeriodEnding') ", true);
                }
            }
            #endregion

            #region RevenueDecreaseReturnGood
            if (AccountingProvider.GetAccountID("531") != Guid.Empty)
            {
                if (AccountingProvider.GetAccountID("511") != Guid.Empty)
                {
                    benifitInfo.RevenueDecreaseReturnGood += AccountingProvider.GetJournalAmount(AccountingProvider.GetAccountID("511"),
                                                                                                 AccountingProvider.GetAccountID("531")
                                                                                                 , startDate, endDate, " (EntryType IS NULL OR EntryType != 'PeriodEnding') ", true);
                }
                if (AccountingProvider.GetAccountID("512") != Guid.Empty)
                {
                    benifitInfo.RevenueDecreaseReturnGood += AccountingProvider.GetJournalAmount(AccountingProvider.GetAccountID("512"),
                                                                                                 AccountingProvider.GetAccountID("531")
                                                                                                 , startDate, endDate, " (EntryType IS NULL OR EntryType != 'PeriodEnding') ", true);
                }
            }
            #endregion

            benifitInfo.RevenueDecrease = benifitInfo.RevenueDecreaseTax + benifitInfo.RevenueDecreaseCommercialDiscount
                                          + benifitInfo.RevenueDecreaseSaleDiscount + benifitInfo.RevenueDecreaseReturnGood;

            #endregion

            benifitInfo.RevenueNetSale = benifitInfo.RevenueGrossSale - benifitInfo.RevenueDecrease;

            #region CostOfGoodSolved
            benifitInfo.CostOfGoodSolved = 0;
            if (AccountingProvider.GetAccountID("632") != Guid.Empty)
            {
                benifitInfo.CostOfGoodSolved = AccountingProvider.GetJournalAmount(AccountingProvider.GetAccountID("911"), AccountingProvider.GetAccountID("632"), startDate, endDate, "", true);
            }
            #endregion

            benifitInfo.BenifitGrossSale = benifitInfo.RevenueNetSale - benifitInfo.CostOfGoodSolved;

            #endregion

            #region BenifitComercial

            #region RevenueCommercial
            benifitInfo.RevenueCommercial = 0;
            if (AccountingProvider.GetAccountID("515") != Guid.Empty)
            {
                benifitInfo.RevenueCommercial = AccountingProvider.GetJournalAmount(AccountingProvider.GetAccountID("515"), AccountingProvider.GetAccountID("911"), startDate, endDate, "", true);
            }

            #endregion

            #region CostCommercial
            benifitInfo.CostCommercial = 0;
            if (AccountingProvider.GetAccountID("635") != Guid.Empty)
            {
                benifitInfo.CostCommercial = AccountingProvider.GetJournalAmount(AccountingProvider.GetAccountID("911"), AccountingProvider.GetAccountID("635"), startDate, endDate, "", true);
            }

            #endregion

            benifitInfo.CostLoan = 0;

            benifitInfo.BenifitComercial = benifitInfo.RevenueCommercial - benifitInfo.CostCommercial - benifitInfo.CostLoan;

            #endregion

            #region CostSale
            benifitInfo.CostSale = 0;
            if (AccountingProvider.GetAccountID("641") != Guid.Empty)
            {
                benifitInfo.CostSale = AccountingProvider.GetJournalAmount(AccountingProvider.GetAccountID("911"), AccountingProvider.GetAccountID("641"), startDate, endDate, "", true);
            }

            #endregion

            #region CostManage
            benifitInfo.CostManage = 0;
            if (AccountingProvider.GetAccountID("642") != Guid.Empty)
            {
                benifitInfo.CostManage = AccountingProvider.GetJournalAmount(AccountingProvider.GetAccountID("911"), AccountingProvider.GetAccountID("642"), startDate, endDate, "", true);
            }

            #endregion

            benifitInfo.BenifitNet = benifitInfo.BenifitGrossSale + (benifitInfo.RevenueCommercial - benifitInfo.CostCommercial) - (benifitInfo.CostSale + benifitInfo.CostManage);

            #region BenifitOthers

            #region RevenueOthers
            benifitInfo.RevenueOthers = 0;
            if (AccountingProvider.GetAccountID("711") != Guid.Empty)
            {
                benifitInfo.RevenueOthers = AccountingProvider.GetJournalAmount(AccountingProvider.GetAccountID("711"), AccountingProvider.GetAccountID("911"), startDate, endDate, "", true);
            }

            #endregion

            #region CostOthers
            benifitInfo.CostOthers = 0;
            if (AccountingProvider.GetAccountID("811") != Guid.Empty)
            {
                benifitInfo.CostOthers = AccountingProvider.GetJournalAmount(AccountingProvider.GetAccountID("911"), AccountingProvider.GetAccountID("811"), startDate, endDate, "", true);
            }

            #endregion

            benifitInfo.BenifitOthers = benifitInfo.RevenueOthers - benifitInfo.CostOthers;

            #endregion

            benifitInfo.BenifitBeforeTax = benifitInfo.BenifitNet + benifitInfo.BenifitOthers;

            #region Income Tax

            #region CostIncomeTax
            benifitInfo.CostIncomeTax = 0;
            if (AccountingProvider.GetAccountID("8211") != Guid.Empty)
            {
                benifitInfo.CostIncomeTax = AccountingProvider.GetJournalAmount(AccountingProvider.GetAccountID("911"), AccountingProvider.GetAccountID("8211"), startDate, endDate, "", true);
            }

            #endregion

            #region CostIncomeTaxDelay
            benifitInfo.CostIncomeTaxDelay = 0;
            if (AccountingProvider.GetAccountID("8212") != Guid.Empty)
            {
                benifitInfo.CostIncomeTaxDelay = AccountingProvider.GetJournalAmount(AccountingProvider.GetAccountID("911"), AccountingProvider.GetAccountID("8212"), startDate, endDate, "", true);
            }

            #endregion

            #endregion

            benifitInfo.Benifit = benifitInfo.BenifitBeforeTax - benifitInfo.CostIncomeTax - benifitInfo.CostIncomeTaxDelay;
        }