mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-27 08:24:06 +00:00
convert 1688 purchase order to po
This commit is contained in:
+3
-4
@@ -382,8 +382,8 @@ Route::get('/payments/manual', function(){
|
||||
Route::get('/1688/fix', function(){
|
||||
$purchaseOrderDocuments = \App\Models\Document::where('document_type', DocumentType::ECOMMERCE_PURCHASE_ORDER)->get();
|
||||
|
||||
$bookings = [];
|
||||
foreach($purchaseOrderDocuments as $document){
|
||||
var_dump($document->owner->marking);
|
||||
foreach($document->files as $file) {
|
||||
$parser = new \Smalot\PdfParser\Parser();
|
||||
$pdf = $parser->parseFile(Storage::disk('documents')->path($file->file->file_info->original->file));
|
||||
@@ -392,7 +392,6 @@ Route::get('/1688/fix', function(){
|
||||
$tables = explode('Amount (yuan)', $text);
|
||||
array_shift($tables);
|
||||
|
||||
$purchaseOrder = [];
|
||||
foreach ($tables as $table){
|
||||
$products = preg_split('/(yuan\/|yuan \/)/', str_replace("\r\n","",$table));
|
||||
|
||||
@@ -400,17 +399,17 @@ Route::get('/1688/fix', function(){
|
||||
foreach ($products as $product){
|
||||
$product = preg_split('/[\t]/',$product);
|
||||
$type = count($product) === 10 ? 2 : 1;
|
||||
$purchaseOrder[] = [
|
||||
$bookings[$document->owner->marking] = [
|
||||
'description' => str_replace("\n","",$product[$type === 2 ? 6 : 3]),
|
||||
'quantity' => (int) str_replace("\n","",$product[$type === 2 ? 8 : 5]),
|
||||
'unit_price' => (float) str_replace("\n","",$product[$type === 2 ? 9 : 6])
|
||||
];
|
||||
}
|
||||
}
|
||||
dd($purchaseOrder);
|
||||
}
|
||||
// if($document->owner->status === ApprovalStatus::COMPLETED) continue;
|
||||
// (App()->make(createPurchaseOrderFor1688OrderProcessor::class))->execute($document->owner);
|
||||
}
|
||||
dd($bookings);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user