From bb276f2bcc60f207a00ebe1b7fa132f759b77f70 Mon Sep 17 00:00:00 2001
From: chenzhi <chenzhi063@qq.com>
Date: Mon, 17 Feb 2020 18:32:22 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8E=A8=E5=B9=BF=E5=85=AC?=
 =?UTF-8?q?=E5=8F=B8=E5=88=97=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../PromoteCompanyController.class.php        |  29 ++-
 .../Admin/View/PromoteCompany/export.html     | 182 +++++++++---------
 .../Admin/View/PromoteCompany/lists.html      |  10 +
 3 files changed, 125 insertions(+), 96 deletions(-)

diff --git a/Application/Admin/Controller/PromoteCompanyController.class.php b/Application/Admin/Controller/PromoteCompanyController.class.php
index 1cc6d854c..29f49cf76 100644
--- a/Application/Admin/Controller/PromoteCompanyController.class.php
+++ b/Application/Admin/Controller/PromoteCompanyController.class.php
@@ -59,6 +59,8 @@ class PromoteCompanyController extends ThinkController
         $companyids = implode(',', array_column($companyres, 'id'));
         //获取所属会长及其游戏分成
         $promotemap['company_id']=["in",$companyids];
+        $promotemap['level'] = 1;
+        
         $promoteres = M("Promote","tab_")
                     ->field("id,company_id,account,settlement_type")
                     ->where($promotemap)
@@ -177,20 +179,29 @@ class PromoteCompanyController extends ThinkController
             if($v['platform_name'] == '' || $v['platform_name'] == "0"){
                 $v['platform_name'] = "--";
             }
-            $v["is_sign_contact"] = ($v["is_sign_contact"]=="1" ? "是" :'否');
             
-
+            $v["is_sign_contact"] = ($v["is_sign_contact"]=="1" ? "是" :'否');
+            $v["company_type"] = ($v["company_type"]=="1" ? "公司" :'个人');
+            $v["company_belong"] = ($v["company_belong"]=="0" ? "内团" : ($v["company_belong"]=="1" ? "外团" : ($v["company_belong"]=="2" ? "外团分发" : '无')));
         }
         // dd($companyres);
+        
+     
+        //公司及会长数量统计
+        $companycount = $model->field("id")->where($map)->select();
+        $count = count($companycount);
+        $companyallids = implode(',', array_column($companycount, 'id'));
+        $promotemap['company_id']=["in",$companyallids];
+        $promotecount = M("Promote","tab_")->where($promotemap)->count();
+
+        $this->assign('listData', $companyres);
+        $this->assign('count', $count);
+        $this->assign('promotecount', $promotecount);
         if($is_export){
-            $this->assign('listData', $companyres);
+            //导出
             $this->display("export");
             die();
         }
-        /* 查询记录总数 */
-        $count = $model
-            ->where($map)
-            ->count();
         //分页
         $parameter['p'] = $page;
         $parameter['row'] = $row;
@@ -198,9 +209,7 @@ class PromoteCompanyController extends ThinkController
         if ($page) {
             $this->assign('_page', $page);
         }
-
-        $this->assign('listData', $companyres);
-        $this->assign('count', $count);
+        //分配其他页面需要参数
         $this->assign('promoteList', getPromoteByLevel(1));
         $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Partner/lists'])->find());
         $this->meta_title = '推广公司';
diff --git a/Application/Admin/View/PromoteCompany/export.html b/Application/Admin/View/PromoteCompany/export.html
index d358bf1af..7232a461c 100644
--- a/Application/Admin/View/PromoteCompany/export.html
+++ b/Application/Admin/View/PromoteCompany/export.html
@@ -29,48 +29,67 @@
     <table border="1" id="exporttable" style="opacity: 0;">
         <!-- 表头 -->
         <thead>
-        <tr>
-            <th>合作方名称</th>
-            <th>对应平台</th>
-            <th>合同期限</th>
-            <th>开票税点</th>
-            <th>开户行</th>
-            <th>银行账号</th>
-            <th>是否签署合同</th>
-            <th>备注</th>
+            <tr>
+                <th>合作方名称</th>
+                <th>对应平台</th>
+                <th>公司性质</th>
+                <th>内外团归属</th>
+                <th>合同期限</th>
+                <th>开票税点</th>
+                <th>开户行</th>
+                <th>银行账号</th>
+                <th>是否签署合同</th>
+                <th>备注</th>
 
-            <th>会长账号</th>
-            <th>结算周期</th>
-            <th>产品类型</th>
-            <th>游戏名称</th>
-            <th colspan="2">合作方分成比例</th>
-        </tr>
-        </thead>
+                <th>会长账号</th>
+                <th>结算周期</th>
+                <th>产品类型</th>
+                <th>游戏名称</th>
+                <th colspan="2">合作方分成比例</th>
+            </tr>
+            </thead>
 
