Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            : Riportata la versione 98.01.03pl015


git-svn-id: svn://10.65.10.50/trunk@6582 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1998-04-30 15:59:34 +00:00
parent 5e6ec4d235
commit 22adfa73ba
58 changed files with 5155 additions and 3929 deletions

@ -1,5 +1,5 @@
#ifndef __CG0200_H
#define __CG0200_H
#define __CG0200_H
#define TCLI "C"
#define TFOR "F"
@ -21,7 +21,7 @@
#define F_CONTO 115
#define F_DESCONTO 137
#define F_GRUPPORIC 116
#define F_CONTORIC 117
#define F_CONTORIC 117
#define F_SOTTOCRIC 118
#define F_DESCRIC 138
@ -38,12 +38,12 @@
#define F_COMNASC 129
#define F_DENCOMNASC 135
#define F_CODSTAT 130
#define F_CODPAG 131
#define F_CODPAG 131
#define F_DESPAG 331
#define F_RAGSOC1 132
#define F_CODABI 133
#define F_CODBAN 134
#define F_DESBAN 140
#define F_DESBAN 140
#define F_CODVAL 136
#define F_DESVAL 336
#define F_FIDO 139
@ -55,7 +55,7 @@
#define F_DENCOMCF 150
#define F_PROVCF 152
#define F_RICALT 151
#define F_RICALT 151
#define F_PTEL2 153
#define F_TEL2 154
#define F_PTEL3 155
@ -132,6 +132,7 @@
#define F_DESTACF 224
#define F_CODDEP 230
#define F_RAGGEFF 232
#define F_NUMCC 233
#define DLG_RIC 300
#define DLG_CST 301

@ -669,9 +669,16 @@ DISPLAY "Codice CAB" CODTAB[6,10]
COPY OUTPUT F_CODBAN
END
STRING F_NUMCC 20
BEGIN
PROMPT 2 6 "Conto corrente "
FIELD NUMCC
FLAGS "U"
END
STRING F_CODVAL 3
BEGIN
PROMPT 2 6 "Valuta "
PROMPT 2 7 "Valuta "
FLAGS "UZ"
FIELD CODVAL
USE %VAL
@ -685,7 +692,7 @@ END
STRING F_DESVAL 50
BEGIN
PROMPT 22 6 ""
PROMPT 22 7 ""
USE %VAL KEY 2
INPUT S0 F_DESVAL
DISPLAY "Descrizione@50" S0
@ -696,7 +703,7 @@ END
STRING F_CODLIN 1
BEGIN
PROMPT 2 7 "Lingua "
PROMPT 2 8 "Lingua "
FIELD CODLIN
USE %LNG
FLAGS "U"
@ -711,7 +718,7 @@ END
STRING F_DESLIN 50
BEGIN
PROMPT 22 7 ""
PROMPT 22 8 ""
USE %LNG KEY 2
INPUT S0 F_DESLIN
DISPLAY "Descrizione@50" S0
@ -722,7 +729,7 @@ END
STRING F_CODPAG 4
BEGIN
PROMPT 2 8 "Pagamento "
PROMPT 2 9 "Pagamento "
FIELD CODPAG
FLAGS "U#"
USE %CPG
@ -738,7 +745,7 @@ END
STRING F_DESPAG 50
BEGIN
PROMPT 22 8 ""
PROMPT 22 9 ""
USE %CPG KEY 2
INPUT S0 F_DESPAG
DISPLAY "Descrizione@50" S0
@ -749,7 +756,7 @@ END
NUMBER F_FIDO 15
BEGIN
PROMPT 2 9 "Fido "
PROMPT 2 10 "Fido "
FIELD FIDO
FLAGS "R"
PICTURE "."
@ -758,18 +765,18 @@ END
GROUPBOX DLG_NULL 76 4
BEGIN
PROMPT 1 10 "Conto cliente/fornitore"
PROMPT 1 11 "Conto cliente/fornitore"
END
NUMBER F_GRUPPO 3
BEGIN
PROMPT 2 11 "Gruppo "
PROMPT 2 12 "Gruppo "
FIELD GRUPPO
END
NUMBER F_CONTO 3
BEGIN
PROMPT 27 11 "Conto "
PROMPT 27 12 "Conto "
FIELD CONTO
USE LF_PCON SELECT (CONTO!="")&&(SOTTOCONTO="")&&(TMCF=#F_TIPOCF)
INPUT GRUPPO F_GRUPPO
@ -787,7 +794,7 @@ END
STRING F_DESCONTO 50
BEGIN
PROMPT 2 12 "Descrizione "
PROMPT 2 13 "Descrizione "
USE LF_PCON KEY 2 SELECT (CONTO!="")&&(SOTTOCONTO="")&&(TMCF=#F_TIPOCF)
INPUT DESCR F_DESCONTO
DISPLAY "Descrizione@50" DESCR
@ -800,18 +807,18 @@ END
GROUPBOX DLG_RIC 76 4
BEGIN
PROMPT 1 14 "Conto di ricavo"
PROMPT 1 15 "Conto di ricavo"
END
GROUPBOX DLG_CST 76 4
BEGIN
PROMPT 1 14 "Conto di costo"
PROMPT 1 15 "Conto di costo"
FLAGS "H"
END
NUMBER F_GRUPPORIC 3
BEGIN
PROMPT 2 15 "Gruppo "
PROMPT 2 16 "Gruppo "
FIELD GRUPPORIC
FLAGS "R"
HELP "Gruppo di contropartita"
@ -819,7 +826,7 @@ END
NUMBER F_CONTORIC 3
BEGIN
PROMPT 27 15 "Conto "
PROMPT 27 16 "Conto "
FIELD CONTORIC
FLAGS "R"
HELP "Conto di contropartita"
@ -827,7 +834,7 @@ END
NUMBER F_SOTTOCRIC 6
BEGIN
PROMPT 47 15 "Sottoconto "
PROMPT 47 16 "Sottoconto "
FIELD SOTTOCRIC
FLAGS "R"
USE LF_PCON SELECT SOTTOCONTO!=""
@ -849,7 +856,7 @@ END
STRING F_DESCRIC 50
BEGIN
PROMPT 2 16 "Descrizione "
PROMPT 2 17 "Descrizione "
USE LF_PCON KEY 2 SELECT SOTTOCONTO!=""
INPUT DESCR F_DESCRIC
DISPLAY "Descrizione@50" DESCR

@ -136,17 +136,22 @@ END
BUTTON DLG_OK 9 2
BEGIN
PROMPT -13 -1 ""
PROMPT -14 -1 ""
END
BUTTON DLG_DELREC 9 2
BEGIN
PROMPT -24 -1 ""
END
BUTTON DLG_CANCEL 9 2
BEGIN
PROMPT -23 -1 ""
PROMPT -34 -1 ""
END
BUTTON DLG_NULL 9 2
BEGIN
PROMPT -33 -1 "A~zzera"
PROMPT -44 -1 "A~zzera"
MESSAGE RESET,1@
MESSAGE EXIT,K_ENTER
END

@ -1111,7 +1111,7 @@ void TProgressivi_iva::setta_intestazione()
if (_livelloprog == 1)
set_header(r++, "IVA %s",(const char*) _codivamsk);
else set_header(r++, "ATTIVITA' %s",(const char*)_codattmsk);
set_header(++r, "@29gImponibile@60gImposta");
set_header(++r, "@31gImponibile@64gImposta");
}
void TProgressivi_iva::preprocess_header()

@ -20,6 +20,7 @@
#include "cg1305.h"
#include "cg1306.h"
#include "cg1307.h"
#include "cg1308.h"
#include "cglib01.h"
class TAgg_attiv : public TApplication
@ -166,7 +167,10 @@ int cg1300(int argc, char* argv[])
}
break;
case 'Z':
elimina_zoppi(argc, argv);
elimina_zoppi(argc, argv);
break;
case 'M':
setta_meseliq(argc, argv);
break;
default:
break;

70
cg/cg1300e.uml Executable file

@ -0,0 +1,70 @@
#include "cg1300.h"
PAGE "Impostazione mese liquidazione" -1 -1 78 10
GROUPBOX DLG_NULL 77 4
BEGIN
PROMPT 1 1 "Registro"
END
NUMBER F_ANNO 4
BEGIN
PROMPT 2 2 "Anno "
FLAGS "Z"
END
STRING F_REG 3
BEGIN
PROMPT 2 3 "Codice registro "
USE REG SELECT (I0=1)
FLAGS "UZ"
INPUT CODTAB[1,4] F_ANNO
INPUT CODTAB[5,7] F_REG
DISPLAY "Anno" CODTAB[1,4]
DISPLAY "Codice" CODTAB[5,7]
DISPLAY "Descrizione@50" S0
DISPLAY "Tipo" I0
OUTPUT F_ANNO CODTAB[1,4]
OUTPUT F_REG CODTAB[5,7]
OUTPUT F_RAGSOC S0
CHECKTYPE REQUIRED
WARNING "Registro inesistente"
END
STRING F_RAGSOC 50
BEGIN
PROMPT 25 3 ""
FLAGS "D"
END
NUMBER F_DA 5
BEGIN
PROMPT 2 5 "Da nr. protocollo "
END
NUMBER F_A 5
BEGIN
PROMPT 2 6 "A nr. protocollo "
END
LISTBOX F_PASS 12
BEGIN
PROMPT 27 5 "Mese da impostare "
ITEM "0|<Normale>"
FLAGS "M"
END
BUTTON DLG_OK 9 2
BEGIN
PROMPT -12 -1 "~Conferma"
MESSAGE EXIT,K_ENTER
END
BUTTON DLG_QUIT 9 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE
ENDMASK

