{% load i18n %}
<ol class="breadcrumb">
    <li>  {% trans "物流查询" %} </li> 
    <li>  {% trans "品名检查" %} </li> 
</ol>

<script type="text/javascript">
    $(document).ready(function(){

        $('.datepicker').datepicker({dateFormat: 'yy-mm-dd'});
        $('.datepicker').datepicker('setDate',new Date());
        setDatePickerZh();

        var table;
        function RefreshData(){
            var date_from,date_to;           
            date_fr=$('#dt_fr').val();
            date_to=$('#dt_to').val();
            var params=[];            
            if(date_fr!=''){params.push('date_fr='+date_fr)};
            if(date_to!=''){params.push('date_to='+date_to)};

            if(params.length==0){
                toastr.error("{% trans '请先输入查询条件！'%}");
            }else{
                $.ajax({
                    type:'GET',
                    url:'/inventory/stock/err/product/ajax?'+params.join('&') ,
                    dataType:'json',
                    success: function(data) {   
                        table=$('#tb').DataTable({
                            pageLength: 10,
                            dom: 'Bfrtip',
                            autoWidth: false,
                            buttons: [{extend:'excelHtml5',text:'导出到Excel'}],           
                            language:lng,           
                            data:data,
                            destroy:true,
                        });       
        
                        table.columns().every( function () {                        
                            var that = this;             
                            $('input', this.footer() ).on( 'keyup change clear', function () {
                                if ( that.search() !== this.value ) {
                                    that.search( this.value ).draw();
                                }
                            });
                        });           
                    }
                });
            }
        };
        RefreshData();
        $('.btn-qry').click(function(){
            RefreshData();
        });
       

        $('#tb').on("click","td a",function(){   
             event.preventDefault();
             $.OpenDlg($(this).attr('href'),'品名检查-明细列表',1000,700);

            return false;
        });        
    });
</script>

<form role="form"  class="form-inline" style="margin-top:35px;">
    <div class="col-sm-3 input-group">
        <span class="input-group-addon">{% trans "开始日期"%}</span>
        <input class="datepicker form-control" id="dt_fr" />
    </div>
    <div class="col-sm-3 input-group">
        <span class="input-group-addon">{% trans "结束日期"%}</span>
        <input class="datepicker form-control" id="dt_to" />
    </div>
    
    <div style="float:right;">
        <span class='input-group-btn'>
            <a type="button" class='btn btn-primary btn-qry'>
                <span class='glyphicon glyphicon-search'  style='padding-right:5px;'></span>{% trans '查看' %}
            </a>
        </span>
    </div>
</form>
<div class="clearfix"></div>


<div class='x_panel'>
<br/>
<div id="inventory-list" class="table-responsive">
    <table id="tb" class="table table-striped table-bordered dt-responsive" width="100%"  style='font-size:95%;'>
        <thead>
            <tr>                
                <th  style='width:7%'>{% trans "发货时间" %}</th>   
                <th  style='width:4%'>{% trans "发货单号" %}</th>
                <th  style='width:4%'>{% trans "操作人" %}</th>  
                <th  style='width:16%'>{% trans "经销商名称" %}</th>   
                <th  style='width:4%'>{% trans "总数" %}</th>             
                <th  style='width:4%'>{% trans "差异" %}</th>
                <th  style='width:16%'>{% trans "产品名称" %}</th>
                <th  style='width:16%'>{% trans "入库产品名称" %}</th>
            </tr>            
        </thead>
        <tbody></tbody>
        <tfoot>
            <th><input type="text" placeholder="{% trans "发货时间" %}"></th>
            <th><input type="text" placeholder="{% trans "发货单号" %}"></th>  
            <th><input type="text" placeholder="{% trans "操作人" %}"></th> 
            <th><input type="text" placeholder="{% trans "经销商名称" %}"></th> 
            <th><input type="text" placeholder="{% trans "总数" %}"></th>        
            <th><input type="text" placeholder="{% trans "差异" %}"></th>
            <th><input type="text" placeholder="{% trans "产品名称" %}"></th>    
            <th><input type="text" placeholder="{% trans "入库产品名称" %}"></th>                               
        </tfoot>
    </table>       
</div>
</div>
