$this->db->set('modifyDT', 'now()', False);
     $this->db->trans_begin();
     $this->db->insert('_documents', $ins_doc);
     $doc_rid = $this->db->insert_id();
     $ins_h = array('date_doc' => date('Y-m-d', strtotime($this->ci->input->post('date_doc'))), '_documents_rid' => $doc_rid, 'owner_users_rid' => get_curr_urid(), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('createDT', 'now()', False);
     $this->db->set('modifyDT', 'now()', False);
     $this->db->insert('_emp_to_positions_headers', $ins_h);
     $ins_r = array('_emp_to_positions_headers_rid' => $this->db->insert_id(), '_employeers_rid' => $this->ci->input->post('_employeers_rid'), '_positions_rid' => $this->ci->input->post('_positions_rid'), '_filials_rid' => $this->ci->input->post('_filials_rid'), '_currencies_rid' => $this->ci->input->post('_currencies_rid'), 'salary' => $this->ci->input->post('salary'), 'bdate' => date('Y-m-d', strtotime($this->ci->input->post('bdate'))), 'owner_users_rid' => get_curr_urid(), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('createDT', 'now()', False);
     $this->db->set('modifyDT', 'now()', False);
     $this->db->insert('_emp_to_positions_rows', $ins_r);
     if ($this->db->trans_status() === FALSE) {
         $this->db->trans_rollback();
         return False;
     } else {
         $this->db->trans_commit();
         return $doc_rid;
     }
 }
 public function update_record()
 {
     $update_doc = array('doc_type' => $this->ci->get_typedoc(), 'descr' => $this->ci->input->post('descr'), 'archive' => $this->ci->input->post('archive'), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('modifyDT', 'now()', False);
     $this->db->trans_begin();
     $this->db->update('_documents', $update_doc, array('_documents.rid' => $this->ci->input->post('rid')));
Example #2
0
 public function update_record()
 {
     $update_arr = array('f_name' => $this->ci->input->post('f_name'), 's_name' => $this->ci->input->post('s_name'), 'l_name' => $this->ci->input->post('l_name'), 'f_name_lat' => $this->ci->input->post('f_name_lat'), 'l_name_lat' => $this->ci->input->post('l_name_lat'), 'birthday' => date('Y-m-d', strtotime($this->ci->input->post('birthday'))), 'bdate' => date('Y-m-d', strtotime($this->ci->input->post('bdate'))), 'edate' => $this->ci->input->post('edate') ? date('Y-m-d', strtotime($this->ci->input->post('edate'))) : null, 'passp_seria' => $this->ci->input->post('passp_seria'), 'passp_num' => $this->ci->input->post('passp_num'), 'fpassp_seria' => $this->ci->input->post('fpassp_seria'), 'fpassp_num' => $this->ci->input->post('fpassp_num'), 'stazh' => $this->ci->input->post('stazh'), 'email' => $this->ci->input->post('email'), 'nal_number' => $this->ci->input->post('nal_number'), 'is_legal' => $this->ci->input->post('is_legal'), 'descr' => $this->ci->input->post('descr'), 'archive' => $this->ci->input->post('archive'), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('modifyDT', 'now()', False);
     $this->db->trans_begin();
     $this->db->update('_employeers', $update_arr, array('rid' => $this->ci->input->post('rid')));
     if ($this->db->trans_status() === FALSE) {
         $this->db->trans_rollback();
         return False;
     } else {
         $this->db->trans_commit();
         return True;
     }
 }
Example #3
0
							_touroperators.contact_email as contact_email, 
							_touroperators.www as www,
							_touroperators.category as category, 
							_touroperators.contract as contract,
							_touroperators.payment_condition as payment_condition,
							DATE_FORMAT(_touroperators.contract_period, \'%d.%m.%Y\') as contract_period,
							_touroperators.adress as adress,
							_touroperators.fax as fax,
							_touroperators.contact_person as contact_person,
							DATE_FORMAT(_touroperators.modifyDT, \'%d.%m.%Y %H:%i\') as modifyDT, 
							_touroperators.owner_users_rid,
							_touroperators.descr as descr, _touroperators.archive', False);
        $this->db->from('_touroperators');
        $this->db->where(array('_touroperators.rid' => $rid));
Example #4
0
							_contrahens.owner_users_rid,
							_contrahens.descr as descr, _contrahens.archive', False);
        $this->db->from('_contrahens');
        $this->db->where(array('_contrahens.rid' => $rid));
        $query = $this->db_get('_contrahens');
        return $query->num_rows() ? $query->row() : False;
    }
    public function create_record()
    {
        $ins_arr = array('_cities_rid' => $this->ci->input->post('_cities_rid'), 'scontrahens_name' => $this->ci->input->post('scontrahens_name'), 'contrahens_name' => $this->ci->input->post('contrahens_name'), 'contact_phone' => $this->ci->input->post('contact_phone'), 'contact_email' => $this->ci->input->post('contact_email'), 'www' => $this->ci->input->post('www'), 'adress' => $this->ci->input->post('adress'), 'fax' => $this->ci->input->post('fax'), 'contact_person' => $this->ci->input->post('contact_person'), 'descr' => $this->ci->input->post('descr'), 'archive' => $this->ci->input->post('archive'), 'owner_users_rid' => get_curr_urid(), 'modifier_users_rid' => get_curr_urid());
        $this->db->set('createDT', 'now()', False);
        $this->db->set('modifyDT', 'now()', False);
        $this->db->trans_begin();
        $this->db->insert('_contrahens', $ins_arr);
Example #5
0
 public function update_record()
 {
     $update_arr = array('_employeers_rid' => $this->ci->input->post('_employeers_rid'), 'user_login' => $this->ci->input->post('user_login'), 'user_passwd' => $this->ci->input->post('user_passwd'), 'edate_passwd' => date('Y-m-d', strtotime($this->ci->input->post('edate_passwd'))), 'chdate_passwd' => date('Y-m-d', strtotime($this->ci->input->post('chdate_passwd'))), 'descr' => $this->ci->input->post('descr'), 'archive' => $this->ci->input->post('archive'), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('modifyDT', 'now()', False);
     $this->db->trans_begin();
     $this->db->update('_users', $update_arr, array('rid' => $this->ci->input->post('rid')));
     if ($this->db->trans_status() === FALSE) {
         $this->db->trans_rollback();
         return False;
     } else {
         $this->db->trans_commit();
         return True;
     }
 }
Example #6
0
 public function create_record()
 {
     $ins_arr = array('_positions_rid' => $this->ci->input->post('_positions_rid'), '_modules_rid' => $this->ci->input->post('_modules_rid') ? $this->ci->input->post('_modules_rid') : null, 'item_name' => $this->ci->input->post('item_name'), 'parent' => $this->ci->input->post('parent'), 'item_order' => $this->ci->input->post('item_order'), 'descr' => $this->ci->input->post('descr'), 'archive' => $this->ci->input->post('archive'), 'owner_users_rid' => get_curr_urid(), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('createDT', 'now()', False);
     $this->db->set('modifyDT', 'now()', False);
     $this->db->trans_begin();
     $this->db->insert('_positions_menus', $ins_arr);
     $insRid = $this->db->insert_id();
     if ($this->db->trans_status() === FALSE) {
         $this->db->trans_rollback();
         return False;
     } else {
         $this->db->trans_commit();
         return $insRid;
Example #7
0
								WHEN \'TOUROPERATOR\' THEN _finjournal.credit_touroperators_rid 
								WHEN \'CONTRAHENT\' THEN _finjournal.credit_contrahents_rid
							END) as creditor_rid, 
							(CASE _finjournal.debet_c_type 
								WHEN \'CLIENT\' THEN _finjournal.debet_clients_rid
								WHEN \'FILIAL\' THEN _finjournal.debet_filials_rid
								WHEN \'EMPLOYEER\' THEN _finjournal.debet_employeers_rid
								WHEN \'TOUROPERATOR\' THEN _finjournal.debet_touroperators_rid
								WHEN \'CONTRAHENT\' THEN _finjournal.debet_contrahents_rid  
							END) as debetor_rid, 
							
							_finjournal._currencies_rid as _currencies_rid,
							DATE_FORMAT(_finjournal.oper_date, \'%d.%m.%Y\') as oper_date,
							_finjournal._account_states_rid as _account_states_rid,
Example #8
0
 public function update_record()
 {
     $update_arr = array('code' => $this->ci->input->post('code'), 'food_name' => $this->ci->input->post('food_name'), 'descr' => $this->ci->input->post('descr'), 'archive' => $this->ci->input->post('archive'), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('modifyDT', 'now()', False);
     $this->db->trans_begin();
     $this->db->update('_food', $update_arr, array('rid' => $this->ci->input->post('rid')));
     if ($this->db->trans_status() === FALSE) {
         $this->db->trans_rollback();
         return False;
     } else {
         $this->db->trans_commit();
         return True;
     }
 }
Example #9
0
 public function create_record()
 {
     $ins_arr = array('descr' => $this->ci->input->post('mess'), 'owner_users_rid' => get_curr_urid(), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('createDT', 'now()', False);
     $this->db->set('modifyDT', 'now()', False);
     $this->db->trans_begin();
     $this->db->insert('_chat', $ins_arr);
     $insRid = $this->db->insert_id();
     if ($this->db->trans_status() === FALSE) {
         $this->db->trans_rollback();
         return False;
     } else {
         $this->db->trans_commit();
         return $insRid;
     }
 }
Example #10
0
     $this->db->trans_begin();
     $this->db->insert('_documents', $ins_doc);
     $doc_rid = $this->db->insert_id();
     $ins_h = array('date_doc' => date('Y-m-d', strtotime($this->ci->input->post('date_doc'))), '_documents_rid' => $doc_rid, 'owner_users_rid' => get_curr_urid(), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('createDT', 'now()', False);
     $this->db->set('modifyDT', 'now()', False);
     $this->db->insert('_inout_headers', $ins_h);
     if ($this->db->trans_status() === FALSE) {
         $this->db->trans_rollback();
         return False;
     } else {
         $this->db->trans_commit();
         return $doc_rid;
     }
 }
 public function update_record()
 {
Example #11
0
     $this->db->trans_begin();
     $this->db->insert('_modules', $ins_arr);
     $insRid = $this->db->insert_id();
     if ($this->db->trans_status() === FALSE) {
         $this->db->trans_rollback();
         return False;
     } else {
         $this->db->trans_commit();
         return $insRid;
     }
 }
 public function update_record()
 {
     $update_arr = array('module_name' => $this->ci->input->post('module_name'), 'module_controller' => $this->ci->input->post('module_controller'), 'descr' => $this->ci->input->post('descr'), 'archive' => $this->ci->input->post('archive'), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('modifyDT', 'now()', False);
     $this->db->trans_begin();
     $this->db->update('_modules', $update_arr, array('rid' => $this->ci->input->post('rid')));
     $this->db->delete('_modules_permissions', array('_modules_rid' => $this->ci->input->post('rid')));
     foreach ($this->ci->input->post('permissions') as $positions_rid => $p) {
Example #12
0
 public function update_record()
 {
     $update_arr = array('parent' => $this->ci->input->post('parent'), 'f_name' => $this->ci->input->post('f_name'), 's_name' => $this->ci->input->post('s_name'), 'l_name' => $this->ci->input->post('l_name'), 'f_name_lat' => $this->ci->input->post('f_name_lat'), 'l_name_lat' => $this->ci->input->post('l_name_lat'), 'sex' => $this->ci->input->post('sex'), 'birthday' => date('Y-m-d', strtotime($this->ci->input->post('birthday'))), '_countries_rid' => $this->ci->input->post('_countries_rid'), 'passp_seria' => $this->ci->input->post('passp_seria'), 'passp_num' => $this->ci->input->post('passp_num'), 'passp_out' => $this->ci->input->post('passp_out'), 'f_pass_out' => $this->ci->input->post('f_pass_out'), 'f_pass_seria' => $this->ci->input->post('f_pass_seria'), 'f_pass_num' => $this->ci->input->post('f_pass_num'), 'f_pass_period' => $this->ci->input->post('f_pass_period') ? date('Y-m-d', strtotime($this->ci->input->post('f_pass_period'))) : null, 'nal_number' => $this->ci->input->post('nal_number'), '_cities_rid' => $this->ci->input->post('_cities_rid'), '_dcarts_rid' => $this->ci->input->post('_dcarts_rid') ? $this->ci->input->post('_dcarts_rid') : null, 'adress' => $this->ci->input->post('adress'), 'phones' => $this->ci->input->post('phones'), 'email' => $this->ci->input->post('email'), 'descr' => $this->ci->input->post('descr'), 'archive' => $this->ci->input->post('archive'), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('modifyDT', 'now()', False);
     $this->db->trans_begin();
     $this->db->update('_clients', $update_arr, array('rid' => $this->ci->input->post('rid')));
     $this->db->delete('_clients_interests', array('_clients_rid' => $this->ci->input->post('rid')));
     foreach ($this->ci->input->post('_clients_interests') as $_interests_rid => $mark) {
         $ins_r = array('_clients_rid' => $this->ci->input->post('rid'), '_interests_rid' => $_interests_rid, 'mark' => $mark);
         $this->db->insert('_clients_interests', $ins_r);
     }
     if ($this->db->trans_status() === FALSE) {
         $this->db->trans_rollback();
         return False;
     } else {
         $this->db->trans_commit();
         return True;
     }
 }
Example #13
0
     $this->db->from('_hotels');
     $this->db->join('_hotelscats', '_hotels._hotelscats_rid = _hotelscats.rid');
     $this->db->where(array('_hotels.rid' => $rid));
     $this->db->order_by('hotel_name');
     $query = $this->db->get();
     return $query->num_rows() ? $query->row()->hotel_full_name : null;
 }
 public function get_synonims($rid)
 {
     $this->db->select('_hotelssynonims.*');
     $this->db->from('_hotelssynonims');
     $this->db->where(array('_hotelssynonims._hotels_rid' => $rid));
     $this->db->order_by('_hotelssynonims.hotel_name');
     $query = $this->db->get();
     return $query->num_rows() ? $query->result() : array();
 }
Example #14
0
 public function close_task()
 {
     $task = $this->get_edit($this->ci->input->post('rid'));
     $update_arr = array('done' => $task->done ? 0 : 1, 'modifier_users_rid' => get_curr_urid());
     $this->db->set('createDT', 'now()', False);
     $this->db->set('modifyDT', 'now()', False);
     $this->db->trans_begin();
     $this->db->update('_tasks', $update_arr, array('rid' => $this->ci->input->post('rid')));
     if ($this->db->trans_status() === FALSE) {
         $this->db->trans_rollback();
         return False;
     } else {
         $this->db->trans_commit();
         return True;
     }
 }
Example #15
0
     $this->db->set('createDT', 'now()', False);
     $this->db->set('modifyDT', 'now()', False);
     $this->db->trans_begin();
     $this->db->insert('_documents', $ins_doc);
     $doc_rid = $this->db->insert_id();
     $ins_h = array('date_doc' => date('Y-m-d H:i', strtotime($this->ci->input->post('date_doc') . ' ' . $this->ci->input->post('time_doc'))), '_documents_rid' => $doc_rid, 'owner_users_rid' => get_curr_urid(), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('createDT', 'now()', False);
     $this->db->set('modifyDT', 'now()', False);
     $this->db->insert('_calls_headers', $ins_h);
     $h_rid = $this->db->insert_id();
     $ins_r = array('_calls_headers_rid' => $h_rid, '_clients_rid' => $this->ci->input->post('_clients_rid') ? $this->ci->input->post('_clients_rid') : null, '_advertisessources_rid' => $this->ci->input->post('_advertisessources_rid'), '_currencies_rid' => $this->ci->input->post('_currencies_rid'), 'f_name' => $this->ci->input->post('f_name'), 's_name' => $this->ci->input->post('s_name'), 'l_name' => $this->ci->input->post('l_name'), 'date_from' => date('Y-m-d', strtotime($this->ci->input->post('date_from'))), 'date_to' => date('Y-m-d', strtotime($this->ci->input->post('date_to'))), 'sum_wanted_to' => $this->ci->input->post('sum_wanted_to'), 'tourists_wish' => $this->ci->input->post('tourists_wish'), 'tourists_quan' => $this->ci->input->post('tourists_quan'), 'chields_quan' => $this->ci->input->post('chields_quan'), 'tourists_offers' => $this->ci->input->post('tourists_offers'), 'tourists_answers' => $this->ci->input->post('tourists_answers'), 'phones' => $this->ci->input->post('phones'), 'email' => $this->ci->input->post('email'), 'owner_users_rid' => get_curr_urid(), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('createDT', 'now()', False);
     $this->db->set('modifyDT', 'now()', False);
     $this->db->insert('_calls_rows', $ins_r);
     foreach ($this->ci->input->post('_hotelscats_rid') as $h_cat) {
         $ins_r = array('_calls_headers_rid' => $h_rid, '_hotelscats_rid' => $h_cat);
         $this->db->insert('_calls_hcats', $ins_r);
     }
     foreach ($this->ci->input->post('_food_rid') as $h_cat) {
         $ins_r = array('_calls_headers_rid' => $h_rid, '_food_rid' => $h_cat);
         $this->db->insert('_calls_food', $ins_r);
     }
     foreach ($this->ci->input->post('_countries_rids') as $country_rid) {
         $ins_r = array('_calls_headers_rid' => $h_rid, '_countries_rid' => $country_rid);
         $this->db->insert('_calls_countries', $ins_r);
     }
     if ($this->ci->input->post('_curourts_rids')) {
         foreach ($this->ci->input->post('_curourts_rids') as $curourt_rid) {
             $ins_r = array('_calls_headers_rid' => $h_rid, '_curourts_rid' => $curourt_rid);
             $this->db->insert('_calls_curourts', $ins_r);
         }
     }
     if ($this->db->trans_status() === FALSE) {
         $this->db->trans_rollback();
         return False;
     } else {
         $this->db->trans_commit();
         return $doc_rid;
     }
 }
 public function update_record()
 {
     $update_doc = array('doc_type' => $this->ci->get_typedoc(), 'descr' => $this->ci->input->post('descr'), 'archive' => $this->ci->input->post('archive'), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('modifyDT', 'now()', False);
     $this->db->trans_begin();
     $this->db->update('_documents', $update_doc, array('_documents.rid' => $this->ci->input->post('rid')));
     $update_h = array('date_doc' => date('Y-m-d H:i', strtotime($this->ci->input->post('date_doc') . ' ' . $this->ci->input->post('time_doc'))), 'modifier_users_rid' => get_curr_urid());
Example #16
0
 private function chpass_processing($passwd)
 {
     return $this->user_model->cp(get_curr_urid(), $passwd, $this->config->item('crm_chpass_period'));
 }
Example #17
0
 public function update_record()
 {
     $update_doc = array('doc_type' => $this->ci->get_typedoc(), 'descr' => $this->ci->input->post('descr'), 'archive' => $this->ci->input->post('archive'), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('modifyDT', 'now()', False);
     $this->db->trans_begin();
     $this->db->update('_documents', $update_doc, array('_documents.rid' => $this->ci->input->post('rid')));
     $query = $this->db->getwhere('_airsell_headers', array('_airsell_headers._documents_rid' => $this->ci->input->post('rid')));
     if (!$query->num_rows()) {
         $this->db->trans_rollback();
         return False;
     }
     $h_rid = $query->row()->rid;
     $update_h = array('date_doc' => date('Y-m-d', strtotime($this->ci->input->post('date_doc'))), '_advertisessources_rid' => $this->ci->input->post('_advertisessources_rid'), '_aircalls_documents_rid' => $this->ci->input->post('_aircalls_documents_rid') ? $this->ci->input->post('_aircalls_documents_rid') : null, '_clients_rid' => $this->ci->input->post('_clients_rid'), 'dnum' => $this->ci->input->post('dnum') ? $this->ci->input->post('dnum') : $this->ci->input->post('rid'), 'anulated' => $this->ci->input->post('anulated'), 'issue' => $this->ci->input->post('issue'), 'bill_code' => $this->ci->input->post('bill_code'), 'bill_num' => $this->ci->input->post('bill_num'), 'brone_locator' => $this->ci->input->post('brone_locator'), 'sum' => $this->ci->input->post('sum'), '_currencies_rid' => $this->ci->input->post('_currencies_rid') ? $this->ci->input->post('_currencies_rid') : null, 'archive' => $this->ci->input->post('archive'), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('modifyDT', 'now()', False);
     $this->db->update('_airsell_headers', $update_h, array('_airsell_headers.rid' => $h_rid));
     $this->db->delete('_airsell_routes', array('_airsell_routes._airsell_headers_rid' => $h_rid));
     foreach ($this->ci->input->post('_aircompanies_rids') as $key => $route) {
         $ins_r = array('_airsell_headers_rid' => $h_rid, '_aircompanies_rid' => element($key, $this->input->post('_aircompanies_rids'), null), 'air_class' => element($key, $this->input->post('air_classes'), null), '_countries_rid_from' => element($key, $this->input->post('_countries_rids_from'), null), '_countries_rid_to' => element($key, $this->input->post('_countries_rids_to'), null), 'point_from' => element($key, $this->input->post('points_from'), null), 'point_to' => element($key, $this->input->post('points_to'), null), 'departure' => date('Y-m-d', strtotime(element($key, $this->input->post('departures'), null))), 'arrival' => date('Y-m-d', strtotime(element($key, $this->input->post('arrivals'), null))), 'owner_users_rid' => get_curr_urid(), 'modifier_users_rid' => get_curr_urid());
         $this->db->insert('_airsell_routes', $ins_r);
     }
     if ($this->db->trans_status() === FALSE) {
         $this->db->trans_rollback();
         return False;
     } else {
         $this->db->trans_commit();
         return $this->ci->input->post('rid');
     }
 }
Example #18
0
 public function update_record()
 {
     $update_doc = array('doc_type' => $this->ci->get_typedoc(), 'descr' => $this->ci->input->post('descr'), 'archive' => $this->ci->input->post('archive'), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('modifyDT', 'now()', False);
     $this->db->trans_begin();
     $this->db->update('_documents', $update_doc, array('_documents.rid' => $this->ci->input->post('rid')));
     $query = $this->db->getwhere('_demands_headers', array('_demands_headers._documents_rid' => $this->ci->input->post('rid')));
     if (!$query->num_rows()) {
         $this->db->trans_rollback();
         return False;
     }
     $h_rid = $query->row()->rid;
     $tour_rid = $query->row()->_tours_rid;
     $update_tours = array('_touroperators_rid' => $this->ci->input->post('_touroperators_rid'), '_food_rid' => $this->ci->input->post('_food_rid'), '_rooms_rid' => $this->ci->input->post('_rooms_rid'), '_currencies_rid' => $this->ci->input->post('_currencies_rid'), 'room_cat' => $this->ci->input->post('room_cat'), 'route' => $this->ci->input->post('route'), '_hotels_rid' => $this->ci->input->post('_hotels_rid') ? $this->ci->input->post('_hotels_rid') : null, '_countries_rid' => $this->ci->input->post('_countries_rid'), '_curourts_rid' => $this->ci->input->post('_curourts_rid') ? $this->ci->input->post('_curourts_rid') : null, 'date_from' => date('Y-m-d', strtotime($this->ci->input->post('date_from'))), 'date_to' => date('Y-m-d', strtotime($this->ci->input->post('date_to'))), 'order_date' => date('Y-m-d', strtotime($this->ci->input->post('order_date'))), 'order_sum' => $this->ci->input->post('order_sum'), 'order_num' => $this->ci->input->post('order_num'), 'transfer' => $this->ci->input->post('transfer'), 'excursions' => $this->ci->input->post('excursions'), 'visa' => $this->ci->input->post('visa'), 'cif' => $this->ci->input->post('cif'), 'approve' => $this->ci->input->post('approve'), 'anulated' => $this->ci->input->post('anulated'), 'tour_num' => $this->ci->input->post('tour_num'), 'sum_tour' => $this->ci->input->post('sum_tour'), 'cource' => $this->ci->input->post('cource'), 'to_koeff' => $this->ci->input->post('to_koeff'), 'discount_fix' => $this->ci->input->post('discount_fix'), 'discount_per' => $this->ci->input->post('discount_per'), 'sum' => $this->ci->recalc(), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('modifyDT', 'now()', False);
     $this->db->update('_tours', $update_tours, array('_tours.rid' => $tour_rid));
     $update_h = array('date_doc' => date('Y-m-d', strtotime($this->ci->input->post('date_doc'))), '_advertisessources_rid' => $this->ci->input->post('_advertisessources_rid'), '_calls_documents_rid' => $this->ci->input->post('_calls_documents_rid') ? $this->ci->input->post('_calls_documents_rid') : null, '_tours_rid' => $tour_rid, 'agreement' => $this->ci->input->post('rid') . '-' . date('d/m/Y'), 'archive' => $this->ci->input->post('archive'), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('modifyDT', 'now()', False);
     $this->db->update('_demands_headers', $update_h, array('_demands_headers._documents_rid' => $this->ci->input->post('rid')));
     $this->db->delete('_demands_rows', array('_demands_rows._demands_headers_rid' => $h_rid));
     # выясняем кто заказчик и является ли он туристом
     $demander = floatval($this->ci->input->post('demander'));
     $demander_t = false;
     # заказчик не турист
     $demander_arr = explode('_', $this->ci->input->post('demander'));
     if (count($demander_arr) > 1 && $demander_arr[1] == 'Z') {
         $demander_t = True;
     }
     foreach ($this->ci->input->post('_cl_rid') as $cl_rid) {
         $ins_r = array('_demands_headers_rid' => $h_rid, '_clients_rid' => $cl_rid, 'demander' => $cl_rid == $demander, 'tourist' => $cl_rid == $demander ? $demander_t : True, 'owner_users_rid' => get_curr_urid(), 'modifier_users_rid' => get_curr_urid());
         $this->db->insert('_demands_rows', $ins_r);
     }
     if ($this->db->trans_status() === FALSE) {
         $this->db->trans_rollback();
         return False;
     } else {
         $this->db->trans_commit();
         return $this->ci->input->post('rid');
     }
 }
Example #19
0
         $this->db->trans_commit();
         return $doc_rid;
     }
 }
 public function get_rows($rid)
 {
     $this->db->select('_advertises_rows._filials_rid as filial, _advertises_rows.sum as sum');
     $this->db->from('_advertises_rows');
     $this->db->join('_advertises_headers', '_advertises_headers.rid = _advertises_rows._advertises_headers_rid');
     $this->db->where(array('_advertises_headers._documents_rid' => $rid));
     $query = $this->db_get('_documents');
     return $query->num_rows() ? $query->result_array() : array();
 }
 public function get_all_filials()
 {
     $query = $this->db->select("_filials.rid as filial")->from('_filials')->order_by('_filials.name')->get();
     return $query->num_rows() ? $query->result_array() : array();
 }
 public function update_record()
 {
     $update_doc = array('doc_type' => $this->ci->get_typedoc(), 'descr' => $this->ci->input->post('descr'), 'archive' => $this->ci->input->post('archive'), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('modifyDT', 'now()', False);
     $this->db->trans_begin();
     $this->db->update('_documents', $update_doc, array('_documents.rid' => $this->ci->input->post('rid')));
     $sums = $this->input->post('row_sum') ? $this->input->post('row_sum') : array();
     $sum = 0;
     foreach ($sums as $s) {
         $sum += $s;
     }
     $update_h = array('date_doc' => date('Y-m-d', strtotime($this->ci->input->post('date_doc'))), '_advertisescompanies_rid' => $this->ci->input->post('_advertisescompanies_rid'), '_advertisessources_rid' => $this->ci->input->post('_advertisessources_rid'), '_currencies_rid' => $this->ci->input->post('_currencies_rid'), 'bdate' => date('Y-m-d', strtotime($this->ci->input->post('bdate'))), 'edate' => date('Y-m-d', strtotime($this->ci->input->post('edate'))), 'sum' => floatval($sum), 'modifier_users_rid' => get_curr_urid());
     $this->db->set('modifyDT', 'now()', False);
     $this->db->update('_advertises_headers', $update_h, array('_advertises_headers._documents_rid' => $this->ci->input->post('rid')));
     $query = $this->db->getwhere('_advertises_headers', array('_advertises_headers._documents_rid' => $this->ci->input->post('rid')));
     if (!$query->num_rows()) {
         $this->db->trans_rollback();
         return False;