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

View File

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

View File

@ -1,21 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?> <?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> <description>Stampa valore convenzionale per articolo</description>
<font face="Courier New" size="10" /> <font face="Courier New" size="10" />
<section type="Head" height="6" pattern="1"> <section type="Head" height="6" pattern="1">
<field type="Stringa" width="60" pattern="1"> <field type="Stringa" width="60" pattern="1">
<source>#SYSTEM.RAGSOC</source> <source>#SYSTEM.RAGSOC</source>
</field> </field>
<field x="66.5" type="Testo" width="5" height="1.5" pattern="1" text="Pag." /> <field x="82" type="Testo" width="5" height="1.5" pattern="1" text="Pag." />
<field x="71.5" type="Stringa" width="10" pattern="1"> <field x="87" type="Stringa" width="10" pattern="1">
<prescript>MESSAGE _PAGENO</prescript> <prescript>MESSAGE _PAGENO</prescript>
</field> </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" /> <font face="Courier New" bold="1" size="14" />
<prescript description="H0.0 PRESCRIPT">"Stampa riepilogo consegne del "
"#DATA" @
+
#THIS !</prescript>
</field> </field>
<field x="0.5" y="3.75" type="Testo" width="20" pattern="1" text="Codice"> <field x="0.5" y="3.75" type="Testo" width="20" pattern="1" text="Codice">
<source>RDOC.CODART</source> <source>RDOC.CODART</source>
@ -23,54 +19,99 @@
<field x="21" y="3.75" type="Testo" width="30" pattern="1" text="Descrizione articolo"> <field x="21" y="3.75" type="Testo" width="30" pattern="1" text="Descrizione articolo">
<source>ANAMAG.DESCR</source> <source>ANAMAG.DESCR</source>
</field> </field>
<field border="2" y="4.75" type="Linea" width="82" height="0" pattern="1" /> <field border="2" y="4.75" type="Linea" width="95" height="0" pattern="1" />
<field x="49" y="3.75" type="Testo" align="right" width="10" id="101" pattern="1" text="Dotaz. Od."> <field x="61" y="3.75" type="Testo" align="right" width="12" id="101" pattern="1" text="Dotaz. Od.">
<source>RDOC.QTA</source> <source>RDOC.QTA</source>
</field> </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> <source>RDOC.QTA</source>
</field> </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> <source>RDOC.QTA</source>
</field> </field>
</section> </section>
<section type="Head" level="1" pattern="1"> <section type="Head" level="1" pattern="1">
<prescript description="H1 PRESCRIPT">0 #F1.101 ! <prescript description="H1 PRESCRIPT">MESSAGE RESET,F1</prescript>
0 #F1.102 ! </section>
0 #F1.103 !</prescript> <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>
<section type="Body" pattern="1" /> <section type="Body" pattern="1" />
<section type="Body" level="1" pattern="1"> <section type="Body" level="1" pattern="1">
<field x="52" type="Numero" align="right" width="7" id="100" pattern="1" text="###.###"> <field type="Stringa" hidden="1" width="1" pattern="1">
<source>#ART.DOTOD</source> <source>#DETT</source>
<prescript description="B1.0 PRESCRIPT">MESSAGE EMPTY HIDE,B1
MESSAGE SHOW,B1</prescript>
</field> </field>
<field x="59" type="Prezzo" align="right" width="10" id="101" pattern="1" text="###.###.###,@@"> <field x="12" type="Stringa" width="40" pattern="1">
<source>UMART.PREZZO</source> <prescript description="B1.0 PRESCRIPT">MESSAGE ISAMREAD,20,TIPOCF=#10!CODCF=#20,RAGSOC</prescript>
</field> </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> <source>#100*#101</source>
<postscript description="B1.102 POSTSCRIPT">MESSAGE ADD,F1.102 <prescript description="B1.102 PRESCRIPT">MESSAGE ADD,F2.102</prescript>
</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>
</field> </field>
</section> </section>
<section type="Foot" height="2" pattern="1" /> <section type="Foot" height="2" pattern="1" />
<section type="Foot" level="1" 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 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 description="F1.102 POSTSCRIPT">MESSAGE ADD,F1.102
</postscript> </postscript>
</field> </field>
</section> </section>
<sql>USE ANAMAG <section type="Foot" level="2" pattern="1">
JOIN UMART INTO CODART==CODART NRIGA==1 <field x="61" type="Numero" align="right" width="12" id="100" pattern="1" text="###.###">
FROM CODART=#DACODART <font face="Courier New" bold="1" size="10" />
TO CODART=#ACODART <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> </sql>
</report> </report>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,6 @@
#include <applicat.h> #include <applicat.h>
#include <automask.h> #include <automask.h>
#include <config.h>
#include <execp.h> #include <execp.h>
#include <progind.h> #include <progind.h>
#include <reputils.h> #include <reputils.h>
@ -28,7 +29,7 @@ class TGenera_documenti_msk : public TAutomask
{ {
public: public:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); 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 //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; TConfig* _configlv;
char _buono; char _buono;
long _ndoc; long _ndoc;
bool _has_gui;
private: private:
//Metodi per la generazione dei documenti //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); const long old_ndoc = doc.get_long(DOC_NDOC);
doc.renum_ndoc(); doc.renum_ndoc();
const long new_ndoc = doc.get_long(DOC_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; ++numdocgen;
} }
@ -1287,12 +1290,14 @@ bool TGenera_documenti_app::transfer()
} }
} }
if (_has_gui)
{
if (documenti.items() == 0) 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 else
{ {
if (adata < TDate(TODAY) && _msk->get_int(F_TPGEN) == 0) 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 else
{ {
TReport_book buc; TReport_book buc;
@ -1305,9 +1310,9 @@ bool TGenera_documenti_app::transfer()
if (numdocgen > 1) if (numdocgen > 1)
str << TR("Sono stati generati ") << numdocgen << TR(" buoni."); str << TR("Sono stati generati ") << numdocgen << TR(" buoni.");
else else
str << TR("E' stato generato ") << numdocgen << TR(" buono."); str << TR("E' stato generato un buono.");
message_box(str); lv_popup_msg(str);
message_box(TR("Generazione terminata")); }
} }
} }
} }
@ -1317,11 +1322,23 @@ bool TGenera_documenti_app::transfer()
void TGenera_documenti_app::main_loop() 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) while (_msk->run() == K_ENTER)
{ {
transfer(); 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 <applicat.h>
#include <automask.h> #include <automask.h>
#include <config.h>
#include <execp.h>
#include <reputils.h> #include <reputils.h>
#include <reprint.h> #include <reprint.h>
#include <urldefid.h> #include <urldefid.h>
@ -22,7 +24,7 @@
///////////////////////////// /////////////////////////////
//classe TArticoli_key //classe TArticoli_key
class TArticoli_key: public TToken_string class TArticoli_key : public TToken_string
{ {
public: public:
const long codcf(); const long codcf();
@ -37,7 +39,7 @@ public:
//CODCF: metodo che restituisce il codcf dalla TToken_string chiave degli articoli //CODCF: metodo che restituisce il codcf dalla TToken_string chiave degli articoli
const long TArticoli_key::codcf() 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 //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 //DATA: metodo che restituisce la data dalla TToken_string chiave degli articoli
const TDate TArticoli_key::data() const TDate TArticoli_key::data()
{ {
return (TDate)get(2); return TDate(get(2));
} }
//metodi costruttori //metodi costruttori
@ -120,7 +122,7 @@ const char* TDocumenti_key::codart()
//DATA: metodo che restituisce la data dalla TToken_string chiave dei documenti //DATA: metodo che restituisce la data dalla TToken_string chiave dei documenti
const TDate TDocumenti_key::data() const TDate TDocumenti_key::data()
{ {
return (TDate)get(6); return TDate(get(6));
} }
//metodi costruttori //metodi costruttori
@ -251,11 +253,93 @@ TQuantita_contate* TArticoli_contati::quantita(long codcf, const TString& codart
class TAcquisizione_msk: public TAutomask class TAcquisizione_msk: public TAutomask
{ {
protected: protected:
virtual long handler(WINDOW task, EVENT* ep);
virtual bool on_field_event(TOperable_field& o,TField_event e,long jolly); virtual bool on_field_event(TOperable_field& o,TField_event e,long jolly);
public: public:
bool some_file() const;
int file_list(TString_array& fl) const;
TAcquisizione_msk(); 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 //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) 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 class TAcquisizione_lavanderie_app : public TSkeleton_application
{ {
TAcquisizione_msk* _msk; TAcquisizione_msk* _msk;
TString4 _auto;
enum TalpMode { alpGUI, alpAUTO, alpMONITOR };
TalpMode _mode;
TString4 _gr; TString4 _gr;
protected: protected:
@ -602,32 +688,46 @@ protected:
public: public:
bool transfer(); bool transfer();
virtual void main_loop(); virtual void main_loop();
TAcquisizione_lavanderie_app() : _msk(NULL) {}
}; };
//CREATE: metodo costruttore //CREATE: metodo costruttore
bool TAcquisizione_lavanderie_app::create() 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(); _msk = new TAcquisizione_msk();
TSheet_field& sheet = _msk->sfield(F_SHEET_NAME); TSheet_field& sheet = _msk->sfield(F_SHEET_NAME);
sheet.set_auto_append(); 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 //se ho più di un parametro, allora lo sto lanciando da linea di comando, e ne devo tenere conto
if (argc() > 2) if (argc() > 2)
{ {
_auto = argv(2); const TFixed_string a(argv(2));
_auto = _auto.right(1); switch (toupper(a[1]))
{
case 'A': _mode = alpAUTO; break;
case 'M': _mode = alpMONITOR; break;
default: break;
}
if (argc() > 3)
{
_gr = argv(3); _gr = argv(3);
_gr = _gr.right(1); _gr = _gr.right(1);
} }
else
{
_auto = "N";
_gr = "";
} }
if (_gr == "S" || _gr.empty()) if (_gr == "S" || _gr.blank())
_msk->set(F_RICGIRI, "X"); _msk->set(F_RICGIRI, "X");
else else
_msk->reset(F_RICGIRI); _msk->reset(F_RICGIRI);
@ -642,7 +742,7 @@ bool TAcquisizione_lavanderie_app::create()
bool TAcquisizione_lavanderie_app::destroy() bool TAcquisizione_lavanderie_app::destroy()
{ {
delete _msk; delete _msk;
return TApplication::destroy(); return TSkeleton_application::destroy();
} }
//ELABORA_FILE: metodo che effettivamente fa l'elaborazione del file //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; TString str;
str << "L'articolo " << codart << " non è previsto nel contratto del cliente " << codcf; 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) //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; TString str;
str << "Attenzione! Il cliente " << codcf << " per l'articolo " << codart << " ha una dotazione di " 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); 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 //altrimenti aggiungila con la rispettiva al TAssoc_array con la quantità appena conteggiata
if (!qc->is_empty()) if (!qc->is_empty())
{ {
if(codcf == 1184)
int cazzone = 1;
TString str; TString str;
str << "ATTENZIONE: è già presente un conteggio per il cliente " << codcf << " sull'articolo " << codart << "\n" 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" << "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 //recupero i dati dalla chiave del TAssoc_array degli articoli
TArticoli_key keyart(key); TArticoli_key keyart(key);
const long codcf = keyart.codcf(); const long codcf = keyart.codcf();
const TString80 codart = keyart.codart(); const TCodice_articolo codart = keyart.codart();
const TDate datadoc = keyart.data(); const TDate datadoc = keyart.data();
//recupero i dati dal contenuto del TAssoc_array degli articoli //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()) if(rit.get("S10").full())
magazzino = rit.get("S10").mid(0,5); magazzino = rit.get("S10").mid(0,5);
else 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()) if(con.get("S10").full())
magazzinoc = con.get("S10").mid(0,5); 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()) 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")); "controllare che il tracciato record sia coerente"));
else else
ca.destroy(); ca.destroy();
@ -1021,11 +1119,6 @@ void TAcquisizione_lavanderie_app::sposta_file(const TString& file)
//ELABORA_FILE(), che effettivamente fa l'elaborazione //ELABORA_FILE(), che effettivamente fa l'elaborazione
bool TAcquisizione_lavanderie_app::transfer() 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")); TLog_report logrep(TR("Acquisizione da contapezzi"));
logrep.kill_duplicates(true); logrep.kill_duplicates(true);
@ -1034,64 +1127,37 @@ bool TAcquisizione_lavanderie_app::transfer()
int nrighe = 0; int nrighe = 0;
int nrsalt = 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 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) TFilename strname;
file = *row1; FOR_EACH_ARRAY_ROW(files, r1, row1)
{
strname = *row1;
elaborato |= elabora_file(strname, logrep, articoli, nrighe, nrsalt);
}
}
else else
{ lv_popup_msg(TR("ATTENZIONE: non è stato trovato nessun file da elaborare"));
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"));
}
bool genera = false;
if (elaborato) if (elaborato)
{ {
controlla_documenti(logrep, articoli, documenti); controlla_documenti(logrep, articoli, documenti);
bool genera = true; genera = true;
if (_auto == "A") if (_mode >= alpAUTO)
{ {
if (nrsalt > 0) if (nrsalt > 0)
{ {
TString str; TString str;
str << "Sono stati ricevuti " << nrighe << " record, di cui " << nrighe - nrsalt str << "Sono stati ricevuti " << nrighe << " record, di cui " << nrighe - nrsalt
<< " sono stati elaborati correttamente" << " e " << nrsalt << " sono stati elaborati correttamente" << " e " << nrsalt
<< " ignorati.\nSi desidera procedere con la generazione dei buoni di ritiro?"; << " ignorati.";
lv_popup_msg(str);
if (!yesno_box(str))
genera = false;
} }
} }
else else
@ -1101,13 +1167,11 @@ bool TAcquisizione_lavanderie_app::transfer()
<< " sono stati elaborati correttamente" << " e " << nrsalt << " sono stati elaborati correttamente" << " e " << nrsalt
<< " ignorati.\nSi desidera procedere con la generazione dei buoni di ritiro?"; << " ignorati.\nSi desidera procedere con la generazione dei buoni di ritiro?";
if (!yesno_box(str)) genera = yesno_box(str);
genera = false;
} }
if (nrsalt == 0 || genera) if (nrsalt == 0 || genera)
{ {
genera_documenti(logrep, documenti); genera_documenti(logrep, documenti);
//diagnostica //diagnostica
@ -1121,44 +1185,20 @@ bool TAcquisizione_lavanderie_app::transfer()
buoni.add(kdoc, kdoc); buoni.add(kdoc, kdoc);
} }
if (_mode == alpGUI)
{
switch (buoni.items()) switch (buoni.items())
{ {
case 0: warning_box(TR("Non è stato generato alcun buono di ritiro.")); break; 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; 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; default: message_box(FR("Sono stati generati %d buoni di ritiro."), buoni.items()); break;
} }
}
FOR_EACH_SHEET_ROW(sheet, r1, row1) FOR_EACH_ARRAY_ROW(files, r1, row1)
{ sposta_file(*row1);
if(row1->full())
{
if (row1->find('/') >= 0 || row1->find('\\') >= 0)
file = *row1;
else
{
file = path;
file.add(*row1);
} }
if (file.find('*') >= 0 || file.find('?') >= 0) if (_mode == alpGUI)
{
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")
{ {
TReport_book buc; TReport_book buc;
buc.add(logrep); buc.add(logrep);
@ -1170,16 +1210,45 @@ bool TAcquisizione_lavanderie_app::transfer()
else else
warning_box(TR("Generazione interrotta")); warning_box(TR("Generazione interrotta"));
} }
_msk->send_key(K_SPACE, DLG_QUIT);
} }
return true; return genera;
} }
void TAcquisizione_lavanderie_app::main_loop() void TAcquisizione_lavanderie_app::main_loop()
{ {
//lo lancio in automatico da linea di comando //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); _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) while (_msk->run() == K_ENTER)
transfer(); transfer();
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -2,6 +2,7 @@
#include <automask.h> #include <automask.h>
#include <progind.h> #include <progind.h>
#include <reputils.h> #include <reputils.h>
#include <sheet.h>
#include <utility.h> #include <utility.h>
#include "../ce/ammce.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: case F_NAME:
if (e == fe_button) if (e == fe_button)
{ {
TArray_sheet as(-1, -1, 72, 20, TR("Selezione file"), TArray_sheet as(-1, -1, 72, 20, TR("Selezione file"), "File@32");
"File@32");
TFilename path = get(F_PATH); TFilename path = get(F_PATH);
path.add("*.txt"); //files delle testate path.add("*.txt"); //files delle testate
list_files(path, as.rows_array()); 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; 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 // TCache_articoli_lavanderie
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////

View File

@ -402,4 +402,7 @@ public:
TDoc_inventario(TDoc_inventario& dinv): TDocumento(dinv){}; 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 #endif