@ -14,7 +14,6 @@
#include <pconti.h>
#include <rmov.h>
#include <rmoviva.h>
#include <partite.h>
#ifndef FOR_EACH_FILE_RECORD
@ -34,9 +33,11 @@ class TElimina_zoppi : public TSkeleton_application
protected:
static bool test_row_file(int rmov, TString_array& arr);
static bool test_scrow_file(int rmov, TString_array& arr);
static bool test_head_file(TString_array& arr);
static int kill_game(long numreg, int numrig);
static int kill_pagsca(long recno, int lfile);
static int kill_row(long numreg, char tipor, int numrig);
static bool firm_handler(TMask_field& f, KEY k);
@ -139,7 +140,7 @@ bool TElimina_zoppi::test_row_file(int lf_rmov, TString_array& arr)
{
case LF_RMOV : msg << "contabili"; break;
case LF_RMOVIVA: msg << "iva"; break;
case LF_PARTITE: msg << "saldaconto";break;
case LF_PARTITE: msg << "saldaconto"; break;
default: CHECKD(0, "Invalid row file %d", lf_rmov); break;
}
msg << ": 0";
@ -203,7 +204,7 @@ bool TElimina_zoppi::test_row_file(int lf_rmov, TString_array& arr)
riga << " ";
break;
case LF_PARTITE:
riga.format(" |%6ld|S%4d", reg, row.get_int(PART_NRIGA));
riga.format(" |%6ld|P%4d", reg, row.get_int(PART_NRIGA));
riga.add(row.get(PART_ANNO));
riga.add(row.get_real(PART_IMPORTO).string("."));
riga << ' ' << row.get(PART_SEZ);
@ -254,6 +255,73 @@ bool TElimina_zoppi::test_row_file(int lf_rmov, TString_array& arr)
return ok;
}
bool TElimina_zoppi::test_scrow_file(int lf_pagsca, TString_array& arr)
{
bool ok = TRUE;
TLocalisamfile& pagsca = app().file(lf_pagsca);
long found = 0;
TString msg;
msg << "Controllo righe ";
switch (lf_pagsca)
{
case LF_SCADENZE: msg << "scadenze"; break;
case LF_PAGSCA : msg << "pagamento"; break;
default: CHECKD(0, "Invalid row file %d", lf_pagsca); break;
}
msg << ": 0";
msg.center_just(50);
TProgind pi(pagsca.items(), msg, TRUE, TRUE, 50);
TToken_string riga, descr;
FOR_EACH_FILE_RECORD(pagsca)
{
if (pi.iscancelled())
{
ok = FALSE;
break;
}
pi.addstatus(1);
bool to_kill = FALSE;
if (pagsca.get_int(SCAD_NRIGA) <= 0 ||
pagsca.get_int(SCAD_NRATA) <= 0)
to_kill = TRUE;
if (lf_pagsca == LF_PAGSCA && pagsca.get_int(PAGSCA_NRIGP) <= 0)
to_kill = TRUE;
if (to_kill)
{
found++;
const int colon = msg.find(':');
msg.cut(colon+2);
msg << found;
pi.set_text(msg);
riga.format(" |%6ld", pagsca.recno());
if (lf_pagsca == LF_SCADENZE)
riga.add("S");
else
riga.add("G");
riga << lf_pagsca;
riga.add(pagsca.get(SCAD_ANNO));
riga.add("Partita "); riga << pagsca.get(SCAD_NUMPART);
riga.add(pagsca.get(SCAD_GRUPPO));
riga.add(pagsca.get(SCAD_CONTO));
riga.add(pagsca.get(SCAD_SOTTOCONTO));
if (lf_pagsca == LF_SCADENZE)
riga.add("Riga scadenze inconsistente");
else
riga.add("Riga pagamenti inconsistente");
arr.add(riga);
}
}
return ok;
}
bool TElimina_zoppi::test_head_file(TString_array& arr)
{
bool ok = TRUE;
@ -289,7 +357,7 @@ bool TElimina_zoppi::test_head_file(TString_array& arr)
rmoviva.put(RMI_NUMRIG, 1);
rmoviva_err = rmoviva.read();
}
if (reg == 0 || rmov_err != NOERR && rmoviva_err != NOERR)
if (reg == 0 || (rmov_err != NOERR && rmoviva_err != NOERR))
{
riga.format(" |%6ld|T", reg);
riga.add(mov.get(MOV_ANNOES));
@ -299,7 +367,7 @@ bool TElimina_zoppi::test_head_file(TString_array& arr)
descr = mov.get(MOV_DESCR);
if (descr.empty())
{
char tipo = rmov.get_char(MOV_TIPO);
char tipo = mov.get_char(MOV_TIPO);
if (tipo == 'C' || tipo == 'F')
{
descr << tipo << '|' << mov.get(MOV_CODCF);
@ -369,6 +437,16 @@ int TElimina_zoppi::kill_game(long numreg, int numrig)
return NOERR;
}
int TElimina_zoppi::kill_pagsca(long recno, int lfile)
{
CHECK(lfile == LF_SCADENZE || lfile == LF_PAGSCA, "Invalid file");
TLocalisamfile& pagsca = app().file(lfile);
int err = pagsca.readat(recno);
if (err == NOERR)
err = pagsca.remove();
return err;
}
int TElimina_zoppi::kill_row(long numreg, char tipor, int numrig)
{
int lf = 0;
@ -377,7 +455,9 @@ int TElimina_zoppi::kill_row(long numreg, char tipor, int numrig)
case 'C': lf = LF_RMOV; break;
case 'I': lf = LF_RMOVIVA; break;
case 'T': lf = LF_MOV; break;
case 'S': return kill_game(numreg, numrig);
case 'P': return kill_game(numreg, numrig);
case 'S':
case 'G': return kill_pagsca(numreg, numrig);
default : break;
}
@ -405,13 +485,17 @@ bool TElimina_zoppi::select_handler(TMask_field& f, KEY k)
ok = test_head_file(arr);
if (ok)
ok = test_row_file(LF_PARTITE, arr);
if (ok)
ok = test_scrow_file(LF_SCADENZE, arr);
if (ok)
ok = test_scrow_file(LF_PAGSCA, arr);
if (ok)
arr.sort();
if (ok && sheet.run() == K_ENTER)
{
const long total = sheet.checked();
if (total > 0 &&
yesno_box("Confermare l'eliminazione di %ld righe di prima nota.", total))
yesno_box("Confermare l'eliminazione di %ld righe.", total))
{
TProgind pi(total, "Eliminazione righe...", TRUE, TRUE);
FOR_EACH_ARRAY_ROW(arr, i, riga)

82
cg/cg1308.cpp Executable file

@ -0,0 +1,82 @@
// Setta il mese liquidazione sui movimenti del registro vendite
#include <applicat.h>
#include <mask.h>
#include <progind.h>
#include <relation.h>
#include "cglib01.h"
#include <mov.h>
#include "cg1300.h"
#include "cg1308.h"
class TImposta_meseliq : public TSkeleton_application
{
protected:
static bool prot_handler(TMask_field& f, KEY k);
virtual void main_loop();
public:
TImposta_meseliq () {};
virtual ~TImposta_meseliq() {};
};
bool TImposta_meseliq::prot_handler(TMask_field& f, KEY k)
{
if (k == K_ENTER && f.to_check(k))
{
const TMask& m = f.mask();
const long da = m.get_long(F_DA);
const long a = m.get_long(F_A);
if (a < da)
return f.error_box("L'intervallo dei numeri protocollo specificati non e' valido.");
}
return TRUE;
}
void TImposta_meseliq::main_loop()
{
TString expr, es, reg;
TDate d(TODAY);
TMask m("cg1300e");
m.set_handler(F_A, prot_handler);
m.set_handler(F_DA, prot_handler);
TRelation r(LF_MOV);
TCursor c(&r);
TLocalisamfile& fl = c.file();
TEsercizi_contabili esc;
while (m.run() != K_QUIT)
{
const int meseliq = m.get_int(F_PASS);
d.set_year(m.get_int(F_ANNO));
es.format("%04d",esc.date2esc(d));
expr.format("(ANNOES==\"%s\")&&(REG==\"%s\")&&(STR((STR(PROTIVA))>=%ld))&&(STR((STR(PROTIVA))<=%ld))",
(const char*)es, (const char*) m.get(F_REG), m.get_long(F_DA), m.get_long(F_A));
c.setfilter(expr); // Setta l'espressione filtro
const long items = c.items();
if (items == 0)
continue;
TProgind* pi = new TProgind(c.items(), "Aggiornamento mese liquidazione in corso...", FALSE, TRUE, 50);
for (c = 0L; c.pos() < items; c+=1L) //scorre i movimenti e li aggiorna
{
if (c.pos() & 0x7F)
pi->addstatus(1L);
fl.put(MOV_MESELIQ,meseliq);
fl.rewrite();
}
delete pi;
warning_box("Aggiornati %ld records.",c.items());
}
}
int setta_meseliq(int argc, char* argv[])
{
TImposta_meseliq a;
a.run(argc, argv, "Impostazione mese liq.");
return 0;
}

1
cg/cg1308.h Executable file

@ -0,0 +1 @@
int setta_meseliq(int argc, char* argv[]);

@ -209,15 +209,17 @@ END
NUMBER F_RIEPILOGO 5
BEGIN
PROMPT 25 9 "Riepilogo fino al n. "
PROMPT 25 9 "Riepilogo al n. "
FIELD UPROTIVA
NUM_EXPR {(#F_RIEPILOGO==0)||(#F_RIEPILOGO>=#F_PROTIVA)}
WARNING "Inserire un riepilogo non inferiore al protocollo IVA (Obbigatorio se il cliete/fornitore ha codice inserimento in allegati uguale a 3)"
END
BOOLEAN F_DIFFERITA
LIST F_DIFFERITA 1 19
BEGIN
PROMPT 54 9 "Liquid. periodo prec."
PROMPT 48 9 "Liquid. "
ITEM " |periodo in corso"
ITEM "X|periodo precedente"
END
NUMBER F_CLIENTE 6
@ -610,7 +612,7 @@ BEGIN
PROMPT 0 4 ""
ITEM "Imponibile@15"
ITEM "Iva@5"
ITEM "Det@1"
ITEM "Det@2"
ITEM "Imposta@15"
ITEM "CR@1"
ITEM "CF@1"

@ -108,7 +108,7 @@ bool TPrimanota_application::suspended_handler(TMask_field& f, KEY k)
// Determina se un codice detrazione e' di tipo detraibile o no
// Certified 70%
// Certified 90%
bool TPrimanota_application::detraibile(TToken_string& row)
{
const TPrimanota_application& a = app();
@ -1239,7 +1239,7 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
if (oldiva.is_zero() && cau.corrispettivi()) // In caso di corrispettivi ...
{
const TString zanicchi(row.get(1)); // Codice IVA
const TString16 zanicchi(row.get(1)); // Codice IVA
const TCodiceIVA i(zanicchi);
oldiva.valore() = i.scorpora(oldimp.valore()); // ... scorpora imposta dall'imponibile
}

@ -1819,7 +1819,7 @@ bool TGame_mask::edit_pagamento(TPartita& p, int nriga, int nrata, int nrigp) co
#endif
}
delete pm;
// delete pm;
return key != K_ESC;
}

@ -322,7 +322,8 @@ bool TPrimanota_application::test_prorata()
bool ok = TRUE;
if (esistono_righe_senza_tipo_detrazione)
{
const int annodoc = _msk[2]->get_date(F_DATADOC).year();
int annodoc = _msk[2]->get_date(F_DATADOC).year();
if (annodoc < 1900) annodoc = _msk[2]->get_int(F_ANNOIVA);
const bool prorata100 = causale().reg().prorata100(annodoc);
const bool esiste_riga_iva_detraibile = type2pos('D') >= 0;
if (prorata100)
@ -342,7 +343,8 @@ bool TPrimanota_application::aggiusta_prorata()
return FALSE;
TRegistro& reg = causale().reg();
const int annodoc = _msk[2]->get_date(F_DATADOC).year();
int annodoc = _msk[2]->get_date(F_DATADOC).year();
if (annodoc < 1900) annodoc = _msk[2]->get_int(F_ANNOIVA);
const real prorata_attuale = reg.prorata(annodoc);
const real vecchio_prorata = prorata_attuale < 100.0 ? 100.0 : 0.0;

@ -464,19 +464,24 @@ const int CodiceRegistro (const char* cod, int anno)
return tipo_reg;
}
bool filter_func_fatture (const TRelation * rel)
bool filter_func_fatture (const TRelation* rel)
{
int tipo_reg;
int ann_reg;
TString cod_reg;
TLocalisamfile* mov = &(rel->lfile(LF_MOV));
TRectype from (mov->curr());
TRectype to (mov->curr());
ann_reg = mov->get_int (MOV_ANNOIVA);
cod_reg = mov->get (MOV_REG);
tipo_reg = CodiceRegistro (cod_reg, ann_reg);
from.zero();
to.zero();
const TRectype& mov = rel->curr(LF_MOV);
// Altrimenti stampa anche i corrispettivi! Pseudo errore MI2396
long codcf = mov.get_long(MOV_CODCF);
if (codcf <= 0)
return FALSE;
int ann_reg = mov.get_int (MOV_ANNOIVA);
TString16 cod_reg = mov.get (MOV_REG);
int tipo_reg = CodiceRegistro (cod_reg, ann_reg);
// Considera solo iva acquisti o vendite
if (tipo_reg != 1 && tipo_reg != 2)
return FALSE;
TRectype from (LF_MOV), to (LF_MOV);
if (app()._annoes != 0) //anno esercizio specificato nella maschera
{
from.put(MOV_ANNOES, app()._annoes);
@ -493,8 +498,7 @@ bool filter_func_fatture (const TRelation * rel)
if (app()._codice_fin != 0)
to.put(MOV_CODCF, app()._codice_fin);
if (((mov->curr() >= from) && (mov->curr() <= to)) &&
((tipo_reg == 1) || (tipo_reg == 2)))
if (mov >= from && mov <= to)
return TRUE;
return FALSE;
@ -1137,10 +1141,11 @@ bool TListaMov_application::preprocess_page(int file,int counter)
{
reset_print();
set_row(1, "");
set_row(2,"@7n",FLD(LF_MOV,MOV_NUMREG));
set_row(2,"@7,rn",FLD(LF_MOV,MOV_NUMREG));
set_row(2,"@8g@d",FLD(LF_MOV,MOV_DATAREG));
set_row(2,"@17g@3,rs",FLD(LF_MOV,MOV_REG));
set_row(2,"@21g@5n",FLD(LF_MOV,MOV_PROTIVA));
set_row(2,"@20g@5,rn",FLD(LF_MOV,MOV_PROTIVA));
set_row(2,"@26g@2,rn",FLD(LF_MOV,MOV_MESELIQ));
TString protiva = cur->curr(LF_MOV).get(MOV_PROTIVA);
TString uprotiva = cur->curr(LF_MOV).get(MOV_UPROTIVA);
@ -1232,23 +1237,30 @@ print_action TListaMov_application::postprocess_page(int file,int count)
TRigaiva& riga = (TRigaiva&)_c[j];
//r = j+1;
r++;
set_row(r, "Imponibile@12g%r", &riga._imponibile);
set_row(r, "@31gImposta@39g%r", &riga._imposta);
set_row(r, "Imponibile@11g%r", &riga._imponibile);
set_row(r, "@31gImposta@38g%r", &riga._imposta);
set_row(r, "@58gCodice Iva@69g%3s", (const char*)riga._codiva);
switch (riga._tipodet)
{
case 0 : set_row(r, "@76gDetraibile");
break;
case 1 : set_row(r, "@76gIndetraibile su op.es.");
break;
case 3 : set_row(r, "@76gPassaggi interni");
break;
case 9 : set_row(r, "@76gIndetraibile art.19");
break;
default: break;
}
case 0 : set_row(r, "@76gDetraibile");
break;
case 1 : set_row(r, "@76gIndetraibile su op.es.");
break;
case 3 : set_row(r, "@76gPassaggi interni");
break;
case 9 : set_row(r, "@76gIndetraibile art.19");
break;
default: break;
}
if (j == 0) // Se e' la prima riga che stampa
{
const int meseliq = current_cursor()->file(LF_MOV).get_int(MOV_MESELIQ);
if (meseliq > 0) // Stampa il mese liquidazione
set_row(r," Mese liq. %2d", meseliq);
}
if (riga._intra)
set_row(r, "@104gOper.intrac.");
set_row(r, "@111gOper.intrac.");
if (_controllo_mov_errati != 3)
if (!_esiste_riga_iva && ! _nonesiste_riga_iva)
stampa_errori_iva(&r, riga._codiva, riga._tipodet, riga._tipocr);
@ -2440,8 +2452,8 @@ void TListaMov_application::preprocess_header()
}
sep.fill('-');
set_header (++soh, (const char *) sep);
set_header (++soh, "Numero Data Cod Protoc. Documento@49gCod Tp @75gTotale@101gCd Tp T O@129gNo");
set_header (++soh, "Regis. Operaz. Reg Numero Data@42gNumero@49gCau Dc @56gDescrizione@75gDocumento@90gImponibile@101gIv Det A I@121gImposta@129gAll");
set_header (++soh, "Numero Data Cod Prot. M Documento@49gCod Tp @75gTotale@101gCd Tp T O@129gNo");
set_header (++soh, "Regis. Operaz. Reg Num. L Data@42gNumero@49gCau Dc @56gDescrizione@75gDocumento@90gImponibile@101gIv Det A I@121gImposta@129gAll");
break;
default:

@ -232,11 +232,11 @@ HIDDEN TStampa_giornale& app() { return (TStampa_giornale&)main_app(); }
bool TStampa_giornale::filtra_reg(const TRelation * r)
{
bool ok = TRUE;
if (app()._ae)
if (app()._ae_solare)
{
const TRectype& rec = r->lfile().curr();
const int anno = atoi(rec.get("CODTAB").left(4));
ok = anno == app()._ae;
ok = anno == app()._ae_solare;
}
return ok;
}
@ -1344,36 +1344,40 @@ int TStampa_giornale::setta_righe_iva()
// set_row(r, " Imponibile@15g%15r", &riga._imponibile);
// set_row(r, "@31gImposta@39g%15r", &riga._imposta);
set_row(r, " Imponibile@15g%15s", (const char*)impon_str);
set_row(r, "@31gImposta@39g%15s", (const char*)impos_str);
set_row(r, "@35gImposta@43g%15s", (const char*)impos_str);
// set_row(r, "@58gCod.Iva@68g%3s", (const char*)riga._codiva);
set_row(r, "@56gCod.Iva %3s", (const char*)riga._codiva);
set_row(r, "@64gCod.Iva %3s", (const char*)riga._codiva);
const TString80 codiva_des(get_codiva_des(riga._codiva));
const int tipoatt = riga._tipoatt;
if (_stampa_width == 132)
set_row(r, "@68g%-.17s", (const char*)codiva_des);
set_row(r, "@76g%-.17s", (const char*)codiva_des);
else
set_row(r, "@68g%-.50s", (const char*)codiva_des);
const int S132 = 89;
const int S198 = 119;
set_row(r, "@76g%-.50s", (const char*)codiva_des);
const int S132 = 97;
const int S198 = 127;
rig.format("@%dg", _stampa_width == 132 ? S132 : S198);
switch (riga._tipodet)
{
case 0 :
rig << "Detraibile ";
rig << "Detraibile ";
break;
case 1 :
rig << "Indetraibile su op.es. ";
rig << "Indetraib. su op.es. ";
break;
case 3 :
rig << "Passaggi interni ";
rig << "Passaggi interni ";
break;
case 9 :
rig << "Indetraibile art.19 ";
rig << "Indetraibile art.19 ";
break;
default: break;
}
set_row(r, (const char*)rig);
const int meseliq = _cur->file(LF_MOV).get_int(MOV_MESELIQ);
if (meseliq > 0)
set_row(r, " Mese liq. %2d", meseliq);
TRegistro reg(_reg, _anno_iva);
const bool att_mista_ev = reg.attivita_mista();
if (tipoatt != 0 && att_mista_ev)
@ -1640,8 +1644,10 @@ bool TStampa_giornale::data_a_hndl (TMask_field& f, KEY k)
if (!data_a.ok())
return TRUE;
TEsercizi_contabili esc;
app()._ae_solare = data_a.year();
app()._ae = app()._ae_solare;
app()._ae = esc.date2esc(data_a);//app()._ae_solare;
m.set(ANNO_ESER, app()._ae_solare);
m.send_key(K_TAB, CODREG);
@ -1653,8 +1659,6 @@ bool TStampa_giornale::data_a_hndl (TMask_field& f, KEY k)
const TDate data_da(m.get(DATA_DA));
const TDate data_a(f.get());
TString16 dtda(data_da.string());
const int ae = app()._ae;
const TMask_field& fld_dtda = m.field(DATA_DA);
if (definitiva)
{
@ -1725,8 +1729,9 @@ bool TStampa_giornale::mask_a_cod_reg (TMask_field& f, KEY k)
return TRUE;
else
{
TEsercizi_contabili esc;
a._ae_solare = data_a.year(); // Anno solare usato per la tabella dei registri
a._ae = a._ae_solare; // Anno esercizio
a._ae = esc.date2esc(data_a); //a._ae_solare; // Anno esercizio
}
const TString16 reg_cod(f.get());
@ -1913,7 +1918,8 @@ bool TStampa_giornale::set_print(int)
// e si scartano i movimenti gia' stampati su bollato
if (_stampa_definitiva)
{
_data_da = TDate(1,1,_ae);
TEsercizi_contabili esc;
_data_da = esc.esercizio(_ae).inizio();//TDate(1,1,_ae);
// Controlla che non siano rimasti movimenti ancora da stampare dell'es.prec.
if (_stampa_stesso_registro)

@ -671,8 +671,8 @@ void TLista_fatture::set_the_header()
rw.fill('-');
set_header(soh++, (const char *) rw);
set_header(soh++, "@12gNum@21gDocumento@66gCod.@70gTipo@106gCod@110g%c@128gNum.",c[0]);
set_header(soh++, "Data reg.@12gprot.@18gData@30gNumero@37gCodice@44gRagione sociale@66gReg.@70gDoc."
set_header(soh++, "@12gNum@21gDocumento@63gCod.@68gM@70gTipo@106gCod@110g%c@128gNum.",c[0]);
set_header(soh++, "Data reg.@12gprot.@18gData@30gNumero@37gCodice@44gRagione sociale@63gReg.@68gL@70gDoc."
"@75gTot.documento@94gImponibile@106gIva@110g%c@118gImposta@128gReg.",c[1]);
set_header(soh++, (const char *) rw);
@ -689,7 +689,7 @@ void TLista_fatture::set_page(int file, int counter)
{
set_row(nriga,"@ld@12g@5,rs@18g@ld@29g@7,rs",FLD(LF_MOV,MOV_DATAREG),FLD(LF_MOV,MOV_PROTIVA),
FLD(LF_MOV,MOV_DATADOC),FLD(LF_MOV,MOV_NUMDOC));
set_row(nriga,"@37g@6,rn@44g#-21t@66g@3s",FLD(LF_MOV,MOV_CODCF),&_ragsoc,FLD(LF_MOV,MOV_REG));
set_row(nriga,"@37g@6,rn@44g#-18t@63g@3s@67g@2,rn",FLD(LF_MOV,MOV_CODCF),&_ragsoc,FLD(LF_MOV,MOV_REG), FLD(LF_MOV,MOV_MESELIQ));
set_row(nriga,"@70g@2s@73g@15n",FLD(LF_MOV,MOV_TIPODOC),FLD(LF_MOV,MOV_TOTDOC));
set_row(nriga,"@125g@7,rn",FLD(LF_MOV,MOV_NUMREG));
}

@ -4,7 +4,7 @@
#define __MAIN__
#include "cg4.h"
const char* const usage = "Errore - uso : %s -{0|1|2|3|4|5}";
const char* const usage = "Errore - uso : %s -{0|1|2|3|4|5|6|7|8}";
int main(int argc,char** argv)
{
@ -13,23 +13,23 @@ int main(int argc,char** argv)
switch (n)
{
case 0:
cg4100(argc,argv); break;
cg4100(argc,argv); break; // Rinumerazione
case 1:
cg4200(argc,argv); break;
cg4200(argc,argv); break; // Copia archivi
case 2:
cg4300(argc,argv); break;
cg4300(argc,argv); break; // Calcolo liquidazione
case 3:
cg4400(argc,argv); break;
cg4400(argc,argv); break; // Stampa registri
case 4:
cg4500(argc,argv); break;
cg4500(argc,argv); break; // Apertura nuovo esercizio
case 5:
cg4600(argc,argv); break;
cg4600(argc,argv); break; // Chiusura /Apertura
case 6:
cg4700(argc,argv); break;
cg4700(argc,argv); break; // Gestione acconti
case 7:
cg4800(argc,argv); break;
cg4800(argc,argv); break; // Creazione versamenti per acconto
case 8:
cg4900(argc,argv); break;
cg4900(argc,argv); break; // Visualizzazione liquidazione acconti
default:
error_box(usage, argv[0]);
}

@ -35,6 +35,7 @@ bool _Iva11Array::sub(const real& val, const char* fld_name, int num_file)
return add(v1,fld_name, num_file);
}
void _Iva11Array::zero(const char* fld_name)
{
const bool is_key = TAssoc_array::is_key(fld_name);
@ -80,7 +81,7 @@ _year(4), _nomiditte(100), _menu(m), _firm_bookmark(-1)
_isvent = _isagricolo = _isbenzinaro = _isviaggio = FALSE;
_row = 1; _what = all; _comp_acconto = FALSE;
_isriepilogo = FALSE; _calcall = FALSE;
_isfinal = _isregis = FALSE;
_recalc_only = _recalc_regis = _isfinal = _isregis = FALSE;
_stampa_vers = _stampa_acc = FALSE;
_recalc = needed;
}
@ -93,9 +94,8 @@ bool TLiquidazione_app::user_create()
TMessage* msg = mail.next_s("RCL");
TToken_string subj(36);
_is_interactive = msg == NULL;
_recalc_only = FALSE;
bool is_header = TRUE;
int headerlen;
int bodylen;
TDate printdate;
TString filename;
long ditta;
@ -141,11 +141,13 @@ bool TLiquidazione_app::user_create()
_month = subj.get_int(1);
ditta = subj.get_long(2);
char rcl = *(subj.get(3));
_recalc_only = rcl == 'C';
_is_visliq = rcl == 'V';
_recalc_only = rcl == 'C';
_recalc_regis = rcl == 'R' && atoi(_year) > 1997;
_is_visliq = rcl == 'V';
// S/s = stampa senza ricalcolo (minuscolo = definitivo)
// L/l = stampa con ricalcolo se necessario (minuscolo = definitivo)
// C = solo ricalcolo
// R = solo ricalcolo per registri: aggiorna solo progressivi PRM e PRP. Non fa niente altro ne write_liq() ne pim, ne stampe...
// V = stampa ed ev. ricalcolo per visualizzazione
// s o l minuscoli = registro bollato
_isregis = (rcl == 'l' || rcl == 'L' ||
@ -156,12 +158,9 @@ bool TLiquidazione_app::user_create()
filename = subj.get(5);
char rliq = *(subj.get(6));
_riepilogo = rliq == 'X';
headerlen = subj.get_int(7);
bodylen = subj.get_int(7);
is_header = subj.items() == 8;
//modifica del 5/07/1995
int f = printer().formlen();
printer().formlen(f - headerlen);
//fine
printer().formlen(bodylen);
}
if(pnd) pnd->addstatus(1);
@ -176,6 +175,9 @@ bool TLiquidazione_app::user_create()
_ver = new TInteressi_IVA_table();
_pim = new TTable("PIM");
_pis = new TTable("PIS");
_prm = new TTable("PRM");
_prp = new TTable("PRP");
_pum = new TTable("PUM");
_pam = new TTable("PAM");
_pom = new TTable("POM");
@ -192,10 +194,13 @@ bool TLiquidazione_app::user_create()
_mov = &_cur->file(LF_MOV);
_rmoviva = &_cur->file(LF_RMOVIVA);
_pcon_1 = &_cur->file(-AGR_PCON1);
_pcon_2 = &_cur->file(-AGR_PCON2);
_pcon_1 = &_cur->file(-AGR_PCON1);
_pcon_2 = &_cur->file(-AGR_PCON2);
_pim_r = &(_pim->curr());
_pis_r = &(_pis->curr());
_prm_r = &(_prm->curr());
_prp_r = &(_prp->curr());
_plm_r = &(_plm->curr());
_pia_r = &(_pia->curr());
_pum_r = &(_pum->curr());
@ -225,6 +230,27 @@ bool TLiquidazione_app::user_create()
_pim_tipocr = new TRecfield(*_pim_r,"CODTAB",15,15);
_pim_codiva = new TRecfield(*_pim_r,"CODTAB",16,19);
_pim_tipodet = new TRecfield(*_pim_r,"CODTAB",20,20);
_pis_anno = new TRecfield(*_pis_r,"CODTAB",0,3);
_pis_codatt = new TRecfield(*_pis_r,"CODTAB",4,9);
_pis_codreg = new TRecfield(*_pis_r,"CODTAB",10,12);
_pis_mese = new TRecfield(*_pis_r,"CODTAB",13,14);
_pis_tipocr = new TRecfield(*_pis_r,"CODTAB",15,15);
_pis_codiva = new TRecfield(*_pis_r,"CODTAB",16,19);
_pis_tipodet = new TRecfield(*_pis_r,"CODTAB",20,20);
_prm_anno = new TRecfield(*_prm_r,"CODTAB",0,3);
_prm_codatt = new TRecfield(*_prm_r,"CODTAB",4,9);
_prm_codreg = new TRecfield(*_prm_r,"CODTAB",10,12);
_prm_mese = new TRecfield(*_prm_r,"CODTAB",13,14);
_prm_tipocr = new TRecfield(*_prm_r,"CODTAB",15,15);
_prm_codiva = new TRecfield(*_prm_r,"CODTAB",16,19);
_prm_tipodet = new TRecfield(*_prm_r,"CODTAB",20,20);
_prp_anno = new TRecfield(*_prp_r,"CODTAB",0,3);
_prp_codatt = new TRecfield(*_prp_r,"CODTAB",4,9);
_prp_codreg = new TRecfield(*_prp_r,"CODTAB",10,12);
_prp_mese = new TRecfield(*_prp_r,"CODTAB",13,14);
_prp_tipocr = new TRecfield(*_prp_r,"CODTAB",15,15);
_prp_codiva = new TRecfield(*_prp_r,"CODTAB",16,19);
_prp_tipodet = new TRecfield(*_prp_r,"CODTAB",20,20);
_pum_anno = new TRecfield(*_pum_r,"CODTAB",0,3);
_pum_codatt = new TRecfield(*_pum_r,"CODTAB",4,9);
_pum_mese = new TRecfield(*_pum_r,"CODTAB",10,11);
@ -338,7 +364,7 @@ bool TLiquidazione_app::user_create()
_nditte->read();
for (int mese = 1; mese < _month; mese++)
if (is_month_plain(mese) || _recalc == ever)
if ((is_month_plain(mese) && !(_freqviva == "T" && _recalc_regis)) || _recalc == ever)
update_firm(mese);
if (is_month_plain(_month) || _month == 13)
@ -363,9 +389,11 @@ bool TLiquidazione_app::user_create()
TApplication::set_firm(__firm);
end_wait();
user_destroy();
}
else delete pnd;
else
delete pnd;
return _is_interactive;
}
@ -378,6 +406,29 @@ bool TLiquidazione_app::user_destroy()
delete _pim_mese;
delete _pim_tipocr;
delete _pim_codiva;
delete _pim_codatt;
delete _pim_tipodet;
delete _pis_anno;
delete _pis_codreg;
delete _pis_mese;
delete _pis_tipocr;
delete _pis_codiva;
delete _pis_codatt;
delete _pis_tipodet;
delete _prm_anno;
delete _prm_codreg;
delete _prm_mese;
delete _prm_tipocr;
delete _prm_codiva;
delete _prm_codatt;
delete _prm_tipodet;
delete _prp_anno;
delete _prp_codreg;
delete _prp_mese;
delete _prp_tipocr;
delete _prp_codiva;
delete _prp_codatt;
delete _prp_tipodet;
delete _ppa_year;
delete _ppa_codatt;
delete _ppa_month;
@ -405,7 +456,6 @@ bool TLiquidazione_app::user_destroy()
delete _lam_mese;
delete _pla_anno;
delete _pla_codatt;
delete _pim_codatt;
delete _del_ditta;
delete _del_anno;
delete _del_mese;
@ -413,6 +463,9 @@ bool TLiquidazione_app::user_destroy()
delete _ver;
delete _pim;
delete _pis;
delete _prm;
delete _prp;
delete _pum;
delete _pam;
delete _pom;
@ -446,19 +499,7 @@ bool TLiquidazione_app::set_print(int)
while (set_liquidazione())
{
if (_selected.ones() > 0l)
{
TRectype& mov = _cur->curr();
TRectype from(_cur->curr()); from.zero();
TRectype to(from);
TDate f(1, 1, atoi(_year));
TDate t(1, _month == 13 ? 12 : _month, atoi(_year));
t.set_end_month();
from.put(MOV_DATAREG, f);
to.put(MOV_DATAREG, t);
_cur->setregion(from, to);
return recalc_all() && _isprint;
}
else warning_box("Nessuna ditta selezionata!");
}
break;
@ -471,15 +512,6 @@ bool TLiquidazione_app::set_print(int)
{
if (_calcall || _selected.ones() > 0l)
{
TRectype & mov = _cur->curr();
TRectype from(_cur->curr()); from.zero();
TRectype to(from);
TDate f(1, _recalc == one ? _month : 1, atoi(_year));
TDate t(1, _month == 13 ? 12 : _month, atoi(_year));
t.set_end_month();
from.put(MOV_DATAREG, f);
to.put(MOV_DATAREG, t);
_cur->setregion(from, to);
extract_deleghe();
return _isprint;
}
@ -497,15 +529,6 @@ bool TLiquidazione_app::set_print(int)
{
if (_calcall || _selected.ones() > 0l)
{
TRectype & mov = _cur->curr();
TRectype from(_cur->curr()); from.zero();
TRectype to(from);
TDate f(1, _recalc == one ? _month : 1, atoi(_year));
TDate t(1, _month == 13 ? 12 : _month, atoi(_year));
t.set_end_month();
from.put(MOV_DATAREG, f);
to.put(MOV_DATAREG, t);
_cur->setregion(from, to);
recalc_acconti(inf, ina);
return _isprint;
}

@ -77,10 +77,10 @@ class TProgind;
#define NETTO "1"
#define LORDO "2"
enum tiporeg { vendita = 1, acquisto = 2 };
enum recalc { needed = 1, one = 2, ever = 3, never = 4 };
enum wht { all = 1, mnt = 2, trimestre = 3};
enum tbc { precedente = 1, incorso = 2};
enum tiporeg { vendita = 1, acquisto = 2 };
// flags per gli items di stampa
#define CHG_PARMS 1 // cambiato qualcosa (attivita', ditta...)
@ -103,7 +103,8 @@ enum tbc { precedente = 1, incorso = 2};
#define PIM_HEAD 18 // bytes sprecati per far vedere l'intestazione pim
#define LIQACC 19 // prospetto liquidazione acconto
#define PROGAGR 20 // progressivi per prospetto agricolo dal 1998
#define PIS_HEAD 21 // intestazione per i PIS (stampa cappelletto iniziale)
#define PIS_ROW 22 // riga totali parziali per codiva (tabella progressivi di cui da periodo successivo)
// ...............................................................
// support structs
// ...............................................................
@ -248,7 +249,6 @@ class TLiquidazione_app : public TPrint_application
bool _isannual; // dichiarazione annuale
bool _mixed; // attivita' mista
bool _isriepilogo; // 13a liq
bool _isannual_12; // annuale con mese = 12 (trimestre)
bool _isendliq; // annuale o riepilogo
bool _isservizio; // servizi, professionisti, artisti
bool _isrimborso; // vuole il rimborso infraannuale
@ -257,6 +257,7 @@ class TLiquidazione_app : public TPrint_application
bool _isdiffacc; // liq. differita (usato per stampa registri)
bool _isagr98; // TRUE se l'anno e' > 1997 e si sta calcolando una attivita' agricola
bool _recalc_only; // solo ricalcolo progressivi
bool _recalc_regis; // solo ricalcolo progressivi per registri
bool _calcall; // tutte le ditte nessuna esclusa
bool _isbase; // stampa base di calcolo acconto
bool _isfinal; // stampa definitiva (su registro bollato)
@ -315,6 +316,9 @@ class TLiquidazione_app : public TPrint_application
TInteressi_IVA_table* _ver;
TTable* _pim;
TTable* _pis;
TTable* _prm;
TTable* _prp;
TTable* _pum;
TTable* _pam;
TTable* _pom;
@ -336,6 +340,9 @@ class TLiquidazione_app : public TPrint_application
TRectype* _pcon_2_r;
TRectype* _iva_r;
TRectype* _pim_r;
TRectype* _pis_r;
TRectype* _prm_r;
TRectype* _prp_r;
TRectype* _pum_r;
TRectype* _pam_r;
TRectype* _pom_r;
@ -358,6 +365,27 @@ class TLiquidazione_app : public TPrint_application
TRecfield* _pim_tipocr;
TRecfield* _pim_codiva;
TRecfield* _pim_tipodet;
TRecfield* _pis_anno;
TRecfield* _pis_codatt;
TRecfield* _pis_codreg;
TRecfield* _pis_mese;
TRecfield* _pis_tipocr;
TRecfield* _pis_codiva;
TRecfield* _pis_tipodet;
TRecfield* _prm_anno;
TRecfield* _prm_codatt;
TRecfield* _prm_codreg;
TRecfield* _prm_mese;
TRecfield* _prm_tipocr;
TRecfield* _prm_codiva;
TRecfield* _prm_tipodet;
TRecfield* _prp_anno;
TRecfield* _prp_codatt;
TRecfield* _prp_codreg;
TRecfield* _prp_mese;
TRecfield* _prp_tipocr;
TRecfield* _prp_codiva;
TRecfield* _prp_tipodet;
TRecfield* _pum_anno;
TRecfield* _pum_codatt;
TRecfield* _pum_mese;
@ -409,7 +437,7 @@ protected:
static bool select_button(TMask_field& f, KEY key);
static bool reset_button(TMask_field& f, KEY key);
static bool chk_final_handler(TMask_field& f, KEY key);
static TLiquidazione_app& app() { return (TLiquidazione_app&)main_app(); }
public:
@ -434,7 +462,6 @@ public:
// ricalcolo progressivi mese
bool update_firm (int month, bool recalc = TRUE);
bool update_att (int month, const char* codatt, bool recalc = TRUE);
void zero_firm (int month);
void zero_att (int month, const char* codatt);
void zero_annual (int month);
void recalc_att (int month, const char* codatt);
@ -443,9 +470,9 @@ public:
// Le funzioni che hanno come prefisso iva11 sono per creare il file di trasferimento per IVA11
// Viene chiamata quando vengono scorsi tutti i movimenti, settando gli elementi di _iva11_arr.
void iva11_set_arr (const TString& codatt);
void iva11_set_arr_phase_1 (const TString& codatt);
// Scorre tutti i PIM della ditta, per completare _iva11_arr prima di chiamare write_IVA11()
void iva11_set_arr_pim (const TString& codatt);
void iva11_set_arr_phase_2 (const TString& codatt);
// Scrive per la ditta/attivita' corrente, i dati relativi al trasferimento IVA11
// Se viene passato TRUE come parametro, azzera i campi R1 ed R2.
void iva11_write (bool reset_r1r2 = FALSE);
@ -481,7 +508,7 @@ public:
void describe_ventilation(int month, const char* codatt);
void describe_agricolo(int month, const char* codatt);
void describe_viaggio(int month, const char* codatt);
void describe_pims(int month, const char* codatt);
void describe_pims(int month, const char* codatt, const bool describe_pis);
void describe_liq(int month, const char* codatts, _DescrItem* d = NULL);
void describe_error(const char* errstr, const char* codatt);
void describe_annual(const char* codatt);
@ -523,7 +550,7 @@ public:
void add_corrisp (int month, const char* codreg, real& r, real& p,
int tipodet, const char* codiva, const char* codatt);
//vergine immacolata, richiamata per scorporare l'iva nei peccatori corrispettivi
//vergine immacolata, richiamata per scorporare l'iva nei corrispettivi peccatori
void lordo2netto(const real& totale, real& imponibile, real& imposta, const real& aliquota);
void lordo2netto(real& imponibile, real& imposta, const real& aliquota);
@ -550,6 +577,12 @@ public:
// cercapalle in tabelle con opzione di creazione se serve
bool look_pim(int m, const char* a, const char* r, const char* cr,
const char* i, int tipodet = 0, bool create = FALSE);
bool look_pis(int m, const char* a, const char* r, const char* cr,
const char* i, int tipodet = 0, bool create = FALSE);
bool look_prm(int m, const char* a, const char* r, const char* cr,
const char* i, int tipodet = 0, bool create = FALSE);
bool look_prp(int m, const char* a, const char* r, const char* cr,
const char* i, int tipodet = 0, bool create = FALSE);
bool look_pum(int m, const char* a, bool create = FALSE);
bool look_pam(int m, const char* a, bool create = FALSE);
bool look_pom(int m, const char* a, bool create = FALSE);
@ -561,7 +594,7 @@ public:
bool look_ppa(int m, const char* a, int t, bool create = FALSE);
bool look_del(int month, int type, bool create = FALSE);
bool look_iva(const char* cod);
bool look_reg(const char* reg);
bool look_reg(const char* reg);
bool look_lia(long ditta = 0l, bool create = FALSE, int anno = 0);
// trova il mytical ufficio concessione da mettere nelle deleghe
@ -590,7 +623,7 @@ public:
// questa serve per i progressivi: la data passata va bene
// se il movimento deve essere considerato in calcolo e riepilogo
// per la liquidazione di month
bool is_date_ok (TDate& d, int month);
bool is_date_ok (TDate& d, int month, int liqmonth, int year);
bool is_in_liq_period(TDate& d);
bool is_first_month (int m);
int liq_month(int x);

File diff suppressed because it is too large Load Diff

@ -63,12 +63,14 @@ int TLiquidazione_app::liq_month(int x)
{
if (x == 13 || _freqviva == "M")
return x;
else return next_trim(x);
else
return next_trim(x);
}
int TLiquidazione_app::next_trim(int x)
{
if (x == 13) x = 12;
if (x == 13)
x = 12;
return x + (2 - ((x-1) % 3));
}
@ -96,19 +98,40 @@ int TLiquidazione_app::previous_month(int m)
// vale per LIM (mese o trimestre precedente)
if (_freqviva == "M")
return m == 1 ? 1 : m - 1;
else return m == 3 ? 3 : m - 3;
else
return m == 3 ? 3 : m - 3;
}
bool TLiquidazione_app::is_date_ok(TDate& d, int month)
// TRUE se la data (di mov o pim) passata va considerata nel
bool TLiquidazione_app::is_date_ok(TDate& d, int month, int liqmonth, int year)
// TRUE se la data passata va considerata nel
// ricalcolo dei progressivi mensili per il mese e anno
// selezionati; se month == 13 vanno bene tutte purche'
// sia giusto l'anno
// selezionati. Vedi cg4301.cpp per maggiori informazioni
// sul nuovo filtro di selezione movimenti.
{
if (d.month() > month || d.year() != atoi(_year))
return FALSE;
if (month == 13) return d.month() <= month;
else return d.month() == month;
bool ok;
if (year < 1998 || _recalc_regis) // Vecchia selezione o calcolo progoressivi per stampa registri bollati
{
if (d.month() > month || d.year() != atoi(_year))
return FALSE;
if (month == 13)
ok = d.month() <= month;
else
ok = d.month() == month;
}
else // Nuova selezione dal 1998 in poi
{
const int regmonth = d.month();
const int regyear = d.year();
if (month <= 12)
ok = (regmonth == month && liqmonth == 0) || (liqmonth == month);
else // Annuale, month == 13
ok = (regyear == year && liqmonth != 12) || (regyear == year + 1 && liqmonth == 12);
}
return ok;
}
@ -200,6 +223,7 @@ void TLiquidazione_app::lordo2netto(real& imponibile, real& imposta, const real&
lordo2netto(totale, imponibile, imposta, aliquota);
}
// Funzione per trovare i PIM: Progressivi liquidazione Iva Mensili.
bool TLiquidazione_app::look_pim(int month, const char* codatt, const char* codreg,
const char* tipocr, const char* codiva, int tipodet,
bool create)
@ -230,6 +254,95 @@ bool TLiquidazione_app::look_pim(int month, const char* codatt, const char* codr
return ok;
}
// Le tabelle seguenti (PIS, PRM, PRP) sono vengono introdotte solo dal 1998 in poi.
// Pertanto il loro utilizzo e' significativo in tale periodo.
// Funzione per trovare i PIS: Progressivi liquidazione Iva mensili di cui periodo Successivo
bool TLiquidazione_app::look_pis(int month, const char* codatt, const char* codreg,
const char* tipocr, const char* codiva, int tipodet,
bool create)
{
bool ok = FALSE;
_pis_r->zero();
(*_pis_anno) = _year;
(*_pis_mese) = format("%02d", month);
(*_pis_codreg) = codreg;
(*_pis_codiva) = codiva;
(*_pis_codatt) = codatt;
(*_pis_tipocr) = tipocr;
(*_pis_tipodet) = tipodet;
TString s = _pis_r->get("CODTAB");
_pis->read();
ok = _pis->good();
if (!ok && create)
{
_pis_r->zero();
_pis_r->put("CODTAB",s);
_pis->write();
}
return ok;
}
// Funzione per trovare i PRM: Progressivi Registri iva Mensili.
bool TLiquidazione_app::look_prm(int month, const char* codatt, const char* codreg,
const char* tipocr, const char* codiva, int tipodet,
bool create)
{
bool ok = FALSE;
_prm_r->zero();
(*_prm_anno) = _year;
(*_prm_mese) = format("%02d", month);
(*_prm_codreg) = codreg;
(*_prm_codiva) = codiva;
(*_prm_codatt) = codatt;
(*_prm_tipocr) = tipocr;
(*_prm_tipodet) = tipodet;
TString s = _prm_r->get("CODTAB");
_prm->read();
ok = _prm->good();
if (!ok && create)
{
_prm_r->zero();
_prm_r->put("CODTAB",s);
_prm->write();
}
return ok;
}
// Funzione per trovare i PRP: Progressivi Registri iva mensili di cui da periodo Precedente
bool TLiquidazione_app::look_prp(int month, const char* codatt, const char* codreg,
const char* tipocr, const char* codiva, int tipodet,
bool create)
{
bool ok = FALSE;
_prp_r->zero();
(*_prp_anno) = _year;
(*_prp_mese) = format("%02d", month);
(*_prp_codreg) = codreg;
(*_prp_codiva) = codiva;
(*_prp_codatt) = codatt;
(*_prp_tipocr) = tipocr;
(*_prp_tipodet) = tipodet;
TString s = _prp_r->get("CODTAB");
_prp->read();
ok = _prp->good();
if (!ok && create)
{
_prp_r->zero();
_prp_r->put("CODTAB",s);
_prp->write();
}
return ok;
}
bool TLiquidazione_app::look_plm(int m, const char* a, bool create)
{
bool ok = FALSE;
@ -527,6 +640,12 @@ bool TLiquidazione_app::look_del(int month, int type, bool create)
isdel = anag.get_long("TIPOSTDEL") == 0l;
uffiva = anag.get_int("UFFIVA");
}
TString16 con;
TString uva;
if (titcf)
look_conc(con, uva); // Legge la concessione se titolare conto fiscale
if (!titcf || isdel)
{
// non titolare conto fiscale oppure paga con delega:
@ -542,24 +661,25 @@ bool TLiquidazione_app::look_del(int month, int type, bool create)
cab = c.get("CodCAB");
}
_del->put("S7", abi);
_del->put("S8", cab);
_del->put("S9", ""); // per sicurezza! (visto che non devono mai
} // esistere entrambe
_del->put("S8", cab);
if (titcf && isdel) // Se e' titolare CF e stampa la delega, va riportata anche la conc
{
_del->put("S9", con);
_del->put("S2", uva);
}
else
_del->put("S9", "");
}
else
{
// non usa delega bensi' bollettino o distinta:
// cerca concessione comune
// infila ufficio concessione in S9
// e descrizione comune in S2
TString16 con;
TString uva;
if (look_conc(con, uva))
{
_del->put("S9", con);
_del->put("S2", uva);
_del->put("S7", "");
_del->put("S8", "");
}
_del->put("S9", con);
_del->put("S2", uva);
_del->put("S7", "");
_del->put("S8", "");
}
} //fine create
@ -604,7 +724,8 @@ bool TLiquidazione_app::look_del(int month, int type, bool create)
_del->put("S2", desiva);
}
}
else if (con.not_empty())
// Descrizione cod. concessione
if (con.not_empty())
{
TString uva;
if (look_conc(con, uva))
@ -683,19 +804,33 @@ real TLiquidazione_app::credito_prec(int month)
// ritorna l'appropriato credito precedente al mese in corso
{
real c(0.0);
const bool lia_ok = look_lia();
if (is_first_month(month))
{
// credito inizio anno
if (look_lia())
if (lia_ok)
c = _lia->get_real("R0");
// e' positivo o 0
}
else
{
c = result_liq(previous_month(month));
if (c.sign() < 0) c = abs(c);
else c = real(0.0);
if (c.sign() < 0)
c = abs(c);
else
c = real(0.0);
// Nel caso di trimestrali considera dal trimestre corrispondente a
// quello impostato+1. Ad es. se m == 1 considera dal I trim. (m=3)
// se m == 2 idem (m=3). Se m == 3 considera dal II trim. (m=6).
const int crm = _lia->get_int("I0") + 1;
if (lia_ok && crm > 1) // Vale dal mese successivo a quello impostato
{
// Toglie il Credito Trasferito
if (month == liq_month(crm))
c -= _lia->get_real("R15");
}
}
return c;

@ -42,9 +42,11 @@ void TLiquidazione_app::set_page(int file, int cnt)
case SET_FIRM:
set_firm(d);
break;
case PIS_ROW:
case PIM_ROW:
set_pim(d);
break;
case PIS_HEAD:
case PIM_HEAD:
set_pim_head(d);
break;
@ -119,7 +121,9 @@ void TLiquidazione_app::describe_att(int month, const char* codatt,
describe_agricolo(month, codatt);
if (atts.items() == 1 && _isviaggio)
describe_viaggio(month, codatt);
describe_pims(month,codatt);
describe_pims(month,codatt,FALSE);
if (atoi(_year) > 1997) // Descrive anche i PIS se esistono
describe_pims(month,codatt,TRUE);
if (atts.items() == 1)
describe_consistence(codatt);
}
@ -452,13 +456,14 @@ void TLiquidazione_app::describe_viaggio(int month, const char* codatt)
}
void TLiquidazione_app::describe_pims(int month, const char* codatt)
void TLiquidazione_app::describe_pims(int month, const char* codatt, const bool describe_pis)
// le si passa una tokenstring (o un codatt) e lei, da brava, calcola
// cumulando per tutte le attivita' nominatele
// ogni riga riguarda un codiva ma tutti i registri
// se il mese e' 13 si guarda tutto l'anno
// se si tratta di una sola attivita' in att. mista evidenziata o servizievole,
// stampa solo vendite e corrispettivi
// L'ultimo parametro serve per calcolare i PIS (progressivi del periodo successivo)
{
TToken_string atts(codatt);
TString ref(atts.items() == 1 ? codatt : "ALL");
@ -474,29 +479,46 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
_DescrItem* ads = NULL;
// descrittore riga iva dovuta ag. viaggio'
_DescrItem* iads = NULL;
// Seleziona la tabella corretta: PIM o PIS e l'identificatore
TTable * tab = describe_pis ? _pis : _pim;
const word PIM_PIS = describe_pis ? PIS_ROW : PIM_ROW;
// questa cazzata serve per far apparire l'intestazione delle colonne
// anche se le colonne non ci sono; in tal modo si ottiene una peggior
// chiarezza, una peggiore efficienza, una gran rottura di coglioni,
// ma risulta identico al dio Sistema.
_DescrItem* hea = new _DescrItem(PIM_HEAD);
_DescrItem* hea = new _DescrItem(describe_pis ? PIS_HEAD : PIM_HEAD);
hea->_f0 = skip_acq; // cosi' non compare nemmeno la colonnina! contento?
hea->_f1 = FALSE;
_descr_arr.add(hea);
// Assoc array per memorizzare i corrispettivi da scorporare. Tali corrispettivi verranno
// aggiunti alla fine del ciclo, scorrendo tutte le righe generate.
TAssoc_array corr_ann;
_CorrItem cx;
bool is_key;
// Never mind the bollox
TString codtab, codreg, codiva, activity, anno;
int mese;
while ((tmpatt = atts.get()) != NULL)
{
TString att(tmpatt);
for (_pim->first(); !_pim->eof(); _pim->next())
for (tab->first(); !tab->eof(); tab->next())
{
_DescrItem* d = NULL;
// compute
bool ok = look_reg(*_pim_codreg);
ok |= look_iva(*_pim_codiva);
codtab = tab->get("CODTAB");
anno = codtab.mid(0,4);
activity= codtab.mid(4,6);
codreg = codtab.mid(10,3);
mese = atoi(codtab.mid(13,2));
codiva = codtab.mid(16,4);
bool ok = look_reg(codreg);
ok |= look_iva(codiva);
bool isnew = FALSE;
if (!ok) continue;
@ -504,10 +526,9 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
tiporeg tipomov = (tiporeg)_reg->get_long("I0");
bool corrisp = _reg->get_bool("B0");
TString tipoiva = _iva->get("S1");
int tipodet = atoi(*_pim_tipodet);
TString codiva((const char*)(*_pim_codiva));
TString other = _pim->get("S4");
TToken_string s1(_pim->get("S1"),'!'); // Imponibile/iva fatture in ritardo
int tipodet = atoi(codtab.mid(20,1));
TString other = tab->get("S4");
TToken_string s1(tab->get("S1"),'!'); // Imponibile/iva fatture in ritardo
real rit_imp(s1.get(0));
real rit_iva(s1.get(1));
const bool is_rit= tipodet != 0 && month == 13 && rit_imp != 0.0; //Se fattura in ritardo con tipo detr. != 0 e si sta calcolando l'annuale
@ -521,7 +542,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
}
// se e' corrispettivo da ventilare non
// scrivo un cannolo ripieno visto che e' stato ventilato
if (tipomov == vendita && tipoiva == "VE") continue;
if (tipomov == vendita && tipoiva == "VE" && !describe_pis) continue;
// se e' il dettaglio di una attivita' mista non stampa
// gli acquisti, il perche' losalamadonna
@ -534,29 +555,27 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
// se ha tutti gli importi nulli viene da un annullamento di
// progressivi esistenti (achtung fatture con scontrino)
if (_pim->get_real("R0").is_zero() &&
_pim->get_real("R1").is_zero() &&
_pim->get_real("R2").is_zero() &&
_pim->get_real("R5").is_zero() &&
_pim->get_real("R6").is_zero())
if (tab->get_real("R0").is_zero() &&
tab->get_real("R1").is_zero() &&
tab->get_real("R2").is_zero() &&
tab->get_real("R5").is_zero() &&
tab->get_real("R6").is_zero())
continue;
if (strcmp((const char*)*_pim_codatt, att) == 0 &&
(is_month_plain(atoi(*_pim_mese))) &&
_year == (const char*)*_pim_anno)
if (activity == att && is_month_plain(mese) && _year == anno)
{
// vedi se c'e' gia' un item corrispondente
for(int i = last+1; i < _descr_arr.items(); i++)
{
d = (_DescrItem*)&_descr_arr[i];
if (d->_flags == PIM_ROW &&
if (d->_flags == PIM_PIS &&
d->_s0 == ref &&
d->_s1 == codiva)
break;
if (d->_s1 > codiva)
{
isnew = TRUE;
_DescrItem* dd = new _DescrItem(PIM_ROW);
_DescrItem* dd = new _DescrItem(PIM_PIS);
// CicciaPrassi li vuole in ordine crescente
_descr_arr.insert(dd,i);
// che due maron stereofonic: se quello dopo
@ -578,7 +597,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
if (!isnew && i == _descr_arr.items())
{
isnew = TRUE;
d = new _DescrItem(PIM_ROW);
d = new _DescrItem(PIM_PIS);
if (isfirst) { d->_f0 = TRUE; isfirst = FALSE; }
_descr_arr.add(d);
}
@ -586,33 +605,33 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
if (tipomov == acquisto)
{
// Ci sono anche le fatture in ritardo (solo in annuale)! Con tipo detraibilita' 1,3,9
d->_r4 += is_rit ? rit_imp : _pim->get_real("R0");
d->_r5 += is_rit ? rit_iva : _pim->get_real("R1");
t4 += is_rit ? rit_imp : _pim->get_real("R0");
t5 += is_rit ? rit_iva : _pim->get_real("R1");
d->_r4 += is_rit ? rit_imp : tab->get_real("R0");
d->_r5 += is_rit ? rit_iva : tab->get_real("R1");
t4 += is_rit ? rit_imp : tab->get_real("R0");
t5 += is_rit ? rit_iva : tab->get_real("R1");
}
else // vendita
{
is_key = corr_ann.is_key(codiva);
cx._totale = 0;
_CorrItem& ca = is_key ? (_CorrItem&) corr_ann[codiva] : cx;
ca._totale += _pim->get_real("R3");
ca._totale += tab->get_real(tipoiva == "VE" ? "R2" : "R3"); // Se e' codice IVA da Vent. stiamo scorrendo i PIS: va stampato il lordo dei progressivi successivi
if (!is_key) // se non c'e' lo aggiunge
{
ca._aliquota = _iva->get_real("R0")/CENTO; // Se e' nuovo setta l'aliquota
corr_ann.add(codiva,ca);
}
// vedi corrispettivi veri e falsi
real cvi = _pim->get_real("R0"); // imp. totale
real cvv = _pim->get_real("R1"); // iva totale
real cfi = _pim->get_real("R13"); // imp. falsi corrispettivi
real cfv = _pim->get_real("R14"); // iva falsi corrispettivi
real cvi = tab->get_real("R0"); // imp. totale
real cvv = tab->get_real("R1"); // iva totale
real cfi = tab->get_real("R13"); // imp. falsi corrispettivi
real cfv = tab->get_real("R14"); // iva falsi corrispettivi
// MI3404...
// Giochiamo sopra la particolarita' che se non e' un registro di corrispettivi
// allora se R5 o R6 sono <> 0 significa che trattasi di documento FS,
// che pertanto va stornato dal totale corrispettivi. (Cosi' volle Vladimiro)
real ifs(_pim->get_real("R5")); // imp. fatture con scontrino
real vfs(_pim->get_real("R6")); // iva fatture con scontrino
real ifs(tab->get_real("R5")); // imp. fatture con scontrino
real vfs(tab->get_real("R6")); // iva fatture con scontrino
if (!corrisp)
{
d->_r2 -= ifs; // tolgo FS dai corrispettivi
@ -620,7 +639,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
t2 -= ifs; // idem per i totali
t3 -= vfs;
}
// ... E qui finisce.
if (corrisp)
{
@ -648,18 +667,18 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
real adf, adi; // autofatture non residenti art. 17
real va7i, va7v; // ammontare art 40 c. 5/6/8
real vendi = corrisp ? cfi : _pim->get_real("R0");
real vendv = corrisp ? cfv : _pim->get_real("R1");
real vendi = corrisp ? cfi : tab->get_real("R0");
real vendv = corrisp ? cfv : tab->get_real("R1");
// si scorporano solo per l'annuale, altrimenti
// vengono normalmente considerati nelle vendite
if (month == 13)
{
TToken_string kr(_pim->get("S0"),'!');
TToken_string kr(tab->get("S0"),'!');
va7i = kr.get(0);
va7v = kr.get(1);
adf = _pim->get_real("R7");
adi = _pim->get_real("R8");
adf = tab->get_real("R7");
adi = tab->get_real("R8");
}
d->_r0 += vendi - adf - va7i;
@ -680,14 +699,14 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
// flag per stampare l'intestazione colonne
}
}
}
} // End of _pim cycle
real impc,ivac; // Aggiunge lo scorporo dei corrispettivi
const int ditems = _descr_arr.items();
for (int i=last+1;i<ditems;i++) // scorre le righe memorizzate
{
_DescrItem& dd = (_DescrItem&) _descr_arr[i];
if (corr_ann.is_key(dd._s1) && dd._flags == PIM_ROW && dd._s0 == ref) // Se esiste il codice iva corrispondente sull'array corrispettivi
if (corr_ann.is_key(dd._s1) && dd._flags == PIM_PIS && dd._s0 == ref) // Se esiste il codice iva corrispondente sull'array corrispettivi
{
_CorrItem& cc = (_CorrItem &) corr_ann[dd._s1];
lordo2netto(cc._totale,impc,ivac,cc._aliquota);
@ -700,7 +719,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
corr_ann.destroy();
look_plm(month,att);
real iva74t = _pom->get_real("R13");
if (iva74t.sign() > 0)
if (!describe_pis && iva74t.sign() > 0)
{
if(iads == NULL) iads = new _DescrItem(PIM_ROW);
iads->_s0 = "74TER"; // cosi' vollero
@ -714,9 +733,9 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
iads->_f0 = TRUE;
}
}
}
} // fine while (codatt)
if (art40.sign() > 0 || art40_iva.sign() > 0)
if (!describe_pis && (art40.sign() > 0 || art40_iva.sign() > 0))
{
_DescrItem* ads = new _DescrItem(PIM_ROW);
ads->_s0 = ref;
@ -731,7 +750,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
_descr_arr.add(ads);
}
if (autodafe.sign() > 0 || autodafe_iva.sign() > 0)
if (!describe_pis && (autodafe.sign() > 0 || autodafe_iva.sign() > 0))
{
_DescrItem* ads = new _DescrItem(PIM_ROW);
ads->_s0 = ref;
@ -749,34 +768,41 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
// ag. viaggio: iva dovuta 74 ter la vogliono in mezzo ai progressivi
if (iads != NULL) _descr_arr.add(iads);
// prepara una bella riga di totali
if (/* !isfirst */ TRUE)
if (describe_pis)
{
_DescrItem* d = new _DescrItem(TOT_ROW);
d->_r0 = t0; d->_r1 = t1;
d->_r2 = t2; d->_r3 = t3;
d->_r4 = t4; d->_r5 = t5;
// aggiunge dati ptm
_DescrItem* t = new _DescrItem(MISC_LIQ);
t->_f1 = isfirst; // per il form feed
_DescrItem& d = (_DescrItem&)_descr_arr[_descr_arr.last()];
if (d._flags == PIS_HEAD) // Nessun PIS_ROW presente
d._f1 = TRUE; // Evita la stampa dell'intestazione
}
// prepara una bella riga di totali
_DescrItem* d = new _DescrItem(TOT_ROW);
d->_r0 = t0; d->_r1 = t1;
d->_r2 = t2; d->_r3 = t3;
d->_r4 = t4; d->_r5 = t5;
// aggiunge dati ptm
_DescrItem* t = new _DescrItem(MISC_LIQ);
t->_f2 = atoi(_year) > 1997 ? describe_pis : TRUE; //isfirst; // per il form feed o meno alla fine
if (!describe_pis)
{
TToken_string ttm("0|0|0");
const bool annual = month == 13;
const int limit = annual ? 13 : month;
int m = annual ? month : 1;
for (; m <= limit; m++)
{
if (!is_month_ok(m,month)) continue;
atts.restart();
while ((tmpatt = atts.get()) != NULL)
{
TString att(tmpatt);
look_plm(m, att);
real ad1, ad2;
d->_r6 += _pom->get_real("R0"); // acq. intracomunitari
d->_r7 += _pom->get_real("R1"); // inded. art 19
d->_r8 += _pom->get_real("R2"); // IVA su inded. art. 19
@ -806,12 +832,12 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
ttm.add(ad1.string(),1); // imp. acq. amm. indetr.
ttm.add(ad2.string(),2); // IVA acq. amm. indetr
t->_s0 = ttm;
t->_f0 = !_prorata.current().is_zero() && (month != 13); // flag per segnalare l'esistenza
t->_f1 = _plm->get_bool("B1"); // flag per segnalare errore tabella prorata precedente mancante
t->_f1 += _plm->get_bool("B1"); // flag per segnalare errore tabella prorata precedente mancante
d->_r9 += _pom->get_real("R9"); // acq. inded. su ricavi esenti
d->_r10 += _pom->get_real("R10"); // IVA acq. inded. su ricavi esenti
// passaggi interni
real aipip(d->_s0); // progressivo ...
real aipivp(d->_s1); // ... (che mazzata sulle palle...)
@ -819,7 +845,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
aipivp += _pum->get_real("R9"); // IVA acq. inded. per pass. int
d->_s0 = aipip.string(); // risbatto ...
d->_s1 = aipivp.string(); // ..
// spese generali.
real spgnp(t->_s2); // progressivo ...
real spgnvp(t->_s3); // ... (che doppia mazzata sulle palle...)
@ -827,30 +853,30 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
spgnvp += _pam->get_real("R11"); // IVA spese generali.
t->_s2 = spgnp.string(); // risbatto ...
t->_s3 = spgnvp.string(); // ..
// sospensione imposta: non piu' due palle, ma QUATTRO
TToken_string tt(t->_s4);
real aqsi(tt.get(0));
real aqsv(tt.get(1));
real vnsi(tt.get(2));
real vnsv(tt.get(3));
aqsi += _pam->get_real("R6");
aqsv += _pam->get_real("R7");
vnsi += _pam->get_real("R8");
vnsv += _pam->get_real("R9");
tt = "";
tt.add(aqsi.string());
tt.add(aqsv.string());
tt.add(vnsi.string());
tt.add(vnsv.string());
t->_s4 = tt;
} // while (attivita')
} // for (mese ok)
// annual follows in _arr
if (month == 13 && ref != "ALL")
{
@ -867,7 +893,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
real am = _pla->get_real("R4");
real iaq = _pla->get_real("R11"); // IVA acquisti
real ppg = _pla->get_real("R12"); // pro-rata pagato
// calcola nuovo prorata per ogni attivita' (miste: 1+2)
real pr(0.0);
if (!ris.is_zero())
@ -875,7 +901,7 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
real co = 0.0;
real topay = 0.0;
pr.round(ROUND_LIRA);
if (pr != _prorata.current())
//if (pr != _prorata.current())
{
// calcolo conguaglio -- se positivo e' a debito
if (pr > 0.0)
@ -886,9 +912,9 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
co = topay - ppg;
round_mille_lire(co);
}
_DescrItem* dd = new _DescrItem(ANNUAL);
// MonsterFish: arrotonda alle 1000 LIRE B1,B2,B3,B4
round_mille_lire(e1);
round_mille_lire(e2);
@ -907,12 +933,11 @@ void TLiquidazione_app::describe_pims(int month, const char* codatt)
t->_arr.add(dd);
}
}
_descr_arr.add(d);
_descr_arr.add(t);
}
_descr_arr.add(d);
_descr_arr.add(t);
}
void TLiquidazione_app::describe_liq(int month, const char* codatts,
_DescrItem* di)
{
@ -939,6 +964,7 @@ void TLiquidazione_app::describe_liq(int month, const char* codatts,
tt.add(_lam->get_real("R1").string());
tt.add(_lam->get_real("R2").string());
tt.add(_lam->get_real("R3").string());
tt.add(_lam->get_real("R4").string());
d->_s0 = tt;
d->_s1 = _lim->get_real("R11").string();
@ -966,7 +992,8 @@ void TLiquidazione_app::describe_liq(int month, const char* codatts,
{
if (d->_r0.sign() < 0)
d->_arr.add(di);
else delete di;
else
delete di;
}
if (!_is_visliq)
@ -1003,15 +1030,13 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month)
if (_stampa_vers) //solo se sono a debito
if (look_del(month,month == 13 ? 2 : 1))
{
if (_del->get("S9").not_empty())
d->_f0 = 2;
else d->_f0 = 1;
if (_del->get_bool("B0"))
{
d->_s0 = _del->get("S2"); // ufficio iva/concessione
d->_s1 = _del->get("S1"); // descrizione banca
d->_s2 = _del->get("S7"); // ABI
d->_s3 = _del->get("S8"); // CAB
//_del->S2 descr. ufficio iva/concessione
//_del->S1 descrizione banca
d->_s0 = _del->get("S9"); // Cod Ufficio concessione
d->_s1 = _del->get("S7"); // Cod ABI
d->_s2 = _del->get("S8"); // Cod CAB
d->_r0 = _del->get_real("R0");
d->_d0 = _del->get_date("D0");
} // altrimenti lascia tutto in bianco e ci scriveranno i dati a mano
@ -1022,16 +1047,14 @@ _DescrItem* TLiquidazione_app::describe_deleghe(int month)
if (look_del(12,7)) //sia che sia a debito che a credito
{
d->_s4 = "ACC";
if (_del->get("S9").not_empty())
d->_f1 = 2;
else d->_f1 = 1;
TToken_string t;
if (_del->get_bool("B0"))
{
t.add(_del->get("S2"));
t.add(_del->get("S1"));
t.add(_del->get("S7"));
t.add(_del->get("S8"));
//_del->S2 descr. ufficio iva/concessione
//_del->S1 descrizione banca
t.add(_del->get("S9")); // Cod Conc
t.add(_del->get("S7")); // Cod ABI
t.add(_del->get("S8")); // Cod CAB
t.add(_del->get_real("R0").string());
t.add(_del->get("D0"));
}
@ -1311,19 +1334,30 @@ void TLiquidazione_app::set_liqacc(_DescrItem& d)
void TLiquidazione_app::set_pim_head(_DescrItem& d)
{
set_bookmark("Riepilogo progressivi", _att_bookmark);
int r = 1;
if (d._flags == PIM_HEAD)
set_bookmark("Riepilogo progressivi", _att_bookmark);
else // PIS_HEAD
{
if (d._f1)
return; // No header please
set_bookmark("Riepilogo progressivi successivi", _att_bookmark);
set_row(r++," Di cui da periodo successivo");
set_row(r++,"");
}
if (d._f0)
{
set_row(1," Cod.@41gVENDITE@71gCORRISPETTIVI");
set_row(2," IVA Descrizione@30gImponibile@49gImposta@63gImponibile@82gImposta");
set_row(r++," Cod.@41gVENDITE@71gCORRISPETTIVI");
set_row(r++," IVA Descrizione@30gImponibile@49gImposta@63gImponibile@82gImposta");
}
else
{
set_row(1," Cod.@41gVENDITE@71gCORRISPETTIVI@106gACQUISTI");
set_row(2," IVA Descrizione@30gImponibile@49gImposta@63gImponibile"
set_row(r++," Cod.@41gVENDITE@71gCORRISPETTIVI@106gACQUISTI");
set_row(r++," IVA Descrizione@30gImponibile@49gImposta@63gImponibile"
"@82gImposta@96gImponibile@115gImposta");
}
set_row(3,"");
set_row(r,"");
}
void TLiquidazione_app::set_pim(_DescrItem& d)
@ -1524,14 +1558,23 @@ void TLiquidazione_app::set_pumpam(_DescrItem& d)
set_row(row++, "%% PRO-RATA ed IVA non detraibile (%s%%)@69g%r",
(const char*)prc.string(), &(d._r11));
if (atoi(_year) > 1997 && d._r12 != ZERO) // prorata 1998
{ // Anno precedente
set_row(row++, "%% PRO-RATA ed IVA non detraibile (%s%%)@69g%r",
(const char*)d._r13.string(), &(d._r12));
if (d._f1) // Segnala errore per tabella anno precedente non esistente
if (atoi(_year) > 1997 /*&& d._r12 != ZERO*/) // prorata 1998
{
if (d._f1)
{
row++;
set_row(row++, "Impossibile reperire la %% PRO-RATA relativa all'anno precedente.");
// Stampa errore solo se NON definitiva. Errore MI2414
if (!_isfinal)
{
// Segnala errore per tabella anno precedente non esistente
row++;
set_row(row++, "Impossibile reperire la %% PRO-RATA relativa all'anno precedente.");
}
}
else if (d._r13 != prc)
{
// Stampa % solo se la tabella dell'anno precedente esiste ma non e' uguale. Errore MI2415
set_row(row++, "%% PRO-RATA ed IVA non detraibile (%s%%)@69g%r",
(const char*)d._r13.string(), &(d._r12));
}
}
}
@ -1552,14 +1595,18 @@ void TLiquidazione_app::set_pumpam(_DescrItem& d)
set_row(3,"ALTRI DATI RELATIVI ALLA DICHIARAZIONE@55gimponibile"
"@77gimposta@91gdetrazione");
set_row(4,"");
set_row(row++,"");
set_row(row,"");
}
else
set_row(1,"");
// form feed
set_auto_ff(TRUE);
if (d._f2)
set_auto_ff(TRUE);
}
void TLiquidazione_app::set_grand(_DescrItem& d)
{
real& risultato = d._r0;
@ -1577,6 +1624,7 @@ void TLiquidazione_app::set_grand(_DescrItem& d)
real iva_acq(tt.get(1));
real cred_prec(tt.get(2));
real debt_prec(tt.get(3));
real cred_trasf(tt.get(4)); cred_trasf = -cred_trasf;
real acc_dec(d._s1);
real res_cred(d._s2);
@ -1611,7 +1659,11 @@ void TLiquidazione_app::set_grand(_DescrItem& d)
set_row(rw++,"@11gRISULTATO@75g%r", &res_debt);
set_row(rw++,"@11gIva ammessa in detrazione@58g%r", &iva_acq);
if (_isannual || d._f1)
{
set_row(rw++,"@11gCredito inizio anno@58g%r", &cred_prec);
if (cred_trasf != ZERO)
set_row(rw++,"@11gCredito trasferito @58g%r", &cred_trasf);
}
else
set_row(rw++,"@11gCredito precedente@58g%r", &cred_prec);
@ -1789,7 +1841,8 @@ void TLiquidazione_app::set_grand(_DescrItem& d)
if (rw < (printer().formlen() - cont))
rw = printer().formlen() - cont;
for (int i = rr; i < rw; i++) set_row(i,"");
for (int i = rr; i < rw; i++)
set_row(i,"");
set_bookmark("Riepilogo versamenti", _firm_bookmark);
@ -1797,65 +1850,41 @@ void TLiquidazione_app::set_grand(_DescrItem& d)
TString vr = di._r0.string("###.###.###.###");
// la cincia non vuole lo zero
if (atof(vr) == 0.0 && vr[vr.len()-1] == '0') vr[vr.len()-1] = ' ';
if (atof(vr) == 0.0 && vr[vr.len()-1] == '0')
vr[vr.len()-1] = ' ';
if (di._s4 == "ACC")
if (di._s4 == "ACC") // Acconto
{
TToken_string ac(di._s5);
if (!ac.empty_items())
{
TString dt (ac.get(5));
real app (ac.get(4));
TString dt (ac.get(4));
real app (ac.get(3));
TString vr (app.string("###.###.###.###"));
TString loc (ac.get(0));
TString ban (ac.get(1));
TString abi (ac.get(2));
TString cab (ac.get(3));
if (atof(vr) == 0.0 && vr[vr.len()-1] == '0') vr[vr.len()-1] = ' ';
TString con (ac.get(0));
TString abi (ac.get(1));
TString cab (ac.get(2));
if (atof(vr) == 0.0 && vr[vr.len()-1] == '0')
vr[vr.len()-1] = ' ';
set_row(rw++, "- ACCONTO DICEMBRE -");
set_row(rw, " Versamento di L. %s effettuato il %s",
(const char*)vr,
(const char*)dt);
if (di._f1 == 1)
{
set_row(rw++, "@68gdiretto all'ufficio IVA di %s", (const char*)loc);
set_row(rw++, "@68gtramite %s", (const char*)ban);
set_row(rw++, "@68gcodice azienda %s codice dipendenza %s",
(const char*)abi, (const char*)cab);
}
else if (di._f1 == 2)
{
set_row(rw++, "@68gdiretto al Ministero delle Finanze");
set_row(rw++, "@68gConcessione %s", (const char*)loc);
}
set_row(rw++, "@68gCod Conc.: %3s",(const char*)con);
set_row(rw++, "@68gCod. ABI: %5s Cod. CAB o Cod. Dipendenza: %5s",(const char*)abi,(const char*)cab);
}
}
if (_stampa_acc && _stampa_vers) set_row(rw++, "- SALDO -");
if (_stampa_acc && _stampa_vers)
set_row(rw++, "- SALDO -");
if (_stampa_vers)
{
set_row(rw, " Versamento di L. %s effettuato il %s",
(const char*)vr,
(const char*)dt);
if (di._f0 == 1)
{
set_row(rw++, "@68gdiretto all'ufficio IVA di %s",
(const char*)(di._s0));
set_row(rw++, "@68gtramite %s", (const char*)(di._s1));
set_row(rw++, "@68gcodice azienda %s codice dipendenza %s",
(const char*)(di._s2), (const char*)(di._s3));
}
else if (di._f0 == 2)
{
set_row(rw++, "@68gdiretto al Ministero delle Finanze");
set_row(rw++, "@68gConcessione %s", (const char*)(di._s0));
}
else
{
set_row(rw++, "@68gdiretto");
set_row(rw++, "@68gtramite");
}
set_row(rw++, "@68gCod Conc.: %3s",(const char*)di._s0);
set_row(rw++, "@68gCod. ABI: %5s Cod. CAB o Cod. Dipendenza: %5s",(const char*)di._s1,(const char*)di._s2);
}
}
}

@ -223,8 +223,8 @@ bool TLiquidazione_app::extract_delega(int month, TArray& desc)
ucc.put("CODTAB", _del->get("S9"));
if (ucc.read() == NOERR)
desc = ucc.get("S0");
}
else if (_del->get("S7").not_empty())
}
if (_del->get("S7").not_empty())
{
TTable ban("%BAN");
TString16 cod;
@ -249,7 +249,8 @@ bool TLiquidazione_app::extract_delega(int month, TArray& desc)
}
// Se non e' stampata invece visualizza la delega presente su file e l'importo a credito che ha calcolato
// chiedendo cosa fare: Registra elimina fisicamente la delega dal file, Annulla lo fa proseguire
if (!stampato) video_conferma(topay, intr, nrnd, TRUE);
if (!stampato)
video_conferma(topay, intr, nrnd, TRUE);
}
}

File diff suppressed because it is too large Load Diff

@ -1,7 +1,6 @@
//
// cg4400.h
//
#include <isam.h>
#include <printapp.h>
#include <mask.h>
@ -13,24 +12,40 @@ enum messaggio {
non_proseguire,
prosegui_stampa,
prosegui_cal_stampa
};
};
class CG4400_application : public TPrintapp
enum tipo_stampa {
prova = 1,
bollato = 2,
libro_unico = 3,
rif_giornale = 4
};
enum tiporeg {
vendita = 1,
acquisto = 2,
riepilogativo = 3,
incassi = 4,
giornale = 5,
sociale = 6,
cespiti = 7
};
class TStampa_registri_app : public TPrintapp
{
TSorted_cursor * _cur;
TRelation *_rel, *_nditte;
TLocalisamfile *_clifo, *_occas, *_tab, *_tabcom, *_com, *_anag, *_unloc, *_attiv, *_indlib;
TTable *_tabreg, *_tablbu, *_tablim, *_tabpim, *_tablia, *_tabiva;
TTable *_tabpla, *_tabppa, *_tabvid;
TLocalisamfile *_clifo, *_occas, *_com, *_anag, *_unloc, *_attiv, *_indlib;
TTable *_tabreg, *_tablia, *_tabpim, *_tabprm, *_tabprp, *_table;
TRigaiva_array _iva_array, _riga_rmi;
TTipodoc_array _doc_array;
TRiga_array _tot_iva_array;
TRiga_array _tot_iva_array, _tot_prec_iva_array;
TBit_array _selected;
TArray_sheet *_ditte;
TArray _nomiditte;
TArray _nomiditte;
tiporeg _tipo_reg;
bool _st_liq[13];
bool _test;
TRecnotype _nrec;
bool _mov_empty, _stampa_ind_ditta, _stampa_tutti_i_registri, _auto_intraf, _stampa;
bool _corrispettivi, _liquidazione, _stampa_ind_comp, _esiste_riga_iva, _stampa_cred_pre;
bool _rif_vid, _intesta_vidi, _intesta_liq, _stampa_data_reg, _ok_vidi;
@ -41,17 +56,18 @@ class CG4400_application : public TPrintapp
TDate _u_data;
long _n_ditte, _u_stampata, _primast, __firm, _uprotivap, _ditta;
long _numini, _pagine_stampate;
int _fino_a_mese, _tipo_reg, _tipo_stampa, _cod_un_loc;
int _fino_a_mese, _cod_un_loc;
int _annoes, _r, _stampa_width, _mese_ultima_liq, _mese_credito;
int _stampa_len, _stampa_mese, _size_header;
real _totale_doc, _credito;
TString _codreg, _desc_lib, _codatt, _attivita, _tipoatt;
TString _tipodoc, _descr_doc, _codlib, _codice_vidi;
TString _cofi,_cap,_paiva,_ragsoc,_comunefis,_provfis,_viafis;
TFilename _t, _pippo;
TFilename _t;
TParagraph_string* _desc27;
messaggio _scelta;
tipo_stampa _tipo_stampa;
protected:
@ -100,10 +116,11 @@ public:
bool look_lia(long ditta = 0l);
bool ricalcola(int);
bool stampa_riepilogo(int);
void stampa_pims(TPrintrow&, TRiga_array&, TRigaiva_array&, int);
void stampa_prospetto_riepilogo(tiporeg, const TString&, const TString&, const bool);
void stampa_progressivi(TRiga_array&, TRigaiva_array&, tiporeg, const bool);
void set_choice_limits(TMask&);
void build_ditte_sheet();
void cerca_reg(const TString&, byte*);
tiporeg cerca_reg(const TString&);
void set_page_tot_reg();
void send_message(char,const TFilename&,int);
void aggiorna_reg(const bool aggiorna_vidi);
@ -117,7 +134,7 @@ public:
bool setta_mask(long);
bool preprocess_page(int, int);
int stampa_intestazione();
int stampa_prospetto();
int stampa_prospetto(int, bool);
long select_firm_range(long,long);
void stampa_plafonds(int);
void get_dati_ditta();
@ -134,8 +151,8 @@ public:
virtual print_action postprocess_page (int, int);
virtual void preprocess_header();
CG4400_application() : TPrintapp(), _ditte(NULL), _selected(10000), _nomiditte(100), _test(FALSE) {}
virtual ~CG4400_application() {}
TStampa_registri_app() : TPrintapp(), _ditte(NULL), _selected(10000), _nomiditte(100), _test(FALSE) {}
virtual ~TStampa_registri_app() {}
};

@ -1,40 +1,24 @@
#include "cg4400a.h"
TOOLBAR "" 0 20 0 2
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -12 -11 "~Stampa"
MESSAGE EXIT,K_ENTER
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -11 ""
END
ENDPAGE
PAGE "Stampa registri" -1 -1 60 18
PAGE "Stampa registri" -1 -1 72 20
LISTBOX TIPO_STAMPA 1 40
BEGIN
PROMPT 2 1 "Tipo "
PROMPT 2 1 "Tipo "
HELP "Indicare il tipo di stampa da eseguire"
ITEM "1|Stampa di prova"
MESSAGE SHOW,3@|SHOW,CODICE_LIBRO_PROVA|SHOW,DATA_STAMPA|SHOW,TIPO_RIEPILOGATIVO|HIDE,RIF_VID|RESET,RIF_VID|HIDE,1@|RESET,1@|HIDE,2@|RESET,2@
MESSAGE SHOW,3@|SHOW,CODICE_LIBRO_PROVA|SHOW,DATA_STAMPA|SHOW,TIPO_RIEPILOGATIVO|HIDE,RIF_VID|RESET,RIF_VID|HIDE,1@|RESET,1@|HIDE,2@|RESET,2@|DISABLE,5@
ITEM "2|Libri bollati della ditta"
MESSAGE SHOW,1@|HIDE,CODICE_LIBRO_PROVA|RESET,CODICE_LIBRO_PROVA|HIDE,2@|RESET,2@|HIDE,3@|RESET,3@|HIDE,DATA_STAMPA|HIDE,TIPO_RIEPILOGATIVO|RESET,TIPO_RIEPILOGATIVO|HIDE,RIF_VID|RESET,RIF_VID
MESSAGE SHOW,1@|HIDE,CODICE_LIBRO_PROVA|RESET,CODICE_LIBRO_PROVA|HIDE,2@|RESET,2@|HIDE,3@|RESET,3@|HIDE,DATA_STAMPA|HIDE,TIPO_RIEPILOGATIVO|RESET,TIPO_RIEPILOGATIVO|HIDE,RIF_VID|RESET,RIF_VID|DISABLE,5@
ITEM "3|Libri unici dello studio"
MESSAGE SHOW,2@|HIDE,1@|RESET,1@|HIDE,3@|RESET,3@|HIDE,DATA_STAMPA|HIDE,CODICE_LIBRO_PROVA|RESET,CODICE_LIBRO_PROVA|HIDE,TIPO_RIEPILOGATIVO|RESET,TIPO_RIEPILOGATIVO|HIDE,RIF_VID|RESET,RIF_VID
MESSAGE SHOW,2@|HIDE,1@|RESET,1@|HIDE,3@|RESET,3@|HIDE,DATA_STAMPA|HIDE,CODICE_LIBRO_PROVA|RESET,CODICE_LIBRO_PROVA|HIDE,TIPO_RIEPILOGATIVO|RESET,TIPO_RIEPILOGATIVO|HIDE,RIF_VID|RESET,RIF_VID|ENABLE,5@
ITEM "4|Libri con riferimenti al libro giornale"
MESSAGE SHOW,1@|HIDE,CODICE_LIBRO_PROVA|RESET,CODICE_LIBRO_PROVA|HIDE,2@|RESET,2@|HIDE,3@|RESET,3@|HIDE,DATA_STAMPA|HIDE,TIPO_RIEPILOGATIVO|RESET,TIPO_RIEPILOGATIVO|HIDE,RIF_VID|RESET,RIF_VID
MESSAGE SHOW,1@|HIDE,CODICE_LIBRO_PROVA|RESET,CODICE_LIBRO_PROVA|HIDE,2@|RESET,2@|HIDE,3@|RESET,3@|HIDE,DATA_STAMPA|HIDE,TIPO_RIEPILOGATIVO|RESET,TIPO_RIEPILOGATIVO|HIDE,RIF_VID|RESET,RIF_VID|DISABLE,5@
END
NUMBER ANNO 4
BEGIN
PROMPT 2 3 "Anno "
PROMPT 2 2 "Anno "
HELP "Anno di cui si vuole stampare il registro"
FLAGS "A"
WARNING "Inserire l'anno"
@ -42,48 +26,48 @@ BEGIN
CHECKTYPE REQUIRED
END
GROUPBOX DLG_NULL 39 5
GROUPBOX DLG_NULL 35 5
BEGIN
PROMPT 16 2 "Scelta ditte"
PROMPT 2 3 "Scelta ditte"
END
NUMBER DA_CODICE 5
BEGIN
PROMPT 17 3 "Da codice "
PROMPT 3 4 "Da codice "
HELP "Codice ditta di inizio selezione"
FLAGS "B"
END
NUMBER A_CODICE 5
BEGIN
PROMPT 17 4 "A codice "
PROMPT 3 5 "A codice "
HELP "Codice ditta di fine selezione"
FLAGS "B"
END
STRING F_SELECT 5
BEGIN
PROMPT 17 5 "Scelte n. "
PROMPT 3 6 "Scelte n. "
FLAGS "DR"
END
BUTTON DLG_SELECT 10 2
BEGIN
PROMPT 41 3 "~Selezione"
PROMPT 22 4 "~Selezione"
HELP "Indicare le ditte da selezionare per la stampa"
MESSAGE EXIT, DLG_SELECT
END
BUTTON F_ANNULLA 10
BEGIN
PROMPT 41 5 "A~zzera"
PROMPT 22 6 "A~zzera"
HELP "Annullare la selezione delle ditte"
MESSAGE RESET,DA_CODICE|RESET,A_CODICE
END
STRING CODICE_LIBRO 3
BEGIN
PROMPT 2 7 "Codice libro "
PROMPT 41 4 "Codice libro "
HELP "Codice libro di cui si chiede la stampa; nel caso in cui non si indichi nessun codice verranno stampati tutti i libri delle ditte selezionate"
USE REG SELECT (I0<="3") && (S6=="") && (CODTAB[1,4]==#111)
INPUT CODTAB[1,4] ANNO
@ -100,7 +84,7 @@ END
STRING CODICE_LIBRO_PROVA 3
BEGIN
PROMPT 2 7 "Codice libro "
PROMPT 41 4 "Codice libro "
HELP "Codice libro di cui si chiede la stampa; nel caso in cui non si indichi nessun codice verranno stampati tutti i libri delle ditte selezionate"
USE REG SELECT (I0<="3") && (CODTAB[1,4]==#111)
INPUT CODTAB[1,4] ANNO
@ -116,7 +100,7 @@ END
STRING CODICE_LIB_UN 3
BEGIN
PROMPT 2 7 "Libro unico "
PROMPT 41 4 "Libro unico "
HELP "Codice del libro unico su cui deve essere effettuata la stampa"
USE %LBU SELECT CODTAB[1,4]==#111
INPUT CODTAB[1,4] ANNO
@ -135,13 +119,13 @@ END
DATE DATA_STAMPA
BEGIN
PROMPT 28 7 "Data stampa "
PROMPT 41 5 "Data stampa "
FLAGS "A"
CHECKTYPE REQUIRED
WARNING "Inserire la data di stampa"
END
GROUPBOX DLG_NULL 52 3
GROUPBOX DLG_NULL 35 4
BEGIN
PROMPT 2 8 "Stampa movimenti"
END
@ -155,7 +139,7 @@ END
DATE A_DATA
BEGIN
PROMPT 30 9 "Alla data "
PROMPT 3 10 "Alla data "
HELP "Data di fine stampa registro"
VALIDATE DATE_CMP_FUNC >= DA_DATA
WARNING "Inserire una data non inferiore alla data limite inferiore"
@ -172,28 +156,20 @@ END
LISTBOX MESE 10
BEGIN
PROMPT 4 9 "Mese "
PROMPT 3 9 "Mese "
HELP "Mese di cui eseguire la stampa"
FLAGS "M"
GROUP 2
END
LISTBOX TIPO_RIEPILOGATIVO 11
GROUPBOX DLG_NULL 28 4
BEGIN
PROMPT 2 11 "Tipo riepilogativo "
HELP "Indicare il tipo stampa di liquidazione sul registro"
ITEM "P|Del periodo"
ITEM "A|Annuale"
END
GROUPBOX DLG_NULL 35 4
BEGIN
PROMPT 2 12 "Formato pagina"
PROMPT 40 8 "Formato pagina"
END
LISTBOX STAMPA_WIDTH 4
BEGIN
PROMPT 3 13 "Numero di colonne "
PROMPT 41 9 "Numero di colonne "
HELP "Numero di colonne per pagina del modulo di stampa."
ITEM "1|132"
ITEM "2|198"
@ -201,26 +177,32 @@ END
NUMBER STAMPA_LEN 3
BEGIN
PROMPT 3 14 "Numero di righe "
PROMPT 41 10 "Numero di righe "
HELP "Numero di righe per pagina del modulo di stampa. Se non specificato assume 66 righe"
END
ENDPAGE
LISTBOX TIPO_RIEPILOGATIVO 11
BEGIN
PROMPT 3 12 "Tipo riepilogativo "
ITEM "P|Del periodo"
ITEM "A|Annuale"
END
PAGE "Parametri addizionali" -1 -1 56 18
GROUPBOX DLG_NULL 52 6
BEGIN
PROMPT 2 13 "Parametri addizionali"
END
NUMBER ULTIMA_PAGINA 4
BEGIN
PROMPT 2 2 "Ultimo numero di pagina stampata libro unico "
HELP "Numero dell'ultima pagina del libro unico stampata"
PROMPT 3 14 "Ultimo nr. di pagina stampata libro unico "
FLAGS "R"
GROUP 2
GROUP 5
END
STRING CODICE_LIBRO_IVA 3
BEGIN
PROMPT 2 3 "Eventuale codice libro IVA "
HELP "Libro IVA da stampare. Vuoto = tutti"
PROMPT 3 15 "Eventuale codice libro IVA "
USE REG SELECT (I0<="3") && (CODTAB[1,4]==#111)
INPUT CODTAB[1,4] ANNO
INPUT CODTAB[5,7] CODICE_LIBRO_IVA
@ -232,22 +214,35 @@ BEGIN
//CHECKTYPE NORMAL
FLAGS "U"
VALIDATE ZEROFILL_FUNC 3
GROUP 2
GROUP 5
END
LISTBOX ULTIMO_MESE 10
BEGIN
PROMPT 2 4 "Ultimo mese stampa su libro unico "
PROMPT 3 16 "Ultimo mese stampa su libro unico "
FLAGS "MD"
ITEM "00|Nessuno"
GROUP 2
//GROUP 2
// Sempre disabilitato...
END
BOOLEAN RIF_VID
BEGIN
PROMPT 2 5 "Stampa riferimenti vidimazione"
// Abilitato solo se mese == 12 && stampa libri unici
PROMPT 3 17 "Stampa riferimenti vidimazione"
END
BUTTON DLG_PRINT 10 2
BEGIN
PROMPT -12 -1 "~Stampa"
MESSAGE EXIT,K_ENTER
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE
ENDMASK

@ -46,20 +46,20 @@ BEGIN
INPUT CODCAUS F_APERTURA
END
DATE F_DATAC
BEGIN
PROMPT 36 4 "Data/Anno chiusura "
HELP "Data in cui effettuare il movimento di chiusura"
END
DATE F_DATAAP
BEGIN
PROMPT 36 5 "Data/Anno apertura "
PROMPT 36 4 "Data/Anno apertura "
HELP "Data in cui effettuare il movimento di apertura"
WARNING "Inserire una data non inferiore alla data di chiusura"
VALIDATE DATE_CMP_FUNC >= F_DATAC
END
DATE F_DATAC
BEGIN
PROMPT 36 5 "Data/Anno chiusura "
HELP "Data in cui effettuare il movimento di chiusura"
END
NUMBER F_ANNOCH 4
BEGIN
PROMPT 69 4 ""

@ -98,31 +98,6 @@ bool GesAcc_app::msk_acconto(TMask_field& f, KEY k)
return TRUE;
}
/*** Deve farlo il programma di stampa versamenti!
int GesAcc_app::rewrite(const TMask& m)
{
TString16 chiave;
int anno = m.get_int(F_ANNO);
chiave << anno << 12;
TTable lim ("LIM");
lim.put("CODTAB", chiave);
if (lim.read() == NOERR)
{
real new_acc (m.get(F_ACCONTO));
real new_cred = lim.get_real("R12") - lim.get_real("R11") + new_acc;
lim.put("R11", new_acc);
lim.put("R12", new_cred);
lim.put("R0", lim.get_real("R13")- new_cred);
lim.rewrite();
}
m.autosave(_rel);
return _rel->rewrite();
}
***/
TMask* GesAcc_app::get_mask(int mode)
{
return _mask;

@ -30,6 +30,7 @@ protected: // Applicat
virtual void on_config_change();
static bool gelidi_handler(TMask_field& f, KEY k);
static bool agrmin_handler(TMask_field& f, KEY k);
static bool credres_handler(TMask_field& f, KEY k);
protected: // Relapp
virtual bool user_create();
@ -107,6 +108,22 @@ bool TParaliq_app::agrmin_handler(TMask_field& f, KEY k)
return TRUE;
}
bool TParaliq_app::credres_handler(TMask_field& f, KEY k)
{
if (k == K_ENTER) // In uscita dalla maschera
{
const TMask& m = f.mask();
const short id = f.dlg();
const real r = m.get_real(F_CRED_RES);
const int i = m.get_int(F_MESE_RES_AL);
if (id == F_MESE_RES_AL && r != 0.0 && i == 0)
return f.error_box("Impostare anche il mese.");
if (id == F_CRED_RES && i != 0 && r == 0.0)
return f.error_box("Impostare anche il credito residuo.");
}
return TRUE;
}
void TParaliq_app::check_registers(int year)
{
// controlla che per ogni data attivita' esistano almeno un registro
@ -210,6 +227,8 @@ bool TParaliq_app::user_create()
_msk->set_handler(F_GELIDI,gelidi_handler);
_msk->set_handler(F_AGRMIN,agrmin_handler);
_msk->set_handler(F_CRED_RES,credres_handler);
_msk->set_handler(F_MESE_RES_AL,credres_handler);
((TSheet_field&)_msk->field(F_SHEET_PLA)).set_notify(sheet_action);
return TRUE;
}

@ -7,6 +7,9 @@
#define F_RAGSOC 307
#define F_CRED_COST 308
#define F_AGRMIN 309
#define F_CRED_RES 310
#define F_MESE_RES_AL 311
#define F_CODATT 101
#define F_DESATT 150
#define F_TIPOATT 102

@ -57,7 +57,7 @@ BEGIN
ADD NONE
END
GROUPBOX DLG_NULL 75 5
GROUPBOX DLG_NULL 75 6
BEGIN
PROMPT 2 4 "Parametri ditta"
END
@ -103,6 +103,24 @@ BEGIN
NUM_CALC ROUND(#THIS_FIELD,-3)
END
NUMBER F_CRED_RES 15
BEGIN
PROMPT 4 8 "Credito residuo "
FIELD R15
PICTURE "."
FLAGS "R"
NUM_EXPR #THIS<=#F_CRED_PREC
WARNING "L'importo non puo' essere maggiore del Credito Precedente"
END
LISTBOX F_MESE_RES_AL 14
BEGIN
PROMPT 45 8 "Al mese di "
ITEM "0|"
FLAGS "M"
FIELD I0
END
SPREADSHEET F_SHEET_PLA 78
BEGIN
PROMPT 1 10 "Parametri attivita'"

@ -443,11 +443,20 @@ bool Visliq_app::sel_mese_sh2 (TMask_field& f, KEY k)
if (app().look_del(month, /* sel == (sh.items() - 1) ? 7 : */ 1))
{
TToken_string& tv = sh.row(sel);
tv.add(app().del()->get("D0"),1);
tv.add(app().del()->get("S7"),2);
tv.add(app().del()->get("S8"),3);
tv.add(app().del()->get("S9"),4);
tv.add(app().del()->get("R0"),5);
sh.force_update(sel);
/*
sv.field(102).set(app().del()->get("D0"));
sv.field(103).set(app().del()->get("S7"));
sv.field(104).set(app().del()->get("S8"));
sv.field(105).set(app().del()->get("S9"));
sv.field(106).set(app().del()->get("R0"));
*/
}
return TRUE;
@ -1536,44 +1545,44 @@ void Visliq_app::write_general(TMask& m)
rstart = risl;
}
else
{
// salva i valori modificati senza fare controlli
// e rimetti a lui i suoi debiti mettendo B0 a FALSE
if (was_lim)
{
if (orett != nrett)
_lim->put("R5", nrett);
if (orimb != nrimb)
_lim->put("R1", nrimb);
_lim->put("B0", "");
_lim->rewrite();
}
}
else
{
// salva i valori modificati senza fare controlli
// e rimetti a lui i suoi debiti mettendo B0 a FALSE
if (was_lim)
{
if (orett != nrett)
_lim->put("R5", nrett);
if (orimb != nrimb)
_lim->put("R1", nrimb);
_lim->put("B0", "");
_lim->rewrite();
}
}
// Rimetti a posto righe sheet se serve
if (was_lim)
{
int sr0 = (_lim->get_real("R0")).sign();
int sr5 = (_lim->get_real("R5")).sign();
// Rimetti a posto righe sheet se serve
if (was_lim)
{
int sr0 = (_lim->get_real("R0")).sign();
int sr5 = (_lim->get_real("R5")).sign();
real r0abs = abs(_lim->get_real("R0"));
real r5abs = abs(_lim->get_real("R5"));
tt_ln.add(r0abs.string(),1);
tt_ln.add(sr0 == 0 ? "" : (sr0 > 0 ? "D" : "C"), 2);
tt_ln.add((_lim->get_real("R1")).string(),3);
tt_ln.add(r5abs.string(),4);
tt_ln.add(sr5 == 0 ? "" : (sr5 > 0 ? "D" : "C"),5);
// sh.force_update(row);
}
_from_one = FALSE;
} // for mese liq. (riga sheet)
real r0abs = abs(_lim->get_real("R0"));
real r5abs = abs(_lim->get_real("R5"));
tt_ln.add(r0abs.string(),1);
tt_ln.add(sr0 == 0 ? "" : (sr0 > 0 ? "D" : "C"), 2);
tt_ln.add((_lim->get_real("R1")).string(),3);
tt_ln.add(r5abs.string(),4);
tt_ln.add(sr5 == 0 ? "" : (sr5 > 0 ? "D" : "C"),5);
// sh.force_update(row);
}
_from_one = FALSE;
} // for mese liq. (riga sheet)
sh.force_update();
if (shm.is_running())
sh.force_update(sh.selected());
sh.force_update();
if (shm.is_running())
sh.force_update(sh.selected());
// Rileggi array righe vecchie
set_vers_rows(sv);
set_liq_rows(sh);

@ -221,9 +221,15 @@ END
NUMBER 105 3
BEGIN
PROMPT 1 5 "Concessione "
HELP "Codice Concessione del Comune di residenza fiscale"
// FIELD S9
FLAGS "RZ"
USE %UCC
INPUT CODTAB 105
DISPLAY "Concessione " CODTAB[1,5]
DISPLAY "Descrizione @50" S0
OUTPUT 105 CODTAB
CHECKTYPE NORMAL
WARNING "Concessione assente"
HELP "Codice Concessione del Comune di residenza fiscale"
END

@ -158,6 +158,13 @@ BEGIN
PROMPT 51 18 "Concessione "
HELP "Codice Concessione del Comune di residenza fiscale"
FLAGS "RZH"
USE %UCC
INPUT CODTAB F_DELCON
DISPLAY "Concessione " CODTAB[1,5]
DISPLAY "Descrizione @50" S0
OUTPUT F_DELCON CODTAB
CHECKTYPE NORMAL
WARNING "Concessione assente"
GROUP 4
END

@ -30,10 +30,10 @@ class TRic_archivi : public TSkeleton_application
TLocalisamfile* _rmov;
TLocalisamfile* _rmoviva;
TLocalisamfile* _occas;
TLocalisamfile* _part;
TLocalisamfile* _scad;
TLocalisamfile* _pagsca;
TLocalisamfile* _tab;
//TLocalisamfile* _part;
//TLocalisamfile* _scad;
//TLocalisamfile* _pagsca;
//TLocalisamfile* _tab;
TString80 TEMP;
@ -103,10 +103,10 @@ bool TRic_archivi::create()
_rmov = new TLocalisamfile (LF_RMOV);
_rmoviva = new TLocalisamfile (LF_RMOVIVA);
_occas = new TLocalisamfile (LF_OCCAS);
_part = new TLocalisamfile (LF_PARTITE);
_scad = new TLocalisamfile (LF_SCADENZE);
_pagsca = new TLocalisamfile (LF_PAGSCA);
_tab = new TLocalisamfile (LF_TAB);
//_part = new TLocalisamfile (LF_PARTITE);
//_scad = new TLocalisamfile (LF_SCADENZE);
//_pagsca = new TLocalisamfile (LF_PAGSCA);
//_tab = new TLocalisamfile (LF_TAB);
_numdisk = 1;
_prima_volta = TRUE;
@ -132,10 +132,10 @@ bool TRic_archivi::destroy()
delete _rmov;
delete _rmoviva;
delete _occas;
delete _part;
delete _scad;
delete _pagsca;
delete _tab;
//delete _part;
//delete _scad;
//delete _pagsca;
//delete _tab;
return TApplication::destroy();
}

@ -291,7 +291,14 @@ bool TRic_ListaMov::user_create()
_mov = new TLocalisamfile (LF_MOV);
_rmov = new TLocalisamfile (LF_RMOV);
_rmoviva = new TLocalisamfile (LF_RMOVIVA);
_part = NULL;
_scad = NULL;
_pagsca = NULL;
_tpart = NULL;
_tscad = NULL;
_tpagsca = NULL;
// _part = new TLocalisamfile (LF_PARTITE);
// _scad = new TLocalisamfile (LF_SCADENZE);
// _pagsca = new TLocalisamfile (LF_PAGSCA);
@ -2200,6 +2207,11 @@ bool TRic_ListaMov::preprocess_page(int file,int counter)
set_row(r," protocollo n. %-5ld", _protiva);
}
set_row(r, " comp. %d", _anno);
// Guy: Aggiunta stampa mese di liquidazione se presente
const int meseliq = cur->curr(LF_MOV).get_int(MOV_MESELIQ);
if (meseliq > 0)
set_row(r, " mese liq. %d", meseliq);
stampa_errori_mov(r);
@ -2337,9 +2349,9 @@ bool TRic_ListaMov::preprocess_page(int file,int counter)
aggiorna_partite();
bool controlla = controlla_partite(); //se TRUE => ci sono errori nella testata
bool verpagsca = controlla_pagsca();
bool verscad = controlla_scadenze();
bool controlla = controlla_partite(); //se TRUE => ci sono errori nella testata
bool verifica = (verpagsca || verscad);
if ( (_controllo == 1 && controlla) || _controllo == 2 ||
@ -3249,7 +3261,7 @@ bool TRic_ListaMov::set_print(int m)
printer().footerlen(5);
setta_intestazione();
_err.reset();
}

File diff suppressed because it is too large Load Diff

@ -1,73 +1,74 @@
// Campi maschera cg2800a.uml
#define F_NUMREG 101
#define F_NUMRIG 102
// Campi maschera cg2800b.uml
#define F_DATAREG 103
#define F_DATADOC 104
#define F_ANNO 105
#define F_REGIVA 106
#define F_PROTIVA 107
#define F_NUPROTIVA 108
#define F_CODCAUS 109
#define F_CODPAG 110
#define F_GRUPPO 111
#define F_CONTO 112
#define F_SOTTOCONTO 113
#define F_SEZIONE 114
#define F_IMPORTO 115
#define F_DESCR 116
#define F_GRUPPOC 117
#define F_CONTOC 118
#define F_SOTTOC 119
#define F_NUMDOC 120
#define F_DESCRREG 121
#define F_DESCRCAU 122
#define F_DESCRPAG 123
#define F_DESCRPARTITA 124
#define F_DESCRCPARTITA 125
#define F_DATACOMP 126
#define F_PROVV 127
// Campi maschera cg2800c.uml
#define F_CODCF 150
#define F_RAGSOCOCC 151
#define F_DATA74TER 152
#define F_INDOCC 153
#define F_LOCALITA 154
#define F_CAPOCC 155
#define F_PROVOCC 156
#define F_IMPONIBILE 157
#define F_IMPOSTA 158
#define F_CODIVA 159
#define F_TIPODET 160
#define F_TIPOCR 161
#define F_RAGSOCCF 162
#define F_DESCRCODIVA 163
#define F_CFPI 164
#define F_CIVOCC 165
#define F_COMOCC 166
// Campi maschera cg2801a.uml
#define F_CODDITTA 200
#define F_RAGDITTA 201
// Campi maschera cg2803a.uml
#define F_CODDITTARIC 250
#define F_RAGSOC 251
#define F_NULTRAS 252
#define F_DATAULTRAS 253
#define F_STD 254
#define F_USELAB 255
#define F_STATO 256
#define F_AGGCAUSALI 257
#define F_AGGCLIFO 258
#define F_AGGPCON 259
#define F_AGGIVD 260
#define F_FATTEM 261
// Campi maschera cg2800a.uml
#define F_NUMREG 101
#define F_NUMRIG 102
// Campi maschera cg2800b.uml
#define F_DATAREG 103
#define F_DATADOC 104
#define F_ANNO 105
#define F_REGIVA 106
#define F_PROTIVA 107
#define F_NUPROTIVA 108
#define F_CODCAUS 109
#define F_CODPAG 110
#define F_GRUPPO 111
#define F_CONTO 112
#define F_SOTTOCONTO 113
#define F_SEZIONE 114
#define F_IMPORTO 115
#define F_DESCR 116
#define F_GRUPPOC 117
#define F_CONTOC 118
#define F_SOTTOC 119
#define F_NUMDOC 120
#define F_DESCRREG 121
#define F_DESCRCAU 122
#define F_DESCRPAG 123
#define F_DESCRPARTITA 124
#define F_DESCRCPARTITA 125
#define F_DATACOMP 126
#define F_PROVV 127
#define F_MESELIQ 128
// Campi maschera cg2800c.uml
#define F_CODCF 150
#define F_RAGSOCOCC 151
#define F_DATA74TER 152
#define F_INDOCC 153
#define F_LOCALITA 154
#define F_CAPOCC 155
#define F_PROVOCC 156
#define F_IMPONIBILE 157
#define F_IMPOSTA 158
#define F_CODIVA 159
#define F_TIPODET 160
#define F_TIPOCR 161
#define F_RAGSOCCF 162
#define F_DESCRCODIVA 163
#define F_CFPI 164
#define F_CIVOCC 165
#define F_COMOCC 166
// Campi maschera cg2801a.uml
#define F_CODDITTA 200
#define F_RAGDITTA 201
// Campi maschera cg2803a.uml
#define F_CODDITTARIC 250
#define F_RAGSOC 251
#define F_NULTRAS 252
#define F_DATAULTRAS 253
#define F_STD 254
#define F_USELAB 255
#define F_STATO 256
#define F_AGGCAUSALI 257
#define F_AGGCLIFO 258
#define F_AGGPCON 259
#define F_AGGIVD 260
#define F_FATTEM 261
#define F_FATTRIC 262

