ok

Mini Shell

Direktori : /home2/selectio/public_html/lilyexpresslive/expense-invoice/
Upload File :
Current File : /home2/selectio/public_html/lilyexpresslive/expense-invoice/index-1.php

<?php  include "header.php";?>
<div class="content-wrapper">
        <section class="content-header">
            <h1>Dashboard</h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
                <li class="active">Dashboard</li>            </ol>
        </section>        

<!--SELECT sum(amount) as total_cash,(select sum(amount) from tbl_expense) as total_expense,sum(amount)-(select sum(amount) from tbl_expense) as total_balance FROM `tbl_cash`-->
<!--SELECT sum(amount) as total_cash,(select sum(amount) from tbl_expense) as total_expense,sum(amount)-(select sum(amount) from tbl_expense) as total_balance 
,(select sum(amount) from tbl_expense where payment_method='Cash') as expense_cash
,(select sum(amount) from tbl_expense where payment_method!='Cash') as expense_online
,(select sum(amount) from tbl_cash where type=1) as cash_credit
,(select sum(amount) from tbl_cash where type!=1) as online_credit
FROM `tbl_cash`-->

<?php 

$conditions="";

$invoice_conditions="";
$vender_invoice_conditions="";

$start_date = $_GET['start_date'];
$end_date = $_GET['end_date'];
$invoice_financial_year = $_GET['invoice_financial_year'];

$expense_where='';
$cash_where='';
$invoice_payment_where='';
$vendor_invoice_payment_where ='';


if($start_date!="" && $end_date!=""){
	$conditions.=" and (cash_date BETWEEN '$start_date' AND '$end_date') ";
	$expense_where.=" and (expense_date BETWEEN '$start_date' AND '$end_date')";
	$cash_where.=" and (cash_date BETWEEN '$start_date' AND '$end_date')";
	$vender_invoice_conditions.=" and (date BETWEEN '$start_date' AND '$end_date')";
	$vendor_invoice_payment_where.=" and (paid_date BETWEEN '$start_date' AND '$end_date')";
}

if($start_date!="" && $end_date!=""){
	$invoice_conditions.=" and (date BETWEEN '$start_date' AND '$end_date') ";
	$invoice_payment_where.=" and (paid_date BETWEEN '$start_date' AND '$end_date') ";
}


