Example #1
0
 def test_set(self):
     from datetime import date
     date.set(2001, 1, 2)
     compare(date.today(), d(2001, 1, 2))
     date.set(2002, 1, 1)
     compare(date.today(), d(2002, 1, 1))
     compare(date.today(), d(2002, 1, 3))
    def reset():
        date.set(datetime.time("%d/%m/%Y"))
        PaidTax.set("")
        SubTotal.set("")
        Totalcost.set("")
        Costotorta.set("")
        Costodrink.set("")
        Serviciocargo.set("")
        txtrecibido.delete("1.0", END)

        txtMango.configure(state=DISABLED)
        txtpiña.configure(state=DISABLED)
        txtfresa.configure(state=DISABLED)
        txtpapaya.configure(state=DISABLED)
        txtplatano.configure(state=DISABLED)
        txtkiwi.configure(state=DISABLED)
        txtsurtido.configure(state=DISABLED)
        txtespecial.configure(state=DISABLED)
        txtchoco.configure(state=DISABLED)
        txtpie.configure(state=DISABLED)
        txthamb.configure(state=DISABLED)
        txtsand.configure(state=DISABLED)
        txtbolog.configure(state=DISABLED)
        txtpiña.configure(state=DISABLED)
        txtfruta.configure(state=DISABLED)
        txtfruta.configure(state=DISABLED)
        txtmenu.configure(state=DISABLED)

        var1.set(0)
        var2.set(0)
        var3.set(0)
        var4.set(0)
        var5.set(0)
        var6.set(0)
        var7.set(0)
        var8.set(0)
        var9.set(0)
        var10.set(0)
        var11.set(0)
        var12.set(0)

        E_Mango.set("0")
        E_piña.set("0")
        E_fresa.set("0")
        E_papaya.set("0")
        E_platano.set("0")
        E_kiwi.set("0")
        E_surtido.set("0")
        E_especial.set("0")
        E_choco.set("0")
        E_pie.set("0")
        E_hamb.set("0")
        E_sand.set("0")
        E_bolog.set("0")
        E_piñas.set("0")
        E_fruta.set("0")
        E_menu.set("0")
Example #3
0
    def test_isinstance_default(self):
        from datetime import date
        to_check = []
        to_check.append(date(1999, 1, 1))
        to_check.append(date.today())
        date.set(2001, 1, 2)
        to_check.append(date.today())
        date.add(2001, 1, 3)
        to_check.append(date.today())
        to_check.append(date.today())
        date.set(date(2001, 1, 4))
        to_check.append(date.today())
        date.add(date(2001, 1, 5))
        to_check.append(date.today())
        to_check.append(date.today())
        date.set(d(2001, 1, 4))
        to_check.append(date.today())
        date.add(d(2001, 1, 5))
        to_check.append(date.today())
        to_check.append(date.today())

        for inst in to_check:
            self.failIf(isinstance(inst, date), inst)
            self.failIf(inst.__class__ is date, inst)
            self.failUnless(isinstance(inst, d), inst)
            self.failUnless(inst.__class__ is d, inst)
Example #4
0
 def test_set_kw(self):
     from datetime import date
     date.set(year=2001, month=1, day=2)
     compare(date.today(), d(2001, 1, 2))
Example #5
0
 def test_set_date_supplied(self):
     from datetime import date
     date.set(d(2001, 1, 2))
     compare(date.today(), d(2001, 1, 2))
     date.set(date(2001, 1, 3))
     compare(date.today(), d(2001, 1, 3))
