Patch level : 12.0 968

Files correlati     : f90.exe d181.des f181.dir f181.trr f9ProspIntegr.rep all-masks build
Commento            :
- Inserita funzione per trovare il movimento collegato (integrazione vendite) se il campo movcoll e' vuoto.
- Implementata funzione generazione prospetto integrazione rev.c. dagli annessi
- Corretta scrittura db annesso prospetto generato.
- Corretta generazione report il recordset veniva distrutto e anche TReport voleva distruggerlo ma non esisteva gia' piu'.
- Corretta esportazione descrizione estrazione.
This commit is contained in:
Simone Palacino 2020-06-17 16:50:35 +02:00
parent 9439dc6a7c
commit 6c6d640642
7 changed files with 101 additions and 90 deletions

View File

@ -246,7 +246,7 @@
<MenCompiler Include="..\src\fp\fpmenu.men" /> <MenCompiler Include="..\src\fp\fpmenu.men" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<RepCompiler Include="..\src\f9\prosp.rep" /> <RepCompiler Include="..\src\f9\f9ProspIntegr.rep" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View File

@ -146,7 +146,7 @@
</MenCompiler> </MenCompiler>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<RepCompiler Include="..\src\f9\prosp.rep"> <RepCompiler Include="..\src\f9\f9ProspIntegr.rep">
<Filter>Rep</Filter> <Filter>Rep</Filter>
</RepCompiler> </RepCompiler>
</ItemGroup> </ItemGroup>

View File

@ -13,7 +13,6 @@
*/ */
class TEstrai_mask : public TMask class TEstrai_mask : public TMask
{ {
TString _descr;
unique_ptr<TEstrazione> _estrazione; // Oggetto estrazione in corso di elaborazione unique_ptr<TEstrazione> _estrazione; // Oggetto estrazione in corso di elaborazione
void enable_fields(bool en = true); void enable_fields(bool en = true);
@ -39,7 +38,6 @@ class TEstrai_mask : public TMask
static bool dataend_handler(TMask_field& f, KEY key); static bool dataend_handler(TMask_field& f, KEY key);
public: public:
TString& get_descr() { return _descr; }
TEstrai_mask(); TEstrai_mask();
}; };

View File

@ -12,18 +12,6 @@
#include "mov.h" #include "mov.h"
#include "anagr.h" #include "anagr.h"
class TReport_prosp : public TReport
{
public:
bool print(TReport_book& book)
{
set_copy(0, 1);
return book.add(*this);
}
TReport_prosp(const char* name) { load(name); }
};
/** /**
* \brief Some test for F9 classes * \brief Some test for F9 classes
*/ */
@ -185,18 +173,19 @@ void TF9_test_app::main_loop()
annesso.obblig = true; annesso.obblig = true;
TEstrazione::make_prosp_int_revc(96951, annesso);*/ TEstrazione::make_prosp_int_revc(96951, annesso);*/
TF9Prospetto_integr prosp;
if(prosp("96951", "96952"))
{ {
TFilename tmp; tmp.tempdir(); TF9Prospetto_integr prosp;
tmp.add(prosp.filename().name()); if (prosp("96951", "96952"))
tmp.ext("pdf"); {
TFilename tmp; tmp.tempdir();
tmp.add(prosp.filename().name());
tmp.ext("pdf");
#ifndef DBG #ifndef DBG
bool exp = prosp.export_pdf(tmp); bool exp = prosp.export_pdf(tmp);
#else #else
bool exp = prosp.preview(); bool exp = prosp.preview();
#endif #endif
}
} }
message_box("TESTS COMPLETELY SUCCESSFUL"); message_box("TESTS COMPLETELY SUCCESSFUL");

View File

