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
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
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
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
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
def GetSumReceived(): cur = connection.cursor GetValues = open(os.path.join("Queries", "GetSumReceived.sql")).read() cur.execute(GetValues) SumValues = QueryToDict.ReceivedSumQueryToDict(cur.fetchall()) return SumValues
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
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
def GetCardsNames(): cur = connection.cursor GetValues = open(os.path.join("Queries", "GetCards.sql")).read() cur.execute(GetValues) CardNames = QueryToDict.CardsNamesQueryToDict(cur.fetchall()) return CardNames