if($invoice_financial_year!="0" ){
	$invoice_conditions.=" and year='$invoice_financial_year'";
	$vender_invoice_conditions.=" and year='$invoice_financial_year'";
}


    $statement = $pdo->prepare("SELECT COALESCE(SUM(amount),0) as total_cash
,(select COALESCE(SUM(amount),0) from tbl_expense where 1=1 $expense_where) as total_expense,COALESCE(SUM(amount),0)-(select COALESCE(SUM(amount),0) from tbl_expense where 1=1 $expense_where) as total_balance 
,(select COALESCE(SUM(amount),0) from tbl_expense where payment_method='Cash' $expense_where) as expense_cash
,(select COALESCE(SUM(amount),0) from tbl_expense where payment_method!='Cash' $expense_where) as expense_online
,(select COALESCE(SUM(amount),0) from tbl_cash where type=1 $cash_where) as cash_credit
,(select COALESCE(SUM(amount),0) from tbl_cash where type!=1 $cash_where) as online_credit
FROM `tbl_cash` where 1=1".$conditions);
    $statement->execute();
    $home_expense_data = $statement->fetchAll(PDO::FETCH_ASSOC);
    
    $statement = $pdo->prepare("SELECT sum(final_amount) as total,
    (select sum(amount) from tbl_invoice_payment WHERE type=1) as paid,
    (select sum(amount) from tbl_invoice_payment WHERE type=2) as reduction 
    
    FROM `tbl_invoice` where 1=1".$invoice_conditions);
    $statement->execute();
    $home_invoice_data = $statement->fetchAll(PDO::FETCH_ASSOC);
    
     $statement = $pdo->prepare("SELECT sum(final_amount) as total,(select sum(amount) from tbl_vendor_invoice_payment WHERE type=1 $vendor_invoice_payment_where) as paid,
     (select sum(amount) from tbl_vendor_invoice_payment WHERE type=2 $vendor_invoice_payment_where) as reduction FROM `tbl_vendor_invoice` where 1=1".$vender_invoice_conditions);
    $statement->execute();
    $home_vendor_invoice_data = $statement->fetchAll(PDO::FETCH_ASSOC);
?>

        <div class="box-body">
                            <form method="GET" action="index-1.php">
                               <div class="row">
                                 <div class="col-md-3">
                                    <div class="form-group">
                                        <label class="required" for="location">Financial  Year</label>                                   
                                         <select name="invoice_financial_year" class="form-control select2" id="invoice_financial_year" data-placeholder="Payment Method" style="width:100%;">
                                            <option value="0">All Year</option>
                                            <?php for($y=2020;$y<2035;$y++){ $f_y=$y."-".($y+1-2000);?>
                                            <option value="<?=$f_y?>"><?=$f_y?></option>
                                            <?php } ?>
                                        </select>
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label for="location">Start Date</label>                                   
                                         <input type="date" name="start_date"  class="form-control tip" id="start_date"/>
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label for="location">End Date</label>                                   
                                         <input type="date" name="end_date"  class="form-control tip" id="end_date"/>
                                    </div>
                                </div>
                                <div class="col-md-3">
                                    <div class="form-group">
                                        <label for="location">Action</label><br>                                
                                         <button type="submit" class="btn btn-primary">Filter</button>
                                    </div>
                                </div>
                                
                            </div>
                            </form>
            
                    <?php if($allPermissions['expense']['read']=="1"){ ?> <div class="col-sm-6" style="padding:2px;">
                            
                            <center><b style="font-size:20px;">Expense Details</b></center>
                             <div class="col-sm-12" style="border: 2px solid cyan;padding: 5px;border-radius: 10px">
                                 <!--<center><b style="font-size:18px;">Today</b></center>-->
                                <a href="cash.php?start_date=<?=$_GET['start_date']?>&end_date=<?=$_GET['end_date']?>"><div class="col-sm-4 col-xl-3" >
                                    <div style="background-color: #26195a;padding:2px;text-align:center;font-size:16px;color:white;font-weight:900;border-radius: 5px;">
                                    ₹  <?=number_format((float)$home_expense_data[0]['total_cash'], 2, '.', '');?><br>
                                    Total Credit Amt
                                    </div>
                                    <!--<b>Cash Credit &nbsp;&nbsp;: 1500.00<br>
                                    Card Credit &nbsp;&nbsp;: 1500.00<br>
                                    UPI Transfer : 1500.00<br>
                                    Acc Transfer  : 1500.00</b>-->
                                </div></a>
                                
                               <a href="expense.php?start_date=<?=$_GET['start_date']?>&end_date=<?=$_GET['end_date']?>"> <div class="col-sm-4 col-xl-3" >
                                    <div style="background-color: #971c55;padding:2px;text-align:center;font-size:16px;color:white;font-weight:900;border-radius: 5px;">
                                    ₹  <?=number_format((float)$home_expense_data[0]['total_expense'], 2, '.', '');?><br>
                                    Total Expense
                                    </div>
                                    <!-- <b>Cash Credit &nbsp;&nbsp;: 1500.00<br>
                                    Card Credit &nbsp;&nbsp;: 1500.00<br>
                                    UPI Transfer : 1500.00<br>
                                    Acc Transfer  : 1500.00</b>-->
                                </div></a>
                                
                                <div class="col-sm-4 col-xl-3" >
                                    <div style="background-color: #f67529;padding:2px;text-align:center;font-size:16px;color:white;font-weight:900;border-radius: 5px;">
                                    ₹  <?=number_format((float)$home_expense_data[0]['total_balance'], 2, '.', '');?><br>
                                    Total Balance
                                    </div>
                                    
                                </div>
                                <div class="col-sm-12 col-xl-12" style="margin-top:5px;">
                                    <div style="background-color: #782e2e;padding:2px;text-align:center;font-size:16px;color:white;font-weight:900;border-radius: 5px;">
                                    <b>Cash Balance &nbsp;&nbsp;: ₹ <?=number_format((float)$home_expense_data[0]['cash_credit']-$home_expense_data[0]['expense_cash'], 2, '.', '');?><br>
                                    Acc Balance &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;: ₹ <?=number_format((float)$home_expense_data[0]['online_credit']-$home_expense_data[0]['expense_online'], 2, '.', '');?>
                                    </b>
                                    </div>
                                    
                                </div>
                                 
                            </div>

                 </div><?php } ?>
                    <?php if($allPermissions['invoice']['read']=="1"){ ?>
                     <a href="invoice.php?start_date=<?=$_GET['start_date']?>&end_date=<?=$_GET['end_date']?>&financial_year=<?=$_GET['invoice_financial_year']?>">
                          <div class="col-sm-6" style="padding:2px;">
                      
                           <center><b style="font-size:20px;">Invoice Payment Deatils</b></center>
                             <div class="col-sm-12" style="border: 2px solid cyan;padding: 5px;border-radius: 10px">
                                 <!--<center><b style="font-size:18px;">This Month</b></center>-->
                                <div class="col-sm-6 col-xl-3" >
                                    <div style="background-color: #29b6f6;padding:2px;text-align:center;font-size:16px;color:white;font-weight:900;border-radius: 5px;">
                                    ₹  <?=number_format((float)$home_invoice_data[0]['total'], 2, '.', '');?><br>
                                    Total Amount
                                    </div>
                                </div>
                                
                                <div class="col-sm-6 col-xl-3" >
                                    <div style="background-color: #f62988;padding:2px;text-align:center;font-size:16px;color:white;font-weight:900;border-radius: 5px;">
                                    ₹  <?=number_format((float)$home_invoice_data[0]['paid'], 2, '.', '');?><br>
                                    Total Received
                                    </div>
                                </div>
                                
                                <div class="col-sm-6 col-xl-3" style="margin-top:5px;">
                                    <div style="background-color: #f67529;padding:2px;text-align:center;font-size:16px;color:white;font-weight:900;border-radius: 5px;">
                                    ₹  <?=number_format((float)($home_invoice_data[0]['total']-($home_invoice_data[0]['paid']+$home_invoice_data[0]['reduction'])), 2, '.', '');?><br>
                                    Total Balance
                                    </div>
                                </div>
                                <div class="col-sm-6 col-xl-3" style="margin-top:5px;">
                                    <div style="background-color: #483866;padding:2px;text-align:center;font-size:16px;color:white;font-weight:900;border-radius: 5px;">
                                    ₹  <?=number_format((float)$home_invoice_data[0]['reduction'], 2, '.', '');?><br>
                                    Total Reduction
                                    </div>
                                </div>
                            </div>
   
                        
                    </div>
                    
                    </a><?php } ?>
                    
                    <?php if($allPermissions['vendor_invoice']['read']=="1"){ ?>
                    <a href="vendor-invoice.php?start_date=<?=$_GET['start_date']?>&end_date=<?=$_GET['end_date']?>&financial_year=<?=$_GET['invoice_financial_year']?>"><div class="col-sm-6" style="padding:2px;">
                      
                           <center><b style="font-size:20px;">Vendor Invoice Payment Deatils</b></center>
                             <div class="col-sm-12" style="border: 2px solid cyan;padding: 5px;border-radius: 10px">
                                 <!--<center><b style="font-size:18px;">This Month</b></center>-->
                                <div class="col-sm-6 col-xl-3" >
                                    <div style="background-color: #29b6f6;padding:2px;text-align:center;font-size:16px;color:white;font-weight:900;border-radius: 5px;">
                                    ₹  <?=number_format((float)$home_vendor_invoice_data[0]['total'], 2, '.', '');?><br>
                                    Total Amount
                                    </div>
                                </div>
                                
                                <div class="col-sm-6 col-xl-3" >
                                    <div style="background-color: #f62988;padding:2px;text-align:center;font-size:16px;color:white;font-weight:900;border-radius: 5px;">
                                    ₹  <?=number_format((float)$home_vendor_invoice_data[0]['paid'], 2, '.', '');?><br>
                                    Total Paid
                                    </div>
                                </div>
                                
                                <div class="col-sm-6 col-xl-3" style="margin-top:5px;">
                                    <div style="background-color: #f67529;padding:2px;text-align:center;font-size:16px;color:white;font-weight:900;border-radius: 5px;">
                                    ₹  <?=number_format((float)($home_vendor_invoice_data[0]['total']-($home_vendor_invoice_data[0]['paid']+$home_vendor_invoice_data[0]['reduction'])), 2, '.', '');?><br>
                                    Total Balance
                                    </div>
                                </div>
                                <div class="col-sm-6 col-xl-3" style="margin-top:5px;">
                                    <div style="background-color: #483866;padding:2px;text-align:center;font-size:16px;color:white;font-weight:900;border-radius: 5px;">
                                    ₹  <?=number_format((float)$home_vendor_invoice_data[0]['reduction'], 2, '.', '');?><br>
                                    Total Reduction
                                    </div>
                                </div>
                            </div>
   
                     </a>  
                    </div><?php } ?>
               
       </div>
        

<?php include "footer.php";?>

Zerion Mini Shell 1.0