void Form_listSTbyPhong::on_pushButton_2_clicked() { NCReport *report = new NCReport(); report->setReportSource( NCReportSource::File ); // set report source type //report->addItemModel(querymodel_room,"myModel"); report->setReportFile("/home/xdien/ProjectsQT/qlsv_ktx/lietkeDSSV.ncr"); //set the report filename fullpath or relative to dir report->runReportToPreview(); // run to preview output // error handling if( report->hasError()) { QMessageBox msgBox; msgBox.setText(QObject::tr("Report error: ") + report->lastErrorMsg()); msgBox.exec(); } else { // show preview NCReportPreviewWindow *pv = new NCReportPreviewWindow(); // create preview window pv->setOutput( (NCReportPreviewOutput*)report->output() ); // add output to the window pv->setReport(report); pv->setWindowModality(Qt::ApplicationModal ); // set modality pv->setAttribute( Qt::WA_DeleteOnClose ); // set attrib pv->exec(); // run like modal dialog } delete report; }
void Widget::on_pushButton_clicked() { QStringList list; list << "a;a;a;a;a;a" << "aa;aa;aa;aa;aa;aa" << "aaa;aaa;aaa;aaa;aaa;aaa" << "aaaa;aaaa;aaaa;aaaa;aaaa;aaaa" << "aaaaa;aaaaa;aaaaa;aaaaa;aaaaa;aaaaa" << "aaaaaa;aaaaaa;aaaaaa;aaaaaa;aaaaaa;aaaaaa"; NCReport *report = new NCReport(); report->setReportSource( NCReportSource::File ); report->setReportFile(":/reports/report.xml"); report->addStringList(list, "model1"); report->runReportToPreview(); if (report->hasError()) { qDebug() << "ERROR:" << report->lastErrorMsg(); } else { NCReportPreviewWindow *pv = new NCReportPreviewWindow(); pv->setOutput( (NCReportPreviewOutput*)report->output() ); pv->setWindowModality( Qt::ApplicationModal ); pv->setAttribute( Qt::WA_DeleteOnClose ); pv->show(); } delete report; }
void reporte_cliente::save_reporte(QString p_apellido,QString s_apellido,QString nombre) { set_file_name(); this->current_date=QDate::currentDate(); this->header_current_date.append(current_date.toString(Qt::ISODate)); this->current_time=QTime::currentTime(); this->header_current_hora.append(current_time.toString()); make_query_cliente(p_apellido,s_apellido,nombre); report->addParameter("sql",quer); QString fullname; fullname.append(p_apellido); fullname.append(" "); fullname.append(s_apellido); fullname.append(" "); fullname.append(nombre); report->addParameter("nombre",fullname); fecha_final_s.clear(); fecha_inicio_s.clear(); fecha_inicio_s.append(this->fecha_inicio.toString(Qt::ISODate)); fecha_final_s.append(this->fecha_fin.toString(Qt::ISODate)); report->addParameter("usuario",current_user); report->addParameter("fecha_inicio",fecha_inicio_s); report->addParameter("fecha_final",fecha_final_s); report->addParameter("fecha_actual",current_date.toString(Qt::ISODate)); report->addParameter("hora_actual",current_time.toString()); NCReportOutput *output=0; output = new NCReportPreviewOutput(); output->setAutoDelete( FALSE ); report->setOutput( output ); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); report->runReport(); //report->runReportToPreview(); bool error = report->hasError(); QString err = report->lastErrorMsg(); QApplication::restoreOverrideCursor(); if ( error ) QMessageBox::information( 0, "Report error", err ); else { //----------------------------- // PRINT PREVIEW //----------------------------- NCReportPreviewWindow *pv = new NCReportPreviewWindow(); pv->setReport( report ); pv->setOutput( (NCReportPreviewOutput*)output ); pv->setWindowModality(Qt::ApplicationModal ); pv->setAttribute( Qt::WA_DeleteOnClose ); pv->show(); } //report->runReportToShowPreview(); }
void reporte_tienda::save_reporte(QString alias, int no_tienda) { set_file_name(); this->current_date=QDate::currentDate(); this->header_current_date.append(current_date.toString(Qt::ISODate)); this->current_time=QTime::currentTime(); this->header_current_hora.append(current_time.toString()); make_query_tienda(alias,no_tienda); report->addParameter("sql",quer); report->addParameter("usuario",current_user); report->addParameter("tienda",alias); //qDebug()<<fecha_inicio_s; report->addParameter("fecha_consulta",fecha_inicio_s); report->addParameter("fecha_actual",current_date.toString(Qt::ISODate)); report->addParameter("hora_actual",current_time.toString()); NCReportOutput *output=0; output = new NCReportPreviewOutput(); output->setAutoDelete( FALSE ); report->setOutput( output ); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); report->runReport(); //report->runReportToPreview(); bool error = report->hasError(); QString err = report->lastErrorMsg(); QApplication::restoreOverrideCursor(); if ( error ) QMessageBox::information( 0, "Report error", err ); else { //----------------------------- // PRINT PREVIEW //----------------------------- NCReportPreviewWindow *pv = new NCReportPreviewWindow(); pv->setReport( report ); pv->setOutput( (NCReportPreviewOutput*)output ); pv->setWindowModality(Qt::ApplicationModal ); pv->setAttribute( Qt::WA_DeleteOnClose ); pv->show(); } //report->runReportToShowPreview(); //report->runReportToShowPreview(); }
void DescargoBienesMB::on_finalizarTransaccion_pressed(){ QMessageBox msgBox; msgBox.setText("Descargo de Bienes"); msgBox.setInformativeText("¿Desea guardar y terminar la transaccion?"); msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Save); int ret = msgBox.exec(); switch (ret) { case QMessageBox::Save:{ QDateTime HoraFecha=QDateTime::currentDateTime(); QString Horatran, Fechatran, observaciones, motivo; Horatran=HoraFecha.time().toString(Qt::ISODate); Fechatran=HoraFecha.date().toString(Qt::ISODate); observaciones=m_ui->observaciones->text(); motivo=m_ui->motivo->text(); servicioPersistencia=new Persistencia(this->regBasico->getUnidad()->id); this->estadoDescargo="finalizado"; int codDescargo=servicioPersistencia->guardarDescargoBienes(Fechatran, Horatran, observaciones, motivo, "matbibliografico", m_ui->codigoDescargo->text(), this->estadoDescargo); for ( map<int, Bien*>::iterator it = listaBienes.begin(); it != listaBienes.end(); ++it ){ servicioPersistencia->cambiaEstadoDescargadoMB(it->second); //it->second->setDescargadoMB(); servicioPersistencia->crearlineaDescargoMB(it->second->oid, codDescargo); } QMessageBox msgBox; msgBox.information(0,"Descargo de Bienes","Descargado con exito!. "); for(int i=m_ui->tablaBienes->rowCount() -1; i>=0; i--) { this->m_ui->tablaBienes->removeRow(i); } this->fila=0; this->m_ui->finalizarTransaccion->setDisabled(true); //CARGAR EL INVENTARIO //this->inventario->cargarInventario(this->registroCatalogo, this->regBasico->getUnidad()->idInventario); NCReport *report = new NCReport(); report->reset(true); report->setReportSource( NCReportSource::File ); report->setReportFile("Reportes/descargoBienesBiblio.xml"); report->addParameter( "idDescargo", QVariant(codDescargo) ); report->runReportToPreview(); QString error=report->lastErrorMsg(); std::cout<< error.toStdString(); NCReportPreviewWindow *pv = new NCReportPreviewWindow(); pv->setReport( report ); pv->setOutput( (NCReportPreviewOutput*) report->output() ); pv->setWindowModality(Qt::ApplicationModal ); pv->setAttribute( Qt::WA_DeleteOnClose ); pv->show(); this->close(); } break; case QMessageBox::Cancel:{ QMessageBox msgBox; QMessageBox::information(this,"Descargo de Bienes del Inventario","Puede continuar ingresando transacciones", QMessageBox::Ok); } break; default: break; } }