<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==='byAccount', 'btn-default':filterSelect!='byAccount'}" style="margin-left: 15px;float: left;"
                        ng-click="filterSelectClick('byAccount')">按客户</button>
                    <button class="btn" ng-class="{'btn-primary': filterSelect==='byOwner', 'btn-default':filterSelect!='byOwner'}" style="margin-left: 15px;float: left;"
                        ng-click="filterSelectClick('byOwner')">按代表</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>
        <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({},"PureVenditionProfitExport",filterSelect==="byAccount"?"纯销毛利统计-按客户":"纯销毛利统计-按代表")'>导出</button>
            </div>
        </div>
    </form>
</div>

<div>
    <div class="row">
        <div class="col-lg-6 col-xs-8">
            <div class="small-box bg-aqua">
                <div class="inner">
                    <h3>{{vm.totalData.totalDoneQty|toFixNumber:2}}</h3>
                    <p>合计数量</p>
                </div>
                <div class="icon">
                    <i class="ion ion-connection-bars"></i>
                </div>
            </div>
        </div>
        <div class="col-lg-6 col-xs-8">
            <div class="small-box bg-green">
                <div class="inner">
                    <h3>{{vm.totalData.totalDoneAmount|toFixNumber:2}}</h3>
                    <p>合计金额</p>
                </div>
                <div class="icon">
                    <i class="ion ion-ios-pulse"></i>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="box box-primary" style="float:left;">
    <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 class="rt-text-align">部门</th>
                        <th class="rt-text-align">代表</th>
                        <th class="rt-text-align" ng-show="isAccountShow">客户</th>
                        <th class="rt-number-align">数量</th>
                        <th class="rt-number-align">金额</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="row in vm.reportData.DataList ">
                        <td class="rt-text-align">{{row.BusinessUnitIdName}}</td>
                        <td class="rt-text-align">{{row.OwnerIdName}}</td>
                        <td class="rt-text-align" ng-show="isAccountShow">{{row.AccountIdName}}</td>
                        <td class="rt-number-align">{{row.Done_Qty|toFixNumber:2}}</td>
                        <td class="rt-number-align">{{row.Done_Amount|toFixNumber:2}}</td>
                    </tr>
                </tbody>
            </table>
        </rt-data-grid>
    </div>
</div>