Correzioni a stampa di controllo bolle fatturate.

Aggiunto parametro per evitare di raggruppare le righe evase per documento di origine

git-svn-id: svn://10.65.10.50/branches/R_10_00@22681 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2012-06-18 14:17:31 +00:00
parent db131f585a
commit 05aa5970c9
10 changed files with 93 additions and 52 deletions

View File

@ -163,6 +163,6 @@ void TStampa_contab_docs::main_loop()
int ve1500(int argc, char* argv[])
{
TStampa_contab_docs a;
a.run(argc, argv, TR("Stampa di controllo documenti contabilizzati"));
a.run(argc, argv, TR("Controllo documenti contabilizzati"));
return 0;
}

View File

@ -4,7 +4,7 @@ TOOLBAR "topbar" 0 0 0 2
#include <printbar.h>
ENDPAGE
PAGE "Stampa di controllo documenti contabilizzati" 0 0 0 0
PAGE "Controllo documenti contabilizzati" 0 0 0 0
GROUPBOX DLG_NULL 78 4
BEGIN

View File

@ -12,8 +12,9 @@
// MASCHERA
////////////////////////////////////////////////////////
static TAssoc_array _tipi_doc;
static TString_array _cod_nums;
static TAssoc_array _tipi_bol;
static TString_array _nums_bol;
static TAssoc_array _nums_fat;
static char _stato_finale = 'Z';
class TStampa_bolfat_mask : public TAutomask
@ -24,14 +25,14 @@ protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
const TString_array& numerazioni() const { return _cod_nums; }
const TString_array& numerazioni() const { return _nums_bol; }
TStampa_bolfat_mask();
};
bool TStampa_bolfat_mask::codnum_filter(const TRelation* rel)
{
const TString& codnum = rel->curr().get("CODTAB");
return _cod_nums.find(codnum) >= 0;
return _nums_bol.find(codnum) >= 0;
}
bool TStampa_bolfat_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
@ -56,7 +57,7 @@ bool TStampa_bolfat_mask::on_field_event(TOperable_field& o, TField_event e, lon
}
if ((e == fe_modify || e == fe_close) && !o.empty())
{
if (_cod_nums.find(o.get()) < 0)
if (_nums_bol.find(o.get()) < 0)
return error_box(TR("Numerazione non valida per le bolle"));
}
break;
@ -73,8 +74,9 @@ bool TStampa_bolfat_mask::on_field_event(TOperable_field& o, TField_event e, lon
TStampa_bolfat_mask::TStampa_bolfat_mask() : TAutomask("ve1600a")
{
_tipi_doc.destroy();
_cod_nums.destroy();
_tipi_bol.destroy();
_nums_bol.destroy();
_nums_fat.destroy();
_stato_finale = 'Z';
//giro sulle elaborazioni
@ -82,28 +84,36 @@ TStampa_bolfat_mask::TStampa_bolfat_mask() : TAutomask("ve1600a")
for (bool ok = eld.move_first(); ok; ok = eld.move_next())
{
const TElaborazione e(eld.cursor()->curr());
if (e.tipo() == _fatturazione_bolle)
if (e.tipo() == _fatturazione_bolle || e.tipo() == _esterna)
{
const TString& codnumfat = e.codice_numerazione_finale();
const TString4 codnumfat = e.codice_numerazione_finale();
const TCodice_numerazione n(codnumfat);
if (n.get_int("I1") == 2) // Genera vere fatture
{
const char sfdi = e.stato_finale_doc_iniziale()[0]; // Stato finale documento iniziale
bool found = false;
TToken_string tipi, stati;
e.tipi_stati_iniziali(tipi, stati);
if (!tipi.empty_items())
e.tipi_stati_iniziali(tipi, stati);
FOR_EACH_TOKEN(tipi, t)
{
const char sfdi = e.stato_finale_doc_iniziale()[0];
if (sfdi < _stato_finale)
_stato_finale = sfdi;
FOR_EACH_TOKEN(tipi, t)
_tipi_doc.add(t);
const char sidi = stati.get_char(); // Stato iniziale documento iniziale
if (sfdi > sidi)
{
found = true;
_tipi_bol.add(t);
if (sfdi < _stato_finale)
_stato_finale = sfdi;
}
}
if (found)
_nums_fat.add(codnumfat);
}
}
}
//giro sulle numerazioni
TISAM_recordset num("USE %NUM");
// giro sulle numerazioni delle bolle
TISAM_recordset num("USE %NUM SELECT I1=1");
for (bool ok = num.move_first(); ok; ok = num.move_next())
{
const TString4 codnum = num.get("CODTAB").as_string();
@ -111,9 +121,9 @@ TStampa_bolfat_mask::TStampa_bolfat_mask() : TAutomask("ve1600a")
for (int i = n.ntipi_doc()-1; i >= 0; i--)
{
const TString& td = n.tipo_doc(i);
if (_tipi_doc.is_key(td))
if (_tipi_bol.is_key(td))
{
_cod_nums.add(codnum);
_nums_bol.add(codnum);
break;
}
}
@ -313,6 +323,8 @@ void TStampa_bolfat::scan_num(const TString& codnum, const TDate& dal, const TDa
TLocalisamfile rfat(LF_RIGHEDOC);
rfat.setkey(4);
TRectype& recfat = rfat.curr();
TString msg; msg << TR("Controllo numerazione ") << codnum;
TProgind pi(bolle.items(), msg);
@ -322,7 +334,7 @@ void TStampa_bolfat::scan_num(const TString& codnum, const TDate& dal, const TDa
break;
const TString& tipodoc = bol.get(DOC_TIPODOC);
const char stato = bol.get_char(DOC_STATO);
if (stato >= _stato_finale && _tipi_doc.is_key(tipodoc))
if (stato >= _stato_finale && _tipi_bol.is_key(tipodoc))
{
TToken_string rdoc_key;
rdoc_key.add(bol.get(DOC_CODNUM));
@ -337,22 +349,38 @@ void TStampa_bolfat::scan_num(const TString& codnum, const TDate& dal, const TDa
if (rbol.get(RDOC_CODART).blank() || rbol.get_real(RDOC_QTA).is_zero())
continue;
rfat.put(RDOC_DAPROVV, rbol.get(RDOC_PROVV));
rfat.put(RDOC_DAANNO, rbol.get(RDOC_ANNO));
rfat.put(RDOC_DACODNUM, rbol.get(RDOC_CODNUM));
rfat.put(RDOC_DANDOC, rbol.get(RDOC_NDOC));
rfat.put(RDOC_DAIDRIGA, rbol.get(RDOC_IDRIGA));
int err = rfat.read();
if (err == NOERR)
recfat.put(RDOC_DAPROVV, rbol.get(RDOC_PROVV));
recfat.put(RDOC_DAANNO, rbol.get(RDOC_ANNO));
recfat.put(RDOC_DACODNUM, rbol.get(RDOC_CODNUM));
recfat.put(RDOC_DANDOC, rbol.get(RDOC_NDOC));
recfat.put(RDOC_DAIDRIGA, rbol.get(RDOC_IDRIGA));
TArray matches;
for (int err = rfat.read(); err == NOERR; err = rfat.next())
{
if (recfat.get_long(RDOC_DAIDRIGA) == rbol.get_long(RDOC_IDRIGA) &&
recfat.get_long(RDOC_DANDOC) == rbol.get_long(RDOC_NDOC))
{
// Devo fare attenzione a scartare gli altri documenti
// che possono derivare dalla bolla pur non essendo fatture
if (_nums_fat.is_key(recfat.get(RDOC_CODNUM)))
matches.add(recfat);
}
else
break;
}
if (!matches.empty())
{
bool bolled = false;
for (; err == NOERR; err = rfat.next())
FOR_EACH_ARRAY_ITEM(matches, r, obj)
{
if (rfat.get_long(RDOC_DAIDRIGA) != rbol.get_long(RDOC_IDRIGA) ||
rfat.get_long(RDOC_DANDOC) != rbol.get_long(RDOC_NDOC))
break;
const TRectype& rigafatt = *(const TRectype*)obj;
const char* msg = compare_rows(rbol, rigafatt);
if ((msg == NULL || *msg < ' ') && matches.items() > 1)
msg = TR("Doppia elaborazione");
const char* msg = compare_rows(rbol, rfat.curr());
if (msg && *msg)
{
if (!bolled)
@ -360,7 +388,7 @@ void TStampa_bolfat::scan_num(const TString& codnum, const TDate& dal, const TDa
recset.add(rbol, " ", 'B');
bolled = true;
}
recset.add(rfat.curr(), msg, 'F');
recset.add(rigafatt, msg, 'F');
}
}
}
@ -394,7 +422,7 @@ void TStampa_bolfat::main_loop()
{
if (!pi.addstatus(1))
break;
const TFixed_string c = row->get(0);
const TString4 c = row->get(0);
scan_num(c, dal, al, *recset);
}
}

View File

@ -1,6 +1,6 @@
#include "ve1600a.h"
PAGE "Controllo bolle non fatturate" -1 -1 61 4
PAGE "Controllo bolle fatturate" -1 -1 61 4
NUMBER F_ANNO 4
BEGIN

View File

@ -12,11 +12,10 @@ Item_06 = "Contabilita' Industriale", <cimenu.men>
Item_07 = "Statistiche di vendita", <svmenu.men>
Item_08 = "Servizi", [ACQVEN_021]
Item_09 = "Configurazione", [ACQVEN_020]
Item_10 = "Tracciabilita' CUP-CIG", <ctmenu.men>
Item_10 = "Tracciabilità CUP-CIG", <ctmenu.men>
Item_11 = "Trasferimento PACK", <tpmenu.men>
Item_12 = "Preventivazione", <pemenu.men>, "E"
Item_13 = "Vendita al dettaglio", <vdmenu.men>
Item_14 = "Verticalizzazioni", [ACQVEN_027]
Item_13 = "Verticalizzazioni", [ACQVEN_027]
[ACQVEN_001]
Caption = "Archivi e tabelle di base"

View File

@ -235,6 +235,8 @@ protected:
public:
bool nettifica() const { return get_bool("B12"); }
bool raggruppa_per_riferimento() const { return raggruppa_righe() || get_int("I3") == 0; }
virtual bool elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
const TDate& data_elab, bool interattivo = false);
@ -431,7 +433,7 @@ protected:
error_type compile_head_mov(TDocumento&);
// Compila la testata del movimento per le fatture da emettere / ricevere;
error_type compile_head_mov_re(TDocumento&);
bool spalma_spese() const { return get("I2") == "X"; }
bool spalma_spese() const { return get_int("I2") != 0; }
// Funzione per distribuire le spese
void split_sp_amount(const real & amount, int decimals);
// Funzione per ricercare il conto di costo/ricavo
@ -591,6 +593,7 @@ class TConsuntivazione_produzione : public TElaborazione // velib04e
{
protected:
bool ref2doc(char & provv, int & anno, TString8 & codnum, long & ndoc, int & nriga, const TString & codart);
bool raggruppa_per_riferimento() const { return raggruppa_righe() || get_int("I3") == 0; }
public:
virtual bool elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
@ -620,7 +623,7 @@ class TContabilizzazione_analitica : public TElaborazione // velib04f
protected:
bool find_conti_iva_indetraibile(const TRiga_documento& riga, const TBill & bill, TString_array& conti, int annoes, const char tipomov, bool & pareggio);
bool spalma_spese() const { return get("I2") == "X"; }
bool spalma_spese() const { return get_int("I2") != 0; }
void split_sp_amount(TAnal_mov & mov, bool pareggio, const TImporto & totdoc, const TBit_array & spese, const real & amount, const real & no_ca_amount, int decimals);
bool find_conti(const TRiga_documento& riga, TString_array& conti, int annoes, bool riclassifica_fdr_fde, const char tipomov, real & amount_to_split, real & no_ca_amount, const real & valore, bool & pareggio);
void init();

View File

@ -610,8 +610,7 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
{
int j = outdoc.physical_rows();
const bool ordina_per_doc = ini_get_bool(CONFIG_DITTA, "ve", "ORDINA_PER_DOC", true);
if (ordina_per_doc)
if (raggruppa_per_riferimento())
{
TToken_string key = inrec.get_rdoc_key();

View File

@ -50,6 +50,7 @@ Item_01 = "Stampa Documenti", "ve1 -0", "F"
Item_02 = "Stampa Avanzata Documenti". "ve1 -2", "F"
Item_03 = "Scoperto fatture", "ve1 -1", "F"
Item_04 = "Controllo documenti contabilizzati", "ve1 -4", "F"
Item_05 = "Controllo bolle fatturate", "ve1 -5", "F"
[VEMENU_003]
Caption = "Tabelle personalizzazione documenti"

View File

@ -83,6 +83,7 @@
#define F_RIF_DOCIN 332
#define F_COMMESSA 333
#define F_SPALMA 334
#define F_GROUP_BY_REF 335
#define F_PREZZO_DA_ORDINE 340
#define F_AGGIORNA_PREZZO 341

View File

@ -674,9 +674,9 @@ END
BOOLEAN F_SOMMA_RIGHE
BEGIN
PROMPT 2 10 "Somma righe simili"
MESSAGE FALSE ENABLE,F_RIFERIMENTI_IN_TESTA
MESSAGE TRUE DISABLE,F_RIFERIMENTI_IN_TESTA|"X",F_RIFERIMENTI_IN_TESTA
PROMPT 2 10 "Somma righe simili (Codice Articolo, Livello di giacenza, Unità di misura)"
MESSAGE FALSE ENABLE,F_RIFERIMENTI_IN_TESTA|ENABLE,F_GROUP_BY_REF
MESSAGE TRUE DISABLE,F_RIFERIMENTI_IN_TESTA|"X",F_RIFERIMENTI_IN_TESTA|CLEAR,F_GROUP_BY_REF
FIELD B0
END
@ -750,15 +750,25 @@ BEGIN
FIELD B8
END
LISTBOX F_SPALMA 1 12
LISTBOX F_SPALMA 1 2
BEGIN
PROMPT 2 17 "Spalma le spese"
ITEM " |Non spalmare"
ITEM "X|Spalma"
PROMPT 2 17 "Spalmatura spese"
ITEM " |No"
ITEM "1|Si"
FIELD I2
GROUP 3 9
END
LISTBOX F_GROUP_BY_REF 1 2
BEGIN
PROMPT 2 17 "Raggruppare per riferimento"
ITEM " |Si"
ITEM "1|No"
FIELD I3
GROUP 1
END
STRING F_RIF_DOCIN 4
BEGIN
PROMPT 40 17 "Numerazione documenti in entrata"