Correzioni su errori da PR

git-svn-id: svn://10.65.10.50/trunk@2504 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1996-01-25 17:20:49 +00:00
parent c0af0706e0
commit 05609d3324
12 changed files with 173 additions and 85 deletions

View File

@ -106,6 +106,7 @@ TMask* TPrimanota_application::load_mask(int n)
ism.set_handler(102, codiva_handler);
ism.set_handler(103, detrazione_handler);
ism.set_handler(104, imposta_handler);
ism.set_handler(107, cg_gruppo_handler);
ism.set_handler(109, iva_sottoconto_handler);
ism.set_handler(110, iva_sottoconto_handler);
ism.set_handler(209, sheet_clifo_handler);
@ -151,14 +152,15 @@ TMask* TPrimanota_application::load_mask(int n)
cg.set_notify(cg_notify);
TMask& cgm = cg.sheet_mask();
cgm.set_handler(101, dareavere_handler);
cgm.set_handler(102, dareavere_handler);
cgm.set_handler(105, cg_conto_handler);
cgm.set_handler(106, suspended_handler);
cgm.set_handler(206, sheet_clifo_handler);
cgm.set_handler(306, sheet_clifo_handler);
cgm.set_handler(112, suspended_handler);
cgm.set_handler(113, suspended_handler);
cgm.set_handler(CG_DARE, dareavere_handler);
cgm.set_handler(CG_AVERE, dareavere_handler);
cgm.set_handler(CG_GRUPPO, cg_gruppo_handler);
cgm.set_handler(CG_CONTO, cg_conto_handler);
cgm.set_handler(CG_SOTTOCONTO, suspended_handler);
cgm.set_handler(CG_SOTTOCONTO + 100, sheet_clifo_handler);
cgm.set_handler(CG_SOTTOCONTO + 200, sheet_clifo_handler);
cgm.set_handler(113, suspended_handler); // Contropartita
cgm.set_handler(213, sheet_clifo_handler);
cgm.set_handler(313, sheet_clifo_handler);
}
@ -619,15 +621,17 @@ bool TPrimanota_application::test_swap(bool ritsoc)
int TPrimanota_application::read(TMask& m)
{
m.autoload(_rel);
m.autoload(_rel); // Carica testata
const long numreg = _rel->curr().get_long(MOV_NUMREG);
cgs().reset();
partite().destroy(); // Azzera tutte le partite
cgs().reset(); // Azzera tutte le righe contabili
if (iva() != nessuna_iva)
{
ivas().reset();
ivas().reset(); // Azzera tutte le righe iva
const TString16 occode(_rel->lfile().get("OCFPI"));
occas_mask().set(O_CODICE, occode);
@ -712,7 +716,6 @@ int TPrimanota_application::read(TMask& m)
calcola_imp(); // Calcola totale imponibile ed imposte
partite().destroy();
if (is_fattura()) // Ci sono scadenze
{
if (!read_scadenze(m))

View File

@ -35,8 +35,9 @@
#define F_RITFIS 120
#define F_RITSOC 121
#define F_CODPAG 122
#define F_ANNORIF 123
#define F_NUMRIF 124
#define F_DESPAG 123
#define F_ANNORIF 124
#define F_NUMRIF 125
#define F_PROVVISORIO 129
#define F_TIPOMOV 130
#define F_OCCASEDIT 131
@ -56,6 +57,16 @@
#define F_SHEETCG 190
#define F_SHEETIVA 191
// Sheet contabile
#define CG_DARE 101
#define CG_AVERE 102
#define CG_TIPO 103
#define CG_GRUPPO 104
#define CG_CONTO 105
#define CG_SOTTOCONTO 106
#define CG_ROWTYPE 116
// Campi ripetuti sulla seconda pagina
#define H_DATAREG 201
#define H_NUMREG 202

View File

@ -204,21 +204,6 @@ BEGIN
WARNING "Inserire un riepilogo non inferiore al protocollo IVA (Obbigatorio se il cliete/fornitore ha codice inserimento in allegati uguale a 3)"
END
STRING F_CODPAG 4
BEGIN
PROMPT 60 9 "Pagamento "
FIELD CODPAG
FLAGS "UZ"
USE %CPG
INPUT CODTAB F_CODPAG
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODPAG CODTAB
CHECKTYPE NORMAL
ADD RUN ba3 -6
WARNING "Codice pagamento errato"
END
STRING F_CLIFO 1
BEGIN
PROMPT 0 10 ""
@ -388,9 +373,31 @@ BEGIN
FLAGS "H"
END
STRING F_CODPAG 4
BEGIN
PROMPT 1 12 "Codice Pagamento "
FIELD CODPAG
FLAGS "UZ"
USE %CPG
INPUT CODTAB F_CODPAG
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_CODPAG CODTAB
OUTPUT F_DESPAG S0
CHECKTYPE NORMAL
ADD RUN ba3 -6
WARNING "Codice pagamento errato"
END
STRING F_DESPAG 50
BEGIN
PROMPT 27 12 ""
FLAGS "D"
END
STRING SK_VALUTA 3
BEGIN
PROMPT 1 12 "Valuta "
PROMPT 1 13 "Valuta "
FIELD CODVAL
FLAGS "UZ"
GROUP 3
@ -405,7 +412,7 @@ END
DATE SK_DATACAMBIO
BEGIN
PROMPT 28 12 "Data cambio "
PROMPT 28 13 "Data cambio "
FIELD DATACAM
FLAGS "R"
USE CAM
@ -422,7 +429,7 @@ END
NUMBER SK_CAMBIO 15 5
BEGIN
PROMPT 55 12 "Cambio "
PROMPT 55 13 "Cambio "
FIELD CAMBIO
FLAGS "RU"
GROUP 3
@ -432,14 +439,14 @@ END
NUMBER F_TOTALE 15
BEGIN
PROMPT 1 13 "Totale documento "
PROMPT 1 14 "Totale documento "
FIELD TOTDOC
PICTURE "."
END
NUMBER SK_TOTDOCVAL 15 3
BEGIN
PROMPT 35 13 "Tot. in valuta "
PROMPT 35 14 "Tot. in valuta "
FIELD TOTDOCVAL
GROUP 3
PICTURE ".3"
@ -448,7 +455,7 @@ END
STRING F_CODIVA 4
BEGIN
PROMPT 67 13 "IVA "
PROMPT 67 14 "IVA "
FLAGS "U"
USE %IVA
INPUT CODTAB F_CODIVA
@ -464,7 +471,7 @@ END
NUMBER F_RITFIS 15
BEGIN
PROMPT 1 14 "Ritenute fiscali "
PROMPT 1 15 "Ritenute fiscali "
FIELD RITFIS
FLAGS "RV"
PICTURE "."
@ -472,7 +479,7 @@ END
NUMBER F_RITSOC 15
BEGIN
PROMPT 1 15 "Ritenute sociali "
PROMPT 1 16 "Ritenute sociali "
FIELD RITSOC
FLAGS "RV"
PICTURE "."
@ -480,7 +487,7 @@ END
DATE F_DATA74TER
BEGIN
PROMPT 54 14 "Data 74/ter "
PROMPT 54 15 "Data 74/ter "
WARNING "E' richiesta la data del 74/ter"
CHECKTYPE REQUIRED
FIELD DATA74TER
@ -488,14 +495,14 @@ END
NUMBER F_ANNORIF 4
BEGIN
PROMPT 50 15 "Rif.partita "
PROMPT 50 16 "Rif.partita "
FIELD LF_PARTITE->ANNO
FLAGS "U"
END
STRING F_NUMRIF 7
BEGIN
PROMPT 68 15 "/ "
PROMPT 68 16 "/ "
FIELD LF_PARTITE->NUMPART
FLAGS "U"
END
@ -520,7 +527,7 @@ END
NUMBER F_CAMBIOINTRA 15 5
BEGIN
PROMPT 37 17 "Cambio intracom. "
PROMPT 41 17 "Cambio intracomun. "
FIELD CAMBIOI
FLAGS "RU"
GROUP 4
@ -538,7 +545,7 @@ END
NUMBER F_CORRVALUTA 15 3
BEGIN
PROMPT 37 18 "Corrispettivo valuta "
PROMPT 41 18 "Corrispettivo valuta "
FIELD CORRVALUTA
FLAGS "R"
PICTURE ".3"

View File

@ -186,7 +186,7 @@ int TMovimentoPN::registra(bool re, bool force)
return err;
const int annoiva = m.get_int("ANNOIVA");
const TString16 reg(m.get_str("REG"));
const TString reg(m.get_str("REG"));
TRegistro registro(reg, annoiva);
const bool att_mista = reg.empty() ? FALSE : registro.attivita_mista();
@ -260,7 +260,7 @@ int TMovimentoPN::remove(TDate&)
const TRectype& m = curr();
const TDate datareg(m.get("DATAREG"));
const int annoiva = m.get_int("ANNOIVA");
const TString16 reg(m.get_str("REG"));
const TString reg(m.get_str("REG"));
TRegistro registro(reg, annoiva);
controlla_liquidazione(datareg, registro, TRUE);
}

View File

@ -8,6 +8,7 @@
#include "cg21sld.h"
#include <mov.h>
#include <rmov.h>
#include <clifo.h>
///////////////////////////////////////////////////////////
@ -236,11 +237,11 @@ TImporto TPrimanota_application::get_cgs_imp(int n)
const TMask& m = s.sheet_mask();
if (m.is_running() && s.selected() == n)
{
const TString& imp = m.get(101);
const TString& imp = m.get(CG_DARE);
if (imp.not_empty())
importo.set('D', real(imp));
else
importo.set('A', real(m.get(102)));
importo.set('A', real(m.get(CG_AVERE)));
}
else
importo = s.row(n);
@ -770,6 +771,10 @@ bool TPrimanota_application::cg_notify(TSheet_field& cg, int r, KEY k)
static TImporto old_spesa;
CHECKD(r >= 0, "Chi e' quel ca$$one che notifica la riga ", r);
if (k == K_CTRL + K_DEL)
return TRUE; // Ritorna subito, altrimenti crea riga vuota
TToken_string& row = cg.row(r);
const char tipo = row_type(row); // Tipo della riga in esame
@ -897,8 +902,9 @@ bool TPrimanota_application::dareavere_handler(TMask_field& f, KEY k)
const TImporto speso = app().partite().importo_speso(numreg, numrig);
const char* ss = speso.valore().string();
TMask& m = f.mask();
m.set(101, speso.sezione() == 'D' ? ss : "");
m.set(102, speso.sezione() == 'A' ? ss : "");
m.set(CG_DARE, speso.sezione() == 'D' ? ss : "");
m.set(CG_AVERE, speso.sezione() == 'A' ? ss : "");
app().calcola_saldo();
}
if (k == K_TAB && f.focusdirty() && f.get().not_empty())
@ -1333,24 +1339,45 @@ bool TPrimanota_application::iva_handler(TMask_field& f, KEY k)
return TRUE;
}
// Il gruppo non possiede una ricerca propria per cui se viene variato richiama
// quella del conto.
bool TPrimanota_application::cg_gruppo_handler(TMask_field& f, KEY key)
{
if (key == K_TAB && f.focusdirty())
{
TEdit_field& conto = f.mask().efield(f.dlg()+1);
const TRectype& curr = conto.browse()->cursor()->curr();
if (curr.get(RMV_GRUPPO) != f.get()) // Se non e' gia' posizionato ...
conto.check(RUNNING_CHECK); // ... forza ricerca sul conto
}
return TRUE;
}
bool TPrimanota_application::cg_conto_handler(TMask_field& f, KEY key)
{
bool ok = TRUE;
if (key == K_ENTER)
{
TMask& m = f.mask();
if (m.get(115)[0] == 'T') // Se riga totale documento
if (m.get(CG_ROWTYPE)[0] == 'T') // Se riga totale documento
{
const char cf = m.get(f.dlg()-2)[0];
char tipo = app().clifo();
if (app().causale().corrispettivi()) tipo = ' ';
if (cf != tipo)
char cf = m.get(f.dlg()-2)[0];
if (cf < ' ') cf = ' '; // Tipo conto della riga
char tipo = ' '; // Tipo conto richiesto dal movimento
if (!app().causale().corrispettivi())
tipo = app().clifo();
if (cf != tipo) // Incongruenza!
{
const char* d = tipo == ' ' ? "normale" : (tipo == 'C' ? "clienti" : "fornitori");
return f.error_box("E' richiesto un conto %s.", d);
ok = f.error_box("La riga totale richiede un conto %s.", d);
}
}
}
return TRUE;
return ok;
}
// Gestore del sottoconto dello sheet IVA
@ -1866,10 +1893,19 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
TEdit_field& upi = m.efield(F_RIEPILOGO);
upi.check_type(alleg == 3 ? CHECK_REQUIRED : CHECK_NORMAL);
if (m.insert_mode() && app().is_fattura() && m.get(F_CODPAG).empty())
if (m.insert_mode() && m.get(F_CODPAG).empty())
{
const TString& s = clifo.get(CLI_CODPAG);
m.set(F_CODPAG, s, s.not_empty());
if (s.not_empty())
{
TEdit_field& cp = m.efield(F_CODPAG);
if (cp.active()) // Se il campo F_CODPAG e' attivo
{
cp.set(s); // Setta il codice di pagamento sulla maschera
cp.check(RUNNING_CHECK); // lo decodifica
cp.on_hit(); // lo ricopia eventualmente a pag.3
}
}
}
if (f.focusdirty() && app().is_saldaconto())