@ -1,196 +1,203 @@
#include "cg6800.h"
TOOLBAR "" 0 20 0 2
BUTTON DLG_SAVEREC 10 2
BEGIN
PROMPT -15 -1 "~Registra"
MESSAGE EXIT,K_SAVE
PICTURE BMP_SAVEREC
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -45 -1 ""
MESSAGE EXIT,K_ESC
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -55 -1 ""
MESSAGE EXIT,K_QUIT
END
ENDPAGE
PAGE "" -1 -1 78 18
NUMBER F_NUMREG 6
BEGIN
PROMPT 1 1 "Numero registrazione "
HELP "Inserire il numero di registrazione che si vuole modificare"
FLAGS "RZ"
CHECKTYPE REQUIRED
END
NUMBER F_NUMRIG 2
BEGIN
PROMPT 52 1 "Numero di riga "
HELP "Inserire il numero della riga desiderata. Se non viene specificata si entra in modifica della testata"
FLAGS "RZ"
END
NUMBER F_CODCF 6
BEGIN
PROMPT 1 3 "Codice C/F "
FLAGS "R"
END
STRING F_RAGSOCCF 50
BEGIN
PROMPT 26 3 ""
FLAGS "D"
END
DATE F_DATA74TER
BEGIN
PROMPT 1 4 "Data reg. 74TER "
END
LIST F_PROVV 1 16
BEGIN
PROMPT 36 4 "Movimento provvisorio "
ITEM " |No (Definitivo)"
ITEM "C|Cespiti"
ITEM "P|Contabile"
END
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 0 6 "Cliente occasionale"
END
STRING F_CFPI 16
BEGIN
PROMPT 1 1 ""
FLAGS "HG"
END
STRING F_RAGSOCOCC 25
BEGIN
PROMPT 1 7 "Ragione sociale "
END
STRING F_INDOCC 22
BEGIN
PROMPT 1 8 "Indirizzo "
END
STRING F_CIVOCC 6
BEGIN
PROMPT 41 8 ""
END
STRING F_LOCALITA 18
BEGIN
PROMPT 1 9 "Localita' "
END
STRING F_CAPOCC 5
BEGIN
PROMPT 46 9 "C.A.P. "
END
STRING F_PROVOCC 2
BEGIN
PROMPT 62 9 "Provincia "
END
STRING F_COMOCC 4
BEGIN
PROMPT 1 10 ""
FLAGS "HG"
END
NUMBER F_IMPONIBILE 15
BEGIN
PROMPT 1 11 "Imponibile "
FLAGS "R"
PICTURE "."
END
STRING F_CODIVA 4
BEGIN
PROMPT 1 12 "Codice IVA "
FLAGS "U"
END
STRING F_DESCRCODIVA 50 46
BEGIN
PROMPT 30 12 ""
FLAGS "D"
END
NUMBER F_IMPOSTA 15
BEGIN
PROMPT 1 13 "Imposta "
FLAGS "R"
PICTURE "."
END
NUMBER F_TIPODET 1
BEGIN
PROMPT 1 14 "Tipo detraibilita' "
SHEET "Codice|Tipo detraibilita'@75"
INPUT F_TIPODET
ITEM " |Regime normale"
ITEM "1|IVA indetraibile su acquisti riferiti a ricavi esenti"
ITEM "3|IVA indicata per passaggi interni al solo fine del calcolo di ventilazione"
ITEM "9|IVA non detraibile per l'articolo 19"
OUTPUT F_TIPODET
END
NUMBER F_TIPOCR 1
BEGIN
PROMPT 1 15 "Tipo Costo/Ricavo "
SHEET "Codice|Tipo costo ricavo@50"
INPUT F_TIPOCR
ITEM " |0. Acquisti o vendite in genere"
ITEM "1|1. Acquisti beni per rivendita"
ITEM "2|2. Acquisti beni ammortizzabili"
ITEM "3|3. Acquisti beni ammortizzabili con detr. 6%"
ITEM "4|4. Vendita beni strumentali art. 17"
ITEM "5|5. Beni per rivendita da non ventilare"
ITEM "8|8. Altri beni strumentali acquistati in leasing"
ITEM "9|9. Spese generali"
HELP "Tipo Costo/Ricavo del conto"
OUTPUT F_TIPOCR
END
NUMBER F_GRUPPO 3
BEGIN
PROMPT 1 16 "Sottoconto costo/ricavo "
FLAGS "R"
END
NUMBER F_CONTO 3
BEGIN
PROMPT 30 16 ""
FLAGS "R"
END
NUMBER F_SOTTOCONTO 6
BEGIN
PROMPT 35 16 ""
FLAGS "R"
END
STRING F_DESCRPARTITA 50
BEGIN
PROMPT 1 17 "Descrizione sottoconto "
FLAGS "D"
END
ENDPAGE
ENDMASK
#include "cg6800.h"
TOOLBAR "" 0 20 0 2
BUTTON DLG_SAVEREC 10 2
BEGIN
PROMPT -15 -1 "~Registra"
MESSAGE EXIT,K_SAVE
PICTURE BMP_SAVEREC
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -45 -1 ""
MESSAGE EXIT,K_ESC
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -55 -1 ""
MESSAGE EXIT,K_QUIT
END
ENDPAGE
PAGE "" -1 -1 78 18
NUMBER F_NUMREG 6
BEGIN
PROMPT 1 1 "Numero registrazione "
HELP "Inserire il numero di registrazione che si vuole modificare"
FLAGS "RZ"
CHECKTYPE REQUIRED
END
NUMBER F_NUMRIG 2
BEGIN
PROMPT 52 1 "Numero di riga "
HELP "Inserire il numero della riga desiderata. Se non viene specificata si entra in modifica della testata"
FLAGS "RZ"
END
NUMBER F_CODCF 6
BEGIN
PROMPT 1 3 "Codice C/F "
FLAGS "R"
END
STRING F_RAGSOCCF 50
BEGIN
PROMPT 26 3 ""
FLAGS "D"
END
DATE F_DATA74TER
BEGIN
PROMPT 1 4 "Data reg. 74TER "
END
LIST F_MESELIQ 2 10
BEGIN
PROMPT 1 5 "Mese liquidazione "
FLAGS "M"
ITEM " |Nessuno"
END
LIST F_PROVV 1 16
BEGIN
PROMPT 36 4 "Movimento provvisorio "
ITEM " |No (Definitivo)"
ITEM "C|Cespiti"
ITEM "P|Contabile"
END
GROUPBOX DLG_NULL 78 5
BEGIN
PROMPT 0 6 "Cliente occasionale"
END
STRING F_CFPI 16
BEGIN
PROMPT 1 1 ""
FLAGS "HG"
END
STRING F_RAGSOCOCC 25
BEGIN
PROMPT 1 7 "Ragione sociale "
END
STRING F_INDOCC 22
BEGIN
PROMPT 1 8 "Indirizzo "
END
STRING F_CIVOCC 6
BEGIN
PROMPT 41 8 ""
END
STRING F_LOCALITA 18
BEGIN
PROMPT 1 9 "Localita' "
END
STRING F_CAPOCC 5
BEGIN
PROMPT 46 9 "C.A.P. "
END
STRING F_PROVOCC 2
BEGIN
PROMPT 62 9 "Provincia "
END
STRING F_COMOCC 4
BEGIN
PROMPT 1 10 ""
FLAGS "HG"
END
NUMBER F_IMPONIBILE 15
BEGIN
PROMPT 1 11 "Imponibile "
FLAGS "R"
PICTURE "."
END
STRING F_CODIVA 4
BEGIN
PROMPT 1 12 "Codice IVA "
FLAGS "U"
END
STRING F_DESCRCODIVA 50 46
BEGIN
PROMPT 30 12 ""
FLAGS "D"
END
NUMBER F_IMPOSTA 15
BEGIN
PROMPT 1 13 "Imposta "
FLAGS "R"
PICTURE "."
END
NUMBER F_TIPODET 1
BEGIN
PROMPT 1 14 "Tipo detraibilita' "
SHEET "Codice|Tipo detraibilita'@75"
INPUT F_TIPODET
ITEM " |Regime normale"
ITEM "1|IVA indetraibile su acquisti riferiti a ricavi esenti"
ITEM "3|IVA indicata per passaggi interni al solo fine del calcolo di ventilazione"
ITEM "9|IVA non detraibile per l'articolo 19"
OUTPUT F_TIPODET
END
NUMBER F_TIPOCR 1
BEGIN
PROMPT 1 15 "Tipo Costo/Ricavo "
SHEET "Codice|Tipo costo ricavo@50"
INPUT F_TIPOCR
ITEM " |0. Acquisti o vendite in genere"
ITEM "1|1. Acquisti beni per rivendita"
ITEM "2|2. Acquisti beni ammortizzabili"
ITEM "3|3. Acquisti beni ammortizzabili con detr. 6%"
ITEM "4|4. Vendita beni strumentali art. 17"
ITEM "5|5. Beni per rivendita da non ventilare"
ITEM "8|8. Altri beni strumentali acquistati in leasing"
ITEM "9|9. Spese generali"
HELP "Tipo Costo/Ricavo del conto"
OUTPUT F_TIPOCR
END
NUMBER F_GRUPPO 3
BEGIN
PROMPT 1 16 "Sottoconto costo/ricavo "
FLAGS "R"
END
NUMBER F_CONTO 3
BEGIN
PROMPT 30 16 ""
FLAGS "R"
END
NUMBER F_SOTTOCONTO 6
BEGIN
PROMPT 35 16 ""
FLAGS "R"
END
STRING F_DESCRPARTITA 50
BEGIN
PROMPT 1 17 "Descrizione sottoconto "
FLAGS "D"
END
ENDPAGE
ENDMASK

