Patch level : 12.00 1364

Files correlati     : f900.exe

Commento:
Implementata esclusione integrazioni
This commit is contained in:
Alessandro Bonazzi 2024-10-28 22:31:46 +01:00
parent 4b9888773f
commit d84edb9602
3 changed files with 84 additions and 11 deletions

View File

@ -67,6 +67,7 @@ public:
TApri_estr_msk(); TApri_estr_msk();
~TApri_estr_msk() {} ~TApri_estr_msk() {}
}; };
class TMonitor_mask : public TAutomask class TMonitor_mask : public TAutomask
{ {
// friend class TF9_app; // friend class TF9_app;

View File

@ -656,15 +656,15 @@ bool TControlloIntegrazioni_mask::associa_int_acq(const long numreg, TToken_stri
void TControlloIntegrazioni_mask::conferma_esclusi() const void TControlloIntegrazioni_mask::conferma_esclusi() const
{ {
TSheet_field& sf = sfield(S_INCL); const TMask& mask = *this;
TSheet_field& sf = mask.sfield(S_CONTROLLO);
FOR_EACH_SHEET_ROW_LOOP(sf, row) FOR_EACH_SHEET_ROW_LOOP(sf, row)
{ {
const long nreg = sf.get_long_row_cell(row, FI_NUMREG); const long nreg = sf.get_long_row_cell(row, F_CNUMREG);
TRectype & movs = (TRectype&)cache().get(LF_MOV, nreg); TRectype & movs = (TRectype&)cache().get(LF_MOV, nreg);
const TString & da_escludere = sf.get_str_row_cell(row, FI_IESCLUDI);
if (da_escludere == "S") if (sf.get_bool_row_cell(row, F_CESCLUDI))
{ {
TToken_string stato("", ';'); TToken_string stato("", ';');
@ -673,19 +673,33 @@ void TControlloIntegrazioni_mask::conferma_esclusi() const
stato.add("X"); stato.add("X");
movs.put(MOV_ELABF9, stato); movs.put(MOV_ELABF9, stato);
movs.rewrite(); movs.rewrite();
sf.set_row_cell(FI_IESCLUSO, true, row); sf.set_row_cell(F_CESCLUSO, "Si", row);
TString query;
query << "UPDATE " F9_ERR " SET ESCLUSO = 'Si' WHERE " ERR_CODSOC " = '" << _cod_soc << "' AND IDESTR = '" <<
_id_estr << "' AND NUMREG = '" << nreg << "';";
fp_db().sq_set_exec(query);
fp_db().sq_commit();
} }
else else
{ {
if (movs.get(MOV_ELABF9).full()) if (movs.get(MOV_ELABF9).full())
{ {
movs.zero(MOV_ELABF9); movs.put(MOV_ELABF9, "");
sf.set_row_cell(FI_IESCLUSO, false, row); sf.set_row_cell(F_CESCLUSO, "", row);
movs.rewrite(); movs.rewrite();
TString query;
query << "UPDATE " F9_ERR " SET ESCLUSO = NULL WHERE " ERR_CODSOC " = '" << _cod_soc << "' AND IDESTR = '" <<
_id_estr << "' AND NUMREG = '" << nreg << "';";
fp_db().sq_set_exec(query);
fp_db().sq_commit();
} }
} }
} }
sf.force_update(); sf.force_update();
sf.show();
} }
TToken_string* TControlloIntegrazioni_mask::selected_mov() TToken_string* TControlloIntegrazioni_mask::selected_mov()
@ -1121,6 +1135,40 @@ TControlloIntegrazioni_mask::TControlloIntegrazioni_mask(const char* codsoc, con
// TApri_pacchetto_msk // TApri_pacchetto_msk
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
void TApri_pacchetto_msk::conferma_esclusi() const
{
TSheet_field& sf = sfield(S_INCL);
FOR_EACH_SHEET_ROW_LOOP(sf, row)
{
const long nreg = sf.get_long_row_cell(row, FI_NUMREG);
TRectype & movs = (TRectype&)cache().get(LF_MOV, nreg);
const TString & da_escludere = sf.get_str_row_cell(row, FI_IESCLUDI);
if (da_escludere == "S")
{
TToken_string stato("", ';');
stato.add("", 0);
stato.add(today.date2ansi());
stato.add("X");
movs.put(MOV_ELABF9, stato);
movs.rewrite();
sf.set_row_cell(FI_IESCLUSO, true, row);
}
else
{
if (movs.get(MOV_ELABF9).full())
{
movs.zero(MOV_ELABF9);
sf.set_row_cell(FI_IESCLUSO, false, row);
movs.rewrite();
}
}
}
sf.force_update();
}
bool TApri_pacchetto_msk::on_field_event(TOperable_field& o, TField_event e, long jolly) bool TApri_pacchetto_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
{ {
switch (o.dlg()) switch (o.dlg())
@ -1137,15 +1185,37 @@ bool TApri_pacchetto_msk::on_field_event(TOperable_field& o, TField_event e, lon
break; break;
case B_ISELESCL: case B_ISELESCL:
if (e == fe_button) if (e == fe_button)
//inselect_handler(); {
static bool sel_esclusi = false;
if (_provv || TArchiviazioneIntegrazioni::is_stato_errore(_statoestr))
{
sel_esclusi = !sel_esclusi;
field(B_IESCL).enable(sel_esclusi);
field(B_IALLESCL).enable(sel_esclusi);
sfield(S_INCL).enable_column(cid2index(FI_IESCLUDI), sel_esclusi);
sfield(S_INCL).force_update();
return true;
}
warning_box("E' possibile escludere i movimenti solo per pacchetti bloccati\nin stato di errore '" D_WA_ERR " - %s'",
TArchiviazioneIntegrazioni::traduci_stato(D_WA_ERR));
}
break; break;
case B_IESCL: case B_IESCL:
if (e == fe_button) if (e == fe_button)
//inescludi_handler(); conferma_esclusi();
break; break;
case B_IALLESCL: case B_IALLESCL:
if (e == fe_button) if (e == fe_button)
//inall_handler(); {
TSheet_field& sf = sfield(S_INCL);
const bool active = *sf.row(0).get(cid2index(FI_IESCLUDI)) == 'S';
FOR_EACH_SHEET_ROW_LOOP(sf, row)
sf.set_row_cell(FI_IESCLUDI, active ? "N" : "S", row);
sf.force_update();
return true;
}
break;
default: break; default: break;
} }
return true; return true;

View File

@ -38,7 +38,8 @@ class TApri_pacchetto_msk : public TAutomask
//bool inall_handler() const; //bool inall_handler() const;
//bool inescludi_handler() const; //bool inescludi_handler() const;
//bool inselect_handler() const; //bool inselect_handler() const;
//void conferma_esclusi() const; void conferma_esclusi() const;
public: public:
void fill_estr() const; void fill_estr() const;
void fill_res() const; void fill_res() const;
@ -169,6 +170,7 @@ public:
TArray & esclusi() { return _esclusi; } TArray & esclusi() { return _esclusi; }
static const char* traduci_stato(const TString& cod); static const char* traduci_stato(const TString& cod);
static bool is_stato_errore(const TString& stato_etr) { return stato_etr == D_GEST_ERR || stato_etr == D_WA_ERR || stato_etr == D_ERR_SOS; }
void run_estr_msk() { _estr_msk->run(); } void run_estr_msk() { _estr_msk->run(); }