From 244e8674a819fe80ddddd8dacda459a19831337f Mon Sep 17 00:00:00 2001 From: cris Date: Tue, 8 Feb 2005 13:20:39 +0000 Subject: [PATCH] Patch level :2.2 nopatch Files correlati :crpa0.exe Ricompilazione Demo : [ ] Commento :modifica per il crpa; da riportare su 2.1 git-svn-id: svn://10.65.10.50/trunk@12675 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- crpa/crpa0.cpp | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/crpa/crpa0.cpp b/crpa/crpa0.cpp index a97c75c4a..d3fb77e77 100755 --- a/crpa/crpa0.cpp +++ b/crpa/crpa0.cpp @@ -59,6 +59,7 @@ protected: void build_paragraph(const TString& paragrafo, TString& outputstr); int build_nriga(const TString& paragrafo); int get_tipo_dadoc(const TDocumento& doc) const; + bool get_fdaric_dadoc(const TDocumento& doc) const; long get_protiva(const TDocumento& doc) const; bool search_costo_ricavo(TBill& conto, const TRiga_documento& r); bool test_swap() const; @@ -478,6 +479,22 @@ int TIni2Sql::get_tipo_dadoc(const TDocumento& doc) const return datipo; } +bool TIni2Sql::get_fdaric_dadoc(const TDocumento& doc) const +{ + bool daric = FALSE; + for (int r = 1; r <= doc.rows(); r++) + { + const TRiga_documento& rdoc = doc[r]; + const TString8 dacodnum = rdoc.get(RDOC_DACODNUM); + if (dacodnum.not_empty()) + { + daric = cache().get("%NUM", dacodnum).get_bool("B3"); + break; + } + } + return daric; +} + // esegue l'elaborazione indicata void TIni2Sql::validate(const TString& elabfield, TString& str) { @@ -630,13 +647,25 @@ void TIni2Sql::validate(const TString& elabfield, TString& str) } else if (tipodoc == 2) // fattura { - const int datipodoc = get_tipo_dadoc(*_doc); - if (datipodoc == 1) - tmpstr = "FB"; - else if (datipodoc == 3) - tmpstr = "FO"; - else - tmpstr = "F"; + const bool daricevere = cache().get("%NUM", _doc->numerazione()).get_bool("B3"); + if (daricevere) + tmpstr = "FR"; + else + { + const int datipodoc = get_tipo_dadoc(*_doc); + if (datipodoc == 1) + tmpstr = "FB"; + else if (datipodoc == 3) + tmpstr = "FO"; + else + { + const bool daric = get_fdaric_dadoc(*_doc); + if (daric) + tmpstr = "FF"; + else + tmpstr = "F"; + } + } } str = _configfile->get(tmpstr, "Tipo documento"); }