select * from wh_purchases_orders where purchases_order_code='1500118000802PO'
select * from wh_delivery_orders where purchases_order_id='802'
select * from companies where delivery_order_id=640
select * from wh_stock_warehouses where company_id='13'
select w.movement_origin_code,w.product_code,w.quantity,w.created_at,wh.name,t.name from wh_stock_movements w
left join wh_stock_warehouses wh on w.source_warehouse_id=wh.wh_stock_warehouse_id
left join wh_stock_movement_types t on t.wh_stock_movement_type_id = w.stock_movement_type_id where
w.srv_spare_part_id='24083' and w.created_at::date >= '2018-10-24' and w.stock_movement_type_id=2 and w.source_warehouse_id='50' and w.movement_origin_code='1500118000656SPK'
select * from srv_invoices where bill_of_service_id in (
select * from srv_work_order_letters where reference_number='1500118000656SPK')
select * from srv_wol_part_maps where work_order_letter_id='4801'
_________________________________________________________________________________________________________
ini jika cuma dikasih plat nomor
select reference_number,created_at,is_order_development,
CASE
WHEN is_complete=0 and is_delivered_to_mechanic=0 THEN 'Dashboard FO belum dikirm ke mekanik'
WHEN is_complete=0 and is_delivered_to_mechanic=1 and mechanic_acceptment_time is null THEN 'dashboard mekanik belum di accept'
when is_complete=0 and mechanic_acceptment_time is not null then 'DI Progress Mekanik belum selesai'
when is_complete=1 and (select srv_invoice_id from srv_invoices where bill_of_service_id=bill_of_service) is null then 'Sudah selesai, belum jadi inv'
when is_complete=1 and (select srv_invoice_id from srv_invoices where bill_of_service_id=bill_of_service) is not null then 'Sudah selesai, jadi inv'
ELSE 'hubungi aufal'
END as status
from srv_work_order_letters where quotation_id in (
select srv_quotation_id from srv_quotations where cust_vehicle_id in(
select srv_customer_vehicle_id from srv_customer_vehicles where replace(vehicle_plate_license,' ','') = replace('H 9366 NZ',' ','')))
-------------------------------------------------------------------------------------------------------------------------------------------
ini jika dikasih no spk
select reference_number,created_at,is_order_development,
CASE
WHEN is_complete=0 and is_delivered_to_mechanic=0 THEN 'Dashboard FO belum dikirm ke mekanik'
WHEN is_complete=0 and is_delivered_to_mechanic=1 and mechanic_acceptment_time is null THEN 'dashboard mekanik belum di accept'
when is_complete=0 and mechanic_acceptment_time is not null then 'DI Progress Mekanik belum selesai'
when is_complete=1 and (select srv_invoice_id from srv_invoices where bill_of_service_id=bill_of_service) is null then 'Sudah selesai, belum jadi inv'
when is_complete=1 and (select srv_invoice_id from srv_invoices where bill_of_service_id=bill_of_service) is not null then 'Sudah selesai, jadi inv'
ELSE 'hubungi aufal'
END as status
from srv_work_order_letters where reference_number like '%1400518000885SPK%'
______________________________________________________________________________________________________________________
ini jika mau ambil semua spk di cabang pada satu hari
select w.reference_number,w.created_at,w.is_order_development,c.name,
CASE
WHEN is_complete=0 and is_delivered_to_mechanic=0 THEN 'Dashboard FO belum dikirm ke mekanik'
WHEN is_complete=0 and is_delivered_to_mechanic=1 and mechanic_acceptment_time is null THEN 'dashboard mekanik belum di accept'
when is_complete=0 and mechanic_acceptment_time is not null then 'DI Progress Mekanik belum selesai'
when is_complete=1 and (select srv_invoice_id from srv_invoices where bill_of_service_id=bill_of_service) is null then 'Sudah selesai, belum jadi inv'
when is_complete=1 and (select srv_invoice_id from srv_invoices where bill_of_service_id=bill_of_service) is not null then 'Sudah selesai, jadi inv'
ELSE 'hubungi aufal'
END as status
from srv_work_order_letters w
join companies c on w.company_id=c.company_id
where c.company_id=9 and w.created_at::date='2018-11-03'
-------------------------------------------------------------------------------------------------------------------------------------------
ini jika mau ambil semua spk di cabang pada tanggal tertentu
select w.reference_number,w.created_at,w.is_order_development,c.name,
CASE
WHEN is_complete=0 and is_delivered_to_mechanic=0 THEN 'Dashboard FO belum dikirm ke mekanik'
WHEN is_complete=0 and is_delivered_to_mechanic=1 and mechanic_acceptment_time is null THEN 'dashboard mekanik belum di accept'
when is_complete=0 and mechanic_acceptment_time is not null then 'DI Progress Mekanik belum selesai'
when is_complete=1 and (select srv_invoice_id from srv_invoices where bill_of_service_id=bill_of_service) is null then 'Sudah selesai, belum jadi inv'
when is_complete=1 and (select srv_invoice_id from srv_invoices where bill_of_service_id=bill_of_service) is not null then 'Sudah selesai, jadi inv'
ELSE 'hubungi aufal'
END as status
from srv_work_order_letters w
join companies c on w.company_id=c.company_id
where c.company_id=9 and w.created_at::date between '2018-11-03' and '2018-11-04'
_______________________________________________________________________________________________________________________________
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.