Patch level : 10.0 142

Files correlati     :  ve0.exe
Ricompilazione Demo : [ ]
Commento            :

aggiunti 2 paramentri alla chiamata dei documenti interattivi per poter selesionare solo bolle o fatture (Lavanderie)


git-svn-id: svn://10.65.10.50/trunk@17420 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2008-10-16 06:16:56 +00:00
parent 5311bdafd3
commit b5d542918d
3 changed files with 96 additions and 31 deletions

View File

@ -487,7 +487,6 @@ bool TMotore_application::user_create( )
LF_TAB, LF_TABCOM, LF_CLIFO, LF_CFVEN, LF_INDSP, LF_OCCAS, LF_PCON, LF_MOV, LF_STOMAG,
LF_MOVMAG, LF_RMOVMAG, LF_MAG, LF_SVRIEP, LF_AGENTI, LF_PERCPROV, LF_ATTIV, LF_CAUSALI, 0);
_config_ditta = new TConfig(CONFIG_DITTA);
// Metto in relazione testata e righe
@ -501,13 +500,75 @@ bool TMotore_application::user_create( )
_msk->set_handler( F_ANNO, TDocumento_mask::anno_handler );
_msk->set_handler( F_CODNUM, TDocumento_mask::num_handler );
_msk->set_handler( F_TIPODOC, TDocumento_mask::tip_handler );
_msk->set_handler( F_NUMDOCRIF, TDocumento_mask::numdocrif_search_handler );
_msk->set_handler( F_RAGSOCSEARCH, TDocumento_mask::ragsoc_search_handler );
TConfig utente( CONFIG_USER );
_codnum = utente.get("CODNUM");
_tipodoc = utente.get("TIPODOC");
const int args = argc() ;
for (int i = 2; i < args; i++)
{
const TString arg(argv(i));
if (arg.starts_with("-def"))
{
TToken_string str(arg.mid(4), ',');
const TString16 codnum(str.get());
const TString16 tipodoc(str.get());
const TString16 paragraph(str.get());
if (paragraph.blank())
{
_codnum = codnum;
_tipodoc = tipodoc;
}
else
{
TConfig c(CONFIG_DITTA, paragraph);
_codnum = c.get(codnum);
_tipodoc = c.get(tipodoc);
}
}
else
if (arg.starts_with("-filt"))
{
TEdit_field & e = _msk->efield(F_CODNUM);
TBrowse * b = e.browse();
TEdit_field & edes = _msk->efield(F_DESNUM);
TBrowse * bdes = edes.browse();
if (b != NULL || bdes != NULL)
{
TString filter = b->get_filter();
if (filter.full())
{
filter.insert("(");
filter << ")&&(" << arg.mid(5) << ")";
if (b != NULL)
b->set_filter(filter);
if (bdes != NULL)
bdes->set_filter(filter);
}
else
{
const TString newfilter(arg.mid(5));
if (b != NULL)
b->set_filter(newfilter);
if (bdes != NULL)
bdes->set_filter(newfilter);
}
}
}
}
TConfig utente( CONFIG_USER );
if (_codnum.blank())
_codnum = utente.get("CODNUM");
if (_tipodoc.blank())
_tipodoc = utente.get("TIPODOC");
_docmsk = NULL;
load_auto_reopen_data();

View File

@ -916,7 +916,6 @@ public:
TCodgiac_livelli& livelli() const { return *_livelli_giac; }
static bool anno_handler( TMask_field& f, KEY key);
static bool num_handler( TMask_field& f, KEY key );
static bool tip_handler( TMask_field& f, KEY key );
static bool numdocrif_search_handler( TMask_field& f, KEY key );
static bool ragsoc_search_handler( TMask_field& f, KEY key );
static bool datadocrif_handler(TMask_field& f, KEY key);

View File

@ -3052,17 +3052,40 @@ bool TDocumento_mask::anno_handler( TMask_field& f, KEY key)
return true;
}
TString16 __codnum;
bool tip_filter(const TRelation* r)
{
if (__codnum.blank())
return true;
const TCodice_numerazione & cod_num = cached_numerazione(__codnum);
const TString4 tipo = r->curr().get("CODTAB");
int last = cod_num.ntipi_doc();
for (int i = 0; i < last; i++ )
{
const TString & curtipo = cod_num.tipo_doc(i);
if (curtipo == tipo)
return true;
}
return false;
}
bool TDocumento_mask::num_handler( TMask_field& f, KEY key)
{
if (key == K_TAB && f.to_check(key, TRUE))
{
// Ottengo la maschera
TMask& m = f.mask();
TTable & tabnum = ((TTable &) ((TEdit_field &)f).browse()->cursor()->file());
if ( tabnum.good())
const TString & codnum = f.get();
TCursor * cur = m.efield(F_TIPODOC).browse()->cursor();
TCursor * descur = m.efield(F_DESTIPODOC).browse()->cursor();
__codnum = codnum;
if (codnum.full())
{
TCodice_numerazione cod_num(tabnum.curr());
const TCodice_numerazione & cod_num = cached_numerazione(codnum);
m.set( F_DESNUM, cod_num.descrizione());
// Propone il primo tipo di documento come default
if (m.field(F_TIPODOC).empty() || f.focusdirty())
@ -3091,31 +3114,13 @@ bool TDocumento_mask::num_handler( TMask_field& f, KEY key)
m.set( F_DESNUM, "" );
m.set( F_TIPODOC, "" );
}
cur->set_filterfunction(tip_filter);
descur->set_filterfunction(tip_filter);
app().update_navigation_bar();
}
return TRUE;
}
bool TDocumento_mask::tip_handler( TMask_field& f, KEY key )
{
TDocumento_mask& m = (TDocumento_mask&)f.mask( );
if ( key == K_TAB && m.is_running() && m.get(F_TIPODOC).not_empty())
{
TCodice_numerazione cod_num(m.get(F_CODNUM));
const TString& tipo = f.get();
int last = cod_num.ntipi_doc();
for (int i = 0; i < last; i++ )
{
const TString16 curtipo(cod_num.tipo_doc(i));
if (curtipo == tipo)
return true;
}
return f.error_box( "Tipo non valido per la numerazione selezionata!" );
}
return true;
}
bool TDocumento_mask::codlist_handler( TMask_field& f, KEY key )
{
if (key == K_TAB && f.focusdirty())