diff --git a/mg/mg3300a.frm b/mg/mg3300a.frm index 8da3598aa..67c5df4f1 100755 --- a/mg/mg3300a.frm +++ b/mg/mg3300a.frm @@ -2,8 +2,8 @@ #include "mg3300.h" USE LF_ANAMAG SORT LF_RMOVMAG BY CODART[1,2] NUMREG - USING LF_MOVMAG INTO NUMREG==NUMREG - JOIN TO LF_ANAMAG KEY 2 INTO CODART==CODART + USING LF_MOVMAG INTO NUMREG==NUMREG +JOIN TO LF_ANAMAG KEY 2 INTO CODART==CODART JOIN LF_MAG TO LF_RMOVMAG KEY 2 INTO ANNOES==1990 CODMAG==CODMAG CODART==CODART LIVELLO==LIVGIAC JOIN LF_MOVMAG TO LF_RMOVMAG INTO NUMREG==NUMREG //JOIN %CAU TO LF_RMOVMAG ALIAS ALIAS_CAU_RIGHE INTO CODTAB==CODCAUS @@ -390,9 +390,9 @@ SECTION BODY ODD 0 SECTION TOTALI_MOV 1 1 1 NUMEXPR #FF_SALDO_MOV!=0 SECTION HEADER_MOV 1 1 1 NUMEXPR (#FF_NUMRIGHE==0) - NUMERO FF_NUM_MOV 32 + NUMERO FF_NUM_MOV BEGIN - PROMPT 2 1 "Mov.$[v,w]" + PROMPT 1 1 "Mov.$[v,w] " END STRINGA FF_DATA_MOV 10 BEGIN diff --git a/mg/mg3300b.frm b/mg/mg3300b.frm index b90e21e98..9c82bfe5e 100755 --- a/mg/mg3300b.frm +++ b/mg/mg3300b.frm @@ -324,9 +324,9 @@ SECTION BODY ODD 2 END // stampa saldo precedente SECTION TOTALI_MOV 1 2 2 NUMEXPR #FF_SALDO_MOV!=0 - NUMBER FF_NUM_MOV 32 + NUMBER FF_NUM_MOV BEGIN - PROMPT 2 1 "Mov.$[v,w]" + PROMPT 1 1 "Mov.$[v,w] " END STRINGA FF_DATA_MOV 10 BEGIN diff --git a/mg/mg3500.cpp b/mg/mg3500.cpp index 7f1fbe679..715904539 100755 --- a/mg/mg3500.cpp +++ b/mg/mg3500.cpp @@ -1,12 +1,51 @@ #include +#include #include "mglib.h" #include "mg3500.h" -#include "mg3500a.h" #include "mg3frm.h" #include "../cg/cglib01.h" -// mg3500 Stampa +// mg3500 Stampa + +class TForm_storgiac : public TForm_stampemg +{ + TSorted_cursor * _sortcur; + bool _use_alternate_cursor; + +public: + void use_alternate_cursor(const bool b = TRUE) { _use_alternate_cursor = b; } + + virtual TCursor* cursor() const ; + virtual bool validate(TForm_item &cf, TToken_string &s); + + TForm_storgiac(const char *name,const char *code) ; + virtual ~TForm_storgiac(); +}; + +TCursor* TForm_storgiac::cursor() const +{ + if (_use_alternate_cursor) // Se e' settata la stampa per ragg. fisc ritorna il cursore appropriato + return (TCursor*)_sortcur; + return TForm_stampemg::cursor(); +} + +bool TForm_storgiac::validate(TForm_item &cf, TToken_string &s) +{ + const TString80 cmd = s.get(0); + if (cmd == "_FRACTION_MULT") + { + const TString16 id1 = s.get(); + const TString16 id2 = s.get(); + + const fraction f1 = cf.find_field(id1).get(); + const fraction f2 = cf.find_field(id2).get(); + const real m = f1 * f2; + cf.set(m.string()); + return TRUE; + } + return TForm_stampemg::validate(cf, s); +} TForm_storgiac::TForm_storgiac(const char *name,const char *code) : TForm_stampemg(name,code) @@ -20,16 +59,29 @@ TForm_storgiac::~TForm_storgiac() delete _sortcur; } -TCursor* TForm_storgiac::cursor() const -{ - if (_use_alternate_cursor) // Se e' settata la stampa per ragg. fisc ritorna il cursore appropriato - return (TCursor*)_sortcur; - return TForm_stampemg::cursor(); -} ///////////////////////////////////////////////////// // Applicazione ///////////////////////////////////////////////////// + +class TStampa_storgiac : public TSkeleton_application +{ + TArray * _files; + TStampemg_mask * _mask; + TCursor * _cur; + TForm_storgiac * _form; // to be moved into TPrint_application + +protected: + virtual bool create(); + virtual bool destroy(); + virtual void main_loop(); + virtual void set_def_valuta(TForm_storgiac & f) {} + +public: + TStampa_storgiac() {} + virtual ~TStampa_storgiac() {}; +}; + bool TStampa_storgiac::create() { _mask = new TStampemg_mask("mg3500"); diff --git a/mg/mg3500.frm b/mg/mg3500.frm index 788967bb4..2e6fc721d 100755 --- a/mg/mg3500.frm +++ b/mg/mg3500.frm @@ -42,10 +42,10 @@ BEGIN MESSAGE _TODAY END -NUMERO 3 7 +NUMERO 3 4 BEGIN KEY "Nr. pagina" - PROMPT 73 1 "Pag. " + PROMPT 72 1 "Pag. " MESSAGE _PAGENO END @@ -58,7 +58,7 @@ END STRINGA 5 80 BEGIN KEY "Separatore (iniziale)" - PROMPT 1 3 "------------------------------------------------------------------------------------------------------------------------------------------------------" + PROMPT 1 3 "______________________________________________________________________________________________________________________________________________________" END END @@ -299,7 +299,7 @@ SECTION FOOTER LAST 3 COLUMNWISE STRINGA 5 80 BEGIN KEY "Separatore (finale)" - PROMPT 1 1 "------------------------------------------------------------------------------------------------------------------------------------------------------" + PROMPT 1 1 "______________________________________________________________________________________________________________________________________________________" END STRINGA 1 58 diff --git a/mg/mg3500a.h b/mg/mg3500a.h deleted file mode 100755 index e742c9bdf..000000000 --- a/mg/mg3500a.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef __MG3500A_H -#define __MG3500A_H - -class TForm_storgiac : public TForm_stampemg -{ - TSorted_cursor * _sortcur; - bool _use_alternate_cursor; -public: - void use_alternate_cursor(const bool b = TRUE) { _use_alternate_cursor = b; } - virtual TCursor* cursor() const ; - TForm_storgiac(const char *name,const char *code) ; - virtual ~TForm_storgiac(); -}; - -class TStampa_storgiac : public TSkeleton_application -{ - TArray * _files; - TStampemg_mask * _mask; - TCursor * _cur; - TForm_storgiac * _form; // to be moved into TPrint_application - -protected: - virtual bool create(); - virtual bool destroy(); - virtual void main_loop(); - virtual void set_def_valuta(TForm_storgiac & f) {} - -public: - TStampa_storgiac() {} - virtual ~TStampa_storgiac() {}; -}; - -#endif //__MG3500A_H - diff --git a/mg/mglib02.cpp b/mg/mglib02.cpp index d80ca4808..f2ad05b49 100755 --- a/mg/mglib02.cpp +++ b/mg/mglib02.cpp @@ -117,20 +117,22 @@ void TArticolo::set_body_key(TRectype & rowrec) int TArticolo::read(TRectype & rec, word op, word lockop) { - const TString80 compstr(rec.get(ANAMAG_CODART)); + const TString& compstr = rec.get(ANAMAG_CODART); if (op == _isequal && lockop == _nolock && codice() == compstr) return NOERR; - - put(ANAMAG_CODART, compstr); - const int err = TMultiple_rectype::read(rec, op , lockop); - + int err = _iskeyerr; + if (!compstr.blank()) + { + put(ANAMAG_CODART, compstr); + err = TMultiple_rectype::read(rec, op , lockop); + } if (err != NOERR) zero(); return err; } int TArticolo::read(const char * cod, word op, word lockop) -{ +{ TRectype tmp(*this); tmp.put(ANAMAG_CODART,cod); return read( tmp, op, lockop); @@ -356,8 +358,8 @@ TArticolo::TArticolo(const char* codice) add_file(LF_DESLIN,"NRIGA"); if (codice && *codice) { - const int err=read(codice); - if (err!=NOERR) + const int err = read(codice); + if (err != NOERR) error_box("Impossibile leggere l'articolo %s: Errore %d",codice, err); } } @@ -1079,10 +1081,10 @@ void TArticolo_giacenza::add_storico(TRecord_array& nrstorico,const char * annoe { //CHECK(annorif && *annorif,"Add_storico: Indicare l'anno esercizio dello storico"); //TRecord_array & rstorico = storico(annorif); - TString annorif(nrstorico.key().get(STOMAG_ANNOESRIF)); + TString8 annorif(nrstorico.key().get(STOMAG_ANNOESRIF)); for (int i=nrstorico.last_row(); i>0; i--) { - TString mag=nrstorico[i].get(STOMAG_CODMAG); + TString16 mag=nrstorico[i].get(STOMAG_CODMAG); if (mag<=codmag) break; } @@ -1093,7 +1095,10 @@ void TArticolo_giacenza::add_storico(TRecord_array& nrstorico,const char * annoe storec.put(STOMAG_NRIGA,i+1); storec.put(STOMAG_CODMAG,codmag); storec.put(STOMAG_QUANT,qta); - storec.put(STOMAG_VALORE,prz); + + const int dec_price = storec.ndec(STOMAG_VALORE); + storec.put(STOMAG_VALORE, prz.string(0, dec_price)); + nrstorico.insert_row(storec); } @@ -1116,7 +1121,7 @@ void TArticolo_giacenza::agg_storicoLIFO(const char * annoes, const char * codma } TString nuovoanno; - TPrice prz; + real prz; real qta; TEsercizi_contabili ese; @@ -1132,11 +1137,9 @@ void TArticolo_giacenza::agg_storicoLIFO(const char * annoes, const char * codma if (giacenza > rim) { qta=giacenza-rim; - if (acq.is_zero()) - prz.set_num(ZERO); - else - prz.set_num(valacq/acq); - add_storico(nuovo_storico,annoes,codmag,qta,prz.get_num()); + if (!acq.is_zero()) + prz = valacq/acq; + add_storico(nuovo_storico,annoes,codmag,qta,prz); } else { @@ -1219,11 +1222,10 @@ void TArticolo_giacenza::agg_storicoFIFO(const char * annoes, const char * codma qta = min(giacenza, acq); if (!qta.is_zero()) { - TPrice prz; - + real prz; if (!acq.is_zero()) - prz.set_num(valacq/acq); - add_storico(nuovo_storico, annoes, codmag, qta, prz.get_num()); + prz = valacq/acq; + add_storico(nuovo_storico, annoes, codmag, qta, prz); } nuovo_storico.pack(); @@ -1237,8 +1239,6 @@ void TArticolo_giacenza::agg_storico(const char * annoes, const char * codmag, CHECK(strlen(codmag)<=3,"Non č pių possibile avere valorizzazione a livello di deposito"); CHECK(codmag && *codmag,"Necessario indicare il magazzino"); -// TPrice prz(val); - TPrice prz; real qta; TRecord_array & rmag = mag(annoes); @@ -1255,7 +1255,7 @@ void TArticolo_giacenza::agg_storico(const char * annoes, const char * codmag, TRecord_array& nuovo_storico = storico(nuovoanno); //nuovo_storico.destroy_rows(); - add_storico(nuovo_storico, annoes, codmag, qta, prz.get_num()); + add_storico(nuovo_storico, annoes, codmag, qta, ZERO); nuovo_storico.sort(sort_storico); nuovo_storico.write(); }