Patch level : 2.0 467

Files correlati     : quelli delle patch AGA
Ricompilazione Demo : [ ]
Commento            :
Riportata la versione AGA 1.7 patch 466


git-svn-id: svn://10.65.10.50/trunk@11085 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2003-05-05 14:32:23 +00:00
parent 5932e4ec62
commit ba8900cf74
57 changed files with 2843 additions and 746 deletions

View File

@ -156,7 +156,6 @@ void TCalcamm::main_loop()
{
TDitta_cespiti& dc = ditta_cespiti();
dc.init_mask(*_mask);
_mask->field(F_SPECIE).check(RUNNING_CHECK);
_mask->recalc_spese();
if (!batch)
k = _mask->run();
@ -180,7 +179,7 @@ void TCalcamm::main_loop()
}
int ce2100(int argc, char* argv[])
{
{
TCalcamm a;
a.run(argc, argv, "Calcolo ammortamenti");
return 0;

View File

@ -1824,7 +1824,7 @@ bool TCespite::calc_amm(int tipo_sit, const TDate& data_limite, bool recalc_spe_
log("* Inizio calcolo situazione %d cespite %s", tipo_sit, (const char*)idcespite);
#ifdef DBG
if (tipo_sit == 1 && atol(idcespite) == 445L)
if (tipo_sit == 1 && atol(idcespite) == 83L)
{
tipo_sit = 1; // Put your breakpoint here
}

View File

@ -132,6 +132,7 @@ void TDitta_cespiti::init_mask(TMask& m)
if (!found[1]) // Non ho ancora trovato l'esercizio
{
f.set(_esercizio);
f.check();
found.set(1, TRUE);
}
} else
@ -140,6 +141,7 @@ void TDitta_cespiti::init_mask(TMask& m)
if (found[4] && !found[5]) // Ho trovato gruppo ma non specie
{
f.set(_specie);
f.check();
found.set(5);
finished = TRUE;
}

View File

@ -3,6 +3,7 @@
#include <mask.h>
#include <mailbox.h>
#include <printapp.h>
#include <recarray.h>
#include <tabutil.h>
#include <utility.h>
@ -47,7 +48,7 @@ class TPrintclifo_app : public TPrintapp
// variable field slots
TString _piva,_cpercip,_fax,_telex,_email,_name,_telefono,_indir,_localita;
TString _cod_from,_cod_to,_data_stampa,_cofi,_d_c_ric,_d_alleg;
TString _datanas,_comprov,_comnasc,_comune,_prov;
TString _datanas,_comprov,_comnasc,_comune,_prov,_descpag;
long _codice;
char _tipocf,_tipoaper;
bool _gia_iniziati_fornitori;
@ -313,6 +314,9 @@ bool TPrintclifo_app::preprocess_page(int file, int counter)
default:
break;
}
_descpag = get_field(LF_CLIFO, CLI_CODPAG);
_descpag = cache().get("%CPG", _descpag, "S0");
}
break;
case LF_INDSP:
@ -344,24 +348,6 @@ default:
print_action TPrintclifo_app::postprocess_print(int file, int counter)
{
/*
static bool more = FALSE;
if (_pr_what == both)
{
if (more)
{
more = FALSE;
select_cursor(ccur());
return NEXT_PAGE;
}
else
{
more = TRUE;
select_cursor(ccur());
return REPEAT_PAGE;
}
}
*/
return NEXT_PAGE;
}
@ -484,6 +470,7 @@ void TPrintclifo_app::header_elenco()
set_header(j, FR("Ditta %ld %s@125gPag @#"), firm, (const char*) s);
set_header(j++, FR("@102gData %s"), (const char*) _data_stampa);
tipocf = current_cursor()->curr(LF_CLIFO).get_char(CLI_TIPOCF);
if (tipocf == 'C')
@ -529,6 +516,7 @@ void TPrintclifo_app::header_elenco()
set_header(j++, FR("@9gLuogo di nascita@45gData@56gPartita IVA Codice fiscale"));
set_header(j++, FR("@9gConto di costo/ricavo@56gCodice allegato@90gPercipiente 770"));
set_header(j, (const char *)(TString(132).fill('-')));
}
void TPrintclifo_app::header_rubriche()
@ -547,6 +535,7 @@ void TPrintclifo_app::header_rubriche()
TString s(ditte.get(NDT_RAGSOC));
set_header(j, FR("Ditta %ld %s@125gPag @#"), firm, (const char*) s);
set_header(j++, FR("@102gData %s"), (const char*) _data_stampa);
tipocf = current_cursor()->curr(LF_CLIFO).get_char(CLI_TIPOCF);
if (tipocf == 'C')
@ -588,8 +577,10 @@ void TPrintclifo_app::header_rubriche()
set_header(j++, FR(" Codice Ragione sociale@60gIndirizzo@100gC.A.P.@106gLocalita'@127gProv."));
set_header(j++, FR("@9gPartita iva@25gTelefoni"));
set_header(j++, (const char *)(TString(132).fill('-')));
}
void TPrintclifo_app::set_elenco()
{
set_row(1,"$[b]@1s$[n] $[b]@pn$[n] #t", FLD(LF_CLIFO, CLI_TIPOCF),
@ -601,9 +592,10 @@ void TPrintclifo_app::set_elenco()
set_row(6,"@9g@3n @3n @6n #t@56g@t #t@90g#t",FLD(LF_CLIFO,CLI_GRUPPORIC),
FLD(LF_CLIFO,CLI_CONTORIC), FLD(LF_CLIFO, CLI_SOTTOCRIC),&_d_c_ric,
FLD(LF_CLIFO, CLI_CODALLEG), &_d_alleg, &_cpercip);
set_row(7,"@9g@s@15g#t",FLD(LF_CLIFO, CLI_CODPAG),&_descpag);
for(int i = 0; i < _interline; i++)
set_row(i+6,"");
set_row(i+7,"");
}
void TPrintclifo_app::set_rubriche()
@ -611,8 +603,6 @@ void TPrintclifo_app::set_rubriche()
// body
set_row(1,"$[b]@1s$[n] $[b]@pn$[n] #t", FLD(LF_CLIFO,CLI_TIPOCF),
FLD(LF_CLIFO,CLI_CODCF,"@@@@@@"), &_name);
//set_row(1,"@60g#t@100g@s@106g#t@127g@s", &_indir, FLD(LF_CLIFO, CLI_CAPCF),
// &_localita, FLD(-COMRF_ALIAS,COM_PROVCOM));
set_row(1,"@60g#t@100g@s@106g#t@127g#t", &_indir, FLD(LF_CLIFO, CLI_CAPCF), &_comune, &_prov);
set_row(2,"@9g#t@25g#t", &_piva,&_telefono);
@ -694,6 +684,7 @@ void TPrintclifo_app::set_vendite(int f, int c)
set_header(11,FR("@9gRaggr. ordini @25gImporto Minimo @46gImporto Massimo @63gPriorita ev. @76gTipo Evasione"));
set_header(12, (const char *)(TString(132).fill('-')));
set_row(1,"$[b]@1s$[n] $[b]@pn$[n] #t", FLD(LF_CLIFO, CLI_TIPOCF),
FLD(LF_CLIFO, CLI_CODCF,"@@@@@@"), &_name);
@ -980,4 +971,4 @@ int cg1200(int argc, char* argv[])
TPrintclifo_app app;
app.run(argc, argv, TR("Stampa Clienti/Fornitori"));
return 0;
}
}

View File