Example #6
0
def pat_reg():
    global no, date, pid, name, gender, age, phone, address, disease, sod, rtype, building, rno, rtype3, price
    f3 = Frame(window, borderwidth=5, bg="white")
    f3.grid(row=5, column=0)
    f3.place(x=400, y=100)
    t = Label(f3, text="\n\n\n\n", bg="white").grid()
    l11 = Label(f3, text="Registration ID", bg="white", font=20).grid(row=6,
                                                                      column=0)
    t = Label(f3, text="\n", bg="white").grid()
    l12 = Label(f3, text="No.", bg="white", font=20).grid(row=8, column=0)
    no = StringVar()
    mycursor.execute(
        "SELECT rid_no FROM patient_reg ORDER BY rid_no DESC LIMIT 1")
    myresult = mycursor.fetchone()
    if myresult is None:
        a = 0
    else:
        for row in myresult:
            a = row
    a += 1
    no.set(a)

    no1 = Entry(f3, textvariable=no).grid(row=8, column=3)
    l12 = Label(f3, text="Date", bg="white", font=20).grid(row=10, column=0)
    date = StringVar()
    date.set(today)
    date2 = Entry(f3, textvariable=date).grid(row=10, column=3)
    #lt = Label(f3, text="", bg="blue").grid()
    l13 = Label(f3, text="Patient's Information", bg="white",
                font=20).grid(row=15, column=0)
    lt = Label(f3, text="\n", bg="white").grid()
    l14 = Label(f3, text="PID", bg="white", font=20).grid(row=24, column=0)
    pid = StringVar()
    mycursor.execute(
        "SELECT pid FROM patient_reg where date_reg='{}' ORDER BY pid DESC LIMIT 1"
        .format(str(today)))
    myresult = mycursor.fetchone()
    if myresult is None:
        b = 0
    else:
        for i in myresult:
            b = i
    b += 1
    pid.set(b)
    pid1 = Entry(f3, textvariable=pid).grid(row=24, column=3)

    l12 = Label(f3, text="Name", bg="white", font=20).grid(row=28, column=0)
    name = StringVar()
    name1 = Entry(f3, textvariable=name).grid(row=28, column=3)

    l15 = Label(f3, text="Gender", bg="white", font=20).grid(row=32, column=0)
    gender = StringVar()
    gender1 = Entry(f3, textvariable=gender).grid(row=32, column=3)

    l16 = Label(f3, text="Age", bg="white", font=20).grid(row=36, column=0)
    age = StringVar()
    age1 = Entry(f3, textvariable=age).grid(row=36, column=3)

    l17 = Label(f3, text="Phone", bg="white", font=20).grid(row=40, column=0)
    phone = StringVar()
    phone1 = Entry(f3, textvariable=phone).grid(row=40, column=3)

    l18 = Label(f3, text="Address", bg="white", font=20).grid(row=44, column=0)
    address = StringVar()
    address1 = Entry(f3, textvariable=address).grid(row=44, column=3, ipady=20)

    l19 = Label(f3, text="Disease", bg="white", font=20).grid(row=48, column=0)
    disease = StringVar()
    disease1 = Entry(f3, textvariable=disease).grid(row=48, column=3)
    l20 = Label(f3, text="Status Of Disease", bg="white",
                font=20).grid(row=52, column=0)
    sod = StringVar()
    sod1 = Entry(f3, textvariable=sod).grid(row=52, column=3)
    t = Label(f3, text="\n\n\n\n", bg="white").grid(row=0, column=14)
    t = Label(f3, text="\t\t\t\t\t\t\t", bg="white").grid(row=0, column=14)
    l21 = Label(f3, text="Room Type", bg="white", font=20).grid(row=6,
                                                                column=14)
    rtype = StringVar()
    rtype1 = Radiobutton(f3,
                         text="Normal",
                         variable=rtype,
                         value="Normal",
                         bg="white",
                         font=20).grid(row=8, column=14)
    rtype2 = Radiobutton(f3,
                         text="Medium",
                         variable=rtype,
                         value="Medium",
                         bg="white",
                         font=20).grid(row=9, column=14)
    rtype4 = Radiobutton(f3,
                         text="VIP     ",
                         variable=rtype,
                         value="VIP",
                         justify=LEFT,
                         bg="white",
                         font=20).grid(row=10, column=14)
    # t = Label(f3, text="\n\n\n\n", bg="blue").grid(row=0, column=16)
    l22 = Label(f3, text="Room's Information", bg="white",
                font=20).grid(row=6, column=16)
    l23 = Label(f3, text="Building", bg="white", font=20).grid(row=8,
                                                               column=16)
    building = StringVar()
    building1 = Entry(f3, textvariable=building).grid(row=8, column=18)
    l24 = Label(f3, text="Room No.", bg="white", font=20).grid(row=9,
                                                               column=16)
    rno = StringVar()
    rno1 = Entry(f3, textvariable=rno).grid(row=9, column=18)
    l25 = Label(f3, text="Room Type", bg="white", font=20).grid(row=10,
                                                                column=16)
    rtype3 = StringVar()
    rtype12 = Entry(f3, textvariable=rtype3).grid(row=10, column=18)
    l26 = Label(f3, text="Price", bg="white", font=20).grid(row=11, column=16)
    price = StringVar()
    price1 = Entry(f3, textvariable=price).grid(row=11, column=18)
    b3 = Button(f3, text=" Add ", font=20, bg="blue",
                command=added).grid(row=14, column=16)
    b3 = Button(f3, text="Close", font=20, bg="blue",
                command=close).grid(row=14, column=18)
Example #7
0
def writeXml(earliest, latest, mainreader, namelist, filename):
	root = et.Element("dailydata")
	root.set('version', '1.0')
	comment = et.Comment("Generated for COMP3001 by netdatacruncher.py -zhilim")
	root.append(comment)
	print "writing to xml.."
	next = earliest
	while next <= latest:
		print "writing data for ", str(next)
		date = et.SubElement(root, "date")
		date.set('name', str(next))
		gain = getBikeGain(iter(mainreader), next)
		loss = getBikeLoss(iter(mainreader), next)
		netdict = getNetMovement(loss, gain)
		netkeys = iter(netdict)
		hasnext = True
		while hasnext:

			try:
				nextkey = netkeys.next()
				#print "writing next station's data"
				stationId = et.SubElement(date, "stationId")
				stationId.set('name', nextkey)

				stationNm = et.SubElement(stationId, "stationNm")
				stationNm.text = namelist[nextkey]

				net = et.SubElement(stationId, "net")
				net.text = str(netdict[nextkey])

				bikeloss = et.SubElement(stationId, "bikeloss")
				bikegain = et.SubElement(stationId, "bikegain")

				if nextkey in loss:
					bikeloss.text = str(loss[nextkey])
				else:
					bikeloss.text = "0"

				if nextkey in gain and nextkey in loss:
					bikegain.text = str(netdict[nextkey] + loss[nextkey])
				if nextkey in gain and nextkey not in loss:
					bikegain.text = str(netdict[nextkey])
				elif nextkey not in gain:
					bikegain.text = "0"

			except StopIteration:
				hasnext = False
		next = next + timedelta(days=1)	
	print "end of csv, prettifying.."
	#print et.tostring(root)
	try:			
		tree = prettify(root)
		with open(filename, "w") as f:
			f.write(tree)


	except UnicodeDecodeError:
		with open("C:/Python27/Scripts/log.txt", "a") as log:
			log.write("Unicode Decode Error with file: ".join(filename))
		print "error occurred."
		
	print "writing to:", filename