Corretta stamba della barratura alla fine del libro giornale

Corretta gestione dello sheet delle scadenze generate dalle fatture


git-svn-id: svn://10.65.10.50/trunk@1490 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-06-21 15:33:31 +00:00
parent b6d974409f
commit 5e5cbf3d6b
14 changed files with 124 additions and 142 deletions

View File

@ -55,22 +55,23 @@ END
STRING F_RAGSOC 30
BEGIN
PROMPT 23 1 "Cognome / Rag. Soc."
FIELD LF_CLIFO->RAGSOC[1,30]
KEY 2
USE LF_CLIFO KEY 2
INPUT TIPOCF F_TIPOCF SELECT
INPUT RAGSOC[1,30] F_RAGSOC
DISPLAY "Ragione sociale@50" RAGSOC
DISPLAY "Sospeso" SOSPESO
DISPLAY "Codice" CODCF
DISPLAY "Codice fiscale@16" COFI
DISPLAY "Partita IVA@11" PAIV
COPY OUTPUT F_CODCF
HELP "Prima parte della ragione sociale o cognome"
MESSAGE COPY,3@
WARNING "Manca la ragione sociale"
VALIDATE NOT_EMPTY_FUNC
PROMPT 23 1 "Cognome / Rag. Soc."
FIELD LF_CLIFO->RAGSOC[1,30]
KEY 2
USE LF_CLIFO KEY 2
INPUT TIPOCF F_TIPOCF SELECT
INPUT RAGSOC[1,30] F_RAGSOC
DISPLAY "Ragione sociale@50" RAGSOC
DISPLAY "Sospeso" SOSPESO
DISPLAY "Codice" CODCF
DISPLAY "Codice fiscale@16" COFI
DISPLAY "Partita IVA@11" PAIV
COPY OUTPUT F_CODCF
HELP "Prima parte della ragione sociale o cognome"
MESSAGE COPY,3@
WARNING "Manca la ragione sociale"
// VALIDATE NOT_EMPTY_FUNC
CHECKTYPE REQUIRED // Guy: perche' non cosi'?
END
STRING F_RAGSOCA 20

View File

@ -620,7 +620,7 @@ int TPrimanota_application::read(TMask& m)
TToken_string& riga = cgs().row(i); // Vuota la riga
TImporto import(r.get_char("SEZIONE"), r.get_real("IMPORTO"));
import.add_to(riga); // Dare/Avere 101-102
import.add_to(riga, 0); // Dare/Avere 101-102
TBill conto; conto.get(r);
riga.add(conto.string(0x3)); // Conto 103-107

View File

@ -334,7 +334,6 @@ BEGIN
PROMPT 1 6 "Movimento provvisorio "
ITEM " |No (movimento normale)"
ITEM "P|Si (cancellabile)"
ITEM "N|Si (non cancellabile)"
FLAGS "D"
END

View File

