my draft solution:
#+name: bss-ledger-python
#+begin_src python :results silent
for line in tab:
# 25/08/2017
from datetime import date
today = date.today()
today_month = today.year * 12 + today.month
end_month = int(line[2].split('/')[2]) * 12 + int(line[2].split('/')[1])
start_month = int(line[3].split('/')[2]) * 12 +
int(line[3].split('/')[1])
delta_months = end_month - start_month + 1
monthly = int(line[1]) / delta_months
payday = int(line[4])
account_from = line[5]
account_to = line[6]
if ((today_month >= start_month) and (today_month <= end_month)):
# print("Цель: %s, Сумма: %sр, delta: %s, monthly: %s, оплата в
этом месяце: %s" % (line[0], line[1], delta_months, monthly,
payment_needed))
print("%s/%02d/%02d ! Собираем %sр на %s к %s" % (today.year,
today.month, payday, int(line[1]), line[0], line[2]))
print("%s %sр" % (line[5], monthly))
print("%s" % line[6])
print("")
if (today_month == end_month):
print("%s/%02d/%02d ! Покупка %s за %sр" % (today.year,
today.month, payday, line[0], int(line[1])))
print("расходы:цели:%s %sр" % (line[0], int(line[1])))
print("%s" % line[5])
print("")
#+end_src
Выводим только активные транзакции этого месяца
#+NAME: table1
| цель | сумма, р | к дате | начальная дата | день платежа |
целевой счёт | счёт расхода|
|---+--+++--++-|
| сборы в школу |15000 | 25/08/2017 | 10/06/2017 | 11 |
(фонды:сборы в школу 2017) | (активы:накопления) |
| зимняя резина |15000 | 11/10/2017 | 10/06/2017 | 25 |
(фонды:зимняя резина 2017) | (активы:накопления) |
| собака|25000 | 25/06/2017 | 10/06/2017 | 25 |
(фонды:зимняя резина 2017) | (активы:накопления) |
| test1 резина |15000 | 11/10/2016 | 10/06/2016 | 11 |
(фонды:зимняя резина 2017) | (активы:накопления) |
| test2 резина |15000 | 11/10/2017 | 10/07/2017 | 11 |
(фонды:зимняя резина 2017) | (активы:накопления) |
#+NAME: my-ledger-goals
#+BEGIN_SRC python :preamble "# -*- coding: utf-8 -*-" :var tab=table1
:results output :noweb yes
<>
#+END_SRC
#+results: my-ledger-goals
#+begin_example
2017/06/11 ! Собираем 15000р на сборы в школу к 25/08/2017
(фонды:сборы в школу 2017) 5000р
(активы:накопления)
2017/06/25 ! Собираем 15000р на зимняя резина к 11/10/2017
(фонды:зимняя резина 2017) 3000р
(активы:накопления)
2017/06/25 ! Собираем 25000р на собака к 25/06/2017
(фонды:зимняя резина 2017) 25000р
(активы:накопления)
2017/06/25 ! Покупка собака за 25000р
расходы:цели:собака 25000р
(фонды:зимняя резина 2017)
#+end_example
понедельник, 5 июня 2017 г., 2:11:16 UTC+3 пользователь Budnikov Sergey
написал:
>
> Hello! How to calculate the monthly payment for savings by the specified
> date? I want to see a scheduled transaction with a regular payment every
> month. For example: by August 20, I need to have a dedicated account of $
> 30. Therefore, this month should see a planned transaction of $ 10. How do
> I automatically generate this transaction?
>
--
---
You received this message because you are subscribed to the Google Groups
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.