siddharth_application/application/models/Zohobook_api_model.php
2023-07-07 11:28:11 +05:30

75 lines
2.0 KiB
PHP

<?php
class Zohobook_api_model extends CI_Model {
public function ip_tax_rates($gst)
{
$this->db->select();
$this->db->from('ip_tax_rates');
$this->db->where('tax_rate_percent', $gst);
$query = $this->db->get();
$query = $query->result_array();
return $query;
}
public function ip_clients($gst_no)
{
$this->db->select();
$this->db->from('ip_clients');
$this->db->where('client_tax_code', $gst_no);
$query = $this->db->get();
$query = $query->result_array();
return $query;
}
public function ip_products($sku)
{
$this->db->select();
$this->db->from('ip_products');
$this->db->where('sku', $sku);
$query = $this->db->get();
$query = $query->result_array();
return $query;
}
public function ip_invoices($invoice_number , $invoice_date)
{
$this->db->select();
$this->db->from('ip_invoices');
$this->db->where('invoice_number', $invoice_number);
$this->db->where('invoice_date_created', $invoice_date);
$query = $this->db->get();
$query = $query->num_rows();
return $query;
}
public function insert($data,$table)
{
$this->db->insert($table,$data);
return $this->db->insert_id();
}
function sql_invoice_update($action, $invoice_number, $invoice_date_created ,$table)
{
$this->db->where('invoice_number',$invoice_number);
$this->db->where('invoice_date_created',$invoice_date_created);
$this->db->update($table,$action);
return true;
}
function get_data($table ,$col_name ,$id)
{
$this->db->select();
$this->db->from($table);
$this->db->where($col_name , $id);
$query = $this->db->get();
$query = $query->result_array();
return $query;
}
function update($action,$id,$table){
$this->db->where('id',$id);
$this->db->update($table,$action);
}
}