예제 #1
0
def addFirm(request):
    root = request.GET.get('root')
    root2 = request.POST.get('root2')
    if root is None:
        root = root2
    if request.method == 'GET':
        return render(request, 'addFirm.html', {'root': root})
    else:
        Firmcode = request.POST.get('Firmcode')
        Firmname = request.POST.get('Firmname')
        Firmregion = request.POST.get('Firmregion')
        Firmadress = request.POST.get('Firmadress')
        Firmlat = request.POST.get('Firmlat')
        Firmlng = request.POST.get('Firmlng')
        Firmphone = request.POST.get('Firmphone')
        Wcode = request.POST.get('Wcode')
        sql = 'insert into firm values(%s,%s,%s,%s,%s,%s,%s,%s);'
        sqlUse.modify(sql, [
            Firmcode,
            Firmname,
            Firmregion,
            Firmadress,
            Firmlat,
            Firmlng,
            Firmphone,
            Wcode,
        ])
        sql = 'select * from firm;'
        firm_list = sqlUse.get_list(sql, [])
        return render(request, 'showFirm.html', {
            'firm_list': firm_list,
            'root': root
        })
예제 #2
0
def addPharmacist(request):
    root = request.GET.get('root')
    root2 = request.POST.get('root2')
    if root is None:
        root = root2
    if request.method == 'GET':
        return render(request, 'addPharmacist.html', {'root': root})
    else:
        Phcode = request.POST.get('Phcode')
        Phname = request.POST.get('Phname')
        Phsex = request.POST.get('Phsex')
        Phage = request.POST.get('Phage')
        Phtitle = request.POST.get('Phtitle')
        Shopcode = request.POST.get('Shopcode')
        Phphone = request.POST.get('Phphone')
        Phcor = request.POST.get('Phcor')
        sql = 'insert into pharmacist values(%s,%s,%s,%s,%s,%s,%s,%s);'
        sqlUse.modify(sql, [
            Phcode,
            Phname,
            Phsex,
            Phage,
            Phtitle,
            Shopcode,
            Phphone,
            Phcor,
        ])
        sql = 'select * from pharmacist;'
        pharmacist_list = sqlUse.get_list(sql, [])
        return render(request, 'showPharmacist.html', {
            'pharmacist_list': pharmacist_list,
            'root': root
        })
예제 #3
0
def addWorker(request):
    root = request.GET.get('root')
    root2 = request.POST.get('root2')
    if root is None:
        root = root2
    if request.method == 'GET':
        return render(request, 'addWorker.html', {'root': root})
    else:
        Wcode = request.POST.get('Wcode')
        Wname = request.POST.get('Wname')
        Wsex = request.POST.get('Wsex')
        Wage = request.POST.get('Wage')
        Wposition = request.POST.get('Wposition')
        Wphone = request.POST.get('Wphone')
        sql = 'insert into worker values(%s,%s,%s,%s,%s,%s);'
        sqlUse.modify(sql, [
            Wcode,
            Wname,
            Wsex,
            Wage,
            Wposition,
            Wphone,
        ])
        sql = 'select * from worker;'
        worker_list = sqlUse.get_list(sql, [])
        return render(request, 'showWorker.html', {
            'worker_list': worker_list,
            'root': root
        })
예제 #4
0
def create(request):
    if request.method == 'GET':
        return render(request, 'create.html')
    else:
        username = request.POST.get('username')
        password = request.POST.get('password')
        exist_user = '******'
        succeed = '创建成功!'
        root = request.POST.get('root')
        root1 = request.POST.get('root2')
        repeat_result = sqlUse.get_one(
            'select username from userList where username = %s', [
                username,
            ])
        if repeat_result is None:
            sqlUse.modify('insert into userList values(%s,%s,%s)', [
                username,
                password,
                root,
            ])
            return render(request, 'index.html', {
                'succeed': succeed,
                'root': root1
            })
        else:
            return render(request, 'create.html', {'exist_user': exist_user})
