Patch level :2.2 140

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :ulteriori modifiche ai report delle stampe di CA3 e aggiunta della prima bozza (NON funzionante!) della stampa rendiconto


git-svn-id: svn://10.65.10.50/trunk@13238 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2005-06-29 14:34:28 +00:00
parent 7d60fb41e5
commit 5a2f33e99a
11 changed files with 1203 additions and 17 deletions

View File

@ -9,6 +9,10 @@ int main(int argc, char** argv)
{
case 1: ca3200(argc, argv); break; // stampa mastrini
case 2: ca3300(argc, argv); break; // stampa bilancio
//case 3: ca3400(argc, argv); break; // stampa conti per CdC/Commessa/Fase
//case 4: ca3500(argc, argv); break; // stampa scheda CdC/Commessa/Fase
//case 5: ca3600(argc, argv); break; // stampa pagato per CdC/Commessa/Fase
case 6: ca3700(argc, argv); break; //stampa rendiconto
case 8: ca3900(argc, argv); break; // generazione movimenti perfetti ma casuali
default: ca3100(argc, argv); break; // stampa movimenti
}

View File

@ -4,6 +4,10 @@
int ca3100(int argc, char* argv[]);
int ca3200(int argc, char* argv[]);
int ca3300(int argc, char* argv[]);
//int ca3400(int argc, char* argv[]);
//int ca3500(int argc, char* argv[]);
//int ca3600(int argc, char* argv[]);
int ca3700(int argc, char* argv[]);
int ca3900(int argc, char* argv[]);
#endif // __CA3_H

View File

@ -1,5 +1,5 @@
<report libraries="ca3100b,ve1300" name="ca3100a" lpi="8">
<report libraries="ve1300" name="ca3100a" lpi="8" class="ca3100b">
<description>Movimenti CA per numero registrazione</description>
<font face="Courier New" size="8" />
<section type="Head">

View File

@ -1,5 +1,5 @@
<report libraries="ca3100b,ve1300" name="ca3100b" lpi="8">
<report libraries="ve1300" name="ca3100b" lpi="8" class="ca3100b">
<description>Movimenti CA per data</description>
<font face="Courier New" size="8" />
<section type="Head">

View File

@ -59,8 +59,6 @@ BEGIN
OUTPUT F_ANNO CODTAB
CHECKTYPE NORMAL
CHECKTYPE NORMAL
MESSAGE HIDE,98|HIDE,99|SHOW,96|SHOW,97
MESSAGE EMPTY HIDE,96|HIDE,97|SHOW,98|SHOW,99
FLAGS "RZ"
ADD NONE
END
@ -82,7 +80,7 @@ END
TEXT 96
BEGIN
PROMPT 2 17 "Dalla data competenza"
PROMPT 2 17 "Dalla data competenza "
END
TEXT 97
@ -90,16 +88,6 @@ BEGIN
PROMPT 40 17 "Alla data competenza "
END
TEXT 98
BEGIN
PROMPT 2 17 "Dalla data operazione "
END
TEXT 99
BEGIN
PROMPT 40 17 "Alla data operazione "
END
DATE F_DATAINI
BEGIN
PROMPT 26 17 ""

View File

@ -1,6 +1,6 @@
<report libraries="ca3200a,ve1300" name="ca3200a" lpi="8">
<description>Mastrini CA movimentati</description>
<report libraries="ve1300" name="ca3200a" lpi="8" class="ca3200a">
<description>Mastrini CA</description>
<font face="Courier New" size="8" />
<section type="Head" height="6.5">
<font italic="1" face="Courier New" bold="1" size="8" />
@ -97,9 +97,11 @@ THEN</prescript>
</section>
<section type="Head" level="3">
<groupby>DATACOMP</groupby>
<prescript description="H3 PRESCRIPT">MESSAGE RESET,F3.103</prescript>
</section>
<section type="Body" />
<section type="Body" level="1">
<condition>NUMREG != 0</condition>
<field x="1" type="Data" width="11" pattern="1">
<source>DATACOMP</source>
<postscript description="B1.0 POSTSCRIPT">MESSAGE COPY,F3.131</postscript>
@ -192,6 +194,7 @@ THEN
</field>
</section>
<section type="Foot" level="3" height="2.5">
<condition>#103 != 0</condition>
<font italic="1" face="Courier New" size="8" />
<field x="154" y="0.5" type="Testo" width="2" pattern="1" text="al" />
<field x="137" y="0.5" type="Valuta" align="right" width="15" id="103" pattern="1" hide_zero="1" text="###.###.###,@@">

665
ca/ca3700.cpp Executable file
View File

