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" #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 // 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_uue() const;
void convert_pim2prm() const; void convert_pim2prm() const;
void convert_riba_tcf() const; void convert_riba_tcf() const;
void convert_cdc2cms() const;
void convert_mov2movcms() const;
TConversione_archivi() : _oldditta(0), _codditta(0), _error(0) {} TConversione_archivi() : _oldditta(0), _codditta(0), _error(0) {}
}; };
@ -338,6 +340,13 @@ bool TConversione_archivi::menu(MENU_TAG)
if (_codditta > 0) if (_codditta > 0)
convert_riba_tcf(); convert_riba_tcf();
break; break;
case 19:
if (_codditta > 0)
{
convert_cdc2cms();
convert_mov2movcms();
}
break;
default: default:
break; break;
} }
@ -356,7 +365,7 @@ bool TConversione_archivi::convert_rmov(TLocalisamfile & rmov, TArray & recs, in
for (int i = 0; i < nrecs; i++) for (int i = 0; i < nrecs; i++)
{ {
TRectype & r0 = (TRectype &) recs[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) 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_CONTOC, r1.get_int(RMV_CONTO));
r0.put(RMV_SOTTOCONTOC, r1.get_long(RMV_SOTTOCONTO)); r0.put(RMV_SOTTOCONTOC, r1.get_long(RMV_SOTTOCONTO));
} }
r0.zero(RMV_RCONTR); r0.zero("RCONTR");
if (rmov.rewrite(r0) != NOERR) if (rmov.rewrite(r0) != NOERR)
{ {
const long reg = r0.get_long(RMV_NUMREG); 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 // 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; const int r = (argc > 1) ? abs(atoi(argv[1])) : 0;
if (r < 0 || r > 18) if (r < 0 || r > 19)
{ {
error_box(usage); error_box(usage);
return 100; return 100;

View File

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

View File

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

View File

@ -2,6 +2,7 @@
#include <automask.h> #include <automask.h>
#include <config.h> #include <config.h>
#include <progind.h> #include <progind.h>
#include <recarray.h>
#include <relation.h> #include <relation.h>
#include "ce2100a.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()) switch (o.dlg())
{ {
case F_ESERCIZIO: 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_MATGEN:
case F_SPMS_AUTOTRAS: case F_SPMS_AUTOTRAS:
if (e == fe_modify) if (e == fe_modify)
@ -79,6 +95,10 @@ bool TCalcamm::calcola_ammortamenti()
ccq.put("CODTAB", key); ccq.put("CODTAB", key);
if (ccb.read() == NOERR) 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 // Azzera monte spese di manutenzione
ccq.zero("R2"); ccq.zero("R2");
ccq.zero("R3"); ccq.zero("R3");

View File

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

View File

@ -44,6 +44,7 @@ protected:
TString& ammini_get(const char* pstar) const; TString& ammini_get(const char* pstar) const;
bool ammini_get_bool(const char* pstar) const; bool ammini_get_bool(const char* pstar) const;
real ammini_get_real(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_perc(TRelation& rel, const TRectype& tmv, const TRectype& tmvam);
void calc_anni(TRectype& ammmv, 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 = ""; _idspese5 = _idspese25 = "";
const TRectype& ccb = ditta_cespiti().get_attivita(); const TRectype& ccb = ditta_cespiti().get_attivita();
const real speseman_5 = ccb.get_real("R2"); const real speseman_5 = ccb.get_real("R0") - ccb.get_real("R2");
if (speseman_5 != ZERO) if (speseman_5 > ZERO)
costruisci_cespite(91, speseman_5); costruisci_cespite(91, speseman_5);
const real speseman_25 = ccb.get_real("R3"); const real speseman_25 = ccb.get_real("R1") - ccb.get_real("R3");
if (speseman_25 != ZERO) if (speseman_25 > ZERO)
costruisci_cespite(92, speseman_25); 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 JOIN %TMC TO LF_MOVCE ALIAS 108 INTO CODTAB==CODMOV
END 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 SECTION HEADER FIRST 9
STRINGA FR_CODDITTA STRINGA FR_CODDITTA
@ -124,6 +112,12 @@ SECTION HEADER FIRST 9
PROMPT 96 4 "@bLIBRO CESPITI@r " PROMPT 96 4 "@bLIBRO CESPITI@r "
END END
STRINGA -1
BEGIN
KEY "riga"
PROMPT 1 5 "@b___________________________________________________________________________________________________________________________________________________@r"
END
STRINGA -1 STRINGA -1
BEGIN BEGIN
KEY "Intestazione stampa" KEY "Intestazione stampa"
@ -238,6 +232,12 @@ SECTION HEADER FIRST 9
PROMPT 128 8 "@bQuota non + amm.@r" PROMPT 128 8 "@bQuota non + amm.@r"
END END
STRINGA -1
BEGIN
KEY "riga"
PROMPT 1 9 "@b___________________________________________________________________________________________________________________________________________________@r"
END
END // end section header first (INTESTAZIONE REGISTRO VERA E PROPRIA) END // end section header first (INTESTAZIONE REGISTRO VERA E PROPRIA)
//// ////
@ -1236,7 +1236,7 @@ SECTION BODY EVEN 17
STRINGA FR_FE_MSG6 STRINGA FR_FE_MSG6
BEGIN BEGIN
KEY "Messaggio 6" KEY "Messaggio 6"
PROMPT 16 12 "" PROMPT 16 12 "Ammortamento proporzionale al periodo di possesso"
END END
STRINGA -1 STRINGA -1

View File

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

View File

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

View File

@ -48,17 +48,22 @@
class TSaldo_cdc : public TSaldo class TSaldo_cdc : public TSaldo
{ {
public: public:
bool data_limite_commessa(int bilancio, int g, int c, long s, const char* commessa, const TDate& data_inf, bool data_limite_commessa(int bilancio, int g, int c, long s,
const TString& commessa, const TString& fase, const TDate& data_inf,
const TDate& data_sup, int indbil, int stp_prov); const TDate& data_sup, int indbil, int stp_prov);
}; };
//per bilancio scalare (ovvero a sezioni contrapposte) per data limite //per bilancio scalare (ovvero a sezioni contrapposte) per data limite
bool TSaldo_cdc::data_limite_commessa(int bilancio, int g, int c, long s, const char* commessa, const TDate& data_inf, bool TSaldo_cdc::data_limite_commessa(int bilancio, int g, int c, long s,
const TString& commessa, const TString& fase, const TDate& data_inf,
const TDate& data_sup, int indbil, int stp_prov) const TDate& data_sup, int indbil, int stp_prov)
{ {
TString filter; TString filter;
filter << RMV_CODCMS << "==\"" << commessa << '"'; filter << '(' << RMV_CODCMS << "==\"" << commessa << "\")";
if (fase.not_empty())
filter << "&&(" << RMV_FASCMS << "==\"" << fase << "\")";
return data_limite_bilancio(bilancio, g, c, s, data_inf, data_sup, indbil, stp_prov, filter); return data_limite_bilancio(bilancio, g, c, s, data_inf, data_sup, indbil, stp_prov, filter);
} }
@ -66,10 +71,11 @@ class TStampa_bilanci : public TPrintapp
{ {
static bool mask_anno (TMask_field& f, KEY k); static bool mask_anno (TMask_field& f, KEY k);
static bool mask_datalim (TMask_field& f, KEY k); static bool mask_datalim (TMask_field& f, KEY k);
static bool my_handler (TMask_field& f, KEY k); static bool verifica_handler(TMask_field& f, KEY k);
static bool mask_date (TMask_field& f, KEY k); static bool mask_date (TMask_field& f, KEY k);
static bool mask_bilancio(TMask_field& f, KEY k); static bool mask_bilancio(TMask_field& f, KEY k);
static bool mask_tipost (TMask_field& f, KEY k); static bool mask_tipost (TMask_field& f, KEY k);
static bool cdc_handler (TMask_field& f, KEY k);
struct cli_for struct cli_for
{ {
@ -135,7 +141,7 @@ class TStampa_bilanci : public TPrintapp
bool _print_exercise; bool _print_exercise;
int _stampa_mov_prov; int _stampa_mov_prov;
TString _cdc; TString _cdc, _fsc;
TArray _clienti, _fornitori; TArray _clienti, _fornitori;
@ -310,13 +316,13 @@ bool TStampa_bilanci::mask_anno(TMask_field& f, KEY k)
bool TStampa_bilanci::mask_bilancio(TMask_field& f, KEY k) bool TStampa_bilanci::mask_bilancio(TMask_field& f, KEY k)
{ {
int tipo_bil, tipo_stp; int tipo_bil, tipo_stp;
TMask& m = f.mask();
if (k == K_SPACE) if (k == K_SPACE)
{ {
TMask& m = f.mask();
const int anno = m.get_int(F_ANNO);
const int bilancio = m.get_int(F_BILANCIO);
int tipo_stampa; int tipo_stampa;
int anno = m.get_int(F_ANNO);
int bilancio = m.get_int(F_BILANCIO);
if (bilancio == 1) //bilancio a sezioni contrapposte if (bilancio == 1) //bilancio a sezioni contrapposte
{ {
tipo_stampa = m.get_int(F_STAMPA); tipo_stampa = m.get_int(F_STAMPA);
@ -327,7 +333,7 @@ bool TStampa_bilanci::mask_bilancio(TMask_field& f, KEY k)
tipo_stampa = m.get_int(F_STAMPA1); tipo_stampa = m.get_int(F_STAMPA1);
m.enable_page(1); m.enable_page(1);
} }
if ( bilancio == 1 || bilancio ==2)
if (tipo_stampa == 2) //all'ultima immissione if (tipo_stampa == 2) //all'ultima immissione
{ {
m.hide(F_DATADA); m.hide(F_DATADA);
@ -337,6 +343,10 @@ bool TStampa_bilanci::mask_bilancio(TMask_field& f, KEY k)
m.hide(99); m.hide(99);
m.hide(96); m.hide(96);
m.hide(97); m.hide(97);
// Disabilito le commesse nelle stampe all'ultima immissione
m.hide(-4);
m.reset(-4);
} }
else else
{ {
@ -361,6 +371,15 @@ bool TStampa_bilanci::mask_bilancio(TMask_field& f, KEY k)
m.hide(96); m.hide(96);
m.hide(97); m.hide(97);
} }
// Abilito eventualmente le commesse
if (main_app().has_module(CMAUT))
m.show(-4);
else
{
m.hide(-4);
m.reset(-4);
}
} }
tipo_bil = f.mask().get_int(F_BILANCIO); tipo_bil = f.mask().get_int(F_BILANCIO);
@ -504,7 +523,7 @@ bool TStampa_bilanci::mask_date(TMask_field& f, KEY k)
return TRUE; return TRUE;
} }
bool TStampa_bilanci::my_handler(TMask_field& f, KEY k) bool TStampa_bilanci::verifica_handler(TMask_field& f, KEY k)
{ {
if (k == K_SPACE) if (k == K_SPACE)
{ {
@ -554,6 +573,23 @@ bool TStampa_bilanci::my_handler(TMask_field& f, KEY k)
return TRUE; return TRUE;
} }
bool TStampa_bilanci::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;
}
void TStampa_bilanci::scrivig_file_temp() void TStampa_bilanci::scrivig_file_temp()
{ {
TIsamtempfile* tmp = NULL; TIsamtempfile* tmp = NULL;
@ -954,13 +990,15 @@ bool TStampa_bilanci::bil_sez_contr()
if (_tipo_stampa == 1) //bil. a sez. contrapposte per data limite if (_tipo_stampa == 1) //bil. a sez. contrapposte per data limite
{ {
if (_cdc.not_empty()) if (_cdc.not_empty())
movimentato = sld.data_limite_commessa(_bilancio,g,c,s,_cdc,_dataini,_datalim,indbil_conto,_stampa_mov_prov); movimentato = sld.data_limite_commessa(_bilancio,g,c,s,_cdc,_fsc,_dataini,_datalim,indbil_conto,_stampa_mov_prov);
else else
movimentato = sld.data_limite_bilancio(_bilancio,g,c,s,_dataini,_datalim,indbil_conto,_stampa_mov_prov); movimentato = sld.data_limite_bilancio(_bilancio,g,c,s,_dataini,_datalim,indbil_conto,_stampa_mov_prov);
} }
else else
{
if (_tipo_stampa == 2) //bil. a sez. contrapposte all'ultima immissione es. in corso if (_tipo_stampa == 2) //bil. a sez. contrapposte all'ultima immissione es. in corso
movimentato = sld.ultima_immissione_bilancio(_annoes,g,c,s,indbil_conto,_stampa_mov_prov); movimentato = sld.ultima_immissione_bilancio(_annoes,g,c,s,indbil_conto,_stampa_mov_prov);
}
if (!movimentato) if (!movimentato)
if (!sld.esiste_saldo() || !sld.significativo()) if (!sld.esiste_saldo() || !sld.significativo())
@ -1128,7 +1166,7 @@ bool TStampa_bilanci::ricerca_sottoc_clifo(int g,int c, bool compensa, int indbi
if (_tipo_stampa == 1) //bil. a sez. contrapposte per data limite if (_tipo_stampa == 1) //bil. a sez. contrapposte per data limite
{ {
if (_cdc.not_empty()) if (_cdc.not_empty())
movimentato = sld.data_limite_commessa(_bilancio,g,c,s,_cdc,_dataini,_datalim,indbil_conto,_stampa_mov_prov); movimentato = sld.data_limite_commessa(_bilancio,g,c,s,_cdc,_fsc,_dataini,_datalim,indbil_conto,_stampa_mov_prov);
else else
movimentato = sld.data_limite_bilancio(_bilancio,g,c,s,_dataini,_datalim,indbil_conto,_stampa_mov_prov); movimentato = sld.data_limite_bilancio(_bilancio,g,c,s,_dataini,_datalim,indbil_conto,_stampa_mov_prov);
} }
@ -1290,8 +1328,7 @@ bool TStampa_bilanci::bil_verifica()
c = _pcn->get_int (PCN_CONTO); c = _pcn->get_int (PCN_CONTO);
s = _pcn->get_long(PCN_SOTTOCONTO); s = _pcn->get_long(PCN_SOTTOCONTO);
if ( (((_cp != -1) && (c != _cp)) || ((_gp != -1) && (g != _gp))) && if ( (((_cp != -1) && (c != _cp)) || ((_gp != -1) && (g != _gp))) && esiste_sc )
esiste_sc )
{ {
if (_verifica == 2) if (_verifica == 2)
if (!((_stampav == 2) && (saldo_conto == 0))) if (!((_stampav == 2) && (saldo_conto == 0)))
@ -1305,7 +1342,7 @@ bool TStampa_bilanci::bil_verifica()
else else
//fine //fine
{ {
real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere; const real app = _saldo_ini_conto_dare + _saldo_ini_conto_avere;
if (app < ZERO) if (app < ZERO)
_saldo_ini_gruppo_avere += app; _saldo_ini_gruppo_avere += app;
else else
@ -1371,14 +1408,13 @@ bool TStampa_bilanci::bil_verifica()
esiste_sc = ricerca_cf(g,c,tipo_conto,indbil_conto,saldo_finale,saldo_iniziale, esiste_sc = ricerca_cf(g,c,tipo_conto,indbil_conto,saldo_finale,saldo_iniziale,
mov_conto_dare,mov_conto_avere,prg_conto_dare,prg_conto_avere, mov_conto_dare,mov_conto_avere,prg_conto_dare,prg_conto_avere,
saldo_conto); saldo_conto);
if ( (_verifica == 2) && (_stampav == 2) ) if (_verifica == 2 && _stampav == 2 && saldo_conto.is_zero())
if (saldo_conto == 0)
continue; continue;
if (esiste_sc) if (esiste_sc)
{ {
_gp = g; _gp = g;
_cp = c; _cp = c;
TRecnotype recnum = _pcn->recno(); const TRecnotype recnum = _pcn->recno();
_pcn->next(); _pcn->next();
if (_pcn->eof()) if (_pcn->eof())
{ {
@ -1431,7 +1467,7 @@ bool TStampa_bilanci::bil_verifica()
_mov_ap = FALSE; _mov_ap = FALSE;
//modifica del 19/06/95 //modifica del 19/06/95
movimentato = calcola(g,c,s); movimentato = calcola(g,c,s);
if (_stampa_mov_prov != 3) if (_stampa_mov_prov != 3 && _cdc.empty())
{ {
if (movimentato) if (movimentato)
{ {
@ -1541,7 +1577,6 @@ else
{ {
movimentato = sld.ultima_immissione_verifica(_annoes,g,c,s,indbil_conto,_stampa_mov_prov); movimentato = sld.ultima_immissione_verifica(_annoes,g,c,s,indbil_conto,_stampa_mov_prov);
//modifica del 31/03/95
if (_stampa_mov_prov != 3) if (_stampa_mov_prov != 3)
{ {
if (movimentato) if (movimentato)
@ -1556,7 +1591,6 @@ else
} }
} }
} }
//fine modifica
if (movimentato || _stampav != 1) if (movimentato || _stampav != 1)
{ {
@ -1574,8 +1608,7 @@ else
} }
} }
if (movimentato || _stampav != 1) if ((movimentato || _stampav != 1) && !(saldo_finale.is_zero() && _stampav == 2))
if (!(saldo_finale == ZERO && _stampav == 2))
{ {
esiste_sc = TRUE; esiste_sc = TRUE;
esiste_conto = TRUE; esiste_conto = TRUE;
@ -1710,6 +1743,7 @@ return TRUE;
} }
// bilancio di verifica per data limite // bilancio di verifica per data limite
// Calcola totali delle righe relative al g,c,s
bool TStampa_bilanci::calcola(int g, int c, long s) bool TStampa_bilanci::calcola(int g, int c, long s)
{ {
int annoe; int annoe;
@ -1746,13 +1780,19 @@ bool TStampa_bilanci::calcola(int g, int c, long s)
rmov.zero(); rmov.zero();
rmov.put(RMV_GRUPPO,g); rmov.put(RMV_GRUPPO,g);
if (c != 0) if (c != 0)
{
rmov.put(RMV_CONTO,c); rmov.put(RMV_CONTO,c);
if (s != 0) if (s != 0)
rmov.put(RMV_SOTTOCONTO,s); rmov.put(RMV_SOTTOCONTO,s);
}
TString filter; TString filter;
if (_cdc.not_empty()) if (_cdc.not_empty())
{
filter << '(' << RMV_CODCMS << "=='" << _cdc << "')"; filter << '(' << RMV_CODCMS << "=='" << _cdc << "')";
if (_fsc.not_empty())
filter << "&&(" << RMV_FASCMS << "=='" << _fsc << "')";
}
TCursor cur(&rel, filter, 2, &rmov, &rmov); TCursor cur(&rel, filter, 2, &rmov, &rmov);
const long items = cur.items(); const long items = cur.items();
@ -1792,7 +1832,7 @@ bool TStampa_bilanci::calcola(int g, int c, long s)
else else
data_reg = datacomp; data_reg = datacomp;
if (importo == 0) if (importo.is_zero())
continue; continue;
//calcolo i movimenti del periodo //calcolo i movimenti del periodo
@ -1867,7 +1907,7 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin
//modifica del 19/06. Vedi appunti per capire //modifica del 19/06. Vedi appunti per capire
bool movimentato = calcola(g,c,s); bool movimentato = calcola(g,c,s);
if (_stampa_mov_prov != 3) if (_stampa_mov_prov != 3 && _cdc.empty())
{ {
if (movimentato) if (movimentato)
{ {
@ -1942,15 +1982,6 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin
_nuovo_tot_saldo_d += _mov_periodo_dare; _nuovo_tot_saldo_d += _mov_periodo_dare;
_nuovo_tot_saldo_a += _mov_periodo_avere; _nuovo_tot_saldo_a += _mov_periodo_avere;
//modifica del 21/11/1995 //modifica del 21/11/1995
/*
if (saldo_iniziale > ZERO)
_nuovo_tot_saldo_d += saldo_iniziale;
else
{
real app = -saldo_iniziale;
_nuovo_tot_saldo_a += app;
}
*/
_nuovo_tot_saldo_d += _saldo_ini_dare; _nuovo_tot_saldo_d += _saldo_ini_dare;
_nuovo_tot_saldo_a += _saldo_ini_avere; _nuovo_tot_saldo_a += _saldo_ini_avere;
//fine //fine
@ -1961,7 +1992,8 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin
{ {
if (saldo_iniziale > 0) if (saldo_iniziale > 0)
_prg_prec_dare += saldo_iniziale; _prg_prec_dare += saldo_iniziale;
else _prg_prec_avere -= saldo_iniziale; else
_prg_prec_avere -= saldo_iniziale;
saldo_finale = _prg_prec_dare-_prg_prec_avere+_mov_periodo_dare- saldo_finale = _prg_prec_dare-_prg_prec_avere+_mov_periodo_dare-
_mov_periodo_avere; _mov_periodo_avere;
} }
@ -2012,9 +2044,7 @@ bool TStampa_bilanci::ricerca_cf(int g,int c,char tipocf,int ib, real& saldo_fin
_mov_periodo_dare += sld.saldofin(); _mov_periodo_dare += sld.saldofin();
saldo_finale = saldo_iniziale+_mov_periodo_dare-_mov_periodo_avere; saldo_finale = saldo_iniziale+_mov_periodo_dare-_mov_periodo_avere;
if (saldo_finale.is_zero() && _stampav == 2)
if (saldo_finale == ZERO)
if (_stampav == 2)
continue; continue;
_nuovo_tot_saldo_d += _mov_periodo_dare; _nuovo_tot_saldo_d += _mov_periodo_dare;
@ -2139,8 +2169,8 @@ void TStampa_bilanci::scrivi_record_gruppo(const real& prg_da,
_tmp_saldi_att->write(); _tmp_saldi_att->write();
} }
void TStampa_bilanci::scrivi_record_conto(const real& prg_da, void TStampa_bilanci::scrivi_record_conto(const real& prg_da, const real& prg_a,
const real& prg_a,const real& mov_da,const real& mov_a,const real& s) const real& mov_da,const real& mov_a, const real& s)
{ {
_tmp_saldi_att->zero(); _tmp_saldi_att->zero();
_tmp_saldi_att->put(SLD_GRUPPO,_gp); _tmp_saldi_att->put(SLD_GRUPPO,_gp);
@ -2394,10 +2424,10 @@ void TStampa_bilanci::leggi_clifo(const TArray& gccf)
saldi.put(SLD_SOTTOCONTO, codcf); saldi.put(SLD_SOTTOCONTO, codcf);
if (saldi.read() == NOERR) if (saldi.read() == NOERR)
{ {
real s = saldi.get_real(SLD_SALDO); const real s = saldi.get_real(SLD_SALDO);
if (_stampa_mov_prov != 3) if (_stampa_mov_prov != 3)
if (_indbil == 1 || _indbil == 2 || _indbil == 5) if (_indbil == 1 || _indbil == 2 || _indbil == 5)
if (s == ZERO && _annoes != 0) //competenza!!! if (s.is_zero() && _annoes != 0) //competenza!!!
{ {
saldo_iniziale += sld.saldofin_esprec(_annoes,g,c,codcf); saldo_iniziale += sld.saldofin_esprec(_annoes,g,c,codcf);
//modifica del 21/11/1995 //modifica del 21/11/1995
@ -2464,7 +2494,7 @@ void TStampa_bilanci::leggi_clifo(const TArray& gccf)
// continue; // continue;
} }
if (movimentato || _stampac != 1 || saldo_iniziale != ZERO) if (movimentato || _stampac != 1 || saldo_iniziale != ZERO)
if (!(saldo_finale == ZERO && _stampac == 2)) if (!(saldo_finale.is_zero() && _stampac == 2))
{ {
esiste_sc = TRUE; esiste_sc = TRUE;
@ -2680,10 +2710,12 @@ void TStampa_bilanci::leggi_file_tmp()
_sottoconto_succ = _tmp_saldi_att->get_long(SLD_SOTTOCONTO); _sottoconto_succ = _tmp_saldi_att->get_long(SLD_SOTTOCONTO);
_tipoc_succ = _tmp_saldi_att->get_char(SLD_FLAGSALINI); _tipoc_succ = _tmp_saldi_att->get_char(SLD_FLAGSALINI);
if ( (_verifica != 2) && (_sottoconto_succ != 0) ) if ( (_verifica != 2) && (_sottoconto_succ != 0) )
{
if (_tipo_stampa1 == 2) if (_tipo_stampa1 == 2)
_ultima_data = UltimaData(_gruppo_succ,_conto_succ, _ultima_data = UltimaData(_gruppo_succ,_conto_succ, _sottoconto_succ,_annoes);
_sottoconto_succ,_annoes); else
else _ultima_data = _tmp_saldi_att->get_date(SLD_DATAULMOV); _ultima_data = _tmp_saldi_att->get_date(SLD_DATAULMOV);
}
_descr_succ = DescrizioneConto(_gruppo_succ,_conto_succ, _descr_succ = DescrizioneConto(_gruppo_succ,_conto_succ,
_sottoconto_succ,_tipoc_succ); _sottoconto_succ,_tipoc_succ);
_saldoini_dare_succ = _tmp_saldi_att->get_real(SLD_PDAREPRO); // W96SALDI del 05-06-96 _saldoini_dare_succ = _tmp_saldi_att->get_real(SLD_PDAREPRO); // W96SALDI del 05-06-96
@ -2828,11 +2860,13 @@ void TStampa_bilanci::leggi_sort()
_conto = atoi(cf->conto); _conto = atoi(cf->conto);
_sottoconto = atol(cf->codcf); _sottoconto = atol(cf->codcf);
_descr = cf->ragsoc; _descr = cf->ragsoc;
if ( (_ordinamento == 2 && _descr != "zzzz") || if ( (_ordinamento == 2 && _descr != "zzzz") || (_ordinamento == 1 && _sottoconto != 999999L) )
(_ordinamento == 1 && _sottoconto != 999999L) ) {
if (_tipo_stampa1 == 2) if (_tipo_stampa1 == 2)
_ultima_data = UltimaData(_gruppo,_conto,_sottoconto,_annoes); _ultima_data = UltimaData(_gruppo,_conto,_sottoconto,_annoes);
else _ultima_data = cf->udata; else
_ultima_data = cf->udata;
}
_saldo_dare = cf->saldodare; _saldo_dare = cf->saldodare;
_saldo_avere = cf->saldoavere; _saldo_avere = cf->saldoavere;
_mov_dare = cf->movdare; _mov_dare = cf->movdare;
@ -2972,7 +3006,7 @@ void TStampa_bilanci::set_page(int file, int counter)
} }
else //stampa bilancio di verifica else //stampa bilancio di verifica
{ {
TString16 udata = _ultima_data.string(brief,'/'); const TString16 udata = _ultima_data.string(brief,'/');
char app; char app;
int r = 1; int r = 1;
@ -3302,15 +3336,19 @@ void TStampa_bilanci::stampa_riga_totali(int r)
set_row(r,"@131g%c", app); set_row(r,"@131g%c", app);
r++; r++;
if (_cdc.empty()) // Non ha senso parlare di saldi iniziali delle commesse
{
if ((_tipo_stampa1 == 1 && _datada == _dataini) || _tipo_stampa1 == 2) if ((_tipo_stampa1 == 1 && _datada == _dataini) || _tipo_stampa1 == 2)
{ {
//modifica del 21/11/1995 //modifica del 21/11/1995
if (_tipo_stampa1 == 2) if (_tipo_stampa1 == 2)
set_row(r,"@1g****** ********@17gTOTALE CON SALDI INIZIALI@46g!@80g!%r@98g%r@114g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a); set_row(r,"@1g****** ********@17gTOTALE CON SALDI INIZIALI@46g!@80g!%r@98g%r@114g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a);
else set_row(r,"@1g****** ********@17gTOTALE CON MOVIM. DI APERTURA@46g!@80g!%r@98g%r@114g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a); else
set_row(r,"@1g****** ********@17gTOTALE CON MOVIM. DI APERTURA@46g!@80g!%r@98g%r@114g!",&_nuovo_tot_saldo_d,&_nuovo_tot_saldo_a);
//fine //fine
} }
} }
}
else else
{ {
if (app == 'D') if (app == 'D')
@ -3323,6 +3361,9 @@ void TStampa_bilanci::stampa_riga_totali(int r)
set_row(r++,"@1g****** ********@17gTOTALE GENERALE@46g!%r@64g%r@80g!%r@98g%r@114g!@132g%r@148g!",&_saldo_dare_tot, set_row(r++,"@1g****** ********@17gTOTALE GENERALE@46g!%r@64g%r@80g!%r@98g%r@114g!@132g%r@148g!",&_saldo_dare_tot,
&_saldo_avere_tot,&_mov_dare_tot,&_mov_avere_tot, &_saldo_finale_tot); &_saldo_avere_tot,&_mov_dare_tot,&_mov_avere_tot, &_saldo_finale_tot);
} }
if (_cdc.empty()) // Non ha senso parlare di saldi iniziali delle commesse
{
if ((_tipo_stampa1 == 1 && _datada == _dataini) || _tipo_stampa1 == 2) if ((_tipo_stampa1 == 1 && _datada == _dataini) || _tipo_stampa1 == 2)
{ {
if (_tipo_stampa1 == 2) if (_tipo_stampa1 == 2)
@ -3333,6 +3374,7 @@ void TStampa_bilanci::stampa_riga_totali(int r)
} }
} }
} }
}
void TStampa_bilanci::stampa_totali() void TStampa_bilanci::stampa_totali()
{ {
@ -3748,7 +3790,7 @@ void TStampa_bilanci::stampa_un_bilancio(const TMask& m)
if (_bilancio == 1) if (_bilancio == 1)
{ {
printer().footerlen(3); printer().footerlen(3);
_prog = new TProgind(_pcn->items(),"Elaborazione in corso... prego attendere",FALSE); _prog = new TProgind(_pcn->items(),"Elaborazione in corso...",FALSE);
_totali = m.get_bool(F_TOTALI); _totali = m.get_bool(F_TOTALI);
_codici = m.get_bool(F_CODICI); _codici = m.get_bool(F_CODICI);
_saldo = m.get_bool(F_SALDO); _saldo = m.get_bool(F_SALDO);
@ -3775,13 +3817,11 @@ void TStampa_bilanci::stampa_un_bilancio(const TMask& m)
else else
{ {
printer().footerlen(5); printer().footerlen(5);
_stampa_width = m.get_int(F_MODULO); _stampa_width = (m.get_int(F_MODULO) == 1) ? 132 : 148; //perche' questo e' in realta' il margine dx (vedi es. di stampa AS/400)
if (_stampa_width == 1)
_stampa_width = 132;
else _stampa_width = 148; //perche' questo e' in realta' il margine dx (vedi es. di stampa AS/400)
_verifica = m.get_int(F_VERIFICA); _verifica = m.get_int(F_VERIFICA);
if ( (_verifica == 1)||(_verifica == 2) ) if ( (_verifica == 1)||(_verifica == 2) )
_prog = new TProgind(_pcn->items(),"Elaborazione in corso... prego attendere",FALSE); _prog = new TProgind(_pcn->items(),"Elaborazione in corso...",FALSE);
_tipo_stampa1 = m.get_int(F_STAMPA1); _tipo_stampa1 = m.get_int(F_STAMPA1);
if (_tipo_stampa1 == 1) if (_tipo_stampa1 == 1)
{ {
@ -3823,7 +3863,7 @@ void TStampa_bilanci::stampa_un_bilancio(const TMask& m)
bool TStampa_bilanci::set_print(int) bool TStampa_bilanci::set_print(int)
{ {
TMask m ("cg1500a"); TMask m ("cg1500a");
m.set_handler (F_VERIFICA, my_handler); m.set_handler (F_VERIFICA, verifica_handler);
m.set_handler (F_BILANCIO, mask_bilancio); m.set_handler (F_BILANCIO, mask_bilancio);
m.set_handler (F_STAMPA1, mask_bilancio); m.set_handler (F_STAMPA1, mask_bilancio);
m.set_handler (F_STAMPA, mask_bilancio); m.set_handler (F_STAMPA, mask_bilancio);
@ -3831,9 +3871,8 @@ bool TStampa_bilanci::set_print(int)
m.set_handler (F_DATADA, mask_date); m.set_handler (F_DATADA, mask_date);
m.set_handler (F_DATAA, mask_date); m.set_handler (F_DATAA, mask_date);
m.set_handler (F_ANNO, mask_anno); m.set_handler (F_ANNO, mask_anno);
m.set_handler (F_DACDC, cdc_handler);
if (!has_module(CMAUT)) m.set_handler (F_ACDC, cdc_handler);
m.hide(-4); // Spegne campi commesse in assenza del modulo relativo
while (m.run() == K_ENTER) while (m.run() == K_ENTER)
{ {
@ -3846,22 +3885,43 @@ bool TStampa_bilanci::set_print(int)
if (m.get(F_DACDC).not_empty() || m.get(F_ACDC).not_empty()) if (m.get(F_DACDC).not_empty() || m.get(F_ACDC).not_empty())
{ {
TRelation rel("CMS"); TRelation cdcrel("CMS");
TRectype da_cdc(rel.curr()), a_cdc(rel.curr()); TRectype da_cdc(cdcrel.curr()), a_cdc(cdcrel.curr());
da_cdc.put("CODTAB", m.get(F_DACDC)); da_cdc.put("CODTAB", m.get(F_DACDC));
a_cdc.put("CODTAB", m.get(F_ACDC)); a_cdc.put("CODTAB", m.get(F_ACDC));
TCursor cur(&rel, "", 1, &da_cdc, &a_cdc); TCursor cdccur(&cdcrel, "", 1, &da_cdc, &a_cdc);
const TRecnotype items = cur.items(); const TRecnotype cdc_items = cdccur.items();
cur.freeze(); cdccur.freeze();
for (cur = 0L; cur.pos() < items; ++cur)
TRelation fscrel("FSC");
TRectype da_fsc(fscrel.curr()), a_fsc(fscrel.curr());
da_fsc.put("CODTAB", m.get(F_DAFSC));
a_fsc.put("CODTAB", m.get(F_AFSC));
TCursor fsccur(&fscrel, "", 1, &da_fsc, &a_fsc);
const TRecnotype fsc_items = fsccur.items();
fsccur.freeze();
for (cdccur = 0L; cdccur.pos() < cdc_items; ++cdccur)
{ {
_cdc = cur.curr().get("CODTAB"); _cdc = cdccur.curr().get("CODTAB");
if (!da_fsc.empty() || !a_fsc.empty())
{
for (fsccur = 0L; fsccur.pos() < fsc_items; ++fsccur)
{
_fsc = fsccur.curr().get("CODTAB");
stampa_un_bilancio(m); stampa_un_bilancio(m);
} }
} }
else else
{ {
_cdc.cut(0); _fsc.cut(0);
stampa_un_bilancio(m);
}
}
}
else
{
_cdc.cut(0); _fsc.cut(0);
stampa_un_bilancio(m); stampa_un_bilancio(m);
} }
} }
@ -3956,8 +4016,16 @@ void TStampa_bilanci::header_cdc(int& r)
{ {
if (_cdc.not_empty()) if (_cdc.not_empty())
{ {
const TString& desc = cache().get("CMS", _cdc, "S0"); const TString& desc_cdc = cache().get("CMS", _cdc, "S0");
set_header(r++, "@bCommessa %s - %s", (const char*)_cdc, (const char*)desc); if (_fsc.not_empty())
{
const TString& desc_fsc = cache().get("FSC", _fsc, "S0");
set_header(r++, "@bCommessa %s %s - Fase %s %s",
(const char*)_cdc, (const char*)desc_cdc,
(const char*)_fsc, (const char*)desc_fsc);
}
else
set_header(r++, "@bCommessa %s %s", (const char*)_cdc, (const char*)desc_cdc);
} }
} }

View File

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

View File

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

View File

@ -112,6 +112,8 @@ TMask* TPrimanota_application::load_mask(int n)
{ {
ism.hide(111); ism.hide(112); ism.hide(111); ism.hide(112);
is.delete_column(112); is.delete_column(111); 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 // 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_DARE, dareavere_handler);
cgm.set_handler(CG_AVERE, 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_GRUPPO, cg_gruppo_handler);
cgm.set_handler(CG_CONTO, cg_conto_handler); cgm.set_handler(CG_CONTO, cg_conto_handler);
cgm.set_handler(CG_SOTTOCONTO, suspended_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); cgm.hide(CG_COMMESSA); cgm.hide(CG_FASE);
cg.delete_column(CG_FASE); cg.delete_column(CG_COMMESSA); 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; break;
@ -280,8 +285,8 @@ bool TPrimanota_application::read_caus(const char* cod, int year)
TSheet_field& cgsheet = (TSheet_field&)m->field(F_SHEETCG); TSheet_field& cgsheet = (TSheet_field&)m->field(F_SHEETCG);
TMask& cgm = cgsheet.sheet_mask(); TMask& cgm = cgsheet.sheet_mask();
cgm.set_handler(100, show_games ? showpartite_handler : NULL); // bottoncino riga cgm.set_handler(DLG_USER, show_games ? showpartite_handler : NULL); // bottoncino riga
cgm.enable(100, show_games); cgm.enable(DLG_USER, show_games);
if (iva == nessuna_iva) if (iva == nessuna_iva)
{ {
m->enable(F_PROVVISORIO, !_is_saldaconto); // Il saldaconto vieta i movimenti provvisori m->enable(F_PROVVISORIO, !_is_saldaconto); // Il saldaconto vieta i movimenti provvisori

View File

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

View File

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

View File

@ -388,10 +388,13 @@ void TPrimanota_application::disable_cgs_cells(int n, char tipo)
needs_update = TRUE; 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_COMMESSA); // Commessa
cg.disable_cell(n, CG_FASE); // Fase cg.disable_cell(n, CG_FASE); // Fase
needs_update = TRUE;
} }
COLOR back_color, fore_color; COLOR back_color, fore_color;
@ -528,45 +531,37 @@ bool TPrimanota_application::ci_sono_importi() const
real TPrimanota_application::calcola_saldo() const real TPrimanota_application::calcola_saldo() const
{ {
real tdare, tavere; TImporto importo, bilancio, saldaconto;
TImporto saldaconto;
const bool pag = is_pagamento() && !_as400; const bool pag = is_pagamento() && !_as400;
TString_array& rows = cgs().rows_array(); TString_array& rows = cgs().rows_array();
const int max = rows.items(); for (int i = rows.items()-1; i >= 0; i--)
for (int i = 0; i < max; i++)
{ {
TToken_string& r = rows.row(i); TToken_string& r = rows.row(i);
const real dare(r.get(0)); importo = r;
const real avere(r.get()); bilancio += importo;
tdare += dare;
tavere += avere;
if (pag) if (pag)
{ {
const char tipo = row_type(r); const char tipo = row_type(r);
if (strchr("ACGKP", tipo) != NULL) // Abbuoni attivi, differenze cambio, 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; saldaconto += importo;
} }
} }
}
TMask& m = curr_mask(); TMask& m = curr_mask();
const real sbilancio = abs(tdare)-abs(tavere); bilancio.normalize();
const real absbilancio = abs(tdare - tavere); const real& sbil = bilancio.valore();
switch (sbilancio.sign())
const char sez = bilancio.is_zero() ? 'Z' : bilancio.sezione();
switch (sez)
{ {
case +1: // Il dare supera l'avere in valore assoluto case 'D':
m.set(F_DARE, absbilancio); m.set(F_DARE, sbil);
m.reset(F_AVERE); m.reset(F_AVERE);
break; break;
case -1: // L'avere supera il dare in valore assoluto case 'A':
m.reset(F_DARE); m.reset(F_DARE);
m.set(F_AVERE, absbilancio); m.set(F_AVERE, sbil);
break; break;
default: // Sbilancio nullo default: // Sbilancio nullo
m.reset(F_DARE); m.reset(F_DARE);
@ -584,7 +579,7 @@ real TPrimanota_application::calcola_saldo() const
m.set(K_RESIDUO, totdoc.valore().string()); m.set(K_RESIDUO, totdoc.valore().string());
} }
return sbilancio; return sbil;
} }
HIDDEN bool imptot_error(const TImporto& imptot, const TImporto& impsal, bool val) 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(); TPrimanota_application& a = app();
const TMask& m = a.curr_mask(); const TMask& m = a.curr_mask();
const char* pic = ".";
TString16 codval; TString16 codval;
if (val) if (val)
{
codval = m.get(SK_VALUTA); codval = m.get(SK_VALUTA);
pic = ".3";
}
TCurrency euro(imptot.valore(), codval); TCurrency euro(imptot.valore(), codval);
TString msg(255); TString msg(255);
@ -613,11 +605,11 @@ HIDDEN bool imptot_error(const TImporto& imptot, const TImporto& impsal, bool va
msg << "in valuta " << codval; msg << "in valuta " << codval;
else else
msg << "inserito"; 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()); euro.set_num(cassa.valore());
msg << "i pagamenti e le spese ammontano a " 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()); euro.set_num(residuo.valore());
msg << "per cui il residuo e' " << euro.string(TRUE); 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(); TSheet_field& cg = app().cgs();
const TString80 old = cg.row(first).get(8); 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.row(first).add(f.get(), 8);
cg.force_update(first); 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'); TImporto newimp = a.real2imp(imponibile, 'I');
newimp.normalize(); newimp.normalize();
// Aggiorna conto sulla riga contabile // Aggiorna conto sulla riga contabile
if (newpos < 0) if (newpos < 0)
{ {
TString descr; TString saved_descr;
if (delimp >= 0) if (delimp >= 0)
{ {
TSheet_field& s = a.cgs(); 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 a.reset_cgs_row(delimp); // Cancella vecchia riga
if (deliva > delimp) deliva--; if (deliva > delimp) deliva--;
} }
@ -1518,6 +1510,7 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
if (descr.blank()) if (descr.blank())
descr = cau.desc_agg(2); descr = cau.desc_agg(2);
newpos = a.set_cgs_row(-1, newimp, conto, descr, 'I', conto.commessa(), conto.fase()); newpos = a.set_cgs_row(-1, newimp, conto, descr, 'I', conto.commessa(), conto.fase());
} }
} }
else else
@ -1528,6 +1521,14 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
a.reset_cgs_row(newpos); a.reset_cgs_row(newpos);
newpos = -1; newpos = -1;
} }
else
{
if (delimp >= 0 && delimp != newpos)
{
a.reset_cgs_row(delimp); // Cancella vecchia riga
if (deliva > delimp) deliva--;
}
}
} }
oldimp = newimp; oldimp = newimp;
oldpos = newpos; oldpos = newpos;
@ -1644,6 +1645,23 @@ bool TPrimanota_application::iva_handler(TMask_field& f, KEY k)
return TRUE; 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 // Il gruppo non possiede una ricerca propria per cui se viene variato richiama
// quella del conto. // quella del conto.
bool TPrimanota_application::cg_gruppo_handler(TMask_field& f, KEY key) bool TPrimanota_application::cg_gruppo_handler(TMask_field& f, KEY key)
@ -1834,7 +1852,7 @@ bool TPrimanota_application::caus_query_handler(TMask_field& f, KEY key)
if (f.to_check(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 int ann = m.get_int(F_ANNOIVA);
const TipoIVA i = app().cau2IVA(cau, ann); // Cerca causale e suo tipo 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 // Handler of the F_DATACOMP field on the modify mask
// Certified 90% // Certified 98%
bool TPrimanota_application::datacomp_handler(TMask_field& f, KEY key) bool TPrimanota_application::datacomp_handler(TMask_field& f, KEY key)
{ {
TMask& m = f.mask(); 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 m.set(F_ANNOES, ae, TRUE); // Aggiorna anno esercizio in entrambe le pagine
data = "di competenza"; 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) if (ae)
@ -2855,4 +2889,3 @@ bool TPrimanota_application::solaiva_handler(TMask_field& f, KEY key)
} }
return TRUE; 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 imposta_handler(TMask_field& f, KEY key);
static bool dareavere_handler(TMask_field& f, KEY k); static bool dareavere_handler(TMask_field& f, KEY k);
static bool fase_handler(TMask_field& f, KEY key); 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_gruppo_handler(TMask_field& f, KEY key);
static bool cg_conto_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 GROUPBOX DLG_NULL 66 3
BEGIN BEGIN
PROMPT 1 1 "Descrizione" PROMPT 1 0 "@bDescrizione riga"
END END
STRING 108 5 STRING 108 5
BEGIN BEGIN
PROMPT 2 2 "" PROMPT 2 1 ""
FLAGS "UZ" FLAGS "UZ"
USE %DPN USE %DPN
INPUT CODTAB 108 INPUT CODTAB 108
@ -20,7 +20,7 @@ END
STRING CG_DESCR 50 STRING CG_DESCR 50
BEGIN BEGIN
PROMPT 12 2 "" PROMPT 12 1 ""
USE %DPN KEY 2 USE %DPN KEY 2
INPUT S0 109 INPUT S0 109
DISPLAY "Descrizione@50" S0 DISPLAY "Descrizione@50" S0
@ -31,22 +31,22 @@ END
GROUPBOX DLG_NULL 66 5 GROUPBOX DLG_NULL 66 5
BEGIN BEGIN
PROMPT 1 4 "Conto principale" PROMPT 1 3 "@bConto principale"
END END
CURRENCY CG_DARE 18 CURRENCY CG_DARE 18
BEGIN BEGIN
PROMPT 2 5 "Dare " PROMPT 2 4 "Dare "
END END
CURRENCY CG_AVERE 18 CURRENCY CG_AVERE 18
BEGIN BEGIN
PROMPT 38 5 "Avere " PROMPT 38 4 "Avere "
END END
LIST CG_TIPO 1 10 LIST CG_TIPO 1 10
BEGIN BEGIN
PROMPT 2 6 "Tipo " PROMPT 2 5 "Tipo "
FLAGS "U" FLAGS "U"
ITEM " |Conto" MESSAGE SHOW,106|HIDE,206|HIDE,306|SHOW,107|HIDE,207|HIDE,307 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 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 NUMBER CG_GRUPPO 3
BEGIN BEGIN
PROMPT 20 6 "Gruppo " PROMPT 20 5 "Gruppo "
FIELD GRUPPO FIELD GRUPPO
END END
NUMBER CG_CONTO 3 NUMBER CG_CONTO 3
BEGIN BEGIN
PROMPT 32 6 "Conto " PROMPT 32 5 "Conto "
FIELD CONTO FIELD CONTO
USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="") USE LF_PCON SELECT (CONTO!="") && (SOTTOCONTO="")
INPUT GRUPPO 104 INPUT GRUPPO 104
@ -82,7 +82,7 @@ END
NUMBER CG_SOTTOCONTO 6 NUMBER CG_SOTTOCONTO 6
BEGIN BEGIN
PROMPT 45 6 "Sottoconto " PROMPT 45 5 "Sottoconto "
FIELD SOTTOCONTO FIELD SOTTOCONTO
USE LF_PCON SELECT SOTTOCONTO!="" USE LF_PCON SELECT SOTTOCONTO!=""
INPUT GRUPPO 104 INPUT GRUPPO 104
@ -103,7 +103,7 @@ END
NUMBER 206 6 NUMBER 206 6
BEGIN BEGIN
PROMPT 45 6 "Cliente " PROMPT 45 5 "Cliente "
FIELD SOTTOCONTO FIELD SOTTOCONTO
USE LF_CLIFO USE LF_CLIFO
INPUT TIPOCF "C" INPUT TIPOCF "C"
@ -122,7 +122,7 @@ END
NUMBER 306 6 NUMBER 306 6
BEGIN BEGIN
PROMPT 45 6 "Fornitore " PROMPT 45 5 "Fornitore "
FIELD SOTTOCONTO FIELD SOTTOCONTO
USE LF_CLIFO USE LF_CLIFO
INPUT TIPOCF "F" INPUT TIPOCF "F"
@ -142,7 +142,7 @@ END
STRING 107 50 STRING 107 50
BEGIN BEGIN
PROMPT 2 7 "Descriz. " PROMPT 2 6 "Descriz. "
FIELD DESCRCONTO FIELD DESCRCONTO
USE LF_PCON KEY 2 USE LF_PCON KEY 2
INPUT DESCR 107 INPUT DESCR 107
@ -158,7 +158,7 @@ END
STRING 207 50 STRING 207 50
BEGIN BEGIN
PROMPT 2 7 "Cliente " PROMPT 2 6 "Cliente "
FIELD LF_CLIFO->RAGSOC FIELD LF_CLIFO->RAGSOC
USE LF_CLIFO KEY 2 USE LF_CLIFO KEY 2
INPUT TIPOCF "C" INPUT TIPOCF "C"
@ -176,7 +176,7 @@ END
STRING 307 50 STRING 307 50
BEGIN BEGIN
PROMPT 2 7 "Fornitore " PROMPT 2 6 "Fornitore "
FIELD LF_PCON->SOTTOCONTO FIELD LF_PCON->SOTTOCONTO
USE LF_CLIFO KEY 2 USE LF_CLIFO KEY 2
INPUT TIPOCF "F" INPUT TIPOCF "F"
@ -194,12 +194,12 @@ END
GROUPBOX DLG_NULL 66 4 GROUPBOX DLG_NULL 66 4
BEGIN BEGIN
PROMPT 1 9 "Contropartita" PROMPT 1 8 "@bContropartita"
END END
LIST 110 1 10 LIST 110 1 10
BEGIN BEGIN
PROMPT 2 10 "Tipo " PROMPT 2 9 "Tipo "
FLAGS "U" FLAGS "U"
ITEM " |Conto" MESSAGE SHOW,113|HIDE,213|HIDE,313|SHOW,114|HIDE,214|HIDE,314 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 ITEM "C|Cliente" MESSAGE SHOW,213|HIDE,113|HIDE,313|SHOW,214|HIDE,114|HIDE,314
@ -208,13 +208,13 @@ END
NUMBER 111 3 NUMBER 111 3
BEGIN BEGIN
PROMPT 20 10 "Gruppo " PROMPT 20 9 "Gruppo "
FIELD GRUPPOC FIELD GRUPPOC
END END
NUMBER 112 3 NUMBER 112 3
BEGIN BEGIN
PROMPT 32 10 "Conto " PROMPT 32 9 "Conto "
FIELD CONTOC FIELD CONTOC
COPY USE 105 COPY USE 105
INPUT GRUPPO 111 INPUT GRUPPO 111
@ -232,7 +232,7 @@ END
NUMBER 113 6 NUMBER 113 6
BEGIN BEGIN
PROMPT 45 10 "Sottoconto " PROMPT 45 9 "Sottoconto "
FIELD SOTTOCONTC FIELD SOTTOCONTC
COPY USE 106 COPY USE 106
COPY INPUT 112 COPY INPUT 112
@ -247,7 +247,7 @@ END
NUMBER 213 6 NUMBER 213 6
BEGIN BEGIN
PROMPT 45 10 "Cliente " PROMPT 45 9 "Cliente "
FIELD SOTTOCONTC FIELD SOTTOCONTC
COPY USE 206 COPY USE 206
INPUT TIPOCF "C" INPUT TIPOCF "C"
@ -261,7 +261,7 @@ END
NUMBER 313 6 NUMBER 313 6
BEGIN BEGIN
PROMPT 45 10 "Fornitore " PROMPT 45 9 "Fornitore "
FIELD SOTTOCONTC FIELD SOTTOCONTC
COPY USE 306 COPY USE 306
INPUT TIPOCF "F" INPUT TIPOCF "F"
@ -275,7 +275,7 @@ END
STRING 114 50 STRING 114 50
BEGIN BEGIN
PROMPT 2 11 "Descriz. " PROMPT 2 10 "Descriz. "
FIELD DESCRCONTOC FIELD DESCRCONTOC
COPY USE 107 COPY USE 107
INPUT DESCR 114 INPUT DESCR 114
@ -287,7 +287,7 @@ END
STRING 214 50 STRING 214 50
BEGIN BEGIN
PROMPT 2 11 "Cliente " PROMPT 2 10 "Cliente "
FIELD DESCRCONTOC FIELD DESCRCONTOC
COPY USE 207 COPY USE 207
INPUT TIPOCF "C" INPUT TIPOCF "C"
@ -301,7 +301,7 @@ END
STRING 314 50 STRING 314 50
BEGIN BEGIN
PROMPT 2 11 "Fornitore " PROMPT 2 10 "Fornitore "
FIELD DESCRCONTOC FIELD DESCRCONTOC
COPY USE 307 COPY USE 307
INPUT TIPOCF "F" INPUT TIPOCF "F"
@ -313,33 +313,62 @@ BEGIN
WARNING "Fornitore inesistente sulla riga contabile" WARNING "Fornitore inesistente sulla riga contabile"
END END
GROUPBOX 155 66 4
BEGIN
PROMPT 1 12 "@bCentro di costo / Commessa"
END
STRING CG_COMMESSA 20 STRING CG_COMMESSA 20
BEGIN BEGIN
PROMPT 2 13 "Commessa " PROMPT 2 13 "Codice "
FLAGS "UZ" FLAGS "UZ"
USE CMS USE CMS
INPUT CODTAB CG_COMMESSA INPUT CODTAB CG_COMMESSA
DISPLAY "Codice@20" CODTAB DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@50" S0 DISPLAY "Descrizione@50" S0
OUTPUT CG_COMMESSA CODTAB 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 CHECKTYPE NORMAL
END END
STRING CG_FASE 10 STRING CG_FASE 10
BEGIN BEGIN
PROMPT 36 13 "Fase " PROMPT 2 14 "Fase "
FLAGS "UZ" FLAGS "UZ"
USE FSC USE FSC
INPUT CODTAB CG_FASE INPUT CODTAB CG_FASE
DISPLAY "Codice@10" CODTAB DISPLAY "Codice@10" CODTAB
DISPLAY "Descrizione@50" S0 DISPLAY "Descrizione@50" S0
OUTPUT CG_FASE CODTAB 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 CHECKTYPE NORMAL
END END
LIST CG_ROWTYPE 24 LIST CG_ROWTYPE 24
BEGIN BEGIN
PROMPT 26 14 "Tipo riga " PROMPT 28 16 "Tipo riga "
ITEM " |Sola contabilita'" ITEM " |Sola contabilita'"
ITEM "A|Abbuoni attivi" ITEM "A|Abbuoni attivi"
ITEM "C|Differenza cambi" ITEM "C|Differenza cambi"
@ -377,7 +406,7 @@ BEGIN
MESSAGE EXIT,K_DEL MESSAGE EXIT,K_DEL
END END
BUTTON 100 9 2 BUTTON DLG_USER 10 2
BEGIN BEGIN
PROMPT -44 -1 "~Partite" PROMPT -44 -1 "~Partite"
END 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 GROUPBOX DLG_NULL 76 5
BEGIN BEGIN
@ -235,26 +235,56 @@ BEGIN
HELP "Tipo Costo/Ricavo del conto" HELP "Tipo Costo/Ricavo del conto"
END END
GROUPBOX 155 76 4
BEGIN
PROMPT 1 11 "@bCentro di costo / Commessa"
END
STRING 111 20 STRING 111 20
BEGIN BEGIN
PROMPT 2 11 "Commessa " PROMPT 2 12 "Codice "
FLAGS "UZ" FLAGS "UZ"
USE CMS USE CMS
INPUT CODTAB 111 INPUT CODTAB 111
DISPLAY "Codice@20" CODTAB DISPLAY "Codice@20" CODTAB
DISPLAY "Decrizione@50" S0 DISPLAY "Decrizione@50" S0
OUTPUT 111 CODTAB 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 END
STRING 112 10 STRING 112 10
BEGIN BEGIN
PROMPT 36 11 "Fase " PROMPT 2 13 "Fase "
FLAGS "UZ" FLAGS "UZ"
USE FSC USE FSC
INPUT CODTAB 112 INPUT CODTAB 112
DISPLAY "Codice@10" CODTAB DISPLAY "Codice@10" CODTAB
DISPLAY "Decrizione@50" S0 DISPLAY "Decrizione@50" S0
OUTPUT 112 CODTAB 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 END
BUTTON DLG_OK 10 2 BUTTON DLG_OK 10 2

View File

@ -3,6 +3,7 @@
// //
#include <currency.h> #include <currency.h>
#include <mask.h> #include <mask.h>
#include <modaut.h>
#include <printapp.h> #include <printapp.h>
#include <recarray.h> #include <recarray.h>
#include <tabutil.h> #include <tabutil.h>
@ -71,6 +72,8 @@ class TListaMov_application : public TPrintapp
friend bool data_inizio (TMask_field&, KEY); friend bool data_inizio (TMask_field&, KEY);
friend bool data_fine (TMask_field&, KEY); friend bool data_fine (TMask_field&, KEY);
static bool cdc_handler (TMask_field& f, KEY k);
TRigaiva_array _c; TRigaiva_array _c;
TTable * _tabiva, * _tabtpd, * _tabreg, * _tabes; TTable * _tabiva, * _tabtpd, * _tabreg, * _tabes;
TLocalisamfile * _caus,* _comuni,* _rmoviva, * _clifo, * _pcon, * _attiv, *_nditte, *_saldi; TLocalisamfile * _caus,* _comuni,* _rmoviva, * _clifo, * _pcon, * _attiv, *_nditte, *_saldi;
@ -105,8 +108,8 @@ class TListaMov_application : public TPrintapp
liste _tipo_lista; liste _tipo_lista;
word _flags; word _flags;
char _tipoc; char _tipoc;
TString _cdc; TString _cdc, _fsc;
bool _cdc_only; bool _cdc_only, _print_cdc;
TDecoder _simbval, _descdoc; TDecoder _simbval, _descdoc;
protected: protected:
@ -145,6 +148,7 @@ public:
const TString& DescrDoc(const char* cod); const TString& DescrDoc(const char* cod);
const TString& cdc() const { return _cdc; } const TString& cdc() const { return _cdc; }
const TString& fsc() const { return _fsc; }
TListaMov_application(char tipost); TListaMov_application(char tipost);
virtual ~TListaMov_application() {} virtual ~TListaMov_application() {}
@ -239,6 +243,25 @@ bool data_fine(TMask_field& f, KEY k)
return TRUE; 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) bool TListaMov_application::RicercaDoc(const char * tipo)
{ {
TTable tab_tpd(TAB_TPD); TTable tab_tpd(TAB_TPD);
@ -449,6 +472,7 @@ bool cdc_filter(const TRelation* rel)
const TRecnotype oldpos = rmov.recno(); const TRecnotype oldpos = rmov.recno();
const long numreg = rel->curr(LF_MOV).get_long(MOV_NUMREG); const long numreg = rel->curr(LF_MOV).get_long(MOV_NUMREG);
const TString& cdc = app().cdc(); const TString& cdc = app().cdc();
const TString& fsc = app().fsc();
rmov.zero(); rmov.zero();
rmov.put(RMV_NUMREG, numreg); rmov.put(RMV_NUMREG, numreg);
rmov.put(RMV_NUMRIG, 1); rmov.put(RMV_NUMRIG, 1);
@ -458,7 +482,11 @@ bool cdc_filter(const TRelation* rel)
break; break;
if (rmov.get(RMV_CODCMS) == cdc) if (rmov.get(RMV_CODCMS) == cdc)
{ {
if (fsc.not_empty())
ok = (rmov.get(RMV_FASCMS) == fsc);
else
ok = TRUE; ok = TRUE;
if (ok)
break; break;
} }
} }
@ -748,6 +776,9 @@ void TListaMov_application::stampa_errori_mov()
void TListaMov_application::set_page(int file, int count) void TListaMov_application::set_page(int file, int count)
{ {
TString riga_commessa(132);
riga_commessa.cut(0);
switch (_tipo_lista) switch (_tipo_lista)
{ {
case movimenti: case movimenti:
@ -756,11 +787,25 @@ void TListaMov_application::set_page(int file, int count)
if (file == LF_RMOV) if (file == LF_RMOV)
{ {
_nr = 1; _nr = 1;
const TRectype& rec = current_cursor()->curr(LF_RMOV);
if (_cdc.not_empty()) if (_cdc.not_empty())
{ {
const TRectype& rec = current_cursor()->curr(LF_RMOV);
if (rec.get(RMV_CODCMS) == _cdc) if (rec.get(RMV_CODCMS) == _cdc)
{ {
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) if (!_cdc_only)
set_row(_nr,"@0g@b"); // Grassettiamo le righe interessate set_row(_nr,"@0g@b"); // Grassettiamo le righe interessate
} }
@ -781,6 +826,26 @@ void TListaMov_application::set_page(int file, int count)
set_row(_nr,"@90g@n",FLD(LF_RMOV,RMV_IMPORTO)); set_row(_nr,"@90g@n",FLD(LF_RMOV,RMV_IMPORTO));
else else
set_row(_nr,"@110g@n",FLD(LF_RMOV,RMV_IMPORTO)); 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) else if (file == LF_MOV)
{ {
@ -1343,6 +1408,8 @@ print_action TListaMov_application::postprocess_page(int file,int count)
_tot_dare_giornaliero += _tot_dare; _tot_dare_giornaliero += _tot_dare;
//stampa i totali giornalieri //stampa i totali giornalieri
if (!_cdc_only)
{
if ( FINITO || if ( FINITO ||
(_datareg != datarec)||(_numreg == _numreg_fin)) (_datareg != datarec)||(_numreg == _numreg_fin))
{ {
@ -1360,6 +1427,7 @@ print_action TListaMov_application::postprocess_page(int file,int count)
set_row(n++, "@b@90g%r %r", &_tot_dare_generale, &_tot_avere_generale); set_row(n++, "@b@90g%r %r", &_tot_dare_generale, &_tot_avere_generale);
} }
} }
}
if (n == 1) if (n == 1)
{ {
@ -2069,11 +2137,22 @@ bool TListaMov_application::set_print(int)
} }
TMask msk(masc); TMask msk(masc);
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_ANNO, annoes_handler);
msk.set_handler(F_DATAINI, data_inizio); msk.set_handler(F_DATAINI, data_inizio);
msk.set_handler(F_DATAFIN, data_fine); 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) 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()) 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);
@ -2084,21 +2163,44 @@ bool TListaMov_application::set_print(int)
TCursor cur(&rel, "", 1, &darec, &arec); TCursor cur(&rel, "", 1, &darec, &arec);
const long items = cur.items(); const long items = cur.items();
cur.freeze(); 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) for (cur = 0L; cur.pos() < items; ++cur)
{ {
_cdc = rel.curr().get("CODTAB"); _cdc = rel.curr().get("CODTAB");
if (!da_fsc.empty() || !a_fsc.empty())
{
for (fsccur = 0L; fsccur.pos() < fsc_items; ++fsccur)
{
_fsc = fsccur.curr().get("CODTAB");
imposta_parametri_stampa(msk); imposta_parametri_stampa(msk);
print(); print();
} }
} }
else else
{ {
_cdc_only = FALSE; _fsc.cut(0);
_cdc.cut(0);
imposta_parametri_stampa(msk); imposta_parametri_stampa(msk);
print(); print();
} }
} }
}
else
{
_cdc_only = FALSE;
_cdc.cut(0); _fsc.cut(0);
imposta_parametri_stampa(msk);
print();
}
msk.reset(-5);
}
return FALSE; return FALSE;
} }
@ -2302,11 +2404,26 @@ void TListaMov_application::init_print(const TMask& msk)
void TListaMov_application::set_cdc_header(int& soh) void TListaMov_application::set_cdc_header(int& soh)
{ {
if (_cdc.not_empty()) 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; TString str;
str.cut(0) << "@bCommessa " << _cdc << " - " << cache().get("CMS", _cdc, "S0"); str.cut(0) << "@bCommessa " << _cdc << " - " << cache().get("CMS", _cdc, "S0");
set_header(++soh, str); set_header(++soh, str);
} }
*/
} }
void TListaMov_application::preprocess_header() void TListaMov_application::preprocess_header()
@ -2449,6 +2566,7 @@ void TListaMov_application::preprocess_header()
else else
set_header (soh++, "@86gtutte le causali"); set_header (soh++, "@86gtutte le causali");
set_cdc_header(soh); set_cdc_header(soh);
soh++;
sep.fill('_'); sep.fill('_');
set_header (soh++, (const char *) sep); set_header (soh++, (const char *) sep);
set_header (soh, "Rg Cod Causale@30gDescrizione@56gCodice conto@71gDescrizione conto@103gDare@120gAvere@130gSB"); 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_RAGSOCFIN1 130
#define F_SEPARATOR 131 #define F_SEPARATOR 131
#define F_DACDC 132 #define F_DACDC 132
#define F_DACDC_DES 133 #define F_ACDC 133
#define F_ACDC 134 #define F_CDC_ONLY 134
#define F_ACDC_DES 135 #define F_DAFASE 135
#define F_CDC_ONLY 136 #define F_AFASE 136
#define F_PRINTCDC 137
#define ST_DATA 0x0001 #define ST_DATA 0x0001
#define ST_NUMERO 0x0002 #define ST_NUMERO 0x0002

View File

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

View File

@ -73,6 +73,7 @@ class TMastrini_application : public TPrintapp
static bool contof_hnd (TMask_field& f, KEY k); static bool contof_hnd (TMask_field& f, KEY k);
static bool sottoc_handler_ini (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 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 memorizza_handler(TMask_field& f, KEY k);
static bool scelte_notify(TSheet_field& s, int r, 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 _rw, _conta_mastrini, _indice_array, _item, _item_lista, _indice_lista;
int _ddociva_len; int _ddociva_len;
bool _noseparator; bool _noseparator, _print_cdc;
TString _real_picture; TString _real_picture;
TString _cdc; TString _cdc;
real _totale_commessa_dare, _totale_commessa_avere, _saldo_commessa; 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(); 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) bool TMastrini_application::sottoc_handler_ini(TMask_field& f, KEY key)
{ {
const TMask& m = f.mask(); const TMask& m = f.mask();
@ -667,8 +686,11 @@ bool TMastrini_application::almeno_un_record()
TString filter; TString filter;
if (_cdc.not_empty()) if (_cdc.not_empty())
filter << RMV_CODCMS << "==\"" << _cdc << '"'; {
filter << '(' << RMV_CODCMS << "=='" << _cdc << "')";
if (_fsc.not_empty())
filter << "&&(" << RMV_FASCMS << "=='" << _fsc << "')";
}
rmov.zero(); rmov.zero();
rmov.put(RMV_GRUPPO, _gruppo); rmov.put(RMV_GRUPPO, _gruppo);
rmov.put(RMV_CONTO, _conto); rmov.put(RMV_CONTO, _conto);
@ -921,6 +943,9 @@ void TMastrini_application::fai_stampa132()
set_row (_rw,"@38g#3t", &_codcaus); set_row (_rw,"@38g#3t", &_codcaus);
set_row (_rw,"@117g#t #t #t", &_g_contr, &_c_contr, &_s_contr); 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() void TMastrini_application::fai_stampa198()
@ -1038,11 +1063,12 @@ void TMastrini_application::stampa_totali_commessa()
{ {
if (_cdc.not_empty()) if (_cdc.not_empty())
{ {
_rw = 1; // _rw = 1;
{ {
_saldo_commessa = _totale_commessa_dare - _totale_commessa_avere; _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) if (_numcarat == 1)
{ {
@ -1063,12 +1089,10 @@ void TMastrini_application::stampa_totali_commessa()
void TMastrini_application::stampa_totali132() void TMastrini_application::stampa_totali132()
{ {
TString sep(132);
if (_nummast == 1 || _nummast == 3) if (_nummast == 1 || _nummast == 3)
_rw = 2; _rw = 2;
sep.fill('_'); //Stampa 132 - (sep(132)) const TString sep(132, '_'); //Stampa 132 - (sep(132))
set_row(_rw++,"@0g%s", (const char*)sep); set_row(_rw++,"@0g%s", (const char*)sep);
_totprogre_dare=_progredare+_totale_periodo_dare; _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,"@83g%r", &_totprogre_dare_al);
set_row (_rw,"@100g%r", &_totprogre_avere_al); set_row (_rw,"@100g%r", &_totprogre_avere_al);
} }
stampa_totali_commessa();
_devi_stampare_footer = FALSE; _devi_stampare_footer = FALSE;
} }
@ -1260,7 +1287,8 @@ void TMastrini_application::stampa_totali198()
if (_nummast == 1 || _nummast == 3) if (_nummast == 1 || _nummast == 3)
_rw = 1; _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); set_row(_rw,"@0g%s", (const char*)sep);
_totprogre_dare=_progredare+_totale_periodo_dare; _totprogre_dare=_progredare+_totale_periodo_dare;
@ -1283,6 +1311,9 @@ void TMastrini_application::stampa_totali198()
if (!_stampa_des_contro) if (!_stampa_des_contro)
set_row (_rw,"@135g%r", &_saldo_progre_al); set_row (_rw,"@135g%r", &_saldo_progre_al);
} }
stampa_totali_commessa();
_devi_stampare_footer = FALSE; _devi_stampare_footer = FALSE;
} }
@ -1586,6 +1617,8 @@ bool TMastrini_application::preprocess_page(int file, int counter)
TLocalisamfile& rmov = current_cursor()->file(LF_RMOV); TLocalisamfile& rmov = current_cursor()->file(LF_RMOV);
if (_cdc.not_empty() && rmov.get(RMV_CODCMS) != _cdc) if (_cdc.not_empty() && rmov.get(RMV_CODCMS) != _cdc)
return FALSE; return FALSE;
if (_fsc.not_empty() && rmov.get(RMV_FASCMS) != _fsc)
return FALSE;
//Il flag _gia_stampata_intestazione serve nella stampa in continuo, xche' //Il flag _gia_stampata_intestazione serve nella stampa in continuo, xche'
//sono costretto a richiamare l'intestazione sia nella preprocess_page (per //sono costretto a richiamare l'intestazione sia nella preprocess_page (per
@ -1611,6 +1644,23 @@ bool TMastrini_application::preprocess_page(int file, int counter)
_c_contr = rmov.get(RMV_CONTOC); _c_contr = rmov.get(RMV_CONTOC);
_s_contr = rmov.get(RMV_SOTTOCONTOC); _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 // Stampa solo quelli che hanno anno esercizio uguale a quello specificato
// nella maschera. Se non viene specificato li stampa tutti // 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); _importo_str = real2str(_importo);
_mov->setkey(1); _mov->setkey(1);
_mov->curr().zero(); _mov->curr().zero();
_mov->curr().put(MOV_NUMREG,_numreg); _mov->put(MOV_NUMREG,_numreg);
_mov->read(); _mov->read();
if (_mov->bad()) if (_mov->bad())
_mov->zero(); _mov->zero();
_annoes = _mov->get_int(MOV_ANNOES); _annoes = _mov->get_int(MOV_ANNOES);
_regiva = _mov->curr().get(MOV_REG); _regiva = _mov->get(MOV_REG);
_annoiva = _mov->curr().get_int(MOV_ANNOIVA); _annoiva = _mov->get_int(MOV_ANNOIVA);
// Controlla se saldo e' diverso da 0 // Controlla se saldo e' diverso da 0
@ -1640,11 +1690,11 @@ bool TMastrini_application::preprocess_page(int file, int counter)
else else
if (_annomsk != 0) if (_annomsk != 0)
{ {
_datareg = _mov->curr().get(MOV_DATACOMP); _datareg = _mov->get(MOV_DATACOMP);
_datareg_stampa = _mov->curr().get(MOV_DATAREG); _datareg_stampa = _mov->get(MOV_DATAREG);
} }
provvis = _mov->curr().get(MOV_PROVVIS); provvis = _mov->get(MOV_PROVVIS);
_dataregs = _datareg_stampa.string(); _dataregs = _datareg_stampa.string();
@ -1666,8 +1716,8 @@ bool TMastrini_application::preprocess_page(int file, int counter)
else else
set_row(_rw, "@195gP"); set_row(_rw, "@195gP");
_codcaus = _mov->curr().get(MOV_CODCAUS); _codcaus = _mov->get(MOV_CODCAUS);
_tipodoc = _mov->curr().get(MOV_TIPODOC); _tipodoc = _mov->get(MOV_TIPODOC);
if (_stampatotiva && (_tmcf == 'C' || _tmcf == 'F')) if (_stampatotiva && (_tmcf == 'C' || _tmcf == 'F'))
{ {
if (_tipodoc != "") if (_tipodoc != "")
@ -1678,14 +1728,14 @@ bool TMastrini_application::preprocess_page(int file, int counter)
_ddociva_len = _descrdociva.len(); _ddociva_len = _descrdociva.len();
} }
} }
_datadoc = (_mov->curr().get(MOV_DATADOC)); _datadoc = _mov->get(MOV_DATADOC);
_datadocs = _datadoc.string(); _datadocs = _datadoc.string();
_numdoc = _mov->curr().get(MOV_NUMDOC); _numdoc = _mov->get(MOV_NUMDOC);
descrizione_causale(); descrizione_causale();
_descrizionemov = _mov->curr().get(MOV_DESCR); _descrizionemov = _mov->get(MOV_DESCR);
_numgio = atol(_mov->curr().get(MOV_NUMGIO)); _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) if (_nummast == 1 || _nummast == 3)
{ {
@ -1786,19 +1836,19 @@ bool TMastrini_application::preprocess_page(int file, int counter)
if (_descrizione != "") if (_descrizione != "")
{ {
d23 = _descrizione; d23 = _descrizione;
if (_descrizionemov != "") if (_descrizionemov.not_empty())
d18 = _descrizionemov; d18 = _descrizionemov;
else if (_descrizionemov == "") else
d18 = _descrcaus; d18 = _descrcaus;
} }
else if (_descrizione == "") else if (_descrizione.empty())
if (_descrizionemov != "") {
if (_descrizionemov.not_empty())
{ {
d23 = _descrizionemov; d23 = _descrizionemov;
d18 = _descrcaus; d18 = _descrcaus;
} }
else else
if (_descrizionemov == "")
{ {
conto(_gruppocontr,_contocontr,FALSE); conto(_gruppocontr,_contocontr,FALSE);
TConto tc (_gruppocontr,_contocontr,_sottocontocontr,_tipo_contr); TConto tc (_gruppocontr,_contocontr,_sottocontocontr,_tipo_contr);
@ -1807,13 +1857,13 @@ bool TMastrini_application::preprocess_page(int file, int counter)
if (_descrcontr != "Sconosciuto") if (_descrcontr != "Sconosciuto")
d23 = _descrcontr; d23 = _descrcontr;
} }
}
TParagraph_string d_18 (d18,18); TParagraph_string d_18 (d18,18);
int i = 0; int i = 0;
const char* str; const char* str;
while ( (str = d_18.get()) != NULL) while ( (str = d_18.get()) != NULL)
{ {
TString stringa = ""; TString stringa;
stringa << "@42g" << str; stringa << "@42g" << str;
setta_riga(i,stringa); setta_riga(i,stringa);
i++; i++;
@ -1823,7 +1873,7 @@ bool TMastrini_application::preprocess_page(int file, int counter)
i = 0; i = 0;
while ( (str = d_23.get()) != NULL) while ( (str = d_23.get()) != NULL)
{ {
TString stringa = ""; TString stringa;
stringa << "@61g" << str; stringa << "@61g" << str;
setta_riga(i,stringa); setta_riga(i,stringa);
i++; i++;
@ -1832,7 +1882,7 @@ bool TMastrini_application::preprocess_page(int file, int counter)
else else
if (_numcarat == 2) // Stampa 198 caratteri if (_numcarat == 2) // Stampa 198 caratteri
{ {
if (_descrizione != "") if (_descrizione.not_empty())
{ {
d30 = _descrizione; d30 = _descrizione;
if (_descrizionemov != "") if (_descrizionemov != "")
@ -1840,14 +1890,14 @@ bool TMastrini_application::preprocess_page(int file, int counter)
else if (_descrizionemov == "") else if (_descrizionemov == "")
d23 = _descrcaus; d23 = _descrcaus;
} }
else if (_descrizione == "") else
if (_descrizionemov != "") {
if (_descrizionemov.not_empty())
{ {
d30 = _descrizionemov; d30 = _descrizionemov;
d23 = _descrcaus; d23 = _descrcaus;
} }
else else
if (_descrizionemov == "")
{ {
conto(_gruppocontr,_contocontr,FALSE); conto(_gruppocontr,_contocontr,FALSE);
TConto tc (_gruppocontr,_contocontr,_sottocontocontr,_tipo_contr); TConto tc (_gruppocontr,_contocontr,_sottocontocontr,_tipo_contr);
@ -1856,13 +1906,13 @@ bool TMastrini_application::preprocess_page(int file, int counter)
if (_descrcontr != "Sconosciuto") if (_descrcontr != "Sconosciuto")
d30 = _descrcontr; d30 = _descrcontr;
} }
}
TParagraph_string d_23 (d23,23); TParagraph_string d_23 (d23,23);
int i = 0; int i = 0;
const char* str; const char* str;
while ( (str = d_23.get()) != NULL) while ( (str = d_23.get()) != NULL)
{ {
TString stringa = ""; TString stringa;
stringa << "@46g" << str; stringa << "@46g" << str;
setta_riga(i,stringa); setta_riga(i,stringa);
i++; i++;
@ -2299,11 +2349,8 @@ print_action TMastrini_application::postprocess_page(int file, int counter)
if (righe_rimaste > 0) if (righe_rimaste > 0)
{ {
_rw++; //incremento la riga altrimenti copro l'ultimo totale settato con una riga bianca _rw++; //incremento la riga altrimenti copro l'ultimo totale settato con una riga bianca
TString sep = " ";
for (int i = 0; i < righe_rimaste; i++) 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) if (file == LF_SALDI)
{ {
reset_print(); reset_print();
stampa_totali_commessa(); // stampa_totali_commessa();
print_one(file); print_one(file);
_msk->reset(-9); _msk->reset(-9);
@ -2437,7 +2484,7 @@ bool TMastrini_application::preprocess_print(int file, int counter)
return TRUE; return TRUE;
} }
bool TMastrini_application::set_print(int) bool TMastrini_application::set_print(int m)
{ {
KEY tasto = K_ENTER; KEY tasto = K_ENTER;
while (tasto == K_ENTER) while (tasto == K_ENTER)
@ -2567,6 +2614,8 @@ bool TMastrini_application::set_print(int)
enable_print_menu(); enable_print_menu();
enable_link("Collegamento prima nota: ", 'b'); 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()) if (_msk->get(F_DACDC).not_empty() || _msk->get(F_ACDC).not_empty())
{ {
TRelation rel("CMS"); TRelation rel("CMS");
@ -2576,18 +2625,53 @@ bool TMastrini_application::set_print(int)
TCursor cur(&rel, "", 1, &darec, &arec); TCursor cur(&rel, "", 1, &darec, &arec);
const long items = cur.items(); const long items = cur.items();
cur.freeze(); 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) for (cur = 0L; cur.pos() < items; ++cur)
{ {
_cdc = rel.curr().get("CODTAB"); _cdc = rel.curr().get("CODTAB");
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(); 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 else
{ {
_cdc.cut(0); _cdc.cut(0);
_fsc.cut(0);
do
print(); print();
while (need_to_repeat_print());
} }
_msk->reset(-8);
} }
return FALSE; return FALSE;
@ -2817,8 +2901,16 @@ void TMastrini_application::crea_intestazione()
if (_cdc.not_empty()) if (_cdc.not_empty())
{ {
const char* descr = cache().get("CMS", _cdc, "S0"); const TString& desc_cdc = cache().get("CMS", _cdc, "S0");
set_header(2, "@bCommessa %s - %s", (const char*)_cdc, descr); 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) if (_nummast == 3)
@ -2869,14 +2961,14 @@ void TMastrini_application::crea_intestazione()
set_header (6,"@0g%s", (const char*)sep1); set_header (6,"@0g%s", (const char*)sep1);
if (_stampa_des_contro) if (_stampa_des_contro)
{ {
set_header (7,"%s@23g%s@34g%s@183g%s@190g%s@197g%s", set_header (7,"%s@23g%s@183g%s@190g%s@197g%s",
trans("Operazione"), trans("Data"), trans("Numero"), trans("Operazione"), trans("Documento"),
trans("Reg"), trans("Numero"), trans("A")); trans("Reg"), trans("Numero"), trans("A"));
} }
else else
{ {
set_header (7,"%s@23g%s@34g%s@169g%s@183g%s@190g%s@197g%s", set_header (7,"%s@23g%s@169g%s@183g%s@190g%s@197g%s",
trans("Operazione"), trans("Data"), trans("Numero"), trans("Contro"), trans("Operazione"), trans("Documento"), trans("Contro"),
trans("Reg"), trans("Numero"), trans("A")); trans("Reg"), trans("Numero"), trans("A"));
} }
if (_stampa_mov_prov) if (_stampa_mov_prov)
@ -2887,15 +2979,15 @@ void TMastrini_application::crea_intestazione()
if (_stampa_des_contro) 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", set_header (8,"@23g%s@34g%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"), trans("Data"), trans("Numero"), trans("Cod.Causale"), trans("Descrizione"), trans("Dare"), trans("Avere"),
trans("Contropartita"), trans("Iva"), trans("Contropartita"), trans("Iva"),
trans("Protoc."), trans("C")); trans("Protoc."), trans("C"));
} }
else 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", 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("Documento"), trans("Cod.Causale"), trans("Descrizione"), trans("Dare"), trans("Avere"), trans("Data"), trans("Numero"), trans("Cod.Causale"), trans("Descrizione"), trans("Dare"), trans("Avere"),
trans("Saldo progre."), trans("Saldo movim."), trans("Partita"), trans("Iva"), trans("Saldo progre."), trans("Saldo movim."), trans("Partita"), trans("Iva"),
trans("Protoc."), trans("C")); 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,"@32g%s@83g%s", trans("A RIPORTO"), real2str(dep_dare));
set_header (10,"@100g%s", real2str(dep_avere)); 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,"@32g%s@100g%s", trans("A RIPORTO"), real2str(dep_dare));
set_header (10,"@117g%s", real2str(dep_avere)); set_header (10,"@117g%s", real2str(dep_avere));
@ -2955,16 +3047,18 @@ void TMastrini_application::crea_intestazione()
_riporto_parziale_dare = ZERO; _riporto_parziale_dare = ZERO;
_riporto_parziale_avere = ZERO; _riporto_parziale_avere = ZERO;
} }
if (_numcarat == 1) if (_numcarat == 1)
{ {
sep =""; sep ="";
set_header(11,"@1g%s",(const char*) sep); set_header(11,"@0g%s",(const char*) sep);
} }
else if (_numcarat == 2) else
{ {
sep1 =""; sep1 ="";
set_header(11,"@1g%s",(const char*) sep1); set_header(11,"@0g%s",(const char*) sep1);
} }
if (_pagina != np && _nummast == 3) if (_pagina != np && _nummast == 3)
_pagina = np; _pagina = np;
} }
@ -3052,7 +3146,7 @@ int TMastrini_application::crea_intestazione(int start_riga)
if (_numcarat == 1) if (_numcarat == 1)
{ {
sep.fill('_'); //Stampa 132 - (sep(132)) 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", set_row (r++,"%s@19g%s@117g%s@131g%s",
trans("Operazione"), trans("Documento"), trans("Contro"), trans("A")); trans("Operazione"), trans("Documento"), trans("Contro"), trans("A"));
if (_stampa_mov_prov) if (_stampa_mov_prov)
@ -3064,22 +3158,22 @@ int TMastrini_application::crea_intestazione(int start_riga)
if (_stampa_mov_prov) if (_stampa_mov_prov)
set_header(r-1,"@130gP"); set_header(r-1,"@130gP");
sep.fill('_'); sep.fill('_');
set_row (r++,"@1g%s", (const char*)sep); set_row (r++,"@0g%s", (const char*)sep);
} }
else else
{ {
sep1.fill('_'); //Stampa 198 - (sep1(198)) sep1.fill('_'); //Stampa 198 - (sep1(198))
set_row (r++,"@0g%s", (const char*)sep1); set_row (r++,"@0g%s", (const char*)sep1);
if (_stampa_des_contro) if (_stampa_des_contro)
set_row (r++,"Operazione@23gData@34gNumero@183gReg@190gNumero@197gA"); set_row (r++,"Operazione@23gDocumento@183gReg@190gNumero@197gA");
else else
set_row (r++,"Operazione@23gData@34gNumero@169gContro@183gReg@190gNumero@197gA"); set_row (r++,"Operazione@23gDocumento@169gContro@183gReg@190gNumero@197gA");
if (_stampa_mov_prov) if (_stampa_mov_prov)
set_row(r-1,"@195gM"); set_row(r-1,"@195gM");
set_row (r,"Data"); set_row (r,"Data");
if (_stampanum < 3) if (_stampanum < 3)
set_row (r,"@11gnumero"); 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) if (_stampa_des_contro)
set_row (r++,"@135gContropartita@183gIva@189gProtoc.@197gC"); set_row (r++,"@135gContropartita@183gIva@189gProtoc.@197gC");
else else
@ -3137,12 +3231,12 @@ void TMastrini_application::stampa_progre_riporto()
if (_numcarat == 1) if (_numcarat == 1)
{ {
sep =""; sep ="";
set_row(_rw,"@1g%s",(const char*)sep); set_row(_rw,"@0g%s",(const char*)sep);
} }
else else
{ {
sep1 =""; 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) if (_numcarat == 1)
{ {
sep =""; sep ="";
set_row(r++,"@1g%s",(const char*) sep); set_row(r++,"@0g%s",(const char*) sep);
} }
else else
{ {
sep1 =""; sep1 ="";
set_row(r++,"@1g%s",(const char*) sep1); set_row(r++,"@0g%s",(const char*) sep1);
} }
return r; return r;
} }
@ -3213,8 +3307,11 @@ void TMastrini_application::calcola_progressivi_al(const TDate& data_fin)
TString filter; TString filter;
if (_cdc.not_empty()) if (_cdc.not_empty())
{
filter << RMV_CODCMS << "==\"" << _cdc << "\""; filter << RMV_CODCMS << "==\"" << _cdc << "\"";
if (_fsc.not_empty())
filter << "&&(" << RMV_FASCMS << "==\"" << _fsc << "\")";
}
rmov.zero(); rmov.zero();
rmov.put(RMV_GRUPPO, _gruppo); rmov.put(RMV_GRUPPO, _gruppo);
rmov.put(RMV_CONTO, _conto); rmov.put(RMV_CONTO, _conto);
@ -3891,8 +3988,16 @@ int TMastrini_application::ricerca_gruppo(int start)
if (_cdc.not_empty()) if (_cdc.not_empty())
{ {
const char* descr = cache().get("CMS", _cdc, "S0"); const TString& desc_cdc = cache().get("CMS", _cdc, "S0");
set_row(++r, "@bCommessa %s - %s", (const char*)_cdc, descr); 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 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_CONTO, sottoc_handler_fine);
msk->set_handler(F_SOTTOCFINE_CLIENTE, 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_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 // 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(); TString_array& rows = sht.rows_array();
TToken_string& row = rows.row(0); TToken_string& row = rows.row(0);
row.restart();
short id = F_ANNO; 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! // Scarta i listbox perche' azzerano i conti!
if (id != F_TIPOCF_INI && id != F_TIPOCF_FINE) if (id != F_TIPOCF_INI && id != F_TIPOCF_FINE)
{ _msk->set(id, val);
const char* val = row.get(); id++;
_msk->fld(pos).set(val);
}
} }
rows.destroy(0, TRUE); rows.destroy(0, TRUE);
@ -4090,7 +4194,7 @@ bool TMastrini_application::user_create()
_msk->set_handler(F_MEMORIZZA, memorizza_handler); _msk->set_handler(F_MEMORIZZA, memorizza_handler);
if (!has_module(CMAUT)) 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); TSheet_field& sht = (TSheet_field&)_msk->field(F_SCELTE);
sht.set_notify(scelte_notify); sht.set_notify(scelte_notify);
@ -4135,4 +4239,3 @@ int cg3200(int argc, char* argv[])
a.run(argc, argv, "Stampa Mastrini"); a.run(argc, argv, "Stampa Mastrini");
return 0; return 0;
} }

View File

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

View File

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

View File

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

View File

@ -62,6 +62,7 @@ void TEsercizi_contabili::check()
{ {
if (_firm != prefix().get_codditta()) if (_firm != prefix().get_codditta())
update(); update();
CHECK(_esercizi.items() > 0, "Non esistono esercizi contabili!");
} }
int TEsercizi_contabili::date2index(const TDate& d) const int TEsercizi_contabili::date2index(const TDate& d) const
@ -118,13 +119,23 @@ int TEsercizi_contabili::last() const
return items() ? esc(items()-1).codice() : 0; return items() ? esc(items()-1).codice() : 0;
} }
// Certified 99%
int TEsercizi_contabili::last_mag() const int TEsercizi_contabili::last_mag() const
{ {
/* Vecchio modo error-prone che non funziona nel primo anno di attività
int es=last()-1; int es=last()-1;
while (es>0 && !esercizio(es).chiusura_mag()) while (es>0 && !esercizio(es).chiusura_mag())
es--; es--;
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_06 = "Agenti", "pr0 -4", ""
Item_07 = "Cambi giornalieri", "ba3 -0 cam", "" Item_07 = "Cambi giornalieri", "ba3 -0 cam", ""
Item_08 = "Esercizi", "cg0 -5 esc", "F" 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", "" Item_10 = "Fasi commesse", "ba3 -0 fsc", ""
[PRASSICG_008] [PRASSICG_008]

View File

@ -151,16 +151,39 @@ void TValorizzazione_mask::elabora()
_risultati.destroy(); _risultati.destroy();
TString line, num; TString line, num;
const int sorc = get_int(F_TIPO);
const int dest = get_int(F_VALORIZZA);
// 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 // 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"; line = "@bCodice distinta Descrizione Attuale Precedente";
bf.add_line(line); bf.add_line(line);
TString80 descr; TString80 descr;
cur.freeze(TRUE); cur.freeze(TRUE);
const int sorc = get_int(F_TIPO);
const int dest = get_int(F_VALORIZZA);
for (cur = 0; cur.pos() < items; ++cur) for (cur = 0; cur.pos() < items; ++cur)
{ {
pi.addstatus(1); 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(); TViswin& w = b.vis_win();
TTextfile& f = w.text(); TTextfile& f = w.text();
const long rows = f.lines(); const long rows = f.lines();
if (rows > 1) if (rows > 2)
{ {
TPrinter& p = printer(); TPrinter& p = printer();
TPrintrow row; TPrintrow row;
TString line = f.line_formatted(0); // Legge la prima riga dal line TString line = f.line_formatted(0); // Legge la prima riga dal line
row.put(line); row.put(line);
p.setheaderline(0, row); // La imposta come testata 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(); const TPrtype old_prtype = p.printtype();
p.set_printtype(winprinter); // Forza la stampa su carta p.set_printtype(winprinter); // Forza la stampa su carta
p.open(); p.open();
for (long l = 1; l < rows; l++) for (long l = 2; l < rows; l++)
{ {
line = f.line_formatted(l); line = f.line_formatted(l);
row.reset(); row.reset();

View File

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

View File

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

View File

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

View File

@ -88,13 +88,21 @@ void TRow_property::set(int col, COLOR back, COLOR fore)
void TRow_property::get(int col, COLOR & back, COLOR & fore) const void TRow_property::get(int col, COLOR & back, COLOR & fore) const
{ {
if (col > 0 && _cell_prop) if (col > 0)
{
if (!_cell_prop)
{
back = _back;
fore = _fore;
}
else
{ {
const TCell_property* cp = (const TCell_property*)_cell_prop->objptr(col); const TCell_property* cp = (const TCell_property*)_cell_prop->objptr(col);
if (cp != NULL) if (cp != NULL)
cp->get(back, fore); cp->get(back, fore);
} }
} }
}
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// TSpreadsheet // TSpreadsheet
@ -1074,6 +1082,9 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
} }
else else
{ {
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, get_back_and_fore_color(xiev->v.cell_request.back_color,
xiev->v.cell_request.color, rec, col); xiev->v.cell_request.color, rec, col);
} }
@ -1170,7 +1181,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
if (oldrec != _cur_rec) if (oldrec != _cur_rec)
{ {
_row_dirty = _cell_dirty = FALSE; _row_dirty = _cell_dirty = FALSE;
str2mask(_cur_rec);
on_idle(); // Forces update delayed by str2mask on_idle(); // Forces update delayed by str2mask
_cur_rec = record; // Forces correct record (may be changed by on_idle!) _cur_rec = record; // Forces correct record (may be changed by on_idle!)
notify(_cur_rec, K_TAB); notify(_cur_rec, K_TAB);
@ -1192,6 +1203,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
mask2str(_cur_rec); mask2str(_cur_rec);
on_idle(); on_idle();
} }
} }
else else
@ -1202,16 +1214,28 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
{ {
TMask_field& button = sm.fld(button_pos); TMask_field& button = sm.fld(button_pos);
if (button.active()) if (button.active())
{
if (!_row_dirty)
{ {
notify_change(); 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(); button.on_hit();
if (sm.dirty()) if (sm.dirty())
{
_row_dirty = TRUE;
mask2str(_cur_rec); mask2str(_cur_rec);
} }
} }
owner().highlight(); owner().highlight();
} }
}
_check_enabled = TRUE; _check_enabled = TRUE;
} }
break; break;
case XIE_DBL_CELL: case XIE_DBL_CELL:
@ -1357,6 +1381,11 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
xi_eh(_obj->itf->v.itf->xvt_win, &e); xi_eh(_obj->itf->v.itf->xvt_win, &e);
#endif #endif
} }
XI_OBJ row;
XI_MAKE_ROW(&row, _obj, _cur_row);
xi_cell_request(&row); // Update internal values
} }
break; break;
case XIE_OFF_CELL: case XIE_OFF_CELL:
@ -1367,6 +1396,16 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
refused = !off_cell_handler(cell); refused = !off_cell_handler(cell);
_check_enabled = TRUE; _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; break;
case XIE_COL_MOVE: case XIE_COL_MOVE:
if (xiev->v.column.in_fixed || if (xiev->v.column.in_fixed ||
@ -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 void TSheet_field::set_column_width( const int col, const int width ) const
{ {
TSpreadsheet* s = (TSpreadsheet*)_ctl; TSpreadsheet* s = (TSpreadsheet*)_ctl;

View File

@ -444,7 +444,7 @@ public:
{ _force_progind = b; } { _force_progind = b; }
// @cmember Permette di forzare (<p b>=TRUE) o non forzare (<p b>=FALSE) la rilettura delle // @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 // 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 // anche se si usano codici %. Chiaramente la stampa viene un po' rallentata
void force_setpage(bool b = TRUE) void force_setpage(bool b = TRUE)
@ -474,6 +474,9 @@ public:
void repeat_print() void repeat_print()
{ _repeat_print = TRUE; } { _repeat_print = TRUE; }
bool need_to_repeat_print()
{ return _repeat_print; }
// @cmember Ritorna se la stampa e' stata interrotta // @cmember Ritorna se la stampa e' stata interrotta
bool is_cancelled() const bool is_cancelled() const
{ return _cancelled; } { return _cancelled; }

View File

@ -801,6 +801,8 @@ class TTree_window : public TField_window
long _first_line; // Prima riga disegnata long _first_line; // Prima riga disegnata
TNode_info_array _node_info; TNode_info_array _node_info;
TNode_info _curr_info; // Nodo attualmente selezionato TNode_info _curr_info; // Nodo attualmente selezionato
TAuto_token_string _header;
int _headlines;
static int _row_height; static int _row_height;
static bool _tree_locked; static bool _tree_locked;
@ -814,6 +816,7 @@ protected: // TWindow
protected: // Internal use protected: // Internal use
static bool callback_draw_node(TTree& node, void* jolly, word); static bool callback_draw_node(TTree& node, void* jolly, word);
void update_header();
void draw_plus_minus(); void draw_plus_minus();
int info2index(const TNode_info& ni) const; int info2index(const TNode_info& ni) const;
@ -825,6 +828,7 @@ public:
void hide_leaves(bool yes) { _hide_leaves = yes; } void hide_leaves(bool yes) { _hide_leaves = yes; }
bool select_current(); bool select_current();
bool goto_selected(); bool goto_selected();
void set_header(const char* head);
TTree_window(int x, int y, int dx, int dy, TTree_window(int x, int y, int dx, int dy,
WINDOW parent, TTree_field* owner); WINDOW parent, TTree_field* owner);
@ -843,6 +847,7 @@ struct TUpdate_info
long _x, _y; long _x, _y;
long _firsty, _lasty; long _firsty, _lasty;
long _jolly; long _jolly;
int _headlines;
TNode_info_array* _node_info; TNode_info_array* _node_info;
TNode_info* _curr_info; TNode_info* _curr_info;
}; };
@ -850,6 +855,9 @@ struct TUpdate_info
PNT TTree_window::log2dev(long x, long y) const PNT TTree_window::log2dev(long x, long y) const
{ {
if (_headlines > 0)
y += _headlines;
if (autoscrolling()) if (autoscrolling())
{ {
if (_pixmap) if (_pixmap)
@ -875,8 +883,13 @@ PNT TTree_window::log2dev(long x, long y) const
return pnt; 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); TPoint pnt(_pixmap ? p.h : p.h/CHARX, _pixmap ? p.v : p.v/_row_height);
return pnt; 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); xvt_dwin_draw_set_pos(win, q);
q.h -= TABX*CHARX - 3*CHARX/2; q.h -= TABX*CHARX - 3*CHARX/2;
xvt_dwin_draw_line(win, q); 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); xvt_dwin_draw_line(win, q);
TImage* bmp = node.image(is_selected); 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() void TTree_window::update()
{ {
TField_window::update(); TField_window::update();
@ -1039,6 +1072,8 @@ void TTree_window::update()
if (_tree == NULL) if (_tree == NULL)
return; return;
update_header();
TUpdate_info ui; TUpdate_info ui;
ui._win = this; ui._win = this;
ui._x = 0; ui._x = 0;
@ -1046,6 +1081,7 @@ void TTree_window::update()
ui._firsty = origin().y; ui._firsty = origin().y;
ui._lasty = ui._firsty + rows(); ui._lasty = ui._firsty + rows();
ui._jolly = 0; ui._jolly = 0;
ui._headlines = _headlines;
ui._node_info = &_node_info; ui._node_info = &_node_info;
ui._curr_info = &_curr_info; ui._curr_info = &_curr_info;
@ -1266,9 +1302,9 @@ void TTree_window::handler(WINDOW win, EVENT* ep)
if (_tree && !_tree_locked) if (_tree && !_tree_locked)
{ {
_tree_locked = TRUE; _tree_locked = TRUE;
const int c = ep->v.mouse.where.h / CHARX; const TPoint lp = dev2log(ep->v.mouse.where);
const int r = ep->v.mouse.where.v / _row_height; const int c = (int)lp.x;
dev2log(ep->v.mouse.where); const int r = (int)lp.y;
TNode_info ni; TNode_info ni;
bool ok = index2info(r, ni); bool ok = index2info(r, ni);
@ -1356,6 +1392,11 @@ bool TTree_field::goto_selected()
return tree_win().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) 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); 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)<< "\")&&" ; cfilter << "(CODMAG[1,3]>=" <<'"' << _mask->get(F_DAMAG)<< "\")&&" ;
if (_mask->get(F_AMAG).not_empty()) if (_mask->get(F_AMAG).not_empty())
cfilter << "(CODMAG[1,3]<=" <<'"' << _mask->get(F_AMAG)<< "\")&&" ; 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)<< "\")&&" ; cfilter << "(" << LF_MOVMAG <<"->ANNOES==" <<'"' << _mask->get(F_ANNOES)<< "\")&&" ;
// filtering from/to DATA // filtering from/to DATA
if (*_mask->get(F_ADATA)) 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)<< "\")&&" ; filter << "(" << LF_RMOVMAG << "->CODMAG[1,3]>=" <<'"' << _mask->get(F_DAMAG)<< "\")&&" ;
if (*_mask->get(F_AMAG)) if (*_mask->get(F_AMAG))
filter << "(" << LF_RMOVMAG << "->CODMAG[1,3]<=" <<'"' << _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 // filtering from/to DATA
if (_mask->get(F_DADATA).not_empty()) if (_mask->get(F_DADATA).not_empty())
{ {

View File

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

View File

@ -145,6 +145,33 @@ BEGIN
WARNING "Il secondo estremo deve essere superiore al primo" WARNING "Il secondo estremo deve essere superiore al primo"
END 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 STRING F_DACATMER 3
BEGIN BEGIN

View File

@ -107,6 +107,16 @@ void TStampa_listamov::setprint_x_mov()
if (anno.not_empty()) if (anno.not_empty())
filter << '(' << LF_MOVMAG << "->ANNOES==\""<< anno << "\")"; 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()) if (_mask->get(F_CAU1).not_empty())
{ {
_filtrocausali.cut(0); _filtrocausali.cut(0);
@ -192,6 +202,17 @@ void TStampa_listamov::setprint_x_art()
if (anno.not_empty()) if (anno.not_empty())
filter << '(' << LF_MOVMAG << "->ANNOES==\""<< _mask->get(F_ANNOES) << "\")"; 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()) if (_mask->get(F_DAARTICOLO).not_empty())
filter << "&&(CODART>=\"" << _mask->get(F_DAARTICOLO) << "\")"; filter << "&&(CODART>=\"" << _mask->get(F_DAARTICOLO) << "\")";
if (_mask->get(F_AARTICOLO).not_empty()) if (_mask->get(F_AARTICOLO).not_empty())

View File

@ -13,3 +13,8 @@
#define F_DAARTICOLO 113 #define F_DAARTICOLO 113
#define F_AARTICOLO 114 #define F_AARTICOLO 114
#define F_INVERTI 120 #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" #include "mg4100.h"
PAGE "Stampa lista movimenti" -1 -1 78 18 PAGE "Stampa lista movimenti" -1 -1 80 20
NUMBER F_ANNOES 4 NUMBER F_ANNOES 4
BEGIN BEGIN
@ -96,9 +96,45 @@ BEGIN
OUTPUT F_AARTICOLO CODART OUTPUT F_AARTICOLO CODART
END 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 STRING F_CAU1 5
BEGIN BEGIN
PROMPT 2 9 "Causale " PROMPT 2 11 "Causale "
FLAGS "U" FLAGS "U"
USE %CAU USE %CAU
INPUT CODTAB F_CAU1 INPUT CODTAB F_CAU1
@ -113,7 +149,7 @@ END
STRING F_CAU2 5 STRING F_CAU2 5
BEGIN BEGIN
FLAGS "U" FLAGS "U"
PROMPT 2 10 "Causale " PROMPT 2 12 "Causale "
COPY USE F_CAU1 COPY USE F_CAU1
INPUT CODTAB F_CAU2 INPUT CODTAB F_CAU2
COPY DISPLAY F_CAU1 COPY DISPLAY F_CAU1
@ -126,7 +162,7 @@ END
STRING F_CAU3 5 STRING F_CAU3 5
BEGIN BEGIN
FLAGS "U" FLAGS "U"
PROMPT 2 11 "Causale " PROMPT 2 13 "Causale "
COPY USE F_CAU1 COPY USE F_CAU1
INPUT CODTAB F_CAU3 INPUT CODTAB F_CAU3
COPY DISPLAY F_CAU1 COPY DISPLAY F_CAU1
@ -139,7 +175,7 @@ END
STRING F_CAU4 5 STRING F_CAU4 5
BEGIN BEGIN
FLAGS "U" FLAGS "U"
PROMPT 2 12 "Causale " PROMPT 2 14 "Causale "
COPY USE F_CAU1 COPY USE F_CAU1
INPUT CODTAB F_CAU4 INPUT CODTAB F_CAU4
COPY DISPLAY F_CAU1 COPY DISPLAY F_CAU1
@ -152,7 +188,7 @@ END
STRING F_CAU5 5 STRING F_CAU5 5
BEGIN BEGIN
FLAGS "U" FLAGS "U"
PROMPT 2 13 "Causale " PROMPT 2 15 "Causale "
COPY USE F_CAU1 COPY USE F_CAU1
INPUT CODTAB F_CAU5 INPUT CODTAB F_CAU5
COPY DISPLAY F_CAU1 COPY DISPLAY F_CAU1
@ -165,7 +201,7 @@ END
STRING F_CAU6 5 STRING F_CAU6 5
BEGIN BEGIN
FLAGS "U" FLAGS "U"
PROMPT 2 14 "Causale " PROMPT 2 16 "Causale "
COPY USE F_CAU1 COPY USE F_CAU1
INPUT CODTAB F_CAU6 INPUT CODTAB F_CAU6
COPY DISPLAY F_CAU1 COPY DISPLAY F_CAU1

View File

@ -776,7 +776,7 @@ TLavorazione& TLav_finder::art2lav(const TCodice_articolo& art)
TArray boom; TArray boom;
tree.set_root(art); tree.set_root(art);
tree.explode(boom, FALSE, RAGGR_EXP_UMBASE, 1, "L"); tree.explode(boom, FALSE, RAGGR_EXP_UMBASE, 1, "L");
TString16 codlav; TString80 codlav;
if (boom.items() > 0) if (boom.items() > 0)
codlav = ((TRiga_esplosione&)boom[0]).articolo(); codlav = ((TRiga_esplosione&)boom[0]).articolo();
lav = new TLavorazione(codlav); 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) 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()) switch (o.dlg())
{ {
case F_DADATA: case F_DADATA:
@ -2936,7 +2936,7 @@ bool TMatResPlanning::emit_orders()
if (datadoc < today && newdoc) if (datadoc < today && newdoc)
if (ignore_docdate_too_soon != K_ENTER && ignore_docdate_too_soon != K_ESC) 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(); ignore_docdate_too_soon = b.run();
} }
if (ignore_docdate_too_soon == K_NO || ignore_docdate_too_soon == K_ESC) 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 (datacon < datadoc && newdoc)
if (ignore_duedate_lt_docdate != K_ENTER && ignore_duedate_lt_docdate != K_ESC) 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(); ignore_duedate_lt_docdate = b.run();
} }
if (ignore_duedate_lt_docdate == K_NO || ignore_duedate_lt_docdate == K_ESC) 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 "" PROMPT 6 1 ""
PICTURE "##@,@#" PICTURE "##@,@#"
MESSAGE _NUMEXPR,#104/#103*100 MESSAGE _NUMEXPR,#104/#103*100
END END
VALUTA 106 15 VALUTA 106 15
BEGIN BEGIN
@ -421,8 +422,9 @@ SECTION CLIENTI 2 0 0 FILE LF_PROVV GROUP CODAGE
BEGIN BEGIN
KEY "perc provv" KEY "perc provv"
PROMPT 6 1 "" PROMPT 6 1 ""
PICTURE "##@,@#" PICTURE "##@,@@"
MESSAGE _NUMEXPR,#104/#103*100 MESSAGE _NUMEXPR,IF(#103==0,0,#104*100/#103)
END END
VALUTA 106 15 VALUTA 106 15
BEGIN BEGIN
@ -488,8 +490,8 @@ SECTION CLIENTI 2 0 0 FILE LF_PROVV GROUP CODAGE
BEGIN BEGIN
KEY "PERCENTUALE" KEY "PERCENTUALE"
prompt 6 1 "" prompt 6 1 ""
PICTURE "##@,@#" PICTURE "##@,@@"
MESSAGE _NUMEXPR,#204/#203*100 MESSAGE _NUMEXPR,IF(#203==0,0,#204*100/#203)
END END
VALUTA 206 15 VALUTA 206 15
BEGIN BEGIN
@ -564,8 +566,9 @@ SECTION CLIENTI 2 0 0 FILE LF_PROVV GROUP CODAGE
BEGIN BEGIN
KEY "IMPORTO" KEY "IMPORTO"
PROMPT 6 1 "" PROMPT 6 1 ""
PICTURE "##@,@#" PICTURE "##@,@@"
MESSAGE _NUMEXPR,#304/#303*100 MESSAGE _NUMEXPR,IF(#303==0,0,#304*100/#303)
END END
VALUTA 306 15 VALUTA 306 15
BEGIN BEGIN
@ -627,8 +630,9 @@ END // end clienti
BEGIN BEGIN
KEY "IMPORTO" KEY "IMPORTO"
PROMPT 6 2 "" PROMPT 6 2 ""
PICTURE "##@,@#" PICTURE "##@,@@"
MESSAGE _NUMEXPR,#404/#403*100 MESSAGE _NUMEXPR,IF(#403==0,0,#404*100/#403)
GROUP G_TOTAGE GROUP G_TOTAGE
END END
VALUTA 406 15 VALUTA 406 15

View File

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

View File

@ -689,20 +689,6 @@ BEGIN
FIELD I1 FIELD I1
END 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 ENDPAGE
ENDMASK ENDMASK

View File

@ -2,4 +2,14 @@
#define QAPPNAME "eurocampo" #define QAPPNAME "eurocampo"
#define QFIRMNAME "A.G.A. Informatica Srl" #define QFIRMNAME "A.G.A. Informatica Srl"
#include <default.url> #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 <defmask.h>
#include <tabutil.h> #include <tabutil.h>
#include <utility.h> #include <utility.h>
#include <urldefid.h>
#include "ve0100.h" #include "ve0100.h"
#include "veini.h" #include "veini.h"
@ -224,10 +225,36 @@ int TMotore_application::read( TMask& m )
_tipodoc = m.get(F_TIPODOC); _tipodoc = m.get(F_TIPODOC);
((TDocumento_mask &)m).doc2mask(); ((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; 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 int TMotore_application::write( const TMask& m ) // C 90
{ {
TDocumento& d = (TDocumento&) _rel->curr(); TDocumento& d = (TDocumento&) _rel->curr();
@ -267,7 +294,9 @@ bool TMotore_application::user_create( )
_rel->lfile().set_curr(new TDocumento); _rel->lfile().set_curr(new TDocumento);
_msk = new TMask("ve0100a"); _msk = new TMask("ve0100a");
_sel_color = new TSelect_color_mask("ve0100a", "0");
set_search_field(F_NDOC); 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_CODNUM, TDocumento_mask::num_handler );
_msk->set_handler( F_TIPODOC, TDocumento_mask::tip_handler ); _msk->set_handler( F_TIPODOC, TDocumento_mask::tip_handler );
@ -293,6 +322,9 @@ bool TMotore_application::user_destroy( )
if ( _msk != NULL ) if ( _msk != NULL )
delete _msk; delete _msk;
if ( _sel_color != NULL )
delete _sel_color;
// Distruggo la relazione // Distruggo la relazione
delete _rel; delete _rel;
// delete _condv; // delete _condv;
@ -427,7 +459,7 @@ void TMotore_application::ini2mask(TConfig& ini, TMask& msk, bool query)
// l'autoload ?? // l'autoload ??
f.insert(-1, FALSE); f.insert(-1, FALSE);
// Aggiunge la riga allo sheet // Aggiunge la riga allo sheet
rec.autoload(f); ((TDocumento_mask &) msk).autoload(f.items());
f.check_row(f.items()-1, 0x2); f.check_row(f.items()-1, 0x2);
} }
} }

View File

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

View File

@ -177,7 +177,7 @@ BEGIN
OUTPUT F_DATADOC_ELAB DATADOC OUTPUT F_DATADOC_ELAB DATADOC
OUTPUT F_CODNUM_ELAB CODNUM OUTPUT F_CODNUM_ELAB CODNUM
OUTPUT F_NDOC_ELAB NDOC OUTPUT F_NDOC_ELAB NDOC
CHECKTYPE NORMAL CHECKTYPE SEARCH
WARNING "Documento inesistente o incompatibile" WARNING "Documento inesistente o incompatibile"
ADD RUN ve0 -1 ADD RUN ve0 -1
MESSAGE EMPTY SHOW,F_DATADOC_ELAB 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 // Genera un campo a partire da una linea del file VE0300A.DAT
void genera_campo( TToken_string _line ); 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 // Genera la colonna dello sheet a partire da una linea del file VE0300B.DAT
void genera_item_sheet( TToken_string _line ); 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 ) void TMask_generator::genera_item_sheet( TToken_string _line )
{ {
_m->_out << "IT \"" << _line.get( B_DESCR ); _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")); TRectype cp = cache().get("%CPG", doc.get("CODPAG"));
TString16 codpag(cp.get("I9")); TString16 codpag(cp.get("I9"));
if (codpag.empty()) // if (codpag.empty())
codpag = doc.get("CODPAG"); // codpag = doc.get("CODPAG");
codpag = codpag.sleft(3).lpad(3); codpag = codpag.sleft(3).lpad(3, '0');
row << codpag; row << codpag;
work = doc.get("CODABIA").sleft(5).rpad(5); work = doc.get("CODABIA").sleft(5).rpad(5);
work << doc.get("CODCABA").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_10 = "Divise", "ba3 -0 %VAL", ""
Item_11 = "Cambi giornalieri", "ba3 -0 CAM", "F" Item_11 = "Cambi giornalieri", "ba3 -0 CAM", "F"
Item_12 = "Esercizi", "cg0 -5 esc", "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" Item_14 = "Fasi commesse", "ba3 -0 fsc", "F"
[ACQVEN_006] [ACQVEN_006]

View File

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

View File

@ -381,7 +381,11 @@ bool TRiga_documento::raggruppabile(const TRiga_documento& r, TToken_string& cam
TRiga_documento& TRiga_documento::operator +=(const TRiga_documento& r) 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()) for (const char* c = campi.get(0); c; c = campi.get())
{ {
real num = r.get_real(c); real num = r.get_real(c);
@ -393,9 +397,7 @@ TRiga_documento& TRiga_documento::operator +=(const TRiga_documento& r)
} }
if (!get_bool("RIGAEVASA")) if (!get_bool("RIGAEVASA"))
{ {
const real qta = get_real("QTA"); if (qtaresidua().is_zero())
const real qtaeva = get_real("QTAEVASA");
if (qtaeva >= qta)
put("RIGAEVASA", "X"); put("RIGAEVASA", "X");
} }
@ -478,9 +480,6 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
case 'Q': case 'Q':
c = _qtaprezzo; c = _qtaprezzo;
break; break;
case 'V':
c = _valore;
break;
case 'P': case 'P':
{ {
const TString16 field_perc(s.field_perc()); 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); r1 = doc().get_real(field_perc);
} }
break; break;
case 'V':
default: default:
c = _valore;
break; break;
} }
} }
@ -628,10 +629,12 @@ real TRiga_documento::provvigione(int ndec) const
real TRiga_documento::qtaresidua() const real TRiga_documento::qtaresidua() const
{ {
real val; real val;
if (!get_bool(RDOC_RIGAEVASA)) 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) if (val < ZERO)
val = ZERO; val = ZERO;
} }

View File

@ -444,485 +444,6 @@ public:
HIDDEN TAgenti_cache _agenti; 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 // Documento per vendite
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -1001,13 +522,12 @@ TDocumento::~TDocumento()
if (_esenzione != NULL) delete _esenzione; 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;} { ((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;} { ((TDocumento *)this)->test_firm(); return _codiva_bolli;}
void TDocumento::check_modules() void TDocumento::check_modules()
{ {
if (_has_mag == 3) if (_has_mag == 3)
@ -2664,7 +2184,7 @@ TPagamento& TDocumento::pagamento()
if (data_in.empty()) if (data_in.empty())
data_in = get_date(DOC_DATADOC); data_in = get_date(DOC_DATADOC);
TString16 codpag(get(DOC_CODPAG)); const TString8 codpag(get(DOC_CODPAG));
if (codpag != _pag.code()) if (codpag != _pag.code())
{ {
_pag.set_code(codpag); _pag.set_code(codpag);
@ -2682,28 +2202,26 @@ TPagamento& TDocumento::pagamento()
real TDocumento::provvigione(int ndec) const real TDocumento::provvigione(int ndec) const
{ {
real val; TString16 field = agente().campoprovv();
if (ndec == AUTO_DECIMALS)
ndec = decimals();
TString16 field(agente().campoprovv());
if (field.empty()) if (field.empty())
field = tipo().totprovv(); field = tipo().totprovv();
real val;
if (field.not_empty()) if (field.not_empty())
return get_real(field); val = get_real(field);
else else
{
if (ndec == AUTO_DECIMALS)
ndec = decimals();
for (int i = rows(); i > 0; i--) for (int i = rows(); i > 0; i--)
val += ((TRiga_documento &) ((TDocumento *)this)->row(i)).provvigione(ndec); val += ((TRiga_documento &) ((TDocumento *)this)->row(i)).provvigione(ndec);
}
return val; return val;
} }
real TDocumento::valore(bool totale, int ndec) const real TDocumento::valore(bool totale, int ndec) const
{ {
real val; real val;
for (int i=rows(); i>0; i--) for (int i=rows(); i>0; i--)
{ {
TRiga_documento &r = ((TRiga_documento &) ((TDocumento *)this)->row(i)); TRiga_documento &r = ((TRiga_documento &) ((TDocumento *)this)->row(i));

View File

@ -57,12 +57,11 @@ const TString & TTipo_documento::riferimento(const TDocumento & doc) const
{ {
static TString __rif; static TString __rif;
__rif = get("S1"); __rif = get("S1");
int p = __rif.find('['); int p = __rif.find('{');
while (p >= 0) while (p >= 0)
{ {
const int last = __rif.find(']'); const int last = __rif.find('}');
const TString16 field_name(__rif.sub(p + 1, last)); const TString16 field_name(__rif.sub(p + 1, last));
const TFieldref field(field_name, LF_DOC); const TFieldref field(field_name, LF_DOC);
if (last < 0) if (last < 0)
@ -86,7 +85,7 @@ const TString & TTipo_documento::riferimento(const TDocumento & doc) const
__rif.insert(field.read(rec), p); __rif.insert(field.read(rec), p);
} }
p = __rif.find('['); p = __rif.find('{');
} }
return __rif; return __rif;
} }
@ -296,8 +295,14 @@ void TTipo_documento::read_formule()
_formule_documento.add(campo, new TFormula_documento(_documento, campo, "TOTPROVV()"), TRUE); _formule_documento.add(campo, new TFormula_documento(_documento, campo, "TOTPROVV()"), TRUE);
} }
_totale_cont = prof.get("TOTALECONT", "MAIN"); _totale_cont = prof.get("TOTALECONT", "MAIN");
_cnt_prezzi = prof.get_bool("CONTROLLO_PREZZI", "MAIN"); _cnt_prezzi = prof.get_bool("CONTROLLO_PREZZI");
_field_prezzo = prof.get("PREZZO", "MAIN"); _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 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; delete _elab; _elab = NULL;
read(); read();
} }
TLista_elaborazioni::~TLista_elaborazioni() TLista_elaborazioni::~TLista_elaborazioni()

View File

@ -1356,8 +1356,6 @@ error_type TContabilizzazione::search_costo_ricavo(TBill& conto, const TRiga_doc
return _error; 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) 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); 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 // Aggiunge le spese d'incasso
tot_netto = doc.totale_netto(); tot_netto = doc.totale_netto();
sp_incasso = doc.spese_incasso(tot_netto,ndec,_netto); sp_incasso = doc.spese_incasso(tot_netto,ndec,_netto);
TString16 codiva_es;
doc.iva_esente(codiva_es);
if (sp_incasso != 0.0) 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 // Aggiunge le spese bolli
tot_netto += sp_incasso + iva_sp_incasso; tot_netto += sp_incasso + iva_sp_incasso;
sp_bolli = doc.bolli(tot_netto,ndec, _netto); sp_bolli = doc.bolli(tot_netto,ndec, _netto);
if (sp_bolli != 0) 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; return _error;
} }

View File

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

View File

@ -1,12 +1,12 @@
#include <applicat.h> #include <applicat.h>
#include <automask.h> #include <automask.h>
#include <defmask.h>
#include <dongle.h> #include <dongle.h>
#include <modaut.h> #include <modaut.h>
#include <sheet.h> #include <sheet.h>
#include <tabutil.h> #include <tabutil.h>
#include <tree.h> #include <tree.h>
#include <postman.h> #include <postman.h>
#include <urldefid.h>
#include "velib.h" #include "velib.h"
#include "vepriv.h" #include "vepriv.h"
@ -246,14 +246,12 @@ void TDocumento_mask::configura_sheet(TSheet_field& sheet)
if (descr.not_empty() ) if (descr.not_empty() )
sheet.set_column_header( field_id, descr); 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) if (size != 0)
sheet.set_column_width( field_id, size); sheet.set_column_width( field_id, size);
if (field_id != FR_LORDO || tdoc.calcolo_lordo()) if (field_id != FR_LORDO || tdoc.calcolo_lordo())
colonne.add(field_id); colonne.add(field_id);
if (size != 0)
colonne << ',' << size;
} }
if (tdoc.calcolo_lordo()) if (tdoc.calcolo_lordo())
@ -682,7 +680,6 @@ void TDocumento_mask::doc2mask(bool reload_clifo)
TSheet_field& s = sfield(F_SHEET); TSheet_field& s = sfield(F_SHEET);
s.destroy( ); s.destroy( );
const int righe = doc().physical_rows(); const int righe = doc().physical_rows();
for (int i = 0; i < righe; i++) 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(); TMask & sm = ss.sheet_mask();
set_curr_um(sm); set_curr_um(sm);
m.update_giacenza(); 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; return TRUE;
@ -1099,6 +1097,23 @@ bool TDocumento_mask::clifo_handler( TMask_field& f, KEY key )
return TRUE; 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 // TDocument_tree
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -1114,6 +1129,9 @@ protected:
bool on_head() const; bool on_head() const;
bool on_row() 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: public:
virtual bool goto_root(); virtual bool goto_root();
virtual bool goto_firstson(); virtual bool goto_firstson();
@ -1127,6 +1145,7 @@ public:
virtual bool goto_lbrother(); virtual bool goto_lbrother();
virtual TObject* curr_node() const { return &(TToken_string&)_curnode; } virtual TObject* curr_node() const { return &(TToken_string&)_curnode; }
virtual bool get_description(TString& str) const; virtual bool get_description(TString& str) const;
virtual TImage* image(bool selected) const;
const TRectype& testata() const; const TRectype& testata() const;
const TRectype& riga() const; const TRectype& riga() const;
@ -1143,7 +1162,7 @@ const TRectype& TDocument_tree::testata() const
{ {
TDocument_tree& me = (TDocument_tree&)*this; TDocument_tree& me = (TDocument_tree&)*this;
const TRecnotype pos = me._curnode.get_long(0); const TRecnotype pos = me._curnode.get_long(0);
if (_cursor->pos() != pos) if (_cursor->pos() != pos || _relation->curr(LF_RIGHEDOC).empty())
*me._cursor = pos; *me._cursor = pos;
return _relation->curr(); return _relation->curr();
} }
@ -1185,7 +1204,7 @@ bool TDocument_tree::on_row() const
bool TDocument_tree::goto_root() bool TDocument_tree::goto_root()
{ {
bool ok = _cursor != NULL && _cursor->items()>0; const bool ok = _cursor != NULL && _cursor->items()>0;
_curnode = ok ? "0" : ""; _curnode = ok ? "0" : "";
return ok; return ok;
} }
@ -1301,15 +1320,64 @@ bool TDocument_tree::goto_lbrother()
return ok; 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 bool TDocument_tree::get_description(TString& str) const
{ {
TDocument_tree& me = (TDocument_tree&)*this;
if (on_head()) if (on_head())
{ {
const TRectype& rec = testata(); const TRectype& rec = testata();
TString16 tmp;
str = rec.get(DOC_ANNO); str = rec.get(DOC_ANNO);
str << ' ' << rec.get(DOC_CODNUM); str << ' ' << rec.get(DOC_CODNUM);
TString16 tmp;
tmp.format("%6ld", rec.get_long(DOC_NDOC)); tmp.format("%6ld", rec.get_long(DOC_NDOC));
str << ' ' << tmp << ' ' << rec.get(DOC_DATADOC); str << ' ' << tmp << ' ' << rec.get(DOC_DATADOC);
const char tipocf = rec.get_char(DOC_TIPOCF); const char tipocf = rec.get_char(DOC_TIPOCF);
@ -1318,18 +1386,35 @@ bool TDocument_tree::get_description(TString& str) const
str << tmp; str << tmp;
tmp.format("%c|%6ld", tipocf, codcf); tmp.format("%c|%6ld", tipocf, codcf);
str << cache().get(LF_CLIFO, tmp, CLI_RAGSOC); 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 else
{ {
const TRectype& rec = riga(); const TRectype& rec = riga();
str.format("%4d: ", rec.get_int(RDOC_NRIGA)); const TRectype& testata = _relation->curr();
const TString80 codart = rec.get(RDOC_CODART); 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()) if (codart.not_empty())
{ {
str << rec.get_real(RDOC_QTA).string("#.###.##@,@@@@@"); const TTipo_documento& tipo = TDocumento::tipo(testata.get(DOC_TIPODOC));
str << ' ' << codart << ' '; 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; return TRUE;
} }
@ -1394,7 +1479,7 @@ protected:
void add_valuta_filter(TString& filter) const; void add_valuta_filter(TString& filter) const;
void docrif_search(); void docrif_search();
void update_list(); int update_list();
void update_ndoc_filter(bool is_tipo_elaborazione = FALSE); void update_ndoc_filter(bool is_tipo_elaborazione = FALSE);
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); 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: case F_TYPE:
if (e == fe_init || e == fe_modify) 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); update_ndoc_filter(TRUE);
o.mask().field(F_NDOC_ELAB).check_type(o.get() == "" ? CHECK_SEARCH : CHECK_REQUIRED);
} }
break; break;
case F_STATODOC_ELAB: 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) if (e == fe_button)
docrif_search(); docrif_search();
break; 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: case F_ROWS:
if (e == fe_modify && is_running()) 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(); const TRectype& head = _tree.testata();
set(F_DATADOC_ELAB, head.get(DOC_DATADOC)); // Anch'essa nella chiave 2! 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)); 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; return TRUE;
} }
void TElabora_mask::update_list() int TElabora_mask::update_list()
{ {
TString_array elabs; TString_array elabs;
const TString16 tipo(_main->get(F_TIPODOC)); const TString16 tipo(_main->get(F_TIPODOC));
@ -1506,6 +1611,8 @@ void TElabora_mask::update_list()
reset(-GRP_ART); reset(-GRP_ART);
hide(-GRP_ART); hide(-GRP_ART);
} }
return items;
} }
bool TElabora_mask::elabora() bool TElabora_mask::elabora()
@ -1516,7 +1623,7 @@ bool TElabora_mask::elabora()
TLista_documenti out; TLista_documenti out;
TDocumento& app_doc = ((TDocumento_mask *)_main)->doc(); TDocumento& app_doc = ((TDocumento_mask *)_main)->doc();
long numdoc = get_long(F_NDOC_ELAB); 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* newdoc = new TDocumento(*get(F_PROVV_ELAB), get_int(F_ANNO_ELAB), get(F_CODNUM_ELAB), numdoc);
TDocumento& d = *newdoc; TDocumento& d = *newdoc;
@ -1628,6 +1735,9 @@ bool TElabora_mask::elabora()
delete newdoc; delete newdoc;
if (update_mask)
update_ndoc_filter();
return update_mask; return update_mask;
} }
@ -1657,15 +1767,11 @@ bool TElabora_mask::article_filter(const TRelation* rel)
const bool evasa= rdoc.get_bool(RDOC_RIGAEVASA); const bool evasa= rdoc.get_bool(RDOC_RIGAEVASA);
const TString& codart = rdoc.get(RDOC_CODART); const TString& codart = rdoc.get(RDOC_CODART);
if (!evasa && codart == m._art_filter) if (!evasa && codart == m._art_filter)
{
const real residuo = rdoc.get_real(RDOC_QTA)-rdoc.get_real(RDOC_QTAEVASA);
if (residuo > ZERO)
{ {
yes = TRUE; yes = TRUE;
break; break;
} }
} }
}
return yes; return yes;
} }
@ -1828,13 +1934,31 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
cursor->set_filterfunction(NULL); cursor->set_filterfunction(NULL);
TTree_field& tf = tfield(F_ROWS); TTree_field& tf = tfield(F_ROWS);
if (tipo.not_empty()) if (tipo.not_empty() && e != NULL)
{ {
tf.set_tree(&_tree); 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) 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); _tree.set_cursor(get(F_TIPOCF_ELAB)[0], get_long(F_CODCF_ELAB), get_int(F_ANNO_ELAB), filter, article_filter);
else else
_tree.set_cursor(get(F_TIPOCF_ELAB)[0], get_long(F_CODCF_ELAB), get_int(F_ANNO_ELAB), filter); _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 else
tf.set_tree(NULL); tf.set_tree(NULL);