'Created by Charles Hoffman, CPA 11/25/2014 11:56:49 AM
'Report frame code: LEGACY
  
'XXXXXXXXXXXXXXXXXXXXXXXX NETWORK: 001-General Information (http://www.xbrlsite.com/2014/Protototype/fac/GeneralInformation)
'General information



'XXXXXXXXXXXXXXXXXXXXXXXX NETWORK: 101-Balance Sheet, Classified (http://www.xbrlsite.com/2014/Protototype/fac/BalanceSheetClassified)
'Balance sheet (Classified)
'Reviewed 2014-11-21

    'Determine which statements are used
    IsClassifiedBalanceSheet = CurrentAssets

	
    'BS-Impute-01:
    If Assets = 0 and NoncurrentAssets = 0 and Assets <> LiabilitiesAndEquity and CurrentAssets = LiabilitiesAndEquity Then
        Assets = CurrentAssets
    End If
    
    'BS-Impute-02:
    If Assets = 0 and LiabilitiesAndEquity <> 0 and CurrentAssets = LiabilitiesAndEquity Then
        Assets = CurrentAssets
    End If
    
    'BS-Impute-03: 
    If Assets = 0 and NoncurrentAssets = 0 and LiabilitiesAndEquity <> 0 and (LiabilitiesAndEquity = Liabilities + Equity) Then
        Assets = CurrentAssets
    End If
    
    'BS-Impute-04:
    If NoncurrentAssets = 0 and Assets <> 0 and CurrentAssets <> 0 Then
        NoncurrentAssets = Assets - CurrentAssets
    End If
    
    'BS-Impute-05: 
    If LiabilitiesAndEquity = 0 and Assets <> 0 Then
        LiabilitiesAndEquity = Assets
    End If
    
    'BS-Impute-06: 
    If Equity = 0 and EquityAttributableToNoncontrollingInterest <> 0 and EquityAttributableToParent <> 0 Then
        Equity = EquityAttributableToParent + EquityAttributableToNoncontrollingInterest
    End If
    
    'BS-Impute-07:
    If Equity = 0 and EquityAttributableToNoncontrollingInterest = 0 and EquityAttributableToParent <> 0 Then
        Equity = EquityAttributableToParent
    End If
    
    'BS-Impute-08:
    If Equity = 0 Then
        Equity = EquityAttributableToParent + EquityAttributableToNoncontrollingInterest
    End If
    
    'BS-Impute-09: 
    If EquityAttributableToParent = 0 and Equity <> 0 and EquityAttributableToNoncontrollingInterest <> 0 Then
        EquityAttributableToParent = Equity - EquityAttributableToNoncontrollingInterest
    End If
    
    'BS-Impute-10: 
    If EquityAttributableToParent = 0 and Equity <> 0 and EquityAttributableToNoncontrollingInterest = 0 Then
        EquityAttributableToParent = Equity
    End If
    
    'BS-Impute-11: 
    If Liabilities = 0 and (Equity <> 0) Then
        Liabilities = LiabilitiesAndEquity - (CommitmentsAndContingencies + TemporaryEquity + RedeemableNoncontrollingInterest + Equity)
    End If
    
    'BS-Impute-12: 
    If NoncurrentLiabilities = 0 and Liabilities <> 0 and CurrentLiabilities <> 0 Then
        NoncurrentLiabilities = Liabilities - CurrentLiabilities
    End If
    
    'BS-Impute-13:
    If Liabilities = 0 and CurrentLiabilities <> 0 and NoncurrentLiabilities = 0 Then
        Liabilities = CurrentLiabilities
    End If
    
    'BS-Impute-14: 
    If Liabilities = 0 and CurrentLiabilities <> 0 and NoncurrentLiabilities <> 0 Then
        Liabilities = CurrentLiabilities + NoncurrentLiabilities
    End If

    'BS-Impute-15: 
    If EquityAttributableToParent <> 0 and Equity <> 0 and EquityAttributableToNoncontrollingInterest <> 0 and EquityAttributableToParent = Equity Then
        EquityAttributableToParent = Equity - EquityAttributableToNoncontrollingInterest
    End If

    'BS-Impute-16: 
    If CurrentLiabilities = 0 and NoncurrentLiabilities = 0 and Liabilities <> 0 Then
        CurrentLiabilities = Liabilities
    End If

    
    'VERIFICATION RULES: Balance Sheet relations

    BS1 = Equity - (EquityAttributableToParent + EquityAttributableToNoncontrollingInterest)
    BS2 = Assets - LiabilitiesAndEquity
    BS3 = Assets - (CurrentAssets + NoncurrentAssets)
    BS4 = Liabilities - (CurrentLiabilities + NoncurrentLiabilities)
    BS5 = LiabilitiesAndEquity - (Liabilities + CommitmentsAndContingencies + TemporaryEquity + RedeemableNoncontrollingInterest + Equity)



