Commit a75fe939 by 孙龙

excel合同

parent ddfa4009
......@@ -6,6 +6,7 @@ use App\Admin\Controllers\BaseController;
use App\Admin\Service\OrderService;
use App\Exceptions\InvalidRequestException;
use App\Http\Utils\ValidatorMsg;
use App\Models\Cms\CmsUser;
use App\Models\Country;
use App\Models\Increasid;
use App\Models\Order;
......@@ -36,7 +37,13 @@ class OrderApiController extends BaseController
}
$info["orderList"] = OrderService::getOrderList($order_id);
$info["orderList"]["adminUser"] = CmsUser::getInfoByUserId($info["orderList"]["sale_id"]);
dump($info["orderList"]);
if($type == "1"){
//PI
return view('export.order_contract_PI',[
......@@ -110,11 +117,28 @@ class OrderApiController extends BaseController
$info["orderList"] = OrderService::getOrderList($order_id);
return Excel::download(new \App\Exports\ContractExport([
// dd($info);
if($type == "1"){
return Excel::download(new \App\Exports\ContractPIExport([
"ship"=>$orderAddressList[1]??[],
"bill"=>$orderAddressList[2]??[],
"info"=>$info
]),'PI.xlsx');
}else if($type == "2"){
return Excel::download(new \App\Exports\ContractCIExport([
"ship"=>$orderAddressList[1]??[],
"bill"=>$orderAddressList[2]??[],
"info"=>$info
]),'CI.xlsx');
}else if($type == "3"){
return Excel::download(new \App\Exports\ContractPLExport([
"ship"=>$orderAddressList[1]??[],
"bill"=>$orderAddressList[2]??[],
"info"=>$info
]),'PL.xlsx');
}
}
......
<?php
namespace App\Exports;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
use Maatwebsite\Excel\Concerns\WithColumnWidths;
use Maatwebsite\Excel\Concerns\WithDefaultStyles;
use Maatwebsite\Excel\Concerns\WithEvents;
use Maatwebsite\Excel\Events\AfterSheet;
use PhpOffice\PhpSpreadsheet\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Style\Style;
class ContractExport implements FromView, WithColumnWidths, WithDefaultStyles, WithEvents
{
private $order_info;
private $order_item_num;
public function __construct($data=[])
{
$this->order_info=[];
}
public function view(): View
{
return view('export.order_contract_PI', $this->order_info);
}
public function columnWidths(): array
{
return [
'A' => 10,
'B' => 23,
'C' => 22,
'D' => 10,
'E' => 23,
'F' => 10,
'G' => 12,
'H' => 12,
'I' => 15,
'J' => 15,
'K' => 15,
];
}
public function defaultStyles(Style $defaultStyle)
{
return $defaultStyle->getFont()->setSize(8);
}
public function registerEvents(): array
{
return [
AfterSheet::class => function (AfterSheet $event) {
// $cellRange = $this->specific_cells;
// foreach ($cellRange as $cell) {
// // 单个单元格设置格式
// $event->sheet->getDelegate()->getStyle($cell)->getNumberFormat()->setFormatCode('0.000000');
// }
// 垂直居中
// $last_line = $this->order_item_num + 8; // 最后行 = 明细数量 + (起始行 - 1)
// $event->sheet->getDelegate()->getStyle('A9:I' . $last_line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
}
];
}
}
......@@ -3,7 +3,7 @@
<td style="font-size: 16px;font-weight: bold">SEMOUR ELECTRONICS CO.,LIMITED</td>
</tr>
<tr>
<td>Flat Rm 1210, 12/F Sunbeam Centre #27, Shing Yip Street, Kwun Tong, Kowloon Hong Kong(固定地址)</td>
<td>Flat Rm 1210, 12/F Sunbeam Centre #27, Shing Yip Street, Kwun Tong, Kowloon Hong Kong</td>
</tr>
<tr>
<td>SELLER /CONTACT:Joanna Email:Joanna@ichunt.com Tel: (+86)755-3580 8309 Fax: (+86)755-3580 0650 Mob: +8613600403130(业务员信息)</td>
......@@ -13,24 +13,53 @@
</tr>
</table>
<table class="no-border">
<table border="1">
<tbody>
<tr>
<td style="width: 50%;">Buyer:公司名/客户名</td>
<td style="width: 50%;">Seller:SEMOUR ELECTRONICS CO. LIMITED</td>
<td colspan="2">Buyer:</td>
<td colspan="3">{{@$ship["consignee"]}}</td>
<td colspan="2">Seller:</td>
<td colspan="3">SEMOUR ELECTRONICS CO. LIMITED</td>
</tr>
<tr>
<td style="width: 50%;">Address:详细地址</td>
<td style="width: 50%;">Invoice No:CISEMOUR08062022-0001(发票单号)</td>
<td colspan="2">Address::</td>
<td colspan="3">{{@$ship["country_name"]}} {{@$ship["province"]}} {{@$ship["city"]}} {{@$ship["detail_address"]}}</td>
<td colspan="2">Invoice No:</td>
<td colspan="3">{{@$info["sn"]}}</td>
</tr>
<tr>
<td colspan="2">Contac:</td>
<td colspan="3">{{@$info["orderList"]["scm_user"]["name"]}}</td>
<td colspan="2">Contac:</td>
<td colspan="3">{{@$info["orderList"]["sale_name"]}}</td>
</tr>
<tr>
<td colspan="2">Phone:</td>
<td colspan="3">sssasasdsdsdsdsfdsfdfdsf32r433434343434343434</td>
<td colspan="2">Phone:</td>
<td colspan="3">{{ $info["orderList"]["adminUser"]["mobile"] ?? ""}}</td>
</tr>
<tr>
<td colspan="5"></td>
<td colspan="2">Invoice date:</td>
<td colspan="3">{{date("Y-m-d",$info["orderList"]["create_time"])}}</td>
</tr>
<!-- <tr>
<td style="width: 50%;">Buyer</td>
<td colspan="2" style="width: 50%;">{{@$ship["consignee"]}}</td>
</tr>
<tr>
<td style="width: 50%;">Address</td>
<td colspan="2" style="width: 50%;">Invoice No:CISEMOUR08062022-0001(发票单号)</td>
</tr>
<tr>
<td style="width: 50%;">Contac:客户名</td>
<td style="width: 50%;">Phone:业务员电话</td>
<td colspan="2" style="width: 50%;">Phone:业务员电话</td>
</tr>
<tr>
<td style="width: 50%;">Phone:业务员电话</td>
<td style="width: 50%;">Invoice date:下载日期</td>
</tr>
<td colspan="2" style="width: 50%;">Invoice date:下载日期</td>
</tr>-->
</tbody>
</table>
<table>
......@@ -46,17 +75,21 @@
<td>CURRENCY</td>
<td>AMOUNT</td>
</tr>
@if(!empty($info["orderList"]["order_items"]))
@foreach($info["orderList"]["order_items"] as $k=>$item)
<tr>
<td>1</td>
<td>型号</td>
<td>制造商</td>
<td>IC(二级分类)</td>
<td>200</td>
<td>pcs(固定单位)</td>
<td>6.00000</td>
<td>USD(固定币种)</td>
<td>1200.00</td>
<td>{{$k+1}}</td>
<td>{{$item["goods_name"]}}</td>
<td>{{$item["brand_name"]}}</td>
<td>{{$item["class_id2_name"]}}</td>
<td>{{$item["goods_number"]}}</td>
<td>pcs</td>
<td>{{$item["goods_number"]}}</td>
<td>USD</td>
<td>{{$item["total_amount"]}}</td>
</tr>
@endforeach
@endif
<tr>
<td colspan="8">Bank Charge</td>
<td>$40.00</td>
......@@ -91,32 +124,6 @@
<table style="width:80%;table-layout: fixed;" border="1">
<tbody>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>Bank Information</td>
</tr>
<tr>
<td> Bank Name HSBC Hong Kong</td>
</tr>
<tr>
<td> Bank address 1 Queen's Road Central, Hong Kong</td>
</tr>
<tr>
<td> Swift Code HSBCHKHHHKH</td>
</tr>
<tr>
<td> Company Name SEMOUR ELECTRONICS CO., LIMITED</td>
</tr>
<tr>
<td> Account No 819-847187-838</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>Terms &amp; Conditions</td>
</tr>
<tr>
......
<table style="width: 80%" border="1">
<table border="1">
<tr>
<td rowspan="4">
......@@ -20,7 +20,7 @@
<td colspan="10">Proforma Invoice</td>
</tr>
</table>
<table style="width: 80%" border="1">
<table border="1">
<tbody>
<tr>
<td width="8%">Ship to:</td>
......@@ -92,7 +92,7 @@
</tr>
</tbody>
</table>
<table style="width: 80%" border="1">
<table border="1">
<tbody>
<tr>
<td width="100">Slno</td>
......@@ -138,14 +138,14 @@
</tbody>
</table>
<table style="width:80%;table-layout: fixed;" border="1">
<table style="table-layout: fixed;" border="1">
<tbody>
<tr >
<td colspan="9" style="word-break: break-all; word-wrap:break-word;width: 100%;">Remark:1.Once received the goods, please sign on the invoice and packing list and send back the scan copy for record, if we didn't receive any feedback with in 3 days we will not entertain any claim regarding this shipment.2.All bank fees are the responsibility of the customer.</td>
</tr>
</tbody>
</table>
<table style="width:80%;table-layout: fixed;" border="1">
<table style="table-layout: fixed;" border="1">
<tbody>
<tr>
<td>&nbsp;</td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment