Tag Archives: code

Parse Hrnet Date

Simple snippet for Custom Scripts: convert form HRNET date string into JavaScript format /** * Parce from string representind date in format “dd/mm/yyyy” into JavaScript Date format */ function parseDate(strDate){ var array = strDate.split(“/”); return new Date(array[2], array[1]-1, array[0], 0,0,0); … Continue reading

Posted in Uncategorized | Tagged , , , , | Leave a comment

Screen Validation

Many times I need to validate entries on the screen via JavaScript (or Custom Script, in terms of HR.Net). For about a year I struggled with validation via overloading function “Page_ClientValidate“. But when you overload this function, you can’t run … Continue reading

Posted in Uncategorized | Tagged , , , , , | 3 Comments

Table definitions

For those of you wanting to know where HRNET stores meta information about tables and table-fields: look into oc_fileddefs for field definitions – type of data, validation, etc. For field captions and descriptions go to oc_filedlanguages.

Posted in Uncategorized | Tagged , , | Leave a comment

PHP Error: unable to get Memo fields from HRNET

When I was doing select statement from HRNET database, one of the problems was that I got error looking like this: warning: mssql_query() [function.mssql-query]: message: Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

Regexp to validate MS SQL uniqueidentifier

I’m working on PHP project that interacts with HRNET and at some point I need to validate if given string is valid mssql guid. For this I use php regular expression: ^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$

Posted in Uncategorized | Tagged , , | 2 Comments

More JavaScript snippets

To open help screen: ShowHelp(); Returns true or false depending if the form validates or not. IsPageValid(); To switch screen into attached documents, print this setTimeout(“ShowAttachedDocs()”,0); if you print only ShowAttachedDocs() – this will give you an error when you … Continue reading

Posted in Uncategorized | Tagged , , , | 1 Comment

Find End of a Day for Given Date

Determines the last second for the day for the given date CREATE FUNCTION [dbo].[EndOfDay] ( @DATE DATETIME ) RETURNS DATETIME AS BEGIN RETURN DATEADD(s,-1,DATEADD(d, DATEDIFF(d,0,@DATE)+1,0)) END

Posted in Uncategorized | Tagged , , , | Leave a comment

Find Start of a Year for Given Date

Finds out a start of the year for the given date. CREATE FUNCTION [dbo].[StartOfYear] ( @DATE DATETIME ) RETURNS DATETIME AS BEGIN RETURN DATEADD(yy, DATEDIFF(yy,0,@DATE),0) END

Posted in Uncategorized | Tagged , , , | Leave a comment

Find Start of a Month for Given Date

Finds Start of the month with given date CREATE FUNCTION [dbo].[StartOfMonth] ( @date datetime ) RETURNS datetime AS BEGIN return DATEADD(M,-1,DATEADD(mm, DATEDIFF(m,0,@date)+1,0)) END

Posted in Uncategorized | Tagged , , , | 2 Comments

End of Month for Given Date

Finds end of the month with given date Create FUNCTION [dbo].[EndOfMonth] ( @date datetime ) RETURNS datetime AS BEGIN return DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,@date)+1,0)) END

Posted in Uncategorized | Tagged , , , | Leave a comment