<?php
include('../headertop.php');
include('../db.php');


$disp = '';
$pagetitle = 'Office Management Dashboard';

$qinv = "select sum(amount) as total_investments from investments";
$qexp = "select sum(amount) as total_expenses from expenses";

$resinv = mysqli_query($dbcon,$qinv) or die(mysqli_error($dbcon));
$resexp = mysqli_query($dbcon,$qexp) or die(mysqli_error($dbcon));

$rowinv = mysqli_fetch_array($resinv);
$rowexp = mysqli_fetch_array($resexp);

/*
$date = date('Y-m-d'); 
$year = date("Y",strtotime($date));
$month = date("m", strtotime($date));
$time = date("h: i: s a");

$qic = "select sum(ic_amount) as totalic, monthname(doc) as month from incoming_cash where year(doc)='$year' and month(doc)='$month'";
$qexp = "select sum(expense_amount) as totalexp,monthname(doe) as month from expenses where year(doe) = '$year' and month(doe)='$month'";

$qic2 = "select sum(ic_amount) as totalic from incoming_cash where doc='$date'";
$qexp2 = "select sum(expense_amount) as totalexp from expenses where doe = '$date'";

$ric = mysqli_query($dbcon,$qic) or die(mysqli_error($dbcon));
$rexp = mysqli_query($dbcon,$qexp) or die(mysqli_error($dbcon));

$ric2 = mysqli_query($dbcon,$qic2) or die(mysqli_error($dbcon));
$rexp2 = mysqli_query($dbcon,$qexp2) or die(mysqli_error($dbcon));

$rwic = mysqli_fetch_array($ric);
$rwexp = mysqli_fetch_array($rexp);

$rwic2 = mysqli_fetch_array($ric2);
$rwexp2 = mysqli_fetch_array($rexp2);
*/

if(isset($_REQUEST['sm']))
$disp .= '<div class="smdiv">'.$_REQUEST['sm'].'</div>';


$disp .= '     
<div class="row"><h2 style="background-color:orange;padding:5px;text-align:center;width:50%;margin:auto;"><a href="backup2.php">Take Backup of Data</a></h2></div>				
<br>
<div class="row">
                <div class="col-md-2 col-sm-3 col-xs-4">           
			 <div class="panel panel-primary text-center no-boder bg-color-red">
                        <div class="panel-body">
                            <i class="fa fa-edit fa-5x"></i>
                            <h3>Add Expenses </h3><br>
                        </div>
                        <div class="panel-footer" style="margin-top:12px">
                            <br><a href="../accounting/addexpense.php">Click here for more information</a>
                            
                        </div>
                    </div>                         
                        </div>';
						
				
$disp .='   
                <div class="col-md-2 col-sm-3 col-xs-4">           
			 <div class="panel panel-primary text-center no-boder bg-color-red">
                        <div class="panel-body">
                            <i class="fa fa-edit fa-5x"></i>
                            <h3>View Expenses </h3><br>
                        </div>
                        <div class="panel-footer" style="margin-top:12px">
                           <br><a href="../accounting/dailyexpense.php">Click here for more information</a>
                            
                        </div>
                    </div>                         
                        </div>';
			
$disp .= '
                    <div class="col-md-6 col-sm-6 col-xs-6">           
			<div class="panel panel-primary text-center no-boder bg-color-red">
                        <div class="panel-body">
						        <i class="fa fa-edit fa-5x"></i>
                <ul style="list-style:none">
				<li style="background-color:black"><span style="font-size:1.7em">Total Investments = '.$rowinv['total_investments'].'</span></li><br>
				<li style="background-color:orange"><span style="font-size:1.7em">Total Expenses = '.$rowexp['total_expenses'].'</span></li><Br><hr>
				<li style="background-color:green"><span style="font-size:1.7em">Difference = '.($rowinv['total_investments'] - $rowexp['total_expenses']).'</span></li></ul></div>
            
					
										
                </div>
             </div>
		     </div>
                    
                    
                 
			
    </div>
                        
        </div>';
$disp .= '';			

include('../template.php');
			
			