'XXXXXXXXXXXXXXXXXXXXXXXX NETWORK: 202-Income Statement, Multi Step (Report Operating Income) (http://www.xbrlsite.com/2014/Protototype/fac/IncomeStatementMultiStep)
'Income statement - Multi-Step, With Operating income (loss)


    'IS-Impute-01:
    If NetIncomeLoss = 0 and NetIncomeLossAttributableToParent <> 0 and NetIncomeLossAttributableToNoncontrollingInterest <> 0 Then
        NetIncomeLoss = NetIncomeLossAttributableToParent + NetIncomeLossAttributableToNoncontrollingInterest
    End If

    'IS-Impute-02:
    If NetIncomeLossAttributableToParent = 0 and NetIncomeLossAttributableToNoncontrollingInterest <> 0 and NetIncomeLoss <> 0 Then
        NetIncomeLossAttributableToParent = NetIncomeLoss - NetIncomeLossAttributableToNoncontrollingInterest
    End If

    'IS-Impute-03: 
    If NetIncomeLossAvailableToCommonStockholdersBasic = 0 and PreferredStockDividendsAndOtherAdjustments <> 0 and NetIncomeLossAttributableToParent <> 0 Then
        NetIncomeLossAvailableToCommonStockholdersBasic = NetIncomeLossAttributableToParent - PreferredStockDividendsAndOtherAdjustments
    End If

    'IS-Impute-04: 
    If NetIncomeLossAttributableToParent = 0 and NetIncomeLossAttributableToNoncontrollingInterest = 0 and NetIncomeLoss <> 0 Then
        NetIncomeLossAttributableToParent = NetIncomeLoss
    End If
            
    'IS-Impute-05: 
    If PreferredStockDividendsAndOtherAdjustments = 0 and NetIncomeLossAttributableToParent <> 0 and NetIncomeLossAvailableToCommonStockholdersBasic <> 0 Then
        PreferredStockDividendsAndOtherAdjustments = NetIncomeLossAttributableToParent - NetIncomeLossAvailableToCommonStockholdersBasic
    End If

    'IS-Impute-06: 
    If NetIncomeLossAvailableToCommonStockholdersBasic = 0 and PreferredStockDividendsAndOtherAdjustments = 0 and NetIncomeLossAttributableToParent <> 0 Then
        NetIncomeLossAvailableToCommonStockholdersBasic = NetIncomeLossAttributableToParent
    End If
   
    'IS-Impute-07: 
    If IncomeLossFromContinuingOperationsAfterTax = 0 and NetIncomeLoss <> 0 Then
        IncomeLossFromContinuingOperationsAfterTax = NetIncomeLoss - IncomeLossFromDiscontinuedOperationsNetOfTax - ExtraordinaryItemsOfIncomeExpenseNetOfTax
    End If


    'IS-Impute-08: 
    If IncomeLossFromContinuingOperationsAfterTax = 0 and IncomeTaxExpenseBenefit <> 0 and IncomeLossFromContinuingOperationsBeforeTax <> 0 Then
        IncomeLossFromContinuingOperationsAfterTax = IncomeLossFromContinuingOperationsBeforeTax - IncomeTaxExpenseBenefit
    End If
            

    'IS-Impute-09: 
    If IncomeLossFromContinuingOperationsBeforeTax = 0 and IncomeLossBeforeEquityMethodInvestments <> 0 and IncomeLossFromEquityMethodInvestments <> 0 Then
        IncomeLossFromContinuingOperationsBeforeTax = IncomeLossBeforeEquityMethodInvestments + IncomeLossFromEquityMethodInvestments
    End If
            
    'IS-Impute-10: 
    If IncomeLossFromContinuingOperationsBeforeTax = 0 and IncomeLossFromContinuingOperationsAfterTax <> 0 Then
        IncomeLossFromContinuingOperationsBeforeTax = IncomeLossFromContinuingOperationsAfterTax + IncomeTaxExpenseBenefit
    End If
            
    'IS-Impute-11: 
    If IncomeLossBeforeEquityMethodInvestments = 0 and IncomeLossFromContinuingOperationsBeforeTax <> 0 and IncomeLossFromEquityMethodInvestments <> 0 Then
        IncomeLossBeforeEquityMethodInvestments = IncomeLossFromContinuingOperationsBeforeTax - IncomeLossFromEquityMethodInvestments
    End If   
            
    'IS-Impute-12: 
    If Revenues = 0 and GrossProfit <> 0 and CostOfRevenue <> 0 Then
        Revenues = GrossProfit + CostOfRevenue
    End If

    'IS-Impute-13: 
    If CostOfRevenue = 0 and GrossProfit <> 0 and Revenues <> 0 Then
        CostOfRevenue = Revenues - GrossProfit
    End If

    'IS-Impute-14: 
    If GrossProfit = 0 and Revenues <> 0 and CostOfRevenue <> 0 Then
        GrossProfit = Revenues - CostOfRevenue
    End If

    'IS-Impute-15: 
    If CostsAndExpenses = 0 and CostOfRevenue <> 0 and OperatingExpenses <> 0 Then
        CostsAndExpenses = CostOfRevenue + OperatingExpenses
    End If

    'IS-Impute-16: OperatingExpensesPlusOtherOperatingIncomeExpenses is a DEBIT
    OperatingExpensesPlusOtherOperatingIncomeExpenses = 0
    If OperatingExpensesPlusOtherOperatingIncomeExpenses = 0 and GrossProfit <> 0 and OperatingIncomeLoss <> 0 Then
        OperatingExpensesPlusOtherOperatingIncomeExpenses = GrossProfit - OperatingIncomeLoss
    End If           
            
    'IS-Impute-17: 
    If CostsAndExpenses = 0 and GrossProfit = 0 and Revenues <> 0 and OperatingIncomeLoss <> 0 and OtherOperatingIncomeExpenses <> 0 Then
        CostsAndExpenses = Revenues - OperatingIncomeLoss - OtherOperatingIncomeExpenses
    End If
            
    'IS-Impute-18: 
    If OperatingExpenses = 0 and CostOfRevenue <> 0 and CostsAndExpenses <> 0 Then
        OperatingExpenses = CostsAndExpenses - CostOfRevenue
    End If
            
    'IS-Impute-19: This seems to have little to no effect
    If CostOfRevenue = 0 and Revenues <> 0 and GrossProfit = 0 and (Revenues - CostsAndExpenses = OperatingIncomeLoss) and OperatingExpenses = 0 and OtherOperatingIncomeExpenses = 0 Then
        CostOfRevenue = CostsAndExpenses - OperatingExpenses
    End If

    'IS-Impute-20: 
    If InterestAndDebtExpense = 0 and OperatingIncomeLoss <> 0 and NonoperatingIncomeLoss <> 0 and IncomeLossBeforeEquityMethodInvestments <> 0 Then
        InterestAndDebtExpense = IncomeLossBeforeEquityMethodInvestments - (OperatingIncomeLoss + NonoperatingIncomeLoss)
    End If
    
    'IS-Impute-21: 
    If OtherOperatingIncomeExpenses = 0 and GrossProfit <> 0 and OperatingExpenses <> 0 and OperatingIncomeLoss <> 0 and OperatingIncomeLoss <> (GrossProfit - OperatingExpenses + OtherOperatingIncomeExpenses) Then
        OtherOperatingIncomeExpenses = OperatingIncomeLoss - (GrossProfit - OperatingExpenses)
    End If

    'IS-Impute-22: Seemst to have little impact
    If OperatingIncomeLoss = 0 and IncomeLossBeforeEquityMethodInvestments <> 0 and NonoperatingIncomeLoss <> 0 and InterestAndDebtExpense <> 0 Then
        OperatingIncomeLoss = IncomeLossBeforeEquityMethodInvestments - NonoperatingIncomeLoss + InterestAndDebtExpense
    End If

    'IS-Impute-23:
    If NonoperatingIncomeLossPlusInterestAndDebtExpense = 0 and NonoperatingIncomeLoss <> 0 and InterestAndDebtExpense <> 0 Then
    	  NonoperatingIncomeLossPlusInterestAndDebtExpense = NonoperatingIncomeLoss - InterestAndDebtExpense
    End If

    'IS-Impute-24:
    'The line items were not reported, but both sides of the equation were reported
    If NonoperatingIncomeLossPlusInterestAndDebtExpense = 0 and OperatingIncomeLoss <> 0 and IncomeLossBeforeEquityMethodInvestments <> 0 Then
    	  NonoperatingIncomeLossPlusInterestAndDebtExpense = IncomeLossBeforeEquityMethodInvestments - OperatingIncomeLoss
    End If

    'IS-Impute-25:
    If NonoperatingIncomeLossPlusInterestAndDebtExpense = 0 and NonoperatingIncomeLoss <> 0 and InterestAndDebtExpense = 0 Then
    	  NonoperatingIncomeLossPlusInterestAndDebtExpense = NonoperatingIncomeLoss
    End If

    'IS-Impute-26: CHANGED THIS, reversed interest and debt expense, added the multiplication by negative 1
    If NonoperatingIncomeLossPlusInterestAndDebtExpense = 0 and NonoperatingIncomeLoss = 0 and InterestAndDebtExpense <> 0 Then
    	  NonoperatingIncomeLossPlusInterestAndDebtExpense = InterestAndDebtExpense * -1
    End If

    'IS-Impute-27:
    If IncomeLossFromEquityMethodInvestments <> 0 and OperatingIncomeLoss <> 0 and IncomeLossBeforeEquityMethodInvestments <> 0 Then
    	  NonoperatingIncomePlusInterestAndDebtExpensePlusIncomeFromEquityMethodInvestments = NonoperatingIncomeLossPlusInterestAndDebtExpense + IncomeLossFromEquityMethodInvestments
    End If
            
    'IS-Impute-28: Changed this from NEGATIVE income from equity method investments to POSITIVE
    If NonoperatingIncomePlusInterestAndDebtExpensePlusIncomeFromEquityMethodInvestments = 0 and IncomeLossFromEquityMethodInvestments <> 0 Then
    	  NonoperatingIncomePlusInterestAndDebtExpensePlusIncomeFromEquityMethodInvestments = NonoperatingIncomeLossPlusInterestAndDebtExpense + IncomeLossFromEquityMethodInvestments
    End If

    'IS-Impute-29:
    If IncomeLossBeforeEquityMethodInvestments = 0 and IncomeLossFromEquityMethodInvestments = 0 Then
    	  IncomeLossBeforeEquityMethodInvestments = IncomeLossFromContinuingOperationsBeforeTax
    End If

    'IS-Impute-30:
    If NonoperatingIncomeLossPlusInterestAndDebtExpense = 0 and NonoperatingIncomeLoss = 0 and InterestAndDebtExpense = 0 Then
    	  NonoperatingIncomeLossPlusInterestAndDebtExpense = IncomeLossBeforeEquityMethodInvestments - OperatingIncomeLoss
    End If

    'NOTE: THIS IS A NEW VARIABLE WHICH SHOULD BE ADDED TO THE HTML!
    'IS-Impute-31: Added to FORCE a total for operating expenses, costs and expenses, and/or other operating income expense
    'OperatingExpensesPlusOtherOperatingIncomeExpenses is a DEBIT and set above
    If OperatingExpenses = 0 and CostsAndExpenses = 0 and OtherOperatingIncomeExpenses = 0 and GrossProfit <> 0 and OperatingIncomeLoss <> 0 and OperatingIncomeLoss <> (GrossProfit - OperatingExpenses + OtherOperatingIncomeExpenses) Then
        OtherOperatingIncomeExpenses = OperatingExpensesPlusOtherOperatingIncomeExpenses * -1
    End If

    'IS-Impute-34:
    If CostsAndExpenses = 0 and CostOfRevenue = 0 and OperatingExpenses <> 0 Then
   	  CostsAndExpenses = OperatingExpenses
    End If



    'IS-Impute-51: ADDED
    If GrossProfit <> 0 and IncomeLossBeforeEquityMethodInvestments <> 0 Then
    	  OperatingExpensesPlusOtherOperatingIncomeExpensesPlusNonoperatingIncomeLossPlusInterestAndDebtExpensePlusIncomeLossFromEquityMethodInvestments = GrossProfit - IncomeLossBeforeEquityMethodInvestments
    End If


    NonoperatingIncomeLossPlusInterestAndDebtExpensePlusIncomeLossFromEquityMethodInvestments = NonoperatingIncomeLossPlusInterestAndDebtExpense + IncomeLossFromEquityMethodInvestments
    
    'Income statement checks
    
    CheckGrossProfitToOperatingIncomeLoss = OperatingExpenses - OtherOperatingIncomeExpenses
    CheckGrossProfitToIncomeFromContinuingOperationsBeforeTax = OperatingExpenses - OtherOperatingIncomeExpenses - NonoperatingIncomeLoss + InterestAndDebtExpense - IncomeLossFromEquityMethodInvestments
	 CheckSpecialReportingItems = IncomeLossFromDiscontinuedOperationsNetOfTax + ExtraordinaryItemsOfIncomeExpenseNetOfTax
    CheckIncomeTaxes = IncomeLossFromContinuingOperationsBeforeTax - IncomeLossFromContinuingOperationsAfterTax
    CheckSingleStepOperatingIncomeLoss = Revenues - CostsAndExpenses
    CheckMultiStepOperatingIncomeLoss = GrossProfit - OperatingExpenses + OtherOperatingIncomeExpenses
    CheckNonoperatingItems = NonoperatingIncomeLoss + IncomeLossBeforeEquityMethodInvestments - InterestAndDebtExpense
    CheckOperatingItems = OperatingExpenses - OtherOperatingIncomeExpenses
 
 
 
 
 

