Patch level : 10.0 67

Files correlati     :
Ricompilazione Demo : [ ]
Commento           :

RIportata la verione 3.2 1167


git-svn-id: svn://10.65.10.50/trunk@16723 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2008-06-11 11:19:53 +00:00
parent 2030c1272c
commit 93e1a7e428
19 changed files with 557 additions and 372 deletions

View File

@ -1299,7 +1299,6 @@ void TCespite::calc_perc(TRelation& rel, const TRectype& tmv, const TRectype& tm
// Calcolare quote perse
const TDate dtmov = tmv.get_date(MOVCE_DTMOV);
const real quote_perse = calc_quote_perse(valamm, per_eff, resamm, qnor, true, dtmov);
ammmv.put(AMMMV_QPERSE, quote_perse);
if (_tipo_sit == 1 && get_int(CESPI_USOPROM) > 1)
agg_quota(valamm, ammmv, "QNOR", true);
@ -1534,9 +1533,9 @@ void TCespite::scansione_movimenti(const TDate& data_limite, bool is_valid)
const TString16 idcespite = get(CESPI_IDCESPITE);
movsem.put(MOVCE_IDCESPITE, idcespite);
TString filtro;
filtro << "(IDRET==\"\")&&(ANSI(DTMOV)>=\"" << inies.string(ANSI) << "\")";
filtro << "(IDRET==\"\")&&(ANSI(DTMOV)>=\"" << inies.date2ansi() << "\")";
if (data_limite.ok())
filtro << "&&(ANSI(DTMOV)<=\"" << data_limite.string(ANSI) << "\")";
filtro << "&&(ANSI(DTMOV)<=\"" << data_limite.date2ansi() << "\")";
TCursor cur(&rel, filtro, 2, &movsem, &movsem);
const long items = cur.items();
if (items > 0) // Continua solo se esistono movimenti
@ -1613,7 +1612,9 @@ void TCespite::scansione_movimenti(const TDate& data_limite, bool is_valid)
tmv.zero("VSPMANU");
}
aggiorna_salpro(tmv, tmvam, segno);
}
} TDate inies, fines;
ditta_cespiti().esercizio_corrente(inies, fines);
} // If esistono movimenti
}
@ -2045,7 +2046,7 @@ bool TCespite::calc_amm(int tipo_sit, const TDate& data_limite,
log(FR("* Inizio calcolo situazione %d cespite %s"), tipo_sit, (const char*)idcespite);
#ifdef DBG
if (tipo_sit == 1 && atol(idcespite) == 89L)
if (tipo_sit == 1 && atol(idcespite) == 2004049L)
tipo_sit = 1; // Put your breakpoint here
#endif
@ -2079,6 +2080,7 @@ int TCespite::read(const char* id)
void TCespite::load_saldi(const int tiposit, const int esercizio)
{
_tipo_sit = tiposit;
TLocalisamfile salce(LF_SALCE);
fill_sal_key(salce.curr(), esercizio, 1);
if (salce.read() == NOERR)
@ -2114,6 +2116,44 @@ void TCespite::load_saldi(const int tiposit, const int esercizio)
_ammpro = ammce.curr();
else
_ammpro = _ammini;
_ammmv.destroy();
TDate inies, fines, dtalien = get(CESPI_DTALIEN);
ditta_cespiti().esercizio_corrente(inies, fines);
if (!dtalien.ok() || dtalien >= inies)
{
TRelation rel(LF_AMMMV);
TRectype& ammmv = rel.curr();
ammmv.put(AMMMV_IDCESPITE, get(CESPI_IDCESPITE));
TString16 filter; filter.format("%s==%d", AMMMV_TPAMM, tiposit);
TCursor cur(&rel, filter, 1, &ammmv, &ammmv);
const TRecnotype items = cur.items();
if (items > 0)
{
cur.freeze();
// Astutamente faccio solo ora il join
rel.add(LF_MOVCE, "IDMOV==IDMOV");
TRectype& movce = rel.curr(LF_MOVCE);
for (cur = 0L; cur.pos() < items; ++cur)
{
const TDate dtmov = movce.get(MOVCE_DTMOV);
if (dtmov >= inies && dtmov <= fines)
{
_ammmv.add(ammmv);
TToken_string key;
key.add(get(CESPI_IDCESPITE));
key.add(movce.get(MOVCE_IDMOV));
key.add(tiposit);
const TRectype& movam = cache().get(LF_MOVAM, key);
if (!movam.empty())
_movam.add(movam);
}
}
}
}
}
TCespite::TCespite()

View File

@ -327,6 +327,8 @@ void TStampa_prospetto::fill_body(const TTotali& tot)
real tempval2 = tot._tot_fondinieser + tot._tot_incr - tot._tot_cesselim3 + tot._tot_reinplus + tot._tot_ammnor + tot._tot_ammacc +tot._tot_ammant;
set_field(FR_TC_FONDBIL,tempval2);
tempval2 = tempval1 - tempval2;
if (tempval2 < ZERO)
tempval2 = ZERO;
set_field(FR_TC_RESBIL,tempval2);
}
//-------------------------------------------------------------------------------------------------------------------------//
@ -416,6 +418,11 @@ void TStampa_prospetto::aggiorna_totali(TCursor& curcespi, const int tipo, TTipo
qmovam += movam.get_real(MOVAM_QACC);
qmovam += movam.get_real(MOVAM_QANT);
real qammmv;
qammmv += ammmv.get_real(AMMMV_QNOR);
qammmv += ammmv.get_real(AMMMV_QACC);
qammmv += ammmv.get_real(AMMMV_QANT);
if (tmc == 'R')
_cat._tot_riveser += (rivmovce + rivg) * signum; else
if (tmc == 'P')
@ -429,14 +436,13 @@ void TStampa_prospetto::aggiorna_totali(TCursor& curcespi, const int tipo, TTipo
{
_cat._tot_cesselim2 += (csto2 + rivmovce + rivg) * (-signum);
_cat._tot_cesselim3 += qmovam * (-signum);
_cat._tot_cesselim3 += qammmv * (-signum); // Aggiunto il 04/05/2008
}
// viene preso l'ammortamento da ammmv (che verrá poi sommato nella riga 4, piú sotto, a quello
// preso da ammce); l'ammortamento viene preso qui in quanto é relativo ai movimenti che vengono qui scanditi
amv_ammnor += (ammmv.get_real(AMMMV_QNOR));
amv_ammacc += (ammmv.get_real(AMMMV_QACC));
amv_ammant += (ammmv.get_real(AMMMV_QANT));
// viene preso l'ammortamento da ammmv (che verrá poi sommato nella riga 4, piú sotto, a quello
// preso da ammce); l'ammortamento viene preso qui in quanto é relativo ai movimenti che vengono qui scanditi
amv_ammnor += qammmv;
} //fine controllo sulle date
} //fine scansione sui movimenti
}
@ -489,11 +495,15 @@ void TStampa_prospetto::main_loop()
_mask->set(F_SITFISC,"X");
while (_mask->run() == K_ENTER)
{
const int esercizio = _mask->get_int(F_ESERCIZIO);
const int gru = _mask->get_int(F_GRUPPO);
const TString4 spe = _mask->get(F_SPECIE);
ditta_cespiti().set_attivita(esercizio, gru, spe);
// record su esercizio,gruppo,specie
TRectype rec(LF_CESPI);
const int esercizio = _mask->get_int(F_ESERCIZIO);
rec.put(CESPI_CODCGRA, _mask->get(F_GRUPPO));
rec.put(CESPI_CODSPA, _mask->get(F_SPECIE));
rec.put(CESPI_CODCGRA, gru);
rec.put(CESPI_CODSPA, spe);
// relazione su lf_cespi e lf_salce
TRelation relcespi(LF_CESPI);
TString espr;
@ -508,16 +518,16 @@ void TStampa_prospetto::main_loop()
filtro << "(CODCGRA=\"" << _mask->get_int(F_GRUPPO)<< "\")&&" ;
filtro << "(CODSPA=\"" << _mask->get(F_SPECIE)<< "\")&&" ;
filtro << "(" << LF_SALCE << "->CODES=" << esercizio << ")&&" ;
filtro << "(ANSI(" << LF_CESPI << "->DTCOMP)<=" << _datafine.string(ANSI) << ")";
filtro << "(ANSI(" << LF_CESPI << "->DTCOMP)<=" << _datafine.date2ansi() << ")";
if (exclude_aliens)
filtro << "&&((ANSI(" << LF_CESPI << "->DTALIEN)='')||(ANSI(" << LF_CESPI << "->DTALIEN)>=" << _dataini.string(ANSI) << "))";
filtro << "&&((ANSI(" << LF_CESPI << "->DTALIEN)='')||(ANSI(" << LF_CESPI << "->DTALIEN)>=" << _dataini.date2ansi() << "))";
// prepara il cursore di tipo sorted perché ho due tipi di ordinamento possibili: per categoria e per impianto
const int ordinamento = _mask->get_int(F_ORDINA);
TString16 ordin = ordinamento == 0 ? CESPI_CODCAT : CESPI_CODIMP;
ordin << "|" <<CESPI_IDCESPITE;
ordin << '|' <<CESPI_IDCESPITE;
TSorted_cursor sortcur (&relcespi, ordin, filtro, 1, &rec, &rec);
sortcur.setregion(rec,rec);
sortcur.setfilter(filtro,TRUE);
//sortcur.setregion(rec,rec);
//sortcur.setfilter(filtro,TRUE);
const TRecnotype num = sortcur.items();
sortcur.freeze();

View File

@ -9,6 +9,7 @@
#include "ammce.h"
#include "ammmv.h"
#include "cespi.h"
#include "movam.h"
#include "movce.h"
#include "salce.h"
#include "celib.h"
@ -185,7 +186,7 @@ real TStampa_sintetica_rep::val_amm(const TRectype& rec_saldi) const
bool TStampa_sintetica_rep::get_usr_val(const TString& name, TVariant& var) const
{
const TRecordset& recset = *recordset();
const TString& idcespite = recset.get("IDCESPITE").as_string();
const TString& idcespite = recset.get(CESPI_IDCESPITE).as_string();
if (idcespite != _cespite.get(CESPI_IDCESPITE))
{
TCespite& c = (TCespite&)_cespite;
@ -230,34 +231,62 @@ bool TStampa_sintetica_rep::get_usr_val(const TString& name, TVariant& var) cons
if (name == "#PERCAMM") //percentuale ammortamento
{
const TRectype& rec_ammce = _cespite.amm_pro();
var = real(rec_ammce.get_real(AMMCE_PNOR) + rec_ammce.get_real(AMMCE_PACC) + rec_ammce.get_real(AMMCE_PANT));
real percamm;
const real valamm = _cespite.val_amm();
if (valamm > ZERO)
{
TVariant qamm, qammmv;
get_usr_val("#QAMM", qamm);
get_usr_val("#QAMMMV", qammmv);
percamm = CENTO * (qamm.as_real() + qammmv.as_real()) / valamm;
}
var = percamm;
return true;
}
if (name == "#QAMM") //quote ammortamento esercizio corrente
if (name == "#QAMMMV") //quote ammortamento su movimento esercizio corrente
{
const TRectype& rec_ammce = _cespite.amm_pro();
var = real(rec_ammce.get_real(AMMCE_QNOR) + rec_ammce.get_real(AMMCE_QACC) + rec_ammce.get_real(AMMCE_QANT) +
rec_ammce.get_real(AMMCE_QPERSE) + rec_ammce.get_real(AMMCE_QPPRIVATE) + rec_ammce.get_real(AMMCE_FPRIVATO));
//ci sono pure degli ammmv? (1 volta su 1 miliardo)
real quote_ammmv;
const TArray& array_ammmv = _cespite.ammmv();
for (int i = 0; i < array_ammmv.items(); i++)
{
const TRectype& rec_ammmv = (const TRectype&)array_ammmv[i];
quote_ammmv = rec_ammmv.get_real(AMMMV_QNOR) + rec_ammmv.get_real(AMMMV_QACC) +
rec_ammmv.get_real(AMMMV_QANT) + rec_ammmv.get_real(AMMMV_QPERSE) + rec_ammmv.get_real(AMMMV_QPPRIVATE) + rec_ammmv.get_real(AMMMV_FPRIVATO);
quote_ammmv += rec_ammmv.get_real(AMMMV_QNOR) + rec_ammmv.get_real(AMMMV_QACC) +
rec_ammmv.get_real(AMMMV_QANT) + rec_ammmv.get_real(AMMMV_QPERSE) +
rec_ammmv.get_real(AMMMV_QPPRIVATE) + rec_ammmv.get_real(AMMMV_FPRIVATO);
}
var += quote_ammmv;
var = quote_ammmv;
return true;
}
if (name == "#QAMM") //quote ammortamento esercizio corrente
{
const TRectype& rec_ammce = _cespite.amm_pro();
var = real(rec_ammce.get_real(AMMCE_QNOR) + rec_ammce.get_real(AMMCE_QACC) +
rec_ammce.get_real(AMMCE_QANT) + rec_ammce.get_real(AMMCE_QPERSE) +
rec_ammce.get_real(AMMCE_QPPRIVATE) + rec_ammce.get_real(AMMCE_FPRIVATO));
return true;
}
if (name == "#FAMM") //fondo ammortamento alla fine dell'esercizio precedente
{
//ragionamento fatto il 05/05/2008;siamo abbastanza sicuri che funzioni!
const TRectype& rec_ammce = _cespite.amm_pro();
const real fondo = _cespite.val_amm() - _cespite.res_amm();
const TRectype& rec_ammce = _cespite.amm_ini();
real fondo = real(rec_ammce.get_real(AMMCE_QNOR) + rec_ammce.get_real(AMMCE_QACC) +
rec_ammce.get_real(AMMCE_QANT) + rec_ammce.get_real(AMMCE_QPERSE) +
rec_ammce.get_real(AMMCE_QPPRIVATE) + rec_ammce.get_real(AMMCE_FPRIVATO));
var = fondo;
return true;
}
if (name == "#CESSELIM") //cessioni elminiazioni
{
real cesselim;
const TArray& array_movam = _cespite.movam();
for (int i = 0; i < array_movam.items(); i++)
{
const TRectype& rec_movam = (const TRectype&)array_movam[i];
cesselim += rec_movam.get_real(MOVAM_QNOR) + rec_movam.get_real(MOVAM_QACC) +
rec_movam.get_real(MOVAM_QANT) + rec_movam.get_real(MOVAM_QPERSE) +
rec_movam.get_real(MOVAM_QPPRIVATE) + rec_movam.get_real(MOVAM_FPRIVATO);
}
var = cesselim;
return true;
}
if (name == "#RESAMM") //residuo da ammortizzare
@ -311,4 +340,4 @@ int ce3900(int argc, char* argv[])
TStampa_sintetica a;
a.run(argc, argv, TR("Stampa sintetica cespiti"));
return 0;
}
}

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<report name="ce3900a" lpi="6">
<description>Lista sintetica cespiti</description>
<font face="Courier New" size="8" />
<font face="Courier New" size="7" />
<section type="Head">
<font face="Courier New" bold="1" size="8" />
<font face="Courier New" bold="1" size="7" />
<field x="24" y="0.5" type="Testo" align="center" width="10" pattern="1" text="Data" />
<field x="90" y="0.5" type="Testo" width="8" pattern="1" text="Valore" />
<field x="127" y="0.5" type="Testo" width="20" pattern="1" text="Fondo Ammortamento" />
<field x="154.5" y="0.75" type="Testo" align="right" width="15" pattern="1" text="Valore residuo" />
<field x="135" y="0.5" type="Testo" width="20" pattern="1" text="Fondo Ammortamento" />
<field x="171" y="0.75" type="Testo" align="right" width="12" pattern="1" text="Residuo da" />
<field x="1.5" y="1.5" type="Testo" width="10" pattern="1" text="Codice" />
<field x="11.5" y="1.5" type="Testo" width="11" pattern="1" text="Alienazione" />
<field x="24.5" y="1.5" type="Testo" width="10" pattern="1" text="Acquisto" />
@ -16,12 +16,13 @@
<field x="72.5" y="1.5" type="Testo" align="right" width="12" pattern="1" text="Iniziale" />
<field x="85.5" y="1.5" type="Testo" align="right" width="12" pattern="1" text="Variazione" />
<field x="98.5" y="1.5" type="Testo" align="right" width="12" pattern="1" text="Finale" />
<field x="111.5" y="1.5" type="Testo" align="right" width="4" pattern="1" text="%Amm" />
<field x="115.5" y="1.5" type="Testo" align="right" width="12" pattern="1" text="Es. corr." />
<field x="128.5" y="1.5" type="Testo" align="right" width="12" pattern="1" text="Fine es.prec" />
<field x="140.5" y="1.5" type="Testo" align="right" width="12" pattern="1" text="Totale" />
<field x="154.5" y="1.5" type="Testo" align="right" width="15" pattern="1" text="da ammortizzare" />
<field border="1" x="1" y="2.5" type="Linea" width="168" height="0" pattern="1" />
<field x="112" y="1.5" type="Testo" align="right" width="6" pattern="1" text="%Amm" />
<field x="119" y="1.5" type="Testo" align="right" width="12" pattern="1" text="Es. corr." />
<field x="132" y="1.5" type="Testo" align="right" width="12" pattern="1" text="Fine es.prec" />
<field x="145" y="1.5" type="Testo" align="right" width="12" pattern="1" text="Cessioni" />
<field x="158" y="1.5" type="Testo" align="right" width="12" pattern="1" text="Totale" />
<field x="171" y="1.5" type="Testo" align="right" width="12" pattern="1" text="ammortizzare" />
<field border="1" x="1" y="2.5" type="Linea" width="182" height="0" pattern="1" />
</section>
<section type="Head" level="1" height="6">
<prescript description="H1 PRESCRIPT">MESSAGE RESET,F1.103
@ -31,10 +32,10 @@ MESSAGE RESET,F1.104
MESSAGE RESET,F1.105
MESSAGE RESET,F1.106
MESSAGE RESET,F1.107</prescript>
<field border="1" radius="100" x="18" y="0.5" type="Testo" valign="center" align="center" shade_offset="25" width="130" height="2.5" text="LISTA SINTETICA CESPITI">
<field border="1" radius="100" x="0" y="0.5" type="Testo" valign="center" align="center" shade_offset="25" width="182" height="2.5" text="LISTA SINTETICA CESPITI">
<font face="Courier New" bold="1" size="16" />
</field>
<field border="2" y="4" type="Linea" width="168" height="0" pattern="1" />
<field border="2" y="4" type="Linea" width="182" height="0" pattern="1" />
<field x="1" y="4.5" type="Stringa" width="50" pattern="1">
<font italic="1" face="Courier New" bold="1" size="9" />
<source>#SYSTEM.RAGSOC</source>
@ -65,7 +66,7 @@ MESSAGE RESET,F1.107</prescript>
</section>
<section type="Head" level="2" height="2" page_break="1">
<groupby>CODCAT</groupby>
<font face="Courier New" bold="1" size="8" />
<font face="Courier New" bold="1" size="7" />
<prescript description="H2 PRESCRIPT">MESSAGE RESET,F2.103
MESSAGE RESET,F2.102
MESSAGE RESET,F2.101
@ -85,7 +86,7 @@ MESSAGE RESET,F2.107</prescript>
<source>CODCAT</source>
</field>
</section>
<section type="Head" level="3">
<section type="Head" level="3" hidden="1">
<groupby>CODIMP</groupby>
<prescript description="H3 PRESCRIPT">#GROUP_CODIMP @
IF
@ -115,7 +116,7 @@ MESSAGE RESET,F3.107</postscript>
<prescript description="H3.102 PRESCRIPT">MESSAGE TABLEREAD,CIM,CODIMP,S0</prescript>
</field>
</section>
<section type="Head" level="4">
<section type="Head" level="4" hidden="1">
<groupby>CODLOC</groupby>
<prescript description="H4 PRESCRIPT">#GROUP_CODLOC @
IF
@ -162,7 +163,7 @@ MESSAGE RESET,F4.107</postscript>
<field x="46" type="Stringa" dynamic_height="1" width="25" height="2" pattern="1">
<source>DESC</source>
</field>
<field x="112" type="Numero" align="right" width="3" pattern="1" text="##@">
<field x="112" type="Numero" align="right" width="6" pattern="1" text="##@,@@">
<source>#PERCAMM</source>
</field>
<field x="72" type="Valuta" align="right" width="12" id="101" pattern="1" text="#########,@@">
@ -183,56 +184,63 @@ MESSAGE ADD,F4.102</postscript>
MESSAGE ADD,F3.103
MESSAGE ADD,F4.103</postscript>
</field>
<field x="115" type="Valuta" align="right" width="12" id="104" pattern="1" text="#########,@@">
<source>#QAMM</source>
<field x="119" type="Valuta" align="right" width="12" id="104" pattern="1" text="#########,@@">
<source>#QAMM+#QAMMMV</source>
<postscript description="B1.104 POSTSCRIPT">MESSAGE ADD,F2.104
MESSAGE ADD,F3.104
MESSAGE ADD,F4.104</postscript>
</field>
<field x="128" type="Valuta" align="right" width="12" id="105" pattern="1" text="#########,@@">
<field x="132" type="Valuta" align="right" width="12" id="105" pattern="1" text="#########,@@">
<source>#FAMM</source>
<postscript description="B1.105 POSTSCRIPT">MESSAGE ADD,F2.105
MESSAGE ADD,F3.105
MESSAGE ADD,F4.105</postscript>
</field>
<field x="141" type="Valuta" align="right" width="12" id="106" pattern="1" text="#########,@@">
<source>#104+#105</source>
<field x="145" type="Valuta" align="right" width="12" id="106" pattern="1" text="#########,@@">
<source>#CESSELIM</source>
<postscript description="B1.106 POSTSCRIPT">MESSAGE ADD,F2.106
MESSAGE ADD,F3.106
MESSAGE ADD,F4.106</postscript>
</field>
<field x="154" type="Valuta" align="right" width="12" id="107" pattern="1" text="#########,@@">
<source>#RESAMM-#QAMM</source>
<field x="158" type="Valuta" align="right" width="12" id="107" pattern="1" text="#########,@@">
<source>#104+#105-#106-#QAMMMV</source>
<postscript description="B1.107 POSTSCRIPT">MESSAGE ADD,F2.107
MESSAGE ADD,F3.107
MESSAGE ADD,F4.107</postscript>
</field>
<field x="171" type="Valuta" align="right" width="12" id="108" pattern="1" text="#########,@@">
<source>#RESAMM-#QAMM</source>
<postscript description="B1.108 POSTSCRIPT">MESSAGE ADD,F2.108
MESSAGE ADD,F3.108
MESSAGE ADD,F4.108</postscript>
</field>
</section>
<section type="Foot">
<field border="1" type="Linea" width="168" height="0" pattern="1" />
<field x="156" y="0.25" type="Testo" width="5" pattern="1" text="Pag.">
<field border="1" type="Linea" width="182" height="0" pattern="1" />
<field x="170" y="0.25" type="Testo" width="5" pattern="1" text="Pag.">
<font italic="1" face="Courier New" size="9" />
</field>
<field x="161" y="0.25" type="Numero" align="right" width="3" pattern="1">
<field x="176" y="0.25" type="Numero" align="right" width="3" pattern="1">
<font italic="1" face="Courier New" bold="1" size="9" />
<source>#REPORT.PAGE</source>
</field>
</section>
<section type="Foot" level="1">
<font face="Courier New" bold="1" size="8" />
<field border="1" x="1" y="0.5" type="Linea" width="168" height="0" pattern="1" />
<font face="Courier New" bold="1" size="7" />
<field border="1" x="1" y="0.5" type="Linea" width="182" height="0" pattern="1" />
<field x="45" y="1" type="Testo" width="25" pattern="1" text="Totali generali" />
<field x="71" y="1" type="Valuta" align="right" width="13" id="101" pattern="1" text="#########,@@" />
<field x="97" y="1" type="Valuta" align="right" width="13" id="102" pattern="1" text="#########,@@" />
<field x="84" y="1" type="Valuta" align="right" width="13" id="103" pattern="1" text="#########,@@" />
<field x="114" y="1" type="Valuta" align="right" width="13" id="104" pattern="1" text="#########,@@" />
<field x="127" y="1" type="Valuta" align="right" width="13" id="105" pattern="1" text="#########,@@" />
<field x="140" y="1" type="Valuta" align="right" width="13" id="106" pattern="1" text="#########,@@" />
<field x="153" y="1" type="Valuta" align="right" width="13" id="107" pattern="1" text="#########,@@" />
<field x="118" y="1" type="Valuta" align="right" width="13" id="104" pattern="1" text="#########,@@" />
<field x="131" y="1" type="Valuta" align="right" width="13" id="105" pattern="1" text="#########,@@" />
<field x="144" y="1" type="Valuta" align="right" width="13" id="106" pattern="1" text="#########,@@" />
<field x="157" y="1" type="Valuta" align="right" width="13" id="107" pattern="1" text="#########,@@" />
<field x="170" y="1" type="Valuta" align="right" width="13" id="108" pattern="1" text="#########,@@" />
</section>
<section type="Foot" level="2">
<font face="Courier New" bold="1" size="8" />
<field border="1" x="1" y="0.5" type="Linea" width="168" height="0" pattern="1" />
<font face="Courier New" bold="1" size="7" />
<field border="1" x="1" y="0.5" type="Linea" width="182" height="0" pattern="1" />
<field x="45" y="1" type="Testo" width="25" pattern="1" text="Totali per categoria" />
<field x="72" y="1" type="Valuta" align="right" width="12" id="101" pattern="1" text="#########,@@">
<postscript description="F2.101 POSTSCRIPT">MESSAGE ADD,F1.101</postscript>
@ -243,40 +251,45 @@ MESSAGE ADD,F4.107</postscript>
<field x="85" y="1" type="Valuta" align="right" width="12" id="103" pattern="1" text="#########,@@">
<postscript description="F2.103 POSTSCRIPT">MESSAGE ADD,F1.103</postscript>
</field>
<field x="115" y="1" type="Valuta" align="right" width="12" id="104" pattern="1" text="#########,@@">
<field x="119" y="1" type="Valuta" align="right" width="12" id="104" pattern="1" text="#########,@@">
<postscript description="F2.104 POSTSCRIPT">MESSAGE ADD,F1.104</postscript>
</field>
<field x="128" y="1" type="Valuta" align="right" width="12" id="105" pattern="1" text="#########,@@">
<field x="132" y="1" type="Valuta" align="right" width="12" id="105" pattern="1" text="#########,@@">
<postscript description="F2.105 POSTSCRIPT">MESSAGE ADD,F1.105</postscript>
</field>
<field x="141" y="1" type="Valuta" align="right" width="12" id="106" pattern="1" text="#########,@@">
<field x="145" y="1" type="Valuta" align="right" width="12" id="106" pattern="1" text="#########,@@">
<postscript description="F2.106 POSTSCRIPT">MESSAGE ADD,F1.106</postscript>
</field>
<field x="154" y="1" type="Valuta" align="right" width="12" id="107" pattern="1" text="#########,@@">
<field x="158" y="1" type="Valuta" align="right" width="12" id="107" pattern="1" text="#########,@@">
<postscript description="F2.107 POSTSCRIPT">MESSAGE ADD,F1.107</postscript>
</field>
<field x="171" y="1" type="Valuta" align="right" width="12" id="108" pattern="1" text="#########,@@">
<postscript description="F2.108 POSTSCRIPT">MESSAGE ADD,F1.108</postscript>
</field>
</section>
<section type="Foot" level="3">
<font italic="1" face="Courier New" bold="1" size="8" />
<section type="Foot" level="3" hidden="1">
<font italic="1" face="Courier New" bold="1" size="7" />
<field x="45" y="0.5" type="Testo" width="25" pattern="1" text="Totali per impianto" />
<field x="72" y="0.5" type="Valuta" align="right" width="12" id="101" pattern="1" text="#########,@@" />
<field x="98" y="0.5" type="Valuta" align="right" width="12" id="102" pattern="1" text="#########,@@" />
<field x="85" y="0.5" type="Valuta" align="right" width="12" id="103" pattern="1" text="#########,@@" />
<field x="115" y="0.5" type="Valuta" align="right" width="12" id="104" pattern="1" text="#########,@@" />
<field x="128" y="0.5" type="Valuta" align="right" width="12" id="105" pattern="1" text="#########,@@" />
<field x="141" y="0.5" type="Valuta" align="right" width="12" id="106" pattern="1" text="#########,@@" />
<field x="154" y="0.5" type="Valuta" align="right" width="12" id="107" pattern="1" text="#########,@@" />
<field x="119" y="0.5" type="Valuta" align="right" width="12" id="104" pattern="1" text="#########,@@" />
<field x="132" y="0.5" type="Valuta" align="right" width="12" id="105" pattern="1" text="#########,@@" />
<field x="145" y="0.5" type="Valuta" align="right" width="12" id="106" pattern="1" text="#########,@@" />
<field x="158" y="0.5" type="Valuta" align="right" width="12" id="107" pattern="1" text="#########,@@" />
<field x="171" y="0.5" type="Valuta" align="right" width="12" id="108" pattern="1" text="#########,@@" />
</section>
<section type="Foot" level="4">
<font italic="1" face="Courier New" bold="1" size="8" />
<section type="Foot" level="4" hidden="1">
<font italic="1" face="Courier New" bold="1" size="7" />
<field x="45" y="0.5" type="Testo" width="25" pattern="1" text="Totali per localita'" />
<field x="72" y="0.5" type="Valuta" align="right" width="12" id="101" pattern="1" text="#########,@@" />
<field x="98" y="0.5" type="Valuta" align="right" width="12" id="102" pattern="1" text="#########,@@" />
<field x="85" y="0.5" type="Valuta" align="right" width="12" id="103" pattern="1" text="#########,@@" />
<field x="115" y="0.5" type="Valuta" align="right" width="12" id="104" pattern="1" text="#########,@@" />
<field x="128" y="0.5" type="Valuta" align="right" width="12" id="105" pattern="1" text="#########,@@" />
<field x="141" y="0.5" type="Valuta" align="right" width="12" id="106" pattern="1" text="#########,@@" />
<field x="154" y="0.5" type="Valuta" align="right" width="12" id="107" pattern="1" text="#########,@@" />
<field x="119" y="0.5" type="Valuta" align="right" width="12" id="104" pattern="1" text="#########,@@" />
<field x="132" y="0.5" type="Valuta" align="right" width="12" id="105" pattern="1" text="#########,@@" />
<field x="145" y="0.5" type="Valuta" align="right" width="12" id="106" pattern="1" text="#########,@@" />
<field x="158" y="0.5" type="Valuta" align="right" width="12" id="107" pattern="1" text="#########,@@" />
<field x="171" y="0.5" type="Valuta" align="right" width="12" id="108" pattern="1" text="#########,@@" />
</section>
<sql>USE CESPI KEY 2</sql>
</report>

View File

@ -5,10 +5,6 @@
#include <form.h>
#endif
#ifndef __ISAM_H
#include <isam.h>
#endif
#ifndef __AUTOMASK_H
#include <automask.h>
#endif

View File

@ -500,7 +500,7 @@ HIDDEN bool codalleg_handler(TMask_field& f, KEY key)
const char tipo = m.get(F_TIPOCF)[0];
TString16 key; key.format("%c|%s", tipo, (const char*)cod);
TString8 key; key.format("%c|%s", tipo, (const char*)cod);
const TRectype& clifo = cache().get(LF_CLIFO, key);
if (clifo.empty())
return false;
@ -508,11 +508,11 @@ HIDDEN bool codalleg_handler(TMask_field& f, KEY key)
if (clifo.get(CLI_CODALLEG).full())
return error_box(TR("Codice non utilizzabile: contiene a sua volta un codice per allegato"));
if (clifo.get(CLI_PAIV).empty())
return error_box(TR("Codice non utilizzabile: privo di partita IVA"));
if (clifo.get(CLI_PAIV).blank() && clifo.get(CLI_COFI).blank())
return error_box(TR("Codice non utilizzabile: partita IVA e codice fiscale non specificati"));
const int tipoall = clifo.get_int(CLI_ALLEG);
if (tipoall != 0 && tipoall != 1 && tipoall != 4)
if (tipoall != 0 && tipoall != 1 && tipoall != 4 && tipoall != 6)
return error_box(TR("Codice non utilizzabile: codice inserimento allegato non corretto"));
}
return true;