@ -2594,7 +2594,8 @@ bool TVar_sc::esegui_controlli()
_std = conf.get("FlStTra");
if (!prefix().exist(_dittaric))
return error_box("Rilevati gravi errori negli archivi: procedura interrotta");
//return error_box("Rilevati gravi errori negli archivi: procedura interrotta");
return error_box("Gli archivi della ditta %05ld non esistono.", _dittaric);
if (!leggi_trasfer())
return FALSE;
@ -2648,6 +2649,10 @@ bool TVar_sc::controlli()
if (_std == "T")
return error_box("Variazione NON POSSIBILE: eseguire prima la ricezione delle tabelle");
const bool is_sc = _control_rec.sub(86,95).find('B') >= 0;
if (!is_sc)
return error_box("Variazione NON POSSIBILE: non esistono movimenti saldaconto.");
return TRUE;
}

251
cg/cginst.ini Executable file

@ -0,0 +1,251 @@
[cg]
Data = 01-04-1998
Descrizione = Contabilita' Generale
Dischi = 1
Moduli = ba
Patch = 304
PostProcess = bainst -0 CG
PreProcess =
Prezzo(1) = 1000,350
Versione = 19980102
[cg0]
File(0) = cg00.bmp
File(1) = cgarea.men
Patch = 304
Versione = 19980102
[cg1]
File(2) = ab0.exe|X
File(3) = ab0200a.msk|X
File(4) = bastcfi.msk
File(5) = bastdpn.msk
File(6) = bastivd.msk
File(7) = bastver.msk
File(8) = batbcfi.msk
File(9) = batbcfi.rpt
File(10) = batbdel.msk
File(11) = batbdpn.msk
File(12) = batbdpn.rpt
File(13) = batbind.msk
File(14) = batbinl.msk
File(15) = batbins.msk
File(16) = batbivd.msk
File(17) = batbivd.rpt
File(18) = batblbu.msk
File(19) = batblia.msk
File(20) = batbpdb.msk|X
File(21) = batbtra.msk
File(22) = batbver.msk
File(23) = batbver.rpt
File(24) = cb0000.exe
File(25) = cg01.bmp
File(26) = cg0500a.msk
File(27) = cg2.exe
File(28) = cg2100a.msk
File(29) = cg2100b.msk
File(30) = cg2100c.msk
File(31) = cg2100i.msk
File(32) = cg2100k.msk
File(33) = cg2100n.msk
File(34) = cg2100o.msk
File(35) = cg2100p.msk
File(36) = cg2100s.msk
File(37) = cg2200a.msk
File(38) = cg3.exe
File(39) = cg3100a.msk
File(40) = cg3100b.msk
File(41) = cg3100c.msk
File(42) = cg3200a.msk
File(43) = cg3300.frm
File(44) = cg3300a.msk
File(45) = cg3300b.msk
File(46) = cg3300c.msk
File(47) = cg3400a.msk
File(48) = cg3400b.msk
File(49) = cg3500a.msk
File(50) = cg3600a.msk
File(51) = cg3600b.msk
File(52) = cg3700a.msk
File(53) = cg4.exe
File(54) = cg4100a.msk
File(55) = cg4100b.msk
File(56) = cg4200a.msk
File(57) = cg4300a.msk
File(58) = cg4300b.msk
File(59) = cg4300c.msk
File(60) = cg4400a.msk
File(61) = cg4400b.msk
File(62) = cg4500a.msk
File(63) = cg4500b.msk
File(64) = cg4600a.msk
File(65) = cg4700a.msk
File(66) = cg4800a.msk
File(67) = cg4800b.msk
File(68) = cg4900a.msk
File(69) = cg4900b.msk
File(70) = cg4900c.msk
File(71) = cg4900d.msk
File(72) = cg5.exe
File(73) = cg5000a.msk
File(74) = cg5100a.msk
File(75) = cg5200a.msk
File(76) = cg5300a.msk
File(77) = cg5400a.msk
File(78) = cg5400b.msk
File(79) = cg5500a.msk
File(80) = cg5500b.msk
File(81) = cg5500c.msk
File(82) = cg5500d.msk
File(83) = cg5600a.msk
File(84) = cg6.exe
File(85) = cg6400a.msk
File(86) = cg6400b.msk
File(87) = cg6400c.msk
File(88) = cg6600a.msk
File(89) = cg6700a.msk
File(90) = cg6800a.msk
File(91) = cg6800b.msk
File(92) = cg6800c.msk
File(93) = cg6801a.msk
File(94) = cg6802a.msk
File(95) = cg6802b.msk
File(96) = cg6803a.msk
File(97) = cg6804a.msk
File(98) = cg6804b.msk
File(99) = cg6804c.msk
File(100) = cg6804d.msk
File(101) = cg6804e.msk
File(102) = cg6804f.msk
File(103) = cg6804g.msk
File(104) = cg6900a.msk
File(105) = cg6900b.msk
File(106) = cg6903a.msk
File(107) = cgaddon.men
File(108) = cgprassi.hlp
File(109) = cgprassi.men
File(110) = cgtrc.ini
File(111) = cgtrcpc.ini
File(112) = dummy.ldb
File(113) = dummy.mdb
File(114) = pec.frm
File(115) = trrice.exe
File(116) = vcopia.exe
Patch = 304
Versione = 19980102
[cg2]
File(117) = recdesc\f103.dir
File(118) = recdesc\f103.trr
File(119) = recdesc\f104.dir
File(120) = recdesc\f104.trr
File(121) = recdesc\f21.dir
File(122) = recdesc\f21.trr
File(123) = recdesc\f22.dir
File(124) = recdesc\f22.trr
File(125) = recdesc\f23.dir
File(126) = recdesc\f23.trr
File(127) = recdesc\f24.dir
File(128) = recdesc\f24.trr
File(129) = recdesc\f25.dir
File(130) = recdesc\f25.trr
File(131) = recdesc\f26.dir
File(132) = recdesc\f26.trr
File(133) = recdesc\f27.dir
File(134) = recdesc\f27.trr
File(135) = recdesc\f28.dir
File(136) = recdesc\f28.trr
File(137) = recdesc\f29.dir
File(138) = recdesc\f29.trr
File(139) = recdesc\f30.dir
File(140) = recdesc\f30.trr
File(141) = recdesc\f78.dir|X
File(142) = recdesc\f78.trr|X
Patch = 304
Versione = 19980102
[cg9]
File(143) = bastcam.msk
File(144) = bastcco.msk
File(145) = bastcve.msk
File(146) = bastesc.msk
File(147) = bastleg.msk
File(148) = bastmag.msk
File(149) = bastmsp.msk
File(150) = bastndo.msk
File(151) = bastnot.msk
File(152) = bastpor.msk
File(153) = bastreg.msk
File(154) = bastscc.msk
File(155) = bastspp.msk
File(156) = basttit.msk
File(157) = basttri.msk
File(158) = bastums.msk
File(159) = bastvet.msk
File(160) = bastzon.msk
File(161) = batbcam.msk
File(162) = batbcam.rpt
File(163) = batbcco.msk
File(164) = batbcco.rpt
File(165) = batbcve.msk
File(166) = batbcve.rpt
File(167) = batbesc.msk
File(168) = batbesc.rpt
File(169) = batbleg.msk
File(170) = batbleg.rpt
File(171) = batbmsp.msk
File(172) = batbmsp.rpt
File(173) = batbndo.msk
File(174) = batbndo.rpt
File(175) = batbnot.msk
File(176) = batbnot.rpt
File(177) = batbpor.msk
File(178) = batbpor.rpt
File(179) = batbreg.msk
File(180) = batbreg.rpt
File(181) = batbscc.msk
File(182) = batbscc.rpt
File(183) = batbspp.msk
File(184) = batbspp.rpt
File(185) = batbtit.msk
File(186) = batbtit.rpt
File(187) = batbtri.msk
File(188) = batbtri.rpt
File(189) = batbums.msk
File(190) = batbums.rpt
File(191) = batbvet.msk
File(192) = batbvet.rpt
File(193) = batbzon.msk
File(194) = batbzon.rpt
File(195) = cg0.exe
File(196) = cg0100a.msk
File(197) = cg0200a.msk|X
File(198) = cg0200b.msk
File(199) = cg0300a.msk
File(200) = cg0400a.msk
File(201) = cg0400b.msk
File(202) = cg1.exe
File(203) = cg1100a.msk
File(204) = cg1200a.msk
File(205) = cg1200b.msk
File(206) = cg1300a.msk
File(207) = cg1300b.msk
File(208) = cg1300c.msk
File(209) = cg1300d.msk
File(210) = cg1400a.msk
File(211) = cg1500a.msk
File(212) = cg1600a.msk
File(213) = cg1700a.msk
File(214) = recdesc\f16.dir
File(215) = recdesc\f16.trr
File(216) = recdesc\f17.dir
File(217) = recdesc\f17.trr
File(218) = recdesc\f18.dir
File(219) = recdesc\f18.trr
File(220) = recdesc\f19.dir
File(221) = recdesc\f19.trr
File(222) = recdesc\f20.dir|X
File(223) = recdesc\f20.trr|X
Patch = 304
Versione = 19980102

