|
|
@@ -26,6 +26,7 @@ use Illuminate\Support\Facades\DB;
|
|
|
use Illuminate\Support\Facades\Gate;
|
|
|
use Illuminate\Support\Facades\Http;
|
|
|
use Illuminate\Support\Facades\Validator;
|
|
|
+use Oursdreams\Export\Export;
|
|
|
|
|
|
class CustomerController extends Controller
|
|
|
{
|
|
|
@@ -85,14 +86,7 @@ class CustomerController extends Controller
|
|
|
$report->ownerBillReport ? (string)$report->ownerBillReport->updated_at : '',
|
|
|
];
|
|
|
}
|
|
|
- $post = Http::post(config('go.export.url'),['type'=>'base','data'=>json_encode(["row"=>$column,"list"=>$list],JSON_UNESCAPED_UNICODE)]);
|
|
|
- if ($post->status() == 500){
|
|
|
- throw new Exception($post->header("Msg"));
|
|
|
- }
|
|
|
- return response($post,200, [
|
|
|
- "Content-type"=>"application/octet-stream",
|
|
|
- "Content-Disposition"=>"attachment; filename=客户项目报表-".date('ymdHis').'.xlsx',
|
|
|
- ]);
|
|
|
+ return Export::make($column,$list,"客户项目报表");
|
|
|
}
|
|
|
|
|
|
public function projectIndex()
|
|
|
@@ -146,14 +140,7 @@ class CustomerController extends Controller
|
|
|
$owner->description
|
|
|
];
|
|
|
}
|
|
|
- $post = Http::post(config('go.export.url'),['type'=>'base','data'=>json_encode(["row"=>$column,"list"=>$list],JSON_UNESCAPED_UNICODE)]);
|
|
|
- if ($post->status() == 500){
|
|
|
- throw new Exception($post->header("Msg"));
|
|
|
- }
|
|
|
- return response($post,200, [
|
|
|
- "Content-type"=>"application/octet-stream",
|
|
|
- "Content-Disposition"=>"attachment; filename=客户报表-".date('ymdHis').'.xlsx',
|
|
|
- ]);
|
|
|
+ return Export::make($column,$list,"客户报表");
|
|
|
}
|
|
|
|
|
|
public function projectCreate()
|
|
|
@@ -299,15 +286,7 @@ class CustomerController extends Controller
|
|
|
$area->accounting_area,
|
|
|
];
|
|
|
}
|
|
|
-
|
|
|
- $post = Http::post(config('go.export.url'),['type'=>'base','data'=>json_encode(["row"=>$column,"list"=>$list],JSON_UNESCAPED_UNICODE)]);
|
|
|
- if ($post->status() == 500){
|
|
|
- throw new Exception($post->header("Msg"));
|
|
|
- }
|
|
|
- return response($post,200, [
|
|
|
- "Content-type"=>"application/octet-stream",
|
|
|
- "Content-Disposition"=>"attachment; filename=项目面积报表-".date('ymdHis').'.xlsx',
|
|
|
- ]);
|
|
|
+ return Export::make($column,$list,"项目面积报表");
|
|
|
}
|
|
|
|
|
|
public function financeInstantBill(Request $request)
|
|
|
@@ -328,22 +307,22 @@ class CustomerController extends Controller
|
|
|
if ($request->checkAllSign)unset($params['checkAllSign']);
|
|
|
else $params = ["id"=>$request->data];
|
|
|
$sql = app('OwnerFeeDetailService')->getSql($params);
|
|
|
-
|
|
|
- $row = ["客户", "项目", "作业时间", "类型","店铺", "单号(发/收/退/提)", "收件人", "收件人电话", "商品数量",
|
|
|
- "物流/快递单号", "体积", "重量", "承运商", "操作费", "物流费", "合计"];
|
|
|
- $column = ["customer_name", "owner_name", "worked_at", "type","shop_name", "operation_bill", "consignee_name", "consignee_phone", "commodity_amount",
|
|
|
- "logistic_bill", "volume", "weight", "logistic_name", "work_fee", "logistic_fee", "total"];
|
|
|
$rule = ["work_fee"=>"mysqlDate"];
|
|
|
|
|
|
- $post = Http::post(config('go.export.url'),['type'=>'unify','sql'=>$sql, 'connection'=>'mysql',
|
|
|
- 'row'=>json_encode($row,JSON_UNESCAPED_UNICODE), 'column'=>json_encode($column), 'rule'=>json_encode($rule)]);
|
|
|
- if ($post->status() == 500){
|
|
|
- throw new Exception($post->header("Msg"));
|
|
|
- }
|
|
|
- return response($post,200, [
|
|
|
- "Content-type"=>"application/octet-stream",
|
|
|
- "Content-Disposition"=>"attachment; filename=即时账单记录-".date('ymdHis').'.xlsx',
|
|
|
- ]);
|
|
|
+ $e = new Export();
|
|
|
+ $e->setMysqlConnection(config('database.connections.mysql.host'),
|
|
|
+ config('database.connections.mysql.port'),config('database.connections.mysql.database')
|
|
|
+ ,config('database.connections.mysql.username'),config('database.connections.mysql.password'));
|
|
|
+ $e->setFileName("即时账单记录");
|
|
|
+ return $e->sql($sql,[
|
|
|
+ "customer_name"=>"客户","owner_name"=>"项目",
|
|
|
+ "worked_at"=>"作业时间","type"=>"类型",
|
|
|
+ "shop_name"=>"店铺","operation_bill"=>"单号(发/收/退/提)",
|
|
|
+ "consignee_name"=>"收件人","consignee_phone"=>"收件人电话",
|
|
|
+ "commodity_amount"=>"商品数量","logistic_bill"=>"物流/快递单号",
|
|
|
+ "volume"=>"体积","weight"=>"重量","logistic_name"=>"承运商",
|
|
|
+ "work_fee"=>"操作费","logistic_fee"=>"物流费","total"=>"合计"
|
|
|
+ ],$rule)->direct();
|
|
|
}
|
|
|
|
|
|
public function financeBillConfirmation(Request $request)
|
|
|
@@ -388,15 +367,7 @@ class CustomerController extends Controller
|
|
|
$bill->confirmed == '是' ? '已确认' : '未确认',
|
|
|
];
|
|
|
}
|
|
|
-
|
|
|
- $post = Http::post(config('go.export.url'),['type'=>'base','data'=>json_encode(["row"=>$column,"list"=>$list],JSON_UNESCAPED_UNICODE)]);
|
|
|
- if ($post->status() == 500){
|
|
|
- throw new Exception($post->header("Msg"));
|
|
|
- }
|
|
|
- return response($post,200, [
|
|
|
- "Content-type"=>"application/octet-stream",
|
|
|
- "Content-Disposition"=>"attachment; filename=客户账单报表-".date('ymdHis').'.xlsx',
|
|
|
- ]);
|
|
|
+ return Export::make($column,$list,"客户账单报表");
|
|
|
}
|
|
|
|
|
|
public function updateBillReport(Request $request)
|