Listing Program
Listing Program
Controller :
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$data['penjualan'] = $this->dash->getDataPenjualan()-
>result();
$data['permintaan'] = $this->dash->getDataPermintaan()-
>result();
$data['stok'] = $this->crud->get('tb_bahanbaku')->result();
$stok_produk = $this->dash->get_stok_produk()->row();
if($stok_produk->stok < $m_stok){
$data['info_produk'] = "Stok Produk sudah menipis
Nih, stok yang ada hanya $stok_produk->stok Buah";
}else{
$data['info_produk'] = "";
}
}elseif($level ==4){
$this->load->view('header',['judul' => 'Dashboard Pemasok Bahan
Baku Kebutuhan Bahan Baku']);
$data['jml_permintaan'] = $this->dash-
>jumlahPermintaan($id_user);
$data['jml_proses'] = $this->dash-
>jumlahStsPermintaan($id_user, 'Proses');
$data['jml_kirim'] = $this->dash-
>jumlahStsPermintaan($id_user, 'Kirim');
$data['jml_selesai'] = $this->dash-
>jumlahStsPermintaan($id_user, 'Selesai');
$data['permintaan'] = $this->dash-
>getDataPermintaan($id_user)->result();
}else{
$this->load->view('header',['judul' => 'Aplikasi Pemesanan Pada
Bahan Baku']);
$data['produk'] = $this->dash->get_produk()->result();
$data['stok'] = $this->dash->get_stok_produk()->row();
$data['harga'] = $this->dash->get_harga_jual();
$data['pesanan'] = $this->dash->get_pesanan($id_user)-
>result();
}
$this->load->view('dashboard', $data);
$this->load->view('footer');
$this->load->view('dashboard-js');
}
$data_input = [
'kode_penjualan' => $kode_penjualan,
'kode_pelanggan' => $kode_pelanggan,
'jumlah' => $jumlah,
'harga' => $harga,
'totalbayar' => $harga*$jumlah,
'status' => 'Menunggu Konfirmasi',
'tanggal' => date('Y-m-d')
];
$simpan = $this->crud->insert('tb_penjualan', $data_input);
if($simpan){
$this->session->set_flashdata('pesan', 'Pesanan
terkirim');
}else{
$this->session->set_flashdata('pesan', 'Tidak dapat
membuat pesanan');
}
redirect('dashboard');
}
$this->cart->insert($data);
redirect('dashboard');
}
}
}
MODEL :
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
}else{
$this->db->select('bb.nama as nama_bahanbaku, bb.satuan,
pmsk.nama as pemasok, order.*');
$this->db->join('tb_bahanbaku bb', 'bb.kode =
order.kode_bahanbaku', 'inner');
$this->db->join('tb_pemasok pmsk', 'pmsk.kode_bahanbaku =
order.kode_bahanbaku', '');
$this->db->order_by('order.kode_order', 'desc');
return $this->db->get('tb_order_bahanbaku order', 5);
}
}
View :
<?php
if($this->session->userdata('level') == 4){
//cek notifikasi pesanan
//ini hanya untuk pemasok
$id_pemasok = $this->session->userdata('id');
$notif = $this->db->select('tob.jumlah, bb.nama,tob.kode_order, bb.satuan')
->join('tb_bahanbaku bb', "bb.kode = tob.kode_bahanbaku")
->join('tb_pemasok pmsk', "pmsk.kode_pemasok = tob.kode_pemasok")
->where(['tob.notif_order'=> 'Y', 'pmsk.id' => $id_pemasok])
->order_by('tob.kode_order', 'desc')
->get('tb_order_bahanbaku tob', 5);
$jumlah_notif = $notif->num_rows();
}elseif($this->session->userdata('level') ==1){
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Dashboard </title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/x-icon" href="<?=
base_url();?>assets/img/favicon.ico">
<link href="https://fonts.googleapis.com/css?
family=Open+Sans:300,300i,400,400i,700,700i,800" rel="stylesheet">
<link rel="stylesheet" href="<?= base_url();?>assets/css/bootstrap.min.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/font-
awesome.min.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/adminpro-custon-
icon.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/meanmenu.min.css">
<link rel="stylesheet" href="<?=
base_url();?>assets/css/jquery.mCustomScrollbar.min.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/animate.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/data-table/bootstrap-
table.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/data-table/bootstrap-
editable.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/normalize.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/c3.min.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/form/all-type-
forms.css">
<link rel="stylesheet" href="<?= base_url();?>assets/style.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/responsive.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/alerts.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/modals.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/charts.css">
<link rel="stylesheet" href="<?=
base_url();?>assets/css/datapicker/datepicker3.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/Lobibox.min.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/notifications.css">
<script src="<?=
base_url();?>assets/js/vendor/modernizr-2.8.3.min.js"></script>
</head>
<body style="background-color: whitesmoke;">
<div class="wrapper-pro">
<div class="left-sidebar-pro">
<nav id="sidebar">
<div class="sidebar-header">
<?php
if($this->session->userdata('level') == 1 or $this->session->userdata('level')
== 2 or $this->session->userdata('level') == 3){ ?>
<a href="#"><img style="width: 70px" src="<?=
base_url();?>assets/admin.png">
</a>
<?php }elseif ($this->session->userdata('level') == 4) { ?>
<a href="#"><img style="width: 70px" src="<?= base_url();?>assets/CV.
Pelita Mas Jaya.png">
</a>
<?php } else { ?>
<a href="#"><img style="width: 70px" src="<?=
base_url();?>assets/pelanggan.png">
</a>
<?php } ?>
<h3><?= $this->session->userdata('nama'); ?></h3>
<p><?= $this->session->userdata('email'); ?></p>
<strong>AP+</strong>
</div>
<div class="left-custom-menu-adp-wrap">
<ul class="nav navbar-nav left-sidebar-menu-pro">
<li class="nav-item">
<a href="<?= site_url();?>" class="nav-link"><i class="fa big-icon fa-
home"></i> <span class="mini-dn">Beranda</span> </a>
</li>
<?php
if($this->session->userdata('level') == 1 or $this->session->userdata('level')
== 2 or $this->session->userdata('level') == 3){
$this->load->view('menu-admin');
}elseif($this->session->userdata('level') == 4){
$this->load->view('menu-pemasok');
}else{
$this->load->view('menu-pelanggan');
} ?>
</ul>
</div>
</nav>
</div>
</div>
<div class="content-inner-all">
<div class="header-top-area">
<div class="fixed-header-top">
<div class="container-fluid">
<div class="row">
<div class="col-lg-1 col-md-6 col-sm-6 col-xs-12">
<button type="button" id="sidebarCollapse" class="btn bar-button-pro
header-drl-controller-btn btn-info navbar-btn">
<i class="fa fa-bars"></i>
</button>
<div class="admin-logo logo-wrap-pro">
<a href="#"><img src="img/logo/log.png" alt="" />
</a>
</div>
</div>
<div class="notification-single-top">
<h1>Keranjang Anda</h1>
</div>
<?php if(!empty($this->cart->contents())){ ?>
<ul class="notification-menu">
<?php foreach ($this->cart->contents() as $items) : ?>
<li>
<a href="#">
<div class="notification-icon">
<span class="adminpro-icon
adminpro-checked-pro"></span>
</div>
<div class="notification-content">
<span class="notification-date"></span>
<h2>Jumlah Produk <?= $items['weight'];?></h2>
<p>Dengan Produk Yang Anda Pesan. <?= $items['name'];?
></p>
</div>
</a>
</li>
<?php endforeach;?>
</ul>
<div class="notification-view">
<a href="<?= site_url('keranjang');?>">View All Notification</a>
</div>
</div>
</li>
<?php } } ?>
<li class="nav-item">
<a href="<?= site_url('logout');?>" role="button" aria-
expanded="false" >
<span class="adminpro-icon adminpro-user-rounded header-riht-
inf"></span>
<span class="admin-name">Logout</span>
<span class="author-project-icon adminpro-icon adminpro-down-
arrow"></span>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Header top area end-->
<!-- Breadcome start-->
<div class="breadcome-area mg-b-30 small-dn">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
</div>
</div>
</div>
</div>
<!-- Breadcome End-->
<!-- Mobile Menu start -->
<div class="mobile-menu-area">
<div class="container">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="mobile-menu">
<nav id="dropdown">
<ul class="mobile-menu-nav">
<li><a data-toggle="collapse" data-target="#Charts" href="#">Pilih
<span class="admin-project-icon adminpro-icon
adminpro-down-arrow"></span></a>
<li class="nav-item">
<a href="<?= site_url();?>" class="nav-link"><i class="fa big-icon fa-
home"></i> <span class="mini-dn">Beranda</span> </a>
</li>
<?php
if($this->session->userdata('level') == 1 or $this->session->userdata('level')
== 2 or $this->session->userdata('level') == 3){
$this->load->view('menu-admin');
}elseif($this->session->userdata('level') == 4){
$this->load->view('menu-pemasok');
}else{
$this->load->view('menu-pelanggan');
} ?>
</ul>
</nav>
</div>
</div>
</div>
</div>
</div>
<!-- Mobile Menu end -->
<!-- Breadcome start-->
<div class="breadcome-area des-none">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="breadcome-list map-mg-t-40-gl shadow-reset">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<div class="breadcome-heading">
<form role="search" class="">
<input type="text" placeholder="Search..." class="form-control">
<a href=""><i class="fa fa-search"></i></a>
</form>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<ul class="breadcome-menu">
<li><a href="#">Home</a> <span class="bread-slash">/</span>
</li>
<li><span class="bread-blod">Dashboard</span>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br><br>
<div class="footer-copyright-area">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="footer-copy-right">
<p>Copyright © 2023 UD ASTINA. Template by <a
href="https://colorlib.com">Colorlib</a>.</p>
</div>
</div>
</div>
</div>
</div>
<script src="<?=
base_url();?>assets/js/vendor/jquery-1.11.3.min.js"></script>
<script src="<?= base_url();?>assets/js/bootstrap.min.js"></script>
<script src="<?= base_url();?>assets/js/jquery.meanmenu.js"></script>
<script src="<?=
base_url();?>assets/js/jquery.mCustomScrollbar.concat.min.js"></script>
<script src="<?= base_url();?>assets/js/jquery.sticky.js"></script>
<script src="<?= base_url();?>assets/js/jquery.scrollUp.min.js"></script>
<script src="<?=
base_url();?>assets/js/counterup/jquery.counterup.min.js"></script>
<script src="<?=
base_url();?>assets/js/counterup/waypoints.min.js"></script>
<script src="<?=
base_url();?>assets/js/counterup/counterup-active.js"></script>
<script src="<?= base_url();?>assets/js/peity/jquery.peity.min.js"></script>
<script src="<?= base_url();?>assets/js/peity/peity-active.js"></script>
<script src="<?=
base_url();?>assets/js/sparkline/jquery.sparkline.min.js"></script>
<script src="<?=
base_url();?>assets/js/sparkline/sparkline-active.js"></script>
<script src="<?= base_url();?>assets/js/flot/Chart.min.js"></script>
<script src="<?= base_url();?>assets/js/flot/flot-active.js"></script>
<script src="<?= base_url();?>assets/js/map/raphael.min.js"></script>
<script src="<?= base_url();?>assets/js/map/jquery.mapael.js"></script>
<script src="<?=
base_url();?>assets/js/data-table/bootstrap-table.js"></script>
<script src="<?= base_url();?>assets/js/data-table/tableExport.js"></script>
<script src="<?=
base_url();?>assets/js/data-table/data-table-active.js"></script>
<script src="<?= base_url();?>assets/js/data-table/bootstrap-table-
editable.js"></script>
<script src="<?=
base_url();?>assets/js/data-table/bootstrap-editable.js"></script>
<script src="<?= base_url();?>assets/js/data-table/bootstrap-table-
resizable.js"></script>
<script src="<?= base_url();?>assets/js/data-table/colResizable-
1.5.source.js"></script>
<script src="<?= base_url();?>assets/js/data-table/bootstrap-table-
export.js"></script>
<script src="<?= base_url();?>assets/js/Lobibox.js"></script>
<script src="<?= base_url();?>assets/js/modal-active.js"></script>
<script src="<?= base_url();?>assets/js/flot/jquery.flot.js"></script>
<script src="<?=
base_url();?>assets/js/flot/jquery.flot.tooltip.min.js"></script>
<script src="<?= base_url();?>assets/js/flot/jquery.flot.spline.js"></script>
<script src="<?= base_url();?>assets/js/flot/jquery.flot.resize.js"></script>
<script src="<?= base_url();?>assets/js/flot/jquery.flot.pie.js"></script>
<script src="<?= base_url();?>assets/js/flot/Chart.min.js"></script>
<script src="<?= base_url();?>assets/js/flot/flot-active.js"></script>
<script src="<?= base_url();?>assets/js/datapicker/bootstrap-
datepicker.js"></script>
<script src="<?= base_url();?>assets/js/notification-active.js"></script>
<!-- main JS
============================================ -->
<script src="<?= base_url();?>assets/js/main.js"></script>
<script>
$(document).ready(function () {
$('#edit_user').on('show.bs.modal', function (e) {
var idx = $(e.relatedTarget).data('id');
var link = $(e.relatedTarget).data('key');
//menggunakan fungsi ajax untuk pengambilan data
$.ajax({
type: 'post',
url: link,
data: 'id=' + idx,
success: function (data) {
$('.form-edit-user').html(data); //menampilkan data ke dalam modal
}
});
});
});
</script>
</body>
</html>