2018-08-02 Fred Gleason <fredg@paravelsystems.com>

* Modified reports in rdlibrary(1) to display UTF-8 strings
	correctly.
This commit is contained in:
Fred Gleason 2018-08-02 16:03:29 -04:00
parent 4e125e2de7
commit 7d54bc3691
15 changed files with 256 additions and 192 deletions

View File

@ -17293,3 +17293,6 @@
* Modified logging in caed(8) to use 'RDConfig::log()' method.
2018-08-01 Fred Gleason <fredg@paravelsystems.com>
* Modified as-played reports to work correctly with UTF-8 strings.
2018-08-02 Fred Gleason <fredg@paravelsystems.com>
* Modified reports in rdlibrary(1) to display UTF-8 strings
correctly.

View File

@ -83,8 +83,8 @@ bool RDReport::ExportBmiEmr(const QString &filename,const QDate &startdate,
//
// Write HEDR Record
//
*strm << QString("HEDRSTA")+LeftJustify(stationId(),25)+
LeftJustify(current_datetime.toString("yyyyMMddhhmmssyyyyMMdd"),22)+
*strm << QString("HEDRSTA")+RDReport::leftJustify(stationId(),25)+
RDReport::leftJustify(current_datetime.toString("yyyyMMddhhmmssyyyyMMdd"),22)+
"FMDT \x0d\x0a";
records++;
@ -122,17 +122,17 @@ bool RDReport::ExportBmiEmr(const QString &filename,const QDate &startdate,
break;
}
*strm << QString("FMDT")+
LeftJustify(stationId(),40)+
RDReport::leftJustify(stationId(),40)+
type_code+
LeftJustify(station_format,25)+
RDReport::leftJustify(station_format,25)+
startdate.toString("yyyyMM")+"01"+
LeftJustify(q->value(0).toDateTime().toString("yyyyMMddhh:mm:ss"),16)+
RDReport::leftJustify(q->value(0).toDateTime().toString("yyyyMMddhh:mm:ss"),16)+
"000000001"+
LeftJustify(q->value(1).toString(),40)+
LeftJustify(q->value(2).toString(),40)+
LeftJustify(q->value(3).toString(),40)+
RDReport::leftJustify(q->value(1).toString(),40)+
RDReport::leftJustify(q->value(2).toString(),40)+
RDReport::leftJustify(q->value(3).toString(),40)+
QTime().addMSecs(q->value(4).toInt()).toString("hh:mm:ss")+" "+
RightJustify(q->value(5).toString(),12)+
RDReport::rightJustify(q->value(5).toString(),12)+
usage_code+" \x0d\x0a";
records++;
}

View File