예제 #5
0
def editMedicine(request):
    root = request.GET.get('root')
    root2 = request.POST.get('root2')
    if root is None:
        root = root2
    if request.method == 'GET':
        sql1 = 'SELECT * FROM medicine INNER JOIN belong on medicine.Mname = belong.Mname AND medicine.Mlot = belong.Mlot AND medicine.Firmcode = belong.Firmcode;'
        sql2 = 'SELECT * FROM medicine INNER JOIN belong on medicine.Mname = belong.Mname AND medicine.Mlot = belong.Mlot AND medicine.Firmcode = belong.Firmcode where belong.Mname=%s and belong.Mlot=%s and belong.Firmcode=%s and belong.Belongcode=%s;'
        Mname = request.GET.get('Mname')
        Mlot = request.GET.get('Mlot')
        Belongcode = request.GET.get('Belongcode')
        Firmcode = request.GET.get('Firmcode')
        current_medicine = sqlUse.get_one(sql2, [Mname, Mlot, Firmcode, Belongcode, ])
        medicine_list = sqlUse.get_list(sql1, [])
        return render(request, 'editMedicine.html', {'medicine_list': medicine_list, 'current_medicine': current_medicine, 'root': root})
    else:
        Mname = request.POST.get('Mname')
        Mlot = request.POST.get('Mlot')
        Firmcode = request.POST.get('Firmcode')
        Mmoney = request.POST.get('Mmoney')
        Mcount = request.POST.get('Mcount')
        Cdate = request.POST.get('Cdate')
        Sdate = request.POST.get('Sdate')
        Belongcode = request.POST.get('Belongcode')
        Belongnum = request.POST.get('Belongnum')
        sql = 'update medicine set Mname=%s, Mlot=%s, Firmcode=%s, Mmoney=%s, Mcount=%s, Cdate=%s, Sdate=%s ' \
              'where Mname=%s and Mlot=%s and Firmcode=%s; '
        sqlUse.modify(sql, [Mname, Mlot, Firmcode, Mmoney, Mcount, Cdate, Sdate, Mname, Mlot, Firmcode, ])
        sql = 'update belong set Mname=%s, Mlot=%s, Firmcode=%s, Belongcode=%s, Belongnum=%s where Mname=%s and Mlot=%s and Firmcode=%s and Belongcode=%s;'
        sqlUse.modify(sql, [Mname, Mlot, Firmcode, Belongcode, Belongnum, Mname, Mlot, Firmcode, Belongcode, ])
        sql = 'SELECT * FROM medicine INNER JOIN belong on medicine.Mname = belong.Mname AND medicine.Mlot = belong.Mlot AND medicine.Firmcode = belong.Firmcode;'
        medicine_list = sqlUse.get_list(sql, [])
        return render(request, 'showMedicine.html', {'medicine_list': medicine_list, 'root': root})
예제 #6
0
def editShop(request):
    root = request.GET.get('root')
    root2 = request.POST.get('root2')
    if root is None:
        root = root2
    if request.method == 'GET':
        sql1 = 'select * from shop'
        sql2 = 'select * from shop where Shopcode=%s'
        Shopcode = request.GET.get('Shopcode')
        current_shop = sqlUse.get_one(sql2, [
            Shopcode,
        ])
        shop_list = sqlUse.get_list(sql1, [])
        return render(request, 'editShop.html', {
            'shop_list': shop_list,
            'current_shop': current_shop,
            'root': root
        })
    else:
        Shopcode = request.POST.get('Shopcode')
        Shopname = request.POST.get('Shopname')
        Shoptype = request.POST.get('Shoptype')
        Shopregion = request.POST.get('Shopregion')
        Shopadress = request.POST.get('Shopadress')
        Shoparea = request.POST.get('Shoparea')
        Shoplat = request.POST.get('Shoplat')
        Shoplng = request.POST.get('Shoplng')
        Doarea = request.POST.get('Doarea')
        Housearea = request.POST.get('Housearea')
        Shopphone = request.POST.get('Shopphone')
        Wcode = request.POST.get('Wcode')
        sql = 'update shop set Shopcode=%s, Shopname=%s, Shoptype=%s, Shopregion=%s, Shopadress=%s, shoparea=%s, shoplat=%s, shoplng=%s, Doarea=%s, Housearea=%s, Shopphone=%s, Wcode=%s where Shopcode=%s ;'
        sqlUse.modify(sql, [
            Shopcode,
            Shopname,
            Shoptype,
            Shopregion,
            Shopadress,
            Shoparea,
            Shoplat,
            Shoplng,
            Doarea,
            Housearea,
            Shopphone,
            Wcode,
            Shopcode,
        ])
        sql = 'select * from shop;'
        shop_list = sqlUse.get_list(sql, [])
        return render(request, 'showShop.html', {
            'shop_list': shop_list,
            'root': root
        })
예제 #7
0
def deleteShop(request):
    root = request.GET.get('root')
    Shopcode = request.GET.get('Shopcode')
    sql = 'delete from shop where Shopcode=%s'
    sqlUse.modify(sql, [
        Shopcode,
    ])
    sql = 'select * from shop;'
    shop_list = sqlUse.get_list(sql, [])
    return render(request, 'showShop.html', {
        'shop_list': shop_list,
        'root': root
    })
예제 #8
0
def deleteFirm(request):
    root = request.GET.get('root')
    Firmcode = request.GET.get('Firmcode')
    sql = 'delete from firm where Firmcode=%s'
    sqlUse.modify(sql, [
        Firmcode,
    ])
    sql = 'select * from firm;'
    firm_list = sqlUse.get_list(sql, [])
    return render(request, 'showFirm.html', {
        'firm_list': firm_list,
        'root': root
    })
