def updateTable(self): tableFunctions.setRowCount(self.vendor_table, self.vendor_df.shape[0]) tableFunctions.setColumnCount(self.vendor_table, self.vendor_df.shape[1]) tableFunctions.setHeaders(self.vendor_table, self.headers) for r, row in self.vendor_df.iterrows(): for c, item in enumerate(row): tableFunctions.setItem(self.vendor_table, r, c, str(item)) fileFunctions.writeCSV(self.vendor_df, self.vendor_list_file)
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)
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)