'Created by Charles Hoffman, CPA 3/28/2016 1:57:12 PM
'Report frame code: UTILX-BSC-CF1-ISS-IEMIA-OILN
  
'XXXXXXXXXXXXXXXXXXXXXXXX NETWORK: 001-General Information (http://www.xbrlsite.com/2014/Protototype/fac/GeneralInformation)
'General information
'Reviewed 2015-11-13



'XXXXXXXXXXXXXXXXXXXXXXXX NETWORK: 102-Balance Sheet, Unclassified (http://www.xbrlsite.com/2014/Protototype/fac/BalanceSheetUnclassified)
'Balance sheet (Unclassified)
'Reviewed 2015-11-13

    'Determine which statements are used
    IsClassifiedBalanceSheet = CurrentAssets

    'IS-Impute-00: (Added, 2016-03-06)
    If RedeemableNoncontrollingInterest = 0 Then
        RedeemableNoncontrollingInterest = RedeemableNoncontrollingInterestCommon + RedeemableNoncontrollingInterestPreferred + RedeemableNoncontrollingInterestOther
    End If

    'IS-Impute-00: (Added, 2016-03-06)
    If TemporaryEquity = 0 Then
        TemporaryEquity = TemporaryEquityAttributableToParent + RedeemableNoncontrollingInterest
    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 + Equity)
    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-17: ADDED 2015-05-29, also removed mappings to detailed NCI concepts
    If EquityAttributableToNoncontrollingInterest = 0 and Equity <> 0 and EquityAttributableToParent <> 0 Then
        EquityAttributableToNoncontrollingInterest = Equity - EquityAttributableToParent
    End If

    
    'VERIFICATION RULES: Balance Sheet relations


    BS1 = Equity - (EquityAttributableToParent + EquityAttributableToNoncontrollingInterest)
    BS2 = Assets - LiabilitiesAndEquity

   'Tests BS3 and BS4 are not applicable if the balance sheet is not classified
    BS3 = 0
    BS4 = 0
    
    'BS3 = Assets - (CurrentAssets + NoncurrentAssets)
    'BS4 = Liabilities - (CurrentLiabilities + NoncurrentLiabilities
    
    BS5 = LiabilitiesAndEquity - (Liabilities + CommitmentsAndContingencies + TemporaryEquity + Equity)



