Date Picker in Static Stats

English! place to talk about development, programming and coding
Post Reply
skullz
Znuny superhero
Posts: 618
Joined: 24 Feb 2012, 03:58
Znuny Version: LTS and Features
Real Name: Mo Azfar
Location: Kuala Lumpur, MY
Contact:

Date Picker in Static Stats

Post by skullz »

Hi,
How can i put Date picker (like in dynamic stats) in custom static stats ?
Currently, the date selection is based on dropdown
Capture.PNG

Code: Select all


    my $TimeObject = $Kernel::OM->Get('Kernel::System::Time');
  
	# get current time
    my ( $s, $m, $h, $D, $M, $Y ) = $TimeObject->SystemTime2Date(
        SystemTime => $TimeObject->SystemTime(),
    );
	
	# get current year
    my $SelectedYear  = $M == 1 ? $Y - 1 : $Y;
	# get one month before
    my $SelectedMonth = $M == 1 ? 12     : $M - 1;
	# get current month
	my $SelectedMonth2 = $M == 1 ? 12     : $M - 0;

    # create possible time selections
    my %Year = map { $_ => $_; } ( $Y - 10 .. $Y );
    my %Month = map { $_ => sprintf( "%02d", $_ ); } ( 1 .. 12 );
	my %ToMonth = map { $_ => sprintf( "%02d", $_ ); } ( 1 .. 12 );

my @Params = (
	
	{
            Frontend   => 'Year',
            Name       => 'Year',
            Multiple   => 0,
            Size       => 0,
            SelectedID => $SelectedYear,
            Data       => \%Year,
        },
        {
            Frontend   => 'From Month',
            Name       => 'Month',
            Multiple   => 0,
            Size       => 0,
            SelectedID => $SelectedMonth,
            Data       => \%Month,
        },
		{
            Frontend   => 'To Month',
            Name       => 'ToMonth',
            Multiple   => 0,
            Size       => 0,
            SelectedID => $SelectedMonth2,
            Data       => \%ToMonth,
        },
		
	###get selection field of type
		{
            Frontend   => 'Ticket Type',
            Name       => 'Ticket_Type',
            Multiple   => 1,
            Size       => 0,
            SelectedID => 1,
			Data       => \%Ticket_Type,
        },	

    );
    return @Params;
You do not have the required permissions to view the files attached to this post.
Post Reply