@ -0,0 +1,665 @@
#include <applicat.h>
#include <execp.h>
#include <progind.h>
#include <reprint.h>
#include "pconana.h"
#include "movana.h"
#include "rmovana.h"
#include "ca3.h"
#include "ca3700.h"
#include "calib01.h"
#include "calib02.h"
////////////////////////////////////////////////////////
// MASCHERA
////////////////////////////////////////////////////////
class TPrint_rendiconto_ca_mask : public TAutomask
{
protected:
bool on_field_event(TOperable_field& o, TField_event e, long jolly);
const TString& get_compatible_library() const;
bool test_compatible_report();
void create_page2();
int create_page2_sheet(int lf, int& y, short& dlg, bool required);
public:
TPrint_rendiconto_ca_mask();
virtual ~TPrint_rendiconto_ca_mask() {}
};
const TString& TPrint_rendiconto_ca_mask::get_compatible_library() const
{
TString& lib = get_tmp_string();
lib = "ca3700a";
// const int stp = get_int(F_TIPOCONTI);
// lib << (stp == 1 ? 'a' : 'b'); // tipo di report da usare in caso di report multipli
return lib;
}
bool TPrint_rendiconto_ca_mask::test_compatible_report()
{
TFilename lib = get_compatible_library();
const TString& name = get(F_REPORT);
bool ok = name.not_empty();
if (ok)
{
TReport rep;
ok = rep.load(name);
if (ok)
{
TToken_string& libraries = rep.get_libraries();
ok = libraries.get_pos(lib) >= 0;
}
}
if (!ok)
{
set(F_REPORT, lib);
lib.ext("rep");
ok = lib.custom_path();
}
return ok;
}
bool TPrint_rendiconto_ca_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
break;
case F_REPORT:
if (e == fe_button)
{
const TString8 lib = get_compatible_library();
TFilename path = o.get();
if (select_custom_file(path, "rep", lib))
{
path = path.name();
path.ext("");
o.set(path);
}
} else
if (e == fe_close)
{
if (!test_compatible_report())
return error_box(TR("Impossibile trovare un report compatibile"));
}
break;
default: break;
}
return true;
}
int TPrint_rendiconto_ca_mask::create_page2_sheet(int lf, int& y, short& dlg, bool required)
{
TSheet_field& sf = sfield(F_RIGHE);
TMask& sm = sf.sheet_mask();
const int h = ca_create_fields(sm, 0, lf, 1, y, dlg, dlg+50);
for (int i = 0; i < h; i++)
{
TEdit_field& fld = sm.efield(dlg+i);
int logic = lf;
if (logic == LF_FASI)
{
const TMultilevel_code_info& fasinfo = ca_multilevel_code_info(LF_FASI);
if (fasinfo.parent() != 0)
{
const TMultilevel_code_info& parinfo = ca_multilevel_code_info(fasinfo.parent());
if (i < parinfo.levels())
logic = fasinfo.parent();
}
}
const char* fieldname = NULL;
switch(logic)
{
case LF_CDC : fieldname = RMOVANA_CODCCOSTO; break;
case LF_COMMESSE: fieldname = RMOVANA_CODCMS; break;
case LF_FASI : fieldname = RMOVANA_CODFASE; break;
default : fieldname = RMOVANA_CODCONTO; break;
}
TFieldref* f = (TFieldref*)fld.field();
f->set_name(fieldname);
fld.check_type(required ? CHECK_REQUIRED : CHECK_NORMAL);
TEdit_field& dfld = sm.efield(dlg+50+i);
dfld.set_field(EMPTY_STRING); // Toglie campi che fan saltare gli output!
}
y += h+1;
dlg += h;
return h;
}
void TPrint_rendiconto_ca_mask::create_page2()
{
TSheet_field& sf = sfield(F_RIGHE);
TMask& sm = sf.sheet_mask();
sm.hide(-1);
const TMultilevel_code_info& fasinfo = ca_multilevel_code_info(LF_FASI);
TConfig_anal ini;
const bool fsc_req = ini.get_bool("FscRequired");
int y = 1;
short dlg = S_CDC1 + 100; // id del primo campo da generare
for (int i = 0; i < 2; i++)
{
const TString& level = ini.get("Level", NULL, i+1); // Legge il livello 1 o 2
if (level == "CDC") // Crea centro di costo
{
if (fasinfo.parent() == LF_CDC)
create_page2_sheet(LF_FASI, y, dlg, fsc_req);
else
{
const bool cdc_req = ini.get_bool("CdcRequired");
create_page2_sheet(LF_CDC, y, dlg, cdc_req);
}
} else
if (level == "CMS") // Crea commessa
{
if (fasinfo.parent() == LF_COMMESSE)
create_page2_sheet(LF_FASI, y, dlg, fsc_req);
else
{
const bool cms_req = ini.get_bool("CmsRequired");
create_page2_sheet(LF_COMMESSE, y, dlg, cms_req);
}
}
}
if (fasinfo.levels() > 0 && fasinfo.parent() <= 0)
create_page2_sheet(LF_FASI, y, dlg, fsc_req);
for (short id = S_CDC12+100; id >= S_CDC1+100; id--)
{
const int pos = sm.id2pos(id);
if (pos >= 0)
{
TMask_field& f = sm.fld(pos);
const int size = f.size();
const TString& prompt = f.prompt();
sf.set_column_header(id, prompt);
sf.set_column_justify(id, f.is_kind_of(CLASS_REAL_FIELD));
sf.set_column_width(id, (max(3+size, prompt.len()+1)) * CHARX);
}
else
sf.delete_column(id);
}
}
TPrint_rendiconto_ca_mask::TPrint_rendiconto_ca_mask()
:TAutomask("ca3700")
{
TConfig_anal cfg;
const bool use_pdcc = cfg.get_bool("UsePdcc");
const int logicnum = use_pdcc ? LF_PCON : LF_PCONANA;
const int nfields = ca_create_fields(*this, 0, logicnum, 2, 5, F_CDC1_INI, F_DES1_INI, 0x0, "#DACONTO");
ca_create_fields(*this, 0, logicnum, 2, 11, F_CDC1_FIN, F_DES1_FIN, 0x0, "#ACONTO");
for (int i = 0; i < nfields; i++)
{
TMask_field& daconto = field(F_CDC1_INI + i);
daconto.set_group(1);
daconto.check_type(CHECK_NORMAL);
TMask_field& aconto = field(F_CDC1_FIN + i);
aconto.set_group(2);
aconto.check_type(CHECK_NORMAL);
}
// creazione dei campi della seconda pagina della maschera
create_page2();
}
///////////////////////////////////////////////////////////////
// RECORDSET PRINCIPALE (caso standard: conti movimentati)
///////////////////////////////////////////////////////////////
class TPrint_rendiconto_ca_recordset : public TISAM_recordset
{
protected:
int _anno;
int _tipoconti;
int _tipimov;
TDate _dadata, _adata;
long _danumreg, _anumreg;
TString _daconto, _aconto, _codcosto, _codcms, _codfas;
protected: //da libreria
virtual const TVariant& get(const char* column_name) const;
protected:
static bool mov_filter(const TRelation* rel);
bool valid_record(const TRelation& rel) const;
virtual void set_custom_filter(TCursor& cur) const;
const TImporto& saldo_iniziale(const char* conto) const;
public:
virtual void set_filter(const TPrint_rendiconto_ca_mask& msk, int cms_row);
TPrint_rendiconto_ca_recordset(const TString& sql) : TISAM_recordset(sql) { }
};
static const TPrint_rendiconto_ca_recordset* myself = NULL;
//metodo per riconoscere se il record corrente soddisfa i filtri della maschera...strafighissimo!
bool TPrint_rendiconto_ca_recordset::valid_record(const TRelation& rel) const
{
//prima controlla la testata...
const TRectype& mov = rel.curr(LF_MOVANA);
const char tipomov = mov.get_char(MOVANA_TIPOMOV);
int tipomov_int = 0;
switch (tipomov)
{
case 'P': tipomov_int = 2; break;
case 'V': tipomov_int = 4; break;
default: tipomov_int = 1; break;
}
if ((_tipimov & tipomov_int) == 0)
return false;
//..poi le righe (devono comparire solo le righe con cdc/cms/fsc che appaiono nello sheet)
const TRectype& rmov = rel.curr(LF_RMOVANA);
if (_codcosto.not_empty())
{
const TString& cos = rmov.get(RMOVANA_CODCCOSTO);
if (cos != _codcosto)
return false;
}
if (_codcms.not_empty())
{
const TString& cms = rmov.get(RMOVANA_CODCMS);
if (cms != _codcms)
return false;
}
if (_codfas.not_empty())
{
const TString& fas = rmov.get(RMOVANA_CODFASE);
if (fas != _codfas)
return false;
}
return true;
}
bool TPrint_rendiconto_ca_recordset::mov_filter(const TRelation* rel)
{
return myself->valid_record(*rel);
}
void TPrint_rendiconto_ca_recordset::set_custom_filter(TCursor& cur) const
{
//filtro sui conti selezionati sulla maschera
TRectype darec(cur.curr()), arec(cur.curr()); //record corrente (rmovana (solo movimentati))
darec.put(RMOVANA_CODCONTO, _daconto);
darec.put(RMOVANA_DATACOMP, _dadata);
arec.put(RMOVANA_CODCONTO, _aconto);
arec.put(RMOVANA_DATACOMP, _adata);
cur.setregion(darec, arec);
myself = this;
cur.set_filterfunction(mov_filter, true);
}
const TImporto& TPrint_rendiconto_ca_recordset::saldo_iniziale(const char* conto) const
{
TAnal_bill bill(conto, _codcosto, _codcms, _codfas);
const TSaldanal& saldo = ca_saldo(bill, _dadata, _adata, _tipimov);
return saldo._ini;
}
const TVariant& TPrint_rendiconto_ca_recordset::get(const char* column_name) const
{
if (strncmp(column_name, "SALDOINI:", 9) == 0)
{
const TString16 sub_field = column_name+9;
const TString& conto = get(RMOVANA_CODCONTO).as_string();
const TImporto& saldo_ini = saldo_iniziale(conto);
TVariant& var = get_tmp_var();
if (sub_field == "DARE")
var = saldo_ini.sezione() == 'D' ? saldo_ini.valore() : ZERO;
else
var = saldo_ini.sezione() == 'A' ? saldo_ini.valore() : ZERO;
return var;
}
if (strcmp(column_name, "#COSTO") == 0)
{
TVariant& var = get_tmp_var();
var = _codcosto;
return var;
}
if (strcmp(column_name, "#COMMESSA") == 0)
{
TVariant& var = get_tmp_var();
var = _codcms;
return var;
}
if (strcmp(column_name, "#FASE") == 0)
{
TVariant& var = get_tmp_var();
var = _codfas;
return var;
}
return TISAM_recordset::get(column_name);
}
//metodo per caricare i valori nel recordset dalla maschera...fighissimo!!
void TPrint_rendiconto_ca_recordset::set_filter(const TPrint_rendiconto_ca_mask& msk, int cms_row)
{
_daconto, _aconto, _codcosto = _codcms = _codfas = "";
if (cms_row >= 0)
{
TSheet_field& sf = msk.sfield(F_RIGHE);
TMask& sm = sf.sheet_mask();
sf.update_mask(cms_row);
TRelation rel(LF_RMOVANA);
sm.autosave(rel);
_codcosto = rel.curr().get(RMOVANA_CODCCOSTO);
_codcms = rel.curr().get(RMOVANA_CODCMS);
_codfas = rel.curr().get(RMOVANA_CODFASE);
}
for (int i = 0; msk.id2pos(F_CDC1_INI+i) > 0; i++)
{
_daconto << msk.get(F_CDC1_INI+i);
_aconto << msk.get(F_CDC1_FIN+i);
}
_dadata = msk.get_date(F_DATAINI);
_adata = msk.get_date(F_DATAFIN);
}
/////////////////////////////////////////////////////////////////////////////////
// RECORDSET SECONDARIO (casi alternativi: conti con saldo != 0 e tutti i conti)
/////////////////////////////////////////////////////////////////////////////////
class TPrint_rendiconto_ca_alternative_recordset : public TPrint_rendiconto_ca_recordset
{
TIsamtempfile* _tmp_rmovana;
protected:
const TImporto& saldo_finale(const char* conto) const;
virtual void set_custom_filter(TCursor& cur) const;
public:
virtual void set_filter(const TPrint_rendiconto_ca_mask& msk, int cms_row);
TPrint_rendiconto_ca_alternative_recordset(const TString& sql);
~TPrint_rendiconto_ca_alternative_recordset() { delete _tmp_rmovana; }
};
TPrint_rendiconto_ca_alternative_recordset::TPrint_rendiconto_ca_alternative_recordset(const TString& sql)
: TPrint_rendiconto_ca_recordset(sql)
{
_tmp_rmovana = NULL;
}
const TImporto& TPrint_rendiconto_ca_alternative_recordset::saldo_finale(const char* conto) const
{
TAnal_bill bill(conto, _codcosto, _codcms, _codfas);
const TSaldanal& saldo = ca_saldo(bill, _dadata, _adata, _tipimov);
return saldo._fin;
}
void TPrint_rendiconto_ca_alternative_recordset::set_custom_filter(TCursor& cur) const
{
//crea un file temporaneo che non viene distrutto ad inizio stampa effettiva
TIsamtempfile* tmp = new TIsamtempfile(LF_RMOVANA, "anal", false, false);
relation()->replace(tmp); //sostituisce il vero file rmovana con quello temporaneo
}
void TPrint_rendiconto_ca_alternative_recordset::set_filter(const TPrint_rendiconto_ca_mask& msk, int cms_row)
{
//se esiste non vuoto il file temporano con tracciato rmovana lo cancella e lo ricrea vuoto
if (_tmp_rmovana != NULL)
delete _tmp_rmovana;
_tmp_rmovana = new TIsamtempfile(LF_RMOVANA, "anal", true, true);
//prende un po' di dati dalla maschera
_daconto, _aconto, _codcosto = _codcms = _codfas = "";
if (cms_row >= 0)
{
TSheet_field& sf = msk.sfield(F_RIGHE);
TMask& sm = sf.sheet_mask();
sf.update_mask(cms_row);
TRelation rel(LF_RMOVANA);
sm.autosave(rel);
_codcosto = rel.curr().get(RMOVANA_CODCCOSTO);
_codcms = rel.curr().get(RMOVANA_CODCMS);
_codfas = rel.curr().get(RMOVANA_CODFASE);
}
for (int i = 0; msk.id2pos(F_CDC1_INI+i) > 0; i++)
{
_daconto << msk.get(F_CDC1_INI+i);
_aconto << msk.get(F_CDC1_FIN+i);
}
_dadata = msk.get_date(F_DATAINI);
_adata = msk.get_date(F_DATAFIN);
//scandisce il piano dei conti analitico creando un cursore con i conti nell'intervallo scelto sulla maschera
TRelation rel_pconana(LF_PCONANA);
TRectype daconto(LF_PCONANA);
daconto.put(PCONANA_CODCONTO, _daconto);
TRectype aconto(LF_PCONANA);
aconto.put(PCONANA_CODCONTO, _aconto);
//solo i gr/co/sottoc completi interessano!!!
int contolen = 0;
const TMultilevel_code_info& info = ca_multilevel_code_info(LF_PCONANA);
for (int l = info.levels()-1; l >= 0; l--)
contolen += info.len(l);
TString filtro;
filtro << "LEN(CODCONTO)==" << contolen;
TCursor cur_pconana(&rel_pconana, filtro, 1, &daconto, &aconto);
const long pconana_items = cur_pconana.items();
cur_pconana.freeze();
TProgind pi(pconana_items, "Scansione conti...");
//scandisce il piano dei conti..
for (cur_pconana = 0; cur_pconana.pos() < pconana_items; ++cur_pconana)
{
pi.addstatus(1);
TRectype& current_pconana_rec = cur_pconana.curr();
const TString conto = current_pconana_rec.get(PCONANA_CODCONTO);
bool aggiungi = true;
if (_tipoconti == 2) //se si è scelto di stampare solo quelli con saldo != 0...
{
const TImporto& saldo_fin = saldo_finale(conto);
aggiungi = !saldo_fin.is_zero();
}
if (aggiungi) //se il conto va aggiunto (casi: conti con saldo !=0 trovato, tutti i conti comunque)..
{
TRelation rel_rmovana(LF_RMOVANA);
rel_rmovana.add(LF_MOVANA, "NUMREG==NUMREG"); //aggiunge le testate x avere i tipi mov.
//..crea un cursore su rmovana per vedere se i conti selezionati hanno veri movimenti che soddisfano
//i parametri del filtro sulla maschera
TRectype da_rmovana(LF_RMOVANA);
da_rmovana.put(RMOVANA_CODCONTO, conto);
da_rmovana.put(RMOVANA_DATACOMP, _dadata);
TRectype a_rmovana(LF_RMOVANA);
a_rmovana.put(RMOVANA_CODCONTO, conto);
a_rmovana.put(RMOVANA_DATACOMP, _adata);
TString filtro;
if (_codcosto.not_empty())
filtro << "(" << RMOVANA_CODCCOSTO << "==\"" << _codcosto << "\")";
if (_codcms.not_empty())
{
if (filtro.not_empty())
filtro << "&&";
filtro << "(" << RMOVANA_CODCMS << "==\"" << _codcms << "\")";
}
if (_codfas.not_empty())
{
if (filtro.not_empty())
filtro << "&&";
filtro << "(" << RMOVANA_CODFASE << "==\"" << _codfas << "\")";
}
TCursor cur_rmovana(&rel_rmovana, filtro, 2, &da_rmovana, &a_rmovana);
const long rmovana_items = cur_rmovana.items();
cur_rmovana.freeze();
bool almeno_uno_aggiunto = false;
if (rmovana_items > 0)
{
for (cur_rmovana = 0; cur_rmovana.pos() < rmovana_items; ++cur_rmovana)
{
//deve coincidere anche il tipomov! sarebbe stato troppo semplice...
const char tipomov = rel_rmovana.curr(LF_MOVANA).get_char(MOVANA_TIPOMOV);
int tipomov_int = 0;
switch (tipomov)
{
case 'P': tipomov_int = 2; break;
case 'V': tipomov_int = 4; break;
default: tipomov_int = 1; break;
}
if ((_tipimov & tipomov_int) != 0)
{
_tmp_rmovana->write(cur_rmovana.curr()); // aggiunge i record al file temporaneo
almeno_uno_aggiunto = true;
}
}
}
//se non ha aggiunto nemmeno un record valido..
//crea un record di rmovana con il solo conto,datacomp e lo aggiunge al file temporaneo
if (!almeno_uno_aggiunto)
{
TRectype fake_rmovana_rec(LF_RMOVANA);
fake_rmovana_rec.put(RMOVANA_CODCONTO, conto);
fake_rmovana_rec.put(RMOVANA_DATACOMP, _dadata);
_tmp_rmovana->write(fake_rmovana_rec);
}
} //end if aggiungi
} //end for su pconana_items
}
////////////////////////////////////////////////////////
// REPORT
////////////////////////////////////////////////////////
class TPrint_rendiconto_ca_rep : public TAnal_report
{
protected:
virtual bool set_recordset(const TString& sql);
virtual bool get_usr_val(const TString& name, TVariant& var) const;
public:
void set_filter(const TPrint_rendiconto_ca_mask& msk, int cms_row);
};
bool TPrint_rendiconto_ca_rep::get_usr_val(const TString& name, TVariant& var) const
{
return TAnal_report::get_usr_val(name, var);
}
bool TPrint_rendiconto_ca_rep::set_recordset(const TString& sql)
{
TPrint_rendiconto_ca_recordset* rs = new TPrint_rendiconto_ca_recordset(sql);
return TReport::set_recordset(rs);
}
void TPrint_rendiconto_ca_rep::set_filter(const TPrint_rendiconto_ca_mask& msk, int cms_row)
{
const int tipoconti = 1; //stronzata per poter compilare inizialmente
TPrint_rendiconto_ca_recordset* recset = NULL;
const char* query ="USE RMOVANA KEY 2\nJOIN MOVANA INTO NUMREG==NUMREG";
switch (tipoconti)
{
case 1:
recset = new TPrint_rendiconto_ca_recordset(query);
break;
default:
recset = new TPrint_rendiconto_ca_alternative_recordset(query);
break;
}
recset->set_filter(msk, cms_row);
TAnal_report::set_recordset(recset);
}
////////////////////////////////////////////////////////
// APPLICAZIONE
////////////////////////////////////////////////////////
class TPrint_rendiconto_ca : public TSkeleton_application
{
TPrint_rendiconto_ca_mask * _mask;
protected:
bool create();
bool destroy();
public:
virtual void main_loop();
};
bool TPrint_rendiconto_ca::create()
{
_mask = new TPrint_rendiconto_ca_mask;
return TSkeleton_application::create();
}
bool TPrint_rendiconto_ca::destroy()
{
delete _mask;
return TSkeleton_application::destroy();
}
void TPrint_rendiconto_ca::main_loop()
{
while (_mask->run() == K_ENTER)
{
//costruzione della query x il report in base ai parametri della maschera
TSheet_field& sheet = _mask->sfield(F_RIGHE);
const int n_righe_sheet = sheet.items();
//se lo sheet è vuoto aggiunge una riga vuota
if (n_righe_sheet == 0)
sheet.insert();
//report e book
TReport_book book; //book dei report
TString path = _mask->get(F_REPORT);
if (path.empty())
path = "ca3700a";
TPrint_rendiconto_ca_rep rep;
rep.load(path);
FOR_EACH_SHEET_ROW(sheet, r, row)
{
rep.set_filter(*_mask, r);
book.add(rep);
}
book.print_or_preview(); //stampa il book dei report
}
}
int ca3700(int argc, char* argv[])
{
TPrint_rendiconto_ca a;
a.run(argc, argv, TR("Stampa rendiconto"));
return 0;
}

