LAMPIRAN
S tored Procedure pada database OLAP 1. Stored Procedure proc filtertimehistory
create proc filtertimehistory(@tabel varchar(40))as if exists
(
select * from filtertimestamp where namatable=@tabel )
update filtertimestamp set last_etl=getdate() where namatable=@tabel
else
insert into filtertimestamp values(@tabel,getdate())
SQL Query untuk Data Transformation Service 1. Nama table : dim_waktu
Primary key : waktuID
Keterangan : Tabel Dimensi Waktu CREATE TABLE dim_Waktu(
[waktuID] int IDENTITY(1,1) primary key NOT NULL, [bulan] int,
[tahun] int, [quarter] int,
[tgl] datetime ) select month(tgl) as [Bulan], [quarter] = case
when month(tgl) between 1 and 3 then 1 when month(tgl) between 4 and 6 then 2 when month(tgl) between 7 and 9 then 3 when month(tgl) between 10 and 12 then 4
end,
year(tgl) as [Tahun], tgl as tgl
from (
select distinct convert(datetime,inv_date) as tgl from [OLTP_M ULIA].[dbo].DELIVERY
union
select distinct convert(datetime,payment_date) as tgl from [OLTP_M ULIA].[dbo].AR_PAYM ENT
union
select distinct convert(datetime,tanggal) as tgl from [OLTP_M ULIA].[dbo].produksi_data
select distinct convert(datetime,do_date) as tgl from [OLTP_M ULIA].[dbo].cutting
union
select distinct convert(datetime,do_date) as tgl from [OLTP_M ULIA].[dbo].cuttingiii
union
select distinct convert(datetime,do_date) as tgl from [OLTP_M ULIA].[dbo].dosewii
union
select distinct convert(datetime,do_date) as tgl from [OLTP_M ULIA].[dbo].dosewing
union
select distinct convert(datetime,do_date) as tgl from [OLTP_M ULIA].[dbo].doqc
union
select distinct convert(datetime,do_date) as tgl from [OLTP_M ULIA].[dbo].qcreject
union
select distinct convert(datetime,do_date) as tgl from [OLTP_M ULIA].[dbo].dopack
)as tgl where
convert(datetime,tgl) >(
where namatable ='dim_Waktu' )
2. Nama tabel : dim_shift Primary key : shiftID
Keterangan : Tabel Dimensi Shift CREATE TABLE dim_shift(
[shiftID] int IDENTITY(1,1) primary key NOT NULL, [shift_no] int,
[waktu_shift] varchar(30) )
3. Nama tabel : dim_salesman Primary key : salesmanID
Keterangan : Tabel Dimensi Salesman CREATE TABLE dim_salesman(
[salesmanID] int IDENTITY(1,1) primary key NOT NULL, [salesman_no] varchar(8) ,
[salesman_name] varchar(100) )
4. Nama tabel : dim_produk Primary key : produkID
CREATE TABLE dim_produk(
[produkID] int IDENTITY(1,1) primary key NOT NULL, [item_code] varchar(16),
[description] varchar(80), [category] varchar(50) )
5. Nama tabel : dim_mesin Primary key : mesinID
Keterangan : Tabel Dimensi M esin CREATE TABLE dim_mesin(
[mesinID] int IDENTITY(1,1) primary key NOT NULL, [no_mesin] varchar(16), [merk] varchar(25) , [jenis_kain] varchar(50) , [tipe_benang] varchar(25) , [ukuran_benang] varchar(25) )
6. Nama tabel : dim_jenisBayar Primary key : jenisID
Keterangan : Tabel Dimensi Jenis Bayar CREATE TABLE dim_jenisBayar(
[jenis_bayar] varchar(30) )
select distinct payment_category from ar_payment where payment_category not in
(
select jenis_bayar from [olap_versi2].[dbo].dim_jenisbayar )
7. Nama tabel : dim_DO Primary key : doID
Keterangan : Tabel Dimensi DO CREATE TABLE dim_DO(
[doID] int IDENTITY(1,1) primary key NOT NULL, [invoice_no] varchar(17) NULL,
[status] varchar(17) NULL )
8. Nama tabel : dim_Customer Primary key : customerID
Keterangan : Tabel Dimensi Customer CREATE TABLE dim_Customer(
[custID] int IDENTITY(1,1) primary key NOT NULL, [cust_no] varchar(8) ,
[company] varchar(60) , [area] varchar(50) , [rayon] varchar(50) )
9. Nama tabel : fakta_produksi_kain Primary key : -
Surrogate key : waktuID, mesinID, shiftID Keterangan : Tabel Fakta Produksi Kain CREATE TABLE fakta_produksi_kain( [waktuID] int, [mesinID] int, [shiftID] int, [jumlah_produksi] real, [rata2_produksi] numeric(20, 3), [jumlah_reject] real ) if exists (
select last_ETL from [OLAP_VERSI2].[dbo].filtertimestamp where namatable ='fakta_produksi_kain'
) select
shiftID, mesinID, sum(d.quantity) [jumlah_produksi], avg(d.quantity) [rata2_produksi], coalesce(sum(r.quantity),0)[jumlah_reject] from [OLAP_VERSI2].[DBO].dim_waktu w, [OLAP_VERSI2].[DBO].dim_mesin m, [OLAP_VERSI2].[DBO].dim_shift s,
[OLTP_MULIA].[dbo].produksi_data d left join [oltp_mulia].[dbo].bf_reject r on d.no_produksi = r.no_os and r.no_kain = d.no_kain
where
w.tgl = d.tanggal and
m.no_mesin = d.no_mesin and s.shift_no = d.shift and
tgl >
(
select last_ETL from [OLAP_VERSI2].[dbo].filtertimestamp where namatable ='fakta_produksi_kain'
)
group by waktuID, shiftID, mesinID
else select waktuID, shiftID, mesinID, sum(d.quantity) [jumlah_produksi], avg(d.quantity) [rata2_produksi], coalesce(sum(r.quantity),0)[jumlah_reject] from [OLAP_VERSI2].[DBO].dim_waktu w, [OLAP_VERSI2].[DBO].dim_mesin m, [OLAP_VERSI2].[DBO].dim_shift s,
[OLTP_MULIA].[dbo].produksi_data d left join [oltp_mulia].[dbo].bf_reject r on d.no_produksi = r.no_os and r.no_kain = d.no_kain
where
w.tgl = d.tanggal and
m.no_mesin = d.no_mesin and s.shift_no = d.shift
group by waktuID, shiftID, mesinID
10. Nama tabel : fakta_produksi_produk Primary key : -
Surrogate key : waktuID, produkID
Keterangan : Tabel Fakta Produksi Produk CREATE TABLE fakta_produksi_produk(
[waktuID] int , [produkID] int, [jumlah_cutting] real, [jumlah_sewing] real, [jumlah_QC] real, [jumlah_packing] real ) if exists (
select last_ETL from [OLAP_VERSI2].[dbo].filtertimestamp where namatable ='fakta_produksi_produk'
) select waktuID, produkID, coalesce(jumlah_cutting,null,0,jumlah_cutting)[jumlah_cutting], coalesce(jumlah_sewing,null,0,jumlah_sewing) [jumlah_sewing], coalesce(jumlah_QC,null,0,jumlah_QC) [jumlah_QC], coalesce(jumlah_packing,null,0,jumlah_packing) [jumlah_packing]
from
[OLAP_VERSI2].[DBO].dim_produk p, [OLAP_VERSI2].[DBO].dim_waktu w, (
select distinct a.do_date as tgl, itemcode from [oltp_mulia].dbo.cutting a, [oltp_mulia].dbo.cutting_data b where a.code = b.code
union
select distinct a.do_date as tgl, itemcode from [oltp_mulia].dbo.dosewii a, [oltp_mulia].dbo.dosewii_data b where a.code = b.code
union
select distinct a.do_date as tgl, itemcode from [oltp_mulia].dbo.doqc a, [oltp_mulia].dbo.doqc_data b where a.code = b.code
union
select distinct a.do_date as tgl, itemcode from [oltp_mulia].dbo.dopack a, [oltp_mulia].dbo.dopack_data b where a.code = b.code
)wkt left join (
select itemcode ic1,a.do_date as tanggal1 , sum(quantity) as jumlah_cutting
from [oltp_mulia].dbo.cutting a, [oltp_mulia].dbo.cutting_data b where a.code = b.code
group by itemcode,a.do_date
)cut on cut.tanggal1 = wkt.tgl and cut.ic1 = wkt.itemcode left join (
select itemcode ic2,a.do_date as tanggal2 , sum(quantity) as jumlah_sewing
from [oltp_mulia].dbo.dosewii a, [oltp_mulia].dbo.dosewii_data b where a.code = b.code
group by itemcode,a.do_date
)sew on sew.tanggal2 = wkt.tgl and sew.ic2 = wkt.itemcode left join (
select itemcode ic3,a.do_date as tanggal3 , sum(quantity) as jumlah_QC from [oltp_mulia].dbo.doqc a, [oltp_mulia].dbo.doqc_data b
where a.code = b.code group by itemcode,a.do_date
)qc on qc.tanggal3 = wkt.tgl and qc.ic3 = wkt.itemcode left join (
select itemcode ic4,a.do_date as tanggal4 , sum(quantity) as jumlah_packing
from [oltp_mulia].dbo.dopack a, [oltp_mulia].dbo.dopack_data b where a.code = b.code
group by itemcode,a.do_date
)pack on pack.tanggal4 = wkt.tgl and wkt.itemcode = pack.ic4 where w.tgl = wkt.tgl and p.item_code = wkt.itemcode
and wkt.tgl > (
select last_ETL from [OLAP_VERSI2].[dbo].filtertimestamp where namatable ='fakta_produksi_produk'
else select waktuID, produkID, coalesce(jumlah_cutting,null,0,jumlah_cutting)[jumlah_cutting], coalesce(jumlah_sewing,null,0,jumlah_sewing) [jumlah_sewing], coalesce(jumlah_QC,null,0,jumlah_QC) [jumlah_QC], coalesce(jumlah_packing,null,0,jumlah_packing) [jumlah_packing] from [OLAP_VERSI2].[DBO].dim_produk p, [OLAP_VERSI2].[DBO].dim_waktu w, (
select distinct a.do_date as tgl, itemcode from [oltp_mulia].dbo.cutting a, [oltp_mulia].dbo.cutting_data b where a.code = b.code
union
select distinct a.do_date as tgl, itemcode from [oltp_mulia].dbo.dosewii a, [oltp_mulia].dbo.dosewii_data b where a.code = b.code
union
select distinct a.do_date as tgl, itemcode from [oltp_mulia].dbo.doqc a, [oltp_mulia].dbo.doqc_data b where a.code = b.code
union
select distinct a.do_date as tgl, itemcode from [oltp_mulia].dbo.dopack a, [oltp_mulia].dbo.dopack_data b where a.code = b.code
)wkt left join (
select itemcode ic1,a.do_date as tanggal1 , sum(quantity) as jumlah_cutting
from [oltp_mulia].dbo.cutting a, [oltp_mulia].dbo.cutting_data b where a.code = b.code
group by itemcode,a.do_date
)cut on cut.tanggal1 = wkt.tgl and cut.ic1 = wkt.itemcode left join (
select itemcode ic2,a.do_date as tanggal2 , sum(quantity) as jumlah_sewing
from [oltp_mulia].dbo.dosewii a, [oltp_mulia].dbo.dosewii_data b where a.code = b.code
group by itemcode,a.do_date
)sew on sew.tanggal2 = wkt.tgl and sew.ic2 = wkt.itemcode left join (
select itemcode ic3,a.do_date as tanggal3 , sum(quantity) as jumlah_QC from [oltp_mulia].dbo.doqc a, [oltp_mulia].dbo.doqc_data b
where a.code = b.code group by itemcode,a.do_date
)qc on qc.tanggal3 = wkt.tgl and qc.ic3 = wkt.itemcode left join (
select itemcode ic4,a.do_date as tanggal4 , sum(quantity) as jumlah_packing
from [oltp_mulia].dbo.dopack a, [oltp_mulia].dbo.dopack_data b where a.code = b.code
group by itemcode,a.do_date
)pack on pack.tanggal4 = wkt.tgl and wkt.itemcode = pack.ic4 where w.tgl = wkt.tgl and p.item_code = wkt.itemcode
11. Nama tabel : fakta_penjualan Primary key : -
Surrogate key : waktuID, produkID, custID, salesmanID Keterangan : Tabel Fakta Penjualan
CREATE TABLE fakta_penjualan( [waktuID] int, [produkID] int, [custID] int, [salesmanID] int, [TotalQuantity] real, [TotalPendapatan] numeric(30, 2), [Size 22/32/S] real, [Size 24/34/M ] real, [Size 26/36/L] real, [Size 28/38/XL] real, [Size 30/40/LL] real, [Size 42] real )
if exists (
select last_ETL from [OLAP_VERSI2].[dbo].filtertimestamp where namatable ='fakta_penjualan'
) select waktuID, produkID, custID, salesmanID,
sum(amount) [Jumlah Quantity], sum(total) [Jumlah Pendapatan], [Size 22/32/S] =
case
when s22 = ' ' and s32 = ' ' and ss = ' ' then 0 when s22 <> ' ' then sum(cast(s22 as real)) when s32 <> ' ' then sum(cast(s32 as real)) when ss <> ' ' then sum(cast(ss as real)) end,
[Size 24/34/M ] = case
when s24 = ' ' and s34 = ' ' and sm = ' ' then 0 when s24 <> ' ' then sum(cast(s24 as real )) when s34 <> ' ' then sum(cast(s34 as real )) when sm <> ' ' then sum(cast(sm as real ))
end,
[Size 26/36/L] = case
when s26 = ' ' and s36 = ' ' and sl = ' ' then 0 when s26 <> ' ' then sum(cast(s26 as real )) when s36 <> ' ' then sum(cast(s36 as real )) when sl <> ' ' then sum(cast(sl as real )) end,
[Size 28/38/XL] = case
when s28 = ' ' and s38 = ' ' and sxl = ' ' then 0 when s28 <> ' ' then sum(cast(s28 as real )) when s38 <> ' ' then sum(cast(s38 as real )) when sxl <> ' ' then sum(cast(sxl as real )) end,
[Size 30/40/LL] = case
when s30 = ' ' and s40 = ' ' and sll = ' ' then 0 when s30 <> ' ' then sum(cast(s30 as real )) when s40 <> ' ' then sum(cast(s40 as real )) when sll <> ' ' then sum(cast(sll as real )) end,
[Size 42] = case
when s42 = ' ' then 0 else sum(cast(s42 as real )) end from [OLAP_VERSI2].[DBO].dim_salesman s, [OLAP_VERSI2].[DBO].dim_waktu w, [OLAP_VERSI2].[DBO].dim_produk p, [OLAP_VERSI2].[DBO].dim_customer c, [OLTP_MULIA].[dbo].customer cd, [OLTP_MULIA].[dbo].DELIVERY as header, [OLTP_MULIA].[dbo].DELIVERY_DATA as detail where
header.order_no = detail.order_no and detail.itemcode = p.item_code and c.cust_no = header.customer and s.salesman_no = cd.salesman and cd.customer_no = header.customer and w.tgl = header.inv_date and tgl > (
select last_ETL from [OLAP_VERSI2].[dbo].filtertimestamp where namatable ='fakta_penjualan'
)
group by waktuID,
produkID, custID, salesmanId, s22,s24,s26,s28,s30,s32,s34,s36,s38,s40,s42,ss,sm,sl,sxl,sll else select waktuID, produkID, custID, salesmanID,
sum(amount) [Jumlah Quantity], sum(total) [Jumlah Pendapatan], [Size 22/32/S] =
case
when s22 = ' ' and s32 = ' ' and ss = ' ' then 0 when s22 <> ' ' then sum(cast(s22 as real)) when s32 <> ' ' then sum(cast(s32 as real)) when ss <> ' ' then sum(cast(ss as real)) end,
[Size 24/34/M ] = case
when s24 = ' ' and s34 = ' ' and sm = ' ' then 0 when s24 <> ' ' then sum(cast(s24 as real )) when s34 <> ' ' then sum(cast(s34 as real ))
when sm <> ' ' then sum(cast(sm as real )) end,
[Size 26/36/L] = case
when s26 = ' ' and s36 = ' ' and sl = ' ' then 0 when s26 <> ' ' then sum(cast(s26 as real )) when s36 <> ' ' then sum(cast(s36 as real )) when sl <> ' ' then sum(cast(sl as real )) end,
[Size 28/38/XL] = case
when s28 = ' ' and s38 = ' ' and sxl = ' ' then 0 when s28 <> ' ' then sum(cast(s28 as real )) when s38 <> ' ' then sum(cast(s38 as real )) when sxl <> ' ' then sum(cast(sxl as real )) end,
[Size 30/40/LL] = case
when s30 = ' ' and s40 = ' ' and sll = ' ' then 0 when s30 <> ' ' then sum(cast(s30 as real )) when s40 <> ' ' then sum(cast(s40 as real )) when sll <> ' ' then sum(cast(sll as real )) end,
case
when s42 = ' ' then 0 else sum(cast(s42 as real )) end from [OLAP_VERSI2].[DBO].dim_salesman s, [OLAP_VERSI2].[DBO].dim_waktu w, [OLAP_VERSI2].[DBO].dim_produk p, [OLAP_VERSI2].[DBO].dim_customer c, [OLTP_MULIA].[dbo].customer cd, [OLTP_MULIA].[dbo].DELIVERY as header, [OLTP_MULIA].[dbo].DELIVERY_DATA as detail where
header.order_no = detail.order_no and detail.itemcode = p.item_code and c.cust_no = header.customer and s.salesman_no = cd.salesman and cd.customer_no = header.customer and w.tgl = header.inv_date group by waktuID, produkID, custID, salesmanId,
s22,s24,s26,s28,s30,s32,s34,s36,s38,s40,s42,ss,sm,sl,sxl,sll
12. Nama tabel : fakta_pembayaran Primary key : -
Surrogate key : waktuID, custID, jenisID, doID Keterangan : Tabel Fakta Pembayaran CREATE TABLE fakta_Pembayaran( [waktuID] int,
[custID] int, [jenisID] int, [doID] int,
[Status Pembayaran] varchar(30), [Total Bayar] real,
[Average Bayar] real, [Lama Keterlambatan] int )
if exists (
select last_ETL from [OLAP_VERSI2].[dbo].filtertimestamp where namatable ='fakta_pembayaran'
) select
waktuID, custID,
jenisID, doID,
[status bayar] = case
when datediff(day,duedate,payment_date) <= 0 then 'On Time' else 'Late'
end,
sum(total_pay) [Total Bayar],
avg(total_pay) [Average pembayaran], [Lama Telat] =
case
when datediff(day,duedate,payment_date) <= 0 then 0 else datediff(day,duedate,payment_date) end from [OLAP_VERSI2].[DBO].dim_waktu w, [OLAP_VERSI2].[DBO].dim_jenisbayar jb, [OLAP_VERSI2].[DBO].dim_do d, [OLAP_VERSI2].[DBO].dim_customer c, [OLTP_MULIA].[dbo].ar_payment as p where
p.payment_category = jb.jenis_bayar and p.payment_date = w.tgl and
p.invoice_no = d.invoice_no and tgl > (
select last_ETL from [OLAP_VERSI2].[dbo].filtertimestamp where namatable ='fakta_pembayaran'
) group by waktuID, custID, jenisID, doID, duedate, payment_date else select waktuID, custID, jenisID, doID, [status bayar] = case
when datediff(day,duedate,payment_date) <= 0 then 'On Time' else 'Late'
end,
avg(total_pay) [Average pembayaran], [Lama Telat] =
case
when datediff(day,duedate,payment_date) <= 0 then 0 else datediff(day,duedate,payment_date) end from [OLAP_VERSI2].[DBO].dim_waktu w, [OLAP_VERSI2].[DBO].dim_jenisbayar jb, [OLAP_VERSI2].[DBO].dim_do d, [OLAP_VERSI2].[DBO].dim_customer c, [OLTP_MULIA].[dbo].ar_payment as p where
p.payment_category = jb.jenis_bayar and p.payment_date = w.tgl and
p.customer = c.cust_no and p.invoice_no = d.invoice_no group by waktuID, custID, jenisID, doID, duedate, payment_date
13. Nama tabel : FilterTimeStamp CREATE TABLE FilterTimeStamp( [NamaTable] varchar(100), [Last_ETL] datetime )
Wawancara
1. Apakah perusahaan ini telah memiliki database? Jawab:
Ya, perusahaan ini sudah memiliki database untuk sistem yang berjalan.
2. Apakah perusahaan ini telah memiliki data warehouse? Jawab:
Belum, perusahaan ini belum memiliki data warehouse.
3. Apa saja kendala yang dihadapi oleh perusahaan saat ini pada sistem yang telah berjalan, khususnya dalam hal DBM S?
Jawab:
Lamanya waktu yang dibutuhkan untuk menghasilkan laporan penjualan karena data diekstrak secara manual dari database transaksi serta terkadang laporan yang dihasilkan terlalu rinci. Selain itu karena transaksi yang terus bertambah, terkadang sulit untuk mengakses data history perusahaan.
4. Jumlah transaksi per hari? Jawab:
Kurang lebih 100 transaksi per hari.
5. Bagaimana cara pihak eksekutif melihat laporan selama ini? Jawab:
Pihak eksekutif harus datang ke perusahaan dan meminta laporan kepada bagian finance lalu menunggu beberapa waktu sampai laporan dihasilkan.
6. Apa saja kendala dari pihak IT ketika harus membuat laporan? Jawab:
Pihak IT harus mengekstrak laporan secara manual dari database transaksi harian, dimana hal tersebut memakan waktu yang cukup lama dan tidak efisien.
7. Apa saja laporan yang ingin dilihat oleh pihak eksekutif? Jawab:
Pihak eksekutif menginginkan laporan berupa jumlah produksi, efisiensi produksi, top 10 produk, top 10 customer, top 10 wilayah, laporan piutang, dan laporan pembayaran piutang.
8. Bagaimana penyediaan info yang diinginkan (untuk perbaikan)? Jawab:
Kami menginginkan info yang lebih ringkas dangan tampilan yang mudah dimengerti (user friendly) dan kalau bisa dapat diakses secara online.
9. Siapa saja (user) yang dapat mengakses database yang ada? Jawab:
User yang dapat mengakses database secara langsung adalah DBA dan para eksekutif.
10. Transaksi yang ada apa saja? Jawab:
Produksi, penjualan, dan pembayaran.
11. Dalam lingkup apa data warehouse yang ingin dibuat? Jawab:
Lingkup yang diinginkan untuk dibuat data warehouse adalah lingkup produksi, penjualan, dan pembayaran.
Kuesioner
Berilah jawaban pada pertanyaan berikut sesuai dengan pendapat anda, dengan cara mencentang pada kolom yang ada.
Keterangan: • Sangat buruk = 1 • Buruk = 2 • Cukup = 3 • Baik = 4 • Sangat baik = 5 No Pertanyaan S angat
buruk Buruk Cukup Baik
S angat baik 1 Apakah tampilan dari
aplikasi ini user friendly?
2 Apakah aplikasi ini meningkatkan efisiensi kerja anda?
3 Bagaimana performa aplikasi ini?
4 Bagiamana bentuk penyajian laporan?
5 Apakah data dalam laporan analisa sudah sesuai dengan kebutuhan?
6 Apakah menu dan fungsi-fungsi sudah sesuai dengan kebutuhan?
7 Apakah pelatihan yang diberikan dapat dimengerti dengan baik?