Patch level : 12.0 412
Files correlati : Commento : Maschera: - Aggiunti bottone "Esporta" e i restanti da helpbar - Sistemata dimensione maschera per le righe - Aggiunto collegamento prima nota + bottone eliminazione record (non testato) Programma: - Aggiunta gestione righe custom - Sistemato bottone elabora - Aggiunto connessione prima nota - Sistemata stampa e aggiunta tolleranza per i valori degli imponibili - Aggiunto controllo se tolgo il flag di invio per una riga documento, ma non mi ricordo se va git-svn-id: svn://10.65.10.50/branches/R_10_00@23913 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
16e6dfdae1
commit
d723354920
@ -494,6 +494,8 @@ TTrFa_cursors::~TTrFa_cursors()
|
||||
{
|
||||
if(c_rmoviva != NULL)
|
||||
delete c_rmoviva;
|
||||
if(c_trasfatt != NULL)
|
||||
delete c_trasfatt;
|
||||
}
|
||||
|
||||
int TTrFa_cursors::next(TAssoc_array& recimposte, bool& ok, TString& tipocf, TString& codcf)
|
||||
@ -504,8 +506,10 @@ int TTrFa_cursors::next(TAssoc_array& recimposte, bool& ok, TString& tipocf, TSt
|
||||
return_code err;
|
||||
// Record
|
||||
TRectype record = _next(err, tipocf, codcf);
|
||||
if(record.get("NUMREG") == "42094")
|
||||
bool tolla = true;
|
||||
if(err == eof)
|
||||
{
|
||||
record = _nextCust(err, tipocf, codcf);
|
||||
}
|
||||
while(err < nextmov)
|
||||
{
|
||||
// Se ho trovato un record custom o non trovo il suo codiva tra i record custom lo salvo
|
||||
@ -524,9 +528,10 @@ int TTrFa_cursors::next(TAssoc_array& recimposte, bool& ok, TString& tipocf, TSt
|
||||
// Salvo il record nell'array
|
||||
recimposte.add(record.get("CODIVA"), record);
|
||||
}
|
||||
if(err == foundidcust) break;
|
||||
record = _next(err, tipocf, codcf);
|
||||
}
|
||||
ok = err != eof;
|
||||
ok = err != eofcust;
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -611,6 +616,25 @@ TRectype TTrFa_cursors::_next(return_code& code, TString& tipocf, TString& codcf
|
||||
return retRec;
|
||||
}
|
||||
|
||||
TRectype TTrFa_cursors::_nextCust(return_code& code, TString& tipocf, TString& codcf)
|
||||
{
|
||||
bool ok;
|
||||
// Preparo il nuovo cursore
|
||||
if(_newCust)
|
||||
{
|
||||
ok = c_trasfatt->move_first();
|
||||
_newCust = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ok = c_trasfatt->move_next();
|
||||
}
|
||||
tipocf = c_trasfatt->get("TIPO").as_string();
|
||||
codcf = c_trasfatt->get("CODCF").as_string();
|
||||
code = ok ? foundidcust : eofcust;
|
||||
return c_trasfatt->cursor()->curr();
|
||||
}
|
||||
|
||||
/* Utilizzo questa funzione per filtrare al meglio i record, tutti i casi che devo omettere verranno rilevati e ritorneranno false
|
||||
* Nota bene: viene sfruttato un puntatore di TISA_Recordset per non creare nuovi oggetti e velocizzare la chiamata
|
||||
* a questo punto il programma non ha ancora creato un record di $trasfatt con i dati che mi interessano
|
||||
@ -638,11 +662,15 @@ bool TTrFa_cursors::checkRecord(TISAM_recordset* rec)
|
||||
|
||||
int TTrFa_cursors::updateFilters(const char tipocf, const long codcf, TDate dal, TDate al, int cod)
|
||||
{
|
||||
TString query = "USE RMOVIVA\n";
|
||||
TString query = "USE RMOVIVA\n", queryCust = "USE TRASFATT\n";
|
||||
query << "SELECT (23.REG!=\"\")&&BETWEEN(23.DATAREG,#DADATAREG,#ADATAREG)&&(23.TIPO=\"" << tipocf << "\")";
|
||||
queryCust << "SELECT BETWEEN(DATAREG,#DADATAREG,#ADATAREG)&&(TIPO=\"" << tipocf << "\")";
|
||||
|
||||
if(codcf > 0)
|
||||
query<<"&&STR((23.CODCF=#CODCF))";
|
||||
{
|
||||
query << "&&STR((23.CODCF=#CODCF))";
|
||||
queryCust << "&&STR((CODCF=#CODCF))";
|
||||
}
|
||||
/*
|
||||
switch(cod)
|
||||
{
|
||||
@ -658,22 +686,31 @@ int TTrFa_cursors::updateFilters(const char tipocf, const long codcf, TDate dal,
|
||||
*/
|
||||
|
||||
query << "\nJOIN MOV INTO NUMREG==NUMREG\n";
|
||||
c_rmoviva = new TISAM_recordset(query);
|
||||
queryCust << "\nFROM NUMREG=" << MOV_CUSTOM;
|
||||
|
||||
c_rmoviva = new TISAM_recordset(query);
|
||||
c_trasfatt= new TISAM_recordset(queryCust);
|
||||
|
||||
if(dal.empty()) dal = "20170101"; // Data in cui questo modulo è diventato valido
|
||||
if(al.empty()) al = TODAY;
|
||||
|
||||
c_rmoviva->set_var("#DADATAREG", dal);
|
||||
c_rmoviva->set_var("#ADATAREG", al);
|
||||
c_trasfatt->set_var("#DADATAREG", dal);
|
||||
c_trasfatt->set_var("#ADATAREG", al);
|
||||
|
||||
if(codcf > 0)
|
||||
{
|
||||
c_rmoviva->set_var("#CODCF", codcf);
|
||||
c_trasfatt->set_var("#CODCF", codcf);
|
||||
}
|
||||
|
||||
|
||||
if(c_rmoviva->items() > ZERO)
|
||||
int items = c_rmoviva->items() + c_trasfatt->items();
|
||||
if(items > 0)
|
||||
{
|
||||
_newMov = true;
|
||||
return c_rmoviva->items();
|
||||
_newCust = true;
|
||||
return items;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@ -746,7 +783,11 @@ bool TTrFa_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
TToken_string& row = s.row(jolly);
|
||||
const TRecnotype progr = row.get_long(0);
|
||||
return progr >= MOV_CUSTOM;
|
||||
}
|
||||
} else
|
||||
if(e == se_enter)
|
||||
{
|
||||
//primaNota(o,e);
|
||||
}
|
||||
break;
|
||||
case A_DATAREG:
|
||||
{
|
||||
@ -891,6 +932,53 @@ bool TTrFa_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DLG_RECALC:
|
||||
if(e == fe_button)
|
||||
next_page(1);
|
||||
break;
|
||||
case DLG_USER:
|
||||
if (e == fe_button || e == fe_init)
|
||||
{
|
||||
const long numreg = o.mask().get_long(A_NUMERO);
|
||||
const bool enab = (numreg > 0) && (numreg < MOV_CUSTOM);
|
||||
if (e == fe_button && enab)
|
||||
{
|
||||
o.disable(); // Tecnica anti doppio click!
|
||||
TRectype mov(LF_MOV);
|
||||
mov.put(MOV_NUMREG, numreg);
|
||||
mov.edit();
|
||||
o.enable();
|
||||
}
|
||||
else
|
||||
o.enable(enab);
|
||||
}
|
||||
break;
|
||||
case DLG_DELREC:
|
||||
if (e == fe_button && o.active())
|
||||
{
|
||||
const long progr = o.mask().get_long(A_NUMERO);
|
||||
TString codalq = o.mask().get(A_ALIQUOTA);
|
||||
TString key; key << progr << "|" << codalq;
|
||||
if (progr >= MOV_CUSTOM)
|
||||
{
|
||||
if(cache().get(LF_TRASFATT, key).full())
|
||||
{
|
||||
TLocalisamfile trasfat(LF_TRASFATT);
|
||||
trasfat.put("NUMREG", progr);
|
||||
trasfat.put("CODIVA", codalq);
|
||||
const int err = trasfat.remove();
|
||||
if (err != NOERR)
|
||||
return error_box(FR("Errore di cancellazione: %d"), err);
|
||||
}
|
||||
// In qualsiasi caso elimino sta riga
|
||||
TSheet_field& s = o.mask().sfield(F_RIGHE);
|
||||
TToken_string& row = s.row(jolly);
|
||||
row.destroy(jolly);
|
||||
}
|
||||
else
|
||||
return error_box(TR("Riga non cancellabile"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -900,7 +988,13 @@ bool TTrFa_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
if (id >= START_SHEET && id < END_SHEET && id != A_FORZATA)
|
||||
{
|
||||
o.mask().set(A_FORZATA, true);
|
||||
// Se ho modificato l'impostazione dell'invio non va segnata la modifica MA devo togliere o mettere il flag a tutti quelli con movimento uguale
|
||||
if(id != A_INVIO)
|
||||
o.mask().set(A_FORZATA, true);
|
||||
else
|
||||
{
|
||||
changeInvio(o.mask().get(A_TIPOCF), o.mask().get(A_CODCF), o.mask().get(A_NUMDOC), o.mask().get(A_INVIO));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (e == fe_modify && jolly == 0)
|
||||
@ -914,6 +1008,7 @@ bool TTrFa_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void TTrFa_mask::loadConfig()
|
||||
{
|
||||
// Rilevo i tipi scelti
|
||||
@ -994,11 +1089,15 @@ bool TTrFa_mask::checkAll()
|
||||
stampa.setheaderline(2, riga);
|
||||
riga.reset();
|
||||
stampa.setheaderline(4, riga);
|
||||
stampa.print(riga);
|
||||
TSheet_field& sheet = sfield(F_RIGHE);
|
||||
FOR_EACH_SHEET_ROW(sheet, r, strarr)
|
||||
{
|
||||
checkRec(&stampa, *strarr);
|
||||
}
|
||||
riga.reset();
|
||||
riga.put(TR("------------------ Fine controllo! ------------------"), 30);
|
||||
stampa.print(riga);
|
||||
stampa.close();
|
||||
return true;
|
||||
}
|
||||
@ -1042,9 +1141,9 @@ bool TTrFa_mask::checkRec(TPrinter* stampa, TToken_string rec)
|
||||
|
||||
real realImp = imponibile * codiva.percentuale() / CENTO;
|
||||
realImp.round(2);
|
||||
if(imposta != realImp)
|
||||
if(imposta > realImp + TOLLARANZA || imposta < realImp - TOLLARANZA)
|
||||
{
|
||||
msgerr.cut(0) << "Imposta errata, valore dichiarato: " << imposta.string() << " valore corretto: " << realImp.string();
|
||||
msgerr.cut(0) << "Imposta errata, valore dichiarato: " << imposta.string() << " valore \"potenzialmente\" corretto: " << realImp.string();
|
||||
printError(stampa, numMov, numDoc, msgerr);
|
||||
coderr << "3;";
|
||||
}
|
||||
@ -1092,6 +1191,24 @@ TRecnotype TTrFa_mask::nuovo_progr() const
|
||||
return numreg;
|
||||
}
|
||||
|
||||
// Dato un cliente e il suo numero documento imposto il nuovo flag di invio su tutti i campi
|
||||
void TTrFa_mask::changeInvio(TString tipocf, TString codcf, TString numdoc, TString invio) const
|
||||
{
|
||||
TSheet_field& sheet = sfield(F_RIGHE);
|
||||
TString rtipo, rcod, rnum;
|
||||
FOR_EACH_SHEET_ROW(sheet, r, strarr)
|
||||
{
|
||||
// Ricevo i parametri della riga
|
||||
rtipo.cut(0); rtipo << strarr->get_char(_tipocf);
|
||||
rcod.cut(0); rcod << strarr->get_int(_codcf);
|
||||
rnum.cut(0); rnum << strarr->get(_numdoc);
|
||||
if(tipocf == rtipo && codcf == rcod && rnum == numdoc)
|
||||
{
|
||||
strarr->add(invio, _invio);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TTrFa_mask::load_sheet()
|
||||
{
|
||||
const char tipo = get(F_TIPOCF)[0];
|
||||
|
@ -18,7 +18,7 @@
|
||||
#define B_TIPO_BOLLADOG 413
|
||||
#define B_TIPO_STORDOC 414
|
||||
|
||||
#define END_BOOLEAN 413
|
||||
#define END_BOOLEAN 414
|
||||
|
||||
#define END_MASK 421
|
||||
|
||||
|
@ -25,7 +25,13 @@ BEGIN
|
||||
PICTURE TOOL_EXCEL
|
||||
END
|
||||
|
||||
#include <elabar.h>
|
||||
BUTTON DLG_OK 2 2
|
||||
BEGIN
|
||||
PROMPT 1 1 "Esporta"
|
||||
PICTURE TOOL_ELABORA
|
||||
END
|
||||
|
||||
#include <helpbar.h>
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Impostazioni" 0 2 0 0
|
||||
@ -176,7 +182,7 @@ ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
PAGE "Riga" -1 -1 -1 -1
|
||||
PAGE "Riga" -1 -1 69 14
|
||||
|
||||
BOOLEAN A_SPEDITA
|
||||
BEGIN
|
||||
@ -356,7 +362,6 @@ BEGIN
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
|
||||
CURRENCY A_IMPONIBILE 12
|
||||
BEGIN
|
||||
PROMPT 42 8 "Imponibile"
|
||||
@ -397,7 +402,7 @@ END
|
||||
|
||||
STRING A_CODERR 10
|
||||
BEGIN
|
||||
PROMPT -1 -1 "Codice Fiscale"
|
||||
PROMPT 0 13 "Codici errori"
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
@ -410,6 +415,18 @@ BEGIN
|
||||
PROMPT 1 1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_USER 2 2
|
||||
BEGIN
|
||||
PROMPT 2 1 "Collega"
|
||||
PICTURE TOOL_LINK
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 2 2
|
||||
BEGIN
|
||||
PROMPT 2 1 "Elimina"
|
||||
PICTURE TOOL_DELREC
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 2 2
|
||||
BEGIN
|
||||
PROMPT 4 1 ""
|
||||
|
@ -26,9 +26,10 @@ enum return_code
|
||||
{
|
||||
found, // Trovato
|
||||
foundcust, // Trovato in trasfatt
|
||||
foundidcust,// Trovato ma con id customizzato
|
||||
nextmov, // Trovato ma cambiato movimento
|
||||
eof, // EOF rmoviva
|
||||
eofm, // EOF mov
|
||||
eofcust, // EOF trasfatt
|
||||
after // File mov su un movimento dopo rispetto a rmoviva
|
||||
};
|
||||
|
||||
@ -43,6 +44,7 @@ enum filter_fatt
|
||||
#define SHEET_GAP 101
|
||||
#define DTE_PROVV "DTE0000001"
|
||||
#define DTR_PROVV "DTR0000001"
|
||||
#define TOLLARANZA 0.05
|
||||
|
||||
/* Così facendo basta modificare la maschera (e le dichiarazioni di conseguenza)
|
||||
* per avere l'inserimento nello sheet corretto */
|
||||
@ -145,13 +147,16 @@ class TTrFa_cursors : TObject
|
||||
{
|
||||
friend class TCursor;
|
||||
TISAM_recordset* c_rmoviva;
|
||||
TISAM_recordset* c_trasfatt;
|
||||
filter_fatt filFat;
|
||||
bool _newMov;
|
||||
bool _newCust;
|
||||
// Se trovo un record custom devo saltare tutti quelli che trovo successivamente, per fare ciò utilizzo una TToken_string
|
||||
TToken_string _alqCust;
|
||||
|
||||
bool filOk(bool alreadySent) { return (filFat == all) || (filFat == sent && alreadySent) || (filFat == toSend && !alreadySent); }
|
||||
TRectype _next(return_code& code, TString& tipocf, TString& codcf); // Si sposta avanti di un elemento
|
||||
TRectype _nextCust(return_code& code, TString& tipocf, TString& codcf); // Si sposta avanti di un elemento tra quelli custom
|
||||
bool checkRecord(TISAM_recordset* rec);
|
||||
public:
|
||||
TTrFa_cursors() : filFat(all) {};
|
||||
@ -184,7 +189,7 @@ protected:
|
||||
TString revCharge(TString numreg) const;
|
||||
TString getRFSO(TString codrfso) const;
|
||||
TRecnotype nuovo_progr() const;
|
||||
|
||||
void changeInvio(TString tipocf, TString codcf, TString numdoc, TString invio) const;
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user