-        <!-- 列表 -->
-        <tbody>
-        <empty name ="listData">
-            <td colspan="99" class="text-center">aOh! 暂时还没有内容!</td>
-            <else />
-            <volist name="listData" id="data" key="companykey">
-                <tr>
-                    <td rowspan="{$data.row}">{$data.company_name}</td>
-                    <td rowspan="{$data.row}">{$data.platform_name}</td>
-                    <td rowspan="{$data.row}">{$data.contact_begin} - {$data.contact_end}</td>
-                    <td rowspan="{$data.row}">{$data.fax_ratio}%</td>
-                    <td rowspan="{$data.row}">{$data.bank_name}</td>
-                    <td rowspan="{$data.row}">&nbsp;{$data.bank_card}</td>
-                    <td rowspan="{$data.row}">{$data.is_sign_contact}</td>
-                    <td rowspan="{$data.row}">{$data.content}</td>
-                    <notempty name="data.list">
-                        <foreach name="data['list']" item="promote" key="promotekey">
-                            <if condition="$promotekey gt 0">
-                                <tr>
-                                    <td rowspan="{$promote['row']}"> {$promote['account']}</td>
-                                    <td rowspan="{$promote['row']}"> {$promote['settlement_type']}</td>
-                                    <foreach name="promote['list']" item="game" key="gamekey">
-                                        <if condition="$gamekey gt 0">
-                                            <tr>
+            <!-- 列表 -->
+            <tbody>
+            <empty name ="listData">
+                <td colspan="99" class="text-center">aOh! 暂时还没有内容!</td>
+                <else />
+                <volist name="listData" id="data" key="companykey">
+                    <tr>
+                        <td rowspan="{$data.row}">{$data.company_name}</td>
+                        <td rowspan="{$data.row}">{$data.platform_name}</td>
+                        <td rowspan="{$data.row}">{$data.company_type}</td>
+                        <td rowspan="{$data.row}">{$data.company_belong}</td>
+                        <td rowspan="{$data.row}">{$data.contact_begin} - {$data.contact_end}</td>
+                        <td rowspan="{$data.row}">{$data.fax_ratio}%</td>
+                        <td rowspan="{$data.row}">{$data.bank_name}</td>
+                        <td rowspan="{$data.row}">&nbsp;{$data.bank_card}</td>
+                        <td rowspan="{$data.row}">{$data.is_sign_contact}</td>
+                        <td rowspan="{$data.row}">{$data.content}</td>
+                        <notempty name="data.list">
+                            <foreach name="data['list']" item="promote" key="promotekey">
+                                <if condition="$promotekey gt 0">
+                                    <tr>
+                                        <td rowspan="{$promote['row']}"> &nbsp;{$promote['account']}</td>
+                                        <td rowspan="{$promote['row']}"> {$promote['settlement_type']}</td>
+                                        <foreach name="promote['list']" item="game" key="gamekey">
+                                            <if condition="$gamekey gt 0">
+                                                <tr>
+                                                    <td rowspan="{$game['row']}">{$game['game_type_name']}</td>
+                                                    <td rowspan="{$game['row']}">{$game['relation_game_name']}</td>
+                                                    <foreach name="game['turnover_ratio']" item="ratio" key="ratiokey">
+                                                        <if condition="$ratiokey gt 0">
+                                                            <tr>
+                                                                <td>{$ratio['name']}</td>
+                                                                <td>{$ratio['ratio']}</td>
+                                                            </tr>
+                                                        <else />
+                                                            <td>{$ratio['name']}</td>
+                                                            <td>{$ratio['ratio']}</td>
+                                                        </if>
+                                                    </foreach>
+                                                </tr>
+                                            <else />
                                                 <td rowspan="{$game['row']}">{$game['game_type_name']}</td>
                                                 <td rowspan="{$game['row']}">{$game['relation_game_name']}</td>
                                                 <foreach name="game['turnover_ratio']" item="ratio" key="ratiokey">
@@ -84,44 +103,14 @@
                                                         <td>{$ratio['ratio']}</td>
                                                     </if>
                                                 </foreach>
