Patch level :4.0 566
Files correlati : Ricompilazione Demo : [ ] Commento :corretta stampa registro cespiti leggibile git-svn-id: svn://10.65.10.50/trunk@14633 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
78ed3a94e5
commit
85560502f5
@ -1869,6 +1869,36 @@ int TCespite::read(const char* id)
|
||||
return err;
|
||||
}
|
||||
|
||||
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)
|
||||
_salini = salce.curr();
|
||||
else
|
||||
_salini.zero();
|
||||
|
||||
fill_sal_key(salce.curr(), esercizio, 2);
|
||||
if (salce.read() == NOERR)
|
||||
_salpro = salce.curr();
|
||||
else
|
||||
_salpro = _salini;
|
||||
|
||||
TLocalisamfile ammce(LF_AMMCE);
|
||||
fill_amm_key(ammce.curr(), esercizio, 1);
|
||||
if (ammce.read() == NOERR)
|
||||
_ammini = ammce.curr();
|
||||
else
|
||||
_ammini.zero();
|
||||
|
||||
fill_amm_key(ammce.curr(), esercizio, 2);
|
||||
if (ammce.read() == NOERR)
|
||||
_ammpro = ammce.curr();
|
||||
else
|
||||
_ammpro = _ammini;
|
||||
}
|
||||
|
||||
TCespite::TCespite()
|
||||
: TRectype(LF_CESPI), _salini(LF_SALCE), _salpro(LF_SALCE), _ammini(LF_AMMCE), _ammpro(LF_AMMCE)
|
||||
{
|
||||
|
@ -30,8 +30,6 @@ protected:
|
||||
real get_limit() const;
|
||||
void prepara_saldi(bool is_valid);
|
||||
|
||||
real val_amm() const;
|
||||
real res_amm() const;
|
||||
real mov_val_amm(const TRectype& tmv) const;
|
||||
real mov_res_amm(const TRectype& tmv, const TRectype& tmvam) const;
|
||||
real calcola_spese_manutenzione(const real& valamm);
|
||||
@ -73,10 +71,15 @@ public:
|
||||
|
||||
const TRectype& categoria() const;
|
||||
TTipo_cespite tipo() const;
|
||||
const TRectype& sal_ini() const { return _salini; }
|
||||
const TRectype& sal_pro() const { return _salpro; }
|
||||
const TRectype& amm_ini() const { return _ammini; }
|
||||
const TRectype& amm_pro() const { return _ammpro; }
|
||||
real val_amm() const;
|
||||
real res_amm() const;
|
||||
|
||||
int read(const char* id);
|
||||
void load_saldi(const int tiposit, const int esercizio);
|
||||
TCespite();
|
||||
TCespite(const char* id);
|
||||
TCespite(const TRectype& rec);
|
||||
|
101
ce/ce3900.cpp
101
ce/ce3900.cpp
@ -1,18 +1,18 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <execp.h>
|
||||
#include <progind.h>
|
||||
#include <recarray.h>
|
||||
#include <recset.h>
|
||||
#include <reprint.h>
|
||||
|
||||
#include "../cg/cglib01.h"
|
||||
|
||||
#include "ammce.h"
|
||||
#include "cespi.h"
|
||||
#include "movce.h"
|
||||
#include "salce.h"
|
||||
#include "celib.h"
|
||||
|
||||
#include "ce2101.h"
|
||||
#include "ce3.h"
|
||||
#include "ce3900.h"
|
||||
|
||||
@ -89,24 +89,21 @@ void TStampa_sintetica_recordset::set_filter(const TStampa_sintetica_mask& msk)
|
||||
{
|
||||
const TString& dacat = msk.get(F_FROM_CAT);
|
||||
const TString& acat = msk.get(F_TO_CAT);
|
||||
TString query = "USE CESPI";
|
||||
TString query = "USE CESPI SELECT\n";
|
||||
query << "((DTALIEN='')||(ANSI(DTALIEN)>=" << msk.get_date(F_DATAINIZIO).date2ansi() << "))";
|
||||
query << "&&(ANSI(DTCOMP)<=" << msk.get_date(F_DATAFINE).date2ansi() << ")";
|
||||
if (dacat.full() || acat.full())
|
||||
{
|
||||
query << " SELECT ";
|
||||
if (dacat == acat)
|
||||
{
|
||||
query << "CODCAT==" << dacat;
|
||||
query << "&&(CODCAT==" << dacat << ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dacat.full())
|
||||
query << "(CODCAT>=" << dacat << ")";
|
||||
query << "&&(CODCAT>=" << dacat << ")";
|
||||
if (acat.full())
|
||||
{
|
||||
if (dacat.full())
|
||||
query << "&&";
|
||||
query << "(CODCAT<=" << acat << ")";
|
||||
}
|
||||
query << "&&(CODCAT<=" << acat << ")";
|
||||
}
|
||||
}
|
||||
query << "\nBY CODCAT|IDCESPITE";
|
||||
@ -119,6 +116,8 @@ void TStampa_sintetica_recordset::set_filter(const TStampa_sintetica_mask& msk)
|
||||
class TStampa_sintetica_rep : public TReport
|
||||
{
|
||||
int _anno;
|
||||
TCespite _cespite;
|
||||
|
||||
protected:
|
||||
virtual bool get_usr_val(const TString& name, TVariant& var) const;
|
||||
public:
|
||||
@ -136,6 +135,13 @@ bool TStampa_sintetica_rep::get_usr_val(const TString& name, TVariant& var) cons
|
||||
{
|
||||
const TRecordset& recset = *recordset();
|
||||
const TString& idcespite = recset.get("IDCESPITE").as_string();
|
||||
if (idcespite != _cespite.get(CESPI_IDCESPITE))
|
||||
{
|
||||
TCespite& c = (TCespite&)_cespite;
|
||||
c.read(idcespite);
|
||||
c.load_saldi(1, _anno);
|
||||
}
|
||||
|
||||
if (name == "#DESCAT") //categoria (descrizione della categoria corrente)
|
||||
{
|
||||
const int gruppo = recset.get("CODCGRA").as_int();
|
||||
@ -145,78 +151,37 @@ bool TStampa_sintetica_rep::get_usr_val(const TString& name, TVariant& var) cons
|
||||
var = rec_cac.get("S0");
|
||||
return true;
|
||||
}
|
||||
if (name == "#ALIENAZ") //movimenti di vendita
|
||||
if (name.starts_with("#COSTO")) //costo storico dell'anno
|
||||
{
|
||||
//cerca tutti i movimenti di vendita relativi al cespite corrente all'interno dell'esercizio..
|
||||
//..selezionato sulla maschera;somma i loro importi in modo da ricavare l'importo complessivo..
|
||||
//..di tutti
|
||||
TString query;
|
||||
|
||||
TEsercizi_contabili esc;
|
||||
const TDate& dataini = esc[_anno].inizio();
|
||||
const TDate& datafine = esc[_anno].fine();
|
||||
|
||||
query.format("USE MOVCE KEY 2 SELECT NUM(ANSI(DTMOV)>=%ld)&&NUM(ANSI(DTMOV)<=%ld)\nFROM IDCESPITE=%s\nTO IDCESPITE=%s",
|
||||
dataini.date2ansi(), datafine.date2ansi(), (const char*)idcespite, (const char*)idcespite);
|
||||
TISAM_recordset isam(query);
|
||||
real somma_vendite;
|
||||
for (TRecnotype i = 0; isam.move_to(i); i++)
|
||||
{
|
||||
const real vendita = isam.get(MOVCE_IMPVEN).as_real();
|
||||
somma_vendite += vendita;
|
||||
}
|
||||
var = somma_vendite;
|
||||
|
||||
return true;
|
||||
}
|
||||
if (name == "#COSTO") //costo
|
||||
{
|
||||
TToken_string key;
|
||||
key = idcespite; //cespite
|
||||
key.add(_anno); //esercizio
|
||||
key.add(1); //tiposaldo finale
|
||||
const TRectype& rec_salce = cache().get(LF_SALCE, key);
|
||||
const real costo = rec_salce.get_real(SALCE_CSTO);
|
||||
var = costo;
|
||||
if (name.ends_with("FIN")) //tiposaldo finale
|
||||
var = _cespite.sal_pro().get_real(SALCE_CSTO);
|
||||
else //tiposaldo iniziale
|
||||
var = _cespite.sal_ini().get_real(SALCE_CSTO);
|
||||
return true;
|
||||
}
|
||||
if (name == "#PERCAMM") //percentuale ammortamento
|
||||
{
|
||||
TToken_string key;
|
||||
key = idcespite;
|
||||
key.add(_anno);
|
||||
key.add(2); //tiposaldo finale
|
||||
key.add(1); //tipoamm fiscale
|
||||
const TRectype& rec_ammce = cache().get(LF_AMMCE, key);
|
||||
const real percamm = rec_ammce.get_real(AMMCE_PNOR) + rec_ammce.get_real(AMMCE_PACC) + rec_ammce.get_real(AMMCE_PANT);
|
||||
var = percamm;
|
||||
const TRectype& rec_ammce = _cespite.amm_pro();
|
||||
var = rec_ammce.get_real(AMMCE_PNOR) + rec_ammce.get_real(AMMCE_PACC) + rec_ammce.get_real(AMMCE_PANT);
|
||||
return true;
|
||||
}
|
||||
if (name == "#QAMM") //fondo ammortamento esercizio corrente
|
||||
{
|
||||
TToken_string key;
|
||||
key = idcespite;
|
||||
key.add(_anno);
|
||||
key.add(2); //tiposaldo finale
|
||||
key.add(1); //tipoamm fiscale
|
||||
const TRectype& rec_ammce = cache().get(LF_AMMCE, key);
|
||||
const real quotamm = rec_ammce.get_real(AMMCE_QNOR) + rec_ammce.get_real(AMMCE_QACC) + rec_ammce.get_real(AMMCE_QANT);
|
||||
var = quotamm;
|
||||
const TRectype& rec_ammce = _cespite.amm_pro();
|
||||
var = rec_ammce.get_real(AMMCE_QNOR) + rec_ammce.get_real(AMMCE_QACC) + rec_ammce.get_real(AMMCE_QANT);
|
||||
return true;
|
||||
}
|
||||
if (name == "#FAMM") //fondo ammortamento alla fine dell'esercizio precedente
|
||||
{
|
||||
TToken_string key;
|
||||
key = idcespite;
|
||||
key.add(_anno);
|
||||
key.add(1); //tiposaldo iniziale
|
||||
key.add(1); //tipoamm fiscale
|
||||
const TRectype& rec_ammce = cache().get(LF_AMMCE, key);
|
||||
const real quotamm = rec_ammce.get_real(AMMCE_QNOR) + rec_ammce.get_real(AMMCE_QACC) + rec_ammce.get_real(AMMCE_QANT);
|
||||
var = quotamm;
|
||||
const TRectype& rec_ammce = _cespite.amm_ini();
|
||||
var = rec_ammce.get_real(AMMCE_QNOR) + rec_ammce.get_real(AMMCE_QACC) + rec_ammce.get_real(AMMCE_QANT);
|
||||
return true;
|
||||
}
|
||||
if (name == "#RESAMM") //residuo da ammortizzare
|
||||
{
|
||||
var = _cespite.res_amm();
|
||||
return true;
|
||||
}
|
||||
|
||||
return TReport::get_usr_val(name, var);
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
<font face="Courier New" size="8" />
|
||||
<section type="Head">
|
||||
<font face="Courier New" bold="1" size="8" />
|
||||
<field x="24" y="0.5" type="Testo" align="center" width="10" pattern="1" text="Date" />
|
||||
<field x="90" y="0.5" type="Testo" width="8" pattern="1" text="Valori" />
|
||||
<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="158.5" y="0.75" type="Testo" align="right" width="15" pattern="1" text="Valore residuo" />
|
||||
<field x="1.5" y="1.5" type="Testo" width="10" pattern="1" text="Codice" />
|
||||
@ -13,9 +13,9 @@
|
||||
<field x="24.5" y="1.5" type="Testo" width="10" pattern="1" text="Acquisto" />
|
||||
<field x="35" y="1.5" type="Testo" width="10" pattern="1" text="Entr. Funz." />
|
||||
<field x="46" y="1.5" type="Testo" width="28" pattern="1" text="Descrizione" />
|
||||
<field x="72.5" y="1.5" type="Testo" align="right" width="12" pattern="1" text="Acquisizione" />
|
||||
<field x="85.5" y="1.5" type="Testo" align="right" width="12" pattern="1" text="Alienazioni" />
|
||||
<field x="98.5" y="1.5" type="Testo" align="right" width="12" pattern="1" text="Aggiornato" />
|
||||
<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="112.5" y="1.5" type="Testo" align="right" width="4" pattern="1" text="%Amm" />
|
||||
<field x="118.5" y="1.5" type="Testo" align="right" width="12" pattern="1" text="Es. corrente" />
|
||||
<field x="131.5" y="1.5" type="Testo" align="right" width="12" pattern="1" text="Fine es.prec" />
|
||||
@ -88,16 +88,16 @@ MESSAGE RESET,F2.107</prescript>
|
||||
<field x="112" type="Numero" align="right" width="6" pattern="1" text="##@,@@">
|
||||
<source>#PERCAMM</source>
|
||||
</field>
|
||||
<field x="98" type="Valuta" align="right" width="12" id="101" pattern="1" text="#########,@@">
|
||||
<source>#COSTO</source>
|
||||
<field x="72" type="Valuta" align="right" width="12" id="101" pattern="1" text="#########,@@">
|
||||
<source>#COSTOINI</source>
|
||||
<postscript description="B1.101 POSTSCRIPT">MESSAGE ADD,F2.101</postscript>
|
||||
</field>
|
||||
<field x="85" type="Valuta" align="right" width="12" id="102" pattern="1" text="#########,@@">
|
||||
<source>#ALIENAZ</source>
|
||||
<field x="98" type="Valuta" align="right" width="12" id="102" pattern="1" text="#########,@@">
|
||||
<source>#COSTOFIN</source>
|
||||
<postscript description="B1.102 POSTSCRIPT">MESSAGE ADD,F2.102</postscript>
|
||||
</field>
|
||||
<field x="72" type="Valuta" align="right" width="12" id="103" pattern="1" text="#########,@@">
|
||||
<source>#101-#102</source>
|
||||
<field x="85" type="Valuta" align="right" width="12" id="103" pattern="1" text="#########,@@">
|
||||
<source>#102-#101</source>
|
||||
<postscript description="B1.103 POSTSCRIPT">MESSAGE ADD,F2.103</postscript>
|
||||
</field>
|
||||
<field x="118" type="Valuta" align="right" width="12" id="104" pattern="1" text="#########,@@">
|
||||
@ -113,7 +113,7 @@ MESSAGE RESET,F2.107</prescript>
|
||||
<postscript description="B1.106 POSTSCRIPT">MESSAGE ADD,F2.106</postscript>
|
||||
</field>
|
||||
<field x="157" type="Valuta" align="right" width="12" id="107" pattern="1" text="#########,@@">
|
||||
<source>#101-#106</source>
|
||||
<source>#RESAMM-#QAMM</source>
|
||||
<postscript description="B1.107 POSTSCRIPT">MESSAGE ADD,F2.107</postscript>
|
||||
</field>
|
||||
</section>
|
||||
@ -122,9 +122,9 @@ MESSAGE RESET,F2.107</prescript>
|
||||
<font face="Courier New" bold="1" size="8" />
|
||||
<field border="1" x="1" y="0.5" type="Linea" width="180" height="0" pattern="1" />
|
||||
<field x="45" y="1" type="Testo" width="25" pattern="1" text="Totali generali" />
|
||||
<field x="97" y="1" type="Valuta" align="right" width="13" id="101" pattern="1" text="#########,@@" />
|
||||
<field x="84" y="1" type="Valuta" align="right" width="13" id="102" pattern="1" text="#########,@@" />
|
||||
<field x="71" y="1" type="Valuta" align="right" width="13" id="103" pattern="1" text="#########,@@" />
|
||||
<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="117" y="1" type="Valuta" align="right" width="13" id="104" pattern="1" text="#########,@@" />
|
||||
<field x="130" y="1" type="Valuta" align="right" width="13" id="105" pattern="1" text="#########,@@" />
|
||||
<field x="143" y="1" type="Valuta" align="right" width="13" id="106" pattern="1" text="#########,@@" />
|
||||
@ -134,13 +134,13 @@ MESSAGE RESET,F2.107</prescript>
|
||||
<font face="Courier New" bold="1" size="8" />
|
||||
<field border="1" x="1" y="0.5" type="Linea" width="196" height="0" pattern="1" />
|
||||
<field x="45" y="1" type="Testo" width="25" pattern="1" text="Totali per categoria" />
|
||||
<field x="98" y="1" type="Valuta" align="right" width="12" id="101" pattern="1" text="#########,@@">
|
||||
<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>
|
||||
</field>
|
||||
<field x="85" y="1" type="Valuta" align="right" width="12" id="102" pattern="1" text="#########,@@">
|
||||
<field x="98" y="1" type="Valuta" align="right" width="12" id="102" pattern="1" text="#########,@@">
|
||||
<postscript description="F2.102 POSTSCRIPT">MESSAGE ADD,F1.102</postscript>
|
||||
</field>
|
||||
<field x="72" y="1" type="Valuta" align="right" width="12" id="103" pattern="1" text="#########,@@">
|
||||
<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="118" y="1" type="Valuta" align="right" width="12" id="104" pattern="1" text="#########,@@">
|
||||
|
Loading…
x
Reference in New Issue
Block a user