Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :


git-svn-id: svn://10.65.10.50/trunk@20232 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2010-03-15 16:38:52 +00:00
parent 91489e08c7
commit b3e0e9f6fe
2 changed files with 102 additions and 4 deletions

@ -1,20 +1,29 @@
#include <applicat.h>
#include <automask.h>
#include <defmask.h>
#include <golem.h>
#include <modaut.h>
#include <progind.h>
#include <reputils.h>
#include <textset.h>
#include <utility.h>
#include "pg0067100a.h"
///////////////////////////////////////////////
// MASCHERA
///////////////////////////////////////////////
class TDistribuzione_f24_mask : public TAutomask
{
protected:
TRecordset* create_recordset() const;
void print_stats() const;
void export_stats() const;
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
TDistribuzione_f24_mask();
};
@ -25,14 +34,82 @@ TDistribuzione_f24_mask::TDistribuzione_f24_mask() : TAutomask("pg0067100a")
bool TDistribuzione_f24_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
/*switch(o.dlg())
switch(o.dlg())
{
case DLG_PRINT: //stampa
if (e == fe_button)
{
print_stats();
}
break;
case DLG_EXPORT: //esporta in excel
if (e == fe_button)
{
export_stats();
}
break;
default:
break;
}*/
}
return true;
}
//metodo comune di generazione del recordset
//recordset che deve ordinare, per piva e anno, i files pdf che trova nelle sottocartelle della..
//..cartella radice di destinazione
TRecordset* TDistribuzione_f24_mask::create_recordset() const
{
TAS400_recordset* recset = new TAS400_recordset("AS400(25)");
recset->create_field("CODICE_FISCALE", 0, 16, _alfafld, true);
recset->create_field("ANNO", -1, 4, _intfld, true);
recset->create_field("F24", -1, 3, _intfld, false);
recset->create_field("CR", -1, 2, _alfafld, true, TVariant("\n\r"));
//cartella radice di destinazione
const TString& dest_dir = get(F_PATH_DST);
TFilename dest_pivas = dest_dir; dest_pivas.add("*");
SLIST pivas = xvt_fsys_list_files(DIR_TYPE, dest_pivas, true);
for (SLIST_ELT e = xvt_slist_get_first(pivas); e; e = xvt_slist_get_next(pivas, e))
{
TFilename dest_years = xvt_slist_get(pivas, e, NULL);
const TString piva = dest_years.name_only();
dest_years.add("????");
SLIST years = xvt_fsys_list_files(DIR_TYPE, dest_years, true);
for (SLIST_ELT e = xvt_slist_get_first(years); e; e = xvt_slist_get_next(years, e))
{
TFilename dest_year = xvt_slist_get(years, e, NULL);
const TString4 year = dest_year.name_only();
dest_year.add("*.pdf");
SLIST files = xvt_fsys_list_files("", dest_year, false);
const long count = xvt_slist_count(files);
xvt_slist_destroy(files);
//aggiunge la riga al recordset
recset->new_rec("");
recset->set("CODICE_FISCALE", piva);
recset->set("ANNO", year);
recset->set("F24", count);
}
xvt_slist_destroy(years);
}
xvt_slist_destroy(pivas);
return recset;
}
void TDistribuzione_f24_mask::print_stats() const
{
}
void TDistribuzione_f24_mask::export_stats() const
{
TRecordset* recset = create_recordset();
if (recset->save_as("statistiche.xls", fmt_html))
goto_url("statistiche.xls");
delete recset;
}
//////////////////////////////////////////////
// APPLICAZIONE
@ -153,7 +230,13 @@ void TDistribuzione_f24::elabora()
continue;
}
}
}
} //for(int i...
message_box(TR("Archiviazione F24 completata"));
const int items = log.recordset()->items();
if (items > 0)
log.preview();
}
bool TDistribuzione_f24::create()
@ -170,6 +253,7 @@ void TDistribuzione_f24::main_loop()
_mask = new TDistribuzione_f24_mask;
if (_mask->run() != K_QUIT)
elabora();
delete _mask;
_mask = NULL;
}
@ -177,6 +261,6 @@ void TDistribuzione_f24::main_loop()
int pg0067100 (int argc, char **argv)
{
TDistribuzione_f24 a;
a.run(argc,argv, TR("Spostamento F24"));
a.run(argc,argv, TR("Archiviazione F24"));
return true;
}

@ -34,7 +34,21 @@ END
ENDPAGE
TOOLBAR "" 0 0 0 2
#include <elabar.h>
BUTTON DLG_PRINT 2 2
BEGIN
PROMPT 5 1 "~Statistiche"
PICTURE TOOL_PRINTELENCO
END
BUTTON DLG_EXPORT 2 2
BEGIN
PROMPT 6 1 "~Excel"
PICTURE TOOL_EXCEL
END
ENDPAGE
ENDMASK