|
|
@ -14,27 +14,27 @@ class StokOpNameController extends Controller |
|
|
|
public function index() |
|
|
|
public function index() |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Total Peti Berdasarkan Gudang |
|
|
|
// Total Peti Berdasarkan Gudang |
|
|
|
$gudangStokOpnames = Peti::with('customer', 'tipe_peti', 'warehouse') |
|
|
|
$gudangStokOpnames = Peti::withTrashed()->with('customer', 'tipe_peti', 'warehouse') |
|
|
|
->select('customer_id', 'tipe_peti_id', 'warehouse_id', DB::raw('COUNT(*) as total_petis')) |
|
|
|
->select('customer_id', 'tipe_peti_id', 'warehouse_id', DB::raw('COUNT(*) as total_petis')) |
|
|
|
->groupBy('customer_id', 'tipe_peti_id', 'warehouse_id') |
|
|
|
->groupBy('customer_id', 'tipe_peti_id', 'warehouse_id') |
|
|
|
->get(); |
|
|
|
->get(); |
|
|
|
|
|
|
|
|
|
|
|
// Total Peti Berdasarkan Tanggal Sekarang |
|
|
|
// Total Peti Berdasarkan Tanggal Sekarang |
|
|
|
$todayStokOpnames = Peti::with('customer', 'tipe_peti') |
|
|
|
$todayStokOpnames = Peti::withTrashed()->with('customer', 'tipe_peti') |
|
|
|
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis')) |
|
|
|
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis')) |
|
|
|
->whereDate('created_at', today()) |
|
|
|
->whereDate('created_at', today()) |
|
|
|
->groupBy('customer_id', 'tipe_peti_id') |
|
|
|
->groupBy('customer_id', 'tipe_peti_id') |
|
|
|
->get(); |
|
|
|
->get(); |
|
|
|
|
|
|
|
|
|
|
|
// Total Peti Berdasarkan Tanggal Sebelum Tanggal Sekarang |
|
|
|
// Total Peti Berdasarkan Tanggal Sebelum Tanggal Sekarang |
|
|
|
$yesterdayStokOpnames = Peti::with('customer', 'tipe_peti') |
|
|
|
$yesterdayStokOpnames = Peti::withTrashed()->with('customer', 'tipe_peti') |
|
|
|
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis')) |
|
|
|
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis')) |
|
|
|
->whereDate('created_at', '<', today()) // Mendapatkan data sebelum tanggal hari ini |
|
|
|
->whereDate('created_at', '<', today()) // Mendapatkan data sebelum tanggal hari ini |
|
|
|
->groupBy('customer_id', 'tipe_peti_id') |
|
|
|
->groupBy('customer_id', 'tipe_peti_id') |
|
|
|
->get(); |
|
|
|
->get(); |
|
|
|
|
|
|
|
|
|
|
|
// Total Peti |
|
|
|
// Total Peti |
|
|
|
$stokOpnames = Peti::with('customer', 'tipe_peti') |
|
|
|
$stokOpnames = Peti::withTrashed()->with('customer', 'tipe_peti') |
|
|
|
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis')) |
|
|
|
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis')) |
|
|
|
->groupBy('customer_id', 'tipe_peti_id') |
|
|
|
->groupBy('customer_id', 'tipe_peti_id') |
|
|
|
->get(); |
|
|
|
->get(); |
|
|
@ -52,27 +52,27 @@ class StokOpNameController extends Controller |
|
|
|
public function export() |
|
|
|
public function export() |
|
|
|
{ |
|
|
|
{ |
|
|
|
//total peti |
|
|
|
//total peti |
|
|
|
$stokOpnames = Peti::with('customer', 'tipe_peti') |
|
|
|
$stokOpnames = Peti::withTrashed()->with('customer', 'tipe_peti') |
|
|
|
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis')) |
|
|
|
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis')) |
|
|
|
->groupBy('customer_id', 'tipe_peti_id') |
|
|
|
->groupBy('customer_id', 'tipe_peti_id') |
|
|
|
->get(); |
|
|
|
->get(); |
|
|
|
|
|
|
|
|
|
|
|
// Total Peti Berdasarkan Tanggal Sekarang |
|
|
|
// Total Peti Berdasarkan Tanggal Sekarang |
|
|
|
$todayStokOpnames = Peti::with('customer', 'tipe_peti') |
|
|
|
$todayStokOpnames = Peti::withTrashed()->with('customer', 'tipe_peti') |
|
|
|
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis')) |
|
|
|
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis')) |
|
|
|
->whereDate('created_at', today()) |
|
|
|
->whereDate('created_at', today()) |
|
|
|
->groupBy('customer_id', 'tipe_peti_id') |
|
|
|
->groupBy('customer_id', 'tipe_peti_id') |
|
|
|
->get(); |
|
|
|
->get(); |
|
|
|
|
|
|
|
|
|
|
|
// Total Peti Berdasarkan Tanggal Sebelum Tanggal Sekarang |
|
|
|
// Total Peti Berdasarkan Tanggal Sebelum Tanggal Sekarang |
|
|
|
$yesterdayStokOpnames = Peti::with('customer', 'tipe_peti') |
|
|
|
$yesterdayStokOpnames = Peti::withTrashed()->with('customer', 'tipe_peti') |
|
|
|
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis')) |
|
|
|
->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis')) |
|
|
|
->whereDate('created_at', '<', today()) // Mendapatkan data sebelum tanggal hari ini |
|
|
|
->whereDate('created_at', '<', today()) // Mendapatkan data sebelum tanggal hari ini |
|
|
|
->groupBy('customer_id', 'tipe_peti_id') |
|
|
|
->groupBy('customer_id', 'tipe_peti_id') |
|
|
|
->get(); |
|
|
|
->get(); |
|
|
|
|
|
|
|
|
|
|
|
// Total Peti Berdasarkan Gudang |
|
|
|
// Total Peti Berdasarkan Gudang |
|
|
|
$gudangStokOpnames = Peti::with('customer', 'tipe_peti', 'warehouse') |
|
|
|
$gudangStokOpnames = Peti::withTrashed()->with('customer', 'tipe_peti', 'warehouse') |
|
|
|
->select('customer_id', 'tipe_peti_id', 'warehouse_id', DB::raw('COUNT(*) as total_petis')) |
|
|
|
->select('customer_id', 'tipe_peti_id', 'warehouse_id', DB::raw('COUNT(*) as total_petis')) |
|
|
|
->groupBy('customer_id', 'tipe_peti_id', 'warehouse_id') |
|
|
|
->groupBy('customer_id', 'tipe_peti_id', 'warehouse_id') |
|
|
|
->get(); |
|
|
|
->get(); |
|
|
|