@ -319,7 +319,7 @@ real* TRegistro::read_prorata(int anno) const
real TRegistro::prorata(int annodoc)
{
const int annoiva = year();
const int annopro = annoiva < 1998 ? annoiva : annodoc;
const int annopro = (annoiva < 1998 || annodoc < 1900) ? annoiva : annodoc;
TString16 chiave; chiave << annopro;
real* pr = (real*)_prorata.objptr(chiave);
@ -328,9 +328,17 @@ real TRegistro::prorata(int annodoc)
{
pr = read_prorata(annopro);
if (pr == NULL && annopro != annoiva)
pr = read_prorata(annoiva);
{
warning_box("Non esistono i dati relativi al pro rata per il %d:\n"
"verra' considerato l'anno %d", annopro, annoiva);
pr = read_prorata(annoiva);
}
if (pr == NULL)
{
warning_box("Non esistono i dati relativi al pro rata per il %d:\n"
"verra' considerato allo 0%", annoiva);
pr = new real;
}
_prorata.add(chiave, pr, TRUE);
}

@ -8,40 +8,40 @@
// e interessi IVA dalla tabella //
///////////////////////////////////
TInteressi_IVA_table::TInteressi_IVA_table()
TInteressi_IVA_table::TInteressi_IVA_table() : TTable("%VER")
{
_ver = new TTable("%VER");
// _ver = new TTable("%VER");
}
TInteressi_IVA_table::~TInteressi_IVA_table()
{
delete _ver;
//delete _ver;
}
int TInteressi_IVA_table::read(int anno, int mese)
{
TString16 k;
k.format("%d%02d",anno,mese);
_ver->zero();_ver->put("CODTAB",k);
if (_ver->read(_isgteq) == NOERR)
zero();put("CODTAB",k);
if (TTable::read(_isgteq) == NOERR)
{
const TString& cod = _ver->get("CODTAB");
if (cod > k)
if (_ver->prev() != NOERR)
_ver->zero();
if (prev() != NOERR)
zero();
}
else
if (_ver->last() != NOERR)
_ver->zero();
return _ver->status();
if (last() != NOERR)
zero();
return status();
}
real TInteressi_IVA_table::get(int what)
{
TString16 fieldname;
fieldname.format("R%d",what);
return _ver->get_real(fieldname);
return get_real(fieldname);
}
///////////////////////////////////////////////

@ -31,13 +31,13 @@
#define B_LIQ_DIFF 11
#define B_LIQ_NORM 12
class TInteressi_IVA_table : public TObject
class TInteressi_IVA_table : public TTable
{
TTable *_ver;
// TTable *_ver;
public:
int read(int anno, int mese);
int status() { return _ver->status();}
//int status() { return _ver->status();}
real get(int what);
TInteressi_IVA_table();
~TInteressi_IVA_table();

@ -8,6 +8,7 @@
#include <scanner.h>
#include <tabutil.h>
#include <utility.h>
#include <varrec.h>
#include "cglib01.h"
#include "cglib04.h"
@ -3174,21 +3175,29 @@ bool TTransfer_file::fcopytemp(const char* orig, const char* dest)
}
if ( (pos = sigle.find('B')) >= 0)
{
TTrec trec;
_tmppart = "%";
_tmppart << path();
_tmppart << "\\" << TEMP_PART;
_tpart = new TIsamtempfile(LF_PARTITE, _tmppart, TRUE);
_deppart = new TRectype(LF_PARTITE);
//_deppart = new TRectype(LF_PARTITE);
trec.get(LF_PARTITE);
_deppart = new TExtrectype (trec);
_tmpscad = "%";
_tmpscad << path();
_tmpscad << "\\" << TEMP_SCAD;
_tscad = new TIsamtempfile(LF_SCADENZE, _tmpscad, TRUE);
_depscad = new TRectype (LF_SCADENZE);
//_depscad = new TRectype (LF_SCADENZE);
trec.get(LF_SCADENZE);
_depscad = new TExtrectype (trec);
_tmppagsca = "%";
_tmppagsca << path();
_tmppagsca << "\\" << TEMP_PAGSCA;
_tpagsca = new TIsamtempfile(LF_PAGSCA, _tmppagsca, TRUE);
_deppagsca = new TRectype (LF_PAGSCA);
//_deppagsca = new TRectype (LF_PAGSCA);
trec.get(LF_PAGSCA);
_deppagsca = new TExtrectype (trec);
nrec_salda = atol(nrec.mid(pos*6,6));
}
@ -3581,6 +3590,8 @@ bool TTransfer_file::fcopytemp_PC(const char* orig, const char* dest)
}
if (sigle.find('B') >= 0)
{
TTrec trec;
_tmppart = "%";
_tmppart << path();
_tmppart << "\\" << TEMP_PART;
@ -3592,11 +3603,17 @@ bool TTransfer_file::fcopytemp_PC(const char* orig, const char* dest)
_tmppagsca << "\\" << TEMP_PAGSCA;
_tpart = new TIsamtempfile(LF_PARTITE, _tmppart, TRUE);
_deppart = new TRectype (LF_PARTITE);
//_deppart = new TRectype (LF_PARTITE);
trec.get(LF_PARTITE);
_deppart = new TExtrectype (trec);
_tscad = new TIsamtempfile(LF_SCADENZE, _tmpscad, TRUE);
_depscad = new TRectype (LF_SCADENZE);
//_depscad = new TRectype (LF_SCADENZE);
trec.get(LF_SCADENZE);
_depscad = new TExtrectype (trec);
_tpagsca = new TIsamtempfile(LF_PAGSCA, _tmppagsca, TRUE);
_deppagsca = new TRectype (LF_PAGSCA);
//_deppagsca = new TRectype (LF_PAGSCA);
trec.get(LF_PAGSCA);
_deppagsca = new TExtrectype (trec);
}
close();

