cg0100.cpp Invertito ordine di distruzione nella user_destroy

cg0500.cpp     Invertito ordine di distruzione nella user_destroy
cg2102.cpp     Corretta generazione contropartite: Errore MI6332
cgsaldac.*     Aggiunto metodo TPartite_array::items()


git-svn-id: svn://10.65.10.50/trunk@6332 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1998-03-11 11:03:34 +00:00
parent 73807de917
commit 109e0c26bb
5 changed files with 24 additions and 40 deletions

View File

@ -5,7 +5,6 @@
#include "cg0100.h" #include "cg0100.h"
#include <pconti.h> #include <pconti.h>
#include <saldi.h> #include <saldi.h>
#define ATTIVITA 1 #define ATTIVITA 1
@ -385,16 +384,17 @@ HIDDEN bool sottoc_handler(TMask_field& f, KEY key)
bool CG0100_application::user_create() bool CG0100_application::user_create()
{ {
_rel = new TRelation(LF_PCON);
_saldi = new TLocalisamfile(LF_SALDI);
_saldi->setkey(2);
_msk = new TMask("cg0100a") ; _msk = new TMask("cg0100a") ;
_msk->set_handler(FLD_CM1_GRUPPO, gruppo_handler); _msk->set_handler(FLD_CM1_GRUPPO, gruppo_handler);
_msk->set_handler(FLD_CM1_CONTO, conto_handler); _msk->set_handler(FLD_CM1_CONTO, conto_handler);
_msk->set_handler(FLD_CM1_SOTTOCONTO, sottoc_handler); _msk->set_handler(FLD_CM1_SOTTOCONTO, sottoc_handler);
_msk->set_handler(FLD_CM1_TMCF, tmcf_handler); _msk->set_handler(FLD_CM1_TMCF, tmcf_handler);
_rel = new TRelation(LF_PCON);
_saldi = new TLocalisamfile(LF_SALDI);
_saldi->setkey(2);
set_search_field(FH_SOTTOCONTO); set_search_field(FH_SOTTOCONTO);
return TRUE; return TRUE;
} }

View File

@ -854,9 +854,9 @@ bool TCaus_app::user_create()
bool TCaus_app::user_destroy() bool TCaus_app::user_destroy()
{ {
delete _msk; delete _msk;
delete _rel;
delete _rcaus;
delete _rcaus_rec; delete _rcaus_rec;
delete _rcaus;
delete _rel;
return TRUE; return TRUE;
} }

View File

