include "../Class/walkin.php"; include "../Class/transactionwalkin.php"; $customerid = $_POST['customerid']; $status = $_POST['status']; $downpayment = $_POST['downpayment']; $addonpayable = $_POST['addonpayable']; $payable = $_POST['payable']; $sql = "select * from tblwalkins where Customer_ID='{$customerid}'"; $result = mysqli_query($conn, $sql); $row = mysqli_fetch_assoc($result); $downpyment = $row['Downpayment']; $stat = $row['Status']; $total = $addonpayable + $payable - $downpayment; if ($status == "Pending") { echo "error"; } else { if ($stat == 'Reserve' || $stat == 'Check In' || $stat == 'Reserve/DownPayment') { if (Walkin::UpdateStatus($status, $downpyment, $customerid)) { $transaction = new TransactionWalkin($customerid, $total); if ($transaction->AddTransactionwalkin()) { echo "true"; } } } else { if (Walkin::UpdateStatus($status, $downpayment, $customerid)) { echo "true"; /*$updte="update tblreservation set Status='$status', Downpayment='$downpayment' where Confirmation='$confirmation'"; $result=mysqli_query($conn,$updte) or die(mysqli_error($conn)); */ } } }
$sum = 0; $sqli = "SELECT * FROM tblwalkins WHERE Customer_ID='{$customerid}'"; $resulti = mysqli_query($conn, $sqli); $row = mysqli_fetch_assoc($resulti); $addamount = $row['Addonpayable']; $sum = $addamount + $amount; $sql = "SELECT * FROM tbladdons WHERE item='{$item}'"; $result = mysqli_query($conn, $sql); $row1 = mysqli_fetch_assoc($result); $qty = $row1['quantity']; $total = $qty - $quantity; if ($quantity == 0) { echo 'quantity is required'; } else { if ($sum == 0) { echo 'Payable is required'; } else { $addon = Addon::UpdateQuantity($total, $item); $addingon = Walkin::UpdateAddonPayable($sum, $customerid); $reserveaddon = new AddonReserve($customerid, $item, $quantity, $price); if ($addingon) { if ($reserveaddon->AddonReserve()) { if ($addon) { echo "true"; } } } else { echo "error"; } } }
$Addonpayable = 0; $Downpayment = $_POST['downpayment']; $Amount = $_POST['amount']; if (empty($Roomid)) { echo 'Room Number is required'; } else { if (empty($FirstName)) { echo 'First Name is required'; } else { if (empty($LastName)) { echo 'Last Name is required'; } else { if (empty($Contact)) { echo 'Contact Number is required'; } else { if (empty($Arrival)) { echo 'Start Date is required'; } else { if (empty($Departure)) { echo 'End Date is required'; } else { $walkin = new Walkin($Roomid, $Categoryname, $FirstName, $LastName, $Contact, $fromdate, $todate, $Numberofdays, $Status, $Addonpayable, $Downpayment, $Amount); if ($walkin->AddWalkin()) { echo 'true'; } } } } } } }