ria/app/Models/Zohobook_api_model.php
2025-02-03 14:16:50 +05:30

98 lines
2.6 KiB
PHP
Executable File

<?php
namespace App\Models;
use CodeIgniter\Model;
class Zohobook_api_model extends Model
{
public function ip_tax_rates($gst)
{
$builder = $this->db->table('ip_tax_rates')
->where('tax_rate_percent', $gst)
->get();
$query = $builder->getResultArray();
return $query;
}
public function ip_clients($gst_no)
{
$builder = $this->db->table('ip_clients')
->where('client_tax_code', $gst_no)
->get();
$query = $builder->getResultArray();
return $query;
}
public function ip_client_ashok_leyland($gst_no,$customer_id)
{
$builder = $this->db->table('ip_clients')
->where('client_tax_code', $gst_no)
->where('customer_id', $customer_id)
->get();
$query = $builder->getResultArray();
return $query;
}
public function ip_products($sku)
{
$builder = $this->db->table('ip_products')
->where('sku', $sku)
->get();
$query = $builder->getResultArray();
return $query;
}
public function ip_invoices($invoice_number, $invoice_date)
{
$builder = $this->db->table('ip_invoices')
->where('invoice_number', $invoice_number)
->where('invoice_date_created', $invoice_date)
->get();
$query = $builder->getNumRows();
return $query;
}
// public function insert($data,$table)
public function customInsert($data, $table)
{
$builder = $this->db->table($table);
$builder->insert($data);
return $this->db->insertID();
}
function sql_invoice_update($action, $invoice_number, $invoice_date_created, $table)
{
// echo 'model';
// print_r($action);
// echo '<br>';
$this->db->table($table)
->where('invoice_number', $invoice_number)
->where('invoice_date_created', $invoice_date_created)
->update($action);
$count = $this->db->affectedRows();
return true;
}
function get_data($table, $col_name, $id)
{
$builder = $this->db->table($table)
->select('*')->where($col_name, $id);
$query = $builder->get();
$query = $query->getResultArray();
return $query;
}
// function update($action,$id,$table){
function customUpdate($action, $id, $table)
{
$this->db->table($table)
->where('id', $id)
->update($action);
$count = $this->db->affectedRows();
return $count;
}
}