user_management_model->selectCustomRecords(array('id', 'user_id', 'cont_type', 'cont_towards', 'amount', 'payment_mode', 'payment_ref','gen_dev_fund_remarks', 'mat_delivery_point', 'mat_delivery_date','DATE_FORMAT(timestamp,"%d-%m-%Y %h:%i %p") as contribute_date'),array('user_id' => $userid),CSR_CONTRIBUTIONS); $this->db->SELECT('CSR_CONTRIBUTIONS.id, CSR_CONTRIBUTIONS.user_id, CSR_CONTRIBUTIONS.cont_type, CSR_CONTRIBUTIONS.cont_towards, CSR_CONTRIBUTIONS.amount, CSR_CONTRIBUTIONS.amount, CSR_CONTRIBUTIONS.payment_mode,CSR_CONTRIBUTIONS.payment_ref,CSR_CONTRIBUTIONS.gen_dev_fund_remarks,CSR_CONTRIBUTIONS.mat_delivery_point,CSR_CONTRIBUTIONS.mat_delivery_date,DATE_FORMAT(convert_tz(CSR_CONTRIBUTIONS.timestamp,"+00:00","+05:30"),"%d-%m-%Y %h:%i %p") as contribute_date,CSR_TXN_DETAILS.merchant_txn_id,CSR_TXN_DETAILS.txnstatus,concat(DATE_FORMAT(convert_tz(CSR_CONTRIBUTIONS.timestamp,"+00:00","+05:30"),"%Y%m%d"),CSR_TXN_DETAILS.merchant_txn_id) as ref_id,CSR_TXN_DETAILS.trackid,CSR_CONTRIBUTIONS.payment_type,CSR_CONTRIBUTIONS.payment_date,CSR_CONTRIBUTIONS.bank_branch,CSR_CONTRIBUTIONS.mode_of_deposit,CSR_CONTRIBUTIONS.cheque_drop_address'); $this->db->FROM(CSR_CONTRIBUTIONS.' as CSR_CONTRIBUTIONS'); $this->db->JOIN(CSR_TXN_DETAILS.' as CSR_TXN_DETAILS','CSR_CONTRIBUTIONS.id = CSR_TXN_DETAILS.con_id','LEFT'); $this->db->WHERE('CSR_CONTRIBUTIONS.user_id',$userid); $this->db->ORDER_BY('CSR_CONTRIBUTIONS.id','DESC'); $contributions= $this->db->GET()->result_array(); //print_r($contributions);die(); if(count($contributions)) { foreach ($contributions as $contribution_key => $contribution) { $this->db->SELECT('CSR_CONTRIBUTION_DETAILS.id, CSR_CONTRIBUTION_DETAILS.cont_id, CSR_CONTRIBUTION_DETAILS.req_id, CSR_CONTRIBUTION_DETAILS.qty, CSR_CONTRIBUTION_DETAILS.amount, CSR_CONTRIBUTION_DETAILS.school_id, CSR_CONTRIBUTION_DETAILS.dist_id,STUDENTS_SCHOOL_CHILD_COUNT.district_name,STUDENTS_SCHOOL_CHILD_COUNT.school_name,CSR_MATERIAL_MASTER.material_name'); $this->db->FROM(CSR_CONTRIBUTION_DETAILS.' as CSR_CONTRIBUTION_DETAILS','CSR_USER.id = CSR_CONTRIBUTIONS.CSR_USER.id'); $this->db->JOIN(STUDENTS_SCHOOL_CHILD_COUNT.' as STUDENTS_SCHOOL_CHILD_COUNT','STUDENTS_SCHOOL_CHILD_COUNT.school_id = CSR_CONTRIBUTION_DETAILS.school_id'); $this->db->JOIN(CSR_SCHOOL_REQUIREMENTS.' as CSR_SCHOOL_REQUIREMENTS','CSR_CONTRIBUTION_DETAILS.req_id = CSR_SCHOOL_REQUIREMENTS.id'); $this->db->JOIN(CSR_MATERIAL_MASTER.' as CSR_MATERIAL_MASTER','CSR_SCHOOL_REQUIREMENTS.mat_id = CSR_MATERIAL_MASTER.id'); $this->db->WHERE('CSR_CONTRIBUTION_DETAILS.cont_id',$contribution['id']); $child_data = $this->db->GET()->result_array(); //print_r($this->db->last_query());die(); $contributions[ $contribution_key ]['child_data'] = $child_data; } } return $contributions; } function getProfileData($userid) { $this->db->SELECT('CSR_USER.id, CSR_USER.name, CSR_USER.email, CSR_USER.mobile, CSR_USER.user_type, CSR_USER.isactive, CSR_USER.profile_share, CSR_USER.notify_pref,CSR_USER_ORG.orgname,CSR_USER_ORG.org_address,CSR_USER_ORG.org_pan,CSR_USER_ORG.id as org_id'); $this->db->FROM(CSR_USER.' as CSR_USER'); $this->db->JOIN(CSR_USER_ORG.' as CSR_USER_ORG','CSR_USER.id = CSR_USER_ORG.user_id','LEFT'); $this->db->WHERE('CSR_USER.id',$userid); return $this->db->GET()->result_array(); } function getMailContentForOnlineTransaction($merchanttxnid) { $this->db->SELECT('CSR_TXN_DETAILS.merchant_txn_id,CSR_TXN_DETAILS.amount,CSR_TXN_DETAILS.trackid,CSR_TXN_DETAILS.con_id,CSR_TXN_DETAILS.user_id,concat(DATE_FORMAT(convert_tz(CSR_CONTRIBUTIONS.timestamp,"+00:00","+05:30"),"%Y%m%d"),CSR_TXN_DETAILS.merchant_txn_id) as ref_id,CSR_USER.id, CSR_USER.name,CSR_USER.email,CSR_TXN_DETAILS.txnstatus'); $this->db->FROM(CSR_TXN_DETAILS.' as CSR_TXN_DETAILS'); $this->db->JOIN(CSR_CONTRIBUTIONS.' as CSR_CONTRIBUTIONS','CSR_TXN_DETAILS.con_id = CSR_CONTRIBUTIONS.id'); $this->db->JOIN(CSR_USER.' as CSR_USER','CSR_TXN_DETAILS.user_id = CSR_USER.id'); $this->db->WHERE('CSR_TXN_DETAILS.merchant_txn_id',$merchanttxnid); return $this->db->GET()->result_array(); } }