'ADDED TO FIX IS10
'    'IS-Impute-09: 
'    If ComprehensiveIncomeLoss = 0 and NetIncomeLoss <> 0 and OtherComprehensiveIncomeLoss <> 0 Then
'        ComprehensiveIncomeLoss = NetIncomeLoss + OtherComprehensiveIncomeLoss
'    End If
'
'    If ComprehensiveIncomeLoss <> 0 and ComprehensiveIncomeLossAttributableToParent = 0 and ComprehensiveIncomeLossAttributableToNoncontrollingInterest = 0 Then
'        ComprehensiveIncomeLossAttributableToParent = ComprehensiveIncomeLoss
'    End If
'END OF WHAT WAS ADDED

    'Determine if income statement is multi-step or single-step
    IsMultiStepIncomeStatement = GrossProfit

'VERIFICATION RULES: Income statement

    If IsMultiStepIncomeStatement = 0 Then
        IS1 = 0
        IS2 = 0
    Else
        'Multi-step only
        IS1 = GrossProfit - (Revenues - CostOfRevenue) 
        IS2 = OperatingIncomeLoss - (GrossProfit - OperatingExpenses + OtherOperatingIncomeExpenses)
                
    End If
        
    IS3 = IncomeLossBeforeEquityMethodInvestments - (OperatingIncomeLoss + NonoperatingIncomeLossPlusInterestAndDebtExpense)
    IS4 = IncomeLossFromContinuingOperationsBeforeTax - (IncomeLossBeforeEquityMethodInvestments + IncomeLossFromEquityMethodInvestments)
    IS5 = IncomeLossFromContinuingOperationsAfterTax - (IncomeLossFromContinuingOperationsBeforeTax - IncomeTaxExpenseBenefit)
    IS6 = NetIncomeLoss - (IncomeLossFromContinuingOperationsAfterTax + IncomeLossFromDiscontinuedOperationsNetOfTax + ExtraordinaryItemsOfIncomeExpenseNetOfTax)
    IS7 = NetIncomeLoss - (NetIncomeLossAttributableToParent + NetIncomeLossAttributableToNoncontrollingInterest)
    IS8 = NetIncomeLossAvailableToCommonStockholdersBasic - (NetIncomeLossAttributableToParent - PreferredStockDividendsAndOtherAdjustments)
    
    
