Patch level : 266
Files correlati : ve0.exe Ricompilazione Demo : [ ] Commento : Aggiunto supporto per anteprima stampa documenti direttamente dall'immissione git-svn-id: svn://10.65.10.50/trunk@18595 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
c86bf0d38c
commit
ea24ed43bc
157
ve/ve0100.cpp
157
ve/ve0100.cpp
@ -1,6 +1,5 @@
|
|||||||
#include <colmask.h>
|
#include <colmask.h>
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
#include <printer.h>
|
|
||||||
#include <recset.h>
|
#include <recset.h>
|
||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
@ -27,26 +26,13 @@ TCursor& TMotore_application::get_filtered_cursor() const
|
|||||||
|
|
||||||
bool TMotore_application::save_and_new() const
|
bool TMotore_application::save_and_new() const
|
||||||
{
|
{
|
||||||
TDocumento_mask & m = edit_mask();
|
|
||||||
bool new_doc = false;
|
bool new_doc = false;
|
||||||
|
|
||||||
|
TDocumento_mask & m = edit_mask();
|
||||||
if (m.insert_mode())
|
if (m.insert_mode())
|
||||||
{
|
{
|
||||||
TDocumento & doc = m.doc();
|
TDocumento& doc = m.doc();
|
||||||
new_doc = doc.codice_numerazione().save_and_new();
|
new_doc = doc.codice_numerazione().save_and_new();
|
||||||
|
|
||||||
if (new_doc && doc.tipo().printable()) // && yesno_box(TR("Si desidera stampare il documento")))
|
|
||||||
{
|
|
||||||
const char s[2] = { doc.tipo().stato_finale_stampa(), '\0' };
|
|
||||||
|
|
||||||
app()._print_directly = true;
|
|
||||||
app().print();
|
|
||||||
app()._print_directly= false;
|
|
||||||
m.set(F_STATO, s, TRUE);
|
|
||||||
doc.read();
|
|
||||||
doc.put(DOC_STATO, s);
|
|
||||||
doc.rewrite();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new_doc;
|
return new_doc;
|
||||||
@ -55,6 +41,7 @@ bool TMotore_application::save_and_new() const
|
|||||||
void TMotore_application::init_query_mode( TMask& m )
|
void TMotore_application::init_query_mode( TMask& m )
|
||||||
{
|
{
|
||||||
disable_menu_item(M_FILE_PRINT);
|
disable_menu_item(M_FILE_PRINT);
|
||||||
|
disable_menu_item(M_FILE_PREVIEW);
|
||||||
disable_menu_item(MENU_ITEM_ID(1));
|
disable_menu_item(MENU_ITEM_ID(1));
|
||||||
|
|
||||||
TEdit_field& cn = _msk->efield(F_CODNUM);
|
TEdit_field& cn = _msk->efield(F_CODNUM);
|
||||||
@ -153,7 +140,8 @@ void TMotore_application::init_insert_mode( TMask& m )
|
|||||||
m.enable(DLG_CONFERMA);
|
m.enable(DLG_CONFERMA);
|
||||||
else
|
else
|
||||||
m.disable(DLG_CONFERMA);
|
m.disable(DLG_CONFERMA);
|
||||||
m.disable(DLG_PRINT);
|
m.disable(DLG_PRINT);
|
||||||
|
m.disable(DLG_PREVIEW);
|
||||||
m.disable(DLG_ELABORA);
|
m.disable(DLG_ELABORA);
|
||||||
|
|
||||||
if (curdo.tipo().auto_add())
|
if (curdo.tipo().auto_add())
|
||||||
@ -173,18 +161,23 @@ void TMotore_application::init_modify_mode( TMask& m )
|
|||||||
n.set("");
|
n.set("");
|
||||||
n.update_flags("R");
|
n.update_flags("R");
|
||||||
const bool enable_print = edit_mask().doc().tipo().printable();
|
const bool enable_print = edit_mask().doc().tipo().printable();
|
||||||
const TString4 provv = m.get(F_PROVV);
|
const char provv = m.get(F_PROVV)[0];
|
||||||
enable_menu_item(M_FILE_PRINT, provv == "D" && enable_print);
|
|
||||||
enable_menu_item(MENU_ITEM_ID(1));
|
enable_menu_item(MENU_ITEM_ID(1));
|
||||||
if (provv[0] == 'P')
|
if (provv == 'P')
|
||||||
{
|
{
|
||||||
m.disable(DLG_PRINT);
|
|
||||||
m.enable(DLG_CONFERMA);
|
m.enable(DLG_CONFERMA);
|
||||||
|
m.disable(DLG_PRINT);
|
||||||
|
m.disable(DLG_PREVIEW);
|
||||||
|
enable_menu_item(M_FILE_PRINT, false);
|
||||||
|
enable_menu_item(M_FILE_PREVIEW, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m.disable(DLG_CONFERMA);
|
m.disable(DLG_CONFERMA);
|
||||||
m.enable(DLG_PRINT, enable_print);
|
m.enable(DLG_PRINT, enable_print);
|
||||||
|
m.enable(DLG_PREVIEW, enable_print);
|
||||||
|
enable_menu_item(M_FILE_PRINT, enable_print);
|
||||||
|
enable_menu_item(M_FILE_PREVIEW, enable_print);
|
||||||
}
|
}
|
||||||
m.enable(DLG_ELABORA);
|
m.enable(DLG_ELABORA);
|
||||||
m.disable(F_STATO);
|
m.disable(F_STATO);
|
||||||
@ -382,8 +375,17 @@ int TMotore_application::write( const TMask& m ) // C 90
|
|||||||
{
|
{
|
||||||
mask.update_father_rows();
|
mask.update_father_rows();
|
||||||
mask.save_father_rows();
|
mask.save_father_rows();
|
||||||
|
|
||||||
|
// Stampa immediatamente dopo aver salvato se possibile
|
||||||
|
if (d.codice_numerazione().save_and_new() && d.tipo().printable())
|
||||||
|
{
|
||||||
|
const TString& sis = d.tipo().stati_iniziali_stampa();
|
||||||
|
if (sis.find(d.stato()) >= 0)
|
||||||
|
save_and_print(false, winprinter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return err;
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TMotore_application::rewrite( const TMask& m ) // C 90
|
int TMotore_application::rewrite( const TMask& m ) // C 90
|
||||||
@ -922,71 +924,86 @@ void TMotore_application::ini2mask(TConfig& ini, TMask& msk, bool query)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMotore_application::print()
|
bool TMotore_application::save_and_print(bool savedoc, TPrtype mode)
|
||||||
{
|
{
|
||||||
bool ok = _print_directly;
|
if (savedoc)
|
||||||
if (!ok)
|
|
||||||
{
|
{
|
||||||
ok = save(false);
|
if (save(false))
|
||||||
edit_mask().update_father_rows(false);
|
edit_mask().update_father_rows(false);
|
||||||
}
|
else
|
||||||
if (ok) // Registra il record corrente
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
TDocumento& doc = (TDocumento&)get_relation()->curr();
|
||||||
|
|
||||||
|
const TTipo_documento& tipo = doc.tipo();
|
||||||
|
TFilename rep;
|
||||||
|
if (tipo.main_print_profile(rep, 0))
|
||||||
{
|
{
|
||||||
TDocumento& doc = (TDocumento&)get_relation()->curr();
|
const bool da_stampare = doc.stampabile();
|
||||||
|
|
||||||
const TTipo_documento& tipo = doc.tipo();
|
TString commandline;
|
||||||
TFilename rep;
|
if (rep.ends_with(".rep"))
|
||||||
if (tipo.main_print_profile(rep, 0))
|
commandline = "ve1 -2"; // Esiste il nuovo report :-)
|
||||||
|
else
|
||||||
|
commandline = "ve1 -0"; // Esiste il vecchio form :-(
|
||||||
|
|
||||||
|
commandline << ' ' << doc.get(DOC_CODNUM) << ' ' << doc.get(DOC_ANNO) << ' ';
|
||||||
|
commandline << doc.get(DOC_PROVV) << ' ' << doc.get(DOC_NDOC) << ' ';
|
||||||
|
switch (mode)
|
||||||
{
|
{
|
||||||
const bool da_stampare = doc.stampabile();
|
case fileprinter: commandline << " P"; break;
|
||||||
|
case screenvis : commandline << " A"; break;
|
||||||
|
default : commandline << " S"; break;
|
||||||
|
}
|
||||||
|
commandline << ' ' << (da_stampare ? 'D' : 'P');
|
||||||
|
|
||||||
TString commandline;
|
const int ncopie = tipo.ncopie();
|
||||||
if (rep.ends_with(".rep"))
|
if (ncopie > 0)
|
||||||
commandline = "ve1 -2"; // Esiste il nuovo report :-)
|
commandline << ' ' << ncopie;
|
||||||
else
|
|
||||||
commandline = "ve1 -0"; // Esiste il vecchio form :-(
|
|
||||||
|
|
||||||
commandline << ' ' << doc.get(DOC_CODNUM) << ' ' << doc.get(DOC_ANNO) << ' ';
|
TExternal_app interattivo( commandline );
|
||||||
commandline << doc.get(DOC_PROVV) << ' ' << doc.get(DOC_NDOC) << ' ';
|
if (interattivo.run() == NOERR)
|
||||||
if (printer().printtype() == screenvis)
|
{
|
||||||
commandline << 'A';
|
if (da_stampare) // Aggiorna stato documento se necessario
|
||||||
else
|
|
||||||
commandline << 'S';
|
|
||||||
commandline << ' ' << (da_stampare ? 'D' : 'P');
|
|
||||||
|
|
||||||
const int ncopie = tipo.ncopie();
|
|
||||||
if (ncopie > 0)
|
|
||||||
commandline << ' ' << ncopie;
|
|
||||||
|
|
||||||
TExternal_app interattivo( commandline );
|
|
||||||
if (interattivo.run() == NOERR)
|
|
||||||
{
|
{
|
||||||
if (da_stampare) // Aggiorna stato documento se necessario
|
TDocumento_mask& m = edit_mask();
|
||||||
{
|
TDocumento& maindoc = m.doc();
|
||||||
TDocumento_mask& m = edit_mask();
|
maindoc.read(); // Aggiorna STATO e MOVMAG generati da ve1
|
||||||
TDocumento& maindoc = m.doc();
|
|
||||||
maindoc.read(); // Aggiorna STATO e MOVMAG generati da ve1
|
|
||||||
|
|
||||||
// Lo stato del documento vive di vita propria
|
// Lo stato del documento vive di vita propria
|
||||||
const char sfs = maindoc.tipo().stato_finale_stampa();
|
const char sfs = maindoc.tipo().stato_finale_stampa();
|
||||||
maindoc.stato(sfs);
|
maindoc.stato(sfs);
|
||||||
const char str_sfs[2] = { sfs, '\0' };
|
const char str_sfs[2] = { sfs, '\0' };
|
||||||
m.set(F_STATO, str_sfs, true);
|
m.set(F_STATO, str_sfs, true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
rep.ext("");
|
|
||||||
message_box("Il profilo %s non esiste", (const char *) rep);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rep.ext("");
|
||||||
|
return error_box("Il profilo %s non esiste", (const char*)rep);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TMotore_application::print()
|
||||||
|
{
|
||||||
|
if (edit_mask().id2pos(DLG_PREVIEW) < 0)
|
||||||
|
save_and_print(true, printer().printtype());
|
||||||
|
else
|
||||||
|
save_and_print(true, winprinter);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TMotore_application::preview()
|
||||||
|
{
|
||||||
|
save_and_print(true, screenvis);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ve0100( int argc, char* argv[])
|
int ve0100( int argc, char* argv[])
|
||||||
{
|
{
|
||||||
TMotore_application a;
|
TMotore_application a;
|
||||||
|
|
||||||
a.run( argc, argv, TR("Gestione documenti"));
|
a.run( argc, argv, TR("Gestione documenti"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
11
ve/ve0100.h
11
ve/ve0100.h
@ -7,6 +7,11 @@
|
|||||||
#include <relapp.h>
|
#include <relapp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __PRINTER_H
|
||||||
|
#include <printer.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef __VELIB_H
|
#ifndef __VELIB_H
|
||||||
#include "velib.h"
|
#include "velib.h"
|
||||||
#endif
|
#endif
|
||||||
@ -30,8 +35,6 @@ class TMotore_application : public TRelation_application
|
|||||||
TString4 _tipodoc;
|
TString4 _tipodoc;
|
||||||
TString80 __last_key;
|
TString80 __last_key;
|
||||||
|
|
||||||
bool _print_directly;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Array di maschere documento
|
// Array di maschere documento
|
||||||
TAssoc_array _doc_masks;
|
TAssoc_array _doc_masks;
|
||||||
@ -50,6 +53,7 @@ protected:
|
|||||||
virtual int rewrite( const TMask& m );
|
virtual int rewrite( const TMask& m );
|
||||||
virtual bool remove();
|
virtual bool remove();
|
||||||
virtual void print();
|
virtual void print();
|
||||||
|
virtual void preview();
|
||||||
virtual bool has_filtered_cursor() const { return true; }
|
virtual bool has_filtered_cursor() const { return true; }
|
||||||
virtual TCursor& get_filtered_cursor() const;
|
virtual TCursor& get_filtered_cursor() const;
|
||||||
virtual bool save_and_new() const;
|
virtual bool save_and_new() const;
|
||||||
@ -73,6 +77,7 @@ protected:
|
|||||||
virtual void ini2mask(TConfig& ini, TMask& m, bool query);
|
virtual void ini2mask(TConfig& ini, TMask& m, bool query);
|
||||||
|
|
||||||
bool last_doc(char provv, int anno, const char* codnum, long& ndoc, TDate& datadoc) const;
|
bool last_doc(char provv, int anno, const char* codnum, long& ndoc, TDate& datadoc) const;
|
||||||
|
bool save_and_print(bool savedoc, TPrtype mode);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual TRelation* get_relation( ) const { return _rel;}
|
virtual TRelation* get_relation( ) const { return _rel;}
|
||||||
@ -87,7 +92,7 @@ public:
|
|||||||
TDocumento & doc() {return edit_mask().doc(); }
|
TDocumento & doc() {return edit_mask().doc(); }
|
||||||
|
|
||||||
// Operazione
|
// Operazione
|
||||||
TMotore_application( ) : _print_directly(false) { }
|
TMotore_application( ) { }
|
||||||
virtual ~TMotore_application( ) { }
|
virtual ~TMotore_application( ) { }
|
||||||
|
|
||||||
virtual const char* get_next_key( );
|
virtual const char* get_next_key( );
|
||||||
|
@ -1486,12 +1486,22 @@ void TMask_generator::genera( const TString& profilo )
|
|||||||
_m->message( "EXIT,127" );
|
_m->message( "EXIT,127" );
|
||||||
_m->end( );
|
_m->end( );
|
||||||
|
|
||||||
|
_m->control( T_BOTTONE, DLG_NULL, 202 );
|
||||||
|
_m->begin( );
|
||||||
|
_m->end( );
|
||||||
|
|
||||||
_m->control( T_BOTTONE, DLG_ELABORA, 202 );
|
_m->control( T_BOTTONE, DLG_ELABORA, 202 );
|
||||||
_m->begin( );
|
_m->begin( );
|
||||||
_m->prompt( 4, 1, "E~labora" );
|
_m->prompt( 4, 1, "E~labora" );
|
||||||
_m->picture(TOOL_ELABORA);
|
_m->picture(TOOL_ELABORA);
|
||||||
_m->end( );
|
_m->end( );
|
||||||
|
|
||||||
|
_m->control( T_BOTTONE, DLG_PREVIEW, 202 );
|
||||||
|
_m->begin( );
|
||||||
|
_m->prompt( 5, 1, "Anteprima" );
|
||||||
|
_m->picture(TOOL_PREVIEW);
|
||||||
|
_m->end( );
|
||||||
|
|
||||||
_m->control( T_BOTTONE, DLG_PRINT, 202 );
|
_m->control( T_BOTTONE, DLG_PRINT, 202 );
|
||||||
_m->begin( );
|
_m->begin( );
|
||||||
_m->prompt( 5, 1 );
|
_m->prompt( 5, 1 );
|
||||||
@ -1505,6 +1515,10 @@ void TMask_generator::genera( const TString& profilo )
|
|||||||
_m->flag("D");
|
_m->flag("D");
|
||||||
_m->end( );
|
_m->end( );
|
||||||
|
|
||||||
|
_m->control( T_BOTTONE, DLG_NULL, 202 );
|
||||||
|
_m->begin( );
|
||||||
|
_m->end( );
|
||||||
|
|
||||||
_m->control( T_BOTTONE, DLG_FIRSTREC, 202 );
|
_m->control( T_BOTTONE, DLG_FIRSTREC, 202 );
|
||||||
_m->begin( );
|
_m->begin( );
|
||||||
_m->prompt( 7, 1, "Primo");
|
_m->prompt( 7, 1, "Primo");
|
||||||
@ -1540,32 +1554,32 @@ void TMask_generator::genera( const TString& profilo )
|
|||||||
_m->picture(TOOL_LASTREC);
|
_m->picture(TOOL_LASTREC);
|
||||||
_m->end( );
|
_m->end( );
|
||||||
|
|
||||||
|
_m->control( T_BOTTONE, DLG_NULL, 202 );
|
||||||
|
_m->begin( );
|
||||||
|
_m->end( );
|
||||||
|
|
||||||
|
/* Occupa spazio prezioso
|
||||||
_m->control( T_BOTTONE, DLG_INFO, 202 );
|
_m->control( T_BOTTONE, DLG_INFO, 202 );
|
||||||
_m->begin( );
|
_m->begin( );
|
||||||
_m->prompt( 12, 1, "Info");
|
_m->prompt( 12, 1, "Info");
|
||||||
_m->message( "EXIT,332" );
|
_m->message( "EXIT,332" );
|
||||||
_m->picture(TOOL_INFO);
|
_m->picture(TOOL_INFO);
|
||||||
_m->end( );
|
_m->end( );
|
||||||
|
*/
|
||||||
/* non funziona per ora
|
|
||||||
_m->control( T_BOTTONE, DLG_HELP, 202 );
|
|
||||||
_m->begin( );
|
|
||||||
_m->prompt( 12, 1 );
|
|
||||||
_m->message( "EXIT,331" );
|
|
||||||
_m->picture(BMP_HELP);
|
|
||||||
_m->end( ); */
|
|
||||||
|
|
||||||
_m->control( T_BOTTONE, DLG_CANCEL, 202 );
|
_m->control( T_BOTTONE, DLG_CANCEL, 202 );
|
||||||
_m->begin( );
|
_m->begin( );
|
||||||
_m->prompt( 13, 1 );
|
_m->prompt( 13, 1, PR("Indietro") );
|
||||||
_m->message( "EXIT,27" );
|
_m->message( "EXIT,27" );
|
||||||
_m->end( );
|
_m->end( );
|
||||||
|
|
||||||
|
/* Occupa spazio prezioso
|
||||||
_m->control( T_BOTTONE, DLG_QUIT, 202 );
|
_m->control( T_BOTTONE, DLG_QUIT, 202 );
|
||||||
_m->begin( );
|
_m->begin( );
|
||||||
_m->prompt( 14, 1 );
|
_m->prompt( 14, 1 );
|
||||||
_m->message( "EXIT,20334" );
|
_m->message( "EXIT,20334" );
|
||||||
_m->end( );
|
_m->end( );
|
||||||
|
*/
|
||||||
|
|
||||||
// End della toolbar
|
// End della toolbar
|
||||||
_m->end( );
|
_m->end( );
|
||||||
|
@ -161,6 +161,7 @@ TDocumento_mask::TDocumento_mask(const char* td)
|
|||||||
set_field_handler( F_DATADOCRIF, datadocrif_handler);
|
set_field_handler( F_DATADOCRIF, datadocrif_handler);
|
||||||
set_handler( DLG_ELABORA, elabora_handler );
|
set_handler( DLG_ELABORA, elabora_handler );
|
||||||
set_handler( DLG_PRINT, print_handler );
|
set_handler( DLG_PRINT, print_handler );
|
||||||
|
set_handler( DLG_PREVIEW, print_handler );
|
||||||
set_handler( DLG_CONFERMA, confirm_handler );
|
set_handler( DLG_CONFERMA, confirm_handler );
|
||||||
|
|
||||||
const TString_array& handlers = tdoc.handlers();
|
const TString_array& handlers = tdoc.handlers();
|
||||||
@ -3135,8 +3136,13 @@ bool TDocumento_mask::elabora_handler( TMask_field& f, KEY key )
|
|||||||
bool TDocumento_mask::print_handler( TMask_field& f, KEY key )
|
bool TDocumento_mask::print_handler( TMask_field& f, KEY key )
|
||||||
{
|
{
|
||||||
if (key == K_SPACE)
|
if (key == K_SPACE)
|
||||||
main_app().print();
|
{
|
||||||
return TRUE;
|
if (f.dlg() == DLG_PREVIEW)
|
||||||
|
main_app().preview();
|
||||||
|
else
|
||||||
|
main_app().print();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TDocumento_mask::set_field_handler(short fieldid, CONTROL_HANDLER handler)
|
void TDocumento_mask::set_field_handler(short fieldid, CONTROL_HANDLER handler)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user