Patch level : 2.2 186

Files correlati     : ci0.exe
Ricompilazione Demo : [ ]
Commento            :

Bug   	 0000461

Aggiungere eliminazione documenti per le commesse chiuse. I piu' bisogna provare  la cancellazione di un documento in stato normale e bloccato. nel secondo caso non deve cancellare il magazzino, agenti statistice etc...


git-svn-id: svn://10.65.10.50/trunk@13397 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2005-10-07 13:41:20 +00:00
parent e02a130b5e
commit 3f45b1d377
10 changed files with 228 additions and 51 deletions

View File

@ -161,6 +161,7 @@ void TConfigurazioneIndustriale_app::file_to_sheet()
t.add(configfile.get("StatoColl", NULL, item, ""));
t.add(configfile.get("ModColl", NULL, item, ""));
t.add(configfile.get("Var", NULL, item, ""));
t.add(configfile.get("DeleteClosed", NULL, item, ""));
mask().sheet().check_row(item);
item++;
}
@ -195,6 +196,7 @@ void TConfigurazioneIndustriale_app::sheet_to_file()
configfile.set("StatoColl", mask().row(i).get(7), NULL, true, i);
configfile.set("ModColl", mask().row(i).get(8), NULL, true, i);
configfile.set("Var", mask().row(i).get(9), NULL, true, i);
configfile.set("DeleteClosed", mask().row(i).get(10), NULL, true, i);
totlen+=currdesc.len();
}

View File

@ -16,6 +16,7 @@
#define FR_STATO 108
#define FR_MODCOLL 109
#define FR_VAR 110
#define FR_DELCLOSE 111
#define FR_DESNUM 201
#define FR_DESTIPODOC 202

View File

@ -31,6 +31,7 @@ BEGIN
ITEM "Stato"
ITEM "Modifica documento\ncollegato@18"
ITEM "Campi modificati@50"
ITEM "Cancella le\nCommesse chiuse@20"
END
BUTTON F_MOVEUP 2 2
@ -178,6 +179,11 @@ BEGIN
GROUP 1
END
BOOLEAN FR_DELCLOSE
BEGIN
PROMPT 1 10 "Cancella i documenti di Commesse chiuse"
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -13 -1 ""

View File

