2008-06-11 14:16:07 +00:00
|
|
|
#include <applicat.h>
|
|
|
|
#include <automask.h>
|
2008-11-14 00:40:30 +00:00
|
|
|
#include <form.h>
|
|
|
|
#include <report.h>
|
2008-06-11 14:16:07 +00:00
|
|
|
#include <reprint.h>
|
2009-02-14 17:13:09 +00:00
|
|
|
#include <tabutil.h>
|
2008-07-29 13:36:43 +00:00
|
|
|
#include <textset.h>
|
2008-06-11 14:16:07 +00:00
|
|
|
|
|
|
|
#include "co1.h"
|
|
|
|
#include "co1300a.h"
|
|
|
|
|
2008-07-29 13:36:43 +00:00
|
|
|
#include "socicoop.h"
|
|
|
|
|
|
|
|
#include "..\ve\velib.h"
|
2009-02-14 19:44:50 +00:00
|
|
|
#include "..\ve\velib04.h"
|
2008-07-29 13:36:43 +00:00
|
|
|
#include "..\ve\velib07.h"
|
|
|
|
|
2008-06-11 14:16:07 +00:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////
|
|
|
|
// MASCHERA
|
|
|
|
////////////////////////////////////////////////////////
|
|
|
|
class TEstrattoConto_mask : public TAutomask
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
|
|
|
public:
|
|
|
|
TEstrattoConto_mask();
|
|
|
|
virtual ~TEstrattoConto_mask() {};
|
|
|
|
};
|
|
|
|
|
|
|
|
TEstrattoConto_mask::TEstrattoConto_mask() :TAutomask ("co1300a")
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TEstrattoConto_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
|
|
|
|
{
|
2008-11-26 10:47:53 +00:00
|
|
|
switch (f.dlg())
|
|
|
|
{
|
|
|
|
case F_DATAINI:
|
|
|
|
case F_DATAFIN:
|
|
|
|
if (e == fe_init || e == fe_modify)
|
|
|
|
{
|
|
|
|
const TDate ini = get_date(F_DATAINI);
|
|
|
|
const TDate fin = get_date(F_DATAFIN);
|
|
|
|
|
|
|
|
if (ini.year() == fin.year() && ini.month() == fin.month() &&
|
|
|
|
ini.day() == 1 && fin.is_end_month())
|
2009-02-14 17:13:09 +00:00
|
|
|
{
|
|
|
|
enable(F_GENPAG);
|
2008-11-26 10:47:53 +00:00
|
|
|
enable(F_CHIUSURA);
|
2009-02-14 17:13:09 +00:00
|
|
|
}
|
2008-11-26 10:47:53 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
disable(F_CHIUSURA);
|
|
|
|
reset(F_CHIUSURA);
|
2009-02-14 17:13:09 +00:00
|
|
|
disable(F_GENPAG);
|
|
|
|
reset(F_GENPAG);
|
2008-11-26 10:47:53 +00:00
|
|
|
}
|
2009-02-14 17:13:09 +00:00
|
|
|
|
2008-11-26 10:47:53 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return true;
|
2008-06-11 14:16:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////
|
|
|
|
// REPORT
|
|
|
|
////////////////////////////////////////////////////////
|
|
|
|
|
2008-07-29 13:36:43 +00:00
|
|
|
class TEstrattoConto_rep : public TDocument_report
|
|
|
|
{
|
2009-02-14 17:13:09 +00:00
|
|
|
TGenerazione_effetti * _el;
|
2008-11-26 10:47:53 +00:00
|
|
|
int _riga;
|
|
|
|
long _socio;
|
2009-02-14 17:13:09 +00:00
|
|
|
real _iva;
|
|
|
|
real _totconf;
|
2008-11-26 10:47:53 +00:00
|
|
|
real _saldocred;
|
|
|
|
real _saldodeb;
|
|
|
|
real _ritenuta;
|
2010-06-21 13:46:42 +00:00
|
|
|
real _acconto8;
|
2008-11-26 10:47:53 +00:00
|
|
|
|
2009-02-27 16:49:30 +00:00
|
|
|
TString8 _numrit;
|
|
|
|
TString8 _tiporit;
|
|
|
|
TString _sprit;
|
2008-11-26 10:47:53 +00:00
|
|
|
|
2009-02-27 16:49:30 +00:00
|
|
|
TString8 _numchi;
|
|
|
|
TString8 _tipochi;
|
2008-11-26 10:47:53 +00:00
|
|
|
TString _tipoass;
|
2009-02-27 16:49:30 +00:00
|
|
|
TString8 _numass;
|
|
|
|
TString8 _spchi;
|
2008-11-26 10:47:53 +00:00
|
|
|
TString _spass;
|
|
|
|
bool _chiusura;
|
2009-02-14 17:13:09 +00:00
|
|
|
bool _genpag;
|
|
|
|
bool _aggiorna;
|
2008-11-14 00:40:30 +00:00
|
|
|
|
2008-07-29 13:36:43 +00:00
|
|
|
protected:
|
|
|
|
virtual bool use_mask() {return false;}
|
2008-11-14 00:40:30 +00:00
|
|
|
virtual bool set_usr_val(const TString& name, const TVariant& var);
|
|
|
|
bool incr_field(int idx, const TVariant& var);
|
2008-11-26 10:47:53 +00:00
|
|
|
void chiudi_mese() ;
|
2008-11-14 00:40:30 +00:00
|
|
|
|
|
|
|
public:
|
2009-02-14 17:13:09 +00:00
|
|
|
TEstrattoConto_rep(bool genpag, bool chiusura, bool aggiorna);
|
2008-07-29 13:36:43 +00:00
|
|
|
};
|
|
|
|
|
2008-11-14 00:40:30 +00:00
|
|
|
bool TEstrattoConto_rep::incr_field(int idx, const TVariant& var)
|
|
|
|
{
|
|
|
|
if (_riga > 0)
|
|
|
|
{
|
|
|
|
TReport_section& f1 = section('F',1);
|
|
|
|
TReport_field* rf = f1.find_field(_riga * 1000 + 100 + idx);
|
|
|
|
if (rf != NULL)
|
|
|
|
{
|
|
|
|
TVariant v = rf->get();
|
|
|
|
v += var;
|
|
|
|
rf->set(v);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TEstrattoConto_rep::set_usr_val(const TString& name, const TVariant& var)
|
|
|
|
{
|
|
|
|
if(name == "#EC_TIPOMOV")
|
|
|
|
{
|
|
|
|
TReport_section& f1 = section('F',1);
|
|
|
|
TReport_field* rf = NULL;
|
2008-11-26 16:45:42 +00:00
|
|
|
int id;
|
|
|
|
for (id = 1100; ; id += 1000)
|
2008-11-14 00:40:30 +00:00
|
|
|
{
|
|
|
|
rf = f1.find_field(id);
|
|
|
|
if (rf == NULL)
|
|
|
|
break;
|
|
|
|
const TVariant& rfv = rf->get();
|
|
|
|
if (rfv == var)
|
|
|
|
break;
|
|
|
|
if (rfv.is_empty())
|
|
|
|
{
|
|
|
|
rf->set(var);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (rf != NULL)
|
|
|
|
_riga = id / 1000;
|
|
|
|
else
|
|
|
|
_riga = 0;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name == "#EC_QTA")
|
|
|
|
{
|
|
|
|
incr_field(2, var);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name == "#EC_MER")
|
|
|
|
{
|
|
|
|
incr_field(5, var);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name == "#EC_ACC")
|
|
|
|
{
|
|
|
|
incr_field(6, var);
|
2010-06-21 13:46:42 +00:00
|
|
|
_acconto8 += var.as_real();
|
2008-11-14 00:40:30 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name == "#EC_IMPCRE")
|
|
|
|
{
|
|
|
|
incr_field(7, var);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name == "#EC_IMPDEB")
|
|
|
|
{
|
|
|
|
incr_field(8, var);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name == "#EC_IMPO")
|
|
|
|
{
|
2009-02-14 17:13:09 +00:00
|
|
|
const real val = var.as_real();
|
|
|
|
_iva -= val;
|
2008-11-14 00:40:30 +00:00
|
|
|
incr_field(9, var);
|
|
|
|
return true;
|
|
|
|
}
|
2008-11-26 10:47:53 +00:00
|
|
|
|
|
|
|
if (name == "#EC_SOCIO")
|
|
|
|
{
|
|
|
|
_socio = var.as_int();
|
|
|
|
return true;
|
|
|
|
}
|
2009-02-14 17:13:09 +00:00
|
|
|
if (name == "#EC_NETC")
|
|
|
|
{
|
|
|
|
const real val = var.as_real();
|
|
|
|
_totconf += val;
|
|
|
|
return true;
|
|
|
|
}
|
2008-11-26 10:47:53 +00:00
|
|
|
if (name == "#EC_CRED")
|
|
|
|
{
|
|
|
|
const real val = var.as_real();
|
|
|
|
_saldocred += val;
|
|
|
|
|
|
|
|
TVariant cod;
|
|
|
|
|
|
|
|
get_record_field(RDOC_CODART, cod);
|
|
|
|
if (_sprit == cod.as_string() && val != ZERO)
|
|
|
|
{
|
|
|
|
_chiusura = false;
|
|
|
|
TVariant totrit;
|
|
|
|
get_usr_val("#F1.98", totrit);
|
|
|
|
real v = totrit.as_real() + val;
|
|
|
|
totrit = v;
|
|
|
|
set_usr_val("#F1.98", totrit);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name == "#EC_DEB")
|
|
|
|
{
|
|
|
|
const real val = var.as_real();
|
|
|
|
|
|
|
|
_saldodeb += val;
|
|
|
|
TVariant cod;
|
|
|
|
|
|
|
|
get_record_field(RDOC_CODART, cod);
|
|
|
|
if (_sprit == cod.as_string() && val != ZERO)
|
|
|
|
{
|
|
|
|
_chiusura = false;
|
|
|
|
TVariant totrit;
|
|
|
|
get_usr_val("#F1.98", totrit);
|
|
|
|
real v = totrit.as_real() - val;
|
|
|
|
totrit = v;
|
|
|
|
set_usr_val("#F1.98", totrit);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name == "#EC_RIT")
|
|
|
|
{
|
|
|
|
_ritenuta += var.as_real();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name == "#EC_CHIUDI")
|
|
|
|
{
|
|
|
|
chiudi_mese();
|
|
|
|
return true;
|
|
|
|
}
|
2008-11-26 16:45:42 +00:00
|
|
|
return TDocument_report::set_usr_val(name,var);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TEstrattoConto_rep::chiudi_mese()
|
|
|
|
{
|
|
|
|
const TRecordset * recset = recordset();
|
|
|
|
|
2009-02-14 17:13:09 +00:00
|
|
|
if (_aggiorna)
|
|
|
|
{
|
|
|
|
TRecordset* r = recordset();
|
|
|
|
const TDate datafin = r->get_var("#DATAFIN").as_date();
|
|
|
|
int year = datafin.year();
|
|
|
|
int month = datafin.month();
|
|
|
|
TString key;
|
|
|
|
TTable psc("PSC");
|
|
|
|
|
|
|
|
key.format("%06ld%04d%02d", _socio, year, month);
|
|
|
|
psc.put("CODTAB", key);
|
|
|
|
if (psc.read(_isequal, _lock) != NOERR)
|
|
|
|
{
|
|
|
|
psc.put("CODTAB", key);
|
|
|
|
psc.write();
|
|
|
|
psc.read(_isequal, _lock);
|
|
|
|
}
|
|
|
|
psc.put("R0", _totconf);
|
|
|
|
psc.put("R1", _iva);
|
|
|
|
psc.put("R2", _ritenuta);
|
2010-06-21 13:46:42 +00:00
|
|
|
psc.put("R3", _acconto8);
|
2009-02-14 17:13:09 +00:00
|
|
|
psc.rewrite();
|
|
|
|
|
|
|
|
}
|
|
|
|
if (_genpag)
|
|
|
|
{
|
|
|
|
const TDate datadoc(TODAY);
|
|
|
|
real saldo = _saldocred - _ritenuta - _saldodeb;
|
|
|
|
|
|
|
|
if (saldo > ZERO) // assegno
|
|
|
|
{
|
|
|
|
TRecordset* r = recordset();
|
|
|
|
const TDate datachi = r->get_var("#DATAFIN").as_date();
|
|
|
|
TDocumento doc('D', datachi.year(), _numchi, 0L);
|
|
|
|
|
|
|
|
doc.set_tipo(_tipoass);
|
|
|
|
doc.stato(doc.tipo().stato_finale_inserimento());
|
|
|
|
doc.put(DOC_DATADOC, datachi);
|
|
|
|
doc.put(DOC_TIPOCF, "F");
|
|
|
|
doc.put(DOC_CODCF, _socio);
|
|
|
|
|
|
|
|
TString key;
|
|
|
|
|
|
|
|
key.format("F|%ld", _socio);
|
|
|
|
const TRectype & forn = cache().get(LF_CLIFO, key);
|
|
|
|
const TString & codpag = forn.get(CLI_CODPAG);
|
|
|
|
|
|
|
|
doc.put(DOC_CODPAG, codpag);
|
|
|
|
|
|
|
|
const TString & iban = forn.get(CLI_IBAN);
|
|
|
|
|
|
|
|
doc.put(DOC_IBAN, iban);
|
|
|
|
|
|
|
|
TString8 codabi = forn.get(CLI_CODABI);
|
|
|
|
|
|
|
|
if (codabi == "00000")
|
|
|
|
codabi = "00001";
|
|
|
|
doc.put(DOC_CODABIA, codabi);
|
|
|
|
|
|
|
|
TString8 codcab = forn.get(CLI_CODCAB);
|
|
|
|
|
|
|
|
if (codcab == "00000")
|
|
|
|
codcab = "00001";
|
|
|
|
doc.put(DOC_CODCABA, codcab);
|
|
|
|
|
|
|
|
TSpesa_prest sp(_spass);
|
|
|
|
TRiga_documento & row = doc.new_row(sp.tipo_riga());
|
|
|
|
|
|
|
|
row.put(RDOC_CODART, sp.codice());
|
|
|
|
row.put(RDOC_CHECKED, "X");
|
|
|
|
row.put(RDOC_DESCR,sp.descrizione());
|
|
|
|
row.put(RDOC_UMQTA, sp.um());
|
|
|
|
row.put(RDOC_QTA, UNO);
|
|
|
|
row.put(RDOC_PREZZO, saldo);
|
|
|
|
row.put(RDOC_CODIVA, sp.cod_iva());
|
|
|
|
TLista_documenti in;
|
|
|
|
TLista_documenti out;
|
|
|
|
|
|
|
|
in.add(doc);
|
|
|
|
_el->set_writeable(false);
|
|
|
|
_el->elabora(in, out, datadoc);
|
|
|
|
}
|
|
|
|
}
|
2008-11-26 16:45:42 +00:00
|
|
|
if (_chiusura)
|
|
|
|
{
|
|
|
|
TRecordset* r = recordset();
|
|
|
|
const TDate datachi = r->get_var("#DATAFIN").as_date();
|
|
|
|
|
|
|
|
if (_ritenuta != ZERO) // create ritenute
|
|
|
|
{
|
2009-02-27 16:49:30 +00:00
|
|
|
TDocumento doc('D', datachi.year(), _numrit, 0L);
|
2008-11-26 16:45:42 +00:00
|
|
|
|
|
|
|
doc.set_tipo(_tiporit);
|
|
|
|
doc.stato(doc.tipo().stato_finale_inserimento());
|
|
|
|
doc.put(DOC_DATADOC, datachi);
|
|
|
|
doc.put(DOC_TIPOCF, "F");
|
|
|
|
doc.put(DOC_CODCF, _socio);
|
|
|
|
|
|
|
|
TSpesa_prest sp(_sprit);
|
|
|
|
TRiga_documento & row = doc.new_row(sp.tipo_riga());
|
|
|
|
|
|
|
|
row.put(RDOC_CODART, sp.codice());
|
|
|
|
row.put(RDOC_CHECKED, "X");
|
|
|
|
row.put(RDOC_DESCR,sp.descrizione());
|
|
|
|
row.put(RDOC_UMQTA, sp.um());
|
|
|
|
row.put(RDOC_QTA, UNO);
|
|
|
|
row.put(RDOC_PREZZO, _ritenuta);
|
|
|
|
row.put(RDOC_CODIVA, sp.cod_iva());
|
|
|
|
doc.write();
|
|
|
|
}
|
|
|
|
|
|
|
|
real saldo = _saldocred - _ritenuta - _saldodeb;
|
|
|
|
|
|
|
|
if (saldo > ZERO) // assegno
|
|
|
|
{
|
2009-02-27 16:49:30 +00:00
|
|
|
TDocumento doc('D', datachi.year(), _numass, 0L);
|
2008-11-26 16:45:42 +00:00
|
|
|
|
|
|
|
doc.set_tipo(_tipoass);
|
|
|
|
doc.stato(doc.tipo().stato_finale_inserimento());
|
|
|
|
doc.put(DOC_DATADOC, datachi);
|
|
|
|
doc.put(DOC_TIPOCF, "F");
|
|
|
|
doc.put(DOC_CODCF, _socio);
|
|
|
|
|
2009-02-14 17:13:09 +00:00
|
|
|
TString key;
|
|
|
|
|
|
|
|
key.format("F|%ld", _socio);
|
|
|
|
const TRectype & forn = cache().get(LF_CLIFO, key);
|
|
|
|
const TString & codpag = forn.get(CLI_CODPAG);
|
|
|
|
|
|
|
|
doc.put(DOC_CODPAG, codpag);
|
|
|
|
|
|
|
|
const TString & iban = forn.get(CLI_IBAN);
|
|
|
|
|
|
|
|
doc.put(DOC_IBAN, iban);
|
|
|
|
|
|
|
|
TString8 codabi = forn.get(CLI_CODABI);
|
|
|
|
|
|
|
|
if (codabi == "00000")
|
|
|
|
codabi = "00001";
|
|
|
|
doc.put(DOC_CODABIA, codabi);
|
|
|
|
|
|
|
|
TString8 codcab = forn.get(CLI_CODCAB);
|
|
|
|
|
|
|
|
if (codcab == "00000")
|
|
|
|
codcab = "00001";
|
|
|
|
doc.put(DOC_CODCABA, codcab);
|
|
|
|
|
2008-11-26 16:45:42 +00:00
|
|
|
TSpesa_prest sp(_spass);
|
|
|
|
TRiga_documento & row = doc.new_row(sp.tipo_riga());
|
|
|
|
|
|
|
|
row.put(RDOC_CODART, sp.codice());
|
|
|
|
row.put(RDOC_CHECKED, "X");
|
|
|
|
row.put(RDOC_DESCR,sp.descrizione());
|
|
|
|
row.put(RDOC_UMQTA, sp.um());
|
|
|
|
row.put(RDOC_QTA, UNO);
|
|
|
|
row.put(RDOC_PREZZO, saldo);
|
|
|
|
row.put(RDOC_CODIVA, sp.cod_iva());
|
|
|
|
doc.write();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (saldo < ZERO) // chiusura
|
|
|
|
{
|
|
|
|
TDocumento doc('D', datachi.year(), _numchi, 0L);
|
|
|
|
|
|
|
|
doc.set_tipo(_tipochi);
|
|
|
|
doc.stato(doc.tipo().stato_finale_inserimento());
|
|
|
|
doc.put(DOC_DATADOC, datachi);
|
|
|
|
doc.put(DOC_TIPOCF, "F");
|
|
|
|
doc.put(DOC_CODCF, _socio);
|
|
|
|
|
|
|
|
TSpesa_prest sp(_spchi);
|
|
|
|
TRiga_documento & row = doc.new_row(sp.tipo_riga());
|
|
|
|
|
|
|
|
row.put(RDOC_CODART, sp.codice());
|
|
|
|
row.put(RDOC_CHECKED, "X");
|
|
|
|
row.put(RDOC_DESCR,sp.descrizione());
|
|
|
|
row.put(RDOC_UMQTA, sp.um());
|
|
|
|
row.put(RDOC_QTA, UNO);
|
|
|
|
row.put(RDOC_PREZZO, saldo);
|
|
|
|
row.put(RDOC_CODIVA, sp.cod_iva());
|
|
|
|
doc.write();
|
|
|
|
|
|
|
|
TDate dataap(datachi);
|
|
|
|
|
|
|
|
dataap += 1L;
|
|
|
|
saldo = - saldo;
|
|
|
|
TDocumento docap('D', dataap.year(), _numchi, 0L);
|
|
|
|
|
|
|
|
docap.set_tipo(_tipochi);
|
|
|
|
docap.stato(docap.tipo().stato_finale_inserimento());
|
|
|
|
docap.put(DOC_DATADOC, dataap);
|
|
|
|
docap.put(DOC_TIPOCF, "F");
|
|
|
|
docap.put(DOC_CODCF, _socio);
|
|
|
|
|
|
|
|
sp.read(_spchi);
|
|
|
|
TRiga_documento & rowap = docap.new_row(sp.tipo_riga());
|
|
|
|
|
|
|
|
rowap.put(RDOC_CODART, sp.codice());
|
|
|
|
rowap.put(RDOC_CHECKED, "X");
|
|
|
|
rowap.put(RDOC_DESCR,sp.descrizione());
|
|
|
|
rowap.put(RDOC_UMQTA, sp.um());
|
|
|
|
rowap.put(RDOC_QTA, UNO);
|
|
|
|
rowap.put(RDOC_PREZZO, saldo);
|
|
|
|
rowap.put(RDOC_CODIVA, sp.cod_iva());
|
|
|
|
docap.write();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_socio = 0L,
|
2009-02-14 17:13:09 +00:00
|
|
|
_iva = ZERO;
|
|
|
|
_totconf = ZERO;
|
2008-11-26 16:45:42 +00:00
|
|
|
_saldocred = ZERO;
|
|
|
|
_saldodeb = ZERO;
|
|
|
|
_ritenuta = ZERO;
|
2010-06-21 13:46:42 +00:00
|
|
|
_acconto8 = ZERO;
|
2008-11-14 00:40:30 +00:00
|
|
|
}
|
|
|
|
|
2010-06-21 13:46:42 +00:00
|
|
|
TEstrattoConto_rep::TEstrattoConto_rep(bool genpag, bool chiusura, bool aggiorna) : _genpag(genpag), _chiusura(chiusura), _aggiorna(aggiorna), _saldocred(), _saldodeb(ZERO), _ritenuta(ZERO), _acconto8(ZERO), _iva(ZERO), _totconf(ZERO)
|
2008-11-14 00:40:30 +00:00
|
|
|
{
|
|
|
|
load("co1300a");
|
|
|
|
TReport_section& b11 = section('B',11);
|
|
|
|
TReport_section& f1 = section('F',1);
|
|
|
|
long y = 400;
|
|
|
|
|
|
|
|
for (int i = 1000; i <= 8000; i += 1000)
|
|
|
|
{
|
|
|
|
for (int j = 100; j <= 109; ++j)
|
|
|
|
{
|
|
|
|
if (j == 101 || j == 103 || j == 104)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
TReport_field* rf_b11 = b11.find_field(j);
|
|
|
|
TReport_field* rf_f1 = new TReport_field(*rf_b11);
|
|
|
|
f1.add(rf_f1);
|
|
|
|
const int id = rf_f1->id() + i;
|
|
|
|
rf_f1->set_id(id);
|
|
|
|
rf_f1->set_row(y);
|
|
|
|
rf_f1->set_postscript("");
|
|
|
|
rf_f1->set_prescript("");
|
|
|
|
rf_f1->set_field("");
|
2009-02-14 17:13:09 +00:00
|
|
|
rf_f1->set_groups("1");
|
2008-11-14 00:40:30 +00:00
|
|
|
}
|
|
|
|
y += 100;
|
|
|
|
}
|
|
|
|
|
2008-11-26 10:47:53 +00:00
|
|
|
TConfig c(CONFIG_DITTA);
|
|
|
|
|
2009-02-27 16:49:30 +00:00
|
|
|
_numrit = c.get("NumRit");
|
2008-11-26 10:47:53 +00:00
|
|
|
_tiporit = c.get("TipoRit");
|
|
|
|
_sprit = c.get("SpRitChi");
|
2009-02-27 16:49:30 +00:00
|
|
|
_numchi = c.get("NumChi");
|
2008-11-26 10:47:53 +00:00
|
|
|
_tipochi = c.get("TipoChi");
|
|
|
|
_spchi = c.get("SpChi");
|
2009-02-27 16:49:30 +00:00
|
|
|
_numass = c.get("NumAss");
|
2008-11-26 10:47:53 +00:00
|
|
|
_tipoass = c.get("TipoAss");
|
|
|
|
_spass = c.get("SpAss");
|
2009-02-14 17:13:09 +00:00
|
|
|
_el = new TGenerazione_effetti(c.get("ElAss"));
|
2008-11-26 10:47:53 +00:00
|
|
|
|
|
|
|
}
|
2008-06-11 14:16:07 +00:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////
|
|
|
|
// APPLICAZIONE
|
|
|
|
////////////////////////////////////////////////////////
|
2008-07-29 13:36:43 +00:00
|
|
|
|
2008-06-11 14:16:07 +00:00
|
|
|
class TEstrattoConto : public TSkeleton_application
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void main_loop();
|
|
|
|
};
|
|
|
|
|
|
|
|
void TEstrattoConto::main_loop()
|
|
|
|
{
|
2008-07-29 13:36:43 +00:00
|
|
|
TEstrattoConto_mask m;
|
|
|
|
while (m.run() == K_ENTER)
|
2008-06-11 14:16:07 +00:00
|
|
|
{
|
|
|
|
TReport_book book;
|
2009-02-14 17:13:09 +00:00
|
|
|
bool chiudi = m.get_bool(F_CHIUSURA);
|
|
|
|
bool aggiorna = m.get_bool(F_AGGIORNA);
|
|
|
|
bool genpag = m.get_bool(F_GENPAG);
|
|
|
|
|
|
|
|
if (chiudi)
|
|
|
|
chiudi = yesno_box("Sei sicuro effettuare la chiusura mensile");
|
|
|
|
if (aggiorna)
|
|
|
|
aggiorna = yesno_box("Sei sicuro di voler\naggiornare i progressivi dei soci");
|
|
|
|
if (genpag)
|
|
|
|
genpag = yesno_box("Sei sicuro di voler\ngenerare i pagamenti dei soci");
|
|
|
|
TEstrattoConto_rep rep(genpag, chiudi, aggiorna);
|
2008-07-29 13:36:43 +00:00
|
|
|
|
|
|
|
const TDate dataini = m.get_date(F_DATAINI);
|
|
|
|
const TDate datafin = m.get_date(F_DATAFIN);
|
|
|
|
const int anno = dataini.year();
|
|
|
|
|
|
|
|
// creo recordset dei soci da stampare
|
|
|
|
TISAM_recordset soci("USE SOCICOOP\nFROM CODCF=#DASOCIO\nTO CODCF=#ASOCIO");
|
|
|
|
soci.set_var("#DASOCIO", m.get_long(F_DASOCIO));
|
|
|
|
soci.set_var("#ASOCIO", m.get_long(F_ASOCIO));
|
|
|
|
|
|
|
|
for (bool ok = soci.move_first(); ok; ok = soci.move_next())
|
|
|
|
{
|
2008-11-14 00:40:30 +00:00
|
|
|
TRecordset* r = rep.recordset();
|
2008-07-29 13:36:43 +00:00
|
|
|
long codcf = soci.get(SC_CODCF).as_int();
|
|
|
|
r->set_var("#SOCIO", soci.get("CODCF"));
|
|
|
|
r->set_var("#ANNO", TVariant(long(anno)));
|
|
|
|
r->set_var("#DATAINI", dataini);
|
|
|
|
r->set_var("#DATAFIN", datafin);
|
2008-11-14 00:40:30 +00:00
|
|
|
|
2008-07-29 13:36:43 +00:00
|
|
|
book.add(rep);
|
|
|
|
}
|
2008-06-11 14:16:07 +00:00
|
|
|
book.print_or_preview();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int co1300(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
TEstrattoConto a;
|
|
|
|
a.run(argc, argv, TR("Stampa estratto conto"));
|
|
|
|
return 0;
|
|
|
|
}
|