diff --git a/or/orlib01.cpp b/or/orlib01.cpp index 0458b58dd..f96316dae 100755 --- a/or/orlib01.cpp +++ b/or/orlib01.cpp @@ -337,89 +337,72 @@ bool TOrdine_form::validate(TForm_item &cf, TToken_string &s) } // Ignore any other command } - } else + } + else if (action == "PREZZONS") { real pns = rdoc.prezzo(TRUE,FALSE); // Prezzo netto scontato cf.set(pns.string()); - } else - if (action == "RAGSOC") - { - // Compone la ragione sociale (considera gli occasionali) - // Il formato è il seguente: CODICE (OCFPI) RAGIONE_SOCIALE - TString ws; - const bool print_cod = s.get_int(2); - TDocumento& documento = (TDocumento&)cf.form().cursor()->curr(LF_DOC); - TCli_for& cli_for = documento.clifor(); - TOccasionale& cli_occ = documento.occas(); - const bool occasionale = cli_for.occasionale(); - if (print_cod) - ws << cli_for.get("CODCF") << " "; - if (occasionale) - { - ws << "(" << cli_occ.get("CFPI") << ") " ; - ws << cli_occ.get("RAGSOC"); - } - else - if (action == "RAGSOC") - { - // Compone la ragione sociale (considera gli occasionali) - // Il formato è il seguente: CODICE (OCFPI) RAGIONE_SOCIALE - TString ws; - const bool print_cod = s.get_int(2)!=0; - TDocumento& documento = (TDocumento&)cf.form().cursor()->file(LF_DOC).curr(); - TCli_for& cli_for = documento.clifor(); - TOccasionale& cli_occ = documento.occas(); - const bool occasionale = cli_for.occasionale(); - if (print_cod) - ws << cli_for.get("CODCF") << " "; - if (occasionale) - { - ws << "(" << cli_occ.get("CFPI") << ") " ; - ws << cli_occ.get("RAGSOC"); - } - else - ws << cli_for.get("RAGSOC"); - cf.set(ws); + } + else + if (action == "RAGSOC") + { + // Compone la ragione sociale (considera gli occasionali) + // Il formato è il seguente: CODICE (OCFPI) RAGIONE_SOCIALE + TString ws; + const bool print_cod = s.get_int(2) != 0; + TDocumento& documento = (TDocumento&)cf.form().cursor()->curr(LF_DOC); + TCli_for& cli_for = documento.clifor(); + TOccasionale& cli_occ = documento.occas(); + const bool occasionale = cli_for.occasionale(); + if (print_cod) + ws << cli_for.get("CODCF") << " "; + if (occasionale) + { + ws << "(" << cli_occ.get("CFPI") << ") " ; + ws << cli_occ.get("RAGSOC"); } else - if (action == "QTA") - { - cf.set(rdoc.quantita().string()); - } else - if (action == "QTAEVASA") - { - cf.set(rdoc.qtaevasa().string()); - } else - if (action == "RESIDUO") - { - cf.set(rdoc.qtaresidua().string()); - } else - if (action == "VALORE") - { - cf.set(rdoc.valore(TRUE, AUTO_DECIMALS).string()); - } else - if (action == "VALRES") - { - cf.set(rdoc.valore(FALSE, AUTO_DECIMALS).string()); - } else - if (action == "GIACENZA") - { - real g = ZERO; - const TString& codart = rdoc.get(RDOC_CODARTMAG); - if (codart.not_empty() && _art_giac->read(codart) == NOERR) - { - const TDate oggi(TODAY); - TString16 annoes; annoes.format("%04d", _esercizi->date2esc(oggi)); - const TString16 codmag(rdoc.get("CODMAG")); // Riferito al magazzino indicato sulla riga... - const TString16 livello(_level > 0 ? rdoc.get(RDOC_LIVELLO) : ""); - g = _art_giac->disponibilita(annoes, codmag, livello, TRUE); // Giacenza attuale - } - cf.set(g.string()); + ws << cli_for.get("RAGSOC"); + cf.set(ws); + } + else + if (action == "QTA") + { + cf.set(rdoc.quantita().string()); + } else + if (action == "QTAEVASA") + { + cf.set(rdoc.qtaevasa().string()); + } else + if (action == "RESIDUO") + { + cf.set(rdoc.qtaresidua().string()); + } else + if (action == "VALORE") + { + cf.set(rdoc.valore(TRUE, AUTO_DECIMALS).string()); + } else + if (action == "VALRES") + { + cf.set(rdoc.valore(FALSE, AUTO_DECIMALS).string()); + } else + if (action == "GIACENZA") + { + real g = ZERO; + const TString& codart = rdoc.get(RDOC_CODARTMAG); + if (codart.not_empty() && _art_giac->read(codart) == NOERR) + { + const TDate oggi(TODAY); + TString16 annoes; annoes.format("%04d", _esercizi->date2esc(oggi)); + const TString16 codmag(rdoc.get("CODMAG")); // Riferito al magazzino indicato sulla riga... + const TString16 livello(_level > 0 ? rdoc.get(RDOC_LIVELLO) : ""); + g = _art_giac->disponibilita(annoes, codmag, livello, TRUE); // Giacenza attuale } - + cf.set(g.string()); + } //Ignore any other command - return TRUE; + return TRUE; } return TForm::validate(cf, s); -} \ No newline at end of file +}