Corretta gestione residuo e accorciate descrizioni sullo sheet
git-svn-id: svn://10.65.10.50/trunk@1900 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
f1e2e3862b
commit
9a02bc9d0c
@ -345,20 +345,20 @@ END
|
|||||||
SPREADSHEET F_SHEETCG
|
SPREADSHEET F_SHEETCG
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 0 8 ""
|
PROMPT 0 8 ""
|
||||||
ITEM "Dare@15"
|
ITEM "Dare@15F"
|
||||||
ITEM "Avere@15"
|
ITEM "Avere@15F"
|
||||||
ITEM "CF@1"
|
ITEM "CF@1"
|
||||||
ITEM "Gr."
|
ITEM "Gr."
|
||||||
ITEM "Co."
|
ITEM "Co."
|
||||||
ITEM "Sottoc.@6"
|
ITEM "Sott.@6"
|
||||||
ITEM "Descrizione conto@50"
|
ITEM "Descrizione conto@30"
|
||||||
ITEM "Codice"
|
ITEM "Codice"
|
||||||
ITEM "Descrizione riga@50"
|
ITEM "Descrizione riga@30"
|
||||||
ITEM "CF@1"
|
ITEM "CF@1"
|
||||||
ITEM "Gr./c@3"
|
ITEM "Gr./c@3"
|
||||||
ITEM "Co./c@3"
|
ITEM "Co./c@3"
|
||||||
ITEM "Sottoc./c@6"
|
ITEM "Sott./c@6"
|
||||||
ITEM "Descrizione contropartita@50"
|
ITEM "Descrizione contropartita@30"
|
||||||
ITEM "Giornale"
|
ITEM "Giornale"
|
||||||
ITEM " @1"
|
ITEM " @1"
|
||||||
END
|
END
|
||||||
|
@ -661,20 +661,20 @@ END
|
|||||||
SPREADSHEET F_SHEETCG
|
SPREADSHEET F_SHEETCG
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 0 12 ""
|
PROMPT 0 12 ""
|
||||||
ITEM "Dare@15"
|
ITEM "Dare@15F"
|
||||||
ITEM "Avere@15"
|
ITEM "Avere@15F"
|
||||||
ITEM "C/F@1"
|
ITEM "C/F@1"
|
||||||
ITEM "Gr."
|
ITEM "Gr."
|
||||||
ITEM "Co."
|
ITEM "Co."
|
||||||
ITEM "Sottoc.@6"
|
ITEM "Sott.@6"
|
||||||
ITEM "Descrizione conto@50"
|
ITEM "Descrizione conto@30"
|
||||||
ITEM "Codice"
|
ITEM "Codice"
|
||||||
ITEM "Descrizione riga@50"
|
ITEM "Descrizione riga@30"
|
||||||
ITEM "C/F@1"
|
ITEM "C/F@1"
|
||||||
ITEM "Gr./c@3"
|
ITEM "Gr./c@3"
|
||||||
ITEM "Co./c@3"
|
ITEM "Co./c@3"
|
||||||
ITEM "Sottoc./c@6"
|
ITEM "Sott./c@6"
|
||||||
ITEM "Descrizione contropartita@50"
|
ITEM "Descrizione contropartita@30"
|
||||||
ITEM "Giornale"
|
ITEM "Giornale"
|
||||||
ITEM " @1"
|
ITEM " @1"
|
||||||
END
|
END
|
||||||
|
@ -1811,6 +1811,11 @@ bool TPrimanota_application::totdoc_handler(TMask_field& f, KEY key)
|
|||||||
app().add_cgs_tot(m);
|
app().add_cgs_tot(m);
|
||||||
m.field(F_CODIVA).on_hit();
|
m.field(F_CODIVA).on_hit();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (app().is_pagamento())
|
||||||
|
app().calcola_saldo();
|
||||||
|
}
|
||||||
|
|
||||||
TMask_field& totval = m.field(S_TOTDOCVAL);
|
TMask_field& totval = m.field(S_TOTDOCVAL);
|
||||||
if (totval.active() && totval.get().empty())
|
if (totval.active() && totval.get().empty())
|
||||||
|
@ -229,7 +229,6 @@ public:
|
|||||||
|
|
||||||
TCausale& causale() const { return *_causale; }
|
TCausale& causale() const { return *_causale; }
|
||||||
TPartite_array& partite() { return _partite; } // Partite editate
|
TPartite_array& partite() { return _partite; } // Partite editate
|
||||||
int nuovo_pagamento(TPartita& p, int nriga, int rata, int rmov);
|
|
||||||
bool edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp);
|
bool edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp);
|
||||||
bool notify_edit_pagamento(TPartita& partita, TRectype& new_pag,
|
bool notify_edit_pagamento(TPartita& partita, TRectype& new_pag,
|
||||||
const TValuta& valuta, int deleting = -1);
|
const TValuta& valuta, int deleting = -1);
|
||||||
|
216
cg/cg2105.cpp
216
cg/cg2105.cpp
@ -40,6 +40,7 @@ protected:
|
|||||||
|
|
||||||
int update_partita(const TPartita& game, int prow);
|
int update_partita(const TPartita& game, int prow);
|
||||||
void update_saldo_clifo();
|
void update_saldo_clifo();
|
||||||
|
int nuovo_pagamento(TPartita& partita, int nriga, int rata);
|
||||||
|
|
||||||
bool cerca_valuta(TValuta& val) const;
|
bool cerca_valuta(TValuta& val) const;
|
||||||
void aggiorna_valuta(const TValuta& val);
|
void aggiorna_valuta(const TValuta& val);
|
||||||
@ -63,12 +64,14 @@ TGame_mask::TGame_mask(const TBill& bill, long numreg, int riga)
|
|||||||
set(P_SOTTOCONTO, _conto.sottoconto());
|
set(P_SOTTOCONTO, _conto.sottoconto());
|
||||||
set(P_DESCR, ((TBill&)_conto).descrizione());
|
set(P_DESCR, ((TBill&)_conto).descrizione());
|
||||||
|
|
||||||
TMask& cm = app().curr_mask();
|
TValuta val;
|
||||||
const TString& val = cm.get(S_VALUTA);
|
if (numreg > 0)
|
||||||
if (val.not_empty())
|
{
|
||||||
{
|
TMask& cm = app().curr_mask();
|
||||||
TValuta val;
|
|
||||||
val.get(cm, S_VALUTA, S_DATACAMBIO, S_CAMBIO);
|
val.get(cm, S_VALUTA, S_DATACAMBIO, S_CAMBIO);
|
||||||
|
}
|
||||||
|
if (val.in_valuta())
|
||||||
|
{
|
||||||
cerca_valuta(val);
|
cerca_valuta(val);
|
||||||
val.set(*this, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
|
val.set(*this, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
|
||||||
enable(-3);
|
enable(-3);
|
||||||
@ -422,6 +425,105 @@ bool TGame_mask::partite_notify(TSheet_field& partite, int r, KEY k)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int TGame_mask::nuovo_pagamento(TPartita& partita, int nriga, int rata)
|
||||||
|
{
|
||||||
|
const TBill& conto = partita.conto(); // Legge conto principale
|
||||||
|
int nrigp = partita.mov2rig(_numreg, _numrig); // Cerca riga partita relativa alla riga rmov
|
||||||
|
TMask& cm = app().curr_mask();
|
||||||
|
const TCausale& causale = app().causale();
|
||||||
|
|
||||||
|
if (nrigp <= 0) // Devo creare una nuova riga di partita
|
||||||
|
{
|
||||||
|
TRiga_partite& part = partita.new_row(); // Creazione nuova riga vuota
|
||||||
|
nrigp = part.get_int(PART_NRIGA);
|
||||||
|
|
||||||
|
// Copia dati movimento corrente
|
||||||
|
part.put(PART_NREG, _numreg); // Numero operazione
|
||||||
|
part.put(PART_NUMRIG, _numrig); // Riga su cui ho cliccato
|
||||||
|
part.put(PART_DATAREG, cm.get(F_DATAREG));
|
||||||
|
part.put(PART_DATADOC, cm.get(F_DATADOC));
|
||||||
|
part.put(PART_NUMDOC, cm.get(F_NUMDOC));
|
||||||
|
part.put(PART_DESCR, cm.get(F_DESCR));
|
||||||
|
part.put(PART_CODVAL, cm.get(S_VALUTA));
|
||||||
|
part.put(PART_CAMBIO, cm.get(S_CAMBIO));
|
||||||
|
part.put(PART_DATACAM, cm.get(S_DATACAMBIO));
|
||||||
|
|
||||||
|
// Copia dati causale corrente
|
||||||
|
const int tipomov = causale.tipomov();
|
||||||
|
part.put(PART_TIPOMOV, tipomov);
|
||||||
|
part.put(PART_CODCAUS, causale.codice());
|
||||||
|
if (causale.iva() != nessuna_iva)
|
||||||
|
{
|
||||||
|
part.put(PART_REG, cm.get(F_CODREG));
|
||||||
|
part.put(PART_PROTIVA, cm.get(F_PROTIVA));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Complesso algoritmo per calcolare la sezione di una nuova riga partita
|
||||||
|
char sezione = causale.sezione(1); // Usa la sezione della causale
|
||||||
|
if (sezione <= ' ') // Se non c'e' la sezione bell'e' ch'e' pronta
|
||||||
|
{
|
||||||
|
if (tipomov == 1 || tipomov == 5) // calcola in base al tipo movimento e
|
||||||
|
sezione = (conto.tipo() == 'C') ? 'D' : 'A'; // al tipo cliente/fornitore
|
||||||
|
else
|
||||||
|
sezione = (conto.tipo() == 'C') ? 'A' : 'D';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (conto.tipo() > ' ') // Se il tipo e' C o F
|
||||||
|
{
|
||||||
|
TBill bill; causale.bill(1, bill); // Legge primo conto causale
|
||||||
|
if (bill.tipo() != conto.tipo())
|
||||||
|
sezione = (sezione == 'D') ? 'A' : 'D'; // scambia segno
|
||||||
|
}
|
||||||
|
|
||||||
|
part.put(PART_SEZ, sezione); // Memorizza solo la sezione (importi nulli)
|
||||||
|
part.put(PART_SEZABB, sezione);
|
||||||
|
part.put(PART_SEZDIFCAM, sezione);
|
||||||
|
}
|
||||||
|
|
||||||
|
TRectype& pagamento = partita.pagamento(nriga, rata, nrigp); // Crea nuovo pagamento
|
||||||
|
|
||||||
|
int caus = 2; // Calcola riga causale per la contropartita in base al tipo pagamento
|
||||||
|
if (rata != TPartita::UNASSIGNED)
|
||||||
|
{
|
||||||
|
const TRiga_scadenze& scad = partita.rata(nriga, rata);
|
||||||
|
const int tp = scad.get_int(SCAD_TIPOPAG);
|
||||||
|
switch (tp)
|
||||||
|
{
|
||||||
|
case 2: // Tratta
|
||||||
|
case 7: // Tratta accettata
|
||||||
|
caus = 3; break;
|
||||||
|
case 3: // Ricevuta bancaria
|
||||||
|
caus = 4; break;
|
||||||
|
case 4: // Cessione
|
||||||
|
caus = 5; break;
|
||||||
|
case 5: // Paghero'
|
||||||
|
caus = 6; break;
|
||||||
|
case 6: // Fattura di credito
|
||||||
|
caus = 7; break;
|
||||||
|
case 1: // Rimessa
|
||||||
|
case 8: // Rapporti interbancari diretti
|
||||||
|
case 9: // Bonifico
|
||||||
|
default:
|
||||||
|
caus = 2; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
pagamento.put(PAGSCA_TIPOPAG, tp);
|
||||||
|
pagamento.put(PAGSCA_CODABIPR, scad.get(SCAD_CODABIPR));
|
||||||
|
pagamento.put(PAGSCA_CODCABPR, scad.get(SCAD_CODCABPR));
|
||||||
|
pagamento.put(PAGSCA_CODABI, scad.get(SCAD_CODABI));
|
||||||
|
pagamento.put(PAGSCA_CODCAB, scad.get(SCAD_CODCAB));
|
||||||
|
pagamento.put(PAGSCA_CODAG, scad.get(SCAD_CODAG));
|
||||||
|
pagamento.put(PAGSCA_DATAPAG, cm.get(F_DATADOC));
|
||||||
|
}
|
||||||
|
|
||||||
|
TBill contro; causale.bill(caus, contro); // Legge conto contropartita
|
||||||
|
if (contro.empty()) // Se non specificato ...
|
||||||
|
causale.bill(caus = 1, contro); // ... prende il primo
|
||||||
|
contro.put(pagamento, TRUE); // Scrive conto contropartita
|
||||||
|
|
||||||
|
return nrigp;
|
||||||
|
}
|
||||||
|
|
||||||
bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
if (k == K_SPACE)
|
if (k == K_SPACE)
|
||||||
@ -446,7 +548,7 @@ bool TGame_mask::edit_scadenza_handler(TMask_field& f, KEY k)
|
|||||||
int nrigp = m.get_int(112);
|
int nrigp = m.get_int(112);
|
||||||
if (nrigp == 0)
|
if (nrigp == 0)
|
||||||
{
|
{
|
||||||
nrigp = app().nuovo_pagamento(game, nriga, nrata, gm._numrig);
|
nrigp = gm.nuovo_pagamento(game, nriga, nrata);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -496,7 +598,7 @@ bool TGame_mask::nuovo_handler(TMask_field& f, KEY k)
|
|||||||
|
|
||||||
const int nriga = TPartita::UNASSIGNED;
|
const int nriga = TPartita::UNASSIGNED;
|
||||||
const int nrata = TPartita::UNASSIGNED;
|
const int nrata = TPartita::UNASSIGNED;
|
||||||
const int nrigp = app().nuovo_pagamento(game, nriga, nrata, gm._numrig);
|
const int nrigp = gm.nuovo_pagamento(game, nriga, nrata);
|
||||||
app().edit_pagamento(game, nriga, nrata, nrigp);
|
app().edit_pagamento(game, nriga, nrata, nrigp);
|
||||||
if (game.ok())
|
if (game.ok())
|
||||||
{
|
{
|
||||||
@ -874,106 +976,6 @@ bool TPrimanota_application::edit_partite(int riga)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int TPrimanota_application::nuovo_pagamento(TPartita& partita, int nriga, int rata, int numrig)
|
|
||||||
{
|
|
||||||
const TBill& conto = partita.conto(); // Legge conto principale
|
|
||||||
const long numreg = curr_mask().get_long(F_NUMREG);
|
|
||||||
int nrigp = partita.mov2rig(numreg, numrig); // Cerca riga partita relativa alla riga rmov
|
|
||||||
|
|
||||||
if (nrigp <= 0) // Devo creare una nuova riga di partita
|
|
||||||
{
|
|
||||||
TRiga_partite& part = partita.new_row(); // Creazione nuova riga vuota
|
|
||||||
nrigp = part.get_int(PART_NRIGA);
|
|
||||||
|
|
||||||
// Copia dati movimento corrente
|
|
||||||
part.put(PART_NREG, numreg); // Numero operazione
|
|
||||||
part.put(PART_NUMRIG, numrig); // Riga su cui ho cliccato
|
|
||||||
part.put(PART_DATAREG, curr_mask().get(F_DATAREG));
|
|
||||||
part.put(PART_DATADOC, curr_mask().get(F_DATADOC));
|
|
||||||
part.put(PART_NUMDOC, curr_mask().get(F_NUMDOC));
|
|
||||||
part.put(PART_DESCR, curr_mask().get(F_DESCR));
|
|
||||||
part.put(PART_CODVAL, curr_mask().get(S_VALUTA));
|
|
||||||
part.put(PART_CAMBIO, curr_mask().get(S_CAMBIO));
|
|
||||||
part.put(PART_DATACAM, curr_mask().get(S_DATACAMBIO));
|
|
||||||
|
|
||||||
// Copia dati causale corrente
|
|
||||||
const int tipomov = causale().tipomov();
|
|
||||||
part.put(PART_TIPOMOV, tipomov);
|
|
||||||
part.put(PART_CODCAUS, causale().codice());
|
|
||||||
if (causale().iva() != nessuna_iva)
|
|
||||||
{
|
|
||||||
part.put(PART_REG, curr_mask().get(F_CODREG));
|
|
||||||
part.put(PART_PROTIVA, curr_mask().get(F_PROTIVA));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Complesso algoritmo per calcolare la sezione di una nuova riga partita
|
|
||||||
char sezione = causale().sezione(1); // Usa la sezione della causale
|
|
||||||
if (sezione <= ' ') // Se non c'e' la sezione bell'e' ch'e' pronta
|
|
||||||
{
|
|
||||||
if (tipomov == 1 || tipomov == 5) // calcola in base al tipo movimento e
|
|
||||||
sezione = (conto.tipo() == 'C') ? 'D' : 'A'; // al tipo cliente/fornitore
|
|
||||||
else
|
|
||||||
sezione = (conto.tipo() == 'C') ? 'A' : 'D';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (conto.tipo() > ' ') // Se il tipo e' C o F
|
|
||||||
{
|
|
||||||
TBill bill; causale().bill(1, bill); // Legge primo conto causale
|
|
||||||
if (bill.tipo() != conto.tipo())
|
|
||||||
sezione = (sezione == 'D') ? 'A' : 'D'; // scambia segno
|
|
||||||
}
|
|
||||||
|
|
||||||
part.put(PART_SEZ, sezione); // Memorizza solo la sezione (importi nulli)
|
|
||||||
part.put(PART_SEZABB, sezione);
|
|
||||||
part.put(PART_SEZDIFCAM, sezione);
|
|
||||||
}
|
|
||||||
|
|
||||||
TRectype& pagamento = partita.pagamento(nriga, rata, nrigp); // Crea nuovo pagamento
|
|
||||||
|
|
||||||
int caus = 2; // Calcola riga causale per la contropartita in base al tipo pagamento
|
|
||||||
if (rata != TPartita::UNASSIGNED)
|
|
||||||
{
|
|
||||||
const TRiga_scadenze& scad = partita.rata(nriga, rata);
|
|
||||||
const int tp = scad.get_int(SCAD_TIPOPAG);
|
|
||||||
switch (tp)
|
|
||||||
{
|
|
||||||
case 2: // Tratta
|
|
||||||
case 7: // Tratta accettata
|
|
||||||
caus = 3; break;
|
|
||||||
case 3: // Ricevuta bancaria
|
|
||||||
caus = 4; break;
|
|
||||||
case 4: // Cessione
|
|
||||||
caus = 5; break;
|
|
||||||
case 5: // Paghero'
|
|
||||||
caus = 6; break;
|
|
||||||
case 6: // Fattura di credito
|
|
||||||
caus = 7; break;
|
|
||||||
case 1: // Rimessa
|
|
||||||
case 8: // Rapporti interbancari diretti
|
|
||||||
case 9: // Bonifico
|
|
||||||
default:
|
|
||||||
caus = 2; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
pagamento.put(PAGSCA_TIPOPAG, tp);
|
|
||||||
pagamento.put(PAGSCA_CODABIPR, scad.get(SCAD_CODABIPR));
|
|
||||||
pagamento.put(PAGSCA_CODCABPR, scad.get(SCAD_CODCABPR));
|
|
||||||
pagamento.put(PAGSCA_CODABI, scad.get(SCAD_CODABI));
|
|
||||||
pagamento.put(PAGSCA_CODCAB, scad.get(SCAD_CODCAB));
|
|
||||||
pagamento.put(PAGSCA_CODAG, scad.get(SCAD_CODAG));
|
|
||||||
pagamento.put(PAGSCA_DATAPAG, curr_mask().get(F_DATADOC));
|
|
||||||
}
|
|
||||||
|
|
||||||
TBill contro; causale().bill(caus, contro); // Legge conto contropartita
|
|
||||||
if (contro.empty()) // Se non specificato ...
|
|
||||||
causale().bill(caus = 1, contro); // ... prende il primo
|
|
||||||
contro.put(pagamento, TRUE); // Scrive conto contropartita
|
|
||||||
|
|
||||||
return nrigp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// deleting significato
|
// deleting significato
|
||||||
// -1 non sto cancellando nulla
|
// -1 non sto cancellando nulla
|
||||||
// 0 sto cancellando tutto
|
// 0 sto cancellando tutto
|
||||||
|
@ -1285,7 +1285,6 @@ void TPagamento::set_sheet(TSheet_field& sf, int sscad)
|
|||||||
for (int i = 0; i < n_rate(); i++)
|
for (int i = 0; i < n_rate(); i++)
|
||||||
{
|
{
|
||||||
TToken_string& ts = sf.row(i);
|
TToken_string& ts = sf.row(i);
|
||||||
// istanzia, o stronzo
|
|
||||||
ts.add((const char*)data_rata(i), 0); // 0 - Data scadenza
|
ts.add((const char*)data_rata(i), 0); // 0 - Data scadenza
|
||||||
if (in_valuta)
|
if (in_valuta)
|
||||||
{
|
{
|
||||||
@ -1375,5 +1374,4 @@ _def_tpr(1), _def_ulc(""), _round(0), _int_rate(30)
|
|||||||
_inizio = data;
|
_inizio = data;
|
||||||
if (_code.blank() || !read())
|
if (_code.blank() || !read())
|
||||||
_new = TRUE;
|
_new = TRUE;
|
||||||
// if (_new && data != NULL) error_box("Modalita' pagamento inesistente");
|
|
||||||
}
|
}
|
@ -86,6 +86,7 @@ public:
|
|||||||
void val2lit(real& val) const;
|
void val2lit(real& val) const;
|
||||||
void val2lit(TImporto& imp) const;
|
void val2lit(TImporto& imp) const;
|
||||||
bool in_lire() const { return _cam == 1.0; }
|
bool in_lire() const { return _cam == 1.0; }
|
||||||
|
bool in_valuta() const { return _cam != 1.0; }
|
||||||
|
|
||||||
void get(const TRectype& rec);
|
void get(const TRectype& rec);
|
||||||
void put(TRectype& rec) const;
|
void put(TRectype& rec) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user