Merge branch 'master' of bitbucket.org:venbaittech/ams

This commit is contained in:
suseendhiran17 2023-01-20 10:01:40 +05:30
commit cd3434be47
12 changed files with 303 additions and 14 deletions

View File

@ -306,6 +306,14 @@ public function add_or_edit_asset_value()
redirect('asset/view_asset_details/'.md5($this->input->post('asset_id')));
}else{
$get_latest_asset_value = $this->Asset_model->get_latest_asset_value($this->input->post('asset_id_for_add'),user()->business_id);
$pre_current_value = $get_latest_asset_value->current_value;
if($this->input->post('type') == 'Upgrade')
{
$data['current_value'] = $pre_current_value + $this->input->post('value');
}else if($this->input->post('type') == 'Depreciation') {
$data['current_value'] = $pre_current_value - $this->input->post('value');
}
$data['asset_id'] = $this->input->post('asset_id_for_add');
$data['business_id'] = user()->business_id;
$data['type'] = $this->input->post('type');
@ -626,9 +634,31 @@ public function deleteAssetInsurance($id)
redirect('asset/view_asset_details/'.md5($asset_id));
}
public function get_history()
public function depreciation_report()
{
echo $this->input->post();
$Data = $this->Asset_model->depreciation_report(user()->business_id);
//print_r($Data);die();
$this->layout->set('tableData', $Data);
$this->layout->buffer('main_content', 'Asset/depreciation_list');
$this->layout->render('default_layout');
}
public function amc_report()
{
$Data = $this->Asset_model->amc_insurance_report(3,user()->business_id);
$this->layout->set('tableData', $Data);
$this->layout->buffer('main_content', 'Asset/amc_reports_list');
$this->layout->render('default_layout');
}
public function insurance_report()
{
$Data = $this->Asset_model->amc_insurance_report(4,user()->business_id);
$this->layout->set('tableData', $Data);
$this->layout->buffer('main_content', 'Asset/insurance_reports_list');
$this->layout->render('default_layout');
}

View File

