<?php
$sql['get_count'] = "
   SELECT
      count(a.penyusutanId) AS total
   FROM
      penyusutan_ref a
      JOIN kelompok_barang_ref b ON a.penyusutanKelbrgId = b.kelbrgId
   WHERE
      b.kelbrgNama like '%s'
";

$sql['get_data_penyusutan'] = "
	SELECT
   	a.penyusutanId AS id_penyusutan,
   	a.penyusutanKelbrgId AS id_klpk_barang,
   	b.kelbrgNama AS nama_klpk_barang,
   	a.penyusutanJnsPenyusutan AS jns_penyusutan,
   	a.punyusutanBesarPenyusutan AS besar_penyusutan
	FROM
   	penyusutan_ref a
   	JOIN kelompok_barang_ref b ON a.penyusutanKelbrgId = b.kelbrgId
   WHERE  
      b.kelbrgNama like '%s'  
   ORDER BY b.kelbrgNama
   LIMIT %s,%s
";

$sql['get_data_by_id'] = "
   SELECT
      a.penyusutanId AS id_penyusutan,
      a.penyusutanKelbrgId AS id_klpk_barang,
      b.kelbrgNama AS nama_klpk_barang,
      a.penyusutanJnsPenyusutan AS jns_penyusutan,
      a.punyusutanBesarPenyusutan AS besar_penyusutan
   FROM
      penyusutan_ref a
      JOIN kelompok_barang_ref b ON a.penyusutanKelbrgId = b.kelbrgId  
   WHERE
      a.penyusutanId = '%s'
";

$sql['do_add'] = "
   INSERT INTO 
      penyusutan_ref 
      (penyusutanKelbrgId, penyusutanJnsPenyusutan, punyusutanBesarPenyusutan)
   VALUES 
      ('%s', '%s', '%s')
";

$sql['do_delete'] = "
   DELETE FROM 
      penyusutan_ref
   WHERE
      penyusutanId = '%s'
";  

$sql['do_update'] = "
   UPDATE 
      penyusutan_ref
   SET
      penyusutanKelbrgId = '%s',
      penyusutanJnsPenyusutan = '%s',
      punyusutanBesarPenyusutan = '%s'
    WHERE 
      penyusutanId = '%s'
";
?>