This commit was generated by cvs2svn to compensate for changes in r1113,
which included commits to RCS files with non-trunk default branches. git-svn-id: svn://10.65.10.50/trunk@1114 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
d92d1ebabb
commit
6d6c079303
18
sc/sc1.cpp
Executable file
18
sc/sc1.cpp
Executable file
@ -0,0 +1,18 @@
|
||||
#include <xvt.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "sp1.h"
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
const int n = (argc > 1) ? atoi(&argv[1][1]) : 0;
|
||||
|
||||
switch(n)
|
||||
{
|
||||
case 1:
|
||||
sc1200(argc,argv); break;
|
||||
default:
|
||||
sc1100(argc,argv); break;
|
||||
}
|
||||
return 0;
|
||||
}
|
3
sc/sc1.h
Executable file
3
sc/sc1.h
Executable file
@ -0,0 +1,3 @@
|
||||
|
||||
int sc1100(int argc, char** argv);
|
||||
int sc1200(int argc, char** argv);
|
158
sc/sc1100.cpp
Executable file
158
sc/sc1100.cpp
Executable file
@ -0,0 +1,158 @@
|
||||
#include <applicat.h>
|
||||
#include <mask.h>
|
||||
#include <progind.h>
|
||||
#include <urldefid.h>
|
||||
|
||||
#include "sc1100.h"
|
||||
|
||||
TString& add_plural(TString& s, long num, const char* name)
|
||||
{
|
||||
const TFixed_string n(name);
|
||||
const char last = n[n.len()-1];
|
||||
|
||||
if (num < 1)
|
||||
{
|
||||
s << "nessun";
|
||||
if (toupper(last) == 'A' || toupper(n[0]) == 'Z' ||
|
||||
toupper(n[0]) == 'S' && strchr("aeiouAEIOU", n[1]) == NULL)
|
||||
s << tolower(last);
|
||||
s << ' ' << name;
|
||||
}
|
||||
else
|
||||
{
|
||||
s << num << ' ' << name;
|
||||
if (num > 1)
|
||||
s[s.len()-1] = (last == 'a') ? 'e' : 'i';
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
class TDeletepart_app : public TApplication
|
||||
{
|
||||
protected:
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
virtual bool menu(MENU_TAG m);
|
||||
|
||||
public:
|
||||
TDeletepart_app() {};
|
||||
};
|
||||
|
||||
bool TDeletepart_app::create()
|
||||
{
|
||||
TApplication::create();
|
||||
dispatch_e_menu(BAR_ITEM(1));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TDeletepart_app::destroy()
|
||||
{
|
||||
return TApplication::destroy();
|
||||
}
|
||||
|
||||
bool TDeletepart_app::menu(MENU_TAG)
|
||||
{
|
||||
TMask m("sc1100a");
|
||||
TCursor& cur = *m.efield(F_TODATE).browse()->cursor();
|
||||
TLocalisamfile& partite = cur.file(LF_PART);
|
||||
TLocalisamfile scadenze(LF_SCAD);
|
||||
while (m.run() != K_QUIT)
|
||||
{
|
||||
TRecnotype last = cur.items()-1;
|
||||
partite.zero();
|
||||
const char* s = m.get(F_TODATE);
|
||||
if (*s)
|
||||
{
|
||||
partite.put(MOV_DATAREG, s);
|
||||
partite.put(MOV_NUMREG, m.get(F_TOREG));
|
||||
last = cur.read();
|
||||
}
|
||||
|
||||
const TRecnotype first = cur.read();
|
||||
const TRecnotype total = 0;
|
||||
int lastanno = -1;
|
||||
TString16 lastpart = "";
|
||||
|
||||
for (cur = 0; cur.pos() <= last; ++cur)
|
||||
{
|
||||
if (lastanno != partite.get_int(??annopart??) ||
|
||||
lastpart != partite.get(??CODPART??);
|
||||
{
|
||||
total++;
|
||||
lastanno = partite.get_int(??annopart??);
|
||||
lastpart = partite.get(??CODPART??);
|
||||
}
|
||||
}
|
||||
TString80 caption("Cancellazione di ");
|
||||
add_plural(caption, total, "partite");
|
||||
|
||||
if (!yesno_box(caption) || total < 1)
|
||||
continue;
|
||||
|
||||
TProgind pi(total, caption, FALSE, TRUE, 24);
|
||||
|
||||
cur.freeze();
|
||||
lastanno = -1;
|
||||
for (cur = 0; cur.pos() <= last; ++cur)
|
||||
{
|
||||
const int anno = partite.get_int(??anno??);
|
||||
const int partita = partite.get(??codpart??);
|
||||
|
||||
int err = cur.lock();
|
||||
if (err == NOERR && (lastanno != partite.get_int(??annopart??) ||
|
||||
lastpart != partite.get(??CODPART??)));
|
||||
{
|
||||
for (int rig = 1; err == NOERR; rig++)
|
||||
{
|
||||
scadenze.put(??anno??, lastanno);
|
||||
scadenze.put(??codpart??, lastpart);
|
||||
scadenze.put(??nrig??, rig);
|
||||
if (scadenze.read(_isequal, _lock) == NOERR)
|
||||
err = scadenze.remove();
|
||||
if (err != NOERR)
|
||||
caption.format("riga scadenza %d", rig);
|
||||
}
|
||||
pi.addstatus(1);
|
||||
lastanno = partite.get_int(??annopart??);
|
||||
lastpart = partite.get(??CODPART??);
|
||||
}
|
||||
if (err == NOERR)
|
||||
{
|
||||
const TRecnotype n = partite.recno();
|
||||
partite.setkey(1); // Isam bug on remove with key != 1
|
||||
partite.readat(n);
|
||||
err = partite.remove();
|
||||
if (err != NOERR)
|
||||
caption = "riga %d";
|
||||
}
|
||||
else
|
||||
{
|
||||
error_box("Errore %d nella cancellazione della %s della partita %d/%s",
|
||||
err, (const char*)caption, anno, partita);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int rig = 1; lastanno > 0 && err == NOERR; rig++)
|
||||
{
|
||||
scadenze.put(??anno??, lastanno);
|
||||
scadenze.put(??codpart??, lastpart);
|
||||
scadenze.put(??nrig??, rig);
|
||||
if (scadenze.read(_isequal, _lock) == NOERR)
|
||||
err = scadenze.remove();
|
||||
if (err != NOERR)
|
||||
caption.format("riga scadenza %d", rig);
|
||||
}
|
||||
cur.freeze(FALSE);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
int cg2200(int argc, char** argv)
|
||||
{
|
||||
TDeletepart_app a;
|
||||
a.run(argc, argv, "Eliminazione partita chiuse");
|
||||
return 0;
|
||||
}
|
42
sc/sc1200.cpp
Executable file
42
sc/sc1200.cpp
Executable file
@ -0,0 +1,42 @@
|
||||
#include <applicat.h>
|
||||
#include <mask.h>
|
||||
#include <progind.h>
|
||||
#include <urldefid.h>
|
||||
|
||||
|
||||
|
||||
class TCreatepart_app : public TApplication
|
||||
{
|
||||
protected:
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
virtual bool menu(MENU_TAG m);
|
||||
|
||||
public:
|
||||
TCreatepart_app() {};
|
||||
};
|
||||
|
||||
bool TCreatepart_app::create()
|
||||
{
|
||||
TApplication::create();
|
||||
dispatch_e_menu(BAR_ITEM(1));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TCreatepart_app::destroy()
|
||||
{
|
||||
return TApplication::destroy();
|
||||
}
|
||||
|
||||
bool TCreatepart_app::menu(MENU_TAG)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
int sc1200(int argc, char** argv)
|
||||
{
|
||||
TCreatepart_app a;
|
||||
a.run(argc, argv, "Apertura scadenze da saldi");
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user