Gestione contatti in anagrafica clienti / fornitori
git-svn-id: svn://10.65.10.50/branches/R_10_00@22655 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
0e941ecd50
commit
896b7a6552
121
cg/cg0200.cpp
121
cg/cg0200.cpp
@ -313,32 +313,55 @@ bool TClifo_application::crea_percipienti(TMask_field& f, KEY key)
|
||||
TLocalisamfile anag(LF_ANAG);
|
||||
TToken_string k;
|
||||
long percip = m.get_long(F_CODANAGPER);
|
||||
const char tipo = m.get(F_TIPOAPER)[0];
|
||||
const char tipo = m.get(F_TIPOAPER)[0];
|
||||
|
||||
if (percip == 0)
|
||||
{
|
||||
percip = m.get_long(F_CODCF);
|
||||
k.add(tipo);
|
||||
k.add(percip);
|
||||
const TRectype & rec = cache().get(LF_ANAG, k);
|
||||
const TString& cofi = m.get(F_COFI);
|
||||
if (cofi.full())
|
||||
{
|
||||
anag.setkey(3);
|
||||
anag.put(ANA_TIPOA, tipo);
|
||||
anag.put(ANA_COFI, cofi);
|
||||
if (anag.read() == NOERR)
|
||||
percip = anag.get_long(ANA_CODANAGR);
|
||||
}
|
||||
if (percip == 0)
|
||||
{
|
||||
const TString& paiv = m.get(F_PAIV);
|
||||
if (paiv.full())
|
||||
{
|
||||
anag.setkey(4);
|
||||
anag.put(ANA_TIPOA, tipo);
|
||||
anag.put(ANA_STATOPAIV, m.get(F_STATOPAIV));
|
||||
anag.put(ANA_PAIV, paiv);
|
||||
if (anag.read() == NOERR)
|
||||
percip = anag.get_long(ANA_CODANAGR);
|
||||
}
|
||||
}
|
||||
if (percip == 0)
|
||||
{
|
||||
percip = m.get_long(F_CODCF);
|
||||
|
||||
if (!rec.empty())
|
||||
{
|
||||
message_box("Esiste gia' una anagrafica con codice uguale del fornitore");
|
||||
m.set(F_CODANAGPER, rec.get_long(ANA_CODANAGR));
|
||||
return true;
|
||||
}
|
||||
m.set(F_CODANAGPER, percip);
|
||||
}
|
||||
else
|
||||
{
|
||||
k.add(m.get(F_TIPOAPER));
|
||||
k.add(percip);
|
||||
const TRectype & rec = cache().get(LF_ANAG, k);
|
||||
if (!rec.empty())
|
||||
return true;
|
||||
anag.setkey(1);
|
||||
anag.put(ANA_TIPOA, tipo);
|
||||
anag.put(ANA_CODANAGR, percip);
|
||||
if (anag.read() == NOERR)
|
||||
{
|
||||
m.set(F_CODANAGPER, percip);
|
||||
message_box(TR("Esiste già una anagrafica corrispondente al fornitore"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m.set(F_CODANAGPER, percip);
|
||||
anag.setkey(1);
|
||||
anag.put(ANA_TIPOA, tipo);
|
||||
anag.put(ANA_CODANAGR, percip);
|
||||
if (anag.read() == NOERR)
|
||||
return true;
|
||||
|
||||
anag.put(ANA_TIPOA, tipo);
|
||||
anag.put(ANA_CODANAGR, percip);
|
||||
anag.put(ANA_COFI, m.get(F_COFI));
|
||||
@ -355,7 +378,6 @@ bool TClifo_application::crea_percipienti(TMask_field& f, KEY key)
|
||||
anag.put(ANA_CAPRES, m.get(F_CAPCF));
|
||||
|
||||
int err = anag.write();
|
||||
|
||||
if (err == _isreinsert)
|
||||
return true;
|
||||
if (err == NOERR)
|
||||
@ -370,7 +392,7 @@ bool TClifo_application::crea_percipienti(TMask_field& f, KEY key)
|
||||
anafis.put(ANF_COMNASC, m.get(F_COMNASC));
|
||||
err = anafis.write();
|
||||
if (err != NOERR)
|
||||
return message_box("Scrittura anagrafica persona fisica Errore %d", err);
|
||||
return cantwrite_box(anafis.description());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -380,11 +402,11 @@ bool TClifo_application::crea_percipienti(TMask_field& f, KEY key)
|
||||
|
||||
err = anagiu.write();
|
||||
if (err != NOERR)
|
||||
return message_box("Scrittura anagrafica persona fisica Errore %d", err);
|
||||
return cantwrite_box(anagiu.description());
|
||||
}
|
||||
}
|
||||
else
|
||||
return message_box("Scrittura anagrafica Errore %d", err);
|
||||
return cantwrite_box(anag.description());
|
||||
|
||||
}
|
||||
return true;
|
||||
@ -820,7 +842,7 @@ int TClifo_application::read(TMask& m)
|
||||
{
|
||||
TToken_string riga(240);
|
||||
indsp_sheet().reset();
|
||||
for (i = 0; i < _rel->indirizzi_items(); i++)
|
||||
for (i = 0; i < _rel->indirizzi(); i++)
|
||||
{
|
||||
TRectype& rec=_rel->indirizzo(i);
|
||||
riga.cut(0);
|
||||
@ -857,6 +879,17 @@ int TClifo_application::read(TMask& m)
|
||||
field_sheet(F_CODINDSP).add(riga);
|
||||
field_sheet(F_CODINDEFF).add(riga);
|
||||
}
|
||||
|
||||
TSheet_field& s = m.sfield(F_SHEET_CONT);
|
||||
s.destroy();
|
||||
for (int c = 0; c < _rel->contatti(); c++)
|
||||
{
|
||||
const TRectype& contact = _rel->contatto(c);
|
||||
TToken_string& row = s.row(-1);
|
||||
row = contact.get("SECOND");
|
||||
row << "|||" << contact.get("DATA");
|
||||
s.check_row(c);
|
||||
}
|
||||
}
|
||||
|
||||
TToken_string key;
|
||||
@ -1206,9 +1239,7 @@ void TClifo_application::get_pnae(const TMask& m, TToken_string& nonacceff, TTok
|
||||
|
||||
void TClifo_application::common_f(const TMask& m)
|
||||
{
|
||||
TString alter = m.get(F_RICALT);
|
||||
int i;
|
||||
|
||||
const TString& alter = m.get(F_RICALT);
|
||||
if (alter.blank() && m.mode() == MODE_INS)
|
||||
((TMask &)m).set(F_RICALT, m.get(F_RAGSOC).left(m.field(F_RICALT).size()));
|
||||
|
||||
@ -1228,7 +1259,7 @@ void TClifo_application::common_f(const TMask& m)
|
||||
TArray& rows=indsp_sheet().rows_array();
|
||||
int n_items = rows.items();
|
||||
|
||||
for (i = 0; i < n_items; i++)
|
||||
for (int i = 0; i < n_items; i++)
|
||||
{
|
||||
TToken_string& row=(TToken_string&)rows[i];
|
||||
TRectype& rec=_rel->indirizzo(i);
|
||||
@ -1252,9 +1283,31 @@ void TClifo_application::common_f(const TMask& m)
|
||||
rec.put(IND_INDIR2,row.get());
|
||||
rec.put(IND_CODIND,i+1);
|
||||
}
|
||||
}
|
||||
TToken_string key;
|
||||
|
||||
TToken_string data;
|
||||
TString8 first, second;
|
||||
first.format("%c%06ld", m.get(F_TIPOCF)[0], m.get_long(F_CODCF));
|
||||
TSheet_field& s = m.sfield(F_SHEET_CONT);
|
||||
FOR_EACH_SHEET_ROW(s, r, row)
|
||||
{
|
||||
TRectype& rec=_rel->contatto(r);
|
||||
rec.put("COD", "BACON");
|
||||
rec.put("FIRST", first);
|
||||
second.format("%06ld", row->get_long(0));
|
||||
rec.put("SECOND", second);
|
||||
row->get(2);
|
||||
data.cut(0);
|
||||
const char* d = NULL;
|
||||
while ((d = row->get()))
|
||||
{
|
||||
if (*d > ' ')
|
||||
data.add(d);
|
||||
}
|
||||
rec.put("DATA", data);
|
||||
}
|
||||
}
|
||||
|
||||
TToken_string key;
|
||||
key.add(m.get(F_TIPOCF));
|
||||
key.add(m.get(F_CODCF));
|
||||
key.add("V");
|
||||
@ -1266,7 +1319,7 @@ void TClifo_application::common_f(const TMask& m)
|
||||
TSheet_field & ns_sh = m.sfield(F_BANA);
|
||||
const int nsrow = ns_sh.items();
|
||||
|
||||
for (i = 0; i < nsrow; i++)
|
||||
for (int i = 0; i < nsrow; i++)
|
||||
{
|
||||
TToken_string & row = ns_sh.row(i);
|
||||
TRectype & ban = ns_ban.row(i + 1, true);
|
||||
@ -1304,7 +1357,7 @@ void TClifo_application::common_f(const TMask& m)
|
||||
TSheet_field & vs_sh = m.sfield(F_BANP);
|
||||
const int vsrow = vs_sh.items();
|
||||
|
||||
for (i = 0; i < vsrow; i++)
|
||||
for (int i = 0; i < vsrow; i++)
|
||||
{
|
||||
TToken_string & row = vs_sh.row(i);
|
||||
TRectype & ban = vs_ban.row(i + 1, true);
|
||||
@ -1379,7 +1432,7 @@ bool TClifo_application::effetti_notify(TSheet_field& pnae, int r, KEY key)
|
||||
TClifo_application& a = app();
|
||||
const TRectype& cfven = a.get_relation()->curr(LF_CFVEN);
|
||||
const int mass_len = cfven.length(CFV_NONACCEFF); // Lunghezza campo
|
||||
const int mass_rig = mass_len / 11; // Numero di periodi ivi salvabili
|
||||
const int mass_rig = mass_len / 11; // Numero di periodi IVA salvabili
|
||||
return pnae.items() < mass_rig; // Non accettare righe che non si possono salvare
|
||||
}
|
||||
|
||||
|
@ -119,6 +119,7 @@
|
||||
#define F_CODVETT1 217
|
||||
#define F_CODVETT2 218
|
||||
#define F_CODVETT3 219
|
||||
#define F_SHEET_CONT 220
|
||||
#define F_DESTACF 224
|
||||
#define F_CODSPED1 225
|
||||
#define F_CODSPED2 226
|
||||
|
@ -70,7 +70,7 @@ BEGIN
|
||||
INPUT TIPOCF F_TIPOCF SELECT
|
||||
INPUT RAGSOC[1,30] F_RAGSOC
|
||||
DISPLAY "Ragione sociale@50" RAGSOC
|
||||
DISPLAY "Sospeso" SOSPESO
|
||||
DISPLAY "Sospeso@C" SOSPESO
|
||||
DISPLAY "Codice@R" CODCF
|
||||
DISPLAY "Codice fiscale@16" COFI
|
||||
DISPLAY "Partita IVA@11" PAIV
|
||||
@ -537,9 +537,9 @@ BEGIN
|
||||
ITEM "G|Giuridica"
|
||||
END
|
||||
|
||||
BUTTON DLG_ANAG 19 1
|
||||
BUTTON DLG_ANAG 17 1
|
||||
BEGIN
|
||||
PROMPT 37 15 "Crea percipiente"
|
||||
PROMPT 39 15 "Nuovo percipiente"
|
||||
GROUP 4
|
||||
END
|
||||
|
||||
@ -1140,44 +1140,45 @@ ENDPAGE
|
||||
|
||||
PAGE "Indirizzi" -1 -1 78 19
|
||||
|
||||
GROUPBOX DLG_NULL 76 4
|
||||
GROUPBOX DLG_NULL 76 3
|
||||
BEGIN
|
||||
PROMPT 1 0 "Dati identificativi"
|
||||
END
|
||||
|
||||
LIST DLG_NULL 1 11
|
||||
LIST DLG_NULL 1 9
|
||||
BEGIN
|
||||
PROMPT 2 1 "Tipo "
|
||||
PROMPT 2 1 ""
|
||||
FLAGS "D"
|
||||
GROUP 1
|
||||
ITEM "C|Clienti"
|
||||
ITEM "F|Fornitori"
|
||||
ITEM "C|Cliente"
|
||||
ITEM "F|Fornitore"
|
||||
END
|
||||
|
||||
NUMBER DLG_NULL 6
|
||||
BEGIN
|
||||
PROMPT 2 2 "Codice "
|
||||
FLAGS "RD"
|
||||
PROMPT 15 1 ""
|
||||
FLAGS "D"
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
STRING DLG_NULL 30
|
||||
BEGIN
|
||||
PROMPT 25 1 "Cognome/Rag. Soc. "
|
||||
PROMPT 23 1 ""
|
||||
FLAGS "D"
|
||||
GROUP 3
|
||||
END
|
||||
|
||||
STRING DLG_NULL 20
|
||||
BEGIN
|
||||
PROMPT 25 2 "Nome/Seconda parte Rag. Soc. "
|
||||
PROMPT 55 1 ""
|
||||
FLAGS "D"
|
||||
GROUP 6
|
||||
GROUP 4
|
||||
END
|
||||
|
||||
SPREADSHEET F_SHEET_G_VEN 0 -4
|
||||
|
||||
SPREADSHEET F_SHEET_G_VEN 0 9
|
||||
BEGIN
|
||||
PROMPT 0 4 ""
|
||||
PROMPT 0 3 ""
|
||||
ITEM "Ragione Sociale@50"
|
||||
ITEM "Indirizzo@35"
|
||||
ITEM "N. civico@10"
|
||||
@ -1194,11 +1195,16 @@ BEGIN
|
||||
ITEM "Indirizzo aggiuntivo@35"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 76 3
|
||||
BEGIN
|
||||
PROMPT 1 12 "@bIndirizzi predefiniti"
|
||||
END
|
||||
|
||||
NUMBER F_CODINDDOC 3
|
||||
BEGIN
|
||||
PROMPT 2 -3 "Codice indirizzo documento "
|
||||
PROMPT 2 13 "Documenti "
|
||||
FIELD LF_CFVEN->CODINDDOC
|
||||
SHEET "Codice|Ragione sociale@50|Indirizzo@35|Nr.@10|Localita@35"
|
||||
SHEET "Codice|Ragione sociale@50|Indirizzo@35|Nr.@10|Località@35"
|
||||
ITEM " |**Nessuno**| | | "
|
||||
INPUT F_CODINDDOC
|
||||
OUTPUT F_CODINDDOC
|
||||
@ -1206,9 +1212,9 @@ END
|
||||
|
||||
NUMBER F_CODINDSP 3
|
||||
BEGIN
|
||||
PROMPT 2 -2 "Codice indirizzo spedizione "
|
||||
PROMPT 32 13 "Spedizione "
|
||||
FIELD LF_CFVEN->CODINDSP
|
||||
SHEET "Codice|Ragione sociale@50|Indirizzo@35|Nr.@10|Localita@35"
|
||||
SHEET "Codice|Ragione sociale@50|Indirizzo@35|Nr.@10|Località@35"
|
||||
INPUT F_CODINDSP
|
||||
OUTPUT F_CODINDSP
|
||||
HELP "Codice dell'indirizzo di spedizione da proporre"
|
||||
@ -1216,14 +1222,28 @@ END
|
||||
|
||||
NUMBER F_CODINDEFF 3
|
||||
BEGIN
|
||||
PROMPT 2 -1 "Codice indirizzo effetti "
|
||||
PROMPT 62 13 "Effetti "
|
||||
FIELD LF_CFVEN->CODINDEFF
|
||||
SHEET "Codice|Ragione sociale@50|Indirizzo@35|Nr.@10|Localita@35"
|
||||
SHEET "Codice|Ragione sociale@50|Indirizzo@35|Nr.@10|Località@35"
|
||||
INPUT F_CODINDEFF
|
||||
OUTPUT F_CODINDEFF
|
||||
HELP "Codice indirizzo effetti"
|
||||
END
|
||||
|
||||
SPREADSHEET F_SHEET_CONT
|
||||
BEGIN
|
||||
PROMPT 0 15 ""
|
||||
ITEM "Contatto@R"
|
||||
ITEM "Nome@20"
|
||||
ITEM "Cognome@30"
|
||||
ITEM "Documento 1"
|
||||
ITEM "Documento 2"
|
||||
ITEM "Documento 3"
|
||||
ITEM "Documento 4"
|
||||
ITEM "Documento 5"
|
||||
ITEM "Documento 6"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Dati vendita 1" -1 -1 78 19
|
||||
@ -1471,14 +1491,14 @@ BEGIN
|
||||
PROMPT 1 0 "Dati identificativi"
|
||||
END
|
||||
|
||||
LIST DLG_NULL 1 11
|
||||
LIST DLG_NULL 1 9
|
||||
BEGIN
|
||||
PROMPT 2 1 "Tipo "
|
||||
FLAGS "DG"
|
||||
GROUP 1
|
||||
ITEM "C|Clienti"
|
||||
ITEM "C|Cliente"
|
||||
MESSAGE HIDE,F_CODFASS|HIDE,F_DESCRASS
|
||||
ITEM "F|Fornitori"
|
||||
ITEM "F|Fornitore"
|
||||
MESSAGE SHOW,F_CODFASS|SHOW,F_DESCRASS
|
||||
END
|
||||
|
||||
@ -1534,7 +1554,7 @@ END
|
||||
|
||||
STRING F_CODSPMEZZO 3
|
||||
BEGIN
|
||||
PROMPT 43 4 "Codice modalita' spedizione "
|
||||
PROMPT 43 4 "Codice modalità spedizione "
|
||||
FIELD LF_CFVEN->CODSPMEZZO
|
||||
USE %MSP
|
||||
INPUT CODTAB F_CODSPMEZZO
|
||||
|
@ -157,3 +157,93 @@ END
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
PAGE "Contatti" -1 -1 68 7
|
||||
|
||||
NUMBER 101 6
|
||||
BEGIN
|
||||
PROMPT 1 0 "Contatto "
|
||||
USE LF_CONTACT KEY 3
|
||||
INPUT TIPOCF -F_TIPOCF SELECT
|
||||
INPUT CODCF -F_CODCF SELECT
|
||||
INPUT CONTACT 101
|
||||
DISPLAY "Codice" CONTACT
|
||||
DISPLAY "Nome@50" NOME
|
||||
DISPLAY "Cognome@50" COGNOME
|
||||
OUTPUT 101 CONTACT
|
||||
OUTPUT 102 NOME
|
||||
OUTPUT 103 COGNOME
|
||||
CHECKTYPE REQUIRED
|
||||
ADD RUN ba4 -6
|
||||
END
|
||||
|
||||
STRING 102 50
|
||||
BEGIN
|
||||
PROMPT 1 1 "Nome "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
STRING 103 50
|
||||
BEGIN
|
||||
PROMPT 1 2 "Cognome "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 65 4
|
||||
BEGIN
|
||||
PROMPT 1 3 "Documenti / Profili"
|
||||
END
|
||||
|
||||
STRING 104 8
|
||||
BEGIN
|
||||
PROMPT 2 4 "Tipo 1 "
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING 105 8
|
||||
BEGIN
|
||||
PROMPT 24 4 "Tipo 2 "
|
||||
END
|
||||
|
||||
STRING 106 8
|
||||
BEGIN
|
||||
PROMPT 46 4 "Tipo 3 "
|
||||
END
|
||||
|
||||
STRING 107 8
|
||||
BEGIN
|
||||
PROMPT 2 5 "Tipo 4 "
|
||||
END
|
||||
|
||||
STRING 108 8
|
||||
BEGIN
|
||||
PROMPT 24 5 "Tipo 5 "
|
||||
END
|
||||
|
||||
STRING 109 8
|
||||
BEGIN
|
||||
PROMPT 46 5 "Tipo 6 "
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
TOOLBAR "bottombar" 0 0 0 2
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT 1 1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 10 2
|
||||
BEGIN
|
||||
PROMPT 2 1 "Elimina"
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 10 2
|
||||
BEGIN
|
||||
PROMPT 3 1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
125
cg/cg0201.cpp
125
cg/cg0201.cpp
@ -1,5 +1,7 @@
|
||||
#include "cg0201.h"
|
||||
|
||||
#include <recset.h>
|
||||
|
||||
#include <clifo.h>
|
||||
#include <modaut.h>
|
||||
#include <indsp.h>
|
||||
@ -15,6 +17,7 @@ TClifoVI::TClifoVI() : TRelation(LF_CLIFO), _oldindirizzi(0), _gesven(FALSE)
|
||||
void TClifoVI::destroy_rows()
|
||||
{
|
||||
_indirizzi.destroy();
|
||||
_contatti.destroy();
|
||||
}
|
||||
|
||||
TRectype& TClifoVI::indirizzo(int i)
|
||||
@ -29,29 +32,105 @@ TRectype& TClifoVI::indirizzo(int i)
|
||||
return *r;
|
||||
}
|
||||
|
||||
TRectype& TClifoVI::contatto(int i)
|
||||
{
|
||||
TRectype* r= (TRectype*)_contatti.objptr(i);
|
||||
if (r == NULL)
|
||||
{
|
||||
r = new TRectype(LF_MULTIREL);
|
||||
_contatti.add(r,i);
|
||||
}
|
||||
return *r;
|
||||
}
|
||||
|
||||
|
||||
int TClifoVI::read_indirizzi()
|
||||
{
|
||||
destroy_rows();
|
||||
|
||||
if (_gesven)
|
||||
{
|
||||
const TLocalisamfile& rind = lfile(LF_INDSP);
|
||||
const TRectype& rind = curr(LF_INDSP);
|
||||
for (bool ok=is_first_match(LF_INDSP); ok; ok=next_match(LF_INDSP))
|
||||
{
|
||||
const int nriga=rind.get_int(IND_CODIND) -1;
|
||||
indirizzo(nriga)=rind.curr();
|
||||
const int nriga = rind.get_int(IND_CODIND) -1;
|
||||
indirizzo(nriga) = rind;
|
||||
}
|
||||
_oldindirizzi=indirizzi_items();
|
||||
}
|
||||
return NOERR;
|
||||
_oldindirizzi = indirizzi();
|
||||
|
||||
// Read contatti
|
||||
TLocalisamfile cont(LF_MULTIREL);
|
||||
const char tipocf = curr().get_char(CLI_TIPOCF);
|
||||
const long codcf = curr().get_long(CLI_CODCF);
|
||||
TString8 first; first.format("%C%06ld", tipocf, codcf);
|
||||
cont.put("COD", "BACON");
|
||||
cont.put("FIRST", first);
|
||||
for (int err = cont.read(_isgteq);
|
||||
err == NOERR && cont.get("COD") == "BACON" && cont.get("FIRST") == first;
|
||||
err = cont.next())
|
||||
_contatti.add(cont.curr());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TClifoVI::write_contatti()
|
||||
{
|
||||
TAssoc_array old_ones;
|
||||
TLocalisamfile cont(LF_MULTIREL);
|
||||
const char tipocf = curr().get_char(CLI_TIPOCF);
|
||||
const long codcf = curr().get_long(CLI_CODCF);
|
||||
TString8 first; first.format("%C%06ld", tipocf, codcf);
|
||||
cont.put("COD", "BACON");
|
||||
cont.put("FIRST", first);
|
||||
for (int err = cont.read(_isgteq);
|
||||
err == NOERR && cont.get("COD") == "BACON" && cont.get("FIRST") == first;
|
||||
err = cont.next())
|
||||
old_ones.add(cont.curr().get("SECOND"));
|
||||
|
||||
FOR_EACH_ASSOC_OBJECT(old_ones, h, k, r)
|
||||
{
|
||||
bool trovato = false;
|
||||
for (int i = _contatti.last(); i >= 0 && !trovato; i--)
|
||||
{
|
||||
const TRectype& c = (const TRectype&)_contatti[i];
|
||||
trovato = c.get_long("SECOND") == atol(k);
|
||||
}
|
||||
if (!trovato)
|
||||
{
|
||||
cont.zero();
|
||||
cont.put("COD", "BACON");
|
||||
cont.put("FIRST", first);
|
||||
cont.put("SECOND", k);
|
||||
cont.remove();
|
||||
}
|
||||
}
|
||||
|
||||
FOR_EACH_ARRAY_ITEM(_contatti, i, obj)
|
||||
{
|
||||
TRectype& rec = *(TRectype*)obj;
|
||||
if (rec.get("DATA").full())
|
||||
{
|
||||
TString8 second;
|
||||
second.format("%06ld", rec.get_long("SECOND"));
|
||||
rec.put("COD", "BACON");
|
||||
rec.put("FIRST", first);
|
||||
rec.put("SECOND", second);
|
||||
rec.write_rewrite(cont);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TClifoVI::read(TIsamop op, TReclock lockop)
|
||||
{
|
||||
int err = file().read(op,lockop);
|
||||
const int err = file().read(op,lockop);
|
||||
position_rels();
|
||||
|
||||
if (err == NOERR)
|
||||
read_indirizzi();
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -59,9 +138,10 @@ int TClifoVI::write_rec(bool re, const TRectype& rec, TLocalisamfile& f)
|
||||
{
|
||||
if (re)
|
||||
{
|
||||
const bool scrivi= (f.rewrite(rec)!=NOERR);
|
||||
const bool scrivi= f.rewrite(rec)!=NOERR;
|
||||
if (scrivi) f.write(rec);
|
||||
} else
|
||||
}
|
||||
else
|
||||
f.write(rec);
|
||||
return f.status();
|
||||
}
|
||||
@ -101,7 +181,7 @@ int TClifoVI::registra(bool re, bool force)
|
||||
const long codcf=c.get_long(CLI_CODCF);
|
||||
int i;
|
||||
|
||||
for (i=0; i<indirizzi_items(); i++)
|
||||
for (i=0; i<indirizzi(); i++)
|
||||
{
|
||||
if (!re)
|
||||
{
|
||||
@ -112,16 +192,18 @@ int TClifoVI::registra(bool re, bool force)
|
||||
}
|
||||
if (i<_oldindirizzi)
|
||||
cancella(rind,i+1,_oldindirizzi);
|
||||
_oldindirizzi=indirizzi_items();
|
||||
_oldindirizzi=indirizzi();
|
||||
|
||||
write_contatti();
|
||||
}
|
||||
|
||||
if(_geslv)
|
||||
if (_geslv)
|
||||
{
|
||||
TLocalisamfile& lv = lfile(-LVAUT);
|
||||
|
||||
const char tipocf=c.get(CLI_TIPOCF)[0];
|
||||
const long codcf=c.get_long(CLI_CODCF);
|
||||
TString codtab; codtab << tipocf << codcf;
|
||||
TString8 codtab; codtab << tipocf << codcf;
|
||||
|
||||
TRectype& rec = lv.curr();
|
||||
rec.put("CODTAB", codtab);
|
||||
@ -146,19 +228,20 @@ int TClifoVI::rewrite(bool force)
|
||||
|
||||
int TClifoVI::remove()
|
||||
{
|
||||
TLocalisamfile& c=lfile(LF_CLIFO);
|
||||
|
||||
c.remove();
|
||||
const int err = lfile(LF_CLIFO).remove();
|
||||
|
||||
// Put here gest_vend() discrimination
|
||||
if (_gesven)
|
||||
{
|
||||
TLocalisamfile& v=lfile(LF_CFVEN);
|
||||
TLocalisamfile& rind=lfile(LF_INDSP);
|
||||
cancella(rind,1,_oldindirizzi);
|
||||
v.remove();
|
||||
lfile(LF_CFVEN).remove();
|
||||
|
||||
TLocalisamfile& rind = lfile(LF_INDSP);
|
||||
cancella(rind, 1, _oldindirizzi);
|
||||
|
||||
_contatti.destroy();
|
||||
write_contatti();
|
||||
}
|
||||
_oldindirizzi=0;
|
||||
|
||||
return c.status();
|
||||
return err;
|
||||
}
|
||||
|
10
cg/cg0201.h
10
cg/cg0201.h
@ -5,7 +5,7 @@
|
||||
class TClifoVI:public TRelation
|
||||
{
|
||||
// @DPRIV
|
||||
TArray _indirizzi;
|
||||
TArray _indirizzi, _contatti;
|
||||
int _oldindirizzi;
|
||||
bool _gesven, _geslv;
|
||||
|
||||
@ -16,7 +16,10 @@ protected:
|
||||
int cancella(TLocalisamfile& f, int da, int a);
|
||||
int registra(bool re, bool force);
|
||||
int read_indirizzi();
|
||||
int write_contatti();
|
||||
|
||||
// @END
|
||||
|
||||
public:
|
||||
virtual int next(TReclock lockop=_nolock) {return (lfile().next(lockop) || read_indirizzi());}
|
||||
virtual int prev(TReclock lockop=_nolock) {return (lfile().prev(lockop) || read_indirizzi());}
|
||||
@ -29,8 +32,11 @@ public:
|
||||
virtual int remove();
|
||||
|
||||
TRectype& indirizzo(int i);
|
||||
int indirizzi_items() const {return _indirizzi.items();}
|
||||
int indirizzi() const { return _indirizzi.items(); }
|
||||
void destroy_rows();
|
||||
|
||||
TRectype& contatto(int i);
|
||||
int contatti() const { return _contatti.items(); }
|
||||
|
||||
void gestione_vendite(bool gv) { _gesven = gv; }
|
||||
void gestione_lavanderie(bool glv) { _geslv = glv; }
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "cgsaldac.h"
|
||||
#include "cg2103.h"
|
||||
|
||||
#include <doc.h>
|
||||
#include <mov.h>
|
||||
#include <rmov.h>
|
||||
#include <rcausali.h>
|
||||
@ -2268,6 +2269,21 @@ int TPartite_array::add_numreg(long nreg)
|
||||
return items();
|
||||
}
|
||||
|
||||
int TPartite_array::add_rec(const TRectype& rec)
|
||||
{
|
||||
long numreg = 0;
|
||||
switch (rec.num())
|
||||
{
|
||||
case LF_MOV:
|
||||
case LF_RMOV:
|
||||
case LF_RMOVIVA: numreg = rec.get_long(MOV_NUMREG); break;
|
||||
case LF_PARTITE: numreg = rec.get_long(PART_NREG); break;
|
||||
case LF_DOC: numreg = rec.get_long(DOC_NUMREG); break;
|
||||
default: break;
|
||||
}
|
||||
return numreg > 0 ? add_numreg(numreg) : 0L;
|
||||
}
|
||||
|
||||
bool TPartite_array::utilizzata(long numreg, int numrig)
|
||||
{
|
||||
bool ok = false;
|
||||
|
@ -347,7 +347,9 @@ public:
|
||||
bool write(bool re = false);
|
||||
bool rewrite() { return write(true); }
|
||||
|
||||
int add_numreg(long numreg); // Carica tutte le partite relative alla registrazione numreg
|
||||
int add_numreg(long numreg); // Carica tutte le partite relative alla registrazione numreg
|
||||
int add_rec(const TRectype& rec); // Carica tutte le partite relative al record rec (LF_MOV o LF_DOC)
|
||||
|
||||
TImporto importo_speso(long numreg, int numrig, bool valuta = false, int mode = 0xF);
|
||||
void update_reg(const TRectype& mov, long old_reg = 0);
|
||||
|
||||
|
@ -229,7 +229,7 @@ END
|
||||
|
||||
NUMBER F_GRUPPO_INCP 3
|
||||
BEGIN
|
||||
PROMPT 2 10 "Conto addebito "
|
||||
PROMPT 2 11 "Conto addebito "
|
||||
FIELD I9
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
@ -403,7 +403,7 @@ END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Paramteri Distinte" 0 -1 77 20
|
||||
PAGE "Parametri Distinte" 0 -1 77 20
|
||||
|
||||
GROUPBOX DLG_NULL 78 5
|
||||
BEGIN
|
||||
|
Loading…
x
Reference in New Issue
Block a user