Migliorato flag di split payment in clienti/fornitori

Corretto riutilizzo vecchi NUMREG in prima nota
Correttra gestione floppy in trasferimento a PC

git-svn-id: svn://10.65.10.50/branches/R_10_00@23068 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2015-04-20 08:12:04 +00:00
parent 55412a57c6
commit 5ed8a6b90d
5 changed files with 77 additions and 66 deletions

View File

@ -517,8 +517,17 @@ HIDDEN bool alleg_handler(TMask_field& f, KEY key)
if (f.to_check(key, true))
{
const int tipoall = atoi(f.get());
TMask& m = f.mask();
bool can_split = m.get(F_TIPOCF)=="C" && (tipoall == 7 || tipoall == 4);
if (can_split && tipoall == 4)
{
TToken_string key; key.format("%c|%ld", m.get(F_TIPOCF)[0], m.get_long(F_CODALLEG));
const TRectype& coll = cache().get(LF_CLIFO, key);
can_split = coll.get_int(CLI_ALLEG) && coll.get_bool(CLI_SPLITPAY);
}
if (key == K_ENTER)
{
if (m.get_bool(F_OCCASIONALE))
@ -531,6 +540,8 @@ HIDDEN bool alleg_handler(TMask_field& f, KEY key)
if (tipoall == 2)
return f.error_box(TR("Tipo allegato non valido per i non occasionali"));
}
if (!can_split)
m.reset(F_SPLITPAY); // You never know
}
else
{
@ -544,8 +555,13 @@ HIDDEN bool alleg_handler(TMask_field& f, KEY key)
}
if (tipoall == 2)
m.set(F_OCCASIONALE, "X");
m.show(F_SPLITPAY, (tipoall == 4 || tipoall == 7) && m.get(F_TIPOCF)=="C");
m.field(F_COFI).set_dirty(true);
m.show(F_SPLITPAY, can_split);
m.enable(F_SPLITPAY, can_split && tipoall == 7);
if (!can_split)
m.reset(F_SPLITPAY);
m.field(F_COFI).set_dirty(true);
m.field(F_PAIV).set_dirty(true);
}
}
@ -577,6 +593,10 @@ HIDDEN bool codalleg_handler(TMask_field& f, KEY key)
const int tipoall = clifo.get_int(CLI_ALLEG);
if (tipoall != 0 && tipoall != 1 && tipoall != 4 && tipoall != 6 && tipoall != 7)
return error_box(TR("Codice non utilizzabile: codice inserimento allegato non corretto"));
TMask_field& a = m.field(F_ALLEG);
a.set_dirty();
alleg_handler(a, K_TAB); // Aggiorna split payment
}
return true;
}

View File