'XXXXXXXXXXXXXXXXXXXXXXXX NETWORK: 201-Income Statement, Single Step (Report Operating Income) (http://www.xbrlsite.com/2014/Protototype/fac/IncomeStatementSingleStep)
'Income statement - Single-Step, With Operating income (loss) (Gross profit is not explicitly reported but might be imputed, operating income (loss) is explicitly reported)
'Reviewed 2015-11-13


    'IS-Impute-00: ADDED 2016-03-10 (Changed basic relations of preferred dividends and distributed and undistributed earnings)
    If ParticipatingSecuritiesDistributedAndUndistributedEarningsLossBasic = 0 Then
        ParticipatingSecuritiesDistributedAndUndistributedEarningsLossBasic = PreferredStockDividendsAndOtherAdjustments + UndistributedEarningsLossAllocatedToParticipatingSecuritiesBasic
    End If

    'IS-Impute-00: ADDED 2016-02-27 (No income from discontinued operations total provided, but detailed line items likely provided)
    If IncomeLossFromDiscontinuedOperationsNetOfTax = 0 Then
        IncomeLossFromDiscontinuedOperationsNetOfTax = IncomeLossFromDiscontinuedOperationsNetOfTaxDuringPhaseOut + IncomeLossFromDiscontinuedOperationsNetOfTaxGainLossOnDisposal + IncomeLossFromDiscontinuedOperationsNetOfTaxProvisionForGainLossOnDisposal + IncomeLossFromDiscontinuedOperationsNetOfTaxAdjustmentToPriorYearGainLossOnDisposal
    End If

    If NetIncomeLossAttributableToNoncontrollingInterest = 0 Then
        NetIncomeLossAttributableToNoncontrollingInterest = NetIncomeLossAttributableToNonredeemableNoncontrollingInterest + NetIncomeLossAttributableToRedeemableNoncontrollingInterest
    End If

    'IS-Impute-00: (Fix taxes, 2015-07-06)
    If IncomeTaxExpenseBenefit = 0 and (IncomeTaxExpenseBenefitCurrent <> 0 or IncomeTaxExpenseBenefitDeferred <> 0) Then
        IncomeTaxExpenseBenefit = IncomeTaxExpenseBenefitCurrent + IncomeTaxExpenseBenefitDeferred
    End If



    'NEW-01: Start from bottom, work up for net income steps
    If NetIncomeLossAttributableToParent = 0 and NetIncomeLossAvailableToCommonStockholdersBasic <> 0 and PreferredStockDividendsAndOtherAdjustments = 0 Then
        NetIncomeLossAttributableToParent = NetIncomeLossAvailableToCommonStockholdersBasic
    End If

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

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

    'NEW-04: 
    If IncomeLossFromContinuingOperationsAfterTax = 0 and NetIncomeLoss <> 0 and IncomeLossFromDiscontinuedOperationsNetOfTax = 0 and ExtraordinaryItemsOfIncomeExpenseNetOfTax = 0 Then
        IncomeLossFromContinuingOperationsAfterTax = NetIncomeLoss
    End If

    'NEW-05: 
    If IncomeLossFromContinuingOperationsBeforeTax = 0 and IncomeLossFromContinuingOperationsAfterTax <> 0 and IncomeTaxExpenseBenefit = 0 Then
        IncomeLossFromContinuingOperationsBeforeTax = IncomeLossFromContinuingOperationsAfterTax
    End If


    'NEW-06: 
    If IncomeLossBeforeEquityMethodInvestments = 0 and IncomeLossFromContinuingOperationsBeforeTax <> 0 and IncomeLossFromEquityMethodInvestments = 0 Then
        IncomeLossBeforeEquityMethodInvestments = IncomeLossFromContinuingOperationsBeforeTax
    End If



    '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-99-1: Added 2015-11-12 (Deals with noncontrolling interests that are made up of multiple line items)
    If NetIncomeLossAttributableToNoncontrollingInterest = 0 and NetIncomeLoss <> 0 and NetIncomeLossAttributableToParent <> 0 and EquityAttributableToNoncontrollingInterest <> 0 Then
        NetIncomeLossAttributableToNoncontrollingInterest = NetIncomeLoss - NetIncomeLossAttributableToParent
    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
 
 
 
 
 

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

'VERIFICATION RULES: Income statement

        
    IS1 = 0
    'IS2 = OperatingIncomeLoss - (Revenues - CostsAndExpenses + OtherOperatingIncomeExpenses)
    IS2 = 0
    
    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)
       

    IS11 = OperatingIncomeLoss - (Revenues - CostsAndExpenses + OtherOperatingIncomeExpenses)
	 
	 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 = IS2 * -1 Then
   	  OperatingIncomeLoss = Revenues - CostsAndExpenses
   	  IS3 = 0
   	  IS2 = 0
    End If




'ADDED 2014-11-28 TO TRY TO FIX ISSUE IS2
    If IS2 <> 0 and (GrossProfit - OperatingExpenses + OtherOperatingIncomeExpenses) = OperatingIncomeLoss Then
        'OperatingIncomeLoss was not reported but it can be computed.
        IS2 = OperatingIncomeLoss - (GrossProfit - OperatingExpenses + OtherOperatingIncomeExpenses)
    Else
        'Do nothing
    End If


    If IS2 <> 0 and (Revenues - CostsAndExpenses + OtherOperatingIncomeExpenses) = OperatingIncomeLoss Then
        'OperatingIncomeLoss was not reported but it can be computed.
        IS2 = OperatingIncomeLoss - (Revenues - CostsAndExpenses + OtherOperatingIncomeExpenses)
    Else
        'Do nothing
    End If
