Patch level : 10.0 1180
Files correlati : ca1.exe ca1100a.msk ca1100a.rep Ricompilazione Demo : [ ] Commento : Aggiunto bilancio per cento di costo git-svn-id: svn://10.65.10.50/branches/R_10_00@22519 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
1455697a90
commit
091cb9a1a7
@ -5,30 +5,50 @@
|
||||
#include "ca1.h"
|
||||
#include "calib02.h"
|
||||
|
||||
class TEthero_rep : public TAnal_report
|
||||
{
|
||||
protected:
|
||||
virtual bool use_mask() { return true; }
|
||||
};
|
||||
|
||||
class TPrint_ca : public TSkeleton_application
|
||||
{
|
||||
protected:
|
||||
void print_rep(const TFilename& n) const;
|
||||
|
||||
public:
|
||||
virtual void main_loop();
|
||||
};
|
||||
|
||||
void TPrint_ca::print_rep(const TFilename& n) const
|
||||
{
|
||||
TEthero_rep rep;
|
||||
if (rep.load(n))
|
||||
rep.print_or_preview();
|
||||
}
|
||||
|
||||
void TPrint_ca::main_loop()
|
||||
{
|
||||
TFilename path;
|
||||
while (select_custom_file(path, "rep", "ca1100"))
|
||||
|
||||
if (argc() > 2)
|
||||
{
|
||||
TReport_book book;
|
||||
TAnal_report rep;
|
||||
rep.load(path);
|
||||
book.add(rep);
|
||||
book.print_or_preview();
|
||||
path = argv(2);
|
||||
path.ext("rep");
|
||||
if (path.custom_path())
|
||||
{
|
||||
print_rep(path);
|
||||
return;
|
||||
}
|
||||
}
|
||||
while (select_custom_file(path, "rep", "ca1100"))
|
||||
print_rep(path);
|
||||
}
|
||||
|
||||
int ca1100(int argc, char* argv[])
|
||||
{
|
||||
TPrint_ca a;
|
||||
a.run(argc, argv, TR("Stampa anagrafiche"));
|
||||
a.run(argc, argv, TR("Stampa analitica"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
284
ca/ca1100a.rep
Normal file
284
ca/ca1100a.rep
Normal file
@ -0,0 +1,284 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<report name="BilancioTassan" orientation="2" lpi="6">
|
||||
<font face="Arial" size="8" />
|
||||
<section type="Head" pattern="1" />
|
||||
<section type="Head" level="1" pattern="1">
|
||||
<field type="Stringa" valign="center" align="center" width="130" height="3" pattern="1">
|
||||
<font face="Courier New" bold="1" size="16" />
|
||||
<source>"BILANCIO DAL " + #DATAINI + " AL " + #DATAFIN + " STAMPA DEL " + #DATASTA</source>
|
||||
</field>
|
||||
</section>
|
||||
<section repeat="1" type="Head" level="2" page_break="1" pattern="1">
|
||||
<groupby>CODCCOSTO</groupby>
|
||||
<font face="Arial" bold="1" size="8" />
|
||||
<field border="3" y="0.5" type="Linea" width="162" height="0" pattern="1" />
|
||||
<field y="1" type="Stringa" width="20" pattern="1">
|
||||
<font face="Courier New" bold="1" size="10" />
|
||||
<source>CODCCOSTO</source>
|
||||
</field>
|
||||
<field x="20" y="1" type="Stringa" width="50" pattern="1">
|
||||
<prescript description="H2.0 PRESCRIPT">MESSAGE ISAMREAD,CDC,CODCOSTO=CODCCOSTO,DESCRIZ</prescript>
|
||||
</field>
|
||||
<field x="84" y="1" type="Stringa" align="right" width="10" pattern="1">
|
||||
<source>"AL " + #DATASTA</source>
|
||||
</field>
|
||||
<field border="2" y="2.5" type="Linea" width="162" height="0" pattern="1" />
|
||||
<field border="2" x="63" y="2.5" type="Linea" height="1.5" pattern="1" />
|
||||
<field border="2" x="112" y="2.5" type="Linea" height="1.5" pattern="1" />
|
||||
<field y="3" type="Testo" width="20" pattern="1" text="Conto" />
|
||||
<field x="21" y="3" type="Testo" align="center" width="41.5" pattern="1" text="Descrizione" />
|
||||
<field x="65" y="3" type="Testo" align="right" width="12" pattern="1" text="Budget" />
|
||||
<field x="77" y="3" type="Testo" align="right" width="17" pattern="1" text="Consuntivo" />
|
||||
<field x="94" y="3" type="Testo" align="right" width="14" pattern="1" text="Differenza" />
|
||||
<field x="109" y="3" type="Testo" align="center" width="3" pattern="1" text="%" />
|
||||
<field x="113" y="3" type="Testo" align="right" width="14" pattern="1" text="Budget" />
|
||||
<field x="129" y="3" type="Testo" align="right" width="14" pattern="1" text="Consuntivo " />
|
||||
<field x="143" y="3" type="Testo" align="right" width="14" pattern="1" text="Differenza" />
|
||||
<field x="158" y="3" type="Testo" align="center" width="3" pattern="1" text="%" />
|
||||
<field border="3" y="4" type="Linea" width="162" height="0" pattern="1" />
|
||||
</section>
|
||||
<section type="Head" level="3" pattern="1">
|
||||
<groupby>CODCONTO</groupby>
|
||||
<prescript description="H3 PRESCRIPT">MESSAGE RESET,F3</prescript>
|
||||
<field type="Stringa" hidden="1" width="20" id="101" pattern="1">
|
||||
<source>CODCONTO</source>
|
||||
</field>
|
||||
</section>
|
||||
<section type="Body" pattern="1" />
|
||||
<section type="Body" level="1" hidden="1" pattern="1">
|
||||
<field x="20" type="Valuta" align="right" width="12" id="201" pattern="1" text="#########,@@">
|
||||
<source>IF((MOVANA.TIPOMOV!="")(BETWEEN(DATACOMP,#DATAINI,#DATASTA));IMPORTO;0)</source>
|
||||
<postscript description="B1.201 POSTSCRIPT">#THIS @
|
||||
EMPTY=
|
||||
IF
|
||||
ELSE
|
||||
#THIS GET_ID_NEXT @ \ Legge la sezione dal campo successivo
|
||||
"A" = IF \ Se vale Avere
|
||||
#THIS @ -1 * \ Cambia segno
|
||||
#THIS ! \ al campo corrente
|
||||
THEN
|
||||
#THIS @ \ Prende il valore attuale con segno
|
||||
"F3." #THIS GET_ID + \ Costruisce la stringa F3.101
|
||||
+! \ Somma il campo corrente al corrispondente in F3
|
||||
THEN
|
||||
</postscript>
|
||||
</field>
|
||||
<field x="33" type="Stringa" width="1" id="202" pattern="1">
|
||||
<source>SEZIONE</source>
|
||||
</field>
|
||||
<field x="36" type="Valuta" align="right" width="12" id="203" pattern="1" text="#########,@@">
|
||||
<source>IF((MOVANA.TIPOMOV=="")(BETWEEN(DATACOMP,#DATAINI,#DATASTA));IMPORTO;0)</source>
|
||||
<postscript description="B1.203 POSTSCRIPT">#THIS @
|
||||
EMPTY=
|
||||
IF
|
||||
ELSE
|
||||
#THIS GET_ID_NEXT @ \ Legge la sezione dal campo successivo
|
||||
"A" = IF \ Se vale Avere
|
||||
#THIS @ -1 * \ Cambia segno
|
||||
#THIS ! \ al campo corrente
|
||||
THEN
|
||||
#THIS @ \ Prende il valore attuale con segno
|
||||
"F3." #THIS GET_ID + \ Costruisce la stringa F3.101
|
||||
+! \ Somma il campo corrente al corrispondente in F3
|
||||
THEN
|
||||
</postscript>
|
||||
</field>
|
||||
<field x="49" type="Stringa" width="1" id="204" pattern="1">
|
||||
<source>SEZIONE</source>
|
||||
</field>
|
||||
<field x="66" type="Valuta" align="right" width="14" id="301" pattern="1" text="#########,@@">
|
||||
<source>IF((MOVANA.TIPOMOV!="")(BETWEEN(DATACOMP,#DATAINI,#DATASTA));IMPORTO;0)</source>
|
||||
<postscript description="B1.301 POSTSCRIPT">#THIS @
|
||||
EMPTY=
|
||||
IF
|
||||
ELSE
|
||||
#THIS GET_ID_NEXT @ \ Legge la sezione dal campo successivo
|
||||
"A" = IF \ Se vale Avere
|
||||
#THIS @ -1 * \ Cambia segno
|
||||
#THIS ! \ al campo corrente
|
||||
THEN
|
||||
#THIS @ \ Prende il valore attuale con segno
|
||||
"F3." #THIS GET_ID + \ Costruisce la stringa F3.101
|
||||
+! \ Somma il campo corrente al corrispondente in F3
|
||||
THEN
|
||||
</postscript>
|
||||
</field>
|
||||
<field x="87" type="Stringa" width="1" id="302" pattern="1">
|
||||
<source>SEZIONE</source>
|
||||
</field>
|
||||
<field x="88" type="Valuta" align="right" width="14" id="303" pattern="1" text="###.###.###,@@">
|
||||
<source>IF((MOVANA.TIPOMOV=="")(BETWEEN(DATACOMP,#DATAINI,#DATASTA));IMPORTO;0)</source>
|
||||
<postscript description="B1.303 POSTSCRIPT">#THIS @
|
||||
EMPTY=
|
||||
IF
|
||||
ELSE
|
||||
#THIS GET_ID_NEXT @ \ Legge la sezione dal campo successivo
|
||||
"A" = IF \ Se vale Avere
|
||||
#THIS @ -1 * \ Cambia segno
|
||||
#THIS ! \ al campo corrente
|
||||
THEN
|
||||
#THIS @ \ Prende il valore attuale con segno
|
||||
"F3." #THIS GET_ID + \ Costruisce la stringa F3.101
|
||||
+! \ Somma il campo corrente al corrispondente in F3
|
||||
THEN
|
||||
</postscript>
|
||||
</field>
|
||||
<field x="103" type="Stringa" width="1" id="304" pattern="1">
|
||||
<source>SEZIONE</source>
|
||||
</field>
|
||||
</section>
|
||||
<section type="Foot" pattern="1" />
|
||||
<section type="Foot" level="1" pattern="1" />
|
||||
<section type="Foot" level="2" pattern="1" />
|
||||
<section type="Foot" level="3" pattern="1">
|
||||
<field border="2" x="20" type="Linea" pattern="1" />
|
||||
<field border="2" x="63" type="Linea" pattern="1" />
|
||||
<field border="2" x="78" type="Linea" pattern="1" />
|
||||
<field border="2" x="94" type="Linea" pattern="1" />
|
||||
<field border="2" x="112" type="Linea" pattern="1" />
|
||||
<field border="2" x="128" type="Linea" pattern="1" />
|
||||
<field border="2" x="144" type="Linea" pattern="1" />
|
||||
<field border="2" x="144" type="Linea" pattern="1" />
|
||||
<field border="2" x="162" type="Linea" pattern="1" />
|
||||
<field border="2" x="162" type="Linea" pattern="1" />
|
||||
<field type="Stringa" width="20" id="101" pattern="1">
|
||||
<source>#H3.101</source>
|
||||
</field>
|
||||
<field x="20" type="Stringa" width="43" id="102" pattern="1">
|
||||
<prescript description="F3.102 PRESCRIPT">MESSAGE ISAMREAD,PCONANA,CODCONTO=#H3.101,DESCR</prescript>
|
||||
</field>
|
||||
<field x="63" type="Valuta" align="right" width="12" id="201" pattern="1" hide_zero="1" text="###.###.###,@@">
|
||||
<prescript description="F3.201 PRESCRIPT">#THIS @ 0 C; IF
|
||||
#THIS @
|
||||
-1 *
|
||||
#THIS !
|
||||
#THIS GET_ID_NEXT
|
||||
"A"
|
||||
ELSE
|
||||
#THIS @
|
||||
0 = IF
|
||||
""
|
||||
ELSE
|
||||
"D"
|
||||
THEN
|
||||
THEN
|
||||
#THIS GET_ID_NEXT !
|
||||
</prescript>
|
||||
</field>
|
||||
<field x="76" type="Stringa" width="1" id="202" pattern="1" />
|
||||
<field x="79" type="Valuta" align="right" width="12" id="203" pattern="1" hide_zero="1" text="###.###.###,@@">
|
||||
<prescript description="F3.203 PRESCRIPT">#THIS @ 0 C; IF
|
||||
#THIS @
|
||||
-1 *
|
||||
#THIS !
|
||||
#THIS GET_ID_NEXT
|
||||
"A"
|
||||
ELSE
|
||||
#THIS @
|
||||
0 = IF
|
||||
""
|
||||
ELSE
|
||||
"D"
|
||||
THEN
|
||||
THEN
|
||||
#THIS GET_ID_NEXT !
|
||||
</prescript>
|
||||
</field>
|
||||
<field x="92" type="Stringa" width="1" id="204" pattern="1" />
|
||||
<field x="95" type="Valuta" align="right" width="12" id="205" pattern="1" hide_zero="1" text="###.###.###,@@">
|
||||
<postscript description="F3.205 POSTSCRIPT">104 @
|
||||
102 @
|
||||
- .</postscript>
|
||||
</field>
|
||||
<field x="108" type="Numero" align="right" width="3" id="206" pattern="1" text="###">
|
||||
<prescript description="F3.206 PRESCRIPT">102 @
|
||||
0 = IF
|
||||
0
|
||||
ELSE
|
||||
106 @
|
||||
102 @
|
||||
F; 100 *
|
||||
0 ROUND
|
||||
THEN
|
||||
.
|
||||
</prescript>
|
||||
</field>
|
||||
<field x="113" type="Valuta" align="right" width="12" id="301" pattern="1" hide_zero="1" text="###.###.###,@@">
|
||||
<prescript description="F3.301 PRESCRIPT">#THIS @ 0 C; IF
|
||||
#THIS @
|
||||
-1 *
|
||||
#THIS !
|
||||
#THIS GET_ID_NEXT
|
||||
"A"
|
||||
ELSE
|
||||
#THIS @
|
||||
0 = IF
|
||||
""
|
||||
ELSE
|
||||
"D"
|
||||
THEN
|
||||
THEN
|
||||
#THIS GET_ID_NEXT !
|
||||
</prescript>
|
||||
</field>
|
||||
<field x="126" type="Stringa" width="1" id="302" pattern="1" />
|
||||
<field x="129" type="Valuta" align="right" width="12" id="303" pattern="1" hide_zero="1" text="###.###.###,@@">
|
||||
<prescript description="F3.303 PRESCRIPT">#THIS @ 0 C; IF
|
||||
#THIS @
|
||||
-1 *
|
||||
#THIS !
|
||||
#THIS GET_ID_NEXT
|
||||
"A"
|
||||
ELSE
|
||||
#THIS @
|
||||
0 = IF
|
||||
""
|
||||
ELSE
|
||||
"D"
|
||||
THEN
|
||||
THEN
|
||||
#THIS GET_ID_NEXT !
|
||||
</prescript>
|
||||
</field>
|
||||
<field x="142" type="Stringa" width="1" id="304" pattern="1" />
|
||||
<field x="145" type="Valuta" align="right" width="12" id="305" pattern="1" text="###.###.###,@@">
|
||||
<postscript description="F3.305 POSTSCRIPT">104 @
|
||||
102 @
|
||||
- .</postscript>
|
||||
</field>
|
||||
<field x="158" type="Numero" align="right" width="3" id="306" pattern="1" text="###">
|
||||
<prescript description="F3.306 PRESCRIPT">102 @
|
||||
0 = IF
|
||||
0
|
||||
ELSE
|
||||
106 @
|
||||
102 @
|
||||
F; 100 *
|
||||
0 ROUND
|
||||
THEN
|
||||
.
|
||||
</prescript>
|
||||
</field>
|
||||
</section>
|
||||
<sql>USE RMOVANA KEY 3 SELECT BETWEEN(CODCCOSTO,#CODCOSTO,#CODCOSTO)
|
||||
BY CODCCOSTO CODCONTO DATACOMP
|
||||
JOIN MOVANA INTO NUMREG==NUMREG
|
||||
FROM DATACOMP=#DATAINI
|
||||
TO DATACOMP=#DATAFIN</sql>
|
||||
<prescript description="PRESCRIPT">: ADD_T0_F3 ( -- )
|
||||
#THIS @
|
||||
EMPTY=
|
||||
IF
|
||||
ELSE
|
||||
MON
|
||||
#THIS GET_ID_NEXT @ \ Legge la sezione dal campo successivo
|
||||
"A" = IF \ Se vale Avere
|
||||
#THIS @ -1 * \ Cambia segno
|
||||
#THIS ! \ al campo corrente
|
||||
THEN
|
||||
#THIS @ \ Prende il valore attuale con segno
|
||||
"F3." #THIS GET_ID + \ Costruisce la stringa F3.101
|
||||
+! \ Somma il campo corrente al corrispondente in F3
|
||||
THEN
|
||||
;</prescript>
|
||||
</report>
|
66
ca/ca1100a.uml
Normal file
66
ca/ca1100a.uml
Normal file
@ -0,0 +1,66 @@
|
||||
PAGE "Bilancio di Budget" -1 -1 52 9
|
||||
|
||||
NUMBER 101 4
|
||||
BEGIN
|
||||
PROMPT 1 1 "Esercizio "
|
||||
USE ESC
|
||||
INPUT CODTAB 101
|
||||
DISPLAY "Codice Esercizio" CODTAB
|
||||
DISPLAY "Inizio Esercizio" D0
|
||||
DISPLAY "Fine Esercizio " D1
|
||||
OUTPUT 102 D0
|
||||
OUTPUT 103 D1
|
||||
CHEKCTYPE REQUIRED
|
||||
END
|
||||
|
||||
DATE 102
|
||||
BEGIN
|
||||
PROMPT 27 1 ""
|
||||
FLAGS "D"
|
||||
FIELD DATAINI
|
||||
END
|
||||
|
||||
DATE 103
|
||||
BEGIN
|
||||
PROMPT 39 1 ""
|
||||
FLAGS "D"
|
||||
FIELD DATAFIN
|
||||
END
|
||||
|
||||
DATE 104
|
||||
BEGIN
|
||||
PROMPT 1 2 "Data stampa "
|
||||
FIELD DATASTA
|
||||
CHECKTYPE REQUIRED
|
||||
STR_EXPR BETWEEN(#104,#102,#103)
|
||||
WARNING "Data non compresa nell'anno selezionato"
|
||||
END
|
||||
|
||||
STRING 105 20
|
||||
BEGIN
|
||||
PROMPT 1 3 "Centro di Costo "
|
||||
USE 146
|
||||
INPUT CODCOSTO 105
|
||||
DISPLAY "Centro di Costo@20" CODCOSTO
|
||||
DISPLAY "Descrizione@50" DESCRIZ
|
||||
OUTPUT 105 CODCOSTO
|
||||
CHECKTYPE NORMAL
|
||||
FIELD CODCOSTO
|
||||
END
|
||||
|
||||
|
||||
BUTTON 1 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 ""
|
||||
END
|
||||
|
||||
BUTTON 2 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
|
19
ca/ca3.cpp
19
ca/ca3.cpp
@ -7,16 +7,15 @@ int main(int argc, char** argv)
|
||||
const int r = (argc > 1) ? argv[1][1] - '0' : 0;
|
||||
switch (r)
|
||||
{
|
||||
case 1: ca3200(argc, argv); break; // stampa mastrini
|
||||
case 2: ca3300(argc, argv); break; // stampa bilancio
|
||||
case 3: ca3400(argc, argv); break; // generazione movimenti perfetti ma casuali
|
||||
case 4: ca3500(argc, argv); break; // stampatore generico di report di CA
|
||||
case 5: ca3600(argc, argv); break; // stampa pagato per CdC/Commessa/Fase
|
||||
case 6: ca3700(argc, argv); break; //stampa rendiconto
|
||||
case 7: ca3800(argc, argv); break; //stampa bilancio di commessa per esercizio
|
||||
case 8: ca3900(argc, argv); break; // stampa stima ricavi
|
||||
default: ca3100(argc, argv); break; // stampa movimenti
|
||||
case 1: ca3200(argc, argv); break; // stampa mastrini
|
||||
case 2: ca3300(argc, argv); break; // stampa bilancio
|
||||
case 3: ca3400(argc, argv); break; // generazione movimenti perfetti ma casuali
|
||||
case 4: ca3500(argc, argv); break; // stampatore generico di report di CA
|
||||
case 5: ca3600(argc, argv); break; // stampa pagato per CdC/Commessa/Fase
|
||||
case 6: ca3700(argc, argv); break; // stampa rendiconto
|
||||
case 7: ca3800(argc, argv); break; // stampa bilancio di commessa per esercizio
|
||||
case 8: ca3900(argc, argv); break; // stampa stima ricavi
|
||||
default:ca3100(argc, argv); break; // stampa movimenti
|
||||
}
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
146
ca/ca3300.cpp
146
ca/ca3300.cpp
@ -4,6 +4,8 @@
|
||||
#include <reprint.h>
|
||||
#include <pconti.h>
|
||||
|
||||
#include "cdc.h"
|
||||
#include "commesse.h"
|
||||
#include "movana.h"
|
||||
#include "pconana.h"
|
||||
#include "rmovana.h"
|
||||
@ -28,7 +30,6 @@ protected:
|
||||
|
||||
public:
|
||||
TPrint_bilancio_ca_mask();
|
||||
virtual ~TPrint_bilancio_ca_mask() {}
|
||||
};
|
||||
|
||||
const TString& TPrint_bilancio_ca_mask::get_report_class() const
|
||||
@ -50,7 +51,7 @@ bool TPrint_bilancio_ca_mask::test_compatible_report()
|
||||
{
|
||||
const TString& cls = get_report_class();
|
||||
const TString& name = get(F_REPORT);
|
||||
bool ok = name.not_empty();
|
||||
bool ok = name.full();
|
||||
if (ok && name != cls)
|
||||
{
|
||||
TReport rep;
|
||||
@ -188,7 +189,6 @@ bool TPrint_bilancio_ca_mask::on_field_event(TOperable_field& o, TField_event e,
|
||||
return TAnal_report_mask::on_field_event(o, e, jolly);
|
||||
}
|
||||
|
||||
|
||||
TPrint_bilancio_ca_mask::TPrint_bilancio_ca_mask()
|
||||
:TAnal_report_mask("ca3300")
|
||||
{
|
||||
@ -269,7 +269,12 @@ TPrint_bilancio_ca_mask::TPrint_bilancio_ca_mask()
|
||||
// creazione dei campi della seconda pagina della maschera
|
||||
create_sheet(F_RIGHE);
|
||||
|
||||
set_handlers(); // Setta l'andler universale a tutti i nuovi campi
|
||||
// Crea gli elementi della lista della stampa completa
|
||||
const bool per_cms = cfg.get("Level", NULL, 1) == "CMS";
|
||||
TList_field& sc = lfield(F_COMPLETA);
|
||||
sc.replace_items("0|1", per_cms ? " |commesse" : " |centri di costo");
|
||||
|
||||
set_handlers(); // Setta l'handler universale a tutti i nuovi campi
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
@ -536,7 +541,7 @@ void TRecordset_sezioni_contrapposte::add_conto(int indbil, const TString& b)
|
||||
|
||||
if ((_tipimov & _saldanal_qualsiasi) == _saldanal_qualsiasi) // Bilancio a sezioni contrapposte di raffronto
|
||||
{
|
||||
const TSaldanal& sp = ca_saldo(bill, _da_data, _a_data, _saldanal_preventivi);
|
||||
const TSaldanal& sp = ca_sldo(bill, _da_data, _a_data, _saldanal_preventivi);
|
||||
const TSaldanal& sc = ca_saldo(bill, _da_data, _a_data, _saldanal_consuntivo);
|
||||
if (!sp._fin.is_zero() || !sc._fin.is_zero())
|
||||
{
|
||||
@ -963,8 +968,11 @@ class TPrint_bilancio_ca : public TSkeleton_application
|
||||
TPrint_bilancio_ca_mask* _mask;
|
||||
|
||||
protected:
|
||||
virtual const char * extra_modules() const {return "cm";} //funziona anche con autorizzazione CM
|
||||
virtual const char * extra_modules() const { return "cm"; } // funziona anche con autorizzazione CM
|
||||
|
||||
bool commessa_buona(const TRectype& cms, const TDate& dadata, const TDate& adata) const;
|
||||
bool buon_cdc(const TRectype& cdc, const TDate& dadata, const TDate& adata) const;
|
||||
void fill_sheet(int livello);
|
||||
void bilancio_a_sezioni_contrapposte(const bool stampa);
|
||||
void bilancio_di_verifica(const bool stampa);
|
||||
|
||||
@ -980,13 +988,17 @@ void TPrint_bilancio_ca::bilancio_a_sezioni_contrapposte(const bool stampa)
|
||||
TReport_bilancio_sezioni_contrapposte rep(_mask->get(F_REPORT));
|
||||
|
||||
const int rows = _mask->sfield(F_RIGHE).items();
|
||||
TProgind* pi = rows > 1 ? new TProgind(rows, TR("Bilancio a sezioni contrapposte")) : NULL;
|
||||
|
||||
TReport_book book;
|
||||
for (int i = 0; i < rows; i++)
|
||||
{
|
||||
if (pi && !pi->addstatus(1))
|
||||
break;
|
||||
rep.set_filter(*_mask, i);
|
||||
book.add(rep);
|
||||
}
|
||||
if (pi) delete pi;
|
||||
|
||||
if (stampa)
|
||||
book.print(); //stampa il book dei report
|
||||
@ -999,13 +1011,17 @@ void TPrint_bilancio_ca::bilancio_di_verifica(const bool stampa)
|
||||
TReport_bilancio_verifica rep(_mask->get(F_REPORT));
|
||||
|
||||
const int rows = _mask->sfield(F_RIGHE).items();
|
||||
TProgind* pi = rows > 1 ? new TProgind(rows, TR("Bilancio di verifica")) : NULL;
|
||||
|
||||
TReport_book book;
|
||||
for (int i = 0; i < rows; i++)
|
||||
{
|
||||
if (pi && !pi->addstatus(1))
|
||||
break;
|
||||
rep.set_filter(*_mask, i);
|
||||
book.add(rep);
|
||||
}
|
||||
if (pi) delete pi;
|
||||
|
||||
if (stampa)
|
||||
book.print(); //stampa il book dei report
|
||||
@ -1023,16 +1039,129 @@ void TPrint_bilancio_ca::preview()
|
||||
print_or_preview(false);
|
||||
}
|
||||
|
||||
// Anche l'occhio vuole la sua parte
|
||||
bool TPrint_bilancio_ca::commessa_buona(const TRectype& cms, const TDate& dadata, const TDate& adata) const
|
||||
{
|
||||
if (dadata.ok() || adata.ok())
|
||||
{
|
||||
TDate dataini, datafine;
|
||||
ca_durata_commessa(cms, dataini, datafine);
|
||||
|
||||
if (dadata.ok() && datafine.ok() && datafine < dadata)
|
||||
return false; // Commessa finita prima dell'inizio della stampa
|
||||
|
||||
if (adata.ok() && dataini.ok() && dataini > adata)
|
||||
return false; // Commessa iniziata dopo la fine della stampa
|
||||
|
||||
TString query;
|
||||
query = "USE RMOVANA KEY 4\nBY CODCMS DATACOMP\n";
|
||||
query << "FROM CODCMS=#CMS\nTO CODCMS=#CMS";
|
||||
TISAM_recordset rmovana(query);
|
||||
rmovana.set_var("#CMS", cms.get(COMMESSE_CODCMS));
|
||||
|
||||
if (!rmovana.move_first())
|
||||
return false; // Ignora commesse non movimentate
|
||||
|
||||
TDate datacomp = rmovana.get(RMOVANA_DATACOMP).as_date();
|
||||
if (adata.ok() && datacomp > adata)
|
||||
return false; // la data del primo movimento è troppo grande
|
||||
|
||||
rmovana.move_last(); // deve riuscire per forza, avendo avuto successo la move_first
|
||||
datacomp = rmovana.get(RMOVANA_DATACOMP).as_date();
|
||||
if (datacomp < dadata)
|
||||
return false; // la data dell'ultimo movimento è troppo piccola
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Non sempre si fanno le cose alla cdc
|
||||
bool TPrint_bilancio_ca::buon_cdc(const TRectype& cdc, const TDate& dadata, const TDate& adata) const
|
||||
{
|
||||
if (dadata.ok() || adata.ok())
|
||||
{
|
||||
TString query;
|
||||
query = "USE RMOVANA KEY 5\nBY CODCCOSTO DATACOMP\n";
|
||||
query << "FROM CODCCOSTO=#COSTO\nTO CODCCOSTO=#COSTO";
|
||||
TISAM_recordset rmovana(query);
|
||||
rmovana.set_var("#COSTO", cdc.get(CDC_CODCOSTO));
|
||||
if (!rmovana.move_first())
|
||||
return false; // Ignora centri non movimentati ... come quello di Isernia
|
||||
|
||||
TDate datacomp = rmovana.get(RMOVANA_DATACOMP).as_date();
|
||||
if (adata.ok() && datacomp > adata)
|
||||
return false; // la data del primo movimento è troppo grande
|
||||
|
||||
rmovana.move_last();
|
||||
datacomp = rmovana.get(RMOVANA_DATACOMP).as_date();
|
||||
if (datacomp < dadata)
|
||||
return false; // la data dell'ultimo movimento è troppo piccola
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void TPrint_bilancio_ca::fill_sheet(int livello)
|
||||
{
|
||||
TSheet_field& sf = _mask->sfield(F_RIGHE);
|
||||
sf.destroy();
|
||||
if (livello <= 0)
|
||||
{
|
||||
sf.row(-1);
|
||||
return;
|
||||
}
|
||||
const bool per_cms = ca_config().get("Level", NULL, 1) == "CMS";
|
||||
const int annoes = _mask->get_int(F_ANNO);
|
||||
TDate dadata, adata;
|
||||
if (annoes > 0)
|
||||
{
|
||||
TEsercizi_contabili ese;
|
||||
ese.code2range(annoes, dadata, adata);
|
||||
}
|
||||
if (!_mask->efield(F_DATADA).empty())
|
||||
dadata = _mask->get(F_DATADA);
|
||||
if (!_mask->efield(F_DATAA).empty())
|
||||
adata = _mask->get(F_DATAA);
|
||||
|
||||
TString query;
|
||||
query << "USE " << (per_cms ? LF_COMMESSE : LF_CDC);
|
||||
TISAM_recordset recset(query);
|
||||
const TRectype& rec = recset.cursor()->curr();
|
||||
for (bool ok = recset.move_first(); ok; ok = recset.move_next())
|
||||
{
|
||||
if (per_cms)
|
||||
{
|
||||
if (commessa_buona(rec, dadata, adata))
|
||||
sf.row(-1) = rec.get(COMMESSE_CODCMS);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (buon_cdc(rec, dadata, adata))
|
||||
sf.row(-1) = rec.get(CDC_CODCOSTO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TPrint_bilancio_ca::print_or_preview(const bool stampa)
|
||||
{
|
||||
TSheet_field& sf = _mask->sfield(F_RIGHE);
|
||||
if (sf.empty())
|
||||
sf.row(-1); // Aggiungo riga vuota
|
||||
|
||||
bool empty_sheet = true;
|
||||
const int completa = _mask->get_int(F_COMPLETA);
|
||||
if (completa <= 0)
|
||||
{
|
||||
empty_sheet = sf.empty();
|
||||
if (empty_sheet)
|
||||
sf.row(-1); // Aggiungo riga vuota
|
||||
}
|
||||
else
|
||||
fill_sheet(completa);
|
||||
|
||||
if (_mask->get(F_BILANCIO) == "C")
|
||||
bilancio_a_sezioni_contrapposte(stampa);
|
||||
else
|
||||
bilancio_di_verifica(stampa);
|
||||
|
||||
if (empty_sheet)
|
||||
sf.destroy();
|
||||
}
|
||||
|
||||
void TPrint_bilancio_ca::main_loop()
|
||||
@ -1049,3 +1178,4 @@ int ca3300(int argc, char* argv[])
|
||||
a.run(argc, argv, TR("Stampa bilancio"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#define F_DATAA 313
|
||||
#define F_TIPOSTAMPA 314
|
||||
#define F_PRINT_CONTO_ECON 315
|
||||
#define F_COMPLETA 316
|
||||
|
||||
//campi generati dai piani dei conti
|
||||
#define F_PIANO 319
|
||||
|
@ -108,7 +108,7 @@ BEGIN
|
||||
PROMPT 59 6 "Al "
|
||||
END
|
||||
|
||||
LIST F_STAMPAV 20
|
||||
LIST F_STAMPAV 1 20
|
||||
BEGIN
|
||||
PROMPT 2 8 "Selezione conti "
|
||||
ITEM "1|Movimentati"
|
||||
@ -117,6 +117,16 @@ BEGIN
|
||||
GROUP 4
|
||||
END
|
||||
|
||||
LIST F_COMPLETA 1 16
|
||||
BEGIN
|
||||
PROMPT 42 8 "Stampa completa "
|
||||
ITEM "0| " MESSAGE SHOW,F_RIGHE
|
||||
ITEM "1|Primo livello " MEGGASE HIDE,F_RIGHE
|
||||
ITEM "2|Secondo livello" MESSAGE HIDE,F_RIGHE
|
||||
ITEM "3|Terzo livello " MEGGASE HIDE,F_RIGHE
|
||||
END
|
||||
|
||||
|
||||
BOOLEAN F_PRINT_CONTO_ECON
|
||||
BEGIN
|
||||
PROMPT 2 9 "Stampa situazione conto economico"
|
||||
|
@ -47,8 +47,7 @@ TConfig_anal::TConfig_anal() : TConfig(CONFIG_DITTA, "ca"), _has_ca(dongle().act
|
||||
const TString& TConfig_anal::get(const char* varname, const char* section, int index, const char* def)
|
||||
{
|
||||
if (_has_ca)
|
||||
return TConfig::get(varname, section, index, def);
|
||||
|
||||
return TConfig::get(varname, section, index, def);
|
||||
|
||||
if (_has_cm)
|
||||
{
|
||||
@ -3115,7 +3114,8 @@ long ca_durata_commessa(const TRectype& rec_commesse, TDate& dataini, TDate& dat
|
||||
}
|
||||
}
|
||||
|
||||
//se entrambe le date fossero vuote, visto che comunque adesso l'anno ce l'ha, le può ricavare..
|
||||
//se entrambe le date fossero vuote, visto che comunque adesso l'anno ce l'ha, le può ricavare...
|
||||
// Probabilmente le prossime 3 righe andrebbero cancellate: si assume una commessa per un anno
|
||||
if (!dataini.ok() && !datafine.ok())
|
||||
esc.code2range(anno, dataini, datafine);
|
||||
else //solo una data o nessuna data non buona
|
||||
|
@ -74,6 +74,7 @@ Item_05 = "Rendiconto", "ca3 -6", "F"
|
||||
Item_06 = "Bilancio di commessa", "ca3 -7", "F"
|
||||
Item_07 = "Stima ricavi di competenza", "ca3 -8", "F"
|
||||
Item_08 = "Conti per commessa", "ca1 -7", "F"
|
||||
Item_09 = "Bilancio per centro di costo", "ca1 -0 ca1100a", "F"
|
||||
|
||||
[CAMENU_050]
|
||||
Caption = "Servizi"
|
||||
|
Loading…
x
Reference in New Issue
Block a user