Пример #1
0
    def general_custom_send_report(self):
        RG = ReportGeneraler(input_file_path=self.path_openfile_name)
        RG.file_path_check(output_file_path=self.output_path)

        print(self.SendDatatype.currentText())
        _temp_sendtype = self.SendDatatype.currentText()
        sendtype_dict = {
            "日":0,
            "周":1,
            "月":2
        }

        SendMail_Info_Path, Send_df_state = RG.send_file_table_output(
            StartDate=self.StartDate.text(),
            EndDate=self.EndDate.text(),
            output_type=sendtype_dict[_temp_sendtype],
            if_mail=True
        )

        self.SendMailPath_Info = SendMail_Info_Path
        self.SendMail_Info_state = Send_df_state

        if Send_df_state:
            self.creat_table_show(file_path=SendMail_Info_Path)
        else:
            self.tempSendTable.show()
Пример #2
0
    def creat_table_show(self):
        self.ExcelFilesState.setText('{:<40}'.format(path_openfile_name))
        # ===========读取表格,转换表格,===========================================
        if len(path_openfile_name) > 0:
            RG = ReportGeneraler(input_file_path=path_openfile_name)
            file_check = RG.input_file_check()
            print(file_check)
            if file_check is not True:
                self.ExcelFilesState.setText('{:<40}'.format(file_check))
                print(1)
                return
            else:
                input_table = RG.file_data_adj()
                self.ExcelFilesState.setText('{:<40}'.format('成功打开文件'))

        # print(input_table)
            input_table_rows = input_table.shape[0]
            input_table_colunms = input_table.shape[1]
        # print(input_table_rows)
        # print(input_table_colunms)
            input_table_header = input_table.columns.values.tolist()
        # print(input_table_header)

        # ===========读取表格,转换表格,============================================
        # ======================给tablewidget设置行列表头============================

            self.OutPutTableView.setColumnCount(input_table_colunms)
            self.OutPutTableView.setRowCount(input_table_rows)
            self.OutPutTableView.setHorizontalHeaderLabels(input_table_header)

        # ======================给tablewidget设置行列表头============================

        # ================遍历表格每个元素,同时添加到tablewidget中========================
            for i in range(input_table_rows):
                input_table_rows_values = input_table.iloc[[i]]
                # print(input_table_rows_values)
                input_table_rows_values_array = np.array(
                    input_table_rows_values)
                input_table_rows_values_list = input_table_rows_values_array.tolist()[
                    0]
            # print(input_table_rows_values_list)
                for j in range(input_table_colunms):
                    input_table_items_list = input_table_rows_values_list[j]
                # print(input_table_items_list)
                # print(type(input_table_items_list))

        # ==============将遍历的元素添加到tablewidget中并显示=======================

                    input_table_items = str(input_table_items_list)
                    newItem = QTableWidgetItem(input_table_items)
                    # newItem.setTextAlignment(Qt.AlignHCenter|Qt.AlignVCenter)
                    self.OutPutTableView.setItem(i, j, newItem)

        # ================遍历表格每个元素,同时添加到tablewidget中========================
        else:
            self.centralwidget.show()
Пример #3
0
    def general_weekly_send_report(self):
        SD = SeasonDict()
        RG = ReportGeneraler(input_file_path=self.path_openfile_name)
        RG.file_path_check(output_file_path = self.output_path)
        SendMail_Info_Path,Send_df_state = RG.send_file_table_output(
            StartDate=SD['week'],
            EndDate=SD['week'],
            output_type=1,
            if_mail=True
        )
        self.SendMailPath_Info = SendMail_Info_Path
        self.SendMail_Info_state = Send_df_state

        if Send_df_state:
            self.creat_table_show(file_path=SendMail_Info_Path)
        else:
            self.tempSendTable.show()
Пример #4
0
 def save_output_month_file(self,):
     if hasattr(self, 'path_openfile_name'):
         RG = ReportGeneraler(input_file_path=self.path_openfile_name)
         RG.file_path_check(output_file_path=self.output_path)
         file_check = RG.input_file_check()
         if file_check is not True:
             self.ExcelFilesState.setText('{:<40}'.format(file_check))
         File_data = RG.input_data_check()
         if File_data is not True:
             self.ExcelFilesState.setText('{:<40}'.format(File_data))
         file_save_state = RG.file_data_excel_output(output_type=2)
         if file_save_state is not True:
             self.ExcelFilesState.setText('{:<40}'.format(file_save_state))
     else:
         self.ExcelFilesState.setText('{:<40}'.format('请选择文件'))