";
$trailing_color="";
}
}
}
}
$date = date_format($date, 'm-d');
$return = "{$leading_color} {$date} {$trailing_color}";
return $return;
}
function show_clients_on_retainer() {
global $wpdb;
$db = new time_sheets_db();
$sql = "select ClientName, im.MonthlyHours, im.HourlyRate, im.Notes
from {$wpdb->prefix}timesheet_clients tc
inner join {$wpdb->prefix}timesheet_recurring_invoices_monthly im on tc.clientid = im.client_id
where im.MonthlyHours <> 0
order by ClientName";
$clients = $db->get_results($sql);
if ($clients) {
echo "
| Client Name | Number of Hours | Hourly Rate on Retainer | Notes |
";
foreach ($clients as $client) {
echo "| {$client->ClientName} | {$client->MonthlyHours} | $ {$client->HourlyRate} | |
";
}
echo "
";
}
$sql = "select ClientName, im.MonthlyHours, im.HourlyRate, im.Notes
from {$wpdb->prefix}timesheet_clients tc
inner join {$wpdb->prefix}timesheet_recurring_invoices_monthly im on tc.clientid = im.client_id
where im.MonthlyHours = 0
order by ClientName";
$clients = $db->get_results($sql);
if ($clients) {
echo "
| Client Name | Notes |
";
foreach ($clients as $client) {
echo "| {$client->ClientName} | |
";
}
echo "
";
}
$sql = "select ClientName, ProjectName, p.notes
from {$wpdb->prefix}timesheet_client_projects p
join {$wpdb->prefix}timesheet_clients c on p.ClientId = c.ClientId
where p.notes <> '' and p.Active = 1
order by ClientName, ProjectName";
$clients = $db->get_results($sql);
if ($clients) {
echo "
| Client Name | Project Name | Notes |
";
foreach ($clients as $client) {
echo "| {$client->ClientName} | {$client->ProjectName} | |
";
}
echo "
";
}
}
function is_match($v1, $v2, $return, $debug=0) {
if ($debug==1) {
var_dump($v1);
var_dump($v2);
}
if (trim($v1)==trim($v2)) {
return $return;
} else {
return "";
}
}
function replace($search, $replace, $value) {
return str_replace($search, $replace, $value);
}
function f_date($date) {
$options = get_option('time_sheets');
if ($options['override_date_format'] == 'system_defined') {
$date_format = get_option('date_format');
} else {
$date_format = $options['new_date_format'];
if ($options['user_specific_date_format']) {
if (get_user_option('user_date_format', $user_id)) {
$date_format = get_user_option('user_date_format', $user_id);
}
}
}
return date_i18n($date_format, strtotime($date));
}
function mysql_date($date) {
return date("Y-m-d", strtotime($date));
}
function send_email ($to, $subject, $body) {
global $wpdb;
$options = get_option('time_sheets');
$db = new time_sheets_db();
if($options['enable_email']) {
$sql = "insert into {$wpdb->prefix}timesheet_emailqueue
(send_to, send_from_email, send_from_name, subject, message_body, entered_on)
values (%s, %s, %s, %s, %s, now())";
$parms = array($to, $options['email_from'], $options['email_name'], $subject, $body);
$db->query($sql, $parms);
if ($options['show_email_notice']) {
echo "";
}
}
}
function remove_br($string) {
$string = str_replace("\'", "'", $string);
return nl2br($string);
}
function enqueue_js() {
wp_enqueue_script ("jquery", '', array(), "1.11.0", false);
wp_enqueue_script ("polyfiller", plugins_url( 'js/minified/polyfiller.js' , __FILE__), array(), false, false);
#wp_enqueue_script ("polyfiller", "//afarkas.github.io/webshim/js-webshim/minified/polyfiller.js", array(), "");
}
function show_datestuff() {
?>