<?php

class dashlet_customer {
	
	function show() {
		global $app, $conf;
		
		//* Loading Template
		$app->uses('tpl');
		
		$tpl = new tpl;
		$tpl->newTemplate("dashlets/templates/customer.htm");
		
		$wb = array();
		$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_dashlet_customer.lng';
		if(is_file($lng_file)) include($lng_file);
		$lng_file = '../billing/lib/lang/'.$_SESSION['s']['language'].'_dashboard_client.lng';
		if(is_file($lng_file)) include($lng_file);
		$tpl->setVar($wb);
		
		$group_rec = $app->db->queryOneRecord('SELECT client_id FROM sys_group WHERE groupid = '.$_SESSION['s']['user']['default_group']);
		$client_id = $group_rec['client_id'];
		
		if($client_id > 0) {
			$customer = $app->db->queryOneRecord("SELECT * FROM client WHERE client_id = $client_id");
			if(is_array($customer) && !empty($customer)) {
				$tpl->setVar($customer);
			}
			
		}

		//$tpl->setVar('has_invoices',$has_invoices);
		
		if($app->auth->is_admin()) {
			return '';
		} else {
			return $tpl->grab();
		}
		
		
	}
}








?>