Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added from/to dates in Analytics -> Employees Leaves Summary #306

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions application/modules/default/controllers/ReportsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2031,6 +2031,7 @@ public function leavesreportAction()
$department = $this->_request->getParam('department');
$leavestatus = $this->_request->getParam('leavestatus');
$from_date = $this->_request->getParam('from_date');
$to_date = $this->_request->getParam('to_date');
$pageno = $this->_request->getParam('pageno',1);
$perpage = intval($this->_request->getParam('perpage',PERPAGE));
if($perpage == 0)
Expand Down Expand Up @@ -2060,11 +2061,16 @@ public function leavesreportAction()
if($from_date !='')
{
$from_date = sapp_Global::change_date($from_date,'database');
$searchQuery .= 'DATE(l.createddate) = "'.$from_date.'" AND ';
$searchQuery .= 'DATE(l.from_date) >= "'.$from_date.'" AND ';
}
if($to_date !='')
{
$to_date = sapp_Global::change_date($to_date,'database');
$searchQuery .= 'DATE(l.to_date) <= "'.$to_date.'" AND ';
}
$searchQuery = rtrim($searchQuery," AND");

$leavestatusArr = $reportsmodel->getEmpLeaveHistory($sortby, $by,$pageno,$perpage,$searchQuery);
$leavestatusArr = $reportsmodel->getEmpLeaveHistory($sortby, $by,$pageno,$perpage,$searchQuery);
$leavestatusCount = $reportsmodel->getEmpLeaveHistoryCount($searchQuery);
$departmentlistArr = $departmentsmodel->getDepartmentWithCodeList();

Expand Down Expand Up @@ -2365,7 +2371,7 @@ public function getexcelreportleavesAction()
$searchQuery .= 'DATE(l.createddate) = "'.$from_date.'" AND ';
}
$searchQuery = rtrim($searchQuery," AND");
$leavestatusArr = $reportsmodel->getEmpLeaveHistory($sort_name, $sort_type,$page_no,$per_page,$searchQuery);
$leavestatusArr = $reportsmodel->getEmpLeaveHistory($sort_name, $sort_type,$page_no,$per_page,$searchQuery);

$emp_arr = $leavestatusArr;
require_once 'Classes/PHPExcel.php';
Expand Down
18 changes: 12 additions & 6 deletions application/modules/default/forms/leavereport.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,28 @@ public function init()
'3'=>'Rejected',
'4'=>'Cancel',
));
$leavestatus->setRegisterInArrayValidator(false);

$leavestatus->setRegisterInArrayValidator(false);
$from_date = new ZendX_JQuery_Form_Element_DatePicker('from_date');
$from_date->setLabel('Applied Date');
$from_date->setLabel('From Date');
$from_date->setAttrib('readonly', 'true');
$from_date->setAttrib('onfocus', 'this.blur()');
$from_date->setOptions(array('class' => 'brdr_none'));
$from_date->setOptions(array('class' => 'brdr_none'));

$to_date = new ZendX_JQuery_Form_Element_DatePicker('to_date');
$to_date->setLabel('To Date');
$to_date->setAttrib('readonly', 'true');
$to_date->setAttrib('onfocus', 'this.blur()');
$to_date->setOptions(array('class' => 'brdr_none'));

$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setLabel('Save');

$this->addElements(array($id,$employeename,$department,$leavestatus,$from_date,$submit));
$this->addElements(array($id,$employeename,$department,$leavestatus,$from_date,$to_date,$submit));
$this->setElementDecorators(array('ViewHelper'));
$this->setElementDecorators(array(
'UiWidgetElement',
),array('from_date'));
),array('from_date','to_date'));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
from_date = $('#from_date').val();
if(from_date !='')
$('#from_dateclear').show();
to_date = $('#to_date').val();
if(to_date !='')
$('#to_dateclear').show();
}else{
if($('#employeenameclear').is(':visible'))
{
Expand All @@ -84,6 +87,10 @@
{
$('#from_date').val(from_date);
}
if($('#to_dateclear').is(':visible'))
{
$('#to_date').val(to_date);
}

}

Expand All @@ -101,7 +108,7 @@
$.ajax({
url: base_url+"/reports/leavesreport/format/html",
type : 'POST',
data : 'employeename='+hiddenempname+'&department='+department+'&leavestatus='+leavestatus+'&from_date='+from_date+'&pageno='+pageno+'&perpage='+perpage+'&sortby='+sortby+'&by='+by+'&columnsortby='+columnsortby+'&columnby='+columnby+'&checkedheaders='+checkedheaders,
data : 'employeename='+hiddenempname+'&department='+department+'&leavestatus='+leavestatus+'&from_date='+from_date+'&to_date='+to_date+'&pageno='+pageno+'&perpage='+perpage+'&sortby='+sortby+'&by='+by+'&columnsortby='+columnsortby+'&columnby='+columnby+'&checkedheaders='+checkedheaders,
dataType: 'html',
beforeSend: function () {
$.blockUI({ width:'50px',message: $("#spinner").html() });
Expand Down Expand Up @@ -162,6 +169,10 @@
if($('#from_date').val() !=''){
from_date= '';
$('#from_date').val('');
}
if($('#to_date').val() !=''){
to_date= '';
$('#to_date').val('');
}
/* Start Make all hidden variables to default */
$('#perpagetext').val('20');
Expand Down Expand Up @@ -363,6 +374,15 @@ echo $this->reportsheader('leavesreport');
</div>
</div>

<div class="new-form-ui">
<label><?php echo $this->form->to_date->getLabel(); ?></label>
<button type="button" id="to_dateclear" name="todateclear" class="inputclear" style="display:none;" onclick="clearsearchvalues('to_dateclear')">Clear</button>
<div class="division"><?php echo $this->form->to_date; ?>
<span id="errors-<?php echo $this->form->to_date->getId(); ?>" class="errors">
<?php echo isset($this->msgarray['to_date'])?$this->msgarray['to_date']:"";?>
</span>
</div>
</div>


<div class="new-form-ui-submit mrgetop5">
Expand Down Expand Up @@ -408,7 +428,7 @@ $(document).ready(function(){
displayleavereportsajax('');
$('#perpage').val('<?php echo $this->perpage; ?>');

if(employeename !='' || department!='' || leavestatus!='' || from_date!='')
if(employeename !='' || department!='' || leavestatus!='' || from_date!='' || to_date!='')
clearleavestatus();

$('#employeename').autocomplete({
Expand Down Expand Up @@ -447,6 +467,21 @@ return $( "<li>" )
//maxDate: new Date,


dateFormat:"<?php echo DATEFORMAT_JS;?>",
buttonImage: "<?php echo $this->baseUrl("public/media/images/cal.jpg");?>",
buttonImageOnly: true,
buttonText: "",
changeMonth: true,
changeYear: true,
showButtonPanel: true

});

$('#to_date').datepicker({
showOn:'both',
//maxDate: new Date,


dateFormat:"<?php echo DATEFORMAT_JS;?>",
buttonImage: "<?php echo $this->baseUrl("public/media/images/cal.jpg");?>",
buttonImageOnly: true,
Expand Down