Patch level : nopatch
Files correlati : velib07 Commento :
This commit is contained in:
parent
6c6a159c78
commit
0f9b6d0bc5
@ -507,6 +507,9 @@ const TString_array& TAVM::get_user_words()
|
||||
int TAVM::compile_user_word(const char* w)
|
||||
{
|
||||
const TString_array& uw = get_user_words();
|
||||
if (strcmp(w, "#DAL") == 0)
|
||||
int I = 1;
|
||||
|
||||
const int i = uw.find(w);
|
||||
return i > 0 ? i : 0;
|
||||
}
|
||||
|
@ -2762,6 +2762,7 @@ bool TReport::set_usr_val(const TString& name, const TVariant& var)
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
size_t TReport::get_usr_words(TString_array& words) const
|
||||
{
|
||||
const char* const name[] =
|
||||
@ -2779,6 +2780,17 @@ size_t TReport::get_usr_words(TString_array& words) const
|
||||
return i;
|
||||
}
|
||||
|
||||
size_t TReport::add_usr_words(TString_array& words, const char* const names[]) const
|
||||
{
|
||||
TReport::get_usr_words(words);
|
||||
|
||||
const int first_msg = words.items(); // Calcola il primo numero disponibile
|
||||
for (size_t i = 0; names[i] != NULL; i++)
|
||||
words.add(names[i]);
|
||||
|
||||
return first_msg;
|
||||
}
|
||||
|
||||
static void do_show(TReport_field& rf, void* jolly)
|
||||
{ rf.set_draw_hidden(jolly == NULL); }
|
||||
|
||||
|
@ -570,6 +570,7 @@ class TReport : public TAlex_virtual_machine
|
||||
protected:
|
||||
virtual const char* class_name() const { return "Report"; }
|
||||
virtual size_t get_usr_words(TString_array& words) const;
|
||||
virtual size_t add_usr_words(TString_array& words, const char* const names[]) const;
|
||||
virtual bool execute_usr_word(unsigned int opcode, TVariant_stack& stack);
|
||||
virtual bool get_usr_val(const TString& name, TVariant& var) const;
|
||||
virtual bool set_usr_val(const TString& name, const TVariant& var);
|
||||
|
@ -64,12 +64,8 @@ void TListaFido_app::main_loop()
|
||||
TDate dal = m.get_date(F_DADATA);
|
||||
TDate al = m.get_date(F_ADATA);
|
||||
|
||||
if (dal.ok())
|
||||
report.set_datafidodal(dal);
|
||||
|
||||
if (al.ok())
|
||||
report.set_datafidoal(al);
|
||||
|
||||
book.add(report);
|
||||
if (book.pages() > 0)
|
||||
if (k == K_VISUALIZE)
|
||||
|
@ -9,7 +9,7 @@
|
||||
<source>#SYSTEM.RAGSOC</source>
|
||||
</field>
|
||||
<field x="136" deactivated="" type="Stringa" hidden="" link="" dynamic_height="" shade_offset="" width="11" codval="" id="2" pattern="1" hide_zero="" text="">
|
||||
<source>#SYSTEM.DATE</source>
|
||||
<source>#AL</source>
|
||||
</field>
|
||||
<field x="162" deactivated="" type="Numero" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="4" codval="" id="3" pattern="1" hide_zero="" text="">
|
||||
<source>#PAGE</source>
|
||||
@ -26,9 +26,13 @@
|
||||
<field y="3" deactivated="" type="Testo" valign="center" hidden="" link="" dynamic_height="" shade_offset="" width="6" codval="" id="6" pattern="1" hide_zero="" text="Codice" />
|
||||
<field x="60" y="3" deactivated="" type="Testo" valign="center" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="18" codval="" id="7" pattern="1" hide_zero="" text="Fido" />
|
||||
<field x="9" y="3" deactivated="" type="Testo" valign="center" hidden="" link="" dynamic_height="" shade_offset="" width="50" codval="" id="8" pattern="1" hide_zero="" text="Ragione sociale" />
|
||||
<field x="121" deactivated="" type="Stringa" hidden="" link="" dynamic_height="" shade_offset="" width="11" codval="" id="9" pattern="1" hide_zero="" text="">
|
||||
<source>#DAL</source>
|
||||
</field>
|
||||
<field x="79" y="3" deactivated="" type="Testo" valign="center" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="18" codval="" id="11" pattern="1" hide_zero="" text="Saldo" />
|
||||
<field deactivated="" type="Testo" hidden="" link="" dynamic_height="" shade_offset="" width="8" codval="" id="13" pattern="1" hide_zero="" text="Ditta:" />
|
||||
<field x="130" deactivated="" type="Testo" hidden="" link="" dynamic_height="" shade_offset="" width="6" codval="" id="13" pattern="1" hide_zero="" text="Data:" />
|
||||
<field x="112" deactivated="" type="Testo" hidden="" link="" dynamic_height="" shade_offset="" width="10" codval="" id="13" pattern="1" hide_zero="" text="Data: DAL" />
|
||||
<field x="132.5" deactivated="" type="Testo" hidden="" link="" dynamic_height="" shade_offset="" width="2" codval="" id="13" pattern="1" hide_zero="" text="AL" />
|
||||
<field x="156" deactivated="" type="Testo" hidden="" link="" dynamic_height="" shade_offset="" width="6" codval="" id="13" pattern="1" hide_zero="" text="Pag." />
|
||||
<field x="116" y="3" deactivated="" type="Testo" valign="center" hidden="" align="right" link="" dynamic_height="" shade_offset="" width="18" codval="" id="17" pattern="1" hide_zero="" text="Fuori fido" />
|
||||
</section>
|
||||
|
@ -740,11 +740,11 @@ bool TDocument_report::msg_fido(TVariant_stack& stack)
|
||||
int selector = stack.pop().as_int();
|
||||
|
||||
if (selector & 1)
|
||||
value += calcola_saldo_contabile('C', codcf, _data_fido_al);
|
||||
//value += calcola_saldo_contabile('C', codcf, _data_fido_al);
|
||||
if (selector & 2)
|
||||
value += calcola_esposto_da_saldaconto('C', codcf, _data_fido_dal ,_data_fido_al, _riskdays);
|
||||
if(selector & 4)
|
||||
value += calcola_fido_da_documenti('C', codcf, _data_fido_al, EMPTY_STRING);
|
||||
//value += calcola_fido_da_documenti('C', codcf, _data_fido_al, EMPTY_STRING);
|
||||
|
||||
curr_field()->set(TVariant(value>0 ? value : ""));
|
||||
return true;
|
||||
@ -753,13 +753,9 @@ bool TDocument_report::msg_fido(TVariant_stack& stack)
|
||||
|
||||
size_t TDocument_report::get_usr_words(TString_array& words) const
|
||||
{
|
||||
TReport::get_usr_words(words);
|
||||
const char* const name[] = { "DOC_CLIENTE", "DOC_PARENT_DOC", "DOC_PARENT_ROW",
|
||||
"DOC_TABELLA_IVA", "UTILIZZO", NULL};
|
||||
|
||||
((TDocument_report*)this)->_first_msg = words.items(); // Calcola il primo numero disponibile
|
||||
for (size_t i = 0; name[i] != NULL; i++)
|
||||
words.add(name[i]);
|
||||
"DOC_TABELLA_IVA", "UTILIZZO", "#DAL", "#AL" , NULL};
|
||||
((TDocument_report*)this)->_first_msg = add_usr_words(words, name); // Calcola il primo numero disponibile
|
||||
|
||||
return words.items();
|
||||
}
|
||||
@ -776,6 +772,8 @@ bool TDocument_report::execute_usr_word(unsigned int opcode, TVariant_stack& sta
|
||||
case 2: msg_parent_row(stack); break;
|
||||
case 3: msg_riepilogo_iva(stack); break;
|
||||
case 4: msg_fido(stack); break;
|
||||
case 5: curr_field()->set(TVariant(_data_fido_dal.stringa())); break;
|
||||
case 6: curr_field()->set(TVariant(_data_fido_al.stringa())); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
@ -881,17 +879,38 @@ static real calcola_esposto_da_saldaconto (const char tipocf, const long codcf,c
|
||||
|
||||
//estrae le righe partita relative a pagamenti successivi alla data di rischio (e con tipopag >2,<7)
|
||||
TString query;
|
||||
query << "USE PART\n";
|
||||
query << "FROM " << PART_TIPOCF << "=" << "\"" << tipocf << "\"" << PART_GRUPPO << "=0" << PART_CONTO << "=0" << PART_SOTTOCONTO << "=" << codcf << "\n";
|
||||
query << "TO " << PART_TIPOCF << "=" << "\"" << tipocf << "\"" << PART_GRUPPO << "=0" << PART_CONTO << "=0" << PART_SOTTOCONTO << "=" << codcf << "\n";
|
||||
query << "USE PART SELECT BETWEEN("<< PART_ANNO << "," << from.year() << "," << eotime.year() << ")\n";
|
||||
query << "FROM " << PART_TIPOCF << "=" << "\"" << tipocf << "\" " << PART_GRUPPO << "=0 " << PART_CONTO << "=0 " << PART_SOTTOCONTO << "=" << codcf << "\n";
|
||||
query << "TO " << PART_TIPOCF << "=" << "\"" << tipocf << "\" " << PART_GRUPPO << "=0 " << PART_CONTO << "=0 " << PART_SOTTOCONTO << "=" << codcf << "\n";
|
||||
|
||||
TISAM_recordset partite(query);
|
||||
|
||||
data_sbf -= riskdays;
|
||||
for (bool ok = partite.move_first(); ok; ok = partite.move_next())
|
||||
{
|
||||
if (partite.get_date(PART_DATADOC)< from)
|
||||
const TDate datadoc = partite.get_date(PART_DATADOC);
|
||||
const int anno = partite.get_int(PART_ANNO);
|
||||
const TString& npart = partite.get_string(PART_NUMPART);
|
||||
const long nreg = partite.get_long(PART_NREG);
|
||||
|
||||
if (datadoc>= from)
|
||||
{
|
||||
TBill bill(0, 0, codcf, 'C');
|
||||
TPartita part(bill,anno, npart);
|
||||
|
||||
for (int r = part.last(); r > 0; r = part.pred(r)) {
|
||||
|
||||
const TRiga_partite& row = part.riga(r);
|
||||
bool is_esposto;
|
||||
TImporto imp = row.esposto(false, to, data_sbf, is_esposto);
|
||||
|
||||
if (is_esposto)
|
||||
esposto += imp;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
TImporto importo_riga;
|
||||
|
||||
//fatture,note di credito,pagamenti
|
||||
@ -901,12 +920,15 @@ static real calcola_esposto_da_saldaconto (const char tipocf, const long codcf,c
|
||||
importo_riga += importo_partita;
|
||||
const tipo_movimento tipo_mov = (tipo_movimento)partite.get_int(PART_TIPOMOV);
|
||||
const tipo_pagamento tipo_pag = (tipo_pagamento)partite.get_int(PART_TIPOPAG);
|
||||
const TDate datapag = partite.get_date(PART_DATAPAG);
|
||||
TDate data = partite.get_date(PART_DATAPAG);
|
||||
const long codcf = partite.get_long(PART_SOTTOCONTO);
|
||||
|
||||
if (!data.ok())
|
||||
data = partite.get_date(PART_DATAREG);
|
||||
//pagamenti (tm=3), insoluti (tm=5), pagamenti insoluti(tm=6)
|
||||
if ((tipo_mov >= tm_pagamento) &&
|
||||
(tipo_pag >= tp_tratta && tipo_pag <= tp_rid) &&
|
||||
((datapag >= data_sbf) && (datapag <= to)))
|
||||
((data >= data_sbf) && (data <= to)))
|
||||
{
|
||||
TImporto importo_abbuono = get_importo(partite, PART_SEZABB, PART_ABBUONI);
|
||||
importo_riga += importo_abbuono;
|
||||
@ -918,7 +940,9 @@ static real calcola_esposto_da_saldaconto (const char tipocf, const long codcf,c
|
||||
}
|
||||
//somma importi presenti sulla riga partita (fatture, pagamenti, insoluti, pagamenti insoluti)
|
||||
esposto += importo_riga;
|
||||
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
@ -1009,13 +1033,13 @@ static real calcola_fido_da_documenti(const char tipocf, const long codcf, const
|
||||
real calcola_fido_cliente (long codcf, const TDate& datacalc, const TDoc_key& ignore)
|
||||
{
|
||||
//PRIMA PARTE: controlla i movimenti
|
||||
real saldo_contabile = calcola_saldo_contabile('C', codcf, datacalc);
|
||||
//real saldo_contabile = calcola_saldo_contabile('C', codcf, datacalc);
|
||||
//SECONDA PARTE: controlla il saldaconto
|
||||
real esposto_saldaconto = calcola_esposto_da_saldaconto('C', codcf, botime, datacalc, 10); // 10 giorni ?
|
||||
//TERZA PARTE: controlla i documenti
|
||||
real tot_documenti = calcola_fido_da_documenti('C',codcf, datacalc, ignore);
|
||||
//real tot_documenti = calcola_fido_da_documenti('C',codcf, datacalc, ignore);
|
||||
|
||||
return saldo_contabile + esposto_saldaconto + tot_documenti;
|
||||
return /*saldo_contabile +*/esposto_saldaconto /*+tot_documenti*/;
|
||||
}
|
||||
|
||||
// FINE METODI PER IL CALCOLO DEL FIDO
|
||||
|
Loading…
x
Reference in New Issue
Block a user