@ -800,12 +800,18 @@ bool TPrimanota_application::get_next_key(TToken_string& tmp)
return true;
}
void TPrimanota_application::init_insert_mode(TMask& m)
{
init_mask(m);
m.first_focus(_firstfocus);
if (m.get_long(F_NUMREG) <= 0)
{
const long nreg = _msk[0]->get_long(F_CC_NUMREG);
if (nreg > 0)
m.set(F_NUMREG, nreg);
}
if (causale().reg().agenzia_viaggi())
m.set(F_DATA74TER, m.get(F_DATAREG));

View File

@ -55,11 +55,12 @@ BEGIN
HELP "Data in cui viene registrata l'operazione"
MESSAGE COPY,F_ANNOIVA,7,10
USE LF_MOV KEY 2
DISPLAY "Data@10" DATAREG
DISPLAY "Numero@7" NUMREG
DISPLAY "Data\nRegistraz.@10" DATAREG
DISPLAY "Data\nCompetenza@10" DATAREG
DISPLAY "Numero\nregistraz.@7" NUMREG
DISPLAY "Causale" CODCAUS
DISPLAY "Documento" NUMDOC
DISPLAY "Protoc." PROTIVA
DISPLAY "Numero\nDocumento@10" NUMDOC
DISPLAY "Protoc.\nIVA@6" PROTIVA
DISPLAY "Descrizione@50" DESCR
OUTPUT F_DATAREG DATAREG
OUTPUT F_NUMREG NUMREG
@ -141,23 +142,10 @@ BEGIN
OUTPUT F_CC_NUMREG NUMREG
MESSAGE COPY F_NUMREG
FLAGS "H"
END
/* DATACOMP new way
DATE F_DATACOMP
BEGIN
PROMPT 3 9 "Data di competenza "
HELP "Data di competenza dell'operazione"
KEY 1
CHECKTYPE REQUIRED
END
NUMBER F_ANNOES 4
BEGIN
PROMPT 52 9 "Codice esercizio "
FLAGS "DRZ"
END
*/
ENDPAGE
ENDMASK

View File

@ -102,8 +102,9 @@ void TInv_cont::main_loop()
long ditta = msk->get_long(F_DITTAINV);
set_firm(ditta);
TConfig conf(CONFIG_DITTA, "cg");
const TString& std = conf.get("FlStInv");
//TConfig conf(CONFIG_DITTA, "cg");
//const TString& std = conf.get("FlStInv");
const TString4 std = ini_get_string(CONFIG_DITTA, "cg", "FlStInv");
if (_scelta == 'S' && std != "D")
{
@ -234,11 +235,10 @@ void TInv_cont::main_loop()
TFilename work = floppy;
work.add(from.name());
FILE* i = fopen(from, "rb");
FILE* i = NULL; fopen_s(&i, from, "rb");
if (i == NULL)
{
error_box("Impossibile aprire il file '%s'", from);
cantread_box(from);
return;
}
@ -331,11 +331,10 @@ void TInv_cont::main_loop()
TFilename work = floppy;
work.add(from.name()); // File su dischetto
FILE* i = fopen(from, "rb");
FILE* i = NULL; fopen_s(&i, from, "rb");
if (i == NULL)
{
error_box("Impossibile aprire il file '%s'", from);
cantread_box(from);
return;
}
const char* message= "Trasferimento in corso... Prego attendere";
@ -449,7 +448,7 @@ void TInv_cont::apri_file_temp()
{
TFilename tmpclifo = "%";
tmpclifo << firm2dir(0);
tmpclifo << "\\" << TEMP_CLIFO;
tmpclifo.add(TEMP_CLIFO);
tmp = tmpclifo.mid(1);
tmp << ".dbf";
_tclifo = new TIsamtempfile(LF_CLIFO, tmpclifo, !tmp.exist());
@ -467,7 +466,7 @@ void TInv_cont::apri_file_temp()
{
TFilename tmpmov = "%";
tmpmov << firm2dir(0);
tmpmov << "\\" << TEMP_MOV;
tmpmov.add(TEMP_MOV);
tmp = tmpmov.mid(1);
tmp << ".dbf";
_tmov = new TIsamtempfile(LF_MOV, tmpmov, !tmp.exist());
@ -815,7 +814,7 @@ void TInv_cont::crea_marker(TMask& m)
TString buffer(size);
buffer.spaces();
FILE* i = fopen(_marker,"w+t");
FILE* i = NULL; fopen_s(&i, _marker, "w+t");
if (i != NULL)
{
TString str;
@ -874,16 +873,16 @@ void TInv_cont::aggiorna_marker(const TString& token, int pos)
const int size = 64;
TString buffer(size);
FILE* i = fopen(_marker,"r+t");
FILE* i = NULL; fopen_s(&i, _marker,"r+t");
if (i != NULL)
{
const word letti = fread(buffer.get_buffer(),1,size,i);
const size_t letti = fread(buffer.get_buffer(),1,size,i);
buffer.overwrite(token,pos);
buffer.cut(size); //Sicurezza: le stringhe dimensionate in realta' sono
//leggermente piu' lunghe della dimensione specificata
fseek(i, 0L, SEEK_SET);
const word scritti = fwrite(buffer,1,size,i);
fwrite(buffer,1,size,i);
fclose(i);
}
@ -1194,8 +1193,8 @@ void TInv_cont::clifo2tempfile(TString& key, TMask& m)
_tras_file.open(_header);
long items = _clifo->items();
_prog = new TProgind(items,"Invio Clienti / Fornitori in corso... Prego attendere.",false);
const TRecnotype items = _clifo->items();
_prog = new TProgind(items, TR("Invio Clienti/Fornitori in corso..."), false);
_clifo->setkey(1);

View File

@ -9,7 +9,7 @@
FILE* TInv_cont::chiedi_disco(const char* name, int disk, const TString& floppy, bool lettura)
{
FILE* f = NULL;
if (!xvt_fsys_is_removable_drive(floppy))
if (!xvt_fsys_is_floppy_drive(floppy))
return f;
message_box("Inserire il disco %d nel drive %c:", disk, floppy[0]);
@ -19,7 +19,7 @@ FILE* TInv_cont::chiedi_disco(const char* name, int disk, const TString& floppy,
bool retry = true;
while (retry)
{
f = fopen(name, lettura ? "rb" : "wb");
fopen_s(&f, name, lettura ? "rb" : "wb");
if (f == NULL)
retry = yesno_box("Il file %s non e' accessibile: riprovare?", (const char*)name);
else
@ -37,11 +37,11 @@ bool TInv_cont::scrivi_disco(const TString& floppy, int disk, const char* work,
{
FILE* file = chiedi_disco(work, disk, floppy, FALSE);
const bool is_floppy = xvt_fsys_is_removable_drive(floppy) != 0;
const bool is_floppy = xvt_fsys_is_floppy_drive(floppy) != 0;
if (is_floppy)
{
if (file == NULL)
return FALSE;
return false;
}
else
{
@ -63,37 +63,36 @@ bool TInv_cont::scrivi_disco(const TString& floppy, int disk, const char* work,
TFilename path_t = floppy; path_t.add("trasfer");
if (!fcopy(_marker,path_m)) // Copia il marker su disco
return FALSE;
return false;
FILE* o = fopen(path_t, "wb");
TString buffer(BUFSIZE);
unsigned long tot_scritti = BUFSIZE;
while (tot_scritti <= _dim_disk)
FILE* o = NULL; fopen_s(&o, path_t, "wb");
if (o != NULL)
{
const word letti = fread((char*)(const char*)buffer, 1, BUFSIZE, i);
TString tmp(BUFSIZE);
char* buffer = tmp.get_buffer(BUFSIZE);
size_t tot_scritti = BUFSIZE;
while (tot_scritti <= _dim_disk)
{
const size_t letti = fread(buffer, 1, BUFSIZE, i);
fwrite(buffer, letti, 1, o);
tot_scritti += letti;
if (letti < BUFSIZE)
break;
long scritti = fwrite((char*)(const char*)buffer, letti, 1, o);
tot_scritti += letti;
if (letti < BUFSIZE) break;
w.addstatus(letti);
}
w.addstatus(letti);
}
fclose(o);
fclose(o);
}
return TRUE;
return o != NULL;
}
int TInv_cont::calcola_numero_dischi(TMask& msk, const TString& floppy)
{
int numdisc = 1;
FILE* t = fopen(_trasf, "rb");
FILE* t = NULL; fopen_s(&t, _trasf, "rb");
if (t == NULL) return error_box("Impossibile aprire il file '%s'", _trasf);
long dim_t = _tras_file.determina_dimensione(t); //Determina la dimensione del trasfer
@ -105,7 +104,7 @@ int TInv_cont::calcola_numero_dischi(TMask& msk, const TString& floppy)
// long dim_h = determina_dimensione(h); //Determina la dimensione del trasfer
// fclose(h);
FILE* m = fopen(_marker, "rb");
FILE* m = NULL; fopen_s(&m, _marker, "rb");
if (m == NULL) return error_box("Impossibile aprire il file '%s'", _marker);
long dim_m = _tras_file.determina_dimensione(m); // Determina la dimensione del marker
@ -113,10 +112,9 @@ int TInv_cont::calcola_numero_dischi(TMask& msk, const TString& floppy)
_dim_tot = dim_t + dim_m; //+dim_h; // Determina la dimensione totale
if (xvt_fsys_is_removable_drive(floppy))
if (xvt_fsys_is_floppy_drive(floppy))
{
int item = msk.get_int(F_DIM);
int item = msk.get_int(F_DIM);
switch (item)
{
case 1 :