Patch level : 10.0 patch 776

Files correlati     :  ca0.exe ca2.exe
Ricompilazione Demo : [ ]
Commento            :

Bug 0001669: Aggiungere un conto di contabilità di default alle commesse

Aggiungere un conto di contabilità di default alle commesse


git-svn-id: svn://10.65.10.50/trunk@20665 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2010-07-15 06:42:48 +00:00
parent 4ba2e58879
commit f362b8f434
20 changed files with 205 additions and 14 deletions

View File

@ -16,9 +16,35 @@ protected:
virtual int get_logicnum() const { return LF_CDC; }
public:
TCdC_anal_msk() { read("ca0500a"); }
TCdC_anal_msk();
};
TCdC_anal_msk::TCdC_anal_msk()
{
read("ca0500a");
const bool use_pdcc = ca_config().get_bool("UsePdcc");
const int nfields = ca_create_fields(*this, 1, use_pdcc ? LF_PCON : LF_PCONANA, 2, 2, F_CDCPDA1, F_CDCDES1, 0x0, CDC_CODCONTO);
int from = 1;
for (int i = 0; i < nfields; i++)
{
TEdit_field & e = efield(F_CDCPDA1 + i);
e.check_type(CHECK_NORMAL);
TFieldref * fr = (TFieldref *) e.field();
if (fr != NULL)
{
fr->set_from(from);
if (i < 2)
from += 3;
else
from += 6;
fr->set_to(from - 1);
}
}
}
////////////////////////////////////////////////////////////////////////
//APPLICAZIONE
////////////////////////////////////////////////////////////////////////

View File

@ -9,3 +9,9 @@
#define H_CDC_MAG 207
#define F_CDC_DEP 208
#define F_CDC_DESCDEP 209
#define F_CDCPDA1 601
#define F_CDCPDA4 605
#define F_CDCDES1 701
#define F_CDCDES4 705

View File

@ -94,4 +94,13 @@ END
ENDPAGE
PAGE "Pagina 2" 0 0 0 2
GROUPBOX DLG_NULL 78 6
BEGIN
PROMPT 1 0 "@bConto analitico"
END
ENDPAGE
ENDMASK

View File

@ -23,6 +23,27 @@ TCms_anal_msk::TCms_anal_msk()
{
read("ca0600a");
ca_create_fields(*this, 2, LF_CDC, 1, 1, F_CMS_CDC1, F_CMS_CDCDES1, 0x0, COMMESSE_CODCOSTO);
const bool use_pdcc = ca_config().get_bool("UsePdcc");
const int nfields = ca_create_fields(*this, 3, use_pdcc ? LF_PCON : LF_PCONANA, 2, 2, F_CMSPDA1, F_CMSDES1, 0x0, COMMESSE_CODCONTO);
int from = 1;
for (int i = 0; i < nfields; i++)
{
TEdit_field & e = efield(F_CMSPDA1 + i);
e.check_type(CHECK_NORMAL);
TFieldref * fr = (TFieldref *) e.field();
if (fr != NULL)
{
fr->set_from(from);
if (i < 2)
from += 3;
else
from += 6;
fr->set_to(from - 1);
}
}
}
////////////////////////////////////////////////////////////////////////

View File

@ -73,3 +73,9 @@
#define F_CMS_CDCDES2 406
#define F_CMS_CDCDES3 407
#define F_CMS_CDCDES4 408
#define F_CMSPDA1 601
#define F_CMSPDA4 605
#define F_CMSDES1 701
#define F_CMSDES4 705

View File

@ -587,4 +587,13 @@ END
ENDPAGE
PAGE "Pagina 4" 0 0 0 2
GROUPBOX DLG_NULL 78 6
BEGIN
PROMPT 1 0 "@bConto analitico"
END
ENDPAGE
ENDMASK

View File