@ -718,11 +718,12 @@ void TPrimanota_application::generazione_righe_cg(int r)
if (can_remove(row)) // Ignora righe senza importo if (can_remove(row)) // Ignora righe senza importo
return; return;
begin_wait(); TWait_cursor hourglass;
TImporto importo; importo = row; TImporto importo; importo = row;
const bool causale_ok = causale().codice()[0] > ' '; const bool causale_ok = causale().codice()[0] > ' ';
// Se la seconda riga e' vuota la genero completamente dalla prima
if (r == 0 && cg.row(1).empty_items()) if (r == 0 && cg.row(1).empty_items())
{ {
TBill contro(row, 9, 0x3); // Contropartita della prima riga TBill contro(row, 9, 0x3); // Contropartita della prima riga
@ -732,12 +733,12 @@ void TPrimanota_application::generazione_righe_cg(int r)
if (contro.ok()) if (contro.ok())
{ {
contro.add_to(row, 9, 0x3); contro.add_to(row, 9, 0x3);
cg.force_update(r); cg.force_update(0);
} }
} }
if (contro.ok()) if (contro.ok())
{ {
importo.swap_section(); importo.swap_section(); // Inverto la sezione D/A
set_cgs_row(1, importo, contro, "", ' '); set_cgs_row(1, importo, contro, "", ' ');
TBill conto(row, 2, 0x3); TBill conto(row, 2, 0x3);
conto.add_to(cg.row(1), 9, 0x3); conto.add_to(cg.row(1), 9, 0x3);
@ -768,8 +769,8 @@ void TPrimanota_application::generazione_righe_cg(int r)
int gruppo = rowi.get_int(3); int gruppo = rowi.get_int(3);
if (gruppo != 0) // Considera righe con conto ... if (gruppo != 0) // Considera righe con conto ...
{ {
gruppo = rowi.get_int(10); long sotto = rowi.get_long(12);
if (gruppo == 0) // ... e senza contropartita if (sotto == 0) // ... e senza contropartita
{ {
char sez = ' '; // Calcola sezione D/A della riga i char sez = ' '; // Calcola sezione D/A della riga i
if (cg.cell_disabled(i,0)) sez = 'A'; else if (cg.cell_disabled(i,0)) sez = 'A'; else
@ -790,8 +791,8 @@ void TPrimanota_application::generazione_righe_cg(int r)
importo.swap_section(); importo.swap_section();
set_cgs_imp(last, importo); set_cgs_imp(last, importo);
const int gruppo = row.get_int(10); const long sotto = row.get_long(12);
if (gruppo == 0) // Se non ho contropartita ... if (sotto == 0) // Se non ho contropartita ...
{ {
TBill contro(cg.row(last), 2, 0x3); // ... copiala dalla riga corrispondente TBill contro(cg.row(last), 2, 0x3); // ... copiala dalla riga corrispondente
contro.add_to(row, 9, 0x3); contro.add_to(row, 9, 0x3);
@ -802,14 +803,14 @@ void TPrimanota_application::generazione_righe_cg(int r)
else else
{ {
TToken_string& first = cg.row(first_not_empty); TToken_string& first = cg.row(first_not_empty);
int gruppo = first.get_int(10); long sotto = first.get_long(12);
if (gruppo == 0) // Se la prima riga non ha contropartita ... if (sotto == 0) // Se la prima riga non ha contropartita ...
{ {
conto.add_to(first, 9, 0x3); // ... copiaci la mia partita conto.add_to(first, 9, 0x3); // ... copiaci la mia partita
cg.force_update(first_not_empty); cg.force_update(first_not_empty);
} }
gruppo = row.get_int(10); sotto = row.get_long(12);
if (gruppo == 0) // Se non ho contropartita ... if (sotto == 0) // Se non ho contropartita ...
{ {
TBill contro(first, 2, 0x3); // ... copiala dalla prima riga TBill contro(first, 2, 0x3); // ... copiala dalla prima riga
contro.add_to(row, 9, 0x3); contro.add_to(row, 9, 0x3);
@ -817,15 +818,13 @@ void TPrimanota_application::generazione_righe_cg(int r)
} }
} }
} }
end_wait();
} }
int TPrimanota_application::crea_somma_spese(TImporto& imp) int TPrimanota_application::crea_somma_spese(TImporto& imp)
{ {
TConto cassa; causale().bill(2, cassa); TConto cassa; causale().bill(2, cassa);
const TString80 desc(causale().desc_agg(2)); const TString desc(causale().desc_agg(2));
imp.swap_section(); imp.normalize(); imp.swap_section(); imp.normalize();
const int r = set_cgs_row(-1, imp, cassa, desc, 'L'); const int r = set_cgs_row(-1, imp, cassa, desc, 'L');
cgs().force_update(); cgs().force_update();
@ -912,7 +911,7 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
{ {
const int k = tipo == 'K' ? 1 : RIGA_SPESE; const int k = tipo == 'K' ? 1 : RIGA_SPESE;
TBill conto; a.causale().bill(k, conto); TBill conto; a.causale().bill(k, conto);
const TString80 desc(a.causale().desc_agg(k)); const TString desc(a.causale().desc_agg(k));
const char sez = a.causale().sezione(k); const char sez = a.causale().sezione(k);
const real imp(cg.mask().get(K_RESIDUO)); const real imp(cg.mask().get(K_RESIDUO));
TImporto importo(sez, imp); TImporto importo(sez, imp);
@ -1048,23 +1047,6 @@ TSheet_field& TPrimanota_application::ivas() const
return s; return s;
} }
/*
TBill& TPrimanota_application::ivas_bill(TBill& c)
{
if (iva() == iva_vendite)
{
const int spric = c.tipo_cr();
if (spric == 2 || spric == 3)
{
const TString& td = causale().tipo_doc();
if (td == "FV" || td == "NC" || td == "ND")
c.tipo_cr(4);
}
}
return c;
}
*/
// Gestione del campo imponibile sullo sheet iva // Gestione del campo imponibile sullo sheet iva
// Certified 90% // Certified 90%
bool TPrimanota_application::imponibile_handler(TMask_field& f, KEY key) bool TPrimanota_application::imponibile_handler(TMask_field& f, KEY key)

View File

@ -1936,6 +1936,7 @@ int TPartite_array::add_numreg(long nreg)
// Uso un cursore per evitare conflitti di lettura con l'oggetta partita // Uso un cursore per evitare conflitti di lettura con l'oggetta partita
TCursor cur(&rel, "", 2, &part, &part); TCursor cur(&rel, "", 2, &part, &part);
cur.freeze();
for (cur = 0; cur.ok(); ++cur) for (cur = 0; cur.ok(); ++cur)
partita(part); // Aggiungi partita se non esiste gia' partita(part); // Aggiungi partita se non esiste gia'

View File

@ -339,6 +339,7 @@ public:
// Cerca la riga della partita relativa alla registrazione numreg // Cerca la riga della partita relativa alla registrazione numreg
TRiga_partite* mov2rig(long numreg, int numrig); TRiga_partite* mov2rig(long numreg, int numrig);
int items() const { return TAssoc_array::items(); }
TPartita* first() { restart(); return next(); } TPartita* first() { restart(); return next(); }
TPartita* next() { return (TPartita*)get(); } TPartita* next() { return (TPartita*)get(); }