Patch level :10.0
Files correlati : Ricompilazione Demo : [ ] Commento :programma baiseina git-svn-id: svn://10.65.10.50/trunk@19454 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5ba523c98d
commit
bd381e482e
@ -91,6 +91,9 @@ Importazione spese
|
||||
PS0816 AeC
|
||||
Caricamento listino personalizzato per AeC.
|
||||
|
||||
PS0830 Baiseina
|
||||
Esporta listino per caricare le casse
|
||||
|
||||
PS0872 Realplast
|
||||
Stampa Listini RealPlast
|
||||
Stampa Produzione RealPlast
|
||||
|
24
ps/ps0830.cpp
Executable file
24
ps/ps0830.cpp
Executable file
@ -0,0 +1,24 @@
|
||||
#include <xvt.h>
|
||||
|
||||
#include "ps0830.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
const int op = argc < 2 ? 0 : argv[1][1]-'0';
|
||||
switch (op)
|
||||
{
|
||||
case 0:
|
||||
ps0830100(argc,argv); // esportazione listino Baiseina
|
||||
break;
|
||||
default:
|
||||
ps0830100(argc,argv);
|
||||
break;
|
||||
}
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
1
ps/ps0830.h
Executable file
1
ps/ps0830.h
Executable file
@ -0,0 +1 @@
|
||||
int ps0830100(int argc, char* argv[]);
|
222
ps/ps0830100.cpp
Executable file
222
ps/ps0830100.cpp
Executable file
@ -0,0 +1,222 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <defmask.h>
|
||||
#include <execp.h>
|
||||
#include <progind.h>
|
||||
#include <relation.h>
|
||||
#include <reputils.h>
|
||||
#include <textset.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "..\ve\rcondv.h"
|
||||
#include "..\mg\codcorr.h"
|
||||
#include "..\mg\anamag.h"
|
||||
|
||||
#include "ps0830.h"
|
||||
#include "ps0830100.h"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Recordset esporta_listino
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
class TEsporta_listino_recordset : public TCSV_recordset
|
||||
{
|
||||
protected:
|
||||
virtual const TToken_string& sheet_head() const;
|
||||
public:
|
||||
virtual bool set(unsigned int fld, const TVariant& var);
|
||||
TEsporta_listino_recordset();
|
||||
};
|
||||
|
||||
const TToken_string& TEsporta_listino_recordset::sheet_head() const
|
||||
{
|
||||
TToken_string& head = get_tmp_string();
|
||||
head = "COD_EAN@20|PREZZO@10|CASSA@5|DESCRIZIONE@13|SCPERC@5|SCMON@5|CODOFF@5";
|
||||
return head;
|
||||
}
|
||||
|
||||
bool TEsporta_listino_recordset::set(unsigned int column, const TVariant& var)
|
||||
{
|
||||
TString str;
|
||||
if (var.is_date())
|
||||
{
|
||||
if (!var.is_empty())
|
||||
{
|
||||
const TDate data = var.as_date();
|
||||
str.format("%04d-%02d-%02d", data.year(), data.month(), data.day());
|
||||
}
|
||||
}
|
||||
else
|
||||
str << var;
|
||||
str.replace('|', '/');
|
||||
return TCSV_recordset::set(column, TVariant(str));
|
||||
}
|
||||
|
||||
TEsporta_listino_recordset::TEsporta_listino_recordset()
|
||||
: TCSV_recordset("CSV(\":\")")
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Mask esporta_listino
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
class TEsporta_listino_mask : public TAutomask
|
||||
{
|
||||
private:
|
||||
void serialize(bool bSave);
|
||||
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
|
||||
public:
|
||||
void esporta_listino(const bool anteprima);
|
||||
TEsporta_listino_mask();
|
||||
~TEsporta_listino_mask();
|
||||
};
|
||||
|
||||
void TEsporta_listino_mask::serialize(bool bSave)
|
||||
{
|
||||
const char* defpar = "ps";
|
||||
TConfig ini(CONFIG_DITTA, defpar);
|
||||
for (int i = fields()-1; i >= 0; i--)
|
||||
{
|
||||
TMask_field& f = fld(i);
|
||||
const TFieldref* fr = f.field();
|
||||
if (fr != NULL)
|
||||
{
|
||||
if (bSave)
|
||||
fr->write(ini, defpar, f.get());
|
||||
else
|
||||
f.set(fr->read(ini, defpar));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEsporta_listino_mask::TEsporta_listino_mask()
|
||||
: TAutomask("ps0830100")
|
||||
{
|
||||
serialize(false);
|
||||
}
|
||||
|
||||
TEsporta_listino_mask::~TEsporta_listino_mask()
|
||||
{
|
||||
serialize(true);
|
||||
}
|
||||
|
||||
bool TEsporta_listino_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
|
||||
{
|
||||
switch (f.dlg())
|
||||
{
|
||||
case DLG_ELABORA:
|
||||
if (e == fe_button)
|
||||
{
|
||||
esporta_listino(false);
|
||||
}
|
||||
break;
|
||||
case DLG_PRINT:
|
||||
if (e == fe_button)
|
||||
{
|
||||
esporta_listino(true);
|
||||
}
|
||||
break;
|
||||
case DLG_QUIT:
|
||||
if (e == fe_button)
|
||||
{
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TEsporta_listino_mask::esporta_listino(const bool anteprima)
|
||||
{
|
||||
// query su listino
|
||||
TString query;
|
||||
query << "USE RCONDV\n";
|
||||
query << "SELECT (CATVEN=\"DE\") && (RCONDV.PREZZO>\"0\") && (CODCORR.CODARTALT!=\"\")\n";
|
||||
query << "JOIN CODCORR INTO CODART==CODRIGA NRIGA=1\n";
|
||||
query << "JOIN ANAMAG INTO CODART==CODRIGA\n";
|
||||
query << "ORDER BY CODCORR.CODARTALT, ANAMAG.REPARTO[2,3], RCONDV.CODRIGA";
|
||||
TISAM_recordset listino(query);
|
||||
|
||||
TEsporta_listino_recordset csv;
|
||||
|
||||
const int items = listino.items();
|
||||
|
||||
TProgind pi(items, "Estrazione listino...", true, true);
|
||||
for (bool ok = listino.move_first(); ok; ok = listino.move_next())
|
||||
{
|
||||
if (!pi.addstatus(1))
|
||||
break;
|
||||
csv.new_rec("");
|
||||
csv.set(0, listino.get("CODCORR.CODARTALT"));
|
||||
real prezzo = listino.get(RCONDV_PREZZO).as_real();
|
||||
prezzo.round(2);
|
||||
prezzo = prezzo*100;
|
||||
csv.set(1, TVariant(prezzo));
|
||||
csv.set(2, listino.get("ANAMAG.REPARTO[2,3]"));
|
||||
csv.set(3, listino.get("ANAMAG.DESCR[1,12]"));
|
||||
csv.set(4, "0");
|
||||
csv.set(5, "0");
|
||||
csv.set(6, "0");
|
||||
} //for(move_first()..
|
||||
if (anteprima)
|
||||
{
|
||||
//TRecordset_sheet sheet(csv, TR("Elenco di controllo"));
|
||||
//sheet.run();
|
||||
|
||||
csv.save_as("ps0830100.xls", fmt_silk);
|
||||
xvt_sys_goto_url("ps0830100.xls", "open");
|
||||
}
|
||||
else
|
||||
{
|
||||
TFilename file = get(F_PATH);
|
||||
file.add(get(F_NAME));
|
||||
csv.save_as(file, fmt_text);
|
||||
|
||||
if (yesno_box("Generazione listino terminata. Procedo con l'invio?"))
|
||||
{
|
||||
TFilename appname = "aggiorna.bat";
|
||||
if (appname.exist())
|
||||
{
|
||||
TExternal_app a("aggiorna.bat");
|
||||
a.run(false,false);
|
||||
}
|
||||
else
|
||||
message_box("Impossibile procedere con l'invio, non esiste l'applicazione aggiorna.bat");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TEsporta_listino applicazione
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TEsporta_listino_app : public TSkeleton_application
|
||||
{
|
||||
|
||||
protected:
|
||||
virtual bool check_autorization() const {return false;}
|
||||
virtual const char * extra_modules() const {return "ve";}
|
||||
virtual void main_loop();
|
||||
};
|
||||
|
||||
void TEsporta_listino_app::main_loop()
|
||||
{
|
||||
open_files(LF_RCONDV, LF_ANAMAG, LF_CODCORR, 0);
|
||||
TEsporta_listino_mask m;
|
||||
m.run();
|
||||
}
|
||||
|
||||
int ps0830100(int argc, char* argv[])
|
||||
{
|
||||
TEsporta_listino_app app;
|
||||
app.run(argc, argv, TR("Esporta listino"));
|
||||
return 0;
|
||||
}
|
5
ps/ps0830100.h
Executable file
5
ps/ps0830100.h
Executable file
@ -0,0 +1,5 @@
|
||||
#define F_CODDITTA 101
|
||||
#define F_RAGSOC 102
|
||||
#define F_PATH 103
|
||||
#define F_NAME 104
|
||||
|
66
ps/ps0830100.uml
Executable file
66
ps/ps0830100.uml
Executable file
@ -0,0 +1,66 @@
|
||||
#include "ps0830100.h"
|
||||
|
||||
PAGE "Esportazione listino" -1 -1 80 14
|
||||
|
||||
GROUPBOX DLG_NULL 76 3
|
||||
BEGIN
|
||||
PROMPT 2 1 "@bDitta corrente"
|
||||
END
|
||||
|
||||
NUMBER F_CODDITTA 5
|
||||
BEGIN
|
||||
PROMPT 3 2 "Codice "
|
||||
FLAGS "FD"
|
||||
USE LF_NDITTE
|
||||
INPUT CODDITTA F_CODDITTA
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
PROMPT 23 2 ""
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 76 4
|
||||
BEGIN
|
||||
PROMPT 2 4 "Esportazione"
|
||||
END
|
||||
|
||||
STRING F_PATH 255 40
|
||||
BEGIN
|
||||
PROMPT 3 5 "Cartella "
|
||||
DSELECT
|
||||
FLAGS "M"
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD PATH
|
||||
WARNING "Selezionare una cartella valida!"
|
||||
END
|
||||
|
||||
STRING F_NAME 30
|
||||
BEGIN
|
||||
PROMPT 3 6 "Nome file "
|
||||
FLAGS "M"
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD NAME
|
||||
END
|
||||
|
||||
BUTTON DLG_PRINT 9 2
|
||||
BEGIN
|
||||
PROMPT -13 -1 "~Anteprima"
|
||||
END
|
||||
|
||||
BUTTON DLG_ELABORA 9 2
|
||||
BEGIN
|
||||
PROMPT -23 -1 "~Esporta"
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 9 2
|
||||
BEGIN
|
||||
PROMPT -33 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
Loading…
x
Reference in New Issue
Block a user