0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
SO
/
[
Home
]
File: summary.php
<?php $MAIN_HEADING = "Summary"; $SUB_HEADING =""; include( "../lib/config.php"); include_once("../model/defaults_mdl.php"); //require_once "../model/Notification_mdl.php"; require_once BASE_DIR."/lib/db/connection.php"; require_once "../model/uploader_mdl.php"; require_once "../model/defaultValues_mdl.php"; require_once "ed_models.php"; $u_id= @$_SESSION['user_id']; include("include/ed_header.php"); $u_id= @$_SESSION['user_id']; $sql="select * from tab_master_fund_type " ; $sql=mysql_query($sql); $fund_types= array(); $fund_types[0]= "All"; while($row=mysql_fetch_array($sql)) { $fund_types[$row['id']] = $row['name']; } $summary = array(); ?> <?php $startdate =""; $end_date = date("m/d/Y"); $__fund_type = 0; if(isset($_POST['submit']) && $_POST['submit'] =='search'){ $startdate =$_POST['startdate']; $end_date =$_POST['end_date']; $__fund_type =$_POST['fund_type']; $startdate = date(DATE_FORMAT,strtotime($startdate)); $end_date = date(DATE_FORMAT,strtotime($end_date)); $summary = Ed_Models::getBudgetSummaryTotal(date('Y-m-d', strtotime($_POST['startdate'])),date('Y-m-d', strtotime($_POST['end_date'])),$__fund_type); }else{ $startdate = date(DATE_FORMAT,strtotime(getFisc()->start)); $end_date = date(DATE_FORMAT); $__fund_type = 0; $summary = Ed_Models::getBudgetSummaryTotal(date('Y-m-d', strtotime($startdate)),date("Y-m-d"),$__fund_type); } //echo "<pre>"; // print_r($summary); $installment_keys = array_keys($summary['installment_details']); $voucher_keys = array_keys($summary['voucher_details']); // print_r($installment_keys); // print_r($voucher_keys); $project_ids = array_unique (array_merge ($installment_keys, $voucher_keys)); // print_r($project_ids); //echo "</pre>"; ?> <?php include("include/alert_message.php"); ?> <form method="post" class="form-horizontal form-label-left " id="form1" data-parsley-validate> <div class="form-group"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="first-name">Fund Type </label> <div class="col-md-6 col-sm-6 col-xs-12"> <select class="form-control col-md-7 col-xs-12" name="fund_type" id="fund_type"> <?php if(!empty($fund_types)) foreach ($fund_types as $j=> $value) { $select = ($j==$__fund_type) ? 'selected ' : ""; ?> <option <?php echo $select?> value="<?php echo $j; ?>"> <?php echo $value ?> </option> <?php } ?> </select> <ul class="parsley-errors-list filled" id="parsley-id-5"> <li class="parsley-required"> <?php if(isset($error[ 'fund_type'])) { echo $error['fund_type']; }?> </li> </ul> </div> </div> <div class="form-group"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="date_current">Start Date </label> <div class="col-md-6 col-sm-6 col-xs-12"> <input readonly id="startdate" type="text" class="form-control col-md-7 col-xs-12 start_date" name="startdate" value="<?php echo $startdate?>" /> </div> <div class="col-md-2 col-sm-2 col-xs-12"> </div> </div> <div class="form-group"> <label class="control-label col-md-3 col-sm-3 col-xs-12" for="end_date">End Date </label> <div class="col-md-6 col-sm-6 col-xs-12"> <input data-parsley-csdate="" id="date_current" readonly type="text" class="form-control col-md-7 col-xs-12 end_date" name="end_date" value="<?php echo $end_date ?>" /> <ul class="parsley-errors-list filled" id="parsley-id-5"><li class="parsley-required"><?php if(isset($error['end_date'])) { echo $error['end_date']; }?></li></ul> </div> </div> <div class="form-group"> <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-4"> <button class="btn btn-success" name='submit' value="search" ><i class="fa fa-search"></i> Search</button> </div> </div> </form> <br/> <div class="form-group center" id="spin" style="display:none"><i class="fa fa-refresh fa-spin fa-3x"></i></div> <div class="form-group center" id="error" style="display:none;color:red"></div> </div> </div> </div> <div class="col-md-12 col-sm-12 col-xs-12" id="table"> <div class="x_panel"> <div class="x_title" style=" border-bottom:0px !important; "> <div class="clearfix"></div> </div> <div class="x_content"> <table class="table table-bordered" id="datatable-buttons"> <thead> <tr> <th>Project Title</th> <th>Project Code</th> <th>PI</th> <th>Fund Type</th> <th>Fund Recevied</th> <th>Expenditure</th> <th>Balance</th> </tr> </thead> <tbody> <?php $insta_sum = $vouc_sum =$bal_sum=0; if(!empty($project_ids)){ foreach ($project_ids as $key_id => $project_id) { $__inst = $summary['installment_details']; $__vouc = $summary['voucher_details']; $inst_amt = isset($__inst[$project_id]) && $__inst[$project_id]['amount'] ? $__inst[$project_id] ['amount']: 0; $vouc_amt = isset($__vouc[$project_id]) && $__vouc[$project_id]['amount'] ? $__vouc[$project_id] ['amount']: 0; $__project = array(); if(isset($__inst[$project_id])){ $__project = $__inst[$project_id]; }else{ $__project = $__vouc[$project_id]; } $bal_sum+= $bal = $inst_amt-$vouc_amt; $insta_sum+= $inst_amt ; $vouc_sum+= $vouc_amt ; $alert_class = ($bal <0) ? "danger" :"success"; $alert_class_sum = ($bal_sum <0) ? "danger" :"success"; ?> <tr> <td> <?php echo $__project['project_title'] ?> </td> <td> <?php echo $__project['project_code'] ?> </td> <td> <?php echo ucwords($__project['co_pi']) ?> </td> <td> <?php echo $__project['fund_type'] ?> </td> <td> <?php echo moneyFormatIndia($inst_amt) ?> </td> <td> <?php echo moneyFormatIndia($vouc_amt) ?> </td> <td class="<?php echo $alert_class ?>"> <?php echo moneyFormatIndia($bal)?> </td> </tr> <?php } ?> <tr class="warning bold"> <td class="center"> </td> <td class="center"> </td> <td class="center"> Total </td> <td class="center"> </td> <td> <?php echo moneyFormatIndia($insta_sum) ?> </td> <td> <?php echo moneyFormatIndia($vouc_sum) ?> </td> <td class="<?php echo $alert_class_sum ?>"> <?php echo moneyFormatIndia($bal_sum)?> </td> </tr> <?php } else{ ?> <tr> <td colspan="6" class="center">No Details Found </td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> <?php include "include/footer.php"; ?> <script type="text/javascript"> $(".select2_single").select2({ placeholder: "Select a project code", allowClear: true, noResults: "No project code found. Add project first", }).on('change', function(e) { getDebitHeadAjax(this.value); }) </script> <script type="text/javascript"> var t; datePicker($(".start_date"),'<?php echo date("m-d-Y" ,strtotime($startdate)) ?>') datePicker($(".end_date"),'<?php echo date("m-d-Y" ,strtotime($end_date)) ?>') function validateDate(){ var strStartDate = $('input[name="startdate"]').attr("date-org"); var strEndDate = $('input[name="end_date"]').attr("date-org"); if(isNotBlank(strStartDate) && isNotBlank(strEndDate)){ var a = moment(strStartDate); var b = moment(strEndDate); return !b.isBefore(a); } return true; } $(function () { window.Parsley.addValidator('csdate', { validateString: function(value) { return validateDate(); }, messages: { en: 'End date must be greater than start date', } }); $('#form1').parsley().on('field:validated', function() {}) .on('form:submit', function() { return true; }); t= $("#datatable-buttons").DataTable({ dom: "Bfrtip", fixedHeader: true, "bPaginate": false, "bSort": false, "bInfo": false, buttons: [ { extend: "excel", className: "btn-sm" }, { extend: "pdfHtml5", className: "btn-sm" }, { extend: "print", className: "btn-sm" }, ], responsive: true }); }); </script>