-
Anonymous
В моей модели есть два разных типа условий для проверки номера lr_no. Как я могу проверить условие if else в контроллере
Сообщение
Anonymous »
В моей модели у меня есть два разных типа условия для проверки lr_no как я могу проверить условие в элементе управления? Я пытаюсь вот так.
Просмотр:
Код: Выделить всё
$('#lr_no').change(function(event) {
var lr_no = $('#lr_no').val();
$.ajax({
url : "crossing/crossing_cash_memo/CashMemoController/fetchCrossType",
type:"POST",
dataType: "json",
data: {
lr_no :lr_no
},
success: function(data){
console.log(data);
},
error:function(data){
alert("error message"+data);
},async:false,
});
});
контроллер:
Код: Выделить всё
public function fetchCrossType(){
$id = $this->input->post('lr_no');
}
Модель:
Код: Выделить всё
public function getBiltyNo($lr_no){
$crossQuery = $this->db->select('*')
->from('truck_freight')
->join('crossing_received', 'crossing_received.crossing_rec_frtno = truck_freight.fr_memo_ids')
->where('crossing_rec_type','cross_received')
->get()->result();
if ($crossQuery != "") {
$query = $this->db->select('*')
->from('truck_freight')
->join('crossing_received', 'crossing_received.crossing_rec_frtno = truck_freight.fr_memo_ids')
->join('frieght_challan', 'frieght_challan.frieght_id = truck_freight.fr_memo_ids')
->join('challan_bilties', 'challan_bilties.challan_id = frieght_challan.dispatch_id')
->join('bilty', 'bilty.id = challan_bilties.bilty_id')
->join('delivery_stock',"bilty.id = delivery_stock.sbilty_id")
->where('sstatus','delivery_bilty')
->where('lr_no', $lr_no)
->get()->num_rows();
if ($query >0) {
return array('form_message' => 'LR no Found', 'form_status' => 'bilty_found');
} else {
return array('form_message' => 'LR NO not found (in Crossing Received)', 'form_status' => 'biltynotfound');
}
} else {
return array('form_message' => 'crossing not received', 'form_status' => 'notRecevied');
}
}
public function getBiltyByNo($bilty_no){
$crossQuery = $this->db->select('*')
->from('delivery_local_truck_freight')
->join('crossing_received', 'crossing_received.crossing_rec_frtno = delivery_local_truck_freight.loc_truck_ids')
->where('crossing_rec_type', 'del_loc_cross_received')
->get()->num_rows();
if ($crossQuery > 0) {
$query = $this->db->select('*')
->from('delivery_local_truck_freight')
->join('crossing_received', 'crossing_received.crossing_rec_frtno = delivery_local_truck_freight.loc_truck_ids')
->join('delivery_local_freight_challan', 'delivery_local_freight_challan.loc_frieght_id = delivery_local_truck_freight.loc_truck_ids')
->join('delivery_local_challan_bilties', 'delivery_local_challan_bilties.challan_id = delivery_local_freight_challan.local_id')
->join('bilty', 'bilty.id = delivery_local_challan_bilties.bilty_id')
->join('delivery_stock',"bilty.id = delivery_stock.sbilty_id")
->where('sstatus','delivery_local_received')
->where('crossing_received.crossing_rec_type','del_loc_cross_received')
->where('lr_no', $bilty_no)
->get()->num_rows();
if ($query == 1) {
return array('form_message' => 'LR NO Found', 'form_status' => 'bilty_found');
} else {
return array('form_message' => 'LR No not found (in Delivery Crossing Received)', 'form_status' => 'biltynotfound');
}
} else {
return array('form_message' => 'crossing not received', 'form_status' => 'notRecevied');
}
}
Как проверить состояние в контроллере для двух разных условий модели
Подробнее здесь:
https://stackoverflow.com/questions/572 ... ber-how-ca
1768535808
Anonymous
В моей модели у меня есть два разных типа условия для проверки lr_no как я могу проверить условие в элементе управления? Я пытаюсь вот так.
Просмотр:
[code]$('#lr_no').change(function(event) {
var lr_no = $('#lr_no').val();
$.ajax({
url : "crossing/crossing_cash_memo/CashMemoController/fetchCrossType",
type:"POST",
dataType: "json",
data: {
lr_no :lr_no
},
success: function(data){
console.log(data);
},
error:function(data){
alert("error message"+data);
},async:false,
});
});
[/code]
контроллер:
[code]public function fetchCrossType(){
$id = $this->input->post('lr_no');
}
[/code]
Модель:
[code] public function getBiltyNo($lr_no){
$crossQuery = $this->db->select('*')
->from('truck_freight')
->join('crossing_received', 'crossing_received.crossing_rec_frtno = truck_freight.fr_memo_ids')
->where('crossing_rec_type','cross_received')
->get()->result();
if ($crossQuery != "") {
$query = $this->db->select('*')
->from('truck_freight')
->join('crossing_received', 'crossing_received.crossing_rec_frtno = truck_freight.fr_memo_ids')
->join('frieght_challan', 'frieght_challan.frieght_id = truck_freight.fr_memo_ids')
->join('challan_bilties', 'challan_bilties.challan_id = frieght_challan.dispatch_id')
->join('bilty', 'bilty.id = challan_bilties.bilty_id')
->join('delivery_stock',"bilty.id = delivery_stock.sbilty_id")
->where('sstatus','delivery_bilty')
->where('lr_no', $lr_no)
->get()->num_rows();
if ($query >0) {
return array('form_message' => 'LR no Found', 'form_status' => 'bilty_found');
} else {
return array('form_message' => 'LR NO not found (in Crossing Received)', 'form_status' => 'biltynotfound');
}
} else {
return array('form_message' => 'crossing not received', 'form_status' => 'notRecevied');
}
}
public function getBiltyByNo($bilty_no){
$crossQuery = $this->db->select('*')
->from('delivery_local_truck_freight')
->join('crossing_received', 'crossing_received.crossing_rec_frtno = delivery_local_truck_freight.loc_truck_ids')
->where('crossing_rec_type', 'del_loc_cross_received')
->get()->num_rows();
if ($crossQuery > 0) {
$query = $this->db->select('*')
->from('delivery_local_truck_freight')
->join('crossing_received', 'crossing_received.crossing_rec_frtno = delivery_local_truck_freight.loc_truck_ids')
->join('delivery_local_freight_challan', 'delivery_local_freight_challan.loc_frieght_id = delivery_local_truck_freight.loc_truck_ids')
->join('delivery_local_challan_bilties', 'delivery_local_challan_bilties.challan_id = delivery_local_freight_challan.local_id')
->join('bilty', 'bilty.id = delivery_local_challan_bilties.bilty_id')
->join('delivery_stock',"bilty.id = delivery_stock.sbilty_id")
->where('sstatus','delivery_local_received')
->where('crossing_received.crossing_rec_type','del_loc_cross_received')
->where('lr_no', $bilty_no)
->get()->num_rows();
if ($query == 1) {
return array('form_message' => 'LR NO Found', 'form_status' => 'bilty_found');
} else {
return array('form_message' => 'LR No not found (in Delivery Crossing Received)', 'form_status' => 'biltynotfound');
}
} else {
return array('form_message' => 'crossing not received', 'form_status' => 'notRecevied');
}
}
[/code]
Как проверить состояние в контроллере для двух разных условий модели
Подробнее здесь: [url]https://stackoverflow.com/questions/57217806/i-have-two-different-types-of-condition-in-my-model-to-check-lr-no-number-how-ca[/url]