Patch level : 10.0 736
Files correlati : mg3.exe mg3300.msk Ricompilazione Demo : [ ] Commento : Corretto calcolo saldo precedente in stampa schede di magazzino. git-svn-id: svn://10.65.10.50/trunk@20444 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
c1a25cd3f5
commit
23076b22d4
355
mg/mg3300.cpp
355
mg/mg3300.cpp
@ -2,9 +2,7 @@
|
|||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
#include <mailbox.h>
|
#include <mailbox.h>
|
||||||
#include <printer.h>
|
#include <printer.h>
|
||||||
|
#include <recset.h>
|
||||||
#include "movmag.h"
|
|
||||||
#include "rmovmag.h"
|
|
||||||
|
|
||||||
#include "mglib.h"
|
#include "mglib.h"
|
||||||
#include "mg3300.h"
|
#include "mg3300.h"
|
||||||
@ -14,19 +12,7 @@
|
|||||||
#define VALUE_NOT_SET "~~"
|
#define VALUE_NOT_SET "~~"
|
||||||
|
|
||||||
TCausale_magazzino& get_cau(const char* codcaus)
|
TCausale_magazzino& get_cau(const char* codcaus)
|
||||||
{
|
{ return cached_causale_magazzino(codcaus); }
|
||||||
/*
|
|
||||||
static TAssoc_array _c;
|
|
||||||
TCausale_magazzino * caus = (TCausale_magazzino*) _c.objptr(codcaus);
|
|
||||||
if (caus == NULL)
|
|
||||||
{
|
|
||||||
caus = new TCausale_magazzino(codcaus);
|
|
||||||
_c.add(codcaus, caus);
|
|
||||||
}
|
|
||||||
return *caus;
|
|
||||||
*/
|
|
||||||
return cached_causale_magazzino(codcaus);
|
|
||||||
}
|
|
||||||
|
|
||||||
class TForm_schedemag : public TForm_stampemg
|
class TForm_schedemag : public TForm_stampemg
|
||||||
{
|
{
|
||||||
@ -43,6 +29,8 @@ class TForm_schedemag : public TForm_stampemg
|
|||||||
TToken_string _rmov_sortexp;
|
TToken_string _rmov_sortexp;
|
||||||
TString _rmov_raggcond,_rmov_joinexp;
|
TString _rmov_raggcond,_rmov_joinexp;
|
||||||
|
|
||||||
|
TToken_string _saldo_key; // codart|livello|codmag
|
||||||
|
|
||||||
TTipo_saldomag _tiposcheda; // tipo scheda
|
TTipo_saldomag _tiposcheda; // tipo scheda
|
||||||
int _annoes;
|
int _annoes;
|
||||||
TString16 _user1;
|
TString16 _user1;
|
||||||
@ -65,7 +53,7 @@ public:
|
|||||||
void set_options(bool no_valori, bool no_ff, bool sintetica);
|
void set_options(bool no_valori, bool no_ff, bool sintetica);
|
||||||
const char* descr_tiposcheda() const;
|
const char* descr_tiposcheda() const;
|
||||||
const char* nomecampo_scheda() const;
|
const char* nomecampo_scheda() const;
|
||||||
TTipo_saldomag tiposcheda() const {return _tiposcheda;} ;
|
TTipo_saldomag tiposcheda() const { return _tiposcheda; }
|
||||||
|
|
||||||
TForm_schedemag(const char *name,const char *code)
|
TForm_schedemag(const char *name,const char *code)
|
||||||
: TForm_stampemg(name,code), _tolivgiac(0), _tolivart(0) {}
|
: TForm_stampemg(name,code), _tolivgiac(0), _tolivart(0) {}
|
||||||
@ -77,15 +65,15 @@ const char* TForm_schedemag::descr_tiposcheda() const
|
|||||||
{
|
{
|
||||||
switch (_tiposcheda)
|
switch (_tiposcheda)
|
||||||
{
|
{
|
||||||
case s_giac: return (TR("Giacenza"));
|
case s_giac: return TR("Giacenza");
|
||||||
case s_acl: return (TR("A conto lavoro"));
|
case s_acl: return TR("A conto lavoro");
|
||||||
case s_incl: return (TR("In conto lavoro"));
|
case s_incl: return TR("In conto lavoro");
|
||||||
case s_prodc: return (TR("In produzione componenti"));
|
case s_prodc: return TR("In produzione componenti");
|
||||||
case s_prodf: return (TR("In produzione finiti"));
|
case s_prodf: return TR("In produzione finiti");
|
||||||
case s_ordc: return (TR("Ordinato clienti"));
|
case s_ordc: return TR("Ordinato clienti");
|
||||||
case s_ordf: return (TR("Ordinato fornitori"));
|
case s_ordf: return TR("Ordinato fornitori");
|
||||||
case s_acq:
|
case s_acq:
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -94,90 +82,83 @@ const char* TForm_schedemag::nomecampo_scheda() const
|
|||||||
{
|
{
|
||||||
switch (_tiposcheda)
|
switch (_tiposcheda)
|
||||||
{
|
{
|
||||||
case s_giac: return (MAG_GIAC);
|
case s_giac: return (MAG_GIAC);
|
||||||
case s_acl: return (MAG_ACL);
|
case s_acl: return (MAG_ACL);
|
||||||
case s_incl: return (MAG_INCL);
|
case s_incl: return (MAG_INCL);
|
||||||
case s_prodc:return (MAG_PRODCOMP);
|
case s_prodc:return (MAG_PRODCOMP);
|
||||||
case s_prodf:return (MAG_PRODFIN);
|
case s_prodf:return (MAG_PRODFIN);
|
||||||
case s_ordc: return (MAG_ORDC);
|
case s_ordc: return (MAG_ORDC);
|
||||||
case s_ordf: return (MAG_ORDF);
|
case s_ordf: return (MAG_ORDF);
|
||||||
case s_acq:
|
case s_acq:
|
||||||
case s_ent:
|
case s_ent:
|
||||||
case s_ven:
|
case s_ven:
|
||||||
case s_usc:
|
case s_usc:
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TForm_schedemag::validate(TForm_item &cf, TToken_string &s)
|
bool TForm_schedemag::validate(TForm_item &cf, TToken_string &s)
|
||||||
{
|
{
|
||||||
const TString code(s.get(0)); // prende il primo parametro, il codice del messaggio
|
const TFixed_string msg(s.get(0)); // prende il primo parametro, il codice del messaggio
|
||||||
|
|
||||||
if (code=="_USER")
|
if (msg=="_USER")
|
||||||
{
|
{
|
||||||
const TString subcode(s.get());
|
const TString80 subcode(s.get());
|
||||||
TString valore(VALUE_NOT_SET);
|
TString80 valore(VALUE_NOT_SET);
|
||||||
|
|
||||||
if (subcode=="TIPOSCHEDA")
|
if (subcode=="TIPOSCHEDA")
|
||||||
valore = descr_tiposcheda();
|
valore = descr_tiposcheda();
|
||||||
if (subcode=="GRUPPOART")
|
if (subcode=="GRUPPOART")
|
||||||
{
|
{
|
||||||
if (_tolivart < livelli_articolo().last_level())
|
const TRectype& anamag = relation()->curr(LF_ANAMAG);
|
||||||
valore = livelli_articolo().group_descr_packed(relation()->lfile(LF_ANAMAG).get("CODART"),_tolivart);
|
if (_tolivart > 0 && _tolivart < livelli_articolo().last_level())
|
||||||
|
valore = livelli_articolo().group_descr_packed(anamag.get(ANAMAG_CODART),_tolivart);
|
||||||
else
|
else
|
||||||
{
|
valore = anamag.get(_user1.not_empty() ? _user1 : ANAMAG_DESCR);
|
||||||
if (_user1.blank())
|
|
||||||
valore = relation()->lfile(LF_ANAMAG).get("DESCR");
|
|
||||||
else
|
|
||||||
valore = relation()->curr(LF_ANAMAG).get(_user1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (subcode=="CODGRUPPOGIAC")
|
if (subcode=="CODGRUPPOGIAC")
|
||||||
{
|
{
|
||||||
int livello=_tolivgiac;
|
const int livello=_tolivgiac; // Cosa si risparmia ???
|
||||||
|
|
||||||
valore = livelli_giacenza().name(livello);
|
valore = livelli_giacenza().name(livello);
|
||||||
add_giaclev(valore, 1, livello);
|
add_giaclev(valore, 1, livello);
|
||||||
valore << ' ';
|
valore << ' ';
|
||||||
TString s = livelli_giacenza().unpack_grpcode(relation()->lfile(LF_RMOVMAG).get("LIVGIAC"),livello);
|
TString s = livelli_giacenza().unpack_grpcode(relation()->curr(LF_RMOVMAG).get(RMOVMAG_LIVGIAC),livello);
|
||||||
if (s.empty())
|
if (s.blank())
|
||||||
s = UNKNOWN_NAME;
|
s = UNKNOWN_NAME;
|
||||||
valore << s;
|
valore << s;
|
||||||
}
|
}
|
||||||
if (subcode=="CODGRUPPOART")
|
if (subcode=="CODGRUPPOART")
|
||||||
{
|
{
|
||||||
valore = relation()->lfile(LF_ANAMAG).get("CODART");
|
valore = relation()->curr(LF_ANAMAG).get(ANAMAG_CODART);
|
||||||
if (livelli_articolo().enabled())
|
if (_tolivart > 0 && livelli_articolo().enabled())
|
||||||
valore.cut(min(valore.len(),livelli_articolo().packed_length(_tolivart)));
|
valore.cut(min(valore.len(),livelli_articolo().packed_length(_tolivart)));
|
||||||
}
|
}
|
||||||
if (subcode=="GRUPPOGIAC")
|
if (subcode=="GRUPPOGIAC")
|
||||||
valore = livelli_giacenza().group_descr_packed(relation()->lfile(LF_RMOVMAG).get("LIVGIAC"),_tolivgiac);
|
valore = livelli_giacenza().group_descr_packed(relation()->curr(LF_RMOVMAG).get(RMOVMAG_LIVGIAC),_tolivgiac);
|
||||||
if (subcode=="CODCATMER")
|
if (subcode=="CODCATMER")
|
||||||
{
|
{
|
||||||
valore = relation()->lfile(LF_ANAMAG).get("GRMERC");
|
valore = relation()->curr(LF_ANAMAG).get("GRMERC");
|
||||||
if (!_sottocatmer && valore.full())
|
if (!_sottocatmer && valore.full())
|
||||||
valore.cut(3);
|
valore.cut(3);
|
||||||
}
|
}
|
||||||
if (subcode=="CATMER")
|
if (subcode=="CATMER")
|
||||||
{
|
{
|
||||||
if (_sottocatmer)
|
valore = relation()->curr(_sottocatmer ? -ALIAS_SOTTOCATMER : -ALIAS_CATMER).get("S0");
|
||||||
valore = relation()->lfile(-ALIAS_SOTTOCATMER).get("S0");
|
|
||||||
else
|
|
||||||
valore = relation()->lfile(-ALIAS_CATMER).get("S0");
|
|
||||||
}
|
}
|
||||||
if (subcode=="DADATA")
|
if (subcode=="DADATA")
|
||||||
valore = _data_inizio.string();
|
valore = _data_inizio.string();
|
||||||
if (subcode=="ADATA")
|
if (subcode=="ADATA")
|
||||||
valore = _data_fine.string();
|
valore = _data_fine.string();
|
||||||
|
|
||||||
const TRectype& rmovmag = relation()->curr(LF_RMOVMAG);
|
|
||||||
const TRectype& movmag = relation()->curr(LF_MOVMAG);
|
|
||||||
const TString16 cau_r= rmovmag.get(RMOVMAG_CODCAUS);
|
|
||||||
const TString16 cau_m= movmag.get(MOVMAG_CODCAUS);
|
|
||||||
const TCausale_magazzino & cau = get_cau(cau_r.empty() ? cau_m : cau_r);
|
|
||||||
if (subcode=="*SEGNOCAUS")
|
if (subcode=="*SEGNOCAUS")
|
||||||
{
|
{
|
||||||
|
const TRectype& rmovmag = relation()->curr(LF_RMOVMAG);
|
||||||
|
const TRectype& movmag = relation()->curr(LF_MOVMAG);
|
||||||
|
const TString8 cau_r= rmovmag.get(RMOVMAG_CODCAUS);
|
||||||
|
const TString8 cau_m= movmag.get(MOVMAG_CODCAUS);
|
||||||
|
const TCausale_magazzino & cau = get_cau(cau_r.empty() ? cau_m : cau_r);
|
||||||
|
|
||||||
const char qv = s.get_char(); // Segno per Quantita'o Valore
|
const char qv = s.get_char(); // Segno per Quantita'o Valore
|
||||||
int sgn = cau.sgn(_tiposcheda);
|
int sgn = cau.sgn(_tiposcheda);
|
||||||
|
|
||||||
@ -197,24 +178,41 @@ bool TForm_schedemag::validate(TForm_item &cf, TToken_string &s)
|
|||||||
valore = "";
|
valore = "";
|
||||||
}
|
}
|
||||||
if (subcode=="CAUSALERIGA")
|
if (subcode=="CAUSALERIGA")
|
||||||
|
{
|
||||||
|
const TRectype& rmovmag = relation()->curr(LF_RMOVMAG);
|
||||||
|
const TRectype& movmag = relation()->curr(LF_MOVMAG);
|
||||||
|
const TString8 cau_r= rmovmag.get(RMOVMAG_CODCAUS);
|
||||||
|
const TString8 cau_m= movmag.get(MOVMAG_CODCAUS);
|
||||||
|
const TCausale_magazzino & cau = get_cau(cau_r.empty() ? cau_m : cau_r);
|
||||||
valore = cau.codice();
|
valore = cau.codice();
|
||||||
|
}
|
||||||
if (subcode=="DESCRCAUSALE")
|
if (subcode=="DESCRCAUSALE")
|
||||||
|
{
|
||||||
|
const TRectype& rmovmag = relation()->curr(LF_RMOVMAG);
|
||||||
|
const TRectype& movmag = relation()->curr(LF_MOVMAG);
|
||||||
|
const TString8 cau_r= rmovmag.get(RMOVMAG_CODCAUS);
|
||||||
|
const TString8 cau_m= movmag.get(MOVMAG_CODCAUS);
|
||||||
|
const TCausale_magazzino & cau = get_cau(cau_r.empty() ? cau_m : cau_r);
|
||||||
valore = cau.descr();
|
valore = cau.descr();
|
||||||
|
}
|
||||||
|
|
||||||
if (subcode=="CANPRINTSALDOPREC") // Determina se e' possibile stampare il saldo precedente
|
if (subcode=="CANPRINTSALDOPREC") // Determina se e' possibile stampare il saldo precedente
|
||||||
{
|
{
|
||||||
bool printsaldoprec = true;
|
bool printsaldoprec = true;
|
||||||
|
const TRectype& movmag = relation()->curr(LF_MOVMAG);
|
||||||
const TDate datareg = movmag.get_date(MOVMAG_DATAREG);
|
const TDate datareg = movmag.get_date(MOVMAG_DATAREG);
|
||||||
|
const bool stampa_perart = relation()->lfile().num() == LF_ANAMAG;
|
||||||
|
|
||||||
// Se il movimento corrente e' >= la data inizio stampa allora posso sempre stampare il saldo ...
|
// Se il movimento corrente e' >= la data inizio stampa allora posso sempre stampare il saldo ...
|
||||||
if (datareg < _data_inizio) // ... altrimenti devo fare altri controlli
|
if (datareg < _data_inizio) // ... altrimenti devo fare altri controlli
|
||||||
{
|
{
|
||||||
const bool stampa_perart = relation()->lfile().num() == LF_ANAMAG;
|
|
||||||
if (stampa_perart) // Stampa per articoli
|
if (stampa_perart) // Stampa per articoli
|
||||||
{
|
{
|
||||||
TSortedfile& rmm = (TSortedfile&)relation()->lfile(LF_RMOVMAG);
|
TSortedfile& rmm = (TSortedfile&)relation()->lfile(LF_RMOVMAG);
|
||||||
const TRecnotype oldpos = rmm.recno();
|
const TRecnotype oldpos = rmm.recno();
|
||||||
TString80 old_art;
|
TToken_string old_art;
|
||||||
old_art << rmm.get(RMOVMAG_CODART); old_art << '|' << rmm.get(RMOVMAG_LIVGIAC);
|
old_art = rmm.get(RMOVMAG_CODART);
|
||||||
|
old_art.add(rmm.get(RMOVMAG_LIVGIAC));
|
||||||
const int err = rmm.next();
|
const int err = rmm.next();
|
||||||
if (err == NOERR) // Se non sono sull'ultimo record ...
|
if (err == NOERR) // Se non sono sull'ultimo record ...
|
||||||
{
|
{
|
||||||
@ -226,8 +224,9 @@ bool TForm_schedemag::validate(TForm_item &cf, TToken_string &s)
|
|||||||
if (!printsaldoprec)
|
if (!printsaldoprec)
|
||||||
{
|
{
|
||||||
// Se la prossima data e' >= della corrente verifico se cambio articolo
|
// Se la prossima data e' >= della corrente verifico se cambio articolo
|
||||||
TString80 new_art;
|
TToken_string new_art;
|
||||||
new_art << rmm.get(RMOVMAG_CODART); new_art << '|' << rmm.get(RMOVMAG_LIVGIAC);
|
new_art = rmm.get(RMOVMAG_CODART);
|
||||||
|
new_art.add(rmm.get(RMOVMAG_LIVGIAC));
|
||||||
printsaldoprec = old_art != new_art;
|
printsaldoprec = old_art != new_art;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -237,10 +236,10 @@ bool TForm_schedemag::validate(TForm_item &cf, TToken_string &s)
|
|||||||
{
|
{
|
||||||
TSortedfile& rmm = (TSortedfile&)relation()->lfile(LF_RMOVMAG);
|
TSortedfile& rmm = (TSortedfile&)relation()->lfile(LF_RMOVMAG);
|
||||||
const TRecnotype oldpos = rmm.recno();
|
const TRecnotype oldpos = rmm.recno();
|
||||||
TString80 old_art;
|
TToken_string old_art;
|
||||||
old_art << rmm.get(RMOVMAG_CODART);
|
old_art = rmm.get(RMOVMAG_CODART);
|
||||||
old_art << '|' << rmm.get(RMOVMAG_LIVGIAC);
|
old_art.add(rmm.get(RMOVMAG_LIVGIAC));
|
||||||
old_art << '|' << rmm.get(RMOVMAG_CODMAG);
|
old_art.add(rmm.get(RMOVMAG_CODMAG));
|
||||||
|
|
||||||
const int err = rmm.next();
|
const int err = rmm.next();
|
||||||
if (err == NOERR) // Se non sono sull'ultimo record ...
|
if (err == NOERR) // Se non sono sull'ultimo record ...
|
||||||
@ -254,16 +253,23 @@ bool TForm_schedemag::validate(TForm_item &cf, TToken_string &s)
|
|||||||
if (!printsaldoprec)
|
if (!printsaldoprec)
|
||||||
{
|
{
|
||||||
// Se la prossima data e' >= della corrente verifico se cambio articolo
|
// Se la prossima data e' >= della corrente verifico se cambio articolo
|
||||||
TString80 new_art;
|
TToken_string new_art;
|
||||||
new_art << rmm.get(RMOVMAG_CODART);
|
new_art = rmm.get(RMOVMAG_CODART);
|
||||||
new_art << '|' << rmm.get(RMOVMAG_LIVGIAC);
|
new_art.add(rmm.get(RMOVMAG_LIVGIAC));
|
||||||
new_art << '|' << rmm.get(RMOVMAG_CODMAG);
|
new_art.add(rmm.get(RMOVMAG_CODMAG));
|
||||||
printsaldoprec = old_art != new_art;
|
printsaldoprec = old_art != new_art;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rmm.readat(oldpos); // ripristino la posizione del file
|
rmm.readat(oldpos); // ripristino la posizione del file
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (printsaldoprec) // Memorizzo chiave articolo per utilizzarla al momento di calcolare il SALDOPREC
|
||||||
|
{
|
||||||
|
const TRectype& rmm = relation()->curr(LF_RMOVMAG);
|
||||||
|
_saldo_key = rmm.get(RMOVMAG_CODART);
|
||||||
|
_saldo_key.add(rmm.get(RMOVMAG_LIVGIAC));
|
||||||
|
_saldo_key.add(rmm.get(RMOVMAG_CODMAG));
|
||||||
|
}
|
||||||
valore = printsaldoprec ? "1" : "0";
|
valore = printsaldoprec ? "1" : "0";
|
||||||
}
|
}
|
||||||
if (subcode=="SALDOPREC")
|
if (subcode=="SALDOPREC")
|
||||||
@ -271,75 +277,52 @@ bool TForm_schedemag::validate(TForm_item &cf, TToken_string &s)
|
|||||||
valore = "";
|
valore = "";
|
||||||
if (!_magazzino_chiuso) // mag precedente non chiuso, mancano i saldi di apertura
|
if (!_magazzino_chiuso) // mag precedente non chiuso, mancano i saldi di apertura
|
||||||
{
|
{
|
||||||
TLocalisamfile mag_annoprec(LF_MAG);
|
TString80 codart; _saldo_key.get(0, codart);
|
||||||
TString codmag, codart, livello;
|
TString16 livello; _saldo_key.get(1, livello);
|
||||||
|
TString8 codmag; _saldo_key.get(2, codmag);
|
||||||
|
|
||||||
const bool stampa_perart = relation()->lfile().num() == LF_ANAMAG;
|
if (_tolivart > 0 && _tolivart < livelli_articolo().last_level())
|
||||||
if (stampa_perart) // Stampa per articoli
|
|
||||||
{
|
{
|
||||||
cursor()->relation()->save_status();
|
codart.cut(livelli_articolo().code_length(_tolivart));
|
||||||
TLocalisamfile & rmovmag = cursor()->relation()->lfile(LF_RMOVMAG);
|
livello.cut(0);
|
||||||
|
|
||||||
rmovmag.prev();
|
|
||||||
|
|
||||||
codmag = rmovmag.get(RMOVMAG_CODMAG);
|
|
||||||
codart = rmovmag.get(RMOVMAG_CODART);
|
|
||||||
livello = rmovmag.get(RMOVMAG_LIVGIAC);
|
|
||||||
cursor()->relation()->restore_status();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
// Nella stampa per magazzini al momento del saldo sono avanti di un passo rispetto a dove mi serve
|
|
||||||
if (cursor()->pos() > 0L)
|
|
||||||
{
|
|
||||||
--(*cursor());
|
|
||||||
const TRectype& rmovmag = cursor()->curr(LF_RMOVMAG); // Record principale
|
|
||||||
codmag = rmovmag.get(RMOVMAG_CODMAG);
|
|
||||||
codart = rmovmag.get(RMOVMAG_CODART);
|
|
||||||
livello = rmovmag.get(RMOVMAG_LIVGIAC);
|
|
||||||
++(*cursor());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mag_annoprec.put(MAG_ANNOES, _anno_prec);
|
|
||||||
mag_annoprec.put(MAG_CODMAG, codmag);
|
|
||||||
mag_annoprec.put(MAG_CODART, codart);
|
|
||||||
mag_annoprec.put(MAG_LIVELLO, livello);
|
|
||||||
if (_sudd_mag) // Se e' una stampa dettagliata per magazzino
|
|
||||||
{
|
{
|
||||||
mag_annoprec.setkey(2);
|
if (_tolivgiac > 0)
|
||||||
if (mag_annoprec.read() == NOERR) // Ho trovato un saldo precedente del magazzino in questione
|
|
||||||
{
|
{
|
||||||
const real saldoprec = mag_annoprec.get_real(nomecampo_scheda());
|
if (_tolivgiac < livelli_giacenza().last_level())
|
||||||
if (!saldoprec.is_zero())
|
livello.cut(livelli_giacenza().code_length(_tolivgiac));
|
||||||
{
|
|
||||||
real currsaldo = cf.get();
|
|
||||||
currsaldo += saldoprec; // Sommo il saldo precedente al campo corrente
|
|
||||||
valore = currsaldo.string();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Calcolo la somma dei saldi di tutti i magazzini
|
|
||||||
mag_annoprec.setkey(1);
|
|
||||||
real currsaldo = cf.get();
|
|
||||||
for (int r = 1; ; r++)
|
|
||||||
{
|
|
||||||
mag_annoprec.put(MAG_NRIGA, r);
|
|
||||||
if (mag_annoprec.read() != NOERR)
|
|
||||||
break;
|
|
||||||
const real saldoprec = mag_annoprec.get_real(nomecampo_scheda());
|
|
||||||
currsaldo += saldoprec; // Sommo il saldo precedente al campo corrente
|
|
||||||
}
|
}
|
||||||
valore = currsaldo.string();
|
else
|
||||||
}
|
livello.cut(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
TString query, region;
|
||||||
|
query << "USE " << LF_MAG;
|
||||||
|
region << MAG_ANNOES << '=' << _anno_prec;
|
||||||
|
region << ' ' << MAG_CODART << '=' << codart;
|
||||||
|
query << "\nFROM " << region;
|
||||||
|
query << "\nTO " << region;
|
||||||
|
if (_tolivart <= 0 || _tolivart >= livelli_articolo().last_level())
|
||||||
|
query << '~';
|
||||||
|
|
||||||
|
TISAM_recordset magprec(query);
|
||||||
|
real currsaldo = cf.get();
|
||||||
|
for (bool ok = magprec.move_first(); ok; ok = magprec.move_next())
|
||||||
|
{
|
||||||
|
if (_sudd_mag && magprec.get(MAG_CODMAG).as_string() != codmag)
|
||||||
|
continue; // Escludo magazzini indesiderati
|
||||||
|
if (livello.not_empty() && !magprec.get(MAG_LIVELLO).as_string().starts_with(livello))
|
||||||
|
continue; // Escludo livelli di giacenza non corrispondenti
|
||||||
|
const real saldoprec = magprec.get(nomecampo_scheda()).as_real();
|
||||||
|
currsaldo += saldoprec; // Sommo il saldo precedente al campo corrente
|
||||||
|
}
|
||||||
|
valore = currsaldo.string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (subcode.left(3) == "ADD")
|
if (subcode.left(3) == "ADD")
|
||||||
{
|
{
|
||||||
const TString16 cau = cf.section().find_field(FF_CAUSALE_RIGA).get();
|
const TString8 cau = cf.section().find_field(FF_CAUSALE_RIGA).get();
|
||||||
TCausale_magazzino & ccrr = get_cau(cau);
|
TCausale_magazzino & ccrr = get_cau(cau);
|
||||||
const bool is_qta = subcode.right(3) == "QTA";
|
const bool is_qta = subcode.right(3) == "QTA";
|
||||||
const bool ok = is_qta && ccrr.update_qta() || !is_qta && ccrr.update_val();
|
const bool ok = is_qta && ccrr.update_qta() || !is_qta && ccrr.update_val();
|
||||||
@ -369,29 +352,23 @@ bool TForm_schedemag::validate(TForm_item &cf, TToken_string &s)
|
|||||||
|
|
||||||
bool TForm_schedemag::ragg_exprs(int livart, int livgiac)
|
bool TForm_schedemag::ragg_exprs(int livart, int livgiac)
|
||||||
{
|
{
|
||||||
TString piece,rest;
|
TString16 ca = RMOVMAG_CODART;
|
||||||
// ***********
|
if (livart > 0 && livart < livelli_articolo().last_level())
|
||||||
int tolivart,tolivgiac;
|
ca << "[1," << livelli_articolo().packed_length(livart) <<']';
|
||||||
|
|
||||||
tolivart =livart ? livart : livelli_articolo().last_level() ;
|
|
||||||
tolivgiac=livgiac ? livgiac : livelli_giacenza().last_level();
|
|
||||||
// sezioni livello codice
|
|
||||||
piece="CODART";
|
|
||||||
if (livelli_articolo().enabled())
|
|
||||||
piece << "[1," << livelli_articolo().packed_length(tolivart) <<']';
|
|
||||||
if (_rmov_raggcond.full())
|
if (_rmov_raggcond.full())
|
||||||
_rmov_raggcond << "+";
|
_rmov_raggcond << '+';
|
||||||
_rmov_raggcond << piece;
|
_rmov_raggcond << ca;
|
||||||
_rmov_sortexp.add(piece);
|
_rmov_sortexp.add(ca);
|
||||||
_rmov_joinexp.cut(0);
|
_rmov_joinexp.cut(0) << ca << "==" << ca;
|
||||||
_rmov_joinexp << piece << "==" << piece;
|
|
||||||
if (livart==0)
|
// Posso raggruppare per livello di giacenza solo se non raggruppo per livello articolo
|
||||||
|
if (livgiac > 0 && !ca.ends_with("]"))
|
||||||
{
|
{
|
||||||
piece="LIVGIAC";
|
TString16 lg=RMOVMAG_LIVGIAC;
|
||||||
if (livelli_giacenza().enabled())
|
if (livgiac < livelli_giacenza().last_level())
|
||||||
piece << "[1," << livelli_giacenza().packed_length(tolivgiac) <<']';
|
lg << "[1," << livelli_giacenza().packed_length(livgiac) <<']';
|
||||||
_rmov_raggcond << '+' << piece;
|
_rmov_raggcond << '+' << lg;
|
||||||
_rmov_sortexp.add(piece);
|
_rmov_sortexp.add(lg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -405,7 +382,8 @@ void TForm_schedemag::setdett_permag(bool sudd_dep,bool show_dett,int livart,int
|
|||||||
TForm_subsection &h_a=(TForm_subsection &)find_field('B',odd_page,"HEADER_ARTICOLO");
|
TForm_subsection &h_a=(TForm_subsection &)find_field('B',odd_page,"HEADER_ARTICOLO");
|
||||||
h_a.enable(show_dett);
|
h_a.enable(show_dett);
|
||||||
TForm_subsection &h_g=(TForm_subsection &)find_field('B',odd_page,"HEADER_LIVGIAC");
|
TForm_subsection &h_g=(TForm_subsection &)find_field('B',odd_page,"HEADER_LIVGIAC");
|
||||||
h_g.enable(livelli_giacenza().enabled() && (livart ==0 || livgiac !=0 ));
|
// h_g.enable(livelli_giacenza().enabled() && (livart ==0 || livgiac !=0 )); Guy was here
|
||||||
|
h_g.enable(livelli_giacenza().enabled() && (livart ==0 && livgiac>0 ));
|
||||||
|
|
||||||
_rmov_raggcond = "CODMAG[1,3]";
|
_rmov_raggcond = "CODMAG[1,3]";
|
||||||
_rmov_sortexp = "CODMAG[1,3]";
|
_rmov_sortexp = "CODMAG[1,3]";
|
||||||
@ -414,19 +392,18 @@ void TForm_schedemag::setdett_permag(bool sudd_dep,bool show_dett,int livart,int
|
|||||||
_rmov_raggcond << "+CODMAG[4,5]";
|
_rmov_raggcond << "+CODMAG[4,5]";
|
||||||
_rmov_sortexp.add("CODMAG[4,5]");
|
_rmov_sortexp.add("CODMAG[4,5]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_tolivart = livart > 0 ? livart : livelli_articolo().last_level();
|
||||||
|
_tolivgiac = _tolivart < livelli_articolo().last_level() ? 0 : livgiac;
|
||||||
if (show_dett)
|
if (show_dett)
|
||||||
ragg_exprs(livart, livgiac);
|
ragg_exprs(livart, livgiac);
|
||||||
|
|
||||||
TForm_subsection &s=(TForm_subsection &)find_field('B',odd_page,"GRUPPI_RMOVMAG");
|
TForm_subsection& s = find_field('B',odd_page,"GRUPPI_RMOVMAG");
|
||||||
s.setcondition(_rmov_raggcond,_strexpr);
|
s.setcondition(_rmov_raggcond,_strexpr);
|
||||||
|
|
||||||
TString cond;
|
TString16 cond; cond << LF_MOVMAG << "->" << MOVMAG_DATAREG;
|
||||||
cond << LF_MOVMAG << "->DATAREG";
|
|
||||||
_rmov_sortexp.add(cond);
|
_rmov_sortexp.add(cond);
|
||||||
_rmov_sortexp.add("NUMREG");
|
_rmov_sortexp.add(MOVMAG_NUMREG);
|
||||||
|
|
||||||
_tolivart=livart ? livart :livelli_articolo().last_level() ;
|
|
||||||
_tolivgiac=livgiac ? livgiac :livelli_giacenza().last_level();
|
|
||||||
|
|
||||||
_sudd_mag = true; // E' una stampa suddvisa per magazzini
|
_sudd_mag = true; // E' una stampa suddvisa per magazzini
|
||||||
}
|
}
|
||||||
@ -451,21 +428,24 @@ void TForm_schedemag::setdett_perart(bool percatmer,bool sottocatmer,int livart,
|
|||||||
h_g.enable(livart ==0 || livgiac !=0 || sudd_mag);
|
h_g.enable(livart ==0 || livgiac !=0 || sudd_mag);
|
||||||
h_g.set_newpage(!_no_ff && (livart ==0 || livgiac !=0 || sudd_mag));
|
h_g.set_newpage(!_no_ff && (livart ==0 || livgiac !=0 || sudd_mag));
|
||||||
TForm_subsection &h_l=(TForm_subsection &)find_field('B',odd_page,"HEADER_LIVGIAC");
|
TForm_subsection &h_l=(TForm_subsection &)find_field('B',odd_page,"HEADER_LIVGIAC");
|
||||||
h_l.enable(livelli_giacenza().enabled() && (livart ==0 || livgiac !=0 ));
|
//h_l.enable(livelli_giacenza().enabled() && (livart ==0 || livgiac !=0 )); Guy was here
|
||||||
|
h_l.enable(livelli_giacenza().enabled() && (livart ==0 && livgiac>0 ));
|
||||||
|
|
||||||
|
|
||||||
TForm_subsection &h_m=(TForm_subsection &)find_field('B',odd_page,"HEADER_MAG");
|
TForm_subsection &h_m=(TForm_subsection &)find_field('B',odd_page,"HEADER_MAG");
|
||||||
h_m.enable(sudd_mag );
|
h_m.enable(sudd_mag );
|
||||||
TForm_subsection &h_d=(TForm_subsection &)find_field('B',odd_page,"HEADER_DEP");
|
TForm_subsection &h_d=(TForm_subsection &)find_field('B',odd_page,"HEADER_DEP");
|
||||||
h_d.enable(sudd_dep);
|
h_d.enable(sudd_dep);
|
||||||
|
|
||||||
TForm_subsection &t_s=(TForm_subsection &)find_field('B',odd_page,"TOTALI_GRMOV");
|
TForm_subsection &t_s=(TForm_subsection &)find_field('B',odd_page,"TOTALI_GRMOV");
|
||||||
t_s.show(livart==0 || livgiac !=0 || sudd_mag);
|
t_s.show(livart==0 || livgiac !=0 || sudd_mag);
|
||||||
|
|
||||||
_tolivart=livart ? livart :livelli_articolo().last_level() ;
|
_tolivart = livart>0 ? livart : livelli_articolo().last_level() ;
|
||||||
_tolivgiac=livgiac ? livgiac :livelli_giacenza().last_level();
|
_tolivgiac = _tolivart < livelli_articolo().last_level() ? 0 : livgiac;
|
||||||
_sottocatmer=sottocatmer;
|
_sottocatmer=sottocatmer;
|
||||||
|
|
||||||
// settaggio catmer/ragg codice
|
// settaggio catmer/ragg codice
|
||||||
if (livart || percatmer) {
|
if (livart || percatmer)
|
||||||
|
{
|
||||||
TForm_subsection &s=(TForm_subsection &)find_field('B',odd_page,"GRUPPI_ARTICOLO");
|
TForm_subsection &s=(TForm_subsection &)find_field('B',odd_page,"GRUPPI_ARTICOLO");
|
||||||
TString cond;
|
TString cond;
|
||||||
if (percatmer)
|
if (percatmer)
|
||||||
@ -666,8 +646,8 @@ void TStampa_schede_mag::setprint_permagazzini()
|
|||||||
m.get_int(F_TOLIVELLOART), m.get_int(F_TOLIVELLOGIAC));
|
m.get_int(F_TOLIVELLOART), m.get_int(F_TOLIVELLOGIAC));
|
||||||
|
|
||||||
// filtering from/to ART
|
// filtering from/to ART
|
||||||
darec.put("CODART", m.get(F_DAART));
|
darec.put(RMOVMAG_CODART, m.get(F_DAART));
|
||||||
arec.put("CODART", m.get(F_AART));
|
arec.put(RMOVMAG_CODART, m.get(F_AART));
|
||||||
|
|
||||||
// filtering ONLY NEGATIVES
|
// filtering ONLY NEGATIVES
|
||||||
if (m.get(F_FILTRO)[0]=='N')
|
if (m.get(F_FILTRO)[0]=='N')
|
||||||
@ -734,8 +714,8 @@ void TStampa_schede_mag::setprint_perarticoli()
|
|||||||
_cur->set_filterfunction(negatives_only);
|
_cur->set_filterfunction(negatives_only);
|
||||||
|
|
||||||
// Imposta i livelli di dettaglio della scheda
|
// Imposta i livelli di dettaglio della scheda
|
||||||
int tolivelloart = m.get_int(F_TOLIVELLOART);
|
const int tolivelloart = m.get_int(F_TOLIVELLOART);
|
||||||
int tolivellogiac = m.get_int(F_TOLIVELLOGIAC);
|
const int tolivellogiac = tolivelloart <= 0 ? m.get_int(F_TOLIVELLOGIAC) : 0;
|
||||||
TString sortexp;
|
TString sortexp;
|
||||||
int tilde = 0x2;
|
int tilde = 0x2;
|
||||||
switch (subordine)
|
switch (subordine)
|
||||||
@ -825,15 +805,22 @@ void TStampa_schede_mag::main_loop()
|
|||||||
while (reload() || m.run() == K_ENTER)
|
while (reload() || m.run() == K_ENTER)
|
||||||
{
|
{
|
||||||
reload() = false;
|
reload() = false;
|
||||||
if (m.magazz_ini().gestmag(TRUE))
|
if (m.magazz_ini().gestmag(true))
|
||||||
{
|
{
|
||||||
char dettaglio=m.get(F_ENABLER)[0];
|
const char dettaglio=m.get(F_ENABLER)[0];
|
||||||
if (dettaglio=='A' && m.get_int(F_TOLIVELLOART)==0)
|
if (dettaglio=='A') // Filtra su livello articolo
|
||||||
m.set(F_TOLIVELLOART,livelli_articolo().last_level());
|
{
|
||||||
if (dettaglio=='G' && m.get_int(F_TOLIVELLOGIAC)==0)
|
if (m.get_int(F_TOLIVELLOART)==0)
|
||||||
m.set(F_TOLIVELLOGIAC,livelli_giacenza().last_level());
|
m.set(F_TOLIVELLOART,livelli_articolo().last_level());
|
||||||
TString16 frmname;
|
m.reset(F_TOLIVELLOGIAC);
|
||||||
const bool per_articoli = (*m.get(F_ORDINE) == 'A');
|
}
|
||||||
|
else // Filtra su livello giacenza
|
||||||
|
{
|
||||||
|
if (m.get_int(F_TOLIVELLOGIAC)==0)
|
||||||
|
m.set(F_TOLIVELLOGIAC,livelli_giacenza().last_level());
|
||||||
|
}
|
||||||
|
TString8 frmname;
|
||||||
|
const bool per_articoli = *m.get(F_ORDINE) == 'A';
|
||||||
const bool sintetica = m.get_bool(F_SINTETICA);
|
const bool sintetica = m.get_bool(F_SINTETICA);
|
||||||
if (per_articoli)
|
if (per_articoli)
|
||||||
frmname = "mg3300a";
|
frmname = "mg3300a";
|
||||||
|
@ -242,18 +242,17 @@ BEGIN
|
|||||||
PROMPT 42 12 "Dettaglio i depositi"
|
PROMPT 42 12 "Dettaglio i depositi"
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST F_ENABLER 30
|
LIST F_ENABLER 2 30
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 14 "Livello di dettaglio "
|
PROMPT 2 14 "Livello di dettaglio "
|
||||||
ITEM "AC|fino ai singoli articoli"
|
ITEM "AC|fino ai singoli articoli"
|
||||||
MESSAGE RESET,F_TOLIVELLOGIAC|HIDE,F_TOLIVELLOGIAC|RESET,F_TOLIVELLOART|HIDE,F_TOLIVELLOART
|
MESSAGE RESET,F_TOLIVELLOGIAC|HIDE,F_TOLIVELLOGIAC|RESET,F_TOLIVELLOART|HIDE,F_TOLIVELLOART
|
||||||
ITEM "AL|fino al livello"
|
ITEM "AL|fino al livello articolo"
|
||||||
MESSAGE RESET,F_TOLIVELLOGIAC|HIDE,F_TOLIVELLOGIAC|SHOW,F_TOLIVELLOART|CHECK,F_TOLIVELLOART
|
MESSAGE RESET,F_TOLIVELLOGIAC|HIDE,F_TOLIVELLOGIAC|SHOW,F_TOLIVELLOART|CHECK,F_TOLIVELLOART
|
||||||
ITEM "GC|fino al livello di giacenza"
|
ITEM "GC|fino al livello di giacenza"
|
||||||
MESSAGE RESET,F_TOLIVELLOART|HIDE,F_TOLIVELLOART|SHOW,F_TOLIVELLOGIAC|CHECK,F_TOLIVELLOGIAC
|
MESSAGE RESET,F_TOLIVELLOART|HIDE,F_TOLIVELLOART|SHOW,F_TOLIVELLOGIAC|CHECK,F_TOLIVELLOGIAC
|
||||||
ITEM "|massimo"
|
ITEM "GM|massimo livello di giacenza"
|
||||||
MESSAGE ENABLE,F_SUDDIV_MAGAZZINI
|
MESSAGE ENABLE,F_SUDDIV_MAGAZZINI|RESET,F_TOLIVELLOGIAC|RESET,F_TOLIVELLOART|HIDE,F_TOLIVELLOART|HIDE,F_TOLIVELLOGIAC
|
||||||
MESSAGE RESET,F_TOLIVELLOGIAC|RESET,F_TOLIVELLOART|HIDE,F_TOLIVELLOART|HIDE,F_TOLIVELLOGIAC
|
|
||||||
GROUP G_LIVELLI
|
GROUP G_LIVELLI
|
||||||
END
|
END
|
||||||
|
|
||||||
|
11
mg/mglib.h
11
mg/mglib.h
@ -4,14 +4,14 @@
|
|||||||
#ifndef __MGLIB_H
|
#ifndef __MGLIB_H
|
||||||
#define __MGLIB_H
|
#define __MGLIB_H
|
||||||
|
|
||||||
#ifndef __MULTIREC_H
|
|
||||||
#include <multirec.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __MASK_H
|
#ifndef __MASK_H
|
||||||
#include <mask.h>
|
#include <mask.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __MULTIREC_H
|
||||||
|
#include <multirec.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __FORM_H
|
#ifndef __FORM_H
|
||||||
#include <form.h>
|
#include <form.h>
|
||||||
#endif
|
#endif
|
||||||
@ -56,7 +56,8 @@ typedef enum
|
|||||||
riga_nongenerata = ' ' // immissione diretta del mov.
|
riga_nongenerata = ' ' // immissione diretta del mov.
|
||||||
} TTipo_rigamovmag;
|
} TTipo_rigamovmag;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum
|
||||||
|
{
|
||||||
valorizz_ultcos,
|
valorizz_ultcos,
|
||||||
valorizz_mediacos,
|
valorizz_mediacos,
|
||||||
valorizz_przlist,
|
valorizz_przlist,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user