View File

@ -2198,24 +2198,15 @@ long TMastrino_set::cell_request(long rec, short column, TString& str) const
const TVariant& TMastrino_set::get(unsigned int column) const
{
CHECK(_curr>=0 && _curr<items() && column>=0 && column< columns(), "Cella errata");
const TRecordset_column_info& info = column_info(column);
if (_curr >= 0 && _curr < items() && column >= 0 && column < columns())
{
const TRecordset_column_info& info = column_info(column);
TString80 str;
cell_request(_curr, abs(info._pos), str);
if (str.full())
{
TVariant& tmp = get_tmp_var();
switch (info._type)
TToken_string str;
cell_request(_curr, abs(info._pos), str);
if (str.full())
{
case _realfld:
tmp = real(real::ita2eng(str));
break;
case _longfld:
tmp = atol(str);
break;
case _datefld:
if (info._pos < 0 || info._type == _datefld || info._type == _realfld)
{
const int cr = str.find(' ');
if (cr >= 0)
@ -2226,17 +2217,30 @@ const TVariant& TMastrino_set::get(unsigned int column) const
str.ltrim(cr);
str.trim();
}
}
TVariant& tmp = get_tmp_var();
switch (info._type)
{
case _realfld:
tmp = real(real::ita2eng(str));
break;
case _longfld:
tmp = atol(str);
break;
case _datefld:
tmp = TDate(str);
}
break;
default:
if (info._width == 1)
tmp = str.right(1);
else
tmp = str;
break;
break;
default:
if (info._width == 1)
tmp = str.right(1);
else
tmp = str;
break;
}
return tmp;
}
return tmp;
}
return NULL_VARIANT;
}

