<div class="box box-primary">
    <div class="box-header with-border">
        <h3 class="box-title">筛选</h3>
        <div class="box-tools pull-right">
            <button type="button" class="btn btn-box-tool" data-widget="collapse">
                <i class="fa fa-minus"></i>
            </button>
        </div>
    </div>
    <form class="form-horizontal">
        <div class="box-body">
            <div class="form-group">
                <label class="col-sm-2 control-label">月份</label>
                <div class="col-sm-3" style="width:15%;">
                    <rt-datetime-no-label ng-model="vm.Ym" rt-type="month"></rt-datetime-no-label>
                </div>

            </div>

            <div class="form-group">
                <rt-bu-tree-lookup rt-title="区域" rt-multiple="true" ng-model="vm.nodeSelected" rt-col="8" rt-label-col="2"></rt-bu-tree-lookup>
            </div>

            <div class="form-group">
                <rt-lookup2 rt-title="品种" ng-model="vm.salesRegionProductCategory" rt-get-data-name="Product.GetProductSize"
                    rt-order-by="code" rt-col-list="[{Code:'name',Name:'品种名称'},{Code:'size',Name:'品种规格'}]" rt-required="false" rt-col="4" rt-multiple="true"></rt-lookup2>
            </div>

            <div class="form-group">
                <rt-lookup2 rt-title="门店" ng-model="vm.accountSeleted" rt-get-data-name="Account.GetAllRetail" rt-order-by="name asc" rt-col-list="[{Code:'name',Name:'门店名称'},{Code:'accountnumber',Name:'门店编号'}]"
                    rt-required="false" rt-col="8" rt-label-col="2"></rt-lookup2>

            </div>
        </div>

        <div class="box-footer">
            <div class="btn-group pull-right">
                <button class="btn btn-primary" ng-click="vm.getReportData()">查询</button>
                <button class="btn btn-default" ng-click='vm.actions.export({
                        "BusinessUnitIdName":"区域",
                        "accountIdName":"门店",
                        "productIdName":"品种",
                        "productSize":"规格",
                        "beginStock":"期初库存",
                        "currentMonthStockIn":"当月入库",
                        "currentMonthStockOut":"当月出库",
                        "endStock":"期末库存",
                       },"DTPPSIExport","DTP进销存分析")'>导出</button>
            </div>
        </div>
    </form>
</div>

<div class="box box-primary">
    <div class="box box-body">
        <rt-data-grid rt-page-record-count="vm.recordCount" rt-page-index="vm.pageIndex" rt-page-size="vm.pageSize" rt-get-data="vm.getReportData()"
            rt-rows="vm.reportData" rt-auto-height="{{tableMaxHeight}} ">
            <table class="table table-condensed table-hover ng-scope" style="white-space:nowrap;" id="rt-report-header">
                <thead>
                    <tr>
                        <th rowspan="2" class="rt-text-align">区域</th>
                        <th rowspan="2" class="rt-text-align">门店</th>
                        <th rowspan="2" class="rt-text-align">品种</th>
                        <th rowspan="2" class="rt-text-align">规格</th>
                        <th rowspan="2" class="rt-number-align">期初库存</th>
                        <th rowspan="2" class="rt-number-align">当月入库</th>
                        <th rowspan="2" class="rt-number-align">当月出库</th>
                        <th rowspan="2" class="rt-number-align">期末库存</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="row in vm.reportData">
                        <td class="rt-text-align">{{row.BusinessUnitIdName}}</td>
                        <td class="rt-text-align">{{row.accountIdName}}</td>
                        <td class="rt-text-align">{{row.productIdName}}</td>
                        <td class="rt-text-align">{{row.productSize}}</td>                       
                        <td class="rt-number-align">{{row.beginStock}}</td>
                        <td class="rt-number-align">{{row.currentMonthStockIn}}</td>
                        <td class="rt-number-align">{{row.currentMonthStockOut}}</td>
                        <td class="rt-number-align">{{row.endStock}}</td>
                    </tr>
                </tbody>
            </table>
        </rt-data-grid>
    </div>
</div>