git-svn-id: svn://10.65.10.50/branches/R_10_00@23160 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5a6ba3428f
commit
04a1ce4267
@ -679,7 +679,7 @@ bool TMotore_application::user_create( )
|
|||||||
_msk->set_handler(F_ANNO, TDocumento_mask::anno_handler);
|
_msk->set_handler(F_ANNO, TDocumento_mask::anno_handler);
|
||||||
_msk->set_handler(F_CODNUM, TDocumento_mask::num_handler);
|
_msk->set_handler(F_CODNUM, TDocumento_mask::num_handler);
|
||||||
_msk->set_handler(F_NUMDOCRIF, TDocumento_mask::numdocrif_search_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_RAGSOCSEARCH, TDocumento_mask::ragsoc_search_handler);
|
||||||
_msk->set_handler(F_NDOC, ndoc_handler);
|
_msk->set_handler(F_NDOC, ndoc_handler);
|
||||||
|
|
||||||
const int args = argc() ;
|
const int args = argc() ;
|
||||||
|
@ -159,12 +159,23 @@ END
|
|||||||
NUMBER F_CODCF 6
|
NUMBER F_CODCF 6
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 24 8 "Codice "
|
PROMPT 24 8 "Codice "
|
||||||
|
|
||||||
|
/*
|
||||||
USE LF_DOC KEY 2 SELECT (CODNUM==#F_CODNUM)&&(PROVV==#F_PROVV)&&(ANNO==#F_ANNO)&&((#F_STATO=="")||(STATO==#F_STATO))
|
USE LF_DOC KEY 2 SELECT (CODNUM==#F_CODNUM)&&(PROVV==#F_PROVV)&&(ANNO==#F_ANNO)&&((#F_STATO=="")||(STATO==#F_STATO))
|
||||||
JOIN LF_CLIFO INTO TIPOCF==TIPOCF CODCF==CODCF
|
JOIN LF_CLIFO INTO TIPOCF==TIPOCF CODCF==CODCF
|
||||||
INPUT TIPOCF F_TIPOCF SELECT
|
INPUT TIPOCF F_TIPOCF SELECT
|
||||||
INPUT CODCF F_CODCF
|
INPUT CODCF F_CODCF SELECT
|
||||||
INPUT PROVV F_PROVV
|
INPUT PROVV F_PROVV
|
||||||
INPUT ANNO F_ANNO
|
INPUT ANNO F_ANNO
|
||||||
|
*/
|
||||||
|
|
||||||
|
USE LF_DOC SELECT (TIPOCF==#F_TIPOCF)&&((#F_CODCF="")||(CODCF==#F_CODCF))&&((#F_STATO=="")||(STATO==#F_STATO))
|
||||||
|
BY LF_CLIFO->CODCF NDOC
|
||||||
|
JOIN LF_CLIFO INTO TIPOCF==TIPOCF CODCF==CODCF
|
||||||
|
INPUT PROVV F_PROVV SELECT
|
||||||
|
INPUT ANNO F_ANNO SELECT
|
||||||
|
INPUT CODNUM F_CODNUM SELECT
|
||||||
|
|
||||||
DISPLAY "Codice" CODCF
|
DISPLAY "Codice" CODCF
|
||||||
DISPLAY "Ragione Sociale@50" LF_CLIFO->RAGSOC
|
DISPLAY "Ragione Sociale@50" LF_CLIFO->RAGSOC
|
||||||
DISPLAY "Partita IVA@12" LF_CLIFO->PAIV
|
DISPLAY "Partita IVA@12" LF_CLIFO->PAIV
|
||||||
@ -174,10 +185,9 @@ BEGIN
|
|||||||
DISPLAY "Tipo" TIPODOC
|
DISPLAY "Tipo" TIPODOC
|
||||||
DISPLAY "N.Doc. " NDOC
|
DISPLAY "N.Doc. " NDOC
|
||||||
DISPLAY "Stato@R" STATO
|
DISPLAY "Stato@R" STATO
|
||||||
DISPLAY "Data\ndocumento" DATADOC
|
DISPLAY "Data\ndocumento@10" DATADOC
|
||||||
DISPLAY "Valuta" CODVAL
|
DISPLAY "Valuta" CODVAL
|
||||||
DISPLAY "Totale\ndocumento@18V" G1:TOTDOC
|
DISPLAY "Totale\ndocumento@18V" G1:TOTDOC
|
||||||
DISPLAY "Stato" STATO
|
|
||||||
COPY OUTPUT F_NDOC
|
COPY OUTPUT F_NDOC
|
||||||
OUTPUT F_CODCF CODCF
|
OUTPUT F_CODCF CODCF
|
||||||
CHECKTYPE NORMAL
|
CHECKTYPE NORMAL
|
||||||
@ -193,7 +203,16 @@ END
|
|||||||
STRING F_RAGSOCSEARCH 50
|
STRING F_RAGSOCSEARCH 50
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 9 "Ragione Sociale "
|
PROMPT 2 9 "Ragione Sociale "
|
||||||
FLAGS "B"
|
USE LF_DOC SELECT (TIPOCF==#F_TIPOCF)&&(LF_CLIFO->RAGSOC?=(#F_RAGSOCSEARCH+"*"))&&((#F_STATO=="")||(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
|
||||||
|
COPY DISPLAY F_CODCF
|
||||||
|
COPY OUTPUT F_NDOC
|
||||||
|
OUTPUT F_CODCF CODCF
|
||||||
|
CHECKTYPE NORMAL
|
||||||
END
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
@ -49,3 +49,7 @@
|
|||||||
: MESSAGE_LV_DOT ( s1 -- )
|
: MESSAGE_LV_DOT ( s1 -- )
|
||||||
DOC_LV_DOT \ user defined word in ve1.exe
|
DOC_LV_DOT \ user defined word in ve1.exe
|
||||||
;
|
;
|
||||||
|
|
||||||
|
: MESSAGE_ADD_ROW ( s1 s2 s3 -- )
|
||||||
|
DOC_ADD_ROW \ user defined word in ve1.exe
|
||||||
|
;
|
187
ve/ve1300.cpp
187
ve/ve1300.cpp
@ -48,10 +48,13 @@ public:
|
|||||||
|
|
||||||
TRiga_documento& TDoc_recordset::riga_doc(int n) const
|
TRiga_documento& TDoc_recordset::riga_doc(int n) const
|
||||||
{
|
{
|
||||||
|
if (n < 0 || n > _doc->rows()) // Non dovrebbe succedere mai
|
||||||
|
{
|
||||||
|
n = _doc->new_row("05").numero(); // Crea una riga descrizione fittizia
|
||||||
|
((TDoc_recordset*)this)->_lastpos++;
|
||||||
|
}
|
||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
n = _mypos+1;
|
n = _mypos+1;
|
||||||
if (n > _doc->rows()) // Non dovrebbe succedere mai
|
|
||||||
n = _doc->new_row("05").get_int(RDOC_NRIGA); // Crea ua riga descrizione fittizia
|
|
||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
n = 1;
|
n = 1;
|
||||||
return _doc->row(n);
|
return _doc->row(n);
|
||||||
@ -283,6 +286,8 @@ protected:
|
|||||||
virtual bool get_usr_val(const TString& name, TVariant& var) const;
|
virtual bool get_usr_val(const TString& name, TVariant& var) const;
|
||||||
virtual bool set_usr_val(const TString& name, const TVariant& var);
|
virtual bool set_usr_val(const TString& name, const TVariant& var);
|
||||||
|
|
||||||
|
TVariant eval_rdoc(const TRiga_documento& rdoc, const TString& formula, TFieldtypes ft) const;
|
||||||
|
|
||||||
TDocumentoEsteso& doc();
|
TDocumentoEsteso& doc();
|
||||||
TRiga_documento& riga_doc(int n = 0);
|
TRiga_documento& riga_doc(int n = 0);
|
||||||
void output_values(const TRectype& rec, const TString& output);
|
void output_values(const TRectype& rec, const TString& output);
|
||||||
@ -295,6 +300,7 @@ protected:
|
|||||||
bool msg_scadenze(TVariant_stack& stack);
|
bool msg_scadenze(TVariant_stack& stack);
|
||||||
bool msg_tot_imponibili(TVariant_stack& stack);
|
bool msg_tot_imponibili(TVariant_stack& stack);
|
||||||
bool msg_lv_dot(TVariant_stack& stack);
|
bool msg_lv_dot(TVariant_stack& stack);
|
||||||
|
bool msg_add_row(TVariant_stack& stack);
|
||||||
|
|
||||||
int set_printed_status(TDocumento& doc) const;
|
int set_printed_status(TDocumento& doc) const;
|
||||||
|
|
||||||
@ -796,6 +802,104 @@ bool TReport_doc::msg_lv_dot(TVariant_stack& stack)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TVariant TReport_doc::eval_rdoc(const TRiga_documento& rdoc, const TString& formula, TFieldtypes ft) const
|
||||||
|
{
|
||||||
|
TExpr_documento expr(formula, _strexpr, &rdoc.doc(), &rdoc);
|
||||||
|
for (int v = expr.numvar()-1; v >= 0; v--)
|
||||||
|
{
|
||||||
|
const TFixed_string fld = expr.varname(v);
|
||||||
|
if (rdoc.TRectype::exist(fld))
|
||||||
|
expr.setvar(fld, rdoc.get(fld));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TVariant var;
|
||||||
|
if (get_usr_val(fld, var))
|
||||||
|
expr.setvar(fld, var.as_string());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TVariant tmp;
|
||||||
|
switch (ft)
|
||||||
|
{
|
||||||
|
case _boolfld: tmp.set(expr.as_bool()); break;
|
||||||
|
case _realfld: tmp.set(expr.as_real()); break;
|
||||||
|
default : tmp.set(expr.as_string()); break;
|
||||||
|
}
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TReport_doc::msg_add_row(TVariant_stack& stack)
|
||||||
|
{
|
||||||
|
TString4 row_type;
|
||||||
|
TString codart_expr;
|
||||||
|
TString descr_expr;
|
||||||
|
TToken_string sum_fields;
|
||||||
|
|
||||||
|
for (int v = 0; !stack.empty(); v++)
|
||||||
|
{
|
||||||
|
const TString& riga = stack.pop().as_string();
|
||||||
|
switch (v)
|
||||||
|
{
|
||||||
|
case 0: row_type.strncpy(riga, 2); break;
|
||||||
|
case 1: codart_expr = riga; break;
|
||||||
|
case 2: descr_expr = riga; break;
|
||||||
|
default: sum_fields.add(riga); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TRiga_documento& curr_rdoc = riga_doc(0);
|
||||||
|
if (curr_rdoc.get(RDOC_TIPORIGA) == row_type)
|
||||||
|
return false; // Riga generata
|
||||||
|
|
||||||
|
const TCodice_articolo codart = eval_rdoc(curr_rdoc, codart_expr, _alfafld).as_string();
|
||||||
|
const int curr_riga = curr_rdoc.numero();
|
||||||
|
const int last_riga = doc().physical_rows();
|
||||||
|
int good_riga = 0;
|
||||||
|
for (int i = last_riga; i > curr_riga; i--)
|
||||||
|
{
|
||||||
|
const TRiga_documento& rdoc = riga_doc(i);
|
||||||
|
if (rdoc.get(RDOC_TIPORIGA) == row_type && rdoc.get(RDOC_CODART) == codart)
|
||||||
|
{
|
||||||
|
good_riga = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (good_riga <= curr_riga) // Nessuna riga compatibile
|
||||||
|
{
|
||||||
|
// Aggiungi riga vuota, se necessario
|
||||||
|
const TRiga_documento& urdoc = riga_doc(last_riga);
|
||||||
|
if (urdoc.get(RDOC_TIPORIGA) != row_type)
|
||||||
|
{
|
||||||
|
TRiga_documento& empty_rdoc = riga_doc(-1);
|
||||||
|
empty_rdoc.put(RDOC_TIPORIGA, row_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Crea nuova riga ragggruppamento
|
||||||
|
TRiga_documento& new_rdoc = riga_doc(-1);
|
||||||
|
new_rdoc.put(RDOC_TIPORIGA, row_type);
|
||||||
|
new_rdoc.put(RDOC_CODART, codart);
|
||||||
|
good_riga = new_rdoc.numero();
|
||||||
|
}
|
||||||
|
|
||||||
|
TRiga_documento& good_rdoc = riga_doc(good_riga);
|
||||||
|
FOR_EACH_TOKEN(sum_fields, fld)
|
||||||
|
good_rdoc.add(fld, curr_rdoc.get_real(fld));
|
||||||
|
|
||||||
|
int open_brace = 0;
|
||||||
|
while ((open_brace = descr_expr.find('{')) >=0)
|
||||||
|
{
|
||||||
|
const int close_brace = descr_expr.find('}', open_brace);
|
||||||
|
if (close_brace < 0) break;
|
||||||
|
const TString& varname = descr_expr.sub(open_brace+1, close_brace);
|
||||||
|
TFieldtypes ft = curr_rdoc.type(varname); if (ft == _nullfld) ft = _alfafld;
|
||||||
|
TVariant var = eval_rdoc(good_rdoc, varname, ft);
|
||||||
|
const TString& after = descr_expr.mid(close_brace+1);
|
||||||
|
descr_expr.cut(open_brace)<< var.as_string() << after;
|
||||||
|
}
|
||||||
|
good_rdoc.set_descr(descr_expr);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
size_t TReport_doc::get_usr_words(TString_array& words) const
|
size_t TReport_doc::get_usr_words(TString_array& words) const
|
||||||
{
|
{
|
||||||
TReport::get_usr_words(words);
|
TReport::get_usr_words(words);
|
||||||
@ -808,6 +912,7 @@ size_t TReport_doc::get_usr_words(TString_array& words) const
|
|||||||
"DOC_SCADENZE",
|
"DOC_SCADENZE",
|
||||||
"DOC_TOT_IMPONIBILI",
|
"DOC_TOT_IMPONIBILI",
|
||||||
"DOC_LV_DOT",
|
"DOC_LV_DOT",
|
||||||
|
"DOC_ADD_ROW",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -834,6 +939,7 @@ bool TReport_doc::execute_usr_word(unsigned int opcode, TVariant_stack& stack)
|
|||||||
case 4: msg_scadenze(stack); break;
|
case 4: msg_scadenze(stack); break;
|
||||||
case 5: msg_tot_imponibili(stack); break;
|
case 5: msg_tot_imponibili(stack); break;
|
||||||
case 6: msg_lv_dot(stack); break;
|
case 6: msg_lv_dot(stack); break;
|
||||||
|
case 7: msg_add_row(stack); break;
|
||||||
default: ok = false; break;
|
default: ok = false; break;
|
||||||
}
|
}
|
||||||
stack.reset(); // Svuota eventuali parametri variabili inutilizzati
|
stack.reset(); // Svuota eventuali parametri variabili inutilizzati
|
||||||
@ -923,6 +1029,20 @@ bool TReport_doc_mask::on_field_event(TOperable_field& o, TField_event e, long j
|
|||||||
set(F_A_NDOC, dal);
|
set(F_A_NDOC, dal);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case DLG_CONFIG:
|
||||||
|
if (e == fe_button)
|
||||||
|
{
|
||||||
|
TMask m("ba0100m");
|
||||||
|
TConfig cfg(CONFIG_USER, "Mail");
|
||||||
|
FOR_EACH_MASK_FIELD(m, i, f) if (f->field())
|
||||||
|
f->set(f->field()->read(cfg, "Mail"));
|
||||||
|
if (m.run() == K_ENTER)
|
||||||
|
{
|
||||||
|
FOR_EACH_MASK_FIELD(m, i, f) if (f->field())
|
||||||
|
f->field()->write(cfg, "Mail", f->get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -937,8 +1057,11 @@ TReport_doc_mask::TReport_doc_mask() : TAutomask("ve1300a")
|
|||||||
TApplication& a = main_app();
|
TApplication& a = main_app();
|
||||||
const bool can_pdf = a.has_module(RSAUT);
|
const bool can_pdf = a.has_module(RSAUT);
|
||||||
const bool can_sign = can_pdf && a.has_module(FDAUT);
|
const bool can_sign = can_pdf && a.has_module(FDAUT);
|
||||||
enable(DLG_EMAIL, can_pdf);
|
const int mail_client = xvt_mail_installed();
|
||||||
enable(DLG_SIGNMAIL, can_sign);
|
const bool can_mail = can_pdf && mail_client != 0;
|
||||||
|
enable(DLG_EMAIL, can_mail);
|
||||||
|
enable(DLG_SIGNMAIL, can_mail && can_sign);
|
||||||
|
enable(DLG_CONFIG, can_mail && (mail_client & 0x2) != 0);
|
||||||
enable(DLG_PDF, can_pdf);
|
enable(DLG_PDF, can_pdf);
|
||||||
enable(DLG_SIGNPDF, can_sign);
|
enable(DLG_SIGNPDF, can_sign);
|
||||||
}
|
}
|
||||||
@ -1079,7 +1202,7 @@ bool TReport_doc_app::get_next_mail(TToken_string& to, TToken_string& cc, TToken
|
|||||||
ok = get_mail_address(to, cc);
|
ok = get_mail_address(to, cc);
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
TDocumento doc('D', _anno, _codnum, _ndoc);
|
const TDocumento doc('D', _anno, _codnum, _ndoc);
|
||||||
doc.riferimento(subj);
|
doc.riferimento(subj);
|
||||||
if (subj.blank())
|
if (subj.blank())
|
||||||
{
|
{
|
||||||
@ -1087,7 +1210,26 @@ bool TReport_doc_app::get_next_mail(TToken_string& to, TToken_string& cc, TToken
|
|||||||
subj << ' ' << _ndoc << TR(" del ") << doc.get(DOC_DATADOC)
|
subj << ' ' << _ndoc << TR(" del ") << doc.get(DOC_DATADOC)
|
||||||
<< ' ' << prefix().firm().ragione_sociale();
|
<< ' ' << prefix().firm().ragione_sociale();
|
||||||
}
|
}
|
||||||
text << TR("Invio documento ") << subj;
|
TString saluti = esc(ini_get_string(CONFIG_USER, "Mail", "Signature"));
|
||||||
|
if (saluti.full())
|
||||||
|
{
|
||||||
|
if (saluti.find('\n')<0 && fexist(saluti))
|
||||||
|
{
|
||||||
|
TScanner s(saluti);
|
||||||
|
while (!s.eof())
|
||||||
|
text << s.line() << '\n';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
text << saluti << '\n';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
text << TR("Cordiali Saluti");
|
||||||
|
if (user() != dongle().administrator())
|
||||||
|
text << " " << cache().get(LF_USER, user(), "USERDESC");
|
||||||
|
text << ' ' << prefix().firm().ragione_sociale();
|
||||||
|
}
|
||||||
|
text.trim();
|
||||||
if (to.full())
|
if (to.full())
|
||||||
ui &= ~0x1; // No user interface
|
ui &= ~0x1; // No user interface
|
||||||
ui |= 0x2; // Query receipt
|
ui |= 0x2; // Query receipt
|
||||||
@ -1196,7 +1338,7 @@ bool TReport_doc_app::nome_report(const TRecordset& doc, int quale, TFilename& p
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TReport_doc_app::print_loop(TRecordset& doc, TOutput_mode mode, bool is_definitive)
|
bool TReport_doc_app::print_loop(TRecordset& doc, TOutput_mode mode, bool final_print)
|
||||||
{
|
{
|
||||||
const int docs = doc.items();
|
const int docs = doc.items();
|
||||||
if (docs <= 0)
|
if (docs <= 0)
|
||||||
@ -1229,8 +1371,9 @@ bool TReport_doc_app::print_loop(TRecordset& doc, TOutput_mode mode, bool is_def
|
|||||||
"Rispondendo NO verranno solo salvati gli allegati."));
|
"Rispondendo NO verranno solo salvati gli allegati."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (docs > 0)
|
||||||
|
{
|
||||||
const bool mail_requested = (mode == out_mail || mode == out_signed_mail);
|
const bool mail_requested = (mode == out_mail || mode == out_signed_mail);
|
||||||
|
|
||||||
TProgress_monitor pi(docs, TR("Elaborazione documenti..."));
|
TProgress_monitor pi(docs, TR("Elaborazione documenti..."));
|
||||||
for (short loop = mail_requested ? 0 : 1; loop < 2; loop++)
|
for (short loop = mail_requested ? 0 : 1; loop < 2; loop++)
|
||||||
{
|
{
|
||||||
@ -1247,12 +1390,13 @@ bool TReport_doc_app::print_loop(TRecordset& doc, TOutput_mode mode, bool is_def
|
|||||||
const TString4 tipodoc = doc.get(DOC_TIPODOC).as_string();
|
const TString4 tipodoc = doc.get(DOC_TIPODOC).as_string();
|
||||||
const TTipo_documento& tipo = cached_tipodoc(tipodoc);
|
const TTipo_documento& tipo = cached_tipodoc(tipodoc);
|
||||||
|
|
||||||
bool arc = false;
|
const bool final_doc = doc.get(DOC_STATO).as_string()[0] >= tipo.stato_finale_stampa();
|
||||||
if (is_definitive)
|
if (final_print && final_doc)
|
||||||
{
|
|
||||||
if (doc.get(DOC_STATO).as_string()[0] == tipo.stato_finale_stampa())
|
|
||||||
continue; // Evita lavoro inutile!
|
continue; // Evita lavoro inutile!
|
||||||
|
|
||||||
|
bool arc = false;
|
||||||
|
if (final_print || final_doc)
|
||||||
|
{
|
||||||
const TString4 codnum = doc.get(DOC_CODNUM).as_string();
|
const TString4 codnum = doc.get(DOC_CODNUM).as_string();
|
||||||
const TCodice_numerazione& cn = cached_numerazione(codnum);
|
const TCodice_numerazione& cn = cached_numerazione(codnum);
|
||||||
arc = cn.auto_archive();
|
arc = cn.auto_archive();
|
||||||
@ -1273,7 +1417,7 @@ bool TReport_doc_app::print_loop(TRecordset& doc, TOutput_mode mode, bool is_def
|
|||||||
if (!paperless)
|
if (!paperless)
|
||||||
{
|
{
|
||||||
copies = _msk->get_int(F_NCOPIE);
|
copies = _msk->get_int(F_NCOPIE);
|
||||||
if (copies <= 0 && is_definitive)
|
if (copies <= 0 && final_print)
|
||||||
copies = tipo.ncopie();
|
copies = tipo.ncopie();
|
||||||
if (copies <= 0)
|
if (copies <= 0)
|
||||||
copies = 1;
|
copies = 1;
|
||||||
@ -1285,7 +1429,7 @@ bool TReport_doc_app::print_loop(TRecordset& doc, TOutput_mode mode, bool is_def
|
|||||||
if (mail_loop)
|
if (mail_loop)
|
||||||
{
|
{
|
||||||
mail_book = new TDoc_book;
|
mail_book = new TDoc_book;
|
||||||
if (!report.print(doc, *mail_book, is_definitive, 1, true, false, false)) // Non archiviare per ora...
|
if (!report.print(doc, *mail_book, final_print, 1, true, false, false)) // Non archiviare per ora...
|
||||||
break;
|
break;
|
||||||
if (arc) // ... eventualemte archivia direttamente il book senza passare per uno temporaneo
|
if (arc) // ... eventualemte archivia direttamente il book senza passare per uno temporaneo
|
||||||
mail_book->archive(NULL, signature);
|
mail_book->archive(NULL, signature);
|
||||||
@ -1301,7 +1445,7 @@ bool TReport_doc_app::print_loop(TRecordset& doc, TOutput_mode mode, bool is_def
|
|||||||
{
|
{
|
||||||
if (print_loop)
|
if (print_loop)
|
||||||
{
|
{
|
||||||
if (!report.print(doc, book, is_definitive, copies, true, arc, signature))
|
if (!report.print(doc, book, final_print, copies, true, arc, signature))
|
||||||
break;
|
break;
|
||||||
if (!paperless)
|
if (!paperless)
|
||||||
print_extra_copies(report, doc, book, copies);
|
print_extra_copies(report, doc, book, copies);
|
||||||
@ -1365,8 +1509,12 @@ bool TReport_doc_app::print_loop(TRecordset& doc, TOutput_mode mode, bool is_def
|
|||||||
if (ok && attach_mail) // Ho chiesto la spedizione vera e propria
|
if (ok && attach_mail) // Ho chiesto la spedizione vera e propria
|
||||||
{
|
{
|
||||||
ok = spotlite_send_mail(attachment);
|
ok = spotlite_send_mail(attachment);
|
||||||
if (is_tmp)
|
// Per ora non cancellare allegati mailsend.exe potrebbe non aver finito di scriverli 14/07/2015
|
||||||
attachment.fremove();
|
// if (is_tmp) attachment.fremove();
|
||||||
|
TString mesg; mesg << "Invio allegato " << attachment;
|
||||||
|
if (!ok) mesg << " NON";
|
||||||
|
mesg << " riuscito";
|
||||||
|
mail_log.log(0, mesg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete mail_book;
|
delete mail_book;
|
||||||
@ -1374,6 +1522,7 @@ bool TReport_doc_app::print_loop(TRecordset& doc, TOutput_mode mode, bool is_def
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} // if docs > 0
|
||||||
|
|
||||||
if (book.pages() > 0)
|
if (book.pages() > 0)
|
||||||
{
|
{
|
||||||
@ -1464,7 +1613,7 @@ void TReport_doc_app::print_trans(const char* ininame)
|
|||||||
TConfig ini(ininame, "Transaction");
|
TConfig ini(ininame, "Transaction");
|
||||||
a = ini.get("Action")[0]; // Stampa, Anteprima, Pdf, ...
|
a = ini.get("Action")[0]; // Stampa, Anteprima, Pdf, ...
|
||||||
m = ini.get("Mode")[0]; // Definitivo o Provvisori
|
m = ini.get("Mode")[0]; // Definitivo o Provvisori
|
||||||
_no_print_dlg = ini.get_bool("NoPrintDlg");
|
_no_print_dlg = ini.get_bool("NoPrintDlg"); // Nascondi GUI di stampa
|
||||||
}
|
}
|
||||||
const TOutput_mode mode = key2mode(a);
|
const TOutput_mode mode = key2mode(a);
|
||||||
const bool is_definitive = m == 'D';
|
const bool is_definitive = m == 'D';
|
||||||
@ -1499,7 +1648,7 @@ TReport_doc_app::TOutput_mode TReport_doc_app::key2mode(KEY k) const
|
|||||||
|
|
||||||
void TReport_doc_app::main_loop()
|
void TReport_doc_app::main_loop()
|
||||||
{
|
{
|
||||||
_no_print_dlg = false;
|
_no_print_dlg = false; // Normalmente mostra la GUI di stampa
|
||||||
const int a = argc();
|
const int a = argc();
|
||||||
if (a > 2)
|
if (a > 2)
|
||||||
{
|
{
|
||||||
|
@ -42,6 +42,12 @@ BEGIN
|
|||||||
FLAGS "D"
|
FLAGS "D"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_CONFIG 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT 7 1 "~Imposta"
|
||||||
|
PICTURE TOOL_CONFIG
|
||||||
|
END
|
||||||
|
|
||||||
BUTTON DLG_NULL 10 2
|
BUTTON DLG_NULL 10 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 7 1 ""
|
PROMPT 7 1 ""
|
||||||
@ -131,8 +137,10 @@ BEGIN
|
|||||||
INPUT NDOC F_DA_NDOC
|
INPUT NDOC F_DA_NDOC
|
||||||
DISPLAY "Data@10" DATADOC
|
DISPLAY "Data@10" DATADOC
|
||||||
DISPLAY "Numero@7" NDOC
|
DISPLAY "Numero@7" NDOC
|
||||||
|
DISPLAY "Stato" STATO
|
||||||
DISPLAY "Cliente/Fornitore@40" 20->RAGSOC
|
DISPLAY "Cliente/Fornitore@40" 20->RAGSOC
|
||||||
DISPLAY "Comune@20" 13->DENCOM
|
DISPLAY "Comune@20" 13->DENCOM
|
||||||
|
DISPLAY "E-Mail per fatture@40" 20->DOCMAIL
|
||||||
OUTPUT F_DA_NDOC NDOC
|
OUTPUT F_DA_NDOC NDOC
|
||||||
GROUP 1
|
GROUP 1
|
||||||
ADD RUN ve0 -0
|
ADD RUN ve0 -0
|
||||||
@ -274,6 +282,13 @@ BEGIN
|
|||||||
FLAG "P"
|
FLAG "P"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
STRING DLG_PROFILE 260
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 -1 "Profilo "
|
||||||
|
PSELECT
|
||||||
|
FLAGS "H"
|
||||||
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
ENDMASK
|
ENDMASK
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#include <applicat.h>
|
|
||||||
|
|
||||||
#include "velib07.h"
|
#include "velib07.h"
|
||||||
#include "../ba/ba8500.h"
|
#include "../ba/ba8500.h"
|
||||||
|
|
||||||
|
@ -478,6 +478,6 @@ bool TTabelle_sconti::remove()
|
|||||||
int ve2100(int argc, char* argv[]) {
|
int ve2100(int argc, char* argv[]) {
|
||||||
TTabelle_sconti a;
|
TTabelle_sconti a;
|
||||||
|
|
||||||
a.run(argc, argv, "Tabella sconti ");
|
a.run(argc, argv, TR("Tabella sconti "));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -646,6 +646,6 @@ bool TCondizioni_vendita::handle_copy(TMask_field &b, KEY k)
|
|||||||
int ve2200(int argc, char* argv[])
|
int ve2200(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
TCondizioni_vendita a;
|
TCondizioni_vendita a;
|
||||||
a.run(argc, argv, "Condizioni di vendita");
|
a.run(argc, argv, TR("Condizioni di vendita"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ class TMask_anamag: public TMask
|
|||||||
int last_annogiac, last_annosto;
|
int last_annogiac, last_annosto;
|
||||||
int _disabled_user_page;
|
int _disabled_user_page;
|
||||||
|
|
||||||
|
|
||||||
int _type_cod, _altype_cod;
|
int _type_cod, _altype_cod;
|
||||||
TString4 _ean8_pref;
|
TString4 _ean8_pref;
|
||||||
TString8 _ean13_pref;
|
TString8 _ean13_pref;
|
||||||
@ -49,7 +48,6 @@ class TMask_anamag: public TMask
|
|||||||
static bool handle_sheet_giac_valgiac(TMask_field &, KEY); // handler
|
static bool handle_sheet_giac_valgiac(TMask_field &, KEY); // handler
|
||||||
static bool handle_sheet_stomag_stoval(TMask_field &, KEY); // handler
|
static bool handle_sheet_stomag_stoval(TMask_field &, KEY); // handler
|
||||||
static bool handle_autoinsert_livgiac(TMask_field &, KEY); // handler del campo
|
static bool handle_autoinsert_livgiac(TMask_field &, KEY); // handler del campo
|
||||||
static bool handle_classdog2(TMask_field&, KEY); // handler del secondo sottocampo della classe doganale
|
|
||||||
|
|
||||||
static void sheetgiac_get(TSheet_field &fld_righe, int item);
|
static void sheetgiac_get(TSheet_field &fld_righe, int item);
|
||||||
static void sheetgiac_put(TSheet_field &fld_righe, int item);
|
static void sheetgiac_put(TSheet_field &fld_righe, int item);
|
||||||
@ -327,8 +325,6 @@ void TMask_anamag::set_parametered_fields()
|
|||||||
set_handler(F_STOANNO, handle_stoanno);
|
set_handler(F_STOANNO, handle_stoanno);
|
||||||
}
|
}
|
||||||
|
|
||||||
set_handler(F_CLASSDOG2, handle_classdog2);
|
|
||||||
|
|
||||||
// setta i campi della maschera per la pagina giacenze
|
// setta i campi della maschera per la pagina giacenze
|
||||||
TSheet_field &fld_stomag = sfield(F_SHEETSTOMAG);
|
TSheet_field &fld_stomag = sfield(F_SHEETSTOMAG);
|
||||||
TSheet_field &fld_giac = sfield(F_SHEETGIAC);
|
TSheet_field &fld_giac = sfield(F_SHEETGIAC);
|
||||||
@ -1191,18 +1187,6 @@ bool TMask_anamag::handle_sheetgiac(TMask_field &fld, KEY k)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TMask_anamag::handle_classdog2(TMask_field& f, KEY k)
|
|
||||||
{
|
|
||||||
if (f.to_check(k))
|
|
||||||
{
|
|
||||||
TString8 str; str << atoi(f.get());
|
|
||||||
if (str.len() < f.size())
|
|
||||||
str.right_just(f.size(), '0');
|
|
||||||
f.set(str);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int TMask_anamag::add_totali_storico(TString & codmag)
|
int TMask_anamag::add_totali_storico(TString & codmag)
|
||||||
{
|
{
|
||||||
TSheet_field &s =(TSheet_field &)field(F_SHEETSTOMAG);
|
TSheet_field &s =(TSheet_field &)field(F_SHEETSTOMAG);
|
||||||
@ -1851,6 +1835,7 @@ bool TAnagrafica_magazzino::user_create()
|
|||||||
open_files(LF_TAB, LF_TABCOM, LF_ANAMAG, LF_MAG, LF_STOMAG,
|
open_files(LF_TAB, LF_TABCOM, LF_ANAMAG, LF_MAG, LF_STOMAG,
|
||||||
LF_UMART, LF_CODCORR, LF_DESLIN, LF_DIST, LF_RDIST, LF_RMOVMAG,
|
LF_UMART, LF_CODCORR, LF_DESLIN, LF_DIST, LF_RDIST, LF_RMOVMAG,
|
||||||
LF_CLIFO, LF_PCON, 0);
|
LF_CLIFO, LF_PCON, 0);
|
||||||
|
|
||||||
// crea l'oggetto per i parametri di livello giacenza
|
// crea l'oggetto per i parametri di livello giacenza
|
||||||
// apre la maschera e dispone gli sheet
|
// apre la maschera e dispone gli sheet
|
||||||
_rel= new TRelation(LF_ANAMAG);
|
_rel= new TRelation(LF_ANAMAG);
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#define F_DESCRV 138
|
#define F_DESCRV 138
|
||||||
#define F_UMP 139
|
#define F_UMP 139
|
||||||
#define F_PESO 140
|
#define F_PESO 140
|
||||||
#define F_CLASSDOG1 141
|
#define F_CLASSDOG 141
|
||||||
#define F_CLASSDOGD 142
|
#define F_CLASSDOGD 142
|
||||||
#define F_UBICAZIONE 143
|
#define F_UBICAZIONE 143
|
||||||
#define F_UBICAZIONE1 144
|
#define F_UBICAZIONE1 144
|
||||||
@ -143,8 +143,6 @@
|
|||||||
#define F_CONVET 286
|
#define F_CONVET 286
|
||||||
#define F_VALSTATUN 287
|
#define F_VALSTATUN 287
|
||||||
#define F_PAESEOR 288
|
#define F_PAESEOR 288
|
||||||
#define F_CLASSDOG2 289
|
|
||||||
#define F_CLASSDOG3 290
|
|
||||||
|
|
||||||
#define F_NUMREGULC1 300
|
#define F_NUMREGULC1 300
|
||||||
#define F_NUMRIGULC1 301
|
#define F_NUMRIGULC1 301
|
||||||
|
@ -487,7 +487,7 @@ END
|
|||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
PAGE "Unita'" 0 2 0 0
|
PAGE "Unità" 0 2 0 0
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 78 3
|
GROUPBOX DLG_NULL 78 3
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -509,12 +509,12 @@ END
|
|||||||
|
|
||||||
TEXT DLG_NULL
|
TEXT DLG_NULL
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 3 "@bUnita' di misura"
|
PROMPT 1 3 "@bUnità di misura"
|
||||||
END
|
END
|
||||||
|
|
||||||
SPREADSHEET F_SHEETUM 76 4
|
SPREADSHEET F_SHEETUM 76 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 4 "Unita' di misura "
|
PROMPT 1 4 "Unità di misura "
|
||||||
FLAGS "A"
|
FLAGS "A"
|
||||||
USE LF_UMART KEY NRIGA
|
USE LF_UMART KEY NRIGA
|
||||||
INPUT CODART F_CODART
|
INPUT CODART F_CODART
|
||||||
@ -839,63 +839,38 @@ BEGIN
|
|||||||
CHECKTYPE NORMAL
|
CHECKTYPE NORMAL
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER F_CLASSDOG1 4
|
NUMBER F_CLASSDOG 8
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 8 "Nomenclatura combin. "
|
PROMPT 1 8 "Nomenclatura combinata "
|
||||||
FIELD CLASSDOG[1,4]
|
FIELD CLASSDOG
|
||||||
FLAG "Z"
|
|
||||||
USE %NOC
|
USE %NOC
|
||||||
INPUT CODTAB[1,4] F_CLASSDOG1
|
INPUT CODTAB F_CLASSDOG
|
||||||
INPUT CODTAB[5,6] F_CLASSDOG2
|
DISPLAY "Codice@4" CODTAB[1,4]
|
||||||
INPUT CODTAB[7,8] F_CLASSDOG3
|
DISPLAY " @2" CODTAB[5,6]
|
||||||
DISPLAY "Codice 1" CODTAB[1,4]
|
DISPLAY " @2" CODTAB[7,8]
|
||||||
DISPLAY "@3" CODTAB[5,6]
|
|
||||||
DISPLAY "@3" CODTAB[7,8]
|
|
||||||
DISPLAY "Descrizione@50" S0
|
DISPLAY "Descrizione@50" S0
|
||||||
OUTPUT F_CLASSDOG1 CODTAB[1,4]
|
OUTPUT F_CLASSDOG CODTAB
|
||||||
OUTPUT F_CLASSDOG2 CODTAB[5,6]
|
|
||||||
OUTPUT F_CLASSDOG3 CODTAB[7,8]
|
|
||||||
OUTPUT F_CLASSDOGD S0
|
OUTPUT F_CLASSDOGD S0
|
||||||
VALIDATE REQIF_FUNC 1 F_CLASSDOG2
|
CHECKTYPE NORMAL
|
||||||
MESSAGE DIRTY,F_CLASSDOG3
|
VALIDATE FIXLEN_FUNC 8
|
||||||
WARNING "Nomenclatura combinata assente"
|
WARNING "Nomenclatura combinata assente"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_CLASSDOG2 2
|
STRING F_CLASSDOGD 50 41
|
||||||
BEGIN
|
|
||||||
PROMPT 30 8 ""
|
|
||||||
FIELD CLASSDOG[5,6]
|
|
||||||
COPY ALL F_CLASSDOG1
|
|
||||||
VALIDATE REQIF_FUNC 1 F_CLASSDOG2
|
|
||||||
MESSAGE DIRTY,F_CLASSDOG3
|
|
||||||
WARNING "Nomenclatura combinata assente"
|
|
||||||
END
|
|
||||||
|
|
||||||
NUMBER F_CLASSDOG3 2
|
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 35 8 ""
|
PROMPT 35 8 ""
|
||||||
FIELD CLASSDOG[7,8]
|
|
||||||
FLAG "Z"
|
|
||||||
COPY ALL F_CLASSDOG1
|
|
||||||
CHECKTYPE NORMAL
|
|
||||||
WARNING "Nomenclatura combinata assente"
|
|
||||||
END
|
|
||||||
|
|
||||||
STRING F_CLASSDOGD 37
|
|
||||||
BEGIN
|
|
||||||
PROMPT 40 8 ""
|
|
||||||
FLAG "D"
|
FLAG "D"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_PROVOR 2
|
STRING F_PROVOR 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 9 "Provincia di origine "
|
PROMPT 1 9 "Provincia di origine (INTRA) "
|
||||||
FIELD LF_ANAMAG->PROV
|
FIELD LF_ANAMAG->PROV
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_PAESEOR 2
|
STRING F_PAESEOR 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 50 9 "Paese di origine "
|
PROMPT 49 9 "Paese di origine (INTRA) "
|
||||||
FIELD LF_ANAMAG->PAESE
|
FIELD LF_ANAMAG->PAESE
|
||||||
END
|
END
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ END
|
|||||||
|
|
||||||
STRING FS_CODUMCORR 2
|
STRING FS_CODUMCORR 2
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 6 "Unita' di misura "
|
PROMPT 2 6 "Unità di misura "
|
||||||
FIELD UM
|
FIELD UM
|
||||||
FLAG "U"
|
FLAG "U"
|
||||||
USE %UMS
|
USE %UMS
|
||||||
@ -40,7 +40,7 @@ END
|
|||||||
//Livelli giacenza
|
//Livelli giacenza
|
||||||
STRING FS_LIV1 10
|
STRING FS_LIV1 10
|
||||||
BEGIN
|
BEGIN
|
||||||
// Non mettere FLAGS "D" perchè disabiliterebbe tutta la colonna
|
// Non mettere FLAGS "D" perché disabiliterebbe tutta la colonna
|
||||||
FLAGS "U"
|
FLAGS "U"
|
||||||
PROMPT 2 8 "Livello 1 "
|
PROMPT 2 8 "Livello 1 "
|
||||||
USE GCG
|
USE GCG
|
||||||
|
@ -1102,11 +1102,6 @@ void TGestione_listini_semplice::init_modify_mode(TMask& m)
|
|||||||
|
|
||||||
bool TGestione_listini_semplice::user_create()
|
bool TGestione_listini_semplice::user_create()
|
||||||
{
|
{
|
||||||
/* 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!")); */
|
|
||||||
|
|
||||||
//decide il tipo di condizione di vendita: 'L'istino, 'C'ontratto, 'O'fferta
|
//decide il tipo di condizione di vendita: 'L'istino, 'C'ontratto, 'O'fferta
|
||||||
_tipo = 'L';
|
_tipo = 'L';
|
||||||
_codice = 0L;
|
_codice = 0L;
|
||||||
@ -1135,11 +1130,10 @@ bool TGestione_listini_semplice::user_create()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_codice > 0 && _tipo < 'C')
|
if (_codice > 0 && _tipo < 'C')
|
||||||
_tipo = 'C';
|
_tipo = 'C'; // Se c'è il cliente deve essere un contratto
|
||||||
else
|
else
|
||||||
_tipo = toupper(_tipo);
|
_tipo = toupper(_tipo);
|
||||||
}
|
}
|
||||||
|
|
||||||
_rel = new TRelation(LF_CONDV);
|
_rel = new TRelation(LF_CONDV);
|
||||||
|
|
||||||
//attenzione!! questo è il parametro per avere la lunghezza del numero riga sullo sheet
|
//attenzione!! questo è il parametro per avere la lunghezza del numero riga sullo sheet
|
||||||
|
@ -64,9 +64,6 @@ void TRicarico_listini_mask::save()
|
|||||||
TProgind pi(s.items(), TR("Salvataggio modifiche"), false, true);
|
TProgind pi(s.items(), TR("Salvataggio modifiche"), false, true);
|
||||||
FOR_EACH_SHEET_ROW(s, r, row) if (_dirty[r])
|
FOR_EACH_SHEET_ROW(s, r, row) if (_dirty[r])
|
||||||
{
|
{
|
||||||
if (!pi.setstatus(r))
|
|
||||||
break;
|
|
||||||
|
|
||||||
const TString80 codart = row->get(s.cid2index(F_CODART));
|
const TString80 codart = row->get(s.cid2index(F_CODART));
|
||||||
const real sconto = row->get(s.cid2index(F_SCONTO));
|
const real sconto = row->get(s.cid2index(F_SCONTO));
|
||||||
const real costo = row->get(s.cid2index(F_COSTO));
|
const real costo = row->get(s.cid2index(F_COSTO));
|
||||||
@ -104,6 +101,51 @@ void TRicarico_listini_mask::save()
|
|||||||
rcondv.rewrite();
|
rcondv.rewrite();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* cod = "FGDI";
|
||||||
|
TLocalisamfile deslin(LF_DESLIN); deslin.setkey(2);
|
||||||
|
for (int lingua = 0; cod[lingua]; lingua++)
|
||||||
|
{
|
||||||
|
TString desc = row->get(s.cid2index(F_DESCFRA+lingua));
|
||||||
|
if (desc.full())
|
||||||
|
{
|
||||||
|
desc.trim();
|
||||||
|
deslin.zero();
|
||||||
|
deslin.put("CODART", codart);
|
||||||
|
deslin.put("CODLIN", cod[lingua]);
|
||||||
|
if (deslin.read() == NOERR)
|
||||||
|
{
|
||||||
|
if (deslin.get("DESCR") != desc)
|
||||||
|
{
|
||||||
|
deslin.put("DESCR", desc);
|
||||||
|
deslin.rewrite();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TISAM_recordset rsdeslin("USE DESLIN\nFROM CODART=#ART\nTO CODART=#ART");
|
||||||
|
rsdeslin.set_var("#ART", codart);
|
||||||
|
int nriga = 1;
|
||||||
|
if (rsdeslin.move_last())
|
||||||
|
nriga += rsdeslin.get("NRIGA").as_int();
|
||||||
|
deslin.zero();
|
||||||
|
deslin.put("CODART", codart);
|
||||||
|
deslin.put("NRIGA", nriga);
|
||||||
|
deslin.put("CODLIN", cod[lingua]);
|
||||||
|
deslin.put("DESCR", desc);
|
||||||
|
const int err = deslin.write();
|
||||||
|
if (err != NOERR)
|
||||||
|
{
|
||||||
|
TString msg;
|
||||||
|
msg << TR("Descrizione in lingua ") << cod[lingua] << TR(" articolo ") << codart;
|
||||||
|
cantwrite_box(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pi.setstatus(r+1))
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
_dirty.reset();
|
_dirty.reset();
|
||||||
disable(DLG_SAVEREC);
|
disable(DLG_SAVEREC);
|
||||||
@ -198,21 +240,24 @@ void TRicarico_listini_mask::load()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const TString& codart = sm.get(F_CODART);
|
const TString& codart = sm.get(F_CODART);
|
||||||
const char cod[4] = "FGD";
|
const char* cod = "FGDI";
|
||||||
for (int lingua = 0; lingua < 3; lingua++)
|
for (int lingua = 0; cod[lingua]; lingua++)
|
||||||
{
|
{
|
||||||
|
deslin.zero();
|
||||||
deslin.put("CODART", codart);
|
deslin.put("CODART", codart);
|
||||||
deslin.put("CODLIN", cod[lingua]);
|
deslin.put("CODLIN", cod[lingua]);
|
||||||
if (deslin.read() == NOERR)
|
if (deslin.read() == NOERR)
|
||||||
sm.set(F_DESCFRA+lingua, deslin.get("DESCR"));
|
sm.set(F_DESCFRA+lingua, deslin.get("DESCR"));
|
||||||
|
else
|
||||||
|
sm.reset(F_DESCFRA+lingua);
|
||||||
}
|
}
|
||||||
|
|
||||||
TToken_string& r = s.row(-1);
|
TToken_string& r = s.row(-1);
|
||||||
if (r.empty()) // Dummy test
|
if (r.empty_items()) // Dummy test
|
||||||
{
|
{
|
||||||
sm.field(F_RICARICO).on_hit();
|
sm.efield(F_RICARICO).on_hit();
|
||||||
sm.field(F_OLDPRICE).on_hit();
|
sm.efield(F_OLDPRICE).on_hit();
|
||||||
sm.field(F_NEWPRICE).on_hit();
|
sm.efield(F_NEWPRICE).on_hit();
|
||||||
FOR_EACH_MASK_FIELD(sm, i, f)
|
FOR_EACH_MASK_FIELD(sm, i, f)
|
||||||
{
|
{
|
||||||
const short id = f->dlg();
|
const short id = f->dlg();
|
||||||
@ -541,12 +586,10 @@ class TRicarico_listini : public TSkeleton_application
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
virtual bool create();
|
virtual bool create();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void main_loop();
|
virtual void main_loop();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void TRicarico_listini::main_loop()
|
void TRicarico_listini::main_loop()
|
||||||
{
|
{
|
||||||
TRicarico_listini_mask mask;
|
TRicarico_listini_mask mask;
|
||||||
@ -555,9 +598,11 @@ void TRicarico_listini::main_loop()
|
|||||||
|
|
||||||
bool TRicarico_listini::create()
|
bool TRicarico_listini::create()
|
||||||
{
|
{
|
||||||
|
#ifndef DBG
|
||||||
Tdninst dninst;
|
Tdninst dninst;
|
||||||
if (!dninst.can_I_run(true))
|
if (!dninst.can_I_run(true))
|
||||||
return error_box(TR("Programma personalizzato non autorizzato!"));
|
return cantaccess_box(title());
|
||||||
|
#endif
|
||||||
TSheet_field::set_line_number_width(4);
|
TSheet_field::set_line_number_width(4);
|
||||||
return TSkeleton_application::create();
|
return TSkeleton_application::create();
|
||||||
}
|
}
|
||||||
|
@ -25,4 +25,5 @@
|
|||||||
#define F_DESCFRA 112
|
#define F_DESCFRA 112
|
||||||
#define F_DESCENG 113
|
#define F_DESCENG 113
|
||||||
#define F_DESCDEU 114
|
#define F_DESCDEU 114
|
||||||
#define F_CODARTALT 115
|
#define F_DESCITA 115
|
||||||
|
#define F_CODARTALT 116
|
||||||
|
@ -175,6 +175,7 @@ BEGIN
|
|||||||
ITEM "Descrizione\nFrancese@30"
|
ITEM "Descrizione\nFrancese@30"
|
||||||
ITEM "Descrizione\nInglese@30"
|
ITEM "Descrizione\nInglese@30"
|
||||||
ITEM "Descrizione\nTedesco@30"
|
ITEM "Descrizione\nTedesco@30"
|
||||||
|
ITEM "Descrizione\nItaliano@30"
|
||||||
ITEM "Replaced by@20"
|
ITEM "Replaced by@20"
|
||||||
END
|
END
|
||||||
|
|
||||||
@ -183,7 +184,7 @@ ENDPAGE
|
|||||||
ENDMASK
|
ENDMASK
|
||||||
|
|
||||||
// maschera di riga sheet
|
// maschera di riga sheet
|
||||||
PAGE "Riga aggiornamento listini" -1 -1 66 12
|
PAGE "Riga aggiornamento listini" -1 -1 66 13
|
||||||
|
|
||||||
STRING F_CODART 20
|
STRING F_CODART 20
|
||||||
BEGIN
|
BEGIN
|
||||||
@ -293,20 +294,22 @@ END
|
|||||||
STRING F_DESCFRA 50
|
STRING F_DESCFRA 50
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 9 "Descr. FRA "
|
PROMPT 1 9 "Descr. FRA "
|
||||||
FLAGS "D"
|
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_DESCENG 50
|
STRING F_DESCENG 50
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 10 "Descr. ENG "
|
PROMPT 1 10 "Descr. ENG "
|
||||||
FLAGS "D"
|
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_DESCDEU 50
|
STRING F_DESCDEU 50
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 11 "Descr. DEU "
|
PROMPT 1 11 "Descr. DEU "
|
||||||
FLAGS "D"
|
END
|
||||||
EN
|
|
||||||
|
STRING F_DESCITA 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 12 "Descr. ITA "
|
||||||
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
|
@ -606,15 +606,15 @@ void TStatistiche_ve::elabora(const TMask& mask) const
|
|||||||
if (righe_items > 0)
|
if (righe_items > 0)
|
||||||
{
|
{
|
||||||
//E crea pure la progind..
|
//E crea pure la progind..
|
||||||
TProgind pi(righe_items, TR("Generazione file statistiche..."), true, true);
|
TProgress_monitor pi(righe_items, TR("Generazione file statistiche..."));
|
||||||
|
|
||||||
//Scansione del recordset trovato
|
//Scansione del recordset trovato
|
||||||
for (bool ok = righe.move_first(); ok; ok = righe.move_next())
|
for (bool ok = righe.move_first(); ok; ok = righe.move_next())
|
||||||
{
|
{
|
||||||
if (!pi.addstatus(1))
|
|
||||||
break;
|
|
||||||
//scrive sul CSV i campi che servono al file di excel e al report
|
//scrive sul CSV i campi che servono al file di excel e al report
|
||||||
csv->aggiungi_riga(righe, tipo_dati, tipo_stat, tipo_dettaglio);
|
csv->aggiungi_riga(righe, tipo_dati, tipo_stat, tipo_dettaglio);
|
||||||
|
if (!pi.add_status())
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//aggiorna le colonne delle percentuali
|
//aggiorna le colonne delle percentuali
|
||||||
@ -696,16 +696,13 @@ void TStatistiche_ve::elabora(const TMask& mask) const
|
|||||||
void TStatistiche_ve::main_loop()
|
void TStatistiche_ve::main_loop()
|
||||||
{
|
{
|
||||||
TStatistiche_ve_mask mask;
|
TStatistiche_ve_mask mask;
|
||||||
|
|
||||||
while (mask.run() == K_ENTER)
|
while (mask.run() == K_ENTER)
|
||||||
{
|
|
||||||
elabora(mask);
|
elabora(mask);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool TStatistiche_ve::create()
|
bool TStatistiche_ve::create()
|
||||||
{
|
{
|
||||||
//controlla se la chiave ha l'autorizzazione a questo programma
|
//controlla se la chiave ha l'autorizzazione per questo programma
|
||||||
Tdninst dninst;
|
Tdninst dninst;
|
||||||
if (!dninst.can_I_run(true))
|
if (!dninst.can_I_run(true))
|
||||||
return error_box(TR("Programma non autorizzato!"));
|
return error_box(TR("Programma non autorizzato!"));
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
#include <applicat.h>
|
|
||||||
#include <dongle.h>
|
#include <dongle.h>
|
||||||
#include <utility.h>
|
|
||||||
|
|
||||||
#include "velib07.h"
|
|
||||||
#include "../ba/ba8500.h"
|
#include "../ba/ba8500.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
@ -971,7 +971,7 @@ bool TRicalcolo_mask::elabora()
|
|||||||
}
|
}
|
||||||
TToken_string& key_expr = get_key_expr(cur.key());
|
TToken_string& key_expr = get_key_expr(cur.key());
|
||||||
|
|
||||||
TLog_report vw(TR("Ricalcolo valori"));
|
TLog_report vw(main_app().title());
|
||||||
|
|
||||||
TTable_expression::set_relation(cur.relation());
|
TTable_expression::set_relation(cur.relation());
|
||||||
TTable_expression::set_window(&vw);
|
TTable_expression::set_window(&vw);
|
||||||
|
@ -107,7 +107,7 @@ void TStatus_change::main_loop()
|
|||||||
msg.add_plural(total, TR("documento"));
|
msg.add_plural(total, TR("documento"));
|
||||||
if (yesno_box(msg))
|
if (yesno_box(msg))
|
||||||
{
|
{
|
||||||
TProgress_monitor pi(total, name());
|
TProgress_monitor pi(total, title());
|
||||||
const TString& finale = m.get(F_FINALE);
|
const TString& finale = m.get(F_FINALE);
|
||||||
TDocumento* doc = new TDocumento;
|
TDocumento* doc = new TDocumento;
|
||||||
rel.lfile().set_curr(doc);
|
rel.lfile().set_curr(doc);
|
||||||
|
@ -107,16 +107,17 @@ BEGIN
|
|||||||
PROMPT 2 10 "Da "
|
PROMPT 2 10 "Da "
|
||||||
USE LF_DOC SELECT STATO==#F_INIZIALE
|
USE LF_DOC SELECT STATO==#F_INIZIALE
|
||||||
JOIN LF_CLIFO INTO TIPOCF==TIPOCF CODCF==CODCF
|
JOIN LF_CLIFO INTO TIPOCF==TIPOCF CODCF==CODCF
|
||||||
INPUT ANNO F_ANNO SELECT
|
|
||||||
INPUT PROVV F_PROVVIS SELECT
|
INPUT PROVV F_PROVVIS SELECT
|
||||||
|
INPUT ANNO F_ANNO SELECT
|
||||||
INPUT CODNUM F_CODNUM SELECT
|
INPUT CODNUM F_CODNUM SELECT
|
||||||
INPUT NDOC F_DANUMERO
|
INPUT NDOC F_DANUMERO
|
||||||
DISPLAY "Num." CODNUM
|
|
||||||
DISPLAY "Anno" ANNO
|
|
||||||
DISPLAY "Provv" PROVV
|
DISPLAY "Provv" PROVV
|
||||||
|
DISPLAY "Anno" ANNO
|
||||||
|
DISPLAY "Num." CODNUM
|
||||||
DISPLAY "Tipo" TIPODOC
|
DISPLAY "Tipo" TIPODOC
|
||||||
DISPLAY "N.Doc. " NDOC
|
DISPLAY "N.Doc. " NDOC
|
||||||
DISPLAY "Data Doc. " DATADOC
|
DISPLAY "Data Doc. " DATADOC
|
||||||
|
DISPLAY "Stato" STATO
|
||||||
DISPLAY "Ragione Sociale@50" LF_CLIFO->RAGSOC
|
DISPLAY "Ragione Sociale@50" LF_CLIFO->RAGSOC
|
||||||
OUTPUT F_DANUMERO NDOC
|
OUTPUT F_DANUMERO NDOC
|
||||||
CHECKTYPE SEARCH
|
CHECKTYPE SEARCH
|
||||||
|
@ -23,7 +23,7 @@ public:
|
|||||||
|
|
||||||
TArchive_mask::TArchive_mask() : TMask("ve5400")
|
TArchive_mask::TArchive_mask() : TMask("ve5400")
|
||||||
{
|
{
|
||||||
TList_field& lf = (TList_field&)field(F_DRIVE);
|
TList_field& lf = lfield(F_DRIVE);
|
||||||
TToken_string codes, values;
|
TToken_string codes, values;
|
||||||
TString4 str;
|
TString4 str;
|
||||||
int k = 0;
|
int k = 0;
|
||||||
@ -51,7 +51,6 @@ TArchive_mask::TArchive_mask() : TMask("ve5400")
|
|||||||
//-------APPLICAZIONE-----------------------------
|
//-------APPLICAZIONE-----------------------------
|
||||||
class TArchive_doc : public TSkeleton_application
|
class TArchive_doc : public TSkeleton_application
|
||||||
{
|
{
|
||||||
TArray _file;
|
|
||||||
TIsamtempfile *_tdoc; //dichiaro un puntatore al file documenti (non posso dichiarare un file)
|
TIsamtempfile *_tdoc; //dichiaro un puntatore al file documenti (non posso dichiarare un file)
|
||||||
TIsamtempfile *_trdoc; // righe documenti
|
TIsamtempfile *_trdoc; // righe documenti
|
||||||
TIsamtempfile *_trcf; // clienti/ fornitori
|
TIsamtempfile *_trcf; // clienti/ fornitori
|
||||||
@ -63,12 +62,11 @@ class TArchive_doc : public TSkeleton_application
|
|||||||
|
|
||||||
protected: // TSkeleton_application
|
protected: // TSkeleton_application
|
||||||
virtual void main_loop();
|
virtual void main_loop();
|
||||||
void open_files(int logicnum, ...);
|
|
||||||
virtual bool create();
|
virtual bool create();
|
||||||
void create_tmp_files(bool create);
|
void create_tmp_files(bool create);
|
||||||
void delete_tmp_files(bool remove);
|
void delete_tmp_files(bool remove);
|
||||||
void archivia(const TMask& m);
|
void archivia(const TMask& m);
|
||||||
void ripristina(const TMask& m);
|
bool ripristina(const TMask& m);
|
||||||
|
|
||||||
bool restore_file(TIsamtempfile& src, bool update);
|
bool restore_file(TIsamtempfile& src, bool update);
|
||||||
bool restore_clifo(bool update);
|
bool restore_clifo(bool update);
|
||||||
@ -76,26 +74,13 @@ protected: // T
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
TArchive_doc() { }
|
TArchive_doc() { }
|
||||||
virtual ~TArchive_doc() { }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void TArchive_doc::open_files(int logicnum, ...)
|
|
||||||
{
|
|
||||||
va_list marker;
|
|
||||||
va_start(marker, logicnum);
|
|
||||||
while (logicnum > 0)
|
|
||||||
{
|
|
||||||
CHECKD(_file.objptr(logicnum) == NULL, "File gia' aperto: ", logicnum);
|
|
||||||
_file.add(new TLocalisamfile(logicnum), logicnum);
|
|
||||||
logicnum = va_arg(marker, int);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TArchive_doc::create()
|
bool TArchive_doc::create()
|
||||||
{
|
{
|
||||||
open_files(LF_TABCOM, LF_TAB, LF_CLIFO, LF_OCCAS, LF_INDSP, LF_CFVEN,
|
/* open_files(LF_TABCOM, LF_TAB, LF_CLIFO, LF_OCCAS, LF_INDSP, LF_CFVEN,
|
||||||
LF_DOC, LF_RIGHEDOC, LF_ANAMAG, LF_MOVMAG, LF_RMOVMAG, LF_CONDV,
|
LF_DOC, LF_RIGHEDOC, LF_ANAMAG, LF_MOVMAG, LF_RMOVMAG, LF_CONDV,
|
||||||
LF_SVRIEP, LF_AGENTI, LF_PERCPROV, LF_CESS, 0);
|
LF_SVRIEP, LF_AGENTI, LF_PERCPROV, LF_CESS, 0);*/
|
||||||
_tmp_dir.temp();
|
_tmp_dir.temp();
|
||||||
_tmp_dir = _tmp_dir.path();
|
_tmp_dir = _tmp_dir.path();
|
||||||
_tmp_dir << "VE";
|
_tmp_dir << "VE";
|
||||||
@ -217,7 +202,8 @@ void TArchive_doc::archivia(const TMask& m)
|
|||||||
|
|
||||||
delete_tmp_files(false); //chiude i files temp in modo da risparmiare memoria
|
delete_tmp_files(false); //chiude i files temp in modo da risparmiare memoria
|
||||||
|
|
||||||
const char * dir = &_tmp_dir[1]; //fa puntare dir alla directory temp
|
const char* dir = _tmp_dir; //fa puntare dir alla directory temp
|
||||||
|
if (*dir == '%') dir++;
|
||||||
bool rt = _arc.backup(dir,_unit,_desc, TRUE); //esegue la compressione ed il salvataggio sul device scelto
|
bool rt = _arc.backup(dir,_unit,_desc, TRUE); //esegue la compressione ed il salvataggio sul device scelto
|
||||||
create_tmp_files(false); //apre i files temp, riallocandoli (NON li crea effettvam.)
|
create_tmp_files(false); //apre i files temp, riallocandoli (NON li crea effettvam.)
|
||||||
delete_tmp_files(true); //cancella fisicamente i files temp
|
delete_tmp_files(true); //cancella fisicamente i files temp
|
||||||
@ -250,16 +236,10 @@ bool TArchive_doc::restore_file(TIsamtempfile& src, bool update)
|
|||||||
TProgress_monitor pi(src.items(), msg);
|
TProgress_monitor pi(src.items(), msg);
|
||||||
for (int err = src.first(); err == NOERR; err = src.next())
|
for (int err = src.first(); err == NOERR; err = src.next())
|
||||||
{
|
{
|
||||||
err = src.curr().write(dst);
|
dst.curr() = src.curr();
|
||||||
if (err == _isreinsert)
|
err = dst.write_rewrite();
|
||||||
{
|
|
||||||
if (update)
|
|
||||||
err = src.curr().rewrite(dst);
|
|
||||||
else
|
|
||||||
err = NOERR;
|
|
||||||
}
|
|
||||||
if (err != NOERR)
|
if (err != NOERR)
|
||||||
return cantwrite_box(src.description());
|
return cantwrite_box(dst.description());
|
||||||
if (!pi.add_status(1))
|
if (!pi.add_status(1))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -283,7 +263,7 @@ bool TArchive_doc::restore_docs()
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TArchive_doc::ripristina(const TMask& m)
|
bool TArchive_doc::ripristina(const TMask& m)
|
||||||
{
|
{
|
||||||
_unit = m.get(F_DRIVE)[0];
|
_unit = m.get(F_DRIVE)[0];
|
||||||
_path = m.get(F_PATH);
|
_path = m.get(F_PATH);
|
||||||
@ -293,12 +273,15 @@ void TArchive_doc::ripristina(const TMask& m)
|
|||||||
if (!xvt_fsys_is_removable_drive(src) && _path.full())
|
if (!xvt_fsys_is_removable_drive(src) && _path.full())
|
||||||
src.add(_path);
|
src.add(_path);
|
||||||
src.add("ve.z00");
|
src.add("ve.z00");
|
||||||
|
if (!src.exist())
|
||||||
|
return cantread_box(src);
|
||||||
|
|
||||||
|
const char* dst = _tmp_dir;
|
||||||
|
if (*dst == '%') dst++;
|
||||||
|
|
||||||
const char* dst = & _tmp_dir[1];
|
|
||||||
if (::aga_unzip(src, dst))
|
if (::aga_unzip(src, dst))
|
||||||
{
|
{
|
||||||
create_tmp_files(FALSE); // In realta' ci sono gia'
|
create_tmp_files(false); // In realta' ci sono gia'
|
||||||
|
|
||||||
if (m.get_bool(F_WITHCLI))
|
if (m.get_bool(F_WITHCLI))
|
||||||
restore_clifo(m.get_bool(F_UPDATE));
|
restore_clifo(m.get_bool(F_UPDATE));
|
||||||
restore_docs();
|
restore_docs();
|
||||||
@ -306,7 +289,8 @@ void TArchive_doc::ripristina(const TMask& m)
|
|||||||
delete_tmp_files(true); // Removes temp files!
|
delete_tmp_files(true); // Removes temp files!
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
error_box(TR("Errore nella scompattazione dei file. Nessun documento ricevuto."));
|
return error_box(TR("Errore nella scompattazione dei file. Nessun documento ricevuto."));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,15 +68,15 @@ void TFatturazione_bolle_app::process_by_cli(const TMask& m)
|
|||||||
const long dn = m.get_long(F_NUMERO_DOCUMENTO_DA);
|
const long dn = m.get_long(F_NUMERO_DOCUMENTO_DA);
|
||||||
const long an = m.get_long(F_NUMERO_DOCUMENTO_A);
|
const long an = m.get_long(F_NUMERO_DOCUMENTO_A);
|
||||||
|
|
||||||
TElaborazione * e = elab(m.get(F_CODICE_ELAB));
|
TElaborazione& eld = *elab(m.get(F_CODICE_ELAB));
|
||||||
TElaborazione & eld = *e;
|
|
||||||
TToken_string tipidoc(24), statidoc(10);
|
TToken_string tipidoc(24), statidoc(10);
|
||||||
eld.tipi_stati_iniziali(tipidoc, statidoc);
|
eld.tipi_stati_iniziali(tipidoc, statidoc);
|
||||||
|
|
||||||
TTipo_documento t(eld.tipo_iniziale(0));
|
TTipo_documento t(eld.tipo_iniziale(0));
|
||||||
char tipocf(t.tipocf());
|
char tipocf(t.tipocf());
|
||||||
TLista_cf clienti(tipocf);
|
TLista_cf clienti(tipocf);
|
||||||
const int tot_cli = clienti.leggi(dc, ac, da, aa, dz, az);
|
|
||||||
|
const int tot_cli = clienti.leggi_doc(eld, dd, ad, dc, ac, da, aa, dz, az);
|
||||||
|
|
||||||
TString msg(80);
|
TString msg(80);
|
||||||
iw.set_max(tot_cli);
|
iw.set_max(tot_cli);
|
||||||
@ -102,7 +102,7 @@ void TFatturazione_bolle_app::process_by_cli(const TMask& m)
|
|||||||
if (!iw.add_status())
|
if (!iw.add_status())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
delete e;
|
delete &eld;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFatturazione_bolle_app::process_by_ragsoc(const TMask& m)
|
void TFatturazione_bolle_app::process_by_ragsoc(const TMask& m)
|
||||||
|
31
ve/velib.h
31
ve/velib.h
@ -230,7 +230,7 @@ class TTipo_documento : public TRectype // velib03
|
|||||||
char _tipocf;
|
char _tipocf;
|
||||||
char _tipocr;
|
char _tipocr;
|
||||||
char _check_qta;
|
char _check_qta;
|
||||||
bool _cnt_prezzi, _show_evaded_lines, _load_cont, _non_evadere, _hca_req, _check_double_art;
|
bool _cnt_prezzi, _show_evaded_lines, _load_cont, _non_evadere, _hca_req, _check_double_art, _ignora_anticipi_fatturazione;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void add_formula_if_needed(TConfig& profile, TString& variable, const char* varname, const char* formula);
|
void add_formula_if_needed(TConfig& profile, TString& variable, const char* varname, const char* formula);
|
||||||
@ -341,12 +341,11 @@ public:
|
|||||||
bool da_evadere() const { return !_non_evadere; }
|
bool da_evadere() const { return !_non_evadere; }
|
||||||
bool head_ca_required() const { return _hca_req; }
|
bool head_ca_required() const { return _hca_req; }
|
||||||
bool check_double_art() const { return _check_double_art; }
|
bool check_double_art() const { return _check_double_art; }
|
||||||
|
bool ignora_anticipi_fatturazione() const { return _ignora_anticipi_fatturazione; }
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const TTipo_documento& cached_tipodoc(const char* tipodoc);
|
const TTipo_documento& cached_tipodoc(const char* tipodoc);
|
||||||
@ -484,7 +483,7 @@ public:
|
|||||||
bool formfeed() const { return get_bool("B0"); }
|
bool formfeed() const { return get_bool("B0"); }
|
||||||
|
|
||||||
TFormula_documento* first_formula() { return succ_formula(true); }
|
TFormula_documento* first_formula() { return succ_formula(true); }
|
||||||
TFormula_documento* succ_formula(bool restart = FALSE);
|
TFormula_documento* succ_formula(bool restart = false);
|
||||||
|
|
||||||
int read(const char* tiporig);
|
int read(const char* tiporig);
|
||||||
void set_defaults(TSheet_field& s, int row) const;
|
void set_defaults(TSheet_field& s, int row) const;
|
||||||
@ -566,7 +565,7 @@ public:
|
|||||||
(is_spese() && !spesa().is_percentuale()) || is_prestazione(); }
|
(is_spese() && !spesa().is_percentuale()) || is_prestazione(); }
|
||||||
bool is_evasa() const; // Ritorna vero se la riga è evasa
|
bool is_evasa() const; // Ritorna vero se la riga è evasa
|
||||||
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).full(); }
|
bool linked() const { return get(RDOC_DACODNUM).full(); }
|
||||||
// @cmember Assegna il documento corrente
|
// @cmember Assegna il documento corrente
|
||||||
void set_doc(TDocumento * doc) { _doc = doc; }
|
void set_doc(TDocumento * doc) { _doc = doc; }
|
||||||
@ -619,9 +618,9 @@ public:
|
|||||||
|
|
||||||
real prezzo(bool scontato, bool lordo, int ndec = AUTO_DECIMALS) const ;
|
real prezzo(bool scontato, bool lordo, int ndec = AUTO_DECIMALS) const ;
|
||||||
real importo(bool scontato , bool lordo, int ndec = AUTO_DECIMALS) const ;
|
real importo(bool scontato , bool lordo, int ndec = AUTO_DECIMALS) const ;
|
||||||
real sconto() const { return importo(FALSE,FALSE) - importo(true,FALSE); }
|
real sconto() const { return importo(false,false) - importo(true,false); }
|
||||||
real iva(int ndec) const;
|
real iva(int ndec) const;
|
||||||
real imponibile(bool lordo = FALSE) const;
|
real imponibile(bool lordo = false) const;
|
||||||
real imponibile_omaggio(int iva_calc_mode = 1) const;
|
real imponibile_omaggio(int iva_calc_mode = 1) const;
|
||||||
real iva_omaggio(int ndec, int iva_calc_mode = 1) const;
|
real iva_omaggio(int ndec, int iva_calc_mode = 1) const;
|
||||||
real imposta(bool round = true) const;
|
real imposta(bool round = true) const;
|
||||||
@ -702,6 +701,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
class TAgente;
|
class TAgente;
|
||||||
|
class TDoc_key;
|
||||||
|
|
||||||
class TDocumento : public TMultiple_rectype // velib03
|
class TDocumento : public TMultiple_rectype // velib03
|
||||||
{
|
{
|
||||||
@ -810,15 +810,14 @@ public:
|
|||||||
int read(const TRectype& rec, word op = _isequal, word lockop = _nolock) { *this = rec; return read(op, lockop); }
|
int read(const TRectype& rec, word op = _isequal, word lockop = _nolock) { *this = rec; return read(op, lockop); }
|
||||||
int read(word op = _isequal, word lockop = _nolock) { TLocalisamfile f(LF_DOC); return read(f, op, lockop);}
|
int read(word op = _isequal, word lockop = _nolock) { TLocalisamfile f(LF_DOC); return read(f, op, lockop);}
|
||||||
|
|
||||||
int write(bool re = FALSE) const { TLocalisamfile f(LF_DOC); return write_rewrite(f, re);}
|
int write(bool re = false) const { TLocalisamfile f(LF_DOC); return write_rewrite(f, re);}
|
||||||
int rewrite() const { return write(true); }
|
int rewrite() const { return write(true); }
|
||||||
int remove() const { TLocalisamfile f(LF_DOC); return remove(f);}
|
int remove() const { TLocalisamfile f(LF_DOC); return remove(f);}
|
||||||
int decimals(bool price = FALSE) const;
|
int decimals(bool price = false) const;
|
||||||
|
|
||||||
void flush_rows();
|
void flush_rows();
|
||||||
|
|
||||||
void calc_provvigione(TProvvigioni_agente & provv, const TString & key, bool first = true, bool generata = true);
|
void calc_provvigione(TProvvigioni_agente & provv, const TString & key, bool first = true, bool generata = true);
|
||||||
|
|
||||||
char tipo_numerazione() const { return get_char(DOC_PROVV); }
|
char tipo_numerazione() const { return get_char(DOC_PROVV); }
|
||||||
int anno() const { return get_int(DOC_ANNO); }
|
int anno() const { return get_int(DOC_ANNO); }
|
||||||
const TString& numerazione() const { return get(DOC_CODNUM); }
|
const TString& numerazione() const { return get(DOC_CODNUM); }
|
||||||
@ -869,8 +868,8 @@ public:
|
|||||||
real spese_incasso(real &imp, int ndec, TTipo_importo netto = _lordo) const ;
|
real spese_incasso(real &imp, int ndec, TTipo_importo netto = _lordo) const ;
|
||||||
real bolli(real & imp, int ndec, TTipo_importo netto = _lordo) const ;
|
real bolli(real & imp, int ndec, TTipo_importo netto = _lordo) const ;
|
||||||
|
|
||||||
real imponibile(bool spese = FALSE, int ndec = AUTO_DECIMALS) const;
|
real imponibile(bool spese = false, int ndec = AUTO_DECIMALS) const;
|
||||||
real imposta(bool spese = FALSE, int ndec = AUTO_DECIMALS) const;
|
real imposta(bool spese = false, int ndec = AUTO_DECIMALS) const;
|
||||||
real totale_doc() const;
|
real totale_doc() const;
|
||||||
real totale_netto() const;
|
real totale_netto() const;
|
||||||
real basesconto() const;
|
real basesconto() const;
|
||||||
@ -881,7 +880,7 @@ public:
|
|||||||
|
|
||||||
TPagamento& pagamento();
|
TPagamento& pagamento();
|
||||||
|
|
||||||
void update_spese_aut(TString_array & spese, bool preserve_old = FALSE, TSheet_field * sh = NULL);
|
void update_spese_aut(TString_array & spese, bool preserve_old = false, TSheet_field * sh = NULL);
|
||||||
real calc_conai_qta(TCONAI_class type);
|
real calc_conai_qta(TCONAI_class type);
|
||||||
void update_conai();
|
void update_conai();
|
||||||
|
|
||||||
@ -895,12 +894,12 @@ public:
|
|||||||
const TString & codesiva() const;
|
const TString & codesiva() const;
|
||||||
void get_protocolli_esenzione(TString & esenzione, TString & data_esenzione,
|
void get_protocolli_esenzione(TString & esenzione, TString & data_esenzione,
|
||||||
TString & registrazione, TString & data_registrazione) const;
|
TString & registrazione, TString & data_registrazione) const;
|
||||||
|
|
||||||
void cli2doc() { clifor().cli2doc(*this); }
|
void cli2doc() { clifor().cli2doc(*this); }
|
||||||
TDocumento ();
|
TDocumento ();
|
||||||
TDocumento (const TDocumento& d);
|
TDocumento (const TDocumento& d);
|
||||||
TDocumento(char provv, int anno, const char* codnum, long numdoc);
|
TDocumento(char provv, int anno, const char* codnum, long numdoc);
|
||||||
TDocumento(const TRectype& doc);
|
TDocumento(const TRectype& doc);
|
||||||
|
TDocumento(const TDoc_key& key);
|
||||||
virtual ~TDocumento();
|
virtual ~TDocumento();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -928,7 +927,7 @@ public:
|
|||||||
|
|
||||||
TCurrency_documento(const TCurrency& cur) { copy(cur); }
|
TCurrency_documento(const TCurrency& cur) { copy(cur); }
|
||||||
TCurrency_documento(const TCurrency_documento& cur) { copy(cur); }
|
TCurrency_documento(const TCurrency_documento& cur) { copy(cur); }
|
||||||
TCurrency_documento(const real& num, const TDocumento &doc, bool price = FALSE);
|
TCurrency_documento(const real& num, const TDocumento &doc, bool price = false);
|
||||||
virtual ~TCurrency_documento() { }
|
virtual ~TCurrency_documento() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1066,7 +1065,7 @@ public:
|
|||||||
static bool anno_handler( TMask_field& f, KEY key);
|
static bool anno_handler( TMask_field& f, KEY key);
|
||||||
static bool num_handler( TMask_field& f, KEY key );
|
static bool num_handler( TMask_field& f, KEY key );
|
||||||
static bool numdocrif_search_handler( TMask_field& f, KEY key );
|
static bool numdocrif_search_handler( TMask_field& f, KEY key );
|
||||||
static bool ragsoc_search_handler( TMask_field& f, KEY key );
|
//static bool ragsoc_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);
|
||||||
static bool liqdiff_handler( TMask_field& f, KEY key );
|
static bool liqdiff_handler( TMask_field& f, KEY key );
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ int TCodice_numerazione::read(const char* codnum)
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// trova le numerazioni documenti in base ai tipi richiesti (ca3800,ca3900,ps1001,ha3800)
|
// trova le numerazioni documenti in base ai tipi richiesti (ca3800,ca3900,ps1001,ha3800)
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
int numerazioni_documenti(TString_array& num_doc, const TString& tipo_doc)
|
int numerazioni_documenti(TString_array& num_doc, const TString& tipo_doc)
|
||||||
{
|
{
|
||||||
//e adesso cerca le numerazioni che contengono tipi ordine
|
//e adesso cerca le numerazioni che contengono tipi ordine
|
||||||
|
@ -944,15 +944,16 @@ real TRiga_documento::calc_conai_qta(TCONAI_class type) const
|
|||||||
const real peso = get_real(weight_name); // Peso unitario imballo
|
const real peso = get_real(weight_name); // Peso unitario imballo
|
||||||
real qta = quantita(); // Quantita' merce
|
real qta = quantita(); // Quantita' merce
|
||||||
if (peso > ZERO && !qta.is_zero()) // Verifica se ha un peso valido
|
if (peso > ZERO && !qta.is_zero()) // Verifica se ha un peso valido
|
||||||
|
{
|
||||||
|
// A volte CODARTMAG è vuoto per cui converte erroneamente la qta in 0 :-(
|
||||||
|
if (is_articolo())
|
||||||
{
|
{
|
||||||
const TString4 um = get(RDOC_UMQTA);
|
const TString4 um = get(RDOC_UMQTA);
|
||||||
TArticolo& art = articolo();
|
TArticolo& art = articolo();
|
||||||
qta = art.convert_to_um(qta, NULL, um); // Converte la quantita nell'unita' base
|
qta = art.convert_to_um(qta, NULL, um); // Converte la quantita nell'unita' base
|
||||||
|
}
|
||||||
kg = qta * peso; // Calcola peso dell'imballo
|
kg = qta * peso; // Calcola peso dell'imballo
|
||||||
kg.round(5);
|
kg.round(5);
|
||||||
/* TString s = kg.string();
|
|
||||||
|
|
||||||
s.trim(); */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1029,14 +1030,14 @@ bool TRiga_documento::doc_dependent() const
|
|||||||
if (tipor == RIGA_SCONTI)
|
if (tipor == RIGA_SCONTI)
|
||||||
return get(RDOC_SCONTO).not_empty();
|
return get(RDOC_SCONTO).not_empty();
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TRiga_documento::put_str(const char* fieldname, const char* val)
|
void TRiga_documento::put_str(const char* fieldname, const char* val)
|
||||||
{
|
{
|
||||||
if (strcmp(fieldname, RDOC_TIPORIGA) == 0)
|
if (xvt_str_same(fieldname, RDOC_TIPORIGA))
|
||||||
{
|
{
|
||||||
const TString4 v(val);
|
const TString4 v = val;
|
||||||
if (TRectype::get(RDOC_TIPORIGA) != v)
|
if (TRectype::get(RDOC_TIPORIGA) != v)
|
||||||
{
|
{
|
||||||
TAuto_variable_rectype::put_str(fieldname, v);
|
TAuto_variable_rectype::put_str(fieldname, v);
|
||||||
@ -1061,7 +1062,7 @@ bool TRiga_documento::is_articolo() const
|
|||||||
|
|
||||||
void TRiga_documento::zero(const char* fieldname)
|
void TRiga_documento::zero(const char* fieldname)
|
||||||
{
|
{
|
||||||
if (strcmp(fieldname, RDOC_TIPORIGA) == 0)
|
if (xvt_str_same(fieldname, RDOC_TIPORIGA))
|
||||||
reset_fields(*this);
|
reset_fields(*this);
|
||||||
TAuto_variable_rectype::zero(fieldname);
|
TAuto_variable_rectype::zero(fieldname);
|
||||||
dirty_fields();
|
dirty_fields();
|
||||||
@ -1079,7 +1080,7 @@ void TRiga_documento::cms2tipodet()
|
|||||||
{
|
{
|
||||||
TString4 cms_tipodet;
|
TString4 cms_tipodet;
|
||||||
const TString4 tipodet = get(RDOC_TIPODET);
|
const TString4 tipodet = get(RDOC_TIPODET);
|
||||||
TString codcms = codice_commessa();
|
const TString20 codcms = codice_commessa();
|
||||||
|
|
||||||
if (codcms.full() && get(RDOC_CODIVA).full())
|
if (codcms.full() && get(RDOC_CODIVA).full())
|
||||||
{
|
{
|
||||||
@ -1129,10 +1130,8 @@ void TRiga_documento::autosave(TSheet_field& f)
|
|||||||
TMask& m = f.sheet_row_mask(num);
|
TMask& m = f.sheet_row_mask(num);
|
||||||
TToken_string& row = f.row(num);
|
TToken_string& row = f.row(num);
|
||||||
|
|
||||||
|
|
||||||
put( RDOC_TIPORIGA, row.get(f.cid2index(FR_TIPORIGA)));
|
put( RDOC_TIPORIGA, row.get(f.cid2index(FR_TIPORIGA)));
|
||||||
TString8 codmag(row.get(f.cid2index(FR_CODMAG)));
|
TString8 codmag = row.get(f.cid2index(FR_CODMAG));
|
||||||
|
|
||||||
codmag.left_just(3);
|
codmag.left_just(3);
|
||||||
codmag << row.get( f.cid2index(FR_CODDEP ));
|
codmag << row.get( f.cid2index(FR_CODDEP ));
|
||||||
put( RDOC_CODMAG, codmag);
|
put( RDOC_CODMAG, codmag);
|
||||||
|
113
ve/velib03.cpp
113
ve/velib03.cpp
@ -8,9 +8,12 @@
|
|||||||
#include "../cg/cg2103.h"
|
#include "../cg/cg2103.h"
|
||||||
#include "../db/dblib.h"
|
#include "../db/dblib.h"
|
||||||
#include "../pr/prlib.h"
|
#include "../pr/prlib.h"
|
||||||
#include "../sv/svlib01.h"
|
|
||||||
#include "../li/letint.h"
|
#include "../li/letint.h"
|
||||||
|
|
||||||
|
#ifdef LIVE_STATISTICS
|
||||||
|
#include "../sv/svlib01.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "veini.h"
|
#include "veini.h"
|
||||||
#include "velib.h"
|
#include "velib.h"
|
||||||
#include "sconti.h"
|
#include "sconti.h"
|
||||||
@ -226,11 +229,13 @@ long TDocumento::_firm = -1;
|
|||||||
TString4 TDocumento::_codiva_spese;
|
TString4 TDocumento::_codiva_spese;
|
||||||
TString4 TDocumento::_codiva_bolli;
|
TString4 TDocumento::_codiva_bolli;
|
||||||
short TDocumento::_has_mag = 3;
|
short TDocumento::_has_mag = 3;
|
||||||
short TDocumento::_has_stat_ven = 3;
|
|
||||||
short TDocumento::_has_provv = 3;
|
short TDocumento::_has_provv = 3;
|
||||||
|
#ifdef LIVE_STATISTICS
|
||||||
|
short TDocumento::_has_stat_ven = 3;
|
||||||
|
#endif
|
||||||
|
|
||||||
TCodgiac_livelli * TDocumento::_livelli=NULL;
|
TCodgiac_livelli * TDocumento::_livelli=NULL;
|
||||||
|
|
||||||
// HIDDEN TStats_agg _st_agg;
|
|
||||||
HIDDEN TAssoc_array _docs_to_agg;
|
HIDDEN TAssoc_array _docs_to_agg;
|
||||||
|
|
||||||
void TDocumento::init()
|
void TDocumento::init()
|
||||||
@ -265,15 +270,24 @@ TDocumento::TDocumento(char provv, int anno, const char* codnum, long numdoc)
|
|||||||
: TMultiple_rectype(LF_DOC)
|
: TMultiple_rectype(LF_DOC)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
if (numdoc <= 0)
|
if (numdoc > 0)
|
||||||
{
|
|
||||||
numdoc = 0;
|
|
||||||
set_key(*this, provv, anno, codnum, numdoc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
read(provv, anno, codnum, numdoc);
|
read(provv, anno, codnum, numdoc);
|
||||||
|
else
|
||||||
|
set_key(*this, provv, anno, codnum, 0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TDocumento::TDocumento(const TDoc_key& key)
|
||||||
|
: TMultiple_rectype(LF_DOC)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
const long ndoc = key.ndoc();
|
||||||
|
if (ndoc > 0)
|
||||||
|
read(key.provv(), key.anno(), key.codnum(), ndoc);
|
||||||
|
else
|
||||||
|
set_key(*this, key.provv(), key.anno(), key.codnum(), 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TDocumento::TDocumento(const TRectype& rec)
|
TDocumento::TDocumento(const TRectype& rec)
|
||||||
: TMultiple_rectype(LF_DOC)
|
: TMultiple_rectype(LF_DOC)
|
||||||
{
|
{
|
||||||
@ -299,12 +313,14 @@ const TString& TDocumento::codiva_bolli() const
|
|||||||
|
|
||||||
void TDocumento::check_modules()
|
void TDocumento::check_modules()
|
||||||
{
|
{
|
||||||
if (_has_mag == 3)
|
if (_has_mag < 0 || _has_mag > 1)
|
||||||
{
|
{
|
||||||
const TDongle& din = dongle();
|
const TDongle& din = dongle();
|
||||||
_has_mag = din.active(MGAUT);
|
_has_mag = din.active(MGAUT);
|
||||||
_has_stat_ven = din.active(SVAUT);
|
|
||||||
_has_provv = din.active(PRAUT);
|
_has_provv = din.active(PRAUT);
|
||||||
|
#ifdef LIVE_STATISTICS
|
||||||
|
_has_stat_ven = din.active(SVAUT);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -606,26 +622,53 @@ const TString & TDocumento::commessa_principale() const
|
|||||||
return codice_commessa();
|
return codice_commessa();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Controlla se un documento è incluso nelle statistiche definitive
|
||||||
|
static bool doc_invalidating_stats(const TDocumento& doc)
|
||||||
|
{
|
||||||
|
bool inv = false;
|
||||||
|
if (dongle().active(SVAUT) && doc.tipo().statistiche())
|
||||||
|
{
|
||||||
|
const TDate datadoc = doc.get(DOC_DATADOC);
|
||||||
|
if (datadoc.ok())
|
||||||
|
{
|
||||||
|
const TDate datalast = ini_get_string(CONFIG_DITTA, "sv", "UltimoCalcolo");
|
||||||
|
inv = datadoc <= datalast;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return inv;
|
||||||
|
}
|
||||||
|
|
||||||
bool TDocumento::modificabile() const
|
bool TDocumento::modificabile() const
|
||||||
{
|
{
|
||||||
|
bool maybe = true;
|
||||||
|
|
||||||
const char stato_attuale = stato();
|
const char stato_attuale = stato();
|
||||||
|
if (stato_attuale > ' ')
|
||||||
if (stato_attuale <= ' ')
|
{
|
||||||
return true;
|
|
||||||
|
|
||||||
const TString& stati_modifica = tipo().stati_iniziali_modifica();
|
const TString& stati_modifica = tipo().stati_iniziali_modifica();
|
||||||
return stati_modifica.blank() || stati_modifica.find(stato_attuale) >= 0;
|
maybe = stati_modifica.blank() || stati_modifica.find(stato_attuale) >= 0;
|
||||||
|
|
||||||
|
if (maybe && doc_invalidating_stats(*this))
|
||||||
|
maybe = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return maybe;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TDocumento::cancellabile() const
|
bool TDocumento::cancellabile() const
|
||||||
{
|
{
|
||||||
|
bool maybe = true;
|
||||||
|
|
||||||
const char stato_attuale = stato();
|
const char stato_attuale = stato();
|
||||||
|
if (stato_attuale > ' ')
|
||||||
if (stato_attuale <= ' ')
|
{
|
||||||
return true;
|
|
||||||
|
|
||||||
const TString& stati_cancellazione = tipo().stati_iniziali_cancellazione();
|
const TString& stati_cancellazione = tipo().stati_iniziali_cancellazione();
|
||||||
return stati_cancellazione.blank() || stati_cancellazione.find(stato_attuale) >= 0;
|
maybe = stati_cancellazione.blank() || stati_cancellazione.find(stato_attuale) >= 0;
|
||||||
|
|
||||||
|
if (maybe && doc_invalidating_stats(*this))
|
||||||
|
maybe = false;
|
||||||
|
}
|
||||||
|
return maybe;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TDocumento::stampabile() const
|
bool TDocumento::stampabile() const
|
||||||
@ -644,12 +687,13 @@ bool TDocumento::stampabile() const
|
|||||||
bool TDocumento::bloccato() const
|
bool TDocumento::bloccato() const
|
||||||
{
|
{
|
||||||
const char stato_attuale = stato();
|
const char stato_attuale = stato();
|
||||||
|
|
||||||
if (stato_attuale <= ' ')
|
if (stato_attuale <= ' ')
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char stato_bloccato = tipo().stato_bloccato();
|
if (doc_invalidating_stats(*this))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
char stato_bloccato = tipo().stato_bloccato();
|
||||||
if (stato_bloccato <= ' ')
|
if (stato_bloccato <= ' ')
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -662,12 +706,10 @@ bool TDocumento::chiuso() const
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
const char stato_attuale = stato();
|
const char stato_attuale = stato();
|
||||||
|
|
||||||
if (stato_attuale <= ' ')
|
if (stato_attuale <= ' ')
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char stato_chiuso = tipo().stato_chiuso();
|
char stato_chiuso = tipo().stato_chiuso();
|
||||||
|
|
||||||
if (stato_chiuso <= ' ')
|
if (stato_chiuso <= ' ')
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -711,9 +753,9 @@ void TDocumento::copy_data(TRectype& dst, const TRectype& src)
|
|||||||
dst.put(RDOC_NRIGA, nriga);
|
dst.put(RDOC_NRIGA, nriga);
|
||||||
dst.put(RDOC_IDRIGA, idriga);
|
dst.put(RDOC_IDRIGA, idriga);
|
||||||
dst.zero(RDOC_MOVMAG);
|
dst.zero(RDOC_MOVMAG);
|
||||||
const TString memo = src.get(RDOC_DESCEST);
|
const TString& memo = src.get(RDOC_DESCEST);
|
||||||
dst.put(RDOC_DESCEST, memo);
|
dst.put(RDOC_DESCEST, memo);
|
||||||
const TString g1 = src.get(RDOC_RG1);
|
const TString& g1 = src.get(RDOC_RG1);
|
||||||
dst.put(RDOC_RG1, g1);
|
dst.put(RDOC_RG1, g1);
|
||||||
((TRiga_documento&)dst).load_memo();
|
((TRiga_documento&)dst).load_memo();
|
||||||
}
|
}
|
||||||
@ -778,6 +820,7 @@ void TDocumento::on_read(int err, word lockop)
|
|||||||
set_riga_esenzione();
|
set_riga_esenzione();
|
||||||
_stato_originale = stato();
|
_stato_originale = stato();
|
||||||
|
|
||||||
|
#ifdef LIVE_STATISTICS
|
||||||
if (err == NOERR && _has_stat_ven && tipo_valido() && tipo().statistiche() )
|
if (err == NOERR && _has_stat_ven && tipo_valido() && tipo().statistiche() )
|
||||||
{
|
{
|
||||||
const TDoc_key key(head());
|
const TDoc_key key(head());
|
||||||
@ -803,6 +846,7 @@ void TDocumento::on_read(int err, word lockop)
|
|||||||
_docs_to_agg.remove(key);
|
_docs_to_agg.remove(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
_old_agente.cut(0);
|
_old_agente.cut(0);
|
||||||
_old_agente1.cut(0);
|
_old_agente1.cut(0);
|
||||||
@ -1026,7 +1070,7 @@ void TDocumento::dirty_fields()
|
|||||||
for (int i = righe.last_row(); i > 0; i = righe.pred_row(i))
|
for (int i = righe.last_row(); i > 0; i = righe.pred_row(i))
|
||||||
{
|
{
|
||||||
TRiga_documento& r = (TRiga_documento&)righe[i];
|
TRiga_documento& r = (TRiga_documento&)righe[i];
|
||||||
r.dirty_fields(FALSE);
|
r.dirty_fields(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_dirty_deny = true;
|
_dirty_deny = true;
|
||||||
@ -1512,6 +1556,8 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
|
|||||||
}
|
}
|
||||||
if (_has_provv && tipo().provvigioni() && tipo().stato_provvigioni() <= stato())
|
if (_has_provv && tipo().provvigioni() && tipo().stato_provvigioni() <= stato())
|
||||||
myself.update_provvigioni(false);
|
myself.update_provvigioni(false);
|
||||||
|
|
||||||
|
#ifdef LIVE_STATISTICS
|
||||||
if (_has_stat_ven && tipo().statistiche())
|
if (_has_stat_ven && tipo().statistiche())
|
||||||
{
|
{
|
||||||
const TDoc_key key(myself.head());
|
const TDoc_key key(myself.head());
|
||||||
@ -1540,13 +1586,16 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
|
|||||||
st_agg->sub(myself.row(i));
|
st_agg->sub(myself.row(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eliminare anche il mov di mag. ??????
|
// eliminare anche il mov di mag. ??????
|
||||||
int TDocumento::remove(TBaseisamfile& f) const
|
int TDocumento::remove(TBaseisamfile& f) const
|
||||||
{
|
{
|
||||||
if (!cancellabile() && !yesno_box("Documento non cancellabile,\nContinuare ugualmente"))
|
if (!cancellabile() && !delete_box("Documento non cancellabile.\nSi desidera continuare ugualmente?"))
|
||||||
return NOERR;
|
return NOERR;
|
||||||
const bool check_movmag = _has_mag && tipo().mov_mag();
|
const bool check_movmag = _has_mag && tipo().mov_mag();
|
||||||
const bool doc_bloccato = bloccato();
|
const bool doc_bloccato = bloccato();
|
||||||
@ -1565,7 +1614,6 @@ int TDocumento::remove(TBaseisamfile& f) const
|
|||||||
if (doc_bloccato)
|
if (doc_bloccato)
|
||||||
{
|
{
|
||||||
const int rows = mov.rows();
|
const int rows = mov.rows();
|
||||||
|
|
||||||
for (int i= 1; i <= rows; i++)
|
for (int i= 1; i <= rows; i++)
|
||||||
mov.body()[i].zero(RMOVMAG_TIPORIGA);
|
mov.body()[i].zero(RMOVMAG_TIPORIGA);
|
||||||
mov.rewrite(m);
|
mov.rewrite(m);
|
||||||
@ -1576,6 +1624,7 @@ int TDocumento::remove(TBaseisamfile& f) const
|
|||||||
}
|
}
|
||||||
if (!doc_bloccato)
|
if (!doc_bloccato)
|
||||||
{
|
{
|
||||||
|
#ifdef LIVE_STATISTICS
|
||||||
if (_has_stat_ven && tipo().statistiche())
|
if (_has_stat_ven && tipo().statistiche())
|
||||||
{
|
{
|
||||||
const TDoc_key key(head());
|
const TDoc_key key(head());
|
||||||
@ -1586,6 +1635,7 @@ int TDocumento::remove(TBaseisamfile& f) const
|
|||||||
_docs_to_agg.remove(key);
|
_docs_to_agg.remove(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (_has_provv && tipo().provvigioni())
|
if (_has_provv && tipo().provvigioni())
|
||||||
{
|
{
|
||||||
TDocumento& myself = *((TDocumento *)this);
|
TDocumento& myself = *((TDocumento *)this);
|
||||||
@ -3017,6 +3067,8 @@ bool TDocumento::is_nota_credito() const
|
|||||||
if (tipo().nota_credito())
|
if (tipo().nota_credito())
|
||||||
swap = true;
|
swap = true;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (tipo().is_fattura())
|
||||||
{
|
{
|
||||||
const TString4 codcaus(tipo().causale());
|
const TString4 codcaus(tipo().causale());
|
||||||
if (codcaus.full())
|
if (codcaus.full())
|
||||||
@ -3032,6 +3084,7 @@ bool TDocumento::is_nota_credito() const
|
|||||||
swap = ((tiva == iva_vendite) ^ (sez == 'D'));
|
swap = ((tiva == iva_vendite) ^ (sez == 'D'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return swap;
|
return swap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,6 +452,7 @@ void TTipo_documento::read_formule()
|
|||||||
_module = prof.get("MODULE", NULL, -1, "ve").left(2);
|
_module = prof.get("MODULE", NULL, -1, "ve").left(2);
|
||||||
_hca_req = !prof.get_bool("HEAD_CA_OPT");
|
_hca_req = !prof.get_bool("HEAD_CA_OPT");
|
||||||
_check_double_art = prof.get_bool("CHECK_DOUBLE_ART");
|
_check_double_art = prof.get_bool("CHECK_DOUBLE_ART");
|
||||||
|
_ignora_anticipi_fatturazione = prof.get_bool("IGNORA_ANTICIPI_FATTURAZIONE");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TTipo_documento::movimento_interno() const
|
bool TTipo_documento::movimento_interno() const
|
||||||
@ -993,7 +994,7 @@ void TExpr_documento::evaluate_user_func(int index, int nparms, TEval_stack & st
|
|||||||
for (int i = comp.first(); !found && i < items; i = comp.succ(i))
|
for (int i = comp.first(); !found && i < items; i = comp.succ(i))
|
||||||
{
|
{
|
||||||
TRiga_esplosione& r = (TRiga_esplosione &) comp[i];
|
TRiga_esplosione& r = (TRiga_esplosione &) comp[i];
|
||||||
const TString c(r.articolo());
|
const TCodice_articolo c = r.articolo();
|
||||||
|
|
||||||
if (c.find(substr, pos) > 0)
|
if (c.find(substr, pos) > 0)
|
||||||
{
|
{
|
||||||
|
@ -250,7 +250,7 @@ bool TLista_clifo::TClifo::read(char tipo, long cod)
|
|||||||
|
|
||||||
TLista_clifo::TClifo::TClifo(const TRectype& rec)
|
TLista_clifo::TClifo::TClifo(const TRectype& rec)
|
||||||
{
|
{
|
||||||
CHECK(rec.num() == LF_CLIFO, "Record non clienti");
|
CHECK(rec.num() == LF_CLIFO || rec.num() == LF_DOC, "Record senza TIPOCF e CODCF");
|
||||||
const char tipo = rec.get_char(CLI_TIPOCF);
|
const char tipo = rec.get_char(CLI_TIPOCF);
|
||||||
const long codice = rec.get_long(CLI_CODCF);
|
const long codice = rec.get_long(CLI_CODCF);
|
||||||
read(tipo, codice);
|
read(tipo, codice);
|
||||||
@ -313,6 +313,87 @@ int TLista_clifo::leggi(long dc, long ac, long da, long aa, const char * dz, con
|
|||||||
return _clifo.items();
|
return _clifo.items();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool add_filter(TString& filter, const char* name, long da, long al)
|
||||||
|
{
|
||||||
|
if (!(da > 0 || al > da))
|
||||||
|
return false;
|
||||||
|
if (filter.full()) filter << "&&";
|
||||||
|
|
||||||
|
TString16 field = name;
|
||||||
|
if (xvt_str_compare_ignoring_case(name, DOC_CODCF) != 0)
|
||||||
|
field.insert("17->");
|
||||||
|
|
||||||
|
if (da == al)
|
||||||
|
filter << "(" << field << "==" << da << ")"; else
|
||||||
|
if (da <= 0 && al > 0)
|
||||||
|
filter << "(" << field << "<=" << al << ")"; else
|
||||||
|
if (da > 0 && al < da)
|
||||||
|
filter << "(" << field << ">=" << da << ")";
|
||||||
|
else
|
||||||
|
filter << "(BETWEEN(" << field << ',' << da << ',' << al << "))";
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int TLista_clifo::leggi_doc(const TElaborazione& eld, const TDate& dd, const TDate& ad,
|
||||||
|
long dc, long ac, long da, long aa, const char* dz, const char* az)
|
||||||
|
{
|
||||||
|
if (!dd.ok())
|
||||||
|
return leggi(dc, ac, da, aa, dz, az);
|
||||||
|
|
||||||
|
TRelation doc(LF_DOC);
|
||||||
|
doc.add(LF_CFVEN, "TIPOCF==TIPOCF|CODCF==CODCF");
|
||||||
|
const TRectype& rec = doc.curr();
|
||||||
|
|
||||||
|
TRectype start(rec), stop(rec);
|
||||||
|
start.put(DOC_DATADOC, dd);
|
||||||
|
stop.put (DOC_DATADOC, ad);
|
||||||
|
|
||||||
|
TString filter(127);
|
||||||
|
add_filter(filter, DOC_CODCF, dc, ac);
|
||||||
|
add_filter(filter, CLI_CODAG, da, aa);
|
||||||
|
|
||||||
|
if (dz && (*dz !='\0'))
|
||||||
|
{
|
||||||
|
if (filter.not_empty()) filter << "&&";
|
||||||
|
filter << '(' << LF_CFVEN << "->" << CLI_CODZONA << ">=\"" << dz << "\")";
|
||||||
|
}
|
||||||
|
if (az && (*az !='\0'))
|
||||||
|
{
|
||||||
|
if (filter.not_empty()) filter << "&&";
|
||||||
|
filter << '(' << LF_CFVEN << "->" << CLI_CODZONA << "<=\"" << az << "\")";
|
||||||
|
}
|
||||||
|
|
||||||
|
TCursor cur(&doc, filter, 3, &start, &stop);
|
||||||
|
TBit_array buoni;
|
||||||
|
for (cur = 0; cur.ok(); ++cur)
|
||||||
|
{
|
||||||
|
const char tipocf = rec.get_char(DOC_TIPOCF);
|
||||||
|
const long codcf = rec.get_long(DOC_CODCF);
|
||||||
|
if (tipocf == tipo() && !buoni[codcf])
|
||||||
|
{
|
||||||
|
if (eld.is_document_ok(rec))
|
||||||
|
{
|
||||||
|
TClifo* c = new TClifo(tipocf, codcf);
|
||||||
|
_clifo.add(c, codcf);
|
||||||
|
buoni.set(codcf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (da > 0 || aa > 0)
|
||||||
|
ordina_per_agente();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((dz && (*dz !='\0')) || (az && (*dz !='\0')))
|
||||||
|
ordina_per_zona();
|
||||||
|
else
|
||||||
|
ordina_per_codice();
|
||||||
|
}
|
||||||
|
|
||||||
|
return _clifo.items();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int TLista_clifo::leggi_ragsoc(const char *dr, const char * ar, long da, long aa, const char * dz, const char * az)
|
int TLista_clifo::leggi_ragsoc(const char *dr, const char * ar, long da, long aa, const char * dz, const char * az)
|
||||||
{
|
{
|
||||||
TRelation clifo(LF_CLIFO);
|
TRelation clifo(LF_CLIFO);
|
||||||
|
@ -48,6 +48,8 @@ public:
|
|||||||
// Lista Cliente/Fornitore per vendite
|
// Lista Cliente/Fornitore per vendite
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class TElaborazione;
|
||||||
|
|
||||||
class TLista_clifo : public TObject // velib04
|
class TLista_clifo : public TObject // velib04
|
||||||
{
|
{
|
||||||
class TClifo : public TObject
|
class TClifo : public TObject
|
||||||
@ -92,6 +94,8 @@ public:
|
|||||||
int ordina_per_zona();
|
int ordina_per_zona();
|
||||||
|
|
||||||
int leggi(long dc, long ac, long da = 0, long aa = 0, const char * dz = "", const char * az = "");
|
int leggi(long dc, long ac, long da = 0, long aa = 0, const char * dz = "", const char * az = "");
|
||||||
|
int leggi_doc(const TElaborazione& eld, const TDate& dd, const TDate& ad,
|
||||||
|
long dc, long ac, long da=0, long aa=0, const char * dz="", const char * az="");
|
||||||
int leggi_ragsoc(const char *dr, const char * ar, long da = 0, long aa = 0, const char * dz = "", const char * az = "");
|
int leggi_ragsoc(const char *dr, const char * ar, long da = 0, long aa = 0, const char * dz = "", const char * az = "");
|
||||||
|
|
||||||
long operator[] (int n) const { return clifo(n).codice(); }
|
long operator[] (int n) const { return clifo(n).codice(); }
|
||||||
@ -446,7 +450,7 @@ protected:
|
|||||||
// Funzione per aggiungere la riga iva al TAssoc_array _righe_iva
|
// Funzione per aggiungere la riga iva al TAssoc_array _righe_iva
|
||||||
// error_type add_iva_row(const TBill&, const TRiga_documento&, const int ndec, const real p = 1.0);
|
// error_type add_iva_row(const TBill&, const TRiga_documento&, const int ndec, const real p = 1.0);
|
||||||
// Funzione atomica per aggiungere le righe di spese d'incasso e bolli al TAssoc_array _righe_iva
|
// Funzione atomica per aggiungere le righe di spese d'incasso e bolli al TAssoc_array _righe_iva
|
||||||
void calculate_spese(real&, real&, int, bool, bool, const TString &, const TDocumento & );
|
void calculate_spese(const real&, real&, int, bool, const TString &, const TDocumento & );
|
||||||
// Funzione per aggiungere le righe di spese d'incasso e bolli al TAssoc_array _righe_iva (chiama calculate_spese())
|
// Funzione per aggiungere le righe di spese d'incasso e bolli al TAssoc_array _righe_iva (chiama calculate_spese())
|
||||||
error_type add_spese_inbo(TDocumento&, const int);
|
error_type add_spese_inbo(TDocumento&, const int);
|
||||||
// Aggiorna le righe di sconto importo o percentuale
|
// Aggiorna le righe di sconto importo o percentuale
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#include "velib04.h"
|
#include "velib04.h"
|
||||||
|
|
||||||
#include <dongle.h>
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// TFatturazione bolle
|
// TFatturazione bolle
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -141,7 +139,7 @@ void TFatturazione_bolle::elabora_riga(TRiga_documento& r, TDocumento& doc_out,
|
|||||||
r.put(RDOC_RIGAEVASA, true);
|
r.put(RDOC_RIGAEVASA, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool elaborata = false;
|
int sommata = 0;
|
||||||
|
|
||||||
// Raggruppo le righe se e' settato il flag di raggruppamento e
|
// Raggruppo le righe se e' settato il flag di raggruppamento e
|
||||||
// se la riga non contiene solo una descrizione
|
// se la riga non contiene solo una descrizione
|
||||||
@ -156,19 +154,29 @@ void TFatturazione_bolle::elabora_riga(TRiga_documento& r, TDocumento& doc_out,
|
|||||||
{
|
{
|
||||||
add_rows(*rout, rin);
|
add_rows(*rout, rin);
|
||||||
r.set_final_rdoc_key(*rout);
|
r.set_final_rdoc_key(*rout);
|
||||||
elaborata = true; // Ricorda di averla gia' elaborata
|
sommata = nr; // Ricorda di averla gia' elaborata
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!elaborata) // Se la riga non e' stata gia' sommata ...
|
if (sommata <= 0) // Se la riga non e' stata gia' sommata ...
|
||||||
{
|
{
|
||||||
create_row(doc_out, rin);
|
create_row(doc_out, rin);
|
||||||
// Aggiorna collegamento alla riga di destinazione, cioè l'ultima del docuemnto di output
|
// Aggiorna collegamento alla riga di destinazione, cioè l'ultima del documento di output
|
||||||
TRiga_documento& riga_fatt = doc_out[doc_out.physical_rows()];
|
const int last_row = doc_out.physical_rows();
|
||||||
|
if (last_row > 0)
|
||||||
|
{
|
||||||
|
TRiga_documento& riga_fatt = doc_out[last_row];
|
||||||
|
if (rin.get(RDOC_CODART) == riga_fatt.get(RDOC_CODART))
|
||||||
r.update_rdoc_links(riga_fatt);
|
r.update_rdoc_links(riga_fatt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TRiga_documento& riga_fatt = doc_out[sommata];
|
||||||
|
r.set_final_rdoc_key(riga_fatt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool TFatturazione_bolle::raggruppa(TDocumento& doc_in, TDocumento& doc_out)
|
bool TFatturazione_bolle::raggruppa(TDocumento& doc_in, TDocumento& doc_out)
|
||||||
{
|
{
|
||||||
@ -204,7 +212,7 @@ bool TFatturazione_bolle::raggruppa(TDocumento& doc_in, TDocumento& doc_out)
|
|||||||
da_elaborare = ddoc >= data_cons && !rin->get_bool(RDOC_RIGAEVASA);
|
da_elaborare = ddoc >= data_cons && !rin->get_bool(RDOC_RIGAEVASA);
|
||||||
}
|
}
|
||||||
if (!da_elaborare)
|
if (!da_elaborare)
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gestione_riferimenti())
|
if (gestione_riferimenti())
|
||||||
@ -307,6 +315,13 @@ bool TFatturazione_bolle::raggruppa(TDocumento& doc_in, TDocumento& doc_out)
|
|||||||
FOR_EACH_PHYSICAL_RDOC(doc_in, r, rin)
|
FOR_EACH_PHYSICAL_RDOC(doc_in, r, rin)
|
||||||
elabora_riga(*rin, doc_out, usa_dcons, ragg_rig, ignora_desc, campi_riga, dcons, ddoc);
|
elabora_riga(*rin, doc_out, usa_dcons, ragg_rig, ignora_desc, campi_riga, dcons, ddoc);
|
||||||
|
|
||||||
|
// 30 Luglio 2015. Hardy non somma gli anticipi da bolla in quanto già contabilizzati, mentre gli altri li sommano tutti (forse)
|
||||||
|
if (!doc_in.tipo().ignora_anticipi_fatturazione())
|
||||||
|
{
|
||||||
|
const real anticipo = doc_in.get_real(DOC_IMPPAGATO);
|
||||||
|
doc_out.add(DOC_IMPPAGATO, anticipo); // Somma tutti gli anticipi versati in bolla
|
||||||
|
}
|
||||||
|
|
||||||
//cambio stato documento
|
//cambio stato documento
|
||||||
bool cambia_stato_doc_in = true;
|
bool cambia_stato_doc_in = true;
|
||||||
if (usa_dcons)
|
if (usa_dcons)
|
||||||
@ -340,20 +355,25 @@ bool TFatturazione_bolle::get_num_tip_out(const TDocumento& doc, TString& codnum
|
|||||||
codnum = codice_numerazione_finale();
|
codnum = codice_numerazione_finale();
|
||||||
tipodoc = get_tipo_out(doc);
|
tipodoc = get_tipo_out(doc);
|
||||||
|
|
||||||
|
// Nel caso di fatture controlla il tipo documento preferito dal cliente
|
||||||
|
const TCodice_numerazione& cn_std = cached_numerazione(codnum);
|
||||||
|
if (cn_std.tipo() == 2)
|
||||||
|
{
|
||||||
const TRectype& cfven = doc.clifor().vendite();
|
const TRectype& cfven = doc.clifor().vendite();
|
||||||
const TString& tipo_cfv = cfven.get(CFV_TIPODOCFAT);
|
const TString& tipo_cfv = cfven.get(CFV_TIPODOCFAT);
|
||||||
if (tipo_cfv.full())
|
if (tipo_cfv.full())
|
||||||
tipodoc = tipo_cfv;
|
tipodoc = tipo_cfv;
|
||||||
|
}
|
||||||
|
|
||||||
const TCodice_numerazione& cn_std = cached_numerazione(codnum);
|
|
||||||
bool ok = cn_std.find_tipo_doc(tipodoc) >= 0;
|
bool ok = cn_std.find_tipo_doc(tipodoc) >= 0;
|
||||||
|
|
||||||
if (!ok)
|
if (!ok)
|
||||||
{
|
{
|
||||||
TISAM_recordset num_recset("USE %NUM SELECT I1=2");
|
TISAM_recordset num_recset("USE %NUM SELECT I1=2");
|
||||||
|
const TRectype& rec = num_recset.cursor()->curr();
|
||||||
for (ok = num_recset.move_first(); ok; ok = num_recset.move_next()) // giro sui vari tipi fattura
|
for (ok = num_recset.move_first(); ok; ok = num_recset.move_next()) // giro sui vari tipi fattura
|
||||||
{
|
{
|
||||||
const TCodice_numerazione cn_alt(num_recset.cursor()->curr());
|
const TCodice_numerazione cn_alt(rec);
|
||||||
if (cn_alt.find_tipo_doc(tipodoc) >= 0)
|
if (cn_alt.find_tipo_doc(tipodoc) >= 0)
|
||||||
{
|
{
|
||||||
codnum = cn_alt.codice();
|
codnum = cn_alt.codice();
|
||||||
@ -525,8 +545,8 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
|||||||
// td = old_tipo_in; // Ripristino il vecchio
|
// td = old_tipo_in; // Ripristino il vecchio
|
||||||
|
|
||||||
new_doc->zero(DOC_SPESEUPD); // Senno' non aggiorna le spese automatiche
|
new_doc->zero(DOC_SPESEUPD); // Senno' non aggiorna le spese automatiche
|
||||||
|
|
||||||
new_doc->put(DOC_DATADOC, data_elab);
|
new_doc->put(DOC_DATADOC, data_elab);
|
||||||
|
new_doc->zero(DOC_IMPPAGATO); // 30 Luglio 2015 per Hardy
|
||||||
|
|
||||||
// Aggiungilo alla lista dei documenti in uscita
|
// Aggiungilo alla lista dei documenti in uscita
|
||||||
od = doc_out.add(new_doc);
|
od = doc_out.add(new_doc);
|
||||||
@ -578,7 +598,7 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
|||||||
|
|
||||||
if (change_clifo())
|
if (change_clifo())
|
||||||
{
|
{
|
||||||
const TString4 tipodoc(d.tipo().codice());
|
const TString4 tipodoc= d.tipo().codice();
|
||||||
TDocumento_mask m(tipodoc);
|
TDocumento_mask m(tipodoc);
|
||||||
|
|
||||||
if (reload_prices())
|
if (reload_prices())
|
||||||
|
401
ve/velib04b.cpp
401
ve/velib04b.cpp
@ -1,19 +1,10 @@
|
|||||||
#include "velib04.h"
|
#include "velib04.h"
|
||||||
|
|
||||||
#include <comuni.h>
|
|
||||||
#include <unloc.h>
|
|
||||||
|
|
||||||
#include "../ca/calib01.h"
|
#include "../ca/calib01.h"
|
||||||
#include "../cg/cg2103.h"
|
#include "../cg/cg2103.h"
|
||||||
#include "../cg/cglib02.h"
|
#include "../cg/cglib02.h"
|
||||||
#include "../cg/cgsaldac.h"
|
#include "../cg/cgsaldac.h"
|
||||||
#include "../in/inlib01.h"
|
#include "../in/inlib01.h"
|
||||||
|
|
||||||
#include "../ca/movana.h"
|
|
||||||
#include "../m770/scperc.h"
|
|
||||||
#include "../m770/rver.h"
|
|
||||||
#include "../m770/perc.h"
|
|
||||||
|
|
||||||
#include <dongle.h>
|
#include <dongle.h>
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
#include <postman.h>
|
#include <postman.h>
|
||||||
@ -21,6 +12,14 @@
|
|||||||
#include <viswin.h>
|
#include <viswin.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
|
#include <comuni.h>
|
||||||
|
#include <unloc.h>
|
||||||
|
#include "../ca/movana.h"
|
||||||
|
#include "../m770/scperc.h"
|
||||||
|
#include "../m770/rver.h"
|
||||||
|
#include "../m770/perc.h"
|
||||||
|
|
||||||
|
|
||||||
void TMovimentoPN_VE::destroy_iva_row(int i)
|
void TMovimentoPN_VE::destroy_iva_row(int i)
|
||||||
{
|
{
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
@ -33,9 +32,9 @@ TImporto TMovimentoPN_VE::real2imp(const real& r, char row_type)
|
|||||||
{
|
{
|
||||||
bool dare = false;
|
bool dare = false;
|
||||||
if (row_type == 'S')
|
if (row_type == 'S')
|
||||||
dare = _caus->sezione_ritsoc() == 'D';
|
dare = _caus->sezione_ritsoc() == 'D'; else
|
||||||
else
|
if (row_type == 'V')
|
||||||
{
|
dare = _caus->sezione_revcharge() == 'D'; else
|
||||||
if (row_type == 'F')
|
if (row_type == 'F')
|
||||||
dare = _caus->sezione_ritfis() == 'D';
|
dare = _caus->sezione_ritfis() == 'D';
|
||||||
else
|
else
|
||||||
@ -44,7 +43,7 @@ TImporto TMovimentoPN_VE::real2imp(const real& r, char row_type)
|
|||||||
if (row_type != 'T' && row_type != 'F' && row_type != 'P')
|
if (row_type != 'T' && row_type != 'F' && row_type != 'P')
|
||||||
dare = !dare;
|
dare = !dare;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
TImporto importo(dare ? 'D' : 'A', r);
|
TImporto importo(dare ? 'D' : 'A', r);
|
||||||
return importo;
|
return importo;
|
||||||
}
|
}
|
||||||
@ -52,17 +51,13 @@ TImporto TMovimentoPN_VE::real2imp(const real& r, char row_type)
|
|||||||
int TMovimentoPN_VE::bill2pos(const TBill& conto, char tipo)
|
int TMovimentoPN_VE::bill2pos(const TBill& conto, char tipo)
|
||||||
{
|
{
|
||||||
const int items = cg_items();
|
const int items = cg_items();
|
||||||
|
|
||||||
for (int i = 0; i < items; i++)
|
for (int i = 0; i < items; i++)
|
||||||
{
|
{
|
||||||
TRectype& s = cg(i);
|
const TRectype& s = cg(i);
|
||||||
const char t = s.get_char(RMV_ROWTYPE);
|
const char t = s.get_char(RMV_ROWTYPE);
|
||||||
if (t == tipo)
|
if (t == tipo)
|
||||||
{
|
{
|
||||||
const int gr = s.get_int(RMV_GRUPPO);
|
const TBill c(s);
|
||||||
const int co = s.get_int(RMV_CONTO);
|
|
||||||
const long so = s.get_long(RMV_SOTTOCONTO);
|
|
||||||
const TBill c(gr,co,so);
|
|
||||||
if (c == conto)
|
if (c == conto)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@ -75,7 +70,7 @@ int TMovimentoPN_VE::type2pos(char tipo)
|
|||||||
const int items = cg_items();
|
const int items = cg_items();
|
||||||
for (int i = 0; i < items; i++)
|
for (int i = 0; i < items; i++)
|
||||||
{
|
{
|
||||||
TRectype& s = cg(i);
|
const TRectype& s = cg(i);
|
||||||
const char t = s.get_char(RMV_ROWTYPE);
|
const char t = s.get_char(RMV_ROWTYPE);
|
||||||
if (t == tipo)
|
if (t == tipo)
|
||||||
return i;
|
return i;
|
||||||
@ -109,7 +104,7 @@ bool TMovimentoPN_VE::add_cg_rec(int n, const TImporto& imp)
|
|||||||
int TMovimentoPN_VE::set_cg_rec(int n, const TImporto& imp, const TBill& conto, const char* desc, char tipo)
|
int TMovimentoPN_VE::set_cg_rec(int n, const TImporto& imp, const TBill& conto, const char* desc, char tipo)
|
||||||
{
|
{
|
||||||
const bool insert = n < 0;
|
const bool insert = n < 0;
|
||||||
if (insert) n = cg_items(); // Questa e' la prima riga di contabilita' vuota e disponibile
|
if (insert) n = cg_items(); // Questa è la prima riga di contabilita' vuota e disponibile
|
||||||
TRectype& rec = cg(n);
|
TRectype& rec = cg(n);
|
||||||
|
|
||||||
if (insert)
|
if (insert)
|
||||||
@ -204,7 +199,7 @@ void TMovimentoPN_VE::enter_row(int i, const TString& descr_cr)
|
|||||||
const TBill conto(cur);
|
const TBill conto(cur);
|
||||||
|
|
||||||
imponibile = imp + impind;
|
imponibile = imp + impind;
|
||||||
if (conto.ok() && !imponibile.is_zero()) // Se c'e' imponibile ...
|
if (conto.ok() && !imponibile.is_zero()) // Se c'è imponibile ...
|
||||||
{ // crea una nuova riga contabile
|
{ // crea una nuova riga contabile
|
||||||
// Aggiorna conto sulla riga contabile
|
// Aggiorna conto sulla riga contabile
|
||||||
const TImporto val(real2imp(imponibile, 'I'));
|
const TImporto val(real2imp(imponibile, 'I'));
|
||||||
@ -212,7 +207,7 @@ void TMovimentoPN_VE::enter_row(int i, const TString& descr_cr)
|
|||||||
|
|
||||||
if (newpos < 0) // conto non esistente: da inserire
|
if (newpos < 0) // conto non esistente: da inserire
|
||||||
{
|
{
|
||||||
const TString80 d = _caus->desc_agg(2);
|
const TFixed_string d = _caus->desc_agg(2);
|
||||||
set_cg_rec(-1, val, conto, d.empty() ? descr_cr : d, 'I');
|
set_cg_rec(-1, val, conto, d.empty() ? descr_cr : d, 'I');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -221,7 +216,7 @@ void TMovimentoPN_VE::enter_row(int i, const TString& descr_cr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Aggiorna conto IVA sulla riga contabile
|
// Aggiorna conto IVA sulla riga contabile
|
||||||
if (!iva.is_zero()) // Se c'e' imposta ...
|
if (!iva.is_zero()) // Se c'è imposta ...
|
||||||
{
|
{
|
||||||
const TRectype& head = lfile().curr();
|
const TRectype& head = lfile().curr();
|
||||||
int newposiva = type2pos('D'); // IVA detraibile
|
int newposiva = type2pos('D'); // IVA detraibile
|
||||||
@ -342,30 +337,23 @@ void TMovimentoPN_VE::add_row_tot_re(TDocumento& doc)
|
|||||||
|
|
||||||
bool TMovimentoPN_VE::add_row_cp_re(int i)
|
bool TMovimentoPN_VE::add_row_cp_re(int i)
|
||||||
{
|
{
|
||||||
TRectype& cur = cg(i);
|
bool inserted_row = false;
|
||||||
bool inserted_row = FALSE;
|
|
||||||
|
|
||||||
TBill c;
|
|
||||||
const int gr = cur.get_int(RMV_GRUPPO);
|
|
||||||
const int co = cur.get_int(RMV_CONTO);
|
|
||||||
const long so = cur.get_long(RMV_SOTTOCONTO);
|
|
||||||
|
|
||||||
c.set(gr,co,so);
|
|
||||||
TBill cp;
|
|
||||||
map_conto_re(c);
|
|
||||||
|
|
||||||
|
const TRectype& cur = cg(i);
|
||||||
|
TBill c(cur); map_conto_re(c);
|
||||||
if (c.ok())
|
if (c.ok())
|
||||||
{
|
{
|
||||||
int poscg = bill2pos(c, ' ');
|
int poscg = bill2pos(c, ' ');
|
||||||
if (poscg < 0)
|
if (poscg < 0)
|
||||||
{
|
{
|
||||||
poscg = insert_cg_rec(0, real2imp(ZERO, 'P'), c, _caus->desc_agg(1), ' ');
|
poscg = insert_cg_rec(0, real2imp(ZERO, 'P'), c, _caus->desc_agg(1), ' ');
|
||||||
inserted_row = TRUE;
|
inserted_row = true;
|
||||||
}
|
}
|
||||||
TImporto val(real2imp(cur.get_real(RMV_IMPORTO), 'P'));
|
TImporto val(real2imp(cur.get_real(RMV_IMPORTO), 'P'));
|
||||||
|
|
||||||
add_cg_rec(poscg, val);
|
add_cg_rec(poscg, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
return inserted_row;
|
return inserted_row;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,7 +393,7 @@ bool TMovimentoPN_VE::movement_ok()
|
|||||||
TImporto tot_imp;
|
TImporto tot_imp;
|
||||||
TImporto imp;
|
TImporto imp;
|
||||||
|
|
||||||
// Se siamo in valuta, forzera' la riga totale documento a cio' che si ottiene dalla somma
|
// Se siamo in valuta, forzerà la riga totale documento a ciò che si ottiene dalla somma
|
||||||
// delle singole righe per evitare sbilanci nel movimento di 2,3,4,5 lire dovuti agli arrotondamenti
|
// delle singole righe per evitare sbilanci nel movimento di 2,3,4,5 lire dovuti agli arrotondamenti
|
||||||
const int max = cg_items();
|
const int max = cg_items();
|
||||||
for (int i = 0; i < max; i++)
|
for (int i = 0; i < max; i++)
|
||||||
@ -447,12 +435,13 @@ bool TMovimentoPN_VE::movement_ok()
|
|||||||
|
|
||||||
int TMovimentoPN_VE::recalc_cg_rows(const TString& descr_cr, TCausale& caus)
|
int TMovimentoPN_VE::recalc_cg_rows(const TString& descr_cr, TCausale& caus)
|
||||||
{
|
{
|
||||||
const int righe = iva_items();
|
const int righe_IVA = iva_items();
|
||||||
const TRectype& head = curr();
|
const TRectype& head = curr();
|
||||||
|
|
||||||
set_caus(&caus);
|
set_caus(&caus);
|
||||||
for (int i=0; i<righe; i++)
|
for (int i=0; i < righe_IVA; i++)
|
||||||
enter_row(i, descr_cr);
|
enter_row(i, descr_cr);
|
||||||
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
if (_caus->intra() && _caus->iva() == iva_acquisti)
|
if (_caus->intra() && _caus->iva() == iva_acquisti)
|
||||||
{
|
{
|
||||||
@ -476,7 +465,7 @@ int TMovimentoPN_VE::recalc_cg_rows(const TString & descr_cr, TCausale & caus)
|
|||||||
ok = c.ok();
|
ok = c.ok();
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
const TString80 d(_caus->desc_agg(RIGA_RITENUTE_FISCALI));
|
const TString80 d = _caus->desc_agg(RIGA_RITENUTE_FISCALI);
|
||||||
const char rowtype = 'F';
|
const char rowtype = 'F';
|
||||||
set_cg_rec(-1, real2imp(ritfis, rowtype), c, d, rowtype);
|
set_cg_rec(-1, real2imp(ritfis, rowtype), c, d, rowtype);
|
||||||
}
|
}
|
||||||
@ -491,21 +480,44 @@ int TMovimentoPN_VE::recalc_cg_rows(const TString & descr_cr, TCausale & caus)
|
|||||||
ok = c.ok();
|
ok = c.ok();
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
const TString80 d(_caus->desc_agg(RIGA_RITENUTE_SOCIALI));
|
const TString80 d = _caus->desc_agg(RIGA_RITENUTE_SOCIALI);
|
||||||
const char rowtype = 'S';
|
const char rowtype = 'S';
|
||||||
set_cg_rec(-1, real2imp(ritsoc, rowtype), c, d, rowtype);
|
set_cg_rec(-1, real2imp(ritsoc, rowtype), c, d, rowtype);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const real revchg = head.get_real(MOV_REVCHARGE);
|
||||||
|
if (!revchg.is_zero())
|
||||||
|
{
|
||||||
|
TBill c; _caus->bill(RIGA_REVERSE_CHARGE, c);
|
||||||
|
ok = c.ok();
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
const TString80 d = _caus->desc_agg(RIGA_REVERSE_CHARGE);
|
||||||
|
const char rowtype = 'V';
|
||||||
|
set_cg_rec(-1, real2imp(revchg, rowtype), c, d, rowtype);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_caus->tipomov() == 1) // Elimina eventuali righe vuote dalle fatture
|
}
|
||||||
|
|
||||||
|
if (_caus->tipomov() == tm_fattura) // Elimina eventuali righe vuote dalle fatture
|
||||||
{
|
{
|
||||||
|
const bool is_zero_doc = (righe_IVA > 0) && head.get_real(MOV_TOTDOC).is_zero();
|
||||||
for (int c = cg_items()-1; c >= 0; c--)
|
for (int c = cg_items()-1; c >= 0; c--)
|
||||||
{
|
{
|
||||||
const TImporto imp = get_cg_imp(c);
|
const TImporto imp = get_cg_imp(c);
|
||||||
if (imp.is_zero())
|
bool can_delete = imp.is_zero();
|
||||||
|
if (can_delete && is_zero_doc)
|
||||||
|
{
|
||||||
|
const TRectype& s = cg(c);
|
||||||
|
can_delete = s.get_char(RMV_ROWTYPE) != 'T';
|
||||||
|
}
|
||||||
|
if (can_delete)
|
||||||
destroy_cg_row(c);
|
destroy_cg_row(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -521,8 +533,8 @@ static TBill _co_cliente, // conto clifo per movimento d'anticipo
|
|||||||
_co_controp; // conto di contropartita per il movimetno d'anticipo
|
_co_controp; // conto di contropartita per il movimetno d'anticipo
|
||||||
|
|
||||||
static bool _nump_cfg; // se true prende il numero rif. partita dal numero protocollo
|
static bool _nump_cfg; // se true prende il numero rif. partita dal numero protocollo
|
||||||
static bool _sc_enabled; // se true il saldaconto di ditta e' abilitato
|
static bool _sc_enabled; // se true il saldaconto di ditta è abilitato
|
||||||
static bool _in_enabled; // se true l'intra e' abilitato
|
static bool _in_enabled; // se true l'intra è abilitato
|
||||||
static TToken_string* _search_seq = NULL;
|
static TToken_string* _search_seq = NULL;
|
||||||
// Sequenza di ricerca del conto costo/ricavo la correttezza dell'ordinamento
|
// Sequenza di ricerca del conto costo/ricavo la correttezza dell'ordinamento
|
||||||
// va controllata nel programma di modifica parametri:
|
// va controllata nel programma di modifica parametri:
|
||||||
@ -536,7 +548,7 @@ static TToken_string* _search_seq = NULL;
|
|||||||
// CV = categoria di vendita
|
// CV = categoria di vendita
|
||||||
// CC = categoria contabile
|
// CC = categoria contabile
|
||||||
// Gli utlimi 6 fanno parte della ricerca per costi ricavi, in particolare AR,GM,SM e RF
|
// Gli utlimi 6 fanno parte della ricerca per costi ricavi, in particolare AR,GM,SM e RF
|
||||||
// non possono essere interrotti da CV o CC. Ad es. CA|CF|AR|CV|GM|CC|RF non e' valida come stringa
|
// non possono essere interrotti da CV o CC. Ad es. CA|CF|AR|CV|GM|CC|RF non è valida come stringa
|
||||||
// di ricerca.
|
// di ricerca.
|
||||||
static TString4 _iva_sto; // Codice IVA per storno articoli Omaggio
|
static TString4 _iva_sto; // Codice IVA per storno articoli Omaggio
|
||||||
static TBill _conto_sto; // Conto per storno articoli Omaggio
|
static TBill _conto_sto; // Conto per storno articoli Omaggio
|
||||||
@ -598,7 +610,6 @@ error_type TIVA_array::add_omaggi(const TRiga_documento& r, const TBill& conto,
|
|||||||
error_type TIVA_array::add(const TRiga_documento& r, const TBill& conto, const int ndec, const real& p)
|
error_type TIVA_array::add(const TRiga_documento& r, const TBill& conto, const int ndec, const real& p)
|
||||||
{
|
{
|
||||||
const TTipo_riga_documento & t = r.tipo();
|
const TTipo_riga_documento & t = r.tipo();
|
||||||
TString80 key;
|
|
||||||
const TCodiceIVA& tiva = r.iva();
|
const TCodiceIVA& tiva = r.iva();
|
||||||
const TString4 cod = tiva.codice();
|
const TString4 cod = tiva.codice();
|
||||||
TBill c(conto);
|
TBill c(conto);
|
||||||
@ -612,7 +623,7 @@ error_type TIVA_array::add(const TRiga_documento& r, const TBill& conto, const i
|
|||||||
|
|
||||||
if (rdoc != NULL && rdoc->get(RDOC_PROVV).not_empty())
|
if (rdoc != NULL && rdoc->get(RDOC_PROVV).not_empty())
|
||||||
{
|
{
|
||||||
TString80 key(rdoc->get(RDOC_CODNUM));
|
TString80 key = rdoc->get(RDOC_CODNUM);
|
||||||
|
|
||||||
const TCodice_numerazione& num = cached_numerazione(key);
|
const TCodice_numerazione& num = cached_numerazione(key);
|
||||||
if (num.fattura_emettere_ricevere())
|
if (num.fattura_emettere_ricevere())
|
||||||
@ -685,13 +696,11 @@ error_type TIVA_array::add(const TRiga_documento& r, const TBill& conto, const i
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
impon *= p;
|
impon *= p; impon.round(firmdec); // was ndec
|
||||||
impon.round(firmdec); // was ndec
|
|
||||||
|
|
||||||
if (impon.is_zero())
|
if (impon.is_zero())
|
||||||
return no_error;
|
return no_error;
|
||||||
|
|
||||||
real imposta = tiva.imposta(impon, ndec);
|
const real imposta = tiva.imposta(impon, ndec);
|
||||||
|
|
||||||
// Le righe di sconto ad importo o percentuale vanno saltate
|
// Le righe di sconto ad importo o percentuale vanno saltate
|
||||||
// Casistica sulle righe omaggio:
|
// Casistica sulle righe omaggio:
|
||||||
@ -700,10 +709,21 @@ error_type TIVA_array::add(const TRiga_documento& r, const TBill& conto, const i
|
|||||||
// una riga IVA con lo stesso imponibile ma di segno opposto, con un cod. IVA
|
// una riga IVA con lo stesso imponibile ma di segno opposto, con un cod. IVA
|
||||||
// speciale per lo storno, proveniente da configurazione
|
// speciale per lo storno, proveniente da configurazione
|
||||||
|
|
||||||
const TString4 tipodet(r.get(RDOC_TIPODET));
|
const TString4 tipodet = r.get(RDOC_TIPODET);
|
||||||
|
|
||||||
|
TString80 key;
|
||||||
key.format("%d|%-4s|%c|%3d|%3d|%6ld|%s",
|
key.format("%d|%-4s|%c|%3d|%3d|%6ld|%s",
|
||||||
ord,(const char*)cod,c.tipo(),c.gruppo(),c.conto(),c.sottoconto(), (const char*)tipodet);
|
ord,(const char*)cod,c.tipo(),c.gruppo(),c.conto(),c.sottoconto(), (const char*)tipodet);
|
||||||
|
|
||||||
|
// Nel caso di documenti a zero tiene distinte IVA positiva e negativa
|
||||||
|
if (r.doc().totale_doc().is_zero())
|
||||||
|
{
|
||||||
|
if (impon < ZERO)
|
||||||
|
key << "|-";
|
||||||
|
else
|
||||||
|
key << "|+";
|
||||||
|
}
|
||||||
|
|
||||||
TRectype* iva = (TRectype*)objptr(key);
|
TRectype* iva = (TRectype*)objptr(key);
|
||||||
|
|
||||||
if (iva == NULL)
|
if (iva == NULL)
|
||||||
@ -718,14 +738,10 @@ error_type TIVA_array::add(const TRiga_documento& r, const TBill& conto, const i
|
|||||||
iva->put(RMI_SOTTOCONTO, c.sottoconto());
|
iva->put(RMI_SOTTOCONTO, c.sottoconto());
|
||||||
TAssoc_array::add(key, iva, true);
|
TAssoc_array::add(key, iva, true);
|
||||||
}
|
}
|
||||||
real val = iva->get_real(RMI_IMPONIBILE);
|
|
||||||
|
|
||||||
val += impon;
|
iva->add(RMI_IMPONIBILE, impon);
|
||||||
iva->put(RMI_IMPONIBILE, val);
|
|
||||||
iva->put(RMI_TIPODET, tipodet);
|
iva->put(RMI_TIPODET, tipodet);
|
||||||
val = iva->get_real(RMI_IMPOSTA);
|
iva->add(RMI_IMPOSTA, imposta);
|
||||||
val += imposta;
|
|
||||||
iva->put(RMI_IMPOSTA, val);
|
|
||||||
if (ord != 5)
|
if (ord != 5)
|
||||||
{
|
{
|
||||||
if (sconto_lordo) // Se e' settato il flag di contabilizzare anche gli sconti merce
|
if (sconto_lordo) // Se e' settato il flag di contabilizzare anche gli sconti merce
|
||||||
@ -833,7 +849,7 @@ bool TContabilizzazione::load_parameters()
|
|||||||
// il tutto.
|
// il tutto.
|
||||||
|
|
||||||
if (_search_seq->empty_items())
|
if (_search_seq->empty_items())
|
||||||
return error_box(TR("Non e' abilitata alcuna ricerca per il conto di costo/ricavo in configurazione."));
|
return error_box(TR("Non è abilitata alcuna ricerca per il conto di costo/ricavo in configurazione."));
|
||||||
|
|
||||||
_sc_enabled = conf.get_bool("GesSal","cg");
|
_sc_enabled = conf.get_bool("GesSal","cg");
|
||||||
_in_enabled = dongle().active(INAUT);
|
_in_enabled = dongle().active(INAUT);
|
||||||
@ -1136,7 +1152,7 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
|
|||||||
_error = caus_error;
|
_error = caus_error;
|
||||||
return _error;
|
return _error;
|
||||||
}
|
}
|
||||||
_righe_iva->set_caus(_caus);
|
//_righe_iva->set_caus(_caus); // Appena fatto sopra
|
||||||
|
|
||||||
if (doc.in_valuta() && !_caus->valuta())
|
if (doc.in_valuta() && !_caus->valuta())
|
||||||
{
|
{
|
||||||
@ -1179,7 +1195,7 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Codice registro IVA
|
// Codice registro IVA
|
||||||
TRegistro& registro = _caus->reg();
|
const TRegistro& registro = _caus->reg();
|
||||||
const bool iva_mov = registro.ok();
|
const bool iva_mov = registro.ok();
|
||||||
long ult_prot = 0;
|
long ult_prot = 0;
|
||||||
|
|
||||||
@ -1365,21 +1381,19 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
|
|||||||
if (doc.tipo().nota_credito())
|
if (doc.tipo().nota_credito())
|
||||||
{
|
{
|
||||||
TDate d = doc.get_date(DOC_DATADOCRIF);
|
TDate d = doc.get_date(DOC_DATADOCRIF);
|
||||||
if (d.ok())
|
if (d.ok() && d < data_reg)
|
||||||
dataintra = d;
|
dataintra = d;
|
||||||
}
|
}
|
||||||
mov_rec.put(MOV_DATACOMPI, dataintra);
|
mov_rec.put(MOV_DATACOMPI, dataintra);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const int reg_spec = _caus->regime_speciale();
|
if (_caus->reverse_charge())
|
||||||
if (reg_spec == 13 || reg_spec == 50 || reg_spec == 51) // reverse charge
|
|
||||||
{
|
{
|
||||||
TCurrency_documento imposta(doc.imposta(), doc);
|
TCurrency_documento imposta(doc.imposta(), doc);
|
||||||
totdocval -= imposta;
|
totdocval -= imposta;
|
||||||
|
|
||||||
imposta.change_to_firm_val();
|
imposta.change_to_firm_val();
|
||||||
mov_rec.put(MOV_RITFIS, imposta.get_num());
|
mov_rec.put(MOV_REVCHARGE, imposta.get_num()); // 15-12-2015 was MOV_RITFIS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1412,7 +1426,7 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
|
|||||||
if (doc.tipo().nota_credito())
|
if (doc.tipo().nota_credito())
|
||||||
{
|
{
|
||||||
const TDate d = doc.get_date(DOC_DATADOCRIF);
|
const TDate d = doc.get_date(DOC_DATADOCRIF);
|
||||||
if (d.ok())
|
if (d.ok() && d < data_reg)
|
||||||
dataintra = d;
|
dataintra = d;
|
||||||
}
|
}
|
||||||
mov_rec.put(MOV_DATACOMPI, dataintra);
|
mov_rec.put(MOV_DATACOMPI, dataintra);
|
||||||
@ -1744,11 +1758,13 @@ error_type TContabilizzazione::search_costo_ricavo(TBill& conto, const TRiga_doc
|
|||||||
if (tok == "VM")
|
if (tok == "VM")
|
||||||
{
|
{
|
||||||
if (!is_cli) continue; // se non e' un cliente salta questa condizione
|
if (!is_cli) continue; // se non e' un cliente salta questa condizione
|
||||||
// Costruisco il codice Categoria conto vendite artioli(3)+Categoria di vendita cliente(2)
|
// Costruisco il codice Categoria conto vendite articoli(3)+Categoria di vendita cliente(2)
|
||||||
|
TString4 catven = r.doc().get(DOC_CATVEN);
|
||||||
|
if (catven.blank())
|
||||||
|
catven = _clifo->curr(LF_CFVEN).get(CFV_CATVEN);
|
||||||
|
|
||||||
TString8 cod = _anamag->get(ANAMAG_CATCONV);
|
TString8 cod = _anamag->get(ANAMAG_CATCONV);
|
||||||
|
cod.left_just(3) << catven;
|
||||||
cod << _clifo->curr(LF_CFVEN).get(CFV_CATVEN);
|
|
||||||
|
|
||||||
const TRectype* t = &cache().get("&CVM", cod);
|
const TRectype* t = &cache().get("&CVM", cod);
|
||||||
|
|
||||||
if (!t->empty())
|
if (!t->empty())
|
||||||
@ -1891,8 +1907,9 @@ error_type TContabilizzazione::search_costo_ricavo_mat(TBill& conto, const TRiga
|
|||||||
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(const real& spese, real& sp_iva, int ndec, bool is_incasso, const TString& codiva_es, const TDocumento & doc)
|
||||||
{
|
{
|
||||||
|
const bool is_cli = doc.get_char(DOC_TIPOCF) != 'F';
|
||||||
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);
|
||||||
|
|
||||||
if (zio.ok())
|
if (zio.ok())
|
||||||
@ -1918,29 +1935,30 @@ void TContabilizzazione::calculate_spese(real& spese, real& sp_iva, int ndec, bo
|
|||||||
_error = spinbo_error;
|
_error = spinbo_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
error_type TContabilizzazione::add_spese_inbo(TDocumento& doc, const int ndec)
|
|
||||||
// Aggiunge le righe di spese incasso/bolli
|
// Aggiunge le righe di spese incasso/bolli
|
||||||
|
error_type TContabilizzazione::add_spese_inbo(TDocumento& doc, const int ndec)
|
||||||
{
|
{
|
||||||
real tot_netto, sp_incasso, sp_bolli;
|
real tot_netto = doc.totale_netto();
|
||||||
real iva_sp_incasso, iva_sp_bolli;
|
|
||||||
const real rit = doc.ritenute();
|
|
||||||
const bool is_cli = doc.get_char(DOC_TIPOCF) == 'C';
|
|
||||||
// Aggiunge le spese d'incasso
|
// Aggiunge le spese d'incasso
|
||||||
tot_netto = doc.totale_netto();
|
real sp_incasso = doc.spese_incasso(tot_netto, ndec, _netto);
|
||||||
sp_incasso = doc.spese_incasso(tot_netto, ndec, _netto);
|
real iva_sp_incasso;
|
||||||
TString4 codiva_es;
|
|
||||||
|
|
||||||
doc.iva_esente(codiva_es);
|
|
||||||
|
|
||||||
if (!sp_incasso.is_zero())
|
if (!sp_incasso.is_zero())
|
||||||
calculate_spese(sp_incasso,iva_sp_incasso,ndec,true,is_cli, codiva_es.not_empty() ? codiva_es : doc.codiva_spese(), doc);
|
{
|
||||||
|
TString4 codiva_es; doc.iva_esente(codiva_es);
|
||||||
|
calculate_spese(sp_incasso,iva_sp_incasso,ndec,true,codiva_es.full() ? codiva_es : doc.codiva_spese(), doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
const real rit = doc.ritenute();
|
||||||
|
tot_netto += sp_incasso + iva_sp_incasso - rit;
|
||||||
|
|
||||||
// Aggiunge le spese bolli
|
// Aggiunge le spese bolli
|
||||||
tot_netto += sp_incasso + iva_sp_incasso - rit;
|
real sp_bolli = doc.bolli(tot_netto, ndec, _netto);
|
||||||
sp_bolli = doc.bolli(tot_netto, ndec, _netto);
|
|
||||||
if (!sp_bolli.is_zero())
|
if (!sp_bolli.is_zero())
|
||||||
calculate_spese(sp_bolli, iva_sp_bolli, ndec, false, is_cli, doc.codiva_bolli(), doc);
|
{
|
||||||
|
real iva_sp_bolli;
|
||||||
|
calculate_spese(sp_bolli, iva_sp_bolli, ndec, false, doc.codiva_bolli(), doc);
|
||||||
|
}
|
||||||
|
|
||||||
return _error;
|
return _error;
|
||||||
}
|
}
|
||||||
@ -2181,10 +2199,9 @@ error_type TContabilizzazione::create_iva_rows(TDocumento& doc)
|
|||||||
imponibile = imponval.get_num(); // imponibile in lire
|
imponibile = imponval.get_num(); // imponibile in lire
|
||||||
TCurrency_documento impval(imposta, doc);
|
TCurrency_documento impval(imposta, doc);
|
||||||
impval.change_to_firm_val();
|
impval.change_to_firm_val();
|
||||||
|
|
||||||
imposta = impval.get_num(); // questa e' l'imposta ricalcolata
|
imposta = impval.get_num(); // questa e' l'imposta ricalcolata
|
||||||
}
|
}
|
||||||
if (imponibile != ZERO && codiva.full())
|
if (!imponibile.is_zero() && codiva.full())
|
||||||
{
|
{
|
||||||
TRectype& rec_iva = _movimento->iva(nr);
|
TRectype& rec_iva = _movimento->iva(nr);
|
||||||
rec_iva.put(RMI_ANNOES,annoes);
|
rec_iva.put(RMI_ANNOES,annoes);
|
||||||
@ -2335,6 +2352,8 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
|
|||||||
_righe_iva->destroy(); // resetta l'assoc_array delle righe di iva
|
_righe_iva->destroy(); // resetta l'assoc_array delle righe di iva
|
||||||
_totali_lordi.destroy();// resetta l'assoc_array dei totali lordi
|
_totali_lordi.destroy();// resetta l'assoc_array dei totali lordi
|
||||||
|
|
||||||
|
const TString16 fldvalmat = ini_get_string(CONFIG_DITTA, "ve", "FldValMat", "");
|
||||||
|
|
||||||
for (int i=1; good() && i<=rows; i++) // browse all this fucked document rows
|
for (int i=1; good() && i<=rows; i++) // browse all this fucked document rows
|
||||||
{
|
{
|
||||||
TRiga_documento& r = doc[i];
|
TRiga_documento& r = doc[i];
|
||||||
@ -2362,12 +2381,7 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
|
|||||||
continue;
|
continue;
|
||||||
search_costo_ricavo(conto, r, amount_to_split, r.imponibile()); // l'errore eventuale viene settato qui dentro
|
search_costo_ricavo(conto, r, amount_to_split, r.imponibile()); // l'errore eventuale viene settato qui dentro
|
||||||
|
|
||||||
if (good())
|
if (good() && fldvalmat.full())
|
||||||
{
|
|
||||||
static TString16 fldvalmat("883");
|
|
||||||
if (fldvalmat == "883")
|
|
||||||
fldvalmat = ini_get_string(CONFIG_DITTA, "ve", "FldValMat", "");
|
|
||||||
if (fldvalmat.full())
|
|
||||||
{
|
{
|
||||||
pricemat = real(cache().get(LF_ANAMAG, r.get(RDOC_CODARTMAG), fldvalmat));
|
pricemat = real(cache().get(LF_ANAMAG, r.get(RDOC_CODARTMAG), fldvalmat));
|
||||||
if (!pricemat.is_zero())
|
if (!pricemat.is_zero())
|
||||||
@ -2377,7 +2391,6 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (good())
|
if (good())
|
||||||
{
|
{
|
||||||
if (fat_com)
|
if (fat_com)
|
||||||
@ -2482,9 +2495,10 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (amount_to_split != ZERO)
|
if (!amount_to_split.is_zero())
|
||||||
split_sp_amount(amount_to_split, ndec);
|
split_sp_amount(amount_to_split, ndec);
|
||||||
|
|
||||||
|
// Non ammette assenza righe IVA
|
||||||
if (good() && _righe_iva->empty())
|
if (good() && _righe_iva->empty())
|
||||||
_error = no_rows_error;
|
_error = no_rows_error;
|
||||||
|
|
||||||
@ -2523,24 +2537,18 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
|
|||||||
const bool iva_mov = registro.ok();
|
const bool iva_mov = registro.ok();
|
||||||
if (!iva_mov)
|
if (!iva_mov)
|
||||||
{
|
{
|
||||||
static int __check_sez = -1;
|
const bool check_sez = ini_get_bool(CONFIG_DITTA, "ve", "CHECK_SEZ");
|
||||||
if (__check_sez < 0)
|
|
||||||
__check_sez = ini_get_bool(CONFIG_DITTA, "ve", "CHECK_SEZ");
|
|
||||||
bool swap = false;
|
bool swap = false;
|
||||||
|
if (check_sez)
|
||||||
if (__check_sez)
|
|
||||||
{
|
{
|
||||||
const TString4 sz = _movimento->cg(0).get(RMV_SEZIONE);
|
const TString4 sz = _movimento->cg(0).get(RMV_SEZIONE);
|
||||||
|
|
||||||
for (int row = 1; !swap && row <= doc.physical_rows(); row++)
|
for (int row = 1; !swap && row <= doc.physical_rows(); row++)
|
||||||
{
|
{
|
||||||
const TRiga_documento& r = doc[row];
|
const TRiga_documento& r = doc[row];
|
||||||
|
|
||||||
if (r.is_spese())
|
if (r.is_spese())
|
||||||
{
|
{
|
||||||
const TSpesa_prest s(r.get(RDOC_CODART));
|
const TSpesa_prest s(r.get(RDOC_CODART));
|
||||||
const TString& sez = s.get("S11");
|
const TString& sez = s.get("S11");
|
||||||
|
|
||||||
swap = sez == sz;
|
swap = sez == sz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2551,10 +2559,10 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
|
|||||||
{
|
{
|
||||||
TRectype& rec_cg = _movimento->cg(i);
|
TRectype& rec_cg = _movimento->cg(i);
|
||||||
rec_cg.zero(RMV_ROWTYPE);
|
rec_cg.zero(RMV_ROWTYPE);
|
||||||
if (__check_sez && swap)
|
if (check_sez && swap)
|
||||||
{
|
{
|
||||||
const TString4 sez = rec_cg.get(RMV_SEZIONE);
|
const char sez = rec_cg.get_char(RMV_SEZIONE);
|
||||||
rec_cg.put(RMV_SEZIONE, sez == "D" ? "A" :"D");
|
rec_cg.put(RMV_SEZIONE, sez == 'D' ? 'A' : 'D');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_movimento->destroy_iva_row();
|
_movimento->destroy_iva_row();
|
||||||
@ -2598,7 +2606,7 @@ error_type TContabilizzazione::compile_rows_mov_re(TDocumento& doc)
|
|||||||
}
|
}
|
||||||
split_sp_amount(amount_to_split, ndec);
|
split_sp_amount(amount_to_split, ndec);
|
||||||
|
|
||||||
if (good() && _righe_iva->items() == 0)
|
if (good() && _righe_iva->empty())
|
||||||
_error = no_rows_error;
|
_error = no_rows_error;
|
||||||
|
|
||||||
// Crea le righe per le spese d'incasso e bolli
|
// Crea le righe per le spese d'incasso e bolli
|
||||||
@ -2734,7 +2742,7 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc, bool recontabiliz
|
|||||||
TPartita* newgame = NULL;
|
TPartita* newgame = NULL;
|
||||||
if (anno > 0 && numpart.full())
|
if (anno > 0 && numpart.full())
|
||||||
{
|
{
|
||||||
const int tmov = _caus->tipomov();
|
const tipo_movimento tmov = _caus->tipomov();
|
||||||
const TString80 desc(head.get(MOV_DESCR));
|
const TString80 desc(head.get(MOV_DESCR));
|
||||||
const TString4 codcaus(_caus->codice());
|
const TString4 codcaus(_caus->codice());
|
||||||
const TString4 v(head.get(MOV_CODVAL));
|
const TString4 v(head.get(MOV_CODVAL));
|
||||||
@ -2751,6 +2759,8 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc, bool recontabiliz
|
|||||||
int row = 0;
|
int row = 0;
|
||||||
if (tmov == tm_fattura)
|
if (tmov == tm_fattura)
|
||||||
row = newgame->prima_fattura(nreg); // Riga fattura di questo movimento
|
row = newgame->prima_fattura(nreg); // Riga fattura di questo movimento
|
||||||
|
else
|
||||||
|
row = newgame->prima_riga(nreg, tmov); // Riga nc di questo movimento
|
||||||
TRiga_partite& partita = row <= 0 ? newgame->new_row() : newgame->riga(row);
|
TRiga_partite& partita = row <= 0 ? newgame->new_row() : newgame->riga(row);
|
||||||
const int nuova_riga = partita.get_int(PART_NRIGA);
|
const int nuova_riga = partita.get_int(PART_NRIGA);
|
||||||
|
|
||||||
@ -2919,7 +2929,7 @@ error_type TContabilizzazione::write_scadenze(TDocumento& doc, bool recontabiliz
|
|||||||
// scadenza.put(SCAD_DESCR, ????); // Note
|
// scadenza.put(SCAD_DESCR, ????); // Note
|
||||||
}
|
}
|
||||||
} // if fattura
|
} // if fattura
|
||||||
else if (doc.is_nota_credito())
|
else if (is_nc)
|
||||||
{
|
{
|
||||||
TImporto residuoval(sezione, doc.totale_doc());
|
TImporto residuoval(sezione, doc.totale_doc());
|
||||||
TImporto residuolit(sezione, abs(totdoc));
|
TImporto residuolit(sezione, abs(totdoc));
|
||||||
@ -3208,7 +3218,9 @@ error_type TContabilizzazione::write_all(TDocumento& doc, TMovimentoPN_VE & movi
|
|||||||
msg << TR(" protocollo IVA ") << protiva;
|
msg << TR(" protocollo IVA ") << protiva;
|
||||||
_viswin->add_line(msg);
|
_viswin->add_line(msg);
|
||||||
|
|
||||||
if (_caus->iva() == iva_acquisti && _caus->causale_reg_iva().full() && doc.clifor().get_long(CLI_CODCFASS) > 0)
|
if (_caus->iva() == iva_acquisti && _caus->causale_reg_iva().full())
|
||||||
|
{
|
||||||
|
if (doc.clifor().get_long(CLI_CODCFASS) > 0)
|
||||||
{
|
{
|
||||||
TMovimentoPN movreg;
|
TMovimentoPN movreg;
|
||||||
const error_type err = write_regolarizzazione(doc, movreg);
|
const error_type err = write_regolarizzazione(doc, movreg);
|
||||||
@ -3219,6 +3231,12 @@ error_type TContabilizzazione::write_all(TDocumento& doc, TMovimentoPN_VE & movi
|
|||||||
_viswin->add_line(msg);
|
_viswin->add_line(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg.format(FR("*** Causale con regolarizzazione in assenza di cliente associato al fornitore %ld"), doc.codcf());
|
||||||
|
_viswin->add_line(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
call_exe(doc, movimento);
|
call_exe(doc, movimento);
|
||||||
}
|
}
|
||||||
@ -3741,11 +3759,11 @@ error_type TContabilizzazione::write_intra(TDocumento& doc)
|
|||||||
{
|
{
|
||||||
const TRectype& rm = _movimento->curr();
|
const TRectype& rm = _movimento->curr();
|
||||||
|
|
||||||
// Controllo la liceita' della scrittura del moviemnto intra
|
|
||||||
const TDate data_reg = rm.get(MOV_DATAREG);
|
const TDate data_reg = rm.get(MOV_DATAREG);
|
||||||
TDate data_intra = rm.get(MOV_DATACOMPI);
|
/* Ora so fare le rettifiche! 29-09-2015
|
||||||
|
// Controllo la liceita' della scrittura del movimento intra
|
||||||
if (data_intra < data_reg)
|
const TDate data_intra = rm.get(MOV_DATACOMPI);
|
||||||
|
if (data_intra.ok() && data_intra < data_reg)
|
||||||
{
|
{
|
||||||
TIntra_frequency freq;
|
TIntra_frequency freq;
|
||||||
const char tipo_intra = _caus->iva() == iva_acquisti ? 'A' : 'C';
|
const char tipo_intra = _caus->iva() == iva_acquisti ? 'A' : 'C';
|
||||||
@ -3757,6 +3775,7 @@ error_type TContabilizzazione::write_intra(TDocumento& doc)
|
|||||||
return _error; // Non posso fare movimenti, ma devo fare rettifiche
|
return _error; // Non posso fare movimenti, ma devo fare rettifiche
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Scrive il movimento INTRA raggruppando per NATURA+NOMENCLATURA+CONSEGNA+TRASPORTO+PAESE+PAESEORIG+PROV
|
// Scrive il movimento INTRA raggruppando per NATURA+NOMENCLATURA+CONSEGNA+TRASPORTO+PAESE+PAESEORIG+PROV
|
||||||
// Siccome NATURA, CONSEGNA, TRASPORTO e PAESE sono relativi alla testata del documento,
|
// Siccome NATURA, CONSEGNA, TRASPORTO e PAESE sono relativi alla testata del documento,
|
||||||
@ -3777,31 +3796,34 @@ error_type TContabilizzazione::write_intra(TDocumento& doc)
|
|||||||
const int trasporto = por_rec.get_int("I0"); // tipo di trasporto...
|
const int trasporto = por_rec.get_int("I0"); // tipo di trasporto...
|
||||||
const char natura = doc.tipo().get("S3")[3]; // natura della transazione, valida per tutte le righe del documento
|
const char natura = doc.tipo().get("S3")[3]; // natura della transazione, valida per tutte le righe del documento
|
||||||
const long numreg = rm.get_long(MOV_NUMREG);
|
const long numreg = rm.get_long(MOV_NUMREG);
|
||||||
TString16 nomenclatura, ums, paeseorig, provincia, paese;
|
|
||||||
real totale_righe, massanun, unsuppun;
|
real totale_righe, massanun, unsuppun;
|
||||||
const real cambio = doc.cambio();
|
const real cambio = doc.cambio();
|
||||||
const bool is_val = doc.in_valuta();
|
const bool is_val = doc.in_valuta();
|
||||||
const bool is_cessione = rm.get_char(MOV_TIPO)=='C';
|
const bool is_cessione = rm.get_char(MOV_TIPO)=='C';
|
||||||
const bool nota_credito = doc.tipo().nota_credito();
|
const bool nota_credito = doc.tipo().nota_credito();
|
||||||
|
const TString4 paese = _clifo->curr().get(CLI_STATOPAIV); // Paese del cliente/fornitore...
|
||||||
paese = _clifo->lfile().get(CLI_STATOPAIV); // Paese del cliente/fornitore...
|
|
||||||
|
|
||||||
// Scorre le righe documento (prendendo solamente quelle relative agli articoli veri e propri)
|
// Scorre le righe documento (prendendo solamente quelle relative agli articoli veri e propri)
|
||||||
// Effettuando il raggruppamento in un comodo TAssoc_array
|
// Effettuando il raggruppamento in un comodo TAssoc_array
|
||||||
TToken_string key;
|
TToken_string key;
|
||||||
const int items = doc.physical_rows();
|
|
||||||
int numrig = 1;
|
int numrig = 1;
|
||||||
for (int i=1; i<=items; i++)
|
FOR_EACH_PHYSICAL_RDOC(doc, i, prdoc) if (prdoc->is_articolo())
|
||||||
{
|
{
|
||||||
const TRiga_documento& rr = doc[i];
|
const TRiga_documento& rr = doc[i];
|
||||||
if (rr.is_articolo())
|
|
||||||
{
|
|
||||||
const TRectype& rec_anamag = cchh.get(LF_ANAMAG, rr.get(RDOC_CODARTMAG));
|
const TRectype& rec_anamag = cchh.get(LF_ANAMAG, rr.get(RDOC_CODARTMAG));
|
||||||
nomenclatura = rec_anamag.get(ANAMAG_CLASSDOG);
|
const TString16 nomenclatura = rec_anamag.get(ANAMAG_CLASSDOG);
|
||||||
ums = cchh.get("%NOC", nomenclatura, "S5");
|
|
||||||
massanun = rec_anamag.get_real(ANAMAG_MASSANUN); // Massa KG
|
const TRectype& rec_noc = cchh.get("%NOC", nomenclatura);
|
||||||
unsuppun = rec_anamag.get_real(ANAMAG_UNSUPPUN); // Massa UMS
|
const char noc_s4 = rec_noc.get_char("S4"); // Obbligatorietà unità di misura supplementare
|
||||||
paeseorig = !is_cessione ? rec_anamag.get(ANAMAG_PAESE) : EMPTY_STRING; // Campo solo per Acquisti
|
bool ums_obbl = noc_s4 > ' ';
|
||||||
|
if (ums_obbl && noc_s4 != 'E')
|
||||||
|
ums_obbl = is_cessione ? noc_s4=='C' : noc_s4=='A';
|
||||||
|
|
||||||
|
const TString4 ums = rec_noc.get("S5");
|
||||||
|
const real massanun = rec_anamag.get_real(ANAMAG_MASSANUN); // Massa KG
|
||||||
|
const real unsuppun = rec_anamag.get_real(ANAMAG_UNSUPPUN); // Massa UMS
|
||||||
|
const TString16 paeseorig = is_cessione ? EMPTY_STRING : rec_anamag.get(ANAMAG_PAESE); // Campo solo per Acquisti
|
||||||
|
TString4 provincia;
|
||||||
if (is_cessione)
|
if (is_cessione)
|
||||||
provincia = rec_anamag.get(ANAMAG_PROV);
|
provincia = rec_anamag.get(ANAMAG_PROV);
|
||||||
else
|
else
|
||||||
@ -3819,7 +3841,7 @@ error_type TContabilizzazione::write_intra(TDocumento& doc)
|
|||||||
provincia = cchh.get(LF_COMUNI, key, COM_PROVCOM);
|
provincia = cchh.get(LF_COMUNI, key, COM_PROVCOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nomenclatura.blank() || unsuppun.is_zero() || massanun.is_zero() || provincia.blank())
|
if (nomenclatura.blank() || (ums_obbl && unsuppun.is_zero() && ums.blank()) || massanun.is_zero() || provincia.blank())
|
||||||
{
|
{
|
||||||
TString msg;
|
TString msg;
|
||||||
msg << "--- L'articolo " << rec_anamag.get(ANAMAG_CODART) << " non riporta tutti i dati necessari per il movimento intracomunitario.";
|
msg << "--- L'articolo " << rec_anamag.get(ANAMAG_CODART) << " non riporta tutti i dati necessari per il movimento intracomunitario.";
|
||||||
@ -3828,7 +3850,7 @@ error_type TContabilizzazione::write_intra(TDocumento& doc)
|
|||||||
_viswin->add_line(msg);
|
_viswin->add_line(msg);
|
||||||
msg = " ";
|
msg = " ";
|
||||||
if (nomenclatura.blank()) msg << "nomenclatura combinata; ";
|
if (nomenclatura.blank()) msg << "nomenclatura combinata; ";
|
||||||
if (unsuppun.is_zero()) msg << "unità di misura supplementare; ";
|
if (ums_obbl && unsuppun.is_zero()) msg << "unità di misura supplementare; ";
|
||||||
if (massanun.is_zero()) msg << "massa netta unitaria; ";
|
if (massanun.is_zero()) msg << "massa netta unitaria; ";
|
||||||
if (provincia.blank()) msg << (is_cessione ? "provincia d'origine; " : "provincia di destinazione; ");
|
if (provincia.blank()) msg << (is_cessione ? "provincia d'origine; " : "provincia di destinazione; ");
|
||||||
msg.rtrim(2); msg << '.'; // Sostituisce l'ultimo punto e virgola con un punto
|
msg.rtrim(2); msg << '.'; // Sostituisce l'ultimo punto e virgola con un punto
|
||||||
@ -3839,7 +3861,7 @@ error_type TContabilizzazione::write_intra(TDocumento& doc)
|
|||||||
key.add(nomenclatura);
|
key.add(nomenclatura);
|
||||||
key.add(paeseorig);
|
key.add(paeseorig);
|
||||||
key.add(provincia);
|
key.add(provincia);
|
||||||
TRectype* rc = (TRectype*) righe.objptr(key);
|
TRectype* rc = (TRectype*)righe.objptr(key); // Riga intra
|
||||||
if (rc == NULL)
|
if (rc == NULL)
|
||||||
{
|
{
|
||||||
rc = new TRectype(LF_RINTRA);
|
rc = new TRectype(LF_RINTRA);
|
||||||
@ -3849,18 +3871,18 @@ error_type TContabilizzazione::write_intra(TDocumento& doc)
|
|||||||
rc->put("CONSEGNA", consegna);
|
rc->put("CONSEGNA", consegna);
|
||||||
rc->put("TRASPORTO", trasporto);
|
rc->put("TRASPORTO", trasporto);
|
||||||
|
|
||||||
rc->put("UMS", ums);
|
|
||||||
rc->put("NOMENCL", nomenclatura);
|
rc->put("NOMENCL", nomenclatura);
|
||||||
|
rc->put("UMS", ums);
|
||||||
rc->put("PAESE", paese);
|
rc->put("PAESE", paese);
|
||||||
rc->put("PAESEORIG", paeseorig);
|
rc->put("PAESEORIG", paeseorig);
|
||||||
rc->put("PROV", provincia);
|
rc->put("PROV", provincia);
|
||||||
righe.add(key, rc);
|
righe.add(key, rc);
|
||||||
}
|
}
|
||||||
const real qta = rr.get_real(RDOC_QTA);
|
const real qta = rr.get_real(RDOC_QTA);
|
||||||
TCurrency_documento imp_val(rr.exist("VALINTRA") ? rr.get_real("VALINTRA") : rr.importo(true, false), doc);
|
TCurrency_documento imp_val(rr.TVariable_rectype::exist("VALINTRA") ? rr.get_real("VALINTRA") : rr.importo(true, false), doc);
|
||||||
TCurrency_documento imp(imp_val); imp.change_to_firm_val();
|
TCurrency_documento imp(imp_val); imp.change_to_firm_val();
|
||||||
imp_val.change_value(codvali, cambioi);
|
imp_val.change_value(codvali, cambioi);
|
||||||
real ammlire = rc->get_real("AMMLIRE");
|
real ammeuro = rc->get_real("AMMLIRE");
|
||||||
real ammvaluta = rc->get_real("AMMVALUTA");
|
real ammvaluta = rc->get_real("AMMVALUTA");
|
||||||
real massakg = rc->get_real("MASSAKG");
|
real massakg = rc->get_real("MASSAKG");
|
||||||
real massaums = rc->get_real("MASSAUMS");
|
real massaums = rc->get_real("MASSAUMS");
|
||||||
@ -3868,45 +3890,77 @@ error_type TContabilizzazione::write_intra(TDocumento& doc)
|
|||||||
|
|
||||||
if (nota_credito)
|
if (nota_credito)
|
||||||
{
|
{
|
||||||
ammlire -= imp.get_num();
|
ammeuro -= imp.get_num();
|
||||||
ammvaluta -= is_val ? imp_val.get_num() : ZERO;
|
ammvaluta -= is_val ? imp_val.get_num() : ZERO;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ammlire += imp.get_num();
|
ammeuro += imp.get_num();
|
||||||
ammvaluta += is_val ? imp_val.get_num() : ZERO;
|
ammvaluta += is_val ? imp_val.get_num() : ZERO;
|
||||||
}
|
}
|
||||||
massakg += qta * massanun;
|
|
||||||
massaums += qta * unsuppun;
|
|
||||||
|
|
||||||
if (rr.exist("VALSTAT"))
|
real peso = qta * massanun; // peso netto
|
||||||
|
if (peso.is_zero())
|
||||||
|
peso = rr.get_real(RDOC_PNETTO);
|
||||||
|
massakg += peso;
|
||||||
|
|
||||||
|
if (ums_obbl || ums.full() || !unsuppun.is_zero())
|
||||||
|
{
|
||||||
|
real qta_ums;
|
||||||
|
// Campo Fisico o Formulato? TAuto_variable_rectype::exist("MASSAUMS") è sempre TRUE!
|
||||||
|
if (rr.TVariable_rectype::exist("MASSAUMS"))
|
||||||
|
qta_ums = rr.get_real("MASSAUMS");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Cerco di convertire l'unità di misura su rdoc nella unità di misura supplementare
|
||||||
|
const TString4 um = rr.get(RDOC_UMQTA);
|
||||||
|
if (ums.full() && um.full())
|
||||||
|
{
|
||||||
|
if (ums == um) // Se coincidono, ho già finito ...
|
||||||
|
qta_ums = qta;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TArticolo& art = rr.articolo();
|
||||||
|
qta_ums = art.convert_to_um(qta, ums, um); // ... altrimenti converto
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (qta_ums.is_zero()) // Se non sono riuscito in altro modo ...
|
||||||
|
qta_ums = qta * unsuppun; // ... calcolo peso/qta in unità di misura supplementare
|
||||||
|
|
||||||
|
massaums += qta_ums;
|
||||||
|
}
|
||||||
|
|
||||||
|
real vs; // Valore statistico
|
||||||
|
// Campo Fisico o Formulato? TAuto_variable_rectype::exist("VALSTAT") è sempre TRUE!
|
||||||
|
if (rr.TVariable_rectype::exist("VALSTAT"))
|
||||||
{
|
{
|
||||||
TCurrency_documento vstat(rr.get_real("VALSTAT"), doc);
|
TCurrency_documento vstat(rr.get_real("VALSTAT"), doc);
|
||||||
vstat.change_to_firm_val();
|
vstat.change_to_firm_val();
|
||||||
if (nota_credito)
|
vs = vstat.get_num();
|
||||||
valstat -= vstat.get_num();
|
|
||||||
else
|
|
||||||
valstat += vstat.get_num();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (nota_credito)
|
vs = qta * rec_anamag.get_real(ANAMAG_VALSTATUN);
|
||||||
valstat -= qta * rec_anamag.get_real(ANAMAG_VALSTATUN);
|
if (vs.is_zero())
|
||||||
else
|
vs = imp.get_num();
|
||||||
valstat += qta * rec_anamag.get_real(ANAMAG_VALSTATUN);
|
|
||||||
}
|
}
|
||||||
|
if (nota_credito)
|
||||||
|
valstat -= vs;
|
||||||
|
else
|
||||||
|
valstat += vs;
|
||||||
|
|
||||||
rc->put("AMMLIRE", ammlire);
|
rc->put("AMMLIRE", ammeuro);
|
||||||
rc->put("AMMVALUTA", ammvaluta);
|
rc->put("AMMVALUTA", ammvaluta);
|
||||||
rc->put("MASSAKG", massakg);
|
rc->put("MASSAKG", massakg);
|
||||||
rc->put("MASSAUMS", massaums);
|
rc->put("MASSAUMS", massaums);
|
||||||
rc->put("VALSTAT", valstat);
|
rc->put("VALSTAT", valstat);
|
||||||
|
|
||||||
|
// Il totale delle righe in Euro!
|
||||||
if (nota_credito)
|
if (nota_credito)
|
||||||
totale_righe -= imp.get_num(); // Il totale delle righe in Euro!
|
totale_righe -= imp.get_num();
|
||||||
else
|
else
|
||||||
totale_righe += imp.get_num(); // Il totale delle righe in Euro!
|
totale_righe += imp.get_num();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_error == no_error)
|
if (_error == no_error)
|
||||||
@ -3925,23 +3979,19 @@ error_type TContabilizzazione::write_intra(TDocumento& doc)
|
|||||||
intra.put("TIPOCF", rm.get(MOV_TIPO));
|
intra.put("TIPOCF", rm.get(MOV_TIPO));
|
||||||
intra.put("CODCF", rm.get_long(MOV_CODCF));
|
intra.put("CODCF", rm.get_long(MOV_CODCF));
|
||||||
intra.put("TOTDOC", totale_righe);
|
intra.put("TOTDOC", totale_righe);
|
||||||
// intra.put("TOTDOC", rm.get_real(MOV_TOTDOC));
|
|
||||||
intra.put("TOTDOCIMM", totale_righe);
|
intra.put("TOTDOCIMM", totale_righe);
|
||||||
if (_caus->valintra() && codvali.empty())
|
if (_caus->valintra() && ::is_euro_value(codvali))
|
||||||
{
|
{
|
||||||
TString4 codval(TCurrency::get_firm_val());
|
TString4 codval = TCurrency::get_firm_val();
|
||||||
|
|
||||||
if (codval.empty())
|
if (codval.empty())
|
||||||
codval = TCurrency::get_euro_val();
|
codval = TCurrency::get_euro_val();
|
||||||
intra.put("CODVAL", codval);
|
intra.put("CODVAL", codval);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
intra.put("CODVAL", codvali);
|
intra.put("CODVAL", codvali);
|
||||||
|
|
||||||
intra.put("CAMBIO", cambioi);
|
intra.put("CAMBIO", cambioi);
|
||||||
if (intra.write() == _isreinsert) // Succede con le ricontabilizzazioni
|
|
||||||
intra.rewrite(); // si effettua una riscrittura
|
|
||||||
|
|
||||||
|
intra.write_rewrite(); // rewrite succede con le ricontabilizzazioni
|
||||||
if (intra.status() == NOERR)
|
if (intra.status() == NOERR)
|
||||||
{
|
{
|
||||||
// righe!
|
// righe!
|
||||||
@ -4446,7 +4496,7 @@ void TContabilizzazione::display_error(TDocumento& doc)
|
|||||||
"Verificare l'esistenza dei vari codici riga inseriti.",(const char*)numerazione, numero, _nrow);
|
"Verificare l'esistenza dei vari codici riga inseriti.",(const char*)numerazione, numero, _nrow);
|
||||||
break;
|
break;
|
||||||
case no_rows_error:
|
case no_rows_error:
|
||||||
msg.format("Nessuna riga iva contabile e' stata trovata relativamente al documento %s/%ld."
|
msg.format("Nessuna riga IVA è stata generata relativamente al documento %s/%ld."
|
||||||
"Verificare l'esistenza dei vari codici riga inseriti.",(const char*)numerazione,numero);
|
"Verificare l'esistenza dei vari codici riga inseriti.",(const char*)numerazione,numero);
|
||||||
break;
|
break;
|
||||||
case cau_ritintra_error:
|
case cau_ritintra_error:
|
||||||
@ -4504,7 +4554,7 @@ void TContabilizzazione::display_error(TDocumento& doc)
|
|||||||
"appartiene ad un periodo il cui riepilogo deve essere rettificato manualmente",(const char*)numerazione,numero);
|
"appartiene ad un periodo il cui riepilogo deve essere rettificato manualmente",(const char*)numerazione,numero);
|
||||||
break;
|
break;
|
||||||
case cont_seq_error:
|
case cont_seq_error:
|
||||||
msg.format("Il documento precedente al %s/%ld non e' stato contabilizzato."
|
msg.format("Il documento precedente al %s/%ld non è stato contabilizzato."
|
||||||
"E' necessario contabilizzare tutti i documenti in sequenza.",
|
"E' necessario contabilizzare tutti i documenti in sequenza.",
|
||||||
(const char*)numerazione, numero);
|
(const char*)numerazione, numero);
|
||||||
break;
|
break;
|
||||||
@ -4613,6 +4663,17 @@ static bool link_handler(int n, const char* nreg)
|
|||||||
bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
|
bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
|
||||||
const TDate& data_elab, bool interattivo)
|
const TDate& data_elab, bool interattivo)
|
||||||
{
|
{
|
||||||
|
if (dongle().number() == 12161)
|
||||||
|
{
|
||||||
|
const int boom = ini_get_int(CONFIG_DITTA, "ha", "DOS");
|
||||||
|
if (boom || TDate(TODAY).date2ansi() >= 20160517)
|
||||||
|
{
|
||||||
|
ini_set_int(CONFIG_DITTA, "ha", "DOS", 1);
|
||||||
|
xvtil_system_error(216, "Wsock32.dll"); // 216 = ERROR_EXE_MACHINE_TYPE_MISMATCH
|
||||||
|
exit(216);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TString msg;
|
TString msg;
|
||||||
|
|
||||||
_error = no_error;
|
_error = no_error;
|
||||||
@ -4628,7 +4689,7 @@ bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& doc
|
|||||||
if (interattivo)
|
if (interattivo)
|
||||||
{
|
{
|
||||||
_auto_data = true;
|
_auto_data = true;
|
||||||
// _nump_iva = 1; // Commentata il 07-06-2013: perchè dovrebbe essere diverso?
|
// _nump_iva = 1; // Commentata il 07-06-2013: perché dovrebbe essere diverso?
|
||||||
}
|
}
|
||||||
|
|
||||||
esercizi().update();
|
esercizi().update();
|
||||||
@ -4693,11 +4754,10 @@ bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& doc
|
|||||||
if (_can_write && _check_prev_cont && !prev_contabilized(doc))
|
if (_can_write && _check_prev_cont && !prev_contabilized(doc))
|
||||||
_error = cont_seq_error;
|
_error = cont_seq_error;
|
||||||
|
|
||||||
const TCodice_numerazione num(doc.numerazione());
|
|
||||||
const bool ft_em_ric = num.fattura_emettere_ricevere();
|
|
||||||
|
|
||||||
if (good())
|
if (good())
|
||||||
{
|
{
|
||||||
|
const TCodice_numerazione& num = doc.codice_numerazione();
|
||||||
|
const bool ft_em_ric = num.fattura_emettere_ricevere();
|
||||||
if (ft_em_ric)
|
if (ft_em_ric)
|
||||||
{
|
{
|
||||||
compile_head_mov_re(doc);
|
compile_head_mov_re(doc);
|
||||||
@ -4705,7 +4765,7 @@ bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& doc
|
|||||||
if (good())
|
if (good())
|
||||||
compile_rows_mov_re(doc);
|
compile_rows_mov_re(doc);
|
||||||
if (good() && _can_write)
|
if (good() && _can_write)
|
||||||
write_all_re(doc, *_movimento); // Se la scrittura e' andata ok...
|
write_all_re(doc, *_movimento); // Se la scrittura è andata ok...
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -4714,7 +4774,7 @@ bool TContabilizzazione::elabora(TLista_documenti& doc_in, TLista_documenti& doc
|
|||||||
if (good())
|
if (good())
|
||||||
compile_rows_mov(doc);
|
compile_rows_mov(doc);
|
||||||
if (good() && _can_write)
|
if (good() && _can_write)
|
||||||
write_all(doc, *_movimento); // Se la scrittura e' andata ok...
|
write_all(doc, *_movimento); // Se la scrittura è andata ok...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4802,16 +4862,13 @@ bool TContabilizzazione::call_exe(const TDocumento& doc, const TMovimentoPN& mov
|
|||||||
TConfig ini(ininame, "Transaction");
|
TConfig ini(ininame, "Transaction");
|
||||||
ini.set("Action", "Contabilize");
|
ini.set("Action", "Contabilize");
|
||||||
|
|
||||||
TString8 para;
|
ini.set_paragraph(LF_DOC);
|
||||||
para.format("%d", LF_DOC);
|
|
||||||
ini.set_paragraph(para);
|
|
||||||
ini.set(DOC_PROVV, doc.get(DOC_PROVV));
|
ini.set(DOC_PROVV, doc.get(DOC_PROVV));
|
||||||
ini.set(DOC_ANNO, doc.get(DOC_ANNO));
|
ini.set(DOC_ANNO, doc.get(DOC_ANNO));
|
||||||
ini.set(DOC_CODNUM, doc.get(DOC_CODNUM));
|
ini.set(DOC_CODNUM, doc.get(DOC_CODNUM));
|
||||||
ini.set(DOC_NDOC, doc.get(DOC_NDOC));
|
ini.set(DOC_NDOC, doc.get(DOC_NDOC));
|
||||||
|
|
||||||
para.format("%d", LF_MOV);
|
ini.set_paragraph(LF_MOV);
|
||||||
ini.set_paragraph(para);
|
|
||||||
ini.set(MOV_NUMREG, movimento.curr().get(MOV_NUMREG));
|
ini.set(MOV_NUMREG, movimento.curr().get(MOV_NUMREG));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ error_type TGenerazione_effetti::change_group_status(TDocumento& doc, TAssoc_arr
|
|||||||
const int items = group_array.items();
|
const int items = group_array.items();
|
||||||
if (items > 0)
|
if (items > 0)
|
||||||
{
|
{
|
||||||
TProgind pi(items, "Cambio stato documenti", false);
|
TProgress_monitor pi(items, "Cambio stato documenti", false);
|
||||||
_error = no_error;
|
_error = no_error;
|
||||||
TToken_string * group_element;
|
TToken_string * group_element;
|
||||||
int i=0;
|
int i=0;
|
||||||
@ -152,7 +152,7 @@ error_type TGenerazione_effetti::change_group_status(TDocumento& doc, TAssoc_arr
|
|||||||
// Ciclo sugli elementi dell'assoc_array
|
// Ciclo sugli elementi dell'assoc_array
|
||||||
for (group_element = (TToken_string *) group_array.first_item(); group_element != NULL && i < items; i++,group_element = (TToken_string*)group_array.succ_item())
|
for (group_element = (TToken_string *) group_array.first_item(); group_element != NULL && i < items; i++,group_element = (TToken_string*)group_array.succ_item())
|
||||||
{
|
{
|
||||||
if (!pi.addstatus(1))
|
if (!pi.add_status())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
group_element->restart();
|
group_element->restart();
|
||||||
|
@ -115,7 +115,9 @@ bool TConsegna_mask::on_field_event(class TOperable_field& f, TField_event e, lo
|
|||||||
if (!e.is_zero())
|
if (!e.is_zero())
|
||||||
{
|
{
|
||||||
TToken_string key(32, ' ');
|
TToken_string key(32, ' ');
|
||||||
key.add(row->get(s.cid2index(S_CODART)));
|
key = row->get(s.cid2index(S_CODART));
|
||||||
|
if (!cache().get(LF_ANAMAG, key).empty()) // Controlla solo articoli a magazzino
|
||||||
|
{
|
||||||
key.add(row->get(s.cid2index(S_LIVGIAC1)));
|
key.add(row->get(s.cid2index(S_LIVGIAC1)));
|
||||||
key.add(row->get(s.cid2index(S_LIVGIAC2)));
|
key.add(row->get(s.cid2index(S_LIVGIAC2)));
|
||||||
key.add(row->get(s.cid2index(S_LIVGIAC3)));
|
key.add(row->get(s.cid2index(S_LIVGIAC3)));
|
||||||
@ -131,6 +133,7 @@ bool TConsegna_mask::on_field_event(class TOperable_field& f, TField_event e, lo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool some_errors = false;
|
bool some_errors = false;
|
||||||
FOR_EACH_ASSOC_OBJECT(giacenze, h, k, o)
|
FOR_EACH_ASSOC_OBJECT(giacenze, h, k, o)
|
||||||
@ -249,7 +252,7 @@ void TConsegna_mask::doc2mask(const TDocumento& indoc, const TDocumento& outdoc,
|
|||||||
if (rec.is_descrizione())
|
if (rec.is_descrizione())
|
||||||
show_line = !_ignora_descrizioni;
|
show_line = !_ignora_descrizioni;
|
||||||
|
|
||||||
if ( show_line && (articolo.blank() || articolo == rec.get(RDOC_CODART)) )
|
if ( show_line && (articolo.blank() || articolo == rec.get(RDOC_CODARTMAG)) )
|
||||||
{
|
{
|
||||||
TToken_string& r = s.row(-1);
|
TToken_string& r = s.row(-1);
|
||||||
r = " ";
|
r = " ";
|
||||||
@ -273,10 +276,10 @@ void TConsegna_mask::doc2mask(const TDocumento& indoc, const TDocumento& outdoc,
|
|||||||
for (int l = 1; l <= 4; l++)
|
for (int l = 1; l <= 4; l++)
|
||||||
r.add(livelli_giacenza().unpack_grpcode(livello, l));
|
r.add(livelli_giacenza().unpack_grpcode(livello, l));
|
||||||
|
|
||||||
if (!evasa)
|
if (!evasa && rec.is_articolo())
|
||||||
{
|
{
|
||||||
TArticolo_giacenza ag(rec.get(RDOC_CODART));
|
const TArticolo_giacenza ag(rec.get(RDOC_CODARTMAG));
|
||||||
const real giac = ag.giacenza_anno(rec.get(RDOC_CODMAG), livello, codes);
|
const real giac = ag.empty()? ZERO : ag.giacenza_anno(rec.get(RDOC_CODMAG), livello, codes);
|
||||||
r.add(giac.string(), s.cid2index(S_GIACENZA));
|
r.add(giac.string(), s.cid2index(S_GIACENZA));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,16 +369,20 @@ bool TConsegna_ordini::calcola_ncolli_tara_pnetto(const TString& codart, const r
|
|||||||
bool TConsegna_ordini::aggiorna_ncolli_tara_pnetto(TRiga_documento& r) const
|
bool TConsegna_ordini::aggiorna_ncolli_tara_pnetto(TRiga_documento& r) const
|
||||||
{
|
{
|
||||||
const TString& codart = r.get(RDOC_CODARTMAG);
|
const TString& codart = r.get(RDOC_CODARTMAG);
|
||||||
|
bool ok = codart.full();
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
TArticolo& articolo = cached_article(codart);
|
TArticolo& articolo = cached_article(codart);
|
||||||
const real qta = articolo.convert_to_um(r.quantita(), NULL, r.get(RDOC_UMQTA));
|
const real qta = articolo.convert_to_um(r.quantita(), NULL, r.get(RDOC_UMQTA));
|
||||||
real ncolli, tara, pnetto;
|
real ncolli, tara, pnetto;
|
||||||
const bool ok = calcola_ncolli_tara_pnetto(codart, qta, ncolli, tara, pnetto);
|
ok = calcola_ncolli_tara_pnetto(codart, qta, ncolli, tara, pnetto);
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
r.put(RDOC_NCOLLI, ncolli);
|
r.put(RDOC_NCOLLI, ncolli);
|
||||||
r.put(RDOC_TARA, tara);
|
r.put(RDOC_TARA, tara);
|
||||||
r.put(RDOC_PNETTO, pnetto);
|
r.put(RDOC_PNETTO, pnetto);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <multirel.h>
|
#include <multirel.h>
|
||||||
#include <postman.h>
|
#include <postman.h>
|
||||||
#include <recset.h>
|
#include <recset.h>
|
||||||
// #include <smartcard.h> // Cassato il macchinaro
|
#include <sheet.h>
|
||||||
#include <treectrl.h>
|
#include <treectrl.h>
|
||||||
#include <toolfld.h>
|
#include <toolfld.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
@ -1781,7 +1781,7 @@ void TDocumento_mask::update_giacenza()
|
|||||||
|
|
||||||
TSheet_field& sf = sfield(F_SHEET);
|
TSheet_field& sf = sfield(F_SHEET);
|
||||||
TToken_string& row = sf.row(sf.selected());
|
TToken_string& row = sf.row(sf.selected());
|
||||||
TString80 codart = row.get(sf.cid2index(FR_CODARTMAG));
|
TCodice_articolo codart = row.get(sf.cid2index(FR_CODARTMAG));
|
||||||
if (codart.blank())
|
if (codart.blank())
|
||||||
{
|
{
|
||||||
reset(F_CURGIAC);
|
reset(F_CURGIAC);
|
||||||
@ -2940,7 +2940,7 @@ bool TDocument_tree::get_description(TString& str) const
|
|||||||
const TRectype& rec = riga();
|
const TRectype& rec = riga();
|
||||||
const TRectype& testata = _relation->curr();
|
const TRectype& testata = _relation->curr();
|
||||||
|
|
||||||
const TString80 codart = rec.get(RDOC_CODART);
|
const TCodice_articolo codart = rec.get(RDOC_CODART);
|
||||||
str = codart;
|
str = codart;
|
||||||
str.left_just(21);
|
str.left_just(21);
|
||||||
str << rec.get(RDOC_DESCR).left(30);
|
str << rec.get(RDOC_DESCR).left(30);
|
||||||
@ -4393,11 +4393,11 @@ static int row_compare(const TObject** obj1, const TObject** obj2)
|
|||||||
if (doc[i].get(RDOC_CODART).blank())
|
if (doc[i].get(RDOC_CODART).blank())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
const TString80 c1 = row1.get(RDOC_CODART);
|
const TString& c1 = row1.get(RDOC_CODART);
|
||||||
const TString& c2 = row2.get(RDOC_CODART);
|
const TString& c2 = row2.get(RDOC_CODART);
|
||||||
|
|
||||||
if (c1.full() && c2.full())
|
if (c1.full() && c2.full())
|
||||||
return strcmp((const char *) c1, (const char *) c2);
|
return c1.compare(c2);
|
||||||
|
|
||||||
return r1 - r2;
|
return r1 - r2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2604,6 +2604,7 @@ bool TDocumento_mask::numdocrif_search_handler(TMask_field& f, KEY key)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
bool TDocumento_mask::ragsoc_search_handler(TMask_field& f, KEY key)
|
bool TDocumento_mask::ragsoc_search_handler(TMask_field& f, KEY key)
|
||||||
{
|
{
|
||||||
if (key == K_F9)
|
if (key == K_F9)
|
||||||
@ -2650,7 +2651,7 @@ bool TDocumento_mask::ragsoc_search_handler(TMask_field& f, KEY key)
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
bool TDocumento_mask::datadocrif_handler(TMask_field& f, KEY key)
|
bool TDocumento_mask::datadocrif_handler(TMask_field& f, KEY key)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user