Sistemata visualizzazione liq. (tutto va tranne 2 kazzatine library-dependent)

git-svn-id: svn://10.65.10.50/trunk@835 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
villa 1995-01-09 12:14:11 +00:00
parent 9f6276d508
commit 42279d33b5
7 changed files with 99 additions and 32 deletions

View File

@ -54,6 +54,7 @@ bool TLiquidazione_app::user_create()
if (_is_interactive) if (_is_interactive)
pnd = new TProgind (3,"Preparazione archivi\nPrego attendere", pnd = new TProgind (3,"Preparazione archivi\nPrego attendere",
FALSE, TRUE, 30); FALSE, TRUE, 30);
else begin_wait();
_nditte = new TRelation(LF_NDITTE); _nditte = new TRelation(LF_NDITTE);
_nditte->add(LF_ATTIV,"CODDITTA=CODDITTA"); _nditte->add(LF_ATTIV,"CODDITTA=CODDITTA");
@ -176,7 +177,7 @@ bool TLiquidazione_app::user_create()
_recalc = needed; _recalc = needed;
TApplication::set_firm(ditta); TApplication::set_firm(ditta);
if (!look_lia()) return FALSE; if (!look_lia()) { end_wait(); return FALSE; }
_nditte->zero(); _nditte->zero();
_nditte_r->put("CODDITTA", ditta); _nditte_r->put("CODDITTA", ditta);
@ -196,6 +197,7 @@ bool TLiquidazione_app::user_create()
if (is_month_ok(_month)) update_firm(_month); if (is_month_ok(_month)) update_firm(_month);
if (_isprint) print(); if (_isprint) print();
TApplication::set_firm(__firm); TApplication::set_firm(__firm);
end_wait();
} }
else delete pnd; else delete pnd;

View File

