Corretti errori in visualizzazione saldi riepilogo gruppi bilanci lista

causali e stampa giornale


git-svn-id: svn://10.65.10.50/trunk@541 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
nik 1994-11-07 09:58:09 +00:00
parent f3e2806a60
commit 07d5119fef
4 changed files with 159 additions and 65 deletions

View File

@ -30,7 +30,7 @@
HIDDEN const char* REAL_PICTURE = "###.###.###.###";
HIDDEN const char* REAL_TOT_PIC = "#.###.###.###.###";
HIDDEN const char* RIP_TOT_PIC = "##.###.###.###.###.###";
HIDDEN const char* RIP_TOT_PIC = "###.###.###.###";
HIDDEN const int RIGHE_MODULO = 66;
HIDDEN const int RIGHE_FOOTER = 10;
@ -120,6 +120,7 @@ public:
int set_header_198();
bool leggi_tabreg(const char * codreg, int annoes);
int ultimo_esercizio(); // ritorna l'ultimo anno esercizio
void aggiorna_tabreg(int, int);
void aggiorna_mov();
void scrivi_numgio(long);
@ -133,7 +134,7 @@ public:
virtual ~CG3400_application() {};
};
HIDDEN CG3400_application * app() { return (CG3400_application*) MainApp(); }
HIDDEN CG3400_application& app() { return (CG3400_application&) main_app(); }
//////////////////////////////////////////////////////////////////////////
// Funzioni legate ai parametri ditta
@ -194,7 +195,7 @@ const char * CG3400_application::get_descr_caus (const char * codcaus)
void CG3400_application::get_dati_ditta ()
{
TString16 codanagr;
TString16 tipoa;
char tipoa;
_nditte->zero();
_nditte->put(NDT_CODDITTA, get_firm());
@ -204,7 +205,16 @@ void CG3400_application::get_dati_ditta ()
_ragsoc = _nditte->get(NDT_RAGSOC);
codanagr = _nditte->curr().get(NDT_CODANAGR);
tipoa = _nditte->curr().get(NDT_TIPOA);
tipoa = _nditte->curr().get_char(NDT_TIPOA);
if (tipoa == 'F')
{
/*
TString80 cognome(_ragsoc.cut(1,30));
TString80 nome(_ragsoc.cut(30,50));
_ragsoc = cognome; _ragsoc << " " << nome;
*/
}
_anag->setkey(1);
_anag->zero();
@ -602,7 +612,7 @@ int CG3400_application::stampa_intestazione_ditta()
_intes = "Data @>";
_intes.right_just(_stampa_width-15); // perche' il codice viene espanso nella data con l'anno in 4 caratteri
_intes.overwrite (format ("Partita iva %s @24gCodice fiscale %s", (const char*)_paiva, (const char*)_cofi));
_intes.overwrite (format ("Partita iva %s @24gCodice fiscale %s %s", (const char*)_paiva, (const char*)_cofi, _stampa_definitiva ? "" : "STAMPA DI PROVA"));
set_header (++r, "%s", (const char*) _intes);
@ -749,6 +759,7 @@ void CG3400_application::preprocess_header()
TString dare (riporto_dare.string(RIP_TOT_PIC));
TString avere(riporto_avere.string(RIP_TOT_PIC));
// RIP_TOT_PIC adesso e' lunga 15
if (_stampa_width == 132)
frm = "@b@84g";
@ -757,7 +768,7 @@ void CG3400_application::preprocess_header()
_riporto = frm;
_riporto << format ("Riporto: %15s %15s", (const char *) dare,
_riporto << format ("Riporto: @95g%15s @112g%15s", (const char *) dare,
(const char *) avere );
set_header (r++, "%s", (const char *) _riporto);
@ -1059,7 +1070,7 @@ void CG3400_application::calcola_iva()
tipocr = iva.get_int (RMI_TIPOCR);
tipodet = iva.get_int (RMI_TIPODET);
codiva = iva.get (RMI_CODIVA);
_iva_array.add_riga(impo,impos,codiva,tipodet,tipocr,ZERO,ZERO);
_iva_array.add_riga(impo,impos,codiva,tipodet,0,ZERO,ZERO);
}
}
@ -1228,11 +1239,31 @@ void CG3400_application::aggiorna_tabreg(int partito_da, int stampate)
}
}
int CG3400_application::ultimo_esercizio()
{
TString16 sanno;
TTable ese("ESC");
ese.zero();
ese.last();
// ese.first();
sanno = ese.get("CODTAB"); sanno.cut(4);
const int anno = atoi(sanno);
return anno;
}
bool CG3400_application::leggi_tabreg(const char * reg_cod,
int reg_anno)
{
TString16 codtab;
if (reg_anno == 0)
reg_anno = ultimo_esercizio();
_ae = reg_anno;
codtab.format ("%04d%-3s", reg_anno, reg_cod);
_tabreg->zero();
@ -1264,8 +1295,8 @@ HIDDEN int date2esc(const TDate& d, int* prevesc)
{
const TDate ia(esc.get("D0")); // Data inizio esercizio
const TDate fa(esc.get("D1")); // Data fine esercizio
app()->_inizioEs = ia;
app()->_fineEs = fa;
app()._inizioEs = ia;
app()._fineEs = fa;
const anno = esc.get_int("CODTAB");
if (d >= ia && d <= fa)
return anno;
@ -1282,50 +1313,60 @@ HIDDEN int date2esc(const TDate& d, int* prevesc)
bool CG3400_application::data_a_hndl (TMask_field& f, KEY k)
{
TMask& m = f.mask();
if (f.to_check(k))
{
TMask& m = f.mask();
const TDate data_a(f.get());
const TString16 codreg(m.get(CODREG));
const int ae = date2esc(data_a); // Anno esercizio
const bool definitiva = m.get_bool(STAMPA_DEF);
TString16 dep(data_a.string());
if (dep.empty())
return TRUE;
if (dep.empty()) return TRUE;
app()->_ae = ae;
app()._ae = ae;
if (ae == 0)
return f.error_box("La data specificata non appartiene a nessun esercizio");
}
if (k == K_ENTER)
{
const bool definitiva = m.get_bool(STAMPA_DEF);
const TDate data_da(m.get(DATA_DA));
const TDate data_a(f.get());
TString16 dtda(data_da.string());
const int ae = app()._ae;
const TMask_field& fld_dtda = m.field(DATA_DA);
// Controlli sulle date
TRegistro reg(codreg, ae);
if (!reg.ok())
return f.warning_box("Non trovo il libro giornale %s per l'esercizio %d",
(const char *) codreg, ae);
if (reg.tipo() != 5)
return f.warning_box("Il registro %s per l'anno %d non e' di tipo libro giornale",
(const char *) codreg, ae);
const TDate data_da(m.get(DATA_DA));
TString16 dtda(data_da.string());
if (definitiva)
{
if (dtda.not_empty()) // senno' ci metto inizioEs
if (data_da < app()->_inizioEs || data_a > app()->_fineEs);
return f.warning_box("Le date specificate non appartengono allo stesso esercizio");
if (data_da < app()._inizioEs || data_a > app()._fineEs);
return f.warning_box("Le date specificate non appartengono allo stesso esercizio");
}
else
// se la stampa e' di prova DALLA_DATA e' obbligatoria
if (dtda.empty())
return f.warning_box("Manca la data di partenza");
else
if (data_da > data_a)
return f.warning_box("La data di inizio non puo' essere maggiore della data finale");
}
else // se la stampa e' di prova DALLA_DATA e' obbligatoria
if (dtda.empty())
return fld_dtda.warning_box("Manca la data di partenza");
else
if (data_da > data_a)
return fld_dtda.warning_box("La data di inizio non puo' essere maggiore della data finale");
// Controllo il registro
const TString16 codreg(m.get(CODREG));
const TMask_field& fld_reg = m.field(CODREG);
TRegistro reg(codreg, ae);
if (!reg.ok())
return fld_reg.warning_box("Non trovo il libro giornale %s per l'esercizio %d",
(const char *) codreg, ae);
if (reg.tipo() != 5)
return fld_reg.warning_box("Il registro %s per l'anno %d non e' di tipo libro giornale",
(const char *) codreg, ae);
} // if K_ENTER
return TRUE;
}
@ -1342,8 +1383,8 @@ bool CG3400_application::data_da_hndl(TMask_field& f, KEY k)
if (dep.empty() || data_a.empty())
return TRUE;
if (app()->_ae != 0)
if (app()->_ae != ae_data_da)
if (app()._ae != 0)
if (app()._ae != ae_data_da)
return f.error_box("Le due date non appartengono allo stesso esercizio");
}
return TRUE;
@ -1364,19 +1405,25 @@ bool CG3400_application::mask_a_cod_reg (TMask_field& f, KEY k)
if (k == K_TAB)
{
TMask& m = f.mask();
CG3400_application * a = (CG3400_application*) MainApp();
CG3400_application& a = (CG3400_application&) main_app();
const bool definitiva = m.get_bool(STAMPA_DEF);
TString16 reg_cod(f.get());
a->leggi_tabreg(reg_cod, a->_ae);
if (reg_cod.empty()) return TRUE;
a.leggi_tabreg(reg_cod, a._ae);
// Output da qui della descrizione del registro e dell'anno
m.set(REG_DESC, a._reg_descr);
m.set(ANNO_ESER, a._ae);
if (definitiva)
{
if (a->_stampa_ok == -1) // stampa precedente andata bene
m.set(PAGINA_DA, a->_pagine_stampate+1);
if (a._stampa_ok == -1) // stampa precedente andata bene
m.set(PAGINA_DA, a._pagine_stampate+1);
else
m.set(PAGINA_DA, a->_stampa_ok);
m.set(PAGINA_DA, a._stampa_ok);
}
}
return TRUE;

