@page "/LevelStatistics"

<PageContainer>
    <Breadcrumb>
        <Breadcrumb>
            <BreadcrumbItem>
                <a href="/Home"><Icon Type="home"></Icon></a>
            </BreadcrumbItem>
            <BreadcrumbItem>
                <Icon Type="manager"></Icon><span>代理人等级考核计算</span>
            </BreadcrumbItem>
        </Breadcrumb>
    </Breadcrumb>

    <ChildContent>
        <Card Title="">
            <Extra>
                <DatePicker TValue="DateTime?" @bind-Value="@SelectedTime" @Ref="refDate" Picker="@DatePickerType.Quarter" Locale="@CN" CultureInfo="CiCn"/>
                <Button Type="primary" Icon="folder-add" OnClick="()=>ShowSelectedDate()" Style="float:right">查看</Button>
            </Extra>
            <CardTabs>
                <Tabs>
                    <TabPane Key="A" Tab="A级代理人">
                        @if(AResult == null)
                        {
                            <spin/>
                        }
                        else
                        {
                            <table width="100%" border="1" style="line-height:40px;">

                                <thead>
                                    <tr>
                                        <th rowspan="2" width="10%">代理人</th>
                                        <th rowspan="2" width="16%">部门</th>
                                        <th rowspan="2" width="10%">代理人等级</th>
                                        <th colspan="4">承办</th>
                                        <th colspan="4">审核</th>
                                        <th rowspan="2" width="8%">Z1（承办）</th>
                                        <th rowspan="2" width="8%">Z2（核稿）</th>
                                    </tr>
                                    <tr>
                                        
                                        <th width="6%">S</th>
                                        <th width="6%">A</th>
                                        <th width="6%">B</th>
                                        <th width="6%">C</th>
                                        <th width="6%">S</th>
                                        <th width="6%">A</th>
                                        <th width="6%">B</th>
                                        <th width="6%">C</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach(var TemObj in AResult.Statistics)
                                    {
                                        <tr>
                                            <td align="center">@TemObj.StaffName</td>
                                            <td align="center">@TemObj.Department</td>
                                            <td align="center">@TemObj.Grade</td>
                                            <td align="center">@TemObj.dS</td>
                                            <td align="center">@TemObj.dA</td>
                                            <td align="center">@TemObj.dB</td>
                                            <td align="center">@TemObj.dC</td>
                                            <td align="center">@TemObj.vS</td>
                                            <td align="center">@TemObj.vA</td>
                                            <td align="center">@TemObj.vB</td>
                                            <td align="center">@TemObj.vC</td>
                                            <td align="center">@((AResult.pAverage(TemObj.StaffId)*100.00).ToString("0.00"))%</td>
                                            <td align="center">@((AResult.pvAverage(TemObj.StaffId)*100.00).ToString("0.00"))%</td>
                                        </tr>
                                    }
                                </tbody>
                            </table>
                        }
                    </TabPane>
                    <TabPane Key="B" Tab="B级代理人">
                        @if(BResult == null)
                        {
                            <spin/>
                        }
                        else
                        {
                            <table width="100%" border="1" style="line-height:40px;">

                                <thead>
                                    <tr>
                                        <th rowspan="2" width="10%">代理人</th>
                                        <th rowspan="2">部门</th>
                                        <th rowspan="2" width="10%">代理人等级</th>
                                        <th colspan="5">承办</th>
                                        <th rowspan="2" width="8%">Z1</th>
                                        <th rowspan="2" width="8%">B2（B*0.95)</th>
                                        <th rowspan="2" width="8%">B3（B*100%)</th>
                                        <th rowspan="2" width="8%">A1</th>
                                    </tr>
                                    <tr>
                                        
                                        <th width="6%">S</th>
                                        <th width="6%">A</th>
                                        <th width="6%">B</th>
                                        <th width="6%">C</th>
                                        <th width="6%">D</th>
                                        
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach(var TemObj in BResult.Statistics)
                                    {
                                        <tr>
                                            <td align="center">@TemObj.StaffName</td>
                                            <td align="center">@TemObj.Department</td>
                                            <td align="center">@TemObj.Grade</td>
                                            <td align="center">@TemObj.dS</td>
                                            <td align="center">@TemObj.dA</td>
                                            <td align="center">@TemObj.dB</td>
                                            <td align="center">@TemObj.dC</td>
                                            <td align="center">@TemObj.dD</td>
                                            <td align="center">@((BResult.pAverage(TemObj.StaffId)*100.00).ToString("0.00"))%</td>
                                            <td align="center">@((BResult.p2(TemObj.StaffId)*100.00).ToString("0.00"))%</td>
                                            <td align="center">@((BResult.p3(TemObj.StaffId)*100.00).ToString("0.00"))%</td>
                                            <td align="center">@((BResult.toUpgradeLevel(TemObj.StaffId)*100.00).ToString("0.00"))%</td>
                                        </tr>
                                    }
                                </tbody>
                            </table>
                        }
                    </TabPane>
                    <TabPane Key="C" Tab="C级代理人">
                        @if(CResult == null)
                        {
                            <spin/>
                        }
                        else
                        {
                            <table width="100%" border="1" style="line-height:40px;">

                                <thead>
                                    <tr>
                                        <th rowspan="2" width="10%">代理人</th>
                                        <th rowspan="2">部门</th>
                                        <th rowspan="2" width="10%">代理人等级</th>
                                        <th colspan="5">承办</th>
                                        <th rowspan="2" width="8%">Z1</th>
                                        <th rowspan="2" width="8%">C2(B*0.7)</th>
                                        <th rowspan="2" width="8%">C3(B*0.8))</th>
                                        <th rowspan="2" width="8%">B1(B*0.9）</th>
                                    </tr>
                                    <tr>
                                        
                                        <th width="6%">S</th>
                                        <th width="6%">A</th>
                                        <th width="6%">B</th>
                                        <th width="6%">C</th>
                                        <th width="6%">D</th>
                                        
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach(var TemObj in CResult.Statistics)
                                    {
                                        <tr>
                                            <td align="center">@TemObj.StaffName</td>
                                            <td align="center">@TemObj.Department</td>
                                            <td align="center">@TemObj.Grade</td>
                                            <td align="center">@TemObj.dS</td>
                                            <td align="center">@TemObj.dA</td>
                                            <td align="center">@TemObj.dB</td>
                                            <td align="center">@TemObj.dC</td>
                                            <td align="center">@TemObj.dD</td>
                                            <td align="center">@((CResult.pAverage(TemObj.StaffId)*100.00).ToString("0.00"))%</td>
                                            <td align="center">@((CResult.p2(TemObj.StaffId)*100.00).ToString("0.00"))%</td>
                                            <td align="center">@((CResult.p3(TemObj.StaffId)*100.00).ToString("0.00"))%</td>
                                            <td align="center">@((CResult.toUpgradeLevel(TemObj.StaffId)*100.00).ToString("0.00"))%</td>
                                        </tr>
                                    }
                                </tbody>
                            </table>
                        }
                    </TabPane>
                    <TabPane Key="D" Tab="D级代理人">
                       @if(CResult == null)
                        {
                            <spin/>
                        }
                        else
                        {
                            <table width="100%" border="1" style="line-height:40px;">

                                <thead>
                                    <tr>
                                        <th rowspan="2" width="10%">代理人</th>
                                        <th rowspan="2">部门</th>
                                        <th rowspan="2" width="10%">代理人等级</th>
                                        <th colspan="5">承办</th>
                                        <th rowspan="2" width="8%">Z1</th>
                                        <th rowspan="2" width="8%">D2（14）</th>
                                        <th rowspan="2" width="8%">D3（16）</th>
                                        <th rowspan="2" width="8%">C1（18）</th>
                                    </tr>
                                    <tr>
                                        
                                        <th width="6%">S</th>
                                        <th width="6%">A</th>
                                        <th width="6%">B</th>
                                        <th width="6%">C</th>
                                        <th width="6%">D</th>
                                        
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach(var TemObj in DResult.Statistics)
                                    {
                                        <tr>
                                            <td align="center">@TemObj.StaffName</td>
                                            <td align="center">@TemObj.Department</td>
                                            <td align="center">@TemObj.Grade</td>
                                            <td align="center">@TemObj.dS</td>
                                            <td align="center">@TemObj.dA</td>
                                            <td align="center">@TemObj.dB</td>
                                            <td align="center">@TemObj.dC</td>
                                            <td align="center">@TemObj.dD</td>
                                            <td align="center">@((DResult.pAverage(TemObj.StaffId)*100.00).ToString("0.00"))%</td>
                                            <td align="center">@((DResult.p2(TemObj.StaffId)*100.00).ToString("0.00"))%</td>
                                            <td align="center">@((DResult.p3(TemObj.StaffId)*100.00).ToString("0.00"))%</td>
                                            <td align="center">@((DResult.toUpgradeLevel(TemObj.StaffId)*100.00).ToString("0.00"))%</td>
                                        </tr>
                                    }
                                </tbody>
                            </table>
                        }
                    </TabPane>
                </Tabs>
            </CardTabs>
        </Card>
    </ChildContent>
</PageContainer>