Преглед изворни кода

feat: EK-3320: 订单增加 Invoice 下载

zhangl пре 1 месец
родитељ
комит
13bcc75050
1 измењених фајлова са 24 додато и 16 уклоњено
  1. 24 16
      common/libs/export/BaseExport.php

+ 24 - 16
common/libs/export/BaseExport.php

@@ -1584,6 +1584,12 @@ ORDER;
             $currency = '';
             $invoiceNo = '';
 
+            $orderTotalBv = 0;
+            $orderTotalTaxAmount = 0;
+            $orderTotalAmount = 0;
+            $orderTotal = 0;
+            $orderTotalQuantity = count($oderList);
+
             foreach ($oderList as $key => $value) {
                 $no = $key + 1;
                 $invoiceRemark = $value['INVOICE_REMARK'] ?: '';
@@ -1607,10 +1613,12 @@ ORDER;
                 // 税额
                 $taxAmount = Tool::calculateTax($value['REAL_PRICE'], $value['TAX_RATE'], $value['BUY_NUMS']);
                 $totalTaxAmount += $taxAmount;
-                $totalBv = Tool::formatAmount($value['BUY_NUMS'] * $value['REAL_PV']);
-                $taxAbleAmount = Tool::formatAmount($totalAmount - $taxAmount);
-                $taxAmount = Tool::formatAmount($taxAmount);
-                $totalAmount = Tool::formatAmount($totalAmount);
+                $totalBv = $value['BUY_NUMS'] * $value['REAL_PV'];
+                $orderTotalBv += $totalBv;
+
+                $orderTotalTaxAmount += $taxAmount;
+                $orderTotalAmount += $totalAmount - $taxAmount;
+                $orderTotal += $totalAmount;
                 $invoiceNo = '123213123123';
 
                 // 订单详情
@@ -1622,11 +1630,11 @@ ORDER;
                     <td>{$value['BUY_NUMS']}</td>
                     <td>{$value['REAL_PRICE']}</td>
                     <td>{$value['REAL_PV']}</td>
-                    <td>{$totalBv}</td>
-                    <td>{$taxAmount}</td>
+                    <td>{Tool::formatAmount($totalBv)}</td>
+                    <td>{Tool::formatAmount($taxAmount)}</td>
                     <td>{$value['TAX_RATE']}%</td>
-                    <td>{$taxAbleAmount}</td>
-                    <td>{$totalAmount}</td> 
+                    <td>{Tool::formatAmount($totalAmount - $taxAmount)}</td>
+                    <td>{Tool::formatAmount($totalAmount)}</td> 
                 </tr>
 EOT;
             }
@@ -1767,14 +1775,14 @@ EOT;
                                 <tr>
                                     <td class="table-noborder"></td>
                                     <td style="text-align: left; background-color: lightslategray;" colspan="2">Grand Total</td>
-                                    <td style="text-align: left; background-color: lightslategray;">1</td>
-                                    <td style="text-align: left; background-color: lightslategray;">2</td>
-                                    <td style="text-align: left; background-color: lightslategray;">3</td>
-                                    <td style="text-align: left; background-color: lightslategray;">4</td>
-                                    <td style="text-align: left; background-color: lightslategray;">5</td>
-                                    <td style="text-align: left; background-color: lightslategray;">6</td>
-                                    <td style="text-align: left; background-color: lightslategray;">7</td>
-                                    <td style="text-align: left; background-color: lightslategray;">8</td>
+                                    <td style="text-align: left; background-color: lightslategray;">{$orderTotalQuantity}</td>
+                                    <td style="text-align: left; background-color: lightslategray;"></td>
+                                    <td style="text-align: left; background-color: lightslategray;"></td>
+                                    <td style="text-align: left; background-color: lightslategray;">{$orderTotalBv}</td>
+                                    <td style="text-align: left; background-color: lightslategray;">{$orderTotalTaxAmount}</td>
+                                    <td style="text-align: left; background-color: lightslategray;"></td>
+                                    <td style="text-align: left; background-color: lightslategray;">{$orderTotalAmount}</td>
+                                    <td style="text-align: left; background-color: lightslategray;">{$orderTotal}</td>
                                 </tr>
                             </table>