Hallo! Selamat Datang di Marketplace produk digital, Freelancer terbaik di indonesia (67421 Members, 783 Products, 5280 Topic, 12953 Comments)

MENAMPILKAN DATA DI TEXTBOX SETELAH DI INPUT

Dibuat
Login Terakhir 7 Bulan lalu,
Telah Dilihat 2997 Kali
indrianto adi Mengatakan : Sultan Account
  1. Asslmkm mas robby saya punya kasus seperti ini
  2. saya input data pada gambar 1 kemudian klik tombol save prosesnya jadi ke gambar 2 (alias jadi kosong), bagaimana supaya digambar 2 tadi ada data yang sudah di isi yang sama ?
  3. berikut scriptnya dan gambar nya dibawah
  4.  
  5. //view
  6. <?php
  7. echo "<div class='col-md-12'>
  8. <div class='box box-info'>
  9.  
  10. <div class='box-body'>";
  11. $attributes = array('class'=>'form-horizontal','role'=>'form');
  12. echo form_open_multipart('Layanan/tambah_pembayaran_baru',$attributes);
  13. echo "<div class='col-md-12'>
  14. <div class='box-header with-border'>
  15. <h3 class='box-title'>DATA CUSTOMER SEBELUMNYA</h3>
  16. </div>
  17. <table class='table table-condensed table-bordered'>
  18. <tbody>
  19. <tr>
  20. <th width='120px' scope='row'>Nama </th>
  21. <td>
  22. <input type='text' name='nama_jamaah' class='form-control' value='$customer[nama_depan] $customer[nama_tengah] $customer[nama_belakang]' readonly></td>
  23. <input type='hidden' name='id_cus' class='form-control' value='$customer[id_cus]' readonly></td>
  24.  
  25. </tr>
  26. <tr>
  27. </tr>
  28. <tr>
  29. <th width='250px' scope='row'>Tempat/Tgl Lahir </th>
  30.  
  31. <td><input type='text' name='ttl' class='form-control' value='$customer[tempat_lahir] / $customer[tgl_lahir]' readonly></td>
  32.  
  33. </tr>
  34. <tr>
  35. <th width='250px' scope='row'>Kwitansi number</th>
  36.  
  37. <td><input type='text' name='no_order' class='form-control' value='$noautokwitansi' readonly></td>
  38.  
  39. </tr>
  40.  
  41.  
  42. <tr>
  43. <th width='120px' scope='row'>Harga</th>
  44. <td><input type='text' name='harga_paket' class='form-control'></td>
  45. <th width='120px' scope='row'>Qty</th>
  46. <td><input type='text' name='qty' class='form-control'></td>
  47. </tr>
  48. <tr>
  49.  
  50. <th width='120px' scope='row'>Total bayar</th>
  51. <td>
  52. <input type='text' name='total_bayar' class='form-control'></td>
  53.  
  54.  
  55. </tr>
  56.  
  57. </tbody>
  58. </table>
  59. </div>
  60. </div>
  61. <div class='box-footer'>
  62. <button type='submit' name='submit' class='btn btn-primary'>Save</button>
  63. <a href='../tambah_pembayaran_baru'><button type='button' class='btn btn-default pull-right'>Cancel</button></a>
  64.  
  65. </div>
  66. </div>";
  67. ?>
  68.  
  69. <div class='col-md-12'>
  70. <div class='box box-info'>
  71. <div class='box-header with-border'>
  72. <h3 class='box-title'>Pembayaran Customer</h3>
  73. </div>
  74. <div class='box-body'>
  75. <table class="table table-bordered">
  76. <thead>
  77. <tr>
  78. <th>No</th>
  79. <th>Nama</th>
  80.  
  81. <th>Harga</th>
  82. <th>Total bayar</th>
  83. <th>Sisa pembayaran</th>
  84. <th>Status pembayaran</th>
  85. <th>Action</th>
  86. </tr>
  87. </thead>
  88. <tbody>
  89. <?php
  90. $no=1;
  91. foreach($tampilkandata->result() as $getdata){
  92. if ($getdata->sisa_pembayaran == 0){
  93. $status = '<span style="color:green">LUNAS</span>';
  94. }else{
  95. $status = '<span style="color:red">BELUM LUNAS</span>';
  96. }
  97. ?>
  98. <tr>
  99. <th><?php echo $no; ?></th>
  100. <th><?php echo $getdata->nama_jamaah ?></th>
  101. <td><?php cetakdulu (number_format($getdata->harga_paket,0,",",".")) ?></td>
  102. <td><?php cetakdulu (number_format($getdata->jumlah_yang_dibayar,0,",",".")) ?></td>
  103. <td><?php cetakdulu (number_format($getdata->sisa_pembayaran,0,",",".")) ?></td>
  104. <th><?php echo $status;?></th>
  105. <th>
  106. <center>
  107. <a class='btn btn-success btn-xs' title='Invoice' href='#' onclick="cetak_invoice(<?php echo $getdata->id_pembayaran; ?>)"><span class='glyphicon glyphicon-print'></span></a>
  108. <a class='btn btn-danger btn-xs delete-link' title='Delete Data' href='<?php echo base_url("Layanan/delete_pendaftaran/".$getdata->id_pembayaran)?>' ><span class='glyphicon glyphicon-remove'></span></a>
  109. </center>
  110. </th>
  111. </tr>
  112. <?php $no++;
  113. }
  114. ?>
  115. </tbody>
  116. </table>
  117. </div>
  118. </div>
  119.  
  120. <script type="text/javascript">
  121. function cetak_invoice(id) {
  122. var url = "<?php echo site_url("Keuangan/cetak_invoice")?>/" + id;
  123. var left = ($(window).width() / 2) - (1000 / 2);
  124. var top = ($(window).height() / 2) - (1000 / 2);
  125. window.open(url, "Cetak Invoice", "width=1000, height=600, top=" + top + ", left=" + left);
  126. }
  127.  
  128.  
  129.  
  130. </script>
  131.  
  132. //controllers
  133.  
  134. function tambah_pembayaran_baru(){
  135. cek_session_admin();
  136. $id = $this->uri->segment(3);
  137. $id_cus = $this->uri->segment(3);
  138.  
  139. if (isset($_POST['submit'])){
  140.  
  141. $this->model_main->updatepembayaran();
  142. //$this->model_main->editdatacus($id)->row_array();
  143. //$data['rows'] = $this->model_main->tampil_save($id)->row_array();
  144. redirect('Layanan/tampilkandata');
  145. //$data['jeniskelamin'] = $this->model_main->ambiljeniskelamin();
  146. }else{
  147. $data['customer'] = $this->model_main->editdatacus($id)->row_array();
  148. //$data['jeniskelamin'] = $this->model_main->ambiljeniskelamin();
  149. $data['tampilkandata'] = $this->model_main->datapernama($id_cus);
  150. $data['noautokwitansi'] = $this->model_main->noautokwitansi();
  151. $this->session->set_flashdata("pesan", "<div class=\"col-md-12\"><div class=\"alert alert-danger\" id=\"alert\">Gagal!!</div></div>");
  152.  
  153. $this->template->load('Cpanelweb/template','Cpanelweb/mod_keuangan/view_tampil_save',$data);
  154.  
  155. }
  156.  
  157. }
  158.  
  159. //model
  160.  
  161. public function updatepembayaran()
  162. {
  163.  
  164. //'alamat'=>$this->db->escape_str($this->input->post('alamat')),
  165. $id_cus = $this->db->escape_str(trim($this->input->post('id_cus')));
  166. $nama_jamaah = $this->db->escape_str(trim($this->input->post('nama_jamaah')));
  167. // $id_agent = $this->db->escape_str(trim($this->input->post('id_agent')));
  168. $no_order = $this->db->escape_str(trim($this->input->post('no_order')));
  169. $harga_paket = $this->db->escape_str(trim($this->input->post('harga_paket')));
  170. $jumlah_yang_dibayar= $this->db->escape_str(trim($this->input->post('total_bayar')));
  171. $qty= $this->db->escape_str(trim($this->input->post('qty')));
  172.  
  173. //if($jumlah_yang_dibayar > $harga_paket ){
  174. //$this->session->set_flashdata('error', '<font color="#ff000">Maaf, anda kelebihan dana!!! silahkan input ulang</font>');
  175. //echo $this->session->flashdata('error');
  176. //exit;
  177.  
  178. //redirect('Keuangan/tambah_pembayaran');
  179. //}
  180. $note = $this->db->escape_str(trim($this->input->post('note')));
  181. $sisapembayaran = $harga_paket*$qty-$jumlah_yang_dibayar;
  182. $tanggal = date("Y-m-d");
  183. $data = array(
  184. 'no_order' => $no_order,
  185. 'id_cus' => $id_cus,
  186. 'qty' => $qty,
  187. 'nama_jamaah' => $nama_jamaah,
  188. // 'id_agent' => $id_agent,
  189. 'harga_paket' => $harga_paket,
  190. 'jumlah_yang_dibayar'=> $jumlah_yang_dibayar,
  191. 'waktu_pemesanan' => $tanggal,
  192. 'keterangan'=> $note,
  193. 'sisa_pembayaran' => $sisapembayaran
  194. );
  195.  
  196.  
  197. $this->db->insert('tbl_pembayaran',$data);
  198. }
Ada 2 File Kiriman :
1. GBR1.png (63 KB)
2. GBR2.png (66 KB)
Maaf, Untuk Memberikan Komentar Anda Harus Login !!!