@ -55,7 +55,7 @@ public function get_amc_with_join($id,$business_id)
$this->db->where('A.business_id', $business_id);
$this->db->where('md5(A.asset_id)', $id);
$this->db->where('is_active', 1);
$this->db->where('A.is_active', 1);
$this->db->where('A.type', 3);
$query = $this->db->get();
$query = $query->result();
@ -67,7 +67,7 @@ public function get_amc_by_id_with_join($id)
$this->db->from('amc A');
$this->db->join('third_parties', 'third_parties.id = A.service_provider', 'left');
$this->db->where('md5(A.id)', $id);
$this->db->where('is_active', 1);
$this->db->where('A.is_active', 1);
$this->db->where('A.type', 3);
$query = $this->db->get();
$query = $query->row();
@ -81,7 +81,7 @@ public function get_insurance_with_join($id,$business_id)
$this->db->join('third_parties', 'third_parties.id = A.insurance_company', 'left');
$this->db->where('A.business_id', $business_id);
$this->db->where('md5(A.asset_id)', $id);
$this->db->where('is_active', 1);
$this->db->where('A.is_active', 1);
$this->db->where('A.type', 4);
$query = $this->db->get();
$query = $query->result();
@ -93,7 +93,7 @@ public function get_insurance_by_id_with_join($id)
$this->db->from('amc A');
$this->db->join('third_parties', 'third_parties.id = A.insurance_company', 'left');
$this->db->where('md5(A.id)', $id);
$this->db->where('is_active', 1);
$this->db->where('A.is_active', 1);
$this->db->where('A.type', 4);
$query = $this->db->get();
$query = $query->row();
@ -120,6 +120,55 @@ public function get_asset_id($id,$table,$business_id)
return $query;
}
public function get_latest_asset_value($asset_id,$business_id)
{
$this->db->select();
$this->db->from('asset_value');
$this->db->where('asset_id', $asset_id);
$this->db->where('business_id', $business_id);
$this->db->where('is_active', 1);
$this->db->order_by('id', 'DESC');
$this->db->limit(1);
$query = $this->db->get();
$query = $query->row();
return $query;
}
public function amc_insurance_report($type,$business_id)
{
$query = $this->db->query("SELECT amc.*,service_provider.name as service_provider_name,insurance_company.name as insurance_company_name,
asset.id,asset.name as asset_name,asset.tag,asset.serial,asset.model,asset.purchase_date,asset.cost as purchase_cost,status.name as status , categories.name as category,locations.location as location,manufacturer.name as manufacturer, Supplier.name as Supplier
FROM asset
LEFT JOIN amc ON asset.id = amc.asset_id AND amc.created_at = (SELECT MAX(amc.created_at) FROM amc
WHERE asset.id = amc.asset_id and amc.is_active=1 and amc.type=".$type.")
LEFT JOIN third_parties as service_provider ON amc.service_provider = service_provider.id
LEFT JOIN third_parties as insurance_company ON amc.insurance_company = insurance_company.id
LEFT JOIN status ON asset.status = status.id
LEFT JOIN categories ON asset.category = categories.id
LEFT JOIN locations ON asset.location = locations.id
LEFT JOIN third_parties as manufacturer ON asset.manufacturer = manufacturer.id
LEFT JOIN third_parties as Supplier ON asset.Supplier = Supplier.id
where asset.business_id =".$business_id." and asset.is_active=1");
$result =$query->result_array();
return $result;
}
public function depreciation_report($business_id)
{
$query = $this->db->query("SELECT asset_value.*,
asset.id,asset.name as asset_name,asset.tag,asset.serial,asset.model,asset.purchase_date,asset.cost as purchase_cost,status.name as status , categories.name as category,locations.location as location,manufacturer.name as manufacturer, Supplier.name as Supplier
FROM asset
LEFT JOIN asset_value ON asset.id = asset_value.asset_id AND asset_value.created_at = (SELECT MAX(asset_value.created_at) FROM asset_value WHERE asset.id = asset_value.asset_id and asset_value.is_active=1)
LEFT JOIN status ON asset.status = status.id
LEFT JOIN categories ON asset.category = categories.id
LEFT JOIN locations ON asset.location = locations.id
LEFT JOIN third_parties as manufacturer ON asset.manufacturer = manufacturer.id
LEFT JOIN third_parties as Supplier ON asset.Supplier = Supplier.id
where asset.business_id =".$business_id." and asset.is_active=1");
$result =$query->result_array();
return $result;
}
}

View File

@ -0,0 +1,69 @@
<div class="col-md-12 col-sm-12 ">
<div class="x_panel">
<div class="x_title">
<h2>AMC Reports Details </h2>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="row">
<div class="col-sm-12">
<div class="card-box table-responsive">
<table id="datatable-buttons" class="table table-striped table-bordered dataTable no-footer" width="100%">
<thead>
<tr class="headings">
<th class="column-title">Category </th>
<th class="column-title">Asset Name </th>
<th class="column-title">Tag </th>
<th class="column-title">Serial </th>
<th class="column-title">Model </th>
<th class="column-title">Service Provider</th>
<th class="column-title">Service cost</th>
<th class="column-title">Valid From</th>
<th class="column-title">Valid To</th>
<th class="column-title">Status </th>
</tr>
</thead>
<tbody>
<?php foreach ($tableData as $key => $value) { ?>
<tr class="even pointer">
<td class=" "> <?php echo $value['category']; ?> </td>
<td class=" "> <?php echo $value['asset_name']; ?> </td>
<td class=" "> <?php echo $value['tag']; ?> </td>
<td class=" "> <?php echo $value['serial']; ?> </td>
<td class=" "> <?php echo $value['model']; ?> </td>
<td class=" "> <?php echo $value['service_provider_name']; ?> </td>
<td class=" "> <?php echo $value['cost']; ?> </td>
<td class=" "> <?php echo my_date_show($value['valid_from']); ?> </td>
<td class=" "> <?php echo my_date_show($value['valid_to']); ?> </td>
<td class=" "> <?php echo $value['status']; ?> </td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<br/>

View File

@ -44,11 +44,12 @@
<table class="table table-bordered table-striped" cellspacing="0" width="100%">
<thead>
<tr class="headings">
<th class="column-title" width="18%">Type </th>
<th class="column-title" width="18%">Name </th>
<th class="column-title" width="18%">Value </th>
<th class="column-title" width="18%">Percentage </th>
<th class="column-title" width="18%">Description </th>
<th class="column-title" width="15%">Type </th>
<th class="column-title" width="15%">Name </th>
<th class="column-title" width="15%">Value </th>
<th class="column-title" width="15%">Current Value </th>
<th class="column-title" width="15%">Percentage </th>
<th class="column-title" width="15%">Description </th>
<th class="column-title" width="10%">Action </th>
</tr>
</thead>
@ -59,6 +60,7 @@
<td class=" "><?php echo $value->type; ?></td>
<td class=" "><?php echo $value->name; ?></td>
<td class=" "><?php echo $value->value; ?></td>
<td class=" "><?php echo $value->current_value; ?></td>
<td class=" "><?php echo $value->percentage; ?></td>
<td class=" "><?php echo $value->description; ?></td>
<td>

View File

@ -0,0 +1,63 @@
<div class="col-md-12 col-sm-12 ">
<div class="x_panel">
<div class="x_title">
<h2>Depreciation Details </h2>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="row">
<div class="col-sm-12">
<div class="card-box table-responsive">
<table id="datatable-buttons" class="table table-striped table-bordered dataTable no-footer" width="100%">
<thead>
<tr class="headings">
<th class="column-title" width="20%">Category </th>
<th class="column-title" width="20%">Asset Name </th>
<th class="column-title" width="20%">Tag </th>
<th class="column-title" width="20%">Serial </th>
<th class="column-title" width="20%">Model </th>
<th class="column-title" width="15%">Purchase Date </th>
<th class="column-title" width="15%">Purchase Cost </th>
<th class="column-title" width="15%">Current Value </th>
<th class="column-title" width="20%">Status </th>
</tr>
</thead>
<tbody>
<?php foreach ($tableData as $key => $value) { ?>
<tr class="even pointer">
<td class=" "> <?php echo $value['category']; ?> </td>
<td class=" "> <?php echo $value['asset_name']; ?> </td>
<td class=" "> <?php echo $value['tag']; ?> </td>
<td class=" "> <?php echo $value['serial']; ?> </td>
<td class=" "> <?php echo $value['model']; ?> </td>
<td class=" "> <?php echo $value['purchase_date']; ?> </td>
<td class=" "> <?php echo $value['purchase_cost']; ?> </td>
<td class=" "> <?php echo $value['current_value']; ?> </td>
<td class=" "> <?php echo $value['status']; ?> </td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<br/>

View File

@ -0,0 +1,67 @@
<div class="col-md-12 col-sm-12 ">
<div class="x_panel">
<div class="x_title">
<h2>Insurance Reports Details </h2>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="row">
<div class="col-sm-12">
<div class="card-box table-responsive">
<table id="datatable-buttons" class="table table-striped table-bordered dataTable no-footer" width="100%">
<thead>
<tr class="headings">
<th class="column-title">Category </th>
<th class="column-title">Asset Name </th>
<th class="column-title">Tag </th>
<th class="column-title">Serial </th>
<th class="column-title">Model </th>
<th class="column-title">Insurance Company</th>
<th class="column-title">Insurance Cost </th>
<th class="column-title">Valid From</th>
<th class="column-title">Valid To</th>
<th class="column-title">Status </th>
</thead>
<tbody>
<?php foreach ($tableData as $key => $value) { ?>
<tr class="even pointer">
<td class=" "> <?php echo $value['category']; ?> </td>
<td class=" "> <?php echo $value['asset_name']; ?> </td>
<td class=" "> <?php echo $value['tag']; ?> </td>
<td class=" "> <?php echo $value['serial']; ?> </td>
<td class=" "> <?php echo $value['model']; ?> </td>
<td class=" "> <?php echo $value['insurance_company_name']; ?> </td>
<td class=" "> <?php echo $value['cost']; ?> </td>
<td class=" "> <?php echo my_date_show($value['valid_from']); ?> </td>
<td class=" "> <?php echo my_date_show($value['valid_to']); ?> </td>
<td class=" "> <?php echo $value['status']; ?> </td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<br/>

View File

@ -38,7 +38,7 @@ public function __construct()
public function index()
{
if(is_admin())
if(is_admin() || is_user())
{
$asset_count = $this->Dashboard_model->get_assets_count(user()->business_id);
$this->layout->set('asset_count', $asset_count);

View File

@ -21,7 +21,7 @@
<?php } ?>
<?php if (is_admin()) { ?>
<?php if (is_admin() || is_user()) { ?>
<div class="col-md-2 col-sm-4 tile_stats_count">
<span class="count_top"><i class="fa fa-user"></i> Total Users</span>
@ -71,7 +71,7 @@
<div class="row">
<?php if (is_admin()) { ?>
<?php if (is_admin() || is_user()) { ?>
<div class="col-md-6 col-sm-6 ">
<div class="x_panel tile ">

View File

@ -73,6 +73,15 @@
<li><a href="<?php echo base_url();?>user/addUser">Add Users</a></li>
</ul>
</li>
<?php } ?>
<?php if(check_auth() && is_admin() || is_user() ) { ?>
<li><a><i class="fa fa-clipboard"></i> Reports <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu">
<li><a href="<?php echo base_url();?>asset/depreciation_report">Depreciation Reports</a></li>
<li><a href="<?php echo base_url();?>asset/amc_report">AMC Reports</a></li>
<li><a href="<?php echo base_url();?>asset/insurance_report">Insurance Reports</a></li>
</ul>
</li>
<?php } ?>

BIN
assets/uploads/logo/gk.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB