Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. //HTML
  2. <div class="form-group">
  3. <label class="col-md-4 col-sm-4 col-xs-12 control-label">No. Order Masuk</label>
  4. <div class="col-md-8 col-sm-8 col-xs-12">
  5. <select id="id_order_masuk" name="id_order_masuk" data-live-search="true" class="form-control selectpicker" title="-- Pilih No. Order Masuk | Customer --" required="required">
  6.  
  7. </select>
  8. </div>
  9. </div>
  10. //AJAX
  11. function autolistkasir(){
  12. var time = setTimeout("autolistkasir()", 8000)
  13. $.ajax({
  14. url: '<?php echo base_url('Penjualan/realtime_list')?>',
  15. type: 'AJAX',
  16. dataType: 'JSON',
  17. async : false,
  18. crossOrigin : false,
  19. cache : false,
  20. success : function(data){
  21. console.log(data);
  22. var html = '';
  23. var i;
  24. for (i = 0; i < data.length; i++) {
  25. html+= '<option value="'+data[i].id_order_masuk+'">'+data[i].id_order_masuk +'|'+ data[i].nama_customer+'</option>';
  26.  
  27. }
  28. $('#id_order_masuk').append(html);
  29. }
  30. });
  31. }
  32.  
  33. $(document).ready(function(){
  34. localStorage.setItem("req_time_kasir", "<?= date('YmdHis'); ?>");
  35. get_notif_for_kasir();
  36. //autolistkasir();
  37. //setInterval(() => {autolistkasir()},3000);
  38. setInterval(autolistkasir(), 5000)
  39. })
  40. //CONTROllER
  41. $data = $this->penjualan_model->realtime_list();
  42. echo json_encode($data);
  43. //MODEL
  44.  
  45. $this->db->select('*');
  46. $this->db->from('tabel_order_masuk');
  47. $this->db->join('tabel_customer', 'tabel_order_masuk.id_customer = tabel_customer.id_customer', 'left');
  48. $this->db->join('tabel_perusahaan', 'tabel_customer.id_perusahaan = tabel_perusahaan.id_perusahaan', 'left');
  49. $this->db->where('tabel_order_masuk.status_order_masuk', 0);
  50. $this->db->order_by('tanggal_order_masuk', 'desc');
  51. $this->db->order_by('jam_order_masuk', 'desc');
  52. $data = $this->db->get();
  53. return $data->result();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement