Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BEGIN
- IF (UPPER((SUBSTRING(new.TextDecoded ,1,4)) = "INFO" ) ) THEN
- #SET @PESAN = CONCAT(' Terima Kasih ', char(13), ' Nomor anda ',new.SenderNumber,' Berlangganan') ;
- SET @pilmob = (select GROUP_CONCAT('Nopol: ',no_polisi, ', Merk: ',merk) from ta_mobil where `status` = 0);
- insert into outbox (DestinationNumber ,TextDecoded,MultiPart ) values ( new.SenderNumber , @pilmob, true ) ;
- #untuk input status posisi mobil
- #elseif (UPPER(SUBSTRING_INDEX(new.TextDecoded, '#', 1)) = "STATUS") then
- # SET @PESAN1 = CONCAT('Terima Kasih ini STATUS', char(13),' coba') ;
- # insert into outbox (DestinationNumber ,TextDecoded ) values ( new.SenderNumber , @PESAN1 ) ;
- #untuk booking
- elseif (UPPER(SUBSTRING_INDEX(new.TextDecoded, '#', 1))="BOOKING") then
- SET @pel = (select user_id from ta_pelanggan where hp_p = new.SenderNumber limit 1);
- SET @pbook= UPPER(SUBSTRING_INDEX(new.TextDecoded, '#', -1));
- if (@pel is NOT NULL) then
- INSERT INTO `evanta`.`ta_peminjaman` (`kode_pinjam` ,`user_id` ,`no_polisi` ,`surat_dinas` ,`waktu_pinjam` ,`username_pinjam` ,`waktu_selesai` ,`username_selesai` ,`is_booking`)
- VALUES (NULL , @pel, @pbook, '', CURRENT_TIMESTAMP , '', '', '', '1');
- UPDATE `evanta`.`ta_mobil` SET `status` = '1' WHERE `ta_mobil`.`no_polisi` = @pbook;
- SET @gagl = CONCAT('Nomor Anda: ',new.SenderNumber, char(13),' Telah Berhasil Memboking ',@pbook) ;
- insert into outbox (DestinationNumber ,TextDecoded ) values ( new.SenderNumber , @gagl ) ;
- ELSE
- SET @gagl = CONCAT('Maaf Anda Belum Terdaftar', char(13),' Silahkan Hubungin Admin') ;
- insert into outbox (DestinationNumber ,TextDecoded ) values ( new.SenderNumber , @gagl ) ;
- end if;
- #LOKASI#B390NO#123,231
- elseif (UPPER(SUBSTRING_INDEX(new.TextDecoded, '#', 1))="LOKASI") then
- SET @plate= UPPER(SUBSTRING_INDEX(SUBSTRING_INDEX(new.TextDecoded, '#', -2),"#",1));
- SET @koorX= SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(new.TextDecoded, '#', -2),"#",-1),",",1);
- SET @koorY= SUBSTRING_INDEX(SUBSTRING_INDEX(new.TextDecoded, '#', -2),",",-1);
- INSERT INTO `evanta`.`ta_info_lokasi` (`id` ,`waktu` ,`no_polisi` ,`koor_x` ,`koor_y`)VALUES (NULL , CURRENT_TIMESTAMP , @plate, @koorX, @koorY);
- else
- insert into outbox (DestinationNumber ,TextDecoded ) values ( new.SenderNumber , 'Maaf Format Salah' ) ;
- END IF;
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement