$phic = $_POST['phic']; $remarks = $_POST['remarks']; $supplier = $_POST['supplier']; $criticalLevel = $_POST['criticalLevel']; $expiration = $_POST['expiration']; $username = $_POST['username']; $ro = new database3(); $ro->editNow("inventory", "inventoryCode", $inventoryCode, "description", $description); if ($ro->selectNow("inventory", "inventoryType", "inventoryCode", $inventoryCode) == "medicine") { $ro->editNow("inventory", "inventoryCode", $inventoryCode, "unitcost", $unitcost); $ro->editNow("inventory", "inventoryCode", $inventoryCode, "Added", $additional); } else { $ro->editNow("inventory", "inventoryCode", $inventoryCode, "unitcost", $additional); $ro->editNow("inventory", "inventoryCode", $inventoryCode, "suppliesUNITCOST", $unitcost); } //edit history $generic = ""; $inventoryType = "supplies"; $qty = $ro->selectNow("inventory", "quantity", "inventoryCode", $inventoryCode); $unitcost = $ro->selectNow("inventory", "suppliesUNITCOST", "inventoryCode", $inventoryCode); $opdPrice = $ro->selectNow("inventory", "unitcost", "inventoryCode", $inventoryCode); $ipdPrice = $ro->selectNow("inventory", "unitcost", "inventoryCode", $inventoryCode); $ro->editedInventory($stockCardNo, $inventoryCode, $description, $generic, $qty, $unitcost, $opdPrice, $ipdPrice, $inventoryType, date("H:i:s"), date("Y-m-d"), $username); $ro->editNow("inventory", "inventoryCode", $inventoryCode, "quantity", $quantity); $ro->editNow("inventory", "inventoryCode", $inventoryCode, "expiration", $expiration); $ro->editNow("inventory", "inventoryCode", $inventoryCode, "dateAdded", $dateAdded); $ro->editNow("inventory", "inventoryCode", $inventoryCode, "inventoryLocation", $inventoryLocation); $ro->editNow("inventory", "inventoryCode", $inventoryCode, "phic", $phic); $ro->editNow("inventory", "inventoryCode", $inventoryCode, "remarks", $remarks); $ro->editNow("inventory", "inventoryCode", $inventoryCode, "supplier", $supplier); $ro->editNow("inventory", "inventoryCode", $inventoryCode, "criticalLevel", $criticalLevel);
echo $quantity."<br>"; echo $unitcost."<br>"; echo $ipdPrice."<br>"; echo $opdPrice."<br>"; */ //edit history $beforeEdit_qty = $ro->selectNow("inventory", "quantity", "inventoryCode", $inventoryCode); $beforeEdit_unitcost = $ro->selectNow("inventory", "unitcost", "inventoryCode", $inventoryCode); $beforeEdit_opdPrice = $ro->selectNow("inventory", "opdPrice", "inventoryCode", $inventoryCode); $beforeEdit_ipdPrice = $ro->selectNow("inventory", "ipdPrice", "inventoryCode", $inventoryCode); $beforeEdit_dateAdded = $ro->selectNow("inventory", "dateAdded", "inventoryCode", $inventoryCode); $beforeEdit_timeAdded = $ro->selectNow("inventory", "timeAdded", "inventoryCode", $inventoryCode); $beforeEdit_username = $ro->selectNow("inventory", "addedBy", "inventoryCode", $inventoryCode); $stockCardNo = $ro->selectNow("inventory", "stockCardNo", "inventoryCode", $inventoryCode); $inventoryType = $ro->selectNow("inventory", "inventoryType", "inventoryCode", $inventoryCode); $ro->editedInventory($stockCardNo, $inventoryCode, $description, $generic, $beforeEdit_qty, $beforeEdit_unitcost, $beforeEdit_opdPrice, $beforeEdit_ipdPrice, $inventoryType, $beforeEdit_timeAdded, $beforeEdit_dateAdded, $beforeEdit_username); //inventory adjustment $currentQTY = $ro->selectNow("inventory", "quantity", "inventoryCode", $inventoryCode); $invoiceNo = $ro->selectNow("inventory", "invoiceNo", "inventoryCode", $inventoryCode); if ($currentQTY != $quantity) { $terms = $ro->selectNow("salesInvoice", "terms", "invoiceNo", $invoiceNo); $originalUnitCost = $ro->selectNow("inventory", "unitcost", "inventoryCode", $inventoryCode); $qtyDifference = $quantity - $currentQTY; $totalOfUnitCost = $unitcost * $qtyDifference; $lessVAT = $totalOfUnitCost / 1.12; $inputVAT = $lessVAT * 0.12; $accountPayables = $originalUnitCost * $qtyDifference; if ($terms != "") { if ($terms != "CASH" || $terms != "C.O.D" || $terms != "Retail") { $terms1 = "ACCOUNTS PAYABLE"; } else {