@ -148,9 +148,12 @@ class TTransfer_file
TRectype* _deprmov;
TRectype* _depriva;
TRectype* _depoccas;
TRectype* _deppart;
TRectype* _depscad;
TRectype* _deppagsca;
//TRectype* _deppart;
//TRectype* _depscad;
//TRectype* _deppagsca;
TExtrectype* _deppart;
TExtrectype* _depscad;
TExtrectype* _deppagsca;
TRecnotype _rec; //Serve alle funzioni per istanziare un Isamtempfile localmente

18
cg/cgp2.cpp Executable file

@ -0,0 +1,18 @@
#include <xvt.h>
#include <checks.h>
#include "cgp2.h"
int main(int argc,char** argv)
{
const int n = (argc > 1) ? atoi(&argv[1][1]) : 0;
switch(n)
{
case 0:
cgp2100(argc, argv); break;
default:
error_box("Usage: cgp2 -0");break;
}
return 0;
}

6
cg/cgp2.h Executable file

@ -0,0 +1,6 @@
#ifndef __cgp2_H
#define __cgp2_H
int cgp2100(int argc, char** argv);
#endif // __cgp2_H

13
cg/cgp2.url Executable file

@ -0,0 +1,13 @@
#include <default.url>
/* cgp0 -0 Programma personalizzato per Istituto Suore */
MENU TASK_MENUBAR
SUBMENU MENU_FILE "~File"
MENUBAR MENU_BAR(1)
MENU MENU_BAR(1)
SUBMENU MENU_FILE "~File"

