Corretta gestione quantità ritirata/consegnata in eccesso
git-svn-id: svn://10.65.10.50/branches/R_10_00@23140 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
07f592bd22
commit
3e4fc7888e
@ -303,7 +303,7 @@ bool TGenera_documenti_app::crea_documento_ritiro(const TISAM_recordset& ritiro,
|
||||
doc.put("CODITI", coditi); //codice itinerario
|
||||
|
||||
//calcola tutte le quantità riportate sui documenti di ritiro, sui documenti di anticipo
|
||||
int numerodoc = scansione_ritiri_anticipi(codcli, dtcons, 'R', doc);
|
||||
const int numerodoc = scansione_ritiri_anticipi(codcli, dtcons, 'R', doc);
|
||||
scansione_ritiri_anticipi(codcli, dtcons, 'A', doc);
|
||||
|
||||
int err = 1;
|
||||
@ -597,7 +597,6 @@ bool TGenera_documenti_app::crea_documento_plan(const TISAM_recordset& plan, TLo
|
||||
void TGenera_documenti_app::crea_riga(TToken_string& chiave, const char modpas, const int tplis,
|
||||
const bool tmp, const bool prinbo, TDocumento& doc, TLog_report& rep)
|
||||
{
|
||||
const int perarr = ini_get_int(CONFIG_DITTA, "lv", "Perarr");
|
||||
//creo la nuova riga
|
||||
TString4 tiporiga;
|
||||
switch (_buono)
|
||||
@ -609,7 +608,7 @@ void TGenera_documenti_app::crea_riga(TToken_string& chiave, const char modpas,
|
||||
|
||||
const long codcli = doc.get_long(DOC_CODCF);
|
||||
const long codcont = doc.get_long(DOC_CODCONT);
|
||||
const TString80 codart = chiave.get(0);
|
||||
const TCodice_articolo codart = chiave.get(0);
|
||||
const TString4 causale = chiave.get(1);
|
||||
|
||||
//calcolo della quantità che va sulla bolla
|
||||
@ -633,7 +632,7 @@ void TGenera_documenti_app::crea_riga(TToken_string& chiave, const char modpas,
|
||||
//instanzio una cache sulla tabella del magazzino
|
||||
const TRectype& anamag = cache().get(LF_ANAMAG,codart);
|
||||
//recupero i dati di interesse dall'anagrafica di magazzino, ma devo evitare divisioni per 0
|
||||
const real ppconf = anamag.get_real(ANAMAG_PPCONF) != 0 ? anamag.get_real(ANAMAG_PPCONF) : 1;
|
||||
const long ppconf = anamag.get_real(ANAMAG_PPCONF) != 0 ? anamag.get_int(ANAMAG_PPCONF) : 1;
|
||||
TString descrart;
|
||||
descrart << anamag.get(ANAMAG_DESCR) << anamag.get(ANAMAG_DESCRAGG);
|
||||
|
||||
@ -753,13 +752,14 @@ void TGenera_documenti_app::crea_riga(TToken_string& chiave, const char modpas,
|
||||
if (quantita_arr > ZERO && arrot)
|
||||
{
|
||||
//calcolo di quanti pezzi sforo
|
||||
long arr = quantita_arr.integer() % ppconf.integer();
|
||||
long arr = quantita_arr.integer() % ppconf;
|
||||
//se sforo (arr > 0) allora calcolo quanti pezzi in più gli devo dare e aggiorno la quantità
|
||||
if (arr > 0)
|
||||
{
|
||||
if (arr > ppconf.integer() * perarr / 100) //arr <= ppconf*perarr/100 -> formula calcolo congualgio di Tassan
|
||||
const int perarr = ini_get_int(CONFIG_DITTA, "lv", "Perarr");
|
||||
if (arr > ppconf * perarr / 100) //arr <= ppconf*perarr/100 -> formula calcolo conguaglio di Tassan
|
||||
{
|
||||
arr = ppconf.integer() - arr;
|
||||
arr = ppconf - arr;
|
||||
quantita_arr += arr;
|
||||
}
|
||||
else
|
||||
@ -791,7 +791,7 @@ void TGenera_documenti_app::crea_riga(TToken_string& chiave, const char modpas,
|
||||
}
|
||||
|
||||
//essendo la dot tmp un di cui la quantità ritirata è sempre quella
|
||||
if(cau.is_ritiro())
|
||||
if (cau.is_ritiro())
|
||||
rdoc.put(RDOC_QTAGG1, qta1); //quantità ritirata
|
||||
|
||||
//elaborazione sul prezzo da utilizzare
|
||||
@ -890,8 +890,8 @@ void TGenera_documenti_app::crea_riga(TToken_string& chiave, const char modpas,
|
||||
rdoc.put(RDOC_UMQTA, um);
|
||||
|
||||
//scrivo il magazzino
|
||||
TCausale_magazzino rit(cau.causale_ritiro());
|
||||
TCausale_magazzino con(cau.causale_consegna());
|
||||
const TCausale_magazzino rit(cau.causale_ritiro());
|
||||
const TCausale_magazzino con(cau.causale_consegna());
|
||||
|
||||
TString8 magazzino;
|
||||
TString8 magazzinoc;
|
||||
@ -931,18 +931,15 @@ bool TGenera_documenti_app::numerazione_ddt(TString& codnum, TString& tpdoc, TSt
|
||||
switch (_buono)
|
||||
{
|
||||
case 'P':
|
||||
{
|
||||
codnum = _configlv->get("NUM_PRE(0)");
|
||||
tpdoc = _configlv->get("TIPODOC_PRE(0)");
|
||||
}
|
||||
codnum = _configlv->get("NUM_PRE(0)");
|
||||
tpdoc = _configlv->get("TIPODOC_PRE(0)");
|
||||
break;
|
||||
case 'C':
|
||||
{
|
||||
codnum = _configlv->get("NUM_GEN");
|
||||
tpdoc = _configlv->get("TIPODOC_GEN");
|
||||
}
|
||||
codnum = _configlv->get("NUM_GEN");
|
||||
tpdoc = _configlv->get("TIPODOC_GEN");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
//instanzio una cache sulla tabella dei tipi documento (cerco lo stato iniziale)
|
||||
@ -1055,12 +1052,12 @@ int TGenera_documenti_app::scansione_ritiri_anticipi(const long codcli, const TD
|
||||
void TGenera_documenti_app::calcolo_quantita(const TDocumento& doc, const char ritoant)
|
||||
{
|
||||
//scorro le righe documento
|
||||
for (long i = 1; i <= doc.rows(); i++)
|
||||
FOR_EACH_PHYSICAL_RDOC(doc, i, prdoc)
|
||||
{
|
||||
//instanzio la riga corrente
|
||||
const TRiga_documento& rdoc = doc[i];
|
||||
const TRiga_documento& rdoc = *prdoc;
|
||||
//estraggo i dati di interesse
|
||||
const TString80 codart = rdoc.get(RDOC_CODARTMAG);
|
||||
const TCodice_articolo codart = rdoc.get(RDOC_CODARTMAG);
|
||||
const TString4 codcau = rdoc.get(RDOC_CODAGG1);
|
||||
TToken_string key; key.add(codart); key.add(codcau);
|
||||
const real qtardoc = rdoc.get_real(RDOC_QTAGG1);
|
||||
@ -1140,7 +1137,7 @@ bool TGenera_documenti_app::transfer()
|
||||
|
||||
long codcli = _msk->get_long(F_CODCF);
|
||||
|
||||
TLog_report rep("Riepilogo associazioni");
|
||||
TLog_report rep(TR("Riepilogo associazioni"));
|
||||
rep.kill_duplicates(true);
|
||||
|
||||
//preparo un recordset che contiene tutti planning per cui voglio creare i documenti relativi
|
||||
@ -1259,14 +1256,14 @@ bool TGenera_documenti_app::transfer()
|
||||
outf << "[Transaction]" << endl; // Transaction header
|
||||
outf << "Action=S" << endl; // 'S'tampa o 'A'nteprima
|
||||
outf << "Mode=D" << endl; // Definitive (always?)
|
||||
outf << "NoPrintDlg=X" << endl; // Dont' prompt the user with the print dialog
|
||||
outf << "NoPrintDlg=X" << endl; // Don't prompt the user with the print dialog
|
||||
outf << endl;
|
||||
outf << "[33]" << endl; // Transaction body
|
||||
long nx = 0; // Document counter
|
||||
|
||||
FOR_EACH_ASSOC_OBJECT(documenti, obj, r, riga)
|
||||
{
|
||||
TDoc_key& kdoc = *(TDoc_key*)riga;
|
||||
const TDoc_key& kdoc = *(TDoc_key*)riga;
|
||||
outf << "Doc(" << (nx++) << ")=";
|
||||
outf << chiavedoc << kdoc.ndoc() << endl;
|
||||
}
|
||||
@ -1279,20 +1276,22 @@ bool TGenera_documenti_app::transfer()
|
||||
TExternal_app app(cmdline);
|
||||
app.run();
|
||||
}
|
||||
/* Il 6-11-2015 ci siamo accorti che lv1 -3 non esiste (e nella 10.0 non lo chiamava nemmeno)
|
||||
{
|
||||
TString cmdline; cmdline << "lv1 -3 -i" << tmp;
|
||||
TExternal_app app(cmdline);
|
||||
app.run();
|
||||
}
|
||||
*/
|
||||
tmp.fremove();
|
||||
}
|
||||
}
|
||||
|
||||
if (documenti.items() == 0)
|
||||
warning_box(TR("Non è stato possibile generare nessun documento; probabilmente i documenti richiesti esistono già"));
|
||||
warning_box(TR("Non è stato possibile generare alcun documento:\nprobabilmente i documenti richiesti esistono già."));
|
||||
else
|
||||
{
|
||||
if (adata < TODAY && _msk->get_int(F_TPGEN) == 0)
|
||||
if (adata < TDate(TODAY) && _msk->get_int(F_TPGEN) == 0)
|
||||
warning_box(TR("Non è stato possibile generare documenti con data prevista consegna nel passato"));
|
||||
else
|
||||
{
|
||||
|
@ -530,7 +530,7 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do
|
||||
bool elcons = contr.get_bool(LVCONDV_ELCONS);
|
||||
bool rifbol = contr.get_bool(LVCONDV_RIFBOL);
|
||||
|
||||
const bool splitpay = doc.clifor().get_bool(CLI_SPLITPAY);
|
||||
const bool splitpay = doc.anno() > 2015 && doc.clifor().get_bool(CLI_SPLITPAY);
|
||||
real consvconv;
|
||||
real impvconv;
|
||||
TAssoc_array nolo_computed;
|
||||
@ -602,8 +602,6 @@ void TFatturazione_lavanderie::post_process(TLista_documenti& doc_out, TLista_do
|
||||
const bool ragart = contr.get_bool(LVCONDV_RAGART); // leggo il flag di testata raggruppa su unico articolo
|
||||
const int tipocan = contr.get_int(LVCONDV_TIPOCAN); // leggo il tipo canone
|
||||
const real redditivita = contr.get_real(LVCONDV_REDDI);
|
||||
|
||||
|
||||
if (ragart)
|
||||
{
|
||||
real totmerc;
|
||||
@ -1760,9 +1758,9 @@ void TFatturazione_lav_app::log(const char* msg, int sev)
|
||||
//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, real& totimp, real& imposta, real& totdoc, real& spese)
|
||||
{
|
||||
TString4 codnum = ini_get_string(CONFIG_DITTA, "lv", "NUM_GEN");
|
||||
TString4 tipodoc = ini_get_string(CONFIG_DITTA, "lv", "TIPODOC_GEN");
|
||||
char stato = cache().get("%TIP", tipodoc, "S2").mid(1,1)[0];
|
||||
const TString4 codnum = ini_get_string(CONFIG_DITTA, "lv", "NUM_GEN");
|
||||
const TString4 tipodoc = ini_get_string(CONFIG_DITTA, "lv", "TIPODOC_GEN");
|
||||
const char stato = cache().get("%TIP", tipodoc, "S2").mid(1,1)[0];
|
||||
|
||||
//preparo la query sui contratti
|
||||
TString str;
|
||||
@ -2044,8 +2042,8 @@ bool TFatturazione_lav_app::copy_file(const TFilename& src, const TFilename& dst
|
||||
{
|
||||
// Crea la cartella di destinazione se necessario
|
||||
const char* dstdir = dst.path();
|
||||
if (*dstdir && !xvt_fsys_mkdir(dstdir))
|
||||
return error_box(FR("Impossibile creare la cartella %s"), dst.path());
|
||||
if (*dstdir && !xvt_fsys_dir_exists(dstdir) && !xvt_fsys_mkdir(dstdir))
|
||||
return cantwrite_box(dstdir);
|
||||
|
||||
// Copia veramente il file
|
||||
return ::fcopy(src, dst);
|
||||
@ -2346,6 +2344,7 @@ void TFatturazione_lav_app::main_loop()
|
||||
TString msg;
|
||||
msg << TR("Non ci sono contratti in essere per il cliente ") << clifo << " " << clirec.get(CLI_RICALT) << TR(" in data ") << datafat.string();
|
||||
log(msg);
|
||||
continue;
|
||||
}
|
||||
const int contrper = contr.get_int(LVCONDV_PERFAT);
|
||||
|
||||
|
@ -30,7 +30,6 @@ NUMBER F_DACODCF 6
|
||||
BEGIN
|
||||
PROMPT 2 2 "Dal Cliente "
|
||||
FLAGS "U"
|
||||
KEY 1
|
||||
USE LF_CLIFO
|
||||
INPUT TIPOCF "C"
|
||||
INPUT CODCF F_DACODCF
|
||||
@ -46,7 +45,6 @@ END
|
||||
STRING F_DARAGSOC 50 30
|
||||
BEGIN
|
||||
PROMPT 32 2 ""
|
||||
KEY 1
|
||||
USE LF_CLIFO KEY 2
|
||||
INPUT TIPOCF "C"
|
||||
INPUT RAGSOC F_DARAGSOC
|
||||
@ -62,13 +60,10 @@ NUMBER F_ACODCF 6
|
||||
BEGIN
|
||||
PROMPT 2 3 "Al Cliente "
|
||||
FLAGS "U"
|
||||
KEY 1
|
||||
USE LF_CLIFO
|
||||
COPY USE F_DACODCF
|
||||
INPUT TIPOCF "C"
|
||||
INPUT CODCF F_ACODCF
|
||||
DISPLAY "Codice" CODCF
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
DISPLAY "Partita IVA@11" PAIV
|
||||
COPY DISPLAY F_DACODCF
|
||||
OUTPUT F_ACODCF CODCF
|
||||
OUTPUT F_ARAGSOC RAGSOC
|
||||
CHECKTYPE SEARCH
|
||||
@ -78,13 +73,10 @@ END
|
||||
STRING F_ARAGSOC 50 30
|
||||
BEGIN
|
||||
PROMPT 32 3 ""
|
||||
KEY 1
|
||||
USE LF_CLIFO KEY 2
|
||||
COPY USE F_DARAGSOC
|
||||
INPUT TIPOCF "C"
|
||||
INPUT RAGSOC F_ARAGSOC
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
DISPLAY "Partita IVA@11" PAIV
|
||||
DISPLAY "Codice" CODCF
|
||||
COPY DISPLAY F_DARAGSOC
|
||||
COPY OUTPUT F_ACODCF
|
||||
CHECKTYPE SEARCH
|
||||
ADD RUN cg0 -1
|
||||
|
@ -664,8 +664,7 @@ bool TAcquisizione_lavanderie_app::elabora_file(const TString& file, TLog_report
|
||||
|
||||
TDate datadoc;
|
||||
long codcf = 0;
|
||||
TString80 codcf_str;
|
||||
TString80 codart;
|
||||
TCodice_articolo codart;
|
||||
long qta;
|
||||
long rotti;
|
||||
long ndoc = 0;
|
||||
@ -689,7 +688,7 @@ bool TAcquisizione_lavanderie_app::elabora_file(const TString& file, TLog_report
|
||||
continue;
|
||||
}
|
||||
|
||||
codcf_str = riga.mid(8,6); codcf = atol(codcf_str);
|
||||
const TString& codcf_str = riga.mid(8,6); codcf = atol(codcf_str);
|
||||
codart = riga.mid(14,8);
|
||||
qta = atol(riga.mid(22,6));
|
||||
rotti = atol(riga.mid(28,6));
|
||||
@ -705,7 +704,7 @@ bool TAcquisizione_lavanderie_app::elabora_file(const TString& file, TLog_report
|
||||
const int d = atoi(riga.mid(6,2));
|
||||
if (d > 0 && d <= 31 && m > 0 && m <= 12 && y > 2000)
|
||||
{
|
||||
codcf_str = riga.mid(28,20); codcf = atol(codcf_str);
|
||||
const TString& codcf_str = riga.mid(28,20); codcf = atol(codcf_str);
|
||||
datadoc = TDate(d, m, y);
|
||||
codart = riga.mid(8,20);
|
||||
qta = atoi(riga.mid(48,11));
|
||||
@ -1040,43 +1039,40 @@ bool TAcquisizione_lavanderie_app::transfer()
|
||||
//tutti, altrimenti elaboro esattamente il file che è scritto sullo sheet
|
||||
bool elaborato = false;
|
||||
bool esiste = false;
|
||||
FOR_EACH_SHEET_ROW(sheet, r1, row1)
|
||||
FOR_EACH_SHEET_ROW(sheet, r1, row1) if (!row1->empty_items())
|
||||
{
|
||||
if(row1->full())
|
||||
if (row1->find('/') >= 0 || row1->find('\\') >= 0)
|
||||
file = *row1;
|
||||
else
|
||||
{
|
||||
if (row1->find('/') >= 0 || row1->find('\\') >= 0)
|
||||
file = *row1;
|
||||
else
|
||||
{
|
||||
file = path;
|
||||
file.add(*row1);
|
||||
}
|
||||
|
||||
if (file.find('*') >= 0 || file.find('?') >= 0)
|
||||
{
|
||||
TString_array lista_file;
|
||||
list_files(file, lista_file);
|
||||
|
||||
FOR_EACH_ARRAY_ROW(lista_file, r2, row2)
|
||||
{
|
||||
const TFilename strname = *row2;
|
||||
if (strname.exist())
|
||||
{
|
||||
esiste = true;
|
||||
elaborato = elabora_file(strname, logrep, articoli, nrighe, nrsalt);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (file.exist())
|
||||
{
|
||||
esiste = true;
|
||||
elaborato = elabora_file(file, logrep, articoli, nrighe, nrsalt);
|
||||
}
|
||||
|
||||
if (!esiste)
|
||||
warning_box(TR("ATTENZIONE: non č stato trovato nessun file da elaborare"));
|
||||
file = path;
|
||||
file.add(*row1);
|
||||
}
|
||||
|
||||
if (file.find('*') >= 0 || file.find('?') >= 0)
|
||||
{
|
||||
TString_array lista_file;
|
||||
list_files(file, lista_file);
|
||||
|
||||
FOR_EACH_ARRAY_ROW(lista_file, r2, row2)
|
||||
{
|
||||
const TFilename strname = *row2;
|
||||
if (strname.exist())
|
||||
{
|
||||
esiste = true;
|
||||
elaborato = elabora_file(strname, logrep, articoli, nrighe, nrsalt);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (file.exist())
|
||||
{
|
||||
esiste = true;
|
||||
elaborato = elabora_file(file, logrep, articoli, nrighe, nrsalt);
|
||||
}
|
||||
|
||||
if (!esiste)
|
||||
warning_box(TR("ATTENZIONE: non è stato trovato nessun file da elaborare"));
|
||||
}
|
||||
|
||||
if (elaborato)
|
||||
@ -1151,9 +1147,9 @@ bool TAcquisizione_lavanderie_app::transfer()
|
||||
|
||||
FOR_EACH_ARRAY_ROW(lista_file, r2, row2)
|
||||
{
|
||||
TFilename strname(*row2);
|
||||
const TFilename strname(*row2);
|
||||
if (strname.exist())
|
||||
sposta_file(*row2);
|
||||
sposta_file(strname);
|
||||
}
|
||||
}
|
||||
else if (file.exist())
|
||||
@ -1192,5 +1188,5 @@ int lv2600(int argc, char *argv[])
|
||||
{
|
||||
TAcquisizione_lavanderie_app a;
|
||||
a.run (argc, argv, TR("Acquisizione da contapezzi"));
|
||||
return TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
224
lv/lv2700.cpp
224
lv/lv2700.cpp
@ -188,134 +188,136 @@ void TRiepBolle_app::elabora(const TMask& mask)const
|
||||
TRelation rel(LF_CLIFO);
|
||||
TCursor cli(&rel, "", 1, &from, &to);
|
||||
const long ncli = cli.items();
|
||||
TProgress_monitor pi_cli(ncli, TR("Estrazione clienti"));
|
||||
|
||||
for (cli = 0L; cli.pos() < ncli && pi_cli.add_status(); ++cli)
|
||||
if (ncli > 0)
|
||||
{
|
||||
const long codcli = cli.curr().get_long(CLI_CODCF);
|
||||
//inserire parametri filtri
|
||||
TISAM_recordset docs(query);
|
||||
docs.set_var("#CODCF", codcli);
|
||||
const TRecnotype docsi = docs.items();
|
||||
if (docsi == 0)
|
||||
continue;
|
||||
|
||||
TString_array nbolle;
|
||||
TString_array datebolle;
|
||||
TAssoc_array riepilogo;
|
||||
TRiepBolle_report rep;
|
||||
if (!rep.load("lv2700a"))
|
||||
return;
|
||||
|
||||
const TReport_section& body = rep.section('B', 1);
|
||||
TString4 last_fld;
|
||||
for (int f = body.items()-1; f > 0; f--)
|
||||
TProgress_monitor pi_cli(ncli, TR("Estrazione clienti"));
|
||||
for (cli = 0L; cli.pos() < ncli && pi_cli.add_status(); ++cli)
|
||||
{
|
||||
const TReport_field& fld = body.field(f);
|
||||
const TString& src = fld.field();
|
||||
if (src.len() == 2 && src > last_fld)
|
||||
last_fld = src;
|
||||
}
|
||||
int last_col = (last_fld[0]-'A'+1)*26 + (last_fld[1]-'A'+1) - 4;
|
||||
if (last_col < 66) last_col = 66;
|
||||
const long codcli = cli.curr().get_long(CLI_CODCF);
|
||||
//inserire parametri filtri
|
||||
TISAM_recordset docs(query);
|
||||
docs.set_var("#CODCF", codcli);
|
||||
const TRecnotype docsi = docs.items();
|
||||
if (docsi == 0)
|
||||
continue;
|
||||
|
||||
TRiepBolle_recordset* riep_set = new TRiepBolle_recordset(last_col);
|
||||
((TReport &)rep).set_recordset(riep_set);
|
||||
TString_array nbolle;
|
||||
TString_array datebolle;
|
||||
TAssoc_array riepilogo;
|
||||
TRiepBolle_report rep;
|
||||
if (!rep.load("lv2700a"))
|
||||
return;
|
||||
|
||||
int count = 1;
|
||||
|
||||
for(bool ok = docs.move_first(); ok; ok = docs.move_next())
|
||||
{
|
||||
const TDocumento d = docs.cursor()->curr();
|
||||
|
||||
int id = -1;
|
||||
FOR_EACH_PHYSICAL_RDOC(d, r, rdoc)
|
||||
const TReport_section& body = rep.section('B', 1);
|
||||
TString4 last_fld;
|
||||
for (int f = body.items()-1; f > 0; f--)
|
||||
{
|
||||
const TRiga_documento& row = *rdoc;
|
||||
const TCodice_articolo articolo = row.get(RDOC_CODARTMAG);
|
||||
if (articolo.blank())
|
||||
continue;
|
||||
const TReport_field& fld = body.field(f);
|
||||
const TString& src = fld.field();
|
||||
if (src.len() == 2 && src > last_fld)
|
||||
last_fld = src;
|
||||
}
|
||||
int last_col = (last_fld[0]-'A'+1)*26 + (last_fld[1]-'A'+1) - 4;
|
||||
if (last_col < 66) last_col = 66;
|
||||
|
||||
//se la causale è di reso devo leggere il ritirato e non il consegnato
|
||||
const TCausale_lavanderie& cau = cached_causale_lavanderie(row.get(RDOC_CODAGG1));
|
||||
real qta;
|
||||
TRiepBolle_recordset* riep_set = new TRiepBolle_recordset(last_col);
|
||||
((TReport &)rep).set_recordset(riep_set);
|
||||
|
||||
if (cau.is_reso())
|
||||
int count = 1;
|
||||
|
||||
for(bool ok = docs.move_first(); ok; ok = docs.move_next())
|
||||
{
|
||||
const TDocumento d = docs.cursor()->curr();
|
||||
|
||||
int id = -1;
|
||||
FOR_EACH_PHYSICAL_RDOC(d, r, rdoc)
|
||||
{
|
||||
if (print_resi)
|
||||
qta = row.get_real(RDOC_QTAGG1);
|
||||
}
|
||||
else
|
||||
{
|
||||
const TCausale_magazzino& caumag = cached_causale_magazzino(cau.get("S2"));
|
||||
if (!print_da_fatt || caumag.get("S2").mid(36, 2) == "+1")
|
||||
qta = row.get_real(RDOC_QTA);
|
||||
}
|
||||
if (!qta.is_zero())
|
||||
{
|
||||
if (id < 0)
|
||||
const TRiga_documento& row = *rdoc;
|
||||
const TCodice_articolo articolo = row.get(RDOC_CODARTMAG);
|
||||
if (articolo.blank())
|
||||
continue;
|
||||
|
||||
//se la causale è di reso devo leggere il ritirato e non il consegnato
|
||||
const TCausale_lavanderie& cau = cached_causale_lavanderie(row.get(RDOC_CODAGG1));
|
||||
real qta;
|
||||
|
||||
if (cau.is_reso())
|
||||
{
|
||||
const TString8 numero = d.get(DOC_NDOC);
|
||||
id = nbolle.add(numero);
|
||||
|
||||
const TDate data = d.get_date(DOC_DATADOC);
|
||||
TString8 ggmm; ggmm.format("%02d-%02d", data.day(), data.month());
|
||||
datebolle.add(ggmm, id);
|
||||
if (print_resi)
|
||||
qta = row.get_real(RDOC_QTAGG1);
|
||||
}
|
||||
else
|
||||
{
|
||||
const TCausale_magazzino& caumag = cached_causale_magazzino(cau.get("S2"));
|
||||
if (!print_da_fatt || caumag.get("S2").mid(36, 2) == "+1")
|
||||
qta = row.get_real(RDOC_QTA);
|
||||
}
|
||||
if (!qta.is_zero())
|
||||
{
|
||||
if (id < 0)
|
||||
{
|
||||
const TString8 numero = d.get(DOC_NDOC);
|
||||
id = nbolle.add(numero);
|
||||
|
||||
TArray* riep_row = (TArray*)riepilogo.objptr(articolo);
|
||||
if (riep_row == NULL)
|
||||
riepilogo.add(articolo, riep_row = new TArray);
|
||||
real* q = (real*)riep_row->objptr(id);
|
||||
if (q == NULL)
|
||||
riep_row->add(q = new real, id);
|
||||
*q += qta;
|
||||
const TDate data = d.get_date(DOC_DATADOC);
|
||||
TString8 ggmm; ggmm.format("%02d-%02d", data.day(), data.month());
|
||||
datebolle.add(ggmm, id);
|
||||
}
|
||||
|
||||
TArray* riep_row = (TArray*)riepilogo.objptr(articolo);
|
||||
if (riep_row == NULL)
|
||||
riepilogo.add(articolo, riep_row = new TArray);
|
||||
real* q = (real*)riep_row->objptr(id);
|
||||
if (q == NULL)
|
||||
riep_row->add(q = new real, id);
|
||||
*q += qta;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!riepilogo.empty())
|
||||
{
|
||||
int maxpos = 0L;
|
||||
const int cols = nbolle.items();
|
||||
TString_array keys;
|
||||
|
||||
riepilogo.get_keys(keys);
|
||||
keys.sort();
|
||||
riep_set->first_loop();
|
||||
FOR_EACH_ARRAY_ROW(keys, r, key)//scandisce clienti e tiene buoni solo quelli valorizzati
|
||||
if (!riepilogo.empty())
|
||||
{
|
||||
TArray * row = (TArray*)riepilogo.objptr(*key);
|
||||
int col = 0;
|
||||
int maxpos = 0L;
|
||||
const int cols = nbolle.items();
|
||||
TString_array keys;
|
||||
|
||||
riep_set->new_rec();
|
||||
riep_set->set(col++, codcli); //CAMPO DI ROTTURA
|
||||
riep_set->set(col++, codcli);
|
||||
riep_set->set(col++, *key);
|
||||
riep_set->set(col++, cached_article(*key).get(ANAMAG_DESCR));
|
||||
FOR_EACH_ARRAY_ITEM(nbolle, c, obj)
|
||||
{
|
||||
riep_set->set(col++, datebolle.row(c));
|
||||
riep_set->set(col++, nbolle.row(c));
|
||||
const real * qta = (real *) row->objptr(c);
|
||||
|
||||
riep_set->set(col++, qta == NULL ? EMPTY_STRING : qta->stringa(10, 0));
|
||||
riep_set->set_max_column(col);
|
||||
}
|
||||
}
|
||||
#ifdef DBG
|
||||
//Crea file che contiene il recordset per debug
|
||||
riep_set->save_as("c:/temp/riepilogoBolla.txt");
|
||||
#endif
|
||||
|
||||
//carica tutte le variabili del report.
|
||||
if (riep_set->items() > 0L)
|
||||
{
|
||||
const int loops = riep_set->loops();
|
||||
rep.mask2report(mask);
|
||||
riepilogo.get_keys(keys);
|
||||
keys.sort();
|
||||
riep_set->first_loop();
|
||||
for (int i = 0 ; i < loops; i++, riep_set->next_loop())
|
||||
b.add(rep);
|
||||
FOR_EACH_ARRAY_ROW(keys, r, key)//scandisce clienti e tiene buoni solo quelli valorizzati
|
||||
{
|
||||
TArray * row = (TArray*)riepilogo.objptr(*key);
|
||||
int col = 0;
|
||||
|
||||
riep_set->new_rec();
|
||||
riep_set->set(col++, codcli); //CAMPO DI ROTTURA
|
||||
riep_set->set(col++, codcli);
|
||||
riep_set->set(col++, *key);
|
||||
riep_set->set(col++, cached_article(*key).get(ANAMAG_DESCR));
|
||||
FOR_EACH_ARRAY_ITEM(nbolle, c, obj)
|
||||
{
|
||||
riep_set->set(col++, datebolle.row(c));
|
||||
riep_set->set(col++, nbolle.row(c));
|
||||
const real * qta = (real *) row->objptr(c);
|
||||
|
||||
riep_set->set(col++, qta == NULL ? EMPTY_STRING : qta->stringa(10, 0));
|
||||
riep_set->set_max_column(col);
|
||||
}
|
||||
}
|
||||
#ifdef DBG
|
||||
//Crea file che contiene il recordset per debug
|
||||
riep_set->save_as("c:/temp/riepilogoBolla.txt");
|
||||
#endif
|
||||
|
||||
//carica tutte le variabili del report.
|
||||
if (riep_set->items() > 0L)
|
||||
{
|
||||
const int loops = riep_set->loops();
|
||||
rep.mask2report(mask);
|
||||
riep_set->first_loop();
|
||||
for (int i = 0 ; i < loops; i++, riep_set->next_loop())
|
||||
b.add(rep);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -673,7 +673,7 @@ bool TGestione_buoni_msk::pre_ritirato_handler(TMask_field& f, KEY k)
|
||||
real dotod = magcli.get_long(CLIFOGIAC_DOTOD); //segnalazione Tassan mail 05/04/2011 ore 17:08
|
||||
|
||||
if (ritirato > dotod && f.dirty() && dotin > 0 && dotod > 0) //accordi da Tassan in data 06/04/2011
|
||||
warning_box(TR("ATTENZIONE: stai ritirando un quantitativo maggiore della dotazione!"));
|
||||
warning_box(TR("ATTENZIONE: si sta ritirando un quantitativo maggiore della dotazione!"));
|
||||
|
||||
|
||||
TDocumento& doc = dmsk.doc();
|
||||
@ -777,7 +777,7 @@ bool TGestione_buoni_msk::pre_codart_handler(TMask_field& f, KEY k)
|
||||
if (!datadoc.ok())
|
||||
datadoc = TODAY;
|
||||
|
||||
TLaundry_contract cont(codcf, indsped, datadoc);
|
||||
TLaundry_contract cont(codcf, indsped, datadoc);
|
||||
const TRectype& rcont = cont.row(codart);
|
||||
|
||||
//cerco la causale relativa all'articolo; se non la trovo prendo quella standard
|
||||
@ -900,7 +900,15 @@ bool TGestione_buoni_msk::pre_codart_handler(TMask_field& f, KEY k)
|
||||
|
||||
//controllo se si vuole aggiungere un eventuale nuovo articolo al contratto
|
||||
if (cont.get_int(LVCONDV_CODCONT) <= 0)
|
||||
warning_box(TR("ATTENZIONE: stai generando una bolla per un cliente che non ha nessun contratto in essere"));
|
||||
{
|
||||
static clock_t _next_time = 0;
|
||||
const clock_t curr_time = clock();
|
||||
if (curr_time > _next_time)
|
||||
{
|
||||
xvt_dm_popup_warning(TR("ATTENZIONE: il cliente non ha nessun contratto in essere"));
|
||||
_next_time = curr_time + 5 * CLOCKS_PER_SEC;
|
||||
}
|
||||
}
|
||||
else if (k == K_ENTER && f.dirty() && msk.get(FR_CODARTMAG).full() && rcont.empty() &&
|
||||
yesno_box(TR("L'articolo in esame non fa parte della dotazione standard di questo cliente."
|
||||
"Si desidera aggiungerla ai contratti?")))
|
||||
|
@ -1010,11 +1010,14 @@ const TString& TBuono_prelievo_row::codart() const
|
||||
//DESART: metodo che restituisce la descrizione dell'articolo
|
||||
const TString& TBuono_prelievo_row::desart() const
|
||||
{
|
||||
TString& str = get_tmp_string();
|
||||
str = _rdoc.get(RDOC_DESCR);
|
||||
if (_rdoc.get_bool(RDOC_DESCLUNGA))
|
||||
{
|
||||
TString& str = get_tmp_string();
|
||||
str = _rdoc.get(RDOC_DESCR);
|
||||
str << _rdoc.get(RDOC_DESCEST);
|
||||
return str;
|
||||
return str;
|
||||
}
|
||||
return _rdoc.get(RDOC_DESCR);
|
||||
}
|
||||
|
||||
//CAUSALE: metodo che restituisce il codice della causale della riga
|
||||
|
@ -132,7 +132,7 @@ Item_07 = "Buoni di Consegna", "lv3 -0 -filtI1=1 -defNUM_GEN,TIPODOC_GEN,lv", "F
|
||||
Item_08 = "Fatture", "ve0 -1 -filtI1=2 -defNUM_FAT,TIPODOC_FAT,lv", "F"
|
||||
Item_09 = "Ordini Fornitori", "ve0 -1 -filtI1=3 -defNUM_ORF,TIPODOC_ORF,lv", "F"
|
||||
Item_10 = "Ordini Clienti", "ve0 -1 -filtI1=3 -defNUM_ORC,TIPODOC_ORC,lv", "F"
|
||||
Item_11 = "Fatturazione definitva", "lv2 -4 -defFatDif", "F"
|
||||
Item_11 = "Fatturazione definitiva", "lv2 -4 -defFatDif", "F"
|
||||
Item_12 = "Fatturazione di prova", "lv2 -4 -defFatPro", "F"
|
||||
Item_13 = "Evasione Buoni di Prelievo manuale", "lv3 -1 M", "F"
|
||||
Item_14 = "Evasione Buoni di Prelievo barcode", "lv3 -1 B", "F"
|
||||
|
Loading…
x
Reference in New Issue
Block a user