From 3d1fdb90d5d07b9643794b33c7421ffb932c3d09 Mon Sep 17 00:00:00 2001 From: Alessandro Bonazzi Date: Thu, 27 Aug 2020 13:08:07 +0200 Subject: [PATCH] Patch level : 12.0 no-patch Files correlati : Commento : Spostati TAnagrafica e TClifor in cglib ecli2doc in TDocumento --- src/ve/sconti.h | 4 --- src/ve/velib.h | 7 ++-- src/ve/velib03.cpp | 90 ++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 90 insertions(+), 11 deletions(-) diff --git a/src/ve/sconti.h b/src/ve/sconti.h index b33760eb3..8f379f3c4 100755 --- a/src/ve/sconti.h +++ b/src/ve/sconti.h @@ -1,10 +1,6 @@ #ifndef __SCONTI_H #define __SCONTI_H -#ifndef __TCLIFOR_H -#include "clifor.h" -#endif - #ifndef __VELIB_H #include "velib.h" #endif diff --git a/src/ve/velib.h b/src/ve/velib.h index 63609a353..7cdf0cdfb 100755 --- a/src/ve/velib.h +++ b/src/ve/velib.h @@ -21,10 +21,6 @@ class TViswin; #endif -#ifndef __CLIFOR_H -#include "../ve/clifor.h" -#endif - #ifndef __VERIG_H #include "../ve/verig.h" #endif @@ -972,7 +968,8 @@ public: TString & registrazione, TString & data_registrazione) const; bool is_split_payment() const; - void cli2doc() { clifor().cli2doc(*this); } + void cli2doc(); + TDocumento (); TDocumento (const TDocumento& d); TDocumento(char provv, int anno, const char* codnum, long numdoc); diff --git a/src/ve/velib03.cpp b/src/ve/velib03.cpp index 43851257f..59674cf86 100755 --- a/src/ve/velib03.cpp +++ b/src/ve/velib03.cpp @@ -5,7 +5,7 @@ #include #include -#include "../cg/cglib.h" +#include "../cg/cfban.h" #include "../db/dblib.h" #include "../pr/prlib.h" #include "../li/letint.h" @@ -3416,4 +3416,90 @@ bool TDocumento::is_split_payment() const } } return yes; -} \ No newline at end of file +} + +void TDocumento::cli2doc() +{ + const TRectype& v = clifor().vendite(); + + put(DOC_CODVAL, get(CLI_CODVAL)); + put(DOC_CODLIN, get(CLI_CODLIN)); + put(DOC_CODPAG, get(CLI_CODPAG)); + + TToken_string key; + + key.add(get(CLI_TIPOCF)); + key.add(get(CLI_CODCF)); + key.add("V"); + key.add("1"); + + const TRectype& cfban = cache().get(LF_CFBAN, key); + + if (cfban.empty()) + { + put(DOC_CODABIA, get(CLI_CODABI)); + put(DOC_CODCABA, get(CLI_CODCAB)); + put(DOC_IBAN, get(CLI_IBAN)); + } + else + { + put(DOC_CODABIA, cfban.get(CFBAN_ABI)); + put(DOC_CODCABA, cfban.get(CFBAN_CAB)); + put(DOC_IBAN, cfban.get(CFBAN_IBAN)); + } + + // Trasforma chiave da Vostra a Nostra banca + key.add("N", 2); + const TRectype& cfbanpr = cache().get(LF_CFBAN, key); + + // Setta i campi che appartengono al file LF_CFVEN + if (cfbanpr.empty()) + { + put(DOC_CODABIP, v.get(CFV_CODABIPR)); + put(DOC_CODCABP, v.get(CFV_CODCABPR)); + } + else + { + put(DOC_CODABIP, cfbanpr.get(CFBAN_ABI)); + put(DOC_CODCABP, cfbanpr.get(CFBAN_CAB)); + put(DOC_PROGBNP, cfbanpr.get(CFBAN_PROGPR)); + } + put(DOC_RAGGR, v.get(CFV_RAGGDOC)); + put(DOC_RAGGREFF, v.get(CFV_RAGGEFF)); + put(DOC_CODINDSP, v.get(CFV_CODINDSP)); + put(DOC_CODAG, v.get(CFV_CODAG)); + put(DOC_CODAGVIS, v.get(CFV_CODAG1)); + put(DOC_CODSPMEZZO, v.get(CFV_CODSPMEZZO)); + put(DOC_CODPORTO, v.get(CFV_CODPORTO)); + put(DOC_CODNOTESP1, v.get(CFV_CODNOTESP1)); + put(DOC_CODNOTESP2, v.get(CFV_CODNOTESP2)); + put(DOC_CODNOTE, v.get(CFV_CODNOTE)); + put(DOC_CODVETT1, v.get(CFV_CODVETT1)); + put(DOC_CODVETT2, v.get(CFV_CODVETT2)); + put(DOC_CODVETT3, v.get(CFV_CODVETT3)); + put(DOC_PERCSPINC, v.get(CFV_PERCSPINC)); + put(DOC_ADDBOLLI, v.get(CFV_ADDBOLLI)); + put(DOC_CATVEN, v.get(CFV_CATVEN)); + + const int alleg = get_int(CLI_ALLEG); + const bool split_payment = get_date(DOC_DATADOC).year() >= 2015 && get_bool(CLI_SPLITPAY); + + put(DOC_LIQDIFF, !split_payment && alleg == 7 && ini_get_bool(CONFIG_DITTA, "cg", "GesLiqDiff") ? "X" : ""); + + //listino: deve essere attiva la gestione listini nella ditta + const bool gest_listini = ini_get_bool(CONFIG_DITTA, "ve", "GES", false, 1); + if (gest_listini) + { + const TDate datadoc = get_date(DOC_DATADOC); + const TString& listino = clifor().find_listino_al(datadoc); + + put(DOC_CODLIST, listino); + } + + put(DOC_ZONA, v.get(CFV_CODZONA)); + put(DOC_RAGGR, v.get(CFV_RAGGDOC)); + + //aggiungere gestione spese e bolli??? + put(DOC_CODPORTO, v.get(CFV_CODPORTO)); +} +