def getAllMaintenanceNotCreated():
    simplelist = []
    maintenancesList = select_all_maintenance()
    for mainte in maintenancesList:
        if mainte.created_at == None:
            simplelist.append(mainte.customers)
    return simplelist
def getMaintenancePused():
    simplelist = []
    mainlist = select_all_maintenance()
    for mainte in mainlist:
        if mainte.created_at == None or mainte.cost_of_bill_of_material == None:
            simplelist.append(mainte)
    return simplelist
def getMaintenanceAmouted():
    simplelist = []
    mainlist = select_all_maintenance()
    for mainte in mainlist:
        if mainte.start_date != None:
            simplelist.append(mainte)
    return simplelist
def getMaintenanceFinishedAndDelivared():
    simplelist = []
    mainlist = select_all_maintenance()
    for mainte in mainlist:
        if mainte.close_at != None:
            simplelist.append(mainte)
    return simplelist
def getMaintenanceWaitingDelevary():
    simplelist = []
    mainlist = select_all_maintenance()
    for mainte in mainlist:
        if mainte.done_date != None and mainte.close_at == None:
            simplelist.append(mainte)
    return simplelist
def getMaintenanceUnderProccessing():
    simplelist = []
    mainlist = select_all_maintenance()
    for mainte in mainlist:
        if mainte.start_date != None and mainte.done_date == None:
            simplelist.append(mainte)
    return simplelist
def getMaintenanceBTWDate(first, second):
    simplelist = []
    mainlist = select_all_maintenance()
    for mainte in mainlist:
        if mainte.start_date != None:
            if mainte.created_at >= first and mainte.created_at <= second:
                simplelist.append(mainte)
    return simplelist
def getMaintenanceHolded():
    simplelist = []
    mainlist = select_all_maintenance()
    for mainte in mainlist:
        if mainte.created_at != None \
          and mainte.start_date == None \
          and mainte.cost_of_labor != None:
            simplelist.append(mainte)
    return simplelist
def getMaintenanceWaitLaborCost():
    simplelist = []
    mainlist = select_all_maintenance()
    for mainte in mainlist:
        if mainte.created_at != None \
          and mainte.cost_of_labor == None \
          and mainte.cost_of_bill_of_material != None:
            simplelist.append(mainte)
    return simplelist
def getMaintenanceFinishedAndDelivaredCost():
    simplelistbm = []
    simplelistla = []
    simplelistan = []
    mainlist = select_all_maintenance()
    for mainte in mainlist:
        if mainte.close_at != None:
            if not mainte.cost_of_bill_of_material == None:
                # 	mainte.cost_of_bill_of_material = 0
                simplelistbm.append(mainte.cost_of_bill_of_material)
            if not mainte.cost_of_labor == None:
                # 	mainte.cost_of_labor = 0
                simplelistla.append(mainte.cost_of_labor)
            if not mainte.cost_of_another == None:
                # 	mainte.cost_of_another = 0
                simplelistan.append(mainte.cost_of_another)
        summ = sum(simplelistbm) + sum(simplelistla) + sum(simplelistan)
        # if summ == 0:
        # 	summ =0
        return summ
def getMaintenanceUnderProccessingCost():
    simplelistbm = []
    simplelistla = []
    simplelistan = []
    mainlist = select_all_maintenance()
    for mainte in mainlist:
        if mainte.start_date != None and mainte.done_date == None:
            if not mainte.cost_of_bill_of_material == None:
                # 	mainte.cost_of_bill_of_material = 0
                simplelistbm.append(mainte.cost_of_bill_of_material)
            if not mainte.cost_of_labor == None:
                # 	mainte.cost_of_labor = 0
                simplelistla.append(mainte.cost_of_labor)
            if not mainte.cost_of_another == None:
                # 	mainte.cost_of_another = 0
                simplelistan.append(mainte.cost_of_another)
        summ = sum(simplelistbm) + sum(simplelistla) + sum(simplelistan)
        # if summ == 0:
        # 	summ =0
        return summ
def getMaintenanceCalcCost():
    simplelistbm = []
    simplelistla = []
    simplelistan = []
    mainlist = select_all_maintenance()
    for mainte in mainlist:
        if mainte.created_at != None \
          and mainte.start_date == None:
            if not mainte.cost_of_bill_of_material == None:
                # mainte.cost_of_bill_of_material = None
                simplelistbm.append(mainte.cost_of_bill_of_material)
            if not mainte.cost_of_labor == None:
                # mainte.cost_of_labor = None
                simplelistla.append(mainte.cost_of_labor)
            if not mainte.cost_of_another == None:
                # mainte.cost_of_another = None
                simplelistan.append(mainte.cost_of_another)
        summ = sum(simplelistbm) + sum(simplelistla) + sum(simplelistan)
        # if summ == 0:
        # 	summ =0
        return summ