Patch level :4.0 nopatch
Files correlati : Ricompilazione Demo : [ ] Commento :programma importazione movimenti bufget per il mitico Adolfo! git-svn-id: svn://10.65.10.50/trunk@14280 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
f185433047
commit
835a5b3b09
@ -9,8 +9,11 @@
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include "../ca/pconana.h"
|
||||
#include "../ca/movana.h"
|
||||
#include "../ca/rmovana.h"
|
||||
#include "../ca/calib01.h"
|
||||
#include "../ca/calib02.h"
|
||||
|
||||
#include "crpa1a.h"
|
||||
|
||||
@ -129,9 +132,9 @@ protected:
|
||||
void ini2mask();
|
||||
bool transfer();
|
||||
void transfer_testata(const TRecord_text& curr); //, TError_log& log);
|
||||
// int crea_riga_mov(const TRecord_text& curr, TDocumento& bol, bool is_omaggio);
|
||||
|
||||
long get_next_key();
|
||||
const char sezione(const TString& codconto);
|
||||
|
||||
public:
|
||||
virtual bool create();
|
||||
@ -164,6 +167,25 @@ long TBudget_Import::get_next_key()
|
||||
}
|
||||
|
||||
|
||||
const char TBudget_Import::sezione(const TString& codconto)
|
||||
{
|
||||
TConfig& cfg = ca_config();
|
||||
TString tmp;
|
||||
TString key;
|
||||
long len;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
key.format("Pdc(%d)", i);
|
||||
tmp << cfg.get(key);
|
||||
len += tmp.len();
|
||||
}
|
||||
|
||||
//TLocalisamfile& pconana(LF_PCONANA);
|
||||
|
||||
const char tipo = 'q';
|
||||
return tipo;
|
||||
}
|
||||
|
||||
void TBudget_Import::transfer_testata(const TRecord_text& curr) //, TError_log& log)
|
||||
{
|
||||
const TString codcms = curr.get(1);
|
||||
@ -177,6 +199,7 @@ void TBudget_Import::transfer_testata(const TRecord_text& curr) //, TError_log&
|
||||
TString4 yy = str_dataini.right(2);
|
||||
yy.insert("20", 0);
|
||||
const TDate dataini(atoi(gg),atoi(mm),atoi(yy));
|
||||
const int annoes = dataini.year();
|
||||
|
||||
gg = str_datafine.left(2);
|
||||
mm = str_datafine.mid(3,2);
|
||||
@ -184,36 +207,39 @@ void TBudget_Import::transfer_testata(const TRecord_text& curr) //, TError_log&
|
||||
yy.insert("20", 0);
|
||||
const TDate datafine(atoi(gg),atoi(mm),atoi(yy));
|
||||
|
||||
//aggiunge il movimento ai movana al primo posto libero
|
||||
//cerca il primo posto libero in movana
|
||||
long numreg = get_next_key();
|
||||
|
||||
// creo il documento, se esiste cancello le righe perche' le ricreo successivamente
|
||||
/* TDocumento& bol = _doc.doc(datadoc.year(), _numbol, num_bol);
|
||||
const bool isnew = bol.rows() == 0;
|
||||
//crea il movimento di prima nota da aggiungere a movana
|
||||
TAnal_mov movana(numreg);
|
||||
movana.zero(); //azzera per sicurezza
|
||||
//sbatte i dati nei campi
|
||||
movana.put(MOVANA_NUMREG, numreg);
|
||||
movana.put(MOVANA_ANNOES, annoes);
|
||||
movana.put(MOVANA_DATAREG, dataini);
|
||||
movana.put(MOVANA_DATACOMP, dataini);
|
||||
movana.put(MOVANA_DESCR, "Movimento di budget importato");
|
||||
movana.put(MOVANA_TIPOMOV, 'P');
|
||||
movana.put(MOVANA_TOTDOC, soldini);
|
||||
|
||||
if (isnew)
|
||||
{
|
||||
_forbidden_ndoc = 0L;
|
||||
bol.put(DOC_TIPODOC, _tipobol);
|
||||
bol.put(DOC_DATADOC, datadoc);
|
||||
bol.put(DOC_STATO, _statobol);
|
||||
bol.put("DAANNO", anno_ord);
|
||||
bol.put("DANDOC", num_ord);
|
||||
//legge la testata dell'ordine per avere il clifo
|
||||
TDocumento& ordine = _doc.doc(anno_ord, _numord, num_ord);
|
||||
const char tipocf = ordine.get_char(DOC_TIPOCF);
|
||||
const long codcf = ordine.get_int(DOC_CODCF);
|
||||
bol.put(DOC_TIPOCF, tipocf);
|
||||
bol.put(DOC_CODCF, codcf);
|
||||
_lastbol = num_bol; //aggiorna l'indicatore dell'ultima bolla trasferita
|
||||
}
|
||||
else
|
||||
{
|
||||
_forbidden_ndoc = num_bol;
|
||||
TString msg;
|
||||
msg.format(FR("La bolla %ld e' gia' stata trasferita"), num_bol);
|
||||
log.log(1, msg);
|
||||
}*/
|
||||
TString query;
|
||||
TString tmp_codconto;
|
||||
tmp_codconto << "'" << codconto << "'";
|
||||
query << "USE PCONANA KEY 1 \n";
|
||||
query << "SELECT CODCONTO[10,15]=" << tmp_codconto;
|
||||
|
||||
TISAM_recordset pconana(query);
|
||||
const TRecnotype items = pconana.items();
|
||||
if (items <= 0)
|
||||
warning_box(TR("Il sottoconto %s NON esiste!"), codconto);
|
||||
|
||||
if (items > 1)
|
||||
warning_box(TR("Esiste piu' di un sottoconto %s!"),codconto);
|
||||
|
||||
pconana.move_last(); //si posiziona sul record corretto
|
||||
|
||||
|
||||
//***alla fine movana.write();
|
||||
|
||||
}
|
||||
|
||||
@ -276,7 +302,7 @@ bool TBudget_Import::create()
|
||||
{
|
||||
_configfile = new TConfig("crpa1conf.ini");
|
||||
_msk = new TBudget_Import_mask();
|
||||
open_files(LF_MOVANA, LF_RMOVANA, 0);
|
||||
open_files(LF_MOVANA, LF_RMOVANA, LF_PCONANA, 0);
|
||||
_relmovana = new TRelation(LF_MOVANA);
|
||||
_relrmovana = new TRelation(LF_RMOVANA);
|
||||
return TSkeleton_application::create();
|
||||
|
Loading…
x
Reference in New Issue
Block a user