|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
#include <applicat.h>
|
|
|
|
|
#include <defmask.h>
|
|
|
|
|
#include <execp.h>
|
|
|
|
|
#include <golem.h>
|
|
|
|
|
#include <progind.h>
|
|
|
|
|
#include <repapp.h>
|
|
|
|
|
#include <textset.h>
|
|
|
|
@ -71,6 +72,15 @@ bool TPrint_rendiconto_ca_mask::on_field_event(TOperable_field& o, TField_event
|
|
|
|
|
if (e == fe_init)
|
|
|
|
|
set_report_class();
|
|
|
|
|
break;
|
|
|
|
|
case F_EXPSINT:
|
|
|
|
|
if (e == fe_button)
|
|
|
|
|
{
|
|
|
|
|
TString path = get(DLG_OUTPUTD);
|
|
|
|
|
|
|
|
|
|
if (path.empty())
|
|
|
|
|
return error_box(TR("Specificare una cartella dove creare il file rendiconto.xls!"));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case F_DATAINI:
|
|
|
|
|
case F_DATAFIN:
|
|
|
|
|
if (e == fe_close)
|
|
|
|
@ -325,7 +335,7 @@ public:
|
|
|
|
|
const TString& conto, char tipo) const; // per l'elaborazione batch
|
|
|
|
|
|
|
|
|
|
TPrint_rendiconto_ca_recordset(const TString& sql);
|
|
|
|
|
~TPrint_rendiconto_ca_recordset();
|
|
|
|
|
~TPrint_rendiconto_ca_recordset() {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TPrint_rendiconto_ca_recordset::TPrint_rendiconto_ca_recordset(const TString& sql)
|
|
|
|
@ -362,11 +372,6 @@ TPrint_rendiconto_ca_recordset::TPrint_rendiconto_ca_recordset(const TString& sq
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TPrint_rendiconto_ca_recordset::~TPrint_rendiconto_ca_recordset()
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//filtro ulteriore sul file rendy.dbf già creato
|
|
|
|
|
//questo filtro, all'apparenza inutile, serve per filtrare sulle rmovana create al volo dagli rdoc..
|
|
|
|
|
//..che potrebbero presentare conti non pertinenti dovuti ai conti stessi legati ai codart ecc.
|
|
|
|
@ -1984,6 +1989,36 @@ void TPrint_rendiconto_ca_recordset::set_filter(const TPrint_rendiconto_ca_mask&
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
|
// CSV RECORDSET
|
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TCSV_rendiconto_ca_recordset : public TCSV_recordset
|
|
|
|
|
{
|
|
|
|
|
TString4 _contsep;
|
|
|
|
|
|
|
|
|
|
public: //da libreria
|
|
|
|
|
virtual const TVariant& get(unsigned int column_name) const;
|
|
|
|
|
|
|
|
|
|
TCSV_rendiconto_ca_recordset(const TString& contsep) : TCSV_recordset("CSV(\"\t\")"), _contsep(contsep) {}
|
|
|
|
|
~TCSV_rendiconto_ca_recordset() {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const TVariant& TCSV_rendiconto_ca_recordset::get(unsigned int column_name) const
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (column_name == 100)
|
|
|
|
|
{
|
|
|
|
|
const TString fld(column_name);
|
|
|
|
|
|
|
|
|
|
if (fld == "#CONTSEP")
|
|
|
|
|
return get_tmp_var() = _contsep;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return TCSV_recordset::get(column_name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////
|
|
|
|
|
// REPORT
|
|
|
|
|
////////////////////////////////////////////////////////
|
|
|
|
@ -2047,7 +2082,7 @@ class TPrint_rendiconto_ca : public TReport_application
|
|
|
|
|
protected:
|
|
|
|
|
void esporta_csv_row(ostream& file_to_date, const int first_level, const TString& cod_cms_cdc,
|
|
|
|
|
const real importi[5][4], real importi_totali[5][4]);
|
|
|
|
|
void esporta_csv(TPrint_rendiconto_ca_recordset& rendy, const int r, TReport_book book, bool reset);
|
|
|
|
|
void esporta_csv(TPrint_rendiconto_ca_recordset& rendy, const TFilename & datefname, const TFilename & printfname, const int r, TReport_book book, bool reset);
|
|
|
|
|
void incrementa(TToken_string& riga, const int col, const real& valore) const;
|
|
|
|
|
void crea_trr(const TFilename& trr) const;
|
|
|
|
|
virtual void export_pdf(TFilename & name, TReport_book & book, TAutomask & mask, TReport & rep);
|
|
|
|
@ -2055,7 +2090,7 @@ protected:
|
|
|
|
|
virtual TReport & get_report(const TAutomask & m);
|
|
|
|
|
virtual TTrec * get_dbase_recdesc(TReport & rep, const TAutomask & mask);
|
|
|
|
|
virtual TAutomask & get_mask();
|
|
|
|
|
virtual void execute_print(TReport_book & book, TAutomask & mask, TReport & rep, export_type type = _export_printer);
|
|
|
|
|
virtual void execute_print(TReport_book & book, TAutomask & mask, TReport & rep, export_type & type);
|
|
|
|
|
virtual const char * output_name(const TAutomask & mask, const TReport & rep) const { return "rend"; }
|
|
|
|
|
// @cmember Distruzione dei dati dell'utente
|
|
|
|
|
virtual bool user_destroy();
|
|
|
|
@ -2204,23 +2239,16 @@ void TPrint_rendiconto_ca::esporta_csv_row(ostream& file_to_date, const int firs
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//metodo di alto livello per l'esportazione dei dati di totale in un file per excel
|
|
|
|
|
void TPrint_rendiconto_ca::esporta_csv(TPrint_rendiconto_ca_recordset& rendy, const int r, TReport_book book, bool reset)
|
|
|
|
|
void TPrint_rendiconto_ca::esporta_csv(TPrint_rendiconto_ca_recordset& rendy, const TFilename & datefname, const TFilename & printfname, const int r, TReport_book book, bool reset)
|
|
|
|
|
{
|
|
|
|
|
//primo livello di configurazione
|
|
|
|
|
const int first_level = get_first_level().logic();
|
|
|
|
|
//piano dei conti riclassificato?
|
|
|
|
|
TConfig& cfg = ca_config();
|
|
|
|
|
const bool riclassificato = cfg.get_bool("UsePdcc");
|
|
|
|
|
|
|
|
|
|
//aggiorna il file da esportare appendendo la nuova riga
|
|
|
|
|
TFilename path = _msk->get(F_PATH);
|
|
|
|
|
path.lower();
|
|
|
|
|
path.add("rendiconto.xls");
|
|
|
|
|
ofstream file_to_date(path, ios::app);
|
|
|
|
|
TFilename paths = _msk->get(F_PATH);
|
|
|
|
|
paths.lower();
|
|
|
|
|
paths.add("rend.xls");
|
|
|
|
|
ofstream file_to_print(paths, reset ? ios::trunc : ios::app);
|
|
|
|
|
ofstream file_to_date(datefname, ios::app);
|
|
|
|
|
ofstream file_to_print(printfname, reset ? ios::trunc : ios::app);
|
|
|
|
|
|
|
|
|
|
const bool invert_cosric = _msk->get_bool(F_REV_COSRIC);
|
|
|
|
|
|
|
|
|
@ -2580,205 +2608,201 @@ void TPrint_rendiconto_ca::export_pdf(TFilename & name, TReport_book & book, TAu
|
|
|
|
|
TReport_application::export_pdf(name, book, mask, rep);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TPrint_rendiconto_ca::execute_print(TReport_book & book, TAutomask & mask, TReport & rep, export_type type)
|
|
|
|
|
void TPrint_rendiconto_ca::execute_print(TReport_book & book, TAutomask & mask, TReport & rep, export_type & type)
|
|
|
|
|
{
|
|
|
|
|
TPrint_rendiconto_ca_rep & ca_rep = (TPrint_rendiconto_ca_rep &)rep;
|
|
|
|
|
TPrint_rendiconto_ca_mask & ca_mask = (TPrint_rendiconto_ca_mask &)mask;
|
|
|
|
|
const int first_level = get_first_level().logic(); //primo livello nella configurazione CA
|
|
|
|
|
const int first_level = get_first_level().logic(); //primo livello nella configurazione CA
|
|
|
|
|
// TString arg(argv(2));
|
|
|
|
|
TEsercizi_contabili esc;
|
|
|
|
|
TEsercizi_contabili esc;
|
|
|
|
|
TFilename datefilename = get_output_filename(mask, rep);
|
|
|
|
|
TFilename printfilename = datefilename.path();
|
|
|
|
|
|
|
|
|
|
/* arg.lower();
|
|
|
|
|
if (arg.starts_with("-b"))
|
|
|
|
|
{
|
|
|
|
|
export_rendiconto();
|
|
|
|
|
return;
|
|
|
|
|
} */
|
|
|
|
|
datefilename.ext("xls"),
|
|
|
|
|
printfilename.add("rend.xls");
|
|
|
|
|
/* arg.lower();
|
|
|
|
|
if (arg.starts_with("-b"))
|
|
|
|
|
{
|
|
|
|
|
export_rendiconto();
|
|
|
|
|
return;
|
|
|
|
|
} */
|
|
|
|
|
//chiave di ordinamento del recordset; di base è 1 (utilizzato per la stampa); va lasciata qui per essere resettata..
|
|
|
|
|
//..ad ogni giro, in modo da sistemarsi quando si passa da esportazione a stampa e viceversa!
|
|
|
|
|
int recset_key = 1;
|
|
|
|
|
int recset_key = 1;
|
|
|
|
|
|
|
|
|
|
//resetta e prepara le intestazioni del file rendiconto.xls
|
|
|
|
|
/* i< (key == K_F6)
|
|
|
|
|
//resetta e prepara le intestazioni del file rendiconto.xls
|
|
|
|
|
if (user_key() == K_F6)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ofstream file_to_date(datefilename);
|
|
|
|
|
|
|
|
|
|
const int posizione_importi = first_level == LF_COMMESSE ? 5 : 2;
|
|
|
|
|
|
|
|
|
|
//intestazione primaria
|
|
|
|
|
TToken_string intestazione_1(512, '\t');
|
|
|
|
|
//l'intestazione primaria dipende anche dalla configurazione dei livelli!
|
|
|
|
|
if (first_level == LF_COMMESSE) //commessa-cdc
|
|
|
|
|
{
|
|
|
|
|
TFilename file_xls = mask.get(F_PATH);
|
|
|
|
|
file_xls.lower();
|
|
|
|
|
file_xls.add("rendiconto.xls");
|
|
|
|
|
ofstream file_to_date(file_xls);
|
|
|
|
|
intestazione_1.add("Commessa");
|
|
|
|
|
intestazione_1.add("Descr. commessa");
|
|
|
|
|
intestazione_1.add("Data inizio");
|
|
|
|
|
intestazione_1.add("Data fine");
|
|
|
|
|
intestazione_1.add("Data proroga");
|
|
|
|
|
recset_key = 2; //chiave del recordset per commessa
|
|
|
|
|
}
|
|
|
|
|
else //cdc-commessa
|
|
|
|
|
{
|
|
|
|
|
intestazione_1.add("C.d.C.");
|
|
|
|
|
intestazione_1.add("Descr. cdc");
|
|
|
|
|
recset_key = 3; //chiave del recordset per centro di costo
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const int posizione_importi = first_level == LF_COMMESSE ? 5 : 2;
|
|
|
|
|
|
|
|
|
|
//intestazione primaria
|
|
|
|
|
TToken_string intestazione_1(512, '\t');
|
|
|
|
|
//l'intestazione primaria dipende anche dalla configurazione dei livelli!
|
|
|
|
|
if (first_level == LF_COMMESSE) //commessa-cdc
|
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
|
{
|
|
|
|
|
switch (i)
|
|
|
|
|
{
|
|
|
|
|
intestazione_1.add("Commessa");
|
|
|
|
|
intestazione_1.add("Descr. commessa");
|
|
|
|
|
intestazione_1.add("Data inizio");
|
|
|
|
|
intestazione_1.add("Data fine");
|
|
|
|
|
intestazione_1.add("Data proroga");
|
|
|
|
|
recset_key = 2; //chiave del recordset per commessa
|
|
|
|
|
}
|
|
|
|
|
else //cdc-commessa
|
|
|
|
|
{
|
|
|
|
|
intestazione_1.add("C.d.C.");
|
|
|
|
|
intestazione_1.add("Descr. cdc");
|
|
|
|
|
recset_key = 3; //chiave del recordset per centro di costo
|
|
|
|
|
case 0: intestazione_1.add("Costi"); break;
|
|
|
|
|
case 1: intestazione_1.add("Ricavi"); break;
|
|
|
|
|
case 2: intestazione_1.add("Attività"); break;
|
|
|
|
|
case 3: intestazione_1.add("Passività"); break;
|
|
|
|
|
}
|
|
|
|
|
for (int j = 0; j < 6; j++)
|
|
|
|
|
intestazione_1.add("");
|
|
|
|
|
}
|
|
|
|
|
file_to_date << intestazione_1 << endl;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
|
|
|
//intestazione secondaria
|
|
|
|
|
TToken_string intestazione_2(512, '\t');
|
|
|
|
|
//campi descrittivi iniziali vuoti (solo intestazione_1)
|
|
|
|
|
intestazione_2.add(" ", posizione_importi - 1);
|
|
|
|
|
|
|
|
|
|
for (int l = 0; l < 4; l++)
|
|
|
|
|
{
|
|
|
|
|
for (int n = 0; n < 7; n++)
|
|
|
|
|
{
|
|
|
|
|
switch (i)
|
|
|
|
|
switch (n)
|
|
|
|
|
{
|
|
|
|
|
case 0: intestazione_1.add("Costi"); break;
|
|
|
|
|
case 1: intestazione_1.add("Ricavi"); break;
|
|
|
|
|
case 2: intestazione_1.add("Attività"); break;
|
|
|
|
|
case 3: intestazione_1.add("Passività"); break;
|
|
|
|
|
}
|
|
|
|
|
for (int j = 0; j < 6; j++)
|
|
|
|
|
intestazione_1.add("");
|
|
|
|
|
}
|
|
|
|
|
file_to_date << intestazione_1 << endl;
|
|
|
|
|
|
|
|
|
|
//intestazione secondaria
|
|
|
|
|
TToken_string intestazione_2(512, '\t');
|
|
|
|
|
//campi descrittivi iniziali vuoti (solo intestazione_1)
|
|
|
|
|
intestazione_2.add(" ", posizione_importi - 1);
|
|
|
|
|
|
|
|
|
|
for (int l = 0; l < 4; l++)
|
|
|
|
|
{
|
|
|
|
|
for (int n = 0; n < 7; n++)
|
|
|
|
|
{
|
|
|
|
|
switch (n)
|
|
|
|
|
{
|
|
|
|
|
case 0: intestazione_2.add("Budget"); break;
|
|
|
|
|
case 1: intestazione_2.add("Impegnato"); break;
|
|
|
|
|
case 2: intestazione_2.add("Maturato"); break;
|
|
|
|
|
case 3: intestazione_2.add("Fatturato"); break;
|
|
|
|
|
case 4: intestazione_2.add("Da impegnare"); break;
|
|
|
|
|
case 5: intestazione_2.add("Da maturare"); break;
|
|
|
|
|
case 6: intestazione_2.add("Da fatturare"); break;
|
|
|
|
|
}
|
|
|
|
|
case 0: intestazione_2.add("Budget"); break;
|
|
|
|
|
case 1: intestazione_2.add("Impegnato"); break;
|
|
|
|
|
case 2: intestazione_2.add("Maturato"); break;
|
|
|
|
|
case 3: intestazione_2.add("Fatturato"); break;
|
|
|
|
|
case 4: intestazione_2.add("Da impegnare"); break;
|
|
|
|
|
case 5: intestazione_2.add("Da maturare"); break;
|
|
|
|
|
case 6: intestazione_2.add("Da fatturare"); break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
file_to_date << intestazione_2 << endl;
|
|
|
|
|
} //if(key==K_F6)
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
file_to_date << intestazione_2 << endl;
|
|
|
|
|
} //if(key==K_F6)
|
|
|
|
|
//log report con segnalazioni su errori (tipo conti inesistenti o robaccia simile..)
|
|
|
|
|
TLog_report log(TR("Errori rilevati"));
|
|
|
|
|
|
|
|
|
|
//log report con segnalazioni su errori (tipo conti inesistenti o robaccia simile..)
|
|
|
|
|
TLog_report log(TR("Errori rilevati"));
|
|
|
|
|
log.kill_duplicates();
|
|
|
|
|
|
|
|
|
|
log.kill_duplicates();
|
|
|
|
|
TSheet_field& sheet = mask.sfield(F_RIGHE);
|
|
|
|
|
TString video_string; //stringa che compare nella progind
|
|
|
|
|
TDate dataini, datafin;
|
|
|
|
|
const int anno = mask.get_int(F_ANNO);
|
|
|
|
|
const bool attive = mask.get_bool(F_ATTIVA);
|
|
|
|
|
|
|
|
|
|
TSheet_field& sheet = mask.sfield(F_RIGHE);
|
|
|
|
|
TString video_string; //stringa che compare nella progind
|
|
|
|
|
TDate dataini, datafin;
|
|
|
|
|
const int anno = mask.get_int(F_ANNO);
|
|
|
|
|
const bool attive = mask.get_bool(F_ATTIVA);
|
|
|
|
|
if (sheet.empty()) //se non ci sono righe sullo sheet (selezione su tutte le cms/cdc)...
|
|
|
|
|
{
|
|
|
|
|
TToken_string& row = sheet.row(-1); //crea la prima riga dello sheet
|
|
|
|
|
|
|
|
|
|
if (sheet.empty()) //se non ci sono righe sullo sheet (selezione su tutte le cms/cdc)...
|
|
|
|
|
//si amplia il range di ricerca temporale di 1 anno nel passato perchè i movana..
|
|
|
|
|
//..preventivi possono essere stati decisi prima dell'inizio effettivo commessa
|
|
|
|
|
if (anno > 0) //se non è stata specificata alcuna dataini, ma è stato specificato un anno di esercizio...
|
|
|
|
|
{
|
|
|
|
|
TToken_string& row = sheet.row(-1); //crea la prima riga dello sheet
|
|
|
|
|
TEsercizi_contabili esc;
|
|
|
|
|
esc.code2range(anno, dataini, datafin);
|
|
|
|
|
}
|
|
|
|
|
if (!mask.field(F_DATAINI).empty())
|
|
|
|
|
dataini = mask.get_date(F_DATAINI);
|
|
|
|
|
if (!mask.field(F_DATAFIN).empty())
|
|
|
|
|
datafin = mask.get_date(F_DATAFIN);
|
|
|
|
|
|
|
|
|
|
//si amplia il range di ricerca temporale di 1 anno nel passato perchè i movana..
|
|
|
|
|
//..preventivi possono essere stati decisi prima dell'inizio effettivo commessa
|
|
|
|
|
if (anno > 0) //se non è stata specificata alcuna dataini, ma è stato specificato un anno di esercizio...
|
|
|
|
|
const TMultilevel_code_info& liv1 = get_first_level(); //stabilisce quale è il primo livello (tra CDC e CMS)..
|
|
|
|
|
const bool is_cms = liv1.logic() == LF_COMMESSE;
|
|
|
|
|
TISAM_recordset set(is_cms ? "USE COMMESSE" : "USE CDC"); //..e di conseguenza scrive la use giusta
|
|
|
|
|
|
|
|
|
|
TProgress_monitor pi(set.items(), video_string, true);
|
|
|
|
|
for (int i = 0; pi.add_status() && set.move_to(i); i++) //fighissimo metodo per scandire un file in 1 riga!
|
|
|
|
|
{
|
|
|
|
|
//Filtro sulle date
|
|
|
|
|
//DATE VALIDE STRETTAMENTE PER COMMESSE
|
|
|
|
|
//per prima cosa controlla se veramente la commessa rientri nei parametri temporali impostati sulla maschera
|
|
|
|
|
//Se infatti è completamente al di fuori di tale intervallo, che cavolo la controlla a fare
|
|
|
|
|
row = set.get((unsigned int)0).as_string(); //prende il valore del primo campo del file (CDC o CMS code)
|
|
|
|
|
|
|
|
|
|
if (is_cms)
|
|
|
|
|
{
|
|
|
|
|
TEsercizi_contabili esc;
|
|
|
|
|
esc.code2range(anno, dataini, datafin);
|
|
|
|
|
}
|
|
|
|
|
if (!mask.field(F_DATAINI).empty())
|
|
|
|
|
dataini = mask.get_date(F_DATAINI);
|
|
|
|
|
if (!mask.field(F_DATAFIN).empty())
|
|
|
|
|
datafin = mask.get_date(F_DATAFIN);
|
|
|
|
|
|
|
|
|
|
const TMultilevel_code_info& liv1 = get_first_level(); //stabilisce quale è il primo livello (tra CDC e CMS)..
|
|
|
|
|
const bool is_cms = liv1.logic() == LF_COMMESSE;
|
|
|
|
|
TISAM_recordset set(is_cms ? "USE COMMESSE" : "USE CDC"); //..e di conseguenza scrive la use giusta
|
|
|
|
|
|
|
|
|
|
TProgress_monitor pi(set.items(), video_string, true);
|
|
|
|
|
for (int i = 0; pi.add_status() && set.move_to(i); i++) //fighissimo metodo per scandire un file in 1 riga!
|
|
|
|
|
{
|
|
|
|
|
//Filtro sulle date
|
|
|
|
|
//DATE VALIDE STRETTAMENTE PER COMMESSE
|
|
|
|
|
//per prima cosa controlla se veramente la commessa rientri nei parametri temporali impostati sulla maschera
|
|
|
|
|
//Se infatti è completamente al di fuori di tale intervallo, che cavolo la controlla a fare
|
|
|
|
|
row = set.get((unsigned int)0).as_string(); //prende il valore del primo campo del file (CDC o CMS code)
|
|
|
|
|
|
|
|
|
|
if (is_cms)
|
|
|
|
|
if (attive)
|
|
|
|
|
{
|
|
|
|
|
if (attive)
|
|
|
|
|
const TRectype& rec_commesse = set.cursor()->curr();
|
|
|
|
|
|
|
|
|
|
if (!ca_commessa_attiva(rec_commesse, dataini, datafin))
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (dataini.ok() || datafin.ok())
|
|
|
|
|
{
|
|
|
|
|
const TRectype& rec_commesse = set.cursor()->curr();
|
|
|
|
|
|
|
|
|
|
if (!ca_commessa_attiva(rec_commesse, dataini, datafin))
|
|
|
|
|
TDate datainicms, datafcomp;
|
|
|
|
|
ca_durata_commessa(rec_commesse, datainicms, datafcomp);
|
|
|
|
|
if ((dataini.ok() && datafcomp < dataini) || (datafin.ok() && datainicms > datafin))
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (dataini.ok() || datafin.ok())
|
|
|
|
|
{
|
|
|
|
|
const TRectype& rec_commesse = set.cursor()->curr();
|
|
|
|
|
TDate datainicms, datafcomp;
|
|
|
|
|
ca_durata_commessa(rec_commesse, datainicms, datafcomp);
|
|
|
|
|
if ((dataini.ok() && datafcomp < dataini) || (datafin.ok() && datainicms > datafin))
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
video_string = TR("Scansione");
|
|
|
|
|
video_string << " " << row; //completa la stringa da visualizzare sulla progind
|
|
|
|
|
pi.set_text(video_string);
|
|
|
|
|
video_string = TR("Scansione");
|
|
|
|
|
video_string << " " << row; //completa la stringa da visualizzare sulla progind
|
|
|
|
|
pi.set_text(video_string);
|
|
|
|
|
|
|
|
|
|
for (int l = liv1.levels() - 2; l >= 0; l--) //se la struttura è a più livelli costruisce la tokenstring
|
|
|
|
|
row.insert("|", liv1.total_len(l));
|
|
|
|
|
for (int l = liv1.levels() - 2; l >= 0; l--) //se la struttura è a più livelli costruisce la tokenstring
|
|
|
|
|
row.insert("|", liv1.total_len(l));
|
|
|
|
|
|
|
|
|
|
ca_rep.set_filter(ca_mask, 0, recset_key, log); //fa la set filter sulla prima riga (che è quella usata)
|
|
|
|
|
ca_rep.set_filter(ca_mask, 0, recset_key, log); //fa la set filter sulla prima riga (che è quella usata)
|
|
|
|
|
|
|
|
|
|
//se stampa o anteprima..
|
|
|
|
|
/* if (key == K_F6)
|
|
|
|
|
esporta_csv((TPrint_rendiconto_ca_recordset&)*rep.recordset(), 0, book, i == 0); //esportazione in excel
|
|
|
|
|
else */
|
|
|
|
|
//se stampa o anteprima..
|
|
|
|
|
if (user_key() == K_F6)
|
|
|
|
|
esporta_csv((TPrint_rendiconto_ca_recordset&)*rep.recordset(), datefilename, printfilename, 0, book, i == 0); //esportazione in excel
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
rep.set_export_sections(type);
|
|
|
|
|
book.add(rep);
|
|
|
|
|
rep.reset_export_sections();
|
|
|
|
|
}
|
|
|
|
|
sheet.destroy(); //cancella le commesse aggiunte in automatico sullo sheet
|
|
|
|
|
}
|
|
|
|
|
else //se ha almeno una riga sullo sheet delle cms/cdc...
|
|
|
|
|
sheet.destroy(); //cancella le commesse aggiunte in automatico sullo sheet
|
|
|
|
|
}
|
|
|
|
|
else //se ha almeno una riga sullo sheet delle cms/cdc...
|
|
|
|
|
{
|
|
|
|
|
FOR_EACH_SHEET_ROW(sheet, r, row) //per ogni cdc/cms che appare nello sheet di pag.1 della msk..
|
|
|
|
|
{
|
|
|
|
|
FOR_EACH_SHEET_ROW(sheet, r, row) //per ogni cdc/cms che appare nello sheet di pag.1 della msk..
|
|
|
|
|
ca_rep.set_filter(ca_mask, r, recset_key, log); //..chiama il metodone globale che crea e compila il file..
|
|
|
|
|
//..temporaneo i cui dati riempiranno il report
|
|
|
|
|
//se stampa o anteprima
|
|
|
|
|
if (user_key() == K_F6) //esportazione in excel sintetica
|
|
|
|
|
esporta_csv((TPrint_rendiconto_ca_recordset&)*rep.recordset(), datefilename, printfilename, r, book, r == 0); //il recordset è del tipo TPrint_rendiconto
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ca_rep.set_filter(ca_mask, r, recset_key, log); //..chiama il metodone globale che crea e compila il file..
|
|
|
|
|
//..temporaneo i cui dati riempiranno il report
|
|
|
|
|
//se stampa o anteprima
|
|
|
|
|
/*if (key == K_F6) //esportazione in excel
|
|
|
|
|
esporta_csv((TPrint_rendiconto_ca_recordset&)*rep.recordset(), r, book, r == 0); //il recordset è del tipo TPrint_rendiconto
|
|
|
|
|
else */
|
|
|
|
|
rep.set_export_sections(type);
|
|
|
|
|
book.add(rep); //aggiunge il report relativo alla cdc/cms corrente al book
|
|
|
|
|
rep.reset_export_sections();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//anteprima report degli errori rilevati
|
|
|
|
|
if (log.recordset()->items() > 0)
|
|
|
|
|
log.preview();
|
|
|
|
|
|
|
|
|
|
/* TReport rep_xls;
|
|
|
|
|
|
|
|
|
|
path = "ca3700b";
|
|
|
|
|
rep_xls.load(path);
|
|
|
|
|
|
|
|
|
|
if (key == K_F6)
|
|
|
|
|
}
|
|
|
|
|
//anteprima report degli errori rilevati
|
|
|
|
|
if (user_key() == K_F6)
|
|
|
|
|
{
|
|
|
|
|
TReport rep_xls;
|
|
|
|
|
|
|
|
|
|
rep_xls.load("ca3700b");
|
|
|
|
|
TCSV_recordset xls_source("CSV(\"\t\")");
|
|
|
|
|
TCSV_recordset * xls_dest = new TCSV_recordset("CSV(\"\t\")");
|
|
|
|
|
TFilename paths = _msk->get(F_PATH);
|
|
|
|
|
TCSV_rendiconto_ca_recordset * xls_dest = new TCSV_rendiconto_ca_recordset(mask.get(F_CONTSEP));
|
|
|
|
|
TString val;
|
|
|
|
|
|
|
|
|
|
paths.lower();
|
|
|
|
|
paths.add("rend.xls");
|
|
|
|
|
xls_source.load_file(paths);
|
|
|
|
|
xls_source.load_file(printfilename);
|
|
|
|
|
|
|
|
|
|
const TEsercizio & e = esc.esercizio(anno == 0 ? (datafin.ok() ? datafin.year() : dataini.year()) : anno);
|
|
|
|
|
const int ncols = xls_source.columns();
|
|
|
|
@ -2810,7 +2834,11 @@ void TPrint_rendiconto_ca::execute_print(TReport_book & book, TAutomask & mask,
|
|
|
|
|
}
|
|
|
|
|
rep_xls.TReport::set_recordset(xls_dest);
|
|
|
|
|
book.add(rep_xls);
|
|
|
|
|
} */
|
|
|
|
|
goto_url(datefilename);
|
|
|
|
|
book.print_or_preview();
|
|
|
|
|
}
|
|
|
|
|
if (log.recordset()->items() > 0)
|
|
|
|
|
log.preview();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TPrint_rendiconto_ca::user_destroy()
|
|
|
|
|