Patch level : 4.0 812
Files correlati : ca2.exe Ricompilazione Demo : [ ] Commento : Bug 0000775: Centro di costo di default Aggiungere un centro di costo di default sulle commesse da proporre nei movimenti di analitica e sui documenti git-svn-id: svn://10.65.10.50/trunk@15760 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
6d99b66eda
commit
38983f3ccf
@ -16,12 +16,17 @@
|
||||
#include "rmovana.h"
|
||||
#include "rrip.h"
|
||||
#include "saldana.h"
|
||||
#include "commesse.h"
|
||||
|
||||
|
||||
class TMovanal_msk : public TAutomask
|
||||
{
|
||||
TAssoc_array _saldi;
|
||||
bool _use_pdc;
|
||||
short _cms_start;
|
||||
short _cms_end;
|
||||
short _cdc_start;
|
||||
short _cdc_end;
|
||||
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event fe, long jolly);
|
||||
@ -370,6 +375,8 @@ int TMovanal_msk::get_constant_columns(TToken_string& tok) const
|
||||
|
||||
bool TMovanal_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
static TString __codcms;
|
||||
|
||||
switch (o.dlg())
|
||||
{
|
||||
case F_DATAREG:
|
||||
@ -410,8 +417,46 @@ bool TMovanal_msk::on_field_event(TOperable_field& o, TField_event e, long jolly
|
||||
if (e == se_enter)
|
||||
{
|
||||
const int r = int(jolly);
|
||||
aggiorna_saldo_riga(r);
|
||||
|
||||
aggiorna_saldo_riga(r);
|
||||
}
|
||||
if (e == se_query_modify)
|
||||
{
|
||||
TSheet_field & s = sfield(F_RIGHE);
|
||||
const int r = int(jolly);
|
||||
|
||||
__codcms.cut(0);
|
||||
for (short j = _cms_start; j <= _cms_end; j++)
|
||||
__codcms << s.row(r).get(s.cid2index(j));
|
||||
}
|
||||
if (e == se_notify_modify)
|
||||
{
|
||||
const int r = int(jolly);
|
||||
TSheet_field & s = sfield(F_RIGHE);
|
||||
TMask & m = s.sheet_mask();
|
||||
const TRectype & curr = ((TEdit_field &) m.field(_cms_start)).browse()->cursor()->curr();
|
||||
const TString codcosto = curr.get(COMMESSE_CODCOSTO);
|
||||
const TString & codcms = curr.get(COMMESSE_CODCMS);
|
||||
|
||||
if (_cms_start > 0 && __codcms != codcms) // && codcosto.full())
|
||||
{
|
||||
for (short i = _cdc_start; i <= _cdc_end; i++)
|
||||
{
|
||||
TEdit_field & e = m.efield(i);
|
||||
const TFieldref * f = e.field();
|
||||
|
||||
if (f != NULL)
|
||||
{
|
||||
const int from = f->from();
|
||||
const int to = f->to();
|
||||
|
||||
m.set(i, codcosto.sub(from, to), 0x2);
|
||||
s.update_row(r);
|
||||
s.force_update(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (e == fe_close)
|
||||
{
|
||||
const TImporto totdoc(get(F_SEZIONE)[0], get_real(F_TOTDOC));
|
||||
@ -491,7 +536,7 @@ bool TMovanal_msk::on_field_event(TOperable_field& o, TField_event e, long jolly
|
||||
TSheet_field& sf = sfield(F_RIGHE);
|
||||
const int r = sf.selected();
|
||||
sf.update_row(r);
|
||||
aggiorna_saldo_riga(r);
|
||||
aggiorna_saldo_riga(r);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -736,12 +781,16 @@ void TMovanal_msk::create_sheet()
|
||||
|
||||
int y = 3;
|
||||
short dlg = S_CDC1+100; // id del primo campo da generare
|
||||
_cdc_start = _cdc_end = -1;
|
||||
_cms_start = _cms_end = -1;
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
const TString& level = ini.get("Level", NULL, i+1); // Legge il livello 1 o 2
|
||||
if (level == "CDC") // Crea centro di costo
|
||||
{
|
||||
_cdc_start = dlg;
|
||||
_cdc_end = dlg + ca_multilevel_code_info(LF_CDC).levels()-1;
|
||||
if (fasinfo.parent() == LF_CDC)
|
||||
create_sheet_fields(LF_FASI, y, dlg, fsc_req);
|
||||
else
|
||||
@ -749,17 +798,20 @@ void TMovanal_msk::create_sheet()
|
||||
const bool cdc_req = ini.get_bool("CdcRequired");
|
||||
create_sheet_fields(LF_CDC, y, dlg, cdc_req);
|
||||
}
|
||||
} else
|
||||
if (level == "CMS") // Crea commessa
|
||||
{
|
||||
if (fasinfo.parent() == LF_COMMESSE)
|
||||
create_sheet_fields(LF_FASI, y, dlg, fsc_req);
|
||||
else
|
||||
{
|
||||
const bool cms_req = ini.get_bool("CmsRequired");
|
||||
create_sheet_fields(LF_COMMESSE, y, dlg, cms_req);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (level == "CMS") // Crea commessa
|
||||
{
|
||||
_cms_start = dlg;
|
||||
_cms_end = dlg + ca_multilevel_code_info(LF_COMMESSE).levels()-1;
|
||||
if (fasinfo.parent() == LF_COMMESSE)
|
||||
create_sheet_fields(LF_FASI, y, dlg, fsc_req);
|
||||
else
|
||||
{
|
||||
const bool cms_req = ini.get_bool("CmsRequired");
|
||||
create_sheet_fields(LF_COMMESSE, y, dlg, cms_req);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fasinfo.levels() > 0 && fasinfo.parent() <= 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user