Patch level : 10.0 298
Files correlati : pe0.exe Ricompilazione Demo : [ ] Commento : Preventivazione (CRPA) git-svn-id: svn://10.65.10.50/trunk@18860 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
56f57e97aa
commit
43a10c96f9
@ -219,6 +219,12 @@ TObject* TVariable_rectype::dup() const
|
||||
return o;
|
||||
}
|
||||
|
||||
void TVariable_rectype::load_memo()
|
||||
{
|
||||
_memo_fld_to_load = true;
|
||||
get_str("DUMMY");
|
||||
}
|
||||
|
||||
TFieldtypes TVariable_rectype::type(const char* fieldname) const
|
||||
{
|
||||
if (_virtual_fields.objptr(fieldname))
|
||||
|
@ -112,6 +112,8 @@ public:
|
||||
// @cmember Duplica il tipo di record
|
||||
virtual TObject* dup() const;
|
||||
|
||||
void load_memo();
|
||||
|
||||
// @cmember Setta il record come non vuoto (chiama <mf TRectype::setempty>
|
||||
|
||||
virtual TFieldtypes type(const char* fieldname) const;
|
||||
|
114
pe/pe0500.cpp
114
pe/pe0500.cpp
@ -25,6 +25,7 @@ public:
|
||||
|
||||
void TGenerazione_esecutivo::genera_matricola(TRiga_documento & row)
|
||||
{
|
||||
row.zero(RDOC_LIVELLO);
|
||||
for (int livello = 0; livello < 4; livello++)
|
||||
{
|
||||
TToken_string * str = row.tipo().genconf(livello);
|
||||
@ -84,7 +85,18 @@ void TGenerazione_esecutivo::genera_matricola(TRiga_documento & row)
|
||||
code << fld.read(anamag);
|
||||
}
|
||||
}
|
||||
row.put(RDOC_LIVELLO, code);
|
||||
TString c(row.get(RDOC_LIVELLO));
|
||||
|
||||
c << code;
|
||||
row.put(RDOC_LIVELLO, c);
|
||||
TTable l("GCG");
|
||||
c.cut(0);
|
||||
c << (livello + 1) << code;
|
||||
l.put("CODTAB", c);
|
||||
c.cut(0);
|
||||
c << "Matricola " << code;
|
||||
l.put("S0", c);
|
||||
l.write();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -108,10 +120,56 @@ void TGenerazione_esecutivo::post_process_output(TLista_documenti& doc_out)
|
||||
genera_matricola(row);
|
||||
}
|
||||
}
|
||||
for (int d = 0; d < items; d++)
|
||||
{
|
||||
TDocumento& doc = doc_out[d];
|
||||
const int rows = doc.physical_rows();
|
||||
|
||||
for (int r = 1; r <= rows; r++)
|
||||
{
|
||||
TRiga_documento & row = doc[r];
|
||||
|
||||
if (row.get_int(RDOC_LEVEL) == 0 && row.get(RDOC_LIVELLO).full())
|
||||
{
|
||||
const real qta = row.get_real(RDOC_QTA);
|
||||
const int times = qta.integer() - 1;
|
||||
|
||||
if (times > 0)
|
||||
{
|
||||
row.put(RDOC_QTA, UNO);
|
||||
for (int q = 0 ; q < times; q++)
|
||||
{
|
||||
TRiga_documento & new_row = doc.new_row(row.tipo().codice());
|
||||
|
||||
TDocumento::copy_data(new_row, row);
|
||||
new_row.put(RDOC_QTA, UNO);
|
||||
genera_matricola(new_row);
|
||||
for (int p = r + 1; p <= rows && doc[p].get_int(RDOC_LEVEL) > 0; p++)
|
||||
{
|
||||
const TRiga_documento & child_row = doc[p];
|
||||
TRiga_documento & new_child_row = doc.new_row(child_row.tipo().codice());
|
||||
|
||||
TDocumento::copy_data(new_child_row, child_row);
|
||||
new_child_row.put(RDOC_QTA, child_row.get_real(RDOC_QTA) / qta);
|
||||
}
|
||||
}
|
||||
for (int p = r + 1; p <= rows && doc[p].get_int(RDOC_LEVEL) > 0; p++)
|
||||
{
|
||||
TRiga_documento & child_row = doc[p];
|
||||
|
||||
child_row.put(RDOC_QTA, child_row.get_real(RDOC_QTA) / qta);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int j = 1 ; j < doc.physical_rows(); j++)
|
||||
if (doc[j].get(RDOC_TREE).blank())
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TGenerazione_orsine
|
||||
// TGenerazione_ordine
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TGenerazione_ordine : public TCopia_documento
|
||||
@ -210,11 +268,53 @@ class TGenEsecutivo_app : public TSkeleton_application
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
void split_docs(TLista_documenti & list, const TDocumento & doc);
|
||||
public:
|
||||
virtual void main_loop();
|
||||
};
|
||||
|
||||
void TGenEsecutivo_app::split_docs(TLista_documenti & list, const TDocumento & doc)
|
||||
{
|
||||
list.destroy(-1);
|
||||
|
||||
const int rows = doc.physical_rows();
|
||||
int last_pos = 0, before_pos = 0;
|
||||
int p = 0;
|
||||
|
||||
for (int i = 1; i <= rows; i++)
|
||||
{
|
||||
const int level = doc[i].get_int(RDOC_LEVEL);
|
||||
|
||||
if (level == 0)
|
||||
{
|
||||
if (last_pos > 0)
|
||||
{
|
||||
TDocumento & d = list[p];
|
||||
|
||||
for (int j = d.physical_rows() ; j >= i; j--)
|
||||
d.destroy_row(j, true);
|
||||
}
|
||||
if (before_pos > 0)
|
||||
{
|
||||
TDocumento & d = list[p];
|
||||
|
||||
for (int j = before_pos ; j >= 1; j--)
|
||||
d.destroy_row(j, true);
|
||||
}
|
||||
before_pos = last_pos;
|
||||
p = list.add(doc);
|
||||
}
|
||||
last_pos++;
|
||||
}
|
||||
if (before_pos > 0)
|
||||
{
|
||||
TDocumento & d = list[p];
|
||||
|
||||
for (int j = before_pos ; j >= 1; j--)
|
||||
d.destroy_row(j, true);
|
||||
}
|
||||
}
|
||||
|
||||
void TGenEsecutivo_app::main_loop()
|
||||
{
|
||||
open_files(LF_TAB, LF_TABCOM, LF_DOC, LF_RIGHEDOC, LF_CONDV, LF_RCONDV,
|
||||
@ -265,14 +365,16 @@ void TGenEsecutivo_app::main_loop()
|
||||
e.elabora(doc_in, doc_out, data);
|
||||
doc_in.rewrite();
|
||||
doc_out[0].put(DOC_K, doc_in[0].get(DOC_K));
|
||||
doc_out.write();
|
||||
doc_out[0].put(DOC_USEK, doc_in[0].get(DOC_USEK));
|
||||
doc_in.destroy(-1);
|
||||
TDocumento esecutivo((const TRectype &)doc_out[0]);
|
||||
TDocumento esecutivo(doc_out[0]);
|
||||
|
||||
if (m.get_bool(F_SPLIT))
|
||||
split_docs(doc_out, esecutivo);
|
||||
doc_out.write();
|
||||
doc_in.add(esecutivo);
|
||||
doc_out.destroy(-1);
|
||||
o.elabora(doc_in, doc_out, data);
|
||||
doc_in.rewrite();
|
||||
TDocumento & doc_dest = doc_out[0];
|
||||
for (int r = doc_dest.physical_rows(); r > 0; r--)
|
||||
{
|
||||
|
@ -10,3 +10,4 @@
|
||||
#define F_CODICE_ORC 210
|
||||
#define F_DESC_ORC 211
|
||||
#define F_DATA 212
|
||||
#define F_SPLIT 213
|
||||
|
@ -140,6 +140,11 @@ BEGIN
|
||||
PROMPT 2 9 "Data "
|
||||
END
|
||||
|
||||
BOOLEAN F_SPLIT
|
||||
BEGIN
|
||||
PROMPT 2 10 "Suddividi il preventivo esecutivo"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
TOOLBAR "" 0 -2 0 2
|
||||
|
@ -175,11 +175,15 @@ void TGenOrdini_app::main_loop()
|
||||
const long tot = cur.items();
|
||||
if (tot > 0L)
|
||||
{
|
||||
TGenerazione_ordine_produzione p(m.get(F_CODICE_ORP));
|
||||
TGenerazione_ordine_acquisto a(m.get(F_CODICE_ORA));
|
||||
TGenerazione_ordine_produzione * p = NULL;
|
||||
|
||||
p.preserve_original_rif();
|
||||
a.preserve_original_rif();
|
||||
a.preserve_original_rif();
|
||||
if (m.get(F_CODICE_ORP).full())
|
||||
{
|
||||
p = new TGenerazione_ordine_produzione(m.get(F_CODICE_ORP));
|
||||
p->preserve_original_rif();
|
||||
}
|
||||
cur.freeze();
|
||||
TProgind pi(tot, "Generazione in corso...", FALSE, TRUE);
|
||||
for (cur = 0; cur.pos() < tot; ++cur)
|
||||
@ -187,24 +191,29 @@ void TGenOrdini_app::main_loop()
|
||||
pi.addstatus(1);
|
||||
|
||||
TDocumento srcdoc(cur.curr()), newdoc;
|
||||
TLista_documenti doc_in;
|
||||
TLista_documenti doc_out;
|
||||
|
||||
if (p.is_document_ok(srcdoc))
|
||||
if (p != NULL && p->is_document_ok(srcdoc))
|
||||
{
|
||||
TLista_documenti doc_in;
|
||||
TLista_documenti doc_out;
|
||||
|
||||
doc_in.add(srcdoc);
|
||||
p.elabora(doc_in, doc_out, data);
|
||||
p->elabora(doc_in, doc_out, data);
|
||||
doc_in.rewrite();
|
||||
doc_out.write();
|
||||
doc_in.destroy(-1);
|
||||
doc_out.destroy(-1);
|
||||
}
|
||||
if (a.is_document_ok(srcdoc))
|
||||
{
|
||||
doc_in.add(srcdoc);
|
||||
a.elabora(doc_in, doc_out, data);
|
||||
doc_in.rewrite();
|
||||
doc_out.write();
|
||||
}
|
||||
}
|
||||
if (p != NULL)
|
||||
delete p;
|
||||
}
|
||||
else
|
||||
warning_box("Nessun documento soddisfa i vincoli indicati");
|
||||
|
@ -97,7 +97,7 @@ BEGIN
|
||||
DISPLAY "Descrizione@55" S0
|
||||
OUTPUT F_CODICE_ORP CODTAB
|
||||
OUTPUT F_DESC_ORP S0
|
||||
CHECKTYPE REQUIRED
|
||||
CHECKTYPE NORMAL
|
||||
WARNING "E' necessario specificare il codice elaborazione"
|
||||
END
|
||||
|
||||
|
@ -708,7 +708,8 @@ void TDocumento::copy_data(TRectype& dst, const TRectype& src)
|
||||
dst.put(RDOC_DESCEST, memo);
|
||||
const TString g1 = src.get(RDOC_RG1);
|
||||
dst.put(RDOC_RG1, g1);
|
||||
}
|
||||
((TRiga_documento & )dst).load_memo();
|
||||
}
|
||||
else
|
||||
{
|
||||
dst.zero(DOC_MOVMAG);
|
||||
|
Loading…
x
Reference in New Issue
Block a user