Patch level : 10.0
Files correlati : ps0713.exe Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/branches/R_10_00@20686 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
a478c76847
commit
8f976fbd3f
@ -106,12 +106,7 @@ void TImporta_comm_app::importa_cms(TAssoc_array& righe)
|
|||||||
TProgind pi(righe.items(), "Importazione commesse in corso...", true, true);
|
TProgind pi(righe.items(), "Importazione commesse in corso...", true, true);
|
||||||
TLog_report log("Importazione Commesse");
|
TLog_report log("Importazione Commesse");
|
||||||
|
|
||||||
TSystemisamfile com(LF_COMMESSE); com.open(_excllock);
|
TLocalisamfile com(LF_COMMESSE);
|
||||||
TSystemisamfile rip(LF_RIP); rip.open(_excllock);
|
|
||||||
TSystemisamfile rrip(LF_RRIP); rrip.open(_excllock);
|
|
||||||
rip.last();
|
|
||||||
const TRectype& r = rip.curr();
|
|
||||||
long codice = r.get_long("CODICE");
|
|
||||||
|
|
||||||
FOR_EACH_ASSOC_OBJECT(righe, obj, key, itm)
|
FOR_EACH_ASSOC_OBJECT(righe, obj, key, itm)
|
||||||
{
|
{
|
||||||
@ -124,51 +119,21 @@ void TImporta_comm_app::importa_cms(TAssoc_array& righe)
|
|||||||
TString str;
|
TString str;
|
||||||
str << "La commessa " << codcms;
|
str << "La commessa " << codcms;
|
||||||
|
|
||||||
rip.zero();
|
if (!cache().get(LF_COMMESSE, codcms).empty())
|
||||||
rip.put("TIPO", 'B');
|
|
||||||
rip.put("CODCOSTO", "");
|
|
||||||
rip.put("CODCMS", codcms);
|
|
||||||
int err_read = rip.read();
|
|
||||||
|
|
||||||
if(err_read != NOERR)
|
|
||||||
{
|
{
|
||||||
const int gruppo = cms.gruppo(); TString4 grup; grup.format("%03d", gruppo);
|
const int gruppo = cms.gruppo(); TString4 grup; grup.format("%03d", gruppo);
|
||||||
const int conto = cms.conto(); TString4 cont; cont.format("%03d", conto);
|
const int conto = cms.conto(); TString4 cont; cont.format("%03d", conto);
|
||||||
const long sotco = cms.sotco(); TString8 sotc; sotc.format("%06ld", sotco);
|
const long sotco = cms.sotco(); TString8 sotc; sotc.format("%06ld", sotco);
|
||||||
TString80 codconto; codconto << grup << cont << sotc;
|
TString80 codconto; codconto << grup << cont << sotc;
|
||||||
|
TString80 descr; descr << "Commessa " << codcms;
|
||||||
TString8 cod;
|
|
||||||
cod.format("%08ld", ++codice);
|
|
||||||
TString80 descr; descr << "Comessa " << codcms;
|
|
||||||
|
|
||||||
TBill bill(gruppo, conto, sotco);
|
TBill bill(gruppo, conto, sotco);
|
||||||
|
|
||||||
const real percentuale(CENTO);
|
const real percentuale(CENTO);
|
||||||
|
|
||||||
com.put(COMMESSE_CODCMS, codcms);
|
com.put(COMMESSE_CODCMS, codcms);
|
||||||
com.put(COMMESSE_DESCRIZ, descr);
|
com.put(COMMESSE_DESCRIZ, descr);
|
||||||
com.put(COMMESSE_CODCONTO, codconto);
|
com.put(COMMESSE_CODCONTO, codconto);
|
||||||
|
|
||||||
rip.put("TIPO", 'B');
|
|
||||||
rip.put("CODICE", cod);
|
|
||||||
rip.put("CODCMS", codcms);
|
|
||||||
if(gruppo > 0 && conto > 0 && sotco > 0)
|
|
||||||
rip.put("INDBIL", bill.indicatore_bilancio());
|
|
||||||
rip.put("DESCRIZ", descr);
|
|
||||||
|
|
||||||
rrip.put("TIPO", 'B');
|
|
||||||
rrip.put("CODICE", cod);
|
|
||||||
rrip.put("NRIGA", 1);
|
|
||||||
rrip.put("CODCMS", codcms);
|
|
||||||
rrip.put("CODCONTO", codconto);
|
|
||||||
rrip.put("RIPARTO", percentuale);
|
|
||||||
|
|
||||||
int err = com.rewrite_write();
|
int err = com.rewrite_write();
|
||||||
if(err == NOERR)
|
|
||||||
err = rip.write();
|
|
||||||
|
|
||||||
if(err == NOERR)
|
|
||||||
err = rrip.write();
|
|
||||||
|
|
||||||
if(err == NOERR)
|
if(err == NOERR)
|
||||||
{
|
{
|
||||||
@ -188,9 +153,6 @@ void TImporta_comm_app::importa_cms(TAssoc_array& righe)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rrip.close();
|
|
||||||
rip.close();
|
|
||||||
com.close();
|
|
||||||
//stampo a video il log
|
//stampo a video il log
|
||||||
TReport_book buc;
|
TReport_book buc;
|
||||||
buc.add(log);
|
buc.add(log);
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
#include <lffiles.h>
|
||||||
|
#include <recarray.h>
|
||||||
|
|
||||||
#include "ps0713lib.h"
|
#include "ps0713lib.h"
|
||||||
|
#include "../ca/commesse.h"
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//// TCOMMESSA_STRING ////
|
//// TCOMMESSA_STRING ////
|
||||||
@ -58,29 +62,7 @@ const TCommessa_string TCommessa::cmsstr() const
|
|||||||
//metodo costruttore
|
//metodo costruttore
|
||||||
TCommessa::TCommessa(const char* codcms)
|
TCommessa::TCommessa(const char* codcms)
|
||||||
{
|
{
|
||||||
TString query;
|
TString80 str = cache().get(LF_COMMESSE, codcms, COMMESSE_CODCONTO);
|
||||||
query << "USE RIP KEY 4\n"
|
|
||||||
<< "FROM TIPO=\"B\" CODCOSTO=\"\" CODCMS=\"" << codcms << "\"\n"
|
|
||||||
<< "TO TIPO=\"B\" CODCOSTO=\"\" CODCMS=\"" << codcms << "\"\n";
|
|
||||||
|
|
||||||
TISAM_recordset rip(query);
|
|
||||||
rip.move_first();
|
|
||||||
|
|
||||||
if(!rip.empty())
|
|
||||||
{
|
|
||||||
_codice = rip.get("CODICE").as_string();
|
|
||||||
|
|
||||||
const TString16 codcms = rip.get("CODCMS").as_string();
|
|
||||||
|
|
||||||
query.cut(0);
|
|
||||||
query << "USE RRIP\n"
|
|
||||||
<< "FROM TIPO=\"B\" CODICE=" << _codice << " NRIGA=1\n"
|
|
||||||
<< "TO TIPO=\"B\" CODICE=" << _codice << " NRIGA=1\n";
|
|
||||||
|
|
||||||
TISAM_recordset rrip(query);
|
|
||||||
rrip.move_first();
|
|
||||||
|
|
||||||
TString80 str = rrip.get("CODCONTO").as_string();
|
|
||||||
const int gruppo = atoi(str.left(3)) > 0 ? atoi(str.left(3)) : 0;
|
const int gruppo = atoi(str.left(3)) > 0 ? atoi(str.left(3)) : 0;
|
||||||
const int conto = atoi(str.mid(3,3)) > 0 ? atoi(str.mid(3,3)) : 0;
|
const int conto = atoi(str.mid(3,3)) > 0 ? atoi(str.mid(3,3)) : 0;
|
||||||
const long sotco = atol(str.right(6)) > 0L ? atol(str.right(6)) : 0L;
|
const long sotco = atol(str.right(6)) > 0L ? atol(str.right(6)) : 0L;
|
||||||
@ -88,13 +70,6 @@ TCommessa::TCommessa(const char* codcms)
|
|||||||
TCommessa_string cms(codcms, gruppo, conto, sotco);
|
TCommessa_string cms(codcms, gruppo, conto, sotco);
|
||||||
|
|
||||||
_commessa = cms;
|
_commessa = cms;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TCommessa_string cms(0L, 0, 0, 0L);
|
|
||||||
_commessa = cms;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
|
Loading…
x
Reference in New Issue
Block a user