Patch level : 10.0
Files correlati : ve1.exe Ricompilazione Demo : [ ] Commento : Aggiunto supporto per transazioni di stampa documenti git-svn-id: svn://10.65.10.50/trunk@19710 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
06fb206415
commit
9e3a430923
135
ve/ve1300.cpp
135
ve/ve1300.cpp
@ -11,6 +11,7 @@
|
||||
#include <reputils.h>
|
||||
#include <spotlite.h>
|
||||
#include <statbar.h>
|
||||
#include <textset.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include <clifo.h>
|
||||
@ -209,6 +210,63 @@ TDoc_recordset::~TDoc_recordset()
|
||||
delete _doc;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TTrans_recordset
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TTrans_recordset : public TAS400_recordset
|
||||
{
|
||||
protected:
|
||||
virtual bool parse_query(const TString& query, TFilename& n);
|
||||
virtual bool load_file(const TFilename& n);
|
||||
|
||||
public:
|
||||
TTrans_recordset(const char* ininame);
|
||||
};
|
||||
|
||||
bool TTrans_recordset::parse_query(const TString& query, TFilename& n)
|
||||
{
|
||||
n = query;
|
||||
return n.exist() ? _qt_select : _qt_none;
|
||||
}
|
||||
|
||||
bool TTrans_recordset::load_file(const TFilename& n)
|
||||
{
|
||||
TConfig ini(n, "33");
|
||||
|
||||
TToken_string dokey;
|
||||
for (int idx = 0; ; idx++)
|
||||
{
|
||||
dokey = ini.get("Doc", NULL, idx);
|
||||
if (dokey.blank())
|
||||
break;
|
||||
const TRectype& doc = cache().get(LF_DOC, dokey);
|
||||
if (!doc.empty())
|
||||
{
|
||||
new_rec();
|
||||
for (unsigned int c = 0; c < columns(); c++)
|
||||
{
|
||||
const TRecordset_column_info& ci = column_info(c);
|
||||
const char* fldname = ci._name;
|
||||
set(fldname, doc.get(fldname));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return items() > 0;
|
||||
}
|
||||
|
||||
TTrans_recordset::TTrans_recordset(const char* ininame) : TAS400_recordset(ininame)
|
||||
{
|
||||
create_field(DOC_PROVV, -1, 1, _alfafld, true);
|
||||
create_field(DOC_ANNO, -1, 4, _intfld, true);
|
||||
create_field(DOC_CODNUM, -1, 4, _alfafld, true);
|
||||
create_field(DOC_NDOC, -1, 4, _longfld, true);
|
||||
create_field(DOC_TIPODOC, -1, 4, _alfafld);
|
||||
create_field(DOC_TIPOCF, -1, 1, _alfafld);
|
||||
create_field(DOC_CODCF, -1, 6, _longfld);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TReport_doc
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -869,9 +927,9 @@ public:
|
||||
|
||||
class TReport_doc_app : public TSkeleton_application
|
||||
{
|
||||
TReport_doc_mask* _msk;
|
||||
enum TOutput_mode { out_preview, out_print, out_mail, out_signed_mail, out_pdf, out_signed_pdf };
|
||||
|
||||
enum TOutput_mode {out_preview, out_print, out_mail, out_signed_mail, out_pdf, out_signed_pdf};
|
||||
TReport_doc_mask* _msk;
|
||||
|
||||
int _anno;
|
||||
TString16 _codnum; // codice numerazione / profilo
|
||||
@ -882,8 +940,9 @@ protected:
|
||||
void add_data_filter(TString& query, bool from) const;
|
||||
void add_ndoc_filter(TString& query, bool from) const;
|
||||
void add_filter(TString& str, bool from) const;
|
||||
bool print_loop(const TString& query, TOutput_mode mode);
|
||||
bool print_loop(TRecordset& doc, TOutput_mode mode, bool is_definitive);
|
||||
void print_selection(TOutput_mode mode);
|
||||
void print_trans(const char* ininame);
|
||||
TOutput_mode key2mode(KEY k) const;
|
||||
|
||||
void set_next_pdf(int an, const char* cn, long nd, char tcf, long cf);
|
||||
@ -1001,29 +1060,12 @@ void TReport_doc_app::print_extra_copies(TReport_doc& report, const TRecordset&
|
||||
report.print(doc, book, false, extra_copies, false, false, false);
|
||||
}
|
||||
|
||||
bool TReport_doc_app::print_loop(const TString& query, TOutput_mode mode)
|
||||
bool TReport_doc_app::print_loop(TRecordset& doc, TOutput_mode mode, bool is_definitive)
|
||||
{
|
||||
TISAM_recordset doc(query);
|
||||
const int docs = doc.items();
|
||||
if (docs <= 0)
|
||||
return false;
|
||||
|
||||
bool is_definitive = false;
|
||||
if (argc() > 7) // Batch
|
||||
is_definitive = *argv(7) == 'D';
|
||||
else
|
||||
{
|
||||
if (argc() < 6) // Vieta i link quando sono in batch
|
||||
is_definitive = _msk->get(F_TIPOST) == "D";
|
||||
else
|
||||
{
|
||||
const KEY k = yesnocancel_box(FR("Stampare in definitiva %d documenti?"), docs);
|
||||
if (k == K_ESC)
|
||||
return false;
|
||||
is_definitive = k == K_YES;
|
||||
}
|
||||
}
|
||||
|
||||
if (mode == out_signed_mail && !xvt_sign_start())
|
||||
{
|
||||
if (yesno_box(TR("Si desidera generare comunque documenti non firmati?")))
|
||||
@ -1204,7 +1246,48 @@ void TReport_doc_app::print_selection(TOutput_mode mode)
|
||||
query << "USE " << LF_DOC;
|
||||
add_filter(query, true);
|
||||
add_filter(query, false);
|
||||
print_loop(query, mode);
|
||||
|
||||
TISAM_recordset doc(query);
|
||||
const TRecnotype docs = doc.items();
|
||||
if (docs > 0)
|
||||
{
|
||||
bool is_definitive = false;
|
||||
if (argc() > 7) // Batch
|
||||
is_definitive = *argv(7) == 'D';
|
||||
else
|
||||
{
|
||||
if (argc() < 6) // Vieta i link quando sono in batch
|
||||
is_definitive = _msk->get(F_TIPOST) == "D";
|
||||
else
|
||||
{
|
||||
const KEY k = yesnocancel_box(FR("Stampare in definitiva %ld documenti?"), docs);
|
||||
if (k == K_ESC)
|
||||
return;
|
||||
is_definitive = k == K_YES;
|
||||
}
|
||||
}
|
||||
print_loop(doc, mode, is_definitive);
|
||||
}
|
||||
}
|
||||
|
||||
// Elabora una transazione del tipo
|
||||
// [Transaction]
|
||||
// Action = Print
|
||||
// Mode = D
|
||||
// [33]
|
||||
// Doc(0)=D|2009|F01|1
|
||||
// Doc(1)=D|2009|A02|2
|
||||
void TReport_doc_app::print_trans(const char* ininame)
|
||||
{
|
||||
TTrans_recordset doc(ininame);
|
||||
if (doc.items() > 0)
|
||||
{
|
||||
const TString& a = ini_get_string(ininame, "Transaction", "Action");
|
||||
const TString& m = ini_get_string(ininame, "Transaction", "Mode");
|
||||
const TOutput_mode mode = key2mode(a[0]);
|
||||
const bool is_definitive = m[0] == 'D';
|
||||
print_loop(doc, mode, is_definitive);
|
||||
}
|
||||
}
|
||||
|
||||
//Allah!!
|
||||
@ -1237,6 +1320,14 @@ void TReport_doc_app::main_loop()
|
||||
if (a > 2)
|
||||
{
|
||||
const TFixed_string arg = argv(2);
|
||||
|
||||
// Gestione transazioni di stampa
|
||||
if (arg.starts_with("-i"))
|
||||
{
|
||||
print_trans(arg.mid(2));
|
||||
return;
|
||||
}
|
||||
|
||||
TString4 codnum = arg.left(4);
|
||||
if (arg.len() > 4 || cache().get("%NUM", arg).empty())
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user