253
cg/cgp2100.cpp Executable file

@ -0,0 +1,253 @@
#include <applicat.h>
#include <execp.h>
#include <config.h>
#include <mask.h>
#include <relation.h>
#include <utility.h>
#include "..\cg\cgsaldac.h"
#include "cgp2100a.h"
#include "mov.h"
#include "rmov.h"
#include "doc.h"
#include "rdoc.h"
#include "partite.h"
#include "pagsca.h"
#include "clifo.h"
class TGenera_ord_bon : public TSkeleton_application
{
TArray _files;
TMask *_m;
void add_totaledoc(TConfig *ordbon,int nrigadoc,const char * tiporiga, const char * codspesa, real & importo);
protected:
bool create();
bool destroy();
void main_loop();
void genera_ordini(TCursor & cur);
public:
~TGenera_ord_bon ()
{;}
};
bool TGenera_ord_bon::create()
{
_files.add(new TLocalisamfile(LF_PARTITE));
_files.add(new TLocalisamfile(LF_SCADENZE));
_files.add(new TLocalisamfile(LF_PAGSCA));
_m = new TMask ("cgp2100a.msk");
return TSkeleton_application::create();
}
bool TGenera_ord_bon::destroy()
{
delete _m;
return TSkeleton_application::destroy();
}
void TGenera_ord_bon::main_loop()
{
TConfig params("crpa.ini","Main"); // configurazione bonifici
_m->set(F_CAUS,params.get("caus"));
_m->set(F_ABIPRES,params.get("abi_pres"));
_m->set(F_CABPRES,params.get("cab_pres"));
if (_m->run() != K_QUIT)
{
// build cursor
TRectype from(LF_RMOV),to(LF_RMOV);
TRelation *rel= new TRelation(LF_RMOV);
rel->add(LF_MOV,"NUMREG==NUMREG");
rel->add(LF_CLIFO,"TIPOCF==TIPOC|CODCF==SOTTOCONTO");
from.put(RMV_NUMREG,_m->get(F_FROMREG));
to.put(RMV_NUMREG,_m->get(F_TOREG));
TString filter,sortexp;
if (*_m->get(F_FROMDATA))
{
filter << '(' << LF_MOV << "->" << MOV_DATACOMP << ">=" << '"' << _m->get(F_FROMDATA) << '"' << ")";
filter << "&&";
}
if (*_m->get(F_TODATA))
{
filter << '(' << LF_MOV << "->" << MOV_DATACOMP << "<=" << '"' << _m->get(F_TODATA) << '"' << ")";
filter << "&&";
}
filter << '(' << LF_RMOV << "->" << RMV_SEZIONE << "==\"D\")";
filter << "&&";
filter << '(' << LF_RMOV << "->" << RMV_TIPOC << "==\"F\")";
filter << "&&";
filter << "(" <<LF_MOV << "->" << MOV_CODCAUS << "==" << '"'<< _m->get(F_CAUS)<< '"' << ')';
sortexp << LF_RMOV << "->" << RMV_SOTTOCONTO << "|" << LF_MOV << "->" << MOV_DATACOMP
<< "|" << LF_MOV << "->" << MOV_NUMREG;
TSorted_cursor movs(rel,sortexp);
movs.setfilter(filter,TRUE);
movs.setregion(from,to);
genera_ordini(movs);
}
}
void TGenera_ord_bon::genera_ordini(TCursor & cur)
{
{
TString_array transactions;
list_files("crpat*.ini", transactions);
FOR_EACH_ARRAY_ROW(transactions, row, name)
remove(*name);
}
TConfig params("crpa.ini","Main"); // configurazione bonifici
const TString16 tipodoc(params.get("tipodoc"));
const TString16 codnum(params.get("codnum"));
const TString16 tiporiga(params.get("tiporiga"));
const TString16 codspesa(params.get("codspesa"));
const TDate datadoc(_m->get(F_DATADOC));
const long firm(get_firm());
TString descrmov;
TConfig *ordbon=NULL;
TPartite_array partite;
long abi(0),cab(0); // abi e cab di presentazione
long curr_numreg(-1);
int curr_numrig;
long curr_codfor(-1);
int ntransac=0; // contatore di transazione
int nrigadoc=0; // contatore di riga
real totaledoc(ZERO);
const long items=cur.items();
for (long c=0 ;c < items; c++)
{
cur = c;
if (cur.relation()->lfile(LF_RMOV).get_long(RMV_SOTTOCONTO)!=curr_codfor)
{
if (curr_codfor >=0)
{
if (abi==0)
{
abi=_m->get_long(F_ABIPRES);
cab=_m->get_long(F_CABPRES);
}
ordbon->set_paragraph(format("%d",LF_DOC));
ordbon->set(DOC_CODABIP,abi);
ordbon->set(DOC_CODCABP,cab);
add_totaledoc(ordbon,nrigadoc,tiporiga, codspesa, totaledoc);
delete ordbon;
if (nrigadoc)
{
nrigadoc=0;
totaledoc=0;
abi=0;
cab=0;
} else
remove(format("crpat%03d.ini",ntransac));
}
curr_codfor=cur.relation()->lfile(LF_RMOV).get_long(RMV_SOTTOCONTO);
// ciclo sui fornitori
ntransac++;
ordbon = new TConfig(format("crpat%03d.ini",ntransac));
ordbon->set_paragraph("Transaction");
ordbon->set("Action","INSERT");
ordbon->set("Mode","AUTO");
ordbon->set("Firm",firm);
ordbon->set_paragraph(format("%d",LF_DOC));
ordbon->set("ANNO",cur.relation()->lfile(LF_MOV).get(MOV_ANNOES));
ordbon->set("PROVV","D");
ordbon->set("CODNUM",codnum);
ordbon->set("TIPODOC",tipodoc);
ordbon->set("DATADOC",datadoc);
ordbon->set("TIPOCF","F");
ordbon->set("CODCF",cur.relation()->lfile(LF_RMOV).get(RMV_SOTTOCONTO));
ordbon->set(DOC_CODABIA,cur.relation()->lfile(LF_CLIFO).get(CLI_CODABI));
ordbon->set(DOC_CODCABA,cur.relation()->lfile(LF_CLIFO).get(CLI_CODCAB));
}
if (cur.relation()->lfile(LF_MOV).get_long(MOV_NUMREG) != curr_numreg)
{
curr_numreg=cur.relation()->lfile(LF_MOV).get_long(MOV_NUMREG);
partite.destroy();
partite.add_numreg(curr_numreg);
}
curr_numrig=cur.relation()->lfile(LF_RMOV).get_int(RMV_NUMRIG);
for (TPartita* game = partite.first(); game; game = partite.next())
{
const int r = game->mov2rig(curr_numreg,curr_numrig);
if (r > 0)
{
// immette la riga
TRiga_partite &rpart = game->riga(r);
nrigadoc++;
ordbon->set_paragraph(format("%d,%d",LF_RIGHEDOC, nrigadoc));
ordbon->set(RDOC_TIPORIGA,tiporiga);
ordbon->set(RDOC_CODART,codspesa);
ordbon->set(RDOC_PREZZO,rpart.get(PART_IMPORTO));
totaledoc+=rpart.get_real(PART_IMPORTO);
// cerca il riferimento alla fattura per la descrizione
descrmov.cut(0);
TPartita & part=rpart.partita();
const int rigafattura = part.prima_fattura();
TRiga_partite &rpart_fatt = part.riga(rigafattura);
const TDate datadocrif=rpart_fatt.get_date(PART_DATADOC);
const int numdocrif=rpart_fatt.get_int(PART_NUMDOC);
if (numdocrif)
descrmov << "Documento" << format(" n.%d ",numdocrif) << "del " << datadocrif;
if (descrmov.blank())
descrmov=rpart.get(PART_DESCR);
if (descrmov.blank())
descrmov=cur.relation()->lfile(LF_RMOV).get(RMV_DESCR);
if (descrmov.blank())
descrmov=cur.relation()->lfile(LF_MOV).get(MOV_DESCR);
ordbon->set(RDOC_DESCR,descrmov);
ordbon->set(RDOC_LIVELLO,rpart.get(PART_NUMPART));
// aggiunge la banca di presentazione
if (abi==0)
{
const int numrate=rpart_fatt.rate();
if (numrate)
{
abi = rpart_fatt.rata(1).get_long(PAGSCA_CODABIPR);
cab = rpart_fatt.rata(1).get_long(PAGSCA_CODCABPR);
}
}
}
} // cicloo partite
}
// genera l'ultimo documento
if (items)
{
if (abi==0)
{
abi=_m->get_long(F_ABIPRES);
cab=_m->get_long(F_CABPRES);
}
ordbon->set_paragraph(format("%d",LF_DOC));
ordbon->set(DOC_CODABIP,abi);
ordbon->set(DOC_CODCABP,cab);
add_totaledoc(ordbon,nrigadoc,tiporiga, codspesa, totaledoc);
delete ordbon;
}
TExternal_app gestdoc("ve0.exe -1 -icrpat*.ini ");
gestdoc.run();
}
void TGenera_ord_bon::add_totaledoc(TConfig *ordbon,int nrigadoc,const char * tiporiga, const char * codspesa, real & importo)
{
return;
nrigadoc++;
ordbon->set_paragraph(format("%d,%d",LF_RIGHEDOC, nrigadoc));
ordbon->set(RDOC_TIPORIGA,tiporiga);
ordbon->set(RDOC_CODART,codspesa);
ordbon->set(RDOC_PREZZO,importo);
ordbon->set(RDOC_DESCR,"Totale");
}
int cgp2100 (int argc, char** argv)
{
TGenera_ord_bon a;
a.run(argc,argv,"Generazione ordini di bonifico");
return 0;
}

13
cg/cgp2100a.h Executable file

@ -0,0 +1,13 @@
#define F_DATAPAG 101
#define F_DATADOC 102
#define F_CAUS 103
#define F_FROMDATA 104
#define F_TODATA 105
#define F_ANNOES 106
#define F_ABIPRES 107
#define F_CABPRES 108
#define F_BANCA 110
#define F_FILIALE 111
#define F_FROMREG 112
#define F_TOREG 113

139
cg/cgp2100a.uml Executable file

@ -0,0 +1,139 @@
#include "cgp2100a.h"
TOOLBAR "" 0 20 0 2
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE
PAGE "Ordini di bonifico" 0 -1 0 19
NUMBER F_ANNOES 4
BEGIN
FLAGS "H"
PROMPT 4 2 "Esercizio contabile"
USE ESC
INPUT CODTAB[1,4] F_ANNOES
DISPLAY "Esercizio" CODTAB[1,4]
DISPLAY "Codice" CODTAB[5,7]
OUTPUT F_ANNOES CODTAB[1,4]
END
DATE F_DATAPAG
BEGIN
FLAGS "H"
PROMPT 4 4 "Data del pagamento "
MESSAGE COPY,F_FROMDATA|COPY,F_TODATA
CHECKTYPE REQUIRED
END
DATE F_DATADOC
BEGIN
FLAGS "A"
PROMPT 4 4 "Data dell'ordine di bonifico "
CHECKTYPE REQUIRED
END
GROUPBOX DLG_NULL 76 7
BEGIN
PROMPT 3 6 " Selezione movimenti contabili"
END
STRING F_CAUS 3
BEGIN
FLAGS "U"
PROMPT 4 7 "Causale contabile "
USE LF_CAUSALI
INPUT CODCAUS F_CAUS
DISPLAY "Codice" CODCAUS
DISPLAY "Descrizione@50" DESCR
OUTPUT F_CAUS CODCAUS
CHECKTYPE REQUIRED
END
NUMBER F_FROMREG 7
BEGIN
PROMPT 4 9 "Dalla registrazione "
USE LF_MOV
INPUT NUMREG F_FROMREG
DISPLAY "Numero reg." NUMREG
DISPLAY "Descrizione@50" DESCR
OUTPUT F_FROMREG NUMREG
END
NUMBER F_TOREG 7
BEGIN
PROMPT 4 11 "Alla registrazione "
COPY USE F_FROMREG
INPUT NUMREG F_TOREG
COPY DISPLAY F_FROMREG
OUTPUT F_TOREG NUMREG
END
DATE F_FROMDATA
BEGIN
PROMPT 40 9 "Dalla data di competenza "
END
DATE F_TODATA
BEGIN
PROMPT 40 11 "Alla data di competenza "
END
GROUPBOX DLG_NULL 76 5
BEGIN
PROMPT 3 13 " Banca di presentazione "
END
NUMBER F_ABIPRES 5
BEGIN
FLAGS "Z"
PROMPT 4 14 "ABI "
USE %BAN SELECT CODTAB[6,10]==""
INPUT CODTAB[1,5] F_ABIPRES
DISPLAY "Codice@10" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_ABIPRES CODTAB[1,5]
OUTPUT F_BANCA S0
MESSAGE EMPTY "",F_CABPRES
CHECKTYPE NORMAL
END
NUMBER F_CABPRES 5
BEGIN
FLAGS "Z"
PROMPT 20 14 "CAB "
USE %BAN SELECT CODTAB[6,10]!=""
INPUT CODTAB[1,5] F_ABIPRES
INPUT CODTAB[6,10] F_CABPRES
COPY DISPLAY F_ABIPRES
OUTPUT F_ABIPRES CODTAB[1,5]
OUTPUT F_CABPRES CODTAB[6,10]
OUTPUT F_FILIALE S0
CHECKTYPE NORMAL
END
STRING F_BANCA 50
BEGIN
PROMPT 4 15 "Banca "
FLAGS "D"
END
STRING F_FILIALE 50
BEGIN
PROMPT 4 16 " "
FLAGS "D"
END
ENDPAGE
ENDMASK

@ -172,8 +172,9 @@ Item_05 = "Aggiornamento flag op.Intrac.", "cg1 -2 I", "FP"
Item_06 = "Rinumerazione n. Protocollo", "cg1 -2 P", "FP"
Item_07 = "Aggiornamento Codice Attivita'", "cg1 -2 C", "FP"
Item_08 = "Riorganizzazione codici esercizio", "cg1 -2 E", "FP"
Item_09 = "Ricerca righe prima nota errate", "cg1 -2 Z", "FP"
Item_10 = "Collegamento bilanci", [PRASSICG_025]
Item_09 = "Correzione righe di prima nota", "cg1 -2 Z", "FP"
Item_10 = "Impostazione mese liquidazione", "cg1 -2 M", "FP"
Item_11 = "Collegamento bilanci", [PRASSICG_025]
[PRASSICG_019]
Caption = "Invio"

@ -1243,7 +1243,7 @@ bool TPartita::esiste(int nriga, int nrata, int nrigp) const
const TRiga_scadenze& scad = r.rata(nrata);
return scad.exist(nrigp); // Cerca pagamento vero e proprio
}
}
bool TPartita::elimina_pagamento(int nriga, int nrata, int nrigp)
{

@ -195,7 +195,7 @@ U1|11|102|104|25|CONTO|||
U1|12|105|110|25|SOTTOCONTO|||
U1|13|111|113|25|RIGAIMP|||
U1|14|114|116|25|RIGAIVA|||
U1|15|117|118|23|MESELIQ|||
U1|15|117|118|24|MESELIQ|||
B1|1|3|3|28|TIPOC|||
B1|2|4|6|28|GRUPPO|||
B1|3|7|9|28|CONTO|||

9
cg/crpa.ini Executable file

@ -0,0 +1,9 @@
[Main]
tipodoc = ORDB
codnum = ORB
caus = B02
tiporiga = 10
codspesa = BONIF
abi_pres=6275
cab_pres=12811
contoc=26317/A

@ -1,3 +1,3 @@
20
0
$clifo|0|0|566|0|Clienti/Fornitori|NCF||
$clifo|0|0|586|7|Clienti/Fornitori|NCF||

@ -1,5 +1,5 @@
20
49
50
TIPOCF|1|1|0|Tipo ( <C>liente <F>ornitore
CODCF|3|6|0|Codice
RAGSOC|1|50|0|Ragione sociale
@ -39,6 +39,7 @@ COMNASC|1|4|0|Codice comune di nascita
CODSTAT|1|7|0|Codice statistico
CODABI|10|5|0|Codice ABI banca
CODCAB|10|5|0|Codice CAB banca
NUMCC|1|20|0|Numero di conto corrente
OCCAS|8|1|0|Cliente / fornitore occasionale
STATO|2|3|0|Codice stato ???
CODVAL|1|3|0|Codice valuta