Patch level : 10.0
Files correlati : sc1.exe sc1300a.msk Ricompilazione Demo : [ ] Commento : Riallineamento partite in base ai parametri ditta git-svn-id: svn://10.65.10.50/branches/R_10_00@21131 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
1800174481
commit
284f979191
@ -8,6 +8,7 @@ int main(int argc,char** argv)
|
||||
switch(n)
|
||||
{
|
||||
case 1: sc1200(argc,argv); break;
|
||||
case 2: sc1300(argc,argv); break;
|
||||
default: sc1100(argc,argv); break;
|
||||
}
|
||||
return 0;
|
||||
|
2
sc/sc1.h
2
sc/sc1.h
@ -1,3 +1,3 @@
|
||||
|
||||
int sc1100(int argc, char** argv);
|
||||
int sc1200(int argc, char** argv);
|
||||
int sc1300(int argc, char** argv);
|
||||
|
186
sc/sc1300.cpp
Executable file
186
sc/sc1300.cpp
Executable file
@ -0,0 +1,186 @@
|
||||
#include <applicat.h>
|
||||
#include <mask.h>
|
||||
#include <config.h>
|
||||
#include <progind.h>
|
||||
#include <recset.h>
|
||||
#include <relation.h>
|
||||
#include <reputils.h>
|
||||
|
||||
#include "sc1300.h"
|
||||
|
||||
#include "partite.h"
|
||||
|
||||
class TAllinea_partite : public TSkeleton_application
|
||||
{
|
||||
char _cli_align, _for_align;
|
||||
|
||||
protected: // Applicat
|
||||
virtual void on_config_change();
|
||||
virtual void main_loop();
|
||||
|
||||
public:
|
||||
void allinea(int logicnum, TLog_report& log, bool& can_write);
|
||||
void compatta(int logicnum, TLog_report& log, bool& can_write);
|
||||
void allinea_e_compatta(int logicnum, TLog_report& log, bool& can_write);
|
||||
};
|
||||
|
||||
void TAllinea_partite::on_config_change()
|
||||
{
|
||||
TConfig cd(CONFIG_DITTA, "cg");
|
||||
_cli_align = cd.get_bool("NrCliDx") ? 'R' : 'L';
|
||||
_for_align = cd.get_bool("NrForDx") ? 'R' : 'L';
|
||||
xvtil_statbar_set("", true);
|
||||
}
|
||||
|
||||
void TAllinea_partite::allinea(int logicnum, TLog_report& log, bool& can_write)
|
||||
{
|
||||
TString query;
|
||||
query << "USE " << logicnum;
|
||||
TISAM_recordset recset(query);
|
||||
TLocalisamfile& file = recset.cursor()->file();
|
||||
TRectype& curr = file.curr();
|
||||
|
||||
TString8 last;
|
||||
|
||||
TString msg;
|
||||
msg = can_write ? TR("Allineamento") : TR("Controllo");
|
||||
msg << ' ' << file.description() << " : " << recset.items() << ' ' << TR("righe");
|
||||
log.log(0, "");
|
||||
log.log(1, msg);
|
||||
log.log(0, "");
|
||||
|
||||
const int partlen = curr.length(PART_NUMPART);
|
||||
|
||||
TRecnotype nl = 0, na = 0;
|
||||
|
||||
TProgind pi(recset.items(), msg);
|
||||
for (bool go = recset.move_first(); go; go = recset.move_next())
|
||||
{
|
||||
if (!pi.addstatus(1))
|
||||
{
|
||||
log.log(1, TR("Elaborazione interrotta dall'utente"));
|
||||
can_write = false;
|
||||
break;
|
||||
}
|
||||
nl++;
|
||||
|
||||
const TString8 numpart = curr.get(PART_NUMPART);
|
||||
// Codice partita allineabile in quanto piu' corto della lunghezza massima
|
||||
if (numpart[0] == ' ' || numpart.len() < partlen)
|
||||
{
|
||||
const char tipocf = curr.get_char(PART_TIPOCF);
|
||||
const char richiesto = tipocf == 'F' ? _for_align : _cli_align;
|
||||
const char attuale = numpart[0] > ' ' ? 'L' : 'R';
|
||||
if (attuale == richiesto)
|
||||
continue;
|
||||
|
||||
TString8 newpart = numpart;
|
||||
if (richiesto == 'R')
|
||||
newpart.right_just(partlen);
|
||||
else
|
||||
newpart.trim();
|
||||
|
||||
if (numpart != last)
|
||||
{
|
||||
msg.cut(0);
|
||||
if (tipocf > ' ')
|
||||
msg << tipocf;
|
||||
else
|
||||
msg << curr.get(PART_GRUPPO) << ' ' << curr.get(PART_CONTO);
|
||||
msg << ' ' << curr.get(PART_SOTTOCONTO) << ' ' << curr.get(PART_ANNO)
|
||||
<< " '" << numpart << "' => '" << newpart << "'";
|
||||
log.log(0, msg);
|
||||
last = numpart;
|
||||
}
|
||||
|
||||
if (can_write)
|
||||
{
|
||||
const char richiesto = tipocf == 'F' ? _for_align : _cli_align;
|
||||
const char attuale = numpart.len() < partlen ? 'L' : 'R';
|
||||
if (attuale != richiesto)
|
||||
{
|
||||
TString8 newpart = curr.get(PART_NUMPART);
|
||||
if (richiesto == 'R')
|
||||
newpart.right_just(partlen);
|
||||
else
|
||||
newpart.trim();
|
||||
curr.put(PART_NUMPART, newpart);
|
||||
|
||||
const TRecnotype recno = file.recno();
|
||||
const int err = file.rewriteat(curr, recno);
|
||||
if (err == NOERR)
|
||||
na++;
|
||||
else
|
||||
{
|
||||
msg = TR("Errore di aggiornamento del file ");
|
||||
msg << file.description() << " : " << err;
|
||||
log.log(2, msg);
|
||||
can_write = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nl > 0)
|
||||
{
|
||||
msg.cut(0) << TR("Righe lette") << " : " << nl;
|
||||
log.log(1, msg);
|
||||
}
|
||||
if (na > 0)
|
||||
{
|
||||
msg.cut(0) << TR("Righe aggiornate") << " : " << na;
|
||||
log.log(1, msg);
|
||||
}
|
||||
}
|
||||
|
||||
void TAllinea_partite::compatta(int logicnum, TLog_report& log, bool& can_write)
|
||||
{
|
||||
if (can_write)
|
||||
{
|
||||
safely_close_closeable_isamfiles();
|
||||
TSystemisamfile sysfile(logicnum);
|
||||
|
||||
TString msg;
|
||||
msg << TR("Compattamento") << ' ' << sysfile.description();
|
||||
log.log(1, msg);
|
||||
int err = sysfile.pack(true);
|
||||
if (err != NOERR)
|
||||
{
|
||||
msg = TR("Errore di compattamento del file ");
|
||||
msg << sysfile.description() << " : " << err;
|
||||
log.log(2, msg);
|
||||
can_write = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TAllinea_partite::allinea_e_compatta(int logicnum, TLog_report& log, bool& can_write)
|
||||
{
|
||||
allinea(logicnum, log, can_write);
|
||||
compatta(logicnum, log, can_write);
|
||||
}
|
||||
|
||||
void TAllinea_partite::main_loop()
|
||||
{
|
||||
TMask msk("sc1300a");
|
||||
msk.set(F_ALLINEAMENTO_CLI, _cli_align == 'R' ? "R" : "L");
|
||||
msk.set(F_ALLINEAMENTO_FOR, _for_align == 'R' ? "R" : "L");
|
||||
msk.set(F_ALLINEAMENTO_CON, _cli_align == 'R' ? "R" : "L");
|
||||
while (msk.run() == K_ENTER)
|
||||
{
|
||||
bool can_write = msk.get_bool(F_SCRITTURA);
|
||||
TLog_report log(title());
|
||||
allinea_e_compatta(LF_PARTITE, log, can_write);
|
||||
allinea_e_compatta(LF_SCADENZE, log, can_write);
|
||||
allinea_e_compatta(LF_PAGSCA, log, can_write);
|
||||
log.preview();
|
||||
}
|
||||
}
|
||||
|
||||
int sc1300(int argc, char** argv)
|
||||
{
|
||||
TAllinea_partite a;
|
||||
a.run(argc, argv, TR("Allineamento partite"));
|
||||
return 0;
|
||||
}
|
4
sc/sc1300.h
Executable file
4
sc/sc1300.h
Executable file
@ -0,0 +1,4 @@
|
||||
#define F_ALLINEAMENTO_CLI 101
|
||||
#define F_ALLINEAMENTO_FOR 102
|
||||
#define F_ALLINEAMENTO_CON 103
|
||||
#define F_SCRITTURA 104
|
47
sc/sc1300a.uml
Executable file
47
sc/sc1300a.uml
Executable file
@ -0,0 +1,47 @@
|
||||
#include "sc1300.h"
|
||||
|
||||
PAGE "Allineamento partite" -1 -1 50 6
|
||||
|
||||
GROUPBOX DLG_NULL 24 5
|
||||
BEGIN
|
||||
PROMPT 1 1 "@bAllineamento corrente"
|
||||
END
|
||||
|
||||
LISTA F_ALLINEAMENTO_CLI 1 8
|
||||
BEGIN
|
||||
PROMPT 2 2 "Clienti "
|
||||
ITEM "L|Sinistra"
|
||||
ITEM "R|Destra"
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
LISTA F_ALLINEAMENTO_FOR 1 8
|
||||
BEGIN
|
||||
PROMPT 2 3 "Fornitori "
|
||||
ITEM "L|Sinistra"
|
||||
ITEM "R|Destra"
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
LISTA F_ALLINEAMENTO_CON 1 8
|
||||
BEGIN
|
||||
PROMPT 2 4 "Conti "
|
||||
ITEM "L|Sinistra"
|
||||
ITEM "R|Destra"
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
RADIOBUTTON F_SCRITTURA 1 21
|
||||
BEGIN
|
||||
PROMPT 27 1 "@bOperazione"
|
||||
ITEM " |Solo controllo"
|
||||
ITEM "X|Aggiornamento"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
TOOLBAR "" 0 0 0 2
|
||||
#include <elabar.h>
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
@ -18,4 +18,5 @@ Module = 13
|
||||
Flags = ""
|
||||
Item_01 = "Stampa controllo saldi", "sc2 -4", ""
|
||||
Item_02 = "Creazione saldaconto da saldi", "sc1 -1", ""
|
||||
Item_03 = "Allineamento Partite", "sc1 -2", "F"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user