def on_edit_customer_print_card_button_clicked(self, *args): id_card = render_pdf.build_id_card( customer_info=local_storage.read_customer_info(self.customer_id), customer_photo_filepath=local_storage.customer_photo_filepath(self.customer_id), pdf_filepath=os.path.join(local_storage.customer_dir(self.customer_id), 'id_card.pdf'), ) system.open_system_explorer(id_card['filename'])
def on_print_csv_transactions_button_clicked(self): selected_month = self.ids.select_month_button.text selected_year = self.ids.select_year_button.text if selected_month != '-' and selected_year == '-': return selected_transactions = [] for t in local_storage.load_transactions_list(): if t.get('blockchain_status') != 'confirmed': continue if selected_year != '-' and not t['date'].endswith(selected_year): continue if selected_month != '-' and not t['date'].startswith( selected_month[:3]): continue selected_transactions.append(t) output_filename = 'transactions' if selected_year != '-': output_filename += '_' + selected_year if selected_month != '-': output_filename += '_' + selected_month output_filename += '.csv' csv_report_filename = render_csv.build_transactions_report( selected_transactions=selected_transactions, csv_filepath=os.path.join(local_storage.reports_dir(), output_filename), ) system.open_system_explorer(csv_report_filename, as_folder=True)
def on_pdf_file_button_clicked(self): cur_settings = local_storage.read_settings() transaction_details = local_storage.read_transaction( self.transaction_id) if transaction_details: buy_contract = render_pdf.build_pdf_contract( transaction_details=transaction_details, disclosure_statement=cur_settings.get('disclosure_statement') or '', pdf_filepath=os.path.join( local_storage.contracts_dir(), 'transaction_{}.pdf'.format(self.transaction_id)), ) system.open_system_explorer(buy_contract['filename'])
def on_edit_customer_open_folder_button_clicked(self, *args): system.open_system_explorer(local_storage.customer_dir(self.customer_id))