-                                            </tr>
-                                        <else />
-                                            <td rowspan="{$game['row']}">{$game['game_type_name']}</td>
-                                            <td rowspan="{$game['row']}">{$game['relation_game_name']}</td>
-                                            <foreach name="game['turnover_ratio']" item="ratio" key="ratiokey">
-                                                <if condition="$ratiokey gt 0">
-                                                    <tr>
-                                                        <td>{$ratio['name']}</td>
-                                                        <td>{$ratio['ratio']}</td>
-                                                    </tr>
-                                                <else />
-                                                    <td>{$ratio['name']}</td>
-                                                    <td>{$ratio['ratio']}</td>
-                                                </if>
-                                            </foreach>
-                                        </if>
-                                    </foreach>
-                                </tr>
-                            <else />
-                                <td rowspan="{$promote['row']}"> {$promote['account']}</td>
-                                <td rowspan="{$promote['row']}"> {$promote['settlement_type']}</td>
-                                <foreach name="promote['list']" item="game" key="gamekey">
-                                    <if condition="$gamekey eq 0">
-                                        <td rowspan="{$game['row']}">{$game['game_type_name']}</td>
-                                        <td rowspan="{$game['row']}">{$game['relation_game_name']}</td>
-                                        <foreach name="game['turnover_ratio']" item="ratio" key="ratiokey">
-                                            <if condition="$ratiokey gt 0">
-                                                <tr>
-                                                    <td>{$ratio['name']}</td>
-                                                    <td>{$ratio['ratio']}</td>
-                                                </tr>
-                                            <else />
-                                                <td>{$ratio['name']}</td>
-                                                <td>{$ratio['ratio']}</td>
                                             </if>
-                                        </foreach> 
-                                    <else />
-                                        <tr>
+                                        </foreach>
+                                    </tr>
+                                <else />
+                                    <td rowspan="{$promote['row']}"> &nbsp;{$promote['account']}</td>
+                                    <td rowspan="{$promote['row']}"> {$promote['settlement_type']}</td>
+                                    <foreach name="promote['list']" item="game" key="gamekey">
+                                        <if condition="$gamekey eq 0">
                                             <td rowspan="{$game['row']}">{$game['game_type_name']}</td>
                                             <td rowspan="{$game['row']}">{$game['relation_game_name']}</td>
                                             <foreach name="game['turnover_ratio']" item="ratio" key="ratiokey">
@@ -135,16 +124,37 @@
                                                     <td>{$ratio['ratio']}</td>
                                                 </if>
                                             </foreach> 
-                                        </tr>
-                                    </if>
-                                </foreach>
-                            </if>
-                        </foreach>
-                    </notempty>
+                                        <else />
+                                            <tr>
+                                                <td rowspan="{$game['row']}">{$game['game_type_name']}</td>
+                                                <td rowspan="{$game['row']}">{$game['relation_game_name']}</td>
+                                                <foreach name="game['turnover_ratio']" item="ratio" key="ratiokey">
+                                                    <if condition="$ratiokey gt 0">
+                                                        <tr>
+                                                            <td>{$ratio['name']}</td>
+                                                            <td>{$ratio['ratio']}</td>
+                                                        </tr>
+                                                    <else />
+                                                        <td>{$ratio['name']}</td>
+                                                        <td>{$ratio['ratio']}</td>
+                                                    </if>
+                                                </foreach> 
+                                            </tr>
+                                        </if>
+                                    </foreach>
+                                </if>
+                            </foreach>
+                        </notempty>
+                    </tr>
+                </volist>
+                <tr class="data_summary">
+                    <td style="text-align: center;">汇总:</td>
+                    <td colspan="15">
+                        累计推广公司数量:{$count}&#12288;&#12288;会长数量:{$promotecount}
+                    </td>
                 </tr>
-            </volist>
-        </empty>
-        </tbody>
+            </empty>
+            </tbody>
     </table>
 
 <script>
diff --git a/Application/Admin/View/PromoteCompany/lists.html b/Application/Admin/View/PromoteCompany/lists.html
index 65e229118..5f547a413 100644
--- a/Application/Admin/View/PromoteCompany/lists.html
+++ b/Application/Admin/View/PromoteCompany/lists.html
@@ -93,6 +93,8 @@
                     <th style="width:10%;min-width:150px;">操作</th>
                     <th>合作方名称</th>
                     <th>对应平台</th>
+                    <th>公司性质</th>
+                    <th>内外团归属</th>
                     <th>合同期限</th>
                     <th>开票税点</th>
                     <th>开户行</th>
@@ -122,6 +124,8 @@
                             </td>
                             <td rowspan="{$data.row}">{$data.company_name}</td>
                             <td rowspan="{$data.row}">{$data.platform_name}</td>
+                            <td rowspan="{$data.row}">{$data.company_type}</td>
+                            <td rowspan="{$data.row}">{$data.company_belong}</td>
                             <td rowspan="{$data.row}">{$data.contact_begin} - {$data.contact_end}</td>
                             <td rowspan="{$data.row}">{$data.fax_ratio}%</td>
                             <td rowspan="{$data.row}">{$data.bank_name}</td>
@@ -209,6 +213,12 @@
                             </notempty>
                         </tr>
                     </volist>
+                    <tr class="data_summary">
+                        <td style="text-align: center;">汇总:</td>
+                        <td colspan="16">
+                            累计推广公司数量:{$count}&#12288;&#12288;会长数量:{$promotecount}
+                        </td>
+                    </tr>
                 </empty>
                 </tbody>
             </table>