Patch level : aga 2.00.303

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Riportata la versione AGA 1.7 patch 302


git-svn-id: svn://10.65.10.50/trunk@10377 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2002-07-02 16:21:23 +00:00
parent fe80f9d91c
commit f991f0834a
61 changed files with 1963 additions and 1484 deletions

View File

@ -26,7 +26,7 @@
#include "..\cg\cglib02.h"
#define usage "Errore - uso : bacnv [1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17] ditta"
#define usage "Errore - uso : bacnv [1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19] ditta"
///////////////////////////////////////////////////////////////////////////////////////////////////////
// Applicazione di conversione archivi XBase, valida per tutti e 4 i tipi di DLL
@ -188,6 +188,8 @@ public:
void convert_uue() const;
void convert_pim2prm() const;
void convert_riba_tcf() const;
void convert_cdc2cms() const;
void convert_mov2movcms() const;
TConversione_archivi() : _oldditta(0), _codditta(0), _error(0) {}
};
@ -338,6 +340,13 @@ bool TConversione_archivi::menu(MENU_TAG)
if (_codditta > 0)
convert_riba_tcf();
break;
case 19:
if (_codditta > 0)
{
convert_cdc2cms();
convert_mov2movcms();
}
break;
default:
break;
}
@ -356,7 +365,7 @@ bool TConversione_archivi::convert_rmov(TLocalisamfile & rmov, TArray & recs, in
for (int i = 0; i < nrecs; i++)
{
TRectype & r0 = (TRectype &) recs[i];
const int rcontr = r0.get_int(RMV_RCONTR) - 1;
const int rcontr = r0.get_int("RCONTR") - 1;
if (rcontr >= 0 && rcontr < nrecs)
{
@ -367,7 +376,7 @@ bool TConversione_archivi::convert_rmov(TLocalisamfile & rmov, TArray & recs, in
r0.put(RMV_CONTOC, r1.get_int(RMV_CONTO));
r0.put(RMV_SOTTOCONTOC, r1.get_long(RMV_SOTTOCONTO));
}
r0.zero(RMV_RCONTR);
r0.zero("RCONTR");
if (rmov.rewrite(r0) != NOERR)
{
const long reg = r0.get_long(RMV_NUMREG);
@ -1661,6 +1670,58 @@ void TConversione_archivi::convert_riba_tcf() const
}
}
/////////////////////////////////////////////////////////////
// Effettua copia dei CDC in CMS (commesse)
////////////////////////////////////////////////////////////
void TConversione_archivi::convert_cdc2cms() const
{
TRelation rel(LF_TAB);
TRectype& curr = rel.curr();
curr.put("COD", "CDC");
TCursor cursore(&rel, "", 1, &curr, &curr);
const long items = cursore.items();
cursore.freeze();
TProgind pi(items, "Conversione tabella da Centri di costo a Commesse...", FALSE, TRUE);
for (cursore=0; cursore.pos()<items; ++cursore)
{
pi.addstatus(1);
curr.put("COD", "CMS");
cursore.file().write();
}
}
////////////////////////////////////////////////////////////////////////////
// Effettua copia dei mov in movCMS (commesse)
//Copia il contenuto del campo NUMGIO nel campo CODCMS del file LF_RMOV
///////////////////////////////////////////////////////////////////////////
void TConversione_archivi::convert_mov2movcms() const
{
TRelation rel(LF_MOV);
TRectype& curr = rel.curr();
TCursor cursore(&rel);
const long items = cursore.items();
cursore.freeze();
TProgind pi(items, "Conversione movimenti con centro di costo...", FALSE, TRUE);
TString80 str;
for (cursore=0; cursore.pos()<items; ++cursore)
{
pi.addstatus(1);
if (curr.get("CODCMS").empty())
{
const long numgio = curr.get_long("NUMGIO");
if (numgio > 0)
{
str.format("%020ld",numgio);
curr.put("CODCMS", str);
cursore.file().rewrite();
}
}
}
}
///////////////////////////////////////////////////////////
// Programma di conversione archivi speciale
///////////////////////////////////////////////////////////
@ -1669,7 +1730,7 @@ int main(int argc,char** argv)
{
const int r = (argc > 1) ? abs(atoi(argv[1])) : 0;
if (r < 0 || r > 18)
if (r < 0 || r > 19)
{
error_box(usage);
return 100;

View File

@ -9,3 +9,4 @@
#define F_PROR 109
#define F_RESP 110
#define F_CHIUSA 111
#define F_RAGSOC 112

View File

@ -41,8 +41,9 @@ NUMBER F_CODCF 6
BEGIN
PROMPT 4 6 "Codice cliente "
FIELD I0
FLAG "R"
USE LF_CLIFO
INPUT TIPOCF "C"
INPUT TIPOCF "C" SELECT
INPUT CODCF F_CODCF
DISPLAY "Codice@6R" CODCF
DISPLAY "Sospeso" SOSPESO
@ -50,11 +51,28 @@ BEGIN
DISPLAY "Codice fiscale@16" COFI
DISPLAY "Partita IVA@11" PAIV
OUTPUT F_CODCF CODCF
CHECKTYPE REQUIRED
OUTPUT F_RAGSOC RAGSOC
CHECKTYPE NORMAL
WARNING "Cliente assente"
ADD RUN cg0 -1
END
STRING F_RAGSOC 50
BEGIN
PROMPT 30 6 ""
USE LF_CLIFO KEY 2
INPUT TIPOCF "C" SELECT
INPUT RAGSOC F_RAGSOC
DISPLAY "Ragione sociale@50" RAGSOC
DISPLAY "Codice@6R" CODCF
DISPLAY "Sospeso" SOSPESO
DISPLAY "Codice fiscale@16" COFI
DISPLAY "Partita IVA@11" PAIV
COPY OUTPUT F_CODCF
CHECKTYPE NORMAL
WARNING "Cliente assente"
END
LIST F_IVA 20
BEGIN
PROMPT 4 8 "Regime IVA "

View File

@ -2,6 +2,7 @@
#include <automask.h>
#include <config.h>
#include <progind.h>
#include <recarray.h>
#include <relation.h>
#include "ce2100a.h"
@ -37,6 +38,21 @@ bool TCalcamm_mask::on_field_event(TOperable_field& o, TField_event e, long joll
switch (o.dlg())
{
case F_ESERCIZIO:
case F_GRUPPO:
case F_SPECIE:
if (e == fe_init || e == fe_modify)
{
const TString& esercizio = get(F_ESERCIZIO);
const TString& gruppo = get(F_GRUPPO);
const TString& specie = get(F_SPECIE);
TString16 key; key << esercizio << gruppo << specie;
TRelation ccb("CCB");
ccb.curr().put("CODTAB", key);
if (ccb.read() == NOERR)
autoload(ccb);
recalc_spese();
}
break;
case F_SPMS_MATGEN:
case F_SPMS_AUTOTRAS:
if (e == fe_modify)
@ -79,6 +95,10 @@ bool TCalcamm::calcola_ammortamenti()
ccq.put("CODTAB", key);
if (ccb.read() == NOERR)
{
// Salva importi spesi per manutenzione
ccq.put("R0", _mask->get(F_SPMS_MATGEN));
ccq.put("R1", _mask->get(F_SPMS_AUTOTRAS));
// Azzera monte spese di manutenzione
ccq.zero("R2");
ccq.zero("R3");

View File

@ -93,12 +93,13 @@ real TCespite::un_milione() const
static real million;
if (million.is_zero())
{
million = 1000000.0;
if (TCurrency::get_firm_dec() == 2)
if (is_euro_value(""))
{
million /= 1936.27;
million.round(2);
}
else
million = 1000000.0;
}
return million;
}
@ -1009,6 +1010,11 @@ real TCespite::ammini_get_real(const char* pstar) const
return val;
}
void TCespite::ammpro_put_perc(const char* pfield, const real& p)
{
real perc = p; perc.round(3);
_ammpro.put(pfield, perc);
}
void TCespite::calc_perc(TRelation& rel, const TRectype& tmv, const TRectype& tmvam)
{
@ -1299,7 +1305,7 @@ real TCespite::mov_r91_escl_ven(const TRectype& tmv)
{
real val;
if (_salini.get_int(SALCE_ANNIPOST91) == 0)
val = val = tmv.get_real(MOVCE_RIV91);
val = tmv.get_real(MOVCE_RIV91);
return val;
}
@ -1324,27 +1330,28 @@ void TCespite::cal_valenza(const TRectype& tmv, const TRectype& tmvam, TRectype&
{
const TDitta_cespiti& dc = ditta_cespiti();
real den = sum_fields(ammmv, AMMMV_QNOR, AMMMV_QACC, AMMMV_QANT, AMMMV_QPERSE, AMMMV_FPRIVATO, AMMMV_QPPRIVATE);
den += sum_fields(tmvam, MOVAM_QNOR, MOVAM_QACC, MOVAM_QANT, MOVAM_QPERSE, MOVAM_FPRIVATO, MOVAM_QPPRIVATE);
real nIAS = 1.0;
if (!den.is_zero())
{
real num = sum_fields(ammmv, AMMMV_QNOR, AMMMV_QACC, AMMMV_QANT, AMMMV_QPERSE);
num += sum_fields(tmvam, MOVAM_QNOR, MOVAM_QACC, MOVAM_QANT, MOVAM_QPERSE);
nIAS = num / den;
}
const real fondo = sum_fields(ammmv, AMMMV_QNOR, AMMMV_QACC, AMMMV_QANT) +
sum_fields(tmvam, MOVAM_QNOR, MOVAM_QACC, MOVAM_QANT);
const real privato = ammmv.get_real(AMMMV_FPRIVATO) + tmvam.get_real(MOVAM_FPRIVATO);
const real totfondo = fondo + privato;
real resparven = mov_val_ven(tmv) * nIAS;
resparven -= sum_fields(ammmv, AMMMV_QNOR, AMMMV_QACC, AMMMV_QANT);
resparven -= sum_fields(tmvam, MOVAM_QNOR, MOVAM_QACC, MOVAM_QANT);
dc.arrotonda(resparven);
real ratio;
if (!totfondo.is_zero())
ratio = privato / totfondo;
real resparven = mov_val_ven(tmv) - totfondo;
if (resparven < ZERO && (mov_r90_escl_ven(tmv) != ZERO || mov_r91_escl_ven(tmv) != ZERO))
resparven = ZERO;
real prezzo = tmv.get_real(MOVCE_IMPVEN) * nIAS;
dc.arrotonda(prezzo);
const real prezzo = tmv.get_real(MOVCE_IMPVEN);
real plusminus = prezzo - resparven;
if (ratio > ZERO)
{
plusminus *= ratio;
dc.arrotonda(plusminus);
}
const real plusminus = prezzo - resparven;
ammmv.put(AMMMV_PLUS, plusminus > ZERO ? plusminus : ZERO);
ammmv.put(AMMMV_MINUS, plusminus < ZERO ? -plusminus : ZERO);
}
@ -1445,18 +1452,21 @@ void TCespite::scansione_movimenti(const TDate& data_limite, bool is_valid)
if (is_valid)
{
if (inies.year() > cce.anno_tuir()) // Controllo praticamente obsoleto
if (inies.year() > cce.anno_tuir()) // Controllo praticamente obsoleto (sempre vero)
{
const int tpspeman = get_int(CESPI_TPSPEMAN);
if ((tpspeman == 2 || tpspeman == 3) || (tpspeman == 4 && cce.esente_art14()))
{
const real valamm = mov_val_amm(tmv);
real vspmanu = calcola_spese_manutenzione(valamm);
const TDate dtmov = movsem.get_date(MOVCE_DTMOV); // ???
const real giorni_residui = fines - dtmov + (segno=='-' ? 0 : 1);
const real giorni_esercizio = fines - inies + 1;
vspmanu = vspmanu * giorni_residui / giorni_esercizio;
cce.arrotonda(vspmanu);
if (!vspmanu.is_zero())
{
const TDate dtmov = movsem.get_date(MOVCE_DTMOV); // ???
const real giorni_residui = fines - dtmov + (segno=='-' ? 0 : 1);
const real giorni_esercizio = fines - inies + 1;
vspmanu = vspmanu * giorni_residui / giorni_esercizio;
cce.arrotonda(vspmanu);
}
tmv.put("VSPMANU", vspmanu);
}
}
@ -1505,7 +1515,7 @@ void TCespite::calc_amm_residui(bool is_valid)
_ammpro.put(AMMCE_QNOR, qnor = resamm); // Forzo la quota uguale al residuo
const real pnor = qnor / coeff_durata * 100.0 / val_amm();
_ammpro.put(AMMCE_PNOR, pnor);
ammpro_put_perc(AMMCE_PNOR, pnor);
resamm -= qnor;
if (resamm > ZERO)
@ -1514,7 +1524,7 @@ void TCespite::calc_amm_residui(bool is_valid)
if (resamm < qacc)
_ammpro.put(AMMCE_QACC, qacc = resamm); // Forzo la quota uguale al residuo
const real pacc = qacc / coeff_durata * 100.0 / val_amm();
_ammpro.put(AMMCE_PACC, pacc);
ammpro_put_perc(AMMCE_PACC, pacc);
resamm -= qacc;
}
else
@ -1527,7 +1537,7 @@ void TCespite::calc_amm_residui(bool is_valid)
if (resamm < qant)
_ammpro.put(AMMCE_QANT, qant = resamm); // Forzo la quota uguale al residuo
const real pant = qant / coeff_durata * 100.0 / val_amm();
_ammpro.put(AMMCE_PANT, pant);
ammpro_put_perc(AMMCE_PANT, pant);
resamm -= qant;
}
else
@ -1551,7 +1561,7 @@ void TCespite::calc_amm_residui(bool is_valid)
real per_eff;
const real qnor = calc_quota(valamm, pnor, resamm, per_eff);
_ammpro.put(AMMCE_QNOR, qnor);
_ammpro.put(AMMCE_PNOR, per_eff);
ammpro_put_perc(AMMCE_PNOR, per_eff);
resamm -= qnor;
}
else
@ -1567,7 +1577,7 @@ void TCespite::calc_amm_residui(bool is_valid)
real per_eff;
const real qacc = calc_quota(valamm, pacc, resamm, per_eff);
_ammpro.put(AMMCE_QACC, qacc);
_ammpro.put(AMMCE_PACC, per_eff);
ammpro_put_perc(AMMCE_PACC, per_eff);
resamm -= qacc;
}
else
@ -1580,7 +1590,7 @@ void TCespite::calc_amm_residui(bool is_valid)
real per_eff;
const real qant = calc_quota(valamm, pant, resamm, per_eff);
_ammpro.put(AMMCE_QANT, qant);
_ammpro.put(AMMCE_PANT, per_eff);
ammpro_put_perc(AMMCE_PANT, per_eff);
resamm -= qant;
}
else
@ -1615,11 +1625,25 @@ void TCespite::calc_amm_residui(bool is_valid)
}
else
{
_ammpro.put(AMMCE_PNOR, ammini_get_real(AMMCE_PNOR)/2.0);
_ammpro.put(AMMCE_PANT, ammini_get_real(AMMCE_PANT)/2.0);
_ammpro.put(AMMCE_PACC, ammini_get_real(AMMCE_PACC)/2.0);
_ammpro.put(AMMCE_MSG01, "X");
pmat = get_real(CESPI_PMAT) / 4.0;
if (get_bool(CESPI_AMMPROP))
{
const real durata_esercizio = fines - inies + 1;
const real giorni_possesso = fines - dtfunz + 1;
const real coeff = giorni_possesso / durata_esercizio;
ammpro_put_perc(AMMCE_PNOR, ammini_get_real(AMMCE_PNOR)*coeff);
ammpro_put_perc(AMMCE_PANT, ammini_get_real(AMMCE_PANT)*coeff);
ammpro_put_perc(AMMCE_PACC, ammini_get_real(AMMCE_PACC)*coeff);
pmat *= coeff; pmat.round(3);
_ammpro.put(AMMCE_MSG06, "X"); // Ammortamento proporzionale nel primo esercizio
}
else
{
ammpro_put_perc(AMMCE_PNOR, ammini_get_real(AMMCE_PNOR)/2.0);
ammpro_put_perc(AMMCE_PANT, ammini_get_real(AMMCE_PANT)/2.0);
ammpro_put_perc(AMMCE_PACC, ammini_get_real(AMMCE_PACC)/2.0);
pmat /= 2.0; pmat.round(3);
_ammpro.put(AMMCE_MSG01, "X"); // Ammortamento al 50% nel primo esercizio
}
}
}
@ -1648,7 +1672,7 @@ void TCespite::calc_amm_residui(bool is_valid)
{
const real qacc = calc_quota(val_amm(), pacc, resamm, per_eff);
_ammpro.put(AMMCE_QACC, qacc);
_ammpro.put(AMMCE_PACC, per_eff);
ammpro_put_perc(AMMCE_PACC, per_eff);
if (_tipo_sit == 1 && uso_promiscuo > 1)
agg_quota(valamm, _ammpro, "QACC", FALSE);
else
@ -1670,7 +1694,7 @@ void TCespite::calc_amm_residui(bool is_valid)
{
const real qant = calc_quota(val_amm(), pant, resamm, per_eff);
_ammpro.put(AMMCE_QANT, qant);
_ammpro.put(AMMCE_PANT, per_eff);
ammpro_put_perc(AMMCE_PANT, per_eff);
if (_tipo_sit == 1 && uso_promiscuo > 1)
agg_quota(valamm, _ammpro, "QANT", FALSE);
else
@ -1730,7 +1754,7 @@ void TCespite::calc_amm_residui(bool is_valid)
if (qnor > ZERO && valore > ZERO)
{
const real pnor = qnor * 100.0 / valore;
_ammpro.put(AMMCE_PNOR, pnor);
ammpro_put_perc(AMMCE_PNOR, pnor);
}
else
_ammpro.zero(AMMCE_PNOR);
@ -1797,7 +1821,7 @@ bool TCespite::calc_amm(int tipo_sit, const TDate& data_limite, bool recalc_spe_
log("* Inizio calcolo situazione %d cespite %s", tipo_sit, (const char*)idcespite);
#ifdef DBG
if (tipo_sit == 1 && atol(idcespite) == 25L)
if (tipo_sit == 1 && atol(idcespite) == 5L)
{
tipo_sit = 1; // Put your breakpoint here
}

View File

@ -44,6 +44,7 @@ protected:
TString& ammini_get(const char* pstar) const;
bool ammini_get_bool(const char* pstar) const;
real ammini_get_real(const char* pstar) const;
void ammpro_put_perc(const char* pfield, const real& p);
void calc_perc(TRelation& rel, const TRectype& tmv, const TRectype& tmvam);
void calc_anni(TRectype& ammmv, const TRectype& tmv, const TRectype& tmvam);

View File

@ -346,12 +346,12 @@ void TRegistro_cespiti::crea_cespite_man()
{
_idspese5 = _idspese25 = "";
const TRectype& ccb = ditta_cespiti().get_attivita();
const real speseman_5 = ccb.get_real("R2");
if (speseman_5 != ZERO)
const real speseman_5 = ccb.get_real("R0") - ccb.get_real("R2");
if (speseman_5 > ZERO)
costruisci_cespite(91, speseman_5);
const real speseman_25 = ccb.get_real("R3");
if (speseman_25 != ZERO)
const real speseman_25 = ccb.get_real("R1") - ccb.get_real("R3");
if (speseman_25 > ZERO)
costruisci_cespite(92, speseman_25);
}

View File

@ -11,18 +11,6 @@ JOIN LF_AMMMV TO LF_MOVCE ALIAS 107 INTO IDCESPITE==IDCESPITE IDMOV==IDMOV
JOIN %TMC TO LF_MOVCE ALIAS 108 INTO CODTAB==CODMOV
END
SECTION GRAPHICS ODD
LINEA -1 147 1
BEGIN
PROMPT 1 5 "B"
END
LINEA -1 147 1
BEGIN
PROMPT 1 9 "B"
END
END
SECTION HEADER FIRST 9
STRINGA FR_CODDITTA
@ -124,6 +112,12 @@ SECTION HEADER FIRST 9
PROMPT 96 4 "@bLIBRO CESPITI@r "
END
STRINGA -1
BEGIN
KEY "riga"
PROMPT 1 5 "@b___________________________________________________________________________________________________________________________________________________@r"
END
STRINGA -1
BEGIN
KEY "Intestazione stampa"
@ -238,6 +232,12 @@ SECTION HEADER FIRST 9
PROMPT 128 8 "@bQuota non + amm.@r"
END
STRINGA -1
BEGIN
KEY "riga"
PROMPT 1 9 "@b___________________________________________________________________________________________________________________________________________________@r"
END
END // end section header first (INTESTAZIONE REGISTRO VERA E PROPRIA)
////
@ -1236,7 +1236,7 @@ SECTION BODY EVEN 17
STRINGA FR_FE_MSG6
BEGIN
KEY "Messaggio 6"
PROMPT 16 12 ""
PROMPT 16 12 "Ammortamento proporzionale al periodo di possesso"
END
STRINGA -1

View File

@ -502,7 +502,7 @@ void TStampa_prospetto::main_loop()
TString filtro;
_dataini = _mask->get_date(F_INIZIO_ES);
_datafine = _mask->get_date(F_FINE_ES);
filtro << "(CODCGRA=\"" << _mask->get(F_GRUPPO)<< "\")&&" ;
filtro << "(CODCGRA=\"" << _mask->get_int(F_GRUPPO)<< "\")&&" ;
filtro << "(CODSPA=\"" << _mask->get(F_SPECIE)<< "\")&&" ;
filtro << "(" << LF_SALCE << "->CODES=" << esercizio << ")&&" ;
filtro << "(ANSI(" << LF_CESPI << "->DTCOMP)<=" << _datafine.string(ANSI) << ")";

View File

@ -13,7 +13,7 @@
#define RICAVI 4
#define ORDINE 5
class CG0100_application : public TRelation_application
class TCausali_app : public TRelation_application
{
TMask* _msk;
TRelation *_rel;
@ -39,12 +39,12 @@ public:
virtual bool check_autorization() const
{return FALSE;}
virtual TRelation* get_relation() const {return _rel;}
CG0100_application() : _pcon_com(FALSE) {}
TCausali_app() : _pcon_com(FALSE) {}
};
HIDDEN inline CG0100_application & app() { return (CG0100_application &) main_app();}
HIDDEN inline TCausali_app & app() { return (TCausali_app &) main_app();}
int CG0100_application::read(TMask& m)
int TCausali_app::read(TMask& m)
{
const TRelation *r = get_relation();
@ -64,7 +64,7 @@ int CG0100_application::read(TMask& m)
return NOERR;
}
int CG0100_application::rewrite(const TMask& m)
int TCausali_app::rewrite(const TMask& m)
{
TString16 sez;
@ -90,7 +90,7 @@ int CG0100_application::rewrite(const TMask& m)
return err;
}
int CG0100_application::write(const TMask& m)
int TCausali_app::write(const TMask& m)
{
TString16 sez;
@ -117,14 +117,14 @@ int CG0100_application::write(const TMask& m)
}
// Controlla se puo' essere effettuata la cancellazione di un conto
void CG0100_application::on_firm_change()
void TCausali_app::on_firm_change()
{
TDir d;
d.get(LF_PCON, _nolock, _nordir, _sysdirop);
_pcon_com = d.is_com();
}
bool CG0100_application::protected_record(TRectype &rec)
bool TCausali_app::protected_record(TRectype &rec)
{
if (!_pcon_com )
{
@ -132,7 +132,7 @@ bool CG0100_application::protected_record(TRectype &rec)
TLocalisamfile& pconti = _rel->lfile();
const int gruppo = m->get_int(FLD_CM1_GRUPPO);
const int conto = m->get_int(FLD_CM1_CONTO);
const long sottoc = m->get_long(FLD_CM1_SOTTOCONTO);
const long sottoc = m->get_long(FLD_CM1_SOTTOCONTO);
// Se e' un sottoconto posso cancellarlo se non esistono saldi
if ((gruppo != 0) && (conto != 0) && (sottoc != 0))
@ -171,7 +171,7 @@ bool CG0100_application::protected_record(TRectype &rec)
return FALSE;
}
void CG0100_application::init_query_mode(TMask& m)
void TCausali_app::init_query_mode(TMask& m)
{
m.show_default();
m.hide(-3);
@ -191,11 +191,11 @@ HIDDEN bool tmcf_handler(TMask_field& f, KEY key)
return TRUE;
}
void CG0100_application::init_insert_mode(TMask& m)
void TCausali_app::init_insert_mode(TMask& m)
{
const int gruppo = atoi(m.get(FLD_CM1_GRUPPO));
const int conto = atoi(m.get(FLD_CM1_CONTO));
const long sottoc = atol(m.get(FLD_CM1_SOTTOCONTO));
const int gruppo = m.get_int(FLD_CM1_GRUPPO);
const int conto = m.get_int(FLD_CM1_CONTO);
const long sottoc = m.get_long(FLD_CM1_SOTTOCONTO);
bool ivd_enable = TRUE;
m.show_default();
@ -373,7 +373,7 @@ HIDDEN bool sottoc_handler(TMask_field& f, KEY key)
return TRUE;
}
bool CG0100_application::user_create()
bool TCausali_app::user_create()
{
_rel = new TRelation(LF_PCON);
_saldi = new TLocalisamfile(LF_SALDI);
@ -390,7 +390,7 @@ bool CG0100_application::user_create()
}
bool CG0100_application::user_destroy()
bool TCausali_app::user_destroy()
{
delete _msk;
delete _rel;
@ -400,7 +400,7 @@ bool CG0100_application::user_destroy()
int cg0100(int argc, char* argv[])
{
CG0100_application a ;
TCausali_app a ;
a.run(argc, argv, "Piano dei conti");
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -25,9 +25,9 @@
#define F_SEPARATOR 124
#define F_PICTURE 125
#define F_DACDC 126
#define F_DACDC_DES 127
#define F_DAFSC 127
#define F_ACDC 128
#define F_ACDC_DES 129
#define F_AFSC 129
#endif // __CG1500_H

View File

@ -85,9 +85,9 @@ BEGIN
PROMPT 41 5 "@bTipo stampa"
HELP "Indicare il tipo di stampa"
ITEM "1|Per date limite"
MESSAGE SHOW,F_DATALIM|SHOW,F_TOTALI|SHOW,F_CODICI|SHOW,F_SALDO|ENABLE,4@
MESSAGE SHOW,F_DATALIM|SHOW,F_TOTALI|SHOW,F_CODICI|SHOW,F_SALDO
ITEM "2|All'ultima immissione"
MESSAGE HIDE,F_DATALIM|RESET,F_DATALIM|CLEAR,4@
MESSAGE HIDE,F_DATALIM|RESET,F_DATALIM
MESSAGE SHOW,F_TOTALI|SHOW,F_CODICI|SHOW,F_SALDO
END
@ -97,9 +97,9 @@ BEGIN
//FLAGS "G"
HELP "Indicare il tipo di stampa"
ITEM "1|Per date limite"
MESSAGE SHOW,F_VERIFICA|SHOW,F_MODULO|SHOW,F_STAMPAMPROV|ENABLE,4@
MESSAGE SHOW,F_VERIFICA|SHOW,F_MODULO|SHOW,F_STAMPAMPROV
ITEM "2|All'ultima immissione"
MESSAGE SHOW,F_VERIFICA|SHOW,F_MODULO|SHOW,F_STAMPAMPROV|CLEAR,4@
MESSAGE SHOW,F_VERIFICA|SHOW,F_MODULO|SHOW,F_STAMPAMPROV
MESSAGE COPY,F_STAMPA
END
@ -168,7 +168,7 @@ END
LIST F_STAMPAMPROV 15
BEGIN
PROMPT 2 11 "Bilancio "
PROMPT 2 11 "Bilancio "
ITEM "1|Normale"
ITEM "2|Globale"
ITEM "3|Solo provvisori"
@ -176,7 +176,8 @@ END
LIST F_MODULO 1 12
BEGIN
PROMPT 2 12 "Dimensione modulo "
PROMPT 2 12 "Larghezza modulo di stampa "
HELP "Indicare il numero di caratteri del foglio (larghezza)"
ITEM "1|132 colonne"
ITEM "2|198 colonne"
@ -189,56 +190,55 @@ END
GROUPBOX DLG_NULL 73 4
BEGIN
PROMPT 2 14 "@bCentri di costo"
PROMPT 2 14 "@bCentri di costo / Commesse"
GROUP 4
END
STRING F_DACDC 20
BEGIN
PROMPT 3 15 "Da "
PROMPT 3 15 "Da CDC/Commessa "
FLAGS "UZ"
USE CMS
INPUT CODTAB F_DACDC
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@70" S0
OUTPUT F_DACDC CODTAB
OUTPUT F_DACDC_DES S0
CHECKTYPE SEARCH
GROUP 4
END
STRING F_DACDC_DES 70 41
STRING F_DAFSC 10
BEGIN
PROMPT 30 15 ""
USE CMS KEY 2
INPUT S0 F_DACDC_DES
DISPLAY "Descrizione@70" S0
DISPLAY "Codice@20" CODTAB
COPY OUTPUT F_DACDC
PROMPT 50 15 "Da Fase "
USE FSC
INPUT CODTAB F_DAFSC
DISPLAY "Codice@10" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_DAFSC CODTAB
CHECKTYPE SEARCH
GROUP 4
END
STRING F_ACDC 20
BEGIN
PROMPT 3 16 "A "
PROMPT 3 16 "A CDC/Commessa "
FLAGS "UZ"
COPY USE F_DACDC
INPUT CODTAB F_ACDC
COPY DISPLAY F_DACDC
OUTPUT F_ACDC CODTAB
OUTPUT F_ACDC_DES S0
CHECKTYPE SEARCH
GROUP 4
END
STRING F_ACDC_DES 70 41
STRING F_AFSC 10
BEGIN
PROMPT 30 16 ""
COPY USE F_DACDC_DES
INPUT S0 F_ACDC_DES
COPY DISPLAY F_DACDC_DES
COPY OUTPUT F_ACDC
PROMPT 50 16 "A Fase "
FLAGS "UZ"
COPY USE F_DAFSC
INPUT CODTAB F_AFSC
COPY DISPLAY F_DAFSC
OUTPUT F_AFSC CODTAB
CHECKTYPE SEARCH
GROUP 4
END

View File

@ -112,6 +112,8 @@ TMask* TPrimanota_application::load_mask(int n)
{
ism.hide(111); ism.hide(112);
is.delete_column(112); is.delete_column(111);
for (short id = 155; id <= 157; id++)
ism.hide(id); // Descrizioni commessa e fase
}
// Se esiste lo sheet delle rate
@ -162,6 +164,7 @@ TMask* TPrimanota_application::load_mask(int n)
cgm.set_handler(CG_DARE, dareavere_handler);
cgm.set_handler(CG_AVERE, dareavere_handler);
cgm.set_handler(CG_TIPO, cg_tipo_handler);
cgm.set_handler(CG_GRUPPO, cg_gruppo_handler);
cgm.set_handler(CG_CONTO, cg_conto_handler);
cgm.set_handler(CG_SOTTOCONTO, suspended_handler);
@ -179,6 +182,8 @@ TMask* TPrimanota_application::load_mask(int n)
{
cgm.hide(CG_COMMESSA); cgm.hide(CG_FASE);
cg.delete_column(CG_FASE); cg.delete_column(CG_COMMESSA);
for (short id = 155; id <= 157; id++)
cgm.hide(id); // Descrizioni commessa e fase
}
}
break;
@ -280,8 +285,8 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
TSheet_field& cgsheet = (TSheet_field&)m->field(F_SHEETCG);
TMask& cgm = cgsheet.sheet_mask();
cgm.set_handler(100, show_games ? showpartite_handler : NULL); // bottoncino riga
cgm.enable(100, show_games);
cgm.set_handler(DLG_USER, show_games ? showpartite_handler : NULL); // bottoncino riga
cgm.enable(DLG_USER, show_games);
if (iva == nessuna_iva)
{
m->enable(F_PROVVISORIO, !_is_saldaconto); // Il saldaconto vieta i movimenti provvisori

View File

@ -354,7 +354,7 @@ BEGIN
ITEM "Co./c@3"
ITEM "Sott./c@6"
ITEM "Descrizione contropartita@30"
ITEM "Commessa@20"
ITEM "CDC / Commessa@20"
ITEM "Fase@10"
ITEM "Tipo@4"
END

View File

@ -618,7 +618,7 @@ BEGIN
ITEM "Co."
ITEM "Sottoc.@6"
ITEM "Descrizione Conto@30"
ITEM "Commessa@20"
ITEM "CDC/Commessa@20"
ITEM "Fase@10"
END
@ -651,7 +651,7 @@ BEGIN
ITEM "Co./c@3"
ITEM "Sott./c@6"
ITEM "Descrizione contropartita@30"
ITEM "Commessa@20"
ITEM "CDC/Commessa@20"
ITEM "Fase@10"
ITEM "Tipo@4"
END

View File

@ -388,10 +388,13 @@ void TPrimanota_application::disable_cgs_cells(int n, char tipo)
needs_update = TRUE;
}
if (cg.cell_disabled(n, 5)) // Se disabilito il sottoconto alloro spengo anche le commesse
// Se disabilito il sottoconto alloro spengo anche le commesse
if (cg.cell_disabled(n, 5))
{
cg.disable_cell(n, CG_COMMESSA); // Commessa
cg.disable_cell(n, CG_FASE); // Fase
cg.disable_cell(n, CG_COMMESSA); // Commessa
cg.disable_cell(n, CG_FASE); // Fase
needs_update = TRUE;
}
COLOR back_color, fore_color;
@ -528,45 +531,37 @@ bool TPrimanota_application::ci_sono_importi() const
real TPrimanota_application::calcola_saldo() const
{
real tdare, tavere;
TImporto saldaconto;
TImporto importo, bilancio, saldaconto;
const bool pag = is_pagamento() && !_as400;
TString_array& rows = cgs().rows_array();
const int max = rows.items();
for (int i = 0; i < max; i++)
for (int i = rows.items()-1; i >= 0; i--)
{
TToken_string& r = rows.row(i);
const real dare(r.get(0));
const real avere(r.get());
tdare += dare;
tavere += avere;
TToken_string& r = rows.row(i);
importo = r;
bilancio += importo;
if (pag)
{
const char tipo = row_type(r);
if (strchr("ACGKP", tipo) != NULL) // Abbuoni attivi, differenze cambio,
{ // spese, clienti/fornitori, abbuoni passivi
const char sez = dare.is_zero() ? 'A' : 'D';
const TImporto importo(sez, sez == 'A' ? avere : dare);
saldaconto += importo;
}
}
}
TMask& m = curr_mask();
const real sbilancio = abs(tdare)-abs(tavere);
const real absbilancio = abs(tdare - tavere);
switch (sbilancio.sign())
bilancio.normalize();
const real& sbil = bilancio.valore();
const char sez = bilancio.is_zero() ? 'Z' : bilancio.sezione();
switch (sez)
{
case +1: // Il dare supera l'avere in valore assoluto
m.set(F_DARE, absbilancio);
case 'D':
m.set(F_DARE, sbil);
m.reset(F_AVERE);
break;
case -1: // L'avere supera il dare in valore assoluto
case 'A':
m.reset(F_DARE);
m.set(F_AVERE, absbilancio);
m.set(F_AVERE, sbil);
break;
default: // Sbilancio nullo
m.reset(F_DARE);
@ -584,7 +579,7 @@ real TPrimanota_application::calcola_saldo() const
m.set(K_RESIDUO, totdoc.valore().string());
}
return sbilancio;
return sbil;
}
HIDDEN bool imptot_error(const TImporto& imptot, const TImporto& impsal, bool val)
@ -598,13 +593,10 @@ HIDDEN bool imptot_error(const TImporto& imptot, const TImporto& impsal, bool va
{
TPrimanota_application& a = app();
const TMask& m = a.curr_mask();
const char* pic = ".";
TString16 codval;
if (val)
{
codval = m.get(SK_VALUTA);
pic = ".3";
}
TCurrency euro(imptot.valore(), codval);
TString msg(255);
@ -613,11 +605,11 @@ HIDDEN bool imptot_error(const TImporto& imptot, const TImporto& impsal, bool va
msg << "in valuta " << codval;
else
msg << "inserito";
msg << " e' " << euro.get_num().string(pic) << ' ' << imptot.sezione() << ",\n";
msg << " e' " << euro.string(TRUE) << ' ' << imptot.sezione() << ",\n";
euro.set_num(cassa.valore());
msg << "i pagamenti e le spese ammontano a "
<< euro.get_num().string(pic) << ' ' << cassa.sezione() << ",\n";
<< euro.string(TRUE) << ' ' << cassa.sezione() << ",\n";
euro.set_num(residuo.valore());
msg << "per cui il residuo e' " << euro.string(TRUE);
@ -1074,7 +1066,7 @@ bool TPrimanota_application::descr_handler(TMask_field& f, KEY k)
{
TSheet_field& cg = app().cgs();
const TString80 old = cg.row(first).get(8);
if (old.blank())
if (old.blank() || f.get().find(old) >= 0)
{
cg.row(first).add(f.get(), 8);
cg.force_update(first);
@ -1500,16 +1492,16 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
}
TImporto newimp = a.real2imp(imponibile, 'I');
newimp.normalize();
// Aggiorna conto sulla riga contabile
if (newpos < 0)
{
TString descr;
TString saved_descr;
if (delimp >= 0)
{
TSheet_field& s = a.cgs();
descr = s.row(delimp).get(8); // Memorizza vecchia descrizione
saved_descr = s.row(delimp).get(8); // Memorizza vecchia descrizione
a.reset_cgs_row(delimp); // Cancella vecchia riga
if (deliva > delimp) deliva--;
}
@ -1518,6 +1510,7 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
if (descr.blank())
descr = cau.desc_agg(2);
newpos = a.set_cgs_row(-1, newimp, conto, descr, 'I', conto.commessa(), conto.fase());
}
}
else
@ -1528,6 +1521,14 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
a.reset_cgs_row(newpos);
newpos = -1;
}
else
{
if (delimp >= 0 && delimp != newpos)
{
a.reset_cgs_row(delimp); // Cancella vecchia riga
if (deliva > delimp) deliva--;
}
}
}
oldimp = newimp;
oldpos = newpos;
@ -1644,6 +1645,23 @@ bool TPrimanota_application::iva_handler(TMask_field& f, KEY k)
return TRUE;
}
bool TPrimanota_application::cg_tipo_handler(TMask_field& f, KEY key)
{
if (key == K_TAB && f.focusdirty() || key == K_ENTER)
{
TMask& m = f.mask();
const bool on = f.get().blank() && m.field(CG_SOTTOCONTO).active();
if (!on)
{
m.reset(CG_COMMESSA);
m.reset(CG_FASE);
}
m.enable(CG_COMMESSA, on);
m.enable(CG_FASE, on);
}
return TRUE;
}
// Il gruppo non possiede una ricerca propria per cui se viene variato richiama
// quella del conto.
bool TPrimanota_application::cg_gruppo_handler(TMask_field& f, KEY key)
@ -1737,7 +1755,7 @@ bool TPrimanota_application::sheet_clifo_handler(TMask_field& f, KEY k)
m.set(gid, c.gruppo());
m.set(cid, c.conto());
}
}
}
}
}
return TRUE;
@ -1834,7 +1852,7 @@ bool TPrimanota_application::caus_query_handler(TMask_field& f, KEY key)
if (f.to_check(key))
{
const TString cau = f.get();
const TString8 cau = f.get();
const int ann = m.get_int(F_ANNOIVA);
const TipoIVA i = app().cau2IVA(cau, ann); // Cerca causale e suo tipo
@ -1979,7 +1997,7 @@ bool TPrimanota_application::datareg_handler(TMask_field& f, KEY key)
}
// Handler of the F_DATACOMP field on the modify mask
// Certified 90%
// Certified 98%
bool TPrimanota_application::datacomp_handler(TMask_field& f, KEY key)
{
TMask& m = f.mask();
@ -2005,6 +2023,22 @@ bool TPrimanota_application::datacomp_handler(TMask_field& f, KEY key)
{
m.set(F_ANNOES, ae, TRUE); // Aggiorna anno esercizio in entrambe le pagine
data = "di competenza";
if (dc > dr)
{
bool ok = FALSE;
const TString& ca = m.get(F_CODCAUS);
if (ca.not_empty())
{
TConfig ini(CONFIG_DITTA, "cg");
const TString& ra = ini.get("RrCcRa");
const TString& ri = ini.get("RrCcRi");
ok = (ca == ra) || (ca == ri); // Se' e' una causale Ratei o Risconti
}
if (!ok)
return f.error_box("La data di competenza non può superare la data di registrazione");
}
}
if (ae)
@ -2855,4 +2889,3 @@ bool TPrimanota_application::solaiva_handler(TMask_field& f, KEY key)
}
return TRUE;
}

