Patch level : 12.0 938

Files correlati     : fp0.exe
Commento            : Corretta contabilizzazione per importi a 0: problema scadenzario
This commit is contained in:
Simone Palacino 2020-02-05 18:06:08 +01:00
parent 6ab12f151d
commit e25a49daa7

View File

@ -663,7 +663,8 @@ int TPassive_mask::prepara_contab() const
clean_ini(F1_INIREGCONT);
FOR_EACH_SHEET_ROW(sf, n, row) {
FOR_EACH_SHEET_ROW(sf, n, row)
{
if (row->starts_with("X"))
{
TString prokeys = row->get(sf.cid2index(S_PROKEY));
@ -671,11 +672,11 @@ int TPassive_mask::prepara_contab() const
const TString codcaus(get_codcaus(row->get(cid2index(S_TIPODOCSDI)), row->get(cid2index(S_FORNITORE))));
TString tipodoc(row->get(sf.cid2index(S_TIPODOCSDI)));
if(tipodoc == "TD01" && !check_causale(codcaus, "FA", true))
if(!yesno_box("Attenzione, per un documento di tipo TD01 e' stata selezionata \nuna causale diversa da Fattura d'Acquisto.\nProcedere lo stesso con l'esportazione?"))
if (tipodoc == "TD01" && !check_causale(codcaus, "FA", true))
if (!yesno_box("Attenzione, per un documento di tipo TD01 e' stata selezionata \nuna causale diversa da Fattura d'Acquisto.\nProcedere lo stesso con l'esportazione?"))
continue;
if(tipodoc == "TD04" && !check_causale(codcaus, "NC", true))
if(!yesno_box("Attenzione, per un documento di tipo TD04 e' stata selezionata \nuna causale diversa da Nota Credito di Acquisto.\nProcedere lo stesso con l'esportazione?"))
if (tipodoc == "TD04" && !check_causale(codcaus, "NC", true))
if (!yesno_box("Attenzione, per un documento di tipo TD04 e' stata selezionata \nuna causale diversa da Nota Credito di Acquisto.\nProcedere lo stesso con l'esportazione?"))
continue;
n_sel++;
@ -705,7 +706,7 @@ int TPassive_mask::prepara_contab() const
contab_ini.set("NUMDOCEXT", row->get(sf.cid2index(S_NDOC)));
contab_ini.set("NUMDOC", TString(row->get(sf.cid2index(S_NDOC))).right(7));
TString totdoc = row->get(sf.cid2index(S_TOTDOC));
if(totdoc.empty())
if (totdoc.empty())
{
real imp = calcola_importo(riva);
totdoc.cut(0) << imp;
@ -739,14 +740,21 @@ int TPassive_mask::prepara_contab() const
i++;
}
// Se ci sono le scadenze esporto anche quelle
TString where_q;
TString where_q, query;
/* Se ci sono le scadenze esporto anche quelle
*
* Solo se l'importo non e' nullo: modifica dopo esserci accorti che lo scadenzario in
* questo caso rompeva le scatole per scadenza nulla. In pratica se sporchi le rate non puoi
* salvarle se nulle.
*/
if (real(totdoc) != ZERO)
{
where_q << "WHERE PO_KEYPRGINVIO = '" << keys.get(0) << "'";
where_q << " AND PO_KEYHEADERFATT = '" << keys.get() << "'";
where_q << " AND PO_KEYBODYFATT = '" << keys.get() << "'";
TString query; query << "SELECT PO_RIGA AS RIGA, PO_DATASCADENZA AS DATA, PO_IMPORTO AS IMPORTO \nFROM PAA2500F \n" << where_q;
query << "SELECT PO_RIGA AS RIGA, PO_DATASCADENZA AS DATA, PO_IMPORTO AS IMPORTO \nFROM PAA2500F \n" << where_q;
fp_db().sq_set_exec(query,false);
fp_db().sq_set_exec(query, false);
for (bool ok = fp_db().sq_next(); ok; ok = fp_db().sq_next())
{
const int riga = real(fp_db().sq_get("RIGA")).integer();
@ -756,8 +764,9 @@ int TPassive_mask::prepara_contab() const
contab_ini.set("NRATA", riga);
contab_ini.set("NRIGA", "1");
}
}
if(check_causale(codcaus, "NC", true) && is_tipomov_nc(codcaus))
if (check_causale(codcaus, "NC", true) && is_tipomov_nc(codcaus))
{
contab_ini.set_paragraph(LF_MOV); // Aggiungo i riferimenti al documento se nota credito: GESTISCO DA CG PER IMPOSTARE PARTITE/SCADENZIARIO
where_q.cut(0) << "WHERE PD_KEYPRGINVIO = '" << keys.get(0) << "'";
@ -766,7 +775,7 @@ int TPassive_mask::prepara_contab() const
query.cut(0) << "SELECT PD_RIFNUMLINEA AS NUMLINEA, PD_IDDOC AS DOC, PD_DATADOC AS DATADOC\nFROM PAA1400F\n" << where_q;
fp_db().sq_set_exec(query, false);
bool ok = fp_db().sq_next();
for(int j = 0; ok; ok = fp_db().sq_next(), j++)
for (int j = 0; ok; ok = fp_db().sq_next(), j++)
{
contab_ini.set(TString("NUMLINEA(") << j << ")", fp_db().sq_get("NUMLINEA"));
contab_ini.set(TString("DOC(") << j << ")", fp_db().sq_get("DOC"));
@ -774,7 +783,6 @@ int TPassive_mask::prepara_contab() const
}
}
row->add("", 0);
break; // Chiudo subito tanto se ne può selezionare solo una alla volta
}