View File

@ -221,7 +221,7 @@ bool sottoc_handler(TMask_field& f, KEY key)
const long sottoconto = f.mask().get_long(id);
TLocalisamfile& pconti = app()->get_relation()->lfile();
if ( key == K_TAB && f.mask().is_running() )
if ( key == K_TAB )
{
if (!f.focusdirty() && gruppo == 0 && conto == 0) return TRUE;
@ -256,7 +256,7 @@ bool sottoc_handler(TMask_field& f, KEY key)
}
else return f.warning_box("Registrazione assente");
}
if (id == F_SOTTOC_CLIENTE || id == F_SOTTOC_FORN)
if (id == F_SOTTOC_CLIENTE || id == F_SOTTOC_FORN)
{
char tipo = id == F_SOTTOC_CLIENTE ? 'C' : 'F';
TLocalisamfile clifo (LF_CLIFO);
@ -268,7 +268,7 @@ bool sottoc_handler(TMask_field& f, KEY key)
clifo.setkey(1);
if (clifo.read(_isequal, _nolock) == NOERR)
{
TString rs = clifo.get(CLI_RAGSOC);
TString80 rs = clifo.get(CLI_RAGSOC);
char tipoa = clifo.get_char("TIPOAPER");
if (tipoa == 'F')
@ -302,12 +302,10 @@ bool sottoc_handler(TMask_field& f, KEY key)
f.mask().set(F_DESCR_FORN, ds);
f.mask().set(F_DESCR_CONTO, ds);
}
// if (!f.focusdirty()) f.mask().stop_run(K_AUTO_ENTER);
f.mask().stop_run(K_AUTO_ENTER);
}
}
}
// f.mask().stop_run(K_AUTO_ENTER);
return TRUE;
}