@ -182,8 +182,12 @@ bool Visliq_app::sel_mese_sh1 (TMask_field& f, KEY k)
TMask& m = *(((Visliq_app&)main_app()).get_main_mask()); TMask& m = *(((Visliq_app&)main_app()).get_main_mask());
TSheet_field& sh = (TSheet_field&)m.field(F_VISLIQ1); TSheet_field& sh = (TSheet_field&)m.field(F_VISLIQ1);
int month = sh.selected()+1; int month = sh.selected()+1;
TToken_string& tt = sh.row(sh.selected());
if (sh.items() == 4) month *= 3; if (sh.items() == 4) month *= 3;
((Visliq_app&)main_app()).vis_one(month); ((Visliq_app&)main_app()).vis_one(month);
((Visliq_app&)main_app()).look_lim(month);
((Visliq_app&)main_app()).update_sheet_row(tt);
sh.force_update();
return TRUE; return TRUE;
} }
@ -199,6 +203,15 @@ bool Visliq_app::sel_mese_sh2 (TMask_field& f, KEY k)
return TRUE; return TRUE;
} }
void Visliq_app::update_sheet_row(TToken_string& t)
{
t.add(abs(_lim->get_real("R0")).string(),2);
t.add((_lim->get_real("R0")).sign() > 0 ? "D" : "C", 3);
t.add((_lim->get_real("R1")).string(),4);
t.add(abs(_lim->get_real("R5")).string(),5);
t.add((_lim->get_real("R5")).sign() > 0 ? "D" : "C", 3);
}
bool Visliq_app::vis_liq() bool Visliq_app::vis_liq()
{ {
long ditta = get_firm(); long ditta = get_firm();
@ -235,6 +248,10 @@ bool Visliq_app::vis_all()
// mask diverse per trimestrale e annuale // mask diverse per trimestrale e annuale
TMask m(_freqviva == "M" ? "cg5500b" : "cg5500c"); TMask m(_freqviva == "M" ? "cg5500b" : "cg5500c");
TString abi(5);
TString cab(5);
TString cnc(5);
_mask = &m; _mask = &m;
TSheet_field& sh = (TSheet_field&)m.field(F_VISLIQ1); TSheet_field& sh = (TSheet_field&)m.field(F_VISLIQ1);
@ -279,7 +296,7 @@ bool Visliq_app::vis_all()
atoi(*_del_anno) != _year) atoi(*_del_anno) != _year)
continue; continue;
// TBC uso solo deleghe normali (tipo == 1) e acconti (tipo == 7) // uso solo deleghe normali (tipo == 1) e acconti (tipo == 7)
int tipod = atoi(*_del_tipo); int tipod = atoi(*_del_tipo);
if (tipod != 1 || tipod != 7) if (tipod != 1 || tipod != 7)
continue; continue;
@ -292,6 +309,9 @@ bool Visliq_app::vis_all()
versamenti[m-1] += _del->get_real("R0"); versamenti[m-1] += _del->get_real("R0");
date[m-1] = _del->get_date("D0"); date[m-1] = _del->get_date("D0");
abi = _del->get("S7");
cab = _del->get("S8");
cnc = _del->get("S9");
} }
TString nomemese(26); TString nomemese(26);
@ -310,11 +330,11 @@ bool Visliq_app::vis_all()
tt->add(""); // questo e' il bottone tt->add(""); // questo e' il bottone
tt->add(nomemese); // mese tt->add(nomemese); // mese
tt->add(date[i-1].string()); // data vers. tt->add(date[i-1].string()); // data vers.
tt->add(""); // TBI azienda tt->add(abi); // azienda
tt->add(""); // TBI dipendenza tt->add(cab); // dipendenza
tt->add(""); // TBI concessionaria tt->add(cnc); // concessionaria
tt->add(versamenti[i-1].string());// versamenti tt->add(versamenti[i-1].string());// versamenti
tt->add(versamenti[i-1].sign() < 0 ? "C" : "D"); // debito/credito tt->add(versamenti[i-1].sign() < 0 ? "C" : "D"); // debito/credito (che senso ha?)
sv.row(i-1) = (*tt); sv.row(i-1) = (*tt);
} }
@ -331,7 +351,9 @@ bool Visliq_app::vis_all()
bool Visliq_app::vis_one(int m) bool Visliq_app::vis_one(int m)
{ {
begin_wait();
TMask msk("cg5500d"); TMask msk("cg5500d");
bool recorded = FALSE;
// ricalcolo liquidazione TMessage msg; // ricalcolo liquidazione TMessage msg;
TFilename f; TFilename f;
@ -384,7 +406,8 @@ bool Visliq_app::vis_one(int m)
long line; long line;
TExternal_app liq("cg4 -2"); TExternal_app liq("cg4 -2");
{ {
TProgind(10l,"Estrazione liquidazione\nPrego attendere", FALSE,FALSE); end_wait();
TProgind(10l,"Estrazione liquidazione: prego attendere", FALSE,FALSE);
liq.run(); liq.run();
if (liq.error()) if (liq.error())
@ -415,14 +438,16 @@ bool Visliq_app::vis_one(int m)
if (lrisd == -1l || lrisc == -1l) return FALSE; if (lrisd == -1l || lrisc == -1l) return FALSE;
if (lvers == -1l) lvers = lrisc+1l; if (lvers == -1l) lvers = lrisc+1l;
bool write_lia = FALSE, write_lim = FALSE;
end_wait(); end_wait();
for(;;) for(;;)
{ {
begin_wait();
KEY k = msk.run(); KEY k = msk.run();
bool write_lia = FALSE, write_lim = FALSE; end_wait();
if (k == K_SAVE) // TBI registra: dovra' essere RICALCOLA if (k == K_INS || k == K_SAVE) // TBI registra: dovra' essere RICALCOLA
{ {
real n_acconto (msk.get(F_ACCONTO)); real n_acconto (msk.get(F_ACCONTO));
real n_rimborso (msk.get(F_RIMBORSO)); real n_rimborso (msk.get(F_RIMBORSO));
@ -450,15 +475,20 @@ bool Visliq_app::vis_one(int m)
risultato -= rettifica; // vecchia rettifica risultato -= rettifica; // vecchia rettifica
// scorporo vecchia
if (rettifica.sign() > 0)
risd -= rettifica;
else
risc += rettifica;
// incorporo nuova
if (msk.get(F_DEBCRE) == "C") if (msk.get(F_DEBCRE) == "C")
{ {
risc -= rettifica;
risc += n_rettifica; risc += n_rettifica;
n_rettifica = -n_rettifica; n_rettifica = -n_rettifica;
} }
else else
{ {
risd -= rettifica;
risd += n_rettifica; risd += n_rettifica;
} }
@ -469,7 +499,11 @@ bool Visliq_app::vis_one(int m)
_lim->put("R5", n_rettifica); _lim->put("R5", n_rettifica);
_lim->put("S7", msk.get(F_DEBCRE)); _lim->put("S7", msk.get(F_DEBCRE));
set_risultato(vsw, lvers, risultato); set_risultato(vsw, lvers, risultato);
// altro giro, altro regalo
rettifica = n_rettifica;
} }
write_lim = TRUE; write_lim = TRUE;
} }
@ -483,7 +517,7 @@ bool Visliq_app::vis_one(int m)
risultato -= n_acconto; risultato -= n_acconto;
risc -= acconto; risc -= acconto;
risc += n_acconto; risc += n_acconto;
_lia->put("R4", acconto); _lia->put("R4", n_acconto);
vsw->replace(lrisc, risc.string("###.###.###.###"), 58); vsw->replace(lrisc, risc.string("###.###.###.###"), 58);
set_risultato(vsw, lvers, risultato); set_risultato(vsw, lvers, risultato);
} }
@ -497,10 +531,11 @@ bool Visliq_app::vis_one(int m)
risultato += n_rimborso; risultato += n_rimborso;
risd -= rimborso; risd -= rimborso;
risd += n_rimborso; risd += n_rimborso;
_lim->put("R1", rimborso); _lim->put("R1", n_rimborso);
vsw->replace(lrisd, risd.string("###.###.###.###"), 75); vsw->replace(lrisd, risd.string("###.###.###.###"), 75);
set_risultato(vsw, lvers, risultato); set_risultato(vsw, lvers, risultato);
} }
if (msk.field(F_DESCR1).dirty()) if (msk.field(F_DESCR1).dirty())
{ {
_lim->put("S0", n_desc1); _lim->put("S0", n_desc1);
@ -514,24 +549,27 @@ bool Visliq_app::vis_one(int m)
// TBI abilitare ricalcolo liquidazione // TBI abilitare ricalcolo liquidazione
if (write_lia && FALSE /* TBI k == K_END */) if (write_lia && k == K_SAVE)
_lia->rewrite(); _lia->rewrite();
if ((write_lim || write_lia) && FALSE /* TBI k == K_END */) if ((write_lim || write_lia) && k == K_SAVE)
{ {
_lim->put("B0", ""); _lim->put("B0", "");
_lim->rewrite(); _lim->rewrite();
} }
if (k == K_SAVE) recorded = TRUE;
if (write_lim || write_lia) if (write_lim || write_lia)
vsw->refresh(); vsw->refresh();
} }
else if (k == K_ESC || k == K_END) break; else if (k == K_ESC || k == K_QUIT) break;
} }
} }
remove(f); remove(f);
return TRUE; return recorded;
} }
void Visliq_app::set_risultato(TViswin* vsw, long line, real& r) void Visliq_app::set_risultato(TViswin* vsw, long line, real& r)

