Migliorata stampa codici articolo contenenti spazi :-(
git-svn-id: svn://10.65.10.50/branches/R_10_00@22744 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
a6ab3a2677
commit
780e9ec6aa
@ -301,14 +301,14 @@ bool TForm_schedemag::validate(TForm_item &cf, TToken_string &s)
|
|||||||
|
|
||||||
TString region;
|
TString region;
|
||||||
region << MAG_ANNOES << '=' << _anno_prec;
|
region << MAG_ANNOES << '=' << _anno_prec;
|
||||||
region << ' ' << MAG_CODART << '=' << codart;
|
region << ' ' << MAG_CODART << "=\"" << codart << "\"";
|
||||||
|
|
||||||
TString query;
|
TString query;
|
||||||
query << "USE " << LF_MAG;
|
query << "USE " << LF_MAG;
|
||||||
query << "\nFROM " << region;
|
query << "\nFROM " << region;
|
||||||
query << "\nTO " << region;
|
query << "\nTO " << region;
|
||||||
if (_tolivart <= 0 || _tolivart >= livelli_articolo().last_level())
|
if (_tolivart <= 0 || _tolivart >= livelli_articolo().last_level())
|
||||||
query << '~';
|
query.insert("~", query.len()-1);
|
||||||
|
|
||||||
TISAM_recordset magprec(query);
|
TISAM_recordset magprec(query);
|
||||||
real currsaldo = cf.get();
|
real currsaldo = cf.get();
|
||||||
|
@ -508,6 +508,7 @@ TIsamtempfile* TStampa_inventario::calcola_giacenze(const bool giaceff, const bo
|
|||||||
//Scorre l'anagrafica di magazzino e calcola per ognuno la giacenza alla data indicata
|
//Scorre l'anagrafica di magazzino e calcola per ognuno la giacenza alla data indicata
|
||||||
//Memorizzando i records in un file temporaneo che avrà lo stesso tracciato di LF_MAG
|
//Memorizzando i records in un file temporaneo che avrà lo stesso tracciato di LF_MAG
|
||||||
TIsamtempfile* temp_mag = new TIsamtempfile(LF_MAG, "tmpmag");
|
TIsamtempfile* temp_mag = new TIsamtempfile(LF_MAG, "tmpmag");
|
||||||
|
|
||||||
TRectype darec(LF_ANAMAG), arec(LF_ANAMAG);
|
TRectype darec(LF_ANAMAG), arec(LF_ANAMAG);
|
||||||
TMask& m = mask();
|
TMask& m = mask();
|
||||||
|
|
||||||
@ -547,9 +548,6 @@ TIsamtempfile* TStampa_inventario::calcola_giacenze(const bool giaceff, const bo
|
|||||||
const TRecnotype items = ana_cur.items();
|
const TRecnotype items = ana_cur.items();
|
||||||
|
|
||||||
ana_cur.freeze();
|
ana_cur.freeze();
|
||||||
ana_rel.lfile().set_curr(new TArticolo_giacenza_data);
|
|
||||||
|
|
||||||
TArticolo_giacenza_data& art_giac = (TArticolo_giacenza_data&)ana_cur.curr();
|
|
||||||
const TEsercizi_contabili esc;
|
const TEsercizi_contabili esc;
|
||||||
const int anno = esc.date2esc(al);
|
const int anno = esc.date2esc(al);
|
||||||
TString4 annoes; annoes.format("%04d", anno);
|
TString4 annoes; annoes.format("%04d", anno);
|
||||||
@ -563,6 +561,8 @@ TIsamtempfile* TStampa_inventario::calcola_giacenze(const bool giaceff, const bo
|
|||||||
{
|
{
|
||||||
if (!pi.addstatus(1))
|
if (!pi.addstatus(1))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
TArticolo_giacenza_data art_giac(ana_cur.curr());
|
||||||
art_giac.al(al); // Calcola la giacenza alla data per questo articolo
|
art_giac.al(al); // Calcola la giacenza alla data per questo articolo
|
||||||
|
|
||||||
// Scrive i records sul file temporaneo
|
// Scrive i records sul file temporaneo
|
||||||
@ -570,7 +570,6 @@ TIsamtempfile* TStampa_inventario::calcola_giacenze(const bool giaceff, const bo
|
|||||||
for (int i = mag.last_row(); temp_mag->good() && i > 0; i = mag.pred_row(i))
|
for (int i = mag.last_row(); temp_mag->good() && i > 0; i = mag.pred_row(i))
|
||||||
{
|
{
|
||||||
TRectype& magrec = (TRectype&)mag.row(i);
|
TRectype& magrec = (TRectype&)mag.row(i);
|
||||||
|
|
||||||
if (giaceff)
|
if (giaceff)
|
||||||
{
|
{
|
||||||
const real v = art_giac.giacenza_corretta(magrec, true, valcomp);
|
const real v = art_giac.giacenza_corretta(magrec, true, valcomp);
|
||||||
@ -581,15 +580,13 @@ TIsamtempfile* TStampa_inventario::calcola_giacenze(const bool giaceff, const bo
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Se il file è ok lo sostituisce all'interno della relazione del form
|
// Se il file è ok lo sostituisce all'interno della relazione del form
|
||||||
|
|
||||||
if (temp_mag->good())
|
if (temp_mag->good())
|
||||||
return temp_mag;
|
return temp_mag;
|
||||||
{
|
|
||||||
error_box(FR("Errore %d in creazione file temporaneo per saldi di magazzino alla data indicata."), temp_mag->status());
|
error_box(FR("Errore %d in creazione file temporaneo per saldi di magazzino alla data indicata."), temp_mag->status());
|
||||||
delete temp_mag;
|
delete temp_mag;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void TStampa_inventario::setprint_permagazzini(const char subordine, const bool alladata, const bool giaceff, bool valcomp, const TDate & al)
|
void TStampa_inventario::setprint_permagazzini(const char subordine, const bool alladata, const bool giaceff, bool valcomp, const TDate & al)
|
||||||
{
|
{
|
||||||
|
@ -1598,24 +1598,30 @@ void TArticolo_giacenza_data::al(const TDate& data, const char* codmag, const ch
|
|||||||
TString80 str; str << TR("Calcolo giacenza articolo ") << codice();
|
TString80 str; str << TR("Calcolo giacenza articolo ") << codice();
|
||||||
pi = new TProgind(items, str, false, true);
|
pi = new TProgind(items, str, false, true);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
TMov_mag* p_movmag = new TMov_mag;
|
TMov_mag* p_movmag = new TMov_mag;
|
||||||
rel.lfile(LF_MOVMAG).set_curr(p_movmag);
|
rel.lfile(LF_MOVMAG).set_curr(p_movmag);
|
||||||
TMov_mag& movmag = *p_movmag;
|
TMov_mag& movmag = *p_movmag;
|
||||||
|
*/
|
||||||
const TRectype& rmovmag = rel.curr();
|
const TRectype& rmovmag = rel.curr();
|
||||||
TRecord_array& rmag = mag(anno);
|
TRecord_array& rmag = mag(anno);
|
||||||
|
|
||||||
for (cur = 0; cur.pos() < items; ++cur)
|
for (cur = 0; cur.pos() < items; ++cur)
|
||||||
{
|
{
|
||||||
if (pi) pi->addstatus(1);
|
if (pi && !pi->addstatus(1))
|
||||||
const TDate datacomp = movmag.get_date(MOVMAG_DATACOMP);
|
break;
|
||||||
|
const TDate datacomp = rel.curr(LF_MOVMAG).get_date(MOVMAG_DATACOMP);
|
||||||
const TString& codart = rmovmag.get(RMOVMAG_CODART);
|
const TString& codart = rmovmag.get(RMOVMAG_CODART);
|
||||||
if (codart == codice() && datacomp >= inizio && datacomp <= data)
|
if (codart == codice() && datacomp >= inizio && datacomp <= data)
|
||||||
{
|
{
|
||||||
const TString16 codmag = rmovmag.get(RMOVMAG_CODMAG);
|
const TString16 codmag = rmovmag.get(RMOVMAG_CODMAG);
|
||||||
const TString16 livello = rmovmag.get(RMOVMAG_LIVGIAC);
|
const TString16 livello = rmovmag.get(RMOVMAG_LIVGIAC);
|
||||||
|
const long nreg = rmovmag.get_int(RMOVMAG_NUMREG);
|
||||||
const int nrig = rmovmag.get_int(RMOVMAG_NRIG);
|
const int nrig = rmovmag.get_int(RMOVMAG_NRIG);
|
||||||
const int i = find_mag(anno, codmag, livello);
|
const int i = find_mag(anno, codmag, livello);
|
||||||
|
|
||||||
|
TMov_mag movmag(nreg);
|
||||||
|
|
||||||
if (i >= 0) // Se il record di giacenza esiste lo aggiorno ...
|
if (i >= 0) // Se il record di giacenza esiste lo aggiorno ...
|
||||||
{
|
{
|
||||||
TRectype& rec = (TRectype&)rmag.row(i);
|
TRectype& rec = (TRectype&)rmag.row(i);
|
||||||
|
@ -5,19 +5,12 @@
|
|||||||
#include <diction.h>
|
#include <diction.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <recset.h>
|
#include <recset.h>
|
||||||
#include <utility.h>
|
|
||||||
|
|
||||||
#include "clifogiac.h"
|
#include "clifogiac.h"
|
||||||
#include "mglib.h"
|
|
||||||
#include "movmag.h"
|
|
||||||
#include <cfven.h>
|
#include <cfven.h>
|
||||||
|
|
||||||
#ifndef __CGLIB01_H
|
|
||||||
#include "../cg/cglib01.h"
|
#include "../cg/cglib01.h"
|
||||||
#endif
|
|
||||||
#ifndef __DBLIB_H
|
|
||||||
#include "../db/dblib.h"
|
#include "../db/dblib.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
class TSaldo_mag : public TObject
|
class TSaldo_mag : public TObject
|
||||||
{
|
{
|
||||||
@ -133,7 +126,7 @@ public:
|
|||||||
|
|
||||||
virtual TObject* dup() const { return new TSaldo_mag_clifo(*this); }
|
virtual TObject* dup() const { return new TSaldo_mag_clifo(*this); }
|
||||||
|
|
||||||
bool is_deletable() const { return _quant == ZERO && _valore == ZERO; }
|
bool is_deletable() const { return _quant.is_zero() && _valore.is_zero(); }
|
||||||
static TToken_string & key(const TRectype & head, const TRectype & row);
|
static TToken_string & key(const TRectype & head, const TRectype & row);
|
||||||
void add_quant(const real & q, bool plus = true) { _quant = _quant + (plus ? q : -q); }
|
void add_quant(const real & q, bool plus = true) { _quant = _quant + (plus ? q : -q); }
|
||||||
void add_valore(const real & v, bool plus = true) { _valore = _valore + (plus ? v : -v); }
|
void add_valore(const real & v, bool plus = true) { _valore = _valore + (plus ? v : -v); }
|
||||||
@ -181,8 +174,10 @@ TToken_string & TSaldo_mag_clifo::key(const TRectype & head, const TRectype & ro
|
|||||||
key.add(head.get_int(MOVMAG_CODINDSP));
|
key.add(head.get_int(MOVMAG_CODINDSP));
|
||||||
key.add(row.get(RMOVMAG_CODART));
|
key.add(row.get(RMOVMAG_CODART));
|
||||||
key.add(row.get(RMOVMAG_LIVGIAC));
|
key.add(row.get(RMOVMAG_LIVGIAC));
|
||||||
|
|
||||||
const TString& c = row.get(RMOVMAG_CODCAUS);
|
const TString& c = row.get(RMOVMAG_CODCAUS);
|
||||||
key.add(c.full() ? c : head.get(MOVMAG_CODCAUS));
|
key.add(c.full() ? c : head.get(MOVMAG_CODCAUS));
|
||||||
|
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,32 +204,31 @@ TSaldo_mag_clifo::TSaldo_mag_clifo(const TSaldo_mag_clifo & s)
|
|||||||
// ********************************
|
// ********************************
|
||||||
// TMov_mag
|
// TMov_mag
|
||||||
|
|
||||||
TMov_mag::TMov_mag() :
|
TMov_mag::TMov_mag() : TMultiple_rectype(LF_MOVMAG)
|
||||||
TMultiple_rectype(LF_MOVMAG)
|
{ add_file(LF_RMOVMAG,"NRIG"); }
|
||||||
{
|
|
||||||
add_file(LF_RMOVMAG,"NRIG");
|
|
||||||
}
|
|
||||||
|
|
||||||
TMov_mag::TMov_mag(long numreg) :
|
TMov_mag::TMov_mag(long numreg) : TMultiple_rectype(LF_MOVMAG)
|
||||||
TMultiple_rectype(LF_MOVMAG)
|
|
||||||
{
|
{
|
||||||
add_file(LF_RMOVMAG,"NRIG");
|
add_file(LF_RMOVMAG,"NRIG");
|
||||||
|
if (numreg > 0)
|
||||||
|
{
|
||||||
TLocalisamfile movmag(LF_MOVMAG);
|
TLocalisamfile movmag(LF_MOVMAG);
|
||||||
put(MOVMAG_NUMREG, numreg);
|
put(MOVMAG_NUMREG, numreg);
|
||||||
read(movmag);
|
read(movmag);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TMov_mag::~TMov_mag()
|
TMov_mag::~TMov_mag()
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
TCausale_magazzino& TMov_mag::causale(int row) const
|
TCausale_magazzino& TMov_mag::causale(int row) const
|
||||||
{
|
{
|
||||||
const TRectype& rowrec = body()[row];
|
const TRectype& rowrec = body()[row];
|
||||||
TString8 cod(rowrec.get(RMOVMAG_CODCAUS));
|
|
||||||
|
|
||||||
|
TString8 cod = rowrec.get(RMOVMAG_CODCAUS);
|
||||||
if (cod.blank())
|
if (cod.blank())
|
||||||
cod = get(MOVMAG_CODCAUS);
|
cod = get(MOVMAG_CODCAUS);
|
||||||
|
|
||||||
return cached_causale_magazzino(cod);
|
return cached_causale_magazzino(cod);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -850,7 +844,7 @@ void TMov_mag::update_balances(TRectype& magrec, int numrig, bool plus)
|
|||||||
|
|
||||||
quant = art.convert_to_um(quant, NULL, rec.get(RMOVMAG_UM));
|
quant = art.convert_to_um(quant, NULL, rec.get(RMOVMAG_UM));
|
||||||
|
|
||||||
real valore = (quant.is_zero() && caus.update_val()) ? rec.get_real(RMOVMAG_PREZZO) : rec.get_real(RMOVMAG_PREZZO) * quant;
|
const real valore = (quant.is_zero() && caus.update_val()) ? rec.get_real(RMOVMAG_PREZZO) : rec.get_real(RMOVMAG_PREZZO) * quant;
|
||||||
|
|
||||||
saldo.add(quant, valore, plus);
|
saldo.add(quant, valore, plus);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user