<?php 
    session_start();
    include '../koneksi.php';
    include '../cari_notrans.php';

    $tnoperk     = $_POST['tnoperk'];
    $takunt      = $_POST['takunt'];
    $tket        = $_POST['tket'];
    $toleh       = $_POST['toleh'];
    $tpokok      = $_POST['tjumlah'];
    $tjenis      = $_POST['jenis'];

    $tket = addslashes($tket);
    $takunt = addslashes($takunt);
    
    $tr        = 'KK';
    $td        = '01';
    $ttgl      = $_POST['ttgl'];
    $tkdc      = $_POST['tkdc'];

    $jam    = date('d-m-Y  H:i:s'); //kombinasi jam dan tanggal

    $nol=0;
    $no='';

	$nominal = str_replace("Rp.", "", $tpokok);
	$nominal = str_replace(".", "", $nominal);
	$nominal = str_replace(",", "", $nominal);

    ///////////             MENYIMPAN KE TABEL KAS
    $query = mysqli_query($mysqli, "INSERT INTO kas (tanggal,notrans,unit,kdc,keterangan,tr,td,jumlah,keluar,noperk,oleh,jam) 
                                    VALUES('$ttgl','$kode3','$tjenis','$tkdc','$tket','$tr','$td','$nominal','$nominal','$takunt','$toleh',(now()) )")
                                    or die('Ada kesalahan pada query insert : '.mysqli_error($mysqli));
    ///////////             MENYIMPAN KE TABEL JOR DEBET
    $query = mysqli_query($mysqli, "INSERT INTO jor (tanggal,notrans,unit,kdc,keterangan,tr,td,debet,noperk) 
                                    VALUES('$ttgl','$kode3','$tjenis','$tkdc','$tket','$tr','$td','$nominal','$takunt' )")
                                    or die('Ada kesalahan pada query insert : '.mysqli_error($mysqli));
    ///////////             MENYIMPAN KE TABEL JOR DEBET
    $query = mysqli_query($mysqli, "INSERT INTO jor (tanggal,notrans,unit,kdc,keterangan,tr,td,kredit,noperk) 
                                    VALUES('$ttgl','$kode3','$tjenis','$tkdc','$tket','$tr','$td','$nominal','$tnoperk' )")
                                    or die('Ada kesalahan pada query insert : '.mysqli_error($mysqli));                                    
    header("location:!!_kas_akunt_trans.php");