'ADDED TO TRY TO FIX ISSUE WITH OPERATING INCOME
'    If IS2 <> 0 and OperatingIncomeLoss - (GrossProfit - OperatingExpenses + OtherOperatingIncomeExpenses) = IS2 Then
'        'OperatingIncomeLoss was not reported but it can be computed.
'        OperatingIncomeLoss = (GrossProfit - OperatingExpenses + OtherOperatingIncomeExpenses)
'        IS2 = OperatingIncomeLoss - (GrossProfit - OperatingExpenses + OtherOperatingIncomeExpenses)
'        IS3 = IncomeLossBeforeEquityMethodInvestments - (OperatingIncomeLoss + NonoperatingIncomeLossPlusInterestAndDebtExpense)
'    Else
'        'Do nothing
'    End If
'END OF WHAT WAS ADDED TO FIX IS2

'ADDED TO TRY TO FIX ISSUE WITH IS2 (This seems to work, but impacts a small number of filings)
    If IS2 <> 0 and OperatingIncomeLoss <> 0 and GrossProfit <> 0 and OtherOperatingIncomeExpenses <> 0 and OperatingExpenses = 0 and (GrossProfit - OperatingIncomeLoss) + OtherOperatingIncomeExpenses = (IS2 * -1) Then
    	  OperatingExpenses = (GrossProfit - OperatingIncomeLoss) + OtherOperatingIncomeExpenses
    	  IS2 = 0
    End If