View File

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

View File

@ -1,13 +1,13 @@
PAGE "RIGA PRIMA NOTA" -1 -1 67 16
PAGE "RIGA PRIMA NOTA" -1 -1 67 18
GROUPBOX DLG_NULL 66 3
BEGIN
PROMPT 1 1 "Descrizione"
PROMPT 1 0 "@bDescrizione riga"
END
STRING 108 5
BEGIN
PROMPT 2 2 ""
PROMPT 2 1 ""
FLAGS "UZ"
USE %DPN
INPUT CODTAB 108
@ -20,7 +20,7 @@ END
STRING CG_DESCR 50
BEGIN
PROMPT 12 2 ""
PROMPT 12 1 ""
USE %DPN KEY 2
INPUT S0 109
DISPLAY "Descrizione@50" S0
@ -31,22 +31,22 @@ END
GROUPBOX DLG_NULL 66 5
BEGIN
PROMPT 1 4 "Conto principale"
PROMPT 1 3 "@bConto principale"
END
CURRENCY CG_DARE 18
BEGIN
PROMPT 2 5 "Dare "
PROMPT 2 4 "Dare "
END
CURRENCY CG_AVERE 18
BEGIN
PROMPT 38 5 "Avere "
PROMPT 38 4 "Avere "
END
LIST CG_TIPO 1 10
BEGIN
PROMPT 2 6 "Tipo "
PROMPT 2 5 "Tipo "
FLAGS "U"
ITEM " |Conto" MESSAGE SHOW,106|HIDE,206|HIDE,306|SHOW,107|HIDE,207|HIDE,307
ITEM "C|Cliente" MESSAGE SHOW,206|HIDE,106|HIDE,306|SHOW,207|HIDE,107|HIDE,307
@ -55,13 +55,13 @@ END
NUMBER CG_GRUPPO 3
BEGIN
PROMPT 20 6 "Gruppo "
PROMPT 20 5 "Gruppo "
FIELD GRUPPO
END
NUMBER CG_CONTO 3
BEGIN
PROMPT 32 6 "Conto "
PROMPT 32 5 "Conto "
FIELD CONTO
USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="")
INPUT GRUPPO 104
@ -82,7 +82,7 @@ END
NUMBER CG_SOTTOCONTO 6
BEGIN
PROMPT 45 6 "Sottoconto "
PROMPT 45 5 "Sottoconto "
FIELD SOTTOCONTO
USE LF_PCON SELECT SOTTOCONTO!=""
INPUT GRUPPO 104
@ -103,7 +103,7 @@ END
NUMBER 206 6
BEGIN
PROMPT 45 6 "Cliente "
PROMPT 45 5 "Cliente "
FIELD SOTTOCONTO
USE LF_CLIFO
INPUT TIPOCF "C"
@ -122,7 +122,7 @@ END
NUMBER 306 6
BEGIN
PROMPT 45 6 "Fornitore "
PROMPT 45 5 "Fornitore "
FIELD SOTTOCONTO
USE LF_CLIFO
INPUT TIPOCF "F"
@ -142,7 +142,7 @@ END
STRING 107 50
BEGIN
PROMPT 2 7 "Descriz. "
PROMPT 2 6 "Descriz. "
FIELD DESCRCONTO
USE LF_PCON KEY 2
INPUT DESCR 107
@ -158,7 +158,7 @@ END
STRING 207 50
BEGIN
PROMPT 2 7 "Cliente "
PROMPT 2 6 "Cliente "
FIELD LF_CLIFO->RAGSOC
USE LF_CLIFO KEY 2
INPUT TIPOCF "C"
@ -176,7 +176,7 @@ END
STRING 307 50
BEGIN
PROMPT 2 7 "Fornitore "
PROMPT 2 6 "Fornitore "
FIELD LF_PCON->SOTTOCONTO
USE LF_CLIFO KEY 2
INPUT TIPOCF "F"
@ -194,12 +194,12 @@ END
GROUPBOX DLG_NULL 66 4
BEGIN
PROMPT 1 9 "Contropartita"
PROMPT 1 8 "@bContropartita"
END
LIST 110 1 10
BEGIN
PROMPT 2 10 "Tipo "
PROMPT 2 9 "Tipo "
FLAGS "U"
ITEM " |Conto" MESSAGE SHOW,113|HIDE,213|HIDE,313|SHOW,114|HIDE,214|HIDE,314
ITEM "C|Cliente" MESSAGE SHOW,213|HIDE,113|HIDE,313|SHOW,214|HIDE,114|HIDE,314
@ -208,13 +208,13 @@ END
NUMBER 111 3
BEGIN
PROMPT 20 10 "Gruppo "
PROMPT 20 9 "Gruppo "
FIELD GRUPPOC
END
NUMBER 112 3
BEGIN
PROMPT 32 10 "Conto "
PROMPT 32 9 "Conto "
FIELD CONTOC
COPY USE 105
INPUT GRUPPO 111
@ -232,7 +232,7 @@ END
NUMBER 113 6
BEGIN
PROMPT 45 10 "Sottoconto "
PROMPT 45 9 "Sottoconto "
FIELD SOTTOCONTC
COPY USE 106
COPY INPUT 112
@ -247,7 +247,7 @@ END
NUMBER 213 6
BEGIN
PROMPT 45 10 "Cliente "
PROMPT 45 9 "Cliente "
FIELD SOTTOCONTC
COPY USE 206
INPUT TIPOCF "C"
@ -261,7 +261,7 @@ END
NUMBER 313 6
BEGIN
PROMPT 45 10 "Fornitore "
PROMPT 45 9 "Fornitore "
FIELD SOTTOCONTC
COPY USE 306
INPUT TIPOCF "F"
@ -275,7 +275,7 @@ END
STRING 114 50
BEGIN
PROMPT 2 11 "Descriz. "
PROMPT 2 10 "Descriz. "
FIELD DESCRCONTOC
COPY USE 107
INPUT DESCR 114
@ -287,7 +287,7 @@ END
STRING 214 50
BEGIN
PROMPT 2 11 "Cliente "
PROMPT 2 10 "Cliente "
FIELD DESCRCONTOC
COPY USE 207
INPUT TIPOCF "C"
@ -301,7 +301,7 @@ END
STRING 314 50
BEGIN
PROMPT 2 11 "Fornitore "
PROMPT 2 10 "Fornitore "
FIELD DESCRCONTOC
COPY USE 307
INPUT TIPOCF "F"
@ -313,33 +313,62 @@ BEGIN
WARNING "Fornitore inesistente sulla riga contabile"
END
GROUPBOX 155 66 4
BEGIN
PROMPT 1 12 "@bCentro di costo / Commessa"
END
STRING CG_COMMESSA 20
BEGIN
PROMPT 2 13 "Commessa "
PROMPT 2 13 "Codice "
FLAGS "UZ"
USE CMS
INPUT CODTAB CG_COMMESSA
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT CG_COMMESSA CODTAB
OUTPUT 156 S0
CHECKTYPE NORMAL
END
STRING 156 50 30
BEGIN
PROMPT 32 13 ""
USE CMS KEY 2
INPUT S0 156
DISPLAY "Descrizione@50" S0
DISPLAY "Codice@20" CODTAB
COPY OUTPUT CG_COMMESSA
CHECKTYPE NORMAL
END
STRING CG_FASE 10
BEGIN
PROMPT 36 13 "Fase "
PROMPT 2 14 "Fase "
FLAGS "UZ"
USE FSC
INPUT CODTAB CG_FASE
DISPLAY "Codice@10" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT CG_FASE CODTAB
OUTPUT 157 S0
CHECKTYPE NORMAL
END
STRING 157 50 30
BEGIN
PROMPT 32 14 ""
USE FSC KEY 2
INPUT S0 157
DISPLAY "Descrizione@50" S0
DISPLAY "Codice@20" CODTAB
COPY OUTPUT CG_FASE
CHECKTYPE NORMAL
END
LIST CG_ROWTYPE 24
BEGIN
PROMPT 26 14 "Tipo riga "
PROMPT 28 16 "Tipo riga "
ITEM " |Sola contabilita'"
ITEM "A|Abbuoni attivi"
ITEM "C|Differenza cambi"
@ -377,7 +406,7 @@ BEGIN
MESSAGE EXIT,K_DEL
END
BUTTON 100 9 2
BUTTON DLG_USER 10 2
BEGIN
PROMPT -44 -1 "~Partite"
END

