Patch level : 2.2 44

Files correlati     :  cg2.exe
Ricompilazione Demo : [ ]
Commento            :

Eliminata gestione commesse dalla prima nota


git-svn-id: svn://10.65.10.50/trunk@12791 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2005-03-08 15:22:12 +00:00
parent 3a841185c5
commit 315d0194fc
9 changed files with 22 additions and 373 deletions

View File

@ -103,18 +103,6 @@ TMask* TPrimanota_application::load_mask(int n)
ism.set_handler(209, sheet_clifo_handler);
ism.set_handler(309, sheet_clifo_handler);
// Controlla gestione commesse ed eventualmente elimina colonne relative
if (has_module(CMAUT, CHK_DONGLE))
ism.set_handler(112, fase_handler);
else
{
for (short id = 111; id <= 114; id++)
{
is.delete_column(id);
ism.hide(id); // Descrizioni commessa e fase
}
}
}
case 1:
if (m)
@ -140,7 +128,7 @@ TMask* TPrimanota_application::load_mask(int n)
cgm.set_handler(CG_DARE, dareavere_handler);
cgm.set_handler(CG_AVERE, dareavere_handler);
cgm.set_handler(CG_TIPO, cg_tipo_handler);
// cgm.set_handler(CG_TIPO, cg_tipo_handler);
cgm.set_handler(CG_GRUPPO, cg_gruppo_handler);
cgm.set_handler(CG_CONTO, cg_conto_handler);
cgm.set_handler(CG_SOTTOCONTO, cg_sottoconto_handler);
@ -151,16 +139,6 @@ TMask* TPrimanota_application::load_mask(int n)
cgm.set_handler(213, sheet_clifo_handler);
cgm.set_handler(313, sheet_clifo_handler);
// Controlla gestione commesse ed eventualmente elimina colonne relative
if (has_module(CMAUT, CHK_DONGLE))
cgm.set_handler(CG_FASE, fase_handler);
else
{
cgm.hide(CG_COMMESSA); cgm.hide(CG_FASE);
cgm.hide(CG_DESC_CDC); cgm.hide(CG_DESC_FASE);
cg.delete_column(CG_DESC_FASE); cg.delete_column(CG_DESC_CDC);
cg.delete_column(CG_FASE); cg.delete_column(CG_COMMESSA);
}
// Se esiste lo sheet delle rate
if (is_fattura())
{
@ -814,13 +792,9 @@ int TPrimanota_application::read(TMask& m)
conto.get(r, TRUE);
riga.add(conto.string(0x3)); // Contropartita 110-114
riga.add(r.get(RMV_CODCMS)); // Commessa 115
riga.add(r.get(RMV_FASCMS)); // Fase 116
riga.add(cache().get("CMS", r.get(RMV_CODCMS), "S0")); // Desrizione Commessa 117
riga.add(cache().get("FSC", r.get(RMV_FASCMS), "S0")); // Desrizione Fase 118
const char tipo = r.get_char(RMV_ROWTYPE);
riga.add(tipo, CG_ROWTYPE-FIRST_FIELD); // Tipo di riga 119
riga.add(tipo, CG_ROWTYPE-FIRST_FIELD); // Tipo di riga 115
disable_cgs_cells(i, tipo);
}
@ -882,10 +856,6 @@ int TPrimanota_application::read(TMask& m)
TBill c; c.get(r);
c.add_to(riga, 4, 0x7); // Conto 105-110
riga.add(r.get(RMI_CODCMS)); // Commessa 111
riga.add(r.get(RMI_FASCMS)); // Fase 112
riga.add(cache().get("CMS", r.get(RMI_CODCMS), "S0")); // Desrizione Commessa 113
riga.add(cache().get("FSC", r.get(RMI_FASCMS), "S0")); // Desrizione Fase 114
}
calcola_imp(); // Calcola totale imponibile ed imposte
@ -973,8 +943,6 @@ void TPrimanota_application::mask2rel(const TMask& m)
r.put(RMV_CONTOC, row.get());
r.put(RMV_SOTTOCONTOC, row.get());
row.get(); // Descrizione contropartita
r.put(RMV_CODCMS, row.get()); // Commessa
r.put(RMV_FASCMS, row.get()); // Fase
r.put(RMV_ROWTYPE, row.get(CG_ROWTYPE-FIRST_FIELD)); // Tipo riga
}
}
@ -1068,8 +1036,8 @@ void TPrimanota_application::mask2rel(const TMask& m)
r.put(RMI_FASCMS, row.get(11));
// Roba obsoleta allo stato brado
const TClinton c(row, TRUE);
const int rimp = clint2pos(c, 'I')+1;
const TBill c(row, TRUE);
const int rimp = bill2pos(c, 'I')+1;
r.put(RMI_RIGAIMP, rimp);
c.put(r);
}
@ -1508,13 +1476,6 @@ HIDDEN void ini2bill(TConfig& ini, TBill& bil, bool contro)
bil.set(gruppo, conto, sottoconto, tipo);
}
HIDDEN void ini2clinton(TConfig& ini, TClinton& bil)
{
ini2bill(ini, bil, FALSE);
bil.set_commessa(ini.get("CODCMS"));
bil.set_fase(ini.get("FASCMS"));
}
HIDDEN bool set_not_empty(TMask& msk, int id, TConfig& ini, const char* var)
{
const TString& val = ini.get(var);
@ -1567,9 +1528,6 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
if (c.gruppo() > 0)
c.add_to(riga, 4, 0x7); // Conto 105-110
add_not_empty(riga, 10, ini, RMI_CODCMS); // Commessa 111
add_not_empty(riga, 11, ini, RMI_FASCMS); // Fase 112
iva_notify(is, i, K_ENTER);
}
calcola_imp(); // Calcola totale imponibile ed imposte
@ -1581,7 +1539,7 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
char tipo = ini.get_char(RMV_ROWTYPE);
if (tipo == '\0') tipo = ' ';
TClinton conto; ini2clinton(ini, conto);
TBill conto; ini2bill(ini, conto, FALSE);
int numrig = ini.get_int(RMV_NUMRIG)-1;
if (numrig != i) // Controllo se ho un numero riga valido
@ -1592,7 +1550,7 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
{
int nr = -1;
if (tipo == 'I' || tipo == ' ')
nr = clint2pos(conto, tipo);
nr = bill2pos(conto, tipo);
else
nr = type2pos(tipo);
@ -1628,10 +1586,8 @@ void TPrimanota_application::ini2mask(TConfig& ini, TMask& msk, bool query)
if (conto.gruppo() > 0)
conto.add_to(riga, 9, 0x3); // Contropartita 110-114
add_not_empty(riga, 14, ini, RMV_CODCMS); // Commessa 115
add_not_empty(riga, 15, ini, RMV_FASCMS); // Fase 116
riga.add(tipo, cg.cid2index(CG_ROWTYPE)); // Tipo di riga 119
riga.add(tipo, cg.cid2index(CG_ROWTYPE)); // Tipo di riga 115
}
if (is_fattura())

