Доступ к товарам и услугам
Структура моделей, назначение полей
Модель Good(инфо. товара/услуги)
Модель Good — представляет товар, услугу, сейчас небольшими доработками внедряется поддержка прочих ТМЦ.
* @property integer $id // ИД продукта * @property integer $group_id // ИД группы в которой находится продукт - Принадлежит GoodGroup * @property string $title // Название товара * @property integer $unit_storage_id // Единица в которой товар хранится на складе - Принадлежит Unit * @property integer $is_warehouse_account // Вести учет этого товара на складе? * @property integer $is_active // Товар активен? * @property string $code // Артикул товара * @property integer $category_id // ИД Категории для зарплаты, если она переопределяется у товара * @property integer $is_call // Относится ли этот товар или услуга к вызову * @property string $barcode // Штрихкод товара * @property integer $is_for_sale // Подлежит ли товар продаже?
Содержит многие GoodSaleParam
Модель GoodGroup(инфо. группы товара/услуги)
Модель GoodGroup — предствляет группу товаров или услуг
* @property integer $id // ИД групы * @property string $title // Название группы * @property integer $price_id // ИД категории (наименование будет изменено, использовать не рекомендуется) * @property integer $is_service // Группа товаров, или услуг * @property double $markup // Наценка на группу товаров, справочное поле для склада
Модель GoodSaleParam(параметры продажи товара)
Модель GoodSaleParam — представляет параметр продажи
* @property integer $id // ИД * @property integer $good_id // ИД товара - Принадлежит Good * @property double $price // Цена основная * @property double $coefficient // Коэффициент пересчета для списания со склада. * @property integer $unit_sale_id // ИД. ед. измерения - принадлежит Unit * @property double $min_price // Минимальная цена - указывается для возможности редактирования цены прям со счета * @property double $max_price // Максимальная цена - указывается для возможности редактирования цены прям со счета * @property string $barcode // Штрих-код * @property string $status // Статус ('active','disabled') * @property int $clinic_id // ИД Клиники
Модель Unit(ед. измерения)
Модель Unit — представляет единицу измерения
* @property integer $id //ИД * @property string $title // Название
Примеры запросов
Общие сведения о запросах к API
Пример Good
curl -i -H "Accept: application/json" -H "X-REST-API-KEY: 950a183ccebb639d464c04ed4b70528b" http:/example/rest/api/good/1
{
"success":true ,"message":"Record Retrieved Successfully" ,"data": { "totalCount":1 ,"good" : { "id":"1" ,"group_id":"45" ,"title":"\u0411\u0438\u043e\u0432\u0430\u043a DPAL" ,"unit_storage_id":null ,"is_warehouse_account":"0" ,"is_active":"1" ,"code":null ,"is_call":"0" ,"is_for_sale":"1" ,"barcode":null ,"category_id":"1" ,"group" : { "id":"45" ,"title":"\u0412\u0430\u043a\u0446\u0438\u043d\u044b" ,"is_service":"0" ,"markup":null ,"price_id":"1" } , "goodSaleParams":[ { "id":"1" ,"good_id":"1" ,"price":"240" ,"coefficient":"1" ,"unit_sale_id":"0" ,"min_price":"240" ,"max_price":"240" ,"barcode":null } ] } }
}
Пример goodGroup
- curl -i -H «Accept: application/json» -H «X-REST-API-KEY: 950a183ccebb639d464c04ed4b70528b» http://example/rest/api/goodGroup/68
{"success":true,"message":"Record Retrieved Successfully","data":{"totalCount":1,"goodGroup":{"id":"68","title":"\u041c\u0435\u0434\u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b","is_service":"0","markup":"7","price_id":null}}}
Пример goodSaleParam
- curl -i -H «Accept: application/json» -H «X-REST-API-KEY: 950a183ccebb639d464c04ed4b70528b» http://example/rest/api/goodSaleParam/1
{"success":true,"message":"Record Retrieved Successfully","data":{"totalCount":1,"goodSaleParam":{"id":"1","good_id":"1","price":"240","coefficient":"1","unit_sale_id":"0","min_price":"240","max_price":"240","barcode":null,"unitSale":{"id":"0","title":"\u0435\u0434\u0438\u043d\u0438\u0446\u0430"},"good":{"id":"1","group_id":"45","title":"\u0411\u0438\u043e\u0432\u0430\u043a DPAL","unit_storage_id":null,"is_warehouse_account":"0","is_active":"1","code":null,"is_call":"0","is_for_sale":"1","barcode":null,"category_id":"1"}}}}
Пример unit
- curl -i -H «Accept: application/json» -H «X-REST-API-KEY: 950a183ccebb639d464c04ed4b70528b» http://example/rest/api/unit/1
{"success":true,"message":"Record Retrieved Successfully","data":{"totalCount":1,"unit":{"id":"1","title":"\u043b\u0438\u0442\u0440"}}}
Пример получения цены продажи
curl -X GET 'http://example/rest/api/Good/GoodSalePriceByIdSaleParamIdClinicId/?good_id=1&good_sale_param_id=1&clinic_id=1&quantity=1' -H "Accept: application/json" -H "X-REST-API-KEY: *******"
{
"success": true, "message": "Records Retrieved Successfully", "data": { "totalCount": 3, "good_sale_price_info": { "price": 240, "min_price": "0", "max_price": "0" } }
}