@ -19,7 +19,7 @@ protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
TFsc_anal_msk() { read("ca0700a"); }
TFsc_anal_msk();
};
bool TFsc_anal_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
@ -33,6 +33,32 @@ bool TFsc_anal_msk::on_field_event(TOperable_field& o, TField_event e, long joll
return TSimple_anal_msk::on_field_event(o, e, jolly);
}
TFsc_anal_msk::TFsc_anal_msk()
{
read("ca0700a");
const bool use_pdcc = ca_config().get_bool("UsePdcc");
const int nfields = ca_create_fields(*this, 0, use_pdcc ? LF_PCON : LF_PCONANA, 2 + compute_offset(), 8, F_FSCPDA1, F_FSCDES1, 0x0, FASI_CODCONTO);
int from = 1;
for (int i = 0; i < nfields; i++)
{
TEdit_field & e = efield(F_FSCPDA1 + i);
e.check_type(CHECK_NORMAL);
TFieldref * fr = (TFieldref *) e.field();
if (fr != NULL)
{
fr->set_from(from);
if (i < 2)
from += 3;
else
from += 6;
fr->set_to(from - 1);
}
}
}
////////////////////////////////////////////////////////////////////////
//APPLICAZIONE
////////////////////////////////////////////////////////////////////////

View File

@ -1,3 +1,8 @@
//id maschera ca0700a(file fasi)
//campi normali
#define F_FSCPDA1 601
#define F_FSCPDA4 605
#define F_FSCDES1 701
#define F_FSCDES4 705

View File

@ -6,11 +6,11 @@ TOOLBAR "topbar" 0 0 0 2
ENDPAGE
PAGE "Fasi" 0 0 0 2
PAGE "FASI" 0 0 0 2
GROUPBOX DLG_NULL 77 7
GROUPBOX DLG_NULL 78 6
BEGIN
PROMPT 1 0 "@bCodici"
PROMPT 1 7 "@bConto analitico"
END
ENDPAGE

View File

