Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $id_user = $this->session->userdata('id_user');
- ?>
- <div class="container">
- <h4><?php echo $judul;?></h4>
- </div>
- <div class="container panel panel-default">
- <div class="panel-body">
- <?php
- if($this->session->flashdata('psn_success') <> '') {
- ?>
- <div class="alert alert-dismissible alert-success">
- <button type="button" class="close" data-dismiss="alert">×</button>
- <strong><span class="glyphicon glyphicon-ok"></span> <?php echo $this->session->flashdata('psn_success');?></strong>
- </div>
- <?php
- }
- if($this->session->flashdata('psn_gagal') <> '') {
- ?>
- <div class="alert alert-dismissible alert-danger">
- <button type="button" class="close" data-dismiss="alert">×</button>
- <strong>× <?php echo $this->session->flashdata('psn_gagal');?></strong>
- </div>
- <?php
- }
- ?>
- <table class='table table-striped table-hover display' id='example'>
- <thead style="text-align:center">
- <tr>
- <th>No.</th>
- <th>Kode Pesanan</th>
- <th>Nama Pembeli</th>
- <th>Jumlah Pesanan</th>
- <th>Total Harga</th>
- <th>Deadline Lunas</th>
- <th>Status</th>
- <th>Opsi</th>
- </tr>
- </thead>
- <tbody>
- <script>
- var timerData = [];
- function countdown(id_pembeli) {
- var seconds = timerData[id_pembeli].remaining;
- var hour = Math.floor(seconds/(60*60))%24;
- var min = Math.floor(seconds/60) % 60;
- var sec = seconds % 60;
- if (sec < 10) {
- sec = "0" + sec;
- }
- document.getElementById('waktu'+id_pembeli).innerHTML = hour+":"+min+":"+sec;
- if (seconds <= 0) {
- clearInterval(timerData[id_pembeli].timerId);
- document.getElementById('waktu' + id_pembeli).innerHTML = "DEADLINE!";
- } else {
- seconds--;
- }
- timerData[id_pembeli].remaining = seconds;
- }
- function timer(id_pembeli, seconds) {
- timerData[id_pembeli] = {
- remaining: seconds,
- timerId: setInterval(function () { countdown(id_pembeli); }, 1000)
- };
- }
- </script>
- <?php
- $no = 1;
- $countpembeli = $this->M_reseller->getpembeliwuser($id_user)->num_rows();
- if($countpembeli == 0){
- /*
- $this->session->set_flashdata(
- "psn_success",
- "<div class=\"alert alert-danger\" id=\"alert\">
- <i class=\"glyphicon glyphicon-ok\"></i> Data Kosong !
- <button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button> </div>");
- redirect('reseller/entry_data');
- */
- } else {
- $getpembeli = $this->M_reseller->getpembeliwuser($id_user)->result();
- foreach($getpembeli as $gp) {
- $id_pembeli = $gp->id_pembeli;
- $getmaster = $this->M_reseller->getmasterwpemuser($id_pembeli, $id_user)->result();
- $getjml = $this->M_reseller->getdetailwpembeli($id_pembeli)->num_rows();
- //Ambil/SUM total harga
- $total = $this->db->query("
- SELECT id_t_sales_master, sum(total_harga) as total
- FROM t_reseller_sales_detail
- WHERE id_t_sales_master = '$id_pembeli' ")->result();
- $total_harga = 'Rp. '.number_format($total[0]->total,2,".",",");
- //DEADLINE LUNASAN
- $sla = strtotime($getmaster[0]->waktu_deadline);
- $now = time();
- $seconds = $sla - $now;
- if($seconds<= 0) {
- $waktu_deadline = 'Waktu Habis';
- $update = $this->db->query("
- UPDATE t_reseller_sales_master
- SET status='canceled'
- WHERE id_t_sales_master='$id_pembeli' ");
- } else {
- $waktu_deadline = '<div style="font-size:40px;margin-top:7px;" id="waktu'.$id_pembeli.'" >
- DEADLINE!</div>';
- }
- ?>
- <tr>
- <td><?php echo $no++;?>.</td>
- <td><?php echo $getmaster[0]->id_t_sales_master;?></td>
- <td><?php echo $gp->nama;?></td>
- <td><?php echo $getjml; ?></td>
- <td><?php echo $total_harga; ?></td>
- <td><?php echo $waktu_deadline; ?></td>
- <td><?php echo $getmaster[0]->status;?></td>
- <td>
- <button class="btn btn-warning btn-xs" data-toggle="modal"
- data-target="#data_sales_master_edit<?php echo $gp->id_pembeli; ?>" >
- <span class="glyphicon glyphicon-pencil"></span> Edit</button>
- <a href="<?php echo base_url('reseller/data_sales_detail/'.$id_pembeli);?>"
- class="btn btn-success btn-xs" >
- <span class="glyphicon glyphicon-plus"></span> Olah Sapi</a>
- <a href="<?php echo base_url('reseller/data_sales_master_hapus/'.$id_pembeli);?>"
- class="btn btn-danger btn-xs" onclick="return confirm('Hapus data?')">× Hapus</a></td>
- </tr>
- <script type="text/javascript">
- timer(<?php echo "{$id_pembeli},{$seconds}";?>);
- </script>
- <?php
- include('data_sales_bukti_bayar.php');
- include('data_sales_master_edit.php');
- }
- }
- ?>
- </tbody>
- </table>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement