diff --git a/cg/cg3300.cpp b/cg/cg3300.cpp index fbfa890fa..36182580b 100755 --- a/cg/cg3300.cpp +++ b/cg/cg3300.cpp @@ -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); } diff --git a/cg/cg3600.cpp b/cg/cg3600.cpp index 3a3fba51f..809d10da7 100755 --- a/cg/cg3600.cpp +++ b/cg/cg3600.cpp @@ -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) { diff --git a/cg/cg3600b.uml b/cg/cg3600b.uml index f65b6e8b3..896f00f0f 100755 --- a/cg/cg3600b.uml +++ b/cg/cg3600b.uml @@ -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