'END OF WHAT WAS ADDED TO FIX IS2


'ADDED TO TRY AND FIX ISSUE WITH COMPREHENSIVE INCOME (LOSS)
    If IS10 <> 0 and ComprehensiveIncomeLoss - (NetIncomeLossAttributableToParent + OtherComprehensiveIncomeLoss) = 0 Then
        'Filer might be using NetIncomeLossAttributableToParent in the computation.
        IS10 = ComprehensiveIncomeLoss - (NetIncomeLossAttributableToParent + OtherComprehensiveIncomeLoss)
    Else
        'Do nothing
    End If

    If IS10 <> 0 and ComprehensiveIncomeLoss - (NetIncomeLossAttributableToNoncontrollingInterest + OtherComprehensiveIncomeLoss) = 0 Then
        'Filer might be using NetIncomeLossAttributableToNoncontrollingInterest in the computation.
        IS10 = ComprehensiveIncomeLoss - (NetIncomeLossAttributableToNoncontrollingInterest + OtherComprehensiveIncomeLoss)
    Else
        'Do nothing
    End If
'END OF WHAT WAS ADDED
    

    If IsMultiStepIncomeStatement = 0 Then
        'Single-step only
        IS11 = OperatingIncomeLoss - (Revenues - CostsAndExpenses + OtherOperatingIncomeExpenses)
    Else
        IS11 = 0
    End If

	 IS12 = CostsAndExpenses - (CostOfRevenue + OperatingExpenses)

    IS13 = OperatingExpensesPlusOtherOperatingIncomeExpenses - (OperatingExpenses - OtherOperatingIncomeExpenses)
   
    IS14 = OperatingExpensesPlusOtherOperatingIncomeExpensesPlusNonoperatingIncomeLossPlusInterestAndDebtExpensePlusIncomeLossFromEquityMethodInvestments - (OperatingExpenses - OtherOperatingIncomeExpenses - NonoperatingIncomeLoss + InterestAndDebtExpense - IncomeLossFromEquityMethodInvestments)


    'ADDED TO FIX IS4: If the amount that test IS4 is off is equal to income from equity method investments that means the filer put income from equity method investments somewhere else
	 If IS4 = (IncomeLossFromEquityMethodInvestments * -1) Then
	 	 IS4 = 0
	 End If


    'ADDED TO FIX IS3:
    'IS-Impute-61: ADDED to fix IS3
    If OperatingIncomeLoss = 0 and IS3 = IS11 * -1 Then
   	  OperatingIncomeLoss = Revenues - CostsAndExpenses
   	  IS3 = 0
   	  IS11 = 0
    End If



