Patch level :2.2 2006 nopatch

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :stampa proiezione ammortamenti cespiti iniziata (e incasinatissima)


git-svn-id: svn://10.65.10.50/trunk@13968 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2006-05-08 16:58:52 +00:00
parent 8f54bee16d
commit d459a2e78e
6 changed files with 572 additions and 4 deletions

View File

@ -9,10 +9,10 @@ int main(int argc,char** argv)
{
case 1:
ce4200(argc,argv); break; //calcolo cespiti per commessa
/* case 2:
ce4300(argc,argv); break;*/ //stampa cespiti per commessa
case 2:
ce4300(argc,argv); break; //stampa proiezione ammortamenti cespiti
case 0:
default: ce4100(argc,argv) ; break; // inserimento cespiti per commessa (personalizzazione CRPA)
default: ce4100(argc,argv) ; break; // inserimento cespiti per commessa
}
return 0;
}

View File

@ -3,7 +3,7 @@
int ce4100(int argc, char* argv[]);
int ce4200(int argc, char* argv[]);
//int ce4300(int argc, char* argv[]);
int ce4300(int argc, char* argv[]);
#endif // __CE4_H

269
ce/ce4300.cpp Executable file
View File

@ -0,0 +1,269 @@
#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 "movce.h"
#include "salce.h"
#include "celib.h"
#include "ce4.h"
#include "ce4300.h"
////////////////////////////////////////////////////////
// MASCHERA
////////////////////////////////////////////////////////
class TStampa_proiez_ammo_mask : public TAutomask
{
protected:
bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
TStampa_proiez_ammo_mask();
virtual ~TStampa_proiez_ammo_mask() {}
};
bool TStampa_proiez_ammo_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
bool ok = true;
switch (o.dlg())
{
case F_FROM_CAT:
case F_D_FROM_CAT:
case F_TO_CAT:
case F_D_TO_CAT:
{
TDitta_cespiti& dc = ditta_cespiti();
ok = dc.on_category_event(o, e, jolly);
}
break;
case F_ESERCIZIO:
case F_GRUPPO:
case F_SPECIE:
if (e == fe_init || e == fe_modify)
{
const TString& esercizio = get(F_ESERCIZIO);
const TString& gruppo = get(F_GRUPPO);
const TString& specie = get(F_SPECIE);
TString16 key; key << esercizio << gruppo << specie;
TRelation ccb("CCB");
ccb.curr().put("CODTAB", key);
if (ccb.read() == NOERR)
autoload(ccb);
}
break;
default: break;
}
return ok;
}
TStampa_proiez_ammo_mask::TStampa_proiez_ammo_mask()
:TAutomask("ce4300")
{}
///////////////////////////////////////////////////////////////
// RECORDSET
///////////////////////////////////////////////////////////////
class TStampa_proiez_ammo_recordset : public TISAM_recordset
{
public:
void set_filter(const TStampa_proiez_ammo_mask& msk);
TStampa_proiez_ammo_recordset(const TString& sql) : TISAM_recordset(sql) { }
};
static const TStampa_proiez_ammo_recordset* myself = NULL;
//metodo per caricare i valori nel recordset dalla maschera...fighissimo!!
void TStampa_proiez_ammo_recordset::set_filter(const TStampa_proiez_ammo_mask& msk)
{
const TString& gruppo = msk.get(F_GRUPPO);
const TString& specie = msk.get(F_SPECIE);
TString8 attivita;
attivita.format("%-2s%-4s", (const char*)gruppo, (const char*)specie);
const TString& dacat = msk.get(F_FROM_CAT);
const TString& acat = msk.get(F_TO_CAT);
TString query = "USE %CAC";
query << " SELECT ((CODTAB[1,6]=' ')||(CODTAB[1,6]='" << attivita << "'))";
if (dacat.full() || acat.full())
{
if (dacat == acat)
query << "&&(CODTAB[7,8]==" << dacat << ")";
else
{
if (dacat.full())
query << "&&(CODTAB[7,8]>=" << dacat << ")";
if (acat.full())
query << "&&(CODTAB[7,8]<=" << acat << ")";
}
}
query << "\nBY I0 CODTAB[7,8]";
set(query); //setta la nuova query nel report (che avrebbe solo USE CESPI)
}
////////////////////////////////////////////////////////
// REPORT
////////////////////////////////////////////////////////
class TStampa_proiez_ammo_rep : public TReport
{
int _anno;
protected:
virtual bool get_usr_val(const TString& name, TVariant& var) const;
public:
void set_filter(const TStampa_proiez_ammo_mask& msk);
};
void TStampa_proiez_ammo_rep::set_filter(const TStampa_proiez_ammo_mask& msk)
{
_anno = msk.get_int(F_ESERCIZIO);
((TStampa_proiez_ammo_recordset*) recordset())->set_filter(msk);
}
//metodo per il calcolo dei campi da calcolare (ma va'!) nel report
bool TStampa_proiez_ammo_rep::get_usr_val(const TString& name, TVariant& var) const
{
const TRecordset& recset = *recordset();
const TString& idcespite = recset.get("IDCESPITE").as_string();
if (name == "#DESCAT") //categoria (descrizione della categoria corrente)
{
const int gruppo = recset.get("CODCGRA").as_int();
const TString& specie = recset.get("CODSPA").as_string();
const int categoria = recset.get("CODCAT").as_int();
const TRectype& rec_cac = ditta_cespiti().categoria(gruppo, specie, categoria);
var = rec_cac.get("S0");
return true;
}
if (name == "#ANNOES")
{
var.set(_anno);
return true;
}
if (name == "#FINESCPREC")
{
TEsercizi_contabili esc;
TDate dal, al;
esc.code2range(_anno, dal, al);
var.set(dal - 1L);
return true;
}
if (name == "#ALIENAZ") //movimenti di vendita
{
//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;
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;
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;
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;
return true;
}
return TReport::get_usr_val(name, var);
}
////////////////////////////////////////////////////////
// APPLICAZIONE
////////////////////////////////////////////////////////
class TStampa_proiez_ammo : public TSkeleton_application
{
protected:
virtual void main_loop();
};
void TStampa_proiez_ammo::main_loop()
{
TStampa_proiez_ammo_mask mask;
while (mask.run() == K_ENTER)
{
//report e book dei report
TReport_book book;
TStampa_proiez_ammo_rep rep;
rep.load("ce4300a");
rep.set_filter(mask);
book.add(rep);
book.print_or_preview(); //stampa il book dei report
}
}
int ce4300(int argc, char* argv[])
{
TStampa_proiez_ammo a;
a.run(argc, argv, TR("Stampa proiezione ammortamenti cespiti"));
return 0;
}