예제 #9
0
def deletePharmacist(request):
    root = request.GET.get('root')
    Phcode = request.GET.get('Phcode')
    sql = 'delete from pharmacist where Phcode=%s'
    sqlUse.modify(sql, [
        Phcode,
    ])
    sql = 'select * from pharmacist;'
    pharmacist_list = sqlUse.get_list(sql, [])
    return render(request, 'showPharmacist.html', {
        'pharmacist_list': pharmacist_list,
        'root': root
    })
예제 #10
0
def deleteWorker(request):
    root = request.GET.get('root')
    Wcode = request.GET.get('Wcode')
    sql = 'delete from worker where Wcode=%s'
    sqlUse.modify(sql, [
        Wcode,
    ])
    sql = 'select * from worker;'
    worker_list = sqlUse.get_list(sql, [])
    return render(request, 'showWorker.html', {
        'worker_list': worker_list,
        'root': root
    })
예제 #11
0
def deleteMedicine(request):
    root = request.GET.get('root')
    Mname = request.GET.get('Mname')
    Mlot = request.GET.get('Mlot')
    Belongcode = request.GET.get('Belongcode')
    Firmcode = request.GET.get('Firmcode')
    sql = 'delete from medicine where Mname=%s and Mlot=%s and Firmcode=%s;'
    sqlUse.modify(sql, [Mname, Mlot, Firmcode, ])
    sql = 'delete from belong where Mname=%s and Mlot=%s and Firmcode=%s and Belongcode=%s;'
    sqlUse.modify(sql, [Mname, Mlot, Firmcode, Belongcode, ])
    sql = 'SELECT * FROM medicine INNER JOIN belong on medicine.Mname = belong.Mname AND medicine.Mlot = belong.Mlot AND medicine.Firmcode = belong.Firmcode;'
    medicine_list = sqlUse.get_list(sql, [])
    return render(request, 'showMedicine.html', {'medicine_list': medicine_list, 'root': root})
예제 #12
0
def editFirm(request):
    root = request.GET.get('root')
    root2 = request.POST.get('root2')
    if root is None:
        root = root2
    if request.method == 'GET':
        sql1 = 'select * from firm'
        sql2 = 'select * from firm where Firmcode=%s'
        Firmcode = request.GET.get('Firmcode')
        current_firm = sqlUse.get_one(sql2, [
            Firmcode,
        ])
        firm_list = sqlUse.get_list(sql1, [])
        return render(request, 'editFirm.html', {
            'firm_list': firm_list,
            'current_firm': current_firm,
            'root': root
        })
    else:
        Firmcode = request.POST.get('Firmcode')
        Firmname = request.POST.get('Firmname')
        Firmregion = request.POST.get('Firmregion')
        Firmadress = request.POST.get('Firmadress')
        Firmlat = request.POST.get('Firmlat')
        Firmlng = request.POST.get('Firmlng')
        Firmphone = request.POST.get('Firmphone')
        Wcode = request.POST.get('Wcode')
        sql = 'update firm set Firmcode=%s, Firmname=%s, Firmregion=%s, Firmadress=%s, Firmlat=%s, Firmlng=%s, Firmphone=%s, Wcode=%s where Firmcode=%s ;'
        sqlUse.modify(sql, [
            Firmcode,
            Firmname,
            Firmregion,
            Firmadress,
            Firmlat,
            Firmlng,
            Firmphone,
            Wcode,
            Firmcode,
        ])
        sql = 'select * from firm;'
        firm_list = sqlUse.get_list(sql, [])
        return render(request, 'showFirm.html', {
            'firm_list': firm_list,
            'root': root
        })
예제 #13
0
def editWorker(request):
    root = request.GET.get('root')
    root2 = request.POST.get('root2')
    if root is None:
        root = root2
    if request.method == 'GET':
        sql1 = 'select * from worker'
        sql2 = 'select * from worker where Wcode=%s'
        Wcode = request.GET.get('Wcode')
        current_worker = sqlUse.get_one(sql2, [
            Wcode,
        ])
        worker_list = sqlUse.get_list(sql1, [])
        return render(
            request, 'editWorker.html', {
                'worker_list': worker_list,
                'current_worker': current_worker,
                'root': root
            })
    else:
        Wcode = request.POST.get('Wcode')
        Wname = request.POST.get('Wname')
        Wsex = request.POST.get('Wsex')
        Wage = request.POST.get('Wage')
        Wposition = request.POST.get('Wposition')
        Wphone = request.POST.get('Wphone')
        sql = 'update worker set Wcode=%s, Wname=%s, Wsex=%s, Wage=%s, Wposition=%s, Wphone=%s where Wcode=%s ;'
        sqlUse.modify(sql, [
            Wcode,
            Wname,
            Wsex,
            Wage,
            Wposition,
            Wphone,
            Wcode,
        ])
        sql = 'select * from worker;'
        worker_list = sqlUse.get_list(sql, [])
        return render(request, 'showWorker.html', {
            'worker_list': worker_list,
            'root': root
        })
