Patch level :10.0 734

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
0001620: 002463 - Presscolor - aggiornamento tabella note clienti e fornitori
Descrizione  non è più possibile aggiornare o inserire descrizioni per una nota cliente.


git-svn-id: svn://10.65.10.50/trunk@20436 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2010-05-11 08:46:30 +00:00
parent cb2df3ec36
commit 5ee2eddc81
4 changed files with 117 additions and 91 deletions

View File

@ -7,7 +7,6 @@
#include "../cg/cgtbcam.h"
#include "../cg/cgtbdel.h"
#include "../cg/cgtbnot.h"
#include "../cg/cgtbreg.h"
#include "../cg/cgtbver.h"
@ -29,7 +28,6 @@
#define TAB_VALUTE "%VAL"
#define TAB_VERSAMENTI "%VER"
#define TAB_NOMENCOMB "%NOC"
#define TAB_NOTECLI "%NOT"
#define TAB_PREST "PRS"
#define TAB_SPESE "SPP"
@ -63,12 +61,8 @@ protected:
static bool codcab_handler(TMask_field& f, KEY k);
static bool codmag_handler(TMask_field& f, KEY k);
static bool codnoc_handler(TMask_field& f, KEY k);
static bool desnot_handler(TMask_field& f, KEY k);
static bool numivd_handler(TMask_field& f, KEY k);
void fragment_string();
void glue_string();
public:
bool exist_journal() { return _exist_journal; }
bool exist_dich_int() { return _exist_dich_int; }
@ -603,17 +597,7 @@ bool TGeneric_table_app::codnoc_handler(TMask_field& f, KEY k)
return true;
}
bool TGeneric_table_app::desnot_handler(TMask_field& f, KEY k)
{
if (k == K_ENTER)
{
const TString& stringone = f.get();
if (stringone.len() > 320)
return f.error_box("La nota non puo' superare i 320 caratteri");
}
return true;
}
bool TGeneric_table_app::numivd_handler(TMask_field& f, KEY k)
{
if (f.to_check(k))
@ -673,9 +657,6 @@ bool TGeneric_table_app::user_create()
if (name == TAB_NOMENCOMB)
mask.set_handler(NOC_CODICE2, codnoc_handler);
if (name == TAB_NOTECLI)
mask.set_handler(F_NOT_DESC, desnot_handler);
if (name == TAB_IVDIRETTIVA)
mask.set_handler(F_NUM, numivd_handler);
}
@ -683,40 +664,6 @@ bool TGeneric_table_app::user_create()
return ok;
}
//folle metodo per suddividere una stringa lunga in piu' stringhe corte da mettere nei campi
//stringa delle tabelle (per ora solo tabella %NOT)
void TGeneric_table_app::fragment_string()
{
TMask& mask = *get_mask();
TString stringone = mask.get(F_NOT_DESC);
TRectype& rec = get_relation()->curr();
TString4 fieldname;
int tot_length = 0;
stringone.replace('\n', (char)0xB6);
for (int i = 0; i < 6; i++)
{
fieldname.format("S%d", i);
const int length = rec.length(fieldname);
const TString& pezzo = stringone.mid(tot_length, length);
rec.put(fieldname, pezzo);
tot_length += length;
}
}
void TGeneric_table_app::glue_string()
{
TMask& mask = *get_mask();
TString stringone;
TRectype& rec = get_relation()->curr();
TString4 fieldname;
for (int i = 0; i < 6; i++)
{
fieldname.format("S%d", i);
stringone << rec.get(fieldname);
}
stringone.replace((char)0xB6, '\n');
mask.set(F_NOT_DESC, stringone);
}
bool TGeneric_table_app::user_destroy()
{
@ -727,36 +674,34 @@ int TGeneric_table_app::read(TMask& m)
{
int err = Tab_application::read(m);
const TString & table_name = get_tabname();
if (table_name == TAB_NOTECLI)
glue_string();
if (table_name == TAB_SPESE || table_name == TAB_PREST)
{
if (get_relation()->lfile().get_real("R10") == ZERO)
m.set(F_PREZZO, get_relation()->lfile().get("R0"));
}
else
if (table_name == TAB_SPESE || table_name == TAB_PREST)
if (table_name == TAB_VALUTE)
{
if (get_relation()->lfile().get_real("R10") == ZERO)
m.set(F_PREZZO, get_relation()->lfile().get("R0"));
const int dec = m.get_int(VAL_DECIMALS_CHANGE);
TReal_field& exc = (TReal_field&)m.efield(VAL_CHANGE);
if (dec != exc.decimals())
{
exc.set_decimals(dec);
exc.set(get_relation()->lfile().get("S4"));
}
}
else
if (table_name == TAB_VALUTE)
if (table_name == TAB_CAMBI)
{
const int dec = m.get_int(VAL_DECIMALS_CHANGE);
TReal_field& exc = (TReal_field&)m.efield(VAL_CHANGE);
const int dec = m.get_int(FLD_TABCAM_I2);
TReal_field& exc = (TReal_field&)m.efield(FLD_TABCAM_S4);
if (dec != exc.decimals())
{
exc.set_decimals(dec);
exc.set(get_relation()->lfile().get("S4"));
exc.set(get_relation()->lfile().get("S4"));
}
}
else
if (table_name == TAB_CAMBI)
{
const int dec = m.get_int(FLD_TABCAM_I2);
TReal_field& exc = (TReal_field&)m.efield(FLD_TABCAM_S4);
if (dec != exc.decimals())
{
exc.set_decimals(dec);
exc.set(get_relation()->lfile().get("S4"));
}
}
return err;
@ -766,11 +711,8 @@ int TGeneric_table_app::write(const TMask& m)
{
const TString & table_name = get_tabname();
if (table_name == TAB_NOTECLI)
fragment_string();
else
if (table_name == TAB_SPESE || table_name == TAB_PREST)
get_relation()->lfile().put("R0", m.get(F_PREZZO));
if (table_name == TAB_SPESE || table_name == TAB_PREST)
get_relation()->lfile().put("R0", m.get(F_PREZZO));
return Tab_application::write(m);
}
@ -790,11 +732,8 @@ int TGeneric_table_app::rewrite(const TMask& m)
ini.set("Type", -1);
}
if (table_name == TAB_NOTECLI)
fragment_string();
else
if (table_name == TAB_SPESE || table_name == TAB_PREST)
get_relation()->lfile().put("R0", m.get(F_PREZZO));
if (table_name == TAB_SPESE || table_name == TAB_PREST)
get_relation()->lfile().put("R0", m.get(F_PREZZO));
return Tab_application::rewrite(m);
}