@ -163,7 +163,7 @@ BEGIN
ITEM " |No (movimento normale)"
ITEM "P|Si (cancellabile)"
ITEM "N|Si (Non cancellabile)"
FLAGS "D"
FLAGS "DG"
END
STRING F_DESCAGG 5
@ -252,7 +252,6 @@ BEGIN
OUTPUT F_STATOPAIV STATOPAIV
OUTPUT F_PIVACLIENTE PAIV
OUTPUT F_COFICLIENTE COFI
OUTPUT F_CODPAG CODPAG
MESSAGE COPY,F_FORNITORE
CHECKTYPE REQUIRED
WARNING "Cliente assente"
@ -279,7 +278,6 @@ BEGIN
OUTPUT F_STATOPAIV STATOPAIV
OUTPUT F_PIVAFORNITORE PAIV
OUTPUT F_COFIFORNITORE COFI
OUTPUT F_CODPAG CODPAG
MESSAGE COPY,F_CLIENTE
CHECKTYPE REQUIRED
WARNING "Fornitore assente"
@ -336,7 +334,7 @@ BEGIN
ITEM "LU|Lussemburgo"
ITEM "NL|Olanda"
ITEM "PT|Portogallo"
GROUP 1 7
GROUP 1
END
@ -344,7 +342,7 @@ STRING F_PIVACLIENTE 14
BEGIN
PROMPT 34 11 ""
HELP "Partita IVA del cliente del documento"
GROUP 1 7
GROUP 1
USE LF_CLIFO KEY 5
INPUT TIPOCF "C"
INPUT STATOPAIV F_STATOPAIV
@ -361,7 +359,7 @@ STRING F_PIVAFORNITORE 14
BEGIN
PROMPT 34 11 ""
HELP "Partita IVA del fornitore del documento"
GROUP 2 7
GROUP 2
USE LF_CLIFO KEY 5
INPUT TIPOCF "F"
INPUT STATOPAIV F_STATOPAIV
@ -376,7 +374,7 @@ STRING F_COFICLIENTE 16
BEGIN
PROMPT 54 11 "C.F. "
HELP "Codice fiscale del cliente del documento"
GROUP 1 7
GROUP 1
USE LF_CLIFO KEY 4
INPUT TIPOCF "C"
INPUT COFI F_COFICLIENTE
@ -392,7 +390,7 @@ STRING F_COFIFORNITORE 16
BEGIN
PROMPT 54 11 "C.F. "
HELP "Codice fiscale del fornitore del documento"
GROUP 2 7
GROUP 2
USE LF_CLIFO KEY 4
INPUT TIPOCF "F"
INPUT COFI F_COFIFORNITORE
@ -626,15 +624,17 @@ END
NUMBER F_IMPONIBILI 15
BEGIN
PROMPT 1 11 "Totale imponibili "
FLAGS "DRV"
FLAGS "DGV"
PICTURE "."
MESSAGE COPY,FS_IMPONIBILI
END
NUMBER F_IMPOSTE 15
BEGIN
PROMPT 41 11 "Totale imposte "
FLAGS "DRV"
FLAGS "DGV"
PICTURE "."
MESSAGE COPY,FS_IMPOSTE
END
SPREADSHEET F_SHEETCG

View File

