How can I make a custom alias with time between two dates using Grails criteriaFunctionality - sql

I am looking to use the withCriteria functionality on a Domain class with two dates, and want to project the time between the dates as a separate variable then return the average of this new variable.
What would be the best way to do this?

Related

PrimeVue 2 - Calendar - :date-select dosen't work properly - Vue.js2

I have two different calendars and I want to use the ':date-select' function on only one of them.
However, when I select a date on the calendar that doesn't have ':date-select', the 'validarDatas()' function is called for some reason.
Can someone help me with this?
Primevue2
Vue.js2
I have tried using different IDs and functions on both calendars, but when I select only one date, both functions are called.

How do you get the ticket created date in trac?

I want to play with some really simple queries for a report, but I want to group everything by the creation date. The problem I am having is that time exists in the database, but not the date. From searching around in trac-related resources, it looks like I need to install trac.util.datefmt to be able to extract this information from datetime(time). I can find the API documentation for trac.util.datefmt, but not a download link to get the .egg.
Am I going in the right direction? If I can do what I need (i.e. get the creation month/day/year) without a plugin, what column do I use? I don't see anything else in the schema that is reasonable. If I do need trac.util.datefmt, where do I download it from? And if I really need a different plugin, which one should I be using?
I'll assume Trac >= 1.0. The time column is unix epoch time: the number of seconds that have elapsed since January 1st 1970. You can divide the value by 1e6 and put the value in a converter to see an example of extracting the datetime from the time column. trac.util.datefmt is part of the egg that ships with Trac, but since you are working with reports it doesn't sound like you need to know more about that function to accomplish your aim.
In a Trac report the time column will be automatically formatted as a date. You can look at the default report {1} as an example. I'm not sure how you intend to group by creation date. Do you wish to group tickets created in a certain datetime range?

Creating TIme Dimension in BusinessObjects

Is it possible to create a time dimension with values inside the BusinessObjects.
If yes, please explain how?
Have a look at this site by Gino Scheppers. Gino created a generic time dimension framework that can be implemented in a BusinessObjects universe, aptly named the Ultimate Generic Date/Time Framework.
If you're using a recent version of BusinessObjects and Web Intelligence as a frontend, the TimeDim() function may also be of use to you. From the user guide:
The TimeDim time dimension allows you to build a time axis from a date
type universe object. TimeDim returns the data for the dates given as
the first parameter over the time periods given as the second
parameter.

openerp payroll (using previous payslips data)

I want to calculate Holiday payment using OpenERP payroll. I managed to successfully configure Salaries calculations depending on my needs, but I'm stuck at using previous payslips data into new one).
What I want to do is calculate Holidays payments, which requires to use previous three months gross (or bruto) salary and worked days (at those three months) and get average $/day for these three months. Then I could use this parameter to calculate how much money employee should get money for his holidays.
I just don't find a way to use such data, because all data is being used at present payslip (like rules, categories, inputs).
Does anyone know how to do it?
Thanks
Salary Rules using python expression have available a payslip object.
This object has sum method:
def sum(self, code, from_date, to_date=None)
Probably you can write a rule containing something like:
payslip.sum('GROSS', a_start_date, a_end_date)
You'll need to add expression to calculate your star and end dates, but I'm not sure if you the datetime and timedelta objects are available in the evaluated expression...
Great to hear that you have right configuration of the Payroll, as the Payroll Engine is quite a strong and technical, but regarding your holiday payment it is purely a customization the generic implementation does not come with the any special feature like this,
But If you want o make it part of the salary slip yes you can always some complex Head with Python Code which can calculate your requirement. you have variable like :
# employee: hr.employee object
# rules: object containing the rules code (previously computed)
**# worked_days: object containing the computed worked days.**
# inputs: object containing the computed inputs.
Hope this will help thanks

How to handle reoccurring calendar events and tasks (SQL Server tables & C#)

I need to scheduled events, tasks, appointments, etc. in my DB. Some of them will be one time appointments, and some will be reoccurring "To-Dos" which must be checked off. After looking a google's calendar layout and others, plus doing a lot of reading here is what I have so far.
Calendar table (Could be called schedule table I guess): Basic_Event Title, start/end, reoccurs info.
Calendar occurrence table: ties to schedule table, occurrence specific text, next occurrence date / time????
Looked here at how SQL Server does its jobs: http://technet.microsoft.com/en-us/library/ms178644.aspx
but this is slightly different.
Why two tables: I need to track status of each instance of the reoccurring task. Otherwise this would be much simpler...
so... on to the questions:
1) Does this seem like the proper way to go about it? Is there a better way to handle the multiple occurrence issue?
2) How often / how should I trigger creation of the occurrences? I really don't want to create a bunch of occurrences... BUT... What if the user wants to view next year's calendar...
Makes sense to have your schedule definition for a task in one table and then a separate table to record each instance of that separately - that's the approach I've taken in the past.
And with regards to creating the occurrences, there's probably no need to create them all up front. Especially when you consider tasks that repeat indefinitely! Again, the approach I've used in the past is to only create the next occurrence. When that instance is actioned, the next instance is then calculated and created.
This leaves the issue of viewing future occurrences. For this, you can start of with the initial/next scheduled occurrence and just calculate the future occurrences on-the-fly at display time.
While this isn't an exact answer to your question I've solved this problem before in SQL Server (though database here is irrelevant) by modeling a solution based on Unix's cron.
Instead of string parsing we used integer columns in a table to store the various time units.
We had events which could be scheduled; they could either point to a one-time schedule table that represented a distinct point in time (a date/time) or to the recurring schedule table which is modelled after cron.
Additionally remember to model your solution correctly. An event has a duration but the duration is unrelated to the schedule (but an event's duration may impact the schedule by causing conflicts). Do not try to model duration as part of your schedule.
In the past when we've done this, we had 2 tables:
1) Schedules -> Includes recurrence information
2) Exceptions -> Edit/changes to specific instances
Using SQL, it's possible to get the list of "Schedules" that have at least one instance in a given date range. Then you can expand in the GUI where each instance lies.