Patch level :4.0 440
Files correlati : Ricompilazione Demo : [ ] Commento :stampa pagato per commessa/fornitore abbastanza funzionante git-svn-id: svn://10.65.10.50/trunk@14116 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
8aba412f06
commit
ed04a6ea37
102
ca/ca3600.cpp
102
ca/ca3600.cpp
@ -198,7 +198,7 @@ class TPag_per_cms_recordset : public TISAM_recordset
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
TDate _dadata, _adata;
|
TDate _dadata, _adata;
|
||||||
long _codfor;
|
long _dacodfor, _acodfor;
|
||||||
TString16 _campodata;
|
TString16 _campodata;
|
||||||
TString _codcosto, _codcms, _codfas;
|
TString _codcosto, _codcms, _codfas;
|
||||||
TAssoc_array _costi,_pagamenti,_fiscali,_sociali; //array che contengono i conti letti dal .ini
|
TAssoc_array _costi,_pagamenti,_fiscali,_sociali; //array che contengono i conti letti dal .ini
|
||||||
@ -228,7 +228,7 @@ protected:
|
|||||||
bool cerca_sociali(const TBill& bill) const;
|
bool cerca_sociali(const TBill& bill) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void set_filter(const TPag_per_cms_mask& msk, const int cms_row, const long codfor, const TString& campodata);
|
virtual void set_filter(const TPag_per_cms_mask& msk, const int cms_row, const long dacodfor, const long acodfor, const TString& campodata);
|
||||||
virtual void set_custom_filter(TCursor& cur) const;
|
virtual void set_custom_filter(TCursor& cur) const;
|
||||||
void scan_pags();
|
void scan_pags();
|
||||||
void scan_movs();
|
void scan_movs();
|
||||||
@ -697,13 +697,27 @@ void TPag_per_cms_recordset::find_commesse(const long nreg, const TRectype& riga
|
|||||||
//..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(nreg));
|
TISAM_recordset movana(query_movama_by_numregcg(nreg));
|
||||||
const TRecnotype items = movana.items();
|
const TRecnotype items = movana.items();
|
||||||
|
if (items <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if (items > 0)
|
|
||||||
{
|
|
||||||
if (items > 1)
|
if (items > 1)
|
||||||
error_box(TR("Esiste piu' di un movimento analitico collegato al movimento contabile %ld"),nreg);
|
warning_box(TR("Esiste piu' di un movimento analitico collegato al movimento contabile %ld"),nreg);
|
||||||
|
|
||||||
movana.move_last(); //si posiziona sul record corretto
|
movana.move_last(); //si posiziona sul record corretto
|
||||||
|
|
||||||
|
//crea il movana e le sue righe
|
||||||
|
const TAnal_mov anal_mov(movana.get(MOVANA_NUMREG).as_int());
|
||||||
|
TRecord_array& anal_rows = anal_mov.body();
|
||||||
|
//scandisce le righe del movana alla ricerca di righe compatibili con le commesse sullo sheet
|
||||||
|
for (int m = anal_rows.last_row(); m > 0; m--)
|
||||||
|
{
|
||||||
|
if (check_cms_cdc_fsc(anal_rows[m]))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//se non ne ha trovata manco una di righe buone esce!
|
||||||
|
if (m <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
//prepara il record tmpcurr sul file temporaneo _tmp su cui registrare i dati da stampare
|
//prepara il record tmpcurr sul file temporaneo _tmp su cui registrare i dati da stampare
|
||||||
TRectype& tmpcurr = _tmp->curr();
|
TRectype& tmpcurr = _tmp->curr();
|
||||||
tmpcurr.zero();
|
tmpcurr.zero();
|
||||||
@ -724,6 +738,7 @@ void TPag_per_cms_recordset::find_commesse(const long nreg, const TRectype& riga
|
|||||||
//se movimento IVA..
|
//se movimento IVA..
|
||||||
if (pn.iva_items() > 0)
|
if (pn.iva_items() > 0)
|
||||||
{
|
{
|
||||||
|
//trova le RMOVANA del MOVANA corrente che hanno il conto = a quello della i-esima rigaiva
|
||||||
for (int j = 0; j < pn.iva_items(); j++)
|
for (int j = 0; j < pn.iva_items(); j++)
|
||||||
{
|
{
|
||||||
const TRectype& rmoviva = pn.iva(j);
|
const TRectype& rmoviva = pn.iva(j);
|
||||||
@ -736,13 +751,6 @@ void TPag_per_cms_recordset::find_commesse(const long nreg, const TRectype& riga
|
|||||||
const int conto_iva = zio.conto();
|
const int conto_iva = zio.conto();
|
||||||
const long sottoconto_iva = zio.sottoconto();
|
const long sottoconto_iva = zio.sottoconto();
|
||||||
|
|
||||||
//crea il movana legato al moviva
|
|
||||||
const TAnal_mov anal_mov(rmoviva);
|
|
||||||
//trova le RMOVANA del MOVANA corrente che hanno il conto = a quello della i-esima rigaiva
|
|
||||||
TRecord_array& anal_rows = anal_mov.body();
|
|
||||||
|
|
||||||
if (anal_rows.rows() > 0) //se il movana ha righe...
|
|
||||||
{
|
|
||||||
real imponibile_iva = rmoviva.get_real(RMI_IMPONIBILE);
|
real imponibile_iva = rmoviva.get_real(RMI_IMPONIBILE);
|
||||||
real imposta_iva = rmoviva.get_real(RMI_IMPOSTA);
|
real imposta_iva = rmoviva.get_real(RMI_IMPOSTA);
|
||||||
const TString& tipodet = rmoviva.get(RMI_TIPODET);
|
const TString& tipodet = rmoviva.get(RMI_TIPODET);
|
||||||
@ -830,7 +838,6 @@ void TPag_per_cms_recordset::find_commesse(const long nreg, const TRectype& riga
|
|||||||
|
|
||||||
} //for (anal_rows...
|
} //for (anal_rows...
|
||||||
|
|
||||||
} //if anal_rows() > 0...
|
|
||||||
} //if indicatore_bilancio!=5...
|
} //if indicatore_bilancio!=5...
|
||||||
|
|
||||||
} //for (pn.iva_items(...
|
} //for (pn.iva_items(...
|
||||||
@ -858,12 +865,6 @@ void TPag_per_cms_recordset::find_commesse(const long nreg, const TRectype& riga
|
|||||||
totdoc -= importo.valore(); //valore da stampare nella colonna Tot.fattura con ritenute
|
totdoc -= importo.valore(); //valore da stampare nella colonna Tot.fattura con ritenute
|
||||||
} //for j < pn.cg_items...
|
} //for j < pn.cg_items...
|
||||||
|
|
||||||
TAnal_mov anal_mov(nreg);
|
|
||||||
TRecord_array& anal_rows = anal_mov.body();
|
|
||||||
|
|
||||||
if (anal_rows.rows() > 0) //se il movana ha righe...
|
|
||||||
{
|
|
||||||
|
|
||||||
for (int k = 1; k <= anal_rows.rows(); k++) //..allora le scansiona..
|
for (int k = 1; k <= anal_rows.rows(); k++) //..allora le scansiona..
|
||||||
{
|
{
|
||||||
//prende gr/co/sott sulla riga analitica...
|
//prende gr/co/sott sulla riga analitica...
|
||||||
@ -899,7 +900,6 @@ void TPag_per_cms_recordset::find_commesse(const long nreg, const TRectype& riga
|
|||||||
totdoc_cms += importo.valore();
|
totdoc_cms += importo.valore();
|
||||||
} //if(conto_cg.indicatore...
|
} //if(conto_cg.indicatore...
|
||||||
} //for(k<anal_rows...
|
} //for(k<anal_rows...
|
||||||
} //if(anal_rows>0...
|
|
||||||
} //else (pn.iva_items(...
|
} //else (pn.iva_items(...
|
||||||
|
|
||||||
//parte comune a movimenti IVA e non (vengono anche qui considerate le ritenute fiscali
|
//parte comune a movimenti IVA e non (vengono anche qui considerate le ritenute fiscali
|
||||||
@ -984,7 +984,6 @@ void TPag_per_cms_recordset::find_commesse(const long nreg, const TRectype& riga
|
|||||||
|
|
||||||
} //pn.read()...
|
} //pn.read()...
|
||||||
|
|
||||||
} //if (items>0...
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TPag_per_cms_recordset::part_callback(const TRelation& rel, void* pJolly)
|
bool TPag_per_cms_recordset::part_callback(const TRelation& rel, void* pJolly)
|
||||||
@ -1001,12 +1000,14 @@ bool TPag_per_cms_recordset::part_callback(const TRelation& rel, void* pJolly)
|
|||||||
void TPag_per_cms_recordset::scan_pags()
|
void TPag_per_cms_recordset::scan_pags()
|
||||||
{
|
{
|
||||||
//costruzione filtro
|
//costruzione filtro
|
||||||
TRectype filtrec(LF_PARTITE);
|
TRectype dafiltrec(LF_PARTITE);
|
||||||
filtrec.put(PART_TIPOCF, 'F');
|
dafiltrec.put(PART_TIPOCF, 'F');
|
||||||
filtrec.put(PART_GRUPPO, 0);
|
dafiltrec.put(PART_GRUPPO, 0);
|
||||||
filtrec.put(PART_CONTO, 0);
|
dafiltrec.put(PART_CONTO, 0);
|
||||||
if (_codfor > 0)
|
dafiltrec.put(PART_SOTTOCONTO, _dacodfor);
|
||||||
filtrec.put(PART_SOTTOCONTO, _codfor);
|
|
||||||
|
TRectype afiltrec(dafiltrec);
|
||||||
|
afiltrec.put(PART_SOTTOCONTO, _acodfor);
|
||||||
|
|
||||||
TString filtro = "(TIPOMOV>=\"3\")"; //deve essere un pagamento a fornitore!!!
|
TString filtro = "(TIPOMOV>=\"3\")"; //deve essere un pagamento a fornitore!!!
|
||||||
|
|
||||||
@ -1024,11 +1025,11 @@ void TPag_per_cms_recordset::scan_pags()
|
|||||||
}
|
}
|
||||||
//applica il filtro alla relazione
|
//applica il filtro alla relazione
|
||||||
TRelation rel(LF_PARTITE);
|
TRelation rel(LF_PARTITE);
|
||||||
TCursor cur(&rel, filtro, 1, &filtrec, &filtrec);
|
TCursor cur(&rel, filtro, 1, &dafiltrec, &afiltrec);
|
||||||
cur.scan(part_callback, this, "Movimenti con saldaconto...");
|
cur.scan(part_callback, this, "Movimenti con saldaconto...");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TPag_per_cms_recordset::set_filter(const TPag_per_cms_mask& msk, const int cms_row, const long codfor, const TString& campodata)
|
void TPag_per_cms_recordset::set_filter(const TPag_per_cms_mask& msk, const int cms_row, const long dacodfor, const long acodfor, const TString& campodata)
|
||||||
{
|
{
|
||||||
//se esiste il file temporano con tracciato persomalizzato lo cancella e lo ricrea vuoto
|
//se esiste il file temporano con tracciato persomalizzato lo cancella e lo ricrea vuoto
|
||||||
TFilename trr; //file tracciato record
|
TFilename trr; //file tracciato record
|
||||||
@ -1043,7 +1044,8 @@ void TPag_per_cms_recordset::set_filter(const TPag_per_cms_mask& msk, const int
|
|||||||
//deve stare qui per poter generare la chiave del file temporaneo in base al tipo di data di estrazione
|
//deve stare qui per poter generare la chiave del file temporaneo in base al tipo di data di estrazione
|
||||||
_campodata = campodata;
|
_campodata = campodata;
|
||||||
//stessa cosa per il simpatico codice fornitore
|
//stessa cosa per il simpatico codice fornitore
|
||||||
_codfor = codfor;
|
_dacodfor = dacodfor;
|
||||||
|
_acodfor = acodfor;
|
||||||
|
|
||||||
//crea il file .trr in base ai parametri del metodo
|
//crea il file .trr in base ai parametri del metodo
|
||||||
crea_trr(trr);
|
crea_trr(trr);
|
||||||
@ -1085,7 +1087,7 @@ void TPag_per_cms_recordset::set_filter(const TPag_per_cms_mask& msk, const int
|
|||||||
scan_pags();
|
scan_pags();
|
||||||
|
|
||||||
//se c'e' un filtro sui fornitori, non si fa lo scan dei movimenti senza saldaconto
|
//se c'e' un filtro sui fornitori, non si fa lo scan dei movimenti senza saldaconto
|
||||||
if (codfor <= 0)
|
if (dacodfor <= 0 && acodfor <= 0)
|
||||||
scan_movs();
|
scan_movs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1100,7 +1102,7 @@ protected:
|
|||||||
virtual bool get_usr_val(const TString& name, TVariant& var) const;
|
virtual bool get_usr_val(const TString& name, TVariant& var) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void set_filter(const TPag_per_cms_mask& msk, const int cms_row, const long codfor, const TString& campodata);
|
void set_filter(const TPag_per_cms_mask& msk, const int cms_row, const long dacodfor, const long acodfor, const TString& campodata);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1117,7 +1119,7 @@ bool TPag_per_cms_rep::set_recordset(const TString& sql)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TPag_per_cms_rep::set_filter(const TPag_per_cms_mask& msk, const int cms_row, const long codfor, const TString& campodata)
|
void TPag_per_cms_rep::set_filter(const TPag_per_cms_mask& msk, const int cms_row, const long dacodfor, const long acodfor, const TString& campodata)
|
||||||
{
|
{
|
||||||
TAnal_report::set_recordset(NULL);
|
TAnal_report::set_recordset(NULL);
|
||||||
|
|
||||||
@ -1125,7 +1127,7 @@ void TPag_per_cms_rep::set_filter(const TPag_per_cms_mask& msk, const int cms_ro
|
|||||||
|
|
||||||
TPag_per_cms_recordset* recset = new TPag_per_cms_recordset(query);
|
TPag_per_cms_recordset* recset = new TPag_per_cms_recordset(query);
|
||||||
|
|
||||||
recset->set_filter(msk, cms_row, codfor, campodata);
|
recset->set_filter(msk, cms_row, dacodfor, acodfor, campodata);
|
||||||
TAnal_report::set_recordset(recset);
|
TAnal_report::set_recordset(recset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1138,7 +1140,9 @@ void TPag_per_cms_rep::set_filter(const TPag_per_cms_mask& msk, const int cms_ro
|
|||||||
class TPag_per_cms : public TSkeleton_application
|
class TPag_per_cms : public TSkeleton_application
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void stampa_per_commessa(const TPag_per_cms_mask& mask, TReport_book& book, TPag_per_cms_rep& rep, const long codfor, const TString& campodata);
|
void stampa_per_commessa(const TPag_per_cms_mask& mask, TReport_book& book,
|
||||||
|
TPag_per_cms_rep& rep, const long dacodfor, const long acodfor,
|
||||||
|
const TString& campodata);
|
||||||
const TMultilevel_code_info& get_level_one() const;
|
const TMultilevel_code_info& get_level_one() const;
|
||||||
virtual void main_loop();
|
virtual void main_loop();
|
||||||
};
|
};
|
||||||
@ -1152,7 +1156,9 @@ const TMultilevel_code_info& TPag_per_cms::get_level_one() const
|
|||||||
return ca_multilevel_code_info(logic);
|
return ca_multilevel_code_info(logic);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TPag_per_cms::stampa_per_commessa(const TPag_per_cms_mask& mask, TReport_book& book, TPag_per_cms_rep& rep, const long codfor, const TString& campodata)
|
void TPag_per_cms::stampa_per_commessa(const TPag_per_cms_mask& mask, TReport_book& book, TPag_per_cms_rep& rep,
|
||||||
|
const long dacodfor, const long acodfor,
|
||||||
|
const TString& campodata)
|
||||||
{
|
{
|
||||||
TSheet_field& sheet = mask.sfield(F_RIGHE);
|
TSheet_field& sheet = mask.sfield(F_RIGHE);
|
||||||
TString video_string; //stringa che compare nella progind
|
TString video_string; //stringa che compare nella progind
|
||||||
@ -1178,7 +1184,7 @@ void TPag_per_cms::stampa_per_commessa(const TPag_per_cms_mask& mask, TReport_bo
|
|||||||
for (int l = liv1.levels()-2; l >= 0; l--) //se la struttura è a più livelli costruisce la tokenstring
|
for (int l = liv1.levels()-2; l >= 0; l--) //se la struttura è a più livelli costruisce la tokenstring
|
||||||
row.insert("|", liv1.total_len(l));
|
row.insert("|", liv1.total_len(l));
|
||||||
|
|
||||||
rep.set_filter(mask, 0, codfor, campodata); //fa la set filter sulla prima riga (che è quella usata)
|
rep.set_filter(mask, 0, dacodfor, acodfor, campodata); //fa la set filter sulla prima riga (che è quella usata)
|
||||||
book.add(rep);
|
book.add(rep);
|
||||||
}
|
}
|
||||||
sheet.destroy(); //cancella le commesse aggiunte in automatico sullo sheet
|
sheet.destroy(); //cancella le commesse aggiunte in automatico sullo sheet
|
||||||
@ -1187,7 +1193,7 @@ void TPag_per_cms::stampa_per_commessa(const TPag_per_cms_mask& mask, TReport_bo
|
|||||||
{
|
{
|
||||||
FOR_EACH_SHEET_ROW(sheet, r, row) //per ogni cdc/cms che appare nello sheet di pag.1 della msk..
|
FOR_EACH_SHEET_ROW(sheet, r, row) //per ogni cdc/cms che appare nello sheet di pag.1 della msk..
|
||||||
{
|
{
|
||||||
rep.set_filter(mask, r, codfor, campodata); //..chiama il metodone globale che crea e compila il file..
|
rep.set_filter(mask, r, dacodfor, acodfor, campodata); //..chiama il metodone globale che crea e compila il file..
|
||||||
//..temporaneo i cui dati riempiranno il report
|
//..temporaneo i cui dati riempiranno il report
|
||||||
book.add(rep); //aggiunge il report relativo alla cdc/cms corrente al book
|
book.add(rep); //aggiunge il report relativo alla cdc/cms corrente al book
|
||||||
}
|
}
|
||||||
@ -1227,25 +1233,13 @@ void TPag_per_cms::main_loop()
|
|||||||
default:break;
|
default:break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const long dacodfor = mask.get_long(F_DACODFOR);
|
|
||||||
const long acodfor = mask.get_long(F_ACODFOR);
|
|
||||||
|
|
||||||
if (dacodfor > 0 || acodfor > 0) //specifica il range dei clifo..
|
|
||||||
{
|
|
||||||
TISAM_recordset clifo("USE CLIFO\nFROM TIPOCF='F' CODCF=#DACODFOR\nTO TIPOCF='F' CODCF=#ACODFOR");
|
|
||||||
clifo.set_var("#DACODFOR", TVariant(dacodfor));
|
|
||||||
clifo.set_var("#ACODFOR", TVariant(acodfor));
|
|
||||||
//scansione su tutti i fornitori selezionati; questa opzione e' praticamente utile solo..
|
//scansione su tutti i fornitori selezionati; questa opzione e' praticamente utile solo..
|
||||||
//..quando il numero di fornitori selezionati non e' elevato;infatti,per ogni fornitore..
|
//..quando il numero di fornitori selezionati non e' elevato;infatti,per ogni fornitore..
|
||||||
//..selezionato, viene eseguito tutto il giro del programma
|
//..selezionato, viene eseguito tutto il giro del programma
|
||||||
for (bool ok = clifo.move_first(); ok; ok = clifo.move_next())
|
const long dacodfor = mask.get_long(F_DACODFOR);
|
||||||
{
|
const long acodfor = mask.get_long(F_ACODFOR);
|
||||||
const long codforn = clifo.get("CODCF").as_int();
|
|
||||||
stampa_per_commessa(mask, book, rep, codforn, campodata);
|
stampa_per_commessa(mask, book, rep, dacodfor, acodfor, campodata); //se non si specifica alcun clifo...
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
stampa_per_commessa(mask, book, rep, 0, campodata); //se non si specifica alcun clifo...
|
|
||||||
|
|
||||||
book.print_or_preview(); //stampa il book dei report
|
book.print_or_preview(); //stampa il book dei report
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user