fix - some improves on new excel transactions
This commit is contained in:
@@ -636,19 +636,16 @@ class WareHouseExcelViewSet(viewsets.ModelViewSet, ExcelDynamicSearchMixin):
|
||||
t_items = transaction_shares_map.get(t['id'], [])
|
||||
products_str = '، '.join([i['name'] for i in t_items]) if t_items else '-'
|
||||
|
||||
# جمع share totals هر تراکنش
|
||||
share_values = []
|
||||
for share_name in share_names:
|
||||
# print(t_items, '\n', share_name)
|
||||
for i in t_items:
|
||||
share_total = sum(
|
||||
share['price'] for share in i['item_share'] if share['name'] == share_name)
|
||||
share_values.append(share_total)
|
||||
share_column_totals[share_name] += share_total
|
||||
|
||||
# جمع کل
|
||||
total_price += t['price_paid'] or 0
|
||||
total_weight += sum(i['unit_price'] or 0 for i in t_items) # یا وزن واقعی اگر موجود باشه
|
||||
total_weight += sum(i['unit_price'] or 0 for i in t_items)
|
||||
all_weight += total_weight
|
||||
|
||||
list1 = [
|
||||
@@ -661,9 +658,9 @@ class WareHouseExcelViewSet(viewsets.ModelViewSet, ExcelDynamicSearchMixin):
|
||||
str(shamsi_date(t['transaction_date'], in_value=True)) if t.get('transaction_date') else '',
|
||||
products_str,
|
||||
t.get('transaction_id', '-'),
|
||||
'-', # شماره کارت اگر موجود باشه
|
||||
'-', # card
|
||||
t.get('price_paid', 0),
|
||||
f'{total_weight}کیلوگرم', # ماهیت وزن
|
||||
f'{total_weight}کیلوگرم',
|
||||
TRANSACTION_STATUS_MAP.get(t.get('transaction_status'), '-'),
|
||||
]
|
||||
list1.extend(share_values)
|
||||
|
||||
Reference in New Issue
Block a user