View File

@ -74,11 +74,7 @@
#define CG_CONTO 105
#define CG_SOTTOCONTO 106
#define CG_DESCR 109
#define CG_COMMESSA 115
#define CG_FASE 116
#define CG_DESC_CDC 117
#define CG_DESC_FASE 118
#define CG_ROWTYPE 119
#define CG_ROWTYPE 115
// Campi ripetuti sulla seconda pagina

View File

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

View File

@ -650,10 +650,6 @@ BEGIN
ITEM "Co."
ITEM "Sottoc.@6"
ITEM "Descrizione Conto@30"
ITEM "CDC/Commessa@20"
ITEM "Fase@10"
ITEM "Descrizione CDC/Commessa@30"
ITEM "Descrizione Fase@30"
END
CURRENCY F_IMPONIBILI 18
@ -685,10 +681,6 @@ BEGIN
ITEM "Co./c@3"
ITEM "Sott./c@6"
ITEM "Descrizione contropartita@30"
ITEM "CDC/Commessa@20"
ITEM "Fase@10"
ITEM "Descrizione CDC/Commessa@30"
ITEM "Descrizione Fase@30"
ITEM "Tipo@4"
END

View File

@ -13,26 +13,6 @@
#include <cfven.h>
#include <pconti.h>
int TClinton::compare(const TSortable& obj) const
{
int cmp = TBill::compare(obj);
if (cmp == 0)
{
const TClinton& bill = (const TClinton&)obj;
cmp = _cms.compare(bill.commessa());
if (cmp == 0)
cmp = _fas.compare(bill.fase());
}
return cmp;
}
TClinton::TClinton(TToken_string& row, bool iva)
: TBill(row, iva ? 6 : 3, 0x0)
{
set_commessa(row.get((iva ? 111 : CG_COMMESSA) - FIRST_FIELD));
set_fase(row.get((iva ? 112 : CG_FASE) - FIRST_FIELD));
}
///////////////////////////////////////////////////////////
// Funzioni di decodifica/calcolo
///////////////////////////////////////////////////////////
@ -197,23 +177,6 @@ int TPrimanota_application::bill2pos(const TBill& conto, char tipo)
return -1;
}
int TPrimanota_application::clint2pos(const TClinton& conto, char tipo)
{
TSheet_field& cg = app().cgs();
FOR_EACH_SHEET_ROW(cg, i, s)
{
const char t = row_type(*s);
if (t == tipo)
{
const TClinton c(*s, FALSE);
if (c == conto)
return i;
}
}
return -1;
}
// Trova nelle righe contabili un conto di contropartita per il conto dato
int TPrimanota_application::bill2contr(const TBill& conto, char sezione) const
{
@ -388,16 +351,6 @@ void TPrimanota_application::disable_cgs_cells(int n, char tipo)
needs_update = TRUE;
}
// 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_DESC_CDC);
cg.disable_cell(n, CG_FASE); // Fase
cg.disable_cell(n, CG_DESC_FASE);
needs_update = TRUE;
}
COLOR back_color, fore_color;
type2colors(tipo, back_color, fore_color);
if (back_color != NORMAL_BACK_COLOR || fore_color != NORMAL_COLOR)
@ -450,48 +403,8 @@ int TPrimanota_application::set_cgs_row(int n, const TImporto& imp,
else
row.add(" | | | | ");
}
if (conto.tipo() <= ' ') // Cerca di impostare la commessa sui conti normali
{
if (cms == NULL || *cms <= ' ')
{
if (row.get_char(CG_COMMESSA-FIRST_FIELD) <= ' ')
{
TString80 codcms, fascms;
if (conto.default_cdc(codcms, fascms))
{
row.add(codcms, CG_COMMESSA-FIRST_FIELD);
row.add(cache().get("CMS", codcms, "S0"), CG_DESC_CDC-FIRST_FIELD);
row.add(fascms, CG_FASE-FIRST_FIELD);
row.add(cache().get("FSC", fascms, "S0"), CG_DESC_FASE-FIRST_FIELD);
}
}
}
else
{
row.add(cms, CG_COMMESSA-FIRST_FIELD);
row.add(cache().get("CMS", cms, "S0"), CG_DESC_CDC-FIRST_FIELD);
row.add(fas, CG_FASE-FIRST_FIELD);
row.add(cache().get("FSC", fas, "S0"), CG_DESC_FASE-FIRST_FIELD);
}
cg.enable_cell(n, CG_COMMESSA); // Commessa
cg.enable_cell(n, CG_DESC_CDC);
cg.enable_cell(n, CG_FASE); // Fase
cg.enable_cell(n, CG_DESC_FASE);
}
else // Azzera commessa sui conti clifo
{
row.add("", CG_COMMESSA-FIRST_FIELD);
row.add("", CG_DESC_CDC-FIRST_FIELD);
row.add("", CG_FASE-FIRST_FIELD);
row.add("", CG_DESC_FASE-FIRST_FIELD);
cg.disable_cell(n, CG_COMMESSA); // Commessa
cg.disable_cell(n, CG_DESC_CDC);
cg.disable_cell(n, CG_FASE); // Fase
cg.disable_cell(n, CG_DESC_FASE);
}
row.add(tipo, CG_ROWTYPE-FIRST_FIELD);
row.add(tipo, CG_ROWTYPE-FIRST_FIELD);
disable_cgs_cells(n, tipo);
@ -789,19 +702,6 @@ bool TPrimanota_application::cg_handler(TMask_field& f, KEY k)
}
}
}
if (c.tipo() <= ' ')
{
// Se la commessa è vuota: controlliamo se era obbligatoria
const int col = CG_COMMESSA-FIRST_FIELD;
const TString80 cms = r.get(col);
if (cms.blank() && cg.cell_enabled(i, col) && c.required_cdc())
{
TToken_string k = c.string(); k.replace('|', ' ');
return f.error_box(FR("Il codice commessa è obbligatorio per il conto %s della riga %d"),
(const char*)k, i+1);
}
}
}
}
@ -1290,19 +1190,6 @@ bool TPrimanota_application::dareavere_handler(TMask_field& f, KEY k)
return TRUE;
}
// La fase puo' esistere solo con la commessa
bool TPrimanota_application::fase_handler(TMask_field& f, KEY k)
{
bool ok = TRUE;
if (f.to_check(k) && !f.empty())
{
const TEdit_field& cms_fld = f.mask().efield(f.dlg()-1);
if (cms_fld.empty())
ok = f.error_box(TR("E' necessario specificare anche la commessa"));
}
return ok;
}
TSheet_field& TPrimanota_application::pags() const
{
CHECK(is_fattura(), "Can't use rate sheet without a fattura");
@ -1591,14 +1478,14 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
}
}
TClinton oldconto(row, TRUE);
TBill oldconto(row, TRUE);
if (oldconto.ok())
{
oldpos = clint2pos(oldconto, 'I');
oldpos = bill2pos(oldconto, 'I');
if (oldpos < 0)
{
const TString d(cau.desc_agg(2));
oldpos = a.set_cgs_row(-1, a.real2imp(ZERO, 'I'), oldconto, d, 'I', oldconto.commessa(), oldconto.fase());
oldpos = a.set_cgs_row(-1, a.real2imp(ZERO, 'I'), oldconto, d, 'I');
}
}
else
@ -1642,8 +1529,8 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
imposta = i.scorpora(imponibile); // ... scorpora imposta dall'imponibile
}
TClinton conto(row, TRUE);
int newpos = clint2pos(conto, 'I'); // Riga in cui andra' l'imponibile
TBill conto(row, TRUE);
int newpos = bill2pos(conto, 'I'); // Riga in cui andra' l'imponibile
const bool detrarre = detraibile(row); // Determina se IVA detraibile
@ -1676,7 +1563,7 @@ bool TPrimanota_application::iva_notify(TSheet_field& iva, int r, KEY k)
{ // crea una nuova riga contabile
if (saved_descr.blank())
saved_descr = cau.desc_agg(2);
newpos = a.set_cgs_row(-1, newimp, conto, saved_descr, 'I', conto.commessa(), conto.fase());
newpos = a.set_cgs_row(-1, newimp, conto, saved_descr, 'I');
}
}
else
@ -1811,6 +1698,7 @@ bool TPrimanota_application::iva_handler(TMask_field& f, KEY k)
return TRUE;
}
/* qui
bool TPrimanota_application::cg_tipo_handler(TMask_field& f, KEY key)
{
if (key == K_TAB && f.focusdirty() || key == K_ENTER)
@ -1827,6 +1715,7 @@ bool TPrimanota_application::cg_tipo_handler(TMask_field& f, KEY key)
}
return TRUE;
}
*/
// Il gruppo non possiede una ricerca propria per cui se viene variato richiama
// quella del conto.
@ -1846,22 +1735,6 @@ bool TPrimanota_application::cg_conto_handler(TMask_field& f, KEY key)
{
bool ok = TRUE;
if (key == K_TAB)
{
TMask& m = f.mask();
if (m.field(CG_SOTTOCONTO).active()) // Controlla se sottoconto acceso
{
const char cf = m.get(CG_TIPO)[0]; // Tipo conto
const bool enc = cf <= ' '; // Commessa ammessa per conti normali
if (!enc)
{
m.reset(CG_COMMESSA);
m.reset(CG_FASE);
}
m.enable(CG_COMMESSA, enc);
m.enable(CG_FASE, enc);
}
}
if (key == K_ENTER)
{
TMask& m = f.mask();
@ -1926,13 +1799,6 @@ bool TPrimanota_application::iva_sottoconto_handler(TMask_field& f, KEY key)
}
}
if (key == K_ENTER && cdc.empty() && zio.required_cdc())
{
TToken_string k = zio.string(); k.replace(k.separator(), ' ');
return cdc.error_box(FR("Il conto %s richiede che sia specificato il codice CDC/Commessa"),
(const char*)k);
}
}
}
@ -1944,30 +1810,6 @@ bool TPrimanota_application::cg_sottoconto_handler(TMask_field& f, KEY k)
if (!suspended_handler(f, k))
return FALSE;
if (!f.empty() && (k == K_ENTER || (k == K_TAB && f.dirty())))
{
TMask& m = f.mask();
TEdit_field& cdc = m.efield(CG_COMMESSA);
if (cdc.active() && cdc.empty())
{
TBill zio; zio.get(m, CG_GRUPPO, CG_CONTO, CG_SOTTOCONTO);
TToken_string key = zio.string();
const TRectype& pc = cache().get(LF_PCON, key);
if (k == K_TAB)
{
m.set(CG_COMMESSA, pc.get(PCN_CODCMS), 0x2);
m.set(CG_FASE, pc.get(PCN_FASCMS), 0x2);
}
if (k == K_ENTER && cdc.empty() && pc.get_bool(PCN_CMSNEEDED))
{
key.replace(key.separator(), ' ');
return cdc.error_box(FR("Il conto %s richiede che sia specificato il codice CDC/Commessa"),
(const char*)key);
}
}
}
return TRUE;
}
@ -2719,15 +2561,6 @@ bool TPrimanota_application::main_codiva_handler(TMask_field& f, KEY key)
TBill bill; // Aggiorna conto della prima riga IVA
a.IVA2bill(iva, bill);
bill.add_to(row, 4, 0x7);
if (bill.tipo() <= ' ' && bill.sottoconto() > 0)
{
TString80 cms, fas;
if (bill.default_cdc(cms, fas))
{
row.add(cms, 10); // Cdc/commessa su riga IVA
row.add(fas, 11); // Fase
}
}
}
a.ivas().force_update(0);

