<script type="text/javascript">
    var params=0;
    $(function(){

        $("#show").click(function(){

            var warehouse= document.getElementById('warehouse');
            //var reason = document.getElementById('reason');
            var reason = document.getElementById('select_custom');
            $.ajax(
            {
                type: "POST",
                url: "<?= site_url() ?>reports/inventory/setparamsinsessionforinventory",
                dataType: "json",
                data: {WAREHOUSE:warehouse.value,REASON:reason.value},
                success: function(data){

                    document.getElementById("preview").src =  "<?= site_url() ?>reports/inventory/printinventory";
                },
                error:function (xhr, ajaxOptions, thrownError){
                    alert(thrownError);
                }
            });

            e.preventDefault();
            alert('here also ');
            return false;

        });

        $(document).ready(function() {
            $("button").button();
        });

    });
</script>
<!-- PRODUCT AUTOCOMPLETE -->
<style>
    .ui-autocomplete-loading { background: white url('<?= site_url() ?>public/images/ui-anim_basic_16x16.gif') right center no-repeat; }
</style>
<script type="text/javascript">
    $(function() {
        $( "#warehouse" ).autocomplete({
            source: function(request, response) {
                $.ajax({ url: "<?php echo site_url('warehouses/getwarehouseautocomplete'); ?>",
                    data: { term: $("#warehouse").val()},
                    dataType: "json",
                    type: "POST",
                    success: function(data){
                        response(data);

                    }
                });
            },
            minLength: 1
        });
    });
</script>

<div id="content-outer" class="main content clearfix">
    <!-- start content -->
    <div id="content">
        <!--  start page-heading -->
        <div id="page-heading" class ="page-heading">
            <h2>Inventory diary</h2>
        </div>
        <!-- end page-heading -->
        <table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
            <tr>
                <th rowspan="3" class="sized"><img src="<?= site_url() ?>images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
                <th class="topleft"></th>
                <td id="tbl-border-top">&nbsp;</td>
                <th class="topright"></th>
                <th rowspan="3" class="sized"><img src="<?= site_url() ?>images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
            </tr>
            <tr>
                <td id="tbl-border-left"></td>
                <td>
                    <!--  start content-table-inner ...................................................................... START -->
                    <div id="content-table-inner">
                        <!--  start table-content  -->
                        <div id="table-content">

                            <!--  start product-table ..................................................................................... -->

                            <table>
                                <td>
                                    &nbsp;&nbsp;Store<br>
                                    &nbsp;&nbsp;<input id="warehouse" name="warehouse" class="inp-form"/>
                                </td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                              <td>&nbsp;&nbsp;Reason<br>
                                    <select id="select_custom" name="type">
                                        <option value="" selected=’selected’>Select Reason</option>
                                        <option value="1">(IN) Purchase</option>
                                        <option value="2">(IN) Refund</option>
                                        <option value="4">(IN) Movement</option>
                                        <option value="5">(IN) Production</option>
                                        <option value="-1">(OUT) Sale</option>
                                        <option value="-2">(OUT) Refund</option>
                                        <option value="-3">(OUT) Break</option>
                                        <option value="-4">(OUT) Movement</option>
                                        <option value="1000">Crossing</option>
                                    </select>
                                </td>
<!--                                 <td>
                                &nbsp;&nbsp;Reason<br>
                                &nbsp;&nbsp;<input id="reason" name="reason" class="inp-form"/>
                            </td>-->

                                <th valign="middle">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
                                <td>
                                    <br>
                                    <button id="show" name="add">Show</button>
                                </td>

                                </tr>
                                <tr><td>&nbsp;</td></tr>
                            </table>
                            <br/>
                            <div align="center">
                                <iframe id="preview" name="preview" src="about:blank" frameborder="5" width="75%" height="600" marginheight="0" marginwidth="0"></iframe>

                            </div>

                            <!--  end content-table  -->

                            <div class="clear"></div>


                        </div>
                        <!--  end content-table-inner ............................................END  -->
                </td>
                <td id="tbl-border-right"></td>
            </tr>
            <tr>
                <th class="sized bottomleft"></th>
                <td id="tbl-border-bottom">&nbsp;</td>
                <th class="sized bottomright"></th>
            </tr>
        </table>
        <div class="clear">&nbsp;</div>

    </div>
    <!--  end content -->
    <div class="clear">&nbsp;</div>
</div>
<!--  end content-outer........................................................END -->

<div class="clear">&nbsp;</div>