Corretta gestione stato in ristampa definitiva documenti
git-svn-id: svn://10.65.10.50/branches/R_10_00@23175 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
6bd580c2b5
commit
150972f6e5
@ -92,7 +92,7 @@ void TMotore_application::init_query_mode( TMask& m )
|
||||
cn.set_focusdirty(TRUE);
|
||||
cn.on_key(K_TAB);
|
||||
cn.set_dirty(FALSE);
|
||||
_msk->set(F_TIPODOC, _tipodoc, TRUE);
|
||||
_msk->set(F_TIPODOC, _tipodoc, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -653,11 +653,23 @@ bool TMotore_application::ndoc_handler(TMask_field& f, KEY k)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TMotore_application::tdoc_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_TAB && !f.empty() && f.focusdirty())
|
||||
{
|
||||
const TTipo_documento& td = cached_tipodoc(f.get());
|
||||
const char cf[2] = { td.tipocf(), '\0' };
|
||||
f.mask().set(F_TIPOCF, cf);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool TMotore_application::user_create( )
|
||||
{
|
||||
open_files(LF_DOC, LF_RIGHEDOC, LF_CONDV, LF_RCONDV, LF_ANAMAG, LF_SCONTI, LF_UMART, LF_DESLIN, LF_CODCORR,
|
||||
LF_TAB, LF_TABCOM, LF_CLIFO, LF_CFVEN, LF_INDSP, LF_OCCAS, LF_PCON, LF_MOV, LF_STOMAG,
|
||||
LF_MOVMAG, LF_RMOVMAG, LF_MAG, LF_SVRIEP, LF_AGENTI, LF_PERCPROV, LF_ATTIV, LF_CAUSALI, 0);
|
||||
LF_TAB, LF_TABCOM, LF_CLIFO, LF_CFVEN, LF_INDSP, LF_OCCAS, LF_PCON, LF_MOV, LF_STOMAG,
|
||||
LF_MOVMAG, LF_RMOVMAG, LF_MAG, LF_SVRIEP, LF_AGENTI, LF_PERCPROV, LF_ATTIV, LF_CAUSALI, 0);
|
||||
|
||||
TISAM_recordset num("USE %NUM");
|
||||
for (bool ok = num.move_first(); ok; ok = num.move_next())
|
||||
@ -678,6 +690,7 @@ bool TMotore_application::user_create( )
|
||||
|
||||
_msk->set_handler(F_ANNO, TDocumento_mask::anno_handler);
|
||||
_msk->set_handler(F_CODNUM, TDocumento_mask::num_handler);
|
||||
_msk->set_handler(F_TIPODOC, tdoc_handler);
|
||||
_msk->set_handler(F_NUMDOCRIF, TDocumento_mask::numdocrif_search_handler);
|
||||
//_msk->set_handler(F_RAGSOCSEARCH, TDocumento_mask::ragsoc_search_handler);
|
||||
_msk->set_handler(F_NDOC, ndoc_handler);
|
||||
@ -1165,6 +1178,7 @@ bool TMotore_application::save_and_print(bool savedoc, TPrtype mode)
|
||||
if (filter > 0)
|
||||
{
|
||||
const bool da_stampare = doc.stampabile();
|
||||
const char old_stato = doc.stato();
|
||||
|
||||
TString commandline;
|
||||
commandline = "ve1 -";
|
||||
@ -1200,9 +1214,10 @@ bool TMotore_application::save_and_print(bool savedoc, TPrtype mode)
|
||||
|
||||
// Lo stato del documento vive di vita propria
|
||||
const char sfs = maindoc.tipo().stato_finale_stampa();
|
||||
maindoc.stato(sfs);
|
||||
const char str_sfs[2] = { sfs, '\0' };
|
||||
m.set(F_STATO, str_sfs, true);
|
||||
const char new_stato = old_stato > sfs ? old_stato : sfs;
|
||||
maindoc.stato(new_stato);
|
||||
const char ss[2] = { new_stato, '\0' };
|
||||
m.set(F_STATO, ss, true);
|
||||
init_modify_mode(m);
|
||||
}
|
||||
do_elab(maindoc, true);
|
||||
@ -1211,7 +1226,7 @@ bool TMotore_application::save_and_print(bool savedoc, TPrtype mode)
|
||||
else
|
||||
{
|
||||
rep.ext("");
|
||||
error_box("Il profilo %s non esiste", (const char*)rep);
|
||||
cantread_box(rep);
|
||||
return already_printing = false;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,8 @@ protected:
|
||||
int stato_corrente( );
|
||||
|
||||
// Handler per la maschera di ricerca
|
||||
static bool ndoc_handler( TMask_field& f, KEY key );
|
||||
static bool ndoc_handler(TMask_field& f, KEY key);
|
||||
static bool tdoc_handler(TMask_field& f, KEY key);
|
||||
|
||||
// caricamento Inifile
|
||||
virtual void sheet2ini(TSheet_field& s, TConfig& ini);
|
||||
|
@ -203,15 +203,15 @@ END
|
||||
STRING F_RAGSOCSEARCH 50
|
||||
BEGIN
|
||||
PROMPT 2 9 "Ragione Sociale "
|
||||
USE LF_DOC SELECT (TIPOCF==#F_TIPOCF)&&(LF_CLIFO->RAGSOC?=(#F_RAGSOCSEARCH+"*"))&&((#F_STATO=="")||(STATO==#F_STATO))
|
||||
USE LF_DOC SELECT (TIPOCF==#F_TIPOCF)&&(BETWEEN(STATO,#F_STATO,#F_STATO))
|
||||
BY LF_CLIFO->RAGSOC NDOC
|
||||
JOIN LF_CLIFO INTO TIPOCF==TIPOCF CODCF==CODCF
|
||||
INPUT PROVV F_PROVV SELECT
|
||||
INPUT ANNO F_ANNO SELECT
|
||||
INPUT CODNUM F_CODNUM SELECT
|
||||
INPUT LF_CLIFO->RAGSOC F_RAGSOCSEARCH
|
||||
COPY DISPLAY F_CODCF
|
||||
COPY OUTPUT F_NDOC
|
||||
OUTPUT F_CODCF CODCF
|
||||
COPY OUTPUT F_CODCF
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
|
@ -319,8 +319,10 @@ int TReport_doc::set_printed_status(TDocumento& doc) const
|
||||
if (doc.get_char(DOC_PROVV) == 'D') // Se e' una numerazione definitiva
|
||||
{
|
||||
if (doc.stampabile()) // Controlla se non e' gia' nello stato si stampato in definitiva
|
||||
{
|
||||
doc.stato(doc.tipo().stato_finale_stampa()); // Se e' gia' in definitiva aggiorna solo lo stato
|
||||
{
|
||||
const char sfs = doc.tipo().stato_finale_stampa();
|
||||
if (doc.stato() < sfs)
|
||||
doc.stato(sfs); // Se non e' gia' in definitiva aggiorna lo stato
|
||||
err = doc.rewrite();
|
||||
|
||||
// Invia la transazione di cambio stato se necessario
|
||||
@ -332,8 +334,7 @@ int TReport_doc::set_printed_status(TDocumento& doc) const
|
||||
ini.set("Action", "MODIFY");
|
||||
ini.set("Firm", prefix().get_codditta());
|
||||
ini.set("Mode", "A");
|
||||
TString4 paradoc; paradoc.format("%d", LF_DOC);
|
||||
ini.set_paragraph(paradoc);
|
||||
ini.set_paragraph(LF_DOC);
|
||||
ini.set(DOC_PROVV, doc.get(DOC_PROVV));
|
||||
ini.set(DOC_ANNO, doc.get(DOC_ANNO));
|
||||
ini.set(DOC_CODNUM, doc.get(DOC_CODNUM));
|
||||
@ -1205,11 +1206,10 @@ bool TReport_doc_app::get_next_mail(TToken_string& to, TToken_string& cc, TToken
|
||||
const TDocumento doc('D', _anno, _codnum, _ndoc);
|
||||
doc.riferimento(subj);
|
||||
if (subj.blank())
|
||||
{
|
||||
subj = doc.tipo().descrizione();
|
||||
subj << ' ' << _ndoc << TR(" del ") << doc.get(DOC_DATADOC)
|
||||
<< ' ' << prefix().firm().ragione_sociale();
|
||||
}
|
||||
subj << ' ' << _ndoc << TR(" del ") << doc.get(DOC_DATADOC)
|
||||
<< ' ' << prefix().firm().ragione_sociale();
|
||||
|
||||
TString saluti = esc(ini_get_string(CONFIG_USER, "Mail", "Signature"));
|
||||
if (saluti.full())
|
||||
{
|
||||
@ -1224,10 +1224,7 @@ bool TReport_doc_app::get_next_mail(TToken_string& to, TToken_string& cc, TToken
|
||||
}
|
||||
else
|
||||
{
|
||||
text << TR("Cordiali Saluti");
|
||||
if (user() != dongle().administrator())
|
||||
text << " " << cache().get(LF_USER, user(), "USERDESC");
|
||||
text << ' ' << prefix().firm().ragione_sociale();
|
||||
text << TR("Cordiali Saluti ") << prefix().firm().ragione_sociale();
|
||||
}
|
||||
text.trim();
|
||||
if (to.full())
|
||||
@ -1391,7 +1388,7 @@ bool TReport_doc_app::print_loop(TRecordset& doc, TOutput_mode mode, bool final_
|
||||
const TTipo_documento& tipo = cached_tipodoc(tipodoc);
|
||||
|
||||
const bool final_doc = doc.get(DOC_STATO).as_string()[0] >= tipo.stato_finale_stampa();
|
||||
if (final_print && final_doc)
|
||||
if (final_print && final_doc && docs > 1) // Se docs==1 probabilmente stampo un sigolo documento comunque
|
||||
continue; // Evita lavoro inutile!
|
||||
|
||||
bool arc = false;
|
||||
@ -1692,7 +1689,7 @@ void TReport_doc_app::main_loop()
|
||||
_msk->set(F_A_NDOC, andoc);
|
||||
}
|
||||
|
||||
const TOutput_mode mode = key2mode(*argv(6)); // modo di 'S'tampa, 'A'nteprima, 'P'DF
|
||||
const TOutput_mode mode = key2mode(*argv(6)); // modo di 'S'tampa, 'A'nteprima, 'P'DF
|
||||
// argv(7); // Provvisiorio o Definitivo testato altrove!
|
||||
if (a > 8)
|
||||
_msk->set(F_NCOPIE, argv(8)); // Numero copie
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <recarray.h>
|
||||
#include <recset.h>
|
||||
#include <relapp.h>
|
||||
#include <sheet.h>
|
||||
|
||||
#include "../mg/anamag.h"
|
||||
#include "../mg/codcorr.h"
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <config.h>
|
||||
#include <defmask.h>
|
||||
#include <dongle.h>
|
||||
#include <progind.h>
|
||||
#include <recarray.h>
|
||||
#include <recset.h>
|
||||
#include <relapp.h>
|
||||
#include <sheet.h>
|
||||
#include <tabutil.h>
|
||||
|
||||
#include "../mg/anamag.h"
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
#include <printapp.h>
|
||||
#include <mask.h>
|
||||
#include <config.h>
|
||||
@ -163,16 +162,19 @@ bool TStampa_condizioni_vendita::user_create() {
|
||||
return (gotcha);
|
||||
}
|
||||
|
||||
bool TStampa_condizioni_vendita::user_destroy() {
|
||||
bool TStampa_condizioni_vendita::user_destroy()
|
||||
{
|
||||
delete _rel; // distrugge la relazione principale
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TStampa_condizioni_vendita::set_print(int) {
|
||||
bool TStampa_condizioni_vendita::set_print(int)
|
||||
{
|
||||
TMask mask("ve3200x");
|
||||
mask.set(F_TIPO, _condven); // settaggio del campo di tipo archivio
|
||||
mask.set_handler(F_TIPORIGHE,tipo_handler);
|
||||
switch (_condven[0]) {
|
||||
switch (_condven[0])
|
||||
{
|
||||
case 'L': // listini
|
||||
mask.show(-1);// nasconde i campi dei listini
|
||||
mask.hide(-5);// nasconde i campi del gr. merc
|
||||
@ -218,7 +220,8 @@ bool TStampa_condizioni_vendita::set_print(int) {
|
||||
DESTROY(F_C_COD);
|
||||
break;
|
||||
}
|
||||
if (mask.run()== K_ENTER) { // lancia la maschera, se viene confermata vengono trovati gli estremi del cursore
|
||||
if (mask.run()== K_ENTER)
|
||||
{ // lancia la maschera, se viene confermata vengono trovati gli estremi del cursore
|
||||
_testastamp= FALSE; // azzera il flag di testa già stampata
|
||||
_listval= mask.get_bool(F_L_LISTVALUTA); // legge lo stato del checkbox di abilitazione dei listini in valuta
|
||||
_testacomp= mask.get_bool(F_TESTACOMP); // legge l'abilitazione della stampa completa della testata
|
||||
@ -229,7 +232,8 @@ bool TStampa_condizioni_vendita::set_print(int) {
|
||||
TRectype da(rcondv.curr()); // prepara il record di inizio regione
|
||||
da.zero();
|
||||
da.put("TIPO", _condven);
|
||||
switch (_condven[0]) { // impostazione della chiave della testata
|
||||
switch (_condven[0])
|
||||
{ // impostazione della chiave della testata
|
||||
case 'L': // listini
|
||||
if (_codlis_catven) da.put("CATVEN", mask.get(F_L_CATVEN));
|
||||
else da.blank("CATVEN"); // riempie il campo di blank se non è gestito
|
||||
@ -237,10 +241,13 @@ bool TStampa_condizioni_vendita::set_print(int) {
|
||||
break;
|
||||
case 'C': // contratti
|
||||
da.blank("CATVEN"); // i campi non gestiti vengono riempiti di blank
|
||||
if (_codcon_codcf) {
|
||||
if (_codcon_codcf)
|
||||
{
|
||||
da.put("TIPOCF", mask.get(F_C_TIPOCF));
|
||||
da.put("CODCF", mask.get(F_C_CODCF));
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
da.blank("TIPOCF"); // riempie i campi di blank se non sono gestiti
|
||||
da.blank("CODCF");
|
||||
}
|
||||
@ -251,7 +258,9 @@ bool TStampa_condizioni_vendita::set_print(int) {
|
||||
da.blank("TIPOCF");
|
||||
da.blank("CODCF");
|
||||
da.put("COD", mask.get(F_O_COD));
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
TString filter;
|
||||
@ -260,23 +269,43 @@ bool TStampa_condizioni_vendita::set_print(int) {
|
||||
|
||||
if (!_filter_by_grm)
|
||||
{
|
||||
da.put("TIPORIGA", mask.get(F_TIPORIGHE));
|
||||
da.put("CODRIGA", mask.get(F_DARIGA_A));
|
||||
a.put("TIPORIGA", mask.get(F_TIPORIGHE));
|
||||
a.put("CODRIGA", mask.get(F_ARIGA_A));
|
||||
if (mask.get(F_C_COD).full())
|
||||
{
|
||||
da.put("TIPORIGA", mask.get(F_TIPORIGHE));
|
||||
da.put("CODRIGA", mask.get(F_DARIGA_A));
|
||||
a.put("TIPORIGA", mask.get(F_TIPORIGHE));
|
||||
a.put("CODRIGA", mask.get(F_ARIGA_A));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (filter.not_empty()) filter << "&&";
|
||||
filter << "(TIPORIGA=\"" << mask.get(F_TIPORIGHE) << "\")";
|
||||
if (mask.get(F_DARIGA_A).full() || mask.get(F_ARIGA_A).full())
|
||||
filter << "&&(BETWEEN(CODRIGA,\"" << mask.get(F_DARIGA_A) << "\",\"" << mask.get(F_ARIGA_A) << "\"))";
|
||||
}
|
||||
}
|
||||
else // Elenco righe per articoli ma filtrate sul gruppo merceologico
|
||||
{
|
||||
da.put("TIPORIGA", "A");a.put("TIPORIGA", "A");
|
||||
if (mask.get(F_C_COD).full())
|
||||
{
|
||||
da.put("TIPORIGA", "A");
|
||||
a.put("TIPORIGA", "A");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (filter.not_empty()) filter << "&&";
|
||||
filter << "(TIPORIGA=\"A\")";
|
||||
}
|
||||
|
||||
if (mask.get(F_DFLT_G_C).not_empty())
|
||||
{
|
||||
if (filter.not_empty()) filter << "&&";
|
||||
filter << "(" << LF_ANAMAG << "->GRMERC>=\"" << mask.get(F_DFLT_G_C);
|
||||
filter << "\")";
|
||||
}
|
||||
if (mask.get(F_DFLT_G_C).not_empty())
|
||||
{
|
||||
if (filter.not_empty())
|
||||
filter << "&&";
|
||||
if (filter.not_empty()) filter << "&&";
|
||||
filter << "(" << LF_ANAMAG << "->GRMERC<=\"" << mask.get(F_AFLT_G_C);
|
||||
filter << "\")";
|
||||
}
|
||||
|
@ -165,11 +165,12 @@ void TPrint_condven::main_loop()
|
||||
|
||||
bool TPrint_condven::create()
|
||||
{
|
||||
#ifdef NDEBUG
|
||||
//controlla se la chiave ha l'autorizzazione a questo programma
|
||||
Tdninst dninst;
|
||||
if (!dninst.can_I_run(true))
|
||||
return error_box(TR("Programma non autorizzato!"));
|
||||
|
||||
#endif
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <dongle.h>
|
||||
#include <lffiles.h>
|
||||
#include <progind.h>
|
||||
#include <recset.h>
|
||||
#include <relation.h>
|
||||
#include <sheet.h>
|
||||
|
||||
#include "ve4.h"
|
||||
#include "ve4200a.h"
|
||||
|
@ -1938,10 +1938,10 @@ long TDocumento::get_next_key(char provv, int anno, const char* codnum) const
|
||||
{
|
||||
if (err == NOERR)
|
||||
doc.prev();
|
||||
if (curr.get_char("PROVV") == provv &&
|
||||
curr.get_int("ANNO") == anno &&
|
||||
curr.get("CODNUM") == codnum)
|
||||
n = curr.get_long("NDOC");
|
||||
if (curr.get_char(DOC_PROVV) == provv &&
|
||||
curr.get_int(DOC_ANNO) == anno &&
|
||||
curr.get(DOC_CODNUM) == codnum)
|
||||
n = curr.get_long(DOC_NDOC);
|
||||
}
|
||||
|
||||
n++;
|
||||
|
@ -1149,7 +1149,7 @@ void TDocumento_mask::cli2mask(bool force_load)
|
||||
key.add("N");
|
||||
key.add("1");
|
||||
|
||||
const TRectype & cfbanpr = cache().get(LF_CFBAN, key);
|
||||
const TRectype& cfbanpr = cache().get(LF_CFBAN, key);
|
||||
|
||||
// Setta i campi che appartengono al file LF_CFVEN
|
||||
if (cfbanpr.empty() || id2pos(F_CODABIP1) < 0)
|
||||
@ -4522,8 +4522,12 @@ bool TBarcode_mask::on_code_entered(const TString& code)
|
||||
{
|
||||
if (rdoc->get(RDOC_CODART) == codart && rdoc->get(RDOC_LIVELLO) == livello)
|
||||
{
|
||||
rdoc->add(RDOC_QTA, qta);
|
||||
s.row(i-1).add(rdoc->get(RDOC_QTA), s.cid2index(FR_QTA));
|
||||
const int idx = s.cid2index(FR_QTA);
|
||||
TToken_string& row = s.row(i-1);
|
||||
qta += real(row.get(idx));
|
||||
row.add(qta.string(),idx);
|
||||
s.check_row(i-1, 0x3);
|
||||
rdoc->autosave(s);
|
||||
s.force_update(i-1);
|
||||
return true;
|
||||
}
|
||||
@ -4531,12 +4535,14 @@ bool TBarcode_mask::on_code_entered(const TString& code)
|
||||
|
||||
TRiga_documento& r = doc.new_row(_dm.get(F_LBTIPORIGA));
|
||||
r.put(RDOC_CODART, codart);
|
||||
r.put(RDOC_CODARTMAG, codart);
|
||||
r.put(RDOC_LIVELLO, livello);
|
||||
r.put(RDOC_QTA, qta);
|
||||
r.autoload(s);
|
||||
const int i = r.get_int(RDOC_NRIGA)-1;
|
||||
_dm.ss_notify(s, i, K_CTRL+K_INS); // Propone magazzino
|
||||
s.check_row(i, 0x3);
|
||||
_dm.ss_notify(s, i, K_ENTER); // Fine modifica
|
||||
s.force_update();
|
||||
}
|
||||
|
||||
|
@ -1462,7 +1462,7 @@ public:
|
||||
|
||||
const TString& TLink_riga_documento::get_str(const char* fieldname) const
|
||||
{
|
||||
if (strcmp(fieldname, "RESIDUO") == 0)
|
||||
if (xvt_str_same(fieldname, "RESIDUO"))
|
||||
{
|
||||
TString& value = get_tmp_string();
|
||||
value = qtaresidua().string();
|
||||
|
Loading…
x
Reference in New Issue
Block a user