Core.NETCore.BI-Examples: Porovnání verzí

Z Podpora.nextis.cz
Přejít na: navigace, hledání
m (Zavadil přesunul stránku Examples na Core.NETCore.BI-Examples)
Řádka 77: Řádka 77:
  
 
=== Calculate company turnover trend (last 12 months) ===
 
=== Calculate company turnover trend (last 12 months) ===
 +
<syntaxhighlight lang="vb">
 +
 +
        Dim Result As Core.NETCore.BI.CompanyBussinesInfo.TurnoverInfo
 +
 +
        For Month As Integer = 0 To 11
 +
 +
            'Calculate date
 +
            Dim Dt As Date = DateSerial(Now.Year, Now.Month, 1).AddMonths((11 * -1) + Month)
 +
 +
            'Calculate month turnover for goods
 +
            Dim MonthGoods As New Core.NETCore.BI.CompanyBussinesInfo(Dt.Year, Dt.Month, Core.NETCore.BI.CompanyBussinesInfo.TurnoverTypes.GoodsByIssue)
 +
            Result = MonthGoods.TotalTurnover
 +
 +
            'XXXXXXXXXXXXXXXXXXXXXXXXXXXX
 +
            'Place your code to show data, stored in [Result]
 +
            'XXXXXXXXXXXXXXXXXXXXXXXXXXXX
 +
 +
            'Calculate month turnover for non-goods
 +
            Dim MonthServices As New Core.NETCore.BI.CompanyBussinesInfo(Dt.Year, Dt.Month, Core.NETCore.BI.CompanyBussinesInfo.TurnoverTypes.Services)
 +
            Result = MonthServices.TotalTurnover
 +
 +
            'XXXXXXXXXXXXXXXXXXXXXXXXXXXX
 +
            'Place your code to show data, stored in [Result]
 +
            'XXXXXXXXXXXXXXXXXXXXXXXXXXXX
 +
        Next
 +
</syntaxhighlight>
  
 
=== Calculate company debts overview (splitted by branch) ===
 
=== Calculate company debts overview (splitted by branch) ===

Verze z 11. 8. 2017, 10:52

Calculate purchase turnover for suppliers (for months)

       'Total moth count to calculate turnover
        Dim TotalMonths As Integer = 12

        'Calculate turnover info for each month
        For MonthCurrent As Integer = 0 To TotalMonths - 1

            Dim Year As Integer = Now.AddMonths((Me.PO.MonthsBack + (TotalMonths - MonthCurrent)) * -1).Year
            Dim Month As Integer = Now.AddMonths((Me.PO.MonthsBack + (TotalMonths - MonthCurrent)) * -1).Month

            '1. Declare base BI calculation class 
            Dim MonthInfo As New Core.NETCore.BI.CompanyBussinesInfo(Year, Month, Core.NETCore.BI.CompanyBussinesInfo.TurnoverTypes.GoodsByIssue)

            '2. Declare collection with supplier turnover info 
            Dim Result As System.Collections.Generic.SortedList(Of Integer, Core.NETCore.BI.CompanyBussinesInfo.SupplierTurnoverInfo)

            '3. Calculate supplier turnover info using base BI class (step 1.)
            '   FilteredInSuppliers (coma delimited string with ID's of suppliers. Example: "1,5688,45")
            '   FilteredOutSuppliers (coma delimited string with ID's of suupliers. Example: "1,5688,45")
            Result = MonthInfo.SupplierTurnover("", "")

            '4. Browse and show data for each supplier info in specified month
            For Each Item As Core.NETCore.BI.CompanyBussinesInfo.SupplierTurnoverInfo In Result.Values
                'XXXXXXXXXXXXXXXXXXXXXXXXXXXX
                'Place your code to show data, stored in [Item]
                'XXXXXXXXXXXXXXXXXXXXXXXXXXXX
            Next
        Next