@ -11,7 +11,9 @@
#include "cilib.h"
#include "ci0400.h"
#include "ci0400a.h"
#include "ci0400b.h"
#include "..\ve\velib.h"
#include <defmask.h>
///////////////////////////////////////////////////////////
@ -43,6 +45,7 @@ void TImmissioneDocumenti_app::init_tabs()
m.stato_coll().add(configfile.get("StatoColl", NULL, items), items);
m.var_coll().add(configfile.get("Var", NULL, items), items);
m.mod_coll().set(items, configfile.get_bool("ModColl", NULL, items));
m.del_closed().set(items, configfile.get_bool("DeleteClosed", NULL, items));
m.activate_almanac(F_AL01 + items, items, TDate(TODAY));
items++;
@ -146,6 +149,14 @@ bool TImmissioneDocumenti_app::has_documents(int currpage, TDate& day)
// Routines Proprietarie
void TImmissioneDocumenti_mask::next_page(int p)
{
TMask::next_page(p);
const int k = (p < 1000) ? curr_page() : p-1000;
enable(DLG_DELREC, del_closed()[k]);
}
void TImmissioneDocumenti_mask::open_day_mask(TDate date)
{
if (!date.ok())
@ -190,35 +201,46 @@ void TImmissioneDocumenti_mask::open_day_mask(TDate date)
fl.replace_items(codes, values);
fl.enable(items > 1);
KEY exitval = sheet.run();
KEY exitval;
switch(exitval)
{
case K_ENTER:
call_ve0(exitval, relation, date, codnum, EMPTY_STRING, currpage);
break;
case K_DEL:
call_ve0(exitval, relation, date, codnum);
break;
case K_INS:
while ((exitval = sheet.run()) != K_ESC)
{
switch(exitval)
{
const TString16 tipo(sheet.get(101));
case K_ENTER:
call_ve0(exitval, relation, date, codnum, EMPTY_STRING, currpage);
break;
case K_DEL:
call_ve0(exitval, relation, date, codnum);
break;
case K_INS:
{
const TString16 tipo(sheet.get(101));
call_ve0(exitval, relation, date, codnum, tipo, currpage);
call_ve0(exitval, relation, date, codnum, tipo, currpage);
}
break;
default:
break;
}
break;
case K_ESC:
break;
default:
break;
}
TDate caput_anni(1, 1, date.year());
}
update_current_calendar(date.year());
}
void TImmissioneDocumenti_mask::update_current_calendar(int year)
{
TDate caput_anni(1, 1, year);
const int currpage = curr_page();
TBit_array & dayfl = (TBit_array&) flags()[currpage];
TString filter;
dayfl.reset();
filter.cut(0);
filter << "(ANNO==\"" << date.year() << "\")" << "&&" << "(CODNUM==\"" << filters().row(currpage) << "\")";
filter << "(ANNO==\"" << year << "\")" << "&&" << "(CODNUM==\"" << filters().row(currpage) << "\")";
TRelation relation(LF_DOC);
TCursor cursor(&relation, filter);
cursor.setfilter(filter);
const int doc_items = cursor.items();
@ -390,6 +412,75 @@ bool TImmissioneDocumenti_mask::is_date_void(int currpage, TDate& cdate)
return !(immissione_documenti_app().has_documents(currpage, cdate));
}
bool delete_closed(const TRelation& rel, void* pJolly)
{
TDocumento & doc = (TDocumento &) rel.lfile().curr();
const int rows = doc.physical_rows();
bool closed = true;
for (int i = 1; closed && i <= rows; i++)
{
const TString & codcms = doc[i].codice_commessa();
const TRectype & cms = cache().get(LF_COMMESSE, codcms);
closed &= cms.get_bool("CHIUSA");
}
if (closed)
{
doc.stato('9');
doc.remove();
}
return true;
}
bool TImmissioneDocumenti_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case DLG_DELREC:
if (e == fe_button)
{
TString descr;
TMask selection("ci0400b");
const int pos = id2pos(31000 + 100 * curr_page());
if (pos >= 0)
descr = fld(pos).prompt();
if (selection.run() == K_ENTER &&
yesno_box("Attenzione !! vuoi cancellare i documenti %s\n delle commesse chiuse", (const char *) descr) &&
yesno_box("Attenzione !! vuoi veramente cancellare i documenti %s\n delle commesse chiuse", (const char *) descr))
{
TRectype from(LF_DOC);
const TDate fromdate = selection.get_date(F_DA_DATA);
if (fromdate.ok())
from.put(DOC_DATADOC, fromdate);
TRectype to(LF_DOC);
const TDate todate = selection.get_date(F_A_DATA);
if (todate.ok())
to.put(DOC_DATADOC, todate);
TString filter;
filter.format("CODNUM==\"%s\"", (const char *) filters().row(curr_page()));
TCursor d(new TRelation(LF_DOC), filter, 3, &from, &to);
d.relation()->lfile().set_curr(new TDocumento());
d.scan(delete_closed, NULL, "Cancellazione documenti commesse chiuse");
update_current_calendar(selected_day().year());
}
}
break;
default:
TAlmanac_mask::on_field_event(o, e, jolly);
break;
}
return true;
}
///////////////////////////////////////////////////////////
// Main
///////////////////////////////////////////////////////////

View File

@ -14,13 +14,16 @@ class TImmissioneDocumenti_mask : public TAlmanac_mask
TBit_array _modify;
TBit_array _doccoll;
TBit_array _modcoll;
TBit_array _delclosed;
TString_array _numcoll;
TString_array _tipocoll;
TString_array _statocoll;
TString_array _varcoll;
protected:
virtual void next_page(int p);
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
// ereditato da TAlmanac_mask
virtual bool is_date_void(int currpage, TDate& cdate);
@ -33,6 +36,7 @@ public:
const TBit_array & ordered() const { return _ordered;}
const TBit_array & doc_coll() const { return _doccoll;}
const TBit_array & mod_coll() const { return _modcoll;}
const TBit_array & del_closed() const { return _delclosed;}
const TString_array & num_coll() const { return _numcoll;}
const TString_array & tipo_coll() const { return _tipocoll;}
const TString_array & stato_coll() const { return _statocoll;}
@ -44,10 +48,13 @@ public:
TBit_array & modify() { return _modify;}
TBit_array & doc_coll() { return _doccoll;}
TBit_array & mod_coll() { return _modcoll;}
TBit_array & del_closed() { return _delclosed;}
TString_array & num_coll() { return _numcoll;}
TString_array & tipo_coll() { return _tipocoll;}
TString_array & stato_coll() { return _statocoll;}
TString_array & var_coll() { return _varcoll;}
void update_current_calendar(int year);
public:
// apertura del foglio interno di gestione dei documenti

View File