@ -154,7 +154,6 @@ class TStampa_IVdirettiva : public TPrintapp
bil_ivd* _bil;
TMask* _msk;
TTable* _tabivd;
TLocalisamfile* _nditte;
TLocalisamfile* _comuni;
TLocalisamfile* _unloc;
@ -170,7 +169,6 @@ class TStampa_IVdirettiva : public TPrintapp
TProgind* _prog, *_prog_stampa;
TParagraph_string* _descr,*_d;
TSaldo* _sld;
TPrtype _stampa;
bool _noseparator;
TDate _data_fine_ese,_data_fine_ese_prec,_data_fine_raf,_data_fine_raf_prec;
@ -248,8 +246,8 @@ public:
void crea_sort_tabella();
void crea_sort_piano_conti_scalare();
void crea_sort_piano_conti_verifica();
void setta_righe_descr(TParagraph_string*,const TString&,const TString&);
void setta_righe_descr_verifica(TParagraph_string*,const TString&,const TString&);
void setta_righe_descr(TParagraph_string*,const char*,const char*);
void setta_righe_descr_verifica(TParagraph_string*,const char*,const char*);
void scrivi_record(const TString&,const TString&,const TString&,int,int,int,long,const real&,const real&,const real&,const real&,const real&,const real&,char,bool conto_dettagliato = TRUE);
void riempi_record(const TString&,const TString&,const TString&,int,int,int,long,const real&,const real&,const real&,const real&,const real&,const real&,char,bool conto_dettagliato = TRUE);
const char* descrizione_sezione(char);
@ -259,8 +257,9 @@ public:
const char* descrizione_sottoconto(int, int, long);
const char* descr_sottoc_clifo(char,long);
void setta_righe(const char*);
void setta_righe_verifica();
void stampa_risultato_prima_delle_imposte(bool raff = FALSE);
void setta_righe_verifica();
bool devo_stampare_risultato_prima_delle_imposte() const;
void stampa_risultato_prima_delle_imposte();
void stampa_totali();
void stampa_totali_con_raffronto();
void stampa_totali_verifica();
@ -2041,6 +2040,7 @@ bool TStampa_IVdirettiva::set_print(int)
_tipo_stampa = _msk->get_int(F_TIPOSTAMPA1);
_prog = new TProgind(_pconti->items(),TR("Elaborazione in corso... prego attendere"),FALSE);
if (_tipo_stampa == 2)
{
_anno_esercizio = _annoese;
@ -2129,23 +2129,37 @@ bool TStampa_IVdirettiva::set_print(int)
crea_intestazione();
delete _bil;
delete _prog;
delete _prog; _prog = NULL;
return TRUE;
}
return FALSE;
}
void TStampa_IVdirettiva::stampa_risultato_prima_delle_imposte(bool raff)
// Lo so, fa schifo: ma mi sono adeguato (Guy)
bool TStampa_IVdirettiva::devo_stampare_risultato_prima_delle_imposte() const
{
if (!_risimp_fatto)
return FALSE;
if (_sez_da_stamp != '9')
return FALSE;
if (_let_da_stamp != 'E')
return FALSE;
if (atoi(_num_da_stamp) <= 21)
return FALSE;
return TRUE;
}
void TStampa_IVdirettiva::stampa_risultato_prima_delle_imposte()
{
if (_risimp_fatto) // Ottimo flag che significa esattamente l'opposto! Grazie PRASSI!
{
if (_let_stamp != 'E') // Forse questo non ci va
{
const char* descr_lett = descrizione_lettera('9', 'E');
set_row (_i++, "@0gE) %s", descr_lett);
}
if (_let_da_stamp == 'E' && atoi(_num_da_stamp) > 21 &&
{
const bool raff = _annoeserafr > 0 || _databilrafr.ok();
if (_let_da_stamp == 'E' && atoi(_num_da_stamp) > 21 && // questa prima parte e' sempre TRUE!
!_totale_parziale.is_zero() && !_totale_parziale_raf.is_zero())
{
set_row (_i,FR("@4gTotale delle partite straordinarie"));
@ -2168,7 +2182,6 @@ void TStampa_IVdirettiva::stampa_totali()
{
bool gia_stampato_conto_ord = FALSE;
const char* diff_prod = "9B";
const char* ris_imp = "9E 21" ;
TString16 classe;
classe.format("%c%c%8s%2s", _sez_da_stamp,_let_da_stamp,(const char*)_numr_da_stamp,(const char*)_num_da_stamp);
@ -2203,13 +2216,15 @@ void TStampa_IVdirettiva::stampa_totali()
}
}
}
/* Killed
if (_sez_stamp == '9') // Conto economico
{
{
const char* ris_imp = "9E 21" ;
if (classe > ris_imp && _risimp_fatto) // Classe > 9E________21
stampa_risultato_prima_delle_imposte();
}
}
*/
_cont_gcs = 0;
_totale_numero = 0;
}
@ -2271,6 +2286,7 @@ void TStampa_IVdirettiva::stampa_totali()
{
TString numrom = itor(numeror);
set_row (_i,FR("@14gTotale@21g%s"), (const char*) numrom);
set_row (_i++,"@81g%r", &_totale_numr);
}
}
@ -2568,8 +2584,10 @@ void TStampa_IVdirettiva::stampa_totali()
set_row (_i++,FR("@4gDifferenza tra valore e costi della produzione@81g%r"), &_totale_economico);
_diffprod_fatto = FALSE;
}
/* Killed
if (_risimp_fatto)
stampa_risultato_prima_delle_imposte();
*/
}
char app = ' ';
@ -2595,7 +2613,6 @@ void TStampa_IVdirettiva::stampa_totali_con_raffronto()
{
bool gia_stampato_conto_ord = FALSE;
const char* const diff_prod = "9B";
const char* const ris_imp = "9E 21";
TString16 classe;
classe.format("%c%c%8s%2s", _sez_da_stamp,_let_da_stamp,(const char*)_numr_da_stamp,(const char*)_num_da_stamp);
@ -2630,12 +2647,15 @@ void TStampa_IVdirettiva::stampa_totali_con_raffronto()
}
}
}
/* Killed
if (_sez_stamp == '9')
{
if (classe > ris_imp && _risimp_fatto)
stampa_risultato_prima_delle_imposte(TRUE);
}
*/
_cont_gcs = 0;
_totale_numero = 0;
@ -3060,7 +3080,8 @@ void TStampa_IVdirettiva::stampa_totali_con_raffronto()
set_row (_i++,FR("@4gDifferenza tra valore e costi della produzione@81g%r@111g%r"), &_totale_economico,&_totale_economico_raf);
_diffprod_fatto = FALSE;
}
stampa_risultato_prima_delle_imposte(TRUE);
// killed stampa_risultato_prima_delle_imposte(TRUE);
}
char app = ' ';
set_row (_i++,"@0g%c", app);
@ -3512,7 +3533,7 @@ print_action TStampa_IVdirettiva::postprocess_page(int file, int counter)
print_action TStampa_IVdirettiva::postprocess_print(int file, int counter)
{
if (_stampa != screenvis)
if (_prog_stampa != NULL)
{
delete _prog_stampa;
_prog_stampa = NULL;
@ -3525,13 +3546,14 @@ bool TStampa_IVdirettiva::preprocess_print(int file,int counter)
_stampa = printer().printtype();
if (_stampa != screenvis)
_prog_stampa = new TProgind(_items_sort,TR("Preparazione stampa... prego attendere"),FALSE);
return TRUE;
}
bool TStampa_IVdirettiva::preprocess_page(int file, int counter)
{
if (_stampa != screenvis)
if (_prog_stampa != NULL)
_prog_stampa->addstatus(1);
bool ok = FALSE;
@ -3588,7 +3610,7 @@ bool TStampa_IVdirettiva::preprocess_stampa_scalare(int counter)
}
else
{
_classe_stampata.format("%1c%1c%8s%2d",bil->sez,bil->let,(const char*)bil->numr,bil->num);
_classe_stampata.format("%c%c%8s%2s",bil->sez,bil->let,bil->numr,bil->num);
_sez_stamp = bil->sez;
_let_stamp = bil->let;
_numr_stamp = bil->numr;
@ -3620,7 +3642,7 @@ bool TStampa_IVdirettiva::preprocess_stampa_scalare(int counter)
if (_buff != NULL)
{
bil = (struct bil_ivd*) _buff;
_classe_da_stampare.format("%1c%1c%8s%2d",bil->sez,bil->let,(const char*) bil->numr,bil->num);
_classe_da_stampare.format("%c%c%8s%2s",bil->sez,bil->let,bil->numr,bil->num);
_sez_da_stamp = bil->sez;
_let_da_stamp = bil->let;
_numr_da_stamp = bil->numr;
@ -3808,7 +3830,7 @@ bool TStampa_IVdirettiva::preprocess_stampa_verifica(int counter)
}
else
{
_classe_stampata = format ("%1c%1c%8s%2d",bil->sez,bil->let,(const char*) bil->numr,bil->num);
_classe_stampata = format ("%c%c%8s%2s",bil->sez,bil->let,bil->numr,bil->num);
_sez_stamp = bil->sez;
_let_stamp = bil->let;
_numr_stamp = bil->numr;
@ -3861,7 +3883,7 @@ bool TStampa_IVdirettiva::preprocess_stampa_verifica(int counter)
if (_buff != NULL)
{
bil = (struct bil_ivd*) _buff;
_classe_da_stampare = format ("%1c%1c%8s%2d",bil->sez,bil->let,(const char*) bil->numr,bil->num);
_classe_da_stampare = format ("%c%c%8s%2s",bil->sez,bil->let,bil->numr,bil->num);
_sez_da_stamp = bil->sez;
_let_da_stamp = bil->let;
_numr_da_stamp = bil->numr;
@ -4048,11 +4070,12 @@ bool TStampa_IVdirettiva::preprocess_stampa_verifica(int counter)
void TStampa_IVdirettiva::set_page(int file, int counter)
{
if (_tipo_bilancio == 1)
if (_tipo_bilancio == 1) // Bilancio scalare
{
if (_sez_da_stamp != _sez_stamp)
{
if ((_sez_da_stamp=='1')||((_sez_da_stamp=='2')&&(_statopatr_no_stamp)))
// Controllo se devo stampare STATO PATRIMONIALE
if (_statopatr_no_stamp && (_sez_da_stamp=='1')||((_sez_da_stamp=='2')))
{
setta_righe (TR("STATO PATRIMONIALE"));
_statopatr_no_stamp = FALSE;
@ -4084,12 +4107,12 @@ void TStampa_IVdirettiva::setta_righe(const char * titolo)
TString numrom,numr;
TString descr_let,descr_numr,descr_num,descr_sottoc,descr_classe;
bool stampa_classe = TRUE;
TString lettera1 = "@1g)@3g%s";
TString lettera2 = "@3g%s";
TString numr1 = "@12g-@14g%s";
TString numr2 = "@14g%s";
TString num = "@15g)@18g%s";
TString num2 = "@18g%s";
const char* lettera1 = "@1g)@3g%s";
const char* lettera2 = "@3g%s";
const char* numr1 = "@12g-@14g%s";
const char* numr2 = "@14g%s";
const char* num = "@15g)@18g%s";
const char* num2 = "@18g%s";
_descr->set_width(40);
sezione = bil->sez;
@ -4109,47 +4132,36 @@ void TStampa_IVdirettiva::setta_righe(const char * titolo)
//Se la classe prelevata dal record corrente del sort e' diversa dalla classe
//prelevata dal record precedente, allora stampo la nuova classe con i relativi
//sottoconti. In caso contrario continuo a stampare solo i sottoconti.
if (_sez_da_stamp != _sez_stamp)
if (_sez_da_stamp != _sez_stamp) // Cambio sezione
{
set_row (_i++,"@0g%s", titolo);
char app = ' ';
set_row(_i++,"@0g%c", app);
if ((_sez_da_stamp == '1')&&(_let_da_stamp == 'Z'))
set_row (_i++, "@0g%s", titolo);
set_row(_i++,"@0g ");
if (_sez_da_stamp == '1')
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i++,TR("CONTI D'ORDINE ATTIVI"));
set_row (_i++,"@0g%c", app);
set_row (_i++,FR("@0gCONTI D'ORDINE ATTIVI"));
stampa_classe = FALSE;
}
else
if ((_sez_da_stamp == '1')&&(_let_da_stamp != 'Z'))
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i++,TR("ATTIVO"));
set_row (_i++,"@0g%c", app);
set_row (_i++,FR("@0gATTIVO"));
}
if ((_sez_da_stamp == '2')&&(_let_da_stamp == 'Z'))
if (_sez_da_stamp == '2')
{
char app = ' ';
set_row(_i++,"@0g%c", app);
set_row (_i++,TR("CONTI D'ORDINE PASSIVI"));
set_row(_i++,"@0g%c", app);
stampa_classe = FALSE;
}
else
if ((_sez_da_stamp == '2')&&(_let_da_stamp != 'Z'))
set_row(_i++,"@0g ");
if ((_let_da_stamp == 'Z'))
{
char app = ' ';
set_row(_i++,"@0g%c", app);
set_row (_i++,TR("PASSIVO"));
set_row(_i++,"@0g%c", app);
}
set_row (_i++,FR("@0gCONTI D'ORDINE PASSIVI"));
stampa_classe = FALSE;
else
set_row (_i++,FR("@0gPASSIVO"));
if (stampa_classe)
{
if ((_sez_da_stamp=='1')||(_sez_da_stamp=='2')||(_sez_da_stamp== '9'))
@ -4175,6 +4187,9 @@ void TStampa_IVdirettiva::setta_righe(const char * titolo)
}
if (numero != 0)
{
if (devo_stampare_risultato_prima_delle_imposte())
stampa_risultato_prima_delle_imposte();
set_row(_i,"@13g%s", bil->num);
*_descr = (const char*) descr_num;
setta_righe_descr(_descr,num,num2);
@ -4187,34 +4202,28 @@ void TStampa_IVdirettiva::setta_righe(const char * titolo)
{
if ((_sez_da_stamp == '1')&&(_let_da_stamp == 'Z'))
{
char app = ' ';
set_row (_i++,"@0g%c", app);
set_row (_i++,TR("CONTI D'ORDINE ATTIVI"));
set_row (_i++,"@0g%c", app);
set_row (_i++,"@0g ");
set_row (_i++,FR("@0gCONTI D'ORDINE ATTIVI"));
set_row (_i++,"@0g ");
stampa_classe = FALSE;
}
if ((_sez_da_stamp == '2')&&(_let_da_stamp == 'Z'))
{
char app = ' ';
set_row(_i++,"@0g%c", app);
set_row (_i++,TR("CONTI D'ORDINE PASSIVI"));
set_row(_i++,"@0g%c", app);
set_row(_i++,"@0g ");
set_row (_i++,FR("@0gCONTI D'ORDINE PASSIVI"));
set_row(_i++,"@0g ");
stampa_classe = FALSE;
}
if (stampa_classe)
{
if ((_sez_da_stamp=='1')||(_sez_da_stamp=='2')||(_sez_da_stamp=='9'))
{
if (_sez_da_stamp=='9' && bil->let=='E' && !_risimp_fatto)
{
// Non stampare E) ... se gia` stampato da totale prima delle imposte
}
else
{
set_row(_i,"@0g%c", bil->let);
*_descr = (const char*) descr_let;
setta_righe_descr(_descr,lettera1,lettera2);
}
set_row(_i,"@0g%c", bil->let);
*_descr = (const char*) descr_let;
setta_righe_descr(_descr,lettera1,lettera2);
if (!_intera_struttura || (_intera_struttura && bil->gruppo[0] != 'Z'))
{
_cont_numr = 1;
@ -4230,6 +4239,8 @@ void TStampa_IVdirettiva::setta_righe(const char * titolo)
}
if (numero != 0)
{
if (devo_stampare_risultato_prima_delle_imposte())
stampa_risultato_prima_delle_imposte();
set_row(_i,"@13g%s", bil->num);
*_descr = (const char*) descr_num;
setta_righe_descr(_descr,num,num2);
@ -4253,6 +4264,8 @@ void TStampa_IVdirettiva::setta_righe(const char * titolo)
if (numero != 0)
{
if (devo_stampare_risultato_prima_delle_imposte())
stampa_risultato_prima_delle_imposte();
set_row(_i,"@13g%s", bil->num);
*_descr = (const char*) descr_num;
setta_righe_descr(_descr,num,num2);
@ -4264,6 +4277,8 @@ void TStampa_IVdirettiva::setta_righe(const char * titolo)
{
if ((_sez_da_stamp=='1')||(_sez_da_stamp=='2')||(_sez_da_stamp=='9'))
{
if (devo_stampare_risultato_prima_delle_imposte())
stampa_risultato_prima_delle_imposte();
set_row(_i,"@13g%s", bil->num);
*_descr = (const char*) descr_num;
setta_righe_descr(_descr,num,num2);
@ -4326,12 +4341,12 @@ void TStampa_IVdirettiva::setta_righe_verifica()
long sottoc;
TString numrom,numr;
TString descr_let,descr_numr,descr_num,descr_sottoc,descr_classe;
TString lettera1 = "@1g)@3g%s";
TString lettera2 = "@3g%s";
TString numr1 = "@8g)@10g%s";
TString numr2 = "@10g%s";
TString num = "@2g)@4g%s";
TString num2 = "@4g%s";
const char* lettera1 = "@1g)@3g%s";
const char* lettera2 = "@3g%s";
const char* numr1 = "@8g)@10g%s";
const char* numr2 = "@10g%s";
const char* num = "@2g)@4g%s";
const char* num2 = "@4g%s";
_descr->set_width(35);
@ -4618,24 +4633,20 @@ void TStampa_IVdirettiva::setta_righe_verifica()
}
}
void TStampa_IVdirettiva::setta_righe_descr(TParagraph_string* str,const TString& formato,const TString& formato2)
void TStampa_IVdirettiva::setta_righe_descr(TParagraph_string* str,const char* formato,const char* formato2)
{
const char* r;
int i = 1;
while ((r = str->get()) != NULL)
for (int i = 1; (r = str->get()) != NULL; i++)
{
if (i == 1)
set_row (_i,formato, r);
else
if (i > 1)
set_row (_i,formato2,r);
set_row (_i,formato2,r);
_i++;
i++;
}
}
void TStampa_IVdirettiva::setta_righe_descr_verifica(TParagraph_string* str,const TString& formato,const TString& formato2)
void TStampa_IVdirettiva::setta_righe_descr_verifica(TParagraph_string* str,const char* formato,const char* formato2)
{
const char* r;
int i = 1;
@ -4655,108 +4666,45 @@ void TStampa_IVdirettiva::setta_righe_descr_verifica(TParagraph_string* str,cons
const char* TStampa_IVdirettiva::descrizione_sezione(char sezione)
{
TTable tabivd(TAB_IVD);
TString dep, dep2;
tabivd.zero();
dep = format("%1c", sezione);
tabivd.put("CODTAB", dep);
tabivd.read();
dep2 = tabivd.get("CODTAB");
if (dep == dep2)
tmp = tabivd.get("S0");
else
tmp = "";
const char sez[2] = { sezione, '\0' };
tmp = cache().get(TAB_IVD, sez, "S0");
return tmp;
}
const char* TStampa_IVdirettiva::descrizione_lettera(char sezione, char lettera)
{
TTable tabivd(TAB_IVD);
TString dep, dep2;
tabivd.zero();
dep = format("%1c%1c", sezione, lettera);
tabivd.put("CODTAB", dep);
tabivd.read();
dep2 = tabivd.get("CODTAB");
if (dep == dep2)
tmp = tabivd.get("S0");
else
tmp = "";
const char let[3] = { sezione, lettera, '\0' };
tmp = cache().get(TAB_IVD, let, "S0");
return tmp;
}
const char* TStampa_IVdirettiva::descrizione_numeroromano(char sezione, char lettera, int numr)
{
TTable tabivd(TAB_IVD);
TString80 dep, dep2;
tabivd.zero();
if (numr != 0)
dep.format("%1c%1c%04d", sezione, lettera, numr);
else
dep.format("%c%c ", sezione, lettera);
tabivd.put("CODTAB", dep);
tabivd.read();
dep2 = tabivd.get("CODTAB");
if (dep == dep2)
tmp = tabivd.get("S0");
else
tmp = "";
TString8 cod; cod.format("%c%c%04d", sezione, lettera, numr);
tmp = cache().get(TAB_IVD, cod, "S0");
return tmp;
}
const char* TStampa_IVdirettiva::descrizione_numero(char sezione, char lettera, int numr, int numero)
{
TTable tabivd(TAB_IVD);
TString80 dep,dep2;
tabivd.zero();
if (numr != 0)
dep.format("%1c%1c%04d%02d",sezione, lettera, numr, numero);
else
dep.format("%c%c %02d",sezione,lettera,numero);
tabivd.put("CODTAB", dep);
tabivd.read();
dep2 = tabivd.get("CODTAB");
if (dep == dep2)
tmp = tabivd.get("S0");
else
tmp = "";
TString8 cod; cod.format("%c%c%04d%02d", sezione, lettera, numr, numero);
tmp = cache().get(TAB_IVD, cod, "S0");
return tmp;
}
const char* TStampa_IVdirettiva::descrizione_sottoconto(int gruppo, int conto, long sottoc)
{
TLocalisamfile pconti (LF_PCON);
pconti.zero();
pconti.put(PCN_GRUPPO , gruppo);
if (conto != 0)
pconti.put(PCN_CONTO , conto );
if (sottoc != 0)
pconti.put(PCN_SOTTOCONTO, sottoc);
pconti.read();
if (pconti.bad())
pconti.zero();
tmp = pconti.get(PCN_DESCR);
// Cache non strettamente necessaria in quanto i conti vengono letti solo una volta
TString16 cod; cod.format("%d|%d|%ld", gruppo, conto, sottoc);
tmp = cache().get(LF_PCON, cod, PCN_DESCR);
return tmp;
}
const char* TStampa_IVdirettiva::descr_sottoc_clifo(char tipocf,long s)
{
TLocalisamfile clifo (LF_CLIFO);
clifo.zero();
clifo.put(CLI_TIPOCF,tipocf);
if (s != 0)
clifo.put(CLI_CODCF, s);
clifo.read();
if (clifo.bad())
clifo.zero();
tmp = clifo.get(CLI_RAGSOC);
// Cache non strettamente necessaria in quanto i clifo vengono letti solo una volta
TString16 cod; cod.format("%c|%ld", tipocf, s);
tmp = cache().get(LF_CLIFO, cod, CLI_RAGSOC);
return tmp;
}
@ -4932,29 +4880,23 @@ void TStampa_IVdirettiva::intesta_scalare()
void TStampa_IVdirettiva::intesta_verifica()
{
TString sep(132),sep1(147);
set_header (3,TR("@0gBILANCIO DI VERIFICA IV DIRETTIVA"));
set_header (3,TR("BILANCIO DI VERIFICA IV DIRETTIVA"));
if (_tipo_stampa == 1)
{
TString datainistr = _dataini.string();
TString datafinestr = _datafine.string();
set_header (3,FR("@43gdalla data@54g%s alla data %s"),
(const char*)datainistr, (const char*) datafinestr);
}
else if (_tipo_stampa == 2)
set_header (3,FR("@42gall'ultima immissione"));
if (_stampa_modulo)
{
sep1.fill('-'); //Stampa 132 - (sep(132))
set_header (4, (const char *) sep1);
}
else
{
sep.fill('-'); //Stampa 132 - (sep(132))
set_header (4, (const char *) sep);
}
TString sep;
sep.fill('-', _stampa_modulo ? 147 : 132);
set_header (4, sep);
intesta_verifica_fissa();
}
@ -4975,6 +4917,8 @@ void TStampa_IVdirettiva::init_sort()
bool TStampa_IVdirettiva::user_create()
{
open_files(LF_TAB, 0);
_nditte = new TLocalisamfile (LF_NDITTE);
_comuni = new TLocalisamfile (LF_COMUNI);
_unloc = new TLocalisamfile (LF_UNLOC);
@ -4985,7 +4929,6 @@ bool TStampa_IVdirettiva::user_create()
_caus = new TLocalisamfile (LF_CAUSALI);
_descr = new TParagraph_string("",40);
_d = new TParagraph_string("",33);
_tabivd = new TTable (TAB_IVD);
_sld = new TSaldo();
@ -5008,7 +4951,6 @@ bool TStampa_IVdirettiva::user_destroy()
{
delete _msk;
delete _tabivd;
delete _nditte;
delete _comuni;
delete _unloc;
@ -5026,11 +4968,10 @@ bool TStampa_IVdirettiva::user_destroy()
int cg1600 (int argc, char* argv[])
{
TStampa_IVdirettiva a;
a.run(argc, argv, TR("Stampa Bilancio IV direttiva CEE"));
return 0;
}

View File

@ -163,7 +163,7 @@ TMask* TPrimanota_application::load_mask(int n)
cgm.set_handler(CG_TIPO, cg_tipo_handler);
cgm.set_handler(CG_GRUPPO, cg_gruppo_handler);
cgm.set_handler(CG_CONTO, cg_conto_handler);
cgm.set_handler(CG_SOTTOCONTO, suspended_handler);
cgm.set_handler(CG_SOTTOCONTO, cg_sottoconto_handler);
cgm.set_handler(CG_SOTTOCONTO + 100, sheet_clifo_handler);
cgm.set_handler(CG_SOTTOCONTO + 200, sheet_clifo_handler);

View File

@ -17,13 +17,13 @@ BEGIN
DISPLAY "%@6" R0
DISPLAY "Tipo" S1
OUTPUT 102 CODTAB
OUTPUT 211 S0
OUTPUT 158 S0
CHECKTYPE NORMAL
WARNING "Codice IVA assente"
VALIDATE ZEROFILL_FUNC 2
END
STRING 211 58
STRING 158 58
BEGIN
PROMPT 16 2 ""
FLAGS "D"

View File

@ -939,7 +939,8 @@ void TMastrini_application::fai_stampa198()
if (_stampa_des_contro)
{
if (_sottocontocontr > 0)
{
{
conto(_gruppocontr,_contocontr,FALSE);
TBill tc (_gruppocontr,_contocontr,_sottocontocontr,_tipo_contr);
_descrcontr.cut(0);
_descrcontr << _g_contr << ' ' << _c_contr << ' ' << _s_contr << ' ' << tc.descrizione();
@ -2671,6 +2672,7 @@ void TMastrini_application::conto(int gruppo, int conto, bool no_contropartita)
const TRectype & pconti = cache().get(LF_PCON, key);
if (no_contropartita)
{
_indbil = pconti.get_int(PCN_INDBIL);

View File

@ -789,7 +789,6 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
TString8 tipoiva = _iva->get("S1");
TString8 tipoes_v = _iva->get("S2");
TString8 tipoes_a = _iva->get("S9");
TString8 iva_vpn = _iva->get(tipomov == vendita ? "S10" : "S11");
int tipoagr = atoi(_iva->get("S4"));
int tipoag = atoi(_iva->get("S5"));
int tipopla = atoi(_iva->get("S3"));
@ -829,44 +828,61 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
if (_is_interactive && month == 13)
iva11_set_arr_phase_1(trueatt);
// Cumula l'ammontare delle operazioni attive/passive
// per la dichiarazione periodica
if (iva_vpn.not_empty() && !fattrit)
// per la dichiarazione annuale fati iva
if (month == 13 && !fattrit)
{
switch (tipomov)
const TString& iva_vpn = _iva->get(tipomov == vendita ? "S10" : "S11");
if (iva_vpn.not_empty())
{
case vendita: // CD1 - 1 2 3 4
if (!corrisp && tipodoc != "AF" && (cau_intra || !cau_valintra) &&
sosp_imp != normale && sosp_imp != liquidazione)
{
cessioni_cd1_1 += imponibile;
if (iva_vpn == "CD12")
cessioni_cd1_2 += imponibile;
if (iva_vpn == "CD13")
cessioni_cd1_3 += imponibile;
if (cau_valintra && iva_vpn == "CD14")
cessioni_cd1_4 += imponibile;
}
break;
case acquisto: // CD2 - 1 2 3 4
acquisti_cd2_1 += imponibile;
if (iva_vpn == "CD22")
acquisti_cd2_2 += imponibile;
if (iva_vpn == "CD23")
acquisti_cd2_3 += imponibile;
if (cau_intra && iva_vpn == "CD24")
acquisti_cd2_4 += imponibile;
if (iva_vpn == "CD3")
{
oroargento_cd3_1 += imponibile;
oroargento_cd3_2 += imposta;
}
break;
default:
break;
switch (tipomov)
{
case vendita: // CD1 - 1 2 3 4
if (!corrisp && tipodoc != "AF" && (cau_intra || !cau_valintra) &&
sosp_imp != normale && sosp_imp != liquidazione)
{
cessioni_cd1_1 += imponibile;
if (!cau_intra)
{
if (iva_vpn == "CD12")
cessioni_cd1_2 += imponibile; else
if (iva_vpn == "CD13")
cessioni_cd1_3 += imponibile;
}
else
{
if (iva_vpn == "CD14")
cessioni_cd1_4 += imponibile;
}
}
break;
case acquisto: // CD2 - 1 2 3 4
acquisti_cd2_1 += imponibile;
if (!cau_intra)
{
if (iva_vpn == "CD22")
acquisti_cd2_2 += imponibile; else
if (iva_vpn == "CD23")
acquisti_cd2_3 += imponibile;
}
else
{
if (iva_vpn == "CD24")
acquisti_cd2_4 += imponibile;
}
if (iva_vpn == "CD3")
{
oroargento_cd3_1 += imponibile;
oroargento_cd3_2 += imposta;
}
break;
default:
break;
}
}
}
}
if (noninc) // non incassati: non devono entrare in nessun altro calcolo
{
nin_imp = imponibile;

View File

@ -98,7 +98,7 @@ void TLiquidazione_app::recalc_corrispettivi(int month, const char* codatt)
_pam->put("R1", vaf);
_pam->rewrite();
// Aggiorna il totale IVA periodica CD1_1
if (look_iva(ci->_codiva))
if (month == 13 && look_iva(ci->_codiva))
{
if (_iva->get("S10").not_empty()) // Solo CD1_1 ha senso coi corrispettivi...
{
@ -339,7 +339,7 @@ void TLiquidazione_app::recalc_ventilation(int month, const char* codatt)
_pam->rewrite();
// Aggiorna il totale IVA periodica CD1_1
if (look_iva(vv->_codiva))
if (month == 13 && look_iva(vv->_codiva))
{
if (_iva->get("S10").not_empty()) // Solo CD1_1 ha senso coi corrispettivi
{

View File

@ -274,9 +274,11 @@ TDich_periodica_iva_mask::TDich_periodica_iva_mask(TDich_periodica_selfirm_mask
void TDich_periodica_iva_mask::read_iva_data()
{
TString16 key;
key.format("%4d13", _sf->get_year());
const TRectype & lim = cache().get("LIM", key);
@ -304,6 +306,7 @@ void TDich_periodica_iva_mask::read_iva_data()
TRectype & pum = relpum.curr();
key.format("%04d",_sf->get_year());
pum.put("CODTAB", key);
TCursor cur(&relpum, "", 1, &pum, &pum);
const TRecnotype items = cur.items();
@ -313,6 +316,9 @@ void TDich_periodica_iva_mask::read_iva_data()
{
const TString & codtab = pum.get("CODTAB");
const TString& annoiva = codtab.left(4);
if (annoiva != key)
break;
if (atoi(codtab.right(2)) == 13) // Solo annuale
{
cd1_1 += pum.get_real("R14");
@ -326,18 +332,26 @@ void TDich_periodica_iva_mask::read_iva_data()
cd3_1 += pum.get_real("R22");
cd3_2 += pum.get_real("R23");
}
}
}
// Arrotondare tutto all'Euro
cd1_1.round(); cd1_2.round(); cd1_3.round(); cd1_4.round();
cd2_1.round(); cd2_2.round(); cd2_3.round(); cd2_4.round();
cd3_1.round(); cd3_2.round();
const real rettifica = lim.get_real("R5"); // Rettifiche
real cd4 = lam.get_real("R0"); // Iva esigibile per il periodo
if (rettifica > ZERO)
cd4 += rettifica;
cd4 += cd3_2; // Soomo anche imposta su oro, argento e birra
cd4.round();
real cd5 = lam.get_real("R1"); // Iva che si detrae per il periodo
if (rettifica < ZERO && !exclude_sign)
cd5 += abs(rettifica);
cd5.round();
const real cd6 = cd4 - cd5; // IVA a debito o credito per il periodo
real cd6_1, cd6_2;
@ -353,7 +367,8 @@ void TDich_periodica_iva_mask::read_iva_data()
set(F_CD6_1, cd6_1); set(F_CD6_2, cd6_2);
}
else
error_box(TR("Risultati liquidazione non presenti o da ricalcolare per il periodo richiesto."));
error_box("Risultati liquidazione non presenti o da ricalcolare per l'anno %d.", anno);
}
void TDich_periodica_iva_mask::print_prospect()
@ -384,9 +399,8 @@ void TDich_periodica_iva_mask::print_prospect()
TRectype f(LF_NDITTE);
f.put(NDT_CODDITTA, get(F_CODDITTA));
TRectype t(f);
frm.cursor()->setregion(f,t);
frm.cursor()->setregion(f,f);
frm.print();
}
@ -477,4 +491,4 @@ int cg5700(int argc, char* argv[])
TDich_periodica_iva_app a;
a.run(argc, argv, TR("Comunicazione annuale IVA"));
return 0;
}
}

View File

@ -19,7 +19,7 @@ BEGIN
OFFSET 0 0
END
SECTION BODY ODD 50
SECTION BODY ODD 40
STRINGA -1
BEGIN

View File

@ -102,7 +102,7 @@ Flags = ""
Item_01 = "Parametri liquidazione", "cg5 -3", "F"
Item_02 = "Liquidazione", "cg4 -2", "F"
Item_03 = "Visualizzazione liquidazione", "cg5 -5", "F"
Item_04 = "Prospetto dich. IVA periodica", "cg5 -7", "F"
Item_04 = "Comunicazione annuale dati IVA", "cg5 -7", "F"
Item_05 = "Riepilogo progressivi", "cg0 -3", "F"
Item_06 = "Stampa registri", "cg4 -3", "F"
Item_07 = "Liste fatture", [PRASSICG_026]

View File

@ -3,7 +3,7 @@
int main(int argc, char** argv)
{
int n = argc > 1 ? atoi(argv[1]+1) : 0;
const int n = argc > 1 ? atoi(argv[1]+1) : 0;
switch(n)
{
case 1: db1200(argc, argv); break; // Stampa Anagrafica

View File

@ -50,7 +50,7 @@ struct _ParmStruct
bool _last_qta,
_vis_art, _vis_lav, _vis_vir, _vis_gho,
_fabbisogno, _no_fabbis_fin, _no_zero_ord,
_val_magmb, _val_depmb, _newpage, _det_ord_for,
_val_magmb, _val_depmb, _newpage, _det_ord_for, _sort_for,
_separate_dist, _separate_giac,
_add_orc, _add_orf, _add_prf, _add_prc, _add_acl, _add_incl,
_normal_disp;
@ -279,6 +279,9 @@ public:
void set_parameters(_ParmStruct* ps);
void explode_and_print();
void reset_cache() { _art_cache.destroy(); }
static TArticolo_cache& cache_articoli() { return _f->_art_cache; }
TExplode_distinta_form(const char *);
virtual ~TExplode_distinta_form();
};
@ -1276,6 +1279,7 @@ void TExplode_distinta_form::explode_and_print()
error_box("Impossibile posizionare l'albero");
}
// Ordina le righe di esplosione per livello/articolo/giacenza
compare_print_rows(const TObject** o1, const TObject** o2)
{
TRiga_esplosione2print & r1 =(TRiga_esplosione2print &)(**o1);
@ -1290,7 +1294,33 @@ compare_print_rows(const TObject** o1, const TObject** o2)
if (diff == 0)
diff = r1.giacenza().compare(r2.giacenza());
return diff ;
}
}
// Ordina le righe di esplosione per fornitore/articolo/giacenza
compare_print_rows_forn(const TObject** o1, const TObject** o2)
{
TRiga_esplosione2print & r1 =(TRiga_esplosione2print &)(**o1);
TRiga_esplosione2print & r2 =(TRiga_esplosione2print &)(**o2);
const int l1 = r1.livello();
const int l2 = r2.livello();
int diff = 0;
if (l1 == 0 || l2 == 0)
diff = l1-l2;
if (diff == 0)
{
TArticolo_cache& ac = TExplode_distinta_form::cache_articoli();
long f1 = atol(ac.get(r1.articolo()).get(ANAMAG_CODFORN));
long f2 = atol(ac.get(r2.articolo()).get(ANAMAG_CODFORN));
diff = f1 < f2 ? -1 : (f1 == f2 ? 0 : +1);
}
if (diff == 0)
diff = r1.articolo().compare(r2.articolo());
if (diff == 0)
diff = r1.giacenza().compare(r2.giacenza());
return diff ;
}
void TExplode_distinta_form::print_explosion_rows()
{
@ -1298,7 +1328,12 @@ void TExplode_distinta_form::print_explosion_rows()
if (righe <= 0)
return;
if (!_p->_separate_dist)
_exploded_tree.sort(compare_print_rows);
{
if (_p->_sort_for)
_exploded_tree.sort(compare_print_rows_forn);
else
_exploded_tree.sort(compare_print_rows);
}
// Inizializza lo sfondo delle pagine normali se no col piffero che stampa la fincatura...
set_background(3, TRUE);
@ -1862,6 +1897,7 @@ void TEsplosione_distinta_app::main_loop()
_parameters._liv_attenzione = _mask->get(F_LIVATTENZ)[0];
_parameters._newpage = _mask->get_bool(F_NEWPAGE);
_parameters._det_ord_for = _mask->get_bool(F_DETORDFOR);
_parameters._sort_for = _mask->get_bool(F_SORTFOR);
_parameters._separate_dist = _mask->get_bool(F_SEPARATE_DIST);
_parameters._separate_giac = _mask->get_bool(F_SEPARATE_GIAC);
_parameters._add_orc = _mask->get_bool(F_ORCLI4DISP);

View File

@ -49,6 +49,7 @@
#define F_DESCIMP 147
#define F_LINEA 148
#define F_DESCLIN 149
#define F_SORTFOR 150
#define F_CODDIS 101
#define F_LIV1 102

View File

@ -498,8 +498,16 @@ END
BOOLEAN F_DETORDFOR
BEGIN
PROMPT 3 19 "Dettaglia ordinato fornitori"
MESSAGE FALSE CLEAR,F_SORTFOR
MESSAGE TRUE ENABLE,F_SORTFOR
END
BOOLEAN F_SORTFOR
BEGIN
PROMPT 36 19 "Ordina per fornitore"
END
ENDPAGE
PAGE "Articoli" -1 -1 78 20

View File

@ -9,7 +9,7 @@
#define F_DENOM 105
#define F_CAB 106
#define F_CC_INC 107
#define F_CC_INC 107
#define F_CC_CONT_INC 109
#define F_CC_SBF 110
#define F_FIDO_SBF 111
@ -30,4 +30,9 @@
#define F_DESCR_INC 126
#define F_DESCR_SBF 127
#define F_DESCR_SCN 128
#define F_GRUPPO_INCP 129
#define F_CONTO_INCP 130
#define F_SOTTOC_INCP 131
#define F_DESCR_INCP 132
#endif//__BATBBNP_H

View File

@ -1,11 +1,11 @@
//DEFINIZIONE MASCHERA GESTIONE TABELLA BANCHE DI PRESENTAZIONE
#include "batbbnp.h"
TOOLBAR "" 0 19 0 2
TOOLBAR "" 0 20 0 2
#include <toolbar.h>
ENDPAGE
PAGE "Banche di Presentazione" 0 -1 77 19
PAGE "Banche di Presentazione" 0 -1 77 20
GROUPBOX DLG_NULL 78 4
BEGIN
@ -96,7 +96,7 @@ BEGIN
FLAG "D"
END
GROUPBOX DLG_NULL 78 5
GROUPBOX DLG_NULL 78 6
BEGIN
PROMPT 1 4 "Portafoglio Effetti all' incasso"
END
@ -115,7 +115,7 @@ END
NUMBER F_GRUPPO_INC 3
BEGIN
PROMPT 2 7 "Contropartita "
PROMPT 2 7 "Cont. attivi "
FIELD I0
CHECKTYPE NORMAL
END
@ -159,47 +159,93 @@ BEGIN
CHECKTYPE NORMAL
END
NUMBER F_GRUPPO_INCP 3
BEGIN
PROMPT 2 8 "Cont. passivi "
FIELD I9
CHECKTYPE NORMAL
END
NUMBER F_CONTO_INCP 3
BEGIN
PROMPT 21 8 ""
FIELD I10
CHECKTYPE NORMAL
END
NUMBER F_SOTTOC_INCP 6
BEGIN
PROMPT 28 8 ""
FIELD I11
USE LF_PCON KEY 1 SELECT SOTTOCONTO!=""
INPUT GRUPPO F_GRUPPO_INCP
INPUT CONTO F_CONTO_INCP
INPUT SOTTOCONTO F_SOTTOC_INCP
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO
DISPLAY "Descrizione@50" DESCR
OUTPUT F_GRUPPO_INCP GRUPPO
OUTPUT F_CONTO_INCP CONTO
OUTPUT F_SOTTOC_INCP SOTTOCONTO
OUTPUT F_DESCR_INCP DESCR
CHECKTYPE NORMAL
END
STRING F_DESCR_INCP 50 38
BEGIN
PROMPT 38 8 ""
USE LF_PCON KEY 2
INPUT DESCR F_DESCR_INCP
DISPLAY "Descrizione@50" DESCR
DISPLAY "Gruppo" GRUPPO
DISPLAY "Conto" CONTO
DISPLAY "Sottoconto" SOTTOCONTO
COPY OUTPUT F_SOTTOC_INCP
CHECKTYPE NORMAL
END
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 1 9 "Portafoglio Effetti salvo buon fine"
PROMPT 1 10 "Portafoglio Effetti salvo buon fine"
END
STRING F_CC_SBF 20
BEGIN
PROMPT 2 10 "C/C "
PROMPT 2 11 "C/C "
FIELD BNP->S1
END
NUMBER F_FIDO_SBF 20 2
BEGIN
PROMPT 38 10 "Fido "
PROMPT 38 11 "Fido "
FIELD BNP->R1
PICTURE "###.###.###.###,@@"
END
STRING F_CC_CONT_SBF 20
BEGIN
PROMPT 2 11 "C/Contabile "
PROMPT 2 12 "C/Contabile "
FIELD BNP->S4
END
NUMBER F_GRUPPO_SBF 3
BEGIN
PROMPT 2 12 "Contropartita "
PROMPT 2 13 "Contropartita "
FIELD I3
CHECKTYPE NORMAL
END
NUMBER F_CONTO_SBF 3
BEGIN
PROMPT 21 12 ""
PROMPT 21 13 ""
FIELD I4
CHECKTYPE NORMAL
END
NUMBER F_SOTTOC_SBF 6
BEGIN
PROMPT 28 12 ""
PROMPT 28 13 ""
FIELD I5
USE LF_PCON KEY 1 SELECT SOTTOCONTO!=""
INPUT GRUPPO F_GRUPPO_SBF
@ -218,7 +264,7 @@ END
STRING F_DESCR_SBF 50 38
BEGIN
PROMPT 38 12 ""
PROMPT 38 13 ""
USE LF_PCON KEY 2
INPUT DESCR F_DESCR_SBF
DISPLAY "Descrizione@50" DESCR
@ -231,45 +277,45 @@ END
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 1 14 "Portafoglio Effetti allo sconto"
PROMPT 1 15 "Portafoglio Effetti allo sconto"
END
STRING F_CC_SCN 20
BEGIN
PROMPT 2 15 "C/C "
PROMPT 2 16 "C/C "
FIELD BNP->S2
END
NUMBER F_FIDO_SCN 20 2
BEGIN
PROMPT 38 15 "Fido "
PROMPT 38 16 "Fido "
FIELD BNP->R2
PICTURE "###.###.###.###,@@"
END
STRING F_CC_CONT_SCN 20
BEGIN
PROMPT 2 15 "C/Contabile "
PROMPT 2 17 "C/Contabile "
FIELD BNP->S5
END
NUMBER F_GRUPPO_SCN 3
BEGIN
PROMPT 2 17 "Contropartita "
PROMPT 2 18 "Contropartita "
FIELD I6
CHECKTYPE NORMAL
END
NUMBER F_CONTO_SCN 3
BEGIN
PROMPT 21 17 ""
PROMPT 21 18 ""
FIELD I7
CHECKTYPE NORMAL
END
NUMBER F_SOTTOC_SCN 6
BEGIN
PROMPT 28 17 ""
PROMPT 28 18 ""
FIELD I8
USE LF_PCON KEY 1 SELECT SOTTOCONTO!=""
INPUT GRUPPO F_GRUPPO_SCN
@ -288,7 +334,7 @@ END
STRING F_DESCR_SCN 50 38
BEGIN
PROMPT 38 17 ""
PROMPT 38 18 ""
USE LF_PCON KEY 2
INPUT DESCR F_DESCR_SCN
DISPLAY "Descrizione@50" DESCR
@ -301,7 +347,7 @@ END
BOOLEAN F_CBI
BEGIN
PROMPT 2 19 "Tracciato SETIF"
PROMPT 2 20 "Tracciato SETIF"
FIELD B0
END

434
ef/df900000.frm Executable file
View File

@ -0,0 +1,434 @@
USE 31
JOIN 14 INTO NPROGTR==NPROGTR
JOIN 20 INTO TIPOCF=="F" CODCF==CODCF
JOIN 17 TO 20 INTO TIPOCF==TIPOCF CODCF==CODCF
JOIN 16 TO 17 INTO TIPOCF==TIPOCF CODCF==CODCF CODIND==CODINDEFF
JOIN 13 TO 20 INTO COM==COMCF
JOIN 13 TO 16 ALIAS 213 INTO COM==COM
JOIN %BAN TO 20 ALIAS 201 INTO CODTAB[1,5]==CODABI
JOIN %BAN TO 20 ALIAS 203 INTO CODTAB==CODABI+CODCAB
JOIN %BAN ALIAS 202 INTO CODTAB==CODABIP+CODCABP
JOIN %BAN ALIAS 204 INTO CODTAB[1,5]==CODABIP
JOIN BNP ALIAS 205 INTO CODTAB==CODABIP+CODCABP
END
DESCRIPTION
BEGIN
31->* "Effetti"
14->* "Righe effetto"
20->* "Clienti e Fornitori"
13->* "Comuni"
201@->* "Tabella banche"
202@->* "Tabella banche"
203@->* "Tabella banche"
204@->* "Tabella banche"
END
GENERAL
BEGIN
OFFSET 0 0
END
SECTION GRAPHICS ODD 4
FIGURA 1 1 1
BEGIN
PROMPT 1 1 ""
END
END
SECTION HEADER ODD 8
STRING 1 80
BEGIN
KEY "denominazione banca presentazione"
PROMPT 38 1 "Al/Alla @B"
FIELD 202@->S0
// MESSAGE _BANCAP
END
STRING 2 30
BEGIN
KEY "scritta elenco riba"
PROMPT 2 1 "@BORDINI DI BONIFICO"
END
NUMBER 3 8
BEGIN
KEY "numero di pagina"
PROMPT 129 1 "pag. "
MESSAGE _PAGENO
END
DATA 4 20
BEGIN
KEY "data emissione"
PROMPT 2 2 "Presentati il : "
MESSAGE _DATA
END
STRING 5 130
BEGIN
KEY "ditta"
PROMPT 2 4 "Vi preghiamo di disporre per ordine e per conto @B"
MESSAGE _DITTA,!RAGSOC
END
STRING 5 130
BEGIN
KEY "ditta"
PROMPT 2 5 "i bonifici di seguito indicati:"
END
STRING 6 20
BEGIN
KEY "scritta titolo righe del body"
PROMPT 2 7 "CREDITORE"
END
STRING 7 10
BEGIN
KEY "scritta titolo righe del body"
PROMPT 32 7 "INDIRIZZO"
END
STRING 8 17
BEGIN
KEY "scritta titolo righe del body"
PROMPT 62 7 "BANCA D'APPOGGIO"
END
STRING 9 11
BEGIN
KEY "scritta titolo righe del body"
PROMPT 94 7 "FATTURA NUM"
END
STRING 10 8
BEGIN
KEY "scritta titolo righe del body"
PROMPT 111 7 "DATA FATT."
END
STRING 11 7
BEGIN
KEY "scritta titolo righe del body"
PROMPT 129 7 "IMPORTO"
END
STRING 12
BEGIN
KEY "riga separazione dalle righe del body"
PROMPT 2 8 "---------------------------------------------------------------------------------------------------------------------------------------------"
END
STRING 13 25
BEGIN
KEY "Numero distinta"
PROMPT 100 2 "Distinta N. @B"
FIELD NDIST
END
END
SECTION BODY ODD 6
STRING 15 2 1
BEGIN
KEY "creditore"
PROMPT 1 1 "@B"
END
STRING 16 25 2
BEGIN
KEY "creditore"
PROMPT 2 1 ""
FIELD 20->RAGSOC
MESSAGE INC,FL->2
END
STRING 27 21
BEGIN
KEY "codice fiscale"
PROMPT 2 3 "P.I. "
FIELD 20->PAIV
// FIELD 20->COFI
END
STRING 28 2 1
BEGIN
KEY "indirizzo normale"
PROMPT 25 1 "@R"
END
STRING 17 25 2
BEGIN
KEY "Indirizzo debitore + nr. civico"
PROMPT 27 1 ""
MESSAGE _CLI,!IND
END
STRINGA 18 25 2
BEGIN
KEY "PIAZZA(LOCALITA+PROV)"
PROMPT 27 3 ""
MESSAGE _CLI,!PIAZZA
END
STRING 117 6
BEGIN
KEY ""
PROMPT 2 17 ""
MESSAGE _NUMEXPR, 20->CODABI==99999
MESSAGE COPY,118
FLAGS "H"
END
NUMBER 118 5
BEGIN
KEY ""
PROMPT 55 4 ""
MESSAGE ENABLE,119|DISABLE,19
MESSAGE ENABLE,120|DISABLE,20|DISABLE,21
MESSAGE ENABLE,134|DISABLE,22|DISABLE,34
MESSAGE EMPTY ENABLE,19|DISABLE,119
MESSAGE EMPTY ENABLE,20|DISABLE,120
FLAGS "H"
END
STRING 119 40 2
BEGIN
KEY "banca d'appoggio denominazione"
PROMPT 55 1 ""
FIELD 203@->S0
FLAGS "D"
END
STRING 120 40 1
BEGIN
KEY "banca d'appoggio denominazione"
PROMPT 55 3 ""
FIELD 203@->S2
FLAGS "D"
END
STRING 19 40 2
BEGIN
KEY "banca d'appoggio denominazione"
PROMPT 55 1 ""
FIELD 201@->S0
END
STRING 20 40 1
BEGIN
KEY "banca d'appoggio succursale"
PROMPT 55 3 ""
FIELD 203@->S0
END
STRING 221 7
BEGIN
KEY "ABI presentazione"
PROMPT 55 4 "@B"
END
STRING 21 5
BEGIN
KEY "ABI presentazione"
PROMPT 55 4 "ABI: "
FIELD 20->CODABI
END
STRING 22 5
BEGIN
KEY "CAB succursale"
PROMPT 66 4 "CAB: "
FIELD 20->CODCAB
END
LISTA 23 8
BEGIN
KEY "a saldo/in conto"
FIELD 31->ULTRATA
PROMPT 95 1 ""
ITEM " |IN CONTO"
ITEM "X|A SALDO"
flags "H"
END
STRING 24 17 5
BEGIN
KEY "dati fattura"
PROMPT 92 1 ""
// MESSAGE _FATT,!DATIFATT
END
DATA 25 10
BEGIN
KEY "data scadenza"
PROMPT 112 1 ""
// FIELD 31->DATASCAD
END
STRING 34 20
BEGIN
KEY "Conto Corrente"
PROMPT 78 4 "C/C "
FIELD 20->NUMCC
END
STRING 133 1
BEGIN
KEY "Conto Corrente"
PROMPT 55 4 ""
FIELD 20->NUMCC
MESSAGE EMPTY DISABLE,134
FLAGS "H"
END
STRING 134 35
BEGIN
KEY "Conto Corrente"
PROMPT 55 4 "ACCOUNT NUM. "
FIELD 20->NUMCC
FLAGS "D"
END
STRING 35 3
BEGIN
KEY "test sulla valuta"
PROMPT 2 8 ""
FIELD CODVAL
FLAGS "H"
MESSAGE EMPTY ENABLE,4@|DISABLE,3@
END
STRING 36 17 1
BEGIN
KEY "cod cliente"
PROMPT 2 4 "@RCod. For: "
FIELD 20->CODCF
END
SECTION RIGHE_EFFETTO 5 1 1 FILE 14 GROUP NPROGTR
STRINGA 1
BEGIN
PROMPT 92 1 "Ft. n."
FIELD 14->NFATT
END
DATA 2
BEGIN
PROMPT 107 1 "del "
FIELD 14->DATAFATT
END
NUMERO 3 21 3
BEGIN
PROMPT 124 1 ""
FIELD 14->IMPORTOVAL
PICTURE "###.###.###.###,@@#"
GROUP 3
END
NUMERO 4 18
BEGIN
PROMPT 124 1 ""
FIELD 14->IMPORTO
PICTURE "###.###.###,@@#"
GROUP 4
FLAGS "D"
END
END
STRINGA 31 32
BEGIN
PROMPT 110 5 "--------------------------------"
END
STRINGA 32 10
BEGIN
PROMPT 109 6 "@B Totale"
END
STRINGA 33 2
BEGIN
PROMPT 114 6 "@B"
END
NUMERO 26 18
BEGIN
KEY "importo"
PROMPT 124 6 ""
MESSAGE _IMPORTO
MESSAGE ADD,FL->3
PICTURE "###.###.###,@@#"
END
END
SECTION FOOTER ODD 5
END
SECTION FOOTER LAST 5
STRINGA 1
BEGIN
KEY "riga separazione dalle righe del body"
PROMPT 2 1 "---------------------------------------------------------------------------------------------------------------------------------------------"
END
NUMERO 2 25
BEGIN
KEY "scritta n. documenti"
PROMPT 5 2 "ORDINI DI BONIFICO N. "
END
NUMERO 3 50
BEGIN
KEY "Totale"
PROMPT 5 3 "Dell' importo complessivo di Eur.@B"
PICTURE "###.###.###.###,@@#"
END
STRING 93 3
BEGIN
KEY "test sulla valuta"
PROMPT 34 3 ""
FIELD CODVAL
// MESSAGE EMPTY ENABLE,4@|DISABLE,3@
GROUP 4
END
STRINGA 4 40
BEGIN
KEY "NUMERO C/C"
PROMPT 60 3 "@Raddebiterete il C/C N. @B"
FIELD 205@->S0
END
STRINGA 5 80
BEGIN
KEY "firma "
PROMPT 5 4 "presso di Voi, intestato a: @B"
MESSAGE _DITTA,!RAGSOC
END
STRINGA 6 40
BEGIN
KEY "firma "
PROMPT 65 5 "------------------------------------"
END
DATA 7 34
BEGIN
KEY "data valuta"
PROMPT 100 3 "@Rcon valuta per noi: @B"
FIELD 31->DATADIST
END
END
END

View File

@ -3,12 +3,13 @@
#include "ef0.h"
int main(int argc, char** argv)
{
{
const char op = argc < 2 ? '0' : argv[1][1];
op + 1; op + 1; op + 1; op + 1;
switch (op)
{
case '1':
ef0200(argc,argv);// GENERAZIONE EFFETTI DA E/C
ef0200(argc,argv);// GENERAZIONE EFFETTI DA E/C (OBSOLETO NON USARE PIU")
break;
case '2':
ef0300(argc,argv);// GESTIONE DISTINTE

View File

@ -19,7 +19,7 @@ BEGIN
FIELD NPROGTR
KEY 1
USE LF_EFFETTI KEY 1
JOIN LF_CLIFO TO LF_EFFETTI KEY 1 INTO CODCF=CODCF TIPOCF=F_TIPOCF
JOIN LF_CLIFO TO LF_EFFETTI KEY 1 INTO CODCF=CODCF TIPOCF=TIPOCF
INPUT NPROGTR F_NPROGTR
DISPLAY "Nr.progr." NPROGTR
DISPLAY "Tipo" TIPOCF
@ -27,6 +27,7 @@ BEGIN
DISPLAY "Data\nscadenza@10" DATASCAD
DISPLAY "Tipo\ndistinta@9" TIPODIST
DISPLAY "Nr.\ndistinta@9" NDIST
DISPLAY "Importo@20" IMPORTO
DISPLAY "Ragione Sociale@50" LF_CLIFO->RAGSOC
OUTPUT F_NPROGTR NPROGTR
CHECKTYPE REQUIRED

View File

@ -694,12 +694,13 @@ bool TVariazione_distinte::data_handler(TMask_field& f, KEY k)
dataa = eotime;
TDate data_sh;
TSheet_field& sf = (TSheet_field&)m.field(F_SHEET);
TString_array& sa = sf.rows_array();
TString_array& sa = sf.rows_array();
const int field = m.get(F_TIPORD) == "F" ? 6 : 2;
// tolgo dallo sheet gli effetti che hanno la data non compresa nel range
for (int i = sa.items()-1; i >=0 ; i--)
{
TToken_string& row = sa.row(i);
data_sh = (TDate)row.get(2);
data_sh = (TDate)row.get(field);
if (data_sh > dataa || data_sh < datad)
sa.remove(i);
}
@ -713,16 +714,15 @@ bool TVariazione_distinte::data_handler(TMask_field& f, KEY k)
// nello sheet, nella maschera di scelta delle riba (ef0300c)
HIDDEN int confronta_data(const TObject** o1, const TObject** o2)
{
int val;
TToken_string* s1 = (TToken_string*) *o1;
TToken_string* s2 = (TToken_string*) *o2;
TDate data1 = s1->get(2);
TDate data2 = s2->get(2);
if (data1 == data2)
val = 0;
return 0;
else
val = (data1 > data2) ? +1 : -1;
return val;
return (data1 > data2) ? +1 : -1;
}
// Handler per gestire l'ordinamento per data degli effetti presenti
@ -743,30 +743,16 @@ void TVariazione_distinte::ord_data()
// effetti presenti nello sheet, nella maschera di scelta delle riba
HIDDEN int confronta_fatt(const TObject** o1, const TObject** o2)
{
int val;
TToken_string* s1 = (TToken_string*) *o1;
TToken_string* s2 = (TToken_string*) *o2;
long num1 = s1->get_long(4);
long num2 = s2->get_long(4);
TDate data1 = s1->get(5);
TDate data2 = s2->get(5);
// ordinamento sul numero fattura
if (num1 != num2)
{
val = (num1 > num2) ? +1 : -1;
return val;
}
TDate data1 = s1->get(6);
TDate data2 = s2->get(6);
// ordinamento sulla data fattura
if (data1 == data2)
{
val = 0;
return val;
}
return 0;
else
{
val = (data1 > data2) ? +1 : -1;
return val;
}
return (data1 > data2) ? +1 : -1;
}
// Handler per gestire l'ordinamento per numero e data fattura degli

View File

@ -18,8 +18,11 @@ BEGIN
KEY 4
FIELD LF_EFFETTI->TIPODIST
ITEM "I|All'incasso"
ITEM "B|Salvo buon fine"
MESSAGE ENABLE,F_TIPOCF
ITEM "B|Salvo buon fine"
MESSAGE RESET,F_TIPOCF|DISABLE,F_TIPOCF
ITEM "S|Allo sconto"
MESSAGE RESET,F_TIPOCF|DISABLE,F_TIPOCF
END
LIST F_NUMBERRIGA 12
@ -46,6 +49,7 @@ BEGIN
DISPLAY "Data@10" DATADIST
DISPLAY "ABI@5" CODABIP
DISPLAY "CAB@5" CODCABP
DISPLAY "C/F@5" TIPOCF
OUTPUT F_NUMBER NDIST
OUTPUT F_TIPODIST TIPODIST
OUTPUT F_NUMBERRIGA NRIGADIST
@ -119,7 +123,7 @@ END
LIST F_TIPOPAG 24
BEGIN
PROMPT 2 6 "Tipo Effetti "
PROMPT 2 6 "Tipo Pagamento "
FIELD LF_EFFETTI->TIPOPAG
ITEM "2|Tratta"
ITEM "3|Ricevuta Bancaria"

View File

@ -6,7 +6,6 @@
#include <relation.h>
#include <printer.h>
#include <progind.h>
#include <utility.h>
#include "ef0.h"
#include "ef0301.h"
@ -266,13 +265,13 @@ void TEmissione::floppy()
error_box("Impossibile continuare dischetto pieno");
else
{
TProgind pi(n_eff,"Emissione Ri.Ba. su floppy...",FALSE,TRUE);
TProgind pi(n_eff,"Emissione Ri.Ba. su floppy...",FALSE,TRUE);
TAssoc_array& tracciati = _trasfile->tracciati();
header_rb();//intestazione flusso effetti
//scandisco tutti gli effetti della distinta selezionata
for (*_cur = 0; _cur->pos() < n_eff; ++(*_cur))
{
TAssoc_array& tracciati = _trasfile->tracciati();
header_rb();//intestazione flusso effetti
//scandisco tutti gli effetti della distinta selezionata
for (*_cur = 0; _cur->pos() < n_eff; ++(*_cur))
{
pi.addstatus(1L);
save_data_emis();
THash_object* lavoro = tracciati.get_hashobj();
@ -280,10 +279,10 @@ void TEmissione::floppy()
for (int i = 0; lavoro != NULL; i++)
{
record(*lavoro);//emetto il record
lavoro = tracciati.get_hashobj();
lavoro = tracciati.get_hashobj();
}
}
footer_ef(); //chiusura flusso effetti
}
footer_ef(); //chiusura flusso effetti
}
_trasfile->close();
delete _trasfile;
@ -331,6 +330,7 @@ void TEmissione::header_rb()
}
_trasfile->autoload(rec, *_cur);
_trasfile->write(rec);
}
//emetto il record di chiusura del flusso di effetti

View File

@ -23,9 +23,8 @@ class TPrint_effetti_app : public TPrintapp
pt _pr_type;
TRelation* _rel;
TPrintrow _pr;
TString _ban, _cli, _val, _data_stampa, _ban_prec;
TString _ban, _banp, _cli, _val, _data_stampa, _ban_prec;
TDate _scad_prec;
//TRectype* _rec_prec;
int _cur_1, _cur_2, _cur_3, _cur_4, _interline, _colonne;
long _dist_prec, _cliente_prec;
char _tipo_prec, _tipocf_prec;
@ -65,7 +64,7 @@ public:
};
// Costruttore classe
TPrint_effetti_app::TPrint_effetti_app():TPrintapp(), _ban(11), _ban_prec(11), _cli(60), _val(3), _data_stampa(10)
TPrint_effetti_app::TPrint_effetti_app():TPrintapp(), _ban(11), _banp(11), _ban_prec(11), _cli(60), _val(3), _data_stampa(10)
{
_rel = NULL;
//_rec_prec = NULL;
@ -88,14 +87,6 @@ const TString& TPrint_effetti_app::look_clifo(char tipo, long codcf, TString& cl
// restituisce un campo di una tabella
const char* TPrint_effetti_app::look_tab(const char* tabname, const TString& cod, const char* fld)
{
/*
TTable tab(tabname);
tab.curr().zero();
tab.curr().put("CODTAB",cod);
tab.read();
if (tab.bad()) tab.curr().zero();
return tab.curr().get(fld);
*/
return cache().get(tabname, cod, fld);
}
@ -142,13 +133,13 @@ void TPrint_effetti_app::st_header_scad(const TDate& scad)
_pr.reset();
}
// stampa intestazione per banca di presentazione
// stampa intestazione per banca di appoggio
// (dopo la "rottura" per banca)
void TPrint_effetti_app::st_header_ban(const TString& ban)
{
TString80 s = look_tab("%BAN",ban);
if (s.empty())
s = "Nessuna Banca di Presentazione";
s = "Banca assente";
_pr.put(s,1);
printer().print(_pr);
_pr.reset();
@ -240,11 +231,11 @@ void TPrint_effetti_app::header_scadenza()
set_header(j, (const char *)(TString(_colonne).fill('_')));
}
// setta l'header per la stampa per banca di presentazione
// setta l'header per la stampa per banca di appoggio
void TPrint_effetti_app::header_banca()
{
int j = 2;
set_header(j, "@45g@bSTAMPA RI.BA. PER BANCHE DI PRESENTAZIONE"); j++;
set_header(j, "@45g@bSTAMPA RI.BA. PER BANCA D'APPOGGIO"); j++;
set_header(j++, (const char *)(TString(_colonne).fill('_')));
TString head = "@b Banca Scadenza Cliente N.Riba N.Dist Importo Imp. in valuta Val Rata Data fattura N.";
if (_stampa_bancapp)
@ -297,7 +288,7 @@ print_action TPrint_effetti_app::postprocess_print(int file, int counter)
_pr.reset();
s = (look_tab("%BAN",_ban_prec));
if (s.empty())
s = "Nessuna Banca di Presentazione";
s = "Banca assente";
_pr.put(s,52);
printer().print(_pr);
_tot_banca = 0.0;
@ -309,10 +300,12 @@ print_action TPrint_effetti_app::postprocess_print(int file, int counter)
printer().print(_pr);
_pr.reset();
_pr.put("TOTALE",46);
_pr.put(_tot_distinta.string(PICTURE_IMPORTO),63);
printer().print(_pr);
_pr.reset();
s = "Distinta ";
s << _dist_prec << " " << _tipo_prec ;
_pr.put(s,57);
_pr.put(_tot_distinta.string(PICTURE_IMPORTO),63);
_pr.put(s,52);
printer().print(_pr);
_tot_distinta = 0.0;
_pr.reset();
@ -433,9 +426,10 @@ void TPrint_effetti_app::write_bancapp()
void TPrint_effetti_app::set_scadenza()
{
set_row(1," ");
set_row(2,"@1g@s@13g#t@26g#t@49g@pn@55g@pn@63g@pn@105g@pn@111g@s@125g@n",
set_row(2,"@1g@s@13g#t@26g@pn@33g#t@49g@pn@55g@pn@63g@pn@105g@pn@111g@s@125g@n",
FLD(LF_EFFETTI, EFF_DATASCAD),
&_ban,
&_banp,
FLD(LF_EFFETTI, EFF_CODCF,"@@@@@@"),
&_cli,
FLD(LF_EFFETTI, EFF_NPROGTR, "#####@"),
FLD(LF_EFFETTI, EFF_NDIST, "#######@"),
@ -456,12 +450,12 @@ void TPrint_effetti_app::set_scadenza()
}
// setta la pagina logica nel caso di stampa per banca di presentazione
// setta la pagina logica nel caso di stampa per banca di appoggio
void TPrint_effetti_app::set_banca()
{
set_row(1," ");
set_row(2,"@1g#t@14g@s@26g#t@49g@pn@55g@pn@63g@pn@105g@pn@111g@s@125g@pn",
&_ban,
&_banp,
FLD(LF_EFFETTI, EFF_DATASCAD),
&_cli,
FLD(LF_EFFETTI, EFF_NPROGTR, "#####@"),
@ -491,7 +485,7 @@ void TPrint_effetti_app::set_distinta()
FLD(LF_EFFETTI, EFF_NDIST, "#######@"),
FLD(LF_EFFETTI, EFF_NPROGTR, "#####@"),
FLD(LF_EFFETTI, EFF_DATASCAD),
&_ban,
&_banp,
&_cli,
FLD(LF_EFFETTI, EFF_IMPORTO, PICTURE_IMPORTO),
FLD(LF_REFFETTI, REFF_NRATA,"##@"),
@ -516,7 +510,7 @@ void TPrint_effetti_app::set_cliente()
set_row(2,"@5g@pn@25g@s@37g#t@49g@pn@55g@pn@63g@pn@105g@pn@111g@s@125g@pn",
FLD(LF_EFFETTI, EFF_CODCF,"@@@@@@"),
FLD(LF_EFFETTI, EFF_DATASCAD),
&_ban,
&_banp,
FLD(LF_EFFETTI, EFF_NPROGTR, "#####@"),
FLD(LF_EFFETTI, EFF_NDIST, "#######@"),
FLD(LF_EFFETTI, EFF_IMPORTO, PICTURE_IMPORTO),
@ -543,7 +537,7 @@ bool TPrint_effetti_app::preprocess_page(int file, int counter)
// necessitano per effettuare la "rorrura della stampa"
TRectype& rec = current_cursor()->curr();
const TDate scad = rec.get_date (EFF_DATASCAD);
TString ban = rec.get (EFF_CODABIP);
TString ban = rec.get (EFF_CODABI);
long dist = rec.get_long (EFF_NDIST);
char tipodist = rec.get_char(EFF_TIPODIST);
long cliente = rec.get_long (EFF_CODCF);
@ -552,14 +546,21 @@ bool TPrint_effetti_app::preprocess_page(int file, int counter)
// elaboro le seguenti stringhe per la stampa
if (ban=="00000")
ban = "";
_ban = get_field(LF_EFFETTI, EFF_CODABIP);
_ban = get_field(LF_EFFETTI, EFF_CODABI);
if (_ban=="00000")
_ban = "";
s = get_field(LF_EFFETTI, EFF_CODCABP);
s = get_field(LF_EFFETTI, EFF_CODCAB);
if (s=="00000")
s = "";
_ban << " " << s;
_banp = get_field(LF_EFFETTI, EFF_CODABIP);
if (_banp=="00000")
_banp = "";
s = get_field(LF_EFFETTI, EFF_CODCABP);
if (s=="00000")
s = "";
_banp << " " << s;
_cli = get_field(LF_CLIFO, CLI_RAGSOC);
s = _cli.mid(30,50); s.trim();
_cli = _cli.mid(0,30); _cli.trim();
@ -680,7 +681,7 @@ bool TPrint_effetti_app::preprocess_page(int file, int counter)
_pr.reset();
s = (look_tab("%BAN",_ban_prec));
if (s.empty())
s = "Nessuna Banca di Presentazione";
s = "Banca assente";
_pr.put(s,52);
printer().print(_pr);
_tot_banca = 0.0;
@ -700,6 +701,8 @@ bool TPrint_effetti_app::preprocess_page(int file, int counter)
// è cambiato il numero distinta, stampo il relativo totale
// è cambiato il mese della la data di scadenza, stampo il relativo totale
// ed il nuovo header del mese
if (scad != _scad_prec)
st_tot_scad();
if (scad.month() !=_scad_prec.month())
{
st_tot_mese();
@ -718,10 +721,12 @@ bool TPrint_effetti_app::preprocess_page(int file, int counter)
printer().print(_pr);
_pr.reset();
_pr.put("TOTALE",46);
_pr.put(_tot_distinta.string(PICTURE_IMPORTO),63);
printer().print(_pr);
_pr.reset();
s = "Distinta ";
s << _tipo_prec << " "<< _dist_prec;
_pr.put(s,57);
_pr.put(_tot_distinta.string(PICTURE_IMPORTO),63);
_pr.put(s,52);
printer().print(_pr);
_tot_distinta = 0.0;
_pr.reset();
@ -766,8 +771,10 @@ bool TPrint_effetti_app::preprocess_page(int file, int counter)
_scad_prec = scad;
_dist_prec = dist;
_tipo_prec = tipodist;
_tot_distinta += importo;
_tot_tip_dist += importo;
_tot_data += importo;
_tot_mese += importo;
_tot_stampa += importo ;
break;
@ -845,19 +852,26 @@ bool TPrint_effetti_app::set_print(int)
from.zero();
TRectype to(from);
TString cod_from, cod_to, filter;
char tipocf;
// a seconda del tipo di stampa scelta , seleziono il curore
// da utilizzare ed imposto i campi per la regione e il filtro
// del cursore
switch(_pr_type)
{
case st_scadenza:
{
cod_from = mask.get(F_DA_DATA);
cod_to = mask.get(F_A_DATA);
from.put(EFF_DATASCAD,cod_from);
to.put(EFF_DATASCAD,cod_to);
tipocf = mask.get(F_TIPOCF)[0];
filter = "";
filter << "(TIPOCF=='" << tipocf << "')";
select_cursor(_cur_1);
break;
}
break;
case st_banca:
{
cod_from = mask.get(F_DA_DATA2);
cod_to = mask.get(F_A_DATA2);
from.put(EFF_DATASCAD,cod_from);
@ -866,36 +880,41 @@ bool TPrint_effetti_app::set_print(int)
cod_to = mask.get(F_ABAN);
if (cod_from.empty())
cod_from = "00000"; // per selezionare tutte
if (cod_to.empty()) // le banche di presentazione
if (cod_to.empty()) // le banche
cod_to = "99999";
tipocf = mask.get(F_TIPOCF2)[0];
filter = "";
filter << "(CODABIP>=" << cod_from << ")&&(CODABIP<=" << cod_to << ")";
filter << "(CODABI>=" << cod_from << ")&&(CODABI<=" << cod_to << ")";
filter << "&&(TIPOCF=='" << tipocf << "')";
select_cursor(_cur_2);
break;
}
break;
case st_distinta:
{
cod_from = mask.get(F_DA_DATA3);
cod_to = mask.get(F_A_DATA3);
from.put(EFF_DATASCAD,cod_from);
to.put(EFF_DATASCAD,cod_to);
cod_from = mask.get(F_DADIST);
cod_to = mask.get(F_ADIST);
filter.cut(0);
const TString16 tipodist(mask.get(F_DATIPODIST));
{
cod_from = mask.get(F_DA_DATA3);
cod_to = mask.get(F_A_DATA3);
from.put(EFF_DATASCAD,cod_from);
to.put(EFF_DATASCAD,cod_to);
cod_from = mask.get(F_DADIST);
cod_to = mask.get(F_ADIST);
filter.cut(0);
const TString16 tipodist(mask.get(F_DATIPODIST));
if (tipodist.not_empty())
{
if (cod_from.not_empty())
filter << "STR(NDIST>=" << cod_from << ")&&";
if (cod_to.not_empty()) // le distinte
filter << "STR(NDIST<=" << cod_to << ")&&";
filter << "(TIPODIST==\"" << tipodist << "\")";
}
else
filter << "(NDIST<=\"\")";
select_cursor(_cur_3);
}
break;
if (tipodist.not_empty())
{
if (cod_from.not_empty())
filter << "STR(NDIST>=" << cod_from << ")&&";
if (cod_to.not_empty()) // le distinte
filter << "STR(NDIST<=" << cod_to << ")&&";
filter << "(TIPODIST==\"" << tipodist << "\")";
}
else
filter << "(NDIST<=\"\")";
tipocf = mask.get(F_TIPOCF3)[0];
filter << "&&(TIPOCF=='" << tipocf << "')";
select_cursor(_cur_3);
}
break;
case st_cliente:
{
cod_from = mask.get(F_DA_DATA4);
@ -911,7 +930,7 @@ bool TPrint_effetti_app::set_print(int)
from.put(EFF_CODCF,cod_from);
to.put(EFF_CODCF,cod_to);
filter = "";
filter << "(TIPOCF == \"" << mask.get(F_TIPOCF) << "\")&&";
filter << "(TIPOCF == \"" << mask.get(F_TIPOCF4) << "\")&&";
filter << "(CODCF>=" << cod_from << ")&&(CODCF<=" << cod_to << ")" ;
select_cursor(_cur_4);
}
@ -939,7 +958,7 @@ bool TPrint_effetti_app::user_create()
//STAMPA PER SCADENZA
_cur_1 = add_cursor(new TCursor(_rel,"",3));
//STAMPA PER BANCA
TString ordine = "CODABIP|DATASCAD|NPROGTR";
TString ordine = "CODABI|CODCAB|DATASCAD|NPROGTR";
_cur_2 = add_cursor(new TSorted_cursor(_rel,ordine,"",3));
//STAMPA PER DISTINTA
ordine = "TIPODIST|NDIST|NRIGADIST|DATASCAD|NPROGTR";

View File

@ -10,23 +10,26 @@
#define F_A_DATA 104
#define F_DABAN 105
#define F_ABAN 106
#define F_DA_DATA2 107
#define F_A_DATA2 108
#define F_NUMBERRIGA 109
#define F_DATIPODIST 110
#define F_DADIST 111
#define F_ADIST 113
#define F_DA_DATA3 114
#define F_A_DATA3 115
#define F_TIPOCF 116
#define F_DACLI 117
#define F_ACLI 118
#define F_DA_DATA4 119
#define F_A_DATA4 120
#define F_BANCA_APP 121
#define F_DABAN_DESCR 122
#define F_ABAN_DESCR 123
#define F_DACLI_DESCR 124
#define F_ACLI_DESCR 125
#define F_TIPOCF 107
#define F_DA_DATA2 108
#define F_A_DATA2 109
#define F_TIPOCF2 110
#define F_NUMBERRIGA 111
#define F_DATIPODIST 112
#define F_TIPOCF3 113
#define F_DADIST 114
#define F_ADIST 115
#define F_DA_DATA3 116
#define F_A_DATA3 117
#define F_TIPOCF4 118
#define F_DACLI 119
#define F_ACLI 120
#define F_DA_DATA4 121
#define F_A_DATA4 122
#define F_BANCA_APP 123
#define F_DABAN_DESCR 124
#define F_ABAN_DESCR 125
#define F_DACLI_DESCR 126
#define F_ACLI_DESCR 127
#endif//__EF0600_H

View File

@ -34,7 +34,7 @@ BEGIN
END
//---------data----------------------------------------------------------------------------------------------------------//
GROUPBOX DLG_NULL 75 3
GROUPBOX DLG_NULL 75 4
BEGIN
PROMPT 1 7 "Stampa effetti per Data di scadenza"
GROUP 1
@ -54,26 +54,33 @@ BEGIN
WARNING "Data limite superiore non valida"
END
LIST F_TIPOCF 11
BEGIN
PROMPT 2 9 "Tipo effetti "
ITEM "C|Attivi"
ITEM "F|Passivi"
GROUP 1
END
//---------banca----------------------------------------------------------------------------------------------------------//
GROUPBOX DLG_NULL 75 6
BEGIN
PROMPT 1 7 "Stampa effetti per Banca di presentazione"
PROMPT 1 7 "Stampa effetti per Banca di appoggio"
GROUP 2
END
NUMBER F_DABAN 5
BEGIN
PROMPT 2 8 "Dalla Banca "
FLAGS "RZ"
FLAGS "RZ"
GROUP 2
USE BNP KEY 1 SELECT CODTAB ?= "??????????"
JOIN %BAN ALIAS 100 INTO CODTAB==CODTAB
USE %BAN KEY 1 SELECT CODTAB ?= "??????????"
INPUT CODTAB F_DABAN
DISPLAY "ABI@5" CODTAB[1,5]
DISPLAY "CAB@5" CODTAB[6,10]
DISPLAY "Denominazione@50" 100@->S0
DISPLAY "Denominazione@50" S0
OUTPUT F_DABAN CODTAB[1,5]
OUTPUT F_DABAN_DESCR %BAN->S0
OUTPUT F_DABAN_DESCR S0
CHECKTYPE SEARCH
END
@ -81,8 +88,7 @@ STRING F_DABAN_DESCR 50
BEGIN
PROMPT 23 8 ""
GROUP 2
USE %BAN KEY 2 SELECT (CODTAB?="??????????")&&(200@->CODTAB!="")
JOIN BNP ALIAS 200 INTO CODTAB==CODTAB
USE %BAN KEY 2 SELECT CODTAB?="??????????"
INPUT S0 F_DABAN_DESCR
DISPLAY "Denominazione@50" S0
DISPLAY "ABI@5" CODTAB[1,5]
@ -96,14 +102,13 @@ BEGIN
PROMPT 2 9 "Alla Banca "
FLAGS "RZ"
GROUP 2
USE BNP KEY 1 SELECT CODTAB ?= "??????????"
JOIN %BAN ALIAS 100 INTO CODTAB==CODTAB
USE %BAN KEY 1 SELECT CODTAB ?= "??????????"
INPUT CODTAB F_ABAN
DISPLAY "ABI@5" CODTAB[1,5]
DISPLAY "CAB@5" CODTAB[6,10]
DISPLAY "Denominazione@50" 100@->S0
DISPLAY "Denominazione@50" S0
OUTPUT F_ABAN CODTAB[1,5]
OUTPUT F_ABAN_DESCR %BAN->S0
OUTPUT F_ABAN_DESCR S0
CHECKTYPE SEARCH
END
@ -111,8 +116,7 @@ STRING F_ABAN_DESCR 50
BEGIN
PROMPT 23 9 ""
GROUP 2
USE %BAN KEY 2 SELECT (CODTAB?="??????????")&&(200@->CODTAB!="")
JOIN BNP ALIAS 200 INTO CODTAB==CODTAB
USE %BAN KEY 2 SELECT CODTAB?="??????????"
INPUT S0 F_ABAN_DESCR
DISPLAY "Denominazione@50" S0
DISPLAY "ABI@5" CODTAB[1,5]
@ -132,11 +136,19 @@ BEGIN
PROMPT 30 10 "Alla Data "
GROUP 2
VALIDATE DATE_CMP_FUNC >= F_DA_DATA2
WARNING "Data limite superiore non valida"
WARNING "Data limite superiore non valida"
END
LIST F_TIPOCF2 11
BEGIN
PROMPT 2 11 "Tipo effetti "
ITEM "C|Attivi"
ITEM "F|Passivi"
GROUP 2
END
//---------distinta-------------------------------------------------------------------------------------------------------//
GROUPBOX DLG_NULL 75 5
GROUPBOX DLG_NULL 75 6
BEGIN
PROMPT 1 7 "Stampa effetti per Distinta"
GROUP 3
@ -156,10 +168,14 @@ BEGIN
PROMPT 4 8 " "
KEY 4
GROUP 3
ITEM " |Senza distinta" MESSAGE CLEAR,F_DADIST|CLEAR,F_ADIST
ITEM "I|All'incasso" MESSAGE ENABLE,F_DADIST|ENABLE,F_ADIST
ITEM "B|Salvo buon fine" MESSAGE ENABLE,F_DADIST|ENABLE,F_ADIST
ITEM "S|Allo sconto" MESSAGE ENABLE,F_DADIST|ENABLE,F_ADIST
ITEM " |Senza distinta"
MESSAGE CLEAR,F_DADIST|CLEAR,F_ADIST|ENABLE,F_TIPOCF3
ITEM "I|All'incasso"
MESSAGE ENABLE,F_DADIST|ENABLE,F_ADIST|ENABLE,F_TIPOCF3
ITEM "B|Salvo buon fine"
MESSAGE ENABLE,F_DADIST|ENABLE,F_ADIST|RESET,F_TIPOCF3|DISABLE,F_TIPOCF3
ITEM "S|Allo sconto"
MESSAGE ENABLE,F_DADIST|ENABLE,F_ADIST|RESET,F_TIPOCF3|DISABLE,F_TIPOCF3
END
TEXT DLG_NULL
@ -180,6 +196,7 @@ BEGIN
INPUT NRIGADIST F_NUMBERRIGA
DISPLAY "Nr. distinta" NDIST
DISPLAY "Tipo distinta" TIPODIST
DISPLAY "C/F" TIPOCF
OUTPUT F_DADIST NDIST
CHECKTYPE NORMAL
END
@ -202,6 +219,7 @@ BEGIN
INPUT NRIGADIST F_NUMBERRIGA
DISPLAY "Nr. distinta" NDIST
DISPLAY "Tipo distinta" TIPODIST
DISPLAY "C/F" TIPOCF
OUTPUT F_ADIST NDIST
OUTPUT F_NUMBERRIGA NRIGADIST
CHECKTYPE NORMAL
@ -235,6 +253,14 @@ BEGIN
WARNING "Data limite superiore non valida"
END
LIST F_TIPOCF3 11
BEGIN
PROMPT 2 11 "Tipo effetti "
ITEM "C|Attivi"
ITEM "F|Passivi"
GROUP 3
END
//---------clifo----------------------------------------------------------------------------------------------------------//
GROUPBOX DLG_NULL 75 6
BEGIN
@ -242,7 +268,7 @@ BEGIN
GROUP 4
END
LIST F_TIPOCF 11
LIST F_TIPOCF4 11
BEGIN
PROMPT 2 8 "Tipo "
ITEM "C|Clienti"
@ -255,7 +281,7 @@ BEGIN
PROMPT 2 9 "Da Codice "
GROUP 4
USE LF_CLIFO
INPUT TIPOCF F_TIPOCF SELECT
INPUT TIPOCF F_TIPOCF4 SELECT
INPUT CODCF F_DACLI
DISPLAY "Codice" CODCF
DISPLAY "Ragione sociale@60" RAGSOC
@ -269,7 +295,7 @@ BEGIN
PROMPT 21 9 " "
GROUP 4
USE LF_CLIFO KEY 2
INPUT TIPOCF F_TIPOCF SELECT
INPUT TIPOCF F_TIPOCF4 SELECT
INPUT RAGSOC F_DACLI_DESCR
DISPLAY "Ragione sociale@60" RAGSOC
DISPLAY "Codice" CODCF
@ -283,7 +309,7 @@ BEGIN
PROMPT 2 10 "A Codice "
GROUP 4
COPY USE F_DACLI
INPUT TIPOCF F_TIPOCF SELECT
INPUT TIPOCF F_TIPOCF4 SELECT
INPUT CODCF F_ACLI
COPY DISLAY F_DACLI
OUTPUT F_ACLI CODCF
@ -296,7 +322,7 @@ BEGIN
PROMPT 21 10 " "
GROUP 4
COPY USE F_DACLI_DESCR
INPUT TIPOCF F_TIPOCF SELECT
INPUT TIPOCF F_TIPOCF4 SELECT
INPUT RAGSOC F_ACLI_DESCR
COPY DISPLAY F_DACLI_DESCR
OUTPUT F_ACLI_DESCR RAGSOC

View File

@ -33,7 +33,6 @@
#include <modaut.h>
#include <progind.h>
#include <relation.h>
#include <tabutil.h>
#include <sheet.h>
#include "../cg/cg2101.h"
@ -95,8 +94,6 @@ class TContabilizzazione_effetti_app : public TSkeleton_application
*_clifo, // file dei clienti
*_doc, // file dei documenti
*_pcon; // file piano dei conti
TTable *_cpg, // tabella condizioni di pagamento
*_bnp; // tabella banca presentazione effetti
TBill _banca, // conto di contropartita della banca
_cliente, // conto di contropartita del cliente
_trandiffcam; // conto di transizione per differenze cambi
@ -242,6 +239,7 @@ void TContabilizzazione_effetti_app::build_dist_sheet()
char tipo_prec = rec.get_char(EFF_TIPODIST);
TString16 codabi, codcab, codval;
char tipocf;
bool enabled = TRUE;
int num_eff = 0;
@ -259,6 +257,8 @@ void TContabilizzazione_effetti_app::build_dist_sheet()
t->add(codabi);
t->add(codcab);
t->add(codval);
t->add(tipocf);
t->add(rec.get(EFF_DATADIST));
const long pos = _dist_sheet->add(t); //aggiunge una riga allo sheet delle distinte
_dist_sheet->enable_row(pos, enabled);
ndist_prec = ndist;
@ -271,6 +271,7 @@ void TContabilizzazione_effetti_app::build_dist_sheet()
codabi = rec.get(EFF_CODABIP); // Memorizza dati della prima riga
codcab = rec.get(EFF_CODCABP);
codval = rec.get(EFF_CODVAL);
tipocf = rec.get_char(EFF_TIPOCF);
}
num_eff++; // numero di effetti che compongono la distinta
enabled &= !rec.get_bool(EFF_EFFCONT);
@ -284,6 +285,8 @@ void TContabilizzazione_effetti_app::build_dist_sheet()
t->add(codabi);
t->add(codcab);
t->add(rec.get(EFF_CODVAL));
t->add(rec.get(EFF_TIPOCF));
t->add(rec.get(EFF_DATADIST));
const long pos = _dist_sheet->add(t); //aggiunge una riga allo sheet delle distinte
_dist_sheet->enable_row(pos, enabled);
@ -348,14 +351,12 @@ bool TContabilizzazione_effetti_app::create()
_error = no_error;
_can_write = TRUE;
_msk = new TContabilizzazione_mask();
_cpg = new TTable("%CPG");
_bnp = new TTable("BNP");
_clifo = new TLocalisamfile(LF_CLIFO);
_doc = new TLocalisamfile(LF_DOC);
_distinta = new TDistinta;
_movimento = new TMovimentoPN;
_dist_sheet = new TArray_sheet(-1, -1, -4, -4, "Selezione distinte",
"@1|Tipo|Numero distinta@R|Numero effetti@R|ABI@5|CAB@5|Valuta");
"@1|Tipo|Numero distinta@R|Numero effetti@R|ABI@5|CAB@5|Valuta|C/F|Data Dist.");
_part_array = new TPartite_array;
return TSkeleton_application::create();
}
@ -363,8 +364,6 @@ bool TContabilizzazione_effetti_app::create()
bool TContabilizzazione_effetti_app::destroy()
{
if (_msk) delete _msk;
if (_cpg) delete _cpg;
if (_bnp) delete _bnp;
if (_clifo)delete _clifo;
if (_doc)delete _doc;
if (_caus) delete _caus;
@ -413,6 +412,13 @@ void TContabilizzazione_effetti_app::main_loop()
_dett_rate_att = _msk->get_bool(F_DETT_RATE_ATT);
_dett_rate_pas = _msk->get_bool(F_DETT_RATE_PAS);
// Salva parametri per la prossima volta
{
TConfig conf(CONFIG_DITTA, "ef");
conf.set("DETRATATT", _dett_rate_att ? "X" : "");
conf.set("DETRATPAS", _dett_rate_pas ? "X" : "");
}
contabilize();
_msk->reset(F_DISTINTE);
build_dist_sheet();
@ -701,30 +707,40 @@ error_type TContabilizzazione_effetti_app::search_bank_counter_bill(int tipopag)
_error = no_error;
if (tipopag == 0) // cerca sulla tabella e poi sulla 2a riga di causale
{
_banca.set(0,0,0); // resetta il conto...
TString16 codtab(_distinta->abip());
codtab << _distinta->cabp();
const char tipodist = _distinta->tipodist();
_banca.set(0,0,0); // resetta il conto...
_bnp->put("CODTAB",codtab);
if (_bnp->read() == NOERR)
{
TString16 fg("I0"),fc("I1"),fs("I2"); // nel caso tipodist == DIST_INCASSO
if (tipodist == DIST_SBF)
const TRectype& bnp = cache().get("BNP", codtab);
if (!bnp.empty())
{
const char* fg;
const char* fc;
const char* fs;
const char tipodist = _distinta->tipodist();
switch (tipodist)
{
fg = "I3";
fc = "I4";
fs = "I5";
}
else
if (tipodist == DIST_SCONTO)
{
fg = "I6";
fc = "I7";
fs = "I8";
case DIST_SBF:
fg = "I3"; fc = "I4"; fs = "I5";
break;
case DIST_SCONTO:
fg = "I6"; fc = "I7"; fs = "I8";
break;
case DIST_INCASSO: // Default
default:
if (_distinta->tipocf() == 'F')
{
fg = "I9"; fc = "I10"; fs = "I11";
}
const int g = _bnp->get_int(fg);
const int c = _bnp->get_int(fc);
const long s = _bnp->get_long(fs);
else
{
fg = "I0"; fc = "I1"; fs = "I2";
}
break;
}
const int g = bnp.get_int(fg);
const int c = bnp.get_int(fc);
const long s = bnp.get_long(fs);
_banca.set(g,c,s);
}
// se non ha trovato la banca oppure il conto, verifica che vi sia
@ -1460,13 +1476,7 @@ void TContabilizzazione_effetti_app::contabilize()
}
}
if (_total_bills > 0)
{
TConfig conf(CONFIG_DITTA, "ef");
conf.set("DETRATATT", _dett_rate_att ? "X" : "");
conf.set("DETRATPAS", _dett_rate_pas ? "X" : "");
message_box("Totale effetti contabilizzati: %ld",_total_bills);
}
}
int ef0800 (int argc, char* argv[])

View File

@ -328,6 +328,7 @@ bool http_get(const char* server,
if (ok)
{
ok = client.HttpGetFile(connection, remote_file, local_file, authorization) != 0;
client.RemoveConnection(connection);
}
@ -356,28 +357,20 @@ bool http_dir(const char* server, const char* remote_dir, TString_array& list)
bool http_post(const char* server, const char* remote_file,
const char* local_file, const char* authorization,
byte*& answer, size_t& length)
{
TSocketClient client;
if (!client.IsOk())
return error_box("Impossibile inizializzare il client HTTP");
TString srv = server;
TString port = "80";
const int colon = srv.rfind(':');
if (colon > 0 && isdigit(srv[colon+1]))
{
port = srv.mid(colon+1);
srv.cut(colon);
}
unsigned long connection = client.QueryConnection(port, srv);
unsigned long connection = client.QueryConnection("80", server);
bool ok = connection != 0;
if (ok)
{
ok = client.HttpPostFile(connection, remote_file, local_file, authorization) != 0;
client.RemoveConnection(connection);
answer = client.GetBuffer(length);
if (!ok)
{
error_box("Impossibile spedire il file %s al server %s:\n%s",
@ -389,4 +382,3 @@ bool http_post(const char* server, const char* remote_file,
return ok;
}

View File

@ -31,4 +31,5 @@ bool http_post(const char* server, const char* remote_file,
const char* local_file, const char* authorization,
byte*& answer, size_t& length);
#endif

View File

@ -611,6 +611,7 @@ TConnection* TSocketClient::OnQueryConnection(const char* service, const char* s
pConnection = NULL;
}
return pConnection;
}
@ -677,14 +678,20 @@ void TSocketClient::ReleaseBuffer()
}
bool TSocketClient::HttpGetFile(CONNID id, const char* remote, const char* local, const char* authorization)
{
bool ok = FALSE;
TString buf(4096);
buf << "GET " << remote << " HTTP/1.0\r\n\r\n";
buf << "GET " << remote << " HTTP/1.0\r\n"
<< "User-Agent: Campo\r\n";
if (authorization && *authorization)
buf << "Authorization: " << authorization << "\r\n";
buf << "\r\n";
if (WriteLine(id, buf))
{
const clock_t start = clock();
@ -694,7 +701,7 @@ bool TSocketClient::HttpGetFile(CONNID id, const char* remote, const char* local
ReadLine(id, buf);
if (buf.blank())
break;
if (r == 0 && (buf.find("400") > 0 || buf.find("404")))
if (r == 0 && buf.find("200 OK") < 0)
return FALSE; // File not found
if (buf.compare("Content-length:", 15, TRUE) == 0)
{
@ -707,6 +714,7 @@ bool TSocketClient::HttpGetFile(CONNID id, const char* remote, const char* local
{
buf.cut(0) << remote << " - " << (size / 1024 + 1) << " KBytes";
TProgind pi(size, buf, TRUE, TRUE);
long total = 0;
skstream* cur_socket = ((TSocket_connection*)GetConnection(id))->GetSocket();
@ -866,13 +874,39 @@ bool TSocketClient::HttpPostFile(CONNID id, const char* remote, const char* loca
}
conn->ReadLine(buf);
ok = buf.find("200 OK") >= 0;
ReleaseBuffer();
m_dwSize = buf.len()+1;
m_pData = new BYTE[m_dwSize];
memcpy(m_pData, buf, (size_t)m_dwSize);
if (ok)
{
unsigned long size = 0;
for (int r = 0; !cur_socket->eof(); r++)
{
cur_socket->getline(buf.get_buffer(), buf.size(), '\n');
if (buf.blank())
break;
if (buf.compare("Content-length:", 15, TRUE) == 0)
{
const int colon = buf.find(':');
size = atol(buf.mid(colon+1));
}
}
ReleaseBuffer();
ok = size > 0;
if (ok)
{
m_dwSize = size;
m_pData = new BYTE[m_dwSize+1];
memset(m_pData, 0, size_t(m_dwSize+1));
cur_socket->read(m_pData, (size_t)m_dwSize);
}
}
else
{
ReleaseBuffer();
m_dwSize = buf.len()+1;
m_pData = new BYTE[m_dwSize];
memcpy(m_pData, buf, (size_t)m_dwSize);
}
}
return ok;
}

View File

@ -52,8 +52,9 @@ public:
bool HttpSoap(CONNID id, const char* query);
bool HttpPostFile(CONNID id, const char* remote, const char* local, const char* authorization = NULL);
TSocketClient();
virtual ~TSocketClient();
};
#endif
#endif

View File

@ -33,14 +33,6 @@ bool TMask_buildmov::handle_annoes(TMask_field &fld, KEY k)
if (fld.to_check(k) || k == K_ENTER)
{
TConfig prassid(CONFIG_DITTA, "Euro");
TDate adozione = prassid.get("DataAdozione");
if (adozione.ok())
{
TEsercizi_contabili esc;
const int anno = esc.date2esc(adozione);
if (mask.get_int(F_ANNOES) < anno)
return fld.error_box("Impossibile effettuare la ricostruzione saldi su\n un esercizio precedente alla data adozione Euro") ;
}
if (mask.esercizi.exist(mask.get_int(F_ANNOES)))
{
const TEsercizio & e=mask.esercizi.esercizio(mask.get_int(F_ANNOES));

View File

@ -479,10 +479,8 @@ void TStampa_datistorici::setprint_perarticoli()
darec.put("ANNOES",_mask->get(F_ANNOES));
darec.put("CODMAG",_mask->get(F_DAMAG));
// darec.put("CODART",_mask->get(F_DAART));
arec.put("ANNOES",_mask->get(F_ANNOES));
arec.put("CODMAG",_mask->get(F_AMAG));
// arec.put("CODART",_mask->get(F_AART));
const bool order_by_group = subordine == 'M' || subordine == 'S';
@ -518,9 +516,6 @@ void TStampa_datistorici::setprint_perarticoli_all()
char filtro_articoli=*_mask->get(F_FILTRO);
char subordine=*_mask->get(F_ORDINEART);
//_form = filtro_articoli == 'T' ?
// new TForm_giacprezzi("mg3100aa", "") :
// new TForm_giacprezzi("mg3100a", "");;
_form = new TForm_giacprezzi("mg3100aa", "");
// ********************
// range di stampa magazzini
@ -646,7 +641,7 @@ void TStampa_datistorici::setprint_perarticoli_all()
_form->set_codlistino(_mask->get(F_CATVENLISTINO),_mask->get(F_CODLISTINO));
joinexp << "ANNOES==" << _mask->get(F_ANNOES) << "|CODART==CODART";
joinexp << "ANNOES==\"" << _mask->get(F_ANNOES) << "\"|CODART==CODART";
TSortedfile *mag;
// !?!?!! ATTENZIONE : Modifica temporanea

View File

@ -345,7 +345,7 @@ void TStampa_disp::setprint_perarticoli()
_mask->get_bool(F_DETTAGLIOMAG));
joinexp << "ANNOES==" << _mask->get(F_ANNOES) << "|CODART==CODART";
joinexp << "ANNOES==\"" << _mask->get(F_ANNOES) << "\"|CODART==CODART";
TSortedfile *mag;
// !?!?!! ATTENZIONE : Modifica temporanea

View File

@ -757,7 +757,8 @@ void TStampa_schede_mag::setprint_permagazzini()
TLocalisamfile *mag=new TLocalisamfile(LF_MAG);
mag->setkey(2);
TString mag_joinexp;
mag_joinexp << "ANNOES==" << _mask->get(F_ANNOES) << "|CODMAG==CODMAG|CODART==CODART|LIVELLO==LIVGIAC";
mag_joinexp << "ANNOES==\"" << _mask->get(F_ANNOES) << "\"|CODMAG==CODMAG|CODART==CODART|LIVELLO==LIVGIAC";
_cur->relation()->replace(mag,1,mag_joinexp);
_cur->setfilter(cfilter,TRUE);
_cur->setregion(darec,arec,0x2);
@ -865,7 +866,7 @@ void TStampa_schede_mag::setprint_perarticoli()
TLocalisamfile *mag=new TLocalisamfile(LF_MAG);
mag->setkey(2);
TString mag_joinexp;
mag_joinexp << "ANNOES==" << _mask->get(F_ANNOES) << "|CODMAG==CODMAG|CODART==CODART|LIVELLO==LIVGIAC";
mag_joinexp << "ANNOES==\"" << _mask->get(F_ANNOES) << "\"|CODMAG==CODMAG|CODART==CODART|LIVELLO==LIVGIAC";
_cur->relation()->replace(mag,2,mag_joinexp);
if (cfilter.not_empty())
@ -1007,4 +1008,4 @@ int mg3300(int argc, char* argv[])
TStampa_schede_mag a;// derivata da Application e con uso di form
a.run(argc,argv,"Stampa schede di magazzino");
return 0;
}
}

View File

@ -502,7 +502,7 @@ bool TStampa_inventario::calcola_giacenze(const bool b)
TArticolo_giacenza_data art_giac;
const TEsercizi_contabili esc;
const int anno = esc.date2esc(data_limite);
TString16 annoes; annoes << anno;
TString16 annoes; annoes.format("%04d", anno);
TString msg;
msg << "Elaborazione saldi al " << data_limite << " ...";
@ -909,7 +909,6 @@ void TStampa_inventario::setprint_perarticoli_all()
break;
case 'R':
{
//TString filter_expr;
_form->set_ordering(mg_ragg_fisc);// Setta la subsection in modo da raggruppare per RAGGFIS
_form->use_alternate_cursor();
_cur = _form->cursor(); // Setta il cursore sortato per questo ordinamento... siccome non esiste una chiave RAGGFIS+CODART
@ -941,14 +940,10 @@ void TStampa_inventario::setprint_perarticoli_all()
_mask->get_bool(F_RAGGCODICE),_mask->get_int(F_FROMLIVELLOART),_mask->get_int(F_TOLIVELLOART),
_mask->get_bool(F_RAGGLIVGIAC),_mask->get_int(F_FROMLIVELLOGIAC),_mask->get_int(F_TOLIVELLOGIAC),
_mask->get_bool(F_TOTALIMAGAZZINI),_mask->get_bool(F_DETTAGLIOMAG));
/* if (*_mask->get(F_FILTRO)=='N')
_form->find_field('B',odd_page,"TOT_DEPOSITO").setcondition("GIAC!=0");
if (*_mask->get(F_FILTRO)=='+')
_form->find_field('B',odd_page,"TOT_DEPOSITO").setcondition("GIAC>0");
*/
joinexp << "ANNOES==" << _mask->get(F_ANNOES) << "|CODART==CODART";
joinexp << "ANNOES==\"" << _mask->get(F_ANNOES) << "\"|CODART==CODART";
TSortedfile *mag;
TRelation *rel = NULL;
@ -1084,4 +1079,4 @@ int mg4200(int argc, char* argv[])
TStampa_inventario a;
a.run(argc,argv,"Stampa inventario");
return 0;
}
}

View File

@ -11,6 +11,7 @@ int main(int argc,char** argv)
case 2: sc2300(argc,argv); break; // Stampa Scaduto
case 3: sc2400(argc,argv); break; // Stampa Solleciti
case 4: sc2500(argc,argv); break; // Confronto saldi contabili con saldaconto
case 5: sc2600(argc,argv); break; // Stampa Prospetto Scadenze
default: sc2100(argc,argv); break; // Stampa Estratti conto
}
exit(0);

View File

@ -4,5 +4,5 @@ int sc2200(int argc, char** argv);
int sc2300(int argc, char** argv);
int sc2400(int argc, char** argv);
int sc2500(int argc, char** argv);
int sc2600(int argc, char** argv);

949
sc/sc2600.cpp Executable file
View File

@ -0,0 +1,949 @@
#include <config.h>
#include <currency.h>
#include <printapp.h>
#include <utility.h>
#include "../cg/cgsaldac.h"
#include "../cg/cglib02.h"
#include "sc2.h"
#include "sc2201.h"
#include "sc2600.h"
#include <clifo.h>
#include <nditte.h>
#include <pconti.h>
///////////////////////////////////////////////////////////
// Stampa prospetto scadenze
///////////////////////////////////////////////////////////
#define NUMERO_FASCE 5
#define LIMITI {30,60,90,120,150,30,60,90,120,150}
enum tipo_st {clienti=0, fornitori=1, altri=2};
class TLineTotal : public TObject //Oggetto di base per i TAssoc_array dei totali
{
public:
real _s1;// Scaglione 1 scaduto
real _s2;// Scaglione 2 scaduto
real _s3;// Scaglione 3 scaduto
real _s4;// Scaglione 4 scaduto
real _s5;// Scaglione 5 scaduto
real _s6;// Scaglione 6 scaduto
real _ns1;// Scaglione 1 non scaduto
real _ns2;// Scaglione 2 non scaduto
real _ns3;// Scaglione 3 non scaduto
real _ns4;// Scaglione 4 non scaduto
real _ns5;// Scaglione 5 non scaduto
real _ns6;// Scaglione 6 non scaduto
real _es; // esposto
real _sl; // saldo
virtual TObject* dup() const { return new TLineTotal(*this); }
virtual TLineTotal & copy(const TLineTotal & l);
TLineTotal(const TLineTotal* l) { copy(*l); }
TLineTotal();
};
TLineTotal & TLineTotal::copy(const TLineTotal & l)
{
_s1=l._s1;
_s2=l._s2;
_s3=l._s3;
_s4=l._s4;
_s5=l._s5;
_s6=l._s6;
_ns1=l._ns1;
_ns2=l._ns2;
_ns3=l._ns3;
_ns4=l._ns4;
_ns5=l._ns5;
_ns6=l._ns6;
_es=l._es;
_sl=l._sl;
return *this;
}
TLineTotal::TLineTotal()
{
_s1=ZERO;
_s2=ZERO;
_s3=ZERO;
_s4=ZERO;
_s5=ZERO;
_s6=ZERO;
_ns1=ZERO;
_ns2=ZERO;
_ns3=ZERO;
_ns4=ZERO;
_ns5=ZERO;
_ns6=ZERO;
_es=ZERO;
_sl=ZERO;
}
class TProspettoScadenze : public TPrintapp
{
TRelation *_rel1, *_rel2; // Relazioni di lavoro...
int _cur1, _cur2, // Identificatori dei cursori di lavoro...
_cur3, _cur4;
TSelection_ext_mask *_m;
TLocalisamfile *_scad,*_pagsca;
tipo_st _tipost; // Tipo di stampa impostato
bool _end_printed,
_stvaluta,
_ordcod, // VERO=ordine per codice, FALSO=ordine per ragione sociale
_sinfasce,
_nsinfasce;
TString _anno,_numdoc,_protiva,_datadoc,_codval,
_cod, _cod_pre, _des, _des_pre;
TDate _limop, _limscad, _datas, _limbf; // Data limite operazione, data limite scaduto e data di stampa
int _gcr, // Giorni per Calcolo Rischio (valido solo per stampa clienti)
_sfasce,
_nsfasce;
real _unsnc,_uns; // Unassigned per partita.
TArray _conti_cf, // array per conti mastro
_t, // Array per i totali
_ns_date, // Date per non scaduto
_s_date; // Date per lo scaduto
static TString _last_game;
static bool fil_function(const TRelation *);
public:
virtual bool preprocess_page(int file, int counter);
virtual bool preprocess_print(int file, int counter);
virtual print_action postprocess_print(int file, int counter);
virtual print_action postprocess_page(int file, int counter);
virtual void preprocess_header() {};
virtual bool user_create();
virtual bool user_destroy();
virtual bool set_print(int);
virtual void set_page (int file, int counter);
void print_totali_rows(int& nriga, bool what);
void print_totali(int& nriga);
void print_header();
void update_totals(bool what, real& esp,
real& s1,real& s2,real& s3,real& s4,real& s5, real& s6,
real& ns1,real& ns2,real& ns3,real& ns4,real& ns5, real& ns6);
void compute_unassigned(TPartita& p);
void compute_all(TPartita& p, TBill& bill);
void print_real(TString& dest, const real& num);
void riempi_conti_mastro(const char cf);
void calcola_saldo();
TProspettoScadenze();
};
TString TProspettoScadenze::_last_game;
inline TProspettoScadenze& app() {return (TProspettoScadenze&)main_app();}
void TProspettoScadenze::print_real(TString& dest, const real& num)
{
const bool stampa_in_valuta = _stvaluta && !_codval.blank();
const TString& val = stampa_in_valuta ? _codval : EMPTY_STRING;
const TCurrency cur(num, val);
dest = cur.string(TRUE);
dest.right_just(13);
}
bool TProspettoScadenze::fil_function(const TRelation *r)
{
TRectype& part = r->curr(LF_PARTITE);
TString80 key;
key.format("%03d%03d%06ld%4d",
part.get_int(PART_GRUPPO), part.get_int(PART_CONTO),
part.get_long(PART_SOTTOCONTO), part.get_int(PART_ANNO));
key << part.get(PART_NUMPART);
const bool rt = key != _last_game;
if (rt)
_last_game = key;
return rt;
}
void TProspettoScadenze::update_totals(bool what, real& esp,
real& s1, real& s2, real& s3, real& s4, real& s5, real& s6,
real& ns1, real& ns2, real& ns3, real& ns4, real& ns5, real& ns6)
{
TAssoc_array& a = (TAssoc_array&) _t[what];
TLineTotal *ll = (TLineTotal *) a.objptr(_codval);
if (ll == NULL)
{
ll = new TLineTotal;
a.add(_codval, ll);
}
ll->_s1 += s1;
ll->_s2 += s2;
ll->_s3 += s3;
ll->_s4 += s4;
ll->_s5 += s5;
ll->_s6 += s6;
ll->_ns1 += ns1;
ll->_ns2 += ns2;
ll->_ns3 += ns3;
ll->_ns4 += ns4;
ll->_ns5 += ns5;
ll->_ns6 += ns6;
ll->_es += esp;
}
void TProspettoScadenze::compute_unassigned(TPartita& p)
{
TRecord_array& ra = p.unassigned();
_uns = ZERO; _unsnc = ZERO;
for (int r = ra.last_row(); r > 0; r = ra.pred_row(r))
{
const TRectype& rec = ra.row(r);
const TRiga_partite& sum = p.riga(rec.get_int(PAGSCA_NRIGP));
const char * field = (_stvaluta && sum.in_valuta() ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO);
if (sum.get_int(PART_TIPOMOV) == 2) // Is it a credit note ?
_unsnc += rec.get_real(field);
else
_uns += rec.get_real(field);
}
}
void TProspettoScadenze::compute_all(TPartita& p, TBill& bill)
{
real residuo, s1,s2,s3,s4,s5,s6,ns1,ns2,ns3,ns4,ns5,ns6,res_pagati,esposto;
compute_unassigned(p);
for (int r = p.last(); r > 0; r = p.pred(r)) // Browse all rows (partite)
{
const TRiga_partite& rp = p.riga(r);
// se la data di registrazione della partita ' > di _limop (data lim operazione)
// non deve scorrere le scadenze
const TDate data_reg(rp.get_date(PART_DATAREG));
if (data_reg > _limop) continue;
for (int n=rp.rate(); n > 0; n--) // Browse all rows (scadenze)
{
const TRiga_scadenze& rs = rp.rata(n);
const TDate d(rs.get_date(SCAD_DATASCAD));
const char* field = (_stvaluta && rs.in_valuta()) ? PAGSCA_IMPORTOVAL : PAGSCA_IMPORTO;
const char* sfield = (_stvaluta && rs.in_valuta()) ? SCAD_IMPORTOVAL : SCAD_IMPORTO;
const char ssez = rp.sezione();
TImporto scd,pag,bf,work_imp;
scd += TImporto(ssez,rs.get_real(sfield)); // Importo in scadenza...
pag += rs.importo_pagato(_stvaluta); // Quanto e' stato pagato per questa scadenza?
// Scorre le righe di pagamento per trovare la riga corripondente alla prima data pagamento
// di questa rata. Motivo: il primo pagamento delle rata corrente, effettuato tramite effetto
// (ai fini del calcolo B.F.) deve essere considerato con la data scadenza
const int lst = rs.last();
int prima_riga_pagamento = -1;
TDate first_date;// data relativa alla prima riga di pagamento
for (int pp = rs.first(); pp <= lst; pp = rs.succ(pp))
{
const TRiga_partite& sum = p.riga(pp);
TDate current_date(sum.get_date(PART_DATAPAG));
int tipo_pag = rs.get_int(SCAD_TIPOPAG);
if (tipo_pag>=2 && tipo_pag<=7) //Incasso tramite effetto
if (prima_riga_pagamento==-1 || first_date > current_date)
{
first_date = current_date;
prima_riga_pagamento = pp;
}
}
for (pp = rs.first(); pp <= lst; pp = rs.succ(pp)) // Browse all rows (pagamenti)
{
const TRectype pg = rs.row(pp);
const TRiga_partite& sum = p.riga(pp);
const char sez = sum.sezione();
const int tipomov = sum.get_int(PART_TIPOMOV);
// se tipomov e' 2 (Nota di credito assegnata)
// storna da scdz. In entrambi i casi si ha l'operatore +=, perche' nel TImporto e' gia'
// compresa la sezione opposta
if (tipomov==2)
{
work_imp = TImporto(sez,pg.get_real(field));
scd += work_imp;
pag -= work_imp;
}
if ((tipomov==3 || tipomov==5) && _tipost==clienti && _gcr!=0)
{
TDate data_pag(sum.get_date(PART_DATAPAG));
int tipo_pag = rs.get_int(SCAD_TIPOPAG);
if (tipo_pag>=2 && tipo_pag<=7 && data_pag.ok()) //Incasso tramite effetto
{
if (prima_riga_pagamento > -1 && prima_riga_pagamento == pp)
data_pag = d; // Se e' il primo pagamento(in ordine di data) di questa rata
// prende la data di scadenza relativa.
if (data_pag >= _limbf) // && data_pag <= _limscad)
bf += TImporto(sez,pg.get_real(field));
}
}
}
char norm='D';
if (_tipost == fornitori)
norm = 'A';
else
if (_tipost == altri && bill.find())
norm = bill.sezione();
pag.normalize((norm=='D') ? 'A' : 'D'); scd.normalize(norm); bf.normalize((norm=='D') ? 'A' : 'D');
real res,a,b; a = pag.valore(); b = scd.valore(); //buonf += bf.valore();
res = b - a;
if (_uns > ZERO) // Rettifica i pagamenti con i non assegnati (calcolo sul residuo: scadenza-pagamento)
{
real gap = (_uns > res ? res : _uns); // questo e' quanto manca per completare questa scadenza
a += gap;
_uns -= gap; // aggiorna la cache..
}
if (_unsnc > ZERO) // Rettifica le scadenze con le N.C non assegnate.
{
real gap = (_unsnc > b ? b : _unsnc);
b -= gap;
_unsnc -= gap;
}
res = b - a; // Scadenze - pagati = scaduto per questo gruppo di rate
if (b == ZERO) // Se le scadenze sono a zero, vuol dire che sono state stornate
res = ZERO; // da qualche nota di credito o non assegnato percio' non si ha residuo
if (res < ZERO) // Significa che l'importo pagato e' maggiore dell'importo in scadenza
{ // c'e' un residuo positivo, e quindi va memorizzato
res *= -1.0; // cambia il segno
res_pagati+= res; // Residui pagati in piu'
res = ZERO;
}
if (d > _limscad)
{
if (d > _limscad && d <= (TDate&)_ns_date[0])
ns1 += res;
if (d > (TDate&)_ns_date[0] && d <= (TDate&)_ns_date[1])
ns2 += res;
if (d > (TDate&)_ns_date[1] && d <= (TDate&)_ns_date[2])
ns3 += res;
if (d > (TDate&)_ns_date[2] && d <= (TDate&)_ns_date[3])
ns4 += res;
if (d > (TDate&)_ns_date[3] && d <= (TDate&)_ns_date[4])
ns5 += res;
if (d > (TDate&)_ns_date[4])
ns6 += res;
}
else
{
// Detrae dal residuo scaduto eventuali pagamenti in piu' effettuati
real gap = (res_pagati > res ? res : res_pagati);
res -= gap;
res_pagati -= gap;
}
if (d <= _limscad && d >= (TDate&)_s_date[0])
s1 += res;
if (d < (TDate&)_s_date[0] && d >= (TDate&)_s_date[1])
s2 += res;
if (d < (TDate&)_s_date[1] && d >= (TDate&)_s_date[2])
s3 += res;
if (d < (TDate&)_s_date[2] && d >= (TDate&)_s_date[3])
s4 += res;
if (d < (TDate&)_s_date[3] && d >= (TDate&)_s_date[4])
s5 += res;
if (d < (TDate&)_s_date[4])
s6 += res;
residuo += res;
}
bool sbf;
TImporto esp = rp.esposto(_stvaluta, _limscad, _limbf, sbf);
esposto += esp.valore();
}
// Aggiorna i totali...
if (s1!=ZERO || s2!=ZERO || s3!=ZERO || s4!= ZERO || s5!= ZERO || s6!=ZERO ||
ns1!=ZERO || ns2!=ZERO || ns3!=ZERO || ns4!= ZERO || ns5!= ZERO || ns6!=ZERO || esposto!=ZERO)
{
update_totals(0, esposto, s1, s2, s3, s4, s5, s6, ns1, ns2, ns3, ns4, ns5, ns6); // Singolo...
update_totals(1, esposto, s1, s2, s3, s4, s5, s6, ns1, ns2, ns3, ns4, ns5, ns6); // ...Generale
}
}
void TProspettoScadenze::calcola_saldo()
{
TAssoc_array& a = (TAssoc_array&) _t[0];
TLineTotal *ll = (TLineTotal *) a.objptr(_codval);
TSaldo saldo;
int g,c;
long s;
if (_tipost == altri)
{
}
else
{
s = atol(_cod_pre);
for (int i = 0; i < _conti_cf.items(); i++)
{
TToken_string& cf = (TToken_string&)_conti_cf[i];
g = cf.get_int(0);
c = cf.get_int(1);
TToken_string key;
key.add(g); key.add(c); key.add(s);
const TRectype& pc = cache().get(LF_PCON, key);
int indbil_conto = pc.get_int (PCN_INDBIL);
TDate dataini = TDate(1, 1, _limop.year());
saldo.data_limite_bilancio( 1, g, c, s, dataini, _limop, indbil_conto, FALSE);
ll->_sl += saldo.saldo();
}
// aggiorno il totale generale
TAssoc_array& at = (TAssoc_array&) _t[1];
TLineTotal *lt = (TLineTotal *) a.objptr(_codval);
lt->_sl += ll->_sl;
}
}
bool TProspettoScadenze::preprocess_page(int file, int counter)
{
if (file == LF_PARTITE)
{
const TRectype& curr = current_cursor()->curr(file);
TBill bill(curr);
const bool checked = _m->selected(bill);
if (!checked && !_end_printed) // Se non e' stato selezionato salta al prossimo record
return FALSE;
int nriga = 1;
if (_tipost == clienti || _tipost == fornitori)
{
const TRectype& clifo = current_cursor()->curr(LF_CLIFO);
_des = clifo.get(CLI_RAGSOC);
_cod = clifo.get(CLI_CODCF);
}
else
{
const TRectype& pcon = current_cursor()->curr(LF_PCON);
_des = pcon.get(PCN_DESCR);
_cod = pcon.get(PCN_GRUPPO);
_cod << " " << pcon.get(PCN_CONTO);
_cod << " " << pcon.get(PCN_SOTTOCONTO);
}
if (_cod != _cod_pre || _end_printed) // Controlla se e' cambiato il codice cli/fo/conto
{
reset_print();
if (_cod_pre != "") // stampa i totali del precedente solo se non e' la prima
{
//calcola_saldo();
TAssoc_array& sin_tot = (TAssoc_array&) _t[0];
if (sin_tot.items() > 0)
print_totali(nriga);
if (_end_printed)
{
TAssoc_array& gen_tot = (TAssoc_array&) _t[1];
if (gen_tot.items() > 0)
{
nriga++;
print_totali_rows(nriga,1);
}
return TRUE; // Go back, print and exit!
}
}
_des.trim();
_cod_pre = _cod;
_des_pre = _des;
}
if (curr.empty()) // Attenzione: Possono succedere anche queste cose!
return FALSE;
TPartita p(curr);
//Pesca gli estremi dalla prima riga di fattura, che non e' necessariamente la riga #1
const int r = p.prima_fattura();
if (r <= 0)
return TRUE; // se non ci sono fatture ... salta al prossimo
if (r > 0) //Skip next partita if no fatture!
{
TRiga_partite& rp = p.riga(r);
_anno = rp.get(PART_ANNO);
_anno.ltrim(2);
_numdoc = rp.get(PART_NUMDOC);
_protiva = rp.get(PART_PROTIVA);
_datadoc = (const char*) rp.get_date(PART_DATADOC);
_codval = (_stvaluta ? rp.get(PART_CODVAL): "");
if (_codval.empty()) _codval = " ";
// Now performing fulkrum...
compute_all(p, bill);
}
current_cursor()->repos(); // Very, very necessary...
}
return TRUE;
}
bool TProspettoScadenze::preprocess_print(int file, int counter)
{
return TRUE;
}
print_action TProspettoScadenze::postprocess_print(int file, int counter)
{
print_action rt = NEXT_PAGE;
if (!_end_printed)
if ((file == LF_PARTITE))
{
rt = REPEAT_PAGE;
_end_printed = TRUE;
}
return rt;
}
print_action TProspettoScadenze::postprocess_page(int file, int counter)
{
return NEXT_PAGE;
}
bool TProspettoScadenze::user_create()
{
_rel1 = new TRelation(LF_PARTITE);
_rel1->add(LF_CLIFO,"TIPOCF=TIPOC|CODCF=SOTTOCONTO",1);
_cur1 = add_cursor(new TCursor(_rel1));
_cur2 = add_cursor(new TSorted_cursor(_rel1,"UPPER(20->RAGSOC)||NUMPART","",1));
_rel2 = new TRelation(LF_PARTITE);
_rel2->add(LF_PCON,"GRUPPO=GRUPPO|CONTO=CONTO|SOTTOCONTO=SOTTOCONTO",1);
_cur3 = add_cursor(new TCursor(_rel2));
_cur4 = add_cursor(new TSorted_cursor(_rel2,"UPPER(19->DESCR)|ANNO|NUMPART","",1));
_scad = new TLocalisamfile(LF_SCADENZE);
_pagsca = new TLocalisamfile(LF_PAGSCA);
_t.add(new TAssoc_array);_t.add(new TAssoc_array);
for (int i = 0; i < NUMERO_FASCE; i++)
{
_s_date.add(new TDate);
_ns_date.add(new TDate);
}
TConfig conf (CONFIG_DITTA,"cg");
_m = new TSelection_ext_mask("sc2600a");
_m->enable(F_VALUTA,conf.get_bool("GesVal"));
enable_print_menu();
return TRUE;
}
bool TProspettoScadenze::user_destroy()
{
if (_rel1) delete _rel1;
if (_rel2) delete _rel2;
if (_scad) delete _scad;
if (_pagsca) delete _pagsca;
if (_m) delete _m;
_t.destroy();
_s_date.destroy();
_ns_date.destroy();
return TRUE;
}
void TProspettoScadenze::riempi_conti_mastro(const char cf)
{
_conti_cf.destroy();
TRelation rel = TRelation(LF_PCON);
TString80 filtro;
filtro.format("TMCF==\'%c\'", cf);
TCursor cur(&rel, filtro);
TToken_string gc(10);
for (cur=0; cur.pos() < cur.items(); ++cur)
{
const int g = cur.curr().get_int(PCN_GRUPPO);
const int c = cur.curr().get_int(PCN_CONTO);
gc.add(g,0);
gc.add(c,1);
_conti_cf.add(gc);
}
}
bool TProspettoScadenze::set_print(int)
{
const bool rt = _m->run() == K_ENTER;
if (rt)
{
reset_files();
reset_print();
if (_m->get_who() == 'P')
_tipost = altri;
else
{
if (_m->get_who() == 'C')
_tipost = clienti;
else
_tipost = fornitori;
riempi_conti_mastro(_m->get_who());
}
if (_m->get_key() == 1)
_ordcod = TRUE;
else
_ordcod = FALSE;
_end_printed = FALSE;
_gcr = _m->get_int(F_GIORNI);
_stvaluta = _m->get_bool(F_VALUTA);
_datas = (const char *)(_m->get(F_DATASTAMPA));
_limop = (const char *)(_m->get(F_DATAOPERAZIONE));
_limscad = (const char *)(_m->get(F_DATASCADUTO));
_limbf = _limscad - (long)_gcr; // Limite inferiore per le scadenze a Buon Fine.
_sinfasce = _m->get_bool(F_SCADINFASCE);
_sfasce = _m->get_int(F_SCADFASCE);
_nsinfasce = _m->get_bool(F_ASCADINFASCE);
_nsfasce = _m->get_int(F_ASCADFASCE);
_anno.cut(0);_numdoc.cut(0);_protiva.cut(0);_datadoc.cut(0);
_codval.cut(0);_cod.cut(0); _des.cut(0); _cod_pre.cut(0);
for (int it=0; it < _t.items(); it++)
{
TAssoc_array& aa = (TAssoc_array&) _t[it];
aa.destroy(); // Totali lineari (singolo e generale)
}
get_cursor(_cur1)->set_filterfunction(fil_function,TRUE);
get_cursor(_cur2)->set_filterfunction(fil_function,TRUE);
get_cursor(_cur3)->set_filterfunction(fil_function,TRUE);
get_cursor(_cur4)->set_filterfunction(fil_function,TRUE);
_last_game.cut(0);
TRectype filter_from(LF_PARTITE), filter_to(LF_PARTITE);
switch (_tipost)
{
case clienti:
case fornitori:
filter_from.put("TIPOC", _tipost == clienti ? "C" : "F");
filter_to = filter_from;
if (_ordcod) // Per codice...
{
select_cursor(_cur1);
get_cursor(_cur1)->setregion(filter_from, filter_to);
}
else // ... e ragione sociale
{
select_cursor(_cur2);
get_cursor(_cur2)->setregion(filter_from, filter_to);
}
add_file(LF_PARTITE);
add_file(LF_CLIFO,LF_PARTITE);
break;
case altri:
filter_to.put("TIPOC", "A"); // Sporco trucco per selezionare solo i conti
if (_ordcod) // Per codice...
{
select_cursor(_cur3);
get_cursor(_cur3)->setregion(filter_from, filter_to); // Filtro per i conti normali!
}
else // ... e descrizione
{
select_cursor(_cur4);
get_cursor(_cur4)->setregion(filter_from, filter_to); // Filtro per i conti normali!
}
add_file(LF_PARTITE);
add_file(LF_PCON,LF_PARTITE);
break;
default: break;
} // End of inner switch
int limiti[2][NUMERO_FASCE] = LIMITI;
int row = 0;
if (_tipost == fornitori)
row = 1;
for (int j = 0; j < NUMERO_FASCE; j++)
{
long inc = (long) limiti[row][j];
TDate* d = (TDate *)_s_date.objptr(j);
if (j < _sfasce)
*d = _limscad - inc;
else
*d = NULLDATE;
TDate* dns = (TDate *)_ns_date.objptr(j);
if (j < _nsfasce)
*dns = _limscad + inc;
else
*dns = NULLDATE;
}
} // End if
return rt;
}
void TProspettoScadenze::print_totali_rows(int& nriga, bool what)
// If what is 0 prints single total... else prints also general total
{
reset_print();
TAssoc_array& xassoc = (TAssoc_array&) _t[what];
TString_array as;
const int items = xassoc.items();
xassoc.get_keys(as);
as.sort();
for (int i=0; i < items; i++)
{
if (!what)
calcola_saldo();
TString k(as.row(i)); // Chiave di ordinamento(valuta)
TString value;
TLineTotal& v = (TLineTotal&)xassoc[k];
int pos = 60;
TString rw(255);
rw = "";
if (_sinfasce)
{
if (v._s1 != ZERO)
{
print_real(value, v._s1);
rw << format("@%dg%15s", pos, (const char*) value);
}
if (_sfasce >= 1)
pos = pos + 16;
if (v._s2 != ZERO)
{
print_real(value, v._s2);
rw << format("@%dg%15s", pos, (const char*) value);
}
if (_sfasce >= 2)
pos = pos + 16;
if (v._s3 != ZERO)
{
print_real(value, v._s3);
rw << format("@%dg%15s", pos, (const char*) value);
}
if (_sfasce >= 3)
pos = pos + 16;
if (v._s4 != ZERO)
{
print_real(value, v._s4);
rw << format("@%dg%15s", pos, (const char*) value);
}
if (_sfasce >= 4)
pos = pos + 16;
if (v._s5 != ZERO)
{
print_real(value, v._s5);
rw << format("@%dg%15s", pos, (const char*) value);
}
if (_sfasce >= 5)
pos = pos + 16;
}
if (v._s6 != ZERO)
{
print_real(value, v._s6);
rw << format("@%dg%15s", pos, (const char*) value);
}
pos = pos + 16;
if (_nsinfasce)
{
if (v._ns1 != ZERO)
{
print_real(value, v._ns1);
rw << format("@%dg%15s", pos, (const char*) value);
}
if (_nsfasce >= 1)
pos = pos + 16;
if (v._ns2 != ZERO)
{
print_real(value, v._ns2);
rw << format("@%dg%15s", pos, (const char*) value);
}
if (_nsfasce >= 2)
pos = pos + 16;
if (v._ns3 != ZERO)
{
print_real(value, v._ns3);
rw << format("@%dg%15s", pos, (const char*) value);
}
if (_nsfasce >= 3)
pos = pos + 16;
if (v._ns4 != ZERO)
{
print_real(value, v._ns4);
rw << format("@%dg%15s", pos, (const char*) value);
}
if (_nsfasce >= 4)
pos = pos + 16;
if (v._ns5 != ZERO)
{
print_real(value, v._ns5);
rw << format("@%dg%15s", pos, (const char*) value);
}
if (_nsfasce >= 5)
pos = pos + 16;
}
if (v._ns6 != ZERO)
{
print_real(value, v._ns6);
rw << format("@%dg%15s", pos, (const char*) value);
}
pos = pos + 16;
const real tot = v._s1+v._s2+v._s3+v._s4+v._s5+v._s6+v._ns1+v._ns2+v._ns3+v._ns4+v._ns5+v._ns6;
if (tot != ZERO)
{
print_real(value, tot);
rw << format("@%dg%15s", pos, (const char*) value);
}
pos = pos + 16;
if (v._es != ZERO)
{
print_real(value, v._es);
rw << format("@%dg%15s", pos, (const char*) value);
}
pos = pos + 16;
if (v._sl != ZERO)
{
print_real(value, v._sl);
rw << format("@%dg%15s", pos, (const char*) value);
}
pos = pos + 16;
if (!what)
{
const real diff = tot - v._sl;
if (diff != ZERO)
{
print_real(value, diff);
rw << format("@%dg%15s", pos, (const char*) value);
}
}
if (rw.not_empty())
{
if (!what)
rw.insert(format("%6s@8g%s", (const char*) _cod_pre, (const char*) _des_pre));
else
rw.insert("TOTALE GENERALE");
set_row(nriga, rw);
}
}
xassoc.destroy(); // Distrugge il totale appena stampato
}
void TProspettoScadenze::print_totali(int& nriga)
{
reset_row(nriga);
//set_row(nriga++,"");
//reset_row(nriga);
print_totali_rows(nriga,0);
//set_row(++nriga,"");
//nriga++;
}
void TProspettoScadenze::print_header()
// Setta le righe dell'intestazione
{
int soh = 1;
const long firm = get_firm();
TString rw(255);
reset_header ();
TLocalisamfile ditte(LF_NDITTE);
ditte.zero();
ditte.put(NDT_CODDITTA, firm);
ditte.read();
if (ditte.bad()) ditte.zero();
TString s;
s = ditte.get(NDT_RAGSOC);
TString datas = _datas.string();
TString limop = _limop.string();
TString limscad = _limscad.string();
set_header (soh++, "Ditta : %ld %s@158gData@163g%s @190gPag. @#",
firm, (const char *)s, (const char *)datas);
switch (_tipost)
{
case fornitori:
case clienti:
{
TString s1,s2, s3;
int o = 0; // Offset per scaglioni.
if (_tipost==fornitori)
set_header(soh++,"@72g** PROSPETTO SCADENZE FORNITORI **");
else
set_header(soh++,"@73g** PROSPETTO SCADENZE CLIENTI **");
set_header (soh++,"@68gAl %s - Operazioni al %s",(const char*)limscad, (const char*)limop);
rw.cut(0);
rw.fill('-');
set_header(soh++, (const char *) rw);
set_header(soh,"CODICE@8gC O G N O M E E N O M E ");
int limiti[2][NUMERO_FASCE] = LIMITI;
int row = 0;
if (_tipost==fornitori)
row = 1;
int pos = 60;
rw = "";
if (_sinfasce)
{
rw << format("@%dg%15s", pos, "0 gg");
for (int i = 0; i < _sfasce; i++)
{
pos = pos + 16;
rw << format("@%dg%12d gg", pos, limiti[row][i]);
}
set_header(soh, format("@%dg%15s", 60+((pos-60)/2)-4, "SCADUTO"));
}
else
set_header(soh, format("@%dg%15s", pos, "SCADUTO"));
pos = pos + 16;
const int pos_ascad = pos;
if (_nsinfasce)
{
rw << format("@%dg%15s", pos, "0 gg");
for (int i = 0; i < _nsfasce; i++)
{
pos = pos + 16;
rw << format("@%dg%12d gg", pos, limiti[row][i]);
}
set_header(soh, format("@%dg%15s", pos_ascad+((pos-pos_ascad)/2)-5, "A SCADERE"));
}
else
set_header(soh, format("@%dg%15s", pos, "A SCADERE"));
pos = pos + 16;
set_header(soh, format("@%dg%15s", pos, "TOTALE"));
pos = pos + 16;
set_header(soh, format("@%dg%15s", pos, "ESPOSTO"));
pos = pos + 16;
set_header(soh, format("@%dg%15s", pos, "SALDO"));
pos = pos + 16;
set_header(soh, format("@%dg%15s", pos, "DIFFERENZA"));
set_header(++soh,(const char *)rw);
break;
}
case altri: // Piano dei conti
{
set_header(soh++,"@79g** SCADENZE **");
set_header (soh++,"@68gAl %s - Operazioni al %s",(const char*)limscad, (const char*)limop);
rw.fill('-');
set_header(soh++, (const char *) rw);
set_header(soh++,"CONTO@16gD E S C R I Z I O N E");
set_header(soh++,(const char *)rw);
break;
}
default:
break;
}
set_header(soh,"");
}
void TProspettoScadenze::set_page(int file, int counter)
{
print_header();
}
TProspettoScadenze::TProspettoScadenze()
{
_rel1=_rel2=NULL;
}
int sc2600(int argc, char** argv)
{
TProspettoScadenze app;
app.run(argc, argv, "Stampa Prospetto Scadenze");
return 0;
}

14
sc/sc2600.h Executable file
View File

@ -0,0 +1,14 @@
#include "scselmsk.h"
#define F_CODDITTA 101
#define F_RAGSOC 102
#define F_DATASTAMPA 103
#define F_DATAOPERAZIONE 104
#define F_DATASCADUTO 105
#define F_GIORNI 106
#define F_VALUTA 107
#define F_SCADINFASCE 201
#define F_SCADFASCE 202
#define F_ASCADINFASCE 203
#define F_ASCADFASCE 204

227
sc/sc2600a.uml Executable file
View File

@ -0,0 +1,227 @@
#include "sc2600.h"
PAGE "Stampa Prospetto Scadenze" -1 -1 78 20
NUMBER F_CODDITTA 5
BEGIN
PROMPT 2 1 "Cod. "
FLAGS "DFR"
USE LF_NDITTE
INPUT CODDITTA F_CODDITTA
OUTPUT F_RAGSOC RAGSOC
CHECKTYPE REQUIRED
END
STRING F_RAGSOC 50 46
BEGIN
PROMPT 14 1 "R.S. "
FLAGS "D"
END
GROUPBOX DLG_NULL 68 7
BEGIN
PROMPT 1 2 ""
END
DATE F_DATASTAMPA
BEGIN
PROMPT 2 3 "Data di stampa "
HELP "Data di stampa"
CHECKTYPE REQUIRED
WARNING "Si deve specificare la data di stampa"
FLAGS "A"
END
DATE F_DATAOPERAZIONE
BEGIN
PROMPT 2 4 "Data limite operazione "
HELP "Data limite operazione"
CHECKTYPE REQUIRED
FLAGS "A"
END
DATE F_DATASCADUTO
BEGIN
PROMPT 2 5 "Data limite scaduto "
HELP "Data limite scaduto"
CHECKTYPE REQUIRED
WARNING "Data limite scaduto non valida"
END
NUMBER F_GIORNI 3
BEGIN
PROMPT 2 6 "Giorni per calcolo rischio "
HELP "Inserire il numero di giorni per il calcolo del rischio"
END
BOOLEAN F_VALUTA
BEGIN
PROMPT 2 7 "Stampa in valuta"
HELP "Selezionare se si vuole la stampa in valuta"
END
RADIOBUTTON SC_CLIFO 20
BEGIN
PROMPT 1 9 "Selezione"
ITEM "C|Clienti" MESSAGE ENABLE, F_GIORNI|K_SPACE,SC_SORTCF
ITEM "F|Fornitori" MESSAGE DISABLE, F_GIORNI|K_SPACE,SC_SORTCF
//ITEM "P|Conti" MESSAGE DISABLE, F_GIORNI|K_SPACE,SC_SORTCF
END
RADIOBUTTON SC_SORTCF 29
BEGIN
GROUP 1
PROMPT 23 9 "Ordinamento"
ITEM "1|Per codice/conto"
ITEM "2|Per rag.soc./descrizione"
END
BUTTON SC_SELECT 10 1
BEGIN
PROMPT 55 10 "S~elezione"
END
BUTTON SC_RESET 10 1
BEGIN
PROMPT 55 11 "A~zzera"
END
NUMBER SC_CFCODFR 6
BEGIN
PROMPT 2 14 "Da codice "
FLAGS "B"
GROUP 3
END
NUMBER SC_CFCODTO 6
BEGIN
PROMPT 37 14 "a codice "
FLAGS "B"
GROUP 3
END
STRING SC_CFDESFR 50 40
BEGIN
PROMPT 2 14 "Da ragione sociale "
GROUP 4
FLAGS "HB"
END
STRING SC_CFDESTO 50 40
BEGIN
PROMPT 2 15 "A ragione sociale "
GROUP 4
FLAGS "HB"
END
NUMBER SC_PCONCODFR1 3
BEGIN
PROMPT 2 14 "Da conto "
GROUP 5
END
NUMBER SC_PCONCODFR2 3
BEGIN
PROMPT 15 14 ""
GROUP 5
END
NUMBER SC_PCONCODFR3 6
BEGIN
PROMPT 19 14 ""
FLAGS "B"
GROUP 5
END
NUMBER SC_PCONCODTO1 3
BEGIN
PROMPT 31 14 "a conto "
GROUP 5
END
NUMBER SC_PCONCODTO2 3
BEGIN
PROMPT 43 14 ""
GROUP 5
END
NUMBER SC_PCONCODTO3 6
BEGIN
PROMPT 47 14 ""
FLAGS "B"
GROUP 5
END
STRING SC_PCONDESFR 50 40
BEGIN
PROMPT 2 14 "Da descrizione "
GROUP 6
FLAGS "HB"
END
STRING SC_PCONDESTO 50 40
BEGIN
PROMPT 2 15 "A descrizione "
GROUP 6
FLAGS "HB"
END
NUMBER SC_NSEL 3
BEGIN
PROMPT 60 13 "N. "
FLAGS "D"
END
BOOLEAN F_SCADINFASCE
BEGIN
PROMPT 2 16 "Scaduto suddiviso in fasce"
HELP "Selezionare se si vuole la stampa scaduto suddiviso in fasce"
MESSAGE TRUE ENABLE,F_SCADFASCE
MESSAGE FALSE RESET,F_SCADFASCE|DISABLE,F_SCADFASCE
END
LISTBOX F_SCADFASCE 3
BEGIN
PROMPT 35 16 "Fino alla fascia "
ITEM "0|0"
ITEM "1|30"
ITEM "2|60"
ITEM "3|90"
ITEM "4|120"
ITEM "5|150"
END
BOOLEAN F_ASCADINFASCE
BEGIN
PROMPT 2 17 "A scadere suddiviso in fasce"
HELP "Selezionare se si vuole la stampa a scadere suddiviso in fasce"
MESSAGE TRUE ENABLE,F_ASCADFASCE
MESSAGE FALSE RESET,F_ASCADFASCE|DISABLE,F_ASCADFASCE
END
LISTBOX F_ASCADFASCE 3
BEGIN
PROMPT 35 17 "Fino alla fascia "
ITEM "0|0"
ITEM "1|30"
ITEM "2|60"
ITEM "3|90"
ITEM "4|120"
ITEM "5|150"
NUM_EXPR {#F_SCADFASCE+#F_ASCADFASCE<7}
WARNING "E' possibile selezionare massimo 6 fasce in totale"
END
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -12 -1 ""
MESSAGE EXIT,K_ENTER
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE
ENDMASK

View File

@ -49,6 +49,7 @@
#define H_DOC 166
#define F_AGGIORNA_TESTATA 167
#define F_ORDINA 168
#define F_PROTOCOLLO 169
#define F_CAMBIO 201
#define F_SCONTO 202

View File

@ -488,17 +488,20 @@ BEGIN
MESSAGE TRUE ENABLE,F_PROVVISORIO
END
GROUPBOX DLG_NULL 35 5
BOOLEAN F_PROVVISORIO 20
BEGIN
PROMPT 44 13 "@bTipo numerazione"
PROMPT 45 13 "Genera documento provvisorio"
FIELD B5
END
RADIOBUTTON F_PROVVISORIO 20
RADIOBUTTON F_PROTOCOLLO 1 38
BEGIN
PROMPT 44 13 ""
ITEM " |Definitiva"
ITEM "X|Provvisioria"
PROMPT 44 14 "@bProtocollo IVA"
ITEM " |Da numero documento"
ITEM "X|Da registro IVA"
FIELD B4
GROUP 3
END
BOOLEAN F_AGGIORNA_TESTATA
@ -691,4 +694,4 @@ END
ENDPAGE
ENDMASK
ENDMASK

View File

@ -592,6 +592,30 @@ BEGIN
GROUP 20
END
LIST F_GEN_EAN 2 10
BEGIN
PROMPT 2 17 "Genera il codice articolo con "
ITEM " |Nulla" MESSAGE ENABLE,F_EAN8|ENABLE,F_EAN13
ITEM "08|EAN 8" MESSAGE ENABLE,F_EAN8|CLEAR,F_EAN13
ITEM "13|EAN 13" MESSAGE CLEAR,F_EAN8|ENABLE,F_EAN13
FIELD GEN_EAN
END
NUMBER F_EAN8 4
BEGIN
PROMPT 45 17 "Prefisso : EAN 8 "
FIELD EAN8
FLAGS "Z"
END
NUMBER F_EAN13 6
BEGIN
PROMPT 67 17 "EAN 13 "
FIELD EAN13
FLAGS "Z"
END
ENDPAGE
ENDMASK

View File

@ -1,15 +1,15 @@
#define F_CODNUM 101
#define F_ANNO 102
#define F_PROVV 103
#define F_NCOPIE 104
#define F_CODNUM 121
#define F_ANNO 122
#define F_PROVV 123
#define F_NCOPIE 124
#define F_DATA_O_NUM 105
#define F_DATA_O_NUM 125
#define F_DA_NDOC 106
#define F_A_NDOC 107
#define F_DA_NDOC 126
#define F_A_NDOC 127
#define F_DA_DATADOC 108
#define F_A_DATADOC 109
#define F_DA_DATADOC 128
#define F_A_DATADOC 129
#define F_TIPOCF 110
#define F_CODFR 111
@ -26,4 +26,4 @@
#define GROUP_PRICES 29
#define GROUP_QTA 30
#define GROUP_IMPORTI 31
#define GROUP_IMPORTI 31

View File

@ -13,7 +13,9 @@
#include "..\cg\cglib01.h"
#include "..\mg\mglib.h"
#include "..\mg\stomag.h"
#include "..\mg\stomag.h"
#include "..\mg\anamag.h"
#include "..\mg\codcorr.h"
// maschera dell'anagrafica di magazzino
class TMask_anamag: public TMask {
@ -22,7 +24,12 @@ class TMask_anamag: public TMask {
TCodgiac_livelli * livelli_giac;// oggetto handler per i livelli di giacenza
TCodart_livelli * livelli_art;// oggetto handler per i livelli di anagraficca
int last_annogiac;
int last_annosto;
int last_annosto;
int _type_cod;
TString16 _ean8_pref;
TString16 _ean13_pref;
TString16 _generated_code;
TString16 _um_principale;
TMagazzini *_magazzini;
@ -37,6 +44,7 @@ class TMask_anamag: public TMask {
static bool notify_sheet_um(TSheet_field & s, int r, KEY k); // notify dello sheet delle unità di misura
static bool handle_sheet_deslin(TMask_field &, KEY); // handler dello sheet delle descrizioni in lingua
static bool handle_sheet_cod(TMask_field &, KEY); // handler dello sheet dei codici alternativi
static bool handle_codcorr(TMask_field &, KEY); // handler dello sheet dei codici alternativi
static bool notify_sheet_giac(TSheet_field & s, int r, KEY k); // notify delle giacenze
static bool handle_sheetgiac(TMask_field &, KEY); // handler dello sheet giacenze
static bool notify_sheet_sto(TSheet_field & s, int r, KEY k); // notify dello storico
@ -58,13 +66,16 @@ class TMask_anamag: public TMask {
int add_totali_storico(TString &codmag);
bool remove_totali_storico(TString & codmag);
void update_totali_storico(TString & codmag);
bool check_totali_storico();
bool check_totali_storico();
bool generate_code(int _type = 0);
public:
void update_ordc_ordf();
void set_parametered_fields();
void ricalcola_giacenze();
TString16 &um_principale() {return _um_principale;}
TString &generated_code() {return _generated_code;}
TString16 &um_principale() {return _um_principale;}
TMagazzini & magazzini() {return *_magazzini;}
TEsercizi_contabili &esercizi_contabili() {return *_esercizi_contabili;}
@ -204,35 +215,16 @@ void TMask_anamag::set_parametered_fields()
enable_page(PAGE_STORICO,gestmag);
// abilita la visualizzazione dei campi distinti per i livelli articolo
if (FALSE)
set_handler(F_CODART, handle_codice);
if (livelli_art->enabled())
{
field(F_CODART).hide();
field(F_GCA).hide();
for (int i=0; i<3; i++)
{
// versione con campi predefiniti sulla maschera
if (livelli_art->enabled(1+i)) {
field(F_LIVART1+i).show();
field(F_LIVART1+livelli_giac->last_level()-1).check_type(1+i==livelli_art->last_level() ? CHECK_NONE : CHECK_REQUIRED);
((TEdit_field&)field(F_LIVART1+livelli_giac->last_level()-1)).set_width(livelli_art->code_length(1+i));
set_handler(F_LIVART1+i, handle_livart);
} else {
field(F_LIVART1+i).hide();
field(F_LIVART1+livelli_giac->last_level()-1).check_type(CHECK_NONE);
}
}
} else {
if (livelli_art->enabled())
{
set_handler(F_CODART, handle_codice);
for (int i=0; i<9; i++)
field(F_LIVART1+i).hide();
if (!livelli_art->enabled(2))
field(F_GCA).hide();
} else
field(F_GCA).hide();
for (int i=0; i<9; i++)
field(F_LIVART1+i).hide();
if (!livelli_art->enabled(2))
field(F_GCA).hide();
}
else
field(F_GCA).hide();
}
// costruttore della maschera anagrafica di magazzino
@ -256,6 +248,9 @@ TMask_anamag::TMask_anamag(TRelation * rel) : TMask("ve2400")
set_handler(F_SHEETDESLIN, handle_sheet_deslin);
// sheet codici corrispondenti
set_handler(F_SHEETCOD, handle_sheet_cod);
TSheet_field &fc= sfield(F_SHEETCOD);
TMask &fmc = fc.sheet_mask();
fmc.set_handler(FS_CODARTALT, handle_codcorr);
livelli_giac = NULL;
livelli_art = NULL;
@ -298,6 +293,9 @@ TMask_anamag::TMask_anamag(TRelation * rel) : TMask("ve2400")
disable_user_page = FALSE;
}
}
_type_cod = c.get_int("GEN_EAN");
_ean8_pref = c.get("EAN8");
_ean13_pref = c.get("EAN13");
if (disable_user_page)
disable_page(PAGE_USER);
@ -383,12 +381,124 @@ bool TMask_anamag::handle_autoinsert_livgiac(TMask_field &fld, KEY k)
// HANDLER DEL CODICE: controlla la corrispondenza al formato previsto
bool TMask_anamag::generate_code(int type)
{
if (type == 0)
{
type = _type_cod;
if (type == 0)
return FALSE;
}
else
if (_type_cod != 0)
return FALSE;
TString cod(20);
TLocalisamfile anamag(LF_ANAMAG);
long progr = 0;
if (type == 8)
{
if (_ean8_pref.empty())
return FALSE;
cod = _ean8_pref;
cod << "999";
if (_type_cod != 0)
{
anamag.put(ANAMAG_CODART, cod);
if (anamag.read(_isgteq) != _isemptyfile)
{
cod = anamag.get(ANAMAG_CODART);
if (_ean8_pref < cod.left(4))
{
anamag.prev();
cod = anamag.get(ANAMAG_CODART);
}
if (_ean8_pref == cod.left(4))
progr = atol(cod.right(3));
}
}
else
{
TLocalisamfile codcorr(LF_CODCORR);
codcorr.setkey(2);
codcorr.put(CODCORR_CODARTALT, cod);
if (codcorr.read(_isgteq) != _isemptyfile)
{
cod = codcorr.get(CODCORR_CODARTALT);
if (_ean8_pref < cod.left(4))
{
codcorr.prev();
cod = codcorr.get(CODCORR_CODARTALT);
}
if (_ean8_pref == cod.left(4))
progr = atol(cod.right(3));
}
}
progr++;
_generated_code.format("%s%03ld", (const char *)_ean8_pref, progr);
}
else
{
if (_ean13_pref.empty())
return FALSE;
cod = _ean13_pref;
cod << "999999";
if (_type_cod != 0)
{
anamag.put(ANAMAG_CODART, cod);
if (anamag.read(_isgteq) != _isemptyfile)
{
cod = anamag.get(ANAMAG_CODART);
if (_ean13_pref < cod.left(6))
{
anamag.prev();
cod = anamag.get(ANAMAG_CODART);
}
if (_ean13_pref == cod.left(6))
progr = atol(cod.right(6));
}
}
else
{
TLocalisamfile codcorr(LF_CODCORR);
codcorr.setkey(2);
codcorr.put(CODCORR_CODARTALT, cod);
if (codcorr.read(_isgteq) != _isemptyfile)
{
cod = codcorr.get(CODCORR_CODARTALT);
if (_ean13_pref < cod.left(6))
{
codcorr.prev();
cod = codcorr.get(CODCORR_CODARTALT);
}
if (_ean13_pref == cod.left(6))
progr = atol(cod.right(6));
}
}
progr++;
_generated_code.format("%s%06ld", (const char *)_ean13_pref, progr);
}
return TRUE;
}
bool TMask_anamag::handle_codice(TMask_field &fld, KEY k)
{
TMask_anamag &mask=(TMask_anamag &)fld.mask();
TString codepart;
if (k == K_TAB && !fld.get().blank()) {
if (k == K_TAB && !fld.get().blank() && mask.livelli_art->enabled())
{
int l;
TTable _tabgrp("GCA");
for (l=1; l<mask.livelli_art->last_level(); l++) {
@ -411,6 +521,14 @@ bool TMask_anamag::handle_codice(TMask_field &fld, KEY k)
return(FALSE);
}
}
if (k == K_F8)
{
if (mask.generate_code())
{
fld.set(mask.generated_code());
mask.stop_run(K_INS);
}
}
return(TRUE);
}
@ -516,16 +634,6 @@ static bool in_handler = FALSE;
TMask_anamag &mask=(TMask_anamag &)fld.mask();
TSheet_field &fld_stomag= mask.sfield(F_SHEETSTOMAG);
/*if (mask.get_int(F_STOANNO) >=mask.esercizi_contabili().last())
{
fld.error_box("Impossibile dare la composizione delle rimanenze per l'ultimo anno");
mask.reset(F_STOANNO);
}*/
/* if (mask.get(F_STOANNO).empty() )
{
mask.set(F_STOANNORIF, mask.esercizi_contabili().last()) ;
mask.set(F_STOANNO, mask.get(F_STOANNORIF));
} */
if (mask.last_annosto>0 && mask.last_annosto!=fld.mask().get_int(F_STOANNO))
{
if ((fld_stomag.dirty() || mask.info_sto_dirty()) &&
@ -671,6 +779,21 @@ bool TMask_anamag::handle_sheet_cod(TMask_field &fld, KEY k)
return TRUE;
}
bool TMask_anamag::handle_codcorr(TMask_field &fld, KEY k)
{
if (k == K_F8)
{
TMask &m = fld.mask(); // prende la maschere d'origine del campo
TMask_anamag & mask = (TMask_anamag &) m.get_sheet()->mask();
char val = fld.mask().get(FS_TIPO)[0];
int type = val == '8' ? 8 : (val == '1' ? 13 : 0);
if (type > 0 && mask.generate_code(type))
fld.set(mask.generated_code());
}
return TRUE;
}
bool TMask_anamag::handle_sheetgiac(TMask_field &fld, KEY k)
{
if (k==K_ENTER)

View File

@ -49,7 +49,6 @@ class TContabilizzazione_app : public TApplication
TDate _data_ini; // data di inizio intervallo
TDate _data_fine; // data di fine intervallo
bool _auto_data; // se TRUE prende in automatico la data di registrazione dalla data documento
byte _nump_iva;
TMask *_msk; // maschera di selezione dati
TArray_sheet *_num_sheet; // Array sheet selezionabile dei codici numerazione
TString_array _tipi_doc; // Array di stringhe contenente i tipi documenti da elaborare
@ -276,7 +275,6 @@ bool TContabilizzazione_app::menu(MENU_TAG mt)
_data_fine = _msk->get_date(F_DATA_FIN);
_data_reg = _msk->get_date(F_DATA_REG);
_auto_data = _msk->get_bool(F_DATA_AUTO);
_nump_iva = _msk->get_int(F_SELPROT);
contabilize();
}
return FALSE;
@ -298,7 +296,6 @@ void TContabilizzazione_app::contabilize()
// Compone la lista dei documenti da elaborare
cont.set_auto(_auto_data); // Setta il flag per il settaggio automatico della data di registrazione del movimento
cont.set_nump(_nump_iva); // Setta il flag per il settaggio del numero di protocollo
da.put("DATADOC",_data_ini);
da.put("PROVV","D");

View File

@ -1,10 +1,10 @@
#include "ve6100a.h"
PAGE "Contabilizzazione documenti" -1 -1 78 14
PAGE "Contabilizzazione documenti" -1 -1 75 10
STRING F_CODICE_ELAB 8
BEGIN
PROMPT 2 2 "Codice elaborazione "
PROMPT 1 1 "Codice "
FLAG "U"
USE %ELD SELECT I0 == 3
INPUT CODTAB F_CODICE_ELAB
@ -12,13 +12,14 @@ BEGIN
DISPLAY "Descrizione@55" S0
OUTPUT F_CODICE_ELAB CODTAB
OUTPUT F_DESC_ELAB S0
OUTPUT F_SELPROT B4
CHECKTYPE REQUIRED
WARNING "E' necessario specificare il codice elaborazione"
END
STRING F_DESC_ELAB 50 39
STRING F_DESC_ELAB 50
BEGIN
PROMPT 35 2 ""
PROMPT 20 1 ""
USE %ELD KEY 2 SELECT I0 == 3
INPUT S0 F_DESC_ELAB
DISPLAY "Descrizione@55" S0
@ -28,40 +29,41 @@ END
GROUPBOX DLG_NULL 32 4
BEGIN
PROMPT 1 4 "Date intervallo documenti"
PROMPT 1 2 "Date intervallo documenti"
END
DATE F_DATA_INI
BEGIN
PROMPT 2 5 "Inizio "
PROMPT 2 3 "Inizio "
VALIDATE NOT_EMPTY_FUNC
WARNING "La data di inizio intervallo e' obbligatoria"
END
DATE F_DATA_FIN
BEGIN
PROMPT 2 6 "Fine "
PROMPT 2 4 "Fine "
VALIDATE NOT_EMPTY_FUNC
WARNING "La data di fine intervallo e' obbligatoria"
END
BOOLEAN F_DATA_AUTO
BEGIN
PROMPT 42 5 "Data registrazione automatica"
PROMPT 40 3 "Data registrazione automatica"
MESSAGE TRUE CLEAR,F_DATA_REG|"",F_DATA_REG
END
DATE F_DATA_REG
BEGIN
PROMPT 42 6 "Data registrazione "
PROMPT 40 4 "Data registrazione "
FLAG "D"
END
RADIOBUTTON F_SELPROT 1 32
RADIOBUTTON F_SELPROT 1 50
BEGIN
PROMPT 1 8 "Selezione numero protocollo"
ITEM "1|Da registro IVA"
ITEM "2|Da numero documento"
PROMPT 1 6 "Selezione numero protocollo"
ITEM " |Da numero documento"
ITEM "X|Da registro IVA"
FLAGS "DZ"
END
BUTTON DLG_OK 10 2

View File

@ -21,25 +21,23 @@
// Have you ever heard MK ?
#include <applicat.h>
#include <relation.h>
#include <tabutil.h>
#include <mask.h>
#include <sheet.h>
#include <progind.h>
#include <modaut.h>
#include <doc.h>
#include <progind.h>
#include <relation.h>
#include <sheet.h>
#include <tabutil.h>
#include <urldefid.h>
#include "velib.h"
#include "ve6300a.h"
#include <doc.h>
// TGenerazioneEffetti_app
// Applicazione di generazione effetti
class TGenerazioneEffetti_app : public TSkeleton_application
{
TString16 _cod_el; // codice elaborazione immesso
TDate _data_ini; // data di inizio intervallo
TDate _data_fine; // data di fine intervallo
bool _raggruppa; // se TRUE raggruppa gli effetti secondo i criteri
TMask *_msk; // maschera di selezione dati
TBit_array _valid_array; // array dei tipi di pagamento validi per la generazione di effetti
@ -72,6 +70,9 @@ protected: // TApplication
static bool handle_data_range(TMask_field& f, KEY k);
// Handler del pulsante di selezione codici numerazione
static bool handle_select(TMask_field& f, KEY k);
// Handler del campo numerazione
static bool handle_codnum(TMask_field& f, KEY k);
// Ritorna il TArray_sheet contenente le selezioni sui codici numerazione
TArray_sheet* get_num_sheet() const { return _num_sheet; }
// Costruisce lo sheet dei codici numerazione
@ -117,11 +118,28 @@ bool TGenerazioneEffetti_app::handle_data_range(TMask_field& f, KEY k)
bool TGenerazioneEffetti_app::handle_cod_eld(TMask_field& f, KEY k)
{
TMask& m = f.mask();
if (k == K_TAB && !m.is_running())
{
TEdit_field& e = (TEdit_field&)f;
TCursor& cur = *e.browse()->cursor();
if (cur.items() > 0)
{
cur = 0L;
const TRectype& eld = cur.curr();
app()._cod_el = eld.get("CODTAB");
f.set(app()._cod_el);
m.set(F_DESC_ELAB, eld.get("S0"));
app().build_num_sheet();
}
}
if (f.to_check(k) && k == K_TAB) // se e' cambiato ricostruisce anche lo sheet dei codici numerazione
{
app()._cod_el = f.get(); // aggiorna il codice elaborazione per la build_num_sheet()
f.mask().disable(DLG_OK);
app().build_num_sheet();
m.disable(DLG_OK);
}
return TRUE;
}
@ -130,12 +148,22 @@ bool TGenerazioneEffetti_app::handle_select(TMask_field& f, KEY k)
{
if (k == K_SPACE)
{
TMask& m = f.mask();
TArray_sheet* s = app().get_num_sheet();
if (s->run())
TArray_sheet& s = *app().get_num_sheet();
if (s.run())
{
if (s->checked() != 0) // Hai selezionato qualcosa ?
TMask& m = f.mask();
if (s.checked() > 0) // Hai selezionato qualcosa ?
{
// Cerca di proporre la prima numerazione possibile
for (long i = 0; i < s.items(); i++) if (s.checked(i))
{
TToken_string& row = s.row(i);
m.set(F_CODNUM, row.get(1));
m.set(F_DESCNUM, row.get());
break;
}
m.enable(DLG_OK); // allora abilita il pulsante di conferma
}
else
m.disable(DLG_OK);
}
@ -143,30 +171,97 @@ bool TGenerazioneEffetti_app::handle_select(TMask_field& f, KEY k)
return TRUE;
}
bool TGenerazioneEffetti_app::handle_codnum(TMask_field& f, KEY k)
{
TMask& m = f.mask();
if (k == K_F9)
return handle_select(m.field(DLG_USER), K_SPACE);
if (k == K_TAB && f.focusdirty() && !f.empty())
{
m.set(F_DESCNUM, cache().get("%NUM", f.get(), "S0"));
k = K_ENTER;
}
if (k == K_ENTER)
{
TArray_sheet& s = *app().get_num_sheet();
for (long i = 0; i < s.items(); i++) if (s.row_enabled(i))
{
TToken_string& row = s.row(i);
if (f.get() == row.get(1))
return TRUE;
}
return error_box("Numerazione non valida");
}
return TRUE;
}
void TGenerazioneEffetti_app::build_num_sheet()
{
_num_sheet->destroy();
_tipi_doc.destroy();
TTable num("%NUM");
TString s1,s2,s3;
TContabilizzazione* cont = new TContabilizzazione(_cod_el);
if (!cont->empty())
if (_cod_el.not_empty())
{
TToken_string t;
TString16 tipo;
_final_doc_status = cont->stato_finale()[0];
for (int i=0;i<TElaborazione::_max_tipi_doc_elab;i++)
TContabilizzazione* cont = new TContabilizzazione(_cod_el);
if (!cont->empty())
{
tipo = cont->tipo_iniziale(i);
if (tipo.not_empty())
{
t = tipo;
t.add(cont->stato_iniziale(i)); // Stato iniziale
_tipi_doc.add(t); // Aggiunge questo tipo documento alla lista
TToken_string t;
TString16 tipo;
_final_doc_status = cont->stato_finale()[0];
for (int i=0;i<TElaborazione::_max_tipi_doc_elab;i++)
{
tipo = cont->tipo_iniziale(i);
if (tipo.not_empty())
{
t = tipo;
t.add(cont->stato_iniziale(i)); // Stato iniziale
_tipi_doc.add(t); // Aggiunge questo tipo documento alla lista
}
}
long pos = 0l;
TTable num("%NUM");
for (num.first();num.good();num.next(),pos++) // scorre tutte le numerazioni possibili
{
TToken_string t,z;
t.add(" ");
t.add(num.get("CODTAB"));
t.add(num.get("S0"));
_num_sheet->add(t);
const TString& s2 = num.get("S2"); // reperisce i tipi documento validi per questa numerazione
for (int x = 0; x <= s2.len(); x += 4)
z.add(s2.mid(x,4));
bool found = FALSE;
for (int i = _tipi_doc.last(); !found && i >= 0; i--)
found |= z.find(((TToken_string &)_tipi_doc[i]).get(0)) >= 0;
if (found)
_num_sheet->enable_row(pos);
else
_num_sheet->disable_row(pos);
}
// Applica un filtro ai documenti da elaborare
TString filter;
for (int td = _tipi_doc.last(); td >= 0; td--)
{
TToken_string& row = _tipi_doc.row(td);
if (filter.not_empty())
filter << "||";
filter << "((" << DOC_TIPODOC << "==\"" << row.get(0) << "\")&&(";
filter << DOC_STATO << "==\"" << row.get(1) << "\"))" ;
}
_msk->efield(F_NDOC_INI).browse()->set_filter(filter);
_msk->efield(F_NDOC_FIN).browse()->set_filter(filter);
}
delete cont;
long pos = 0l;
@ -190,8 +285,8 @@ void TGenerazioneEffetti_app::build_num_sheet()
else
_num_sheet->disable_row(pos);
}
}
delete cont;
}
bool TGenerazioneEffetti_app::create()
@ -201,12 +296,15 @@ bool TGenerazioneEffetti_app::create()
error_box("Impossibile eseguire il programma se il modulo Effetti non e' abilitato");
return FALSE;
}
open_files(LF_TABCOM, LF_TAB, LF_CLIFO, LF_OCCAS, LF_INDSP, LF_CFVEN, LF_DOC, LF_RIGHEDOC, LF_ANAMAG, LF_MOVMAG, LF_RMOVMAG, LF_CONDV, LF_SVRIEP, LF_AGENTI, LF_PERCPROV, LF_CESS, LF_CAUSALI, 0);
open_files(LF_TABCOM, LF_TAB, LF_CLIFO, LF_OCCAS, LF_INDSP, LF_CFVEN,
LF_DOC, LF_RIGHEDOC, LF_ANAMAG, LF_MOVMAG, LF_RMOVMAG, LF_CONDV,
LF_SVRIEP, LF_AGENTI, LF_PERCPROV, LF_CESS, LF_CAUSALI, 0);
_msk = new TMask("ve6300a");
_msk->set_handler(F_CODICE_ELAB,handle_cod_eld);
_msk->set_handler(F_DATA_INI,handle_data_range);
_msk->set_handler(F_DATA_FIN,handle_data_range);
_msk->set_handler(DLG_USER,handle_select);
_msk->set_handler(F_CODICE_ELAB, handle_cod_eld);
_msk->set_handler(F_DATA_INI, handle_data_range);
_msk->set_handler(F_DATA_FIN, handle_data_range);
_msk->set_handler(F_CODNUM, handle_codnum);
_msk->set_handler(DLG_USER, handle_select);
_num_sheet = new TArray_sheet(-1,-1,-4,-4,"Codici numerazione",
"@1|Cod. numerazione|Descrizione@50");
return TSkeleton_application::create();
@ -224,8 +322,6 @@ void TGenerazioneEffetti_app::main_loop()
while (_msk->run() == K_ENTER)
{
_cod_el = _msk->get(F_CODICE_ELAB);
_data_ini = _msk->get_date(F_DATA_INI);
_data_fine = _msk->get_date(F_DATA_FIN);
_raggruppa = _msk->get_bool(F_RAGGRUPPA);
generate();
}
@ -360,10 +456,9 @@ void TGenerazioneEffetti_app::build_doc_key(TToken_string& key, TDocumento* doc)
}
void TGenerazioneEffetti_app::set_options()
{
TTable eld("%ELD");
eld.put("CODTAB",_cod_el);
if (eld.read() == NOERR)
{
const TRectype& eld = cache().get("%ELD", _cod_el);
if (!eld.empty())
{
TString s1;
s1.format("%-20s",(const char*)eld.get("S1")); // Forzo la sua lunghezza a 20 per evitare subscript errors
@ -381,105 +476,133 @@ void TGenerazioneEffetti_app::set_options()
void TGenerazioneEffetti_app::generate()
{
TRelation doc_rel(LF_DOC);
TRectype da(LF_DOC);
TRectype a(LF_DOC);
const long items = _num_sheet->items();
long tot = 0L;
int year_from = _data_ini.year();
int year_to = _data_fine.year();
TString16 codnum;
TString msg,filt_expr;
TGenerazione_effetti gen_eff(_cod_el);
TDate data;
_group_array.destroy();
set_options();
da.put("DATADOC",_data_ini);
da.put("PROVV","D");
da.put("ANNO",year_from);
a.put("DATADOC",_data_fine);
a.put("PROVV","D");
a.put("ANNO",year_to);
const bool sort_by_date = _msk->get_int(F_ORDERBY) == 0;
for (long i=0L; i<items;i++) // Scorre per tutte le numerazioni dello sheet
if (_num_sheet->checked(i)) // Se la numerazione corrente e' stata selezionata
{ // istanzia un cursore per la numerazione corrente, con i limiti di data
codnum = _num_sheet->row(i).get(1);
filt_expr = "CODNUM=\"";
filt_expr << codnum << "\"";
TCursor doc_cur(&doc_rel,filt_expr,3,&da,&a);
const long cur_items = doc_cur.items(); // Scorre tutti i documenti che rientrano nell'intervallo selezionato
if (cur_items == 0)
{
warning_box("Non vi sono effetti da generare per il codice numerazione %s",(const char*)codnum);
continue;
}
msg = "Selezione documenti ";
msg << codnum << " dal ";
msg << _data_ini.string() << " al ";
msg << _data_fine.string();
#ifdef DBG
TProgind p(cur_items,msg,TRUE,TRUE,1);
#else
TProgind p(cur_items,msg,FALSE,TRUE,1);
#endif
long j = 0;
// Comportamento:
// - scorre i documenti della numerazione corrente.
// - se e' possibile generare subito l'effetto (tipo di pagamento valido,
// stato documento valido e non e' abilitato il raggruppamento) lo fa,
// altrimenti compone una lista dei documenti da raggruppare
// - alla fine del ciclo per numerazioni scorre la lista residua e genera gli
// effetti rimasti
#ifdef DBG
for (;j<cur_items && !p.iscancelled();j++)
#else
for (;j<cur_items;j++)
#endif
{
p.setstatus(j+1);
doc_cur = j;
TDocumento* doc = new TDocumento;
if (doc->read(doc_cur.curr()) == NOERR && // legge il documento
codnum == doc->get(DOC_CODNUM) && // patch del cazzo
doc_tipo_stato_ok(doc)) // controlla che il tipo documento e lo stato siano coerenti con la ELD selezionata
{
TPagamento & pag = doc->pagamento();
if (pag.code().not_empty())
{
const bool raggruppabile = doc->get_bool(DOC_RAGGREFF);
if (!_raggruppa || (_raggruppa && !raggruppabile))
{
// Aggiunge alla lista degli effetti da generare singolarmente
TLista_documenti lista_in,lista_out;
{
const TString8 codnum = _num_sheet->row(i).get(1);
lista_in.add(doc);
if (!gen_eff.elabora(lista_in,lista_out,data)) // La data non serve, cosi' come la lista documenti in uscita
gen_eff.set_writeable(FALSE);
// Controlla se la numerazione corrente e' stata selezionata
bool is_selected = _num_sheet->row_enabled(i);
if (is_selected)
{
if (sort_by_date)
is_selected = _num_sheet->checked(i);
else
is_selected = _msk->get(F_CODNUM) == codnum;
}
if (!is_selected)
continue;
TString filt_expr;
int cursor_key = 0;
TRectype da(LF_DOC), a(LF_DOC);
da.put(DOC_PROVV,"D");
a.put(DOC_PROVV,"D");
if (sort_by_date)
{
cursor_key = 3;
const TDate dataini = _msk->get(F_DATA_INI);
da.put(DOC_ANNO,dataini.year());
da.put(DOC_DATADOC,dataini);
const TDate datafin = _msk->get(F_DATA_FIN);
a.put(DOC_ANNO,datafin.year());
a.put(DOC_DATADOC,datafin);
filt_expr << DOC_CODNUM << "=\"" << codnum << "\"";
}
else
{
cursor_key = 1;
da.put(DOC_ANNO, _msk->get(F_ANNO));
da.put(DOC_CODNUM, codnum);
da.put(DOC_NDOC, _msk->get(F_NDOC_INI));
a.put(DOC_ANNO, _msk->get(F_ANNO));
a.put(DOC_CODNUM, codnum);
a.put(DOC_NDOC, _msk->get(F_NDOC_FIN));
}
TCursor doc_cur(&doc_rel, filt_expr, cursor_key, &da, &a);
const long cur_items = doc_cur.items(); // Scorre tutti i documenti che rientrano nell'intervallo selezionato
if (cur_items == 0)
{
warning_box("Non vi sono effetti da generare per il codice numerazione %s",(const char*)codnum);
continue;
}
TString msg;
msg << "Selezione documenti " << codnum;
if (sort_by_date)
{
msg << " dal " << _msk->get(F_DATA_INI);
msg << " al " << _msk->get(F_DATA_FIN);
}
else
{
msg << " dal " << _msk->get(F_NDOC_INI);
msg << " al " << _msk->get(F_NDOC_FIN);
}
TProgind p(cur_items,msg,FALSE,TRUE);
long j = 0;
// Comportamento:
// - scorre i documenti della numerazione corrente.
// - se e' possibile generare subito l'effetto (tipo di pagamento valido,
// stato documento valido e non e' abilitato il raggruppamento) lo fa,
// altrimenti compone una lista dei documenti da raggruppare
// - alla fine del ciclo per numerazioni scorre la lista residua e genera gli
// effetti rimasti
for (;j<cur_items;j++)
{
p.setstatus(j+1);
doc_cur = j;
TDocumento* doc = new TDocumento;
if (doc->read(doc_cur.curr()) == NOERR && // legge il documento
codnum == doc->get(DOC_CODNUM) && // patch del cazzo
doc_tipo_stato_ok(doc)) // controlla che il tipo documento e lo stato siano coerenti con la ELD selezionata
{
TPagamento & pag = doc->pagamento();
if (pag.code().not_empty())
{
const bool raggruppabile = doc->get_bool(DOC_RAGGREFF);
if (!_raggruppa || (_raggruppa && !raggruppabile))
{
// Aggiunge alla lista degli effetti da generare singolarmente
TLista_documenti lista_in,lista_out;
lista_in.add(doc);
if (!gen_eff.elabora(lista_in,lista_out,data)) // La data non serve, cosi' come la lista documenti in uscita
gen_eff.set_writeable(FALSE);
tot += gen_eff.bills();
}
else
{
add_to_group_list(doc); // Aggiorna la lista degli effetti da raggruppare
delete doc;
}
tot += gen_eff.bills();
}
else
{
int err = change_doc_status(doc); // Cambia lo stato al documento
if (err != NOERR)
warning_box("Errore %d tentando di cambiare lo stato del documento %s/%d",err,(const char*)doc->numerazione(),doc->numero());
add_to_group_list(doc); // Aggiorna la lista degli effetti da raggruppare
delete doc;
}
}
else
{
int err = change_doc_status(doc); // Cambia lo stato al documento
if (err != NOERR)
warning_box("Errore %d tentando di cambiare lo stato del documento %s/%d",err,(const char*)doc->numerazione(),doc->numero());
delete doc;
}
}
#ifdef DBG
if (p.iscancelled()) break;
#endif
else
delete doc;
}
}
// Ogni elemento di _group_array è una TToken_string. Ogni elemento della TToken_string contiene
// la chiave per identificare il documento che fa parte di quel raggruppamento
tot += gen_eff.group_bills(_group_array);// Setta l'elenco dei documenti per generare effetti raggruppati
@ -495,4 +618,4 @@ int ve6300 (int argc, char **argv)
TGenerazioneEffetti_app a;
a.run(argc,argv,"Generazione effetti");
return TRUE;
}
}

View File

@ -5,3 +5,10 @@
#define F_DATA_INI 103
#define F_DATA_FIN 104
#define F_RAGGRUPPA 105
#define F_ORDERBY 106
#define F_ANNO 201
#define F_CODNUM 202
#define F_NDOC_INI 203
#define F_NDOC_FIN 204
#define F_DESCNUM 205

View File

@ -4,9 +4,9 @@ PAGE "Generazione effetti" -1 -1 78 12
STRING F_CODICE_ELAB 8
BEGIN
PROMPT 2 2 "Codice elaborazione "
PROMPT 1 1 "Codice elaborazione "
FLAG "U"
USE %ELD SELECT I0 == 5
USE %ELD SELECT I0==5
INPUT CODTAB F_CODICE_ELAB
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@55" S0
@ -16,38 +16,110 @@ BEGIN
WARNING "E' necessario specificare il codice elaborazione"
END
STRING F_DESC_ELAB 50 39
STRING F_DESC_ELAB 50 40
BEGIN
PROMPT 35 2 ""
USE %ELD KEY 2 SELECT I0 == 4
PROMPT 34 1 ""
USE %ELD KEY 2 SELECT I0==5
INPUT S0 F_DESC_ELAB
DISPLAY "Descrizione@55" S0
DISPLAY "Codice" CODTAB
COPY OUTPUT F_CODICE_ELAB
CHECKTYPE NORMAL
END
GROUPBOX DLG_NULL 32 4
RADIOBUTTON F_ORDERBY 1 76
BEGIN
PROMPT 1 4 "Date intervallo documenti"
PROMPT 1 2 "Sequenza di ordinamento"
ITEM "0|Per data documento"
MESSAGE SHOW,1@|HIDE,2@
ITEM "1|Per numero documento"
MESSAGE SHOW,2@|HIDE,1@
FLAGS "Z"
END
GROUPBOX DLG_NULL 76 5
BEGIN
PROMPT 1 5 "Intervallo documenti"
END
DATE F_DATA_INI
BEGIN
PROMPT 2 5 "Inizio "
VALIDATE NOT_EMPTY_FUNC
PROMPT 2 7 "Data iniziale "
CHECKTYPE REQUIRED
WARNING "La data di inizio intervallo e' obbligatoria"
GROUP 1
END
DATE F_DATA_FIN
BEGIN
PROMPT 2 6 "Fine "
VALIDATE NOT_EMPTY_FUNC
PROMPT 2 8 "Data finale "
CHECKTYPE REQUIRED
WARNING "La data di fine intervallo e' obbligatoria"
GROUP 1
END
NUMBER F_ANNO 4
BEGIN
PROMPT 2 6 "Anno "
CHECKTYPE REQUIRED
GROUP 2
FLAGS "A"
END
STRING F_CODNUM 3
BEGIN
PROMPT 14 6 "Numerazione "
FLAGS "BU"
CHECKTYPE REQUIRED
GROUP 2
END
STRING F_DESCNUM 50 40
BEGIN
PROMPT 34 6 ""
FLAGS "D"
GROUP 2
END
NUMBER F_NDOC_INI 7
BEGIN
PROMPT 2 7 "Documento iniziale "
USE LF_DOC
JOIN LF_CLIFO INTO TIPOCF==TIPOCF CODCF==CODCF
INPUT PROVV "D"
INPUT ANNO F_ANNO SELECT
INPUT CODNUM F_CODNUM SELECT
INPUT NDOC F_NDOC_INI
DISPLAY "Numero" NDOC
DISPLAY "Data@10" DATADOC
DISPLAY "Tipo" TIPOCF
DISPLAY "Codice" CODCF
DISPLAY "Ragione Sociale@50" LF_CLIFO->RAGSOC
OUTPUT F_NDOC_INI NDOC
CHECKTYPE REQUIRED
WARNING "Numero documento errato"
GROUP 2
END
NUMBER F_NDOC_FIN 7
BEGIN
PROMPT 2 8 "Documento finale "
COPY USE F_NDOC_INI
INPUT PROVV "D"
INPUT ANNO F_ANNO SELECT
INPUT CODNUM F_CODNUM SELECT
INPUT NDOC F_NDOC_FIN
COPY DISPLAY F_NDOC_INI
OUTPUT F_NDOC_FIN NDOC
CHECKTYPE NORMAL
WARNING "Numero documento errato"
GROUP 2
END
BOOLEAN F_RAGGRUPPA
BEGIN
PROMPT 35 6 "Raggruppa effetti"
PROMPT 1 10 "Raggruppamento effetti"
END
BUTTON DLG_OK 10 2

View File

@ -211,5 +211,8 @@
#define F_DEC_USER8 167
#define F_DEC_USER9 168
#define F_DEC_USER10 169
#define F_GEN_EAN 170
#define F_EAN8 171
#define F_EAN13 172
#endif

View File

@ -1078,7 +1078,7 @@ class TSaldo_agg;
class TContabilizzazione : public TElaborazione // velib04b
{
bool _auto_data; // Flag per data di registrazione automatica
byte _nump_iva; // se 1 prende il numero protocollo da registro iva, se 2 prende il numero protocollo dal numero doc.
bool _nump_iva; // se TRUE prende il numero protocollo da registro iva, se no prende il numero protocollo dal numero doc.
TDate _data_reg; // Data di registrazione documenti
long _total_docs;// Numero di documenti contabilizzati
error_type _error; // Errore rilevato durante l'elaborazione
@ -1192,7 +1192,6 @@ public:
virtual bool elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
const TDate& data_elab, bool interattivo = FALSE);
void set_auto(const bool a) { _auto_data = a; }
void set_nump(const byte n) { _nump_iva = n; }
void set_writeable(const bool b) { _can_write = b; }
const long processed_docs() const { return _total_docs; }
void inc_processed_docs() { _total_docs++; }

View File

@ -930,7 +930,7 @@ error_type TIVA_array::add(const TRiga_documento & r, const TBill& conto, const
TContabilizzazione::TContabilizzazione(const char* cod)
: TElaborazione(cod), _auto_data(FALSE), _nump_iva(2)
: TElaborazione(cod), _auto_data(FALSE)
{
_fcaus = new TLocalisamfile(LF_CAUSALI);
_frcaus = new TLocalisamfile(LF_RCAUSALI);// Per far andare TCausale
@ -961,8 +961,7 @@ TContabilizzazione::TContabilizzazione(const char* cod)
_clifo->add(LF_CFVEN,"TIPOCF=TIPOCF|CODCF=CODCF");
_righe_iva = new TIVA_array;
_nump_iva = get_bool("B4");
_can_write = TRUE;
_error = no_error;
_total_docs = 0L;
@ -970,7 +969,7 @@ TContabilizzazione::TContabilizzazione(const char* cod)
}
TContabilizzazione::TContabilizzazione(const TRectype& rec)
: TElaborazione(rec), _auto_data(FALSE), _nump_iva(2), _viswin(NULL)
: TElaborazione(rec), _auto_data(FALSE), _viswin(NULL)
{
_fcaus = new TLocalisamfile(LF_CAUSALI);
_frcaus = new TLocalisamfile(LF_RCAUSALI);// Per far andare TCausale
@ -1001,6 +1000,8 @@ TContabilizzazione::TContabilizzazione(const TRectype& rec)
_clifo->add(LF_CFVEN,"TIPOCF=TIPOCF|CODCF=CODCF");
_righe_iva = new TIVA_array;
_nump_iva = get_bool("B4");
_can_write = TRUE;
_error = no_error;
_total_docs = 0L;
@ -1307,6 +1308,7 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
ult_prot = mov.get_long(MOV_PROTIVA);
}
else
{
if (_nump_iva == 1) // Reperisce l'ultimo numero di protocollo dal registro IVA
{
@ -2503,7 +2505,8 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc)
const real totdoc(head.get(MOV_TOTDOC));
const real totdocval(head.get(MOV_TOTDOCVAL));
const bool in_valuta = cambio.in_valuta();
const TCurrency_documento td((in_valuta ? totdocval : totdoc) * (test_swap() ? -1 : 1), doc);
const bool swapped = test_swap();
const TCurrency_documento td((in_valuta ? totdocval : totdoc) * (swapped ? -1 : 1), doc);
partita.put(PART_IMPTOTDOC, totdoc);
@ -2518,8 +2521,8 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc)
TCurrency_documento totimposte(doc.imposta(TRUE), doc);
real imposte;
for (int j = _movimento->iva_items()-1; j >= 0; j--)
imposte += _movimento->iva(j).get_real(RMI_IMPOSTA);
for (int j = _movimento->iva_items()-1; j >= 0; j--)
imposte += _movimento->iva(j).get_real(RMI_IMPOSTA) * (swapped ? -1 : 1);
if (_caus->iva() == iva_acquisti) // Ricalcola precisamente il totale imposte
{
real ti = imposte;
@ -3869,6 +3872,6 @@ bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& /*
if (k == K_CTRL+'S') // Ho premuto Stampa
printer().print_txt(_viswin->text());
delete _viswin; _viswin = NULL;
return _can_write; // Se non ha riscontrato errori per nessun documento, _can_write = TRUE
}

View File

@ -85,7 +85,6 @@ TDocumento_mask::TDocumento_mask(const char* td)
set_handler( F_CODCAMP, codcamp_handler );
set_handler( F_CODVAL, codval_handler );
set_handler( F_CODVAL1, codval_handler );
set_handler( F_DATACAMBIO1, datacambio_handler );
set_handler( F_NUMDOCRIF, datadocrif_handler);
set_handler( F_DATADOCRIF, datadocrif_handler);
set_handler( DLG_ELABORA, elabora_handler );
@ -406,8 +405,6 @@ void TDocumento_mask::cli2mask()
TOccasionale & o = doc().occas();
const bool onload = !is_running();
const TString16 codval(get(F_CODVAL));
const TString16 datacambio(get(F_DATACAMBIO1));
// Setta i campi che appartengono al file LF_CLIFO
const bool occas = c.occasionale();
@ -431,10 +428,10 @@ void TDocumento_mask::cli2mask()
const TString & codval = c.get(CLI_CODVAL);
if (pos >= 0)
fld(pos).set(codval);
set(F_CODVAL, codval, TRUE);
pos = id2pos(F_CODVAL1);
if (pos >= 0)
fld(pos).set(codval);
set(F_CODVAL1, codval, TRUE);
pos = id2pos(F_CODLIN);
if (pos >= 0 && fld(pos).active())
fld(pos).set(c.get(CLI_CODLIN));
@ -503,7 +500,6 @@ void TDocumento_mask::cli2mask()
check_field( F_CODINDSP );
}
const TString16 newcodval(get(F_CODVAL));
const TString16 newdatacambio(get(F_DATACAMBIO1));
short pos = id2pos(F_CAMBIO);
if ((pos >= 0) && newcodval.empty())
@ -514,10 +510,6 @@ void TDocumento_mask::cli2mask()
pos = id2pos(F_CODVAL1);
if (pos >= 0 && fld(pos).active())
fld(pos).check(STARTING_CHECK);
pos = id2pos(F_DATACAMBIO1);
if (pos >= 0 && fld(pos).active() &&
(codval != newcodval || datacambio != newdatacambio))
fld(pos).check();
check_field(F_COMCF);
check_field(F_STATOCF);
check_field( F_CODPAG );
@ -2363,8 +2355,8 @@ bool TDocumento_mask::datacambio_handler( TMask_field& f, KEY key )
bool TDocumento_mask::codval_handler( TMask_field& f, KEY key )
{
if (key == K_TAB && f.focusdirty())
{
TMask& m = f.mask();
{
TMask& m = f.mask();
// Cerco un cambio per la data specificata, se non lo trovo lo invento
TDate datacam = m.get(F_DATACAMBIO);
@ -2384,7 +2376,8 @@ bool TDocumento_mask::codval_handler( TMask_field& f, KEY key )
m.set(F_CAMBIO, cambio);
m.set(F_CONTROEURO, et == _exchange_contro ? "X" : "");
TSheet_field& righe = m.sfield(F_SHEET);
TSheet_field& righe = f.mask().sfield(F_SHEET);
righe.force_update();
}
return TRUE;