<?php
include "../../inc/inc.koneksi.php";

mysql_query("UPDATE akun_bb SET mutasi_db=0,mutasi_kd=0 WHERE 1");
mysql_query("UPDATE akun_bp SET mutasi_db=0,mutasi_kd=0 WHERE 1");

$sql	= mysql_query("SELECT noakun,sum(debet) as jdebet,sum(kredit) as jkredit FROM rekapjur WHERE batal='' GROUP BY noakun");
$no	= 0;
while($r=mysql_fetch_array($sql)){
	$noakun 	= $r[noakun];
	$jdebet	= $r[jdebet];
	$jkredit	= $r[jkredit];	
	mysql_query("UPDATE akun_bb SET mutasi_db=$jdebet,mutasi_kd=$jkredit WHERE noakun='$noakun' ");	
	$no++;
}

$sql	= mysql_query("SELECT nobp,sum(debet) as jdebet,sum(kredit) as jkredit FROM rekapjur WHERE !(nobp='') AND !(nobp='-') AND batal='' GROUP BY nobp");
$no	= 0;
while($r=mysql_fetch_array($sql)){
	$noakun 	= $r[nobp];
	$jdebet	= $r[jdebet];
	$jkredit	= $r[jkredit];
	$no++;
	mysql_query("UPDATE akun_bp SET mutasi_db=$jdebet,mutasi_kd=$jkredit WHERE noakun='$noakun'");
}
echo "Seluruh rekap jurnal selesai diposting ulang.";
?>