Доступ к счетам
Структура моделей, назначение полей
Модель Invoice (инфо. счета)
Модель Invoice — представляет заголовок счета, содержит основную информацию о нем
* @property integer $id // ИД счета * @property integer $doctor_id // ИД ответственного врача * @property integer $client_id // ИД клиента * @property integer $pet_id // ИД питомца * @property string $description // Примечание * @property double $percent // Суммарное значение скидки и надбавки * @property double $amount // Сумма счета * @property enum('save', 'exec', 'closed', 'deleted') $status Статус, добавление счета со статусом, отличным от save, может привести к неверной работе программы save - счет черновик, никакого влияния на программу не осуществляет exec - счет выполнен, сумма списана с баланса клиента closed - по счету посчитана зарплата, счет закрыт для редактирования deleted - счет удален, программа больше не предлагает его выполнить, удалить можно только сохраненный счет * @property string $invoice_date // Дата сохранения/проведения счета * @property integer $old_id // deprecated * @property bool $night // Отметка, если счет ночной * @property double $increase // Процент надбавки * @property double $discount // Процент скидки * @property bool $call // Отметка, если счет создан на вызове * @property double $paid_amount // Оплачено по счету * @property string $create_date // Дата создания строки счета * @property string $payment_status (none, partial, full)// статус оплаты счета // none – не оплачен, // partial – частично оплачен, // full – полностью оплачен * @property string $clinic_id// клиника, в которой создан счёт * @property string $creator_id // создатель счета (пользователь, который залогинен в программе)
Модель InvoiceDocument (товары/услуги в счете)
Модель InvoiceDocument — представляет товары и услуги, вошедшие в счет, принадлежит счету
* @property integer $id // ИД документа * @property integer $document_id //ИД счета * @property integer $good_id // ИД товара * @property float $quantity // Количество * @property float $price // Стоимость = Цена товара на момент создания счета * Количество * @property integer $responsible_user_id // ИД врача, ответственного за эту позицию * @property integer $is_default_responsible // Отметка, если врач назначен по ответственному счета * @property integer $sale_param_id // Ссылка на параметр продажи товара * @property integer $tag_id // Ссылка на группу товара * @property integer $discount_type // Ссылка на тип дисконта * @property integer $discount_document_id // Ссылка на скидочную карту * @property integer $discount_percent // Процент скидки * @property integer $default_price // Цена по умолчанию * @property integer $create_date // Дата создания строки (при пересохранении строки перезаписываются и дата меняется) * @property integer $discount_cause // Текст выполнения правил скидки * @property array $party_info // Массив с информацией о партиях, с которых был списал данный товар
Переменная $party_info — Массив с информацией о партиях, с которых был списал данный товар
Описание переменных:
* @property integer $party_id // ID партии из модели PartyAccount * @property timestamp $party_exec_date // Дата создания партии * @property integer $store_id // ID склада * @property integer $good_id // ID товара * @property integer $characteristic_id // ID характеристики товара * @property float $quantity // Количество товара в ед. хранения * @property float $price // Цена закупки
Пример:
[{ "party_id":"2" ,"party_exec_date":"2013-11-07 13:43:30" ,"store_id":"1" ,"good_id":"101" ,"characteristic_id":"0" ,"quantity":"7" ,"price":"123" }, { "party_id":"9" ,"party_exec_date":"2013-12-20 17:44:54" ,"store_id":"1" ,"good_id":"101" ,"characteristic_id":"0" ,"quantity":"1" ,"price":"1" }, { "party_id":"10" ,"party_exec_date":"2013-12-20 17:52:40" ,"store_id":"1" ,"good_id":"101" ,"characteristic_id":"0" ,"quantity":"3" ,"price":"0" }]
Примеры запросов
Общие сведения о запросах к API
Пример invoice по ID счета
curl -i -H "Accept: application/json" -H "X-REST-API-KEY: 950a183ccebb639d464c04ed4b70528b" http://example/rest/api/invoice/106021
{ "success": true, "message": "Record Retrieved Successfully", "data": { "totalCount": 1, "invoice": { "id": "106021", "doctor_id": "1", "client_id": "5484", "pet_id": "10757", "description": "\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u0447\u0435\u0442", "percent": "0", "amount": "588", "status": "exec", "invoice_date": "2014-11-20 16:54:24", "old_id": null, "night": "0", "increase": "0", "discount": "0", "call": "0", "paid_amount": "588", "create_date": "2014-11-08 17:42:38", "client": { "id": "5484", "address": "", "home_phone": "", "work_phone": "", "fax": "", "note": "", "type_id": null, "how_find": null, "balance": "0", "email": "", "city": "", "city_id": "253", "date_register": "2014-10-20 16:50:56", "cell_phone": "", "zip": "", "registration_index": null, "vip": "0", "last_name": "\u0421\u0443\u043f\u0435\u0440\u0433\u043e\u0441\u0442\u044c", "first_name": "12121", "middle_name": "", "status": "ACTIVE", "discount": "0", "passport_series": "", "lab_number": "", "street_id": "0", "apartment": "", "unsubscribe": "0", "number_of_journal": "", "phone_prefix": "0" }, "pet": { "id": "10757", "owner_id": "5484", "type_id": "10", "alias": "\u0424\u0444\u0444", "sex": "unknown", "date_register": "2014-10-20 16:51:03", "birthday": null, "note": "", "breed_id": "828", "old_id": null, "color_id": "0", "deathnote": null, "deathdate": null, "chip_number": "", "lab_number": "", "status": "alive", "picture": null }, "doctor": { "id": "1", "last_name": "admin", "first_name": "admin", "middle_name": "66565", "login": "admin", "passwd": "9205814c8bc98857f5e07f3bae30ad68", "position_id": "8", "email": "[email protected]", "phone": "454545", "cell_phone": "(066)286-11-09", "address": "\u0410\u0434\u0440\u0435\u0441\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441", "role_id": "7", "is_active": "1", "calc_percents": "1", "nickname": "admin", "last_visit": "2014-11-09 15:54:38", "youtrack_login": "", "youtrack_password": "", "last_change_pwd_date": "2014-09-19" }, "invoiceDocuments": [{ "id": "212179", "document_id": "106021", "good_id": "24540", "quantity": "2", "price": "222", "responsible_user_id": "1", "is_default_responsible": "1", "sale_param_id": "114658", "tag_id": "17", "discount_type": null, "discount_document_id": null, "discount_percent": null, "default_price": "222", "create_date": "2014-11-08 17:45:59", "discount_cause": "", "party_info": [{ "party_id": "68", "party_exec_date": "2014-05-06 17:47:21", "store_id": "1", "good_id": "24540", "characteristic_id": "17", "quantity": "2", "price": "4" }], "goodSaleParam": { "id": "114658", "good_id": "24540", "price": "111", "coefficient": "1", "unit_sale_id": "9", "min_price": "0", "max_price": "0", "barcode": "123456789", "status": "active", "clinic_id": "1", "markup": "0", "unitSale": { "id": "9", "title": "\u0433\u0440", "status": "active" } } }, { "id": "212180", "document_id": "106021", "good_id": "24548", "quantity": "3", "price": "366", "responsible_user_id": "1", "is_default_responsible": "1", "sale_param_id": "147438", "tag_id": "17", "discount_type": null, "discount_document_id": null, "discount_percent": null, "default_price": "366", "create_date": "2014-11-08 17:45:59", "discount_cause": "", "party_info": [{ "party_id": "152", "party_exec_date": "2014-10-01 17:28:32", "store_id": "14", "good_id": "24548", "characteristic_id": "0", "quantity": "1.5", "price": "152" }], "goodSaleParam": { "id": "147438", "good_id": "24548", "price": "122", "coefficient": "2", "unit_sale_id": "6", "min_price": "20", "max_price": "30", "barcode": "", "status": "active", "clinic_id": "1", "markup": "0", "unitSale": { "id": "6", "title": "\u043a\u0433", "status": "active" } } }] } } }
Пример invoiceDocument
- curl -i -H «Accept: application/json» -H «X-REST-API-KEY: 950a183ccebb639d464c04ed4b70528b» http://example/rest/api/invoiceDocument/212179
{
"success": true, "message": "Record Retrieved Successfully", "data": { "totalCount": 1, "invoiceDocument": { "id": "212179", "document_id": "106021", "good_id": "24540", "quantity": "2", "price": "222", "responsible_user_id": "1", "is_default_responsible": "1", "sale_param_id": "114658", "tag_id": "17", "discount_type": null, "discount_document_id": null, "discount_percent": null, "default_price": "222", "create_date": "2014-11-08 17:45:59", "discount_cause": "", "document": { "id": "106021", "doctor_id": "1", "client_id": "5484", "pet_id": "10757", "description": "\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u0447\u0435\u0442", "percent": "0", "amount": "588", "status": "exec", "invoice_date": "2014-11-20 16:54:24", "old_id": null, "night": "0", "increase": "0", "discount": "0", "call": "0", "paid_amount": "588", "create_date": "2014-11-08 17:42:38" }, "good": { "id": "24540", "group_id": "71", "title": "aaaTest", "unit_storage_id": "9", "is_warehouse_account": "1", "is_active": "1", "code": "", "is_call": "0", "is_for_sale": "1", "barcode": "222222222", "remove_from_store_without_prihod": "1", "category_id": "6" }, "goodSaleParam": { "id": "114658", "good_id": "24540", "price": "111", "coefficient": "1", "unit_sale_id": "9", "min_price": "0", "max_price": "0", "barcode": "123456789", "status": "active", "clinic_id": "1", "markup": "0", "unitSale": { "id": "9", "title": "\u0433\u0440", "status": "active" } }, "party_info": [{ "party_id": "68", "party_exec_date": "2014-05-06 17:47:21", "store_id": "1", "good_id": "24540", "characteristic_id": "17", "quantity": "2", "price": "4" }] } }
}
Пример invoice по всем счетам
curl -i -H "Accept: application/json" -H "X-REST-API-KEY: 950a183ccebb639d464c04ed4b70528b" http://example/rest/api/invoice/
}
{ "success":true, "message":"Records Retrieved Successfully", "data":{ "totalCount":"194", "invoice":[ { "id": "4", "doctor_id": "1", "client_id": "1", "pet_id": "1", "description": "", "percent": "-3.0000000000", "amount": "153.2600000000", "status": "exec", "invoice_date": "2017-12-27 17:28:30", "old_id": null, "night": "0", "increase": "0.0000000000", "discount": "3.0000000000", "call": "0", "paid_amount": "153.2600000000", "create_date": "2017-12-27 17:28:15", "payment_status": "full", "clinic_id": "1", "creator_id": null, "client": { "id": "1", "address": "", "home_phone": "", "work_phone": "", "note": "", "type_id": "3", "how_find": "15", "balance": "0.0000000000", "email": "[email protected]", "city": "", "city_id": "251", "date_register": "2012-09-29 09:14:34", "cell_phone": "2321312311", "zip": "", "registration_index": null, "vip": "0", "last_name": "Тестов", "first_name": "Тест", "middle_name": "Тестович", "status": "DISABLED", "discount": "3", "passport_series": "", "lab_number": "", "street_id": "0", "apartment": "", "unsubscribe": "0", "in_blacklist": "0", "last_visit_date": "2017-12-27 17:28:15", "number_of_journal": "", "phone_prefix": "" }, "pet": { "id": "1", "owner_id": "1", "type_id": "9", "alias": "Тестик", "sex": "male", "date_register": "2013-10-17 10:24:05", "birthday": "2012-09-02", "note": "", "breed_id": "331", "old_id": null, "color_id": "1", "deathnote": null, "deathdate": null, "chip_number": "", "lab_number": "vm1", "status": "alive", "picture": null, "weight": "5.0000000000" }, "doctor": { "id": "1", "last_name": "Сидоров", "first_name": "Сидр", "middle_name": "Сидорович", "login": "admin", "passwd": "e12e2271792a4bfd3cd819ed544e33d9", "position_id": "8", "email": "serekoso[email protected]", "phone": "", "cell_phone": "", "address": "", "role_id": "7", "is_active": "1", "calc_percents": "1", "nickname": "Сидоров С.С.", "last_visit": "2015-06-30 13:34:49", "youtrack_login": "", "youtrack_password": "", "last_change_pwd_date": "0000-00-00", "is_limited": "0", "carrotquest_id": "serekonvc:1", "sip_number": "" } }, { "id": "5", "doctor_id": "1", "client_id": "1271", "pet_id": "1311", "description": "", "percent": "0.0000000000", "amount": "5750.6900000000", "status": "exec", "invoice_date": "2018-02-26 12:26:40", "old_id": null, "night": "0", "increase": "0.0000000000", "discount": "0.0000000000", "call": "0", "paid_amount": "5750.6900000000", "create_date": "2018-02-26 12:19:25", "payment_status": "full", "clinic_id": "1", "creator_id": null, "client": { "id": "1271", "address": "", "home_phone": "", "work_phone": "", "note": "", "type_id": "1", "how_find": null, "balance": "0.0000000000", "email": "", "city": "", "city_id": "252", "date_register": "2018-01-15 13:21:32", "cell_phone": "9099441613", "zip": "", "registration_index": null, "vip": "0", "last_name": "Акимов", "first_name": "Алексей", "middle_name": "Викторович", "status": "DISABLED", "discount": "0", "passport_series": "", "lab_number": "", "street_id": "0", "apartment": "", "unsubscribe": "0", "in_blacklist": "0", "last_visit_date": "2018-05-07 14:49:40", "number_of_journal": "024852959595", "phone_prefix": "" }, "pet": { "id": "1311", "owner_id": "1271", "type_id": "9", "alias": "ума", "sex": "unknown", "date_register": "2018-01-15 13:21:32", "birthday": "2017-03-22", "note": "", "breed_id": "777", "old_id": null, "color_id": null, "deathnote": null, "deathdate": null, "chip_number": null, "lab_number": "", "status": "alive", "picture": null, "weight": "0.0000000000" }, "doctor": { "id": "1", "last_name": "Сидоров", "first_name": "Сидр", "middle_name": "Сидорович", "login": "admin", "passwd": "e12e2271792a4bfd3cd819ed544e33d9", "position_id": "8", "email": "[email protected]", "phone": "", "cell_phone": "", "address": "", "role_id": "7", "is_active": "1", "calc_percents": "1", "nickname": "Сидоров С.С.", "last_visit": "2015-06-30 13:34:49", "youtrack_login": "", "youtrack_password": "", "last_change_pwd_date": "0000-00-00", "is_limited": "0", "carrotquest_id": "serekonvc:1", "sip_number": "" } } ] } }