void dlgReports::report_team(int teamID) { Document xl; QString teamNote = App::theApp()->db_value(QString("SELECT note FROM teams WHERE id=%1;").arg(teamID), 0).toString(); xl.addSheet(teamNote); Worksheet *sh = xl.currentWorksheet(); QString q_head = QString("call p_Report_head('%1','%2');") .arg(_dateA.toString("yyyy-MM-dd")) .arg(_dateZ.toString("yyyy-MM-dd")); queryToSheetHeader(sh, q_head); QString q_team = QString("call p_Report_team('%1','%2', %3);") .arg(_dateA.toString("yyyy-MM-dd")) .arg(_dateZ.toString("yyyy-MM-dd")) .arg(teamID); queryToSheet(sh, q_team); save_report(xl, "team_" + teamNote); qDebug() << "report_team ok!"; }
void dlgReports::report_full() { Document xl; xl.addSheet("full"); Worksheet *sh = xl.currentWorksheet(); QString q_full_head = QString("call p_Report_full_head('%1','%2');") .arg(_dateA.toString("yyyy-MM-dd")) .arg(_dateZ.toString("yyyy-MM-dd")); queryToSheetHeader(sh, q_full_head); QString q_full = QString("call p_Report_full('%1','%2');") .arg(_dateA.toString("yyyy-MM-dd")) .arg(_dateZ.toString("yyyy-MM-dd")); int r(5); int c = queryToSheet(sh, q_full) + 2; QSqlQuery q_stat = App::theApp()->db_query(QString("call p_showStat_report('%1','%2');").arg(_dateA.toString("yyyy-MM-dd")).arg(_dateZ.toString("yyyy-MM-dd"))); while (q_stat.next()) { xl.write(r, c, q_stat.value(0)); xl.write(r, c + 1, q_stat.value(1)); r++; } save_report(xl, "full"); qDebug() << "report_full ok!"; }
void dlgReports::report_simple() { Document xl; xl.addSheet("simple"); Worksheet *sh = xl.currentWorksheet(); QString q_head = QString("call p_Report_head('%1','%2');") .arg(_dateA.toString("yyyy-MM-dd")) .arg(_dateZ.toString("yyyy-MM-dd")); queryToSheetHeader(sh, q_head); QString q_simple = QString("call p_Report_simple('%1','%2');") .arg(_dateA.toString("yyyy-MM-dd")) .arg(_dateZ.toString("yyyy-MM-dd")); queryToSheet(sh, q_simple); save_report(xl, "simple"); qDebug() << "report_simple ok!"; }
void dlgReports::report_sign() { Document xl(App::theApp()->tmplPath() + "tmpl_sign.xlsx"); Worksheet *sh; // Лист "Финал" view --> viewReport_sign_total; xl.selectSheet("Финал"); sh = xl.currentWorksheet(); sh->write("A3", QString(xl.read("A3").toString()).arg(_dateA.toString("dd.MM.yyyy")).arg(_dateZ.toString("dd.MM.yyyy"))); sh->write("O4", QString(xl.read("O4").toString()).arg(_dateX.toString("dd.MM.yyyy"))); int r1_t(10); int r2_t(0); QString q_total = QString("call p_Report_sign_total('%1','%2');") .arg(_dateA.toString("yyyy-MM-dd")) .arg(_dateZ.toString("yyyy-MM-dd")); queryToSheet(sh, q_total, r1_t, r2_t); r1_t++; sh->write(r2_t, 9, QString("=COUNT(I%1:I%2)").arg(r1_t).arg(r2_t - 1)); sh->write(r2_t,10, QString("=COUNT(J%1:J%2)").arg(r1_t).arg(r2_t - 1)); sh->write(r2_t,11, QString("=COUNT(K%1:K%2)").arg(r1_t).arg(r2_t - 1)); sh->write(r2_t,12, QString("=COUNT(L%1:L%2)").arg(r1_t).arg(r2_t - 1)); sh->write(r2_t,13, QString("=COUNT(M%1:M%2)").arg(r1_t).arg(r2_t - 1)); // Лист "Свод" view --> viewReport_sign_stat; xl.selectSheet("Свод"); sh = xl.currentWorksheet(); sh->write("A3", QString(xl.read("A3").toString()).arg(_dateA.toString("dd.MM.yyyy")).arg(_dateZ.toString("dd.MM.yyyy"))); int r1_s(5); int r2_s(0); QString q_stat = QString("call p_Report_sign_stat('%1','%2');") .arg(_dateA.toString("yyyy-MM-dd")) .arg(_dateZ.toString("yyyy-MM-dd")); queryToSheet(sh, q_stat, r1_s, r2_s); r1_s++; sh->write(r2_s, 8, QString("=SUM(H%1:H%2)").arg(r1_s).arg(r2_s - 1)); xl.selectSheet("Финал"); save_report(xl, "sign"); qDebug() << "report_sign ok!"; }
Chart_base_display_controls::Chart_base_display_controls( QWidget *parent) : Chart_base(parent) { //Add the vtk rendering window qvtkWidget_ = new QVTKWidget(this); context_view_ = vtkSmartPointer<vtkContextView>::New(); context_view_->SetInteractor(qvtkWidget_->GetInteractor()); qvtkWidget_->SetRenderWindow(context_view_->GetRenderWindow()); chart_ = vtkSmartPointer<vtkChartXY>::New(); context_view_->GetScene()->AddItem(chart_); chart_control_ = new Chart_display_control( this ); report_frame_ = new QFrame(this); view_report_button_ = new QPushButton("View Report",this); save_report_button_ = new QPushButton("Save Report",this); save_figure_button_ = new QPushButton("Save Figure",this); QHBoxLayout* report_layout = new QHBoxLayout(report_frame_); report_layout->addStretch(); report_layout->addWidget(save_figure_button_); report_layout->addWidget(save_report_button_); report_layout->addWidget(view_report_button_); report_frame_->setLayout(report_layout); connect( chart_control_, SIGNAL(xaxis_label_changed(const QString&)), this, SLOT(set_x_axis_label(const QString&)) ); connect( chart_control_, SIGNAL(yaxis_label_changed(const QString&)), this, SLOT(set_y_axis_label(const QString&)) ); connect( chart_control_, SIGNAL(title_changed(const QString&)), this, SLOT(set_title(const QString&)) ); connect( chart_control_, SIGNAL(legend_display_changed(bool)), this, SLOT(set_legend(bool)) ); connect( chart_control_, SIGNAL(grid_display_changed(bool)), this, SLOT(set_grid(bool)) ); connect( chart_control_, SIGNAL(x_grid_display_changed(bool)), this, SLOT(set_x_grid(bool)) ); connect( chart_control_, SIGNAL(y_grid_display_changed(bool)), this, SLOT(set_y_grid(bool)) ); bool ok = connect( chart_control_, SIGNAL(x_axis_font_size(int)), this, SLOT(set_x_axis_font_size(int)) ); ok = connect( chart_control_, SIGNAL(y_axis_font_size(int)), this, SLOT(set_y_axis_font_size(int)) ); ok = connect( chart_control_, SIGNAL(x_label_font_size(int)), this, SLOT(set_x_label_font_size(int)) ); ok = connect( chart_control_, SIGNAL(y_label_font_size(int)), this, SLOT(set_y_label_font_size(int)) ); ok = connect( chart_control_, SIGNAL(legend_font_size(int)), this, SLOT(set_legend_font_size(int)) ); ok = connect( chart_control_, SIGNAL(title_font_size(int)), this, SLOT(set_title_font_size(int)) ); connect( chart_control_, SIGNAL(xaxis_min_changed(double)), this, SLOT(set_xaxis_min(double)) ); connect( chart_control_, SIGNAL(xaxis_max_changed(double)), this, SLOT(set_xaxis_max(double)) ); connect( chart_control_, SIGNAL(xaxis_precision_changed(int)), this, SLOT(set_xaxis_precision(int)) ); connect( chart_control_, SIGNAL(xaxis_nticks_changed(int)), this, SLOT(set_xaxis_nticks(int)) ); connect( chart_control_, SIGNAL(xaxis_logscale_changed(bool)), this, SLOT(set_xaxis_logscale(bool)) ); connect( chart_control_, SIGNAL(xaxis_autoscale_changed()), this, SLOT(set_xaxis_autoscale()) ); connect( chart_control_, SIGNAL(yaxis_min_changed(double)), this, SLOT(set_yaxis_min(double)) ); connect( chart_control_, SIGNAL(yaxis_max_changed(double)), this, SLOT(set_yaxis_max(double)) ); connect( chart_control_, SIGNAL(yaxis_precision_changed(int)), this, SLOT(set_yaxis_precision(int)) ); connect( chart_control_, SIGNAL(yaxis_nticks_changed(int)), this, SLOT(set_yaxis_nticks(int)) ); connect( chart_control_, SIGNAL(yaxis_logscale_changed(bool)), this, SLOT(set_yaxis_logscale(bool)) ); connect( chart_control_, SIGNAL(yaxis_autoscale_changed()), this, SLOT(set_yaxis_autoscale()) ); connect( view_report_button_, SIGNAL(clicked()), this, SLOT(view_report()) ); connect( save_report_button_, SIGNAL(clicked()), this, SLOT(save_report()) ); connect( save_figure_button_, SIGNAL(clicked()), this, SLOT(save_figure()) ); }