Corretta gestione giacenza
git-svn-id: svn://10.65.10.50/branches/R_10_00@22923 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
b8d35eb40b
commit
27c4d273e8
@ -134,7 +134,7 @@ BEGIN
|
||||
ITEM "Dot.\nOd.@5"
|
||||
ITEM "Cons.\nmese@5"
|
||||
ITEM "Cons.\nanno@5"
|
||||
ITEM "Tipo\nForfait@25"
|
||||
ITEM "Tipo\nForfait@22"
|
||||
ITEM "Prezzo\nRinnovo@8"
|
||||
ITEM "Sconto %@5"
|
||||
ITEM "Dot.\nTemp.@5"
|
||||
@ -196,7 +196,7 @@ BEGIN
|
||||
ITEM "1|Conguaglio alla confezione"
|
||||
END
|
||||
|
||||
LISTBOX F_TIPOFORF 1 25
|
||||
LISTBOX F_TIPOFORF 1 20
|
||||
BEGIN
|
||||
PROMPT 1 -7 "Forfait "
|
||||
ITEM "0|Nessuno"
|
||||
@ -209,7 +209,7 @@ BEGIN
|
||||
MESSAGE SHOW,F_NOLCIC|SHOW,F_IMPFISART|DISABLE,F_IMPFISART|DISABLE,3@|SHOW,F_MINCIC|HIDE,F_PREZNOL
|
||||
ITEM "4|% sul val. convenz."
|
||||
MESSAGE SHOW,F_NOLCIC|SHOW,F_IMPFISART|DISABLE,F_IMPFISART|ENABLE,3@|HIDE,F_MINCIC|HIDE,F_PREZNOL
|
||||
ITEM "5|Fisso su dot. iniziale"
|
||||
ITEM "5|Fisso su dot. iniz."
|
||||
MESSAGE HIDE,1@|SHOW,F_IMPFISART|ENABLE,F_IMPFISART|DISABLE,3@|HIDE,F_MINCIC|HIDE,F_PREZNOL
|
||||
END
|
||||
|
||||
@ -746,7 +746,7 @@ BEGIN
|
||||
PROMPT 1 6 "@bForfait/Prezzi"
|
||||
END
|
||||
|
||||
LISTBOX S_TIPOFORF 1 25
|
||||
LISTBOX S_TIPOFORF 1 20
|
||||
BEGIN
|
||||
PROMPT 2 7 "Tipo "
|
||||
ITEM "0|Nessuno"
|
||||
@ -759,7 +759,7 @@ BEGIN
|
||||
MESSAGE ENABLE,S_NOLCIC|DISABLE,S_VCARTCLI|DISABLE,S_IMPFISART|DISABLE,3@|ENABLE,S_MINCIC|ENABLE,2@|DISABLE,S_PREZNOL
|
||||
ITEM "4|% sul val. convenz."
|
||||
MESSAGE ENABLE,S_NOLCIC|ENABLE,S_VCARTCLI|DISABLE,S_IMPFISART|ENABLE,3@|DISABLE,S_MINCIC|DISABLE,2@|DISABLE,S_PREZNOL
|
||||
ITEM "5|Fisso su dot. iniziale"
|
||||
ITEM "5|Fisso su dot. iniz."
|
||||
MESSAGE DISABLE,1@|ENABLE,S_IMPFISART|DISABLE,3@|DISABLE,S_MINCIC|DISABLE,2@|DISABLE,S_PREZNOL
|
||||
FIELD TIPOFORF
|
||||
END
|
||||
|
195
lv/lv2600.cpp
195
lv/lv2600.cpp
@ -15,7 +15,7 @@
|
||||
#include "lvcondv.h"
|
||||
#include "lvrcondv.h"
|
||||
#include "lvrconsplan.h"
|
||||
#include "lv2600a.h"
|
||||
#include "lv2600a.h"
|
||||
|
||||
/////////////////////////////
|
||||
//// TARTICOLI_KEY ////
|
||||
@ -28,9 +28,10 @@ public:
|
||||
const long codcf();
|
||||
const char* codart();
|
||||
const TDate data();
|
||||
|
||||
TArticoli_key(long codcf, TString& codart, TDate& data);
|
||||
TArticoli_key(const char* key);
|
||||
TArticoli_key& operator=(const char* key) { set(key); return *this; }
|
||||
TArticoli_key(long codcf, const TString& codart, const TDate& data);
|
||||
TArticoli_key(const TArticoli_key& key) : TToken_string(key) {}
|
||||
TArticoli_key(const char* key) : TToken_string(key) {}
|
||||
};
|
||||
|
||||
//CODCF: metodo che restituisce il codcf dalla TToken_string chiave degli articoli
|
||||
@ -52,15 +53,12 @@ const TDate TArticoli_key::data()
|
||||
}
|
||||
|
||||
//metodi costruttori
|
||||
TArticoli_key::TArticoli_key(long codcf, TString& codart, TDate& data)
|
||||
TArticoli_key::TArticoli_key(long codcf, const TString& codart, const TDate& data)
|
||||
{
|
||||
add(codcf);
|
||||
add(codart.trim());
|
||||
add(codart);
|
||||
add(data.date2ansi());
|
||||
}
|
||||
|
||||
TArticoli_key::TArticoli_key(const char* key):TToken_string(key)
|
||||
{
|
||||
strip(" ");
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
@ -68,7 +66,7 @@ TArticoli_key::TArticoli_key(const char* key):TToken_string(key)
|
||||
//////////////////////////////
|
||||
|
||||
//classe TDocumenti_key
|
||||
class TDocumenti_key: public TToken_string
|
||||
class TDocumenti_key : public TToken_string
|
||||
{
|
||||
public:
|
||||
const char* codnum();
|
||||
@ -79,7 +77,7 @@ public:
|
||||
const char* codart();
|
||||
const TDate data();
|
||||
|
||||
TDocumenti_key(int anno, long ndoc, int idriga, long codcf, TString& codart, TDate& data);
|
||||
TDocumenti_key(int anno, long ndoc, int idriga, long codcf, const TString& codart, const TDate& data);
|
||||
TDocumenti_key(const char* key);
|
||||
};
|
||||
|
||||
@ -98,7 +96,7 @@ const int TDocumenti_key::anno()
|
||||
//NDOC: metodo che restituisce il numero documento dalla TToken_string chiave dei documenti
|
||||
const long TDocumenti_key::ndoc()
|
||||
{
|
||||
return get_int(2);
|
||||
return get_long(2);
|
||||
}
|
||||
|
||||
//IDRIGA: metodo che restituisce l'idriga dalla TToken_string chiave dei documenti
|
||||
@ -126,15 +124,16 @@ const TDate TDocumenti_key::data()
|
||||
}
|
||||
|
||||
//metodi costruttori
|
||||
TDocumenti_key::TDocumenti_key(int anno, long ndoc, int idriga, long codcf, TString& codart, TDate& data)
|
||||
TDocumenti_key::TDocumenti_key(int anno, long ndoc, int idriga, long codcf, const TString& codart, const TDate& data)
|
||||
{
|
||||
add(ini_get_string(CONFIG_DITTA, "lv", "NUM_RIT(0)"));
|
||||
add(anno);
|
||||
add(ndoc);
|
||||
add(idriga);
|
||||
add(codcf);
|
||||
add(codart.trim());
|
||||
add(codart);
|
||||
add(data.date2ansi());
|
||||
strip(" ");
|
||||
}
|
||||
|
||||
TDocumenti_key::TDocumenti_key(const char* key):TToken_string(key)
|
||||
@ -224,12 +223,12 @@ TQuantita_contate::TQuantita_contate(real pezzi, real rotti)
|
||||
class TArticoli_contati: public TAssoc_array
|
||||
{
|
||||
public:
|
||||
TQuantita_contate* quantita(long codcf, TString& codart, TDate& data, bool create = false);
|
||||
TQuantita_contate* quantita(long codcf, const TString& codart, const TDate& data, bool create = false);
|
||||
};
|
||||
|
||||
//QUANTITA: metodo che cerca nel TAssoc_array le quantità contate in base ai parametri passati
|
||||
//e lo crea in automatico se il parametro create vale "true"
|
||||
TQuantita_contate* TArticoli_contati::quantita(long codcf, TString& codart, TDate& data, bool create)
|
||||
TQuantita_contate* TArticoli_contati::quantita(long codcf, const TString& codart, const TDate& data, bool create)
|
||||
{
|
||||
TArticoli_key key(codcf, codart, data);
|
||||
|
||||
@ -274,12 +273,12 @@ TAcquisizione_msk::TAcquisizione_msk():TAutomask("lv2600a")
|
||||
TSheet_field& sheet = sfield(F_SHEET_NAME);
|
||||
for (int i = 0; ; i++)
|
||||
{
|
||||
TString nomefile = configlv.get("FileName", NULL, i);
|
||||
if (nomefile.empty())
|
||||
const TString& nomefile = configlv.get("FileName", NULL, i);
|
||||
if (nomefile.blank())
|
||||
break;
|
||||
|
||||
TToken_string& row = sheet.row(-1);
|
||||
row.add(nomefile);
|
||||
row = nomefile;
|
||||
}
|
||||
|
||||
sheet.force_update();
|
||||
@ -308,22 +307,22 @@ public:
|
||||
void TAcquisizione_cache::discarding(const THash_object* obj)
|
||||
{
|
||||
TDocumento& doc = (TDocumento&)obj->obj();
|
||||
TToken_string orderkey;
|
||||
orderkey.add(RDOC_CODART);
|
||||
doc.sort_rows(orderkey);
|
||||
doc.sort_rows(RDOC_CODART);
|
||||
int err = doc.rewrite();
|
||||
if (err != NOERR)
|
||||
error_box(FR("Errore %d di scrittura del documento"), err);
|
||||
}
|
||||
|
||||
//KEY2OBJ: metodo che sceglie il documento giusto da disco in modo da poterlo continuare, o lo crea se non c'è
|
||||
TObject* TAcquisizione_cache::key2obj(const char* key)
|
||||
{
|
||||
TToken_string chiave(key);
|
||||
TDate datadoc = chiave.get();
|
||||
const TDate datadoc = chiave.get(0);
|
||||
const long codcf = chiave.get_long();
|
||||
const TDate datagen(TODAY);
|
||||
TDate dadata = datadoc;
|
||||
TDate adata = datagen;
|
||||
adata.addmonth();
|
||||
const long codcf = chiave.get_long();
|
||||
adata.addmonth(1);
|
||||
|
||||
if(_ndoc == 0)
|
||||
{
|
||||
@ -332,7 +331,7 @@ TObject* TAcquisizione_cache::key2obj(const char* key)
|
||||
<< "FROM PROVV=\"D\" ANNO=" << datadoc.year() << " CODNUM=\"" << _codnum << "\"\n"
|
||||
<< "TO PROVV=\"D\" ANNO=" << datadoc.year() << " CODNUM=\"" << _codnum << "\"";
|
||||
TISAM_recordset sporco(query2);
|
||||
if(sporco.move_last())
|
||||
if (sporco.move_last())
|
||||
_ndoc = sporco.get(DOC_NDOC).as_int();
|
||||
}
|
||||
|
||||
@ -631,9 +630,10 @@ bool TAcquisizione_lavanderie_app::create()
|
||||
if (_gr == "S" || _gr.empty())
|
||||
_msk->set(F_RICGIRI, "X");
|
||||
else
|
||||
_msk->set(F_RICGIRI, "");
|
||||
_msk->reset(F_RICGIRI);
|
||||
|
||||
open_files(LF_DOC, LF_RIGHEDOC);
|
||||
open_files(LF_DOC, LF_RIGHEDOC, LF_CLIFO, LF_CFVEN, LF_SCONTI,
|
||||
LF_TAB, LF_TABCOM, LF_ANAMAG, LF_UMART, 0);
|
||||
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
@ -648,13 +648,15 @@ bool TAcquisizione_lavanderie_app::destroy()
|
||||
//ELABORA_FILE: metodo che effettivamente fa l'elaborazione del file
|
||||
bool TAcquisizione_lavanderie_app::elabora_file(const TString& file, TLog_report& rep, TArticoli_contati& articoli, int& nrighe, int& nrsalt)
|
||||
{
|
||||
//scandisco il file solo se esiste
|
||||
TFilename strname = file;
|
||||
//fisso l'anno esercizio
|
||||
TEsercizi_contabili& esc = esercizi();
|
||||
const int last_esc = esc.last();
|
||||
|
||||
//scandisco il file solo se esiste
|
||||
TScanner s(file);
|
||||
while (s.ok())
|
||||
{
|
||||
TString80 riga = s.line();
|
||||
const TString& riga = s.line();
|
||||
if (riga.blank())
|
||||
continue;
|
||||
|
||||
@ -670,7 +672,7 @@ bool TAcquisizione_lavanderie_app::elabora_file(const TString& file, TLog_report
|
||||
//controllo quale tracciato record devo seguire
|
||||
if (riga.len() == 34) // -> MONTANARI
|
||||
{
|
||||
nrighe += 1;
|
||||
nrighe++;
|
||||
//leggo i campi dalla riga del file
|
||||
const int d = atoi(riga.mid(0,2));
|
||||
const int m = atoi(riga.mid(2,2));
|
||||
@ -680,7 +682,7 @@ bool TAcquisizione_lavanderie_app::elabora_file(const TString& file, TLog_report
|
||||
datadoc = TDate(d, m, y);
|
||||
if (datadoc < _msk->get_date(F_DADATA) || datadoc > _msk->get_date(F_ADATA))
|
||||
{
|
||||
nrsalt += 1;
|
||||
nrsalt++;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -719,14 +721,12 @@ bool TAcquisizione_lavanderie_app::elabora_file(const TString& file, TLog_report
|
||||
continue;
|
||||
}
|
||||
|
||||
TToken_string key;
|
||||
key.add('C');
|
||||
key.add(codcf);
|
||||
TToken_string key; key.format("C|%ld", codcf);
|
||||
const int codindsp = atoi(cache().get(LF_CFVEN, key, CFV_CODINDSP));
|
||||
TLaundry_contract cont(codcf, codindsp, datadoc);
|
||||
const TRectype& rcont = cont.row(codart.trim());
|
||||
|
||||
if(rcont.empty())
|
||||
if (rcont.empty())
|
||||
{
|
||||
TString str;
|
||||
str << "L'articolo " << codart << " non è previsto nel contratto del cliente " << codcf;
|
||||
@ -736,9 +736,6 @@ bool TAcquisizione_lavanderie_app::elabora_file(const TString& file, TLog_report
|
||||
}
|
||||
|
||||
TArticolo_lavanderie& artrec = cached_article_laundry(codart, 'C', codcf, 0);
|
||||
//fisso l'anno esercizio
|
||||
TEsercizi_contabili& esc = esercizi();
|
||||
const int last_esc = esc.last();
|
||||
|
||||
//estraggo il record corrispondente su LF_CLIFOGIAC
|
||||
const TRecmag_lavanderie& reclav = artrec.find_rec(last_esc);
|
||||
@ -748,11 +745,11 @@ bool TAcquisizione_lavanderie_app::elabora_file(const TString& file, TLog_report
|
||||
{
|
||||
const real dotod = reclav.get_real(CLIFOGIAC_DOTOD);
|
||||
|
||||
if(qta > dotod)
|
||||
if (qta > dotod)
|
||||
{
|
||||
TString str;
|
||||
str << "Attenzione! Il cliente " << codcf << " per l'articolo " << codart << " ha una dotazione di "
|
||||
<< dotod << " pezzi, e ne sono stati ritirati " << qta << " (" << real(qta - dotod) << " in più).";
|
||||
<< dotod << " pezzi e ne sono stati ritirati " << qta << " (" << real(qta - dotod) << " in più).";
|
||||
warning_box(str);
|
||||
}
|
||||
}
|
||||
@ -763,7 +760,7 @@ bool TAcquisizione_lavanderie_app::elabora_file(const TString& file, TLog_report
|
||||
//altrimenti aggiungila con la rispettiva al TAssoc_array con la quantità appena conteggiata
|
||||
if (!qc->is_empty())
|
||||
{
|
||||
if(codcf == 1140)
|
||||
if(codcf == 1184)
|
||||
int cazzone = 1;
|
||||
TString str;
|
||||
str << "ATTENZIONE: è già presente un conteggio per il cliente " << codcf << " sull'articolo " << codart << "\n"
|
||||
@ -797,18 +794,16 @@ void TAcquisizione_lavanderie_app::controlla_documenti(TLog_report& rep, TArtico
|
||||
bool found = false;
|
||||
FOR_EACH_ASSOC_OBJECT(articoli, obj, key, itm)
|
||||
{
|
||||
TArticoli_key keyart(key);
|
||||
const TQuantita_contate* qc = (TQuantita_contate*)itm;
|
||||
|
||||
//recupero i dati dalla chiave del TAssoc_array degli articoli
|
||||
int codcf = keyart.codcf();
|
||||
TString80 codart = keyart.codart();
|
||||
TDate datadoc = keyart.data();
|
||||
TArticoli_key keyart(key);
|
||||
const long codcf = keyart.codcf();
|
||||
const TString80 codart = keyart.codart();
|
||||
const TDate datadoc = keyart.data();
|
||||
|
||||
//recupero i dati dal contenuto del TAssoc_array degli articoli
|
||||
TQuantita_contate* quantita = new TQuantita_contate(ZERO, ZERO);
|
||||
quantita->set_pezzi(qc->get_pezzi());
|
||||
quantita->set_rotti(qc->get_rotti());
|
||||
TQuantita_contate* quantita = new TQuantita_contate(qc->get_pezzi(), qc->get_rotti());
|
||||
|
||||
TDocumento& doc = ca.doc(datadoc, codcf);
|
||||
if (doc.empty())
|
||||
@ -821,16 +816,17 @@ void TAcquisizione_lavanderie_app::controlla_documenti(TLog_report& rep, TArtico
|
||||
}
|
||||
else
|
||||
{
|
||||
int idriga;
|
||||
for (idriga = 1; idriga <= doc.rows(); idriga++)
|
||||
int idriga = 0;
|
||||
FOR_EACH_PHYSICAL_RDOC(doc, r, prdoc)
|
||||
{
|
||||
//cerco se esiste già una riga sul documento selezionato per quell'articolo
|
||||
TRiga_documento& rdoc = doc[idriga];
|
||||
TString80 codart_doc = rdoc.get(RDOC_CODART); codart_doc.trim();
|
||||
const TRiga_documento& rdoc = *prdoc;
|
||||
const TString& codart_doc = rdoc.get(RDOC_CODART);
|
||||
|
||||
if (codart_doc == codart)
|
||||
{
|
||||
found = true;
|
||||
idriga = r;
|
||||
|
||||
TString str;
|
||||
str << "ATTENZIONE: è già presente un buono di ritiro per il cliente " << codcf << " sull'articolo " << codart << "\n"
|
||||
@ -838,8 +834,7 @@ void TAcquisizione_lavanderie_app::controlla_documenti(TLog_report& rep, TArtico
|
||||
<< "Si desidera sommare le quantità?\n"
|
||||
<< "(SI -> Somma NO -> Ignora Conteggio ANNULLA -> Modifica Buono)\n";
|
||||
|
||||
KEY k = yesnocancel_box(str);
|
||||
|
||||
const KEY k = yesnocancel_box(str);
|
||||
switch (k)
|
||||
{
|
||||
case K_YES: quantita->add_pezzi(rdoc.get_real(RDOC_QTAGG1)); quantita->add_rotti(rdoc.get_real(RDOC_QTAGG2)); break; //sommo le quantità
|
||||
@ -850,11 +845,9 @@ void TAcquisizione_lavanderie_app::controlla_documenti(TLog_report& rep, TArtico
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
idriga = 0;
|
||||
if (!found) idriga = 0; // Mi pare implicito!!!
|
||||
//preparo la chiave per il TAssoc_array dei documenti
|
||||
TDocumenti_key keydoc(datadoc.year(), doc.get_long(DOC_NDOC), idriga, codcf, codart, datadoc);
|
||||
|
||||
const TDocumenti_key keydoc(datadoc.year(), doc.get_long(DOC_NDOC), idriga, codcf, codart, datadoc);
|
||||
documenti.add(keydoc, quantita);
|
||||
found = false;
|
||||
}
|
||||
@ -874,7 +867,7 @@ void TAcquisizione_lavanderie_app::genera_documenti(TLog_report& rep, TAssoc_arr
|
||||
const TString4 codnum = keydoc.codnum();
|
||||
const int anno = keydoc.anno();
|
||||
const int ndoc = keydoc.ndoc();
|
||||
const int idriga = keydoc.idriga();
|
||||
int idriga = keydoc.idriga(); // May change
|
||||
const int codcf = keydoc.codcf();
|
||||
const TString80 codart = keydoc.codart();
|
||||
const TDate datadoc = keydoc.data();
|
||||
@ -887,21 +880,39 @@ void TAcquisizione_lavanderie_app::genera_documenti(TLog_report& rep, TAssoc_arr
|
||||
key.add('C');
|
||||
key.add(codcf);
|
||||
const int codindsp = atoi(cache().get(LF_CFVEN, key, CFV_CODINDSP));
|
||||
TLaundry_contract cont(codcf, codindsp, datadoc);
|
||||
const TLaundry_contract cont(codcf, codindsp, datadoc);
|
||||
const TString8 codcont = cont.get(LVCONDV_CODCONT);
|
||||
const TRectype rcont = cont.row(codart);
|
||||
const TRectype& rcont = cont.row(codart);
|
||||
|
||||
TDate oggi(TODAY);
|
||||
|
||||
TDocumento& doc = ca.doc(datadoc, codcf);
|
||||
if (!giri)
|
||||
{
|
||||
const TDate oggi(TODAY);
|
||||
doc.put("DATAPRCO", oggi);
|
||||
}
|
||||
|
||||
const TDate dtcons = doc.get_date("DATAPRCO");
|
||||
|
||||
const TString4 causale = rcont.get(LVRCONDV_CAUSLAV).full() ? rcont.get(LVRCONDV_CAUSLAV) : ini_get_string(CONFIG_DITTA, "lv", "CAUSLAV");
|
||||
TString4 causale = rcont.get(LVRCONDV_CAUSLAV);
|
||||
if (causale.blank())
|
||||
causale = ini_get_string(CONFIG_DITTA, "lv", "CAUSLAV");
|
||||
|
||||
if (doc.rows() > 0 && (idriga > 0 && idriga <= doc.rows()))
|
||||
// idriga NON è affidabile, per cui ricerco per codart
|
||||
if (idriga > 0 && doc.body().exist(idriga) && doc[idriga].get(RDOC_CODARTMAG) != codart)
|
||||
{
|
||||
idriga = 0; // Invalidate by now
|
||||
FOR_EACH_PHYSICAL_RDOC(doc, r, row)
|
||||
{
|
||||
if (row->get(RDOC_CODARTMAG) == codart)
|
||||
{
|
||||
idriga = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (idriga > 0 && doc.body().exist(idriga))
|
||||
{
|
||||
TRiga_documento& rdoc = doc[idriga];
|
||||
rdoc.put(RDOC_QTAGG1, qtacon);
|
||||
@ -935,9 +946,8 @@ void TAcquisizione_lavanderie_app::genera_documenti(TLog_report& rep, TAssoc_arr
|
||||
TCausale_magazzino rit(cau.causale_ritiro());
|
||||
TCausale_magazzino con(cau.causale_consegna());
|
||||
|
||||
TString8 magazzino;
|
||||
TString8 magazzinoc;
|
||||
|
||||
TString8 magazzino, magazzinoc;
|
||||
|
||||
if(rit.get("S10").full())
|
||||
magazzino = rit.get("S10").mid(0,5);
|
||||
else
|
||||
@ -959,7 +969,7 @@ void TAcquisizione_lavanderie_app::genera_documenti(TLog_report& rep, TAssoc_arr
|
||||
rdoc.put(RDOC_UMQTA, umart.get(UMART_UM));
|
||||
}
|
||||
|
||||
if (!doc.get_date("DATAPRCO").ok() && giri)
|
||||
if (giri && !doc.get_date("DATAPRCO").ok())
|
||||
{
|
||||
TString msg;
|
||||
msg << TR("Il documento ") << doc.get(DOC_NDOC) << TR(" del ") << doc.get(DOC_DATADOC)
|
||||
@ -969,10 +979,8 @@ void TAcquisizione_lavanderie_app::genera_documenti(TLog_report& rep, TAssoc_arr
|
||||
}
|
||||
|
||||
if (ca.empty())
|
||||
{
|
||||
warning_box(TR("ATTENZIONE: il file importato non ha generato nessun documento; controllare che il tracciato record sia coerente"));
|
||||
return;
|
||||
}
|
||||
warning_box(TR("ATTENZIONE: il file importato non ha generato nessun documento.\n"
|
||||
"controllare che il tracciato record sia coerente"));
|
||||
else
|
||||
ca.destroy();
|
||||
}
|
||||
@ -990,7 +998,7 @@ void TAcquisizione_lavanderie_app::sposta_file(const TString& file)
|
||||
TFilename filedest = path;
|
||||
filedest.add(strname);
|
||||
|
||||
//se la ciopia è andata a buon fine, creo un file .old vuoto e cancello il file .dat
|
||||
//se la copia è andata a buon fine, creo un file .old vuoto e cancello il file .dat
|
||||
if (fcopy(fileori, filedest))
|
||||
{
|
||||
TFilename fileold;
|
||||
@ -1016,7 +1024,7 @@ bool TAcquisizione_lavanderie_app::transfer()
|
||||
TSheet_field& sheet = _msk->sfield(F_SHEET_NAME);
|
||||
TFilename file;
|
||||
|
||||
TLog_report logrep("Aquisizione da contapezzi");
|
||||
TLog_report logrep(TR("Aquisizione da contapezzi"));
|
||||
logrep.kill_duplicates(true);
|
||||
|
||||
TArticoli_contati articoli;
|
||||
@ -1048,31 +1056,27 @@ bool TAcquisizione_lavanderie_app::transfer()
|
||||
|
||||
FOR_EACH_ARRAY_ROW(lista_file, r2, row2)
|
||||
{
|
||||
TFilename strname = *row2;
|
||||
const TFilename strname = *row2;
|
||||
if (strname.exist())
|
||||
{
|
||||
esiste = true;
|
||||
elaborato = elabora_file(*row2, logrep, articoli, nrighe, nrsalt);
|
||||
elaborato = elabora_file(strname, logrep, articoli, nrighe, nrsalt);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if(file.exist())
|
||||
else if (file.exist())
|
||||
{
|
||||
esiste = true;
|
||||
elaborato = elabora_file(file, logrep, articoli, nrighe, nrsalt);
|
||||
}
|
||||
|
||||
if (!esiste)
|
||||
{
|
||||
TString str;
|
||||
str << "ATTENZIONE: non è stato trovato nessun file da elaborare";
|
||||
warning_box(str);
|
||||
}
|
||||
warning_box(TR("ATTENZIONE: non è stato trovato nessun file da elaborare"));
|
||||
}
|
||||
}
|
||||
|
||||
if(elaborato)
|
||||
if (elaborato)
|
||||
{
|
||||
controlla_documenti(logrep, articoli, documenti);
|
||||
|
||||
@ -1111,20 +1115,19 @@ bool TAcquisizione_lavanderie_app::transfer()
|
||||
TAssoc_array buoni;
|
||||
FOR_EACH_ASSOC_OBJECT(documenti, obj, key, itm)
|
||||
{
|
||||
TDocumenti_key tmp = (TDocumenti_key)key;
|
||||
TDocumenti_key tmp = key;
|
||||
TDoc_key kdoc(tmp.anno(), tmp.codnum(), tmp.ndoc());
|
||||
|
||||
if (!buoni.is_key(kdoc))
|
||||
buoni.add(kdoc, kdoc);
|
||||
}
|
||||
|
||||
TString str;
|
||||
if (buoni.items() > 1)
|
||||
str << "Sono stati generati " << buoni.items() << " buoni di ritiro.";
|
||||
else
|
||||
str << "E' stato generato " << buoni.items() << " buono di ritiro.";
|
||||
|
||||
message_box(str);
|
||||
switch (buoni.items())
|
||||
{
|
||||
case 0: warning_box(TR("Non è stato generato alcun buono di ritiro.")); break;
|
||||
case 1: message_box(TR("E' stato generato un buono di ritiro.")); break;
|
||||
default: message_box(FR("Sono stati generati %d buoni di ritiro."), buoni.items()); break;
|
||||
}
|
||||
|
||||
FOR_EACH_SHEET_ROW(sheet, r1, row1)
|
||||
{
|
||||
@ -1166,7 +1169,7 @@ bool TAcquisizione_lavanderie_app::transfer()
|
||||
if (genera)
|
||||
message_box(TR("Generazione terminata"));
|
||||
else
|
||||
message_box(TR("Generazione interrotta"));
|
||||
warning_box(TR("Generazione interrotta"));
|
||||
}
|
||||
_msk->send_key(K_SPACE, DLG_QUIT);
|
||||
}
|
||||
@ -1185,6 +1188,6 @@ void TAcquisizione_lavanderie_app::main_loop()
|
||||
int lv2600(int argc, char *argv[])
|
||||
{
|
||||
TAcquisizione_lavanderie_app a;
|
||||
a.run (argc, argv, "Acquisizione bolle di rientro/ritiro");
|
||||
a.run (argc, argv, TR("Acquisizione da contapezzi"));
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1014,8 +1014,6 @@ public:
|
||||
virtual void main_loop();
|
||||
};
|
||||
|
||||
|
||||
|
||||
//CREATE: metodo costruttore
|
||||
bool TConta_pulito_app::create()
|
||||
{
|
||||
@ -1043,7 +1041,7 @@ bool TConta_pulito_app::create()
|
||||
_cliormag = ' ';
|
||||
}
|
||||
|
||||
open_files(LF_DOC, LF_RIGHEDOC);
|
||||
open_files(LF_TAB, LF_TABCOM, LF_DOC, LF_RIGHEDOC, LF_CLIFO, LF_CFVEN, LF_SCONTI, LF_PACCHI, LF_ANAMAG, LF_UMART, 0);
|
||||
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
@ -1065,6 +1063,7 @@ void TConta_pulito_app::main_loop()
|
||||
{
|
||||
//lo lancio in automatico da linea di comando
|
||||
if (_auto == "A")
|
||||
{
|
||||
switch(_cliormag)
|
||||
{
|
||||
case 'C': _msk->send_key(K_SPACE, DLG_PACKTCLI); break;
|
||||
@ -1072,6 +1071,7 @@ void TConta_pulito_app::main_loop()
|
||||
case 'I': _msk->send_key(K_SPACE, DLG_IMPORT); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
while (_msk->run() == K_ENTER)
|
||||
transfer();
|
||||
}
|
||||
|
72
lv/lvlib.cpp
72
lv/lvlib.cpp
@ -790,10 +790,7 @@ TCache_articoli_lavanderie::TCache_articoli_lavanderie()
|
||||
TArticolo_lavanderie & cached_article_laundry(const char * codart, const char tipocf, const long codcf, const int indsped)
|
||||
{
|
||||
HIDDEN TCache_articoli_lavanderie __cache_articoli_lavanderie;
|
||||
|
||||
|
||||
TArticolo_lavanderie & art = __cache_articoli_lavanderie.lav(codart);
|
||||
|
||||
TArticolo_lavanderie& art = __cache_articoli_lavanderie.lav(codart);
|
||||
art.set_tipocf(tipocf);
|
||||
art.set_codcf(codcf);
|
||||
art.set_indsped(indsped);
|
||||
@ -893,29 +890,24 @@ TLavanderie_calendar::TLavanderie_calendar(const int year) : _year(year)
|
||||
//// TCausale_lavanderie ////
|
||||
///////////////////////////////////
|
||||
|
||||
TCausale_lavanderie::TCausale_lavanderie(const char * codice):
|
||||
TRectype(cache().get("&CAU", codice))
|
||||
{
|
||||
}
|
||||
TCausale_lavanderie::TCausale_lavanderie(const char* codice) : TRectype(cache().get("&CAU", codice))
|
||||
{ }
|
||||
|
||||
|
||||
TCausale_lavanderie::TCausale_lavanderie(const TRectype &r):
|
||||
TRectype(r)
|
||||
{
|
||||
CHECK(r.num() == LF_TABMOD, "Tipo record errato sulla causale di magazzino");
|
||||
}
|
||||
TCausale_lavanderie::TCausale_lavanderie(const TRectype &r)
|
||||
: TRectype(r)
|
||||
{ CHECK(r.num() == LF_TABMOD, "Tipo record errato sulla causale di magazzino"); }
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TCache_causali_lavanderie
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TCache_causali_lavanderie : public TRecord_cache
|
||||
{
|
||||
protected:
|
||||
virtual TObject* rec2obj(const TRectype& rec) const{ return new TCausale_lavanderie(rec); }
|
||||
|
||||
|
||||
public:
|
||||
TCausale_lavanderie & caus(const char* key);
|
||||
TCausale_lavanderie& caus(const char* key);
|
||||
|
||||
TCache_causali_lavanderie();
|
||||
virtual ~TCache_causali_lavanderie() { }
|
||||
@ -923,24 +915,22 @@ public:
|
||||
|
||||
|
||||
TCache_causali_lavanderie::TCache_causali_lavanderie()
|
||||
: TRecord_cache("LVCAU", 1)
|
||||
: TRecord_cache("LVCAU", 1)
|
||||
{
|
||||
test_file_changes(); // Tieni d'occhio le modifiche sul file
|
||||
set_items_limit(83); // Numero primo
|
||||
}
|
||||
|
||||
TCausale_lavanderie & TCache_causali_lavanderie::caus(const char* key)
|
||||
TCausale_lavanderie& TCache_causali_lavanderie::caus(const char* key)
|
||||
{
|
||||
TString16 k;
|
||||
|
||||
k << "LV||CAU|" << key;
|
||||
return (TCausale_lavanderie &)query(k);
|
||||
}
|
||||
|
||||
TCausale_lavanderie & cached_causale_lavanderie(const char * codcaus)
|
||||
TCausale_lavanderie& cached_causale_lavanderie(const char* codcaus)
|
||||
{
|
||||
HIDDEN TCache_causali_lavanderie __cache_causali_lavanderie;
|
||||
|
||||
return __cache_causali_lavanderie.caus(codcaus);
|
||||
}
|
||||
|
||||
@ -1012,60 +1002,42 @@ const TString& TBuono_prelievo_row::desart() const
|
||||
{
|
||||
TString& str = get_tmp_string();
|
||||
str = _rdoc.get(RDOC_DESCR);
|
||||
|
||||
if (_rdoc.get_bool(RDOC_DESCLUNGA))
|
||||
str << _rdoc.get(RDOC_DESCEST);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
//CAUSALE: metodo che restituisce il codice della causale della riga
|
||||
const TString& TBuono_prelievo_row::causale() const
|
||||
{
|
||||
return _rdoc.get(RDOC_CODAGG1);
|
||||
}
|
||||
{ return _rdoc.get(RDOC_CODAGG1); }
|
||||
|
||||
//QTA_RITIRATA: metodo che restituisce la quantità ritirata
|
||||
const real TBuono_prelievo_row::qta_ritirata() const
|
||||
{
|
||||
return _rdoc.get_real(RDOC_QTAGG1);
|
||||
}
|
||||
{ return _rdoc.get_real(RDOC_QTAGG1); }
|
||||
|
||||
//QTA_DACONS: metodo che restituisce la quantità da consegnare
|
||||
const real TBuono_prelievo_row::qta_dacons() const
|
||||
{
|
||||
return _rdoc.get_real(RDOC_QTA);
|
||||
}
|
||||
{ return _rdoc.get_real(RDOC_QTA); }
|
||||
|
||||
//QTA_CONSEGNATA: metodo che restituisce la quantità effettivamente consegnata
|
||||
const real TBuono_prelievo_row::qta_consegnata() const
|
||||
{
|
||||
return _rdoc.get_real(RDOC_QTAEVASA);
|
||||
}
|
||||
{ return _rdoc.get_real(RDOC_QTAEVASA); }
|
||||
|
||||
//NUM_PACCHI: metodo che restituisce il numero dei pacchi consegnati
|
||||
const int TBuono_prelievo_row::num_pacchi() const
|
||||
{
|
||||
return _rdoc.get_int(RDOC_NCOLLI);
|
||||
}
|
||||
{ return _rdoc.get_int(RDOC_NCOLLI); }
|
||||
|
||||
//PREZZO:metodo che restituisce il prezzo dell'articolo selezionato
|
||||
const real TBuono_prelievo_row::prezzo() const
|
||||
{
|
||||
return _rdoc.get_real(RDOC_PREZZO);
|
||||
}
|
||||
{ return _rdoc.get_real(RDOC_PREZZO); }
|
||||
|
||||
//CONG_PRE: metodo che restituisce il valore del conguaglio al momento dell'inizio delle operazioni
|
||||
const long TBuono_prelievo_row::cong_pre() const
|
||||
{
|
||||
return _rdoc.get_long("CONGPRE");
|
||||
}
|
||||
{ return _rdoc.get_long("CONGPRE"); }
|
||||
|
||||
//CONG_ATT: metodo che restituisce il valore del conguaglio al termine dell'operazione attuale
|
||||
const long TBuono_prelievo_row::cong_att() const
|
||||
{
|
||||
return _rdoc.get_long("CONGATT");
|
||||
}
|
||||
{ return _rdoc.get_long("CONGATT"); }
|
||||
|
||||
//RIFBCON: metodo che restituisce i riferimenti al buono di consegna associato
|
||||
const TToken_string& TBuono_prelievo_row::rifbcon() const
|
||||
@ -1083,10 +1055,10 @@ const TToken_string& TBuono_prelievo_row::rifbrit() const
|
||||
return kdoc;
|
||||
}
|
||||
|
||||
//DATAEVA: metodo che restituisce la data di evasione di queòòa riga
|
||||
const TDate& TBuono_prelievo_row::dataeva() const
|
||||
//DATAEVA: metodo che restituisce la data di evasione di quella riga
|
||||
const TDate TBuono_prelievo_row::dataeva() const
|
||||
{
|
||||
TDate& data = _rdoc.get_date("DATAEVA");
|
||||
TDate data = _rdoc.get_date("DATAEVA");
|
||||
if (!data.ok())
|
||||
data = NULLDATE;
|
||||
return data;
|
||||
|
@ -111,8 +111,8 @@ public:
|
||||
int find_clifomag(int annoes, const char * livello = NULL, int from = 0) const ;
|
||||
int find_clifomag(const char * annoes, const char * livello = NULL, int from = 0) const { return find_clifomag(atoi(annoes), livello, from); }
|
||||
|
||||
TRecord_array & clifomag(int annoes) const;
|
||||
TRecord_array & clifomag(const char * annoes) const { return clifomag(atoi(annoes));}
|
||||
TRecord_array& clifomag(int annoes) const;
|
||||
TRecord_array& clifomag(const char * annoes) const { return clifomag(atoi(annoes)); }
|
||||
|
||||
void set_tipocf(char tipocf);
|
||||
void set_codcf(long codcf);
|
||||
@ -220,7 +220,7 @@ public:
|
||||
const long cong_att() const;
|
||||
const TToken_string& rifbcon() const;
|
||||
const TToken_string& rifbrit() const;
|
||||
const TDate& dataeva() const;
|
||||
const TDate dataeva() const;
|
||||
|
||||
void set_evaso(const bool evaso);
|
||||
void set_codart(const char* codart);
|
||||
|
Loading…
x
Reference in New Issue
Block a user