def _update_pwd(self): pwd_one = get_table_cell(self.super_user_pwd_table, 1, 1) pwd_two = get_table_cell(self.super_user_pwd_table, 2, 1) old_pwd = get_table_cell(self.super_user_pwd_table, 0, 1) if old_pwd == "": QtWidgets.QMessageBox.information(self.update_super_user_pwd, "提示", "原密码不能为空") elif pwd_one == "": QtWidgets.QMessageBox.information(self.update_super_user_pwd, "提示", "密码不能为空") elif pwd_one != pwd_two: QtWidgets.QMessageBox.information(self.update_super_user_pwd, "提示", "两次输入密码不一致") else: pwd_one += 'udontknowwhy' pwd_one = md5(pwd_one) old_pwd += 'udontknowwhy' old_pwd = md5(old_pwd) if update_super_user_pwd(pwd_one, old_pwd): QtWidgets.QMessageBox.information(self.update_super_user_pwd, "提示", "修改成功") print("密码修改成功") model = self.super_user_pwd_table.model() model.setItem(0, 1, QStandardItem("")) model.setItem(1, 1, QStandardItem("")) model.setItem(2, 1, QStandardItem("")) self.super_user_pwd_table.setModel(model) else: QtWidgets.QMessageBox.information(self.update_super_user_pwd, "提示", "原密码输入有误")
def show_detail(self, index: QModelIndex): if index.column() != 14: return self.sale_id = table_utils.get_table_cell(self.write_off_table, index.row(), 0) self.stock_id = table_utils.get_table_current_index_info( self.write_off_table, 9) self.brand_id = table_utils.get_table_current_index_info( self.write_off_table, 7) self.model_id = table_utils.get_table_current_index_info( self.write_off_table, 8) self.buy_date.setDateTime( QDateTime.fromString(time_utils.get_now(), 'yyyy-MM-dd hh:mm:ss')) self.brand.setText( table_utils.get_table_current_index_info(self.write_off_table, 2)) self.model.setText( table_utils.get_table_current_index_info(self.write_off_table, 3)) self.sale_number.setText( table_utils.get_table_current_index_info(self.write_off_table, 4)) balance = int( table_utils.get_table_current_index_info(self.write_off_table, 5)) self.buy_number.setValue(abs(balance)) self.unit.setText( table_utils.get_table_current_index_info(self.write_off_table, 6)) self.service.setText( table_utils.get_table_current_index_info(self.write_off_table, 10) + '-' + table_utils.get_table_current_index_info(self.write_off_table, 12)) self.price.setText('0.0') self.total.setText('0.0') self.paid.setText('0.0') self.unpaid.setText('0.0') self.balance = balance
def bulk_pay(self): total = self.summary_need_pay.text() if not total or not Decimal(total): QMessageBox.information(self.bulk_button, '提示', '请勾选需要付款的进货信息!') return buys = [] for index, state in enumerate(self.detail_table_cell_check_state): if state: unpaid = Decimal(table_utils.get_table_cell(self.detail_table, index, 9)) paid = Decimal(table_utils.get_table_cell(self.detail_table, index, 8)) buy_id = int(table_utils.get_table_cell(self.detail_table, index, 10)) buys.append((buy_id, unpaid + paid, 0.0)) dialog = SupplierBulkPayOff(buys, total, self.supplier_name) dialog.exec() self._init_table()
def _refresh_detail_table(self, summary_table_index): if not summary_table_index: record = () else: supplier_id = table_utils.get_table_cell(self.summary_table, summary_table_index.row(), 0) if supplier_id: record = payment_handler.get_arrears_info_buy(supplier_id) self.supplier_name = table_utils.get_table_cell(self.summary_table, summary_table_index.row(), 1) else: record = () table_utils.set_table_widget_content(self.detail_table, record, self.detail_table_title, True) self.detail_table.setColumnHidden(10, True) if record: self.detail_table.resizeColumnsToContents() self.detail_table_cell_check_state.clear() self.detail_table_cell_check_state = [False] * len(record) self.summary_need_pay.setText('0.0')
def _save_store_pc_info(self): register_id = get_table_cell(self.store_pc_info_table, 0, 1) store_phone = get_table_cell(self.store_pc_info_table, 1, 1) address = get_table_cell(self.store_pc_info_table, 2, 1) if register_id == "": QtWidgets.QMessageBox.information(self.store_pc_info_save, "提示", "标识不能为空") elif address == "": QtWidgets.QMessageBox.information(self.store_pc_info_save, "提示", "地址不能为空") elif store_phone == "": QtWidgets.QMessageBox.information(self.store_pc_info_save, "提示", "联系方式不能为空") else: req = update_store_pc_info(register_id, address, store_phone) if req: QtWidgets.QMessageBox.information(self.store_pc_info_save, "提示", "修改成功") self.remote_data = get_store_info() print(self.remote_data.get("data")) self._init_all_table() else: QtWidgets.QMessageBox.information(self.updateWorker, "提示", "修改失败")