From ad483c3045b50c0756fe62386aa31640c4e2262d Mon Sep 17 00:00:00 2001 From: luca83 Date: Tue, 15 Dec 2009 17:36:40 +0000 Subject: [PATCH] =?UTF-8?q?Patch=20level=20=20=20=20=20=20=20=20=20:=2010.?= =?UTF-8?q?0=20patch=20549=20Files=20correlati=20=20=20=20=20:=20lv0=20Ric?= =?UTF-8?q?ompilazione=20Demo=20:=20[=20]=20Commento=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20=20:=20Se=20tento=20di=20cancellare=20un=20articolo?= =?UTF-8?q?=20in=20contratto=20e=20questo=20articolo=20=C3=A8=20presente?= =?UTF-8?q?=20in=20una=20bolla=20da=20fatturare=20o=20in=20un=20buono=20di?= =?UTF-8?q?=20ritiro=20o=20prelievo=20ancora=20da=20associare=20non=20deve?= =?UTF-8?q?=20potermelo=20far=20fare?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://10.65.10.50/trunk@19788 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- lv/lv0400.cpp | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/lv/lv0400.cpp b/lv/lv0400.cpp index 45c9f5bb8..ef77d87aa 100755 --- a/lv/lv0400.cpp +++ b/lv/lv0400.cpp @@ -281,6 +281,59 @@ bool TContratti_msk::on_field_event(TOperable_field& o,TField_event e,long jolly warning_box("Impossibile cancellare l'articolo %s perchè ha una dotazione iniziale non nulla", (const char*) codart); return false; } + + const TDate oggi(TODAY); + const int danno = oggi.year() - 1; + const int aanno = oggi.year() + 1; + + //controllo articolo in buoni di consegna + const TString8 tipoela = "FAT1"; //in realtà dal 16/12/2009 andrà letto da configurazione + + const TString4 codnumbc = ini_get_string(CONFIG_DITTA, "lv", "NUM_GEN"); + const TString4 tipodocbc = ini_get_string(CONFIG_DITTA, "lv", "TIPODOC_GEN"); + const char statofbc = cache().get("%ELD", tipoela, "S4").left(0)[0]; + + TString query; + query << "USE RDOC KEY 5\n" + << "SELECT (DOC.TIPODOC=\"" << tipodocbc << "\")&&(DOC.STATO<\"" << statofbc << "\")\n" + << "JOIN DOC INTO PROVV=PROVV ANNO=ANNO CODNUM=CODNUM NDOC=NDOC\n" + << "FROM CODART=\"" << codart << "\" ANNO=" << danno << "CODNUM=\"" << codnumbc << "\"\n" + << "TO CODART=\"" << codart << "\" ANNO=" << danno << "CODNUM=\"" << codnumbc << "\"\n"; + + TISAM_recordset bcon(query); + + if(bcon.items() > 0) + { + TString str; + str << "Non è possibile cancellare dal contratto l'articolo " << codart + << "in quanto è presente su " << bcon.items() << " ancora da fatturare"; + warning_box(str); + return false; + } + + //controllo articolo in buoni di prelievo + const TString4 codnumbp = ini_get_string(CONFIG_DITTA, "lv", "NUM_PRE", NULL, 0); + const TString4 tipodocbp = ini_get_string(CONFIG_DITTA, "lv", "TIPODOC_PRE", NULL, 0); + const char statofbp = cache().get("%TIP", tipodocbp, "S2").mid(2,1)[0]; + + query.cut(0); + query << "USE RDOC KEY 5\n" + << "SELECT (DOC.TIPODOC=\"" << tipodocbp << "\")&&(DOC.STATO<\"" << statofbp << "\")\n" + << "JOIN DOC INTO PROVV=PROVV ANNO=ANNO CODNUM=CODNUM NDOC=NDOC\n" + << "FROM CODART=\"" << codart << "\" ANNO=" << danno << "CODNUM=\"" << codnumbp << "\"\n" + << "TO CODART=\"" << codart << "\" ANNO=" << danno << "CODNUM=\"" << codnumbp << "\"\n"; + + TISAM_recordset bpre(query); + + if(bpre.items() > 0) + { + TString str; + str << "Non è possibile cancellare dal contratto l'articolo " << codart + << "in quanto è presente su " << bpre.items() << " ancora da evadere"; + warning_box(str); + return false; + } + if (!yesno_box("Si desidera veramente cancellare l'articolo %s",(const char*) codart)) return false; }