예제 #14
0
def addShop(request):
    root = request.GET.get('root')
    root2 = request.POST.get('root2')
    if root is None:
        root = root2
    if request.method == 'GET':
        return render(request, 'addShop.html', {'root': root})
    else:
        Shopcode = request.POST.get('Shopcode')
        Shopname = request.POST.get('Shopname')
        Shoptype = request.POST.get('Shoptype')
        Shopregion = request.POST.get('Shopregion')
        Shopadress = request.POST.get('Shopadress')
        Shoparea = request.POST.get('Shoparea')
        Shoplat = request.POST.get('Shoplat')
        Shoplng = request.POST.get('Shoplng')
        Doarea = request.POST.get('Doarea')
        Housearea = request.POST.get('Housearea')
        Shopphone = request.POST.get('Shopphone')
        Wcode = request.POST.get('Wcode')
        sql = 'insert into shop values(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);'
        sqlUse.modify(sql, [
            Shopcode,
            Shopname,
            Shoptype,
            Shopregion,
            Shopadress,
            Shoparea,
            Shoplat,
            Shoplng,
            Doarea,
            Housearea,
            Shopphone,
            Wcode,
        ])
        sql = 'select * from shop;'
        shop_list = sqlUse.get_list(sql, [])
        return render(request, 'showShop.html', {
            'shop_list': shop_list,
            'root': root
        })
예제 #15
0
def editPharmacist(request):
    root = request.GET.get('root')
    root2 = request.POST.get('root2')
    if root is None:
        root = root2
    if request.method == 'GET':
        sql1 = 'select * from pharmacist'
        sql2 = 'select * from pharmacist where Phcode=%s'
        Phcode = request.GET.get('Phcode')
        current_pharmacist = sqlUse.get_one(sql2, [
            Phcode,
        ])
        pharmacist_list = sqlUse.get_list(sql1, [])
        return render(
            request, 'editPharmacist.html', {
                'pharmacist_list': pharmacist_list,
                'current_pharmacist': current_pharmacist,
                'root': root
            })
    else:
        Phcode = request.POST.get('Phcode')
        Phname = request.POST.get('Phname')
        Phsex = request.POST.get('Phsex')
        Phage = request.POST.get('Phage')
        Phtitle = request.POST.get('Phtitle')
        Shopcode = request.POST.get('Shopcode')
        Phphone = request.POST.get('Phphone')
        Phcor = request.POST.get('Phcor')
        sql = 'update pharmacist set Phcode=%s, Phname=%s, Phsex=%s, Phage=%s, Phtitle=%s, Shopcode=%s, Phphone=%s, Phcor=%s where Phcode=%s ;'
        sqlUse.modify(sql, [
            Phcode, Phname, Phsex, Phage, Phtitle, Shopcode, Phphone, Phcor,
            Phcode
        ])
        sql = 'select * from pharmacist;'
        pharmacist_list = sqlUse.get_list(sql, [])
        return render(request, 'showPharmacist.html', {
            'pharmacist_list': pharmacist_list,
            'root': root
        })
예제 #16
0
def addMedicine(request):
    root = request.GET.get('root')
    root2 = request.POST.get('root2')
    if root is None:
        root = root2
    if request.method == 'GET':
        return render(request, 'addMedicine.html', {'root': root})
    else:
        Mname = request.POST.get('Mname')
        Mlot = request.POST.get('Mlot')
        Firmcode = request.POST.get('Firmcode')
        Mmoney = request.POST.get('Mmoney')
        Mcount = request.POST.get('Mcount')
        Cdate = request.POST.get('Cdate')
        Sdate = request.POST.get('Sdate')
        Belongcode = request.POST.get('Belongcode')
        Belongnum = request.POST.get('Belongnum')
        sql = 'insert into medicine values(%s,%s,%s,%s,%s,%s,%s);'
        sqlUse.modify(sql, [Mname, Mlot, Firmcode, Mmoney, Mcount, Cdate, Sdate, ])
        sql = 'insert into belong values(%s, %s, %s, %s, %s);'
        sqlUse.modify(sql, [Mname, Mlot, Firmcode, Belongcode, Belongnum, ])
        sql = 'SELECT * FROM medicine INNER JOIN belong on medicine.Mname = belong.Mname AND medicine.Mlot = belong.Mlot AND medicine.Firmcode = belong.Firmcode;'
        medicine_list = sqlUse.get_list(sql, [])
        return render(request, 'showMedicine.html', {'medicine_list': medicine_list, 'root': root})