From cc4e2ee94928c417487fb1e544ddada9e004b991 Mon Sep 17 00:00:00 2001 From: mtollari Date: Tue, 28 Mar 2017 09:08:51 +0000 Subject: [PATCH] =?UTF-8?q?Patch=20level=20=20=20=20=20=20=20=20=20:=2012.?= =?UTF-8?q?0=20376=20Files=20correlati=20=20=20=20=20:=20li=20Commento=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20=20=20=20:=20Sistemati=20controlli=20di?= =?UTF-8?q?chiarazione=20di=20intento.=20Tutti=20i=20problemi=20per=20le?= =?UTF-8?q?=20dichiarazioni=20di=20intento=20di=20tipo=20"Nel=20periodo"?= =?UTF-8?q?=20sono=20stati=20sistemati,=20con=20i=20tasti=20Shift+F12=20?= =?UTF-8?q?=C3=A8=20possibile=20disabilitare=20tutti=20i=20controlli=20e?= =?UTF-8?q?=20con=20i=20tasti=20Shift+F11=20si=20riabilitano.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://10.65.10.50/branches/R_10_00@23706 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- src/li/li0400.cpp | 59 +++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/src/li/li0400.cpp b/src/li/li0400.cpp index 47edd5637..a0c46f4da 100755 --- a/src/li/li0400.cpp +++ b/src/li/li0400.cpp @@ -20,6 +20,7 @@ protected: bool hasLiOpen(); bool block; + bool keyforced; public: TDate ultima_stampa(int anno); @@ -32,13 +33,12 @@ bool TLetint_mask::on_key(KEY k) { if (k == K_SHIFT+K_F12 && (edit_mode() || insert_mode())) { + keyforced = true; enable(DLG_SAVEREC); - if(get_int(F_TIPOOP) == 3) // Nel periodo - { - enable(F_DAL); - enable(F_AL); - } + enable(F_NUMPROT); } + if (k == K_SHIFT+K_F11) + keyforced = false; return TAutomask::on_key(k); } @@ -56,7 +56,7 @@ bool TLetint_mask::on_field_event(TOperable_field& o, TField_event e, long jolly if (e == fe_close && query_mode()) { const long numprot = get_long(F_NUMPROT); - if (numprot > 1) + if (!keyforced && numprot > 1) { const int anno = get_int(F_ANNO); TLocalisamfile letint(LF_LETINT); @@ -67,6 +67,7 @@ bool TLetint_mask::on_field_event(TOperable_field& o, TField_event e, long jolly } } break; + case F_DATAREG: if (e == fe_close && insert_mode()) { @@ -93,51 +94,53 @@ bool TLetint_mask::on_field_event(TOperable_field& o, TField_event e, long jolly { } break; + case F_CODCLI: // Controllo se il cliente non ha già una dichiarazione aperta - if(hasLiOpen() && insert_mode()) + if(!keyforced && hasLiOpen() && insert_mode()) { warning_box("Il cliente %d ha già una dichiarazione aperta! Chiudere prima la precedente!", get_int(F_CODCLI)); disable(DLG_SAVEREC); - block = true; } else { enable(DLG_SAVEREC); - enable(F_TIPOOP); } + case F_DAL: + if(e != fe_modify) + break; case F_TIPOOP: - switch(get_int(F_TIPOOP)) + // Controlli + if(!keyforced && insert_mode() && get_int(F_TIPOOP) == 3 && get_date(F_DAL) > TDate(01,03,2017)) + { + error_box(TR("Non può esistere una dichiarazione di intento di tipo \"A Periodo\"\ncon data posteriore al 01/03/2017!")); + disable(DLG_SAVEREC); + } + else + { + enable(DLG_SAVEREC); + } + // Abilitazione date + switch (get_int(F_TIPOOP)) { case 1: - if(!block) enable(DLG_SAVEREC); disable(F_DAL); disable(F_AL); + set(F_DAL, ""); + set(F_AL, ""); break; case 2: - if(!block) enable(DLG_SAVEREC); enable(F_DAL); disable(F_AL); + set(F_AL, ""); break; case 3: - { - disable(DLG_SAVEREC); - disable(F_DAL); - disable(F_AL); - if(!insert_mode()) - { - // Chiudo la dichiarazione di intento - TRectype liclosed = cache().get(LF_LETINT, TString(get(F_ANNO)) << "|" << get_int(F_NUMPROT)); - liclosed.put("CHIUSA", "X"); - liclosed.rewrite(TLocalisamfile(LF_LETINT)); - set(B_CHIUSA, true); - } - break; - } - default: + enable(F_DAL); + enable(F_AL); break; } + break; default: break; } @@ -182,7 +185,7 @@ TDate TLetint_mask::ultima_stampa(int anno) } -TLetint_mask::TLetint_mask() : TAutomask("li0400a"), block(false) +TLetint_mask::TLetint_mask() : TAutomask("li0400a"), block(false), keyforced(false) { first_focus(F_ANNO); }