119 lines
4.6 KiB
PHP
119 lines
4.6 KiB
PHP
<?php
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
require_once APPPATH . '/libraries/SPARQ_Model.php';
|
|
class Data_Dump_Model extends SPARQ_Model {
|
|
|
|
public function __construct() {
|
|
parent::__construct();
|
|
}
|
|
|
|
function saveGenDumpData($gen_data_dump)
|
|
{
|
|
if(isset($gen_data_dump['individuals_data']))
|
|
{
|
|
foreach ($gen_data_dump['individuals_data'] as $key => $value)
|
|
{
|
|
$this->saveRecords($value,D_GENERAL_IND);
|
|
}
|
|
}
|
|
|
|
if(isset($gen_data_dump['relationship_data']))
|
|
{
|
|
foreach ($gen_data_dump['relationship_data'] as $key => $value)
|
|
{
|
|
$this->saveRecords($value,D_GEN_RELATIONSHIP);
|
|
}
|
|
}
|
|
}
|
|
|
|
function saveBusinessDUmpData($business_data_dump)
|
|
{
|
|
print_r($business_data_dump);
|
|
echo "*****************";
|
|
if(isset($business_data_dump['single_business_items']))
|
|
{
|
|
|
|
$this->saveRecords($business_data_dump['single_business_items'],D_BUSINESS_FORM);
|
|
|
|
}
|
|
if(isset($business_data_dump['partners_details']))
|
|
{
|
|
foreach ($business_data_dump['partners_details'] as $key => $value)
|
|
{
|
|
$this->saveRecords($value,D_BUSINESS_PARTNERS);
|
|
}
|
|
}
|
|
if(isset($business_data_dump['type_of_activity_details']))
|
|
{
|
|
foreach ($business_data_dump['type_of_activity_details'] as $key => $value)
|
|
{
|
|
$this->saveRecords($value,D_BUSIENSS_TYPE);
|
|
}
|
|
}
|
|
if(isset($business_data_dump['business_relatinship_data']))
|
|
{
|
|
foreach ($business_data_dump['business_relatinship_data'] as $key => $value)
|
|
{
|
|
$this->saveRecords($value,D_BUSINESS_RELATINSHIP);
|
|
}
|
|
}
|
|
if(isset($business_data_dump['products']))
|
|
{
|
|
foreach ($business_data_dump['products'] as $index => $activity_data)
|
|
{
|
|
foreach ($activity_data as $key => $value)
|
|
{
|
|
$this->saveRecords($value,D_BUSINESS_PRODUCTS);
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
function getRequestForDataDump($pdid,$fd=null,$td=null,$type){
|
|
$this->db->select('t_pd_form_details_json.pd_form_detail_json_id, t_pd_form_details_json.fk_pd_id, t_pd_form_details_json.fk_form_id, t_pd_form_details_json.isactive, t_pd_form_details_json.json, DATE_FORMAT(t_pd_form_details_json.createdon,"%d/%m/%Y %H:%i:%s") as createdon, t_pd_form_details_json.processed_json, t_pd_form_details_json.updatedon');
|
|
$this->db->from('t_pd_form_details_json');
|
|
|
|
if(!empty($pdid))
|
|
{
|
|
|
|
$this->db->where_in('t_pd_form_details_json.fk_pd_id',$pdid);
|
|
}
|
|
if(($fd != "" || $fd != null) && ($td != "" || $td != null)) {
|
|
if($type == "Createdon" ){
|
|
$this->db->where('t_pd_form_details_json.createdon BETWEEN '. "'$fd'". ' AND '. "'$td'" );
|
|
}else if($type == "Updatedon" ){
|
|
$this->db->where('t_pd_form_details_json.updatedon BETWEEN '. "'$fd'". ' AND '. "'$td'" );
|
|
}else{
|
|
$this->db->where('t_pd_form_details_json.updatedon BETWEEN '. "'$fd'". ' AND '. "'$td'" );
|
|
}
|
|
}
|
|
else if($fd != "" && $fd != null) {
|
|
if($type == "Createdon" ){
|
|
$this->db->where("DATE_FORMAT(t_pd_form_details_json.createdon,'%Y-%m-%d')",$fd);
|
|
}else if($type == "Updatedon" ){
|
|
$this->db->where("DATE_FORMAT(t_pd_form_details_json.updatedon,'%Y-%m-%d')",$fd);
|
|
}else{
|
|
$this->db->where("DATE_FORMAT(t_pd_form_details_json.updatedon,'%Y-%m-%d')",$fd);
|
|
}
|
|
}
|
|
else if($td != "" && $td != null) {
|
|
if($type == "Createdon" ){
|
|
$this->db->where("DATE_FORMAT(t_pd_form_details_json.createdon,'%Y-%m-%d')",$td);
|
|
}else if($type == "Updatedon" ){
|
|
$this->db->where("DATE_FORMAT(t_pd_form_details_json.updatedon,'%Y-%m-%d')",$td);
|
|
}else{
|
|
$this->db->where("DATE_FORMAT(t_pd_form_details_json.updatedon,'%Y-%m-%d')",$td);
|
|
}
|
|
}
|
|
$this->db->WHERE('t_pd_form_details_json.isactive',1);
|
|
$this->db->order_by('t_pd_form_details_json.pd_form_detail_json_id','desc');
|
|
$result = $this->db->get()->result_array();
|
|
// echo count($result);print_r($result);die();
|
|
// print_r($this->db->last_query());die();
|
|
return $result;
|
|
|
|
}
|
|
} |