$totalDiscount = 0; } } else { $totalDiscount = 0; } $grandTotal = $currentTotal - $totalDiscount; } //check autoDispense???? if ($ro->selectNow("inventory", "autoDispense", "inventoryCode", $chargesCode) == "yes") { $currentQTY = $ro->selectNow("inventory", "quantity", "inventoryCode", $chargesCode); // current qty ng meds/sup sa inventory $newQTY = $currentQTY - $quantity; // less sa inventory as in qty after ibawas ung desired qty ng user $ro->editNow("inventory", "inventoryCode", $chargesCode, "quantity", $newQTY); // update qty sa database $ro->addCharges_cash_autoDispense($status, $registrationNo, $chargesCode, $description, $sellingPrice, $totalDiscount, $grandTotal, $grandTotal, 0, 0, $timeCharge, $dateCharge, $username, $service, $title, $paidVia, $cashPaid, $batchNo, $quantity, $inventoryFrom, $ro->getRegistrationDetails_branch(), $room, "dispensedBy_" . $username, $ro->getSynapseTime()); } else { $ro->addCharges_cash($status, $registrationNo, $chargesCode, $description, $sellingPrice, $totalDiscount, $grandTotal, $grandTotal, 0, 0, $timeCharge, $dateCharge, $username, $service, $title, $paidVia, $cashPaid, $batchNo, $quantity, $inventoryFrom, $ro->getRegistrationDetails_branch(), $room); } //ORIGINAL //$ro->addCharges_cash($status,$registrationNo,$chargesCode,$description,$sellingPrice,$totalDiscount,$grandTotal,$grandTotal,0,0,$timeCharge,$dateCharge,$username,$service,$title,$paidVia,$cashPaid,$batchNo,$quantity,$inventoryFrom,$ro->getRegistrationDetails_branch(),$room); } } } } } } } } } }