Description
Properties
| Name | Value |
|---|---|
| Collation | SQL_Latin1_General_CP1_CI_AS |
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Schema Bound | False |
| Created | 10/31/2017 01:27:43 |
| Last Modified | 10/31/2017 01:27:43 |
Columns
| Key | Name | Description |
|---|---|---|
| ms_in_item_detail_id | ||
| ms_item_id | ||
| mode_source | ||
| mode_source_name | ||
| receive_no | ||
| receive_date | ||
| status_id | ||
| quantity_pakai |
SQL Script
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
create view dbo.vw_ms_item_in_detail_for_mutasi
---XencX---with encryption
as
SELECT
dt_ms_item_in_detail.ms_in_item_detail_id
, dt_ms_item_in_detail.ms_item_id
, dt_ms_item_in_detail.mode_source
, enum_ms_mode_source_item_in_detail.mode_source_name
,cast( case when dt_ms_item_in_detail.mode_source =1 then dt_ms_item_list_sta.receive_no
when dt_ms_item_in_detail.mode_source =2 then dt_ms_tpb_in_header.receive_no
when dt_ms_item_in_detail.mode_source =5 then dt_ms_production_retur.retur_no
when dt_ms_item_in_detail.mode_source =3 or dt_ms_item_in_detail.mode_source =3 then dt_ms_adj_sto.doc_code
else ''
end as varchar(255)) as receive_no
,cast( case when dt_ms_item_in_detail.mode_source =1 then dt_ms_item_list_sta.receive_date
when dt_ms_item_in_detail.mode_source =2 then dt_ms_tpb_in_header.receive_date
when dt_ms_item_in_detail.mode_source =5 then dt_ms_production_retur.retur_date
when dt_ms_item_in_detail.mode_source =3 or dt_ms_item_in_detail.mode_source =3 then dt_ms_adj_sto.doc_date
else ''
end as date) as receive_date
,cast( case when dt_ms_item_in_detail.mode_source =1 then 1
when dt_ms_item_in_detail.mode_source =2 then case when dt_ms_tpb_in_header_h_status.status_tpb_in_id=3 then 1 else 0 end
when dt_ms_item_in_detail.mode_source =5 then case when dt_ms_production_retur_h_status.ms_production_retur_id=1 then 1 else 0 end
when dt_ms_item_in_detail.mode_source =3 or dt_ms_item_in_detail.mode_source =3 then case when dt_ms_adj_sto_h_status.status_adj_sto_id =1 then 1 else 0 end
else 0
end as int) as status_id
,dt_ms_item_in_detail.quantity_pakai
FROM enum_ms_mode_source_item_in_detail INNER JOIN
dt_ms_item_in_detail ON enum_ms_mode_source_item_in_detail.mode_source = dt_ms_item_in_detail.mode_source LEFT OUTER JOIN
dt_ms_adj_sto INNER JOIN
dt_ms_adj_sto_h_status ON dt_ms_adj_sto.ms_adj_sto_h_status_id = dt_ms_adj_sto_h_status.ms_adj_sto_h_status_id INNER JOIN
enum_ms_status_adj_sto ON dt_ms_adj_sto_h_status.status_adj_sto_id = enum_ms_status_adj_sto.status_adj_sto_id ON dt_ms_item_in_detail.id_source_header = dt_ms_adj_sto.ms_adj_sto_id LEFT OUTER JOIN
enum_ms_status_tpb_in INNER JOIN
dt_ms_tpb_in_header INNER JOIN
dt_ms_tpb_in_barang ON dt_ms_tpb_in_header.ID_HEADER = dt_ms_tpb_in_barang.ID_HEADER INNER JOIN
dt_ms_tpb_in_header_h_status ON dt_ms_tpb_in_header.dt_ms_tpb_in_header_h_status_id = dt_ms_tpb_in_header_h_status.dt_ms_tpb_in_header_h_status_id ON
enum_ms_status_tpb_in.status_tpb_in_id = dt_ms_tpb_in_header_h_status.status_tpb_in_id ON dt_ms_item_in_detail.id_source = dt_ms_tpb_in_barang.ID LEFT OUTER JOIN
dt_ms_item_list_sta ON dt_ms_item_in_detail.id_source = dt_ms_item_list_sta.ms_item_list_sta_id LEFT OUTER JOIN
dt_ms_production_retur INNER JOIN
dt_ms_production_retur_detail ON dt_ms_production_retur.ms_production_retur_id = dt_ms_production_retur_detail.ms_production_retur_id INNER JOIN
dt_ms_production_retur_h_status ON dt_ms_production_retur.ms_production_retur_h_status_id = dt_ms_production_retur_h_status.ms_production_retur_h_status_id INNER JOIN
enum_status_production_retur ON dt_ms_production_retur_h_status.status_production_retur_id = enum_status_production_retur.status_production_retur_id ON
dt_ms_item_in_detail.id_source = dt_ms_production_retur_detail.ms_production_retur_detail_id
GO
GO
create view dbo.vw_ms_item_in_detail_for_mutasi
---XencX---with encryption
as
SELECT
dt_ms_item_in_detail.ms_in_item_detail_id
, dt_ms_item_in_detail.ms_item_id
, dt_ms_item_in_detail.mode_source
, enum_ms_mode_source_item_in_detail.mode_source_name
,cast( case when dt_ms_item_in_detail.mode_source =1 then dt_ms_item_list_sta.receive_no
when dt_ms_item_in_detail.mode_source =2 then dt_ms_tpb_in_header.receive_no
when dt_ms_item_in_detail.mode_source =5 then dt_ms_production_retur.retur_no
when dt_ms_item_in_detail.mode_source =3 or dt_ms_item_in_detail.mode_source =3 then dt_ms_adj_sto.doc_code
else ''
end as varchar(255)) as receive_no
,cast( case when dt_ms_item_in_detail.mode_source =1 then dt_ms_item_list_sta.receive_date
when dt_ms_item_in_detail.mode_source =2 then dt_ms_tpb_in_header.receive_date
when dt_ms_item_in_detail.mode_source =5 then dt_ms_production_retur.retur_date
when dt_ms_item_in_detail.mode_source =3 or dt_ms_item_in_detail.mode_source =3 then dt_ms_adj_sto.doc_date
else ''
end as date) as receive_date
,cast( case when dt_ms_item_in_detail.mode_source =1 then 1
when dt_ms_item_in_detail.mode_source =2 then case when dt_ms_tpb_in_header_h_status.status_tpb_in_id=3 then 1 else 0 end
when dt_ms_item_in_detail.mode_source =5 then case when dt_ms_production_retur_h_status.ms_production_retur_id=1 then 1 else 0 end
when dt_ms_item_in_detail.mode_source =3 or dt_ms_item_in_detail.mode_source =3 then case when dt_ms_adj_sto_h_status.status_adj_sto_id =1 then 1 else 0 end
else 0
end as int) as status_id
,dt_ms_item_in_detail.quantity_pakai
FROM enum_ms_mode_source_item_in_detail INNER JOIN
dt_ms_item_in_detail ON enum_ms_mode_source_item_in_detail.mode_source = dt_ms_item_in_detail.mode_source LEFT OUTER JOIN
dt_ms_adj_sto INNER JOIN
dt_ms_adj_sto_h_status ON dt_ms_adj_sto.ms_adj_sto_h_status_id = dt_ms_adj_sto_h_status.ms_adj_sto_h_status_id INNER JOIN
enum_ms_status_adj_sto ON dt_ms_adj_sto_h_status.status_adj_sto_id = enum_ms_status_adj_sto.status_adj_sto_id ON dt_ms_item_in_detail.id_source_header = dt_ms_adj_sto.ms_adj_sto_id LEFT OUTER JOIN
enum_ms_status_tpb_in INNER JOIN
dt_ms_tpb_in_header INNER JOIN
dt_ms_tpb_in_barang ON dt_ms_tpb_in_header.ID_HEADER = dt_ms_tpb_in_barang.ID_HEADER INNER JOIN
dt_ms_tpb_in_header_h_status ON dt_ms_tpb_in_header.dt_ms_tpb_in_header_h_status_id = dt_ms_tpb_in_header_h_status.dt_ms_tpb_in_header_h_status_id ON
enum_ms_status_tpb_in.status_tpb_in_id = dt_ms_tpb_in_header_h_status.status_tpb_in_id ON dt_ms_item_in_detail.id_source = dt_ms_tpb_in_barang.ID LEFT OUTER JOIN
dt_ms_item_list_sta ON dt_ms_item_in_detail.id_source = dt_ms_item_list_sta.ms_item_list_sta_id LEFT OUTER JOIN
dt_ms_production_retur INNER JOIN
dt_ms_production_retur_detail ON dt_ms_production_retur.ms_production_retur_id = dt_ms_production_retur_detail.ms_production_retur_id INNER JOIN
dt_ms_production_retur_h_status ON dt_ms_production_retur.ms_production_retur_h_status_id = dt_ms_production_retur_h_status.ms_production_retur_h_status_id INNER JOIN
enum_status_production_retur ON dt_ms_production_retur_h_status.status_production_retur_id = enum_status_production_retur.status_production_retur_id ON
dt_ms_item_in_detail.id_source = dt_ms_production_retur_detail.ms_production_retur_detail_id
GO
Depends On
14- dbo.enum_ms_mode_source_item_in_detail
- dbo.dt_ms_item_in_detail
- dbo.dt_ms_adj_sto
- dbo.dt_ms_adj_sto_h_status
- dbo.enum_ms_status_adj_sto
- dbo.enum_ms_status_tpb_in
- dbo.dt_ms_tpb_in_header
- dbo.dt_ms_tpb_in_barang
- dbo.dt_ms_tpb_in_header_h_status
- dbo.dt_ms_item_list_sta
- dbo.dt_ms_production_retur
- dbo.dt_ms_production_retur_detail
- dbo.dt_ms_production_retur_h_status
- dbo.enum_status_production_retur