Patch level : 4.0 nopatch

Files correlati     : crpa0.exe
Ricompilazione Demo : [ ]
Commento            : commit in sospeso (usa tipodocumento)


git-svn-id: svn://10.65.10.50/trunk@15362 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 2007-05-25 10:28:44 +00:00
parent 9965418d3f
commit 6cbc0260a6

View File

@ -61,6 +61,7 @@ protected:
void build_paragraph(const TString& paragrafo, TString& outputstr);
int build_nriga(const TString& paragrafo);
int get_tipo_dadoc(const TDocumento& doc) const;
int get_tipo_doc(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);
@ -468,13 +469,20 @@ long TIni2Sql::get_protiva(const TDocumento& doc) const
return protiva;
}
int TIni2Sql::get_tipo_doc(const TDocumento& doc) const
{
const TString4 codnum = doc.get(DOC_CODNUM);
int tipo = atoi(cache().get("%NUM", codnum, "I1"));
return tipo;
}
int TIni2Sql::get_tipo_dadoc(const TDocumento& doc) const
{
int datipo = 0;
for (int r = 1; r <= doc.rows(); r++)
{
const TRiga_documento& rdoc = doc[r];
const TString8 dacodnum = rdoc.get(RDOC_DACODNUM);
const TString4 dacodnum = rdoc.get(RDOC_DACODNUM);
if (dacodnum.not_empty())
{
datipo = atoi(cache().get("%NUM", dacodnum, "I1"));
@ -484,13 +492,14 @@ 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);
const TString4 dacodnum = rdoc.get(RDOC_DACODNUM);
if (dacodnum.not_empty())
{
daric = cache().get("%NUM", dacodnum).get_bool("B3");
@ -660,34 +669,31 @@ void TIni2Sql::validate(const TString& elabfield, TString& str)
{
if (_doc != NULL)
{
const int tipodoc = atoi(cache().get("%NUM", _doc->numerazione(), "I1"));
if (tipodoc == 3) // ordine
const int tipodoc = get_tipo_doc(*_doc);
if (tipodoc == TTipo_documento::_ordine)
tmpstr = "O";
else if (tipodoc == 1) // bolla
else if (tipodoc == TTipo_documento::_bolla)
{
// restituisce il tipo documento origine della prima riga che ha un doc. di origine
const int datipodoc = get_tipo_dadoc(*_doc); // si assume che sia il tipo documento di origine per tutto il documento
tmpstr = (datipodoc == 3) ? "BO" : "B";
tmpstr = (datipodoc == TTipo_documento::_ordine) ? "BO" : "B";
}
else if (tipodoc == 2 || tipodoc == 0) // fattura o altro da ricevere
else if (tipodoc == TTipo_documento::_fattura || tipodoc == TTipo_documento::_altro)
{
const bool daricevere = cache().get("%NUM", _doc->numerazione()).get_bool("B3");
if (daricevere)
tmpstr = "FR";
else if (tipodoc == 2) // fattura
else if (tipodoc == TTipo_documento::_fattura)
{
const int datipodoc = get_tipo_dadoc(*_doc);
if (datipodoc == 1)
if (datipodoc == TTipo_documento::_bolla)
tmpstr = "FB";
else if (datipodoc == 3)
else if (datipodoc == TTipo_documento::_ordine)
tmpstr = "FO";
else
{
const bool daric = get_fdaric_dadoc(*_doc);
if (daric)
tmpstr = "FF";
else
tmpstr = "F";
tmpstr = daric ? "FF" : "F";
}
}
}
@ -698,17 +704,14 @@ void TIni2Sql::validate(const TString& elabfield, TString& str)
{
if (_dadoc != NULL)
{
const int ord_bol = atoi(cache().get("%NUM", _dadoc->numerazione(), "I1"));
const int ord_bol = get_tipo_doc(*_dadoc);
const bool daricevere = cache().get("%NUM", _dadoc->numerazione()).get_bool("B3");
if (((ord_bol == 3 || daricevere) && (code == "_RIFORD")) || ((ord_bol == 1) && (code == "_RIFBOL")))
if (((ord_bol == TTipo_documento::_ordine || daricevere) && (code == "_RIFORD")) || ((ord_bol == TTipo_documento::_bolla) && (code == "_RIFBOL")))
{
str << _dadoc->numerazione() << '-';
str << _dadoc->anno() << '-';
str << _dadoc->numero();
}
if ((ord_bol == 1) && (code == "_RIFORD"))
{
}
}
}
}