24 return available.amount == 0 && blocked.amount == 0 && writeoff.amount == 0;
31 return available + blocked +
writeoff;
67 uint64_t
by_coop()
const {
return coopname.value; }
68 checksum256
by_hash()
const {
return writeoff_hash; }
71typedef eosio::multi_index<
"writeoffs"_n,
writeoff_op,
72 eosio::indexed_by<
"bycoop"_n, eosio::const_mem_fun<writeoff_op, uint64_t, &writeoff_op::by_coop>>,
73 eosio::indexed_by<
"byhash"_n, eosio::const_mem_fun<writeoff_op, checksum256, &writeoff_op::by_hash>>
104 static void add(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment);
105 static void sub(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment);
106 static void transfer(eosio::name actor, eosio::name coopname, uint64_t from_account_id, uint64_t to_account_id, eosio::asset quantity, std::string comment);
109 static void block(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment);
110 static void unblock(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment);
113 static void writeoff(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment);
114 static void writeoffcnsl(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment);
117 static void add_membership_fee(eosio::name actor, eosio::name coopname, eosio::asset quantity, std::string comment);
118 static void sub_membership_fee(eosio::name actor, eosio::name coopname, eosio::asset quantity, std::string comment);
119 static void block_membership_fee(eosio::name actor, eosio::name coopname, eosio::asset quantity, std::string comment);
120 static void unblock_membership_fee(eosio::name actor, eosio::name coopname, eosio::asset quantity, std::string comment);
140 static constexpr uint64_t
CASH = 50;
208static const std::vector<std::tuple<uint64_t, std::string>>
ACCOUNT_MAP = {
286 eosio::check(
amount.is_valid(),
"Некорректная сумма");
287 eosio::check(
amount.amount > 0,
"Сумма должна быть положительной");
292 if (std::get<0>(account_data) == account_id) {
293 return std::get<1>(account_data);
296 return "Неизвестный счет";
307inline void Ledger::add(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment) {
312 std::make_tuple(coopname, account_id, quantity, comment)
324inline void Ledger::sub(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment) {
329 std::make_tuple(coopname, account_id, quantity, comment)
342inline void Ledger::transfer(eosio::name actor, eosio::name coopname, uint64_t from_account_id, uint64_t to_account_id, eosio::asset quantity, std::string comment) {
343 add(actor, coopname, from_account_id, quantity, comment);
344 sub(actor, coopname, to_account_id, quantity, comment);
355inline void Ledger::block(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment) {
360 std::make_tuple(coopname, account_id, quantity, comment)
372inline void Ledger::unblock(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment) {
377 std::make_tuple(coopname, account_id, quantity, comment)
389inline void Ledger::writeoff(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment) {
394 std::make_tuple(coopname, account_id, quantity, comment)
406inline void Ledger::writeoffcnsl(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment) {
411 std::make_tuple(coopname, account_id, quantity, comment)
461 auto hash_idx = writeoffs.get_index<
"byhash"_n>();
463 auto op_iter = hash_idx.find(writeoff_hash);
464 if (op_iter == hash_idx.end()) {
Класс Ledger для интеграции с ledger контрактом
Definition: shared_ledger.hpp:80
static void unblock_membership_fee(eosio::name actor, eosio::name coopname, eosio::asset quantity, std::string comment)
Разблокировать членский взнос на счёте поступлений
Definition: shared_ledger.hpp:455
static void transfer(eosio::name actor, eosio::name coopname, uint64_t from_account_id, uint64_t to_account_id, eosio::asset quantity, std::string comment)
Перевести средства между счетами кооператива
Definition: shared_ledger.hpp:342
static void block_membership_fee(eosio::name actor, eosio::name coopname, eosio::asset quantity, std::string comment)
Заблокировать членский взнос на счёте поступлений
Definition: shared_ledger.hpp:444
static void block(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment)
Заблокировать средства на счёте кооператива
Definition: shared_ledger.hpp:355
static void writeoff(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment)
Списать средства со счёта кооператива
Definition: shared_ledger.hpp:389
static void writeoffcnsl(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment)
Списать средства со счёта кооператива
Definition: shared_ledger.hpp:406
static void add_membership_fee(eosio::name actor, eosio::name coopname, eosio::asset quantity, std::string comment)
Добавить членский взнос на счёт поступлений
Definition: shared_ledger.hpp:422
static void check_ledger_symbol(const eosio::asset &amount)
Проверка корректности символа валюты для операций ledger.
Definition: shared_ledger.hpp:281
static void sub_membership_fee(eosio::name actor, eosio::name coopname, eosio::asset quantity, std::string comment)
Вычесть членский взнос со счёта поступлений
Definition: shared_ledger.hpp:433
static void check_positive_amount(const eosio::asset &amount)
Проверка положительности суммы для операций ledger.
Definition: shared_ledger.hpp:285
static std::optional< writeoff_op > get_writeoff_by_hash(const checksum256 &writeoff_hash)
Получает операцию списания по хэшу
Definition: shared_ledger.hpp:459
static eosio::name get_valid_ledger_action(const eosio::name &action)
Проверка корректности действия ledger.
Definition: shared_ledger.hpp:276
static void add(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment)
Добавить средства на счёт кооператива
Definition: shared_ledger.hpp:307
static void sub(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment)
Уменьшить средства на счёте кооператива
Definition: shared_ledger.hpp:324
static void unblock(eosio::name actor, eosio::name coopname, uint64_t account_id, eosio::asset quantity, std::string comment)
Разблокировать средства на счёте кооператива
Definition: shared_ledger.hpp:372
static std::string get_account_name_by_id(uint64_t account_id)
Получает название счета по его ID из ACCOUNT_MAP.
Definition: shared_ledger.hpp:290
static constexpr eosio::symbol _root_govern_symbol
Definition: consts.hpp:210
static constexpr eosio::name _ledger
Definition: consts.hpp:163
contract
Definition: eosio.msig_tests.cpp:977
permission_level
Definition: eosio.msig_tests.cpp:896
share_type amount
Definition: eosio.token_tests.cpp:174
static const std::set< eosio::name > ledger_actions
Валидные действия ledger для интеграции с другими контрактами
Definition: shared_ledger.hpp:86
static const std::vector< std::tuple< uint64_t, std::string > > ACCOUNT_MAP
Карта счетов для инициализации бухгалтерской книги СОХРАНЯЕМ - используется для получения названий пр...
Definition: shared_ledger.hpp:208
void send(name contract, name action_name, name actor, Args &&... args)
Definition: shared_actions.hpp:10
Definition: eosio.msig.hpp:34
action(permission_level{ _gateway, "active"_n}, _gateway, "adduser"_n, std::make_tuple(coopname, deposit->username, to_spread, to_circulation, eosio::current_time_point(), true)).send()
eosio::multi_index<"accounts"_n, laccount > laccounts_index
Типы индексов для таблиц ledger.
Definition: shared_ledger.hpp:45
eosio::multi_index<"writeoffs"_n, writeoff_op, eosio::indexed_by<"bycoop"_n, eosio::const_mem_fun< writeoff_op, uint64_t, &writeoff_op::by_coop > >, eosio::indexed_by<"byhash"_n, eosio::const_mem_fun< writeoff_op, checksum256, &writeoff_op::by_hash > > > writeoffs_index
Definition: shared_ledger.hpp:74
Константы счетов
Definition: shared_ledger.hpp:138
static constexpr uint64_t INTANGIBLE_ASSETS
Нематериальные активы
Definition: shared_ledger.hpp:170
static constexpr uint64_t TAXES_FEES
Расчеты с бюджетом по налогам и сборам
Definition: shared_ledger.hpp:177
static constexpr uint64_t FUNDS_PO_2
Фонды ПО (вариант пополнения фондов ПО)
Definition: shared_ledger.hpp:185
static constexpr uint64_t LONG_TERM_LOANS
Расчеты по долгосрочным кредитам и займам
Definition: shared_ledger.hpp:176
static constexpr uint64_t NON_PROFIT_ACTIVITY
Некоммерческая деятельность
Definition: shared_ledger.hpp:173
static constexpr uint64_t GENERAL_EXPENSES
Общехозяйственные расходы (содержание ПО)
Definition: shared_ledger.hpp:174
static constexpr uint64_t INDIVISIBLE_FUND
Неделимый фонд
Definition: shared_ledger.hpp:190
static constexpr uint64_t SHARE_FUND
Паевой фонд (складочный капитал)
Definition: shared_ledger.hpp:149
static constexpr uint64_t ENTRANCE_FEES
Вступительные взносы
Definition: shared_ledger.hpp:188
static constexpr uint64_t TARGET_RECEIPTS
Целевые поступления
Definition: shared_ledger.hpp:187
static constexpr uint64_t ADDITIONAL_CAPITAL
Добавочный капитал
Definition: shared_ledger.hpp:181
static constexpr uint64_t MATERIALS_GOODS
Материалы, товары
Definition: shared_ledger.hpp:171
static constexpr uint64_t MAIN_PRODUCTION
Основное производство
Definition: shared_ledger.hpp:172
static constexpr uint64_t FIXED_ASSETS
Основные средства
Definition: shared_ledger.hpp:169
static constexpr uint64_t PREVIOUS_YEARS_PROFIT
Нераспределенная прибыль (непокрытый убыток) прошлых лет
Definition: shared_ledger.hpp:184
static constexpr uint64_t MUTUAL_SECURITY_FUND
Фонд взаимного обеспечения
Definition: shared_ledger.hpp:192
static constexpr uint64_t SALARY
Заработная плата
Definition: shared_ledger.hpp:179
static constexpr uint64_t RESERVE_FUND
Резервный фонд
Definition: shared_ledger.hpp:189
static constexpr uint64_t FINANCIAL_INVESTMENTS
Финансовые вложения из средств ПО
Definition: shared_ledger.hpp:161
static constexpr uint64_t PROPERTY_TRANSFER
По передаче имущества для некоммерческой деятельности
Definition: shared_ledger.hpp:153
static constexpr uint64_t INCOME_ACCRUALS
Начисление доходов участникам от предпринимательской деятельности ПО (кооперативные выплаты)
Definition: shared_ledger.hpp:146
static constexpr uint64_t UNDISTRIBUTED_PROFIT
Нераспределенная прибыль (непокрытый убыток)
Definition: shared_ledger.hpp:186
static constexpr uint64_t CASH
Касса
Definition: shared_ledger.hpp:140
static constexpr uint64_t SECURITIES
Облигации (государственные ценные бумаги)
Definition: shared_ledger.hpp:163
static constexpr uint64_t MEMBER_SETTLEMENTS
Расчеты с пайщиками по внесению/возврату паевых взносов
Definition: shared_ledger.hpp:144
static constexpr uint64_t FREE_RECEIPT
Безвозмездное получение имущества
Definition: shared_ledger.hpp:197
static constexpr uint64_t CURRENT_YEAR_PROFIT
Нераспределенная прибыль (убыток) отчетного года
Definition: shared_ledger.hpp:183
static constexpr uint64_t FUNDS_PO_1
Фонды ПО (вариант пополнения фондов ПО)
Definition: shared_ledger.hpp:182
static constexpr uint64_t DEVELOPMENT_FUND
Фонд развития потребительской кооперации
Definition: shared_ledger.hpp:193
static constexpr uint64_t ECONOMIC_ACTIVITY_FUND
Фонд обеспечения хозяйственной деятельности
Definition: shared_ledger.hpp:191
static constexpr uint64_t MEMBER_DEBT
Задолженность пайщиков по внесению взносов в паевой фонд
Definition: shared_ledger.hpp:145
static constexpr uint64_t LOANS_ISSUED
Расчеты по выданным займам
Definition: shared_ledger.hpp:157
static constexpr uint64_t BANK_ACCOUNT
Расчетный счет
Definition: shared_ledger.hpp:141
static constexpr uint64_t ACCOUNTABLE_PERSONS
Расчеты с подотчетными лицами
Definition: shared_ledger.hpp:180
static constexpr uint64_t OTHER_SETTLEMENTS
Другие расчеты
Definition: shared_ledger.hpp:154
static constexpr uint64_t SOCIAL_INSURANCE
Расчеты по социальному страхованию и обеспечению
Definition: shared_ledger.hpp:178
static constexpr uint64_t LOAN_INTEREST
Внесение процентов за пользование займами
Definition: shared_ledger.hpp:158
static constexpr uint64_t DEBTORS_CREDITORS
Расчеты с дебиторами и кредиторами
Definition: shared_ledger.hpp:166
static constexpr uint64_t SHARES_AND_STAKES
Доли, паи и акции в организациях, где участвует ПО
Definition: shared_ledger.hpp:162
static constexpr uint64_t FUTURE_EXPENSES_RESERVE
Резерв предстоящих расходов
Definition: shared_ledger.hpp:195
static constexpr uint64_t MEMBER_FEES
По членским взносам
Definition: shared_ledger.hpp:152
static constexpr uint64_t FUTURE_INCOME
Доходы будущих периодов
Definition: shared_ledger.hpp:196
static constexpr uint64_t OTHER_INCOME_EXPENSES
Прочие доходы и расходы
Definition: shared_ledger.hpp:194
static constexpr uint64_t RESERVES
Резервы по сомнительным долгам
Definition: shared_ledger.hpp:175
Definition: drafts.hpp:28
Структура бухгалтерского счета
Definition: shared_ledger.hpp:11
uint64_t id
Идентификатор счета
Definition: shared_ledger.hpp:12
bool is_empty() const
Проверяет, пуст ли счет (все балансы равны нулю)
Definition: shared_ledger.hpp:23
eosio::asset get_total() const
Получает общий баланс счета
Definition: shared_ledger.hpp:30
std::string name
Название счета
Definition: shared_ledger.hpp:13
eosio::asset get_balance() const
Получает всего доступных + заблокированных средств (без списанных)
Definition: shared_ledger.hpp:37
uint64_t primary_key() const
Definition: shared_ledger.hpp:18
eosio::asset available
Доступные средства (было allocation)
Definition: shared_ledger.hpp:14
eosio::asset blocked
Заблокированные средства
Definition: shared_ledger.hpp:15
eosio::asset writeoff
Списанные средства
Definition: shared_ledger.hpp:16
Структура для операций ожидающих решения совета
Definition: shared_ledger.hpp:55
uint64_t account_id
Счет для операции
Definition: shared_ledger.hpp:59
uint64_t primary_key() const
Definition: shared_ledger.hpp:66
eosio::name status
Статус: pending, approved, declined, paid.
Definition: shared_ledger.hpp:64
eosio::name coopname
Имя кооператива
Definition: shared_ledger.hpp:57
eosio::asset quantity
Сумма операции
Definition: shared_ledger.hpp:60
checksum256 writeoff_hash
Хэш операции списания
Definition: shared_ledger.hpp:63
uint64_t id
Идентификатор операции
Definition: shared_ledger.hpp:56
eosio::name username
Инициатор операции
Definition: shared_ledger.hpp:58
uint64_t by_coop() const
Definition: shared_ledger.hpp:67
std::string reason
Обоснование
Definition: shared_ledger.hpp:61
document2 document
Документ обоснования
Definition: shared_ledger.hpp:62
checksum256 by_hash() const
Definition: shared_ledger.hpp:68