Patch level : 12.0 no patch
Files correlati : Commento : Major Aggiunta gestione di più ordini da importare nello stesso xml
This commit is contained in:
parent
2ef449d9cd
commit
014a99411e
@ -209,69 +209,74 @@ bool TFlexform_xml_ordini::create_doc()
|
||||
if (import_doc())
|
||||
{
|
||||
TLog_report * log = _log;
|
||||
const TXmlItem * first = FindFirstChild("ORDINE_IMPEGNO");
|
||||
long id_ordine;
|
||||
//const TXmlItem * first = FindFirstChild("ORDINE_IMPEGNO");
|
||||
int n = 0;
|
||||
|
||||
if (first != nullptr)
|
||||
for (TXmlItem * ord = GetChild(n); ord != nullptr; ord = GetChild(++n))
|
||||
{
|
||||
if (first->GetAttr("TipoOperazione") != "Insert")
|
||||
XML_ERROR(TR("il Tipo Operazione deve essere Insert."));
|
||||
long id_ordine;
|
||||
|
||||
const TXmlItem * ordine = first->FindFirstChild("OR_ORDINIT");
|
||||
|
||||
if (ordine != nullptr)
|
||||
if (ord->GetTag() == "ORDINE_IMPEGNO")
|
||||
{
|
||||
const TXmlItem * testata = ordine->FindFirstChild("datarow");
|
||||
if (ord->GetAttr("TipoOperazione") != "Insert")
|
||||
XML_ERROR(TR("il Tipo Operazione deve essere Insert."));
|
||||
|
||||
if (testata->GetEnclosedLong("des_num_esterno", id_ordine))
|
||||
const TXmlItem * ordine = ord->FindFirstChild("OR_ORDINIT");
|
||||
|
||||
if (ordine != nullptr)
|
||||
{
|
||||
TDate dat_doc_esterno;
|
||||
TDate dat_evasione;
|
||||
const TXmlItem * testata = ordine->FindFirstChild("datarow");
|
||||
|
||||
if (!testata->GetEnclosedDate("dat_doc_esterno", dat_doc_esterno))
|
||||
XML_TAG_NOT_FOUND(id_ordine, 0, "N.ro ordine");
|
||||
if (!testata->GetEnclosedDate("dat_evasione", dat_evasione))
|
||||
XML_TAG_NOT_FOUND(id_ordine, 0, "N.ro ordine");
|
||||
// "sig_serie_esterno"
|
||||
TDocumento doc('D', dat_doc_esterno.year(), _codnum, -1);
|
||||
TString msg(TR("Importazione documento ")); msg << id_ordine;
|
||||
|
||||
XML_MSG(msg);
|
||||
doc.put(DOC_TIPODOC, _codnum);
|
||||
doc.put(DOC_STATO, "2");
|
||||
doc.put(DOC_DATADOC, dat_doc_esterno);
|
||||
doc.put(DOC_TIPOCF, "C");
|
||||
doc.put(DOC_CODCF, _codcli_flex);
|
||||
doc.put(DOC_DATACONS, dat_evasione);
|
||||
|
||||
const int nrow = ordine->GetChildren();
|
||||
|
||||
for (int i = 1; i < nrow; i++)
|
||||
if (testata->GetEnclosedLong("des_num_esterno", id_ordine))
|
||||
{
|
||||
const TXmlItem * row = ordine->GetChild(i);
|
||||
TDate dat_doc_esterno;
|
||||
TDate dat_evasione;
|
||||
|
||||
if (row->GetTag() == "OR_ORDINIR")
|
||||
if (!testata->GetEnclosedDate("dat_doc_esterno", dat_doc_esterno))
|
||||
XML_TAG_NOT_FOUND(id_ordine, 0, "N.ro ordine");
|
||||
if (!testata->GetEnclosedDate("dat_evasione", dat_evasione))
|
||||
XML_TAG_NOT_FOUND(id_ordine, 0, "N.ro ordine");
|
||||
// "sig_serie_esterno"
|
||||
TDocumento doc('D', dat_doc_esterno.year(), _codnum, -1);
|
||||
TString msg(TR("Importazione documento ")); msg << id_ordine;
|
||||
|
||||
XML_MSG(msg);
|
||||
doc.put(DOC_TIPODOC, _codnum);
|
||||
doc.put(DOC_STATO, "2");
|
||||
doc.put(DOC_DATADOC, dat_doc_esterno);
|
||||
doc.put(DOC_TIPOCF, "C");
|
||||
doc.put(DOC_CODCF, _codcli_flex);
|
||||
doc.put(DOC_DATACONS, dat_evasione);
|
||||
|
||||
const int nrow = ordine->GetChildren();
|
||||
|
||||
for (int i = 1; i < nrow; i++)
|
||||
{
|
||||
const TXmlItem * data = row->FindFirstChild("datarow");
|
||||
const TXmlItem * row = ordine->GetChild(i);
|
||||
|
||||
if (data != nullptr)
|
||||
add_row(id_ordine, i, doc, data, log);
|
||||
if (row->GetTag() == "OR_ORDINIR")
|
||||
{
|
||||
const TXmlItem * data = row->FindFirstChild("datarow");
|
||||
|
||||
if (data != nullptr)
|
||||
add_row(id_ordine, i, doc, data, log);
|
||||
else
|
||||
XML_ROW_NOT_FOUND(id_ordine, i);
|
||||
}
|
||||
else
|
||||
XML_ROW_NOT_FOUND(id_ordine, i);
|
||||
}
|
||||
else
|
||||
XML_ROW_NOT_FOUND(id_ordine, i);
|
||||
ok = doc.write() == NOERR;
|
||||
}
|
||||
ok = doc.write() == NOERR;
|
||||
else
|
||||
XML_TAG_NOT_FOUND(id_ordine, 0, "N.ro ordine");
|
||||
}
|
||||
else
|
||||
XML_TAG_NOT_FOUND(id_ordine, 0, "N.ro ordine");
|
||||
XML_NOT_FOUND("Testata");
|
||||
}
|
||||
else
|
||||
XML_NOT_FOUND("Testata");
|
||||
XML_NOT_FOUND("ORDINE_IMPEGNO");
|
||||
}
|
||||
else
|
||||
XML_NOT_FOUND("ORDINE_IMPEGNO");
|
||||
}
|
||||
return ok;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user