Ejemplo n.º 1
0
def medListModifyPage():
    medList = []
    a = Iterator.Iterator
    a = adm.AccessDatabaseMedicines().getIterator()
    while a.hasNext():
        medList.append(a.next())
    return render_template('medicineListEdit.html', medList=medList)
Ejemplo n.º 2
0
    def createMedList(self):

        # medFromDatabase = [ "Saline01#Orsaline#Saline#1#50#01-07-2019#11A#/static/Images/orsaline.jpg",
        #                       "Util01#Bandages#Utilities#2#50#01-01-2020#12B#/static/Images/bandages.jpg"]
        medFromDatabase = []
        a = adm.AccessDatabaseMedicines().getIterator()
        while a.hasNext():
            medFromDatabase.append(a.next())

        for med in medFromDatabase:
            #print(med)
            medAttrs = med.split("#")
            medicine= Medicine.Builder().build_medID(medAttrs[0]) \
                .build_name(medAttrs[1]) \
                .build_type(medAttrs[2]) \
                .build_company(medAttrs[3]) \
                .build_price(medAttrs[4]) \
                .build_qty(medAttrs[5]) \
                .build_ExpDate(medAttrs[6]) \
                .build_shelf(medAttrs[7]) \
                .build_imgLink(medAttrs[8])\
                .build()

            self.medicines.append(medicine)

        return self.medicines


# m = MedicineCollector()
# l = m.createMedList()
# for li in l:
#  print(li)
Ejemplo n.º 3
0
    def createMedList(self):

        # medFromDatabase = [ "Saline01#Orsaline#Saline#1#50#01-07-2019#11A#/static/Images/orsaline.jpg",
        #                       "Util01#Bandages#Utilities#2#50#01-01-2020#12B#/static/Images/bandages.jpg"]
        medFromDatabase = []
        a = adm.AccessDatabaseMedicines().getIterator()
        while a.hasNext():
            medFromDatabase.append(a.next())

        m = []
        for med in medFromDatabase:
            medAttrs = med.split("#")
            # __init__(self,medID,name,type,qty,price,expDate,shelf,imgLink):
            medicine = Medicine(medAttrs[0],medAttrs[1],medAttrs[2],medAttrs[3],
                                medAttrs[4],medAttrs[5],medAttrs[6],medAttrs[7],medAttrs[8])
            m.append(medicine)

        #extra medicines for testing
        m.append(Medicine("Zim01", "Zimax", "Antibiotic","Beximco Pharma Limited", "0", "20", "01-01-2020", "31E", "/static/Images/napa.jpg"))
        m.append(Medicine("Ant01", "Antacid", "Antacid","Square Pharma Limited", "10", "20", "01-01-2018", "23A", "/static/Images/ace.jpg"))
        m.append(Medicine("Omid01", "Omidon", "Dompiridon","Square Pharma Limited", "0", "20", "01-01-2018", "22C", "/static/Images/napa.jpg"))

        medicines = []
        for mi in m:
            medicines.append(mi)

        return medicines
Ejemplo n.º 4
0
def resultsPage():
    Statics.searchResult = ""
    a = Iterator.Iterator
    a = adm.AccessDatabaseMedicines().getIterator()
    searchResults = a.search(Statics.searchKey)
    print(searchResults)
    return render_template('searchResults.html', searchResults=searchResults)
Ejemplo n.º 5
0
    def createMedList(self):

        # medFromDatabase = [ "Saline01#Orsaline#Saline#1#50#01-07-2019#11A#/static/Images/orsaline.jpg",
        #                       "Util01#Bandages#Utilities#2#50#01-01-2020#12B#/static/Images/bandages.jpg"]
        medFromDatabase = []
        a = adm.AccessDatabaseMedicines().getIterator()
        while a.hasNext():
            medFromDatabase.append(a.next())

        m = []
        for med in medFromDatabase:
            medAttrs = med.split("#")
            # __init__(self,medID,name,type,qty,price,expDate,shelf,imgLink):
            medicine = Medicine(medAttrs[0], medAttrs[1], medAttrs[2],
                                medAttrs[3], medAttrs[5], medAttrs[4],
                                medAttrs[6], medAttrs[7], medAttrs[8])
            m.append(medicine)

        #extra medicines for testing

        medicines = []
        for mi in m:
            medicines.append(mi)

        return medicines
Ejemplo n.º 6
0
def makeReceiptPage():
    medNames = []
    a = Iterator.Iterator
    a = adm.AccessDatabaseMedicines().getIterator()
    while a.hasNext():
        medNames.append(a.next())
    usr = Statics.currentUser
    return render_template('makeReceipt.html', medNames=medNames, usr=usr)
