Generazione automatica descrizioni saldaconto in prima nota
git-svn-id: svn://10.65.10.50/branches/R_10_00@22858 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
f2dfd50a0b
commit
649be11f1e
@ -15,7 +15,6 @@ int main(int argc, char** argv)
|
||||
case 6: cg0700(argc,argv); break; // Clienti/Fornitori occasionali
|
||||
default: cg0100(argc,argv); break; // Piano dei conti
|
||||
}
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
120
cg/cg2105.cpp
120
cg/cg2105.cpp
@ -1979,12 +1979,113 @@ bool TGame_mask::edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp) co
|
||||
// Edit delle partite
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
static bool genera_riferimento(int riga, TString& rif)
|
||||
{
|
||||
TToken_string& row = app().cgs().row(riga);
|
||||
const char tipocf = row.get_char(CG_TIPO - 101);
|
||||
if (tipocf != 'C' && tipocf != 'F')
|
||||
return false;
|
||||
|
||||
rif = ini_get_string(CONFIG_DITTA, "cg", tipocf == 'C' ? "DescInc" : "DescPag");
|
||||
if (rif.blank())
|
||||
return false;
|
||||
|
||||
const TMask& mov_mask = app().curr_mask();
|
||||
|
||||
bool ok = true;
|
||||
for (int p = rif.find('{'); p >= 0; p = rif.find('{'))
|
||||
{
|
||||
char conn = ' ';
|
||||
int q = p + 1;
|
||||
|
||||
if (rif[q] == '\\' || rif[q] == '&' || rif[q] == '|')
|
||||
conn = rif[q++];
|
||||
const int last = rif.find('}', p);
|
||||
const TString16 field_name(rif.sub(q, last));
|
||||
const TFieldref field(field_name, LF_MOV);
|
||||
if (last < 0)
|
||||
rif.cut(p);
|
||||
else
|
||||
{
|
||||
const int len = rif.len() - last;
|
||||
for (int i = 0; i <= len; i++)
|
||||
rif[p + i] = rif[last + i + 1];
|
||||
}
|
||||
|
||||
TString val;
|
||||
|
||||
if (field.file() == LF_MOV)
|
||||
{
|
||||
const TMask_field* mf = mov_mask.find_by_fieldname(field.name());
|
||||
if (mf != NULL)
|
||||
{
|
||||
val = mf->get();
|
||||
if (field.to() > 0)
|
||||
val = val.sub(field.from(), field.to());
|
||||
rif.insert(val, p);
|
||||
}
|
||||
} else
|
||||
if (field.file() == LF_RMOV)
|
||||
{
|
||||
TMask& row_mask = app().cgs().sheet_row_mask(riga);
|
||||
const TMask_field* rf = row_mask.find_by_fieldname(field.name());
|
||||
if (rf != NULL)
|
||||
{
|
||||
val = rf->get();
|
||||
if (field.to() > 0)
|
||||
val = val.sub(field.from(), field.to());
|
||||
rif.insert(val, p);
|
||||
}
|
||||
} else
|
||||
if (field.file() == LF_PARTITE)
|
||||
{
|
||||
TToken_string lista(50,',');
|
||||
TPartite_array& games = app().partite();
|
||||
const long nreg = mov_mask.insert_mode() ? 999999 : mov_mask.get_long(F_NUMREG);
|
||||
for (TPartita* game = games.first(); game; game = games.next())
|
||||
{
|
||||
int nriga = game->mov2rig(nreg, riga+1);
|
||||
if (nriga > 0)
|
||||
{
|
||||
nriga = game->prima_fattura();
|
||||
if (nriga > 0)
|
||||
{
|
||||
val = field.read(game->riga(nriga));
|
||||
if (val.full() && lista.get_pos(val) < 0)
|
||||
lista.add(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
val = lista;
|
||||
rif.insert(val, p);
|
||||
}
|
||||
|
||||
switch (conn)
|
||||
{
|
||||
case '\\' :
|
||||
ok = val.full();
|
||||
break;
|
||||
case '&' :
|
||||
ok &= val.full();
|
||||
break;
|
||||
case '|' :
|
||||
ok |= val.full();
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!ok)
|
||||
rif.cut(0);
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TPrimanota_application::edit_partite(const TMask& m, int riga)
|
||||
{
|
||||
const char tipo = m.get(CG_TIPO)[0];
|
||||
const char rt = m.get(CG_ROWTYPE)[0];
|
||||
if (rt == 'T' && tipo <= ' ') // Nelle note di credito DEVE essere un clifo
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
const int gruppo = m.get_int(CG_GRUPPO);
|
||||
const int conto = m.get_int(CG_CONTO);
|
||||
@ -2031,6 +2132,23 @@ bool TPrimanota_application::edit_partite(const TMask& m, int riga)
|
||||
|
||||
if (changed)
|
||||
{
|
||||
if (m.field(CG_DESCR).empty())
|
||||
{
|
||||
TString descr;
|
||||
if (genera_riferimento(riga, descr))
|
||||
{
|
||||
TSheet_field& s = cgs();
|
||||
s.row(riga).add(descr, CG_DESCR-101);
|
||||
TBill conto; conto.get(s.row(riga), 2, 0x3);
|
||||
for (int r = riga+1; r < s.items(); r++)
|
||||
{
|
||||
TBill contro; contro.get(s.row(r), 9, 0x3);
|
||||
if (conto == contro)
|
||||
s.row(r).add(descr, CG_DESCR-101);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cgs().force_update(); // Aggiornamento righe contabili
|
||||
calcola_saldo();
|
||||
_sal_dirty = true;
|
||||
|
@ -1914,7 +1914,7 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
|
||||
}
|
||||
}
|
||||
|
||||
TString80 cms;
|
||||
TString cms;
|
||||
for (int h = hits.first_one(); h >= 0 && h <= last_rmovana; h++) if (hits[h])
|
||||
{
|
||||
const TRectype& r = rmovana.row(h);
|
||||
@ -1928,6 +1928,8 @@ void TMastrini_grid::cell_request(long rec, short id, TGrid_cell& cell)
|
||||
if (cms.not_empty())
|
||||
cms << ' ';
|
||||
cms << cod;
|
||||
if (cms.len() >= cell.size())
|
||||
break;
|
||||
}
|
||||
if (cms.len() >= cell.size())
|
||||
cms.cut(cell.size()-1);
|
||||
|
@ -1187,9 +1187,20 @@ void TLiquidazione_app::recalc_att(int month, const char* codatt)
|
||||
id.put(MOV_DATAREG, _mov->get(MOV_DATADOC));
|
||||
id.put(RMI_CODIVA, _rmoviva->get(RMI_CODIVA));
|
||||
id.put("SEZIONE", sezfat);
|
||||
|
||||
id.put("IMPORTO", imponibile_orig+imposta_orig);
|
||||
id.put(RMI_IMPONIBILE, imponibile_orig);
|
||||
id.put(RMI_IMPOSTA, imposta_orig);
|
||||
|
||||
if (percind > ZERO) // Nel caso di IVA indetraibile memorizza solo la parte detraibile!
|
||||
{
|
||||
real imp_det, iva_det, imp_ind, iva_ind;
|
||||
analizza_IVA(imponibile_orig, imposta_orig, percind, corrisp, false, codiva,
|
||||
imp_det, iva_det, imp_ind, iva_ind);
|
||||
id.put(RMI_IMPOSTA, iva_det);
|
||||
}
|
||||
else
|
||||
id.put(RMI_IMPOSTA, imposta_orig);
|
||||
|
||||
id.write_rewrite();
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ int main(int argc,char** argv)
|
||||
case 6: cg5600(argc,argv); break; // Ripristino liquidazione
|
||||
case 7: cg5700(argc,argv); break; // Comunicazione annuale dati IVA
|
||||
case 8: cg5800(argc,argv); break; // Quadro VT
|
||||
case 9: cg5900(argc,argv); break; // Stampa Prorata
|
||||
default: cg5000(argc,argv); break; // Parametri Studio
|
||||
}
|
||||
return 0;
|
||||
|
1
cg/cg5.h
1
cg/cg5.h
@ -7,3 +7,4 @@ int cg5500 (int argc, char* argv[]);
|
||||
int cg5600 (int argc, char* argv[]);
|
||||
int cg5700 (int argc, char* argv[]);
|
||||
int cg5800 (int argc, char* argv[]);
|
||||
int cg5900 (int argc, char* argv[]);
|
||||
|
@ -19,6 +19,8 @@
|
||||
#define FLD_DATSAL 119
|
||||
#define CHK_EASYSAL 120
|
||||
#define CHK_DIFFCAM 121
|
||||
#define FLD_DES_INC 122
|
||||
#define FLD_DES_PAG 123
|
||||
|
||||
#define FLD_CSBICHS 217
|
||||
#define FLD_CSBICHG 218
|
||||
|
@ -45,7 +45,7 @@ END
|
||||
|
||||
GROUPBOX DLG_NULL 76 6
|
||||
BEGIN
|
||||
PROMPT 2 6 "@bParametri contabilita'"
|
||||
PROMPT 2 6 "@bParametri contabilità"
|
||||
END
|
||||
|
||||
BOOLEAN CHK_GSLBCN
|
||||
@ -88,7 +88,7 @@ BEGIN
|
||||
GROUP GROUP_CONTABILITA
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 76 8
|
||||
GROUPBOX DLG_NULL 76 10
|
||||
BEGIN
|
||||
PROMPT 2 12 "@bParametri saldaconto"
|
||||
END
|
||||
@ -200,6 +200,20 @@ BEGIN
|
||||
FLAGS "H" // Per ora Vladimiro non lo vuole
|
||||
END
|
||||
|
||||
STRING FLD_DES_INC 50 47
|
||||
BEGIN
|
||||
PROMPT 4 19 "Descrizione incassi "
|
||||
FIELD DescInc
|
||||
GROUP GROUP_SALDACONTO
|
||||
END
|
||||
|
||||
STRING FLD_DES_PAG 50 47
|
||||
BEGIN
|
||||
PROMPT 4 20 "Descrizione pagamenti "
|
||||
FIELD DescPag
|
||||
GROUP GROUP_SALDACONTO
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
|
||||
@ -267,7 +281,7 @@ END
|
||||
STRING FLD_COCACH 3
|
||||
BEGIN
|
||||
PROMPT 1 4 "Codice causale chiusura "
|
||||
HELP "Codice della causale di chiusura che generera' il movimento"
|
||||
HELP "Codice della causale di chiusura che genererà il movimento"
|
||||
USE LF_CAUSALI SELECT MOVAP="C"
|
||||
INPUT CODCAUS FLD_COCACH
|
||||
DISPLAY "Codice" CODCAUS
|
||||
@ -284,7 +298,7 @@ END
|
||||
STRING FLD_DCOCACH 50 35
|
||||
BEGIN
|
||||
PROMPT 40 4 ""
|
||||
HELP "Codice della causale di chiusura che generera' il movimento"
|
||||
HELP "Codice della causale di chiusura che genererà il movimento"
|
||||
USE LF_CAUSALI KEY 2 SELECT MOVAP="C"
|
||||
INPUT DESCR FLD_DCOCACH
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
@ -298,7 +312,7 @@ END
|
||||
STRING FLD_COCAAP 3
|
||||
BEGIN
|
||||
PROMPT 1 5 "Codice causale apertura "
|
||||
HELP "Codice della causale di apertura che generera' il movimento"
|
||||
HELP "Codice della causale di apertura che genererà il movimento"
|
||||
FLAGS "UZ"
|
||||
USE LF_CAUSALI SELECT MOVAP="A"
|
||||
INPUT CODCAUS FLD_COCAAP
|
||||
@ -314,7 +328,7 @@ END
|
||||
STRING FLD_DCOCAAP 50 35
|
||||
BEGIN
|
||||
PROMPT 40 5 ""
|
||||
HELP "Codice della causale di apertura che generera' il movimento"
|
||||
HELP "Codice della causale di apertura che genererà il movimento"
|
||||
USE LF_CAUSALI KEY 2 SELECT MOVAP="A"
|
||||
INPUT DESCR FLD_DCOCAAP
|
||||
COPY DISPLAY FLD_DCOCACH
|
||||
@ -830,7 +844,7 @@ END
|
||||
STRING FLD_RRCCRA 3
|
||||
BEGIN
|
||||
PROMPT 2 7 "Causale "
|
||||
HELP "Codice causale dei ratei per movimento di contabilita'"
|
||||
HELP "Codice causale dei ratei per movimento di contabilità"
|
||||
FLAGS "UZ"
|
||||
USE LF_CAUSALI
|
||||
INPUT CODCAUS FLD_RRCCRA
|
||||
@ -846,7 +860,7 @@ END
|
||||
STRING FLD_DRRCCRA 50 52
|
||||
BEGIN
|
||||
PROMPT 22 7 ""
|
||||
HELP "Descrizione causale dei ratei per movimento di contabilita'"
|
||||
HELP "Descrizione causale dei ratei per movimento di contabilità"
|
||||
USE LF_CAUSALI KEY 2
|
||||
INPUT DESCR FLD_DRRCCRA
|
||||
COPY DISPLAY FLD_DCOCACH
|
||||
@ -919,7 +933,7 @@ END
|
||||
STRING FLD_RRCCRI 3
|
||||
BEGIN
|
||||
PROMPT 2 12 "Causale "
|
||||
HELP "Codice causale dei risconti per movimento di contabilita'"
|
||||
HELP "Codice causale dei risconti per movimento di contabilità"
|
||||
FLAGS "UZ"
|
||||
COPY USE FLD_RRCCRA
|
||||
INPUT CODCAUS FLD_RRCCRI
|
||||
@ -935,7 +949,7 @@ END
|
||||
STRING FLD_DRRCCRI 50 52
|
||||
BEGIN
|
||||
PROMPT 22 12 ""
|
||||
HELP "Descrizione causale dei risconti per movimento di contabilita'"
|
||||
HELP "Descrizione causale dei risconti per movimento di contabilità"
|
||||
USE LF_CAUSALI KEY 2
|
||||
INPUT DESCR FLD_DRRCCRI
|
||||
COPY DISPLAY FLD_DCOCACH
|
||||
|
@ -170,7 +170,7 @@ bool TRic_archivi::leggi_marker()
|
||||
return error_box(FR("File marker non presente in %s: impossibile proseguire"), (const char*)_pathname);
|
||||
}
|
||||
|
||||
const int size = 64;
|
||||
const size_t size = 64;
|
||||
TString80 buffer;
|
||||
|
||||
FILE* i = fopen(_marker,"r+t"); // Perche' non semplicemente "rb"?
|
||||
@ -179,14 +179,19 @@ bool TRic_archivi::leggi_marker()
|
||||
const size_t letti = fread(buffer.get_buffer(),1,size,i);
|
||||
fclose(i);
|
||||
if (letti < size)
|
||||
return error_box(TR("Errore di lettura del MARKER: impossibile proseguire"));
|
||||
{
|
||||
if (letti < 34)
|
||||
return error_box(TR("Errore di lettura del MARKER: lunghezza diversa da 64"));
|
||||
else
|
||||
warning_box(TR("Errore di lettura del MARKER: lunghezza diversa da 64"));
|
||||
}
|
||||
|
||||
_progdisk = atoi(buffer.sub(31,33));
|
||||
_numtotdisk = atoi(buffer.sub(29,31));
|
||||
|
||||
if (_numtotdisk == 0)
|
||||
{
|
||||
message_box(TR("Il numero totale dischi su marker non e' significativo: impossibile proseguire"));
|
||||
message_box(TR("Il numero totale dischi su marker non è significativo: impossibile proseguire"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -209,10 +214,12 @@ bool TRic_archivi::leggi_marker()
|
||||
_totrectras = atol(buffer.sub(23,29));
|
||||
|
||||
if (_numdisk > 1) //Va fatto solo dal disco 2 in poi
|
||||
if (_nomeid != _nomeidp || _dittainv != _dittainvp || _totrectras != _totrectrasp
|
||||
|| _numinv != _numinvp || _datatras != _datatrasp)
|
||||
{
|
||||
if (_nomeid != _nomeidp || _dittainv != _dittainvp || _totrectras != _totrectrasp ||
|
||||
_numinv != _numinvp || _datatras != _datatrasp)
|
||||
return error_box(FR("I dati del marker del disco %d, non corrispondono ai dati del marker del disco 1"), _numdisk);
|
||||
|
||||
}
|
||||
|
||||
_nomeidp = _nomeid;
|
||||
_dittainvp = _dittainv;
|
||||
_totrectrasp = _totrectras;
|
||||
@ -226,7 +233,7 @@ bool TRic_archivi::leggi_marker()
|
||||
if (_dittaric != 0)
|
||||
{
|
||||
if (!prefix().exist(_dittaric))
|
||||
return error_box(FR("Libreria archivi ditta %ld non presente su disco"), _dittaric);
|
||||
return error_box(FR("Archivi ditta %ld non presente su disco"), _dittaric);
|
||||
}
|
||||
else
|
||||
return error_box(FR("Codici NON PRESENTI in tabella ricezione:\ncaricare %s %ld e riprovare"),
|
||||
|
@ -1919,7 +1919,7 @@ TImporto TPartita::calcola_saldo_al(bool valuta,const TDate& al, const TDate & d
|
||||
}
|
||||
|
||||
|
||||
real TPartita::calcola_scaduto_al(bool valuta,const TDate& al) const
|
||||
real TPartita::calcola_scaduto_al(bool valuta, const TDate& al) const
|
||||
{
|
||||
const int ultima = last();
|
||||
if (ultima > 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user