Files correlati : ve0.exe Ricompilazione Demo : [ ] Commento : Riportata la versione 3.2 patch 1350 git-svn-id: svn://10.65.10.50/trunk@18385 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			574 lines
		
	
	
		
			13 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			574 lines
		
	
	
		
			13 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
#include <applicat.h>
 | 
						|
#include <automask.h>
 | 
						|
#include <form.h>
 | 
						|
#include <report.h>
 | 
						|
#include <reprint.h>
 | 
						|
#include <tabutil.h>
 | 
						|
#include <textset.h>
 | 
						|
 | 
						|
#include "co1.h"
 | 
						|
#include "co1300a.h"
 | 
						|
 | 
						|
#include "socicoop.h"
 | 
						|
 | 
						|
#include "..\ve\velib.h"
 | 
						|
#include "..\ve\velib04.h"
 | 
						|
#include "..\ve\velib07.h"
 | 
						|
 | 
						|
 | 
						|
////////////////////////////////////////////////////////
 | 
						|
//	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)
 | 
						|
{ 
 | 
						|
  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())
 | 
						|
				{
 | 
						|
					enable(F_GENPAG);
 | 
						|
					enable(F_CHIUSURA);
 | 
						|
				}
 | 
						|
				else 
 | 
						|
				{
 | 
						|
					disable(F_CHIUSURA);
 | 
						|
					reset(F_CHIUSURA);
 | 
						|
					disable(F_GENPAG);
 | 
						|
					reset(F_GENPAG);
 | 
						|
				}
 | 
						|
 | 
						|
			}
 | 
						|
			break;
 | 
						|
		default:
 | 
						|
			break;
 | 
						|
	}
 | 
						|
	return true;
 | 
						|
}
 | 
						|
 | 
						|
////////////////////////////////////////////////////////
 | 
						|
//	REPORT
 | 
						|
////////////////////////////////////////////////////////
 | 
						|
 | 
						|
class TEstrattoConto_rep : public TDocument_report
 | 
						|
{
 | 
						|
	TGenerazione_effetti * _el;
 | 
						|
  int         _riga; 
 | 
						|
	long				_socio;
 | 
						|
	real				_iva;
 | 
						|
	real				_totconf;
 | 
						|
	real				_saldocred;
 | 
						|
	real				_saldodeb;
 | 
						|
	real				_ritenuta;
 | 
						|
 | 
						|
	TString8    _numrit;
 | 
						|
	TString8    _tiporit;
 | 
						|
	TString 		_sprit;
 | 
						|
 | 
						|
	TString8    _numchi;
 | 
						|
	TString8    _tipochi;
 | 
						|
	TString     _tipoass;
 | 
						|
	TString8		_numass;
 | 
						|
	TString8		_spchi;
 | 
						|
	TString			_spass;
 | 
						|
	bool				_chiusura;
 | 
						|
	bool				_genpag;
 | 
						|
	bool				_aggiorna;
 | 
						|
 | 
						|
protected:
 | 
						|
	virtual bool use_mask() {return false;}
 | 
						|
  virtual bool set_usr_val(const TString& name, const TVariant& var);
 | 
						|
  bool incr_field(int idx, const TVariant& var);
 | 
						|
	void chiudi_mese() ;
 | 
						|
 | 
						|
public:
 | 
						|
  TEstrattoConto_rep(bool genpag, bool chiusura, bool aggiorna);
 | 
						|
};
 | 
						|
 | 
						|
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;
 | 
						|
    int id;
 | 
						|
    for (id = 1100; ; id += 1000)
 | 
						|
    {
 | 
						|
      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);
 | 
						|
    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")
 | 
						|
  {
 | 
						|
		const real val = var.as_real();
 | 
						|
		_iva -= val;
 | 
						|
    incr_field(9, var);
 | 
						|
    return true;
 | 
						|
  }
 | 
						|
 | 
						|
  if (name == "#EC_SOCIO")
 | 
						|
  {
 | 
						|
		_socio = var.as_int();
 | 
						|
		return true;
 | 
						|
	}
 | 
						|
  if (name == "#EC_NETC")
 | 
						|
  {
 | 
						|
		const real val = var.as_real();
 | 
						|
    _totconf += val;
 | 
						|
		return true;
 | 
						|
	}
 | 
						|
  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;
 | 
						|
	}
 | 
						|
	return TDocument_report::set_usr_val(name,var);
 | 
						|
}
 | 
						|
 | 
						|
