Patch level :2.2 nopatch x ora

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :stampa pagato quasi terminata


git-svn-id: svn://10.65.10.50/trunk@13840 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2006-03-09 13:14:01 +00:00
parent 83a9d5ba02
commit 3b4005d7bf
2 changed files with 65 additions and 36 deletions

View File

@ -221,9 +221,9 @@ protected:
real totale_documento(const TRectype& mov) const; real totale_documento(const TRectype& mov) const;
real calcola_pagato_prec(const TPartita& match, const int riga_fatt, const TRectype& riga_pag); real calcola_pagato_prec(const TPartita& match, const int riga_fatt, const TRectype& riga_pag);
bool test_swap(TCausale& caus, bool ritsoc) const; bool test_swap(TCausale& caus, bool ritsoc) const;
bool cerca_conto(const TBill& bill, const TAssoc_array& assoc) const; bool cerca_conto(const char tipo, const TBill& bill, const TAssoc_array& assoc) const;
bool cerca_costo(const TBill& bill) const; int cerca_costo(const TBill& bill) const;
bool cerca_pagamento(const TBill& bill) const; int cerca_pagamento(const TBill& bill) const;
bool cerca_fiscali(const TBill& bill) const; bool cerca_fiscali(const TBill& bill) const;
bool cerca_sociali(const TBill& bill) const; bool cerca_sociali(const TBill& bill) const;
@ -237,7 +237,9 @@ public:
~TPag_per_cms_recordset(); ~TPag_per_cms_recordset();
}; };
//////////////////////////////////
// generica
//////////////////////////////////
static TPag_per_cms_recordset* myself = NULL; static TPag_per_cms_recordset* myself = NULL;
TPag_per_cms_recordset::~TPag_per_cms_recordset() TPag_per_cms_recordset::~TPag_per_cms_recordset()
@ -344,9 +346,12 @@ void TPag_per_cms_recordset::lettura_conti(TAssoc_array& assoc, const char tipoc
} }
} }
bool TPag_per_cms_recordset::cerca_conto(const TBill& bill, const TAssoc_array& assoc) const bool TPag_per_cms_recordset::cerca_conto(const char tipo, const TBill& bill, const TAssoc_array& assoc) const
{ {
TToken_string key(15,'.'); TToken_string key(15);
key.add(tipo);
key.add(bill.gruppo()); key.add(bill.gruppo());
if (assoc.is_key(key)) if (assoc.is_key(key))
return true; return true;
@ -362,24 +367,30 @@ bool TPag_per_cms_recordset::cerca_conto(const TBill& bill, const TAssoc_array&
return false; return false;
} }
bool TPag_per_cms_recordset::cerca_costo(const TBill& bill) const int TPag_per_cms_recordset::cerca_costo(const TBill& bill) const
{ {
return cerca_conto(bill, _costi); if (cerca_conto('C', bill, _costi))
return 1;
else
return 0;
} }
bool TPag_per_cms_recordset::cerca_pagamento(const TBill& bill) const int TPag_per_cms_recordset::cerca_pagamento(const TBill& bill) const
{ {
return cerca_conto(bill, _pagamenti); if (cerca_conto('P', bill, _pagamenti))
return 2;
else
return 0;
} }
bool TPag_per_cms_recordset::cerca_fiscali(const TBill& bill) const bool TPag_per_cms_recordset::cerca_fiscali(const TBill& bill) const
{ {
return cerca_conto(bill, _fiscali); return cerca_conto('F', bill, _fiscali);
} }
bool TPag_per_cms_recordset::cerca_sociali(const TBill& bill) const bool TPag_per_cms_recordset::cerca_sociali(const TBill& bill) const
{ {
return cerca_conto(bill, _sociali); return cerca_conto('S', bill, _sociali);
} }
// Controlla sulla causale se il segno del totale documento (ritsoc=FALSE) // Controlla sulla causale se il segno del totale documento (ritsoc=FALSE)
@ -464,6 +475,10 @@ real TPag_per_cms_recordset::calcola_pagato_prec(const TPartita& match, const in
return pagato; return pagato;
} }
/////////////////////////////////////
// movimenti senza saldaconto
/////////////////////////////////////
long TPag_per_cms_recordset::find_movimento(const TRectype& riga_pag) const long TPag_per_cms_recordset::find_movimento(const TRectype& riga_pag) const
{ {
int n_fatture = 0; //numero di fatture trovate int n_fatture = 0; //numero di fatture trovate
@ -519,15 +534,14 @@ long TPag_per_cms_recordset::find_movimento(const TRectype& riga_pag) const
void TPag_per_cms_recordset::find_commesse_cg(const TRectype& mov) void TPag_per_cms_recordset::find_commesse_cg(const TRectype& mov)
{ {
const long numregcg = mov.get_long(MOV_NUMREG); const long numregcg = mov.get_long(MOV_NUMREG);
// if (numregcg == 1039)
// warning_box("movimento rompico...");
//cerca un record di MOVANA che abbia numregcg = nreg;usa il nuovo metodo fighissimo.. //cerca un record di MOVANA che abbia numregcg = nreg;usa il nuovo metodo fighissimo..
//..con la isam query implementato nella query_movama_by_numregcg() //..con la isam query implementato nella query_movama_by_numregcg()
TISAM_recordset movana(query_movama_by_numregcg(numregcg)); TISAM_recordset movana(query_movama_by_numregcg(numregcg));
const TRecnotype items = movana.items(); const TRecnotype items = movana.items();
if (items > 0) if (items > 0)
{ {
if (items > 1) if (items > 1)
error_box(TR("Esiste piu' di un movimento analitico collegato al movimento contabile %ld"),numregcg); error_box(TR("Esiste piu' di un movimento analitico collegato al movimento contabile %ld"),numregcg);
@ -552,47 +566,60 @@ void TPag_per_cms_recordset::find_commesse_cg(const TRectype& mov)
const long sottoconto_anal = atol(conto_riga_analitica.mid(6,6)); const long sottoconto_anal = atol(conto_riga_analitica.mid(6,6));
const TBill conto(gruppo_anal, conto_anal, sottoconto_anal); const TBill conto(gruppo_anal, conto_anal, sottoconto_anal);
if (cerca_costo(conto) || cerca_pagamento(conto)) int tipo = cerca_costo(conto) || cerca_pagamento(conto);
if (tipo > 0)
{ {
const char sezione = anal_row.get_char(RMOVANA_SEZIONE); const char sezione = anal_row.get_char(RMOVANA_SEZIONE);
const real valore = anal_row.get_real(RMOVANA_IMPORTO); const real valore = anal_row.get_real(RMOVANA_IMPORTO);
const TImporto imp(sezione, valore); TImporto imp(sezione, valore);
switch (tipo)
{
case 1:imp.normalize('D');break;
case 2:imp.normalize('A');break;
//case 3:imp.normalize('D');break;
//case 4:imp.normalize('A');break;
default:break;
}
//deve aggiungere ora al file temporaneo il record //deve aggiungere ora al file temporaneo il record
// campi del pagamento che vanno spediti nel file temporaneo
//codice fornitore e descrizione //codice fornitore e descrizione
const long codforn = mov.get_long(MOV_CODCF); const long codforn = mov.get_long(MOV_CODCF);
tmpcurr.put("CODFORN", codforn); if (codforn > 0)
TString16 keyclifo; {
keyclifo.format("F|%ld", codforn); tmpcurr.put("CODFORN", codforn);
const TRectype& rec_clifo = cache().get(LF_CLIFO, keyclifo); TString16 keyclifo;
tmpcurr.put("DESFORN", rec_clifo.get(CLI_RAGSOC)); keyclifo.format("F|%ld", codforn);
const TRectype& rec_clifo = cache().get(LF_CLIFO, keyclifo);
tmpcurr.put("DESFORN", rec_clifo.get(CLI_RAGSOC));
}
//nreg,data pagamento,descrizione pagamento //nreg,data pagamento,descrizione pagamento
tmpcurr.put("NREG", numregcg); tmpcurr.put("NREG", numregcg);
tmpcurr.put("DATAREG", mov.get_date(MOV_DATAREG)); tmpcurr.put("DATAREG", mov.get_date(MOV_DATAREG));
tmpcurr.put("DATAPAG", mov.get_date(MOV_DATACOMP));
//documento origine //documento origine
tmpcurr.put("NDOC", mov.get_long(MOV_NUMDOC)); tmpcurr.put("NDOC", mov.get_long(MOV_NUMDOC));
tmpcurr.put("DATADOC", mov.get_date(MOV_DATADOC)); tmpcurr.put("DATADOC", movana.get(MOV_DATADOC).as_date());
tmpcurr.put("PROT", mov.get_long(MOV_PROTIVA)); tmpcurr.put("TOTDOC", movana.get(MOV_TOTDOC).as_real());
tmpcurr.put("TOTDOC", mov.get_real(MOV_TOTDOC));
//tmpcurr.put("TOTPAG", distributore.get()); //pagamento nella partita //importi
// tmpcurr.put("TOTRES", ); //pagamenti precedenti al tmpcurr.put("TOTPAG", imp.valore());
//tmpcurr.put("TOTRES", ); //pagamenti precedenti al
//campi relativi a cdc,commessa,fase //campi relativi a cdc,commessa,fase
tmpcurr.put("CMS",anal_row.get(RMOVANA_CODCMS)); tmpcurr.put("CMS",anal_row.get(RMOVANA_CODCMS));
tmpcurr.put("CDC",anal_row.get(RMOVANA_CODCCOSTO)); tmpcurr.put("CDC",anal_row.get(RMOVANA_CODCCOSTO));
tmpcurr.put("FSC",anal_row.get(RMOVANA_CODFASE)); tmpcurr.put("FSC",anal_row.get(RMOVANA_CODFASE));
// tmpcurr.put("IMPCMS",impcms);
//e finalmente aggiunge il record al file temporaneo //e finalmente aggiunge il record al file temporaneo
_tmp->write(); _tmp->write();
} }
} }
} //for(j<anal_rows... } //for(j<anal_rows...
} //if(items>0... } //if(items>0...
} }
bool TPag_per_cms_recordset::mov_callback(const TRelation& rel, void* pJolly) bool TPag_per_cms_recordset::mov_callback(const TRelation& rel, void* pJolly)
@ -650,6 +677,9 @@ bool TPag_per_cms_recordset::check_cms_cdc_fsc(const TRectype& rec_analriga)
return true; return true;
} }
//////////////////////////////////////
// movimenti con saldaconto
//////////////////////////////////////
const TString& TPag_per_cms_recordset::query_movama_by_numregcg(const long nreg) const TString& TPag_per_cms_recordset::query_movama_by_numregcg(const long nreg)
{ {
TString& query = get_tmp_string(); TString& query = get_tmp_string();
@ -919,10 +949,9 @@ void TPag_per_cms_recordset::find_commesse(const long nreg, const TRectype& riga
const long codforn = riga_pag.get_long(PART_SOTTOCONTO); const long codforn = riga_pag.get_long(PART_SOTTOCONTO);
tmpcurr.put("CODFORN", codforn); tmpcurr.put("CODFORN", codforn);
TString16 keyclifo; TString16 keyclifo;
keyclifo.format("%s|%d", "F", codforn); keyclifo.format("F|%ld", codforn);
const TRectype& rec_clifo = cache().get(LF_CLIFO, keyclifo); const TRectype& rec_clifo = cache().get(LF_CLIFO, keyclifo);
TString80 desforn = rec_clifo.get(CLI_RAGSOC); tmpcurr.put("DESFORN", rec_clifo.get(CLI_RAGSOC));
tmpcurr.put("DESFORN", desforn);
//nreg,data pagamento,descrizione pagamento //nreg,data pagamento,descrizione pagamento
tmpcurr.put("NREG", nreg); tmpcurr.put("NREG", nreg);

View File

@ -120,7 +120,7 @@ MESSAGE RESET,F1.102</prescript>
<prescript description="H2 PRESCRIPT">MESSAGE RESET,F2.101 <prescript description="H2 PRESCRIPT">MESSAGE RESET,F2.101
MESSAGE RESET,F2.102 MESSAGE RESET,F2.102
MESSAGE RESET,F2.103</prescript> MESSAGE RESET,F2.103</prescript>
<field x="1" y="0.5" type="Stringa" bg_color="#C0C0C0" width="7"> <field x="1" y="0.5" type="Numero" align="right" bg_color="#C0C0C0" width="7" hide_zero="1">
<font italic="1" face="Courier New" bold="1" size="8" /> <font italic="1" face="Courier New" bold="1" size="8" />
<source>CODFORN</source> <source>CODFORN</source>
</field> </field>
@ -173,7 +173,7 @@ MESSAGE ADD,F3.101</postscript>
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F2.102 <postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F2.102
MESSAGE ADD,F3.102</postscript> MESSAGE ADD,F3.102</postscript>
</field> </field>
<field x="146" type="Valuta" align="right" width="15" pattern="1" text="###.###.###,@@"> <field x="146" type="Valuta" align="right" width="15" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>TOTRES</source> <source>TOTRES</source>
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F2.103 <postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F2.103
MESSAGE ADD,F3.103</postscript> MESSAGE ADD,F3.103</postscript>