MMCT TEAM
Server IP : 2a02:4780:3:1493:0:3736:a38e:7  /  Your IP : 216.73.216.139
Web Server : LiteSpeed
System : Linux sg-nme-web1393.main-hosting.eu 4.18.0-553.40.1.lve.el8.x86_64 #1 SMP Wed Feb 12 18:54:57 UTC 2025 x86_64
User : u926327694 ( 926327694)
PHP Version : 7.4.33
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u926327694/domains/smsoft.in/public_html/demo/accounts/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u926327694/domains/smsoft.in/public_html/demo/accounts/balancesheet.php
<?php 

    // First we execute our common code to connection to the database and start the session 
    //  require("../common.php"); 
     session_start();
    // At the top of the page we check to see whether the user is logged in or not 
    if(!isset($_SESSION['user']) && !isset($_SESSION['Mng_User'])) 
    { 
        // If they are not, we redirect them to the login page. 
        header("Location: ../index.php"); 
         
        // Remember that this die statement is absolutely critical.  Without it, 
        // people can view your members-only content without logging in. 
        die("Redirecting to ../index.php"); 
    } 
     
    // Everything below this point in the file is secured by the login system 
     
    // We can display the user's username to them by reading it from the session array.  Remember that because 
    // a username is user submitted content we must use htmlentities on it before displaying it to the user. 

?>

<?php


        
 include "config/config.php";
 

$Assets_sql_res = "SELECT DISTINCT(`Dr_Ledger`) FROM `vochers` WHERE  `Dr_Ledger_Type` = 'Assets'";


$Liabilities_sql_res = "SELECT DISTINCT(`Cr_Ledger`) FROM `vochers` WHERE `Cr_Ledger_Type` = 'Liabilirties' OR `Dr_Ledger_Type` = 'Liabilirties'";
//echo "$Assets_sql_res<br>";
//echo "$Liabilities_sql_res";


?>


<!DOCTYPE html>
<html lang="en">

<?php  include "html-head.php";  
$Liabilities_name=array();
$Liabilities_amount=array();
$Assets_name=array();
$Asssts_amount=array(); ?>

