$price = preg_split("/\\//", $sellingPrice); $currentTotal = $quantity * $price[0]; } else { $currentTotal = $quantity * $sellingPrice; } $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 { if ($ro->getRegistrationDetails_company() != "" && $ro->selectNow("registrationDetails", "type", "registrationNo", $registrationNo) == "OPD") { //opd na meron company $ro->addCharges_cash($status, $registrationNo, $chargesCode, $description, $sellingPrice, $totalDiscount, $grandTotal, 0, 0, $grandTotal, $timeCharge, $dateCharge, $username, $service, $title, $paidVia, $cashPaid, $batchNo, $quantity, $inventoryFrom, $ro->getRegistrationDetails_branch(), $room, $remarks, $docSpecialization, "", $stockCardNo, "", ""); } 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, $remarks, $docSpecialization, "", $stockCardNo, "", ""); } } //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); } } } } }