-- http://www.phpmyadmin.net
--




--
-- Database: `rchcargodb`
--

-- --------------------------------------------------------

--
-- Table structure for table `t_booking`
--

CREATE TABLE IF NOT EXISTS `t_booking` (
  `id_booking` varchar(23) NOT NULL,
  `tgl_b` date NOT NULL,
  `nama_pengirim_b` varchar(25) NOT NULL,
  `alamat_pengirim_b` text NOT NULL,
  `no_hp_pengirim` varchar(25) NOT NULL,
  `id_kota_pengirim` int(10) NOT NULL,
  `id_tarif` int(5) NOT NULL,
  `totber` int(5) NOT NULL,
  `nama_penerima_b` varchar(25) NOT NULL,
  `alamat_penerima_b` text NOT NULL,
  `no_hp_penerima` varchar(25) NOT NULL,
  `kode_kota_penerima` varchar(4) NOT NULL,
  `total_biaya` int(15) NOT NULL,
  `kd_counter` char(6) NOT NULL,
  PRIMARY KEY (`id_booking`),
  KEY `id_booking` (`id_booking`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `t_booking`
--

INSERT INTO `t_booking` (`id_booking`, `tgl_b`, `nama_pengirim_b`, `alamat_pengirim_b`, `no_hp_pengirim`, `id_kota_pengirim`, `id_tarif`, `totber`, `nama_penerima_b`, `alamat_penerima_b`, `no_hp_penerima`, `kode_kota_penerima`, `total_biaya`, `kd_counter`) VALUES
('RCHESRQ080805252', '2017-08-08', '2', '2', '2', 0, 2, 113, '2', '2', '2', 'MDN', 605000, 'ESR');

-- --------------------------------------------------------

--
-- Table structure for table `t_data_booking`
--

CREATE TABLE IF NOT EXISTS `t_data_booking` (
  `id_data_booking` int(10) NOT NULL AUTO_INCREMENT,
  `id_booking` char(25) NOT NULL,
  `tgl_b` date NOT NULL,
  `id_tarif` int(11) NOT NULL,
  `nama_pengirim` varchar(25) NOT NULL,
  `alamat_pengirim` text NOT NULL,
  `no_hp_pengirim` varchar(25) NOT NULL,
  `id_kota_asal` char(10) NOT NULL,
  `nama_penerima` varchar(25) NOT NULL,
  `kode_kota_penerima` varchar(25) NOT NULL,
  `alamat_penerima` text NOT NULL,
  `no_hp_penerima` varchar(25) NOT NULL,
  PRIMARY KEY (`id_data_booking`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Dumping data for table `t_data_booking`
--


-- --------------------------------------------------------

--
-- Table structure for table `t_data_stkb`
--

CREATE TABLE IF NOT EXISTS `t_data_stkb` (
  `id_stkb` varchar(25) NOT NULL,
  `no_stkb` int(10) NOT NULL AUTO_INCREMENT,
  `id_counter` varchar(25) NOT NULL,
  `nama_pengirim` varchar(25) NOT NULL,
  `no_hp_pengirim` varchar(25) NOT NULL,
  `alamat_pengirim` text NOT NULL,
  `id_kota_asal` int(4) NOT NULL,
  `nama_penerima` varchar(25) NOT NULL,
  `alamat_penerima` text NOT NULL,
  `kode_kota_penerima` varchar(5) NOT NULL,
  `grand_total_biaya` int(25) NOT NULL,
  `tgl_stkb` date NOT NULL,
  `status` int(20) NOT NULL,
  `no_hp_penerima` varchar(15) NOT NULL,
  `id_tarif` int(11) NOT NULL,
  PRIMARY KEY (`no_stkb`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Dumping data for table `t_data_stkb`
--


-- --------------------------------------------------------

--
-- Table structure for table `t_detail_booking`
--

CREATE TABLE IF NOT EXISTS `t_detail_booking` (
  `id_b` int(11) NOT NULL AUTO_INCREMENT,
  `id_booking` char(16) NOT NULL,
  `jml_b` int(5) NOT NULL,
  `satuan_b` varchar(15) NOT NULL,
  `isi_barang` text NOT NULL,
  `p` int(5) NOT NULL,
  `l` int(5) NOT NULL,
  `t` int(5) NOT NULL,
  `berat` int(10) NOT NULL,
  `tarif` int(15) NOT NULL,
  `subtotal` int(15) NOT NULL,
  PRIMARY KEY (`id_b`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Dumping data for table `t_detail_booking`
--

INSERT INTO `t_detail_booking` (`id_b`, `id_booking`, `jml_b`, `satuan_b`, `isi_barang`, `p`, `l`, `t`, `berat`, `tarif`, `subtotal`) VALUES
(1, 'RCHESRQ080805252', 8, '8', '8', 8, 8, 8, 8, 0, 0),
(2, 'RCHESRQ080805252', 7, '7', '7', 7, 7, 7, 7, 0, 0);

-- --------------------------------------------------------

--
-- Table structure for table `t_detail_stkb`
--

CREATE TABLE IF NOT EXISTS `t_detail_stkb` (
  `id_s` int(11) NOT NULL AUTO_INCREMENT,
  `id_stkb` varchar(25) NOT NULL,
  `no_collye` varchar(25) NOT NULL,
  `isi_barang` text NOT NULL,
  `satuan_b` varchar(15) NOT NULL,
  `jml_b` int(6) NOT NULL,
  `berat_aktual` int(15) NOT NULL,
  `p` int(15) NOT NULL,
  `l` int(15) NOT NULL,
  `t` int(15) NOT NULL,
  `vol` int(15) NOT NULL,
  `berat` int(5) NOT NULL,
  `id_tarif` int(15) NOT NULL,
  `tarif` int(15) NOT NULL,
  `subtotal` int(15) NOT NULL,
  `biaya_packing` int(15) NOT NULL,
  `total_biaya` int(15) NOT NULL,
  PRIMARY KEY (`id_s`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

--
-- Dumping data for table `t_detail_stkb`
--

INSERT INTO `t_detail_stkb` (`id_s`, `id_stkb`, `no_collye`, `isi_barang`, `satuan_b`, `jml_b`, `berat_aktual`, `p`, `l`, `t`, `vol`, `berat`, `id_tarif`, `tarif`, `subtotal`, `biaya_packing`, `total_biaya`) VALUES
(2, 'RCHESRO080805272', '', '9', '9', 9, 0, 9, 9, 9, 0, 9, 0, 0, 0, 0, 0),
(3, 'RCHESRO080805272', '', '8', '8', 8, 0, 8, 8, 8, 0, 8, 0, 0, 0, 0, 0),
(4, 'RCHASTX081609200', '', '9', '9', 9, 0, 9, 9, 9, 0, 9, 0, 0, 0, 0, 0);

-- --------------------------------------------------------

--
-- Table structure for table `t_hasil_komisi`
--

CREATE TABLE IF NOT EXISTS `t_hasil_komisi` (
  `id_hasil` char(10) NOT NULL,
  `kode_layanan` varchar(5) NOT NULL,
  `id_stkb` char(20) NOT NULL,
  `h_sales` int(10) NOT NULL,
  `h_pc` int(10) NOT NULL,
  `h_phu` int(10) NOT NULL,
  `adm_sales` int(10) NOT NULL,
  `adm_pc` int(10) NOT NULL,
  `adm_phu` int(10) NOT NULL,
  `kd_h_pc` char(12) NOT NULL,
  `kd_h_sales` char(12) NOT NULL,
  `kd_h_phu` char(12) NOT NULL,
  `hasil` int(10) NOT NULL,
  `jumber` int(7) NOT NULL,
  `id_status` char(3) NOT NULL,
  `status` enum('terhitung','terbayar','tidak') NOT NULL,
  PRIMARY KEY (`id_hasil`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `t_hasil_komisi`
--

INSERT INTO `t_hasil_komisi` (`id_hasil`, `kode_layanan`, `id_stkb`, `h_sales`, `h_pc`, `h_phu`, `adm_sales`, `adm_pc`, `adm_phu`, `kd_h_pc`, `kd_h_sales`, `kd_h_phu`, `hasil`, `jumber`, `id_status`, `status`) VALUES
('H000000001', 'ASEX', 'RCHESRQ080805252', 56500, 56500, 28250, 1000, 1000, 250, '', 'ESR', '', 0, 113, '1', 'terhitung'),
('H000000002', 'ASEX', 'RCHESRO080805272', 72500, 72500, 36250, 1000, 1000, 250, 'ESR', '', '', 0, 145, '2', 'terhitung'),
('H000000003', 'ASEX', 'RCHASTX081609200', 40500, 40500, 20250, 1000, 1000, 250, 'AST', 'AST', '', 0, 81, '2', 'terhitung');

-- --------------------------------------------------------

--
-- Table structure for table `t_kota`
--

CREATE TABLE IF NOT EXISTS `t_kota` (
  `id_kota` int(2) NOT NULL AUTO_INCREMENT,
  `kode_prov` char(3) NOT NULL,
  `kode_kota` char(3) NOT NULL,
  `nama_kota` varchar(25) NOT NULL,
  PRIMARY KEY (`id_kota`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=29 ;

--
-- Dumping data for table `t_kota`
--

INSERT INTO `t_kota` (`id_kota`, `kode_prov`, `kode_kota`, `nama_kota`) VALUES
(23, 'DKI', 'CKG', 'Cengkareng'),
(24, 'SMB', 'PDG', 'Padang'),
(25, 'SMS', 'PLB', 'Palembang'),
(26, 'SMU', 'MDN', 'Medan'),
(27, 'SMU', 'SDB', 'Silanngit'),
(28, 'SMU', 'KNO', 'Kualanamu');

-- --------------------------------------------------------

--
-- Table structure for table `t_layanan`
--

CREATE TABLE IF NOT EXISTS `t_layanan` (
  `id_layanan` int(3) NOT NULL AUTO_INCREMENT,
  `kode_layanan` char(4) NOT NULL,
  `nama_layanan` varchar(30) NOT NULL,
  `tipe_layanan` int(3) NOT NULL,
  `jalur_layanan` char(25) NOT NULL,
  `adm_sales` int(10) NOT NULL,
  `h_sales` int(10) NOT NULL,
  `adm_pc` int(10) NOT NULL,
  `h_pc` int(10) NOT NULL,
  `adm_phu` int(10) NOT NULL,
  `h_phu` int(10) NOT NULL,
  `keterangan` text NOT NULL,
  PRIMARY KEY (`id_layanan`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=18 ;

--
-- Dumping data for table `t_layanan`
--

INSERT INTO `t_layanan` (`id_layanan`, `kode_layanan`, `nama_layanan`, `tipe_layanan`, `jalur_layanan`, `adm_sales`, `h_sales`, `adm_pc`, `h_pc`, `adm_phu`, `h_phu`, `keterangan`) VALUES
(2, 'OFDD', 'OFS - Door To Door', 1, '1', 10000, 750, 7500, 0, 2500, 250, 'sales'),
(5, 'ASPP', 'ASTON - Port To Port', 2, '2', 1000, 750, 7500, 0, 2500, 250, 'sales'),
(8, 'OFPP', 'OFS - Port To Port', 1, '2', 10000, 750, 7500, 1000, 2500, 250, 'sales'),
(11, 'LTEX', 'LTS - Express', 3, '3', 1000, 750, 1750, 1000, 250, 250, 'sales'),
(14, 'ASEX', 'OFS - Express', 1, '3', 1000, 500, 1000, 500, 250, 250, 'sales'),
(17, 'ASEX', 'ASTON - Express', 2, '3', 500, 250, 750, 250, 0, 250, 'sales');

-- --------------------------------------------------------

--
-- Table structure for table `t_prov`
--

CREATE TABLE IF NOT EXISTS `t_prov` (
  `id_prov` int(2) NOT NULL AUTO_INCREMENT,
  `kode_prov` char(3) NOT NULL,
  `nama_prov` varchar(25) NOT NULL,
  PRIMARY KEY (`id_prov`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=26 ;

--
-- Dumping data for table `t_prov`
--

INSERT INTO `t_prov` (`id_prov`, `kode_prov`, `nama_prov`) VALUES
(17, 'SMS', 'Sumatera Selatan'),
(18, 'SMB', 'Sumatera Barat'),
(19, 'DKI', 'DKI Jakarta'),
(20, 'KLM', 'Kalimantan'),
(25, 'SMU', 'Sumatera Utara');

-- --------------------------------------------------------

--
-- Table structure for table `t_status_stkb`
--

CREATE TABLE IF NOT EXISTS `t_status_stkb` (
  `id_status` int(11) NOT NULL AUTO_INCREMENT,
  `status` varchar(50) NOT NULL,
  PRIMARY KEY (`id_status`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

--
-- Dumping data for table `t_status_stkb`
--

INSERT INTO `t_status_stkb` (`id_status`, `status`) VALUES
(1, 'booked by sales code'),
(2, 'issued by agent code'),
(3, 'ware housing'),
(4, 'arrived at city destination'),
(5, 'received by consigner');

-- --------------------------------------------------------

--
-- Table structure for table `t_stkb`
--

CREATE TABLE IF NOT EXISTS `t_stkb` (
  `id_stkb` varchar(25) NOT NULL,
  `no_stkb` int(10) NOT NULL,
  `kd_counter` varchar(25) NOT NULL,
  `kd_counter_issued` char(25) NOT NULL,
  `nama_pengirim` varchar(25) NOT NULL,
  `no_hp_pengirim` varchar(25) NOT NULL,
  `asuransi` int(10) NOT NULL,
  `b_pack` int(10) NOT NULL,
  `totber` int(5) NOT NULL,
  `alamat_pengirim` text NOT NULL,
  `id_kota_pengirim` int(4) NOT NULL,
  `nama_penerima` varchar(25) NOT NULL,
  `alamat_penerima` text NOT NULL,
  `kode_kota_penerima` varchar(5) NOT NULL,
  `id_tarif` int(3) NOT NULL,
  `adm` int(25) NOT NULL,
  `total` int(25) NOT NULL,
  `grand_total_biaya` int(25) NOT NULL,
  `tgl_stkb` date NOT NULL,
  `status` int(20) NOT NULL,
  `no_hp_penerima` varchar(15) NOT NULL,
  PRIMARY KEY (`id_stkb`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `t_stkb`
--

INSERT INTO `t_stkb` (`id_stkb`, `no_stkb`, `kd_counter`, `kd_counter_issued`, `nama_pengirim`, `no_hp_pengirim`, `asuransi`, `b_pack`, `totber`, `alamat_pengirim`, `id_kota_pengirim`, `nama_penerima`, `alamat_penerima`, `kode_kota_penerima`, `id_tarif`, `adm`, `total`, `grand_total_biaya`, `tgl_stkb`, `status`, `no_hp_penerima`) VALUES
('RCHASTX081609200', 0, 'AST', 'AST', '8', '8', 0, 90000, 81, '8', 0, '8', '8', 'MDN', 2, 40000, 405000, 535000, '2017-08-16', 0, '8'),
('RCHESRO080805272', 0, 'ESR', 'ESR', '8', '8', 0, 9000, 145, '8', 0, '8', '8', 'MDN', 2, 40000, 725000, 774000, '2017-08-08', 0, '8');

-- --------------------------------------------------------

--
-- Table structure for table `t_tarif`
--

CREATE TABLE IF NOT EXISTS `t_tarif` (
  `id_tarif` int(5) NOT NULL AUTO_INCREMENT,
  `kode_kota` char(3) NOT NULL,
  `kode_layanan` char(5) NOT NULL,
  `minberat` int(3) NOT NULL,
  `mincharge` int(15) NOT NULL,
  `kg_selanjutnya` int(15) NOT NULL,
  PRIMARY KEY (`id_tarif`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

--
-- Dumping data for table `t_tarif`
--

INSERT INTO `t_tarif` (`id_tarif`, `kode_kota`, `kode_layanan`, `minberat`, `mincharge`, `kg_selanjutnya`) VALUES
(1, 'MDN', 'OFDD', 10, 400000, 50000),
(2, 'MDN', 'ASEX', 10, 90000, 5000),
(3, 'PLB', 'LTEX', 5, 100000, 7000),
(4, 'PLB', 'ASPP', 8, 190000, 9000);

-- --------------------------------------------------------

--
-- Table structure for table `t_track`
--

CREATE TABLE IF NOT EXISTS `t_track` (
  `id_track` char(8) NOT NULL,
  `id_stkb` varchar(25) NOT NULL,
  `tgl_track` date NOT NULL,
  `jam_track` time NOT NULL,
  `tgl_booked` date NOT NULL,
  `tgl_issued` date NOT NULL,
  `tgl_ware` date NOT NULL,
  `tgl_arrived` date NOT NULL,
  `tgl_received` date NOT NULL,
  `jam_booked` time NOT NULL,
  `jam_issued` time NOT NULL,
  `jam_ware` time NOT NULL,
  `jam_arrived` time NOT NULL,
  `jam_received` time NOT NULL,
  `ket_track` text NOT NULL,
  `id_user` varchar(25) NOT NULL,
  `id_status` char(3) NOT NULL,
  `kd_counter` varchar(5) NOT NULL,
  `kd_counter_issued` varchar(5) NOT NULL,
  PRIMARY KEY (`id_track`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `t_track`
--

INSERT INTO `t_track` (`id_track`, `id_stkb`, `tgl_track`, `jam_track`, `tgl_booked`, `tgl_issued`, `tgl_ware`, `tgl_arrived`, `tgl_received`, `jam_booked`, `jam_issued`, `jam_ware`, `jam_arrived`, `jam_received`, `ket_track`, `id_user`, `id_status`, `kd_counter`, `kd_counter_issued`) VALUES
('T0000001', 'RCHESRQ080805252', '0000-00-00', '00:00:00', '2017-08-08', '0000-00-00', '0000-00-00', '0000-00-00', '0000-00-00', '12:26:36', '00:00:00', '00:00:00', '00:00:00', '00:00:00', '', '', '1', 'ESR', ''),
('T0000002', 'RCHESRO080805272', '0000-00-00', '00:00:00', '0000-00-00', '2017-08-08', '0000-00-00', '0000-00-00', '0000-00-00', '00:00:00', '17:30:06', '00:00:00', '00:00:00', '00:00:00', '', '', '2', '', 'ESR'),
('T0000003', 'RCHASTX081609200', '0000-00-00', '00:00:00', '0000-00-00', '2017-08-16', '0000-00-00', '0000-00-00', '0000-00-00', '00:00:00', '09:20:46', '00:00:00', '00:00:00', '00:00:00', '', '', '2', '', 'AST');
