Patch level : 12.0 360
Files correlati : li0.exe Commento : Modificata maschera li0400 per visualizzare le vecchie dichiarazioni git-svn-id: svn://10.65.10.50/branches/R_10_00@23671 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
bd30bfab6a
commit
d6bc661b30
@ -1,90 +1,108 @@
|
|||||||
#include <automask.h>
|
#include <automask.h>
|
||||||
#include <defmask.h>
|
#include <defmask.h>
|
||||||
#include <relapp.h>
|
#include <relapp.h>
|
||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
#include "lilib01.h"
|
#include "lilib01.h"
|
||||||
|
|
||||||
#include "li0.h"
|
#include "li0.h"
|
||||||
#include "li0400a.h"
|
#include "li0400a.h"
|
||||||
|
|
||||||
#include "letint.h"
|
#include "letint.h"
|
||||||
|
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
// MASCHERA (li0400a)
|
// MASCHERA (li0400a)
|
||||||
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
||||||
class TLetint_mask : public TAutomask
|
class TLetint_mask : public TAutomask
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||||
virtual bool on_key(KEY k);
|
virtual bool on_key(KEY k);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TDate ultima_stampa(int anno);
|
TDate ultima_stampa(int anno);
|
||||||
bool is_registro(int anno) { return ultima_stampa(anno) > botime;}
|
bool is_registro(int anno) { return ultima_stampa(anno) > botime;}
|
||||||
TLetint_mask();
|
TLetint_mask();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
bool TLetint_mask::on_key(KEY k)
|
bool TLetint_mask::on_key(KEY k)
|
||||||
{
|
{
|
||||||
if (k == K_SHIFT+K_F12 && edit_mode())
|
if (k == K_SHIFT+K_F12 && edit_mode())
|
||||||
enable(DLG_SAVEREC);
|
enable(DLG_SAVEREC);
|
||||||
return TAutomask::on_key(k);
|
return TAutomask::on_key(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TLetint_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
bool TLetint_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||||
{
|
{
|
||||||
switch (o.dlg())
|
switch (o.dlg())
|
||||||
{
|
{
|
||||||
case F_ANNO:
|
case F_ANNO:
|
||||||
if (e == fe_modify || e == fe_init || e == fe_close)
|
if (e == fe_modify || e == fe_init || e == fe_close)
|
||||||
{
|
{
|
||||||
if (!is_registro(atoi(o.get())))
|
if (!is_registro(atoi(o.get())))
|
||||||
return error_box(FR("Manca il registro dichiarazioni d'intento per l'anno %d"), atoi(o.get()));
|
return error_box(FR("Manca il registro dichiarazioni d'intento per l'anno %d"), atoi(o.get()));
|
||||||
}
|
}
|
||||||
case F_NUMPROT:
|
case F_NUMPROT:
|
||||||
if (e == fe_close && query_mode())
|
if (e == fe_close && query_mode())
|
||||||
{
|
{
|
||||||
const long numprot = get_long(F_NUMPROT);
|
const long numprot = get_long(F_NUMPROT);
|
||||||
if (numprot > 1)
|
if (numprot > 1)
|
||||||
{
|
{
|
||||||
const int anno = get_int(F_ANNO);
|
const int anno = get_int(F_ANNO);
|
||||||
TLocalisamfile letint(LF_LETINT);
|
TLocalisamfile letint(LF_LETINT);
|
||||||
letint.put(LETINT_ANNO, anno);
|
letint.put(LETINT_ANNO, anno);
|
||||||
letint.put(LETINT_NUMPROT, numprot - 1);
|
letint.put(LETINT_NUMPROT, numprot - 1);
|
||||||
if (letint.read() != NOERR)
|
if (letint.read() != NOERR)
|
||||||
return error_box(TR("Il numero di protocollo deve essere progressivo!"));
|
return error_box(TR("Il numero di protocollo deve essere progressivo!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case F_DATAREG:
|
case F_DATAREG:
|
||||||
if (e == fe_close && insert_mode())
|
if (e == fe_close && insert_mode())
|
||||||
{
|
{
|
||||||
const long numprot = get_long(F_NUMPROT);
|
const long numprot = get_long(F_NUMPROT);
|
||||||
if (numprot > 1)
|
if (numprot > 1)
|
||||||
{
|
{
|
||||||
const int anno = get_int(F_ANNO);
|
const int anno = get_int(F_ANNO);
|
||||||
TLocalisamfile letint(LF_LETINT);
|
TLocalisamfile letint(LF_LETINT);
|
||||||
letint.put(LETINT_ANNO, anno);
|
letint.put(LETINT_ANNO, anno);
|
||||||
letint.put(LETINT_NUMPROT, numprot - 1);
|
letint.put(LETINT_NUMPROT, numprot - 1);
|
||||||
if (letint.read() == NOERR)
|
if (letint.read() == NOERR)
|
||||||
{
|
{
|
||||||
const TDate& old_data = letint.get_date(LETINT_DATAREG);
|
const TDate& old_data = letint.get_date(LETINT_DATAREG);
|
||||||
if (get_date(F_DATAREG) < old_data)
|
if (get_date(F_DATAREG) < old_data)
|
||||||
return error_box(TR("La data di registrazione non puo' essere antecedente a %s"), (const char*) old_data.string());
|
return error_box(TR("La data di registrazione non puo' essere antecedente a %s"), (const char*) old_data.string());
|
||||||
}
|
}
|
||||||
TDate ultima = ultima_stampa(anno);
|
TDate ultima = ultima_stampa(anno);
|
||||||
if (get_date(F_DATAREG) <= ultima)
|
if (get_date(F_DATAREG) <= ultima)
|
||||||
return error_box(TR("La data di registrazione non puo' essere antecedente a %s"), (const char*) ultima.string());
|
return error_box(TR("La data di registrazione non puo' essere antecedente a %s"), (const char*) ultima.string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (e == fe_modify)
|
if (e == fe_modify)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DLG_SAVEREC:
|
case F_TIPOOP:
|
||||||
{
|
switch(get_int(F_TIPOOP))
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
enable(DLG_SAVEREC);
|
||||||
|
disable(F_DAL);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
enable(DLG_SAVEREC);
|
||||||
|
enable(F_DAL);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
disable(DLG_SAVEREC);
|
||||||
|
disable(F_DAL);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DLG_SAVEREC:
|
||||||
|
{
|
||||||
// Salvo le informazioni nel cliente:
|
// Salvo le informazioni nel cliente:
|
||||||
TRectype cli = cache().get(LF_CFVEN, TString("C|")<< get_int(F_CODCLI));
|
TRectype cli = cache().get(LF_CFVEN, TString("C|")<< get_int(F_CODCLI));
|
||||||
if(!cli.get("VSNRPROT").empty() && TDate(get(F_DAL)) <= TDate(TODAY))
|
if(!cli.get("VSNRPROT").empty() && TDate(get(F_DAL)) <= TDate(TODAY))
|
||||||
@ -93,141 +111,141 @@ bool TLetint_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
|
|||||||
cli.put("VSDATAREG", get_date(F_VSDATA));
|
cli.put("VSDATAREG", get_date(F_VSDATA));
|
||||||
cli.put("NSNPROT", get_int(F_NUMPROT));
|
cli.put("NSNPROT", get_int(F_NUMPROT));
|
||||||
cli.put("NSDATAREG", get_date(F_DATAREG));
|
cli.put("NSDATAREG", get_date(F_DATAREG));
|
||||||
cli.rewrite(TLocalisamfile(LF_CFVEN));
|
cli.rewrite(TLocalisamfile(LF_CFVEN));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
TDate TLetint_mask::ultima_stampa(int anno)
|
TDate TLetint_mask::ultima_stampa(int anno)
|
||||||
{
|
{
|
||||||
TTable reg("REG");
|
TTable reg("REG");
|
||||||
TDate ultima_stampa = botime;
|
TDate ultima_stampa = botime;
|
||||||
TString s; s.format("%0d", anno);
|
TString s; s.format("%0d", anno);
|
||||||
|
|
||||||
reg.put("CODTAB", s);
|
reg.put("CODTAB", s);
|
||||||
for (int err = reg.read(_isgteq); s == reg.get("CODTAB").left(4) && err == NOERR; err = reg.next())
|
for (int err = reg.read(_isgteq); s == reg.get("CODTAB").left(4) && err == NOERR; err = reg.next())
|
||||||
if (reg.get_int("I0") == 10)
|
if (reg.get_int("I0") == 10)
|
||||||
{
|
{
|
||||||
ultima_stampa = reg.get_date("D3");
|
ultima_stampa = reg.get_date("D3");
|
||||||
if (!ultima_stampa.ok())
|
if (!ultima_stampa.ok())
|
||||||
{
|
{
|
||||||
ultima_stampa.set_day(1);
|
ultima_stampa.set_day(1);
|
||||||
ultima_stampa.set_month(1);
|
ultima_stampa.set_month(1);
|
||||||
ultima_stampa.set_year(anno);
|
ultima_stampa.set_year(anno);
|
||||||
--ultima_stampa;
|
--ultima_stampa;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ultima_stampa;
|
return ultima_stampa;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TLetint_mask::TLetint_mask() : TAutomask("li0400a")
|
TLetint_mask::TLetint_mask() : TAutomask("li0400a")
|
||||||
{
|
{
|
||||||
first_focus(F_ANNO);
|
first_focus(F_ANNO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
// APPLICAZIONE
|
// APPLICAZIONE
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
class TLetint : public TRelation_application
|
class TLetint : public TRelation_application
|
||||||
{
|
{
|
||||||
TLetint_mask* _mask;
|
TLetint_mask* _mask;
|
||||||
TRelation* _rel;
|
TRelation* _rel;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool user_create();
|
bool user_create();
|
||||||
bool user_destroy();
|
bool user_destroy();
|
||||||
virtual TMask* get_mask(int mode) { return _mask; }
|
virtual TMask* get_mask(int mode) { return _mask; }
|
||||||
virtual bool changing_mask(int mode) { return false; }
|
virtual bool changing_mask(int mode) { return false; }
|
||||||
virtual bool protected_record(TRectype &rec);
|
virtual bool protected_record(TRectype &rec);
|
||||||
virtual void init_modify_mode(TMask& m);
|
virtual void init_modify_mode(TMask& m);
|
||||||
|
|
||||||
virtual bool get_next_key(TToken_string& key);
|
virtual bool get_next_key(TToken_string& key);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// @cmember Disabilita la verifica del modulo : essendo una anagrafica, va sempre abilitata
|
// @cmember Disabilita la verifica del modulo : essendo una anagrafica, va sempre abilitata
|
||||||
virtual bool check_autorization() const {return true;}
|
virtual bool check_autorization() const {return true;}
|
||||||
|
|
||||||
virtual TRelation* get_relation() const {return (TRelation*)_rel;}
|
virtual TRelation* get_relation() const {return (TRelation*)_rel;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
bool TLetint::get_next_key(TToken_string& key)
|
bool TLetint::get_next_key(TToken_string& key)
|
||||||
{
|
{
|
||||||
TLocalisamfile& letint = _rel->lfile() ;
|
TLocalisamfile& letint = _rel->lfile() ;
|
||||||
long numprot = 1L ;
|
long numprot = 1L ;
|
||||||
const int anno(_mask->get_int(F_ANNO)) ;
|
const int anno(_mask->get_int(F_ANNO)) ;
|
||||||
|
|
||||||
if (!letint.empty())
|
if (!letint.empty())
|
||||||
{
|
{
|
||||||
letint.zero() ;
|
letint.zero() ;
|
||||||
letint.setkey(1) ;
|
letint.setkey(1) ;
|
||||||
|
|
||||||
letint.put(LETINT_ANNO, anno);
|
letint.put(LETINT_ANNO, anno);
|
||||||
letint.read(_isgteq);
|
letint.read(_isgteq);
|
||||||
if (letint.good()) //se e' tutto ok,si posiziona sull'ultimo record con l'anno selezionato
|
if (letint.good()) //se e' tutto ok,si posiziona sull'ultimo record con l'anno selezionato
|
||||||
letint.last();
|
letint.last();
|
||||||
|
|
||||||
if (letint.good())
|
if (letint.good())
|
||||||
{
|
{
|
||||||
const int year(letint.get_int(LETINT_ANNO));
|
const int year(letint.get_int(LETINT_ANNO));
|
||||||
if (year == anno)
|
if (year == anno)
|
||||||
numprot += letint.get_long(LETINT_NUMPROT);
|
numprot += letint.get_long(LETINT_NUMPROT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
key.format("%d|%d|%d|%ld", F_ANNO, anno, F_NUMPROT, numprot);
|
key.format("%d|%d|%d|%ld", F_ANNO, anno, F_NUMPROT, numprot);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TLetint::protected_record(TRectype& rec) //evita la cancellazione del record se STAMPATO
|
bool TLetint::protected_record(TRectype& rec) //evita la cancellazione del record se STAMPATO
|
||||||
{
|
{
|
||||||
bool prot = TRelation_application::protected_record(rec);
|
bool prot = TRelation_application::protected_record(rec);
|
||||||
if (!prot)
|
if (!prot)
|
||||||
{
|
{
|
||||||
prot = rec.get_bool(LETINT_STAMPATO);
|
prot = rec.get_bool(LETINT_STAMPATO);
|
||||||
}
|
}
|
||||||
return prot;
|
return prot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TLetint::init_modify_mode(TMask& m) //evita la registrazione di un record modificato se STAMPATO
|
void TLetint::init_modify_mode(TMask& m) //evita la registrazione di un record modificato se STAMPATO
|
||||||
{
|
{
|
||||||
const TRectype& rec = get_relation()->curr();
|
const TRectype& rec = get_relation()->curr();
|
||||||
const bool stampato = rec.get_bool(LETINT_STAMPATO);
|
const bool stampato = rec.get_bool(LETINT_STAMPATO);
|
||||||
if (stampato)
|
if (stampato)
|
||||||
{
|
{
|
||||||
m.disable(DLG_SAVEREC);
|
m.disable(DLG_SAVEREC);
|
||||||
m.disable(DLG_DELREC);
|
m.disable(DLG_DELREC);
|
||||||
TString msg = TR("Dichiarazione già stampata sul registro dell'esercizio ");
|
TString msg = TR("Dichiarazione già stampata sul registro dell'esercizio ");
|
||||||
xvtil_statbar_set(msg);
|
xvtil_statbar_set(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TLetint::user_create()
|
bool TLetint::user_create()
|
||||||
{
|
{
|
||||||
_rel = new TRelation(LF_LETINT);
|
_rel = new TRelation(LF_LETINT);
|
||||||
_mask = new TLetint_mask;
|
_mask = new TLetint_mask;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TLetint::user_destroy()
|
bool TLetint::user_destroy()
|
||||||
{
|
{
|
||||||
delete _mask;
|
delete _mask;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int li0400(int argc, char* argv[])
|
int li0400(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
TLetint a;
|
TLetint a;
|
||||||
a.run(argc, argv, TR("Lettere d'intento"));
|
a.run(argc, argv, TR("Lettere d'intento"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -224,6 +224,8 @@ BEGIN
|
|||||||
MESSAGE ENABLE,F_IMPORTO|CLEAR,1@
|
MESSAGE ENABLE,F_IMPORTO|CLEAR,1@
|
||||||
ITEM "2|A concorrenza"
|
ITEM "2|A concorrenza"
|
||||||
MESSAGE ENABLE,F_IMPORTO|CLEAR,1@
|
MESSAGE ENABLE,F_IMPORTO|CLEAR,1@
|
||||||
|
ITEM "3|Nel periodo"
|
||||||
|
MESSAGE ENABLE,1@|CLEAR,F_IMPORTO
|
||||||
FIELD TIPOOP
|
FIELD TIPOOP
|
||||||
END
|
END
|
||||||
|
|
||||||
@ -248,6 +250,14 @@ BEGIN
|
|||||||
FLAGS "D"
|
FLAGS "D"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
DATE F_AL
|
||||||
|
BEGIN
|
||||||
|
PROMPT 42 18 "Data fine periodo "
|
||||||
|
FIELD AL
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
FLAGS "D"
|
||||||
|
END
|
||||||
|
|
||||||
BOOLEAN F_STAMPATO
|
BOOLEAN F_STAMPATO
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 20 ""
|
PROMPT 2 20 ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user