Dash:GWM
This commit is contained in:
parent
c8e06b4fc2
commit
3130829ae9
@ -73,6 +73,8 @@ public function createAssets()
|
||||
$data=$this->input->post();
|
||||
$data['business_id'] = user()->business_id;
|
||||
$data['created_by'] = user()->name;
|
||||
$date = date_create($this->input->post('purchase_date'));
|
||||
$data['purchase_date'] = date_format($date,"Y-m-d");
|
||||
|
||||
//file upload confic
|
||||
$asset_image['upload_path'] = APPPATH. '../assets/uploads/';
|
||||
@ -398,6 +400,10 @@ public function add_or_edit_asset_amc()
|
||||
if($this->input->post('id'))
|
||||
{
|
||||
$value = $this->input->post();
|
||||
$valid_from = date_create($this->input->post('valid_from'));
|
||||
$value['valid_from'] = date_format($valid_from,"Y-m-d");
|
||||
$valid_to = date_create($this->input->post('valid_to'));
|
||||
$value['valid_to'] = date_format($valid_to,"Y-m-d");
|
||||
unset($value['asset_id_for_add']);
|
||||
|
||||
//set id $ table name for audit history
|
||||
@ -421,10 +427,13 @@ public function add_or_edit_asset_amc()
|
||||
$data['service_provider'] = $this->input->post('service_provider');
|
||||
$data['cost'] = $this->input->post('cost');
|
||||
$data['description'] = $this->input->post('description');
|
||||
$data['valid_from'] = $this->input->post('valid_from');
|
||||
$data['valid_to'] = $this->input->post('valid_to');
|
||||
$valid_from = date_create($this->input->post('valid_from'));
|
||||
$data['valid_from'] = date_format($valid_from,"Y-m-d");
|
||||
$valid_to = date_create($this->input->post('valid_to'));
|
||||
$data['valid_to'] = date_format($valid_to,"Y-m-d");
|
||||
$data['created_by'] = user()->id;
|
||||
$data['type'] = 3; //(amc service provider type = 3 * in third_parties table)
|
||||
|
||||
$createAMCData = $this->MY_Model->insert($data, 'amc');
|
||||
if($createAMCData)
|
||||
{
|
||||
@ -466,6 +475,10 @@ public function add_or_edit_asset_insurance()
|
||||
if($this->input->post('id'))
|
||||
{
|
||||
$value = $this->input->post();
|
||||
$valid_from = date_create($this->input->post('valid_from'));
|
||||
$value['valid_from'] = date_format($valid_from,"Y-m-d");
|
||||
$valid_to = date_create($this->input->post('valid_to'));
|
||||
$value['valid_to'] = date_format($valid_to,"Y-m-d");
|
||||
unset($value['asset_id_for_add']);
|
||||
|
||||
//set id $ table name for audit history
|
||||
@ -489,8 +502,10 @@ public function add_or_edit_asset_insurance()
|
||||
$data['insurance_company'] = $this->input->post('insurance_company');
|
||||
$data['cost'] = $this->input->post('cost');
|
||||
$data['description'] = $this->input->post('description');
|
||||
$data['valid_from'] = $this->input->post('valid_from');
|
||||
$data['valid_to'] = $this->input->post('valid_to');
|
||||
$valid_from = date_create($this->input->post('valid_from'));
|
||||
$data['valid_from'] = date_format($valid_from,"Y-m-d");
|
||||
$valid_to = date_create($this->input->post('valid_to'));
|
||||
$data['valid_to'] = date_format($valid_to,"Y-m-d");
|
||||
$data['created_by'] = user()->id;
|
||||
$data['type'] = 4; //(insurance company type = 4 * in third_parties table)
|
||||
$createInsuranceData = $this->MY_Model->insert($data, 'amc');
|
||||
|
||||
@ -37,6 +37,7 @@ public function __construct()
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//echo date('Y-m-d', strtotime('+60 day', strtotime(date("Y-m-d")))); die();
|
||||
if(is_admin())
|
||||
{
|
||||
$asset_count = $this->Dashboard_model->get_assets_count(user()->business_id);
|
||||
|
||||
@ -31,6 +31,11 @@ public function get_amc_count($business_id)
|
||||
$this->db->where('business_id', $business_id);
|
||||
$this->db->where('is_active', 1);
|
||||
$this->db->where('type', 3);
|
||||
$this->db->where('valid_to >', date("Y-m-d"));
|
||||
$this->db->where('valid_to <=', date('Y-m-d', strtotime('+30 day', strtotime(date("Y-m-d")))));
|
||||
$this->db->group_by('asset_id');
|
||||
$this->db->order_by('id','DESC');
|
||||
$this->db->limit(1);
|
||||
$query = $this->db->get();
|
||||
$query = $query->num_rows();
|
||||
return $query;
|
||||
@ -44,6 +49,10 @@ public function get_expired_amc_count($business_id)
|
||||
$this->db->where('business_id', $business_id);
|
||||
$this->db->where('is_active', 1);
|
||||
$this->db->where('type', 3);
|
||||
$this->db->where('valid_to <', date("Y-m-d"));
|
||||
$this->db->group_by('asset_id');
|
||||
$this->db->order_by('id','DESC');
|
||||
$this->db->limit(1);
|
||||
$query = $this->db->get();
|
||||
$query = $query->num_rows();
|
||||
return $query;
|
||||
@ -56,6 +65,11 @@ public function get_insurance_count($business_id)
|
||||
$this->db->where('business_id', $business_id);
|
||||
$this->db->where('is_active', 1);
|
||||
$this->db->where('type', 4);
|
||||
$this->db->where('valid_to >', date("Y-m-d"));
|
||||
$this->db->where('valid_to <=', date('Y-m-d', strtotime('+30 day', strtotime(date("Y-m-d")))));
|
||||
$this->db->group_by('asset_id');
|
||||
$this->db->order_by('id','DESC');
|
||||
$this->db->limit(1);
|
||||
$query = $this->db->get();
|
||||
$query = $query->num_rows();
|
||||
return $query;
|
||||
@ -69,6 +83,10 @@ public function get_expired_insurance_count($business_id)
|
||||
$this->db->where('business_id', $business_id);
|
||||
$this->db->where('is_active', 1);
|
||||
$this->db->where('type', 4);
|
||||
$this->db->where('valid_to <', date("Y-m-d"));
|
||||
$this->db->group_by('asset_id');
|
||||
$this->db->order_by('id','DESC');
|
||||
$this->db->limit(1);
|
||||
$query = $this->db->get();
|
||||
$query = $query->num_rows();
|
||||
return $query;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user