View File

@ -1,4 +1,4 @@
PAGE "RIGA IVA" -1 -1 78 13
PAGE "RIGA IVA" -1 -1 78 16
GROUPBOX DLG_NULL 76 5
BEGIN
@ -235,26 +235,56 @@ BEGIN
HELP "Tipo Costo/Ricavo del conto"
END
GROUPBOX 155 76 4
BEGIN
PROMPT 1 11 "@bCentro di costo / Commessa"
END
STRING 111 20
BEGIN
PROMPT 2 11 "Commessa "
PROMPT 2 12 "Codice "
FLAGS "UZ"
USE CMS
INPUT CODTAB 111
DISPLAY "Codice@20" CODTAB
DISPLAY "Decrizione@50" S0
OUTPUT 111 CODTAB
OUTPUT 156 S0
CHECKTYPE NORMAL
END
STRING 156 50 40
BEGIN
PROMPT 32 12 ""
USE CMS KEY 2
INPUT S0 156
DISPLAY "Descrizione@50" S0
DISPLAY "Codice@20" CODTAB
COPY OUTPUT 111
CHECKTYPE NORMAL
END
STRING 112 10
BEGIN
PROMPT 36 11 "Fase "
PROMPT 2 13 "Fase "
FLAGS "UZ"
USE FSC
INPUT CODTAB 112
DISPLAY "Codice@10" CODTAB
DISPLAY "Decrizione@50" S0
OUTPUT 112 CODTAB
CHECKTYPE NORMAL
END
STRING 157 50 40
BEGIN
PROMPT 32 13 ""
USE FSC KEY 2
INPUT S0 157
DISPLAY "Descrizione@50" S0
DISPLAY "Codice@20" CODTAB
COPY OUTPUT 112
CHECKTYPE NORMAL
END
BUTTON DLG_OK 10 2

View File

