tambah fitur produk
This commit is contained in:
@@ -10,6 +10,22 @@ class AbsensiModel extends CI_Model
|
||||
return $absensi = $this->db->get($this->_table)->result();
|
||||
}
|
||||
|
||||
public function getAbsensiByAbsenIdAndUmkmId($id_umkm,$id_absen){
|
||||
$this->db->where('id_absen', $id_absen);
|
||||
$this->db->where('id_umkm', $id_umkm);
|
||||
return $absensi = $this->db->get($this->_table)->row();
|
||||
}
|
||||
|
||||
public function update($id_absensi){
|
||||
$post = $this->input->post();
|
||||
$this->aset = $post["aset"];
|
||||
$this->omset = $post["omset"];
|
||||
$this->karyawan_l = $post["karyawan_l"];
|
||||
$this->karyawan_p = $post["karyawan_p"];
|
||||
$this->signed = 1;
|
||||
return $this->db->update($this->_table, $this, array('id_absensi' => $id_absensi));
|
||||
}
|
||||
|
||||
public function getLastMonthAbsensi($bulan,$tahun){
|
||||
$bulan = $bulan-1;
|
||||
$this->db->where('bulan', $bulan);
|
||||
@@ -75,6 +91,7 @@ class AbsensiModel extends CI_Model
|
||||
public function getSignedAbsensiByUmkmId($id_umkm){
|
||||
$this->db->where('signed', true);
|
||||
$this->db->where('id_umkm', $id_umkm);
|
||||
$this->db->where('tahun', date('Y'));
|
||||
$this->db->order_by('bulan', 'DESC');
|
||||
$this->db->order_by('tahun', 'DESC');
|
||||
return $user = $this->db->get($this->_table)->result();
|
||||
|
||||
47
application/models/ProdukModel.php
Normal file
47
application/models/ProdukModel.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
class ProdukModel extends CI_Model
|
||||
{
|
||||
private $_table = "tb_produk";
|
||||
|
||||
public function save($id_umkm)
|
||||
{
|
||||
$post = $this->input->post();
|
||||
$this->id_umkm = $id_umkm;
|
||||
$this->produk = $post["produk"];
|
||||
$this->deskripsi = $post["deskripsi"];
|
||||
|
||||
$this->foto_produk = "default.png";
|
||||
return $this->db->insert($this->_table, $this);
|
||||
}
|
||||
|
||||
public function getProdukByUmkmId($id_umkm){
|
||||
$this->db->where('id_umkm', $id_umkm);
|
||||
$this->db->order_by('produk', 'DESC');
|
||||
return $produk = $this->db->get($this->_table)->result();
|
||||
}
|
||||
|
||||
public function getProdukById($id_produk){
|
||||
$this->db->where('id_produk', $id_produk);
|
||||
return $produk = $this->db->get($this->_table)->row();
|
||||
}
|
||||
|
||||
public function getLastProdukByIdUmkm($id_umkm){
|
||||
$this->db->where('id_umkm', $id_umkm);
|
||||
$this->db->order_by('id_produk', 'DESC');
|
||||
return $umkm = $this->db->get($this->_table)->row();
|
||||
}
|
||||
|
||||
public function setFirstImage($id_produk,$foto_produk)
|
||||
{
|
||||
$this->foto_produk = $foto_produk;
|
||||
return $this->db->update($this->_table, $this, array('id_produk' => $id_produk));
|
||||
}
|
||||
|
||||
public function delete($id_produk)
|
||||
{
|
||||
return $this->db->delete($this->_table, array("id_produk" => $id_produk));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -66,6 +66,7 @@ class UmkmModel extends CI_Model
|
||||
|
||||
public function getUmkmsByIdPemilik($id_pemilik){
|
||||
$this->db->join('tb_kategori','tb_kategori.id_kategori = tb_umkm.id_kategori');
|
||||
$this->db->join('tb_jenis','tb_jenis.id_jenis = tb_umkm.id_jenis');
|
||||
$this->db->where('id_pemilik', $id_pemilik);
|
||||
return $umkm = $this->db->get($this->_table)->result();
|
||||
}
|
||||
@@ -127,6 +128,20 @@ class UmkmModel extends CI_Model
|
||||
return $this->db->update($this->_table, $this, array('id_umkm' => $id_umkm));
|
||||
}
|
||||
|
||||
public function userUpdate($id_umkm,$foto_umkm)
|
||||
{
|
||||
$post = $this->input->post();
|
||||
$this->nama = $post["nama"];
|
||||
|
||||
|
||||
$this->id_jenis = $post["jenis"];
|
||||
|
||||
$this->telp = $post["telp"];
|
||||
$this->deskripsi = $post["deskripsi"];
|
||||
$this->foto_umkm = $foto_umkm;
|
||||
return $this->db->update($this->_table, $this, array('id_umkm' => $id_umkm));
|
||||
}
|
||||
|
||||
public function delete($id_umkm)
|
||||
{
|
||||
return $this->db->delete($this->_table, array("id_umkm" => $id_umkm));
|
||||
|
||||
Reference in New Issue
Block a user