def getMiscTable(readResults, startPage):
    miscTab = []
    for pageNum in range(startPage, len(readResults)):
        for lineNum in range(0, len(readResults[pageNum]["lines"])):
            cell = readResults[pageNum]["lines"][lineNum]['text']
            if 'Parking' in cell or 'Porterage' in cell or 'Package' in cell:
                startPage = pageNum
    pgStrEndStrings = [["Date", "Description", "Charges", "Credits"],
                       ["Guest Signature", "Telephone"]]
    fixedValList = [["Date"], ["Parking", "Porterage", "Package"],
                    ["Guest Tota"], ["packages", "bags", "Routed From"],
                    ["Charges"]]
    fixedAllign = ['c', 'l', 'r', 'l', 'r']
    bodyAllign = ['l', 'l', 'r', 'l', 'r']
    tableCords, startPageNum, endPageNum = MyTable.getTableCordsFromPageNo(
        readResults, pgStrEndStrings, fixedValList, fixedAllign, startPage)
    miscFullTab = MyTable.getTable(readResults, tableCords, startPageNum,
                                   endPageNum, bodyAllign)
    miscOtherTab = getMiscOtherShortTab(miscFullTab)
    flag = False
    mealList = [
        'Dinner', 'Liquor', 'Food', 'Wine', 'Beer', 'Breakfast', 'Lunch',
        'Stinger', 'Minibar', 'Dining', 'Beverage'
    ]
    for pageNum in range(endPageNum, len(readResults)):
        for lineNum in range(0, len(readResults[pageNum]["lines"])):
            cell = readResults[pageNum]["lines"][lineNum]['text']
            for meal in mealList:
                if meal in cell:
                    startPage = pageNum
                    flag = True
                    break
        if flag:
            break
    pgStrEndStrings = [["Date", "Description", "Charges", "Credits"],
                       ["Guest Signature", "Telephone"]]
    fixedValList = [["Date"], mealList, ["Guest Tota", "Sub Tota"],
                    ["Charges"]]
    fixedAllign = ['c', 'l', 'r', 'r']
    bodyAllign = ['l', 'l', 'r', 'r']
    tableCords, startPageNum, endPageNum = MyTable.getTableCordsFromPageNo(
        readResults, pgStrEndStrings, fixedValList, fixedAllign, startPage)
    miscFullTab = MyTable.getTable(readResults, tableCords, startPageNum,
                                   endPageNum, bodyAllign)
    miscMealsTab = [["Meals", '', '', '', '', '', '']]
    miscMealsTab.append(
        ["10% off F&B charges per contract", '', '', '', -72.21, '', ''])
    miscMealsTab.extend(getMiscMealsShortTab(miscFullTab))
    miscTab.extend(miscOtherTab)
    miscTab.extend(miscMealsTab)
    return miscTab, endPageNum
def getRoomTable(readResults, excelFileName):
    startIdentifiers = [["NEW", "YORK"], ["INFORMATION", "INVOICE"]]
    endIdentifiers = [["i have received", "the amount shown heron"],
                      ["personally", "thath the indicated person"]]
    pgStrEndStrings = [["Date", "Description", "Charges", "Credits"],
                       ["300 W", "Telephone"]]
    fixedValList = [["Date"], ["State Hotel", "*Accomodation"],
                    ["Sub Total", "Guest Total"], ["Charges"]]
    fixedAllign = ['c', 'l', 'r', 'r']
    bodyAllign = ['l', 'l', 'r', 'r']
    startPage = 0
    for pageNum in range(0, len(readResults)):
        for lineNum in range(0, len(readResults[pageNum]["lines"])):
            cell = readResults[pageNum]["lines"][lineNum]['text']
            if 'Accommodation' in cell:
                startPage = pageNum
                break
        if startPage != 0:
            break
    tableCords, startPageNum, endPageNum = MyTable.getTableCordsFromPageNo(
        readResults, pgStrEndStrings, fixedValList, fixedAllign, startPage)
    roomFullTab = MyTable.getTable(readResults, tableCords, startPageNum,
                                   endPageNum, bodyAllign)
    roomTab, roomRate = getRoomShortTab(roomFullTab)
    groupedRoomTab, sum = getGroupedRoomTab(roomTab, excelFileName)
    return groupedRoomTab, roomRate, endPageNum, sum
def getAVTable(readResults, startPage):
    avTab = []
    stPage = 0
    for pageNum in range(startPage, len(readResults)):
        for lineNum in range(0, len(readResults[pageNum]["lines"])):
            cell = readResults[pageNum]["lines"][lineNum]['text']
            if 'Audio' in cell:
                stPage = pageNum
                break
        if stPage != 0:
            break
    pgStrEndStrings = [["Date", "Description", "Charges", "Credits"],
                       ["Guest Signature", "Telephone"]]
    fixedValList = [["Date"], ["Audio"], ["Charges"]]
    fixedAllign = ['c', 'l', 'r']
    bodyAllign = ['l', 'l', 'r']
    tableCords, startPageNum, endPageNum = MyTable.getTableCordsFromPageNo(
        readResults, pgStrEndStrings, fixedValList, fixedAllign, stPage)
    avFullTab = MyTable.getTable(readResults, tableCords, startPageNum,
                                 endPageNum, bodyAllign)

    for rowIndex in range(0, len(avFullTab)):
        for colIndex in range(0, len(avFullTab[rowIndex])):
            item = avFullTab[rowIndex][colIndex]
            if "Audio" in item:
                Date = avFullTab[rowIndex][colIndex - 1]  #change date format
                avTab.append([
                    Date, "AV", '1', '', avFullTab[rowIndex][colIndex + 1], '',
                    ''
                ])
    return avTab, endPageNum