@ -10,7 +10,6 @@
#include "mov.h" #include "mov.h"
#include "../fp/fplib.h" #include "../fp/fplib.h"
#include "annessif9.h" #include "annessif9.h"
#include "printer.h"
#define MODE_SHEETS 0xC #define MODE_SHEETS 0xC
@ -101,7 +100,7 @@ bool TEstrazione::check_annessi_oblig(const TString& catdoc, const int numreg, _
else if(ok_cat && annesso.opcee == "RC") else if(ok_cat && annesso.opcee == "RC")
{ {
// Generazione prospetto integrativo. // Generazione prospetto integrativo.
make_prosp_int_revc(numreg, annesso); ok_ann &= make_prosp_int_revc(numreg, annesso);
} }
} }
return ok_ann; return ok_ann;
@ -258,18 +257,45 @@ bool TEstrazione::is_doc_xml(const TLocalisamfile& mov)
bool TEstrazione::is_integr_rev(const int numreg, _Out_ TString& numreg_rev_vend) bool TEstrazione::is_integr_rev(const int numreg, _Out_ TString& numreg_rev_vend)
{ {
TLocalisamfile mov(LF_MOV); TLocalisamfile mov(LF_MOV);
TLocalisamfile mov_rev(LF_MOV); //TLocalisamfile mov_rev(LF_MOV);
mov.put(MOV_NUMREG, numreg); mov.put(MOV_NUMREG, numreg);
mov_rev.put(MOV_NUMREG, numreg + 1); /*mov_rev.put(MOV_NUMREG, numreg + 1);
if(mov.read() == NOERR && mov_rev.read() == NOERR) if(mov.read() == NOERR && mov_rev.read() == NOERR)
{ {
if(mov.get(MOV_DATADOC) == mov_rev.get(MOV_DATADOC) && if(mov.get(MOV_DATADOC) == mov_rev.get(MOV_DATADOC) &&
(mov.get(MOV_NUMDOCEXT).full() && mov_rev.get(MOV_NUMDOCEXT).full() ? (mov.get(MOV_NUMDOCEXT).full() && mov_rev.get(MOV_NUMDOCEXT).full() ?
mov.get(MOV_NUMDOCEXT) == mov_rev.get(MOV_NUMDOCEXT) : mov.get(MOV_NUMDOC) == mov_rev.get(MOV_NUMDOC))) mov.get(MOV_NUMDOCEXT) == mov_rev.get(MOV_NUMDOCEXT) : mov.get(MOV_NUMDOC) == mov_rev.get(MOV_NUMDOC)))
numreg_rev_vend = mov_rev.get(MOV_NUMREG); numreg_rev_vend = mov_rev.get(MOV_NUMREG);
return numreg_rev_vend.full(); if(numreg_rev_vend.full()) return true;
}*/
mov.read();
const TCausale& cau = cached_causale(mov.get(MOV_CODCAUS), mov.get_int(MOV_ANNOES));
const TString4 cau_reg = cau.causale_reg_iva();
TToken_string key(mov.get(MOV_TIPO)); key.add(mov.get_long(MOV_CODCF));
const long codcli = cache().get(LF_CLIFO, key).get_long(CLI_CODCFASS);
TString query("USE ");
query << LF_MOV << " KEY 1 SELECT " << MOV_CODCAUS << "==\"" << cau_reg << "\"\nFROM " << MOV_NUMREG << "==" << numreg;
TISAM_recordset mov_rs(query);
long movcoll = 0L;
for (bool ok = mov_rs.move_first(); ok; ok = mov_rs.move_next())
{
TRectype& curr = (TRectype&)mov_rs.cursor()->curr();
const long movcoll_found = curr.get_long(MOV_MOVCOLL);
if ((curr.get_long(MOV_CODCF) == codcli) && ((movcoll_found == 0L) || (movcoll_found == numreg)))
{
movcoll = mov_rs.get(MOV_NUMREG).as_int();
curr.put(MOV_MOVCOLL, numreg);
TLocalisamfile& f = TLocalisamfile(LF_MOV);
curr.rewrite(f);
break;
}
} }
return false; numreg_rev_vend.cut(0) << movcoll;
return numreg_rev_vend.full();
} }
bool TEstrazione::load_annessi(movimento_t& movimento) bool TEstrazione::load_annessi(movimento_t& movimento)
@ -287,63 +313,61 @@ bool TEstrazione::make_prosp_int_revc(const int numreg, TCategorie_doc::annesso&
TString rev_vend = mov.get(MOV_MOVCOLL); TString rev_vend = mov.get(MOV_MOVCOLL);
if(rev_vend.full() || is_integr_rev(numreg, rev_vend)) if(rev_vend.full() || is_integr_rev(numreg, rev_vend))
{ {
/* todo */ TF9Prospetto_integr prosp;
////////////////// if (prosp(TString(numreg), rev_vend))
// Genero file /// todo
////////////////// todo
// [ NUMREG][ CAT.ANN.].pdf
// [0000000][AAAAAAAAAA].pdf
TFilename fileorig; // Nella temp
fileorig.tempdir().slash_terminate();
fileorig << format("%07d", numreg);
for(int i = 0; i < 10 - annesso.catdoc.len(); ++i)
fileorig << "_";
fileorig << annesso.catdoc << ".pdf";
// Testo che abbia scritto il file
if (!fileorig.exist())
bool simo = true;
// Sposto il file nella cartella dei documenti cartacei.
const TFilename newfile(TF9_doccart::get_full_path_file_cartaceo(fileorig.name()));
if(!newfile.exist())
CopyFile(fileorig, newfile, false);
else
{ {
// Rimpiazzo il file // [ NUMREG][ CAT.ANN.].pdf
DeleteFile(newfile); // [0000000][AAAAAAAAAA].pdf
CopyFile(fileorig, newfile, false); TFilename tmp_file; tmp_file.tempdir();
TString name; name << format("%07d%10s", numreg, (const char*)annesso.catdoc);
name.replace(' ', '_');
tmp_file.add(name);
tmp_file.ext("pdf");
if(prosp.export_pdf(tmp_file))
{
if (!tmp_file.exist())
bool simo = true;
// Sposto il file nella cartella dei documenti cartacei.
const TFilename newfile(TF9_doccart::get_full_path_file_cartaceo(tmp_file.name()));
if (!newfile.exist())
CopyFile(tmp_file, newfile, false);
else
{
// Rimpiazzo il file
DeleteFile(newfile);
CopyFile(tmp_file, newfile, false);
}
// Controllo che non esista gia' altrimenti elimino il record
TF9_doccart doccart;
bool a;
TString numreg_old;
if (doccart.doc_already_exists(newfile, numreg_old, a))
{
TLocalisamfile lf_ann(LF_F9ANNESSI);
lf_ann.setkey(2);
lf_ann.put(F9A_FILENAME, newfile.name());
lf_ann.read();
lf_ann.remove();
lf_ann.zero();
}
// Registro il file come annesso RC
TLocalisamfile lf_ann(LF_F9ANNESSI);
lf_ann.put(F9A_NUMREG, numreg);
lf_ann.put(F9A_FILENAME, newfile.name());
lf_ann.put(F9A_CATDOCPAD, annesso.catdocpadre);
lf_ann.put(F9A_CATDOCANN, annesso.catdoc);
lf_ann.put(F9A_LOADDATE, TDate(TODAY));
lf_ann.put(F9A_USER, user());
bool ok = lf_ann.write() == NOERR;
ok &= lf_ann.rewrite() == NOERR;
if (!ok)
ok = yesno_box("Impossibile creare il prospetto integrativo per la registrazione n. %s.\nContinuare con l'estrazione?", (const char*)numreg);
return ok;
}
} }
// Controllo che non esista gia' altrimenti elimino il record
TF9_doccart doccart;
bool a;
TString numreg_old;
if (doccart.doc_already_exists(newfile, numreg_old, a))
{
TLocalisamfile lf_ann(LF_F9ANNESSI);
lf_ann.put(F9A_FILENAME, newfile.name());
lf_ann.read();
lf_ann.remove();
lf_ann.zero();
}
// Registro il file come annesso RC
TLocalisamfile lf_ann(LF_F9ANNESSI);
lf_ann.put(F9A_NUMREG, numreg);
lf_ann.put(F9A_FILENAME, newfile.name());
lf_ann.put(F9A_CATDOCPAD, annesso.catdocpadre);
lf_ann.put(F9A_CATDOCANN, annesso.catdoc);
lf_ann.put(F9A_LOADDATE, TDate(TODAY));
lf_ann.put(F9A_USER, user());
bool ok = lf_ann.write() == NOERR;
ok &= lf_ann.rewrite() == NOERR;
if(!ok)
return yesno_box("Impossibile creare il prospetto integrativo per la registrazione n. %s.\nContinuare con l'estrazione?", (const char*)numreg);
} }
return false; return false;
} }

View File

@ -543,7 +543,7 @@ public:
class TF9Prospetto_integr class TF9Prospetto_integr
{ {
static constexpr const char* _name = "prosp"; static constexpr const char* _name = "f9ProspIntegr";
TReport_book _book; TReport_book _book;
const TFilename _f_report; const TFilename _f_report;

View File

@ -448,11 +448,11 @@ bool TF9Prospetto_integr::operator()(const char* numreg_acq, const char* numreg_
{ {
if (_rep.load(_f_report)) if (_rep.load(_f_report))
{ {
TFilename fprosp; fprosp.tempdir().slash_terminate() << make_name_rep(); TFilename fprosp; fprosp.tempdir().slash_terminate() << make_name_rep();
TProspetto_recset prosp_rs(numreg_acq, numreg_ven); TProspetto_recset* _prosp_rs = new TProspetto_recset(numreg_acq, numreg_ven);
_items = prosp_rs.items(); _items = _prosp_rs->items();
_rep.set_recordset(&prosp_rs); _rep.set_recordset(&*_prosp_rs);
_book.add(_rep); _book.add(_rep);
} }
else else