@ -14,7 +14,9 @@
#include "rmovana.h"
#include "rrip.h"
#include "saldana.h"
#include "cdc.h"
#include "commesse.h"
#include "fasi.h"
class TMovanal_msk : public TAutomask
@ -25,6 +27,9 @@ class TMovanal_msk : public TAutomask
short _cms_end;
short _cdc_start;
short _cdc_end;
short _pcon_start;
short _pcon_end;
TCache_ripartizioni _cache_rip;
@ -34,6 +39,7 @@ protected:
virtual bool on_key(KEY key);
const TToken_string& rec2key(const TRectype& rec) const;
void completa_conto(int r);
void aggiorna_saldo_riga(int r);
// Lettura movimento contabile
@ -514,6 +520,32 @@ bool TMovanal_msk::on_field_event(TOperable_field& o, TField_event e, long jolly
aggiorna_saldo_riga(r);
}
if (e == se_notify_modify)
{
TSheet_field & s = sfield(F_RIGHE);
TMask & m = s.sheet_mask();
const int r = int(jolly);
completa_conto(r);
s.update_mask(r);
const bool pdc_req = ca_config().get_bool("PdciRequired");
if (pdc_req)
{
for (short id = _pcon_start; id < _pcon_end; id++)
{
TEdit_field & e = m.efield(id);
e.check_type(CHECK_REQUIRED);
e.set_dirty();
const bool ok = e.check();
e.check_type(CHECK_NORMAL);
if (!ok)
return error_box("Manca il conto analitico");
}
}
}
if (e == se_query_modify)
{
TSheet_field & s = sfield(F_RIGHE);
@ -807,6 +839,47 @@ TImporto& TMovanal_msk::saldo(const TRectype& rec)
return *imp;
}
void TMovanal_msk::completa_conto(int r)
{
TRectype rec(LF_RMOVANA);
row2rec(r, rec);
TString conto = rec.get(RMOVANA_CODCONTO);
if (conto.blank())
{
TToken_string key;
const TString4 livsup = ca_config().get("FathFasi");
if (livsup.blank())
key.add("");
else
if (livsup == "CDC")
key.add(rec.get(RMOVANA_CODCCOSTO));
else
key.add(rec.get(RMOVANA_CODCMS));
key.add(rec.get(RMOVANA_CODFASE));
conto = cache().get(LF_FASI, key, FASI_CODCONTO);
if (conto.blank())
{
for (int i = 2; conto.blank()&& i > 0; i--)
{
const TString4 level = ca_config().get("Level", NULL, i);
if (level == "CMS")
conto = cache().get(LF_COMMESSE, rec.get(RMOVANA_CODCMS), COMMESSE_CODCONTO);
else
if (level == "CDC")
conto = cache().get(LF_CDC, rec.get(RMOVANA_CODCCOSTO), CDC_CODCONTO);
}
}
if (conto.full())
{
rec.put(RMOVANA_CODCONTO, conto);
rec2row(rec, r);
}
}
}
void TMovanal_msk::aggiorna_saldo_riga(int r)
{
TRectype rec(LF_RMOVANA);
@ -946,8 +1019,9 @@ void TMovanal_msk::create_sheet()
create_sheet_fields(LF_FASI, y, dlg, fsc_req);
_use_pdc = ini.get_bool("UsePdcc");
const bool pdc_req = ini.get_bool("PdciRequired");
create_sheet_fields(_use_pdc ? LF_PCON : LF_PCONANA, y, dlg, pdc_req);
_pcon_start = dlg;
create_sheet_fields(_use_pdc ? LF_PCON : LF_PCONANA, y, dlg, false);
_pcon_end = dlg;
for (short id = S_CON4+100; id >= S_CDC1+100; id--)
{

View File

@ -635,7 +635,9 @@ int ca_create_fields(TMask& msk, int page, int logicnum, int x, int y,
if (fieldname && *fieldname)
{
const TFieldref& fr = *kfld->field();
TString80 str; str.format("%s[%d,%d]", fieldname, fr.from()+from+1, fr.to()+from);
TString80 str;
str.format("%s[%d,%d]", fieldname, fr.from()+from+1, fr.to()+from);
kfld->set_field(str);
}
}

View File

@ -7,5 +7,6 @@
#define CDC_ADDETTI "ADDETTI"
#define CDC_GESTFASI "GESTFASI"
#define CDC_APPOGGIO "APPOGGIO"
#define CDC_CODCONTO "CODCONTO"
#endif

View File

@ -54,6 +54,8 @@
#define COMMESSE_CODMAG "CODMAG"
#define COMMESSE_CODCOSTO "CODCOSTO"
#define COMMESSE_INDETR "INDETR"
#define COMMESSE_CODCONTO "CODCONTO"
#endif

View File

@ -1,3 +1,3 @@
146
0
$cdc|0|0|93|0|Archivio Centri di Costo|||
$cdc|||113|0|Archivio Centri di Costo|||

View File

@ -1,5 +1,5 @@
146
7
8
CODCOSTO|1|20|0|Codice Centro di Costo
DESCRIZ|1|50|0|Descrizione
DESCRAGG|11|10|0|Descrizione aggiuntiva
@ -7,6 +7,7 @@ ADDETTI|1|5|0|Numero Addetti
GESTFASI|8|1|0|Gestione Fasi
APPOGGIO|8|1|0|Centro di costo di appoggio
CODMAG|1|5|0|Codice magazzino e deposito
CODCONTO|1|20|0|Codice Conto analitico
2
CODCOSTO|
UPPER(DESCRIZ)|X

View File

@ -1,3 +1,3 @@
147
0
$commesse|||446|0|Archivio Commesse|||
$commesse|||466|0|Archivio Commesse|||

View File

@ -1,5 +1,5 @@
147
53
54
CODCMS|1|20|0|Codice Commessa
DESCRIZ|1|50|0|Descrizione
DESCRAGG|11|10|0|Descrizione aggiuntiva
@ -53,6 +53,7 @@ SALMIN|1|20|0|Modalit
CODMAG|1|5|0|Codice magazzino e deposito
CODCOSTO|1|20|0|Codice Centro di Costo
INDETR|1|1|0|Codice intetraibilita' IVA
CODCONTO|1|20|0|Codice Conto analitico
2
CODCMS|
UPPER(DESCRIZ)|X

View File

@ -1,3 +1,3 @@
148
0
$fasi|11|11|105|0|Archivio Fasi|||
$fasi|||125|0|Archivio Fasi|||

View File

@ -1,11 +1,12 @@
148
6
7
CODCMSFAS|1|20|0|Codice Centro di Costo/ Commessa
CODFASE|1|10|0|Codice Fase
DESCRIZ|1|50|0|Descrizione
DATAINIZIO|5|8|0|Data inizio
DATAFINE|5|8|0|Data fine
DATAPROR|5|8|0|Data proroga
CODCONTO|1|20|0|Codice Conto analitico
2
CODCMSFAS+CODFASE|
UPPER(DESCRIZ)|X

View File

@ -7,5 +7,6 @@
#define FASI_DATAINIZIO "DATAINIZIO"
#define FASI_DATAFINE "DATAFINE"
#define FASI_DATAPROR "DATAPROR"
#define FASI_CODCONTO "CODCONTO"
#endif