You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.6 KiB
PHP
62 lines
1.6 KiB
PHP
<?php
|
|
session_start();
|
|
if($_SESSION['validUser'] !== TRUE)
|
|
{
|
|
header("location: ./index.php");
|
|
exit();
|
|
}
|
|
?>
|
|
<?php
|
|
include "./db_login.inc.php";
|
|
include "./func_lib.php";
|
|
|
|
$id = $_REQUEST['idTemp'];
|
|
$kodebarang = $_REQUEST['kodebarang'];
|
|
$barcode = strtoupper($_REQUEST['barcode']);
|
|
$nama = strtoupper($_REQUEST['nama']);
|
|
$jmlbeli = $_REQUEST['jmlbeli'];
|
|
$subtotal = $_REQUEST['subtotal'];
|
|
$hpbaru = convHrgP($_REQUEST['hpbaru']);
|
|
$hp = $_REQUEST['hpbaru'];
|
|
$hjbaru = $_REQUEST['hjbaru'];
|
|
$bathi = ($hjbaru-$hp)/$hp*100;
|
|
$disc = $_REQUEST['disc'];
|
|
$discrp = $_REQUEST['discrp'];
|
|
$ppn = $_REQUEST['ppn'];
|
|
$profit = number_format($bathi,2,'.',',');
|
|
$expdate = decTgl($_REQUEST['expdate']);
|
|
$pemakai = $_SESSION["useracc"];
|
|
|
|
$harray = array();
|
|
$mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE);
|
|
if (!empty($kodebarang) AND !empty($nama) AND !empty($jmlbeli) AND !empty($subtotal))
|
|
{
|
|
$dtUpdate = $mysqli->prepare("UPDATE `tPembelian$pemakai` SET
|
|
`kode_barang` = '$kodebarang',
|
|
`barcode` = '$barcode',
|
|
`nm_brg` = '$nama',
|
|
`jumlah` = '$jmlbeli',
|
|
`subtotal` = '$subtotal',
|
|
`disc` = '$disc',
|
|
`discrp` = '$discrp',
|
|
`profit` = '$profit',
|
|
`ppn` = '$ppn',
|
|
`harga_pokok` = '$hpbaru',
|
|
`harga_jual` = '$hjbaru',
|
|
`exp` = '$expdate'
|
|
WHERE id = '$id'");
|
|
$dtUpdate->execute();
|
|
if($dtUpdate->affected_rows > 0) {
|
|
$harray[0] = 1;
|
|
$dtUpdate->close();
|
|
} else {
|
|
$harray[0] = 0;
|
|
}
|
|
$mysqli->close();
|
|
}else{
|
|
$harray[0] = 2;
|
|
}
|
|
echo json_encode($harray);
|
|
|
|
?>
|
|
|