git-svn-id: svn://10.65.10.50/branches/R_10_00@23191 c028cbd2-c16b-5b4b-a496-9718f37d4682

This commit is contained in:
guy 2016-04-15 08:17:44 +00:00
parent db4a70fcd3
commit 3c7e9a5c69
19 changed files with 1436 additions and 1273 deletions

View File

@ -1,30 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?>
<report libraries="ve1300" name="lv0200b" lpi="6">
<report libraries="ve1300" name="lv0200b" orientation="1" lpi="6">
<description>Stampa valore convenzionale per articolo</description>
<font face="Courier New" size="10" />
<section type="Head" height="6" pattern="1">
<field type="Stringa" width="60" pattern="1">
<source>#SYSTEM.RAGSOC</source>
</field>
<field x="66.5" type="Testo" width="5" height="1.5" pattern="1" text="Pag." />
<field x="71.5" type="Stringa" width="10" pattern="1">
<field x="80" type="Testo" width="5" height="1.5" pattern="1" text="Pag." />
<field x="85" type="Stringa" width="10" pattern="1">
<prescript>MESSAGE _PAGENO</prescript>
</field>
<field y="1" type="Stringa" align="center" width="81.5" height="2" pattern="1">
<field y="1.5" type="Testo" align="center" width="95" height="1.5" pattern="1" text="Stampa valore convenzionale per articolo">
<font face="Courier New" bold="1" size="14" />
<prescript description="H0.0 PRESCRIPT">"Stampa riepilogo consegne del "
"#DATA" @
+
#THIS !</prescript>
</field>
<field x="0.5" y="3.75" type="Testo" width="20" pattern="1" text="Codice">
<source>RDOC.CODART</source>
</field>
<field x="21" y="3.75" type="Testo" width="50" pattern="1" text="Descrizione articolo">
<field x="22" y="3.75" type="Testo" width="50" pattern="1" text="Descrizione articolo">
<source>ANAMAG.DESCR</source>
</field>
<field border="2" y="4.75" type="Linea" width="81.5" height="0" pattern="1" />
<field x="62.5" y="3.75" type="Testo" align="right" width="18" id="101" pattern="1" text="Val.convenzionale">
<field border="2" y="4.75" type="Linea" width="95" height="0" pattern="1" />
<field x="63.5" y="3.75" type="Testo" align="right" width="18" id="101" pattern="1" text="Val.convenzionale">
<source>RDOC.QTA</source>
</field>
</section>
@ -36,15 +32,15 @@
<section type="Body" pattern="1" />
<section type="Body" level="1" pattern="1">
<condition>VALCONV</condition>
<field x="70" type="Prezzo" align="right" width="10" id="102" pattern="1" text="#########,@@">
<field x="73" type="Prezzo" align="right" width="10" id="102" pattern="1" text="#########,@@">
<source>201@-&#3E;R0</source>
<postscript description="B1.102 POSTSCRIPT">MESSAGE ADD,F2.102
</postscript>
</field>
<field type="Stringa" width="20" id="201" pattern="1">
<source>RDOC.CODART</source>
<field x="1" type="Stringa" link="47.CODART" width="20" id="201" pattern="1">
<source>CODART</source>
</field>
<field x="21" type="Stringa" dynamic_height="1" width="40" height="2" id="202" pattern="1">
<field x="22" type="Stringa" width="50" id="202" pattern="1">
<source>ANAMAG.DESCR</source>
</field>
</section>
@ -52,8 +48,8 @@
<section type="Foot" level="1" pattern="1">
<field border="2" y="1" type="Linea" width="95" height="0" pattern="1" />
</section>
<sql>USE ANAMAG
JOIN &#26;LV047 INTO CODTAB==CODART ALIAS 201
<sql>USE ANAMAG SELECT (STR(201@-&#3E;R0!=0)||(#ALL="X"))
JOIN &#26;LV047 ALIAS 201 INTO CODTAB==CODART
FROM CODART=#DACODART
TO CODART=#ACODART
</sql>

View File

@ -61,6 +61,12 @@ BEGIN
CHECKTYPE SEARCH
END
BOOLEAN 400
BEGIN
PROMPT 2 8 "Stampa tutti gli articoli"
FIELD ALL
END
ENDPAGE
ENDMASK

View File

@ -1,21 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<report libraries="ve1300" name="lv0200c" lpi="6" command="lv0 -1">
<report libraries="ve1300" name="lv0200c" orientation="1" lpi="6" command="lv0 -1">
<description>Stampa valore convenzionale per articolo</description>
<font face="Courier New" size="10" />
<section type="Head" height="6" pattern="1">
<field type="Stringa" width="60" pattern="1">
<source>#SYSTEM.RAGSOC</source>
</field>
<field x="66.5" type="Testo" width="5" height="1.5" pattern="1" text="Pag." />
<field x="71.5" type="Stringa" width="10" pattern="1">
<field x="82" type="Testo" width="5" height="1.5" pattern="1" text="Pag." />
<field x="87" type="Stringa" width="10" pattern="1">
<prescript>MESSAGE _PAGENO</prescript>
</field>
<field y="1" type="Stringa" align="center" width="81.5" height="2" pattern="1">
<field y="1" type="Stringa" align="center" width="95" height="2" pattern="1" text="Stampa Valore dotazione odierna per articolo">
<font face="Courier New" bold="1" size="14" />
<prescript description="H0.0 PRESCRIPT">"Stampa riepilogo consegne del "
"#DATA" @
+
#THIS !</prescript>
</field>
<field x="0.5" y="3.75" type="Testo" width="20" pattern="1" text="Codice">
<source>RDOC.CODART</source>
@ -23,54 +19,99 @@
<field x="21" y="3.75" type="Testo" width="30" pattern="1" text="Descrizione articolo">
<source>ANAMAG.DESCR</source>
</field>
<field border="2" y="4.75" type="Linea" width="82" height="0" pattern="1" />
<field x="49" y="3.75" type="Testo" align="right" width="10" id="101" pattern="1" text="Dotaz. Od.">
<field border="2" y="4.75" type="Linea" width="95" height="0" pattern="1" />
<field x="61" y="3.75" type="Testo" align="right" width="12" id="101" pattern="1" text="Dotaz. Od.">
<source>RDOC.QTA</source>
</field>
<field x="60" y="3.75" type="Testo" align="right" width="8" id="101" pattern="1" text="Prezzo">
<field x="74" y="3.75" type="Testo" align="right" width="9" id="101" pattern="1" text="Val.Conv.">
<source>RDOC.QTA</source>
</field>
<field x="69.5" y="3.75" type="Testo" align="right" width="12" id="101" pattern="1" text="Valore">
<field x="84" y="3.75" type="Testo" align="right" width="11" id="101" pattern="1" text="Totale">
<source>RDOC.QTA</source>
</field>
</section>
<section type="Head" level="1" pattern="1">
<prescript description="H1 PRESCRIPT">0 #F1.101 !
0 #F1.102 !
0 #F1.103 !</prescript>
<prescript description="H1 PRESCRIPT">MESSAGE RESET,F1</prescript>
</section>
<section type="Head" level="2" hidden="1" pattern="1">
<groupby>CODART</groupby>
<prescript description="H2 PRESCRIPT">MESSAGE RESET,F2</prescript>
<field type="Stringa" width="15" id="201" pattern="1">
<source>CODART</source>
</field>
<field x="16" type="Stringa" width="45" id="202" pattern="1">
<source>ANAMAG.DESCR</source>
</field>
<field x="74" type="Numero" align="right" width="10" id="203" pattern="1" text="###.###.###,@@">
<source>201@.R0</source>
</field>
</section>
<section type="Body" pattern="1" />
<section type="Body" level="1" pattern="1">
<field x="52" type="Numero" align="right" width="7" id="100" pattern="1" text="###.###">
<source>#ART.DOTOD</source>
<field type="Stringa" hidden="1" width="1" pattern="1">
<source>#DETT</source>
<prescript description="B1.0 PRESCRIPT">MESSAGE EMPTY HIDE,B1
MESSAGE SHOW,B1</prescript>
</field>
<field x="59" type="Prezzo" align="right" width="10" id="101" pattern="1" text="###.###.###,@@">
<source>UMART.PREZZO</source>
<field x="12" type="Stringa" width="40" pattern="1">
<prescript description="B1.0 PRESCRIPT">MESSAGE ISAMREAD,20,TIPOCF=#10!CODCF=#20,RAGSOC</prescript>
</field>
<field x="69" type="Valuta" align="right" width="12" id="102" pattern="1" text="###.###.###,@@">
<field x="1" type="Stringa" width="1" id="10" pattern="1">
<source>CLIFOGIAC.TIPOCF</source>
</field>
<field x="3" type="Numero" align="right" width="8.5" id="20" pattern="1">
<source>CLIFOGIAC.CODCF</source>
</field>
<field x="61" type="Numero" align="right" width="12" id="100" pattern="1" text="###.###">
<source>CLIFOGIAC.DOTOD</source>
<prescript description="B1.100 PRESCRIPT">MESSAGE ADD,F2.100</prescript>
</field>
<field x="74" type="Numero" align="right" width="9" id="101" pattern="1" text="###.###.###,@@">
<source>201@.R0</source>
</field>
<field x="84" type="Valuta" align="right" width="11" id="102" pattern="1" text="###.###.###,@@">
<source>#100*#101</source>
<postscript description="B1.102 POSTSCRIPT">MESSAGE ADD,F1.102
</postscript>
</field>
<field type="Stringa" width="20" id="201" pattern="1">
<source>CODART</source>
</field>
<field x="21" type="Stringa" dynamic_height="1" width="30" height="2" id="202" pattern="1">
<source>ANAMAG.DESCR</source>
<prescript description="B1.102 PRESCRIPT">MESSAGE ADD,F2.102</prescript>
</field>
</section>
<section type="Foot" height="2" pattern="1" />
<section type="Foot" level="1" pattern="1">
<field border="2" y="1" type="Linea" width="81" height="0" pattern="1" />
<field border="2" y="1" type="Linea" width="95" height="0" pattern="1" />
<field y="2.25" type="Testo" width="10" pattern="1" text="Totale" />
<field x="67" y="2" type="Valuta" align="right" width="14" id="102" pattern="1" text="###.###.###,@@">
<field x="58" y="2" type="Numero" align="right" width="15" id="100" pattern="1" text="###.###.###">
<postscript description="F1.100 POSTSCRIPT">MESSAGE ADD,F1.102
</postscript>
</field>
<field x="81" y="2" type="Valuta" align="right" width="14" id="102" pattern="1" text="###.###.###,@@">
<postscript description="F1.102 POSTSCRIPT">MESSAGE ADD,F1.102
</postscript>
</field>
</section>
<sql>USE ANAMAG
JOIN UMART INTO CODART==CODART NRIGA==1
FROM CODART=#DACODART
TO CODART=#ACODART
<section type="Foot" level="2" pattern="1">
<field x="61" type="Numero" align="right" width="12" id="100" pattern="1" text="###.###">
<font face="Courier New" bold="1" size="10" />
<postscript description="F2.100 POSTSCRIPT">MESSAGE ADD,F1.100</postscript>
</field>
<field x="74" type="Numero" align="right" width="9" id="101" pattern="1" text="###.###.###,@@">
<source>#H2.203</source>
</field>
<field x="84" type="Valuta" align="right" width="11" id="102" pattern="1" text="###.###.###,@@">
<postscript description="F2.102 POSTSCRIPT">MESSAGE ADD,F1.102
</postscript>
</field>
<field x="1" type="Stringa" link="47.CODART" width="15" id="201" pattern="1">
<source>#H2.201</source>
</field>
<field x="16" type="Stringa" width="45" id="202" pattern="1">
<source>#H2.202</source>
</field>
</section>
<sql>USE CLIFOGIAC KEY 3 SELECT STR(DOTOD!=0)&#26;&#26;STR(CODCF!=0)&#26;&#26;(ANAMAG.DESCR!="")&#26;&#26;(CLIFO.RAGSOC!="")
JOIN ANAMAG INTO CODART==CODART
JOIN &#26;LV047 ALIAS 201 INTO CODTAB==CODART
JOIN CLIFO INTO TIPOCF==TIPOCF CODCF==CODCF
FROM ANNOES=#ANNO CODART=#DACODART
TO ANNOES=#ANNO CODART=#ACODART
</sql>
</report>

View File

@ -61,6 +61,12 @@ BEGIN
CHECKTYPE SEARCH
END
BOOLEAN 400
BEGIN
PROMPT 2 9 "Stampa dettaglio clienti"
FIELD DETT
END
ENDPAGE
ENDMASK

View File

@ -1,8 +1,9 @@
#include <applicat.h>
#include <automask.h>
#include <config.h>
#include <execp.h>
#include <relation.h>
#include <reprint.h>
#include <sheet.h>
#include "lv1100a.h"
#include "../ve/velib.h"

View File

@ -1,5 +1,6 @@
#include <applicat.h>
#include <automask.h>
#include <config.h>
#include <execp.h>
#include <relation.h>
#include <reprint.h>

View File

@ -1,6 +1,8 @@
#include <applicat.h>
#include <automask.h>
#include <config.h>
#include <execp.h>
#include <sheet.h>
#include "lvlib.h"

View File

@ -1,4 +1,5 @@
#include <applicat.h>
#include <config.h>
#include <automask.h>
#include <progind.h>

View File

@ -1,4 +1,5 @@
#include <applicat.h>
#include <config.h>
#include <automask.h>
#include <defmask.h>
#include <progind.h>

View File

@ -1,5 +1,6 @@
#include <applicat.h>
#include <automask.h>
#include <config.h>
#include <execp.h>
#include <progind.h>
#include <reputils.h>
@ -28,7 +29,7 @@ class TGenera_documenti_msk : public TAutomask
{
public:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
TGenera_documenti_msk (const char* name) : TAutomask(name) {set(F_STAMPA, 'X');}
TGenera_documenti_msk (const char* name) : TAutomask(name) {}
};
//ON_FIELD_EVENT: questo metodo gestisce i vari eventi che si verificano sui campi della maschera
@ -64,6 +65,7 @@ class TGenera_documenti_app : public TSkeleton_application
TConfig* _configlv;
char _buono;
long _ndoc;
bool _has_gui;
private:
//Metodi per la generazione dei documenti
@ -338,7 +340,8 @@ bool TGenera_documenti_app::crea_documento_ritiro(const TISAM_recordset& ritiro,
const long old_ndoc = doc.get_long(DOC_NDOC);
doc.renum_ndoc();
const long new_ndoc = doc.get_long(DOC_NDOC);
message_box("Attenzione documento numero %ld rinumerato in %ld", old_ndoc, new_ndoc);
if (_has_gui)
lv_popup_msg("Attenzione documento numero %ld rinumerato in %ld", old_ndoc, new_ndoc);
}
++numdocgen;
}
@ -1287,12 +1290,14 @@ bool TGenera_documenti_app::transfer()
}
}
if (_has_gui)
{
if (documenti.items() == 0)
warning_box(TR("Non è stato possibile generare alcun documento:\nprobabilmente i documenti richiesti esistono già."));
lv_popup_msg(TR("Non è stato possibile generare alcun documento:\nprobabilmente i documenti richiesti esistono già."));
else
{
if (adata < TDate(TODAY) && _msk->get_int(F_TPGEN) == 0)
warning_box(TR("Non è stato possibile generare documenti con data prevista consegna nel passato"));
lv_popup_msg(TR("Non è stato possibile generare documenti con data prevista consegna nel passato"));
else
{
TReport_book buc;
@ -1305,9 +1310,9 @@ bool TGenera_documenti_app::transfer()
if (numdocgen > 1)
str << TR("Sono stati generati ") << numdocgen << TR(" buoni.");
else
str << TR("E' stato generato ") << numdocgen << TR(" buono.");
message_box(str);
message_box(TR("Generazione terminata"));
str << TR("E' stato generato un buono.");
lv_popup_msg(str);
}
}
}
}
@ -1317,11 +1322,23 @@ bool TGenera_documenti_app::transfer()
void TGenera_documenti_app::main_loop()
{
_msk->set(F_NOTPLAN, "X");
_has_gui = !(argc() >= 4 && xvt_str_same(argv(3), "-A"));
_msk->set(F_STAMPA, true);
_msk->set(F_NOTPLAN, true);
if (_has_gui)
{
while (_msk->run() == K_ENTER)
{
transfer();
_msk->set(F_NOTPLAN, "X");
_msk->set(F_NOTPLAN, true);
}
}
else
{
_msk->set(F_DTCONS, TDate(TODAY));
_msk->send_key(K_SPACE, DLG_OK);
if (_msk->run() == K_ENTER)
transfer();
}
}

