Generazione automatizzata delle righe contabili nei movimenti senza IVA
git-svn-id: svn://10.65.10.50/trunk@586 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
8deee683b0
commit
4dcf5f74ad
@ -624,14 +624,13 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
||||
TRectype &r = _rel->cg(i);
|
||||
r.zero();
|
||||
|
||||
r.put("IMPORTO", n.valore()); // Importo
|
||||
r.put("NUMREG", numreg); // Numero registrazione
|
||||
r.put("ANNOES", annoes); // Anno esercizio
|
||||
r.put("DATAREG", datareg); // Data di registrazione
|
||||
r.put("NUMRIG", i+1); // Numero riga
|
||||
|
||||
r.put("SEZIONE", n.sezione()); // Sezione
|
||||
|
||||
r.put("NUMREG", numreg);
|
||||
r.put("ANNOES", annoes);
|
||||
r.put("DATAREG", datareg);
|
||||
r.put("NUMRIG", i+1);
|
||||
|
||||
r.put("IMPORTO", n.valore()); // Importo
|
||||
put_conto(r, conto); // Conto
|
||||
|
||||
row.get(); // Codice descrizione
|
||||
@ -689,6 +688,7 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
||||
if (err) _rel->lfile().zero("OCFPI");
|
||||
}
|
||||
|
||||
const bool intra = causale().intra();
|
||||
const bool to_swap = test_swap(FALSE);
|
||||
if (to_swap)
|
||||
{
|
||||
@ -708,6 +708,7 @@ void TPrimanota_application::mask2rel(const TMask& m)
|
||||
r.zero();
|
||||
r.put("ANNOES", annoes);
|
||||
r.put("NUMREG", numreg);
|
||||
r.put("INTRA", intra); // Causale intra
|
||||
r.put("NUMRIG", i+1);
|
||||
|
||||
real imponibile(row.get(0));
|
||||
|
104
cg/cg2102.cpp
104
cg/cg2102.cpp
@ -487,45 +487,111 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
|
||||
}
|
||||
|
||||
|
||||
bool TPrimanota_application::cg_notify(int r, KEY k)
|
||||
void TPrimanota_application::generazione_righe_cg(int r)
|
||||
{
|
||||
TSheet_field& cg = app().cgs();
|
||||
TSheet_field& cg = cgs();
|
||||
TToken_string& row = cg.row(r);
|
||||
const char tipo = row.empty() ? ' ' : row.right(1)[0];
|
||||
|
||||
switch(k)
|
||||
{
|
||||
case K_SPACE:
|
||||
cg.sheet_mask().enable(DLG_DELREC, tipo == ' ');
|
||||
break;
|
||||
case K_ENTER:
|
||||
if (r == 0 && app().iva() == nessuna_iva && cg.row(1).empty_items())
|
||||
{
|
||||
TImporto i; i = row;
|
||||
if (!i.is_zero())
|
||||
TImporto importo; importo = row;
|
||||
|
||||
if (importo.is_zero())
|
||||
return;
|
||||
|
||||
if (r == 0 && cg.row(1).empty_items())
|
||||
{
|
||||
TBill contro(row, 9, 0x3);
|
||||
if (!contro.ok() && *app().causale().codice() > ' ')
|
||||
if (!contro.ok())
|
||||
{
|
||||
app().causale().bill(2, contro);
|
||||
causale().bill(2, contro);
|
||||
contro.add_to(row, 9, 0x3);
|
||||
cg.force_update(r);
|
||||
}
|
||||
if (contro.ok())
|
||||
{
|
||||
i.swap_section();
|
||||
app().set_cgs_row(1, i, contro, "", ' ');
|
||||
importo.swap_section();
|
||||
set_cgs_row(1, importo, contro, "", ' ');
|
||||
TBill conto(row, 2, 0x3);
|
||||
conto.add_to(cg.row(1), 9, 0x3);
|
||||
app().cgs().force_update(1);
|
||||
cg.force_update(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (causale().codice()[0] > ' ')
|
||||
{
|
||||
int first_not_empty = 0;
|
||||
for (int i = 0; i < r; i++)
|
||||
{
|
||||
TImporto im; im = cg.row(i);
|
||||
if (!im.is_zero())
|
||||
{
|
||||
first_not_empty = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TBill conto(row, 2, 0x3);
|
||||
if (first_not_empty == r)
|
||||
{
|
||||
for (i = r+1; i < cg.items(); i++)
|
||||
{
|
||||
TToken_string& rowi = cg.row(i);
|
||||
int gruppo = rowi.get_int(3);
|
||||
if (gruppo != 0)
|
||||
{
|
||||
gruppo = rowi.get_int(10);
|
||||
if (gruppo == 0)
|
||||
{
|
||||
char sez = 'D';
|
||||
if (cg.cell_disabled(i,0)) sez = 'A';
|
||||
if (importo.sezione() != sez)
|
||||
{
|
||||
conto.add_to(rowi, 9, 0x3);
|
||||
cg.force_update(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TToken_string& rowi = cg.row(first_not_empty);
|
||||
const int gruppo = rowi.get_int(10);
|
||||
if (gruppo == 0)
|
||||
{
|
||||
conto.add_to(rowi, 9, 0x3);
|
||||
cg.force_update(first_not_empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool TPrimanota_application::cg_notify(int r, KEY k)
|
||||
{
|
||||
switch(k)
|
||||
{
|
||||
case K_SPACE:
|
||||
{
|
||||
TSheet_field& cg = app().cgs();
|
||||
TToken_string& row = cg.row(r);
|
||||
const char tipo = row.right(1)[0];
|
||||
cg.sheet_mask().enable(DLG_DELREC, tipo <= ' ');
|
||||
}
|
||||
break;
|
||||
case K_ENTER:
|
||||
if (app().iva() == nessuna_iva)
|
||||
app().generazione_righe_cg(r);
|
||||
app().calcola_saldo();
|
||||
break;
|
||||
case K_DEL:
|
||||
if (tipo != ' ')
|
||||
{
|
||||
TToken_string& row = app().cgs().row(r);
|
||||
const char tipo = row.right(1)[0];
|
||||
if (tipo > ' ')
|
||||
return error_box("La riga %d non puo' essere cancellata", r+1);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -165,6 +165,7 @@ protected:
|
||||
void disable_cgs_cells(int n, char tipo);
|
||||
void add_cgs_tot(TMask& m);
|
||||
void add_cgs_rit(bool fisc);
|
||||
void generazione_righe_cg(int r);
|
||||
|
||||
void* get_app_data() { return _app_data; }
|
||||
void set_app_data(void* v) { _app_data = v; }
|
||||
|
@ -145,7 +145,7 @@ bool TRegistro::read_att()
|
||||
return TRUE;
|
||||
|
||||
TLocalisamfile attiv(LF_ATTIV);
|
||||
attiv.put("CODDITTA", MainApp()->get_firm());
|
||||
attiv.put("CODDITTA", main_app().get_firm());
|
||||
attiv.put("CODATT", attivita());
|
||||
const int err = attiv.read();
|
||||
_att = attiv.curr();
|
||||
|
@ -19,7 +19,7 @@ struct shuttle
|
||||
bool TPrimanota_application::pag_notify(int r, KEY k)
|
||||
{
|
||||
// questo e' il bello
|
||||
shuttle* sh = (shuttle*)(((TPrimanota_application*)MainApp())->get_app_data());
|
||||
shuttle* sh = (shuttle*)(((TPrimanota_application&)main_app()).get_app_data());
|
||||
|
||||
Pagamento* pag = sh->_pag;
|
||||
TSheet_field* ps = sh->_sheet;
|
||||
|
Loading…
x
Reference in New Issue
Block a user