Patch level : 10.0 patch 767
Files correlati : or1.exe Ricompilazione Demo : [ ] Commento : modifica per cigno: generazione doc. di carico Dalla versione 3.2 git-svn-id: svn://10.65.10.50/trunk@20593 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
39b4c1f647
commit
a0d9292683
344
or/or1400.cpp
344
or/or1400.cpp
@ -101,6 +101,7 @@ private:
|
|||||||
void load_user_defs();
|
void load_user_defs();
|
||||||
void update_sheet();
|
void update_sheet();
|
||||||
void update_orders();
|
void update_orders();
|
||||||
|
void reconstruction(const TDocumento& doc2delete);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool on_sheet_event(TOperable_field& o, TField_event e, long jolly);
|
bool on_sheet_event(TOperable_field& o, TField_event e, long jolly);
|
||||||
@ -123,9 +124,11 @@ class TCreazione_ordini : public TSkeleton_application
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
TString_array _userfld;
|
TString_array _userfld;
|
||||||
void generate_orders();
|
void aggiorna_stato_doc_orig(const TRectype& rdoc);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
void generate_orders();
|
||||||
|
void generate_carics();
|
||||||
virtual bool create();
|
virtual bool create();
|
||||||
virtual void main_loop();
|
virtual void main_loop();
|
||||||
virtual bool destroy();
|
virtual bool destroy();
|
||||||
@ -153,7 +156,7 @@ void TGenera_ordini_mask::update_sheet()
|
|||||||
const int pos = query.find("KEY ");
|
const int pos = query.find("KEY ");
|
||||||
TArticolo_giacenza art;
|
TArticolo_giacenza art;
|
||||||
TString8 codmag(get(F_MAG));
|
TString8 codmag(get(F_MAG));
|
||||||
const TString8 codnum(get(F_CODNUM));
|
const TString4 codnum(get(F_CODNUM));
|
||||||
const bool check_expr = codnum == _disable_num;
|
const bool check_expr = codnum == _disable_num;
|
||||||
int anno = get_int(F_ANNO);
|
int anno = get_int(F_ANNO);
|
||||||
if (anno <= 0)
|
if (anno <= 0)
|
||||||
@ -324,7 +327,8 @@ void TGenera_ordini_mask::update_orders()
|
|||||||
TString query;
|
TString query;
|
||||||
query << "USE RDOC\n";
|
query << "USE RDOC\n";
|
||||||
query << "SELECT (CODARTMAG!=\"\")&&(CODCMS==#CODCMS)"
|
query << "SELECT (CODARTMAG!=\"\")&&(CODCMS==#CODCMS)"
|
||||||
<< "&&(BETWEEN(33.STATO,#DASTATO,#ASTATO))\n";
|
<< "&&(BETWEEN(33.STATO,#DASTATO,#ASTATO))"
|
||||||
|
<< "&&(RIGAEVASA=\"\")\n";
|
||||||
query << "JOIN ANAMAG INTO CODART==CODART\n";
|
query << "JOIN ANAMAG INTO CODART==CODART\n";
|
||||||
query << "JOIN DOC INTO PROVV==PROVV ANNO==ANNO CODNUM==CODNUM NDOC==NDOC\n";
|
query << "JOIN DOC INTO PROVV==PROVV ANNO==ANNO CODNUM==CODNUM NDOC==NDOC\n";
|
||||||
query << "JOIN CLIFO TO DOC INTO TIPOCF=\"F\" CODCF==CODCF\n";
|
query << "JOIN CLIFO TO DOC INTO TIPOCF=\"F\" CODCF==CODCF\n";
|
||||||
@ -343,6 +347,8 @@ void TGenera_ordini_mask::update_orders()
|
|||||||
|
|
||||||
TMask& m = sh.sheet_mask();
|
TMask& m = sh.sheet_mask();
|
||||||
TRelation& rel = *orders.cursor()->relation();
|
TRelation& rel = *orders.cursor()->relation();
|
||||||
|
|
||||||
|
const int status_pos = sh.cid2index(S_STATODOC);
|
||||||
for (bool ok = orders.move_first(); ok; ok = orders.move_next())
|
for (bool ok = orders.move_first(); ok; ok = orders.move_next())
|
||||||
{
|
{
|
||||||
TToken_string& row = sh.row(-1);
|
TToken_string& row = sh.row(-1);
|
||||||
@ -350,15 +356,19 @@ void TGenera_ordini_mask::update_orders()
|
|||||||
{
|
{
|
||||||
const TFieldref* fr = f->field();
|
const TFieldref* fr = f->field();
|
||||||
if (fr != NULL)
|
if (fr != NULL)
|
||||||
row.add(fr->read(rel));
|
{
|
||||||
|
const int j = sh.cid2index(f->dlg());
|
||||||
|
row.add(fr->read(rel), j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const int nrow = sh.items()-1;
|
const int nrow = sh.items()-1;
|
||||||
switch (row.get_int(2))
|
switch (row.get_int(status_pos))
|
||||||
{
|
{
|
||||||
case 1: sh.set_back_and_fore_color(NORMAL_BACK_COLOR, NORMAL_COLOR, nrow); break;
|
case 1: sh.set_back_and_fore_color(NORMAL_BACK_COLOR, NORMAL_COLOR, nrow); break;
|
||||||
case 2: sh.set_back_and_fore_color(REQUIRED_BACK_COLOR, NORMAL_COLOR, nrow); break;
|
case 2: sh.set_back_and_fore_color(REQUIRED_BACK_COLOR, NORMAL_COLOR, nrow); break;
|
||||||
default: sh.set_back_and_fore_color(DISABLED_BACK_COLOR, DISABLED_COLOR, nrow); break;
|
default: sh.set_back_and_fore_color(DISABLED_BACK_COLOR, DISABLED_COLOR, nrow); break;
|
||||||
}
|
}
|
||||||
|
sh.check_row(nrow);
|
||||||
}
|
}
|
||||||
sh.force_update();
|
sh.force_update();
|
||||||
}
|
}
|
||||||
@ -401,6 +411,43 @@ bool TGenera_ordini_mask::on_sheet_event(TOperable_field& o, TField_event e, lon
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TGenera_ordini_mask::reconstruction(const TDocumento& doc2delete)
|
||||||
|
{
|
||||||
|
const char* const defpar = "or";
|
||||||
|
TConfig c(CONFIG_USER, defpar);
|
||||||
|
const char statoini = c.get_char("OR14_STATOINI");
|
||||||
|
|
||||||
|
const int rows = doc2delete.rows();
|
||||||
|
for (int i=1; i<=rows; i++)
|
||||||
|
{
|
||||||
|
const TRiga_documento& r = doc2delete[i];
|
||||||
|
const TRectype* original_doc = r.find_original_doc();
|
||||||
|
if (original_doc != NULL)
|
||||||
|
{
|
||||||
|
TDocumento d(*original_doc);
|
||||||
|
const long nriga = r.get_long(RDOC_DAIDRIGA);
|
||||||
|
if (nriga != 0)
|
||||||
|
{
|
||||||
|
TRiga_documento& original_row = d[nriga];
|
||||||
|
const real qta = r.quantita();
|
||||||
|
const TString& name = original_row.field_qtaevasa();
|
||||||
|
real qtaevasa = original_row.get_real(name) - qta;
|
||||||
|
if (qtaevasa < ZERO)
|
||||||
|
qtaevasa = ZERO;
|
||||||
|
original_row.put(name, qtaevasa);
|
||||||
|
if (qtaevasa < original_row.quantita())
|
||||||
|
original_row.zero(RDOC_RIGAEVASA);
|
||||||
|
else
|
||||||
|
original_row.put(RDOC_RIGAEVASA, "X");
|
||||||
|
if (statoini != ' ')
|
||||||
|
d.stato(statoini);
|
||||||
|
d.rewrite();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TGenera_ordini_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
bool TGenera_ordini_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||||
{
|
{
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
@ -424,6 +471,14 @@ bool TGenera_ordini_mask::on_field_event(TOperable_field& o, TField_event e, lon
|
|||||||
_filter_changed = true;
|
_filter_changed = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case F_TIPODOC:
|
||||||
|
if (e == fe_init || e == fe_modify)
|
||||||
|
{
|
||||||
|
const TTipo_documento tipodoc(o.get());
|
||||||
|
const bool is_ordine = tipodoc.is_ordine();
|
||||||
|
enable(DLG_ELABORA, is_ordine);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case F_ANNO:
|
case F_ANNO:
|
||||||
if (e == fe_init && o.empty())
|
if (e == fe_init && o.empty())
|
||||||
{
|
{
|
||||||
@ -523,6 +578,7 @@ bool TGenera_ordini_mask::on_field_event(TOperable_field& o, TField_event e, lon
|
|||||||
for (*c = 0; c->pos() < items; ++(*c)) if (sht.checked(c->pos()))
|
for (*c = 0; c->pos() < items; ++(*c)) if (sht.checked(c->pos()))
|
||||||
{
|
{
|
||||||
TDocumento doc(c->curr());
|
TDocumento doc(c->curr());
|
||||||
|
reconstruction(doc); // funzione che ricostruisce la situazione precedente al documento
|
||||||
doc.remove();
|
doc.remove();
|
||||||
}
|
}
|
||||||
update_sheet();
|
update_sheet();
|
||||||
@ -531,6 +587,24 @@ bool TGenera_ordini_mask::on_field_event(TOperable_field& o, TField_event e, lon
|
|||||||
ok = false; // Non uscire
|
ok = false; // Non uscire
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case DLG_OK:
|
||||||
|
if (e == fe_button && jolly == 0)
|
||||||
|
{
|
||||||
|
capp().generate_orders();
|
||||||
|
update_orders();
|
||||||
|
update_sheet();
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DLG_ELABORA:
|
||||||
|
if (e == fe_button && jolly == 0)
|
||||||
|
{
|
||||||
|
capp().generate_carics();
|
||||||
|
update_orders();
|
||||||
|
update_sheet();
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (o.is_kind_of(CLASS_SHEET_FIELD))
|
if (o.is_kind_of(CLASS_SHEET_FIELD))
|
||||||
ok = on_sheet_event(o, e, jolly);
|
ok = on_sheet_event(o, e, jolly);
|
||||||
@ -600,6 +674,7 @@ TGenera_ordini_mask::TGenera_ordini_mask()
|
|||||||
_doc_filter = c.get("OR14_FILTER");
|
_doc_filter = c.get("OR14_FILTER");
|
||||||
if (_doc_filter.empty() && !field(F_CDCT).empty())
|
if (_doc_filter.empty() && !field(F_CDCT).empty())
|
||||||
_doc_filter = "CODCMS=#CODCMS"; // Utile al Cigno
|
_doc_filter = "CODCMS=#CODCMS"; // Utile al Cigno
|
||||||
|
|
||||||
_days_interval = c.get_int("OR14_DAYS");
|
_days_interval = c.get_int("OR14_DAYS");
|
||||||
TSheet_field& sh = sfield(F_ARTICLES);
|
TSheet_field& sh = sfield(F_ARTICLES);
|
||||||
TMask& sh_mask = sh.sheet_mask();
|
TMask& sh_mask = sh.sheet_mask();
|
||||||
@ -685,6 +760,259 @@ void TCreazione_ordini::print_doc(const TRectype & doc)
|
|||||||
interattivo.run();
|
interattivo.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TCreazione_ordini::aggiorna_stato_doc_orig(const TRectype& rdoc)
|
||||||
|
{
|
||||||
|
const char provv = rdoc.get_char(RDOC_PROVV);
|
||||||
|
const int anno = rdoc.get_int(RDOC_ANNO);
|
||||||
|
const TString8 codnum = rdoc.get(RDOC_CODNUM);
|
||||||
|
const long ndoc = rdoc.get_long(RDOC_NDOC);
|
||||||
|
TDocumento doc_orig(provv, anno, codnum, ndoc);
|
||||||
|
if (doc_orig.is_evaso())
|
||||||
|
{
|
||||||
|
const char* const defpar = "or";
|
||||||
|
TConfig c(CONFIG_USER, defpar);
|
||||||
|
const char statoevaso = c.get_char("OR14_STATOEVASO");
|
||||||
|
if (statoevaso != ' ')
|
||||||
|
{
|
||||||
|
doc_orig.stato(statoevaso);
|
||||||
|
doc_orig.rewrite();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCreazione_ordini::generate_carics()
|
||||||
|
{
|
||||||
|
TGenera_ordini_mask& mask = *_mask;
|
||||||
|
TSheet_field& sf = mask.sfield(F_ORDERS);
|
||||||
|
|
||||||
|
long minforn = 999999L;
|
||||||
|
long maxforn = 0L;
|
||||||
|
TAssoc_array orders;
|
||||||
|
|
||||||
|
if (sf.items() > 0)
|
||||||
|
{
|
||||||
|
const TDate datadoc = mask.get_date(F_DATADOCCAR);
|
||||||
|
|
||||||
|
const char* const defpar = "or";
|
||||||
|
TConfig c(CONFIG_USER, defpar);
|
||||||
|
const TString& codnum = c.get("OR14_NUMCAR");
|
||||||
|
const TString& tipodoc = c.get("OR14_TIPCAR");
|
||||||
|
|
||||||
|
const TTipo_documento tipo(tipodoc);
|
||||||
|
|
||||||
|
//const bool ultimo_prezzo = mask.get(F_PREZZO) == "U";
|
||||||
|
const TString& commessat = mask.get(F_CDCT);
|
||||||
|
const TString& faset = mask.get(F_FSCT);
|
||||||
|
|
||||||
|
//TString8 codmag(mask.get(F_MAG));
|
||||||
|
//codmag.right_just(3);
|
||||||
|
//codmag << mask.get(F_DEP);
|
||||||
|
|
||||||
|
//TString8 codmagc(mask.get(F_MAGC));
|
||||||
|
//codmagc.right_just(3);
|
||||||
|
//codmagc << mask.get(F_DEPC);
|
||||||
|
|
||||||
|
TLocalisamfile righedoc(LF_RIGHEDOC);
|
||||||
|
|
||||||
|
TProgind pi(sf.items(), TR("Generazione documenti di carico"), true, true);
|
||||||
|
FOR_EACH_SHEET_ROW(sf, n, row)
|
||||||
|
{
|
||||||
|
if (!pi.setstatus(n))
|
||||||
|
break;
|
||||||
|
if (row->get_char(sf.cid2index(S_DAEVADERE) == 'X'))
|
||||||
|
{
|
||||||
|
const real qta = row->get(sf.cid2index(S_QTADAEVADERE));
|
||||||
|
if (!qta.is_zero())
|
||||||
|
{
|
||||||
|
const TString8 codforn(row->get(sf.cid2index(S_FORNITORE)));
|
||||||
|
const long cod = atol(codforn);
|
||||||
|
TString8 key; key.format("F|%ld", cod);
|
||||||
|
const TRectype& forn = cache().get(LF_CLIFO, key);
|
||||||
|
const TDate datacons(row->get(sf.cid2index(S_DATACONS)));
|
||||||
|
const TString4 codval(forn.get(CLI_CODVAL));
|
||||||
|
const TRectype& forven = cache().get(LF_CFVEN, key);
|
||||||
|
const TString4 codiva(forven.get(CFV_ASSFIS));
|
||||||
|
const TString commessa = row->get(sf.cid2index(S_CDC));
|
||||||
|
const TString fase = row->get(sf.cid2index(S_FSC));
|
||||||
|
|
||||||
|
TDocumento* d = (TDocumento*)orders.objptr(codforn);
|
||||||
|
if (d == NULL)
|
||||||
|
{
|
||||||
|
d = new TDocumento('D', datadoc.year(), codnum, 0L);
|
||||||
|
d->put(DOC_TIPODOC, tipodoc);
|
||||||
|
d->put(DOC_TIPOCF, "F");
|
||||||
|
d->put(DOC_CODCF, codforn);
|
||||||
|
d->put(DOC_DATADOC, datadoc);
|
||||||
|
d->put(DOC_DATACONS, datacons);
|
||||||
|
d->put(DOC_CODVAL, codval);
|
||||||
|
d->put(DOC_CODLIN, forn.get(CLI_CODLIN));
|
||||||
|
d->put(DOC_CODPAG, forn.get(CLI_CODPAG));
|
||||||
|
d->put(DOC_CODABIA, forn.get(CLI_CODABI));
|
||||||
|
d->put(DOC_CODCABA, forn.get(CLI_CODCAB));
|
||||||
|
d->put(DOC_IBAN, forn.get(CLI_IBAN));
|
||||||
|
d->put(DOC_CODABIP, forven.get(CFV_CODABIPR));
|
||||||
|
d->put(DOC_CODCABP, forven.get(CFV_CODCABPR));
|
||||||
|
d->put(DOC_RAGGR, forven.get(CFV_RAGGDOC));
|
||||||
|
d->put(DOC_RAGGREFF, forven.get(CFV_RAGGEFF));
|
||||||
|
d->put(DOC_CODINDSP, forven.get(CFV_CODINDSP));
|
||||||
|
d->put(DOC_CODAG, forven.get(CFV_CODAG));
|
||||||
|
d->put(DOC_ZONA, forven.get(CFV_CODZONA));
|
||||||
|
d->put(DOC_CODSPMEZZO, forven.get(CFV_CODSPMEZZO));
|
||||||
|
d->put(DOC_CODPORTO, forven.get(CFV_CODPORTO));
|
||||||
|
d->put(DOC_CODNOTESP1, forven.get(CFV_CODNOTESP1));
|
||||||
|
d->put(DOC_CODNOTESP2, forven.get(CFV_CODNOTESP2));
|
||||||
|
d->put(DOC_CODNOTE, forven.get(CFV_CODNOTE));
|
||||||
|
d->put(DOC_CODVETT1, forven.get(CFV_CODVETT1));
|
||||||
|
d->put(DOC_CODVETT2, forven.get(CFV_CODVETT2));
|
||||||
|
d->put(DOC_CODVETT3, forven.get(CFV_CODVETT3));
|
||||||
|
d->put(DOC_PERCSPINC, forven.get(CFV_PERCSPINC));
|
||||||
|
d->put(DOC_ADDBOLLI, forven.get(CFV_ADDBOLLI));
|
||||||
|
d->put(DOC_CATVEN, forven.get(CFV_CATVEN));
|
||||||
|
d->put(DOC_CODLIST, forven.get(CFV_CODLIST));
|
||||||
|
d->put(DOC_CODCMS, commessat);
|
||||||
|
// le note non dovrebbero servire
|
||||||
|
//d->put(DOC_NOTE, mask.get(F_NOTE));
|
||||||
|
|
||||||
|
const TString& causmag = tipo.caus_mov();
|
||||||
|
d->put(DOC_CAUSMAG, causmag);
|
||||||
|
|
||||||
|
orders.add(codforn, d);
|
||||||
|
if (cod < minforn)
|
||||||
|
minforn = cod;
|
||||||
|
if (cod > maxforn)
|
||||||
|
maxforn = cod;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRiga_documento& rdoc = d->new_row("01");
|
||||||
|
|
||||||
|
|
||||||
|
/* guy si e' molto arrabbiato nel leggere queste righe di pseudo codice (attenzione, morde!)
|
||||||
|
const TString codart(row->get(sf.cid2index(S_CODART)));
|
||||||
|
|
||||||
|
//rdoc.put(RDOC_CODMAG, codmag);
|
||||||
|
//rdoc.put(RDOC_CODMAGC, codmagc);
|
||||||
|
rdoc.put(RDOC_CODART, codart);
|
||||||
|
rdoc.put(RDOC_CODARTMAG, codart);
|
||||||
|
rdoc.put(RDOC_CHECKED, "X");
|
||||||
|
rdoc.put(RDOC_DESCR, row->get(sf.cid2index(S_DESCART)));
|
||||||
|
|
||||||
|
//const TString descr_agg(row->get(sf.cid2index(S_DESCRAGG)));
|
||||||
|
//if (descr_agg.full())
|
||||||
|
//{
|
||||||
|
// rdoc.put(RDOC_DESCLUNGA, "X");
|
||||||
|
// rdoc.put(RDOC_DESCEST, descr_agg);
|
||||||
|
//}
|
||||||
|
|
||||||
|
rdoc.put(RDOC_UMQTA, row->get(sf.cid2index(S_UM)));
|
||||||
|
rdoc.put(RDOC_QTA, qta);
|
||||||
|
rdoc.put(RDOC_DATACONS, datacons);
|
||||||
|
|
||||||
|
const TRectype& articolo = cache().get(LF_ANAMAG, codart);
|
||||||
|
//TPrice prezzo;
|
||||||
|
//if (ultimo_prezzo)
|
||||||
|
// prezzo = articolo.get_real(ANAMAG_ULTCOS1);
|
||||||
|
//else
|
||||||
|
// prezzo = articolo.get_real(ANAMAG_COSTSTD);
|
||||||
|
//prezzo.change_value(codval);
|
||||||
|
//rdoc.put(RDOC_PREZZO, prezzo.get_num());
|
||||||
|
if (codiva.full())
|
||||||
|
rdoc.put(RDOC_CODIVA, codiva);
|
||||||
|
else
|
||||||
|
rdoc.put(RDOC_CODIVA, articolo.get(ANAMAG_CODIVA));
|
||||||
|
rdoc.put(RDOC_CODCMS, commessa);
|
||||||
|
rdoc.put(RDOC_FASCMS, fase);
|
||||||
|
|
||||||
|
for (int i = 0; i < 10 ; i++)
|
||||||
|
if (_userfld.row(i).full())
|
||||||
|
rdoc.put(_userfld.row(i), mask.get(F_USER1 + i));
|
||||||
|
|
||||||
|
rdoc.put(RDOC_CODAGG1, row->get(sf.cid2index(F_CODAGG1)));
|
||||||
|
rdoc.put(RDOC_CODAGG2, row->get(sf.cid2index(F_CODAGG2)));
|
||||||
|
*/
|
||||||
|
const TDate dataord = row->get(sf.cid2index(S_DATADOC));
|
||||||
|
const long ndoc = row->get_long(sf.cid2index(S_NUMDOC));
|
||||||
|
const int nriga = row->get_int(sf.cid2index(S_NUMRIGA));
|
||||||
|
TRectype& rigord = righedoc.curr();
|
||||||
|
rigord.put(RDOC_PROVV, 'D');
|
||||||
|
rigord.put(RDOC_ANNO, dataord.year());
|
||||||
|
rigord.put(RDOC_CODNUM, mask.get(F_CODNUM));
|
||||||
|
rigord.put(RDOC_NDOC, ndoc);
|
||||||
|
rigord.put(RDOC_NRIGA, nriga);
|
||||||
|
int err = righedoc.read(_isequal, _lock);
|
||||||
|
if (err == NOERR)
|
||||||
|
{
|
||||||
|
d->copy_data(rdoc, rigord);
|
||||||
|
rdoc.put(rdoc.field_qta(), qta);
|
||||||
|
rigord.add(rdoc.field_qtaevasa(), qta);
|
||||||
|
if (rigord.get_real(rdoc.field_qtaevasa()) >= rigord.get_real(rdoc.field_qta()))
|
||||||
|
rigord.put(RDOC_RIGAEVASA, true);
|
||||||
|
rdoc.put(RDOC_DACODNUM, rigord.get(RDOC_CODNUM));
|
||||||
|
rdoc.put(RDOC_DAANNO, rigord.get(RDOC_ANNO));
|
||||||
|
rdoc.put(RDOC_DAPROVV, rigord.get(RDOC_PROVV));
|
||||||
|
rdoc.put(RDOC_DANDOC, rigord.get(RDOC_NDOC));
|
||||||
|
rdoc.put(RDOC_DAIDRIGA, rigord.get(RDOC_NRIGA));
|
||||||
|
err = righedoc.rewrite();
|
||||||
|
if (err == NOERR)
|
||||||
|
aggiorna_stato_doc_orig(rigord);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (err != NOERR)
|
||||||
|
error_box(FR("Impossibile aggiornare la riga %d del doc. %ld"), nriga, ndoc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (orders.items() > 0)
|
||||||
|
{
|
||||||
|
TProgind pi(orders.items(), TR("Registrazione documenti di carico"), true, true);
|
||||||
|
TString cmdline;
|
||||||
|
int cnt = 0;
|
||||||
|
TString8 key;
|
||||||
|
long mindoc = 0, maxdoc = 0;
|
||||||
|
for (long cod = minforn; cod <= maxforn; cod++)
|
||||||
|
{
|
||||||
|
key.format("%ld", cod);
|
||||||
|
TDocumento* d = (TDocumento*)orders.objptr(key);
|
||||||
|
if (d != NULL)
|
||||||
|
{
|
||||||
|
if (!pi.addstatus(1))
|
||||||
|
break;
|
||||||
|
if (d->write() == NOERR)
|
||||||
|
{
|
||||||
|
if (cmdline.blank())
|
||||||
|
{
|
||||||
|
const TTipo_documento& tipo = d->tipo();
|
||||||
|
TFilename rep(tipo.main_print_profile());
|
||||||
|
|
||||||
|
rep.ext("rep");
|
||||||
|
|
||||||
|
if (rep.custom_path()) // Esiste il nuovo report :-)
|
||||||
|
cmdline = "ve1 -2";
|
||||||
|
else // Esiste il vecchio form :-(
|
||||||
|
cmdline = "ve1 -0";
|
||||||
|
}
|
||||||
|
cnt++;
|
||||||
|
const long ndoc = d->get_long(DOC_NDOC);
|
||||||
|
if (mindoc <= 0 || ndoc < mindoc)
|
||||||
|
mindoc = ndoc;
|
||||||
|
if (ndoc > maxdoc)
|
||||||
|
maxdoc = ndoc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (yesno_box(TR("Sono stati generati %d documenti:\nSi desidera stamparli ora?"), cnt))
|
||||||
|
{
|
||||||
|
const TString& codnum = mask.get(F_CODNUM);
|
||||||
|
const TDate datadoc(TODAY);
|
||||||
|
const int anno = datadoc.year();
|
||||||
|
cmdline << " " << codnum << ' ' << anno << " D " << mindoc << ' ' << maxdoc;
|
||||||
|
TExternal_app prg(cmdline);
|
||||||
|
prg.run(true, true, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TCreazione_ordini::generate_orders()
|
void TCreazione_ordini::generate_orders()
|
||||||
{
|
{
|
||||||
TGenera_ordini_mask& mask = *_mask;
|
TGenera_ordini_mask& mask = *_mask;
|
||||||
@ -878,8 +1206,10 @@ void TCreazione_ordini::generate_orders()
|
|||||||
|
|
||||||
void TCreazione_ordini::main_loop()
|
void TCreazione_ordini::main_loop()
|
||||||
{
|
{
|
||||||
while (_mask->run() == K_ENTER)
|
|
||||||
generate_orders();
|
KEY tasto = K_ENTER;
|
||||||
|
while (tasto == K_ENTER)
|
||||||
|
tasto = _mask->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
int or1400(int argc, char** argv)
|
int or1400(int argc, char** argv)
|
||||||
|
31
or/or1400a.h
31
or/or1400a.h
@ -34,6 +34,7 @@
|
|||||||
#define F_DASTATO 201
|
#define F_DASTATO 201
|
||||||
#define F_ASTATO 202
|
#define F_ASTATO 202
|
||||||
#define F_ANNO 203
|
#define F_ANNO 203
|
||||||
|
#define F_DATADOCCAR 204
|
||||||
#define F_ORDERS 210
|
#define F_ORDERS 210
|
||||||
|
|
||||||
#define F_CODART 101
|
#define F_CODART 101
|
||||||
@ -66,13 +67,23 @@
|
|||||||
|
|
||||||
#define S_DATADOC 101
|
#define S_DATADOC 101
|
||||||
#define S_NUMDOC 102
|
#define S_NUMDOC 102
|
||||||
#define S_STATODOC 103
|
#define S_NUMRIGA 103
|
||||||
#define S_CODART 104
|
#define S_STATODOC 104
|
||||||
#define S_DESCART 105
|
#define S_CODART 105
|
||||||
#define S_UM 106
|
#define S_DESCART 106
|
||||||
#define S_QTA 107
|
#define S_UM 107
|
||||||
#define S_DATACONS 108
|
#define S_QTA 108
|
||||||
#define S_FORNITORE 109
|
#define S_QTAEVASA 109
|
||||||
#define S_RAGSOC 110
|
#define S_RESIDUO 110
|
||||||
#define S_CDC 111
|
#define S_DAEVADERE 111
|
||||||
#define S_FSC 112
|
#define S_QTADAEVADERE 112
|
||||||
|
#define S_DATACONS 113
|
||||||
|
#define S_FORNITORE 114
|
||||||
|
#define S_RAGSOC 115
|
||||||
|
#define S_CDC 116
|
||||||
|
#define S_FSC 117
|
||||||
|
#define S_DESCRAGG 118
|
||||||
|
#define S_PPCONF 119
|
||||||
|
#define S_TAGLIE 120
|
||||||
|
|
||||||
|
|
||||||
|
124
or/or1400a.uml
124
or/or1400a.uml
@ -26,11 +26,23 @@ BEGIN
|
|||||||
PICTURE TOOL_DELREC
|
PICTURE TOOL_DELREC
|
||||||
END
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_NULL 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -57 -11 "Stampa ~Inv."
|
||||||
|
MESSAGE RUN,MG4,-1
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_ELABORA 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -67 -11 "~Carichi"
|
||||||
|
MESSAGE K_ENTER
|
||||||
|
END
|
||||||
|
|
||||||
#include <helpbar.h>
|
#include <helpbar.h>
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
PAGE "Ordini fornitori" 0 2 0 0
|
PAGE "Gestione Documenti" 0 2 0 0
|
||||||
|
|
||||||
DATE F_DATADOC
|
DATE F_DATADOC
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -104,23 +116,36 @@ BEGIN
|
|||||||
FIELD OR14_ANNO
|
FIELD OR14_ANNO
|
||||||
END
|
END
|
||||||
|
|
||||||
|
DATE F_DATADOCCAR
|
||||||
|
BEGIN
|
||||||
|
PROMPT 65 1 "Data doc. "
|
||||||
|
FLAGS "A"
|
||||||
|
END
|
||||||
|
|
||||||
SPREADSHEET F_ORDERS
|
SPREADSHEET F_ORDERS
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 2 "Ordini"
|
PROMPT 1 2 "Ordini"
|
||||||
ITEM "Data\nOrdine@10"
|
ITEM "Data\nOrdine@10"
|
||||||
ITEM "Numero\nOrdine"
|
ITEM "Numero\nOrdine"
|
||||||
ITEM "Stato\nOrdine"
|
ITEM "Riga\nOrdine"
|
||||||
|
ITEM "Stato\nOrdine"
|
||||||
ITEM "Codice\nArticolo@20"
|
ITEM "Codice\nArticolo@20"
|
||||||
ITEM "Descrizione@50"
|
ITEM "Descrizione@50"
|
||||||
ITEM "UM"
|
ITEM "UM"
|
||||||
ITEM "Quantità@15"
|
ITEM "Quantità@15"
|
||||||
|
ITEM "Qta evasa@15"
|
||||||
|
ITEM "Residuo@15"
|
||||||
|
ITEM "DaEvadere"
|
||||||
|
ITEM "Qta da evadere@15"
|
||||||
ITEM "Data di\nconsegna@10"
|
ITEM "Data di\nconsegna@10"
|
||||||
ITEM "Fornitore"
|
ITEM "Fornitore"
|
||||||
ITEM "Ragione sociale@50"
|
ITEM "Ragione sociale@50"
|
||||||
ITEM "Commessa@20"
|
ITEM "Commessa@20"
|
||||||
ITEM "Fase@10"
|
ITEM "Fase@10"
|
||||||
FLAGS "D"
|
ITEM "Descrizione aggiuntiva@50"
|
||||||
|
ITEM "Pezzi\nper conf."
|
||||||
|
ITEM "Taglie@10"
|
||||||
|
FLAGS "D"
|
||||||
END
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
@ -514,7 +539,7 @@ END
|
|||||||
|
|
||||||
NUMBER F_FORNITORE 6
|
NUMBER F_FORNITORE 6
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 6 "Codice fornitore "
|
PROMPT 2 6 "Codice fornitore "
|
||||||
FIELD CODCF
|
FIELD CODCF
|
||||||
USE LF_CLIFO
|
USE LF_CLIFO
|
||||||
INPUT TIPOCF "F"
|
INPUT TIPOCF "F"
|
||||||
@ -678,9 +703,9 @@ ENDPAGE
|
|||||||
|
|
||||||
ENDMASK
|
ENDMASK
|
||||||
|
|
||||||
PAGE "Ordini" -1 -1 68 16
|
PAGE "Ordini" -1 -1 80 20
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 66 3
|
GROUPBOX DLG_NULL 80 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 0 "@bEstremi del documento"
|
PROMPT 1 0 "@bEstremi del documento"
|
||||||
END
|
END
|
||||||
@ -693,17 +718,23 @@ END
|
|||||||
|
|
||||||
NUMBER S_NUMDOC 6
|
NUMBER S_NUMDOC 6
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 30 1 "Numero "
|
PROMPT 25 1 "Numero "
|
||||||
FIELD NDOC
|
FIELD NDOC
|
||||||
END
|
END
|
||||||
|
|
||||||
|
NUMBER S_NUMRIGA 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 43 1 "Riga "
|
||||||
|
FIELD NRIGA
|
||||||
|
END
|
||||||
|
|
||||||
STRING S_STATODOC 1
|
STRING S_STATODOC 1
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 57 1 "Stato "
|
PROMPT 57 1 "Stato "
|
||||||
FIELD 33.STATO
|
FIELD 33.STATO
|
||||||
END
|
END
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 66 5
|
GROUPBOX DLG_NULL 80 6
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 3 "@bArticolo"
|
PROMPT 1 3 "@bArticolo"
|
||||||
END
|
END
|
||||||
@ -730,54 +761,105 @@ END
|
|||||||
NUMBER S_QTA 13 5
|
NUMBER S_QTA 13 5
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 18 6 ""
|
PROMPT 18 6 ""
|
||||||
FIELD QTA
|
FIELD QTA
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER S_QTAEVASA 13 5
|
||||||
|
BEGIN
|
||||||
|
PROMPT 34 6 "Evasa "
|
||||||
|
FIELD QTAEVASA
|
||||||
|
FLAGS "D"
|
||||||
|
CHECKTYPE NORMAL
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER S_RESIDUO 13 5
|
||||||
|
BEGIN
|
||||||
|
PROMPT 56 6 "Residuo "
|
||||||
|
NUM_CALC #S_QTA-#S_QTAEVASA
|
||||||
|
FLAGS "D"
|
||||||
|
CHECKTYPE NORMAL
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN S_DAEVADERE
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 7 "Da evadere"
|
||||||
|
MESSAGE TRUE ENABLE,S_QTADAEVADERE | COPY, S_RESIDUO
|
||||||
|
MESSAGE FALSE CLEAR, S_QTADAEVADERE | DISABLE,S_QTADAEVADERE
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER S_QTADAEVADERE 13 5
|
||||||
|
BEGIN
|
||||||
|
PROMPT 16 7 "Qta da evadere"
|
||||||
END
|
END
|
||||||
|
|
||||||
DATA S_DATACONS
|
DATA S_DATACONS
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 37 6 "Data di consegna "
|
PROMPT 47 7 "Data di consegna "
|
||||||
FIELD DATACONS
|
FIELD DATACONS
|
||||||
END
|
END
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 66 3
|
GROUPBOX DLG_NULL 80 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 8 "@bFornitore"
|
PROMPT 1 9 "@bFornitore"
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER S_FORNITORE 6
|
NUMBER S_FORNITORE 6
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 9 ""
|
PROMPT 2 10 ""
|
||||||
FIELD 33.CODCF
|
FIELD 33.CODCF
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING S_RAGSOC 50
|
STRING S_RAGSOC 50
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 14 9 ""
|
PROMPT 14 10 ""
|
||||||
FIELD 20.RAGSOC
|
FIELD 20.RAGSOC
|
||||||
END
|
END
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 66 4
|
GROUPBOX DLG_NULL 80 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 11 "@bCentro di costo/Commessa"
|
PROMPT 1 12 "@bCentro di costo/Commessa"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING S_CDC 20
|
STRING S_CDC 20
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 12 "Codice "
|
PROMPT 2 13 "Codice "
|
||||||
FLAGS "UZ"
|
FLAGS "UZ"
|
||||||
FIELD CODCMS
|
FIELD CODCMS
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING S_FSC 10
|
STRING S_FSC 10
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 13 "Fase "
|
PROMPT 2 14 "Fase "
|
||||||
FLAGS "UZ"
|
FLAGS "UZ"
|
||||||
FIELD FASCMS
|
FIELD FASCMS
|
||||||
END
|
END
|
||||||
|
|
||||||
|
STRING S_DESCRAGG 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 16 "Descr. agg. "
|
||||||
|
FIELD 47.DESCRAGG[1,50]
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER S_PPCONF 15
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 17 "P.per conf. "
|
||||||
|
FIELD 47.PPCONF
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING S_TAGLIE 20
|
||||||
|
BEGIN
|
||||||
|
PROMPT 42 17 "Taglie "
|
||||||
|
FIELD 47.USER2
|
||||||
|
END
|
||||||
|
|
||||||
BUTTON DLG_CANCEL 10 2
|
BUTTON DLG_CANCEL 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -11 -1 ""
|
PROMPT -12 -1 ""
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_OK 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -22 -1 ""
|
||||||
END
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user