Modulo movimenti
git-svn-id: svn://10.65.10.50/trunk@4170 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
c339104e50
commit
831763f4fb
22
mg/mg1.cpp
Executable file
22
mg/mg1.cpp
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#include <xvt.h>
|
||||||
|
#include <strings.h>
|
||||||
|
|
||||||
|
#include "mg1.h"
|
||||||
|
|
||||||
|
#define usage "Error - usage : %s -{0|1|2|3|4|5|6|7|8|9}"
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
int rt = -1;
|
||||||
|
const int r = (argc > 1) ? atoi(&argv[1][1]) : -1;
|
||||||
|
|
||||||
|
switch (r)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
rt = mg1100(argc,argv) ; break; // gestione manuale movimenti
|
||||||
|
default:
|
||||||
|
error_box(usage, argv[0]) ; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rt ;
|
||||||
|
}
|
6
mg/mg1.h
Executable file
6
mg/mg1.h
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef __MG1_H
|
||||||
|
#define __MG1_H
|
||||||
|
|
||||||
|
int mg1100(int argc, char* argv[]);
|
||||||
|
|
||||||
|
#endif // __MG1_H
|
510
mg/mg1100.cpp
Executable file
510
mg/mg1100.cpp
Executable file
@ -0,0 +1,510 @@
|
|||||||
|
#include <relapp.h>
|
||||||
|
#include <utility.h>
|
||||||
|
#include <tabutil.h>
|
||||||
|
#include <msksheet.h>
|
||||||
|
#include <recarray.h>
|
||||||
|
#include <assoc.h>
|
||||||
|
#include <checks.h>
|
||||||
|
#include <defmask.h>
|
||||||
|
#include <varrec.h>
|
||||||
|
#include "..\mg\mglib01.h"
|
||||||
|
#include "mg1100.h"
|
||||||
|
|
||||||
|
//**************************************
|
||||||
|
// classe per il controllo dei record composti da una testata e N righe
|
||||||
|
// è implementato come un TRectype che contiene anche un TRecord_array
|
||||||
|
//
|
||||||
|
class THead_body_record : public TAuto_variable_rectype {
|
||||||
|
|
||||||
|
TRecord_array _rows; // Array di TRectype per le righe
|
||||||
|
bool _nuovo;
|
||||||
|
int _file; // file principale (
|
||||||
|
int _rowsfilenum; // file delle righe
|
||||||
|
|
||||||
|
protected:
|
||||||
|
long get_next_key(char provv, int anno, const char* codnum) const;
|
||||||
|
virtual TRectype & row(int index); // riga del corpo
|
||||||
|
virtual void put_str(const char* fieldname, const char* val);
|
||||||
|
long renum(long numdoc = 0);
|
||||||
|
// @ cmember funzione per estrarre dal record della testata la chiave delle righe
|
||||||
|
virtual void copy_linekey(const TRectype headrecord, TRectype linesrecord)=0;
|
||||||
|
|
||||||
|
public:
|
||||||
|
//***********************
|
||||||
|
// struttura
|
||||||
|
const TAuto_variable_rectype& head() const { return *this; } // Ritorna la testata del documento
|
||||||
|
TAuto_variable_rectype& head() { return *this; } // Ritorna la testata del documento
|
||||||
|
|
||||||
|
int rows() const { return _rows.rows(); }
|
||||||
|
|
||||||
|
const TRectype& operator[](int index) const
|
||||||
|
{ return (const TRectype&)((THead_body_record *)this)->row(index); }
|
||||||
|
TRectype& operator[](int index)
|
||||||
|
{ return (TRectype&)row(index); }
|
||||||
|
|
||||||
|
TRectype & insert_row(int row, const char *tipo = NULL);
|
||||||
|
TRectype & new_row(const char *tipo = NULL);
|
||||||
|
bool destroy_row(int n, bool pack = FALSE) { return _rows.destroy_row(n, pack); }
|
||||||
|
void destroy_rows() { _rows.destroy_rows(); }
|
||||||
|
|
||||||
|
//***********************
|
||||||
|
// record e I/O
|
||||||
|
void dirty_fields();
|
||||||
|
|
||||||
|
virtual TRectype & operator =(const TRectype & r);
|
||||||
|
virtual TRectype & operator =(const char * r);
|
||||||
|
virtual void zero(const char * fieldname);
|
||||||
|
virtual void zero(char c = '\0');
|
||||||
|
|
||||||
|
void reset_fields(TAuto_variable_rectype & rec) { rec.remove_field(); }
|
||||||
|
void set_fields(TAuto_variable_rectype & rec);
|
||||||
|
|
||||||
|
int read(const TRectype& rec);
|
||||||
|
|
||||||
|
int write(bool re = FALSE) const;
|
||||||
|
int rewrite() const { return write(TRUE); }
|
||||||
|
int remove() const;
|
||||||
|
|
||||||
|
//**************************
|
||||||
|
THead_body_record(int hfn, int rfn,const char *numfield);
|
||||||
|
THead_body_record(const TBaseisamfile* i,int rfn,const char *numfield);
|
||||||
|
THead_body_record(const TRectype & r,int rfn,const char *numfield);
|
||||||
|
THead_body_record(const TVariable_rectype & r,int rfn,const char *numfield);
|
||||||
|
virtual ~THead_body_record();
|
||||||
|
};
|
||||||
|
|
||||||
|
THead_body_record::THead_body_record(int hfn, int rfn,const char *numfield):
|
||||||
|
_rows(rfn,numfield), // inizializza il record array delle righe
|
||||||
|
TAuto_variable_rectype(hfn)
|
||||||
|
{
|
||||||
|
_file=hfn; // file principale
|
||||||
|
_rowsfilenum=rfn; // file delle righe
|
||||||
|
}
|
||||||
|
|
||||||
|
THead_body_record::THead_body_record(const TBaseisamfile* i,int rfn,const char *numfield):
|
||||||
|
TAuto_variable_rectype(i)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
THead_body_record::THead_body_record(const TRectype & r,int rfn,const char *numfield):
|
||||||
|
TAuto_variable_rectype(r)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
THead_body_record::THead_body_record(const THead_body_record& r):
|
||||||
|
TAuto_variable_rectype(r)
|
||||||
|
{
|
||||||
|
// copia..
|
||||||
|
}
|
||||||
|
|
||||||
|
int THead_body_record::read(const TRectype& rec)
|
||||||
|
{
|
||||||
|
head() = rec;
|
||||||
|
TRectype line_key(_rows.key());
|
||||||
|
|
||||||
|
copy_linekey(head(),line_key);
|
||||||
|
|
||||||
|
TLocalisamfile afile(_file);
|
||||||
|
int err = TRectype::read(afile);
|
||||||
|
if (err == NOERR)
|
||||||
|
{
|
||||||
|
_nuovo = FALSE;
|
||||||
|
_rows.read(line_key); //ok
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// nuovo oggetto: resetta tutto
|
||||||
|
_nuovo = TRUE;
|
||||||
|
head() = rec;
|
||||||
|
destroy_rows();
|
||||||
|
_rows.set_key(&line_key); // ok
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
int THead_body_record::write(bool re) const
|
||||||
|
{
|
||||||
|
const bool nuovo = _nuovo; // E' nuovo di zecca!
|
||||||
|
if (nuovo && re) // quindi ...
|
||||||
|
re = FALSE; // ... non fare la rewrite
|
||||||
|
|
||||||
|
TLocalisamfile afile(_file);
|
||||||
|
int err = NOERR;
|
||||||
|
if (re)
|
||||||
|
{
|
||||||
|
err = _rows.write(re);
|
||||||
|
if (err == NOERR)
|
||||||
|
{
|
||||||
|
err = TRectype::rewrite(afile);
|
||||||
|
if (err != NOERR)
|
||||||
|
err = TRectype::write(afile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (nuovo)
|
||||||
|
{
|
||||||
|
THead_body_record& myself = *(THead_body_record*)this;
|
||||||
|
//if (numero() <= 0)
|
||||||
|
// myself.renum();
|
||||||
|
do
|
||||||
|
{
|
||||||
|
err = TRectype::write(afile);
|
||||||
|
if (err == _isreinsert)
|
||||||
|
myself.renum();
|
||||||
|
} while (err == _isreinsert);
|
||||||
|
myself._nuovo = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
err = TRectype::write(afile);
|
||||||
|
if (err != NOERR)
|
||||||
|
err = TRectype::rewrite(afile);
|
||||||
|
}
|
||||||
|
if (err == NOERR)
|
||||||
|
err = _rows.write(re);
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int THead_body_record::remove() const
|
||||||
|
{
|
||||||
|
TLocalisamfile afile(_file);
|
||||||
|
int err = _rows.remove();
|
||||||
|
if (err == NOERR)
|
||||||
|
err = TRectype::remove(afile);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class TMov_mag : public THead_body_record {
|
||||||
|
TString16 _nextcod;
|
||||||
|
|
||||||
|
public:
|
||||||
|
// IO ad alto livello
|
||||||
|
const char *get_next_key() ;
|
||||||
|
int read(int numreg);
|
||||||
|
int remove();
|
||||||
|
// gestione saldi
|
||||||
|
int save_line_minus();
|
||||||
|
int save_line_plus();
|
||||||
|
int update_balances();
|
||||||
|
// costruttori e distruttori
|
||||||
|
TMov_mag();
|
||||||
|
virtual ~TMov_mag() {};
|
||||||
|
};
|
||||||
|
|
||||||
|
TMov_mag::TMov_mag() :
|
||||||
|
TRelation(LF_MOVMAG)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
TMov_mag::remove()
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
// controlla le righe da togliere
|
||||||
|
if ((res=((TSheet_field &)_msk->field(F_RIGHE)).record()->remove())==NOERR ) {
|
||||||
|
// effettua la variazione dei saldi
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *TMov_mag::get_next_key()
|
||||||
|
{
|
||||||
|
TLocalisamfile f(LF_MOVMAG);
|
||||||
|
f.last();
|
||||||
|
int a=atoi(f.get("NUMREG"))+1;
|
||||||
|
return _nextcod.format("%d|%d",F_NUMREG,a);
|
||||||
|
}
|
||||||
|
|
||||||
|
//*******
|
||||||
|
// gestione delle variazione dei saldi
|
||||||
|
//
|
||||||
|
//
|
||||||
|
int TMov_mag::save_line_plus()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TMov_mag::save_line_minus()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TMov_mag::update_balances()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//*****
|
||||||
|
//*****
|
||||||
|
// maschera dei movimenti di magazzino
|
||||||
|
class TMask_movmag: public TMask {
|
||||||
|
TMov_mag * mov_mag;
|
||||||
|
TMag_livelli * livelli_giac; // oggetto gestione livelli di giacenza
|
||||||
|
static bool handle_sheetrighe(TMask_field &fld, KEY k); // handler delle righe
|
||||||
|
static bool handle_codcaus(TMask_field &fld, KEY k); // handler delle righe
|
||||||
|
static bool handle_numreg(TMask_field &, KEY); // handler del campo anno delle giacenze
|
||||||
|
public:
|
||||||
|
TMask_movmag(TMag_livelli *l_m,TMov_mag * m_m);
|
||||||
|
virtual ~TMask_movmag();
|
||||||
|
static void sheetrighe_put(TSheet_field &fld_righe, int item);
|
||||||
|
static void sheetrighe_get(TSheet_field &fld_righe, int item);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// costruttore della maschera anagrafica di magazzino
|
||||||
|
//TMask_movmag::TMask_movmag() :
|
||||||
|
TMask_movmag::TMask_movmag(TMag_livelli *l_m,TMov_mag * m_m) : TMask("mg1100")
|
||||||
|
{
|
||||||
|
|
||||||
|
// oggetti dell'applciazione
|
||||||
|
livelli_giac= l_m;
|
||||||
|
mov_mag = m_m;
|
||||||
|
|
||||||
|
set_handler(F_NUMREG, handle_numreg);
|
||||||
|
set_handler(F_CODCAUS, handle_codcaus);
|
||||||
|
set_handler(F_RIGHE, handle_sheetrighe);
|
||||||
|
((TSheet_field &)field(F_RIGHE)).set_userget(sheetrighe_get);
|
||||||
|
((TSheet_field &)field(F_RIGHE)).set_userput(sheetrighe_put);
|
||||||
|
|
||||||
|
// setta i campi della maschera
|
||||||
|
// per la pagina giacenze
|
||||||
|
TSheet_field &fld_righe= (TSheet_field &)field(F_RIGHE);
|
||||||
|
// disabilita le colonne quando non sono utilizzati i livelli di giacenza
|
||||||
|
if (livelli_giac->enabled(1)) {
|
||||||
|
fld_righe.sheet_mask().field(F_LIV1).show();
|
||||||
|
fld_righe.set_column_header(fld_righe.cid2index(F_LIV1),livelli_giac->name(1));
|
||||||
|
fld_righe.sheet_mask().field(F_LIV1).set_prompt(livelli_giac->name(1));
|
||||||
|
} else {
|
||||||
|
fld_righe.sheet_mask().field(F_LIV1).hide();
|
||||||
|
fld_righe.delete_column(fld_righe.cid2index(F_LIV1));
|
||||||
|
}
|
||||||
|
if (livelli_giac->enabled(2)) {
|
||||||
|
fld_righe.sheet_mask().field(F_LIV2).show();
|
||||||
|
fld_righe.set_column_header(fld_righe.cid2index(F_LIV2),livelli_giac->name(2));
|
||||||
|
fld_righe.sheet_mask().field(F_LIV2).set_prompt(livelli_giac->name(2));
|
||||||
|
} else {
|
||||||
|
fld_righe.sheet_mask().field(F_LIV2).hide();
|
||||||
|
fld_righe.delete_column(fld_righe.cid2index(F_LIV2));
|
||||||
|
}
|
||||||
|
if (livelli_giac->enabled(3)) {
|
||||||
|
fld_righe.sheet_mask().field(F_LIV3).show();
|
||||||
|
fld_righe.set_column_header(fld_righe.cid2index(F_LIV3),livelli_giac->name(3));
|
||||||
|
fld_righe.sheet_mask().field(F_LIV3).set_prompt(livelli_giac->name(3));
|
||||||
|
} else {
|
||||||
|
fld_righe.sheet_mask().field(F_LIV3).hide();
|
||||||
|
fld_righe.delete_column(fld_righe.cid2index(F_LIV3));
|
||||||
|
}
|
||||||
|
if (livelli_giac->enabled(4)) {
|
||||||
|
fld_righe.sheet_mask().field(F_LIV4).show();
|
||||||
|
fld_righe.set_column_header(fld_righe.cid2index(F_LIV4),livelli_giac->name(4));
|
||||||
|
fld_righe.sheet_mask().field(F_LIV4).set_prompt(livelli_giac->name(4));
|
||||||
|
} else {
|
||||||
|
fld_righe.sheet_mask().field(F_LIV4).hide();
|
||||||
|
fld_righe.delete_column(fld_righe.cid2index(F_LIV4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TMask_movmag::~TMask_movmag()
|
||||||
|
{
|
||||||
|
delete livelli_giac;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// item varies from 1 to items()
|
||||||
|
void TMask_movmag::sheetrighe_get(TSheet_field &fld_righe, int item)
|
||||||
|
{
|
||||||
|
TMask_movmag &m=(TMask_movmag &)fld_righe.mask();
|
||||||
|
// prende il record della riga corrente dal record array
|
||||||
|
TRectype &rec= fld_righe.record()->row(item, TRUE);
|
||||||
|
TToken_string &row= fld_righe.row(item-1);
|
||||||
|
// codici di livello
|
||||||
|
row.add( m.livelli_giac->unpack_grpcode(rec.get("LIVGIAC") ,1),fld_righe.cid2index(F_LIV1) );
|
||||||
|
row.add( m.livelli_giac->unpack_grpcode(rec.get("LIVGIAC") ,2),fld_righe.cid2index(F_LIV2) );
|
||||||
|
row.add( m.livelli_giac->unpack_grpcode(rec.get("LIVGIAC") ,3),fld_righe.cid2index(F_LIV3) );
|
||||||
|
row.add( m.livelli_giac->unpack_grpcode(rec.get("LIVGIAC") ,4),fld_righe.cid2index(F_LIV4) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// item varies from 1 to items()
|
||||||
|
void TMask_movmag::sheetrighe_put(TSheet_field &fld_righe, int item)
|
||||||
|
{
|
||||||
|
TMask_movmag &m=(TMask_movmag &)fld_righe.mask();
|
||||||
|
TToken_string &row= fld_righe.row(item-1);
|
||||||
|
|
||||||
|
TRectype &recrighe= fld_righe.record()->row(item, TRUE);
|
||||||
|
// codici livello
|
||||||
|
if (m.livelli_giac->enabled()) {
|
||||||
|
TString16 packedcode;
|
||||||
|
m.livelli_giac->pack_grpcode(packedcode,row.get(fld_righe.cid2index(F_LIV1)),1);
|
||||||
|
m.livelli_giac->pack_grpcode(packedcode,row.get(fld_righe.cid2index(F_LIV2)),2);
|
||||||
|
m.livelli_giac->pack_grpcode(packedcode,row.get(fld_righe.cid2index(F_LIV3)),3);
|
||||||
|
m.livelli_giac->pack_grpcode(packedcode,row.get(fld_righe.cid2index(F_LIV4)),4);
|
||||||
|
recrighe.put("LIVGIAC", packedcode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool TMask_movmag::handle_sheetrighe(TMask_field &fld, KEY k)
|
||||||
|
{
|
||||||
|
TSheet_field &f= (TSheet_field &)fld; // typecast del campo al suo sheet corrispondente
|
||||||
|
TMask_movmag &m= (TMask_movmag &)fld.mask();
|
||||||
|
int line;
|
||||||
|
if (k==K_SPACE)
|
||||||
|
{
|
||||||
|
// entrata nella modifica
|
||||||
|
m.mov_mag->save_line_minus(line);
|
||||||
|
}
|
||||||
|
if (k==K_TAB && fld.focusdirty())
|
||||||
|
{
|
||||||
|
// uscita dalla modifica
|
||||||
|
m.mov_mag->save_line_plus(line);
|
||||||
|
}
|
||||||
|
if (k==K_ENTER)
|
||||||
|
{
|
||||||
|
m.mov_mag->update_balances();
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TMask_movmag::handle_codcaus(TMask_field &fld, KEY k)
|
||||||
|
{
|
||||||
|
if (k==K_TAB)
|
||||||
|
{
|
||||||
|
TMask_movmag &m= (TMask_movmag &)fld.mask();
|
||||||
|
m.mov_mag->save_line_minus();
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TMask_movmag::handle_numreg(TMask_field &fld, KEY k)
|
||||||
|
{
|
||||||
|
if (k==K_ENTER)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// handle
|
||||||
|
bool TMask_movmag::handle_rmov_um(TMask_field &fld, KEY k)
|
||||||
|
{
|
||||||
|
if (k==K_ENTER)
|
||||||
|
{
|
||||||
|
TTable cau("CAU");
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class TApp_movmag: public TRelation_application {
|
||||||
|
TMask_movmag *_msk; // maschera principale
|
||||||
|
TMov_mag * _mov_mag; // relazione principale di un solo file (movimenti di magazzino)
|
||||||
|
TMag_livelli * _livelli_giac;// oggetto handler per i livelli di le giacenze
|
||||||
|
int _lastnumreg;
|
||||||
|
virtual bool user_create();
|
||||||
|
virtual bool user_destroy();
|
||||||
|
virtual TMask *get_mask(int) { return _msk; }
|
||||||
|
virtual bool changing_mask(int) { return FALSE; }
|
||||||
|
virtual TRelation *get_relation() const { return _mov_mag; }
|
||||||
|
virtual void init_insert_mode(TMask &);
|
||||||
|
virtual const char *get_next_key() ;
|
||||||
|
virtual int read(TMask& m);
|
||||||
|
virtual bool remove();
|
||||||
|
virtual int write(const TMask& m);
|
||||||
|
virtual int rewrite(const TMask& m);
|
||||||
|
|
||||||
|
public:
|
||||||
|
TApp_movmag() {};
|
||||||
|
virtual ~TApp_movmag() {};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline TApp_movmag& app() { return (TApp_movmag&) main_app(); }
|
||||||
|
|
||||||
|
bool TApp_movmag::user_create()
|
||||||
|
{
|
||||||
|
// apre la maschera e dispone gli sheet
|
||||||
|
_livelli_giac= new TMag_livelli("FCG");
|
||||||
|
_mov_mag= new TMov_mag;
|
||||||
|
_msk= new TMask_movmag(_livelli_giac,_mov_mag);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TApp_movmag::user_destroy()
|
||||||
|
{
|
||||||
|
delete _msk;
|
||||||
|
delete _mov_mag;
|
||||||
|
delete _livelli_giac;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// autonumerazione
|
||||||
|
const char *TApp_movmag::get_next_key()
|
||||||
|
{
|
||||||
|
return _mov_mag->get_next_key();
|
||||||
|
}
|
||||||
|
|
||||||
|
// rimozione
|
||||||
|
bool TApp_movmag::remove()
|
||||||
|
{
|
||||||
|
int res;
|
||||||
|
_mov_mag->remove();
|
||||||
|
return (res && TRelation_application::remove());
|
||||||
|
}
|
||||||
|
|
||||||
|
int TApp_movmag::read(TMask& m)
|
||||||
|
{
|
||||||
|
int err=TRelation_application::read(m);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TApp_movmag::write(const TMask& m)
|
||||||
|
{
|
||||||
|
int err= TRelation_application::write(m);
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TApp_movmag::rewrite(const TMask& m)
|
||||||
|
{
|
||||||
|
|
||||||
|
int err= TRelation_application::rewrite(m);
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TApp_movmag::init_insert_mode(TMask &m)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int mg1100(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
TApp_movmag a;
|
||||||
|
|
||||||
|
a.run(argc, argv, "Movimenti di magazzino");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
26
mg/mg1100.h
Executable file
26
mg/mg1100.h
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#define F_NUMREG 101
|
||||||
|
#define F_DATAREG 102
|
||||||
|
#define F_ANNOES 103
|
||||||
|
#define F_DATACOMP 104
|
||||||
|
#define F_DESCR 105
|
||||||
|
#define F_RIFADOC 106
|
||||||
|
#define F_NUMDOC 107
|
||||||
|
#define F_ANNODOC 108
|
||||||
|
#define F_CODCAUS 109
|
||||||
|
#define F_DESCAU 110
|
||||||
|
#define F_TIPOCF 111
|
||||||
|
#define F_CODCLI 112
|
||||||
|
#define F_CODFOR 113
|
||||||
|
#define F_RAGSOC 114
|
||||||
|
#define F_CATVEN 115
|
||||||
|
#define F_CODLIST 116
|
||||||
|
#define F_CODCONTR 117
|
||||||
|
#define F_CODOFF 118
|
||||||
|
#define F_CONDV 119
|
||||||
|
#define F_RIGHE 120
|
||||||
|
#define F_NUMPROVV 121
|
||||||
|
#define F_CODCF 122
|
||||||
|
|
||||||
|
#define G_DEFMOV 1
|
||||||
|
|
||||||
|
#include "mg1100a.h"
|
21
mg/mg1100a.h
Executable file
21
mg/mg1100a.h
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
// colonne visibili dello Sheet
|
||||||
|
#define F_CODART 101
|
||||||
|
#define F_CODMAG 102
|
||||||
|
#define F_CODDEP 103
|
||||||
|
#define F_LIV1 104
|
||||||
|
#define F_LIV2 105
|
||||||
|
#define F_LIV3 106
|
||||||
|
#define F_LIV4 107
|
||||||
|
#define F_UM 108
|
||||||
|
#define F_QUANT 109
|
||||||
|
#define F_PREZZO 110
|
||||||
|
|
||||||
|
|
||||||
|
// colonne non visibili dello Sheet
|
||||||
|
#define F_DESMAG 150
|
||||||
|
#define F_DESDEP 151
|
||||||
|
#define H_DESMAG 152
|
||||||
|
#define H_GESTGIA 153
|
||||||
|
#define F_UBICAZD 154
|
||||||
|
#define F_DESART 155
|
||||||
|
|
217
mg/mg1100a.uml
Executable file
217
mg/mg1100a.uml
Executable file
@ -0,0 +1,217 @@
|
|||||||
|
TOOLBAR "" 0 20 60 2
|
||||||
|
|
||||||
|
BUTTON DLG_OK 9 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -13 -1 ""
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_CANCEL 9 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -23 -1 ""
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_DELREC 9 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -33 -1 "Elimina"
|
||||||
|
MESSAGE EXIT,K_DEL
|
||||||
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
PAGE "Righe movimenti" -1 -1 80 23
|
||||||
|
|
||||||
|
STRING F_CODART 20
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 2 "Codice articolo "
|
||||||
|
FIELD CODART
|
||||||
|
FLAGS "U"
|
||||||
|
USE LF_ANAMAG
|
||||||
|
INPUT CODART F_CODART
|
||||||
|
DISPLAY "Codice@20" CODART
|
||||||
|
DISPLAY "Descrizione@50" DESCR
|
||||||
|
OUTPUT F_CODART CODART
|
||||||
|
OUTPUT F_DESART DESCR
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_DESART 20
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 3 "Descrizione "
|
||||||
|
FIELD CODART
|
||||||
|
FLAGS "U"
|
||||||
|
USE LF_ANAMAG KEY 2
|
||||||
|
INPUT DESCR F_DESART
|
||||||
|
DISPLAY "Descrizione@50" DESCR
|
||||||
|
DISPLAY "Codice@20" CODART
|
||||||
|
COPY OUTPUT F_CODART
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_CODMAG 3
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 5 "Magazzino "
|
||||||
|
FLAGS "U"
|
||||||
|
FIELD CODMAG[1,3]
|
||||||
|
USE MAG SELECT CODTAB[4,5]==""
|
||||||
|
INPUT CODTAB F_CODMAG
|
||||||
|
DISPLAY "Codice " CODTAB[1,3]
|
||||||
|
DISPLAY "Denominazione mag.@50 " S0
|
||||||
|
OUTPUT F_CODMAG CODTAB[1,3]
|
||||||
|
OUTPUT F_DESMAG S0
|
||||||
|
OUTPUT H_DESMAG S0
|
||||||
|
OUTPUT H_GESTGIA B0
|
||||||
|
// OUTPUT F_CODDEP CODTAB[4,5]
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_CODDEP 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 6 "Deposito "
|
||||||
|
FLAGS "U"
|
||||||
|
FIELD CODMAG[4,5]
|
||||||
|
USE MAG
|
||||||
|
INPUT CODTAB[1,3] F_CODMAG
|
||||||
|
INPUT CODTAB[4,5] F_CODDEP
|
||||||
|
DISPLAY "Cod. magazzino" CODTAB[1,3]
|
||||||
|
DISPLAY "Cod. deposito" CODTAB[4,5]
|
||||||
|
DISPLAY "Denominazione dep.@50" S0
|
||||||
|
OUTPUT F_CODDEP CODTAB[4,5]
|
||||||
|
OUTPUT F_DESDEP S0
|
||||||
|
OUTPUT F_CODMAG CODTAB[1,3]
|
||||||
|
CHECKTYPE NORMAL
|
||||||
|
STR_EXPR ((#H_GESTGIA=="X")&&(#F_CODDEP!=""))||(#H_GESTGIA!="X")
|
||||||
|
// WARNING "Indicare il deposito"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_DESMAG 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 22 5 ""
|
||||||
|
USE MAG KEY 2
|
||||||
|
INPUT S0 F_DESMAG
|
||||||
|
DISPLAY "Denominazione mag.@50" S0
|
||||||
|
DISPLAY "Cod. magazzino" CODTAB[1,3]
|
||||||
|
DISPLAY "Cod. deposito" CODTAB[4,5]
|
||||||
|
OUTPUT F_CODMAG CODTAB[1,3]
|
||||||
|
OUTPUT F_CODDEP CODTAB[4,5]
|
||||||
|
// GUIDO!!!!!!!!!!!!!!!!! in che ordine vengono eseguiti gli output
|
||||||
|
// a cascata??? perchè mi ritrovo il coddep cancellato???
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
STRING F_DESDEP 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 22 6 ""
|
||||||
|
FLAGS "H"
|
||||||
|
COPY USE F_DESMAG
|
||||||
|
INPUT S0 F_DESDEP
|
||||||
|
COPY DISPLAY F_DESMAG
|
||||||
|
COPY OUTPUT F_DESMAG
|
||||||
|
// MESSAGE K_TAB,F_CODDEP
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
STRING H_DESMAG 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 22 5 ""
|
||||||
|
FLAGS "D"
|
||||||
|
END
|
||||||
|
|
||||||
|
//Abilitazione/disabil. dei campi relativi al deposito
|
||||||
|
BOOLEAN H_GESTGIA
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 1 ""
|
||||||
|
FLAGS "HG"
|
||||||
|
MESSAGE TRUE ENABLE,F_CODDEP|CHECK,F_CODDEP|SHOW,F_DESDEP|SHOW,H_DESMAG|HIDE,F_DESMAG
|
||||||
|
MESSAGE FALSE RESET,F_CODDEP|RESET,F_DESDEP|DISABLE,F_CODDEP|HIDE,F_DESDEP|HIDE,H_DESMAG|SHOW,F_DESMAG
|
||||||
|
END
|
||||||
|
|
||||||
|
//Livelli giacenza
|
||||||
|
STRING F_LIV1 10
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 8 "Livello 1 "
|
||||||
|
USE GCG //SELECT CODTAB[1,1]=="1"
|
||||||
|
JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1]
|
||||||
|
INPUT CODTAB[1,1] "1"
|
||||||
|
INPUT CODTAB[2,11] F_LIV1
|
||||||
|
DISPLAY "Livello@20" 500@->S0
|
||||||
|
DISPLAY "Gruppo@10" CODTAB[2,20]
|
||||||
|
DISPLAY "Descr.@30" S0
|
||||||
|
OUTPUT F_LIV1 CODTAB[2,12]
|
||||||
|
CHECKTYPE NORMAL
|
||||||
|
|
||||||
|
MESSAGE EMPTY RESET,F_LIV2|RESET,F_LIV3|RESET,F_LIV4
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_LIV2 6
|
||||||
|
BEGIN
|
||||||
|
PROMPT 40 8 "Livello 2 "
|
||||||
|
// Non mettere FLAGS "D" perchè disabiliterebbe tutta la colonna
|
||||||
|
USE GCG //SELECT CODTAB[1,1]=="2"
|
||||||
|
JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1]
|
||||||
|
INPUT CODTAB[1,1] "2"
|
||||||
|
INPUT CODTAB[2,12] F_LIV2
|
||||||
|
COPY DISPLAY F_LIV1
|
||||||
|
OUTPUT F_LIV2 CODTAB[2,12]
|
||||||
|
CHECKTYPE NORMAL
|
||||||
|
MESSAGE EMPTY RESET,F_LIV3|RESET,F_LIV4
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_LIV3 6
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 9 "Livello 3 "
|
||||||
|
USE GCG //SELECT CODTAB[1,1]=="3"
|
||||||
|
JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1]
|
||||||
|
INPUT CODTAB[1,1] "3"
|
||||||
|
INPUT CODTAB[2,12] F_LIV3
|
||||||
|
COPY DISPLAY F_LIV1
|
||||||
|
OUTPUT F_LIV3 CODTAB[2,12]
|
||||||
|
CHECKTYPE NORMAL
|
||||||
|
MESSAGE EMPTY RESET,F_LIV4
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_LIV4 6
|
||||||
|
BEGIN
|
||||||
|
PROMPT 40 9 "Livello 4 "
|
||||||
|
USE GCG //SELECT CODTAB[1,1]=="4"
|
||||||
|
JOIN FCG ALIAS 500 INTO CODTAB==CODTAB[1,1]
|
||||||
|
INPUT CODTAB[1,1] "4"
|
||||||
|
INPUT CODTAB[2,12] F_LIV4
|
||||||
|
COPY DISPLAY F_LIV1
|
||||||
|
OUTPUT F_LIV4 CODTAB[2,12]
|
||||||
|
CHECKTYPE NORMAL
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_UM 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 11 "Unità di misura "
|
||||||
|
FIELD UM
|
||||||
|
USE LF_UMART KEY 2
|
||||||
|
INPUT CODART F_CODART SELECT
|
||||||
|
INPUT UM F_UM
|
||||||
|
DISPLAY "U.M.@10" UM
|
||||||
|
DISPLAY "F.C.@10" FC
|
||||||
|
OUTPUT F_CODART CODART
|
||||||
|
OUTPUT F_UM UM
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_QUANT 15 5
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 13 "Quantità "
|
||||||
|
FIELD QUANT
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
WARNING "Indicare la quantità"
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_PREZZO 18 3
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 14 "Prezzo "
|
||||||
|
FIELD PREZZO
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
WARNING "Indicare il prezzo"
|
||||||
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
ENDMASK
|
Loading…
x
Reference in New Issue
Block a user