<!DOCTYPE html>
<html>
<head>

  <title>Balance Sheet</title>


  <style type="text/css">

    
    *{

        margin: 0;
     }

     /* GENERAL CSS APPLY ALL SECTIONS*/


  *{
    margin: 0;
  /*  padding-top: 6px;*/
  }
  .margin{
    padding-top: 8px;
  }

  .title{

    text-align: center;
    font-weight: bold;
  }


  .container1{

    margin-left: 7%;
    margin-right: 5%; 
    
  }

  .image-section1{

    width: 100px;
    height: 100px;
    
    
    text-align: center;
    position: absolute;
    margin-left:  -5%;
/*    top:  -500%;*/
bottom:  10%;

    
  }

  .title1{

    text-align: center;
    margin-top: 2%;
    background: #a8a8a8;
    color: #fff;
    width: 30%;
    height: 2%;
    border-radius: 15px;
    vertical-align: middle;
    line-height: 29px;
    margin-left: 34.5%;
  }

  

  .clear{

    clear: both;
  }

  .top-section{
    margin-left: 4%;
  }

  input[type=text]
  {
    

    
    border-top: 0;
    border-right: 0;
    border-left: 0;
    border-bottom: 1px solid;
    font-size: 12px;
    text-align: center;
    background-color: transparent;

  }

/*  #START=> APPARTMENT SECTION */
  .main-section .row .col{
    
  
    width: 25%;
    margin-right: 30px;
    padding-right: 10px;
    float: left;
  }

  .main-section .row{

    /*margin-left: 4%;*/


  }

  .main-section .col label{
    font-size: 12px;
    /*font-weight: bold;*/
  }

  

  .main-section .row .col .check{
    vertical-align: middle;
    margin-right:  90px; 
  }

/*  #END=> APPARTMENT SECTION */




  

  
/*  #END=> OFFICE USE SECTION */

/*  #START=>  IMAGE SECTION */

 .image-section{

    width: 85px;
    height: 85px;
    
    border: 1px solid #000;
    text-align: center;
    position: absolute;
    margin-left:  83%;
    top:  18%;

    
  }



  small{
    font-size: 12px;
    margin-left: 15;
  }

     .container{

        
     }


  </style>
</head>
<body style="margin:3% 4.5% 4% 4.5%;">

      @if($format)    
        @include('documents.report_logo')
      

       <br>
     @endif


     <div class="container">
        <div class="main-section">
           <center> <h3>BALANCE SHEET</h3></center>
         
           
      <div class="row clear" style="margin-top:3%;">
         <b>  Title: {{$title}} </b>
          <table border="1" style="border-collapse: collapse;  text-align: center; width:100%;">
            <thead>
                <tr>
                  <th colspan="3" style="background: #E0E0E0; ">Balance Sheet</th> 
                </tr>

                <tr>
                    <th>Description</th>
                    <th>Amount</th>
                    <th>Total Amount</th>
                </tr>
            </thead>

       
        
              <!-- FIXED ASSET CONFIGURATION -->
              @php($view_fixed_asset  = "")
              @php($total_fixed_asset = 0)


              <!-- CURRENT ASSET CONFIGURATION -->
              @php($view_current_asset  = "")
              @php($total_current_asset = 0)

              <!-- TOTAL ASSET -->
              @php($total_asset = 0)

              <!-- CAPITAL CONFIGURATION -->
              @php($view_capital  = "")
              @php($total_capital = 0)

              <!-- LONG TERM LIABILITIES CONFIGURATION -->
              @php($view_long_term_liabilities  = "")
              @php($total_long_term_liabilities = 0)

               <!-- SHORT TERM LIABILITIES CONFIGURATION -->
              @php($view_short_term_liabilities  = "")
              @php($total_short_term_liabilities = 0)

              <!-- GET ALL NATURE LIST DEFINE ESTATECH -->
              @php($nature_list = EF::getNatureList())

              <!-- 
                   ::::::::::RULE LIST::::::::::: 
                   DEBIT  - CREDIT USE ASSET & EXPENSE CASE  
                   CREDIT - DEBIT  USE INCOME LIABILTY & CAPITAL CASE
                   CREDIT - DEBIT RESULT ALWAYS POSITVE USING PHP abs(result)
              -->
              <!-- :::::::::::::: CREATE BALANCE SHEET :::::::::::::::::::: -->

              @foreach($balance_sheet as $rows)

                <!-- FIXED ASSET AT 0 LOCATION IN EF -->
                @if($rows->nature === $nature_list['0'])

                    @php($view_fixed_asset .= '<tr>
                      <td style="text-align:left;">&nbsp;'.$rows->name.'</td>
                      <td>'.EF::numberFormat(($rows->debit - $rows->credit)).'</td>
                      <td></td>
                    </tr>'
                    )

                    @php($total_fixed_asset += ($rows->debit - $rows->credit))

                <!-- CURRENT ASSET AT 0 LOCATION IN EF -->
                @elseif($rows->nature === $nature_list['1'])

                    @php($view_current_asset .= '<tr>
                      <td style="text-align:left;">&nbsp;'.$rows->name.'</td>
                      <td>'.EF::numberFormat(($rows->debit - $rows->credit)).'</td>
                      <td></td>
                    </tr>'
                    )

                    @php($total_current_asset += ($rows->debit - $rows->credit))

                

                 <!-- CAPITAL AT 2 LOCATION IN EF -->
                @elseif($rows->nature === $nature_list['2'])

                    @php($view_capital .= '<tr>
                      <td style="text-align:left;">&nbsp;'.$rows->name.'</td>
                      <td>'.EF::numberFormat(($rows->credit - $rows->debit)).'</td>
                      <td></td>
                    </tr>'
                    )