19
ce/ce4300.h Executable file
View File

@ -0,0 +1,19 @@
//campi maschera ce4300.uml
#define F_CODDITTA 101
#define F_RAGSOC 102
#define F_ESERCIZIO 103
#define F_DATAINIZIO 104
#define F_DATAFINE 105
#define F_GRUPPO 106
#define F_SPECIE 107
#define F_D_GRUPPO 108
#define F_D_SPECIE 109
#define F_CODTAB 110
#define F_D_CODTAB 111
#define F_FROM_CAT 112
#define F_D_FROM_CAT 113
#define F_TO_CAT 114
#define F_D_TO_CAT 115
#define F_REPORT 116

150
ce/ce4300.uml Executable file
View File

@ -0,0 +1,150 @@
#include "ce4300.h"
TOOLBAR "" 0 -3 0 3
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -12 -11 "~Stampa"
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -11 ""
END
ENDPAGE
PAGE "Proiezione ammortamenti cespiti" -1 -1 78 6
GROUPBOX DLG_NULL 78 6
BEGIN
PROMPT 1 0 ""
FLAGS "R"
END
NUMBER F_CODDITTA 5
BEGIN
PROMPT 2 1 "Ditta "
FLAGS "DF"
USE LF_NDITTE
INPUT CODDITTA F_CODDITTA
OUTPUT F_RAGSOC RAGSOC
CHECKTYPE REQUIRED
END
STRING F_RAGSOC 55
BEGIN
PROMPT 20 1 ""
FLAGS "D"
END
NUMBER F_ESERCIZIO 4
BEGIN
PROMPT 2 2 "Esercizio "
FLAGS "Z"
USE CCE
JOIN ESC ALIAS 105 INTO CODTAB==CODTAB
INPUT CODTAB F_ESERCIZIO
DISPLAY "Codice esercizio" CODTAB
DISPLAY "Data inizio@15" 105@->D0
DISPLAY "Data fine@15" 105@->D1
OUTPUT F_ESERCIZIO CODTAB
OUTPUT F_DATAINIZIO 105@->D0
OUTPUT F_DATAFINE 105@->D1
CHECKTYPE REQUIRED
END
DATE F_DATAINIZIO
BEGIN
PROMPT 20 2 "Data inizio "
FLAGS "D"
END
DATE F_DATAFINE
BEGIN
PROMPT 45 2 "Data fine "
FLAGS "D"
END
NUMBER F_GRUPPO 2
BEGIN
PROMPT 2 3 "Gruppo "
FLAGS "Z"
USE CCB KEY 1
JOIN %CGR ALIAS 106 INTO CODTAB==CODTAB[5,6]
INPUT CODTAB[1,4] F_ESERCIZIO SELECT
INPUT CODTAB[5,6] F_GRUPPO
INPUT CODTAB[7,10] F_SPECIE
DISPLAY "Codice" CODTAB[5,6]
DISPLAY "Descrizione@60" 106@->S0
OUTPUT F_GRUPPO CODTAB[5,6]
OUTPUT F_D_GRUPPO 106@->S0
CHECKTYPE NORMAL
FIELD CODTAB[5,6]
END
STRING F_SPECIE 4
BEGIN
PROMPT 2 4 "Specie "
FLAGS "_"
USE CCB KEY 1
JOIN %CAT ALIAS 107 INTO CODTAB[1,2]==CODTAB[5,6] CODTAB[3,6]==CODTAB[7,10]
INPUT CODTAB[1,4] F_ESERCIZIO SELECT
INPUT CODTAB[5,6] F_GRUPPO SELECT
INPUT CODTAB[7,10] F_SPECIE
DISPLAY "Gruppo" CODTAB[5,6]
DISPLAY "Specie" CODTAB[7,10]
DISPLAY "Descrizione@60" 107@->S0
OUTPUT F_SPECIE CODTAB[7,10]
OUTPUT F_D_SPECIE 107@->S0
CHECKTYPE NORMAL
FIELD CODTAB[7,10]
END
STRING F_D_GRUPPO 60 55
BEGIN
PROMPT 20 3 ""
FLAGS "D"
END
STRING F_D_SPECIE 60 55
BEGIN
PROMPT 20 4 ""
FLAGS "D"
END
GROUPBOX DLG_NULL 78 4
BEGIN
PROMPT 1 6 "@bSelezione categoria"
GROUP 1
END
NUMBER F_FROM_CAT 2
BEGIN
PROMPT 2 7 "Dalla "
FLAGS "BZ"
GROUP 1
END
STRING F_D_FROM_CAT 60 50
BEGIN
PROMPT 25 7 ""
FLAGS "B"
GROUP 1
END
NUMBER F_TO_CAT 2
BEGIN
PROMPT 2 8 "Alla "
FLAGS "BZ"
GROUP 1
END
STRING F_D_TO_CAT 60 50
BEGIN
PROMPT 25 8 ""
FLAGS "B"
GROUP 1
END
ENDPAGE

