Patch level : 2.0 nopatch
Files correlati : cm0.exe cm0100a.frm Ricompilazione Demo : [ ] Commento : Tampalini colpisce ancora git-svn-id: svn://10.65.10.50/trunk@11630 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
3001744c53
commit
a493dede4b
176
cm/cm0100.cpp
176
cm/cm0100.cpp
@ -13,25 +13,30 @@
|
|||||||
#include "rmov.h"
|
#include "rmov.h"
|
||||||
#include "pconti.h"
|
#include "pconti.h"
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// TForm_contixcdc
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class TForm_contixcdc : public TForm
|
class TForm_contixcdc : public TForm
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool validate(TForm_item &cf, TToken_string &s);
|
virtual bool validate(TForm_item &cf, TToken_string &s);
|
||||||
void set_testata() { set_header(1,TRUE); }
|
void set_testata() { set_header(1, false); set_header(1, true); }
|
||||||
TPrint_section& get_body() { return section('B', odd_page); }
|
void set_pedata() { set_footer(1, false); set_footer(1, true); }
|
||||||
TPrint_section& get_section(char s, pagetype pos) { return section(s, pos); }
|
TPrint_section& get_section(char s, pagetype pos);
|
||||||
|
|
||||||
TForm_contixcdc();
|
TForm_contixcdc();
|
||||||
virtual ~TForm_contixcdc();
|
virtual ~TForm_contixcdc();
|
||||||
};
|
};
|
||||||
|
|
||||||
TForm_contixcdc::TForm_contixcdc() :TForm("cm0100a") //costruttore
|
TPrint_section& TForm_contixcdc::get_section(char s, pagetype pos)
|
||||||
{
|
{
|
||||||
|
if (!exist(s, pos))
|
||||||
|
{
|
||||||
|
s = 'B';
|
||||||
|
pos = odd_page;
|
||||||
}
|
}
|
||||||
|
return section(s, pos);
|
||||||
TForm_contixcdc::~TForm_contixcdc() //distruttore
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TForm_contixcdc::validate(TForm_item &cf, TToken_string &s)
|
bool TForm_contixcdc::validate(TForm_item &cf, TToken_string &s)
|
||||||
@ -71,6 +76,18 @@ bool TForm_contixcdc::validate(TForm_item &cf, TToken_string &s)
|
|||||||
return TForm::validate(cf, s); // se il codice del messaggio non è identificato viene passato alla funzione standard
|
return TForm::validate(cf, s); // se il codice del messaggio non è identificato viene passato alla funzione standard
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TForm_contixcdc::TForm_contixcdc() :TForm("cm0100a") //costruttore
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
TForm_contixcdc::~TForm_contixcdc() //distruttore
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// TContixcdc_mask
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class TContixcdc_mask : public TAutomask
|
class TContixcdc_mask : public TAutomask
|
||||||
{
|
{
|
||||||
TRelation * _rel;
|
TRelation * _rel;
|
||||||
@ -165,7 +182,7 @@ class TContixCdc : public TSkeleton_application
|
|||||||
TForm_contixcdc* _form;
|
TForm_contixcdc* _form;
|
||||||
int _codes;
|
int _codes;
|
||||||
TDate _dataini, _datafin;
|
TDate _dataini, _datafin;
|
||||||
TTotali _t_gruppo, _t_sottoc, _t_fsc, _t_cms; //sono i tre set di totali (gruppo/conto, sottoconto, commessa)
|
TTotali _t_conto, _t_sottoc, _t_fsc, _t_cms; //sono i tre set di totali (gruppo/conto, sottoconto, commessa)
|
||||||
int _currgruppo, _currconto, _oldgruppo, _oldconto;
|
int _currgruppo, _currconto, _oldgruppo, _oldconto;
|
||||||
long _currsottoc, _oldsottoc;
|
long _currsottoc, _oldsottoc;
|
||||||
TString _currcms, _currfsc, _oldcms, _oldfsc;
|
TString _currcms, _currfsc, _oldcms, _oldfsc;
|
||||||
@ -183,16 +200,17 @@ protected:
|
|||||||
void print_header_cms();
|
void print_header_cms();
|
||||||
void print_footer_fsc();
|
void print_footer_fsc();
|
||||||
void print_header_fsc();
|
void print_header_fsc();
|
||||||
void print_footer_last();
|
|
||||||
void set_intestazione();
|
void set_intestazione();
|
||||||
void fill_importo(const TImporto& imp, short id_imp, short id_sez);
|
|
||||||
void fill_body(const TTotali& tot); //riempie il campo body con tutti i totali
|
void fill_importo(const TImporto& imp, pagetype pt, short id_imp, short id_sez);
|
||||||
void print_body(); //stampa effettivamente il body
|
void fill_body(pagetype pt, const TTotali& tot); //riempie il campo body con tutti i totali
|
||||||
void set_field(int id, const real& val); //mette in un campo del body odd un valore numerico
|
void set_field(pagetype pt, int id, const real& val); //mette in un campo del body odd un valore numerico
|
||||||
void set_field(int id, const char* val); //mette in un campo del body odd una stringa
|
void set_field(pagetype pt, int id, const char* val); //mette in un campo del body odd una stringa
|
||||||
void print_specialsection(char s, pagetype pos); // stampa una sezione qualunque (
|
|
||||||
void aggiorna_totali(const TImporto& importo, const TDate& data);
|
void aggiorna_totali(const TImporto& importo, const TDate& data);
|
||||||
|
|
||||||
|
void print_special_section(char type, pagetype pos);
|
||||||
|
void print_body(pagetype pt); //stampa effettivamente il body
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TContixCdc() {}
|
TContixCdc() {}
|
||||||
};
|
};
|
||||||
@ -229,14 +247,14 @@ void TContixCdc::print_sottoc()
|
|||||||
TString16 key;
|
TString16 key;
|
||||||
key.format("%d|%d|%ld", _oldgruppo, _oldconto, _oldsottoc);
|
key.format("%d|%d|%ld", _oldgruppo, _oldconto, _oldsottoc);
|
||||||
const TRectype& pcon = cache().get(LF_PCON, key);
|
const TRectype& pcon = cache().get(LF_PCON, key);
|
||||||
set_field(FR_GRUPPO, _oldgruppo);
|
set_field(odd_page, FR_GRUPPO, _oldgruppo);
|
||||||
set_field(FR_CONTO, _oldconto);
|
set_field(odd_page, FR_CONTO, _oldconto);
|
||||||
set_field(FR_SOTTOC, _oldsottoc);
|
set_field(odd_page, FR_SOTTOC, _oldsottoc);
|
||||||
set_field(FR_D_SOTTOC, pcon.get(PCN_DESCR));
|
set_field(odd_page, FR_D_SOTTOC, pcon.get(PCN_DESCR));
|
||||||
fill_body(_t_sottoc);
|
fill_body(odd_page, _t_sottoc);
|
||||||
if (_stampa_dettagli)
|
if (_stampa_dettagli)
|
||||||
print_body();
|
print_body(odd_page);
|
||||||
_t_gruppo += _t_sottoc;
|
_t_conto += _t_sottoc;
|
||||||
_t_fsc += _t_sottoc;
|
_t_fsc += _t_sottoc;
|
||||||
_t_cms += _t_sottoc;
|
_t_cms += _t_sottoc;
|
||||||
}
|
}
|
||||||
@ -246,22 +264,22 @@ void TContixCdc::print_sottoc()
|
|||||||
|
|
||||||
void TContixCdc::print_footer_gruppo()
|
void TContixCdc::print_footer_gruppo()
|
||||||
{
|
{
|
||||||
if (!_t_gruppo._tot_periodo.is_zero() && _stampa_totconti)
|
if (!_t_conto._tot_periodo.is_zero() && _stampa_totconti)
|
||||||
{
|
{
|
||||||
TString16 key;
|
TString16 key;
|
||||||
key.format("%d|%d", _oldgruppo, _oldconto);
|
key.format("%d|%d", _oldgruppo, _oldconto);
|
||||||
TString tmp;
|
TString tmp;
|
||||||
const TRectype& pcon = cache().get(LF_PCON, key);
|
const TRectype& pcon = cache().get(LF_PCON, key);
|
||||||
set_field(FR_GRUPPO, _oldgruppo);
|
set_field(first_page, FR_GRUPPO, _oldgruppo);
|
||||||
set_field(FR_CONTO, _oldconto);
|
set_field(first_page, FR_CONTO, _oldconto);
|
||||||
set_field(FR_SOTTOC, "");
|
set_field(first_page, FR_SOTTOC, "");
|
||||||
set_field(FR_D_SOTTOC, pcon.get(PCN_DESCR));
|
set_field(first_page, FR_D_SOTTOC, pcon.get(PCN_DESCR));
|
||||||
fill_body(_t_gruppo);
|
fill_body(first_page, _t_conto);
|
||||||
print_body();
|
print_body(first_page);
|
||||||
}
|
}
|
||||||
_oldgruppo = _currgruppo;
|
_oldgruppo = _currgruppo;
|
||||||
_oldconto = _currconto;
|
_oldconto = _currconto;
|
||||||
_t_gruppo.azzera();
|
_t_conto.azzera();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TContixCdc::print_footer_cms()
|
void TContixCdc::print_footer_cms()
|
||||||
@ -270,12 +288,12 @@ void TContixCdc::print_footer_cms()
|
|||||||
{
|
{
|
||||||
TString tmp;
|
TString tmp;
|
||||||
tmp.format(FR("TOTALE COMMESSA %s"), (const char*)_oldcms);
|
tmp.format(FR("TOTALE COMMESSA %s"), (const char*)_oldcms);
|
||||||
set_field(FR_GRUPPO, "");
|
set_field(last_page, FR_GRUPPO, "");
|
||||||
set_field(FR_CONTO, "");
|
set_field(last_page, FR_CONTO, "");
|
||||||
set_field(FR_SOTTOC, "");
|
set_field(last_page, FR_SOTTOC, "");
|
||||||
set_field(FR_D_SOTTOC, tmp);
|
set_field(last_page, FR_D_SOTTOC, tmp);
|
||||||
fill_body(_t_cms);
|
fill_body(last_page, _t_cms);
|
||||||
print_body();
|
print_body(last_page);
|
||||||
if (_saltopagina)
|
if (_saltopagina)
|
||||||
printer().formfeed();
|
printer().formfeed();
|
||||||
}
|
}
|
||||||
@ -290,44 +308,27 @@ void TContixCdc::print_footer_fsc()
|
|||||||
{
|
{
|
||||||
TString tmp;
|
TString tmp;
|
||||||
tmp.format(FR("TOTALE FASE %s"), (const char*) _oldfsc);
|
tmp.format(FR("TOTALE FASE %s"), (const char*) _oldfsc);
|
||||||
set_field(FR_D_SOTTOC, tmp);
|
set_field(even_page, FR_D_SOTTOC, tmp);
|
||||||
fill_body(_t_fsc);
|
fill_body(even_page, _t_fsc);
|
||||||
print_body();
|
print_body(even_page);
|
||||||
}
|
}
|
||||||
_oldfsc = _currfsc;
|
_oldfsc = _currfsc;
|
||||||
_t_fsc.azzera();
|
_t_fsc.azzera();
|
||||||
_headerfsc = TRUE;
|
_headerfsc = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TContixCdc::print_footer_last()
|
|
||||||
{
|
|
||||||
TPrinter& pr = printer();
|
|
||||||
TPrint_section& f = _form->get_section('F', last_page);
|
|
||||||
if (f.fields() > 0)
|
|
||||||
{
|
|
||||||
f.update();
|
|
||||||
if (f.height() > pr.rows_left())
|
|
||||||
pr.formfeed();
|
|
||||||
|
|
||||||
pr.footerlen(f.height());
|
|
||||||
for (word i = 0; i < f.height(); i++)
|
|
||||||
pr.setfooterline(i, f.row(i));
|
|
||||||
}
|
|
||||||
pr.formfeed();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TContixCdc::print_header_cms()
|
void TContixCdc::print_header_cms()
|
||||||
{
|
{
|
||||||
_form->find_field('H', odd_page, FR_CMS).set(_oldcms);
|
_form->find_field('H', odd_page, FR_CMS).set(_oldcms);
|
||||||
_form->find_field('H', odd_page, FR_D_CMS).set(cache().get("CMS", _oldcms).get("S0"));
|
_form->find_field('H', odd_page, FR_D_CMS).set(cache().get("CMS", _oldcms).get("S0"));
|
||||||
print_specialsection('H', odd_page);
|
print_special_section('H', odd_page);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TContixCdc::print_header_fsc()
|
void TContixCdc::print_header_fsc()
|
||||||
{
|
{
|
||||||
_form->find_field('H', last_page, FR_FSC).set(_oldfsc);
|
_form->find_field('H', last_page, FR_FSC).set(_oldfsc);
|
||||||
_form->find_field('H', last_page, FR_D_FSC).set(cache().get("FSC", _oldfsc).get("S0"));
|
_form->find_field('H', last_page, FR_D_FSC).set(cache().get("FSC", _oldfsc).get("S0"));
|
||||||
print_specialsection('H', last_page);
|
print_special_section('H', last_page);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TContixCdc::set_intestazione()
|
void TContixCdc::set_intestazione()
|
||||||
@ -341,24 +342,12 @@ void TContixCdc::set_intestazione()
|
|||||||
_form->find_field('H', first_page, FR_ACDC).set(_mask->get(F_ACDC));
|
_form->find_field('H', first_page, FR_ACDC).set(_mask->get(F_ACDC));
|
||||||
_form->find_field('H', first_page, FR_AFSC).set(_mask->get(F_AFSC));
|
_form->find_field('H', first_page, FR_AFSC).set(_mask->get(F_AFSC));
|
||||||
_form->set_testata();
|
_form->set_testata();
|
||||||
|
_form->set_pedata();
|
||||||
printer().footerlen(0);
|
|
||||||
printer().resetfooter();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TContixCdc::print_body()
|
void TContixCdc::print_special_section(char type, pagetype pos)
|
||||||
{
|
{
|
||||||
TPrint_section& body = _form->get_body();
|
TPrint_section& sec = _form->get_section(type, pos);
|
||||||
body.update();
|
|
||||||
if (body.height() > printer().rows_left())
|
|
||||||
printer().formfeed();
|
|
||||||
for (word i = 0; i < body.height(); i++) // stampa le righe del body
|
|
||||||
printer().print(body.row(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
void TContixCdc::print_specialsection(char s, pagetype pos)
|
|
||||||
{
|
|
||||||
TPrint_section& sec = _form->get_section(s, pos);
|
|
||||||
sec.update();
|
sec.update();
|
||||||
if (sec.height() > printer().rows_left())
|
if (sec.height() > printer().rows_left())
|
||||||
printer().formfeed();
|
printer().formfeed();
|
||||||
@ -366,43 +355,50 @@ void TContixCdc::print_specialsection(char s, pagetype pos)
|
|||||||
printer().print(sec.row(i));
|
printer().print(sec.row(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TContixCdc::set_field(int id, const real& val)
|
void TContixCdc::print_body(pagetype pos)
|
||||||
{
|
{
|
||||||
_form->find_field('B', odd_page, id).set(val.string());
|
print_special_section('B', pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TContixCdc::set_field(int id, const char* val)
|
void TContixCdc::set_field(pagetype pos, int id, const real& val)
|
||||||
{
|
{
|
||||||
_form->find_field('B', odd_page, id).set(val);
|
TPrint_section& ps = _form->get_section('B', pos);
|
||||||
|
ps.find_field(id).set(val.string());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TContixCdc::fill_importo(const TImporto& importo, short id_imp, short id_sez)
|
void TContixCdc::set_field(pagetype pos, int id, const char* val)
|
||||||
|
{
|
||||||
|
TPrint_section& ps = _form->get_section('B', pos);
|
||||||
|
ps.find_field(id).set(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TContixCdc::fill_importo(const TImporto& importo, pagetype pos, short id_imp, short id_sez)
|
||||||
{
|
{
|
||||||
if (!importo.is_zero())
|
if (!importo.is_zero())
|
||||||
{
|
{
|
||||||
TImporto imp(importo);
|
TImporto imp(importo);
|
||||||
imp.normalize();
|
imp.normalize();
|
||||||
set_field(id_imp, imp.valore());
|
set_field(pos, id_imp, imp.valore());
|
||||||
char sez[2] = { imp.sezione(), '\0' };
|
char sez[2] = { imp.sezione(), '\0' };
|
||||||
set_field(id_sez, sez);
|
set_field(pos, id_sez, sez);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
set_field(id_imp, "");
|
set_field(pos, id_imp, "");
|
||||||
set_field(id_sez, "");
|
set_field(pos, id_sez, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TContixCdc::fill_body(const TTotali& tot)
|
void TContixCdc::fill_body(pagetype pos, const TTotali& tot)
|
||||||
{
|
{
|
||||||
// riempie il body odd, contenente i totali; lo fa chiamando la set_field per ogni campo
|
// riempie il body odd, contenente i totali; lo fa chiamando la set_field per ogni campo
|
||||||
fill_importo(tot._tot_progprec, FR_PROGPREC, FR_SEGNO_PROGPREC);
|
fill_importo(tot._tot_progprec, pos, FR_PROGPREC, FR_SEGNO_PROGPREC);
|
||||||
fill_importo(tot._tot_periodo, FR_PERIODO, FR_SEGNO_PERIODO);
|
fill_importo(tot._tot_periodo, pos, FR_PERIODO, FR_SEGNO_PERIODO);
|
||||||
|
|
||||||
TImporto tempval = tot._tot_progprec; tempval += tot._tot_periodo;
|
TImporto tempval = tot._tot_progprec; tempval += tot._tot_periodo;
|
||||||
fill_importo(tempval, FR_PROG, FR_SEGNO_PROG);
|
fill_importo(tempval, pos, FR_PROG, FR_SEGNO_PROG);
|
||||||
|
|
||||||
fill_importo(tot._tot_saldoatt, FR_SALDOATT, FR_SEGNO_SALDOATT);
|
fill_importo(tot._tot_saldoatt, pos, FR_SALDOATT, FR_SEGNO_SALDOATT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TContixCdc::aggiorna_totali(const TImporto& importo, const TDate& data)
|
void TContixCdc::aggiorna_totali(const TImporto& importo, const TDate& data)
|
||||||
@ -498,7 +494,7 @@ void TContixCdc::main_loop()
|
|||||||
_oldconto = -1;
|
_oldconto = -1;
|
||||||
_t_cms.azzera();
|
_t_cms.azzera();
|
||||||
_t_fsc.azzera();
|
_t_fsc.azzera();
|
||||||
_t_gruppo.azzera();
|
_t_conto.azzera();
|
||||||
_t_sottoc.azzera();
|
_t_sottoc.azzera();
|
||||||
_headercms = TRUE;
|
_headercms = TRUE;
|
||||||
_headerfsc = (ctrlfsc) ? TRUE : FALSE;
|
_headerfsc = (ctrlfsc) ? TRUE : FALSE;
|
||||||
@ -542,7 +538,7 @@ void TContixCdc::main_loop()
|
|||||||
if (ctrlfsc)
|
if (ctrlfsc)
|
||||||
print_footer_fsc();
|
print_footer_fsc();
|
||||||
print_footer_cms();
|
print_footer_cms();
|
||||||
print_footer_last();
|
printer().formfeed();
|
||||||
}
|
}
|
||||||
printer().close();
|
printer().close();
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ BEGIN
|
|||||||
END
|
END
|
||||||
|
|
||||||
// intestazione generale stampa conti per commessa
|
// intestazione generale stampa conti per commessa
|
||||||
SECTION HEADER FIRST 6
|
SECTION HEADER FIRST 7
|
||||||
|
|
||||||
STRINGA 1 5
|
STRINGA 1 5
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -201,7 +201,6 @@ END
|
|||||||
VALUTA FR_PERIODO 14
|
VALUTA FR_PERIODO 14
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 83 1 ""
|
PROMPT 83 1 ""
|
||||||
PICTURE "."
|
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGA FR_SEGNO_PERIODO 1
|
STRINGA FR_SEGNO_PERIODO 1
|
||||||
@ -212,7 +211,6 @@ END
|
|||||||
VALUTA FR_PROG 14
|
VALUTA FR_PROG 14
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 100 1 ""
|
PROMPT 100 1 ""
|
||||||
PICTURE "."
|
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGA FR_SEGNO_PROG 1
|
STRINGA FR_SEGNO_PROG 1
|
||||||
@ -223,7 +221,6 @@ END
|
|||||||
VALUTA FR_SALDOATT 14
|
VALUTA FR_SALDOATT 14
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 117 1 ""
|
PROMPT 117 1 ""
|
||||||
PICTURE "."
|
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGA FR_SEGNO_SALDOATT 1
|
STRINGA FR_SEGNO_SALDOATT 1
|
||||||
@ -233,4 +230,7 @@ END
|
|||||||
|
|
||||||
END // section body
|
END // section body
|
||||||
|
|
||||||
|
SECTION FOOTER ODD 3
|
||||||
|
END
|
||||||
|
|
||||||
END // form
|
END // form
|
||||||
|
Loading…
x
Reference in New Issue
Block a user