View File

@ -1,5 +1,7 @@
#include <applicat.h>
#include <automask.h>
#include <config.h>
#include <execp.h>
#include <reputils.h>
#include <reprint.h>
#include <urldefid.h>
@ -22,7 +24,7 @@
/////////////////////////////
//classe TArticoli_key
class TArticoli_key: public TToken_string
class TArticoli_key : public TToken_string
{
public:
const long codcf();
@ -37,7 +39,7 @@ public:
//CODCF: metodo che restituisce il codcf dalla TToken_string chiave degli articoli
const long TArticoli_key::codcf()
{
return get_int(0);
return get_long(0);
}
//CODART: metodo che restituisce il codart dalla TToken_string chiave degli articoli
@ -49,7 +51,7 @@ const char* TArticoli_key::codart()
//DATA: metodo che restituisce la data dalla TToken_string chiave degli articoli
const TDate TArticoli_key::data()
{
return (TDate)get(2);
return TDate(get(2));
}
//metodi costruttori
@ -120,7 +122,7 @@ const char* TDocumenti_key::codart()
//DATA: metodo che restituisce la data dalla TToken_string chiave dei documenti
const TDate TDocumenti_key::data()
{
return (TDate)get(6);
return TDate(get(6));
}
//metodi costruttori
@ -251,11 +253,93 @@ TQuantita_contate* TArticoli_contati::quantita(long codcf, const TString& codart
class TAcquisizione_msk: public TAutomask
{
protected:
virtual long handler(WINDOW task, EVENT* ep);
virtual bool on_field_event(TOperable_field& o,TField_event e,long jolly);
public:
bool some_file() const;
int file_list(TString_array& fl) const;
TAcquisizione_msk();
};
int TAcquisizione_msk::file_list(TString_array& lista_file) const
{
const TFilename path = get(F_PATH);
TSheet_field& sheet = sfield(F_SHEET_NAME);
TFilename file;
FOR_EACH_SHEET_ROW(sheet, r1, row1) if (!row1->empty_items())
{
if (row1->find('/') >= 0 || row1->find('\\') >= 0)
file = *row1;
else
{
file = path;
file.add(*row1);
}
if (file.find('*') >= 0 || file.find('?') >= 0)
list_files(file, lista_file);
else
{
if (file.exist())
lista_file.add(file);
}
}
for (int i = lista_file.last(); i >= 0; i--)
{
file = lista_file.row(i);
if (fsize(file) < 8) // Contapezzi a volte genera file vuoti
{
lista_file.destroy(i, true);
file.fremove();
}
}
return lista_file.items();
}
bool TAcquisizione_msk::some_file() const
{
const TFilename path = get(F_PATH);
TSheet_field& sheet = sfield(F_SHEET_NAME);
TFilename file;
bool found = false;
FOR_EACH_SHEET_ROW(sheet, r1, row1) if (!(found || row1->empty_items()))
{
if (row1->find('/') >= 0 || row1->find('\\') >= 0)
file = *row1;
else
{
file = path;
file.add(*row1);
}
if (file.find('*') >= 0 || file.find('?') >= 0)
{
TString_array a;
found = list_files(file, a) > 0;
}
else
found = file.exist();
}
return found;
}
long TAcquisizione_msk::handler(WINDOW task, EVENT* ep)
{
if (ep->type == E_TIMER)
{
if (is_running() && some_file())
stop_run(K_ENTER);
}
return TAutomask::handler(task, ep);
}
//ON_FIELD_EVENT: metodo che gestisce gli eventi sui campi della maschera
bool TAcquisizione_msk::on_field_event(TOperable_field& f,TField_event e,long jolly)
{
@ -587,7 +671,9 @@ TConfronto_cache::TConfronto_cache() : TCache(17)
class TAcquisizione_lavanderie_app : public TSkeleton_application
{
TAcquisizione_msk* _msk;
TString4 _auto;
enum TalpMode { alpGUI, alpAUTO, alpMONITOR };
TalpMode _mode;
TString4 _gr;
protected:
@ -602,32 +688,46 @@ protected:
public:
bool transfer();
virtual void main_loop();
TAcquisizione_lavanderie_app() : _msk(NULL) {}
};
//CREATE: metodo costruttore
bool TAcquisizione_lavanderie_app::create()
{
if (xvt_vobj_get_attr(NULL_WIN, ATTR_APPL_ALREADY_RUNNING))
{
TString msg; msg.format(FR("%s già in esecuzione!"), name());
xvt_dm_popup_error(msg);
return false;
}
_msk = new TAcquisizione_msk();
TSheet_field& sheet = _msk->sfield(F_SHEET_NAME);
sheet.set_auto_append();
_mode = alpGUI;
_gr = "";
//se ho più di un parametro, allora lo sto lanciando da linea di comando, e ne devo tenere conto
if (argc() > 2)
{
_auto = argv(2);
_auto = _auto.right(1);
const TFixed_string a(argv(2));
switch (toupper(a[1]))
{
case 'A': _mode = alpAUTO; break;
case 'M': _mode = alpMONITOR; break;
default: break;
}
if (argc() > 3)
{
_gr = argv(3);
_gr = _gr.right(1);
}
else
{
_auto = "N";
_gr = "";
}
if (_gr == "S" || _gr.empty())
if (_gr == "S" || _gr.blank())
_msk->set(F_RICGIRI, "X");
else
_msk->reset(F_RICGIRI);
@ -642,7 +742,7 @@ bool TAcquisizione_lavanderie_app::create()
bool TAcquisizione_lavanderie_app::destroy()
{
delete _msk;
return TApplication::destroy();
return TSkeleton_application::destroy();
}
//ELABORA_FILE: metodo che effettivamente fa l'elaborazione del file
@ -732,7 +832,7 @@ bool TAcquisizione_lavanderie_app::elabora_file(const TString& file, TLog_report
{
TString str;
str << "L'articolo " << codart << " non è previsto nel contratto del cliente " << codcf;
warning_box(str);
lv_popup_msg(str);
//ATTENZIONE: DEVE CHIEDERE CHE COSA FARE (Aggiungerlo o Ignorarlo)
}
@ -752,7 +852,7 @@ bool TAcquisizione_lavanderie_app::elabora_file(const TString& file, TLog_report
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ù).";
warning_box(str);
lv_popup_msg(str);
}
}
@ -762,8 +862,6 @@ 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 == 1184)
int cazzone = 1;
TString str;
str << "ATTENZIONE: è già presente un conteggio per il cliente " << codcf << " sull'articolo " << codart << "\n"
<< "Quantità conteggio attuale: " << qta << " Quantità conteggio precedente: " << qc->get_pezzi() << "\n"
@ -801,7 +899,7 @@ void TAcquisizione_lavanderie_app::controlla_documenti(TLog_report& rep, TArtico
//recupero i dati dalla chiave del TAssoc_array degli articoli
TArticoli_key keyart(key);
const long codcf = keyart.codcf();
const TString80 codart = keyart.codart();
const TCodice_articolo codart = keyart.codart();
const TDate datadoc = keyart.data();
//recupero i dati dal contenuto del TAssoc_array degli articoli
@ -953,7 +1051,7 @@ void TAcquisizione_lavanderie_app::genera_documenti(TLog_report& rep, TAssoc_arr
if(rit.get("S10").full())
magazzino = rit.get("S10").mid(0,5);
else
magazzino << ini_get_string(CONFIG_DITTA, "lv", "CODMAG") << ini_get_string(CONFIG_DITTA, "lv", "CODMAGN");
magazzino <<ini_get_string(CONFIG_DITTA, "lv", "CODMAG") << ini_get_string(CONFIG_DITTA, "lv", "CODMAGN");
if(con.get("S10").full())
magazzinoc = con.get("S10").mid(0,5);
@ -981,7 +1079,7 @@ 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.\n"
lv_popup_msg(TR("ATTENZIONE: il file importato non ha generato nessun documento.\n"
"controllare che il tracciato record sia coerente"));
else
ca.destroy();
@ -1021,11 +1119,6 @@ void TAcquisizione_lavanderie_app::sposta_file(const TString& file)
//ELABORA_FILE(), che effettivamente fa l'elaborazione
bool TAcquisizione_lavanderie_app::transfer()
{
//prendo il path dalla maschera
const TString& path = _msk->get(F_PATH);
TSheet_field& sheet = _msk->sfield(F_SHEET_NAME);
TFilename file;
TLog_report logrep(TR("Acquisizione da contapezzi"));
logrep.kill_duplicates(true);
@ -1034,64 +1127,37 @@ bool TAcquisizione_lavanderie_app::transfer()
int nrighe = 0;
int nrsalt = 0;
//per ogni riga dello sheet, leggo il suo contenuto, se contiene dei caratteri jolly
//preparo la lista dei file che soddisfano la maschera in quella directory e li elaboro
//tutti, altrimenti elaboro esattamente il file che è scritto sullo sheet
bool elaborato = false;
bool esiste = false;
FOR_EACH_SHEET_ROW(sheet, r1, row1) if (!row1->empty_items())
TString_array files;
if (_msk->file_list(files) > 0)
{
if (row1->find('/') >= 0 || row1->find('\\') >= 0)
file = *row1;
TFilename strname;
FOR_EACH_ARRAY_ROW(files, r1, row1)
{
strname = *row1;
elaborato |= elabora_file(strname, logrep, articoli, nrighe, nrsalt);
}
}
else
{
file = path;
file.add(*row1);
}
if (file.find('*') >= 0 || file.find('?') >= 0)
{
TString_array lista_file;
list_files(file, lista_file);
FOR_EACH_ARRAY_ROW(lista_file, r2, row2)
{
const TFilename strname = *row2;
if (strname.exist())
{
esiste = true;
elaborato = elabora_file(strname, logrep, articoli, nrighe, nrsalt);
}
}
}
else if (file.exist())
{
esiste = true;
elaborato = elabora_file(file, logrep, articoli, nrighe, nrsalt);
}
if (!esiste)
warning_box(TR("ATTENZIONE: non è stato trovato nessun file da elaborare"));
}
lv_popup_msg(TR("ATTENZIONE: non è stato trovato nessun file da elaborare"));
bool genera = false;
if (elaborato)
{
controlla_documenti(logrep, articoli, documenti);
bool genera = true;
genera = true;
if (_auto == "A")
if (_mode >= alpAUTO)
{
if (nrsalt > 0)
{
TString str;
str << "Sono stati ricevuti " << nrighe << " record, di cui " << nrighe - nrsalt
<< " sono stati elaborati correttamente" << " e " << nrsalt
<< " ignorati.\nSi desidera procedere con la generazione dei buoni di ritiro?";
if (!yesno_box(str))
genera = false;
<< " ignorati.";
lv_popup_msg(str);
}
}
else
@ -1101,13 +1167,11 @@ bool TAcquisizione_lavanderie_app::transfer()
<< " sono stati elaborati correttamente" << " e " << nrsalt
<< " ignorati.\nSi desidera procedere con la generazione dei buoni di ritiro?";
if (!yesno_box(str))
genera = false;
genera = yesno_box(str);
}
if (nrsalt == 0 || genera)
{
genera_documenti(logrep, documenti);
//diagnostica
@ -1121,44 +1185,20 @@ bool TAcquisizione_lavanderie_app::transfer()
buoni.add(kdoc, kdoc);
}
if (_mode == alpGUI)
{
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)
{
if(row1->full())
{
if (row1->find('/') >= 0 || row1->find('\\') >= 0)
file = *row1;
else
{
file = path;
file.add(*row1);
}
FOR_EACH_ARRAY_ROW(files, r1, row1)
sposta_file(*row1);
}
if (file.find('*') >= 0 || file.find('?') >= 0)
{
TString_array lista_file;
list_files(file, lista_file);
FOR_EACH_ARRAY_ROW(lista_file, r2, row2)
{
const TFilename strname(*row2);
if (strname.exist())
sposta_file(strname);
}
}
else if (file.exist())
sposta_file(file);
}
}
}
if (_auto != "A")
if (_mode == alpGUI)
{
TReport_book buc;
buc.add(logrep);
@ -1170,16 +1210,45 @@ bool TAcquisizione_lavanderie_app::transfer()
else
warning_box(TR("Generazione interrotta"));
}
_msk->send_key(K_SPACE, DLG_QUIT);
}
return true;
return genera;
}
void TAcquisizione_lavanderie_app::main_loop()
{
//lo lancio in automatico da linea di comando
if (_auto == "A")
if (_mode == alpAUTO)
{
if (_msk->some_file())
{
_msk->send_key(K_SPACE, DLG_OK);
if (_msk->run() == K_ENTER)
transfer();
}
} else
if (_mode == alpMONITOR)
{
const WINDOW task =TASK_WIN;
WINDOW tray = xvt_trayicon_create(task, 10220, name()); // Washing machine
if (tray != NULL_WIN)
xvt_vobj_set_visible(task, FALSE);
xvt_timer_create(_msk->win(), 60 * 1000L);
while (_msk->run() == K_ENTER)
{
// potrebbe essere passata mezzanotte
const TDate d(TODAY); _msk->set(F_DADATA, d); _msk->set(F_ADATA, d);
xvt_vobj_set_visible(task, TRUE);
if (transfer())
{
TExternal_app prelievo("lv2 -3 P -A");
prelievo.run();
}
xvt_vobj_set_visible(task, FALSE);
}
xvt_trayicon_destroy(tray);
}
else
while (_msk->run() == K_ENTER)
transfer();
}

View File

@ -48,9 +48,9 @@ BEGIN
FLAGS "D"
END
SPREADSHEET F_SHEET_NAME 78 10
SPREADSHEET F_SHEET_NAME 78 -1
BEGIN
PROMPT 1 9 "Nomi"
PROMPT 1 10 "Nomi"
ITEM "Nome file"
END
@ -64,7 +64,7 @@ BEGIN
PROMPT 1 1 "@bNome file"
END
STRING F_S_NAME 255 66
STRING F_S_NAME 260 66
BEGIN
PROMPT 3 2 "File "
FLAGS "D"

View File

@ -1,5 +1,6 @@
#include <applicat.h>
#include <automask.h>
#include <config.h>
#include <defmask.h>
#include <execp.h>
#include <reprint.h>

View File

@ -1,7 +1,9 @@
#include <applicat.h>
#include <automask.h>
#include <config.h>
#include <execp.h>
#include <progind.h>
#include <sheet.h>
#include <utility.h>
#include "../cg/cglib01.h"

View File

@ -1,9 +1,11 @@
#include <applicat.h>
#include <automask.h>
#include <config.h>
#include <execp.h>
#include <progind.h>
#include <relation.h>
#include <reputils.h>
#include <sheet.h>
#include <utility.h>
#include "../cg/cglib01.h"

View File

@ -2,6 +2,7 @@
#include <automask.h>
#include <progind.h>
#include <reputils.h>
#include <sheet.h>
#include <utility.h>
#include "../ce/ammce.h"
@ -85,8 +86,7 @@ bool TImporta_cesp_mask::on_field_event(TOperable_field& f, TField_event e, long
case F_NAME:
if (e == fe_button)
{
TArray_sheet as(-1, -1, 72, 20, TR("Selezione file"),
"File@32");
TArray_sheet as(-1, -1, 72, 20, TR("Selezione file"), "File@32");
TFilename path = get(F_PATH);
path.add("*.txt"); //files delle testate
list_files(path, as.rows_array());

View File

@ -117,6 +117,20 @@ long lv_find_contract(const long codcf, const long indsped, const TDate& data)
return cod;
}
bool lv_popup_msg(const char* fmt, ...)
{
char buff[256] = { 0 };
va_list arg;
va_start(arg, fmt);
vsprintf_s(buff, sizeof(buff), fmt, arg);
va_end(arg);
if (strchr(buff, '!'))
xvt_dm_popup_warning(buff);
else
xvt_dm_popup_message(buff);
return false;
}
///////////////////////////////////////////////////////////
// TCache_articoli_lavanderie
///////////////////////////////////////////////////////////

View File

@ -402,4 +402,7 @@ public:
TDoc_inventario(TDoc_inventario& dinv): TDocumento(dinv){};
};
// Finestra di notifica per messaggi non troppo critici, tipice nelle elaborazioni batch
bool lv_popup_msg(const char* fmt, ...);
#endif