130
ce/ce4300a.rep Executable file
View File

@ -0,0 +1,130 @@
<report name="ce4300a" lpi="6">
<description>Proiezione ammortamenti cespiti</description>
<font face="Courier New" size="8" />
<section type="Head">
<font face="Courier New" bold="1" size="8" />
</section>
<section type="Head" level="1" height="6">
<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="PROIEZIONE AMMORTAMENTI CESPITI">
<font face="Courier New" bold="1" size="16" />
</field>
<field border="2" y="4" type="Linea" width="176" 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>
</field>
<field x="79" y="4.5" type="Data" width="10" pattern="1">
<source>#SYSTEM.DATE</source>
</field>
<field x="157" y="4.5" type="Numero" align="right" width="3" pattern="1">
<source>#REPORT.PAGE</source>
</field>
</section>
<section repeat="1" type="Head" level="2">
<groupby>I0</groupby>
<font face="Courier New" bold="1" size="8" />
<field x="1" type="Testo" width="12" pattern="1" text="TIPO BENI:">
<font face="Courier New" bold="1" size="9" />
</field>
<field x="13" type="Array" width="15" pattern="1">
<font face="Courier New" bold="1" size="9" />
<source>I0</source>
<list>
<li Value="Materiali" Code="0" />
<li Value="Immateriali" Code="1" />
<li Value="Pluriennali" Code="2" />
</list>
</field>
<field x="30" y="1.25" type="Testo" align="right" width="12" height="0.75" pattern="1" text="Valore al" />
<field x="57" y="1.25" type="Testo" align="right" width="13" height="0.75" pattern="1" text="Fondo amm. al" />
<field x="71" y="1.25" type="Testo" align="right" width="13" height="0.75" pattern="1" text="Val. residuo" />
<field x="92" y="1.25" type="Testo" align="right" width="12" height="0.75" pattern="1" text="Ammortamento" />
<field x="105" y="1.25" type="Testo" align="right" width="12" height="0.75" pattern="1" text="Ammortamento" />
<field x="118" y="1.25" type="Testo" align="right" width="12" height="0.75" pattern="1" text="Ammortamento" />
<field x="131.1" y="1.25" type="Testo" align="right" width="12" height="0.75" pattern="1" text="Ammortamento" />
<field x="144" y="1.25" type="Testo" align="right" width="12" height="0.75" pattern="1" text="Ammortamento" />
<field x="157" y="1.25" type="Testo" align="right" width="12" height="0.75" pattern="1" text="Residuo da" />
<field x="1" y="2" type="Testo" width="10" pattern="1" text="Categoria" />
<field x="30" y="2" type="Stringa" align="right" width="12" height="0.75" pattern="1">
<source>#FINESCPREC</source>
</field>
<field x="44" y="2" type="Testo" align="right" width="12" pattern="1" text="Alienazioni" />
<field x="58" y="2" type="Data" align="right" width="12" height="0.75" pattern="1">
<source>#FINESCPREC</source>
</field>
<field x="72" y="2" type="Testo" align="right" width="12" height="0.75" pattern="1" text="da ammortizz" />
<field x="86" y="2" type="Testo" align="right" width="5" pattern="1" text="Aliq." />
<field x="95" y="2" type="Numero" align="right" width="6" height="0.75" pattern="1">
<source>#ANNOES</source>
</field>
<field x="108" y="2" type="Numero" align="right" width="6" height="0.75" pattern="1">
<source>#ANNOES+1</source>
</field>
<field x="121" y="2" type="Numero" align="right" width="6" height="0.75" pattern="1">
<source>#ANNOES+2</source>
</field>
<field x="134" y="2" type="Numero" align="right" width="6" height="0.75" pattern="1">
<source>#ANNOES+3</source>
</field>
<field x="147" y="2" type="Numero" align="right" width="6" height="0.75" pattern="1">
<source>#ANNOES+4</source>
</field>
<field x="157" y="2" type="Testo" align="right" width="12" height="0.75" pattern="1" text="ammortizzare" />
<field border="1" x="1" y="3" type="Linea" width="172" height="0" pattern="1" />
</section>
<section type="Body" />
<section type="Body" level="1">
<field x="1" type="Stringa" width="2" pattern="1">
<source>CODTAB[7,8]</source>
</field>
<field x="4" type="Stringa" dynamic_height="1" width="25" height="2" pattern="1">
<source>S0</source>
</field>
<field x="87" type="Numero" align="right" width="4" pattern="1">
<source>#PERCAMM</source>
</field>
<field x="92" type="Numero" align="right" width="12" pattern="1">
<source>#QAMM</source>
</field>
<field x="105" type="Numero" align="right" width="12" pattern="1">
<source>#QAMM</source>
</field>
<field x="118" type="Numero" align="right" width="12" pattern="1">
<source>#QAMM</source>
</field>
<field x="131" type="Numero" align="right" width="12" pattern="1">
<source>#QAMM</source>
</field>
<field x="144" type="Numero" align="right" width="12" pattern="1">
<source>#QAMM</source>
</field>
<field x="157" type="Numero" align="right" width="12" pattern="1">
<source>#RESAMM</source>
</field>
<field x="30" type="Valuta" align="right" width="12" id="101" pattern="1" text="#########,@@">
<source>#COSTO</source>
</field>
<field x="44" type="Valuta" align="right" width="12" id="102" pattern="1" text="#########,@@">
<source>#ALIENAZ</source>
</field>
<field x="58" type="Numero" align="right" width="12" id="103" pattern="1">
<source>#FAMM</source>
</field>
<field x="72" type="Valuta" align="right" width="12" id="104" pattern="1" text="###.###.###,@@">
<source>#101-#102-#103</source>
</field>
</section>
<section type="Head" level="11" />
<section type="Body" level="11">
<sql>USE CESPI KEY 2</sql>
</section>
<section type="Foot" level="11" />
<section type="Foot" />
<section type="Foot" level="1" />
<section type="Foot" level="2" height="1">
<field border="1" x="1" y="0.5" type="Linea" width="196" height="0" pattern="1" />
</section>
<sql>USE %CAC
BY I0 CODTAB[7,8]</sql>
</report>