Exemple #1
0
                                                     $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);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
if ($title == "MEDICINE" && $ro->selectNow("inventory", "quantity", "inventoryCode", $chargesCode) < $quantity) {
    $ro->getBack("Sorry, Not Enough Stock");
} else {
    if ($title == "SUPPLIES" && $ro->selectNow("inventory", "quantity", "inventoryCode", $chargesCode) < $quantity) {
        $ro->getBack("Sorry, Not Enough Stock");
    } else {
        $dateCharge = date("Y-m-d");
        $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_injectables($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(), $status2, $qty2, $registrationNo2, $chargesCode2, $description2, $sellingPrice2, $month2, $day2, $year2, $timeCharge2, $chargeBy2, $service2, $title2, $paidVia2, $cashPaid2, $batchNo2, $username2, $discount2, $inventoryFrom2, $room2, $paycash2, $remarks2);
        } else {
            if ($ro->getRegistrationDetails_company() != "" && $ro->selectNow("registrationDetails", "type", "registrationNo", $registrationNo) == "OPD") {
                //opd na meron company
                $ro->addCharges_cash_injectables($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, $status2, $qty2, $registrationNo2, $chargesCode2, $description2, $sellingPrice2, $month2, $day2, $year2, $timeCharge2, $chargeBy2, $service2, $title2, $paidVia2, $cashPaid2, $batchNo2, $username2, $discount2, $inventoryFrom2, $room2, $paycash2, $remarks2);
            } else {
                $ro->addCharges_cash_injectables($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, $status2, $qty2, $registrationNo2, $chargesCode2, $description2, $sellingPrice2, $month2, $day2, $year2, $timeCharge2, $chargeBy2, $service2, $title2, $paidVia2, $cashPaid2, $batchNo2, $username2, $discount2, $inventoryFrom2, $room2, $paycash2, $remarks2);
            }
        }
        //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);
    }
}