2004-05-18 13:07:58 +00:00
|
|
|
|
#include <diction.h>
|
1999-10-22 10:00:18 +00:00
|
|
|
|
#include "orlib.h"
|
|
|
|
|
#include "or1100a.h"
|
|
|
|
|
|
2003-06-27 14:55:37 +00:00
|
|
|
|
#include "../cg/cglib01.h"
|
|
|
|
|
#include "../ve/velib.h"
|
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
// Prima colonna quantita' nel form per stampa disponibilita'
|
|
|
|
|
#define COL1 4
|
|
|
|
|
|
|
|
|
|
TOrdine_form::TOrdine_form(const char* name) : TForm(name)
|
|
|
|
|
{
|
|
|
|
|
_art_giac = new TArticolo_giacenza;
|
|
|
|
|
_codgiac = new TCodgiac_livelli;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TOrdine_form::~TOrdine_form()
|
|
|
|
|
{
|
|
|
|
|
delete _codgiac;
|
|
|
|
|
delete _art_giac;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const int TOrdine_form::find_period(const TDate& dc)
|
|
|
|
|
{
|
2006-12-12 13:53:57 +00:00
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
CHECK(_date_array, "Invalid date array in TOrdine_form");
|
2006-12-12 13:53:57 +00:00
|
|
|
|
|
|
|
|
|
if (dc <= (TDate&)*_date_array->objptr(0))
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
const int last = _date_array->last();
|
|
|
|
|
|
|
|
|
|
for (int i = last; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
TDate& dt = (TDate&)*_date_array->objptr(i);
|
2006-12-13 18:07:52 +00:00
|
|
|
|
if (dc > dt && i < last)
|
2006-12-12 13:53:57 +00:00
|
|
|
|
return i + 1;
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TOrdine_form::genera_intestazione_supplementare(pagetype p, short y)
|
|
|
|
|
{
|
|
|
|
|
CHECK(_date_array, "L'array delle date non e' impostato.");
|
|
|
|
|
TPrint_section* body = exist('B', p);
|
|
|
|
|
if (body == NULL || !body->columnwise())
|
2009-11-19 11:53:45 +00:00
|
|
|
|
return false;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
|
|
|
|
TPrint_section* header = exist('H', p);
|
|
|
|
|
if (header == NULL)
|
2009-11-19 11:53:45 +00:00
|
|
|
|
return false;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
|
|
|
|
const int items = _date_array->items();//body->fields();
|
|
|
|
|
TForm_string* s;
|
|
|
|
|
TString des;
|
|
|
|
|
for (int j=0;j<items;j++)
|
|
|
|
|
{
|
|
|
|
|
TForm_item& fi = body->find_field(COL1+j*2);
|
|
|
|
|
des = "Situaz. al ";
|
|
|
|
|
des << ((TDate*)_date_array->objptr(j))->string();
|
|
|
|
|
des.center_just(fi.width()*2);
|
|
|
|
|
s = new TForm_string(header);
|
|
|
|
|
s->id() = -1;
|
|
|
|
|
s->set_x(fi.x());
|
|
|
|
|
s->y() = y;
|
|
|
|
|
s->set_prompt(des);
|
2009-11-19 11:53:45 +00:00
|
|
|
|
s->temp() = true;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
header->add_field(s);
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-19 11:53:45 +00:00
|
|
|
|
return true;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TOrdine_form::validate(TForm_item &cf, TToken_string &s)
|
|
|
|
|
{
|
2002-12-20 16:15:03 +00:00
|
|
|
|
if (strcmp(s.get(0), "_ORDINE") == 0)
|
1999-10-22 10:00:18 +00:00
|
|
|
|
{
|
2002-12-20 16:15:03 +00:00
|
|
|
|
TDocumento& doc = (TDocumento&)cf.form().cursor()->curr(LF_DOC);
|
|
|
|
|
TRiga_documento& rdoc = (TRiga_documento&)cf.form().cursor()->curr(LF_RIGHEDOC);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
// Add custom messages here
|
|
|
|
|
// All the following messages takes 1 parameter: the field number to set
|
|
|
|
|
TString action(s.get(1));
|
|
|
|
|
|
|
|
|
|
if (action == "DESCRIZIONE")
|
|
|
|
|
{
|
|
|
|
|
// Scrive: Cod articolo/cod livello1/cod livello2/.../denominazione ultimo livello codifica /cod mag /cod dep
|
|
|
|
|
// Nel caso di stampa disponibilita' articoli stampa un pezzo della descrizione
|
|
|
|
|
// vera e proprio dell'articolo.
|
|
|
|
|
TString codart,livello, coddep, codmag;
|
|
|
|
|
codart = rdoc.get(RDOC_CODART);
|
|
|
|
|
if (_art_giac->read(rdoc.get(RDOC_CODART)) == NOERR)
|
|
|
|
|
{
|
|
|
|
|
if (_normale)
|
|
|
|
|
codart << " " << _art_giac->get(ANAMAG_DESCR);
|
|
|
|
|
else
|
|
|
|
|
codart = _art_giac->get(ANAMAG_DESCR);
|
|
|
|
|
|
|
|
|
|
if (codart.len() > 40)
|
|
|
|
|
codart.cut(40);
|
|
|
|
|
}
|
|
|
|
|
if (_level > 0)
|
|
|
|
|
livello = rdoc.get(RDOC_LIVELLO);
|
|
|
|
|
if (livello.not_empty())
|
|
|
|
|
{
|
|
|
|
|
for (int lev=1; lev <= _level; lev++)
|
|
|
|
|
{
|
|
|
|
|
if (!_codgiac->enabled(lev))
|
|
|
|
|
continue;
|
|
|
|
|
const int starts = _codgiac->code_start(lev) -1;
|
|
|
|
|
const int length = _codgiac->code_length(lev);
|
|
|
|
|
codart << "/";
|
|
|
|
|
codart << livello.mid(starts,length);
|
|
|
|
|
}
|
|
|
|
|
codart << " " << _codgiac->name(_level);
|
|
|
|
|
codart << " " << _codgiac->group_descr(livello,_level);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
codmag = rdoc.get(RDOC_CODMAG).left(3);
|
|
|
|
|
coddep = rdoc.get(RDOC_CODMAG).right(2);
|
|
|
|
|
if (_detail_mag && codmag.not_empty())
|
2004-05-18 13:07:58 +00:00
|
|
|
|
codart << TR(" Mag. ") << codmag;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
if (_detail_dep && coddep.not_empty())
|
2004-05-18 13:07:58 +00:00
|
|
|
|
codart << TR(" Dep. ") << coddep;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
|
|
|
|
cf.set(codart);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (action == "SELECTUM")
|
|
|
|
|
{
|
2003-06-10 08:26:39 +00:00
|
|
|
|
const TString8 um(rdoc.get(RDOC_UMQTA));
|
|
|
|
|
const TString8 cur_um(cf.find_field("407").get());
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
|
|
|
|
if (cur_um.empty()) // Se l'unita' di misura non e' ancora stata settata prende quella principale
|
|
|
|
|
cf.set(um);
|
|
|
|
|
else
|
|
|
|
|
if (cur_um != um) // Se c'e' ma e' diversa dalla prec. allora setta l'unita' di misura su quella principale
|
|
|
|
|
if (_art_giac->read(rdoc.get(RDOC_CODART)) == NOERR)
|
|
|
|
|
{
|
|
|
|
|
TForm_item& qo = cf.find_field("408");
|
|
|
|
|
TForm_item& qe = cf.find_field("409");
|
|
|
|
|
TForm_item& qr = cf.find_field("411");
|
|
|
|
|
real qtaor(qo.get());
|
|
|
|
|
real qtaev(qe.get());
|
|
|
|
|
real qtare(qr.get());
|
|
|
|
|
|
2003-06-10 08:26:39 +00:00
|
|
|
|
// Converte i totali q.ta evasa e ordinata nella unita' di misura principale
|
2009-11-19 11:53:45 +00:00
|
|
|
|
qtaor = _art_giac->convert_to_um(qtaor, "", cur_um, true);
|
|
|
|
|
qtaev = _art_giac->convert_to_um(qtaev, "", cur_um, true);
|
|
|
|
|
qtare = _art_giac->convert_to_um(qtare, "", cur_um, true);
|
2003-06-10 08:26:39 +00:00
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
qo.set(qtaor.string());
|
|
|
|
|
qe.set(qtaev.string());
|
|
|
|
|
qr.set(qtare.string());
|
|
|
|
|
|
|
|
|
|
cf.set(_art_giac->um().row(1).get("UM")); // UM principale
|
|
|
|
|
}
|
|
|
|
|
// TBI:
|
|
|
|
|
// Riga merce non a magazzino o non e' possibile reperire l'UM principale per art.
|
|
|
|
|
// non posso interrompere la sezione di stampa da qui, e neppure cambiare il raggruppamento...
|
|
|
|
|
// This seems to be a great dilemma... For now leave it as is: Somme dure e crude di quantita'
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (action == "CONVUM") // Converte cazzilli quantitativi nella unita' di misura corrente
|
|
|
|
|
{
|
2003-06-27 14:55:37 +00:00
|
|
|
|
const TString4 um = rdoc.get(RDOC_UMQTA);
|
|
|
|
|
const TString4 cur_um = cf.find_field("407").get();
|
1999-10-22 10:00:18 +00:00
|
|
|
|
|
|
|
|
|
if (cur_um != um)
|
2003-06-27 14:55:37 +00:00
|
|
|
|
if (_art_giac->read(rdoc.get(RDOC_CODART)) == NOERR) // Perche' non RDOC_CODARTMAG ???
|
1999-10-22 10:00:18 +00:00
|
|
|
|
{
|
|
|
|
|
real qt(cf.get());
|
2009-11-19 11:53:45 +00:00
|
|
|
|
qt = _art_giac->convert_to_um(qt, cur_um, um, true);
|
2003-06-27 14:55:37 +00:00
|
|
|
|
|
1999-10-22 10:00:18 +00:00
|
|
|
|
cf.set(qt.string());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (action == "VALTABLE") // Comandi per stampa riepilogo per valuta
|
|
|
|
|
{
|
|
|
|
|
TString subcommand(s.get(2));
|
|
|
|
|
if (subcommand == "RESET")
|
|
|
|
|
{
|
|
|
|
|
_totvaluta.destroy();
|
|
|
|
|
cf.find_field("TOTVAL1").disable();
|
|
|
|
|
cf.find_field("TOTVAL2").disable();
|
|
|
|
|
cf.find_field("TOTVAL3").disable();
|
|
|
|
|
cf.find_field("TOTVAL4").disable();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const int valute = _totvaluta.items();
|
|
|
|
|
TString codval(doc.get(DOC_CODVAL));
|
|
|
|
|
const bool is_key = _totvaluta.is_key(codval);
|
|
|
|
|
const bool is_new = !is_key && valute < 4;
|
|
|
|
|
|
|
|
|
|
if (is_new) // Aggiunge l'elemento se non c'e'
|
|
|
|
|
_totvaluta.add(codval,(_TTotale_valuta*)new _TTotale_valuta,is_key);
|
|
|
|
|
// Controlla/stampa al massimo 4 valute
|
|
|
|
|
if (is_key || is_new)
|
|
|
|
|
{
|
|
|
|
|
_TTotale_valuta& tv = (_TTotale_valuta&)_totvaluta[codval];
|
|
|
|
|
const bool is_valord = subcommand == "VALORD";
|
|
|
|
|
real& r = is_valord ? tv.totord() : tv.totres();
|
|
|
|
|
TString s_id;
|
|
|
|
|
int i_id;
|
|
|
|
|
|
|
|
|
|
// Abilita la sezione corrispondente e setta i valori all'interno
|
|
|
|
|
if (!is_key)
|
|
|
|
|
{
|
|
|
|
|
TString16 sec_name = "TOTVAL";
|
|
|
|
|
sec_name << valute+1;
|
|
|
|
|
tv.secnum() = valute+1;
|
|
|
|
|
cf.find_field(sec_name).enable();
|
|
|
|
|
// Setta anche il codice valuta
|
|
|
|
|
i_id = BODY_CODVAL + valute*10;
|
|
|
|
|
s_id.format("%d",i_id);
|
|
|
|
|
cf.find_field(s_id).set(codval);
|
|
|
|
|
if (valute == 0)
|
|
|
|
|
{
|
|
|
|
|
i_id--;
|
|
|
|
|
s_id.format("%d",i_id);
|
2002-12-20 16:15:03 +00:00
|
|
|
|
cf.find_field(s_id).set("@bTotali");
|
1999-10-22 10:00:18 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const int sn = tv.secnum();
|
|
|
|
|
i_id = is_valord ? BODY_TOTVALORD : BODY_TOTVALRES;
|
|
|
|
|
|
|
|
|
|
i_id += (sn-1)*10;
|
|
|
|
|
s_id.format("%d",i_id);
|
|
|
|
|
r += ((real) cf.get()); // Somma il valore corrente
|
|
|
|
|
cf.find_field(s_id).set(r.string());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (action == "CALCDISP") // messaggi per calcolo disponibilita'
|
|
|
|
|
{
|
|
|
|
|
TString command(s.get(2));
|
|
|
|
|
if (command == "RESET") // resetta la tabella
|
|
|
|
|
{
|
|
|
|
|
_totdisp.destroy();
|
|
|
|
|
const real rz = ZERO;
|
|
|
|
|
const int items = _date_array->items();
|
|
|
|
|
for (int i = 0; i<items; i++)
|
|
|
|
|
_totdisp.add(rz);
|
|
|
|
|
// Legge anche una volta per tutte il TArticolo_giacenza (uargh uargh)
|
|
|
|
|
if (_art_giac->read(rdoc.get(RDOC_CODART)) == NOERR)
|
|
|
|
|
{
|
|
|
|
|
_codmag = rdoc.get(RDOC_CODMAG);
|
|
|
|
|
_livello = rdoc.get(RDOC_LIVELLO);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
cf.set("Errore in lettura articolo");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (command == "CALC") // Effettua il calcolo per questa riga articolo,
|
|
|
|
|
//cumulando nell'array le quantita', espresse sempre in UM principale
|
|
|
|
|
{
|
|
|
|
|
const bool is_ordine_cliente = doc.get(DOC_TIPOCF)[0] == 'C';
|
|
|
|
|
const TString16 causmag(doc.get(DOC_CAUSMAG));
|
|
|
|
|
const TString16 um(rdoc.get(RDOC_UMQTA));
|
2006-12-12 13:53:57 +00:00
|
|
|
|
const TDate datacons(rdoc.get_date(RDOC_DATACONS));
|
1999-10-22 10:00:18 +00:00
|
|
|
|
int segno = is_ordine_cliente ? -1 : +1; // default
|
|
|
|
|
if (causmag.not_empty()) // se la causale esiste consulta il segno
|
|
|
|
|
{
|
|
|
|
|
TCausale_magazzino cm(causmag);
|
|
|
|
|
segno *= cm.sgn(is_ordine_cliente ? s_ordc : s_ordf);
|
|
|
|
|
}
|
|
|
|
|
// Reperisce fattore di conversione per UM principale,
|
|
|
|
|
// la quantita residua
|
2003-06-10 08:26:39 +00:00
|
|
|
|
real qtares = rdoc.qtaresidua(); // ZIO PERA! ag v<>l la riga dal document
|
2009-11-19 11:53:45 +00:00
|
|
|
|
qtares = _art_giac->convert_to_um(qtares, "", um, true);
|
1999-10-22 10:00:18 +00:00
|
|
|
|
qtares *= segno; // mette a posto il segno...
|
|
|
|
|
// Trova il periodo giusto
|
|
|
|
|
const int index = find_period(datacons);
|
2003-06-10 08:26:39 +00:00
|
|
|
|
if (index >= _totdisp.items())
|
|
|
|
|
_totdisp.add(ZERO, index); // Added by Guy! Should never happen :-)
|
1999-10-22 10:00:18 +00:00
|
|
|
|
real& rv = (real&) _totdisp[index];
|
|
|
|
|
rv += qtares;
|
2006-12-12 13:53:57 +00:00
|
|
|
|
|
|
|
|
|
const TDate datascimp(doc.get_date("DATASCIMP"));
|
|
|
|
|
|
|
|
|
|
if (datascimp.ok())
|
|
|
|
|
{
|
|
|
|
|
const int last_index = find_period(datascimp);
|
|
|
|
|
if (last_index >= 0)
|
|
|
|
|
{
|
|
|
|
|
real& rv = (real&) _totdisp[last_index];
|
|
|
|
|
rv -= qtares;
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-10-22 10:00:18 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (command == "PRNUM") // Stampa l'unita' di misura principale
|
|
|
|
|
{
|
2003-06-10 08:26:39 +00:00
|
|
|
|
const TRecord_array& um = _art_giac->um();
|
|
|
|
|
if (um.rows() > 0) // Controlla che ci sia almeno una unita' di misura
|
|
|
|
|
cf.set(um.row(1).get("UM")); // UM principale
|
|
|
|
|
else
|
|
|
|
|
cf.set("");
|
1999-10-22 10:00:18 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const int period = s.get_int(3);
|
|
|
|
|
//const int items = _date_array->items();
|
|
|
|
|
TString16 annoes;
|
|
|
|
|
real giacenza, scorta_min;
|
2003-06-27 14:55:37 +00:00
|
|
|
|
|
|
|
|
|
TEsercizi_contabili esc;
|
|
|
|
|
annoes << esc.date2esc(doc.get_date(DOC_DATADOC));
|
1999-10-22 10:00:18 +00:00
|
|
|
|
//TString16 codmag(rdoc.get(RDOC_CODMAG));
|
|
|
|
|
//TString16 livello(rdoc.get(RDOC_LIVELLO));
|
|
|
|
|
const int codmag_len = (_detail_dep || _detail_mag) ? _codmag.len() : 0;
|
|
|
|
|
const int livello_len = _level > 0 ? _livello.len() : 0;
|
|
|
|
|
//if (_art_giac->read(rdoc.get(RDOC_CODART)) == NOERR)
|
|
|
|
|
{
|
|
|
|
|
// Serve l'anno esercizio del magazzino...
|
|
|
|
|
|
|
|
|
|
// Ciclo sulle giacenze di magazzino
|
|
|
|
|
TRecord_array& mmgg = _art_giac->mag(annoes);
|
|
|
|
|
const int rows = mmgg.rows();
|
|
|
|
|
// Cumula raggruppando le giacenze per lo stesso mag/dep/liv.giac
|
|
|
|
|
// Scurre alla ruvescia
|
|
|
|
|
for (int i=mmgg.last_row();i>0;i--)
|
|
|
|
|
{
|
|
|
|
|
const TRectype& rec = mmgg.row(i); // gosh!?
|
|
|
|
|
|
|
|
|
|
//checkka se trattasi di medesimo liv giac/mag/dep in caso sia stato spec. il dettaglio
|
|
|
|
|
// altrimenti cumula el todo
|
|
|
|
|
if (codmag_len == 0 || (rec.get(MAG_CODMAG).compare(_codmag, codmag_len) == 0))
|
|
|
|
|
if (livello_len == 0 || (rec.get(MAG_LIVELLO).compare(_livello, livello_len) == 0))
|
|
|
|
|
{
|
|
|
|
|
giacenza += _art_giac->giacenza_corretta(rec, _giac_eff, _val_comp);
|
|
|
|
|
scorta_min = rec.get_real(MAG_SCORTAMIN);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i< period/*items*/; i++)
|
|
|
|
|
giacenza += (real&)_totdisp[i];
|
|
|
|
|
if (command == "PRNGIAC") // Stampa la giacenza prevista
|
|
|
|
|
{
|
|
|
|
|
cf.set(giacenza.string());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (command == "PRNSOTT") // Stampa il sottoscorta
|
|
|
|
|
{
|
|
|
|
|
if (giacenza < scorta_min)
|
|
|
|
|
{
|
|
|
|
|
giacenza = scorta_min - giacenza;
|
|
|
|
|
cf.set(giacenza.string());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
cf.set("");
|
|
|
|
|
}
|
|
|
|
|
// Ignore any other command
|
|
|
|
|
}
|
2003-01-13 12:04:10 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2002-12-20 16:15:03 +00:00
|
|
|
|
if (action == "PREZZONS")
|
|
|
|
|
{
|
2009-11-19 11:53:45 +00:00
|
|
|
|
real pns = rdoc.prezzo(true,false); // Prezzo netto scontato
|
2002-12-20 16:15:03 +00:00
|
|
|
|
cf.set(pns.string());
|
2003-01-13 12:04:10 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (action == "RAGSOC")
|
|
|
|
|
{
|
|
|
|
|
// Compone la ragione sociale (considera gli occasionali)
|
|
|
|
|
// Il formato <20> il seguente: CODICE (OCFPI) RAGIONE_SOCIALE
|
|
|
|
|
TString ws;
|
|
|
|
|
const bool print_cod = s.get_int(2) != 0;
|
|
|
|
|
TDocumento& documento = (TDocumento&)cf.form().cursor()->curr(LF_DOC);
|
|
|
|
|
TCli_for& cli_for = documento.clifor();
|
|
|
|
|
TOccasionale& cli_occ = documento.occas();
|
|
|
|
|
const bool occasionale = cli_for.occasionale();
|
|
|
|
|
if (print_cod)
|
|
|
|
|
ws << cli_for.get("CODCF") << " ";
|
|
|
|
|
if (occasionale)
|
|
|
|
|
{
|
|
|
|
|
ws << "(" << cli_occ.get("CFPI") << ") " ;
|
|
|
|
|
ws << cli_occ.get("RAGSOC");
|
1999-10-22 10:00:18 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2003-01-13 12:04:10 +00:00
|
|
|
|
ws << cli_for.get("RAGSOC");
|
|
|
|
|
cf.set(ws);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (action == "QTA")
|
|
|
|
|
{
|
|
|
|
|
cf.set(rdoc.quantita().string());
|
|
|
|
|
} else
|
|
|
|
|
if (action == "QTAEVASA")
|
|
|
|
|
{
|
|
|
|
|
cf.set(rdoc.qtaevasa().string());
|
|
|
|
|
} else
|
|
|
|
|
if (action == "RESIDUO")
|
|
|
|
|
{
|
|
|
|
|
cf.set(rdoc.qtaresidua().string());
|
|
|
|
|
} else
|
|
|
|
|
if (action == "VALORE")
|
|
|
|
|
{
|
2008-11-15 09:41:12 +00:00
|
|
|
|
cf.set(rdoc.valore(true, false,AUTO_DECIMALS).string());
|
2003-01-13 12:04:10 +00:00
|
|
|
|
} else
|
|
|
|
|
if (action == "VALRES")
|
|
|
|
|
{
|
2008-11-15 09:41:12 +00:00
|
|
|
|
cf.set(rdoc.valore(true, false, AUTO_DECIMALS).string());
|
2003-01-13 12:04:10 +00:00
|
|
|
|
} else
|
|
|
|
|
if (action == "GIACENZA")
|
|
|
|
|
{
|
|
|
|
|
real g = ZERO;
|
|
|
|
|
const TString& codart = rdoc.get(RDOC_CODARTMAG);
|
|
|
|
|
if (codart.not_empty() && _art_giac->read(codart) == NOERR)
|
|
|
|
|
{
|
2003-06-27 14:55:37 +00:00
|
|
|
|
TEsercizi_contabili esc;
|
2003-01-13 12:04:10 +00:00
|
|
|
|
const TDate oggi(TODAY);
|
2003-06-27 14:55:37 +00:00
|
|
|
|
TString16 annoes; annoes.format("%04d", esc.date2esc(oggi));
|
2003-01-13 12:04:10 +00:00
|
|
|
|
const TString16 codmag(rdoc.get("CODMAG")); // Riferito al magazzino indicato sulla riga...
|
|
|
|
|
const TString16 livello(_level > 0 ? rdoc.get(RDOC_LIVELLO) : "");
|
2009-11-19 11:53:45 +00:00
|
|
|
|
g = _art_giac->disponibilita(annoes, codmag, livello, true); // Giacenza attuale
|
2002-12-20 16:15:03 +00:00
|
|
|
|
}
|
2003-01-13 12:04:10 +00:00
|
|
|
|
cf.set(g.string());
|
|
|
|
|
}
|
1999-10-22 10:00:18 +00:00
|
|
|
|
//Ignore any other command
|
2009-11-19 11:53:45 +00:00
|
|
|
|
return true;
|
1999-10-22 10:00:18 +00:00
|
|
|
|
}
|
|
|
|
|
return TForm::validate(cf, s);
|
2003-01-13 12:04:10 +00:00
|
|
|
|
}
|