<!-- REMOVE ABS ON THIS PORTION ON THE BEHAFE OF UPPER MANAGEMENT -->
                    @php($total_capital += ($rows->debit - $rows->credit))
                <!-- LONG-TERM LIABILITIY AT 6 LOCATION IN EF -->
                @elseif($rows->nature === $nature_list['3'])

                    @php($view_long_term_liabilities .= '<tr>
                      <td style="text-align:left;">&nbsp;'.$rows->name.'</td>
                      <td>'.EF::numberFormat(($rows->credit - $rows->debit)).'</td>
                      <td></td>
                    </tr>'
                    )

                    @php($total_long_term_liabilities += ($rows->credit - $rows->debit))

                 <!-- SHORT-TERM LIABILITIY AT 6 LOCATION IN EF -->
                @elseif($rows->nature === $nature_list['4'])

                    @php($view_short_term_liabilities .= '<tr>
                      <td style="text-align:left;">&nbsp;'.$rows->name.'</td>
                      <td>'.EF::numberFormat(($rows->credit - $rows->debit)).'</td>
                      <td></td>
                    </tr>'
                    )

                    @php($total_short_term_liabilities += ($rows->credit - $rows->debit))

                @endif

              @endforeach
<!-- END REMOVE ABS ON THIS PORTION ON THE BEHAFE OF UPPER MANAGEMENT -->

              <!-- :::::::::::::: END BALANCE SHEET :::::::::::::::::::: -->


              <!-- STARRT ASSET -->
               @php($total_asset = ($total_current_asset + $total_fixed_asset))
               @php($slahes = '')

               @if(strlen(trim($view_fixed_asset)) === 0)
                  @php($slahes = '-')
               @endif

               <!-- FIXED ASSET -->
                <thead>
                  <tr>
                    <th style="text-align:left;">&nbsp;FIXED ASSET</th><th>{{$slahes}}</th><th>{{$slahes}}</th>
                  </tr>
                </thead>
                @if(strlen(trim($view_fixed_asset)) > 0)
                  <tbody>{!! $view_fixed_asset !!}</tbody>
                  <tfoot>
                    <tr style="font-weight: bolder; background: #EAECEF;">
                      <td>Subtotal</td>
                      <td>{{EF::numberFormat($total_fixed_asset)}}</td>
                      <td></td>
                    </tr>
                  </tfoot>
                @endif

              @php($slahes = '')

               @if(strlen(trim($view_current_asset)) === 0)
                  @php($slahes = '-')
               @endif
                <!-- CURRENT ASSET -->
                <thead>
                  <tr>
                    <th style="text-align:left;">&nbsp;CURRENT ASSET</th><th>{{$slahes}}</th><th>{{$slahes}}</th>
                  </tr>
                </thead>
                @if(strlen(trim($view_current_asset)) > 0)
                  <tbody>{!! $view_current_asset !!}</tbody>
                  <tfoot>
                    <tr style="font-weight: bolder; background: #EAECEF;">
                      <td>Subtotal</td>
                      <td>{{EF::numberFormat($total_current_asset)}}</td>
                      <td></td>
                    </tr>
                  </tfoot>
                @endif

                <tfoot>
                    <tr >
                      <td colspan="3">&nbsp;</td>
                    </tr>

                    <tr style="font-weight: bolder; background: #EAECEF;">
                      <td>Total Asset</td>
                      <td>{{EF::numberFormat($total_asset)}}</td>
                      <td></td>
                    </tr>
                </tfoot>
                <tfoot>
                  <tr><td colspan="3">&nbsp;</td></tr>
                </tfoot>
                <!-- END TOTAL ASSET -->


                <!-- CAPITAL PORTION -->
                @php($view_capital.= '<tr><td style="text-align: left;">&nbsp;Retained Earning</td><td>'.EF::numberFormat($retain_earning).'</td><td></td></tr>')
                @if(strlen(trim($view_capital)) > 0)
                  <tbody>{!! $view_capital !!}</tbody>
                @endif
                <tfoot>
                  <tr><td colspan="3">&nbsp;</td></tr>
                </tfoot>

                <!-- END CAPITAL PORTION -->

                <!-- LONG TERM LIABILITIES -->
                @if(strlen(trim($view_long_term_liabilities)) === 0)
                  @php($slahes = '-')
                @endif

                <thead>
                  <tr>
                    <th style="text-align:left;">&nbsp;Long Term Liabilities</th><th>{{$slahes}}</th><th>{{$slahes}}</th>
                  </tr>
                </thead>
                @if(strlen(trim($view_long_term_liabilities)) > 0)
                  <tbody>{!! $view_long_term_liabilities !!}</tbody>
                  <tfoot>
                    <tr style="font-weight: bolder; background: #EAECEF;">
                      <td>Subtotal</td>
                      <td>{{EF::numberFormat($total_long_term_liabilities)}}</td>
                      <td></td>
                    </tr>
                  </tfoot>
                @endif

               <!-- SHORT TERM LIABILITIES -->
              @php($slahes = '')

               @if(strlen(trim($view_short_term_liabilities)) === 0)
                  @php($slahes = '-')
               @endif
                <thead>
                  <tr>
                    <th style="text-align:left;">&nbsp;Short Term Liabilities</th><th>{{$slahes}}</th><th>{{$slahes}}</th>
                  </tr>
                </thead>
                @if(strlen(trim($view_short_term_liabilities)) > 0)
                  <tbody>{!! $view_short_term_liabilities !!}</tbody>
                  <tfoot>
                    <tr style="font-weight: bolder; background: #EAECEF;">
                      <td>Subtotal</td>
                      <td>{{EF::numberFormat($total_short_term_liabilities)}}</td>
                      <td></td>
                    </tr>
                  </tfoot>
                @endif

                <!-- FINAL CALCULATION -->

                <tfoot>

                    <tr >
                      <td colspan="3">&nbsp;</td>
                    </tr>

                    <tr style="font-weight: bolder; background: #EAECEF;">
                      <td>Total CAPITAL + LIABILITIES</td>
                      <td>{{EF::numberFormat($retain_earning + $total_capital + $total_long_term_liabilities + $total_short_term_liabilities)}}</td>
                      <td></td>
                    </tr>
                </tfoot>
                <!-- END FINAL CALCULATION -->
          </table>
      </div>
          
        </div>
     </div>

</body>
</html>