>DEFINE CLASS vente_Resident AS CrystalReportEnvironment > ReportFileName = "vente_Resident.rpt" > aCursors[1] = "lv_cr_vente" > *-------------------------------------------------- > FUNCTION BeforePrint() > LOCAL lretval,; > crxDbField > WITH THIS > .AddFieldsCalculed( "@nMois" , goapp.oReportSelection.spinnerMois.VALUE ) > .AddFieldsCalculed( "@nAn" , goapp.oReportSelection.spinnerAn.VALUE ) > .AddFieldsCalculed( "@lallow_imprime_detail_vente" , goapp.oReportSelection.chkdetail.VALUE ) > .Put_Compagny( COORD_SOC_ABREGE_840 , MRPA_LOC ) && coordonnées compagny > *-- Changement de condition pour le groupe. > IF goapp.oReportSelection.Cboordre_resident_chambre1.LISTINDEX = 2 > crxDbField = .crReport.DATABASE.TABLES.ITEM(1).FIELDS.ITEM(20) > *-- GROUPE HEADER 2 > .crReport.areas.ITEM("GH1").groupConditionField = crxDbField > ENDIF > ENDWITH > lretval = DODEFAULT() > RETURN lretval > ENDFUNC > *--------------------------------------------------- >ENDDEFINE >>
> *--------------------------------------------------------------------------------------------------- > *-- Change the data source of a report at runtime. > PROCEDURE changedataSource > *------------------------------------------------------------------------------------------------ > LPARAMETERS cTableName, cNewTableName , oreport > > * > * cNewODBC ODBC DSN to use for this run > * cTableName Name of the table this is to be applied to > * cNewTableName New name of table if appropriate > * > LOCAL nItems, lSuccess , cNewODBC > lSuccess = .F. > > cNewODBC = THIS.cDNS > > > IF VARTYPE(cNewODBC) # 'C' OR VARTYPE(cTableName) # 'C' > RETURN lSuccess > ENDIF > > IF EMPTY(cNewTableName) > cNewTableName = cTableName > ENDIF > > *-- 09/2004 > IF VARTYPE( oreport ) <> 'O' > oreport = THIS.crreport > ENDIF > > > * > * Ensure '.dsn' is not included - also remember the ODBC name is CaSe SeNsItIvE > * > cNewODBC = STRTRAN( cNewODBC, '.dsn', '') > > * WITH THIS.crreport > WITH oreport > > nItems = .DATABASE.TABLES.COUNT > > FOR nX = 1 TO nItems > * > IF UPPER( ALLTRIM( .DATABASE.TABLES.ITEM( nX ).Location ) ) = cTableName > * WAIT WINDOW "Connection Serveur Ok " + .DATABASE.TABLES.ITEM( nX ).Location TIMEOUT 4 > > .DATABASE.TABLES.ITEM( 1 ).SetLogOnInfo( cNewODBC , "", "" , "" ) > .DATABASE.TABLES.ITEM( 1 ).Location = cNewTableName > lSuccess = .T. > > > EXIT FOR > ENDIF > ENDFOR > > ENDWITH > > * THIS.crApplication.setmatchlogoninfo(.T.) > *-- Warning !!! 06/2004 Dans le rapport sur le nouveau financement on a un sous rapport > *-- composé d'une table Indépendante ccomp_fonc.DBF et ccompense.dbf. > *-- La connection est ODBC FoxproTable. > > RETURN lSuccess > ENDPROC > >>