View File

@ -106,6 +106,7 @@ class TPrimanota_application : public TRelation_application
static bool codiva_handler(TMask_field& f, KEY key);
static bool imposta_handler(TMask_field& f, KEY key);
static bool dareavere_handler(TMask_field& f, KEY k);
static bool cg_gruppo_handler(TMask_field& f, KEY key);
static bool cg_conto_handler(TMask_field& f, KEY key);
static bool codpag_handler(TMask_field& f, KEY key);

View File

@ -290,12 +290,14 @@ bool TPrimanota_application::tipopag_handler(TMask_field& f, KEY key)
bool TPrimanota_application::codpag_handler(TMask_field& f, KEY key)
{
bool ok = TRUE;
TMask& m = f.mask();
const bool set_scad = m.field(F_NUMRIF).active() && !m.get(F_NUMRIF).blank();
if (key == K_ENTER)
{
const bool required = (m.insert_mode() && !m.get_bool(F_SOLAIVA)) ||
!m.get(F_NUMRIF).blank();
const bool required = (m.insert_mode() && !m.get_bool(F_SOLAIVA)) || set_scad;
if (required && f.get().empty())
{
error_box("Il codice di pagamento e' obbligatorio!\n"
@ -314,18 +316,17 @@ bool TPrimanota_application::codpag_handler(TMask_field& f, KEY key)
if (cp.not_empty())
{
f.set(cp);
if (m.insert_mode())
app().set_scadenze(m);
key = K_TAB;
}
}
return FALSE;
ok = FALSE;
}
}
if (key == K_TAB && f.focusdirty() && m.insert_mode())
if (key == K_TAB && f.focusdirty() && m.insert_mode() && set_scad)
app().set_scadenze(m);
return TRUE;
return ok;
}
bool TPrimanota_application::annorif_handler(TMask_field& f, KEY key)
@ -794,7 +795,7 @@ void TPrimanota_application::write_scadenze(const TMask& m)
// put data on partita
partita.put(PART_TIPOMOV, tmov);
partita.put(PART_NREG, nreg);
partita.put(PART_NUMRIG, 1);
partita.put(PART_NUMRIG, riga_clifo+1);
partita.put(PART_DATAREG, m.get(F_DATAREG));
partita.put(PART_DATADOC, m.get(F_DATADOC));
partita.put(PART_NUMDOC, m.get(F_NUMDOC));
@ -948,6 +949,7 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
const TRectype& old_pag = p.pagamento(nriga, nrata, nrigp);
const TRiga_partite& somma = p.riga(nrigp);
const int riga_contabile = somma.get_int(PART_NUMRIG); // Riga movimento
TSheet_field& sheet = cgs();
if (deleting >= 0)
{
@ -968,7 +970,7 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
{
const bool empty = sub_cgs_imp(old_riga, old_importo);
if (empty && (new_importo.is_zero() || new_conto != old_conto))
reset_cgs_row(old_riga);
sheet.destroy(old_riga);
}
// Importo della contropartita
@ -1003,7 +1005,7 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
else
{
const bool empty = add_cgs_imp(riga, grow_ritenute);
if (empty) reset_cgs_row(riga);
if (empty) sheet.destroy(riga);
}
}
} // if (deleting != 0)
@ -1025,7 +1027,7 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
CHECK(riga_abb >= 0, "Chiss'e' fregato gli abbuoni?");
const bool empty = add_cgs_imp(riga_abb, old_abbuono);
if (empty && new_ap != old_ap)
cgs().destroy(riga_abb);
sheet.destroy(riga_abb);
if (deleting != riga_contabile)
{
@ -1075,7 +1077,8 @@ bool TPrimanota_application::notify_edit_pagamento(TPartita& p, TRectype& new_pa
else
{
const bool empty = add_cgs_imp(riga_diffcam, grow_diffcam);
if (empty) cgs().destroy(riga_diffcam);
if (empty)
sheet.destroy(riga_diffcam);
}
if (deleting != riga_contabile)

View File

@ -7,6 +7,7 @@
#include "cg2102.h" // Applicazione di prima nota
#endif
#include <causali.h> // Archivio causali
#include <clifo.h> // Archivio clienti/fornitori
#include <mov.h> // Archivio movimenti di prima nota
#include <pagsca.h> // Archivio pagamenti
@ -22,6 +23,8 @@ class TPay_mask : public TMask
TDate _datadoc;
real _da_pagare, _pagabile;
TDecoder _causale;
protected:
static bool importo_handler(TMask_field& f, KEY k);
static bool importolire_handler(TMask_field& f, KEY k);
@ -39,7 +42,8 @@ public:
virtual ~TPay_mask() {}
};
TPay_mask::TPay_mask() : TMask("cg2100s")
TPay_mask::TPay_mask()
: TMask("cg2100s"), _causale(LF_CAUSALI, CAU_CODCAUS, CAU_DESCR)
{
}
@ -66,7 +70,14 @@ void TPay_mask::set_pag(const TRectype& oldpag, const TRiga_scadenze& scad,
set(S_NUMDOC, fatt.get(PART_NUMDOC)); // Numero documento
set(S_DATADOC, fatt.get(PART_DATADOC)); // Data documento
set(S_NUMPROT, fatt.get(PART_PROTIVA)); // Protocollo IVA
set(S_DESCR, fatt.get(PART_DESCR)); // Descrizione fattura
TString desfat = fatt.get(PART_DESCR); // Descrizione fattura
if (desfat.empty()) // Se e' vuota ...
{
desfat = fatt.get(PART_CODCAUS);
desfat = _causale.decode(desfat); // ... usa descrizione causale
}
set(S_DESCR, desfat);
set(S_DATAPAG, sum.get(PART_DATAPAG)); // Data pagamento
set(S_TIPOPAG, sum.get(PART_TIPOPAG)); // Tipo pagamento
@ -537,8 +548,9 @@ real TGame_mask::aggiorna_residuo()
const TValuta cambio(*this, P_VALUTA, P_DATACAMBIO, P_CAMBIO);
if (cambio.in_valuta())
{
const real resval = cambio.lit2val(res);
set(P_RESIDUOVAL, resval);
TImporto resval = _importo; cambio.lit2val(resval);
resval -= app().partite().importo_speso(_numreg, _numrig, TRUE); // Residuo della riga
set(P_RESIDUOVAL, resval.valore());
}
}
@ -951,7 +963,7 @@ int TGame_mask::nuovo_pagamento(TPartita& partita, int nriga, int rata) const
{
#ifdef __EXTRA__
const int nrigp = nuova_riga(partita);
if (nriga > 0)
if (nriga > 0 && nriga != TPartita::UNASSIGNED)
{
const TRiga_partite& fattura = partita.riga(nriga);
const TValuta val(fattura);

View File

@ -37,7 +37,7 @@ BEGIN
PROMPT 1 4 "Conto principale"
END
NUMBER 101 15
NUMBER CG_DARE 15
BEGIN
PROMPT 2 5 "Dare "
HELP "Importo 'dare' del conto della riga"
@ -45,7 +45,7 @@ BEGIN
PICTURE "."
END
NUMBER 102 15
NUMBER CG_AVERE 15
BEGIN
PROMPT 43 5 "Avere "
HELP "Importo 'avere' del conto della riga"
@ -53,7 +53,7 @@ BEGIN
PICTURE "."
END
LIST 103 1 12
LIST CG_TIPO 1 12
BEGIN
PROMPT 2 6 "Tipo "
HELP "Tipo del conto principale della riga"
@ -63,13 +63,13 @@ BEGIN
ITEM "F|Fornitore" MESSAGE SHOW,306|HIDE,106|HIDE,206|SHOW,307|HIDE,107|HIDE,207
END
NUMBER 104 3
NUMBER CG_GRUPPO 3
BEGIN
PROMPT 20 6 "Gruppo "
HELP "Codice del conto delle riga"
END
NUMBER 105 3
NUMBER CG_CONTO 3
BEGIN
PROMPT 32 6 "Conto "
HELP "Codice del conto delle riga"
@ -90,7 +90,7 @@ BEGIN
WARNING "Conto inesistente o mancante sulla riga contabile"
END
NUMBER 106 6
NUMBER CG_SOTTOCONTO 6
BEGIN
PROMPT 45 6 "Sottoconto "
HELP "Codice del conto delle riga"
@ -343,7 +343,7 @@ BEGIN
FLAGS "D"
END
LIST 116 20
LIST CG_ROWTYPE 20
BEGIN
PROMPT 30 13 "Tipo riga "
ITEM " |Sola contabilita'"

View File

@ -1674,7 +1674,7 @@ void TPagamento::set_sheet(TSheet_field& sf, int sscad)
for (int d = sf.items()-1; d >= i; d--)
sf.destroy(d, FALSE);
// sf.enable_column(2, in_valuta);
sf.enable_column(2, in_valuta);
}
else
{

View File

@ -230,11 +230,23 @@ void TValuta::val2lit(real& val) const
val.round();
}
void TValuta::lit2val(real& lit) const
{
lit /= _cam;
lit.round(3);
}
void TValuta::val2lit(TImporto& imp) const
{
val2lit(imp.valore());
}
void TValuta::lit2val(TImporto& imp) const
{
lit2val(imp.valore());
}
///////////////////////////////////////////////////////////
// TDecoder
///////////////////////////////////////////////////////////

View File

@ -85,7 +85,10 @@ public:
real lit2val(const real& lit) const;
real val2lit(const real& val) const;
void val2lit(real& val) const;
void val2lit(TImporto& imp) const;
void lit2val(real& lit) const;
void val2lit(TImporto& impval) const;
void lit2val(TImporto& implit) const;
bool in_lire() const { return _cod.empty(); }
bool in_valuta() const { return _cod.not_empty(); }