41
ca/ca3700.h Executable file
View File

@ -0,0 +1,41 @@
#ifndef __CA3700_H
#define __CA3700_H
//pagina 1
#define F_CODDITTA 201
#define F_RAGSOC 202
#define F_DATASTAMPA 203
#define F_ANNO 204
#define F_REPORT 205
#define F_DATAINI 250
#define F_DATAFIN 251
//campi generati dal pdc
#define F_CDC1_INI 206
#define F_CDC4_INI 209
#define F_CDC1_FIN 216
#define F_CDC4_FIN 219
#define F_DES1_INI 226
#define F_DES4_INI 229
#define F_DES1_FIN 236
#define F_DES4_FIN 239
//sheet di pagina 2
#define F_RIGHE 260
#define S_CDC1 101
#define S_CDC2 102
#define S_CDC3 103
#define S_CDC4 104
#define S_CDC5 105
#define S_CDC6 106
#define S_CDC7 107
#define S_CDC8 108
#define S_CDC9 109
#define S_CDC10 110
#define S_CDC11 111
#define S_CDC12 112
#endif // __CA3700_H

248
ca/ca3700.uml Executable file
View File

@ -0,0 +1,248 @@
#include "ca3700.h"
TOOLBAR "" 0 -3 0 3
STRING DLG_PROFILE 50
BEGIN
PROMPT 9 0 "Profilo "
PSELECT
END
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -12 -1 "~Stampa"
MESSAGE EXIT,K_ENTER
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE
PAGE "Parametri stampa" -1 -1 78 20
NUMBER F_CODDITTA 5
BEGIN
PROMPT 1 1 "Ditta "
FLAGS "FRD"
USE LF_NDITTE KEY 1
CHECKTYPE REQUIRED
INPUT CODDITTA F_CODDITTA
DISPLAY "Codice" CODDITTA
DISPLAY "Ragione sociale @50" RAGSOC
OUTPUT F_CODDITTA CODDITTA
OUTPUT F_RAGSOC RAGSOC
END
STRING F_RAGSOC 50
BEGIN
PROMPT 15 1 ""
FLAGS "D"
END
DATE F_DATASTAMPA
BEGIN
PROMPT 1 2 "Data di stampa "
FLAGS "A"
END
NUMBER F_ANNO 4
BEGIN
PROMPT 49 2 "Esercizio "
USE ESC
INPUT CODTAB F_ANNO
DISPLAY "Codice Esercizio" CODTAB
DISPLAY "Data inizio esercizio" D0
DISPLAY "Data fine esercizio " D1
OUTPUT F_ANNO CODTAB
CHECKTYPE NORMAL
CHECKTYPE NORMAL
FLAGS "RZ"
ADD NONE
END
GROUPBOX DLG_NULL 76 6
BEGIN
PROMPT 1 4 "@bDa:"
END
GROUPBOX DLG_NULL 76 6
BEGIN
PROMPT 1 10 "@bA:"
END
GROUPBOX DLG_NULL 76 7
BEGIN
PROMPT 1 16 "@bOpzioni stampa"
END
TEXT 96
BEGIN
PROMPT 2 17 "Dalla data "
END
TEXT 97
BEGIN
PROMPT 40 17 "Alla data "
END
DATE F_DATAINI
BEGIN
PROMPT 26 17 ""
END
DATE F_DATAFIN
BEGIN
PROMPT 62 17 ""
END
STRING F_REPORT 256 64
BEGIN
PROMPT 2 21 "Report "
FLAGS "B"
CHECKTYPE REQUIRED
END
ENDPAGE
PAGE "Selezioni" -1 -1 78 20
SPREADSHEET F_RIGHE -1 -2
BEGIN
PROMPT 0 2 ""
ITEM "Cdc1"
ITEM "Cdc2"
ITEM "Cdc3"
ITEM "Cdc4"
ITEM "Cdc5"
ITEM "Cdc6"
ITEM "Cdc7"
ITEM "Cdc8"
ITEM "Cdc9"
ITEM "Cdc10"
ITEM "Cdc11"
ITEM "Cdc12"
END
ENDPAGE
ENDMASK
PAGE "Riga" -1 -1 78 19
STRING S_CDC1 20
BEGIN
PROMPT 1 2 "Cdc1"
FLAGS "B"
CHECKTYPE NORMAL
GROUP 1
END
STRING S_CDC2 20
BEGIN
PROMPT 21 2 "Cdc2"
FLAGS "B"
CHECKTYPE NORMAL
GROUP 1
END
STRING S_CDC3 20
BEGIN
PROMPT 41 2 "Cdc3"
FLAGS "B"
CHECKTYPE NORMAL
GROUP 1
END
STRING S_CDC4 20
BEGIN
PROMPT 61 2 "Cdc4"
FLAGS "B"
CHECKTYPE NORMAL
GROUP 1
END
STRING S_CDC5 20
BEGIN
PROMPT 1 3 "Cdc5"
FLAGS "B"
CHECKTYPE NORMAL
GROUP 1
END
STRING S_CDC6 20
BEGIN
PROMPT 21 3 "Cdc6"
FLAGS "B"
CHECKTYPE NORMAL
GROUP 1
END
STRING S_CDC7 20
BEGIN
PROMPT 41 3 "Cdc7"
FLAGS "B"
CHECKTYPE NORMAL
GROUP 1
END
STRING S_CDC8 20
BEGIN
PROMPT 61 3 "Cdc8"
FLAGS "B"
CHECKTYPE NORMAL
GROUP 1
END
STRING S_CDC9 20
BEGIN
PROMPT 1 4 "Cdc9"
FLAGS "B"
CHECKTYPE NORMAL
GROUP 1
END
STRING S_CDC10 20
BEGIN
PROMPT 21 4 "Cdc10"
FLAGS "B"
CHECKTYPE NORMAL
GROUP 1
END
STRING S_CDC11 20
BEGIN
PROMPT 41 4 "Cdc11"
FLAGS "B"
CHECKTYPE NORMAL
GROUP 1
END
STRING S_CDC12 20
BEGIN
PROMPT 61 4 "Cdc12"
FLAGS "B"
CHECKTYPE NORMAL
GROUP 1
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -13 -1 ""
END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -23 -1 ""
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -33 -1 ""
END
ENDPAGE
ENDMASK

