Patch level :4.0 nopatch
Files correlati : Ricompilazione Demo : [ ] Commento :stampa bilancio di commessa; commit di sicurezza git-svn-id: svn://10.65.10.50/trunk@14137 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e579568335
commit
cb513d7823
155
ca/ca3800.cpp
155
ca/ca3800.cpp
@ -3,11 +3,15 @@
|
|||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <reprint.h>
|
#include <reprint.h>
|
||||||
|
|
||||||
|
#include "../cg/cglib01.h"
|
||||||
|
|
||||||
#include "ca3.h"
|
#include "ca3.h"
|
||||||
#include "ca3800.h"
|
#include "ca3800.h"
|
||||||
#include "calib01.h"
|
#include "calib01.h"
|
||||||
#include "calib02.h"
|
#include "calib02.h"
|
||||||
#include "commesse.h"
|
#include "commesse.h"
|
||||||
|
#include "panapdc.h"
|
||||||
|
#include "saldana.h"
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
// MASCHERA
|
// MASCHERA
|
||||||
@ -90,6 +94,71 @@ TPrint_bilancio_cms_mask::TPrint_bilancio_cms_mask()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
// CACHE INDICATORI BILANCIO
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
class TIndbil_cache : public TCache
|
||||||
|
{
|
||||||
|
bool _usepdcc;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual TObject* key2obj(const char* key);
|
||||||
|
|
||||||
|
public:
|
||||||
|
int get_indbil(const TString& conto);
|
||||||
|
TIndbil_cache();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
TObject* TIndbil_cache::key2obj(const char* key)
|
||||||
|
{
|
||||||
|
TString80 conto = key;
|
||||||
|
if (_usepdcc)
|
||||||
|
{
|
||||||
|
TLocalisamfile panapdc(LF_PANAPDC);
|
||||||
|
panapdc.setkey(2);
|
||||||
|
const int gr = atoi(conto.left(3));
|
||||||
|
const int co = atoi(conto.mid(3,3));
|
||||||
|
const long so = atol(conto.mid(6,6));
|
||||||
|
|
||||||
|
TRectype& panapdrec = panapdc.curr();
|
||||||
|
for (int i = 2; i >= 0; i--)
|
||||||
|
{
|
||||||
|
panapdrec.zero();
|
||||||
|
panapdrec.put(PANAPDC_GRUPPO, gr);
|
||||||
|
if (i > 0)
|
||||||
|
panapdrec.put(PANAPDC_CONTO, co);
|
||||||
|
if (i == 2)
|
||||||
|
panapdrec.put(PANAPDC_SOTTOCONTO, so);
|
||||||
|
if (panapdc.read() == NOERR)
|
||||||
|
{
|
||||||
|
conto = panapdrec.get(PANAPDC_CODCONTO);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//se non trova il corrispondente conto analitico azzera il conto per il prossimo giro
|
||||||
|
if (i < 0)
|
||||||
|
conto.cut(0);
|
||||||
|
}
|
||||||
|
//conto analitico
|
||||||
|
TAnal_bill bill(conto);
|
||||||
|
int indbil = bill.indicatore_bilancio();
|
||||||
|
TString* ib = new TString4;
|
||||||
|
*ib << indbil;
|
||||||
|
return ib;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TIndbil_cache::get_indbil(const TString& conto)
|
||||||
|
{
|
||||||
|
TString* ib = (TString*)objptr(conto);
|
||||||
|
return ib ? atoi(*ib) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
TIndbil_cache::TIndbil_cache()
|
||||||
|
{
|
||||||
|
TConfig& cfg = ca_config();
|
||||||
|
_usepdcc = cfg.get_bool("UsePdcc");
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// RECORDSET
|
// RECORDSET
|
||||||
@ -99,9 +168,12 @@ class TPrint_bilancio_cms_recordset : public TRecordset
|
|||||||
TString_array _righe;
|
TString_array _righe;
|
||||||
TRecnotype _curr;
|
TRecnotype _curr;
|
||||||
TArray _colonne;
|
TArray _colonne;
|
||||||
|
TIndbil_cache _indicatori;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _anno;
|
int _anno;
|
||||||
|
bool _vitaintera, _use_fasi;
|
||||||
|
char _tipostima;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual TRecnotype items() const { return _righe.items(); }
|
virtual TRecnotype items() const { return _righe.items(); }
|
||||||
@ -128,33 +200,69 @@ bool TPrint_bilancio_cms_recordset::move_to(TRecnotype pos)
|
|||||||
void TPrint_bilancio_cms_recordset::requery()
|
void TPrint_bilancio_cms_recordset::requery()
|
||||||
{
|
{
|
||||||
//prende le date di inizio e fine dell'eserizio selezionato sulla maschera
|
//prende le date di inizio e fine dell'eserizio selezionato sulla maschera
|
||||||
TString4 anno;
|
TEsercizi_contabili esc;
|
||||||
anno << _anno;
|
TDate datainiesc, datafinesc;
|
||||||
const TRectype& esc = cache().get("ESC", anno);
|
esc.code2range(_anno, datainiesc, datafinesc);
|
||||||
const TDate datainiesc = esc.get("D0");
|
|
||||||
const TDate datafinesc = esc.get("D1");
|
|
||||||
|
|
||||||
//deve procedere al confronto tra le date inizio-fine esercizio e quelle inizio-fine commessa..
|
//deve procedere al confronto tra le date inizio-fine esercizio e quelle inizio-fine commessa..
|
||||||
//..per spostare il record in esame nell'array corretto
|
//..per spostare il record in esame nell'array corretto
|
||||||
TString_array cms[4];
|
TAssoc_array cms[4];
|
||||||
TISAM_recordset commesse("USE COMMESSE");
|
|
||||||
for (bool ok = commesse.move_first(); ok; ok = commesse.move_next())
|
TString query;
|
||||||
|
query = "USE SALDANA";
|
||||||
|
//stampa standard non a vita intera
|
||||||
|
if (!_vitaintera)
|
||||||
|
query << "\nTO ANNO=" << _anno;
|
||||||
|
|
||||||
|
TISAM_recordset saldana("");
|
||||||
|
for (bool ok = saldana.move_first(); ok; ok = saldana.move_next())
|
||||||
{
|
{
|
||||||
const TDate dataini = commesse.get(COMMESSE_DATAINIZIO).as_date();
|
const TString& conto = saldana.get(SALDANA_CONTO).as_string();
|
||||||
const TDate datafine = commesse.get(COMMESSE_DATAFINE).as_date();
|
//trova l'indicatore di bilancio
|
||||||
//e' inutile considerare le commesse terminate prima dell'esercizio selezionato..
|
const int indbil = _indicatori.get_indbil(conto);
|
||||||
//..cioe' nel passato oppure che iniziano nel futuro!
|
|
||||||
if (datafine >= datainiesc && dataini <= datafinesc)
|
if (indbil == 3 || indbil == 4)
|
||||||
{
|
{
|
||||||
int indice = datafine <= datafinesc ? 0 : 2;
|
const TString& codcms = saldana.get(SALDANA_COMMESSA).as_string();
|
||||||
if (dataini >= datainiesc)
|
const TString& fase = saldana.get(SALDANA_FASE).as_string();
|
||||||
indice++;
|
|
||||||
TToken_string riga_array;
|
const TRectype& rec_commesse = cache().get(LF_COMMESSE, codcms);
|
||||||
riga_array << indice;
|
|
||||||
riga_array.add(commesse.get(COMMESSE_CODCMS).as_string());
|
const TDate dataini = rec_commesse.get(COMMESSE_DATAINIZIO);
|
||||||
riga_array.add(commesse.get(COMMESSE_DESCRIZ).as_string());
|
const TDate datafine = rec_commesse.get(COMMESSE_DATAFINE);
|
||||||
cms[indice].add(riga_array);
|
//e' inutile considerare le commesse terminate prima dell'esercizio selezionato..
|
||||||
}
|
//..cioe' nel passato oppure che iniziano nel futuro!
|
||||||
|
if (datafine >= datainiesc && dataini <= datafinesc)
|
||||||
|
{
|
||||||
|
int indice = datafine <= datafinesc ? 0 : 2;
|
||||||
|
if (dataini >= datainiesc)
|
||||||
|
indice++;
|
||||||
|
|
||||||
|
TString80 chiave = codcms;
|
||||||
|
if (_use_fasi)
|
||||||
|
chiave << '|' << fase;
|
||||||
|
|
||||||
|
//cerca se la commessa (e l'eventuale fase) esistono gia' nell'assocarray delle commesse
|
||||||
|
TAssoc_array* riga_array = (TAssoc_array*)cms[indice].objptr(chiave);
|
||||||
|
//se non esiste la crea!
|
||||||
|
if (riga_array == NULL)
|
||||||
|
{
|
||||||
|
riga_array = new TAssoc_array;
|
||||||
|
cms[indice].add(chiave, riga_array);
|
||||||
|
|
||||||
|
TString4 str_indice; //l'indice va stringato per l'assoc_array
|
||||||
|
str_indice << indice;
|
||||||
|
|
||||||
|
riga_array->add("INDICE", str_indice);
|
||||||
|
riga_array->add("CODCMS", codcms);
|
||||||
|
riga_array->add("FASE", fase);
|
||||||
|
riga_array->add("DESCRIZ", rec_commesse.get(COMMESSE_DESCRIZ));
|
||||||
|
}
|
||||||
|
} //if (datafine >= datainiesc &&...
|
||||||
|
|
||||||
|
|
||||||
|
} //if (indbil == 3 ||...
|
||||||
|
|
||||||
}
|
}
|
||||||
//merging dei 4 arrayini cms nell'arrayone _righe da mandare in stampa
|
//merging dei 4 arrayini cms nell'arrayone _righe da mandare in stampa
|
||||||
_righe.destroy();
|
_righe.destroy();
|
||||||
@ -163,7 +271,7 @@ void TPrint_bilancio_cms_recordset::requery()
|
|||||||
const int tot = cms[i].items();
|
const int tot = cms[i].items();
|
||||||
for (int j = 0; j < tot; j++)
|
for (int j = 0; j < tot; j++)
|
||||||
{
|
{
|
||||||
_righe.TArray::add(cms[i].remove(j));
|
// _righe.TArray::add(cms[i].remove(j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,6 +316,7 @@ const TVariant& TPrint_bilancio_cms_recordset::get(const char* column_name) cons
|
|||||||
void TPrint_bilancio_cms_recordset::set_filter(const TPrint_bilancio_cms_mask& msk)
|
void TPrint_bilancio_cms_recordset::set_filter(const TPrint_bilancio_cms_mask& msk)
|
||||||
{
|
{
|
||||||
_anno = msk.get_int(F_ESERCIZIO);
|
_anno = msk.get_int(F_ESERCIZIO);
|
||||||
|
_tipostima = msk.get_bool(F_TIPOSTIMA);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
|
@ -8,7 +8,9 @@
|
|||||||
#define F_REPORT 105
|
#define F_REPORT 105
|
||||||
#define F_INIZIO_ES 106
|
#define F_INIZIO_ES 106
|
||||||
#define F_FINE_ES 107
|
#define F_FINE_ES 107
|
||||||
#define F_TIPOSTAMPA 108
|
#define F_TIPOSTIMA 108
|
||||||
|
#define F_VITAINTERA 109
|
||||||
|
#define F_FASI 110
|
||||||
|
|
||||||
#endif // __CA3800_H
|
#endif // __CA3800_H
|
||||||
|
|
||||||
|
@ -72,12 +72,22 @@ BEGIN
|
|||||||
FLAGS "A"
|
FLAGS "A"
|
||||||
END
|
END
|
||||||
|
|
||||||
RADIOBUTTON F_TIPOSTAMPA 22
|
BOOLEAN F_FASI
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 7 "Tipo di stima"
|
PROMPT 2 7 "Esplodi Fasi"
|
||||||
|
END
|
||||||
|
|
||||||
|
RADIOBUTTON F_TIPOSTIMA 22
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 9 "Tipo di stima"
|
||||||
FLAGS "Z"
|
FLAGS "Z"
|
||||||
ITEM "X|Tempo"
|
ITEM "T|Tempo"
|
||||||
ITEM " |Costi"
|
ITEM "C|Costi"
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_VITAINTERA
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 11 "Includi esercizi successivi (vita intera)"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_REPORT 256 64
|
STRING F_REPORT 256 64
|
||||||
|
@ -132,5 +132,5 @@
|
|||||||
</field>
|
</field>
|
||||||
<field y="1" type="Numero" hidden="1" align="right" width="1" id="101" pattern="1" />
|
<field y="1" type="Numero" hidden="1" align="right" width="1" id="101" pattern="1" />
|
||||||
</section>
|
</section>
|
||||||
<sql>USE COMMESSE</sql>
|
<sql>USE SALDANA</sql>
|
||||||
</report>
|
</report>
|
Loading…
x
Reference in New Issue
Block a user