diff --git a/cg/cg3200.cpp b/cg/cg3200.cpp index 73be8be80..18605f05c 100755 --- a/cg/cg3200.cpp +++ b/cg/cg3200.cpp @@ -109,7 +109,7 @@ protected: bool sheet2mask(); public: - TDate _inizioEs,_fineEs; + //TDate _inizioEs,_fineEs; int date2esc(const TDate& d); void ricerca_clifo(); @@ -704,10 +704,10 @@ bool TMastrini_application::data_inizio(TMask_field& f, KEY k) if (anno == 0) { if (data == botime) - { - f.error_box("La data deve essere obbligatoriamente indicata"); - return FALSE; - } + return f.error_box("La data deve essere obbligatoriamente indicata"); + + if (app().date2esc(data) == 0) + return f.error_box("La data indicata non appartiene ad alcun esercizio"); else app()._data_ini = data; } @@ -733,36 +733,35 @@ bool TMastrini_application::data_fine(TMask_field& f, KEY k) app().data_fine_esercizio(annoes); if (data == botime) - app()._data_fine = app()._data_finese; + app()._data_fine = app()._data_finese; else - if (data < app()._data_inizioese || data > app()._data_finese) - { - f.error_box("La data non appartiene all'esercizio indicato"); - return FALSE; - } - else + if (data < app()._data_inizioese || data > app()._data_finese) + { + f.error_box("La data non appartiene all'esercizio indicato"); + return FALSE; + } + else app()._data_fine = data; } else if (annoes == 0) { - if (data == botime) - { - f.error_box("La data deve essere obbligatoriamente indicata"); - return FALSE; - } + if (data == botime) + return f.error_box("La data deve essere obbligatoriamente indicata"); - app()._anno_ghost = app().date2esc(data_ini); - - app()._inizioes = app()._inizioEs; + app()._anno_ghost = app().date2esc(data_ini); + + if (app()._anno_ghost == 0) + return f.error_box("La data indicata non appartiene ad alcun esercizio"); + //app()._inizioes = app()._inizioEs; - if (data < app()._inizioEs || data > app()._fineEs) - { - f.error_box("La data non appartiene all'esercizio indicato"); - return FALSE; - } - else - app()._data_fine = data; + //if (data < app()._inizioEs || data > app()._fineEs) + //{ + // f.error_box("La data non appartiene all'esercizio indicato"); + // return FALSE; + //} + //else + app()._data_fine = data; } if (data < data_ini)