add names suggestions
This commit is contained in:
@@ -140,20 +140,29 @@ class GoodsReception:
|
|||||||
|
|
||||||
self.products_table = ft.DataTable(
|
self.products_table = ft.DataTable(
|
||||||
columns=[
|
columns=[
|
||||||
ft.DataColumn(ft.Text("Produs")),
|
ft.DataColumn(ft.Text("Produs", weight=ft.FontWeight.BOLD)),
|
||||||
ft.DataColumn(ft.Text("Cantitate")),
|
ft.DataColumn(ft.Text("Cantitate", weight=ft.FontWeight.BOLD)),
|
||||||
ft.DataColumn(ft.Text("Unitate\nde masura")),
|
ft.DataColumn(ft.Text("Unitate\nde masura", weight=ft.FontWeight.BOLD)),
|
||||||
ft.DataColumn(ft.Text("Pret\nfara TVA")),
|
ft.DataColumn(ft.Text("Pret\nfara TVA", weight=ft.FontWeight.BOLD)),
|
||||||
ft.DataColumn(ft.Text("Procent\nTVA(%)")),
|
ft.DataColumn(ft.Text("Procent\nTVA(%)", weight=ft.FontWeight.BOLD)),
|
||||||
ft.DataColumn(ft.Text("Pret\nproduse")),
|
ft.DataColumn(ft.Text("Pret\nproduse", weight=ft.FontWeight.BOLD)),
|
||||||
ft.DataColumn(ft.Text("Valoare\nTVA")),
|
ft.DataColumn(ft.Text("Valoare\nTVA", weight=ft.FontWeight.BOLD)),
|
||||||
ft.DataColumn(ft.Text("Pret\nfinal")),
|
ft.DataColumn(ft.Text("Pret\nfinal", weight=ft.FontWeight.BOLD)),
|
||||||
],
|
],
|
||||||
rows=[]
|
rows=[]
|
||||||
)
|
)
|
||||||
|
|
||||||
self.placeholder = ft.Column([self.products_table], width=900, scroll=ft.ScrollMode.ADAPTIVE, height=600)
|
self.placeholder = ft.Column([self.products_table, self.total], width=900, scroll=ft.ScrollMode.ADAPTIVE, height=600)
|
||||||
self.all_procuts = None
|
self.all_procuts = None
|
||||||
|
self.total = ft.Text("", weight=ft.FontWeight.BOLD)
|
||||||
|
|
||||||
|
def set_total(self):
|
||||||
|
tl = 0
|
||||||
|
all_products = self.bulk_products_manager.get_products_by_bill_id(self.selected_bill['id'])
|
||||||
|
for product in all_products:
|
||||||
|
tl += round((product['price']*product['quantity'])*product['vat']/100+(product['price']*product['quantity']),2)
|
||||||
|
self.total.value = f'Total: {tl}'
|
||||||
|
self.total.update()
|
||||||
|
|
||||||
def search_for_product_name(self, e):
|
def search_for_product_name(self, e):
|
||||||
produts_names = []
|
produts_names = []
|
||||||
@@ -166,7 +175,7 @@ class GoodsReception:
|
|||||||
self.product_suggestions.update()
|
self.product_suggestions.update()
|
||||||
|
|
||||||
def show_bill_products(self):
|
def show_bill_products(self):
|
||||||
all_products = self.bulk_products_manager.get_products_by_bill_id(self.selected_bill['id'])[::-1]
|
all_products = self.bulk_products_manager.get_products_by_bill_id(self.selected_bill['id'])
|
||||||
print(all_products)
|
print(all_products)
|
||||||
self.products_table.rows.clear()
|
self.products_table.rows.clear()
|
||||||
for product in all_products:
|
for product in all_products:
|
||||||
@@ -207,6 +216,7 @@ class GoodsReception:
|
|||||||
self.reset_values()
|
self.reset_values()
|
||||||
self.page.close(self.add_product_dialog)
|
self.page.close(self.add_product_dialog)
|
||||||
self.show_bill_products()
|
self.show_bill_products()
|
||||||
|
self.set_total()
|
||||||
|
|
||||||
def on_cancel_product_btn_click(self, e):
|
def on_cancel_product_btn_click(self, e):
|
||||||
self.reset_values()
|
self.reset_values()
|
||||||
@@ -244,6 +254,7 @@ class GoodsReception:
|
|||||||
def on_view_list_btn_click(self, item):
|
def on_view_list_btn_click(self, item):
|
||||||
self.selected_bill = item
|
self.selected_bill = item
|
||||||
self.show_bill_products()
|
self.show_bill_products()
|
||||||
|
self.set_total()
|
||||||
|
|
||||||
def on_edit_provider_bill_btn_click(self, item):
|
def on_edit_provider_bill_btn_click(self, item):
|
||||||
self.edit_item = item
|
self.edit_item = item
|
||||||
|
|||||||
Reference in New Issue
Block a user