Доступ к оплатам
Структура моделей, назначение полей
Модель Payment — Оплаты
* @property integer $id * @property double $amount //Сумма * @property enum('exec', 'save', 'deleted') $status // Статус * @property integer $cassa_id // ID кассы * @property integer $cassaclose_id // Связь с документом закрытия кассы * @property string $create_date // Создание счет * @property integer $payed_user // Оплативший пользователь * @property string $description // Описание * @property string (‘cash’, ‘cashless’) $payment_type // Тип оплаты * @property string $invoice_id // ИД Счёта
Модель ClosingOfInvoices — связь счетов с оплатами
- @property integer $id
* @property integer $client_id //ID клиента * @property integer $plus_amount // Сумма документа увеличивающего баланс клиента * @property string $plus_type_document // Тип документа увеличивающего баланс клиента ('invoice', 'payment', 'add_balance', 'return_good', 'start_balance' ) * @property string $plus_document_id // ИД документа увеличивающего баланс клиента * @property integer $minus_amount // Сумма документа уменьшающего баланс клиента * @property string $minus_type_document // Тип документа уменьшающего баланс клиента * @property string $minus_document_id // ИД документа уменьшающего баланс клиента * @property string $status * @property string $create_date * Связанные документы * @property Client $client - клиент * @property Invoice $invoice - Счета * @property Payment $minus_payment - Отрицательные оплаты * @property Payment $plus_payment - Положительные оплаты
Примеры запросов
Пример Payment
curl -i -H "Accept: application/json" -H "X-REST-API-KEY: 950a183ccebb639d464c04ed4b70528b" http://example/rest/api/payment/1
{
"success": true, "message": "Record Retrieved Successfully", "data": { "totalCount": 1, "payment": { "id": "1", "amount": "600", "status": "exec", "cassa_id": "2", "cassaclose_id": "9", "create_date": "2013-11-01 20:28:06", "payed_user": "11", "description": "", "payment_type": "cash", "invoice_id": "0", "cassa": { "id": "2", "title": "касса Вика", "assigned_user_id": "15", "inventarization_date": "2014-11-07 17:43:53", "client_cass": "1", "main_cassa": "0", "is_blocked": "0", "has_unfinished_docs": "0", "status": "active" "clinic_id": "1", "summa_cash": "40782.9800000000", "summa_cashless": "0.0000000000", "is_system": "0" }, "cassaclose": { "id": "9", "date": "2013-12-19 12:23:49", "id_cassa": "2", "status": "exec", "closed_user_id": "11", "amount": "615" "amount_cashless": "0.0000000000" } } }
}
Пример ClosingOfInvoices
- curl -i -H «Accept: application/json» -H «X-REST-API-KEY: 950a183ccebb639d464c04ed4b70528b» http://example/rest/api/closingOfInvoices/1
{
"success": true, "message": "Record Retrieved Successfully", "data": { "totalCount": 1, "closingOfInvoices": { "id": "46", "client_id": "13", "invoice_id": "1", "status": "exec", "create_date": "2013-11-13 17:34:13", "amount": "600", "type_document": "payment", "document_id": "1", "client": { "id": "13", "address": "", "home_phone": "123456", "work_phone": "", "fax": "", "note": "", "type_id": null, "how_find": null, "balance": "20", "email": "", "city": "", "city_id": "252", "date_register": "2013-10-31 21:35:37", "cell_phone": "", "zip": "", "registration_index": null, "vip": "0", "last_name": "Никифоров", "first_name": "Антон", "middle_name": "", "status": "ACTIVE", "discount": "0", "passport_series": "", "lab_number": "", "street_id": "0", "apartment": "", "unsubscribe": "0", "number_of_journal": "", "phone_prefix": "0" }, "invoice": { "id": "1", "doctor_id": "11", "client_id": "13", "pet_id": "13", "description": "", "percent": "0", "amount": "600", "status": "exec", "invoice_date": "2013-11-01 20:28:06", "old_id": null, "night": "0", "increase": "0", "discount": "0", "call": "0", "paid_amount": "600", "create_date": "2013-11-01 20:27:57" } } }
}
Список обязательных полей
создание записи: client_id pet_id description percent amount invoice_date clinic_id creator_id обновление записи: обязательных полей для запроса нет. При передаче поля из сущности, его и обновит