Corretto calcolo prorata escludendo i beni ammortizzabili
git-svn-id: svn://10.65.10.50/branches/R_10_00@22992 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
f49be2e4f1
commit
cabf66ad4e
160
cg/cg1307.cpp
160
cg/cg1307.cpp
@ -4,7 +4,10 @@
|
||||
#include <prefix.h>
|
||||
#include <progind.h>
|
||||
#include <recarray.h>
|
||||
#include <relation.h>
|
||||
#include <recset.h>
|
||||
#include <sheet.h>
|
||||
#include <urldefid.h>
|
||||
|
||||
#include "cgsaldac.h"
|
||||
|
||||
@ -15,18 +18,8 @@
|
||||
#include <rmov.h>
|
||||
#include <rmoviva.h>
|
||||
|
||||
#ifndef FOR_EACH_FILE_RECORD
|
||||
|
||||
#define FOR_EACH_FILE_RECORD(isamfile) \
|
||||
for (int _e##isamfile = isamfile.first(); \
|
||||
_e##isamfile == NOERR; \
|
||||
_e##isamfile = isamfile.next())
|
||||
|
||||
#endif
|
||||
|
||||
class TElimina_zoppi : public TSkeleton_application
|
||||
{
|
||||
// TArray _files;
|
||||
TArray _decoders;
|
||||
|
||||
protected:
|
||||
@ -40,11 +33,11 @@ protected:
|
||||
static int kill_row(long numreg, char tipor, int numrig);
|
||||
|
||||
static bool firm_handler(TMask_field& f, KEY k);
|
||||
static bool select_handler(TMask_field& f, KEY k);
|
||||
|
||||
public:
|
||||
const char* app_name() const {return TR("Righe prima nota errate");}
|
||||
const char* decode(int num, const char* key, const char* field);
|
||||
const char* decode(int num, long key, const char* field);
|
||||
virtual void main_loop();
|
||||
};
|
||||
|
||||
@ -56,22 +49,14 @@ bool TElimina_zoppi::firm_handler(TMask_field& f, KEY k)
|
||||
if (k == K_F9)
|
||||
{
|
||||
TArray_sheet sheet(-1, -1, 70, 20, TR("Scelta ditta"), HR("Codice|Ragione Sociale@50"));
|
||||
TToken_string row;
|
||||
TLocalisamfile ditte(LF_NDITTE);
|
||||
|
||||
FOR_EACH_FILE_RECORD(ditte)
|
||||
TString_array& rows = sheet.rows_array();
|
||||
prefix().firms(rows);
|
||||
FOR_EACH_ARRAY_ROW(rows, r, row)
|
||||
{
|
||||
const long cod = ditte.get_long(NDT_CODDITTA);
|
||||
if (prefix().exist(cod))
|
||||
{
|
||||
row.cut(0);
|
||||
row.add(cod);
|
||||
row.add(ditte.get(NDT_RAGSOC));
|
||||
|
||||
const long pos = sheet.add(row);
|
||||
if (cod == prefix().get_codditta())
|
||||
sheet.select(pos);
|
||||
}
|
||||
const long cod = row->get_long(0);
|
||||
row->add(app().decode(LF_NDITTE, cod, NDT_RAGSOC));
|
||||
if (cod == prefix().get_codditta())
|
||||
sheet.select(r);
|
||||
}
|
||||
if (sheet.run() == K_ENTER)
|
||||
{
|
||||
@ -86,7 +71,7 @@ bool TElimina_zoppi::firm_handler(TMask_field& f, KEY k)
|
||||
if (ok)
|
||||
prefix().set_codditta(cod);
|
||||
else
|
||||
f.error_box(FR("La ditta %05ld non e' attivata per la contabilita'"), cod);
|
||||
f.error_box(FR("La ditta %05ld non è attivata per la contabilità"), cod);
|
||||
}
|
||||
|
||||
return ok;
|
||||
@ -103,11 +88,19 @@ const char* TElimina_zoppi::decode(int num, const char* key, const char* field)
|
||||
return dec->decode(key);
|
||||
}
|
||||
|
||||
const char* TElimina_zoppi::decode(int num, long key, const char* field)
|
||||
{
|
||||
TString8 k; k.format("%ld", key);
|
||||
return decode(num, k, field);
|
||||
}
|
||||
|
||||
bool TElimina_zoppi::test_row_file(int lf_rmov, TString_array& arr)
|
||||
{
|
||||
bool ok = true;
|
||||
TLocalisamfile mov(LF_MOV);
|
||||
TLocalisamfile row(lf_rmov);
|
||||
|
||||
TString8 query; query.format("USE %d", lf_rmov);
|
||||
TISAM_recordset recset(query);
|
||||
|
||||
TString msg;
|
||||
switch (lf_rmov)
|
||||
@ -119,7 +112,7 @@ bool TElimina_zoppi::test_row_file(int lf_rmov, TString_array& arr)
|
||||
}
|
||||
msg << ": 0";
|
||||
|
||||
TProgind pi(row.items(), msg, true, true);
|
||||
TProgress_monitor pi(recset.items(), msg);
|
||||
TToken_string riga, descr;
|
||||
|
||||
long reg, last_reg = 0, found = 0;
|
||||
@ -129,9 +122,10 @@ bool TElimina_zoppi::test_row_file(int lf_rmov, TString_array& arr)
|
||||
int gruppo, conto;
|
||||
long sottoconto;
|
||||
|
||||
FOR_EACH_FILE_RECORD(row)
|
||||
const TRectype& row = recset.cursor()->curr();
|
||||
for (bool ok = recset.move_first(); ok; ok = recset.move_next())
|
||||
{
|
||||
if (!pi.addstatus(1))
|
||||
if (!pi.add_status(1))
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
@ -242,8 +236,7 @@ bool TElimina_zoppi::test_riga_partita(const TRectype& pagsca)
|
||||
k.add(pagsca.get(PART_ANNO));
|
||||
k.add(pagsca.get(PART_NUMPART));
|
||||
k.add(nriga);
|
||||
const TRectype& part = cache().get(LF_PARTITE, k);
|
||||
const int tipomov = part.get_int(PART_TIPOMOV);
|
||||
const int tipomov = atoi(app().decode(LF_PARTITE, k, PART_TIPOMOV));
|
||||
ok = tipomov == 1;
|
||||
}
|
||||
|
||||
@ -253,7 +246,9 @@ bool TElimina_zoppi::test_riga_partita(const TRectype& pagsca)
|
||||
bool TElimina_zoppi::test_scrow_file(int lf_pagsca, TString_array& arr)
|
||||
{
|
||||
bool ok = true;
|
||||
TLocalisamfile pagsca(lf_pagsca);
|
||||
|
||||
TString8 query; query.format("USE %d", lf_pagsca);
|
||||
TISAM_recordset recset(query);
|
||||
long found = 0;
|
||||
|
||||
TString msg;
|
||||
@ -267,12 +262,13 @@ bool TElimina_zoppi::test_scrow_file(int lf_pagsca, TString_array& arr)
|
||||
msg << ": 0";
|
||||
msg.center_just(50);
|
||||
|
||||
TProgind pi(pagsca.items(), msg, true, true);
|
||||
TProgress_monitor pi(recset.items(), msg);
|
||||
TToken_string riga, descr;
|
||||
|
||||
FOR_EACH_FILE_RECORD(pagsca)
|
||||
const TRectype& pagsca = recset.cursor()->curr();
|
||||
for (bool ok = recset.move_first(); ok; ok = recset.move_next())
|
||||
{
|
||||
if (!pi.addstatus(1))
|
||||
if (!pi.add_status())
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
@ -287,11 +283,11 @@ bool TElimina_zoppi::test_scrow_file(int lf_pagsca, TString_array& arr)
|
||||
case LF_PAGSCA:
|
||||
if (pagsca.get_int(PAGSCA_NRIGP) <= 0)
|
||||
to_kill = true;
|
||||
if (!test_riga_partita(pagsca.curr()))
|
||||
if (!test_riga_partita(pagsca))
|
||||
to_kill = true;
|
||||
break;
|
||||
case LF_SCADENZE:
|
||||
if (!test_riga_partita(pagsca.curr()))
|
||||
if (!test_riga_partita(pagsca))
|
||||
to_kill = true;
|
||||
break;
|
||||
default:
|
||||
@ -306,7 +302,7 @@ bool TElimina_zoppi::test_scrow_file(int lf_pagsca, TString_array& arr)
|
||||
msg << found;
|
||||
pi.set_text(msg);
|
||||
|
||||
riga.format(" |%6ld", pagsca.recno());
|
||||
riga.format(" |%6ld", recset.cursor()->file().recno());
|
||||
if (lf_pagsca == LF_SCADENZE)
|
||||
riga.add("S");
|
||||
else
|
||||
@ -331,8 +327,10 @@ bool TElimina_zoppi::test_scrow_file(int lf_pagsca, TString_array& arr)
|
||||
|
||||
bool TElimina_zoppi::test_head_file(TString_array& arr)
|
||||
{
|
||||
TEsercizi_contabili esc;
|
||||
|
||||
bool ok = true;
|
||||
TLocalisamfile mov(LF_MOV);
|
||||
TISAM_recordset recset("USE MOV");
|
||||
TLocalisamfile rmov(LF_RMOV);
|
||||
TLocalisamfile rmoviva(LF_RMOVIVA);
|
||||
|
||||
@ -340,31 +338,39 @@ bool TElimina_zoppi::test_head_file(TString_array& arr)
|
||||
msg << TR("Controllo testate di prima nota: 0");
|
||||
msg.center_just(50);
|
||||
|
||||
TProgind pi(mov.items(), msg, true, true, 50);
|
||||
TProgress_monitor pi(recset.items(), msg);
|
||||
TToken_string riga, descr;
|
||||
const TRectype& mov = recset.cursor()->curr();
|
||||
|
||||
FOR_EACH_FILE_RECORD(mov)
|
||||
for (bool ok = recset.move_first(); ok; ok = recset.move_next())
|
||||
{
|
||||
if (pi.iscancelled())
|
||||
if (!pi.add_status())
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
pi.addstatus(1);
|
||||
|
||||
long reg = mov.get_long(MOV_NUMREG);
|
||||
int rmov_err = NOERR;
|
||||
int rmoviva_err = NOERR;
|
||||
if (reg > 0)
|
||||
|
||||
bool good = reg > 0;
|
||||
if (good)
|
||||
{
|
||||
//int rmoviva_err = NOERR;
|
||||
rmov.put(RMV_NUMREG, reg);
|
||||
rmov.put(RMV_NUMRIG, 1);
|
||||
rmov_err = rmov.read();
|
||||
rmoviva.put(RMI_NUMREG, reg);
|
||||
int rmov_err = rmov.read();
|
||||
/*rmoviva.put(RMI_NUMREG, reg);
|
||||
rmoviva.put(RMI_NUMRIG, 1);
|
||||
rmoviva_err = rmoviva.read();
|
||||
int rmoviva_err = rmoviva.read();*/
|
||||
good = rmov_err == NOERR;
|
||||
if (good)
|
||||
{
|
||||
const int annoes = mov.get_int(MOV_ANNOES);
|
||||
good = annoes > 0 && esc.exist(annoes);
|
||||
}
|
||||
}
|
||||
if (reg == 0 || (rmov_err != NOERR && rmoviva_err != NOERR))
|
||||
|
||||
if (!good)
|
||||
{
|
||||
riga.format(" |%6ld|T", reg);
|
||||
riga.add(mov.get(MOV_ANNOES));
|
||||
@ -487,18 +493,32 @@ int TElimina_zoppi::kill_row(long numreg, char tipor, int numrig)
|
||||
rmov.put(RMV_NUMRIG, numrig);
|
||||
int err = rmov.read();
|
||||
if (err == NOERR)
|
||||
{
|
||||
err = rmov.remove();
|
||||
if (err == NOERR && lf == LF_MOV)
|
||||
{
|
||||
// Cancella anche le righe collegate alla testata
|
||||
for (int r = 1; kill_row(numreg, 'C', r) == NOERR; r++);
|
||||
for (int r = 1; kill_row(numreg, 'I', r) == NOERR; r++);
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
bool TElimina_zoppi::select_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
bool ok = true;
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
TArray_sheet sheet(-1, -1, 76, 20, app().app_name(), HR("@1|Codice@6|Riga@5|Anno@R|Importo@20R|Grp@R|Cnt@R|Sottoc@R|Descrizione@50"));
|
||||
void TElimina_zoppi::main_loop()
|
||||
{
|
||||
open_files(LF_CLIFO, LF_NDITTE, LF_PCON, LF_MOV, LF_RMOV, LF_RMOVIVA, LF_PARTITE, LF_SCADENZE, LF_PAGSCA, 0);
|
||||
|
||||
TMask m(app_name(), 1, 30, 5);
|
||||
m.add_number(DLG_USER, 0, TR("Codice ditta "), 1, 1, 5, "BUF").set_handler(firm_handler);
|
||||
m.add_button(DLG_ELABORA, 0, "", -12, -1, 10, 2, "", BMP_ELABORA).set_exit_key(K_ENTER);
|
||||
m.add_button(DLG_QUIT, 0, "", -22, -1, 10, 2);
|
||||
|
||||
while (m.run() != K_QUIT)
|
||||
{
|
||||
TArray_sheet sheet(0, 0, 0, 0, app().app_name(), HR("@1|Codice@6|Riga@5|Anno@R|Importo@20R|Grp@R|Cnt@R|Sottoc@R|Descrizione@50"));
|
||||
TString_array& arr = sheet.rows_array();
|
||||
ok = test_row_file(LF_RMOV, arr);
|
||||
bool ok = test_row_file(LF_RMOV, arr);
|
||||
if (ok)
|
||||
ok = test_row_file(LF_RMOVIVA, arr);
|
||||
if (ok)
|
||||
@ -515,16 +535,15 @@ bool TElimina_zoppi::select_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
const long total = sheet.checked();
|
||||
if (total > 0 &&
|
||||
yesno_box(FR("Confermare l'eliminazione di %ld righe."), total))
|
||||
delete_box(FR("Confermare l'eliminazione di %ld righe."), total))
|
||||
{
|
||||
TProgind pi(total, TR("Eliminazione righe..."), true, true);
|
||||
TProgress_monitor pi(total, TR("Eliminazione righe..."));
|
||||
FOR_EACH_ARRAY_ROW(arr, i, riga)
|
||||
{
|
||||
if (sheet.checked(i))
|
||||
{
|
||||
if (pi.iscancelled())
|
||||
if (!pi.add_status())
|
||||
break;
|
||||
pi.addstatus(1);
|
||||
|
||||
TString16 str = riga->get(2);
|
||||
char tipor = str[0];
|
||||
@ -536,21 +555,6 @@ bool TElimina_zoppi::select_handler(TMask_field& f, KEY k)
|
||||
}
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
void TElimina_zoppi::main_loop()
|
||||
{
|
||||
open_files(LF_CLIFO, LF_NDITTE, LF_PCON, LF_MOV, LF_RMOV, LF_RMOVIVA, LF_PARTITE, LF_SCADENZE, LF_PAGSCA, 0);
|
||||
|
||||
TMask m(app_name(), 1, 30, 5);
|
||||
m.add_number(DLG_USER, 0, TR("Codice ditta "), 1, 1, 5, "BUF");
|
||||
m.add_button(DLG_SELECT, 0, "", -12, -1, 10, 2);
|
||||
m.add_button(DLG_QUIT, 0, "", -22, -1, 10, 2);
|
||||
m.set_handler(DLG_USER, firm_handler);
|
||||
m.set_handler(DLG_SELECT, select_handler);
|
||||
|
||||
while (m.run() != K_QUIT);
|
||||
}
|
||||
|
||||
void elimina_zoppi(int argc, char* argv[])
|
||||
|
@ -2803,12 +2803,10 @@ void TStampa_bilanci::leggi_sort()
|
||||
|
||||
void TStampa_bilanci::controlla_conto(int file1,int file2)
|
||||
{
|
||||
char dep = '*';
|
||||
|
||||
if (!file1)
|
||||
if (_cambiato_conto_1)
|
||||
{
|
||||
set_row(_i,"@68g%c", dep);
|
||||
set_row(_i,"@67g*");
|
||||
_cambiato_conto_1 = FALSE;
|
||||
}
|
||||
else
|
||||
@ -2827,7 +2825,7 @@ void TStampa_bilanci::controlla_conto(int file1,int file2)
|
||||
if (!file2)
|
||||
if (_cambiato_conto_2)
|
||||
{
|
||||
set_row(_i,"@68g%c", dep);
|
||||
set_row(_i,"@67g*");
|
||||
_cambiato_conto_2 = FALSE;
|
||||
}
|
||||
else
|
||||
@ -2878,8 +2876,8 @@ void TStampa_bilanci::set_page(int file, int counter)
|
||||
|
||||
if (!counter)
|
||||
{
|
||||
set_row(_i++,FR("@29gATTIVITA'@94gPASSIVITA'"));
|
||||
set_row(_i++,"@29g---------@94g----------");
|
||||
set_row(_i++,FR("@29gATTIVITA'@98gPASSIVITA'"));
|
||||
set_row(_i++,"@29g---------@98g----------");
|
||||
set_row(_i++, dep);
|
||||
}
|
||||
|
||||
@ -2889,8 +2887,8 @@ void TStampa_bilanci::set_page(int file, int counter)
|
||||
if (!_salto_pagina)
|
||||
{
|
||||
printer().formfeed();
|
||||
set_row(_i++,FR("@29gCOSTI@94gRICAVI"));
|
||||
set_row(_i++,"@29g-----@94g------");
|
||||
set_row(_i++,FR("@29gCOSTI@98gRICAVI"));
|
||||
set_row(_i++,"@29g-----@98g------");
|
||||
set_row(_i++, dep);
|
||||
_salto_pagina = TRUE;
|
||||
|
||||
@ -3446,91 +3444,69 @@ void TStampa_bilanci::stampa_totali_uno(const real& r1,const real& r2)
|
||||
void TStampa_bilanci::stampa_prima_colonna(int g, int c, long s,
|
||||
const char* desc, const real& saldo)
|
||||
{
|
||||
char dep = '*';
|
||||
|
||||
if (_codici) //sono stampate solo le descrizioni dei conti
|
||||
{
|
||||
if (!_totali)
|
||||
{
|
||||
if (c != 0 && s == 0)
|
||||
set_row(_i, "%-.44s @44g @49g%r @68g%c", desc, &saldo, dep);
|
||||
set_row(_i, "%-.44s @44g @48g%r", desc, &saldo);
|
||||
else
|
||||
set_row(_i, "%-.48s @49g%r @68g%c", desc, &saldo, dep);
|
||||
set_row(_i, "%-.48s @48g%r", desc, &saldo);
|
||||
}
|
||||
else if ( !(c == 0 && s == 0) ) //se cioe' non e' un gruppo
|
||||
{
|
||||
if (s == 0) //se e' un conto
|
||||
set_row(_i, "%-.44s @44g @49g%r @68g%c", desc, &saldo, dep);
|
||||
set_row(_i, "%-.44s @44g @48g%r", desc, &saldo);
|
||||
else
|
||||
set_row(_i, "%-.48s @49g%r @68g%c", desc, &saldo, dep);
|
||||
set_row(_i, "%-.48s @48g%r", desc, &saldo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_totali && c == 0 && s == 0l)
|
||||
return;
|
||||
else if ( c == 0 && s == 0l )
|
||||
|
||||
set_row(_i, "@0g%3d", g);
|
||||
if (c > 0)
|
||||
{
|
||||
set_row(_i, "%3d ", g);
|
||||
set_row(_i, "@15g%-.31s @49g%r @68g%c", desc, &saldo, dep);
|
||||
}
|
||||
else if (s == 0l)
|
||||
{
|
||||
set_row(_i, "%3d ", g);
|
||||
set_row(_i, "%3d ", c);
|
||||
set_row(_i, "@15g%-.31s @49g%r @68g%c", desc, &saldo, dep);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_row(_i, "%3d ", g);
|
||||
set_row(_i, "%3d ", c);
|
||||
set_row(_i, "%6ld ", s);
|
||||
set_row(_i, "@15g%-.31s @49g%r @68g%c", desc, &saldo, dep);
|
||||
set_row(_i, "@4g%3d", c);
|
||||
if (s > 0)
|
||||
set_row(_i, "@8g%6ld", s);
|
||||
}
|
||||
set_row(_i, "@15g%-.31s @48g%r", desc, &saldo);
|
||||
}
|
||||
set_row(_i, "@67g*");
|
||||
}
|
||||
|
||||
|
||||
// Guy: stampa la seconda colonna del bilancio di raffronto
|
||||
void TStampa_bilanci::stampa_seconda_colonna(int g, int c, long s,
|
||||
const char* desc, const real& saldo)
|
||||
void TStampa_bilanci::stampa_seconda_colonna(int g, int c, long s, const char* desc, const real& saldo)
|
||||
{
|
||||
char dep = '*';
|
||||
|
||||
if (_codici) //sono stampate solo le descrizioni dei conti
|
||||
{
|
||||
if (!_totali)
|
||||
{
|
||||
set_row(_i, "@68g%c@69g%-.47s @114g%r", dep, desc, &saldo);
|
||||
set_row(_i, "@67g*@69g%-.47s @114g%r", desc, &saldo);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !(c == 0 && s == 0) )
|
||||
{
|
||||
set_row(_i, "@68g%c @69g%-.47s @114g%r", dep, desc, &saldo);
|
||||
}
|
||||
set_row(_i, "@67g*@69g%-.47s @114g%r", desc, &saldo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_totali && c == 0 && s == 0l)
|
||||
return;
|
||||
else if ( c == 0 && s == 0l )
|
||||
{
|
||||
set_row(_i, "@68g%c@69g%3d ", dep, g);
|
||||
set_row(_i, "@84g%-.30s @114g%r", desc, &saldo);
|
||||
}
|
||||
else if (s == 0l)
|
||||
|
||||
set_row(_i, "@67g*@69g%3d ", g);
|
||||
if (c > 0)
|
||||
{
|
||||
set_row(_i, "@68g%c@69g%3d ", dep, g);
|
||||
set_row(_i, "%3d", c);
|
||||
set_row(_i, "@84g%-.30s @114g%r", desc, &saldo);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_row(_i, "@68g%c@69g%3d ", dep, g);
|
||||
set_row(_i, "%3d ", c);
|
||||
set_row(_i, "%6ld ",s);
|
||||
set_row(_i, "@84g%-.30s @114g%r", desc, &saldo);
|
||||
set_row(_i, "@73g%3d", c);
|
||||
if (s > 0)
|
||||
set_row(_i, "@77g%6ld", s);
|
||||
}
|
||||
set_row(_i, "@84g%-.30s @114g%r", desc, &saldo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2424,12 +2424,12 @@ bool TPrimanota_application::protected_record(TRectype& mov)
|
||||
{
|
||||
if (mov.get_bool(MOV_STAMPATO))
|
||||
{
|
||||
ok = delete_box(FR("Il movimento %ld è già stato stampato sul libro giornale:\n"
|
||||
ok = delete_box(FR("Il movimento %ld è già stato stampato sul libro giornale:\n"
|
||||
"si desidera eliminarlo ugualmente?"), numreg);
|
||||
}
|
||||
if (ok && mov.get_bool(MOV_REGST))
|
||||
{
|
||||
ok = delete_box(FR("Il movimento %ld è già stato stampato sul bollato:\n"
|
||||
ok = delete_box(FR("Il movimento %ld è già stato stampato sul bollato:\n"
|
||||
"si desidera eliminarlo ugualmente?"), numreg);
|
||||
}
|
||||
if (ok && mov.get_bool(MOV_INVIATO))
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "cg2100p.h"
|
||||
|
||||
PAGE "Nuova partita" -1 -1 40 10
|
||||
PAGE "Nuova partita" -1 -1 42 10
|
||||
|
||||
RADIOBUTTON P_NUOVO 1 23
|
||||
RADIOBUTTON P_NUOVO 1 25
|
||||
BEGIN
|
||||
PROMPT 0 0 "@BTipo movimento"
|
||||
ITEM "1|Fattura"
|
||||
@ -14,7 +14,7 @@ END
|
||||
|
||||
NUMBER P_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 24 0 "Anno "
|
||||
PROMPT 26 0 "Anno "
|
||||
// FLAGS "A"
|
||||
CHECKTYPE REQUIRED
|
||||
WARNING "Inserire l'anno di riferimento partita"
|
||||
@ -22,20 +22,20 @@ END
|
||||
|
||||
STRING P_NUMERO 7
|
||||
BEGIN
|
||||
PROMPT 24 1 "Numero "
|
||||
PROMPT 26 1 "Numero "
|
||||
FLAGS "U#"
|
||||
CHECKTYPE REQUIRED
|
||||
WARNING "Inserire il numero di riferimento partita"
|
||||
END
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 10 2
|
||||
BEGIN
|
||||
PROMPT 26 2 ""
|
||||
PROMPT -1 -3 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT 26 4 ""
|
||||
PROMPT -1 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
@ -2476,16 +2476,13 @@ bool TPrimanota_application::numdoc_handler(TMask_field& f, KEY key)
|
||||
if (annodoc > 0 && fornitore > 0)
|
||||
{
|
||||
// SELECT NUMREG,DATAREG,DATADOC,NUMDOC FROM MOV
|
||||
// WHERE TIPO='F' AND CODCF=F_FORNITORE AND
|
||||
// WHERE TIPO='F' AND CODCF=F_FORNITORE AND REG<>'' AND
|
||||
// NUMDOC=F_NUMDOC AND DATAREG>=F_DATADOC AND NUMREG<>F_NUMREG
|
||||
|
||||
TString filter;
|
||||
filter << MOV_NUMDOC << "=\"" << f.get() << '"';
|
||||
filter << '(' << MOV_NUMDOC << "=\"" << f.get() << "\")&&(" << MOV_REG << "!=\"\")";
|
||||
if (m.edit_mode())
|
||||
{
|
||||
filter.insert("(");
|
||||
filter << ")&&(" << MOV_NUMREG << "!=\"" << m.get(F_NUMREG) << "\")";
|
||||
}
|
||||
filter << "&&(" << MOV_NUMREG << "!=\"" << m.get(F_NUMREG) << "\")";
|
||||
|
||||
TRelation rel(LF_MOV);
|
||||
TRectype& rec = rel.curr();
|
||||
@ -2505,7 +2502,7 @@ bool TPrimanota_application::numdoc_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
const int ad = rec.get_date(MOV_DATADOC).year();
|
||||
if (ad == annodoc)
|
||||
return yesno_box("Il documento %d / %s e' gia' stato inserito con la registrazione %ld\nSi desidera continuare ugualmente?",
|
||||
return yesno_box("Il documento %d / %s è già stato inserito con la registrazione %ld\nSi desidera continuare ugualmente?",
|
||||
annodoc, (const char*)f.get(), rec.get_long(MOV_NUMREG));
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ protected:
|
||||
static bool edit_scadenza_handler(TMask_field& f, KEY k);
|
||||
static bool nuovo_handler(TMask_field& f, KEY k);
|
||||
static bool cambio_handler(TMask_field& f, KEY k);
|
||||
|
||||
|
||||
void add_importo(TToken_string& s, const TImporto& i, const char* val = NULL, int pos = -1);
|
||||
void add_descrizione(TToken_string& s, const TRiga_partite& riga, int pos = -1);
|
||||
TImporto get_importo(TToken_string& s, int pos) const;
|
||||
@ -85,6 +85,7 @@ public:
|
||||
TSheet_field& partite() const { return sfield(P_PARTITE); }
|
||||
TSheet_field& scadenze() const { return sfield(P_SCADENZE); }
|
||||
const TBill& conto() const { return _conto; }
|
||||
TPartita* partita_corrente() const;
|
||||
|
||||
const TImporto& residuo(bool val) const { return val ? _resval : _residuo; }
|
||||
bool changed() const { return _changed; }
|
||||
@ -795,7 +796,6 @@ const TRiga_partite* TGame_mask::cerca_prima_riga() const
|
||||
return riga;
|
||||
}
|
||||
|
||||
|
||||
void TGame_mask::aggiorna_valuta(const TValuta& val)
|
||||
{
|
||||
TPartite_array& pa = app().partite();
|
||||
@ -832,13 +832,25 @@ void TGame_mask::aggiorna_valuta(const TValuta& val)
|
||||
|
||||
TToken_string& TGame_mask::add_colored_row(TSheet_field& sheet, char type) const
|
||||
{
|
||||
int r = sheet.insert(-1, FALSE, FALSE);
|
||||
int r = sheet.insert(-1, false, false);
|
||||
COLOR back, fore;
|
||||
app().type2colors(type, back, fore);
|
||||
sheet.set_back_and_fore_color(back, fore, r);
|
||||
return sheet.row(r);
|
||||
}
|
||||
|
||||
TPartita* TGame_mask::partita_corrente() const
|
||||
{
|
||||
if (_riga_partite < 0)
|
||||
return NULL;
|
||||
TToken_string& row = partite().row(_riga_partite);
|
||||
const int anno = row.get_int(0); // Anno partita
|
||||
const TString16 num = row.get(); // Numero partita
|
||||
const TBill& zio = conto();
|
||||
TPartita* game = app().partite().exist(zio, anno, num);
|
||||
return game;
|
||||
}
|
||||
|
||||
bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
|
||||
{
|
||||
TGame_mask& gm = (TGame_mask&)partite.mask();
|
||||
@ -1189,19 +1201,49 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
|
||||
if (k == K_INS)
|
||||
{
|
||||
gm.send_key(K_CTRL + 'N', 0, &partite); // Simula la pressione del tasto nuovo
|
||||
return FALSE; // Rifiuta l'aggiunta di una riga
|
||||
return false; // Rifiuta l'aggiunta di una riga
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool partita_bloccata(const TPartita& game)
|
||||
{
|
||||
int rate = 0, bloccate = 0;
|
||||
for (int i = game.last(); i > 0; i = game.pred(i))
|
||||
{
|
||||
const TRiga_partite& riga = game.riga(i);
|
||||
if (riga.tipo() == tm_fattura)
|
||||
{
|
||||
for (int r = riga.rate(); r > 0; r--)
|
||||
{
|
||||
rate++;
|
||||
const TRiga_scadenze& rata = riga.rata(r);
|
||||
if (rata.get_bool(SCAD_BLOCCATA))
|
||||
bloccate++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return bloccate > 0 && bloccate == rate;
|
||||
}
|
||||
|
||||
bool TGame_mask::scadenze_notify(TSheet_field& scadenze, int r, KEY k)
|
||||
{
|
||||
if (k == K_INS)
|
||||
{
|
||||
TGame_mask& gm = (TGame_mask&)scadenze.mask();
|
||||
#ifndef __EXTRA__
|
||||
const TCausale& causale = app().causale();
|
||||
const tipo_movimento tm = (tipo_movimento)causale.tipomov();
|
||||
if (tm == tm_pagamento)
|
||||
{
|
||||
const TPartita* game = gm.partita_corrente();
|
||||
if (game && partita_bloccata(*game))
|
||||
return error_box(TR("Le rate della partita risultano bloccate"));
|
||||
}
|
||||
#endif
|
||||
gm.send_key(K_CTRL + 'N', 0, &scadenze); // Simula la pressione del tasto nuovo
|
||||
return FALSE; // Rifiuta l'aggiunta di una riga
|
||||
return false; // Rifiuta l'aggiunta di una riga
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1397,8 +1439,9 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (m.get_bool(114))
|
||||
{
|
||||
if (was == NULL) giochi.destroy(game);
|
||||
return f.error_box(FR("La rata %d e' bloccata."), nrata);
|
||||
if (was == NULL)
|
||||
giochi.destroy(game);
|
||||
return f.error_box(FR("La rata %d risulta bloccata."), nrata);
|
||||
}
|
||||
|
||||
#ifndef __EXTRA__
|
||||
@ -1414,7 +1457,7 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
||||
}
|
||||
#endif
|
||||
|
||||
tipo_movimento tm;
|
||||
tipo_movimento tm = tm_pagamento;
|
||||
#ifdef __EXTRA__
|
||||
TMask* nm = new TNew_mask(gm.conto().tipo(), FALSE, FALSE);
|
||||
nm->set(P_ANNO, game.anno());
|
||||
@ -1427,7 +1470,7 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (was == NULL)
|
||||
giochi.destroy(game);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
tm = (tipo_movimento)app().causale().tipomov();
|
||||
@ -1530,7 +1573,7 @@ bool TGame_mask::nuovo_handler(TMask_field& f, KEY k)
|
||||
else
|
||||
new_game->init(gm.conto().tipo(), allow_fatt, TRUE);
|
||||
|
||||
tipo_movimento tm;
|
||||
tipo_movimento tm = tm_pagamento;
|
||||
|
||||
#ifndef __EXTRA__
|
||||
const TMask& cm = app().curr_mask();
|
||||
@ -1555,7 +1598,9 @@ bool TGame_mask::nuovo_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
// Creazione nuova partita
|
||||
TPartita& game = app().partite().partita(gm.conto(), anno, numero);
|
||||
|
||||
if (tm == tm_pagamento && partita_bloccata(game))
|
||||
return error_box(TR("Le rate di questa partita risultano bloccate"));
|
||||
|
||||
bool edit = FALSE;
|
||||
// N.B. Le fatture non possone essere editate in modo contabile
|
||||
if (tm != tm_fattura)
|
||||
@ -1934,6 +1979,9 @@ void TGame_mask::fill_partite()
|
||||
|
||||
bool TGame_mask::edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp) const
|
||||
{
|
||||
if (nrigp <= 0)
|
||||
return false;
|
||||
|
||||
TRectype oldpag = p.pagamento(nriga, nrata, nrigp);
|
||||
TRiga_partite& somma = p.riga(nrigp);
|
||||
|
||||
@ -2176,24 +2224,28 @@ bool TPrimanota_application::edit_partite(const TMask& m, int riga)
|
||||
|
||||
if (changed)
|
||||
{
|
||||
TSheet_field& s = cgs();
|
||||
|
||||
if (m.field(CG_DESCR).empty())
|
||||
{
|
||||
TString descr;
|
||||
if (genera_riferimento(riga, descr))
|
||||
{
|
||||
TSheet_field& s = cgs();
|
||||
s.row(riga).add(descr, CG_DESCR-101);
|
||||
TBill conto; conto.get(s.row(riga), 2, 0x3);
|
||||
const int idx = s.cid2index(CG_DESCR);
|
||||
TToken_string& sr = s.row(riga);
|
||||
sr.add(descr, idx);
|
||||
TBill conto; conto.get(sr, 2, 0x3);
|
||||
for (int r = riga+1; r < s.items(); r++)
|
||||
{
|
||||
TBill contro; contro.get(s.row(r), 9, 0x3);
|
||||
TToken_string& sr = s.row(r);
|
||||
TBill contro; contro.get(sr, 9, 0x3);
|
||||
if (conto == contro)
|
||||
s.row(r).add(descr, CG_DESCR-101);
|
||||
sr.add(descr, idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cgs().force_update(); // Aggiornamento righe contabili
|
||||
s.force_update(); // Aggiornamento righe contabili
|
||||
calcola_saldo();
|
||||
_sal_dirty = true;
|
||||
}
|
||||
|
@ -310,7 +310,6 @@ static int sort_by_fields(TSheet_field& sheet, int r1, int r2, const short* cons
|
||||
return diff;
|
||||
}
|
||||
|
||||
|
||||
static int sort_by_date(TSheet_field& sheet, int r1, int r2)
|
||||
{
|
||||
// Elenco dei campi da confrontare in ordine di priorita'
|
||||
@ -1064,12 +1063,13 @@ void TEasySolder_mask::fill_sheet()
|
||||
|
||||
if (_tipomov == tm_insoluto)
|
||||
{
|
||||
s.set_column_header(S_IMPORTO, TR("Importo\nInsoluto"));
|
||||
s.set_column_header(S_RESIDUO, TR("Importo\nPagato"));
|
||||
s.set_column_header(S_IMPORTO, HR("Importo\nInsoluto"));
|
||||
s.set_column_header(S_RESIDUO, HR("Importo\nPagato"));
|
||||
}
|
||||
else
|
||||
{
|
||||
s.set_column_header(S_RESIDUO, TR("Residuo\nScadenza"));
|
||||
s.set_column_header(S_IMPORTO, HR("Importo\nPagamento"));
|
||||
s.set_column_header(S_RESIDUO, HR("Residuo\nScadenza"));
|
||||
}
|
||||
s.set_column_justify(S_PARTITA, TPartita::allineamento_richiesto(_conto.tipo()) == 'R');
|
||||
|
||||
|
@ -159,7 +159,8 @@ bool CG4100_App::sort_sal()
|
||||
{
|
||||
if (gruppo <= 0 || conto <= 0 || sottoconto <= 0)
|
||||
{
|
||||
warning_box(FR("Conto non valido alla riga %d nel movimento %ld"), rmov.get_int(RMV_NUMRIG), numreg);
|
||||
warning_box(FR("Conto non valido alla riga %d nel movimento %ld"),
|
||||
rmov.get_int(RMV_NUMRIG), numreg);
|
||||
continue;
|
||||
}
|
||||
sal.aggiorna(gruppo, conto, sottoconto, importo, sezione, true, scaricato);
|
||||
|
@ -2501,6 +2501,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
// Prorata per l'anno corrente + quelli eventuali dello scorso anno e quelli che sono oltre 3 anni fa...
|
||||
// E quelli che non hanno la % prorata settata in tabella
|
||||
real aaa = acquisti_iva;
|
||||
aaa -= ammort_det_iva; // Scarta gli acquisti di beni ammortizzabili (4-9-2014)
|
||||
if (percentuale1 != INVALID_PRORATA && percentuale1 != INVALID_PRORATA_ASSERT)
|
||||
aaa -= rr1 ? *rr1 : ZERO;
|
||||
if (percentuale2 != INVALID_PRORATA && percentuale2 != INVALID_PRORATA_ASSERT)
|
||||
@ -2533,7 +2534,7 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
* Il prorata pagato in annuale viene scritto a 0, perche' in realta' sarebbe
|
||||
* la somma di quelli pagati nei mesi precedenti.
|
||||
*/
|
||||
_plm->put("R2", prorata); // Prorata complessivo (acq. rif. anno attuale + acq. rif. anni precedenti)
|
||||
_plm->put("R2", prorata); // Prorata complessivo (acq. rif. anno attuale + acq. rif. anni precedenti)
|
||||
_plm->put("R14", prorata_precedente1); // Prorata acq. rif. anno addietro
|
||||
_plm->put("R15", prorata_precedente2); // Prorata acq. rif. 2 anni addietro
|
||||
|
||||
@ -3841,8 +3842,8 @@ void TLiquidazione_app::write_liq(int month, const char* codatts)
|
||||
conguaglio = topay - ppg;
|
||||
round_imposta(conguaglio);
|
||||
|
||||
_pla->put("R9", conguaglio);
|
||||
_pla->put("R10",prorata);
|
||||
_pla->put("R9", conguaglio);
|
||||
_pla->put("R10", prorata);
|
||||
|
||||
// Prorata delle mie brame...
|
||||
// Chi e' il piu' sfatto del reame?
|
||||
@ -4282,8 +4283,7 @@ void TLiquidazione_app::recalc_annual(const char* att)
|
||||
{
|
||||
if (!look_plm(i,aaa))
|
||||
continue;
|
||||
|
||||
pro_pag += _plm->get_real("R2"); // Can't do anyway else...
|
||||
pro_pag += _plm->get_real("R2"); // Can't do anyway else...
|
||||
}
|
||||
|
||||
// Modifiche per PIM13
|
||||
|
@ -350,9 +350,11 @@ bool TProrata_msk::on_field_event(TOperable_field& o, TField_event e, long jolly
|
||||
case F_DATAINI:
|
||||
if (e == fe_init)
|
||||
{
|
||||
const TDate oggi(TODAY);
|
||||
o.set(TDate(1,1,oggi.year()-1));
|
||||
set(F_DATAFIN, TDate(31,12,oggi.year()-1), 0x3);
|
||||
TDate d(TODAY); d.set_day(1); --d;
|
||||
d.set_day(1);
|
||||
o.set(d);
|
||||
d.set_end_month();
|
||||
set(F_DATAFIN, d, 0x3);
|
||||
}
|
||||
break;
|
||||
case F_DATAFIN:
|
||||
|
@ -797,7 +797,14 @@ TImage* TSolder_tree::image(bool selected) const
|
||||
case 3:
|
||||
{
|
||||
const TRiga_scadenze* s = scadenza();
|
||||
id = s && s->chiusa() ? BMP_DIRDNSEL : BMP_DIRDN;
|
||||
id = BMP_DIRDN;
|
||||
if (s)
|
||||
{
|
||||
if (s->get_bool(SCAD_BLOCCATA))
|
||||
return get_res_icon(10203); // Icona di stop
|
||||
if (s->chiusa())
|
||||
id = BMP_DIRDNSEL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
|
Loading…
x
Reference in New Issue
Block a user