campo-sirio/src/tf/tfutility.cpp
mtollari 725ad83724 Patch level : 12.0 428
Files correlati     : tf
Commento            : Inizio sviluppo programma di controllo spesometro, spostate alcune funzioni in tfutility per comodità

git-svn-id: svn://10.65.10.50/branches/R_10_00@24008 c028cbd2-c16b-5b4b-a496-9718f37d4682
2017-07-28 08:20:30 +00:00

78 lines
1.9 KiB
C++

#include <recarray.h> // cache()
#include "../ve/velib05.h"
#include "../cg/cglib03.h"
#include "../fe/felib.h"
#include "tfutility.h"
// Ritorna il record da trasfatt
TRectype getTrasFatt(TString reg, TString codiva)
{
TString key = reg; key << "|" << codiva;
return cache().get(LF_TRASFATT, key);
}
// Ritorna il cliente
TRectype getCli(const TString& tipocf, const TString& codcf, const TString& ocfpi)
{
TString key = tipocf; key << "|" << codcf;
const TRectype& cli = cache().get(LF_CLIFO, key);
if(cli.get_bool("OCCAS"))
{
TRectype cli(LF_CLIFO);
TRectype occas = cache().get(LF_OCCAS, ocfpi);
cli.put("RAGSOC" , occas.get("RAGSOC"));
cli.put("CODRFSO" , "");
cli.put("PAIV" , occas.get("PAIV"));
cli.put("COFI" , occas.get("COFI"));
return cli;
}
else
return cli;
}
// Controlla se l'azienda ha un RFSO
bool haveRFSO(TString& codrfso)
{
codrfso = cache().get(LF_NDITTE, prefix().firm().codice(), "CODRFSO");
if(codrfso == "") return false;
return true;
}
const char * natura(const TString& codiva)
{
const TRectype& ai = cache().get("%IVA", codiva);
TString & natura = get_tmp_string(4);
natura = ai.get("S12");
return natura;
}
TString findDetraib(TString tipodet)
{
real perc = cache().get("%DET", tipodet, "R0");
return perc.stringa(6,2);
}
real get_IVA(const TString& codiva)
{
const TRectype& ai = cache().get("%IVA", codiva);
return ai.get_real("R0");
}
TString revCharge(TString numreg)
{
// Controllo se la causale ha il reverse charge, se il cliente non l'ha impostata giusta sono ARAZZI suoi
TString key = numreg;
TCausale caus(cache().get(LF_MOV, key, "CODCAUS"));
if(caus.reverse_charge())
bool tolla = true;
return caus.reverse_charge() ? "X" : "";
}
TString getRFSO(TString codrfso)
{
TString key; key << codrfso[0] << "|" << codrfso.mid(1);
return cache().get(LF_ANAG, key, "RAGSOC");
}