@ -3,6 +3,7 @@
//
#include <currency.h>
#include <mask.h>
#include <modaut.h>
#include <printapp.h>
#include <recarray.h>
#include <tabutil.h>
@ -70,6 +71,8 @@ class TListaMov_application : public TPrintapp
friend bool annoes_handler(TMask_field&, KEY);
friend bool data_inizio (TMask_field&, KEY);
friend bool data_fine (TMask_field&, KEY);
static bool cdc_handler (TMask_field& f, KEY k);
TRigaiva_array _c;
TTable * _tabiva, * _tabtpd, * _tabreg, * _tabes;
@ -105,8 +108,8 @@ class TListaMov_application : public TPrintapp
liste _tipo_lista;
word _flags;
char _tipoc;
TString _cdc;
bool _cdc_only;
TString _cdc, _fsc;
bool _cdc_only, _print_cdc;
TDecoder _simbval, _descdoc;
protected:
@ -145,6 +148,7 @@ public:
const TString& DescrDoc(const char* cod);
const TString& cdc() const { return _cdc; }
const TString& fsc() const { return _fsc; }
TListaMov_application(char tipost);
virtual ~TListaMov_application() {}
@ -239,6 +243,25 @@ bool data_fine(TMask_field& f, KEY k)
return TRUE;
}
bool TListaMov_application::cdc_handler(TMask_field& f, KEY k)
{
if (k == K_TAB)
{
TMask& m = f.mask();
const bool on = !(m.field(F_DACDC).empty() && m.field(F_ACDC).empty());
if (!on)
{
m.reset(F_DAFASE);
m.reset(F_AFASE);
m.reset(F_CDC_ONLY);
}
m.enable(F_DAFASE, on);
m.enable(F_AFASE, on);
m.enable(F_CDC_ONLY, on);
}
return TRUE;
}
bool TListaMov_application::RicercaDoc(const char * tipo)
{
TTable tab_tpd(TAB_TPD);
@ -449,6 +472,7 @@ bool cdc_filter(const TRelation* rel)
const TRecnotype oldpos = rmov.recno();
const long numreg = rel->curr(LF_MOV).get_long(MOV_NUMREG);
const TString& cdc = app().cdc();
const TString& fsc = app().fsc();
rmov.zero();
rmov.put(RMV_NUMREG, numreg);
rmov.put(RMV_NUMRIG, 1);
@ -457,9 +481,13 @@ bool cdc_filter(const TRelation* rel)
if (rmov.get_long(RMV_NUMREG) != numreg)
break;
if (rmov.get(RMV_CODCMS) == cdc)
{
ok = TRUE;
break;
{
if (fsc.not_empty())
ok = (rmov.get(RMV_FASCMS) == fsc);
else
ok = TRUE;
if (ok)
break;
}
}
rmov.readat(oldpos);
@ -748,6 +776,9 @@ void TListaMov_application::stampa_errori_mov()
void TListaMov_application::set_page(int file, int count)
{
TString riga_commessa(132);
riga_commessa.cut(0);
switch (_tipo_lista)
{
case movimenti:
@ -756,13 +787,27 @@ void TListaMov_application::set_page(int file, int count)
if (file == LF_RMOV)
{
_nr = 1;
const TRectype& rec = current_cursor()->curr(LF_RMOV);
if (_cdc.not_empty())
{
const TRectype& rec = current_cursor()->curr(LF_RMOV);
if (rec.get(RMV_CODCMS) == _cdc)
{
if (!_cdc_only)
set_row(_nr,"@0g@b"); // Grassettiamo le righe interessate
{
if (_fsc.not_empty())
{
if (rec.get(RMV_FASCMS) == _fsc)
{
if (!_cdc_only)
set_row(_nr,"@0g@b"); // Grassettiamo le righe interessate
}
else
{
if (_cdc_only)
return;
}
}
else
if (!_cdc_only)
set_row(_nr,"@0g@b"); // Grassettiamo le righe interessate
}
else
{
@ -781,6 +826,26 @@ void TListaMov_application::set_page(int file, int count)
set_row(_nr,"@90g@n",FLD(LF_RMOV,RMV_IMPORTO));
else
set_row(_nr,"@110g@n",FLD(LF_RMOV,RMV_IMPORTO));
if (_print_cdc)
{
riga_commessa.cut(0);
TString80 cms = rec.get(RMV_CODCMS);
if (cms.not_empty())
{
riga_commessa = cms; riga_commessa.left_just(132);
riga_commessa.overwrite(cache().get("CMS", cms, "S0"), 21);
cms = rec.get(RMV_FASCMS);
if (cms.not_empty())
{
riga_commessa.overwrite(cms, 72);
riga_commessa.overwrite(cache().get("FSC", cms, "S0"), 93);
}
}
if (riga_commessa.not_empty())
{
set_row (++_nr, riga_commessa);
}
}
}
else if (file == LF_MOV)
{
@ -1343,23 +1408,26 @@ print_action TListaMov_application::postprocess_page(int file,int count)
_tot_dare_giornaliero += _tot_dare;
//stampa i totali giornalieri
if ( FINITO ||
(_datareg != datarec)||(_numreg == _numreg_fin))
if (!_cdc_only)
{
if (( _scelta_stampa == 0 && _controllo_mov_errati != 1 && _decidi == 2) || (_scelta_stampa == 1 && _decidi == 2))
{
set_row(n, "@b@60gTotali del giorno %s", _datareg.string());
set_row(n++, "@b@90g%r %r", &_tot_dare_giornaliero, &_tot_avere_giornaliero);
_tot_avere_giornaliero = 0;
_tot_dare_giornaliero = 0;
}
if ((_scelta_stampa == 0 && _controllo_mov_errati != 1 && FINITO) || (_scelta_stampa == 1 && FINITO))
{
set_row(n++,"");
set_row(n, "@b@60gTotale generale");
set_row(n++, "@b@90g%r %r", &_tot_dare_generale, &_tot_avere_generale);
}
}
if ( FINITO ||
(_datareg != datarec)||(_numreg == _numreg_fin))
{
if (( _scelta_stampa == 0 && _controllo_mov_errati != 1 && _decidi == 2) || (_scelta_stampa == 1 && _decidi == 2))
{
set_row(n, "@b@60gTotali del giorno %s", _datareg.string());
set_row(n++, "@b@90g%r %r", &_tot_dare_giornaliero, &_tot_avere_giornaliero);
_tot_avere_giornaliero = 0;
_tot_dare_giornaliero = 0;
}
if ((_scelta_stampa == 0 && _controllo_mov_errati != 1 && FINITO) || (_scelta_stampa == 1 && FINITO))
{
set_row(n++,"");
set_row(n, "@b@60gTotale generale");
set_row(n++, "@b@90g%r %r", &_tot_dare_generale, &_tot_avere_generale);
}
}
}
if (n == 1)
{
@ -2069,14 +2137,25 @@ bool TListaMov_application::set_print(int)
}
TMask msk(masc);
msk.set_handler(F_ANNO, annoes_handler);
if (main_app().has_module(CMAUT))
msk.show(-4);
else
{
msk.hide(-4);
msk.reset(-4);
}
msk.set_handler(F_ANNO, annoes_handler);
msk.set_handler(F_DATAINI, data_inizio);
msk.set_handler(F_DATAFIN, data_fine);
msk.set_handler(F_DACDC, cdc_handler);
msk.set_handler(F_ACDC, cdc_handler);
while (msk.run() == K_ENTER)
{
_print_cdc = msk.get_bool(F_PRINTCDC);
if (msk.get(F_DACDC).not_empty() || msk.get(F_ACDC).not_empty())
{
_cdc_only = msk.get_bool(F_CDC_ONLY);
_cdc_only = msk.get_bool(F_CDC_ONLY);
TRelation rel("CMS");
TRectype darec(rel.curr()), arec(rel.curr());
darec.put("CODTAB", msk.get(F_DACDC));
@ -2084,20 +2163,43 @@ bool TListaMov_application::set_print(int)
TCursor cur(&rel, "", 1, &darec, &arec);
const long items = cur.items();
cur.freeze();
TRelation fscrel("FSC");
TRectype da_fsc(fscrel.curr()), a_fsc(fscrel.curr());
da_fsc.put("CODTAB", msk.get(F_DAFASE));
a_fsc.put("CODTAB", msk.get(F_AFASE));
TCursor fsccur(&fscrel, "", 1, &da_fsc, &a_fsc);
const TRecnotype fsc_items = fsccur.items();
fsccur.freeze();
for (cur = 0L; cur.pos() < items; ++cur)
{
_cdc = rel.curr().get("CODTAB");
imposta_parametri_stampa(msk);
print();
if (!da_fsc.empty() || !a_fsc.empty())
{
for (fsccur = 0L; fsccur.pos() < fsc_items; ++fsccur)
{
_fsc = fsccur.curr().get("CODTAB");
imposta_parametri_stampa(msk);
print();
}
}
else
{
_fsc.cut(0);
imposta_parametri_stampa(msk);
print();
}
}
}
else
{
_cdc_only = FALSE;
_cdc.cut(0);
_cdc.cut(0); _fsc.cut(0);
imposta_parametri_stampa(msk);
print();
}
msk.reset(-5);
}
return FALSE;
}
@ -2302,11 +2404,26 @@ void TListaMov_application::init_print(const TMask& msk)
void TListaMov_application::set_cdc_header(int& soh)
{
if (_cdc.not_empty())
{
const TString& desc_cdc = cache().get("CMS", _cdc, "S0");
if (_fsc.not_empty())
{
const TString& desc_fsc = cache().get("FSC", _fsc, "S0");
set_header(++soh, "@bCommessa %s %s - Fase %s %s",
(const char*)_cdc, (const char*)desc_cdc,
(const char*)_fsc, (const char*)desc_fsc);
}
else
set_header(++soh, "@bCommessa %s %s", (const char*)_cdc, (const char*)desc_cdc);
}
/*
if (_cdc.not_empty())
{
TString str;
str.cut(0) << "@bCommessa " << _cdc << " - " << cache().get("CMS", _cdc, "S0");
set_header(++soh, str);
}
}
*/
}
void TListaMov_application::preprocess_header()
@ -2449,6 +2566,7 @@ void TListaMov_application::preprocess_header()
else
set_header (soh++, "@86gtutte le causali");
set_cdc_header(soh);
soh++;
sep.fill('_');
set_header (soh++, (const char *) sep);
set_header (soh, "Rg Cod Causale@30gDescrizione@56gCodice conto@71gDescrizione conto@103gDare@120gAvere@130gSB");

View File

@ -34,10 +34,11 @@
#define F_RAGSOCFIN1 130
#define F_SEPARATOR 131
#define F_DACDC 132
#define F_DACDC_DES 133
#define F_ACDC 134
#define F_ACDC_DES 135
#define F_CDC_ONLY 136
#define F_ACDC 133
#define F_CDC_ONLY 134
#define F_DAFASE 135
#define F_AFASE 136
#define F_PRINTCDC 137
#define ST_DATA 0x0001
#define ST_NUMERO 0x0002

View File

@ -90,6 +90,7 @@ BEGIN
GROUP 1
PROMPT 20 8 "Anno di competenza "
HELP "Indicare se stampa l'anno di competenza"
GROUP 5
END
BOOLEAN F_ALLEGATO
@ -99,6 +100,7 @@ BEGIN
HELP "Indicare se stampare l'allegato IVA"
MESSAGE TRUE DISABLE,F_STAMPA|COPY,F_STAMPA
MESSAGE FALSE ENABLE,F_STAMPA
GROUP 5
END
RADIOBUTTON F_DECIDI 12
@ -215,6 +217,7 @@ BOOLEAN F_STAMPA
BEGIN
PROMPT 2 16 "Stampa imponibili, imposte e codici iva "
HELP "Indicare se stampare i valori degli imponibili, delle imposte e i codici IVA"
GROUP 5
END
LIST F_STAMPAMOVP 16
@ -225,65 +228,72 @@ BEGIN
ITEM "3|Solo provvisori"
END
GROUPBOX DLG_NULL 71 4
GROUPBOX DLG_NULL 71 5
BEGIN
PROMPT 2 18 "@bCentri di costo"
PROMPT 2 18 "@bCDC / Commesse"
GROUP 4
END
BOOLEAN F_CDC_ONLY
BOOLEAN F_PRINTCDC
BEGIN
PROMPT 22 18 "Stampa solo le righe relative ai centri di costo"
PROMPT 22 18 "Stampa CDC/Commessa e fase relativa ad ogni riga"
GROUP 4 5
END
STRING F_DACDC 20
BEGIN
PROMPT 3 19 "Da "
PROMPT 3 19 "Da CDC/Commessa "
FLAGS "UZ"
USE CMS
INPUT CODTAB F_DACDC
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@70" S0
OUTPUT F_DACDC CODTAB
OUTPUT F_DACDC_DES S0
CHECKTYPE SEARCH
GROUP 4
GROUP 4 5
END
STRING F_DACDC_DES 70 39
STRING F_DAFASE 10
BEGIN
PROMPT 30 19 ""
USE CMS KEY 2
INPUT S0 F_DACDC_DES
DISPLAY "Descrizione@70" S0
PROMPT 50 19 "Da fase "
FLAGS "UZ"
USE FSC
INPUT CODTAB F_DAFASE
DISPLAY "Codice@20" CODTAB
COPY OUTPUT F_DACDC
DISPLAY "Descrizione@70" S0
OUTPUT F_DAFASE CODTAB
CHECKTYPE SEARCH
GROUP 4
GROUP 4 5
END
STRING F_ACDC 20
BEGIN
PROMPT 3 20 "A "
PROMPT 3 20 "A CDC/Commessa "
FLAGS "UZ"
COPY USE F_DACDC
INPUT CODTAB F_ACDC
COPY DISPLAY F_DACDC
OUTPUT F_ACDC CODTAB
OUTPUT F_ACDC_DES S0
CHECKTYPE SEARCH
GROUP 4
GROUP 4 5
END
STRING F_ACDC_DES 70 39
STRING F_AFASE 10
BEGIN
PROMPT 30 20 ""
COPY USE F_DACDC_DES
INPUT S0 F_ACDC_DES
COPY DISPLAY F_DACDC_DES
COPY OUTPUT F_ACDC
PROMPT 50 20 "A fase "
FLAGS "UZ"
COPY USE F_DAFASE
INPUT CODTAB F_AFASE
COPY DISPLAY F_DAFASE
OUTPUT F_AFASE CODTAB
CHECKTYPE SEARCH
GROUP 4
GROUP 4 5
END
BOOLEAN F_CDC_ONLY
BEGIN
PROMPT 3 21 "Stampa solo le righe relative a CDC/Commesse "
GROUP 4 5
END
ENDPAGE

View File

@ -73,6 +73,7 @@ class TMastrini_application : public TPrintapp
static bool contof_hnd (TMask_field& f, KEY k);
static bool sottoc_handler_ini (TMask_field& f, KEY k);
static bool sottoc_handler_fine (TMask_field& f, KEY k);
static bool cdc_handler (TMask_field& f, KEY k);
static bool memorizza_handler(TMask_field& f, KEY k);
static bool scelte_notify(TSheet_field& s, int r, KEY k);
@ -130,10 +131,11 @@ class TMastrini_application : public TPrintapp
int _rw, _conta_mastrini, _indice_array, _item, _item_lista, _indice_lista;
int _ddociva_len;
bool _noseparator;
bool _noseparator, _print_cdc;
TString _real_picture;
TString _cdc;
real _totale_commessa_dare, _totale_commessa_avere, _saldo_commessa;
@ -269,6 +271,23 @@ void TMastrini_application::process_link(int id, const char* txt)
pn.run();
}
bool TMastrini_application::cdc_handler(TMask_field& f, KEY k)
{
if (k == K_TAB)
{
TMask& m = f.mask();
const bool on = !(m.field(F_DACDC).empty() && m.field(F_ACDC).empty());
if (!on)
{
m.reset(F_DAFSC);
m.reset(F_AFSC);
}
m.enable(F_DAFSC, on);
m.enable(F_AFSC, on);
}
return TRUE;
}
bool TMastrini_application::sottoc_handler_ini(TMask_field& f, KEY key)
{
const TMask& m = f.mask();
@ -617,7 +636,7 @@ bool TMastrini_application::check_ordine(TMask_field& f, KEY k)
return TRUE;
}
bool TMastrini_application::memorizza_handler(TMask_field& f, KEY k)
{
if (k == K_SPACE)
@ -667,8 +686,11 @@ bool TMastrini_application::almeno_un_record()
TString filter;
if (_cdc.not_empty())
filter << RMV_CODCMS << "==\"" << _cdc << '"';
{
filter << '(' << RMV_CODCMS << "=='" << _cdc << "')";
if (_fsc.not_empty())
filter << "&&(" << RMV_FASCMS << "=='" << _fsc << "')";
}
rmov.zero();
rmov.put(RMV_GRUPPO, _gruppo);
rmov.put(RMV_CONTO, _conto);
@ -921,6 +943,9 @@ void TMastrini_application::fai_stampa132()
set_row (_rw,"@38g#3t", &_codcaus);
set_row (_rw,"@117g#t #t #t", &_g_contr, &_c_contr, &_s_contr);
if (_riga_commessa.not_empty())
set_row (++_rw, _riga_commessa);
}
void TMastrini_application::fai_stampa198()
@ -1038,11 +1063,12 @@ void TMastrini_application::stampa_totali_commessa()
{
if (_cdc.not_empty())
{
_rw = 1;
// _rw = 1;
{
_saldo_commessa = _totale_commessa_dare - _totale_commessa_avere;
set_row (++_rw,"@32g@b%s", trans("TOTALI COMMESSA"));
// set_row (++_rw,"@32g@b%s", trans("TOTALI COMMESSA"));
set_row (_rw,"@32g@b%s", trans("PROGRESSIVI COMMESSA"));
if (_numcarat == 1)
{
@ -1063,12 +1089,10 @@ void TMastrini_application::stampa_totali_commessa()
void TMastrini_application::stampa_totali132()
{
TString sep(132);
if (_nummast == 1 || _nummast == 3)
_rw = 2;
sep.fill('_'); //Stampa 132 - (sep(132))
const TString sep(132, '_'); //Stampa 132 - (sep(132))
set_row(_rw++,"@0g%s", (const char*)sep);
_totprogre_dare=_progredare+_totale_periodo_dare;
@ -1093,6 +1117,9 @@ void TMastrini_application::stampa_totali132()
set_row (_rw,"@83g%r", &_totprogre_dare_al);
set_row (_rw,"@100g%r", &_totprogre_avere_al);
}
stampa_totali_commessa();
_devi_stampare_footer = FALSE;
}
@ -1155,7 +1182,7 @@ void TMastrini_application::carica_array_totali132()
_lista.add(r);
r = "";
}
if (_stampatotiva)
{
real totale;
@ -1251,7 +1278,7 @@ void TMastrini_application::stampa_totali132_II()
if (_item_lista <= diff)
_lista.destroy();
_devi_stampare_footer = FALSE;
}
@ -1260,7 +1287,8 @@ void TMastrini_application::stampa_totali198()
if (_nummast == 1 || _nummast == 3)
_rw = 1;
TString sep(198); sep.fill('_'); //Stampa 198 - (sep(198))
const TString sep(198, '-'); //Stampa 198 - (sep(198))
set_row(_rw,"@0g%s", (const char*)sep);
_totprogre_dare=_progredare+_totale_periodo_dare;
@ -1283,6 +1311,9 @@ void TMastrini_application::stampa_totali198()
if (!_stampa_des_contro)
set_row (_rw,"@135g%r", &_saldo_progre_al);
}
stampa_totali_commessa();
_devi_stampare_footer = FALSE;
}
@ -1586,6 +1617,8 @@ bool TMastrini_application::preprocess_page(int file, int counter)
TLocalisamfile& rmov = current_cursor()->file(LF_RMOV);
if (_cdc.not_empty() && rmov.get(RMV_CODCMS) != _cdc)
return FALSE;
if (_fsc.not_empty() && rmov.get(RMV_FASCMS) != _fsc)
return FALSE;
//Il flag _gia_stampata_intestazione serve nella stampa in continuo, xche'
//sono costretto a richiamare l'intestazione sia nella preprocess_page (per
@ -1610,6 +1643,23 @@ bool TMastrini_application::preprocess_page(int file, int counter)
_g_contr = rmov.get(RMV_GRUPPOC);
_c_contr = rmov.get(RMV_CONTOC);
_s_contr = rmov.get(RMV_SOTTOCONTOC);
_riga_commessa.cut(0);
if (_print_cdc)
{
TString80 cms = rmov.get(RMV_CODCMS);
if (cms.not_empty())
{
_riga_commessa = cms; _riga_commessa.left_just(132);
_riga_commessa.overwrite(cache().get("CMS", cms, "S0"), 21);
cms = rmov.get(RMV_FASCMS);
if (cms.not_empty())
{
_riga_commessa.overwrite(cms, 72);
_riga_commessa.overwrite(cache().get("FSC", cms, "S0"), 93);
}
}
}
// Stampa solo quelli che hanno anno esercizio uguale a quello specificato
// nella maschera. Se non viene specificato li stampa tutti
@ -1618,13 +1668,13 @@ bool TMastrini_application::preprocess_page(int file, int counter)
_importo_str = real2str(_importo);
_mov->setkey(1);
_mov->curr().zero();
_mov->curr().put(MOV_NUMREG,_numreg);
_mov->put(MOV_NUMREG,_numreg);
_mov->read();
if (_mov->bad())
_mov->zero();
_annoes = _mov->get_int(MOV_ANNOES);
_regiva = _mov->curr().get(MOV_REG);
_annoiva = _mov->curr().get_int(MOV_ANNOIVA);
_regiva = _mov->get(MOV_REG);
_annoiva = _mov->get_int(MOV_ANNOIVA);
// Controlla se saldo e' diverso da 0
@ -1640,11 +1690,11 @@ bool TMastrini_application::preprocess_page(int file, int counter)
else
if (_annomsk != 0)
{
_datareg = _mov->curr().get(MOV_DATACOMP);
_datareg_stampa = _mov->curr().get(MOV_DATAREG);
_datareg = _mov->get(MOV_DATACOMP);
_datareg_stampa = _mov->get(MOV_DATAREG);
}
provvis = _mov->curr().get(MOV_PROVVIS);
provvis = _mov->get(MOV_PROVVIS);
_dataregs = _datareg_stampa.string();
@ -1666,8 +1716,8 @@ bool TMastrini_application::preprocess_page(int file, int counter)
else
set_row(_rw, "@195gP");
_codcaus = _mov->curr().get(MOV_CODCAUS);
_tipodoc = _mov->curr().get(MOV_TIPODOC);
_codcaus = _mov->get(MOV_CODCAUS);
_tipodoc = _mov->get(MOV_TIPODOC);
if (_stampatotiva && (_tmcf == 'C' || _tmcf == 'F'))
{
if (_tipodoc != "")
@ -1678,14 +1728,14 @@ bool TMastrini_application::preprocess_page(int file, int counter)
_ddociva_len = _descrdociva.len();
}
}
_datadoc = (_mov->curr().get(MOV_DATADOC));
_datadoc = _mov->get(MOV_DATADOC);
_datadocs = _datadoc.string();
_numdoc = _mov->curr().get(MOV_NUMDOC);
_numdoc = _mov->get(MOV_NUMDOC);
descrizione_causale();
_descrizionemov = _mov->curr().get(MOV_DESCR);
_numgio = atol(_mov->curr().get(MOV_NUMGIO));
_descrizionemov = _mov->get(MOV_DESCR);
_numgio = _mov->get_long(MOV_NUMGIO);
_descrizione = current_cursor()->curr(LF_RMOV).get(RMV_DESCR);
_descrizione = rmov.get(RMV_DESCR);
if (_nummast == 1 || _nummast == 3)
{
@ -1786,34 +1836,34 @@ bool TMastrini_application::preprocess_page(int file, int counter)
if (_descrizione != "")
{
d23 = _descrizione;
if (_descrizionemov != "")
if (_descrizionemov.not_empty())
d18 = _descrizionemov;
else if (_descrizionemov == "")
else
d18 = _descrcaus;
}
else if (_descrizione == "")
if (_descrizionemov != "")
{
d23 = _descrizionemov;
d18 = _descrcaus;
}
else
if (_descrizionemov == "")
{
conto(_gruppocontr,_contocontr,FALSE);
TConto tc (_gruppocontr,_contocontr,_sottocontocontr,_tipo_contr);
_descrcontr = tc.descrizione();
d18 = _descrcaus;
if (_descrcontr != "Sconosciuto")
d23 = _descrcontr;
}
else if (_descrizione.empty())
{
if (_descrizionemov.not_empty())
{
d23 = _descrizionemov;
d18 = _descrcaus;
}
else
{
conto(_gruppocontr,_contocontr,FALSE);
TConto tc (_gruppocontr,_contocontr,_sottocontocontr,_tipo_contr);
_descrcontr = tc.descrizione();
d18 = _descrcaus;
if (_descrcontr != "Sconosciuto")
d23 = _descrcontr;
}
}
TParagraph_string d_18 (d18,18);
int i = 0;
const char* str;
while ( (str = d_18.get()) != NULL)
{
TString stringa = "";
TString stringa;
stringa << "@42g" << str;
setta_riga(i,stringa);
i++;
@ -1823,7 +1873,7 @@ bool TMastrini_application::preprocess_page(int file, int counter)
i = 0;
while ( (str = d_23.get()) != NULL)
{
TString stringa = "";
TString stringa;
stringa << "@61g" << str;
setta_riga(i,stringa);
i++;
@ -1832,7 +1882,7 @@ bool TMastrini_application::preprocess_page(int file, int counter)
else
if (_numcarat == 2) // Stampa 198 caratteri
{
if (_descrizione != "")
if (_descrizione.not_empty())
{
d30 = _descrizione;
if (_descrizionemov != "")
@ -1840,29 +1890,29 @@ bool TMastrini_application::preprocess_page(int file, int counter)
else if (_descrizionemov == "")
d23 = _descrcaus;
}
else if (_descrizione == "")
if (_descrizionemov != "")
{
d30 = _descrizionemov;
d23 = _descrcaus;
}
else
if (_descrizionemov == "")
{
conto(_gruppocontr,_contocontr,FALSE);
TConto tc (_gruppocontr,_contocontr,_sottocontocontr,_tipo_contr);
_descrcontr = tc.descrizione();
d23 = _descrcaus;
if (_descrcontr != "Sconosciuto")
d30 = _descrcontr;
}
else
{
if (_descrizionemov.not_empty())
{
d30 = _descrizionemov;
d23 = _descrcaus;
}
else
{
conto(_gruppocontr,_contocontr,FALSE);
TConto tc (_gruppocontr,_contocontr,_sottocontocontr,_tipo_contr);
_descrcontr = tc.descrizione();
d23 = _descrcaus;
if (_descrcontr != "Sconosciuto")
d30 = _descrcontr;
}
}
TParagraph_string d_23 (d23,23);
int i = 0;
const char* str;
while ( (str = d_23.get()) != NULL)
{
TString stringa = "";
TString stringa;
stringa << "@46g" << str;
setta_riga(i,stringa);
i++;
@ -2299,11 +2349,8 @@ print_action TMastrini_application::postprocess_page(int file, int counter)
if (righe_rimaste > 0)
{
_rw++; //incremento la riga altrimenti copro l'ultimo totale settato con una riga bianca
TString sep = " ";
for (int i = 0; i < righe_rimaste; i++)
set_row(_rw++,"@0g%s", (const char*) sep);
set_row(_rw++,"@0g ");
}
}
}
@ -2325,7 +2372,7 @@ print_action TMastrini_application::postprocess_print(int file, int counter)
if (file == LF_SALDI)
{
reset_print();
stampa_totali_commessa();
// stampa_totali_commessa();
print_one(file);
_msk->reset(-9);
@ -2437,7 +2484,7 @@ bool TMastrini_application::preprocess_print(int file, int counter)
return TRUE;
}
bool TMastrini_application::set_print(int)
bool TMastrini_application::set_print(int m)
{
KEY tasto = K_ENTER;
while (tasto == K_ENTER)
@ -2567,6 +2614,8 @@ bool TMastrini_application::set_print(int)
enable_print_menu();
enable_link("Collegamento prima nota: ", 'b');
_print_cdc = _msk->get_bool(F_PRINTCDC);
if (_msk->get(F_DACDC).not_empty() || _msk->get(F_ACDC).not_empty())
{
TRelation rel("CMS");
@ -2576,18 +2625,53 @@ bool TMastrini_application::set_print(int)
TCursor cur(&rel, "", 1, &darec, &arec);
const long items = cur.items();
cur.freeze();
_totale_commessa_dare = _totale_commessa_avere = ZERO;
TRelation fscrel("FSC");
TRectype da_fsc(fscrel.curr()), a_fsc(fscrel.curr());
da_fsc.put("CODTAB", _msk->get(F_DAFSC));
a_fsc.put("CODTAB", _msk->get(F_AFSC));
TCursor fsccur(&fscrel, "", 1, &da_fsc, &a_fsc);
const TRecnotype fsc_items = fsccur.items();
fsccur.freeze();
for (cur = 0L; cur.pos() < items; ++cur)
{
_cdc = rel.curr().get("CODTAB");
print();
if (!da_fsc.empty() || !a_fsc.empty())
{
for (fsccur = 0L; fsccur.pos() < fsc_items; ++fsccur)
{
_fsc = fsccur.curr().get("CODTAB");
do
{
_totale_commessa_dare = _totale_commessa_avere = ZERO;
print();
}
while (need_to_repeat_print());
}
}
else
{
_fsc.cut(0);
do
{
_totale_commessa_dare = _totale_commessa_avere = ZERO;
print();
}
while (need_to_repeat_print());
}
}
}
else
{
_cdc.cut(0);
print();
_fsc.cut(0);
do
print();
while (need_to_repeat_print());
}
_msk->reset(-8);
}
return FALSE;
@ -2814,13 +2898,21 @@ void TMastrini_application::crea_intestazione()
set_header (1, "@103g%-.18s", (const char*) _com);
set_header (1, "@122g%-.3s", (const char*) _prov);
}
if (_cdc.not_empty())
{
const char* descr = cache().get("CMS", _cdc, "S0");
set_header(2, "@bCommessa %s - %s", (const char*)_cdc, descr);
{
const TString& desc_cdc = cache().get("CMS", _cdc, "S0");
if (_fsc.not_empty())
{
const TString& desc_fsc = cache().get("FSC", _fsc, "S0");
set_header(2, "@bCommessa %s %s - Fase %s %s",
(const char*)_cdc, (const char*)desc_cdc,
(const char*)_fsc, (const char*)desc_fsc);
}
else
set_header(2, "@bCommessa %s %s", (const char*)_cdc, (const char*)desc_cdc);
}
if (_nummast == 3)
set_header (3, "@0g%s@12g@b%3d %3d %6ld", trans("Sottoconto"), _gruppo, _conto, _sottoc);
else
@ -2869,14 +2961,14 @@ void TMastrini_application::crea_intestazione()
set_header (6,"@0g%s", (const char*)sep1);
if (_stampa_des_contro)
{
set_header (7,"%s@23g%s@34g%s@183g%s@190g%s@197g%s",
trans("Operazione"), trans("Data"), trans("Numero"),
set_header (7,"%s@23g%s@183g%s@190g%s@197g%s",
trans("Operazione"), trans("Documento"),
trans("Reg"), trans("Numero"), trans("A"));
}
else
{
set_header (7,"%s@23g%s@34g%s@169g%s@183g%s@190g%s@197g%s",
trans("Operazione"), trans("Data"), trans("Numero"), trans("Contro"),
set_header (7,"%s@23g%s@169g%s@183g%s@190g%s@197g%s",
trans("Operazione"), trans("Documento"), trans("Contro"),
trans("Reg"), trans("Numero"), trans("A"));
}
if (_stampa_mov_prov)
@ -2887,15 +2979,15 @@ void TMastrini_application::crea_intestazione()
if (_stampa_des_contro)
{
set_header (8,"@23g%s@42g%s@70g%s@112g%s@127g%s@135g%s@183g%s@189g%s@197g%s",
trans("Documento"), trans("Cod.Causale"), trans("Descrizione"), trans("Dare"), trans("Avere"),
set_header (8,"@23g%s@34g%s@42g%s@70g%s@112g%s@127g%s@135g%s@183g%s@189g%s@197g%s",
trans("Data"), trans("Numero"), trans("Cod.Causale"), trans("Descrizione"), trans("Dare"), trans("Avere"),
trans("Contropartita"), trans("Iva"),
trans("Protoc."), trans("C"));
}
else
{
set_header (8,"@23g%s@42g%s@70g%s@112g%s@127g%s@135g%s@152g%s@169g%s@183g%s@189g%s@197g%s",
trans("Documento"), trans("Cod.Causale"), trans("Descrizione"), trans("Dare"), trans("Avere"),
set_header (8,"@23g%s@34g%s@42g%s@70g%s@112g%s@127g%s@135g%s@152g%s@169g%s@183g%s@189g%s@197g%s",
trans("Data"), trans("Numero"), trans("Cod.Causale"), trans("Descrizione"), trans("Dare"), trans("Avere"),
trans("Saldo progre."), trans("Saldo movim."), trans("Partita"), trans("Iva"),
trans("Protoc."), trans("C"));
}
@ -2946,7 +3038,7 @@ void TMastrini_application::crea_intestazione()
set_header (10,"@32g%s@83g%s", trans("A RIPORTO"), real2str(dep_dare));
set_header (10,"@100g%s", real2str(dep_avere));
}
if (_numcarat == 2)
else
{
set_header (10,"@32g%s@100g%s", trans("A RIPORTO"), real2str(dep_dare));
set_header (10,"@117g%s", real2str(dep_avere));
@ -2955,16 +3047,18 @@ void TMastrini_application::crea_intestazione()
_riporto_parziale_dare = ZERO;
_riporto_parziale_avere = ZERO;
}
if (_numcarat == 1)
{
sep ="";
set_header(11,"@1g%s",(const char*) sep);
set_header(11,"@0g%s",(const char*) sep);
}
else if (_numcarat == 2)
{
sep1 ="";
set_header(11,"@1g%s",(const char*) sep1);
}
else
{
sep1 ="";
set_header(11,"@0g%s",(const char*) sep1);
}
if (_pagina != np && _nummast == 3)
_pagina = np;
}
@ -3052,7 +3146,7 @@ int TMastrini_application::crea_intestazione(int start_riga)
if (_numcarat == 1)
{
sep.fill('_'); //Stampa 132 - (sep(132))
set_row (r++,"@1g%s", (const char *) sep);
set_row (r++,"@0g%s", (const char *) sep);
set_row (r++,"%s@19g%s@117g%s@131g%s",
trans("Operazione"), trans("Documento"), trans("Contro"), trans("A"));
if (_stampa_mov_prov)
@ -3064,22 +3158,22 @@ int TMastrini_application::crea_intestazione(int start_riga)
if (_stampa_mov_prov)
set_header(r-1,"@130gP");
sep.fill('_');
set_row (r++,"@1g%s", (const char*)sep);
set_row (r++,"@0g%s", (const char*)sep);
}
else
{
sep1.fill('_'); //Stampa 198 - (sep1(198))
set_row (r++,"@0g%s", (const char*)sep1);
if (_stampa_des_contro)
set_row (r++,"Operazione@23gData@34gNumero@183gReg@190gNumero@197gA");
set_row (r++,"Operazione@23gDocumento@183gReg@190gNumero@197gA");
else
set_row (r++,"Operazione@23gData@34gNumero@169gContro@183gReg@190gNumero@197gA");
set_row (r++,"Operazione@23gDocumento@169gContro@183gReg@190gNumero@197gA");
if (_stampa_mov_prov)
set_row(r-1,"@195gM");
set_row (r,"Data");
if (_stampanum < 3)
set_row (r,"@11gnumero");
set_row (r,"@23gDocumento@42gCod.Causale@70gDescrizione@112gDare@127gAvere");
set_row (r,"@23gData@34gNumero@42gCod.Causale@70gDescrizione@112gDare@127gAvere");
if (_stampa_des_contro)
set_row (r++,"@135gContropartita@183gIva@189gProtoc.@197gC");
else
@ -3137,12 +3231,12 @@ void TMastrini_application::stampa_progre_riporto()
if (_numcarat == 1)
{
sep ="";
set_row(_rw,"@1g%s",(const char*)sep);
set_row(_rw,"@0g%s",(const char*)sep);
}
else
{
sep1 ="";
set_row(_rw,"@1g%s",(const char*)sep1);
set_row(_rw,"@0g%s",(const char*)sep1);
}
}
@ -3188,12 +3282,12 @@ int TMastrini_application::stampa_progre_riporto(int start_riga)
if (_numcarat == 1)
{
sep ="";
set_row(r++,"@1g%s",(const char*) sep);
set_row(r++,"@0g%s",(const char*) sep);
}
else
{
sep1 ="";
set_row(r++,"@1g%s",(const char*) sep1);
set_row(r++,"@0g%s",(const char*) sep1);
}
return r;
}
@ -3213,8 +3307,11 @@ void TMastrini_application::calcola_progressivi_al(const TDate& data_fin)
TString filter;
if (_cdc.not_empty())
{
filter << RMV_CODCMS << "==\"" << _cdc << "\"";
if (_fsc.not_empty())
filter << "&&(" << RMV_FASCMS << "==\"" << _fsc << "\")";
}
rmov.zero();
rmov.put(RMV_GRUPPO, _gruppo);
rmov.put(RMV_CONTO, _conto);
@ -3888,12 +3985,20 @@ int TMastrini_application::ricerca_gruppo(int start)
{
set_row (r, "@r%s@23g@b%s", trans("Periodo di competenza"), (const char*) dataini);
set_row (r, "@35g%s@r", (const char*) datafine);
if (_cdc.not_empty())
{
const char* descr = cache().get("CMS", _cdc, "S0");
set_row(++r, "@bCommessa %s - %s", (const char*)_cdc, descr);
}
if (_cdc.not_empty())
{
const TString& desc_cdc = cache().get("CMS", _cdc, "S0");
if (_fsc.not_empty())
{
const TString& desc_fsc = cache().get("FSC", _fsc, "S0");
set_row(++r, "@bCommessa %s %s - Fase %s %s",
(const char*)_cdc, (const char*)desc_cdc,
(const char*)_fsc, (const char*)desc_fsc);
}
else
set_row(++r, "@bCommessa %s %s", (const char*)_cdc, (const char*)desc_cdc);
}
}
else
{
@ -3998,6 +4103,8 @@ void TMastrini_application::set_handlers(TMask* msk) const
msk->set_handler(F_SOTTOCFINE_CONTO, sottoc_handler_fine);
msk->set_handler(F_SOTTOCFINE_CLIENTE, sottoc_handler_fine);
msk->set_handler(F_SOTTOCFINE_FORN, sottoc_handler_fine);
msk->set_handler(F_DACDC, cdc_handler);
msk->set_handler(F_ACDC, cdc_handler);
}
// Copia i parametri della prima pagina in una nuova riga dello spreadsheet
@ -4037,17 +4144,14 @@ bool TMastrini_application::sheet2mask()
{
TString_array& rows = sht.rows_array();
TToken_string& row = rows.row(0);
row.restart();
short id = F_ANNO;
for (int pos = _msk->id2pos(id); pos >= 0; pos = _msk->id2pos(++id))
{
FOR_EACH_TOKEN(row, val)
{
// Scarta i listbox perche' azzerano i conti!
if (id != F_TIPOCF_INI && id != F_TIPOCF_FINE)
{
const char* val = row.get();
_msk->fld(pos).set(val);
}
_msk->set(id, val);
id++;
}
rows.destroy(0, TRUE);
@ -4090,7 +4194,7 @@ bool TMastrini_application::user_create()
_msk->set_handler(F_MEMORIZZA, memorizza_handler);
if (!has_module(CMAUT))
_msk->hide(-4); // Spegne campi commesse in assenza del modulo relativo
_msk->hide(-7); // Spegne campi commesse in assenza del modulo relativo
TSheet_field& sht = (TSheet_field&)_msk->field(F_SCELTE);
sht.set_notify(scelte_notify);
@ -4135,4 +4239,3 @@ int cg3200(int argc, char* argv[])
a.run(argc, argv, "Stampa Mastrini");
return 0;
}

View File

@ -38,8 +38,9 @@
#define F_STAMPAMOVPROV 116
#define F_DACDC 117
#define F_ACDC 118
#define F_DACDC_DES 157
#define F_ACDC_DES 158
#define F_DAFSC 119
#define F_AFSC 120
#define F_PRINTCDC 123
#define F_SEPARATOR 150
#define F_SORTDESC 151
#define F_MEMORIZZA 500

View File

@ -408,26 +408,31 @@ END
BOOLEAN F_STAMPATOTIVA
BEGIN
PROMPT 4 12 "Stampa totali documenti IVA"
GROUP 8
END
BOOLEAN F_STAMPAPROGRE
BEGIN
PROMPT 44 12 "Stampa progressivi attuali"
PROMPT 40 12 "Stampa progressivi attuali"
GROUP 8
END
BOOLEAN F_STAMPAMOVPROV
BEGIN
PROMPT 4 13 "Stampa movimenti provvisori"
GROUP 8
END
BOOLEAN F_SORTDESC
BEGIN
PROMPT 44 13 "Stampa ordinata per descrizione"
PROMPT 40 13 "Stampa ordinata per descrizione"
GROUP 8
END
BOOLEAN F_SEPARATOR
BEGIN
PROMPT 4 14 "Non stampare il separatore delle migliaia"
GROUP 8
END
LIST F_STAMPANUM 15
@ -446,60 +451,66 @@ BEGIN
ITEM "3|Completa"
END
GROUPBOX DLG_NULL 71 4
GROUPBOX DLG_NULL 71 5
BEGIN
PROMPT 4 17 "@bCentri di costo"
GROUP 4
PROMPT 4 17 "@bCentri di costo / Commesse"
GROUP 7
END
BOOLEAN F_PRINTCDC
BEGIN
PROMPT 5 18 "Stampa Centro di costo/Commessa e Fase relativa ad ogni riga"
GROUP 7 8
END
STRING F_DACDC 20
BEGIN
PROMPT 5 18 "Da "
PROMPT 5 19 "Da CDC/Commessa "
FLAGS "UZ"
USE CMS
INPUT CODTAB F_DACDC
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@70" S0
OUTPUT F_DACDC CODTAB
OUTPUT F_DACDC_DES S0
CHECKTYPE SEARCH
GROUP 4
GROUP 7 8
END
STRING F_DACDC_DES 70 39
STRING F_DAFSC 10
BEGIN
PROMPT 32 18 ""
USE CMS KEY 2
INPUT S0 F_DACDC_DES
DISPLAY "Descrizione@70" S0
DISPLAY "Codice@20" CODTAB
COPY OUTPUT F_DACDC
PROMPT 50 19 "Da Fase "
FLAGS "UZ"
USE FSC
INPUT CODTAB F_DAFSC
DISPLAY "Codice@10" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_DAFSC CODTAB
CHECKTYPE SEARCH
GROUP 4
GROUP 7 8
END
STRING F_ACDC 20
BEGIN
PROMPT 5 19 "A "
PROMPT 5 20 "A CDC/Commessa "
FLAGS "UZ"
COPY USE F_DACDC
INPUT CODTAB F_ACDC
COPY DISPLAY F_DACDC
OUTPUT F_ACDC CODTAB
OUTPUT F_ACDC_DES S0
CHECKTYPE SEARCH
GROUP 4
GROUP 7 8
END
STRING F_ACDC_DES 70 39
STRING F_AFSC 10
BEGIN
PROMPT 32 19 ""
COPY USE F_DACDC_DES
INPUT S0 F_ACDC_DES
COPY DISPLAY F_DACDC_DES
COPY OUTPUT F_ACDC
PROMPT 50 20 "A Fase "
FLAGS "UZ"
COPY USE F_DAFSC
INPUT CODTAB F_AFSC
COPY DISPLAY F_DAFSC
OUTPUT F_AFSC CODTAB
CHECKTYPE SEARCH
GROUP 4
GROUP 7 8
END
ENDPAGE
@ -932,16 +943,19 @@ END
BOOLEAN F_STAMPATOTIVA
BEGIN
PROMPT 1 7 "Stampa totali documenti IVA"
GROUP 8
END
BOOLEAN F_STAMPAPROGRE
BEGIN
PROMPT 38 7 "Stampa progressivi attuali"
GROUP 8
END
BOOLEAN F_STAMPAMOVPROV
BEGIN
PROMPT 1 8 "Stampa movimenti provvisori"
GROUP 8
END
LIST F_STAMPANUM 15
@ -962,7 +976,7 @@ END
STRING F_DACDC 20
BEGIN
PROMPT 1 11 "Da commessa "
PROMPT 1 11 "Da CDC/Commessa "
FLAGS "UZ"
USE CMS
INPUT CODTAB F_DACDC
@ -970,17 +984,44 @@ BEGIN
DISPLAY "Descrizione@70" S0
OUTPUT F_DACDC CODTAB
CHECKTYPE SEARCH
GROUP 7 8
END
STRING F_DAFSC 10
BEGIN
PROMPT 50 11 "Da fase "
FLAGS "UZ"
USE FSC
INPUT CODTAB F_DAFSC
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@70" S0
OUTPUT F_DAFSC CODTAB
CHECKTYPE SEARCH
GROUP 7 8
END
STRING F_ACDC 20
BEGIN
PROMPT 1 12 "A commessa "
PROMPT 1 12 "A CDC/Commessa "
FLAGS "UZ"
COPY USE F_DACDC
INPUT CODTAB F_ACDC
COPY DISPLAY F_DACDC
OUTPUT F_ACDC CODTAB
CHECKTYPE SEARCH
GROUP 7 8
END
STRING F_AFSC 10
BEGIN
PROMPT 50 12 "A fase "
FLAGS "UZ"
COPY USE F_DAFSC
INPUT CODTAB F_AFSC
COPY DISPLAY F_DAFSC
OUTPUT F_AFSC CODTAB
CHECKTYPE SEARCH
GROUP 7 8
END
BUTTON DLG_OK 10 2

View File

@ -90,12 +90,12 @@ public:
void ricevi_movSC(TString& key,char sigla);
long esiste_numreg(long nreg);
void num_protocollo();
long controlli_primanota();
long ulnumprot_reg(int anno,TString& codreg);
void controlli_primanota();
long ulnumprot_reg(int anno, const TString& codreg);
long ultima_registrazione();
void aggiorna_reg(int anno,TString& codreg,long ulnum);
void aggiorna_reg(int anno, const TString& codreg);
char ricerca_causale(TString& field);
bool esiste_partita(TString& key);
bool esiste_partita(const TString& key);
void rigaErata(char,int,int,long,int,TString&,int,int);
void aggiorna_temp_scad(char,int,int,long,int,TString&,int,int,int,int);
bool occasionali(TString& ocfpi);
@ -851,7 +851,6 @@ long TRic_tab::ultima_registrazione()
if (_nreg == 0)
{
TLocalisamfile mov (LF_MOV);
mov.last();
return (mov.get_long(MOV_NUMREG));
}
@ -859,6 +858,7 @@ long TRic_tab::ultima_registrazione()
return _nreg;
}
// Legge i numeri di protocollo dal movimento ricevuto
void TRic_tab::num_protocollo()
{
_protiva = _tmov->get_long(MOV_PROTIVA);
@ -871,96 +871,99 @@ void TRic_tab::num_protocollo()
_nuprotiva = _uprotiva;
}
long TRic_tab::ulnumprot_reg(int anno,TString& cr)
long TRic_tab::ulnumprot_reg(int anno, const TString& codreg)
{
TRegistro rg (cr, anno);
TString16 dep;
if (real::is_natural(codreg))
dep.format("%04d%03s", anno, (const char*)codreg);
else
dep.format("%04d%-3s", anno, (const char*)codreg);
return rg.protocol();
// Non usare le cache! Problemi di aggiornamento veloce
TTable& reg = *_reg;
int err = NOERR;
if (reg.get("CODTAB") != dep)
{
reg.put("CODTAB", dep);
err = reg.read();
}
long lastprot = err == NOERR ? reg.get_long("I5") : 0L;
return lastprot;
}
void TRic_tab::aggiorna_reg(int anno,TString& codreg,long ulnum)
void TRic_tab::aggiorna_reg(int anno, const TString& codreg)
{
TTable reg ("REG");
TString16 dep;
if (real::is_natural(codreg))
dep.format("%04d%03s", anno,(const char*) codreg);
dep.format("%04d%03s", anno, (const char*)codreg);
else
dep.format("%04d%-3s", anno,(const char*) codreg);
dep.format("%04d%-3s", anno, (const char*)codreg);
reg.zero();
reg.put("CODTAB", (const char*) dep);
if (reg.read() == NOERR)
TTable& reg = *_reg;
int err = NOERR;
if (reg.get("CODTAB") != dep)
{
if (_nprotiva > ulnum )
reg.put("I5", _nprotiva);
reg.put("CODTAB", dep);
err = reg.read();
}
if (err == NOERR)
{
const long ulnum = reg.get_long("I5");
if (_nuprotiva > ulnum )
reg.put("I5", _nuprotiva);
else
{
if (_nprotiva > ulnum )
reg.put("I5", _nprotiva);
}
reg.rewrite();
}
}
long TRic_tab::controlli_primanota()
void TRic_tab::controlli_primanota()
{
TTable tpd ("%TPD");
bool corrisp = FALSE;
TDate datareg;
int anno;
long ulnum = 0;
TString16 tmp;
TString tipodoc,codreg;
char tipocf = _tmov->get_char(MOV_TIPO);
int tiporeg;
const char tipocf = _tmov->get_char(MOV_TIPO);
int tiporeg = 0;
if (tipocf == 'C')
tiporeg = 1;
else
if (tipocf == 'F')
tiporeg = 2;
codreg = _tmov->get(MOV_REG);
tipodoc = _tmov->get(MOV_TIPODOC);
const TString8 codreg = _tmov->get(MOV_REG);
const TString8 tipodoc = _tmov->get(MOV_TIPODOC);
datareg = _tmov->get_date(MOV_DATAREG);
anno = datareg.year();
const TDate datareg = _tmov->get_date(MOV_DATAREG);
const int anno = datareg.year();
tpd.zero();
tpd.put("CODTAB", (const char*) tipodoc);
if (tpd.read() == NOERR)
corrisp = tpd.get_bool("B0");
const TRectype& tpd = cache().get("%TDP", tipodoc);
const bool corrisp = tpd.get_bool("B0");
if (codreg.not_empty() && !corrisp)
{
if ( ( (tiporeg == 1 && (_nprot_att || _protiva == 0) ) )
|| ( (tiporeg == 2 && (_nprot_pas || _protiva == 0) ) ) )
{
ulnum = ulnumprot_reg(anno,codreg);
const long ulnum = ulnumprot_reg(anno, codreg);
_nprotiva = ulnum + 1;
if (_uprotiva != 0)
_nuprotiva = (_nprotiva - ulnum) + _uprotiva;
}
}
return ulnum;
}
char TRic_tab::ricerca_causale(TString& causale)
{
TLocalisamfile cau (LF_CAUSALI);
char movap = ' ';
if (real::is_natural(causale))
causale.format("%03s", (const char*) causale);
else
causale.format("%-3s", (const char*) causale);
cau.setkey(1);
cau.zero();
cau.put("CODCAUS", causale);
if (cau.read() == NOERR)
movap = cau.get_char("MOVAP");
const TRectype& cau = cache().get(LF_CAUSALI, causale);
char movap = cau.get_char(CAU_MOVAP);
if (movap < ' ')
movap = ' ';
return movap;
}
@ -995,7 +998,7 @@ void TRic_tab::scrivi_righePN(long numreg)
void TRic_tab::ricevi_movPN(TString& key, char uselab)
{
TString str;
long numulreg;
long numulreg;
TRectype recmov (LF_MOV);
char flag = _tras_file.flg_agg(uselab);
@ -1046,8 +1049,8 @@ void TRic_tab::ricevi_movPN(TString& key, char uselab)
if (_mov->read() != NOERR) // Se non esiste la testata
{
num_protocollo(); // Riattribuzione numero di protocollo
long ulnum = controlli_primanota();
num_protocollo(); // Legge i numeri di protocollo dal movimento ricevuto
controlli_primanota();
recmov.put(MOV_NUMREG, _nreg);
recmov.put(MOV_PROTIVA, _nprotiva);
@ -1057,19 +1060,19 @@ void TRic_tab::ricevi_movPN(TString& key, char uselab)
_mov->curr() = recmov;
_mov->write();
TString codreg (_tmov->get (MOV_REG));
TString codcaus (_tmov->get (MOV_CODCAUS));
TDate datareg (_tmov->get_date(MOV_DATAREG));
int anno = datareg.year();
const TString8 codreg = _tmov->get(MOV_REG);
TString8 codcaus = _tmov->get(MOV_CODCAUS);
const TDate datareg = _tmov->get(MOV_DATAREG);
const int anno = datareg.year();
aggiorna_reg(anno,codreg,ulnum); // Aggiorna il registro
aggiorna_reg(anno,codreg); // Aggiorna il registro
_sld.set_anno_es(annoes);
_sld.set_movprovv(provvis);
_sld.set_num_ulmov(_nreg);
_sld.set_data_ulmov(datareg);
char movap = ricerca_causale(codcaus);
const char movap = ricerca_causale(codcaus);
if (movap == 'A')
_sld.set_tipo_saldo(apertura);
else if (movap == 'C')
@ -1284,7 +1287,7 @@ long TRic_tab::nuovaregSC(long nreg)
return nuovareg;
}
bool TRic_tab::esiste_partita(TString& key)
bool TRic_tab::esiste_partita(const TString& key)
{
TLocalisamfile part (LF_PARTITE);
@ -1293,7 +1296,7 @@ bool TRic_tab::esiste_partita(TString& key)
int conto = atoi(key.mid(4,3));
long sottoc = atol(key.mid(7,6));
int anno = atoi(key.mid(13,4));
TString npart = key.mid(17,7);
TString8 npart = key.mid(17,7);
int nriga = atoi(key.mid(24,4));
part.zero();

View File

@ -62,6 +62,7 @@ void TEsercizi_contabili::check()
{
if (_firm != prefix().get_codditta())
update();
CHECK(_esercizi.items() > 0, "Non esistono esercizi contabili!");
}
int TEsercizi_contabili::date2index(const TDate& d) const
@ -118,13 +119,23 @@ int TEsercizi_contabili::last() const
return items() ? esc(items()-1).codice() : 0;
}
// Certified 99%
int TEsercizi_contabili::last_mag() const
{
/* Vecchio modo error-prone che non funziona nel primo anno di attività
int es=last()-1;
while (es>0 && !esercizio(es).chiusura_mag())
es--;
es++;
return es;
*/
check();
for (int i = items()-1; i >= 0; i--)
{
const TEsercizio& e = esc(i);
if (e.chiusura_mag().ok())
break;
}
return esc(i+1).codice();
}

View File

@ -64,7 +64,7 @@ Item_05 = "Clienti/Fornitori", "cg0 -1", "F"
Item_06 = "Agenti", "pr0 -4", ""
Item_07 = "Cambi giornalieri", "ba3 -0 cam", ""
Item_08 = "Esercizi", "cg0 -5 esc", "F"
Item_09 = "Commesse", "ba3 -0 cms", ""
Item_09 = "CDC/Commesse", "ba3 -0 cms", ""
Item_10 = "Fasi commesse", "ba3 -0 fsc", ""
[PRASSICG_008]

View File

@ -151,16 +151,39 @@ void TValorizzazione_mask::elabora()
_risultati.destroy();
TString line, num;
const int sorc = get_int(F_TIPO);
const int dest = get_int(F_VALORIZZA);
// 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
line = "@b Valorizzazione al ";
switch (sorc)
{
case 1: line << "Media Costi"; break;
case 2: line << "Prezzo Listino"; break;
case 3: line << "Costo Standard"; break;
case 4: line << "Costo Medio"; break;
case 5: line << "Costo Medio Ponderato"; break;
case 6: line << "LIFO Annuale"; break;
case 7: line << "FIFO Annuale"; break;
case 8: line << "LIFO"; break;
case 9: line << "FIFO"; break;
default: line << "Ultimo Costo"; break;
}
line << " - ricalcola ";
switch (dest)
{
case 1: line << "l' Ultimo Costo"; break;
case 2: line << "il Prezzo di Listino"; break;
default: line << "il Costo Standard"; break;
}
line << " " << get(F_DATA);
bf.add_line(line);
line = "@bCodice distinta Descrizione Attuale Precedente";
bf.add_line(line);
TString80 descr;
cur.freeze(TRUE);
const int sorc = get_int(F_TIPO);
const int dest = get_int(F_VALORIZZA);
for (cur = 0; cur.pos() < items; ++cur)
{
pi.addstatus(1);
@ -315,21 +338,25 @@ bool TValorizzazione_mask::on_field_event(TOperable_field& f, TField_event e, lo
TViswin& w = b.vis_win();
TTextfile& f = w.text();
const long rows = f.lines();
if (rows > 1)
if (rows > 2)
{
TPrinter& p = printer();
TPrintrow row;
TString line = f.line_formatted(0); // Legge la prima riga dal line
row.put(line);
p.setheaderline(0, row); // La imposta come testata
p.headerlen(2); // Imposta altezza testata
line = f.line_formatted(1); // Legge la prima riga dal line
row.reset();
row.put(line);
p.setheaderline(1, row); // La imposta come testata
p.headerlen(3); // Imposta altezza testata
const TPrtype old_prtype = p.printtype();
p.set_printtype(winprinter); // Forza la stampa su carta
p.open();
for (long l = 1; l < rows; l++)
for (long l = 2; l < rows; l++)
{
line = f.line_formatted(l);
row.reset();

View File

@ -487,11 +487,12 @@ const char* TApplication::get_module_name() const
bool ok = FALSE;
for (int aut = 0; scanner.line() != ""; aut++)
if (strncmp(scanner.token(), _name, 2) == 0)
if (strncmp(scanner.token(), (const char *)_name, 2) == 0)
{ ok = TRUE; break; }
module = scanner.token().mid(3);
if (ok && check_autorization())
ok = has_module(aut);
if (!ok)
{
if (module.empty())
@ -766,10 +767,20 @@ void TApplication::end_wait()
bool TApplication::has_module(int module, int checktype) const
{
bool ok = TRUE;
#ifdef DBG
// Ignora i bit di attivazione della chiave programmatori (sempre attivati)
if (get_serial_number() == 0)
checktype = CHK_USER;
#endif
#ifndef _DEMO_
// Testa bit di attivazione della chiave
if (checktype == CHK_ALL || checktype == CHK_DONGLE)
ok = _dongle_aut[module];
#endif
// Testa bit di attivazione dell'utente
if (ok && (checktype == CHK_ALL || checktype == CHK_USER))
ok = _user_aut[module];
return ok;
@ -1091,4 +1102,3 @@ bool TSkeleton_application::menu(MENU_TAG tag)
main_loop();
return FALSE;
}

View File

@ -289,13 +289,13 @@ void TSelect_color_mask::save() const
TColor_object_props & p = *row(i);
tmp = p.get_key();
if (p.get_fore() == NORMAL_COLOR)
if (p.get_fore() == p.get_fore_def())
conf.remove(tmp);
else
conf.set_color(tmp, p.get_fore());
tmp << "_Bg";
if (p.get_back() == NORMAL_BACK_COLOR)
if (p.get_back() == p.get_back_def())
conf.remove(tmp);
else
conf.set_color(tmp, p.get_back());

View File

@ -1599,8 +1599,8 @@ protected: // TObject
bool is_kind_of(word cid) const;
protected: // TWindowed_field
virtual TField_window* create_window(int x, int y, int dx, int dy,
WINDOW parent);
virtual TField_window* create_window(int x, int y, int dx, int dy, WINDOW parent);
public:
TTree* tree() const;
void set_tree(TTree* t);
@ -1609,6 +1609,7 @@ public:
void show_leaves(bool yes = TRUE) { hide_leaves(!yes); }
bool select_current();
bool goto_selected();
void set_header(const char* header);
TTree_field(TMask* m) : TWindowed_field(m) { }
virtual ~TTree_field() { }

View File

@ -88,12 +88,20 @@ void TRow_property::set(int col, COLOR back, COLOR fore)
void TRow_property::get(int col, COLOR & back, COLOR & fore) const
{
if (col > 0 && _cell_prop)
if (col > 0)
{
const TCell_property* cp = (const TCell_property*)_cell_prop->objptr(col);
if (cp != NULL)
cp->get(back, fore);
}
if (!_cell_prop)
{
back = _back;
fore = _fore;
}
else
{
const TCell_property* cp = (const TCell_property*)_cell_prop->objptr(col);
if (cp != NULL)
cp->get(back, fore);
}
}
}
///////////////////////////////////////////////////////////
@ -1073,9 +1081,12 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
xiev->v.cell_request.attrib &= ~XI_ATR_ENABLED;
}
else
{
get_back_and_fore_color(xiev->v.cell_request.back_color,
xiev->v.cell_request.color, rec, col);
{
const bool has_focus = rec == _cur_rec && cid2col(f->dlg()) == _cur_col;
if (!has_focus)
get_back_and_fore_color(xiev->v.cell_request.back_color,
xiev->v.cell_request.color, rec, col);
}
if (e->has_query_button())
@ -1170,7 +1181,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
if (oldrec != _cur_rec)
{
_row_dirty = _cell_dirty = FALSE;
str2mask(_cur_rec);
on_idle(); // Forces update delayed by str2mask
_cur_rec = record; // Forces correct record (may be changed by on_idle!)
notify(_cur_rec, K_TAB);
@ -1192,6 +1203,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
mask2str(_cur_rec);
on_idle();
}
}
else
@ -1202,16 +1214,28 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
{
TMask_field& button = sm.fld(button_pos);
if (button.active())
{
notify_change();
{
if (!_row_dirty)
{
notify_change();
_row_dirty = _cell_dirty = FALSE;
for (int i = sm.fields() - 1; i >= 0; i--)
sm.fld(i).set_dirty(FALSE);
}
button.on_hit();
if (sm.dirty())
mask2str(_cur_rec);
}
}
owner().highlight();
{
_row_dirty = TRUE;
mask2str(_cur_rec);
}
}
owner().highlight();
}
}
_check_enabled = TRUE;
}
break;
case XIE_DBL_CELL:
@ -1263,7 +1287,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
case XIE_ON_LIST:
owner().mask().notify_focus_field(owner().dlg());
break;
case XIE_OFF_LIST:
case XIE_OFF_LIST:
on_idle();
break;
case XIE_ON_ROW:
@ -1321,7 +1345,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
refused = !notify(_cur_rec, K_CTRL+K_TAB);
_check_enabled = TRUE;
}
}
break;
case XIE_ON_CELL:
if (_check_enabled)
@ -1357,6 +1381,11 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
xi_eh(_obj->itf->v.itf->xvt_win, &e);
#endif
}
XI_OBJ row;
XI_MAKE_ROW(&row, _obj, _cur_row);
xi_cell_request(&row); // Update internal values
}
break;
case XIE_OFF_CELL:
@ -1366,6 +1395,16 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
XI_OBJ* cell = xiev->v.xi_obj;
refused = !off_cell_handler(cell);
_check_enabled = TRUE;
}
if (! refused)
{
const int col = _cur_col;
XI_OBJ row;
_cur_col = -1;
XI_MAKE_ROW(&row, _obj, _cur_row);
xi_cell_request(&row); // Update internal values
_cur_col = col;
}
break;
case XIE_COL_MOVE:
@ -1902,7 +1941,7 @@ void TSpreadsheet::set_back_and_fore_color(COLOR back, COLOR fore, int row, int
}
void TSpreadsheet::get_back_and_fore_color(COLOR& back, COLOR& fore, int row, int col)
{
{
TRow_property* prop = get_property(row, FALSE);
if (prop)
prop->get(col, back, fore);
@ -2680,8 +2719,6 @@ void TSheet_field::sort(ROWS_COMPARE_FUNCTION compare)
}
}
void TSheet_field::set_column_width( const int col, const int width ) const
{
TSpreadsheet* s = (TSpreadsheet*)_ctl;
@ -3107,4 +3144,4 @@ void TSheet_field::set_userget(SHEET_USERGETPUT handler)
void TSheet_field::set_userput(SHEET_USERGETPUT handler)
{
_userput = handler;
}
}

View File

@ -444,7 +444,7 @@ public:
{ _force_progind = b; }
// @cmember Permette di forzare (<p b>=TRUE) o non forzare (<p b>=FALSE) la rilettura delle
// <mf TPrint_application::set_row> in <mf TPirnt_application::set_page> ad ogni
// <mf TPrint_application::set_row> in <mf TPrint_application::set_page> ad ogni
// record stampato, in modo che i dati siano sempre quelli del record corrente
// anche se si usano codici %. Chiaramente la stampa viene un po' rallentata
void force_setpage(bool b = TRUE)
@ -474,6 +474,9 @@ public:
void repeat_print()
{ _repeat_print = TRUE; }
bool need_to_repeat_print()
{ return _repeat_print; }
// @cmember Ritorna se la stampa e' stata interrotta
bool is_cancelled() const
{ return _cancelled; }

View File

@ -801,6 +801,8 @@ class TTree_window : public TField_window
long _first_line; // Prima riga disegnata
TNode_info_array _node_info;
TNode_info _curr_info; // Nodo attualmente selezionato
TAuto_token_string _header;
int _headlines;
static int _row_height;
static bool _tree_locked;
@ -814,6 +816,7 @@ protected: // TWindow
protected: // Internal use
static bool callback_draw_node(TTree& node, void* jolly, word);
void update_header();
void draw_plus_minus();
int info2index(const TNode_info& ni) const;
@ -825,6 +828,7 @@ public:
void hide_leaves(bool yes) { _hide_leaves = yes; }
bool select_current();
bool goto_selected();
void set_header(const char* head);
TTree_window(int x, int y, int dx, int dy,
WINDOW parent, TTree_field* owner);
@ -843,6 +847,7 @@ struct TUpdate_info
long _x, _y;
long _firsty, _lasty;
long _jolly;
int _headlines;
TNode_info_array* _node_info;
TNode_info* _curr_info;
};
@ -850,6 +855,9 @@ struct TUpdate_info
PNT TTree_window::log2dev(long x, long y) const
{
if (_headlines > 0)
y += _headlines;
if (autoscrolling())
{
if (_pixmap)
@ -875,8 +883,13 @@ PNT TTree_window::log2dev(long x, long y) const
return pnt;
}
TPoint TTree_window::dev2log(const PNT& p) const
TPoint TTree_window::dev2log(const PNT& dp) const
{
PNT p = dp;
if (_headlines > 0)
p.v -= _headlines * _row_height;
TPoint pnt(_pixmap ? p.h : p.h/CHARX, _pixmap ? p.v : p.v/_row_height);
return pnt;
}
@ -921,7 +934,7 @@ bool TTree_window::callback_draw_node(TTree& node, void* jolly, word when)
xvt_dwin_draw_set_pos(win, q);
q.h -= TABX*CHARX - 3*CHARX/2;
xvt_dwin_draw_line(win, q);
q.v = (by+1)*_row_height;
q.v = (by+1+ui->_headlines)*_row_height;
xvt_dwin_draw_line(win, q);
TImage* bmp = node.image(is_selected);
@ -1032,6 +1045,26 @@ void TTree_window::draw_plus_minus()
}
}
void TTree_window::set_header(const char* head)
{
_header = head;
_headlines = _header.items();
}
void TTree_window::update_header()
{
if (_headlines > 0)
{
autoscroll(FALSE);
set_brush(MASK_BACK_COLOR);
bar(0,-_headlines,columns(),0);
autoscroll(TRUE);
set_opaque_text(FALSE);
for (int i = 0; i < _headlines; i++)
stringat(2, int(origin().y+i-_headlines), _header.get(i));
}
}
void TTree_window::update()
{
TField_window::update();
@ -1039,6 +1072,8 @@ void TTree_window::update()
if (_tree == NULL)
return;
update_header();
TUpdate_info ui;
ui._win = this;
ui._x = 0;
@ -1046,6 +1081,7 @@ void TTree_window::update()
ui._firsty = origin().y;
ui._lasty = ui._firsty + rows();
ui._jolly = 0;
ui._headlines = _headlines;
ui._node_info = &_node_info;
ui._curr_info = &_curr_info;
@ -1266,9 +1302,9 @@ void TTree_window::handler(WINDOW win, EVENT* ep)
if (_tree && !_tree_locked)
{
_tree_locked = TRUE;
const int c = ep->v.mouse.where.h / CHARX;
const int r = ep->v.mouse.where.v / _row_height;
dev2log(ep->v.mouse.where);
const TPoint lp = dev2log(ep->v.mouse.where);
const int c = (int)lp.x;
const int r = (int)lp.y;
TNode_info ni;
bool ok = index2info(r, ni);
@ -1356,6 +1392,11 @@ bool TTree_field::goto_selected()
return tree_win().goto_selected();
}
void TTree_field::set_header(const char* head)
{
tree_win().set_header(head);
}
TField_window* TTree_field::create_window(int x, int y, int dx, int dy, WINDOW parent)
{
return new TTree_window(x, y, dx, dy, parent, this);

View File

@ -685,6 +685,12 @@ void TStampa_schede_mag::setprint_permagazzini()
cfilter << "(CODMAG[1,3]>=" <<'"' << _mask->get(F_DAMAG)<< "\")&&" ;
if (_mask->get(F_AMAG).not_empty())
cfilter << "(CODMAG[1,3]<=" <<'"' << _mask->get(F_AMAG)<< "\")&&" ;
if (_mask->get(F_DADEP).not_empty())
cfilter << "(CODMAG[4,]>=" <<'"' << _mask->get(F_DADEP)<< "\")&&" ;
if (_mask->get(F_ADEP).not_empty())
cfilter << "(CODMAG[4,]<=" <<'"' << _mask->get(F_ADEP)<< "\")&&" ;
cfilter << "(" << LF_MOVMAG <<"->ANNOES==" <<'"' << _mask->get(F_ANNOES)<< "\")&&" ;
// filtering from/to DATA
if (*_mask->get(F_ADATA))
@ -750,6 +756,12 @@ void TStampa_schede_mag::setprint_perarticoli()
filter << "(" << LF_RMOVMAG << "->CODMAG[1,3]>=" <<'"' << _mask->get(F_DAMAG)<< "\")&&" ;
if (*_mask->get(F_AMAG))
filter << "(" << LF_RMOVMAG << "->CODMAG[1,3]<=" <<'"' << _mask->get(F_AMAG)<< "\")&&" ;
if (_mask->get(F_DADEP).not_empty())
filter << "(" << LF_RMOVMAG << "->CODMAG[4,]>=" <<'"' << _mask->get(F_DADEP)<< "\")&&" ;
if (_mask->get(F_ADEP).not_empty())
filter << "(" << LF_RMOVMAG << "->CODMAG[4,]<=" <<'"' << _mask->get(F_ADEP)<< "\")&&" ;
// filtering from/to DATA
if (_mask->get(F_DADATA).not_empty())
{

View File

@ -17,6 +17,8 @@
#define F_ADES 115
#define F_VALMEDI 116
#define F_STAMPAGIAC 117
#define F_DADEP 118
#define F_ADEP 119
#define F_SUDDIV_MAGAZZINI 123
#define F_SUDDIV_DEPOSITI 124

View File

@ -145,6 +145,33 @@ BEGIN
WARNING "Il secondo estremo deve essere superiore al primo"
END
STRING F_DADEP 3
BEGIN
PROMPT 40 8 "Dal deposito "
FLAGS "U"
USE MAG SELECT CODTAB[4,5]!=""
INPUT CODTAB[1,3] F_DAMAG SELECT
INPUT CODTAB[4,5] F_DADEP
DISPLAY "Magazzino" CODTAB[1,3]
DISPLAY "Deposito" CODTAB[4,5]
DISPLAY "Descr@50" S0
OUTPUT F_DADEP CODTAB[4,5]
END
STRING F_ADEP 3
BEGIN
PROMPT 40 9 " al deposito "
FLAGS "U"
COPY USE F_DADEP
INPUT CODTAB[1,3] F_AMAG SELECT
INPUT CODTAB[4,5] F_ADEP
COPY DISPLAY F_DADEP
OUTPUT F_ADEP CODTAB[4,5]
STR_EXPR (#F_ADEP>=#F_DADEP)||(#F_ADEP=="")
WARNING "Il secondo estremo deve essere superiore al primo"
END
STRING F_DACATMER 3
BEGIN

View File

@ -107,6 +107,16 @@ void TStampa_listamov::setprint_x_mov()
if (anno.not_empty())
filter << '(' << LF_MOVMAG << "->ANNOES==\""<< anno << "\")";
long codcf = _mask->get_long(F_CODCF);
if (codcf != 0)
{
if (filter.not_empty())
filter << " && ";
filter << '(' << LF_MOVMAG << "->TIPOCF==\""<< _mask->get(F_TIPOCF) << "\")";
filter << "&& (" << LF_MOVMAG << "->CODCF==\""<< codcf << "\")";
}
if (_mask->get(F_CAU1).not_empty())
{
_filtrocausali.cut(0);
@ -191,6 +201,17 @@ void TStampa_listamov::setprint_x_art()
if (anno.not_empty())
filter << '(' << LF_MOVMAG << "->ANNOES==\""<< _mask->get(F_ANNOES) << "\")";
long codcf = _mask->get_long(F_CODCF);
if (codcf != 0)
{
if (filter.not_empty())
filter << " && ";
filter << '(' << LF_MOVMAG << "->TIPOCF==\""<< _mask->get(F_TIPOCF) << "\")";
filter << "&& (" << LF_MOVMAG << "->CODCF==\""<< codcf << "\")";
}
if (_mask->get(F_DAARTICOLO).not_empty())
filter << "&&(CODART>=\"" << _mask->get(F_DAARTICOLO) << "\")";

View File

@ -13,3 +13,8 @@
#define F_DAARTICOLO 113
#define F_AARTICOLO 114
#define F_INVERTI 120
#define F_TIPOCF 121
#define F_CODCF 122
#define F_CODCLI 123
#define F_CODFOR 124
#define F_RAGSOC 125

View File

@ -1,5 +1,5 @@
#include "mg4100.h"
PAGE "Stampa lista movimenti" -1 -1 78 18
PAGE "Stampa lista movimenti" -1 -1 80 20
NUMBER F_ANNOES 4
BEGIN
@ -96,9 +96,45 @@ BEGIN
OUTPUT F_AARTICOLO CODART
END
LISTBOX F_TIPOCF 9
BEGIN
PROMPT 2 9 ""
FLAGS "G"
FIELD TIPOCF
ITEM "C|Cliente"
ITEM "F|Fornitore"
END
NUMBER F_CODCF 6
BEGIN
// FLAGS "UHG"
FIELD CODCF
PROMPT 15 9 "Codice "
USE LF_CLIFO
INPUT TIPOCF F_TIPOCF SELECT
INPUT CODCF F_CODCF
DISPLAY "Codice " CODCF
DISPLAY "Ragione sociale@50" RAGSOC
OUTPUT F_CODCF CODCF
OUTPUT F_RAGSOC RAGSOC
CHECKTYPE NORMAL
END
STRING F_RAGSOC 50 45
BEGIN
PROMPT 32 9 ""
USE LF_CLIFO KEY 2
INPUT TIPOCF F_TIPOCF SELECT
INPUT RAGSOC F_RAGSOC
DISPLAY "Ragione sociale@50" RAGSOC
DISPLAY "Codice " CODCF
OUTPUT F_CODCF CODCF
CHECKTYPE NORMAL
END
STRING F_CAU1 5
BEGIN
PROMPT 2 9 "Causale "
PROMPT 2 11 "Causale "
FLAGS "U"
USE %CAU
INPUT CODTAB F_CAU1
@ -113,7 +149,7 @@ END
STRING F_CAU2 5
BEGIN
FLAGS "U"
PROMPT 2 10 "Causale "
PROMPT 2 12 "Causale "
COPY USE F_CAU1
INPUT CODTAB F_CAU2
COPY DISPLAY F_CAU1
@ -126,7 +162,7 @@ END
STRING F_CAU3 5
BEGIN
FLAGS "U"
PROMPT 2 11 "Causale "
PROMPT 2 13 "Causale "
COPY USE F_CAU1
INPUT CODTAB F_CAU3
COPY DISPLAY F_CAU1
@ -139,7 +175,7 @@ END
STRING F_CAU4 5
BEGIN
FLAGS "U"
PROMPT 2 12 "Causale "
PROMPT 2 14 "Causale "
COPY USE F_CAU1
INPUT CODTAB F_CAU4
COPY DISPLAY F_CAU1
@ -152,7 +188,7 @@ END
STRING F_CAU5 5
BEGIN
FLAGS "U"
PROMPT 2 13 "Causale "
PROMPT 2 15 "Causale "
COPY USE F_CAU1
INPUT CODTAB F_CAU5
COPY DISPLAY F_CAU1
@ -165,7 +201,7 @@ END
STRING F_CAU6 5
BEGIN
FLAGS "U"
PROMPT 2 14 "Causale "
PROMPT 2 16 "Causale "
COPY USE F_CAU1
INPUT CODTAB F_CAU6
COPY DISPLAY F_CAU1

View File

@ -776,7 +776,7 @@ TLavorazione& TLav_finder::art2lav(const TCodice_articolo& art)
TArray boom;
tree.set_root(art);
tree.explode(boom, FALSE, RAGGR_EXP_UMBASE, 1, "L");
TString16 codlav;
TString80 codlav;
if (boom.items() > 0)
codlav = ((TRiga_esplosione&)boom[0]).articolo();
lav = new TLavorazione(codlav);
@ -986,7 +986,7 @@ int TMatResMask::num_orders()
}
bool TMatResMask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
const char * confirm_msg="Le attuali %d righe di ordine verranno perse. Confermi ?";
const char * confirm_msg="Le attuali %d righe di ordine verranno perse. Confermare?";
switch (o.dlg())
{
case F_DADATA:
@ -2936,7 +2936,7 @@ bool TMatResPlanning::emit_orders()
if (datadoc < today && newdoc)
if (ignore_docdate_too_soon != K_ENTER && ignore_docdate_too_soon != K_ESC)
{
TYesnoallnone_box b(format("Riga %d: data di emissione del documento (%s) inferiore a quella odierna. Confermi ?",r+1,(const char *)datadoc.string()), K_NO);
TYesnoallnone_box b(format("Riga %d: data di emissione del documento (%s) inferiore a quella odierna. Confermare?",r+1,(const char *)datadoc.string()), K_NO);
ignore_docdate_too_soon = b.run();
}
if (ignore_docdate_too_soon == K_NO || ignore_docdate_too_soon == K_ESC)
@ -2944,7 +2944,7 @@ bool TMatResPlanning::emit_orders()
if (datacon < datadoc && newdoc)
if (ignore_duedate_lt_docdate != K_ENTER && ignore_duedate_lt_docdate != K_ESC)
{
TYesnoallnone_box b(format("Riga %d: data di consegna (%s) inferiore a quella di emissione del documento (%s). Confermi ?",r+1,(const char *)datacon.string(), (const char *)datadoc.string()), K_NO);
TYesnoallnone_box b(format("Riga %d: data di consegna (%s) inferiore a quella di emissione del documento (%s). Confermare?",r+1,(const char *)datacon.string(), (const char *)datadoc.string()), K_NO);
ignore_duedate_lt_docdate = b.run();
}
if (ignore_duedate_lt_docdate == K_NO || ignore_duedate_lt_docdate == K_ESC)

View File

@ -344,6 +344,7 @@ SECTION CLIENTI 2 0 0 FILE LF_PROVV GROUP CODAGE
PROMPT 6 1 ""
PICTURE "##@,@#"
MESSAGE _NUMEXPR,#104/#103*100
END
VALUTA 106 15
BEGIN
@ -421,8 +422,9 @@ SECTION CLIENTI 2 0 0 FILE LF_PROVV GROUP CODAGE
BEGIN
KEY "perc provv"
PROMPT 6 1 ""
PICTURE "##@,@#"
MESSAGE _NUMEXPR,#104/#103*100
PICTURE "##@,@@"
MESSAGE _NUMEXPR,IF(#103==0,0,#104*100/#103)
END
VALUTA 106 15
BEGIN
@ -488,8 +490,8 @@ SECTION CLIENTI 2 0 0 FILE LF_PROVV GROUP CODAGE
BEGIN
KEY "PERCENTUALE"
prompt 6 1 ""
PICTURE "##@,@#"
MESSAGE _NUMEXPR,#204/#203*100
PICTURE "##@,@@"
MESSAGE _NUMEXPR,IF(#203==0,0,#204*100/#203)
END
VALUTA 206 15
BEGIN
@ -564,8 +566,9 @@ SECTION CLIENTI 2 0 0 FILE LF_PROVV GROUP CODAGE
BEGIN
KEY "IMPORTO"
PROMPT 6 1 ""
PICTURE "##@,@#"
MESSAGE _NUMEXPR,#304/#303*100
PICTURE "##@,@@"
MESSAGE _NUMEXPR,IF(#303==0,0,#304*100/#303)
END
VALUTA 306 15
BEGIN
@ -627,8 +630,9 @@ END // end clienti
BEGIN
KEY "IMPORTO"
PROMPT 6 2 ""
PICTURE "##@,@#"
MESSAGE _NUMEXPR,#404/#403*100
PICTURE "##@,@@"
MESSAGE _NUMEXPR,IF(#403==0,0,#404*100/#403)
GROUP G_TOTAGE
END
VALUTA 406 15
@ -661,4 +665,4 @@ END // Fine body
SECTION FOOTER ODD 3
END // Fine footer
END // Fine Form
END // Fine Form

View File

@ -1331,7 +1331,7 @@ long TStampaEC_application::find_agents_games(TAssoc_array& agents)
curr.put(SCAD_TIPOCF, mask().get(SC_CLIFO));
TString filter;
if (!mask().get_bool(F_STAMPCHIU))
filter << "(PAGATA==\"\")";
filter << "PAGATA!=\"X\"";
TCursor cur(&rel, filter, 1, &curr, &curr);
const long items = cur.items();
cur.freeze();

View File

@ -689,20 +689,6 @@ BEGIN
FIELD I1
END
STRING F_QTACON 10
BEGIN
PROMPT 2 20 "Quantita' da evad. "
FLAGS "U"
FIELD S1[50,59]
END
STRING F_QTAEV 10
BEGIN
PROMPT 40 20 "Quantita' evasa "
FLAGS "U"
FIELD S1[60,69]
END
ENDPAGE
ENDMASK

View File

@ -2,4 +2,14 @@
#define QAPPNAME "eurocampo"
#define QFIRMNAME "A.G.A. Informatica Srl"
#include <default.url>
#include <mainmenu.url>
MENUBAR TASK_MENUBAR
MENU TASK_MENUBAR
SUBMENU M_FILE "~File"
/* SUBMENU M_EDIT "~Modifica" Unsupported! */
SUBMENU M_FONT "~Opzioni"
SUBMENU M_HELP "~Help"
MENU M_FONT
ITEM MENU_ITEM(1) "~Colori righe"

View File

@ -2,6 +2,7 @@
#include <defmask.h>
#include <tabutil.h>
#include <utility.h>
#include <urldefid.h>
#include "ve0100.h"
#include "veini.h"
@ -224,10 +225,36 @@ int TMotore_application::read( TMask& m )
_tipodoc = m.get(F_TIPODOC);
((TDocumento_mask &)m).doc2mask();
COLOR high_back_color = _sel_color->get_back_color(_link_pos);
COLOR high_color = _sel_color->get_fore_color(_link_pos);
((TDocumento_mask &)m).highlight(high_back_color, high_color);
return NOERR;
}
bool TMotore_application::menu(MENU_TAG mt)
{
bool ok = TRUE;
if (mt == MENU_ITEM(1))
{
_sel_color->run();
COLOR high_back_color = _sel_color->get_back_color(_link_pos);
COLOR high_color = _sel_color->get_fore_color(_link_pos);
if (!query_mask().is_running())
{
TDocumento_mask * m = (TDocumento_mask * ) &edit_mask();
if (m != NULL)
m->highlight(high_back_color, high_color);
}
}
else
ok = TRelation_application::menu(mt);
return ok;
}
int TMotore_application::write( const TMask& m ) // C 90
{
TDocumento& d = (TDocumento&) _rel->curr();
@ -267,7 +294,9 @@ bool TMotore_application::user_create( )
_rel->lfile().set_curr(new TDocumento);
_msk = new TMask("ve0100a");
_sel_color = new TSelect_color_mask("ve0100a", "0");
set_search_field(F_NDOC);
_link_pos =_sel_color->add_color_def("LINKED", "Righe collegate a documento", COLOR_YELLOW, COLOR_BLACK);
_msk->set_handler( F_CODNUM, TDocumento_mask::num_handler );
_msk->set_handler( F_TIPODOC, TDocumento_mask::tip_handler );
@ -293,6 +322,9 @@ bool TMotore_application::user_destroy( )
if ( _msk != NULL )
delete _msk;
if ( _sel_color != NULL )
delete _sel_color;
// Distruggo la relazione
delete _rel;
// delete _condv;
@ -427,7 +459,7 @@ void TMotore_application::ini2mask(TConfig& ini, TMask& msk, bool query)
// l'autoload ??
f.insert(-1, FALSE);
// Aggiunge la riga allo sheet
rec.autoload(f);
((TDocumento_mask &) msk).autoload(f.items());
f.check_row(f.items()-1, 0x2);
}
}

View File

@ -33,10 +33,13 @@ class TMotore_application : public TRelation_application
// Array di maschere documento
TAssoc_array _doc_masks;
TSelect_color_mask * _sel_color;
int _link_pos;
// Ridefinizione dei metodi virtuali
virtual bool user_create( );
virtual bool user_destroy( );
virtual bool menu(MENU_TAG mt);
virtual TMask* get_mask( int mode );
virtual bool changing_mask( int mode );
virtual void init_query_mode(TMask& m);

View File

@ -177,7 +177,7 @@ BEGIN
OUTPUT F_DATADOC_ELAB DATADOC
OUTPUT F_CODNUM_ELAB CODNUM
OUTPUT F_NDOC_ELAB NDOC
CHECKTYPE NORMAL
CHECKTYPE SEARCH
WARNING "Documento inesistente o incompatibile"
ADD RUN ve0 -1
MESSAGE EMPTY SHOW,F_DATADOC_ELAB

View File

@ -266,10 +266,6 @@ protected:
// Genera un campo a partire da una linea del file VE0300A.DAT
void genera_campo( TToken_string _line );
// Genera un campo dello sheet a partire da una linea del file VE0300B.DAT
void genera_campo_sheet( TToken_string _line );
// Genera la colonna dello sheet a partire da una linea del file VE0300B.DAT
void genera_item_sheet( TToken_string _line );
@ -1029,16 +1025,6 @@ void TMask_generator::carica_tabella( const TFilename& fn, TString_array& tabell
}
}
void TMask_generator::genera_campo_sheet( TToken_string _line )
{
const int type( _line.get_int( B_MSKTYPE ) );
_m->control( type, id( ), _line.get_int( B_MSKSIZE ) );
_m->begin( );
_m->prompt( 2, 2 );
_m->field( _line.get( B_NOME ) );
_m->end( );
}
void TMask_generator::genera_item_sheet( TToken_string _line )
{
_m->_out << "IT \"" << _line.get( B_DESCR );

View File

@ -307,10 +307,10 @@ error_type TContabil_tsys::write_all(TDocumento& doc, TMovimentoPN_VE & moviment
TRectype cp = cache().get("%CPG", doc.get("CODPAG"));
TString16 codpag(cp.get("I9"));
if (codpag.empty())
codpag = doc.get("CODPAG");
// if (codpag.empty())
// codpag = doc.get("CODPAG");
codpag = codpag.sleft(3).lpad(3);
codpag = codpag.sleft(3).lpad(3, '0');
row << codpag;
work = doc.get("CODABIA").sleft(5).rpad(5);
work << doc.get("CODCABA").sleft(5).rpad(5);

View File

@ -68,7 +68,7 @@ Item_09 = "Lingue", "ba3 -0 %LNG", ""
Item_10 = "Divise", "ba3 -0 %VAL", ""
Item_11 = "Cambi giornalieri", "ba3 -0 CAM", "F"
Item_12 = "Esercizi", "cg0 -5 esc", "F"
Item_13 = "Commesse", "ba3 -0 cms", "F"
Item_13 = "CDC/Commesse", "ba3 -0 cms", "F"
Item_14 = "Fasi commesse", "ba3 -0 fsc", "F"
[ACQVEN_006]

View File

@ -37,11 +37,10 @@ class TViswin;
#include "../mg/mglib.h"
#endif
#ifndef __VISWIN_H
class TViswin;
#ifndef __COLMASK_H
#include <colmask.h>
#endif
#ifndef __DOC_H
#include <doc.h>
#endif
@ -246,9 +245,11 @@ class TTipo_documento : public TRectype // velib03
TString16 _totvalore;
TString16 _totale_cont;
TString16 _field_prezzo;
TString16 _field_qta, _field_qtaevasa; // Veri campi Quantità e Quantità Evasa
TString _str_desc_doc, _str_desc_rdoc;
char _tipocf;
bool _cnt_prezzi;
bool _cnt_prezzi, _show_evaded_lines;
protected:
void read_formule();
@ -258,8 +259,7 @@ public:
TObject* dup() const { return new TTipo_documento(codice()); }
public:
const TString& profile_name() const { return get("S4");}
//TConfig& profile() const;
const TString& profile_name() const { return get("S4"); }
// Funzioni che effettuano la cache di importanti valori contenuti nel profilo
const char tipocf();
@ -278,7 +278,9 @@ public:
bool is_bolla() const { return tipo() == _bolla; }
bool is_ordine() const { return tipo() == _ordine; }
bool controllo_prezzi() const { return _cnt_prezzi; }
const char * field_prezzo() const { return _field_prezzo; }
const TString& field_prezzo() const { return _field_prezzo; }
const TString& field_qta() const { return _field_qta; }
const TString& field_qtaevasa() const { return _field_qtaevasa; }
const TString & descrizione() const { return get("S0"); }
const TString & riferimento(const TDocumento & doc) const ;
@ -322,6 +324,10 @@ public:
bool calcolo_lordo() const { return get_bool("B8"); }
bool fattura_commerciale() const { return get_bool("B9"); }
const TString& stringa_descrizione_documento() const { return _str_desc_doc; }
const TString& stringa_descrizione_riga() const { return _str_desc_rdoc; }
bool mostra_righe_evase_in_elaborazione() const { return _show_evaded_lines; }
TTipo_documento(const char* tipodoc = NULL);
TTipo_documento(const TRectype& rec);
virtual ~TTipo_documento();
@ -439,7 +445,8 @@ public:
bool is_evadibile() const { return is_merce() || is_omaggio() || is_spese() || is_prestazione(); }
void checked(bool on = TRUE) { put(RDOC_CHECKED, (bool)on); }
void unchecked() { checked(FALSE); }
// @cmember Assegna il documento corrente
bool linked() const { return get(RDOC_DACODNUM).not_empty();}
// @cmember Assegna il documento corrente
void set_doc(TDocumento * doc) { _doc = doc; }
const TDocumento & doc() const { CHECK(_doc, "Documento nullo"); return *_doc;}
@ -591,8 +598,7 @@ protected:
void dirty_tabella_iva() { _tabella_iva.destroy();}
static void test_firm();
const TString& codiva_spese() const ;
const TString& codiva_bolli() const ;
void init();
void check_modules();
@ -600,6 +606,9 @@ protected:
int set_row_ids();
public:
const TString& codiva_spese() const ;
const TString& codiva_bolli() const ;
TCodgiac_livelli & livelli() const ;
void dirty_fields();
@ -699,7 +708,7 @@ public:
real calc_conai_qta(int type);
void update_conai();
bool is_generic() const { return tipo_valido() && tipo().is_generic(); }
bool is_generic() const { return tipo_valido() && tipo().is_generic(); }
bool is_fattura() const { return tipo_valido() && tipo().is_fattura(); }
bool is_bolla() const { return tipo_valido() && tipo().is_bolla(); }
bool is_ordine() const { return tipo_valido() && tipo().is_ordine(); }
@ -796,6 +805,8 @@ public:
static bool numdocrif_search_handler( TMask_field& f, KEY key );
static bool datadocrif_handler(TMask_field& f, KEY key);
void highlight(COLOR high_back_color, COLOR high_color);
TDocumento_mask(const char* tipodoc);
virtual ~TDocumento_mask();
};

View File

@ -380,8 +380,12 @@ bool TRiga_documento::raggruppabile(const TRiga_documento& r, TToken_string& cam
}
TRiga_documento& TRiga_documento::operator +=(const TRiga_documento& r)
{
TToken_string campi("QTA|NCOLLI|QTAEVASA");
{
const TTipo_documento& tipo = doc().tipo();
TToken_string campi("NCOLLI");
campi.add(tipo.field_qta());
campi.add(tipo.field_qtaevasa());
for (const char* c = campi.get(0); c; c = campi.get())
{
real num = r.get_real(c);
@ -392,10 +396,8 @@ TRiga_documento& TRiga_documento::operator +=(const TRiga_documento& r)
}
}
if (!get_bool("RIGAEVASA"))
{
const real qta = get_real("QTA");
const real qtaeva = get_real("QTAEVASA");
if (qtaeva >= qta)
{
if (qtaresidua().is_zero())
put("RIGAEVASA", "X");
}
@ -478,9 +480,6 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
case 'Q':
c = _qtaprezzo;
break;
case 'V':
c = _valore;
break;
case 'P':
{
const TString16 field_perc(s.field_perc());
@ -488,7 +487,9 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
r1 = doc().get_real(field_perc);
}
break;
case 'V':
default:
c = _valore;
break;
}
}
@ -628,10 +629,12 @@ real TRiga_documento::provvigione(int ndec) const
real TRiga_documento::qtaresidua() const
{
real val;
if (!get_bool(RDOC_RIGAEVASA))
{
val = get_real(RDOC_QTA) - get_real(RDOC_QTAEVASA);
const TTipo_documento& tipo = doc().tipo();
const real qta = get_real(tipo.field_qta());
const real qtaeva = get_real(tipo.field_qtaevasa());
val = qta - qtaeva;
if (val < ZERO)
val = ZERO;
}

View File

@ -444,485 +444,6 @@ public:
HIDDEN TAgenti_cache _agenti;
/*
///////////////////////////////////////////////////////////
// Espressione documento
///////////////////////////////////////////////////////////
TExpr_documento::TExpr_documento(const char* expression, TTypeexp type,
TDocumento * doc, TRiga_documento * row)
: TExpression(type), _doc(doc), _row(row)
{
if (!set(expression, type))
error_box("Wrong expression : '%s'", expression);
}
int TExpr_documento::parse_user_func(const char * name, int nparms) const
{
if (strcmp(name, "SOMMA") == 0)
return nparms > 0 || nparms < 3 ? _somma : -1;
if (strcmp(name, "BOLLI") == 0)
return nparms > 0 || nparms < 4 ? _bolli : -1;
if (strcmp(name, "_BOLLI") == 0)
return nparms > 0 || nparms < 3 ? _bolli_int : -1;
if (strcmp(name, "SPESEINC") == 0)
return nparms > 0 || nparms < 4 ? _spinc : -1;
if (strcmp(name, "PREZZO") == 0)
return nparms < 4 ? _prezzo : -1;
if (strcmp(name, "IMPORTO") == 0)
return nparms < 4 ? _importo : -1;
if (strcmp(name, "SCONTO") == 0)
return nparms < 2 ? _sconto : -1;
if (strcmp(name, "IMPONIBILE") == 0)
return nparms == 0 ? _imponibile : -1;
if (strcmp(name, "IVA") == 0)
return nparms == 0 ? _iva : -1;
if (strcmp(name, "PROVV") == 0)
return nparms < 2 ? _provv : -1;
if (strcmp(name, "QTARES") == 0)
return nparms < 2 ? _qtares : -1;
if (strcmp(name, "VALDOC") == 0)
return nparms < 3 ? _valdoc : -1;
if (strcmp(name, "TIPO") == 0)
return nparms == 0 ? _tipo : -1;
if (strcmp(name, "IMPONIBILI") == 0)
return nparms < 3 ? _imponibili : -1;
if (strcmp(name, "IMPOSTE") == 0)
return nparms < 3 ? _imposte : -1;
if (strcmp(name, "TOTPROVV") == 0)
return nparms < 3 ? _totprovv : -1;
if (strcmp(name, "PSCONTOT") == 0)
return nparms < 1 ? _pscontot : -1;
if (strcmp(name, "RITENUTA") == 0)
return nparms < 3 ? _ritenuta : -1;
if (strcmp(name, "TIPORIT") == 0)
return nparms < 1 ? _tipo_ritenuta : -1;
return -1;
}
void TExpr_documento::evaluate_user_func(int index, int nparms, TEval_stack & stack, TTypeexp type) const
{
switch (index)
{
case _somma:
{
const TString cond(nparms == 2 ? stack.pop_string() : "STR(1)");
const TString & field = stack.pop_string();
real somma;
if (_doc != NULL)
{
TExpr_documento cond_expr(cond, _strexpr, _doc);
const int cond_nvars = cond_expr.numvar();
TExpr_documento expr(field, _numexpr, _doc);
const int nvars = expr.numvar();
const int nrows = _doc->rows();
for (int i = nrows; i > 0; i--)
{
TRiga_documento & riga = (TRiga_documento &) (*_doc)[i];
for (int j = cond_nvars - 1; j >= 0; j--)
{
const char* s = cond_expr.varname(j);
TFieldref f(s,0);
cond_expr.setvar(j, f.read(riga));
}
cond_expr.set_row(&riga);
if ((bool)cond_expr)
{
for (j = nvars - 1; j >= 0; j--)
{
const char* s = expr.varname(j);
TFieldref f(s,0);
expr.setvar(j, f.read(riga));
}
expr.set_row(&riga);
somma += expr.as_real();
}
}
}
stack.push(somma);
}
break;
case _spinc:
{
int ndec = AUTO_DECIMALS;
bool netto = FALSE;
if (nparms > 2)
ndec = (int) stack.pop_real().integer();
if (nparms > 1)
netto = !stack.pop_real().is_zero();
real & r = stack.peek_real();
if (_doc)
r = _doc->spese_incasso(r, ndec, netto ? _netto : _lordo);
else
r = ZERO;
}
break;
case _bolli:
{
int ndec = AUTO_DECIMALS;
bool netto = FALSE;
if (nparms > 2)
ndec = (int) stack.pop_real().integer();
if (nparms > 1)
netto = !stack.pop_real().is_zero();
real & r = stack.peek_real();
if (_doc)
{
r += _doc->spese_incasso(r, ndec);
r = _doc->bolli(r, ndec, netto ? _netto : _lordo);
}
else
r = ZERO;
}
break;
case _bolli_int:
{
int ndec = AUTO_DECIMALS;
if (nparms > 2)
ndec = (int) stack.pop_real().integer();
real & r = stack.peek_real();
if (_doc)
{
real r1 = _doc->spese_incasso(r, ndec);
r += r1;
r1 += _doc->bolli(r, ndec);
r = r1;
}
else
r = ZERO;
}
break;
case _prezzo:
{
int ndec = AUTO_DECIMALS;
bool lordo = FALSE;
bool scontato = FALSE;
if (nparms > 2)
ndec = (int) stack.pop_real().integer();
if (nparms > 1)
lordo = !stack.pop_real().is_zero();
if (nparms > 0)
scontato = !stack.peek_real().is_zero();
else
stack.push(ZERO);
real & val = stack.peek_real();
if (_row)
val = _row->prezzo(scontato, lordo, ndec);
else
val = ZERO;
}
break;
case _importo:
{
int ndec = AUTO_DECIMALS;
bool lordo = FALSE;
bool scontato = FALSE;
if (nparms > 2)
ndec = (int) stack.pop_real().integer();
if (nparms > 1)
lordo = !stack.pop_real().is_zero();
if (nparms > 0)
scontato = !stack.peek_real().is_zero();
else
stack.push(ZERO);
real & val = stack.peek_real();
if (_row)
val = _row->importo(scontato, lordo, ndec);
else
val = ZERO;
}
break;
case _imponibile:
{
real r;
if (_row)
r = _row->imponibile();
stack.push(r);
}
break;
case _sconto:
{
int ndec = AUTO_DECIMALS;
if (nparms > 0)
ndec = (int) stack.peek_real().integer();
else
stack.push(ZERO);
real & val = stack.peek_real();
if (_row)
{
if (_row->is_sconto())
val = -_row->importo(FALSE, FALSE, ndec);
else
val = _row->importo(FALSE, FALSE, ndec) - _row->importo(TRUE, FALSE, ndec);
}
else
val = ZERO;
}
break;
case _iva:
{
real r;
if (_row)
r = _row->imposta();
stack.push(r);
}
break;
case _provv:
{
int ndec = AUTO_DECIMALS;
if (nparms > 0)
ndec = (int) stack.peek_real().integer();
else
stack.push(ZERO);
real & val = stack.peek_real();
if (_row)
val = _row->provvigione(ndec);
else
val = ZERO;
}
break;
case _qtares:
{
int ndec = AUTO_DECIMALS;
if (nparms > 0)
ndec = (int) stack.peek_real().integer();
else
stack.push(ZERO);
real & val = stack.peek_real();
if (_row)
val = _row->qtaresidua();
else
val = ZERO;
}
break;
case _valdoc:
{
int ndec = AUTO_DECIMALS;
bool totale = TRUE; // Totale o residuo per documento
if (nparms > 1)
ndec = (int)stack.pop_real().integer();
if (nparms > 0)
totale = !stack.peek_real().is_zero();
else
stack.push(ZERO);
real & r = stack.peek_real();
if (_doc)
r = _doc->valore(totale, ndec);
else
r = ZERO;
}
break;
case _tipo:
{
TString s;
if (_row)
s << _row->tipo().tipo();
stack.push(s);
}
break;
case _imponibili:
{
int ndec = AUTO_DECIMALS;
bool spese = FALSE;
if (nparms > 1)
ndec = (int) stack.pop_real().integer();
if (nparms > 0)
spese = !stack.peek_real().is_zero();
else
stack.push(ZERO);
real & val = stack.peek_real();
val = _doc->imponibile(spese, ndec);
}
break;
case _imposte:
{
int ndec = AUTO_DECIMALS;
bool spese = FALSE;
if (nparms > 1)
ndec = (int) stack.pop_real().integer();
if (nparms > 0)
spese = !stack.peek_real().is_zero();
else
stack.push(ZERO);
real & val = stack.peek_real();
val = _doc->imposta(spese, ndec);
}
break;
case _totprovv:
{
int ndec = AUTO_DECIMALS;
if (nparms > 0)
ndec = (int) stack.peek_real().integer();
else
stack.push(ZERO);
real & val = stack.peek_real();
val = _doc->provvigione(ndec);
}
break;
case _pscontot:
{
real val;
TString80 s;
if (_doc && scontoexpr2perc(_doc->get(DOC_SCONTOPERC), FALSE, s, val) && val != ZERO)
val = 1 - val;
stack.push(val);
}
break;
case _ritenuta:
{
int ndec = AUTO_DECIMALS;
bool lordo = FALSE;
if (nparms > 1)
ndec = (int) stack.pop_real().integer();
if (nparms > 0)
lordo = !stack.peek_real().is_zero();
else
stack.push(ZERO);
real & val = stack.peek_real();
const bool spesa = _row->tipo().tipo() == 'S';
if (spesa)
{
const bool tipo_rit = _row->spesa().tipo_ritenuta();
if (tipo_rit != '\0')
{
((TSpesa_prest &)_row->spesa()).zero("S9");
_row->dirty_fields();
val = _row->importo(TRUE, lordo, ndec);
_row->dirty_fields();
((TSpesa_prest &)_row->spesa()).put("S9", (char)tipo_rit);
}
else
val = ZERO;
}
else
val = ZERO;
}
break;
case _tipo_ritenuta:
{
TString s;
if (_row && _row->tipo().tipo() == 'S')
s << _row->spesa().tipo_ritenuta();
stack.push(s);
}
break;
default:
TExpression::evaluate_user_func(index, nparms, stack, type);
break;
}
}
TObject* TExpr_documento::dup() const
{
TExpr_documento* o = new TExpr_documento(*this);
return o;
}
///////////////////////////////////////////////////////////
// Formula documento
///////////////////////////////////////////////////////////
TFormula_documento::TFormula_documento(TTipo_formula tipo, const char* codice, const char * expr, bool numexpr)
: TRectype(LF_TABCOM), _expr(NULL)
{
_tab = tipo == _documento ? "FRD" : "FRR";
settab(_tab);
_tab.insert("%");
if (codice && *codice)
read(codice, expr, numexpr);
}
TFormula_documento::TFormula_documento(const TRectype& rec)
: TRectype(rec), _expr(NULL)
{
_tab = "%";
_tab << rec.get("COD");
const TTypeexp et = expr_type();
_expr = new TExpr_documento(expr_string(), et);
}
TFormula_documento::~TFormula_documento()
{
if (_expr) delete _expr;
}
int TFormula_documento::read(const char* codice, const char * expr, bool numexpr)
{
if (_expr != NULL)
{
delete _expr;
_expr = NULL;
}
put("CODTAB", codice);
int err = NOERR;
if (expr && *expr)
{
put("S1", expr);
put("B0", numexpr ? "X" : "");
}
else
{
TTable t(_tab);
err = TRectype::read(t);
}
if (err == NOERR)
{
const TTypeexp et = expr_type();
const TString e = expr_string(); // Copio espressione proveniente da record
_expr = new TExpr_documento(e, et);
}
else
{
zero();
put("CODTAB", codice);
}
return err;
}
*/
///////////////////////////////////////////////////////////
// Documento per vendite
///////////////////////////////////////////////////////////
@ -1001,13 +522,12 @@ TDocumento::~TDocumento()
if (_esenzione != NULL) delete _esenzione;
}
inline const TString& TDocumento::codiva_spese() const
const TString& TDocumento::codiva_spese() const
{ ((TDocumento *)this)->test_firm(); return _codiva_spese;}
inline const TString& TDocumento::codiva_bolli() const
const TString& TDocumento::codiva_bolli() const
{ ((TDocumento *)this)->test_firm(); return _codiva_bolli;}
void TDocumento::check_modules()
{
if (_has_mag == 3)
@ -1115,7 +635,7 @@ void TDocumento::iva_esente(TString & codiva_es) const
for (int r = 1; codiva_es.empty() && r <= rows; r++)
{
const TRiga_documento& riga = ((TDocumento*)this)->row(r);
const TString16 str_codiva(riga.get(RDOC_CODIVA));
const TString16 str_codiva(riga.get(RDOC_CODIVA));
if (str_codiva.not_empty())
{
@ -2664,7 +2184,7 @@ TPagamento& TDocumento::pagamento()
if (data_in.empty())
data_in = get_date(DOC_DATADOC);
TString16 codpag(get(DOC_CODPAG));
const TString8 codpag(get(DOC_CODPAG));
if (codpag != _pag.code())
{
_pag.set_code(codpag);
@ -2682,28 +2202,26 @@ TPagamento& TDocumento::pagamento()
real TDocumento::provvigione(int ndec) const
{
real val;
if (ndec == AUTO_DECIMALS)
ndec = decimals();
TString16 field(agente().campoprovv());
TString16 field = agente().campoprovv();
if (field.empty())
field = tipo().totprovv();
real val;
if (field.not_empty())
return get_real(field);
val = get_real(field);
else
{
if (ndec == AUTO_DECIMALS)
ndec = decimals();
for (int i = rows(); i > 0; i--)
val += ((TRiga_documento &) ((TDocumento *)this)->row(i)).provvigione(ndec);
}
return val;
}
real TDocumento::valore(bool totale, int ndec) const
{
real val;
for (int i=rows(); i>0; i--)
{
TRiga_documento &r = ((TRiga_documento &) ((TDocumento *)this)->row(i));

View File

@ -3,7 +3,7 @@
#include "velib.h"
#include "vepriv.h"
///////////////////////////////////////////////////////////
///////////////// //////////////////////////////////////////
// Tipo documento
///////////////////////////////////////////////////////////
@ -57,12 +57,11 @@ const TString & TTipo_documento::riferimento(const TDocumento & doc) const
{
static TString __rif;
__rif = get("S1");
int p = __rif.find('[');
int p = __rif.find('{');
while (p >= 0)
{
const int last = __rif.find(']');
const int last = __rif.find('}');
const TString16 field_name(__rif.sub(p + 1, last));
const TFieldref field(field_name, LF_DOC);
if (last < 0)
@ -86,7 +85,7 @@ const TString & TTipo_documento::riferimento(const TDocumento & doc) const
__rif.insert(field.read(rec), p);
}
p = __rif.find('[');
p = __rif.find('{');
}
return __rif;
}
@ -296,8 +295,14 @@ void TTipo_documento::read_formule()
_formule_documento.add(campo, new TFormula_documento(_documento, campo, "TOTPROVV()"), TRUE);
}
_totale_cont = prof.get("TOTALECONT", "MAIN");
_cnt_prezzi = prof.get_bool("CONTROLLO_PREZZI", "MAIN");
_field_prezzo = prof.get("PREZZO", "MAIN");
_cnt_prezzi = prof.get_bool("CONTROLLO_PREZZI");
_field_prezzo = prof.get(RDOC_PREZZO, "MAIN", -1, RDOC_PREZZO);
_field_qta = prof.get(RDOC_QTA, "MAIN", -1, RDOC_QTA);
_field_qtaevasa = prof.get(RDOC_QTAEVASA, "MAIN", -1, RDOC_QTAEVASA);
_str_desc_doc = prof.get("DESCRIZIONE_DOC");
_str_desc_rdoc = prof.get("DESCRIZIONE_RDOC");
_show_evaded_lines = !prof.get_bool("NASCONDI_RIGHE_EVASE"); // Normalmente mostra anche evase
}
bool TTipo_documento::stato_with_mov_mag(const char stato) const

View File

@ -555,7 +555,6 @@ void TLista_elaborazioni::update()
{
delete _elab; _elab = NULL;
read();
}
TLista_elaborazioni::~TLista_elaborazioni()

View File

@ -1356,8 +1356,6 @@ error_type TContabilizzazione::search_costo_ricavo(TBill& conto, const TRiga_doc
return _error;
}
void TContabilizzazione::calculate_spese(real& spese, real& sp_iva, int ndec, bool is_incasso, bool is_cli, const TString & codiva_es, const TDocumento & doc)
{
const TBill& zio = is_incasso ? (is_cli ? _spin_billv : _spin_billa) : (is_cli ? _spbo_billv : _spbo_billa);
@ -1392,17 +1390,16 @@ error_type TContabilizzazione::add_spese_inbo(TDocumento& doc, const int ndec)
// Aggiunge le spese d'incasso
tot_netto = doc.totale_netto();
sp_incasso = doc.spese_incasso(tot_netto,ndec,_netto);
TString16 codiva_es;
doc.iva_esente(codiva_es);
if (sp_incasso != 0.0)
calculate_spese(sp_incasso,iva_sp_incasso,ndec,TRUE,is_cli, codiva_es, doc);
calculate_spese(sp_incasso,iva_sp_incasso,ndec,TRUE,is_cli, doc.codiva_spese(), doc);
// Aggiunge le spese bolli
tot_netto += sp_incasso + iva_sp_incasso;
sp_bolli = doc.bolli(tot_netto,ndec, _netto);
if (sp_bolli != 0)
calculate_spese(sp_bolli, iva_sp_bolli, ndec, FALSE, is_cli, "", doc);
calculate_spese(sp_bolli, iva_sp_bolli, ndec, FALSE, is_cli, doc.codiva_bolli(), doc);
return _error;
}
@ -3207,4 +3204,4 @@ bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& /*
delete _viswin; _viswin = NULL;
return _can_write; // Se non ha riscontrato errori per nessun documento, _can_write = TRUE
}
}

View File

@ -1,6 +1,6 @@
#include "velib04d.h"
TOOLBAR "Toolbar" 0 20 0 0
TOOLBAR "Toolbar" 0 -2 0 2
BUTTON DLG_OK 10 2
BEGIN

View File

@ -1,12 +1,12 @@
#include <applicat.h>
#include <automask.h>
#include <defmask.h>
#include <dongle.h>
#include <modaut.h>
#include <sheet.h>
#include <tabutil.h>
#include <tree.h>
#include <postman.h>
#include <urldefid.h>
#include "velib.h"
#include "vepriv.h"
@ -246,14 +246,12 @@ void TDocumento_mask::configura_sheet(TSheet_field& sheet)
if (descr.not_empty() )
sheet.set_column_header( field_id, descr);
const int size = sheet_col.get_int(2);
const int size = sheet_col.get_int(2) * 8; // XI_FU_MULTIPLE
if (size != 0)
sheet.set_column_width( field_id, size);
if (field_id != FR_LORDO || tdoc.calcolo_lordo())
colonne.add(field_id);
if (size != 0)
colonne << ',' << size;
}
if (tdoc.calcolo_lordo())
@ -682,7 +680,6 @@ void TDocumento_mask::doc2mask(bool reload_clifo)
TSheet_field& s = sfield(F_SHEET);
s.destroy( );
const int righe = doc().physical_rows();
for (int i = 0; i < righe; i++)
{
@ -987,7 +984,8 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
TMask & sm = ss.sheet_mask();
set_curr_um(sm);
m.update_giacenza();
sm.enable(DLG_USER, doc[r + 1].get(RDOC_DACODNUM).not_empty());
const bool on = doc[r + 1].get(RDOC_DACODNUM).not_empty();
sm.enable(DLG_USER, on);
}
return TRUE;
@ -1099,6 +1097,23 @@ bool TDocumento_mask::clifo_handler( TMask_field& f, KEY key )
return TRUE;
}
void TDocumento_mask::highlight(COLOR high_back_color, COLOR high_color)
{
TSheet_field & sf = sfield(F_SHEET);
const int items = sf.items();
for (int i = 0 ; i < items; i++)
{
const bool on = doc()[i + 1].linked();
COLOR back = on ? high_back_color : NORMAL_BACK_COLOR;
COLOR fore = on ? high_color : NORMAL_COLOR;
sf.set_back_and_fore_color(back, fore, i);
sf.force_update(i);
}
}
///////////////////////////////////////////////////////////
// TDocument_tree
///////////////////////////////////////////////////////////
@ -1113,6 +1128,9 @@ protected:
virtual void node2id(const TObject* node, TString& id) const;
bool on_head() const;
bool on_row() const;
void format_field(const TRectype& rec, const TString& field, TString& str) const;
void append_custom_fields(const TTipo_documento& tipo, const TRectype& rec, TString& str) const;
public:
virtual bool goto_root();
@ -1127,6 +1145,7 @@ public:
virtual bool goto_lbrother();
virtual TObject* curr_node() const { return &(TToken_string&)_curnode; }
virtual bool get_description(TString& str) const;
virtual TImage* image(bool selected) const;
const TRectype& testata() const;
const TRectype& riga() const;
@ -1143,7 +1162,7 @@ const TRectype& TDocument_tree::testata() const
{
TDocument_tree& me = (TDocument_tree&)*this;
const TRecnotype pos = me._curnode.get_long(0);
if (_cursor->pos() != pos)
if (_cursor->pos() != pos || _relation->curr(LF_RIGHEDOC).empty())
*me._cursor = pos;
return _relation->curr();
}
@ -1185,7 +1204,7 @@ bool TDocument_tree::on_row() const
bool TDocument_tree::goto_root()
{
bool ok = _cursor != NULL && _cursor->items()>0;
const bool ok = _cursor != NULL && _cursor->items()>0;
_curnode = ok ? "0" : "";
return ok;
}
@ -1301,15 +1320,64 @@ bool TDocument_tree::goto_lbrother()
return ok;
}
void TDocument_tree::format_field(const TRectype& rec, const TString& field, TString& str) const
{
const TFieldref fld(field, rec.num());
const TString& value = fld.read(rec);
const TFieldtypes ft = rec.type(fld.name());
if (ft == _realfld)
{
const int len = rec.length(fld.name());
const int ndec = rec.ndec(fld.name());
TString8 pic; pic.format(".%d", ndec);
const real r = value;
str = r.string(pic);
str.right_just(len);
}
else
str = value;
}
void TDocument_tree::append_custom_fields(const TTipo_documento& tipo, const TRectype& rec, TString& str) const
{
const TString& format = rec.num() == LF_DOC ? tipo.stringa_descrizione_documento()
: tipo.stringa_descrizione_riga();
if (format.not_empty())
{
str << ' ';
int ch = -1;
TString tmp;
for (int ap = format.find('{'); ap >= 0; ap = format.find('{', ch+1))
{
str << format.sub(ch+1, ap);
ch = format.find('}', ap);
const TString16 field = format.sub(ap+1, ch);
format_field(rec, field, tmp);
str << tmp;
}
str << format.mid(ch+1);
}
}
TImage* TDocument_tree::image(bool selected) const
{
if (on_row())
{
const TRectype& rec = riga();
if (rec.get_bool(RDOC_RIGAEVASA))
return get_res_image(BMP_STOP);
}
return TTree::image(selected);
}
bool TDocument_tree::get_description(TString& str) const
{
TDocument_tree& me = (TDocument_tree&)*this;
if (on_head())
{
const TRectype& rec = testata();
TString16 tmp;
str = rec.get(DOC_ANNO);
str << ' ' << rec.get(DOC_CODNUM);
TString16 tmp;
tmp.format("%6ld", rec.get_long(DOC_NDOC));
str << ' ' << tmp << ' ' << rec.get(DOC_DATADOC);
const char tipocf = rec.get_char(DOC_TIPOCF);
@ -1318,18 +1386,35 @@ bool TDocument_tree::get_description(TString& str) const
str << tmp;
tmp.format("%c|%6ld", tipocf, codcf);
str << cache().get(LF_CLIFO, tmp, CLI_RAGSOC);
str.left_just(63);
const TTipo_documento& tipo = TDocumento::tipo(rec.get(DOC_TIPODOC));
append_custom_fields(tipo, rec, str);
}
else
{
const TRectype& rec = riga();
str.format("%4d: ", rec.get_int(RDOC_NRIGA));
const TRectype& testata = _relation->curr();
const TString80 codart = rec.get(RDOC_CODART);
str = codart;
str.left_just(21);
str << rec.get(RDOC_DESCR).left(30);
str.left_just(52);
if (codart.not_empty())
{
str << rec.get_real(RDOC_QTA).string("#.###.##@,@@@@@");
str << ' ' << codart << ' ';
const TTipo_documento& tipo = TDocumento::tipo(testata.get(DOC_TIPODOC));
const real qta = rec.get(tipo.field_qta());
str << qta.string("###.###.##@,@@@");
if (tipo.is_ordine())
{
const real qta_evasa = rec.get(tipo.field_qtaevasa());
const real residuo = qta_evasa < qta ? (qta-qta_evasa) : ZERO;
str << residuo.string("###.###.##@,@@@");
}
append_custom_fields(tipo, rec, str);
}
str << rec.get(RDOC_DESCR);
}
return TRUE;
}
@ -1394,7 +1479,7 @@ protected:
void add_valuta_filter(TString& filter) const;
void docrif_search();
void update_list();
int update_list();
void update_ndoc_filter(bool is_tipo_elaborazione = FALSE);
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
@ -1424,8 +1509,16 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
case F_TYPE:
if (e == fe_init || e == fe_modify)
{
update_list();
int ne = update_list();
if (e == fe_init && ne == 0) // Riprova a cambiare flag e ricostruire la lista
{
set(F_TYPE, "X");
ne = update_list();
if (ne == 0)
set(F_TYPE, "");
}
update_ndoc_filter(TRUE);
o.mask().field(F_NDOC_ELAB).check_type(o.get() == "" ? CHECK_SEARCH : CHECK_REQUIRED);
}
break;
case F_STATODOC_ELAB:
@ -1444,6 +1537,16 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
if (e == fe_button)
docrif_search();
break;
case F_NDOC_ELAB:
if ((e == fe_modify || e == fe_close) && o.check_type() == CHECK_SEARCH && !o.empty())
{
o.check_type(CHECK_REQUIRED);
const bool ok = o.on_key (K_ENTER);
o.check_type(CHECK_SEARCH);
return ok;
}
break;
case F_ROWS:
if (e == fe_modify && is_running())
{
@ -1452,6 +1555,8 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
{
const TRectype& head = _tree.testata();
set(F_DATADOC_ELAB, head.get(DOC_DATADOC)); // Anch'essa nella chiave 2!
set(F_CODNUM_ELAB, head.get(DOC_CODNUM));
field(F_CODNUM_ELAB).check();
set(F_NDOC_ELAB, head.get(DOC_NDOC));
}
}
@ -1462,7 +1567,7 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
return TRUE;
}
void TElabora_mask::update_list()
int TElabora_mask::update_list()
{
TString_array elabs;
const TString16 tipo(_main->get(F_TIPODOC));
@ -1506,6 +1611,8 @@ void TElabora_mask::update_list()
reset(-GRP_ART);
hide(-GRP_ART);
}
return items;
}
bool TElabora_mask::elabora()
@ -1516,7 +1623,7 @@ bool TElabora_mask::elabora()
TLista_documenti out;
TDocumento& app_doc = ((TDocumento_mask *)_main)->doc();
long numdoc = get_long(F_NDOC_ELAB);
bool update_header = get_bool(F_UPDATE_HEADER);
const bool update_header = get_bool(F_UPDATE_HEADER);
TDocumento* newdoc = new TDocumento(*get(F_PROVV_ELAB), get_int(F_ANNO_ELAB), get(F_CODNUM_ELAB), numdoc);
TDocumento& d = *newdoc;
@ -1627,6 +1734,9 @@ bool TElabora_mask::elabora()
}
delete newdoc;
if (update_mask)
update_ndoc_filter();
return update_mask;
}
@ -1658,12 +1768,8 @@ bool TElabora_mask::article_filter(const TRelation* rel)
const TString& codart = rdoc.get(RDOC_CODART);
if (!evasa && codart == m._art_filter)
{
const real residuo = rdoc.get_real(RDOC_QTA)-rdoc.get_real(RDOC_QTAEVASA);
if (residuo > ZERO)
{
yes = TRUE;
break;
}
yes = TRUE;
break;
}
}
return yes;
@ -1704,7 +1810,7 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
enable(-1, to_elab /*&& e != NULL*/);
if (!to_elab && is_tipo_elaborazione )
reset(-1);
reset(-1);
if (e != NULL)
{
if (to_elab)
@ -1828,13 +1934,31 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
cursor->set_filterfunction(NULL);
TTree_field& tf = tfield(F_ROWS);
if (tipo.not_empty())
if (tipo.not_empty() && e != NULL)
{
tf.set_tree(&_tree);
TToken_string header(256, '\n');
header.add("Anno Num. N. Data Cli/For Ragione Sociale");
header.add(" Codice Articolo Descrizione Riga ");
if (e->tipo() == _consegna_ordini)
header << "Da Evadere Residuo";
else
header << " Quantità";
tf.set_header(header);
if (_art_filter.not_empty() && to_elab)
_tree.set_cursor(get(F_TIPOCF_ELAB)[0], get_long(F_CODCF_ELAB), get_int(F_ANNO_ELAB), filter, article_filter);
else
_tree.set_cursor(get(F_TIPOCF_ELAB)[0], get_long(F_CODCF_ELAB), get_int(F_ANNO_ELAB), filter);
TCursor& cur = *_tree.get_cursor();
if (cur.items() == 1) // Propone l'unico documento possibile
{
cur = 0L;
const TRectype& curr = cur.curr();
set(F_NDOC_ELAB, curr.get(DOC_NDOC));
set(F_DATADOC_ELAB, curr.get(DOC_DATADOC));
}
}
else
tf.set_tree(NULL);