View File

@ -192,10 +192,9 @@ bool TRic_auto::leggi_trasfer()
bool TRic_auto::leggi_header()
{
TString header;
TFilename header;
header = _tras_file->path(_ditta);
header << HEADER;
header.add(HEADER);
_tras_file->open(header);
@ -204,8 +203,7 @@ bool TRic_auto::leggi_header()
if (_tras_file->read_control_rec())
{
_control_rec = _tras_file->record();
TString tiporecord = _control_rec.sub(0,2);
const TString& tiporecord = _control_rec.sub(0,2);
if (tiporecord != " 1")
return FALSE;
}

View File

@ -257,7 +257,7 @@ bool TRic_archivi::leggi_marker_rep()
FILE* inmark = fopen(_marker,"r");
if (inmark != NULL)
{
const word letti = fread((char*)(const char*)buffer,sizeof(char),size,inmark);
const word letti = fread(buffer.get_buffer(),1,size,inmark);
fclose(inmark);
_progdisk = atoi(buffer.sub(34,36));
@ -319,7 +319,7 @@ void TRic_archivi::main_loop()
{
_dittaric = get_firm();
_trasf = _tras_file->path(_dittaric);
_trasf << "\\trasfer";
_trasf.add("trasfer");
_tras_file->open(_trasf);
if (_scelta == 'S')
@ -327,11 +327,11 @@ void TRic_archivi::main_loop()
trasfer2tempfile();
_tras_file->close(); // Chiude il trasfer letto dalla directory della ditta
::remove(_trasf);
TString80 tab = _tras_file->path(_dittaric);
TString tabcdx = tab;
TString tabdbf = tab;
tabcdx << "\\ttab.cdx";
tabdbf << "\\ttab.dbf";
TFilename tab = _tras_file->path(_dittaric);
TFilename tabcdx = tab;
TFilename tabdbf = tab;
tabcdx.add("ttab.cdx");
tabdbf.add("ttab.dbf");
::remove(tabcdx);
::remove(tabdbf);
}
@ -404,8 +404,8 @@ void TRic_archivi::main_loop()
TFilename tab = _tras_file->path(_dittaric);
TFilename tabcdx = tab;
TFilename tabdbf = tab;
tabcdx << "\\ttab.cdx";
tabdbf << "\\ttab.dbf";
tabcdx.add("ttab.cdx");
tabdbf.add("ttab.dbf");
::remove(tabcdx);
::remove(tabdbf);
}

View File

@ -242,7 +242,7 @@ void TInv_cont::main_loop()
return;
}
const char* message = "Trasferimento in corso... Prego attendere";
const char* message = TR("Trasferimento in corso... Prego attendere");
TProgind w(_dim_tot, message, TRUE, TRUE, 60);
@ -281,7 +281,7 @@ void TInv_cont::main_loop()
if (_scelta == 'P')
{
_trasf = firm2dir(0);
_trasf << "\\trasfer";
_trasf.add("trasfer");
::remove(_trasf);
_tras_file.open(_trasf,TRUE);
@ -807,20 +807,18 @@ bool TInv_cont::setta_maschera_hnd(TMask_field& f, KEY k)
void TInv_cont::crea_marker(TMask& m)
{
TString str;
_marker = "";
_marker = firm2dir(0);
_marker << "\\marker";
_marker.add("marker");
FILE* i;
const word size = 64;
TString buffer(size);
buffer.spaces();
if ( (i = fopen(_marker,"w+t")) != NULL)
FILE* i = fopen(_marker,"w+t");
if (i != NULL)
{
TString str;
if (_scelta == 'S')
{
str.format("%-10s", (const char*)_nome_simbolico);
@ -857,31 +855,30 @@ void TInv_cont::crea_marker(TMask& m)
buffer.cut(64); //Sicurezza: le stringhe dimensionate in realta' sono
//leggermente piu' lunghe della dimensione specificata
const word scritti = fwrite((char*)(const char*)buffer,sizeof(char),size,i);
const word scritti = fwrite(buffer,1,size,i);
fclose(i);
}
}
void TInv_cont::aggiorna_marker(TString& token, int pos)
void TInv_cont::aggiorna_marker(const TString& token, int pos)
{
_marker = "";
_marker = firm2dir(0);
_marker << "\\marker";
_marker.add("marker");
const int size = 64;
TString buffer(size);
FILE* i = fopen(_marker,"r+t");
if (i != NULL)
{
const int size = 64;
TString80 buffer;
const word letti = fread(buffer.get_buffer(),sizeof(char),size,i);
const word letti = fread(buffer.get_buffer(),1,size,i);
buffer.overwrite(token,pos);
buffer.cut(size); //Sicurezza: le stringhe dimensionate in realta' sono
//leggermente piu' lunghe della dimensione specificata
fseek(i, 0L, SEEK_SET);
const word scritti = fwrite(buffer,sizeof(char),size,i);
const word scritti = fwrite(buffer,1,size,i);
fclose(i);
}
@ -1457,8 +1454,6 @@ void TInv_cont::movPN2tempfile(TString& key, TMask& m)
_tmov->zero();
_tmov->curr() = _mov->curr();
_tmov->rewrite();
scrivi_righePN(nreg);
}
else
{
@ -1466,8 +1461,8 @@ void TInv_cont::movPN2tempfile(TString& key, TMask& m)
_tmov->curr() = _mov->curr();
_tmov->write();
scrivi_righePN(nreg);
}
scrivi_righePN(nreg);
leggi_record_controllo();
TString8 chiave;

View File

@ -41,8 +41,8 @@ class TInv_cont : public TSkeleton_application
char _scelta;
TFilename _trasf, _header;
TString _control_rec, _std, _stato, _marker, _nome_simbolico;
TFilename _trasf, _header, _marker;
TString _control_rec, _std, _stato, _nome_simbolico;
TString _files, _codcaus, _numdoc, _reg, _codpag, _tipodoc, _codcausm, _sigle,_cpg_nc;
TString _ocfpi, _ragsococc, _indocc, _capocc, _localocc, _provocc, _codvali, _codval;
bool _esiste_ditta, _esiste_record, _inviato, _flag_provvis, _flag_bollato;
@ -62,8 +62,7 @@ public:
virtual bool create();
virtual bool destroy();
virtual void main_loop();
virtual bool check_autorization() const
{return FALSE;}
virtual bool check_autorization() const { return false; }
bool esiste_tabella_studio();
bool record_controllo() const;
@ -134,7 +133,7 @@ public:
void dec2integer(real& val, long dec);
void write_AS_imp(const real& importo, TString& record, int pos, int len = 11);
void aggiorna_marker(TString& token, int pos);
void aggiorna_marker(const TString& token, int pos);
void calcola_totale_record();
void scrivi_telefono(TString& app);
@ -165,4 +164,4 @@ public:
TInv_cont(char mov);
};
HIDDEN TInv_cont& app() { return (TInv_cont &) main_app(); }
HIDDEN TInv_cont& app() { return (TInv_cont&)main_app(); }

View File

@ -1253,7 +1253,6 @@ void TInv_cont::cerca_comune_occas(const TString& com)
bool TInv_cont::invio_mov_IVA()
{
const int size = 256;
// TString256 record(size);
TString256 record;
long nreg_p;
int numero_righe = 0;
@ -1403,8 +1402,8 @@ bool TInv_cont::invio_mov_IVA()
str.format("%014s", (const char*) corrval);
record.overwrite(str,160); //Corrispettivo in valuta
const bool nota = _triva->get_bool(RMI_NAVP);
record.overwrite(nota ? "1" : "0", 177); //Nota variazione relativa anni precedenti
const bool nota = _triva->curr().exist(RMI_NAVP) && _triva->get_bool(RMI_NAVP);
record.overwrite(nota ? "1" : " ", 177); //Nota variazione relativa anni precedenti
_tmov->setkey(1);
_tmov->put(MOV_NUMREG, nreg);

View File

@ -481,7 +481,7 @@ bool TTransfer_file::read_control_rec()
fseek(_trasfer, 0L, SEEK_SET);
// const word letti = fread((char*)(const char*)_control_rec,sizeof(char),sizeH,_trasfer);
const word letti = fread(_control_rec->get_buffer(), sizeof(char), sizeH, _trasfer);
const word letti = fread(_control_rec->get_buffer(), 1, sizeH, _trasfer);
_control_rec->cut(sizeH);
@ -803,9 +803,9 @@ void TTransfer_file::fill_index(const TString& sigle_file, const TString& nrec_f
// da sostituire a quella analoga poco piu' sotto.
// In pratica viene tolto l'and con nrec != 0
//
// if (sigla != ' ')
if (sigla != ' ' && nrec != 0)
if (sigla != ' ') // Cosi funziona sempre
//if (sigla != ' ' && nrec != 0) // Cosi funziona solo se non ci sono zeri
{
data.add(sigla);
data.add(nrec + nrecp);
@ -1795,23 +1795,21 @@ void TTransfer_file::scrivi_occasionali(const TString& record, TString& cfpi)
void TTransfer_file::write_tmp_movIVA(const TString& record)
{
TString key,str;
int numfield = 3; //Per i movimenti i primi due campi della mappa non sono significativi
//ai fini del trasferimento (flag record gia trasferito e nuovo ultimo numero di registrazione).
const TMappa_trc& trc = mappa();
TIsamtempfile* file = NULL;
TRectype* dep = NULL;
int logicnum;
TString nreg,tipodoc;
int fnrmiva = 11;
TString tmp_path;
static bool create = true;
static bool create = true;
const TMappa_trc& trc = mappa(););
int numfield = 3; //Per i movimenti i primi due campi della mappa non sono significativi
const TString4 sigla = record.mid(0,2);
key.format("%2s%d", (const char*)sigla, numfield);
TString4 key; key.format("%2s%d", (const char*)sigla, numfield);
if (trc.is_key(key))
{
const int fnrmiva = 11;
//ai fini del trasferimento (flag record gia trasferito e nuovo ultimo numero di registrazione).
TIsamtempfile* file = NULL;
TRectype* dep = NULL;
TFilename tmp_path;
TString16 cfpi;
int logicnum_p = 0;
@ -1830,15 +1828,15 @@ void TTransfer_file::write_tmp_movIVA(const TString& record)
do
{
logicnum = trc.logicnum(key);
const int logicnum = trc.logicnum(key);
if (logicnum != logicnum_p)
{
if (logicnum_p)
{
trasfer_data_moviva(*file, *dep, logicnum_p);
delete file;
delete dep;
trasfer_data_moviva(*file, *dep);
delete file; file = NULL;
delete dep; dep = NULL;
}
if (sigla == "U1")
@ -1855,8 +1853,7 @@ void TTransfer_file::write_tmp_movIVA(const TString& record)
}
}
dep = new TRectype (logicnum);
dep->zero();
dep = new TRectype(logicnum);
}
logicnum_p = logicnum;
@ -1922,9 +1919,10 @@ void TTransfer_file::write_tmp_movIVA(const TString& record)
else
if (logicnum == LF_RMOVIVA && fname == RMI_NUMREG)
{
int annoes = cerca_annoes(_numreg,tipodoc);
dep->put("ANNOES", annoes);
dep->put("NUMREG", _numreg);
TString4 tipodoc;
const int annoes = cerca_annoes(_numreg,tipodoc);
dep->put("ANNOES", annoes);
dep->put("NUMREG", _numreg);
}
else
dep->put(fname, field);
@ -1935,7 +1933,7 @@ void TTransfer_file::write_tmp_movIVA(const TString& record)
while (trc.is_key(key));
_prog->addstatus(1);
trasfer_data_moviva(*file, *dep, logicnum_p);
trasfer_data_moviva(*file, *dep);
if (create)
create = false;
@ -1945,14 +1943,15 @@ void TTransfer_file::write_tmp_movIVA(const TString& record)
} // if (trc.is_key((const char*) key))
}
int TTransfer_file::trasfer_data_moviva(TIsamtempfile& file, TRectype& dep, int ln)
int TTransfer_file::trasfer_data_moviva(TIsamtempfile& file, const TRectype& dep)
{
file.zero();
file.curr() = dep;
if (dep.get_long(MOV_NUMREG) <= 0)
return NOERR;
file.curr() = dep;
if (file.read() == NOERR)
{
if (ln == LF_MOV)
if (dep.num() == LF_MOV)
{
TDate data74ter = dep.get_date(MOV_DATA74TER);
TString4 codval (dep.get (MOV_CODVALI));
@ -1961,7 +1960,6 @@ int TTransfer_file::trasfer_data_moviva(TIsamtempfile& file, TRectype& dep, int
real cambioi (dep.get_real(MOV_CAMBIOI));
real corrlire (dep.get_real(MOV_CORRLIRE));
real corrvaluta(dep.get_real(MOV_CORRVALUTA));
file.put(MOV_DATA74TER, data74ter);
file.put(MOV_CODVALI, codval);
file.put(MOV_OCFPI, ocfpi);
@ -1969,24 +1967,20 @@ int TTransfer_file::trasfer_data_moviva(TIsamtempfile& file, TRectype& dep, int
file.put(MOV_CAMBIOI, cambioi);
file.put(MOV_CORRLIRE, corrlire);
file.put(MOV_CORRVALUTA,corrvaluta);
file.rewrite();
}
else
{
file.zero();
file.curr() = dep;
file.rewrite();
}
file.rewrite();
}
else
{
file.zero();
file.curr() = dep;
file.write();
}
return 0;
return NOERR;
}
void TTransfer_file::tipo_anagrafica(TString& record,TString& tipoc)
@ -3067,12 +3061,12 @@ bool TTransfer_file::ordina_trasfer(const char* orig)
TRic_recfield recf (_ttab->curr(), "S0", 0, sizeT);
TString80 key;
TString16 app;
TString80 key, app;
while (ok)
{
const word letti = fread((char*)(const char*)buffer, 1, sizeT, i);
const word letti = fread(buffer.get_buffer(), 1, sizeT, i);
buffer.cut(sizeT);
// A causa di errori di invio da parte del sistema
@ -3090,7 +3084,7 @@ bool TTransfer_file::ordina_trasfer(const char* orig)
key = buffer.left(15);
if (buffer.left(2) == "B1")
if (buffer.starts_with("B1"))
{
app = buffer.mid(28,7); // Modifica del 06-09-96 relativa all'allineamento
app.trim(); // del numero di riferimento partita che per i file
@ -3100,7 +3094,7 @@ bool TTransfer_file::ordina_trasfer(const char* orig)
int tipomov = atoi(buffer.mid(37,1));
new_key(key,tipomov,buffer);
}
_ttab->put("CODTAB", key);
recf = buffer;
@ -3141,17 +3135,17 @@ bool TTransfer_file::fcopytemp(const char* orig, const char* dest)
{
_tmpcaus = "%";
_tmpcaus << path();
_tmpcaus << SLASH << TEMP_CAUS;
_tmpcaus.add(TEMP_CAUS);
_tmprcaus = "%";
_tmprcaus << path();
_tmprcaus << SLASH << TEMP_RCAUS;
_tmprcaus.add(TEMP_RCAUS);
nrec_cau = atol(nrec.mid(pos*6,6));
}
if ( (pos = sigle.find('A')) >= 0)
{
_tmpclifo = "%";
_tmpclifo << path();
_tmpclifo << SLASH << TEMP_CLIFO;
_tmpclifo.add(TEMP_CLIFO);
nrec_clifo = atol(nrec.mid(pos*6,6));
}
if ( (pos = sigle.find('P')) >= 0)
@ -3160,7 +3154,7 @@ bool TTransfer_file::fcopytemp(const char* orig, const char* dest)
_tmppcon = "%";
_tmppcon << path();
_tmppcon << SLASH << TEMP_PCON;
_tmppcon.add(TEMP_PCON);
nrec_pcon = atol(nrec.mid(pos*6,6));
}
if ( (pos = sigle.find('Z')) >= 0)
@ -3196,14 +3190,14 @@ bool TTransfer_file::fcopytemp(const char* orig, const char* dest)
_tmppart = "%";
_tmppart << path();
_tmppart << "\\" << TEMP_PART;
_tmppart.add(TEMP_PART);
_tpart = new TIsamtempfile(LF_PARTITE, _tmppart, true);
//_deppart = new TRectype(LF_PARTITE);
trec.get(LF_PARTITE);
_deppart = new TExtrectype (trec);
_tmpscad = "%";
_tmpscad << path();
_tmpscad << "\\" << TEMP_SCAD;
_tmpscad.add(TEMP_SCAD);
_tscad = new TIsamtempfile(LF_SCADENZE, _tmpscad, true);
//_depscad = new TRectype (LF_SCADENZE);
trec.get(LF_SCADENZE);
@ -4093,8 +4087,9 @@ void TTransfer_file::causale(TString& cau,TString& tipo,TString& descr)
}
}
int TTransfer_file::registro(TString& reg,int anno)
int TTransfer_file::registro(const TString& reg, int anno) const
{
/*
TTable rg ("REG");
TString dep;
int tipo = 0;
@ -4105,13 +4100,17 @@ int TTransfer_file::registro(TString& reg,int anno)
rg.put("CODTAB", dep);
if (rg.read() == NOERR)
tipo = rg.get_int("I0");
*/
return tipo;
TString8 dep; dep.format("%04d%s", anno, (const char*)reg);
int tipo = atoi(cache().get("REG", dep, "I0"));
return tipo;
}
void TTransfer_file::write_testata_movimenti(TString& record)
{
TString key,descr;
TString descr;
int numfield = 1;
const TMappa_trc& trc = mappa();
int annoiva;
@ -4119,11 +4118,11 @@ void TTransfer_file::write_testata_movimenti(TString& record)
bool occas = true;
const TString4 sigla = record.mid(0,2);
key.format("%2s%d", (const char*)sigla,numfield);
TString4 key; key.format("%2s%d", (const char*)sigla,numfield);
_depmov->zero();
if (trc.is_key((const char *) key))
if (trc.is_key(key))
{
_numreg = atol(record.sub(2,9));
@ -4141,7 +4140,7 @@ void TTransfer_file::write_testata_movimenti(TString& record)
TRecfield campo (*_depmov,fname);
if (campo.type() == _realfld)
{
TString sign,importo;
TString16 sign,importo;
importo = field;
strip_zero(importo);
@ -4314,12 +4313,12 @@ void TTransfer_file::write_testata_movimenti(TString& record)
numfield++;
key.format("%2s%d", (const char*)sigla,numfield);
}
while (trc.is_key((const char*) key));
while (trc.is_key(key));
}
/* // Vecchio modo cazzuto
_tmov->zero();
_tmov->curr() = *_depmov;
if (_tmov->read() == NOERR)
{
_tmov->zero();
@ -4332,9 +4331,12 @@ void TTransfer_file::write_testata_movimenti(TString& record)
_tmov->curr() = *_depmov;
_tmov->write();
}
*/
_depmov->write_rewrite(*_tmov); // Nuovo modo per fare la stessa cosa
if (registra_occas)
{
{
/*
_toccas->zero();
_toccas->curr() = *_depoccas;
@ -4350,6 +4352,9 @@ void TTransfer_file::write_testata_movimenti(TString& record)
_toccas->curr() = *_depoccas;
_toccas->write();
}
*/
_depoccas->write_rewrite(*_toccas);
registra_occas = false;
}
_prog->addstatus(1);
@ -4590,14 +4595,15 @@ void TTransfer_file::write_righe_IVA(TString& record)
if (logic == LF_RMOVIVA)
_depriva->put(fname, field);
// Devo trasferire un campo che in realta' e in testata
// Devo trasferire un campo che in realta' e' in testata
if (logic == LF_RMOV && nriga == 1 && field.not_empty())
{
_tmov->put(MOV_NUMREG, nreg);
if (_tmov->read() == NOERR)
{
_tmov->put(fname, field);
_tmov->rewrite();
*_depmov = _tmov->curr();
_depmov->put(fname, field);
_depmov->rewrite(*_tmov);
}
}
}

View File

@ -204,7 +204,7 @@ private:
void write_tmp_movPN(TString& record);
int trasfer_data_mov(TIsamtempfile& file, TRectype& dep);
void write_tmp_movIVA(const TString& record);
int trasfer_data_moviva(TIsamtempfile& file, TRectype& dep, int ln);
int trasfer_data_moviva(TIsamtempfile& file, const TRectype& dep);
// Funzioni per la ricezione del Saldaconto da Sistema
void write_tmp_movSC(TString& record);
void new_key(TString& key, int tipo, TString& buffer);
@ -252,7 +252,7 @@ private:
int annoes_PC(const TString& data) const;
void causale(TString& cau,TString& tipo,TString& descr);
int registro(TString& reg,int anno);
int registro(const TString& reg,int anno) const;
public:

View File

@ -31,6 +31,24 @@
# e' un reale con 2 decimali il flag G deve essere 3 mentre il flag H
# deve essere 2.
#
# Formato file MARKER
# 1 10 Nome studio inviante
# 11 14 Codice ditta inviante
# 15 17 Numero progressivo di invio
# 18 23 Data del trasferimento
# 24 29 Numero totale di record trasferiti
# 30 31 Numero totale dischetti
# 32 33 Numero dischetto corrente
#
# Formato record di controllo
# 1 2 fisso " 1"
# 16 25 Nome studio inviante
# 26 29 Codice ditta
# 30 32 Numero ultimo trasferimento
# 33 38 Data ultimo trasferimento
# 39 47 Sigle file "WAPZUB"
# 48 149 Numero di record per file (6 cifre per file in corrispondenza a sigle)
#
W1|1|256|256|26||||
W1|2|3|5|26|CODCAUS|||
W1|3|16|35|26|DESCR|1||
@ -211,27 +229,21 @@ U1|7|238|248|23|TOTDOC|||
U1|8|150|160|23|CAMBIOI|3|5|
U1|9|136|146|23|CORRLIRE|||
U1|10|161|174|23|CORRVALUTA|3|3|
U1|11|3|8|25|NUMREG|||
U1|12|9|10|25|NUMRIG|||
U1|13|33|34|25|CODIVA|||
U1|14|22|32|25|IMPONIBILE|||
U1|15|35|43|25|IMPOSTA|||
U1|16|45|45|25|TIPODET|||
U1|17|44|44|25|TIPOCR|||
U1|18|134|134|25|TIPOATT|||
U1|19|46|47|25|GRUPPO|||
U1|20|48|49|25|CONTO|||
U1|21|50|55|25|SOTTOCONTO|||
U1|22|135|135|25|INTRA|||
U1|23|175|176|23|MESELIQ|||
U1|24|178|178|25|NOTAVARECF|||
U1|25|200|215|23|OCFPI|||
U1|50|62|86|||||
U1|51|249|249|23||||
U1|52|109|126|||||
U1|53|127|131|||||
U1|54|132|133|||||
U1|56|87|108|||||
U1|11|175|176|23|MESELIQ|||
U1|12|200|215|23|OCFPI|||
U1|13|3|8|25|NUMREG|||
U1|14|9|10|25|NUMRIG|||
U1|15|33|34|25|CODIVA|||
U1|16|22|32|25|IMPONIBILE|||
U1|17|35|43|25|IMPOSTA|||
U1|18|45|45|25|TIPODET|||
U1|19|44|44|25|TIPOCR|||
U1|20|134|134|25|TIPOATT|||
U1|21|46|47|25|GRUPPO|||
U1|22|48|49|25|CONTO|||
U1|23|50|55|25|SOTTOCONTO|||
U1|24|135|135|25|INTRA|||
U1|25|178|178|25|NAVP|||
#
# Tracciato Partite in caso di Fattura
#

View File

@ -17,7 +17,7 @@
static bool is_numeric(const char* str)
{
if (str == NULL || *str == '\0' || *str == '0')
if (str == NULL || *str == '\0' || (*str == '0' && isdigit(str[1])))
return false; // Se comincia per zero va preservato!
if (*str == '-')
{
@ -58,7 +58,9 @@ const TToken_string& TRecordset::sheet_head() const
{
TToken_string head;
TToken_string tablefield(32, '.');
for (unsigned int c = 0; c < columns(); c++)
const unsigned int cols = columns();
for (unsigned int c = 0; c < cols; c++)
{
const TRecordset_column_info& ci = column_info(c);
tablefield = ci._name;
@ -98,21 +100,26 @@ bool TRecordset::save_as_html(const char* path)
out << "<p><b>" << qry << "</b></p>" << endl;
out << "<table border=\"1\">" << endl;
out << " <thead>";
for (unsigned int c = 0; c < columns(); c++)
const unsigned int cols = columns();
if (cols > 0)
{
const TRecordset_column_info& ci = column_info(c);
TToken_string header(ci._name, '.');
TString str;
FOR_EACH_TOKEN(header, tok)
out << " <thead>";
for (unsigned int c = 0; c < cols; c++)
{
if (str.not_empty())
str << "<br/>";
str << tok;
const TRecordset_column_info& ci = column_info(c);
TToken_string header(ci._name, '.');
TString str;
FOR_EACH_TOKEN(header, tok)
{
if (str.not_empty())
str << "<br/>";
str << tok;
}
out << " <th>" << str << "</th>" << endl;
}
out << " <th>" << str << "</th>" << endl;
out << " </thead>" << endl;
}
out << " </thead>" << endl;
TString val;
for (bool ok = move_first(); ok; ok = move_next())
@ -120,7 +127,7 @@ bool TRecordset::save_as_html(const char* path)
if (!pi.addstatus(1))
break;
out << " <tr>" << endl;
for (unsigned int c = 0; c < columns(); c++)
for (unsigned int c = 0; c < cols; c++)
{
const TRecordset_column_info& ci = column_info(c);
out << " <td";
@ -152,31 +159,41 @@ bool TRecordset::save_as_silk(const char* path)
ofstream out(path);
out << "ID;PWXL;N;E" << endl;
// Larghezza colonne
for (unsigned int h = 0; h < columns(); h++)
{
const TRecordset_column_info& ci = column_info(h);
const int w = max(ci._width, ci._name.len());
out << "F;W" << (h+1) << ' ' << (h+1) << ' ' << w << endl;
}
const unsigned int cols = columns();
// Intestazioni colonne
for (unsigned int c = 0; c < columns(); c++)
{
const TRecordset_column_info& ci = column_info(c);
out << 'C';
if (c == 0) out << ";Y1";
out << ";X" << (c+1) << ";K\"" << ci._name << '"' << endl;
}
int header = 1;
if (cols > 0)
{
// Larghezza colonne
for (unsigned int h = 0; h < cols; h++)
{
const TRecordset_column_info& ci = column_info(h);
const int w = max(ci._width, ci._name.len());
out << "F;W" << (h+1) << ' ' << (h+1) << ' ' << w << endl;
}
// Intestazioni colonne
for (unsigned int c = 0; c < cols; c++)
{
const TRecordset_column_info& ci = column_info(c);
out << 'C';
if (c == 0) out << ";Y1";
out << ";X" << (c+1) << ";K\"" << ci._name << '"' << endl;
}
header++;
}
TString val;
for (bool ok = move_first(); ok; ok = move_next())
{
for (unsigned int c = 0; c < columns(); c++)
for (unsigned int c = 0; ; c++)
{
out << 'C';
if (c == 0) out << ";Y" << (current_row()+2);
const TVariant& var = get(c);
if (var.is_null() && c >= cols)
break;
out << 'C';
if (c == 0) out << ";Y" << (current_row()+header);
if (!var.is_empty())
{
out << ";X" << (c+1) << ";K";
@ -185,6 +202,11 @@ bool TRecordset::save_as_silk(const char* path)
{
case _alfafld:
case _datefld:
if (cols == 0 && is_numeric(val))
{
out << val;
}
else
{
val.rtrim();
val.replace('"', '\'');
@ -212,13 +234,18 @@ bool TRecordset::save_as_text(const char* path)
ofstream out(path);
TString val;
const unsigned int cols = columns();
for (bool ok = move_first(); ok; ok = move_next())
{
for (unsigned int c = 0; c < columns(); c++)
for (unsigned int c = 0; ; c++)
{
const TVariant& var = get(c);
if (var.is_null() && c >= cols)
break;
if (c > 0)
out << '\t';
const TVariant& var = get(c);
if (!var.is_empty())
{
var.as_string(val);
@ -249,7 +276,8 @@ bool TRecordset::save_as_campo(const char* path)
out << "[Head]" << endl;
out << "Version=0";
for (unsigned int c = 0; c < columns(); c++)
const unsigned int cols = columns();
for (unsigned int c = 0; c < cols; c++)
{
const TRecordset_column_info& ci = column_info(c);
if ((c % 8) == 0)
@ -263,11 +291,14 @@ bool TRecordset::save_as_campo(const char* path)
TString val;
for (bool ok = move_first(); ok; ok = move_next())
{
for (unsigned int c = 0; c < columns(); c++)
for (unsigned int c = 0; ; c++)
{
const TVariant& var = get(c);
if (var.is_null() && c >= cols)
break;
if (c > 0)
out << '|';
const TVariant& var = get(c);
if (!var.is_empty())
{
var.as_string(val);

View File

@ -2496,7 +2496,12 @@ bool TReport::do_message(const TVariant& var, FLDMSG_FUNC msg, void* jolly)
if (msg == do_show)
sec.show(jolly != 0); else
if (msg == do_enable)
sec.activate(jolly != 0);
sec.activate(jolly != 0); else
if (msg == do_set_size)
{
const TPoint& pt = *(const TPoint*)jolly;
sec.set_height(pt.y);
}
}
break;
case 3: // E' un campo singolo
@ -2947,26 +2952,51 @@ bool TReport::execute_usr_word(unsigned int opcode, TVariant_stack& stack)
break;
case 4: // GET_POS
{
const TReport_field* fld = field(stack.pop().as_string());
real x, y;
if (fld != NULL)
{
const TRectangle& r = fld->get_draw_rect();
x = r.x / CENTO; y = r.y / CENTO;
}
int level, id;
char type;
const int k = parse_field(stack.pop().as_string(), type, level, id);
if (k != 3) // E' una sezione
x = y = ZERO;
else
{
const TReport_field* fld = section(type, level).find_field(id);
if (fld != NULL)
{
const TRectangle& r = fld->get_draw_rect();
x = r.x / CENTO; y = r.y / CENTO;
}
}
stack.push(x); stack.push(y);
}
break;
case 5: // GET_SIZE
{
const TReport_field* fld = field(stack.pop().as_string());
real w, h;
if (fld != NULL)
{
const TRectangle& r = fld->get_draw_rect();
w = r.width() / CENTO; h = r.height() / CENTO;
}
stack.push(w); stack.push(h);
int level, id;
char type;
const int k = parse_field(stack.pop().as_string(), type, level, id);
if (k == 2) // E' una sezione
{
TReport_section& sec = section(type, level);
w = sec.width() / CENTO;
h = sec.height() / CENTO;
}
else
{
const TReport_field* fld = section(type, level).find_field(id);
if (fld != NULL)
{
const TRectangle& r = fld->get_draw_rect();
w = r.width() / CENTO; h = r.height() / CENTO;
}
}
stack.push(w); stack.push(h);
}
break;
case 6: // HIDE

View File

@ -251,7 +251,7 @@ unsigned int TCSV_recordset::columns() const
unsigned int c = _trc.items();
if (c == 0)
{
items();
const TRecnotype i = items();
c = _trc.items();
}
return c;

View File

@ -929,22 +929,23 @@ int bban_check(const TString& b, TString& msg)
HIDDEN bool _iban_val(TMask_field& f, KEY key)
{
TMask& m = f.mask();
const int nparms = get_val_param_count();
CHECKD(nparms == 8, "IBAN_CHECK deve avere 8 parametri: ", nparms);
int id[8];
for (int i = 0; i < 8; i++)
id[i] = get_int_val_param(i);
bool ok = true;
if (f.dlg() == id[1]) // Campo Stato IBAN
if (key == K_TAB || key == K_ENTER)
{
if (key == K_TAB && !m.is_running())
TMask& m = f.mask();
const int nparms = get_val_param_count();
CHECKD(nparms == 8, "IBAN_CHECK deve avere 8 parametri: ", nparms);
int id[8];
for (int i = 0; i < 8; i++)
id[i] = get_int_val_param(i);
if (f.dlg() == id[1]) // Campo Stato IBAN
{
const TString& iban = m.get(id[0]);
if (iban.not_empty())
if (key == K_TAB && !m.is_running())
{
const TString& iban = m.get(id[0]);
m.set(id[1], iban.left(2));
m.set(id[2], iban.mid(2,2));
m.set(id[3], iban.mid(4));
@ -953,70 +954,73 @@ HIDDEN bool _iban_val(TMask_field& f, KEY key)
m.set(id[6], iban.mid(10,5));
m.set(id[7], iban.mid(15));
}
const bool italy = f.empty() || f.get() == "IT";
m.show(id[3], !italy);
m.show(id[4], italy);
m.show(id[5], italy);
m.show(id[6], italy);
m.show(id[7], italy);
}
const bool italy = f.empty() || f.get() == "IT";
m.show(id[3], !italy);
m.show(id[4], italy);
m.show(id[5], italy);
m.show(id[6], italy);
m.show(id[7], italy);
}
if (f.dlg() == id[2] && key == K_ENTER)
{
const TString& stato = m.get(id[1]);
const bool italy = stato.empty() || stato == "IT";
TString80 iban;
if (italy && f.empty() && m.get(id[7]).not_empty())
{
bool found = false;
TString16 cin;
TString msg;
for (int i = 99; !found && i >= 0; i--)
{
cin.format("%02d", i);
iban = "IT";
iban << cin << m.get(id[4]) << m.get(id[5]) << m.get(id[6]) << m.get(id[7]);
found = iban_check(iban, msg) == 0;
}
if (found)
{
m.set(id[1], "IT");
m.set(id[2], cin);
}
}
else
{
const bool do_test = !f.empty() && !m.field(id[italy ? 7 : 3]).empty(); // Faccio il test solo in presenza di conto corrente
if (do_test)
{
iban << m.get(id[1]) << m.get(id[2]);
if (italy)
iban << m.get(id[4]) << m.get(id[5]) << m.get(id[6]) << m.get(id[7]);
else
iban << m.get(id[3]);
TString msg;
const int err = iban_check(iban, msg);
if (err != 0)
{
msg.insert(TR("Codice IBAN errato:\n"));
if (err > 1) // Errore grave
ok = error_box(msg);
else
{
msg << '\n' << TR("Si desidera continuare ugualmente?");
ok = yesno_box(msg);
}
}
}
}
if (key == K_ENTER)
if (f.dlg() == id[2])
{
if (!ok) iban.cut(0);
m.set(id[0], iban);
TString4 stato = m.get(id[1]);
if (stato.empty())
stato = "IT";
const bool italy = stato=="IT";
const bool do_test = !m.field(id[italy ? 7 : 3]).empty(); // Faccio il test solo in presenza di conto corrente
TString80 iban;
if (do_test)
{
if (f.empty()) // Cifra di controllo vuota
{
TString msg;
TString80 iban;
iban << stato << "@@";
if (italy)
iban << m.get(id[4]) << m.get(id[5]) << m.get(id[6]) << m.get(id[7]);
else
iban << m.get(id[3]);
int err = 1;
for (int pp = 0; pp <= 99 && err == 1; pp++)
{
msg.format("%02d", pp);
iban.overwrite(msg, 2);
err = iban_check(iban, msg);
if (err == 0)
{
m.set(id[1], stato);
m.set(id[2], pp);
break;
}
}
}
iban << m.get(id[1]) << m.get(id[2]);
if (italy)
iban << m.get(id[4]) << m.get(id[5]) << m.get(id[6]) << m.get(id[7]);
else
iban << m.get(id[3]);
TString msg;
const int err = iban_check(iban, msg);
if (err != 0)
{
msg.insert(TR("Codice IBAN errato:\n"));
if (err > 1) // Errore grave
ok = error_box(msg);
else
{
msg << '\n' << TR("Si desidera continuare ugualmente?");
ok = yesno_box(msg);
}
}
}
if (key == K_ENTER)
{
if (!ok) iban.cut(0);
m.set(id[0], iban);
}
}
}
@ -1027,7 +1031,7 @@ HIDDEN bool _bban_val(TMask_field& f, KEY key)
{
bool ok = true;
if (key == K_ENTER && !f.empty())
if (!f.empty() && f.to_check(key))
{
TMask& m = f.mask();
const int nparms = get_val_param_count();
@ -1036,7 +1040,26 @@ HIDDEN bool _bban_val(TMask_field& f, KEY key)
for (int i = 0; i < 5; i++)
id[i] = get_int_val_param(i);
if (f.dlg() == id[1])
if (m.field(id[1]).empty()) // CIN vuoto
{
TString msg;
TString80 bban;
bban << "#" << m.get(id[2]) << m.get(id[3]) << m.get(id[4]);
int err = 1;
for (char cin = 'A'; cin <= 'Z' && err == 1; cin++)
{
bban[0] = cin;
err = bban_check(bban, msg);
if (err == 0)
{
m.set(id[1], bban.left(1));
break;
}
}
}
if (f.dlg() == id[1] && key == K_ENTER)
{
TString80 bban;
for (int i = 1; i < 5; i++)