Patch level :2.2 nopatch
Files correlati : Ricompilazione Demo : [ ] Commento :un sacco di modifiche su ribaltamenti, tabelle ripartizioni, conversione ecc. git-svn-id: svn://10.65.10.50/trunk@12733 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4da0917806
commit
f99184fbe6
@ -13,7 +13,7 @@ int main(int argc, char** argv)
|
|||||||
case 4: ca0500(argc,argv); break; //gestione centri di costo
|
case 4: ca0500(argc,argv); break; //gestione centri di costo
|
||||||
case 5: ca0600(argc,argv); break; //gestione commesse
|
case 5: ca0600(argc,argv); break; //gestione commesse
|
||||||
case 6: ca0700(argc,argv); break; //gestione fasi
|
case 6: ca0700(argc,argv); break; //gestione fasi
|
||||||
case 7: ca0800(argc,argv); break; // ribaltamenti
|
case 7: ca0800(argc,argv); break; // tabelle ripartizioni
|
||||||
default: ca0100(argc,argv); break; // gestione tabelle
|
default: ca0100(argc,argv); break; // gestione tabelle
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -122,7 +122,7 @@ TMask * Tab_app_ca::set_mask(TMask * _m)
|
|||||||
if (tabname == "CDC")
|
if (tabname == "CDC")
|
||||||
m = new TMask_tabanal("CDC", "CdC", "CdCDes"); else
|
m = new TMask_tabanal("CDC", "CdC", "CdCDes"); else
|
||||||
if (tabname == "CMS")
|
if (tabname == "CMS")
|
||||||
m = new TMask_tabanal("CDC", "Cms", "CmsDes"); else
|
m = new TMask_tabanal("CMS", "Cms", "CmsDes"); else
|
||||||
if (tabname == "FSC")
|
if (tabname == "FSC")
|
||||||
m = new TMask_tabanal("FSC", "Fsc", "FscDes");
|
m = new TMask_tabanal("FSC", "Fsc", "FscDes");
|
||||||
else
|
else
|
||||||
|
@ -143,7 +143,7 @@ class TRiparti_app : public TRelation_application
|
|||||||
TRelation* _rel;
|
TRelation* _rel;
|
||||||
TRiparti_msk* _msk;
|
TRiparti_msk* _msk;
|
||||||
|
|
||||||
const TString& somma_campi(TToken_string& row, int first) const;
|
const TString& somma_campi(TToken_string& row, int first, bool pdc = false) const;
|
||||||
void write_rows();
|
void write_rows();
|
||||||
|
|
||||||
void spezza_campo(const TString& str, TToken_string& row, int first) const;
|
void spezza_campo(const TString& str, TToken_string& row, int first) const;
|
||||||
@ -160,7 +160,7 @@ protected:
|
|||||||
virtual TMask* get_mask(int) { return _msk; }
|
virtual TMask* get_mask(int) { return _msk; }
|
||||||
};
|
};
|
||||||
|
|
||||||
const TString& TRiparti_app::somma_campi(TToken_string& row, int first) const
|
const TString& TRiparti_app::somma_campi(TToken_string& row, int first, bool pdc) const
|
||||||
{
|
{
|
||||||
TSheet_field& sheet = _msk->sfield(F_SHEET);
|
TSheet_field& sheet = _msk->sfield(F_SHEET);
|
||||||
TMask& m = sheet.sheet_mask();
|
TMask& m = sheet.sheet_mask();
|
||||||
@ -174,6 +174,9 @@ const TString& TRiparti_app::somma_campi(TToken_string& row, int first) const
|
|||||||
if (m.id2pos(id+i) < 0)
|
if (m.id2pos(id+i) < 0)
|
||||||
break;
|
break;
|
||||||
const TEdit_field& fld = m.efield(id+i);
|
const TEdit_field& fld = m.efield(id+i);
|
||||||
|
if (pdc)
|
||||||
|
token.right_just(fld.size(), '0');
|
||||||
|
else
|
||||||
token.left_just(fld.size());
|
token.left_just(fld.size());
|
||||||
str << token;
|
str << token;
|
||||||
}
|
}
|
||||||
@ -211,6 +214,9 @@ void TRiparti_app::write_rows()
|
|||||||
TRecord_array a(LF_RRIP, "NRIGA");
|
TRecord_array a(LF_RRIP, "NRIGA");
|
||||||
a.set_key(key);
|
a.set_key(key);
|
||||||
|
|
||||||
|
TConfig ini(CONFIG_DITTA, "ca");
|
||||||
|
const bool use_pdc = ini.get_bool("UsePdcc");
|
||||||
|
|
||||||
TSheet_field& sheet = _msk->sfield(F_SHEET);
|
TSheet_field& sheet = _msk->sfield(F_SHEET);
|
||||||
FOR_EACH_SHEET_ROW(sheet, i, row)
|
FOR_EACH_SHEET_ROW(sheet, i, row)
|
||||||
{
|
{
|
||||||
@ -219,7 +225,7 @@ void TRiparti_app::write_rows()
|
|||||||
rec.put("CODCOSTO", somma_campi(*row, 1));
|
rec.put("CODCOSTO", somma_campi(*row, 1));
|
||||||
rec.put("CODCMS", somma_campi(*row, 5));
|
rec.put("CODCMS", somma_campi(*row, 5));
|
||||||
rec.put("CODFASE", somma_campi(*row, 9));
|
rec.put("CODFASE", somma_campi(*row, 9));
|
||||||
rec.put("CODCONTO", somma_campi(*row,13));
|
rec.put("CODCONTO", somma_campi(*row,13,use_pdc));
|
||||||
}
|
}
|
||||||
a.rewrite();
|
a.rewrite();
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ BEGIN
|
|||||||
COPY USE F_CODICE_I
|
COPY USE F_CODICE_I
|
||||||
INPUT TIPO "B"
|
INPUT TIPO "B"
|
||||||
INPUT CODICE F_CODICE_B
|
INPUT CODICE F_CODICE_B
|
||||||
DISPLAY "Codice " CODICE
|
DISPLAY "Codice@8 " CODICE
|
||||||
DISPLAY "Costo@20" CODCOSTO
|
DISPLAY "Costo@20" CODCOSTO
|
||||||
DISPLAY "Commessa@20" CODCMS
|
DISPLAY "Commessa@20" CODCMS
|
||||||
DISPLAY "Descrizione@50" DESCRIZ
|
DISPLAY "Descrizione@50" DESCRIZ
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
class TMovanal_msk : public TAutomask
|
class TMovanal_msk : public TAutomask
|
||||||
{
|
{
|
||||||
TAssoc_array _saldi;
|
TAssoc_array _saldi;
|
||||||
|
bool _use_pdc;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool on_field_event(TOperable_field& o, TField_event fe, long jolly);
|
virtual bool on_field_event(TOperable_field& o, TField_event fe, long jolly);
|
||||||
@ -30,7 +31,7 @@ protected:
|
|||||||
|
|
||||||
const TToken_string& rec2key(const TRectype& rec) const;
|
const TToken_string& rec2key(const TRectype& rec) const;
|
||||||
void aggiorna_saldo_riga(int r);
|
void aggiorna_saldo_riga(int r);
|
||||||
const TString& somma_campi(TToken_string& row, int first) const;
|
const TString& somma_campi(TToken_string& row, int first, bool pdc = false) const;
|
||||||
|
|
||||||
// Lettura movimento contabile
|
// Lettura movimento contabile
|
||||||
TToken_string& get_rip_row(const TRectype& rrip);
|
TToken_string& get_rip_row(const TRectype& rrip);
|
||||||
@ -135,7 +136,7 @@ TToken_string& TMovanal_msk::get_rip_row(const TRectype& rrip)
|
|||||||
keyrow = somma_campi(*row, pos_cdc);
|
keyrow = somma_campi(*row, pos_cdc);
|
||||||
keyrow.add(somma_campi(*row, pos_cms));
|
keyrow.add(somma_campi(*row, pos_cms));
|
||||||
keyrow.add(somma_campi(*row, pos_fas));
|
keyrow.add(somma_campi(*row, pos_fas));
|
||||||
keyrow.add(somma_campi(*row, pos_con));
|
keyrow.add(somma_campi(*row, pos_con, _use_pdc));
|
||||||
if (keyrow == keyrip)
|
if (keyrow == keyrip)
|
||||||
return *row;
|
return *row;
|
||||||
}
|
}
|
||||||
@ -357,7 +358,7 @@ bool TMovanal_msk::on_field_event(TOperable_field& o, TField_event e, long jolly
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TString& TMovanal_msk::somma_campi(TToken_string& row, int first) const
|
const TString& TMovanal_msk::somma_campi(TToken_string& row, int first, bool pdc) const
|
||||||
{
|
{
|
||||||
TSheet_field& sheet = sfield(F_RIGHE);
|
TSheet_field& sheet = sfield(F_RIGHE);
|
||||||
TMask& m = sheet.sheet_mask();
|
TMask& m = sheet.sheet_mask();
|
||||||
@ -371,6 +372,9 @@ const TString& TMovanal_msk::somma_campi(TToken_string& row, int first) const
|
|||||||
break;
|
break;
|
||||||
const TEdit_field& fld = m.efield(id+i);
|
const TEdit_field& fld = m.efield(id+i);
|
||||||
token = row.get(first+i);
|
token = row.get(first+i);
|
||||||
|
if (pdc)
|
||||||
|
token.right_just(fld.size(), '0');
|
||||||
|
else
|
||||||
token.left_just(fld.size());
|
token.left_just(fld.size());
|
||||||
str << token;
|
str << token;
|
||||||
}
|
}
|
||||||
@ -423,7 +427,7 @@ bool TMovanal_msk::row2rec(int r, TRectype& rec) const
|
|||||||
rec.put(RMOVANA_CODCCOSTO, somma_campi(row, sheet.cid2index(S_CDC1)));
|
rec.put(RMOVANA_CODCCOSTO, somma_campi(row, sheet.cid2index(S_CDC1)));
|
||||||
rec.put(RMOVANA_CODCMS, somma_campi(row, sheet.cid2index(S_CMS1)));
|
rec.put(RMOVANA_CODCMS, somma_campi(row, sheet.cid2index(S_CMS1)));
|
||||||
rec.put(RMOVANA_CODFASE, somma_campi(row, sheet.cid2index(S_FAS1)));
|
rec.put(RMOVANA_CODFASE, somma_campi(row, sheet.cid2index(S_FAS1)));
|
||||||
rec.put(RMOVANA_CODCONTO, somma_campi(row, sheet.cid2index(S_CON1)));
|
rec.put(RMOVANA_CODCONTO, somma_campi(row, sheet.cid2index(S_CON1), _use_pdc));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -532,7 +536,7 @@ TMovanal_msk::TMovanal_msk() : TAutomask("ca2100a")
|
|||||||
sm.hide(-1); // Nasconde tutti campi fittizi
|
sm.hide(-1); // Nasconde tutti campi fittizi
|
||||||
|
|
||||||
TConfig ini(CONFIG_DITTA, "ca");
|
TConfig ini(CONFIG_DITTA, "ca");
|
||||||
const bool use_pdc = ini.get_bool("UsePdcc");
|
_use_pdc = ini.get_bool("UsePdcc");
|
||||||
|
|
||||||
const short id_cdc = 201+sf.cid2index(S_CDC1);
|
const short id_cdc = 201+sf.cid2index(S_CDC1);
|
||||||
const short id_cms = 201+sf.cid2index(S_CMS1);
|
const short id_cms = 201+sf.cid2index(S_CMS1);
|
||||||
@ -542,7 +546,7 @@ TMovanal_msk::TMovanal_msk() : TAutomask("ca2100a")
|
|||||||
ca_create_fields(sm, LF_CDC, 1, 2, id_cdc, id_cdc+50);
|
ca_create_fields(sm, LF_CDC, 1, 2, id_cdc, id_cdc+50);
|
||||||
ca_create_fields(sm, LF_COMMESSE, 1, 6, id_cms, id_cms+50);
|
ca_create_fields(sm, LF_COMMESSE, 1, 6, id_cms, id_cms+50);
|
||||||
ca_create_fields(sm, LF_FASI, 1, 10, id_fas, id_fas+50);
|
ca_create_fields(sm, LF_FASI, 1, 10, id_fas, id_fas+50);
|
||||||
ca_create_fields(sm, use_pdc ? LF_PCON : LF_PCONANA, 1, 14, id_con, id_con+50);
|
ca_create_fields(sm, _use_pdc ? LF_PCON : LF_PCONANA, 1, 14, id_con, id_con+50);
|
||||||
|
|
||||||
for (short id = id_con+3; id >= id_cdc; id--)
|
for (short id = id_con+3; id >= id_cdc; id--)
|
||||||
{
|
{
|
||||||
|
@ -62,29 +62,32 @@ TRipartizione::TRipartizione(TString16 codice) : TMultiple_rectype(LF_RIP)
|
|||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
class TCache_ripartizioni : public TCache
|
class TCache_ripartizioni : public TCache
|
||||||
{
|
{
|
||||||
TLocalisamfile _rip; //testate delle ripartizioni
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual TObject* key2obj(const char* key);
|
virtual TObject* key2obj(const char* key);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TRecord_array& righe(const char* costo);
|
const TRecord_array& righe(const char* costo);
|
||||||
TCache_ripartizioni() : _rip(LF_RIP) {_rip.setkey(4);}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TObject* TCache_ripartizioni::key2obj(const char* key)
|
TObject* TCache_ripartizioni::key2obj(const char* key)
|
||||||
{
|
{
|
||||||
|
TLocalisamfile rip(LF_RIP);
|
||||||
|
rip.setkey(4);
|
||||||
|
rip.put(RIP_TIPO, "B");
|
||||||
|
rip.put(RIP_CODCOSTO, key); //chiave 4 del file testate delle ripartizioni
|
||||||
|
|
||||||
|
TString16 chiave;
|
||||||
|
if (rip.read() == NOERR)
|
||||||
|
chiave << "B|" << rip.get(RIP_CODICE);
|
||||||
|
|
||||||
TRecord_array* rows = new TRecord_array(LF_RRIP, RRIP_NRIGA);
|
TRecord_array* rows = new TRecord_array(chiave, LF_RRIP);
|
||||||
TRectype* chiave = new TRectype(LF_RRIP);
|
|
||||||
// chiave.put(RRIP_TIPO, "B");
|
return (TObject*)rows;
|
||||||
// chiave.put(RRIP_CODICE, codice);
|
|
||||||
return (TObject*);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TRecord_array& TCache_ripartizioni::righe(const char* costo)
|
const TRecord_array& TCache_ripartizioni::righe(const char* costo)
|
||||||
{
|
{
|
||||||
|
return *(const TRecord_array*)objptr(costo);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
@ -93,6 +96,7 @@ TRecord_array& TCache_ripartizioni::righe(const char* costo)
|
|||||||
class TRib_movanal_app : public TSkeleton_application
|
class TRib_movanal_app : public TSkeleton_application
|
||||||
{
|
{
|
||||||
TRib_movanal_msk * _mask;
|
TRib_movanal_msk * _mask;
|
||||||
|
TCache_ripartizioni _cache_rip;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool create();
|
virtual bool create();
|
||||||
@ -117,6 +121,14 @@ bool TRib_movanal_app::destroy()
|
|||||||
return TSkeleton_application::destroy();
|
return TSkeleton_application::destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void copia_campo(const TRectype& src, const char* campo_src,
|
||||||
|
TRectype& dst, const char* campo_dst)
|
||||||
|
{
|
||||||
|
const TString& valore = src.get(campo_src);
|
||||||
|
if (!valore.blank())
|
||||||
|
dst.put(campo_dst, valore);
|
||||||
|
}
|
||||||
|
|
||||||
bool TRib_movanal_app::cappotta_movimento(const TRelation& rel, void* pJolly)
|
bool TRib_movanal_app::cappotta_movimento(const TRelation& rel, void* pJolly)
|
||||||
{
|
{
|
||||||
TRib_movanal_app* app = (TRib_movanal_app*)pJolly;
|
TRib_movanal_app* app = (TRib_movanal_app*)pJolly;
|
||||||
@ -124,20 +136,56 @@ bool TRib_movanal_app::cappotta_movimento(const TRelation& rel, void* pJolly)
|
|||||||
TAnal_mov& anal_mov = (TAnal_mov&)rel.curr(); //movimento analitica
|
TAnal_mov& anal_mov = (TAnal_mov&)rel.curr(); //movimento analitica
|
||||||
TRecord_array& input_rows = anal_mov.body(); //record_array con le righe del mov_anal (INPUT)
|
TRecord_array& input_rows = anal_mov.body(); //record_array con le righe del mov_anal (INPUT)
|
||||||
|
|
||||||
//controllare
|
|
||||||
|
|
||||||
TRecord_array output_rows = input_rows; //crea il record_array di output come copia dell'INPUT..
|
TRecord_array output_rows = input_rows; //crea il record_array di output come copia dell'INPUT..
|
||||||
output_rows.destroy_rows(); //..e poi lo pulisce
|
output_rows.destroy_rows(); //..e poi lo pulisce
|
||||||
|
|
||||||
TToken_string key; //tokenstring in cui parcheggiare la chiave del record
|
bool ho_cambiato_qualchecosa = false;
|
||||||
for (int i = 1; i <= input_rows.rows(); i++)
|
|
||||||
{
|
|
||||||
const TRectype& rec = input_rows.row(i);
|
|
||||||
key = "B";
|
|
||||||
key.add(rec.get(RMOVANA_CODCCOSTO));
|
|
||||||
|
|
||||||
|
//Esploditore
|
||||||
|
for (int r = 1; r <= input_rows.rows(); r++)
|
||||||
|
{
|
||||||
|
const TRectype& rec = input_rows.row(r);
|
||||||
|
const TRecord_array& rrip = app->_cache_rip.righe(rec.get(RMOVANA_CODCCOSTO));
|
||||||
|
|
||||||
|
if (rrip.rows() > 0) //ci sono righe di ripartizione
|
||||||
|
{
|
||||||
|
// Importo totale da distribuire arrotondato ai decimali della valuta di conto
|
||||||
|
TGeneric_distrib distrib(rec.get_real(RMOVANA_IMPORTO), TCurrency::get_firm_dec());
|
||||||
|
|
||||||
|
// Calcolo tutte le percentuali da ripartire
|
||||||
|
int i;
|
||||||
|
for (i = 1; i <= rrip.rows(); i++)
|
||||||
|
distrib.add(rrip[i].get_real("RIPARTO"));
|
||||||
|
|
||||||
|
for (i = 1; i <= rrip.rows(); i++)
|
||||||
|
{
|
||||||
|
TRectype* newrec = new TRectype(rec);
|
||||||
|
const real imp = distrib.get(); // Legge la quota da distribuire
|
||||||
|
newrec->put("IMPORTO", imp); //e la mette nella nuova riga
|
||||||
|
//poi copia i valori dei campi cdc,cms,fsc,con in quelli di tipo ori (nello stesso record)
|
||||||
|
copia_campo(rec, RMOVANA_CODCCOSTO, *newrec, RMOVANA_CODCCORI);
|
||||||
|
copia_campo(rec, RMOVANA_CODCMS, *newrec, RMOVANA_CODCMSORI);
|
||||||
|
copia_campo(rec, RMOVANA_CODFASE, *newrec, RMOVANA_CODFASEORI);
|
||||||
|
copia_campo(rec, RMOVANA_CODCONTO, *newrec, RMOVANA_CODCONTORI);
|
||||||
|
//e mette nei campi std i valori che trova nelle righe ripartizione
|
||||||
|
copia_campo(rrip[i], RRIP_CODCOSTO, *newrec, RMOVANA_CODCCOSTO);
|
||||||
|
copia_campo(rrip[i], RRIP_CODCMS, *newrec, RMOVANA_CODCMS);
|
||||||
|
copia_campo(rrip[i], RRIP_CODFASE, *newrec, RMOVANA_CODFASE);
|
||||||
|
copia_campo(rrip[i], RRIP_CODCONTO, *newrec, RMOVANA_CODCONTO);
|
||||||
|
|
||||||
|
output_rows.add_row(newrec);
|
||||||
|
ho_cambiato_qualchecosa = true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else //nessuna riga di ripartizione->aggiungo la riga input all'output
|
||||||
|
{
|
||||||
|
output_rows.add_row(rec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ho_cambiato_qualchecosa)
|
||||||
|
output_rows.rewrite();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,6 +206,7 @@ void TRib_movanal_app::main_loop()
|
|||||||
//usa la scan dei TCursor,quindi niente progind e for,x' gia' nel metodo
|
//usa la scan dei TCursor,quindi niente progind e for,x' gia' nel metodo
|
||||||
if (items > 0)
|
if (items > 0)
|
||||||
{
|
{
|
||||||
|
rel_movana.lfile().set_curr(new TAnal_mov); //il record principale della rel e' un TMov_anal!!
|
||||||
cur_movana.scan(cappotta_movimento, this, "Ribaltamento movimenti...");
|
cur_movana.scan(cappotta_movimento, this, "Ribaltamento movimenti...");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
68
ca/cacnv.cpp
68
ca/cacnv.cpp
@ -1,4 +1,5 @@
|
|||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
|
#include <confapp.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <relation.h>
|
#include <relation.h>
|
||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
@ -12,6 +13,9 @@
|
|||||||
#include "../cg/cg2101.h"
|
#include "../cg/cg2101.h"
|
||||||
#include "calib01.h"
|
#include "calib01.h"
|
||||||
|
|
||||||
|
#include "cdc.h"
|
||||||
|
//#include "cms.h"
|
||||||
|
|
||||||
#include "movana.h"
|
#include "movana.h"
|
||||||
#include "rmovana.h"
|
#include "rmovana.h"
|
||||||
|
|
||||||
@ -175,16 +179,78 @@ bool TConversione_cm2ca::convert_phases()
|
|||||||
curfsc.freeze();
|
curfsc.freeze();
|
||||||
TRectype& fasi_rec = fasi.curr();
|
TRectype& fasi_rec = fasi.curr();
|
||||||
TProgind pi(nrectab, "Conversione tabella fasi");
|
TProgind pi(nrectab, "Conversione tabella fasi");
|
||||||
|
|
||||||
|
TRelation* relazione = NULL;
|
||||||
|
TCursor* cursore = NULL;
|
||||||
|
|
||||||
|
//se sono gia' state configurate le fasi nel ditta.ini...
|
||||||
|
/* TConfig config(CONFIG_DITTA, "ca");
|
||||||
|
const TString& fathfasi = config.get( "FathFasi", "ca");
|
||||||
|
|
||||||
|
if (fathfasi == "CDC")
|
||||||
|
{
|
||||||
|
TLocalisamfile cdc(LF_CDC); //devono gia' essere stati creati i files dell'analitica
|
||||||
|
if (cdc.first() == NOERR) //se il file del piano dei conti ha almeno un record...
|
||||||
|
{
|
||||||
|
relazione = new TRelation(LF_CDC);
|
||||||
|
cursore = new TCursor(relazione);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (fathfasi == "CMS")
|
||||||
|
{
|
||||||
|
TLocalisamfile cms(LF_COMMESSE); //devono gia' essere stati creati i files dell'analitica
|
||||||
|
if (cms.first() == NOERR) //se il file del piano dei conti ha almeno un record...
|
||||||
|
{
|
||||||
|
relazione = new TRelation(LF_COMMESSE);
|
||||||
|
cursore = new TCursor(relazione);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TRecnotype items = 0;
|
||||||
|
if (cursore !=NULL)
|
||||||
|
{
|
||||||
|
items = cursore->items();
|
||||||
|
cursore->freeze();
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
for (curfsc = 0; curfsc.pos() < nrectab; ++curfsc)
|
for (curfsc = 0; curfsc.pos() < nrectab; ++curfsc)
|
||||||
{
|
{
|
||||||
pi.addstatus(1);
|
pi.addstatus(1);
|
||||||
|
if (cursore == NULL)
|
||||||
|
{
|
||||||
fasi_rec.zero();
|
fasi_rec.zero();
|
||||||
fasi_rec.put("CODFASE", fsc.get("CODTAB"));
|
fasi_rec.put("CODFASE", fsc.get("CODTAB"));
|
||||||
fasi_rec.put("DESCRIZ", fsc.get("S0"));
|
fasi_rec.put("DESCRIZ", fsc.get("S0"));
|
||||||
fasi.write();
|
fasi.write();
|
||||||
}
|
}
|
||||||
return true;
|
/* else
|
||||||
|
{
|
||||||
|
TString80 codice;
|
||||||
|
const TRectype& rec = cursore->curr();
|
||||||
|
for (*cursore = 0; cursore->pos() < items; ++*cursore)
|
||||||
|
{
|
||||||
|
switch (rec.num())
|
||||||
|
{
|
||||||
|
case LF_CDC:
|
||||||
|
codice = rec.get(CDC_CODCOSTO);
|
||||||
|
break;
|
||||||
|
case LF_CMS:
|
||||||
|
codice = rec.get("CODCMS");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fasi_rec.zero();
|
||||||
|
fasi_rec.put("CODCMSFAS", codice);
|
||||||
|
fasi_rec.put("CODFASE", fsc.get("CODTAB"));
|
||||||
|
fasi_rec.put("DESCRIZ", fsc.get("S0"));
|
||||||
|
fasi.write();
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------
|
||||||
|
@ -57,7 +57,9 @@ const char* TMultilevel_code_info::get_key_fieldname(int k) const
|
|||||||
const RecDes& rd = prefix().get_recdes(_logicnum);
|
const RecDes& rd = prefix().get_recdes(_logicnum);
|
||||||
CHECKD(k > 0 && k <= rd.NKeys, "Invalid key ", k);
|
CHECKD(k > 0 && k <= rd.NKeys, "Invalid key ", k);
|
||||||
const KeyDes& ky = rd.Ky[k-1];
|
const KeyDes& ky = rd.Ky[k-1];
|
||||||
const int idx = (_logicnum == LF_TAB || _logicnum == LF_TABCOM) ? 1 : 0;
|
int idx = 0;
|
||||||
|
if (k == 1 && (_logicnum == LF_TAB || _logicnum == LF_TABCOM || _logicnum == LF_FASI))
|
||||||
|
idx = 1;
|
||||||
const int pos = ky.FieldSeq[idx] % MaxFields;
|
const int pos = ky.FieldSeq[idx] % MaxFields;
|
||||||
return rd.Fd[pos].Name;
|
return rd.Fd[pos].Name;
|
||||||
}
|
}
|
||||||
@ -440,17 +442,6 @@ const TToken_string& TSimple_anal_msk::get_key_value(int c) const
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* TSimple_anal_msk::get_key_fieldname(int k) const
|
|
||||||
{
|
|
||||||
const int logic = get_logicnum();
|
|
||||||
const RecDes& rd = prefix().get_recdes(logic);
|
|
||||||
CHECKD(k > 0 && k <= rd.NKeys, "Invalid key ", k);
|
|
||||||
const KeyDes& ky = rd.Ky[k-1];
|
|
||||||
const int idx = (logic == LF_TAB || logic == LF_TABCOM) ? 1 : 0;
|
|
||||||
const int pos = ky.FieldSeq[idx] % MaxFields;
|
|
||||||
return rd.Fd[pos].Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TSimple_anal_msk::append_select_clause(ostream& out, int level) const
|
void TSimple_anal_msk::append_select_clause(ostream& out, int level) const
|
||||||
{
|
{
|
||||||
const TFieldref& key = fieldref(level, 1);
|
const TFieldref& key = fieldref(level, 1);
|
||||||
@ -1167,7 +1158,7 @@ void ca_create_browse1(TEdit_field& kfld, int level, int logic, short key_id, sh
|
|||||||
out << "DI \"" << TR("Descrizione") << "@50\" " << field << endl;
|
out << "DI \"" << TR("Descrizione") << "@50\" " << field << endl;
|
||||||
out << "OU " << (des_id+level) << ' ' << field << endl;
|
out << "OU " << (des_id+level) << ' ' << field << endl;
|
||||||
out << "CH RE" << endl;
|
out << "CH RE" << endl;
|
||||||
//out << "FI " << mci.fieldref(level) << endl;
|
out << "FI " << mci.fieldref(level) << endl;
|
||||||
out << "EN" << endl;
|
out << "EN" << endl;
|
||||||
out.close();
|
out.close();
|
||||||
|
|
||||||
|
@ -54,8 +54,6 @@ protected:
|
|||||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||||
virtual void read(const char* msk);
|
virtual void read(const char* msk);
|
||||||
|
|
||||||
const char* get_key_fieldname(int k) const;
|
|
||||||
|
|
||||||
void append_select_clause(ostream& out, int level) const;
|
void append_select_clause(ostream& out, int level) const;
|
||||||
void create_key_browse(TEdit_field& kfld, int level);
|
void create_key_browse(TEdit_field& kfld, int level);
|
||||||
void create_des_browse(TEdit_field& kfld, int level);
|
void create_des_browse(TEdit_field& kfld, int level);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user