Calculate sell turnover for whole company splitted by branch

        Dim Year As Integer = 2017
        Dim Month As Integer = 6

        Dim MonthInfo As Core.NETCore.BI.CompanyBussinesInfo

        Dim Result As System.Collections.Generic.SortedList(Of Integer, Core.NETCore.BI.CompanyBussinesInfo.TurnoverInfo)

        '1. Create new instance of month info BI (calculate goods by issue)
        MonthInfo = New Core.NETCore.BI.CompanyBussinesInfo(Year, Month, Core.NETCore.BI.CompanyBussinesInfo.TurnoverTypes.GoodsByIssue)
        '2. Calculate branch turnover info for specified month
        Result = MonthInfo.BranchTurnover(Core.NETCore.BI.CompanyBussinesInfo.BranchGroupMode.BranchByIssue)
        '3. Browse and show data for each branch 
        For Each BranchID As Integer In Result.Keys

            'Get item information from result collection
            Dim Item As Core.NETCore.BI.CompanyBussinesInfo.TurnoverInfo = Result.Item(BranchID)

            'Obtain turnover plan informations for specified period and branch
            Dim Plan As Core.NETCore.BI.CompanyPlans.CompanyPlanItem = Core.NETCore.BI.CompanyPlans.MonthPlan(Year, Month, BranchID)

            'XXXXXXXXXXXXXXXXXXXXXXXXXXXX
            'Place your code to show data, stored in [Item],[Plan]
            'XXXXXXXXXXXXXXXXXXXXXXXXXXXX
        Next

        '1. Create new instance of month info BI (calculate non-goods items)
        MonthInfo = New Core.NETCore.BI.CompanyBussinesInfo(Year, Month, Core.NETCore.BI.CompanyBussinesInfo.TurnoverTypes.Services)
        '2. Calculate branch turnover info for specified month
        Result = MonthInfo.BranchTurnover(Core.NETCore.BI.CompanyBussinesInfo.BranchGroupMode.BranchByIssue)
        '3. Browse and show data for each branch 
        For Each BranchID As Integer In Result.Keys

            'Get item information from result collection
            Dim Item As Core.NETCore.BI.CompanyBussinesInfo.TurnoverInfo = Result.Item(BranchID)

            'Obtain turnover plan informations for specified period and branch
            Dim Plan As Core.NETCore.BI.CompanyPlans.CompanyPlanItem = Core.NETCore.BI.CompanyPlans.MonthPlan(Year, Month, BranchID)

            'XXXXXXXXXXXXXXXXXXXXXXXXXXXX
            'Place your code to show data, stored in [Item],[Plan]
            'XXXXXXXXXXXXXXXXXXXXXXXXXXXX
        Next

Calculate company turnover trend (last 12 months)

        Dim Result As Core.NETCore.BI.CompanyBussinesInfo.TurnoverInfo

        For Month As Integer = 0 To 11

            'Calculate date
            Dim Dt As Date = DateSerial(Now.Year, Now.Month, 1).AddMonths((11 * -1) + Month)

            'Calculate month turnover for goods
            Dim MonthGoods As New Core.NETCore.BI.CompanyBussinesInfo(Dt.Year, Dt.Month, Core.NETCore.BI.CompanyBussinesInfo.TurnoverTypes.GoodsByIssue)
            Result = MonthGoods.TotalTurnover

            'XXXXXXXXXXXXXXXXXXXXXXXXXXXX
            'Place your code to show data, stored in [Result]
            'XXXXXXXXXXXXXXXXXXXXXXXXXXXX

            'Calculate month turnover for non-goods
            Dim MonthServices As New Core.NETCore.BI.CompanyBussinesInfo(Dt.Year, Dt.Month, Core.NETCore.BI.CompanyBussinesInfo.TurnoverTypes.Services)
            Result = MonthServices.TotalTurnover

            'XXXXXXXXXXXXXXXXXXXXXXXXXXXX
            'Place your code to show data, stored in [Result]
            'XXXXXXXXXXXXXXXXXXXXXXXXXXXX
        Next

Calculate company debts overview (splitted by branch)