'XXXXXXXXXXXXXXXXXXXXXXXX NETWORK: 211-Net Income (Loss) Breakdown (http://www.xbrlsite.com/2014/Protototype/fac/NetIncomeLossBreakdown)
'Empty


'XXXXXXXXXXXXXXXXXXXXXXXX NETWORK: 212-Net Income (Loss) Available to Common Breakdown (http://www.xbrlsite.com/2014/Protototype/fac/NetIncomeLossAvailableToCommonBreakdown)
'Empty


'XXXXXXXXXXXXXXXXXXXXXXXX NETWORK: 301-Statement of Comprehensive Income (http://www.xbrlsite.com/2014/Protototype/fac/StatementOfComprehensiveIncome)
'Statement of comprehensive income
'Reviewed 2014-11-21


    'IS-Impute-06: 
    If ComprehensiveIncomeLoss = 0 and ComprehensiveIncomeLossAttributableToParent = 0 and ComprehensiveIncomeLossAttributableToNoncontrollingInterest = 0 and OtherComprehensiveIncomeLoss = 0 Then
        ComprehensiveIncomeLoss = NetIncomeLoss
    End If
            
    'IS-Impute-07: 
    If OtherComprehensiveIncomeLoss = 0 and ComprehensiveIncomeLoss <> 0 Then
        OtherComprehensiveIncomeLoss = ComprehensiveIncomeLoss - NetIncomeLoss
    End If

    'IS-Impute-08: 
    If ComprehensiveIncomeLossAttributableToParent = 0 and ComprehensiveIncomeLossAttributableToNoncontrollingInterest = 0 and ComprehensiveIncomeLoss <> 0 Then
        ComprehensiveIncomeLossAttributableToParent = ComprehensiveIncomeLoss
    End If

    'IS-Impute-08A:
    If ComprehensiveIncomeLossAttributableToNoncontrollingInterest = 0 and ComprehensiveIncomeLossAttributableToParent <> 0 and ComprehensiveIncomeLoss <> 0 Then
        ComprehensiveIncomeLossAttributableToNoncontrollingInterest = ComprehensiveIncomeLoss - ComprehensiveIncomeLossAttributableToParent
    End If

'ADDED TO FIX IS10
'    'IS-Impute-09: 
'    If ComprehensiveIncomeLoss = 0 and NetIncomeLoss <> 0 and OtherComprehensiveIncomeLoss <> 0 Then
'        ComprehensiveIncomeLoss = NetIncomeLoss + OtherComprehensiveIncomeLoss
'    End If
'
'    If ComprehensiveIncomeLoss <> 0 and ComprehensiveIncomeLossAttributableToParent = 0 and ComprehensiveIncomeLossAttributableToNoncontrollingInterest = 0 Then
'        ComprehensiveIncomeLossAttributableToParent = ComprehensiveIncomeLoss
'    End If
'END OF WHAT WAS ADDED

    'Determine if income statement is multi-step or single-step
    IsMultiStepIncomeStatement = GrossProfit

