L1
LAMPIRAN – LAMPIRAN
Script SQL /****** Object: Database Skripsi ******/ CREATE DATABASE [Skripsi] ON (NAME = 'Skripsi_Data', FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL\data\Skripsi_Data.MDF' , SIZE = 2, FILEGROWTH = 10%) LOG ON (NAME = 'Skripsi_Log', FILENAME = 'C:\Program Files\Microsoft
SQL
Server\MSSQL\data\Skripsi_Log.LDF'
,
FILEGROWTH = 10%) COLLATE SQL_Latin1_General_CP1_CI_AS
use [Skripsi]
/****** Object: Table [BahanBaku] ******/ CREATE TABLE [BahanBaku] ( [Kd_BB] [char] (5) NOT NULL , [Nama_BB] [varchar] (20) NOT NULL , [Satuan_BB] [varchar] (10) NOT NULL , [Harga_BB] [money] NOT NULL , [Saldo_GudBB] [decimal] (9, 3) NOT NULL , [Saldo_ProdBB] [decimal] (9, 3) NOT NULL , [Saldo_Waste] [decimal] (9, 3) NOT NULL , [Reorder_BB] [decimal] (9, 3) NOT NULL ) ON [PRIMARY] /****** Object: Table [JenisBarangJadi] ******/ CREATE TABLE [JenisBarangJadi] ( [Kd_Jns] [char] (5) NOT NULL , [Nama_Jns] [varchar] (35) NOT NULL ) ON [PRIMARY]
/****** Object: Table [Karyawan] ******/
SIZE
=
2,
L2 CREATE TABLE [Karyawan] ( [NIK] [char] (6) NOT NULL , [Nama] [varchar] (50) NOT NULL , [Jenis_Kelamin] [char] (1) NOT NULL , [Alamat] [varchar] (100) NOT NULL , [No_Telp] [varchar] (12) NOT NULL , [No_Handphone] [varchar] (12) NULL , [Username] [varchar] (50) NOT NULL , [Psswrd] [char] (10) NOT NULL , [Jabatan] [varchar] (50) NOT NULL , [Bagian] [varchar] (50) NOT NULL ) ON [PRIMARY]
/****** Object: Table [Pelanggan] ******/ CREATE TABLE [Pelanggan] ( [Kd_Plg] [char] (8) NOT NULL , [Nama_Plg] [varchar] (40) NOT NULL , [Alamat_Plg] [varchar] (100) NOT NULL , [Telp_Plg] [varchar] (12) NOT NULL , [Fax_Plg] [varchar] (12) NULL ) ON [PRIMARY]
/****** Object: Table [BarangJadi] ******/ CREATE TABLE [BarangJadi] ( [Kd_BJ] [char] (5) NOT NULL , [Nama_BJ] [varchar] (20) NOT NULL , [Satuan_BJ] [varchar] (10) NOT NULL , [HPP] [money] NOT NULL , [Harga_Jual] [money] NOT NULL , [Saldo_GudBJ] [int] NOT NULL , [Saldo_ProdBJ] [int] NOT NULL ,
L3 [Reorder_BJ] [int] NOT NULL , [Kd_Jns] [char] (5) NOT NULL ) ON [PRIMARY]
/****** Object: Table [PemesananPenjualan] ******/ CREATE TABLE [PemesananPenjualan] ( [No_Pesan] [char] (8) NOT NULL , [Tgl_Pesan] [smalldatetime] NOT NULL , [Pemesan] [varchar] (40) NOT NULL , [Total_Pesan] [money] NOT NULL , [Kd_Plg] [char] (8) NOT NULL , [NIK] [char] (6) NULL ) ON [PRIMARY]
/****** Object: Table [PengeluaranWaste] ******/ CREATE TABLE [PengeluaranWaste] ( [No_WO] [char] (8) NOT NULL , [Tgl_WO] [smalldatetime] NOT NULL , [Ket_WO] [varchar] (30) NOT NULL , [NIK] [char] (6) NOT NULL ) ON [PRIMARY]
/****** Object: Table [PerintahProduksiMassal] ******/ CREATE TABLE [PerintahProduksiMassal] ( [No_SPM] [char] (8) NOT NULL , [Tgl_SPM] [smalldatetime] NOT NULL , [Tgl_ProdSPM] [smalldatetime] NOT NULL , [Tgl_SlsSPM] [smalldatetime] NOT NULL , [NIK] [char] (6) NULL ) ON [PRIMARY]
L4 /****** Object: Table [TeleponPelanggan] ******/ CREATE TABLE [TeleponPelanggan] ( [Telp_Plg] [varchar] (12) NOT NULL , [Kd_Plg] [char] (8) NOT NULL ) ON [PRIMARY]
/****** Object: Table [Penjualan] ******/ CREATE TABLE [Penjualan] ( [No_Penj] [char] (8) NOT NULL , [Tgl_Penj] [smalldatetime] NOT NULL , [Nama_Proyek] [varchar] (20) NOT NULL , [Tgl_Kirim] [smalldatetime] NOT NULL , [Alamat_Kirim] [varchar] (100) NOT NULL , [Penerima] [varchar] (40) NOT NULL , [Total_Penj] [money] NOT NULL , [No_Pesan] [char] (8) NOT NULL , [NIK] [char] (6) NULL ) ON [PRIMARY]
/****** Object: Table [PesanBJ] ******/ CREATE TABLE [PesanBJ] ( [No_Pesan] [char] (8) NOT NULL , [Kd_BJ] [char] (5) NOT NULL , [Jml_BJ] [int] NOT NULL , [Harga_Sat] [money] NOT NULL ) ON [PRIMARY]
/****** Object: Table [SPMBB] ******/ CREATE TABLE [SPMBB] ( [No_SPM] [char] (8) NOT NULL , [Kd_BB] [char] (5) NOT NULL ,
L5 [Jml_BB] [decimal] (9, 3) NOT NULL ) ON [PRIMARY]
/****** Object: Table [SPMBJ] ******/ CREATE TABLE [SPMBJ] ( [No_SPM] [char] (8) NOT NULL , [Kd_BJ] [char] (5) NOT NULL , [Jml_BJ] [int] NOT NULL ) ON [PRIMARY]
/****** Object: Table [WasteKeluar] ******/ CREATE TABLE [WasteKeluar] ( [No_WO] [char] (8) NOT NULL , [Kd_BB] [char] (5) NOT NULL , [Jml_W] [decimal] (9, 3) NOT NULL ) ON [PRIMARY]
/****** Object: Table [JualBJ] ******/ CREATE TABLE [JualBJ] ( [No_Penj] [char] (8) NOT NULL , [Kd_BJ] [char] (5) NOT NULL , [Jml_BJ] [int] NOT NULL , [Harga_Sat] [money] NOT NULL ) ON [PRIMARY]
/****** Object: Table [PembayaranPenjualan] ******/ CREATE TABLE [PembayaranPenjualan] ( [No_Pemb] [char] (8) NOT NULL , [Tgl_Pemb] [smalldatetime] NOT NULL , [Total_Pemb] [money] NOT NULL , [No_Penj] [char] (8) NOT NULL ,
L6 [NIK] [char] (6) NULL ) ON [PRIMARY]
/****** Object: Table [PerintahProduksiPesanan] ******/ CREATE TABLE [PerintahProduksiPesanan] ( [No_SPK] [char] (8) NOT NULL , [Tgl_SPK] [smalldatetime] NOT NULL , [Tgl_ProdSPK] [smalldatetime] NOT NULL , [Tgl_SlsSPK] [smalldatetime] NOT NULL , [No_Penj] [char] (8) NOT NULL , [NIK] [char] (6) NULL ) ON [PRIMARY]
/****** Object: Table [HasilProduksi] ******/ CREATE TABLE [HasilProduksi] ( [No_HP] [char] (8) NOT NULL , [Tgl_HP] [smalldatetime] NOT NULL , [No_SPK] [char] (8) NULL , [No_SPM] [char] (8) NULL ) ON [PRIMARY]
/****** Object: Table [PengeluaranBahanBaku] ******/ CREATE TABLE [PengeluaranBahanBaku] ( [No_KeluarBB] [char] (8) NOT NULL , [Tgl_KeluarBB] [smalldatetime] NOT NULL , [No_SPK] [char] (8) NULL , [No_SPM] [char] (8) NULL , [NIK] [char] (6) NULL ) ON [PRIMARY]
/****** Object: Table [PengirimanPenjualan] ******/
L7 CREATE TABLE [PengirimanPenjualan] ( [No_Krm] [char] (8) NOT NULL , [Tgl_Krm] [smalldatetime] NOT NULL , [No_Pemb] [char] (8) NOT NULL , [NIK] [char] (6) NULL ) ON [PRIMARY]
/****** Object: Table [SPKBB] ******/ CREATE TABLE [SPKBB] ( [No_SPK] [char] (8) NOT NULL , [Kd_BB] [char] (5) NOT NULL , [Jml_BB] [decimal] (9, 3) NOT NULL ) ON [PRIMARY]
/****** Object: Table [SPKBJ] ******/ CREATE TABLE [SPKBJ] ( [No_SPK] [char] (8) NOT NULL , [Kd_BJ] [char] (5) NOT NULL , [Jml_BJ] [int] NOT NULL ) ON [PRIMARY]
/****** Object: Table [KeluarBB] ******/ CREATE TABLE [KeluarBB] ( [No_KeluarBB] [char] (8) NOT NULL , [Kd_BB] [char] (5) NOT NULL , [Jml_BBKel] [decimal] (9, 3) NOT NULL , [Jml_BBMsk] [decimal] (9, 3) NULL , [Kg_BB] [decimal] (9, 3) NULL , [Ukuran] [varchar] (10) NOT NULL ) ON [PRIMARY] /****** Object: Table [PenerimaanWaste] ******/
L8 CREATE TABLE [PenerimaanWaste] ( [No_HP] [char] (8) NOT NULL , [Kd_BB] [char] (5) NOT NULL , [Jml_BB] [decimal] (9, 3) NOT NULL ) ON [PRIMARY]
/****** Object: Table [PengeluaranBBProduksi] ******/ CREATE TABLE [PengeluaranBBProduksi] ( [No_Pakai] [char] (8) NOT NULL , [Tgl_Pakai] [smalldatetime] NOT NULL , [No_KeluarBB] [char] (8) NOT NULL , [NIK] [char] (6) NULL ) ON [PRIMARY]
/****** Object: Table [PengeluaranBJ] ******/ CREATE TABLE [PengeluaranBJ] ( [No_Krm] [char] (8) NOT NULL , [Kd_BJ] [char] (5) NOT NULL , [Jml_BJ] [int] NOT NULL ) ON [PRIMARY]
/****** Object: Table [PengembalianPenjualan] ******/ CREATE TABLE [PengembalianPenjualan] ( [No_Retur] [char] (8) NOT NULL , [Tgl_Retur] [smalldatetime] NOT NULL , [No_Krm] [char] (8) NOT NULL , [NIK] [char] (6) NULL ) ON [PRIMARY]
/****** Object: Table [TerimaBJProduksi] ******/ CREATE TABLE [TerimaBJProduksi] (
L9 [No_HP] [char] (8) NOT NULL , [Kd_BJ] [char] (5) NOT NULL , [Jml_BJ] [int] NOT NULL , [Kg_BJ] [decimal] (9, 3) NOT NULL ) ON [PRIMARY]
/****** Object: Table [KeluarBBProduksi] ******/ CREATE TABLE [KeluarBBProduksi] ( [No_Pakai] [char] (8) NOT NULL , [Kd_BB] [char] (5) NOT NULL , [Kd_BJ] [char] (5) NOT NULL , [Jml_BB] [decimal] (9, 3) NOT NULL , [Kg_BB] [decimal] (9, 3) NOT NULL , [Ukuran] [varchar] (10) NOT NULL ) ON [PRIMARY]
/****** Object: Table [ReturBJ] ******/ CREATE TABLE [ReturBJ] ( [No_Retur] [char] (8) NOT NULL , [Kd_BJ] [char] (5) NOT NULL , [Jml_BJ] [int] NOT NULL , [Harga_Sat] [money] NOT NULL ) ON [PRIMARY]
/****** Object: View [PesanPenjualan] ******/ CREATE VIEW PesanPenjualan AS SELECT pp.NoPesan, pp.Tgl_Pesan, plg.Kd_Plg, plg.Nama_Plg, bj.Nama_BJ, p.Jml_BJ FROM Pelanggan plg, PemesananPenjualan pp, PesanBJ p, BarangJadi bj WHERE pp.No_Pesan = p.No_Pesan AND pp.Kd_Plg = plg.Kd_Plg AND p.Kd_BJ = bj.Kd_BJ GROUP BY pp.Tgl_Pesan ORDER BY pp.Tgl_Pesan DESC, pp.Kd_Plg ASC
L 10 /****** Object: View [Penj] ******/ CREATE VIEW Penj AS SELECT p.No_Penj, p.Tgl_Penj, p.Total_penj, pp.Kd_Plg, plg.Nama_Plg, p.NIK, k.Nama, d.Kd_BJ, bj.Nama_BJ, bj.SatuanBJ, d.Jml_BJ, d.Harga_Sat FROM Penjualan p, PemesananPenjualan pp, Karyawan k, PesanBJ d, BarangJadi bj, Pelanggan plg WHERE d.No_Penj = p.No_Penj AND p.No_Pesan = pp.No_Pesan AND pp.Kd_Plg = plg.Kd_Plg AND d_Kd_BJ = bj.Kd_BJ AND p.NIK = k.NIK GROUP BY p.Tgl_Penj ORDER BY p.Tgl_Penj DESC, pp.Kd_Plg ASC
/****** Object: View [BayarPenjualan] ******/ CREATE VIEW BayarPenjualan AS SELECT b.No_Pemb, b.Tgl_Pemb, b.Total_Pemb, p.No_Penj, pp.Kd_Plg, plg.Nama_Plg FROM PembayaranPenjualan b, Penjualan p, PemesananPenjualan pp, Pelanggan plg WHERE b.No_Penj = p.No_Penj AND pp.No_Pesan = p.No_Pesan AND pp.Kd_Plg = plg.Kd_Plg ORDER BY p.No_Penj DESC
/****** Object: View [KirimPenjualan] ******/ CREATE VIEW KirimPenjualan AS SELECT k.*, p.No_Penj, p.Tgl_Penj, pp.Kd_Plg, plg.Nama_Plg,
d.Kd_BJ,
bj.Nama_BJ,
bj.Satuan_BJ,
d.Jml_BJ
FROM
PengirimanPenjualan k, Penjualan p, PemesananPenjualan pp, Pelanggan plg, PengeluaranBJ d, BarangJadi bj, PembayaranPenjualan b WHERE k.No_Pemb = b.No_Pemb AND b.No_Penj = p.No_Penj AND p.No_Pesan = pp.No_Pesan AND pp.Kd_Plg = plg.Kd_Plg AND d.Kd_BJ = bj.Kd_BJ GROUP BY p.No_Penj ORDER BY p.No_Penj DESC, k.No_Krm ASC
/****** Object: View [ReturPenjualan] ******/ CREATE VIEW ReturPenjualan AS SELECT r.No_Retur, r.Tgl_Retur, pp.Kd_Plg, plg.Nama_Plg, d.Kd_BJ, bj.Nama_BJ, d.Jml_BJ, bj.Satuan_BJ, d.Harga_Sat FROM Pelanggan plg, PemesananPenjualan pp, Penjualan p, PembayaranPenjualan b, PengirimanPenjualan k, PengembalianPenjualan r, ReturBJ rb, BarangJadi bj, Pelanggan plg WHERE pp.Kd_Plg = plg.Kd_Plg AND pp.No_Pesan = p.No_Pesan and p.No_Penj
L 11 = b.No_Penj AND b.No_Pemb = k.No_Pemb AND k.No_Krm = r.No_Krm AND r.No_Retur = rb.No_Retur AND rb.Kd_BJ = bj.Kd_BJ ORDER BY r.No_Retur DESC /****** Object: View [SPKBahanBaku] ******/ CREATE VIEW SPKBahanBaku AS SELECT spk.No_SPK, spk.Tgl_SPK, p.No_Penj, pp.Kd_Plg,
plg.No_Plg,
spk.Tgl_ProdSPK,
spk.Tgl_SlsSPK,
spkbb.Kd_BB,
bb.Nama_BB, spkbb.Jml_BB, bb.Satuan_BB FROM PerintahProduksiPesanan spk, SPKBB spkbb, BahanBaku bb, Pelanggan plg, PemesananPenjualan pp, Penjualan p WHERE spk.No_SPK = spkbb.No_SPK AND spk.No_Penj = p. No_Penj AND p.No_Pesan = pp.No_Pesan AND pp.Kd_Plg = plg.Kd_Plg AND spkbb.Kd_BB = bb.Kd_BB ORDER BY spk.No_SPK DESC
/****** Object: View [SPKBarangJadi] ******/ CREATE VIEW SPKBarangJadi AS SELECT spk.No_SPK, spk.Tgl_SPK, p.No_Penj, pp.Kd_Plg,
plg.No_Plg,
spk.Tgl_ProdSPK,
spk.Tgl_SlsSPK,
spkbj.Kd_BJ,
bj.Nama_BJ, spkbj.Jml_BJ, bj.Satuan_BJ FROM PerintahProduksiPesanan spk, SPKBJ spkbj, BarangJadi bj, Pelanggan plg, PemesananPenjualan pp, Penjualan p WHERE spk.No_SPK = spkbj.No_SPK AND spk.No_Penj = p. No_Penj AND p.No_Pesan = pp.No_Pesan AND pp.Kd_Plg = plg.Kd_Plg AND spkbj.Kd_BJ = bj.Kd_BJ ORDER BY spk.No_SPK DESC
/****** Object: View [SPMBahanBaku] ******/ CREATE VIEW SPMBahanBaku AS SELECT spm.No_SPM, spm.Tgl_SPM, spm.Tgl_ProdSPM, Tgl_SlsSPM, spmbb.Kd_BB, bb.Nama_BB, spmbb.Jml_BB, bb.SatuanBB FROM PerintahProduksiMassal spm, SPMBB spmbb, SPMBJ spmbj, BahanBaku bb WHERE spm.No_SPM = spmbb.No_SPM AND spm.No_SPM = spmbj.No_SPM AND spmbb.Kd_BB = bb.Kd_BB ORDER BY spm.No_SPM DESC /****** Object: View [SPMBarangJadi] ******/ CREATE VIEW SPMBarangJadi AS SELECT spm.No_SPM, spm.Tgl_SPM, spm.Tgl_ProdSPM,
Tgl_SlsSPM,
spmbj.Kd_BJ,
bj.Nama_BJ,
spmbj.Jml_BJ,
bj.SatuanBJ FROM PerintahProduksiMassal spm, SPMBJ spmbj, BarangJadi bj
L 12 WHERE spm.No_SPM = spmbj.No_SPM AND spmbj.Kd_BJ = bj.Kd_BJ ORDER BY spm.No_SPM DESC
/****** Object: View [PengeluaranBB] ******/ CREATE VIEW PengeluaranBB AS SELECT p.*, d.Kd_BB, bb.Nama_BB, d.Jml_BBKel,
d.Jml_BBMsk,
bb.SatuanBB
FROM
PengeluaranBahanbaku
p,
KeluarBB d, BahanBaku bb WHERE p.No_KeluarBB = d.No_KeluarBB AND d.Kd_BB = bb.Kd_BB ORDER BY p.No_KeluarBB DESC
/****** Object: View [PengeluaranBBProd] ******/ CREATE VIEW PengeluaranBBProd AS SELECT p.*, k.No_KeluarBB, d.Kd_BB, bb.Nama_BB, d.Kd_BJ, bj.nama_BJ, d.Kg_BB FROM PengeluaranBBProduksi p, KeluarBBProduksi d, PengeluaranBahanBaku k, BahanBaku bb, BarangJadi bj WHERE k.No_KeluarBB = p.No_KeluarBB AND p.No_Pakai = d.No_Pakai AND d.Kd_BB = bb.Kd_BB AND d.Kd_BJ = bj.Kd_BJ ORDER BY p.No_Pakai DESC
/****** Object: View [HasilProd] ******/ CREATE VIEW HasilProd AS SELECT hp.No_HP, hp.Tgl_HP, hp.No_SPK, hp.No_SPM, d.Kd_BJ, bj.Nama_BJ, d.Jml_BJ, bj.Satuan_BJ FROM HasilProduksi hp, TerimaBJProduksi d, BarangJadi bj WHERE hp.No_HP = d.No_HP AND hp.Kd_BJ = d.Kd_BJ AND d.Kd_BJ = bj.Kd_BJ ORDER BY hp.No_HP DESC
/****** Object: View [TerimaWaste] ******/ CREATE VIEW TerimaWaste AS SELECT hp.No_HP, hp.Tgl_HP, d.Kd_BB, bb.Nama_BB, d.Kg_BB, bb.Satuan_BB FROM HasilProduksi hp, PenerimaanWaste d, BahanBaku bb WHERE hp.No_HP = d.No_HP AND hp.Kd_BB = d.Kd_BB AND d.Kd_BB = bb.Kd_BB ORDER BY hp.No_HP DESC
/****** Object: View [KeluarWaste] ******/
L 13 CREATE VIEW KeluarWaste AS SELECT p.*, d.Kd_BB, bb.Nama_BB, d.Kg_BB FROM PengeluaranWaste p, WasteKeluar d, BahanBaku bb WHERE p.No_WO = d.No_WO AND d.Kd_BB = bb.Kd_BB ORDER BY p.No_WO DESC
/****** Object: View [BBReorder] ******/ CREATE VIEW BBReorder AS SELECT bb.Kd_BB, bb.Nama_BB, bb.Reorder_BB, bb.SaldoGudBB FROM BahanBaku bb WHERE bb.Saldo_GudBB <= bb.Reorder_BB ORDER BY bb.Kd_BB ASC /****** Object: View [BJReorder] ******/ CREATE VIEW BJReorder AS SELECT bj.Kd_BJ, bj.Nama_BJ, bj.Reorder_BJ, bj.SaldoGudBJ FROM BarangJadi bj WHERE bj.Saldo_GudBJ <= bj.Reorder_BJ ORDER BY bj.Kd_BJ ASC
ALTER TABLE [BahanBaku] WITH NOCHECK ADD CONSTRAINT [BBInd1] PRIMARY KEY CLUSTERED ( [Kd_BB] ) ON [PRIMARY]
ALTER TABLE [JenisBarangJadi] WITH NOCHECK ADD CONSTRAINT [JenisBJInd1] PRIMARY KEY CLUSTERED ( [Kd_Jns] ) ON [PRIMARY]
ALTER TABLE [Karyawan] WITH NOCHECK ADD CONSTRAINT [KaryawanInd1] PRIMARY KEY CLUSTERED ( [NIK] ) ON [PRIMARY]
ALTER TABLE [Pelanggan] WITH NOCHECK ADD CONSTRAINT [PelangganInd1] PRIMARY KEY CLUSTERED
L 14 ( [Kd_Plg] ) ON [PRIMARY]
ALTER TABLE [BarangJadi] WITH NOCHECK ADD CONSTRAINT [BJInd1] PRIMARY KEY CLUSTERED ( [Kd_BJ] ) ON [PRIMARY]
ALTER TABLE [PemesananPenjualan] WITH NOCHECK ADD CONSTRAINT [PemesananPenjInd1] PRIMARY KEY CLUSTERED ( [No_Pesan] ) ON [PRIMARY]
ALTER TABLE [PengeluaranWaste] WITH NOCHECK ADD CONSTRAINT [PengeluaranWasteInd1] PRIMARY KEY CLUSTERED ( [No_WO] ) ON [PRIMARY]
ALTER TABLE [PerintahProduksiMassal] WITH NOCHECK ADD CONSTRAINT [PerintahMassalInd1] PRIMARY KEY CLUSTERED ( [No_SPM] ) ON [PRIMARY]
ALTER TABLE [Penjualan] WITH NOCHECK ADD CONSTRAINT [PenjualanInd1] PRIMARY KEY CLUSTERED ( [No_Penj] ) ON [PRIMARY]
ALTER TABLE [PesanBJ] WITH NOCHECK ADD CONSTRAINT [PesanBJInd1] PRIMARY KEY CLUSTERED ( [No_Pesan]
L 15 ) ON [PRIMARY]
ALTER TABLE [SPMBB] WITH NOCHECK ADD CONSTRAINT [SPMBBInd1] PRIMARY KEY CLUSTERED ( [No_SPM] ) ON [PRIMARY]
ALTER TABLE [SPMBJ] WITH NOCHECK ADD CONSTRAINT [SPMBJInd1] PRIMARY KEY CLUSTERED ( [No_SPM] ) ON [PRIMARY]
ALTER TABLE [WasteKeluar] WITH NOCHECK ADD CONSTRAINT [KeluarWasteInd1] PRIMARY KEY CLUSTERED ( [No_WO] ) ON [PRIMARY] ALTER TABLE [JualBJ] WITH NOCHECK ADD CONSTRAINT [JualBJInd1] PRIMARY KEY CLUSTERED ( [No_Penj] ) ON [PRIMARY]
ALTER TABLE [PembayaranPenjualan] WITH NOCHECK ADD CONSTRAINT [PembayaranPenjInd1] PRIMARY KEY CLUSTERED ( [No_Pemb] ) ON [PRIMARY]
ALTER TABLE [PerintahProduksiPesanan] WITH NOCHECK ADD CONSTRAINT [PerintahPesananInd1] PRIMARY KEY CLUSTERED ( [No_SPK] ) ON [PRIMARY]
L 16 ALTER TABLE [HasilProduksi] WITH NOCHECK ADD CONSTRAINT [HasilProdInd1] PRIMARY KEY CLUSTERED ( [No_HP] ) ON [PRIMARY]
ALTER TABLE [PengeluaranBahanBaku] WITH NOCHECK ADD CONSTRAINT [PengeluaranBBInd1] PRIMARY KEY CLUSTERED ( [No_KeluarBB] ) ON [PRIMARY] ALTER TABLE [PengirimanPenjualan] WITH NOCHECK ADD CONSTRAINT [PengirimanPenjInd1] PRIMARY KEY CLUSTERED ( [No_Krm] ) ON [PRIMARY]
ALTER TABLE [SPKBB] WITH NOCHECK ADD CONSTRAINT [SPKBBInd1] PRIMARY KEY CLUSTERED ( [No_SPK] ) ON [PRIMARY]
ALTER TABLE [SPKBJ] WITH NOCHECK ADD CONSTRAINT [SPKBJInd1] PRIMARY KEY CLUSTERED ( [No_SPK] ) ON [PRIMARY]
ALTER TABLE [KeluarBB] WITH NOCHECK ADD CONSTRAINT [KeluarBBInd1] PRIMARY KEY CLUSTERED ( [No_KeluarBB] ) ON [PRIMARY]
ALTER TABLE [PenerimaanWaste] WITH NOCHECK ADD CONSTRAINT [TerimaWasteInd1] PRIMARY KEY CLUSTERED
L 17 ([No_HP] ) ON [PRIMARY] ALTER TABLE [PengeluaranBBProduksi] WITH NOCHECK ADD CONSTRAINT [PengeluaranProdInd1] PRIMARY KEY CLUSTERED ( [No_Pakai] ) ON [PRIMARY]
ALTER TABLE [PengeluaranBJ] WITH NOCHECK ADD CONSTRAINT [PengeluaranBJInd1] PRIMARY KEY CLUSTERED ( [No_Krm] ) ON [PRIMARY]
ALTER TABLE [PengembalianPenjualan] WITH NOCHECK ADD CONSTRAINT [PengembalianPenjInd1] PRIMARY KEY CLUSTERED ( [No_Retur] ) ON [PRIMARY]
ALTER TABLE [TerimaBJProduksi] WITH NOCHECK ADD CONSTRAINT [TerimaBJProdInd1] PRIMARY KEY CLUSTERED ( [No_HP] ) ON [PRIMARY]
ALTER TABLE [KeluarBBProduksi] WITH NOCHECK ADD CONSTRAINT [KeluarProdInd1] PRIMARY KEY CLUSTERED ( [No_Pakai] ) ON [PRIMARY] ALTER TABLE [ReturBJ] WITH NOCHECK ADD CONSTRAINT [ReturBJInd1] PRIMARY KEY CLUSTERED ( [No_Retur] ) ON [PRIMARY]
L 18 ALTER TABLE [BahanBaku] WITH NOCHECK ADD CONSTRAINT
[DF_BahanBaku_Saldo_GudBB]
DEFAULT
(0)
FOR
[DF_BahanBaku_Saldo_ProdBB]
DEFAULT
(0)
FOR
[Saldo_GudBB], CONSTRAINT [Saldo_ProdBB], CONSTRAINT
[DF_BahanBaku_Saldo_Waste]
DEFAULT
(0)
FOR
[DF_BahanBaku_Reorder_BB]
DEFAULT
(0)
FOR
[Saldo_Waste], CONSTRAINT [Reorder_BB], CONSTRAINT [CK_BahanBaku] CHECK (len([Kd_BB]) = 5)
ALTER TABLE [JenisBarangJadi] WITH NOCHECK ADD CONSTRAINT [CK_JenisBarangJadi] CHECK (len([Kd_Jns]) = 5)
ALTER TABLE [Karyawan] WITH NOCHECK ADD CONSTRAINT [CK_Karyawan] CHECK (len([NIK]) = 6), CONSTRAINT [CK_Karyawan_1] CHECK (len([Psswrd]) = 6)
ALTER TABLE [Pelanggan] WITH NOCHECK ADD CONSTRAINT [CK_Pelanggan] CHECK (len([Kd_Plg]) = 8)
ALTER TABLE [BarangJadi] WITH NOCHECK ADD CONSTRAINT
[DF_BarangJadi_Saldo_GudBJ]
DEFAULT
(0)
FOR
[DF_BarangJadi_Saldo_ProdBJ]
DEFAULT
(0)
FOR
(0)
FOR
[Saldo_GudBJ], CONSTRAINT [Saldo_ProdBJ], CONSTRAINT
[DF_BarangJadi_Reorder_BJ]
DEFAULT
[Reorder_BJ], CONSTRAINT [CK_BarangJadi] CHECK (len([Kd_BJ]) = 5), CONSTRAINT [CK_BarangJadi_1] CHECK (len([Kd_Jns]) = 5)
L 19 ALTER TABLE [PemesananPenjualan] WITH NOCHECK ADD CONSTRAINT [CK_PemesananPenjualan] CHECK (len([No_Pesan]) = 8), CONSTRAINT [CK_PemesananPenjualan_1] CHECK (len([Kd_Plg]) = 8), CONSTRAINT [CK_PemesananPenjualan_2] CHECK (len([NIK]) = 6)
ALTER TABLE [PengeluaranWaste] WITH NOCHECK ADD CONSTRAINT [CK_PengeluaranWaste] CHECK (len([No_WO]) = 8), CONSTRAINT [CK_PengeluaranWaste_1] CHECK (len([NIK]) = 6)
ALTER TABLE [PerintahProduksiMassal] WITH NOCHECK ADD CONSTRAINT [CK_PerintahProduksiMassal] CHECK (len([No_SPM]) = 8), CONSTRAINT [CK_PerintahProduksiMassal_1] CHECK (len([NIK]) = 6) ALTER TABLE [TeleponPelanggan] WITH NOCHECK ADD CONSTRAINT [CK_TeleponPelanggan] CHECK (len([Kd_Plg]) = 8)
ALTER TABLE [Penjualan] WITH NOCHECK ADD CONSTRAINT [CK_Penjualan] CHECK (len([No_Penj]) = 8), CONSTRAINT [CK_Penjualan_1] CHECK (len([No_Pesan]) = 8), CONSTRAINT [CK_Penjualan_2] CHECK (len([NIK]) = 6)
ALTER TABLE [PesanBJ] WITH NOCHECK ADD CONSTRAINT [CK_PesanBJ] CHECK (len([No_Pesan]) = 8), CONSTRAINT [CK_PesanBJ_1] CHECK (len([Kd_BJ]) = 5)
ALTER TABLE [SPMBB] WITH NOCHECK ADD CONSTRAINT [CK_SPMBB] CHECK (len([No_SPM]) = 8), CONSTRAINT [CK_SPMBB_1] CHECK (len([Kd_BB]) = 5)
ALTER TABLE [SPMBJ] WITH NOCHECK ADD CONSTRAINT [CK_SPMBJ] CHECK (len([No_SPM]) = 8), CONSTRAINT [CK_SPMBJ_1] CHECK (len([Kd_BJ]) = 5)
L 20
ALTER TABLE [WasteKeluar] WITH NOCHECK ADD CONSTRAINT [CK_WasteKeluar] CHECK (len([No_WO]) = 8), CONSTRAINT [CK_WasteKeluar_1] CHECK (len([Kd_BB]) = 5)
ALTER TABLE [JualBJ] WITH NOCHECK ADD CONSTRAINT [CK_JualBJ] CHECK (len([No_Penj]) = 8), CONSTRAINT [CK_JualBJ_1] CHECK (len([Kd_BJ]) = 5)
ALTER TABLE [PembayaranPenjualan] WITH NOCHECK ADD CONSTRAINT [CK_PembayaranPenjualan] CHECK (len([No_Pemb]) = 8), CONSTRAINT [CK_PembayaranPenjualan_1] CHECK (len([No_Penj]) = 8), CONSTRAINT [CK_PembayaranPenjualan_2] CHECK (len([NIK]) = 6)
ALTER TABLE [PerintahProduksiPesanan] WITH NOCHECK ADD CONSTRAINT [CK_PerintahProduksiPesanan] CHECK (len([No_SPK]) = 8), CONSTRAINT [CK_PerintahProduksiPesanan_1] CHECK (len([No_Penj]) = 8), CONSTRAINT [CK_PerintahProduksiPesanan_2] CHECK (len([NIK]) = 6)
ALTER TABLE [HasilProduksi] WITH NOCHECK ADD CONSTRAINT [CK_HasilProduksi] CHECK (len([No_HP]) = 8), CONSTRAINT [CK_HasilProduksi_1] CHECK (len([No_SPK]) = 8), CONSTRAINT [CK_HasilProduksi_2] CHECK (len([No_SPM]) = 8)
ALTER TABLE [PengeluaranBahanBaku] WITH NOCHECK ADD CONSTRAINT [CK_PengeluaranBahanBaku] CHECK (len([No_KeluarBB]) = 8), CONSTRAINT [CK_PengeluaranBahanBaku_1] CHECK (len([No_SPK]) = 8), CONSTRAINT [CK_PengeluaranBahanBaku_2] CHECK (len([No_SPM]) = 8), CONSTRAINT [CK_PengeluaranBahanBaku_3] CHECK (len([NIK]) = 6)
L 21
ALTER TABLE [PengirimanPenjualan] WITH NOCHECK ADD CONSTRAINT [CK_PengirimanPenjualan] CHECK (len([No_Krm]) = 8), CONSTRAINT [CK_PengirimanPenjualan_1] CHECK (len([No_Pemb]) = 8), CONSTRAINT [CK_PengirimanPenjualan_2] CHECK (len([NIK]) = 6)
ALTER TABLE [SPKBB] WITH NOCHECK ADD CONSTRAINT [CK_SPKBB] CHECK (len([No_SPK]) = 8), CONSTRAINT [CK_SPKBB_1] CHECK (len([Jml_BB]) = 5)
ALTER TABLE [SPKBJ] WITH NOCHECK ADD CONSTRAINT [CK_SPKBJ] CHECK (len([No_SPK]) = 8), CONSTRAINT [CK_SPKBJ_1] CHECK (len([Kd_BJ]) = 8)
ALTER TABLE [KeluarBB] WITH NOCHECK ADD CONSTRAINT [CK_KeluarBB] CHECK (len([No_KeluarBB]) = 8), CONSTRAINT [CK_KeluarBB_1] CHECK (len([Kd_BB]) = 5)
ALTER TABLE [PenerimaanWaste] WITH NOCHECK ADD CONSTRAINT [CK_PenerimaanWaste] CHECK (len([No_HP]) = 8), CONSTRAINT [CK_PenerimaanWaste_1] CHECK (len([Kd_BB]) = 5)
ALTER TABLE [PengeluaranBBProduksi] WITH NOCHECK ADD CONSTRAINT [CK_PengeluaranBBProduksi] CHECK (len([No_Pakai]) = 8), CONSTRAINT [CK_PengeluaranBBProduksi_1] CHECK (len([No_KeluarBB]) = 8), CONSTRAINT [CK_PengeluaranBBProduksi_2] CHECK (len([NIK]) = 6)
ALTER TABLE [PengeluaranBJ] WITH NOCHECK ADD CONSTRAINT [CK_PengeluaranBJ] CHECK (len([No_Krm]) = 8),
L 22 CONSTRAINT [CK_PengeluaranBJ_1] CHECK (len([Kd_BJ]) = 5)
ALTER TABLE [PengembalianPenjualan] WITH NOCHECK ADD CONSTRAINT [CK_PengembalianPenjualan] CHECK (len([No_Retur]) = 8), CONSTRAINT [CK_PengembalianPenjualan_1] CHECK (len([No_Krm]) = 8), CONSTRAINT [CK_PengembalianPenjualan_2] CHECK (len([NIK]) = 6)
ALTER TABLE [TerimaBJProduksi] WITH NOCHECK ADD CONSTRAINT [CK_TerimaBJProduksi] CHECK (len([No_HP]) = 8), CONSTRAINT [CK_TerimaBJProduksi_1] CHECK (len([Kd_BJ]) = 5)
ALTER TABLE [KeluarBBProduksi] WITH NOCHECK ADD CONSTRAINT [CK_KeluarBBProduksi] CHECK (len([No_Pakai]) = 8), CONSTRAINT [CK_KeluarBBProduksi_1] CHECK (len([Kd_BJ]) = 5), CONSTRAINT [CK_KeluarBBProduksi_2] CHECK (len([Kd_BB]) = 5)
ALTER TABLE [ReturBJ] WITH NOCHECK ADD CONSTRAINT [CK_ReturBJ] CHECK (len([No_Retur]) = 8), CONSTRAINT [CK_ReturBJ_1] CHECK (len([Kd_BJ]) = 5)
CREATE INDEX [BBInd2] ON [BahanBaku]([Nama_BB]) ON [PRIMARY] CREATE INDEX [KaryawanInd2] ON [Karyawan]([Nama]) ON [PRIMARY] CREATE INDEX [PelangganInd2] ON [Pelanggan]([Nama_Plg]) ON [PRIMARY] CREATE INDEX [BJInd2] ON [BarangJadi]([Nama_BJ]) ON [PRIMARY]
CREATE INDEX [PemesananPenjInd2] ON [PemesananPenjualan]([Tgl_Pesan]) ON [PRIMARY]
CREATE INDEX [PengeluaranWasteInd2] ON [PengeluaranWaste]([Tgl_WO]) ON [PRIMARY]
L 23 CREATE
INDEX [PerintahMassalInd2] ON [PerintahProduksiMassal]([Tgl_SPM])
ON [PRIMARY]
CREATE INDEX [TelpPlgInd1] ON [TeleponPelanggan]([Kd_Plg]) ON [PRIMARY] CREATE INDEX [PenjualanInd2] ON [Penjualan]([No_Pesan]) ON [PRIMARY] CREATE INDEX [PenjualanInd3] ON [Penjualan]([Tgl_Penj]) ON [PRIMARY] CREATE INDEX [PesanBJInd2] ON [PesanBJ]([Kd_BJ]) ON [PRIMARY] CREATE INDEX [SPMBBInd2] ON [SPMBB]([Kd_BB]) ON [PRIMARY] CREATE INDEX [SPMBJInd2] ON [SPMBJ]([Kd_BJ]) ON [PRIMARY] CREATE INDEX [KeluarWasteInd2] ON [WasteKeluar]([Kd_BB]) ON [PRIMARY] CREATE INDEX [JualBJInd2] ON [JualBJ]([Kd_BJ]) ON [PRIMARY]
CREATE
INDEX [PembayaranPenjInd2] ON [PembayaranPenjualan]([Tgl_Pemb])
ON [PRIMARY]
CREATE INDEX [PerintahPesananInd2] ON [PerintahProduksiPesanan]([No_Penj]) ON [PRIMARY]
CREATE INDEX [PerintahPesananInd3] ON [PerintahProduksiPesanan]([Tgl_SPK]) ON [PRIMARY]
CREATE INDEX [HasilProdInd2] ON [HasilProduksi]([Tgl_HP]) ON [PRIMARY]
CREATE
INDEX
[PengeluaranBBInd2]
ON
[PengeluaranBahanBaku]([Tgl_KeluarBB]) ON [PRIMARY]
CREATE INDEX [PengirimanPenjInd2] ON [PengirimanPenjualan]([No_Pemb]) ON [PRIMARY]
CREATE INDEX [SPKBBInd2] ON [SPKBB]([Kd_BB]) ON [PRIMARY] CREATE INDEX [SPKBJInd2] ON [SPKBJ]([Kd_BJ]) ON [PRIMARY]
L 24 CREATE INDEX [KeluarBBInd2] ON [KeluarBB]([Kd_BB]) ON [PRIMARY] CREATE
INDEX [TerimaWasteInd2] ON [PenerimaanWaste]([Kd_BB]) ON
[PRIMARY]
CREATE INDEX [PengeluaranProdInd2] ON [PengeluaranBBProduksi]([Tgl_Pakai]) ON [PRIMARY]
CREATE
INDEX
[PengeluaranBJInd2]
ON
[PengeluaranBJ]([Kd_BJ])
ON
[PRIMARY]
CREATE INDEX [PengembalianPenjInd2] ON [PengembalianPenjualan]([No_Krm]) ON [PRIMARY]
CREATE INDEX [PengembalianPenjInd3] ON [PengembalianPenjualan]([Tgl_Retur]) ON [PRIMARY]
CREATE
INDEX [TerimaBJProdInd2] ON [TerimaBJProduksi]([Kd_BJ]) ON
[PRIMARY]
CREATE
INDEX [KeluarProdInd2] ON [KeluarBBProduksi]([Kd_BB]) ON
[PRIMARY]
CREATE INDEX [ReturBJInd2] ON [ReturBJ]([Kd_BJ]) ON [PRIMARY]
ALTER TABLE [BarangJadi] ADD CONSTRAINT [FK_BarangJadi_JenisBarangJadi] FOREIGN KEY ( [Kd_Jns] ) REFERENCES [JenisBarangJadi] ( [Kd_Jns] ) ON UPDATE CASCADE
L 25 ALTER TABLE [PemesananPenjualan] ADD CONSTRAINT [FK_PemesananPenjualan_Karyawan] FOREIGN KEY ( [NIK] ) REFERENCES [Karyawan] ( [NIK] ) ON UPDATE CASCADE , CONSTRAINT [FK_PemesananPenjualan_Pelanggan] FOREIGN KEY ( [Kd_Plg] ) REFERENCES [Pelanggan] ( [Kd_Plg] ) ON UPDATE CASCADE
ALTER TABLE [PengeluaranWaste] ADD CONSTRAINT [FK_PengeluaranWaste_Karyawan] FOREIGN KEY ( [NIK] ) REFERENCES [Karyawan] ( [NIK] ) alter table [PengeluaranWaste] nocheck constraint [FK_PengeluaranWaste_Karyawan]
ALTER TABLE [PerintahProduksiMassal] ADD CONSTRAINT [FK_PerintahProduksiMassal_Karyawan] FOREIGN KEY ( [NIK] ) REFERENCES [Karyawan] ( [NIK] )
alter
table
[PerintahProduksiMassal]
[FK_PerintahProduksiMassal_Karyawan]
ALTER TABLE [TeleponPelanggan] ADD
nocheck
constraint
L 26 CONSTRAINT [FK_TeleponPelanggan_Pelanggan] FOREIGN KEY ( [Kd_Plg] ) REFERENCES [Pelanggan] ( [Kd_Plg] ) ON UPDATE CASCADE
ALTER TABLE [Penjualan] ADD CONSTRAINT [FK_Penjualan_Karyawan] FOREIGN KEY ( [NIK] ) REFERENCES [Karyawan] ( [NIK] ), CONSTRAINT [FK_Penjualan_PemesananPenjualan] FOREIGN KEY ( [No_Pesan] ) REFERENCES [PemesananPenjualan] ( [No_Pesan] ) ON UPDATE CASCADE
alter table [Penjualan] nocheck constraint [FK_Penjualan_Karyawan]
ALTER TABLE [PesanBJ] ADD CONSTRAINT [FK_PesanBJ_BarangJadi] FOREIGN KEY ( [Kd_BJ] ) REFERENCES [BarangJadi] ( [Kd_BJ] ) ON UPDATE CASCADE , CONSTRAINT [FK_PesanBJ_PemesananPenjualan] FOREIGN KEY ( [No_Pesan] ) REFERENCES [PemesananPenjualan] ( [No_Pesan] ) ON UPDATE CASCADE
L 27
ALTER TABLE [SPMBB] ADD CONSTRAINT [FK_SPMBB_BahanBaku] FOREIGN KEY ( [Kd_BB] ) REFERENCES [BahanBaku] ( [Kd_BB] ) ON UPDATE CASCADE , CONSTRAINT [FK_SPMBB_PerintahProduksiMassal] FOREIGN KEY ( [No_SPM] ) REFERENCES [PerintahProduksiMassal] ( [No_SPM] ) ON UPDATE CASCADE
ALTER TABLE [SPMBJ] ADD CONSTRAINT [FK_SPMBJ_BarangJadi] FOREIGN KEY ( [Kd_BJ] ) REFERENCES [BarangJadi] ( [Kd_BJ] ) ON UPDATE CASCADE , CONSTRAINT [FK_SPMBJ_PerintahProduksiMassal] FOREIGN KEY ( [No_SPM] ) REFERENCES [PerintahProduksiMassal] ( [No_SPM] ) ON UPDATE CASCADE
ALTER TABLE [WasteKeluar] ADD CONSTRAINT [FK_WasteKeluar_BahanBaku] FOREIGN KEY ( [Kd_BB] ) REFERENCES [BahanBaku] ( [Kd_BB] ) ON UPDATE CASCADE ,
L 28 CONSTRAINT [FK_WasteKeluar_PengeluaranWaste] FOREIGN KEY ( [No_WO] ) REFERENCES [PengeluaranWaste] ( [No_WO] ) ON UPDATE CASCADE
ALTER TABLE [JualBJ] ADD CONSTRAINT [FK_JualBJ_BarangJadi] FOREIGN KEY ( [Kd_BJ] ) REFERENCES [BarangJadi] ( [Kd_BJ] ) ON UPDATE CASCADE , CONSTRAINT [FK_JualBJ_Penjualan] FOREIGN KEY ( [No_Penj] ) REFERENCES [Penjualan] ( [No_Penj] ) ON UPDATE CASCADE
ALTER TABLE [PembayaranPenjualan] ADD CONSTRAINT [FK_PembayaranPenjualan_Karyawan] FOREIGN KEY ( [NIK] ) REFERENCES [Karyawan] ( [NIK] ), CONSTRAINT [FK_PembayaranPenjualan_Penjualan] FOREIGN KEY ( [No_Penj] ) REFERENCES [Penjualan] ( [No_Penj] ) ON UPDATE CASCADE
L 29 alter
table
[PembayaranPenjualan]
nocheck
constraint
[FK_PembayaranPenjualan_Karyawan]
ALTER TABLE [PerintahProduksiPesanan] ADD CONSTRAINT [FK_PerintahProduksiPesanan_Karyawan] FOREIGN KEY ( [NIK] ) REFERENCES [Karyawan] ( [NIK] ), CONSTRAINT [FK_PerintahProduksiPesanan_Penjualan] FOREIGN KEY ( [No_Penj] ) REFERENCES [Penjualan] ( [No_Penj] ) ON UPDATE CASCADE
alter
table
[PerintahProduksiPesanan]
nocheck
constraint
[FK_PerintahProduksiPesanan_Karyawan]
ALTER TABLE [HasilProduksi] ADD CONSTRAINT [FK_HasilProduksi_PerintahProduksiMassal] FOREIGN KEY ( [No_SPM] ) REFERENCES [PerintahProduksiMassal] ( [No_SPM] ) ON UPDATE CASCADE , CONSTRAINT [FK_HasilProduksi_PerintahProduksiPesanan] FOREIGN KEY ( [No_SPK] ) REFERENCES [PerintahProduksiPesanan] ( [No_SPK] ) ON UPDATE CASCADE
ALTER TABLE [PengeluaranBahanBaku] ADD
L 30 CONSTRAINT [FK_PengeluaranBahanBaku_Karyawan] FOREIGN KEY ( [NIK] ) REFERENCES [Karyawan] ( [NIK] ), CONSTRAINT
[FK_PengeluaranBahanBaku_PerintahProduksiMassal]
FOREIGN KEY ( [No_SPM] ) REFERENCES [PerintahProduksiMassal] ( [No_SPM] ) ON UPDATE CASCADE , CONSTRAINT
[FK_PengeluaranBahanBaku_PerintahProduksiPesanan]
FOREIGN KEY ( [No_SPK] ) REFERENCES [PerintahProduksiPesanan] ( [No_SPK] ) ON UPDATE CASCADE
alter
table
[PengeluaranBahanBaku]
nocheck
constraint
[FK_PengeluaranBahanBaku_Karyawan]
ALTER TABLE [PengirimanPenjualan] ADD CONSTRAINT [FK_PengirimanPenjualan_Karyawan] FOREIGN KEY ( [NIK] ) REFERENCES [Karyawan] ( [NIK] ), CONSTRAINT [FK_PengirimanPenjualan_PembayaranPenjualan] FOREIGN KEY ( [No_Pemb] ) REFERENCES [PembayaranPenjualan] (
L 31 [No_Pemb] ) ON UPDATE CASCADE
alter
table
[PengirimanPenjualan]
nocheck
constraint
[FK_PengirimanPenjualan_Karyawan]
ALTER TABLE [SPKBB] ADD CONSTRAINT [FK_SPKBB_BahanBaku] FOREIGN KEY ( [Kd_BB] ) REFERENCES [BahanBaku] ( [Kd_BB] ) ON UPDATE CASCADE , CONSTRAINT [FK_SPKBB_PerintahProduksiPesanan] FOREIGN KEY ( [No_SPK] ) REFERENCES [PerintahProduksiPesanan] ( [No_SPK] ) ON UPDATE CASCADE
ALTER TABLE [SPKBJ] ADD CONSTRAINT [FK_SPKBJ_BarangJadi] FOREIGN KEY ( [Kd_BJ] ) REFERENCES [BarangJadi] ( [Kd_BJ] ) ON UPDATE CASCADE , CONSTRAINT [FK_SPKBJ_PerintahProduksiPesanan] FOREIGN KEY ( [No_SPK] ) REFERENCES [PerintahProduksiPesanan] ( [No_SPK] ) ON UPDATE CASCADE
L 32 ALTER TABLE [KeluarBB] ADD CONSTRAINT [FK_KeluarBB_BahanBaku] FOREIGN KEY ( [Kd_BB] ) REFERENCES [BahanBaku] ( [Kd_BB] ) ON UPDATE CASCADE , CONSTRAINT [FK_KeluarBB_PengeluaranBahanBaku] FOREIGN KEY ( [No_KeluarBB] ) REFERENCES [PengeluaranBahanBaku] ( [No_KeluarBB] ) ON UPDATE CASCADE
ALTER TABLE [PenerimaanWaste] ADD CONSTRAINT [FK_PenerimaanWaste_BahanBaku] FOREIGN KEY ( [Kd_BB] ) REFERENCES [BahanBaku] ( [Kd_BB] ) ON UPDATE CASCADE , CONSTRAINT [FK_PenerimaanWaste_HasilProduksi] FOREIGN KEY ( [No_HP] ) REFERENCES [HasilProduksi] ( [No_HP] ) ON UPDATE CASCADE
ALTER TABLE [PengeluaranBBProduksi] ADD CONSTRAINT [FK_PengeluaranBBProduksi_Karyawan] FOREIGN KEY ( [NIK] ) REFERENCES [Karyawan] ( [NIK] ),
L 33 CONSTRAINT
[FK_PengeluaranBBProduksi_PengeluaranBahanBaku]
FOREIGN KEY ( [No_KeluarBB] ) REFERENCES [PengeluaranBahanBaku] ( [No_KeluarBB] ) ON UPDATE CASCADE
alter
table
[PengeluaranBBProduksi]
nocheck
constraint
[FK_PengeluaranBBProduksi_Karyawan]
ALTER TABLE [PengeluaranBJ] ADD CONSTRAINT [FK_PengeluaranBJ_BarangJadi] FOREIGN KEY ( [Kd_BJ] ) REFERENCES [BarangJadi] ( [Kd_BJ] ) ON UPDATE CASCADE , CONSTRAINT [FK_PengeluaranBJ_PengirimanPenjualan] FOREIGN KEY ( [No_Krm] ) REFERENCES [PengirimanPenjualan] ( [No_Krm] ) ON UPDATE CASCADE
ALTER TABLE [PengembalianPenjualan] ADD CONSTRAINT [FK_PengembalianPenjualan_Karyawan] FOREIGN KEY ( [NIK] ) REFERENCES [Karyawan] ( [NIK] ), CONSTRAINT [FK_PengembalianPenjualan_PengirimanPenjualan] FOREIGN KEY ( [No_Krm]
L 34 ) REFERENCES [PengirimanPenjualan] ( [No_Krm] ) ON UPDATE CASCADE
alter
table
[PengembalianPenjualan]
nocheck
constraint
[FK_PengembalianPenjualan_Karyawan] ALTER TABLE [TerimaBJProduksi] ADD CONSTRAINT [FK_TerimaBJProduksi_BarangJadi] FOREIGN KEY ( [Kd_BJ] ) REFERENCES [BarangJadi] ( [Kd_BJ] ) ON UPDATE CASCADE , CONSTRAINT [FK_TerimaBJProduksi_HasilProduksi] FOREIGN KEY ( [No_HP] ) REFERENCES [HasilProduksi] ( [No_HP] ) ON UPDATE CASCADE
ALTER TABLE [KeluarBBProduksi] ADD CONSTRAINT [FK_KeluarBBProduksi_BahanBaku] FOREIGN KEY ( [Kd_BB] ) REFERENCES [BahanBaku] ( [Kd_BB] ) ON UPDATE CASCADE , CONSTRAINT [FK_KeluarBBProduksi_BarangJadi] FOREIGN KEY ( [Kd_BJ] ) REFERENCES [BarangJadi] ( [Kd_BJ] ) ON UPDATE CASCADE , CONSTRAINT [FK_KeluarBBProduksi_PengeluaranBBProduksi] FOREIGN KEY
L 35 ( [No_Pakai] ) REFERENCES [PengeluaranBBProduksi] ( [No_Pakai] ) ON UPDATE CASCADE ALTER TABLE [ReturBJ] ADD CONSTRAINT [FK_ReturBJ_BarangJadi] FOREIGN KEY ( [Kd_BJ] ) REFERENCES [BarangJadi] ( [Kd_BJ] ) ON UPDATE CASCADE , CONSTRAINT [FK_ReturBJ_PengembalianPenjualan] FOREIGN KEY ( [No_Retur] ) REFERENCES [PengembalianPenjualan] ( [No_Retur] ) ON UPDATE CASCADE
/****** Object: Stored Procedure Auto_Number_Kd_Plg ******/ create proc Auto_Number_Kd_Plg as select cast((max(cast (Kd_Plg as int)) + 1) as char (8)) from Pelanggan
/****** Object: Stored Procedure Auto_Number_NIK ******/ create proc Auto_Number_NIK as select cast((max(cast (NIK as int)) + 1) as char (6)) from Karyawan
/****** Object: Stored Procedure Cari_Data_BB_Berdasarkan_Kd_BB ******/ create proc Cari_Data_BB_Berdasarkan_Kd_BB @kd char (5) as select
Kd_BB,
Nama_BB,
Satuan_BB,
Harga_BB,
Saldo_GudBB,
Saldo_ProdBB, Saldo_Waste, Reorder_BB from BahanBaku where Kd_BB = @kd /****** Object: Stored Procedure Cari_Data_BB_Berdasarkan_Nama_BB ******/ create proc Cari_Data_BB_Berdasarkan_Nama_BB @nama varchar (40) as
L 36 select
Kd_BB,
Nama_BB,
Satuan_BB,
Harga_BB,
Saldo_GudBB,
Saldo_ProdBB, Saldo_Waste, Reorder_BB from BahanBaku where Nama_BB = @nama
/****** Object: Stored Procedure Cari_Data_Karyawan_Berdasarkan_NIK ******/ create proc Cari_Data_Karyawan_Berdasarkan_NIK @nik char (6) as select NIK, Nama, Jenis_Kelamin, Alamat, No_Telp, No_Handphone, Username, Psswrd, Jabatan, Bagian from Karyawan where NIK = @nik
/****** Object: Stored Procedure Cari_Data_Karyawan_Berdasarkan_nama ******/ create proc Cari_Data_Karyawan_Berdasarkan_nama @nama varchar (40) as select NIK, Nama, Jenis_Kelamin, Alamat, No_Telp, No_Handphone, Username, Psswrd, Jabatan, Bagian from Karyawan where Nama = @nama
/****** Object: Stored Procedure Cari_Data_Pelanggan_Berdasarkan_Kd_Plg ******/ create proc Cari_Data_Pelanggan_Berdasarkan_Kd_Plg @kd char (8) as select Kd_Plg, Nama_Plg, Alamat_Plg, Telp_Plg, Fax_Plg from Pelanggan where Kd_Plg = @kd
/****** Object:
Stored Procedure Cari_Data_Pelanggan_Berdasarkan_Nama_Plg
******/ create proc Cari_Data_Pelanggan_Berdasarkan_Nama_Plg @nama varchar (40) as select Kd_Plg, Nama_Plg, Alamat_Plg, Telp_Plg, Fax_Plg from Pelanggan where Nama_Plg = @nama
/****** Object: Stored Procedure Hapus_Data_Karyawan ******/ create proc Hapus_Data_Karyawan @nik char (6) as delete from Karyawan where NIK = @nik
L 37 /****** Object: Stored Procedure Hapus_Data_Pelanggan ******/ create proc Hapus_Data_Pelanggan @kd char (8) as delete from Pelanggan where Kd_Plg = @kd
/****** Object: Stored Procedure Input_Data_Karyawan ******/ create proc Input_Data_Karyawan @nik char (6), @nama varchar (40), @jk char (1), @alamat varchar (100), @telp varchar (12), @hp varchar (12), @username varchar (10), @psswrd char (6), @jabatan varchar (20), @bagian varchar (15) as insert into Karyawan values (@nik, @nama, @jk, @alamat, @telp, @hp, @username, @psswrd, @jabatan, @bagian)
/****** Object: Stored Procedure Input_Data_Pelanggan ******/ create proc Input_Data_Pelanggan @kd char (8), @nama varchar (40), @alamat varchar (100), @telp varchar (12), @fax varchar (12) as insert into Pelanggan values (@kd, @nama, @alamat, @telp, @fax)
/****** Object: Stored Procedure Login ******/ create proc Login @username varchar (10), @psswrd char (6) as select (NIK) from Karyawan where Username = @username and Psswrd = @psswrd
/****** Object: Stored Procedure Tampil_Data_BB ******/ create proc Tampil_Data_BB as select
Kd_BB,
Nama_BB,
Satuan_BB,
Harga_BB,
Saldo_GudBB,
Saldo_ProdBB, Saldo_Waste, Reorder_BB from BahanBaku
/****** Object: Stored Procedure Tampil_Data_Karyawan ******/ create proc Tampil_Data_Karyawan as select NIK, Nama, Jenis_Kelamin, Alamat, No_Telp, No_Handphone,
L 38 Username, Psswrd, Jabatan, Bagian from Karyawan
/****** Object: Stored Procedure Tampil_Data_Pelanggan ******/ create proc Tampil_Data_Pelanggan as select Kd_Plg, Nama_Plg, Alamat_Plg, Telp_Plg, Fax_Plg from Pelanggan
/****** Object: Stored Procedure Update_Data_Karyawan ******/ create proc Update_Data_Karyawan @nik char (6), @nama varchar (40), @jk char (1), @alamat varchar (100), @telp varchar (12), @hp varchar (12), @username varchar (10), @psswrd char (6), @jabatan varchar (20), @bagian varchar (15) as update Karyawan set Nama = @nama, Jenis_Kelamin = @jk, Alamat = @alamat, No_Telp = @telp, No_Handphone = @hp, Username = @username, Psswrd = @psswrd, Jabatan = @jabatan, Bagian = @bagian where NIK = @nik
/****** Object: Stored Procedure Update_Data_Pelanggan ******/ create proc Update_Data_Pelanggan @kd char (8), @nama varchar (40), @alamat varchar (100), @telp varchar (12), @fax varchar (12) as update Pelanggan set Nama_Plg = @nama, Alamat_Plg = @alamat, Telp_Plg = @telp, Fax_Plg = @fax where Kd_Plg = @kd
/****** Object: Stored Procedure Cari_Data_BJ_Berdasarkan_Kd_BJ ******/ create proc Cari_Data_BJ_Berdasarkan_Kd_BJ @kd char (5) as select Kd_BJ, Nama_BJ, Satuan_BJ, HPP, Harga_Jual, Saldo_GudBJ, Saldo_ProdBJ, Reorder_BJ,
L 39 b.Kd_Jns, j.Nama_Jns from BarangJadi b, JenisBarangJadi j where b.Kd_Jns = j.Kd_Jns and b.Kd_BJ = @kd
/****** Object: Stored Procedure Cari_Data_BJ_Berdasarkan_Kd_Jns ******/ create proc Cari_Data_BJ_Berdasarkan_Kd_Jns @kd varchar (20) as select Kd_BJ, Nama_BJ, Satuan_BJ, HPP, Harga_Jual, Saldo_GudBJ, Saldo_ProdBJ, Reorder_BJ, b.Kd_Jns, j.Nama_Jns from BarangJadi b, JenisBarangJadi j where b.Kd_Jns = j.Kd_Jns and j.Kd_Jns = @kd
/****** Object: Stored Procedure Cari_Data_BJ_Berdasarkan_Nama_BJ ******/ create proc Cari_Data_BJ_Berdasarkan_Nama_BJ @nama varchar (20) as select Kd_BJ, Nama_BJ, Satuan_BJ, HPP, Harga_Jual, Saldo_GudBJ, Saldo_ProdBJ, Reorder_BJ, b.Kd_Jns, j.Nama_Jns from BarangJadi b, JenisBarangJadi j where b.Kd_Jns = j.Kd_Jns and Nama_BJ = @nama
/****** Object: Stored Procedure Cari_Telepon_Pelanggan ******/ create proc Cari_Telepon_Pelanggan @kd char (8) as select Telp_Plg from TeleponPelanggan where Kd_Plg = @kd
/****** Object: Stored Procedure Cek_Telepon_Pelanggan ******/ create proc Cek_Telepon_Pelanggan @kd char (8) as select Telp_Plg from TeleponPelanggan where Kd_Plg = @kd
/****** Object: Stored Procedure Hapus_Telepon_Pelanggan ******/ create proc Hapus_Telepon_Pelanggan @kd char (8) as delete from TeleponPelanggan where Kd_Plg = @kd
L 40
/****** Object: Stored Procedure Hapus_Telepon_Pelanggan_yang_Kosong ******/ create proc Hapus_Telepon_Pelanggan_yang_Kosong @telp varchar (12), @kd char (8) as delete from TeleponPelanggan where Kd_Plg = @kd and Telp_Plg = @telp
/****** Object: Stored Procedure Input_Telepon_Pelanggan ******/ create proc Input_Telepon_Pelanggan @telp varchar (12), @kd char (8) as insert into TeleponPelanggan values (@telp, @kd) /****** Object: Stored Procedure Laporan_Pemesanan_Penjualan ******/ create proc Laporan_Pemesanan_Penjualan as select No_Pesan, Tgl_Pesan, Pemesan, Total_Pesan, j.Kd_Plg, Nama_Plg from PemesananPenjualan j, Pelanggan p where j.Kd_Plg = p.Kd_Plg
/****** Object: Stored Procedure Tampil_Data_BJ ******/ create proc Tampil_Data_BJ as select Kd_BJ, Nama_BJ, Satuan_BJ, HPP, Harga_Jual, Saldo_GudBJ, Saldo_ProdBJ, Reorder_BJ, b.Kd_Jns, j.Nama_Jns from BarangJadi b, JenisBarangJadi j where b.Kd_Jns = j.Kd_Jns
/****** Object: Stored Procedure Tampil_Data_Pengeluaran_Waste ******/ create proc Tampil_Data_Pengeluaran_Waste as select No_WO, Tgl_WO, Ket_WO, NIK from PengeluaranWaste
/****** Object: Stored Procedure Tampil_Data_Perintah_Produksi_Massal ******/ create proc Tampil_Data_Perintah_Produksi_Massal as select
No_SPM,
Tgl_SPM,
Tgl_ProdSPM,
Tgl_SlsSPM,
NIK
PerintahProduksiMassal
/****** Object: Stored Procedure Tampil_Telepon_Pelanggan ******/ create proc Tampil_Telepon_Pelanggan @telp varchar (12), @kd char (8) as
from
L 41 select Telp_Plg from TeleponPelanggan where Kd_Plg = @kd and Telp_Plg = @telp /****** Object: Stored Procedure Update_Telepon_Pelanggan ******/ create proc Update_Telepon_Pelanggan @telp varchar (12), @kd char (8), @temp varchar (12) as update TeleponPelanggan set Telp_Plg = @telp where Kd_Plg = @kd and Telp_Plg = @temp
/****** Object: Stored Procedure Tampil_Data_Pemesanan_Penjualan ******/ create proc Tampil_Data_Pemesanan_Penjualan as select pp.No_Pesan, Tgl_Pesan, Pemesan, Total_Pesan, Kd_Plg, NIK, Kd_BJ, Jml_BJ, Harga_Sat from PemesananPenjualan pp, PesanBJ pb where pp.No_Pesan = pb.No_Pesan
/****** Object: Stored Procedure Tampil_Data_Pembayaran_Penjualan ******/ create proc Tampil_Data_Pembayaran_Penjualan as select
No_Pemb,
Tgl_Pemb,
Total_Pemb,
No_Penj,
NIK
from
PembayaranPenjualan
/****** Object: Stored Procedure Tampil_Data_Penjualan ******/ create proc Tampil_Data_Penjualan as select j.No_Penj, Tgl_Penj, Nama_proyek, Tgl_Kirim, Alamat_Kirim, Penerima, Total_penj, No_Pesan, NIK, Kd_BJ, Harga_Sat from Penjualan j, JualBJ jb where j.No_Penj = jb.No_Penj
/****** Object: Stored Procedure Tampil_Data_Perintah_Produksi_Pesanan ******/ create proc Tampil_Data_Perintah_Produksi_Pesanan as select No_SPK, Tgl_SPK, Tgl_ProdSPK, Tgl_SlsSPK, No_Penj, NIK from PerintahProduksiPesanan
L 42
/****** Object: Stored Procedure Tampil_Data_Hasil_Produksi ******/ create proc Tampil_Data_Hasil_Produksi as select No_HP, Tgl_HP, No_SPK, No_SPM from HasilProduksi
/****** Object: Stored Procedure Tampil_Data_Penerimaan_Waste ******/ create proc Tampil_Data_Penerimaan_Waste as select No_HP, Kd_BB, Jml_BB from PenerimaanWaste
/****** Object: Stored Procedure Tampil_Data_Pengeluaran_BB ******/ create proc Tampil_Data_Pengeluaran_BB as select p.No_KeluarBB, Tgl_KeluarBB, No_SPK, No_SPM, NIK, Kd_BB, Jml_BBKel, Jml_BBMsk, Kg_BB, Ukuran from PengeluaranBahanBaku p, KeluarBB k where p.No_KeluarBB = k.No_KeluarBB
/****** Object: Stored Procedure Tampil_Data_Pengiriman_Penjualan ******/ create proc Tampil_Data_Pengiriman_Penjualan as select krm.No_Krm, Tgl_Krm, No_Pemb, NIK, Kd_BJ, Jml_BJ from PengirimanPenjualan krm, PengeluaranBJ pb where krm.No_Krm = pb.No_Krm
/****** Object: Stored Procedure Tampil_Data_Pengeluaran_BB_Produksi ******/ create proc Tampil_Data_Pengeluaran_BB_Produksi as select p.No_Pakai, Tgl_Pakai, No_KeluarBB, NIK, Kd_BB, Kd_BJ, Jml_BB, Kg_BB, Ukuran from PengeluaranBBProduksi p, KeluarBBProduksi k where p.No_Pakai = k.No_Pakai
L 43 /****** Object: Stored Procedure Tampil_Data_Pengembalian_Penjualan ******/ create proc Tampil_Data_Pengembalian_Penjualan as select kembali.No_Retur, Tgl_Retur, No_Krm, NIK, Kd_BJ, Jml_BJ, Harga_Sat from PengembalianPenjualan kembali, ReturBJ retur where kembali.No_Retur = retur.No_Retur
L 44 Rancangan Layar
Gambar 1 Rancangan Layar Form Login
L 45
Gambar 2 Rancangan Layar Form Menu Utama
L 46
Gambar 3 Rancangan Layar Form Master Karyawan
L 47
Gambar 4 Rancangan Layar Form Master Pelanggan
L 48
Gambar 5 Rancangan Layar Form Master Bahan Baku
L 49
Gambar 6 Rancangan Layar Form Master Barang Jadi
L 50
Gambar 7 Rancangan Layar Form Transaksi Pemesanan Penjualan
L 51
Gambar 8 Rancangan Layar Form Transaksi Penjualan
L 52
Gambar 9 Rancangan Layar Form Transaksi Pembayaran Penjualan
L 53
Gambar 10 Rancangan Layar Form Transaksi Pengiriman Penjualan
L 54
Gambar 11 Rancangan Layar Form Transaksi Retur Penjualan
L 55
Gambar 12 Rancangan Layar Form Transaksi Perintah Produksi Pesanan
L 56
Gambar 13 Rancangan Layar Form Transaksi Perintah Produksi Massal
L 57
Gambar 14 Rancangan Layar Form Transaksi Pengeluaran Bahan Baku
L 58
Gambar 15 Rancangan Layar Form Transaksi Pengeluaran Bahan Baku Produksi
L 59
Gambar 16 Rancangan Layar Form Transaksi Hasil Produksi
L 60
Gambar 17 Rancangan Layar Form Transaksi Pengeluaran Waste
L 61
Gambar 18 Rancangan Layar Laporan Data Karyawan
Gambar 19 Rancangan Layar Laporan Data Pelanggan
Gambar 20 Rancangan Layar Laporan Data Bahan Baku
L 62
Gambar 21 Rancangan Layar Laporan Data Barang Jadi
L 63
Gambar 22 Rancangan Layar Form Laporan Transaksi Pemesanan Penjualan
Gambar 23 Rancangan Layar Laporan Transaksi Pemesanan Penjualan
L 64
Gambar 24 Rancangan Layar Form Laporan Transaksi Penjualan
Gambar 25 Rancangan Layar Laporan Transaksi Penjualan
L 65
Gambar 26 Rancangan Layar Form Laporan Transaksi Pengiriman Penjualan
Gambar 27 Rancangan Layar Laporan Transaksi Pengiriman Penjualan
L 66
Gambar 28 Rancangan Layar Form Laporan Transaksi Perintah Produksi Pesanan
Gambar 29 Rancangan Layar Laporan Transaksi Perintah Produksi Pesanan
L 67
Gambar 30 Rancangan Layar Form Laporan Transaksi Perintah Produksi Massal
Gambar 31 Rancangan Layar Laporan Transaksi Perintah Produksi Massal
L 68
Gambar 32 Rancangan Layar Form Laporan Transaksi Pengeluaran Bahan Baku
Gambar 33 Rancangan Layar Laporan Transaksi Pengeluaran Bahan Baku
L 69
Gambar 34 Rancangan Layar Form Laporan Transaksi Hasil Produksi
Gambar 35 Rancangan Layar Laporan Transaksi Hasil Produksi
L 70
Gambar 36 Rancangan Layar Form Laporan Transaksi Penerimaan Waste
Gambar 37 Rancangan Layar Laporan Transaksi Penerimaan Waste