Patch level : 12.00 1328

Files correlati     : ve1.exe ve1300.alx

Commento:

Aggiunto messaggio cli_ind alla stampa documenti
This commit is contained in:
Alessandro Bonazzi 2024-08-21 00:49:36 +02:00
parent f4058ac029
commit ecca05524b
4 changed files with 237 additions and 102 deletions

View File

@ -20,6 +20,7 @@
#include <comuni.h>
#include <nditte.h>
#include <indsp.h>
#define LISTADOC "listadoc"
#define FAKETOTFLD 9999
@ -801,7 +802,7 @@ bool TDocumento_form::validate(TForm_item &cf, TToken_string &s)
}
} // fine _DITTA
if (code== "_CLIENTE")
if ((code== "_CLIENTE") || (code == "_CLI_IND"))
{
// lettura dei dati del cliente
// sintassi: _CLIENTE,{<campo relazione>|<macro>}
@ -823,6 +824,9 @@ bool TDocumento_form::validate(TForm_item &cf, TToken_string &s)
TCli_for & cli_for = _doc->clifor();
TOccasionale & cli_occ = _doc->occas();
const bool occasionale = cli_for.is_occasionale();
const TRectype & indsped = cli_for.indsped(_doc->get_int(DOC_CODINDSP));
const bool is_sped = (code == "_CLI_IND") && indsped.full();
TString in(s.get()); // prende la macro o il fieldref
if (in[0] != '!')
{
@ -838,41 +842,90 @@ bool TDocumento_form::validate(TForm_item &cf, TToken_string &s)
}
in.ltrim(1);
if (in=="INDNUM")
{
if (is_sped)
{
valore = indsped.get(IND_INDIR); // come usare indir2 IND_INDIR2
valore << " " << indsped.get(IND_CIV);
}
else
{
valore = occasionale ? cli_occ.get(OCC_INDIR) : cli_for.get(CLI_INDCF);
valore << " ";
valore << (occasionale ? cli_occ.get(OCC_CIV) : cli_for.get(CLI_CIVCF));
}
cf.set(valore);
return true;
}
if (in.find("COM") == 0)
{
if (in.len() == 3)
{
if (is_sped)
valore = indsped.get(IND_COM);
else
valore = occasionale ? cli_occ.get(OCC_COM) : cli_for.get(CLI_COMCF);
cf.set(valore);
}
else
{
const bool nascita = in[3] == 'N';
const int p = in.find("->");
if (p > 0)
in.ltrim(p + 2);
TLocalisamfile com(LF_COMUNI);
if (nascita)
{
com.put(COM_STATO, occasionale ? cli_occ.get(OCC_STATONASC) : cli_for.get(CLI_STATONASC));
com.put(COM_COM, occasionale ? cli_occ.get(OCC_COMNASC) : cli_for.get(CLI_COMNASC));
}
else
{
if (is_sped)
{
com.put(COM_STATO, indsped.get(IND_STATO));
com.put(COM_COM, indsped.get(IND_COM));
}
else
{
com.put(COM_STATO, occasionale ? cli_occ.get(OCC_STATO) : cli_for.get(CLI_STATOCF));
com.put(COM_COM, occasionale ? cli_occ.get(OCC_COM) : cli_for.get(CLI_COMCF));
}
}
if (com.read() == NOERR)
cf.set(com.get(in));
}
return true;
}
if (in.find("LOCALITACF") == 0)
{
if (is_sped)
valore = indsped.get(IND_LOCALITA);
else
valore = occasionale ? cli_occ.get(OCC_LOCALITA) : cli_for.get(CLI_LOCCF);
cf.set(valore);
return true;
}
if (in.find("CAP") == 0)
{
if (is_sped)
valore = indsped.get(IND_CAP);
else
valore = occasionale ? cli_occ.get(OCC_CAP) : cli_for.get(CLI_CAPCF);
cf.set(valore);
return true;
}
if (in.find("TEL") == 0)
{
if (is_sped)
{
valore = indsped.get(IND_PTEL);
valore << "/" << indsped.get(IND_TEL);
}
else
{
if (!occasionale)
{
@ -883,21 +936,33 @@ bool TDocumento_form::validate(TForm_item &cf, TToken_string &s)
valore = cli_for.get(in);
valore << "/" << num;
}
}
cf.set(valore);
return true;
}
if (in=="FAX")
{
if (is_sped)
{
valore = indsped.get(IND_PFAX);
valore << "/" << indsped.get(IND_FAX);
}
else
{
if (!occasionale)
{
valore = cli_for.get("PFAX");
valore << "/" << cli_for.get("FAX");
}
}
cf.set(valore);
return true;
}
if (in=="RAGSOC")
{
if (is_sped)
valore = indsped.get(IND_RAGSOC);
else
valore = occasionale ? cli_occ.get(in) : cli_for.get(in);
valore.strip_double_spaces();
cf.set(valore);

View File

@ -21,6 +21,9 @@
DOC_CLIENTE \ user defined word in ve1.exe
;
: MESSAGE_CLI_IND ( s1 -- )
DOC_CLI_IND \ user defined word in ve1.exe
;
: MESSAGE_DITTA ( s1 -- )
GET_FIRM_DATA \ user defined word in report
;

View File

@ -470,13 +470,15 @@ TRiga_documento& TReport_doc::riga_doc(int n)
return rs->riga_doc(n);
}
bool TReport_doc::msg_cliente(TVariant_stack& stack)
bool TReport_doc::msg_cliente(TVariant_stack& stack, bool is_indsped)
{
TReport_field& cf = *curr_field();
const TCli_for& cli_for = doc().clifor();
TCli_for& cli_for = doc().clifor();
const TOccasionale& cli_occ = doc().occas();
const bool occasionale = cli_for.is_occasionale();
const TRectype & indsped = cli_for.indsped(doc().get_int(DOC_CODINDSP));
const bool is_sped = is_indsped && indsped.full();
TString in = stack.pop().as_string(); // prende la macro o il fieldref
TString valore;
@ -495,42 +497,90 @@ bool TReport_doc::msg_cliente(TVariant_stack& stack)
}
in.ltrim(1);
if (in=="INDNUM")
{
if (is_sped)
{
valore = indsped.get(IND_INDIR); // come usare indir2 IND_INDIR2
valore << " " << indsped.get(IND_CIV);
}
else
{
valore = occasionale ? cli_occ.get(OCC_INDIR) : cli_for.get(CLI_INDCF);
valore << ' ';
valore << (occasionale ? cli_occ.get(OCC_CIV) : cli_for.get(CLI_CIVCF));
}
cf.set(valore);
return true;
}
if (in.find("COM") == 0)
{
if (in.len() == 3)
{
if (is_sped)
valore = indsped.get(IND_COM);
else
valore = occasionale ? cli_occ.get(OCC_COM) : cli_for.get(CLI_COMCF);
cf.set(valore);
}
else
{
const bool nascita = in[3] == 'N';
const int p = in.find("->");
if (p > 0)
in.ltrim(p + 2);
TString8 key;
if (nascita)
{
key = occasionale ? cli_occ.get(OCC_STATONASC) : cli_for.get(CLI_STATONASC);
key << '|' << (occasionale ? cli_occ.get(OCC_COMNASC) : cli_for.get(CLI_COMNASC));
}
else
{
if (is_sped)
{
key = indsped.get(IND_STATO);
key << '|' << indsped.get(IND_COM);
}
else
{
key = occasionale ? cli_occ.get(OCC_STATO) : cli_for.get(CLI_STATOCF);
key << '|' << (occasionale ? cli_occ.get(OCC_COM) : cli_for.get(CLI_COMCF));
}
}
valore = cache().get(LF_COMUNI, key, in);
}
cf.set(valore);
return true;
}
if (in.find("LOCALITACF") == 0)
{
if (is_sped)
valore = indsped.get(IND_LOCALITA);
else
valore = occasionale ? cli_occ.get(OCC_LOCALITA) : cli_for.get(CLI_LOCCF);
cf.set(valore);
return true;
}
if (in.find("CAP") == 0)
{
if (is_sped)
valore = indsped.get(IND_CAP);
else
valore = occasionale ? cli_occ.get(OCC_CAP) : cli_for.get(CLI_CAPCF);
cf.set(valore);
return true;
}
if (in.find("TEL") == 0)
{
if (is_sped)
{
valore = indsped.get(IND_PTEL);
valore << "/" << indsped.get(IND_TEL);
}
else
{
if (!occasionale)
{
@ -541,21 +591,33 @@ bool TReport_doc::msg_cliente(TVariant_stack& stack)
valore = cli_for.get(in);
valore << "/" << num;
}
}
cf.set(valore);
return true;
}
if (in=="FAX")
{
if (is_sped)
{
valore = indsped.get(IND_PFAX);
valore << "/" << indsped.get(IND_FAX);
}
else
{
if (!occasionale)
{
valore = cli_for.get("PFAX");
valore << "/" << cli_for.get("FAX");
}
}
cf.set(valore);
return true;
}
if (in=="RAGSOC")
{
if (is_sped)
valore = indsped.get(IND_RAGSOC);
else
valore = occasionale ? cli_occ.get(in) : cli_for.get(in);
valore.strip_double_spaces();
cf.set(valore);
@ -909,19 +971,23 @@ size_t TReport_doc::get_usr_words(TString_array& words) const
const char* const name[] =
{
"DOC_CLIENTE",
"DOC_PARENT_DOC", "DOC_PARENT_ROW",
"DOC_RIEPILOGO_IVA",
"DOC_SCADENZE",
"DOC_TOT_IMPONIBILI",
"DOC_LV_DOT",
"DOC_ADD_ROW",
NULL
"DOC_CLIENTE", // 0
"DOC_PARENT_DOC", // 1
"DOC_PARENT_ROW", // 2
"DOC_RIEPILOGO_IVA", // 3
"DOC_SCADENZE", // 4
"DOC_TOT_IMPONIBILI", // 5
"DOC_LV_DOT", // 6
"DOC_ADD_ROW", // 7
"DOC_CLI_IND", // 8
nullptr
};
((TReport_doc*)this)->_first_msg = words.items(); // Calcola il primo numero disponibile
size_t i;
for (i = 0; name[i] != NULL; i++)
for (i = 0; name[i] != nullptr; i++)
words.add(name[i]);
return words.items();
@ -943,6 +1009,7 @@ bool TReport_doc::execute_usr_word(unsigned int opcode, TVariant_stack& stack)
case 5: msg_tot_imponibili(stack); break;
case 6: msg_lv_dot(stack); break;
case 7: msg_add_row(stack); break;
case 8: msg_cliente(stack, true); break;
default: ok = false; break;
}
stack.reset(); // Svuota eventuali parametri variabili inutilizzati
@ -1292,7 +1359,7 @@ void TReport_doc_app::add_filter(TString& query, bool from) const
bool TReport_doc_app::create()
{
if (!has_module(RSAUT))
return error_box(FR("Modulo non autorizzato: %s"), dongle().module_code2desc(RSAUT));
return error_box(FR("Modulo non autorizzato: %s"), (const char *) dongle().module_code2desc(RSAUT));
_msk = new TReport_doc_mask;
return TSkeleton_application::create();

View File

@ -705,7 +705,7 @@ bool TDocument_report::msg_riepilogo_iva(TVariant_stack& stack)
const TRectype& rec = ((TISAM_recordset*)recordset())->cursor()->relation()->file(idx).curr();
TDocumento & doc = (TDocumento &)((TDocument_recordset*)recordset())->doc(rec);
TAssoc_array & IVA = doc.tabella_iva(); // serve per aggiornare la tebella
TAssoc_array & i = doc.tabella_iva(); // serve per aggiornare la tebella
TRiepilogo_iva * r = (TRiepilogo_iva *) doc.riepilogo_iva(index);
TString value;
if (r != NULL)