'VERIFICATION RULES: Statement of comprehensive income

    IS9 = ComprehensiveIncomeLoss - (ComprehensiveIncomeLossAttributableToParent + ComprehensiveIncomeLossAttributableToNoncontrollingInterest)
    IS10 = ComprehensiveIncomeLoss - (NetIncomeLoss + OtherComprehensiveIncomeLoss)
    



'XXXXXXXXXXXXXXXXXXXXXXXX NETWORK: 311-Comprehensive Income (Loss) Breakdown (http://www.xbrlsite.com/2014/Protototype/fac/ComprehensiveIncomeBreakdown)
'Empty


'XXXXXXXXXXXXXXXXXXXXXXXX NETWORK: 401-Cash Flow Statement (http://www.xbrlsite.com/2014/Protototype/fac/CashFlowStatement)
'Cash flow statement

    'CF-Impute-01: 
    If NetCashFlow = 0 and NetCashFlowContinuing <> 0 and NetCashFlowDiscontinued <> 0 Then
        NetCashFlow = NetCashFlowContinuing + NetCashFlowDiscontinued + ExchangeGainsLosses
    End If

    'CF-Impute-02:
    If NetCashFlowDiscontinued = 0 Then
        NetCashFlowDiscontinued = NetCashFlowFromOperatingActivitiesDiscontinued + NetCashFlowFromInvestingActivitiesDiscontinued + NetCashFlowFromFinancingActivitiesDiscontinued
    End If

    'CF-Impute-03:
    If NetCashFlowFromOperatingActivities <> 0 and NetCashFlowFromOperatingActivitiesContinuing = 0 Then
        NetCashFlowFromOperatingActivitiesContinuing = NetCashFlowFromOperatingActivities - NetCashFlowFromOperatingActivitiesDiscontinued
    End If

    'CF-Impute-04:
    If NetCashFlowFromInvestingActivities <> 0 and NetCashFlowFromInvestingActivitiesContinuing = 0 Then
        NetCashFlowFromInvestingActivitiesContinuing = NetCashFlowFromInvestingActivities - NetCashFlowFromInvestingActivitiesDiscontinued
    End If

    'CF-Impute-05:
    If NetCashFlowFromFinancingActivities <> 0 and NetCashFlowFromFinancingActivitiesContinuing = 0 Then
        NetCashFlowFromFinancingActivitiesContinuing = NetCashFlowFromFinancingActivities - NetCashFlowFromFinancingActivitiesDiscontinued
    End If
    
    'CF-Impute-06:
    If NetCashFlowFromOperatingActivities = 0 and NetCashFlowFromOperatingActivitiesContinuing <> 0 and NetCashFlowFromOperatingActivitiesDiscontinued = 0 Then
        NetCashFlowFromOperatingActivities = NetCashFlowFromOperatingActivitiesContinuing
    End If

    'CF-Impute-07:
    If NetCashFlowFromInvestingActivities = 0 and NetCashFlowFromInvestingActivitiesContinuing <> 0 and NetCashFlowFromInvestingActivitiesDiscontinued = 0 Then
        NetCashFlowFromInvestingActivities = NetCashFlowFromInvestingActivitiesContinuing
    End If

    'CF-Impute-08:
    If NetCashFlowFromFinancingActivities = 0 and NetCashFlowFromFinancingActivitiesContinuing <> 0 and NetCashFlowFromFinancingActivitiesDiscontinued = 0 Then
        NetCashFlowFromFinancingActivities = NetCashFlowFromFinancingActivitiesContinuing
    End If
    
    'CF-Impute-09:
    If NetCashFlowContinuing = 0 Then
        NetCashFlowContinuing = NetCashFlowFromOperatingActivitiesContinuing + NetCashFlowFromInvestingActivitiesContinuing + NetCashFlowFromFinancingActivitiesContinuing
    End If
    
    'CF-Impute-10:
    If NetCashFlowFromOperatingActivitiesDiscontinued = 0 and NetCashFlowFromOperatingActivities = NetCashFlowFromOperatingActivitiesContinuing Then
        NetCashFlowFromOperatingActivitiesDiscontinued = 0
    End If

    'CF-Impute-11:
    If NetCashFlowFromInvestingActivitiesDiscontinued = 0 and NetCashFlowFromInvestingActivities = NetCashFlowFromInvestingActivitiesContinuing Then
        NetCashFlowFromInvestingActivitiesDiscontinued = 0
    End If

    'CF-Impute-12:
    If NetCashFlowFromFinancingActivitiesDiscontinued = 0 and NetCashFlowFromFinancingActivities = NetCashFlowFromFinancingActivitiesContinuing Then
        NetCashFlowFromFinancingActivitiesDiscontinued = 0
    End If

    'CF-Impute-13:
    If NetCashFlowFromOperatingActivities = 0 and NetCashFlowFromOperatingActivitiesContinuing <> 0 and NetCashFlowFromOperatingActivitiesDiscontinued <> 0 Then
        NetCashFlowFromOperatingActivities = NetCashFlowFromOperatingActivitiesContinuing + NetCashFlowFromOperatingActivitiesDiscontinued
    End If

    'CF-Impute-14:
    If NetCashFlowFromInvestingActivities = 0 and NetCashFlowFromInvestingActivitiesContinuing <> 0 and NetCashFlowFromInvestingActivitiesDiscontinued <> 0 Then
        NetCashFlowFromInvestingActivities = NetCashFlowFromInvestingActivitiesContinuing + NetCashFlowFromInvestingActivitiesDiscontinued
    End If

    'CF-Impute-15:
    If NetCashFlowFromFinancingActivities = 0 and NetCashFlowFromFinancingActivitiesContinuing <> 0 and NetCashFlowFromFinancingActivitiesDiscontinued <> 0 Then
        NetCashFlowFromFinancingActivities = NetCashFlowFromFinancingActivitiesContinuing + NetCashFlowFromFinancingActivitiesDiscontinued
    End If

    'CF-Impute-16:
    If NetCashFlow = 0 and (NetCashFlowFromOperatingActivities <> 0 or NetCashFlowFromInvestingActivities <> 0 or NetCashFlowFromFinancingActivities <> 0) Then
        NetCashFlow = NetCashFlowFromOperatingActivities + NetCashFlowFromInvestingActivities + NetCashFlowFromFinancingActivities + ExchangeGainsLosses
    End If




