<?php
include "../../inc/inc.koneksi.php";
session_start();

$table		="jurnalum";

$kode		=$_POST['kode'];
$tanggal	=$_POST['tanggal'];
$nourut		=$_POST['nourut'];
$noakun 	=$_POST['noakun'];
$nobp   	=$_POST['nobp'];
$naakun 	=$_POST['naakun'];
$namabp 	=$_POST['namabp'];
$nofak  	=$_POST['nofak'];
$kodecab  	=$_POST['kodecab'];
$radiodk	=$_POST['radiodk'];
$ket    	=$_POST['ket'];
$debet		=$_POST['debet'];
$kredit		=$_POST['kredit'];
$user		=$_SESSION['namauser'];

$sql = mysql_query("SELECT * FROM $table WHERE kode_ju='$kode' AND no_urut='$nourut'");
$row= mysql_num_rows($sql);

if ($row>0){
	$input = "UPDATE $table SET tanggal='$tanggal',noakun='$noakun',nobp='$nobp',naakun='$naakun',namabp='$namabp',nofak='$nofak',kode_cab='$kodecab',kode_dk='$radiodk',keterangan='$ket',debet='$debet',kredit='$kredit' ,user='$user'
	WHERE kode_ju='$kode' AND no_urut='$nourut' ";
	mysql_query($input);
}
else{
	$input = "INSERT INTO $table (kode_ju,tanggal,no_urut,noakun,nobp,naakun,namabp,kode_cab,nofak,kode_dk,keterangan,debet,kredit,user,posting) VALUES('$kode','$tanggal','$nourut','$noakun','$nobp','$naakun','$namabp','$kodecab','$nofak','$radiodk','$ket','$debet','$kredit','$user','')";
	mysql_query($input);		
}
?>