DW.get_receipts (eng) - datawizio/pythonAPI GitHub Wiki
Shows a list of products in every receipt, name and cost of a product in every receipt, cost of receipts and their issuing time.
Parameters:
-
products: int,list
id of the product or a list of ids that will be used for selection.
-
shops: int,list
id of the shop or a list of ids that will be used for selection.
-
weekday: int {monday - 0, sunday - 6}
day of the week that will be used for selection.
-
date_from: datetime, str {%Y-%m-%d}
starting date of selection.
-
date_to: datetime, str {%Y-%m-%d}
ending date of selection.
If the interval [date_from, date_to]
has not been set, last 30 client's days will be used for selection.
If only one parameter has been set, then 30 client's days from selected parameter will be used for selection.
type: str, {'full', 'short', 'info'}
Type of products output in a receipt default: 'full'
loyalty: int, list
id of the client or a list of ids of loyalty program clients
only_loyalty: bool, default: False
If True
, only receipts of loyalty program clients are returned
Returns:
Returns a list of receipts.
[
{
"receipt_id": <receipt_id>,
"date": <receipt_datetime>,
"cartitems": <cartitems>
"total_price": <total_price>
},
....
],
where 'cartitems' depends on the argument 'type'.
For type = "full" :
[
{
"product_id": <product_id>,
"product_name": <product_name>,
"category_id": <category_id>,
"category_name": <category_name>,
"qty": <qty>,
"price": <price>
},
{
"product_id": <product_id>,
"product_name": <product_name>,
"category_id": <category_id>,
"category_name": <category_name>,
"qty": <qty>,
"price": <price>
}
.....
]
for type = "short"
[<product1_id>, <product2_id>, ... , <productN_id>]</code>
for type = "info"
the function returns object 'DataFrame' organized as
date | loyalty_id | receipt_id | turnover |
<date> | <loyalty_id> | <receipt_id> | <turnover> |
Examples:
dw = datawiz.DW()
dw.get_receipts(categories = [50599, 50600],
shops = [305, 306, 318, 321],
date_from = datetime.date(2015, 8, 9),
date_to = datetime.date(2015, 9, 9),
type = "short")
Consequently, we have received all receipts including products that belong to the categories [50599, 50600], for shops [305, 306, 318, 321], for the period from 2015.8.9 till 2015.9.9 in concise form.