liuhairui 2 tuần trước cách đây
mục cha
commit
4aaeee254d

+ 177 - 63
application/admin/controller/Procuremen.php

@@ -1736,6 +1736,7 @@ class Procuremen extends Backend
             return [];
             return [];
         }
         }
         $gymcMap = [];
         $gymcMap = [];
+        $qtyBySid = [];
         foreach ($bundle['merge_rows'] ?? [] as $mr) {
         foreach ($bundle['merge_rows'] ?? [] as $mr) {
             if (!is_array($mr)) {
             if (!is_array($mr)) {
                 continue;
                 continue;
@@ -1743,6 +1744,11 @@ class Procuremen extends Backend
             $gid = $this->extractScydgyRowId($mr);
             $gid = $this->extractScydgyRowId($mr);
             if ($this->isValidScydgyRowId($gid)) {
             if ($this->isValidScydgyRowId($gid)) {
                 $gymcMap[$gid] = trim((string)($mr['CGYMC'] ?? ''));
                 $gymcMap[$gid] = trim((string)($mr['CGYMC'] ?? ''));
+                $qty = trim((string)($mr['This_quantity'] ?? ''));
+                if ($qty === '') {
+                    $qty = trim((string)($mr['NGZL'] ?? ''));
+                }
+                $qtyBySid[$gid] = $qty;
             }
             }
         }
         }
         foreach ($bundle['pos'] ?? [] as $po) {
         foreach ($bundle['pos'] ?? [] as $po) {
@@ -1811,15 +1817,27 @@ class Procuremen extends Backend
                 $deliveryShow = $deliveryRaw;
                 $deliveryShow = $deliveryRaw;
             }
             }
             $amountFilled = ($am !== '' && $am !== '0' && $am !== '0.00');
             $amountFilled = ($am !== '' && $am !== '0' && $am !== '0.00');
-            $deliveryFilled = ($deliveryShow !== '');
+            $deliveryFilled = ($deliveryShow !== '' && !preg_match('/^0000-00-00/i', $deliveryShow));
+            $amountNum = $this->parseProcuremenMoneyNumber($d['amount'] ?? null);
+            $subtotal = null;
+            if ($amountNum !== null) {
+                $subtotal = $this->calcProcuremenDetailSubtotal($d['amount'] ?? null, $qtyBySid[$sid] ?? '');
+            }
+            $unitPriceText = $amountFilled
+                ? ($amountNum !== null ? $this->formatProcuremenMoneyDisplay($amountNum) : $am)
+                : '未填写';
             $byCompany[$cn]['lines'][] = [
             $byCompany[$cn]['lines'][] = [
                 'cgymc'           => $gymc,
                 'cgymc'           => $gymc,
                 'amount'          => $am,
                 'amount'          => $am,
-                'amount_show'     => $amountFilled ? $am : '',
+                'amount_show'     => $amountFilled ? ($amountNum !== null ? $this->formatProcuremenMoneyDisplay($amountNum) : $am) : '',
                 'amount_filled'   => $amountFilled,
                 'amount_filled'   => $amountFilled,
+                'unit_price_text' => $unitPriceText,
                 'delivery'        => $deliveryRaw,
                 'delivery'        => $deliveryRaw,
-                'delivery_show'   => $deliveryFilled ? $deliveryShow : '',
+                'delivery_show'   => $deliveryFilled ? $deliveryShow : '未填写',
                 'delivery_filled' => $deliveryFilled,
                 'delivery_filled' => $deliveryFilled,
+                'delivery_ymd'    => $deliveryFilled ? $deliveryShow : '',
+                'subtotal_text'   => $subtotal !== null ? $this->formatProcuremenMoneyDisplay($subtotal) : '',
+                'subtotal_num'    => $subtotal,
                 'status_name'     => trim((string)($d['status_name'] ?? '')),
                 'status_name'     => trim((string)($d['status_name'] ?? '')),
                 'is_quoted'       => $amountFilled,
                 'is_quoted'       => $amountFilled,
                 'quote_label'     => $amountFilled ? '已报价' : '未报价',
                 'quote_label'     => $amountFilled ? '已报价' : '未报价',
@@ -1828,13 +1846,23 @@ class Procuremen extends Backend
         foreach ($byCompany as $cn => $g) {
         foreach ($byCompany as $cn => $g) {
             $total = count($g['lines']);
             $total = count($g['lines']);
             $quoted = 0;
             $quoted = 0;
+            $groupTotal = 0.0;
+            $groupHasTotal = false;
             foreach ($g['lines'] as $ln) {
             foreach ($g['lines'] as $ln) {
                 $am = trim((string)($ln['amount'] ?? ''));
                 $am = trim((string)($ln['amount'] ?? ''));
                 if ($am !== '' && $am !== '0' && $am !== '0.00') {
                 if ($am !== '' && $am !== '0' && $am !== '0.00') {
                     $quoted++;
                     $quoted++;
                 }
                 }
+                if (isset($ln['subtotal_num']) && $ln['subtotal_num'] !== null) {
+                    $groupTotal += (float)$ln['subtotal_num'];
+                    $groupHasTotal = true;
+                }
             }
             }
             $byCompany[$cn]['has_quote'] = $total > 0 && $quoted === $total;
             $byCompany[$cn]['has_quote'] = $total > 0 && $quoted === $total;
+            $byCompany[$cn]['line_count'] = $total;
+            $byCompany[$cn]['has_total'] = $total > 0;
+            $byCompany[$cn]['total_text'] = $groupHasTotal ? $this->formatProcuremenMoneyDisplay($groupTotal) : '';
+            $byCompany[$cn]['display_rowspan'] = $total + ($total > 0 ? 1 : 0);
         }
         }
 
 
         return array_values($byCompany);
         return array_values($byCompany);
@@ -1901,6 +1929,8 @@ class Procuremen extends Backend
             return [];
             return [];
         }
         }
         $gymcMap = [];
         $gymcMap = [];
+        $qtyBySid = [];
+        $orderedSids = [];
         foreach ($bundle['merge_rows'] ?? [] as $mr) {
         foreach ($bundle['merge_rows'] ?? [] as $mr) {
             if (!is_array($mr)) {
             if (!is_array($mr)) {
                 continue;
                 continue;
@@ -1908,6 +1938,12 @@ class Procuremen extends Backend
             $gid = $this->extractScydgyRowId($mr);
             $gid = $this->extractScydgyRowId($mr);
             if ($this->isValidScydgyRowId($gid)) {
             if ($this->isValidScydgyRowId($gid)) {
                 $gymcMap[$gid] = trim((string)($mr['CGYMC'] ?? ''));
                 $gymcMap[$gid] = trim((string)($mr['CGYMC'] ?? ''));
+                $orderedSids[] = $gid;
+                $qty = trim((string)($mr['This_quantity'] ?? ''));
+                if ($qty === '') {
+                    $qty = trim((string)($mr['NGZL'] ?? ''));
+                }
+                $qtyBySid[$gid] = $qty;
             }
             }
         }
         }
         foreach ($bundle['pos'] ?? [] as $po) {
         foreach ($bundle['pos'] ?? [] as $po) {
@@ -1982,11 +2018,25 @@ class Procuremen extends Backend
             if ($deliveryShow === '' && $deliveryRaw !== '') {
             if ($deliveryShow === '' && $deliveryRaw !== '') {
                 $deliveryShow = $deliveryRaw;
                 $deliveryShow = $deliveryRaw;
             }
             }
+            $deliveryFilled = ($deliveryShow !== '' && !preg_match('/^0000-00-00/i', $deliveryShow));
+            $amountNum = $this->parseProcuremenMoneyNumber($d['amount'] ?? null);
+            $subtotal = null;
+            if ($amountNum !== null) {
+                $subtotal = $this->calcProcuremenDetailSubtotal($d['amount'] ?? null, $qtyBySid[$sid] ?? '');
+            }
+            $unitPriceText = $amountFilled
+                ? ($amountNum !== null ? $this->formatProcuremenMoneyDisplay($amountNum) : $am)
+                : '未填写';
             $byCompany[$cn]['pick_lines'][$sid] = [
             $byCompany[$cn]['pick_lines'][$sid] = [
-                'cgymc'         => $gymc,
-                'amount_text'   => $amountFilled ? $am : '未填写',
-                'delivery_text' => $deliveryShow !== '' ? $deliveryShow : '未填写',
-                'is_quoted'     => $amountFilled,
+                'cgymc'           => $gymc,
+                'amount_text'     => $amountFilled ? ($amountNum !== null ? $this->formatProcuremenMoneyDisplay($amountNum) : $am) : '未填写',
+                'delivery_text'   => $deliveryFilled ? $deliveryShow : '未填写',
+                'amount_filled'   => $amountFilled,
+                'delivery_filled' => $deliveryFilled,
+                'unit_price_text' => $unitPriceText,
+                'subtotal_text'   => $subtotal !== null ? $this->formatProcuremenMoneyDisplay($subtotal) : '',
+                'subtotal_num'    => $subtotal,
+                'is_quoted'       => $amountFilled,
             ];
             ];
             $byCompany[$cn]['detail_picks'][$sid] = [
             $byCompany[$cn]['detail_picks'][$sid] = [
                 'scydgy_id'         => $sid,
                 'scydgy_id'         => $sid,
@@ -1997,11 +2047,39 @@ class Procuremen extends Backend
         }
         }
         $out = [];
         $out = [];
         foreach ($byCompany as $g) {
         foreach ($byCompany as $g) {
-            $pickLines = $g['pick_lines'] ?? [];
-            if (!is_array($pickLines) || $pickLines === []) {
+            $pickLinesMap = $g['pick_lines'] ?? [];
+            if (!is_array($pickLinesMap) || $pickLinesMap === []) {
                 continue;
                 continue;
             }
             }
-            $g['pick_lines'] = array_values($pickLines);
+            $pickLines = [];
+            $usedLineSids = [];
+            foreach ($orderedSids as $sid) {
+                if (!isset($pickLinesMap[$sid])) {
+                    continue;
+                }
+                $pickLines[] = $pickLinesMap[$sid];
+                $usedLineSids[$sid] = true;
+            }
+            foreach ($pickLinesMap as $sid => $ln) {
+                if (isset($usedLineSids[$sid])) {
+                    continue;
+                }
+                $pickLines[] = $ln;
+            }
+            $groupTotal = 0.0;
+            $groupHasTotal = false;
+            foreach ($pickLines as $ln) {
+                if (isset($ln['subtotal_num']) && $ln['subtotal_num'] !== null) {
+                    $groupTotal += (float)$ln['subtotal_num'];
+                    $groupHasTotal = true;
+                }
+            }
+            $lineCount = count($pickLines);
+            $g['pick_lines'] = $pickLines;
+            $g['line_count'] = $lineCount;
+            $g['has_total'] = $lineCount > 0;
+            $g['total_text'] = $groupHasTotal ? $this->formatProcuremenMoneyDisplay($groupTotal) : '';
+            $g['display_rowspan'] = $lineCount + ($lineCount > 0 ? 1 : 0);
             $detailPicks = $g['detail_picks'] ?? [];
             $detailPicks = $g['detail_picks'] ?? [];
             $g['detail_picks'] = array_values(is_array($detailPicks) ? $detailPicks : []);
             $g['detail_picks'] = array_values(is_array($detailPicks) ? $detailPicks : []);
             $g['detail_picks_json'] = json_encode($g['detail_picks'], JSON_UNESCAPED_UNICODE);
             $g['detail_picks_json'] = json_encode($g['detail_picks'], JSON_UNESCAPED_UNICODE);
@@ -3277,6 +3355,39 @@ class Procuremen extends Backend
         return '';
         return '';
     }
     }
 
 
+    /**
+     * 操作记录时间(取指定 action 最近一条)
+     *
+     * @param string|array<int, string> $actions
+     */
+    protected function resolveProcuremenOperLogTime(int $scydgyId, $actions): string
+    {
+        if (!$this->isValidScydgyRowId($scydgyId)) {
+            return '';
+        }
+        $acts = is_array($actions) ? $actions : [$actions];
+        $acts = array_values(array_filter(array_map('strval', $acts)));
+        if ($acts === []) {
+            return '';
+        }
+        try {
+            $log = Db::table('purchase_order_oper_log')
+                ->where('scydgy_id', $scydgyId)
+                ->where('action', 'in', $acts)
+                ->order('id', 'desc')
+                ->find();
+            if (is_array($log)) {
+                $ct = (int)($log['createtime'] ?? 0);
+                if ($ct > 946684800) {
+                    return date('Y-m-d H:i:s', $ct);
+                }
+            }
+        } catch (\Throwable $e) {
+        }
+
+        return '';
+    }
+
     /**
     /**
      * 详情弹层:进度步骤 + 订单摘要 + 下发明细(已下发 / 已完结均可用)
      * 详情弹层:进度步骤 + 订单摘要 + 下发明细(已下发 / 已完结均可用)
      *
      *
@@ -3320,29 +3431,9 @@ class Procuremen extends Backend
         $issued = $this->isProcuremenOrderIssued($main, $issueCnt);
         $issued = $this->isProcuremenOrderIssued($main, $issueCnt);
         $issueTime = $issued ? $this->resolveProcuremenIssueTime($main, $details) : '';
         $issueTime = $issued ? $this->resolveProcuremenIssueTime($main, $details) : '';
 
 
-        $auditNotifyTime = '';
-        if ($wflowStatus >= 2 || ($wflowStatus === 0 && $issueCnt > 0)) {
-            $scydgyId = (int)($main['scydgy_id'] ?? 0);
-            if ($this->isValidScydgyRowId($scydgyId)) {
-                try {
-                    $auditLog = Db::table('purchase_order_oper_log')
-                        ->where('scydgy_id', $scydgyId)
-                        ->where('action', 'audit_confirm')
-                        ->order('id', 'desc')
-                        ->find();
-                    if (is_array($auditLog)) {
-                        $ct = (int)($auditLog['createtime'] ?? 0);
-                        if ($ct > 946684800) {
-                            $auditNotifyTime = date('Y-m-d H:i:s', $ct);
-                        }
-                    }
-                } catch (\Throwable $e) {
-                }
-            }
-            if ($auditNotifyTime === '' && $issueTime !== '') {
-                $auditNotifyTime = $issueTime;
-            }
-        }
+        $scydgyId = (int)($main['scydgy_id'] ?? 0);
+        $auditSelectTime = $this->resolveProcuremenOperLogTime($scydgyId, ['audit_select', 'audit_confirm']);
+        $confirmApproveTime = $this->resolveProcuremenOperLogTime($scydgyId, ['purchase_confirm']);
 
 
         $supplierTime = '';
         $supplierTime = '';
         if ($acceptCnt > 0) {
         if ($acceptCnt > 0) {
@@ -3358,7 +3449,6 @@ class Procuremen extends Backend
         }
         }
 
 
         $directComplete = ($mainStatus === 1 && !$issued);
         $directComplete = ($mainStatus === 1 && !$issued);
-        $scydgyId = (int)($main['scydgy_id'] ?? 0);
 
 
         $doneTime = '';
         $doneTime = '';
         if ($mainStatus === 1) {
         if ($mainStatus === 1) {
@@ -3395,16 +3485,17 @@ class Procuremen extends Backend
         } else {
         } else {
             $step1Done = $issued;
             $step1Done = $issued;
             $step2Done = $issued;
             $step2Done = $issued;
-            // wflow=1:初选已下发、待审批确认通知;wflow>=2 或旧数据(有明细且 wf=0)视为已通知
-            $step3Done = $wflowStatus >= 2 || ($wflowStatus === 0 && $issueCnt > 0);
-            $step4Done = $acceptCnt > 0;
-            $step5Done = false;
-            foreach ($details as $dr) {
-                if (is_array($dr) && (int)($dr['status'] ?? 0) === 1) {
-                    $step5Done = true;
-                    break;
+            $step3Done = $acceptCnt > 0;
+            $step4Done = $wflowStatus >= 2;
+            if (!$step4Done) {
+                foreach ($details as $dr) {
+                    if (is_array($dr) && (int)($dr['status'] ?? 0) === 1) {
+                        $step4Done = true;
+                        break;
+                    }
                 }
                 }
             }
             }
+            $step5Done = $confirmApproveTime !== '' || $mainStatus === 1;
             $step6Done = $mainStatus === 1;
             $step6Done = $mainStatus === 1;
 
 
             // 已走下发流程并完结:中间环节按业务视为已全部完成(不显示灰色「未到达」)
             // 已走下发流程并完结:中间环节按业务视为已全部完成(不显示灰色「未到达」)
@@ -3424,17 +3515,21 @@ class Procuremen extends Backend
                         $pickedTime = $fillT;
                         $pickedTime = $fillT;
                     }
                     }
                 }
                 }
-                if ($auditNotifyTime === '') {
+                if ($auditSelectTime === '') {
+                    $fillT = $doneTime !== '' ? $doneTime : $poTime;
+                    if ($fillT !== '') {
+                        $auditSelectTime = $fillT;
+                    }
+                }
+                if ($confirmApproveTime === '') {
                     $fillT = $doneTime !== '' ? $doneTime : $poTime;
                     $fillT = $doneTime !== '' ? $doneTime : $poTime;
                     if ($fillT !== '') {
                     if ($fillT !== '') {
-                        $auditNotifyTime = $fillT;
+                        $confirmApproveTime = $fillT;
                     }
                     }
                 }
                 }
             }
             }
         }
         }
 
 
-        $auditPendingSubtitle = '待确认通知';
-
         $steps = [
         $steps = [
             [
             [
                 'title'    => '未发',
                 'title'    => '未发',
@@ -3443,27 +3538,29 @@ class Procuremen extends Backend
                 'done'     => $step1Done,
                 'done'     => $step1Done,
             ],
             ],
             [
             [
-                'title'    => '初选下发',
+                'title'    => '下发',
                 'subtitle' => '',
                 'subtitle' => '',
                 'time'     => $step2Done ? ($issueTime !== '' ? $issueTime : $poTime) : '',
                 'time'     => $step2Done ? ($issueTime !== '' ? $issueTime : $poTime) : '',
                 'done'     => $step2Done,
                 'done'     => $step2Done,
             ],
             ],
             [
             [
-                'title'    => '待审批',
-                'subtitle' => $step3Done ? '' : $auditPendingSubtitle,
-                'time'     => $step3Done ? $auditNotifyTime : '',
+                'title'    => '供应商接单',
+                'subtitle' => '下发 ' . $issueCnt . ' / 接单 ' . $acceptCnt,
+                'time'     => $step3Done ? $supplierTime : '',
                 'done'     => $step3Done,
                 'done'     => $step3Done,
             ],
             ],
             [
             [
-                'title'    => '供应商接单',
-                'subtitle' => '下发 ' . $issueCnt . ' / 接单 ' . $acceptCnt,
-                'time'     => $step4Done ? $supplierTime : '',
+                'title'    => '待确认',
+                'subtitle' => $step4Done
+                    ? ($pickedName !== '' ? ('选定:' . $pickedName) : '')
+                    : ($issued ? '待选供应商' : ''),
+                'time'     => $step4Done ? ($auditSelectTime !== '' ? $auditSelectTime : $pickedTime) : '',
                 'done'     => $step4Done,
                 'done'     => $step4Done,
             ],
             ],
             [
             [
-                'title'    => '采购确认',
-                'subtitle' => $pickedName !== '' ? ('选中供应商:' . $pickedName) : '',
-                'time'     => $step5Done ? ($pickedTime !== '' ? $pickedTime : '') : '',
+                'title'    => '待审批',
+                'subtitle' => ($pickedName !== '' && $step4Done) ? ('供应商:' . $pickedName) : '',
+                'time'     => $step5Done ? ($confirmApproveTime !== '' ? $confirmApproveTime : $doneTime) : '',
                 'done'     => $step5Done,
                 'done'     => $step5Done,
             ],
             ],
             [
             [
@@ -4395,14 +4492,31 @@ class Procuremen extends Backend
                 }
                 }
                 $appendLine((int)$sid, $d);
                 $appendLine((int)$sid, $d);
             }
             }
+            $firstDetail = null;
+            foreach ($bySid as $d) {
+                if (is_array($d)) {
+                    $firstDetail = $d;
+                    break;
+                }
+            }
+            $ph = is_array($firstDetail) ? trim((string)($firstDetail['phone'] ?? '')) : '';
+            $username = is_array($firstDetail) ? trim((string)($firstDetail['username'] ?? '')) : '';
+            if ($username === '' && $ph !== '') {
+                $username = $this->resolveCustomerContactName($ph, $cn);
+            }
+            $lineCount = count($lines);
             $supplierGroups[] = [
             $supplierGroups[] = [
-                'company_name' => $cn,
-                'is_selected'  => ($selectedCompany !== '' && $cn === $selectedCompany),
-                'is_void'      => $groupVoid,
-                'lines'        => $lines,
-                'line_count'   => count($lines),
-                'total_text'   => $groupHas ? $this->formatProcuremenMoneyDisplay($groupTotal) : '',
-                'has_total'    => count($lines) > 0,
+                'company_name'   => $cn,
+                'username'       => $username,
+                'email'          => is_array($firstDetail) ? trim((string)($firstDetail['email'] ?? '')) : '',
+                'phone'          => $ph,
+                'is_selected'    => ($selectedCompany !== '' && $cn === $selectedCompany),
+                'is_void'        => $groupVoid,
+                'lines'          => $lines,
+                'line_count'     => $lineCount,
+                'display_rowspan'=> $lineCount + ($lineCount > 0 ? 1 : 0),
+                'total_text'     => $groupHas ? $this->formatProcuremenMoneyDisplay($groupTotal) : '',
+                'has_total'      => $lineCount > 0,
             ];
             ];
         }
         }
         usort($supplierGroups, function ($a, $b) {
         usort($supplierGroups, function ($a, $b) {

+ 38 - 19
application/admin/view/procuremen/audit_issue.html

@@ -114,6 +114,15 @@
         font-size: 12px;
         font-size: 12px;
         margin: 0 2px 2px 0;
         margin: 0 2px 2px 0;
     }
     }
+    .audit-issue-wrap .audit-table-wrap.audit-quote-table-wrap {
+        max-height: 360px;
+    }
+    .audit-issue-wrap .audit-quote-detail-table {
+        min-width: 1180px;
+    }
+    .audit-issue-wrap .audit-quote-detail-table td.audit-quote-empty {
+        color: #e67e22;
+    }
 </style>
 </style>
 <div class="audit-issue-wrap">
 <div class="audit-issue-wrap">
     <div class="audit-table-wrap">
     <div class="audit-table-wrap">
@@ -169,46 +178,56 @@
         <strong>重要提示:</strong>请查看各供应商报价,<strong>选定唯一一家</strong>后点击「确认供应商」进入采购终审(本步<strong>任何发送短信通知</strong>)。
         <strong>重要提示:</strong>请查看各供应商报价,<strong>选定唯一一家</strong>后点击「确认供应商」进入采购终审(本步<strong>任何发送短信通知</strong>)。
         需再次提醒报价时,请在右侧<strong>操作</strong>列点击「发邮件」或「发短信」。
         需再次提醒报价时,请在右侧<strong>操作</strong>列点击「发邮件」或「发短信」。
     </p>
     </p>
-    <div class="audit-table-wrap">
-        <table class="table table-bordered table-condensed audit-table audit-quote-pick-table">
+    <div class="audit-table-wrap audit-quote-table-wrap">
+        <table class="table table-bordered table-condensed audit-table audit-quote-pick-table audit-quote-detail-table">
             <thead>
             <thead>
             <tr>
             <tr>
                 <th class="text-center" style="width:42px;">选定</th>
                 <th class="text-center" style="width:42px;">选定</th>
-                <th>公司名称</th>
+                <th style="min-width:140px;">公司名称</th>
                 <th style="width:88px;">联系人</th>
                 <th style="width:88px;">联系人</th>
                 <th style="min-width:160px;">邮箱</th>
                 <th style="min-width:160px;">邮箱</th>
                 <th style="width:120px;">手机号</th>
                 <th style="width:120px;">手机号</th>
-                <th style="min-width:200px;">报价工序</th>
+                <th style="min-width:120px;">工序名称</th>
+                <th class="text-center" style="width:88px;">单价</th>
+                <th class="text-center" style="width:100px;">交货日期</th>
+                <th class="text-center" style="width:88px;">小计</th>
                 <th class="text-center" style="width:120px;">操作</th>
                 <th class="text-center" style="width:120px;">操作</th>
             </tr>
             </tr>
             </thead>
             </thead>
             <tbody id="audit-quote-tbody">
             <tbody id="audit-quote-tbody">
             {volist name="quoteGroups" id="co" key="k"}
             {volist name="quoteGroups" id="co" key="k"}
+            {volist name="co.lines" id="ln" key="lk"}
             <tr>
             <tr>
-                <td class="text-center">
+                {if $lk == 1}
+                <td class="text-center"{if condition="$co.display_rowspan gt 1"} rowspan="{$co.display_rowspan}"{/if} style="vertical-align:middle;">
                     <label>
                     <label>
                         <input type="radio" class="audit-quote-pick" name="audit_quote_pick" value="{$co.name|default=''|htmlentities}"
                         <input type="radio" class="audit-quote-pick" name="audit_quote_pick" value="{$co.name|default=''|htmlentities}"
                             {if condition="$pickedCompanyName neq '' && $pickedCompanyName eq $co.name"} checked="checked"{/if}/>
                             {if condition="$pickedCompanyName neq '' && $pickedCompanyName eq $co.name"} checked="checked"{/if}/>
                     </label>
                     </label>
                 </td>
                 </td>
-                <td>{$co.name|default=''|htmlentities}</td>
-                <td>{$co.username|default=''|htmlentities}</td>
-                <td>{$co.email|default=''|htmlentities}</td>
-                <td>{$co.phone|default=''|htmlentities}</td>
-                <td>
-                    {volist name="co.lines" id="ln"}
-                    <div class="audit-quote-item">
-                        <div>工序:{$ln.cgymc|default=''|htmlentities}</div>
-                        <div>单价:{if condition="$ln.amount_filled"}{$ln.amount_show|htmlentities}{else /}未填写{/if}</div>
-                        <div>交货日期:{if condition="$ln.delivery_filled"}{$ln.delivery_show|htmlentities}{else /}未填写{/if}</div>
-                    </div>
-                    {/volist}
-                </td>
-                <td class="text-center audit-op-cell">
+                <td{if condition="$co.display_rowspan gt 1"} rowspan="{$co.display_rowspan}"{/if} style="vertical-align:middle;">{$co.name|default=''|htmlentities}</td>
+                <td{if condition="$co.display_rowspan gt 1"} rowspan="{$co.display_rowspan}"{/if} style="vertical-align:middle;">{$co.username|default=''|htmlentities}</td>
+                <td{if condition="$co.display_rowspan gt 1"} rowspan="{$co.display_rowspan}"{/if} style="vertical-align:middle;">{$co.email|default=''|htmlentities}</td>
+                <td{if condition="$co.display_rowspan gt 1"} rowspan="{$co.display_rowspan}"{/if} style="vertical-align:middle;">{$co.phone|default=''|htmlentities}</td>
+                {/if}
+                <td>{$ln.cgymc|default=''|htmlentities}</td>
+                <td class="text-center{if condition="$ln.amount_filled neq 1"} audit-quote-empty{/if}">{$ln.unit_price_text|default='未填写'|htmlentities}</td>
+                <td class="text-center{if condition="$ln.delivery_filled neq 1"} audit-quote-empty{/if}">{$ln.delivery_show|default='未填写'|htmlentities}</td>
+                <td class="text-center">{$ln.subtotal_text|default=''|htmlentities}</td>
+                {if $lk == 1}
+                <td class="text-center audit-op-cell"{if condition="$co.display_rowspan gt 1"} rowspan="{$co.display_rowspan}"{/if} style="vertical-align:middle;">
                     <button type="button" class="btn btn-default btn-xs audit-row-send-email" data-company="{$co.name|default=''|htmlentities}">发邮件</button>
                     <button type="button" class="btn btn-default btn-xs audit-row-send-email" data-company="{$co.name|default=''|htmlentities}">发邮件</button>
                     <button type="button" class="btn btn-default btn-xs audit-row-send-sms" data-company="{$co.name|default=''|htmlentities}">发短信</button>
                     <button type="button" class="btn btn-default btn-xs audit-row-send-sms" data-company="{$co.name|default=''|htmlentities}">发短信</button>
                 </td>
                 </td>
+                {/if}
+            </tr>
+            {/volist}
+            {if !empty($co.has_total)}
+            <tr class="active">
+                <td colspan="3" class="text-right"><strong>总计</strong></td>
+                <td class="text-center"><strong>{$co.total_text|default=''|htmlentities}</strong></td>
             </tr>
             </tr>
+            {/if}
             {/volist}
             {/volist}
             </tbody>
             </tbody>
         </table>
         </table>

+ 29 - 12
application/admin/view/procuremen/details_fragment.html

@@ -206,6 +206,12 @@
         padding: 6px 8px;
         padding: 6px 8px;
         vertical-align: middle;
         vertical-align: middle;
     }
     }
+    .procuremen-details-wrap .detail-supplier-table {
+        min-width: 1180px;
+    }
+    .procuremen-details-wrap .detail-supplier-table td.detail-quote-empty {
+        color: #e67e22;
+    }
 </style>
 </style>
 
 
 <div class="panel panel-default panel-intro procuremen-details-wrap{if !empty($pdf_export)} procuremen-pdf-inner{/if}" style="border:0;box-shadow:none;">
 <div class="panel panel-default panel-intro procuremen-details-wrap{if !empty($pdf_export)} procuremen-pdf-inner{/if}" style="border:0;box-shadow:none;">
@@ -315,6 +321,7 @@
                 <th class="text-center" style="width:100px;">订单号</th>
                 <th class="text-center" style="width:100px;">订单号</th>
                 <th style="min-width:160px;">印件名称</th>
                 <th style="min-width:160px;">印件名称</th>
                 <th>工序名称</th>
                 <th>工序名称</th>
+                <th class="text-center" style="width:56px;">单位</th>
                 <th class="text-center" style="width:88px;">本次数量</th>
                 <th class="text-center" style="width:88px;">本次数量</th>
                 <th class="text-center" style="width:72px;">最高限价</th>
                 <th class="text-center" style="width:72px;">最高限价</th>
                 <th class="text-center" style="width:80px;">订法</th>
                 <th class="text-center" style="width:80px;">订法</th>
@@ -330,6 +337,7 @@
                 <td{if condition="$pr.order_rowspan gt 1"} rowspan="{$pr.order_rowspan}"{/if}>{$pr.CYJMC|default=''|htmlentities}</td>
                 <td{if condition="$pr.order_rowspan gt 1"} rowspan="{$pr.order_rowspan}"{/if}>{$pr.CYJMC|default=''|htmlentities}</td>
                 {/if}
                 {/if}
                 <td>{$pr.CGYMC|default=''|htmlentities}</td>
                 <td>{$pr.CGYMC|default=''|htmlentities}</td>
+                <td class="text-center">{$pr.CDW|default=''|htmlentities}</td>
                 <td class="text-center">{$pr.This_quantity|default=''|htmlentities}</td>
                 <td class="text-center">{$pr.This_quantity|default=''|htmlentities}</td>
                 <td class="text-center">{$pr.ceilingPrice|default=''|htmlentities}</td>
                 <td class="text-center">{$pr.ceilingPrice|default=''|htmlentities}</td>
                 <td class="text-center">{$pr.CDF|default=''|htmlentities}</td>
                 <td class="text-center">{$pr.CDF|default=''|htmlentities}</td>
@@ -338,7 +346,7 @@
             {/volist}
             {/volist}
             {else /}
             {else /}
             <tr>
             <tr>
-                <td colspan="7" class="text-center text-muted" style="padding:14px;">暂无工序数据</td>
+                <td colspan="8" class="text-center text-muted" style="padding:14px;">暂无工序数据</td>
             </tr>
             </tr>
             {/notempty}
             {/notempty}
             </tbody>
             </tbody>
@@ -348,16 +356,19 @@
 
 
     <div class="section-title">供应商</div>
     <div class="section-title">供应商</div>
     <div class="table-responsive">
     <div class="table-responsive">
-        <table class="table table-bordered table-condensed detail-mini">
+        <table class="table table-bordered table-condensed detail-mini detail-supplier-table">
             <thead>
             <thead>
             <tr>
             <tr>
-                <th>公司名称</th>
-                <th>工序名称</th>
-                <th class="text-center">单价</th>
-                <th class="text-center">交货日期</th>
-                <th class="text-center">小计</th>
-                <th class="text-center">采购确认</th>
-                <th>操作时间</th>
+                <th style="min-width:140px;">公司名称</th>
+                <th style="width:88px;">联系人</th>
+                <th style="min-width:160px;">邮箱</th>
+                <th style="width:120px;">手机号</th>
+                <th style="min-width:120px;">工序名称</th>
+                <th class="text-center" style="width:88px;">单价</th>
+                <th class="text-center" style="width:100px;">交货日期</th>
+                <th class="text-center" style="width:88px;">小计</th>
+                <th class="text-center" style="width:88px;">采购确认</th>
+                <th style="width:140px;">操作时间</th>
             </tr>
             </tr>
             </thead>
             </thead>
             <tbody>
             <tbody>
@@ -366,9 +377,12 @@
             {volist name="sg.lines" id="ln" key="lk"}
             {volist name="sg.lines" id="ln" key="lk"}
             <tr{if !empty($sg.is_void)} class="text-muted"{/if}>
             <tr{if !empty($sg.is_void)} class="text-muted"{/if}>
                 {if $lk == 1}
                 {if $lk == 1}
-                <td rowspan="{$sg.line_count|default='1'}" style="vertical-align:middle;">
+                <td{if condition="$sg.display_rowspan gt 1"} rowspan="{$sg.display_rowspan}"{/if} style="vertical-align:middle;">
                     {$sg.company_name|default=''|htmlentities}
                     {$sg.company_name|default=''|htmlentities}
                 </td>
                 </td>
+                <td{if condition="$sg.display_rowspan gt 1"} rowspan="{$sg.display_rowspan}"{/if} style="vertical-align:middle;">{$sg.username|default=''|htmlentities}</td>
+                <td{if condition="$sg.display_rowspan gt 1"} rowspan="{$sg.display_rowspan}"{/if} style="vertical-align:middle;">{$sg.email|default=''|htmlentities}</td>
+                <td{if condition="$sg.display_rowspan gt 1"} rowspan="{$sg.display_rowspan}"{/if} style="vertical-align:middle;">{$sg.phone|default=''|htmlentities}</td>
                 {/if}
                 {/if}
                 <td>{$ln.cgymc|default=''|htmlentities}</td>
                 <td>{$ln.cgymc|default=''|htmlentities}</td>
                 <td class="text-center">{$ln.unit_price_text|default=''|htmlentities}</td>
                 <td class="text-center">{$ln.unit_price_text|default=''|htmlentities}</td>
@@ -388,7 +402,7 @@
             {/volist}
             {/volist}
             {if !empty($sg.has_total)}
             {if !empty($sg.has_total)}
             <tr class="active">
             <tr class="active">
-                <td colspan="4" class="text-right"><strong>总计</strong></td>
+                <td colspan="3" class="text-right"><strong>总计</strong></td>
                 <td class="text-center"><strong>{$sg.total_text|default=''|htmlentities}</strong></td>
                 <td class="text-center"><strong>{$sg.total_text|default=''|htmlentities}</strong></td>
                 <td colspan="2"></td>
                 <td colspan="2"></td>
             </tr>
             </tr>
@@ -399,6 +413,9 @@
             {volist name="detailRows" id="dr"}
             {volist name="detailRows" id="dr"}
             <tr>
             <tr>
                 <td>{$dr.company_name|default=''|htmlentities}</td>
                 <td>{$dr.company_name|default=''|htmlentities}</td>
+                <td>{$dr.username|default=''|htmlentities}</td>
+                <td>{$dr.email|default=''|htmlentities}</td>
+                <td>{$dr.phone|default=''|htmlentities}</td>
                 <td></td>
                 <td></td>
                 <td class="text-center">{$dr.amount|default=''|htmlentities}</td>
                 <td class="text-center">{$dr.amount|default=''|htmlentities}</td>
                 <td class="text-center">{$dr.delivery_ymd|default=''|htmlentities}</td>
                 <td class="text-center">{$dr.delivery_ymd|default=''|htmlentities}</td>
@@ -417,7 +434,7 @@
             {/volist}
             {/volist}
             {else /}
             {else /}
             <tr>
             <tr>
-                <td colspan="7" class="text-center text-muted">暂无下发明细</td>
+                <td colspan="10" class="text-center text-muted">暂无下发明细</td>
             </tr>
             </tr>
             {/notempty}
             {/notempty}
             {/notempty}
             {/notempty}

+ 30 - 19
application/admin/view/procuremen/outward_detail.html

@@ -38,7 +38,7 @@
         font-size: 12px;
         font-size: 12px;
         table-layout: fixed;
         table-layout: fixed;
         width: 100%;
         width: 100%;
-        min-width: 860px;
+        min-width: 1180px;
     }
     }
     .outward-detail-table > thead > tr > th,
     .outward-detail-table > thead > tr > th,
     .outward-detail-table > tbody > tr > td,
     .outward-detail-table > tbody > tr > td,
@@ -89,6 +89,9 @@
     .outward-confirm-company-table tbody tr {
     .outward-confirm-company-table tbody tr {
         cursor: pointer;
         cursor: pointer;
     }
     }
+    .outward-confirm-company-table td.outward-quote-empty {
+        color: #e67e22;
+    }
     .outward-confirm-quote-cell {
     .outward-confirm-quote-cell {
         font-size: 12px;
         font-size: 12px;
         line-height: 1.55;
         line-height: 1.55;
@@ -184,41 +187,49 @@
             <thead>
             <thead>
             <tr>
             <tr>
                 <th class="text-center" style="width:42px;">选择</th>
                 <th class="text-center" style="width:42px;">选择</th>
-                <th>公司名称</th>
+                <th style="min-width:140px;">公司名称</th>
                 <th style="width:88px;">联系人</th>
                 <th style="width:88px;">联系人</th>
                 <th style="min-width:160px;">邮箱</th>
                 <th style="min-width:160px;">邮箱</th>
                 <th style="width:120px;">手机号</th>
                 <th style="width:120px;">手机号</th>
-                <th style="min-width:220px;">报价工序</th>
+                <th style="min-width:120px;">工序名称</th>
+                <th class="text-center" style="width:88px;">单价</th>
+                <th class="text-center" style="width:100px;">交货日期</th>
+                <th class="text-center" style="width:88px;">小计</th>
             </tr>
             </tr>
             </thead>
             </thead>
             <tbody>
             <tbody>
             {volist name="confirmPickGroups" id="co" key="k"}
             {volist name="confirmPickGroups" id="co" key="k"}
-            <tr>
-                <td class="text-center">
+            {volist name="co.pick_lines" id="ql" key="lk"}
+            <tr class="outward-confirm-supplier-row" data-supplier-idx="{$k-1}">
+                {if $lk == 1}
+                <td class="text-center"{if condition="$co.display_rowspan gt 1"} rowspan="{$co.display_rowspan}"{/if} style="vertical-align:middle;">
                     <label>
                     <label>
                         <input type="checkbox" class="pod-company-pick-cb" name="pod_company_pick[]" value="{$k-1}"
                         <input type="checkbox" class="pod-company-pick-cb" name="pod_company_pick[]" value="{$k-1}"
                                data-detail-picks="{$co.detail_picks_json|htmlentities}"
                                data-detail-picks="{$co.detail_picks_json|htmlentities}"
                                {if condition="$pickedCompanyName neq '' && $pickedCompanyName eq $co.name"} checked="checked"{/if}/>
                                {if condition="$pickedCompanyName neq '' && $pickedCompanyName eq $co.name"} checked="checked"{/if}/>
                     </label>
                     </label>
                 </td>
                 </td>
-                <td>{$co.name|default=''|htmlentities}</td>
-                <td>{$co.username|default=''|htmlentities}</td>
-                <td>{$co.email|default=''|htmlentities}</td>
-                <td>{$co.phone|default=''|htmlentities}</td>
-                <td class="outward-confirm-quote-cell">
-                    {volist name="co.pick_lines" id="ql"}
-                    <div class="outward-confirm-quote-item">
-                        <div>工序:{$ql.cgymc|default=''|htmlentities}</div>
-                        <div>单价:{$ql.amount_text|default='未填写'|htmlentities}</div>
-                        <div>交货日期:{$ql.delivery_text|default='未填写'|htmlentities}</div>
-                    </div>
-                    {/volist}
-                </td>
+                <td{if condition="$co.display_rowspan gt 1"} rowspan="{$co.display_rowspan}"{/if} style="vertical-align:middle;">{$co.name|default=''|htmlentities}</td>
+                <td{if condition="$co.display_rowspan gt 1"} rowspan="{$co.display_rowspan}"{/if} style="vertical-align:middle;">{$co.username|default=''|htmlentities}</td>
+                <td{if condition="$co.display_rowspan gt 1"} rowspan="{$co.display_rowspan}"{/if} style="vertical-align:middle;">{$co.email|default=''|htmlentities}</td>
+                <td{if condition="$co.display_rowspan gt 1"} rowspan="{$co.display_rowspan}"{/if} style="vertical-align:middle;">{$co.phone|default=''|htmlentities}</td>
+                {/if}
+                <td>{$ql.cgymc|default=''|htmlentities}</td>
+                <td class="text-center{if condition="$ql.amount_filled neq 1"} outward-quote-empty{/if}">{$ql.unit_price_text|default='未填写'|htmlentities}</td>
+                <td class="text-center{if condition="$ql.delivery_filled neq 1"} outward-quote-empty{/if}">{$ql.delivery_text|default='未填写'|htmlentities}</td>
+                <td class="text-center">{$ql.subtotal_text|default=''|htmlentities}</td>
+            </tr>
+            {/volist}
+            {if !empty($co.has_total)}
+            <tr class="active outward-confirm-supplier-row" data-supplier-idx="{$k-1}">
+                <td colspan="3" class="text-right"><strong>总计</strong></td>
+                <td class="text-center"><strong>{$co.total_text|default=''|htmlentities}</strong></td>
             </tr>
             </tr>
+            {/if}
             {/volist}
             {/volist}
             {empty name="confirmPickGroups"}
             {empty name="confirmPickGroups"}
             <tr>
             <tr>
-                <td colspan="6" class="text-center text-muted">暂无供应商报价</td>
+                <td colspan="9" class="text-center text-muted">暂无供应商报价</td>
             </tr>
             </tr>
             {/empty}
             {/empty}
             </tbody>
             </tbody>

+ 6 - 3
public/assets/js/backend/procuremen.js

@@ -489,7 +489,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         if (!row || pk == null || pk === '' || String(pk) === '0') {
                         if (!row || pk == null || pk === '' || String(pk) === '0') {
                             return '';
                             return '';
                         }
                         }
-                        var areaDetails = ' data-area=\'["76%","85%"]\'';
+                        var areaDetails = ' data-area=\'["92%","88%"]\'';
                         var areaAudit = ' data-area=\'["92%","88%"]\'';
                         var areaAudit = ' data-area=\'["92%","88%"]\'';
                         var areaConfirmOutward = ' data-area=\'["96%","85%"]\'';
                         var areaConfirmOutward = ' data-area=\'["96%","85%"]\'';
                         var parts = [];
                         var parts = [];
@@ -1438,7 +1438,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     return;
                     return;
                 }
                 }
                 var url = Fast.api.fixurl('procuremen/details?ids=' + encodeURIComponent(String(sid)));
                 var url = Fast.api.fixurl('procuremen/details?ids=' + encodeURIComponent(String(sid)));
-                Backend.api.open(url, '详情', {area: ['76%', '100%']});
+                Backend.api.open(url, '详情', {area: ['92%', '88%']});
             });
             });
         },
         },
 
 
@@ -1533,7 +1533,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 if ($(e.target).closest('input.pod-company-pick-cb,label').length) {
                 if ($(e.target).closest('input.pod-company-pick-cb,label').length) {
                     return;
                     return;
                 }
                 }
-                var $cb = $(this).find('.pod-company-pick-cb').first();
+                var idx = $(this).attr('data-supplier-idx');
+                var $cb = idx !== undefined && idx !== ''
+                    ? $wrap.find('.pod-company-pick-cb[value="' + idx + '"]').first()
+                    : $(this).find('.pod-company-pick-cb').first();
                 if ($cb.length) {
                 if ($cb.length) {
                     $cb.prop('checked', !$cb.prop('checked')).trigger('change');
                     $cb.prop('checked', !$cb.prop('checked')).trigger('change');
                 }
                 }