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
146
sc/sc2100.cpp
146
sc/sc2100.cpp
@ -31,16 +31,21 @@ class TEC_form : public TForm
|
||||
|
||||
TCursor* _cursore;
|
||||
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
|
||||
TDate _dlo, _dls, _dir; // Data limite operazione, scaduto e inizio rischio
|
||||
int _giorni_rischio; // Numero giorni rischio nella maschera di selezione
|
||||
bool _in_valuta; // Il form e' in valuta
|
||||
word _num_rip; // Numero di righe usate per i riporti
|
||||
word _total_rows; // Numero di righe usate per i totali
|
||||
|
||||
protected:
|
||||
void init_memo();
|
||||
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_pedata(TPrinter& p);
|
||||
@ -52,6 +57,7 @@ protected:
|
||||
public:
|
||||
TTotalizer& totali() { return _totali; }
|
||||
TDecoder& causali() { return _causali; }
|
||||
TDecoder& valute() { return _valute; }
|
||||
|
||||
const TDate& data_limite_operazione() const { return _dlo; }
|
||||
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())
|
||||
{
|
||||
TEC_row& rec = new_row(row, data, abbuoni, 2);
|
||||
rec.descrizione(form().describe(302));
|
||||
rec.descrizione(form().describe(PEC_ABBUONI));
|
||||
if (in_valuta)
|
||||
{
|
||||
TImporto il(row.importo(FALSE, 0x2));
|
||||
@ -488,7 +494,7 @@ void TEC_array::add_row(const TRiga_partite& row)
|
||||
if (!diffcam.is_zero())
|
||||
{
|
||||
TEC_row& rec = new_row(row, data, diffcam, 3);
|
||||
rec.descrizione(form().describe(303));
|
||||
rec.descrizione(form().describe(PEC_DIFFCAM));
|
||||
if (in_valuta)
|
||||
{
|
||||
TImporto il(row.importo(FALSE, 0x4));
|
||||
@ -501,7 +507,7 @@ void TEC_array::add_row(const TRiga_partite& row)
|
||||
if (!ritenute.is_zero())
|
||||
{
|
||||
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)
|
||||
_num_rip = maxtot;
|
||||
|
||||
const TString& riporto = describe(301, 'F');
|
||||
const TString& riporto = describe(PEC_RIPORTO, 'F');
|
||||
|
||||
TString desc(80);
|
||||
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)
|
||||
{
|
||||
THash_object* tot[MAXTOT];
|
||||
word num_rip = ordina_totali_per_valuta(tot);
|
||||
|
||||
const word footer_used = 3;
|
||||
const word maxtot = section('F', 0).height() / footer_used;
|
||||
const word maxtot = section('F').height() / _total_rows;
|
||||
if (num_rip > maxtot)
|
||||
num_rip = maxtot;
|
||||
|
||||
const TString& desc_totale = describe(301, 'F', last_page);
|
||||
|
||||
TString desc(80);
|
||||
TPrint_section& body = section('B');
|
||||
|
||||
for (word j = 0; j < num_rip; j++)
|
||||
{
|
||||
const TString& key = tot[j]->key();
|
||||
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));
|
||||
}
|
||||
{
|
||||
print_total(j * _total_rows, *tot[j], PEC_TSALDO);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -749,7 +787,7 @@ bool TEC_form::print_game(const TPartita& game)
|
||||
{
|
||||
saldo.normalize();
|
||||
|
||||
TEC_row sld(describe(301), saldo);
|
||||
TEC_row sld(describe(PEC_SALDO), saldo);
|
||||
sld.scaduto(scaduto);
|
||||
sld.esposto(esposto);
|
||||
sld.importo_lire(implire);
|
||||
@ -769,10 +807,27 @@ const TString& TEC_form::describe(short id, char sez, pagetype pt) const
|
||||
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)
|
||||
: TForm(BASE_EC_PROFILE, m.get_prof_code()),
|
||||
_in_valuta(FALSE), _num_rip(0),
|
||||
_causali(LF_CAUSALI, CAU_CODCAUS, CAU_DESCR)
|
||||
_in_valuta(FALSE), _num_rip(0), _total_rows(0),
|
||||
_causali(LF_CAUSALI, CAU_CODCAUS, CAU_DESCR),
|
||||
_valute("%VAL")
|
||||
{
|
||||
_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);
|
||||
data_invio.set(m.get(F_DATASEND));
|
||||
|
||||
TForm_item& testo_memo = head.find_field(PEC_MEMO);
|
||||
testo_memo.set("Per favore pagatemi che sono alla fame!");
|
||||
init_memo(); // Set fixed memo text
|
||||
|
||||
pr.setfooterhandler(ec_footer_handler);
|
||||
const TPrint_section& foot = section('F');
|
||||
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()
|
||||
@ -829,8 +895,8 @@ class TStampaEC_application : public TApplication
|
||||
|
||||
TFile_array _file;
|
||||
|
||||
TString _lingua_ditta;
|
||||
bool _gesval;
|
||||
TString _lingua_ditta;
|
||||
bool _gesval;
|
||||
|
||||
protected: // TApplication
|
||||
virtual bool create();
|
||||
@ -982,7 +1048,7 @@ bool TStampaEC_application::create()
|
||||
TApplication::create();
|
||||
|
||||
_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);
|
||||
|
||||
_msk = new TEC_mask("sc2100a");
|
||||
|
@ -38,17 +38,22 @@ BEGIN
|
||||
OUTPUT F_LINPROF CODPROF[5,5]
|
||||
OUTPUT F_DESPROF DESC
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD ANTICLEAR
|
||||
WARNING "Codice profilo o lingua errato"
|
||||
END
|
||||
|
||||
STRING F_LINPROF 1
|
||||
BEGIN
|
||||
PROMPT 18 8 ""
|
||||
FLAGS "U"
|
||||
USE %LNG
|
||||
INPUT CODTAB F_LINPROF
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_LINPROF CODTAB
|
||||
CHECKTYPE NORMAL
|
||||
VALIDATE CHECK_FIELD F_CODPROF
|
||||
WARNING "Codice profilo o lingua errato"
|
||||
END
|
||||
|
||||
STRING F_DESPROF 50 40
|
||||
|
54
sc/sc21pec.h
54
sc/sc21pec.h
@ -1,27 +1,39 @@
|
||||
#ifndef __SC21PEC_H
|
||||
#define __SC21PEC_H
|
||||
|
||||
#define PEC_LUOGOIN 101
|
||||
#define PEC_DATAIN 102
|
||||
#define PEC_MEMO 103
|
||||
#define PEC_FLAGS 100
|
||||
#define PEC_LUOGOIN 101
|
||||
#define PEC_DATAIN 102
|
||||
#define PEC_MEMO 103
|
||||
|
||||
#define PEC_CODCAUS 201
|
||||
#define PEC_DESCR1 202
|
||||
#define PEC_DESCR2 203
|
||||
#define PEC_DESCR3 204
|
||||
#define PEC_DATADOC 205
|
||||
#define PEC_NUMDOC 206
|
||||
#define PEC_PROTIVA 207
|
||||
#define PEC_TOTDOC 208
|
||||
#define PEC_DATAPAG 209
|
||||
#define PEC_DARE 210
|
||||
#define PEC_AVERE 211
|
||||
#define PEC_SCADUTO 212
|
||||
#define PEC_ESPOSTO 213
|
||||
#define PEC_SBF 214
|
||||
#define PEC_IMPLIRE 215
|
||||
#define PEC_CAMBIO 216
|
||||
#define PEC_DATACAM 217
|
||||
#define PEC_PAGINA 218
|
||||
#define PEC_CODCAUS 201
|
||||
#define PEC_DESCR1 202
|
||||
#define PEC_DESCR2 203
|
||||
#define PEC_DESCR3 204
|
||||
#define PEC_DATADOC 205
|
||||
#define PEC_NUMDOC 206
|
||||
#define PEC_PROTIVA 207
|
||||
#define PEC_TOTDOC 208
|
||||
#define PEC_DATAPAG 209
|
||||
#define PEC_DARE 210
|
||||
#define PEC_AVERE 211
|
||||
#define PEC_SCADUTO 212
|
||||
#define PEC_ESPOSTO 213
|
||||
#define PEC_SBF 214
|
||||
#define PEC_IMPLIRE 215
|
||||
#define PEC_CAMBIO 216
|
||||
#define PEC_DATACAM 217
|
||||
#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
|
||||
|
Loading…
x
Reference in New Issue
Block a user