Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : Modifiche fatturazione git-svn-id: svn://10.65.10.50/branches/R_10_00@21895 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
6270b14f76
commit
97f6fe0fe9
@ -94,6 +94,9 @@
|
|||||||
#define F_CODARTCOFIX 273
|
#define F_CODARTCOFIX 273
|
||||||
#define F_DESARTCOFIX 274
|
#define F_DESARTCOFIX 274
|
||||||
|
|
||||||
|
#define F_AGGHEAD 275
|
||||||
|
#define F_DESTHEAD 276
|
||||||
|
|
||||||
#define F_BACKUP 300
|
#define F_BACKUP 300
|
||||||
|
|
||||||
#define S_CODNUM_RIT 101
|
#define S_CODNUM_RIT 101
|
||||||
|
@ -848,14 +848,26 @@ END
|
|||||||
LISTBOX F_TIPOPR 1 19
|
LISTBOX F_TIPOPR 1 19
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 20 "Tipo prezzo"
|
PROMPT 1 20 "Tipo prezzo"
|
||||||
ITEM "0|Prezzo da contratto"
|
ITEM "0|Prezzo da contratto" MESSAGE "X",F_AGGHEAD|DISABLE,F_AGGHEAD
|
||||||
ITEM "1|Prezzo da bolla"
|
ITEM "1|Prezzo da bolla" MESSAGE ENABLE,F_AGGHEAD
|
||||||
FIELD Tipopr
|
FIELD Tipopr
|
||||||
END
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_AGGHEAD
|
||||||
|
BEGIN
|
||||||
|
PROMPT 40 20 "Aggiorna la testata delle bolle"
|
||||||
|
FIELD AggHead
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_DESTHEAD
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 21 "Destinazione nella testata"
|
||||||
|
FIELD DestHead
|
||||||
|
END
|
||||||
|
|
||||||
STRING F_UMPESO 3
|
STRING F_UMPESO 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 40 20 "U.M. "
|
PROMPT 40 21 "U.M. "
|
||||||
USE %UMS
|
USE %UMS
|
||||||
INPUT CODTAB F_UMPESO
|
INPUT CODTAB F_UMPESO
|
||||||
DISPLAY "Codice@6" CODTAB
|
DISPLAY "Codice@6" CODTAB
|
||||||
|
296
lv/lv2500.cpp
296
lv/lv2500.cpp
@ -2,6 +2,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <dongle.h>
|
#include <dongle.h>
|
||||||
#include <modaut.h>
|
#include <modaut.h>
|
||||||
|
#include <reputils.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
#include "lvlib.h"
|
#include "lvlib.h"
|
||||||
@ -10,6 +11,8 @@
|
|||||||
#include "../pr/agenti.h"
|
#include "../pr/agenti.h"
|
||||||
#include "../pr/percprov.h"
|
#include "../pr/percprov.h"
|
||||||
#include "clifo.h"
|
#include "clifo.h"
|
||||||
|
#include "../cg/cfban.h"
|
||||||
|
#include "comuni.h"
|
||||||
#include "cfven.h"
|
#include "cfven.h"
|
||||||
#include "lvcondv.h"
|
#include "lvcondv.h"
|
||||||
#include "lvrcondv.h"
|
#include "lvrcondv.h"
|
||||||
@ -21,6 +24,8 @@
|
|||||||
#include "../ve/ve6200.h"
|
#include "../ve/ve6200.h"
|
||||||
#include "../ve/ve6200a.h"
|
#include "../ve/ve6200a.h"
|
||||||
|
|
||||||
|
#define DOC_DEST "DEST" //c campo virtuale per la destinazone
|
||||||
|
|
||||||
class TFatturazione_lavanderie;
|
class TFatturazione_lavanderie;
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
//// classe TFatturazione_msk ////
|
//// classe TFatturazione_msk ////
|
||||||
@ -42,11 +47,13 @@ public:
|
|||||||
class TFatturazione_lav_app: public TSkeleton_application
|
class TFatturazione_lav_app: public TSkeleton_application
|
||||||
{
|
{
|
||||||
TFatturazione_msk* _msk;
|
TFatturazione_msk* _msk;
|
||||||
|
TLog_report * _log;
|
||||||
|
bool _solototali;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void main_loop();
|
virtual void main_loop();
|
||||||
|
|
||||||
void genera_bolle_nolo(TAssoc_array& cliela, TFatturazione_lavanderie& elab, int& numdocgen);
|
void genera_bolle_nolo(TAssoc_array& cliela, TFatturazione_lavanderie& elab, int& numdocgen, real & totimp, real &imposta, real & totdoc, real & spese);
|
||||||
bool controlli_preliminari();
|
bool controlli_preliminari();
|
||||||
bool copy_file(const TFilename& src, const TFilename& dst) const;
|
bool copy_file(const TFilename& src, const TFilename& dst) const;
|
||||||
bool copy_tree(const char* src_study, const char* dst_study) const;
|
bool copy_tree(const char* src_study, const char* dst_study) const;
|
||||||
@ -106,6 +113,9 @@ class TFatturazione_lavanderie:public TFatturazione_bolle
|
|||||||
TAssoc_array _output_rows_02;
|
TAssoc_array _output_rows_02;
|
||||||
TAssoc_array _doc_grouped;
|
TAssoc_array _doc_grouped;
|
||||||
bool _prova;
|
bool _prova;
|
||||||
|
long _last_cli_damn;
|
||||||
|
int _art_damn;
|
||||||
|
int _cli_damn;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void add_rows(TRiga_documento & rout, TRiga_documento & rin);
|
virtual void add_rows(TRiga_documento & rout, TRiga_documento & rin);
|
||||||
@ -130,6 +140,9 @@ public:
|
|||||||
void set_perc_provv(TRiga_documento & row, bool prima = true);
|
void set_perc_provv(TRiga_documento & row, bool prima = true);
|
||||||
virtual bool elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
|
virtual bool elabora(TLista_documenti& doc_in, TLista_documenti& doc_out,
|
||||||
const TDate& data_elab, bool interattivo = false);
|
const TDate& data_elab, bool interattivo = false);
|
||||||
|
long & last_cli_damn() {return _last_cli_damn;}
|
||||||
|
int & cli_damn() {return _cli_damn;}
|
||||||
|
int & art_damn() {return _art_damn;}
|
||||||
|
|
||||||
TFatturazione_lavanderie(const char* cod, bool prova = false);
|
TFatturazione_lavanderie(const char* cod, bool prova = false);
|
||||||
~TFatturazione_lavanderie() {}
|
~TFatturazione_lavanderie() {}
|
||||||
@ -1314,12 +1327,28 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do
|
|||||||
doc.put(DOC_CODINDSP, new_reccliven.get(CFV_CODINDDOC));
|
doc.put(DOC_CODINDSP, new_reccliven.get(CFV_CODINDDOC));
|
||||||
|
|
||||||
TString descr;
|
TString descr;
|
||||||
TRiga_documento & r = doc.insert_row(1, "05");
|
|
||||||
|
|
||||||
r.put(RDOC_DESCR, "Consegne effettuate presso\n");
|
if (ini_get_bool(CONFIG_DITTA, "lv", "DestHead"))
|
||||||
descr << act_cli << " " << reccli.get(CLI_RAGSOC);
|
{
|
||||||
r.put(RDOC_DESCLUNGA, "X");
|
descr << reccli.get(CLI_RAGSOC) << '\n';
|
||||||
r.put(RDOC_DESCEST, descr);
|
descr << reccli.get(CLI_INDCF) << ',' << reccli.get(CLI_CIVCF) << '\n';
|
||||||
|
descr << reccli.get(CLI_LOCCF) << '\n';
|
||||||
|
TToken_string keyc = reccli.get(CLI_STATOCF);
|
||||||
|
|
||||||
|
keyc.add(reccli.get(CLI_COMCF));
|
||||||
|
const TRectype & com = cache().get(LF_COMUNI, keyc);
|
||||||
|
descr << reccli.get(CLI_CAPCF) << ',' << com.get(COM_DENCOM) << '\n';
|
||||||
|
doc.put(DOC_DEST, descr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TRiga_documento & r = doc.insert_row(1, "05");
|
||||||
|
|
||||||
|
r.put(RDOC_DESCR, "Consegne effettuate presso\n");
|
||||||
|
descr << act_cli << " " << reccli.get(CLI_RAGSOC);
|
||||||
|
r.put(RDOC_DESCLUNGA, "X");
|
||||||
|
r.put(RDOC_DESCEST, descr);
|
||||||
|
}
|
||||||
if (contr.get_bool(LVCONDV_RAGGCGRUP))
|
if (contr.get_bool(LVCONDV_RAGGCGRUP))
|
||||||
{
|
{
|
||||||
add_doc_to_list(key, doc);
|
add_doc_to_list(key, doc);
|
||||||
@ -1328,6 +1357,23 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (fatt_02())
|
||||||
|
{
|
||||||
|
for (int id = doc_in.items() - 1; id >= 0 ; id--)
|
||||||
|
{
|
||||||
|
TDocumento & doc = doc_in[id];
|
||||||
|
const long clifo = doc.get_long(DOC_CODCF);
|
||||||
|
const int indsped = doc.get_int(DOC_CODINDSP);
|
||||||
|
TLaundry_contract contr(clifo,indsped,_data_elab);
|
||||||
|
const real redditivita = contr.get_real(LVCONDV_REDDI);
|
||||||
|
|
||||||
|
if (redditivita >= CENTO)
|
||||||
|
{
|
||||||
|
doc_in[id].remove();
|
||||||
|
doc_in.destroy(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1492,6 +1538,16 @@ void TFatturazione_lavanderie::create_row(TDocumento& doc_out, const TRiga_docum
|
|||||||
rd.put(RDOC_DESCEST, "\nper addebito biancheria");
|
rd.put(RDOC_DESCEST, "\nper addebito biancheria");
|
||||||
rd.add(RDOC_QTA, qta1);
|
rd.add(RDOC_QTA, qta1);
|
||||||
rd.put(RDOC_PREZZO, rcont.get_real(LVRCONDV_PREZDAN));
|
rd.put(RDOC_PREZZO, rcont.get_real(LVRCONDV_PREZDAN));
|
||||||
|
if (cau.get_int("I2") > 0)
|
||||||
|
{
|
||||||
|
rd.put(RDOC_QTAGG1, cau.get("I0"));
|
||||||
|
rd.put(RDOC_QTAGG2, cau.get("I1"));
|
||||||
|
rd.put(RDOC_QTAGG3, cau.get("I2"));
|
||||||
|
}
|
||||||
|
if (clifo != _last_cli_damn)
|
||||||
|
_cli_damn++;
|
||||||
|
_last_cli_damn = clifo;
|
||||||
|
_art_damn++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//se è una causale di ritirato e se sto ritirando una quantità di merce diversa da zero, allora:
|
//se è una causale di ritirato e se sto ritirando una quantità di merce diversa da zero, allora:
|
||||||
@ -1612,7 +1668,7 @@ TFatturazione_msk::TFatturazione_msk():TAutomask("lv2500a")
|
|||||||
/////////////////////////////////////
|
/////////////////////////////////////
|
||||||
|
|
||||||
//GENERA_BOLLE_NOLO: metodo che genera le fatture di solo nolo per quei clienti a cui non è stato consegnato niente
|
//GENERA_BOLLE_NOLO: metodo che genera le fatture di solo nolo per quei clienti a cui non è stato consegnato niente
|
||||||
void TFatturazione_lav_app::genera_bolle_nolo(TAssoc_array& cliela, TFatturazione_lavanderie& elab, int& numdocgen)
|
void TFatturazione_lav_app::genera_bolle_nolo(TAssoc_array& cliela, TFatturazione_lavanderie& elab, int& numdocgen, real & totimp, real &imposta, real & totdoc, real & spese)
|
||||||
{
|
{
|
||||||
TString4 codnum = ini_get_string(CONFIG_DITTA, "lv", "NUM_GEN");
|
TString4 codnum = ini_get_string(CONFIG_DITTA, "lv", "NUM_GEN");
|
||||||
TString4 tipodoc = ini_get_string(CONFIG_DITTA, "lv", "TIPODOC_GEN");
|
TString4 tipodoc = ini_get_string(CONFIG_DITTA, "lv", "TIPODOC_GEN");
|
||||||
@ -1816,8 +1872,17 @@ void TFatturazione_lav_app::genera_bolle_nolo(TAssoc_array& cliela, TFatturazion
|
|||||||
if (doc.physical_rows() > 0)
|
if (doc.physical_rows() > 0)
|
||||||
{
|
{
|
||||||
elab.elabora(doc_in, doc_out, _msk->get_date(F_DATAFAT));
|
elab.elabora(doc_in, doc_out, _msk->get_date(F_DATAFAT));
|
||||||
int err = doc_out.write();
|
if (!_solototali)
|
||||||
|
int err = doc_out.write();
|
||||||
numdocgen += doc_out.items();
|
numdocgen += doc_out.items();
|
||||||
|
|
||||||
|
if (doc_out.items() > 0)
|
||||||
|
{
|
||||||
|
totimp += doc_out[0].imponibile();
|
||||||
|
imposta += doc_out[0].imposta();
|
||||||
|
totdoc += doc_out[0].totale_doc();
|
||||||
|
spese += doc_out[0].spese();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
doc_out.destroy(-1);
|
doc_out.destroy(-1);
|
||||||
@ -1957,6 +2022,11 @@ bool TFatturazione_lav_app::copy_tree(const char* src_study, const char* dst_stu
|
|||||||
void TFatturazione_lav_app::main_loop()
|
void TFatturazione_lav_app::main_loop()
|
||||||
{
|
{
|
||||||
bool prova = false;
|
bool prova = false;
|
||||||
|
const bool use_indsp = ini_get_bool(CONFIG_DITTA, "mg", "MOV_INDSPED");
|
||||||
|
const bool prezzo_da_contratto = ini_get_int(CONFIG_DITTA, "lv", "Tipopr") == 0;
|
||||||
|
const bool agghead = prezzo_da_contratto || ini_get_bool(CONFIG_DITTA, "lv", "AggHead");
|
||||||
|
const TString4 num_buoni = ini_get_string(CONFIG_DITTA, "lv", "NUM_GEN");
|
||||||
|
const TString4 tipo_buoni = ini_get_string(CONFIG_DITTA, "lv", "TIPODOC_GEN");
|
||||||
|
|
||||||
if (main_app().argc() > 2)
|
if (main_app().argc() > 2)
|
||||||
{
|
{
|
||||||
@ -1976,6 +2046,10 @@ void TFatturazione_lav_app::main_loop()
|
|||||||
|
|
||||||
while (_msk->run()!= K_QUIT)
|
while (_msk->run()!= K_QUIT)
|
||||||
{
|
{
|
||||||
|
_solototali = _msk->get_bool(F_SOLOTOTALI);
|
||||||
|
const int annoes = _msk->get_date(F_DATAFAT).year();
|
||||||
|
|
||||||
|
|
||||||
if (!controlli_preliminari())
|
if (!controlli_preliminari())
|
||||||
{
|
{
|
||||||
TString str;
|
TString str;
|
||||||
@ -1984,6 +2058,7 @@ void TFatturazione_lav_app::main_loop()
|
|||||||
warning_box(str);
|
warning_box(str);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
_log = new TLog_report("Fatturazione");
|
||||||
|
|
||||||
if (_msk->get_bool(F_SAVEDATA))
|
if (_msk->get_bool(F_SAVEDATA))
|
||||||
{
|
{
|
||||||
@ -2008,6 +2083,7 @@ void TFatturazione_lav_app::main_loop()
|
|||||||
if (!dal.ok())
|
if (!dal.ok())
|
||||||
{
|
{
|
||||||
dal.set_day(1);
|
dal.set_day(1);
|
||||||
|
|
||||||
dal.set_month(1);
|
dal.set_month(1);
|
||||||
dal.set_year(year);
|
dal.set_year(year);
|
||||||
}
|
}
|
||||||
@ -2021,6 +2097,18 @@ void TFatturazione_lav_app::main_loop()
|
|||||||
const int period = _msk->get_int(F_PERFAT);
|
const int period = _msk->get_int(F_PERFAT);
|
||||||
const TDate datafat = _msk->get_date(F_DATAFAT);
|
const TDate datafat = _msk->get_date(F_DATAFAT);
|
||||||
long indsped;
|
long indsped;
|
||||||
|
TToken_string tipi;
|
||||||
|
TToken_string stati;
|
||||||
|
TString stato_min("Z");
|
||||||
|
|
||||||
|
elab.last_cli_damn() = -1L;
|
||||||
|
elab.cli_damn() = 0;
|
||||||
|
elab.art_damn() = 0;
|
||||||
|
elab.tipi_stati_iniziali(tipi, stati);
|
||||||
|
|
||||||
|
for (const char * s = stati.get(); s > " "; s = stati.get())
|
||||||
|
if (stato_min > s)
|
||||||
|
stato_min = s;
|
||||||
|
|
||||||
//preparo la query
|
//preparo la query
|
||||||
TString query;
|
TString query;
|
||||||
@ -2043,6 +2131,10 @@ void TFatturazione_lav_app::main_loop()
|
|||||||
TProgind pi(recset.items(), "Fatturazione", true, true);
|
TProgind pi(recset.items(), "Fatturazione", true, true);
|
||||||
long last_clifo = 0;
|
long last_clifo = 0;
|
||||||
int numdocgen = 0;
|
int numdocgen = 0;
|
||||||
|
real totimp;
|
||||||
|
real imposta;
|
||||||
|
real totdoc;
|
||||||
|
real spese;
|
||||||
|
|
||||||
//TAssoc_array dei clienti per cui ho generato dei documenti
|
//TAssoc_array dei clienti per cui ho generato dei documenti
|
||||||
TAssoc_array cliela;
|
TAssoc_array cliela;
|
||||||
@ -2074,7 +2166,8 @@ void TFatturazione_lav_app::main_loop()
|
|||||||
const int items = docsout.items();
|
const int items = docsout.items();
|
||||||
if (items > 0)
|
if (items > 0)
|
||||||
{
|
{
|
||||||
docsout.write();
|
if (!_solototali)
|
||||||
|
docsout.write();
|
||||||
numdocgen += items;
|
numdocgen += items;
|
||||||
TString tmp;
|
TString tmp;
|
||||||
tmp << lastcli;
|
tmp << lastcli;
|
||||||
@ -2082,7 +2175,8 @@ void TFatturazione_lav_app::main_loop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
docsout.destroy(-1);
|
docsout.destroy(-1);
|
||||||
docsin.rewrite();
|
if (!_solototali)
|
||||||
|
docsin.rewrite();
|
||||||
docsin.destroy(-1);
|
docsin.destroy(-1);
|
||||||
}
|
}
|
||||||
lastcli = clifo;
|
lastcli = clifo;
|
||||||
@ -2093,9 +2187,11 @@ void TFatturazione_lav_app::main_loop()
|
|||||||
key.add('C');
|
key.add('C');
|
||||||
key.add(clifo);
|
key.add(clifo);
|
||||||
const TRectype& clienti = cache().get(LF_CFVEN,key);
|
const TRectype& clienti = cache().get(LF_CFVEN,key);
|
||||||
|
const TRectype & docrec = recset.cursor()->curr();
|
||||||
|
const TRectype& clirec = cache().get(LF_CLIFO,key);
|
||||||
|
|
||||||
//se il documento che sto analizzando è corretto, allora:
|
//se il documento che sto analizzando è corretto, allora:
|
||||||
bool cliok = elab.is_document_ok(recset.cursor()->curr());
|
bool cliok = elab.is_document_ok(docrec);
|
||||||
if (cliok)
|
if (cliok)
|
||||||
{
|
{
|
||||||
//se il codice di zona è pieno, allora:
|
//se il codice di zona è pieno, allora:
|
||||||
@ -2114,6 +2210,13 @@ void TFatturazione_lav_app::main_loop()
|
|||||||
cliok = (codcat == mskcat);
|
cliok = (codcat == mskcat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if (!_solototali && docrec.get(DOC_STATO) < stato_min)
|
||||||
|
{
|
||||||
|
TString msg("Bolla n.ro ");
|
||||||
|
msg << docrec.get(DOC_NDOC) << " del " << docrec.get(DOC_DATADOC) << "Cliente " << clifo << " " << clirec.get(CLI_RAGSOC) << " in stato " << docrec.get(DOC_STATO);
|
||||||
|
_log->log(0, msg);
|
||||||
|
}
|
||||||
|
|
||||||
//se ho passato tutti e due i test, allora:
|
//se ho passato tutti e due i test, allora:
|
||||||
if (cliok)
|
if (cliok)
|
||||||
@ -2124,9 +2227,137 @@ void TFatturazione_lav_app::main_loop()
|
|||||||
const int contrper = contr.get_int(LVCONDV_PERFAT);
|
const int contrper = contr.get_int(LVCONDV_PERFAT);
|
||||||
|
|
||||||
//se il cliente non è sospeso e se si è nel periodo di fatturazione giusto, aggiungo il documento alla
|
//se il cliente non è sospeso e se si è nel periodo di fatturazione giusto, aggiungo il documento alla
|
||||||
//lista dei documetni da elaborare
|
//lista dei documenti da elaborare
|
||||||
if (!contr.get_bool(LVCONDV_FATTSOSP) && contrper <= period)
|
if (!contr.get_bool(LVCONDV_FATTSOSP) && contrper <= period)
|
||||||
docsin.add(new TDocumento(recset.cursor()->curr()));
|
{
|
||||||
|
TDocumento * doc = new TDocumento(recset.cursor()->curr());
|
||||||
|
|
||||||
|
if (agghead && !_solototali && doc->get(DOC_CODNUM) == num_buoni && doc->tipo().codice() == tipo_buoni)
|
||||||
|
{
|
||||||
|
|
||||||
|
bool doc_updated = false;
|
||||||
|
// banche
|
||||||
|
|
||||||
|
key.cut(0);
|
||||||
|
key.add(clirec.get(CLI_TIPOCF));
|
||||||
|
key.add(clirec.get(CLI_CODCF));
|
||||||
|
key.add("V");
|
||||||
|
key.add("1");
|
||||||
|
|
||||||
|
const TRectype & cfban = cache().get(LF_CFBAN, key);
|
||||||
|
TString8 abi;
|
||||||
|
TString8 cab;
|
||||||
|
TString iban;
|
||||||
|
|
||||||
|
if (cfban.empty())
|
||||||
|
{
|
||||||
|
abi = clirec.get(CLI_CODABI);
|
||||||
|
cab = clirec.get(CLI_CODCAB);
|
||||||
|
iban = clirec.get(CLI_IBAN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
abi = cfban.get(CFBAN_ABI);
|
||||||
|
cab = cfban.get(CFBAN_CAB);
|
||||||
|
iban = cfban.get(CFBAN_IBAN);
|
||||||
|
}
|
||||||
|
if (cab.full() && cab != "00000")
|
||||||
|
{
|
||||||
|
doc_updated |= (doc->get(DOC_CODABIA) != abi) || (doc->get(DOC_CODCABA) != cab);
|
||||||
|
doc->put(DOC_CODABIA, abi);
|
||||||
|
doc->put(DOC_CODCABA, cab);
|
||||||
|
doc->put(DOC_IBAN, iban);
|
||||||
|
}
|
||||||
|
key.cut(0);
|
||||||
|
key.add(clirec.get(CLI_TIPOCF));
|
||||||
|
key.add(clirec.get(CLI_CODCF));
|
||||||
|
key.add("N");
|
||||||
|
key.add("1");
|
||||||
|
|
||||||
|
const TRectype & cfbanpr = cache().get(LF_CFBAN, key);
|
||||||
|
int progbnp = 0;
|
||||||
|
|
||||||
|
if (cfbanpr.empty())
|
||||||
|
{
|
||||||
|
abi = clienti.get(CFV_CODABIPR);
|
||||||
|
cab = clienti.get(CFV_CODCABPR);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
abi = cfbanpr.get(CFBAN_ABI);
|
||||||
|
cab = cfbanpr.get(CFBAN_CAB);
|
||||||
|
progbnp = cfbanpr.get_int(CFBAN_PROGPR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cab.full() && cab != "00000")
|
||||||
|
{
|
||||||
|
doc_updated |= (doc->get(DOC_CODABIP) != abi) || (doc->get(DOC_CODCABP) != cab);
|
||||||
|
doc->put(DOC_CODABIP, abi);
|
||||||
|
doc->put(DOC_CODCABP, cab);
|
||||||
|
doc->put(DOC_PROGBNP, progbnp);
|
||||||
|
}
|
||||||
|
const TString codpag = clirec.get(CLI_CODPAG);
|
||||||
|
if (codpag.full())
|
||||||
|
{
|
||||||
|
doc_updated |= (doc->get(DOC_CODPAG) != codpag);
|
||||||
|
doc->put(DOC_CODPAG, codpag);
|
||||||
|
}
|
||||||
|
const TString spinc = clienti.get(CFV_PERCSPINC);
|
||||||
|
if (spinc.full())
|
||||||
|
{
|
||||||
|
doc_updated |= (doc->get(DOC_PERCSPINC) != spinc);
|
||||||
|
doc->put(DOC_PERCSPINC, spinc);
|
||||||
|
}
|
||||||
|
const bool addbolli = clienti.get_bool(CFV_ADDBOLLI);
|
||||||
|
doc_updated |= (doc->get_bool(DOC_ADDBOLLI) != addbolli);
|
||||||
|
doc->put(DOC_ADDBOLLI, addbolli);
|
||||||
|
const TString agente1 = clienti.get(CFV_CODAG1);
|
||||||
|
if (agente1.full())
|
||||||
|
{
|
||||||
|
doc_updated |= (doc->get(DOC_CODAGVIS) != agente1);
|
||||||
|
doc->put(DOC_CODAGVIS, agente1);
|
||||||
|
}
|
||||||
|
if (doc_updated)
|
||||||
|
{
|
||||||
|
TString msg("Bolla n.ro ");
|
||||||
|
msg << docrec.get(DOC_NDOC) << " del " << docrec.get(DOC_DATADOC) << " Cliente " << clifo << " " << clirec.get(CLI_RAGSOC) << " aggirnata la testata ";
|
||||||
|
_log->log(2, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int r = 1; !_solototali && r <= doc->physical_rows(); r++)
|
||||||
|
{
|
||||||
|
const TString & codart = (*doc)[r].get(RDOC_CODARTMAG);
|
||||||
|
|
||||||
|
if (codart.full())
|
||||||
|
{
|
||||||
|
const TRectype & rcont = contr.row(codart);
|
||||||
|
TArticolo_lavanderie& art = cached_article_laundry(codart, 'C', clifo, use_indsp ? indsped : 0);
|
||||||
|
//estraggo il record corrispondente su LF_CLIFOGIAC
|
||||||
|
const TRecmag_lavanderie& rec = art.find_rec(annoes);
|
||||||
|
|
||||||
|
if (rec.get_real("DOTOD") < ZERO)
|
||||||
|
{
|
||||||
|
TString msg("Bolla n.ro ");
|
||||||
|
msg << docrec.get(DOC_NDOC) << " del " << docrec.get(DOC_DATADOC) << " Cliente " << clifo << " " << clirec.get(CLI_RAGSOC) << " articolo " << codart << " dotazione odierna negativa";
|
||||||
|
_log->log(2, msg);
|
||||||
|
}
|
||||||
|
if (rec.get_real("DOTIN") < ZERO)
|
||||||
|
{
|
||||||
|
TString msg("Bolla n.ro ");
|
||||||
|
msg << docrec.get(DOC_NDOC) << " del " << docrec.get(DOC_DATADOC) << " Cliente " << clifo << " " << clirec.get(CLI_RAGSOC) << " articolo " << codart << " dotazione iniziale negativa";
|
||||||
|
_log->log(2, msg);
|
||||||
|
}
|
||||||
|
if (prezzo_da_contratto && rcont.get_real(LVRCONDV_PREZZO) == ZERO)
|
||||||
|
{
|
||||||
|
TString msg("Bolla n.ro ");
|
||||||
|
msg << docrec.get(DOC_NDOC) << " del " << docrec.get(DOC_DATADOC) << " Cliente " << clifo << " " << clirec.get(CLI_RAGSOC) << " articolo " << codart << " prezzo da contratto zero";
|
||||||
|
_log->log(2, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
docsin.add(doc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2140,29 +2371,54 @@ void TFatturazione_lav_app::main_loop()
|
|||||||
const int items = docsout.items();
|
const int items = docsout.items();
|
||||||
if (items > 0)
|
if (items > 0)
|
||||||
{
|
{
|
||||||
docsout.write();
|
if (!_solototali)
|
||||||
|
docsout.write();
|
||||||
numdocgen += items;
|
numdocgen += items;
|
||||||
TString tmp;
|
TString tmp;
|
||||||
tmp << lastcli;
|
tmp << lastcli;
|
||||||
cliela.add(tmp, tmp);
|
cliela.add(tmp, tmp);
|
||||||
|
for (int i = 0; i < items; i++)
|
||||||
|
{
|
||||||
|
const TDocumento & doc = docsout[i];
|
||||||
|
|
||||||
|
totimp += doc.imponibile();
|
||||||
|
imposta += doc.imposta();
|
||||||
|
totdoc += doc.totale_doc();
|
||||||
|
spese += doc.spese();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
docsout.destroy(-1);
|
docsout.destroy(-1);
|
||||||
docsin.rewrite();
|
if (!_solototali)
|
||||||
|
docsin.rewrite();
|
||||||
docsin.destroy(-1);
|
docsin.destroy(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
genera_bolle_nolo(cliela, elab, numdocgen);
|
genera_bolle_nolo(cliela, elab, numdocgen, totimp, imposta, totdoc, spese);
|
||||||
numdocgen += elab.write_fatt_ragg();
|
numdocgen += elab.write_fatt_ragg();
|
||||||
|
|
||||||
TString str;
|
TString str;
|
||||||
|
|
||||||
if (numdocgen > 1 || numdocgen == 0)
|
if (!_solototali)
|
||||||
str << "Sono state generate " << numdocgen << " fatture";
|
{
|
||||||
else
|
if (numdocgen > 1 || numdocgen == 0)
|
||||||
str << "E' stata generata " << numdocgen << " fattura";
|
str << "Sono state generate " << numdocgen << " fatture";
|
||||||
|
else
|
||||||
|
str << "E' stata generata " << numdocgen << " fattura";
|
||||||
|
}
|
||||||
|
|
||||||
message_box(str);
|
message_box(str);
|
||||||
message_box(TR("Elaborazione terminata"));
|
message_box(TR("Elaborazione terminata"));
|
||||||
|
str = "Clienti Danneggati Articoli danneggiati";
|
||||||
|
_log->log(0, str);
|
||||||
|
str.format(" %5d %5d", elab.cli_damn(), elab.art_damn());
|
||||||
|
_log->log(0, str);
|
||||||
|
str = "Numero fatture Imponibile Imposta Totale Spese";
|
||||||
|
_log->log(0, str);
|
||||||
|
str.format(" %5d", numdocgen);
|
||||||
|
str << totimp.stringa(15) << imposta.stringa(14) << totdoc.stringa(15) << spese.stringa(13);
|
||||||
|
_log->log(0, str);
|
||||||
|
_log->print_or_preview();
|
||||||
|
delete _log;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#define F_CODCATC 111
|
#define F_CODCATC 111
|
||||||
#define F_CODZONA 112
|
#define F_CODZONA 112
|
||||||
#define F_SAVEDATA 113
|
#define F_SAVEDATA 113
|
||||||
|
#define F_SOLOTOTALI 114
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -148,9 +148,14 @@ BEGIN
|
|||||||
ITEM "0|Giornaliera"
|
ITEM "0|Giornaliera"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_SOLOTOTALI
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 12 "Solo Totali"
|
||||||
|
END
|
||||||
|
|
||||||
BOOLEAN F_SAVEDATA
|
BOOLEAN F_SAVEDATA
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 12 "Salvataggio dati"
|
PROMPT 2 14 "Salvataggio dati"
|
||||||
END
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
@ -22,6 +22,12 @@
|
|||||||
#define F_CAUSALE_RESO 121
|
#define F_CAUSALE_RESO 121
|
||||||
#define F_CAUSALE_ROTTO 122
|
#define F_CAUSALE_ROTTO 122
|
||||||
#define F_MOV_CONGUAGLIO 123
|
#define F_MOV_CONGUAGLIO 123
|
||||||
|
#define F_GRUPPO 124
|
||||||
|
#define F_CONTO 125
|
||||||
|
#define F_SOTTOC 126
|
||||||
|
#define F_DESCR 127
|
||||||
|
|
||||||
|
#define R_CON 16
|
||||||
//#define F_STAMPA_BOLLA 117
|
//#define F_STAMPA_BOLLA 117
|
||||||
//#define F_CALC_IMPORTO 118
|
//#define F_CALC_IMPORTO 118
|
||||||
//#define F_CONTR_DOTAZIONE 119
|
//#define F_CONTR_DOTAZIONE 119
|
@ -1,4 +1,4 @@
|
|||||||
#include "lvtbcau.h"
|
2#include "lvtbcau.h"
|
||||||
|
|
||||||
TOOLBAR "" 0 0 0 2
|
TOOLBAR "" 0 0 0 2
|
||||||
#include "relapbar.h"
|
#include "relapbar.h"
|
||||||
@ -280,6 +280,8 @@ BOOLEAN F_CAUSALE_ROTTO
|
|||||||
BEGIN
|
BEGIN
|
||||||
FIELD B3
|
FIELD B3
|
||||||
PROMPT 25 16 "Causale di rotto"
|
PROMPT 25 16 "Causale di rotto"
|
||||||
|
MESSAGE TRUE ENABLE,-R_CON
|
||||||
|
MESSAGE TRUE CLEAR,-R_CON
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN F_MOV_CONGUAGLIO
|
BOOLEAN F_MOV_CONGUAGLIO
|
||||||
@ -288,6 +290,58 @@ BEGIN
|
|||||||
PROMPT 45 16 "Non movimentare conguaglio"
|
PROMPT 45 16 "Non movimentare conguaglio"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
NUMBER F_GRUPPO 3
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 18 "Conto per i rotti "
|
||||||
|
FIELD I0
|
||||||
|
GROUP R_CON
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_CONTO 3
|
||||||
|
BEGIN
|
||||||
|
PROMPT 22 18 ""
|
||||||
|
FIELD I1
|
||||||
|
GROUP R_CON
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_SOTTOC 6
|
||||||
|
BEGIN
|
||||||
|
PROMPT 26 18 ""
|
||||||
|
FIELD I2
|
||||||
|
GROUP R_CON
|
||||||
|
USE LF_PCON
|
||||||
|
INPUT GRUPPO F_GRUPPO
|
||||||
|
INPUT CONTO F_CONTO
|
||||||
|
INPUT SOTTOCONTO F_SOTTOC
|
||||||
|
DISPLAY "Gruppo" GRUPPO
|
||||||
|
DISPLAY "Conto" CONTO
|
||||||
|
DISPLAY "Sottoconto" SOTTOCONTO
|
||||||
|
DISPLAY "Descrizione@50" DESCR
|
||||||
|
OUTPUT F_GRUPPO GRUPPO
|
||||||
|
OUTPUT F_CONTO CONTO
|
||||||
|
OUTPUT F_SOTTOC SOTTOCONTO
|
||||||
|
OUTPUT F_DESCR DESCR
|
||||||
|
CHECKTYPE NORMAL
|
||||||
|
WARNING "Conto assente"
|
||||||
|
ADD RUN cg0 -0
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_DESCR 50 37
|
||||||
|
BEGIN
|
||||||
|
PROMPT 36 18 ""
|
||||||
|
GROUP R_CON
|
||||||
|
USE LF_PCON KEY 2
|
||||||
|
INPUT DESCR F_DESCR
|
||||||
|
DISPLAY "Descrizione@50" DESCR
|
||||||
|
DISPLAY "Gruppo" GRUPPO
|
||||||
|
DISPLAY "Conto" CONTO
|
||||||
|
DISPLAY "Sottoconto" SOTTOCONTO
|
||||||
|
COPY OUTPUT F_SOTTOC
|
||||||
|
WARNING "Conto assente"
|
||||||
|
ADD RUN cg0 -0
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
ENDMASK
|
ENDMASK
|
||||||
|
Loading…
x
Reference in New Issue
Block a user