mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
download billing documents
This commit is contained in:
+19
-19
@@ -97,25 +97,25 @@ Route::get('/products', function (\App\Classes\Modules\Exports\Services\ExportsP
|
||||
})->name('products.random');
|
||||
|
||||
Route::get('/fix_bills', function () {
|
||||
ini_set('max_execution_time', '1000000');
|
||||
Auth()->login(User::find(1));
|
||||
Transaction::where('type', TransactionType::INVOICE)->chunk(200, function($invoices){
|
||||
foreach ($invoices as $invoice){
|
||||
$invoice->booking->documents()->where('document_type', DocumentType::INVOICE)->delete();
|
||||
$po = $invoice->booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->first();
|
||||
$supplier = Company::find($invoice->receiver);
|
||||
$invoice_pdf = LaravelMpdf::loadView('pages.pdfs.invoice', ['invoice_transaction' => $invoice, 'po_order_transaction' => $po, 'supplier' => $supplier]);
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::INVOICE,
|
||||
[chunk_split('data:application/pdf;base64,'.base64_encode($invoice_pdf->output()))],
|
||||
'',
|
||||
ApprovalStatus::COMPLETED,
|
||||
'invoices'
|
||||
);
|
||||
$document = (App()->make(CreatesDocument::class))->execute($invoice->booking, $document_object);
|
||||
(App()->make(CreatesFiles::class))->execute($document, $document_object);
|
||||
}
|
||||
});
|
||||
// ini_set('max_execution_time', '1000000');
|
||||
// Auth()->login(User::find(1));
|
||||
// Transaction::where('type', TransactionType::INVOICE)->chunk(200, function($invoices){
|
||||
// foreach ($invoices as $invoice){
|
||||
// $invoice->booking->documents()->where('document_type', DocumentType::INVOICE)->delete();
|
||||
// $po = $invoice->booking->transactions()->where('type', TransactionType::PURCHASE_ORDER)->first();
|
||||
// $supplier = Company::find($invoice->receiver);
|
||||
// $invoice_pdf = LaravelMpdf::loadView('pages.pdfs.invoice', ['invoice_transaction' => $invoice, 'po_order_transaction' => $po, 'supplier' => $supplier]);
|
||||
// $document_object = new DocumentObject(
|
||||
// DocumentType::INVOICE,
|
||||
// [chunk_split('data:application/pdf;base64,'.base64_encode($invoice_pdf->output()))],
|
||||
// '',
|
||||
// ApprovalStatus::COMPLETED,
|
||||
// 'invoices'
|
||||
// );
|
||||
// $document = (App()->make(CreatesDocument::class))->execute($invoice->booking, $document_object);
|
||||
// (App()->make(CreatesFiles::class))->execute($document, $document_object);
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
})->name('products.random');
|
||||
|
||||
Reference in New Issue
Block a user