View File

@ -11,7 +11,7 @@ int main(int argc, char** argv)
case 2: cg0300(argc,argv); break; // Progressivi allegati
case 3: cg0400(argc,argv); break; // Progressivi IVA
case 4: cg0500(argc,argv); break; // Causali contabili
case 5: cg0600(argc,argv); break; // Tabelle contabii
case 5: cg0600(argc,argv); break; // Tabelle contabili
default: cg0100(argc,argv); break; // Piano dei conti
}
exit(0);

View File

@ -5,10 +5,14 @@
#include <sheet.h>
#include <tabapp.h>
#include "cgtbesc.h"
#include "cgtbbnp.h"
#include "cgtbesc.h"
#include "cgtbnot.h"
#include "cglib01.h"
#define TAB_NOTECLI "%NOT"
class CGTTable_application : public TTable_application
{
// ------------- specifiche tabella esercizi ----
@ -16,6 +20,9 @@ class CGTTable_application : public TTable_application
static bool checkbut_handler(TMask_field& f, KEY k);
void check_sheet();
bool check_esercizio(TString& cod, TDate s1, TDate f1);
static bool desnot_handler(TMask_field& f, KEY k);
void fragment_string();
void glue_string();
// --------------------------------------------
protected:
@ -28,11 +35,14 @@ protected:
virtual bool user_create();
virtual bool user_destroy();
virtual int read(TMask& m);
virtual int write(const TMask& m);
virtual int rewrite(const TMask& m);
public:
// @cmember Disabilita la verifica del modulo : essendo una anagrafica, va sempre abilitata
virtual bool check_autorization() const
{return FALSE;}
{return false;}
static CGTTable_application& app() { return (CGTTable_application&)main_app(); }
@ -118,6 +128,7 @@ bool CGTTable_application::user_create()
{
get_mask()->set_handler(F_DATAINI, dataini_handler);
get_mask()->set_handler(BUT_CHECK, checkbut_handler);
get_mask()->set_handler(F_NOT_DESC, desnot_handler);
}
}
return ok;
@ -128,6 +139,85 @@ bool CGTTable_application::user_destroy()
return TTable_application::user_destroy();
}
int CGTTable_application::read(TMask& m)
{
int err = Tab_application::read(m);
const TString & table_name = get_tabname();
if (table_name == TAB_NOTECLI)
glue_string();
return err;
}
int CGTTable_application::write(const TMask& m)
{
const TString & table_name = get_tabname();
if (table_name == TAB_NOTECLI)
fragment_string();
return Tab_application::write(m);
}
int CGTTable_application::rewrite(const TMask& m)
{
const TString & table_name = get_tabname();
if (table_name == TAB_NOTECLI)
fragment_string();
return Tab_application::rewrite(m);
}
// - note cliente-specific --------------------------------------------------------
//folle metodo per suddividere una stringa lunga in piu' stringhe corte da mettere nei campi
//stringa delle tabelle (per ora solo tabella %NOT)
void CGTTable_application::fragment_string()
{
TMask& mask = *get_mask();
TString stringone = mask.get(F_NOT_DESC);
TRectype& rec = get_relation()->curr();
TString4 fieldname;
int tot_length = 0;
stringone.replace('\n', (char)0xB6);
for (int i = 0; i < 6; i++)
{
fieldname.format("S%d", i);
const int length = rec.length(fieldname);
const TString& pezzo = stringone.mid(tot_length, length);
rec.put(fieldname, pezzo);
tot_length += length;
}
}
void CGTTable_application::glue_string()
{
TMask& mask = *get_mask();
TString stringone;
TRectype& rec = get_relation()->curr();
TString4 fieldname;
for (int i = 0; i < 6; i++)
{
fieldname.format("S%d", i);
stringone << rec.get(fieldname);
}
stringone.replace((char)0xB6, '\n');
mask.set(F_NOT_DESC, stringone);
}
bool CGTTable_application::desnot_handler(TMask_field& f, KEY k)
{
if (k == K_ENTER)
{
const TString& stringone = f.get();
if (stringone.len() > 320)
return f.error_box("La nota non puo' superare i 320 caratteri");
}
return true;
}
// - esercizi-specific --------------------------------------------------------
@ -229,10 +319,7 @@ void CGTTable_application::check_sheet()
TArray_sheet as(-1,-1,70,20,TR("Esercizi contabili"),
FR("Codice|Inizio@10|Fine@10|Scarico@10|Chiusura@10|Note@20"),
0x10);
TDate s1;
for (int i = 0; i < escarr.items(); i++)

View File

@ -44,7 +44,7 @@ Picture = <ve00>
Module = 0
Flags = ""
Item_01 = "Categorie vendita", "ba3 -0 CVE", "F"
Item_02 = "Note cliente", "ba3 -0 %NOT", ""
Item_02 = "Note cliente", "cg0 -5 %NOT", ""
Item_03 = "Note documento", "ba3 -0 %NDO", ""
Item_04 = "Modalita' di spedizione", "ba3 -0 %MSP", ""
Item_05 = "Modalita' di consegna", "ba3 -0 %POR", ""