drop view if exists kinerja_pembelian_view;

--gopg:split
create view kinerja_pembelian_view as
select
    ib.berat,
    ib.karat + ib.karat1 + ib.karat2 as karat,
    jb.nama as nama_jenis,
    jb.kode as kode_jenis,
    tp.anggota_id,
    tp.tanggal_beli,
    tp.toko_id,
    tp.jenis_transaksi,
    tp.pembayaran
from
    transaksi_pembelians as tp
    left join inventory_barangs as ib on tp.inventory_barang_id = ib.id
    left join jenis_barangs as jb on ib.jenis_barang_id = jb.id
where
    tp.deleted_at is NULL
    and tp.deleted_by is NULL