76 lines
2.4 KiB
PHP
76 lines
2.4 KiB
PHP
<?php
|
|
|
|
use App\Mail\test;
|
|
use App\Models\EquipmentMaster;
|
|
use App\Models\InvoiceValidation;
|
|
use App\Models\Plant;
|
|
use Illuminate\Support\Facades\Mail;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
Route::get('/', function () {
|
|
return redirect('/admin');
|
|
});
|
|
|
|
Route::get('/download/{equipmentNumber}', function ($equipmentNumber) {
|
|
$model = EquipmentMaster::where('equipment_number', $equipmentNumber)->firstOrFail();
|
|
|
|
if (! $model->attachment || ! Storage::disk('local')->exists($model->attachment)) {
|
|
abort(404, 'File not found.');
|
|
}
|
|
return Storage::disk('local')->download($model->attachment);
|
|
})->name('download.attachment');
|
|
|
|
// Route::get('/scheduler', function() {
|
|
// Artisan::call('schedule:run');
|
|
// });
|
|
|
|
|
|
// Route::get('/test_mail', function () {
|
|
|
|
|
|
// $plants = InvoiceValidation::select('plant_id')->distinct()->pluck('plant_id');
|
|
|
|
// $tableData = [];
|
|
// $no = 1;
|
|
|
|
// foreach ($plants as $plantId) {
|
|
|
|
// $plant = Plant::find($plantId);
|
|
|
|
// $plantName = $plant ? $plant->name : $plantId;
|
|
|
|
// $totalInvoice = InvoiceValidation::where('plant_id', $plantId)
|
|
// ->distinct('invoice_number')
|
|
// ->count('invoice_number');
|
|
|
|
// $startDate = now()->setTime(8, 0, 0);
|
|
// $endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
|
|
|
// $scannedInvoice = InvoiceValidation::select('invoice_number')
|
|
// ->where('plant_id', $plantId)
|
|
// ->whereNull('quantity')
|
|
// ->whereBetween('updated_at', [$startDate, $endDate])
|
|
// ->groupBy('invoice_number')
|
|
// ->havingRaw("COUNT(*) = SUM(CASE WHEN scanned_status = 'Scanned' THEN 1 ELSE 0 END)")
|
|
// ->count();
|
|
|
|
// $tableData[] = [
|
|
// 'no' => $no++,
|
|
// 'plant' => $plantName,
|
|
// 'totalInvoice' => $totalInvoice,
|
|
// 'scannedInvoice' => $scannedInvoice,
|
|
// ];
|
|
// }
|
|
|
|
// Mail::to('jothikumar.padmanaban@cripumps.com')->send(
|
|
// new test($tableData)
|
|
// );
|
|
// // Mail::to([
|
|
// // 'jothikumar.padmanaban@cripumps.com',
|
|
// // 'tamilselvan.selvaraj@cripumps.com',
|
|
// // 'dineshkumar.kaliyappan@cripumps.com'
|
|
// // ])->send(new test($tableData));
|
|
|
|
// return "Mail sent!";
|
|
// });
|