
DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `BeforeEdit` BEFORE UPDATE ON `tm_barang_copy` FOR EACH ROW BEGIN
  
END */;;

DELIMITER ;

--
-- Table structure for table `tm_cabang`
--

CREATE TABLE `tm_cabang` (
  `cabang_id` varchar(2) NOT NULL,
  `nama_cabang` varchar(30) default NULL,
  PRIMARY KEY  (`cabang_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tm_cabang`
--


--
-- Table structure for table `tm_custkirim`
--

CREATE TABLE `tm_custkirim` (
  `KodeCust` varchar(10) NOT NULL default '',
  `ItemCust` int(11) NOT NULL default '0',
  `NamaKirim` varchar(50) default NULL,
  `AlamatKirim` varchar(200) default NULL,
  `KotaKirim` varchar(50) default NULL,
  `Aktif` varchar(1) default NULL,
  PRIMARY KEY  (`KodeCust`,`ItemCust`),
  CONSTRAINT `fk_TM_CustKirim` FOREIGN KEY (`KodeCust`) REFERENCES `tm_customer` (`KodeCust`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tm_custkirim`
--


--
-- Table structure for table `tm_customer`
--

CREATE TABLE `tm_customer` (
  `KodeCust` varchar(30) NOT NULL default '',
  `NamaCust` varchar(50) default NULL,
  `Editnama` varchar(1) default NULL,
  `Alamat` varchar(50) default NULL,
  `Kota` varchar(30) default NULL,
  `Telp` varchar(30) default NULL,
  `Fax` varchar(30) default NULL,
  `email` varchar(50) default NULL,
  `webpage` varchar(50) default NULL,
  `CustType` varchar(10) default NULL,
  `CreditLimit` double default NULL,
  `Defvalas` varchar(10) default NULL,
  `SyaratByr` int(11) default NULL,
  `Keterangan` varchar(100) default NULL,
  `Aktif` varchar(1) default NULL,
  `Piutang` double default NULL,
  `PiutAw` double default NULL,
  `TglPiutAwal` datetime default NULL,
  `AccPiut` varchar(20) default NULL,
  `AccPiutBG` varchar(20) default NULL,
  `AccPiutDB` varchar(20) default NULL,
  `AccPiutCR` varchar(20) default NULL,
  `AccPiutTitip` varchar(20) default NULL,
  `DefD1` double default NULL,
  `DefD2` double default NULL,
  `DefD3` double default NULL,
  `DefD4` double default NULL,
  `DefTamb` double default NULL,
  `DefKetTamb` varchar(50) default NULL,
  `FieldCust1` varchar(100) default NULL,
  `FieldCust2` varchar(100) default NULL,
  `FieldCust3` varchar(100) default NULL,
  `FieldCust4` varchar(100) default NULL,
  `FieldCust5` varchar(100) default NULL,
  `Point` decimal(15,0) default '0',
  `PointNon` decimal(15,0) default '0',
  `PointAwal` decimal(15,0) default '0',
  `PointAmbil` decimal(15,0) default '0',
  PRIMARY KEY  (`KodeCust`),
  KEY `fk_MCustomer1` (`AccPiut`),
  KEY `fk_MCustomer2` (`AccPiutBG`),
  KEY `fk_MCustomer3` (`AccPiutDB`),
  KEY `fk_MCustomer4` (`AccPiutCR`),
  KEY `fk_MCustomer5` (`AccPiutTitip`),
  CONSTRAINT `fk_MCustomer1` FOREIGN KEY (`AccPiut`) REFERENCES `mperkiraan` (`Kode_perk`),
  CONSTRAINT `fk_MCustomer2` FOREIGN KEY (`AccPiutBG`) REFERENCES `mperkiraan` (`Kode_perk`),
  CONSTRAINT `fk_MCustomer3` FOREIGN KEY (`AccPiutDB`) REFERENCES `mperkiraan` (`Kode_perk`),
  CONSTRAINT `fk_MCustomer4` FOREIGN KEY (`AccPiutCR`) REFERENCES `mperkiraan` (`Kode_perk`),
  CONSTRAINT `fk_MCustomer5` FOREIGN KEY (`AccPiutTitip`) REFERENCES `mperkiraan` (`Kode_perk`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tm_customer`
--

INSERT INTO `tm_customer` VALUES ('001','test','','','','','',NULL,NULL,'',NULL,NULL,NULL,'','Y',23210,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0','0','0','0');

--
-- Table structure for table `tm_golongan`
--

CREATE TABLE `tm_golongan` (
  `KodeGol` varchar(10) NOT NULL default '',
  `NamaGol` varchar(50) default NULL,
  `Keterangan` varchar(100) default NULL,
  `Aktif` varchar(1) default NULL,
  `DefAccExp` varchar(20) default NULL,
  `DefAccInv` varchar(20) default NULL,
  `DefAccSales` varchar(20) default NULL,
  `DefAccRetSales` varchar(20) default NULL,
  `DefAccRetPurc` varchar(20) default NULL,
  `DefAccCOGS` varchar(20) default NULL,
  PRIMARY KEY  (`KodeGol`),
  KEY `fk_MGolongan1` (`DefAccExp`),
  KEY `fk_MGolongan2` (`DefAccInv`),
  KEY `fk_MGolongan3` (`DefAccSales`),
  KEY `fk_MGolongan4` (`DefAccRetSales`),
  KEY `fk_MGolongan5` (`DefAccRetPurc`),
  KEY `fk_MGolongan6` (`DefAccCOGS`),
  CONSTRAINT `fk_MGolongan1` FOREIGN KEY (`DefAccExp`) REFERENCES `mperkiraan` (`Kode_perk`),
  CONSTRAINT `fk_MGolongan2` FOREIGN KEY (`DefAccInv`) REFERENCES `mperkiraan` (`Kode_perk`),
  CONSTRAINT `fk_MGolongan3` FOREIGN KEY (`DefAccSales`) REFERENCES `mperkiraan` (`Kode_perk`),
  CONSTRAINT `fk_MGolongan4` FOREIGN KEY (`DefAccRetSales`) REFERENCES `mperkiraan` (`Kode_perk`),
  CONSTRAINT `fk_MGolongan5` FOREIGN KEY (`DefAccRetPurc`) REFERENCES `mperkiraan` (`Kode_perk`),
  CONSTRAINT `fk_MGolongan6` FOREIGN KEY (`DefAccCOGS`) REFERENCES `mperkiraan` (`Kode_perk`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tm_golongan`
--

INSERT INTO `tm_golongan` VALUES ('001','Test','','Y',NULL,NULL,NULL,NULL,NULL,NULL);

--
-- Table structure for table `tm_gudang`
--

CREATE TABLE `tm_gudang` (
  `KodeGd` varchar(5) NOT NULL default '',
  `NamaGd` varchar(50) default NULL,
  `Keterangan` varchar(100) default NULL,
  `Aktif` varchar(1) default NULL,
  PRIMARY KEY  (`KodeGd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tm_gudang`
--

INSERT INTO `tm_gudang` VALUES ('GD','GUDANG','','Y');

--
-- Table structure for table `tm_mesin`
--

CREATE TABLE `tm_mesin` (
  `KodeMesin` varchar(15) NOT NULL,
  `NamaMesin` varchar(40) default NULL,
  `Tag` varchar(50) default NULL,
  `Keterangan` varchar(100) default NULL,
  PRIMARY KEY  (`KodeMesin`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tm_mesin`
--

INSERT INTO `tm_mesin` VALUES ('CAN01','Canon F',NULL,NULL),('X01','XEROX 01',NULL,NULL);

--
-- Table structure for table `tm_produk`
--

CREATE TABLE `tm_produk` (
  `PRODUK_ID` varchar(3) NOT NULL,
  `JNS_PRODUK` varchar(5) default NULL,
  `NAMA` varchar(75) default NULL,
  `NO_AKUN` varchar(20) default NULL,
  `SALDO_MIN` double default NULL,
  `SETOR_MIN` double default NULL,
  `BIAYA_ADM` double default NULL,
  `BIAYA_ADM_NO_AKUN` varchar(20) default NULL,
  `DENDA` double default NULL,
  `DENDA_NO_AKUN` varchar(20) default NULL,
  `BLN_HR_MGGU` varchar(1) default NULL,
  `BUNGA` double default NULL,
  `ADM` double default NULL,
  `BUNGA_NO_AKUN` varchar(20) default NULL,
  `TITIP_BUNGA_NO_AKUN` varchar(20) default NULL,
  `SALDO_KENA_PAJAK` double default NULL,
  `PAJAK` double default NULL,
  `PAJAK_NO_AKUN` varchar(20) default NULL,
  `PINALTY` double default NULL,
  `PINALTY_NO_AKUN` varchar(20) default NULL,
  `JW` int(11) default NULL,
  `PENUTUPAN_NO_AKUN` varchar(20) default NULL,
  PRIMARY KEY  (`PRODUK_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tm_produk`
--


--
-- Table structure for table `tm_rakitan_d`
--

CREATE TABLE `tm_rakitan_d` (
  `KodeRakitan` varchar(20) NOT NULL,
  `ItemRakitan` int(11) NOT NULL,
  `KodeBrg` varchar(20) default NULL,
  `NamaBrg` varchar(50) default NULL,
  `Satuan` varchar(10) default NULL,
  `KodeGd` varchar(5) default NULL,
  `Jml` double default NULL,
  `Harga` double default NULL,
  `Disc` double default NULL,
  PRIMARY KEY  (`KodeRakitan`,`ItemRakitan`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tm_rakitan_d`
--


--
-- Table structure for table `tm_rakitan_m`
--

CREATE TABLE `tm_rakitan_m` (
  `KodeRakitan` varchar(20) NOT NULL default '',
  `NamaRakitan` varchar(50) default NULL,
  `TglRakitan` datetime default NULL,
  `Keterangan` varchar(100) default NULL,
  `Nilai` double default NULL,
  `Aktif` varchar(1) default NULL,
  PRIMARY KEY  (`KodeRakitan`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tm_rakitan_m`
--


--
-- Table structure for table `tm_saldo`
--

CREATE TABLE `tm_saldo` (
  `KodeGol` varchar(20) NOT NULL,
  `NamaGroup` varchar(40) default NULL,
  `SaldoAkhir` double default NULL,
  `Debuging` varchar(100) default NULL,
  PRIMARY KEY  (`KodeGol`),
  CONSTRAINT `tm_saldo_ibfk_1` FOREIGN KEY (`KodeGol`) REFERENCES `tm_golongan` (`KodeGol`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tm_saldo`
--


--
-- Table structure for table `tm_sales`
--

CREATE TABLE `tm_sales` (
  `KodeSales` varchar(10) NOT NULL default '',
  `NamaSales` varchar(50) default NULL,
  `Keterangan` varchar(100) default NULL,
  `Aktif` varchar(1) default NULL,
  PRIMARY KEY  (`KodeSales`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tm_sales`
--


--
-- Table structure for table `tm_satuan`
--

CREATE TABLE `tm_satuan` (
  `satuan` varchar(10) NOT NULL default '',
  PRIMARY KEY  (`satuan`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tm_satuan`
--

INSERT INTO `tm_satuan` VALUES ('biji'),('botol'),('box'),('cepok'),('dos'),('ecer'),('galon'),('kaleng'),('karton'),('Kg'),('kilo'),('kodi'),('lembar'),('Meter'),('mL'),('ons'),('pack'),('pasang'),('Pcs'),('press'),('roll'),('sachet'),('set'),('strip'),('tor'),('tube'),('unit'),('vial'),('zack');

--
-- Table structure for table `tm_setupall`
--

CREATE TABLE `tm_setupall` (
  `setupall_id` int(11) NOT NULL auto_increment,
  `groups` varchar(20) NOT NULL,
  `subgroups` varchar(20) NOT NULL default '',
  `nilainum` float default NULL,
  `nilaitgl` datetime default NULL,
  `nilaichar` varchar(100) default NULL,
  `ketnilai` varchar(255) default NULL,
  `visible` varchar(1) default 'Y',
  PRIMARY KEY  (`setupall_id`,`groups`,`subgroups`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tm_setupall`
--

INSERT INTO `tm_setupall` VALUES (1,'Masking','KodeBrg',0,'1899-12-30 00:00:00','','Masking kode Barang untuk input kode barang','Y'),(2,'Masking','KodeCust',0,'1899-12-30 00:00:00','','Masking kode Customer untuk input kode Customer','Y'),(3,'Masking','KodeGd',0,'1899-12-30 00:00:00','','Masking kode Gudang untuk input kode Gudang','Y'),(4,'Masking','KodeGol',0,'1899-12-30 00:00:00','','Masking kode Golongan untuk input kode Golongan','Y'),(5,'Masking','KodeSupp',0,'1899-12-30 00:00:00','','Masking kode Supplier untuk input kode Supplier','Y'),(6,'Satuan','Satuan01',0,'1899-12-30 00:00:00','Pcs','','Y'),(10,'Satuan','Satuan08',0,'1899-12-30 00:00:00','Strip','Satuan Untuk Master Barang xx','Y'),(11,'Satuan','Satuan06',0,'1899-12-30 00:00:00','Pack','','Y'),(12,'Satuan','Satuan03',0,'1899-12-30 00:00:00','Mtr','','Y'),(13,'Satuan','Satuan05',0,'1899-12-30 00:00:00','Dos','','Y'),(25,'JenisBrg','JenisBrg1',0,NULL,'Inventory',NULL,'Y'),(26,'JenisBrg','JenisBrg2',0,NULL,'Non Inv',NULL,'Y'),(27,'JenisBrg','JenisBrg3',0,NULL,'Service',NULL,'Y'),(35,'Trans Beli','TrBeli1',0,'1899-12-30 00:00:00','BT','No Bukti Pembelian','Y'),(37,'Trans Jual Retail','TrJualR1',0,NULL,'JR','No Bukti Penjualan Retail','Y'),(38,'Trans Jual Grosir','TrJual1',0,'1899-12-30 00:00:00','JT','No Bukti Penjualan Grosir','Y'),(39,'Trans Jual Rakitan','TrJualRakitan1',0,NULL,'JK','No Bukti Penjualan Rakitan','Y'),(42,'Trans Retur Beli','TrReturBeli1',0,NULL,'RB','No Bukti Retur Pembelian','Y'),(43,'Trans Retur Jual','TrReturJual1',0,NULL,'RJ','No Bukti Retur Penjualan Grosir','Y'),(44,'Trans Retur Jual R','TrReturJualR1',NULL,NULL,'RR','No Bukti Retur Penjualan Retail','Y'),(45,'Trans Retur Jual Rkt','TrReturJualRakitan1',NULL,NULL,'RK','No Bukti Retur Penjualan Rakitan','Y'),(46,'Trans Bayar Beli','TrBayarBeli1',0,NULL,'YB','No Bukti Pembayaran Pembelian','Y'),(47,'Trans Bayar Jual','TrBayarJual1',0,NULL,'YJ','No Bukti Pembayaran Penjualan Grosir','Y'),(48,'Trans Bayar Jual Rkt','TrBayarJualRakitan1',0,NULL,'YK','No Bukti Pembayaran Penjualan Rakitan','Y'),(49,'Trans SO','TrSO1',0,NULL,'PJ','No Bukti Sales Order','Y'),(50,'Trans SO Rakitan','TrSORakitan1',NULL,NULL,'PK','No Bukti Sales Order Rakitan','Y'),(51,'Trans PO','TrPo1',NULL,NULL,'PO','No Bukti Purchase Order','Y'),(54,'Valas','Valas1',1,'1899-12-30 00:00:00','IDR','Indonesian Rupiah','Y'),(55,'Valas','Valas2',3000,'1899-12-30 00:00:00','SGD','Singapore Dolar','Y'),(56,'Valas','Valas3',8000,'1899-12-30 00:00:00','USD','US Dolar','Y'),(60,'Nomor','BT',1,'1899-12-30 00:00:00','19000017','Nomor Transaksi Pembelian; Jika Nilai Num  0 atau 1 format no sbb : yyxxxxxxR01;  untuk 2  :  yymmxxxxR01;  untuk 3 : yymmddxxxR1 -->  Nilai Char Diisi Angka (xx artinya angka 0-9)  ','Y'),(61,'Nomor','JT',3,'1899-12-30 00:00:00','7240207001','Nomor Transaksi Penjualan; Jika Nilai Num  0 atau 1 format no sbb : yyxxxxxxR01;  untuk 2  :  yymmxxxxR01;  untuk 3 : yymmddxxxR1 -->  Nilai Char Diisi Angka (xx artinya angka 0-9)  ','Y'),(62,'Nomor','YB',1,'1899-12-30 00:00:00','17000384','Nomor Transaksi Pembayaran Pembelian; Jika Nilai Num  0 atau 1 format no sbb : yyxxxxxxR01;  untuk 2  :  yymmxxxxR01;  untuk 3 : yymmddxxxR1 -->  Nilai Char Diisi Angka (xx artinya angka 0-9)  ','Y'),(63,'Nomor','YJ',1,'1899-12-30 00:00:00','18000001','Nomor Transaksi Pembayaran Penjualan; Jika Nilai Num  0 atau 1 format no sbb : yyxxxxxxR01;  untuk 2  :  yymmxxxxR01;  untuk 3 : yymmddxxxR1 -->  Nilai Char Diisi Angka (xx artinya angka 0-9)  ','Y'),(64,'Nomor','RB',1,'1899-12-30 00:00:00','16000001','Nomor Transaksi Retur Pembelian; Jika Nilai Num  0 atau 1 format no sbb : yyxxxxxxR01;  untuk 2  :  yymmxxxxR01;  untuk 3 : yymmddxxxR1 -->  Nilai Char Diisi Angka (xx artinya angka 0-9)  ','Y'),(65,'Nomor','RJ',1,'1899-12-30 00:00:00','16000001','Nomor Transaksi Retur Penjualan; Jika Nilai Num  0 atau 1 format no sbb : yyxxxxxxR01;  untuk 2  :  yymmxxxxR01;  untuk 3 : yymmddxxxR1 -->  Nilai Char Diisi Angka (xx artinya angka 0-9)  ','Y'),(67,'Nomor','PJ',2,'1899-12-30 00:00:00','13010018','Nomor Transaksi PO Penjualan (Sales Order); Jika Nilai Num  0 atau 1 format no sbb : yyxxxxxxR01;  untuk 2  :  yymmxxxxR01;  untuk 3 : yymmddxxxR1 -->  Nilai Char Diisi Angka (xx artinya angka 0-9)  ','Y'),(68,'Nomor','PK',2,'1899-12-30 00:00:00','07090005','Nomor Transaksi PO Penjualan Rakitan (Sales Order Rakitan); Jika Nilai Num  0 atau 1 format no sbb : yyxxxxxxR01;  untuk 2  :  yymmxxxxR01;  untuk 3 : yymmddxxxR1 -->  Nilai Char Diisi Angka (xx artin','Y'),(69,'Nomor','JR',3,'1899-12-30 00:00:00','1190125094','Nomor Transaksi Penjualan Retail; Jika Nilai Num  0 atau 1 format no sbb : yyxxxxxxR01;  untuk 2  :  yymmxxxxR01;  untuk 3 : yymmddxxxR1 -->  Nilai Char Diisi Angka (xx artinya angka 0-9)  ','Y'),(70,'Nomor','JK',3,'1899-12-30 00:00:00','071114002','Nomor Transaksi Penjualan Rakitan; Jika Nilai Num  0 atau 1 format no sbb : yyxxxxxxR01;  untuk 2  :  yymmxxxxR01;  untuk 3 : yymmddxxxR1 -->  Nilai Char Diisi Angka (xx artinya angka 0-9)  ','Y'),(71,'Nomor','RK',3,'1899-12-30 00:00:00','070830005','Nomor Transaksi Retur Penjualan Rakitan; Jika Nilai Num  0 atau 1 format no sbb : yyxxxxxxR01;  untuk 2  :  yymmxxxxR01;  untuk 3 : yymmddxxxR1 -->  Nilai Char Diisi Angka (xx artinya angka 0-9)  ','Y'),(72,'Nomor','PG',1,'1899-12-30 00:00:00','16000001','Nomor Transaksi Pindah Gudang; Jika Nilai Num  0 atau 1 format no sbb : yyxxxxxxR01;  untuk 2  :  yymmxxxxR01;  untuk 3 : yymmddxxxR1 -->  Nilai Char Diisi Angka (xx artinya angka 0-9)  ','Y'),(73,'Nomor','BR',3,'1899-12-30 00:00:00','5190124055','Nomor Transaksi Barang Rusak per Gudang; Jika Nilai Num  0 atau 1 format no sbb : yyxxxxxxR01;  untuk 2  :  yymmxxxxR01;  untuk 3 : yymmddxxxR1 -->  Nilai Char Diisi Angka (xx artinya angka 0-9)  ','Y'),(74,'Nomor','CL',2,'1899-12-30 00:00:00','99120019','Nomor Transaksi Untuk Closing; Jika Nilai Num  0 atau 1 format no sbb : yyxxxxxxR01;  untuk 2  :  yymmxxxxR01;  untuk 3 : yymmddxxxR1 -->  Nilai Char Diisi Angka (xx artinya angka 0-9)  ','Y'),(75,'Nomor','PO',2,'1899-12-30 00:00:00','11092606','Nomor Transaksi Untuk Purchase Order; Jika Nilai Num  0 atau 1 format no sbb : yyxxxxxxR01;  untuk 2  :  yymmxxxxR01;  untuk 3 : yymmddxxxR1 -->  Nilai Char Diisi Angka (xx artinya angka 0-9)  ','Y'),(80,'Kode Bayar Beli','KodeByr1',0,'1899-12-30 00:00:00','CASH','Tunai','Y'),(83,'Kode Bayar Beli','KodeByr3',0,'1899-12-30 00:00:00','TRANSFER','Transfer Via Bank','Y'),(85,'Default List Filter','ListBeli',0,'1899-12-30 00:00:00','Tahun','Diisi : Semua,Tahun,Bulan,Tanggal','Y'),(86,'Default List Filter','ListBayarBeli',0,'1899-12-30 00:00:00','Tahun','Diisi : Semua, Tahun, Bulan, Tanggal','Y'),(87,'Default List Filter','ListReturBeli',0,'1899-12-30 00:00:00','Tahun','Diisi : Semua, Tahun, Bulan, Tanggal','Y'),(88,'Default List Filter','ListSO',0,'1899-12-30 00:00:00','Tahun','Diisi : Semua, Tahun, Bulan, Tanggal','Y'),(89,'Default List Filter','ListSORakitan',0,'1899-12-30 00:00:00','Tahun','Diisi : Semua, Tahun, Bulan, Tanggal','Y'),(90,'Default List Filter','ListJualRetail',0,'1899-12-30 00:00:00','Tanggal','Diisi : Semua, Tahun, Bulan, Tanggal','Y'),(91,'Default List Filter','ListJualGrosir',0,'1899-12-30 00:00:00','Tahun','Diisi : Semua, Tahun, Bulan, Tanggal','Y'),(92,'Default List Filter','ListJualRakitan',0,'1899-12-30 00:00:00','Semua','Diisi : Semua, Tahun, Bulan, Tanggal','Y'),(93,'Default List Filter','ListMasterRakitan',0,'1899-12-30 00:00:00','Semua','Diisi : Semua, Tahun, Bulan, Tanggal','Y'),(94,'Default List Filter','ListBayarJual',0,'1899-12-30 00:00:00','Semua','Diisi : Semua, Tahun, Bulan, Tanggal','Y'),(95,'Default List Filter','ListMutasiGudang',0,'1899-12-30 00:00:00','Tahun','Diisi : Semua, Tahun, Bulan, Tanggal','Y'),(96,'Default List Filter','ListBarangRusak',0,'1899-12-30 00:00:00','Tahun','Diisi : Semua, Tahun, Bulan, Tanggal','Y'),(100,'Masking','KodeSales',0,'1899-12-30 00:00:00','','Masking Master Sales untuk input Kode Sales','Y'),(101,'Masking','KodeRakitan',0,'1899-12-30 00:00:00','','Masking Master Rakitan untuk input Kode Rakitan','Y'),(120,'Set Harga Penjualan','SalesOrder',0,'1899-12-30 00:00:00','HargaGrosir','Digunakan Untuk Set Radio Button;  Diisi : HargaGrosir, HargaRetail','Y'),(121,'Set Harga Penjualan','SalesOrderRakitan',0,'1899-12-30 00:00:00','HargaGrosir','Digunakan Untuk Set Radio Button;  Diisi : HargaGrosir, HargaRetail','Y'),(122,'Set Harga Penjualan','PenjualanRetail',0,'1899-12-30 00:00:00','HargaGrosir','Digunakan Untuk Set Radio Button;  Diisi : HargaRetail, HargaGrosir','Y'),(123,'Set Harga Penjualan','PenjualanGrosir',0,'1899-12-30 00:00:00','HargaGrosir','Digunakan Untuk Set Radio Button;  Diisi : HargaGrosir, HargaRetail','Y'),(124,'Set Harga Penjualan','MasterRakitan',0,'1899-12-30 00:00:00','HargaGrosir','Digunakan Untuk Set Radio Button;  Diisi : HargaGrosir, HargaRetail','Y'),(125,'Set Harga Penjualan','PenjualanRakitan',0,'1899-12-30 00:00:00','HargaGrosir','Digunakan Untuk Set Radio Button;  Diisi : HargaGrosir, HargaRetail','Y'),(131,'Set Cetak Struk','MarginAtas',0,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi, Atas Kertas Ke Heder;  Diisi : 0 s/d 5\r\n','Y'),(132,'Set Cetak Struk','MarginKiri',0,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi, Kiri Kertas Ke Heder dan Detil;  Diisi :0 s/d 10','Y'),(133,'Set Cetak Struk','SpasiHederKeDetail',1,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi, Heder ke Detil;  Diisi : 0 s/d 5','Y'),(134,'Set Cetak Struk','MaxBaris',100,'1899-12-30 00:00:00','','Digunakan Untuk Set Max Baris Cetak Struk; Minimal = 11  + ColumnHeder(2) + nDetil Data (>= 1) +  MarginAtas + SpasiHederKeDetail (1)+ MarginBawah; Diisi : 15 s/d 50','Y'),(135,'Set Cetak Struk','KeteranganFooter1',0,'2009-02-27 00:00:00','*TERIMA KASIH*','Digunakan Untuk Set Catatan Footer;  Diisi : TERIMA KASIH','Y'),(136,'Set Cetak Struk','GantiKertas',0,'1899-12-30 00:00:00','N','Digunakan Untuk Set Ganti Kertas (Eject) atau Tidak  Bila Sudah Max Baris; Eject Merupakan Prioritas 1 bila diisi N baru digunakan MarginBawah dan CetakSampaiMaxBaris; Diisi : Y atau N','Y'),(137,'Set Cetak Struk','CetakSampaiMaxBaris',0,'1899-12-30 00:00:00','N','Digunakan Untuk Set Cetak Blank, Bila Belum Max Baris;  Aktif bila GantiKertas diisi N; Diisi : Y atau N','Y'),(138,'Set Cetak Struk','KeteranganFooter2',0,'1899-12-30 00:00:00','*Barang Yang Sudah Dibeli Tidak Dapat Ditukar/Dikembalikan*','Digunakan Untuk Set Catatan Footer;  Diisi : Barang Yang Sudah Dibeli Tidak Dapat Ditukar/Dikembalikan','Y'),(139,'Set Cetak Struk','MarginBawah',8,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi, Bawah Kertas Ke Footer; Aktif bila GantiKertas diisi N;  Diisi : 0 s/d 3','Y'),(150,'Set Cetak Invoice','MarginBawah',2,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi, Bawah Kertas Ke Footer; Aktif bila GantiKertas diisi N;  Diisi : 0 s/d 3','Y'),(151,'Set Cetak Invoice','MarginAtas',-5,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi, Atas Kertas Ke Heder;  Diisi : 0 s/d 5\r\n','Y'),(152,'Set Cetak Invoice','MarginKiri',5,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi, Kiri Kertas Ke Heder dan Detil;  Diisi :0 s/d 10','Y'),(153,'Set Cetak Invoice','MaxBaris',32,'1899-12-30 00:00:00','','Digunakan Untuk Set Max Baris Cetak Invoice Unutk Penjualan Grosir; Minimal = 20  + ColumnHeder(2) + nDetil Data (>= 8) +  MarginAtas + SpasiHederKeDetail (1)+ MarginBawah(1); Diisi : 32 s/d 64','Y'),(154,'Set Cetak Invoice','MaxBarisRakitan',32,'1899-12-30 00:00:00','','Digunakan Untuk Set Max Baris Cetak Invoice untuk Penjualan Rakitan; Minimal = 18  + ColumnHeder(2) + nDetil Data (>= 1) +  MarginAtas + SpasiHederKeDetail (1)+ MarginBawah; Diisi : 22 s/d 50','Y'),(155,'Set Cetak Invoice','SpasiHederKeDetail',1,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi, Heder ke Detil;  Diisi : 0 s/d 5','Y'),(156,'Set Cetak Invoice','MarginBwhDipindahkan',0,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi Dipindahkan, Bawah kertas ke Detil data Untuk detil data yang banyak yang ngak cukup untuk 1 Lembar;  Diisi : 0 s/d 5','Y'),(157,'Set Cetak Invoice','MarginAtasPemindahan',0,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi Pemindahan, Atas Kertas ke Heder Untuk detil data yang banyak yang ngak cukup untuk 1 Lembar;  Diisi : 0 s/d 5','Y'),(175,'Set Cetak Invoice','GantiKertas',0,'1899-12-30 00:00:00','N','Digunakan Untuk Set Ganti Kertas (Eject) atau Tidak  Bila Sudah Max Baris; Prioritas 1 bila diisi N baru digunakan MarginBawah dan CetakSampaiMaxBaris; Diisi : Y atau N','Y'),(176,'Set Cetak Invoice','CetakSampaiMaxBaris',0,'1899-12-30 00:00:00','Y','Digunakan Untuk Set Cetak Blank, Bila Belum Max Baris;  Aktif bila GantiKertas diisi N; Diisi : Y atau N','Y'),(177,'Set Cetak Invoice','KeteranganFooter1',0,'1899-12-30 00:00:00','* Kami Doakan Semoga Lancar *','Digunakan Untuk Set Catatan Footer;  Diisi : * Kami Doakan Semoga Lancar *','Y'),(179,'Set Cetak Invoice','KeteranganFooter2',0,'1899-12-30 00:00:00','* Claim atas*','Digunakan Untuk Set Catatan Footer;  Diisi : * Barang yg dibeli tidak dapat ditukar kembali *','Y'),(180,'Set Cetak Invoice','NamaCustLunas',0,'1899-12-30 00:00:00','CASH','Digunakan Untuk Mengisi Nama Customer Di Format Cetak, Bila Pembayaran Sudah Lunas dan Namacust Blank, Diganti Dengan Default CASH','Y'),(190,'Set Cetak SalesOrder','MarginBawah',2,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi, Bawah Kertas Ke Footer; Aktif bila GantiKertas diisi N;  Diisi : 0 s/d 3','Y'),(191,'Set Cetak SalesOrder','MarginAtas',0,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi, Atas Kertas Ke Heder;  Diisi : 0 s/d 5\r\n','Y'),(192,'Set Cetak SalesOrder','MarginKiri',5,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi, Kiri Kertas Ke Heder dan Detil;  Diisi :0 s/d 10','Y'),(193,'Set Cetak SalesOrder','MaxBaris',32,'1899-12-30 00:00:00','','Digunakan Untuk Set Max Baris Cetak SalesOrder Unutk Penjualan Grosir; Minimal = 20  + ColumnHeder(2) + nDetil Data (>= 8) +  MarginAtas + SpasiHederKeDetail (1)+ MarginBawah(1); Diisi : 32 s/d 64','Y'),(194,'Set Cetak SalesOrder','MaxBarisRakitan',32,'1899-12-30 00:00:00','','Digunakan Untuk Set Max Baris Cetak SalesOrder untuk Penjualan Rakitan; Minimal = 18  + ColumnHeder(2) + nDetil Data (>= 1) +  MarginAtas + SpasiHederKeDetail (1)+ MarginBawah; Diisi : 22 s/d 50','Y'),(195,'Set Cetak SalesOrder','SpasiHederKeDetail',1,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi, Heder ke Detil;  Diisi : 0 s/d 5','Y'),(196,'Set Cetak SalesOrder','MarginBwhDipindahkan',0,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi Dipindahkan, Bawah kertas ke Detil data Untuk detil data yang banyak yang ngak cukup untuk 1 Lembar;  Diisi : 0 s/d 5','Y'),(197,'Set Cetak SalesOrder','MarginAtasPemindahan',0,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi Pemindahan, Atas Kertas ke Heder Untuk detil data yang banyak yang ngak cukup untuk 1 Lembar;  Diisi : 0 s/d 5','Y'),(200,'Set Cetak SalesOrder','GantiKertas',0,'1899-12-30 00:00:00','N','Digunakan Untuk Set Ganti Kertas (Eject) atau Tidak  Bila Sudah Max Baris; Prioritas 1 bila diisi N baru digunakan MarginBawah dan CetakSampaiMaxBaris; Diisi : Y atau N','Y'),(201,'Set Cetak SalesOrder','CetakSampaiMaxBaris',0,'1899-12-30 00:00:00','Y','Digunakan Untuk Set Cetak Blank, Bila Belum Max Baris;  Aktif bila GantiKertas diisi N; Diisi : Y atau N','Y'),(202,'Set Cetak SalesOrder','KeteranganFooter1',0,'1899-12-30 00:00:00','* Kami Tidak Menerima Pembayaran berupa Cheque/BG *','Digunakan Untuk Set Catatan Footer;  Diisi : * Terima Kasih Atas Kunjungan Anda *','Y'),(203,'Set Cetak SalesOrder','KeteranganFooter2',0,'1899-12-30 00:00:00','* Barang yg dibeli tidak dapat ditukar/dikembalikan tanpa ada perjanjian *','Digunakan Untuk Set Catatan Footer;  Diisi : * Barang yg dibeli tidak dapat ditukar kembali *','Y'),(204,'Set Cetak SalesOrder','NamaCustLunas',0,'1899-12-30 00:00:00','CASH','Digunakan Untuk Mengisi Nama Customer Di Format Cetak, Bila Pembayaran Sudah Lunas dan Namacust Blank, Diganti Dengan Default CASH','Y'),(210,'Set Cetak Closing','MarginAtas',0,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi, Atas Kertas Ke Heder;  Diisi : 0 s/d 5\r\n','Y'),(211,'Set Cetak Closing','MarginKiri',5,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi, Kiri Kertas Ke Heder dan Detil;  Diisi :0 s/d 10','Y'),(212,'Set Cetak Closing','SpasiHederKeDetail',1,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi, Heder ke Detil;  Diisi : 0 s/d 5','Y'),(213,'Set Cetak Closing','MaxBaris',24,'1899-12-30 00:00:00','','Digunakan Untuk Set Max Baris Cetak Struk; Minimal = 11  + ColumnHeder(2) + nDetil Data (>= 1) +  MarginAtas + SpasiHederKeDetail (1)+ MarginBawah; Diisi : 15 s/d 50','Y'),(214,'Set Cetak Closing','GantiKertas',0,'1899-12-30 00:00:00','N','Digunakan Untuk Set Ganti Kertas (Eject) atau Tidak  Bila Sudah Max Baris; Eject Merupakan Prioritas 1 bila diisi N baru digunakan MarginBawah dan CetakSampaiMaxBaris; Diisi : Y atau N','Y'),(215,'Set Cetak Closing','CetakSampaiMaxBaris',0,'1899-12-30 00:00:00','N','Digunakan Untuk Set Cetak Blank, Bila Belum Max Baris;  Aktif bila GantiKertas diisi N; Diisi : Y atau N','Y'),(216,'Set Cetak Closing','KeteranganFooter2',0,'1899-12-30 00:00:00','* Barang yg dibeli tidak dapat di kembalikan *','Digunakan Untuk Set Catatan Footer;  Diisi : * Barang yg dibeli tidak dapat ditukar kembali *','Y'),(217,'Set Cetak Closing','MarginBawah',10,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi, Bawah Kertas Ke Footer; Aktif bila GantiKertas diisi N;  Diisi : 0 s/d 3','Y'),(218,'Set Cetak Closing','MaxChar',42,'1899-12-30 00:00:00','','Digunakan Untuk Jumlah Karakter, Kiri ke kanan;  Diisi : 40 s/d 50','Y'),(219,'Set Cetak Closing','MarginKanan',0,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi, Kanan Kertas Ke Heder dan Detil;  Diisi :0 s/d 10','Y'),(245,'Penjualan Retail','FormatCetak',0,'1899-12-30 00:00:00','Struk','Digunakan Untuk Set Format Cetakan Penjualan Retail; Diisi: Struk, Invoice','Y'),(246,'Penjualan Retail','ModeCetak',0,'1899-12-30 00:00:00','Cetak','Digunakan Untuk Set Mode Cetak Penjualan Retail;  Diisi : Cetak, Lihat atau \'\' (bila tidak ingin dicetak atau dilihat)','Y'),(247,'Penjualan Grosir','FormatCetak',0,'1899-12-30 00:00:00','Invoice','Digunakan Untuk Set Format Cetakan Penjualan Grosir; Diisi: Struk, Invoice','Y'),(248,'Penjualan Grosir','ModeCetak',0,'1899-12-30 00:00:00','Cetak','Digunakan Untuk Set Mode Cetak Penjualan Grosir;  Diisi : Cetak, Lihat atau \'\' (bila tidak ingin dicetak atau dilihat)','Y'),(249,'Penjualan Rakitan','FormatCetak',0,'1899-12-30 00:00:00','Invoice','Digunakan Untuk Set Format Cetakan Penjualan Rakitan; Diisi: Struk, Invoice','Y'),(250,'Penjualan Rakitan','ModeCetak',0,'1899-12-30 00:00:00','Cetak','Digunakan Untuk Set Mode Cetak Penjualan Rakitan;  Diisi : Cetak, Lihat atau \'\' (bila tidak ingin dicetak atau dilihat)','Y'),(251,'Penjualan Retail','JmlBrsCetakGrafik',17,'1899-12-30 00:00:00','','Digunakan Untuk Set Jumlah Baris Cetak Invoce Mode Grafik; Diisi 17 untuk panjang kertas 5,5 Inch (Setengah Kertas Letter)','Y'),(252,'Penjualan Grosir','JmlBrsCetakGrafik',17,'1899-12-30 00:00:00','','Digunakan Untuk Set Jumlah Baris Cetak Invoce Mode Grafik; Diisi 17 untuk panjang kertas 5,5 Inch (Setengah Kertas Letter)','Y'),(253,'Penjualan Rakitan','JmlBrsCetakGrafik',17,NULL,'','Digunakan Untuk Set Jumlah Baris Cetak Invoce Mode Grafik; Diisi 17 untuk panjang kertas 5,5 Inch (Setengah Kertas Letter)','Y'),(255,'Sales Order Grosir','ModeCetak',NULL,NULL,'Lihat','Digunakan Untuk Set Mode Cetak Sales Order Grosir;  Diisi : Cetak, Lihat atau \'\' (bila tidak ingin dicetak atau dilihat)',NULL),(258,'Sales Order Rakitan','ModeCetak',0,'1899-12-30 00:00:00','Lihat','Digunakan Untuk Set Mode Cetak Sales Order Rakitan;  Diisi : Cetak, Lihat atau \'\' (bila tidak ingin dicetak atau dilihat)',NULL),(300,'Masking','NoPol',0,'1899-12-30 00:00:00','!!*4{1,2,3,4,5,6,7,8,9,0}','Masking No Polisi Kendaraan di input Penjualan Grosir; !!*4{1,2,3,4,5,6,7,8,9,0} contoh \'AE1234\'','Y'),(400,'Kode Bayar Jual','KodeByr1',0,NULL,'CASH','Tunai','Y'),(402,'Kode Bayar Jual','KodeByr3',0,NULL,'TRANSFER','Transfer Via Bank','Y'),(500,'Kota Customer','Kota1',0,'1899-12-30 00:00:00','MOJOKERTO','Digunakan Untuk Daftar Kota Pada Saat Input Master Customer','Y'),(501,'Kota Customer','Kota2',0,'1899-12-30 00:00:00','MOJOSARI','Digunakan Untuk Daftar Kota Pada Saat Input Master Customer','Y'),(502,'Kota Customer','Kota3',0,'1899-12-30 00:00:00','JOMBANG','Digunakan Untuk Daftar Kota Pada Saat Input Master Customer','Y'),(550,'Kota Supplier','Kota1',0,'1899-12-30 00:00:00','MOJOKERTO','Digunakan Untuk Daftar Kota Pada Saat Input Master Supplier','Y'),(551,'Kota Supplier','Kota2',0,'1899-12-30 00:00:00','SURABAYA','Digunakan Untuk Daftar Kota Pada Saat Input Master Supplier','Y'),(600,'Default List Order','ListJurnal',0,'1899-12-30 00:00:00','No_bukti','Diisi Tanggal,No_bukti,Keterangan','Y'),(601,'Default List Order','ListBarang',0,'1899-12-30 00:00:00','NamaBrg','Diisi KodeBrg,NamaBrg,NamaGol,NamaSupp','Y'),(602,'Default List Order','ListCustomer',0,'1899-12-30 00:00:00','NamaCust','Diisi KodeCust,NamaCust,Alamat,Kota','Y'),(603,'Default List Order','ListSupplier',NULL,NULL,'NamaSupp','Diisi KodeSupp,NamaSupp,Alamat,Kota','Y'),(604,'Default List Order','ListGroupBarang',NULL,NULL,'NamaGol','Diisi KodeGol,NamaGol,Keterangan','Y'),(605,'Default List Order','ListGudang',NULL,NULL,'NamaGd','Diisi KodeGd,NamaGd,Keterangan','Y'),(700,'SuppType','SuppType1',0,'1899-12-30 00:00:00','Lokal','','Y'),(701,'SuppType','SuppType2',0,'1899-12-30 00:00:00','Luar Kota','','Y'),(710,'CustType','CustType1',NULL,NULL,'Lokal',NULL,'Y'),(711,'CustType','CustType2',NULL,NULL,'Luar Kota',NULL,'Y'),(790,'Template','LapCustomer',0,NULL,'Report','LapCustomer.rtm','Y'),(791,'Template','LapCustomerSummary',0,NULL,'Report','LapCustomerSummary.rtm','Y'),(793,'Template','LapSupplier',0,NULL,'Report','LapSupplier.rtm','Y'),(794,'Template','LapSupplierSummary',0,NULL,'Report','LapSupplierSummary.rtm','Y'),(796,'Template','LapMutasiGudang',0,NULL,'Report','LapMutasiGudang.rtm','Y'),(800,'Template','LapPosisiHutang',0,NULL,'Report','LapPosisiHutang.rtm','Y'),(801,'Template','LapKartuHutang',0,NULL,'Report','LapKartuHutang.rtm','Y'),(802,'Template','LapUmurHutang',0,NULL,'Report','LapUmurHutang.rtm','Y'),(805,'Template','LapPosisiPiutang',0,NULL,'Report','LapPosisiPiutang.rtm','Y'),(806,'Template','LapKartuPiutang',0,NULL,'Report','LapKartuPiutang.rtm','Y'),(807,'Template','LapUmurPiutang',0,NULL,'Report','LapUmurPiutang.rtm','Y'),(810,'Template','LapPosisiStock',0,NULL,'Report','LapPosisiStock.rtm','Y'),(811,'Template','LapPosisiStockNilai',0,NULL,'Report','LapPosisiStockNilai.rtm','Y'),(812,'Template','LapMinMaxStock',0,NULL,'Report','LapMinMaxStock.rtm','Y'),(813,'Template','LapKartuStock',0,NULL,'Report','LapKartuStock.rtm','Y'),(820,'Template','LapPembelianSummary',0,NULL,'Report','LapPembelianSummary.rtm','Y'),(821,'Template','LapPembelianDetail',0,NULL,'Report','LapPembelianDetail.rtm','Y'),(823,'Template','LapReturBeliSummary',0,NULL,'Report','LapReturPembelianSummary.rtm','Y'),(824,'Template','LapReturBeliDetail',0,NULL,'Report','LapReturPembelianDetail.rtm','Y'),(826,'Template','LapBayarBeliNota',0,NULL,'Report','LapPembayaranPembelianNota.rtm','Y'),(827,'Template','LapBayarBeliBayar',0,NULL,'Report','LapPembayaranPembelianBayar.rtm','Y'),(840,'Template','LapPoJualSummary',0,NULL,'Report','LapPoJualSummary.rtm','Y'),(842,'Template','LapSODetail',0,NULL,'Report','LapSODetail.rtm','Y'),(865,'Template','LapAnalisaJualSum',0,NULL,'Report','LapAnalisaPenjualanSummary.rtm','Y'),(866,'Template','LapAnalisaJualDtl',0,NULL,'Report','LapAnalisaPenjualanDetail.rtm','Y'),(871,'Template','LapAnalisaPenjualan',0,NULL,'Report','LapAnalisaPenjualan.rtm','Y'),(872,'Template','LapInvoiceRetail',0,NULL,'Report','LapInvoiceRetail.rtm','Y'),(873,'Template','LapInvoiceGrosir',0,NULL,'Report','LapInvoiceGrosir.rtm','Y'),(874,'Template','LapInvoiceRakitan',0,NULL,'Report','LapInvoiceRakitan.rtm','Y'),(875,'Template','LapRetJualRetailDtl',0,NULL,'Report','LapReturPenjualanRetailDetail.rtm','Y'),(876,'Template','LapRetJualRetailSum',0,NULL,'Report','LapReturPenjualanRetailSummary.rtm','Y'),(877,'Template','LapRetJualGrosirDtl',0,NULL,'Report','LapReturPenjualanGrosirDetail.rtm','Y'),(878,'Template','LapRetJualGrosirSum',0,NULL,'Report','LapReturPenjualanGrosirSummary.rtm','Y'),(880,'Template','MasterBarang',0,NULL,'Report','MasterBarang.rtm','Y'),(881,'Template','MasterBarangPersen',0,NULL,'Report','MasterBarangPersen.rtm','Y'),(882,'Template','LapPenjRetailSummary',0,NULL,'Report','LapPenjualanRetailSummary.rtm','Y'),(883,'Template','LapPenjRetailDetail',0,NULL,'Report','LapPenjualanRetailDetail.rtm','Y'),(884,'Template','LapPenjGrosirSummary',0,NULL,'Report','LapPenjualanGrosirSummary.rtm','Y'),(885,'Template','LapPenjGrosirDetail',0,NULL,'Report','LapPenjualanGrosirDetail.rtm','Y'),(888,'Template','PersediaanAwal',0,NULL,'Report','PersediaanAwal.rtm','Y'),(889,'Template','OpnameAwal',0,NULL,'Report','OpnameAwal.rtm','Y'),(950,'UmurHut','1',-14,NULL,NULL,NULL,NULL),(951,'UmurHut','2',-7,NULL,NULL,NULL,NULL),(952,'UmurHut','3',0,NULL,NULL,NULL,NULL),(953,'UmurHut','4',8,NULL,NULL,NULL,NULL),(954,'UmurHut','5',15,NULL,NULL,NULL,NULL),(956,'UmurPiut','1',-14,NULL,NULL,NULL,NULL),(957,'UmurPiut','2',-7,NULL,NULL,NULL,NULL),(958,'UmurPiut','3',0,NULL,NULL,NULL,NULL),(959,'UmurPiut','4',8,NULL,NULL,NULL,NULL),(960,'UmurPiut','5',15,NULL,NULL,NULL,NULL),(971,'AutoJurnal','Hpp',0,'1899-12-30 00:00:00','511001','Kode Perkiraan Jurnal Untuk Harga Pokok Penjualan','Y'),(972,'AutoJurnal','PendapatanPenjualan',0,'1899-12-30 00:00:00','411001','Kode Perkiraan Jurnal Untuk Pendapatan Penjualan','Y'),(973,'AutoJurnal','ReturPenjualan',0,'1899-12-30 00:00:00','411002\r\n411002\r\n411002','Kode Perkiraan Jurnal Untuk Retur Penjualan','Y'),(974,'AutoJurnal','MasterSupplier',0,'1899-12-30 00:00:00','211001','Kode Perkiraan Awal Untuk Master Supplier','Y'),(975,'AutoJurnal','MasterCustomer',0,'1899-12-30 00:00:00','112001','Kode Perkiraan Awal Untuk Master Customer','Y'),(976,'AutoJurnal','PendapatanDiskon',0,'1899-12-30 00:00:00','411003','Kode Perkiraan Jurnal Untuk Pendapatan Diskon','Y'),(977,'AutoJurnal','Kas',0,'1899-12-30 00:00:00','111001','Kode Perkiraan Jurnal Untuk Kas','Y'),(978,'AutoJurnal','PersediaanBarang',0,'1899-12-30 00:00:00','113001','Kode Perkiraan Jurnal Untuk Persediaan Barang','Y'),(979,'AutoJurnal','BebanBarangRusak',0,'1899-12-30 00:00:00','521009','Kode Perkiraan Jurnal Untuk Beban Atas Kerusakan Barang','Y'),(980,'Set Cetak Struk','MaxChar',40,'1899-12-30 00:00:00','','Digunakan Untuk Set Banyaknya Karakter, Kiri Kertas Ke Kanan;  Diisi :40 s/d 50','Y'),(982,'Set Cetak Struk','MarginKanan',0,'1899-12-30 00:00:00','','Digunakan Untuk Set Jarak Spasi, Kanan Kertas Ke Heder dan Detil;  Diisi :0 s/d 10','Y'),(983,'Kota Supplier','Kota3',0,'1899-12-30 00:00:00','MADIUN','Digunakan Untuk Daftar Kota Pada Saat Input Master Supplier','Y'),(984,'Kota Supplier','Kota4',0,'1899-12-30 00:00:00','PONOROGO','Digunakan Untuk Daftar Kota Pada Saat Input Master Supplier','Y'),(986,'Satuan','satuan15',0,'1899-12-30 00:00:00','Krtn','','Y'),(987,'Satuan','satuan16',0,'1899-12-30 00:00:00','Box','','Y'),(988,'Satuan','satuan17',0,'1899-12-30 00:00:00','Lusin','','Y'),(989,'Satuan','satuan18',0,'1899-12-30 00:00:00','1ons','','Y'),(991,'Satuan','Satuan20 ',0,'2008-12-30 00:00:00','1kg','','Y'),(996,'Satuan','Satuan24',0,'2008-12-30 00:00:00','Lbr','','Y'),(1003,'Set Cetak Struk','KeteranganFooter3',0,'2008-06-02 00:00:00','','Digunakan Untuk Set Catatan Footer; Diisi : \"Customer Service (0321) 6110825','Y'),(1004,'Set Cetak Closing','KeteranganFooter3',0,'2008-06-02 00:00:00','','Digunakan Untuk Set Catatan Footer, Diisi : \" Customer Service (0321) 390940','Y'),(1006,'Satuan','Satuan25',0,'2008-12-30 00:00:00','Sak','','Y'),(1008,'Satuan','Satuan26',0,'2008-12-30 00:00:00','3 pcs','','Y'),(1009,'Satuan','Satuan27',0,'2008-12-30 00:00:00','Pres','','Y'),(1010,'Satuan','Satuan28',0,'2008-12-30 00:00:00','Liter','','Y'),(1012,'Satuan','Satuan29',0,'2008-12-30 00:00:00','5 pcs','','Y'),(1013,'Satuan','Satuan10',0,'2008-12-30 00:00:00','Krat','','Y'),(1014,'Satuan','Satuan30',0,'2008-12-30 00:00:00','Kaleng','','Y'),(1018,'Satuan','Satuan34',0,'2008-12-30 00:00:00','1/2kg','','Y'),(1019,'Satuan','Satuan35',0,'2008-12-30 00:00:00','Dos','','Y'),(1020,'Satuan','Satuan36',0,'2008-12-30 00:00:00','Gendel','','Y'),(1022,'Satuan','Satuan38',0,'2017-07-03 00:00:00','1/4kg','','Y'),(1023,'Satuan','Satuan40',0,'2017-07-03 00:00:00','5 kg','','Y'),(1024,'Point','Point1',150000,'1899-12-30 00:00:00','1','Rokok','Y'),(1025,'Satuan','satuan02',0,'2018-09-03 00:00:00','','','Y'),(1026,'Satuan','Satuan04',0,'2018-09-05 00:00:00','Renteng','','Y'),(1027,'Satuan','Satuan07',0,'2018-09-05 00:00:00','3 Renteng','','Y'),(1028,'Satuan','Satuan09',0,'2018-09-14 00:00:00','6 Renteng','','Y'),(1029,'Satuan','Satuan11',0,'2018-09-16 00:00:00','Botol','','Y'),(1030,'Satuan','Satuan12',0,'2018-09-17 00:00:00','1/2 lusin','','Y'),(1031,'Satuan','satuan13',0,'2018-10-07 00:00:00','Pres','','Y'),(1032,'Satuan','Satuan14',0,'2018-10-08 00:00:00','Slop','','Y'),(1033,'Satuan','Satuan19',0,'2018-10-11 00:00:00','Bag','','Y'),(1034,'Satuan','Satuan21',0,'2018-10-11 00:00:00','Tor','','Y'),(1035,'Satuan','Satuan22',0,'2018-10-12 00:00:00','1/2ons','','Y'),(1036,'Point','Point2',50000,'1899-12-30 00:00:00','2','Non Rokok','Y'),(1037,'Satuan','Satuan23',0,'2018-10-16 00:00:00','10kg','','Y'),(1038,'Satuan','Satuan31',0,'2018-10-18 00:00:00','Rp 2000','','Y'),(1039,'Satuan','Satuan32',0,'2018-10-19 00:00:00','Rp 1000','','Y'),(1040,'Satuan','Satuan33',0,'2018-10-19 00:00:00','Rp 2500','','Y'),(1041,'Satuan','Satuan37',0,'2018-10-20 00:00:00','15 kg','','Y'),(1042,'Satuan','Satuan39',0,'2018-10-21 00:00:00','2,5kg','','Y'),(1043,'Satuan','Satuan41',0,'2018-10-22 00:00:00','3 kg','','Y'),(1044,'','Satuan42',0,'2018-10-22 00:00:00','5 renteng','','Y'),(1045,'Satuan','Satuan42',0,'2018-10-22 00:00:00','5 renteng','','Y'),(1046,'Satuan','Satuan43',0,'2018-10-23 00:00:00','Tor 4,5kg','','Y'),(1047,'Kota Customer','Kota4',0,'1899-12-30 00:00:00','SIDOARJO','','Y'),(1048,'Kota Customer','Kota5',0,'1899-12-30 00:00:00','SURABAYA','','Y'),(1049,'Kota Supplier','Kota5',0,'1899-12-30 00:00:00','SIDOARJO','','Y'),(1050,'Kota Supplier','Kota6',0,'1899-12-30 00:00:00','JOMBANG','','Y'),(1051,'Satuan','Satuan44',0,'2018-11-04 00:00:00','1/2 Dos','','Y'),(1052,'Satuan','Satuan45',0,'2018-11-04 00:00:00','10 Renteng','','Y'),(1053,'Satuan','Satuan46',0,'2019-01-08 00:00:00','1/4 ons','','Y');

--
-- Table structure for table `tm_shift`
--

CREATE TABLE `tm_shift` (
  `KodeShift` varchar(15) NOT NULL,
  `NamaShift` varchar(25) default NULL,
  `JamStart` datetime NOT NULL,
  `JamEnd` datetime NOT NULL,
  PRIMARY KEY  (`KodeShift`,`JamStart`,`JamEnd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tm_shift`
--

INSERT INTO `tm_shift` VALUES ('001','PAGI','2013-01-30 08:00:00','2013-01-30 16:00:00'),('002','Sore','2013-01-30 16:00:00','2013-01-30 21:00:00');

--
-- Table structure for table `tm_stockbrg`
--

CREATE TABLE `tm_stockbrg` (
  `KodeBrg` varchar(20) NOT NULL default '',
  `NamaBrg` varchar(50) default NULL,
  `KodeGd` varchar(5) NOT NULL default '',
  `StockAwal` double(10,2) default NULL,
  `StockAkhir` double(10,2) default NULL,
  `NilaiAwal` double default NULL,
  `TglAwal` date default NULL,
  `Stock` double default NULL,
  `Stock0` double default NULL,
  `Stock1` double default NULL,
  `Stock2` double default NULL,
  `Stock3` double default NULL,
  `SatuanStok1` varchar(30) default NULL,
  `SatuanStok2` varchar(30) default NULL,
  `SatuanStok3` varchar(30) default NULL,
  PRIMARY KEY  (`KodeBrg`,`KodeGd`),
  KEY `fk_MStockBrg2` (`KodeGd`),
  CONSTRAINT `fk_MStockBrg1` FOREIGN KEY (`KodeBrg`) REFERENCES `tm_barang` (`KodeBrg`) ON DELETE CASCADE,
  CONSTRAINT `fk_MStockBrg2` FOREIGN KEY (`KodeGd`) REFERENCES `tm_gudang` (`KodeGd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tm_stockbrg`
--

INSERT INTO `tm_stockbrg` VALUES ('001','K10000','GD',0.00,7.00,NULL,NULL,NULL,7,0,0,0,'Pack',NULL,NULL);

DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `groupstock` BEFORE UPDATE ON `tm_stockbrg` FOR EACH ROW BEGIN
		DECLARE K1, K2, K3 DECIMAL (10,2);
    DECLARE Sat1, Sat2, Sat3 VARCHAR(30);
		DECLARE Urut VARCHAR(6);
		DECLARE Proses VARCHAR(2);
		DECLARE Stc DECIMAL (10,2);
		SET Stc= IFNULL(new.StockAkhir,0);
		SELECT Konv1, Konv2, Konv3, Satuan1, Satuan2, Satuan3 INTO K1, K2, K3, Sat1, Sat2, Sat3 FROM tm_barang WHERE KodeBrg=new.KodeBrg;
		SET Urut = "000000";
		SET new.Stock0=0;
		SET new.Stock1=0;
		SET new.Stock2=0;
		SET new.Stock3=0;
 
		  
		IF (IFNULL(K1,0) > IFNULL(K2,0)) AND (IFNULL(K1,0) > IFNULL(K3,0)) THEN
		 SET Urut= INSERT(Urut, 1,2, "K1");
		END IF;
		IF (IFNULL(K2,0) > IFNULL(K1,0)) AND (IFNULL(K2,0) > IFNULL(K3,0)) THEN
		 SET Urut= INSERT(Urut, 1,2, "K2");
		END IF;
		IF (IFNULL(K3,0) > IFNULL(K1,0)) AND (IFNULL(K3,0) > IFNULL(K2,0)) THEN
		 SET Urut= INSERT(Urut, 1,2, "K3");
		END IF;
		IF (IFNULL(K1,0) < IFNULL(K2,0)) AND (IFNULL(K1,0) < IFNULL(K3,0)) THEN
		  SET Urut= INSERT(Urut, 5,2, "K1");
		END IF;
		IF (IFNULL(K2,0) < IFNULL(K1,0)) AND (IFNULL(K2,0) < IFNULL(K3,0)) THEN
		  SET Urut= INSERT(Urut, 5,2, "K2");
		END IF;
		IF (IFNULL(K3,0) < IFNULL(K1,0)) AND (IFNULL(K3,0) < IFNULL(K2,0)) THEN
		 SET Urut= INSERT(Urut, 5,2, "K3");
		END IF;
		IF (POSITION(1 IN Urut) = 0)  THEN
		 SET Urut= INSERT(Urut, 3, 2, "K1");
		END IF; 
		IF (POSITION(2 IN Urut) = 0)   THEN
		 SET Urut= INSERT(Urut, 3, 2, "K2");
		END IF;
		IF (POSITION(3 IN Urut)= 0)  THEN
		 SET Urut= INSERT(Urut, 3, 2, "K3");
		END IF;
		
		IF IFNULL(K1,0) = 0 THEN
		   SET Urut= REPLACE(Urut, "K1", "00");
		END IF;
                                     IF IFNULL(K2,0) = 0 THEN
		   SET Urut= REPLACE(Urut, "K2", "00");
		END IF;
		IF IFNULL(K3,0) = 0 THEN
		   SET Urut= REPLACE(Urut, "K3", "00");
		END IF;		
    SET new.NamaBrg=Urut;
		SET Proses= Left(Urut, 2);
		SET Urut = Right(Urut, Length(Urut)-2);
		IF Proses="K1" THEN
			SET new.Stock1= Stc DIV K1;
			SET Stc = Stc - (new.Stock1 * K1);
      SET new.SatuanStok1= Sat1;
				
		END IF; 
		IF Proses="K2" THEN
			SET new.Stock1= Stc DIV K2;
			SET Stc = Stc - (new.Stock1 * K2);
      SET new.SatuanStok1=Sat2;
				
		END IF; 
		IF Proses="K3" THEN
			SET new.Stock1= Stc DIV K3;
			SET Stc = Stc - (new.Stock1 * K3);
      SET new.SatuanStok1=Sat3;
				
		END IF; 
		SET Proses= Left(Urut, 2);
		SET Urut = Right(Urut, Length(Urut)-2);
		IF Proses="K1" THEN
			SET new.Stock2= Stc DIV K1;
			SET Stc = Stc - (new.Stock2 * K1);
		  SET new.SatuanStok2=Sat1;
		END IF; 
		IF Proses="K2" THEN
			SET new.Stock2= Stc DIV K2;
			SET Stc = Stc - (new.Stock2 * K2);
			SET new.SatuanStok2=Sat2;	
		END IF; 
		IF Proses="K3" THEN
			SET new.Stock2= Stc DIV K3;
			SET Stc = Stc - (new.Stock2 * K3);
			SET new.SatuanStok2=Sat3;	
		END IF; 
		SET Proses= Left(Urut, 2);
		SET Urut = Right(Urut, Length(Urut)-2);
		IF Proses="K1" THEN
			SET new.Stock3= Stc DIV K1;
			SET Stc = Stc - (new.Stock3 * K1);
				SET new.SatuanStok3=Sat1;
		END IF; 
		IF Proses="K2" THEN
			SET new.Stock3= Stc DIV K2;
			SET Stc = Stc - (new.Stock3 * K2);
				SET new.SatuanStok3=Sat2;
		END IF; 
		IF Proses="K3" THEN
			SET new.Stock3= Stc DIV K3;
			SET Stc = Stc - (new.Stock3 * K3);
				SET new.SatuanStok3=Sat3;
		END IF; 
                                     
                                   SET new.Stock0=Stc;
                                     IF New.Stock0 IS NULL THEN 
                                         SET new.Stock0 = 0;
                                     END IF;
                                     IF New.Stock1 IS NULL THEN 
                                         SET new.Stock1 = 0;
                                     END IF;
                                     IF New.Stock2 IS NULL THEN 
                                         SET new.Stock2 = 0;
                                     END IF;
                                     IF New.Stock3 IS NULL THEN 
                                         SET new.Stock3 = 0;
                                     END IF;
END */;;

DELIMITER ;

--
-- Table structure for table `tm_supplier`
--

CREATE TABLE `tm_supplier` (
  `KodeSupp` varchar(10) NOT NULL default '',
  `NamaSupp` varchar(50) default NULL,
  `Editnama` varchar(1) default NULL,
  `Alamat` varchar(50) default NULL,
  `Kota` varchar(30) default NULL,
  `Telp` varchar(30) default NULL,
  `Fax` varchar(30) default NULL,
  `email` varchar(50) default NULL,
  `webpage` varchar(50) default NULL,
  `SuppType` varchar(10) default NULL,
  `CreditLimit` double default NULL,
  `Defvalas` varchar(10) default NULL,
  `SyaratByr` int(11) default NULL,
  `Keterangan` varchar(100) default NULL,
  `Aktif` varchar(1) default 'Y',
  `Hutang` double default NULL,
  `HTAwal` double default NULL,
  `TglHtAwal` datetime default NULL,
  `AccHt` varchar(20) default NULL,
  `AccHtBG` varchar(20) default NULL,
  `AccHtDB` varchar(20) default NULL,
  `AccHtCR` varchar(20) default NULL,
  `AccHtTitip` varchar(20) default NULL,
  `DefD1` double default NULL,
  `DefD2` double default NULL,
  `DefD3` double default NULL,
  `DefD4` double default NULL,
  `DefTamb` double default NULL,
  `DefKetTamb` varchar(50) default NULL,
  `FieldSupp1` varchar(100) default NULL,
  `FieldSupp2` varchar(100) default NULL,
  `FieldSupp3` varchar(100) default NULL,
  `FieldSupp4` varchar(100) default NULL,
  `FieldSupp5` varchar(100) default NULL,
  `TotPoint` double default NULL,
  PRIMARY KEY  (`KodeSupp`),
  KEY `fk_MSupplier1` (`AccHt`),
  KEY `fk_MSupplier2` (`AccHtBG`),
  KEY `fk_MSupplier3` (`AccHtDB`),
  KEY `fk_MSupplier4` (`AccHtCR`),
  KEY `fk_MSupplier5` (`AccHtTitip`),
  CONSTRAINT `fk_MSupplier1` FOREIGN KEY (`AccHt`) REFERENCES `mperkiraan` (`Kode_perk`),
  CONSTRAINT `fk_MSupplier2` FOREIGN KEY (`AccHtBG`) REFERENCES `mperkiraan` (`Kode_perk`),
  CONSTRAINT `fk_MSupplier3` FOREIGN KEY (`AccHtDB`) REFERENCES `mperkiraan` (`Kode_perk`),
  CONSTRAINT `fk_MSupplier4` FOREIGN KEY (`AccHtCR`) REFERENCES `mperkiraan` (`Kode_perk`),
  CONSTRAINT `fk_MSupplier5` FOREIGN KEY (`AccHtTitip`) REFERENCES `mperkiraan` (`Kode_perk`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tm_supplier`
--

INSERT INTO `tm_supplier` VALUES ('001','Test','','','','','','','','',NULL,NULL,NULL,'','Y',111000,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);

--
-- Table structure for table `tm_teknisi`
--

CREATE TABLE `tm_teknisi` (
  `KodeTeknisi` varchar(20) NOT NULL default '',
  `NamaTeknisi` varchar(30) default NULL,
  PRIMARY KEY  (`KodeTeknisi`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tm_teknisi`
--


--
-- Table structure for table `tmenu`
--

CREATE TABLE `tmenu` (
  `menu_id` varchar(6) NOT NULL default '1',
  `menu` varchar(30) default NULL,
  `keterangan` varchar(50) default NULL,
  `Status_aktive` varchar(1) default NULL,
  PRIMARY KEY  (`menu_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tmenu`
--

INSERT INTO `tmenu` VALUES ('010000','file1','File','1'),('010100','login1','Login','1'),('010200','logout1','Logout','1'),('010300','rubahpassword1','Rubah Password','1'),('010400','settinguser1','Setting User','1'),('010500','settingleveluser1','Setting Level User','1'),('010600','formatrugilaba1','Format Laporan Rugi Laba','1'),('010700','konfigurasi1','Setting Konfigurasi','1'),('010800','konfigurasiproduk1','Konfigurasi Produk','0'),('010900','setup1','Setup','1'),('020000','master1','Master','1'),('020100','perkiraan1','Master Perkiraan','1'),('020200','supplier1','Master Supplier','1'),('020300','customer1','Master Customer','1'),('020400','barang1','Master Barang','1'),('020500','gudang1','Master Gudang','1'),('020600','groupbarang1','Master Grup Barang','1'),('020700','sales1','Master Sales','1'),('020800','persedianawal1','Persediaan Awal','1'),('020900','opnameawal1','Opname Awal','1'),('021000','barangswalayan1','Master Barang Swalayan','0'),('030000','akuntansi1','Akuntansi','1'),('030100','jurnalumum1','Transaksi Jurnal Umum','1'),('040000','pembelian1','Pembelian','1'),('040100','pembelian2','Transaksi Pembelian','1'),('040101','pembelianbuat1','Transaksi Pembelian Pembuatan','1'),('040102','pembelianedit1','Transaksi Pembelian Edit','1'),('040200','pembelianbayar1','Transaksi Pembayaran','1'),('040201','pembelianbayarbuat1','Transaksi Pembayaran Pembuatan','1'),('040202','pembelianbayaredit1','Transaksi Pembayaran Edit','1'),('040300','returbeli1','Transaksi Retur Beli','1'),('040301','returbelibuat1','Transaksi Retur Beli Pembuatan','1'),('040302','returbeliedit1','Transaksi Retur Beli Edit','1'),('040400','diganti1','Transaksi Replace Returan','1'),('040401','gantipembuatan1','Transaksi Replace Returan Pembuatan','1'),('040402','gantiedit1','Transaksi Replace Returan Edit','1'),('040500','purchaseorder1','Transaksi Purchase Order','1'),('040501','purchaseorderbuat1','Transaksi Purchase Order Pembuatan','1'),('040502','purchaseorderedit1','Transaksi Purchase Order Edit','1'),('050000','penjualan1','Penjualan','1'),('050100','PenjualanRetail1','Transaksi Penjualan Retail Swalayan','1'),('050101','PenjualanRetailBuat1','Transaksi Penjualan Retail Swalayan Pembuatan','1'),('050102','PenjualanRetailEdit1','Transaksi Penjualan Retail Swalayan Edit','1'),('050200','ReturJualRetail1','Transaksi Retur Jual Retail','1'),('050201','ReturJualRetailBuat1','Transaksi Retur Jual Retail Pembuatan','1'),('050202','ReturJualRetailEdit1','Transaksi Retur Jual Retail Edit','1'),('050300','SalesOrderGrosir1','Transaksi Sales Order','0'),('050301','SalesOrderGrosirBuat1','Transaksi Sales Order Pembuatan','1'),('050302','SalesOrderGrosirEdit1','Transaksi Sales Order Edit','1'),('050400','PenjualanGrosir1','Transaksi Penjualan Grosir','1'),('050401','PenjualanGrosirBuat1','Transaksi Penjualan Grosir Pembuatan','1'),('050402','PenjualanGrosirEdit1','Transaksi Penjualan Grosir Edit','1'),('050500','ReturJualGrosir1','Transaksi Retur Jual Grosir','1'),('050501','ReturJualGrosirBuat1','Transaksi Retur Jual Grosir Pembuatan','1'),('050502','ReturJualGrosirEdit1','Transaksi Retur Jual Grosir Edit','1'),('050600','PenjualanGrosirBayar1','Transaksi Pembayaran Penjualan Grosir','1'),('050601','PenjualanGrosirBayarBuat1','Transaksi Pembayaran Penjualan Grosir Pembuatan','1'),('050602','PenjualanGrosirBayarEdit1','Transaksi Pembayaran Penjualan Grosir Edit','1'),('050700','SalesOrderRakitan1','Transaksi Sales Order Rakitan','1'),('050701','SalesOrderRakitanBuat1','Transaksi Sales Order Rakitan Pembuatan','1'),('050702','SalesOrderRakitanEdit1','Transaksi Sales Order Rakitan Edit','1'),('050800','PenjualanRakitan1','Transaksi Penjualan Rakitan','1'),('050801','PenjualanRakitanMaster1','Transaksi Penjualan Rakitan Master','1'),('050802','PenjualanRakitanBuat1','Transaksi Penjualan Rakitan Buat','1'),('050803','PenjualanRakitanEdit1','Transaksi Penjualan Rakitan Edit','1'),('050900','ReturJualRakitan1','Transaksi Retur Jual Rakitan','1'),('050901','ReturJualRakitanBuat1','Transaksi Retur Jual Rakitan Pembuatan','1'),('050902','ReturJualRakitanEdit1','Transaksi Retur Jual Rakitan Edit','1'),('051000','PenjualanRakitanBayar1','Transaksi Pembayaran Penjualan Rakitan','1'),('051001','PenjualanRakitanBayarBuat1','Transaksi Pembayaran Penjualan Rakitan Pembuatan','1'),('051002','PenjualanRakitanBayarEdit1','Transaksi Pembayaran Penjualan Rakitan Edit','1'),('060000','laporan1','Laporan','1'),('060100','lapakuntansi1','Akuntansi','1'),('060101','perkiraan2','Laporan Perkiraan','1'),('060102','laporanjurnal1','Laporan Jurnal Umum','1'),('060103','bukubesarpembantu1','Laporan Buku Besar Pembantu','1'),('060104','bukubesar1','Laporan Buku Besar','1'),('060105','neraca1','Laporan Neraca','1'),('060106','rincianneraca1','Laporan Rincian Neraca','1'),('060107','rugilaba1','Laporan Rugi Laba','1'),('060108','rincianrugilaba1','Laporan Rincian Rugi Laba','1'),('060200','lapcustomer1','Laporan Customer','1'),('060300','lapsupplier1','Laporan Supplier','1'),('060400','lapbarang1','Laporan Barang','1'),('060401','lapkartustock1','Laporan Kartu Stock','1'),('060402','lapposisistock1','Laporan Posisi Stock','1'),('060403','stockminim1','Laporan Stock Minim','1'),('060500','laphutang1','Laporan Hutang','1'),('060501','lapkartuhutang1','Laporan Kartu Hutang','1'),('060502','lapposisihutang1','Laporan Posisi Hutang','1'),('060503','lapumurhutang1','Laporan Umur Hutang','1'),('060600','lappiutang1','Laporan Piutang','1'),('060601','lapkartupiutang1','Laporan Kartu Piutang','1'),('060602','lapposisipiutang1','Laporan Posisi Piutang','1'),('060603','lapumurpiutang1','Laporan Umur Piutang','1'),('060700','lappembelian1','Laporan Pembelian','1'),('060701','lappembelianbeli1','Laporan Pembelian beli','1'),('060702','lappembelianretur1','Laporan Pembelian retur','1'),('060703','lappembelianbayar1','Laporan Pembelian bayar','1'),('060800','lappenjualanretail1','Laporan Penjualan Retail','1'),('060801','lappenjualanretailjual1','Laporan Penjualan Retail Jual','1'),('060802','lappenjualanretailretur1','Laporan Penjualan Retail Retur','1'),('060900','lappenjualangrosir1','Laporan Penjualan Grosir','1'),('060901','lappenjualangrosirso1','Laporan Penjualan Grosir Sales Order','1'),('060902','lappenjualangrosirjual1','Laporan Penjualan Grosir Jual','1'),('060903','lappenjualangrosirretur1','Laporan Penjualan Grosir Retur','1'),('060904','lappenjualangrosirbayar1','Laporan Penjualan Grosir Bayar','1'),('061000','lappenjualanrakitan1','Laporan Penjualan Rakitan','1'),('061001','lappenjualanrakitanso1','Laporan Penjualan Rakitan Sales Order','1'),('061002','lappenjualanrakitanjual1','Laporan Penjualan Rakitan Jual','1'),('061003','lappenjualanrakitanretur1','Laporan Penjualan Rakitan Retur','1'),('061004','lappenjualanrakitanbayar1','Laporan Penjualan Rakitan Bayar','1'),('061100','lapanalisapenjualan1','Laporan Analisa Penjualan','1'),('061101','lapanalisapenjualanrugilaba1','Laporan Analisa Penjualan Rugi Laba Detail','1'),('061102','lapanalisarlsummary1','Laporan Analisa Penj. Rugi Laba Summary','1'),('061103','lapanalisapenjualanjual1','Laporan Analisa Penjualan Jual','0'),('061104','lapmutasigudang1','Laporan Mutasi Gudang','1'),('070000','proses1','Proses','1'),('070100','postingharian1','Proses Posting Harian','1'),('070200','akhirtahun1','Proses Akhir Tahun','1'),('070300','tutupbuku1','Proses Tutup Buku','0'),('070400','ValidasiJurnal1','Proses Valiasi Jurnal','1'),('070500','koreksivalidasijurnal1','Proses Koreksi Validasi Jurnal','1'),('070600','pemindahbukuan1','Proses Pemindah Bukuan Simp Berjangka','1'),('070700','penyesuaian1','Proses Penyesuaian','0'),('080000','utility1','Utility','1'),('080100','repairdatabase1','Utility Repair Database','1'),('080200','backup1','Utility BackUp Database','1'),('080300','restore1','Utility Restore Database','1'),('090000','lainlain1','Lain-Lain','1'),('090100','mutasigudang1','Mutasi Gudang','1'),('090101','mutasigudangbuat1','Mutasi Gudang Pembuatan','1'),('090102','mutasigudangedit1','Mutasi Gudang Edit','1'),('090200','barangrusak1','Barang Rusak','0'),('090201','barangrusakbuat1','Barang Rusak Pembuatan','0'),('090202','barangrusakedit1','Barang Rusak Edit','0'),('090203','log1','Log Transaksi','1'),('090300','koreksistock1','Transaksi Koreksi Stock','1'),('090301','koreksistockbuat1','Transaksi Koreksi Stock Pembuatan','1'),('090302','koreksistockedit1','Transaksi Edit Koreksi Stock','1'),('090303','point1','Laporan Point','1'),('090304','penukaranpoint','Tukar Point','1'),('090305','KartuPoint1','Kartu Point','1'),('100000','pembayaran1','Pembayaran','1'),('110000','keluar1','Keluar Program','1');

--
-- Table structure for table `totoritas`
--

CREATE TABLE `totoritas` (
  `Trans` varchar(3) NOT NULL,
  `NoBukti` varchar(11) NOT NULL,
  `TglTrans` datetime default NULL,
  `Acc1` varchar(30) default NULL,
  `Acc2` varchar(30) default NULL,
  `Acc3` varchar(30) default NULL,
  `Acc4` varchar(30) default NULL,
  `Acc5` varchar(30) default NULL,
  `Acc6` varchar(30) default NULL,
  `Acc7` varchar(30) default NULL,
  `Acc8` varchar(30) default NULL,
  `Acc9` varchar(30) default NULL,
  `TglAcc1` datetime default NULL,
  `TglAcc2` datetime default NULL,
  `TglAcc3` datetime default NULL,
  `TglAcc4` datetime default NULL,
  `TglAcc5` datetime default NULL,
  `TglAcc6` datetime default NULL,
  `TglAcc7` datetime default NULL,
  `TglAcc8` datetime default NULL,
  `TglAcc9` datetime default NULL,
  PRIMARY KEY  (`Trans`,`NoBukti`),
  KEY `NoBukti` (`NoBukti`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `totoritas`
--


--
-- Table structure for table `tr_ambilpoint`
--

CREATE TABLE `tr_ambilpoint` (
  `NoAmbil` varchar(15) NOT NULL,
  `KodeCust` varchar(25) default NULL,
  `Namacust` varchar(100) default NULL,
  `AlamatCust` varchar(200) default NULL,
  `TakePoint` double default NULL,
  `TglTukar` datetime default NULL,
  PRIMARY KEY  (`NoAmbil`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_ambilpoint`
--


DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `addAmbilPoint` AFTER INSERT ON `tr_ambilpoint` FOR EACH ROW Begin
Update tm_customer set PointAmbil = ifnull(PointAmbil,0)+(new.TakePoint) where kodecust = new.kodecust;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `UpdAmbilPoint` AFTER UPDATE ON `tr_ambilpoint` FOR EACH ROW Begin
Update tm_customer set PointAmbil = ifnull(PointAmbil,0)-(old.TakePoint) where kodecust = old.kodecust;
Update tm_customer set PointAmbil = ifnull(PointAmbil,0)+(new.TakePoint) where kodecust = new.kodecust;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DelAmbilPoint` AFTER DELETE ON `tr_ambilpoint` FOR EACH ROW Begin
Update tm_customer set PointAmbil = ifnull(PointAmbil,0)-(old.TakePoint) where kodecust = old.kodecust;
end */;;

DELIMITER ;

--
-- Table structure for table `tr_barangrusak_d`
--

CREATE TABLE `tr_barangrusak_d` (
  `NoBarangRusak` varchar(11) NOT NULL default '',
  `ItemDet` int(11) NOT NULL default '0',
  `KodeBrg` varchar(20) NOT NULL,
  `KodeGdAsal` varchar(5) NOT NULL,
  `Jumlah` double default NULL,
  `Satuan` varchar(10) NOT NULL,
  `Hpp` double default NULL,
  `Konv` double default NULL,
  PRIMARY KEY  (`NoBarangRusak`,`ItemDet`),
  KEY `fk_BarangRusak_d2` (`KodeBrg`),
  KEY `fk_BarangRusak_d3` (`KodeGdAsal`),
  CONSTRAINT `fk_BarangRusak_d1` FOREIGN KEY (`NoBarangRusak`) REFERENCES `tr_barangrusak_m` (`NoBarangRusak`) ON DELETE CASCADE,
  CONSTRAINT `fk_BarangRusak_d2` FOREIGN KEY (`KodeBrg`) REFERENCES `tm_barang` (`KodeBrg`),
  CONSTRAINT `fk_BarangRusak_d3` FOREIGN KEY (`KodeGdAsal`) REFERENCES `tm_gudang` (`KodeGd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_barangrusak_d`
--


--
-- Table structure for table `tr_barangrusak_m`
--

CREATE TABLE `tr_barangrusak_m` (
  `NoBarangRusak` varchar(11) NOT NULL default '',
  `TglBarangRusak` datetime default NULL,
  `Keterangan` varchar(200) default NULL,
  `TglBatal` datetime default NULL,
  PRIMARY KEY  (`NoBarangRusak`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_barangrusak_m`
--


--
-- Table structure for table `tr_bayarbeli_d`
--

CREATE TABLE `tr_bayarbeli_d` (
  `NoBayarB` varchar(11) NOT NULL default '',
  `ItemDBayarB` int(11) NOT NULL default '0',
  `KodeByr` varchar(10) default NULL,
  `NoBG` varchar(20) default NULL,
  `Bank` varchar(20) default NULL,
  `Trans` varchar(2) default NULL,
  `NoBukti` varchar(11) default NULL,
  `TglJT` datetime default NULL,
  `Nilai` double default NULL,
  `Valas` varchar(10) default NULL,
  `ExRate` double default NULL,
  `TglLunas` datetime default NULL,
  PRIMARY KEY  (`NoBayarB`,`ItemDBayarB`),
  KEY `fk_Tr_BayarBeli_D1` (`NoBayarB`),
  CONSTRAINT `fk_Tr_BayarBeli_D1` FOREIGN KEY (`NoBayarB`) REFERENCES `tr_bayarbeli_m` (`NoBayarB`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_bayarbeli_d`
--


--
-- Table structure for table `tr_bayarbeli_m`
--

CREATE TABLE `tr_bayarbeli_m` (
  `NoBayarB` varchar(11) NOT NULL default '',
  `TglBayarB` datetime default NULL,
  `KodeSupp` varchar(10) default NULL,
  `Keterangan` varchar(200) default NULL,
  `TglBatal` datetime default NULL,
  `NoIDJurnal` varchar(10) default NULL,
  `NoIDJurnalB` varchar(10) default NULL,
  PRIMARY KEY  (`NoBayarB`),
  KEY `fk_BayarBeli` (`KodeSupp`),
  CONSTRAINT `fk_BayarBeli` FOREIGN KEY (`KodeSupp`) REFERENCES `tm_supplier` (`KodeSupp`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_bayarbeli_m`
--


--
-- Table structure for table `tr_bayarjual_d`
--

CREATE TABLE `tr_bayarjual_d` (
  `NoBayarJ` varchar(11) NOT NULL default '',
  `ItemDBayarJ` int(11) NOT NULL default '0',
  `KodeByr` varchar(10) default NULL,
  `KodeRek` varchar(20) default NULL,
  `NoBG` varchar(20) default NULL,
  `Bank` varchar(20) default NULL,
  `Trans` varchar(2) default NULL,
  `NoBukti` varchar(11) default NULL,
  `TglJT` datetime default NULL,
  `Nilai` double default NULL,
  `Valas` varchar(10) default NULL,
  `ExRate` double default NULL,
  `TglLunas` datetime default NULL,
  PRIMARY KEY  (`NoBayarJ`,`ItemDBayarJ`),
  KEY `fk_Tr_BayarJual_D1` (`NoBayarJ`),
  CONSTRAINT `fk_Tr_BayarJual_D2` FOREIGN KEY (`NoBayarJ`) REFERENCES `tr_bayarjual_m` (`NoBayarJ`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_bayarjual_d`
--


--
-- Table structure for table `tr_bayarjual_m`
--

CREATE TABLE `tr_bayarjual_m` (
  `NoBayarJ` varchar(11) NOT NULL default '',
  `TglBayarJ` datetime default NULL,
  `KodeCust` varchar(10) default NULL,
  `Keterangan` varchar(200) default NULL,
  `TglBatal` datetime default NULL,
  `NOiDJurnal` varchar(10) default NULL,
  `NoIDJurnalB` varchar(10) default NULL,
  PRIMARY KEY  (`NoBayarJ`),
  KEY `fk_Tr_BayarJual_M1` (`KodeCust`),
  CONSTRAINT `fk_Tr_BayarJual_M2` FOREIGN KEY (`KodeCust`) REFERENCES `tm_customer` (`KodeCust`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_bayarjual_m`
--


--
-- Table structure for table `tr_bayarjualrakitan_d`
--

CREATE TABLE `tr_bayarjualrakitan_d` (
  `NoBayarJ` varchar(11) NOT NULL default '',
  `ItemDBayarJ` int(11) NOT NULL default '0',
  `KodeByr` varchar(10) default NULL,
  `KodeRek` varchar(20) default NULL,
  `NoBG` varchar(20) default NULL,
  `Bank` varchar(20) default NULL,
  `Trans` varchar(2) default NULL,
  `NoBukti` varchar(11) default NULL,
  `TglJT` datetime default NULL,
  `Nilai` double default NULL,
  `Valas` varchar(10) default NULL,
  `ExRate` double default NULL,
  `TglLunas` datetime default NULL,
  PRIMARY KEY  (`NoBayarJ`,`ItemDBayarJ`),
  KEY `fk_Tr_BayarJual_D1` (`NoBayarJ`),
  CONSTRAINT `fk_Tr_BayarJualrakitan_D2` FOREIGN KEY (`NoBayarJ`) REFERENCES `tr_bayarjualrakitan_m` (`NoBayarJ`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_bayarjualrakitan_d`
--


--
-- Table structure for table `tr_bayarjualrakitan_m`
--

CREATE TABLE `tr_bayarjualrakitan_m` (
  `NoBayarJ` varchar(11) NOT NULL default '',
  `TglBayarJ` datetime default NULL,
  `KodeCust` varchar(10) default NULL,
  `Keterangan` varchar(200) default NULL,
  `TglBatal` datetime default NULL,
  `NOiDJurnal` varchar(10) default NULL,
  `NoIDJurnalB` varchar(10) default NULL,
  PRIMARY KEY  (`NoBayarJ`),
  KEY `fk_Tr_BayarJualrakitan_M1` (`KodeCust`),
  CONSTRAINT `fk_Tr_BayarJualRakitan_M2` FOREIGN KEY (`KodeCust`) REFERENCES `tm_customer` (`KodeCust`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_bayarjualrakitan_m`
--


--
-- Table structure for table `tr_beli_d`
--

CREATE TABLE `tr_beli_d` (
  `TransBeli` varchar(2) NOT NULL default '',
  `NoBeli` varchar(11) NOT NULL default '',
  `ItemBeli` int(11) NOT NULL default '0',
  `NoPO` varchar(11) default NULL,
  `ItemPO` int(11) default NULL,
  `KodeBrg` varchar(20) NOT NULL,
  `KodeGd` varchar(5) NOT NULL,
  `NamaBrg` varchar(50) default NULL,
  `Harga` double default NULL,
  `Disc` double default NULL,
  `Jml` double default NULL,
  `JmlTitip` double default NULL,
  `Satuan` varchar(10) NOT NULL,
  `Konv` double default NULL,
  `Diretur` double default NULL,
  `total` double default NULL,
  `hargajual` double default NULL,
  PRIMARY KEY  (`TransBeli`,`NoBeli`,`ItemBeli`),
  KEY `idx_tr_Beli_d1` (`KodeGd`),
  KEY `idx_tr_Beli_d2` (`KodeGd`),
  KEY `idx_tr_Beli_d3` (`KodeBrg`),
  CONSTRAINT `fk_tr_Beli_d1` FOREIGN KEY (`TransBeli`, `NoBeli`) REFERENCES `tr_beli_m` (`TransBeli`, `NoBeli`) ON DELETE CASCADE,
  CONSTRAINT `fk_tr_Beli_d2` FOREIGN KEY (`KodeGd`) REFERENCES `tm_gudang` (`KodeGd`),
  CONSTRAINT `fk_tr_Beli_d3` FOREIGN KEY (`KodeBrg`) REFERENCES `tm_barang` (`KodeBrg`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_beli_d`
--

INSERT INTO `tr_beli_d` VALUES ('BT','72400001',1,NULL,NULL,'001','GD','Test',10000,0,10,NULL,'Pcs',1,NULL,100000,NULL);

DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetBeliAdd` AFTER INSERT ON `tr_beli_d` FOR EACH ROW BEGIN
DECLARE HargaLama DOUBLE;
DECLARE StockLama DOUBLE;
DECLARE HitungLama DOUBLE;
DECLARE HargaBaru DOUBLE;
DECLARE JumlahBaru DOUBLE;
DECLARE HitungBaru DOUBLE;
DECLARE StockHasil DOUBLE;
DECLARE HitungHasil DOUBLE;
DECLARE HargaHasil DOUBLE;
DECLARE vTemp DOUBLE;
SET HargaLama=(SELECT ifnull(HargaAvg,0) FROM tm_barang WHERE KodeBrg=new.KodeBrg);
IF HargaLama is NULL THEN 
   SET HargaLama=0;
END IF;
SET StockLama=(SELECT ifnull(StockAkhir,0) FROM tm_StockBrg WHERE KodeBrg=new.KodeBrg and KodeGD=new.KodeGD);
IF (StockLama is NULL) and (StockLama <= 0) THEN 
   SET StockLama=0;
END IF;
SET HitungLama=HargaLama * StockLama;
SET HargaBaru=ifnull(new.Harga,0)/ifnull(new.konv,1);
SET JumlahBaru=ifnull(new.Jml,0) *ifnull( new.Konv,1);
SET HitungBaru=HargaBaru * JumlahBaru;
SET StockHasil=StockLama + JumlahBaru;
SET HitungHasil=HitungLama + HitungBaru;
SET HargaHasil= HitungHasil / StockHasil;
UPDATE tm_barang SET HargaAvg=HargaHasil WHERE KodeBrg=new.KodeBrg;
SELECT COUNT(*) into vTemp FROM tm_stockbrg WHERE kodebrg=new.kodebrg and kodeGd=new.KodeGD;
IF vTemp>0 THEN
     UPDATE tm_stockbrg SET stockakhir=ifnull(stockakhir,0) + JumlahBaru WHERE kodebrg=new.kodebrg and kodegd=new.kodegd;
END IF;
IF vTemp <=0 THEN
    INSERT INTO tm_stockbrg(kodebrg, kodegd, stockakhir) VALUES(new.kodebrg,new.kodegd,JumlahBaru);
END IF;
END */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetBeliUpdate` AFTER UPDATE ON `tr_beli_d` FOR EACH ROW BEGIN
DECLARE HargaLama DOUBLE;
DECLARE StockLama DOUBLE;
DECLARE HitungLama DOUBLE;
DECLARE HargaBaru DOUBLE;
DECLARE JumlahBaru DOUBLE;
DECLARE HitungBaru DOUBLE;
DECLARE StockHasil DOUBLE;
DECLARE HitungHasil DOUBLE;
DECLARE HargaHasil DOUBLE;
SET HargaHasil=(SELECT HargaAvg FROM tm_barang WHERE KodeBrg=old.KodeBrg);
SET StockHasil=(SELECT StockAkhir FROM tm_StockBrg WHERE KodeBrg=old.KodeBrg and KodeGD=old.KodeGD);
SET HitungHasil=HargaHasil*StockHasil;
SET HargaBaru=old.Harga/old.konv;
SET JumlahBaru=old.jml * old.konv;
SET HitungBaru=HargaBaru * JumlahBaru;
SET HitungLama=HitungHasil-HitungBaru;
SET StockLama=StockHasil-JumlahBaru;
SET HargaLama=HitungLama/StockLama;
UPDATE tm_barang SET HargaAvg=HargaLama WHERE KodeBrg=old.KodeBrg;
UPDATE tm_stockbrg SET StockAkhir=ifnull(StockAkhir,0) - JumlahBaru WHERE KodeBrg=old.KodeBrg and KodeGD=old.KodeGD;
SET HargaLama=(SELECT HargaAvg FROM tm_barang WHERE KodeBrg=new.KodeBrg);
SET StockLama=(SELECT StockAkhir FROM tm_StockBrg WHERE KodeBrg=new.KodeBrg and KodeGD=new.KodeGD);
SET HitungLama=HargaLama * StockLama;
SET HargaBaru=new.Harga/new.konv;
SET JumlahBaru=new.Jml * new.Konv;
SET HitungBaru=HargaBaru * JumlahBaru;
SET StockHasil=StockLama + JumlahBaru;
SET HitungHasil=HitungLama + HitungBaru;
SET HargaHasil= HitungHasil / StockHasil;
UPDATE tm_barang SET HargaAvg=HargaBaru WHERE KodeBrg=new.KodeBrg;
UPDATE tm_stockbrg SET StockAkhir=ifnull(stockakhir,0) + JumlahBaru WHERE KodeBrg=new.KodeBrg and KodeGD=new.KodeGD;
END */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetBeliDelete` AFTER DELETE ON `tr_beli_d` FOR EACH ROW BEGIN
DECLARE HargaLama DOUBLE;
DECLARE StockLama DOUBLE;
DECLARE HitungLama DOUBLE;
DECLARE HargaBaru DOUBLE;
DECLARE JumlahBaru DOUBLE;
DECLARE HitungBaru DOUBLE;
DECLARE StockHasil DOUBLE;
DECLARE HitungHasil DOUBLE;
DECLARE HargaHasil DOUBLE;
SET HargaHasil=(SELECT HargaAvg FROM tm_barang WHERE KodeBrg=old.KodeBrg);
SET StockHasil=(SELECT StockAkhir FROM tm_StockBrg WHERE KodeBrg=old.KodeBrg and KodeGD=old.KodeGD);
SET HitungHasil=HargaHasil*StockHasil;
SET HargaBaru=old.Harga/old.konv;
SET JumlahBaru=old.jml * old.konv;
SET HitungBaru=HargaBaru * JumlahBaru;
SET HitungLama=HitungHasil-HitungBaru;
SET StockLama=StockHasil-JumlahBaru;
SET HargaLama=HitungLama/StockLama;
UPDATE tm_barang SET HargaAvg=HargaLama WHERE KodeBrg=old.KodeBrg;
UPDATE tm_stockbrg SET StockAkhir=ifnull(StockAkhir,0) - JumlahBaru WHERE KodeBrg=old.KodeBrg and KodeGD=old.KodeGD;
END */;;

DELIMITER ;

--
-- Table structure for table `tr_beli_m`
--

CREATE TABLE `tr_beli_m` (
  `TransBeli` varchar(2) NOT NULL default '',
  `NoBeli` varchar(11) NOT NULL default '',
  `TglBeli` datetime default NULL,
  `TglBatal` datetime default NULL,
  `KodeSupp` varchar(10) default NULL,
  `NamaSupp` varchar(50) default NULL,
  `Keterangan` varchar(100) default NULL,
  `NoSJ` varchar(30) default NULL,
  `TglJT` datetime default NULL,
  `DiscRp` double default NULL,
  `Tambahan` double default NULL,
  `KetTambahan` varchar(50) default NULL,
  `PPN` double default NULL,
  `Nilai` double default NULL,
  `Sisa` double default NULL,
  `NPWP` varchar(20) default NULL,
  `NoTitip` varchar(11) default NULL,
  `NilaiTitip` double default NULL,
  `Valas` varchar(10) default NULL,
  `ExRate` double default NULL,
  `PPNRps` double default NULL,
  `TipePPN` varchar(3) default NULL,
  `NoFPajak` varchar(20) default NULL,
  `TglFPajak` datetime default NULL,
  PRIMARY KEY  (`TransBeli`,`NoBeli`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_beli_m`
--

INSERT INTO `tr_beli_m` VALUES ('BT','72400001','2024-02-07 00:00:00',NULL,'001','Test','','12313','2024-02-07 00:00:00',0,0,NULL,11,111000,111000,NULL,NULL,NULL,'',1,11000,NULL,NULL,NULL);

DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `TrBeliAdd` AFTER INSERT ON `tr_beli_m` FOR EACH ROW BEGIN
  Update tm_Supplier set Hutang =  ifnull(hutang,0) + (new.nilai * new.exrate) 
  where kodesupp = new.kodesupp;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `TrBeliUpdate` AFTER UPDATE ON `tr_beli_m` FOR EACH ROW BEGIN
  Update tm_Supplier set Hutang =  ifnull(hutang,0) + (new.nilai * new.exrate)
  where kodesupp = new.kodesupp;
  Update tm_Supplier set Hutang =  ifnull(hutang,0) - (old.nilai * old.exrate)
  where kodesupp = old.kodesupp;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `TrBeliDelete` AFTER DELETE ON `tr_beli_m` FOR EACH ROW BEGIN
  Update tm_Supplier set Hutang =  ifnull(hutang,0) - (Old.nilai * Old.exrate) 
  where kodesupp = Old.kodesupp;
end */;;

DELIMITER ;

--
-- Table structure for table `tr_buanggd_d`
--

CREATE TABLE `tr_buanggd_d` (
  `NoBuangGd` varchar(11) NOT NULL default '',
  `ItemDet` int(11) NOT NULL default '0',
  `KodeBrg` varchar(20) NOT NULL,
  `KodeGdAsal` varchar(5) NOT NULL,
  `Jumlah` double default NULL,
  `Harga` double default NULL,
  `Satuan` varchar(10) NOT NULL,
  `Hpp` double default NULL,
  `Konv` double default NULL,
  PRIMARY KEY  (`NoBuangGd`,`ItemDet`),
  KEY `fk_Tr_BuangGd_d2` (`KodeBrg`),
  KEY `fk_Tr_BuangGd_d3` (`KodeGdAsal`),
  CONSTRAINT `fk_Tr_BuangGd_d1` FOREIGN KEY (`NoBuangGd`) REFERENCES `tr_buanggd_m` (`NoBuangGd`) ON DELETE CASCADE,
  CONSTRAINT `fk_Tr_BuangGd_d2` FOREIGN KEY (`KodeBrg`) REFERENCES `tm_barang` (`KodeBrg`),
  CONSTRAINT `fk_Tr_BuangGd_d3` FOREIGN KEY (`KodeGdAsal`) REFERENCES `tm_gudang` (`KodeGd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_buanggd_d`
--


DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetBuangGdAdd` AFTER INSERT ON `tr_buanggd_d` FOR EACH ROW BEGIN
  Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)-new.jumlah*new.konv where kodeGd= new.KodeGDAsal and kodebrg=new.kodebrg;
END */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetBuangGdUpdate` AFTER UPDATE ON `tr_buanggd_d` FOR EACH ROW BEGIN
  Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)+old.Jumlah*old.konv where kodeGd= old.KodeGDasal and kodebrg=old.kodebrg;
  Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)-new.Jumlah*new.konv where kodeGd= new.KodeGDasal and kodebrg=new.kodebrg;
END */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetBuangGdDelete` AFTER DELETE ON `tr_buanggd_d` FOR EACH ROW BEGIN
  Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)+old.Jumlah*old.konv where kodeGd= old.KodeGDAsal and kodebrg=old.kodebrg;
END */;;

DELIMITER ;

--
-- Table structure for table `tr_buanggd_m`
--

CREATE TABLE `tr_buanggd_m` (
  `NoBuangGd` varchar(11) NOT NULL default '',
  `TglBuangGd` datetime default NULL,
  `Keterangan` varchar(200) default NULL,
  `TglBatal` datetime default NULL,
  PRIMARY KEY  (`NoBuangGd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_buanggd_m`
--


--
-- Table structure for table `tr_data`
--

CREATE TABLE `tr_data` (
  `Notrans` varchar(20) NOT NULL,
  `KodeCust` varchar(10) default NULL,
  `Kodebrg` varchar(10) default NULL,
  `NoSeriBrg` varchar(50) default NULL,
  `TglMasuk` date default NULL,
  `TglKeluar` date default NULL,
  `SparePart` varchar(50) default NULL,
  `Kerusakan` varchar(200) default NULL,
  `Teknisi` varchar(50) default NULL,
  `Spesifikasi` text,
  PRIMARY KEY  (`Notrans`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_data`
--


--
-- Table structure for table `tr_destmodx`
--

CREATE TABLE `tr_destmodx` (
  `NoModx` varchar(11) NOT NULL default '',
  `ItemModX` int(11) NOT NULL default '0',
  `Kodebrg` varchar(20) NOT NULL,
  `KodeGd` varchar(5) NOT NULL,
  `Jumlah` double default NULL,
  `Satuan` varchar(10) NOT NULL,
  `Konv` double default NULL,
  `BagHarga` double default NULL,
  PRIMARY KEY  (`NoModx`,`ItemModX`),
  KEY `fk_DestModX2` (`Kodebrg`),
  KEY `fk_DestModX3` (`KodeGd`),
  CONSTRAINT `fk_DestModX1` FOREIGN KEY (`NoModx`) REFERENCES `tr_modx` (`NoModX`) ON DELETE CASCADE,
  CONSTRAINT `fk_DestModX2` FOREIGN KEY (`Kodebrg`) REFERENCES `tm_barang` (`KodeBrg`),
  CONSTRAINT `fk_DestModX3` FOREIGN KEY (`KodeGd`) REFERENCES `tm_gudang` (`KodeGd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_destmodx`
--


--
-- Table structure for table `tr_jual_d`
--

CREATE TABLE `tr_jual_d` (
  `TransJual` varchar(2) NOT NULL default '',
  `NoJual` varchar(11) NOT NULL default '',
  `ItemJual` int(11) NOT NULL default '0',
  `NOPO` varchar(11) default NULL,
  `ItemPO` int(11) default NULL,
  `KodeBrg` varchar(20) NOT NULL,
  `KodeGd` varchar(5) NOT NULL,
  `NamaBrg` varchar(50) default NULL,
  `Harga` double default NULL,
  `Disc` double default NULL,
  `DiscPersen` double default NULL,
  `Jml` double default NULL,
  `JmlTitip` double default NULL,
  `Satuan` varchar(10) NOT NULL,
  `Konv` double default NULL,
  `HargaAvg` double default NULL,
  `Diretur` double default NULL,
  `HPP` double default NULL,
  `HargaPeny` double default NULL,
  `JmlPeny` double default NULL,
  `Sales` varchar(50) default NULL,
  `Teknisi` varchar(50) default NULL,
  PRIMARY KEY  (`TransJual`,`NoJual`,`ItemJual`),
  KEY `fk_tr_Jual_d1` (`KodeBrg`),
  KEY `fk_tr_Jual_d2` (`KodeGd`),
  KEY `fk_tr_Jual_d4` (`NOPO`,`ItemPO`),
  KEY `tr_jual_d_idx1` (`NoJual`),
  CONSTRAINT `fk_tr_Jual_d1` FOREIGN KEY (`KodeBrg`) REFERENCES `tm_barang` (`KodeBrg`),
  CONSTRAINT `fk_tr_Jual_d2` FOREIGN KEY (`KodeGd`) REFERENCES `tm_gudang` (`KodeGd`),
  CONSTRAINT `fk_tr_Jual_d3` FOREIGN KEY (`TransJual`, `NoJual`) REFERENCES `tr_jual_m` (`TransJual`, `NoJual`) ON DELETE CASCADE,
  CONSTRAINT `fk_tr_Jual_d4` FOREIGN KEY (`NOPO`, `ItemPO`) REFERENCES `tr_pojual_d` (`NoPO`, `ItemPO`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_jual_d`
--

INSERT INTO `tr_jual_d` VALUES ('JT','7240130001',1,NULL,NULL,'001','GD','Test',11000,0,0,1,NULL,'Pcs',1,10000,NULL,NULL,NULL,NULL,NULL,NULL),('JT','7240207001',1,NULL,NULL,'001','GD','Test',11000,0,0,1,NULL,'Pcs',1,10000,NULL,NULL,NULL,NULL,NULL,NULL);

DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetJualAdd` AFTER INSERT ON `tr_jual_d` FOR EACH ROW BEGIN
 DECLARE vtemp double;
 select stockakhir-new.jml into vtemp from tm_stockbrg where kodebrg=new.kodebrg and kodeGd= new.KodeGD;
if (select jenisbrg from tm_barang where kodebrg=new.KodeBrg)="Inventory" then
    Update tm_stockbrg set Stockakhir =  stockakhir-(new.jml*ifnull(new.konv,1))
    where kodebrg=new.kodebrg and kodeGd= new.KodeGD;
end if;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetJualUpdate` AFTER UPDATE ON `tr_jual_d` FOR EACH ROW BEGIN
 DECLARE vtemp double;
 select stockakhir-(new.jml-old.jml) into vtemp from tm_stockbrg where kodebrg=new.kodebrg and kodeGd= new.KodeGD;
if (select jenisbrg from tm_barang where kodebrg=old.Kodebrg)="Inventory" then
    Update tm_stockbrg set Stockakhir =  stockakhir+(old.jml*ifnull(old.konv,1))
    where kodebrg=old.kodebrg and kodeGd= old.KodeGD;
end if;
if (select jenisbrg from tm_barang where kodebrg=new.Kodebrg)="Inventory" then
    Update tm_stockbrg set Stockakhir =  stockakhir-(new.jml*ifnull(new.konv,1))
    where kodebrg=new.kodebrg and kodeGd= new.KodeGD;
end if;
 
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetJualDelete` AFTER DELETE ON `tr_jual_d` FOR EACH ROW BEGIN
if (select jenisbrg from tm_barang where kodebrg=old.Kodebrg)="Inventory" then
  Update tm_stockbrg set Stockakhir =  stockakhir+(old.jml*ifnull(old.konv,1)) 
  where kodebrg=Old.kodebrg and kodeGd= Old.KodeGD;
end if;
end */;;

DELIMITER ;

--
-- Table structure for table `tr_jual_m`
--

CREATE TABLE `tr_jual_m` (
  `TransJual` varchar(2) NOT NULL default '',
  `NoJual` varchar(11) NOT NULL default '',
  `TglJual` datetime default NULL,
  `KodeCust` varchar(10) default NULL,
  `NamaCust` varchar(50) default NULL,
  `Alamat` varchar(50) default NULL,
  `Kota` varchar(30) default NULL,
  `TglBatal` datetime default NULL,
  `DiscRp` double default NULL,
  `PPN` double default NULL,
  `Tambahan` double default NULL,
  `Sisa` double default NULL,
  `KetTambahan` varchar(50) default NULL,
  `Nilai` double default NULL,
  `KodeSales` varchar(10) default NULL,
  `TglJT` datetime default NULL,
  `NPWP` varchar(20) default NULL,
  `NoTitip` varchar(11) default NULL,
  `NilaiTitip` double default NULL,
  `Valas` varchar(10) default NULL,
  `ExRate` double default NULL,
  `PPNRps` double default NULL,
  `TipePPN` varchar(3) default NULL,
  `NoFPajak` varchar(20) default NULL,
  `TglFPajak` datetime default NULL,
  `Keterangan` varchar(100) default NULL,
  `ItemKirim` int(11) default NULL,
  `Kendaraan` varchar(50) default NULL,
  `NoPol` varchar(15) default NULL,
  `BayarCard` double default NULL,
  `TipeCard` varchar(20) default NULL,
  `NoCard` varchar(20) default NULL,
  `BankCard` varchar(20) default NULL,
  `NamaCard` varchar(30) default NULL,
  `BayarVoucher` double default NULL,
  `BayarTunai` double default NULL,
  `NilaiPeny` double default NULL,
  `SisaPeny` double default NULL,
  `BayarCardPeny` double default NULL,
  `BayarVoucherPeny` double default NULL,
  `BayarTunaiPeny` double default NULL,
  `Sales` varchar(50) default NULL,
  `Teknisi` varchar(50) default NULL,
  `BankPerkiraan` varchar(10) default NULL,
  `PointG` decimal(15,0) default NULL,
  `PointGNon` decimal(15,0) default NULL,
  `PointNon` decimal(15,0) default NULL,
  PRIMARY KEY  (`TransJual`,`NoJual`),
  KEY `fk_TR_Jual_m2` (`KodeSales`),
  KEY `fk_TR_Jual_m3` (`KodeCust`,`ItemKirim`),
  CONSTRAINT `fk_TR_Jual_m1` FOREIGN KEY (`KodeCust`) REFERENCES `tm_customer` (`KodeCust`),
  CONSTRAINT `fk_TR_Jual_m3` FOREIGN KEY (`KodeCust`, `ItemKirim`) REFERENCES `tm_custkirim` (`KodeCust`, `ItemCust`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_jual_m`
--

INSERT INTO `tr_jual_m` VALUES ('JT','7240130001','2024-01-30 00:00:00','001','test','','',NULL,0,0,0,11000,'',11000,'','2024-01-30 00:00:00','','',0,'',1,0,'','','1899-12-30 00:00:00','',NULL,'','',0,'','','','',0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0','0',NULL),('JT','7240207001','2024-02-07 00:00:00','001','test','','',NULL,0,11,0,12210,'',12210,'','2024-02-07 00:00:00','','',0,'',1,1210,'','','1899-12-30 00:00:00','',NULL,'','',0,'','','','',0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0','0',NULL);

DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `TrJualAdd` AFTER INSERT ON `tr_jual_m` FOR EACH ROW BEGIN
  Update tm_Customer set Piutang =  ifnull(piutang,0) + ((new.nilai-new.bayartunai-new.bayarcard-new.bayarvoucher) * new.exrate), Point =  ifnull(Point,0) + (new.pointG), PointNon= (ifnull(PointNon,0) + (new.PointGNon))
  where kodecust = new.kodecust;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `TrJualUpdate` AFTER UPDATE ON `tr_jual_m` FOR EACH ROW BEGIN
  Update tm_Customer set Piutang =  ifnull(piutang,0) - ((old.nilai-old.bayartunai-old.bayarcard-old.bayarvoucher) * Old.exrate), Point =  ifnull(Point,0) - (old.pointG), PointNon= (ifnull(PointNon,0) - (old.PointGNon))
  where kodecust = old.kodecust;
  Update tm_Customer set Piutang =  ifnull(piutang,0) + ((new.nilai-new.bayartunai-new.bayarcard-new.bayarvoucher) * new.exrate), Point =  ifnull(Point,0) + (new.pointG), PointNon= (ifnull(PointNon,0) + (new.PointGNon))
  where kodecust = new.kodecust;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `TrJualDelete` AFTER DELETE ON `tr_jual_m` FOR EACH ROW BEGIN
  Update tm_Customer set Piutang =  ifnull(piutang,0) - ((old.nilai-old.bayartunai-old.bayarcard-old.bayarvoucher) * Old.exrate), Point =  ifnull(Point,0) - (old.pointG), PointNon= (ifnull(PointNon,0) - (old.PointGNon))
  where kodecust = old.kodecust;
end */;;

DELIMITER ;

--
-- Table structure for table `tr_jualr_d`
--

CREATE TABLE `tr_jualr_d` (
  `TransRetail` varchar(2) NOT NULL default '',
  `NoJualR` varchar(11) NOT NULL default '',
  `ItemJual` int(11) NOT NULL default '0',
  `KodeBrg` varchar(20) NOT NULL,
  `KodeGd` varchar(5) NOT NULL,
  `NamaBrg` varchar(50) default NULL,
  `Harga` double default NULL,
  `Disc` double default NULL,
  `DiscPersen` double default NULL,
  `Jml` double default NULL,
  `Satuan` varchar(10) NOT NULL,
  `Konv` double default NULL,
  `HargaRetail` double default NULL,
  `HargaAvg` double default NULL,
  `Diretur` double default NULL,
  `HPP` double default NULL,
  `total` double default NULL,
  `HargaPeny` double default NULL,
  `JmlPeny` double default NULL,
  `Sales` varchar(50) default NULL,
  `Teknisi` varchar(50) default NULL,
  PRIMARY KEY  (`TransRetail`,`NoJualR`,`ItemJual`),
  KEY `fk_tr_JualR_d1` (`KodeBrg`),
  KEY `fk_tr_JualR_d2` (`KodeGd`),
  KEY `idx_tr_jualr_d1` (`TransRetail`,`NoJualR`),
  KEY `idx_tr_jualr_d2` (`NoJualR`),
  CONSTRAINT `fk_tr_JualR_d1` FOREIGN KEY (`KodeBrg`) REFERENCES `tm_barang` (`KodeBrg`),
  CONSTRAINT `fk_tr_JualR_d2` FOREIGN KEY (`KodeGd`) REFERENCES `tm_gudang` (`KodeGd`),
  CONSTRAINT `fk_tr_JualR_d3` FOREIGN KEY (`TransRetail`, `NoJualR`) REFERENCES `tr_jualr_m` (`TransRetail`, `NoJualR`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_jualr_d`
--

INSERT INTO `tr_jualr_d` VALUES ('JR','7240130001',1,'001','GD','Test',11000,0,0,1,'Pcs',1,0,10000,1,NULL,11000,NULL,NULL,NULL,NULL),('JR','7240207001',1,'001','GD','Test',11000,0,0,1,'Pcs',1,0,10000,NULL,NULL,11000,NULL,NULL,NULL,NULL);

DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetJualRAdd` AFTER INSERT ON `tr_jualr_d` FOR EACH ROW BEGIN
  DECLARE vtemp double;
if (select jenisbrg from tm_barang where kodebrg=new.KodeBrg)="Inventory" then
  Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)-(ifnull(new.jml,0)*ifnull(new.konv,1))
  where kodebrg=new.kodebrg and kodeGd= new.KodeGD;
end if;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetJualRUpdate` AFTER UPDATE ON `tr_jualr_d` FOR EACH ROW BEGIN
 DECLARE vtemp double;
if (select jenisbrg from tm_barang where kodebrg=old.Kodebrg)="Inventory" then
   Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)+(ifnull(old.jml,0)*ifnull(old.konv,1))
   where kodebrg=old.kodebrg and kodeGd= old.KodeGD;
end if;
if (select jenisbrg from tm_barang where kodebrg=new.Kodebrg)="Inventory" then
   Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)-(ifnull(new.jml,0)*ifnull(new.konv,1))
   where kodebrg=new.kodebrg and kodeGd= new.KodeGD;
end if;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetJualRDelete` AFTER DELETE ON `tr_jualr_d` FOR EACH ROW BEGIN
if (select jenisbrg from tm_barang where kodebrg=old.Kodebrg)="Inventory" then
  Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)+(ifnull(old.jml,0)*ifnull(old.konv,1)) 
  where kodebrg=Old.kodebrg and kodeGd= Old.KodeGD;
end if;
end */;;

DELIMITER ;

--
-- Table structure for table `tr_jualr_m`
--

CREATE TABLE `tr_jualr_m` (
  `TransRetail` varchar(2) NOT NULL default '',
  `NoJualR` varchar(11) NOT NULL default '',
  `TglJual` datetime default NULL,
  `TglBatal` datetime default NULL,
  `KodeCustR` varchar(30) default NULL,
  `NamaCust` varchar(50) default NULL,
  `Alamat` varchar(50) default NULL,
  `Kota` varchar(30) default NULL,
  `DiscRp` double default NULL,
  `PPN` double default NULL,
  `PPNRps` double default NULL,
  `Tambahan` double default NULL,
  `KetTambahan` varchar(200) default NULL,
  `BayarVoucher` double default NULL,
  `BayarTunai` double default NULL,
  `BayarCard` double default NULL,
  `TipeCard` varchar(20) default NULL,
  `NoCard` varchar(20) default NULL,
  `BankCard` varchar(20) default NULL,
  `NamaCard` varchar(30) default NULL,
  `Nilai` double default NULL,
  `NoClose` varchar(11) default NULL,
  `kasir` varchar(10) default NULL,
  `KodeSales` varchar(10) default NULL,
  `Tglentry` datetime default NULL,
  `NilaiPeny` double default NULL,
  `Sales` varchar(50) default NULL,
  `Teknisi` varchar(50) default NULL,
  `BankPerkiraan` varchar(10) default NULL,
  `PointR` decimal(15,0) default NULL,
  `PointRNon` decimal(15,0) default NULL,
  `PointNon` decimal(15,0) default NULL,
  `NoKomputer` varchar(5) default NULL,
  PRIMARY KEY  (`TransRetail`,`NoJualR`),
  KEY `tr_jualr_m_idx1` (`NoJualR`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_jualr_m`
--

INSERT INTO `tr_jualr_m` VALUES ('JR','7240130001','2024-01-30 00:00:00',NULL,'001','test','','',0,0,0,0,'',0,11000,0,'','','','',11000,'','ADMIN','','2024-01-30 13:50:16',NULL,NULL,NULL,'','0','0',NULL,'7'),('JR','7240207001','2024-02-07 00:00:00',NULL,'','CASH','','',0,11,1210,0,'',0,13000,0,'','','','',11000,'','ADMIN','','2024-02-07 09:10:05',NULL,NULL,NULL,'','0','0',NULL,'7');

DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `addTrJualrM` AFTER INSERT ON `tr_jualr_m` FOR EACH ROW BEGIN
  Update tm_Customer set Point =  ifnull(Point,0) + (new.pointR), PointNon= ifnull(PointNon,0)+(new.PointRNon)
  where kodecust = new.kodecustR;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `editTrJualM` AFTER UPDATE ON `tr_jualr_m` FOR EACH ROW BEGIN
Update tm_customer set Point = ifnull(Point,0)-(old.PointR),PointNon = ifnull(Pointnon,0)-(old.PointRNon) 
where kodecust = old.kodecustR;
Update tm_customer set Point = ifnull(Point,0)+(new.PointR),PointNon = ifnull(Pointnon,0)+(new.PointRNon)
where kodecust = new.kodecustR;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DeleteTrJualM` AFTER DELETE ON `tr_jualr_m` FOR EACH ROW BEGIN
Update tm_customer set Point = ifnull(Point,0)-(old.PointR),PointNon = ifnull(Pointnon,0)-(old.PointRNon) 
where kodecust = old.kodecustR;  
END */;;

DELIMITER ;

--
-- Table structure for table `tr_jualrakitan_d`
--

CREATE TABLE `tr_jualrakitan_d` (
  `TransJual` varchar(2) NOT NULL default '',
  `NoJual` varchar(11) NOT NULL default '',
  `ItemJual` int(11) NOT NULL default '0',
  `NOPO` varchar(11) default NULL,
  `ItemPO` int(11) default NULL,
  `KodeBrg` varchar(20) NOT NULL,
  `KodeGd` varchar(5) NOT NULL,
  `NamaBrg` varchar(50) default NULL,
  `Harga` double default NULL,
  `Disc` double default NULL,
  `DiscPersen` double default NULL,
  `Jml` double default NULL,
  `JmlTitip` double default NULL,
  `Satuan` varchar(10) NOT NULL,
  `Konv` double default NULL,
  `HargaAvg` double default NULL,
  `Diretur` double default NULL,
  `HPP` double default NULL,
  `HargaPeny` double default NULL,
  `JmlPeny` double default NULL,
  `Sales` varchar(50) default NULL,
  `Teknisi` varchar(50) default NULL,
  PRIMARY KEY  (`TransJual`,`NoJual`,`ItemJual`),
  KEY `fk_tr_Jualrakitan_d1` (`KodeBrg`),
  KEY `fk_tr_Jualrakitan_d2` (`KodeGd`),
  KEY `fk_tr_Jualrakitan_d4` (`NOPO`,`ItemPO`),
  KEY `tr_jualrakitan_d_idx1` (`NoJual`),
  CONSTRAINT `fk_tr_Jualrakitan_d1` FOREIGN KEY (`KodeBrg`) REFERENCES `tm_barang` (`KodeBrg`),
  CONSTRAINT `fk_tr_Jualrakitan_d2` FOREIGN KEY (`KodeGd`) REFERENCES `tm_gudang` (`KodeGd`),
  CONSTRAINT `fk_tr_Jualrakitan_d3` FOREIGN KEY (`TransJual`, `NoJual`) REFERENCES `tr_jualrakitan_m` (`TransJual`, `NoJual`) ON DELETE CASCADE,
  CONSTRAINT `fk_tr_Juarakitanl_d4` FOREIGN KEY (`NOPO`, `ItemPO`) REFERENCES `tr_pojualrakitan_d` (`NoPO`, `ItemPO`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_jualrakitan_d`
--


DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetJualRakitanAdd` AFTER INSERT ON `tr_jualrakitan_d` FOR EACH ROW BEGIN
DECLARE vtemp double;
 select stockakhir-new.jml into vtemp from tm_stockbrg where kodebrg=new.kodebrg and kodeGd= new.KodeGD;
   Update tm_stockbrg set Stockakhir =  stockakhir-new.jml
   where kodebrg=new.kodebrg and kodeGd= new.KodeGD;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetJualRakitanUpdate` AFTER UPDATE ON `tr_jualrakitan_d` FOR EACH ROW BEGIN
 DECLARE vtemp double;
 select stockakhir-(new.jml-old.jml) into vtemp from tm_stockbrg where kodebrg=new.kodebrg and kodeGd= new.KodeGD;
   Update tm_stockbrg set Stockakhir =  stockakhir+old.jml
   where kodebrg=old.kodebrg and kodeGd= old.KodeGD;
   Update tm_stockbrg set Stockakhir =  stockakhir-new.jml
   where kodebrg=new.kodebrg and kodeGd= new.KodeGD;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetJualRakitanDelete` AFTER DELETE ON `tr_jualrakitan_d` FOR EACH ROW BEGIN
  Update tm_stockbrg set Stockakhir =  stockakhir+old.jml 
  where kodebrg=Old.kodebrg and kodeGd= Old.KodeGD;
end */;;

DELIMITER ;

--
-- Table structure for table `tr_jualrakitan_m`
--

CREATE TABLE `tr_jualrakitan_m` (
  `TransJual` varchar(2) NOT NULL default '',
  `NoJual` varchar(11) NOT NULL default '',
  `TglJual` datetime default NULL,
  `KodeCust` varchar(10) default NULL,
  `NamaCust` varchar(50) default NULL,
  `Alamat` varchar(50) default NULL,
  `Kota` varchar(30) default NULL,
  `NoPo` varchar(11) default NULL,
  `KodeRakitan` varchar(20) default NULL,
  `NamaRakitan` varchar(50) default NULL,
  `JmlRakitan` int(11) default NULL,
  `TglBatal` datetime default NULL,
  `DiscRp` double default NULL,
  `PPN` double default NULL,
  `Tambahan` double default NULL,
  `Sisa` double default NULL,
  `KetTambahan` varchar(50) default NULL,
  `Nilai` double default NULL,
  `KodeSales` varchar(10) default NULL,
  `TglJT` datetime default NULL,
  `NPWP` varchar(20) default NULL,
  `NoTitip` varchar(11) default NULL,
  `NilaiTitip` double default NULL,
  `Valas` varchar(10) default NULL,
  `ExRate` double default NULL,
  `PPNRps` double default NULL,
  `TipePPN` varchar(3) default NULL,
  `NoFPajak` varchar(20) default NULL,
  `TglFPajak` datetime default NULL,
  `Keterangan` varchar(100) default NULL,
  `ItemKirim` int(11) default NULL,
  `Kendaraan` varchar(50) default NULL,
  `NoPol` varchar(15) default NULL,
  `BayarCard` double default NULL,
  `TipeCard` varchar(20) default NULL,
  `NoCard` varchar(20) default NULL,
  `BankCard` varchar(20) default NULL,
  `NamaCard` varchar(30) default NULL,
  `BayarVoucher` double default NULL,
  `BayarTunai` double default NULL,
  `StatusCash` varchar(1) default NULL,
  `ReturRakitan` int(11) default NULL,
  `NilaiPeny` double default NULL,
  `SisaPeny` double default NULL,
  `BayarCardPeny` double default NULL,
  `BayarTunaiPeny` double default NULL,
  `BayarVoucherPeny` double default NULL,
  `Sales` varchar(50) default NULL,
  `Teknisi` varchar(50) default NULL,
  PRIMARY KEY  (`TransJual`,`NoJual`),
  KEY `fk_TR_Jualrakitan_m2` (`KodeSales`),
  KEY `fk_TR_Jualrakitan_m3` (`KodeCust`,`ItemKirim`),
  KEY `tr_jualrakiitan_m_idx1` (`NoJual`),
  CONSTRAINT `fk_TR_Jualrakitan_m1` FOREIGN KEY (`KodeCust`) REFERENCES `tm_customer` (`KodeCust`),
  CONSTRAINT `fk_TR_Jualrakitan_m3` FOREIGN KEY (`KodeCust`, `ItemKirim`) REFERENCES `tm_custkirim` (`KodeCust`, `ItemCust`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_jualrakitan_m`
--


DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `TrJualRakitanAdd` AFTER INSERT ON `tr_jualrakitan_m` FOR EACH ROW BEGIN
  Update tm_Customer set Piutang =  ifnull(piutang,0) + ((new.nilai-new.bayartunai-new.bayarcard-new.bayarvoucher)*new.exrate)
  where kodecust = new.kodecust;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `TrJualRakitanUpdate` AFTER UPDATE ON `tr_jualrakitan_m` FOR EACH ROW BEGIN
  Update tm_Customer set Piutang =  ifnull(piutang,0) + ((new.nilai-new.bayartunai-new.bayarcard-new.bayarvoucher)*new.exrate)
  where kodecust = new.kodecust;
  Update tm_Customer set Piutang =  ifnull(piutang,0) - ((old.nilai-old.bayartunai-old.bayarcard-old.bayarvoucher)*old.exrate)
  where kodecust = old.kodecust;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `TrJualRakitanDelete` AFTER DELETE ON `tr_jualrakitan_m` FOR EACH ROW BEGIN
  Update tm_Customer set Piutang =  ifnull(piutang,0) - ((old.nilai-old.bayartunai-old.bayarcard-old.bayarvoucher) * Old.exrate) 
  where kodecust = Old.kodecust;
end */;;

DELIMITER ;

--
-- Table structure for table `tr_koreksistc_d`
--

CREATE TABLE `tr_koreksistc_d` (
  `NoKoreksi` varchar(15) default NULL,
  `ItemDet` int(11) default NULL,
  `kodebrg` varchar(20) default NULL,
  `Satuan` varchar(10) default NULL,
  `JmlSebelum` double(10,2) default NULL,
  `JmlSesudah` double(10,2) default NULL,
  `Konv` double(10,2) default NULL,
  `SelisihKurang` double default NULL,
  `SelisihLebih` double default NULL,
  `Harga` double default NULL,
  `KodeGd` varchar(15) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_koreksistc_d`
--


DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `UpdateStock` AFTER INSERT ON `tr_koreksistc_d` FOR EACH ROW update tm_stockbrg set stockakhir=new.jmlsesudah * new.konv where kodegd=new.kodegd and kodebrg=new.kodebrg */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `UpdateStock2` AFTER UPDATE ON `tr_koreksistc_d` FOR EACH ROW update tm_stockbrg set stockakhir=new.jmlsesudah * new.konv where kodegd=new.kodegd and kodebrg=new.kodebrg */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DeleteStock` AFTER DELETE ON `tr_koreksistc_d` FOR EACH ROW update tm_StockBrg set stockakhir=old.JmlSebelum*old.konv where kodebrg=old.kodebrg and kodegd=old.kodegd */;;

DELIMITER ;

--
-- Table structure for table `tr_koreksistc_m`
--

CREATE TABLE `tr_koreksistc_m` (
  `NoKoreksi` varchar(15) NOT NULL,
  `TglKoreksi` date default NULL,
  `Keterangan` varchar(255) default NULL,
  PRIMARY KEY  (`NoKoreksi`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_koreksistc_m`
--


--
-- Table structure for table `tr_log`
--

CREATE TABLE `tr_log` (
  `Log` varchar(50) NOT NULL default '',
  `NoBukti` varchar(20) default NULL,
  `Keterangan` varchar(500) default NULL,
  `Tanggal` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`Log`,`Tanggal`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_log`
--


--
-- Table structure for table `tr_modx`
--

CREATE TABLE `tr_modx` (
  `NoModX` varchar(11) NOT NULL default '',
  `TglModx` datetime default NULL,
  `Keterangan` varchar(200) default NULL,
  `TglBatal` datetime default NULL,
  PRIMARY KEY  (`NoModX`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_modx`
--


--
-- Table structure for table `tr_mutasibuku`
--

CREATE TABLE `tr_mutasibuku` (
  `TransMutasiBuku` varchar(2) NOT NULL,
  `NoMutasiBuku` varchar(11) NOT NULL,
  `NoJual` varchar(11) default NULL,
  `Tanggal` datetime default NULL,
  `ItemMutasi` varchar(11) default NULL,
  `KodeCustAsal` varchar(10) default NULL,
  `KodeCustTujuan` varchar(10) default NULL,
  `KodeBrg` varchar(50) default NULL,
  `NamaBrg` varchar(50) default NULL,
  `Tahun` int(11) default NULL,
  `Semester` int(11) default NULL,
  `Jml` double default NULL,
  `Harga` double default NULL,
  `Satuan` varchar(10) default NULL,
  `Nilai` double default NULL,
  `Keterangan` text,
  `itemjual` int(11) default NULL,
  PRIMARY KEY  (`TransMutasiBuku`,`NoMutasiBuku`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_mutasibuku`
--


--
-- Table structure for table `tr_mutasigd`
--

CREATE TABLE `tr_mutasigd` (
  `NoPindah` varchar(11) default NULL,
  `TglPindah` date default NULL,
  `ItemPindah` int(11) default NULL,
  `KodeBrg` varchar(20) default NULL,
  `TokoAsal` varchar(1) default NULL,
  `KodeGDAsal` varchar(5) default NULL,
  `TokoTujuan` varchar(1) default NULL,
  `KodeGDTujuan` varchar(5) default NULL,
  `Jumlah` double default NULL,
  `Satuan` varchar(10) default NULL,
  `Konv` double default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_mutasigd`
--


--
-- Table structure for table `tr_opnameall`
--

CREATE TABLE `tr_opnameall` (
  `TglOpname` datetime NOT NULL default '0000-00-00 00:00:00',
  `KodeBrg` varchar(20) NOT NULL,
  `JmlStock` double default NULL,
  `JmlOpname` double default NULL,
  `JmlUpdate` double default NULL,
  `KodeGd` varchar(5) NOT NULL,
  PRIMARY KEY  (`TglOpname`,`KodeBrg`),
  KEY `fk_OpnameAll1` (`KodeGd`),
  KEY `fk_OpnameAll2` (`KodeBrg`),
  CONSTRAINT `fk_OpnameAll1` FOREIGN KEY (`KodeGd`) REFERENCES `tm_gudang` (`KodeGd`),
  CONSTRAINT `fk_OpnameAll2` FOREIGN KEY (`KodeBrg`) REFERENCES `tm_barang` (`KodeBrg`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_opnameall`
--


--
-- Table structure for table `tr_pindahgd_d`
--

CREATE TABLE `tr_pindahgd_d` (
  `NoPindahGd` varchar(11) NOT NULL default '',
  `ItemDet` int(11) NOT NULL default '0',
  `KodeBrg` varchar(20) NOT NULL,
  `KodeGdAsal` varchar(5) NOT NULL,
  `KodeGdTujuan` varchar(5) NOT NULL,
  `Jumlah` double default NULL,
  `Satuan` varchar(10) NOT NULL,
  `Konv` int(11) default NULL,
  PRIMARY KEY  (`NoPindahGd`,`ItemDet`),
  KEY `fk_DetPIndahGd2` (`KodeBrg`),
  KEY `fk_DetPindahGd3` (`KodeGdAsal`),
  KEY `fk_DetPindahGd4` (`KodeGdTujuan`),
  CONSTRAINT `fk_DetPindahGd1` FOREIGN KEY (`NoPindahGd`) REFERENCES `tr_pindahgd_m` (`NoPindahGd`) ON DELETE CASCADE,
  CONSTRAINT `fk_DetPIndahGd2` FOREIGN KEY (`KodeBrg`) REFERENCES `tm_barang` (`KodeBrg`),
  CONSTRAINT `fk_DetPindahGd3` FOREIGN KEY (`KodeGdAsal`) REFERENCES `tm_gudang` (`KodeGd`),
  CONSTRAINT `fk_DetPindahGd4` FOREIGN KEY (`KodeGdTujuan`) REFERENCES `tm_gudang` (`KodeGd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_pindahgd_d`
--


DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetPindahGdAdd` AFTER INSERT ON `tr_pindahgd_d` FOR EACH ROW BEGIN
Declare vtemp double;
Declare vJml double;
  select stockakhir-new.jumlah into vJml from tm_stockbrg where kodeGd=new.KodeGDasal and kodebrg=new.kodebrg;
     select count(*) into vtemp from tm_stockbrg where kodebrg=new.kodebrg and kodeGd= new.KodeGDTujuan;
     if vtemp = 0 then
        insert  into tm_stockbrg (kodebrg,kodegd,StockAwal,stockakhir) values (new.kodebrg,new.kodegdtujuan,0,new.Jumlah);
        Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)-new.jumlah where kodeGd= new.KodeGDAsal and kodebrg=new.kodebrg;
     else  
        Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)+new.jumlah where kodeGd= new.KodeGDTujuan and kodebrg=new.kodebrg;
        Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)-new.jumlah where kodeGd= new.KodeGDAsal and kodebrg=new.kodebrg;
     end if;
END */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetPindahGdUpdate` AFTER UPDATE ON `tr_pindahgd_d` FOR EACH ROW BEGIN
declare vtemp double;
declare vJmltujuan double;
declare vJmlasal   double;
declare vJml   double;
  select count(*) into vtemp from tm_stockbrg where kodeGd= new.KodeGDTujuan and kodebrg=new.kodebrg;
  select ifnull(stockakhir,0)-new.jumlah into vJmlAsal from tm_stockbrg where kodeGd= new.KodeGDAsal and kodebrg=new.kodebrg;
  select ifnull(stockakhir,0)-old.jumlah into vJmlTujuan from tm_stockbrg where kodeGd= old.KodeGDTujuan and kodebrg=old.kodebrg;
     if vtemp = 0 then
        insert  into tm_stockbrg (kodebrg,kodegd,StockAwal,stockakhir) values (new.kodebrg,new.kodegdtujuan,0,new.jumlah);
 
        Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)+old.Jumlah*old.konv where kodeGd= old.KodeGDasal and kodebrg=old.kodebrg;
        Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)-new.Jumlah*new.konv where kodeGd= new.KodeGDasal and kodebrg=new.kodebrg;
        Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)-old.Jumlah*old.konv where kodeGd= old.KodeGDtujuan and kodebrg=old.kodebrg;
     else
        Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)+new.Jumlah*new.konv where kodeGd= new.KodeGDTujuan and kodebrg=new.kodebrg;
        Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)+old.Jumlah*old.konv where kodeGd= old.KodeGDasal and kodebrg=old.kodebrg;
        Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)-new.Jumlah*new.konv where kodeGd= new.KodeGDasal and kodebrg=new.kodebrg;
        Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)-old.Jumlah*old.konv where kodeGd= old.KodeGDtujuan and kodebrg=old.kodebrg;
     end if;
END */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetPindahGdDelete` AFTER DELETE ON `tr_pindahgd_d` FOR EACH ROW BEGIN
declare vtemp double;
Declare vJmlTujuan double;
  select ifnull(stockakhir,0)-old.jumlah into vJmlTujuan from tm_stockbrg where kodeGd= old.KodeGDTujuan and kodebrg=old.kodebrg;
  select count(*) into vtemp from tm_stockbrg where kodeGd= old.KodeGDtujuan and kodebrg=old.kodebrg;
  
     if vtemp > 0 then
       Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)-old.Jumlah where kodeGd= old.KodeGDTujuan and kodebrg=old.kodebrg;
       Update tm_stockbrg set Stockakhir =  ifnull(stockakhir,0)+old.Jumlah where kodeGd= old.KodeGDAsal and kodebrg=old.kodebrg;
     END if;
 
END */;;

DELIMITER ;

--
-- Table structure for table `tr_pindahgd_m`
--

CREATE TABLE `tr_pindahgd_m` (
  `NoPindahGd` varchar(11) NOT NULL default '',
  `TglPindahGd` datetime default NULL,
  `Keterangan` varchar(200) default NULL,
  `TglBatal` datetime default NULL,
  `User` varchar(30) default NULL,
  PRIMARY KEY  (`NoPindahGd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_pindahgd_m`
--


--
-- Table structure for table `tr_piusem`
--

CREATE TABLE `tr_piusem` (
  `KodeCust` varchar(20) default NULL,
  `NamaCust` varchar(75) default NULL,
  `Alamat` varchar(75) default NULL,
  `Kota` varchar(50) default NULL,
  `Telp` varchar(20) default NULL,
  `Semester` varchar(20) default NULL,
  `Piutang_sem` double default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_piusem`
--


--
-- Table structure for table `tr_pobeli_d`
--

CREATE TABLE `tr_pobeli_d` (
  `NoPO` varchar(11) NOT NULL,
  `ItemPO` int(11) NOT NULL,
  `KodeBrg` varchar(20) default NULL,
  `Keterangan` varchar(100) default NULL,
  `Harga` double default NULL,
  `Disc` double default NULL,
  `Jml` double default NULL,
  `Satuan` varchar(10) NOT NULL,
  `Konv` double default NULL,
  `SdhTerima` double default NULL,
  `TglFinish` datetime default NULL,
  `Sisa` double default NULL,
  PRIMARY KEY  (`NoPO`,`ItemPO`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_pobeli_d`
--


--
-- Table structure for table `tr_pobeli_m`
--

CREATE TABLE `tr_pobeli_m` (
  `NoPO` varchar(11) NOT NULL,
  `TglPO` datetime default NULL,
  `TglBatal` datetime default NULL,
  `KodeSupp` varchar(10) default NULL,
  `Keterangan` varchar(200) default NULL,
  `DiscRp` double default NULL,
  `Tambahan` double default NULL,
  `KetTambahan` varchar(50) default NULL,
  `PPN` double default NULL,
  `PPNRps` double default NULL,
  `SyaratByr` int(11) default NULL,
  `KetSyaratByr` varchar(50) default NULL,
  `Valas` varchar(10) default NULL,
  `ExRate` double default NULL,
  PRIMARY KEY  (`NoPO`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_pobeli_m`
--


--
-- Table structure for table `tr_pojual_d`
--

CREATE TABLE `tr_pojual_d` (
  `NoPO` varchar(11) NOT NULL default '',
  `ItemPO` int(11) NOT NULL default '0',
  `KodeBrg` varchar(20) default NULL,
  `Keterangan` varchar(100) default NULL,
  `Harga` double default NULL,
  `Disc` double default NULL,
  `Jml` double default NULL,
  `Satuan` varchar(10) NOT NULL,
  `Konv` double default NULL,
  `SdhTerima` double default NULL,
  `TglFinish` datetime default NULL,
  PRIMARY KEY  (`NoPO`,`ItemPO`),
  KEY `fk_POJual_d2` (`KodeBrg`),
  CONSTRAINT `fk_POJual_d1` FOREIGN KEY (`NoPO`) REFERENCES `tr_pojual_m` (`NoPO`) ON DELETE CASCADE,
  CONSTRAINT `fk_POJual_d2` FOREIGN KEY (`KodeBrg`) REFERENCES `tm_barang` (`KodeBrg`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_pojual_d`
--


--
-- Table structure for table `tr_pojual_m`
--

CREATE TABLE `tr_pojual_m` (
  `NoPO` varchar(11) NOT NULL default '',
  `TglPO` datetime default NULL,
  `TglBatal` datetime default NULL,
  `KodeCust` varchar(10) default NULL,
  `Keterangan` varchar(200) default NULL,
  `DiscRp` double default NULL,
  `Tambahan` double default NULL,
  `KetTambahan` varchar(50) default NULL,
  `PPN` double default NULL,
  `PPNRps` double default NULL,
  `SyaratByr` int(11) default NULL,
  `KetSyaratByr` varchar(50) default NULL,
  `Valas` varchar(10) default NULL,
  `Exrate` double default NULL,
  PRIMARY KEY  (`NoPO`),
  KEY `fk_tr_POJual_m` (`KodeCust`),
  CONSTRAINT `fk_tr_POJual_m` FOREIGN KEY (`KodeCust`) REFERENCES `tm_customer` (`KodeCust`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_pojual_m`
--


--
-- Table structure for table `tr_pojualrakitan_d`
--

CREATE TABLE `tr_pojualrakitan_d` (
  `NoPO` varchar(11) NOT NULL default '',
  `ItemPO` int(11) NOT NULL default '0',
  `KodeBrg` varchar(20) default NULL,
  `Keterangan` varchar(100) default NULL,
  `Harga` double default NULL,
  `Disc` double default NULL,
  `Jml` double default NULL,
  `Satuan` varchar(10) NOT NULL,
  `Konv` double default NULL,
  `SdhTerima` double default NULL,
  `TglFinish` datetime default NULL,
  PRIMARY KEY  (`NoPO`,`ItemPO`),
  KEY `fk_POJualrakitan_d2` (`KodeBrg`),
  CONSTRAINT `fk_POJualrakitan_d1` FOREIGN KEY (`NoPO`) REFERENCES `tr_pojualrakitan_m` (`NoPO`) ON DELETE CASCADE,
  CONSTRAINT `fk_POJualrakitan_d2` FOREIGN KEY (`KodeBrg`) REFERENCES `tm_barang` (`KodeBrg`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_pojualrakitan_d`
--


--
-- Table structure for table `tr_pojualrakitan_m`
--

CREATE TABLE `tr_pojualrakitan_m` (
  `NoPO` varchar(11) NOT NULL default '',
  `TglPO` datetime default NULL,
  `TglBatal` datetime default NULL,
  `KodeCust` varchar(10) default NULL,
  `KodeRakitan` varchar(20) default NULL,
  `JmlRakitan` int(11) default NULL,
  `SdhTerima` int(11) default NULL,
  `Keterangan` varchar(200) default NULL,
  `DiscRp` double default NULL,
  `Tambahan` double default NULL,
  `KetTambahan` varchar(50) default NULL,
  `PPN` double default NULL,
  `PPNRps` double default NULL,
  `SyaratByr` int(11) default NULL,
  `KetSyaratByr` varchar(50) default NULL,
  `Valas` varchar(10) default NULL,
  `Exrate` double default NULL,
  PRIMARY KEY  (`NoPO`),
  KEY `fk_tr_POJualrakitan_m` (`KodeCust`),
  CONSTRAINT `fk_tr_POJualrakitan_m` FOREIGN KEY (`KodeCust`) REFERENCES `tm_customer` (`KodeCust`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_pojualrakitan_m`
--


--
-- Table structure for table `tr_retbeli_d`
--

CREATE TABLE `tr_retbeli_d` (
  `TransRetB` varchar(2) NOT NULL default '',
  `NoRetB` varchar(11) NOT NULL default '',
  `ItemRetB` int(11) NOT NULL default '0',
  `TransBeli` varchar(2) default NULL,
  `NoBeli` varchar(11) default NULL,
  `itemBeli` int(11) default NULL,
  `KodeBrg` varchar(20) NOT NULL,
  `KodeGd` varchar(5) NOT NULL,
  `Harga` double default NULL,
  `Disc` double default NULL,
  `Jml` double default NULL,
  `Satuan` varchar(10) NOT NULL,
  `Konv` double default NULL,
  `Replaced` varchar(1) default NULL,
  `Locked` varchar(1) default NULL,
  `Direplace` double default NULL,
  `Sisa` double default NULL,
  PRIMARY KEY  (`TransRetB`,`NoRetB`,`ItemRetB`),
  KEY `fk_tr_RetBeli_d2` (`KodeGd`),
  KEY `fk_tr_RetBeli_d3` (`KodeBrg`),
  KEY `fk_tr_RetBeli_d4` (`TransBeli`,`NoBeli`,`itemBeli`),
  CONSTRAINT `fk_tr_RetBeli_d1` FOREIGN KEY (`TransRetB`, `NoRetB`) REFERENCES `tr_retbeli_m` (`TransRetB`, `NoRetB`) ON DELETE CASCADE,
  CONSTRAINT `fk_tr_RetBeli_d2` FOREIGN KEY (`KodeGd`) REFERENCES `tm_gudang` (`KodeGd`),
  CONSTRAINT `fk_tr_RetBeli_d3` FOREIGN KEY (`KodeBrg`) REFERENCES `tm_barang` (`KodeBrg`),
  CONSTRAINT `fk_tr_RetBeli_d4` FOREIGN KEY (`TransBeli`, `NoBeli`, `itemBeli`) REFERENCES `tr_beli_d` (`TransBeli`, `NoBeli`, `ItemBeli`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_retbeli_d`
--


DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetRetBeliAdd` AFTER INSERT ON `tr_retbeli_d` FOR EACH ROW BEGIN
declare vnoretb varchar(11);
DECLARE vjumlah  double; 
DECLARE vTglBatal datetime;
Declare vnobeli varchar(11);
declare vcode varchar(20);
declare vitemBeli int;
declare vtrans varchar(2);
declare vTransbeli varchar(2);
declare vKodeGd varchar(5);
 select TransRetB,NoretB,Kodebrg, ifnull(jml,0),kodegd, ifnull(TransBeli,''), ifnull(NoBeli,''), ifnull(itemBeli,0) into vtrans,vNoretB,vcode,vjumlah,vkodegd, vTransbeli, vNoBeli, vItemBeli 
 from Tr_RetBeli_d where TransRetB = new.TransRetB and NoretB = new.NoretB and ItemRetB=new.ItemretB;
 select Tglbatal into vTglbatal from Tr_RetBeli_M where new.TransRetB and NoretB = new.NoretB;
 update tm_stockbrg set stockakhir = ifnull(stockakhir,0) -new.jml where kodebrg=new.kodebrg and kodeGd= new.KodeGD; 
 
 if (vnobeli<>'') and (vTransBeli<>'') and (vItemBeli<>0) then
    update Tr_Beli_d set diretur = ifnull(diretur,0) + vJumlah where Transbeli=vTransBeli and nobeli=vnobeli and ItemBeli=vItemBeli;
 end if;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetRetBeliUpdate` AFTER UPDATE ON `tr_retbeli_d` FOR EACH ROW BEGIN
 declare vnoretb varchar(11);
 DECLARE vjumlah  double; 
 DECLARE vTglBatal datetime;
 Declare vnobeli varchar(11);
 declare vcode varchar(20);
 declare vitemBeli int;
 declare vtrans varchar(2);
 declare vTransbeli varchar(2);
 declare vKodeGd varchar(5);
  select TransRetB,NoretB,Kodebrg, ifnull(jml,0),kodegd, ifnull(TransBeli,''), ifnull(NoBeli,''), ifnull(itemBeli,0) into vtrans,vNoretB,vcode,vjumlah,vkodegd, vTransbeli, vNoBeli, vItemBeli 
  from Tr_RetBeli_d where TransRetB = new.TransRetB and NoretB = new.NoretB and ItemRetB=new.ItemretB;
  select Tglbatal into vTglbatal from Tr_RetBeli_M where new.TransRetB and NoretB = new.NoretB;
  update tm_stockbrg set stockakhir = ifnull(stockakhir,0) +Old.jml where kodebrg=Old.kodebrg and kodeGd= Old.KodeGD; 
  update tm_stockbrg set stockakhir = ifnull(stockakhir,0) -new.jml where kodebrg=new.kodebrg and kodeGd= new.KodeGD; 
  update tr_Beli_d set diretur = ifnull(diretur,0)-Old.Jml  where Transbeli=old.TransBeli and nobeli=old.nobeli and ItemBeli=old.ItemBeli;
  update tr_Beli_d set diretur = ifnull(diretur,0)+New.Jml  where Transbeli=new.TransBeli and nobeli=new.nobeli and ItemBeli=new.ItemBeli;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetRetBeliDelete` AFTER DELETE ON `tr_retbeli_d` FOR EACH ROW BEGIN
 update tm_stockbrg set stockakhir = ifnull(stockakhir,0) +Old.jml where kodebrg=Old.kodebrg and kodeGd= Old.KodeGD; 
 update tr_Beli_d set diretur = ifnull(diretur,0)-Old.Jml  where Transbeli=old.TransBeli and nobeli=old.nobeli and ItemBeli=old.ItemBeli;
end */;;

DELIMITER ;

--
-- Table structure for table `tr_retbeli_m`
--

CREATE TABLE `tr_retbeli_m` (
  `TransRetB` varchar(2) NOT NULL default '',
  `NoRetB` varchar(11) NOT NULL default '',
  `TglRetB` datetime default NULL,
  `TglBatal` datetime default NULL,
  `KodeSupp` varchar(10) default NULL,
  `Keterangan` varchar(200) default NULL,
  `TRansBeli` varchar(2) default NULL,
  `NoBeli` varchar(11) default NULL,
  `DiscRp` double default NULL,
  `Tambahan` double default NULL,
  `KetTambahan` varchar(50) default NULL,
  `PPN` double default NULL,
  `PPNRps` double default NULL,
  `Nilai` double default NULL,
  `Sisa` double default NULL,
  `valas` varchar(10) default NULL,
  `ExRate` double default NULL,
  PRIMARY KEY  (`TransRetB`,`NoRetB`),
  KEY `fk_tr_RetBeli_m1` (`KodeSupp`),
  KEY `fk_tr_RetBeli_m2` (`TRansBeli`,`NoBeli`),
  CONSTRAINT `fk_tr_RetBeli_m1` FOREIGN KEY (`KodeSupp`) REFERENCES `tm_supplier` (`KodeSupp`),
  CONSTRAINT `fk_tr_RetBeli_m2` FOREIGN KEY (`TRansBeli`, `NoBeli`) REFERENCES `tr_beli_m` (`TransBeli`, `NoBeli`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_retbeli_m`
--


DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trRetBeliAdd` AFTER INSERT ON `tr_retbeli_m` FOR EACH ROW BEGIN
  Update tm_Supplier set Hutang =  ifnull(hutang,0) - new.nilai * new.exrate 
  where kodesupp = new.kodesupp;
  Update tr_beli_m set sisa =  ifnull(sisa,0) - new.nilai * new.exrate 
  where TransBeli = new.TransBeli and NoBeli=New.NoBeli;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trRetBeliUpdate` AFTER UPDATE ON `tr_retbeli_m` FOR EACH ROW BEGIN
  Update tm_Supplier set Hutang =  ifnull(hutang,0) +  old.nilai *  Old.exrate 
  where kodesupp = old.kodesupp;
  
  Update tm_Supplier set Hutang =  ifnull(hutang,0) -  new.nilai *  new.exrate 
  where kodesupp = new.kodesupp;
  Update tr_beli_m set sisa =  ifnull(sisa,0) - new.nilai * new.exrate 
  where TransBeli = new.TransBeli and NoBeli=New.NoBeli;
  Update tr_beli_m set sisa =  ifnull(sisa,0) + old.nilai * old.exrate 
  where TransBeli = old.TransBeli and NoBeli=old.NoBeli;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trRetBeliDelete` AFTER DELETE ON `tr_retbeli_m` FOR EACH ROW BEGIN
  Update tm_Supplier set Hutang =  ifnull(hutang,0) + (Old.nilai * Old.exrate) 
  where kodesupp = Old.kodesupp;
  Update tr_beli_m set sisa =  ifnull(sisa,0) + old.nilai * old.exrate 
  where TransBeli = old.TransBeli and NoBeli=old.NoBeli;
end */;;

DELIMITER ;

--
-- Table structure for table `tr_retjual_d`
--

CREATE TABLE `tr_retjual_d` (
  `TransRetJ` varchar(2) NOT NULL default '',
  `NoRetJ` varchar(11) NOT NULL default '',
  `ItemRetJ` int(11) NOT NULL default '0',
  `TransJual` varchar(2) default NULL,
  `NoJual` varchar(11) default NULL,
  `ItemJual` int(11) default NULL,
  `KodeBrg` varchar(20) NOT NULL,
  `KodeGd` varchar(5) NOT NULL,
  `Harga` double default NULL,
  `Disc` double default NULL,
  `Jml` double default NULL,
  `Satuan` varchar(10) NOT NULL,
  `Konv` double default NULL,
  PRIMARY KEY  (`TransRetJ`,`NoRetJ`,`ItemRetJ`),
  KEY `fk_Tr_RetJual_D1` (`KodeGd`),
  KEY `fk_Tr_RetJual_D2` (`KodeBrg`),
  KEY `fk_Tr_RetJual_D3` (`TransJual`,`NoJual`,`ItemJual`),
  KEY `fk_Tr_RetJual_D7` (`TransJual`,`NoJual`,`ItemJual`),
  CONSTRAINT `fk_Tr_RetJual_D4` FOREIGN KEY (`TransRetJ`, `NoRetJ`) REFERENCES `tr_retjual_m` (`TransRetJ`, `NoRetJ`) ON DELETE CASCADE,
  CONSTRAINT `fk_Tr_RetJual_D5` FOREIGN KEY (`KodeGd`) REFERENCES `tm_gudang` (`KodeGd`),
  CONSTRAINT `fk_Tr_RetJual_D6` FOREIGN KEY (`KodeBrg`) REFERENCES `tm_barang` (`KodeBrg`),
  CONSTRAINT `fk_Tr_RetJual_D7` FOREIGN KEY (`TransJual`, `NoJual`, `ItemJual`) REFERENCES `tr_jual_d` (`TransJual`, `NoJual`, `ItemJual`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_retjual_d`
--


DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetREtJualAdd` AFTER INSERT ON `tr_retjual_d` FOR EACH ROW BEGIN
  Update tm_StockBrg set stockakhir = ifnull(stockakhir,0) + new.jml where kodebrg=new.kodebrg and kodeGd= new.KodeGD;
  update tr_jual_d set diretur = ifnull(diretur,0) + new.Jml  where nojual = new.nojual and TransJual=new.Transjual and ItemJual=new.ItemJual;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetREtJualUpdate` AFTER UPDATE ON `tr_retjual_d` FOR EACH ROW BEGIN
  Update tm_StockBrg set stockakhir = ifnull(stockakhir,0) - Old.jml where kodebrg=Old.kodebrg and kodeGd= Old.KodeGD;
  Update tm_StockBrg set stockakhir = ifnull(stockakhir,0) + New.jml where kodebrg=New.kodebrg and kodeGd= New.KodeGD;
  update tr_jual_d set diretur = ifnull(diretur,0) -Old.Jml  where nojual = Old.nojual and TransJual=Old.Transjual and ItemJual=Old.ItemJual;
  update tr_jual_d set diretur = ifnull(diretur,0) +New.Jml  where nojual = New.nojual and TransJual=New.Transjual and ItemJual=New.ItemJual;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetREtJualDelete` AFTER DELETE ON `tr_retjual_d` FOR EACH ROW BEGIN
Update tm_StockBrg set stockakhir = ifnull(stockakhir,0) - Old.jml where kodebrg=Old.kodebrg and kodeGd= Old.KodeGD;
update tr_jual_d set diretur = ifnull(diretur,0) - Old.Jml  where nojual = Old.nojual and TransJual=Old.Transjual and ItemJual=Old.ItemJual;
end */;;

DELIMITER ;

--
-- Table structure for table `tr_retjual_m`
--

CREATE TABLE `tr_retjual_m` (
  `TransRetJ` varchar(2) NOT NULL default '',
  `NoRetJ` varchar(11) NOT NULL default '',
  `TglRetJ` datetime default NULL,
  `TglBatal` datetime default NULL,
  `KodeCust` varchar(10) default NULL,
  `Keterangan` varchar(200) default NULL,
  `TRansJual` varchar(2) default NULL,
  `NoJual` varchar(11) default NULL,
  `DiscRp` double default NULL,
  `Tambahan` double default NULL,
  `KetTambahan` varchar(50) default NULL,
  `PPN` double default NULL,
  `PPNRps` double default NULL,
  `Nilai` double default NULL,
  `Valas` varchar(10) default NULL,
  `ExRate` double default NULL,
  `Sisa` double default NULL,
  PRIMARY KEY  (`TransRetJ`,`NoRetJ`),
  KEY `fk_Tr_RetJual_M1` (`KodeCust`),
  KEY `fk_Tr_RetJual_M2` (`TRansJual`,`NoJual`),
  CONSTRAINT `fk_Tr_RetJual_M1` FOREIGN KEY (`KodeCust`) REFERENCES `tm_customer` (`KodeCust`),
  CONSTRAINT `fk_Tr_RetJual_M2` FOREIGN KEY (`TRansJual`, `NoJual`) REFERENCES `tr_jual_m` (`TransJual`, `NoJual`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_retjual_m`
--


DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `TrRetJualAdd` AFTER INSERT ON `tr_retjual_m` FOR EACH ROW BEGIN
Declare vPiutang double;
Declare vSisa double;
  select ifnull(Piutang,0) into vPiutang from tm_Customer where kodeCust = new.kodeCust; 
  Update tm_Customer set Piutang =  ifnull(Piutang,0) - new.nilai * new.exrate 
  where kodeCust = new.kodeCust;
  Update tr_Jual_m set sisa =  ifnull(sisa,0) - new.nilai * new.exrate 
  where TransJual = new.TransJual and NoJual=New.NoJual;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `TrRetJualUpdate` AFTER UPDATE ON `tr_retjual_m` FOR EACH ROW BEGIN
Declare vPiutang double;
Declare vSisa double;
  select ifnull(Piutang,0) into vPiutang from tm_Customer where kodeCust = new.kodeCust; 
  Update tm_Customer set Piutang =  ifnull(Piutang,0) - new.nilai * new.exrate 
  where kodeCust = new.kodeCust;
  Update tm_Customer set Piutang =  ifnull(Piutang,0) + Old.nilai * Old.exrate 
  where kodeCust = Old.kodeCust;
  Update tr_Jual_m set sisa =  ifnull(sisa,0) - new.nilai * new.exrate 
  where TransJual = new.TransJual and NoJual=New.NoJual;
  Update tr_Jual_m set sisa =  ifnull(sisa,0) + old.nilai * old.exrate 
  where TransJual = old.TransJual and NoJual=old.NoJual;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `TrRetJualDelete` AFTER DELETE ON `tr_retjual_m` FOR EACH ROW BEGIN
Declare vSisa double;
  Update tm_Customer set Piutang =  ifnull(Piutang,0) + Old.nilai * Old.exrate 
  where kodeCust = Old.kodeCust;
  Update tr_Jual_m set sisa =  ifnull(sisa,0) + old.nilai * old.exrate 
  where TransJual = old.TransJual and NoJual=old.NoJual;
end */;;

DELIMITER ;

--
-- Table structure for table `tr_retjualr_d`
--

CREATE TABLE `tr_retjualr_d` (
  `TransRetJ` varchar(2) NOT NULL default '',
  `NoRetJ` varchar(11) NOT NULL default '',
  `ItemRetJ` int(11) NOT NULL default '0',
  `TransJual` varchar(2) default NULL,
  `NoJual` varchar(11) default NULL,
  `ItemJual` int(11) default NULL,
  `KodeBrg` varchar(20) NOT NULL,
  `KodeGd` varchar(5) NOT NULL,
  `Harga` double default NULL,
  `Disc` double default NULL,
  `Jml` double default NULL,
  `Satuan` varchar(10) NOT NULL,
  `Konv` double default NULL,
  PRIMARY KEY  (`TransRetJ`,`NoRetJ`,`ItemRetJ`),
  KEY `fk_Tr_RetJualr_D1` (`KodeGd`),
  KEY `fk_Tr_RetJualr_D2` (`KodeBrg`),
  KEY `fk_Tr_RetJualr_D3` (`TransJual`,`NoJual`,`ItemJual`),
  KEY `fk_Tr_RetJualr_D7` (`TransJual`,`NoJual`,`ItemJual`),
  CONSTRAINT `fk_Tr_RetJualr_D4` FOREIGN KEY (`TransRetJ`, `NoRetJ`) REFERENCES `tr_retjualr_m` (`TransRetJ`, `NoRetJ`) ON DELETE CASCADE,
  CONSTRAINT `fk_Tr_RetJualr_D5` FOREIGN KEY (`KodeGd`) REFERENCES `tm_gudang` (`KodeGd`),
  CONSTRAINT `fk_Tr_RetJualr_D6` FOREIGN KEY (`KodeBrg`) REFERENCES `tm_barang` (`KodeBrg`),
  CONSTRAINT `fk_Tr_RetJualr_D7` FOREIGN KEY (`TransJual`, `NoJual`, `ItemJual`) REFERENCES `tr_jualr_d` (`TransRetail`, `NoJualR`, `ItemJual`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_retjualr_d`
--

INSERT INTO `tr_retjualr_d` VALUES ('RR','24000001',1,'JR','7240130001',1,'001','GD',11000,0,1,'Pcs',1);

DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetREtJualRAdd` AFTER INSERT ON `tr_retjualr_d` FOR EACH ROW BEGIN
  Update tm_StockBrg set stockakhir = ifnull(stockakhir,0) + new.jml where kodebrg=new.kodebrg and kodeGd= new.KodeGD;
  update tr_jualR_d set diretur = ifnull(diretur,0) + new.Jml where nojualR = new.nojual and TransRetail=new.Transjual and ItemJual=new.ItemJual;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetREtJualRUpdate` AFTER UPDATE ON `tr_retjualr_d` FOR EACH ROW BEGIN
  Update tm_StockBrg set stockakhir = ifnull(stockakhir,0) - (old.jml-new.jml) where kodebrg=new.kodebrg and kodeGd= new.KodeGD;
  update tr_jualR_d set diretur =  ifnull(diretur,0)- (old.jml * old.konv) where nojualR=new.nojual and TransRetail=new.Transjual and ItemJual=new.ItemJual;
  update tr_jualR_d set diretur =  ifnull(diretur,0)+ (new.jml * new.konv) where nojualR=new.nojual and TransRetail=new.Transjual and ItemJual=new.ItemJual;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetREtJualRDelete` AFTER DELETE ON `tr_retjualr_d` FOR EACH ROW BEGIN
  Update tm_StockBrg set stockakhir = ifnull(stockakhir,0) - old.jml 
  where kodebrg=Old.kodebrg and kodeGd= Old.KodeGD;
  update tr_jualR_d set diretur = ifnull(diretur,0) - Old.Jml
  where nojualR=Old.nojual and TransRetail=Old.Transjual and ItemJual=Old.ItemJual;
end */;;

DELIMITER ;

--
-- Table structure for table `tr_retjualr_m`
--

CREATE TABLE `tr_retjualr_m` (
  `TransRetJ` varchar(2) NOT NULL default '',
  `NoRetJ` varchar(11) NOT NULL default '',
  `TglRetJ` datetime default NULL,
  `TglBatal` datetime default NULL,
  `NamaCust` varchar(50) default NULL,
  `Alamat` varchar(50) default NULL,
  `Kota` varchar(30) default NULL,
  `Keterangan` varchar(200) default NULL,
  `TRansJual` varchar(2) default NULL,
  `NoJual` varchar(11) default NULL,
  `DiscRp` double default NULL,
  `Tambahan` double default NULL,
  `KetTambahan` varchar(50) default NULL,
  `PPN` double default NULL,
  `PPNRps` double default NULL,
  `Nilai` double default NULL,
  `Valas` varchar(10) default NULL,
  `ExRate` double default NULL,
  `Sisa` double default NULL,
  PRIMARY KEY  (`TransRetJ`,`NoRetJ`),
  KEY `fk_Tr_RetJualR_M2` (`TRansJual`,`NoJual`),
  CONSTRAINT `fk_Tr_RetJualR_M2` FOREIGN KEY (`TRansJual`, `NoJual`) REFERENCES `tr_jualr_m` (`TransRetail`, `NoJualR`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_retjualr_m`
--

INSERT INTO `tr_retjualr_m` VALUES ('RR','24000001','2024-01-30 00:00:00',NULL,'test','','','','JR','7240130001',0,0,'',0,0,11000,'',0,NULL);

--
-- Table structure for table `tr_retjualrakitan_d`
--

CREATE TABLE `tr_retjualrakitan_d` (
  `TransRetJ` varchar(2) NOT NULL default '',
  `NoRetJ` varchar(11) NOT NULL default '',
  `ItemRetJ` int(11) NOT NULL default '0',
  `TransJual` varchar(2) default NULL,
  `NoJual` varchar(11) default NULL,
  `ItemJual` int(11) default NULL,
  `KodeBrg` varchar(20) NOT NULL,
  `KodeGd` varchar(5) NOT NULL,
  `Harga` double default NULL,
  `Disc` double default NULL,
  `Jml` double default NULL,
  `Satuan` varchar(10) NOT NULL,
  `Konv` double default NULL,
  PRIMARY KEY  (`TransRetJ`,`NoRetJ`,`ItemRetJ`),
  KEY `fk_Tr_RetJualRakitan_D1` (`KodeGd`),
  KEY `fk_Tr_RetJualRakitan_D2` (`KodeBrg`),
  KEY `fk_Tr_RetJualRakitan_D3` (`TransJual`,`NoJual`,`ItemJual`),
  KEY `fk_Tr_RetJualRakitan_D7` (`TransJual`,`NoJual`,`ItemJual`),
  CONSTRAINT `fk_Tr_RetJualRakitan_D4` FOREIGN KEY (`TransRetJ`, `NoRetJ`) REFERENCES `tr_retjualrakitan_m` (`TransRetJ`, `NoRetJ`) ON DELETE CASCADE,
  CONSTRAINT `fk_Tr_RetJualRakitan_D5` FOREIGN KEY (`KodeGd`) REFERENCES `tm_gudang` (`KodeGd`),
  CONSTRAINT `fk_Tr_RetJualRakitan_D6` FOREIGN KEY (`KodeBrg`) REFERENCES `tm_barang` (`KodeBrg`),
  CONSTRAINT `fk_Tr_RetJualRakitan_D7` FOREIGN KEY (`TransJual`, `NoJual`, `ItemJual`) REFERENCES `tr_jualrakitan_d` (`TransJual`, `NoJual`, `ItemJual`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_retjualrakitan_d`
--


DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetREtJualRakitanAdd` AFTER INSERT ON `tr_retjualrakitan_d` FOR EACH ROW BEGIN
  Update tm_StockBrg set stockakhir = ifnull(stockakhir,0) + new.jml where kodebrg=new.kodebrg and kodeGd= new.KodeGD;
  update tr_jualRakitan_d set diretur = ifnull(diretur,0) + new.Jml  where nojual = new.nojual and TransJual=new.Transjual and ItemJual=new.ItemJual;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetREtJualRakitanUpdate` AFTER UPDATE ON `tr_retjualrakitan_d` FOR EACH ROW BEGIN
  Update tm_StockBrg set stockakhir = ifnull(stockakhir,0) + new.jml where kodebrg=new.kodebrg and kodeGd= new.KodeGD;
  Update tm_StockBrg set stockakhir = ifnull(stockakhir,0) - Old.jml where kodebrg=Old.kodebrg and kodeGd= Old.KodeGD;
  update tr_jualrakitan_d set diretur = ifnull(diretur,0) + new.Jml  where nojual = new.nojual and TransJual=new.Transjual and ItemJual=new.ItemJual;
  update tr_jualrakitan_d set diretur = ifnull(diretur,0) - Old.Jml  where nojual = Old.nojual and TransJual=Old.Transjual and ItemJual=Old.ItemJual;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `DetREtJualRakitanDelete` AFTER DELETE ON `tr_retjualrakitan_d` FOR EACH ROW BEGIN
  Update tm_StockBrg set stockakhir = ifnull(stockakhir,0) - Old.jml where kodebrg=Old.kodebrg and kodeGd= Old.KodeGD;
  update tr_jualRakitan_d set diretur = ifnull(diretur,0) - Old.Jml  where nojual = Old.nojual and TransJual=Old.Transjual and ItemJual=Old.ItemJual;
end */;;

DELIMITER ;

--
-- Table structure for table `tr_retjualrakitan_m`
--

CREATE TABLE `tr_retjualrakitan_m` (
  `TransRetJ` varchar(2) NOT NULL default '',
  `NoRetJ` varchar(11) NOT NULL default '',
  `TglRetJ` datetime default NULL,
  `TglBatal` datetime default NULL,
  `KodeCust` varchar(10) default NULL,
  `KodeRakitan` varchar(20) default NULL,
  `jmlrakitan` int(11) default NULL,
  `Keterangan` varchar(200) default NULL,
  `TRansJual` varchar(2) default NULL,
  `NoJual` varchar(11) default NULL,
  `DiscRp` double default NULL,
  `Tambahan` double default NULL,
  `KetTambahan` varchar(50) default NULL,
  `PPN` double default NULL,
  `PPNRps` double default NULL,
  `Nilai` double default NULL,
  `Valas` varchar(10) default NULL,
  `ExRate` double default NULL,
  `Sisa` double default NULL,
  PRIMARY KEY  (`TransRetJ`,`NoRetJ`),
  KEY `fk_Tr_RetJualR_M1` (`KodeCust`),
  KEY `fk_Tr_RetJualR_M2` (`TRansJual`,`NoJual`),
  CONSTRAINT `fk_Tr_RetJualR_M3` FOREIGN KEY (`KodeCust`) REFERENCES `tm_customer` (`KodeCust`),
  CONSTRAINT `fk_Tr_RetJualR_M4` FOREIGN KEY (`TRansJual`, `NoJual`) REFERENCES `tr_jualrakitan_m` (`TransJual`, `NoJual`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_retjualrakitan_m`
--


DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `TrRetJualRakitanAdd` AFTER INSERT ON `tr_retjualrakitan_m` FOR EACH ROW BEGIN
Declare vPiutang double;
  select ifnull(Piutang,0) into vPiutang from tm_Customer where kodeCust = new.kodeCust; 
  Update tm_Customer set Piutang =  ifnull(Piutang,0) - new.nilai * new.exrate 
  where kodeCust = new.kodeCust;
  Update tr_Jualrakitan_m set sisa =  ifnull(sisa,0) - new.nilai * new.exrate 
  where TransJual = new.TransJual and NoJual=New.NoJual;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `TrRetJualRakitanUpdate` AFTER UPDATE ON `tr_retjualrakitan_m` FOR EACH ROW BEGIN
Declare vPiutang double;
  select ifnull(Piutang,0) into vPiutang from tm_Customer where kodeCust = new.kodeCust; 
 
  Update tm_Customer set Piutang =  ifnull(Piutang,0) - new.nilai * new.exrate 
  where kodeCust = new.kodeCust;
  Update tm_Customer set Piutang =  ifnull(Piutang,0) + Old.nilai * Old.exrate 
  where kodeCust = Old.kodeCust;
  Update tr_Jualrakitan_m set sisa =  ifnull(sisa,0) - new.nilai * new.exrate 
  where TransJual = new.TransJual and NoJual=New.NoJual;
  Update tr_Jualrakitan_m set sisa =  ifnull(sisa,0) + old.nilai * old.exrate 
  where TransJual = old.TransJual and NoJual=old.NoJual;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `TrRetJualRakitanDelete` AFTER DELETE ON `tr_retjualrakitan_m` FOR EACH ROW BEGIN
  Update tm_Customer set Piutang =  ifnull(Piutang,0) + Old.nilai * Old.exrate 
  where kodeCust = Old.kodeCust;
  Update tr_Jualrakitan_m set sisa =  ifnull(sisa,0) + old.nilai * old.exrate 
  where TransJual = old.TransJual and NoJual=old.NoJual;
end */;;

DELIMITER ;

--
-- Table structure for table `tr_saldocounter`
--

CREATE TABLE `tr_saldocounter` (
  `KodeShift` varchar(15) NOT NULL,
  `KodeMesin` varchar(15) NOT NULL,
  `NoClose` varchar(15) default NULL,
  `UserID` varchar(15) NOT NULL,
  `Tanggal` date NOT NULL,
  `SaldoAwal` int(11) NOT NULL,
  `SaldoAkhir` int(11) NOT NULL,
  `OverShiff` varchar(2) default NULL,
  PRIMARY KEY  (`KodeShift`,`UserID`,`Tanggal`,`KodeMesin`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_saldocounter`
--


--
-- Table structure for table `tr_savetmp`
--

CREATE TABLE `tr_savetmp` (
  `NoJualR` varchar(11) NOT NULL default '',
  `ItemJual` int(11) NOT NULL default '0',
  `KodeBrg` varchar(20) NOT NULL,
  `KodeGd` varchar(5) NOT NULL,
  `NamaBrg` varchar(50) default NULL,
  `Harga` double default NULL,
  `HargaAvg` double default NULL,
  `Disc` double default NULL,
  `DiscPersen` double default NULL,
  `Jml` double default NULL,
  `Satuan` varchar(10) NOT NULL,
  `Konv` double default NULL,
  `Jam` datetime default NULL,
  `priceedits` varchar(1) default NULL,
  `cashr` int(11) default NULL,
  `kasir` varchar(10) default NULL,
  PRIMARY KEY  (`NoJualR`,`ItemJual`),
  KEY `fk_SaveTmp` (`KodeBrg`),
  CONSTRAINT `fk_SaveTmp` FOREIGN KEY (`KodeBrg`) REFERENCES `tm_barang` (`KodeBrg`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_savetmp`
--


--
-- Table structure for table `tr_savetmpgrosir`
--

CREATE TABLE `tr_savetmpgrosir` (
  `NoJual` varchar(20) NOT NULL,
  `ItemJual` int(11) NOT NULL default '0',
  `kodebrg` varchar(15) default NULL,
  `kodegd` varchar(10) default NULL,
  `namabrg` varchar(50) default NULL,
  `harga` double default NULL,
  `hargaavg` double default NULL,
  `disc` double default NULL,
  `discpersen` double default NULL,
  `jml` double default NULL,
  `satuan` varchar(30) default NULL,
  `konv` double default NULL,
  `jam` time default NULL,
  `priceedits` double default NULL,
  `Kasir` varchar(50) default NULL,
  `Kodecust` varchar(15) default NULL,
  `NamaCust` varchar(50) default NULL,
  `AlamatCust` varchar(50) default NULL,
  PRIMARY KEY  (`NoJual`,`ItemJual`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_savetmpgrosir`
--


--
-- Table structure for table `tr_scrbayarbeli`
--

CREATE TABLE `tr_scrbayarbeli` (
  `NoBayarB` varchar(11) NOT NULL default '',
  `ItemSBayarB` int(11) NOT NULL default '0',
  `TransBeli` varchar(2) default NULL,
  `NoBeli` varchar(11) default NULL,
  `Nilai` double default NULL,
  `Valas` varchar(10) default NULL,
  `ExRate` double default NULL,
  PRIMARY KEY  (`NoBayarB`,`ItemSBayarB`),
  KEY `fk_tr_ScrBayarBeli` (`NoBayarB`),
  KEY `fk_tr_ScrBayarBeli1` (`TransBeli`,`NoBeli`),
  CONSTRAINT `fk_tr_ScrBayarBeli` FOREIGN KEY (`NoBayarB`) REFERENCES `tr_bayarbeli_m` (`NoBayarB`) ON DELETE CASCADE,
  CONSTRAINT `fk_tr_ScrBayarBeli1` FOREIGN KEY (`TransBeli`, `NoBeli`) REFERENCES `tr_beli_m` (`TransBeli`, `NoBeli`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_scrbayarbeli`
--


DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `ScrBayarBeliAdd` AFTER INSERT ON `tr_scrbayarbeli` FOR EACH ROW BEGIN
declare vTransbeli varchar (2);
DECLARE vNoBeli varchar (11);
DECLARE vNilai double; 
DECLARE vTglBatal datetime;
Declare vKodeSupp varchar(10);
declare vNoBayar varchar(11);
declare vExrate integer;
select ifnull(TransBeli,''), ifnull(NoBeli,''), ifnull(Nilai,0), ifnull(ExRate,1) into  vTransbeli, vNoBeli, vNilai ,vexrate 
from Tr_ScrBayarBeli where NoBayarB = new.NobayarB and ItemSBayarB=new.ItemSBayarB;
select Tglbatal,KodeSupp into vTglbatal,vKodeSupp from tr_BayarBeli_M where NoBayarB=new.NoBayarB;
if ifnull(vTglBatal,'')='' then
 update tr_beli_m set Sisa=ifnull(Sisa,0)-new.Nilai where NoBeli=vNoBeli and TransBeli=vTransBeli;
 update tM_Supplier set hutang= ifnull(Hutang,0)-new.Nilai*new.ExRate where KodeSupp=vKodeSupp;
END if;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `ScrBayarBeliUpdate` AFTER UPDATE ON `tr_scrbayarbeli` FOR EACH ROW BEGIN
declare vTransBelibaru varchar(2);
DECLARE vNoBeliBaru varchar(11);
DECLARE vNilaiBaru double; 
DECLARE vTglBatal datetime;
Declare vKodeSupp varchar(10);
declare vNoBayar varchar(11);
declare vExrateBaru integer;
declare vExrateLama integer;
declare vTransBelilama varchar(2);
declare vNoBeliLama varchar(11);
DECLARE vNilaiLama double; 
select ifnull(TransBeli,''), ifnull(NoBeli,''), ifnull(Nilai,0), ifnull(ExRate,1) into  vTransbeliBaru, vNoBeliBaru, vNilaiBaru ,vexrateBaru 
from Tr_ScrBayarBeli where NoBayarB = new.NobayarB and ItemSBayarB=new.ItemSBayarB;
select Tglbatal,KodeSupp into vTglbatal,vKodeSupp from tr_BayarBeli_M where NoBayarB=new.NoBayarB;
if ifnull(vTglBatal,'')='' then
 update tr_beli_m set Sisa=ifnull(Sisa,0)+Old.Nilai where NoBeli=Old.NoBeli and TransBeli=Old.TransBeli;
 update tr_beli_m set Sisa=ifnull(Sisa,0)-New.Nilai where NoBeli=New.NoBeli and TransBeli=New.TransBeli;
 update tM_Supplier set hutang= ifnull(Hutang,0)+(Old.Nilai*Old.ExRate ) where KodeSupp=vKodeSupp;
 update tM_Supplier set hutang= ifnull(Hutang,0)-(New.Nilai*New.ExRate) where KodeSupp=vKodeSupp;
END if;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `ScrBayarBeliDelete` AFTER DELETE ON `tr_scrbayarbeli` FOR EACH ROW BEGIN
declare vTransBelibaru varchar(2);
DECLARE vNoBeliBaru varchar(11);
DECLARE vNilaiBaru double; 
DECLARE vTglBatal datetime;
Declare vKodeSupp varchar(10);
declare vNoBayar varchar(11);
declare vExrateBaru integer;
declare vExrateLama integer;
declare vTransBelilama varchar(2);
declare vNoBeliLama varchar(11);
DECLARE vNilaiLama double; 
select ifnull(TransBeli,''), ifnull(NoBeli,''), ifnull(Nilai,0), ifnull(ExRate,1) into  vTransbeliBaru, vNoBeliBaru, vNilaiBaru ,vexrateBaru 
from Tr_ScrBayarBeli where NoBayarB = Old.NobayarB and ItemSBayarB=old.ItemSBayarB;
select Tglbatal,KodeSupp into vTglbatal,vKodeSupp from tr_BayarBeli_M where NoBayarB=Old.NoBayarB;
if ifnull(vTglBatal,'')='' then
 update tr_beli_m set Sisa=ifnull(Sisa,0)+Old.Nilai  where NoBeli=Old.NoBeli and TransBeli=Old.TransBeli;
 update tM_Supplier set hutang= ifnull(Hutang,0)+(Old.Nilai*Old.ExRate)  where KodeSupp=vKodeSupp;
END if;
end */;;

DELIMITER ;

--
-- Table structure for table `tr_scrbayarjual`
--

CREATE TABLE `tr_scrbayarjual` (
  `NoBayarJ` varchar(11) NOT NULL default '',
  `ItemSBayarJ` int(11) NOT NULL default '0',
  `TransJual` varchar(2) default NULL,
  `NoJual` varchar(11) default NULL,
  `Nilai` double default NULL,
  `Valas` varchar(10) default NULL,
  `ExRate` double default NULL,
  PRIMARY KEY  (`NoBayarJ`,`ItemSBayarJ`),
  KEY `fk_tr_ScrBayarJual1` (`NoBayarJ`),
  KEY `fk_tr_ScrBayarJual2` (`TransJual`,`NoJual`),
  CONSTRAINT `fk_tr_ScrBayarJual3` FOREIGN KEY (`NoBayarJ`) REFERENCES `tr_bayarjual_m` (`NoBayarJ`) ON DELETE CASCADE,
  CONSTRAINT `fk_tr_ScrBayarJual4` FOREIGN KEY (`TransJual`, `NoJual`) REFERENCES `tr_jual_m` (`TransJual`, `NoJual`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_scrbayarjual`
--


DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `ScrBayarJualAdd` AFTER INSERT ON `tr_scrbayarjual` FOR EACH ROW BEGIN
declare vTransJual varchar (2);
DECLARE vNoJual varchar (11);
DECLARE vNilai double; 
DECLARE vTglBatal datetime;
Declare vKodeCust varchar(10);
declare vNoBayar varchar(11);
declare vExrate integer;
select Tglbatal,KodeCust into vTglbatal,vKodeCust from tr_BayarJual_M where NoBayarJ=new.NoBayarJ;
  Update tr_jual_m set sisa =  ifnull(sisa,0) - new.nilai * new.exrate 
  where TransJual = New.TransJual and NoJual=New.NoJual;
  Update tm_customer set piutang =  ifnull(piutang,0) - new.nilai * new.exrate 
  where KodeCust = vKodeCust;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `ScrBayarJualUpdate` AFTER UPDATE ON `tr_scrbayarjual` FOR EACH ROW BEGIN
declare vTransJual varchar (2);
DECLARE vNoJual varchar (11);
DECLARE vNilai double; 
DECLARE vTglBatal datetime;
Declare vKodeCust varchar(10);
declare vNoBayar varchar(11);
declare vExrate integer;
select Tglbatal,KodeCust into vTglbatal,vKodeCust from tr_BayarJual_M where NoBayarJ=new.NoBayarJ;
  Update tr_jual_m set sisa =  ifnull(sisa,0) - new.nilai * new.exrate 
  where TransJual = New.TransJual and NoJual=New.NoJual;
  Update tr_jual_m set sisa =  ifnull(sisa,0) + old.nilai * old.exrate 
  where TransJual = old.TransJual and NoJual = old.NoJual;
  Update tm_customer set piutang =  ifnull(piutang,0) - new.nilai * new.exrate 
  where KodeCust = vKodeCust;
  Update tm_customer set piutang =  ifnull(piutang,0) + old.nilai * old.exrate 
  where KodeCust = vKodeCust;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `ScrBayarJualDelete` AFTER DELETE ON `tr_scrbayarjual` FOR EACH ROW BEGIN
declare vTransJual varchar (2);
DECLARE vNoJual varchar (11);
DECLARE vNilai double; 
DECLARE vTglBatal datetime;
Declare vKodeCust varchar(10);
declare vNoBayar varchar(11);
declare vExrate integer;
select Tglbatal,KodeCust into vTglbatal,vKodeCust from tr_BayarJual_M where NoBayarJ=Old.NoBayarJ;
  Update tr_jual_m set sisa =  ifnull(sisa,0) + old.nilai * old.exrate 
  where TransJual = old.TransJual and NoJual = old.NoJual;
  Update tm_customer set piutang =  ifnull(piutang,0) + old.nilai * old.exrate 
  where KodeCust = vKodeCust;
end */;;

DELIMITER ;

--
-- Table structure for table `tr_scrbayarjualrakitan`
--

CREATE TABLE `tr_scrbayarjualrakitan` (
  `NoBayarJ` varchar(11) NOT NULL default '',
  `ItemSBayarJ` int(11) NOT NULL default '0',
  `TransJual` varchar(2) default NULL,
  `NoJual` varchar(11) default NULL,
  `Nilai` double default NULL,
  `Valas` varchar(10) default NULL,
  `ExRate` double default NULL,
  PRIMARY KEY  (`NoBayarJ`,`ItemSBayarJ`),
  KEY `fk_tr_ScrBayarJualrakitan1` (`NoBayarJ`),
  KEY `fk_tr_ScrBayarJualrakitan2` (`TransJual`,`NoJual`),
  CONSTRAINT `fk_tr_ScrBayarJualrakitan3` FOREIGN KEY (`NoBayarJ`) REFERENCES `tr_bayarjualrakitan_m` (`NoBayarJ`) ON DELETE CASCADE,
  CONSTRAINT `fk_tr_ScrBayarJualrakitan4` FOREIGN KEY (`TransJual`, `NoJual`) REFERENCES `tr_jualrakitan_m` (`TransJual`, `NoJual`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_scrbayarjualrakitan`
--


DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `ScrBayarJualRakitanAdd` AFTER INSERT ON `tr_scrbayarjualrakitan` FOR EACH ROW BEGIN
declare vTransJual varchar (2);
DECLARE vNoJual varchar (11);
DECLARE vNilai double; 
DECLARE vTglBatal datetime;
Declare vKodeCust varchar(10);
declare vNoBayar varchar(11);
declare vExrate integer;
select Tglbatal,KodeCust into vTglbatal,vKodeCust from tr_BayarJualRakitan_M where NoBayarJ=new.NoBayarJ;
  Update tr_JualRakitan_m set sisa =  ifnull(sisa,0) - new.nilai * new.exrate 
  where TransJual = New.TransJual and NoJual=New.NoJual;
  Update tm_customer set piutang =  ifnull(piutang,0) - new.nilai * new.exrate 
  where KodeCust = vKodeCust;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `ScrBayarJualRakitanUpdate` AFTER UPDATE ON `tr_scrbayarjualrakitan` FOR EACH ROW BEGIN
declare vTransJual varchar (2);
DECLARE vNoJual varchar (11);
DECLARE vNilai double; 
DECLARE vTglBatal datetime;
Declare vKodeCust varchar(10);
declare vNoBayar varchar(11);
declare vExrate integer;
select Tglbatal,KodeCust into vTglbatal,vKodeCust from tr_BayarJualRakitan_M where NoBayarJ=new.NoBayarJ;
  Update tr_JualRakitan_m set sisa =  ifnull(sisa,0) - new.nilai * new.exrate 
  where TransJual = New.TransJual and NoJual=New.NoJual;
  Update tr_JualRakitan_m set sisa =  ifnull(sisa,0) + old.nilai * old.exrate 
  where TransJual = old.TransJual and NoJual = old.NoJual;
  Update tm_customer set piutang =  ifnull(piutang,0) - new.nilai * new.exrate 
  where KodeCust = vKodeCust;
  Update tm_customer set piutang =  ifnull(piutang,0) + old.nilai * old.exrate 
  where KodeCust = vKodeCust;
end */;;

/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `ScrBayarJualRakitanDelete` AFTER DELETE ON `tr_scrbayarjualrakitan` FOR EACH ROW BEGIN
declare vTransJual varchar (2);
DECLARE vNoJual varchar (11);
DECLARE vNilai double; 
DECLARE vTglBatal datetime;
Declare vKodeCust varchar(10);
declare vNoBayar varchar(11);
declare vExrate integer;
select Tglbatal,KodeCust into vTglbatal,vKodeCust from tr_BayarJualRakitan_M where NoBayarJ=Old.NoBayarJ;
  Update tr_JualRakitan_m set sisa =  ifnull(sisa,0) + old.nilai * old.exrate 
  where TransJual = old.TransJual and NoJual = old.NoJual;
  Update tm_customer set piutang =  ifnull(piutang,0) + old.nilai * old.exrate 
  where KodeCust = vKodeCust;
end */;;

DELIMITER ;

--
-- Table structure for table `tr_scrmodx`
--

CREATE TABLE `tr_scrmodx` (
  `NoModx` varchar(11) NOT NULL default '',
  `ItemModX` int(11) NOT NULL default '0',
  `Kodebrg` varchar(20) NOT NULL,
  `KodeGd` varchar(5) NOT NULL,
  `Jumlah` double default NULL,
  `Satuan` varchar(10) NOT NULL,
  `Konv` double default NULL,
  `BagHarga` double default NULL,
  PRIMARY KEY  (`NoModx`,`ItemModX`),
  KEY `fk_SCRModX2` (`Kodebrg`),
  KEY `fk_SCRModX3` (`KodeGd`),
  CONSTRAINT `fk_ScrModX1` FOREIGN KEY (`NoModx`) REFERENCES `tr_modx` (`NoModX`) ON DELETE CASCADE,
  CONSTRAINT `fk_SCRModX2` FOREIGN KEY (`Kodebrg`) REFERENCES `tm_barang` (`KodeBrg`),
  CONSTRAINT `fk_SCRModX3` FOREIGN KEY (`KodeGd`) REFERENCES `tm_gudang` (`KodeGd`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tr_scrmodx`
--


--
-- Table structure for table `tuser`
--

CREATE TABLE `tuser` (
  `UserId` varchar(10) NOT NULL default '0',
  `UserName` varchar(25) default NULL,
  `Password` varchar(30) default NULL,
  `HakAkses` varchar(50) default NULL,
  `SuperUser` enum('Y','N','') default NULL,
  `IpLogin` varchar(15) default NULL,
  `NoUser` varchar(2) default NULL,
  PRIMARY KEY  (`UserId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tuser`
--

INSERT INTO `tuser` VALUES ('ADMIN','ADMIN',NULL,'01','Y','*','1');

--
-- Table structure for table `tuserlevel`
--

CREATE TABLE `tuserlevel` (
  `userlevel_id` varchar(2) NOT NULL,
  `menu` varchar(6) NOT NULL,
  `status` varchar(1) default NULL,
  `Ket_level` varchar(20) default NULL,
  PRIMARY KEY  (`userlevel_id`,`menu`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `tuserlevel`
--

INSERT INTO `tuserlevel` VALUES ('01','010000','1','Admin'),('01','010100','1','Admin'),('01','010200','1','Admin'),('01','010300','1','Admin'),('01','010400','1','Admin'),('01','010500','1','Admin'),('01','010600','1','Admin'),('01','010700','1','Admin'),('01','010800','1','Admin'),('01','010900','1','Admin'),('01','020000','1','Admin'),('01','020100','0','Admin'),('01','020200','1','Admin'),('01','020300','1','Admin'),('01','020400','1','Admin'),('01','020500','1','Admin'),('01','020600','1','Admin'),('01','020700','1','Admin'),('01','020800','1','Admin'),('01','020900','0','Admin'),('01','021000','0','Admin'),('01','030000','0','Admin'),('01','030100','0','Admin'),('01','040000','1','Admin'),('01','040100','1','Admin'),('01','040101','1','Admin'),('01','040102','1','Admin'),('01','040200','1','Admin'),('01','040201','1','Admin'),('01','040202','1','Admin'),('01','040300','1','Admin'),('01','040301','1','Admin'),('01','040302','1','Admin'),('01','040400','0','Admin'),('01','040401','0','Admin'),('01','040402','0','Admin'),('01','040500','0','Admin'),('01','040501','0','Admin'),('01','040502','0','Admin'),('01','050000','1','Admin'),('01','050100','1','Admin'),('01','050101','1','Admin'),('01','050102','1','Admin'),('01','050200','1','Admin'),('01','050201','1','Admin'),('01','050202','1','Admin'),('01','050300','0','Admin'),('01','050301','0','Admin'),('01','050302','0','Admin'),('01','050400','1','Admin'),('01','050401','1','Admin'),('01','050402','1','Admin'),('01','050500','0','Admin'),('01','050501','0','Admin'),('01','050502','0','Admin'),('01','050600','1','Admin'),('01','050601','1','Admin'),('01','050602','1','Admin'),('01','050700','0','Admin'),('01','050701','0','Admin'),('01','050702','0','Admin'),('01','050800','0','Admin'),('01','050801','0','Admin'),('01','050802','0','Admin'),('01','050803','0','Admin'),('01','050900','0','Admin'),('01','050901','0','Admin'),('01','050902','0','Admin'),('01','051000','0','Admin'),('01','051001','0','Admin'),('01','051002','0','Admin'),('01','051100','1','Admin'),('01','051101','1','Admin'),('01','051102','1','Admin'),('01','060000','1','Admin'),('01','060100','0','Admin'),('01','060101','1','Admin'),('01','060102','0','Admin'),('01','060103','0','Admin'),('01','060104','0','Admin'),('01','060105','0','Admin'),('01','060106','0','Admin'),('01','060107','0','Admin'),('01','060108','0','Admin'),('01','060200','1','Admin'),('01','060300','1','Admin'),('01','060400','1','Admin'),('01','060401','1','Admin'),('01','060402','1','Admin'),('01','060403','1','Admin'),('01','060500','1','Admin'),('01','060501','1','Admin'),('01','060502','1','Admin'),('01','060503','1','Admin'),('01','060600','1','Admin'),('01','060601','1','Admin'),('01','060602','1','Admin'),('01','060603','1','Admin'),('01','060700','1','Admin'),('01','060701','1','Admin'),('01','060702','1','Admin'),('01','060703','1','Admin'),('01','060800','1','Admin'),('01','060801','1','Admin'),('01','060802','0','Admin'),('01','060900','1','Admin'),('01','060901','1','Admin'),('01','060902','1','Admin'),('01','060903','0','Admin'),('01','060904','1','Admin'),('01','061000','0','Admin'),('01','061001','0','Admin'),('01','061002','0','Admin'),('01','061003','0','Admin'),('01','061004','0','Admin'),('01','061100','1','Admin'),('01','061101','1','Admin'),('01','061102','1','Admin'),('01','061103','1','Admin'),('01','061104','1','Admin'),('01','070000','1','Admin'),('01','070100','1','Admin'),('01','070200','1','Admin'),('01','070300','1','Admin'),('01','070400','1','Admin'),('01','070500','1','Admin'),('01','070600','0','Admin'),('01','070700','1','Admin'),('01','080000','1','Admin'),('01','080100','1','Admin'),('01','080200','1','Admin'),('01','080300','1','Admin'),('01','090000','1','Admin'),('01','090100','1','Admin'),('01','090101','1','Admin'),('01','090102','1','Admin'),('01','090200','1','Admin'),('01','090201','1','Admin'),('01','090202','1','Admin'),('01','090203','1','Admin'),('01','090300','1','Admin'),('01','090301','1','Admin'),('01','090302','1','Admin'),('01','090303','1','Admin'),('01','090304','1','Admin'),('01','090305','1','Admin'),('01','100000','1','Admin'),('01','110000','1','Admin'),('02','010000','1','Pindah Jual'),('02','010100','1','Pindah Jual'),('02','010200','1','Pindah Jual'),('02','010300','1','Pindah Jual'),('02','010400','0','Pindah Jual'),('02','010500','0','Pindah Jual'),('02','010600','0','Pindah Jual'),('02','010700','0','Pindah Jual'),('02','010900','1','Pindah Jual'),('02','020000','1','Pindah Jual'),('02','020100','0','Pindah Jual'),('02','020200','1','Pindah Jual'),('02','020300','1','Pindah Jual'),('02','020400','1','Pindah Jual'),('02','020500','1','Pindah Jual'),('02','020600','1','Pindah Jual'),('02','020700','1','Pindah Jual'),('02','020800','1','Pindah Jual'),('02','020900','0','Pindah Jual'),('02','030000','0','Pindah Jual'),('02','030100','1','Pindah Jual'),('02','040000','1','Pindah Jual'),('02','040100','1','Pindah Jual'),('02','040101','1','Pindah Jual'),('02','040102','1','Pindah Jual'),('02','040200','1','Pindah Jual'),('02','040201','1','Pindah Jual'),('02','040202','1','Pindah Jual'),('02','040300','1','Pindah Jual'),('02','040301','1','Pindah Jual'),('02','040302','1','Pindah Jual'),('02','040400','0','Pindah Jual'),('02','040401','1','Pindah Jual'),('02','040402','1','Pindah Jual'),('02','040500','0','Pindah Jual'),('02','040501','1','Pindah Jual'),('02','040502','1','Pindah Jual'),('02','050000','1','Pindah Jual'),('02','050100','1','Pindah Jual'),('02','050101','1','Pindah Jual'),('02','050102','1','Pindah Jual'),('02','050200','1','Pindah Jual'),('02','050201','1','Pindah Jual'),('02','050202','1','Pindah Jual'),('02','050302','1','Pindah Jual'),('02','050400','1','Pindah Jual'),('02','050401','1','Pindah Jual'),('02','050402','1','Pindah Jual'),('02','050500','1','Pindah Jual'),('02','050501','1','Pindah Jual'),('02','050502','1','Pindah Jual'),('02','050600','1','Pindah Jual'),('02','050601','1','Pindah Jual'),('02','050602','1','Pindah Jual'),('02','050700','0','Pindah Jual'),('02','050701','1','Pindah Jual'),('02','050702','1','Pindah Jual'),('02','050800','0','Pindah Jual'),('02','050801','1','Pindah Jual'),('02','050802','1','Pindah Jual'),('02','050803','1','Pindah Jual'),('02','050900','0','Pindah Jual'),('02','050901','1','Pindah Jual'),('02','050902','1','Pindah Jual'),('02','051000','0','Pindah Jual'),('02','051001','1','Pindah Jual'),('02','051002','1','Pindah Jual'),('02','060000','1','Pindah Jual'),('02','060100','0','Pindah Jual'),('02','060101','1','Pindah Jual'),('02','060102','1','Pindah Jual'),('02','060103','1','Pindah Jual'),('02','060104','1','Pindah Jual'),('02','060105','1','Pindah Jual'),('02','060106','1','Pindah Jual'),('02','060107','1','Pindah Jual'),('02','060108','1','Pindah Jual'),('02','060200','1','Pindah Jual'),('02','060300','1','Pindah Jual'),('02','060400','1','Pindah Jual'),('02','060401','1','Pindah Jual'),('02','060402','1','Pindah Jual'),('02','060403','1','Pindah Jual'),('02','060500','1','Pindah Jual'),('02','060501','1','Pindah Jual'),('02','060502','1','Pindah Jual'),('02','060503','1','Pindah Jual'),('02','060600','1','Pindah Jual'),('02','060601','1','Pindah Jual'),('02','060602','1','Pindah Jual'),('02','060603','1','Pindah Jual'),('02','060700','1','Pindah Jual'),('02','060701','1','Pindah Jual'),('02','060702','1','Pindah Jual'),('02','060703','1','Pindah Jual'),('02','060800','0','Pindah Jual'),('02','060801','1','Pindah Jual'),('02','060802','1','Pindah Jual'),('02','060900','0','Pindah Jual'),('02','060901','1','Pindah Jual'),('02','060902','1','Pindah Jual'),('02','060903','1','Pindah Jual'),('02','060904','1','Pindah Jual'),('02','061000','0','Pindah Jual'),('02','061001','1','Pindah Jual'),('02','061002','1','Pindah Jual'),('02','061003','1','Pindah Jual'),('02','061004','1','Pindah Jual'),('02','061100','1','Pindah Jual'),('02','061101','0','Pindah Jual'),('02','061102','0','Pindah Jual'),('02','070000','1','Pindah Jual'),('02','070100','1','Pindah Jual'),('02','070200','1','Pindah Jual'),('02','070400','1','Pindah Jual'),('02','070500','1','Pindah Jual'),('02','070600','1','Pindah Jual'),('02','080000','1','Pindah Jual'),('02','080100','0','Pindah Jual'),('02','080200','1','Pindah Jual'),('02','080300','0','Pindah Jual'),('02','090000','1','Pindah Jual'),('02','090100','0','Pindah Jual'),('02','090101','1','Pindah Jual'),('02','090102','1','Pindah Jual'),('02','090203','0','Pindah Jual'),('02','090300','1','Pindah Jual'),('02','090301','1','Pindah Jual'),('02','090302','1','Pindah Jual'),('02','090303','1','Pindah Jual'),('02','090304','1','Pindah Jual'),('02','090305','1','Pindah Jual'),('02','100000','1','Pindah Jual'),('02','110000','1','Pindah Jual'),('03','010000','1','Pindah Jual Exclusiv'),('03','010100','1','Pindah Jual Exclusiv'),('03','010200','1','Pindah Jual Exclusiv'),('03','050000','1','Pindah Jual Exclusiv'),('03','050200','1','Pindah Jual Exclusiv'),('03','050201','1','Pindah Jual Exclusiv'),('03','050202','1','Pindah Jual Exclusiv'),('03','050400','1','Pindah Jual Exclusiv'),('03','050401','1','Pindah Jual Exclusiv'),('03','050402','1','Pindah Jual Exclusiv'),('03','090000','1','Pindah Jual Exclusiv'),('03','090100','1','Pindah Jual Exclusiv'),('03','090101','1','Pindah Jual Exclusiv'),('03','090102','1','Pindah Jual Exclusiv'),('03','090300','1','Pindah Jual Exclusiv'),('03','090301','1','Pindah Jual Exclusiv'),('03','090302','1','Pindah Jual Exclusiv'),('03','110000','1','Pindah Jual Exclusiv'),('04','010000','1',''),('04','010100','0',''),('04','010200','1',''),('04','010300','1',''),('04','010400','0',''),('04','010500','0',''),('04','010600','0',''),('04','010700','0',''),('04','010900','0',''),('04','020000','0',''),('04','020100','0',''),('04','020200','0',''),('04','020300','1',''),('04','020400','0',''),('04','020500','0',''),('04','020600','0',''),('04','020700','0',''),('04','020800','0',''),('04','020900','0',''),('04','030000','0',''),('04','030100','0',''),('04','040000','0',''),('04','040100','1',''),('04','040101','1',''),('04','040102','1',''),('04','040200','1',''),('04','040201','1',''),('04','040202','1',''),('04','040300','1',''),('04','040301','1',''),('04','040302','1',''),('04','040400','0',''),('04','040401','0',''),('04','040402','0',''),('04','040500','0',''),('04','040501','0',''),('04','040502','0',''),('04','050000','1',''),('04','050100','1',''),('04','050101','1',''),('04','050102','1',''),('04','050200','0',''),('04','050201','0',''),('04','050202','0',''),('04','050400','0',''),('04','050401','1',''),('04','050402','1',''),('04','050500','0',''),('04','050501','0',''),('04','050502','0',''),('04','050600','0',''),('04','050601','0',''),('04','050602','0',''),('04','050700','0',''),('04','050701','0',''),('04','050702','0',''),('04','050800','0',''),('04','050801','0',''),('04','050802','0',''),('04','050803','0',''),('04','050900','0',''),('04','050901','0',''),('04','050902','0',''),('04','051000','0',''),('04','051001','0',''),('04','051002','0',''),('04','060000','0',''),('04','060100','0',''),('04','060101','0',''),('04','060102','0',''),('04','060103','0',''),('04','060104','0',''),('04','060105','0',''),('04','060106','0',''),('04','060107','1',''),('04','060108','1',''),('04','060200','1',''),('04','060300','1',''),('04','060400','1',''),('04','060401','1',''),('04','060402','1',''),('04','060403','1',''),('04','060500','1',''),('04','060501','1',''),('04','060502','1',''),('04','060503','1',''),('04','060600','1',''),('04','060601','1',''),('04','060602','1',''),('04','060603','1',''),('04','060700','1',''),('04','060701','1',''),('04','060702','1',''),('04','060703','1',''),('04','060800','1',''),('04','060801','1',''),('04','060802','0',''),('04','060900','1',''),('04','060902','1',''),('04','060903','0',''),('04','060904','1',''),('04','061000','0',''),('04','061001','0',''),('04','061002','0',''),('04','061003','0',''),('04','061004','0',''),('04','061100','0',''),('04','061101','0',''),('04','061102','0',''),('04','070000','0',''),('04','070100','0',''),('04','070200','0',''),('04','070400','0',''),('04','070500','0',''),('04','070600','0',''),('04','080000','1',''),('04','080100','0',''),('04','080200','1',''),('04','080300','0',''),('04','090000','0',''),('04','090100','0',''),('04','090101','0',''),('04','090102','0',''),('04','090203','1',''),('04','090300','1',''),('04','090301','1',''),('04','090302','1',''),('04','100000','0',''),('04','110000','1',''),('05','010000','1','Kasir Exclusiv'),('05','010100','1','Kasir Exclusiv'),('05','010200','1','Kasir Exclusiv'),('05','010300','1','Kasir Exclusiv'),('05','010400','1','Kasir Exclusiv'),('05','010500','1','Kasir Exclusiv'),('05','010600','1','Kasir Exclusiv'),('05','010700','1','Kasir Exclusiv'),('05','010900','1','Kasir Exclusiv'),('05','020000','1','Kasir Exclusiv'),('05','020100','1','Kasir Exclusiv'),('05','020200','1','Kasir Exclusiv'),('05','020300','1','Kasir Exclusiv'),('05','020400','1','Kasir Exclusiv'),('05','020500','1','Kasir Exclusiv'),('05','020600','1','Kasir Exclusiv'),('05','020700','1','Kasir Exclusiv'),('05','020800','1','Kasir Exclusiv'),('05','020900','1','Kasir Exclusiv'),('05','030000','1','Kasir Exclusiv'),('05','030100','1','Kasir Exclusiv'),('05','040000','1','Kasir Exclusiv'),('05','040100','1','Kasir Exclusiv'),('05','040101','1','Kasir Exclusiv'),('05','040102','1','Kasir Exclusiv'),('05','040200','1','Kasir Exclusiv'),('05','040201','1','Kasir Exclusiv'),('05','040202','1','Kasir Exclusiv'),('05','040300','1','Kasir Exclusiv'),('05','040301','1','Kasir Exclusiv'),('05','040302','1','Kasir Exclusiv'),('05','040400','1','Kasir Exclusiv'),('05','040401','1','Kasir Exclusiv'),('05','040402','1','Kasir Exclusiv'),('05','040500','1','Kasir Exclusiv'),('05','040501','1','Kasir Exclusiv'),('05','040502','1','Kasir Exclusiv'),('05','050000','1','Kasir Exclusiv'),('05','050100','1','Kasir Exclusiv'),('05','050101','1','Kasir Exclusiv'),('05','050102','1','Kasir Exclusiv'),('05','050200','1','Kasir Exclusiv'),('05','050201','1','Kasir Exclusiv'),('05','050202','1','Kasir Exclusiv'),('05','050400','1','Kasir Exclusiv'),('05','050401','1','Kasir Exclusiv'),('05','050402','1','Kasir Exclusiv'),('05','050500','1','Kasir Exclusiv'),('05','050501','1','Kasir Exclusiv'),('05','050502','1','Kasir Exclusiv'),('05','050600','1','Kasir Exclusiv'),('05','050601','1','Kasir Exclusiv'),('05','050602','1','Kasir Exclusiv'),('05','050700','1','Kasir Exclusiv'),('05','050701','1','Kasir Exclusiv'),('05','050702','1','Kasir Exclusiv'),('05','050800','1','Kasir Exclusiv'),('05','050801','1','Kasir Exclusiv'),('05','050802','1','Kasir Exclusiv'),('05','050803','1','Kasir Exclusiv'),('05','050900','1','Kasir Exclusiv'),('05','050901','1','Kasir Exclusiv'),('05','050902','1','Kasir Exclusiv'),('05','051000','1','Kasir Exclusiv'),('05','051001','1','Kasir Exclusiv'),('05','051002','1','Kasir Exclusiv'),('05','060000','1','Kasir Exclusiv'),('05','060100','1','Kasir Exclusiv'),('05','060101','1','Kasir Exclusiv'),('05','060102','1','Kasir Exclusiv'),('05','060103','1','Kasir Exclusiv'),('05','060104','1','Kasir Exclusiv'),('05','060105','1','Kasir Exclusiv'),('05','060106','1','Kasir Exclusiv'),('05','060107','1','Kasir Exclusiv'),('05','060108','1','Kasir Exclusiv'),('05','060200','1','Kasir Exclusiv'),('05','060300','1','Kasir Exclusiv'),('05','060400','1','Kasir Exclusiv'),('05','060401','1','Kasir Exclusiv'),('05','060402','1','Kasir Exclusiv'),('05','060500','1','Kasir Exclusiv'),('05','060501','1','Kasir Exclusiv'),('05','060502','1','Kasir Exclusiv'),('05','060503','1','Kasir Exclusiv'),('05','060600','1','Kasir Exclusiv'),('05','060601','1','Kasir Exclusiv'),('05','060602','1','Kasir Exclusiv'),('05','060603','1','Kasir Exclusiv'),('05','060700','1','Kasir Exclusiv'),('05','060701','1','Kasir Exclusiv'),('05','060702','1','Kasir Exclusiv'),('05','060703','1','Kasir Exclusiv'),('05','060800','1','Kasir Exclusiv'),('05','060801','1','Kasir Exclusiv'),('05','060802','1','Kasir Exclusiv'),('05','060900','1','Kasir Exclusiv'),('05','060902','1','Kasir Exclusiv'),('05','060903','1','Kasir Exclusiv'),('05','060904','1','Kasir Exclusiv'),('05','061000','1','Kasir Exclusiv'),('05','061001','1','Kasir Exclusiv'),('05','061002','1','Kasir Exclusiv'),('05','061003','1','Kasir Exclusiv'),('05','061004','1','Kasir Exclusiv'),('05','061100','1','Kasir Exclusiv'),('05','061101','1','Kasir Exclusiv'),('05','061102','1','Kasir Exclusiv'),('05','070000','1','Kasir Exclusiv'),('05','070100','1','Kasir Exclusiv'),('05','070200','1','Kasir Exclusiv'),('05','070400','1','Kasir Exclusiv'),('05','070500','1','Kasir Exclusiv'),('05','070600','1','Kasir Exclusiv'),('05','080000','1','Kasir Exclusiv'),('05','080100','1','Kasir Exclusiv'),('05','080200','1','Kasir Exclusiv'),('05','080300','1','Kasir Exclusiv'),('05','090000','1','Kasir Exclusiv'),('05','090100','1','Kasir Exclusiv'),('05','090101','1','Kasir Exclusiv'),('05','090102','1','Kasir Exclusiv'),('05','090203','1','Kasir Exclusiv'),('05','100000','1','Kasir Exclusiv'),('05','110000','1','Kasir Exclusiv'),('06','010000','1','Pindah Barang Saja'),('06','010100','1','Pindah Barang Saja'),('06','010200','1','Pindah Barang Saja'),('06','010300','1','Pindah Barang Saja'),('06','010400','1','Pindah Barang Saja'),('06','010500','1','Pindah Barang Saja'),('06','010600','1','Pindah Barang Saja'),('06','010700','1','Pindah Barang Saja'),('06','010900','1','Pindah Barang Saja'),('06','020000','1','Pindah Barang Saja'),('06','020100','1','Pindah Barang Saja'),('06','020200','1','Pindah Barang Saja'),('06','020300','1','Pindah Barang Saja'),('06','020400','1','Pindah Barang Saja'),('06','020500','1','Pindah Barang Saja'),('06','020600','1','Pindah Barang Saja'),('06','020700','1','Pindah Barang Saja'),('06','020800','1','Pindah Barang Saja'),('06','020900','1','Pindah Barang Saja'),('06','030000','1','Pindah Barang Saja'),('06','030100','1','Pindah Barang Saja'),('06','040000','1','Pindah Barang Saja'),('06','040100','1','Pindah Barang Saja'),('06','040101','1','Pindah Barang Saja'),('06','040102','1','Pindah Barang Saja'),('06','040200','1','Pindah Barang Saja'),('06','040201','1','Pindah Barang Saja'),('06','040202','1','Pindah Barang Saja'),('06','040300','1','Pindah Barang Saja'),('06','040301','1','Pindah Barang Saja'),('06','040302','1','Pindah Barang Saja'),('06','040400','1','Pindah Barang Saja'),('06','040401','1','Pindah Barang Saja'),('06','040402','1','Pindah Barang Saja'),('06','040500','1','Pindah Barang Saja'),('06','040501','1','Pindah Barang Saja'),('06','040502','1','Pindah Barang Saja'),('06','050000','1','Pindah Barang Saja'),('06','050100','1','Pindah Barang Saja'),('06','050101','1','Pindah Barang Saja'),('06','050102','1','Pindah Barang Saja'),('06','050200','1','Pindah Barang Saja'),('06','050201','1','Pindah Barang Saja'),('06','050202','1','Pindah Barang Saja'),('06','050400','1','Pindah Barang Saja'),('06','050401','1','Pindah Barang Saja'),('06','050402','1','Pindah Barang Saja'),('06','050500','1','Pindah Barang Saja'),('06','050501','1','Pindah Barang Saja'),('06','050502','1','Pindah Barang Saja'),('06','050600','1','Pindah Barang Saja'),('06','050601','1','Pindah Barang Saja'),('06','050602','1','Pindah Barang Saja'),('06','050700','1','Pindah Barang Saja'),('06','050701','1','Pindah Barang Saja'),('06','050702','1','Pindah Barang Saja'),('06','050800','1','Pindah Barang Saja'),('06','050801','1','Pindah Barang Saja'),('06','050802','1','Pindah Barang Saja'),('06','050803','1','Pindah Barang Saja'),('06','050900','1','Pindah Barang Saja'),('06','050901','1','Pindah Barang Saja'),('06','050902','1','Pindah Barang Saja'),('06','051000','1','Pindah Barang Saja'),('06','051001','1','Pindah Barang Saja'),('06','051002','1','Pindah Barang Saja'),('06','060000','1','Pindah Barang Saja'),('06','060100','1','Pindah Barang Saja'),('06','060101','1','Pindah Barang Saja'),('06','060102','1','Pindah Barang Saja'),('06','060103','1','Pindah Barang Saja'),('06','060104','1','Pindah Barang Saja'),('06','060105','1','Pindah Barang Saja'),('06','060106','1','Pindah Barang Saja'),('06','060107','1','Pindah Barang Saja'),('06','060108','1','Pindah Barang Saja'),('06','060200','1','Pindah Barang Saja'),('06','060300','1','Pindah Barang Saja'),('06','060400','1','Pindah Barang Saja'),('06','060401','1','Pindah Barang Saja'),('06','060402','1','Pindah Barang Saja'),('06','060500','1','Pindah Barang Saja'),('06','060501','1','Pindah Barang Saja'),('06','060502','1','Pindah Barang Saja'),('06','060503','1','Pindah Barang Saja'),('06','060600','1','Pindah Barang Saja'),('06','060601','1','Pindah Barang Saja'),('06','060602','1','Pindah Barang Saja'),('06','060603','1','Pindah Barang Saja'),('06','060700','1','Pindah Barang Saja'),('06','060701','1','Pindah Barang Saja'),('06','060702','1','Pindah Barang Saja'),('06','060703','1','Pindah Barang Saja'),('06','060800','1','Pindah Barang Saja'),('06','060801','1','Pindah Barang Saja'),('06','060802','1','Pindah Barang Saja'),('06','060900','1','Pindah Barang Saja'),('06','060902','1','Pindah Barang Saja'),('06','060903','1','Pindah Barang Saja'),('06','060904','1','Pindah Barang Saja'),('06','061000','1','Pindah Barang Saja'),('06','061001','1','Pindah Barang Saja'),('06','061002','1','Pindah Barang Saja'),('06','061003','1','Pindah Barang Saja'),('06','061004','1','Pindah Barang Saja'),('06','061100','1','Pindah Barang Saja'),('06','061101','1','Pindah Barang Saja'),('06','061102','1','Pindah Barang Saja'),('06','070000','1','Pindah Barang Saja'),('06','070100','1','Pindah Barang Saja'),('06','070200','1','Pindah Barang Saja'),('06','070400','1','Pindah Barang Saja'),('06','070500','1','Pindah Barang Saja'),('06','070600','1','Pindah Barang Saja'),('06','080000','1','Pindah Barang Saja'),('06','080100','1','Pindah Barang Saja'),('06','080200','1','Pindah Barang Saja'),('06','080300','1','Pindah Barang Saja'),('06','090000','1','Pindah Barang Saja'),('06','090100','1','Pindah Barang Saja'),('06','090101','1','Pindah Barang Saja'),('06','090102','1','Pindah Barang Saja'),('06','090203','1','Pindah Barang Saja'),('06','100000','1','Pindah Barang Saja'),('06','110000','1','Pindah Barang Saja'),('07','010000','1','Jual Barang Saja'),('07','010100','0','Jual Barang Saja'),('07','010200','1','Jual Barang Saja'),('07','010300','0','Jual Barang Saja'),('07','010400','0','Jual Barang Saja'),('07','010500','0','Jual Barang Saja'),('07','010600','0','Jual Barang Saja'),('07','010700','0','Jual Barang Saja'),('07','010900','0','Jual Barang Saja'),('07','020000','0','Jual Barang Saja'),('07','020100','0','Jual Barang Saja'),('07','020200','0','Jual Barang Saja'),('07','020300','0','Jual Barang Saja'),('07','020400','0','Jual Barang Saja'),('07','020500','0','Jual Barang Saja'),('07','020600','0','Jual Barang Saja'),('07','020700','0','Jual Barang Saja'),('07','020800','0','Jual Barang Saja'),('07','020900','0','Jual Barang Saja'),('07','030000','0','Jual Barang Saja'),('07','030100','0','Jual Barang Saja'),('07','040000','0','Jual Barang Saja'),('07','040100','0','Jual Barang Saja'),('07','040101','0','Jual Barang Saja'),('07','040102','0','Jual Barang Saja'),('07','040200','0','Jual Barang Saja'),('07','040201','0','Jual Barang Saja'),('07','040202','0','Jual Barang Saja'),('07','040300','0','Jual Barang Saja'),('07','040301','0','Jual Barang Saja'),('07','040302','0','Jual Barang Saja'),('07','040400','0','Jual Barang Saja'),('07','040401','0','Jual Barang Saja'),('07','040402','0','Jual Barang Saja'),('07','040500','0','Jual Barang Saja'),('07','040501','0','Jual Barang Saja'),('07','040502','0','Jual Barang Saja'),('07','050000','1','Jual Barang Saja'),('07','050100','1','Jual Barang Saja'),('07','050101','1','Jual Barang Saja'),('07','050102','0','Jual Barang Saja'),('07','050200','0','Jual Barang Saja'),('07','050201','0','Jual Barang Saja'),('07','050202','0','Jual Barang Saja'),('07','050300','0','Jual Barang Saja'),('07','050301','0','Jual Barang Saja'),('07','050302','0','Jual Barang Saja'),('07','050400','0','Jual Barang Saja'),('07','050401','0','Jual Barang Saja'),('07','050402','0','Jual Barang Saja'),('07','050500','0','Jual Barang Saja'),('07','050501','0','Jual Barang Saja'),('07','050502','0','Jual Barang Saja'),('07','050600','0','Jual Barang Saja'),('07','050601','0','Jual Barang Saja'),('07','050602','0','Jual Barang Saja'),('07','050700','0','Jual Barang Saja'),('07','050701','0','Jual Barang Saja'),('07','050702','0','Jual Barang Saja'),('07','050800','0','Jual Barang Saja'),('07','050801','0','Jual Barang Saja'),('07','050802','0','Jual Barang Saja'),('07','050803','0','Jual Barang Saja'),('07','050900','0','Jual Barang Saja'),('07','050901','0','Jual Barang Saja'),('07','050902','0','Jual Barang Saja'),('07','051000','0','Jual Barang Saja'),('07','051001','0','Jual Barang Saja'),('07','051002','0','Jual Barang Saja'),('07','060000','0','Jual Barang Saja'),('07','060100','0','Jual Barang Saja'),('07','060101','0','Jual Barang Saja'),('07','060102','0','Jual Barang Saja'),('07','060103','0','Jual Barang Saja'),('07','060104','0','Jual Barang Saja'),('07','060105','0','Jual Barang Saja'),('07','060106','0','Jual Barang Saja'),('07','060107','0','Jual Barang Saja'),('07','060108','0','Jual Barang Saja'),('07','060200','0','Jual Barang Saja'),('07','060300','0','Jual Barang Saja'),('07','060400','0','Jual Barang Saja'),('07','060401','0','Jual Barang Saja'),('07','060402','0','Jual Barang Saja'),('07','060403','0','Jual Barang Saja'),('07','060500','0','Jual Barang Saja'),('07','060501','0','Jual Barang Saja'),('07','060502','0','Jual Barang Saja'),('07','060503','0','Jual Barang Saja'),('07','060600','0','Jual Barang Saja'),('07','060601','0','Jual Barang Saja'),('07','060602','0','Jual Barang Saja'),('07','060603','0','Jual Barang Saja'),('07','060700','0','Jual Barang Saja'),('07','060701','0','Jual Barang Saja'),('07','060702','0','Jual Barang Saja'),('07','060703','0','Jual Barang Saja'),('07','060800','0','Jual Barang Saja'),('07','060801','0','Jual Barang Saja'),('07','060802','0','Jual Barang Saja'),('07','060900','0','Jual Barang Saja'),('07','060901','0','Jual Barang Saja'),('07','060902','0','Jual Barang Saja'),('07','060903','0','Jual Barang Saja'),('07','060904','0','Jual Barang Saja'),('07','061000','0','Jual Barang Saja'),('07','061001','0','Jual Barang Saja'),('07','061002','0','Jual Barang Saja'),('07','061003','0','Jual Barang Saja'),('07','061004','0','Jual Barang Saja'),('07','061100','0','Jual Barang Saja'),('07','061101','0','Jual Barang Saja'),('07','061102','0','Jual Barang Saja'),('07','061104','0','Jual Barang Saja'),('07','070000','0','Jual Barang Saja'),('07','070100','0','Jual Barang Saja'),('07','070200','0','Jual Barang Saja'),('07','070400','0','Jual Barang Saja'),('07','070500','0','Jual Barang Saja'),('07','070600','0','Jual Barang Saja'),('07','080000','0','Jual Barang Saja'),('07','080100','0','Jual Barang Saja'),('07','080200','0','Jual Barang Saja'),('07','080300','0','Jual Barang Saja'),('07','090000','0','Jual Barang Saja'),('07','090100','0','Jual Barang Saja'),('07','090101','0','Jual Barang Saja'),('07','090102','0','Jual Barang Saja'),('07','090203','0','Jual Barang Saja'),('07','090300','0','Jual Barang Saja'),('07','090301','0','Jual Barang Saja'),('07','090302','0','Jual Barang Saja'),('07','100000','0','Jual Barang Saja'),('07','110000','1','Jual Barang Saja'),('08','010000','1','Khusus antar'),('08','010100','1','Khusus antar'),('08','010200','1','Khusus antar'),('08','010300','1','Khusus antar'),('08','010400','1','Khusus antar'),('08','010500','1','Khusus antar'),('08','010600','1','Khusus antar'),('08','010700','1','Khusus antar'),('08','010900','1','Khusus antar'),('08','020000','1','Khusus antar'),('08','020100','1','Khusus antar'),('08','020200','1','Khusus antar'),('08','020300','1','Khusus antar'),('08','020400','1','Khusus antar'),('08','020500','1','Khusus antar'),('08','020600','1','Khusus antar'),('08','020700','1','Khusus antar'),('08','020800','1','Khusus antar'),('08','020900','1','Khusus antar'),('08','030000','1','Khusus antar'),('08','030100','1','Khusus antar'),('08','040000','1','Khusus antar'),('08','040100','1','Khusus antar'),('08','040101','1','Khusus antar'),('08','040102','1','Khusus antar'),('08','040200','1','Khusus antar'),('08','040201','1','Khusus antar'),('08','040202','1','Khusus antar'),('08','040300','1','Khusus antar'),('08','040301','1','Khusus antar'),('08','040302','1','Khusus antar'),('08','040400','1','Khusus antar'),('08','040401','1','Khusus antar'),('08','040402','1','Khusus antar'),('08','040500','1','Khusus antar'),('08','040501','1','Khusus antar'),('08','040502','1','Khusus antar'),('08','050000','1','Khusus antar'),('08','050100','1','Khusus antar'),('08','050101','1','Khusus antar'),('08','050102','1','Khusus antar'),('08','050200','1','Khusus antar'),('08','050201','1','Khusus antar'),('08','050202','1','Khusus antar'),('08','050400','1','Khusus antar'),('08','050401','1','Khusus antar'),('08','050402','1','Khusus antar'),('08','050500','1','Khusus antar'),('08','050501','1','Khusus antar'),('08','050502','1','Khusus antar'),('08','050600','1','Khusus antar'),('08','050601','1','Khusus antar'),('08','050602','1','Khusus antar'),('08','050700','1','Khusus antar'),('08','050701','1','Khusus antar'),('08','050702','1','Khusus antar'),('08','050800','1','Khusus antar'),('08','050801','1','Khusus antar'),('08','050802','1','Khusus antar'),('08','050803','1','Khusus antar'),('08','050900','1','Khusus antar'),('08','050901','1','Khusus antar'),('08','050902','1','Khusus antar'),('08','051000','1','Khusus antar'),('08','051001','1','Khusus antar'),('08','051002','1','Khusus antar'),('08','060000','1','Khusus antar'),('08','060100','1','Khusus antar'),('08','060101','1','Khusus antar'),('08','060102','1','Khusus antar'),('08','060103','1','Khusus antar'),('08','060104','1','Khusus antar'),('08','060105','1','Khusus antar'),('08','060106','1','Khusus antar'),('08','060107','1','Khusus antar'),('08','060108','1','Khusus antar'),('08','060200','1','Khusus antar'),('08','060300','1','Khusus antar'),('08','060400','1','Khusus antar'),('08','060401','1','Khusus antar'),('08','060402','1','Khusus antar'),('08','060500','1','Khusus antar'),('08','060501','1','Khusus antar'),('08','060502','1','Khusus antar'),('08','060503','1','Khusus antar'),('08','060600','1','Khusus antar'),('08','060601','1','Khusus antar'),('08','060602','1','Khusus antar'),('08','060603','1','Khusus antar'),('08','060700','1','Khusus antar'),('08','060701','1','Khusus antar'),('08','060702','1','Khusus antar'),('08','060703','1','Khusus antar'),('08','060800','1','Khusus antar'),('08','060801','1','Khusus antar'),('08','060802','1','Khusus antar'),('08','060900','1','Khusus antar'),('08','060902','1','Khusus antar'),('08','060903','1','Khusus antar'),('08','060904','1','Khusus antar'),('08','061000','1','Khusus antar'),('08','061001','1','Khusus antar'),('08','061002','1','Khusus antar'),('08','061003','1','Khusus antar'),('08','061004','1','Khusus antar'),('08','061100','1','Khusus antar'),('08','061101','1','Khusus antar'),('08','061102','1','Khusus antar'),('08','070000','1','Khusus antar'),('08','070100','1','Khusus antar'),('08','070200','1','Khusus antar'),('08','070400','1','Khusus antar'),('08','070500','1','Khusus antar'),('08','070600','1','Khusus antar'),('08','080000','1','Khusus antar'),('08','080100','1','Khusus antar'),('08','080200','1','Khusus antar'),('08','080300','1','Khusus antar'),('08','090000','1','Khusus antar'),('08','090100','1','Khusus antar'),('08','090101','1','Khusus antar'),('08','090102','1','Khusus antar'),('08','090203','1','Khusus antar'),('08','100000','1','Khusus antar'),('08','110000','1','Khusus antar'),('09','010000','1','Kasir 2'),('09','010100','1','Kasir 2'),('09','010200','1','Kasir 2'),('09','010300','1','Kasir 2'),('09','010400','1','Kasir 2'),('09','010500','1','Kasir 2'),('09','010600','1','Kasir 2'),('09','010700','1','Kasir 2'),('09','010900','1','Kasir 2'),('09','020000','1','Kasir 2'),('09','020100','1','Kasir 2'),('09','020200','1','Kasir 2'),('09','020300','1','Kasir 2'),('09','020400','1','Kasir 2'),('09','020500','1','Kasir 2'),('09','020600','1','Kasir 2'),('09','020700','1','Kasir 2'),('09','020800','1','Kasir 2'),('09','020900','1','Kasir 2'),('09','030000','1','Kasir 2'),('09','030100','1','Kasir 2'),('09','040000','1','Kasir 2'),('09','040100','1','Kasir 2'),('09','040101','1','Kasir 2'),('09','040102','1','Kasir 2'),('09','040200','1','Kasir 2'),('09','040201','1','Kasir 2'),('09','040202','1','Kasir 2'),('09','040300','1','Kasir 2'),('09','040301','1','Kasir 2'),('09','040302','1','Kasir 2'),('09','040400','1','Kasir 2'),('09','040401','1','Kasir 2'),('09','040402','1','Kasir 2'),('09','040500','1','Kasir 2'),('09','040501','1','Kasir 2'),('09','040502','1','Kasir 2'),('09','050000','1','Kasir 2'),('09','050100','1','Kasir 2'),('09','050101','1','Kasir 2'),('09','050102','1','Kasir 2'),('09','050200','1','Kasir 2'),('09','050201','1','Kasir 2'),('09','050202','1','Kasir 2'),('09','050400','1','Kasir 2'),('09','050401','1','Kasir 2'),('09','050402','1','Kasir 2'),('09','050500','1','Kasir 2'),('09','050501','1','Kasir 2'),('09','050502','1','Kasir 2'),('09','050600','1','Kasir 2'),('09','050601','1','Kasir 2'),('09','050602','1','Kasir 2'),('09','050700','1','Kasir 2'),('09','050701','1','Kasir 2'),('09','050702','1','Kasir 2'),('09','050800','1','Kasir 2'),('09','050801','1','Kasir 2'),('09','050802','1','Kasir 2'),('09','050803','1','Kasir 2'),('09','050900','1','Kasir 2'),('09','050901','1','Kasir 2'),('09','050902','1','Kasir 2'),('09','051000','1','Kasir 2'),('09','051001','1','Kasir 2'),('09','051002','1','Kasir 2'),('09','060000','1','Kasir 2'),('09','060100','1','Kasir 2'),('09','060101','1','Kasir 2'),('09','060102','1','Kasir 2'),('09','060103','1','Kasir 2'),('09','060104','1','Kasir 2'),('09','060105','1','Kasir 2'),('09','060106','1','Kasir 2'),('09','060107','1','Kasir 2'),('09','060108','1','Kasir 2'),('09','060200','1','Kasir 2'),('09','060300','1','Kasir 2'),('09','060400','1','Kasir 2'),('09','060401','1','Kasir 2'),('09','060402','1','Kasir 2'),('09','060500','1','Kasir 2'),('09','060501','1','Kasir 2'),('09','060502','1','Kasir 2'),('09','060503','1','Kasir 2'),('09','060600','1','Kasir 2'),('09','060601','1','Kasir 2'),('09','060602','1','Kasir 2'),('09','060603','1','Kasir 2'),('09','060700','1','Kasir 2'),('09','060701','1','Kasir 2'),('09','060702','1','Kasir 2'),('09','060703','1','Kasir 2'),('09','060800','1','Kasir 2'),('09','060801','1','Kasir 2'),('09','060802','1','Kasir 2'),('09','060900','1','Kasir 2'),('09','060902','1','Kasir 2'),('09','060903','1','Kasir 2'),('09','060904','1','Kasir 2'),('09','061000','1','Kasir 2'),('09','061001','1','Kasir 2'),('09','061002','1','Kasir 2'),('09','061003','1','Kasir 2'),('09','061004','1','Kasir 2'),('09','061100','1','Kasir 2'),('09','061101','1','Kasir 2'),('09','061102','1','Kasir 2'),('09','070000','1','Kasir 2'),('09','070100','1','Kasir 2'),('09','070200','1','Kasir 2'),('09','070400','1','Kasir 2'),('09','070500','1','Kasir 2'),('09','070600','1','Kasir 2'),('09','080000','1','Kasir 2'),('09','080100','1','Kasir 2'),('09','080200','1','Kasir 2'),('09','080300','1','Kasir 2'),('09','090000','1','Kasir 2'),('09','090100','1','Kasir 2'),('09','090101','1','Kasir 2'),('09','090102','1','Kasir 2'),('09','090203','1','Kasir 2'),('09','100000','1','Kasir 2'),('09','110000','1','Kasir 2'),('10','010000','1','Kasir 2 Exclusiv'),('10','010100','1','Kasir 2 Exclusiv'),('10','010200','1','Kasir 2 Exclusiv'),('10','010300','1','Kasir 2 Exclusiv'),('10','010400','1','Kasir 2 Exclusiv'),('10','010500','1','Kasir 2 Exclusiv'),('10','010600','1','Kasir 2 Exclusiv'),('10','010700','1','Kasir 2 Exclusiv'),('10','010900','1','Kasir 2 Exclusiv'),('10','020000','1','Kasir 2 Exclusiv'),('10','020100','1','Kasir 2 Exclusiv'),('10','020200','1','Kasir 2 Exclusiv'),('10','020300','1','Kasir 2 Exclusiv'),('10','020400','1','Kasir 2 Exclusiv'),('10','020500','1','Kasir 2 Exclusiv'),('10','020600','1','Kasir 2 Exclusiv'),('10','020700','1','Kasir 2 Exclusiv'),('10','020800','1','Kasir 2 Exclusiv'),('10','020900','1','Kasir 2 Exclusiv'),('10','030000','1','Kasir 2 Exclusiv'),('10','030100','1','Kasir 2 Exclusiv'),('10','040000','1','Kasir 2 Exclusiv'),('10','040100','1','Kasir 2 Exclusiv'),('10','040101','1','Kasir 2 Exclusiv'),('10','040102','1','Kasir 2 Exclusiv'),('10','040200','1','Kasir 2 Exclusiv'),('10','040201','1','Kasir 2 Exclusiv'),('10','040202','1','Kasir 2 Exclusiv'),('10','040300','1','Kasir 2 Exclusiv'),('10','040301','1','Kasir 2 Exclusiv'),('10','040302','1','Kasir 2 Exclusiv'),('10','040400','1','Kasir 2 Exclusiv'),('10','040401','1','Kasir 2 Exclusiv'),('10','040402','1','Kasir 2 Exclusiv'),('10','040500','1','Kasir 2 Exclusiv'),('10','040501','1','Kasir 2 Exclusiv'),('10','040502','1','Kasir 2 Exclusiv'),('10','050000','1','Kasir 2 Exclusiv'),('10','050100','1','Kasir 2 Exclusiv'),('10','050101','1','Kasir 2 Exclusiv'),('10','050102','1','Kasir 2 Exclusiv'),('10','050200','1','Kasir 2 Exclusiv'),('10','050201','1','Kasir 2 Exclusiv'),('10','050202','1','Kasir 2 Exclusiv'),('10','050400','1','Kasir 2 Exclusiv'),('10','050401','1','Kasir 2 Exclusiv'),('10','050402','1','Kasir 2 Exclusiv'),('10','050500','1','Kasir 2 Exclusiv'),('10','050501','1','Kasir 2 Exclusiv'),('10','050502','1','Kasir 2 Exclusiv'),('10','050600','1','Kasir 2 Exclusiv'),('10','050601','1','Kasir 2 Exclusiv'),('10','050602','1','Kasir 2 Exclusiv'),('10','050700','1','Kasir 2 Exclusiv'),('10','050701','1','Kasir 2 Exclusiv'),('10','050702','1','Kasir 2 Exclusiv'),('10','050800','1','Kasir 2 Exclusiv'),('10','050801','1','Kasir 2 Exclusiv'),('10','050802','1','Kasir 2 Exclusiv'),('10','050803','1','Kasir 2 Exclusiv'),('10','050900','1','Kasir 2 Exclusiv'),('10','050901','1','Kasir 2 Exclusiv'),('10','050902','1','Kasir 2 Exclusiv'),('10','051000','1','Kasir 2 Exclusiv'),('10','051001','1','Kasir 2 Exclusiv'),('10','051002','1','Kasir 2 Exclusiv'),('10','060000','1','Kasir 2 Exclusiv'),('10','060100','1','Kasir 2 Exclusiv'),('10','060101','1','Kasir 2 Exclusiv'),('10','060102','1','Kasir 2 Exclusiv'),('10','060103','1','Kasir 2 Exclusiv'),('10','060104','1','Kasir 2 Exclusiv'),('10','060105','1','Kasir 2 Exclusiv'),('10','060106','1','Kasir 2 Exclusiv'),('10','060107','1','Kasir 2 Exclusiv'),('10','060108','1','Kasir 2 Exclusiv'),('10','060200','1','Kasir 2 Exclusiv'),('10','060300','1','Kasir 2 Exclusiv'),('10','060400','1','Kasir 2 Exclusiv'),('10','060401','1','Kasir 2 Exclusiv'),('10','060402','1','Kasir 2 Exclusiv'),('10','060500','1','Kasir 2 Exclusiv'),('10','060501','1','Kasir 2 Exclusiv'),('10','060502','1','Kasir 2 Exclusiv'),('10','060503','1','Kasir 2 Exclusiv'),('10','060600','1','Kasir 2 Exclusiv'),('10','060601','1','Kasir 2 Exclusiv'),('10','060602','1','Kasir 2 Exclusiv'),('10','060603','1','Kasir 2 Exclusiv'),('10','060700','1','Kasir 2 Exclusiv'),('10','060701','1','Kasir 2 Exclusiv'),('10','060702','1','Kasir 2 Exclusiv'),('10','060703','1','Kasir 2 Exclusiv'),('10','060800','1','Kasir 2 Exclusiv'),('10','060801','1','Kasir 2 Exclusiv'),('10','060802','1','Kasir 2 Exclusiv'),('10','060900','1','Kasir 2 Exclusiv'),('10','060902','1','Kasir 2 Exclusiv'),('10','060903','1','Kasir 2 Exclusiv'),('10','060904','1','Kasir 2 Exclusiv'),('10','061000','1','Kasir 2 Exclusiv'),('10','061001','1','Kasir 2 Exclusiv'),('10','061002','1','Kasir 2 Exclusiv'),('10','061003','1','Kasir 2 Exclusiv'),('10','061004','1','Kasir 2 Exclusiv'),('10','061100','1','Kasir 2 Exclusiv'),('10','061101','1','Kasir 2 Exclusiv'),('10','061102','1','Kasir 2 Exclusiv'),('10','070000','1','Kasir 2 Exclusiv'),('10','070100','1','Kasir 2 Exclusiv'),('10','070200','1','Kasir 2 Exclusiv'),('10','070400','1','Kasir 2 Exclusiv'),('10','070500','1','Kasir 2 Exclusiv'),('10','070600','1','Kasir 2 Exclusiv'),('10','080000','1','Kasir 2 Exclusiv'),('10','080100','1','Kasir 2 Exclusiv'),('10','080200','1','Kasir 2 Exclusiv'),('10','080300','1','Kasir 2 Exclusiv'),('10','090000','1','Kasir 2 Exclusiv'),('10','090100','1','Kasir 2 Exclusiv'),('10','090101','1','Kasir 2 Exclusiv'),('10','090102','1','Kasir 2 Exclusiv'),('10','090203','1','Kasir 2 Exclusiv'),('10','100000','1','Kasir 2 Exclusiv'),('10','110000','1','Kasir 2 Exclusiv'),('11','010000','1','Lain - lain'),('11','010100','1','Lain - lain'),('11','010200','1','Lain - lain'),('11','010300','1','Lain - lain'),('11','010400','1','Lain - lain'),('11','010500','1','Lain - lain'),('11','010600','1','Lain - lain'),('11','010700','1','Lain - lain'),('11','010900','1','Lain - lain'),('11','020000','1','Lain - lain'),('11','020100','1','Lain - lain'),('11','020200','1','Lain - lain'),('11','020300','1','Lain - lain'),('11','020400','1','Lain - lain'),('11','020500','1','Lain - lain'),('11','020600','1','Lain - lain'),('11','020700','1','Lain - lain'),('11','020800','1','Lain - lain'),('11','020900','1','Lain - lain'),('11','030000','1','Lain - lain'),('11','030100','1','Lain - lain'),('11','040000','1','Lain - lain'),('11','040100','1','Lain - lain'),('11','040101','1','Lain - lain'),('11','040102','1','Lain - lain'),('11','040200','1','Lain - lain'),('11','040201','1','Lain - lain'),('11','040202','1','Lain - lain'),('11','040300','1','Lain - lain'),('11','040301','1','Lain - lain'),('11','040302','1','Lain - lain'),('11','040400','1','Lain - lain'),('11','040401','1','Lain - lain'),('11','040402','1','Lain - lain'),('11','040500','1','Lain - lain'),('11','040501','1','Lain - lain'),('11','040502','1','Lain - lain'),('11','050000','1','Lain - lain'),('11','050100','1','Lain - lain'),('11','050101','1','Lain - lain'),('11','050102','1','Lain - lain'),('11','050200','1','Lain - lain'),('11','050201','1','Lain - lain'),('11','050202','1','Lain - lain'),('11','050400','1','Lain - lain'),('11','050401','1','Lain - lain'),('11','050402','1','Lain - lain'),('11','050500','1','Lain - lain'),('11','050501','1','Lain - lain'),('11','050502','1','Lain - lain'),('11','050600','1','Lain - lain'),('11','050601','1','Lain - lain'),('11','050602','1','Lain - lain'),('11','050700','1','Lain - lain'),('11','050701','1','Lain - lain'),('11','050702','1','Lain - lain'),('11','050800','1','Lain - lain'),('11','050801','1','Lain - lain'),('11','050802','1','Lain - lain'),('11','050803','1','Lain - lain'),('11','050900','1','Lain - lain'),('11','050901','1','Lain - lain'),('11','050902','1','Lain - lain'),('11','051000','1','Lain - lain'),('11','051001','1','Lain - lain'),('11','051002','1','Lain - lain'),('11','060000','1','Lain - lain'),('11','060100','1','Lain - lain'),('11','060101','1','Lain - lain'),('11','060102','1','Lain - lain'),('11','060103','1','Lain - lain'),('11','060104','1','Lain - lain'),('11','060105','1','Lain - lain'),('11','060106','1','Lain - lain'),('11','060107','1','Lain - lain'),('11','060108','1','Lain - lain'),('11','060200','1','Lain - lain'),('11','060300','1','Lain - lain'),('11','060400','1','Lain - lain'),('11','060401','1','Lain - lain'),('11','060402','1','Lain - lain'),('11','060500','1','Lain - lain'),('11','060501','1','Lain - lain'),('11','060502','1','Lain - lain'),('11','060503','1','Lain - lain'),('11','060600','1','Lain - lain'),('11','060601','1','Lain - lain'),('11','060602','1','Lain - lain'),('11','060603','1','Lain - lain'),('11','060700','1','Lain - lain'),('11','060701','1','Lain - lain'),('11','060702','1','Lain - lain'),('11','060703','1','Lain - lain'),('11','060800','1','Lain - lain'),('11','060801','1','Lain - lain'),('11','060802','1','Lain - lain'),('11','060900','1','Lain - lain'),('11','060902','1','Lain - lain'),('11','060903','1','Lain - lain'),('11','060904','1','Lain - lain'),('11','061000','1','Lain - lain'),('11','061001','1','Lain - lain'),('11','061002','1','Lain - lain'),('11','061003','1','Lain - lain'),('11','061004','1','Lain - lain'),('11','061100','1','Lain - lain'),('11','061101','1','Lain - lain'),('11','061102','1','Lain - lain'),('11','070000','1','Lain - lain'),('11','070100','1','Lain - lain'),('11','070200','1','Lain - lain'),('11','070400','1','Lain - lain'),('11','070500','1','Lain - lain'),('11','070600','1','Lain - lain'),('11','080000','1','Lain - lain'),('11','080100','1','Lain - lain'),('11','080200','1','Lain - lain'),('11','080300','1','Lain - lain'),('11','090000','1','Lain - lain'),('11','090100','1','Lain - lain'),('11','090101','1','Lain - lain'),('11','090102','1','Lain - lain'),('11','090203','1','Lain - lain'),('11','100000','1','Lain - lain'),('11','110000','1','Lain - lain'),('12','010000','1','Pembelian & cek'),('12','010100','1','Pembelian & cek'),('12','010200','1','Pembelian & cek'),('12','010300','0','Pembelian & cek'),('12','030000','1','Pembelian & cek'),('12','030100','1','Pembelian & cek'),('12','040000','1','Pembelian & cek'),('12','040100','1','Pembelian & cek'),('12','040101','1','Pembelian & cek'),('12','040102','1','Pembelian & cek'),('12','040200','1','Pembelian & cek'),('12','040201','1','Pembelian & cek'),('12','040202','1','Pembelian & cek'),('12','040300','1','Pembelian & cek'),('12','040301','1','Pembelian & cek'),('12','040302','1','Pembelian & cek'),('12','050000','1','Pembelian & cek'),('12','050100','1','Pembelian & cek'),('12','050101','1','Pembelian & cek'),('12','050102','1','Pembelian & cek'),('12','050200','1','Pembelian & cek'),('12','050201','1','Pembelian & cek'),('12','050202','1','Pembelian & cek'),('12','050400','1','Pembelian & cek'),('12','050401','1','Pembelian & cek'),('12','050402','1','Pembelian & cek'),('12','050500','1','Pembelian & cek'),('12','050501','1','Pembelian & cek'),('12','050502','1','Pembelian & cek'),('12','050600','1','Pembelian & cek'),('12','050601','1','Pembelian & cek'),('12','050602','1','Pembelian & cek'),('12','050700','1','Pembelian & cek'),('12','050701','1','Pembelian & cek'),('12','050702','1','Pembelian & cek'),('12','050800','1','Pembelian & cek'),('12','050801','1','Pembelian & cek'),('12','050802','1','Pembelian & cek'),('12','050803','1','Pembelian & cek'),('12','050900','1','Pembelian & cek'),('12','050901','1','Pembelian & cek'),('12','050902','1','Pembelian & cek'),('12','051000','1','Pembelian & cek'),('12','051001','1','Pembelian & cek'),('12','051002','1','Pembelian & cek'),('12','060000','1','Pembelian & cek'),('12','060100','1','Pembelian & cek'),('12','060101','1','Pembelian & cek'),('12','060102','1','Pembelian & cek'),('12','060103','1','Pembelian & cek'),('12','060104','1','Pembelian & cek'),('12','060105','1','Pembelian & cek'),('12','060106','1','Pembelian & cek'),('12','060107','1','Pembelian & cek'),('12','060108','1','Pembelian & cek'),('12','060200','1','Pembelian & cek'),('12','060300','1','Pembelian & cek'),('12','060400','1','Pembelian & cek'),('12','060401','1','Pembelian & cek'),('12','060402','1','Pembelian & cek'),('12','060700','1','Pembelian & cek'),('12','060701','1','Pembelian & cek'),('12','060702','1','Pembelian & cek'),('12','060703','1','Pembelian & cek'),('12','060800','1','Pembelian & cek'),('12','060801','1','Pembelian & cek'),('12','060802','1','Pembelian & cek'),('12','060900','1','Pembelian & cek'),('12','060902','1','Pembelian & cek'),('12','060903','1','Pembelian & cek'),('12','060904','1','Pembelian & cek'),('12','061000','1','Pembelian & cek'),('12','061001','1','Pembelian & cek'),('12','061002','1','Pembelian & cek'),('12','061003','1','Pembelian & cek'),('12','061004','1','Pembelian & cek'),('12','061100','1','Pembelian & cek'),('12','061101','1','Pembelian & cek'),('12','061102','1','Pembelian & cek'),('12','061104','1','Pembelian & cek'),('12','090000','1','Pembelian & cek'),('12','090100','1','Pembelian & cek'),('12','090101','1','Pembelian & cek'),('12','090102','1','Pembelian & cek'),('12','100000','1','Pembelian & cek'),('12','110000','1','Pembelian & cek'),('13','010000','1','Pembelian saja tok!'),('13','010100','1','Pembelian saja tok!'),('13','010200','1','Pembelian saja tok!'),('13','040000','1','Pembelian saja tok!'),('13','040100','1','Pembelian saja tok!'),('13','040101','1','Pembelian saja tok!'),('13','040102','1','Pembelian saja tok!'),('13','060400','1','Pembelian saja tok!'),('13','060401','1','Pembelian saja tok!'),('13','060402','1','Pembelian saja tok!'),('13','060700','1','Pembelian saja tok!'),('13','060701','1','Pembelian saja tok!'),('13','110000','1','Pembelian saja tok!');

--
-- Table structure for table `userlog`
--

CREATE TABLE `userlog` (
  `tgllog` date NOT NULL default '0000-00-00',
  `jamlog` time NOT NULL default '00:00:00',
  `log` char(255) NOT NULL default '',
  `user` char(65) NOT NULL default '',
  `userip` char(15) NOT NULL default '',
  `userhost` char(60) NOT NULL default '',
  KEY `Index_tgl` (`tgllog`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `userlog`
--

INSERT INTO `userlog` VALUES ('2024-01-30','13:09:54','Login','ADMIN - ADMIN','154.26.130.93',''),('2024-01-30','13:11:47','Transaksi Penjualan Grosir Baru (NoJual=7240130001)','ADMIN','154.26.130.93',''),('2024-01-30','13:14:58','Login dari IP lain','asp','154.26.130.93',''),('2024-01-30','13:15:08','Login','ADMIN - ADMIN','154.26.130.93',''),('2024-01-30','13:15:41','Login','ADMIN - ADMIN','154.26.130.93',''),('2024-01-30','13:36:49','Login dari IP lain','asp','154.26.130.93',''),('2024-01-30','13:36:56','Login','ADMIN - ADMIN','154.26.130.93',''),('2024-01-30','13:37:51','Login dari IP lain','asp','154.26.130.93',''),('2024-01-30','13:37:54','Login','ADMIN - ADMIN','154.26.130.93',''),('2024-01-30','13:39:38','Edit setup konfigurasi','ADMIN','154.26.130.93',''),('2024-01-30','13:39:52','Edit setup konfigurasi','ADMIN','154.26.130.93',''),('2024-01-30','13:47:37','Login','ADMIN - ADMIN','154.26.130.93',''),('2024-01-30','13:50:16','Transaksi Penjualan Retail Baru (NoJual=7240130001)','ADMIN','154.26.130.93',''),('2024-01-30','14:21:37','Login','ADMIN - ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:07','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:08','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:09','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:09','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:09','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:09','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:09','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:09','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:09','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:09','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:09','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:09','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:09','Update setting level user (level=01)','ADMIN','154.26.130.93',''),('2024-01-30','14:22:18','Login','ADMIN - ADMIN','154.26.130.93',''),('2024-01-30','14:22:45','Transaksi Retur Penjualan Retail Baru (NoRetur=24000001)','ADMIN','154.26.130.93',''),('2024-02-07','09:07:19','Login dari IP lain','asp','154.26.130.93',''),('2024-02-07','09:08:15','Login','ADMIN - ADMIN','154.26.130.93',''),('2024-02-07','09:09:27','Transaksi Pembelian Baru (NoBeli=72400001)','ADMIN','154.26.130.93',''),('2024-02-07','09:10:05','Transaksi Penjualan Retail Baru (NoJual=7240207001)','ADMIN','154.26.130.93',''),('2024-02-07','09:10:38','Transaksi Penjualan Grosir Baru (NoJual=7240207001)','ADMIN','154.26.130.93',''),('2024-02-07','10:09:48','Login dari IP lain','asp','154.26.130.93',''),('2024-02-07','10:09:54','Login','ADMIN - ADMIN','154.26.130.93',''),('2024-02-07','10:34:24','Login dari IP lain','asp','154.26.130.93',''),('2024-02-07','10:34:26','Login','ADMIN - ADMIN','154.26.130.93',''),('2024-02-07','13:28:17','Login dari IP lain','asp','154.26.130.93',''),('2024-02-07','13:28:24','Login','ADMIN - ADMIN','154.26.130.93',''),('2024-02-12','13:23:08','Login dari IP lain','asp','154.26.130.93',''),('2024-02-12','13:23:12','Login','ADMIN - ADMIN','154.26.130.93',''),('2024-02-23','10:39:52','Login','ADMIN - ADMIN','154.26.130.93','');

--
-- Table structure for table `v_stockbrg`
--

CREATE TABLE `v_stockbrg` (
  `KodeBrg` varchar(50) default NULL,
  `Namabrg` varchar(200) default NULL,
  `StockAkhir` decimal(10,0) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `v_stockbrg`
--


--
-- Dumping routines for database 'dbmanunggal_jaya'
--
DELIMITER ;;
/*!50003 DROP FUNCTION IF EXISTS `BuatNo` */;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `BuatNo`(sUser varchar(1),Nama Varchar(20),Codes varchar(2),Tgl Varchar(10),Trans varchar(2),NoBaru varchar(11)) RETURNS char(11) CHARSET latin1
BEGIN
  DECLARE nUser Varchar(1) DEFAULT 0;
  DECLARE yy Varchar(2) DEFAULT 0;
  DECLARE mm Varchar(2) DEFAULT 0;
  DECLARE dd Varchar(2) DEFAULT 0;
  DECLARE NoInt Integer DEFAULT 0;
  DECLARE NoStr Varchar(11) DEFAULT 0;
  DECLARE Nomer Varchar(11) DEFAULT 0;
  DECLARE thn Varchar(6) DEFAULT 0;
  DECLARE TipeNo Integer DEFAULT 0;
  set nUser = Substring(sUser,1,1); 
  Set yy=Substring(tgl,3,2);
  Set mm=Substring(tgl,6,2);
  Set dd=Substring(tgl,9,2);
  Select ifnull(nilainum,1) into TipeNo from tm_setupall where groups='Nomor' and subgroups=Codes;
  If (TipeNo=0) or (TipeNo=1) then
     select if(ifnull(substring(nilaichar,3,6),0)='',0,ifnull(substring(nilaichar,3,6),0)),ifnull(nilaichar,'00') into NoInt,Nomer from tm_setupall where groups='Nomor' and subgroups=Codes;
     set thn=substring(nomer,1,2);
     if thn=yy then
        set NoInt=NoInt+1;
        set NoStr=NoInt;
        set NoBaru=concat(yy,REPEAT('0',6-length(NoStr)),NoStr);
     else
        case upper(Nama)
             when upper('Tr_Beli') then select ifnull(max(substring(noBeli,3,6)),0) into NoInt from TR_Beli_m where left(NoBeli,2)=yy and transBeli=Trans;
             when upper('Tr_Jual') then select ifnull(max(substring(noJual,3,6)),0) into NoInt from TR_Jual_m where left(NoJual,2)=yy and TransJual=Trans;
             when upper('Tr_JualR') then select ifnull(max(substring(noJualR,3,6)),0) into NoInt from TR_JualR_m where left(NoJualR,2)=yy and TransRetail=Trans;
             when upper('Tr_JualRakitan') then select ifnull(max(substring(noJual,3,6)),0) into NoInt from TR_JualRakitan_m where left(NoJual,2)=yy and TransJual=Trans;
             when upper('Tr_BayarBeli') then select ifnull(max(substring(noBayarB,3,6)),0) into NoInt from TR_BayarBeli_m where left(NoBayarB,2)=yy;
             when upper('Tr_BayarJual') then select ifnull(max(substring(noBayarJ,3,6)),0) into NoInt from TR_BayarJual_m where left(NoBayarJ,2)=yy;
             when upper('Tr_BayarJualRakitan') then select ifnull(max(substring(noBayarJ,3,6)),0) into NoInt from TR_BayarJualRakitan_m where left(NoBayarJ,2)=yy;
             when upper('Tr_RetBeli') then select ifnull(max(substring(noRetB,3,6)),0) into NoInt from TR_RetBeli_m where left(NoRetB,2)=yy and TransRetB=Trans;
             when upper('Tr_RetJual') then select ifnull(max(substring(noRetJ,3,6)),0) into NoInt from TR_RetJual_m where left(NoRetJ,2)=yy and TransRetJ=Trans;
             when upper('Tr_RetJualR') then select ifnull(max(substring(noRetJ,3,6)),0) into NoInt from TR_RetJualR_m where left(NoRetJ,2)=yy and TransRetJ=Trans;
             when upper('Tr_RetJualRakitan') then select ifnull(max(substring(noRetJ,3,6)),0) into NoInt from TR_RetJualRakitan_m where left(NoRetJ,2)=yy and TransRetJ=Trans;
             when upper('Tr_PoJual') then select ifnull(max(substring(nopo,3,6)),0) into NoInt from TR_PoJual_m where left(NoPo,2)=yy;
             when upper('Tr_PoJualRakitan') then select ifnull(max(substring(nopo,3,6)),0) into NoInt from TR_PoJualRakitan_m where left(NoPo,2)=yy;
             when upper('Tr_PIndahGd') then select ifnull(max(substring(noPindahGd,3,6)),0) into NoInt from Tr_PindahGd_M where left(noPindahGd,2)=yy;
             when upper('Tr_BuangGd') then select ifnull(max(substring(noBuangGd,3,6)),0) into NoInt from Tr_BuangGd_M where left(noBuangGd,2)=yy;
             when upper('Close') then select ifnull(max(substring(noClose,3,6)),0) into NoInt from TR_JualR_m where left(NoJualR,2)=yy and TransRetail=Trans;
        end case;
        if NoInt=0 then
           set NoBaru = concat(yy,'000001');
        else
           set noInt = noInt + 1;
           set noStr = noInt;
           set NoBaru= concat(yy,repeat('0',6-length(NoStr)),NoStr);
        end if;
     end if;
  end if;
  If (TipeNo=2) then
     select if(ifnull(substring(nilaichar,5,4),0)='',0,ifnull(substring(nilaichar,5,4),0)),ifnull(nilaichar,'00') into NoInt,Nomer from tm_setupall where groups='Nomor' and subgroups=Codes;
     set thn=substring(nomer,1,4);
     if thn=concat(yy,mm) then
        set NoInt=NoInt+1;
        set NoStr=NoInt;
        set NoBaru=concat(yy,mm,REPEAT('0',4-length(NoStr)),NoStr);
     else
        case upper(Nama)
             when upper('Tr_Beli') then select ifnull(max(substring(noBeli,5,4)),0) into NoInt from TR_Beli_m where left(NoBeli,4)=concat(yy,mm) and transBeli=Trans;
             when upper('Tr_Jual') then select ifnull(max(substring(noJual,5,4)),0) into NoInt from TR_Jual_m where left(NoJual,4)=concat(yy,mm) and TransJual=Trans;
             when upper('Tr_JualR') then select ifnull(max(substring(noJualR,5,4)),0) into NoInt from TR_JualR_m where left(NoJualR,4)=concat(yy,mm) and TransRetail=Trans;
             when upper('Tr_JualRakitan') then select ifnull(max(substring(noJual,5,4)),0) into NoInt from TR_JualRakitan_m where left(NoJual,4)=concat(yy,mm) and TransJual=Trans;
             when upper('Tr_BayarBeli') then select ifnull(max(substring(noBayarB,5,4)),0) into NoInt from TR_BayarBeli_m where left(NoBayarB,4)=concat(yy,mm);
             when upper('Tr_BayarJual') then select ifnull(max(substring(noBayarJ,5,4)),0) into NoInt from TR_BayarJual_m where left(NoBayarJ,4)=concat(yy,mm);
             when upper('Tr_BayarJualRakitan') then select ifnull(max(substring(noBayarJ,5,4)),0) into NoInt from TR_BayarJualRakitan_m where left(NoBayarJ,4)=concat(yy,mm);
             when upper('Tr_RetBeli') then select ifnull(max(substring(noRetB,5,4)),0) into NoInt from TR_RetBeli_m where left(NoRetB,4)=concat(yy,mm) and TransRetB=Trans;
             when upper('Tr_RetJual') then select ifnull(max(substring(noRetJ,5,4)),0) into NoInt from TR_RetJual_m where left(NoRetJ,4)=concat(yy,mm) and TransRetJ=Trans;
             when upper('Tr_RetJualR') then select ifnull(max(substring(noRetJ,5,4)),0) into NoInt from TR_RetJualR_m where left(NoRetJ,4)=concat(yy,mm) and TransRetJ=Trans;
             when upper('Tr_RetJualRakitan') then select ifnull(max(substring(noRetJ,5,4)),0) into NoInt from TR_RetJualRakitan_m where left(NoRetJ,4)=concat(yy,mm) and TransRetJ=Trans;
             when upper('Tr_PoJual') then select ifnull(max(substring(nopo,5,4)),0) into NoInt from TR_PoJual_m where left(NoPo,4)=concat(yy,mm);
             when upper('Tr_PoJualRakitan') then select ifnull(max(substring(nopo,5,4)),0) into NoInt from TR_PoJualRakitan_m where left(NoPo,4)=concat(yy,mm);
             when upper('Tr_PIndahGd') then select ifnull(max(substring(noPindahGd,5,4)),0) into NoInt from Tr_PindahGd_M where left(noPindahGd,4)=concat(yy,mm);
             when upper('Tr_BuangGd') then select ifnull(max(substring(noBuangGd,5,4)),0) into NoInt from Tr_BuangGd_M where left(noBuangGd,4)=concat(yy,mm);
             when upper('Close') then select ifnull(max(substring(noClose,5,4)),0) into NoInt from TR_JualR_m where left(NoJualR,4)=concat(yy,mm) and TransRetail=Trans;
       end case;
        if NoInt=0 then
           set NoBaru = concat(yy,mm,'0001');
        else
           set noInt = noInt + 1;
           set noStr = noInt;
           set NoBaru= concat(yy,mm,repeat('0',4-length(NoStr)),NoStr);
        end if;
     end if;
  end if;
 If (TipeNo=3) then
     select if(ifnull(substring(nilaichar,8,3),0)='',0,ifnull(substring(nilaichar,8,3),0)),ifnull(nilaichar,'00') into NoInt,Nomer from tm_setupall where groups='Nomor' and subgroups=Codes;
     set thn=substring(nomer,2,6);
     if thn=concat(yy,mm,dd) then
        set NoInt=NoInt+1;
        set NoStr=NoInt;
        set NoBaru=concat(nUser,yy,mm,dd,REPEAT('0',3-length(NoStr)),NoStr);
     else
        case upper(Nama)
             when upper('Tr_Beli') then select ifnull(max(substring(noBeli,7,3)),0) into NoInt from TR_Beli_m where left(NoBeli,6)=concat(yy,mm,dd) and transBeli=Trans;
             when upper('Tr_Jual') then select ifnull(max(substring(noJual,7,3)),0) into NoInt from TR_Jual_m where left(NoJual,6)=concat(yy,mm,dd) and TransJual=Trans;
             when upper('Tr_JualR') then select ifnull(max(substring(noJualR,8,3)),0) into NoInt from TR_JualR_m where substring(NoJualR,2,6)=concat(yy,mm,dd) and TransRetail=Trans;
             when upper('Tr_JualRakitan') then select ifnull(max(substring(noJual,7,3)),0) into NoInt from TR_JualRakitan_m where left(NoJual,6)=concat(yy,mm,dd) and TransJual=Trans;
             when upper('Tr_BayarBeli') then select ifnull(max(substring(noBayarB,7,3)),0) into NoInt from TR_BayarBeli_m where left(NoBayarB,6)=concat(yy,mm,dd);
             when upper('Tr_BayarJual') then select ifnull(max(substring(noBayarJ,7,3)),0) into NoInt from TR_BayarJual_m where left(NoBayarJ,6)=concat(yy,mm,dd);
             when upper('Tr_BayarJualRakitan') then select ifnull(max(substring(noBayarJ,7,3)),0) into NoInt from TR_BayarJualRakitan_m where left(NoBayarJ,6)=concat(yy,mm,dd);
             when upper('Tr_RetBeli') then select ifnull(max(substring(noRetB,7,3)),0) into NoInt from TR_RetBeli_m where left(NoRetB,6)=concat(yy,mm,dd) and TransRetB=Trans;
             when upper('Tr_RetJual') then select ifnull(max(substring(noRetJ,7,3)),0) into NoInt from TR_RetJual_m where left(NoRetJ,6)=concat(yy,mm,dd) and TransRetJ=Trans;
             when upper('Tr_RetJualR') then select ifnull(max(substring(noRetJ,7,3)),0) into NoInt from TR_RetJualR_m where left(NoRetJ,6)=concat(yy,mm,dd) and TransRetJ=Trans;
             when upper('Tr_RetJualRakitan') then select ifnull(max(substring(noRetJ,7,3)),0) into NoInt from TR_RetJualRakitan_m where left(NoRetJ,6)=concat(yy,mm,dd) and TransRetJ=Trans;
             when upper('Tr_PoJual') then select ifnull(max(substring(nopo,7,3)),0) into NoInt from TR_PoJual_m where left(NoPo,6)=concat(yy,mm,dd);
             when upper('Tr_PoJualRakitan') then select ifnull(max(substring(nopo,7,3)),0) into NoInt from TR_PoJualRakitan_m where left(NoPo,6)=concat(yy,mm,dd);
             when upper('Tr_PIndahGd') then select ifnull(max(substring(noPindahGd,7,3)),0) into NoInt from Tr_PindahGd_M where left(noPindahGd,6)=concat(yy,mm,dd);
             when upper('Tr_BuangGd') then select ifnull(max(substring(noBuangGd,8,3)),0) into NoInt from Tr_BuangGd_M where substring(noBuangGd,2,6)=concat(yy,mm,dd);
             when upper('Close') then select ifnull(max(substring(noClose,7,3)),0) into NoInt from TR_JualR_m where left(NoJualR,6)=concat(yy,mm,dd) and TransRetail=Trans;
      end case;
        if NoInt=0 then
           set NoBaru = concat(nUser,yy,mm,dd,'001');
        else
           set noInt = noInt + 1;
           set noStr = noInt;
           set NoBaru= concat(nUser,yy,mm,dd,repeat('0',3-length(NoStr)),NoStr);
        end if;
     end if;
  end if;
  update tm_setupall set nilaichar=NoBaru where groups='Nomor' and subgroups=codes;
  Return NoBaru;
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP FUNCTION IF EXISTS `GenAnggota_id_tm_anggota` */;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `GenAnggota_id_tm_anggota`() RETURNS char(5) CHARSET latin1
BEGIN
  DECLARE nomor INTEGER DEFAULT 0;
  DECLARE VPK char(5) DEFAULT 0;
  SELECT IFNULL(MAX(right(Anggota_id,5)), 0)+1 INTO nomor FROM tm_anggota;
  SET vpk=INSERT('00000',6-LENGTH(nomor), length(nomor), nomor);
  RETURN concat(vPK);
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP FUNCTION IF EXISTS `GenKodeCust` */;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `GenKodeCust`(NoBk char(10)) RETURNS char(13) CHARSET latin1
BEGIN
  DECLARE nomor INTEGER DEFAULT 0;
  DECLARE VPK char(3) DEFAULT 0;
  SELECT IFNULL(MAX(right(kodecust,3)), 0)+1 INTO nomor FROM tm_customer where left(kodecust,length(nobk))=NoBk;
  SET vpk=INSERT('000',4-LENGTH(nomor), length(nomor), nomor);
  RETURN upper( concat(NoBk,vPK));
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP FUNCTION IF EXISTS `GenNoBuktiJurnal` */;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `GenNoBuktiJurnal`(NoBk char(10)) RETURNS char(13) CHARSET latin1
BEGIN
  DECLARE nomor INTEGER DEFAULT 0;
  DECLARE VPK char(3) DEFAULT 0;
  SELECT IFNULL(MAX(right(no_bukti,3)), 0)+1 INTO nomor FROM tJurnal where left(no_bukti,length(nobk))=NoBk;
  SET vpk=INSERT('000',4-LENGTH(nomor), length(nomor), nomor);
  RETURN concat(NoBk,vPK);
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
DELIMITER ;

--
-- Final view structure for view `tjurnal`
--

/*!50001 DROP TABLE IF EXISTS `tjurnal`*/;
/*!50001 DROP VIEW IF EXISTS `tjurnal`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `tjurnal` AS select `a`.`Jns_jurnal` AS `Jns_jurnal`,`a`.`Tanggal` AS `Tanggal`,`a`.`Tgl_Validasi` AS `Tgl_Validasi`,`a`.`No_bukti` AS `No_bukti`,`b`.`Row_id` AS `Row_id`,`a`.`Keterangan` AS `Keterangan`,`a`.`Pst` AS `Pst`,`a`.`Tgl_Edit` AS `Tgl_Edit`,`a`.`User` AS `User`,`a`.`Sandi_trans_id` AS `Sandi_trans_id`,`a`.`Norek_Simp` AS `Norek_Simp`,`a`.`Norek_Pinj` AS `Norek_Pinj`,`a`.`Norek_Dep` AS `Norek_Dep`,`a`.`Status_Val` AS `Status_Val`,`a`.`Status_AB` AS `Status_AB`,`a`.`Nobukti_Rtl` AS `Nobukti_Rtl`,`b`.`Kode_perk` AS `Kode_perk`,`b`.`Debet` AS `Debet`,`b`.`Kredit` AS `Kredit` from (`tjurnal_m` `a` join `tjurnal_d` `b`) where ((`a`.`Jns_jurnal` = `b`.`Jns_jurnal`) and (`a`.`No_bukti` = `b`.`No_bukti`) and (`a`.`Tgl_Validasi` = `b`.`Tanggal`)) */;


