Riportate dalla 3.3 personalizzazioni MRP per cliente DB Service
git-svn-id: svn://10.65.10.50/branches/R_10_00@22678 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
53d90d8c95
commit
48d079a2c3
@ -1,22 +1,22 @@
|
||||
#include <xvt.h>
|
||||
|
||||
#include "ps0920.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int n = argc > 1 ? atoi(argv[1]+1) : 0;
|
||||
switch(n)
|
||||
{
|
||||
case 1:
|
||||
ps0920200(argc, argv); break; //Aggiornamento IVA Documenti DBService
|
||||
case 2:
|
||||
ps0920300(argc, argv); break; //Pianificazione impianti DBService
|
||||
case 3:
|
||||
ps0920400(argc, argv); break; //Riepilogo produzione DBService
|
||||
case 0:
|
||||
default:
|
||||
ps0920100(argc, argv); break; //Stampa ordini di produzione DBService
|
||||
}
|
||||
exit(0);
|
||||
return 0;
|
||||
#include <xvt.h>
|
||||
|
||||
#include "ps0920.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int n = argc > 1 ? atoi(argv[1]+1) : 0;
|
||||
switch(n)
|
||||
{
|
||||
case 1:
|
||||
ps0920200(argc, argv); break; //Aggiornamento IVA Documenti DBService
|
||||
case 2:
|
||||
ps0920300(argc, argv); break; //Pianificazione impianti DBService
|
||||
case 3:
|
||||
ps0920400(argc, argv); break; //Riepilogo produzione DBService
|
||||
case 0:
|
||||
default:
|
||||
ps0920100(argc, argv); break; //Stampa ordini di produzione DBService
|
||||
}
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
int ps0920100(int argc, char* argv[]);
|
||||
int ps0920200(int argc, char* argv[]);
|
||||
int ps0920300(int argc, char* argv[]);
|
||||
int ps0920400(int argc, char* argv[]);
|
||||
int ps0920100(int argc, char* argv[]);
|
||||
int ps0920200(int argc, char* argv[]);
|
||||
int ps0920300(int argc, char* argv[]);
|
||||
int ps0920400(int argc, char* argv[]);
|
||||
|
362
ps/ps0920100.cpp
362
ps/ps0920100.cpp
@ -1,181 +1,181 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <defmask.h>
|
||||
#include <relation.h>
|
||||
#include <reprint.h>
|
||||
|
||||
#include "ps0920.h"
|
||||
#include "ps0920100a.h"
|
||||
|
||||
#include <rdoc.h>
|
||||
|
||||
class TMaskPs09201 : public TAutomask
|
||||
{
|
||||
TCursor_sheet * _sht;
|
||||
bool _select_changed;
|
||||
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
void update_sheet();
|
||||
|
||||
public:
|
||||
TCursor_sheet& sheet() const;
|
||||
TMaskPs09201();
|
||||
virtual ~TMaskPs09201();
|
||||
};
|
||||
|
||||
TCursor_sheet& TMaskPs09201::sheet() const
|
||||
{
|
||||
if (_sht == NULL) // Non si sa mai!
|
||||
((TMaskPs09201*)this)->update_sheet();
|
||||
return *_sht;
|
||||
}
|
||||
|
||||
|
||||
TMaskPs09201::TMaskPs09201()
|
||||
: TAutomask("ps0920100a"), _sht(NULL)
|
||||
{
|
||||
((TButton_field&) field(DLG_SELECT)).set_exit_key(0);
|
||||
_select_changed = true;
|
||||
}
|
||||
|
||||
TMaskPs09201::~TMaskPs09201()
|
||||
{
|
||||
if (_sht != NULL)
|
||||
delete _sht;
|
||||
}
|
||||
|
||||
bool TMaskPs09201::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
const int id = o.dlg();
|
||||
switch (id)
|
||||
{
|
||||
case F_NUM:
|
||||
case F_ANNO:
|
||||
case F_CODCLI:
|
||||
_select_changed = true;
|
||||
break;
|
||||
case DLG_SELECT:
|
||||
if (e == fe_button)
|
||||
{
|
||||
if (_select_changed)
|
||||
update_sheet();
|
||||
_select_changed = false;
|
||||
_sht->run();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TMaskPs09201::update_sheet()
|
||||
{
|
||||
|
||||
if (_sht != NULL)
|
||||
{
|
||||
delete _sht;
|
||||
_sht = NULL;
|
||||
}
|
||||
|
||||
_select_changed = false;
|
||||
|
||||
TRelation * r = new TRelation(LF_RIGHEDOC);
|
||||
TRectype from(r->curr());
|
||||
const long codcli = get_long(F_CODCLI);
|
||||
TString codartfrom; codartfrom.format("%03ld", codcli);
|
||||
|
||||
from.put(RDOC_CODNUM, get(F_NUM));
|
||||
from.put(RDOC_ANNO, get(F_ANNO));
|
||||
from.put(RDOC_PROVV, "D");
|
||||
from.put(RDOC_CODART, codartfrom);
|
||||
|
||||
TRectype to(from);
|
||||
|
||||
TString codartto; codartto.format("%03ld", codcli + 1);
|
||||
to.put(RDOC_CODART, codartto);
|
||||
TCursor * c = new TSorted_cursor(r, "CODNUM|NDOC|NRIGA", "RIGAEVASA!=\"X\"", 2, &from, &to);
|
||||
_sht = new TCursor_sheet(c, " |CODNUM|NDOC|NRIGA|DATACONS|CODART|DESCR", "Selezione articoli",
|
||||
"@1|Ordine@6|N.Doc.@7|N.Riga@6|Data\nConsegna@10|Articolo@20|Descr@50",0,1);
|
||||
_sht->uncheck(-1);
|
||||
}
|
||||
|
||||
class TStampaProduzionePs0920 : public TSkeleton_application
|
||||
{
|
||||
virtual bool check_autorization() const { return false; }
|
||||
virtual const char * extra_modules() const {return "ve";}
|
||||
|
||||
|
||||
protected:
|
||||
virtual void main_loop();
|
||||
virtual bool create();
|
||||
|
||||
public:
|
||||
virtual ~TStampaProduzionePs0920();
|
||||
};
|
||||
|
||||
void TStampaProduzionePs0920::main_loop()
|
||||
{
|
||||
TMaskPs09201 m;
|
||||
|
||||
while (m.run() == K_ENTER)
|
||||
{
|
||||
TCursor_sheet& s = m.sheet();
|
||||
|
||||
if (s.one_checked())
|
||||
{
|
||||
TReport_book book;
|
||||
TCursor & cur = *s.cursor();
|
||||
TReport rep;
|
||||
|
||||
if (m.get_bool(F_PAGEBREAK))
|
||||
rep.load("OrdineProdSP.rep");
|
||||
else
|
||||
rep.load("OrdineProd.rep");
|
||||
const long items = cur.items();
|
||||
|
||||
for (long pos = 0L; pos < items; pos++)
|
||||
{
|
||||
if (s.checked(pos))
|
||||
{
|
||||
cur = pos;
|
||||
const TRectype & rec = cur.curr();
|
||||
TRecordset & r = *rep.recordset();
|
||||
TVariant var;
|
||||
|
||||
var = rec.get(RDOC_CODNUM);
|
||||
r.set_var("#S_NUM", var);
|
||||
var = rec.get(RDOC_ANNO);
|
||||
r.set_var("#S_ANNO", var);
|
||||
var = rec.get(RDOC_NDOC);
|
||||
r.set_var("#S_NDOC", var);
|
||||
var = rec.get(RDOC_NRIGA);
|
||||
r.set_var("#S_NRIGA", var);
|
||||
var = rec.get(RDOC_IDRIGA);
|
||||
r.set_var("#S_IDRIGA", var);
|
||||
book.add(rep);
|
||||
}
|
||||
}
|
||||
book.print_or_preview();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool TStampaProduzionePs0920::create()
|
||||
{
|
||||
return TSkeleton_application:: create();
|
||||
}
|
||||
|
||||
TStampaProduzionePs0920::~TStampaProduzionePs0920()
|
||||
{
|
||||
}
|
||||
|
||||
TStampaProduzionePs0920 & app() { return (TStampaProduzionePs0920&) main_app();}
|
||||
|
||||
int ps0920100(int argc, char* argv[])
|
||||
{
|
||||
TStampaProduzionePs0920 a;
|
||||
a.run(argc, argv, "Stampa ordini di produzione");
|
||||
return 0;
|
||||
}
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <defmask.h>
|
||||
#include <relation.h>
|
||||
#include <reprint.h>
|
||||
|
||||
#include "ps0920.h"
|
||||
#include "ps0920100a.h"
|
||||
|
||||
#include <rdoc.h>
|
||||
|
||||
class TMaskPs09201 : public TAutomask
|
||||
{
|
||||
TCursor_sheet * _sht;
|
||||
bool _select_changed;
|
||||
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
void update_sheet();
|
||||
|
||||
public:
|
||||
TCursor_sheet& sheet() const;
|
||||
TMaskPs09201();
|
||||
virtual ~TMaskPs09201();
|
||||
};
|
||||
|
||||
TCursor_sheet& TMaskPs09201::sheet() const
|
||||
{
|
||||
if (_sht == NULL) // Non si sa mai!
|
||||
((TMaskPs09201*)this)->update_sheet();
|
||||
return *_sht;
|
||||
}
|
||||
|
||||
|
||||
TMaskPs09201::TMaskPs09201()
|
||||
: TAutomask("ps0920100a"), _sht(NULL)
|
||||
{
|
||||
((TButton_field&) field(DLG_SELECT)).set_exit_key(0);
|
||||
_select_changed = true;
|
||||
}
|
||||
|
||||
TMaskPs09201::~TMaskPs09201()
|
||||
{
|
||||
if (_sht != NULL)
|
||||
delete _sht;
|
||||
}
|
||||
|
||||
bool TMaskPs09201::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
const int id = o.dlg();
|
||||
switch (id)
|
||||
{
|
||||
case F_NUM:
|
||||
case F_ANNO:
|
||||
case F_CODCLI:
|
||||
_select_changed = true;
|
||||
break;
|
||||
case DLG_SELECT:
|
||||
if (e == fe_button)
|
||||
{
|
||||
if (_select_changed)
|
||||
update_sheet();
|
||||
_select_changed = false;
|
||||
_sht->run();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TMaskPs09201::update_sheet()
|
||||
{
|
||||
|
||||
if (_sht != NULL)
|
||||
{
|
||||
delete _sht;
|
||||
_sht = NULL;
|
||||
}
|
||||
|
||||
_select_changed = false;
|
||||
|
||||
TRelation * r = new TRelation(LF_RIGHEDOC);
|
||||
TRectype from(r->curr());
|
||||
const long codcli = get_long(F_CODCLI);
|
||||
TString codartfrom; codartfrom.format("%03ld", codcli);
|
||||
|
||||
from.put(RDOC_CODNUM, get(F_NUM));
|
||||
from.put(RDOC_ANNO, get(F_ANNO));
|
||||
from.put(RDOC_PROVV, "D");
|
||||
from.put(RDOC_CODART, codartfrom);
|
||||
|
||||
TRectype to(from);
|
||||
|
||||
TString codartto; codartto.format("%03ld", codcli + 1);
|
||||
to.put(RDOC_CODART, codartto);
|
||||
TCursor * c = new TSorted_cursor(r, "CODNUM|NDOC|NRIGA", "RIGAEVASA!=\"X\"", 2, &from, &to);
|
||||
_sht = new TCursor_sheet(c, " |CODNUM|NDOC|NRIGA|DATACONS|CODART|DESCR", "Selezione articoli",
|
||||
"@1|Ordine@6|N.Doc.@7|N.Riga@6|Data\nConsegna@10|Articolo@20|Descr@50",0,1);
|
||||
_sht->uncheck(-1);
|
||||
}
|
||||
|
||||
class TStampaProduzionePs0920 : public TSkeleton_application
|
||||
{
|
||||
virtual bool check_autorization() const { return false; }
|
||||
virtual const char * extra_modules() const {return "ve";}
|
||||
|
||||
|
||||
protected:
|
||||
virtual void main_loop();
|
||||
virtual bool create();
|
||||
|
||||
public:
|
||||
virtual ~TStampaProduzionePs0920();
|
||||
};
|
||||
|
||||
void TStampaProduzionePs0920::main_loop()
|
||||
{
|
||||
TMaskPs09201 m;
|
||||
|
||||
while (m.run() == K_ENTER)
|
||||
{
|
||||
TCursor_sheet& s = m.sheet();
|
||||
|
||||
if (s.one_checked())
|
||||
{
|
||||
TReport_book book;
|
||||
TCursor & cur = *s.cursor();
|
||||
TReport rep;
|
||||
|
||||
if (m.get_bool(F_PAGEBREAK))
|
||||
rep.load("OrdineProdSP.rep");
|
||||
else
|
||||
rep.load("OrdineProd.rep");
|
||||
const long items = cur.items();
|
||||
|
||||
for (long pos = 0L; pos < items; pos++)
|
||||
{
|
||||
if (s.checked(pos))
|
||||
{
|
||||
cur = pos;
|
||||
const TRectype & rec = cur.curr();
|
||||
TRecordset & r = *rep.recordset();
|
||||
TVariant var;
|
||||
|
||||
var = rec.get(RDOC_CODNUM);
|
||||
r.set_var("#S_NUM", var);
|
||||
var = rec.get(RDOC_ANNO);
|
||||
r.set_var("#S_ANNO", var);
|
||||
var = rec.get(RDOC_NDOC);
|
||||
r.set_var("#S_NDOC", var);
|
||||
var = rec.get(RDOC_NRIGA);
|
||||
r.set_var("#S_NRIGA", var);
|
||||
var = rec.get(RDOC_IDRIGA);
|
||||
r.set_var("#S_IDRIGA", var);
|
||||
book.add(rep);
|
||||
}
|
||||
}
|
||||
book.print_or_preview();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool TStampaProduzionePs0920::create()
|
||||
{
|
||||
return TSkeleton_application:: create();
|
||||
}
|
||||
|
||||
TStampaProduzionePs0920::~TStampaProduzionePs0920()
|
||||
{
|
||||
}
|
||||
|
||||
TStampaProduzionePs0920 & app() { return (TStampaProduzionePs0920&) main_app();}
|
||||
|
||||
int ps0920100(int argc, char* argv[])
|
||||
{
|
||||
TStampaProduzionePs0920 a;
|
||||
a.run(argc, argv, "Stampa ordini di produzione");
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
#define F_PROFILO 30
|
||||
#define F_ANNO 101
|
||||
#define F_NUM 102
|
||||
#define F_CODCLI 103
|
||||
#define F_RAGSOC 104
|
||||
#define F_PAGEBREAK 105
|
||||
|
||||
#define F_PROFILO 30
|
||||
#define F_ANNO 101
|
||||
#define F_NUM 102
|
||||
#define F_CODCLI 103
|
||||
#define F_RAGSOC 104
|
||||
#define F_PAGEBREAK 105
|
||||
|
@ -1,101 +1,107 @@
|
||||
#include "ps0920100a.h"
|
||||
|
||||
PAGE "Stampa ordini di produzione" -1 -1 80 11
|
||||
|
||||
GROUPBOX -1 78 5
|
||||
BEGIN
|
||||
PROMPT 2 1 "Selezione Documenti"
|
||||
FLAGS ""
|
||||
END
|
||||
|
||||
NUMBER F_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 4 2 "Anno "
|
||||
FIELD S_ANNO
|
||||
KEY 1
|
||||
USE ESC
|
||||
CHECKTYPE NORMAL
|
||||
INPUT CODTAB F_ANNO
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Data inizio esercizio" D0
|
||||
DISPLAY "Data fine esercizio" D1
|
||||
OUTPUT F_ANNO CODTAB
|
||||
FLAGS "RZ"
|
||||
END
|
||||
|
||||
STRING F_NUM 4
|
||||
BEGIN
|
||||
PROMPT 21 2 "Num. "
|
||||
FIELDS S_NUM
|
||||
HELP "Codice numerazione"
|
||||
USE %NUM
|
||||
INPUT CODTAB F_NUM
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_NUM CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
FLAG "UPA"
|
||||
WARNING "Numerazione assente"
|
||||
END
|
||||
|
||||
STRING F_CODCLI 3
|
||||
BEGIN
|
||||
PROMPT 4 4 "Cliente "
|
||||
WARNING "Cliente assente"
|
||||
FLAGS "R"
|
||||
FIELD CODCLI
|
||||
USE LF_CLIFO
|
||||
INPUT TIPOCF "C"
|
||||
INPUT CODCF F_CODCLI
|
||||
DISPLAY "Codice" CODCF
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
OUTPUT F_CODCLI CODCF
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
WARNING "Cliente assente"
|
||||
PROMPT 26 4 ""
|
||||
USE LF_CLIFO KEY 2
|
||||
INPUT TIPOCF "C"
|
||||
INPUT RAGSOC F_RAGSOC
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
DISPLAY "Partita IVA@12" PAIV
|
||||
DISPLAY "Codice" CODCF
|
||||
OUTPUT F_CODCLI CODCF
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
BOOLEAN F_PAGEBREAK
|
||||
BEGIN
|
||||
PROMPT 4 6 "Salto pagina per ogni scheda"
|
||||
END
|
||||
|
||||
STRING F_PROFILO 70 50
|
||||
BEGIN
|
||||
PROMPT 8 -4 "Profilo "
|
||||
PSELECT
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -13 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_SELECT 10 2
|
||||
BEGIN
|
||||
PROMPT -23 -1 "~Seleziona"
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -33 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
#include "ps0920100a.h"
|
||||
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -13 -1 ""
|
||||
PICTURE TOOL_PRINT
|
||||
END
|
||||
|
||||
BUTTON DLG_SELECT 10 2
|
||||
BEGIN
|
||||
PROMPT -23 -1 "~Seleziona"
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -33 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Stampa ordini di produzione" -1 -1 80 11
|
||||
|
||||
GROUPBOX -1 78 5
|
||||
BEGIN
|
||||
PROMPT 2 1 "Selezione Documenti"
|
||||
FLAGS ""
|
||||
END
|
||||
|
||||
NUMBER F_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 4 2 "Anno "
|
||||
FIELD S_ANNO
|
||||
KEY 1
|
||||
USE ESC
|
||||
CHECKTYPE NORMAL
|
||||
INPUT CODTAB F_ANNO
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Data inizio esercizio" D0
|
||||
DISPLAY "Data fine esercizio" D1
|
||||
OUTPUT F_ANNO CODTAB
|
||||
FLAGS "RZ"
|
||||
END
|
||||
|
||||
STRING F_NUM 4
|
||||
BEGIN
|
||||
PROMPT 21 2 "Num. "
|
||||
FIELDS S_NUM
|
||||
HELP "Codice numerazione"
|
||||
USE %NUM
|
||||
INPUT CODTAB F_NUM
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_NUM CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
FLAG "UPA"
|
||||
WARNING "Numerazione assente"
|
||||
END
|
||||
|
||||
STRING F_CODCLI 3
|
||||
BEGIN
|
||||
PROMPT 4 4 "Cliente "
|
||||
WARNING "Cliente assente"
|
||||
FLAGS "R"
|
||||
FIELD CODCLI
|
||||
USE LF_CLIFO
|
||||
INPUT TIPOCF "C"
|
||||
INPUT CODCF F_CODCLI
|
||||
DISPLAY "Codice" CODCF
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
OUTPUT F_CODCLI CODCF
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
WARNING "Cliente assente"
|
||||
PROMPT 26 4 ""
|
||||
USE LF_CLIFO KEY 2
|
||||
INPUT TIPOCF "C"
|
||||
INPUT RAGSOC F_RAGSOC
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
DISPLAY "Partita IVA@12" PAIV
|
||||
DISPLAY "Codice" CODCF
|
||||
OUTPUT F_CODCLI CODCF
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
BOOLEAN F_PAGEBREAK
|
||||
BEGIN
|
||||
PROMPT 4 6 "Salto pagina per ogni scheda"
|
||||
END
|
||||
|
||||
STRING F_PROFILO 70 50
|
||||
BEGIN
|
||||
PROMPT 8 -4 "Profilo "
|
||||
PSELECT
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
|
276
ps/ps0920200.cpp
276
ps/ps0920200.cpp
@ -1,138 +1,138 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <defmask.h>
|
||||
#include <relation.h>
|
||||
#include <cfven.h>
|
||||
#include "../ve/velib.h"
|
||||
|
||||
#include "ps0920.h"
|
||||
#include "ps0920200a.h"
|
||||
|
||||
#include <rdoc.h>
|
||||
|
||||
class TMaskPs09202 : public TAutomask
|
||||
{
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
TMaskPs09202();
|
||||
virtual ~TMaskPs09202();
|
||||
};
|
||||
|
||||
TMaskPs09202::TMaskPs09202()
|
||||
: TAutomask("ps0920200a")
|
||||
{
|
||||
}
|
||||
|
||||
TMaskPs09202::~TMaskPs09202()
|
||||
{
|
||||
}
|
||||
|
||||
bool TMaskPs09202::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
const int id = o.dlg();
|
||||
switch (id)
|
||||
{
|
||||
case F_CODCLI:
|
||||
if (e == fe_modify)
|
||||
{
|
||||
TString key; key.format("C|%ld", atol(o.get()));
|
||||
const TRectype & cli = cache().get(LF_CFVEN, key);
|
||||
if (cli.get(CFV_ASSFIS).empty())
|
||||
o.mask().enable(F_CODIVA);
|
||||
else
|
||||
{
|
||||
o.mask().set(F_CODIVA, "");
|
||||
o.mask().disable(F_CODIVA);
|
||||
}
|
||||
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
class TAggiornaIVAPs0920 : public TSkeleton_application
|
||||
{
|
||||
TMaskPs09202 * _mask;
|
||||
virtual bool check_autorization() const {return false;}
|
||||
virtual const char * extra_modules() const {return "ve";}
|
||||
|
||||
|
||||
protected:
|
||||
virtual void main_loop();
|
||||
virtual bool create();
|
||||
|
||||
public:
|
||||
const TMaskPs09202 & mask() const {return *_mask;}
|
||||
virtual ~TAggiornaIVAPs0920();
|
||||
};
|
||||
|
||||
void TAggiornaIVAPs0920::main_loop()
|
||||
{
|
||||
while (_mask->run() == K_ENTER)
|
||||
{
|
||||
TCursor c(new TRelation(LF_DOC));
|
||||
TRectype from(c.curr());
|
||||
|
||||
from.put(DOC_PROVV, "D");
|
||||
from.put(DOC_CODNUM, _mask->get(F_NUM));
|
||||
from.put(DOC_ANNO, _mask->get_int(F_ANNO));
|
||||
|
||||
TRectype to(from);
|
||||
from.put(DOC_NDOC, _mask->get_int(F_NDOCDA));
|
||||
to.put(DOC_NDOC, _mask->get_int(F_NDOCA));
|
||||
c.setregion(from, to);
|
||||
TString filter; filter.format("CODCF=%ld", _mask->get_long(F_CODCLI));
|
||||
c.setfilter(filter);
|
||||
|
||||
TString key; key.format("C|%ld", _mask->get_long(F_CODCLI));
|
||||
const TRectype & cli = cache().get(LF_CFVEN, key);
|
||||
TString codice_IVA(cli.get(CFV_ASSFIS));
|
||||
|
||||
if (codice_IVA.empty())
|
||||
codice_IVA = _mask->get(F_CODIVA);
|
||||
|
||||
const long items = c.items();
|
||||
TString16 iva_orig;
|
||||
|
||||
for (c = 0L; c.pos() < items; ++c)
|
||||
{
|
||||
TDocumento doc(c.curr());
|
||||
const int rows = doc.physical_rows();
|
||||
|
||||
for (int r = 1 ; r <= rows; r++)
|
||||
{
|
||||
TRiga_documento & riga = doc[r];
|
||||
|
||||
iva_orig = riga.get(RDOC_CODIVA);
|
||||
|
||||
if (iva_orig.not_empty())
|
||||
riga.put(RDOC_CODIVA, codice_IVA);
|
||||
}
|
||||
doc.rewrite();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool TAggiornaIVAPs0920::create()
|
||||
{
|
||||
_mask = new TMaskPs09202;
|
||||
return TSkeleton_application:: create();
|
||||
}
|
||||
|
||||
TAggiornaIVAPs0920::~TAggiornaIVAPs0920()
|
||||
{
|
||||
delete _mask;
|
||||
}
|
||||
|
||||
TAggiornaIVAPs0920 & app() { return (TAggiornaIVAPs0920&) main_app();}
|
||||
|
||||
int ps0920200(int argc, char* argv[])
|
||||
{
|
||||
TAggiornaIVAPs0920 a;
|
||||
a.run(argc, argv, "Aggiornamento IVA Documenti");
|
||||
return 0;
|
||||
}
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <defmask.h>
|
||||
#include <relation.h>
|
||||
#include <cfven.h>
|
||||
#include "../ve/velib.h"
|
||||
|
||||
#include "ps0920.h"
|
||||
#include "ps0920200a.h"
|
||||
|
||||
#include <rdoc.h>
|
||||
|
||||
class TMaskPs09202 : public TAutomask
|
||||
{
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
TMaskPs09202();
|
||||
virtual ~TMaskPs09202();
|
||||
};
|
||||
|
||||
TMaskPs09202::TMaskPs09202()
|
||||
: TAutomask("ps0920200a")
|
||||
{
|
||||
}
|
||||
|
||||
TMaskPs09202::~TMaskPs09202()
|
||||
{
|
||||
}
|
||||
|
||||
bool TMaskPs09202::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
const int id = o.dlg();
|
||||
switch (id)
|
||||
{
|
||||
case F_CODCLI:
|
||||
if (e == fe_modify)
|
||||
{
|
||||
TString key; key.format("C|%ld", atol(o.get()));
|
||||
const TRectype & cli = cache().get(LF_CFVEN, key);
|
||||
if (cli.get(CFV_ASSFIS).empty())
|
||||
o.mask().enable(F_CODIVA);
|
||||
else
|
||||
{
|
||||
o.mask().set(F_CODIVA, "");
|
||||
o.mask().disable(F_CODIVA);
|
||||
}
|
||||
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
class TAggiornaIVAPs0920 : public TSkeleton_application
|
||||
{
|
||||
TMaskPs09202 * _mask;
|
||||
virtual bool check_autorization() const {return false;}
|
||||
virtual const char * extra_modules() const {return "ve";}
|
||||
|
||||
|
||||
protected:
|
||||
virtual void main_loop();
|
||||
virtual bool create();
|
||||
|
||||
public:
|
||||
const TMaskPs09202 & mask() const {return *_mask;}
|
||||
virtual ~TAggiornaIVAPs0920();
|
||||
};
|
||||
|
||||
void TAggiornaIVAPs0920::main_loop()
|
||||
{
|
||||
while (_mask->run() == K_ENTER)
|
||||
{
|
||||
TCursor c(new TRelation(LF_DOC));
|
||||
TRectype from(c.curr());
|
||||
|
||||
from.put(DOC_PROVV, "D");
|
||||
from.put(DOC_CODNUM, _mask->get(F_NUM));
|
||||
from.put(DOC_ANNO, _mask->get_int(F_ANNO));
|
||||
|
||||
TRectype to(from);
|
||||
from.put(DOC_NDOC, _mask->get_int(F_NDOCDA));
|
||||
to.put(DOC_NDOC, _mask->get_int(F_NDOCA));
|
||||
c.setregion(from, to);
|
||||
TString filter; filter.format("CODCF=%ld", _mask->get_long(F_CODCLI));
|
||||
c.setfilter(filter);
|
||||
|
||||
TString key; key.format("C|%ld", _mask->get_long(F_CODCLI));
|
||||
const TRectype & cli = cache().get(LF_CFVEN, key);
|
||||
TString codice_IVA(cli.get(CFV_ASSFIS));
|
||||
|
||||
if (codice_IVA.empty())
|
||||
codice_IVA = _mask->get(F_CODIVA);
|
||||
|
||||
const long items = c.items();
|
||||
TString16 iva_orig;
|
||||
|
||||
for (c = 0L; c.pos() < items; ++c)
|
||||
{
|
||||
TDocumento doc(c.curr());
|
||||
const int rows = doc.physical_rows();
|
||||
|
||||
for (int r = 1 ; r <= rows; r++)
|
||||
{
|
||||
TRiga_documento & riga = doc[r];
|
||||
|
||||
iva_orig = riga.get(RDOC_CODIVA);
|
||||
|
||||
if (iva_orig.not_empty())
|
||||
riga.put(RDOC_CODIVA, codice_IVA);
|
||||
}
|
||||
doc.rewrite();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool TAggiornaIVAPs0920::create()
|
||||
{
|
||||
_mask = new TMaskPs09202;
|
||||
return TSkeleton_application:: create();
|
||||
}
|
||||
|
||||
TAggiornaIVAPs0920::~TAggiornaIVAPs0920()
|
||||
{
|
||||
delete _mask;
|
||||
}
|
||||
|
||||
TAggiornaIVAPs0920 & app() { return (TAggiornaIVAPs0920&) main_app();}
|
||||
|
||||
int ps0920200(int argc, char* argv[])
|
||||
{
|
||||
TAggiornaIVAPs0920 a;
|
||||
a.run(argc, argv, "Aggiornamento IVA Documenti");
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,11 +1,8 @@
|
||||
#define F_PROFILO 30
|
||||
#define F_ANNO 101
|
||||
#define F_NUM 102
|
||||
#define F_CODCLI 103
|
||||
#define F_RAGSOC 104
|
||||
#define F_NDOCDA 105
|
||||
#define F_NDOCA 106
|
||||
#define F_CODIVA 107
|
||||
|
||||
|
||||
|
||||
#define F_PROFILO 30
|
||||
#define F_ANNO 101
|
||||
#define F_NUM 102
|
||||
#define F_CODCLI 103
|
||||
#define F_RAGSOC 104
|
||||
#define F_NDOCDA 105
|
||||
#define F_NDOCA 106
|
||||
#define F_CODIVA 107
|
||||
|
@ -1,150 +1,144 @@
|
||||
#include "ps0920200a.h"
|
||||
|
||||
PAGE "Aggiornamento IVA Documenti" -1 -1 80 12
|
||||
|
||||
GROUPBOX -1 78 5
|
||||
BEGIN
|
||||
PROMPT 2 1 "Selezione Documenti"
|
||||
FLAGS ""
|
||||
END
|
||||
|
||||
NUMBER F_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 4 2 "Anno "
|
||||
FIELD S_ANNO
|
||||
KEY 1
|
||||
USE ESC
|
||||
CHECKTYPE NORMAL
|
||||
INPUT CODTAB F_ANNO
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Data inizio esercizio" D0
|
||||
DISPLAY "Data fine esercizio" D1
|
||||
OUTPUT F_ANNO CODTAB
|
||||
FLAGS "RZ"
|
||||
END
|
||||
|
||||
STRING F_NUM 4
|
||||
BEGIN
|
||||
PROMPT 26 2 "Num. "
|
||||
FIELDS S_NUM
|
||||
HELP "Codice numerazione"
|
||||
USE %NUM
|
||||
INPUT CODTAB F_NUM
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_NUM CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
FLAG "UPA"
|
||||
WARNING "Numerazione assente"
|
||||
END
|
||||
|
||||
STRING F_CODCLI 3
|
||||
BEGIN
|
||||
PROMPT 4 4 "Cliente "
|
||||
WARNING "Cliente assente"
|
||||
FLAGS "R"
|
||||
FIELD CODCLI
|
||||
USE LF_CLIFO
|
||||
INPUT TIPOCF "C"
|
||||
INPUT CODCF F_CODCLI
|
||||
DISPLAY "Codice" CODCF
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
OUTPUT F_CODCLI CODCF
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
WARNING "Cliente assente"
|
||||
PROMPT 26 4 ""
|
||||
USE LF_CLIFO KEY 2
|
||||
INPUT TIPOCF "C"
|
||||
INPUT RAGSOC F_RAGSOC
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
DISPLAY "Partita IVA@12" PAIV
|
||||
DISPLAY "Codice" CODCF
|
||||
OUTPUT F_CODCLI CODCF
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
NUMBER F_NDOCDA 6
|
||||
BEGIN
|
||||
PROMPT 4 6 "Da numero "
|
||||
USE LF_DOC SELECT CODCF=#F_CODCLI
|
||||
JOIN LF_CLIFO TO LF_DOC INTO TIPOCF==TIPOCF CODCF==CODCF
|
||||
INPUT PROVV "D" SELECT
|
||||
INPUT ANNO F_ANNO SELECT
|
||||
INPUT CODNUM F_NUM SELECT
|
||||
INPUT NDOC F_NDOCDA
|
||||
DISPLAY "Num." CODNUM
|
||||
DISPLAY "Anno" ANNO
|
||||
DISPLAY "Provv" PROVV
|
||||
DISPLAY "Tipo" TIPODOC
|
||||
DISPLAY "N.Doc. " NDOC
|
||||
DISPLAY "Stato@R" STATO
|
||||
DISPLAY "Data\ndocumento" DATADOC
|
||||
DISPLAY "C/F" TIPOCF
|
||||
DISPLAY "Codice" CODCF
|
||||
DISPLAY "Ragione Sociale@50" LF_CLIFO->RAGSOC
|
||||
OUTPUT F_NDOCDA NDOC
|
||||
CHECKTYPE NORMAL
|
||||
FLAG "R"
|
||||
END
|
||||
|
||||
NUMBER F_NDOCA 6
|
||||
BEGIN
|
||||
PROMPT 26 6 "A Numero "
|
||||
USE LF_DOC SELECT CODCF=#F_CODCLI
|
||||
JOIN LF_CLIFO TO LF_DOC INTO TIPOCF==TIPOCF CODCF==CODCF
|
||||
INPUT PROVV "D" SELECT
|
||||
INPUT ANNO F_ANNO SELECT
|
||||
INPUT CODNUM F_NUM SELECT
|
||||
INPUT NDOC F_NDOCA
|
||||
DISPLAY "Num." CODNUM
|
||||
DISPLAY "Anno" ANNO
|
||||
DISPLAY "Provv" PROVV
|
||||
DISPLAY "Tipo" TIPODOC
|
||||
DISPLAY "N.Doc. " NDOC
|
||||
DISPLAY "Stato@R" STATO
|
||||
DISPLAY "Data\ndocumento" DATADOC
|
||||
DISPLAY "C/F" TIPOCF
|
||||
DISPLAY "Codice" CODCF
|
||||
DISPLAY "Ragione Sociale@50" LF_CLIFO->RAGSOC
|
||||
OUTPUT F_NDOCA NDOC
|
||||
CHECKTYPE NORMAL
|
||||
FLAG "R"
|
||||
END
|
||||
|
||||
STRING F_CODIVA 4
|
||||
BEGIN
|
||||
PROMPT 4 8 "Codice IVA "
|
||||
USE %IVA
|
||||
INPUT CODTAB F_CODIVA
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_CODIVA CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_PROFILO 70 50
|
||||
BEGIN
|
||||
PROMPT 8 -3 "Profilo "
|
||||
PSELECT
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
#include "ps0920200a.h"
|
||||
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
#include <elabar.h>
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Aggiornamento IVA Documenti" -1 -1 80 12
|
||||
|
||||
GROUPBOX -1 78 5
|
||||
BEGIN
|
||||
PROMPT 2 1 "Selezione Documenti"
|
||||
FLAGS ""
|
||||
END
|
||||
|
||||
NUMBER F_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 4 2 "Anno "
|
||||
FIELD S_ANNO
|
||||
KEY 1
|
||||
USE ESC
|
||||
CHECKTYPE NORMAL
|
||||
INPUT CODTAB F_ANNO
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Data inizio esercizio" D0
|
||||
DISPLAY "Data fine esercizio" D1
|
||||
OUTPUT F_ANNO CODTAB
|
||||
FLAGS "RZ"
|
||||
END
|
||||
|
||||
STRING F_NUM 4
|
||||
BEGIN
|
||||
PROMPT 26 2 "Num. "
|
||||
FIELDS S_NUM
|
||||
HELP "Codice numerazione"
|
||||
USE %NUM
|
||||
INPUT CODTAB F_NUM
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_NUM CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
FLAG "UPA"
|
||||
WARNING "Numerazione assente"
|
||||
END
|
||||
|
||||
STRING F_CODCLI 3
|
||||
BEGIN
|
||||
PROMPT 4 4 "Cliente "
|
||||
WARNING "Cliente assente"
|
||||
FLAGS "R"
|
||||
FIELD CODCLI
|
||||
USE LF_CLIFO
|
||||
INPUT TIPOCF "C"
|
||||
INPUT CODCF F_CODCLI
|
||||
DISPLAY "Codice" CODCF
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
OUTPUT F_CODCLI CODCF
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
WARNING "Cliente assente"
|
||||
PROMPT 26 4 ""
|
||||
USE LF_CLIFO KEY 2
|
||||
INPUT TIPOCF "C"
|
||||
INPUT RAGSOC F_RAGSOC
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
DISPLAY "Partita IVA@12" PAIV
|
||||
DISPLAY "Codice" CODCF
|
||||
OUTPUT F_CODCLI CODCF
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
NUMBER F_NDOCDA 6
|
||||
BEGIN
|
||||
PROMPT 4 6 "Da numero "
|
||||
USE LF_DOC SELECT CODCF=#F_CODCLI
|
||||
JOIN LF_CLIFO TO LF_DOC INTO TIPOCF==TIPOCF CODCF==CODCF
|
||||
INPUT PROVV "D" SELECT
|
||||
INPUT ANNO F_ANNO SELECT
|
||||
INPUT CODNUM F_NUM SELECT
|
||||
INPUT NDOC F_NDOCDA
|
||||
DISPLAY "Num." CODNUM
|
||||
DISPLAY "Anno" ANNO
|
||||
DISPLAY "Provv" PROVV
|
||||
DISPLAY "Tipo" TIPODOC
|
||||
DISPLAY "N.Doc. " NDOC
|
||||
DISPLAY "Stato@R" STATO
|
||||
DISPLAY "Data\ndocumento" DATADOC
|
||||
DISPLAY "C/F" TIPOCF
|
||||
DISPLAY "Codice" CODCF
|
||||
DISPLAY "Ragione Sociale@50" LF_CLIFO->RAGSOC
|
||||
OUTPUT F_NDOCDA NDOC
|
||||
CHECKTYPE NORMAL
|
||||
FLAG "R"
|
||||
END
|
||||
|
||||
NUMBER F_NDOCA 6
|
||||
BEGIN
|
||||
PROMPT 26 6 "A Numero "
|
||||
USE LF_DOC SELECT CODCF=#F_CODCLI
|
||||
JOIN LF_CLIFO TO LF_DOC INTO TIPOCF==TIPOCF CODCF==CODCF
|
||||
INPUT PROVV "D" SELECT
|
||||
INPUT ANNO F_ANNO SELECT
|
||||
INPUT CODNUM F_NUM SELECT
|
||||
INPUT NDOC F_NDOCA
|
||||
DISPLAY "Num." CODNUM
|
||||
DISPLAY "Anno" ANNO
|
||||
DISPLAY "Provv" PROVV
|
||||
DISPLAY "Tipo" TIPODOC
|
||||
DISPLAY "N.Doc. " NDOC
|
||||
DISPLAY "Stato@R" STATO
|
||||
DISPLAY "Data\ndocumento" DATADOC
|
||||
DISPLAY "C/F" TIPOCF
|
||||
DISPLAY "Codice" CODCF
|
||||
DISPLAY "Ragione Sociale@50" LF_CLIFO->RAGSOC
|
||||
OUTPUT F_NDOCA NDOC
|
||||
CHECKTYPE NORMAL
|
||||
FLAG "R"
|
||||
END
|
||||
|
||||
STRING F_CODIVA 4
|
||||
BEGIN
|
||||
PROMPT 4 8 "Codice IVA "
|
||||
USE %IVA
|
||||
INPUT CODTAB F_CODIVA
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_CODIVA CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_PROFILO 70 50
|
||||
BEGIN
|
||||
PROMPT 8 -3 "Profilo "
|
||||
PSELECT
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
754
ps/ps0920300.cpp
754
ps/ps0920300.cpp
@ -1,392 +1,362 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <progind.h>
|
||||
#include <reprint.h>
|
||||
#include <reputils.h>
|
||||
|
||||
#include "../db/dblib.h"
|
||||
#include "../ve/velib.h"
|
||||
|
||||
#include "ps0920.h"
|
||||
#include "ps0920300a.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// MASCHERA
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
class TPianifica_impianti_mask : public TAutomask
|
||||
{
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
TPianifica_impianti_mask();
|
||||
virtual ~TPianifica_impianti_mask();
|
||||
};
|
||||
|
||||
TPianifica_impianti_mask::TPianifica_impianti_mask()
|
||||
: TAutomask("ps0920300a")
|
||||
{
|
||||
}
|
||||
|
||||
TPianifica_impianti_mask::~TPianifica_impianti_mask()
|
||||
{
|
||||
}
|
||||
|
||||
bool TPianifica_impianti_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
const int id = o.dlg();
|
||||
switch (id)
|
||||
{
|
||||
case F_ADATA:
|
||||
if (e == fe_modify)
|
||||
{
|
||||
const TDate dadata = get_date(F_DADATA);
|
||||
const int daanno = dadata.year();
|
||||
const TDate adata = o.get();
|
||||
const int aanno = adata.year();
|
||||
if (daanno != aanno)
|
||||
return error_box(TR("Le date devono appartenere allo stesso anno!"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// APPLICAZIONE
|
||||
/////////////////////////////////////////////////////////////////
|
||||
class TPianifica_impianti : public TSkeleton_application
|
||||
{
|
||||
TPianifica_impianti_mask * _mask;
|
||||
virtual bool check_autorization() const {return false;}
|
||||
virtual const char * extra_modules() const {return "ve";}
|
||||
bool find_my_sister_row(const TRiga_documento& source_row, const TString& a_codnum, const TCodice_articolo& son_codartmag,
|
||||
const TString& a_impianto, TRectype& sister_row, TLog_report& log) const;
|
||||
void delete_old_docs();
|
||||
void create_new_docs(TLog_report& log);
|
||||
|
||||
protected:
|
||||
virtual void main_loop();
|
||||
virtual bool create();
|
||||
|
||||
public:
|
||||
const TPianifica_impianti_mask & mask() const {return *_mask;}
|
||||
virtual ~TPianifica_impianti();
|
||||
};
|
||||
|
||||
|
||||
void TPianifica_impianti::delete_old_docs()
|
||||
{
|
||||
TDate dadata = _mask->get_date(F_DADATA);
|
||||
TDate adata = _mask->get_date(F_ADATA);
|
||||
const int lastday = adata - dadata;
|
||||
const int anno = dadata.year();
|
||||
const TString& codnum = _mask->get(F_ANUM); //accoppa i documenti con numerazione di destinazione..
|
||||
const TString& impianto = _mask->get(F_DAIMP); //..e con l'impianto sorgente! (rompe la supersimmetria)
|
||||
|
||||
TRelation rel_doc(LF_DOC);
|
||||
|
||||
TRectype darec(LF_DOC), arec(LF_DOC);
|
||||
TDate from(1, 1, anno - 1);
|
||||
TDate to(31, 12, anno);
|
||||
|
||||
darec.put(DOC_DATADOC, from);
|
||||
darec.put(DOC_PROVV, "D");
|
||||
darec.put(DOC_ANNO, anno);
|
||||
darec.put(DOC_CODNUM, codnum);
|
||||
|
||||
arec.put(DOC_DATADOC, to);
|
||||
arec.put(DOC_PROVV, "D");
|
||||
arec.put(DOC_ANNO, anno);
|
||||
arec.put(DOC_CODNUM, codnum);
|
||||
|
||||
TString filtro;
|
||||
filtro << "CODNUM='" << codnum << "'";
|
||||
|
||||
TCursor cur_doc (&rel_doc, filtro, 3, &darec, &arec);
|
||||
const long items = cur_doc.items();
|
||||
cur_doc.freeze();
|
||||
TProgind progind(items, "Eliminazione vecchi documenti in corso...", false, true);
|
||||
|
||||
dadata += _delays[0];
|
||||
adata += _delays[lastday ];
|
||||
for (cur_doc = 0; cur_doc.pos() < items; ++cur_doc)
|
||||
{
|
||||
progind.addstatus(1);
|
||||
TDocumento doc(cur_doc.curr());
|
||||
//trovato un documento che soddisfa il darec/arec deve eliminarlo se la prima riga ha impianto..
|
||||
//..uguale a quello nel campo F_AIMP sulla maschera
|
||||
const TDate h_datacons = doc.get_date(DOC_DATACONS);
|
||||
bool imp_ok =false, datacons_ok = false;
|
||||
|
||||
for (int i = 1; i <= doc.physical_rows(); i++)
|
||||
{
|
||||
const TRiga_documento& rigadoc = doc[i];
|
||||
if (rigadoc.get(RDOC_IMPIANTO) == impianto)
|
||||
imp_ok = true;
|
||||
const TDate datacons = rigadoc.get_date(RDOC_DATACONS);
|
||||
if (datacons.ok())
|
||||
datacons_ok = (datacons >= dadata) && (datacons <= adata);
|
||||
else
|
||||
datacons_ok = (h_datacons >= dadata) && (h_datacons <= adata);
|
||||
if (imp_ok && datacons_ok)
|
||||
{
|
||||
doc.remove();
|
||||
break;
|
||||
}
|
||||
} //for(int i =...
|
||||
} //for(cur_doc..
|
||||
}
|
||||
|
||||
bool TPianifica_impianti::find_my_sister_row(const TRiga_documento& source_row, const TString& a_codnum,
|
||||
const TCodice_articolo& son_codartmag,
|
||||
const TString& a_impianto, TRectype& sister_row,
|
||||
TLog_report& log) const
|
||||
{
|
||||
TRelation rel_righedoc(LF_RIGHEDOC);
|
||||
TString filtro;
|
||||
filtro << "(CODNUM='" << a_codnum << "')&&";
|
||||
filtro << "(IMPIANTO='" << a_impianto << "')&&";
|
||||
filtro << "(CODARTMAG='" << son_codartmag << "')";
|
||||
TCursor cur_righedoc(&rel_righedoc, filtro, 4, &source_row, &source_row);
|
||||
const long items = cur_righedoc.items();
|
||||
|
||||
if (items != 1)
|
||||
{
|
||||
TString errore;
|
||||
if (items == 0)
|
||||
{
|
||||
errore.format("Non ci sono documenti per l'articolo %s", (const char*)son_codartmag);
|
||||
log.log(2, errore);
|
||||
}
|
||||
else
|
||||
{
|
||||
errore.format("Ci sono %ld documenti per l'articolo %s", items, (const char*)son_codartmag);
|
||||
log.log(1, errore);
|
||||
}
|
||||
}
|
||||
|
||||
if (items > 0)
|
||||
{
|
||||
cur_righedoc = 0;
|
||||
sister_row = cur_righedoc.curr();
|
||||
}
|
||||
return items > 0;
|
||||
}
|
||||
|
||||
void TPianifica_impianti::create_new_docs(TLog_report& log)
|
||||
{
|
||||
const TDate dadata = _mask->get_date(F_DADATA);
|
||||
const TDate adata = _mask->get_date(F_ADATA);
|
||||
const int anno = dadata.year();
|
||||
const TString& da_codnum = _mask->get(F_DANUM); //crea documenti con numerazioni sorgenti...
|
||||
const TString& da_impianto = _mask->get(F_DAIMP); //..con l'impianto sorgente! (conserva la supersimmetria)
|
||||
|
||||
//questi servono dopo!!!
|
||||
const TString& a_codnum = _mask->get(F_ANUM);
|
||||
const int ritardo = _mask->get_int(F_RITARDO);
|
||||
const TString& a_impianto = _mask->get(F_AIMP);
|
||||
|
||||
TRelation rel_doc(LF_DOC);
|
||||
|
||||
TRectype darec(LF_DOC), arec(LF_DOC);
|
||||
TLocalisamfile db(LF_RDIST);
|
||||
TDate from(1, 1, anno - 1);
|
||||
TDate to(31, 12, anno);
|
||||
|
||||
db.setkey(2);
|
||||
darec.put(DOC_DATADOC, from);
|
||||
|
||||
darec.put(DOC_PROVV, "D");
|
||||
darec.put(DOC_ANNO, anno);
|
||||
darec.put(DOC_CODNUM, da_codnum);
|
||||
|
||||
arec.put(DOC_DATADOC, to);
|
||||
arec.put(DOC_PROVV, "D");
|
||||
arec.put(DOC_ANNO, anno);
|
||||
arec.put(DOC_CODNUM, da_codnum);
|
||||
|
||||
TString filtro;
|
||||
filtro << "CODNUM='" << da_codnum << "'";
|
||||
TCursor cur_doc (&rel_doc, filtro, 3, &darec, &arec);
|
||||
const long items = cur_doc.items();
|
||||
cur_doc.freeze();
|
||||
TProgind progind(items, "Generazione nuovi documenti in corso...", false, true);
|
||||
|
||||
TDistinta_tree albero;
|
||||
TRectype sister_row(LF_RIGHEDOC);
|
||||
|
||||
for (cur_doc = 0; cur_doc.pos() < items; ++cur_doc)
|
||||
{
|
||||
progind.addstatus(1);
|
||||
TDocumento doc(cur_doc.curr());
|
||||
TDocumento nuovo_doc('D', anno, codnum, 0);
|
||||
|
||||
// crea un documento...
|
||||
nuovo_doc.copy_data(nuovo_doc, doc);
|
||||
nuovo_doc.put(DOC_TIPODOC, codnum); //il tipo deve corrispondere alla numerazione!
|
||||
nuovo_doc.put(DOC_STATO, 2);
|
||||
TDate datadoc = nuovo_doc.get(DOC_DATADOC);
|
||||
|
||||
TDate h_datacons = nuovo_doc.get(DOC_DATACONS);
|
||||
|
||||
if (h_datacons < dadata || h_datacons > adata)
|
||||
continue;
|
||||
|
||||
TDate datacons = h_datacons;
|
||||
|
||||
|
||||
const int ndays = datacons - dadata;
|
||||
|
||||
if (ndays > 365)
|
||||
continue;
|
||||
|
||||
datacons += _delays[ndays];
|
||||
nuovo_doc.put(DOC_DATACONS, datacons);
|
||||
|
||||
for (int i = 1; i <= doc.rows(); i++)
|
||||
{
|
||||
const TRiga_documento& source_row = doc[i]; //riga del documento sorgente
|
||||
const TString80 codice(source_row.get(RDOC_CODARTMAG));
|
||||
|
||||
if (codice == "008BTN008033MP01")
|
||||
int i = 1;
|
||||
|
||||
//il casino va fatto solo se la riga non e' gia' evasa, l'impianto e' quello selezionato e la riga e' riga articolo
|
||||
if (source_row.get(RDOC_IMPIANTO) == da_impianto && source_row.is_articolo())
|
||||
{
|
||||
|
||||
db.zero();
|
||||
db.put("CODCOMP", codice);
|
||||
const int err = db.read(_isgteq);
|
||||
|
||||
if (err == NOERR && codice == db.get("CODCOMP"))
|
||||
{
|
||||
TCodice_articolo son_codartmag;
|
||||
albero.curr_code(son_codartmag); //e' risalito al codice dell'articolo figlio
|
||||
//cerca la riga sua sorella, ovvero quella che viene dalla stessa riga ordine mamma originaria
|
||||
if (find_my_sister_row(source_row, a_codnum, son_codartmag, a_impianto, sister_row, log))
|
||||
{
|
||||
TDate datacons = sister_row.get_date(RDOC_DATACONS);
|
||||
//ignora righe con data consegna fuori dal range selezionato
|
||||
if (datacons < dadata || datacons > adata)
|
||||
continue;
|
||||
datacons += ritardo;
|
||||
const int priority = sister_row.get_int(RDOC_PRIORITY);
|
||||
|
||||
//crea un documento...
|
||||
TDocumento nuovo_doc('D', anno, a_codnum, 0);
|
||||
nuovo_doc.copy_data(nuovo_doc, doc);
|
||||
nuovo_doc.put(DOC_TIPODOC, a_codnum); //il tipo deve corrispondere alla numerazione!
|
||||
|
||||
//..e la sua riga vuota
|
||||
TRiga_documento& nuova_rigadoc = nuovo_doc.new_row(source_row.get(RDOC_TIPORIGA));
|
||||
//riempie la nuova riga
|
||||
nuovo_doc.copy_data(nuova_rigadoc, source_row);
|
||||
nuova_rigadoc.put(RDOC_PRIORITY, priority);
|
||||
nuova_rigadoc.put(RDOC_DATACONS, datacons);
|
||||
|
||||
//..e alla fine scrive testata e riga!!
|
||||
int err = nuovo_doc.write();
|
||||
if (err != NOERR)
|
||||
{
|
||||
TString errore;
|
||||
errore.format("Errore %d nella scrittura del documento %ld", err, nuovo_doc.get_long(DOC_NDOC));
|
||||
log.log(2, errore);
|
||||
}
|
||||
if (!datacons.ok())
|
||||
datacons = h_datacons;
|
||||
const int ndays = datacons - dadata;
|
||||
datacons += _delays[ndays];
|
||||
if (datacons < dadata || datacons > adata)
|
||||
continue;
|
||||
//..e la sua riga vuota
|
||||
TRiga_documento& nuova_rigadoc = nuovo_doc.new_row(source_row.get(RDOC_TIPORIGA));
|
||||
//riempie la nuova riga
|
||||
|
||||
nuovo_doc.copy_data(nuova_rigadoc, source_row);
|
||||
nuova_rigadoc.put(RDOC_CODART, dest_codart);
|
||||
nuova_rigadoc.put(RDOC_CODARTMAG, dest_codart);
|
||||
nuova_rigadoc.put(RDOC_PRIORITY, priority);
|
||||
nuova_rigadoc.zero(nuova_rigadoc.field_qtaevasa());
|
||||
nuova_rigadoc.zero(RDOC_RIGAEVASA);
|
||||
datacons = source_row.get_date(RDOC_DATACONS);
|
||||
if (datacons.ok())
|
||||
{
|
||||
datacons += _delays[ndays];
|
||||
nuova_rigadoc.put(RDOC_DATACONS, datacons);
|
||||
}
|
||||
nuova_rigadoc.put(RDOC_IMPIANTO, a_impianto);
|
||||
const TString &linea = lav->cod_linea(0);
|
||||
nuova_rigadoc.put(RDOC_LINEA, linea);
|
||||
found = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} //if(source_row.get...
|
||||
} //for(int i...
|
||||
} //for(cur_doc...
|
||||
}
|
||||
|
||||
void TPianifica_impianti::main_loop()
|
||||
{
|
||||
while (_mask->run() == K_ENTER)
|
||||
{
|
||||
TDate dadata = _mask->get_date(F_DADATA);
|
||||
TDate adata = _mask->get_date(F_ADATA);
|
||||
TDate data;
|
||||
int ndays = adata - dadata + 1;
|
||||
const int ritardo = _mask->get_int(F_RITARDO);
|
||||
_delays[0] = ritardo;
|
||||
|
||||
for (int i = 1; i < 366; i++)
|
||||
{
|
||||
data = dadata;
|
||||
data += i;
|
||||
const TDate workdate = data;
|
||||
if (!data.is_holiday() && data.wday() != 6)
|
||||
{
|
||||
TDate end_date = data;
|
||||
end_date += _delays[i - 1];
|
||||
while (end_date.is_holiday() || end_date.wday() == 6)
|
||||
++end_date;
|
||||
_delays[i] = end_date - workdate;
|
||||
}
|
||||
else
|
||||
_delays[i] = _delays [i - 1];
|
||||
}
|
||||
delete_old_docs(); //intanto accoppa i vecchi documenti di tipo destinazione
|
||||
//poi crea i nuovi documenti di produzione
|
||||
TLog_report log("Errori generazione documenti pianificazione");
|
||||
|
||||
create_new_docs(log);
|
||||
|
||||
TReport_book buc;
|
||||
buc.add(log);
|
||||
buc.preview();
|
||||
}
|
||||
|
||||
bool TPianifica_impianti::create()
|
||||
{
|
||||
open_files(LF_TAB, LF_TABCOM, LF_DOC, LF_RIGHEDOC, LF_DIST, LF_RDIST, LF_ANAMAG, NULL);
|
||||
_mask = new TPianifica_impianti_mask;
|
||||
return TSkeleton_application:: create();
|
||||
}
|
||||
|
||||
TPianifica_impianti::~TPianifica_impianti()
|
||||
{
|
||||
delete _mask;
|
||||
}
|
||||
|
||||
TPianifica_impianti & app() { return (TPianifica_impianti&) main_app();}
|
||||
|
||||
int ps0920300(int argc, char* argv[])
|
||||
{
|
||||
TPianifica_impianti a;
|
||||
a.run(argc, argv, "Pianificazione impianti");
|
||||
return 0;
|
||||
}
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <progind.h>
|
||||
#include <reprint.h>
|
||||
#include <reputils.h>
|
||||
|
||||
#include "../db/dblib.h"
|
||||
#include "../ve/velib.h"
|
||||
#include "../mr/mrplib.h"
|
||||
|
||||
#include "ps0920.h"
|
||||
#include "ps0920300a.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// MASCHERA
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
class TPianifica_impianti_mask : public TAutomask
|
||||
{
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
TPianifica_impianti_mask();
|
||||
virtual ~TPianifica_impianti_mask();
|
||||
};
|
||||
|
||||
TPianifica_impianti_mask::TPianifica_impianti_mask()
|
||||
: TAutomask("ps0920300a")
|
||||
{
|
||||
}
|
||||
|
||||
TPianifica_impianti_mask::~TPianifica_impianti_mask()
|
||||
{
|
||||
}
|
||||
|
||||
bool TPianifica_impianti_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
const int id = o.dlg();
|
||||
switch (id)
|
||||
{
|
||||
case F_ADATA:
|
||||
if (e == fe_modify)
|
||||
{
|
||||
const TDate dadata = get_date(F_DADATA);
|
||||
const int daanno = dadata.year();
|
||||
const TDate adata = o.get();
|
||||
const int aanno = adata.year();
|
||||
if (daanno != aanno)
|
||||
return error_box(TR("Le date devono appartenere allo stesso anno!"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// APPLICAZIONE
|
||||
/////////////////////////////////////////////////////////////////
|
||||
class TPianifica_impianti : public TSkeleton_application
|
||||
{
|
||||
TPianifica_impianti_mask * _mask;
|
||||
TArray _target_dates;
|
||||
|
||||
virtual bool check_autorization() const {return false;}
|
||||
virtual const char * extra_modules() const {return "ve";}
|
||||
bool find_my_sister_row(const TRiga_documento& source_row, const TString& a_codnum, const TCodice_articolo& son_codartmag,
|
||||
const TString& a_impianto, TRectype& sister_row, TLog_report& log) const;
|
||||
void delete_old_docs();
|
||||
void create_new_docs(TLog_report& log);
|
||||
|
||||
protected:
|
||||
virtual void main_loop();
|
||||
virtual bool create();
|
||||
|
||||
public:
|
||||
const TPianifica_impianti_mask & mask() const {return *_mask;}
|
||||
virtual ~TPianifica_impianti();
|
||||
};
|
||||
|
||||
|
||||
void TPianifica_impianti::delete_old_docs()
|
||||
{
|
||||
TDate dadata = _mask->get_date(F_DADATA);
|
||||
TDate adata = _mask->get_date(F_ADATA);
|
||||
const int lastday = adata - dadata;
|
||||
|
||||
const int anno = dadata.year();
|
||||
const TString& codnum = _mask->get(F_NUM); //accoppa i documenti con numerazione sorgente
|
||||
const TString& impianto = _mask->get(F_AIMP); //..e con l'impianto destinazione
|
||||
TRelation rel_doc(LF_DOC);
|
||||
TRectype darec(LF_DOC), arec(LF_DOC);
|
||||
TDate from(1, 1, anno - 1);
|
||||
TDate to(31, 12, anno);
|
||||
|
||||
darec.put(DOC_DATADOC, from);
|
||||
darec.put(DOC_PROVV, "D");
|
||||
darec.put(DOC_ANNO, anno);
|
||||
darec.put(DOC_CODNUM, codnum);
|
||||
|
||||
arec.put(DOC_DATADOC, to);
|
||||
arec.put(DOC_PROVV, "D");
|
||||
arec.put(DOC_ANNO, anno);
|
||||
arec.put(DOC_CODNUM, codnum);
|
||||
|
||||
TString filtro;
|
||||
filtro << "CODNUM='" << codnum << "'";
|
||||
|
||||
TCursor cur_doc (&rel_doc, filtro, 3, &darec, &arec);
|
||||
const long items = cur_doc.items();
|
||||
cur_doc.freeze();
|
||||
TProgind progind(items, "Eliminazione vecchi documenti in corso...", false, true);
|
||||
|
||||
dadata = (TDate&) _target_dates[0];
|
||||
adata = (TDate&) _target_dates[lastday];
|
||||
for (cur_doc = 0; cur_doc.pos() < items; ++cur_doc)
|
||||
{
|
||||
progind.addstatus(1);
|
||||
TDocumento doc(cur_doc.curr());
|
||||
//trovato un documento che soddisfa il darec/arec deve eliminarlo se la prima riga ha impianto..
|
||||
//..uguale a quello nel campo F_AIMP sulla maschera
|
||||
const TDate h_datacons = doc.get_date(DOC_DATACONS);
|
||||
bool imp_ok =false, datacons_ok = false;
|
||||
|
||||
for (int i = 1; i <= doc.physical_rows(); i++)
|
||||
{
|
||||
const TRiga_documento& rigadoc = doc[i];
|
||||
if (rigadoc.get(RDOC_IMPIANTO) == impianto)
|
||||
imp_ok = true;
|
||||
const TDate datacons = rigadoc.get_date(RDOC_DATACONS);
|
||||
if (datacons.ok())
|
||||
datacons_ok = (datacons >= dadata) && (datacons <= adata);
|
||||
else
|
||||
datacons_ok = (h_datacons >= dadata) && (h_datacons <= adata);
|
||||
if (imp_ok && datacons_ok)
|
||||
{
|
||||
doc.remove();
|
||||
break;
|
||||
}
|
||||
} //for(int i =...
|
||||
} //for(cur_doc..
|
||||
}
|
||||
|
||||
void TPianifica_impianti::create_new_docs(TLog_report& log)
|
||||
{
|
||||
const TDate dadata = _mask->get_date(F_DADATA);
|
||||
const TDate adata = _mask->get_date(F_ADATA);
|
||||
const int anno = dadata.year();
|
||||
const TString& codnum = _mask->get(F_NUM); //crea documenti con numerazioni sorgenti...
|
||||
const TString& da_impianto = _mask->get(F_DAIMP); //..con l'impianto sorgente! (conserva la supersimmetria)
|
||||
//questi servono dopo!!!
|
||||
const TString& a_impianto = _mask->get(F_AIMP);
|
||||
TRelation rel_doc(LF_DOC);
|
||||
TRectype darec(LF_DOC), arec(LF_DOC);
|
||||
TLocalisamfile db(LF_RDIST);
|
||||
TDate from(1, 1, anno - 1);
|
||||
TDate to(31, 12, anno);
|
||||
|
||||
db.setkey(2);
|
||||
darec.put(DOC_DATADOC, from);
|
||||
darec.put(DOC_PROVV, "D");
|
||||
darec.put(DOC_ANNO, anno);
|
||||
darec.put(DOC_CODNUM, codnum);
|
||||
|
||||
arec.put(DOC_DATADOC, to);
|
||||
arec.put(DOC_PROVV, "D");
|
||||
arec.put(DOC_ANNO, anno);
|
||||
arec.put(DOC_CODNUM, codnum);
|
||||
|
||||
TString filtro;
|
||||
TDistinta_tree albero;
|
||||
filtro << "CODNUM='" << codnum << "'";
|
||||
TCursor cur_doc (&rel_doc, filtro, 3, &darec, &arec);
|
||||
const long items = cur_doc.items();
|
||||
cur_doc.freeze();
|
||||
TProgind progind(items, "Generazione nuovi documenti in corso...", false, true);
|
||||
|
||||
for (cur_doc = 0; cur_doc.pos() < items; ++cur_doc)
|
||||
{
|
||||
progind.addstatus(1);
|
||||
TDocumento doc(cur_doc.curr());
|
||||
TDocumento nuovo_doc('D', anno, codnum, 0);
|
||||
|
||||
// crea un documento...
|
||||
nuovo_doc.copy_data(nuovo_doc, doc);
|
||||
nuovo_doc.put(DOC_TIPODOC, codnum); //il tipo deve corrispondere alla numerazione!
|
||||
nuovo_doc.put(DOC_STATO, 2);
|
||||
TDate datadoc = nuovo_doc.get(DOC_DATADOC);
|
||||
|
||||
TDate h_datacons = nuovo_doc.get(DOC_DATACONS);
|
||||
|
||||
if (h_datacons < dadata || h_datacons > adata)
|
||||
continue;
|
||||
|
||||
TDate datacons = h_datacons;
|
||||
|
||||
|
||||
const int ndays = datacons - dadata;
|
||||
|
||||
if (ndays > 365)
|
||||
continue;
|
||||
|
||||
datacons = (TDate &)_target_dates[ndays];
|
||||
nuovo_doc.put(DOC_DATACONS, datacons);
|
||||
|
||||
for (int i = 1; i <= doc.rows(); i++)
|
||||
{
|
||||
const TRiga_documento& source_row = doc[i]; //riga del documento sorgente
|
||||
const TString80 codice(source_row.get(RDOC_CODARTMAG));
|
||||
|
||||
|
||||
//il casino va fatto solo se la riga non e' gia' evasa, l'impianto e' quello selezionato e la riga e' riga articolo
|
||||
if (source_row.get(RDOC_IMPIANTO) == da_impianto && source_row.is_articolo())
|
||||
{
|
||||
|
||||
db.zero();
|
||||
db.put("CODCOMP", codice);
|
||||
const int err = db.read(_isgteq);
|
||||
|
||||
if (err == NOERR && codice == db.get("CODCOMP"))
|
||||
{
|
||||
const TCodice_articolo dest_codart = db.get("CODDIST");
|
||||
TArray labors;
|
||||
bool found = false;
|
||||
|
||||
albero.set_root(dest_codart);
|
||||
|
||||
for (TRiga_esplosione * l = albero.first_labor(labors); l != NULL && !found; l = albero.next_labor(labors))
|
||||
{
|
||||
TLavorazione * lav = TDistinta_tree::find_labor(l);
|
||||
|
||||
if (lav != NULL && a_impianto == lav->cod_impianto(0))
|
||||
{
|
||||
const int priority = source_row.get_int(RDOC_PRIORITY);
|
||||
TDate datacons = source_row.get_date(RDOC_DATACONS);
|
||||
|
||||
if (!datacons.ok())
|
||||
datacons = h_datacons;
|
||||
const int ndays = datacons - dadata;
|
||||
datacons = (TDate &)_target_dates[ndays];
|
||||
if (datacons < dadata || datacons > adata)
|
||||
continue;
|
||||
//..e la sua riga vuota
|
||||
TRiga_documento& nuova_rigadoc = nuovo_doc.new_row(source_row.get(RDOC_TIPORIGA));
|
||||
//riempie la nuova riga
|
||||
|
||||
nuovo_doc.copy_data(nuova_rigadoc, source_row);
|
||||
nuova_rigadoc.put(RDOC_CODART, dest_codart);
|
||||
nuova_rigadoc.put(RDOC_CODARTMAG, dest_codart);
|
||||
nuova_rigadoc.put(RDOC_PRIORITY, priority);
|
||||
nuova_rigadoc.zero(nuova_rigadoc.field_qtaevasa());
|
||||
nuova_rigadoc.zero(RDOC_RIGAEVASA);
|
||||
datacons = source_row.get_date(RDOC_DATACONS);
|
||||
if (datacons.ok())
|
||||
{
|
||||
datacons = (TDate &)_target_dates[ndays];
|
||||
nuova_rigadoc.put(RDOC_DATACONS, datacons);
|
||||
}
|
||||
nuova_rigadoc.put(RDOC_IMPIANTO, a_impianto);
|
||||
const TString &linea = lav->cod_linea(0);
|
||||
nuova_rigadoc.put(RDOC_LINEA, linea);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} //if(source_row.get...
|
||||
} //for(int i...
|
||||
if (nuovo_doc.physical_rows() > 0)
|
||||
{
|
||||
int err = nuovo_doc.write();
|
||||
if (err != NOERR)
|
||||
{
|
||||
TString errore;
|
||||
errore.format("Errore %d nella scrittura del documento %ld", err, nuovo_doc.get_long(DOC_NDOC));
|
||||
log.log(2, errore);
|
||||
}
|
||||
}
|
||||
} //for(cur_doc...
|
||||
}
|
||||
|
||||
void TPianifica_impianti::main_loop()
|
||||
{
|
||||
while (_mask->run() == K_ENTER)
|
||||
{
|
||||
TDate dadata = _mask->get_date(F_DADATA);
|
||||
TDate adata = _mask->get_date(F_ADATA);
|
||||
TDate data, end_date;
|
||||
const TString8 impianto = _mask->get(F_AIMP);
|
||||
const TString8 linea = _mask->get(F_LIN);
|
||||
TMRP_calendar c(linea, impianto);
|
||||
int ndays = adata - dadata + 1;
|
||||
const int ritardo = _mask->get_int(F_RITARDO);
|
||||
int min, max;
|
||||
|
||||
data = dadata;
|
||||
end_date = dadata;
|
||||
end_date += ritardo;
|
||||
if (!data.is_holiday() && data.wday() != 6)
|
||||
{
|
||||
c.turni(end_date, min, max);
|
||||
|
||||
while (max == 0 || end_date.is_holiday() || end_date.wday() == 6)
|
||||
c.turni(++end_date, min, max);
|
||||
}
|
||||
_target_dates.add(end_date, 0);
|
||||
|
||||
for (int i = 1; i < 366; i++)
|
||||
{
|
||||
data = dadata;
|
||||
data += i;
|
||||
end_date = (TDate &) _target_dates[i - 1];
|
||||
++end_date;
|
||||
if (!data.is_holiday() && data.wday() != 6)
|
||||
{
|
||||
c.turni(end_date, min, max);
|
||||
|
||||
while (max == 0 || end_date.is_holiday() || end_date.wday() == 6)
|
||||
{
|
||||
++end_date;
|
||||
c.turni(end_date, min, max);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
if (end_date - data > ritardo)
|
||||
--end_date;
|
||||
_target_dates.add(end_date, i);
|
||||
}
|
||||
delete_old_docs(); //intanto accoppa i vecchi documenti di tipo destinazione
|
||||
//poi crea i nuovi documenti di produzione
|
||||
TLog_report log("Errori generazione documenti pianificazione");
|
||||
|
||||
create_new_docs(log);
|
||||
|
||||
TReport_book buc;
|
||||
buc.add(log);
|
||||
buc.preview();
|
||||
}
|
||||
}
|
||||
|
||||
bool TPianifica_impianti::create()
|
||||
{
|
||||
open_files(LF_TAB, LF_TABCOM, LF_DOC, LF_RIGHEDOC, LF_DIST, LF_RDIST, LF_ANAMAG, NULL);
|
||||
_mask = new TPianifica_impianti_mask;
|
||||
return TSkeleton_application:: create();
|
||||
}
|
||||
|
||||
TPianifica_impianti::~TPianifica_impianti()
|
||||
{
|
||||
delete _mask;
|
||||
}
|
||||
|
||||
TPianifica_impianti & app() { return (TPianifica_impianti&) main_app();}
|
||||
|
||||
int ps0920300(int argc, char* argv[])
|
||||
{
|
||||
TPianifica_impianti a;
|
||||
a.run(argc, argv, "Pianificazione impianti");
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
#define F_DANUM 101
|
||||
#define F_DANUMDESC 102
|
||||
#define F_ANUM 103
|
||||
#define F_ANUMDESC 104
|
||||
#define F_DAIMP 105
|
||||
#define F_DAIMPDESC 106
|
||||
#define F_AIMP 107
|
||||
#define F_AIMPDESC 108
|
||||
#define F_DADATA 109
|
||||
#define F_ADATA 110
|
||||
#define F_RITARDO 111
|
||||
#define F_PROFILO 120
|
||||
#define F_NUM 101
|
||||
#define F_NUMDESC 102
|
||||
#define F_DAIMP 105
|
||||
#define F_DAIMPDESC 106
|
||||
#define F_AIMP 107
|
||||
#define F_AIMPDESC 108
|
||||
#define F_DADATA 109
|
||||
#define F_ADATA 110
|
||||
#define F_RITARDO 111
|
||||
#define F_PROFILO 120
|
||||
#define F_LIN 121
|
||||
#define F_LINDESC 122
|
||||
|
@ -1,153 +1,146 @@
|
||||
#include "ps0920300a.h"
|
||||
|
||||
PAGE "Pianificazione impianti" -1 -1 80 14
|
||||
|
||||
GROUPBOX -1 78 4
|
||||
BEGIN
|
||||
PROMPT 1 1 "@bArea da pianificare"
|
||||
FLAGS ""
|
||||
END
|
||||
|
||||
STRING F_DANUM 4
|
||||
BEGIN
|
||||
PROMPT 2 2 "Numerazione "
|
||||
HELP "Codice numerazione"
|
||||
USE %NUM
|
||||
INPUT CODTAB F_DANUM
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_DANUM CODTAB
|
||||
OUTPUT F_DANUMDESC S0
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "UPA"
|
||||
WARNING "Numerazione assente"
|
||||
END
|
||||
|
||||
STRING F_DANUMDESC 50
|
||||
BEGIN
|
||||
PROMPT 23 2 ""
|
||||
HELP "Descrizione numerazione"
|
||||
USE %NUM KEY 2
|
||||
INPUT S0 F_DANUMDESC
|
||||
DISPLAY "Descrizione@60" S0
|
||||
DISPLAY "Codice" CODTAB
|
||||
COPY OUTPUT F_DANUM
|
||||
END
|
||||
|
||||
STRING F_DAIMP 5
|
||||
BEGIN
|
||||
PROMPT 2 3 "Impianto "
|
||||
USE IMP
|
||||
INPUT CODTAB F_DAIMP
|
||||
DISPLAY "Codice@5" CODTAB
|
||||
DISPLAY "Descrizione@60" S0
|
||||
OUTPUT F_DAIMP CODTAB
|
||||
OUTPUT F_DAIMPDESC S0
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "UZ"
|
||||
WARNING "E l'impianto?"
|
||||
END
|
||||
|
||||
STRING F_DAIMPDESC 50
|
||||
BEGIN
|
||||
PROMPT 23 3 ""
|
||||
USE IMP KEY 2
|
||||
INPUT S0 F_DAIMPDESC
|
||||
DISPLAY "Descrizione@60" S0
|
||||
DISPLAY "Codice@5" CODTAB
|
||||
COPY OUTPUT F_DAIMP
|
||||
END
|
||||
|
||||
GROUPBOX -1 78 4
|
||||
BEGIN
|
||||
PROMPT 1 6 "@bArea pianificata"
|
||||
FLAGS ""
|
||||
END
|
||||
|
||||
STRING F_ANUM 4
|
||||
BEGIN
|
||||
PROMPT 2 7 "Numerazione "
|
||||
HELP "Codice numerazione"
|
||||
COPY USE F_DANUM
|
||||
INPUT CODTAB F_ANUM
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_ANUM CODTAB
|
||||
OUTPUT F_ANUMDESC S0
|
||||
CHECKTYPE REQUIRED
|
||||
FLAG "UPA"
|
||||
WARNING "Numerazione assente"
|
||||
END
|
||||
|
||||
STRING F_ANUMDESC 50
|
||||
BEGIN
|
||||
PROMPT 23 7 ""
|
||||
HELP "Descrizione numerazione"
|
||||
USE %NUM KEY 2
|
||||
INPUT S0 F_ANUMDESC
|
||||
DISPLAY "Descrizione@60" S0
|
||||
DISPLAY "Codice" CODTAB
|
||||
COPY OUTPUT F_ANUM
|
||||
END
|
||||
|
||||
STRING F_AIMP 5
|
||||
BEGIN
|
||||
PROMPT 2 8 "Impianto "
|
||||
COPY USE F_DAIMP
|
||||
INPUT CODTAB F_AIMP
|
||||
DISPLAY "Codice@5" CODTAB
|
||||
DISPLAY "Descrizione@60" S0
|
||||
OUTPUT F_AIMP CODTAB
|
||||
OUTPUT F_AIMPDESC S0
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "UZ"
|
||||
WARNING "E l'impianto?"
|
||||
END
|
||||
|
||||
STRING F_AIMPDESC 50
|
||||
BEGIN
|
||||
PROMPT 23 8 ""
|
||||
USE IMP KEY 2
|
||||
INPUT S0 F_AIMPDESC
|
||||
DISPLAY "Descrizione@60" S0
|
||||
DISPLAY "Codice@5" CODTAB
|
||||
COPY OUTPUT F_AIMP
|
||||
END
|
||||
|
||||
DATE F_DADATA
|
||||
BEGIN
|
||||
PROMPT 2 10 "Dalla data "
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
DATE F_ADATA
|
||||
BEGIN
|
||||
PROMPT 35 10 "Alla data "
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
NUMBER F_RITARDO 2
|
||||
BEGIN
|
||||
PROMPT 2 11 "Giorni di ritardo "
|
||||
FLAGS "U"
|
||||
END
|
||||
|
||||
STRING F_PROFILO 70 50
|
||||
BEGIN
|
||||
PROMPT 8 -3 "Profilo "
|
||||
PSELECT
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
#include "ps0920300a.h"
|
||||
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
#include <elabar.h>
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Pianificazione impianti" -1 -1 80 16
|
||||
|
||||
GROUPBOX -1 78 4
|
||||
BEGIN
|
||||
PROMPT 1 1 "@bArea pianificata"
|
||||
FLAGS ""
|
||||
END
|
||||
|
||||
STRING F_NUM 4
|
||||
BEGIN
|
||||
PROMPT 2 2 "Numerazione "
|
||||
HELP "Codice numerazione"
|
||||
USE %NUM
|
||||
INPUT CODTAB F_NUM
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT F_NUM CODTAB
|
||||
OUTPUT F_NUMDESC S0
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "UPA"
|
||||
WARNING "Numerazione assente"
|
||||
END
|
||||
|
||||
STRING F_NUMDESC 50
|
||||
BEGIN
|
||||
PROMPT 23 2 ""
|
||||
HELP "Descrizione numerazione"
|
||||
USE %NUM KEY 2
|
||||
INPUT S0 F_NUMDESC
|
||||
DISPLAY "Descrizione@60" S0
|
||||
DISPLAY "Codice" CODTAB
|
||||
COPY OUTPUT F_NUM
|
||||
END
|
||||
|
||||
STRING F_DAIMP 5
|
||||
BEGIN
|
||||
PROMPT 2 3 "Impianto "
|
||||
USE IMP
|
||||
INPUT CODTAB F_DAIMP
|
||||
DISPLAY "Codice@5" CODTAB
|
||||
DISPLAY "Descrizione@60" S0
|
||||
OUTPUT F_DAIMP CODTAB
|
||||
OUTPUT F_DAIMPDESC S0
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "UZ"
|
||||
WARNING "E l'impianto?"
|
||||
END
|
||||
|
||||
STRING F_DAIMPDESC 50
|
||||
BEGIN
|
||||
PROMPT 23 3 ""
|
||||
USE IMP KEY 2
|
||||
INPUT S0 F_DAIMPDESC
|
||||
DISPLAY "Descrizione@60" S0
|
||||
DISPLAY "Codice@5" CODTAB
|
||||
COPY OUTPUT F_DAIMP
|
||||
END
|
||||
|
||||
GROUPBOX -1 78 3
|
||||
BEGIN
|
||||
PROMPT 1 6 "@bArea da pianificare"
|
||||
FLAGS ""
|
||||
END
|
||||
|
||||
STRING F_AIMP 5
|
||||
BEGIN
|
||||
PROMPT 2 7 "Impianto "
|
||||
COPY USE F_DAIMP
|
||||
INPUT CODTAB F_AIMP
|
||||
DISPLAY "Codice@5" CODTAB
|
||||
DISPLAY "Descrizione@60" S0
|
||||
OUTPUT F_AIMP CODTAB
|
||||
OUTPUT F_AIMPDESC S0
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "UZ"
|
||||
WARNING "E l'impianto?"
|
||||
END
|
||||
|
||||
STRING F_AIMPDESC 50
|
||||
BEGIN
|
||||
PROMPT 23 7 ""
|
||||
USE IMP KEY 2
|
||||
INPUT S0 F_AIMPDESC
|
||||
DISPLAY "Descrizione@60" S0
|
||||
DISPLAY "Codice@5" CODTAB
|
||||
COPY OUTPUT F_AIMP
|
||||
END
|
||||
|
||||
STRING F_LIN 5
|
||||
BEGIN
|
||||
PROMPT 2 10 "Linea "
|
||||
USE LNP
|
||||
INPUT CODTAB F_LIN
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@60" S0
|
||||
OUTPUT F_LIN CODTAB
|
||||
OUTPUT F_LINDESC S0
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "UZ"
|
||||
WARNING "E la linea ? "
|
||||
END
|
||||
|
||||
STRING F_LINDESC 50
|
||||
BEGIN
|
||||
PROMPT 23 10 ""
|
||||
USE LNP KEY 2
|
||||
INPUT S0 F_LINDESC
|
||||
DISPLAY "Descrizione@60" S0
|
||||
DISPLAY "Codice" CODTAB
|
||||
OUTPUT F_LINDESC S0
|
||||
OUTPUT F_LIN CODTAB
|
||||
END
|
||||
|
||||
DATE F_DADATA
|
||||
BEGIN
|
||||
PROMPT 2 12 "Dalla data "
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
DATE F_ADATA
|
||||
BEGIN
|
||||
PROMPT 35 12 "Alla data "
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
NUMBER F_RITARDO 2
|
||||
BEGIN
|
||||
PROMPT 2 13 "GG.Ritardo "
|
||||
FLAGS "U"
|
||||
END
|
||||
|
||||
STRING F_PROFILO 70 50
|
||||
BEGIN
|
||||
PROMPT 8 -3 "Profilo "
|
||||
PSELECT
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
762
ps/ps0920400.cpp
762
ps/ps0920400.cpp
@ -1,381 +1,381 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <defmask.h>
|
||||
#include <relation.h>
|
||||
#include <cfven.h>
|
||||
#include <progind.h>
|
||||
#include <textset.h>
|
||||
#include <utility.h>
|
||||
#include "../db/dblib.h"
|
||||
#include "../ve/velib.h"
|
||||
#include <rdoc.h>
|
||||
|
||||
#include "ps0920.h"
|
||||
#include "ps0920400a.h"
|
||||
|
||||
class TShuttle : public TObject
|
||||
{
|
||||
TString _codnum;
|
||||
TString4 _provv;
|
||||
TString _impianto;
|
||||
int _anno;
|
||||
TString _codart;
|
||||
TString _codart_orig;
|
||||
long _ndoc;
|
||||
int _nriga;
|
||||
real _qta;
|
||||
|
||||
protected:
|
||||
virtual TObject* dup() const { return new TShuttle(*this); }
|
||||
void get_codart_orig(const TRectype & rec);
|
||||
const real qta_orig();
|
||||
|
||||
public:
|
||||
const TString & codnum() const { return _codnum; }
|
||||
const TString & provv() const { return _provv; }
|
||||
const int anno() const { return _anno; }
|
||||
const long ndoc() const { return _ndoc; }
|
||||
const int nriga() const { return _nriga; }
|
||||
const TString & codart() const { return _codart; }
|
||||
const TString & codart_orig() const { return _codart_orig; }
|
||||
const TString & impianto() const { return _impianto; }
|
||||
const real & qta() const { return _qta; }
|
||||
const real scarto();
|
||||
TShuttle(const TRectype & rec);
|
||||
TShuttle(const TShuttle & s);
|
||||
void add(const TRectype & rec);
|
||||
static const char * key(const TRectype & rec);
|
||||
const char * key(bool full = false) const;
|
||||
virtual ~TShuttle() {}
|
||||
};
|
||||
|
||||
const real TShuttle::scarto()
|
||||
{
|
||||
real scarto = qta_orig();
|
||||
TDistinta_tree d;
|
||||
TArray boom;
|
||||
|
||||
if (_codart != _codart_orig)
|
||||
{
|
||||
d.set_root(_codart_orig);
|
||||
if (d.explode(boom, false, RAGGR_EXP_NONE, 0, "A") > 0)
|
||||
{
|
||||
const int items = boom.items();
|
||||
bool found = false;
|
||||
|
||||
for (int i = 0; i < items; i++)
|
||||
{
|
||||
const TRiga_esplosione & re = (const TRiga_esplosione &) boom[i];
|
||||
|
||||
if (re.articolo() == _codart)
|
||||
{
|
||||
if (re.curr_qta() != UNO && re.curr_qta() != ZERO)
|
||||
{
|
||||
scarto *= re.curr_qta();
|
||||
scarto.round(3);
|
||||
found = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
scarto = qta();
|
||||
}
|
||||
}
|
||||
scarto -= qta();
|
||||
return scarto < ZERO ? ZERO : scarto ;
|
||||
}
|
||||
|
||||
const real TShuttle::qta_orig()
|
||||
{
|
||||
TToken_string key(_codnum);
|
||||
|
||||
key.add(_anno);
|
||||
key.add(_provv);
|
||||
key.add(_ndoc);
|
||||
key.add(_nriga);
|
||||
|
||||
const TRectype & r = cache().get(LF_RIGHEDOC, key);
|
||||
|
||||
real qta(r.get_real(RDOC_QTA));
|
||||
|
||||
return qta;
|
||||
}
|
||||
|
||||
void TShuttle::get_codart_orig(const TRectype & rec)
|
||||
{
|
||||
TToken_string key(rec.get("CODNUM"));
|
||||
|
||||
key.add(rec.get("ANNO"));
|
||||
key.add(rec.get("PROVV"));
|
||||
key.add(rec.get("NDOC"));
|
||||
key.add(rec.get("NRIGA"));
|
||||
|
||||
const TRectype & r = cache().get(LF_RIGHEDOC, key);
|
||||
|
||||
_codart_orig = r.get(RDOC_CODARTMAG);
|
||||
}
|
||||
|
||||
TShuttle::TShuttle(const TRectype & rec)
|
||||
{
|
||||
_codnum = rec.get("CODNUM");
|
||||
_provv = rec.get("PROVV");
|
||||
_anno = rec.get_int("ANNO");
|
||||
_ndoc = rec.get_long("NDOC");
|
||||
_nriga = rec.get_long("NRIGA");
|
||||
_codart = rec.get("CODART");
|
||||
_impianto = rec.get("IMPIANTO");
|
||||
_qta = rec.get_real("QTA");
|
||||
get_codart_orig(rec);
|
||||
}
|
||||
|
||||
TShuttle::TShuttle(const TShuttle & s)
|
||||
{
|
||||
_codnum = s._codnum;
|
||||
_provv = s._provv;
|
||||
_anno = s._anno;
|
||||
_ndoc = s._ndoc;
|
||||
_nriga = s._nriga;
|
||||
_codart = s._codart;
|
||||
_impianto = s._impianto;
|
||||
_qta = s._qta;
|
||||
_codart_orig = s._codart_orig;
|
||||
}
|
||||
|
||||
void TShuttle::add(const TRectype & rec)
|
||||
{
|
||||
_qta += rec.get_real("QTA");
|
||||
}
|
||||
|
||||
const char * TShuttle::key(const TRectype & rec)
|
||||
{
|
||||
TString & key = get_tmp_string(60);
|
||||
|
||||
key.format("%-4s", (const char *) rec.get("CODNUM"));
|
||||
|
||||
key << format("%04d", rec.get_int("ANNO"));
|
||||
key << format("%07ld", rec.get_long("NDOC"));
|
||||
key << format("%04d", rec.get_int("NRIGA"));
|
||||
key << rec.get("IMPIANTO");
|
||||
return (const char *) key;
|
||||
}
|
||||
|
||||
const char * TShuttle::key(bool full) const
|
||||
{
|
||||
TString & key = get_tmp_string(60);
|
||||
|
||||
key.format("%-4s%04d%07ld%04d", (const char *) _codnum, _anno, _ndoc, _nriga);
|
||||
if (full)
|
||||
key << _impianto;
|
||||
return (const char *) key;
|
||||
}
|
||||
|
||||
class TMaskPs09204 : public TAutomask
|
||||
{
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
TMaskPs09204();
|
||||
virtual ~TMaskPs09204();
|
||||
};
|
||||
|
||||
TMaskPs09204::TMaskPs09204()
|
||||
: TAutomask("ps0920400a")
|
||||
{
|
||||
}
|
||||
|
||||
TMaskPs09204::~TMaskPs09204()
|
||||
{
|
||||
}
|
||||
|
||||
bool TMaskPs09204::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
const int id = o.dlg();
|
||||
switch (id)
|
||||
{
|
||||
case F_CODCLI:
|
||||
if (e == fe_modify)
|
||||
{
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
class TRiepilogoProduzionePs0920 : public TSkeleton_application
|
||||
{
|
||||
TAssoc_array _riepilogo;
|
||||
TAssoc_array _impianti;
|
||||
TMaskPs09204 * _mask;
|
||||
virtual bool check_autorization() const {return false;}
|
||||
virtual const char * extra_modules() const {return "ve";}
|
||||
|
||||
|
||||
protected:
|
||||
virtual void main_loop();
|
||||
virtual bool create();
|
||||
|
||||
public:
|
||||
TAssoc_array & riepilogo() {return _riepilogo;}
|
||||
TAssoc_array & impianti() {return _impianti;}
|
||||
const TMaskPs09204 & mask() const {return *_mask;}
|
||||
virtual ~TRiepilogoProduzionePs0920();
|
||||
};
|
||||
|
||||
bool build_riep(const TRelation& rel, void* pJolly)
|
||||
{
|
||||
TRiepilogoProduzionePs0920 * app = (TRiepilogoProduzionePs0920 *) pJolly;
|
||||
TAssoc_array & r = app->riepilogo();
|
||||
const TString key = TShuttle::key(rel.curr());
|
||||
|
||||
TShuttle * s = (TShuttle *) r.objptr(key);
|
||||
|
||||
if (s == NULL)
|
||||
r.add(key, new TShuttle(rel.curr()));
|
||||
else
|
||||
s->add(rel.curr());
|
||||
|
||||
const TString8 impianto = rel.curr().get("IMPIANTO");
|
||||
|
||||
if (!app->impianti().is_key(impianto))
|
||||
app->impianti().add(impianto, impianto);
|
||||
return true;
|
||||
}
|
||||
|
||||
void TRiepilogoProduzionePs0920::main_loop()
|
||||
{
|
||||
while (_mask->run() == K_ENTER)
|
||||
{
|
||||
TCursor c(new TRelation(LF_RILPROD), "", 3);
|
||||
TRectype from(c.curr());
|
||||
|
||||
_riepilogo.destroy();
|
||||
_impianti.destroy();
|
||||
from.put("DATA",_mask->get(F_DADATA));
|
||||
|
||||
TRectype to(from);
|
||||
|
||||
to.put("DATA",_mask->get(F_ADATA));
|
||||
c.setregion(from, to);
|
||||
const long codcli = _mask->get_long(F_CODCLI);
|
||||
|
||||
if (codcli > 0L)
|
||||
{
|
||||
TString filter; filter.format("CODART[1,3]==\"%03ld\"", codcli);
|
||||
c.setfilter(filter);
|
||||
}
|
||||
c.scan(build_riep, this);
|
||||
|
||||
TString_array keysimp;
|
||||
TAS400_recordset out("AS400(2048)");
|
||||
|
||||
_impianti.get_keys(keysimp);
|
||||
keysimp.sort();
|
||||
|
||||
int items = keysimp.items();
|
||||
|
||||
out.create_field("OR", 0, 4);
|
||||
out.create_field("AN", 4, 4);
|
||||
out.create_field("NR", 8, 7);
|
||||
out.create_field("AR", 15, 20);
|
||||
int p = 35;
|
||||
for (int i = 0; i < items;i++)
|
||||
{
|
||||
out.create_field(format("Q%1d", i), p , 10);
|
||||
p += 10;
|
||||
out.create_field(format("S%1d", i), p , 10);
|
||||
p += 10;
|
||||
out.create_field(format("P%1d", i), p , 10);
|
||||
p += 10;
|
||||
}
|
||||
out.new_rec("");
|
||||
out.set("OR", "Ordine");
|
||||
out.set("AN", "Anno");
|
||||
out.set("NR", "Numero");
|
||||
out.set("AR", "Articolo");
|
||||
for (i = 0; i < items;i++)
|
||||
{
|
||||
out.set(format("Q%1d", i), cache().get("IMP", (TString &)keysimp[i], "S0"));
|
||||
out.set(format("S%1d", i), "");
|
||||
out.set(format("P%1d", i), "");
|
||||
}
|
||||
out.new_rec("");
|
||||
out.set("OR", "");
|
||||
out.set("AN", "");
|
||||
out.set("NR", "");
|
||||
out.set("AR", "");
|
||||
for (i = 0; i < items;i++)
|
||||
{
|
||||
out.set(format("Q%1d", i), "Quantità");
|
||||
out.set(format("S%1d", i), "Scarto");
|
||||
out.set(format("P%1d", i), "%");
|
||||
|
||||
}
|
||||
|
||||
TString_array keys;
|
||||
TString last_key;
|
||||
|
||||
_riepilogo.get_keys(keys);
|
||||
keys.sort();
|
||||
items = keys.items();
|
||||
|
||||
TProgind pi(items, "Esportazione");
|
||||
|
||||
for (i = 0; i < items; i++)
|
||||
{
|
||||
pi.addstatus(1L);
|
||||
TShuttle * s = (TShuttle *) _riepilogo.objptr((TString &)keys[i]);
|
||||
const TString key(s->key());
|
||||
|
||||
if (last_key != key)
|
||||
{
|
||||
last_key = key;
|
||||
out.new_rec("");
|
||||
out.set("OR", s->codnum());
|
||||
out.set("AN", long(s->anno()));
|
||||
out.set("NR", s->ndoc());
|
||||
out.set("AR", s->codart_orig());
|
||||
}
|
||||
|
||||
const int p = keysimp.find(s->impianto());
|
||||
|
||||
real scarto = s->scarto();
|
||||
|
||||
out.set(format("Q%1d", p), s->qta());
|
||||
out.set(format("S%1d", p), scarto);
|
||||
const real perc = scarto * CENTO / (s->qta() + scarto);
|
||||
out.set(format("P%1d", p), perc.stringa(6, 2));
|
||||
}
|
||||
|
||||
TFilename f(_mask->get(F_PATH));
|
||||
|
||||
if (!is_slash(f[f.len() - 1]))
|
||||
f << SLASH;
|
||||
f << _mask->get(F_NAME);
|
||||
f.ext("xls");
|
||||
out.save_as(f, fmt_html);
|
||||
}
|
||||
}
|
||||
|
||||
bool TRiepilogoProduzionePs0920::create()
|
||||
{
|
||||
_mask = new TMaskPs09204;
|
||||
return TSkeleton_application:: create();
|
||||
}
|
||||
|
||||
TRiepilogoProduzionePs0920::~TRiepilogoProduzionePs0920()
|
||||
{
|
||||
delete _mask;
|
||||
}
|
||||
|
||||
TRiepilogoProduzionePs0920 & app() { return (TRiepilogoProduzionePs0920&) main_app();}
|
||||
|
||||
int ps0920400(int argc, char* argv[])
|
||||
{
|
||||
TRiepilogoProduzionePs0920 a;
|
||||
|
||||
a.run(argc, argv, "Riepilogo Produzione DbService");
|
||||
return 0;
|
||||
}
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <defmask.h>
|
||||
#include <relation.h>
|
||||
#include <cfven.h>
|
||||
#include <progind.h>
|
||||
#include <textset.h>
|
||||
#include <utility.h>
|
||||
#include "../db/dblib.h"
|
||||
#include "../ve/velib.h"
|
||||
#include <rdoc.h>
|
||||
|
||||
#include "ps0920.h"
|
||||
#include "ps0920400a.h"
|
||||
|
||||
class TShuttle : public TObject
|
||||
{
|
||||
TString _codnum;
|
||||
TString4 _provv;
|
||||
TString _impianto;
|
||||
int _anno;
|
||||
TString _codart;
|
||||
TString _codart_orig;
|
||||
long _ndoc;
|
||||
int _nriga;
|
||||
real _qta;
|
||||
|
||||
protected:
|
||||
virtual TObject* dup() const { return new TShuttle(*this); }
|
||||
void get_codart_orig(const TRectype & rec);
|
||||
const real qta_orig();
|
||||
|
||||
public:
|
||||
const TString & codnum() const { return _codnum; }
|
||||
const TString & provv() const { return _provv; }
|
||||
const int anno() const { return _anno; }
|
||||
const long ndoc() const { return _ndoc; }
|
||||
const int nriga() const { return _nriga; }
|
||||
const TString & codart() const { return _codart; }
|
||||
const TString & codart_orig() const { return _codart_orig; }
|
||||
const TString & impianto() const { return _impianto; }
|
||||
const real & qta() const { return _qta; }
|
||||
const real scarto();
|
||||
TShuttle(const TRectype & rec);
|
||||
TShuttle(const TShuttle & s);
|
||||
void add(const TRectype & rec);
|
||||
static const char * key(const TRectype & rec);
|
||||
const char * key(bool full = false) const;
|
||||
virtual ~TShuttle() {}
|
||||
};
|
||||
|
||||
const real TShuttle::scarto()
|
||||
{
|
||||
real scarto = qta_orig();
|
||||
TDistinta_tree d;
|
||||
TArray boom;
|
||||
|
||||
if (_codart != _codart_orig)
|
||||
{
|
||||
d.set_root(_codart_orig);
|
||||
if (d.explode(boom, false, RAGGR_EXP_NONE, 0, "A") > 0)
|
||||
{
|
||||
const int items = boom.items();
|
||||
bool found = false;
|
||||
|
||||
for (int i = 0; i < items; i++)
|
||||
{
|
||||
const TRiga_esplosione & re = (const TRiga_esplosione &) boom[i];
|
||||
|
||||
if (re.articolo() == _codart)
|
||||
{
|
||||
if (re.curr_qta() != UNO && re.curr_qta() != ZERO)
|
||||
{
|
||||
scarto *= re.curr_qta();
|
||||
scarto.round(3);
|
||||
found = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
scarto = qta();
|
||||
}
|
||||
}
|
||||
scarto -= qta();
|
||||
return scarto < ZERO ? ZERO : scarto ;
|
||||
}
|
||||
|
||||
const real TShuttle::qta_orig()
|
||||
{
|
||||
TToken_string key(_codnum);
|
||||
|
||||
key.add(_anno);
|
||||
key.add(_provv);
|
||||
key.add(_ndoc);
|
||||
key.add(_nriga);
|
||||
|
||||
const TRectype & r = cache().get(LF_RIGHEDOC, key);
|
||||
|
||||
real qta(r.get_real(RDOC_QTA));
|
||||
|
||||
return qta;
|
||||
}
|
||||
|
||||
void TShuttle::get_codart_orig(const TRectype & rec)
|
||||
{
|
||||
TToken_string key(rec.get("CODNUM"));
|
||||
|
||||
key.add(rec.get("ANNO"));
|
||||
key.add(rec.get("PROVV"));
|
||||
key.add(rec.get("NDOC"));
|
||||
key.add(rec.get("NRIGA"));
|
||||
|
||||
const TRectype & r = cache().get(LF_RIGHEDOC, key);
|
||||
|
||||
_codart_orig = r.get(RDOC_CODARTMAG);
|
||||
}
|
||||
|
||||
TShuttle::TShuttle(const TRectype & rec)
|
||||
{
|
||||
_codnum = rec.get("CODNUM");
|
||||
_provv = rec.get("PROVV");
|
||||
_anno = rec.get_int("ANNO");
|
||||
_ndoc = rec.get_long("NDOC");
|
||||
_nriga = rec.get_long("NRIGA");
|
||||
_codart = rec.get("CODART");
|
||||
_impianto = rec.get("IMPIANTO");
|
||||
_qta = rec.get_real("QTA");
|
||||
get_codart_orig(rec);
|
||||
}
|
||||
|
||||
TShuttle::TShuttle(const TShuttle & s)
|
||||
{
|
||||
_codnum = s._codnum;
|
||||
_provv = s._provv;
|
||||
_anno = s._anno;
|
||||
_ndoc = s._ndoc;
|
||||
_nriga = s._nriga;
|
||||
_codart = s._codart;
|
||||
_impianto = s._impianto;
|
||||
_qta = s._qta;
|
||||
_codart_orig = s._codart_orig;
|
||||
}
|
||||
|
||||
void TShuttle::add(const TRectype & rec)
|
||||
{
|
||||
_qta += rec.get_real("QTA");
|
||||
}
|
||||
|
||||
const char * TShuttle::key(const TRectype & rec)
|
||||
{
|
||||
TString & key = get_tmp_string(60);
|
||||
|
||||
key.format("%-4s", (const char *) rec.get("CODNUM"));
|
||||
|
||||
key << format("%04d", rec.get_int("ANNO"));
|
||||
key << format("%07ld", rec.get_long("NDOC"));
|
||||
key << format("%04d", rec.get_int("NRIGA"));
|
||||
key << rec.get("IMPIANTO");
|
||||
return (const char *) key;
|
||||
}
|
||||
|
||||
const char * TShuttle::key(bool full) const
|
||||
{
|
||||
TString & key = get_tmp_string(60);
|
||||
|
||||
key.format("%-4s%04d%07ld%04d", (const char *) _codnum, _anno, _ndoc, _nriga);
|
||||
if (full)
|
||||
key << _impianto;
|
||||
return (const char *) key;
|
||||
}
|
||||
|
||||
class TMaskPs09204 : public TAutomask
|
||||
{
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
TMaskPs09204();
|
||||
virtual ~TMaskPs09204();
|
||||
};
|
||||
|
||||
TMaskPs09204::TMaskPs09204()
|
||||
: TAutomask("ps0920400a")
|
||||
{
|
||||
}
|
||||
|
||||
TMaskPs09204::~TMaskPs09204()
|
||||
{
|
||||
}
|
||||
|
||||
bool TMaskPs09204::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
const int id = o.dlg();
|
||||
switch (id)
|
||||
{
|
||||
case F_CODCLI:
|
||||
if (e == fe_modify)
|
||||
{
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
class TRiepilogoProduzionePs0920 : public TSkeleton_application
|
||||
{
|
||||
TAssoc_array _riepilogo;
|
||||
TAssoc_array _impianti;
|
||||
TMaskPs09204 * _mask;
|
||||
virtual bool check_autorization() const {return false;}
|
||||
virtual const char * extra_modules() const {return "ve";}
|
||||
|
||||
|
||||
protected:
|
||||
virtual void main_loop();
|
||||
virtual bool create();
|
||||
|
||||
public:
|
||||
TAssoc_array & riepilogo() {return _riepilogo;}
|
||||
TAssoc_array & impianti() {return _impianti;}
|
||||
const TMaskPs09204 & mask() const {return *_mask;}
|
||||
virtual ~TRiepilogoProduzionePs0920();
|
||||
};
|
||||
|
||||
bool build_riep(const TRelation& rel, void* pJolly)
|
||||
{
|
||||
TRiepilogoProduzionePs0920 * app = (TRiepilogoProduzionePs0920 *) pJolly;
|
||||
TAssoc_array & r = app->riepilogo();
|
||||
const TString key = TShuttle::key(rel.curr());
|
||||
|
||||
TShuttle * s = (TShuttle *) r.objptr(key);
|
||||
|
||||
if (s == NULL)
|
||||
r.add(key, new TShuttle(rel.curr()));
|
||||
else
|
||||
s->add(rel.curr());
|
||||
|
||||
const TString8 impianto = rel.curr().get("IMPIANTO");
|
||||
|
||||
if (!app->impianti().is_key(impianto))
|
||||
app->impianti().add(impianto, impianto);
|
||||
return true;
|
||||
}
|
||||
|
||||
void TRiepilogoProduzionePs0920::main_loop()
|
||||
{
|
||||
while (_mask->run() == K_ENTER)
|
||||
{
|
||||
TCursor c(new TRelation(LF_RILPROD), "", 3);
|
||||
TRectype from(c.curr());
|
||||
|
||||
_riepilogo.destroy();
|
||||
_impianti.destroy();
|
||||
from.put("DATA",_mask->get(F_DADATA));
|
||||
|
||||
TRectype to(from);
|
||||
|
||||
to.put("DATA",_mask->get(F_ADATA));
|
||||
c.setregion(from, to);
|
||||
const long codcli = _mask->get_long(F_CODCLI);
|
||||
|
||||
if (codcli > 0L)
|
||||
{
|
||||
TString filter; filter.format("CODART[1,3]==\"%03ld\"", codcli);
|
||||
c.setfilter(filter);
|
||||
}
|
||||
c.scan(build_riep, this);
|
||||
|
||||
TString_array keysimp;
|
||||
TAS400_recordset out("AS400(2048)");
|
||||
|
||||
_impianti.get_keys(keysimp);
|
||||
keysimp.sort();
|
||||
|
||||
int items = keysimp.items();
|
||||
|
||||
out.create_field("OR", 0, 4);
|
||||
out.create_field("AN", 4, 4);
|
||||
out.create_field("NR", 8, 7);
|
||||
out.create_field("AR", 15, 20);
|
||||
int p = 35;
|
||||
for (int i = 0; i < items;i++)
|
||||
{
|
||||
out.create_field(format("Q%1d", i), p , 10);
|
||||
p += 10;
|
||||
out.create_field(format("S%1d", i), p , 10);
|
||||
p += 10;
|
||||
out.create_field(format("P%1d", i), p , 10);
|
||||
p += 10;
|
||||
}
|
||||
out.new_rec("");
|
||||
out.set("OR", "Ordine");
|
||||
out.set("AN", "Anno");
|
||||
out.set("NR", "Numero");
|
||||
out.set("AR", "Articolo");
|
||||
for (int i = 0; i < items;i++)
|
||||
{
|
||||
out.set(format("Q%1d", i), cache().get("IMP", (TString &)keysimp[i], "S0"));
|
||||
out.set(format("S%1d", i), "");
|
||||
out.set(format("P%1d", i), "");
|
||||
}
|
||||
out.new_rec("");
|
||||
out.set("OR", "");
|
||||
out.set("AN", "");
|
||||
out.set("NR", "");
|
||||
out.set("AR", "");
|
||||
for (int i = 0; i < items;i++)
|
||||
{
|
||||
out.set(format("Q%1d", i), "Quantità");
|
||||
out.set(format("S%1d", i), "Scarto");
|
||||
out.set(format("P%1d", i), "%");
|
||||
|
||||
}
|
||||
|
||||
TString_array keys;
|
||||
TString last_key;
|
||||
|
||||
_riepilogo.get_keys(keys);
|
||||
keys.sort();
|
||||
items = keys.items();
|
||||
|
||||
TProgind pi(items, "Esportazione");
|
||||
|
||||
for (int i = 0; i < items; i++)
|
||||
{
|
||||
pi.addstatus(1L);
|
||||
TShuttle * s = (TShuttle *) _riepilogo.objptr((TString &)keys[i]);
|
||||
const TString key(s->key());
|
||||
|
||||
if (last_key != key)
|
||||
{
|
||||
last_key = key;
|
||||
out.new_rec("");
|
||||
out.set("OR", s->codnum());
|
||||
out.set("AN", long(s->anno()));
|
||||
out.set("NR", s->ndoc());
|
||||
out.set("AR", s->codart_orig());
|
||||
}
|
||||
|
||||
const int p = keysimp.find(s->impianto());
|
||||
|
||||
real scarto = s->scarto();
|
||||
|
||||
out.set(format("Q%1d", p), s->qta());
|
||||
out.set(format("S%1d", p), scarto);
|
||||
const real perc = scarto * CENTO / (s->qta() + scarto);
|
||||
out.set(format("P%1d", p), perc.stringa(6, 2));
|
||||
}
|
||||
|
||||
TFilename f(_mask->get(F_PATH));
|
||||
|
||||
if (!is_slash(f[f.len() - 1]))
|
||||
f << SLASH;
|
||||
f << _mask->get(F_NAME);
|
||||
f.ext("xls");
|
||||
out.save_as(f, fmt_html);
|
||||
}
|
||||
}
|
||||
|
||||
bool TRiepilogoProduzionePs0920::create()
|
||||
{
|
||||
_mask = new TMaskPs09204;
|
||||
return TSkeleton_application:: create();
|
||||
}
|
||||
|
||||
TRiepilogoProduzionePs0920::~TRiepilogoProduzionePs0920()
|
||||
{
|
||||
delete _mask;
|
||||
}
|
||||
|
||||
TRiepilogoProduzionePs0920 & app() { return (TRiepilogoProduzionePs0920&) main_app();}
|
||||
|
||||
int ps0920400(int argc, char* argv[])
|
||||
{
|
||||
TRiepilogoProduzionePs0920 a;
|
||||
|
||||
a.run(argc, argv, "Riepilogo Produzione DbService");
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
#define F_PROFILO 30
|
||||
#define F_DADATA 101
|
||||
#define F_ADATA 102
|
||||
#define F_CODCLI 103
|
||||
#define F_RAGSOC 104
|
||||
#define F_PATH 105
|
||||
#define F_NAME 106
|
||||
|
||||
#define F_PROFILO 30
|
||||
#define F_DADATA 101
|
||||
#define F_ADATA 102
|
||||
#define F_CODCLI 103
|
||||
#define F_RAGSOC 104
|
||||
#define F_PATH 105
|
||||
#define F_NAME 106
|
||||
|
@ -1,83 +1,76 @@
|
||||
#include "ps0920400a.h"
|
||||
|
||||
PAGE "Selezione Produzione" -1 -1 80 14
|
||||
|
||||
|
||||
DATE F_DADATA
|
||||
BEGIN
|
||||
PROMPT 2 2 "Dal "
|
||||
FIELD S_DADATA
|
||||
END
|
||||
|
||||
DATE F_ADATA
|
||||
BEGIN
|
||||
PROMPT 2 4 "Al "
|
||||
FIELD S_ADATA
|
||||
END
|
||||
|
||||
STRING F_CODCLI 3
|
||||
BEGIN
|
||||
PROMPT 2 6 "Cliente "
|
||||
WARNING "Cliente assente"
|
||||
FLAGS "R"
|
||||
FIELD CODCLI
|
||||
USE LF_CLIFO
|
||||
INPUT TIPOCF "C"
|
||||
INPUT CODCF F_CODCLI
|
||||
DISPLAY "Codice" CODCF
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
OUTPUT F_CODCLI CODCF
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
WARNING "Cliente assente"
|
||||
PROMPT 26 6 ""
|
||||
USE LF_CLIFO KEY 2
|
||||
INPUT TIPOCF "C"
|
||||
INPUT RAGSOC F_RAGSOC
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
DISPLAY "Partita IVA@12" PAIV
|
||||
DISPLAY "Codice" CODCF
|
||||
OUTPUT F_CODCLI CODCF
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE SEARCH
|
||||
END
|
||||
|
||||
STRING F_PATH 255 50
|
||||
BEGIN
|
||||
PROMPT 2 8 "Cartella "
|
||||
DSELECT
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "M"
|
||||
END
|
||||
|
||||
STRING F_NAME 50
|
||||
BEGIN
|
||||
PROMPT 2 10 "File "
|
||||
FSELECT ""
|
||||
FLAGS "B"
|
||||
END
|
||||
|
||||
STRING F_PROFILO 70 50
|
||||
BEGIN
|
||||
PROMPT 8 -3 "Profilo "
|
||||
PSELECT
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
#include "ps0920400a.h"
|
||||
|
||||
PAGE "Selezione Produzione" -1 -1 80 14
|
||||
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
#include <elabar.h>
|
||||
ENDPAGE
|
||||
|
||||
DATE F_DADATA
|
||||
BEGIN
|
||||
PROMPT 2 2 "Dal "
|
||||
FIELD S_DADATA
|
||||
END
|
||||
|
||||
DATE F_ADATA
|
||||
BEGIN
|
||||
PROMPT 2 4 "Al "
|
||||
FIELD S_ADATA
|
||||
END
|
||||
|
||||
STRING F_CODCLI 3
|
||||
BEGIN
|
||||
PROMPT 2 6 "Cliente "
|
||||
WARNING "Cliente assente"
|
||||
FLAGS "R"
|
||||
FIELD CODCLI
|
||||
USE LF_CLIFO
|
||||
INPUT TIPOCF "C"
|
||||
INPUT CODCF F_CODCLI
|
||||
DISPLAY "Codice" CODCF
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
OUTPUT F_CODCLI CODCF
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
WARNING "Cliente assente"
|
||||
PROMPT 26 6 ""
|
||||
USE LF_CLIFO KEY 2
|
||||
INPUT TIPOCF "C"
|
||||
INPUT RAGSOC F_RAGSOC
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
DISPLAY "Partita IVA@12" PAIV
|
||||
DISPLAY "Codice" CODCF
|
||||
OUTPUT F_CODCLI CODCF
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE SEARCH
|
||||
END
|
||||
|
||||
STRING F_PATH 255 50
|
||||
BEGIN
|
||||
PROMPT 2 8 "Cartella "
|
||||
DSELECT
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "M"
|
||||
END
|
||||
|
||||
STRING F_NAME 50
|
||||
BEGIN
|
||||
PROMPT 2 10 "File "
|
||||
FSELECT ""
|
||||
FLAGS "B"
|
||||
END
|
||||
|
||||
STRING F_PROFILO 70 50
|
||||
BEGIN
|
||||
PROMPT 8 -3 "Profilo "
|
||||
PSELECT
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
Loading…
x
Reference in New Issue
Block a user