230
ca/ca3700a.rep Executable file
View File

@ -0,0 +1,230 @@
<report libraries="ve1300" name="ca3700a" lpi="8" class="ca3700a">
<description>Rendiconto</description>
<font face="Courier New" size="8" />
<section type="Head" height="6.5">
<font italic="1" face="Courier New" bold="1" size="8" />
<field x="1" type="Stringa" width="50" pattern="1">
<font italic="1" face="Courier New" bold="1" size="10" />
<source>#SYSTEM.RAGSOC</source>
</field>
<field x="80" type="Data" width="10" pattern="1">
<source>#SYSTEM.DATE</source>
</field>
<field x="165" type="Numero" align="right" width="3" pattern="1">
<source>#REPORT.PAGE</source>
</field>
<field x="1" y="1.5" type="Testo" width="18" pattern="1" text="Centro di Costo:" />
<field x="14" y="1.5" type="Stringa" width="23" pattern="1">
<source>#COSTO</source>
<prescript description="H0.0 PRESCRIPT">CA_FORMAT_COSTO</prescript>
</field>
<field x="38" y="1.5" type="Stringa" width="50" pattern="1">
<prescript description="H0.0 PRESCRIPT">MESSAGE ISAMREAD,CDC,CODCOSTO=RMOVANA.CODCCOSTO,DESCRIZ</prescript>
</field>
<field x="1" y="3" type="Testo" width="9" pattern="1" text="Commessa:" />
<field x="14" y="3" type="Stringa" width="23" pattern="1">
<source>#COMMESSA</source>
<prescript description="H0.0 PRESCRIPT">CA_FORMAT_COMMESSA</prescript>
</field>
<field x="38" y="3" type="Stringa" width="50" pattern="1">
<prescript description="H0.0 PRESCRIPT">MESSAGE ISAMREAD,COMMESSE,CODCMS=RMOVANA.CODCMS,DESCRIZ</prescript>
</field>
<field x="1" y="4.5" type="Testo" width="5" pattern="1" text="Fase:" />
<field x="14" y="4.5" type="Stringa" width="13" pattern="1">
<source>#FASE</source>
<prescript description="H0.0 PRESCRIPT">CA_FORMAT_FASE</prescript>
</field>
<field x="38" y="4.5" type="Stringa" width="50" pattern="1">
<prescript description="H0.0 PRESCRIPT">MESSAGE ISAMREAD,FASI,CODFASE=RMOVANA.CODFASE,DESCRIZ</prescript>
</field>
<field border="2" x="1" y="6" type="Linea" width="167" height="0" pattern="1" />
</section>
<section type="Head" level="1" height="3">
<prescript description="H1 PRESCRIPT">MESSAGE RESET,F1.101
MESSAGE RESET,F1.102</prescript>
<field border="1" radius="100" x="1" type="Testo" valign="center" align="center" shade_offset="25" width="167" height="2.5" text="RENDICONTO">
<font face="Courier New" bold="1" size="16" />
</field>
</section>
<section repeat="1" type="Head" level="2" height="4.5">
<groupby>CODCONTO</groupby>
<font italic="1" face="Courier New" size="8" />
<prescript description="H2 PRESCRIPT">MESSAGE RESET,F2.101
MESSAGE RESET,F2.102
MESSAGE RESET,F2.201
MESSAGE RESET,F2.202
</prescript>
<field type="Testo" width="6" pattern="1" text="Conto:">
<font italic="1" face="Courier New" bold="1" size="8" />
</field>
<field x="7" type="Stringa" width="23" pattern="1">
<font italic="1" face="Courier New" bold="1" size="8" />
<source>CODCONTO</source>
<prescript description="H2.0 PRESCRIPT">CA_FORMAT_CONTO</prescript>
</field>
<field x="31" type="Stringa" width="50" pattern="1">
<font italic="1" face="Courier New" bold="1" size="8" />
<prescript description="H2.0 PRESCRIPT">MESSAGE ISAMREAD,PCONANA,CODCONTO=CODCONTO,DESCR</prescript>
</field>
<field x="13" y="1.5" type="Testo" align="center" width="11" pattern="1" text="N.Reg.&#2F;Riga" />
<field x="25" y="1.5" type="Testo" width="11" pattern="1" text="Descrizione" />
<field x="52" y="1.5" type="Testo" width="10" pattern="1" text="Data Doc." />
<field x="64" y="1.5" type="Testo" width="6" pattern="1" text="N.Doc." />
<field x="73" y="1.5" type="Testo" width="7" pattern="1" text="Causale" />
<field x="115" y="1.5" type="Testo" align="right" width="4" pattern="1" text="Dare" />
<field x="130" y="1.5" type="Testo" align="right" width="5" pattern="1" text="Avere" />
<field x="138" y="1.5" type="Testo" align="right" width="14" pattern="1" text="Saldo" />
<field border="1" x="1" y="2.5" type="Linea" width="168" height="0" pattern="1" />
<field x="80" y="3" type="Testo" width="25" pattern="1" text="Progressivo precedente" />
<field x="1" y="1.5" type="Testo" align="center" width="10" id="121" pattern="1" text="Data" />
<field x="104" y="3" type="Valuta" align="right" width="15" id="201" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>SALDOINI:DARE</source>
<postscript description="H2.201 POSTSCRIPT">MESSAGE COPY,B1.103
</postscript>
</field>
<field x="120" y="3" type="Valuta" align="right" width="15" id="202" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>SALDOINI:AVERE</source>
<prescript description="H2.202 PRESCRIPT">#THIS @
DUP
0 &#3E; IF
-1 *
"B1.103" +!
ELSE
DROP
THEN</prescript>
</field>
</section>
<section type="Head" level="3">
<groupby>DATACOMP</groupby>
</section>
<section type="Body" />
<section type="Body" level="1">
<field x="1" type="Data" width="11" pattern="1">
<source>DATACOMP</source>
<postscript description="B1.0 POSTSCRIPT">MESSAGE COPY,F3.131</postscript>
</field>
<field x="13" type="Numero" align="right" width="7" pattern="1">
<source>NUMREG</source>
</field>
<field x="20" type="Testo" width="1" pattern="1" text="&#2F;" />
<field x="21" type="Numero" align="right" width="3" pattern="1">
<source>NUMRIG</source>
</field>
<field x="25" type="Stringa" dynamic_height="1" width="25" height="2" pattern="1">
<source>DESCR</source>
</field>
<field x="52" type="Data" width="11" pattern="1">
<source>MOVANA.DATADOC</source>
</field>
<field x="64" type="Stringa" width="7" pattern="1">
<source>MOVANA.NUMDOC</source>
</field>
<field x="73" type="Stringa" width="3" pattern="1">
<source>MOVANA.CODCAUS</source>
</field>
<field x="77" type="Stringa" dynamic_height="1" width="25" height="2" pattern="1">
<prescript description="B1.0 PRESCRIPT">MESSAGE ISAMREAD,CAUS,CODCAUS=MOVANA.CODCAUS,DESCR</prescript>
</field>
<field x="104" type="Valuta" align="right" width="15" id="101" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>IMPORTO</source>
<prescript description="B1.101 PRESCRIPT">"RMOVANA.SEZIONE" @
"A" =
IF
0 #THIS !
ELSE
#THIS @
"B1.103"
+!
THEN
</prescript>
<postscript description="B1.101 POSTSCRIPT">MESSAGE ADD,F2.101
</postscript>
</field>
<field x="120" type="Valuta" align="right" width="15" id="102" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>IMPORTO</source>
<prescript description="B1.102 PRESCRIPT">"RMOVANA.SEZIONE" @
"D" =
IF
0 #THIS !
ELSE
#THIS @
-1 *
"B1.103"
+!
THEN
</prescript>
<postscript description="B1.102 POSTSCRIPT">MESSAGE ADD,F2.102
</postscript>
</field>
<field x="137" type="Valuta" align="right" width="15" id="103" pattern="1" hide_zero="1" text="###.###.###,@@">
<postscript description="B1.103 POSTSCRIPT">MESSAGE COPY,F3.103</postscript>
</field>
</section>
<section type="Foot" />
<section type="Foot" level="1" />
<section type="Foot" level="2" height="4">
<field border="1" x="1" y="0.5" type="Linea" width="168" height="0" pattern="1" />
<field x="82" y="1" type="Testo" width="22" pattern="1" text="Totali periodo:">
<font face="Courier New" bold="1" size="8" />
</field>
<field x="82" y="2.5" type="Testo" width="22" pattern="1" text="Totali progressivi:">
<font face="Courier New" bold="1" size="8" />
</field>
<field x="104" y="1" type="Valuta" align="right" width="15" id="101" pattern="1" text="###.###.###,@@">
<font face="Courier New" bold="1" size="8" />
</field>
<field x="120" y="1" type="Valuta" align="right" width="15" id="102" pattern="1" text="###.###.###,@@">
<font face="Courier New" bold="1" size="8" />
</field>
<field x="104" y="2.5" type="Valuta" align="right" width="15" id="201" pattern="1" text="###.###.###,@@">
<font face="Courier New" bold="1" size="8" />
<source>#101+#H2.201</source>
</field>
<field x="120" y="2.5" type="Valuta" align="right" width="15" id="202" pattern="1" text="###.###.###,@@">
<font face="Courier New" bold="1" size="8" />
<source>#102+#H2.202</source>
</field>
<field x="137" y="2.5" type="Valuta" align="right" width="15" id="203" pattern="1" text="###.###.###,@@">
<font face="Courier New" bold="1" size="8" />
<source>#201-#202</source>
</field>
</section>
<section type="Foot" level="3" height="2.5">
<font italic="1" face="Courier New" size="8" />
<field x="154" y="0.5" type="Testo" width="2" pattern="1" text="al" />
<field x="137" y="0.5" type="Valuta" align="right" width="15" id="103" pattern="1" hide_zero="1" text="###.###.###,@@">
<font italic="1" face="Courier New" bold="1" size="8" />
</field>
<field x="157" y="0.5" type="Data" width="11" id="131" pattern="1" />
</section>
<sql>USE RMOVANA KEY 2
JOIN MOVANA INTO NUMREG==NUMREG</sql>
<prescript description="PRESCRIPT">: SCAMBIA_CAMPI ( F1 F2 -- )
VARIABLE _X1 \ coordinate del campo F1
VARIABLE _Y1
VARIABLE _X2 \ coordinate del campo F2
VARIABLE _Y2
2DUP \ duplica i campi F1 F2 sullo stack
GET_POS \ prende le coordinate del campo F2
_Y2 ! \ e le mette in _Y2 e _X2
_X2 !
GET_POS \ prende le coordinate del campo F1
_Y1 ! \ e le mette in _Y1 e _X1
_X1 !
_X1 @ \ legge le coordinate di F1
_Y1 @
ROT
SET_POS \ mette le coord in F2
_X2 @
_Y2 @
ROT
SET_POS
;
</prescript>
</report>

View File

@ -59,6 +59,9 @@ Picture = <ba03>
Module = 22
Flags = ""
Item_01 = "Tabelle", "", "F"
Item_02 = "Movimenti", "ca3 -0", "F"
Item_03 = "Mastrini", "ca3 -1", "F"
Item_04 = "Bilancio", "ca3 -2", "F"
[CAMENU_050]
Caption = "Servizi"