git-svn-id: svn://10.65.10.50/branches/R_10_00@23168 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
65c9ffe1cd
commit
cb39cedcec
@ -1,18 +1,9 @@
|
||||
#include <xvt.h>
|
||||
#include <checks.h>
|
||||
|
||||
#include "pd6142.h"
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
const int n = (argc > 1) ? atoi(&argv[1][1]) : 0;
|
||||
|
||||
switch(n)
|
||||
{
|
||||
case 0:
|
||||
pd6142100(argc, argv); break;
|
||||
default:
|
||||
error_box("Usare: pd6142 -0");break;
|
||||
}
|
||||
pd6142100(argc, argv);
|
||||
return 0;
|
||||
}
|
||||
|
115
ps/pd6142100.cpp
115
ps/pd6142100.cpp
@ -8,12 +8,12 @@
|
||||
#include <progind.h>
|
||||
#include <relation.h>
|
||||
#include <sheet.h>
|
||||
#include <tabutil.h>
|
||||
#include <urldefid.h>
|
||||
|
||||
#include <nditte.h>
|
||||
#include <mov.h>
|
||||
#include <rmoviva.h>
|
||||
#include "../cg/cglib03.h"
|
||||
|
||||
#include "pd6142100a.h"
|
||||
|
||||
@ -98,7 +98,7 @@ bool TCopia_movimenti::firm_handler(TMask_field& f, KEY k)
|
||||
app()._rcv_firm = codditta;
|
||||
app().set_choice_limits(f.mask());
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TCopia_movimenti::to_ditt_handler(TMask_field& f, KEY key)
|
||||
@ -123,7 +123,7 @@ bool TCopia_movimenti::to_ditt_handler(TMask_field& f, KEY key)
|
||||
app().set_choice_limits(m);
|
||||
m.set(F_SELECTED, l);
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TCopia_movimenti::fr_ditt_handler(TMask_field& f, KEY key)
|
||||
@ -149,7 +149,7 @@ bool TCopia_movimenti::fr_ditt_handler(TMask_field& f, KEY key)
|
||||
app().set_choice_limits(m);
|
||||
m.set(F_SELECTED, l);
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void TCopia_movimenti::set_choice_limits(TMask& m)
|
||||
@ -175,7 +175,7 @@ void TCopia_movimenti::reset_choices(TMask& m)
|
||||
m.reset(F_SELECTED);
|
||||
m.reset(F_DFR);
|
||||
m.reset(F_DTO);
|
||||
_ditte->check(-1, FALSE);
|
||||
_ditte->check(-1, false);
|
||||
}
|
||||
|
||||
long TCopia_movimenti::select_firm_range(long from, long to)
|
||||
@ -225,14 +225,14 @@ bool TCopia_movimenti::select_button(TMask_field& f, KEY key)
|
||||
if (app()._ditte->run() == K_ENTER)
|
||||
app().set_choice_limits(f.mask());
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TCopia_movimenti::reset_button(TMask_field& f, KEY key)
|
||||
{
|
||||
if (key == K_SPACE)
|
||||
app().reset_choices(f.mask());
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void TCopia_movimenti::main_loop()
|
||||
@ -257,7 +257,7 @@ void TCopia_movimenti::main_loop()
|
||||
_anno = msk.get_int(F_ANNO);
|
||||
_mese = msk.get_int(F_MESE);
|
||||
_rcv_firm = msk.get_long(F_RCVFIRM);
|
||||
if (yesno_box("E' stata selezionata la ditta %ld come ditta ricevente. Continuare?",_rcv_firm))
|
||||
if (yesno_box("E' stata selezionata la ditta %ld come ditta ricevente.\nSi desidera continuare?",_rcv_firm))
|
||||
{
|
||||
copia_mov();
|
||||
message_box("Copia movimenti completata.");
|
||||
@ -277,8 +277,8 @@ void TCopia_movimenti::copia_mov()
|
||||
|
||||
long numreg = 0L; // numero di registrazione progressivo
|
||||
long count = 0L; // numero di items (mov+rmoviva) totali
|
||||
TIsamtempfile tmov(LF_MOV,t1,TRUE);
|
||||
TIsamtempfile trmoviva(LF_RMOVIVA,t2,TRUE);
|
||||
TIsamtempfile tmov(LF_MOV,t1,true);
|
||||
TIsamtempfile trmoviva(LF_RMOVIVA,t2,true);
|
||||
tmov.set_autodel();
|
||||
trmoviva.set_autodel();
|
||||
int err=NOERR;
|
||||
@ -295,57 +295,58 @@ void TCopia_movimenti::copia_mov()
|
||||
from.put(MOV_DATAREG,inizio);
|
||||
to.put(MOV_DATAREG,fine);
|
||||
TRelation rel(LF_MOV);
|
||||
rel.add(LF_RMOVIVA,"NUMREG=NUMREG");
|
||||
rel.add(LF_RMOVIVA,"NUMREG==NUMREG");
|
||||
TCursor cur(&rel,"",2,&from,&to);
|
||||
|
||||
TProgind p(_ditte->checked(), TR("Copia movimenti ditte..."));
|
||||
TString msg;
|
||||
const long items = _ditte->items();
|
||||
|
||||
TProgind p(items,"Copia movimenti ditte...", FALSE,TRUE);
|
||||
TString msg;
|
||||
|
||||
for (long i=0; i<items && err == NOERR; i++) // ciclo sulle ditte selezionate
|
||||
if (_ditte->checked(i))
|
||||
for (long i=0; i<items && err == NOERR; i++) if (_ditte->checked(i)) // ciclo sulle ditte selezionate
|
||||
{
|
||||
const long codditta = _ditte->row(i).get_long(1);
|
||||
set_firm(codditta);
|
||||
msg.format(FR("Copia movimenti ditta %ld in corso..."), codditta);
|
||||
p.set_text(msg);
|
||||
const TRecnotype recs = cur.items();
|
||||
for (TRecnotype j=0; j<recs && err==NOERR;j++)
|
||||
{
|
||||
const long codditta = _ditte->row(i).get_long(1);
|
||||
set_firm(codditta);
|
||||
msg.format("Copia movimenti ditta %ld in corso...",codditta);
|
||||
p.setstatus(i);
|
||||
p.set_text(msg);
|
||||
const TRecnotype recs = cur.items();
|
||||
for (TRecnotype j=0; j<recs && err==NOERR;j++)
|
||||
cur = j;
|
||||
if (cur.is_first_match(LF_RMOVIVA))
|
||||
{
|
||||
cur = j;
|
||||
if (cur.is_first_match(LF_RMOVIVA))
|
||||
TRectype& head = tmov.curr();
|
||||
head = cur.curr();
|
||||
if (head.get(MOV_ANNOIVA) >= 2015 && head.get_char(MOV_TIPO) == 'C' && head.get_char(MOV_SPLITPAY) <= ' ')
|
||||
head.put(MOV_SPLITPAY, is_split_payment(head) ? 'S' : 'N');
|
||||
const long orig_nreg = head.get_long(MOV_NUMREG);
|
||||
head.put(MOV_NUMREG,numreg+1);
|
||||
count++;
|
||||
if (tmov.write() != NOERR)
|
||||
{
|
||||
tmov.curr() = cur.curr();
|
||||
const long orig_nreg = tmov.get_long(MOV_NUMREG);
|
||||
tmov.put(MOV_NUMREG,numreg+1);
|
||||
count++;
|
||||
if (tmov.write() != NOERR)
|
||||
err=tmov.status();
|
||||
error_box("Errore %d in scrittura file temporaneo movimenti. Ditta %ld, movimento %ld.",
|
||||
err,codditta,orig_nreg);
|
||||
break;
|
||||
}
|
||||
do
|
||||
{
|
||||
trmoviva.curr() = cur.curr(LF_RMOVIVA);
|
||||
const int numrig = trmoviva.get_int(RMI_NUMRIG);
|
||||
trmoviva.put(RMI_NUMREG,numreg+1);
|
||||
if (trmoviva.write() != NOERR)
|
||||
{
|
||||
err=tmov.status();
|
||||
error_box("Errore %d in scrittura file temporaneo movimenti. Ditta %ld, movimento %ld.",
|
||||
err,codditta,orig_nreg);
|
||||
err=trmoviva.status();
|
||||
error_box("Errore %d in scrittura file temporaneo righe iva. Ditta %ld, movimento %ld, riga %d.",
|
||||
err,codditta,orig_nreg, numrig);
|
||||
break;
|
||||
}
|
||||
do
|
||||
{
|
||||
trmoviva.curr() = cur.curr(LF_RMOVIVA);
|
||||
const int numrig = trmoviva.get_int(RMI_NUMRIG);
|
||||
trmoviva.put(RMI_NUMREG,numreg+1);
|
||||
if (trmoviva.write() != NOERR)
|
||||
{
|
||||
err=trmoviva.status();
|
||||
error_box("Errore %d in scrittura file temporaneo righe iva. Ditta %ld, movimento %ld, riga %d.",
|
||||
err,codditta,orig_nreg, numrig);
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
} while (cur.next_match(LF_RMOVIVA));
|
||||
numreg++;
|
||||
}
|
||||
count++;
|
||||
} while (cur.next_match(LF_RMOVIVA));
|
||||
numreg++;
|
||||
}
|
||||
}
|
||||
if (!p.addstatus(1))
|
||||
break;
|
||||
}
|
||||
}
|
||||
// una volta finita la copia, se non ci sono errori e ci sono record da trasferire
|
||||
// copia i records nella ditta ricevente
|
||||
@ -377,16 +378,16 @@ void TCopia_movimenti::copia_mov()
|
||||
if (err == NOERR) // Scrive sui files della ditta ricevente
|
||||
{
|
||||
long j=0L;
|
||||
TProgind p(count,"Trasferimento movimenti...",FALSE,TRUE);
|
||||
TProgress_monitor p(count,"Trasferimento movimenti...",false);
|
||||
for (tmov.first(); tmov.good(); tmov.next())
|
||||
{
|
||||
p.setstatus(j++);
|
||||
mov.write(tmov.curr());
|
||||
p.add_status();
|
||||
}
|
||||
for (trmoviva.first(); trmoviva.good(); trmoviva.next())
|
||||
{
|
||||
p.setstatus(j++);
|
||||
rmoviva.write(trmoviva.curr());
|
||||
p.add_status();
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -403,7 +404,9 @@ void TCopia_movimenti::copia_mov()
|
||||
|
||||
bool TCopia_movimenti::create()
|
||||
{
|
||||
_ditte = new TArray_sheet(-1, -1, -4, -4, "Selezione Ditte", "@1|Cod.@5R|Ragione Sociale@50");
|
||||
open_files(LF_TABCOM, LF_CAUSALI, LF_CLIFO, LF_NDITTE, LF_MOV, LF_RMOVIVA, 0);
|
||||
|
||||
_ditte = new TArray_sheet(-1, -1, -4, -4, TR("Selezione Ditte"), HR("@1|Cod.@5R|Ragione Sociale@50"));
|
||||
_nditte = new TLocalisamfile(LF_NDITTE);
|
||||
_lia = new TTable("%LIA");
|
||||
_firm = TApplication::get_firm();
|
||||
@ -417,12 +420,12 @@ bool TCopia_movimenti::destroy()
|
||||
delete _ditte;
|
||||
delete _nditte;
|
||||
delete _lia;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
int pd6142100 (int argc, char** argv)
|
||||
{
|
||||
TCopia_movimenti a;
|
||||
a.run(argc,argv,"Liquidazione riepilogativa IVA");
|
||||
a.run(argc,argv, TR("Liquidazione riepilogativa IVA"));
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <filetext.h>
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <progind.h>
|
||||
|
||||
|
@ -110,7 +110,7 @@ TGalileo_log::~TGalileo_log()
|
||||
|
||||
bool TGalileo_iterator::cancelled() const
|
||||
{
|
||||
return _pi != NULL && _pi->iscancelled();
|
||||
return _pi != NULL && _pi->is_cancelled();
|
||||
}
|
||||
|
||||
bool TGalileo_iterator::ok() const
|
||||
@ -138,11 +138,7 @@ TGalileo_iterator::TGalileo_iterator(TGalileo_transfer* pt) : _pt(pt), _pi(NULL)
|
||||
const TRecnotype tot = _pt->recordset().items();
|
||||
TString title;
|
||||
title << _pt->title() << ": " << tot << ' ' << TR("righe");
|
||||
if (tot > 1)
|
||||
_pi = new TProgind(tot, title, true, true);
|
||||
else
|
||||
::begin_wait();
|
||||
|
||||
_pi = new TProgress_monitor(tot, title, true);
|
||||
if (tot > 0)
|
||||
_pt->log(title);
|
||||
|
||||
@ -153,8 +149,6 @@ TGalileo_iterator::~TGalileo_iterator()
|
||||
{
|
||||
if (_pi != NULL)
|
||||
delete _pi;
|
||||
else
|
||||
::end_wait();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
@ -18,7 +18,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef __PROGIND_H
|
||||
class TProgind;
|
||||
#include <progind.h>
|
||||
#endif
|
||||
|
||||
class TGalileo_log;
|
||||
@ -75,7 +75,7 @@ public:
|
||||
class TGalileo_iterator
|
||||
{
|
||||
TGalileo_transfer* _pt;
|
||||
TProgind* _pi;
|
||||
TProgress_monitor* _pi;
|
||||
TRecnotype _rec;
|
||||
|
||||
public:
|
||||
|
401
ps/ps0713400.cpp
401
ps/ps0713400.cpp
@ -181,233 +181,232 @@ bool TImporta_fatven_app::update_cfban(long codcf, const TVB_recset& s, int idx_
|
||||
//pronti per essere contabilizzati
|
||||
bool TImporta_fatven_app::transfer(const TFilename& file)
|
||||
{
|
||||
TLocalisamfile clifo(LF_CLIFO);
|
||||
|
||||
const TString4 codnum = "F01"; //Da analisi
|
||||
const TString4 tpdoc = "F01"; //Da analisi
|
||||
TLocalisamfile clifo(LF_CLIFO);
|
||||
|
||||
TVB_recset s(file, ',');
|
||||
TLog_report log;
|
||||
TString msg;
|
||||
|
||||
TProgress_monitor pi(s.items(), TR("Importazione fatture in corso ..."));
|
||||
|
||||
long ndoc_old;
|
||||
|
||||
s.move_first();
|
||||
//campi documento
|
||||
const long ndoc = ndoc_old = togli_apici_numero(s, 0); //ndoc
|
||||
const TDate datadoc = togli_apici(s,1); //datadoc
|
||||
const int anno = datadoc.year(); //anno documento
|
||||
|
||||
TDocumento doctmp('D', anno, codnum, ndoc_old);
|
||||
if (doctmp.physical_rows() > 0)
|
||||
if (s.items())
|
||||
{
|
||||
#ifdef DBG
|
||||
if (!yesno_box(TR("I documenti che si sta cercando di importare esistono già.\nSi desidera proseguire ugualmente?")))
|
||||
return false;
|
||||
#else
|
||||
return warning_box(TR("I documenti che si sta cercando di importare esistono già."));
|
||||
#endif
|
||||
}
|
||||
|
||||
for (bool ok = s.move_first(); ok; ok = s.move_next())
|
||||
{
|
||||
if (!pi.add_status())
|
||||
break;
|
||||
|
||||
//leggo il contenuto del tracciato record
|
||||
|
||||
TProgress_monitor pi(s.items(), TR("Importazione fatture in corso ..."));
|
||||
s.move_first();
|
||||
//campi documento
|
||||
const long ndoc = togli_apici_numero(s, 0); //ndoc
|
||||
if (ndoc <= 0)
|
||||
break;
|
||||
long ndoc_old;
|
||||
const long ndoc = ndoc_old = togli_apici_numero(s, 0); //ndoc
|
||||
const TDate datadoc = togli_apici(s,1); //datadoc
|
||||
const int anno = datadoc.year(); //anno documento
|
||||
|
||||
TDocumento doctmp('D', anno, codnum, ndoc_old);
|
||||
|
||||
const TDate datadoc = togli_apici(s, 1); //datadoc
|
||||
const int anno = datadoc.year(); //anno documento
|
||||
|
||||
//correggo l'imponibile dell'ultima riga del documento precedente per far tornare i conti
|
||||
if (ndoc != ndoc_old)
|
||||
if (doctmp.physical_rows() > 0)
|
||||
{
|
||||
//carico il documento
|
||||
TDocumento doc('D', anno, codnum, ndoc_old);
|
||||
|
||||
s.move_prev();
|
||||
real tot_doc = togli_apici(s,18);
|
||||
real tot_imp = doc.get_real("TOTVALORE");
|
||||
|
||||
//se è necessario, faccio la modifica sull'ultima riga
|
||||
if (tot_imp != tot_doc)
|
||||
{
|
||||
//calcolo la differenza
|
||||
real diff = tot_doc - tot_imp;
|
||||
|
||||
//estraggo l'imponibile dell'ultima riga
|
||||
TRiga_documento& rdoc = doc[doc.rows()];
|
||||
real imp = rdoc.get_real(RDOC_PREZZO);
|
||||
|
||||
//calcolo l'imponibile esatto e lo inserisco nella riga documento
|
||||
imp += diff;
|
||||
rdoc.put(RDOC_PREZZO, imp);
|
||||
doc.write();
|
||||
}
|
||||
//passo al nuovo documento
|
||||
ndoc_old = ndoc;
|
||||
s.move_next();
|
||||
#ifdef DBG
|
||||
if (!yesno_box(TR("I documenti che si sta cercando di importare esistono già.\nSi desidera proseguire ugualmente?")))
|
||||
return false;
|
||||
#else
|
||||
return warning_box(TR("I documenti che si sta cercando di importare esistono già."));
|
||||
#endif
|
||||
}
|
||||
|
||||
//campi articolo 1
|
||||
const TString descr1 = togli_apici_descr(s,2); //descrizione articolo 1
|
||||
const TString80 art1 = togli_apici(s,3); //articolo 1
|
||||
const real imp1 = togli_apici(s,4); //imponibile articolo 1
|
||||
//campi articolo 2
|
||||
const TString descr2 = togli_apici_descr(s,5); //descrizione articolo 2
|
||||
const real imp2 = togli_apici(s,6); //imponibile articolo 2
|
||||
//campi articolo 3
|
||||
const TString descr3 = togli_apici_descr(s,7); //articolo 3
|
||||
const real impives = togli_apici(s,8); //imponibile iva esente
|
||||
//prendo codiva da anamag
|
||||
const TRectype& anamag = cache().get(LF_ANAMAG,art1);
|
||||
const TString16 codiva = anamag.get(ANAMAG_CODIVA);
|
||||
|
||||
//partita iva, mi serve per sapere se un cliente esiste già in clifo
|
||||
const TString16 paiv = togli_apici(s,9); //partita iva
|
||||
const TString80 ragsoc = togli_apici(s,10); //ragione sociale
|
||||
|
||||
//cerco gli altri dati di interesse
|
||||
long codcf = find_cliente(clifo, paiv, ragsoc);
|
||||
if (codcf <= 0)
|
||||
for (bool ok = s.move_first(); ok; ok = s.move_next())
|
||||
{
|
||||
//campi cliente (da utilizzare se non esiste già)
|
||||
const TString80 ind = togli_apici(s,11); //indirizzo
|
||||
const TString4 nciv = togli_apici_numero(s,12); //numero civico
|
||||
const TString8 cap = togli_apici(s,13); //CAP
|
||||
const TString80 comune = togli_apici(s,14); //comune
|
||||
const TString80 loc = togli_apici(s,15); //località
|
||||
// const TString4 prov = togli_apici(s,16); //provincia
|
||||
const TString& codcom = cap2comune(cap, comune); //codice comune
|
||||
if (!pi.add_status())
|
||||
break;
|
||||
|
||||
//calcolo il prossimo codice cliente libero
|
||||
codcf = 1L ;
|
||||
clifo.setkey(1);
|
||||
if (!clifo.empty())
|
||||
//leggo il contenuto del tracciato record
|
||||
|
||||
//campi documento
|
||||
const long ndoc = togli_apici_numero(s, 0); //ndoc
|
||||
if (ndoc <= 0)
|
||||
break;
|
||||
|
||||
const TDate datadoc = togli_apici(s, 1); //datadoc
|
||||
const int anno = datadoc.year(); //anno documento
|
||||
|
||||
//correggo l'imponibile dell'ultima riga del documento precedente per far tornare i conti
|
||||
if (ndoc != ndoc_old)
|
||||
{
|
||||
clifo.zero();
|
||||
clifo.put(CLI_TIPOCF, 'F');
|
||||
if (clifo.read(_isgteq) == NOERR)
|
||||
clifo.prev();
|
||||
else
|
||||
clifo.last();
|
||||
//carico il documento
|
||||
TDocumento doc('D', anno, codnum, ndoc_old);
|
||||
|
||||
if (clifo.get_char(CLI_TIPOCF) == 'C')
|
||||
codcf += clifo.get_long(CLI_CODCF);
|
||||
s.move_prev();
|
||||
real tot_doc = togli_apici(s,18);
|
||||
real tot_imp = doc.get_real("TOTVALORE");
|
||||
|
||||
//se è necessario, faccio la modifica sull'ultima riga
|
||||
if (tot_imp != tot_doc)
|
||||
{
|
||||
//calcolo la differenza
|
||||
real diff = tot_doc - tot_imp;
|
||||
|
||||
//estraggo l'imponibile dell'ultima riga
|
||||
TRiga_documento& rdoc = doc[doc.rows()];
|
||||
real imp = rdoc.get_real(RDOC_PREZZO);
|
||||
|
||||
//calcolo l'imponibile esatto e lo inserisco nella riga documento
|
||||
imp += diff;
|
||||
rdoc.put(RDOC_PREZZO, imp);
|
||||
doc.write();
|
||||
}
|
||||
//passo al nuovo documento
|
||||
ndoc_old = ndoc;
|
||||
s.move_next();
|
||||
}
|
||||
|
||||
msg.cut(0) << TR("Inserimento cliente ") << codcf << ' ' << ragsoc;
|
||||
log.log(0, msg);
|
||||
if (paiv.blank())
|
||||
log.log(2, TR("Cliente privo di Partita IVA e Codice Fiscale"));
|
||||
//inserisco i dati di interesse
|
||||
clifo.zero();
|
||||
clifo.put(CLI_TIPOCF, 'C');
|
||||
clifo.put(CLI_CODCF, codcf);
|
||||
clifo.put(CLI_RAGSOC, ragsoc);
|
||||
if (paiv.len() == 16)
|
||||
clifo.put(CLI_COFI, paiv);
|
||||
else
|
||||
clifo.put(CLI_PAIV, paiv);
|
||||
clifo.put(CLI_INDCF, ind);
|
||||
clifo.put(CLI_CIVCF, nciv);
|
||||
clifo.put(CLI_CAPCF, cap);
|
||||
clifo.put(CLI_COMCF, codcom);
|
||||
clifo.put(CLI_LOCCF, loc);
|
||||
clifo.put(CLI_CODABI, togli_apici(s, 20));
|
||||
clifo.put(CLI_CODCAB, togli_apici(s, 21));
|
||||
//campi articolo 1
|
||||
const TString descr1 = togli_apici_descr(s,2); //descrizione articolo 1
|
||||
const TString80 art1 = togli_apici(s,3); //articolo 1
|
||||
const real imp1 = togli_apici(s,4); //imponibile articolo 1
|
||||
//campi articolo 2
|
||||
const TString descr2 = togli_apici_descr(s,5); //descrizione articolo 2
|
||||
const real imp2 = togli_apici(s,6); //imponibile articolo 2
|
||||
//campi articolo 3
|
||||
const TString descr3 = togli_apici_descr(s,7); //articolo 3
|
||||
const real impives = togli_apici(s,8); //imponibile iva esente
|
||||
//prendo codiva da anamag
|
||||
const TRectype& anamag = cache().get(LF_ANAMAG,art1);
|
||||
const TString16 codiva = anamag.get(ANAMAG_CODIVA);
|
||||
|
||||
const int err = clifo.write();
|
||||
if (err != NOERR)
|
||||
//partita iva, mi serve per sapere se un cliente esiste già in clifo
|
||||
const TString16 paiv = togli_apici(s,9); //partita iva
|
||||
const TString80 ragsoc = togli_apici(s,10); //ragione sociale
|
||||
|
||||
//cerco gli altri dati di interesse
|
||||
long codcf = find_cliente(clifo, paiv, ragsoc);
|
||||
if (codcf <= 0)
|
||||
{
|
||||
msg.cut(0) << TR("Impossibile inserire il cliente ") << codcf
|
||||
<< TR(" : errore ") << err;
|
||||
//campi cliente (da utilizzare se non esiste già)
|
||||
const TString80 ind = togli_apici(s,11); //indirizzo
|
||||
const TString4 nciv = togli_apici_numero(s,12); //numero civico
|
||||
const TString8 cap = togli_apici(s,13); //CAP
|
||||
const TString80 comune = togli_apici(s,14); //comune
|
||||
const TString80 loc = togli_apici(s,15); //località
|
||||
// const TString4 prov = togli_apici(s,16); //provincia
|
||||
const TString& codcom = cap2comune(cap, comune); //codice comune
|
||||
|
||||
//calcolo il prossimo codice cliente libero
|
||||
codcf = 1L ;
|
||||
clifo.setkey(1);
|
||||
if (!clifo.empty())
|
||||
{
|
||||
clifo.zero();
|
||||
clifo.put(CLI_TIPOCF, 'F');
|
||||
if (clifo.read(_isgteq) == NOERR)
|
||||
clifo.prev();
|
||||
else
|
||||
clifo.last();
|
||||
|
||||
if (clifo.get_char(CLI_TIPOCF) == 'C')
|
||||
codcf += clifo.get_long(CLI_CODCF);
|
||||
}
|
||||
|
||||
msg.cut(0) << TR("Inserimento cliente ") << codcf << ' ' << ragsoc;
|
||||
log.log(0, msg);
|
||||
if (paiv.blank())
|
||||
log.log(2, TR("Cliente privo di Partita IVA e Codice Fiscale"));
|
||||
//inserisco i dati di interesse
|
||||
clifo.zero();
|
||||
clifo.put(CLI_TIPOCF, 'C');
|
||||
clifo.put(CLI_CODCF, codcf);
|
||||
clifo.put(CLI_RAGSOC, ragsoc);
|
||||
if (paiv.len() == 16)
|
||||
clifo.put(CLI_COFI, paiv);
|
||||
else
|
||||
clifo.put(CLI_PAIV, paiv);
|
||||
clifo.put(CLI_INDCF, ind);
|
||||
clifo.put(CLI_CIVCF, nciv);
|
||||
clifo.put(CLI_CAPCF, cap);
|
||||
clifo.put(CLI_COMCF, codcom);
|
||||
clifo.put(CLI_LOCCF, loc);
|
||||
clifo.put(CLI_CODABI, togli_apici(s, 20));
|
||||
clifo.put(CLI_CODCAB, togli_apici(s, 21));
|
||||
|
||||
const int err = clifo.write();
|
||||
if (err != NOERR)
|
||||
{
|
||||
msg.cut(0) << TR("Impossibile inserire il cliente ") << codcf
|
||||
<< TR(" : errore ") << err;
|
||||
log.log(2, msg);
|
||||
}
|
||||
}
|
||||
|
||||
TDocumento doc('D', anno, codnum, ndoc);
|
||||
const bool is_new = doc.physical_rows() == 0;
|
||||
doc.put(DOC_TIPODOC, tpdoc);
|
||||
doc.put(DOC_DATADOC, datadoc);
|
||||
doc.put(DOC_TIPOCF, 'C');
|
||||
doc.put(DOC_CODCF, codcf);
|
||||
|
||||
doc.put(DOC_CODCMS, togli_apici(s, 17));
|
||||
doc.put(DOC_CODABIA, togli_apici(s, 20));
|
||||
doc.put(DOC_CODCABA, togli_apici(s, 21));
|
||||
doc.put(DOC_CODABIP, togli_apici(s, 22));
|
||||
doc.put(DOC_CODCABP, togli_apici(s, 23));
|
||||
doc.put(DOC_CODPAG, togli_apici(s, 24));
|
||||
|
||||
if (!imp1.is_zero())
|
||||
{
|
||||
TRiga_documento& rdoc = doc.new_row("01");
|
||||
put_rdoc_descr(rdoc, descr1);
|
||||
rdoc.put(RDOC_PREZZO, imp1);
|
||||
rdoc.put(RDOC_QTA, 1);
|
||||
rdoc.put(RDOC_CODART, art1);
|
||||
rdoc.put(RDOC_CODARTMAG, art1);
|
||||
rdoc.put(RDOC_CHECKED, "X");
|
||||
rdoc.put(RDOC_CODIVA, codiva);
|
||||
}
|
||||
|
||||
if (!imp2.is_zero())
|
||||
{
|
||||
TRiga_documento& rdoc = doc.new_row("01");
|
||||
|
||||
put_rdoc_descr(rdoc, descr2);
|
||||
rdoc.put(RDOC_PREZZO, imp2);
|
||||
rdoc.put(RDOC_QTA, 1);
|
||||
rdoc.put(RDOC_CODART, art1);
|
||||
rdoc.put(RDOC_CODARTMAG, art1);
|
||||
rdoc.put(RDOC_CHECKED, "X");
|
||||
rdoc.put(RDOC_CODIVA, codiva);
|
||||
}
|
||||
|
||||
if (!impives.is_zero())
|
||||
{
|
||||
TRiga_documento& rdoc = doc.new_row("01");
|
||||
put_rdoc_descr(rdoc, descr3);
|
||||
rdoc.put(RDOC_PREZZO, impives);
|
||||
rdoc.put(RDOC_QTA, 1);
|
||||
rdoc.put(RDOC_CHECKED, "X");
|
||||
rdoc.put(RDOC_CODIVA, codiva); //??????????????????????????????????
|
||||
}
|
||||
|
||||
int err = doc.write();
|
||||
if (err == NOERR)
|
||||
{
|
||||
if (is_new)
|
||||
{
|
||||
msg.cut(0) << TR("Inserito documento ") << ndoc;
|
||||
log.log(0, msg);
|
||||
}
|
||||
|
||||
update_cfban(codcf, s, 20);
|
||||
update_cfban(codcf, s, 22);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.cut(0);
|
||||
if (is_new)
|
||||
msg << TR("Impossibile creare");
|
||||
else
|
||||
msg << TR("Impossibile aggiornare");
|
||||
msg << TR(" il documento ") << ndoc << TR(" : errore ") << err;
|
||||
log.log(2, msg);
|
||||
}
|
||||
}
|
||||
|
||||
TDocumento doc('D', anno, codnum, ndoc);
|
||||
const bool is_new = doc.physical_rows() == 0;
|
||||
doc.put(DOC_TIPODOC, tpdoc);
|
||||
doc.put(DOC_DATADOC, datadoc);
|
||||
doc.put(DOC_TIPOCF, 'C');
|
||||
doc.put(DOC_CODCF, codcf);
|
||||
|
||||
doc.put(DOC_CODCMS, togli_apici(s, 17));
|
||||
doc.put(DOC_CODABIA, togli_apici(s, 20));
|
||||
doc.put(DOC_CODCABA, togli_apici(s, 21));
|
||||
doc.put(DOC_CODABIP, togli_apici(s, 22));
|
||||
doc.put(DOC_CODCABP, togli_apici(s, 23));
|
||||
doc.put(DOC_CODPAG, togli_apici(s, 24));
|
||||
|
||||
if (!imp1.is_zero())
|
||||
{
|
||||
TRiga_documento& rdoc = doc.new_row("01");
|
||||
put_rdoc_descr(rdoc, descr1);
|
||||
rdoc.put(RDOC_PREZZO, imp1);
|
||||
rdoc.put(RDOC_QTA, 1);
|
||||
rdoc.put(RDOC_CODART, art1);
|
||||
rdoc.put(RDOC_CODARTMAG, art1);
|
||||
rdoc.put(RDOC_CHECKED, "X");
|
||||
rdoc.put(RDOC_CODIVA, codiva);
|
||||
}
|
||||
|
||||
if (!imp2.is_zero())
|
||||
{
|
||||
TRiga_documento& rdoc = doc.new_row("01");
|
||||
|
||||
put_rdoc_descr(rdoc, descr2);
|
||||
rdoc.put(RDOC_PREZZO, imp2);
|
||||
rdoc.put(RDOC_QTA, 1);
|
||||
rdoc.put(RDOC_CODART, art1);
|
||||
rdoc.put(RDOC_CODARTMAG, art1);
|
||||
rdoc.put(RDOC_CHECKED, "X");
|
||||
rdoc.put(RDOC_CODIVA, codiva);
|
||||
}
|
||||
|
||||
if (!impives.is_zero())
|
||||
{
|
||||
TRiga_documento& rdoc = doc.new_row("01");
|
||||
put_rdoc_descr(rdoc, descr3);
|
||||
rdoc.put(RDOC_PREZZO, impives);
|
||||
rdoc.put(RDOC_QTA, 1);
|
||||
rdoc.put(RDOC_CHECKED, "X");
|
||||
rdoc.put(RDOC_CODIVA, codiva); //??????????????????????????????????
|
||||
}
|
||||
|
||||
int err = doc.write();
|
||||
if (err == NOERR)
|
||||
{
|
||||
if (is_new)
|
||||
{
|
||||
msg.cut(0) << TR("Inserito documento ") << ndoc;
|
||||
log.log(0, msg);
|
||||
}
|
||||
|
||||
update_cfban(codcf, s, 20);
|
||||
update_cfban(codcf, s, 22);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.cut(0);
|
||||
if (is_new)
|
||||
msg << TR("Impossibile creare");
|
||||
else
|
||||
msg << TR("Impossibile aggiornare");
|
||||
msg << TR(" il documento ") << ndoc << TR(" : errore ") << err;
|
||||
log.log(2, msg);
|
||||
}
|
||||
}
|
||||
|
||||
log.preview();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
167
ps/ps0883vet.uml
167
ps/ps0883vet.uml
@ -13,70 +13,95 @@ END
|
||||
|
||||
STRING 101 3
|
||||
BEGIN
|
||||
PROMPT 2 2 "Codice IATA "
|
||||
PROMPT 2 2 "Codice IATA "
|
||||
USE &PS0883VET
|
||||
INPUT CODTAB 101
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Descrizione@50" S0
|
||||
DISPLAY "Cliente" I0
|
||||
OUTPUT 101 CODTAB
|
||||
OUTPUT 102 S0
|
||||
JOIN LF_CLIFO INTO TIPOCF="C" CODCF=CODTAB[4,9]
|
||||
INPUT CODTAB[1,3] 101
|
||||
INPUT CODTAB[4,9] 103
|
||||
DISPLAY "Codice" CODTAB[1,3]
|
||||
DISPLAY "Cliente" CODTAB[4,9]
|
||||
DISPLAY "Principale@C" B0
|
||||
DISPLAY "Ragione Sociale@50" LF_CLIFO->RAGSOC
|
||||
OUTPUT 101 CODTAB[1,3]
|
||||
OUTPUT 102 LF_CLIFO->RAGSOC
|
||||
OUTPUT 103 CODTAB[4,9]
|
||||
CHECKTYPE REQUIRED
|
||||
KEY 1
|
||||
FLAGS "U"
|
||||
FIELD CODTAB
|
||||
FIELD CODTAB[1,2]
|
||||
END
|
||||
|
||||
STRING 102 50
|
||||
BEGIN
|
||||
PROMPT 2 3 "Descrizione "
|
||||
PROMPT 25 2 ""
|
||||
USE &PS0883VET KEY 2
|
||||
JOIN LF_CLIFO INTO TIPOCF="C" CODCF=CODTAB[4,9]
|
||||
INPUT S0 102
|
||||
DISPLAY "Descrizione@50" S0
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Cliente" I0
|
||||
DISPLAY "Ragione Sociale@50" S0
|
||||
DISPLAY "Principale@C" B0
|
||||
DISPLAY "Codice" CODTAB[1,3]
|
||||
DISPLAY "Cliente" CODTAB[4,9]
|
||||
COPY OUTPUT 101
|
||||
CHECKTYPE REQUIRED
|
||||
KEY 2
|
||||
FIELD S0
|
||||
END
|
||||
|
||||
NUMBER 103 6
|
||||
NUMBER 103 6
|
||||
BEGIN
|
||||
PROMPT 2 4 "Codice cliente "
|
||||
PROMPT 2 3 "Cliente "
|
||||
USE LF_CLIFO
|
||||
INPUT TIPOCF "C"
|
||||
INPUT CODCF 103
|
||||
DISPLAY "Codice" CODCF
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
DISPLAY "Partita IVA" PAIV
|
||||
OUTPUT 103 CODCF
|
||||
OUTPUT 104 RAGSOC
|
||||
CHECKTYPE NORMAL
|
||||
CHECKTYPE REQUIRED
|
||||
KEY 1
|
||||
FLAGS "UZ"
|
||||
FIELD CODTAB[4,9]
|
||||
ADD RUN cg0 -1 C
|
||||
FIELD I0
|
||||
END
|
||||
|
||||
STRING 104 50
|
||||
BEGIN
|
||||
PROMPT 2 5 "Ragione sociale "
|
||||
PROMPT 25 3 ""
|
||||
USE LF_CLIFO KEY 2
|
||||
INPUT TIPOCF "C"
|
||||
INPUT RAGSOC 104
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
DISPLAY "Codice" CODCF
|
||||
DISPLAY "Partita IVA" PAIV
|
||||
COPY OUTPUT 103
|
||||
CHECKTYPE NORMAL
|
||||
ADD RUN cg0 -1 C
|
||||
KEY 1
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 78 4
|
||||
BOOLEAN 113
|
||||
BEGIN
|
||||
PROMPT 1 8 "@bParametri fatturazione"
|
||||
PROMPT 2 4 "Cliente principale associato univocamente al vettore"
|
||||
FIELD B0
|
||||
MESSAGE EMPTY CLEAR,114
|
||||
MESSAGE ENABLE,114
|
||||
END
|
||||
|
||||
BOOLEAN 114
|
||||
BEGIN
|
||||
PROMPT 2 5 "Vettore speciale per gestione privati (Universal)"
|
||||
FIELD B2
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 78 5
|
||||
BEGIN
|
||||
PROMPT 1 8 "@bArticoli standard"
|
||||
END
|
||||
|
||||
STRING 105 20
|
||||
BEGIN
|
||||
PROMPT 2 9 "Codice articolo servizio standard "
|
||||
PROMPT 2 9 "Servizio standard "
|
||||
FIELD S4
|
||||
FLAGS "U"
|
||||
USE LF_RCONDV
|
||||
@ -95,10 +120,16 @@ BEGIN
|
||||
ADD RUN ve2 -4
|
||||
END
|
||||
|
||||
BOOLEAN 115
|
||||
BEGIN
|
||||
PROMPT 44 9 "Ferry automatico"
|
||||
FIELD B1
|
||||
END
|
||||
|
||||
STRING 106 20
|
||||
BEGIN
|
||||
PROMPT 2 10 "Codice articolo BINGO sheet "
|
||||
FIELD S5
|
||||
PROMPT 2 10 "Servizio notturno "
|
||||
FIELD S1[1,20]
|
||||
FLAGS "U"
|
||||
COPY USE 105
|
||||
INPUT TIPO "C"
|
||||
@ -111,6 +142,98 @@ BEGIN
|
||||
OUTPUT 106 CODRIGA
|
||||
CHECKTYPE NORMAL
|
||||
ADD RUN ve2 -4
|
||||
MESSAGE EMPTY CLEAR,6@
|
||||
MESSAGE ENABLE,6@
|
||||
END
|
||||
|
||||
NUMBER 161 2
|
||||
BEGIN
|
||||
PROMPT 44 10 "Periodo "
|
||||
FIELD S1[21,22]
|
||||
FLAGS "Z"
|
||||
CHECKTYPE REQUIRED
|
||||
GROUP 6
|
||||
END
|
||||
|
||||
STRING 162 2
|
||||
BEGIN
|
||||
PROMPT 55 10 ":"
|
||||
FIELD S1[23,24]
|
||||
CHECKTYPE REQUIRED
|
||||
GROUP 6
|
||||
END
|
||||
|
||||
NUMBER 163 2
|
||||
BEGIN
|
||||
PROMPT 60 10 "- "
|
||||
FLAGS "Z"
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD S1[25,26]
|
||||
GROUP 6
|
||||
END
|
||||
|
||||
STRING 164 2
|
||||
BEGIN
|
||||
PROMPT 66 10 ":"
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD S1[27,28]
|
||||
GROUP 6
|
||||
END
|
||||
|
||||
NUMBER 166 3
|
||||
BEGIN
|
||||
PROMPT 72 10 "% "
|
||||
FLAGS "U"
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD I1
|
||||
GROUP 6
|
||||
FIELD S1[29,31]
|
||||
END
|
||||
|
||||
STRING 107 20
|
||||
BEGIN
|
||||
PROMPT 2 11 "Gestione DELAY "
|
||||
FIELD S2[1,20]
|
||||
FLAGS "U"
|
||||
COPY USE 105
|
||||
INPUT TIPO "C"
|
||||
INPUT TIPOCF "C"
|
||||
INPUT CODCF 103 SELECT
|
||||
INPUT COD 101 SELECT
|
||||
INPUT TIPORIGA "A"
|
||||
INPUT CODRIGA 107
|
||||
COPY DISPLAY 105
|
||||
OUTPUT 107 CODRIGA
|
||||
CHECKTYPE NORMAL
|
||||
ADD RUN ve2 -4
|
||||
MESSAGE EMPTY CLEAR,7@
|
||||
MESSAGE ENABLE,7@
|
||||
END
|
||||
|
||||
STRING 171 2
|
||||
BEGIN
|
||||
PROMPT 44 11 "Ritardo "
|
||||
FIELD S2[21,22]
|
||||
CHECKTYPE REQUIRED
|
||||
GROUP 7
|
||||
END
|
||||
|
||||
STRING 172 2
|
||||
BEGIN
|
||||
PROMPT 55 11 ":"
|
||||
FIELD S2[23,24]
|
||||
CHECKTYPE REQUIRED
|
||||
GROUP 7
|
||||
END
|
||||
|
||||
NUMBER 176 3
|
||||
BEGIN
|
||||
PROMPT 72 11 "% "
|
||||
FLAGS "U"
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD I2
|
||||
GROUP 7
|
||||
FIELD S2[29,31]
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
Loading…
x
Reference in New Issue
Block a user