Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : aggiunto metodo ai clifor per raccattare il listino valido di un cliente in una certa data git-svn-id: svn://10.65.10.50/branches/R_10_00@21386 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
90c99670b8
commit
152017b6ec
@ -1,10 +1,12 @@
|
||||
#include <applicat.h>
|
||||
#include <modaut.h>
|
||||
#include <relation.h>
|
||||
|
||||
#include "clifor.h"
|
||||
#include "condv.h"
|
||||
#include "velib.h"
|
||||
#include "../li/letint.h"
|
||||
#include "../cg/cfban.h"
|
||||
#include <modaut.h>
|
||||
#include <relation.h>
|
||||
|
||||
TOccasionale::TOccasionale() : TRectype(LF_OCCAS)
|
||||
{ }
|
||||
@ -175,6 +177,38 @@ void TCli_for::init()
|
||||
_use_lettere = ini_get_bool(CONFIG_DITTA, "ve", "USELETTERE");
|
||||
}
|
||||
|
||||
const TString& TCli_for::find_listino_al(const TDate& datadoc) const
|
||||
{
|
||||
const bool gest_list_catven = ini_get_bool(CONFIG_DITTA, "ve", "GESLISCV", false, 1);
|
||||
const TRectype& v = vendite();
|
||||
TString4 listino = v.get(CFV_CODLIST);
|
||||
|
||||
//se il cliente ha un listino specificato -> va usato (previo controllo validità)
|
||||
while (listino.full())
|
||||
{
|
||||
TToken_string key_condv;
|
||||
key_condv.add("L");
|
||||
if (gest_list_catven)
|
||||
key_condv.add(v.get(CFV_CATVEN));
|
||||
else
|
||||
key_condv.add("");
|
||||
key_condv.add("");
|
||||
key_condv.add("");
|
||||
key_condv.add(listino);
|
||||
const TRectype& rec_condv = cache().get(LF_CONDV, key_condv);
|
||||
|
||||
const TDate inizio_validita = rec_condv.get_date(CONDV_VALIN);
|
||||
const TDate fine_validita = rec_condv.get_date(CONDV_VALFIN);
|
||||
|
||||
//usa il listino indicato sul cliente solo se è valido per la data del documento
|
||||
if (datadoc >= inizio_validita && (datadoc <= fine_validita || !fine_validita.ok()))
|
||||
break;
|
||||
else
|
||||
listino = rec_condv.get(CONDV_CODLISSUCC);
|
||||
}
|
||||
return get_tmp_string() = listino;
|
||||
}
|
||||
|
||||
void TCli_for::cli2doc(TDocumento & doc)
|
||||
{
|
||||
const TRectype & v = vendite();
|
||||
@ -247,7 +281,11 @@ void TCli_for::cli2doc(TDocumento & doc)
|
||||
//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)
|
||||
doc.put(DOC_CODLIST, v.get(CFV_CODLIST));
|
||||
{
|
||||
const TDate datadoc = doc.get_date(DOC_DATADOC);
|
||||
const TString& listino = find_listino_al(datadoc);
|
||||
doc.put(DOC_CODLIST, listino);
|
||||
}
|
||||
|
||||
doc.put(DOC_ZONA, v.get(CFV_CODZONA));
|
||||
doc.put(DOC_RAGGR, v.get(CFV_RAGGDOC));
|
||||
|
@ -70,6 +70,7 @@ public:
|
||||
int read(char tipo, long codice, word op = _isequal, word lockop = _nolock);
|
||||
virtual int remove(TBaseisamfile& f) const;
|
||||
void cli2doc(TDocumento & doc);
|
||||
const TString& find_listino_al(const TDate& datadoc) const;
|
||||
|
||||
TCli_for(char tipo = ' ', long codice = 0L);
|
||||
TCli_for(const TRectype & rec);
|
||||
|
Loading…
x
Reference in New Issue
Block a user