View File

@ -27,23 +27,6 @@
class TDati_incasso;
class TClinton : public TBill
{
TString _cms, _fas;
public:
virtual int compare(const TSortable& obj) const;
public:
void set_commessa(const char* cms) { _cms = cms; _cms.rtrim(); }
void set_fase(const char* fas) { _fas = fas; _fas.rtrim(); }
const TString& commessa() const { return _cms; }
const TString& fase() const { return _fas; }
TClinton() { }
TClinton(TToken_string& row, bool iva = FALSE);
};
class TPrimanota_application : public TRelation_application
{
TMovimentoPN* _rel; // Relazione principale
@ -222,7 +205,6 @@ protected:
static real scorpora(real& imponibile, const real& percentuale);
static bool detraibile(TToken_string& row);
static int bill2pos(const TBill& conto, char tipo);
static int clint2pos(const TClinton& conto, char tipo);
TipoIVA cau2IVA(const char* causale, int anno);
bool IVA2bill(const TCodiceIVA& iva, TBill& bill);

View File

@ -1,4 +1,4 @@
PAGE "RIGA PRIMA NOTA" -1 -1 67 18
PAGE "RIGA PRIMA NOTA" -1 -1 67 14
GROUPBOX DLG_NULL 66 3
BEGIN
@ -313,62 +313,9 @@ BEGIN
WARNING "Fornitore inesistente sulla riga contabile"
END
GROUPBOX 155 66 4
BEGIN
PROMPT 1 12 "@bCentro di costo / Commessa"
END
STRING CG_COMMESSA 20
BEGIN
PROMPT 2 13 "Codice "
FLAGS "UZ"
USE CMS
INPUT CODTAB CG_COMMESSA
DISPLAY "Codice@20" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT CG_COMMESSA CODTAB
OUTPUT CG_DESC_CDC S0
CHECKTYPE NORMAL
END
STRING CG_DESC_CDC 50 30
BEGIN
PROMPT 32 13 ""
USE CMS KEY 2
INPUT S0 CG_DESC_CDC
DISPLAY "Descrizione@50" S0
DISPLAY "Codice@20" CODTAB
COPY OUTPUT CG_COMMESSA
CHECKTYPE NORMAL
END
STRING CG_FASE 10
BEGIN
PROMPT 2 14 "Fase "
FLAGS "UZ"
USE FSC
INPUT CODTAB CG_FASE
DISPLAY "Codice@10" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT CG_FASE CODTAB
OUTPUT CG_DESC_FASE S0
CHECKTYPE NORMAL
END
STRING CG_DESC_FASE 50 30
BEGIN
PROMPT 32 14 ""
USE FSC KEY 2
INPUT S0 CG_DESC_FASE
DISPLAY "Descrizione@50" S0
DISPLAY "Codice@20" CODTAB
COPY OUTPUT CG_FASE
CHECKTYPE NORMAL
END
LIST CG_ROWTYPE 24
BEGIN
PROMPT 28 16 "Tipo riga "
PROMPT 28 12 "Tipo riga "
ITEM " |Sola contabilità"
ITEM "A|Abbuoni attivi"
ITEM "C|Differenza cambi"

View File

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

View File

@ -372,7 +372,7 @@ END
CURRENCY FM_REGIVA(16) 18
BEGIN
PROMPT 14 36 "Imposte "
PROMPT 51 14 "Imposte "
FLAGS "D"
END