@ -80,15 +80,15 @@ bool RDReport::ExportCutLog(const QString &filename,const QDate &startdate,
// Write File Header
//
if(startdate==enddate) {
*strm << Center(QString("Rivendell RDAirPlay Cut Report for ")+
*strm << RDReport::center(QString("Rivendell RDAirPlay Cut Report for ")+
startdate.toString("MM/dd/yyyy"),75);
}
else {
*strm << Center(QString("Rivendell RDAirPlay Cut Report for ")+
*strm << RDReport::center(QString("Rivendell RDAirPlay Cut Report for ")+
startdate.toString("MM/dd/yyyy")+" - "+
enddate.toString("MM/dd/yyyy"),75)+"\n";
}
*strm << Center(name()+" -- "+description(),75)+"\n";
*strm << RDReport::center(name()+" -- "+description(),75)+"\n";
*strm << "--Time-- -Cart- --Title---------------- Cut --Description------- -Len-\n";
//
@ -114,9 +114,9 @@ bool RDReport::ExportCutLog(const QString &filename,const QDate &startdate,
}
*strm << q->value(2).toTime().toString("hh:mm:ss")+" ";
*strm << cart_num+" ";
*strm << LeftJustify(q->value(8).toString(),23)+" ";
*strm << RDReport::leftJustify(q->value(8).toString(),23)+" ";
*strm << cut+" ";
*strm << LeftJustify(desc,20)+" ";
*strm << RDReport::leftJustify(desc,20)+" ";
*strm << RDGetTimeLength(q->value(9).toInt(),true,false).right(5);
*strm << "\n";
}

View File

@ -152,15 +152,15 @@ bool RDReport::ExportDeltaflex(const QString &filename,const QDate &startdate,
tfc_cartnum=q->value(10).toString();
*strm << q->value(2).toDateTime().toString("hhmm")+"|";
*strm << LeftJustify(tfc_time,4)+"|";
*strm << LeftJustify(cart_title,29)+"|";
*strm << LeftJustify(air_cartnum,12)+"|";
*strm << LeftJustify(tfc_cartnum,12)+"|";
*strm << RDReport::leftJustify(tfc_time,4)+"|";
*strm << RDReport::leftJustify(cart_title,29)+"|";
*strm << RDReport::leftJustify(air_cartnum,12)+"|";
*strm << RDReport::leftJustify(tfc_cartnum,12)+"|";
*strm << play_length+"|";
*strm << tfc_length+"|";
*strm << LeftJustify(ext_data,8)+"|";
*strm << LeftJustify(q->value(8).toString(),3)+"| | |";
*strm << LeftJustify(q->value(7).toString(),4)+"|\x0d\x0a";
*strm << RDReport::leftJustify(ext_data,8)+"|";
*strm << RDReport::leftJustify(q->value(8).toString(),3)+"| | |";
*strm << RDReport::leftJustify(q->value(7).toString(),4)+"|\x0d\x0a";
}
delete q;

View File

@ -73,15 +73,15 @@ bool RDReport::ExportMusicClassical(const QString &filename,
// Write File Header
//
if(startdate==enddate) {
*strm << Center(QString("Rivendell RDAirPlay Classical Music Playout Report for ")+
*strm << RDReport::center(QString("Rivendell RDAirPlay Classical Music Playout Report for ")+
startdate.toString("MM/dd/yyyy"),120)+"\n";
}
else {
*strm << Center(QString("Rivendell RDAirPlay Classical Music Playout Report for ")+
*strm << RDReport::center(QString("Rivendell RDAirPlay Classical Music Playout Report for ")+
startdate.toString("MM/dd/yyyy")+" - "+
enddate.toString("MM/dd/yyyy"),120)+"\n";
}
*strm << Center(name()+" -- "+description(),120)+"\n";
*strm << RDReport::center(name()+" -- "+description(),120)+"\n";
*strm << "Time -Len- --Title----------------------- --Composer-------------------- --Label / Spine #-------- Lib # Cart #\n";
//
@ -103,10 +103,10 @@ bool RDReport::ExportMusicClassical(const QString &filename,
cart_num=QString().sprintf(cart_fmt,q->value(1).toUInt());
*strm << q->value(2).toDateTime().time().toString("hhmm")+" ";
*strm << RDGetTimeLength(q->value(0).toInt(),true,false).right(5)+" ";
*strm << LeftJustify(q->value(3).toString(),30)+" ";
*strm << LeftJustify(q->value(5).toString(),30)+" ";
*strm << LeftJustify(q->value(4).toString(),25)+" ";
*strm << LeftJustify(q->value(6).toString(),5)+" ";
*strm << RDReport::leftJustify(q->value(3).toString(),30)+" ";
*strm << RDReport::leftJustify(q->value(5).toString(),30)+" ";
*strm << RDReport::leftJustify(q->value(4).toString(),25)+" ";
*strm << RDReport::leftJustify(q->value(6).toString(),5)+" ";
* strm << QString().sprintf("%06u",q->value(1).toUInt())+"\n";
}
delete q;

View File

@ -75,15 +75,15 @@ bool RDReport::ExportMusicPlayout(const QString &filename,
// Write File Header
//
if(startdate==enddate) {
*strm << Center(QString("Rivendell RDAirPlay Music Playout Report for ")+
*strm << RDReport::center(QString("Rivendell RDAirPlay Music Playout Report for ")+
startdate.toString("MM/dd/yyyy"),144)+"\n";
}
else {
*strm << Center(QString("Rivendell RDAirPlay Music Playout Report for ")+
*strm << RDReport::center(QString("Rivendell RDAirPlay Music Playout Report for ")+
startdate.toString("MM/dd/yyyy")+" - "+
enddate.toString("MM/dd/yyyy"),144)+"\n";
}
*strm << Center(name()+" -- "+description(),144)+"\n";
*strm << RDReport::center(name()+" -- "+description(),144)+"\n";
*strm << "--Time-- -Cart- Cut A-Len --Title----------------------- --Artist---------------------- --Album------------------ --Label-------------\n";
//
@ -107,10 +107,10 @@ bool RDReport::ExportMusicPlayout(const QString &filename,
*strm << cart_num+" ";
*strm << cut+" ";
*strm << RDGetTimeLength(q->value(0).toInt(),true,false).right(5)+" ";
*strm << LeftJustify(q->value(4).toString(),30)+" ";
*strm << LeftJustify(q->value(6).toString(),30)+" ";
*strm << LeftJustify(q->value(7).toString(),25)+" ";
*strm << LeftJustify(q->value(8).toString(),20)+"\n";
*strm << RDReport::leftJustify(q->value(4).toString(),30)+" ";
*strm << RDReport::leftJustify(q->value(6).toString(),30)+" ";
*strm << RDReport::leftJustify(q->value(7).toString(),25)+" ";
*strm << RDReport::leftJustify(q->value(8).toString(),20)+"\n";
}
delete q;
delete strm;

View File

@ -61,15 +61,15 @@ bool RDReport::ExportMusicSummary(const QString &filename,
// Write File Header
//
if(startdate==enddate) {
*strm << Center(QString("Rivendell RDAirPlay Music Summary Report for ")+
*strm << RDReport::center(QString("Rivendell RDAirPlay Music Summary Report for ")+
startdate.toString("MM/dd/yyyy"),75)+"\n";
}
else {
*strm << Center(QString("Rivendell RDAirPlay Music Summary Report for ")+
*strm << RDReport::center(QString("Rivendell RDAirPlay Music Summary Report for ")+
startdate.toString("MM/dd/yyyy")+" - "+
enddate.toString("MM/dd/yyyy"),75)+"\n";
}
*strm << Center(name()+" -- "+description(),75)+"\n";
*strm << RDReport::center(name()+" -- "+description(),75)+"\n";
//
// Write Data Rows

View File

@ -87,8 +87,8 @@ bool RDReport::ExportRadioTraffic(const QString &filename,
*strm << "00:00:00 ";
}
*strm << QString().sprintf(air_fmt,q->value(1).toUInt());
*strm << LeftJustify(q->value(9).toString(),34)+" ";
*strm << LeftJustify(q->value(6).toString(),32);
*strm << RDReport::leftJustify(q->value(9).toString(),34)+" ";
*strm << RDReport::leftJustify(q->value(6).toString(),32);
*strm << "\x0d\x0a";
}

View File

@ -87,15 +87,15 @@ bool RDReport::ExportSpinCount(const QString &filename,const QDate &startdate,
// Write File Header
//
if(startdate==enddate) {
*strm << Center(QString("Rivendell Spin Count Report for ")+
*strm << RDReport::center(QString("Rivendell Spin Count Report for ")+
startdate.toString("MM/dd/yyyy"),132)+"\n";
}
else {
*strm << Center(QString("Rivendell Spin Count Report for ")+
*strm << RDReport::center(QString("Rivendell Spin Count Report for ")+
startdate.toString("MM/dd/yyyy")+" - "+
enddate.toString("MM/dd/yyyy"),132)+"\n";
}
*strm << Center(name()+" -- "+description(),132)+"\n";
*strm << RDReport::center(name()+" -- "+description(),132)+"\n";
*strm << "--Title------------------------ --Artist----------------------- --Album------------------------ --Label----------------------- Spins\n";
//
@ -103,10 +103,10 @@ bool RDReport::ExportSpinCount(const QString &filename,const QDate &startdate,
//
for(std::map<unsigned,unsigned>::const_iterator it=carts.begin();
it!=carts.end();it++) {
*strm << LeftJustify(titles[it->first],30)+" ";
*strm << LeftJustify(artists[it->first],30)+" ";
*strm << LeftJustify(albums[it->first],30)+" ";
*strm << LeftJustify(labels[it->first],29)+" ";
*strm << RDReport::leftJustify(titles[it->first],30)+" ";
*strm << RDReport::leftJustify(artists[it->first],30)+" ";
*strm << RDReport::leftJustify(albums[it->first],30)+" ";
*strm << RDReport::leftJustify(labels[it->first],29)+" ";
*strm << QString().sprintf("%5u",it->second);
*strm << "\n";
}

View File

@ -85,15 +85,15 @@ bool RDReport::ExportTechnical(const QString &filename,const QDate &startdate,
//
if(incl_hdr) {
if(startdate==enddate) {
*strm << Center("Rivendell RDAirPlay Technical Playout Report for "+
*strm << RDReport::center("Rivendell RDAirPlay Technical Playout Report for "+
startdate.toString("MM/dd/yyyy"),96)+eol;
}
else {
*strm << Center("Rivendell RDAirPlay Technical Playout Report for "+
*strm << RDReport::center("Rivendell RDAirPlay Technical Playout Report for "+
startdate.toString("MM/dd/yyyy")+" - "+
enddate.toString("MM/dd/yyyy"),96)+eol;
}
*strm << Center(name()+" -- "+description(),96)+eol;
*strm << RDReport::center(name()+" -- "+description(),96)+eol;
*strm << QString("--Time-- -Cart- Cut --Title---------------- A-Len N-Len --Host---- Srce StartedBy OnAir")+eol;
}
@ -117,10 +117,10 @@ bool RDReport::ExportTechnical(const QString &filename,const QDate &startdate,
*strm << q->value(2).toTime().toString("hh:mm:ss")+" ";
*strm << cart_num+" ";
*strm << cut+" ";
*strm << LeftJustify(q->value(8).toString(),23)+" ";
*strm << RDReport::leftJustify(q->value(8).toString(),23)+" ";
*strm << RDGetTimeLength(q->value(0).toInt(),true,false).right(5)+" ";
*strm << RDGetTimeLength(q->value(9).toInt(),true,false).right(5)+" ";
*strm << LeftJustify(q->value(10).toString(),10)+" ";
*strm << RDReport::leftJustify(q->value(10).toString(),10)+" ";
switch((RDLogLine::PlaySource)q->value(11).toInt()) {
case RDLogLine::MainLog:
*strm << "Main ";
@ -146,7 +146,7 @@ bool RDReport::ExportTechnical(const QString &filename,const QDate &startdate,
*strm << " ";
break;
}
*strm << LeftJustify(RDLogLine::startSourceText((RDLogLine::StartSource)q->value(13).toInt()),7)+" ";
*strm << RDReport::leftJustify(RDLogLine::startSourceText((RDLogLine::StartSource)q->value(13).toInt()),7)+" ";
if(q->value(14).toString()=="Y") {
*strm << " Yes ";
}

View File

@ -78,15 +78,15 @@ bool RDReport::ExportTextLog(const QString &filename,const QDate &startdate,
// Write File Header
//
if(startdate==enddate) {
*strm << Center(QString("Rivendell RDAirPlay Playout Report for ")+
*strm << RDReport::center(QString("Rivendell RDAirPlay Playout Report for ")+
startdate.toString("MM/dd/yyyy"),78)+"\n";
}
else {
*strm << Center(QString("Rivendell RDAirPlay Playout Report for ")+
*strm << RDReport::center(QString("Rivendell RDAirPlay Playout Report for ")+
startdate.toString("MM/dd/yyyy")+" - "+
enddate.toString("MM/dd/yyyy"),78)+"\n";
}
*strm << Center(name()+" -- "+description(),78)+"\n";
*strm << RDReport::center(name()+" -- "+description(),78)+"\n";
*strm << "--Time-- -Cart- Cut --Title---------------- A-Len N-Len --Host---- Srce\n";
//
@ -107,12 +107,12 @@ bool RDReport::ExportTextLog(const QString &filename,const QDate &startdate,
}
cart_num=QString().sprintf(cart_fmt,q->value(1).toUInt());
*strm << q->value(2).toTime().toString("hh:mm:ss")+" ";
*strm << RightJustify(cart_num,6)+" ";
*strm << RDReport::rightJustify(cart_num,6)+" ";
*strm << cut+" ";
*strm << LeftJustify(q->value(8).toString(),23)+" ";
*strm << RDReport::leftJustify(q->value(8).toString(),23)+" ";
*strm << RDGetTimeLength(q->value(0).toInt(),true,false).right(5)+" ";
*strm << RDGetTimeLength(q->value(8).toInt(),true,false).right(5)+" ";
*strm << LeftJustify(q->value(10).toString(),10)+" ";
*strm << RDReport::leftJustify(q->value(10).toString(),10)+" ";
switch((RDLogLine::PlaySource)q->value(11).toInt()) {
case RDLogLine::MainLog:
*strm << "Main";

View File

@ -848,7 +848,7 @@ QString RDReport::errorText(RDReport::ErrorCode code)
}
QString RDReport::LeftJustify(const QString &str,int width) const
QString RDReport::leftJustify(const QString &str,int width)
{
QString ret=str.left(width);
@ -860,7 +860,7 @@ QString RDReport::LeftJustify(const QString &str,int width) const
}
QString RDReport::RightJustify(const QString &str,int width) const
QString RDReport::rightJustify(const QString &str,int width)
{
QString ret=str.left(width);
@ -872,7 +872,7 @@ QString RDReport::RightJustify(const QString &str,int width) const
}
QString RDReport::Center(const QString &str,int width) const
QString RDReport::center(const QString &str,int width)
{
QString ret=str.left(width);

View File

@ -93,11 +93,11 @@ class RDReport
static bool multipleDaysAllowed(RDReport::ExportFilter filter);
static bool multipleMonthsAllowed(RDReport::ExportFilter filter);
static QString errorText(RDReport::ErrorCode code);
static QString leftJustify(const QString &str,int width);
static QString rightJustify(const QString &str,int width);
static QString center(const QString &str,int width);
private:
QString LeftJustify(const QString &str,int width) const;
QString RightJustify(const QString &str,int width) const;
QString Center(const QString &str,int width) const;
bool ExportDeltaflex(const QString &filename,const QDate &startdate,
const QDate &enddate,const QString &mixtable);
bool ExportTextLog(const QString &filename,const QDate &startdate,

View File

@ -24,6 +24,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <qfile.h>
#include <qmessagebox.h>
#include <qprocess.h>
@ -50,13 +51,13 @@ bool RDTextFile(const QString &data)
}
#ifdef WIN32
QString tempfile=RDTempDirectory::basePath()+"\\rd-"+
QTime::currentTime().toString("hhmmsszzz"));
QTime::currentTime().toString("hhmmsszzz");
FILE *f=fopen(tempfile,"w");
if(f==NULL) {
QMessageBox::warning(NULL,"File Error","Unable to create temporary file");
return false;
}
fprintf(f,"%s",(const char *)data);
fprintf(f,"%s",(const char *)data.utf8());
fclose(f);
QStringList args;
args+=editor;
@ -71,14 +72,12 @@ bool RDTextFile(const QString &data)
QMessageBox::warning(NULL,"File Error","Unable to create temporary file");
return false;
}
else {
write(fd,data,data.length());
::close(fd);
if(fork()==0) {
system(editor+" "+tmpfile);
unlink(tmpfile);
exit(0);
}
write(fd,data.utf8(),data.utf8().length());
::close(fd);
if(fork()==0) {
system(editor+" "+tmpfile);
unlink(tmpfile);
exit(0);
}
#endif // WIN32
return true;

View File

@ -2,7 +2,7 @@
//
// List RDLibrary Reports
//
// (C) Copyright 2002-2006,2016 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2006,2016-2018 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@ -22,12 +22,13 @@
#include <qpushbutton.h>
#include <qstringlist.h>
#include <rddb.h>
#include <rdapplication.h>
#include <rdconf.h>
#include <rdtextfile.h>
#include <rdcart_search_text.h>
#include <rdcart.h>
#include <rdcart_search_text.h>
#include <rdconf.h>
#include <rddb.h>
#include <rdreport.h>
#include <rdtextfile.h>
#include "globals.h"
#include "list_reports.h"
@ -140,24 +141,24 @@ void ListReports::generateData()
QString report;
switch(list_reports_box->currentItem()) {
case 0: // Cart Report
GenerateCartReport(&report);
break;
case 0: // Cart Report
GenerateCartReport(&report);
break;
case 1: // Cut Report
GenerateCutReport(&report);
break;
case 1: // Cut Report
GenerateCutReport(&report);
break;
case 2: // Cart Data Dump (fixed)
GenerateCartDumpFixed(&report,list_fieldnames_check->isChecked());
break;
case 2: // Cart Data Dump (fixed)
GenerateCartDumpFixed(&report,list_fieldnames_check->isChecked());
break;
case 3: // Cart Data Dump (CSV)
GenerateCartDumpCsv(&report,list_fieldnames_check->isChecked());
break;
case 3: // Cart Data Dump (CSV)
GenerateCartDumpCsv(&report,list_fieldnames_check->isChecked());
break;
default:
return;
default:
return;
}
RDTextFile(report);
}
@ -186,13 +187,9 @@ void ListReports::GenerateCartReport(QString *report)
if(list_filter.isEmpty()) {
filter="[none]";
}
*report=" Rivendell Cart Report\n";
*report+=QString().
sprintf("Generated: %s Group: %-10s Filter: %s\n",
(const char *)QDateTime(QDate::currentDate(),QTime::currentTime()).
toString("MM/dd/yyyy - hh:mm:ss"),
(const char *)list_group.utf8(),(const char *)filter.utf8());
*report+="\n";
*report=RDReport::center("Rivendell Cart Report",132)+"\n";
*report+=RDReport::center(QString("Generated: ")+
QDateTime::currentDateTime().toString("MM/dd/yyyy - hh:mm:ss")+" Group: "+list_group+" Filter: "+filter,132)+"\n";
*report+="Type -Cart- -Group---- -Len- -Title------------------------- -Artist----------------------- Cuts Rot Enf -LenDev -Owner--------------\n";
//
@ -201,10 +198,20 @@ void ListReports::GenerateCartReport(QString *report)
if(list_type_filter.isEmpty()) {
return;
}
sql=QString("select CART.TYPE,CART.NUMBER,CART.GROUP_NAME,")+
"CART.FORCED_LENGTH,CART.TITLE,CART.ARTIST,CART.CUT_QUANTITY,"+
"CART.PLAY_ORDER,CART.ENFORCE_LENGTH,CART.LENGTH_DEVIATION,CART.OWNER "+
"from CART left join CUTS on CART.NUMBER=CUTS.CART_NUMBER";
sql=QString("select ")+
"CART.TYPE,"+ // 00
"CART.NUMBER,"+ // 01
"CART.GROUP_NAME,"+ // 02
"CART.FORCED_LENGTH,"+ // 03
"CART.TITLE,"+ // 04
"CART.ARTIST,"+ // 05
"CART.CUT_QUANTITY,"+ // 06
"CART.PLAY_ORDER,"+ // 07
"CART.ENFORCE_LENGTH,"+ // 08
"CART.LENGTH_DEVIATION,"+ // 09
"CART.OWNER "+ // 10
"from CART left join CUTS on "+
"CART.NUMBER=CUTS.CART_NUMBER ";
if(list_group==QString("ALL")) {
sql+=QString(" where ")+
RDAllCartSearchText(list_filter,schedcode,rda->user()->name(),true)+" && "+
@ -221,17 +228,17 @@ void ListReports::GenerateCartReport(QString *report)
// Cart Type
//
switch((RDCart::Type)q->value(0).toInt()) {
case RDCart::Audio:
*report+=" A ";
break;
case RDCart::Audio:
*report+=" A ";
break;
case RDCart::Macro:
*report+=" M ";
break;
case RDCart::Macro:
*report+=" M ";
break;
default:
*report+=" ? ";
break;
default:
*report+=" ? ";
break;
}
//
@ -242,27 +249,22 @@ void ListReports::GenerateCartReport(QString *report)
//
// Group
//
*report+=
QString().sprintf("%-10s ",(const char *)q->value(2).toString().utf8());
*report+=RDReport::leftJustify(q->value(2).toString(),10)+" ";
//
// Length
//
*report+=
QString().sprintf("%5s ",
(const char *)RDGetTimeLength(q->value(3).toInt(),false,false));
*report+=RDReport::rightJustify(RDGetTimeLength(q->value(3).toInt(),false,false),5)+" ";
//
// Title
//
*report+=QString().sprintf("%-31s ",(const char *)q->value(4).toString().
utf8().left(31));
*report+=RDReport::leftJustify(q->value(4).toString(),31)+" ";
//
// Artist
//
*report+=QString().sprintf("%-30s ",(const char *)q->value(5).toString().
utf8().left(30));
*report+=RDReport::leftJustify(q->value(5).toString(),30)+" ";
//
// Cut Quantity
@ -273,17 +275,17 @@ void ListReports::GenerateCartReport(QString *report)
// Play Order
//
switch((RDCart::PlayOrder)q->value(7).toInt()) {
case RDCart::Sequence:
*report+="SEQ ";
break;
case RDCart::Sequence:
*report+="SEQ ";
break;
case RDCart::Random:
*report+="RND ";
break;
case RDCart::Random:
*report+="RND ";
break;
default:
*report+="???";
break;
default:
*report+="??? ";
break;
}
//
@ -299,19 +301,16 @@ void ListReports::GenerateCartReport(QString *report)
//
// Length Deviation
//
*report+=
QString().sprintf("%7s ",
(const char *)RDGetTimeLength(q->value(9).toInt(),false,true));
*report+=RDReport::rightJustify(RDGetTimeLength(q->value(9).toInt(),false,true),7)+" ";
//
// Owner
//
if(q->value(10).toString().isEmpty()) {
*report+="[none]";
*report+="[none] ";
}
else {
*report+=QString().sprintf("%s",(const char *)q->value(10).toString().
utf8().left(20));
*report+=RDReport::leftJustify(q->value(10).toString(),20);
}
//
@ -341,13 +340,9 @@ void ListReports::GenerateCutReport(QString *report)
if(list_filter.isEmpty()) {
filter="[none]";
}
*report=" Rivendell Cut Report\n";
*report+=QString().
sprintf("Generated: %s Group: %-10s Filter: %s\n",
(const char *)QDateTime(QDate::currentDate(),QTime::currentTime()).
toString("MM/dd/yyyy - hh:mm:ss"),
(const char *)list_group.utf8(),(const char *)filter.utf8());
*report+="\n";
*report=RDReport::center("Rivendell Cut Report",132)+"\n";
*report+=RDReport::center(QString("Generated: ")+
QDateTime::currentDateTime().toString("MM/dd/yyyy - hh:mm:ss")+" Group: "+list_group+" Filter: "+filter,132)+"\n";
*report+="-Cart- Cut Wht -Cart Title-------------- -Description--- -Len- Last Play Plays Start Date End Date -Days of Week- -Daypart-----------\n";
//
@ -356,11 +351,28 @@ void ListReports::GenerateCutReport(QString *report)
if(list_type_filter.isEmpty()) {
return;
}
sql="select CART.NUMBER,CUTS.CUT_NAME,CUTS.WEIGHT,CART.TITLE,\
CUTS.DESCRIPTION,CUTS.LENGTH,CUTS.LAST_PLAY_DATETIME,CUTS.PLAY_COUNTER,\
CUTS.START_DATETIME,CUTS.END_DATETIME,SUN,MON,TUE,WED,THU,FRI,SAT,\
CUTS.START_DAYPART,CUTS.END_DAYPART from CART join CUTS \
on CART.NUMBER=CUTS.CART_NUMBER";
sql=QString("select ")+
"CART.NUMBER,"+ // 00
"CUTS.CUT_NAME,"+ // 01
"CUTS.WEIGHT,"+ // 02
"CART.TITLE,"+ // 03
"CUTS.DESCRIPTION,"+ // 04
"CUTS.LENGTH,"+ // 05
"CUTS.LAST_PLAY_DATETIME,"+ // 06
"CUTS.PLAY_COUNTER,"+ // 07
"CUTS.START_DATETIME,"+ // 08
"CUTS.END_DATETIME,"+ // 09
"CUTS.SUN,"+ // 10
"CUTS.MON,"+ // 11
"CUTS.TUE,"+ // 12
"CUTS.WED,"+ // 13
"CUTS.THU,"+ // 14
"CUTS.FRI,"+ // 15
"CUTS.SAT,"+ // 16
"CUTS.START_DAYPART,"+ // 17
"CUTS.END_DAYPART "+ // 18
"from CART join CUTS "+
"on CART.NUMBER=CUTS.CART_NUMBER ";
if(list_group==QString("ALL")) {
sql+=QString(" where ")+
RDAllCartSearchText(list_filter,schedcode,rda->user()->name(),true)+" && "+
@ -398,8 +410,7 @@ void ListReports::GenerateCutReport(QString *report)
// Title
//
if(q->value(0).toUInt()!=current_cart) {
*report+=QString().sprintf("%-25s ",(const char *)q->value(3).toString().
utf8().left(25));
*report+=RDReport::leftJustify(q->value(3).toString(),25)+" ";
}
else {
*report+=" ";
@ -408,15 +419,13 @@ void ListReports::GenerateCutReport(QString *report)
//
// Description
//
*report+=QString().sprintf("%-15s ",(const char *)q->value(4).toString().
utf8().left(15));
*report+=RDReport::leftJustify(q->value(4).toString(),15)+" ";
//
// Length
//
*report+=
QString().sprintf("%5s ",
(const char *)RDGetTimeLength(q->value(5).toInt(),false,false));
*report+=RDReport::rightJustify(RDGetTimeLength(q->value(5).toInt(),
false,false),5)+" ";
//
// Last Play
@ -425,8 +434,7 @@ void ListReports::GenerateCutReport(QString *report)
*report+=" [none] ";
}
else {
*report+=QString().sprintf(" %8s ",
(const char *)q->value(6).toDate().toString("MM/dd/yy"));
*report+=RDReport::center(q->value(6).toDate().toString("MM/dd/yy"),10)+" ";
}
//
@ -441,8 +449,7 @@ void ListReports::GenerateCutReport(QString *report)
*report+=" [none] ";
}
else {
*report+=QString().sprintf(" %8s ",
(const char *)q->value(8).toDateTime().toString("MM/dd/yy"));
*report+=RDReport::center(q->value(8).toDateTime().toString("MM/dd/yy"),10)+" ";
}
//
@ -452,8 +459,7 @@ void ListReports::GenerateCutReport(QString *report)
*report+=" TFN ";
}
else {
*report+=QString().sprintf(" %8s ",
(const char *)q->value(9).toDateTime().toString("MM/dd/yy"));
*report+=RDReport::center(q->value(9).toDateTime().toString("MM/dd/yy"),10)+" ";
}
//
@ -509,9 +515,8 @@ void ListReports::GenerateCutReport(QString *report)
*report+="[none]";
}
else {
*report+=QString().sprintf("%8s - %8s",
(const char *)q->value(17).toTime().toString("hh:mm:ss"),
(const char *)q->value(18).toTime().toString("hh:mm:ss"));
*report+=q->value(17).toTime().toString("hh:mm:ss")+" - "+
q->value(18).toTime().toString("hh:mm:ss");
}
//
@ -562,10 +567,23 @@ void ListReports::GenerateCartDumpFixed(QString *report,bool prepend_names)
if(list_type_filter.isEmpty()) {
return;
}
sql="select CUTS.CUT_NAME,CART.GROUP_NAME,CART.TITLE,CART.ARTIST,CART.ALBUM,\
CART.YEAR,CUTS.ISRC,CART.LABEL,CART.CLIENT,CART.AGENCY,CART.PUBLISHER,\
CART.COMPOSER,CART.USER_DEFINED,CUTS.LENGTH from CART \
join CUTS on CART.NUMBER=CUTS.CART_NUMBER";
sql=QString("select ")+
"CUTS.CUT_NAME,"+ // 00
"CART.GROUP_NAME,"+ // 01
"CART.TITLE,"+ // 02
"CART.ARTIST,"+ // 03
"CART.ALBUM,"+ // 04
"CART.YEAR,"+ // 05
"CUTS.ISRC,"+ // 06
"CART.LABEL,"+ // 07
"CART.CLIENT,"+ // 08
"CART.AGENCY,"+ // 09
"CART.PUBLISHER,"+ // 10
"CART.COMPOSER,"+ // 11
"CART.USER_DEFINED,"+ // 12
"CUTS.LENGTH "+ // 13
"from CART join CUTS "+
"on CART.NUMBER=CUTS.CART_NUMBER ";
if(list_group==QString("ALL")) {
sql+=QString(" where ")+
RDAllCartSearchText(list_filter,schedcode,rda->user()->name(),true)+" && "+
@ -700,18 +718,40 @@ void ListReports::GenerateCartDumpCsv(QString *report,bool prepend_names)
if(list_type_filter.isEmpty()) {
return;
}
sql=QString("select CART.NUMBER,CART.TYPE,CUTS.CUT_NAME,CART.GROUP_NAME,CART.TITLE,CART.ARTIST,")+
"CART.ALBUM,CART.YEAR,CUTS.ISRC,CUTS.ISCI,CART.LABEL,CART.CLIENT,"+
"CART.AGENCY,CART.PUBLISHER,CART.COMPOSER,CART.CONDUCTOR,CART.SONG_ID,"+
"CART.USER_DEFINED,CUTS.DESCRIPTION,CUTS.OUTCUE,"+
"CUTS.LENGTH,"+
"CUTS.START_POINT,CUTS.END_POINT,"+
"CUTS.SEGUE_START_POINT,CUTS.SEGUE_END_POINT,"+
"CUTS.HOOK_START_POINT,CUTS.HOOK_END_POINT,"+
"CUTS.TALK_START_POINT,CUTS.TALK_END_POINT,"+
"CUTS.FADEUP_POINT,CUTS.FADEDOWN_POINT,"+
"SCHED_CODES from CART "+
"left join CUTS on CART.NUMBER=CUTS.CART_NUMBER";
sql=QString("select ")+
"CART.NUMBER,"+ // 00
"CART.TYPE,"+ // 01
"CUTS.CUT_NAME,"+ // 02
"CART.GROUP_NAME,"+ // 03
"CART.TITLE,CART.ARTIST,"+ // 04
"CART.ALBUM,"+ // 05
"CART.YEAR,"+ // 06
"CUTS.ISRC,"+ // 07
"CUTS.ISCI,"+ // 08
"CART.LABEL,"+ // 09
"CART.CLIENT,"+ // 10
"CART.AGENCY,"+ // 11
"CART.PUBLISHER,"+ // 12
"CART.COMPOSER,"+ // 13
"CART.CONDUCTOR,"+ // 14
"CART.SONG_ID,"+ // 15
"CART.USER_DEFINED,"+ // 16
"CUTS.DESCRIPTION,"+ // 17
"CUTS.OUTCUE,"+ // 18
"CUTS.LENGTH,"+ // 19
"CUTS.START_POINT,"+ // 20
"CUTS.END_POINT,"+ // 21
"CUTS.SEGUE_START_POINT,"+ // 22
"CUTS.SEGUE_END_POINT,"+ // 23
"CUTS.HOOK_START_POINT,"+ // 24
"CUTS.HOOK_END_POINT,"+ // 25
"CUTS.TALK_START_POINT,"+ // 26
"CUTS.TALK_END_POINT,"+ // 27
"CUTS.FADEUP_POINT,"+ // 28
"CUTS.FADEDOWN_POINT,"+ // 29
"SCHED_CODES "+ // 30
"from CART left join CUTS "+
"on CART.NUMBER=CUTS.CART_NUMBER ";
if(list_group==QString("ALL")) {
sql+=QString(" where ")+
RDAllCartSearchText(list_filter,schedcode,rda->user()->name(),true)+" && "+
@ -739,17 +779,39 @@ void ListReports::GenerateCartDumpCsv(QString *report,bool prepend_names)
// Prepend Field Names
//
if(prepend_names) {
*report="CART,CUT,TYPE,GROUP_NAME,TITLE,ARTIST,ALBUM,YEAR,ISRC,ISCI,LABEL,";
*report+="CLIENT,AGENCY,PUBLISHER,COMPOSER,CONDUCTOR,SONG_ID,USER_DEFINED,";
*report+="DESCRIPTION,OUTCUE,";
*report+="FILENAME,LENGTH,";
*report+="START_POINT,END_POINT,";
*report+="SEGUE_START_POINT,SEGUE_END_POINT,";
*report+="HOOK_START_POINT,HOOK_END_POINT,";
*report+="TALK_START_POINT,TALK_END_POINT,";
*report+="FADEUP_POINT,FADEDOWN_POINT,";
*report=QString("CART,")+
"CUT,"+ // 00
"TYPE,"+ // 01
"GROUP_NAME,"+ // 02
"TITLE,"+ // 03
"ARTIST,"+ // 04
"ALBUM,"+ // 05
"YEAR,"+ // 06
"ISRC,"+ // 07
"ISCI,"+ // 08
"LABEL,"+ // 09
"CLIENT,"+ // 10
"AGENCY,"+ // 11
"PUBLISHER,"+ // 12
"COMPOSER,"+ // 13
"CONDUCTOR,"+ // 14
"SONG_ID,"+ // 15
"USER_DEFINED,"+ // 16
"DESCRIPTION,"+ // 17
"OUTCUE,"+ // 18
"FILENAME,LENGTH,"+ // 19
"START_POINT,"+ // 20
"END_POINT,"+ // 21
"SEGUE_START_POINT,"+ // 22
"SEGUE_END_POINT,"+ // 23
"HOOK_START_POINT,"+ // 24
"HOOK_END_POINT,"+ // 25
"TALK_START_POINT,"+ // 26
"TALK_END_POINT,"+ // 27
"FADEUP_POINT,"+ // 28
"FADEDOWN_POINT,"; // 29
for(int i=0;i<code_quan;i++) {
*report+=QString().sprintf("SCHED_CODE%u,",i+1);
*report+=QString().sprintf("SCHED_CODE%u,",i+1); // 30
}
*report=report->left(report->length()-1);
*report+="\n";