Patch level : 10.0

Files correlati     : cg3.exe cg3100b.msk
Ricompilazione Demo : [ ]
Commento            :
0000989: Date esercizio
Inserisco la data di esercizio e all'uscita campo mi imposta le date di inizio e fine esercizio, la data di fine è errata, viene impostata quella dell'esercizio successivo a quello impostatato.


git-svn-id: svn://10.65.10.50/trunk@17663 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-11-17 16:10:35 +00:00
parent 66708ef434
commit 03d3fece83
3 changed files with 34 additions and 49 deletions

View File

@ -24,10 +24,7 @@
#include <rmoviva.h> #include <rmoviva.h>
#include <saldi.h> #include <saldi.h>
enum liste { enum liste { movimenti=1, fatture=2, };
movimenti=1,
fatture=2,
};
class TListaMov_application : public TPrintapp class TListaMov_application : public TPrintapp
{ {
@ -72,7 +69,7 @@ class TListaMov_application : public TPrintapp
liste _tipo_lista; liste _tipo_lista;
word _flags; word _flags;
char _tipoc; char _tipoc;
TString _dacodiva, _acodiva; TString4 _dacodiva, _acodiva;
TDecoder _simbval, _descdoc; TDecoder _simbval, _descdoc;
protected: protected:
@ -93,7 +90,6 @@ protected:
bool rmoviva_filter(const TRectype& rmoviva) const; bool rmoviva_filter(const TRectype& rmoviva) const;
public: public:
bool user_create(); bool user_create();
bool user_destroy(); bool user_destroy();
bool segnala_errori_primariga(); bool segnala_errori_primariga();
@ -124,19 +120,21 @@ HIDDEN inline TListaMov_application& app()
bool TListaMov_application::annoes_handler(TMask_field& f, KEY k) bool TListaMov_application::annoes_handler(TMask_field& f, KEY k)
{ {
if (k == K_TAB && f.focusdirty()) if (k == K_TAB && f.focusdirty() && !f.empty())
{ {
const int anno = atoi(f.get()); const int anno = atoi(f.get());
TDate dataini, datafin;
TEsercizi_contabili esc; TEsercizi_contabili esc;
if (esc.exist(anno)) if (esc.code2range(anno, dataini, datafin))
{ {
f.mask().set(F_DATAINI, esc[anno].inizio()); f.mask().set(F_DATAINI, dataini);
const int prossimo = esc.next(anno); const int prossimo = esc.next(anno);
const TDate fine = esc[prossimo > 0 ? prossimo : anno].fine(); if (prossimo > 0)
f.mask().set(F_DATAFIN, fine); datafin = esc[prossimo].fine();
f.mask().set(F_DATAFIN, datafin);
} }
} }
return TRUE; return true;
} }
bool TListaMov_application::data_inizio(TMask_field& f, KEY k) bool TListaMov_application::data_inizio(TMask_field& f, KEY k)
@ -208,7 +206,7 @@ bool TListaMov_application::data_fine(TMask_field& f, KEY k)
return TRUE; return TRUE;
} }
bool TListaMov_application::RicercaDoc(const char * tipo) bool TListaMov_application::RicercaDoc(const char* tipo)
{ {
const TRectype& tab_tpd = cache().get(TAB_TPD, tipo); const TRectype& tab_tpd = cache().get(TAB_TPD, tipo);
return !tab_tpd.empty(); return !tab_tpd.empty();
@ -221,17 +219,16 @@ void TListaMov_application::compila_clifo()
key.add(_codcf); key.add(_codcf);
const TRectype& clifo = cache().get(LF_CLIFO, key); const TRectype& clifo = cache().get(LF_CLIFO, key);
char tipoa = clifo.get_char("TIPOAPER"); char tipoa = clifo.get_char(CLI_TIPOAPER);
_alleg = clifo.get_int(CLI_ALLEG); _alleg = clifo.get_int(CLI_ALLEG);
_statocf = clifo.get(CLI_STATOCF); _statocf = clifo.get(CLI_STATOCF);
_comcf = clifo.get(CLI_COMCF); _comcf = clifo.get(CLI_COMCF);
_ragsoc = clifo.get(CLI_RAGSOC); _ragsoc = clifo.get(CLI_RAGSOC);
if (tipoa == 'F') if (tipoa == 'F')
{ {
TString80 cognome, nome; TString80 cognome, nome;
cognome = _ragsoc.mid(0,30); cognome = _ragsoc.mid(0, 30); cognome.trim();
nome = _ragsoc.mid(30,20); nome = _ragsoc.mid(30,20); nome.trim();
cognome.trim(); nome.trim();
_ragsoc = cognome; _ragsoc = cognome;
_ragsoc << ' ' << nome; _ragsoc << ' ' << nome;
} }
@ -2458,18 +2455,14 @@ TListaMov_application::TListaMov_application(char tipost)
int cg3100(int argc, char* argv[]) int cg3100(int argc, char* argv[])
{ {
const char tipo = argc > 2 ? *argv[2] : 'M'; const char tipo = argc > 2 ? toupper(*argv[2]) : 'M';
TListaMov_application a(tipo); TListaMov_application a(tipo);
const char* title; const char* title = NULL;
switch (tipo) switch (tipo)
{ {
case 'C': case 'C': title = TR("Lista fatture clienti/fornitori"); break;
title = TR("Lista fatture clienti/fornitori"); default : title = TR("Lista movimenti"); break;
break;
default:
title = TR("Lista movimenti");
break;
} }
a.run(argc, argv, title); a.run(argc, argv, title);
return TRUE; return TRUE;

View File

@ -2,20 +2,11 @@
TOOLBAR "topbar" 0 0 0 2 TOOLBAR "topbar" 0 0 0 2
BUTTON DLG_PRINT 10 2 #include <printbar.h>
BEGIN
PROMPT -12 -11 "~Stampa"
MESSAGE EXIT,K_ENTER
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -11 ""
END
ENDPAGE ENDPAGE
PAGE "Lista Fatture" -1 -1 73 17 PAGE "Lista Fatture" 0 2 0 0
NUMBER F_CODDITTA 5 NUMBER F_CODDITTA 5
BEGIN BEGIN
@ -47,14 +38,14 @@ NUMBER F_ANNO 4
BEGIN BEGIN
PROMPT 2 4 "Codice esercizio " PROMPT 2 4 "Codice esercizio "
HELP "Codice esercizio per cui si vuole la stampa" HELP "Codice esercizio per cui si vuole la stampa"
USE ESC KEY 1 USE ESC
CHECKTYPE NORMAL CHECKTYPE NORMAL
INPUT CODTAB F_ANNO INPUT CODTAB F_ANNO
DISPLAY "Codice" CODTAB DISPLAY "Codice" CODTAB
DISPLAY "Data inizio esercizio" D0 DISPLAY "Data inizio esercizio" D0
DISPLAY "Data fine esercizio" D1 DISPLAY "Data fine esercizio" D1
OUTPUT F_ANNO CODTAB OUTPUT F_ANNO CODTAB
FLAGS "RZ" FLAGS "Z"
ADD RUN cg0 -5 esc ADD RUN cg0 -5 esc
END END

View File

@ -169,14 +169,15 @@ int TMastrini_application::righe_rimaste_da_stampare()
if (_nummast == 2) if (_nummast == 2)
{ {
const int pfl = printer().formlen();
if (printer().rows_left() != 0) if (printer().rows_left() != 0)
{ {
if ( (_conta_mastrini % 2) != 0) if ( (_conta_mastrini % 2) != 0)
{ {
if ( (printer().formlen() % 2) != 0) if ( pfl % 2 )
righe_rimaste = printer().rows_left() - (printer().formlen() / 2) + 1; //- 33; righe_rimaste = printer().rows_left() - (pfl / 2) + 1; //- 33;
else else
righe_rimaste = printer().rows_left() - (printer().formlen() / 2); righe_rimaste = printer().rows_left() - (pfl / 2);
} }
else else
righe_rimaste = printer().rows_left(); righe_rimaste = printer().rows_left();
@ -184,13 +185,13 @@ int TMastrini_application::righe_rimaste_da_stampare()
else else
{ {
if ( (_conta_mastrini % 2) != 0) if ( (_conta_mastrini % 2) != 0)
righe_rimaste = printer().formlen() / 2; //32; righe_rimaste = pfl / 2; //32;
else else
{ {
if ( (printer().formlen() % 2) != 0) if (pfl % 2)
righe_rimaste = (printer().formlen() / 2) + 1; //33; righe_rimaste = (pfl / 2) + 1; //33;
else else
righe_rimaste = printer().formlen / 2; righe_rimaste = pfl / 2;
} }
} }
} }