<?php   
   $sql['get_data_inventarisasi_tanah'] ="
		SELECT 
		   SQL_CALC_FOUND_ROWS invPeruntukanTnhId AS idTanah,
		   invPeruntukanTnhInvDetId AS invdet,
		   b.invDetMstLabel AS nama_aset,
		   invPeruntukanTnhKode AS kodeinv,
		   peruntukanTanahNama AS peruntukan,
		   invPeruntukanTnhLuas AS luas,
		   statusAsetNama AS penggunaan,
		   CONCAT(
			  invDetKodeBarang,
			  '.',
			  invPeruntukanTnhKode
		   ) AS kode,
		   invPeruntukanTnhAlamat AS alamat,
		   invPeruntukanTnhPj AS unitnama,
		   invPeruntukanTnhKeterangan AS keterangan,
		   invPeruntukanTnhNoSertipikat AS sertipikat 
		FROM
		   inventarisasi_mst a 
		   LEFT JOIN inventarisasi_detail b 
			  ON a.invMstId = b.invDetMstId 
		   LEFT JOIN barang_ref c 
			  ON a.invBarangId = barangId 
		   JOIN sub_kelompok_barang_ref i 
			  ON barangSubkelbrgId = subkelbrgId 
		   JOIN kelompok_barang_ref j 
			  ON subkelbrgKelbrgId = kelbrgId 
		   JOIN bidang_barang_ref k 
			  ON kelbrgBidangbrgId = bidangbrgId 
		   JOIN golongan_barang_ref l 
			  ON bidangbrgGolbrgId = golbrgId 
		   JOIN inv_peruntukan_tanah 
			  ON invPeruntukanTnhInvDetId = invDetId 
		   JOIN peruntukan_tanah_ref 
			  ON invPeruntukanTnhPrtknTnhId = peruntukanTanahId 
		   JOIN aset_ref_aset_status 
			  ON statusAsetId = invPeruntukanTnhStatusAsetId 
		WHERE (l.golbrgKibKode = 'a') 
		   AND (
			  invPeruntukanTnhNoSertipikat LIKE '%s' 
			  OR invPeruntukanTnhPj LIKE '%s'
		   ) 
		   AND YEAR(b.invDetTglPembelian) = '%s' 
		ORDER BY invPeruntukanTnhId DESC 
		LIMIT %s, %s
		
   ";
   
   $sql['get_data_inventarisasi_tanah_count'] = "
		SELECT FOUND_ROWS() AS total
	";
   
   $sql['get_inventarisasi_tanah_by_id'] ="
		SELECT 
		   invPeruntukanTnhInvDetId AS invdet,
		   b.invDetMstLabel AS nama_aset,
		   invPeruntukanTnhKode AS kodeinv,
		   invPeruntukanTnhPrtknTnhId AS peruntukan,
		   invPeruntukanTnhPanjang AS panjang,
		   invPeruntukanTnhLebar AS lebar,
		   invPeruntukanTnhLuas AS luas,
		   invPeruntukanTnhStatusAsetId AS penggunaan,
		   invPeruntukanTnhKeterangan AS keterangan,
		   invDetKodeBarang AS kode,
		   a.invLuasTanah AS luasHidden,
		   invPeruntukanTnhAlamat AS alamat,
		   invPeruntukanTnhKodePemerintah AS kodepemerintah,
		   invPeruntukanTnhPj AS unitnama 
		FROM
		   inventarisasi_mst a 
		   LEFT JOIN inventarisasi_detail b 
			  ON a.invMstId = b.invDetMstId 
		   LEFT JOIN barang_ref c 
			  ON a.invBarangId = barangId 
		   JOIN sub_kelompok_barang_ref i 
			  ON barangSubkelbrgId = subkelbrgId 
		   JOIN kelompok_barang_ref j 
			  ON subkelbrgKelbrgId = kelbrgId 
		   JOIN bidang_barang_ref k 
			  ON kelbrgBidangbrgId = bidangbrgId 
		   JOIN golongan_barang_ref l 
			  ON bidangbrgGolbrgId = golbrgId 
		   JOIN inv_peruntukan_tanah 
			  ON invPeruntukanTnhInvDetId = invDetId 
		WHERE (l.golbrgKibKode = 'a') 
		   AND invPeruntukanTnhId = '%s' 
		LIMIT 1 
   ";
?>
