Add basic support for "sale" price
This commit is contained in:
parent
d933a6acbc
commit
7edceac934
|
@ -143,8 +143,11 @@ class WuttaTxnItem(WuttaControl):
|
||||||
self.sales_total_style.weight = None
|
self.sales_total_style.weight = None
|
||||||
else:
|
else:
|
||||||
if (self.row.row_type == self.enum.POS_ROW_TYPE_SELL
|
if (self.row.row_type == self.enum.POS_ROW_TYPE_SELL
|
||||||
and self.row.txn_price < self.row.reg_price):
|
and self.row.txn_price_adjusted):
|
||||||
self.sales_total_style.color = 'blue'
|
self.sales_total_style.color = 'orange'
|
||||||
|
elif (self.row.row_type == self.enum.POS_ROW_TYPE_SELL
|
||||||
|
and self.row.cur_price and self.row.cur_price < self.row.reg_price):
|
||||||
|
self.sales_total_style.color = 'green'
|
||||||
else:
|
else:
|
||||||
self.sales_total_style.color = None
|
self.sales_total_style.color = None
|
||||||
self.sales_total_style.decoration = None
|
self.sales_total_style.decoration = None
|
||||||
|
|
|
@ -1166,12 +1166,28 @@ class POSView(WuttaView):
|
||||||
self.clear_item_selection()
|
self.clear_item_selection()
|
||||||
self.reset()
|
self.reset()
|
||||||
|
|
||||||
price_override = ft.TextField(value=self.main_input.value,
|
row = self.selected_item.data['row']
|
||||||
|
|
||||||
|
price = f'{row.txn_price:0.2f}'
|
||||||
|
if self.main_input.value:
|
||||||
|
try:
|
||||||
|
price = decimal.Decimal(self.main_input.value)
|
||||||
|
except decimal.InvalidOperation:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
price = f'{price:0.2f}'
|
||||||
|
|
||||||
|
price_override = ft.TextField(value=price,
|
||||||
text_size=32,
|
text_size=32,
|
||||||
text_style=ft.TextStyle(weight=ft.FontWeight.BOLD),
|
text_style=ft.TextStyle(weight=ft.FontWeight.BOLD),
|
||||||
autofocus=True,
|
autofocus=True,
|
||||||
on_submit=confirm)
|
on_submit=confirm)
|
||||||
|
|
||||||
|
current_price = self.app.render_currency(row.cur_price)
|
||||||
|
if current_price:
|
||||||
|
current_price += ' [{}]'.format(self.enum.PRICE_TYPE.get(row.cur_price_type,
|
||||||
|
row.cur_price_type))
|
||||||
|
|
||||||
dlg = ft.AlertDialog(
|
dlg = ft.AlertDialog(
|
||||||
modal=True,
|
modal=True,
|
||||||
title=ft.Text("Adjust Price"),
|
title=ft.Text("Adjust Price"),
|
||||||
|
@ -1183,25 +1199,25 @@ class POSView(WuttaView):
|
||||||
[
|
[
|
||||||
ft.Text("Reg Price:",
|
ft.Text("Reg Price:",
|
||||||
size=32, weight=ft.FontWeight.BOLD),
|
size=32, weight=ft.FontWeight.BOLD),
|
||||||
ft.Text(self.app.render_currency(self.selected_item.data['row'].reg_price),
|
ft.Text(self.app.render_currency(row.reg_price),
|
||||||
size=32, weight=ft.FontWeight.BOLD),
|
size=32, weight=ft.FontWeight.BOLD),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
ft.Row(),
|
ft.Row(),
|
||||||
|
ft.Row(
|
||||||
|
[
|
||||||
|
ft.Text("Cur Price:",
|
||||||
|
size=32, weight=ft.FontWeight.BOLD),
|
||||||
|
ft.Text(current_price,
|
||||||
|
size=32, weight=ft.FontWeight.BOLD),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
ft.Row(),
|
||||||
|
ft.Row(),
|
||||||
ft.Row(
|
ft.Row(
|
||||||
[
|
[
|
||||||
ft.Text("Txn Price:",
|
ft.Text("Txn Price:",
|
||||||
size=32, weight=ft.FontWeight.BOLD),
|
size=32, weight=ft.FontWeight.BOLD),
|
||||||
ft.Text(self.app.render_currency(self.selected_item.data['row'].txn_price),
|
|
||||||
size=32, weight=ft.FontWeight.BOLD),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
ft.Row(),
|
|
||||||
ft.Row(),
|
|
||||||
ft.Row(
|
|
||||||
[
|
|
||||||
ft.Text("New Price:",
|
|
||||||
size=32, weight=ft.FontWeight.BOLD),
|
|
||||||
ft.VerticalDivider(),
|
ft.VerticalDivider(),
|
||||||
ft.Text("$", size=32, weight=ft.FontWeight.BOLD),
|
ft.Text("$", size=32, weight=ft.FontWeight.BOLD),
|
||||||
price_override,
|
price_override,
|
||||||
|
|
Loading…
Reference in a new issue