Exemple #1
0
def GetAllValuesByMonth(Month, Year):
    cur = connection.cursor
    DebtsValues = open(os.path.join("Queries", "GetAllCardsValues.sql")).read()
    CardValues = open(os.path.join("Queries", "GetAllValuesDebts.sql")).read()

    cur.execute(DebtsValues.format("'" + Month + "'", "'" + Year + "'"))
    debtsQuery = cur.fetchall()
    cur.execute(CardValues.format("'" + Month + "'", "'" + Year + "'"))
    cardsQuery = cur.fetchall()

    values = QueryToDict.GetAllValues(debtsQuery, cardsQuery)
    return values
Exemple #2
0
def GetValuesByCurrentMonth():
    CurrentDate = datetime.datetime.now()
    Month = str(CurrentDate.month)
    Year = str(CurrentDate.year)
    cur = connection.cursor

    GetDebtValues = open(os.path.join("Queries", "GetDebtsByMonth.sql")).read()

    cur.execute(GetDebtValues.format("'" + Month + "'", "'" + Year + "'"))
    resultado = cur.fetchall()
    Debtsvalues = QueryToDict.SimpleQueryToDict(resultado)

    return Debtsvalues
Exemple #3
0
def GetAllDebtsSum(Month, Year):
    cur = connection.cursor
    SumDebtsValues = open(os.path.join("Queries", "GetSumDebts.sql")).read()
    SumCardsValues = open(os.path.join("Queries", "GetSumCards.sql")).read()

    cur.execute(SumDebtsValues.format("'" + Month + "'", "'" + Year + "'"))
    debtsSum = cur.fetchall()

    cur.execute(SumCardsValues.format("'" + Month + "'", "'" + Year + "'"))
    cardsSum = cur.fetchall()

    DebtsValues = QueryToDict.SumAllQueryToDict(debtsSum, cardsSum)

    return DebtsValues
Exemple #4
0
def GetCardValuesByCurrentMonth(CardName):
    CurrentDate = datetime.datetime.now()
    Month = str(CurrentDate.month)
    Year = str(CurrentDate.year)
    cur = connection.cursor

    GetDebtValues = open(os.path.join("Queries", "GetCardsByMonth.sql")).read()

    cur.execute(
        GetDebtValues.format("'" + Month + "'", "'" + Year + "'",
                             "'" + CardName + "'", "'" + CardName + "'"))
    Debtsvalues = QueryToDict.CardQueryToDict(cur.fetchall())

    return Debtsvalues
Exemple #5
0
def GetAllDebtsByMonth(year):
    cur = connection.cursor
    SumDebtsValues = open(os.path.join("Queries",
                                       "GetAllDebtsSumByMonth.sql")).read()
    SumFixdValues = open(os.path.join("Queries",
                                      "GetAllFixedDebts.sql")).read()

    cur.execute(SumDebtsValues.format("'" + year + "'", "'" + year + "'"))
    DebtsValues = cur.fetchall()

    cur.execute(SumFixdValues)
    FixedValues = cur.fetchall()

    AllValues = QueryToDict.SumValuesToDict(DebtsValues, FixedValues)

    return AllValues
Exemple #6
0
def GetSumReceived():
    cur = connection.cursor
    GetValues = open(os.path.join("Queries", "GetSumReceived.sql")).read()
    cur.execute(GetValues)
    SumValues = QueryToDict.ReceivedSumQueryToDict(cur.fetchall())
    return SumValues
Exemple #7
0
def GetCardsSum(Month, Year):
    cur = connection.cursor
    SumValues = open(os.path.join("Queries", "GetSumCards.sql")).read()
    cur.execute(SumValues.format("'" + Month + "'", "'" + Year + "'"))
    values = QueryToDict.CardSumQueryToDict(cur.fetchall())
    return values
Exemple #8
0
def GetValuesByCardName(CardName):
    cur = connection.cursor
    AddValues = open(os.path.join("Queries", "GetCardByName.sql")).read()
    cur.execute(AddValues.format("'" + CardName + "'"))
    CardId = QueryToDict.QueryToDict(cur.fetchall())
    return CardId
Exemple #9
0
def GetCardsNames():
    cur = connection.cursor
    GetValues = open(os.path.join("Queries", "GetCards.sql")).read()
    cur.execute(GetValues)
    CardNames = QueryToDict.CardsNamesQueryToDict(cur.fetchall())
    return CardNames