Patch level : 2..0 434
Files correlati : cg4.exe Ricompilazione Demo : [ ] Commento : Aggiunto il supporto delle lingue a cg4 git-svn-id: svn://10.65.10.50/trunk@10946 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
730be22a7a
commit
33712eacad
10
cg/cg4.h
10
cg/cg4.h
@ -16,15 +16,5 @@ int cg4800(int argc, char* argv[]);
|
||||
int cg4900(int argc, char* argv[]);
|
||||
int cg4a00(int argc, char* argv[]);
|
||||
|
||||
#ifdef __MAIN__
|
||||
#define extern
|
||||
#endif
|
||||
|
||||
extern TString256 TMP;
|
||||
|
||||
#ifdef __MAIN__
|
||||
#undef extern
|
||||
#endif
|
||||
|
||||
#endif // __CG4_H
|
||||
|
||||
|
@ -1,29 +0,0 @@
|
||||
PAGE "Riordino Movimenti" -1 -1 47 10
|
||||
|
||||
TEXT DLG_NULL
|
||||
BEGIN
|
||||
PROMPT 16 1 "ATTENZIONE"
|
||||
END
|
||||
|
||||
TEXT DLG_NULL
|
||||
BEGIN
|
||||
PROMPT 2 3 "Il riordino degli archivi puo' richiedere"
|
||||
END
|
||||
|
||||
TEXT DLG_NULL
|
||||
BEGIN
|
||||
PROMPT 3 4 "tempo. Siate certi di voler proseguire."
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
ENDMASK
|
292
cg/cg4500.cpp
292
cg/cg4500.cpp
@ -1,36 +1,41 @@
|
||||
#include <recarray.h>
|
||||
#include <relation.h>
|
||||
#include "cg4501.h"
|
||||
#include "cg4500a.h"
|
||||
#include "cglib01.h"
|
||||
|
||||
class TAp_eser : public TSkeleton_application
|
||||
{
|
||||
int _anno, _newanno;
|
||||
TDate _dataini, _datafin, _datainp, _datafip;
|
||||
TString _conserva;
|
||||
TEsercizi_contabili * _esc;
|
||||
|
||||
protected:
|
||||
|
||||
bool check_esercizio(const TString& cod, TDate s1, TDate f1);
|
||||
bool check_esercizio(const int cod, TDate s1, TDate f1);
|
||||
static bool mask_dataini (TMask_field&, KEY);
|
||||
static bool mask_newanno (TMask_field&, KEY);
|
||||
|
||||
public:
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
virtual void main_loop();
|
||||
|
||||
bool set();
|
||||
bool apertura_es();
|
||||
};
|
||||
|
||||
TAp_eser& app() { return (TAp_eser&) main_app(); }
|
||||
|
||||
bool TAp_eser::mask_newanno (TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
int newanno = f.mask().get_int(F_NUOVOANNO);
|
||||
TString16 codtab; codtab.format("%04d", newanno);
|
||||
TTable TabEs("ESC");
|
||||
TabEs.put ("CODTAB", codtab);
|
||||
if (TabEs.read() == NOERR)
|
||||
return f.warning_box ("Il codice %04d e' gia' presente nella tabella degli esercizi!",
|
||||
const int newanno = f.mask().get_int(F_NUOVOANNO);
|
||||
|
||||
if (app()._esc->exist(newanno))
|
||||
return f.warning_box (FR("Il codice %04d e' gia' presente nella tabella degli esercizi!"),
|
||||
newanno);
|
||||
}
|
||||
return TRUE;
|
||||
@ -42,11 +47,9 @@ bool TAp_eser::mask_dataini (TMask_field& f, KEY k)
|
||||
{
|
||||
TDate data(f.mask().get(F_DATAINI));
|
||||
TDate fine(f.mask().get(F_DATAFINC));
|
||||
|
||||
if ( data <= fine )
|
||||
{
|
||||
f.warning_box ("La data di inizio del nuovo esercizio deve essere superiore alla data di fine esercizio precedente");
|
||||
return FALSE;
|
||||
}
|
||||
return f.warning_box (TR("La data di inizio del nuovo esercizio deve essere superiore alla data di fine esercizio precedente"));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -55,140 +58,128 @@ bool TAp_eser::create()
|
||||
{
|
||||
open_files(LF_TAB, 0);
|
||||
enable_menu_item(M_FILE_NEW, FALSE);
|
||||
return TSkeleton_application::create();
|
||||
_esc = new TEsercizi_contabili;
|
||||
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
|
||||
bool TAp_eser::destroy()
|
||||
{
|
||||
delete _esc;
|
||||
|
||||
return TSkeleton_application::destroy();
|
||||
}
|
||||
|
||||
void TAp_eser::main_loop()
|
||||
{
|
||||
TTable TabEs ("ESC");
|
||||
TMask msk ("cg4500a");
|
||||
|
||||
if (TabEs.last() != NOERR)
|
||||
{
|
||||
error_box("Non e' ancora stato aperto alcun esercizio!");
|
||||
return;
|
||||
}
|
||||
TabEs.first();
|
||||
TRecnotype rn = TabEs.recno();
|
||||
int anno = TabEs.get_int ("CODTAB");
|
||||
TDate inizio = TabEs.get_date("D0"); //data inizio es. in corso
|
||||
TDate fine = TabEs.get_date("D1"); //data fine es. in corso
|
||||
int anno = _esc->last();
|
||||
|
||||
// determina esercizio con data fine piu' alta
|
||||
for ( ; !TabEs.eof(); TabEs.next())
|
||||
if (TabEs.get_date("D1") > fine)
|
||||
{
|
||||
rn = TabEs.recno();
|
||||
fine = TabEs.get_date("D1");
|
||||
_conserva = TabEs.get("S1");
|
||||
}
|
||||
|
||||
TabEs.readat(rn);
|
||||
// rilegge dati
|
||||
anno = TabEs.get_int ("CODTAB");
|
||||
inizio = TabEs.get_date("D0"); //data inizio es. in corso
|
||||
fine = TabEs.get_date("D1"); //data fine es. in corso
|
||||
if (anno > 0)
|
||||
{
|
||||
TMask msk ("cg4500a");
|
||||
msk.set_handler (F_NUOVOANNO, mask_newanno);
|
||||
msk.set_handler (F_DATAINI, mask_dataini);
|
||||
TDate inizio = _esc->esercizio(anno).inizio(); //data inizio es. in corso
|
||||
TDate fine = _esc->esercizio(anno).fine(); //data fine es. in corso
|
||||
|
||||
msk.set(F_ANNO, anno);
|
||||
msk.set(F_DATAINIC, inizio.string());
|
||||
msk.set(F_DATAFINC, fine.string());
|
||||
msk.set(F_ANNO, anno);
|
||||
msk.set(F_DATAINIC, inizio.string());
|
||||
msk.set(F_DATAFINC, fine.string());
|
||||
|
||||
msk.set_handler (F_NUOVOANNO, mask_newanno);
|
||||
msk.set_handler (F_DATAINI, mask_dataini);
|
||||
|
||||
if (msk.run() == K_ENTER)
|
||||
{
|
||||
_anno = msk.get_int(F_ANNO);
|
||||
_datainp = msk.get(F_DATAINIC);
|
||||
_datafip = msk.get(F_DATAFINC);
|
||||
_newanno = msk.get_int(F_NUOVOANNO); //nuovo anno esercizio
|
||||
_dataini = msk.get(F_DATAINI);
|
||||
_datafin = msk.get(F_DATAFIN);
|
||||
anno++;
|
||||
inizio.addyear();
|
||||
fine.addyear();
|
||||
|
||||
msk.set(F_NUOVOANNO, anno);
|
||||
msk.set(F_DATAINI, inizio.string());
|
||||
msk.set(F_DATAFIN, fine.string());
|
||||
if (msk.run() == K_ENTER)
|
||||
{
|
||||
_anno = msk.get_int(F_ANNO);
|
||||
_datainp = msk.get(F_DATAINIC);
|
||||
_datafip = msk.get(F_DATAFINC);
|
||||
_newanno = msk.get_int(F_NUOVOANNO); //nuovo anno esercizio
|
||||
_dataini = msk.get(F_DATAINI);
|
||||
_datafin = msk.get(F_DATAFIN);
|
||||
|
||||
apertura_es();
|
||||
}
|
||||
apertura_es();
|
||||
}
|
||||
}
|
||||
else
|
||||
error_box(TR("Non e' ancora stato aperto alcun esercizio!"));
|
||||
}
|
||||
|
||||
bool TAp_eser::apertura_es()
|
||||
{
|
||||
TTable TabReg ("REG");
|
||||
TTable TabEs ("ESC");
|
||||
TString anno (4);
|
||||
TString annonew(4);
|
||||
TString8 anno;
|
||||
TString8 annonew;
|
||||
TDate data;
|
||||
TRelation reg("REG");
|
||||
TRectype & tabreg = reg.curr();
|
||||
bool ok = FALSE;
|
||||
|
||||
//viene aggiornata la tabella dei registri. Se esisteva gia' un record relativo al nuovo esercizio, viene cancellato.
|
||||
//In ogni caso ne viene creato uno nuovo relativo al nuovo esercizio.
|
||||
TabReg.zero();
|
||||
anno.format ("%04d", _datafip.year());
|
||||
annonew.format("%04d", _datafin.year());
|
||||
TabReg.put ("CODTAB", annonew);
|
||||
|
||||
TRectype r (TabReg.curr());
|
||||
|
||||
TabReg.read(_isgteq);
|
||||
|
||||
for (; !TabReg.eof(); TabReg.next())
|
||||
{
|
||||
if (TabReg.curr() != r) break;
|
||||
|
||||
int tiporeg = TabReg.get_int("I0");
|
||||
if (tiporeg == 5)
|
||||
TabReg.remove();
|
||||
}
|
||||
|
||||
TabReg.zero();
|
||||
TRectype nuovo (TabReg.curr());
|
||||
anno.format ("%04d", _datafip.year());
|
||||
TabReg.put ("CODTAB", anno);
|
||||
tabreg.put ("CODTAB", annonew);
|
||||
|
||||
TRectype rec (TabReg.curr());
|
||||
|
||||
TabReg.read(_isgteq);
|
||||
|
||||
for (; !TabReg.eof(); TabReg.next())
|
||||
TCursor cur(®, "", 1, &tabreg, &tabreg);
|
||||
TRecnotype items = cur.items();
|
||||
|
||||
cur.freeze();
|
||||
for (cur = 0L; cur.pos() < items; ++cur)
|
||||
if (tabreg.get_int("I0") == 5)
|
||||
reg.remove();
|
||||
|
||||
cur.freeze(FALSE);
|
||||
tabreg.zero();
|
||||
tabreg.put ("CODTAB", anno);
|
||||
cur.setregion(tabreg, tabreg);
|
||||
|
||||
items = cur.items();
|
||||
|
||||
cur.freeze();
|
||||
for (cur = 0L; cur.pos() < items; ++cur)
|
||||
{
|
||||
if (TabReg.curr() != rec) break;
|
||||
|
||||
int tiporeg = TabReg.get_int("I0");
|
||||
TString cod_reg = TabReg.get("CODTAB");
|
||||
cod_reg = cod_reg.mid(4,3);
|
||||
if (tiporeg == 5)
|
||||
if (tabreg.get_int("I0") == 5)
|
||||
{
|
||||
TString16 cod(tabreg.get("CODTAB"));
|
||||
|
||||
ok = TRUE;
|
||||
nuovo = TabReg.curr();
|
||||
TString16 cod;
|
||||
annonew.format ("%04d", _datafin.year());
|
||||
cod << annonew << cod_reg;
|
||||
nuovo.put("CODTAB", cod);
|
||||
nuovo.put("D0", data);
|
||||
nuovo.put("D2", data);
|
||||
nuovo.put("D3", data);
|
||||
nuovo.put("I6", 0L);
|
||||
nuovo.put("I1", 0L);
|
||||
nuovo.put("R1", real(0.0));
|
||||
nuovo.put("R2", real(0.0));
|
||||
|
||||
TabReg.write(nuovo);
|
||||
annonew.format("%04d", _datafin.year());
|
||||
cod.overwrite(annonew);
|
||||
tabreg.put("CODTAB", cod);
|
||||
tabreg.zero("I1");
|
||||
tabreg.zero("I6");
|
||||
tabreg.zero("S1");
|
||||
tabreg.put("D0", data);
|
||||
tabreg.put("D2", data);
|
||||
tabreg.put("D3", data);
|
||||
tabreg.zero("R1");
|
||||
tabreg.zero("R2");
|
||||
|
||||
reg.write();
|
||||
}
|
||||
}
|
||||
// se tutto ok viene aggiornata la tabella degli esercizi
|
||||
annonew.format("%04d", _newanno);
|
||||
if (check_esercizio(annonew, _dataini, _datafin))
|
||||
if (check_esercizio(_newanno, _dataini, _datafin))
|
||||
{
|
||||
TabEs.zero();
|
||||
annonew.format ("%04d", _newanno);
|
||||
TabEs.put ("CODTAB", annonew);
|
||||
TabEs.put ("D0", _dataini);
|
||||
TabEs.put ("D1", _datafin);
|
||||
TabEs.put ("S1", _conserva);
|
||||
TabEs.write();
|
||||
message_box("Apertura nuovo esercizio completata");
|
||||
TTable tabesc("ESC");
|
||||
tabesc.zero();
|
||||
annonew.format("%04d", _newanno);
|
||||
tabesc.put ("CODTAB", annonew);
|
||||
tabesc.put ("D0", _dataini);
|
||||
tabesc.put ("D1", _datafin);
|
||||
tabesc.put ("S1", _conserva);
|
||||
tabesc.write();
|
||||
message_box(TR("Apertura nuovo esercizio completata"));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TAp_eser::check_esercizio(const TString& cod, TDate s1, TDate f1)
|
||||
bool TAp_eser::check_esercizio(const int cod_es, TDate s1, TDate f1)
|
||||
{
|
||||
// -----------------------------------------------------------------------------------------
|
||||
// chiamata prima di registrare. Controlla:
|
||||
@ -200,39 +191,40 @@ bool TAp_eser::check_esercizio(const TString& cod, TDate s1, TDate f1)
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
byte err = 0x00; bool ret = TRUE;
|
||||
TTable esc("ESC");
|
||||
|
||||
bool basta1 = FALSE, basta2 = FALSE;
|
||||
|
||||
for (esc.first(); !esc.eof(); esc.next())
|
||||
for (int cod = _esc->first(); cod > 0; cod = _esc->next(cod))
|
||||
{
|
||||
if (esc.get("CODTAB") == cod)
|
||||
continue;
|
||||
|
||||
TDate s2 = esc.get_date("D0");
|
||||
TDate f2 = esc.get_date("D1");
|
||||
TDate s1d = s1; --s1d;
|
||||
TDate s2d = s2; --s2d;
|
||||
if (cod != cod_es)
|
||||
{
|
||||
const TEsercizio & e = (*_esc)[cod];
|
||||
const TDate s2 = e.inizio();
|
||||
const TDate f2 = e.fine();
|
||||
|
||||
// check sovrapposizione
|
||||
if (s1 <= f2 && s2 <= f1)
|
||||
err |= 0x01;
|
||||
else
|
||||
{
|
||||
if (!basta1 && f1 < s2 && f1 != s2d)
|
||||
err |= 0x02;
|
||||
if (f1 < s2 && f1 == s2d)
|
||||
{
|
||||
err &= ~0x02;
|
||||
basta1 = TRUE;
|
||||
}
|
||||
if (!basta2 && s1 > f2 && f2 != s1d)
|
||||
err |= 0x04;
|
||||
if (s1 > f2 && f2 == s1d)
|
||||
{
|
||||
err &= ~0x04;
|
||||
basta2 = TRUE;
|
||||
}
|
||||
// check sovrapposizione
|
||||
if (s1 <= f2 && s2 <= f1)
|
||||
err |= 0x01;
|
||||
else
|
||||
{
|
||||
const TDate s1d(s1 - 1L);
|
||||
const TDate s2d(s2 - 1L);
|
||||
|
||||
if (!basta1 && f1 < s2 && f1 != s2d)
|
||||
err |= 0x02;
|
||||
if (f1 < s2 && f1 == s2d)
|
||||
{
|
||||
err &= ~0x02;
|
||||
basta1 = TRUE;
|
||||
}
|
||||
if (!basta2 && s1 > f2 && f2 != s1d)
|
||||
err |= 0x04;
|
||||
if (s1 > f2 && f2 == s1d)
|
||||
{
|
||||
err &= ~0x04;
|
||||
basta2 = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,18 +232,18 @@ bool TAp_eser::check_esercizio(const TString& cod, TDate s1, TDate f1)
|
||||
{
|
||||
ret = FALSE;
|
||||
TString errstr(120);
|
||||
errstr << "Date esercizio errate: \n";
|
||||
errstr << TR("Date esercizio errate: \n");
|
||||
// build error string
|
||||
if (err & 0x01)
|
||||
errstr << "\n - l'esercizio si sovrappone ad altro gia' esistente";
|
||||
errstr << TR("\n - l'esercizio si sovrappone ad altro gia' esistente");
|
||||
if (err & 0x02)
|
||||
errstr << "\n - l'esercizio non e' contiguo ad esercizi successivi";
|
||||
errstr << TR("\n - l'esercizio non e' contiguo ad esercizi successivi");
|
||||
if (err & 0x04)
|
||||
errstr << "\n - l'esercizio non e' contiguo ad esercizi precedenti";
|
||||
errstr << TR("\n - l'esercizio non e' contiguo ad esercizi precedenti");
|
||||
|
||||
if (!(err & 0x01))
|
||||
{
|
||||
errstr << "\nSi desidera registrare ugualmente?";
|
||||
errstr << TR("\nSi desidera registrare ugualmente?");
|
||||
ret = yesno_box(errstr);
|
||||
}
|
||||
else error_box(errstr);
|
||||
@ -266,17 +258,17 @@ int cg4500 (int argc, char* argv[])
|
||||
case 'C':
|
||||
{
|
||||
TAp_eser a;
|
||||
a.run(argc, argv, "Apertura nuovo esercizio");
|
||||
a.run(argc, argv, TR("Apertura nuovo esercizio"));
|
||||
}
|
||||
break;
|
||||
case 'I':
|
||||
{
|
||||
TAp_iva a;
|
||||
a.run(argc, argv, "Apertura nuovo esercizio IVA");
|
||||
a.run(argc, argv, TR("Apertura nuovo esercizio IVA"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
error_box("Uso: cg4 -4 [C,I]");
|
||||
error_box("Uso: cg4 -4 [C,I]");
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
|
271
cg/cg4501.cpp
271
cg/cg4501.cpp
@ -1,222 +1,163 @@
|
||||
#include <recarray.h>
|
||||
#include <relation.h>
|
||||
|
||||
#include "cg4501.h"
|
||||
#include "cg4500b.h"
|
||||
|
||||
#include "nditte.h"
|
||||
|
||||
bool TAp_iva::mask_annoiva (TMask_field& f, KEY k)
|
||||
{
|
||||
if ( (k == K_ENTER) && f.to_check(k) )
|
||||
//if ( (k == K_TAB) && f.mask().is_running() )
|
||||
{
|
||||
int annoiva = f.mask().get_int(F_ANNOIVA);
|
||||
TConfig conf(CONFIG_DITTA);
|
||||
int annoivap = conf.get_int("AnLiIv");
|
||||
if (annoivap > 0 && annoiva != annoivap + 1)
|
||||
return f.error_box("Il nuovo anno esercizio IVA deve essere %d", (annoivap+1));
|
||||
return f.error_box(FR("Il nuovo anno esercizio IVA deve essere %d"), (annoivap+1));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TAp_iva::create()
|
||||
{
|
||||
_nditte = new TLocalisamfile(LF_NDITTE);
|
||||
_reg = new TTable("REG");
|
||||
_lia = new TTable("%LIA");
|
||||
_lbu = new TTable("%LBU");
|
||||
|
||||
open_files(LF_TAB, LF_TABCOM, LF_NDITTE, 0);
|
||||
enable_menu_item(M_FILE_NEW, FALSE);
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
|
||||
bool TAp_iva::destroy()
|
||||
{
|
||||
delete _nditte;
|
||||
delete _reg;
|
||||
delete _lia;
|
||||
delete _lbu;
|
||||
|
||||
return TRUE;
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
|
||||
bool TAp_iva::apertura_iva()
|
||||
{
|
||||
TTable TabReg ("REG");
|
||||
TTable TabLia ("%LIA");
|
||||
TTable TabLbu ("%LBU");
|
||||
TLocalisamfile nditte (LF_NDITTE);
|
||||
TString annoiva (4), codlia(10);
|
||||
TString16 annoiva;
|
||||
TString16 codlia;
|
||||
TDate data;
|
||||
bool ok = FALSE;
|
||||
|
||||
int annop = _annop;
|
||||
annoiva.format("%04d", _annoiva);
|
||||
|
||||
//viene aggiornata la tabella LIA (liquidazione iva annuale)
|
||||
TabLia.zero();
|
||||
TTable tablia ("%LIA");
|
||||
|
||||
codlia.format("%05ld%04d", get_firm(), _annoiva);
|
||||
TabLia.put ("CODTAB", codlia);
|
||||
if (TabLia.read() == NOERR)
|
||||
TabLia.remove();
|
||||
tablia.put ("CODTAB", codlia);
|
||||
if (tablia.read() == NOERR)
|
||||
tablia.remove();
|
||||
|
||||
TabLia.zero();
|
||||
TRectype newrec (TabLia.curr());
|
||||
tablia.zero();
|
||||
codlia.format("%05ld%04d", get_firm(), annop);
|
||||
TabLia.put ("CODTAB", codlia);
|
||||
tablia.put ("CODTAB", codlia);
|
||||
|
||||
if (TabLia.read() == NOERR)
|
||||
if (tablia.read() != NOERR)
|
||||
return error_box(TR("Non esiste il record relativo all'anno iva precedente sulla tabella liquidazione annuale iva"));
|
||||
else
|
||||
{
|
||||
ok = TRUE;
|
||||
newrec = TabLia.curr();
|
||||
codlia.format("%05ld%04d", get_firm(), _annoiva);
|
||||
newrec.put("CODTAB", codlia);
|
||||
newrec.put("S7", _frequenza);
|
||||
newrec.put("B2", _is_minagr);
|
||||
newrec.zero("R0");
|
||||
TabLia.write(newrec);
|
||||
tablia.put("CODTAB", codlia);
|
||||
tablia.put("S7", _frequenza);
|
||||
tablia.put("B2", _is_minagr);
|
||||
tablia.zero("R0");
|
||||
tablia.write();
|
||||
}
|
||||
if (!ok)
|
||||
{
|
||||
error_box("Non esiste il record relativo all'anno iva precedente sulla tabella liquidazione annuale iva");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//viene aggiornata la tabella del libro unico.
|
||||
TabLbu.zero();
|
||||
TabLbu.put ("CODTAB", annoiva);
|
||||
|
||||
TRectype r (TabLbu.curr());
|
||||
|
||||
TabLbu.read(_isgteq);
|
||||
|
||||
for (; !TabLbu.eof(); TabLbu.next())
|
||||
{
|
||||
if (TabLbu.curr() != r) break;
|
||||
|
||||
TabLbu.remove();
|
||||
}
|
||||
TRelation lbu("%LBU");
|
||||
TRectype & tablbu = lbu.curr();
|
||||
|
||||
ok = FALSE;
|
||||
TabLbu.zero();
|
||||
TRectype nrec (TabLbu.curr());
|
||||
TabLbu.put ("CODTAB", _annop);
|
||||
tablbu.put ("CODTAB", annoiva);
|
||||
|
||||
TRectype rec (TabLbu.curr());
|
||||
TCursor cur(&lbu, "", 1, &tablbu, &tablbu);
|
||||
TRecnotype items = cur.items();
|
||||
|
||||
TabLbu.read(_isgteq);
|
||||
cur.freeze();
|
||||
|
||||
for (cur = 0L; cur.pos() < items; ++cur)
|
||||
lbu.remove();
|
||||
|
||||
cur.freeze(FALSE);
|
||||
tablbu.zero();
|
||||
tablbu.put ("CODTAB", _annop);
|
||||
cur.setregion(tablbu, tablbu);
|
||||
items = cur.items();
|
||||
|
||||
for (; !TabLbu.eof(); TabLbu.next())
|
||||
cur.freeze();
|
||||
|
||||
for (cur = 0L; cur.pos() < items; ++cur)
|
||||
{
|
||||
if (TabLbu.curr() != rec) break;
|
||||
TString16 cod(tablbu.get("CODTAB"));
|
||||
|
||||
TRecnotype nr = TabLbu.recno();
|
||||
TString cod_lib = TabLbu.get("CODTAB");
|
||||
cod_lib = cod_lib.mid(4,3);
|
||||
ok = TRUE;
|
||||
nrec = TabLbu.curr();
|
||||
TString16 cod;
|
||||
cod << _annoiva << cod_lib;
|
||||
nrec.put("CODTAB", cod);
|
||||
nrec.put("I0", 0L);
|
||||
|
||||
TabLbu.write(nrec);
|
||||
TabLbu.readat(nr);
|
||||
cod.overwrite(annoiva);
|
||||
tablbu.put("CODTAB", cod);
|
||||
tablbu.zero("I0");
|
||||
lbu.write();
|
||||
}
|
||||
/*
|
||||
if (!ok)
|
||||
{
|
||||
error_box("Non esistono i registri del libro unico relativi all'anno iva precedente");
|
||||
return FALSE;
|
||||
}
|
||||
*/
|
||||
|
||||
//viene aggiornata la tabella dei registri.
|
||||
TabReg.zero();
|
||||
TabReg.put ("CODTAB", annoiva);
|
||||
TRelation reg("REG");
|
||||
TRectype & tabreg = reg.curr();
|
||||
|
||||
tabreg.put ("CODTAB", annoiva);
|
||||
|
||||
const TRectype rr (TabReg.curr());
|
||||
|
||||
TabReg.read(_isgteq);
|
||||
|
||||
for (; !TabReg.eof(); TabReg.next())
|
||||
TCursor cur_reg(®, "", 1, &tabreg, &tabreg);
|
||||
|
||||
items = cur_reg.items();
|
||||
cur_reg.freeze();
|
||||
for (cur_reg = 0L; cur_reg.pos() < items; ++cur_reg)
|
||||
{
|
||||
if (TabReg.curr() != rr) break;
|
||||
|
||||
int tiporeg = TabReg.get_int("I0");
|
||||
if ( (tiporeg == 1)||(tiporeg == 2)||(tiporeg == 3)||(tiporeg==9))
|
||||
TabReg.remove();
|
||||
const int tiporeg = tabreg.get_int("I0");
|
||||
if ((tiporeg == 1) || (tiporeg == 2) || (tiporeg == 3) || (tiporeg==9))
|
||||
reg.remove();
|
||||
}
|
||||
|
||||
ok = FALSE;
|
||||
TabReg.zero();
|
||||
TRectype nuovo (TabReg.curr());
|
||||
TabReg.put ("CODTAB", _annop);
|
||||
|
||||
const TRectype recc (TabReg.curr());
|
||||
|
||||
TabReg.read(_isgteq);
|
||||
|
||||
for (; !TabReg.eof(); TabReg.next())
|
||||
cur_reg.freeze(FALSE);
|
||||
tabreg.zero();
|
||||
tabreg.put ("CODTAB", _annop);
|
||||
cur_reg.setregion(tabreg, tabreg);
|
||||
items = cur_reg.items();
|
||||
cur_reg.freeze();
|
||||
for (cur_reg = 0L; cur_reg.pos() < items; ++cur_reg)
|
||||
{
|
||||
if (TabReg.curr() != recc) break;
|
||||
|
||||
TRecnotype nr = TabReg.recno();
|
||||
int tiporeg = TabReg.get_int("I0");
|
||||
TString cod_reg = TabReg.get("CODTAB");
|
||||
//TDate data_vid = TabReg.get_date("D0");
|
||||
//data_vid.addyear();
|
||||
cod_reg = cod_reg.mid(4,3);
|
||||
int tiporeg = tabreg.get_int("I0");
|
||||
if ( (tiporeg == 1)||(tiporeg == 2)||(tiporeg==3)||(tiporeg==9))
|
||||
{
|
||||
ok = TRUE;
|
||||
nuovo = TabReg.curr();
|
||||
TString16 cod;
|
||||
cod << annoiva << cod_reg;
|
||||
nuovo.put("CODTAB", cod);
|
||||
nuovo.put("I1", 0L);
|
||||
nuovo.put("I2", 0L);
|
||||
nuovo.put("I4", 0L);
|
||||
nuovo.put("I5", 0L);
|
||||
nuovo.put("I6", 0L);
|
||||
nuovo.put("S1", "");
|
||||
//nuovo.put("D0", data_vid);
|
||||
nuovo.put("D0", data);
|
||||
nuovo.put("D2", data);
|
||||
nuovo.put("D3", data);
|
||||
nuovo.put("R1", real(0.0));
|
||||
nuovo.put("R2", real(0.0));
|
||||
TString16 cod = tabreg.get("CODTAB");
|
||||
|
||||
cod.overwrite(annoiva);
|
||||
tabreg.put("CODTAB", cod);
|
||||
tabreg.zero("I1");
|
||||
tabreg.zero("I2");
|
||||
tabreg.zero("I4");
|
||||
tabreg.zero("I5");
|
||||
tabreg.zero("I6");
|
||||
tabreg.zero("S1");
|
||||
tabreg.put("D0", data);
|
||||
tabreg.put("D2", data);
|
||||
tabreg.put("D3", data);
|
||||
tabreg.zero("R1");
|
||||
tabreg.zero("R2");
|
||||
|
||||
TabReg.write(nuovo);
|
||||
TabReg.readat(nr);
|
||||
reg.write();
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (!ok)
|
||||
{
|
||||
error_box("Non esistono i registri iva relativi all'anno iva precedente");
|
||||
return FALSE;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
//viene aggiornato l'anno iva sui parametri ditta
|
||||
TConfig conf(CONFIG_DITTA);
|
||||
conf.set("AnLiIv", annoiva);
|
||||
|
||||
//sull'anagrafica ditte viene aggiornata la frequenza versamento
|
||||
nditte.zero();
|
||||
TLocalisamfile nditte (LF_NDITTE);
|
||||
|
||||
nditte.put("CODDITTA", _ditta);
|
||||
if (nditte.read() == NOERR)
|
||||
if (nditte.read(_isequal, _lock) == NOERR)
|
||||
{
|
||||
nditte.put(NDT_FREQVIVA, _frequenza);
|
||||
nditte.rewrite();
|
||||
}
|
||||
message_box("Apertura nuovo esercizio IVA completata");
|
||||
message_box(TR("Apertura nuovo esercizio IVA completata"));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TAp_iva::main_loop()
|
||||
{
|
||||
TTable TabLia ("%LIA");
|
||||
TLocalisamfile nditte (LF_NDITTE);
|
||||
TMask msk ("cg4500b");
|
||||
|
||||
TConfig conf(CONFIG_DITTA);
|
||||
@ -227,31 +168,37 @@ void TAp_iva::main_loop()
|
||||
int anno = aivap+1;
|
||||
_is_minagr = FALSE;
|
||||
|
||||
TabLia.zero();
|
||||
TString16 chiave; chiave.format("%05ld%04d", get_firm(), anno);
|
||||
TabLia.put("CODTAB",chiave);
|
||||
if (TabLia.read() == NOERR)
|
||||
TTable tablia ("%LIA");
|
||||
TString16 chiave;
|
||||
|
||||
tablia.zero();
|
||||
chiave.format("%05ld%04d", get_firm(), anno);
|
||||
tablia.put("CODTAB",chiave);
|
||||
if (tablia.read() == NOERR)
|
||||
{
|
||||
msk.set(F_FREQUENZA, TabLia.get("S7"));
|
||||
_is_minagr = TabLia.get_bool("B2");
|
||||
msk.set(F_FREQUENZA, tablia.get("S7"));
|
||||
_is_minagr = tablia.get_bool("B2");
|
||||
}
|
||||
else
|
||||
{
|
||||
TabLia.zero();
|
||||
tablia.zero();
|
||||
chiave = "";
|
||||
chiave.format("%05ld%04d", get_firm(), aivap);
|
||||
TabLia.put("CODTAB", chiave);
|
||||
if (TabLia.read() == NOERR)
|
||||
tablia.put("CODTAB", chiave);
|
||||
if (tablia.read() == NOERR)
|
||||
{
|
||||
msk.set(F_FREQUENZA, TabLia.get("S7"));
|
||||
_is_minagr = TabLia.get_bool("B2");
|
||||
msk.set(F_FREQUENZA, tablia.get("S7"));
|
||||
_is_minagr = tablia.get_bool("B2");
|
||||
}
|
||||
else
|
||||
{
|
||||
nditte.zero();
|
||||
nditte.put("CODDITTA", get_firm());
|
||||
if (nditte.read() == NOERR)
|
||||
msk.set(F_FREQUENZA, nditte.get(NDT_FREQVIVA));
|
||||
{
|
||||
TString16 key;
|
||||
|
||||
key.format("%ld", get_firm());
|
||||
|
||||
const TString & freq_iva = cache().get(LF_NDITTE, key, NDT_FREQVIVA);
|
||||
|
||||
msk.set(F_FREQUENZA, freq_iva);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,7 @@
|
||||
|
||||
class TAp_iva : public TSkeleton_application
|
||||
{
|
||||
TTable* _reg, * _lia, * _lbu;
|
||||
TLocalisamfile* _nditte;
|
||||
// TTable* _reg, * _lia, * _lbu;
|
||||
int _annoiva;
|
||||
int _annop;
|
||||
long _ditta;
|
||||
@ -25,7 +24,7 @@ protected:
|
||||
|
||||
public:
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
virtual bool destroy() { return TRUE;}
|
||||
virtual void main_loop();
|
||||
|
||||
bool setta();
|
||||
|
744
cg/cg4600.cpp
744
cg/cg4600.cpp
File diff suppressed because it is too large
Load Diff
@ -86,12 +86,9 @@ bool GesAcc_app::msk_credito(TMask_field& f, KEY k)
|
||||
real credito (f.get());
|
||||
real acconto (f.mask().get(F_ACCONTO));
|
||||
if (credito.sign() < 0)
|
||||
return f.error_box("Introdurre un valore non negativo");
|
||||
return f.error_box(TR("Introdurre un valore non negativo"));
|
||||
if (credito > acconto)
|
||||
return f.error_box("Il credito non puo' essere superiore all'acconto");
|
||||
if (acconto.is_zero())
|
||||
if (!credito.is_zero())
|
||||
return f.error_box("Non e' possibile indicare il credito se l'acconto e' nullo");
|
||||
return f.error_box(TR("Il credito non puo' essere superiore all'acconto"));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -114,16 +111,16 @@ bool GesAcc_app::msk_acconto(TMask_field& f, KEY k)
|
||||
const TMask& m = f.mask();
|
||||
TInteressi_IVA_table ver;
|
||||
if (ver.read(m.get_int(F_ANNO),12)!=NOERR)
|
||||
warning_box("Errore %d in lettura tabella versamenti ed interessi.",ver.status());
|
||||
warning_box(FR("Errore %d in lettura tabella versamenti ed interessi."),ver.status());
|
||||
const TCurrency acconto_minimo = ver.get(I_ACCONTOIVA);
|
||||
|
||||
const TCurrency acconto = real(f.get());
|
||||
if (!acconto.is_zero())
|
||||
{
|
||||
if (acconto.sign() < 0)
|
||||
return f.error_box("Introdurre un valore non negativo");
|
||||
return f.error_box(TR("Introdurre un valore non negativo"));
|
||||
if (acconto < acconto_minimo)
|
||||
return f.error_box("L'importo dell'acconto inserito deve essere superiore a %s", acconto_minimo.string(TRUE));
|
||||
return f.error_box(FR("L'importo dell'acconto inserito deve essere superiore a %s"), acconto_minimo.string(TRUE));
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
@ -137,6 +134,6 @@ TMask* GesAcc_app::get_mask(int /* mode */)
|
||||
int cg4700(int argc, char* argv[])
|
||||
{
|
||||
GesAcc_app app;
|
||||
app.run(argc, argv, "Gestione acconti");
|
||||
app.run(argc, argv, TR("Gestione acconti"));
|
||||
return 0;
|
||||
}
|
||||
|
229
cg/cg4800.cpp
229
cg/cg4800.cpp
@ -3,6 +3,7 @@
|
||||
#include <currency.h>
|
||||
#include <mask.h>
|
||||
#include <tabutil.h>
|
||||
#include <recarray.h>
|
||||
#include <relation.h>
|
||||
#include <sheet.h>
|
||||
#include <urldefid.h>
|
||||
@ -25,11 +26,6 @@ class VersAcc_app : public TApplication
|
||||
TBit_array _selected;
|
||||
|
||||
TInteressi_IVA_table* _ver;
|
||||
TTable* _lim;
|
||||
TTable* _lia;
|
||||
TTable* _del;
|
||||
TTable* _ban;
|
||||
TTable* _ucc;
|
||||
TProgind* _prind;
|
||||
|
||||
int _year;
|
||||
@ -57,12 +53,12 @@ public:
|
||||
void lettura_delega();
|
||||
void lettura_anagrafica(bool*);
|
||||
void crea_riga_stampa(bool);
|
||||
void aggiorna_delega();
|
||||
void crea_delega();
|
||||
void aggiorna_delega(TTable & del);
|
||||
void crea_delega(TTable & del);
|
||||
void vers_acc();
|
||||
|
||||
bool look_lia();
|
||||
bool video_conferma();
|
||||
bool video_conferma(TTable & del);
|
||||
bool check_acc();
|
||||
|
||||
VersAcc_app() : _ditte(NULL), _selected(10000), _nomiditte(100), _desc(100) {}
|
||||
@ -70,43 +66,32 @@ public:
|
||||
|
||||
bool VersAcc_app::look_lia()
|
||||
{
|
||||
TTable lia("%LIA");
|
||||
TString16 y;
|
||||
|
||||
y.format("%05ld%04d", _nditte->lfile().get_long("CODDITTA"), _year);
|
||||
|
||||
TString16 y; y.format("%05ld%04d", _nditte->lfile().get_long("CODDITTA"), _year);
|
||||
|
||||
lia.zero();
|
||||
lia.put("CODTAB", y);
|
||||
lia.read();
|
||||
const bool ok = lia.good();
|
||||
if (ok)
|
||||
{
|
||||
_acconto = lia.get_real("R4");
|
||||
_credito = lia.get_real("R6");
|
||||
}
|
||||
else
|
||||
{
|
||||
_acconto = ZERO;
|
||||
_credito = ZERO;
|
||||
}
|
||||
return ok;
|
||||
const TRectype & lia = cache().get("%LIA", y);
|
||||
|
||||
_acconto = lia.get_real("R4");
|
||||
_credito = lia.get_real("R6");
|
||||
|
||||
return !lia.empty();
|
||||
|
||||
}
|
||||
|
||||
bool VersAcc_app::create()
|
||||
{
|
||||
TApplication::create();
|
||||
|
||||
_nditte = new TRelation(LF_NDITTE);
|
||||
open_files(LF_TABCOM, LF_TAB, LF_NDITTE, LF_ANAG, LF_COMUNI, 0);
|
||||
|
||||
_nditte = new TRelation(LF_NDITTE);
|
||||
_nditte->add(LF_ANAG, "TIPOA=TIPOA|CODANAGR=CODANAGR");
|
||||
_nditte->add(LF_COMUNI, "COM=COMRF(COMRES)", 1, LF_ANAG);
|
||||
|
||||
_ditte = new TArray_sheet(-1, -1, -4, -4, "Selezione Ditte",
|
||||
"@1|Cod.@5R|Ragione Sociale@50|Vers.");
|
||||
_ditte = new TArray_sheet(-1, -1, -4, -4, TR("Selezione Ditte"),
|
||||
HR("@1|Cod.@5R|Ragione Sociale@50|Vers."));
|
||||
_ver = new TInteressi_IVA_table();
|
||||
_del = new TTable("%DEL");
|
||||
_lia = new TTable("%LIA");
|
||||
_ban = new TTable("%BAN");
|
||||
_ucc = new TTable("%UCC");
|
||||
_lim = new TTable("LIM");
|
||||
|
||||
TConfig c (CONFIG_STUDIO, "cg");
|
||||
_abips = c.get("CodABI");
|
||||
@ -128,11 +113,6 @@ bool VersAcc_app::create()
|
||||
bool VersAcc_app::destroy()
|
||||
{
|
||||
delete _ver;
|
||||
delete _lim;
|
||||
delete _lia;
|
||||
delete _del;
|
||||
delete _ban;
|
||||
delete _ucc;
|
||||
delete _ditte;
|
||||
delete _nditte;
|
||||
|
||||
@ -174,33 +154,31 @@ void VersAcc_app::build_nomiditte()
|
||||
{
|
||||
_nomiditte.destroy();
|
||||
// ricostruire _nomiditte e rifare build_ditte_sheet
|
||||
TLocalisamfile& dt = _nditte->lfile();
|
||||
TString fr(2);
|
||||
TTable lia("%LIA");
|
||||
TCursor cur(_nditte, "", 1);
|
||||
TRectype & dt = _nditte->curr();
|
||||
const TRecnotype items = cur.items();
|
||||
|
||||
for (dt.first(); !dt.eof(); dt.next())
|
||||
for (cur = 0L; cur.pos() < items; ++cur)
|
||||
{
|
||||
// check no archivi
|
||||
fr = "??";
|
||||
bool good = prefix().exist(dt.get_long("CODDITTA"));
|
||||
|
||||
if (good)
|
||||
if (prefix().exist(dt.get_long("CODDITTA")))
|
||||
{
|
||||
// check no parametri liquidazione
|
||||
lia.put("CODTAB", format("%05ld%d",dt.get_long("CODDITTA"),_year));
|
||||
if (lia.read() != NOERR) good = FALSE;
|
||||
else fr = lia.get("S7");
|
||||
}
|
||||
else continue;
|
||||
TString key;
|
||||
TToken_string d;
|
||||
|
||||
// add record
|
||||
d.add(dt.get_long("CODDITTA"));
|
||||
d.add(dt.get("RAGSOC"));
|
||||
|
||||
key.format("%05ld%d", dt.get_long("CODDITTA"), _year);
|
||||
|
||||
const TRectype & lia = cache().get("%LIA", key);
|
||||
|
||||
d.add(lia.empty() ? "??" : lia.get("S7"));
|
||||
_nomiditte.add(d);
|
||||
}
|
||||
|
||||
TToken_string* d = new TToken_string(64);
|
||||
|
||||
// add record
|
||||
d->add(dt.get_long("CODDITTA"));
|
||||
d->add(dt.get("RAGSOC"));
|
||||
d->add(fr);
|
||||
|
||||
_nomiditte.add(d);
|
||||
}
|
||||
}
|
||||
|
||||
@ -217,7 +195,7 @@ bool VersAcc_app::menu(MENU_TAG)
|
||||
print();
|
||||
}
|
||||
}
|
||||
else warning_box("Nessuna ditta selezionata!");
|
||||
else warning_box(TR("Nessuna ditta selezionata!"));
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@ -272,13 +250,13 @@ void VersAcc_app::vers_acc()
|
||||
_da_stampare = _print = FALSE;
|
||||
|
||||
_prind = new TProgind(_calcall ? 0l : _selected.ones(),
|
||||
" Creazione versam. acconti \n"
|
||||
" preparazione archivi \n"
|
||||
" \n",
|
||||
TRUE,TRUE,30);
|
||||
TR(" Creazione versam. acconti \n"
|
||||
" preparazione archivi \n"
|
||||
" \n"),
|
||||
TRUE, TRUE);
|
||||
|
||||
if (_ver->read(_year,12)!=NOERR)
|
||||
warning_box("Errore %d in lettura tabella versamenti ed interessi.",_ver->status());
|
||||
warning_box(FR("Errore %d in lettura tabella versamenti ed interessi."),_ver->status());
|
||||
_acconto_minimo = _ver->get(I_ACCONTOIVA);
|
||||
for (int l = 0; l < _ditte->items(); l++)
|
||||
{
|
||||
@ -302,7 +280,7 @@ void VersAcc_app::vers_acc()
|
||||
|
||||
if (!look_lia()) continue;
|
||||
|
||||
sprintf (buf,"Creazione vers. acconti:\nditta %s\n ",
|
||||
sprintf (buf,FR("Creazione vers. acconti:\nditta %s\n "),
|
||||
(const char*)_nditte->lfile().get("RAGSOC"));
|
||||
_prind->set_text(buf);
|
||||
|
||||
@ -327,13 +305,13 @@ void VersAcc_app::print()
|
||||
|
||||
TPrintrow row;
|
||||
|
||||
row.put("Gestione iva", 0);
|
||||
row.put("Data @>", 106);
|
||||
row.put("Pag.@#", 124);
|
||||
row.put(TR("Gestione iva"), 0);
|
||||
row.put(FR("Data @>"), 106);
|
||||
row.put(FR("Pag.@#"), 124);
|
||||
printer().setheaderline(0,row);
|
||||
|
||||
row.reset();
|
||||
TString256 t("@bCREAZIONE VERSAMENTI PER ACCONTI DICEMBRE");
|
||||
TString256 t(FR("@bCREAZIONE VERSAMENTI PER ACCONTI DICEMBRE"));
|
||||
t <<' '<<_year;
|
||||
row.put(t,34);
|
||||
printer().setheaderline(1,row);
|
||||
@ -346,12 +324,12 @@ void VersAcc_app::print()
|
||||
printer().setheaderline(4,row);
|
||||
|
||||
row.reset();
|
||||
row.put("Ditta",0);
|
||||
row.put("Denominazione",7);
|
||||
row.put("Importo",46);
|
||||
row.put("Banca",55);
|
||||
row.put("Dipendenza",62);
|
||||
row.put("Concessione",74);
|
||||
row.put(TR("Ditta"),0);
|
||||
row.put(TR("Denominazione"),7);
|
||||
row.put(TR("Importo"),46);
|
||||
row.put(TR("Banca"),55);
|
||||
row.put(TR("Dipendenza"),62);
|
||||
row.put(TR("Concessione"),74);
|
||||
printer().setheaderline(3,row);
|
||||
|
||||
for (int i = 0; i < _desc.items(); i++)
|
||||
@ -414,36 +392,36 @@ void VersAcc_app::lettura_delega()
|
||||
|
||||
cod << y << _year << 12 << 7;
|
||||
|
||||
_del->zero();
|
||||
_del->put("CODTAB", cod);
|
||||
|
||||
if (_del->read() == NOERR)
|
||||
TTable del("%DEL");
|
||||
|
||||
del.put("CODTAB", cod);
|
||||
if (del.read() == NOERR)
|
||||
{
|
||||
if (_diff < minimo) //l'importo non e' dovuto
|
||||
{
|
||||
//cancello la delega
|
||||
_del->remove();
|
||||
del.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
// se sono qui e' perche' l'importo e' dovuto (_diff >= minimo)
|
||||
bool stampata = _del->get_bool("B0");
|
||||
bool stampata = del.get_bool("B0");
|
||||
|
||||
_impver = _del->get_real("R0");
|
||||
_dataver = _del->get_date("D0");
|
||||
_impver = del.get_real("R0");
|
||||
_dataver = del.get_date("D0");
|
||||
|
||||
if (stampata)
|
||||
{
|
||||
_abi = _del->get("S7");
|
||||
_cab = _del->get("S8");
|
||||
_con = _del->get("S9");
|
||||
_abi = del.get("S7");
|
||||
_cab = del.get("S8");
|
||||
_con = del.get("S9");
|
||||
if (_diff != _impver)
|
||||
video_conferma();
|
||||
video_conferma(del);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
aggiorna_delega();
|
||||
aggiorna_delega(del);
|
||||
_da_stampare = TRUE;
|
||||
}
|
||||
}
|
||||
@ -452,38 +430,38 @@ void VersAcc_app::lettura_delega()
|
||||
if (_diff >= minimo)
|
||||
//creo record delega
|
||||
{
|
||||
crea_delega();
|
||||
crea_delega(del);
|
||||
_da_stampare = TRUE;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void VersAcc_app::crea_delega()
|
||||
void VersAcc_app::crea_delega(TTable & del)
|
||||
{
|
||||
TString16 y (format("%05ld", _nditte->lfile().get_long("CODDITTA")));
|
||||
TString16 cod;
|
||||
|
||||
cod << y << _year << 12 << 7;
|
||||
|
||||
_del->zero();
|
||||
_del->put("CODTAB", cod);
|
||||
_del->put("S7", _abi);
|
||||
_del->put("S8", _cab);
|
||||
_del->put("S9", _con);
|
||||
_del->put("R0", _diff);
|
||||
del.zero();
|
||||
del.put("CODTAB", cod);
|
||||
del.put("S7", _abi);
|
||||
del.put("S8", _cab);
|
||||
del.put("S9", _con);
|
||||
del.put("R0", _diff);
|
||||
|
||||
_del->write();
|
||||
del.write();
|
||||
}
|
||||
|
||||
void VersAcc_app::aggiorna_delega()
|
||||
void VersAcc_app::aggiorna_delega(TTable & del)
|
||||
{
|
||||
_del->put("S7", _abi);
|
||||
_del->put("S8", _cab);
|
||||
_del->put("S9", _con);
|
||||
_del->put("R0", _diff);
|
||||
del.put("S7", _abi);
|
||||
del.put("S8", _cab);
|
||||
del.put("S9", _con);
|
||||
del.put("R0", _diff);
|
||||
|
||||
_del->rewrite();
|
||||
del.rewrite();
|
||||
}
|
||||
|
||||
static real pezza_euro(real n)
|
||||
@ -523,11 +501,8 @@ void VersAcc_app::lettura_anagrafica(bool* tipo)
|
||||
{
|
||||
*tipo = FALSE;
|
||||
_con = "";
|
||||
//const long codabi = anag.get_long("CODABI");
|
||||
//const long codcab = anag.get_long("CODCAB");
|
||||
const long codabi = _nditte->lfile().get_long("ABIBAN");
|
||||
const long codcab = _nditte->lfile().get_long("CABBAN");
|
||||
//if (codabi != 0 || codcab != 0)
|
||||
if (codabi != 0 && codcab != 0)
|
||||
{
|
||||
_abi = format("%05ld", codabi);
|
||||
@ -536,7 +511,7 @@ void VersAcc_app::lettura_anagrafica(bool* tipo)
|
||||
}
|
||||
}
|
||||
|
||||
bool VersAcc_app::video_conferma()
|
||||
bool VersAcc_app::video_conferma(TTable & del)
|
||||
{
|
||||
TMask m("cg4800b");
|
||||
|
||||
@ -557,13 +532,13 @@ bool VersAcc_app::video_conferma()
|
||||
{
|
||||
case K_SAVE:
|
||||
{
|
||||
KEY k = yesnocancel_box("Delega gia' stampata. Si desidera ugualmente confermare l'aggiornamento?");
|
||||
KEY k = yesnocancel_box(TR("Delega gia' stampata. Si desidera ugualmente confermare l'aggiornamento?"));
|
||||
if (k == K_YES)
|
||||
{
|
||||
_da_stampare = TRUE;
|
||||
_del->put("R0",_diff);
|
||||
_del->put("B0", "");
|
||||
_del->rewrite();
|
||||
del.put("R0",_diff);
|
||||
del.put("B0", "");
|
||||
del.rewrite();
|
||||
}
|
||||
if (k == K_YES || k == K_NO)
|
||||
stop = TRUE;
|
||||
@ -586,26 +561,19 @@ void VersAcc_app::crea_riga_stampa(bool tipost)
|
||||
if (tipost) //prendo la descrizione dell'ufficio concessione
|
||||
{
|
||||
if (_con.not_empty())
|
||||
{
|
||||
TTable ucc("%UCC");
|
||||
ucc.zero();
|
||||
ucc.put("CODTAB", _con);
|
||||
if (ucc.read() == NOERR)
|
||||
desc = ucc.get("S0");
|
||||
}
|
||||
desc = cache().get("%UCC", _con, "S0");
|
||||
}
|
||||
else //prendo la descrizione della banca
|
||||
{
|
||||
if (_abi.not_empty())
|
||||
{
|
||||
TTable ban("%BAN");
|
||||
TString16 cod;
|
||||
cod = _abi; if (!_cab.empty()) cod << _cab;
|
||||
ban.zero();
|
||||
ban.put("CODTAB", cod);
|
||||
if (ban.read() == NOERR)
|
||||
desc = ban.get("S0");
|
||||
}
|
||||
TString16 key;
|
||||
|
||||
key = _abi;
|
||||
if (!_cab.empty())
|
||||
key << _cab;
|
||||
desc = cache().get("%BAN", key, "S0");
|
||||
}
|
||||
}
|
||||
|
||||
tt->add(_nditte->lfile().get("CODDITTA"));
|
||||
@ -617,12 +585,13 @@ void VersAcc_app::crea_riga_stampa(bool tipost)
|
||||
tt->add(desc);
|
||||
tt->add(tipost);
|
||||
|
||||
if (tt != NULL) _desc.add(tt);
|
||||
if (tt != NULL)
|
||||
_desc.add(tt);
|
||||
}
|
||||
|
||||
int cg4800(int argc, char* argv[])
|
||||
{
|
||||
VersAcc_app app;
|
||||
app.run(argc, argv, "Creazione versam. acconti dicembre");
|
||||
app.run(argc, argv, TR("Creazione versam. acconti dicembre"));
|
||||
return 0;
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
#include <currency.h>
|
||||
#include <mask.h>
|
||||
#include <tabutil.h>
|
||||
#include <recarray.h>
|
||||
#include <relation.h>
|
||||
#include <sheet.h>
|
||||
#include <urldefid.h>
|
||||
@ -62,9 +63,10 @@ bool LiqAcc_app::create()
|
||||
|
||||
TDate oggi(TODAY);
|
||||
_year = oggi.year();
|
||||
open_files(LF_TAB, LF_TABCOM, LF_NDITTE, 0);
|
||||
_nditte = new TRelation(LF_NDITTE);
|
||||
_ditte = new TArray_sheet(-1, -1, -4, -4, "Selezione Ditte",
|
||||
"Cod.@5|Ragione Sociale@50|Vers.");
|
||||
_ditte = new TArray_sheet(-1, -1, -4, -4, TR("Selezione Ditte"),
|
||||
HR("Cod.@5|Ragione Sociale@50|Vers."));
|
||||
|
||||
_lia = new TTable("%LIA");
|
||||
_lam = new TTable("LAM");
|
||||
@ -104,7 +106,7 @@ bool LiqAcc_app::msk_hide(TMask& m,KEY k)
|
||||
case K_QUIT:
|
||||
if (m1.dirty())
|
||||
{
|
||||
KEY k = yesnocancel_box("Registrazione modifiche effettuate?");
|
||||
KEY k = yesnocancel_box(TR("Registrazione modifiche effettuate?"));
|
||||
if (k == K_YES)
|
||||
{
|
||||
TString16 tipo (m1.get(F_TIPO));
|
||||
@ -112,7 +114,7 @@ bool LiqAcc_app::msk_hide(TMask& m,KEY k)
|
||||
TString16 y; y.format("%05ld%04d", app()._ditta, app()._year);
|
||||
lia.zero();
|
||||
lia.put("CODTAB", y);
|
||||
if (lia.read() != NOERR)
|
||||
if (lia.read(_isequal, _lock) != NOERR)
|
||||
return FALSE;
|
||||
lia.put("S8", tipo);
|
||||
lia.rewrite();
|
||||
@ -131,7 +133,7 @@ bool LiqAcc_app::msk_hide(TMask& m,KEY k)
|
||||
TString16 y; y.format("%05ld%04d", app()._ditta, app()._year);
|
||||
lia.zero();
|
||||
lia.put("CODTAB", y);
|
||||
if (lia.read() != NOERR)
|
||||
if (lia.read(_isequal, _lock) != NOERR)
|
||||
return FALSE;
|
||||
lia.put("S8", tipo);
|
||||
lia.rewrite();
|
||||
@ -199,7 +201,7 @@ bool LiqAcc_app::set_ditta(TMask_field& f, KEY k)
|
||||
}
|
||||
else
|
||||
{
|
||||
warning_box("Non sono definiti i parametri liquidazione per la ditta %ld",
|
||||
warning_box(FR("Non sono definiti i parametri liquidazione per la ditta %ld"),
|
||||
atol(ditta));
|
||||
f.reset();
|
||||
}
|
||||
@ -292,33 +294,31 @@ void LiqAcc_app::build_nomiditte()
|
||||
{
|
||||
_nomiditte.destroy();
|
||||
// ricostruire _nomiditte e rifare build_ditte_sheet
|
||||
TLocalisamfile& dt = _nditte->lfile();
|
||||
TString fr(2);
|
||||
TTable lia("%LIA");
|
||||
TCursor cur(_nditte, "", 1);
|
||||
TRectype & dt = _nditte->curr();
|
||||
const TRecnotype items = cur.items();
|
||||
|
||||
for (dt.first(); !dt.eof(); dt.next())
|
||||
for (cur = 0L; cur.pos() < items; ++cur)
|
||||
{
|
||||
// check no archivi
|
||||
fr = "??";
|
||||
bool good = prefix().exist(dt.get_long("CODDITTA"));
|
||||
|
||||
if (good)
|
||||
if (prefix().exist(dt.get_long("CODDITTA")))
|
||||
{
|
||||
// check no parametri liquidazione
|
||||
lia.put("CODTAB", format("%05ld%d",dt.get_long("CODDITTA"),_year));
|
||||
if (lia.read() != NOERR) good = FALSE;
|
||||
else fr = lia.get("S7");
|
||||
}
|
||||
else continue;
|
||||
TString key;
|
||||
TToken_string d;
|
||||
|
||||
// add record
|
||||
d.add(dt.get_long("CODDITTA"));
|
||||
d.add(dt.get("RAGSOC"));
|
||||
|
||||
key.format("%05ld%d", dt.get_long("CODDITTA"), _year);
|
||||
|
||||
const TRectype & lia = cache().get("%LIA", key);
|
||||
|
||||
d.add(lia.empty() ? "??" : lia.get("S7"));
|
||||
_nomiditte.add(d);
|
||||
}
|
||||
|
||||
TToken_string* d = new TToken_string(64);
|
||||
|
||||
// add record
|
||||
d->add(dt.get("CODDITTA"));
|
||||
d->add(dt.get("RAGSOC"));
|
||||
d->add(fr);
|
||||
|
||||
_nomiditte.add(d);
|
||||
}
|
||||
}
|
||||
|
||||
@ -377,7 +377,7 @@ bool LiqAcc_app::video_vis_1999()
|
||||
TString16 y; y.format("%05ld%04d", _ditta, _year);
|
||||
lia.zero();
|
||||
lia.put("CODTAB", y);
|
||||
if (lia.read() != NOERR) //da verificare se e' giusto
|
||||
if (lia.read(_isequal, _lock) != NOERR) //da verificare se e' giusto
|
||||
return FALSE;
|
||||
|
||||
// TConfig cnf(CONFIG_DITTA, "cg");
|
||||
@ -388,7 +388,7 @@ bool LiqAcc_app::video_vis_1999()
|
||||
TString16 freqviva = lia.get("S7");
|
||||
TInteressi_IVA_table ver;
|
||||
if (ver.read(_year,12)!=NOERR)
|
||||
warning_box("Errore %d in lettura tabella versamenti ed interessi.",ver.status());
|
||||
warning_box(FR("Errore %d in lettura tabella versamenti ed interessi."),ver.status());
|
||||
const real acconto_min_da_versare = ver.get(I_ACCONTOIVA);
|
||||
real acconto = ZERO;
|
||||
real iva_ven = ZERO;
|
||||
@ -524,7 +524,7 @@ bool LiqAcc_app::video_vis_1999()
|
||||
case K_QUIT:
|
||||
if (m.dirty())
|
||||
{
|
||||
KEY k = yesnocancel_box("Registrazione modifiche effettuate?");
|
||||
KEY k = yesnocancel_box(TR("Registrazione modifiche effettuate?"));
|
||||
|
||||
if (k == K_YES)
|
||||
{
|
||||
@ -533,7 +533,7 @@ bool LiqAcc_app::video_vis_1999()
|
||||
real nf (m.get(F_NONFAT));
|
||||
real na (m.get(F_NONANN));
|
||||
if (nf != non_fat || na != non_ann)
|
||||
message_box("Valori modificati: rieseguire il calcolo dell'acconto");
|
||||
message_box(TR("Valori modificati: rieseguire il calcolo dell'acconto"));
|
||||
lia.put("R13", nf);
|
||||
lia.put("R14", na);
|
||||
lia.rewrite();
|
||||
@ -554,7 +554,7 @@ bool LiqAcc_app::video_vis_1999()
|
||||
real nf (m.get(F_NONFAT));
|
||||
real na (m.get(F_NONANN));
|
||||
if (nf != non_fat || na != non_ann)
|
||||
message_box("Valori modificati: rieseguire il calcolo dell'acconto");
|
||||
message_box(TR("Valori modificati: rieseguire il calcolo dell'acconto"));
|
||||
lia.put("R13", nf);
|
||||
lia.put("R14", na);
|
||||
lia.rewrite();
|
||||
@ -633,7 +633,7 @@ bool LiqAcc_app::video_vis_2000()
|
||||
TTable lia ("%LIA");
|
||||
TString16 key; key.format("%05ld%04d", _ditta, _year);
|
||||
lia.put("CODTAB", key);
|
||||
if (lia.read() != NOERR)
|
||||
if (lia.read(_isequal, _lock) != NOERR)
|
||||
return FALSE;
|
||||
|
||||
const bool liqdiff = lia.get_bool("B1"); // MI3262..
|
||||
@ -643,7 +643,7 @@ bool LiqAcc_app::video_vis_2000()
|
||||
|
||||
TInteressi_IVA_table ver;
|
||||
if (ver.read(_year,12)!=NOERR)
|
||||
warning_box("Errore %d in lettura tabella versamenti ed interessi.", ver.status());
|
||||
warning_box(FR("Errore %d in lettura tabella versamenti ed interessi."), ver.status());
|
||||
|
||||
const real acconto_min_da_versare = ver.get(I_ACCONTOIVA);
|
||||
real acconto = lia.get("R4"); // Acconto di Dicembre
|
||||
@ -734,10 +734,10 @@ bool LiqAcc_app::video_vis_2000()
|
||||
case K_QUIT:
|
||||
if (!liqdiff && m.dirty())
|
||||
{
|
||||
KEY k = yesnocancel_box("Registrare le modifiche effettuate?");
|
||||
KEY k = yesnocancel_box(TR("Registrare le modifiche effettuate?"));
|
||||
if (k == K_YES)
|
||||
{
|
||||
warning_box("E' necessario rieseguire il calcolo dell'acconto");
|
||||
warning_box(TR("E' necessario rieseguire il calcolo dell'acconto"));
|
||||
const real nf = m.get(F_NONFAT);
|
||||
const real na = m.get(F_NONANN);
|
||||
lia.put("R13", nf);
|
||||
@ -754,7 +754,7 @@ bool LiqAcc_app::video_vis_2000()
|
||||
_registra = TRUE;
|
||||
if (!liqdiff && m.dirty())
|
||||
{
|
||||
warning_box("E' necessario rieseguire il calcolo dell'acconto");
|
||||
warning_box(TR("E' necessario rieseguire il calcolo dell'acconto"));
|
||||
const real nf = m.get(F_NONFAT);
|
||||
const real na = m.get(F_NONANN);
|
||||
lia.put("R13", nf);
|
||||
@ -770,6 +770,8 @@ bool LiqAcc_app::video_vis_2000()
|
||||
int cg4900(int argc, char* argv[])
|
||||
{
|
||||
LiqAcc_app app;
|
||||
app.run(argc, argv, "Visualizzazione liquidazione acconti");
|
||||
return 0;
|
||||
|
||||
app.run(argc, argv, TR("Visualizzazione liquidazione acconti"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -36,7 +36,8 @@ bool cau_filter1 (const TRelation *r)
|
||||
const bool b1 = reg.get_bool("B1");
|
||||
if (i9 == 1 || i9 == 0 && b1) // Il registro deve avere la X di sospensione NORMALE
|
||||
{
|
||||
TLocalisamfile& rcau = r->lfile(LF_RCAUSALI); // La riga 1 (gia' posizionata nella relazione) deve essere di tipo cliente
|
||||
TLocalisamfile & rcau = r->lfile(LF_RCAUSALI); // La riga 1 (gia' posizionata nella relazione) deve essere di tipo cliente
|
||||
|
||||
if (rcau.get(RCA_TIPOCF) == "C")
|
||||
rt = TRUE;
|
||||
}
|
||||
@ -155,7 +156,7 @@ void TGestAutoTrasp_mask::fill_sheet(const short id)
|
||||
TProgind* pi = NULL;
|
||||
|
||||
if (items > 10)
|
||||
pi = new TProgind(items, "Selezione movimenti...", FALSE, TRUE);
|
||||
pi = new TProgind(items, TR("Selezione movimenti..."), FALSE, TRUE);
|
||||
|
||||
TLocalisamfile causali(LF_CAUSALI);
|
||||
|
||||
@ -180,7 +181,7 @@ void TGestAutoTrasp_mask::fill_sheet(const short id)
|
||||
causali.put(CAU_CODCAUS, caus);
|
||||
|
||||
const bool ok = causali.read() == NOERR;
|
||||
tt->add(ok ? causali.get(CAU_DESCR) : "** Non presente **", 1);
|
||||
tt->add(ok ? causali.get(CAU_DESCR) : TR("** Non presente **"), 1);
|
||||
tt->add(ok ? causali.get(CAU_TIPODOC) : "**", 2);
|
||||
|
||||
sa.add(tt);
|
||||
@ -194,7 +195,7 @@ void TGestAutoTrasp_mask::fill_sheet(const short id)
|
||||
|
||||
if (items == 0)
|
||||
{
|
||||
warning_box("Non vi sono operazioni da effettuare nell'intervallo specificato.");
|
||||
warning_box(TR("Non vi sono operazioni da effettuare nell'intervallo specificato."));
|
||||
set_focus_field(id);
|
||||
}
|
||||
}
|
||||
@ -248,9 +249,9 @@ bool TGestAutoTrasp_mask::on_field_event(TOperable_field& o, TField_event e, lon
|
||||
if (error)
|
||||
{
|
||||
if (sf.items() == 0)
|
||||
error_box("Non vi sono movimenti in sospensione da stornare nel periodo indicato.");
|
||||
error_box(TR("Non vi sono movimenti in sospensione da stornare nel periodo indicato."));
|
||||
else
|
||||
error_box("E' necessario indicare almeno una causale definitiva.");
|
||||
error_box(TR("E' necessario indicare almeno una causale definitiva."));
|
||||
}
|
||||
|
||||
return !error;
|
||||
@ -292,12 +293,15 @@ bool TGestAutoTrasp_mask::on_field_event(TOperable_field& o, TField_event e, lon
|
||||
const long TGestAutoTrasp_mask::get_last_nreg()
|
||||
{
|
||||
TLocalisamfile& mov = _rel->lfile();
|
||||
const int key = mov.getkey();
|
||||
long nr = 1L;
|
||||
|
||||
if (!mov.empty())
|
||||
{
|
||||
mov.setkey(1);
|
||||
mov.last();
|
||||
nr = mov.get_long(MOV_NUMREG) + 1L;
|
||||
mov.setkey(key);
|
||||
}
|
||||
return nr;
|
||||
}
|
||||
@ -368,7 +372,7 @@ void TGestAutoTrasp_mask::write_movs()
|
||||
|
||||
_cur->freeze();
|
||||
|
||||
TProgind pi(cur_items, "Creazione movimenti...", FALSE, TRUE);
|
||||
TProgind pi(cur_items, TR("Creazione movimenti..."), FALSE, TRUE);
|
||||
int err = NOERR;
|
||||
int movs = 0;
|
||||
|
||||
@ -465,19 +469,19 @@ void TGestAutoTrasp_mask::write_movs()
|
||||
movs++;
|
||||
err = mpn_sosp.rewrite(); // Aggiorna il movimento in sospensione con i flags aggiornati
|
||||
if (err != NOERR)
|
||||
error_box("Errore %d in fase di riscrittura del movimento di sospensione nr. %d.", err, nsosp);
|
||||
error_box(FR("Errore %d in fase di riscrittura del movimento di sospensione nr. %d."), err, nsosp);
|
||||
}
|
||||
else
|
||||
error_box("Errore %d in fase di scrittura del movimento definitivo. Movimento di sospensione nr. %d.", err, nsosp);
|
||||
error_box(FR("Errore %d in fase di scrittura del movimento definitivo. Movimento di sospensione nr. %d."), err, nsosp);
|
||||
}
|
||||
else
|
||||
error_box("Errore %d in fase di scrittura del movimento di storno. Movimento di sospensione nr. %d.", err, nsosp);
|
||||
error_box(FR("Errore %d in fase di scrittura del movimento di storno. Movimento di sospensione nr. %d."), err, nsosp);
|
||||
}
|
||||
}
|
||||
|
||||
_cur->freeze(FALSE);
|
||||
|
||||
message_box("Totale movimenti generati: %d", movs);
|
||||
message_box(FR("Totale movimenti generati: %d"), movs);
|
||||
}
|
||||
|
||||
class TGestAutoTrasp_app : public TSkeleton_application
|
||||
@ -510,7 +514,7 @@ void TGestAutoTrasp_app::main_loop()
|
||||
{
|
||||
while (_msk->run() != K_QUIT)
|
||||
{
|
||||
if (yesno_box("Procedo con la creazione dei movimenti?"))
|
||||
if (yesno_box(TR("Procedo con la creazione dei movimenti?")))
|
||||
{
|
||||
_msk->write_movs();
|
||||
_msk->reset();
|
||||
@ -521,6 +525,6 @@ void TGestAutoTrasp_app::main_loop()
|
||||
int cg4a00(int argc, char* argv[])
|
||||
{
|
||||
TGestAutoTrasp_app app;
|
||||
app.run(argc, argv, "Gestione Autotrasportatori");
|
||||
app.run(argc, argv, TR("Gestione Autotrasportatori"));
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user