<body>

    




        <!-- Navigation -->
        <nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                
                    <h3 style="margin-left: 20px;margin-bottom: 20px;color: Red" href="#"><b><?php include "Name.txt"; ?></b></h3>

            </div>
            <!-- /.navbar-header -->

            
            <!-- /.navbar-top-links -->

            <?php
            include "header.php";
            ?>
            <!-- /.navbar-static-side -->
        </nav>


          <div id="wrapper">
         <div id="page-wrapper">
            <br>
 



         <div class="tab-content">
    <div  class="tab-pane fade in active">


      
                <div class="row">
                    <div class="col-lg-12">
                    


                    <div class="panel panel-default">


                        <div class="panel-heading">
                           <center> Balance Sheet</center>
                        </div>


                        <div class="panel-body">
                            <?php 
                            $FromDate=date('Y-m-01', strtotime("now"));
                            $ToDate=date('Y-m-t', strtotime("now"));
                            if(isset($_POST['btnSubmit']))
                            {
                                $FromDate=$_POST['FromDate'];
                                $ToDate=$_POST['ToDate'];
                            }
                            ?>
                            <form action="" method="POST">
                                <div class="row">
                                    <div class="col-lg-3 col-md-3 col-xs-12 col-sm-12">
                                        <div class="form-group">
                                            <label>From Date</label>
                                            <input type="date" name="FromDate" class="form-control" required value="<?php echo $FromDate; ?>" />
                                        </div>
                                    </div>
                                    <div class="col-lg-3 col-md-3 col-xs-12 col-sm-12">
                                        <div class="form-group">
                                            <label>To Date</label>
                                            <input type="date" name="ToDate" class="form-control" required value="<?php echo $ToDate; ?>" />
                                        </div>
                                    </div>
                                    <div class="col-lg-3 col-md-3 col-xs-12 col-sm-12">
                                        <div class="form-group">
                                            <label style="width:100%">&nbsp;</label>
                                            <button type="submit" class="btn btn-primary" name="btnSubmit">Submit</button>
                                        </div>
                                    </div>
                                </div>
                            </form>
                                <!-- Form Content Start -->
 

                               <!-- Liabilities Tab Start--> 
                                                    <?php 
                                                       $i=0;
                                                    $Liabilities_Total="";
                                                    $Liabilities_res=mysqli_query($con,$Liabilities_sql_res);
                                                    while($Liabilities_1=mysqli_fetch_array($Liabilities_res))
                                                    {
                                                   //cho "SELECT SUM(Cr_Amount) FROM `vochers` WHERE `Cr_Ledger` = '$expenditure_1[Cr_Ledger]'";
                                                    $Liabilities_1_res=mysqli_query($con,
                                                        "SELECT SUM(Dr_Amount) FROM `vochers` 
                                                        WHERE `Cr_Ledger` = '$Liabilities_1[Cr_Ledger]' AND (Date between '$FromDate' And '$ToDate')");
                                                    while($Liabilities=mysqli_fetch_array($Liabilities_1_res))
                                                    {
                                                        
                                                    
                                                  $Liabilities_name[$i]=$Liabilities_1['Cr_Ledger'];   
                                                  $Liabilities_amount[$i]=$Liabilities[0]; 
                                                     
                                                    $Liabilities_Total+=$Liabilities['0'];
                                                     $i++;
                                                    }
                                                }
                                                    ?>
                                      
                                <!-- Liabilities Tab End-->


                                                                 
                                   
                                                <?php 
                                                $i=0;
                                                    $Assets_Total="";
                                                    $Assets_res=mysqli_query($con,$Assets_sql_res);
                                                    while($Assets_1=mysqli_fetch_array($Assets_res))
                                                    {
                                                        
                                                    $Assets_1_res=mysqli_query($con,
                                                        "SELECT SUM(Dr_Amount) FROM `vochers` 
                                                        WHERE `Dr_Ledger` = '$Assets_1[Dr_Ledger]' AND (Date between '$FromDate' And '$ToDate')");
                                                    while($Assets=mysqli_fetch_array($Assets_1_res))
                                                    {
                                                        
                                                 
                                                $Assets_name[$i] =$Assets_1['Dr_Ledger']; 
                                                $Assets_amount[$i]= $Assets['0'] ;
                                                  
                                                    $Assets_Total+=$Assets['0'];
                                                    
                                                    }
                                                }
                                                 if(sizeof($Liabilities_name) > sizeof($Assets_name))
                                                    {
                                                       $size=sizeof($Liabilities_name);
                                                    }
                                                    else
                                                     $size=sizeof($Assets_name);   
                                                        


                                                    ?>
                                                  



                                      <table width="100%" class="table table-striped table-bordered table-hover" id="example">
                                <thead>
                                 <tr>
                                    <th>Liabilities</th>
                                    <th></th>
                                    <th>Assets</th>
                                    <th></th>
                                 </tr>
                             </thead>                
                             <tbody>
                                <?php
                                    for($i=0;$i<$size;$i++)
                                    {
                                    ?>
                                 <tr>
                                    <td>
                                        <?php 
                                        if(array_key_exists($i, $Liabilities_name))
                                        {
                                           echo $Liabilities_name[$i]; 
                                        } 
                                        ?> 
                                     </td>


                                        <td>
                                        <?php 
                                        if(array_key_exists($i, $Liabilities_amount))
                                        {
                                           echo $Liabilities_amount[$i]; 
                                        } 
                                        ?> 
                                     </td>



                                     <td>
                                        <?php

                                        if(array_key_exists($i, $Assets_name))
                                        {
                                           echo $Assets_name[$i]; 

                                        } 
                                        ?> 
                                     </td>



                                     <td>
                                        <?php 
                                        if(array_key_exists($i, $Assets_amount))
                                        {
                                           echo $Assets_amount[$i]; 
                                        } 
                                        ?> 
                                     </td>

                                  </tr>
                                   <?php
                                    }
                                    ?>
                                    <tr>
                                        <td></td>
                                        <td> <?php echo  "Total :".$Liabilities_Total; ?></td>
                                        <td></td>
                                        <td><?php echo "Total :".$Assets_Total; ?></td>
                                    </tr>

<?php
$income_sql_res = "SELECT DISTINCT `Cr_Ledger` FROM `vochers` WHERE `Type` = 'Recipt'";
$expenditure_sql_res = "SELECT DISTINCT `Dr_Ledger` FROM `vochers` WHERE `Type` = 'Payment' ";

 


                     $expenditure_Total="";
                    $expenditure_res=mysqli_query($con,$expenditure_sql_res);
                    while($expenditure_1=mysqli_fetch_array($expenditure_res))
                    {
                   //cho "SELECT SUM(Cr_Amount) FROM `vochers` WHERE `Cr_Ledger` = '$expenditure_1[Cr_Ledger]'";
                    $expenditure_1_res=mysqli_query($con,
                        "SELECT SUM(Dr_Amount) FROM `vochers` 
                        WHERE `Dr_Ledger` = '$expenditure_1[Dr_Ledger]'");
                    while($expenditure=mysqli_fetch_array($expenditure_1_res))
                    {
                      
                 
                     
                    $expenditure_Total+=$expenditure['0'];
                     
                    }
                }
                    ?>
         
<!-- Expenditure Tab End-->
                <?php 
                    $income_Total="";
                    $income_res=mysqli_query($con,$income_sql_res);
                    while($income_1=mysqli_fetch_array($income_res))
                    {
                   //cho "SELECT SUM(Cr_Amount) FROM `vochers` WHERE `Cr_Ledger` = '$expenditure_1[Cr_Ledger]'";
                    $income_1_res=mysqli_query($con,
                        "SELECT SUM(Cr_Amount) FROM `vochers` 
                        WHERE `Cr_Ledger` = '$income_1[Cr_Ledger]'");
                    while($income=mysqli_fetch_array($income_1_res))
                    {
                 
                    $income_Total+=$income['0'];
                     
                    }
                }
  
                       $CashInHand=$income_Total-$expenditure_Total;
                                          
                                          $label2="";
                                          $label="";
                                            $asset_label2="";
                                          $asset_label="";
                                          
                                
                                                        


                          
                                                        if($CashInHand > 0)
                                                        {
                                                        $label="Profit : $CashInHand";
                                                       
                                                        }
                                                        else
                                                        {
                                                            $label2="Loss :". abs($CashInHand);

                                                           
                                                    }
                        ?>
                                





                                     <tr>
                                        <td></td>
                                        <td> <?php echo  "$label2"; ?></td>
                                        <td></td>
                                        <td><?php echo $label; ?></td>
                                    </tr>
                                       <?php
                                    $pl_label="Profit and Loss A/c :"; 

                                        if($Assets_Total < $Liabilities_Total)
                                        {
                                            $asset_label = "$pl_label".($Liabilities_Total+$CashInHand)-$Assets_Total;
                                            $asset_label=$pl_label.$asset_label;
                                        }
                                        else
                                        {
                                            $asset_label2=($Assets_Total+$CashInHand)-$Liabilities_Total;
                                            $asset_label2=$pl_label.$asset_label2;
                                        }

                                    ?>

                                     <tr>
                                        <td></td>
                                        <td><?php echo  $asset_label2; ?></td>
                                        <td></td>
                                        <td><?php echo $asset_label; ?></td>
                                    </tr>
                                    



                              </tbody>
                          </table>
       
                                    </div>
                                </div>
                            </div>
                        </div>


                         
                      
                            </div>
                                <!-- Assets Tab End-->

        
                           
                            <!-- Form Content Start -->
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
               <!-- /.ROW -->
     


    </div>


        </div></div>
            
        </div>
       

    </div>
    <!-- /#wrapper -->






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

    
</body>

</html>

MMCT - 2023