void TEstrattoConto_rep::chiudi_mese()
 | 
						|
{
 | 
						|
	const TRecordset  * recset = recordset();
 | 
						|
 | 
						|
	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);
 | 
						|
		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);
 | 
						|
		}
 | 
						|
	}
 | 
						|
	if (_chiusura)
 | 
						|
	{
 | 
						|
		TRecordset* r = recordset();
 | 
						|
		const TDate	datachi = r->get_var("#DATAFIN").as_date();
 | 
						|
		
 | 
						|
		if (_ritenuta != ZERO) // create ritenute
 | 
						|
		{
 | 
						|
			TDocumento doc('D', datachi.year(), _numrit, 0L);
 | 
						|
 | 
						|
			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
 | 
						|
		{
 | 
						|
			TDocumento doc('D', datachi.year(), _numass, 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());
 | 
						|
			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,
 | 
						|
	_iva = ZERO;
 | 
						|
	_totconf = ZERO;
 | 
						|
	_saldocred = ZERO;
 | 
						|
	_saldodeb = ZERO;
 | 
						|
	_ritenuta = ZERO;
 | 
						|
}
 | 
						|
 | 
						|
TEstrattoConto_rep::TEstrattoConto_rep(bool genpag, bool chiusura, bool aggiorna) : _genpag(genpag), _chiusura(chiusura), _aggiorna(aggiorna), _saldocred(), _saldodeb(ZERO),	_ritenuta(ZERO), _iva(ZERO), _totconf(ZERO)
 | 
						|
{
 | 
						|
  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("");
 | 
						|
			rf_f1->set_groups("1");
 | 
						|
    }
 | 
						|
    y += 100;
 | 
						|
  }
 | 
						|
 | 
						|
	TConfig c(CONFIG_DITTA);
 | 
						|
 | 
						|
	_numrit = c.get("NumRit");
 | 
						|
	_tiporit = c.get("TipoRit");
 | 
						|
	_sprit = c.get("SpRitChi");
 | 
						|
	_numchi = c.get("NumChi");
 | 
						|
	_tipochi = c.get("TipoChi");
 | 
						|
	_spchi = c.get("SpChi");
 | 
						|
	_numass = c.get("NumAss");
 | 
						|
	_tipoass = c.get("TipoAss");
 | 
						|
	_spass = c.get("SpAss");
 | 
						|
	_el = new TGenerazione_effetti(c.get("ElAss"));
 | 
						|
 | 
						|
}
 | 
						|
 | 
						|
////////////////////////////////////////////////////////
 | 
						|
//	APPLICAZIONE
 | 
						|
////////////////////////////////////////////////////////
 | 
						|
 | 
						|
class TEstrattoConto : public TSkeleton_application
 | 
						|
{
 | 
						|
public:
 | 
						|
  virtual void main_loop();
 | 
						|
};
 | 
						|
 | 
						|
void TEstrattoConto::main_loop()
 | 
						|
{
 | 
						|
  TEstrattoConto_mask m;
 | 
						|
  while (m.run() == K_ENTER)
 | 
						|
  {
 | 
						|
		TReport_book book;
 | 
						|
		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);
 | 
						|
 | 
						|
		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())
 | 
						|
		{
 | 
						|
	    TRecordset* r = rep.recordset();
 | 
						|
			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);
 | 
						|
      			
 | 
						|
			book.add(rep);
 | 
						|
		}
 | 
						|
		book.print_or_preview();
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
int co1300(int argc, char* argv[])
 | 
						|
{
 | 
						|
  TEstrattoConto a;
 | 
						|
  a.run(argc, argv, TR("Stampa estratto conto"));
 | 
						|
  return 0;
 | 
						|
}
 |