Patch level : 12.00 1416

Files correlati     : ve0.exe
Commento
Riprostinata la commessa precedente se l'attuale e chiusa
This commit is contained in:
Alessandro Bonazzi 2026-09-15 18:28:46 +02:00
parent 42c2419751
commit 45b418599a
2 changed files with 64 additions and 22 deletions

View File

@ -2883,10 +2883,10 @@ bool cms_mag_handler(TMask_field& f, KEY key)
const TSheet_field& s = *m.get_sheet();
TDocumento_mask& mask = (TDocumento_mask&)s.mask();
const TRectype& curr = m.efield(mask.cms_end_sh()).browse()->cursor()->curr();
const TString80 codcms = curr.get(COMMESSE_CODCMS);
TString80 codcms = curr.get(COMMESSE_CODCMS);
TString svcms = mask.codcms_sh();
if (mask.codcms_sh() != codcms) // Cambio commessa
if (svcms != codcms) // Cambio commessa
{
if ((key == K_TAB && f.focusdirty()))
{
@ -2896,7 +2896,27 @@ bool cms_mag_handler(TMask_field& f, KEY key)
if (chiusa && curr.get_bool(COMMESSE_PROROGA))
chiusa = mask.get_date(F_DATADOC) > curr.get_date(COMMESSE_DATAPROR);
if (chiusa)
return (t == _bloccante) ? f.error_box(FR("La commessa %s è chiusa "), (const char*)codcms) : f.yesno_box(FR("La commessa chiusa %s, vuoi utilizzarla"), (const char*)codcms);
{
bool ok = (t == _bloccante) ? error_box(FR("La commessa %s è chiusa "), (const char*)codcms) :
yesno_box(FR("La commessa chiusa %s, vuoi utilizzarla ?"), (const char*)codcms);
if (!ok)
{
codcms = svcms;
for (short i = mask.cms_start(); i <= mask.cms_end(); i++)
{
TEdit_field & e = mask.efield(i);
const TFieldref * f = e.field();
if (f != nullptr)
{
const int from = f->from();
const int to = f->to();
mask.set(i, codcms.sub(from, to), 0x2);
}
}
}
return ok;
}
}
mask.codcms_sh() = codcms;
@ -2988,13 +3008,15 @@ bool codcms_handler(TMask_field& f, KEY key)
}
const TRectype& curr_cms = ((TEdit_field&)f).browse()->cursor()->curr();
const TString80 codcms = curr_cms.get(COMMESSE_CODCMS);
TString80 codcms = curr_cms.get(COMMESSE_CODCMS);
mask.set(F_CMSH, codcms);
if ((key == K_TAB && f.focusdirty()) || key == K_ENTER)
{
// Controlla se c'e' la gestione dei centri di costo al secondo livello
if (mask.codcms() != codcms)
TString svcms = mask.codcms();
if (svcms != codcms)
{
if ((key == K_TAB && f.focusdirty()))
{
@ -3004,7 +3026,27 @@ bool codcms_handler(TMask_field& f, KEY key)
if (chiusa && curr_cms.get_bool(COMMESSE_PROROGA))
chiusa = mask.get_date(F_DATADOC) > curr_cms.get_date(COMMESSE_DATAPROR);
if (chiusa)
return (t == _bloccante) ? f.error_box(FR("La commessa %s è chiusa "), (const char*)codcms) : f.yesno_box(FR("La commessa chiusa %s, vuoi utilizzarla"), (const char*)codcms);
{
bool ok = (t == _bloccante) ? error_box(FR("La commessa %s è chiusa "), (const char*)codcms) :
yesno_box(FR("La commessa chiusa %s, vuoi utilizzarla ?"), (const char*)codcms);
if (!ok)
{
codcms = svcms;
for (short i = mask.cms_start(); i <= mask.cms_end(); i++)
{
TEdit_field & e = mask.efield(i);
const TFieldref * f = e.field();
if (f != nullptr)
{
const int from = f->from();
const int to = f->to();
mask.set(i, codcms.sub(from, to), 0x2);
}
}
}
return ok;
}
}
doc.put(DOC_CODCMS, codcms);
FOR_EACH_PHYSICAL_RDOC(doc, r, riga)