Patch level : 10.0

Files correlati     : cg3.exe cg3600b.msk
Ricompilazione Demo : [ ]
Commento            :
Aggiunta possibilitá di esportare senza aprire il file Excel


git-svn-id: svn://10.65.10.50/trunk@20095 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2010-02-10 12:22:21 +00:00
parent 39d4c1c9b0
commit c4f1572238
3 changed files with 52 additions and 21 deletions

View File

@ -904,7 +904,8 @@ print_action TStampa_allegati::postprocess_page(int file, int counter)
//
// Se sono in una pagina dispari devo fare 2 formfeed
//
if (ODD(pagina_corrente)) printer().formfeed();
if (pagina_corrente & 1)
printer().formfeed();
return NEXT_PAGE;
}
@ -1130,19 +1131,20 @@ bool TStampa_allegati::preprocess_page(int file,int counter)
{
codditta_curr = buff->codditta_dic;
printer().formfeed();
if (ODD(pagina_corrente)) printer().formfeed();
if (pagina_corrente & 1)
printer().formfeed();
_t->azzera_totali();
}
else
{
// .. e se cambia l'attivita'
if (_distingui_att)
if (codatt_curr != buff->codatt_dic)
{
codatt_curr = buff->codatt_dic;
if (_distingui_att && codatt_curr != buff->codatt_dic)
{
codatt_curr = buff->codatt_dic;
printer().formfeed();
if (pagina_corrente & 1)
printer().formfeed();
if (ODD(pagina_corrente)) printer().formfeed();
}
}
}
}
@ -1158,7 +1160,7 @@ void TStampa_allegati::preprocess_header()
// printer().footerlen (LUNGHEZZA_FOOTER);
pagina_corrente = printer().getcurrentpage();
if (ODD (pagina_corrente))
if (pagina_corrente & 1)
intesta();
else
reset_header();
@ -1178,7 +1180,7 @@ void TStampa_allegati::preprocess_footer()
if (pagina_corrente == 1)
_t->azzera_totali();
if (EVEN (pagina_corrente))
if ((pagina_corrente & 1) == 0)
stampa_totali(ultima);
}

View File

@ -2126,6 +2126,7 @@ protected: // TMask
static bool link_handler(TMask_field& f, KEY k);
static bool new_handler(TMask_field& f, KEY k);
static bool edit_handler(TMask_field& f, KEY k);
static bool export_handler(TMask_field& f, KEY k);
public:
TMastrini_grid& grid() { CHECK(_grid, "What's grid?"); return *_grid; }
@ -2138,9 +2139,10 @@ TGrid_mask::TGrid_mask()
: _grid(NULL)
{
read_mask("cg3600b", 0, 0);
set_handler(DLG_LINK, link_handler);
set_handler(DLG_LINK, link_handler);
set_handler(DLG_NEWREC, new_handler);
set_handler(DLG_EDIT, edit_handler);
set_handler(DLG_EDIT, edit_handler);
set_handler(DLG_EXPORT, export_handler);
}
TMask_field* TGrid_mask::parse_field(TScanner& sc)
@ -2184,19 +2186,40 @@ bool TGrid_mask::new_handler(TMask_field& f, KEY k)
bool TGrid_mask::edit_handler(TMask_field& f, KEY k)
{
bool ok = true;
if (k == K_SPACE)
{
TGrid_mask& gm = (TGrid_mask&)f.mask();
TMastrini_grid& grid = gm.grid();
TMastrino_set ms(grid);
TFilename n; n.tempdir(); n.add("mastrino.slk");
ms.save_as(n);
xvt_sys_goto_url(n, "open");
TFilename n; n.tempdir(); n.add("mastrino.xls");
ms.save_as(n, fmt_text);
ok = xvt_sys_goto_url(n, "open") != FALSE;
if (!ok)
ok = export_handler(f, k); // Se non parte Excel salvo altrove
}
return true;
return ok;
}
bool TGrid_mask::export_handler(TMask_field& f, KEY k)
{
bool ok = true;
if (k == K_SPACE)
{
TFilename n; n.tempdir(); n.add("mastrino.xls");
FILE_SPEC fs; xvt_fsys_convert_str_to_fspec(n, &fs);
if (xvt_dm_post_file_save(&fs, TR("Esportazione")) == FL_OK)
{
xvt_fsys_convert_fspec_to_str(&fs, n.get_buffer(), n.size());
TGrid_mask& gm = (TGrid_mask&)f.mask();
TMastrini_grid& grid = gm.grid();
TMastrino_set ms(grid);
ms.save_as(n, fmt_text);
}
}
return ok;
}
bool TGrid_mask::on_key(KEY k)
{

View File

@ -4,25 +4,31 @@ TOOLBAR "topbar" 0 0 0 2
BUTTON DLG_LINK 10 2
BEGIN
PROMPT -14 -11 "Colle~ga"
PROMPT 1 1 "Colle~ga"
PICTURE TOOL_LINK
END
BUTTON DLG_NEWREC 10 2
BEGIN
PROMPT -24 -11 "~Nuovo"
PROMPT 2 1 "~Nuovo"
PICTURE TOOL_NEWREC
END
BUTTON DLG_EDIT 10 2
BEGIN
PROMPT -34 -11 "~Edit"
PICTURE TOOL_EDIT
PROMPT 3 1 "E~xcel"
PICTURE TOOL_EXCEL
END
BUTTON DLG_EXPORT 10 2
BEGIN
PROMPT 4 1 "~Esporta"
PICTURE TOOL_EXPORT
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -44 -11 ""
PROMPT 5 1 ""
END
ENDPAGE