Advertisement
fahmihilmansyah

Untitled

Jul 1st, 2014
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.81 KB | None | 0 0
  1. BEGIN
  2.     IF (UPPER((SUBSTRING(new.TextDecoded ,1,4)) =  "INFO"  ) ) THEN
  3.         #SET @PESAN = CONCAT(' Terima Kasih  ', char(13), ' Nomor anda ',new.SenderNumber,' Berlangganan') ;
  4.         SET @pilmob = (select GROUP_CONCAT('Nopol: ',no_polisi, ', Merk: ',merk) from ta_mobil where `status` = 0);
  5.         insert into outbox (DestinationNumber ,TextDecoded ) values ( new.SenderNumber  , @pilmob ) ;
  6.     #untuk input status posisi mobil
  7.     elseif (UPPER(SUBSTRING_INDEX(new.TextDecoded, '#', 1)) = "STATUS") then
  8.         SET @PESAN1 = CONCAT('Terima Kasih ini STATUS', char(13),' coba') ;
  9.         insert into outbox (DestinationNumber ,TextDecoded ) values ( new.SenderNumber  , @PESAN1 ) ;
  10.     #untuk booking
  11.     elseif (UPPER(SUBSTRING_INDEX(new.TextDecoded, '#', 1))="BOOKING") then
  12.         SET @pel = (select user_id from ta_pelanggan where hp_p = new.SenderNumber limit 1);
  13.             SET @pbook= SUBSTRING_INDEX(new.TextDecoded, '#', -1);
  14.         if (@pel is NOT NULL) then
  15.             INSERT INTO  `evanta`.`ta_peminjaman` (`kode_pinjam` ,`user_id` ,`no_polisi` ,`surat_dinas` ,`waktu_pinjam` ,`username_pinjam` ,`waktu_selesai` ,`username_selesai` ,`is_booking`)
  16.             VALUES (NULL ,  @pel,  @pbook,  '', CURRENT_TIMESTAMP ,  '',  '',  '',  '1');
  17.             UPDATE  `evanta`.`ta_mobil` SET  `status` =  '1' WHERE  `ta_mobil`.`no_polisi` =  @pbook;
  18.             SET @gagl = CONCAT('Nomor Anda: ',new.SenderNumber, char(13),' Telah Berhasil Memboking ',@pbook) ;
  19.                 insert into outbox (DestinationNumber ,TextDecoded ) values ( new.SenderNumber  , @gagl ) ;
  20.         ELSE
  21.                 SET @gagl = CONCAT('Maaf Anda Belum Terdaftar', char(13),' Silahkan Hubungin Admin') ;
  22.                 insert into outbox (DestinationNumber ,TextDecoded ) values ( new.SenderNumber  , @gagl ) ;
  23.         end if;
  24.     else
  25.         insert into outbox (DestinationNumber ,TextDecoded ) values ( new.SenderNumber  , 'Maaf Format Salah' ) ;
  26.     END IF;
  27. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement