$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"; } } }
} } } else { $getaddonamount = abs($addamount - $addonamount); // addonpayable - previousamount; $gettotaladdonpayable = $getaddonamount + $amount; // addonpayable + currentamount; $totalamount = $payable - $addonamount + $amount; // reservationpayble-previouseamount + currentamount $transactionamount = $totalamount - abs($currentdownpayment); $total = $qty1 + $addonquantity; $total2 = abs($qty - $quantity); $addon = Addon::UpdateQuantity($total, $addonitem); $addon2 = Addon::UpdateQuantity($total2, $item); $updateaddon = Reservation::UpdateAddonPayable($gettotaladdonpayable, $currentdownpayment, $payable, $confirmation); $updateaddonreserve = AddonReserve::UpdateAddonReserve($item, $price, $quantity, $amount, $addonid); $transaction = transaction::UpdateBalance($transactionamount, $reservationid); if ($addon) { if ($addon2) { if ($updateaddon) { if ($updateaddonreserve) { if ($transaction) { echo "true"; } } } } } } } }