<aside class="right-side">

    <!-- Main content -->

    <section class="content">

        <div class="row">

            <div class="col-xs-12">

                <!-- /.box -->

                

                <div class="box box-primary">

                    <?php 

						$general 	= get_general_setting();                       

                        $basic 		= get_basic_setting();

                        $design 	= get_design_setting();

                    ?>

                    <div class="box-body table-responsive" style="clear:both;" id="print_data_container">

                        <div>

                            <table border="0" width="1000" style="border-collapse:collapse;">

                                <tr>

                                    <td width="20%" style="border-right:1px solid #FFF;">

                                        <?php  if ((!empty($design->logo)) && (file_exists(FCPATH . DIR_COMPANY_LOGO . $design->logo))) {

                                            $image_url = DIR_COMPANY_LOGO . $design->logo;

                                            $alt = $basic->temple_name;

                                        }

                                        else {

                                            $image_url = 'assets/images/logo.png';

                                            $alt = 'Logo not found!';

                                        } ?>

                                        <div style="font-size: 14px;">

                                            <div><span style="float:left;width:155px;height:75px; margin:2px;"><img src="<?php echo $image_url;?>" alt="<?php echo $alt;?>" width="155" height="75" /></span></div>

                                        </div>

                                    </td>

                                    <td width="15%">&nbsp;</td>

                                    <td width="40%" align="center">

                                        <span style="float:left;font-family:Arial, Helvetica, sans-serif;font-weight:bold; margin-bottom: 20px;">

                                            <span style="font-size:18px;"><?php echo $basic->temple_name;?></span>

                                        </span>

                                    </td>

                                    <td width="15%">&nbsp;</td>

                                    <td width="10%">&nbsp;</td>

                                </tr>

                              	<tr><td colspan="5" style="border-top:1px solid #666;">&nbsp;</td></tr>

                                <tr><td colspan="5" align="center"><strong>Inventory Stock Report</strong></td></tr>

                                <tr>

                                	<?php $category	= $this->inventory_stock_report_model->get_category_by_id($filter['category']);  ?>

                                    <?php $item		= $this->inventory_stock_report_model->get_item_by_id($filter['item']);  ?>

                                    <?php $itemcode	= $this->inventory_stock_report_model->get_itemcode_by_id($filter['itemcode']);  ?>

                                    <td align="left" nowrap="nowrap"><strong>Category : <?php echo ($category)? $category : "All Category"; ?></strong></td>

                                    <td colspan="3" align="center"><strong>Item : <?php echo ($item)? $item : "All Items"; ?></strong></td>

                                    <?php if($itemcode){?> <td align="right" nowrap="nowrap"><strong>Item Code : <?php echo $itemcode; ?></strong></td><?php } ?>

                                </tr>

                           

                            </table>

                            <br/>

                                

                            <table width="1000" border="1" cellpadding="3" cellspacing="0" style="font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; font-size:14px; width: 1000px; border-collapse:collapse;" class="filterTable" id="filterTable">

                                <thead>

                                    <tr>

                                        <th style="padding:1%;" width="6%">S.No</th>

                                        <th style="padding:1%;">Category Name</th>

                                        <th style="padding:1%;">Item Name</th>

                                        <th style="padding:1%;">Purchased Qty</th>

                                        <th style="padding:1%;">Issued Qty</th>

                                        <th style="padding:1%;">Available Qty</th>

                                    </tr>

                                </thead>

                                

                                <?php if( !empty( $results ) ) : ?>

                                    <tbody>

                                       <?php foreach($results as $k => $r ) :  //echo "<pre>"; print_r($r); echo "</pre>";?>

											<?php $category	= $this->inventory_stock_report_model->get_category_by_id($r['inv_cat_id']);  ?>

                                            <?php $item		= $this->inventory_stock_report_model->get_item_by_id($r['inv_item_id']);  ?>

                                            <tr>

                                                <td align="center" style="padding:1%;"><?php echo $k+1; ?></td>

                                                <td style="padding:1%;"><?php echo $category; ?></td>

                                                <td style="padding:1%;"><?php echo $item; ?></td>

                                                <td style="padding:1%;"><?php echo ($r['now_avail_qty'] + $r['total_issued_qty']); ?></td>

                                                <td style="padding:1%;"><?php echo $r['total_issued_qty']; ?></td>                                                

                                                <td style="padding:1%;"><?php echo $r['now_avail_qty']; ?></td>                                                    

                                            </tr>

                                        <?php endforeach; ?>

                                    </tbody>



                                <?php else : ?>

                                    <tbody>

                                        <tr>

                                            <td colspan="6" style="color: #0B6CCB;"><center>No Records Found!</center></td>

                                        </tr>

                                    </tbody>

                                <?php endif; ?>

                            </table>

                        </div>

                    </div>

                

                    

                </div><!-- /.box -->

            </div>

        </div>

    </section><!-- /.content -->

</aside><!-- /.right-side -->

<!-- ./wrapper -->

<?php if( !IS_KSK ) : ?>

<script type="text/javascript">

    window.onload = function() {

        print_layout();

    } 

    

    $(document).ready(function(){

        $('.print').click(function(){

            print_layout();

        });

    });

    

    function print_layout() {

        var body = $('#print_data_container').html();

        var newWin = document.getElementById('report').contentWindow;

        newWin.document.write(body);

        newWin.document.close(); //important!

        newWin.focus(); //IE fix

        newWin.print();

        window.location.href = '<?php echo base_url();?>expenses_report';

    }



</script>

<?php endif;