Beispiel #1
0
def setMemos(adate, memos):
    '''
    updates the aday table with memos
    useage is setMemos(pydate, ((4, "NW not working"),(5, "BW is")))
    '''
    print "setting memos", memos
    db = connect()
    cursor = db.cursor()
    query = '''insert into aday (memo, adate, apptix, start, end)
    values (%s,%s, %s, %s, %s)
    on duplicate key update memo=%s'''

    start = localsettings.pyTimetoWystime(localsettings.earliestStart)
    end = localsettings.pyTimetoWystime(localsettings.latestFinish)
    for apptix, memo in memos:
        values = (memo, adate, apptix, start, end, memo)
        cursor.execute(query, values)
    cursor.close()
Beispiel #2
0
def setMemos(adate, memos):
    '''
    updates the aday table with memos
    useage is setMemos(pydate, ((4, "NW not working"),(5, "BW is")))
    '''
    print "setting memos", memos
    db = connect()
    cursor = db.cursor()
    query = '''insert into aday (memo, adate, apptix, start, end)
    values (%s,%s, %s, %s, %s)
    on duplicate key update memo=%s'''

    start = localsettings.pyTimetoWystime(localsettings.earliestStart)
    end = localsettings.pyTimetoWystime(localsettings.latestFinish)
    for apptix, memo in memos:
        values = (memo, adate, apptix, start, end, memo)
        cursor.execute(query, values)
    cursor.close()
Beispiel #3
0
def block_appt(bldate, apptix, start, end, bl_start, bl_end, reason):
    '''
    put a block in the book, with text set as reason
    '''
    #- 1st check the block is free
    slots = future_slots(bldate, bldate, (apptix,))

    date_time = datetime.datetime.combine(bldate, start)

    block_length = (localsettings.pyTimeToMinutesPastMidnight(end) -
        localsettings.pyTimeToMinutesPastMidnight(start))

    this_slot = FreeSlot(date_time, apptix, block_length)
    #-- check block still available!!
    found = False
    for slot in slots:
        if slot == this_slot:
            found = True
            break
    if not found:
        return False

    db = connect()
    cursor = db.cursor()
    query = '''INSERT INTO aslot (adate, apptix, start, end, name, serialno,
    code0, code1, code2, note, flag0, flag1, flag2, flag3)
    VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)'''

    values = (bldate, apptix, localsettings.pyTimetoWystime(bl_start),
    localsettings.pyTimetoWystime(bl_end), reason, 0, "", "", "", "",
    -128, 0, 0, 0)

    if cursor.execute(query, values):
        #-- insert call.. so this will always be true unless we have key
        #-- value errors?
        db.commit()
        result = True
    else:
        print "couldn't insert into aslot %s %s %s" % (
            bldate, apptix, start)
        result = False
    cursor.close()
    # db.close()
    return result
Beispiel #4
0
def block_appt(bldate, apptix, start, end, bl_start, bl_end, reason):
    '''
    put a block in the book, with text set as reason
    '''
    #- 1st check the block is free
    slots = future_slots(bldate, bldate, (apptix, ))

    date_time = datetime.datetime.combine(bldate, start)

    block_length = (localsettings.pyTimeToMinutesPastMidnight(end) -
                    localsettings.pyTimeToMinutesPastMidnight(start))

    this_slot = FreeSlot(date_time, apptix, block_length)
    #-- check block still available!!
    found = False
    for slot in slots:
        if slot == this_slot:
            found = True
            break
    if not found:
        return False

    db = connect()
    cursor = db.cursor()
    query = '''INSERT INTO aslot (adate, apptix, start, end, name, serialno,
    code0, code1, code2, note, flag0, flag1, flag2, flag3)
    VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)'''

    values = (bldate, apptix, localsettings.pyTimetoWystime(bl_start),
              localsettings.pyTimetoWystime(bl_end), reason, 0, "", "", "", "",
              -128, 0, 0, 0)

    if cursor.execute(query, values):
        #-- insert call.. so this will always be true unless we have key
        #-- value errors?
        db.commit()
        result = True
    else:
        print "couldn't insert into aslot %s %s %s" % (bldate, apptix, start)
        result = False
    cursor.close()
    # db.close()
    return result
Beispiel #5
0
def fill_appt(bldate, apptix, start, end, bl_start, bl_end, reason, pt):
    '''
    this is the procedure called when making an appointment via clicking on a
    free slot in a DAY view.
    '''
    #- 1st check the block is free
    slots = future_slots(bldate, bldate, (apptix,))

    date_time = datetime.datetime.combine(bldate, start)

    block_length = (localsettings.pyTimeToMinutesPastMidnight(end) -
        localsettings.pyTimeToMinutesPastMidnight(start))

    this_slot = FreeSlot(date_time, apptix, block_length)

    #-- check block still available!!
    found = False
    for slot in slots:
        if slot == this_slot:
            found = True
            break
    if not found:
        return False

    name = "%s %s *" % (pt.fname, pt.sname)
    try:
        cset = ord(pt.cset[0])
    except:
        cset = 0

    make_appt(bldate, apptix, localsettings.pyTimetoWystime(bl_start),
    localsettings.pyTimetoWystime(bl_end), name,
    pt.serialno, reason, "", "", "", 1, cset, 0, 0)

    block_length = (localsettings.pyTimeToMinutesPastMidnight(bl_end) -
        localsettings.pyTimeToMinutesPastMidnight(bl_start))
    aprix = add_pt_appt(pt.serialno, apptix, block_length, reason)

    print "adjust pt diary"
    return pt_appt_made(pt.serialno, aprix,
        bldate, localsettings.pyTimetoWystime(bl_start), apptix)
Beispiel #6
0
def fill_appt(bldate, apptix, start, end, bl_start, bl_end, reason, pt):
    '''
    this is the procedure called when making an appointment via clicking on a
    free slot in a DAY view.
    '''
    #- 1st check the block is free
    slots = future_slots(bldate, bldate, (apptix, ))

    date_time = datetime.datetime.combine(bldate, start)

    block_length = (localsettings.pyTimeToMinutesPastMidnight(end) -
                    localsettings.pyTimeToMinutesPastMidnight(start))

    this_slot = FreeSlot(date_time, apptix, block_length)

    #-- check block still available!!
    found = False
    for slot in slots:
        if slot == this_slot:
            found = True
            break
    if not found:
        return False

    name = "%s %s *" % (pt.fname, pt.sname)
    try:
        cset = ord(pt.cset[0])
    except:
        cset = 0

    make_appt(bldate, apptix, localsettings.pyTimetoWystime(bl_start),
              localsettings.pyTimetoWystime(bl_end), name, pt.serialno, reason,
              "", "", "", 1, cset, 0, 0)

    block_length = (localsettings.pyTimeToMinutesPastMidnight(bl_end) -
                    localsettings.pyTimeToMinutesPastMidnight(bl_start))
    aprix = add_pt_appt(pt.serialno, apptix, block_length, reason)

    print "adjust pt diary"
    return pt_appt_made(pt.serialno, aprix, bldate,
                        localsettings.pyTimetoWystime(bl_start), apptix)