Description
Properties
| Name | Value |
|---|---|
| Collation | |
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Schema Bound | False |
| Created | 9/11/2017 10:12:56 |
| Last Modified | 9/11/2017 10:12:56 |
Columns
| Key | Name | Description |
|---|---|---|
| ID_BARANG | ||
| ID_HEADER | ||
| BM | ||
| BM_ID | ||
| PPNBM | ||
| PPNBM_ID | ||
| PPH | ||
| PPH_ID | ||
| PPN | ||
| PPN_ID |
SQL Script
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
create view dbo.vw_ms_header_bc_in_item_tarif
---XencX---with encryption
as
select ID_BARANG,ID_HEADER
, sum(BM) as BM
, max(BM_ID) as BM_ID
, sum(PPNBM) as PPNBM
, max(PPNBM_ID) as PPNBM_ID
, sum(PPH) as PPH
, max(PPH_ID) as PPH_ID
, sum(PPN) as PPN
, max(PPN_ID) as PPN_ID
from
(
SELECT
ID_BARANG
, case when JENIS_TARIF='BM' then TARIF else 0 end as BM
, case when JENIS_TARIF='BM' then ID else -1 end as BM_ID
, case when JENIS_TARIF='PPNBM' then TARIF else 0 end as PPNBM
, case when JENIS_TARIF='PPNBM' then ID else -1 end as PPNBM_ID
, case when JENIS_TARIF='PPH' then TARIF else 0 end as PPH
, case when JENIS_TARIF='PPH' then ID else -1 end as PPH_ID
, case when JENIS_TARIF='PPN' then TARIF else 0 end as PPN
, case when JENIS_TARIF='PPN' then ID else -1 end as PPN_ID
, ID_HEADER
FROM dt_ms_tpb_in_barang_tarif
) xdata
group by ID_BARANG,ID_HEADER
GO
GO
create view dbo.vw_ms_header_bc_in_item_tarif
---XencX---with encryption
as
select ID_BARANG,ID_HEADER
, sum(BM) as BM
, max(BM_ID) as BM_ID
, sum(PPNBM) as PPNBM
, max(PPNBM_ID) as PPNBM_ID
, sum(PPH) as PPH
, max(PPH_ID) as PPH_ID
, sum(PPN) as PPN
, max(PPN_ID) as PPN_ID
from
(
SELECT
ID_BARANG
, case when JENIS_TARIF='BM' then TARIF else 0 end as BM
, case when JENIS_TARIF='BM' then ID else -1 end as BM_ID
, case when JENIS_TARIF='PPNBM' then TARIF else 0 end as PPNBM
, case when JENIS_TARIF='PPNBM' then ID else -1 end as PPNBM_ID
, case when JENIS_TARIF='PPH' then TARIF else 0 end as PPH
, case when JENIS_TARIF='PPH' then ID else -1 end as PPH_ID
, case when JENIS_TARIF='PPN' then TARIF else 0 end as PPN
, case when JENIS_TARIF='PPN' then ID else -1 end as PPN_ID
, ID_HEADER
FROM dt_ms_tpb_in_barang_tarif
) xdata
group by ID_BARANG,ID_HEADER
GO