deploy awal
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
class Model_Laporan extends CI_Model
|
||||
{
|
||||
|
||||
function get_data()
|
||||
{
|
||||
return
|
||||
$this->db
|
||||
->join('penjualan', 'penjualan.id_dtlpen = detail_penjualan.id', 'left')
|
||||
->join('barang', 'barang.id_barang = penjualan.id_barang', 'left')
|
||||
->join('pembayaran', ' detail_penjualan.id_pembayaran = pembayaran.id_byr ', 'inner')
|
||||
->group_by('detail_penjualan.no_trf')
|
||||
->distinct()
|
||||
->order_by('detail_penjualan.id', 'ASC')
|
||||
->get('detail_penjualan')->result();
|
||||
}
|
||||
|
||||
function get_metode()
|
||||
{
|
||||
return $this->db->get('pembayaran')->result();
|
||||
}
|
||||
|
||||
|
||||
function get_range($start, $end, $metode)
|
||||
{
|
||||
if ($metode != '') {
|
||||
return $this->db->join('penjualan', 'penjualan.id_dtlpen = detail_penjualan.id', 'left')
|
||||
->join('barang', 'barang.id_barang = penjualan.id_barang', 'left')
|
||||
->join('pembayaran', ' detail_penjualan.id_pembayaran = pembayaran.id_byr ', 'inner')
|
||||
->where("tgl_trf >=", $start)
|
||||
->where("tgl_trf <=", $end)
|
||||
->where('id_pembayaran', $metode)
|
||||
->group_by('detail_penjualan.no_trf')
|
||||
->distinct()
|
||||
->order_by('detail_penjualan.id', 'ASC')
|
||||
->get('detail_penjualan')->result();
|
||||
} else {
|
||||
return $this->db->join('penjualan', 'penjualan.id_dtlpen = detail_penjualan.id', 'left')
|
||||
->join('barang', 'barang.id_barang = penjualan.id_barang', 'left')
|
||||
->join('pembayaran', ' detail_penjualan.id_pembayaran = pembayaran.id_byr ', 'inner')
|
||||
->where("tgl_trf >=", $start)
|
||||
->where("tgl_trf <=", $end)
|
||||
->group_by('detail_penjualan.no_trf')
|
||||
->distinct()
|
||||
->order_by('detail_penjualan.id', 'ASC')
|
||||
->get('detail_penjualan')->result();
|
||||
}
|
||||
}
|
||||
|
||||
function hapus_trf($id)
|
||||
{
|
||||
$this->db->where('id', $id)->delete('detail_penjualan');
|
||||
}
|
||||
function hapus_id($id)
|
||||
{
|
||||
$this->db->where('id_dtlpen', $id)->delete('penjualan');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
class Model_barang extends CI_Model
|
||||
{
|
||||
|
||||
function tampil_data()
|
||||
{
|
||||
return
|
||||
$this->db->join('kategori', 'kategori.id_kategori = barang.id_kategori', 'left')
|
||||
->join('suplier','suplier.id_suplier = barang.id_suplier','left')
|
||||
->join('ukuran', 'ukuran.id_ukuran = barang.ukuran', 'left')
|
||||
->distinct()
|
||||
->get('barang');
|
||||
}
|
||||
|
||||
function tampilkan_ukuran()
|
||||
{
|
||||
return $this->db->get('ukuran');
|
||||
}
|
||||
|
||||
function tampil_dropdown()
|
||||
{
|
||||
return
|
||||
$this->db->select('id_barang, nama_barang')
|
||||
->from('barang')
|
||||
->get();
|
||||
}
|
||||
|
||||
function post($data)
|
||||
{
|
||||
$this->db->insert('barang', $data);
|
||||
}
|
||||
|
||||
function get_one($id)
|
||||
{
|
||||
$param = array('id_barang' => $id);
|
||||
return $this->db->get_where('barang', $param);
|
||||
}
|
||||
|
||||
function get_ones($id)
|
||||
{
|
||||
$param = array('nis' => $id);
|
||||
return $this->db->get_where('siswa', $param);
|
||||
}
|
||||
|
||||
function get_ones2($id)
|
||||
{
|
||||
$param = array('id_suplier' => $id);
|
||||
return $this->db->get_where('suplier', $param);
|
||||
}
|
||||
|
||||
function edit($data, $id)
|
||||
{
|
||||
$this->db->where('id_barang', $id);
|
||||
$this->db->update('barang', $data);
|
||||
}
|
||||
|
||||
function editsiswa($data, $id)
|
||||
{
|
||||
$this->db->where('nis', $id);
|
||||
$this->db->update('siswa', $data);
|
||||
}
|
||||
|
||||
function editsuplier($data, $id)
|
||||
{
|
||||
$this->db->where('id_suplier', $id);
|
||||
$this->db->update('suplier', $data);
|
||||
}
|
||||
|
||||
function hapus($id)
|
||||
{
|
||||
$this->db->where('id_barang', $id);
|
||||
$this->db->delete('barang');
|
||||
}
|
||||
|
||||
function hapussiswa($id)
|
||||
{
|
||||
$this->db->where('nis', $id);
|
||||
$this->db->delete('siswa');
|
||||
}
|
||||
|
||||
function hapussuplier($id)
|
||||
{
|
||||
$this->db->where('id_suplier', $id);
|
||||
$this->db->delete('suplier');
|
||||
}
|
||||
|
||||
function get_detail_modal($id)
|
||||
{
|
||||
return $this->db->where('id_barang', $id)
|
||||
->get('barang')
|
||||
->row();
|
||||
}
|
||||
|
||||
function get_detail_modal2($id)
|
||||
{
|
||||
return $this->db->where('id_suplier', $id)
|
||||
->get('suplier')
|
||||
->row();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
class Model_dashboard extends CI_Model
|
||||
{
|
||||
|
||||
public function total($table)
|
||||
{
|
||||
$query = $this->db->get($table)->num_rows();
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function total_penjualan()
|
||||
{
|
||||
return $this->db->select('sum(jumlah_stok) as total')
|
||||
->from('penjualan')->get()->row();
|
||||
}
|
||||
|
||||
public function total_stok()
|
||||
{
|
||||
return $this->db->select('sum(stok_barang) as total')
|
||||
->from('stok')->get()->row();
|
||||
}
|
||||
|
||||
public function graph_stok()
|
||||
{
|
||||
return $this->db->select('barang.nama_barang,sum(stok_barang) as total,barang.foto')
|
||||
->from('stok')->join('barang', 'barang.id_barang = stok.id_barang', 'left')
|
||||
->group_by('stok.id_barang')
|
||||
->get()
|
||||
->result();
|
||||
}
|
||||
|
||||
public function graph_kategori()
|
||||
{
|
||||
return $this->db->select('barang.nama_barang,sum(stok_barang) as total,kategori.nama_kategori')
|
||||
->from('stok')->join('barang', 'barang.id_barang = stok.id_barang', 'left')
|
||||
->join('kategori', 'kategori.id_kategori = barang.id_kategori', 'left')
|
||||
->group_by('kategori.nama_kategori')
|
||||
->get()
|
||||
->result();
|
||||
}
|
||||
|
||||
public function barang_laris()
|
||||
{
|
||||
return $this->db->select('barang.nama_barang,sum(jumlah_stok) as total,barang.foto,detail_penjualan.tgl_trf')
|
||||
->from('penjualan')
|
||||
->join('barang', 'barang.id_barang = penjualan.id_barang', 'left')
|
||||
->join('detail_penjualan', 'detail_penjualan.id = penjualan.id_dtlpen', 'left')
|
||||
->group_by('barang.nama_barang')
|
||||
->order_by('total', 'ASC')
|
||||
->where('month(detail_penjualan.tgl_trf) = month(CURRENT_date())')
|
||||
->limit('5')
|
||||
->get()->result();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
class Model_detail extends CI_Model
|
||||
{
|
||||
|
||||
function get_data() {
|
||||
return $this->db
|
||||
->select('*') // Menentukan kolom yang ingin dipilih, Anda dapat mengubahnya sesuai kebutuhan
|
||||
->from('penjualan')
|
||||
->join('detail_penjualan', 'penjualan.id_dtlpen = detail_penjualan.id', 'left') // Join ke detail_penjualan
|
||||
->join('barang', 'barang.id_barang = penjualan.id_barang', 'left') // Join ke tabel barang jika diperlukan
|
||||
->join('pembayaran', 'detail_penjualan.id_pembayaran = pembayaran.id_byr', 'inner') // Join ke tabel pembayaran
|
||||
->order_by('penjualan.id_transaksi', 'ASC')
|
||||
->get()
|
||||
->result();
|
||||
}
|
||||
|
||||
function get_metode()
|
||||
{
|
||||
return $this->db->get('pembayaran')->result();
|
||||
}
|
||||
|
||||
|
||||
function get_range($start, $end, $metode)
|
||||
{
|
||||
if ($metode != '') {
|
||||
return $this->db
|
||||
->select('*') // Pilih kolom yang diinginkan
|
||||
->from('penjualan')
|
||||
->join('detail_penjualan', 'penjualan.id_dtlpen = detail_penjualan.id', 'left')
|
||||
->join('barang', 'barang.id_barang = penjualan.id_barang', 'left')
|
||||
->join('pembayaran', 'detail_penjualan.id_pembayaran = pembayaran.id_byr', 'inner')
|
||||
->where("detail_penjualan.tgl_trf >=", $start) // Ubah penjualan.tgl_trf
|
||||
->where("detail_penjualan.tgl_trf <=", $end) // Ubah penjualan.tgl_trf
|
||||
->where('detail_penjualan.id_pembayaran', $metode) // Ubah detail_penjualan.id_pembayaran
|
||||
->distinct()
|
||||
->order_by('penjualan.id_transaksi', 'ASC')
|
||||
->get()
|
||||
->result();
|
||||
|
||||
} else {
|
||||
|
||||
return $this->db
|
||||
->select('*')
|
||||
->from('penjualan')
|
||||
->join('detail_penjualan', 'penjualan.id_dtlpen = detail_penjualan.id', 'left')
|
||||
->join('barang', 'barang.id_barang = penjualan.id_barang', 'left')
|
||||
->join('pembayaran', 'detail_penjualan.id_pembayaran = pembayaran.id_byr', 'inner')
|
||||
->where("detail_penjualan.tgl_trf >=", $start)
|
||||
->where("detail_penjualan.tgl_trf <=", $end)
|
||||
->distinct()
|
||||
->order_by('penjualan.id_transaksi', 'ASC')
|
||||
->get()
|
||||
->result();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function hapus_trf($id)
|
||||
{
|
||||
$this->db->where('id', $id)->delete('detail_penjualan');
|
||||
}
|
||||
function hapus_id($id)
|
||||
{
|
||||
$this->db->where('id_dtlpen', $id)->delete('penjualan');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
class Model_kategori extends CI_Model {
|
||||
|
||||
function tampilkan_data() {
|
||||
|
||||
return
|
||||
$this->db->get('kategori')->result();
|
||||
//$this->db->get('suplier')->result();
|
||||
}
|
||||
function post()
|
||||
{
|
||||
$data=array
|
||||
(
|
||||
'nama_kategori'=> $this->input->post('kategori')
|
||||
);
|
||||
$this->db->insert('kategori', $data);
|
||||
}
|
||||
|
||||
function tampilkan_data2() {
|
||||
|
||||
return
|
||||
$this->db->get('suplier')->result();
|
||||
}
|
||||
function post2()
|
||||
{
|
||||
$data=array
|
||||
(
|
||||
'nama_perusahaan'=> $this->input->post('suplier')
|
||||
);
|
||||
$this->db->insert('suplier', $data);
|
||||
}
|
||||
|
||||
function edit()
|
||||
{
|
||||
$data=array('nama_kategori'=> $this->input->post('kategori'));
|
||||
$this->db->where('id_kategori', $this->input->post('id'));
|
||||
$this->db->update('kategori',$data);
|
||||
}
|
||||
|
||||
function get_one($id)
|
||||
{
|
||||
$param = array('id_kategori'=>$id);
|
||||
return $this->db->get_where('kategori',$param);
|
||||
}
|
||||
|
||||
function hapus($id)
|
||||
{
|
||||
$this->db->where('id_kategori', $id);
|
||||
$this->db->delete('kategori');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
class Model_lapbulanan extends Ci_Model
|
||||
{
|
||||
|
||||
public function bulanan($thn)
|
||||
{
|
||||
return $this->db->select('tgl_trf,sum(grand_total) as gtotal')
|
||||
->from('detail_penjualan')
|
||||
->where('YEAR(tgl_trf)', $thn)
|
||||
->group_by('MONTH(tgl_trf)')
|
||||
->get()
|
||||
->result();
|
||||
}
|
||||
|
||||
public function income()
|
||||
{
|
||||
return $this->db->select('sum(grand_total) as gtotal')
|
||||
->from('detail_penjualan')
|
||||
->where('month(tgl_trf) = month(CURRENT_date())')
|
||||
->get()
|
||||
->row();
|
||||
}
|
||||
|
||||
public function total_penjualan()
|
||||
{
|
||||
return $this->db->select('sum(jumlah_stok) as total')
|
||||
->join('detail_penjualan', 'detail_penjualan.id = penjualan.id_dtlpen', 'left')
|
||||
->where('month(detail_penjualan.tgl_trf) = month(CURRENT_date())')
|
||||
->from('penjualan')->get()->row();
|
||||
}
|
||||
|
||||
public function total_transaksi()
|
||||
{
|
||||
return $this->db->select('count(id) as total')
|
||||
->where('month(tgl_trf) = month(CURRENT_date())')
|
||||
->from('detail_penjualan')->get()->row();
|
||||
}
|
||||
|
||||
public function total_barang()
|
||||
{
|
||||
return $this->db->select('sum(jumlah_stok) as total')
|
||||
->from('penjualan')->get()->row();
|
||||
}
|
||||
public function barang_laris()
|
||||
{
|
||||
$query = $this->db->select('barang.nama_barang,sum(jumlah_stok) as total,barang.foto,detail_penjualan.tgl_trf')
|
||||
->from('penjualan')
|
||||
->join('barang', 'barang.id_barang = penjualan.id_barang', 'left')
|
||||
->join('detail_penjualan', 'detail_penjualan.id = penjualan.id_dtlpen', 'left')
|
||||
->group_by('barang.nama_barang')
|
||||
->order_by('total', 'ASC')
|
||||
->where( 'month(detail_penjualan.tgl_trf) = month(CURRENT_date())')
|
||||
->limit('1')
|
||||
->get();
|
||||
if ($query->num_rows() > 0) {
|
||||
return $query->row();
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
class Model_lapharian extends Ci_Model
|
||||
{
|
||||
|
||||
public $prefs;
|
||||
public function __construct()
|
||||
{
|
||||
//parent::Model();
|
||||
$this->prefs = array(
|
||||
'start_day' => 'sunday',
|
||||
'month_type' => 'long',
|
||||
'day_type' => 'long',
|
||||
'show_next_prev' => TRUE,
|
||||
'next_prev_url' => base_url() . '/Lapharian/index/'
|
||||
);
|
||||
$this->prefs['template'] = '
|
||||
{table_open}
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="calender">{/table_open}
|
||||
|
||||
{heading_row_start}<tr>{/heading_row_start}
|
||||
|
||||
{heading_previous_cell}<th><a href="{previous_url}"><<</a></th>{/heading_previous_cell}
|
||||
{heading_title_cell}<th colspan="{colspan}">{heading}</th>{/heading_title_cell}
|
||||
{heading_next_cell}<th><a href="{next_url}">>></a></th>{/heading_next_cell}
|
||||
|
||||
{heading_row_end}</tr>{/heading_row_end}
|
||||
|
||||
{week_row_start}<tr>{/week_row_start}
|
||||
{week_day_cell}<td>{week_day}</td>{/week_day_cell}
|
||||
{week_row_end}</tr>{/week_row_end}
|
||||
|
||||
{cal_row_start}<tr class="days">{/cal_row_start}
|
||||
{cal_cell_start}<td>{/cal_cell_start}
|
||||
{cal_cell_start_today}<td>{/cal_cell_start_today}
|
||||
{cal_cell_start_other}<td class="other-month">{/cal_cell_start_other}
|
||||
|
||||
{cal_cell_content}
|
||||
<div class="day_num">{day}</div>
|
||||
<div class="content">{content}</div>
|
||||
{/cal_cell_content}
|
||||
{cal_cell_content_today}
|
||||
<div class="">
|
||||
<div class="day_num highlight">{day}</div>
|
||||
<div class="content">{content}</div>
|
||||
</div>
|
||||
{/cal_cell_content_today}
|
||||
|
||||
{cal_cell_no_content}{day}{/cal_cell_no_content}
|
||||
{cal_cell_no_content_today}<div class="day_num highlight">{day}</div>{/cal_cell_no_content_today}
|
||||
|
||||
{cal_cell_blank} {/cal_cell_blank}
|
||||
|
||||
{cal_cell_other}{day}{/cal_cel_other}
|
||||
|
||||
{cal_cell_end}</td>{/cal_cell_end}
|
||||
{cal_cell_end_today}</td>{/cal_cell_end_today}
|
||||
{cal_cell_end_other}</td>{/cal_cell_end_other}
|
||||
{cal_row_end}</tr>{/cal_row_end}
|
||||
|
||||
{table_close}</table>{/table_close}
|
||||
';
|
||||
}
|
||||
|
||||
public function income()
|
||||
{
|
||||
return $this->db->select('sum(grand_total) as gtotal')
|
||||
->from('detail_penjualan')
|
||||
->where('day(tgl_trf) = day(CURRENT_date())')
|
||||
->get()
|
||||
->row();
|
||||
}
|
||||
|
||||
public function total_penjualan()
|
||||
{
|
||||
return $this->db->select('sum(jumlah_stok) as total')
|
||||
->join('detail_penjualan', 'detail_penjualan.id = penjualan.id_dtlpen', 'left')
|
||||
->where('day(detail_penjualan.tgl_trf) = day(CURRENT_date())')
|
||||
->from('penjualan')->get()->row();
|
||||
}
|
||||
|
||||
public function total_transaksi()
|
||||
{
|
||||
return $this->db->select('count(id) as total')
|
||||
->where('day(tgl_trf) = day(CURRENT_date())')
|
||||
->from('detail_penjualan')->get()->row();
|
||||
}
|
||||
|
||||
public function total_barang()
|
||||
{
|
||||
return $this->db->select('sum(jumlah_stok) as total')
|
||||
->from('penjualan')->get()->row();
|
||||
}
|
||||
public function barang_laris()
|
||||
{
|
||||
$query = $this->db->select('barang.nama_barang,sum(jumlah_stok) as total,barang.foto,detail_penjualan.tgl_trf')
|
||||
->from('penjualan')
|
||||
->join('barang', 'barang.id_barang = penjualan.id_barang', 'left')
|
||||
->join('detail_penjualan', 'detail_penjualan.id = penjualan.id_dtlpen', 'left')
|
||||
->group_by('barang.nama_barang')
|
||||
->order_by('total', 'ASC')
|
||||
->where('day(detail_penjualan.tgl_trf) = day(CURRENT_date())')
|
||||
->limit('1')
|
||||
->get();
|
||||
if ($query->num_rows() > 0) {
|
||||
return $query->row();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function getcalender($year, $month)
|
||||
{
|
||||
$this->load->library('calendar', $this->prefs); // Load calender library
|
||||
$data = $this->get_calender_data($year, $month);
|
||||
return $this->calendar->generate($year, $month, $data);
|
||||
}
|
||||
|
||||
public function get_calender_data($year, $month)
|
||||
{
|
||||
$query = $this->db->select('tgl_trf,sum(grand_total) as gtotal')
|
||||
->from('detail_penjualan')
|
||||
->like('tgl_trf', "$year-$month", 'after')
|
||||
->group_by('tgl_trf')
|
||||
->get();
|
||||
//echo $this->db->last_query();exit;
|
||||
$cal_data = array();
|
||||
foreach ($query->result() as $row) {
|
||||
$calendar_date = date("Y-m-j", strtotime($row->tgl_trf)); // to remove leading zero from day format
|
||||
$cal_data[substr($calendar_date, 8, 2)] = 'Rp.' . number_format($row->gtotal);
|
||||
}
|
||||
|
||||
return $cal_data;
|
||||
}
|
||||
|
||||
public function add_calendar_data($data, $date)
|
||||
{
|
||||
$this->db->insert('calendar', array(
|
||||
'date' => $date,
|
||||
'content' => $data,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
class Model_operator extends CI_Model
|
||||
{
|
||||
|
||||
function login($username, $password)
|
||||
{
|
||||
$chek = $this->db->join('akses','akses.id_akses = operator.id_akses','left')
|
||||
->get_where('operator', array('username' => $username, 'password' => md5($password)));
|
||||
if ($chek->num_rows() > 0) {
|
||||
return $chek;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function ambil_foto($username, $password)
|
||||
{
|
||||
$chek = $this->db->get_where('operator', array('username' => $username, 'password' => md5($password)));
|
||||
if ($chek->num_rows() > 0) {
|
||||
return $chek->row();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getAkses()
|
||||
{
|
||||
return $this->db->get('akses')->result();
|
||||
}
|
||||
|
||||
function tampilkan_data()
|
||||
{
|
||||
return $this->db->join('akses', 'akses.id_akses = operator.id_akses', 'left')
|
||||
->get('operator');
|
||||
}
|
||||
|
||||
function get_one($id)
|
||||
{
|
||||
$param = array('id_operator' => $id);
|
||||
return $this->db->get_where('operator', $param);
|
||||
}
|
||||
|
||||
function edit($data)
|
||||
{
|
||||
$this->db->where('id_operator', $this->input->post('id'));
|
||||
$this->db->update('operator', $data);
|
||||
}
|
||||
|
||||
function hapus($id)
|
||||
{
|
||||
$this->db->where('id_opertaor', $id);
|
||||
$this->db->delete('operator');
|
||||
}
|
||||
|
||||
function get_detail_modal($id)
|
||||
{
|
||||
return $this->db->where('id_operator', $id)
|
||||
->get('operator')
|
||||
->row();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Model_penjualan extends Ci_Model
|
||||
{
|
||||
public $id = 'id_barang';
|
||||
|
||||
|
||||
function lihat_barang($id)
|
||||
{
|
||||
return $this->db->select('SUM(stok_barang) as jumlah')
|
||||
->join('barang', 'barang.id_barang = stok.id_barang')
|
||||
->where('stok.id_barang', $id)
|
||||
->get('stok');
|
||||
}
|
||||
|
||||
function hasilcari($key)
|
||||
{
|
||||
return $this->db->or_like('nama_barang', $key)
|
||||
->get('barang')
|
||||
->result();
|
||||
}
|
||||
|
||||
function stok_list()
|
||||
{
|
||||
return $this->db->join('barang', 'barang.id_barang = stok.id_barang', 'left')
|
||||
->join('ukuran', 'ukuran.id_ukuran = barang.ukuran', 'left')
|
||||
->get('stok')->num_rows();
|
||||
}
|
||||
|
||||
function halaman($number, $offset)
|
||||
{
|
||||
return $this->db->join('barang', 'barang.id_barang = stok.id_barang', 'left')
|
||||
->join('ukuran', 'ukuran.id_ukuran = barang.ukuran', 'left')
|
||||
->get('stok', $number, $offset)->result();
|
||||
}
|
||||
|
||||
function cart($id)
|
||||
{
|
||||
return $this->db->where('barang.id_barang', $id)
|
||||
->join('stok', 'stok.id_barang = barang.id_barang', 'left')
|
||||
->join('ukuran', 'ukuran.id_ukuran = barang.ukuran', 'left')
|
||||
->get('barang')
|
||||
->row();
|
||||
}
|
||||
|
||||
function tambah_trf($payment)
|
||||
{
|
||||
$this->db->insert('detail_penjualan', $payment);
|
||||
}
|
||||
|
||||
function get_byr($id)
|
||||
{
|
||||
return $this->db->where('id_byr', $id)->get('pembayaran')->row();
|
||||
}
|
||||
|
||||
function get_nourut()
|
||||
{
|
||||
return $this->db->select('max(id) as nomor')
|
||||
->from('detail_penjualan')->get()->result();
|
||||
}
|
||||
|
||||
function get_id($id)
|
||||
{
|
||||
return $this->db->select('id')->where('no_trf', $id)->get('detail_penjualan')->row_array();
|
||||
}
|
||||
|
||||
function tambah_pjl($penjualan)
|
||||
{
|
||||
$this->db->insert_batch('penjualan', $penjualan);
|
||||
}
|
||||
|
||||
function pengurangan_stok($pjl)
|
||||
{
|
||||
$this->db->update_batch('stok', $pjl, 'id_barang');
|
||||
}
|
||||
|
||||
function cek_transaksi($id)
|
||||
{
|
||||
return $this->db->join('penjualan', 'penjualan.id_dtlpen = detail_penjualan.id', 'left')
|
||||
->join('barang', 'barang.id_barang = penjualan.id_barang', 'left')
|
||||
->join('pembayaran', 'pembayaran.id_byr = detail_penjualan.id_pembayaran', 'inner')
|
||||
->join('bank', 'bank.id = detail_penjualan.id_bank', 'left')
|
||||
->where('detail_penjualan.id', $id)->get('detail_penjualan')->result();
|
||||
}
|
||||
|
||||
function get_detail_modal($id)
|
||||
{
|
||||
return $this->db->where('barang.id_barang', $id)
|
||||
->join('stok', 'stok.id_barang = barang.id_barang', 'left')
|
||||
->join('ukuran', 'ukuran.id_ukuran = barang.ukuran', 'left')
|
||||
->get('barang')
|
||||
->row();
|
||||
}
|
||||
|
||||
function total_barang($id)
|
||||
{
|
||||
return $this->db->select('sum(stok_barang) as total')
|
||||
->where('id_barang', $id)
|
||||
->get('stok');
|
||||
}
|
||||
|
||||
function tampilkan_data()
|
||||
{
|
||||
return
|
||||
$this->db->get('siswa')->result();
|
||||
}
|
||||
|
||||
|
||||
function filter_barang($kategori, $ukuran, $number, $offset)
|
||||
{
|
||||
if ($kategori != '' && $ukuran != '') {
|
||||
return $this->db->join('barang', 'barang.id_barang = stok.id_barang', 'left')
|
||||
->where('barang.ukuran', $ukuran)
|
||||
->where('barang.id_kategori', $kategori)
|
||||
->join('ukuran', 'ukuran.id_ukuran = barang.ukuran', 'left')
|
||||
->get('stok')->result();
|
||||
} else if ($kategori != '' && $ukuran == '') {
|
||||
return $this->db->join('barang', 'barang.id_barang = stok.id_barang', 'left')
|
||||
->where('barang.id_kategori', $kategori)
|
||||
->join('ukuran', 'ukuran.id_ukuran = barang.ukuran', 'left')
|
||||
->get('stok')->result();
|
||||
} else if ($kategori == '' & $ukuran != '') {
|
||||
return $this->db->join('barang', 'barang.id_barang = stok.id_barang', 'left')
|
||||
->where('barang.ukuran', $ukuran)
|
||||
->join('ukuran', 'ukuran.id_ukuran = barang.ukuran', 'left')
|
||||
->get('stok')->result();
|
||||
} else {
|
||||
return $this->db->join('barang', 'barang.id_barang = stok.id_barang', 'left')
|
||||
->join('ukuran', 'ukuran.id_ukuran = barang.ukuran', 'left')
|
||||
->get('stok', $number, $offset)->result();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
class Model_stok extends CI_Model{
|
||||
|
||||
function tampil_data()
|
||||
{
|
||||
return
|
||||
$this->db->join('barang','barang.id_barang = stok.id_barang','left')
|
||||
->join('suplier','suplier.id_suplier = barang.id_suplier','left')
|
||||
->join('kategori','kategori.id_kategori = barang.id_kategori','left')
|
||||
->get('stok')->result();
|
||||
}
|
||||
|
||||
function tampil_data2(){
|
||||
return $this->db->get('stok')->result();
|
||||
}
|
||||
|
||||
function post($data)
|
||||
{
|
||||
$this->db->insert('stok', $data);
|
||||
}
|
||||
|
||||
function get_one($id)
|
||||
{
|
||||
$param = array ('id_stok'=>$id);
|
||||
return $this->db->get_where('stok', $param);
|
||||
}
|
||||
|
||||
function edit($id,$data)
|
||||
{
|
||||
$this->db->where('id_stok', $id);
|
||||
$this->db->update('stok', $data);
|
||||
}
|
||||
|
||||
function tambah_stok($id,$data)
|
||||
{
|
||||
$this->db->where('id_barang', $id);
|
||||
$this->db->update('stok', $data);
|
||||
}
|
||||
|
||||
function hapus($id)
|
||||
{
|
||||
$this->db->where('id_stok', $id);
|
||||
$this->db->delete('stok');
|
||||
}
|
||||
|
||||
function get_stok($id){
|
||||
$param = array('id_barang' => $id);
|
||||
return $this->db->get_where('stok',$param)->row();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
class Model_kategori extends CI_Model {
|
||||
|
||||
function tampilkan_data() {
|
||||
|
||||
return
|
||||
$this->db->get('suplier')->result();
|
||||
}
|
||||
function post()
|
||||
{
|
||||
$data=array
|
||||
(
|
||||
'nama_perusahaan'=> $this->input->post('suplier')
|
||||
);
|
||||
$this->db->insert('suplier', $data);
|
||||
}
|
||||
|
||||
function edit()
|
||||
{
|
||||
$data=array('nama_kategori'=> $this->input->post('kategori'));
|
||||
$this->db->where('id_kategori', $this->input->post('id'));
|
||||
$this->db->update('kategori',$data);
|
||||
}
|
||||
|
||||
function get_one($id)
|
||||
{
|
||||
$param = array('id_kategori'=>$id);
|
||||
return $this->db->get_where('kategori',$param);
|
||||
}
|
||||
|
||||
function hapus($id)
|
||||
{
|
||||
$this->db->where('id_kategori', $id);
|
||||
$this->db->delete('kategori');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user