Gestione memo della testata
git-svn-id: svn://10.65.10.50/trunk@2290 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
fd090303fc
commit
972c3e3b20
138
sc/sc2100.cpp
138
sc/sc2100.cpp
@ -31,16 +31,21 @@ class TEC_form : public TForm
|
|||||||
|
|
||||||
TCursor* _cursore;
|
TCursor* _cursore;
|
||||||
TTotalizer _totali;
|
TTotalizer _totali;
|
||||||
TDecoder _causali; // Decodoficatore dei codici causale
|
TDecoder _causali; // Decodificatore dei codici causale
|
||||||
|
TDecoder _valute; // Decodificatore dei codici valuta
|
||||||
|
|
||||||
TString _lingua; // Codice lingua del form
|
TString _lingua; // Codice lingua del form
|
||||||
TDate _dlo, _dls, _dir; // Data limite operazione, scaduto e inizio rischio
|
TDate _dlo, _dls, _dir; // Data limite operazione, scaduto e inizio rischio
|
||||||
int _giorni_rischio; // Numero giorni rischio nella maschera di selezione
|
int _giorni_rischio; // Numero giorni rischio nella maschera di selezione
|
||||||
bool _in_valuta; // Il form e' in valuta
|
bool _in_valuta; // Il form e' in valuta
|
||||||
word _num_rip; // Numero di righe usate per i riporti
|
word _num_rip; // Numero di righe usate per i riporti
|
||||||
|
word _total_rows; // Numero di righe usate per i totali
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void init_memo();
|
||||||
word ordina_totali_per_valuta(THash_object* tot[MAXTOT]);
|
word ordina_totali_per_valuta(THash_object* tot[MAXTOT]);
|
||||||
|
void change_magic_names(const THash_object& o, TString& s);
|
||||||
|
void print_total(int riga, const THash_object& o, short id);
|
||||||
|
|
||||||
void stampa_testata(TPrinter& p);
|
void stampa_testata(TPrinter& p);
|
||||||
void stampa_pedata(TPrinter& p);
|
void stampa_pedata(TPrinter& p);
|
||||||
@ -52,6 +57,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
TTotalizer& totali() { return _totali; }
|
TTotalizer& totali() { return _totali; }
|
||||||
TDecoder& causali() { return _causali; }
|
TDecoder& causali() { return _causali; }
|
||||||
|
TDecoder& valute() { return _valute; }
|
||||||
|
|
||||||
const TDate& data_limite_operazione() const { return _dlo; }
|
const TDate& data_limite_operazione() const { return _dlo; }
|
||||||
const TDate& data_limite_scaduto() const { return _dls; }
|
const TDate& data_limite_scaduto() const { return _dls; }
|
||||||
@ -475,7 +481,7 @@ void TEC_array::add_row(const TRiga_partite& row)
|
|||||||
if (!abbuoni.is_zero())
|
if (!abbuoni.is_zero())
|
||||||
{
|
{
|
||||||
TEC_row& rec = new_row(row, data, abbuoni, 2);
|
TEC_row& rec = new_row(row, data, abbuoni, 2);
|
||||||
rec.descrizione(form().describe(302));
|
rec.descrizione(form().describe(PEC_ABBUONI));
|
||||||
if (in_valuta)
|
if (in_valuta)
|
||||||
{
|
{
|
||||||
TImporto il(row.importo(FALSE, 0x2));
|
TImporto il(row.importo(FALSE, 0x2));
|
||||||
@ -488,7 +494,7 @@ void TEC_array::add_row(const TRiga_partite& row)
|
|||||||
if (!diffcam.is_zero())
|
if (!diffcam.is_zero())
|
||||||
{
|
{
|
||||||
TEC_row& rec = new_row(row, data, diffcam, 3);
|
TEC_row& rec = new_row(row, data, diffcam, 3);
|
||||||
rec.descrizione(form().describe(303));
|
rec.descrizione(form().describe(PEC_DIFFCAM));
|
||||||
if (in_valuta)
|
if (in_valuta)
|
||||||
{
|
{
|
||||||
TImporto il(row.importo(FALSE, 0x4));
|
TImporto il(row.importo(FALSE, 0x4));
|
||||||
@ -501,7 +507,7 @@ void TEC_array::add_row(const TRiga_partite& row)
|
|||||||
if (!ritenute.is_zero())
|
if (!ritenute.is_zero())
|
||||||
{
|
{
|
||||||
TEC_row& r = new_row(row, data, ritenute, 4);
|
TEC_row& r = new_row(row, data, ritenute, 4);
|
||||||
r.descrizione(form().describe(304));
|
r.descrizione(form().describe(PEC_RITENUTE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -600,7 +606,7 @@ void TEC_form::stampa_riporti(TPrinter& pr)
|
|||||||
if (_num_rip > maxtot)
|
if (_num_rip > maxtot)
|
||||||
_num_rip = maxtot;
|
_num_rip = maxtot;
|
||||||
|
|
||||||
const TString& riporto = describe(301, 'F');
|
const TString& riporto = describe(PEC_RIPORTO, 'F');
|
||||||
|
|
||||||
TString desc(80);
|
TString desc(80);
|
||||||
TPrint_section& body = section('B');
|
TPrint_section& body = section('B');
|
||||||
@ -621,48 +627,80 @@ void TEC_form::stampa_riporti(TPrinter& pr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TEC_form::change_magic_names(const THash_object& o, TString& s)
|
||||||
|
{
|
||||||
|
TString magic1(4), magic2(4), val(50), park(80);
|
||||||
|
|
||||||
|
for (int pos = s.find('<', 0); pos >= 0; pos = s.find('<', pos))
|
||||||
|
{
|
||||||
|
const int end = s.find('>', pos);
|
||||||
|
if (end > pos)
|
||||||
|
{
|
||||||
|
int p1 = pos+1;
|
||||||
|
magic1 = s.mid(p1, 2);
|
||||||
|
magic2.cut(0);
|
||||||
|
while (isalnum(s[p1])) p1++;
|
||||||
|
while (p1 < end && !isalnum(s[p1])) p1++;
|
||||||
|
if (p1 < end)
|
||||||
|
magic2 = s.mid(p1, 2);
|
||||||
|
|
||||||
|
val.cut(0);
|
||||||
|
if (magic1 == "DA")
|
||||||
|
{
|
||||||
|
const TDate& d = magic2 == "SC" ? _dls : _dlo;
|
||||||
|
val = d.string();
|
||||||
|
}
|
||||||
|
if (magic1 == "VA")
|
||||||
|
val = o.key();
|
||||||
|
if (magic1 == "DE")
|
||||||
|
val = valute().decode(o.key());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
|
||||||
|
park = s.left(pos);
|
||||||
|
park << val << s.mid(end+1);
|
||||||
|
s = park;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TEC_form::print_total(int riga, const THash_object& o, short id)
|
||||||
|
{
|
||||||
|
TForm_item& desc_field = find_field('F', odd_page, id);
|
||||||
|
if (desc_field.shown())
|
||||||
|
{
|
||||||
|
TString s(80); s = desc_field.prompt();
|
||||||
|
change_magic_names(o, s);
|
||||||
|
|
||||||
|
const TTotal& t = (const TTotal&)o.obj();
|
||||||
|
TEC_row row(s, t.importo());
|
||||||
|
|
||||||
|
TPrint_section& body = section('B');
|
||||||
|
row.print_on(body);
|
||||||
|
printer().setfooterline(riga + desc_field.y() -1, body.row(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TEC_form::stampa_pedata(TPrinter& pr)
|
void TEC_form::stampa_pedata(TPrinter& pr)
|
||||||
{
|
{
|
||||||
THash_object* tot[MAXTOT];
|
THash_object* tot[MAXTOT];
|
||||||
word num_rip = ordina_totali_per_valuta(tot);
|
word num_rip = ordina_totali_per_valuta(tot);
|
||||||
|
|
||||||
const word footer_used = 3;
|
const word maxtot = section('F').height() / _total_rows;
|
||||||
const word maxtot = section('F', 0).height() / footer_used;
|
|
||||||
if (num_rip > maxtot)
|
if (num_rip > maxtot)
|
||||||
num_rip = maxtot;
|
num_rip = maxtot;
|
||||||
|
|
||||||
const TString& desc_totale = describe(301, 'F', last_page);
|
|
||||||
|
|
||||||
TString desc(80);
|
TString desc(80);
|
||||||
TPrint_section& body = section('B');
|
TPrint_section& body = section('B');
|
||||||
|
|
||||||
for (word j = 0; j < num_rip; j++)
|
for (word j = 0; j < num_rip; j++)
|
||||||
{
|
{
|
||||||
const TString& key = tot[j]->key();
|
print_total(j * _total_rows, *tot[j], PEC_TSALDO);
|
||||||
TTotal& t = (TTotal&)(tot[j]->obj());
|
|
||||||
|
|
||||||
desc = desc_totale;
|
|
||||||
if (key.not_empty())
|
|
||||||
desc << ' ' << key;
|
|
||||||
TEC_row rip(desc, t.importo().normalize());
|
|
||||||
rip.scaduto(t.scaduto());
|
|
||||||
rip.esposto(t.esposto());
|
|
||||||
rip.importo_lire(t.importo_lire());
|
|
||||||
rip.print_on(body);
|
|
||||||
|
|
||||||
for (word fl = 0; fl < footer_used; fl++)
|
|
||||||
pr.setfooterline(footer_used*j+fl, body.row(fl));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TEC_form::ultima_pagina()
|
void TEC_form::ultima_pagina()
|
||||||
{
|
{
|
||||||
TPrint_section& foot = section('F', 0);
|
|
||||||
const word h = foot.height();
|
|
||||||
|
|
||||||
TPrinter& p = printer();
|
|
||||||
if (h > p.rows_left())
|
|
||||||
p.formfeed();
|
|
||||||
p.footerlen(h);
|
|
||||||
set_last_page(TRUE);
|
set_last_page(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -749,7 +787,7 @@ bool TEC_form::print_game(const TPartita& game)
|
|||||||
{
|
{
|
||||||
saldo.normalize();
|
saldo.normalize();
|
||||||
|
|
||||||
TEC_row sld(describe(301), saldo);
|
TEC_row sld(describe(PEC_SALDO), saldo);
|
||||||
sld.scaduto(scaduto);
|
sld.scaduto(scaduto);
|
||||||
sld.esposto(esposto);
|
sld.esposto(esposto);
|
||||||
sld.importo_lire(implire);
|
sld.importo_lire(implire);
|
||||||
@ -769,10 +807,27 @@ const TString& TEC_form::describe(short id, char sez, pagetype pt) const
|
|||||||
return fi.prompt();
|
return fi.prompt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TEC_form::init_memo()
|
||||||
|
{
|
||||||
|
TForm_item& fi = find_field('H', odd_page, PEC_MEMO);
|
||||||
|
if (fi.shown())
|
||||||
|
{
|
||||||
|
TLocalisamfile f(LF_RFORM);
|
||||||
|
f.put("TIPOPROF", name());
|
||||||
|
f.put("CODPROF", code());
|
||||||
|
f.put("SEZ", "H");
|
||||||
|
f.put("ID", PEC_MEMO);
|
||||||
|
const int err = f.read();
|
||||||
|
if (err == NOERR)
|
||||||
|
fi.set(f.get("TESTO"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TEC_form::TEC_form(const TEC_mask& m, bool gesval)
|
TEC_form::TEC_form(const TEC_mask& m, bool gesval)
|
||||||
: TForm(BASE_EC_PROFILE, m.get_prof_code()),
|
: TForm(BASE_EC_PROFILE, m.get_prof_code()),
|
||||||
_in_valuta(FALSE), _num_rip(0),
|
_in_valuta(FALSE), _num_rip(0), _total_rows(0),
|
||||||
_causali(LF_CAUSALI, CAU_CODCAUS, CAU_DESCR)
|
_causali(LF_CAUSALI, CAU_CODCAUS, CAU_DESCR),
|
||||||
|
_valute("%VAL")
|
||||||
{
|
{
|
||||||
_form = this;
|
_form = this;
|
||||||
|
|
||||||
@ -801,12 +856,23 @@ TEC_form::TEC_form(const TEC_mask& m, bool gesval)
|
|||||||
TForm_item& data_invio = head.find_field(PEC_DATAIN);
|
TForm_item& data_invio = head.find_field(PEC_DATAIN);
|
||||||
data_invio.set(m.get(F_DATASEND));
|
data_invio.set(m.get(F_DATASEND));
|
||||||
|
|
||||||
TForm_item& testo_memo = head.find_field(PEC_MEMO);
|
init_memo(); // Set fixed memo text
|
||||||
testo_memo.set("Per favore pagatemi che sono alla fame!");
|
|
||||||
|
|
||||||
pr.setfooterhandler(ec_footer_handler);
|
pr.setfooterhandler(ec_footer_handler);
|
||||||
const TPrint_section& foot = section('F');
|
const TPrint_section& foot = section('F');
|
||||||
pr.footerlen(foot.height());
|
pr.footerlen(foot.height());
|
||||||
|
|
||||||
|
_total_rows = 1;
|
||||||
|
for (word fi = 0; fi < foot.fields(); fi++)
|
||||||
|
{
|
||||||
|
const TForm_item& item = foot.field(fi);
|
||||||
|
if (item.shown())
|
||||||
|
{
|
||||||
|
const word y = (word)item.y();
|
||||||
|
if (y > _total_rows)
|
||||||
|
_total_rows = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEC_form::~TEC_form()
|
TEC_form::~TEC_form()
|
||||||
@ -982,7 +1048,7 @@ bool TStampaEC_application::create()
|
|||||||
TApplication::create();
|
TApplication::create();
|
||||||
|
|
||||||
_file.open(LF_TABCOM, LF_TAB, LF_CAUSALI, LF_MOV, LF_RMOV, 0);
|
_file.open(LF_TABCOM, LF_TAB, LF_CAUSALI, LF_MOV, LF_RMOV, 0);
|
||||||
_file.open(LF_NDITTE, LF_ANAG, LF_COMUNI, 0);
|
_file.open(LF_NDITTE, LF_ANAG, LF_COMUNI, LF_RFORM, 0);
|
||||||
_file.open(LF_CLIFO, LF_PARTITE, LF_SCADENZE, LF_PAGSCA ,0);
|
_file.open(LF_CLIFO, LF_PARTITE, LF_SCADENZE, LF_PAGSCA ,0);
|
||||||
|
|
||||||
_msk = new TEC_mask("sc2100a");
|
_msk = new TEC_mask("sc2100a");
|
||||||
|
@ -38,17 +38,22 @@ BEGIN
|
|||||||
OUTPUT F_LINPROF CODPROF[5,5]
|
OUTPUT F_LINPROF CODPROF[5,5]
|
||||||
OUTPUT F_DESPROF DESC
|
OUTPUT F_DESPROF DESC
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
|
FIELD ANTICLEAR
|
||||||
|
WARNING "Codice profilo o lingua errato"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_LINPROF 1
|
STRING F_LINPROF 1
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 18 8 ""
|
PROMPT 18 8 ""
|
||||||
|
FLAGS "U"
|
||||||
USE %LNG
|
USE %LNG
|
||||||
INPUT CODTAB F_LINPROF
|
INPUT CODTAB F_LINPROF
|
||||||
DISPLAY "Codice" CODTAB
|
DISPLAY "Codice" CODTAB
|
||||||
DISPLAY "Descrizione@50" S0
|
DISPLAY "Descrizione@50" S0
|
||||||
OUTPUT F_LINPROF CODTAB
|
OUTPUT F_LINPROF CODTAB
|
||||||
CHECKTYPE NORMAL
|
CHECKTYPE NORMAL
|
||||||
|
VALIDATE CHECK_FIELD F_CODPROF
|
||||||
|
WARNING "Codice profilo o lingua errato"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_DESPROF 50 40
|
STRING F_DESPROF 50 40
|
||||||
|
12
sc/sc21pec.h
12
sc/sc21pec.h
@ -1,6 +1,7 @@
|
|||||||
#ifndef __SC21PEC_H
|
#ifndef __SC21PEC_H
|
||||||
#define __SC21PEC_H
|
#define __SC21PEC_H
|
||||||
|
|
||||||
|
#define PEC_FLAGS 100
|
||||||
#define PEC_LUOGOIN 101
|
#define PEC_LUOGOIN 101
|
||||||
#define PEC_DATAIN 102
|
#define PEC_DATAIN 102
|
||||||
#define PEC_MEMO 103
|
#define PEC_MEMO 103
|
||||||
@ -24,4 +25,15 @@
|
|||||||
#define PEC_DATACAM 217
|
#define PEC_DATACAM 217
|
||||||
#define PEC_PAGINA 218
|
#define PEC_PAGINA 218
|
||||||
|
|
||||||
|
#define PEC_SALDO 301
|
||||||
|
#define PEC_ABBUONI 302
|
||||||
|
#define PEC_DIFFCAM 303
|
||||||
|
#define PEC_RITENUTE 304
|
||||||
|
|
||||||
|
#define PEC_RIPORTO 400
|
||||||
|
#define PEC_TSALDO 401
|
||||||
|
#define PEC_TSCADUTO 402
|
||||||
|
#define PEC_TESPOSTO 403
|
||||||
|
#define PEC_TLIRE 404
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user