<?php

/* $Id: SelectCustomer.php 7133 2015-02-07 03:23:51Z daintree $*/

include('../includes/session.inc');
$Title = _('Pay Runs');
$ViewTopic= 'Pay Runs';
$BookMark = 'Pay Runs';
include('../includes/header.inc');


include('../includes/SQL_CommonFunctions.inc');
echo '<link href="' . $RootPath . '/css/evergreen2'.'/default.css" rel="stylesheet" type="text/css" media="screen"/>';


//echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/maintenance.png"> </p>';
      
	echo '<div class="col-sm-9">';
	
    include('../xcrud/xcrud.php');
    $ebusiness = Xcrud::get_instance();
	$ebusiness->table('payruns');
	
	$ebusiness->order_by('pay_no','desc');
	$ebusiness->disabled('total_payouts,entered_by,last_update,approved_by');
    $ebusiness->default_tab('Pay Run Profile');
$ebusiness->change_type('pay_cycle','select','Weekly','Weekly,Fortnightly,Monthly');
$ebusiness->table_name('Pay Run Profile','ATM','icon-leaf');
   // $xcrud->button('JCAutoCreateCITInvoice.php?billing_id={billing_id}', 'Create Invoice','glyphicon glyphicon-list-alt');
 $ebusiness->change_type('status','select','draft','draft,approved,locked');
    $ebusiness->column_pattern('pay_no', '<a href="#" class="xcrud-action" data-task="view" data-primary="{pay_no}">{value}</a>');
//second level table configurations
	$ebusiness1 = $ebusiness->nested_table('Employees','pay_no','payrun_details','pay_no'); 
$ebusiness1->table_name('Employees in this Pay Run','ATM','icon-leaf');
$ebusiness1->disabled('pay_no,entered_by,last_update');
$ebusiness1->relation('employeeid','employeemaster','employeeid',array('first_name','middle_name','last_name','employeeid'));
	        $ebusiness1->button('PaySlips.php?id={id}&employeeid={employeeid}', 'Print Payslip','glyphicon glyphicon-download');
$ebusiness1->button('EmailPaySlips.php?id={id}&employeeid={employeeid}', 'Email Payslip','glyphicon glyphicon-envelope');
  $ebusiness->button('EmailPaySlips.php?pay_no={pay_no}', 'Post Payrun','glyphicon glyphicon-floppy-disk','',array('target'=>'_blank'));
$ebusiness->button('PaySlips.php?pay_no={pay_no}', 'Print All Payslip','glyphicon glyphicon-download');
$ebusiness->button('EmailPaySlips.php?pay_no={pay_no}', 'Email All Payslip','glyphicon glyphicon-envelope');
  $ebusiness->button('PaySlips.php?pay_no={pay_no}', 'Download EMS file','glyphicon glyphicon-download');
$ebusiness->button('EmailPaySlips.php?pay_no={pay_no}', 'Download FNPF file','glyphicon glyphicon-download');
$ebusiness->button('EmailPaySlips.php?pay_no={pay_no}', 'Download westpac file','glyphicon glyphicon-download');

 //$ebusiness1->modal('employeeid');
              //$pool->relation('employeeid','employeemaster','employeeid',array('first_name','last_name','employeeid'));
 $ebusiness->limit_list('20,50,100,1000'); // do not use 'all' for large tables
   //$ebusiness->benchmark();
$ebusiness1->limit_list('20,50,100,1000'); // do not use 'all' for large tables
  // $ebusiness1->benchmark();
$ebusiness1->load_view('list','PayRunList.php');


$userid = $_SESSION['UserID'];

$ebusiness->pass_var('entered_by',$userid );

$timenow = date('Y-m-d H:i:s');

	$ebusiness->pass_var('last_update',$timenow);

$ebusiness1->pass_var('entered_by',$userid );
$ebusiness1->pass_var('last_update',$timenow);
	echo $ebusiness->render();


?>
   
  

