Core.NETCore.BI-Examples

Z Podpora.nextis.cz
Přejít na: navigace, hledání

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

Company turnover trend (last 12 months)