View File

@ -2,10 +2,12 @@
#define F_TIPOCF 102
#define F_GRUPPO 103
#define F_CONTO 104
#define F_SOTTOCONTO 105
#define F_DESCR_CONTO 106
#define F_SOTTOC_CLIENTE 107
#define F_DESCR_CLIENTE 108
#define F_SOTTOC_FORN 109
#define F_DESCR_FORN 110
#define F_SHEET_SALDI 111
#define F_CONTO_CLIENTE 105
#define F_CONTO_FORN 106
#define F_SOTTOCONTO 107
#define F_DESCR_CONTO 108
#define F_SOTTOC_CLIENTE 109
#define F_DESCR_CLIENTE 110
#define F_SOTTOC_FORN 111
#define F_DESCR_FORN 112
#define F_SHEET_SALDI 113

View File

@ -54,7 +54,7 @@ END
NUMBER F_CONTO 3
BEGIN
PROMPT 40 3 "Conto "
USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="")
USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="")
FIELD LF_PCON->CONTO
KEY 1
INPUT GRUPPO F_GRUPPO
@ -64,16 +64,60 @@ BEGIN
DISPLAY "Descrizione@50" DESCR
OUTPUT F_CONTO CONTO
OUTPUT F_GRUPPO GRUPPO
OUTPUT F_TIPOCF TMCF
//OUTPUT F_DESCR_CLIENTE DESCR
//OUTPUT F_DESCR_FORN DESCR
//OUTPUT F_DESCR_CONTO DESCR
FLAGS "R"
CHECKTYPE NORMAL
WARNING "Conto inesistente o mancante"
//MESSAGE DIRTY,F_SOTTOCONTO|DIRTY,F_SOTTOC_CLIENTE|DIRTY,F_SOTTOC_FORN
//MESSAGE DIRTY,F_DESCR_CONTO|DIRTY,F_DESCR_CLIENTE|DIRTY,F_DESCR_FORN
MESSAGE COPY,F_CONTO_CLIENTE|COPY,F_CONTO_FORN
GROUP 1
END
NUMBER F_CONTO_CLIENTE 3
BEGIN
PROMPT 40 3 "Conto "
USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="C")
FIELD LF_PCON->CONTO
KEY 1
INPUT GRUPPO F_GRUPPO
INPUT CONTO F_CONTO_CLIENTE
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR
OUTPUT F_CONTO_CLIENTE CONTO
OUTPUT F_GRUPPO GRUPPO
//OUTPUT F_DESCR_CLIENTE DESCR
//OUTPUT F_DESCR_FORN DESCR
//OUTPUT F_DESCR_CONTO DESCR
FLAGS "R"
CHECKTYPE NORMAL
WARNING "Conto inesistente o mancante"
MESSAGE COPY,F_CONTO|COPY,F_CONTO_FORN
GROUP 2
END
NUMBER F_CONTO_FORN 3
BEGIN
PROMPT 40 3 "Conto "
USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") && (TMCF="F")
FIELD LF_PCON->CONTO
KEY 1
INPUT GRUPPO F_GRUPPO
INPUT CONTO F_CONTO_FORN
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Descrizione@50" DESCR
OUTPUT F_CONTO_FORN CONTO
OUTPUT F_GRUPPO GRUPPO
//OUTPUT F_DESCR_CLIENTE DESCR
//OUTPUT F_DESCR_FORN DESCR
//OUTPUT F_DESCR_CONTO DESCR
FLAGS "R"
CHECKTYPE NORMAL
WARNING "Conto inesistente o mancante"
MESSAGE COPY,F_CONTO_CLIENTE|COPY,F_CONTO
GROUP 3
END
NUMBER F_SOTTOCONTO 6
@ -100,7 +144,7 @@ BEGIN
//MESSAGE COPY,F_SOTTOC_CLIENTE
FLAGS "R"
CHECKTYPE NORMAL
//VALIDATE AUTOEXIT_FUNC 3 F_GRUPPO F_CONTO F_SOTTOCONTO
//VALIDATE AUTOEXIT_FUNC 3 F_GRUPPO F_CONTO F_SOTTOCONTO //come pure questo
GROUP 1
WARNING "Conto inesistente"
END
@ -117,6 +161,8 @@ BEGIN
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
OUTPUT F_SOTTOC_CLIENTE CODCF
OUTPUT F_GRUPPO GRUPPO
OUTPUT F_CONTO_CLIENTE CONTO
//OUTPUT F_DESCR_CONTO RAGSOC
//OUTPUT F_DESCR_CLIENTE RAGSOC
//OUTPUT F_DESCR_FORN RAGSOC
@ -138,13 +184,14 @@ BEGIN
DISPLAY "Ragione Sociale@50" RAGSOC
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
OUTPUT F_SOTTOC_FORN CODCF
OUTPUT F_SOTTOC_FORN CODCF
OUTPUT F_GRUPPO GRUPPO
OUTPUT F_CONTO_FORN CONTO
// OUTPUT F_DESCR_FORN RAGSOC
// OUTPUT F_DESCR_CONTO RAGSOC
// OUTPUT F_DESCR_CLIENTE RAGSOC
FLAGS "R"
CHECKTYPE NORMAL
// serve per l' autopremimento
KEY 1
WARNING "Fornitore inesistente"
//VALIDATE AUTOEXIT_FUNC 3 F_GRUPPO F_CONTO F_SOTTOC_FORN