Browse Source

feat: EK-3320: [Order List]新增发票功能.

kevin 1 tháng trước cách đây
mục cha
commit
e1a3921d8b
1 tập tin đã thay đổi với 18 bổ sung10 xóa
  1. 18 10
      common/libs/export/BaseExport.php

+ 18 - 10
common/libs/export/BaseExport.php

@@ -818,7 +818,7 @@ ORDER;
             // 设置行高
             $pdf->setCellHeightRatio(1);
             // 设置左、上、右的间距
-            $pdf->SetMargins('15', '15', '15');
+            $pdf->SetMargins('20', '25', '20');
             // 设置是否自动分页  距离底部多少距离时分页
             $pdf->SetAutoPageBreak(TRUE, '15');
             // 设置图像比例因子
@@ -835,9 +835,10 @@ ORDER;
 //        if (!file_exists($image_file)) {
 //            $image_file = \Yii::$app->runtimePath . '/../common/uploads/ngds-logo.jpg';
 //        }
-            $image_file = \Yii::$app->basePath . '/../ngds-logo.jpg';
-            $image = file_get_contents($image_file);
-            $pdf->Image('@' . $image, 15, 12, 20, 7, 'JPG');
+            // $image_file = \Yii::$app->basePath . '/../ngds-logo.jpg';
+            // $image = file_get_contents($image_file);
+            // 将图像放在右上角,根据页面宽度和边距计算位置
+            // $pdf->Image('@' . $image, $pdf->getPageWidth() - 45, 25, 30, 10, 'JPG');
             $pdf->writeHTML($context);
 
             $result = $pdf->Output($realFile, 'F');
@@ -1748,12 +1749,19 @@ EOT;
             </head>
             <body style="font-weight: normal; margin: 0; padding: 0; line-height: 1.3;">
                 <div class="content" style="line-height: 1.3; font-weight: normal;">
-                    <p style="text-align: left; font-weight: bold; font-size: 18px; margin: 0 !important; padding: 0 !important; line-height: 1.3 !important;"><b>Tax Invoice</b></p>
-                    <p style="text-align: left; font-weight: bold; font-size: 15px; margin: 0 !important; padding: 0 !important; line-height: 1.3 !important;"><b>Elken Arabiya General Grading Co.LLC</b></p>
-                    <p style="text-align: left; font-size: 13px; margin: 0 !important; padding: 0 !important; line-height: 1.3 !important;">Shop No.2, Plot 356-1142, Juneirah Street, Umm Suqeim 1, Dubai, UAE</p>
-                    <p style="text-align: left; font-size: 13px; margin: 0 !important; padding: 0 !important; line-height: 1.3 !important;">Phone: +971042296118</p>
-                    <p style="text-align: left; font-size: 13px; margin: 0 !important; padding: 0 !important; line-height: 1.3 !important;">License No: 1314319</p>
-                    <p style="text-align: left; font-size: 13px; margin: 0 !important; padding: 0 !important; line-height: 1.3 !important;">VAT No: {$orderSn}</p>
+                    <div style="display: flex; justify-content: space-between; align-items: flex-start; width: 100%;">
+                        <div style="width: 70%;">
+                            <p style="text-align: left; font-weight: bold; font-size: 16px; margin: 0 !important; padding: 0 !important; line-height: 1.3 !important;"><b>TAX INVOICE</b></p>
+                            <p style="text-align: left; font-size: 14px; margin: 0 !important; padding: 0 !important; line-height: 1.3 !important;">Elken Arabiya Gen. Trading Co. LLC</p>
+                            <p style="text-align: left; font-size: 13px; margin: 0 !important; padding: 0 !important; line-height: 1.3 !important;">Shop No.2, Plot 356-1142, Juneirah Street, Umm Suqeim 1, Dubai, UAE</p>
+                            <p style="text-align: left; font-size: 13px; margin: 0 !important; padding: 0 !important; line-height: 1.3 !important;">Phone: +971042296118</p>
+                            <p style="text-align: left; font-size: 13px; margin: 0 !important; padding: 0 !important; line-height: 1.3 !important;">License No: 1314319</p>
+                            <p style="text-align: left; font-size: 13px; margin: 0 !important; padding: 0 !important; line-height: 1.3 !important;">VAT No: {$orderSn}</p>
+                        </div>
+                        <div style="width: 25%; text-align: right;">
+                            <!-- 图像将通过TCPDF直接插入 -->
+                        </div>
+                    </div>
                     
                     <hr />
                     <br>