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,
  `updater` int(3) 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 ('000001QIO','KOS QORY','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('0001MBLW','MOBIL W','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('AB00001','TOKO APU BUBUK','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('ABBA9939','PT. ANUGERAH BERLIMPAH BERKAT ABADI','','JL PEMUDA NO 46','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('AD00000VKT','SUKRISNO ADVOKAT','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('AM0000FD','ANEKA MOTOR','','JL. GAJAH MADA - MOJOKERTO','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('AM0003D','AM ACCU ','','JL. S. PARMAN MODOPURO','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('ARS000VS','C. ARIS SB','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('AT000001','AK TRUSS CV. Nugraha Cipta Raharja','','Ds. Mojotengah Kec. Sukorejo','PASURUAN','0343639411','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('BDP000MJK','BADAN PENDAPATAN DAERAH MOJOKERTO','','AHMAD YANI NO. 16 MOJOKERTO','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('BERKAT00D2','UD. BERKAT BERSAMA','','DSN. KASIYAN DS. POHKECIK KEC DLANGGU NO.99','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('BEY003','P. BEY','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('BM0000SF','BESI MAKMUR','','WONOREJO - SUMBERWONO - BANGSAL - MOJOKERTO','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('BMC00001','CV. BUILDING MATERIAL CONSTRUCTION','','JL. RAYA SUKOMANUNGGAL ','SURABAYA','0317319880','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('BS0000FG','B. SOFY SB','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('CGI00001','PT. CIPTA GRAHA INDAH','','Jl. S. Parman kav. 64 Kel. Silpi Palmerah ','JAWA BARAT','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('CIM0090S','C. CIMIN','','SB','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('CKMT0000F','PT. CKMT','','SURABAYA','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('CS000DF','C. YASIN SB','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('DELTA00S','DELTA','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('DJPR001','DJAWA PROFIL','','MOJOKERTO','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('GAL0023','ISI ULANG GALON','','','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('GM0000DFG','GUNUNG MAS','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('GRC00CKJ','GRC BOARD','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('GS00001','GLUGU SULAWESI','','UNGGAHAN - BANJARAGUNG - PURI','085707305332','081554281925','085645543163','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('JATI009','TOKO JATI TEMENAN','','JL. PAHLAWAN ','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('KDR0TRIP','KEDIRI TRIPLEK','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('KK00001','CV. KARYA KUSUMADILGA','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('KU00DGFDG','UNYIL (KOMBONG)','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('LINKCOM09','LINK COMPUTER','','SOOKO','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('LP0033333','BELI LINGGIS','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('MJD000DG','P. MAJID KOMBONG','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('MUL0999E','P. MUL ','','KALICANGKRING','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('NO0000ME','NO NAME','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('NON00D','P. NONO','','SB','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('PB990001','PURNAMA BERJAYA 99','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('PDS000SD','PT. PRAWIRA DAYA SAKTI','','JL. RAYA TROWULAN, DS. JATIPASAR, TROWULAN','MOJOKERTO','0321491999','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('PELA0002','PELANGI HADIAH','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('PR000FS','P. RUDI SB','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('PUNGLI00D3','PORTAL','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('RO0000DFI','ROFI JAYA CERAMIC','','JL. PEMUDA NO. 69 MOJOSARI','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0000001','TIDAK ADA NAMA','','','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,11),('S0000002','FALCON','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000003','NAGA SEJAHTERA','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000004','GANTI RGI KECELAKAAN','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000005','MP','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000006','ECOMORTAR','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000007','BLACKBULL','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000008','IMOKITO','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000010','EMCO','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000011','CV. CAKRA BESI INDOPRIMA','','','MOJOKERTO','0321-323067','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000012','GALERI PROFIL','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000013','ANEKA JAYA','','RUKO JL. RAYA NGAGEL 23 SURABAYA','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000014','BERUANG PERKASA','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000015','CV. BALAKOSA INTERIOR','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000016','CV. TRIXSIE MAKMUR','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000017','ETHER','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000018','FAJAR JAYA ELEKTRIK','','DSN. TAMBAKREJO RT. 05 RW. 03, GAYAMAN, MOJOANYAR','MOJOKERTO','0856-3432-460','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000019','HADI JAYA (CORAL)','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S000001UY','P. UDIN','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0000020','L. A JAYA STEEL','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000021','PT. ANUGERAH BERSAMA PERDANA','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000022','PT. GLOBAL SUKSES ANUGERAH','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000023','PT. KENCANA MAJU BERSAMA','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000024','PT. RUMAH AIR MAKMUR ABADI','','PERG. LEGUNDI BUSINESPARK BLOK E.8 ','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000025','PT. FOCON INTERLITE','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000026','SARITANI KAYU INDONESA (TRIPLEK)','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000027','MARINE','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000028','PT. PENGUIN TRADING','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000029','PT. PROFILIA INDOTECH','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000030','UD. ADIVA ','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000031','UD. MOJOSONGO','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000032','UD. CAKRA OXYGEN','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000033','UD. SUMBER REJEKI','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000034','PT. B2M (Besi Baja Metal)','','PURI','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S0000035','PT. BERHASIL INDONESIA GEMILANG','','JL. Ir. Soekarno (MERR) No. 531 ','SURABAYA','031-87857791','031-87857276','pt.biglog@gmail.com','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S000003612','PT. MOJO RETAIL MERAH PUTIH','','JL. RAYA AIR PANAS NO. 25, PUNGGING','MOJOKERTO','085336212064','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,9),('S000004561','UD. KURNIA JAYA','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0000062RD','CV. SUKSES INTI PERKASA','','SIMOLAWANG BARU NO. 20, RT.009 RW.010. SIMOKERTO','SURABAYA','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S000008972','LOSTER KAYU','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,3),('S00000BCA','BCA','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001ADIT','ADDITON','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001AGJ1','AGUNG JAYA FASTENER','','MOJOKERTO','','','','','','',NULL,NULL,NULL,'','Y',33000,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001ALFN','OBAT PAK ALFAN','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001CM1','C. MUNIR ( BATA MERAH & PASIR)','','','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001CMJD','C. MAJID','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001CS1','CV. ROSAN PRIMA','','DSN. TUMAPEL, DS. JATIREJO, KEC. JATIREJO','MOJOKERTO','0321-5151031','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001CTD','CAK TAWA DYNAMO ','','JL. RAYA SEKAR PUTIH DS. KEDUNDUNG, MAGERSARI','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001DJ','BERKAH LANCAR BESI ','','JL. RAYA GAYAMAN, MOJOANYAR','MOJOKERTO','082226688862','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001DPL','RJ LONDON','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001FY','PT. PROPAN RAYA INDUSTRIAL COATING CHEMICAL','','JL. SATRIA RAYA NO. 1D RT.007/004 JELAMBAR GROGOL,','JAKARTA','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001GRSM','SEMEN GRESIK REJO MAKMUR','','JATENG','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001JKRR','KURIR','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001MRE','MURAH REJEKI ELEKTRONIK','','JL. NAWAWI 20 MOJOKERTO','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001MT1','UD. MITRA PERKASA ','','JL. A. YANI NO. 48 AWANG-AWANG','MOJOKERTO','081235050350','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001NGR','NGORO KEMBANG RINGGIT','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001ON1','ONDA','','','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001PC1','PORTLAND POZZOLAN CEMENT (PCC)','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001PEDE','P. EDI','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001PLN','PLN','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001PNG1','PANGESTON','','','MOJOKERTO','0321323837','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001PPN','PENGAMEN','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001PS1','PASM','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001PYDI','TRIPLEK P. YUDI','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001RKRP','KERUPUK','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001RNG','ANDIK MEGA JAYA','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001RT1','RATNA JAYA','','','MOJOKERTO','0321322350','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001SC1','UD. SUMBER LANCAR','','JL. RAYA TALANGSUKO 171,TUREN','MALANG','082214922738','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001SHA1','\"SHA-SHA\" Letter','','JL. RAYA BANGSAL','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001SNR1','SINAR BARU','','JL. MASJID, MOJOSARI','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001SOFI','BENGKEL','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001STI1','PT. SATRIAKARYA ADIYUDHA','','KOM. PERGUDANGAN 80 BLOK C.17-18 RT/RW 20/00SEDATI','SIDOARJO','081556786970','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001SYIR','P. IRSYAD ','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001TAP','P. ARFI','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001TBW','TAMBAL BAN \"W\"','','JL. KEPUHANYAR, MOJOANYAR','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001TKMR','TOKO KERJA MOTOR','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001TRJ1','TARIYO JAYA 1','','JL. RAYA TRAWAS DSN. SRUNI, DSBANJARTANGGUL, PUNGG','MOJOKERTO','0858-5971-9941','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001TU1','PT. TUNGGAL DJAJA INDAH','','','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001UA','UD. AHMAD','','JL. MAYJEND H. SOEMADI DSN. KUTOREJO','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001UDE','UD. EKA JAYA','','JL. RAYA SIDOMULYA, BANGSAL','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001UJM','TOKO USAHA JAYA MOTOR','','','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001WLN','UD. WULANDARI','','DSN. JURANGSARI DS. BELAHAN TENGAH KEC. MOJOSARI ','MOJOKERTO','08121610988','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001WR1','TOKO MBAK WARNI','','JANTI, MOJOANYAR','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00001WS1','WALISONGO','','JL. RAYA TEMU, WONOPLINTAHAN, PRAMBON','SIDOARJO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S000032','TB. SATU JAYA','','JL. RAYA CEMENG KALANG','SIDOARJO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S000035','SEMEN GRESIK (P. MAHESA)','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0000367','SEMI JAYA','','','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,3),('S00006888','P. CETOK','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,3),('S00007932','MINI LANCAR','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,3),('S0000864','DOKAR NIPPON','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,3),('S0000897','PT. CITICON NUSANTARA INDUSTRIES','','TEMPURAN PUNGGING','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,3),('S0000984','P. AHMADI [PINTU TRIPLEK]','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,3),('S00009871','P. EGO (PASIR CUCI)','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,3),('S0000989','CV. SINAR AGRO WISATA','','PENANGGUNGAN-TRAWAS','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,3),('S0000PERT1','SPBU','','','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0000PIYTM','P. MINTO','','GALANGAN','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00011','MITRA KARYA DECORATION','','JL. YOS SUDARSO DUKUHSARI - JANTI - MOJOAGUNG','JOMBANG','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001AES1','AJENG ELECTRONIC SERVICE','','RT. 04 RW. 02 Dsn. Ds. Wunut, Mojoanyar','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001ARF1','ARFI JAYA','','','MOJOKERTO','081331501911','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001BJU','BAJU','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001BLC','BLESSCON','','','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001C0D','C. OD','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001CJNO','C. JONO','','GALANGAN','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001DPR','DAPUR','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001EKO','P. EKO GALANGAN ','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001FGFG','KEMATIAN','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001FTG','FEE TUKANG','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001GFH','DIAN KALIGORO','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001GIJK','TOKO SWALAYAN BANGUNAN','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001GJIAN','GAJIAN KARYAWAN ','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001GT32','ADIN JAYA','','JLN. RAYA PACING DLANGGU','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001HJLL','VINYX DOOR','','DS. TAYUKULON RT03/3,TAYU','PATI','089669782624','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001HSLM','UD. HASIL MAKMUR','','JL. RAYA MOJOSARI PACET KM. 3','MOJOKERTO','0321-595-381','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001HUD','P. HUDI GRESIK','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001IKA','IKA ABADI','','JLN JASEM DINOYO Km.15 JATIREJO','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001IND1','INDACO','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001JOMLG','P. JONY ','','MALANG','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001JRD1','JAYA RAYA DIESEL','','JL. PB. SUDIRMAN 46','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001KUL','KULI','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001LCJY','LANCAR JAYA','','MOJOSARI','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001LS1','LISTRIK ','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001MKNN','MAKANAN ','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001PMSB','P. MINTO (TOKO)','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001PSR','C. OD (PASIR CUCI & KORAL)','','NGORO','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001RNDM','RANDOM','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001RRA','RARA','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001RS1','ROSI','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001RTN1','RATNA ELECTRONIC','','JL. RAYA SADAR TENGAH NO. 21, MOJOANYAR','MOJOKERTO','085784769857','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001SAM1','P. SAMSUL ','','','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001SGMK','SEMEN GRESIK PUTRA ABADI SUKSES MANDIRI','','JOMBANG','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001SLHE','P. SHOLEH JANTI','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001SMP2','SMPN II MOJOANYAR (DAMARSIH)','','','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001SWBRG','SEWA BARANG','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001TERT','RETURN BARANG','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001TIU','TOKO PLASTIK','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001TKBL','TOKO BUDI LUHUR ','','JL. RAYA SADAR TENGAH, MOJOANYAR','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001TRIJ','UD. TRI JAYA','','JLN. RAYA GEDANGABNO. 09, MENGANTO, MOJOWARNO','JOMBANG','082142499989','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001TUNG','TUNGGAL','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001UDPL','UD. PIJAR LESTARI','','GENERAL SUPLIER JATIM','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0001USCRF','FEE CUSTOMER','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S000C.TOGA','C. TOGAS ','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S000N1UMG','UD. MEGA JAYA','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S001AST','SARUNG TANGAN P. IRSYAK','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S001BKTW','BUKIT WARNA INDAH','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S001BPRTI','B. PARTI ','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S001CICIL6','CICILAN TRAGA','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S001CTSM','TOKO CAT SEMI JAYA','','JL. PAHLAWAN 15B MOJOKERTO','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S001DTOY','BINTANG 87','','Dsn. WONOKOYO Ds. Sumber Tanggul, Mojosari','MOJOKERTO','0813-3331-3241','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S001JYGM','JAYA GIFSUM','','DS. RANDUBANGU, GG. TENGAH RT/RW 08/03','MOJOKERTO','0821-3123-4125','0821-4208-4452','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S001KRMD','KORAL NGORO (MAS UD)','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S001LETE','LUKMAN ELEKTRONIK','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S001PTRA','PATRA','','JL. BHAYANGKARA 48 (SPBU)','MOJOKERTO','0321-392121','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S001RGNK','RENG NIKO ','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S001SEMB','PT. SEMBADA INDORAYA SENTOSA','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S001SLSP','SALES PANASONIC','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S001SRY2','SURYA 2 STATIONARY ','','JL. TAMAN SISWA NO.11','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S001TRQ','TRILIUN WARE','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S001UDJT','UD. JATI UTAMA','','JL. TANGUNAN BADUNG, PURI - MOJOKERTO','085812437745','082132332873','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S001VTS1','VICTORIA TRUSS','','JL. RAYA PACE WARUJAYENG','NGANJUK','082132141025','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00BRJO','UD. BERKAH REJO','','DS. NGROWO KP PENDOWO, KEC. BANGSAL,','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00GFRJY','FIRA JAYA','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S00PBDU','P. BUDI GALANGAN','','','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S01ASRNS','ASURANSI ','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S01FKUIIL','FEE KULI','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S01GFGFH','KURNIA JAYA MOTOR','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S01SJUD','UD. SINAR JAYA DIESEL ','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S01TYR6','P. RENDY (KOMBONG)','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('S0HDE0001','UD. ROFI JAYA','','JL. PEMUDA NO. 69, MOJOSARI','MOJOKERTO','082116160571','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('SAG00001','SEMESTA ABADI GALVALUM','','JL. RAYA BANGSAL KM. 10','','081215599117','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('SDC01OHD','P. HUDA WUNUT','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('SER090CV','UD. SERASI.','','KALIGORO RT 4 RW 2 KEC. KUTOREJO','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('SISA0000D','SISA UANG BRANKAS','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('SJ000000DA','STEGER JAYA MANDIRI 21','','PERUM GRIYA SAMUDRA ASRI B6/12 TAMAN ','SIDOARJO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('SM3888','SINGA MERAH','','','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('SMP00001','Toko Sempurna Bangunan','','Jl. Mojopahit Mojokerto','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('SOLU99S','PT. SOLUSI TANDON AIR','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('SOPIA007D','TOKO SOFIA','','DSN. JANTI RT.04 RW.02 DS. WUNUT, MOJOANYAR','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('SPI000TR','PT. SATRIANI PERKAYUAN INDONESIA','','JL. S. PARMAN 10 MODOPURO MOJOSARI','MOJOKERTO','03216850054','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('SSM00001','PT. SEMEN IMASCO ASIATIC','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('SUM000SD','UD. SUMBER PANGAN','','JL. BRAWIJAYA','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('TJA88321','UD. TRI JAYA AGUNG II','','DSN. DAMARSI DS. KEPUH ANYAR KEC. MOJOANYAR','MOJOKERTO','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('TK00001','TRANS KELAPA','','JL. Raya Pasinan Wringinanom - Gresik','GRESIK','085 648 362 362','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('TOK00F','TOKO SENTOSA','','JL. MOJOPAHIT 219','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('TU000001','TOKO UTAMA','','JL. MOJOPAHIT 93 ','MOJOKERTO','0321-322013','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('TUK000DF','TUKAR UANG','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('WAR008S','MBAK WARNI','','JANTI','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('WGI','WASKITA GRAHA INDONESIA','','Jl. Ngagel Rejo Kidul No.52, Kec. Wonokromo','SURABAYA','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('WI00000FI','WI-FI','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('WIM0001','WADJA INTI MULIA (WINGKING DOOR)','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7),('WK000001','PT. WIJAYA KARYA, Tbk','','','','','','','','',NULL,NULL,NULL,'','Y',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,7);

DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `BeforeUpdateHutang` BEFORE UPDATE ON `tm_supplier` FOR EACH ROW BEGIN
    IF IFNull(old.Updater,0) <> Ifnull(new.Updater,0) THEN
    SET new.Hutang = (SELECT SUM(IFNULL(Nilai,0)) FROM tr_beli_m WHERE KodeSupp= new.KodeSupp) -  
    (SELECT SUM(IFNULL(a.Nilai,0)) FROM tr_scrbayarbeli a LEFT JOIN tr_bayarbeli_m b ON b.NoBayarB=a.NoBayarB WHERE b.KodeSupp = new.KodeSupp);
END IF;
END */;;

DELIMITER ;

--
-- 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`
--



--
-- 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`
--

INSERT INTO `tr_bayarbeli_d` VALUES ('25000001',1,'CASH','','','','',NULL,33000,'',1,NULL);

--
-- 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`
--

INSERT INTO `tr_bayarbeli_m` VALUES ('25000001','2025-02-04 00:00:00','S00001AGJ1','',NULL,NULL,NULL);

--
-- 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`),
  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','25000001',1,NULL,NULL,'B00000001BG1','GD','805K ENVI CAT TEMBOK CRYSTAL BLUE',33000,0,1,NULL,'Pcs',1,NULL,33000,NULL),('BT','25000002',1,NULL,NULL,'18000505','GD','807K ENVI CAT TEMBOK NAVY BLUE',33000,0,1,NULL,'Pcs',1,NULL,33000,NULL),('BT','25000003',1,NULL,NULL,'18000505','GD','807K ENVI CAT TEMBOK NAVY BLUE',33000,0,1,NULL,'Pcs',1,1,33000,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 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=Hargabaru 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_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="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" */;;
/*!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=old.harga 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,
  `BayarTunai` double 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','25000001','2025-01-16 00:00:00',NULL,'S00001AGJ1','AGUNG JAYA FASTENER','','12312','2025-01-16 00:00:00',0,0,NULL,0,33000,33000,NULL,NULL,NULL,'',1,0,NULL,NULL,NULL,NULL),('BT','25000002','2025-01-21 00:00:00',NULL,'S00001AGJ1','AGUNG JAYA FASTENER','','1234','2025-01-21 00:00:00',0,0,NULL,0,33000,0,NULL,NULL,NULL,'',1,0,NULL,NULL,NULL,NULL),('BT','25000003','2025-01-21 00:00:00',NULL,'AT000001','AK TRUSS CV. Nugraha Cipta Raharja','','4654','2025-01-21 00:00:00',0,0,NULL,0,33000,0,NULL,NULL,NULL,'',1,0,NULL,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="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `BeforeUpd_tr_Beli_m` BEFORE UPDATE ON `tr_beli_m` FOR EACH ROW BEGIN
DECLARE sBayar,sRetur DECIMAL(15,2);
SELECT IFNULL(SUM(nilai),0) INTO sBayar FROM tr_scrbayarBeli WHERE NoBeli=new.NoBeli;
SELECT IFNULL(SUM(Nilai),0) INTO sRetur FROM tr_retbeli_m WHERE NoBeli=new.NoBeli;
SET new.Sisa = new.Nilai - (sBayar + sRetur); 
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','1250115001',1,'12501150002',1,'E00000048','GD','805G ENVI CAT TEMBOK CRYSTAL BLUE',20000,0,0,1,NULL,'Pcs',1,126900,NULL,NULL,NULL,NULL,NULL,NULL),('JT','1250116001',1,NULL,NULL,'E00000048','GD','805G ENVI CAT TEMBOK CRYSTAL BLUE',140000,0,0,1,NULL,'Pcs',1,126900,NULL,NULL,NULL,NULL,NULL,NULL);

DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" */;;
/*!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;

if new.NoPO <> '' then

Update tr_pojual_d set SdhTerima =  ifnull(SdhTerima,0)-(ifnull(new.jml,0)*ifnull(new.konv,1))

  where NoPo=new.NoPo and kodebrg=new.kodebrg;

end if;

end */;;

/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" */;;
/*!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;

end if;



if new.NoPO <> '' then

Update tr_pojual_d set SdhTerima =  ifnull(SdhTerima,0)+(ifnull(old.jml,0)*ifnull(old.konv,1))

  where NoPo=old.NoPo and kodebrg=old.kodebrg;

Update tr_pojual_d set SdhTerima =  ifnull(SdhTerima,0)-(ifnull(new.jml,0)*ifnull(new.konv,1))

  where NoPo=new.NoPo and kodebrg=new.kodebrg;

end if; 



end */;;

/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" */;;
/*!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;

if old.NoPO <> '' then

Update tr_pojual_d set SdhTerima =  ifnull(SdhTerima,0)+(ifnull(old.jml,0)*ifnull(old.konv,1))

  where NoPo=old.NoPo and kodebrg=old.kodebrg;

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,
  `Kasir` varchar(15) default NULL,
  `TglEntry` datetime default NULL,
  `NoKomputer` varchar(1) default NULL,
  `Updater` varchar(1) 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','1250115001','2025-01-15 00:00:00','BYN000ABH','','','',NULL,0,0,0,20000,'',20000,'','2025-01-15 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,'link','2025-01-15 13:06:50','1',NULL),('JT','1250116001','2025-01-16 00:00:00','C0000111','ABAH ALIYO','NGOR RT.10','',NULL,40000,0,0,100000,'',100000,'','2025-01-16 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,'link','2025-01-16 15:21:26','1',NULL);

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

/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `BeforeUpd` BEFORE UPDATE ON `tr_jual_m` FOR EACH ROW BEGIN
DECLARE sBayar,sRetur DECIMAL(15,2);
SELECT IFNULL(SUM(nilai),0) INTO sBayar FROM tr_scrbayarJual WHERE NoJual=new.NoJual;
SELECT IFNULL(SUM(Nilai),0) INTO sRetur FROM tr_retjual_m WHERE NoJual=new.NoJual;
SET new.Sisa = new.Nilai - (sBayar + sRetur); 
END */;;

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

/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `TrJualDelete` AFTER DELETE ON `tr_jual_m` FOR EACH ROW BEGIN
  Update tm_Customer set Point =  ifnull(Point,0) - (old.pointG), PointNon = (ifnull(PointNon,0) - (old.PointGNon)), 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_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','12501160001',1,'B00BC000001','GD','803G ENVI CAT TEMBOK LIGHT VIOLET',140000,0,0,1,'Pcs',1,0,126900,NULL,NULL,140000,NULL,NULL,NULL,NULL);

DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" */;;
/*!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="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" */;;
/*!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(20) 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` decimal(10,0) default NULL,
  `BayarTunai` decimal(10,0) default NULL,
  `BayarCard` decimal(10,0) default NULL,
  `TipeCard` varchar(20) default NULL,
  `NoCard` varchar(20) default NULL,
  `BankCard` varchar(20) default NULL,
  `NamaCard` varchar(30) default NULL,
  `Nilai` decimal(10,0) 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(1) 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','12501160001','2025-01-16 00:00:00',NULL,'','CASH','','',40000,0,0,0,'','0','100000','0','','','','','140000','','link','','2025-01-16 13:01:33',NULL,NULL,NULL,'','0','0',NULL,'1');

DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `AddTrJualM` 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,
  `PerkDebet` char(6) default NULL,
  `PerkKredit` char(6) 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`
--

INSERT INTO `tr_pojual_d` VALUES ('12501150001',1,'B00BC000001','',140000,0,1,'Pcs',1,0,'1899-12-30 00:00:00'),('12501150002',1,'E00000048','',20000,0,1,'Pcs',1,1,'1899-12-30 00:00:00'),('12501160001',1,'B00000001BG1','',100000,0,1,'Pcs',1,0,'1899-12-30 00:00:00'),('12501160002',1,'E00000011','',100000,0,1,'Pcs',1,0,'1899-12-30 00:00:00');

--
-- 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`
--

INSERT INTO `tr_pojual_m` VALUES ('12501150001','2025-01-15 00:00:00','1899-12-30 00:00:00','001ABAGS','',0,0,'',0,0,0,'','',1),('12501150002','2025-01-15 00:00:00','1899-12-30 00:00:00','BYN000ABH','',0,0,'',0,0,0,'','',1),('12501160001','2025-01-16 00:00:00','1899-12-30 00:00:00','C001PNAM','',0,0,'',0,0,0,'','',1),('12501160002','2025-01-16 00:00:00','1899-12-30 00:00:00','C001ABGS','',0,0,'',0,0,0,'','',1);

--
-- 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`),
  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`
--

INSERT INTO `tr_retbeli_d` VALUES ('RB','25000001',1,'BT','25000003',1,'18000505','GD',33000,0,1,'Pcs',1,NULL,NULL,NULL,NULL);

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`
--

INSERT INTO `tr_retbeli_m` VALUES ('RB','25000001','2025-02-04 00:00:00',NULL,'AT000001','','BT','25000003',0,0,'',0,0,33000,0,'',1);

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`
--


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`
--


--
-- 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,
  `HargaBeliLm` double 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,
  `HargaBeliLm` double 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`
--

INSERT INTO `tr_scrbayarbeli` VALUES ('25000001',1,'BT','25000002',33000,'',1);

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="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" */;;
/*!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;
DECLARE sDivisi VARCHAR(50);
DECLARE sSisa DECIMAL(15,2);
DECLARE sTglLunas Datetime;
SELECT Sisa INTO sSisa FROM tr_jual_m WHERE NoJual=new.NoJual;
select TglBayarJ,Tglbatal,KodeCust into sTglLunas,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="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" */;;
/*!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;
DECLARE sDivisi VARCHAR(50);
DECLARE sSisa DECIMAL(15,2);
SELECT Sisa INTO sSisa FROM tr_jual_m WHERE NoJual=new.NoJual;
select Tglbatal,KodeCust into vTglbatal,vKodeCust from tr_BayarJual_M where NoBayarJ=new.NoBayarJ;
  Update tr_jual_m set sisa =  ifnull(sisa,0) + old.nilai * old.exrate 
  where TransJual = old.TransJual and NoJual = old.NoJual;
  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) + old.nilai * old.exrate  where KodeCust = vKodeCust;
     Update tm_customer set Piutang =  ifnull(Piutang,0) - new.nilai * new.exrate  where KodeCust = vKodeCust;
end */;;

/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" */;;
/*!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;
DECLARE sDivisi VARCHAR(50);
DECLARE sSisa DECIMAL(15,2);
DECLARE sTglLunas Datetime;
SELECT Sisa INTO sSisa FROM tr_jual_m WHERE NoJual=old.NoJual;
select TglBayarJ,Tglbatal,KodeCust INTO sTglLunas, vTglbatal,vKodeCust from tr_BayarJual_M where NoBayarJ=Old.NoBayarJ;
IF (sSisa + old.Nilai) > 0 then
 Update tr_jual_m set sisa =  ifnull(sisa,0) + old.nilai * old.exrate
  where TransJual = old.TransJual and NoJual = old.NoJual;
ELSE
 Update tr_jual_m set sisa =  ifnull(sisa,0) + old.nilai * old.exrate 
  where TransJual = old.TransJual and NoJual = old.NoJual;
END IF;
     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','j¥;dt‘6þzTâAî’Š','01','Y','*','2'),('asp','asp','','02','Y','*','1'),('link','link','kîâ ÿa¯_(B‡¢×','01','Y','*','3');

--
-- 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','1','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','1','Admin'),('01','030100','1','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','1','Admin'),('01','040401','1','Admin'),('01','040402','1','Admin'),('01','040500','1','Admin'),('01','040501','1','Admin'),('01','040502','1','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','1','Admin'),('01','050301','1','Admin'),('01','050302','1','Admin'),('01','050400','1','Admin'),('01','050401','1','Admin'),('01','050402','1','Admin'),('01','050500','1','Admin'),('01','050501','1','Admin'),('01','050502','1','Admin'),('01','050600','1','Admin'),('01','050601','1','Admin'),('01','050602','1','Admin'),('01','050700','1','Admin'),('01','050701','1','Admin'),('01','050702','1','Admin'),('01','050800','1','Admin'),('01','050801','1','Admin'),('01','050802','1','Admin'),('01','050803','1','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','1','Admin'),('01','060101','1','Admin'),('01','060102','1','Admin'),('01','060103','1','Admin'),('01','060104','1','Admin'),('01','060105','1','Admin'),('01','060106','1','Admin'),('01','060107','1','Admin'),('01','060108','1','Admin'),('01','060109','1','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','060504','1','Admin'),('01','060600','1','Admin'),('01','060601','1','Admin'),('01','060602','1','Admin'),('01','060603','1','Admin'),('01','060604','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','1','Admin'),('01','060900','1','Admin'),('01','060901','1','Admin'),('01','060902','1','Admin'),('01','060903','1','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','1','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','1','Pindah Jual'),('02','010500','1','Pindah Jual'),('02','010600','1','Pindah Jual'),('02','010700','1','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','1','Pindah Jual'),('02','030000','0','Pindah Jual'),('02','030100','0','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','1','Pindah Jual'),('02','040401','1','Pindah Jual'),('02','040402','1','Pindah Jual'),('02','040500','1','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','050301','0','Pindah Jual'),('02','050302','0','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','0','Pindah Jual'),('02','050702','0','Pindah Jual'),('02','050800','0','Pindah Jual'),('02','050801','0','Pindah Jual'),('02','050802','0','Pindah Jual'),('02','050803','0','Pindah Jual'),('02','050900','0','Pindah Jual'),('02','050901','0','Pindah Jual'),('02','050902','0','Pindah Jual'),('02','051000','1','Pindah Jual'),('02','051001','1','Pindah Jual'),('02','051002','1','Pindah Jual'),('02','060000','1','Pindah Jual'),('02','060100','0','Pindah Jual'),('02','060101','0','Pindah Jual'),('02','060102','0','Pindah Jual'),('02','060103','0','Pindah Jual'),('02','060104','0','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','1','Pindah Jual'),('02','060801','1','Pindah Jual'),('02','060802','1','Pindah Jual'),('02','060900','1','Pindah Jual'),('02','060901','1','Pindah Jual'),('02','060902','1','Pindah Jual'),('02','060903','1','Pindah Jual'),('02','060904','1','Pindah Jual'),('02','061000','1','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','1','Pindah Jual'),('02','061102','1','Pindah Jual'),('02','061104','1','Pindah Jual'),('02','070000','0','Pindah Jual'),('02','070100','0','Pindah Jual'),('02','070200','0','Pindah Jual'),('02','070400','0','Pindah Jual'),('02','070500','0','Pindah Jual'),('02','070600','0','Pindah Jual'),('02','080000','1','Pindah Jual'),('02','080100','1','Pindah Jual'),('02','080200','1','Pindah Jual'),('02','080300','1','Pindah Jual'),('02','090000','1','Pindah Jual'),('02','090100','1','Pindah Jual'),('02','090101','1','Pindah Jual'),('02','090102','1','Pindah Jual'),('02','090203','0','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','010300','1','Pindah Jual Exclusiv'),('03','020000','1','Pindah Jual Exclusiv'),('03','020100','1','Pindah Jual Exclusiv'),('03','020200','1','Pindah Jual Exclusiv'),('03','020300','1','Pindah Jual Exclusiv'),('03','020700','1','Pindah Jual Exclusiv'),('03','030000','1','Pindah Jual Exclusiv'),('03','030100','1','Pindah Jual Exclusiv'),('03','040000','1','Pindah Jual Exclusiv'),('03','040100','1','Pindah Jual Exclusiv'),('03','040101','1','Pindah Jual Exclusiv'),('03','040102','1','Pindah Jual Exclusiv'),('03','040200','1','Pindah Jual Exclusiv'),('03','040201','1','Pindah Jual Exclusiv'),('03','040202','1','Pindah Jual Exclusiv'),('03','040300','1','Pindah Jual Exclusiv'),('03','040301','1','Pindah Jual Exclusiv'),('03','040302','1','Pindah Jual Exclusiv'),('03','050000','1','Pindah Jual Exclusiv'),('03','050200','0','Pindah Jual Exclusiv'),('03','050201','0','Pindah Jual Exclusiv'),('03','050202','0','Pindah Jual Exclusiv'),('03','050400','1','Pindah Jual Exclusiv'),('03','050401','1','Pindah Jual Exclusiv'),('03','050402','1','Pindah Jual Exclusiv'),('03','050500','1','Pindah Jual Exclusiv'),('03','050501','1','Pindah Jual Exclusiv'),('03','050502','1','Pindah Jual Exclusiv'),('03','050600','1','Pindah Jual Exclusiv'),('03','050601','1','Pindah Jual Exclusiv'),('03','050602','1','Pindah Jual Exclusiv'),('03','060000','1','Pindah Jual Exclusiv'),('03','060100','1','Pindah Jual Exclusiv'),('03','060101','1','Pindah Jual Exclusiv'),('03','060102','1','Pindah Jual Exclusiv'),('03','060103','1','Pindah Jual Exclusiv'),('03','060104','1','Pindah Jual Exclusiv'),('03','060105','1','Pindah Jual Exclusiv'),('03','060106','1','Pindah Jual Exclusiv'),('03','060107','1','Pindah Jual Exclusiv'),('03','060108','1','Pindah Jual Exclusiv'),('03','060200','1','Pindah Jual Exclusiv'),('03','060300','1','Pindah Jual Exclusiv'),('03','060400','1','Pindah Jual Exclusiv'),('03','060401','1','Pindah Jual Exclusiv'),('03','060402','1','Pindah Jual Exclusiv'),('03','060403','1','Pindah Jual Exclusiv'),('03','060501','1','Pindah Jual Exclusiv'),('03','060502','1','Pindah Jual Exclusiv'),('03','060503','1','Pindah Jual Exclusiv'),('03','060600','1','Pindah Jual Exclusiv'),('03','060601','1','Pindah Jual Exclusiv'),('03','060602','0','Pindah Jual Exclusiv'),('03','060603','1','Pindah Jual Exclusiv'),('03','060604','1','Pindah Jual Exclusiv'),('03','060700','1','Pindah Jual Exclusiv'),('03','060701','1','Pindah Jual Exclusiv'),('03','060702','1','Pindah Jual Exclusiv'),('03','060703','1','Pindah Jual Exclusiv'),('03','060900','1','Pindah Jual Exclusiv'),('03','060901','1','Pindah Jual Exclusiv'),('03','060902','1','Pindah Jual Exclusiv'),('03','060903','1','Pindah Jual Exclusiv'),('03','060904','1','Pindah Jual Exclusiv'),('03','080000','1','Pindah Jual Exclusiv'),('03','080200','1','Pindah Jual Exclusiv'),('03','090000','0','Pindah Jual Exclusiv'),('03','090100','0','Pindah Jual Exclusiv'),('03','090101','0','Pindah Jual Exclusiv'),('03','090102','0','Pindah Jual Exclusiv'),('03','090300','0','Pindah Jual Exclusiv'),('03','090301','0','Pindah Jual Exclusiv'),('03','090302','0','Pindah Jual Exclusiv'),('03','100000','1','Pindah Jual Exclusiv'),('03','110000','1','Pindah Jual Exclusiv'),('04','010000','1',''),('04','010100','0',''),('04','010200','0',''),('04','010300','1',''),('04','010400','0',''),('04','010500','0',''),('04','010600','0',''),('04','010700','0',''),('04','010900','0',''),('04','020000','1',''),('04','020100','0',''),('04','020200','1',''),('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','1',''),('04','040100','1',''),('04','040101','1',''),('04','040102','1',''),('04','040200','0',''),('04','040201','0',''),('04','040202','0',''),('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','1',''),('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','0',''),('04','060108','0',''),('04','060200','0',''),('04','060300','0',''),('04','060400','0',''),('04','060401','0',''),('04','060402','0',''),('04','060403','0',''),('04','060500','0',''),('04','060501','0',''),('04','060502','0',''),('04','060503','0',''),('04','060600','0',''),('04','060601','0',''),('04','060602','0',''),('04','060603','0',''),('04','060700','0',''),('04','060701','0',''),('04','060702','0',''),('04','060703','0',''),('04','060800','0',''),('04','060801','0',''),('04','060802','0',''),('04','060900','0',''),('04','060902','0',''),('04','060903','0',''),('04','060904','0',''),('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','0',''),('04','080100','0',''),('04','080200','0',''),('04','080300','0',''),('04','090000','0',''),('04','090100','0',''),('04','090101','0',''),('04','090102','0',''),('04','090203','0',''),('04','090300','0',''),('04','090301','0',''),('04','090302','0',''),('04','100000','0',''),('04','110000','0',''),('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 ('2025-01-13','10:43:04','Login','link - link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:37','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:38','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:07:46','Login','link - link','154.26.136.5',''),('2025-01-13','11:08:43','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:43','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:43','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:43','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:43','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:43','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:43','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:43','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:44','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:45','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','11:08:56','Login','admin - admin','154.26.136.5',''),('2025-01-13','11:20:20','Transaksi Pembayaran Grosir Baru (NoBayar=25000001)','admin','154.26.136.5',''),('2025-01-13','11:21:10','Login','link - link','154.26.136.5',''),('2025-01-13','13:35:54','Login','link - link','154.26.136.5',''),('2025-01-13','13:42:08','Login','link - link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:30','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:31','Update setting level user (level=01)','link','154.26.136.5',''),('2025-01-13','13:42:55','Login','link - link','154.26.136.5',''),('2025-01-13','14:16:35','Login','admin - admin','154.26.136.5',''),('2025-01-13','14:26:26','Login','link - link','154.26.136.5',''),('2025-01-13','14:27:23','Login','link - link','154.26.136.5',''),('2025-01-13','14:28:21','Transaksi Sales Order Baru (NoSO=12501130001)','link','154.26.136.5',''),('2025-01-13','14:29:57','Login','link - link','154.26.136.5',''),('2025-01-13','14:31:34','Login','link - link','154.26.136.5',''),('2025-01-14','09:55:01','Login','link - link','154.26.136.5',''),('2025-01-15','09:45:09','Login','link - link','154.26.136.5',''),('2025-01-15','10:38:04','Login','link - link','154.26.136.5',''),('2025-01-15','11:17:51','Login','link - link','154.26.136.5',''),('2025-01-15','11:18:59','Login','link - link','154.26.136.5',''),('2025-01-15','11:23:22','Login','link - link','154.26.136.5',''),('2025-01-15','11:32:05','Login','link - link','154.26.136.5',''),('2025-01-15','11:42:41','Login','link - link','154.26.136.5',''),('2025-01-15','11:46:07','Update konfigurasi','link','154.26.136.5',''),('2025-01-15','11:48:17','Login','link - link','154.26.136.5',''),('2025-01-15','11:48:49','Transaksi Sales Order Baru (NoSO=12501150001)','link','154.26.136.5',''),('2025-01-15','11:50:56','Login','link - link','154.26.136.5',''),('2025-01-15','13:05:53','Login','link - link','154.26.136.5',''),('2025-01-15','13:06:28','Transaksi Sales Order Baru (NoSO=12501150002)','link','154.26.136.5',''),('2025-01-15','13:09:40','Login','link - link','154.26.136.5',''),('2025-01-16','12:26:35','Login','link - link','154.26.136.5',''),('2025-01-16','12:29:01','Login','link - link','154.26.136.5',''),('2025-01-16','12:34:16','Login','link - link','154.26.136.5',''),('2025-01-16','12:41:20','Login','link - link','154.26.136.5',''),('2025-01-16','12:46:22','Login','link - link','154.26.136.5',''),('2025-01-16','12:46:46','Transaksi Sales Order Baru (NoSO=12501160001)','link','154.26.136.5',''),('2025-01-16','12:49:06','Login','link - link','154.26.136.5',''),('2025-01-16','12:49:55','Transaksi Sales Order Baru (NoSO=12501160002)','link','154.26.136.5',''),('2025-01-16','12:51:16','Login','link - link','154.26.136.5',''),('2025-01-16','12:57:03','Login','link - link','154.26.136.5',''),('2025-01-16','13:00:42','Login','link - link','154.26.136.5',''),('2025-01-16','13:01:33','Transaksi Penjualan Retail Baru (NoJual=12501160001)','link','154.26.136.5',''),('2025-01-16','13:04:50','Login','link - link','154.26.136.5',''),('2025-01-16','13:09:07','Login','link - link','154.26.136.5',''),('2025-01-16','13:10:44','Login','link - link','154.26.136.5',''),('2025-01-16','13:14:02','Login','link - link','154.26.136.5',''),('2025-01-16','13:18:02','Login','link - link','154.26.136.5',''),('2025-01-16','13:20:00','Login','link - link','154.26.136.5',''),('2025-01-16','13:30:56','Login','link - link','154.26.136.5',''),('2025-01-16','13:31:22','Transaksi Pembelian Baru (NoBeli=25000001)','link','154.26.136.5',''),('2025-01-16','13:31:23','Transaksi Cetak Invoice Pembelian','link','154.26.136.5',''),('2025-01-16','13:36:38','Login','link - link','154.26.136.5',''),('2025-01-16','13:38:00','Login','link - link','154.26.136.5',''),('2025-01-16','13:39:57','Login','link - link','154.26.136.5',''),('2025-01-16','15:00:36','Login','link - link','154.26.136.5',''),('2025-01-16','15:06:57','Login','link - link','154.26.136.5',''),('2025-01-16','15:07:35','Login','link - link','154.26.136.5',''),('2025-01-16','15:20:39','Login','link - link','154.26.136.5',''),('2025-01-21','09:05:27','Login','link - link','154.26.136.5',''),('2025-01-21','09:05:42','Transaksi Pembelian Baru (NoBeli=25000002)','link','154.26.136.5',''),('2025-01-21','09:05:44','Transaksi Cetak Invoice Pembelian','link','154.26.136.5',''),('2025-01-21','09:16:53','Login','link - link','192.168.1.3',''),('2025-01-21','09:18:21','Transaksi Pembelian Baru (NoBeli=25000003)','link','192.168.1.3',''),('2025-01-27','10:16:52','Login','asp - asp','192.168.1.102',''),('2025-02-01','13:18:10','Login','asp - asp','192.168.1.106',''),('2025-02-04','08:52:32','Login','asp - asp','192.168.1.106',''),('2025-02-04','14:06:54','Login','asp - asp','192.168.1.106',''),('2025-02-04','14:08:01','Transaksi Retur Beli Baru (NoJual=25000001)','asp','192.168.1.106',''),('2025-02-04','14:08:03','Transaksi Cetak Retur Pembelian','asp','192.168.1.106',''),('2025-02-04','14:09:10','Transaksi Pembayaran Pembelian Baru (NoBayar=25000001)','asp','192.168.1.106',''),('2025-02-09','12:15:05','Login','asp - asp','192.168.165.243',''),('2025-02-11','15:25:57','Login','asp - asp','192.168.1.107','');

--
-- 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 'dbekawijaya'
--
DELIMITER ;;
/*!50003 DROP FUNCTION IF EXISTS `BuatNo` */;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`client`@`%`*/ /*!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,8,3)),0) into NoInt from TR_Jual_m where substring(NoJual,2,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,8,3)),0) into NoInt from TR_RetJual_m where substring(NoRetJ,2,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 `GenKodeBrg` */;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`link`@`%`*/ /*!50003 FUNCTION `GenKodeBrg`(NoBk char(10)) RETURNS char(13) CHARSET latin1
BEGIN
  DECLARE nomor INTEGER DEFAULT 0;
  DECLARE VPK char(10) DEFAULT 0;
  SELECT IFNULL(MAX(right(kodebrg,1)), 0)+1 INTO nomor FROM tm_barang where left(kodebrg,length(nobk))=NoBk;
  SET vpk=INSERT('00000000',9-LENGTH(nomor), length(nomor), nomor);
  RETURN upper(concat(NoBk,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(10) DEFAULT 0;
  SELECT IFNULL(MAX(right(kodecust,1)), 0)+1 INTO nomor FROM tm_customer where left(kodecust,length(nobk))=NoBk;
  SET vpk=INSERT('0000000',8-LENGTH(nomor), length(nomor), nomor);
  RETURN upper( concat(NoBk,vPK));
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP FUNCTION IF EXISTS `GenKodeJurnalUmum` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `GenKodeJurnalUmum`(JenisJurnal char(5),Tgl varchar(12)) RETURNS char(15) CHARSET latin1
BEGIN
  DECLARE nomor INTEGER DEFAULT 0;
  DECLARE VPK char(10) DEFAULT 0;
  SELECT IFNULL(MAX(right(No_Bukti,5)), 0)+1 INTO nomor FROM tjurnal_m where left(No_Bukti,length(JenisJurnal))=JenisJurnal
  and Tanggal = Tgl;
  SET vpk=INSERT('00000',6-LENGTH(nomor), length(nomor), nomor);
  RETURN upper( concat(JenisJurnal,vPK));
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP FUNCTION IF EXISTS `GenKodeSupp` */;;
/*!50003 SET SESSION SQL_MODE="NO_AUTO_VALUE_ON_ZERO"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `GenKodeSupp`(NoBk char(10)) RETURNS char(13) CHARSET latin1
BEGIN
  DECLARE nomor INTEGER DEFAULT 0;
  DECLARE VPK char(10) DEFAULT 0;
  SELECT IFNULL(MAX(right(kodesupp,2)), 0)+1 INTO nomor FROM tm_supplier where left(kodesupp,length(nobk))=NoBk;
  SET vpk=INSERT('0000000',8-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*/;;
/*!50003 DROP PROCEDURE IF EXISTS `CheckJurnalUlang_BayarBeli` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `CheckJurnalUlang_BayarBeli`(sTglStart DATE)
BEGIN
  DECLARE finished INTEGER DEFAULT 0; 
	DECLARE sNoTrans VARCHAR(20);
	DEClARE curTrans
		CURSOR FOR 
			SELECT x.* FROM (SELECT NoBayarB FROM tr_bayarbeli_m WHERE TglBayarB >= sTglStart) x;
	DECLARE CONTINUE HANDLER 
        FOR NOT FOUND SET finished = 1;
	OPEN curTrans;
	getTrans: LOOP
		FETCH curTrans INTO sNoTrans;
		IF finished = 1 THEN 
			LEAVE getTrans;
		END IF;
		
		CALL SimpanJurnal_BayarBeli(sNoTrans);
		
	END LOOP getTrans;
	CLOSE curTrans;
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `CheckJurnalUlang_BayarGrosir` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `CheckJurnalUlang_BayarGrosir`(sTglStart DATE)
BEGIN
  DECLARE finished INTEGER DEFAULT 0; 
	DECLARE sNoTrans VARCHAR(20);
	DEClARE curTrans
		CURSOR FOR 
			SELECT x.* FROM (SELECT NoBayarJ FROM tr_bayarjual_m WHERE TglBayarJ >= sTglStart) x;
	DECLARE CONTINUE HANDLER 
        FOR NOT FOUND SET finished = 1;
	OPEN curTrans;
	getTrans: LOOP
		FETCH curTrans INTO sNoTrans;
		IF finished = 1 THEN 
			LEAVE getTrans;
		END IF;
		
		CALL SimpanJurnal_BayarJual(sNoTrans);
		
	END LOOP getTrans;
	CLOSE curTrans;
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `CheckJurnalUlang_Beli` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `CheckJurnalUlang_Beli`(sTglStart DATE)
BEGIN
  DECLARE finished INTEGER DEFAULT 0; 
	DECLARE sNoTrans VARCHAR(20);
	DEClARE curTrans
		CURSOR FOR 
			SELECT x.* FROM (SELECT NoBeli FROM tr_beli_m WHERE TglBeli >= sTglStart) x;
	DECLARE CONTINUE HANDLER 
        FOR NOT FOUND SET finished = 1;
	OPEN curTrans;
	getTrans: LOOP
		FETCH curTrans INTO sNoTrans;
		IF finished = 1 THEN 
			LEAVE getTrans;
		END IF;
		
		CALL SimpanJurnal_Pembelian(sNoTrans);
		
	END LOOP getTrans;
	CLOSE curTrans;
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `CheckJurnalUlang_JualGrosir` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `CheckJurnalUlang_JualGrosir`(sTglStart DATE)
BEGIN
  DECLARE finished INTEGER DEFAULT 0; 
	DECLARE sNoTrans VARCHAR(20);
	DEClARE curTrans
		CURSOR FOR 
			SELECT x.* FROM (SELECT NoJual FROM tr_jual_m WHERE TglJual >= sTglStart) x;
	DECLARE CONTINUE HANDLER 
        FOR NOT FOUND SET finished = 1;
	OPEN curTrans;
	getTrans: LOOP
		FETCH curTrans INTO sNoTrans;
		IF finished = 1 THEN 
			LEAVE getTrans;
		END IF;
		
		CALL SimpanJurnal_JualGrosir(sNoTrans);
		
	END LOOP getTrans;
	CLOSE curTrans;
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `CheckJurnalUlang_JualRetail` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `CheckJurnalUlang_JualRetail`(sTglStart DATE)
BEGIN
  DECLARE finished INTEGER DEFAULT 0; 
	DECLARE sNoTrans VARCHAR(20);
	DEClARE curTrans
		CURSOR FOR 
			SELECT x.* FROM (SELECT NoJualR FROM tr_jualr_m WHERE TglJual >= sTglStart) x;
	DECLARE CONTINUE HANDLER 
        FOR NOT FOUND SET finished = 1;
	OPEN curTrans;
	getTrans: LOOP
		FETCH curTrans INTO sNoTrans;
		IF finished = 1 THEN 
			LEAVE getTrans;
		END IF;
		
		CALL SimpanJurnal_JualRetail(sNoTrans);
		
	END LOOP getTrans;
	CLOSE curTrans;
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `CheckJurnalUlang_RetBeli` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `CheckJurnalUlang_RetBeli`(sTglStart DATE)
BEGIN
  DECLARE finished INTEGER DEFAULT 0; 
	DECLARE sNoTrans VARCHAR(20);
	DEClARE curTrans
		CURSOR FOR 
			SELECT x.* FROM (SELECT NoRetB FROM tr_retbeli_m WHERE TglRetB >= sTglStart) x;
	DECLARE CONTINUE HANDLER 
        FOR NOT FOUND SET finished = 1;
	OPEN curTrans;
	getTrans: LOOP
		FETCH curTrans INTO sNoTrans;
		IF finished = 1 THEN 
			LEAVE getTrans;
		END IF;
		
		CALL SimpanJurnal_ReturBeli(sNoTrans);
		
	END LOOP getTrans;
	CLOSE curTrans;
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `CheckJurnalUlang_ReturGrosir` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `CheckJurnalUlang_ReturGrosir`(sTglStart DATE)
BEGIN
  DECLARE finished INTEGER DEFAULT 0; 
	DECLARE sNoTrans VARCHAR(20);
	DEClARE curTrans
		CURSOR FOR 
			SELECT x.* FROM (SELECT NoRetJ FROM tr_retjual_m WHERE TglRetJ >= sTglStart) x;
	DECLARE CONTINUE HANDLER 
        FOR NOT FOUND SET finished = 1;
	OPEN curTrans;
	getTrans: LOOP
		FETCH curTrans INTO sNoTrans;
		IF finished = 1 THEN 
			LEAVE getTrans;
		END IF;
		
		CALL SimpanJurnal_ReturGrosir(sNoTrans);
		
	END LOOP getTrans;
	CLOSE curTrans;
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `CheckJurnalUlang_ReturRetail` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `CheckJurnalUlang_ReturRetail`(sTglStart DATE)
BEGIN
  DECLARE finished INTEGER DEFAULT 0; 
	DECLARE sNoTrans VARCHAR(20);
	DEClARE curTrans
		CURSOR FOR 
			SELECT x.* FROM (SELECT NoRetJ FROM tr_retjualr_m WHERE TglRetJ >= sTglStart) x;
	DECLARE CONTINUE HANDLER 
        FOR NOT FOUND SET finished = 1;
	OPEN curTrans;
	getTrans: LOOP
		FETCH curTrans INTO sNoTrans;
		IF finished = 1 THEN 
			LEAVE getTrans;
		END IF;
		
		CALL SimpanJurnal_ReturRetail(sNoTrans);
		
	END LOOP getTrans;
	CLOSE curTrans;
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteJurnal_BayarBeli` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `DeleteJurnal_BayarBeli`(sNoBayar VARCHAR(15))
BEGIN
	DECLARE NoBukti,sNoBukti VARCHAR(30); 
	
	Select No_bukti INTO sNoBukti from tjurnal_m where Jns_jurnal="JK" and Sandi_Trans_Id="YB" and Nobukti_Rtl=sNoBayar LIMIT 0,1;
    
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	SET NoBukti = CONCAT("YB",sNoBayar);
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=NoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=NoBukti;
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteJurnal_BayarJual` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `DeleteJurnal_BayarJual`(sNoBayar VARCHAR(15))
BEGIN
	DECLARE NoBukti,sNoBukti VARCHAR(30);
	
	Select No_bukti INTO sNoBukti from tjurnal_m where Jns_jurnal="JK" and Sandi_Trans_Id="YJ" and Nobukti_Rtl=sNoBayar LIMIT 0,1;
    
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	SET NoBukti = CONCAT("YJ",sNoBayar);
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=NoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=NoBukti;
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteJurnal_JualGrosir` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `DeleteJurnal_JualGrosir`(sNoJual VARCHAR(15))
BEGIN
  DECLARE sNoBukti, NoBukti VARCHAR(30); 
	select No_bukti INTO sNoBukti from tjurnal_m where Jns_jurnal="JK" and Sandi_Trans_Id="JT" and Nobukti_Rtl=sNoJual LIMIT 0,1;
  delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	SET NoBukti = CONCAT("JT",sNoJual);
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=NoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=NoBukti;
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteJurnal_JualRetail` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `DeleteJurnal_JualRetail`(sNoJual VARCHAR(15))
BEGIN
  DECLARE sNoBukti, NoBukti VARCHAR(30); 
	select No_bukti INTO sNoBukti from tjurnal_m where Jns_jurnal="JK" and Sandi_Trans_Id="JR" and Nobukti_Rtl=sNoJual LIMIT 0,1;
  delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	select CONCAT("JR",sNoJual) INTO NoBukti;
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=NoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=NoBukti;
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteJurnal_Pembelian` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `DeleteJurnal_Pembelian`(sNoBeli VARCHAR(15))
BEGIN
  DECLARE sNoBukti, NoBukti VARCHAR(30);
	Select No_bukti INTO sNoBukti from tjurnal where Jns_jurnal="JK" and Sandi_Trans_Id="BT" and Nobukti_Rtl=sNoBeli LIMIT 0,1;  
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	select CONCAT("BT",sNoBeli) INTO NoBukti;
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=NoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=NoBukti; 
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteJurnal_ReturBeli` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `DeleteJurnal_ReturBeli`(sNoRetur VARCHAR(15))
BEGIN
  DECLARE sNoBukti, NoBukti VARCHAR(30);
	Select No_bukti INTO sNoBukti from tjurnal 
		where Jns_jurnal="JK" and Sandi_Trans_Id="RB" and Nobukti_Rtl=sNoRetur LIMIT 0,1;
    
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	select CONCAT("RB",sNoRetur) INTO NoBukti;
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=NoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=NoBukti;
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteJurnal_ReturGrosir` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `DeleteJurnal_ReturGrosir`(sNoRetJ VARCHAR(15))
BEGIN
	DECLARE NoBukti VARCHAR(30); 
  DECLARE sNoBukti VARCHAR(30);
	
	Select No_bukti INTO sNoBukti from tjurnal_m where Jns_jurnal="JK" and Sandi_Trans_Id="RJ" and Nobukti_Rtl=sNoRetJ LIMIT 0,1; 
    
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	SET NoBukti = CONCAT("RJ",sNoRetJ);
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=NoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=NoBukti;
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `DeleteJurnal_ReturRetail` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `DeleteJurnal_ReturRetail`(sNoRetJ VARCHAR(15))
BEGIN
	DECLARE NoBukti VARCHAR(30);
  DECLARE sNoBukti VARCHAR(30);
	
	Select No_bukti INTO sNoBukti from tjurnal_m where Jns_jurnal="JK" and Sandi_Trans_Id="RR" and Nobukti_Rtl=sNoRetJ LIMIT 0,1; 
    
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	SET NoBukti = CONCAT("RR",sNoRetJ);
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=NoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=NoBukti;
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `SimpanJurnal_BayarBeli` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `SimpanJurnal_BayarBeli`(sNoBayar VARCHAR(15))
BEGIN
	DECLARE NoBukti,sNoBukti VARCHAR(30); 
  DECLARE sKodePerk VARCHAR(30);
  DECLARE HPP DECIMAL(15,2);
	DECLARE sTgl DATE;
	DECLARE sNamaSupp VARCHAR(100);
  DECLARE sNilai DECIMAL(15,2);
	DECLARE sJmlRow,sIndex INTEGER(4);
	
	SELECT m.TglBayarB,s.NamaSupp INTO sTgl,sNamaSupp FROM tr_bayarbeli_m m JOIN tm_supplier s ON m.KodeSupp=s.KodeSupp WHERE NoBayarB=sNoBayar;
	
	Select No_bukti INTO sNoBukti from tjurnal_m where Jns_jurnal="JK" and Sandi_Trans_Id="YB" and Nobukti_Rtl=sNoBayar LIMIT 0,1;
    
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	SET NoBukti = CONCAT("YB",sNoBayar);
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=NoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=NoBukti;
	insert into tjurnal_m (tanggal,no_bukti,keterangan,Sandi_Trans_Id,Status_Val,Nobukti_Rtl,pst,jns_jurnal,tgl_validasi,tgl_edit,user) 	values 
		("0000-00-00",NoBukti,CONCAT("Pembayaran Pembelian No: YJ-",sNoBayar," a.n ", sNamaSupp),"YB",0,sNoBayar,0,"JK",DATE(sTgl),now(),"ADMIN");
	
	SELECT COUNT(*) INTO sJmlRow FROM tr_bayarbeli_d WHERE NoBayarB=sNoBayar;
	
	
	SET sIndex=1;
	WHILE sIndex <= sJmlRow DO
		SELECT IFNULL(Bank,"111001"),Nilai INTO sKodePerk,sNilai FROM tr_bayarbeli_d WHERE NoBayarB=sNoBayar AND ItemDBayarB=sIndex;
		IF sKodePerk = '' THEN SET sKodePerk="111001"; END IF; 
		insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values 
				(YEAR(sTgl),DATE(sTgl),NoBukti,(sIndex * 2)-1,sKodePerk,0,sNilai,"JK");
		insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values 
				(YEAR(sTgl),DATE(sTgl),NoBukti,(sIndex * 2),"211001",sNilai,0,"JK");
		SET sIndex= sIndex + 1; 
	END WHILE;
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `SimpanJurnal_BayarJual` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `SimpanJurnal_BayarJual`(sNoBayar VARCHAR(15))
BEGIN
	DECLARE NoBukti,sNoBukti VARCHAR(30);
  DECLARE sKodePerk VARCHAR(30);
  DECLARE HPP DECIMAL(15,2);
	DECLARE sTgl DATE;
	DECLARE sNamaCust VARCHAR(100);
  DECLARE sNilai DECIMAL(15,2);
	DECLARE sJmlRow,sIndex INTEGER(4);
	
	SELECT m.TglBayarJ,c.NamaCust INTO sTgl,sNamaCust FROM tr_bayarjual_m m JOIN tm_customer c ON m.KodeCust=c.KodeCust WHERE NoBayarJ=sNoBayar;
	
	Select No_bukti INTO sNoBukti from tjurnal_m where Jns_jurnal="JK" and Sandi_Trans_Id="YJ" and Nobukti_Rtl=sNoBayar LIMIT 0,1;
    
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	SET NoBukti = CONCAT("YJ",sNoBayar);
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=NoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=NoBukti;
	insert into tjurnal_m (tanggal,no_bukti,keterangan,Sandi_Trans_Id,Status_Val,Nobukti_Rtl,pst,jns_jurnal,tgl_validasi,tgl_edit,user) 	values 
		("0000-00-00",NoBukti,CONCAT("Pembayaran Penjualan No: YJ-",sNoBayar," a.n ", sNamaCust),"YJ",0,sNoBayar,0,"JK",DATE(sTgl),now(),"ADMIN");
	
	SELECT COUNT(*) INTO sJmlRow FROM tr_bayarjual_d WHERE NoBayarJ=sNoBayar;
	
	
	SET sIndex=1;
	WHILE sIndex <= sJmlRow DO
		SELECT IFNULL(Bank,"111001"),Nilai INTO sKodePerk,sNilai FROM tr_bayarjual_d WHERE NoBayarJ=sNoBayar AND ItemDBayarJ=sIndex;
		IF sKodePerk = '' THEN SET sKodePerk="111001"; END IF; 
		insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values 
				(YEAR(sTgl),DATE(sTgl),NoBukti,(sIndex * 2)-1,sKodePerk,sNilai,0,"JK");
		insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values 
				(YEAR(sTgl),DATE(sTgl),NoBukti,(sIndex * 2),"112001",0,sNilai,"JK");
		SET sIndex= sIndex + 1; 
	END WHILE;
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `SimpanJurnal_JualGrosir` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `SimpanJurnal_JualGrosir`(sNoJual VARCHAR(15))
BEGIN
	DECLARE NoBukti VARCHAR(30); 
  DECLARE sNoBukti VARCHAR(30);
  DECLARE HPP DECIMAL(15,2);
	DECLARE sTgl DATE;
	DECLARE sNamaCust VARCHAR(100);
  DECLARE sNilai DECIMAL(15,2);
	SELECT TglJual,NamaCust, Nilai INTO sTgl,sNamaCust, sNilai FROM tr_jual_m WHERE NoJual=sNoJual;
	SELECT SUM(d.HargaAVG * d.Jml) INTO HPP FROM tr_jual_d d WHERE d.NoJual=sNoJual; 
	
	Select No_bukti INTO sNoBukti from tjurnal_m where Jns_jurnal="JK" and Sandi_Trans_Id="JT" and Nobukti_Rtl=sNoJual LIMIT 0,1;
    
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	SET NoBukti = CONCAT("JT",sNoJual);
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=NoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=NoBukti;
	insert into tjurnal_m (tanggal,no_bukti,keterangan,Sandi_Trans_Id,Status_Val,Nobukti_Rtl,pst,jns_jurnal,tgl_validasi,tgl_edit,user) 	values 
		("0000-00-00",NoBukti,CONCAT("Penjualan Grosir No: JT-",sNoJual," a.n ", sNamaCust),"JT",0,sNoJual,0,"JK",DATE(sTgl),now(),"NK");
		
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values (YEAR(sTgl),DATE(sTgl),NoBukti,1,"511001",HPP,0,"JK");
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values (YEAR(sTgl),DATE(sTgl),NoBukti,2,"112001",sNilai,0,"JK");
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values (YEAR(sTgl),DATE(sTgl),NoBukti,3,"113001",0,HPP,"JK");
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values (YEAR(sTgl),DATE(sTgl),NoBukti,4,"411001",0,sNilai,"JK");
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `SimpanJurnal_JualRetail` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `SimpanJurnal_JualRetail`(sNoJual VARCHAR(15))
BEGIN
	DECLARE NoBukti VARCHAR(30); 
  DECLARE sNoBukti VARCHAR(30);
  DECLARE HPP DECIMAL(15,2);
	DECLARE sTgl DATE;
  DECLARE sNilai DECIMAL(15,2);
	SELECT TglJual, Nilai INTO sTgl, sNilai FROM tr_jualr_m WHERE NoJualR=sNoJual;
	SELECT SUM(d.HargaAVG * d.Jml) INTO HPP FROM tr_jualr_d d WHERE d.NoJualR=sNoJual;
	
	Select No_bukti INTO sNoBukti from tjurnal where Jns_jurnal="JK" and Sandi_Trans_Id="JR" and Nobukti_Rtl=sNoJual LIMIT 0,1;
    
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	select CONCAT("JR",sNoJual) INTO NoBukti;
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=NoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=NoBukti;
	insert into tjurnal_m (tanggal,no_bukti,keterangan,Sandi_Trans_Id,Status_Val,Nobukti_Rtl,pst,jns_jurnal,tgl_validasi,tgl_edit,user) 	values 
		("0000-00-00",NoBukti,CONCAT("Penjualan Retail No: JR-",sNoJual),"JR",0,sNoJual,0,"JK",DATE(sTgl),now(),"ASP");
	
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values (YEAR(sTgl),DATE(sTgl),NoBukti,1,"511001",HPP,0,"JK");
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values (YEAR(sTgl),DATE(sTgl),NoBukti,2,"111001",sNilai,0,"JK");
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values (YEAR(sTgl),DATE(sTgl),NoBukti,3,"113001",0,HPP,"JK");
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values (YEAR(sTgl),DATE(sTgl),NoBukti,4,"411001",0,sNilai,"JK");
	
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `SimpanJurnal_Pembelian` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `SimpanJurnal_Pembelian`(sNoBeli  VARCHAR(15))
BEGIN
	DECLARE NoBukti VARCHAR(30);
  DECLARE sNoBukti VARCHAR(30);
  DECLARE HPP DECIMAL(15,2); 
	DECLARE sTgl DATE;
	DECLARE sNamaSupp VARCHAR(100);
  DECLARE sNilai DECIMAL(15,2);
	DECLARE sKodePerkD1,sKodePerkD2,sKodePerkD3 CHAR(6);
	DECLARE Persediaan1, Persediaan2, Persediaan3 DECIMAL(15,2);
	DECLARE sIndex,sJmlRow INTEGER;
	SELECT TglBeli,NamaSupp, Nilai  INTO sTgl,sNamaSupp, sNilai FROM tr_beli_m WHERE NoBeli=sNoBeli;
	Select No_bukti INTO sNoBukti from tjurnal where Jns_jurnal="JK" and Sandi_Trans_Id="BT" and Nobukti_Rtl=sNoBeli LIMIT 0,1;
    
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	select CONCAT("BT",sNoBeli) INTO NoBukti;
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=NoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=NoBukti;
	insert into tjurnal_m (tanggal,no_bukti,keterangan,Sandi_Trans_Id,Status_Val,Nobukti_Rtl,pst,jns_jurnal,tgl_validasi,tgl_edit,user)	values 
		("0000-00-00",NoBukti,CONCAT("Pembelian BT-",sNoBeli," , a.n ", sNamaSupp),"BT",0,sNoBeli,0,"JK",DATE(sTgl),now(),"ADMIN");
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values 
			(YEAR(sTgl),DATE(sTgl),NoBukti,1,113001,sNilai,0,"JK");
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values 
			(YEAR(sTgl),DATE(sTgl),NoBukti,2,211001,0,sNilai,"JK");
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `SimpanJurnal_ReturBeli` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `SimpanJurnal_ReturBeli`(sNoRetB  VARCHAR(15))
BEGIN
	DECLARE NoBukti VARCHAR(30); 
  DECLARE sNoBukti VARCHAR(30);
  DECLARE HPP DECIMAL(15,2); 
	DECLARE sTgl DATE;
	DECLARE sNamaSupp VARCHAR(100);
  DECLARE sNilai DECIMAL(15,2);
	DECLARE sKodePerkD1,sKodePerkD2,sKodePerkD3 CHAR(6);
	DECLARE Persediaan1, Persediaan2, Persediaan3 DECIMAL(15,2);
	DECLARE sIndex,sJmlRow INTEGER;
	SELECT m.TglRetB,(SELECT NamaSupp FROM tm_supplier where KodeSupp=m.KodeSupp), m.Nilai  INTO sTgl,sNamaSupp, sNilai FROM tr_retbeli_m m WHERE m.NoRetB=sNoRetB;
	Select No_bukti INTO sNoBukti from tjurnal where Jns_jurnal="JK" and Sandi_Trans_Id="RB" and Nobukti_Rtl=sNoRetB LIMIT 0,1;
    
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	select CONCAT("RB",sNoRetB) INTO NoBukti;
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=NoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=NoBukti;
	insert into tjurnal_m (tanggal,no_bukti,keterangan,Sandi_Trans_Id,Status_Val,Nobukti_Rtl,pst,jns_jurnal,tgl_validasi,tgl_edit,user)	values 
		("0000-00-00",NoBukti,CONCAT("Retur Pembelian RB-",sNoRetB," , a.n ", sNamaSupp),"RB",0,sNoRetB,0,"JK",DATE(sTgl),now(),"ADMIN");
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values 
			(YEAR(sTgl),DATE(sTgl),NoBukti,1,113001,0,sNilai,"JK");
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values 
			(YEAR(sTgl),DATE(sTgl),NoBukti,2,211001,sNilai,0,"JK");
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `SimpanJurnal_ReturGrosir` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `SimpanJurnal_ReturGrosir`(sNoRetJ VARCHAR(15))
BEGIN
	DECLARE NoBukti VARCHAR(30);
  DECLARE sNoBukti VARCHAR(30);
  DECLARE HPP DECIMAL(15,2);
	DECLARE sTgl DATE;
	DECLARE sNamaCust VARCHAR(100);
  DECLARE sNilai DECIMAL(15,2);
	SELECT r.TglRetJ,(SELECT NamaCust FROM tm_customer WHERE KodeCust=r.KodeCust LIMIT 0,1), r.Nilai INTO sTgl,sNamaCust, sNilai 
		FROM tr_retjual_m r WHERE r.NoRetJ=sNoRetJ;
	SELECT SUM((SELECT jd.HargaAVG FROM tr_jual_d jd WHERE jd.NoJual=d.NoJual AND jd.ItemJual=d.ItemJual AND jd.KodeBrg=d.KodeBrg) * d.Jml) INTO HPP FROM tr_retjual_d d WHERE d.NoRetJ=sNoRetJ; 
	
	Select No_bukti INTO sNoBukti from tjurnal_m where Jns_jurnal="JK" and Sandi_Trans_Id="RJ" and Nobukti_Rtl=sNoRetJ LIMIT 0,1;
    
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	SET NoBukti = CONCAT("RJ",sNoRetJ);
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=NoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=NoBukti;
	insert into tjurnal_m (tanggal,no_bukti,keterangan,Sandi_Trans_Id,Status_Val,Nobukti_Rtl,pst,jns_jurnal,tgl_validasi,tgl_edit,user) 	values 
		("0000-00-00",NoBukti,CONCAT("Retur Penjualan Grosir No: RJ-",sNoRetJ," a.n ", sNamaCust),"RJ",0,sNoRetJ,0,"JK",DATE(sTgl),now(),"ADMIN");
		
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values (YEAR(sTgl),DATE(sTgl),NoBukti,1,"511001",0,HPP,"JK");
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values (YEAR(sTgl),DATE(sTgl),NoBukti,2,"112001",0,sNilai,"JK");
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values (YEAR(sTgl),DATE(sTgl),NoBukti,3,"113001",HPP,0,"JK");
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values (YEAR(sTgl),DATE(sTgl),NoBukti,4,"411001",sNilai,0,"JK");
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
/*!50003 DROP PROCEDURE IF EXISTS `SimpanJurnal_ReturRetail` */;;
/*!50003 SET SESSION SQL_MODE="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER"*/;;
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `SimpanJurnal_ReturRetail`(sNoRetJ VARCHAR(15))
BEGIN
	DECLARE NoBukti VARCHAR(30); 
  DECLARE sNoBukti VARCHAR(30);
  DECLARE HPP DECIMAL(15,2);
	DECLARE sTgl DATE;
	DECLARE sNamaCust VARCHAR(100);
  DECLARE sNilai DECIMAL(15,2);
	SELECT TglRetJ,NamaCust, Nilai INTO sTgl,sNamaCust, sNilai 
		FROM tr_retjualr_m WHERE NoRetJ=sNoRetJ;
	SELECT SUM((SELECT jd.HargaAVG FROM tr_jualr_d jd WHERE jd.NoJualR=d.NoJual AND jd.ItemJual=d.ItemJual AND jd.KodeBrg=d.KodeBrg) * d.Jml) 
		INTO HPP FROM tr_retjualr_d d 
		WHERE d.NoRetJ=sNoRetJ; 
	
	Select No_bukti INTO sNoBukti from tjurnal_m where Jns_jurnal="JK" and Sandi_Trans_Id="RR" and Nobukti_Rtl=sNoRetJ LIMIT 0,1;
    
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=sNoBukti;
	SET NoBukti = CONCAT("RR",sNoRetJ);
	delete from tJurnal_d where Jns_Jurnal="JK" and No_bukti=NoBukti;
	delete from tJurnal_m where Jns_Jurnal="JK" and No_bukti=NoBukti;
	insert into tjurnal_m (tanggal,no_bukti,keterangan,Sandi_Trans_Id,Status_Val,Nobukti_Rtl,pst,jns_jurnal,tgl_validasi,tgl_edit,user) 	values 
		("0000-00-00",NoBukti,CONCAT("Retur Penjualan Retail No: RR-",sNoRetJ," a.n ", sNamaCust),"RR",0,sNoRetJ,0,"JK",DATE(sTgl),now(),"ADMIN");
		
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values (YEAR(sTgl),DATE(sTgl),NoBukti,1,"511001",0,HPP,"JK");
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values (YEAR(sTgl),DATE(sTgl),NoBukti,2,"111001",0,sNilai,"JK");
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values (YEAR(sTgl),DATE(sTgl),NoBukti,3,"113001",HPP,0,"JK");
	insert into tjurnal_d(tahun,tanggal,no_bukti,row_id,kode_perk,debet,kredit,jns_jurnal) values (YEAR(sTgl),DATE(sTgl),NoBukti,4,"411001",sNilai,0,"JK");
END */;;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
DELIMITER ;