'VERIFICATION RULES: Cash flow statement

    CF1 = NetCashFlow - (NetCashFlowFromOperatingActivities + NetCashFlowFromInvestingActivities + NetCashFlowFromFinancingActivities + ExchangeGainsLosses)
    
    If CF1 <> 0 and (NetCashFlow - (NetCashFlowFromOperatingActivities + NetCashFlowFromInvestingActivities + NetCashFlowFromFinancingActivities + ExchangeGainsLosses)) = (ExchangeGainsLosses * -1) Then
      'NetCashFlow DOES NOT include ExchangeGainsLosses for about 128 SEC filers, it does for about 7040 SEC filers
    	CF1 = NetCashFlow - (NetCashFlowFromOperatingActivities + NetCashFlowFromInvestingActivities + NetCashFlowFromFinancingActivities)

    End If
    
    
    CF2 = NetCashFlowContinuing - (NetCashFlowFromOperatingActivitiesContinuing + NetCashFlowFromInvestingActivitiesContinuing + NetCashFlowFromFinancingActivitiesContinuing)
    CF3 = NetCashFlowDiscontinued - (NetCashFlowFromOperatingActivitiesDiscontinued + NetCashFlowFromInvestingActivitiesDiscontinued + NetCashFlowFromFinancingActivitiesDiscontinued)
    CF4 = NetCashFlowFromOperatingActivities - (NetCashFlowFromOperatingActivitiesContinuing + NetCashFlowFromOperatingActivitiesDiscontinued)
    CF5 = NetCashFlowFromInvestingActivities - (NetCashFlowFromInvestingActivitiesContinuing + NetCashFlowFromInvestingActivitiesDiscontinued)
    CF6 = NetCashFlowFromFinancingActivities - (NetCashFlowFromFinancingActivitiesContinuing + NetCashFlowFromFinancingActivitiesDiscontinued)
    
    


'XXXXXXXXXXXXXXXXXXXXXXXX NETWORK: 411-Net Cash Flow Breakdown (http://www.xbrlsite.com/2014/Protototype/fac/NetCashFlowBreakdown)
'Empty


'XXXXXXXXXXXXXXXXXXXXXXXX NETWORK: 501-Key Ratios (http://www.xbrlsite.com/2014/Protototype/fac/KeyRatios)
'Key ratios

    If (Assets <> 0) and (Equity <> 0) and (Revenues <> 0) Then
        SustainableGrowthRate = ((NetIncomeLoss / Revenues) * (1+((Assets - Equity) / Equity))) / ((1 / (Revenues / Assets))-(((NetIncomeLoss / Revenues) * (1+(((Assets - Equity) / Equity))))))
    End If

    If Assets <> 0 Then
        ReturnOnAssets = NetIncomeLoss / Assets
    End If

    If Equity <> 0 Then
        ReturnOnEquity = NetIncomeLoss / Equity
    End If

    If Revenues <> 0 Then
        ReturnOnSales = NetIncomeLoss / Revenues
    End If



'XXXXXXXXXXXXXXXXXXXXXXXX NETWORK: 601-Validation Results (http://www.xbrlsite.com/2014/Protototype/fac/ValidationResults)
'Empty


'END OF FILE
