Attach Costco discounts to purchase rows
This commit is contained in:
@@ -33,6 +33,8 @@ PURCHASE_FIELDS = [
|
||||
"measure_type",
|
||||
"line_total",
|
||||
"unit_price",
|
||||
"matched_discount_amount",
|
||||
"net_line_total",
|
||||
"store_name",
|
||||
"store_number",
|
||||
"store_city",
|
||||
@@ -94,7 +96,7 @@ def decimal_or_zero(value):
|
||||
|
||||
|
||||
def derive_metrics(row):
|
||||
line_total = to_decimal(row.get("line_total"))
|
||||
line_total = to_decimal(row.get("net_line_total") or row.get("line_total"))
|
||||
qty = to_decimal(row.get("qty"))
|
||||
pack_qty = to_decimal(row.get("pack_qty"))
|
||||
size_value = to_decimal(row.get("size_value"))
|
||||
@@ -292,6 +294,8 @@ def build_purchase_rows(
|
||||
"measure_type": row["measure_type"],
|
||||
"line_total": row["line_total"],
|
||||
"unit_price": row["unit_price"],
|
||||
"matched_discount_amount": row.get("matched_discount_amount", ""),
|
||||
"net_line_total": row.get("net_line_total", ""),
|
||||
"store_name": order_row.get("store_name", ""),
|
||||
"store_number": order_row.get("store_number", ""),
|
||||
"store_city": order_row.get("store_city", ""),
|
||||
|
||||
Reference in New Issue
Block a user