  <?php 
    $this->load->view('templates/header');
    $action                     = (isset($_GET['action'])) ? $_GET['action'] : "";
    $search_value_stock_id      = (isset($_GET['search_value_stock_id'])) ? $_GET['search_value_stock_id'] : 0;
    $search_value_user          = (isset($_GET['search_value_user'])) ? $_GET['search_value_user'] : 0;
    $search_value_party         = (isset($_GET['search_value_party'])) ? $_GET['search_value_party'] : 0;
    $search_value_broker        = (isset($_GET['search_value_broker'])) ? $_GET['search_value_broker'] : 0;
    $search_value_status        = (isset($_GET['search_value_status'])) ? $_GET['search_value_status'] : 0;    
    $search_value_entry_date    = (isset($_GET['search_value_entry_date'])) ? $_GET['search_value_entry_date'] : date('d-m-Y');    
    $search_value_entry_no      = (isset($_GET['search_value_entry_no'])) ? $_GET['search_value_entry_no'] : 0;    
    $search_value_cert          = (isset($_GET['search_value_cert'])) ? $_GET['search_value_cert'] : 0;    
  ?>
    <script>
        var link = "report";
        var sub_link = "group";
    </script>
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        GROUP
        <small>REPORT</small>
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
        <li class="active">GROUP 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/sold_report')?>" method="get">
                            <div class="panel panel-body remove-bottom">
                                <div class="form-group floating-form">
                                    
                                    
                                    <div class="col-md-1 col-sm-1 floating-label">
                                        <input type="text" class="form-control floating-input" name="search_value_entry_date" value="<?php echo $search_value_entry_date ?>" placeholder=" " autocomplete="off" readonly/>
                                        <label>DATE</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/group_report_excel'); ?>" class="btn btn-primary"><i class="fa fa-file-excel-o" aria-hidden="true"></i>
                                            Export
                                        </a>
                                    </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="15%">DIAMOND GROUP</th>
                                    <th width="15%">TOTAL STONE IN STOCK</th>    
                                    <th width="15%">STONE IN MEMO(ISSUE)</th>    
                                    <th width="15%">STONE IN MEMO(HOLD)</th>    
                                    <th width="15%">STONE SOLD</th>    
                                    <th width="15%"></th>    
                                    <th width="25%">STONE IN HAND</th>    
                                </tr>
                            </thead>
                            <tbody>
                        <?php
                            if(!empty($data['diamond_data'])):
                        ?>
                            <tr>
                                <td>FANCY (PE-PR-CU-HT-EM-OV)</td>                                
                                <td><?php echo $data['diamond_data']['FANCY (PE-PR-CU-HT-EM-OV)_in_hand']; ?></td>
                                <td><?php echo $data['diamond_data']['FANCY (PE-PR-CU-HT-EM-OV)_issue']; ?></td>
                                <td><?php echo $data['diamond_data']['FANCY (PE-PR-CU-HT-EM-OV)_hold']; ?></td>
                                <td><?php echo $data['diamond_data']['FANCY (PE-PR-CU-HT-EM-OV)_sold']; ?></td>
                                <td></td>
                                <td><?php echo $data['diamond_data']['FANCY (PE-PR-CU-HT-EM-OV)_in_hand'] - $data['diamond_data']['FANCY (PE-PR-CU-HT-EM-OV)_issue'] - $data['diamond_data']['FANCY (PE-PR-CU-HT-EM-OV)_hold'] - $data['diamond_data']['FANCY (PE-PR-CU-HT-EM-OV)_sold'] ?></td>
                            </tr> 
                            <tr>
                                <td>3.00 UP ( 3.00 TO 10.00)</td>                                
                                <td><?php echo $data['diamond_data']['3.00 UP ( 3.00 TO 10.00)_in_hand']; ?></td>
                                <td><?php echo $data['diamond_data']['3.00 UP ( 3.00 TO 10.00)_issue']; ?></td>
                                <td><?php echo $data['diamond_data']['3.00 UP ( 3.00 TO 10.00)_hold']; ?></td>
                                <td><?php echo $data['diamond_data']['3.00 UP ( 3.00 TO 10.00)_sold']; ?></td>
                                <td></td>
                                <td><?php echo $data['diamond_data']['3.00 UP ( 3.00 TO 10.00)_in_hand'] - $data['diamond_data']['3.00 UP ( 3.00 TO 10.00)_issue'] - $data['diamond_data']['3.00 UP ( 3.00 TO 10.00)_hold'] - $data['diamond_data']['3.00 UP ( 3.00 TO 10.00)_sold'] ?></td>
                            </tr> 
                            <tr>
                                <td>2.00 TO 2.99</td>                                
                                <td><?php echo $data['diamond_data']['2.00 TO 2.99_in_hand']; ?></td>
                                <td><?php echo $data['diamond_data']['2.00 TO 2.99_issue']; ?></td>
                                <td><?php echo $data['diamond_data']['2.00 TO 2.99_hold']; ?></td>
                                <td><?php echo $data['diamond_data']['2.00 TO 2.99_sold']; ?></td>
                                <td></td>
                                <td><?php echo $data['diamond_data']['2.00 TO 2.99_in_hand'] - $data['diamond_data']['2.00 TO 2.99_issue'] - $data['diamond_data']['2.00 TO 2.99_hold'] - $data['diamond_data']['2.00 TO 2.99_sold'] ?></td>
                            </tr>
                            <tr>
                                <td>1.50 TO 1.99</td>                                
                                <td><?php echo $data['diamond_data']['1.50 TO 1.99_in_hand']; ?></td>
                                <td><?php echo $data['diamond_data']['1.50 TO 1.99_issue']; ?></td>
                                <td><?php echo $data['diamond_data']['1.50 TO 1.99_hold']; ?></td>
                                <td><?php echo $data['diamond_data']['1.50 TO 1.99_sold']; ?></td>
                                <td></td>
                                <td><?php echo $data['diamond_data']['1.50 TO 1.99_in_hand'] - $data['diamond_data']['1.50 TO 1.99_issue'] - $data['diamond_data']['1.50 TO 1.99_hold'] - $data['diamond_data']['1.50 TO 1.99_sold'] ?></td>
                            </tr>
                            <tr>
                                <td>1.00 TO 1.49</td>                                
                                <td><?php echo $data['diamond_data']['1.00 TO 1.49_in_hand']; ?></td>
                                <td><?php echo $data['diamond_data']['1.00 TO 1.49_issue']; ?></td>
                                <td><?php echo $data['diamond_data']['1.00 TO 1.49_hold']; ?></td>
                                <td><?php echo $data['diamond_data']['1.00 TO 1.49_sold']; ?></td>
                                <td></td>
                                <td><?php echo $data['diamond_data']['1.00 TO 1.49_in_hand'] - $data['diamond_data']['1.00 TO 1.49_issue'] - $data['diamond_data']['1.00 TO 1.49_hold'] - $data['diamond_data']['1.00 TO 1.49_sold'] ?></td>
                            </tr>
                            <tr>
                                <td>0.90 TO 0.99</td>                                
                                <td><?php echo $data['diamond_data']['0.90 TO 0.99_in_hand']; ?></td>
                                <td><?php echo $data['diamond_data']['0.90 TO 0.99_issue']; ?></td>
                                <td><?php echo $data['diamond_data']['0.90 TO 0.99_hold']; ?></td>
                                <td><?php echo $data['diamond_data']['0.90 TO 0.99_sold']; ?></td>
                                <td></td>
                                <td><?php echo $data['diamond_data']['0.90 TO 0.99_in_hand'] - $data['diamond_data']['0.90 TO 0.99_issue'] - $data['diamond_data']['0.90 TO 0.99_hold'] - $data['diamond_data']['0.90 TO 0.99_sold'] ?></td>
                            </tr>
                            <tr>
                                <td>0.80 TO 0.89</td>                                
                                <td><?php echo $data['diamond_data']['0.80 TO 0.89_in_hand']; ?></td>
                                <td><?php echo $data['diamond_data']['0.80 TO 0.89_issue']; ?></td>
                                <td><?php echo $data['diamond_data']['0.80 TO 0.89_hold']; ?></td>
                                <td><?php echo $data['diamond_data']['0.80 TO 0.89_sold']; ?></td>
                                <td></td>
                                <td><?php echo $data['diamond_data']['0.80 TO 0.89_in_hand'] - $data['diamond_data']['0.80 TO 0.89_issue'] - $data['diamond_data']['0.80 TO 0.89_hold'] - $data['diamond_data']['0.80 TO 0.89_sold'] ?></td>
                            </tr> 
                            <tr>
                                <td>0.70 TO 0.79</td>                                
                                <td><?php echo $data['diamond_data']['0.70 TO 0.79_in_hand']; ?></td>
                                <td><?php echo $data['diamond_data']['0.70 TO 0.79_issue']; ?></td>
                                <td><?php echo $data['diamond_data']['0.70 TO 0.79_hold']; ?></td>
                                <td><?php echo $data['diamond_data']['0.70 TO 0.79_sold']; ?></td>
                                <td></td>
                                <td><?php echo $data['diamond_data']['0.70 TO 0.79_in_hand'] - $data['diamond_data']['0.70 TO 0.79_issue'] - $data['diamond_data']['0.70 TO 0.79_hold'] - $data['diamond_data']['0.70 TO 0.79_sold'] ?></td>
                            </tr>
                            <tr>
                                <td>0.01 TO 0.69</td>                                
                                <td><?php echo $data['diamond_data']['0.01 TO 0.69_in_hand']; ?></td>
                                <td><?php echo $data['diamond_data']['0.01 TO 0.69_issue']; ?></td>
                                <td><?php echo $data['diamond_data']['0.01 TO 0.69_hold']; ?></td>
                                <td><?php echo $data['diamond_data']['0.01 TO 0.69_sold']; ?></td>
                                <td></td>
                                <td><?php echo $data['diamond_data']['0.01 TO 0.69_in_hand'] - $data['diamond_data']['0.01 TO 0.69_issue'] - $data['diamond_data']['0.01 TO 0.69_hold'] - $data['diamond_data']['0.01 TO 0.69_sold'] ?></td>
                            </tr> 
                            <tr>
                                <td>NON - CERTS</td>                                
                                <td><?php echo $data['diamond_data']['NON_in_hand']; ?></td>
                                <td><?php echo $data['diamond_data']['NON_issue']; ?></td>
                                <td><?php echo $data['diamond_data']['NON_hold']; ?></td>
                                <td><?php echo $data['diamond_data']['NON_sold']; ?></td>
                                <td></td>
                                <td><?php echo $data['diamond_data']['NON_in_hand'] - $data['diamond_data']['NON_issue'] - $data['diamond_data']['NON_hold'] - $data['diamond_data']['NON_sold'] ?></td>
                            </tr> 
                        <?php
                            else:
                        ?>
                            <tr>
                                <td colspan="6" align="center" style="color: red;">No Record Found!</td>
                            </tr>
                        <?php
                            endif;
                        ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </section>
  <?php 
    $this->load->view('templates/footer');
   ?>
   <script type="text/javascript" >
       disable_enable_background(false)
   </script> 