@ -4,43 +4,50 @@ TOOLBAR "" 0 -2 0 2
BUTTON DLG_SELECT 10 2
BEGIN
PROMPT -16 -11 "~Selezione"
PROMPT -17 -11 "~Selezione"
MESSAGE EXIT,K_ENTER
PICTURE BMP_SELECT
END
BUTTON F_PREVMONTH 10 2
BEGIN
PROMPT -26 -11 "~Precedente"
PROMPT -27 -11 "~Precedente"
PICTURE BMP_PREVREC
END
LIST F_CHANGEMONTH 10
BEGIN
PROMPT 18 -11 " "
PROMPT -37 -11 ""
FLAGS "M"
END
NUMBER F_CHANGEYEAR 10
BEGIN
PROMPT 44 -11 ""
PROMPT -47 -11 ""
FLAGS "A"
END
BUTTON F_NEXTMONTH 10 2
BEGIN
PROMPT -56 -11 "S~uccessivo"
PROMPT -57 -11 "S~uccessivo"
PICTURE BMP_NEXTREC
END
BUTTON DLG_DELREC 10 2
BEGIN
PROMPT -67 -11 "~Elimina"
MESSAGE EXIT,K_DEL
PICTURE BMP_DELREC
PICTURE BMP_DELRECDN
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -66 -11 "~Fine"
PROMPT -77 -11 "~Fine"
MESSAGE EXIT,K_QUIT
PICTURE BMP_QUIT
PICTURE BMP_QUITDN
END
ENDPAGE
PAGE "Pagina 1" -1 -1 80 20

2
ci/ci0400b.h Executable file
View File

@ -0,0 +1,2 @@
#define F_DA_DATA 101
#define F_A_DATA 102

32
ci/ci0400b.uml Executable file
View File

@ -0,0 +1,32 @@
#include "ci0400b.h"
PAGE "Eliminazione Documenti di Commesse chiuse" -1 -1 40 7
GROUPBOX DLG_NULL 20 4
BEGIN
PROMPT 10 1 "@bData"
END
DATA F_DA_DATA
BEGIN
PROMPT 11 2 "Dal "
END
DATA F_A_DATA
BEGIN
PROMPT 11 3 "Al "
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE
ENDMASK

View File

@ -314,6 +314,22 @@ bool TAlmanac_window::on_key(KEY key)
break;
case K_ENTER:
((TAlmanac_mask&)o.mask()).open_day_mask();
break;
case K_PREV:
case K_NEXT:
case K_CTRL+K_F1:
case K_CTRL+K_F2:
case K_CTRL+K_F3:
case K_CTRL+K_F4:
case K_CTRL+K_F5:
case K_CTRL+K_F6:
case K_CTRL+K_F7:
case K_CTRL+K_F8:
case K_CTRL+K_F9:
case K_CTRL+K_F10:
case K_CTRL+K_F11:
case K_CTRL+K_F12:
o.mask().on_key(key);
break;
default:
return TField_window::on_key(key);

View File

@ -1127,6 +1127,7 @@ int TDocumento::remove(TBaseisamfile& f) const
if (!cancellabile() && !yesno_box("Documento non cancellabile,\nContinuare ugualmente"))
return NOERR;
const bool check_movmag = dongle().active(MGAUT) && tipo().mov_mag();
const bool doc_bloccato = bloccato();
if (check_movmag)
{
@ -1139,32 +1140,44 @@ int TDocumento::remove(TBaseisamfile& f) const
mov.put(MOVMAG_NUMREG, num);
while (mov.read(m, _isequal, _testandlock) == _islocked)
message_box("Movimento di magazzino in uso da parte di un'altro utente");
mov.remove(m);
if (doc_bloccato)
{
const int rows = mov.rows();
for (int i= 1; i <= rows; i++)
mov.body()[i].zero(RMOVMAG_TIPORIGA);
mov.rewrite(m);
}
else
mov.remove(m);
}
}
if (tipo().statistiche() && _has_stat_ven)
{
TString80 key(get(DOC_PROVV)); key << get(DOC_ANNO); key << get(DOC_CODNUM); key << get(DOC_NDOC);
TStats_agg * st_agg = (TStats_agg *) _docs_to_agg.objptr(key);
if (!doc_bloccato)
{
if (tipo().statistiche() && _has_stat_ven)
{
TString80 key(get(DOC_PROVV)); key << get(DOC_ANNO); key << get(DOC_CODNUM); key << get(DOC_NDOC);
TStats_agg * st_agg = (TStats_agg *) _docs_to_agg.objptr(key);
if (st_agg != NULL)
{
st_agg->update();
_docs_to_agg.remove(key);
}
}
if (_has_provv && tipo().provvigioni())
{
const TString8 agente(get(DOC_CODAG));
const int anno = TDocumento::anno();
const TString4 codnum(numerazione());
const long ndoc = numero();
if (st_agg != NULL)
{
st_agg->update();
_docs_to_agg.remove(key);
}
}
if (_has_provv && tipo().provvigioni())
{
const TString8 agente(get(DOC_CODAG));
const int anno = TDocumento::anno();
const TString4 codnum(numerazione());
const long ndoc = numero();
// Legge le provvigioni per questo documento
_provv_agente->read(agente, anno,codnum,ndoc);
// Le rimuove
_provv_agente->remove();
}
// Legge le provvigioni per questo documento
_provv_agente->read(agente, anno,codnum,ndoc);
// Le rimuove
_provv_agente->remove();
}
}
return TMultiple_rectype::remove(f);
}