Ejemplo n.º 7
0
def medicinesPage():
    medList = []
    a = Iterator.Iterator
    a = adm.AccessDatabaseMedicines().getIterator()
    while a.hasNext():
        medList.append(a.next())
    #print(medList[medList.__len__()-1])
    return render_template('medicines.html', medList=medList)
Ejemplo n.º 8
0
def medChange():
    medicineChangeInfo = ""
    changeRequest = request.get_json(force=True)
    a = Iterator.Iterator
    a = adm.AccessDatabaseMedicines().getIterator()
    for i in changeRequest:
        medicineChangeInfo += str(i['change'])
    opF = OperationFactory.OperationFactory().getOperation(medicineChangeInfo)
    opF.doOperation(Statics.medicineOperation)
    return 'OK'
Ejemplo n.º 9
0
 def generateExpiredNotification(medID, medName, medShelf, notiID=0):
     new_noti = Notification(notiID=notiID,
                             type="Expired",
                             medName=medName,
                             medID=medID,
                             medShelf=medShelf,
                             status="unread")
     from Classes.DatabaseAccessors import AccessDatabaseMedicines as adm
     a = adm.AccessDatabaseMedicines().getIterator()
     a.remove(medID)
     return new_noti
Ejemplo n.º 10
0
        def sellMedicinceByID(self, medID, qty):

            b = Iterator.Iterator
            b = adm.AccessDatabaseMedicines().getIterator()

            b.update(medID, "quantity", qty)
            # qty te updated medicine quantity for that medID ase. kichu minus kora lagbe na
            """Update that medicine's quantity in database
            if it becomes zero, create newEmptyNotification
            notify unreadManager, NotificationTableManager"""

            newQty = qty
            if newQty == 0:
                self._newNoti = self.notiGenerator.generateEmptyNotification(
                    medID=medID, medName="x", medShelf="y", notiID=0)
                self.notifyAllObserver()
            pass
Ejemplo n.º 11
0
def submitReceipt():
    if request.method == "POST":
        temp = request.form["mydata"]

        y = temp.split("*")
        print("here")
        print(y)
        a = Iterator.Iterator
        a = ads.AccessDatabaseSellings().getIterator()
        b = Iterator.Iterator
        b = adm.AccessDatabaseMedicines().getIterator()
        # a.update(medID, attribute, newValue)

        print(y)
        for i in y:
            a.add(i)
            #searching med id
            x = i.split("#")
            for j in Statics.medList:
                mlist = j.split("#")
                if (x[2] == mlist[1]):
                    MedId = int(mlist[0])
                    Avail = int(mlist[5])
                    newVal = Avail - int(x[4])
                    #newListValue=str(mlist[0])+"#"+str(mlist[1])+"#"+str(mlist[2])+"#"+str(mlist[3])+"#"+str(mlist[4])+"#"+str(newVal)+"#"+str(mlist[6])+"#"+str(mlist[7])+"#"+str(mlist[8])
                    #Statics.medList[MedId]=newListValue
                    ##print("aaaa")
                    #print(Statics.medList[MedId])
                    #print(Statics.medList)
                    #print(MedId)
                    break
            #updating
            #moon er function call dibo
            mdepo = MedicineDEPO()
            mdepo.sellMedicinceByID(MedId, newVal)

            #b.update(MedId,"quantity",newVal)

            print("After fetching\n")
            print(Statics.medList)
Ejemplo n.º 12
0
def medChange():
    temp = ""
    changeRequest = request.get_json(force=True)
    a = Iterator.Iterator
    a = adm.AccessDatabaseMedicines().getIterator()
    for i in changeRequest:
        temp += str(i['change'])
    temp2 = temp.split("#")
    if temp2[0] == "add":
        print(temp2)
        temp3 = ""
        for i in temp2:
            if i != "add":
                temp3 += i + "#"
        if temp2.__len__() < 10:
            temp3 += "/static/Images/generic.png"
        Statics.medNames.append(temp3)
        a.add(temp3)
    elif temp2[0] == "remove":
        a.remove(temp2[1])
    elif temp2[0] == "change":
        print(temp2)
        a.update(temp2[1], temp2[2], temp2[3])
Ejemplo n.º 13
0
 def doOperation(self, msg):
     a = Iterator.Iterator
     a = adm.AccessDatabaseMedicines().getIterator()
     a.remove(msg)
Ejemplo n.º 14
0
 def removeMedicineByID(self, medID):
     from Classes.DatabaseAccessors import AccessDatabaseMedicines as adm
     a = adm.AccessDatabaseMedicines().getIterator()
     a.remove(medID)
     print("removed")
Ejemplo n.º 15
0
 def doOperation(self, msg):
     a = Iterator.Iterator
     a = adm.AccessDatabaseMedicines().getIterator()
     toSend = msg.split("#")
     print(toSend)
     a.update(int(toSend[0]), toSend[1], toSend[2])