'END OF WHAT WAS ADDED TO FIX IS2



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


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


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


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

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



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

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

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



    '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-09:
    If ComprehensiveIncomeLossAttributableToNoncontrollingInterest = 0 and ComprehensiveIncomeLossAttributableToParent <> 0 and ComprehensiveIncomeLoss <> 0 Then
        ComprehensiveIncomeLossAttributableToNoncontrollingInterest = ComprehensiveIncomeLoss - ComprehensiveIncomeLossAttributableToParent
    End If

'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
'Reviewed 2015-11-13


'XXXXXXXXXXXXXXXXXXXXXXXX NETWORK: 401-Cash Flow Statement (http://www.xbrlsite.com/2014/Protototype/fac/CashFlowStatement)
'Cash flow statement (exchange gains included in net cash flow)
'Reviewed 2015-11-13

'Refactored version

    'CF-Impute-01: Added 2015-11-12 If total discontinued is reported but detail is not, assume total is operating
    If NetCashFlowFromOperatingActivitiesDiscontinued = 0 and NetCashFlowFromInvestingActivitiesDiscontinued = 0 and NetCashFlowFromFinancingActivitiesDiscontinued = 0 and NetCashFlowDiscontinued <> 0 Then
        NetCashFlowFromOperatingActivitiesDiscontinued = NetCashFlowDiscontinued
    End If


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

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

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


    'CF-Impute-05:
    If NetCashFlowFromOperatingActivities = 0 Then
        NetCashFlowFromOperatingActivities = NetCashFlowFromOperatingActivitiesContinuing + NetCashFlowFromOperatingActivitiesDiscontinued
    End If

    'CF-Impute-06:
    If NetCashFlowFromInvestingActivities = 0 Then
        NetCashFlowFromInvestingActivities = NetCashFlowFromInvestingActivitiesContinuing + NetCashFlowFromInvestingActivitiesDiscontinued
    End If

    'CF-Impute-07:
    If NetCashFlowFromFinancingActivities = 0 Then
        NetCashFlowFromFinancingActivities = NetCashFlowFromFinancingActivitiesContinuing + NetCashFlowFromFinancingActivitiesDiscontinued
    End If



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


    'CF-Impute-09:
    'CF-Impute-NEW during refactoring:
    If NetCashFlowContinuing = 0 and NetCashFlow <> 0 Then
        NetCashFlowContinuing = NetCashFlow - NetCashFlowDiscontinued - ExchangeGainsLosses
    End If
    

    'CF-Impute-10:
    'CF-Impute-NEW2 during refactoring:
    If NetCashFlow = 0 and NetCashFlowContinuing <> 0 Then
        NetCashFlow = NetCashFlowContinuing + NetCashFlowDiscontinued  + ExchangeGainsLosses
    End If
    


    'CF-Impute-11: Added 2015-11-05
    If NetCashFlowFromInvestingActivitiesContinuing = 0 and NetCashFlowFromOperatingActivitiesContinuing <> 0 and NetCashFlowFromFinancingActivitiesContinuing <> 0 and (NetCashFlowContinuing - (NetCashFlowFromOperatingActivitiesContinuing + NetCashFlowFromInvestingActivitiesContinuing + NetCashFlowFromFinancingActivitiesContinuing) <> 0) Then
        NetCashFlowFromInvestingActivitiesContinuing = NetCashFlowContinuing - (NetCashFlowFromOperatingActivitiesContinuing + NetCashFlowFromFinancingActivitiesContinuing)
    End If

    'CF-Impute-12: Added 2015-11-05
    If NetCashFlowFromFinancingActivitiesContinuing = 0 and NetCashFlowFromOperatingActivitiesContinuing <> 0 and NetCashFlowFromInvestingActivitiesContinuing <> 0 and (NetCashFlowContinuing - (NetCashFlowFromOperatingActivitiesContinuing + NetCashFlowFromInvestingActivitiesContinuing + NetCashFlowFromFinancingActivitiesContinuing) <> 0) Then
        NetCashFlowFromFinancingActivitiesContinuing = NetCashFlowContinuing - (NetCashFlowFromOperatingActivitiesContinuing + NetCashFlowFromInvestingActivitiesContinuing)
    End If


    'CF-Impute-13: Added 2015-11-05
    If NetCashFlowFromInvestingActivities = 0 and NetCashFlowFromOperatingActivities <> 0 and NetCashFlowFromFinancingActivities <> 0 and (NetCashFlow - (NetCashFlowFromOperatingActivities + NetCashFlowFromInvestingActivities + NetCashFlowFromFinancingActivities + ExchangeGainsLosses) <> 0) Then
        NetCashFlowFromInvestingActivities = NetCashFlow - (NetCashFlowFromOperatingActivities + NetCashFlowFromFinancingActivities + ExchangeGainsLosses)
    End If

    'CF-Impute-14: Added 2015-11-05
    If NetCashFlowFromFinancingActivities = 0 and NetCashFlowFromOperatingActivities <> 0 and NetCashFlowFromInvestingActivities <> 0 and (NetCashFlow - (NetCashFlowFromOperatingActivities + NetCashFlowFromInvestingActivities + NetCashFlowFromFinancingActivities + ExchangeGainsLosses) <> 0) Then
        NetCashFlowFromFinancingActivities = NetCashFlow - (NetCashFlowFromOperatingActivities + NetCashFlowFromInvestingActivities + ExchangeGainsLosses)
    End If




    'CF-Impute-15:
    If NetCashFlowContinuing = 0 Then
        NetCashFlowContinuing = NetCashFlowFromOperatingActivitiesContinuing + NetCashFlowFromInvestingActivitiesContinuing + NetCashFlowFromFinancingActivitiesContinuing
    End If
    
    


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

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

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



    'CF-Impute-19: Added 2015-11-05
    If NetCashFlow = 0 and NetCashFlowContinuing <> 0 and NetCashFlowDiscontinued = 0 and NetCashFlowFromOperatingActivitiesDiscontinued = 0 and NetCashFlowFromInvestingActivitiesDiscontinued = 0 and NetCashFlowFromFinancingActivitiesDiscontinued = 0 and ExchangeGainsLosses = 0 Then
        NetCashFlow = NetCashFlowContinuing
    End If



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


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







