Esempio n. 1
0
 def calculateCost(self):
     try:
         quantity = int(self.quantity_le.text())
         idx = self.parts_cb.currentIndex()
         unit_price = self.inventory.inventory_df.unit_price[idx]
         total_cost = unit_price * quantity
         self.total_cost_label.setText(
             fileFunctions.formatCurrency(total_cost))
     except ValueError:
         self.total_cost_label.setText(fileFunctions.formatCurrency(0))
Esempio n. 2
0
 def updateProductsTable(self):
     headers = ["name", "count", "sale price", "cog"]
     tableFunctions.setRowCount(self.products_table, len(self.products))
     tableFunctions.setColumnCount(self.products_table, len(headers))
     tableFunctions.setHeaders(self.products_table, headers)
     for row, product in enumerate(self.products.keys()):
         count = self.products[product]["count"]
         sale_price = fileFunctions.formatCurrency(
             self.products[product]["sale price"])
         cog = fileFunctions.formatCurrency(self.calculateCOGS(product))
         tableFunctions.setItem(self.products_table, row, 0, product)
         tableFunctions.setItem(self.products_table, row, 1, str(count))
         tableFunctions.setItem(self.products_table, row, 2, sale_price)
         tableFunctions.setItem(self.products_table, row, 3, cog)
     fileFunctions.writeJSON(self.product_list_file, self.products)
Esempio n. 3
0
 def updateCategoryTable(self, category):
     table = self.tables[category]
     headers = ["item", "total"]
     sub_categories = self.income_statement[category]
     tableFunctions.setRowCount(table, len(sub_categories))
     tableFunctions.setColumnCount(table, len(headers))
     tableFunctions.setHeaders(table, headers)
     for row, sub_category in enumerate(sub_categories.keys()):
         value = fileFunctions.formatCurrency(sub_categories[sub_category])
         tableFunctions.setItem(table, row, 0, sub_category)
         tableFunctions.setItem(table, row, 1, value)
Esempio n. 4
0
 def updateTotalLabel(self, category):
     label = self.total_labels[category]
     value = fileFunctions.formatCurrency(self.totals[category])
     label.setText(value)
Esempio n. 5
0
 def calculateSalary(self):
     idx = self.employee_cb.currentIndex()
     salary = self.employee_list.employee_df.salary[idx] / 12.0
     self.monthly_salary_label.setText(fileFunctions.formatCurrency(salary))