<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">
                <div class="col-sm-12">
                    <label class="col-sm-2 control-label">机构类型</label>
                    <button class="btn" ng-class="{'btn-primary': filterSelect=='byAll', 'btn-default':filterSelect!='byAll'}"
                            style="margin-left: 15px;float: left;" ng-click="filterSelect = 'byAll'">全部</button>
                    <button class="btn" ng-class="{'btn-primary': filterSelect=='byBusiness', 'btn-default':filterSelect!='byBusiness'}"
                            style="margin-left: 15px;float: left;" ng-click="filterSelect = 'byBusiness'">按商业</button>
                    <button class="btn" ng-class="{'btn-primary': filterSelect=='byAgent', 'btn-default':filterSelect!='byAgent'}" style="margin-left: 15px;float: left;"
                            ng-click="filterSelect = 'byAgent'">按代理商</button>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-12">
                    <label class="col-sm-2 control-label">时间筛选</label>
                    <button class="btn" ng-class="{'btn-primary': dateSelect=='fullYear', 'btn-default':dateSelect!='fullYear'}" style="margin-left: 15px;float: left;"
                        ng-click="vm.changeDate('fullYear')">全年</button>
                    <button class="btn" ng-class="{'btn-primary': dateSelect=='thisMonth', 'btn-default':dateSelect!='thisMonth'}" style="margin-left: 15px;float: left;"
                        ng-click="vm.changeDate('thisMonth')">本月</button>
                    <button class="btn" ng-class="{'btn-primary': dateSelect=='lastMonth', 'btn-default':dateSelect!='lastMonth'}" style="margin-left: 15px;float: left;"
                        ng-click="vm.changeDate('lastMonth')">上月</button>
                    <button class="btn" ng-class="{'btn-primary': dateSelect=='thisQuarter', 'btn-default':dateSelect!='thisQuarter'}" style="margin-left: 15px;float: left;"
                        ng-click="vm.changeDate('thisQuarter')">本季度</button>
                    <button class="btn" ng-class="{'btn-primary': dateSelect=='lastQuarter', 'btn-default':dateSelect!='lastQuarter'}" style="margin-left: 15px;float: left;"
                        ng-click="vm.changeDate('lastQuarter')">上季度</button>
                    <button class="btn" ng-class="{'btn-primary': dateSelect=='custom', 'btn-default':dateSelect!='custom'}" style="margin-left: 15px;float: left;"
                        ng-click="vm.changeDate('custom')">自定义</button>

                    <div class="col-sm-3" style="width:15%;" ng-if="dateSelect=='custom'">
                        <rt-datetime-no-label ng-model="vm.sYm" rt-type="month"></rt-datetime-no-label>
                    </div>
                    <div style="float: left;" ng-show="dateSelect=='custom'">~</div>
                    <div class="col-sm-3" style="width:15%;" ng-if="dateSelect=='custom'">
                        <rt-datetime-no-label ng-model="vm.eYm" rt-type="month"></rt-datetime-no-label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-12">
                    <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>
			<div class="form-group">
				<div class="col-sm-12">
					<!--<rt-lookup2 rt-title="药品筛选" ng-model="vm.productSelected" rt-get-data-name="Product.GetProductCategory" rt-order-by="name asc"
		 				rt-col-list="[{Code:'name',Name:'药品名称'},{Code:'code',Name:'编号'}]" rt-multiple="true" rt-col="8"></rt-lookup2>-->
                    <label class="col-sm-2 control-label">品种筛选</label>
                    <div class="col-sm-8">
                        <ui-select class="form" multiple allow-clear sortable="true" theme="bootstrap" close-on-select="false" ng-model="vm.productSelected">
                            <ui-select-match>{{$item.Name}}</ui-select-match>
                            <ui-select-choices repeat="item in vm.productList | filter: {Name: $select.search}">
                                <span ng-bind-html="item.Name | highlight: $select.search"></span>
                            </ui-select-choices>
                        </ui-select>
                    </div>
				</div>
			</div>
        </div>
        <div class="box-footer">
            <div class="btn-group pull-right">
                <button class="btn btn-primary" ng-click="vm.getChartData();vm.getReportData()">查询</button>
                <button class="btn btn-default" ng-click='vm.actions.export({},"BusiSaleRankExport","按商业/代理商销量排名报表")'>导出</button>
            </div>
        </div>
    </form>
</div>

<div class="box box-primary" style="width:49%;float:left;">
    <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>
    <div class="box-body">
        <div class="row">
            <div id="report1" style="width:100%;height:500px">
            </div>
        </div>
    </div>
</div>


<div class="box box-primary" style="width:49%;float:right;">
    <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>
    <div class="box-body">
        <div class="row">
            <div id="report2" style="width:100%;height:500px">
            </div>
        </div>
    </div>
</div>


<div class="box box-primary" style="float:left;">
    <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>
    <div class="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">
							事业部
						</th>
						<th rowspan="2">
							业务线
						</th>
						<th rowspan="2">
							省区/地区
						</th>
						<th rowspan="2">
							代表
						</th>
						<th rowspan="2">
							名称
						</th>
						<th rowspan="2">
							品种
						</th>
						<th rowspan="2" class="rt-number-align">
							累计销量
						</th>
						<th rowspan="2" class="rt-number-align">
							累计金额（万元）
						</th>
						<th colspan="2" align="center" ng-repeat="item in vm.MonDataList">{{item}} 月</th>
					</tr>
					<tr>
						<th class="rt-number-align" ng-repeat="Mtext in vm.TbMessText track by $index">{{Mtext}}
						</th>
					</tr>
				</thead>
                <tbody>
                    <tr ng-repeat="row in vm.reportData ">
                        <td>{{row.buidname}}</td>
                        <td>{{row.bigdeptidname}}</td>
                        <td>{{row.businessunitidname}}</td>
						<td>{{row.owneridname}}</td>
						<td>{{row.accountidname}}</td>
						<td>{{row.product_categoryidname}}</td>
						<td class="rt-number-align">{{row.total_qty}}</td>
						<td class="rt-number-align">{{row.total_amount}}</td>
						<td ng-repeat="Items in row.monthList track by $index" class="rt-number-align">{{Items}}
						</td>
                    </tr>
                </tbody>
            </table>
        </rt-data-grid>
    </div>
</div> 