View File

@ -28,9 +28,6 @@ class Visliq_app : public TApplication
bool is_trim(int x); bool is_trim(int x);
bool is_month_ok(int x, int month = -1); bool is_month_ok(int x, int month = -1);
bool look_lia(int year = 0);
bool look_lim(int m);
bool look_del(int month, int type);
void set_risultato(TViswin*, long, real&); void set_risultato(TViswin*, long, real&);
protected: protected:
@ -51,11 +48,16 @@ protected:
public: public:
bool look_lia(int year = 0);
bool look_lim(int m);
bool look_del(int month, int type);
void set_freqviva(); void set_freqviva();
void set_mask_freq(TMask&); void set_mask_freq(TMask&);
void set_year(int y) { _year = y; } void set_year(int y) { _year = y; }
TMask* get_main_mask() { return _mask; } TMask* get_main_mask() { return _mask; }
void update_sheet_row(TToken_string& t);
// workhorses // workhorses
bool vis_liq(); bool vis_liq();

View File

@ -2,7 +2,11 @@
TOOLBAR "" 0 20 0 2 TOOLBAR "" 0 20 0 2
#include <toolbar.h> BUTTON DLG_QUIT 8 2
BEGIN
PROMPT -11 -1 ""
MESSAGE EXIT,K_QUIT
END
ENDPAGE ENDPAGE

View File

@ -2,7 +2,11 @@
TOOLBAR "" 0 20 0 2 TOOLBAR "" 0 20 0 2
#include <toolbar.h> BUTTON DLG_QUIT 8 2
BEGIN
PROMPT -11 -1 ""
MESSAGE EXIT,K_QUIT
END
ENDPAGE ENDPAGE

18
cg/cg5500t.h Executable file
View File

@ -0,0 +1,18 @@
BUTTON DLG_SAVEREC 8 2
BEGIN
PROMPT -13 -1 "~Registra"
MESSAGE EXIT,K_SAVE
END
BUTTON DLG_RECALC 8 2
BEGIN
PROMPT -23 -1 "Ri~calcola"
MESSAGE EXIT,K_INS
END
BUTTON DLG_QUIT 8 2
BEGIN
PROMPT -33 -1 ""
MESSAGE EXIT,K_QUIT
END

View File

@ -7,9 +7,8 @@ bool Visliq_app::look_lim(int m)
_lim_r->zero(); _lim_r->zero();
(*_lim_mese) = format("%d",m); (*_lim_mese) = format("%d",m);
(*_lim_anno) = _year; (*_lim_anno) = format("%d",_year);
TString s = _lim_r->get("CODTAB");
_lim->read(); _lim->read();
return _lim->good(); return _lim->good();
} }
@ -17,12 +16,12 @@ bool Visliq_app::look_lim(int m)
bool Visliq_app::look_del(int month, int type) bool Visliq_app::look_del(int month, int type)
{ {
long ditta = get_firm(); long ditta = get_firm();
_del->zero(); _del->zero();
(*_del_ditta) = ditta; (*_del_ditta) = format("%ld",ditta);
(*_del_anno) = _year; (*_del_anno) = format("%d",_year);
(*_del_mese) = month; (*_del_mese) = format("%d",month);
(*_del_tipo) = type; (*_del_tipo) = format("%d",type);
TString ctab = _del->get("CODTAB");
_del->read(); _del->read();
return _del->good(); return _del->good();