def on_documents_add_button_enter_clicked(self, documents_add_button_enter): entries = [ "documents_add_entry_for", "documents_add_entry_ref", "documents_add_entry_name", "documents_add_entry_issue", "documents_add_entry_reason" ] text = Function.get_entries(self, entries) date = Cal_Date.date(self, "documents_add_calendar_date") doc = '' if self.file != None: file_name = text[2] file_settings = { "dep": "Procedures", "sub": text[0], "eal_ref": None } doc = Function.file_path2(self, self.file, file_name, file_settings) shutil.copy(self.file, doc) self.file_chooser.unselect_all() else: doc = "Not Uploaded" now = datetime.now() for item in self.current_items: row = list(item) if row[1] == text[1]: match = True break else: match = False if match == True: query = self.queries.documents["update"] values = (now, text[0], text[2], text[3], text[4], date, doc, text[1]) procedure = 'N/A' message = text[1] + ' updated field' log_query = self.queries.logbook["insert"] log_values = (now, text[0], now, text[4], text[3], message) self.update(query, values, log_query, log_values) elif match == False: query = self.queries.documents["insert"] values = (now, text[0], text[1], text[2], text[3], text[4], date, doc) log_query = self.queries.logbook["insert"] log_values = (now, text[1], date, "N/A", text[2], text[4]) self.insert(query, values, log_query, log_values) Function.clear_entries(self, entries)
def on_equipment_log_button_enter_clicked(self, equipment_log_button_enter): entries = [ "equipment_log_entry_eal", "equipment_log_entry_from", "equipment_log_entry_procedure", "equipment_log_entry_message" ] text = Function.get_entries(self, entries) log_date = Cal_Date.date(self, "equipment_log_calendar_date") now = datetime.now() log_values = (now, text[0], log_date, text[1], text[2], text[3]) log_query = self.queries.logbook["insert"] self.log_insert(log_query, log_values) Function.clear_entries(self, entries)
def on_equipment_add_button_add_clicked(self, equipment_add_button_add): entries = [ "equipment_add_entry_eal", "equipment_add_entry_type", "equipment_add_entry_manufacturer", "equipment_add_entry_model", "equipment_add_entry_pressure", "equipment_add_entry_serial" ] text = Function.get_entries(self, entries) now = datetime.now() for item in self.current_items: row = list(item) if row[0] == text[0]: match = True break else: match = False if match == True: query = self.queries.equipment["update"] utext = text[1:] utext.append(text[0]) values = (now, utext[0], utext[1], utext[2], utext[3], utext[4], utext[5]) location = 'Westcott' procedure = 'N/A' message = text[0] + ' updated field' log_query = self.queries.logbook["insert"] log_values = (now, text[0], now, location, procedure, message) self.update(query, values, log_query, log_values) elif match == False: values = (now, text[0], text[1], text[2], text[3], text[4], text[5]) location = 'Westcott' procedure = 'N/A' message = text[0] + ' added to equipment store' log_query = self.queries.logbook["insert"] log_values = (now, text[0], now, location, procedure, message) query = self.queries.equipment["insert"] self.insert(query, values, log_query, log_values) Function.clear_entries(self, entries)
def on_equipment_cleanliness_button_enter_clicked( self, equipment_cleanliness_button_enter): entries = [ "equipment_cleanliness_entry_eal", "equipment_cleanliness_entry_pco", "equipment_cleanliness_entry_dew", "equipment_cleanliness_entry_procedure", "equipment_cleanliness_entry_location" ] text = Function.get_entries(self, entries) clean_date = Cal_Date.date(self, "equipment_cleanliness_calendar_date") clean_expiry = Cal_Date.expiry(self, clean_date, 12) clean_recall = Cal_Date.recall(self, clean_expiry) clean_certificate = '' if self.file != None: file_name = 'Cleanliness_&_Dryness_Certificate_' + str(clean_date) file_settings = { "dep": "Equipment", "sub": "Cleanliness_&_Dryness", "eal_ref": text[0] } clean_certificate = Function.file_path2(self, self.file, file_name, file_settings) shutil.copy(self.file, clean_certificate) self.file_chooser.unselect_all() else: clean_certificate = "Not Uploaded" now = datetime.now() for item in self.current_items: row = list(item) if row[0] == text[0]: match = True break else: match = False if match == True: query = self.queries.cleanliness["update"] utext = text[1:] utext.append(text[0]) values = (now, utext[0], utext[1], utext[2], clean_date, clean_recall, clean_expiry, utext[3], self.result, clean_certificate, utext[4]) procedure = 'N/A' message = text[0] + ' updated field' log_query = self.queries.logbook["insert"] log_values = (now, text[0], now, text[4], text[3], message) self.update(query, values, log_query, log_values) elif match == False: message = "Cleanliness & Dryness certificate added." values = (now, text[0], text[1], text[2], text[3], clean_date, clean_recall, clean_expiry, text[4], self.result, clean_certificate) log_values = (now, text[0], now, text[4], text[3], message) query = self.queries.cleanliness["insert"] log_query = self.queries.logbook["insert"] self.insert(query, values, log_query, log_values) Function.clear_entries(self, entries)
def on_equipment_calibration_button_enter_clicked( self, equipment_calibration_button_enter): entries = [ "equipment_calibration_entry_eal", "equipment_calibration_entry_company" ] text = Function.get_entries(self, entries) print(text) calibration_type = self.type if (calibration_type == "External"): length = 12 elif (calibration_type == "Internal"): length = 6 else: length = 12 calibration_date = Cal_Date.date( self, "equipment_calibration_calendar_date") calibration_expiry = Cal_Date.expiry(self, calibration_date, length) calibration_recall = Cal_Date.recall(self, calibration_expiry) calibration_certificate = '' if self.file != None: file_name = 'Calibration_Certificate_' + str(calibration_date) file_settings = { "dep": "Equipment", "sub": "Calibration", "eal_ref": text[0] } calibration_certificate = Function.file_path2( self, self.file, file_name, file_settings) shutil.copy(self.file, calibration_certificate) self.file_chooser.unselect_all() else: calibration_certificate = "Not Uploaded" now = datetime.now() location = Function.get_entry(self, "equipment_calibration_entry_location") for item in self.current_items: row = list(item) if row[0] == text[0]: match = True break else: match = False if match == True: query = self.queries.calibration["update"] utext = text[1:] utext.append(text[0]) values = (now, utext[0], calibration_type, calibration_date, calibration_recall, calibration_expiry, calibration_certificate, utext[1]) procedure = 'N/A' message = text[0] + ' updated field' log_query = self.queries.logbook["insert"] log_values = (now, text[0], now, location, procedure, message) self.update(query, values, log_query, log_values) elif match == False: message = "Calibration certificate added." procedure = "N/A" values = (now, text[0], text[1], calibration_type, calibration_date, calibration_recall, calibration_expiry, calibration_certificate) log_values = (now, text[0], now, location, procedure, message) query = self.queries.calibration["insert"] log_query = self.queries.logbook["insert"] self.insert(query, values, log_query, log_values) Function.clear_entries(self, entries)