Patch level :10.0 276
Files correlati :ca3 Ricompilazione Demo : [ ] Commento : Terminato il programma di esportazione in excel del rendiconto. Da riportare sulla 5 e TESTARE!!!! git-svn-id: svn://10.65.10.50/trunk@18655 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4001b7e63f
commit
c23d8c8a2d
@ -9,6 +9,7 @@
|
|||||||
#include "../cg/cglib01.h"
|
#include "../cg/cglib01.h"
|
||||||
#include "../ve/velib04.h"
|
#include "../ve/velib04.h"
|
||||||
|
|
||||||
|
#include "cdc.h"
|
||||||
#include "commesse.h"
|
#include "commesse.h"
|
||||||
#include "panapdc.h"
|
#include "panapdc.h"
|
||||||
#include "pconana.h"
|
#include "pconana.h"
|
||||||
@ -1590,7 +1591,7 @@ protected:
|
|||||||
void print_or_preview(bool pr);
|
void print_or_preview(bool pr);
|
||||||
virtual void print() { print_or_preview(true); }
|
virtual void print() { print_or_preview(true); }
|
||||||
virtual void preview() { print_or_preview(false); }
|
virtual void preview() { print_or_preview(false); }
|
||||||
void esporta_csv(TMask& mask, TRecordset& rendy, const TString& codcms, const TString& cdc, const TString& codfase);
|
void esporta_csv(TRecordset& rendy, const int r);
|
||||||
void incrementa(TToken_string& riga, const int col, const real& valore) const;
|
void incrementa(TToken_string& riga, const int col, const real& valore) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -1612,16 +1613,31 @@ void TPrint_rendiconto_ca::incrementa(TToken_string& riga, const int col, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//metodo di alto livello per l'esportazione dei dati di totale in un file per excel
|
//metodo di alto livello per l'esportazione dei dati di totale in un file per excel
|
||||||
void TPrint_rendiconto_ca::esporta_csv(TMask& mask, TRecordset& rendy,
|
void TPrint_rendiconto_ca::esporta_csv(TRecordset& rendy, const int r)
|
||||||
const TString& codcms, const TString& cdc, const TString& codfase)
|
|
||||||
{
|
{
|
||||||
|
TMask& mask = *_msk;
|
||||||
|
TSheet_field& sheet = mask.sfield(F_RIGHE);
|
||||||
|
TString codcms; ca_extract_sheet_field(sheet, r, LF_COMMESSE, codcms);
|
||||||
|
TString cdc; ca_extract_sheet_field(sheet, r, LF_CDC, cdc);
|
||||||
|
TString codfase; ca_extract_sheet_field(sheet, r, LF_FASI, codfase);
|
||||||
|
|
||||||
//crea una token string su cui mettere i valori dei record letti dal file .dbf
|
//crea una token string su cui mettere i valori dei record letti dal file .dbf
|
||||||
TToken_string riga(512, '\t');
|
TToken_string riga(512, '\t');
|
||||||
|
|
||||||
riga.add(codcms);
|
if (get_first_level().logic() == LF_COMMESSE)
|
||||||
riga.add(cache().get(LF_COMMESSE, codcms, COMMESSE_DESCRIZ));
|
{
|
||||||
riga.add(cdc);
|
riga.add(codcms);
|
||||||
riga.add(codfase);
|
riga.add(cache().get(LF_COMMESSE, codcms, COMMESSE_DESCRIZ));
|
||||||
|
riga.add(cdc);
|
||||||
|
riga.add(codfase);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
riga.add(cdc);
|
||||||
|
riga.add(cache().get(LF_CDC, cdc, CDC_DESCRIZ));
|
||||||
|
riga.add(codcms);
|
||||||
|
riga.add(codfase);
|
||||||
|
}
|
||||||
|
|
||||||
//recordset sul file .dbf, da scandire tutto uno per volta
|
//recordset sul file .dbf, da scandire tutto uno per volta
|
||||||
for (bool ok = rendy.move_first(); ok; ok = rendy.move_next())
|
for (bool ok = rendy.move_first(); ok; ok = rendy.move_next())
|
||||||
@ -1808,13 +1824,8 @@ void TPrint_rendiconto_ca::main_loop()
|
|||||||
//se stampa o anteprima..
|
//se stampa o anteprima..
|
||||||
if (key == K_ENTER)
|
if (key == K_ENTER)
|
||||||
book.add(rep);
|
book.add(rep);
|
||||||
else
|
else //esportazione in excel
|
||||||
{
|
esporta_csv(*rep.recordset(), 0);
|
||||||
const TString codcms = row.get(0);
|
|
||||||
const TString cdc = row.get();
|
|
||||||
const TString codfase = row.get();
|
|
||||||
esporta_csv(mask, *rep.recordset(), codcms, cdc, codfase);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
sheet.destroy(); //cancella le commesse aggiunte in automatico sullo sheet
|
sheet.destroy(); //cancella le commesse aggiunte in automatico sullo sheet
|
||||||
}
|
}
|
||||||
@ -1827,13 +1838,8 @@ void TPrint_rendiconto_ca::main_loop()
|
|||||||
//se stampa o anteprima
|
//se stampa o anteprima
|
||||||
if (key == K_ENTER)
|
if (key == K_ENTER)
|
||||||
book.add(rep); //aggiunge il report relativo alla cdc/cms corrente al book
|
book.add(rep); //aggiunge il report relativo alla cdc/cms corrente al book
|
||||||
else
|
else //esportazione in excel
|
||||||
{
|
esporta_csv(*rep.recordset(), r);
|
||||||
const TString codcms = row->get(0);
|
|
||||||
const TString cdc = row->get();
|
|
||||||
const TString codfase = row->get();
|
|
||||||
esporta_csv(mask, *rep.recordset(), codcms, cdc, codfase);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//se stampa o anteprima
|
//se stampa o anteprima
|
||||||
@ -1842,7 +1848,7 @@ void TPrint_rendiconto_ca::main_loop()
|
|||||||
if (mask.print_mode() == 'A')
|
if (mask.print_mode() == 'A')
|
||||||
book.preview();
|
book.preview();
|
||||||
else
|
else
|
||||||
book.print(); //stampa il book dei report
|
book.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
} //while(true)...
|
} //while(true)...
|
||||||
|
@ -1979,3 +1979,39 @@ bool ca_implode_rows(const TRecord_array& input_rows, TRecord_array& compact_row
|
|||||||
|
|
||||||
return implosion_done;
|
return implosion_done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
//metodi per ricavare informazioni sulla configurazione (usati per ora nel rendiconto)
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//metodo per ricavare la stringa dei codici dai campi dello sheet
|
||||||
|
bool ca_extract_sheet_field(const TSheet_field& sheet, const int row, const int logicnum, TString& codice)
|
||||||
|
{
|
||||||
|
TMask& mask_sheet = sheet.sheet_mask(); //maschera di riga
|
||||||
|
codice.cut(0);
|
||||||
|
FOR_EACH_MASK_FIELD(mask_sheet, i, f) //giro sui campi della maschera di riga
|
||||||
|
{
|
||||||
|
const TFieldref* fr = f->field(); //campo corrente della maschera
|
||||||
|
if (fr != NULL && f->is_edit()) //deve essere un campo di tipo edit
|
||||||
|
{
|
||||||
|
TEdit_field& e = *(TEdit_field*)f; //visto che è di tipo edit può creare l'edit_field per farne la browse
|
||||||
|
if (e.browse() != NULL)
|
||||||
|
{
|
||||||
|
const TCursor& cur = *e.browse()->cursor();
|
||||||
|
const int ln = cur.file().num(); //Allah! dal campo ricava il cursore sul file di numero ln
|
||||||
|
if (ln == logicnum && cur.key() == 1 && !e.empty())
|
||||||
|
{
|
||||||
|
const TString& parte_codice = e.get();
|
||||||
|
codice << parte_codice;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (codice.full())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return codice.full();
|
||||||
|
}
|
||||||
|
@ -220,4 +220,9 @@ bool ca_can_merge_rows(const TRectype& compact_rec, const TRectype& rec);
|
|||||||
void ca_taglia_campo(TRectype& src, const char* campo_src, TRectype& dst, const char* campo_dst);
|
void ca_taglia_campo(TRectype& src, const char* campo_src, TRectype& dst, const char* campo_dst);
|
||||||
void ca_copia_campo(const TRectype& src, const char* campo_src, TRectype& dst, const char* campo_dst);
|
void ca_copia_campo(const TRectype& src, const char* campo_src, TRectype& dst, const char* campo_dst);
|
||||||
|
|
||||||
|
|
||||||
|
//metodi per ricavare informazioni sulla configurazione (usati per ora nel rendiconto)
|
||||||
|
//metodo per ricavare la stringa dei codici dai campi dello sheet
|
||||||
|
bool ca_extract_sheet_field(const TSheet_field& sheet, const int row, const int logicnum, TString& codice);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user