  <?php 
    $this->load->view('templates/header');
    $action                     = (isset($_GET['action'])) ? $_GET['action'] : "";
    $hsn_no    = (isset($_GET['hsn_no'])) ? $_GET['hsn_no'] : '';    
    $pro_id      = (isset($_GET['pro_id'])) ? $_GET['pro_id'] : '';    
  ?>
    <script>
        var link = "report";
        var sub_link = "hsn";
    </script>
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>HSN WISE SALE<small>REPORT</small></h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
        <li class="active">HSN Wise Sale Report</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-md-12 col-sm-12">
                <div class="box box-primary">
                    <!-- <div class="box-body"> -->
                        <form class="form-horizontal" id="search_form" action="<?php echo base_url('report/Reportctrl/hsnwise_sale_report')?>" method="get">
                            <div class="panel panel-body remove-bottom">
                                <div class="form-group floating-form">
                                    
                                   
                                    <div class="col-md-2 col-sm-1 floating-label">
                                        <?php echo form_dropdown('', $data['hsn_no'], $hsn_no,'id="hsn_no" name="hsn_no" class="form-control floating-select flexselect" ');?>
                                        <label>HSN NO</label>
                                    </div>                                  

                                    <div class="col-md-2 col-sm-2 floating-label">
                                        <?php echo form_dropdown('', $data['products'], $pro_id,'id="pro_id" name="pro_id" class="form-control floating-select flexselect" ');?>
                                        <label>PRODUCT</label>
                                    </div>

                                    <div class="col-md-1 col-sm-1 ">
                                        <button type="submit" class="btn btn-primary"><i class="fa fa-search" aria-hidden="true"></i>Search</button>                                   
                                        <input type="hidden" class="form-control" id="action" name="action" value="<?php echo $action ?>" />
                                    </div>

                                    <div class="col-md-1 col-sm-1">
                                        <a href="<?php echo base_url('report/Reportctrl/hsnwise_sale_report?action=view'); ?>" class="btn btn-primary"><i class="fa fa-undo" aria-hidden="true"></i>
                                            Reset
                                        </a>
                                    </div>
                                    <div class="col-md-1 col-sm-1">
                                       
                                        <a target="_blank" href="<?php echo base_url('report/Reportctrl/hsnwise_sale_report_print?hsn_no='.$hsn_no.'&pro_id='.$pro_id); ?>" class="btn btn-primary"><i class="fa fa-print" aria-hidden="true"></i>
                                            Print
                                        </a>
                                    </div>
                                    <div class="col-md-1 col-sm-1 ">
                                        <label for="inputEmail3" class="col-sm-1 control-label control-label_custom" style="width:100%;">
                                            Count :
                                            <span id="count_reload">                         
                                                <i id="total_rows"><?php echo $total_rows;?></i>
                                            </span>
                                        </label>                                        
                                    </div>                                    
                                </div>
                            </div>                            
                        </form>
                    <!-- </div> -->
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-12">     
                <div class="box">
                    <div class="box-body" id="table_reload">
                        <table class="table table-bordered table-striped">
                            <thead>
                                <tr>
                                    <th width="5%">#</th>
                                    <th>HSN Code</th>   
                                    <th>PRODUCT NAME</th> 
                                    <th>TOTAL QTY</th>
                                    <th>TOTAL RATE</th>
                                    <th>TOTAL CGST</th>
                                    <th>TOTAL SGST</th>
                                    <th>TOTAL IGST</th>
                                    <th>TOTAL AMT</th>
                                </tr>
                            </thead>
                            <tbody>
                        <?php
                            if(!empty($data['hsn_data'])):
                            foreach ($data['hsn_data'] as $key => $value):
                                $hsn_code       =  $value['pro_hsn_code'];
                                $product_name       =  $value['pro_name'];
                                $total_qty   = $value['total_qty'];
                                $total_rate   = $value['total_rate'];
                                $total_cgst   = $value['total_cgst'];
                                $total_sgst   = $value['total_sgst'];
                                $total_igst   = $value['total_igst'];
                                $total_amt   = $value['total_amt'];
                        ?>
                            <tr>
                                <td><?php echo $key+1 ?></td>                                
                                <td><?php echo $hsn_code; ?></td>
                                <td><?php echo $product_name; ?></td>
                                <td><?php echo $total_qty; ?></td>
                                <td><?php echo $total_rate; ?></td>
                                <td><?php echo $total_cgst; ?></td>
                                <td><?php echo $total_sgst; ?></td>
                                <td><?php echo $total_igst; ?></td>
                                <td><?php echo $total_amt; ?></td>
                            </tr> 
                        <?php
                            endforeach;
                            else:
                        ?>
                            <tr>
                                <td colspan="10" align="center" style="color: red;">No Record Found!</td>
                            </tr>
                        <?php
                            endif;
                        ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="text-right">
                <?= $this->pagination->create_links(); ?>
            </div>
        </div>
    </section>
  <?php 
    $this->load->view('templates/footer');
   ?>
   <script type="text/javascript" >
       disable_enable_background(false)
   </script> 