@ -106,26 +106,29 @@ bool TPrimanota_application::showpartite_handler(TMask_field& f, KEY k)
{
TSheet_field& s = app().cgs();
const int sel = s.selected();
const int currig = sel+1;
const long curreg = app().curr_mask().get_long(F_NUMREG);
TImporto importo; importo = app().cgs().row(sel);
TImporto speso = app()._partite.importo_speso(curreg, currig);
if (importo != speso)
TToken_string& row = app().cgs().row(sel);
if (row.get_char(2) > ' ')
{
ok = yesno_box("L'importo dei pagamenti %c %s\ne' diverso dall'importo sulla riga %d.\n"
"Si desidera correggerlo?", speso.sezione(), speso.valore().string("."), currig);
if (ok)
{
TMask& m = f.mask();
const bool dare = speso.sezione() == 'D';
m.set(101, dare ? speso.valore().string() : "");
m.set(102, dare ? "" : speso.valore().string());
const int currig = sel+1;
const long curreg = app().curr_mask().get_long(F_NUMREG);
TImporto importo; importo = row;
TImporto speso = app()._partite.importo_speso(curreg, currig);
if (importo != speso)
{
ok = yesno_box("L'importo dei pagamenti %c %s\ne' diverso dall'importo sulla riga %d.\n"
"Si desidera correggerlo?", speso.sezione(), speso.valore().string("."), currig);
if (ok)
{
TMask& m = f.mask();
const bool dare = speso.sezione() == 'D';
m.set(101, dare ? speso.valore().string() : "");
m.set(102, dare ? "" : speso.valore().string());
}
}
}
}
return ok;
}
@ -285,7 +288,7 @@ TSheet_field& TPrimanota_application::cgs() const
// Scrive l'importo imp nella opportuna sezione della riga n
void TPrimanota_application::set_cgs_imp(int n, const TImporto& imp)
{
imp.add_to(cgs().row(n));
imp.add_to(cgs().row(n), 0);
cgs().force_update(n);
}
@ -388,7 +391,7 @@ int TPrimanota_application::set_cgs_row(int n, const TImporto& imp,
if (n < 0) n = cg.first_empty();
TToken_string& row = cg.row(n);
row = "";
imp.add_to(row);
imp.add_to(row, 0);
row.add(conto.string(0x3));
row.add(""); // Codice decrizione
row.add(desc); // Descrizione aggiuntiva
@ -903,8 +906,8 @@ real TPrimanota_application::calcola_imp() const
imposte += real(row.get(3));
}
curr_mask().set(F_IMPONIBILI, imponibili.string());
curr_mask().set(F_IMPOSTE, imposte.string());
curr_mask().set(F_IMPONIBILI, imponibili.string(), TRUE);
curr_mask().set(F_IMPOSTE, imposte.string(), TRUE);
return imponibili+imposte;
}
@ -1079,6 +1082,7 @@ else
app().reset_cgs_row(newposiva); // ... cancellala
newposiva = -1;
}
}
oldiva = imposta;
@ -1089,7 +1093,12 @@ if (r == 0) // Se cambio la prima ri
app().calcola_imp(); // Ricalcola totale IVA
app().calcola_saldo(); // Ricalcola sbilanci
TMask& m = app().curr_mask();
if (app().is_saldaconto() && m.page_enabled(2))
app().set_scadenze(m);
}
return TRUE;
}
@ -1618,18 +1627,16 @@ bool TPrimanota_application::clifo_handler(TMask_field& f, KEY key)
const int alleg = clifo.get_int(CLI_ALLEG);
TEdit_field& upi = m.efield(F_RIEPILOGO);
upi.check_type(alleg == 3 ? CHECK_REQUIRED : CHECK_NORMAL);
const TString& s = clifo.get(CLI_CODPAG);
if (s.not_empty()) m.set(F_CODPAG, s, TRUE);
}
const bool occas = clifo.get_bool(CLI_OCCAS);
m.show(F_OCCASEDIT, occas); // Dati anagrfici
if (occas)
m.hide(-7); // Partita IVA e stato partita IVA
else
{
m.show(-7);
m.hide(cf == 'F' ? F_PIVACLIENTE : F_PIVAFORNITORE);
}
m.show(F_OCCASEDIT, occas); // Bottone Dati anagrafici
m.show(F_STATOPAIV, !occas); // Stato partita IVA
m.show(cf == 'C' ? F_PIVACLIENTE : F_PIVAFORNITORE, !occas); // Partita IVA
m.show(cf == 'C' ? F_COFICLIENTE : F_COFIFORNITORE, !occas); // Codice Fiscale
if (f.focusdirty())
{
@ -1735,8 +1742,8 @@ bool TPrimanota_application::totale_handler(TMask_field& f, KEY key)
{
app().add_cgs_tot(m);
m.field(F_CODIVA).on_hit();
if (app().is_saldaconto() && m.get(F_CODPAG).not_empty())
app().set_scadenze(m);
// if (app().is_saldaconto() && m.get(F_CODPAG).not_empty())
// app().set_scadenze(m);
}
if (key == K_ENTER && f.get().empty())

View File

@ -208,7 +208,7 @@ protected:
void set_pagamento(const char* c, const char* d);
void reset_pagamento();
void set_scadenze(TMask& m);
bool read_scadenze(const TMask& m);
bool read_scadenze(TMask& m);
void write_scadenze(const TMask& m);
bool edit_partite(int riga);

View File

@ -96,7 +96,7 @@ bool TPrimanota_application::pag_notify(int r, KEY k)
(m_tipo ? (const char*)newt : NULL),
rdiff, mcomm, need_recalc);
// see if rdiff changed
msk->field(FS_RDIFFER).set(pag.rate_differenziate() ? "1" : "2");
msk->set(FS_RDIFFER, pag.rate_differenziate() ? "1" : "2");
}
if (!recalc)
{
@ -161,12 +161,11 @@ void TPrimanota_application::set_pagamento(const char* c, const char* d)
void TPrimanota_application::set_scadenze(TMask& m)
{
real imponibile(0.0);
real imposta(0.0);
real spese(0.0);
const real imponibile(m.get(F_IMPONIBILI));
const real imposta(m.get(F_IMPOSTE));
const real spese(0.0);
TPagamento& pag = pagamento();
if (pag.is_new())
{
m.disable_page(2);
@ -176,24 +175,9 @@ void TPrimanota_application::set_scadenze(TMask& m)
m.set(FS_RDIFFER, pag.rate_differenziate() ? "1" : "2");
m.set(FS_NAMEPAG, pag.name());
m.set(FS_TIPOPR, pag.desc_tpr());
m.set(FS_MCOMM, pag.mese_commerciale() ? "X" : "");
TSheet_field& iva_sh = ivas();
for (int i = 0; i < iva_sh.items(); i++)
{
TToken_string& tt = iva_sh.row(i);
const real mpo(tt.get(0));
imponibile += mpo;
const real imp(tt.get(3));
imposta += imp;
}
m.set(FS_IMPONIBILE, imponibile.string());
m.set(FS_IMPOSTA, imposta.string());
m.set(FS_SPESE, spese.string());
m.set(FS_RECALC, "X");
m.set(FS_TIPOPR, pag.desc_tpr());
m.set(FS_MCOMM, pag.mese_commerciale() ? "X" : "");
m.set(FS_RECALC, "X", TRUE);
pag.set_total(imponibile, imposta, spese);
pag.set_rate_auto();
@ -215,32 +199,18 @@ void TPrimanota_application::set_scadenze(TMask& m)
}
}
bool TPrimanota_application::read_scadenze(const TMask& m)
bool TPrimanota_application::read_scadenze(TMask& m)
{
real imponibile(0.0);
real imposta(0.0);
real spese(0.0);
real imponibile(0.0);
real imposta(0.0);
real spese(0.0);
TSheet_field& ps = (TSheet_field&)m.field(FS_RATESHEET);
// should never happen but it doesn't hurt
if (_rel->cg(0).empty()) return FALSE;
TSheet_field& iva_sh = ivas();
for (int i = 0; i < iva_sh.items(); i++)
{
TToken_string& tt = iva_sh.row(i);
real mpo(tt.get(0));
real imp(tt.get(3));
imponibile += mpo;
imposta += imp;
}
m.field(FS_IMPONIBILE).set(imponibile.string());
m.field(FS_IMPOSTA).set(imposta.string());
m.field(FS_SPESE).set(spese.string());
m.field(FS_RECALC).set("X");
m.set(FS_RECALC, "X");
TPagamento& pag = pagamento();
pag.set_total(imponibile, imposta, spese);
@ -486,7 +456,7 @@ bool TPrimanota_application::edit_partite(int riga)
TString caption("Partite aperte del conto ");
caption << b.gruppo() << ' ' << b.conto() << ' ' << b.sottoconto();
TArray_sheet a(-1, -1, 0, 0, caption, "Anno|Numero@7|Descrizione@50|Importo@15R|Sezione", 0x8);
TArray_sheet a(-1, -1, 0, 0, caption, "Anno|Numero@7|Dare@15R|Avere@15R|Descrizione@50", 0x8);
TLocalisamfile partita(LF_PARTITE);
partita.setkey(2); // Chiave per conto
@ -526,8 +496,9 @@ bool TPrimanota_application::edit_partite(int riga)
if (!saldo.is_zero() || nreg == curreg) // Se il saldo non e' nullo allora e' aperta
{
r.cut(0);
r.add(ult); r.add(last); r.add(desc);
r.add(saldo.valore().string(".")); r.add(saldo.sezione());
r.add(ult); r.add(last);
saldo.add_to(r, 2);
r.add(desc);
a.add(r); // Aggiunge partita alla lista
}
ult = anno;
@ -540,8 +511,9 @@ bool TPrimanota_application::edit_partite(int riga)
if (!saldo.is_zero() || nreg == curreg) // Aggiunge ultima partita se aperta
{
r.cut(0);
r.add(ult); r.add(last); r.add(desc);
r.add(saldo.valore().string(".")); r.add(saldo.sezione());
r.add(ult); r.add(last);
saldo.add_to(r, 2);
r.add(desc);
a.add(r);
}

View File

@ -1,8 +1,8 @@
#define FS_RATESHEET 501
#define FS_TOTAL 502
#define FS_RDIFFER 503
#define FS_IMPONIBILE 504
#define FS_IMPOSTA 505
#define FS_IMPONIBILI 504
#define FS_IMPOSTE 505
#define FS_SPESE 506
#define FS_RECALC 507
#define FS_NAMEPAG 508

View File

@ -5,16 +5,16 @@ BEGIN
PROMPT 0 1 "@bScadenzario"
END
NUMBER FS_IMPONIBILE 15
NUMBER FS_IMPONIBILI 15
BEGIN
PROMPT 1 2 "Imponibile "
PROMPT 1 2 "Imponibili "
PICTURE "."
FLAGS "DR"
END
NUMBER FS_IMPOSTA 15
NUMBER FS_IMPOSTE 15
BEGIN
PROMPT 29 2 "Imposta "
PROMPT 29 2 "Imposte "
PICTURE "."
FLAGS "DR"
END
@ -30,10 +30,10 @@ END
RADIOBUTTON FS_RDIFFER 31
BEGIN
PROMPT 1 4 "Opzioni ricalcolo rate"
ITEM "1|Differenziate"
ITEM "2|Uguali"
ITEM "3|Uguali dall'ultima modificata"
ITEM "4|Uguali finche' possibile"
ITEM "1|Differenziate"
ITEM "2|Uguali"
ITEM "3|Uguali dall'ultima modificata"
ITEM "4|Uguali finche' possibile"
END
BOOLEAN FS_RECALC

View File

@ -175,8 +175,12 @@ bool TProvvisori_app::delete_provv(TCursor& cur, TProgind& pi)
{
const long numreg = mov.get_long(MOV_NUMREG);
int err = cur.lock();
mov.setkey(1); // Isam bug on remove with key != 1
mov.put(MOV_NUMREG, numreg);
int err = mov.read(_isequal, _lock);
if (err != NOERR)
return error_box("Errore %d nel bloccare il record %ld", err, numreg);
inizia_saldi(mov.curr());
for (int rig = 1; err == NOERR; rig++)
@ -202,9 +206,6 @@ bool TProvvisori_app::delete_provv(TCursor& cur, TProgind& pi)
if (err == NOERR)
{
const TRecnotype n = mov.recno();
mov.setkey(1); // Isam bug on remove with key != 1
mov.readat(n);
err = mov.remove();
if (err != NOERR)
error = "testata";
@ -231,10 +232,10 @@ bool TProvvisori_app::filter(const TRelation* rel)
return FALSE;
const char* caus = mov.get(MOV_CODCAUS);
if (app()._from_caus.not_empty() && app()._from_caus > caus)
if (app()._from_caus.not_empty() && app()._from_caus < caus)
return FALSE;
if (app()._to_caus.not_empty() && app()._to_caus < caus)
if (app()._to_caus.not_empty() && app()._to_caus > caus)
return FALSE;
return TRUE;

View File

@ -9,7 +9,7 @@ END
DATE F_FROMDATE
BEGIN
PROMPT 2 2 "Data "
PROMPT 2 2 "Data "
HELP "Data del primo movimento provvisorio"
USE LF_MOV KEY 2 SELECT PROVVIS="P"
INPUT DATAREG F_FROMDATE
@ -32,7 +32,8 @@ END
STRING F_FROMCAUS 3
BEGIN
PROMPT 2 3 "Causale "
USE LF_CAUSALI
FLAGS "U"
USE LF_CAUSALI SELECT REG==""
INPUT CODCAUS F_FROMCAUS
DISPLAY "Codice" CODCAUS
DISPLAY "Descrizione@50" DESCR
@ -44,7 +45,7 @@ END
STRING F_FROMCAUSDESC 50 30
BEGIN
PROMPT 16 3 ""
USE LF_CAUSALI KEY 2
USE LF_CAUSALI KEY 2 SELECT REG==""
INPUT DESCR F_FROMCAUSDESC
DISPLAY "Descrizione@50" DESCR
DISPLAY "Codice" CODCAUS
@ -59,7 +60,7 @@ END
DATE F_TODATE
BEGIN
PROMPT 2 6 "Data "
PROMPT 2 6 "Data "
COPY USE F_FROMDATE
INPUT DATAREG F_TODATE
INPUT NUMREG F_TOREG
@ -77,6 +78,7 @@ END
STRING F_TOCAUS 3
BEGIN
PROMPT 2 7 "Causale "
FLAGS "U"
COPY USE F_FROMCAUS
INPUT CODCAUS F_TOCAUS
COPY DISPLAY F_FROMCAUS

View File

@ -866,7 +866,7 @@ void CG3400_application::fill_page(int riga)
{
TString256 rigas;
// char frm[4];
int r_l = printer().rows_left() - 1;
int r_l = printer().rows_left() - 2; // Tolgo le 2 righe del totale!
// Se sono rimaste righe da riempire
if (r_l > 0)
@ -890,12 +890,12 @@ void CG3400_application::fill_page(int riga)
// }
int j=0;
// Calcola una specie di coefficiente angolare
int alfa = _stampa_width / r_l;
int alfa = (_stampa_width - 6) / r_l;
while (--r_l && j + alfa < _stampa_width)
for ( ; r_l > 1; r_l--) // Non stampare sulla riga orizzontale!
{
rigas.format("@%dg======", j);
set_row(riga++, "%s", (const char*)rigas);
set_row(riga++, rigas);
j += alfa;
}
}
@ -1842,8 +1842,8 @@ void CG3400_application::init_print()
void CG3400_application::init_totals()
{
_tot_dare_gg_ap = ZERO;
_tot_avere_gg_ap = ZERO;
_tot_dare_gg_ap = ZERO;
_tot_avere_gg_ap = ZERO;
_tot_dare_progr_ap = ZERO;
_tot_avere_progr_ap = ZERO;
_tot_dare_gg = ZERO;
@ -1949,10 +1949,10 @@ bool CG3400_application::set_print(int)
if (tasto == K_ENTER)
{
real dare2;
_nprog_da = mb.get_long(N_RIGA_STAMPATO);
_last_data = mb.get(ULTIMA_DATA);
dare2 = mb.get_long(PROGR_DARE);
_pagina_da = mb.get_int(PAGINA_DA);
_nprog_da = mb.get_long(N_RIGA_STAMPATO);
_last_data = mb.get(ULTIMA_DATA);
dare2 = mb.get_long(PROGR_DARE);
_pagina_da = mb.get_int(PAGINA_DA);
// "Se l'utente cambia il progressivo dare, esso viene uguagliato all'avere"
if (dare2 != _tot_dare)
{

View File

@ -86,7 +86,7 @@ TSaldo_agg::TSaldo_agg()
_num_ulmov = 0l;
_movap = FALSE;
_provv = FALSE;
reset(); // pulizia dell'array dei conti
// reset(); // INUTILE pulizia dell'array dei conti
}
void TSaldo_agg::aggiorna(const TBill& tc, const TImporto& imp, bool somma)

View File

@ -377,8 +377,8 @@ const char* TPagamento::desc_tipo(int i) const
{
const char* o;
switch (i)
{
case 1: o = "Rimessa diretta / contanti"; break;
{
case 1: o = "Rimessa diretta o contanti"; break;
case 2: o = "Tratta"; break;
case 3: o = "Ricevuta bancaria"; break;
case 4: o = "Cessione"; break;
@ -386,7 +386,7 @@ const char* TPagamento::desc_tipo(int i) const
case 6: o = "Lettera di credito"; break;
case 7: o = "Tratta accettata"; break;
case 8: o = "Altro pagamento"; break;
}
}
return o;
}