'VERIFICATION RULES: Cash flow statement

    CF1 = NetCashFlow - (NetCashFlowFromOperatingActivities + NetCashFlowFromInvestingActivities + NetCashFlowFromFinancingActivities + ExchangeGainsLosses)
    
    'CF2 = NetCashFlowContinuing - (NetCashFlowFromOperatingActivitiesContinuing + NetCashFlowFromInvestingActivitiesContinuing + NetCashFlowFromFinancingActivitiesContinuing)
    CF2 = NetCashFlow - (NetCashFlowContinuing + NetCashFlowDiscontinued + ExchangeGainsLosses)

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


'XXXXXXXXXXXXXXXXXXXXXXXX NETWORK: 411.1-Net Cash Flow Breakdown (http://www.xbrlsite.com/2014/Protototype/fac/NetCashFlowBreakdown)
'Empty
'Reviewed 2015-11-13


'XXXXXXXXXXXXXXXXXXXXXXXX NETWORK: 420.1-Continuing and Discontinued Net Cash Flow Breakdown (http://www.xbrlsite.com/2014/Protototype/fac/ContinuingDiscontuedBreakdown)
'Empty
'Reviewed 2015-11-13


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


    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.2-Validation Results (No IS11) (http://www.xbrlsite.com/2014/Protototype/fac/ValidationResults2)
'Empty
'Reviewed 2015-11-13


'END OF FILE
