     tanggal date NOT NULL,
     no_anggota character varying(20) NOT NULL,
     jumlah integer NOT NULL,
-    keterangan character varying(50) NOT NULL
+    keterangan character varying(50)
 );
 
 --

    LANGUAGE plpgsql
    AS $$                   
begin
    if(new.kode_simpanan like 'SPSKRL') then
    update anggota 
    set total_simpanan = total_simpanan + new.jumlah
    where no_anggota = new.no_anggota;
    update anggota
    set total_simpanan_sukarela = total_simpanan_sukarela + new.jumlah
    where no_anggota = new.no_anggota;
    
    elsif(new.kode_simpanan like 'SPWJB') then
    update anggota 
    set total_simpanan = total_simpanan + new.jumlah
    where no_anggota = new.no_anggota;
    update anggota
    set total_simpanan_sukarela = total_simpanan_sukarela + new.jumlah
    where no_anggota = new.no_anggota;
    
    elsif(new.kode_simpanan like 'AMSP') then
    update anggota 
    set total_simpanan = total_simpanan - new.jumlah
    where no_anggota = new.no_anggota;
    update anggota
    set total_simpanan_sukarela = total_simpanan_sukarela - new.jumlah
    where no_anggota = new.no_anggota;
    end if;
    return new; 
end;
$$;


    denda integer NOT NULL,
    bunga double precision NOT NULL,
    kode_barang character(10),
    keterangan character varying(50)
);

--
