diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2013-09-09 20:00:48 +0200 |
---|---|---|
committer | Noel Power <noel.power@suse.com> | 2013-09-11 20:40:19 +0000 |
commit | b31f33bcc1e5b8d1f791867358b5b4ad1df6e71e (patch) | |
tree | 50b297ee4a5187e120b7898afff52fcde18f3c52 | |
parent | 20238b8fa63b8754d14b69467842f8c49fe3bb2b (diff) |
Easier conversion between Basic Date and UNO Date/Time
Utility functions to convert between Basic Date type
and the representations of Date and Time in UNO, namely:
- com.sun.star.util.Date
- com.sun.star.util.Time
- com.sun.star.util.DateTime
Name of new functions:
- CDateToUnoDate
- CDateFromUnoDate
- CDateToUnoTime
- CDateFromUnoTime
- CDateToUnoDateTime
- CDateFromUnoDateTime
Change-Id: I2b971df20df1c0351d071023e042169b548894f1
Reviewed-on: https://gerrit.libreoffice.org/5897
Reviewed-by: Noel Power <noel.power@suse.com>
Tested-by: Noel Power <noel.power@suse.com>
-rw-r--r-- | basic/source/classes/propacc.cxx | 9 | ||||
-rw-r--r-- | basic/source/classes/sbunoobj.cxx | 11 | ||||
-rw-r--r-- | basic/source/classes/sbxmod.cxx | 3 | ||||
-rw-r--r-- | basic/source/inc/date.hxx | 15 | ||||
-rw-r--r-- | basic/source/runtime/methods.cxx | 200 | ||||
-rw-r--r-- | basic/source/runtime/methods1.cxx | 4 | ||||
-rw-r--r-- | basic/source/runtime/rtlproto.hxx | 6 | ||||
-rw-r--r-- | basic/source/runtime/stdobj.cxx | 12 | ||||
-rw-r--r-- | basic/source/sbx/sbxvalue.cxx | 2 | ||||
-rw-r--r-- | include/basic/sbuno.hxx | 6 | ||||
-rw-r--r-- | include/basic/sbxvar.hxx | 2 | ||||
-rw-r--r-- | wizards/source/depot/Depot.xba | 20 | ||||
-rw-r--r-- | wizards/source/depot/Internet.xba | 8 |
13 files changed, 255 insertions, 43 deletions
diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx index 9d627248ea1d..48e56c2a5536 100644 --- a/basic/source/classes/propacc.cxx +++ b/basic/source/classes/propacc.cxx @@ -22,6 +22,7 @@ #include <basic/sbstar.hxx> #include <sbunoobj.hxx> +#include <basic/sbuno.hxx> #include <limits.h> // USHRT_MAX @@ -32,14 +33,6 @@ using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace cppu; - -//======================================================================== - -// Declaration conversion from Sbx to UNO with known target type -Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty = NULL ); - -//======================================================================== - #ifdef WNT #define CDECL _cdecl #endif diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index c0b9c33936ee..eba896f0609b 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -897,7 +897,7 @@ Type getUnoTypeForSbxBaseType( SbxDataType eType ) } // Converting of Sbx to Uno without a know target class for TypeClass_ANY -Type getUnoTypeForSbxValue( SbxValue* pVal ) +Type getUnoTypeForSbxValue( const SbxValue* pVal ) { Type aRetType = getCppuVoidType(); if( !pVal ) @@ -1026,11 +1026,8 @@ Type getUnoTypeForSbxValue( SbxValue* pVal ) return aRetType; } -// Declaration converting of Sbx to Uno with known target class -Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty = NULL ); - // converting of Sbx to Uno without known target class for TypeClass_ANY -Any sbxToUnoValueImpl( SbxVariable* pVar, bool bBlockConversionToSmallestType = false ) +Any sbxToUnoValueImpl( const SbxValue* pVar, bool bBlockConversionToSmallestType = false ) { SbxDataType eBaseType = pVar->SbxValue::GetType(); if( eBaseType == SbxOBJECT ) @@ -1194,7 +1191,7 @@ static Any implRekMultiDimArrayToSequence( SbxDimArray* pArray, } // Map old interface -Any sbxToUnoValue( SbxVariable* pVar ) +Any sbxToUnoValue( const SbxValue* pVar ) { return sbxToUnoValueImpl( pVar ); } @@ -1223,7 +1220,7 @@ static bool implGetTypeByName( const OUString& rName, Type& rRetType ) // converting of Sbx to Uno with known target class -Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty ) +Any sbxToUnoValue( const SbxValue* pVar, const Type& rType, Property* pUnoProperty ) { Any aRetVal; diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 567d26fa0993..b1e4b8ffad9a 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -25,6 +25,7 @@ #include <svl/brdcst.hxx> #include <tools/shl.hxx> #include <basic/sbx.hxx> +#include <basic/sbuno.hxx> #include "sbdiagnose.hxx" #include "sb.hxx" #include <sbjsmeth.hxx> @@ -87,8 +88,6 @@ using namespace com::sun::star::uno; typedef ::cppu::WeakImplHelper1< XInvocation > DocObjectWrapper_BASE; typedef ::std::map< sal_Int16, Any, ::std::less< sal_Int16 > > OutParamMap; -::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar ); -void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue ); class DocObjectWrapper : public DocObjectWrapper_BASE { diff --git a/basic/source/inc/date.hxx b/basic/source/inc/date.hxx index cd38c896d1df..cb7070284164 100644 --- a/basic/source/inc/date.hxx +++ b/basic/source/inc/date.hxx @@ -20,7 +20,15 @@ #ifndef _SBDATE_HXX #define _SBDATE_HXX +#include <com/sun/star/util/Date.hpp> +#include <com/sun/star/util/Time.hpp> +#include <com/sun/star/util/DateTime.hpp> + bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double& rdRet ); +double implTimeSerial( sal_Int16 nHour, sal_Int16 nMinute, sal_Int16 nSecond); +bool implDateTimeSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, + sal_Int16 nHour, sal_Int16 nMinute, sal_Int16 nSecond, + double& rdRet ); sal_Int16 implGetWeekDay( double aDate, bool bFirstDayParam = false, sal_Int16 nFirstDay = 0 ); @@ -32,6 +40,13 @@ sal_Int16 implGetHour( double dDate ); sal_Int16 implGetMinute( double dDate ); sal_Int16 implGetSecond( double dDate ); +::com::sun::star::util::Date SbxDateToUNODate( const SbxValue* ); +void SbxDateFromUNODate( SbxValue*, const ::com::sun::star::util::Date& ); +::com::sun::star::util::Time SbxDateToUNOTime( const SbxValue* ); +void SbxDateFromUNOTime( SbxValue*, const ::com::sun::star::util::Time& ); +::com::sun::star::util::DateTime SbxDateToUNODateTime( const SbxValue* ); +void SbxDateFromUNODateTime( SbxValue*, const ::com::sun::star::util::DateTime& ); + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index fb01bdbfb989..048ca0c3a716 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -19,6 +19,7 @@ #include <tools/date.hxx> #include <basic/sbxvar.hxx> +#include <basic/sbuno.hxx> #include <osl/process.h> #include <vcl/dibtools.hxx> #include <vcl/svapp.hxx> @@ -1857,6 +1858,177 @@ sal_Int16 implGetDateMonth( double aDate ) return nRet; } +::com::sun::star::util::Date SbxDateToUNODate( const SbxValue* const pVal ) +{ + double aDate = pVal->GetDate(); + + com::sun::star::util::Date aUnoDate; + aUnoDate.Day = implGetDateDay ( aDate ); + aUnoDate.Month = implGetDateMonth( aDate ); + aUnoDate.Year = implGetDateYear ( aDate ); + + return aUnoDate; +} + +void SbxDateFromUNODate( SbxValue *pVal, const ::com::sun::star::util::Date& aUnoDate) +{ + double dDate; + if( implDateSerial( aUnoDate.Year, aUnoDate.Month, aUnoDate.Day, dDate ) ) + { + pVal->PutDate( dDate ); + } +} + +// Function to convert date to UNO date (com.sun.star.util.Date) +RTLFUNC(CDateToUnoDate) +{ + (void)pBasic; + (void)bWrite; + + if ( rPar.Count() != 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + unoToSbxValue(rPar.Get(0), Any(SbxDateToUNODate(rPar.Get(1)))); +} + +// Function to convert date from UNO date (com.sun.star.util.Date) +RTLFUNC(CDateFromUnoDate) +{ + (void)pBasic; + (void)bWrite; + + if ( rPar.Count() != 2 || rPar.Get(1)->GetType() != SbxOBJECT ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + Any aAny (sbxToUnoValue(rPar.Get(1), ::getCppuType( (com::sun::star::util::Date*)0 ))); + com::sun::star::util::Date aUnoDate; + if(aAny >>= aUnoDate) + SbxDateFromUNODate(rPar.Get(0), aUnoDate); + else + SbxBase::SetError( SbxERR_CONVERSION ); +} + +::com::sun::star::util::Time SbxDateToUNOTime( const SbxValue* const pVal ) +{ + double aDate = pVal->GetDate(); + + com::sun::star::util::Time aUnoTime; + aUnoTime.Hours = implGetHour ( aDate ); + aUnoTime.Minutes = implGetMinute ( aDate ); + aUnoTime.Seconds = implGetSecond ( aDate ); + aUnoTime.NanoSeconds = 0; + + return aUnoTime; +} + +void SbxDateFromUNOTime( SbxValue *pVal, const ::com::sun::star::util::Time& aUnoTime) +{ + pVal->PutDate( implTimeSerial(aUnoTime.Hours, aUnoTime.Minutes, aUnoTime.Seconds) ); +} + +// Function to convert date to UNO time (com.sun.star.util.Time) +RTLFUNC(CDateToUnoTime) +{ + (void)pBasic; + (void)bWrite; + + if ( rPar.Count() != 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + unoToSbxValue(rPar.Get(0), Any(SbxDateToUNOTime(rPar.Get(1)))); +} + +// Function to convert date from UNO time (com.sun.star.util.Time) +RTLFUNC(CDateFromUnoTime) +{ + (void)pBasic; + (void)bWrite; + + if ( rPar.Count() != 2 || rPar.Get(1)->GetType() != SbxOBJECT ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + Any aAny (sbxToUnoValue(rPar.Get(1), ::getCppuType( (com::sun::star::util::Time*)0 ))); + com::sun::star::util::Time aUnoTime; + if(aAny >>= aUnoTime) + SbxDateFromUNOTime(rPar.Get(0), aUnoTime); + else + SbxBase::SetError( SbxERR_CONVERSION ); +} + +::com::sun::star::util::DateTime SbxDateToUNODateTime( const SbxValue* const pVal ) +{ + double aDate = pVal->GetDate(); + + com::sun::star::util::DateTime aUnoDT; + aUnoDT.Day = implGetDateDay ( aDate ); + aUnoDT.Month = implGetDateMonth( aDate ); + aUnoDT.Year = implGetDateYear ( aDate ); + aUnoDT.Hours = implGetHour ( aDate ); + aUnoDT.Minutes = implGetMinute ( aDate ); + aUnoDT.Seconds = implGetSecond ( aDate ); + aUnoDT.NanoSeconds = 0; + + return aUnoDT; +} + +void SbxDateFromUNODateTime( SbxValue *pVal, const ::com::sun::star::util::DateTime& aUnoDT) +{ + double dDate; + if( implDateTimeSerial( aUnoDT.Year, aUnoDT.Month, aUnoDT.Day, + aUnoDT.Hours, aUnoDT.Minutes, aUnoDT.Seconds, + dDate ) ) + { + pVal->PutDate( dDate ); + } +} + +// Function to convert date to UNO date (com.sun.star.util.Date) +RTLFUNC(CDateToUnoDateTime) +{ + (void)pBasic; + (void)bWrite; + + if ( rPar.Count() != 2 ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + unoToSbxValue(rPar.Get(0), Any(SbxDateToUNODateTime(rPar.Get(1)))); +} + +// Function to convert date from UNO date (com.sun.star.util.Date) +RTLFUNC(CDateFromUnoDateTime) +{ + (void)pBasic; + (void)bWrite; + + if ( rPar.Count() != 2 || rPar.Get(1)->GetType() != SbxOBJECT ) + { + StarBASIC::Error( SbERR_BAD_ARGUMENT ); + return; + } + + Any aAny (sbxToUnoValue(rPar.Get(1), ::getCppuType( (com::sun::star::util::DateTime*)0 ))); + com::sun::star::util::DateTime aUnoDT; + if(aAny >>= aUnoDT) + SbxDateFromUNODateTime(rPar.Get(0), aUnoDT); + else + SbxBase::SetError( SbxERR_CONVERSION ); +} + // Function to convert date to ISO 8601 date format RTLFUNC(CDateToIso) { @@ -1954,12 +2126,7 @@ RTLFUNC(TimeSerial) return; } - sal_Int32 nSeconds = nHour; - nSeconds *= 3600; - nSeconds += nMinute * 60; - nSeconds += nSecond; - double nDays = ((double)nSeconds) / (double)(86400.0); - rPar.Get(0)->PutDate( nDays ); // JSM + rPar.Get(0)->PutDate( implTimeSerial(nHour, nMinute, nSecond) ); // JSM } RTLFUNC(DateValue) @@ -4809,6 +4976,27 @@ bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double& return true; } +double implTimeSerial( sal_Int16 nHours, sal_Int16 nMinutes, sal_Int16 nSeconds ) +{ + return + static_cast<double>( nHours * ::Time::secondPerHour + + nMinutes * ::Time::secondPerMinute + + nSeconds) + / + static_cast<double>( ::Time::secondPerDay ); +} + +bool implDateTimeSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, + sal_Int16 nHour, sal_Int16 nMinute, sal_Int16 nSecond, + double& rdRet ) +{ + double dDate; + if(!implDateSerial(nYear, nMonth, nDay, dDate)) + return false; + rdRet += dDate + implTimeSerial(nHour, nMinute, nSecond); + return true; +} + sal_Int16 implGetMinute( double dDate ) { if( dDate < 0.0 ) diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 7b7ea190eb0a..de275d740735 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -33,6 +33,7 @@ #include <osl/file.hxx> #include <vcl/jobset.hxx> #include <basic/sbobjmod.hxx> +#include <basic/sbuno.hxx> #include "date.hxx" #include "sbintern.hxx" @@ -60,9 +61,6 @@ using namespace com::sun::star::lang; using namespace com::sun::star::sheet; using namespace com::sun::star::uno; -void unoToSbxValue( SbxVariable* pVar, const Any& aValue ); -Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, com::sun::star::beans::Property* pUnoProperty = NULL ); - static Reference< XCalendar3 > getLocaleCalendar( void ) { static Reference< XCalendar3 > xCalendar; diff --git a/basic/source/runtime/rtlproto.hxx b/basic/source/runtime/rtlproto.hxx index ccf0a3ba62ce..7a6a9d84bea8 100644 --- a/basic/source/runtime/rtlproto.hxx +++ b/basic/source/runtime/rtlproto.hxx @@ -347,6 +347,12 @@ extern RTLFUNC(GlobalScope); extern RTLFUNC(FileExists); extern RTLFUNC(ConvertToUrl); extern RTLFUNC(ConvertFromUrl); +extern RTLFUNC(CDateToUnoDate); +extern RTLFUNC(CDateFromUnoDate); +extern RTLFUNC(CDateToUnoTime); +extern RTLFUNC(CDateFromUnoTime); +extern RTLFUNC(CDateToUnoDateTime); +extern RTLFUNC(CDateFromUnoDateTime); extern RTLFUNC(CDateToIso); extern RTLFUNC(CDateFromIso); extern RTLFUNC(CompatibilityMode); diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx index 08158045689e..34d45824919f 100644 --- a/basic/source/runtime/stdobj.cxx +++ b/basic/source/runtime/stdobj.cxx @@ -108,6 +108,18 @@ static Methods aMethods[] = { { "expression", SbxVARIANT, 0,NULL,0 }, { "CDate", SbxDATE, 1 | _FUNCTION, RTLNAME(CDate),0 }, { "expression", SbxVARIANT, 0,NULL,0 }, +{ "CDateFromUnoDate", SbxDATE, 1 | _FUNCTION, RTLNAME(CDateFromUnoDate),0 }, + { "UnoDate", SbxOBJECT, 0,NULL,0 }, +{ "CDateToUnoDate", SbxOBJECT, 1 | _FUNCTION, RTLNAME(CDateToUnoDate),0 }, + { "Date", SbxDATE, 0,NULL,0 }, +{ "CDateFromUnoTime", SbxDATE, 1 | _FUNCTION, RTLNAME(CDateFromUnoTime),0 }, + { "UnoTime", SbxOBJECT, 0,NULL,0 }, +{ "CDateToUnoTime", SbxOBJECT, 1 | _FUNCTION, RTLNAME(CDateToUnoTime),0 }, + { "Time", SbxDATE, 0,NULL,0 }, +{ "CDateFromUnoDateTime", SbxDATE, 1 | _FUNCTION, RTLNAME(CDateFromUnoDateTime),0 }, + { "UnoDateTime", SbxOBJECT, 0,NULL,0 }, +{ "CDateToUnoDateTime", SbxOBJECT, 1 | _FUNCTION, RTLNAME(CDateToUnoDateTime),0 }, + { "DateTime", SbxDATE, 0,NULL,0 }, { "CDateFromIso", SbxDATE, 1 | _FUNCTION, RTLNAME(CDateFromIso),0 }, { "IsoDate", SbxSTRING, 0,NULL,0 }, { "CDateToIso", SbxSTRING, 1 | _FUNCTION, RTLNAME(CDateToIso),0 }, diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index 1921c51c893d..3deced11ec62 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -661,7 +661,7 @@ sal_Bool SbxValue::PutDecimal( com::sun::star::bridge::oleautomation::Decimal& r } sal_Bool SbxValue::fillAutomationDecimal - ( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ) + ( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ) const { SbxDecimal* pDecimal = GetDecimal(); if( pDecimal != NULL ) diff --git a/include/basic/sbuno.hxx b/include/basic/sbuno.hxx index 55d487a48b75..30148690d188 100644 --- a/include/basic/sbuno.hxx +++ b/include/basic/sbuno.hxx @@ -20,6 +20,9 @@ #ifndef _SB_SBUNO_HXX #define _SB_SBUNO_HXX +#include <com/sun/star/beans/Property.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Type.hxx> #include <basic/sbxobj.hxx> #include "basicdllapi.h" @@ -33,7 +36,8 @@ BASIC_DLLPUBLIC SbxObjectRef GetSbUnoObject( const OUString& aName, const com::s BASIC_DLLPUBLIC void createAllObjectProperties( SbxObject* pObj ); BASIC_DLLPUBLIC void SetSbUnoObjectDfltPropName( SbxObject* pObj ); -BASIC_DLLPUBLIC ::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar ); +BASIC_DLLPUBLIC ::com::sun::star::uno::Any sbxToUnoValue( const SbxValue* pVar ); +BASIC_DLLPUBLIC ::com::sun::star::uno::Any sbxToUnoValue( const SbxValue* pVar, const ::com::sun::star::uno::Type& rType, com::sun::star::beans::Property* pUnoProperty = NULL ); BASIC_DLLPUBLIC void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue ); diff --git a/include/basic/sbxvar.hxx b/include/basic/sbxvar.hxx index 4d4a8b625bc3..a81836f125f6 100644 --- a/include/basic/sbxvar.hxx +++ b/include/basic/sbxvar.hxx @@ -189,7 +189,7 @@ public: // Special methods sal_Bool PutDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ); sal_Bool PutDecimal( SbxDecimal* pDecimal ); // This function is needed for Windows build, don't remove - sal_Bool fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ); + sal_Bool fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec ) const; sal_Bool PutCurrency( const sal_Int64& ); // Interface for CDbl in Basic static SbxError ScanNumIntnl( const OUString& rSrc, double& nVal, bool bSingle = false ); diff --git a/wizards/source/depot/Depot.xba b/wizards/source/depot/Depot.xba index 73f81a1fc2ef..6a8b1419c0e0 100644 --- a/wizards/source/depot/Depot.xba +++ b/wizards/source/depot/Depot.xba @@ -129,7 +129,7 @@ Dim LocStockName as String End If End If CurRate = TransactModel.txtRate.Value - TransactDate = CDateFromISO(TransactModel.txtDate.Date) + TransactDate = CDateFromUNODate(TransactModel.txtDate.Date) DlgTransaction.EndExecute() UnprotectSheets(oSheets) @@ -148,7 +148,7 @@ Dim LocStockName as String oMovementSheet.GetCellByPosition(SBCOLUMNQUANTITY2, iNewRow).Value = -TransactModel.txtQuantity.Value End If - oMovementSheet.GetCellByPosition(SBCOLUMNDATE2, iNewRow).Value = CDateFromISO(TransactModel.txtDate.Date) + oMovementSheet.GetCellByPosition(SBCOLUMNDATE2, iNewRow).Value = CDateFromUNODate(TransactModel.txtDate.Date) oMovementSheet.GetCellByPosition(SBCOLUMNRATE2, iNewRow).Value = TransactModel.txtRate.Value oMovementSheet.GetCellByPosition(SBCOLUMNPROVPERCENT2, iNewRow).Value = TransactModel.txtCommission.EffectiveValue oMovementSheet.GetCellByPosition(SBCOLUMNPROVMIN2, iNewRow).Value = TransactModel.txtMinimum.Value @@ -290,7 +290,7 @@ Dim oModel as Object ' Store entered values in variables OldNumber = oModel.txtOldRate.Value NewNumber = oModel.txtNewRate.Value - SplitDate = CDateFromISO(oModel.txtDate.Date) + SplitDate = CDateFromUNODate(oModel.txtDate.Date) iRow = SBROWFIRSTTRANSACT2 NoteText = cSplit & SplitDate & ", " & oModel.txtOldRate.Value & oModel.lblColon.Label & oModel.txtNewRate.Value Do @@ -398,8 +398,8 @@ End Sub Sub SetupTransactionControls(CurStep as Integer) DlgReference = DlgTransaction With TransactModel - .txtDate.Date = CDateToISO(Date()) - .txtDate.DateMax = CDateToISO(Date()) + .txtDate.Date = CDateToUNODate(Date()) + .txtDate.DateMax = CDateToUNODate(Date()) .txtStockID.Enabled = False .lblStockID.Enabled = False .lblStockID.Label = sCurStockIDLabel @@ -504,12 +504,12 @@ Sub InitializeStockRatesControls(CurStep as Integer) Case 2 .txtOldRate.Value = 1 .txtNewRate.Value = 1 - .txtDate.Date = CDateToISO(Date()) + .txtDate.Date = CDateToUNODate(Date()) Case 3 - .txtStartDate.DateMax = CDateToISO(CDate(Date())-1) - .txtEndDate.DateMax = CDateToISO(CDate(Date())-1) - .txtStartDate.Date = CDateToISO(CDate(Date())-8) - .txtEndDate.Date = CDateToISO(CDate(Date())-1) + .txtStartDate.DateMax = CDateToUNODate(CDate(Date())-1) + .txtEndDate.DateMax = CDateToUNODate(CDate(Date())-1) + .txtStartDate.Date = CDateToUNODate(CDate(Date())-8) + .txtEndDate.Date = CDateToUNODate(CDate(Date())-1) .optDaily.State = 1 End Select End With diff --git a/wizards/source/depot/Internet.xba b/wizards/source/depot/Internet.xba index 3e57f0a7b7c8..b4bcf579b808 100644 --- a/wizards/source/depot/Internet.xba +++ b/wizards/source/depot/Internet.xba @@ -25,8 +25,8 @@ Function CheckHistoryControls() Dim bLocGoOn as Boolean Dim Firstdate as Date Dim LastDate as Date - LastDate = CDateFromISO(StockRatesModel.txtEndDate.Date) - FirstDate = CDateFromISO(StockRatesModel.txtStartDate.Date) + LastDate = CDateFromUNODate(StockRatesModel.txtEndDate.Date) + FirstDate = CDateFromUNODate(StockRatesModel.txtStartDate.Date) bLocGoOn = FirstDate <> 0 And LastDate <> 0 If bLocGoOn Then If FirstDate >= LastDate Then @@ -47,8 +47,8 @@ Dim oCell as Object Dim sStockID as String Dim ChartSource as String If CheckHistoryControls() Then - StartDate = CDateFromISO(StockRatesModel.txtStartDate.Date) - EndDate = CDateFromISO(StockRatesModel.txtEndDate.Date) + StartDate = CDateFromUNODate(StockRatesModel.txtStartDate.Date) + EndDate = CDateFromUNODate(StockRatesModel.txtEndDate.Date) DlgStockRates.EndExecute() If StockRatesModel.optDaily.State = 1 Then sInterval = "d" |