New Code for ZOHO API And table_name in Small Charater changes : ps

This commit is contained in:
VE10-Sanjeev 2024-03-14 16:43:12 +05:30
parent 2b0af09121
commit d1c8f65800
30 changed files with 1346 additions and 773 deletions

View File

@ -371,7 +371,7 @@ function add($pathname)
$ServiceTypeOptions=$this->input->post('PoTypeOptions');
$DescriptionOfPo = $this->input->post('emergdescofpo');
//create T_Requestion_Master
//create t_requestion_master
$Request = array('ReqType'=>$POType, 'RequestedDept'=>$RequestedBy,'CostCenterCode'=>$CostCenterName,'Status'=>$ReqStatus,'Comments'=>$RequistionComments,'ReqDate'=>$createddt,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy,'Schedule_Type'=>$ServiceScheduleType,'NumberOfService'=>$ServiceServiceNo,'Service_Period'=>$ServiceScheduleOptions);
$Req = $this->requistion_model->addRequistion($Request);

View File

@ -1,4 +1,4 @@
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
<?php if(!defined('BASEPATH')) exit('No direct scri-pt access allowed');
/**
* Class : Login (LoginController)
@ -16,6 +16,8 @@ class Login extends CI_Controller
{
parent::__construct();
$this->load->model('login_model');
$this->load->model('Zohobook_api_model','Zohobook_model');
$this->load->helper('zohobooks_fetch_api_helper');
}
/**
@ -252,6 +254,354 @@ class Login extends CI_Controller
*
* }
*/
function zohobooks_api_fetch_all()
{
try {
$this->load->helper('zohobooks_fetch_api_helper');
if (isset($_GET['from']) && $_GET['from'] != null && isset($_GET['to']) && $_GET['to'] != null) {
$date_today = $_GET['to'];
$date_yesterday = $_GET['from'];
} else {
$date_today = date('Y-m-d');
$date_yesterday = date('Y-m-d',strtotime('-3 day',strtotime($date_today)));
}
$chk_acc_token_val = $this->Zohobook_model->get_data('zohobook_accesstoken', 'id', 1);
$date = new DateTime($chk_acc_token_val[0]['created_at']);
$date->add(new DateInterval('PT1H'));
//echo '****************';
//print_r(date('Y-m-d h:i:s'));
$token = 0;
// echo $chk_acc_token_val;die;
// echo $token = $chk_acc_token_val[0]['token'];
if ($date->format('Y-m-d H:i:s') > date('Y-m-d H:i:s')) {
$token = $chk_acc_token_val[0]['token'];
$tokendata['token'] = $token;
} else {
$token = generateNewToken();
$tokendata['token'] = $token;
$this->Zohobook_model->update($tokendata, 1, 'zohobook_accesstoken');
}
$result = getheringInvoiceDetails($date_today, $date_yesterday, $token);
$headers_new = $result['headers_new'];
$res = json_decode($result['data'], true);
if(isset($res['invoices']) && !empty($res['invoices'])){
$inv_array = $res['invoices'];
// echo json_encode($inv_array);die;
}else{
$inv_array = array();
log_message('ERROR', $res['message']);
echo "An Error Occur ==> " .$res['message']." \n <br> ";
throw new \Exception($res['message']);
}
if(!empty($inv_array)){
foreach ($inv_array as $inv) {
$invoice_id = $inv['invoice_id'];
//filter only einvoice status pushed invoices only
//&& isset($inv['einvoice_details']) && isset($inv['einvoice_details']['status']) && ($inv['einvoice_details']['status'] == 'pushed')
if ($invoice_id !== "") {
// $organization_id = '655654572';
$organization_id = '776847408';
$result2 = getheringInvoiceSubDetails($invoice_id, $organization_id, $headers_new);
$resall = json_decode($result2, true);
$res2[] = $resall['invoice'];
}
}
$insert_count = 0;
$update_count = 0;
// echo json_encode($res2);die();
foreach ($res2 as $rs) {
$gst_no = $rs['gst_no'];
$invoice_number = $rs['invoice_number'];
$invoice_date = $rs['date'];
$status = $rs['status'];
$due_date = $rs['due_date'];
$invoice_time = $rs['created_time'];
$time_array = explode("T", $invoice_time);
$time_array = explode("+", $time_array[1]);
$invoice_time = $time_array[0];
$sql_invoice_chk = $this->Zohobook_model->ip_invoices($invoice_number, $invoice_date);
if ($sql_invoice_chk <= 0) {
$gst_sql = $this->Zohobook_model->ip_clients($gst_no);
if ($gst_sql) {
$client_id = $gst_sql[0]['client_id'];
log_message('error', 'Data fetch success DB : ip_clients , client_id : ' . $client_id);
} else {
log_message('error', 'No data => Data fetch failed DB : ip_clients ' . $gst_no);
$gst_no_data['client_tax_code'] = $gst_no;
$gst_sql = $this->Zohobook_model->insert($gst_no_data, 'ip_clients');
$client_id = $gst_sql[0]['tax_rate_id'];
log_message('error', 'New Data Created : DB : ip_clients , client_id : ' . $client_id);
}
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < 16; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
$url_key = $randomString;
$ip_invoices['user_id'] = 1;
$ip_invoices['client_id'] = $client_id;
$ip_invoices['invoice_group_id'] = 6;
$ip_invoices['invoice_status_id'] = ($status == 'draft' ? 1 : (($status == 'sent' || $status == 'overdue') ? 2 : 5));
$ip_invoices['invoice_date_created'] = $invoice_date;
$ip_invoices['invoice_time_created'] = $invoice_time;
$ip_invoices['invoice_date_due'] = $due_date;
$ip_invoices['invoice_number'] = $invoice_number;
$ip_invoices['invoice_url_key'] = $url_key;
$ip_invoices['receivedstatus'] = 'ST066';
$ip_invoices['credit_status'] = 0;
$invoice_insert_id = $this->Zohobook_model->insert($ip_invoices, 'ip_invoices');
if ($invoice_insert_id) {
log_message('error', 'Data insert success DB : ip_invoices client id :' . $client_id);
$insert_count = $insert_count + 1;
//start invoice level custom fields
//custom fields insert
$batch_no = isset($rs['custom_fields'][5]['value']) ? $rs['custom_fields'][5]['value'] : "";
$vehicle_number = isset($rs['custom_field_hash']['cf_vehicle_number']) ? $rs['custom_field_hash']['cf_vehicle_number'] : "";
$transport_mode = isset($rs['custom_field_hash']['cf_transport_mode']) ? $rs['custom_field_hash']['cf_transport_mode'] : "";
$purchase_order_date = isset($rs['custom_field_hash']['cf_purchase_order_date']) ? $rs['custom_field_hash']['cf_purchase_order_date'] : "";
$driver = isset($rs['custom_field_hash']['cf_driver'])?$rs['custom_field_hash']['cf_driver']:"";
$place_of_supply = isset($rs['custom_field_hash']['cf_place_of_supply'])?$rs['custom_field_hash']['cf_place_of_supply']:"";
// batch_no
if($batch_no){
$ip_invoice_custom_b['invoice_id'] = $invoice_insert_id;
$ip_invoice_custom_b['invoice_custom_fieldid'] = 62;
$ip_invoice_custom_b['invoice_custom_fieldvalue'] = $batch_no;
$result_invoice_custom_insert = $this->Zohobook_model->insert($ip_invoice_custom_b, 'ip_invoice_custom');
if ($result_invoice_custom_insert)
log_message('error', 'Data insert success DB : ip_invoice_custom ');
else
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
}
// vehicle_number
if($vehicle_number){
$ip_invoice_custom_v['invoice_id'] = $invoice_insert_id;
$ip_invoice_custom_v['invoice_custom_fieldid'] = 8;
$ip_invoice_custom_v['invoice_custom_fieldvalue'] = $vehicle_number;
$res_vehicle = $this->Zohobook_model->insert($ip_invoice_custom_v, 'ip_invoice_custom');
if ($res_vehicle)
log_message('error', 'Data insert success DB : ip_invoice_custom ');
else
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
}
// transport_mode
if($transport_mode){
$ip_invoice_custom_t['invoice_id'] = $invoice_insert_id;
$ip_invoice_custom_t['invoice_custom_fieldid'] = 7;
$ip_invoice_custom_t['invoice_custom_fieldvalue'] = $transport_mode;
$res_transport_mode = $this->Zohobook_model->insert($ip_invoice_custom_t, 'ip_invoice_custom');
if ($res_transport_mode)
log_message('error', 'Data insert success DB : ip_invoice_custom ');
else
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
}
// purchase_order_date
if($purchase_order_date){
$ip_invoice_custom_p['invoice_id'] = $invoice_insert_id;
$ip_invoice_custom_p['invoice_custom_fieldid'] = 15;
$ip_invoice_custom_p['invoice_custom_fieldvalue'] = $purchase_order_date;
$res_purchase_order_date = $this->Zohobook_model->insert($ip_invoice_custom_p, 'ip_invoice_custom');
if ($res_purchase_order_date)
log_message('error', 'Data insert success DB : ip_invoice_custom ');
else
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
}
// driver
if($driver){
$ip_invoice_custom_d['invoice_id'] = $invoice_insert_id;
$ip_invoice_custom_d['invoice_custom_fieldid'] = 58;
$ip_invoice_custom_d['invoice_custom_fieldvalue'] = $driver;
$res_driver = $this->Zohobook_model->insert($ip_invoice_custom_d, 'ip_invoice_custom');
if ($res_driver)
log_message('error', 'Data insert success DB : ip_invoice_custom ');
else
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
}
// place_of_supply
if($place_of_supply){
$ip_invoice_custom_d['invoice_id'] = $invoice_insert_id;
$ip_invoice_custom_d['invoice_custom_fieldid'] = 10;
$ip_invoice_custom_d['invoice_custom_fieldvalue'] = $place_of_supply;
$res_place = $this->Zohobook_model->insert($ip_invoice_custom_d, 'ip_invoice_custom');
if ($res_place)
log_message('error', 'Data insert success DB : ip_invoice_custom ');
else
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
}
//end invoice level custom fields
//if line items available
if (isset($rs['line_items']) && count($rs['line_items']) > 0) {
log_message('error', 'Processing line items' . count($rs['line_items']));
for ($i = 0; $i < count($rs['line_items']); $i++) { //start insert line items
$sku = $rs['line_items'][$i]['sku'];
$item_price = $rs['line_items'][$i]['rate'];
$item_order = $rs['line_items'][$i]['item_order'];
$item_product_unit = $rs['line_items'][$i]['unit'];
$item_name = $rs['line_items'][$i]['name'];
$item_description = $rs['line_items'][$i]['description'];
$item_quantity = $rs['line_items'][$i]['quantity'];
$cgst = $rs['line_items'][$i]['line_item_taxes'][1]['tax_name'];
$sgst = $rs['line_items'][$i]['line_item_taxes'][0]['tax_name'];
$cgst = $cgst[4];
$sgst = $sgst[4];
$cgst = $cgst . '.000';
$getcgsttax = $this->Zohobook_model->ip_tax_rates($cgst);
if ($getcgsttax) {
$cgsttaxid = $getcgsttax[0]['tax_rate_id'];
log_message('error', 'Data fetch success DB : ip_tax_rates cgst' . $cgst);
} else {
log_message('error', 'No data => Data fetch failed DB : ip_tax_rates ' . $cgst);
$cgst_data['tax_rate_percent'] = $cgst;
$getcgsttax = $this->Zohobook_model->insert($cgst_data, 'ip_tax_rates');
$cgsttaxid = $getcgsttax[0]['tax_rate_id'];
log_message('error', 'New Data Created : DB : ip_tax_rates , tax_rate_id : ' . $cgsttaxid);
}
$sgst = $sgst . '.000';
$getsgsttax = $this->Zohobook_model->ip_tax_rates($sgst);
if ($getsgsttax) {
$sgsttaxid = $getsgsttax[0]['tax_rate_id'];
log_message('error', 'Data fetch success DB : ip_tax_rates sgst' . $sgst);
} else {
log_message('error', 'No data => Data fetch failed DB : ip_tax_rates ' . $sgst);
$sgst_data['tax_rate_percent'] = $sgst;
$getsgsttax = $this->Zohobook_model->insert($sgst_data, 'ip_tax_rates');
$sgsttaxid = $getsgsttax[0]['tax_rate_id'];
log_message('error', 'New Data Created : DB : ip_tax_rates , tax_rate_id : ' . $sgsttaxid);
}
$item_subtotal = $rs['line_items'][$i]['item_total'];
$item_sgst_amt = $rs['line_items'][$i]['line_item_taxes'][0]['tax_amount'];
$item_cgst_amt = $rs['line_items'][$i]['line_item_taxes'][1]['tax_amount'];
$item_tax_total = ($item_sgst_amt + $item_cgst_amt);
$item_total = ($item_subtotal + $item_tax_total);
$item_discount = 0.00;
$item_igst_amt = 0.00;
// if($batch_no==""){ $batch_no = "";}
$sku_sql = $this->Zohobook_model->ip_products($sku);
if ($sku_sql) {
$product_id = $sku_sql[0]['product_id'];
log_message('error', 'Data fetch success DB : ip_products , product_id : ' . $product_id);
} else {
log_message('error', 'No data => Data fetch failed DB : ip_products ' . $sku);
$sku_data['product_name'] = $item_name;
$sku_data['product_description'] = $item_description;
$sku_data['sku'] = $sku;
$sku_sql = $this->Zohobook_model->insert($sku_data, 'ip_products');
$product_id = $sku_sql[0]['sku'];
log_message('error', 'sku' . $sku);
log_message('error', 'New Data Created : DB : product_id , product_id : ' . $product_id);
}
//#1
$ip_invoice_items['invoice_id'] = $invoice_insert_id;
$ip_invoice_items['item_product_id'] = $product_id;
$ip_invoice_items['item_date_added'] = $invoice_date;
$ip_invoice_items['item_name'] = $item_name;
$ip_invoice_items['item_description'] = $item_description;
$ip_invoice_items['item_quantity'] = $item_quantity;
$ip_invoice_items['item_price'] = $item_price;
$ip_invoice_items['item_order'] = $item_order;
$ip_invoice_items['item_product_unit'] = $item_product_unit;
$ip_invoice_items['Sgst_item_tax_rate_id'] = $sgsttaxid;
$ip_invoice_items['Cgst_item_tax_rate_id'] = $cgsttaxid;
$item_insert_id = $this->Zohobook_model->insert($ip_invoice_items, 'ip_invoice_items');
if ($item_insert_id)
log_message('error', 'Data insert success DB : ip_invoice_items => Sgst_item_tax_rate_id :' . $sgsttaxid);
else
log_message('error', 'Data insert failed DB : ip_invoice_items => Sgst_item_tax_rate_id :' . $sgsttaxid);
//tax amount -- ip_invoice_item_amounts - table
$ip_invoice_item_amounts['item_id'] = $item_insert_id;
$ip_invoice_item_amounts['item_subtotal'] = $item_subtotal;
$ip_invoice_item_amounts['item_tax_total'] = $item_tax_total;
$ip_invoice_item_amounts['item_total'] = $item_total;
$ip_invoice_item_amounts['item_sgst_amt'] = $item_sgst_amt;
$ip_invoice_item_amounts['item_cgst_amt'] = $item_cgst_amt;
$ip_invoice_item_amounts['item_discount'] = $item_discount;
$ip_invoice_item_amounts['item_igst_amt'] = $item_igst_amt;
$result_tax_amount_insert = $this->Zohobook_model->insert($ip_invoice_item_amounts, 'ip_invoice_item_amounts');
if ($result_tax_amount_insert)
log_message('error', 'Data insert success DB : ip_invoice_item_amounts ');
else
log_message('error', 'Data insert failed DB : ip_invoice_item_amounts ');
} //end line items insert
} else {
log_message('error', 'Line Items not found in API result');
}
} else {
log_message('error', 'Data insert failed DB : ip_invoice_items client id :' . $client_id);
}
} else // update invoice status, especially for cancelled invoices
{
if ($status == "void" || $status == "sent" || $status == "ovedue") {
$sql_invoice_update = array();
$sql_invoice_update['invoice_status_id'] = (($status == "sent" || $status == "ovedue") ? 2 : 5);
// echo 'script' . $invoice_number. $status;
// print_r( $sql_invoice_update);
// echo '<br>';
$sql_invoice_update = $this->Zohobook_model->sql_invoice_update($sql_invoice_update, $invoice_number, $invoice_date, 'ip_invoices');
if ($sql_invoice_update) {
log_message('error', 'Data update success DB : ip_invoices ');
} else {
log_message('error', 'Data update failed DB : ip_invoices ');
}
$update_count = $update_count + 1;
}
}
}
echo 'new invoice inserted count- ' . $insert_count . '/' . 'status updated count - ' . $update_count;
}else{
$err = 'invoice details not founded ( from '.$date_yesterday.' into '.$date_today.' )';
log_message('ERROR', $err);
echo $err;
throw new \Exception($err);
}
// curl_close($ch);
// }
} catch (Exception $e) {
$data['err'] = $e->getMessage();
$data['last_query'] = $this->db->last_query();
$this->Zohobook_model->insert($data, 'zohobook_api_err');
log_message('ERROR', "Data insertion failed : " . $e->getMessage());
}
}
//end
// END zoho API
}

View File

@ -1806,6 +1806,7 @@ function deliver_perform()
$res_invoice = $con->query($sql_invoice_chk);
if($res_invoice->num_rows<=0)
{

View File

@ -56,7 +56,7 @@ function get_fav($user)
$CI->db->reconnect();
$CI->db->where('Created_BY',$user);
$CI->db->where('Status',1);
return $CI->db->get('T_fav_add')->result();
return $CI->db->get('t_fav_add')->result();
}
@ -66,7 +66,7 @@ function get_fav($user)
$CI->load->database();
$CI->db->reconnect();
$subQuery='SELECT * from T_MaterialMaster where Current_stock < reorder?';
$subQuery='SELECT * from t_materialmaster where Current_stock < reorder?';
$query=$CI->db->query($subQuery,array());
//print_r($this->db->last_query());

View File

@ -0,0 +1,77 @@
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
* InvoicePlane
*
* @author InvoicePlane Developers & Contributors
* @copyright Copyright (c) 2012 - 2017 InvoicePlane.com
* @license https://invoiceplane.com/license.txt
* @link https://invoiceplane.com
*/
function generateNewToken()
{
$ch=curl_init();
$organization_id = '776847408';
$client_id = '1000.0WMDLCXAZV5DR60IKE9P49YTYGVL6C';
$refresh_token = '1000.0fcf314cc7b7b598df6e519461bbe9b8.f77688a2254137532ae33ad5e152a064';
$client_secret = '99da3a05cfa13cf91eb6476a3c44cfa3e21b6106a8';
$redirect_uri = 'https://resicoindustries.com/RIA/';
$accesstoken = '1000.095b66fc95fc81874c1cfc7d15b0904e.10bc9956d9b9ec14cce1350ee0cf8254';
$url_getauthtoken = 'https://accounts.zoho.com/oauth/v2/token?refresh_token='.$refresh_token.'&client_id='.$client_id.'&client_secret='.$client_secret.'&redirect_uri='.$redirect_uri.'&grant_type=refresh_token';
$headers=array('Authorization:Zoho-oauthtoken '.$accesstoken,'Content-Type:application/json');
curl_setopt($ch, CURLOPT_URL, $url_getauthtoken);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, 0);
$body = '{}';
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS,$body);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$res_token=curl_exec($ch);
$ress = json_decode($res_token);
return $ress->access_token;
}
function getheringInvoiceDetails($date_today , $date_yesterday , $accesstoken)
{
$ch=curl_init();
$organization_id = '776847408';
$url_org ="https://books.zoho.com/api/v3/invoices?";
$fields=array("usestate" => "true","organization_id" => $organization_id,"date_start" => $date_yesterday,"date_end" => $date_today);
$data_all = http_build_query($fields);
$headers=array('Authorization:Zoho-oauthtoken '.$accesstoken,'Content-Type:application/json');
$data_access = $url_org.$data_all;
curl_setopt($ch, CURLOPT_URL, $url_org.$data_access);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, 0);
$body = '{}';
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_POSTFIELDS,$body);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result=curl_exec($ch);
$data['headers_new'] = $headers;
$data['data'] = curl_exec($ch);
return $data;
}
function getheringInvoiceSubDetails($invoice_id , $organization_id , $headers)
{
$ch=curl_init();
$url2 = 'https://books.zoho.com/api/v3/invoices/'.$invoice_id.'?organization_id='.$organization_id;
curl_setopt($ch, CURLOPT_URL, $url2);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, 0);
$body2 = '{}';
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_POSTFIELDS,$body2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
return curl_exec($ch);
}

View File

@ -36,34 +36,66 @@ class BaseController extends CI_Controller {
/**
* This function used to check the user is logged in or not
*/
// function isLoggedIn() {
// $isLoggedIn = $this->session->userdata ( 'isLoggedIn' );
// if (! isset ( $isLoggedIn ) || $isLoggedIn != TRUE) {
// redirect ( 'login' );
// } else {
// $this->role = $this->session->userdata ( 'role' );
// $this->vendorId = $this->session->userdata ( 'userId' );
// $this->name = $this->session->userdata ( 'name' );
// $this->roleText = $this->session->userdata ( 'roleText' );
// $this->Designation = $this->session->userdata ( 'Designation' );
// $this->DEPCode = $this->session->userdata ( 'DEPCode' );
// $this->HeadDept = $this->session->userdata ( 'HeadDept' );
// $this->DepartmentName = $this->session->userdata ( 'DepartmentName' );
// $this->EmpID = $this->session->userdata ( 'EmpID' );
// $this->depaccess = $this->session->userdata ('depaccess');
// $this->profilepic = $this->session->userdata ( 'ProfilePic' );
// $this->CompanyName = $this->session->userdata ( 'CompanyName' );
// $this->global ['name'] = $this->name;
// $this->global ['role'] = $this->role;
// $this->global ['role_text'] = $this->roleText;
// $this->global ['DEPCode'] = $this->DEPCode;
// $this->global ['Designation'] = $this->Designation;
// $this->global ['DepAccesslist'] = $this->depaccess;
// $this->global ['CompanyName'] = $this->CompanyName;
// }
// }
function isLoggedIn() {
$isLoggedIn = $this->session->userdata ( 'isLoggedIn' );
if (! isset ( $isLoggedIn ) || $isLoggedIn != TRUE) {
redirect ( 'login' );
$this->load->library('uri');
if ($this->uri->segment(2) == 'zohobooks_api_fetch_all') {
redirect('login/zohobooks_api_fetch_all');
}
redirect ( 'login' );
} else {
$this->role = $this->session->userdata ( 'role' );
$this->vendorId = $this->session->userdata ( 'userId' );
$this->name = $this->session->userdata ( 'name' );
$this->roleText = $this->session->userdata ( 'roleText' );
$this->Designation = $this->session->userdata ( 'Designation' );
$this->DEPCode = $this->session->userdata ( 'DEPCode' );
$this->HeadDept = $this->session->userdata ( 'HeadDept' );
$this->DepartmentName = $this->session->userdata ( 'DepartmentName' );
$this->EmpID = $this->session->userdata ( 'EmpID' );
$this->depaccess = $this->session->userdata ('depaccess');
$this->profilepic = $this->session->userdata ( 'ProfilePic' );
$this->CompanyName = $this->session->userdata ( 'CompanyName' );
$this->global ['name'] = $this->name;
$this->global ['role'] = $this->role;
$this->global ['role_text'] = $this->roleText;
$this->global ['DEPCode'] = $this->DEPCode;
$this->global ['Designation'] = $this->Designation;
$this->global ['DepAccesslist'] = $this->depaccess;
$this->global ['CompanyName'] = $this->CompanyName;
log_message('ERROR','#####In BaseController - isLoggedIn function ci session : ' . $this->session->userdata ( 'name' ));
$this->role = $this->session->userdata ( 'role' );
$this->vendorId = $this->session->userdata ( 'userId' );
$this->name = $this->session->userdata ( 'name' );
$this->roleText = $this->session->userdata ( 'roleText' );
$this->Designation = $this->session->userdata ( 'Designation' );
$this->DEPCode = $this->session->userdata ( 'DEPCode' );
$this->HeadDept = $this->session->userdata ( 'HeadDept' );
$this->DepartmentName = $this->session->userdata ( 'DepartmentName' );
$this->EmpID = $this->session->userdata ( 'EmpID' );
$this->depaccess = $this->session->userdata ('depaccess');
$this->profilepic = $this->session->userdata ( 'ProfilePic' );
$this->CompanyName = $this->session->userdata ( 'CompanyName' );
$this->global ['name'] = $this->name;
$this->global ['role'] = $this->role;
$this->global ['role_text'] = $this->roleText;
$this->global ['DEPCode'] = $this->DEPCode;
$this->global ['Designation'] = $this->Designation;
$this->global ['DepAccesslist'] = $this->depaccess;
$this->global ['CompanyName'] = $this->CompanyName;
}
}
/**
* This function is used to check the access
*/

View File

@ -14,7 +14,7 @@ class assetdetails_model extends CI_Model
{
$this->db->select('asd.*,dep.DepartmentName,sup.SupplierName');
$this->db->from('T_Asset_Details asd');
$this->db->join('T_DepartmentDetails dep', ' dep.DEPCode = asd.DEPCode','left');
$this->db->join('t_departmentdetails dep', ' dep.DEPCode = asd.DEPCode','left');
$this->db->join ('T_SupplierDetailsN sup','sup.SupplierID = asd.SupplierCode','left');
@ -28,7 +28,7 @@ class assetdetails_model extends CI_Model
function getDepartment($Department = '')
{
$this->db->select('DEPCode,DepartmentName');
$this->db->from('T_DepartmentDetails');
$this->db->from('t_departmentdetails');
$this->db->where('IsActive',1 );
if($Department != '')
{
@ -57,8 +57,8 @@ class assetdetails_model extends CI_Model
$this->db->distinct();
$this->db->select('POM.PONO,POM.SupplierID,POL.MaterialCode,DeliveryDate,PODate,sup.SupplierName,POL.LineItemNo');
$this->db->from('T_PurchaseOrder_Master POM');
$this->db->join('T_PurchaseOrder_LineItem POL', 'POL.PONO = POM.PONO');
$this->db->from('t_purchaseorder_master POM');
$this->db->join('t_purchaseorder_lineitem POL', 'POL.PONO = POM.PONO');
$this->db->join('T_SupplierDetailsN sup', 'sup.SupplierID = POM.SupplierID');
$this->db->where('POM.status',MRIR_APPROVED);
if(!empty($PO)){
@ -74,8 +74,8 @@ class assetdetails_model extends CI_Model
{
$this->db->distinct();
$this->db->select(' POM.PONO');//,DeliveryDate,PODate,sup.SupplierName,POM.SupplierID');
$this->db->from('T_PurchaseOrder_Master POM');
//$this->db->join ('T_PurchaseOrder_LineItem POL ',' POL.PONO = POM.PONO');
$this->db->from('t_purchaseorder_master POM');
//$this->db->join ('t_purchaseorder_lineitem POL ',' POL.PONO = POM.PONO');
//$this->db->join ('T_SupplierDetailsN sup ',' sup.SupplierID = POM.SupplierID');
$this->db->where('POM.status',MRIR_APPROVED);
if(!empty($PO)){
@ -87,12 +87,12 @@ class assetdetails_model extends CI_Model
}
function getlineitemre($line){
$this->db->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POL.Quantity,POM.POType,re.TotalValue,req.ReqNo,emp.firstname,emp.Departmentcode,dep.DepartmentName,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID');
$this->db->from('T_PurchaseOrder_LineItem POL');
$this->db->join('T_Requestion_Master req','req.ReqNo = POL.ReqNo','left');
$this->db->join('T_PurchaseOrder_Master POM','POM.PONO=POL.PONO','left');
$this->db->from('t_purchaseorder_lineitem POL');
$this->db->join('t_requestion_master req','req.ReqNo = POL.ReqNo','left');
$this->db->join('t_purchaseorder_master POM','POM.PONO=POL.PONO','left');
$this->db->join ('T_MaterialMaster MM','MM.MaterialCode = POL.MaterialCode','left');
$this->db->join('T_Employee_Details emp','emp.EmpID = req.Requestedby','left');
$this->db->join('T_DepartmentDetails dep','dep.DEPCode = emp.Departmentcode','left');
$this->db->join('t_employee_details emp','emp.EmpID = req.Requestedby','left');
$this->db->join('t_departmentdetails dep','dep.DEPCode = emp.Departmentcode','left');
$this->db->join ('T_Revenue_Tax re','re.LineItemNo = POL.LineItemNo','left');
$this->db->join('T_SupplierDetailsN sup','sup.SupplierID = POM.SupplierID','left');
$this->db->where('POL.LineItemNo',$line);
@ -105,12 +105,12 @@ class assetdetails_model extends CI_Model
function getlineitemser($line){
$this->db->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,ser.TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID');
$this->db->from('T_PurchaseOrder_LineItem POL');
$this->db->join('T_Requestion_Master req','req.ReqNo = POL.ReqNo','left');
$this->db->join('T_PurchaseOrder_Master POM','POM.PONO=POL.PONO','left');
$this->db->from('t_purchaseorder_lineitem POL');
$this->db->join('t_requestion_master req','req.ReqNo = POL.ReqNo','left');
$this->db->join('t_purchaseorder_master POM','POM.PONO=POL.PONO','left');
$this->db->join ('T_MaterialMaster MM','MM.MaterialCode = POL.MaterialCode','left');
$this->db->join('T_Employee_Details emp','emp.EmpID = req.Requestedby','left');
$this->db->join('T_DepartmentDetails dep','dep.DEPCode = emp.Departmentcode','left');
$this->db->join('t_employee_details emp','emp.EmpID = req.Requestedby','left');
$this->db->join('t_departmentdetails dep','dep.DEPCode = emp.Departmentcode','left');
$this->db->join ('T_Service_Tax ser','ser.LineItemNo = POL.LineItemNo','left');
$this->db->join('T_SupplierDetailsN sup','sup.SupplierID = POM.SupplierID','left');
$this->db->where('POL.LineItemNo',$line);
@ -122,12 +122,12 @@ class assetdetails_model extends CI_Model
}
function getlineitemimport($line){
$this->db->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,ser.TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID');
$this->db->from('T_PurchaseOrder_LineItem POL');
$this->db->join('T_Requestion_Master req','req.ReqNo = POL.ReqNo','left');
$this->db->join('T_PurchaseOrder_Master POM','POM.PONO=POL.PONO','left');
$this->db->from('t_purchaseorder_lineitem POL');
$this->db->join('t_requestion_master req','req.ReqNo = POL.ReqNo','left');
$this->db->join('t_purchaseorder_master POM','POM.PONO=POL.PONO','left');
$this->db->join ('T_MaterialMaster MM','MM.MaterialCode = POL.MaterialCode','left');
$this->db->join('T_Employee_Details emp','emp.EmpID = req.Requestedby','left');
$this->db->join('T_DepartmentDetails dep','dep.DEPCode = emp.Departmentcode','left');
$this->db->join('t_employee_details emp','emp.EmpID = req.Requestedby','left');
$this->db->join('t_departmentdetails dep','dep.DEPCode = emp.Departmentcode','left');
$this->db->join ('T_Import_Tax ser','ser.LineItemNo = POL.LineItemNo','left');
$this->db->join('T_SupplierDetailsN sup','sup.SupplierID = POM.SupplierID','left');
$this->db->where('POL.LineItemNo',$line);
@ -140,12 +140,12 @@ class assetdetails_model extends CI_Model
function getlineitemcap($line){
$this->db->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,sum(ser.TotalValue+imp.TotalValue) as TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID');
$this->db->from('T_PurchaseOrder_LineItem POL');
$this->db->join('T_Requestion_Master req','req.ReqNo = POL.ReqNo','left');
$this->db->join('T_PurchaseOrder_Master POM','POM.PONO=POL.PONO','left');
$this->db->from('t_purchaseorder_lineitem POL');
$this->db->join('t_requestion_master req','req.ReqNo = POL.ReqNo','left');
$this->db->join('t_purchaseorder_master POM','POM.PONO=POL.PONO','left');
$this->db->join ('T_MaterialMaster MM','MM.MaterialCode = POL.MaterialCode','left');
$this->db->join('T_Employee_Details emp','emp.EmpID = req.Requestedby','left');
$this->db->join('T_DepartmentDetails dep','dep.DEPCode = emp.Departmentcode','left');
$this->db->join('t_employee_details emp','emp.EmpID = req.Requestedby','left');
$this->db->join('t_departmentdetails dep','dep.DEPCode = emp.Departmentcode','left');
$this->db->join ('T_Import_Tax imp','imp.LineItemNo = POL.LineItemNo','left');
$this->db->join ('T_Service_Tax ser','ser.LineItemNo = POL.LineItemNo','left');
$this->db->join('T_SupplierDetailsN sup','sup.SupplierID = POM.SupplierID','left');
@ -159,8 +159,8 @@ class assetdetails_model extends CI_Model
function gettyp($type)
{
$this->db->select('POM.POType,POL.LineItemNo');
$this->db->from('T_PurchaseOrder_LineItem POL');
$this->db->join('T_PurchaseOrder_Master POM','POM.PONO=POL.PONO');
$this->db->from('t_purchaseorder_lineitem POL');
$this->db->join('t_purchaseorder_master POM','POM.PONO=POL.PONO');
$this->db->where('POL.LineItemNo',$type);
$query = $this->db->get();
@ -215,10 +215,10 @@ function addNewasset($asset)
//echo $Asset_Code;
$this->db->select('Asset.*,POM.DeliveryDate,Dep.DepartmentName as DepartmentName,MM.MaterialName,MM.UOM,Supp.SupplierName as SupplierName');
$this->db->from('T_Asset_Details Asset');
$this->db->join('T_DepartmentDetails Dep', 'Asset.DEPCode = Dep.DEPCode','left');
$this->db->join('t_departmentdetails Dep', 'Asset.DEPCode = Dep.DEPCode','left');
$this->db->join('T_SupplierDetailsN Supp', 'Asset.SupplierCode = Supp.SupplierID','left');
$this->db->join('T_MaterialMaster MM ', 'MM.MaterialCode = Asset.MaterialCode','left');
$this->db->join('T_PurchaseOrder_Master POM','POM.PONO = Asset.PONO','left');
$this->db->join('t_purchaseorder_master POM','POM.PONO = Asset.PONO','left');
$this->db->where('Asset.AssetCode', $Asset_Code);
@ -246,12 +246,12 @@ function addNewasset($asset)
$this->db->select('det.*,dep.DepartmentName as DEPCode,sup.SupplierName,MM.MaterialName,emp.firstname,emp1.firstname as Updated_By');
$this->db->join('tbl_users as tbl',' det.createdby = tbl.userid','left');
$this->db->join('T_DepartmentDetails as dep','dep.DEPCode=det.DEPCode','left');
$this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid','left');
$this->db->join('t_departmentdetails as dep','dep.DEPCode=det.DEPCode','left');
$this->db->join('t_employee_details as emp', 'emp.empid=tbl.empid','left');
$this->db->join('T_SupplierDetailsN as sup', 'sup.SupplierID=det.SupplierCode','left');
$this->db->join('T_MaterialMaster MM ', 'MM.MaterialCode = det.MaterialCode','left');
$this->db->join('tbl_users as tbl1',' det.UpdatedBy = tbl1.userid','left');
$this->db->join('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid','left');
$this->db->join('t_employee_details as emp1', 'emp1.empid=tbl1.empid','left');
return $this->db->get('T_Asset_Details as det')->result_array();
}
}

View File

@ -5,13 +5,13 @@ class batchcard_model extends CI_Model
function getEmplistforReport()
{
$this->db->select('T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.Departmentcode,T_DepartmentDetails.shortName');
$this->db->from('T_Employee_Details');
$this->db->join('T_DepartmentDetails','T_Employee_Details.Departmentcode=T_DepartmentDetails.DEPCode');
$this->db->select('t_employee_details.EmpID,t_employee_details.FirstName,t_employee_details.LastName,t_employee_details.Departmentcode,t_departmentdetails.shortName');
$this->db->from('t_employee_details');
$this->db->join('t_departmentdetails','t_employee_details.Departmentcode=t_departmentdetails.DEPCode');
//$this->db->join('ip_invoice_items','ip_invoices.invoice_number=ip_invoice_items.invoice_number');
//$this->db->join('ip_products','ip_invoice_items.item_product_id=ip_products.product_id');
//$this->db->join('ip_invoice_custom','ip_invoices.invoice_number=ip_invoice_custom.invoice_number and invoice_custom_fieldid=62');
$this->db->order_by('T_Employee_Details.EmpID');
$this->db->order_by('t_employee_details.EmpID');
$res = $this->db->get();
return $res->result();
@ -32,9 +32,9 @@ class batchcard_model extends CI_Model
{
$this->db->select('mas.SupplierID,sup.SupplierName,mmas.MaterialCode,mmas.MaterialName');
$this->db->from('T_PurchaseOrder_Master mas');
$this->db->from('t_purchaseorder_master mas');
$this->db->join('T_SupplierDetailsN sup','sup.SupplierID=mas.SupplierID');
$this->db->join('T_PurchaseOrder_LineItem line','line.PONO=mas.PONO');
$this->db->join('t_purchaseorder_lineitem line','line.PONO=mas.PONO');
$this->db->join('T_MaterialMaster mmas','mmas.MaterialCode=line.MaterialCode');
$this->db->where('Category','Raw Material');
$this->db->group_by('SupplierID');
@ -52,9 +52,9 @@ class batchcard_model extends CI_Model
function Consupplier()
{
$this->db->select('mas.SupplierID,sup.SupplierName');
$this->db->from('T_PurchaseOrder_Master mas');
$this->db->from('t_purchaseorder_master mas');
$this->db->join('T_SupplierDetailsN sup','sup.SupplierID=mas.SupplierID');
$this->db->join('T_PurchaseOrder_LineItem line','line.PONO=mas.PONO');
$this->db->join('t_purchaseorder_lineitem line','line.PONO=mas.PONO');
$this->db->join('T_MaterialMaster mmas','mmas.MaterialCode=line.MaterialCode');
$this->db->where('Category','Consumables');
$this->db->group_by('SupplierID');
@ -67,9 +67,9 @@ class batchcard_model extends CI_Model
function Pacsupplier()
{
$this->db->select('mas.SupplierID,sup.SupplierName');
$this->db->from('T_PurchaseOrder_Master mas');
$this->db->from('t_purchaseorder_master mas');
$this->db->join('T_SupplierDetailsN sup','sup.SupplierID=mas.SupplierID');
$this->db->join('T_PurchaseOrder_LineItem line','line.PONO=mas.PONO');
$this->db->join('t_purchaseorder_lineitem line','line.PONO=mas.PONO');
$this->db->join('T_MaterialMaster mmas','mmas.MaterialCode=line.MaterialCode');
$this->db->where('Category','Packing material');
$this->db->group_by('SupplierID');
@ -115,10 +115,10 @@ class batchcard_model extends CI_Model
{
//echo "Model".$from.'-'.$to;
$this->db->select('T_hourly_batch_info.*,T_Employee_Details.FirstName as F,T_Employee_Details.LastName as L');
$this->db->select('T_hourly_batch_info.*,t_employee_details.FirstName as F,t_employee_details.LastName as L');
$this->db->from('T_hourly_batch_info');
$this->db->join('tbl_users','T_hourly_batch_info.checkedby=tbl_users.userId');
$this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID');
$this->db->join('t_employee_details','tbl_users.EmpID=t_employee_details.EmpID');
if(!empty($hid))
{
$this->db->where('hourlyid',$hid);
@ -162,9 +162,9 @@ class batchcard_model extends CI_Model
// $this->db->select('*');
// $this->db->from('T_daily_batchcard_data');
// $this->db->where('month(ddate)',$month);
$sql = 'select T_daily_batchcard_data.*,T_Employee_Details.FirstName,T_Employee_Details.LastName from T_daily_batchcard_data
$sql = 'select T_daily_batchcard_data.*,t_employee_details.FirstName,t_employee_details.LastName from T_daily_batchcard_data
join tbl_users on T_daily_batchcard_data.createdby = tbl_users.userId
join T_Employee_Details on T_Employee_Details.EmpID = tbl_users.EmpID
join t_employee_details on t_employee_details.EmpID = tbl_users.EmpID
where month(ddate) = ?';
$res = $this->db->query($sql,array($month));
return $res->result();
@ -304,8 +304,8 @@ class batchcard_model extends CI_Model
$this->db->select('CONCAT(ED2.FirstName, " - " , ED2.LastName) AS Worker_Name', FALSE);
$this->db->from('T_Batchcard_MaintanceDetails BMD');
$this->db->join('T_Employee_Details ED1', 'ED1.EmpID = BMD.Approved_By', 'left');
$this->db->join('T_Employee_Details ED2', 'ED2.EmpID = BMD.WorkDone_By', 'left');
$this->db->join('t_employee_details ED1', 'ED1.EmpID = BMD.Approved_By', 'left');
$this->db->join('t_employee_details ED2', 'ED2.EmpID = BMD.WorkDone_By', 'left');
@ -360,8 +360,8 @@ class batchcard_model extends CI_Model
$this->db->select("CONCAT(ED2.FirstName, ' - ' , ED2.LastName) AS Worker_Name", FALSE);
$this->db->from("T_Batchcard_MaintanceDetails bm");
$this->db->join("T_Machine_Master mm", "bm.Machine_Code = mm.Machine_Code", "left");
$this->db->join("T_Employee_Details ED1", "bm.Approved_By = ED1.EmpID", "left");
$this->db->join("T_Employee_Details ED2", "bm.WorkDone_By = ED2.EmpID", "left");
$this->db->join("t_employee_details ED1", "bm.Approved_By = ED1.EmpID", "left");
$this->db->join("t_employee_details ED2", "bm.WorkDone_By = ED2.EmpID", "left");
$this->db->where("mm.Machines_Category = 'TRP'");
//AND DATE_FORMAT(bm.CreatedOn,'%Y-%m-%d') = '19-04-2018'
$this->db->where("DATE_FORMAT(bm.CreatedOn,'%d-%m-%Y')",$date);
@ -383,8 +383,8 @@ class batchcard_model extends CI_Model
/** Machines History/Master */
function getdept_dtls()
{
$this->db->select('T_DepartmentDetails.DEPCode,T_DepartmentDetails.shortName');
$this->db->from('T_DepartmentDetails');
$this->db->select('t_departmentdetails.DEPCode,t_departmentdetails.shortName');
$this->db->from('t_departmentdetails');
$this->db->where('IsActive',1);
$res = $this->db->get();
return $res->result();
@ -393,7 +393,7 @@ class batchcard_model extends CI_Model
function getpono(){
$this->db->select('PONO');
$this->db->from('T_PurchaseOrder_Master');
$this->db->from('t_purchaseorder_master');
$this->db->where('Status','ST026');
$res = $this->db->get();
return $res->result();
@ -401,15 +401,15 @@ class batchcard_model extends CI_Model
function getpo_dtls($pono){
// $this->db->select('T_PurchaseOrder_Master.PONO,T_PurchaseOrder_Master.SupplierID,T_SupplierDetailsN.SupplierName,DATE_FORMAT(T_PurchaseOrder_Master.PODate,"%d-%m-%Y") as PO_Date');
// $this->db->from('T_PurchaseOrder_Master');
// $this->db->join('T_SupplierDetailsN','T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID');
// $this->db->select('t_purchaseorder_master.PONO,t_purchaseorder_master.SupplierID,T_SupplierDetailsN.SupplierName,DATE_FORMAT(t_purchaseorder_master.PODate,"%d-%m-%Y") as PO_Date');
// $this->db->from('t_purchaseorder_master');
// $this->db->join('T_SupplierDetailsN','t_purchaseorder_master.SupplierID=T_SupplierDetailsN.SupplierID');
// $this->db->where('PONO',$pono);
// $res = $this->db->get();
// return $res->result();
$sql = "select T_PurchaseOrder_Master.PONO,T_PurchaseOrder_Master.SupplierID,T_SupplierDetailsN.SupplierName,DATE_FORMAT(T_PurchaseOrder_Master.PODate,'%d-%m-%Y') as PO_Date
from T_PurchaseOrder_Master
join T_SupplierDetailsN on T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID
$sql = "select t_purchaseorder_master.PONO,t_purchaseorder_master.SupplierID,T_SupplierDetailsN.SupplierName,DATE_FORMAT(t_purchaseorder_master.PODate,'%d-%m-%Y') as PO_Date
from t_purchaseorder_master
join T_SupplierDetailsN on t_purchaseorder_master.SupplierID=T_SupplierDetailsN.SupplierID
where PONO = ? ";
$res = $this->db->query($sql,array($pono));
return $res->result();
@ -613,27 +613,27 @@ class batchcard_model extends CI_Model
function getHist_tbls($MachineCode){
$this->db->select('T_Machine_Master.*,T_Batchcard_MaintanceDetails.*,T_DepartmentDetails.DepartmentName');
$this->db->select('T_Machine_Master.*,T_Batchcard_MaintanceDetails.*,t_departmentdetails.DepartmentName');
$this->db->select("DATE_FORMAT(T_Batchcard_MaintanceDetails.CreatedOn,'%d-%m-%Y') AS date", FALSE);
$this->db->select("DATE_FORMAT(T_Batchcard_MaintanceDetails.CreatedOn,'%l:%i %p') AS time", FALSE);
$this->db->select("CONCAT(ED1.FirstName, ' - ' , ED1.LastName) AS Approver_Name", FALSE);
$this->db->select("CONCAT(ED2.FirstName, ' - ' , ED2.LastName) AS Worker_Name", FALSE);
$this->db->from('T_Machine_Master');
$this->db->join('T_Batchcard_MaintanceDetails','T_Batchcard_MaintanceDetails.Machine_Code=T_Machine_Master.Machine_Code');
$this->db->join('T_DepartmentDetails','T_DepartmentDetails.DEPCode=T_Machine_Master.Machines_Dept');
$this->db->join('T_Employee_Details ED1', 'ED1.EmpID = T_Batchcard_MaintanceDetails.Approved_By', 'left');
$this->db->join('T_Employee_Details ED2', 'ED2.EmpID = T_Batchcard_MaintanceDetails.WorkDone_By', 'left');
$this->db->join('t_departmentdetails','t_departmentdetails.DEPCode=T_Machine_Master.Machines_Dept');
$this->db->join('t_employee_details ED1', 'ED1.EmpID = T_Batchcard_MaintanceDetails.Approved_By', 'left');
$this->db->join('t_employee_details ED2', 'ED2.EmpID = T_Batchcard_MaintanceDetails.WorkDone_By', 'left');
$this->db->where('T_Machine_Master.Machine_Code',$MachineCode);
$res = $this->db->get();
return $res->result();
// $sql = "SELECT T_Machine_Master.*,T_Batchcard_MaintanceDetails.*,
// T_DepartmentDetails.DepartmentName,
// t_departmentdetails.DepartmentName,
// DATE_FORMAT(T_Batchcard_MaintanceDetails.CreatedOn, '%d-%m-%Y') as date,
// DATE_FORMAT(T_Batchcard_MaintanceDetails.CreatedOn, '%l:%i %p') as time,
// FROM T_Machine_Master
// LEFT JOIN T_Batchcard_MaintanceDetails ON T_Batchcard_MaintanceDetails.Machine_Code=T_Machine_Master.Machine_Code
// LEFT JOIN T_DepartmentDetails ON T_DepartmentDetails.DEPCode=T_Machine_Master.Machines_Dept
// LEFT JOIN t_departmentdetails ON t_departmentdetails.DEPCode=T_Machine_Master.Machines_Dept
// WHERE T_Machine_Master.Machine_Code = '".$MachineCode."'" ;
// $res = $this->db->query($sql);
// return $res->result();
@ -1281,8 +1281,8 @@ where ProductCode=? and Transactiondate >= ? and Transactiondate <= ?';
function GetAvgPrice($MaterialCode,$date,$Supplier)
{
$subQuery='select AVG(Rate) as avg_rate from T_PurchaseOrder_LineItem
join T_PurchaseOrder_Master on T_PurchaseOrder_Master.PONO=T_PurchaseOrder_LineItem.PONO
$subQuery='select AVG(Rate) as avg_rate from t_purchaseorder_lineitem
join t_purchaseorder_master on t_purchaseorder_master.PONO=t_purchaseorder_lineitem.PONO
where MaterialCode = ? and SupplierID=?';
$query = $this->db->query($subQuery,array($MaterialCode,$Supplier));
@ -1299,9 +1299,9 @@ where MaterialCode = ? and SupplierID=?';
$ltype='%'.$type.'%';
//echo $ltype;
$this->db->select('mas.SupplierID,sup.SupplierName,mmas.MaterialCode,mmas.MaterialName');
$this->db->from('T_PurchaseOrder_Master mas');
$this->db->from('t_purchaseorder_master mas');
$this->db->join('T_SupplierDetailsN sup','sup.SupplierID=mas.SupplierID');
$this->db->join('T_PurchaseOrder_LineItem line','line.PONO=mas.PONO');
$this->db->join('t_purchaseorder_lineitem line','line.PONO=mas.PONO');
$this->db->join('T_MaterialMaster mmas','mmas.MaterialCode=line.MaterialCode');
$this->db->where('Category like',$ltype);
@ -1382,7 +1382,7 @@ FROM
left join T_MaterialMaster mm on mm.MaterialCode = p.MaterialCode
left join ip_products ip on ip.product_id=p.MaterialCode
left join T_PurchaseOrder_LineItem pol on pol.MaterialCode = mm.MaterialCode
left join t_purchaseorder_lineitem pol on pol.MaterialCode = mm.MaterialCode
";

View File

@ -39,11 +39,11 @@ class cashbook_model extends CI_Model
// }
// function amountpaidcashbook()
// {
// $this->db->select('t_accountcode.namea,total,cashtype,T_Employee_Details.FirstName,T_Employee_Details.LastName,t_income_expense.*');
// $this->db->select('t_accountcode.namea,total,cashtype,t_employee_details.FirstName,t_employee_details.LastName,t_income_expense.*');
// $this->db->from('t_income_expense');
// $this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code','left');
// $this->db->join('tbl_users','t_income_expense.Created_By=tbl_users.userId','left');
// $this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID','left');
// $this->db->join('t_employee_details','tbl_users.EmpID=t_employee_details.EmpID','left');
// $this->db->where('t_income_expense.IsActive',1);
// $this->db->where('t_income_expense.account_code !=','ADV001');
// $this->db->group_by('t_income_expense.account_code');
@ -55,11 +55,11 @@ class cashbook_model extends CI_Model
function getIncomeExpenseList($i="")
{
// echo $i;
$this->db->select('t_accountcode.name,cashtype,T_Employee_Details.FirstName,T_Employee_Details.LastName,t_income_expense.*');
$this->db->select('t_accountcode.name,cashtype,t_employee_details.FirstName,t_employee_details.LastName,t_income_expense.*');
$this->db->from('t_income_expense');
$this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code','left');
$this->db->join('tbl_users','t_income_expense.Created_By=tbl_users.userId','left');
$this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID','left');
$this->db->join('t_employee_details','tbl_users.EmpID=t_employee_details.EmpID','left');
$this->db->where('t_income_expense.IsActive',1);
// $this->db->where('t_income_expense.account_code !=','ADV001');
// $this->db->where('t_income_expense.account_code !=','0013');
@ -75,11 +75,11 @@ class cashbook_model extends CI_Model
function getIncomeExpense($firstyear,$secondyear,$frmdt,$todt)
{
$this->db->select('t_accountcode.name,cashtype,T_Employee_Details.FirstName,T_Employee_Details.LastName,t_income_expense.*');
$this->db->select('t_accountcode.name,cashtype,t_employee_details.FirstName,t_employee_details.LastName,t_income_expense.*');
$this->db->from('t_income_expense');
$this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code','left');
$this->db->join('tbl_users','t_income_expense.Created_By=tbl_users.userId','left');
$this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID','left');
$this->db->join('t_employee_details','tbl_users.EmpID=t_employee_details.EmpID','left');
$this->db->where('t_income_expense.IsActive',1);
$this->db->where('t_income_expense.account_code !=','ADV001');
$this->db->where('t_income_expense.account_code !=','0013');
@ -103,11 +103,11 @@ class cashbook_model extends CI_Model
function getAdvanceList($i="")
{
// echo $i;
$this->db->select('t_accountcode.name,cashtype,T_Employee_Details.FirstName,T_Employee_Details.LastName,t_income_expense.*');
$this->db->select('t_accountcode.name,cashtype,t_employee_details.FirstName,t_employee_details.LastName,t_income_expense.*');
$this->db->from('t_income_expense');
$this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code','left');
$this->db->join('tbl_users','t_income_expense.Created_By=tbl_users.userId','left');
$this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID','left');
$this->db->join('t_employee_details','tbl_users.EmpID=t_employee_details.EmpID','left');
$this->db->where('t_income_expense.IsActive',1);
$this->db->where('t_income_expense.account_code','ADV001');
$this->db->or_where('t_income_expense.account_code','0013');
@ -123,11 +123,11 @@ class cashbook_model extends CI_Model
function getAdvance($firstyear,$secondyear,$frmdt,$todt)
{
$this->db->select('t_accountcode.name,cashtype,T_Employee_Details.FirstName,T_Employee_Details.LastName,t_income_expense.*');
$this->db->select('t_accountcode.name,cashtype,t_employee_details.FirstName,t_employee_details.LastName,t_income_expense.*');
$this->db->from('t_income_expense');
$this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code','left');
$this->db->join('tbl_users','t_income_expense.Created_By=tbl_users.userId','left');
$this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID','left');
$this->db->join('t_employee_details','tbl_users.EmpID=t_employee_details.EmpID','left');
$this->db->where('t_income_expense.IsActive',1);
$this->db->where('t_income_expense.account_code','ADV001');
$this->db->or_where('t_income_expense.account_code','0013');
@ -162,7 +162,7 @@ function finyear(){
}
function getCompany()
{
$r = $this->db->get('T_Company_Details');
$r = $this->db->get('t_company_details');
return $r->result();
@ -194,11 +194,11 @@ function finyear(){
function Selectadvance($i="")
{
// echo $i;
$this->db->select('T_SupplierDetailsN.SupplierName,t_accountcode.name,cashtype,T_Employee_Details.FirstName,T_Employee_Details.LastName,t_income_expense.*');
$this->db->select('T_SupplierDetailsN.SupplierName,t_accountcode.name,cashtype,t_employee_details.FirstName,t_employee_details.LastName,t_income_expense.*');
$this->db->from('t_income_expense');
$this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code','left');
$this->db->join('tbl_users','t_income_expense.Created_By=tbl_users.userId','left');
$this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID','left');
$this->db->join('t_employee_details','tbl_users.EmpID=t_employee_details.EmpID','left');
$this->db->join('T_SupplierDetailsN','T_SupplierDetailsN.SupplierID=t_income_expense.Supplier_id' );
$this->db->order_by("date","desc");
$this->db->where_in('t_accountcode.code',[AReceipt,Apayment]);
@ -1720,8 +1720,8 @@ function receiptdata()
// // $this->db->select('igd.IGRNO,igd.IGRItemNo,pom.PONO,sm.SupplierName');
// // $this->db->from('T_IGR_Details igd');
// // $this->db->join('T_IGR_Master igm','igm.IGRNO=igd.IGRNO');
// // $this->db->join('T_PurchaseOrder_LineItem poli','igm.PONO= poli.PONO and igd.MaterialCode=poli.MaterialCode');
// // $this->db->join('T_PurchaseOrder_Master pom','pom.PONO=poli.PONO');
// // $this->db->join('t_purchaseorder_lineitem poli','igm.PONO= poli.PONO and igd.MaterialCode=poli.MaterialCode');
// // $this->db->join('t_purchaseorder_master pom','pom.PONO=poli.PONO');
// // $this->db->join('T_SupplierDetailsN sm','sm.SupplierID=pom.SupplierID');
// // $this->db->where('igd.BankStatus','ST072');
// // $query = $this->db->get();
@ -1911,7 +1911,7 @@ function receiptdata()
// {
// echo $igrdetails;
// $this->db->where('PONO',$pono);
// $this->db->update('T_PurchaseOrder_Master',$podetails);
// $this->db->update('t_purchaseorder_master',$podetails);
// $r = $this->db->affected_rows();
// return $r;

View File

@ -11,7 +11,7 @@ class companydetailsmodel extends CI_Model
//inserted data into companydetails table//
function Companyadd($Company)
{
$this->db->insert('T_Company_Details', $Company);
$this->db->insert('t_company_details', $Company);
$CompID = $this->db->affected_rows();
return $Company;
}
@ -48,7 +48,7 @@ class companydetailsmodel extends CI_Model
function Updatecompany($Comp, $CompID)
{
$this->db->where('CompID', $CompID);
$this->db->update('T_Company_Details', $Comp);
$this->db->update('t_company_details', $Comp);
$this->db->last_query();
return TRUE;
}
@ -57,7 +57,7 @@ class companydetailsmodel extends CI_Model
function checkPhotoExists($Pic)
{
$this->db->select('ProfilePic');
$this->db->from('T_Company_Details');
$this->db->from('t_company_details');
$this->db->where($Pic);
$query = $this->db->get();
if ($query->num_rows > 0) {
@ -69,10 +69,10 @@ class companydetailsmodel extends CI_Model
function companylisting()
{
$this->db->select('com.*,emp.firstname,pmt.PaymentTerms');
$this->db->from('T_Company_Details com');
$this->db->from('t_company_details com');
$this->db->join('T_PaymentTerms pmt','com.paymentID = pmt.PaymentID','left');
$this->db->join('tbl_users as tbl',' com.createdby = tbl.userid','left');
$this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid','left');
$this->db->join('t_employee_details as emp', 'emp.empid=tbl.empid','left');
$query = $this->db->get();
$result = $query->result();
return $result;

View File

@ -75,7 +75,7 @@ function addconfigmaster($config)
{
$subQuery = 'select ConfigValue from T_ConfigDetails Bud where ConfigValue not in
(select BudgetType from T_CostCenter_Budget where CostCenterCode=? and BudgetYear=(select max(BudgetYear) from T_CostCenter_Budget)) and Config_ID=?';
(select BudgetType from t_costcenter_budget where CostCenterCode=? and BudgetYear=(select max(BudgetYear) from t_costcenter_budget)) and Config_ID=?';
$query = $this->db->query($subQuery, array($CostCenterCode,$ConfigID));
@ -133,7 +133,7 @@ function addconfigmaster($config)
function EditBudget($Budget)
{
$this->db->trans_start();
$this->db->insert('T_CostCenter_Budget', $Budget);
$this->db->insert('t_costcenter_budget', $Budget);
$insert_id = $this->db->affected_rows();
@ -147,7 +147,7 @@ function addconfigmaster($config)
$this->db->where("BudgetType", $BudgetType);
$this->db->where("BudgetYear", $BudgetYear);
$this->db->where("CostCenterCode", $CostCenterCode);
$this->db->delete('T_CostCenter_Budget');
$this->db->delete('t_costcenter_budget');
//print_r( $this->db->last_query());
}

View File

@ -15,7 +15,7 @@ class costcenter_model extends CI_Model
$this->db->select('Cost.CostCenterCode as code,Cost.CostCenterName as CostCenterName , Cost.ApprovedBy as ApprovedBy,Emp.FirstName as FirstName,Emp.Designation as Designation ,Cost.CreatedDate,Cost.IsActive');
$this->db->from('T_CostCenter_Master as Cost');
$this->db->join('T_Employee_Details as Emp', 'Emp.EmpID=Cost.ApprovedBy');
$this->db->join('t_employee_details as Emp', 'Emp.EmpID=Cost.ApprovedBy');
$query = $this->db->get();
@ -44,7 +44,7 @@ function addNewcost($Cost)
function getFiscalYear()
{
$this->db->select('year(FiscalYearStartOn) as StartYear,year(FiscalYearEndsOn) as EndYear');
$this->db->from('T_Company_Details');
$this->db->from('t_company_details');
$query = $this->db->get();
@ -67,7 +67,7 @@ function addNewcost($Cost)
function addBudget($Budget)
{
$this->db->trans_start();
$this->db->insert('T_CostCenter_Budget', $Budget);
$this->db->insert('t_costcenter_budget', $Budget);
$insert_id = $this->db->affected_rows();
@ -79,7 +79,7 @@ function addNewcost($Cost)
function getApproverName()
{
$this->db->select('EmpID,FirstName,LastName,Designation');
$this->db->from('T_Employee_Details');
$this->db->from('t_employee_details');
$this->db->where('Departmentcode ', 'DEP10');
$query = $this->db->get();
@ -111,8 +111,8 @@ function addNewcost($Cost)
{
$this->db->select('Cost.CostCenterCode,Cost.CostCenterName,Cost.ApprovedBy,emp.FirstName,emp.Designation,max(BudgetYear) as BudYear' );
$this->db->from('T_CostCenter_Master Cost');
$this->db->join('T_Employee_Details emp', 'emp.EmpID = Cost.ApprovedBy');
$this->db->join('T_CostCenter_Budget Bud', ' Bud.CostCenterCode = Cost.CostCenterCode');
$this->db->join('t_employee_details emp', 'emp.EmpID = Cost.ApprovedBy');
$this->db->join('t_costcenter_budget Bud', ' Bud.CostCenterCode = Cost.CostCenterCode');
$this->db->where('Cost.CostCenterCode', $CostCenterCode);
$query = $this->db->get();
@ -128,7 +128,7 @@ function addNewcost($Cost)
{
$this->db->select('Dept.DEPCode,Det.DepartmentName');
$this->db->from('T_CostCenter_Departments Dept');
$this->db->join('T_DepartmentDetails Det', 'Det.DEPCode = Dept.DEPCode');
$this->db->join('t_departmentdetails Det', 'Det.DEPCode = Dept.DEPCode');
$this->db->where('Dept.CostCenterCode', $CostCenterCode);
$query = $this->db->get();
@ -143,7 +143,7 @@ function addNewcost($Cost)
function GetBudgetYear($CostCenterCode)
{
$subQuery = 'select BudgetYear from T_CostCenter_Budget where CostCenterCode=? ';
$subQuery = 'select BudgetYear from t_costcenter_budget where CostCenterCode=? ';
$query = $this->db->query($subQuery, array($CostCenterCode));
@ -158,8 +158,8 @@ function addNewcost($Cost)
function GetCostCenterBudget($CostCenterCode)
{
$subQuery = 'select BudgetType,BudgetYear,BudgetAmount,Remarks from T_CostCenter_Budget where CostCenterCode=? and
BudgetYear=(select max(BudgetYear) from T_CostCenter_Budget where CostCenterCode=?)';
$subQuery = 'select BudgetType,BudgetYear,BudgetAmount,Remarks from t_costcenter_budget where CostCenterCode=? and
BudgetYear=(select max(BudgetYear) from t_costcenter_budget where CostCenterCode=?)';
$query = $this->db->query($subQuery, array($CostCenterCode,$CostCenterCode));
@ -175,7 +175,7 @@ function addNewcost($Cost)
{
$subQuery = 'select ConfigValue from T_ConfigDetails Bud where ConfigValue not in
(select BudgetType from T_CostCenter_Budget where CostCenterCode=? and BudgetYear=?) and Config_ID=? ';
(select BudgetType from t_costcenter_budget where CostCenterCode=? and BudgetYear=?) and Config_ID=? ';
$query = $this->db->query($subQuery, array($CostCenterCode,$Year,$ConfigID));
@ -191,7 +191,7 @@ function addNewcost($Cost)
function GetCostCenterBudgetByYear($CostCenterCode,$Year)
{
$subQuery = 'select BudgetType,BudgetYear,BudgetAmount,Remarks from T_CostCenter_Budget where CostCenterCode=? and
$subQuery = 'select BudgetType,BudgetYear,BudgetAmount,Remarks from t_costcenter_budget where CostCenterCode=? and
budgetyear=?';
@ -208,7 +208,7 @@ function addNewcost($Cost)
function GetDepartmentNotinCostCenter($CostCenterCode)
{
$subQuery = 'select Dept.DEPCode,Dept.DepartmentName from T_DepartmentDetails Dept
$subQuery = 'select Dept.DEPCode,Dept.DepartmentName from t_departmentdetails Dept
where Dept.DEPCode not in
(select DEPCode from T_CostCenter_Departments where CostCenterCode=?) order by Dept.DEPCode asc';
@ -223,10 +223,10 @@ function addNewcost($Cost)
function getDepartmentnotadded($Empid)
{
$subQuery = 'select Dept.DEPCode,Dept.DepartmentName from T_DepartmentDetails Dept
left join T_AccessDepartments Ass on Ass.Departmentcode= Dept.DEPCode
$subQuery = 'select Dept.DEPCode,Dept.DepartmentName from t_departmentdetails Dept
left join t_accessdepartments Ass on Ass.Departmentcode= Dept.DEPCode
where Dept.DEPCode not in
(select Ass.Departmentcode from T_AccessDepartments Ass where EmpID=?) group by Dept.DEPCode';
(select Ass.Departmentcode from t_accessdepartments Ass where EmpID=?) group by Dept.DEPCode';
$query = $this->db->query($subQuery, array($Empid));
@ -239,8 +239,8 @@ where Dept.DEPCode not in
{
$this->db->select('Ass.Departmentcode as AssDep,Dep.DepartmentName');
$this->db->from('T_AccessDepartments Ass');
$this->db->join('T_DepartmentDetails Dep', 'Dep.DEPCode = Ass.Departmentcode','left');
$this->db->from('t_accessdepartments Ass');
$this->db->join('t_departmentdetails Dep', 'Dep.DEPCode = Ass.Departmentcode','left');
$this->db->where('EmpID ',$Empid);
$query = $this->db->get();
@ -258,7 +258,7 @@ where Dept.DEPCode not in
{
$subQuery = 'select ConfigValue from T_ConfigDetails Bud where ConfigValue not in
(select BudgetType from T_CostCenter_Budget where CostCenterCode=? and BudgetYear=(select max(BudgetYear) from T_CostCenter_Budget)) and Config_ID=?';
(select BudgetType from t_costcenter_budget where CostCenterCode=? and BudgetYear=(select max(BudgetYear) from t_costcenter_budget)) and Config_ID=?';
$query = $this->db->query($subQuery, array($CostCenterCode,$ConfigID));
@ -280,7 +280,7 @@ where Dept.DEPCode not in
function EditBudget($Budget)
{
$this->db->trans_start();
$this->db->insert('T_CostCenter_Budget', $Budget);
$this->db->insert('t_costcenter_budget', $Budget);
$insert_id = $this->db->affected_rows();
@ -294,7 +294,7 @@ where Dept.DEPCode not in
$this->db->where("BudgetType", $BudgetType);
$this->db->where("BudgetYear", $BudgetYear);
$this->db->where("CostCenterCode", $CostCenterCode);
$this->db->delete('T_CostCenter_Budget');
$this->db->delete('t_costcenter_budget');
//print_r( $this->db->last_query());
}
@ -338,13 +338,13 @@ where Dept.DEPCode not in
}
}
/* *//**
* This function is used to get the Department details from T_DepartmentDetails
* This function is used to get the Department details from t_departmentdetails
* @return array $result : This is result of the query
*/
function getDepartment()
{
$this->db->select('DEPCode, DepartmentName');
$this->db->from('T_DepartmentDetails');
$this->db->from('t_departmentdetails');
$this->db->where('IsActive =', 1);
$query = $this->db->get();
@ -374,14 +374,14 @@ where Dept.DEPCode not in
$this->db->select('sum(distinct case when Mas.budgettype="SERVICE" then budgetamount else 0 end) as service',FALSE);
$this->db->select('sum(distinct case when Mas.budgettype="IMPORT" then budgetamount else 0 end) as import',FALSE);
$this->db->select('GROUP_CONCAT(distinct part.DepartmentName) as DepartmentName');
$this->db->join('T_CostCenter_Budget as Mas','Mas.CostCenterCode=bud.CostCenterCode','left');
$this->db->join('t_costcenter_budget as Mas','Mas.CostCenterCode=bud.CostCenterCode','left');
$this->db->join('T_CostCenter_Departments as dep',' dep.CostCenterCode=Mas.CostCenterCode','left');
$this->db->join('T_DepartmentDetails as part','part.DEPCode=dep.DEPCode','left');
$this->db->join('t_departmentdetails as part','part.DEPCode=dep.DEPCode','left');
$this->db->group_by(array('bud.CostCenterCode','Mas.BudgetYear'));
$this->db->join('tbl_users as tbl',' bud.createdby = tbl.userid','left');
$this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid','left');
$this->db->join('t_employee_details as emp', 'emp.empid=tbl.empid','left');
$this->db->join('tbl_users as tbl1',' bud.UpdatedBy = tbl1.userid','left');
$this->db->join('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid','left');
$this->db->join('t_employee_details as emp1', 'emp1.empid=tbl1.empid','left');
$this->db->where('Mas.BudgetYear !=""');
return $this->db->get('T_CostCenter_Master as bud')->result_array();
@ -389,7 +389,7 @@ where Dept.DEPCode not in
//get exist budget year details
function CheckExistBudget($BudgetType,$BudgetYear,$CostCode){
$this->db->select('CostCenterCode');
$this->db->from('T_CostCenter_Budget');
$this->db->from('t_costcenter_budget');
$this->db->where('CostCenterCode',$CostCode);
$this->db->where('BudgetType',$BudgetType);
$this->db->where('BudgetYear',$BudgetYear);
@ -411,7 +411,7 @@ where Dept.DEPCode not in
$this->db->where('BudgetType',$BudgetType);
$this->db->where('BudgetYear',$BudgetYear);
$this->db->update('T_CostCenter_Budget', $Budget);
$this->db->update('t_costcenter_budget', $Budget);
return TRUE;
}
}

View File

@ -15,12 +15,12 @@ class dahsboard_Model extends CI_Model
function totemp()
{
$yes_date = date('Y-m-d',strtotime("-1 days"));
// $sql="select count(*) as emp_count from T_Employee_Details where date(T_Employee_Details.Created_date) <= ? and isActive = 1";
// $sql="select count(*) as emp_count from t_employee_details where date(t_employee_details.Created_date) <= ? and isActive = 1";
// $query =$this->db->query($sql,array($yes_date));
$this->db->select('count(*) as totemp');
$this->db->where('date(T_Employee_Details.Created_date)<=',$yes_date);
$this->db->where('date(t_employee_details.Created_date)<=',$yes_date);
$this->db->where('isActive',1);
$query = $this->db->get('T_Employee_Details');
$query = $this->db->get('t_employee_details');
// print_r($query->row());die;
return $query->row();
@ -93,7 +93,7 @@ function getfiles($igr,$PONO)
function totloan()
{
$sql="select sum(Loan_Amount)as totloan FROM T_Loan_Master";
$sql="select sum(Loan_Amount)as totloan FROM t_loan_master";
$query =$this->db->query($sql);
return $query->result();
@ -103,7 +103,7 @@ function getfiles($igr,$PONO)
function totpay()
{
$sql="select sum(Paid_Amount)as totpay FROM T_Loan_Master";
$sql="select sum(Paid_Amount)as totpay FROM t_loan_master";
$query =$this->db->query($sql);
return $query->result();
@ -112,7 +112,7 @@ function getfiles($igr,$PONO)
function totrec()
{
$sql="select sum(Loan_Amount), sum(Paid_Amount),sum(Loan_Amount)-sum(Paid_Amount) as totrec FROM T_Loan_Master";
$sql="select sum(Loan_Amount), sum(Paid_Amount),sum(Loan_Amount)-sum(Paid_Amount) as totrec FROM t_loan_master";
$query =$this->db->query($sql);
return $query->result();
@ -121,7 +121,7 @@ function getfiles($igr,$PONO)
function emplist()
{
$sql="select EmpID,CONCAT(FirstName,' ',LastName) as name FROM T_Employee_Details where IsActive ='1'";
$sql="select EmpID,CONCAT(FirstName,' ',LastName) as name FROM t_employee_details where IsActive ='1'";
$query =$this->db->query($sql);
return $query->result();
@ -133,12 +133,12 @@ $sql="select EmpID,CONCAT(FirstName,' ',LastName) as name FROM T_Employee_Detai
function attyesterday($WH,$date)
{
//echo 'model' . $WH.'-'.$date;
// $sql="select EmpID,".$WH." from T_Attendance where Month_Year = ? and EmpID in (select EmpID from T_Attendance)" ;
// $sql="select EmpID,".$WH." from t_attendance where Month_Year = ? and EmpID in (select EmpID from t_attendance)" ;
$yes_date = date('Y-m-d',strtotime("-1 days"));
$sql="select att.EmpID,ifnull(".$WH.",0)".$WH.",a.FirstName from T_Attendance as att
join T_Employee_Details as a on a.EmpID= att.EmpID
where Month_Year = ? and att.EmpID in (select EmpID from T_Attendance) and date(a.Created_date) <= '".$yes_date."' and isActive=1";
$sql="select att.EmpID,ifnull(".$WH.",0)".$WH.",a.FirstName from t_attendance as att
join t_employee_details as a on a.EmpID= att.EmpID
where Month_Year = ? and att.EmpID in (select EmpID from t_attendance) and date(a.Created_date) <= '".$yes_date."' and isActive=1";
$query = $this->db->query($sql,array($date));
// print_r($query->result_array());die;
//echo count($query->result());
@ -149,7 +149,7 @@ where Month_Year = ? and att.EmpID in (select EmpID from T_Attendance) and dat
function dayAllPersentEmpSalary($WH,$OT,$date)
{
// echo $date;
$sql="select EmpID,".$WH.",".$OT." from T_Attendance where Month_Year = ? and EmpID in (select EmpID from T_Attendance)";
$sql="select EmpID,".$WH.",".$OT." from t_attendance where Month_Year = ? and EmpID in (select EmpID from t_attendance)";
$query = $this->db->query($sql,array($date));
//return
return $query->result_array();
@ -158,7 +158,7 @@ where Month_Year = ? and att.EmpID in (select EmpID from T_Attendance) and dat
function yesterdayAllPersentEmpSalary($WH,$OT,$date)
{
// echo $date;
$sql="select EmpID,".$WH.",".$OT." from T_Attendance where Month_Year = ? and EmpID in (select EmpID from T_Attendance)";
$sql="select EmpID,".$WH.",".$OT." from t_attendance where Month_Year = ? and EmpID in (select EmpID from t_attendance)";
$query = $this->db->query($sql,array($date));
//return
return $query->result_array();
@ -168,7 +168,7 @@ function yesterdayAllPersentEmpSalary($WH,$OT,$date)
function attendance($EmpID,$dates)
{
//echo $EmpID.'-'.$dates;
$sql="select * from T_Attendance where EmpID =? and Month_Year=?";
$sql="select * from t_attendance where EmpID =? and Month_Year=?";
$query = $this->db->query($sql,array($EmpID,$dates));
return $query->result();
@ -176,11 +176,11 @@ function attendance($EmpID,$dates)
}
function getAllAttendance($EmpID,$CURMONTH)
{
$sql="select * from T_Attendance where EmpID =? and month(Month_Year)=?";
$sql="select * from t_attendance where EmpID =? and month(Month_Year)=?";
// $sql=" select T_Attendance.*,emp.FirstName from T_Attendance
// join T_Employee_Details emp on T_Attendance.EmpID = emp.EmpID
// where T_Attendance.EmpID = ? and month(Month_Year)= ? ";
// $sql=" select t_attendance.*,emp.FirstName from t_attendance
// join t_employee_details emp on t_attendance.EmpID = emp.EmpID
// where t_attendance.EmpID = ? and month(Month_Year)= ? ";
$query = $this->db->query($sql,array($EmpID,$CURMONTH));
@ -190,11 +190,11 @@ function getAllAttendance($EmpID,$CURMONTH)
function getAllAttendances($EmpID,$JoinedMonth)
{
//$sql="select * from T_Attendance where EmpID =? and month(Month_Year)=?";
//$sql="select * from t_attendance where EmpID =? and month(Month_Year)=?";
$sql=" select T_Attendance.*,emp.FirstName from T_Attendance
join T_Employee_Details emp on T_Attendance.EmpID = emp.EmpID
where T_Attendance.EmpID = ? and month(Month_Year)= ? ";
$sql=" select t_attendance.*,emp.FirstName from t_attendance
join t_employee_details emp on t_attendance.EmpID = emp.EmpID
where t_attendance.EmpID = ? and month(Month_Year)= ? ";
$query = $this->db->query($sql,array($EmpID,$JoinedMonth));
@ -203,7 +203,7 @@ where T_Attendance.EmpID = ? and month(Month_Year)= ? ";
}
function joindate($EmpID)
{
$sql="select DateofJoining from T_Employee_Details where EmpID =? ";
$sql="select DateofJoining from t_employee_details where EmpID =? ";
$query = $this->db->query($sql,array($EmpID));
return $query->result();
@ -217,7 +217,7 @@ function daysalary($EmpID,$dates)
//print_r($dates);die;
$sql= "select * FROM T_Emp_Pay_Data as pay
join T_Attendance att on att.EmpID = pay.EmpID
join t_attendance att on att.EmpID = pay.EmpID
where att.Month_Year = ? and att.EmpID = ?;";
$query = $this->db->query($sql,array($dates,$EmpID));
@ -227,7 +227,7 @@ where att.Month_Year = ? and att.EmpID = ?;";
function persentEmployeeDetails($EmpID){
//join T_Attendance att on att.EmpID = pay.EmpID
//join t_attendance att on att.EmpID = pay.EmpID
$sql= "select * FROM T_Emp_Pay_Data where EmpID = ?;";
$query = $this->db->query($sql,array($EmpID));
@ -241,19 +241,19 @@ $sql= "select * FROM T_Emp_Pay_Data where EmpID = ?;";
{
// //print_r($MONTH);
// $sql="select Att.EmpID,Att.Month_Year,Att.*,NoofDays,Days_Worked,emp.DateofJoining from T_Attendance Att
// join T_Employee_Details as emp on emp.EmpID = Att.EmpID
// $sql="select Att.EmpID,Att.Month_Year,Att.*,NoofDays,Days_Worked,emp.DateofJoining from t_attendance Att
// join t_employee_details as emp on emp.EmpID = Att.EmpID
// where Att.Month_Year between ? and Att.EmpID = ?";
// else
// (YEAR(Month_Year) = YEAR(CURRENT_DATE)-1 and MONTH(Month_Year) >= ? ) or ( YEAR(Month_Year) = YEAR(CURRENT_DATE) and MONTH(Month_Year) <= 3 )
// $sql = 'select sum(NoofDays) as TotalWorkingDays,sum(Days_worked) as DaysWorked from T_Attendance where
// $sql = 'select sum(NoofDays) as TotalWorkingDays,sum(Days_worked) as DaysWorked from t_attendance where
// case
// when (month(Month_Year) >=4) then
// (YEAR(Month_Year) = YEAR(CURRENT_DATE) and MONTH(Month_Year) >= ? ) or ( YEAR(Month_Year) = YEAR(CURRENT_DATE)+1 and MONTH(Month_Year) <= 3 )end and EmpID = ? and month(Month_Year) != month(current_date())
// else
// (YEAR(Month_Year) = YEAR(CURRENT_DATE)-1 and MONTH(Month_Year) >= ? ) or ( YEAR(Month_Year) = YEAR(CURRENT_DATE) and MONTH(Month_Year) <= 3 )';
$sql = ' select sum(NoofDays) as TotalWorkingDays,sum(Days_worked) as DaysWorked from T_Attendance where
$sql = ' select sum(NoofDays) as TotalWorkingDays,sum(Days_worked) as DaysWorked from t_attendance where
case
when (MONTH(CURRENT_DATE) >=4) then
((YEAR(Month_Year) = YEAR(CURRENT_DATE) and MONTH(Month_Year) >= ? )) and EmpID = ? and month(Month_Year) != MONTH(CURRENT_DATE)
@ -262,7 +262,7 @@ $sql= "select * FROM T_Emp_Pay_Data where EmpID = ?;";
end';
/*$sql='select sum(NoofDays) as TotalWorkingDays,sum(Days_worked) as DaysWorked from T_Attendance
/*$sql='select sum(NoofDays) as TotalWorkingDays,sum(Days_worked) as DaysWorked from t_attendance
where EmpID= ? and (MONTH(Month_Year) >=4) or (MONTH(Month_Year) <3)
and (YEAR(Month_Year) = YEAR(CURRENT_DATE) and MONTH(Month_Year) >= ? )or ( YEAR(Month_Year) = YEAR(CURRENT_DATE)+1 and MONTH(Month_Year) <= 3 )
and MONTH(Month_Year) != MONTH(current_date())';*/
@ -277,7 +277,7 @@ and (YEAR(Month_Year) = YEAR(CURRENT_DATE) and MONTH(Month_Year) >= ? )or ( YEAR
}
function getEmployee(){
$sql="select EmpID,FirstName,LastName,IsActive FROM T_Employee_Details ";
$sql="select EmpID,FirstName,LastName,IsActive FROM t_employee_details ";
$query =$this->db->query($sql);
return $query->result();
@ -287,8 +287,8 @@ $sql="select EmpID,FirstName,LastName,IsActive FROM T_Employee_Details ";
function get_all_employee($Month)
{
$sql = "select T_Attendance.*,emp.EmpID,emp.FirstName,emp.LastName,emp.IsActive from T_Attendance
join T_Employee_Details emp on T_Attendance.EmpID = emp.EmpID
$sql = "select t_attendance.*,emp.EmpID,emp.FirstName,emp.LastName,emp.IsActive from t_attendance
join t_employee_details emp on t_attendance.EmpID = emp.EmpID
where Month_Year=?;";
$query = $this->db->query($sql,array($Month));
return $query->result();
@ -299,8 +299,8 @@ function get_all_employee1($finStart,$finEnd)
{
$sql = "select att.EmpID,att.*,att.Month_Year,emp.FirstName,emp.DateofJoining from T_Attendance att
join T_Employee_Details emp on emp.EmpID = att.EmpID
$sql = "select att.EmpID,att.*,att.Month_Year,emp.FirstName,emp.DateofJoining from t_attendance att
join t_employee_details emp on emp.EmpID = att.EmpID
where att.Month_Year between ? and ?";
$query = $this->db->query($sql,array($finStart,$finEnd));
return $query->result();
@ -318,7 +318,7 @@ function fy()
CASE WHEN MONTH(Month_year)>=4 THEN
concat(YEAR(Month_year), '-',YEAR(Month_year)+1)
ELSE concat(YEAR(Month_year)-1,'-', YEAR(Month_year)) END AS financial_year
FROM T_Attendance
FROM t_attendance
GROUP BY financial_year";
$query = $this->db->query($sql);
return $query->result();
@ -326,7 +326,7 @@ GROUP BY financial_year";
function get_employee(){
$yes_date = date('Y-m-d',strtotime("-1 days"));
$sql = "select * from T_Employee_Details where date(created_date) <='".$yes_date."' and isActive =1";
$sql = "select * from t_employee_details where date(created_date) <='".$yes_date."' and isActive =1";
$query = $this->db->query($sql);
return $query->result();
}
@ -346,8 +346,8 @@ function per($fa,$aa,$m)
$sql= "SELECT month.Eid as Eid,month.ename as ename,month.active as active,month.days as monthdays,month.Days_Worked as monthworked,month.percentage as monthpercentage
from (select em.EmpID as Eid,concat(em.FirstName,'.',em.LastName) as ename,em.IsActive as active,at.NoofDays as days,
Days_Worked,round((Days_Worked/".$cur_date."*100)) as percentage from
T_Employee_Details em
join T_Attendance at on at.EmpID = em.EmpID
t_employee_details em
join t_attendance at on at.EmpID = em.EmpID
where (Month_Year >= '".$fa."-04-01' and Month_Year <= '".$aa."-04-01') and monthname(Month_Year) = '".$m."'
) as month";
@ -365,7 +365,7 @@ $query = $this->db->query($sql);
function totalpurchaseorder(){
$sql="select count(PONO) as totalpurchaseorder from T_PurchaseOrder_Master pm where Status != 'ST030'
$sql="select count(PONO) as totalpurchaseorder from t_purchaseorder_master pm where Status != 'ST030'
and case
when (month(pm.PODate) >=4) then
(YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.PODate) <= 3 )
@ -379,7 +379,7 @@ $query = $this->db->query($sql);
function totalordervalue(){
$sql="select sum(totalordervalue) as totalordervalue from T_PurchaseOrder_Master pm where Status != 'ST030'
$sql="select sum(totalordervalue) as totalordervalue from t_purchaseorder_master pm where Status != 'ST030'
and case
when (month(pm.PODate) >=4) then
(YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.PODate) <= 3 )
@ -393,7 +393,7 @@ $query = $this->db->query($sql);
function pendingpo(){
$sql="select count(PONO) as pending from T_PurchaseOrder_Master pm where status='ST020' and Status != 'ST030'
$sql="select count(PONO) as pending from t_purchaseorder_master pm where status='ST020' and Status != 'ST030'
and case
when (month(pm.PODate) >=4) then
(YEAR(pm.PODate) = YEAR(CURRENT_DATE) and MONTH(pm.PODate) >= 4 ) or ( YEAR(pm.PODate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.PODate) <= 3 )
@ -407,7 +407,7 @@ $query = $this->db->query($sql);
function req_pending(){
$sql="SELECT count(Status) as TOTAL_PENDING_REQUESTS FROM T_Requestion_Master pm where Status = 'ST002'
$sql="SELECT count(Status) as TOTAL_PENDING_REQUESTS FROM t_requestion_master pm where Status = 'ST002'
and case
when (month(pm.ReqDate) >=4) then
(YEAR(pm.ReqDate) = YEAR(CURRENT_DATE) and MONTH(pm.ReqDate) >= 4 ) or ( YEAR(pm.ReqDate) = YEAR(CURRENT_DATE)+1 and MONTH(pm.ReqDate) <= 3 )
@ -423,7 +423,7 @@ $query = $this->db->query($sql);
function reqdetail(){
$now= date('Y-m-d');
$sql="SELECT count(Status) as TODAY_REQUESTS FROM T_Requestion_Master where date(ReqDate) = '".$now."' ";
$sql="SELECT count(Status) as TODAY_REQUESTS FROM t_requestion_master where date(ReqDate) = '".$now."' ";
$query = $this->db->query($sql);
@ -438,33 +438,33 @@ $query = $this->db->query($sql);
function january(){
$sql="select count(PONO) as pending from T_PurchaseOrder_Master where status='ST020'";
$sql="select count(PONO) as pending from t_purchaseorder_master where status='ST020'";
$query = $this->db->query($sql);
return $query->result();
}
// function totalserviceamount()
// {
// $sql="select sum(BudgetAmount) as totalserviceamount from T_CostCenter_Budget where BudgetType='SERVICE'";
// $sql="select sum(BudgetAmount) as totalserviceamount from t_costcenter_budget where BudgetType='SERVICE'";
// $query = $this->db->query($sql);
// return $query->result();
// }
// function totalcapitalamount()
// {
// $sql="select sum(BudgetAmount) as totalcapitalamount from T_CostCenter_Budget where BudgetType='CAPITAL'";
// $sql="select sum(BudgetAmount) as totalcapitalamount from t_costcenter_budget where BudgetType='CAPITAL'";
// $query = $this->db->query($sql);
// return $query->result();
// }
// function totalimportamount()
// {
// $sql="select sum(BudgetAmount) as totalimportamount from T_CostCenter_Budget where BudgetType='IMPORT'";
// $sql="select sum(BudgetAmount) as totalimportamount from t_costcenter_budget where BudgetType='IMPORT'";
// $query = $this->db->query($sql);
// return $query->result();
// }
// function totalrevenueamount()
// {
// $sql="select sum(BudgetAmount) as totalrevenueamount from T_CostCenter_Budget where BudgetType='REVENUE'";
// $sql="select sum(BudgetAmount) as totalrevenueamount from t_costcenter_budget where BudgetType='REVENUE'";
// $query = $this->db->query($sql);
// return $query->result();
// }
@ -483,7 +483,7 @@ function getTotalServicePoCount(){
while($i<=12){
$sql="SELECT count(cmast.PONO) as totalService FROM T_PurchaseOrder_Master cmast
$sql="SELECT count(cmast.PONO) as totalService FROM t_purchaseorder_master cmast
where POType='SERVICE' and Status != 'ST030' and month(PODate) = $i
and date(cmast.PODate) >= '".$fa."-04-01' and date(cmast.PODate) <= '".$aa."-03-31'";
@ -511,7 +511,7 @@ function getTotalimportPoCount(){
while($i<=12){
$sql="SELECT count(cmast.PONO) as totalImport FROM T_PurchaseOrder_Master cmast
$sql="SELECT count(cmast.PONO) as totalImport FROM t_purchaseorder_master cmast
where POType='IMPORT' and Status != 'ST030' and month(PODate) = $i
and date(cmast.PODate) >= '".$fa."-04-01' and date(cmast.PODate) <= '".$aa."-03-31'";
@ -537,7 +537,7 @@ function getTotalcapitalPoCount(){
$aa=substr($ab,5,5);
while($i<=12){
$sql="SELECT count(cmast.PONO) as totalcapital FROM T_PurchaseOrder_Master cmast
$sql="SELECT count(cmast.PONO) as totalcapital FROM t_purchaseorder_master cmast
where POType='CAPITAL' and Status != 'ST030' and month(PODate) = $i
and date(cmast.PODate) >= '".$fa."-04-01' and date(cmast.PODate) <= '".$aa."-03-31'";
@ -563,7 +563,7 @@ $i++;
$aa=substr($ab,5,5);
while($i<=12){
$sql="SELECT count(cmast.PONO) as totalrevenue FROM T_PurchaseOrder_Master cmast
$sql="SELECT count(cmast.PONO) as totalrevenue FROM t_purchaseorder_master cmast
where POType='REVENUE' and Status != 'ST030' and month(PODate) = $i
and date(cmast.PODate) >= '".$fa."-04-01' and date(cmast.PODate) <= '".$aa."-03-31'";
@ -583,70 +583,70 @@ $i++;
function serviceprogress()
{
$sql="SELECT count(cmast.PONO) as serviceprogress FROM T_PurchaseOrder_Master cmast
join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO
join T_Requestion_Master req on req.ReqNo=line.ReqNo
join T_Status sta on sta.statusCode=req.status
$sql="SELECT count(cmast.PONO) as serviceprogress FROM t_purchaseorder_master cmast
join t_purchaseorder_lineitem line on line.PONO=cmast.PONO
join t_requestion_master req on req.ReqNo=line.ReqNo
join t_status sta on sta.statusCode=req.status
where ReqType='SERVICE' and statusCode='ST018'";
$query = $this->db->query($sql);
return $query->result();
}
function revenueprogress()
{
$sql="SELECT count(cmast.PONO) as revenueprogress FROM T_PurchaseOrder_Master cmast
join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO
join T_Requestion_Master req on req.ReqNo=line.ReqNo
join T_Status sta on sta.statusCode=req.status
$sql="SELECT count(cmast.PONO) as revenueprogress FROM t_purchaseorder_master cmast
join t_purchaseorder_lineitem line on line.PONO=cmast.PONO
join t_requestion_master req on req.ReqNo=line.ReqNo
join t_status sta on sta.statusCode=req.status
where ReqType='REVENUE' and statusCode='ST018'";
$query = $this->db->query($sql);
return $query->result();
}
function importprogress()
{
$sql="SELECT count(cmast.PONO) as importprogress FROM T_PurchaseOrder_Master cmast
join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO
join T_Requestion_Master req on req.ReqNo=line.ReqNo
join T_Status sta on sta.statusCode=req.status
$sql="SELECT count(cmast.PONO) as importprogress FROM t_purchaseorder_master cmast
join t_purchaseorder_lineitem line on line.PONO=cmast.PONO
join t_requestion_master req on req.ReqNo=line.ReqNo
join t_status sta on sta.statusCode=req.status
where ReqType='IMPORT' and statusCode='ST018'";
$query = $this->db->query($sql);
return $query->result();
}
function capitalprogress()
{
$sql="SELECT count(cmast.PONO) as capitalprogress FROM T_PurchaseOrder_Master cmast
join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO
join T_Requestion_Master req on req.ReqNo=line.ReqNo
join T_Status sta on sta.statusCode=req.status
$sql="SELECT count(cmast.PONO) as capitalprogress FROM t_purchaseorder_master cmast
join t_purchaseorder_lineitem line on line.PONO=cmast.PONO
join t_requestion_master req on req.ReqNo=line.ReqNo
join t_status sta on sta.statusCode=req.status
where ReqType='CAPITAL' and statusCode='ST018'";
$query = $this->db->query($sql);
return $query->result();
}
function totalservicepo ()
{
$sql="SELECT count(cmast.PONO) as totalservicepo FROM T_PurchaseOrder_Master cmast
join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO
join T_Requestion_Master req on req.ReqNo=line.ReqNo
join T_Status sta on sta.statusCode=req.status
$sql="SELECT count(cmast.PONO) as totalservicepo FROM t_purchaseorder_master cmast
join t_purchaseorder_lineitem line on line.PONO=cmast.PONO
join t_requestion_master req on req.ReqNo=line.ReqNo
join t_status sta on sta.statusCode=req.status
where ReqType='SERVICE'";
$query = $this->db->query($sql);
return $query->result();
}
function totalrevenuepo ()
{
$sql="SELECT count(cmast.PONO) as totalrevenuepo FROM T_PurchaseOrder_Master cmast
join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO
join T_Requestion_Master req on req.ReqNo=line.ReqNo
join T_Status sta on sta.statusCode=req.status
$sql="SELECT count(cmast.PONO) as totalrevenuepo FROM t_purchaseorder_master cmast
join t_purchaseorder_lineitem line on line.PONO=cmast.PONO
join t_requestion_master req on req.ReqNo=line.ReqNo
join t_status sta on sta.statusCode=req.status
where ReqType='REVENUE'";
$query = $this->db->query($sql);
return $query->result();
}
function totalimportpo ()
{
$sql="SELECT count(cmast.PONO) as totalimportpo FROM T_PurchaseOrder_Master cmast
join T_PurchaseOrder_LineItem line on line.PONO=cmast.PONO
join T_Requestion_Master req on req.ReqNo=line.ReqNo
join T_Status sta on sta.statusCode=req.status
$sql="SELECT count(cmast.PONO) as totalimportpo FROM t_purchaseorder_master cmast
join t_purchaseorder_lineitem line on line.PONO=cmast.PONO
join t_requestion_master req on req.ReqNo=line.ReqNo
join t_status sta on sta.statusCode=req.status
where ReqType='IMPORT'";
$query = $this->db->query($sql);
return $query->result();
@ -663,7 +663,7 @@ function importbudgt ()
$ab=$yearl;
$fa=substr($ab,0,-5);
$aa=substr($ab,5,5);
$sql="SELECT ROUND(sum(BudgetAmount),2) as totalimportbudget FROM T_CostCenter_Budget where BudgetType ='IMPORT' and date(CreatedDate) >= '".$fa."-04-01' and date(CreatedDate) <= '".$aa."-03-31'";
$sql="SELECT ROUND(sum(BudgetAmount),2) as totalimportbudget FROM t_costcenter_budget where BudgetType ='IMPORT' and date(CreatedDate) >= '".$fa."-04-01' and date(CreatedDate) <= '".$aa."-03-31'";
$query = $this->db->query($sql);
return $query->result();
}
@ -679,7 +679,7 @@ function capitalbud ()
$ab=$yearl;
$fa=substr($ab,0,-5);
$aa=substr($ab,5,5);
$sql="SELECT sum(BudgetAmount) as totalcapitalbudget FROM T_CostCenter_Budget where BudgetType ='CAPITAL' and date(CreatedDate) >= '".$fa."-04-01' and date(CreatedDate) <= '".$aa."-03-31' ";
$sql="SELECT sum(BudgetAmount) as totalcapitalbudget FROM t_costcenter_budget where BudgetType ='CAPITAL' and date(CreatedDate) >= '".$fa."-04-01' and date(CreatedDate) <= '".$aa."-03-31' ";
$query = $this->db->query($sql);
return $query->result();
}
@ -695,7 +695,7 @@ function servicebudgt ()
$ab=$yearl;
$fa=substr($ab,0,-5);
$aa=substr($ab,5,5);
$sql="SELECT ROUND(sum(BudgetAmount),2) as totalservicebudget FROM T_CostCenter_Budget where BudgetType ='SERVICE' and date(CreatedDate) >= '".$fa."-04-01' and date(CreatedDate) <= '".$aa."-03-31'";
$sql="SELECT ROUND(sum(BudgetAmount),2) as totalservicebudget FROM t_costcenter_budget where BudgetType ='SERVICE' and date(CreatedDate) >= '".$fa."-04-01' and date(CreatedDate) <= '".$aa."-03-31'";
$query = $this->db->query($sql);
return $query->result();
}
@ -711,7 +711,7 @@ function revenuebudgt ()
$ab=$yearl;
$fa=substr($ab,0,-5);
$aa=substr($ab,5,5);
$sql="SELECT ROUND(sum(BudgetAmount),2) as totalrevenuebudget FROM T_CostCenter_Budget where BudgetType ='REVENUE' and date(CreatedDate) >= '".$fa."-04-01' and date(CreatedDate) <= '".$aa."-03-31'";
$sql="SELECT ROUND(sum(BudgetAmount),2) as totalrevenuebudget FROM t_costcenter_budget where BudgetType ='REVENUE' and date(CreatedDate) >= '".$fa."-04-01' and date(CreatedDate) <= '".$aa."-03-31'";
$query = $this->db->query($sql);
return $query->result();
}
@ -746,10 +746,10 @@ FROM cost_center where Status !='ST030' and date(PODate) >= '".$fa."-04-01' and
function req_list($fa,$aa,$m,$frm,$t,$agf,$agt){
$sql="select date_format(mas.ReqDate,'%d-%m-%Y') as ReqDate,mas.ReqNo,emp.FirstName as Requestedby,dep.DepartmentName,mas.ReqType,DATEDIFF(CURDATE(),mas.ReqDate) AS Aging from T_Requestion_Master as mas
$sql="select date_format(mas.ReqDate,'%d-%m-%Y') as ReqDate,mas.ReqNo,emp.FirstName as Requestedby,dep.DepartmentName,mas.ReqType,DATEDIFF(CURDATE(),mas.ReqDate) AS Aging from t_requestion_master as mas
join T_CostCenter_Master cos on cos.CostCenterCode = mas.CostCenterCode
join T_Employee_Details emp on emp.EmpID = mas.Requestedby
join T_DepartmentDetails dep on dep.DEPCode=emp.Departmentcode
join t_employee_details emp on emp.EmpID = mas.Requestedby
join t_departmentdetails dep on dep.DEPCode=emp.Departmentcode
where mas.Status = 'ST002'
";
if ($fa and $aa != ''){
@ -784,13 +784,13 @@ FROM cost_center where Status !='ST030' and date(PODate) >= '".$fa."-04-01' and
function report_relpo($fa,$aa,$m,$frm,$t,$agf,$agt){
$sql="select Mast.PONO,Mast.POType,date_format(Mast.PODate,'%d-%m-%Y') as PODate,date_format(Mast.ReleasedOn,'%d-%m-%Y') as ReleasedDate,Dept_Details.DepartmentName As Dept_Name,Mast.TotalOrderValue
from T_PurchaseOrder_Master Mast
JOIN T_PurchaseOrder_LineItem Det on Det.PONO=Mast.PONO
left JOIN T_Requestion_Master as Req on Req.ReqNo=Det.ReqNo
left JOIN T_DepartmentDetails Dept_Details on Dept_Details.DEPCode=Req.RequestedDept
from t_purchaseorder_master Mast
JOIN t_purchaseorder_lineitem Det on Det.PONO=Mast.PONO
left JOIN t_requestion_master as Req on Req.ReqNo=Det.ReqNo
left JOIN t_departmentdetails Dept_Details on Dept_Details.DEPCode=Req.RequestedDept
left JOIN T_CostCenter_Master as Cost on
Cost.CostCenterCode=Req.CostCenterCode
JOIN T_CostCenter_Budget as Cost_Center_Bdgt on Cost.CostCenterCode=Cost_Center_Bdgt.CostCenterCode
JOIN t_costcenter_budget as Cost_Center_Bdgt on Cost.CostCenterCode=Cost_Center_Bdgt.CostCenterCode
where Mast.Status='ST026'
";
if ($fa and $aa != ''){
@ -825,13 +825,13 @@ if ($fa and $aa != ''){
function report_openpending($fa,$aa,$m,$frm,$t,$agf,$agt){
$sql="select Mast.PONO as PONO,Mast.POType as POType,date_format(Mast.PODate,'%d-%m-%Y') as PODate,date_format(Mast.ApprovedOn,'%d-%m-%Y') as ApprovedDate,Dept_Details.DepartmentName As Dept_Name,Mast.TotalOrderValue
from T_PurchaseOrder_Master Mast
left JOIN T_PurchaseOrder_LineItem Det on Det.PONO=Mast.PONO
left JOIN T_Requestion_Master as Req on Req.ReqNo=Det.ReqNo
left JOIN T_DepartmentDetails Dept_Details on Dept_Details.DEPCode=Req.RequestedDept
from t_purchaseorder_master Mast
left JOIN t_purchaseorder_lineitem Det on Det.PONO=Mast.PONO
left JOIN t_requestion_master as Req on Req.ReqNo=Det.ReqNo
left JOIN t_departmentdetails Dept_Details on Dept_Details.DEPCode=Req.RequestedDept
left JOIN T_CostCenter_Master as Cost on
Cost.CostCenterCode=Req.CostCenterCode
JOIN T_CostCenter_Budget as Cost_Center_Bdgt on Cost.CostCenterCode=Cost_Center_Bdgt.CostCenterCode
JOIN t_costcenter_budget as Cost_Center_Bdgt on Cost.CostCenterCode=Cost_Center_Bdgt.CostCenterCode
where (Mast.Status='ST025' or Mast.Status='ST005')
";
if ($fa and $aa != ''){
@ -883,8 +883,8 @@ if ($fa and $aa != ''){
SUM(CASE WHEN Mast.Status = 'ST045' THEN 1 ELSE 0 END) AS MRIR_Rejected,
SUM(CASE WHEN Mast.Status = 'ST056' THEN 1 ELSE 0 END) AS Special_po
from T_PO_Detail Mast
left JOIN T_Requestion_Master as Req on Req.ReqNo=Mast.ReqNo
left JOIN T_DepartmentDetails Dept_Details on Dept_Details.DEPCode=Req.RequestedDept
left JOIN t_requestion_master as Req on Req.ReqNo=Mast.ReqNo
left JOIN t_departmentdetails Dept_Details on Dept_Details.DEPCode=Req.RequestedDept
where Mast.PODate >= '".$fa."-04-01' and Mast.PODate <= '".$aa."-03-31'
group by Dept_Name";
$query = $this->db->query($sql);
@ -913,8 +913,8 @@ group by Cost_Center_Code,BudgetYear,BudgetType";
$sql="select po.PODate as Material_Date,po.SupplierID,sup.SupplierName,pl.MaterialCode,mm.MaterialName,mm.MaterialType,mm.UOM,mm.HSNCODE
from T_PurchaseOrder_Master po
join T_PurchaseOrder_LineItem pl on pl.PONO=po.PONO
from t_purchaseorder_master po
join t_purchaseorder_lineitem pl on pl.PONO=po.PONO
join T_MaterialMaster mm on mm.MaterialCode=pl.MaterialCode
join T_SupplierDetailsN sup on sup.SupplierID=po.SupplierID
group by po.SupplierID,pl.MaterialCode";
@ -943,7 +943,7 @@ group by po.SupplierID,pl.MaterialCode";
DATE_FORMAT(IF(pm.PODate = '0000-00-00', NOW(), pm.PODate), '%b-%Y') AS Month,
matv.MaterialCode,mat.MaterialName,mat.UOM,ROUND(AVG(matv.Rate),2) as Average_Rate
from T_MaterialItem_PO matv
join T_PurchaseOrder_Master pm on pm.CreatedDate = matv.CreatedDate
join t_purchaseorder_master pm on pm.CreatedDate = matv.CreatedDate
join T_MaterialMaster mat on matv.MaterialCode=mat.MaterialCode
where pm.PODate != 0 ";
if ($fa and $aa != ''){
@ -991,8 +991,8 @@ ifnull(sum(pl.Quantity * pl.Rate),0)))
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0)
+ ifnull(rt.Insurance,0)
- ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)),2) as total
FROM T_PurchaseOrder_Master pm
join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
FROM t_purchaseorder_master pm
join t_purchaseorder_lineitem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
@ -1067,8 +1067,8 @@ ifnull(sum(pl.Quantity * pl.Rate),0)))
+ ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterPackagingValue),0),0)
+ ifnull(rt.Insurance,0)
- ifnull(if(POType = 'REVENUE',sum(distinct rt.AfterDiscount),sum(distinct st.Afterdiscountval)),0)),2) as total
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
FROM t_purchaseorder_master pm
left join t_purchaseorder_lineitem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
@ -1138,7 +1138,7 @@ $sql.="group by pono,material_name,supplier_name";
CASE WHEN MONTH(PODate)>=4 THEN
concat(YEAR(PODate), '-',YEAR(PODate)+1)
ELSE concat(YEAR(PODate)-1,'-', YEAR(PODate)) END AS financial_year
FROM T_PurchaseOrder_Master
FROM t_purchaseorder_master
GROUP BY financial_year";
$query = $this->db->query($sql);
return $query->result();
@ -1165,8 +1165,8 @@ GROUP BY financial_year";
$sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,pm.POdate as created_date,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as total
FROM T_PurchaseOrder_Master pm
join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
FROM t_purchaseorder_master pm
join t_purchaseorder_lineitem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
@ -1198,8 +1198,8 @@ group by month(created_date)";
$year = date("Y",strtotime($mont));
$sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as total
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
FROM t_purchaseorder_master pm
left join t_purchaseorder_lineitem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
@ -1211,8 +1211,8 @@ group by supplier_name,material_name";
function report_year_wise_total($a,$b){
$sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as total
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
FROM t_purchaseorder_master pm
left join t_purchaseorder_lineitem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
@ -1262,8 +1262,8 @@ then ifnull(sum(distinct pl.Quantity * pl.Rate),0)
end
as total
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
FROM t_purchaseorder_master pm
left join t_purchaseorder_lineitem pl on pl.PONO = pm.PONO
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
left join T_Revenue_Tax rt on rt.LineItemNo = pl.LineItemNo
@ -1333,8 +1333,8 @@ SUM(IF(month(pm.PODate) = 1, pl.Quantity * pl.Rate, 0)) AS vJanuary,
SUM(IF(month(pm.PODate) = 2, pl.Quantity * pl.Rate, 0)) AS vFebruary,
SUM(IF(month(pm.PODate) = 3, pl.Quantity * pl.Rate, 0)) AS vMarch,
sum(pl.Quantity * pl.Rate) as vtotal
FROM T_PurchaseOrder_Master pm
join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
FROM t_purchaseorder_master pm
join t_purchaseorder_lineitem pl on pl.PONO = pm.PONO
join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' ";
@ -1364,8 +1364,8 @@ if ($cname!= ''){
$sql="select mm.Category as category,sd.SupplierID as sid,sd.SupplierName as supplier_name,mm.MaterialCode as mid,mm.MaterialName as material_name,
sum(pl.Quantity) as quantity,
sum(pl.Quantity * pl.Rate) as total
FROM T_PurchaseOrder_Master pm
join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
FROM t_purchaseorder_master pm
join t_purchaseorder_lineitem pl on pl.PONO = pm.PONO
join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
@ -1387,8 +1387,8 @@ if ($fa and $aa != ''){
$sql="select mm.Category as category,sd.SupplierID as sid,sd.SupplierName as supplier_name,mm.MaterialCode as mid,mm.MaterialName as material_name,
sum(pl.Quantity) as quantity,
sum(pl.Quantity * pl.Rate) as total
FROM T_PurchaseOrder_Master pm
join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
FROM t_purchaseorder_master pm
join t_purchaseorder_lineitem pl on pl.PONO = pm.PONO
join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
@ -1416,8 +1416,8 @@ if ($fa and $aa != ''){
$sql="SELECT year.sid as sid,year.mid as mid,year.supplier_name as supplier_name,year.material_name as material_name,year.quantity as quantity,year.total as total,month.mquantity as mquantity,month.mtotal as mtotal,today.tquantity as tquantity,today.ttotal as ttotal
FROM (SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,ifnull(sum(pl.Quantity),0) as quantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as total
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
FROM t_purchaseorder_master pm
left join t_purchaseorder_lineitem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' and sd.SupplierName is not null and
@ -1425,8 +1425,8 @@ where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' an
group by supplier_name,material_name
) as year left join
(SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,ifnull(sum(pl.Quantity),0) as mquantity,round(ifnull(sum(pl.Quantity * pl.Rate),0),2) as mtotal
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
FROM t_purchaseorder_master pm
left join t_purchaseorder_lineitem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' and sd.SupplierName is not null and
@ -1435,8 +1435,8 @@ group by supplier_name,material_name
) as month on month.supplier_name=year.supplier_name and month.material_name=year.material_name
left join
(SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
FROM t_purchaseorder_master pm
left join t_purchaseorder_lineitem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' and sd.SupplierName is not null and
@ -1451,8 +1451,8 @@ group by supplier_name,material_name
function report_cum_month($sup=null,$mat=null){
$sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
FROM t_purchaseorder_master pm
left join t_purchaseorder_lineitem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' and sd.SupplierName is not null and month(pm.PODate) = month(current_date()) and sd.SupplierID = '".$sup."' and mm.MaterialCode = '".$mat."'
@ -1470,8 +1470,8 @@ group by supplier_name,material_name";
$fa=substr($ab,0,-5);
$aa=substr($ab,5,5);
$sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
FROM t_purchaseorder_master pm
left join t_purchaseorder_lineitem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' and sd.SupplierName is not null and
@ -1484,8 +1484,8 @@ group by supplier_name,material_name";
function report_cum_day($sup=null,$mat=null){
$sql="SELECT sd.SupplierID as sid,mm.MaterialCode as mid,sd.SupplierName as supplier_name,ifnull(mm.MaterialName,'-') as material_name,IF(pl.Quantity IS NULL or pl.Quantity = '', 0, sum(pl.Quantity)) as tquantity,ifnull(sum(pl.Quantity * pl.Rate),0) as ttotal
FROM T_PurchaseOrder_Master pm
left join T_PurchaseOrder_LineItem pl on pl.PONO = pm.PONO
FROM t_purchaseorder_master pm
left join t_purchaseorder_lineitem pl on pl.PONO = pm.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
where pm.Status != 'ST030' and pm.Status != 'ST056' and pm.Status != 'ST027' and sd.SupplierName is not null and
@ -1539,9 +1539,9 @@ ifnull((id.QuantityAsPerInvoice * pl.Rate),0)))
(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
im.file as ifile,pb.FilePath as file,infiles.FilePath as Infiles
from T_IGR_Master im
left join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
left join t_purchaseorder_lineitem pl on pl.PONO = im.PONO
join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO
join t_purchaseorder_master pm on pm.PONO = pl.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
@ -1644,9 +1644,9 @@ ifnull((id.QuantityAsPerInvoice * pl.Rate),0)))
(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
im.file as ifile,pb.FilePath as file,infiles.FilePath as Infiles
from T_IGR_Master im
left join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
left join t_purchaseorder_lineitem pl on pl.PONO = im.PONO
join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO
join t_purchaseorder_master pm on pm.PONO = pl.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
@ -1908,9 +1908,9 @@ then ifnull(sum(id.QuantityAsPerInvoice * pl.Rate),0)
end
as total,im.MaterialRcvdDate
from T_IGR_Master im
left join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
left join t_purchaseorder_lineitem pl on pl.PONO = im.PONO
join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO
join t_purchaseorder_master pm on pm.PONO = pl.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo
@ -2280,8 +2280,8 @@ if ($fa and $aa != ''){
function pending_purchase($cname,$prod,$fa,$aa,$m,$frm,$t){
$sql="select po.PONO as po,date_format(po.PODate,'%d-%m-%Y') as pdate,sup.SupplierName as supplier,mm.MaterialName as material,mm.Category as category,pl.Quantity as quantity,pl.ReceivedQuantity as received, (pl.Quantity - pl.ReceivedQuantity) as pending
from T_PurchaseOrder_LineItem pl
join T_PurchaseOrder_Master po on po.PONO = pl.PONO
from t_purchaseorder_lineitem pl
join t_purchaseorder_master po on po.PONO = pl.PONO
join T_SupplierDetailsN sup on sup.SupplierID=po.SupplierID
join T_MaterialMaster mm on mm.MaterialCode=pl.MaterialCode
where po.Status != 'ST030' and po.Status = 'ST026'
@ -2525,9 +2525,9 @@ ifnull((id.QuantityAsPerInvoice * pl.Rate),0)))
(id.QuantityAsPerInvoice * st.Afterdiscountval / pl.Quantity)),0),2)),2) as total,
im.file as ifile,pb.FilePath as file
from T_IGR_Master im
left join T_PurchaseOrder_LineItem pl on pl.PONO = im.PONO
left join t_purchaseorder_lineitem pl on pl.PONO = im.PONO
join T_IGR_Details id on id.IGRNO = im.IGRNO and id.MaterialCode = pl.MaterialCode
join T_PurchaseOrder_Master pm on pm.PONO = pl.PONO
join t_purchaseorder_master pm on pm.PONO = pl.PONO
left join T_MaterialMaster mm on mm.MaterialCode = pl.MaterialCode
left join T_SupplierDetailsN sd on sd.SupplierID = pm.SupplierID
left join T_Service_Tax st on st.LineItemNo = pl.LineItemNo

View File

@ -10,7 +10,7 @@ class department_model extends CI_Model
// function departmentListingCount($searchText = '')
// {
// $this->db->select('BaseT.DepartmentID, BaseT.SupplierName, BaseT.Address, BaseT.ContactNumber, BaseT.AlternateContactNumber,BaseT.EmailAddress,BaseT.Exiseregistration,BaseT.TIN,BaseT.PAN,BaseT.GSTNO,BaseT.GSTRange,BaseT.CollectrateAddress,BaseT.UANumber,BaseT.PaymentTerms,BaseT.PaymentDays,BaseT.PayableAT');
// $this->db->from('T_DepartmentDetails as BaseT');
// $this->db->from('t_departmentdetails as BaseT');
// //$this->db->join('tbl_users as users', 'users.userId = BaseT.userId','left');
// //$this->db->join('T_SupplierDetails as ID', 'ID.DepartmentID = BaseT.DepartmentID','left');
// if(!empty($searchText)) {
@ -48,7 +48,7 @@ class department_model extends CI_Model
function departmentListing()
{
$this->db->select('BaseT.DepartmentName, BaseT.DEPCode, BaseT.HeadDept, BaseT.IsActive');
$this->db->from('T_DepartmentDetails as BaseT');
$this->db->from('t_departmentdetails as BaseT');
$this->db->order_by("BaseT.DEPCode", "asc");
$query = $this->db->get();
$result = $query->result();
@ -81,7 +81,7 @@ class department_model extends CI_Model
function addNewdepartment($department)
{
$this->db->insert('T_DepartmentDetails', $department);
$this->db->insert('t_departmentdetails', $department);
$SID = $this->db->affected_rows();
@ -94,7 +94,7 @@ function getdepcode()
//$limit = 12;
$this->db->distinct();
$this->db->select('DEPCode, DepartmentName');
$this->db->from('T_DepartmentDetails');
$this->db->from('t_departmentdetails');
$this->db->where('IsActive =', 1);
//$this->db->limit($limit);
$query = $this->db->get();
@ -110,7 +110,7 @@ function getdepcode()
function getDeptInfo($DEPCode='')
{
$this->db->select('*');
$this->db->from('T_DepartmentDetails');
$this->db->from('t_departmentdetails');
$this->db->where('DEPCode', $DEPCode);
$query = $this->db->get();
// print_r($this->db->last_query());
@ -121,7 +121,7 @@ function getdepcode()
function Updatedepartment($department, $DEPCode)
{
$this->db->where('DEPCode', $DEPCode);
$this->db->update('T_DepartmentDetails', $department);
$this->db->update('t_departmentdetails', $department);
return TRUE;
}

View File

@ -15,8 +15,8 @@ class employeedetails_model extends CI_Model
function employeeListing()
{
$this->db->select(' Emp.*,Dep.DepartmentName as DepartmentName');
$this->db->from('T_Employee_Details Emp');
$this->db->join('T_DepartmentDetails Dep', 'Emp.Departmentcode = Dep.DEPCode','left');
$this->db->from('t_employee_details Emp');
$this->db->join('t_departmentdetails Dep', 'Emp.Departmentcode = Dep.DEPCode','left');
$this->db->order_by("Emp.EmpID", "asc");
@ -53,13 +53,13 @@ class employeedetails_model extends CI_Model
}
/* *//**
* This function is used to get the Department details from T_DepartmentDetails
* This function is used to get the Department details from t_departmentdetails
* @return array $result : This is result of the query
*/
function getDepartment()
{
$this->db->select('DEPCode, DepartmentName');
$this->db->from('T_DepartmentDetails');
$this->db->from('t_departmentdetails');
$this->db->where('IsActive =', 1);
$query = $this->db->get();
@ -74,7 +74,7 @@ class employeedetails_model extends CI_Model
function addNewemployee($Employee)
{
$this->db->insert('T_Employee_Details', $Employee);
$this->db->insert('t_employee_details', $Employee);
$EmpID = $this->db->affected_rows();
@ -86,7 +86,7 @@ function addNewemployee($Employee)
{
//echo $EmpID;
$this->db->where('EmpID', $EmpID);
$this->db->update('T_Employee_Details', $Emp);
$this->db->update('t_employee_details', $Emp);
//print_r($this->db->last_query());
return TRUE;
}
@ -95,8 +95,8 @@ function addNewemployee($Employee)
function viewemployee( $EmpID)
{
$this->db->select('Emp.*,Dep.DepartmentName as DepartmentName');
$this->db->from('T_Employee_Details AS Emp');
$this->db->join('T_DepartmentDetails Dep', 'Emp.Departmentcode = Dep.DEPCode','left');
$this->db->from('t_employee_details AS Emp');
$this->db->join('t_departmentdetails Dep', 'Emp.Departmentcode = Dep.DEPCode','left');
$this->db->where('Emp.EmpID', $EmpID);
$query = $this->db->get();
@ -119,7 +119,7 @@ function addNewemployee($Employee)
function checkMailExists($email='',$Empid='')
{
$this->db->select('EmailId');
$this->db->from('T_Employee_Details');
$this->db->from('t_employee_details');
$this->db->where('EmailId',$email);
if ($Empid != '')
{
@ -135,7 +135,7 @@ function addNewemployee($Employee)
function checkAadharExists($AadharNo,$Empid='')
{
$this->db->select('AadharNo');
$this->db->from('T_Employee_Details');
$this->db->from('t_employee_details');
$this->db->where('AadharNo',$AadharNo);
if ($Empid != '')
{
@ -150,7 +150,7 @@ function addNewemployee($Employee)
function checkPANExists($PANNo,$Empid='')
{
$this->db->select('PANNo');
$this->db->from('T_Employee_Details');
$this->db->from('t_employee_details');
$this->db->where('PANNo',$PANNo);
if ($Empid != '')
{
@ -167,7 +167,7 @@ function addNewemployee($Employee)
function checkPhotoExists($Pic)
{
$this->db->select('ProfilePic');
$this->db->from('T_Employee_Details');
$this->db->from('t_employee_details');
$this->db->where($Pic);
$query = $this->db->get();
@ -180,7 +180,7 @@ function getEmployeeCount( )
{
$this->db->select('count(*) as EmpCount');
$this->db->from('T_Employee_Details');
$this->db->from('t_employee_details');
$this->db->where('IsActive ',1 );
$query = $this->db->get();
return $query->result();
@ -199,12 +199,12 @@ function getEmployeeCount( )
function export_excel(){
$this->db->select(' det.*,Dep.DepartmentName as DepartmentName,det.firstname,emp1.firstname as UpdatedByName,emp1.firstname as CreatedByName');
$this->db->join('T_DepartmentDetails Dep', 'det.Departmentcode = Dep.DEPCode','left');
$this->db->join('t_departmentdetails Dep', 'det.Departmentcode = Dep.DEPCode','left');
$this->db->join('tbl_users as tbl',' det.createdby = tbl.userid','left');
$this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid','left');
$this->db->join('t_employee_details as emp', 'emp.empid=tbl.empid','left');
$this->db->join('tbl_users as tbl1',' det.UpdatedBy = tbl1.userid','left');
$this->db->join('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid','left');
return $this->db->get('T_Employee_Details as det')->result_array();
$this->db->join('t_employee_details as emp1', 'emp1.empid=tbl1.empid','left');
return $this->db->get('t_employee_details as det')->result_array();
}
}
?>

View File

@ -17,9 +17,9 @@ class emppaydate_model extends CI_Model
function emppayListing()
{
$this->db->select('T_Emp_Pay_Data.*,T_Employee_Details.FirstName,T_Employee_Details.LastName');
$this->db->select('T_Emp_Pay_Data.*,t_employee_details.FirstName,t_employee_details.LastName');
$this->db->from('T_Emp_Pay_Data');
$this->db->join('T_Employee_Details','T_Emp_Pay_Data.EmpID=T_Employee_Details.EmpID');
$this->db->join('t_employee_details','T_Emp_Pay_Data.EmpID=t_employee_details.EmpID');
$query = $this->db->get();
$result = $query->result();
return $result;
@ -51,7 +51,7 @@ class emppaydate_model extends CI_Model
function addLoanInfo($dataarray,$string)
{
if($string == 'add'){
$this->db->insert('T_Loan_Master', $dataarray);
$this->db->insert('t_loan_master', $dataarray);
$loanid = $this->db->affected_rows();
return $loanid;
}
@ -59,16 +59,16 @@ class emppaydate_model extends CI_Model
{
$loanid = $dataarray['Loan_ID'];
$this->db->where('Loan_ID',$loanid);
$this->db->update('T_Loan_Master', $dataarray);
$this->db->update('t_loan_master', $dataarray);
$loanid = $this->db->affected_rows();
return $loanid;
}
}
function getUserInfo($paydataid)
{
$sql = 'select T_Emp_Pay_Data.Pay_Data_ID,T_Emp_Pay_Data.EmpID as PAYEMPID,T_Emp_Pay_Data.Basic_Pay,T_Emp_Pay_Data.HRA_Rate,T_Emp_Pay_Data.Allowances,T_Emp_Pay_Data.Food_Allowances,T_Emp_Pay_Data.Incentives,T_Emp_Pay_Data.PF_Rate,T_Emp_Pay_Data.ESI_Rate,T_Emp_Pay_Data.HRA_Amount,T_Emp_Pay_Data.TotalSalary,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Loan_Master.*from T_Emp_Pay_Data
join T_Employee_Details on T_Emp_Pay_Data.EmpID=T_Employee_Details.EmpID
left join T_Loan_Master on T_Emp_Pay_Data.EmpID=T_Loan_Master.EmpID and T_Loan_Master.is_Active = 1
$sql = 'select T_Emp_Pay_Data.Pay_Data_ID,T_Emp_Pay_Data.EmpID as PAYEMPID,T_Emp_Pay_Data.Basic_Pay,T_Emp_Pay_Data.HRA_Rate,T_Emp_Pay_Data.Allowances,T_Emp_Pay_Data.Food_Allowances,T_Emp_Pay_Data.Incentives,T_Emp_Pay_Data.PF_Rate,T_Emp_Pay_Data.ESI_Rate,T_Emp_Pay_Data.HRA_Amount,T_Emp_Pay_Data.TotalSalary,t_employee_details.FirstName,t_employee_details.LastName,t_loan_master.*from T_Emp_Pay_Data
join t_employee_details on T_Emp_Pay_Data.EmpID=t_employee_details.EmpID
left join t_loan_master on T_Emp_Pay_Data.EmpID=t_loan_master.EmpID and t_loan_master.is_Active = 1
where T_Emp_Pay_Data.Pay_Data_ID = ?;';
$query = $this->db->query($sql,array($paydataid));

View File

@ -90,7 +90,7 @@ return $afftectedRows;
// {
// $this->db->select('igr.*,PO.DeliveryDate,sup.SupplierName,igr.file');
// $this->db->from('T_IGR_Master igr');
// $this->db->join('T_PurchaseOrder_Master PO','igr.PONO = PO.PONO');
// $this->db->join('t_purchaseorder_master PO','igr.PONO = PO.PONO');
// $this->db->join('T_SupplierDetailsN` sup','PO.SupplierID = sup.SupplierID');
// $this->db->order_by('igr.CreatedDate','desc');
// $query = $this->db->get();
@ -101,7 +101,7 @@ return $afftectedRows;
{
$this->db->select('igr.*,PO.DeliveryDate,sup.SupplierName,fileup.FilePath,igr.file');
$this->db->from('T_IGR_Master igr');
$this->db->join('T_PurchaseOrder_Master PO','igr.PONO = PO.PONO');
$this->db->join('t_purchaseorder_master PO','igr.PONO = PO.PONO');
$this->db->join('T_Inwardgateregister_fileupload fileup',' igr.IGRNO = fileup.IGRNO','left');
$this->db->join('T_SupplierDetailsN` sup','PO.SupplierID = sup.SupplierID');
$this->db->group_by('igr.IGRNO','desc');
@ -155,8 +155,8 @@ return $afftectedRows;
{
$this->db->distinct();
$this->db->select('POM.PONO,POM.ServiceDescription,POM.DeliveryDate,sup.SupplierName,sup.Address,POM.status,OGR_Status');
$this->db->from('T_PurchaseOrder_Master POM');
$this->db->join('T_PurchaseOrder_LineItem POL', 'POL.PONO = POM.PONO');
$this->db->from('t_purchaseorder_master POM');
$this->db->join('t_purchaseorder_lineitem POL', 'POL.PONO = POM.PONO');
$this->db->join('T_SupplierDetailsN sup', 'POM.SupplierID = sup.SupplierID');
$this->db->join('T_OGR_Master OGM ', 'POM.PONO = OGM.PONO_INV','left');
$this->db->where('POM.Status',PO_RELEASED);
@ -177,8 +177,8 @@ return $afftectedRows;
{
$subQuery ='SELECT distinct POM.PONO,POL.MaterialCode,POL.Quantity,POL.ReceivedQuantity,(POL.Quantity -POL.ReceivedQuantity ) as PendingQty,QuantityRejected,POL.PONO,MM.MaterialName,MM.UOM
from T_PurchaseOrder_Master POM
left join T_PurchaseOrder_LineItem POL on POL.PONO = POM.PONO
from t_purchaseorder_master POM
left join t_purchaseorder_lineitem POL on POL.PONO = POM.PONO
left join T_IGR_Master IGM on IGM.PONO =POL.PONO
left join T_IGR_Details igr on igr.MaterialCode = POL.MaterialCode and IGM.PONO =POL.PONO
left join T_MaterialMaster MM on MM.MaterialCode = POL.MaterialCode
@ -192,8 +192,8 @@ return $afftectedRows;
return $query->result();
/* $this->db->select('POM.PONO,POL.MaterialCode,POL.Quantity,POL.PONO,MM.MaterialName,MM.UOM');
$this->db->from('T_PurchaseOrder_Master POM');
$this->db->join('T_PurchaseOrder_LineItem POL', 'POL.PONO = POM.PONO','left');
$this->db->from('t_purchaseorder_master POM');
$this->db->join('t_purchaseorder_lineitem POL', 'POL.PONO = POM.PONO','left');
$this->db->join('T_MaterialMaster MM', 'MM.MaterialCode = POL.MaterialCode','left');
$this->db->where('POM.PONO',$PO );
@ -284,9 +284,9 @@ return $afftectedRows;
function getitemvalue($pono,$MaterialCode)
{
$this->db->select('Rate,SupplierID');
$this->db->from('T_PurchaseOrder_LineItem');
$this->db->join('T_PurchaseOrder_Master','T_PurchaseOrder_Master.PONO=T_PurchaseOrder_LineItem.PONO');
$this->db->where('T_PurchaseOrder_LineItem.PONO',$pono);
$this->db->from('t_purchaseorder_lineitem');
$this->db->join('t_purchaseorder_master','t_purchaseorder_master.PONO=t_purchaseorder_lineitem.PONO');
$this->db->where('t_purchaseorder_lineitem.PONO',$pono);
$this->db->where('MaterialCode',$MaterialCode);
$query = $this->db->get();
$result = $query->result();
@ -302,8 +302,8 @@ return $afftectedRows;
$this->db->select('igr.IGRNO,igr.*,igrd.*,MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity');
$this->db->from('T_IGR_Master igr');
$this->db->join('T_IGR_Details igrd','igrd.IGRNO = igr.IGRNO');
$this->db->join('T_PurchaseOrder_Master POM','igr.PONO = POM.PONO');
$this->db->join('T_PurchaseOrder_LineItem POL','igr.PONO = POL.PONO and POL.MaterialCode=igrd.MaterialCode ');
$this->db->join('t_purchaseorder_master POM','igr.PONO = POM.PONO');
$this->db->join('t_purchaseorder_lineitem POL','igr.PONO = POL.PONO and POL.MaterialCode=igrd.MaterialCode ');
$this->db->join('T_SupplierDetailsN sup', 'sup.SupplierID = POM.SupplierID');
$this->db->join('T_MaterialMaster MM', 'MM.MaterialCode = igrd.MaterialCode');
$this->db->where('igr.IGRNO',$IGRNO);
@ -319,7 +319,7 @@ return $afftectedRows;
{
$this->db->where('PONO', $PONO);
$this->db->where('MaterialCode', $MaterialCode);
$this->db->update('T_PurchaseOrder_LineItem', $LineItem);
$this->db->update('t_purchaseorder_lineitem', $LineItem);
return TRUE;
}
@ -339,7 +339,7 @@ return $afftectedRows;
function UpdatePOMasterOGRStatus($pono,$POMasterStatuss)
{
$this->db->where('PONO', $pono);
$this->db->update('T_PurchaseOrder_Master', $POMasterStatuss);
$this->db->update('t_purchaseorder_master', $POMasterStatuss);
return TRUE;
}
@ -362,7 +362,7 @@ return $afftectedRows;
function UpdatePOMaster($PONO,$updatedBy)
{
$this->db->select('*');
$this->db->from('T_PurchaseOrder_LineItem');
$this->db->from('t_purchaseorder_lineitem');
$this->db->where('PONO',$PONO);
$this->db->where('Status !=',IGR_CREATED);
@ -372,7 +372,7 @@ return $afftectedRows;
if ($query->num_rows == 0) {
$this->db->where('PONO', $PONO);
$POStatus = array('status'=>IGR_CREATED,'UpdateBY'=>$updatedBy);
$this->db->update('T_PurchaseOrder_Master', $POStatus);
$this->db->update('t_purchaseorder_master', $POStatus);
}
}
@ -430,7 +430,7 @@ return $afftectedRows;
function updateogrpomaster($pono)
{
$this->db->select('*');
$this->db->from('T_PurchaseOrder_LineItem');
$this->db->from('t_purchaseorder_lineitem');
$this->db->where('PONO',$pono);
$this->db->where('OGR_Status !=','ST064');
@ -440,7 +440,7 @@ return $afftectedRows;
if ($query->num_rows == 0) {
$this->db->where('PONO',$pono);
$POStatus = array('status'=>'ST063');
$this->db->update('T_PurchaseOrder_Master', $POStatus);
$this->db->update('t_purchaseorder_master', $POStatus);
}
}
@ -449,7 +449,7 @@ return $afftectedRows;
function getPOLineItemReceivedQty($PONO,$MaterialCode)
{
$this->db->select('ReceivedQuantity');
$this->db->from('T_PurchaseOrder_LineItem');
$this->db->from('t_purchaseorder_lineitem');
$this->db->where('PONO',$PONO);
$this->db->where('MaterialCode',$MaterialCode);
$query = $this->db->get();
@ -506,8 +506,8 @@ return $afftectedRows;
$this->db->select('T_OGR_Master.*,T_OGR_Details.*,T_SupplierDetailsN.SupplierName,sup.SupplierName as Servicesupplier');
$this->db->from('T_OGR_Master');
$this->db->join('T_OGR_Details','T_OGR_Details.OGRNO=T_OGR_Master.OGRNO');
$this->db->join('T_PurchaseOrder_Master','T_PurchaseOrder_Master.PONO=T_OGR_Master.PONO_INV','left');
$this->db->join('T_SupplierDetailsN','T_SupplierDetailsN.SupplierID=T_PurchaseOrder_Master.SupplierID','left');
$this->db->join('t_purchaseorder_master','t_purchaseorder_master.PONO=T_OGR_Master.PONO_INV','left');
$this->db->join('T_SupplierDetailsN','T_SupplierDetailsN.SupplierID=t_purchaseorder_master.SupplierID','left');
$this->db->join('T_SupplierDetailsN sup','sup.SupplierID=T_OGR_Details.SupplierID','left');
$this->db->group_by('T_OGR_Master.OGRNO');
//$this->db->where();
@ -523,8 +523,8 @@ return $afftectedRows;
$this->db->select('T_OGR_Master.*,T_SupplierDetailsN.SupplierName,T_OGR_Details.*,sup.SupplierName as ServiceSupname,T_MaterialMaster.MaterialName as Matname,Remark');
$this->db->from('T_OGR_Master');
$this->db->join('T_OGR_Details','T_OGR_Details.OGRNO=T_OGR_Master.OGRNO');
$this->db->join('T_PurchaseOrder_Master','T_PurchaseOrder_Master.PONO=T_OGR_Master.PONO_INV','left');
$this->db->join('T_SupplierDetailsN','T_SupplierDetailsN.SupplierID=T_PurchaseOrder_Master.SupplierID','left');
$this->db->join('t_purchaseorder_master','t_purchaseorder_master.PONO=T_OGR_Master.PONO_INV','left');
$this->db->join('T_SupplierDetailsN','T_SupplierDetailsN.SupplierID=t_purchaseorder_master.SupplierID','left');
$this->db->join('T_SupplierDetailsN sup','sup.SupplierID=T_OGR_Details.SupplierID','left');
$this->db->join('T_MaterialMaster','T_MaterialMaster.MaterialCode=T_OGR_Details.MaterialCode','left');
@ -547,8 +547,8 @@ return $afftectedRows;
$this->db->join('T_OGR_Master','T_OGR_Master.OGRNO=T_OGR_Details.OGRNO');
$this->db->join('T_MRIR_Master','T_MRIR_Master.PONO=T_OGR_Master.PONO_INV','left');
$this->db->join('T_MRIR_Details','T_MRIR_Details.MRIRNO=T_MRIR_Master.MRIRNO and T_MRIR_Details.MaterialCode=T_OGR_Details.MaterialCode');
$this->db->join('T_PurchaseOrder_Master','T_PurchaseOrder_Master.PONO=T_MRIR_Master.PONO');
$this->db->join('T_PurchaseOrder_LineItem','T_PurchaseOrder_Master.PONO=T_PurchaseOrder_LineItem.PONO and T_OGR_Details.MaterialCode=T_PurchaseOrder_LineItem.MaterialCode');
$this->db->join('t_purchaseorder_master','t_purchaseorder_master.PONO=T_MRIR_Master.PONO');
$this->db->join('t_purchaseorder_lineitem','t_purchaseorder_master.PONO=t_purchaseorder_lineitem.PONO and T_OGR_Details.MaterialCode=t_purchaseorder_lineitem.MaterialCode');
$this->db->where('T_OGR_Details.OGRNO',$OGRNO);
$this->db->where('T_MRIR_Details.MRIRNO',$MRIRNO);
$this->db->group_by('T_OGR_Details.MaterialCode');
@ -597,9 +597,9 @@ return $afftectedRows;
{
/// echo $supplierId;
$subQuery='select T_PurchaseOrder_Master.PONO from T_PurchaseOrder_Master
join T_MRIR_Master on T_MRIR_Master.PONO= T_PurchaseOrder_Master.PONO
where T_PurchaseOrder_Master.SupplierID=? and (T_PurchaseOrder_Master.Status=? or T_PurchaseOrder_Master.Status=? or T_PurchaseOrder_Master.Status=? or T_PurchaseOrder_Master.Status=? or T_PurchaseOrder_Master.Status=? or T_PurchaseOrder_Master.Status=? or T_PurchaseOrder_Master.Status=?) group by T_PurchaseOrder_Master.PONO';
$subQuery='select t_purchaseorder_master.PONO from t_purchaseorder_master
join T_MRIR_Master on T_MRIR_Master.PONO= t_purchaseorder_master.PONO
where t_purchaseorder_master.SupplierID=? and (t_purchaseorder_master.Status=? or t_purchaseorder_master.Status=? or t_purchaseorder_master.Status=? or t_purchaseorder_master.Status=? or t_purchaseorder_master.Status=? or t_purchaseorder_master.Status=? or t_purchaseorder_master.Status=?) group by t_purchaseorder_master.PONO';
//$query= $this->db->query($subQuery, array($supplierId,ST044,PO,ST063));
$query= $this->db->query($subQuery, array($supplierId,ST044,PO,PO_RELEASED,IGR_CREATED,MRIR_CREATED,PARTIAL_MRIRAPPROVED,OGR_COMPLETE,OGR_PARTIAL_COMPLETE,OGR_CREATED));
@ -612,17 +612,17 @@ return $afftectedRows;
function getPODetails($PONO)
{
$subQuery ='select distinct T_PurchaseOrder_Master.PONO,T_PurchaseOrder_LineItem.MaterialCode,
T_PurchaseOrder_LineItem.Quantity as Oqty,T_MRIR_Details.ActualQuantityReceived,
$subQuery ='select distinct t_purchaseorder_master.PONO,t_purchaseorder_lineitem.MaterialCode,
t_purchaseorder_lineitem.Quantity as Oqty,T_MRIR_Details.ActualQuantityReceived,
T_MRIR_Details.QuantityRejected,MaterialName,balance_Qty
from T_PurchaseOrder_Master
join T_PurchaseOrder_LineItem on T_PurchaseOrder_LineItem.PONO = T_PurchaseOrder_Master.PONO
join T_MRIR_Master on T_MRIR_Master.PONO = T_PurchaseOrder_Master.PONO
join T_MRIR_Details on T_MRIR_Master.MRIRNO = T_MRIR_Details.MRIRNO and T_PurchaseOrder_LineItem.MaterialCode=T_MRIR_Details.MaterialCode
from t_purchaseorder_master
join t_purchaseorder_lineitem on t_purchaseorder_lineitem.PONO = t_purchaseorder_master.PONO
join T_MRIR_Master on T_MRIR_Master.PONO = t_purchaseorder_master.PONO
join T_MRIR_Details on T_MRIR_Master.MRIRNO = T_MRIR_Details.MRIRNO and t_purchaseorder_lineitem.MaterialCode=T_MRIR_Details.MaterialCode
join T_MaterialMaster on T_MRIR_Details.MaterialCode=T_MaterialMaster.MaterialCode
left join T_OGR_Master on T_PurchaseOrder_Master.PONO=T_OGR_Master.PONO_INV
left join T_OGR_Details on T_OGR_Master.OGRNO=T_OGR_Details.OGRNO and T_PurchaseOrder_LineItem.MaterialCode= T_OGR_Details.MaterialCode
where T_PurchaseOrder_Master.PONO=?';
left join T_OGR_Master on t_purchaseorder_master.PONO=T_OGR_Master.PONO_INV
left join T_OGR_Details on T_OGR_Master.OGRNO=T_OGR_Details.OGRNO and t_purchaseorder_lineitem.MaterialCode= T_OGR_Details.MaterialCode
where t_purchaseorder_master.PONO=?';
$query = $this->db->query($subQuery, array($PONO));
//print_r($this->db->last_query());
@ -640,7 +640,7 @@ MaterialName,Quantity as Oqty,SUM(Ogr_Out_Qty) as allowedQty
from T_MRIR_Details
join T_MaterialMaster on T_MRIR_Details.MaterialCode=T_MaterialMaster.MaterialCode
join T_MRIR_Master on T_MRIR_Details.MRIRNO = T_MRIR_Master.MRIRNO
join T_PurchaseOrder_LineItem on T_MRIR_Master.PONO = T_PurchaseOrder_LineItem.PONO and T_PurchaseOrder_LineItem.MaterialCode=T_MRIR_Details.MaterialCode
join t_purchaseorder_lineitem on T_MRIR_Master.PONO = t_purchaseorder_lineitem.PONO and t_purchaseorder_lineitem.MaterialCode=T_MRIR_Details.MaterialCode
where T_MRIR_Details.MRIRNO=? and T_MRIR_Master.PONO=? and T_MRIR_Details.MaterialCode=? group by T_MRIR_Details.MaterialCode;';
$query = $this->db->query($subQuery, array($MRIRno,$PONO,$materialcode));
//print_r($this->db->last_query());
@ -686,15 +686,15 @@ $query = $this->db->query($subQuery, array($PONO,$materialcode));
function getPOmaterialDetails($PONO,$materialcode)
{
$subQuery='select distinct T_PurchaseOrder_LineItem.MaterialCode,MaterialName,T_PurchaseOrder_LineItem.Quantity as Oqty,T_MRIR_Details.ActualQuantityReceived,T_MRIR_Details.QuantityRejected,balance_Qty
from T_PurchaseOrder_Master
join T_PurchaseOrder_LineItem on T_PurchaseOrder_LineItem.PONO = T_PurchaseOrder_Master.PONO
join T_MRIR_Master on T_MRIR_Master.PONO = T_PurchaseOrder_Master.PONO
join T_MRIR_Details on T_MRIR_Master.MRIRNO = T_MRIR_Details.MRIRNO and T_PurchaseOrder_LineItem.MaterialCode=T_MRIR_Details.MaterialCode
$subQuery='select distinct t_purchaseorder_lineitem.MaterialCode,MaterialName,t_purchaseorder_lineitem.Quantity as Oqty,T_MRIR_Details.ActualQuantityReceived,T_MRIR_Details.QuantityRejected,balance_Qty
from t_purchaseorder_master
join t_purchaseorder_lineitem on t_purchaseorder_lineitem.PONO = t_purchaseorder_master.PONO
join T_MRIR_Master on T_MRIR_Master.PONO = t_purchaseorder_master.PONO
join T_MRIR_Details on T_MRIR_Master.MRIRNO = T_MRIR_Details.MRIRNO and t_purchaseorder_lineitem.MaterialCode=T_MRIR_Details.MaterialCode
join T_MaterialMaster on T_MRIR_Details.MaterialCode=T_MaterialMaster.MaterialCode
left join T_OGR_Master on T_PurchaseOrder_Master.PONO=T_OGR_Master.PONO_INV
left join T_OGR_Details on T_OGR_Master.OGRNO=T_OGR_Details.OGRNO and T_PurchaseOrder_LineItem.MaterialCode= T_OGR_Details.MaterialCode
where T_PurchaseOrder_LineItem.PONO=? and T_PurchaseOrder_LineItem.MaterialCode=?'
left join T_OGR_Master on t_purchaseorder_master.PONO=T_OGR_Master.PONO_INV
left join T_OGR_Details on T_OGR_Master.OGRNO=T_OGR_Details.OGRNO and t_purchaseorder_lineitem.MaterialCode= T_OGR_Details.MaterialCode
where t_purchaseorder_lineitem.PONO=? and t_purchaseorder_lineitem.MaterialCode=?'
;
$query = $this->db->query($subQuery, array($PONO,$materialcode));
// print_r($this->db->last_query());
@ -704,7 +704,7 @@ $query = $this->db->query($subQuery, array($PONO,$materialcode));
function getPOmaterial($PONO)
{
$subQuery ='select MaterialCode from T_PurchaseOrder_LineItem where PONO=?';
$subQuery ='select MaterialCode from t_purchaseorder_lineitem where PONO=?';
$query = $this->db->query($subQuery, array($PONO));
//print_r($this->db->last_query());
@ -786,14 +786,14 @@ function getPOmaterial($PONO)
function GetPreSavedQty($pono,$MaterialCode)
{
// $subQuery = 'select Total_OutwardQty from T_PurchaseOrder_LineItem where PONO=? and MaterialCode=?';
// $subQuery = 'select Total_OutwardQty from t_purchaseorder_lineitem where PONO=? and MaterialCode=?';
// $query = $this->db->query($subQuery, array($pono,$MaterialCode));
// //print_r($this->db->last_query());
// return $query->result();
$this->db->select('Total_OutwardQty');
$this->db->from('T_PurchaseOrder_LineItem');
$this->db->from('t_purchaseorder_lineitem');
$this->db->where('PONO',$pono);
$this->db->where('MaterialCode',$MaterialCode);
$query = $this->db->get();
@ -816,7 +816,7 @@ function getPOmaterial($PONO)
{
$this->db->where('PONO',$pono);
//$this->db->where('MaterialCode', $MaterialCode);
$this->db->update('T_PurchaseOrder_Master', $postatus);
$this->db->update('t_purchaseorder_master', $postatus);
return TRUE;
}
@ -832,7 +832,7 @@ function getPOmaterial($PONO)
function getpolineqty($NewPO)
{
$this->db->select('sum(Quantity)as Qty,sum(ReceivedQuantity)as rec');
$this->db->from('T_PurchaseOrder_LineItem');
$this->db->from('t_purchaseorder_lineitem');
$this->db->where('PONO',$NewPO);
$query = $this->db->get();
@ -843,7 +843,7 @@ function getPOmaterial($PONO)
function POLineItemsupdatestatus($PONO,$Newstatus)
{
$this->db->where('PONO',$PONO);
$this->db->update('T_PurchaseOrder_LineItem',$Newstatus);
$this->db->update('t_purchaseorder_lineitem',$Newstatus);
$update = $this->db->affected_rows();
return $update;
@ -852,7 +852,7 @@ function POLineItemsupdatestatus($PONO,$Newstatus)
function pomasterupdatestatus($PONO,$Newstatus)
{
$this->db->where('PONO',$PONO);
$this->db->update('T_PurchaseOrder_Master',$Newstatus);
$this->db->update('t_purchaseorder_master',$Newstatus);
$update = $this->db->affected_rows();
return $update;
}

View File

@ -13,10 +13,10 @@ class Login_model extends CI_Model
$this->db->select('BaseTbl.userId, BaseTbl.password, Emp.EmpID,Emp.FirstName,Emp.Designation, BaseTbl.roleId, Roles.role,DEPT.DEPCode,DEPT.DepartmentName,DEPT.HeadDept,Emp.ProfilePic,CompTbl.CompanyName');
$this->db->from('tbl_users as BaseTbl');
$this->db->join('tbl_roles as Roles','Roles.roleId = BaseTbl.roleId');
$this->db->join('T_Employee_Details as Emp','BaseTbl.EmpID = Emp.EmpID');
$this->db->join('T_DepartmentDetails as DEPT','Emp.Departmentcode = DEPT.DEPCode');
$this->db->join('t_employee_details as Emp','BaseTbl.EmpID = Emp.EmpID');
$this->db->join('t_departmentdetails as DEPT','Emp.Departmentcode = DEPT.DEPCode');
$this->db->where('BaseTbl.isDeleted !=',1);
$this->db->join('T_Company_Details as CompTbl','true','cross');
$this->db->join('t_company_details as CompTbl','true','cross');
$this->db->where('BaseTbl.email', $email);
$this->db->or_where('Emp.ContactNumber', $email);
$this->db->where('BaseTbl.isDeleted !=',1);
@ -115,7 +115,7 @@ class Login_model extends CI_Model
{
$this->db->select('Departmentcode as AssDep');
$this->db->from('T_AccessDepartments');
$this->db->from('t_accessdepartments');
$this->db->where('EmpID', $EmpID);
@ -130,7 +130,7 @@ class Login_model extends CI_Model
{
$this->db->select('UsrTbl.userId,UsrTbl.email,EmpTbl.ContactNumber,EmpTbl.FirstName');
$this->db->from('tbl_users as UsrTbl');
$this->db->join('T_Employee_Details as EmpTbl','UsrTbl.EmpID = EmpTbl.EmpID');
$this->db->join('t_employee_details as EmpTbl','UsrTbl.EmpID = EmpTbl.EmpID');
$this->db->where('EmpTbl.ContactNumber', $mobileno);
$this->db->where('UsrTbl.email',$emailid);
$this->db->where('UsrTbl.isDeleted', 0);
@ -162,7 +162,7 @@ class Login_model extends CI_Model
function getuserdtl($phno){
$this->db->select('BaseTbl.userId');
$this->db->from('tbl_users as BaseTbl');
$this->db->join('T_Employee_Details as Emp','BaseTbl.EmpID = Emp.EmpID');
$this->db->join('t_employee_details as Emp','BaseTbl.EmpID = Emp.EmpID');
$this->db->where('Emp.ContactNumber', $phno);
$query = $this->db->get();
$result = $query->result();

View File

@ -27,22 +27,22 @@ class monthlypay_model extends CI_Model
$lastdate = $year_val.'-'.$month_val.'-'.$date_val;
//echo $lastdate ;
// $this->db->select('T_Monthly_Pay_Inputs.*,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Payroll.Key,T_Loan_Master.Loan_ID');
// $this->db->select('T_Monthly_Pay_Inputs.*,t_employee_details.FirstName,t_employee_details.LastName,T_Payroll.Key,t_loan_master.Loan_ID');
// $this->db->from('T_Monthly_Pay_Inputs');
// $this->db->join('T_Employee_Details','T_Monthly_Pay_Inputs.EmpID=T_Employee_Details.EmpID');
// $this->db->join('t_employee_details','T_Monthly_Pay_Inputs.EmpID=t_employee_details.EmpID');
// $this->db->join('T_Payroll','T_Monthly_Pay_Inputs.EmpID=T_Payroll.EmpID','left');
// $this->db->join('T_Loan_Master','T_Monthly_Pay_Inputs.EmpID=T_Loan_Master.EmpID','left');
// $this->db->order_by('T_Employee_Details.EmpID','asc');
// $this->db->where('T_Employee_Details.DateofJoining <=',$lastdate);
// $this->db->join('t_loan_master','T_Monthly_Pay_Inputs.EmpID=t_loan_master.EmpID','left');
// $this->db->order_by('t_employee_details.EmpID','asc');
// $this->db->where('t_employee_details.DateofJoining <=',$lastdate);
// $this->db->where('Month_Year',$current);
$sql="select T_Monthly_Pay_Inputs.*,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Loan_Master.Loan_ID,T_Loan_Master.Monthly_Due,T_Payroll.Key
$sql="select T_Monthly_Pay_Inputs.*,t_employee_details.FirstName,t_employee_details.LastName,t_loan_master.Loan_ID,t_loan_master.Monthly_Due,T_Payroll.Key
from T_Monthly_Pay_Inputs
left join T_Employee_Details on T_Monthly_Pay_Inputs.EmpID=T_Employee_Details.EmpID and T_Employee_Details.DateofJoining <= ?
left join t_employee_details on T_Monthly_Pay_Inputs.EmpID=t_employee_details.EmpID and t_employee_details.DateofJoining <= ?
left join T_Payroll on T_Monthly_Pay_Inputs.EmpID=T_Payroll.EmpID
left join T_Loan_Master on T_Monthly_Pay_Inputs.EmpID=T_Loan_Master.EmpID and T_Loan_Master.is_Active = 1
left join t_loan_master on T_Monthly_Pay_Inputs.EmpID=t_loan_master.EmpID and t_loan_master.is_Active = 1
where Month_Year = ?
order by T_Employee_Details.EmpID asc";
order by t_employee_details.EmpID asc";
$query = $this->db->query($sql,array($lastdate,$current));
// print_r($query->result());
@ -60,11 +60,11 @@ class monthlypay_model extends CI_Model
$date_val =cal_days_in_month(CAL_GREGORIAN,$month_val,$year_val);
//$monthyear_val = date('Y-m',strtotime($current));
$lastdate = $year_val.'-'.$month_val.'-'.$date_val;
$this->db->select('T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.DateofJoining');
$this->db->from('T_Employee_Details');
//$this->db->join('T_Emp_Pay_Data','T_Emp_Pay_Data.EmpID=T_Employee_Details.EmpID','Left');
$this->db->where('T_Employee_Details.IsActive',1);
$this->db->where('T_Employee_Details.DateofJoining <=',$lastdate);
$this->db->select('t_employee_details.EmpID,t_employee_details.FirstName,t_employee_details.LastName,t_employee_details.DateofJoining');
$this->db->from('t_employee_details');
//$this->db->join('T_Emp_Pay_Data','T_Emp_Pay_Data.EmpID=t_employee_details.EmpID','Left');
$this->db->where('t_employee_details.IsActive',1);
$this->db->where('t_employee_details.DateofJoining <=',$lastdate);
$this->db->order_by('EmpID','asc');
$query = $this->db->get();
$result = $query->result();
@ -98,19 +98,19 @@ if(strlen($month) == 6)
$lastdate = $year_val.'-'.$month_val.'-'.$date_val;
//echo $lastdate;
//left join T_Payroll on T_Employee_Details.EmpID = T_Payroll.EmpID and month(T_Payroll.PayOn) = month(?) and year(T_Payroll.PayOn) = year(?)
$sql ="select T_Emp_Pay_Data.EmpID, T_Emp_Pay_Data.Incentives as MasterIncentives,T_Emp_Pay_Data.*,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.DateofJoining,T_Attendance.Days_Worked as Days_worked,T_Attendance.Absent as LOP_Days,T_Attendance.Paid_Leave as Paid_leave,T_Attendance.Total_OTHrs as OT_Hrs_Worked,T_Attendance.NoofDays,T_Loan_Master.Loan_ID,T_Loan_Master.Monthly_Due,T_Loan_Master.Due_Start_Date as DueDate,T_Loan_Master.Loan_Amount,T_Loan_Master.Paid_Amount,T_Payroll.Key,T_Monthly_Pay_Inputs.Incentives as MonthlyIncentives,T_Monthly_Pay_Inputs.Loan_Recovered,T_Monthly_Pay_Inputs.Estimate,T_Monthly_Pay_Inputs.Festival_Bonus,T_Monthly_Pay_Inputs.Other_Deductions,T_Loan_History .Balance_Amount
//left join T_Payroll on t_employee_details.EmpID = T_Payroll.EmpID and month(T_Payroll.PayOn) = month(?) and year(T_Payroll.PayOn) = year(?)
$sql ="select T_Emp_Pay_Data.EmpID, T_Emp_Pay_Data.Incentives as MasterIncentives,T_Emp_Pay_Data.*,t_employee_details.FirstName,t_employee_details.LastName,t_employee_details.DateofJoining,t_attendance.Days_Worked as Days_worked,t_attendance.Absent as LOP_Days,t_attendance.Paid_Leave as Paid_leave,t_attendance.Total_OTHrs as OT_Hrs_Worked,t_attendance.NoofDays,t_loan_master.Loan_ID,t_loan_master.Monthly_Due,t_loan_master.Due_Start_Date as DueDate,t_loan_master.Loan_Amount,t_loan_master.Paid_Amount,T_Payroll.Key,T_Monthly_Pay_Inputs.Incentives as MonthlyIncentives,T_Monthly_Pay_Inputs.Loan_Recovered,T_Monthly_Pay_Inputs.Estimate,T_Monthly_Pay_Inputs.Festival_Bonus,T_Monthly_Pay_Inputs.Other_Deductions,T_Loan_History .Balance_Amount
from T_Emp_Pay_Data
left join T_Employee_Details on T_Employee_Details.EmpID = T_Emp_Pay_Data.EmpID
left join T_Payroll on T_Employee_Details.EmpID = T_Payroll.EmpID and T_Payroll.PayOn = ?
left join t_employee_details on t_employee_details.EmpID = T_Emp_Pay_Data.EmpID
left join T_Payroll on t_employee_details.EmpID = T_Payroll.EmpID and T_Payroll.PayOn = ?
left join T_Attendance on T_Emp_Pay_Data.EmpID = T_Attendance.EmpID
left join t_attendance on T_Emp_Pay_Data.EmpID = t_attendance.EmpID
left join T_Monthly_Pay_Inputs on T_Monthly_Pay_Inputs.EmpID = T_Emp_Pay_Data.EmpID and T_Monthly_Pay_Inputs.Month_Year = ?
left join T_Loan_Master on T_Emp_Pay_Data.EmpID = T_Loan_Master.EmpID and T_Loan_Master.is_Active = 1
left join T_Loan_History on T_Loan_History .Loan_ID = T_Loan_Master.Loan_ID
where T_Employee_Details.DateofJoining <= ?
and month(T_Attendance.Month_Year) = month(?) and year(T_Attendance.Month_Year) = year(?)
order by T_Employee_Details.EmpID";
left join t_loan_master on T_Emp_Pay_Data.EmpID = t_loan_master.EmpID and t_loan_master.is_Active = 1
left join T_Loan_History on T_Loan_History .Loan_ID = t_loan_master.Loan_ID
where t_employee_details.DateofJoining <= ?
and month(t_attendance.Month_Year) = month(?) and year(t_attendance.Month_Year) = year(?)
order by t_employee_details.EmpID";
$query = $this->db->query($sql,array($month,$month,$lastdate,$current,$current));
return $query->result();
@ -181,15 +181,15 @@ if(strlen($month) == 6)
$date_val =cal_days_in_month(CAL_GREGORIAN,$month_val,$year_val);
$lastdate = $year_val.'-'.$month_val.'-'.$date_val;
$this->db->select('T_Attendance.*,T_Employee_Details.FirstName,T_Employee_Details.LastName');
$this->db->from('T_Attendance');
$this->db->join('T_Employee_Details','T_Attendance.EmpID=T_Employee_Details.EmpID');
// $this->db->where('year(T_Employee_Details.DateofJoining) <= ',$year_val);
// $this->db->where('month(T_Employee_Details.DateofJoining) <= ',$month_val);
$this->db->where('T_Employee_Details.DateofJoining <= ',$lastdate);
$this->db->select('t_attendance.*,t_employee_details.FirstName,t_employee_details.LastName');
$this->db->from('t_attendance');
$this->db->join('t_employee_details','t_attendance.EmpID=t_employee_details.EmpID');
// $this->db->where('year(t_employee_details.DateofJoining) <= ',$year_val);
// $this->db->where('month(t_employee_details.DateofJoining) <= ',$month_val);
$this->db->where('t_employee_details.DateofJoining <= ',$lastdate);
$this->db->where('Month_Year',$current);
//$this->db->where('T_Employee_Details.IsActive',1);
$this->db->order_by('T_Attendance.EmpID', 'asc');
//$this->db->where('t_employee_details.IsActive',1);
$this->db->order_by('t_attendance.EmpID', 'asc');
$query = $this->db->get();
$result = $query->result();
@ -237,7 +237,7 @@ if(strlen($month) == 6)
function saveAttendance($monthattendance,$Month_Year,$EmpID)
{
$this->db->select('count(*) as c');
$this->db->from('T_Attendance');
$this->db->from('t_attendance');
$this->db->where('Month_Year',$Month_Year);
$this->db->where('EmpID',$EmpID);
$isExist = $this->db->get();
@ -248,7 +248,7 @@ if(strlen($month) == 6)
{
//array_pop();
$this->db->insert('T_Attendance',$monthattendance);
$this->db->insert('t_attendance',$monthattendance);
return $this->db->affected_rows();
//echo "INS";
// if($this->db->affected_rows() > 0)
@ -265,7 +265,7 @@ if(strlen($month) == 6)
{
$this->db->where('Month_Year',$Month_Year);
$this->db->where('EmpID',$EmpID);
$this->db->update('T_Attendance',$monthattendance);
$this->db->update('t_attendance',$monthattendance);
//echo "UPDATE";
return $this->db->affected_rows();
@ -286,9 +286,9 @@ function addNewmonthlisting($m_list)
}
function getUserInfo($EmpID,$month_year)
{
$this->db->select('T_Monthly_Pay_Inputs.*,T_Employee_Details.FirstName,T_Employee_Details.LastName');
$this->db->select('T_Monthly_Pay_Inputs.*,t_employee_details.FirstName,t_employee_details.LastName');
$this->db->from('T_Monthly_Pay_Inputs');
$this->db->join('T_Employee_Details','T_Monthly_Pay_Inputs.EmpID=T_Employee_Details.EmpID');
$this->db->join('t_employee_details','T_Monthly_Pay_Inputs.EmpID=t_employee_details.EmpID');
$this->db->where('T_Monthly_Pay_Inputs.EmpID', $EmpID);
$this->db->where('T_Monthly_Pay_Inputs.Month_Year', $month_year);
@ -327,8 +327,8 @@ function addNewmonthlisting($m_list)
function emplist()
{
$sql="select Emp.EmpID,CONCAT(FirstName,' ',LastName)as name ,Emp.Departmentcode, Dep.DepartmentName FROM T_Employee_Details as Emp
join T_DepartmentDetails as Dep on Dep.DEPCode=Emp.Departmentcode where Emp.IsActive = 1;";
$sql="select Emp.EmpID,CONCAT(FirstName,' ',LastName)as name ,Emp.Departmentcode, Dep.DepartmentName FROM t_employee_details as Emp
join t_departmentdetails as Dep on Dep.DEPCode=Emp.Departmentcode where Emp.IsActive = 1;";
$query =$this->db->query($sql);
return $query->result();
@ -367,8 +367,8 @@ join T_DepartmentDetails as Dep on Dep.DEPCode=Emp.Departmentcode where Emp.IsA
{
$this->db->select('per.*,emp.FirstName,LastName,dep.DepartmentName');
$this->db->from('T_Permission per');
$this->db->join('T_Employee_Details emp','emp.EmpID = per.EmpID');
$this->db->join('T_DepartmentDetails dep','dep.DEPCode = emp.Departmentcode');
$this->db->join('t_employee_details emp','emp.EmpID = per.EmpID');
$this->db->join('t_departmentdetails dep','dep.DEPCode = emp.Departmentcode');
$this->db->where('per.SNO',$SNO );
$query =$this->db->get();
return $query->result();
@ -382,9 +382,9 @@ join T_DepartmentDetails as Dep on Dep.DEPCode=Emp.Departmentcode where Emp.IsA
$pre_year = $curr_split[0];
$curr_year = $curr_split[1];
$sql= "select T_Monthly_Pay_Inputs.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,sum(Incentives) as Incentives,sum(Festival_Bonus) as Bonus
$sql= "select T_Monthly_Pay_Inputs.EmpID,t_employee_details.FirstName,t_employee_details.LastName,sum(Incentives) as Incentives,sum(Festival_Bonus) as Bonus
from T_Monthly_Pay_Inputs
join T_Employee_Details on T_Monthly_Pay_Inputs.EmpID = T_Employee_Details.EmpID
join t_employee_details on T_Monthly_Pay_Inputs.EmpID = t_employee_details.EmpID
where
substr(T_Monthly_Pay_Inputs.Month_Year,4) = ?
and substr(T_Monthly_Pay_Inputs.Month_Year,1,2) >= 4
@ -403,9 +403,9 @@ join T_DepartmentDetails as Dep on Dep.DEPCode=Emp.Departmentcode where Emp.IsA
$pre_year = $curr_split[0];
$curr_year = $curr_split[1];
$sql= "select T_Monthly_Pay_Inputs.EmpID,T_Monthly_Pay_Inputs.Month_Year,T_Employee_Details.FirstName,T_Employee_Details.LastName,sum(Incentives) as Incentives,sum(Festival_Bonus) as Bonus
$sql= "select T_Monthly_Pay_Inputs.EmpID,T_Monthly_Pay_Inputs.Month_Year,t_employee_details.FirstName,t_employee_details.LastName,sum(Incentives) as Incentives,sum(Festival_Bonus) as Bonus
from T_Monthly_Pay_Inputs
join T_Employee_Details on T_Monthly_Pay_Inputs.EmpID = T_Employee_Details.EmpID
join t_employee_details on T_Monthly_Pay_Inputs.EmpID = t_employee_details.EmpID
and T_Monthly_Pay_Inputs.EmpID = ?
where substr(T_Monthly_Pay_Inputs.Month_Year,4) = ? and substr(T_Monthly_Pay_Inputs.Month_Year,1,2) >= 4
or substr(T_Monthly_Pay_Inputs.Month_Year,4) = ? and substr(T_Monthly_Pay_Inputs.Month_Year,1,2) <= 3
@ -463,9 +463,9 @@ function updateproduction($productions,$sno)
$sql="select att.EmpID,".$WH.",a.FirstName from T_Attendance as att
join T_Employee_Details as a on a.EmpID= att.EmpID
where Month_Year = ? and att.EmpID in (select EmpID from T_Attendance)";
$sql="select att.EmpID,".$WH.",a.FirstName from t_attendance as att
join t_employee_details as a on a.EmpID= att.EmpID
where Month_Year = ? and att.EmpID in (select EmpID from t_attendance)";
$query = $this->db->query($sql,array($daydate));
return $query->result_array();
@ -475,7 +475,7 @@ where Month_Year = ? and att.EmpID in (select EmpID from T_Attendance)";
function dayAllPersentEmpSalary($WH,$OT,$date)
{
$sql="select EmpID,".$WH.",".$OT." from T_Attendance where Month_Year = ? and EmpID in (select EmpID from T_Attendance)";
$sql="select EmpID,".$WH.",".$OT." from t_attendance where Month_Year = ? and EmpID in (select EmpID from t_attendance)";
$query = $this->db->query($sql,array($date));
return $query->result_array();

View File

@ -29,7 +29,7 @@ class mrir_model extends CI_Model
$this->db->select('igr.*,PO.DeliveryDate,sup.SupplierName');
$this->db->from('T_IGR_Master igr');
$this->db->join('T_PurchaseOrder_Master PO','igr.PONO = PO.PONO');
$this->db->join('t_purchaseorder_master PO','igr.PONO = PO.PONO');
$this->db->join('T_SupplierDetailsN` sup','PO.SupplierID = sup.SupplierID');
$this->db->where('igr.IGRStatus !=',MRIR_CREATED);
$this->db->where('PO.IsQualityChkReqired',1);
@ -46,13 +46,13 @@ class mrir_model extends CI_Model
$this->db->select('IGRM.DeliveryChellanDate,IGRM.CreatedDate,IGRM.IGRNO,IGRM.VehicleNo,IGRM.DeliveryChellanOrInvoiceNo,IGRM.CourierNo,IGRM.PONO,IGRD.MaterialCode,IGRD.QuantityAsPerInvoice,POMR.ServiceDescription,POMR.PODate,POMR.DeliveryDate,POMR.CreatedBy,SUPP.SupplierName,SUPP.Address,MM.UOM,MM.MaterialName,POLT.Quantity,POLT.ReceivedQuantity,ED.FirstName');
//$this->db->select("DATE_FORMAT(IGRM.DeliveryChellanDate, '%d %m %Y') as DCdate");
$this->db->from('T_IGR_Master IGRM');
$this->db->join('T_PurchaseOrder_Master POMR ','IGRM.PONO=POMR.PONO');
$this->db->join('t_purchaseorder_master POMR ','IGRM.PONO=POMR.PONO');
$this->db->join('T_IGR_Details IGRD','IGRM.IGRNO=IGRD.IGRNO');
$this->db->join('T_SupplierDetailsN SUPP','POMR.SupplierID=SUPP.SupplierID');
$this->db->join('T_MaterialMaster MM',' MM.MaterialCode=IGRD.MaterialCode');
$this->db->join('T_PurchaseOrder_LineItem POLT','IGRM.PONO=POLT.PONO and IGRD.MaterialCode = POLT.MaterialCode');
$this->db->join('t_purchaseorder_lineitem POLT','IGRM.PONO=POLT.PONO and IGRD.MaterialCode = POLT.MaterialCode');
$this->db->join ('tbl_users user','user.userid=POMR.CreatedBy','left');
$this->db->join ('T_Employee_Details ED','ED.EmpID = user.EmpID','left');
$this->db->join ('t_employee_details ED','ED.EmpID = user.EmpID','left');
$this->db->where('IGRM.IGRNO',$IgrNo);
$query = $this->db->get();
@ -69,16 +69,16 @@ as OrderedQuantity ,(MD.ActualQuantityReceived) as ActualReceivedqty,(MD.Quantit
AcceptedQty,REQ.ReqDate, ReqLine.Status as ReqStatus,
st.StatusCode as ReqStatus,st.StatusName,
ReqLine.Remarks
from T_Requestion_Details ReqLine join T_PurchaseOrder_LineItem POL
from T_Requestion_Details ReqLine join t_purchaseorder_lineitem POL
on ReqLine.ReqNo = POL.ReqNo and ReqLine.MaterialCode = POL.MaterialCode
join T_Requestion_Master REQ on REQ.ReqNo = ReqLine.ReqNo
join T_PurchaseOrder_Master POMast on POMast.PONO=POL.PONO
join T_Status st on ReqLine.Status = st.StatusCode
join t_requestion_master REQ on REQ.ReqNo = ReqLine.ReqNo
join t_purchaseorder_master POMast on POMast.PONO=POL.PONO
join t_status st on ReqLine.Status = st.StatusCode
join T_MRIR_Master MR on MR.PONO = POL.PONO join T_MRIR_Details MD
on MD.MRIRNO = MR.MRIRNO and ReqLine.MaterialCode = MD.MaterialCode join T_MaterialMaster MM on
MM.MaterialCode = ReqLine.MaterialCode join
T_Employee_Details EMP on EMP.EmpID = REQ.Requestedby join
T_DepartmentDetails DD on DD.DEPCode = EMP.Departmentcode where
t_employee_details EMP on EMP.EmpID = REQ.Requestedby join
t_departmentdetails DD on DD.DEPCode = EMP.Departmentcode where
POL.status in (?,?)
and ReqLine.Status not in(?) and POMast.status not in(?)
group by ReqLine.MaterialCode ,POL.PONO';
@ -95,12 +95,12 @@ POL.status in (?,?)
$this->db->join ('T_MRIR_Details TMD','TMM.MRIRNO=TMD.MRIRNO');
$this->db->join ('T_IGR_Master IGRM','TMM.IGRNO=IGRM.IGRNO');
$this->db->join ('T_IGR_Details IGRD','IGRM.IGRNO=IGRD.IGRNO');
$this->db->join ('T_PurchaseOrder_Master POM','TMM.PONO=POM.PONO');
$this->db->join ('t_purchaseorder_master POM','TMM.PONO=POM.PONO');
$this->db->join ('tbl_users user','user.userid=TMD.UpdateBY','left');
$this->db->join ('T_Employee_Details ED','ED.EmpID = user.EmpID','left');
$this->db->join ('t_employee_details ED','ED.EmpID = user.EmpID','left');
$this->db->join ('tbl_users user1','user1.userid = POM.CreatedBy','left');
$this->db->join ('T_Employee_Details ED1','ED1.EmpID = user1.EmpID','left');
$this->db->join ('T_Status ST','ST.StatusCode = TMM.MRIRStatus');
$this->db->join ('t_employee_details ED1','ED1.EmpID = user1.EmpID','left');
$this->db->join ('t_status ST','ST.StatusCode = TMM.MRIRStatus');
//$this->db->where('POM.IsQualityChkReqired !=','0');
$this->db->order_by ('TMM.MRIRNO','desc');
$query = $this->db->get();
@ -110,7 +110,7 @@ POL.status in (?,?)
function getStatus()
{
$this->db->select('StatusCode,StatusName');
$this->db->from('T_Status');
$this->db->from('t_status');
$this->db->where('StatusType',8);
$query = $this->db->get();
return $query->result();
@ -129,17 +129,17 @@ TMD.QuantityRejected,ST.StatusName,TMD.Remarks,AdvanceAmount ');
$this->db->join ('T_MRIR_Details TMD','TMM.MRIRNO=TMD.MRIRNO','left');
$this->db->join ('T_IGR_Master IGRM','TMM.IGRNO=IGRM.IGRNO');
$this->db->join ('T_IGR_Details IGRD','IGRM.IGRNO=IGRD.IGRNO and IGRD.MaterialCode = TMD.MaterialCode');
$this->db->join ('T_PurchaseOrder_Master POM','POM.PONO=IGRM.PONO');
$this->db->join ('T_PurchaseOrder_LineItem POL','POL.PONO=POM.PONO and TMD.MaterialCode = POL.MaterialCode');
$this->db->join ('t_purchaseorder_master POM','POM.PONO=IGRM.PONO');
$this->db->join ('t_purchaseorder_lineitem POL','POL.PONO=POM.PONO and TMD.MaterialCode = POL.MaterialCode');
$this->db->join('T_PurchaseOrder_AdvanceRequest PUADV','POM.PONO=PUADV.PONO','left');
$this->db->join ('tbl_users user','user.userid=TMD.UpdateBY','left');
$this->db->join ('T_Employee_Details ED','ED.EmpID = user.EmpID','left');
$this->db->join ('t_employee_details ED','ED.EmpID = user.EmpID','left');
$this->db->join ('tbl_users user1','user1.userid = POM.ReleasedBy','left');
$this->db->join ('T_Employee_Details ED1','ED1.EmpID = user1.EmpID','left');
$this->db->join ('t_employee_details ED1','ED1.EmpID = user1.EmpID','left');
$this->db->join ('tbl_users user2','user2.userid=TMD.StoreInchargeID','left');
$this->db->join ('T_Employee_Details ED2','ED2.EmpID = user2.EmpID','left');
$this->db->join ('t_employee_details ED2','ED2.EmpID = user2.EmpID','left');
$this->db->join ('T_MaterialMaster MM','MM.MaterialCode = IGRD.MaterialCode and POL.MaterialCode = MM.MaterialCode');
$this->db->join ('T_Status ST','ST.StatusCode = TMD.MRIRStatus');
$this->db->join ('t_status ST','ST.StatusCode = TMD.MRIRStatus');
$this->db->where('TMM.MRIRStatus',MRIR_APPROVED);
$this->db->order_by('TMM.UpdatedOn','desc');
@ -157,20 +157,20 @@ TMD.QuantityRejected,ST.StatusName,TMD.Remarks,AdvanceAmount ');
$this->db->from ('T_MRIR_Master TMM');
$this->db->join ('T_MRIR_Details TMD','TMM.MRIRNO = TMD.MRIRNO');//to get IGRNO,PONO,MRIRNO,mrirdate,
$this->db->join ('T_IGR_Master IGRM', 'IGRM.IGRNO = TMM.IGRNO');//to get actualquantity,deliverydate,Invoicedate,vechileno,courierno,igrdate,
$this->db->join ('T_PurchaseOrder_Master POMR ','IGRM.PONO = POMR.PONO');//to get podate,deliverydate,servicedescription
// $this->db->join ('T_PurchaseOrder_LineItem POLT','IGRM.PONO=POLT.PONO');//to get receivedquantity,quantity
$this->db->join('T_PurchaseOrder_LineItem Line','TMM.PONO=Line.PONO and TMD.MaterialCode=Line.MaterialCode');
$this->db->join ('t_purchaseorder_master POMR ','IGRM.PONO = POMR.PONO');//to get podate,deliverydate,servicedescription
// $this->db->join ('t_purchaseorder_lineitem POLT','IGRM.PONO=POLT.PONO');//to get receivedquantity,quantity
$this->db->join('t_purchaseorder_lineitem Line','TMM.PONO=Line.PONO and TMD.MaterialCode=Line.MaterialCode');
$this->db->join('T_CostCenter_Master COST','Line.CostCenterCode=COST.CostCenterCode','left');
//$this->db->join ('T_IGR_Details IGRD','IGRD.IGRNO = IGRM.IGRNO');//to get invoicequantity
$this->db->join('T_IGR_Details IGRD','IGRD.IGRNO = TMM.IGRNO and TMD.MaterialCode=IGRD.MaterialCode');
$this->db->join ('T_MaterialMaster MM','TMD.MaterialCode = MM.MaterialCode');
$this->db->join ('T_SupplierDetailsN SUPP','POMR.SupplierID = SUPP.SupplierID');//to get suppliername,supplieraddress
$this->db->join ('tbl_users user','user.userid = POMR.CreatedBy');//to get poraisedby
$this->db->join ('T_Employee_Details ED','ED.EmpID = user.EmpID');
$this->db->join ('t_employee_details ED','ED.EmpID = user.EmpID');
$this->db->join ('tbl_users user1','user1.userid=TMM.CreatedBy');//to get mrirraisedby
$this->db->join ('T_Employee_Details ED1','ED1.EmpID = user1.EmpID');
$this->db->join ('t_employee_details ED1','ED1.EmpID = user1.EmpID');
$this->db->join ('tbl_users user2','user2.userid=IGRM.CreatedBy');//to get igrraisedby
$this->db->join ('T_Employee_Details ED2','ED2.EmpID = user2.EmpID');
$this->db->join ('t_employee_details ED2','ED2.EmpID = user2.EmpID');
$this->db->where('TMM.MRIRNO',$MrirNo);
$this->db->group_by('TMM.MRIRNO,TMD.MaterialCode');
$query = $this->db->get();
@ -244,12 +244,12 @@ TMD.QuantityRejected,ST.StatusName,TMD.Remarks,AdvanceAmount ');
$this->db->join ('T_MRIR_Details TMD','TMM.MRIRNO = TMD.MRIRNO');
$this->db->join ('T_MaterialMaster MM','TMD.MaterialCode = MM.MaterialCode');
$this->db->join ('T_IGR_Master IGRM', 'IGRM.IGRNO=TMM.IGRNO');
$this->db->join ('T_PurchaseOrder_Master POMR ','IGRM.PONO=POMR.PONO');
$this->db->join ('T_PurchaseOrder_LineItem POLT','IGRM.PONO=POLT.PONO and POLT.MaterialCode=TMD.MaterialCode');
$this->db->join ('t_purchaseorder_master POMR ','IGRM.PONO=POMR.PONO');
$this->db->join ('t_purchaseorder_lineitem POLT','IGRM.PONO=POLT.PONO and POLT.MaterialCode=TMD.MaterialCode');
$this->db->join ('T_IGR_Details IGRD','IGRD.IGRNO= IGRM.IGRNO and IGRD.MaterialCode=TMD.MaterialCode');
$this->db->join ('T_SupplierDetailsN SUPP','POMR.SupplierID=SUPP.SupplierID');
$this->db->join ('tbl_users user','user.userid=TMD.StoreInchargeID','left');
$this->db->join ('T_Employee_Details ED','ED.EmpID = user.EmpID','left');
$this->db->join ('t_employee_details ED','ED.EmpID = user.EmpID','left');
$this->db->where('TMD.MRIRNO',$mrir);
//$this->db->order_by('TMD.MRIRNO','asc');
@ -266,12 +266,12 @@ TMD.QuantityRejected,ST.StatusName,TMD.Remarks,AdvanceAmount ');
{
$this->db->select('IGRM.*,IGRD.*,SUPP.SupplierName,SUPP.Address,TMM.PONO,TMD.*,MM.MaterialCode,MM.UOM,MM.MaterialName,POLT.Quantity,POLT.ReceivedQuantity');
$this->db->from ('T_IGR_Master IGRM');
$this->db->join ('T_PurchaseOrder_Master POMR ','IGRM.PONO=POMR.PONO','left');
$this->db->join ('t_purchaseorder_master POMR ','IGRM.PONO=POMR.PONO','left');
$this->db->join ('T_MRIR_Master TMM' ,'TMM.IGRNO=IGRM.IGRNO');
$this->db->join ('T_MRIR_Details TMD','TMD.MRIRNO=TMM.MRIRNO');
//$this->db->join ('T_MRIRNO');
$this->db->join ('T_IGR_Details IGRD','IGRD.IGRNO= IGRM.IGRNO','left');
$this->db->join ('T_PurchaseOrder_LineItem POLT','IGRM.PONO=POLT.PONO','left');
$this->db->join ('t_purchaseorder_lineitem POLT','IGRM.PONO=POLT.PONO','left');
$this->db->join ('T_SupplierDetailsN SUPP','POMR.SupplierID=SUPP.SupplierID','left');
$this->db->join ('T_MaterialMaster MM',' MM.MaterialCode=TMD.MaterialCode','left');
//$this->db->where('IGRM.IGRNO ');
@ -316,13 +316,13 @@ TMD.QuantityRejected,ST.StatusName,TMD.Remarks,AdvanceAmount ');
}
function UpdatePOLineItem($LineItem,$PONO,$MaterialCode)
{
$subQuery = 'select * from T_PurchaseOrder_LineItem where Quantity = ReceivedQuantity and PONO=? and MaterialCode=? ';
$subQuery = 'select * from t_purchaseorder_lineitem where Quantity = ReceivedQuantity and PONO=? and MaterialCode=? ';
$query = $this->db->query($subQuery,array($PONO,$MaterialCode));
$ApprovedCount = $query->num_rows;
$subQuery = 'select * from T_PurchaseOrder_LineItem where Quantity > ReceivedQuantity and ReceivedQuantity != 0 and PONO=? and MaterialCode=?';
$subQuery = 'select * from t_purchaseorder_lineitem where Quantity > ReceivedQuantity and ReceivedQuantity != 0 and PONO=? and MaterialCode=?';
$query = $this->db->query($subQuery,array($PONO,$MaterialCode));
$PartialApproved = $query->num_rows;
@ -333,7 +333,7 @@ TMD.QuantityRejected,ST.StatusName,TMD.Remarks,AdvanceAmount ');
{
$this->db->where('PONO', $PONO);
$this->db->where('MaterialCode', $MaterialCode);
$this->db->update('T_PurchaseOrder_LineItem', $LineItem);
$this->db->update('t_purchaseorder_lineitem', $LineItem);
return TRUE;
}
@ -346,7 +346,7 @@ TMD.QuantityRejected,ST.StatusName,TMD.Remarks,AdvanceAmount ');
$this->db->where('PONO', $PONO);
$this->db->where('MaterialCode', $MaterialCode);
$this->db->update('T_PurchaseOrder_LineItem', $POLineItem);
$this->db->update('t_purchaseorder_lineitem', $POLineItem);
return TRUE;
}
@ -355,7 +355,7 @@ TMD.QuantityRejected,ST.StatusName,TMD.Remarks,AdvanceAmount ');
function UpdatePOMaster($PONO,$PoMrirStatus,$updatedBy)
{
$this->db->select('*');
$this->db->from('T_PurchaseOrder_LineItem');
$this->db->from('t_purchaseorder_lineitem');
$this->db->where('PONO',$PONO);
$this->db->where('Status !=',MRIR_APPROVED);
$query = $this->db->get();
@ -363,7 +363,7 @@ TMD.QuantityRejected,ST.StatusName,TMD.Remarks,AdvanceAmount ');
$ApprovedCnt = $query->num_rows;
$this->db->select('*');
$this->db->from('T_PurchaseOrder_LineItem');
$this->db->from('t_purchaseorder_lineitem');
$this->db->where('PONO',$PONO);
$this->db->where('Status !=',MRIR_REJECTED);
$query1 = $this->db->get();
@ -372,12 +372,12 @@ TMD.QuantityRejected,ST.StatusName,TMD.Remarks,AdvanceAmount ');
if ($ApprovedCnt == 0) {
$this->db->where('PONO', $PONO);
$POStatus = array('status'=>MRIR_APPROVED,'UpdateBY'=>$updatedBy);
$this->db->update('T_PurchaseOrder_Master', $POStatus);
$this->db->update('t_purchaseorder_master', $POStatus);
}
elseif ($RejectedCnt == 0) {
$this->db->where('PONO', $PONO);
$POStatus = array('status'=>MRIR_REJECTED,'UpdateBY'=>$updatedBy);
$this->db->update('T_PurchaseOrder_Master', $POStatus);
$this->db->update('t_purchaseorder_master', $POStatus);
}

View File

@ -144,8 +144,8 @@ class Payroll_model extends CI_Model
$this->db->select('Pay.*,Emp.FirstName as FName ,Emp.LastName as Lname,Emp.DateofBirth as Dob,Emp.PANNo as Pan,Emp.BankBranchName as BankName,Emp.AadharNo,Emp.IFSCCode as IFSCCode,Emp.DateofJoining as DOJ,Emp.Designation as Designation,Dep.DepartmentName as DeptName');
$this->db->from('T_Payroll Pay');
//$this->db->join('T_Payroll_File payfile', 'Pay.PayOn = payfile.PayOn');
$this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID');
$this->db->join('T_DepartmentDetails Dep', 'Emp.Departmentcode = Dep.DEPCode');
$this->db->join('t_employee_details Emp', 'Pay.EmpID = Emp.EmpID');
$this->db->join('t_departmentdetails Dep', 'Emp.Departmentcode = Dep.DEPCode');
if($PayOn != '')
{
$this->db->where('Pay.PayOn', $PayOn);
@ -200,7 +200,7 @@ class Payroll_model extends CI_Model
$this->db->distinct();
$this->db->select('Pay.*,Emp.FirstName as FName ,Emp.LastName as Lname,Emp.PANNo as Pan,Emp.BankBranchName as BankName,Emp.IFSCCode as IFSC,Bank.Address as BAddress');
$this->db->from('T_Payroll Pay');
$this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID');
$this->db->join('t_employee_details Emp', 'Pay.EmpID = Emp.EmpID');
$this->db->join('T_Bank_Details Bank', 'Emp.BankBranchName = Bank.Bank_name');
$this->db->order_by("Pay.EmpID", "asc");
$this->db->where('Emp.BankBranchName',$bank);
@ -216,7 +216,7 @@ class Payroll_model extends CI_Model
$this->db->distinct();
$this->db->select('Pay.EmployeeESI,Pay.PF,Pay.CompanyESI,Pay.CompanyPF,Pay.NoofDaysWorked,Pay.OTperHours,Emp.FirstName as FName ,Emp.LastName as Lname,Emp.PFNO,Emp.ESI');
$this->db->from('T_Payroll Pay');
$this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID');
$this->db->join('t_employee_details Emp', 'Pay.EmpID = Emp.EmpID');
$this->db->where('Pay.PayOn',$payon);
// $this->db->where('Pay.EmployeeESI > 0 ');
// $this->db->where('Pay.CompanyESI > 0');
@ -235,8 +235,8 @@ class Payroll_model extends CI_Model
$this->db->distinct();
$this->db->select('Pay.EmpID,Emp.FirstName as FName ,Emp.LastName as Lname,sum(loan.Loan_Amount) as Loan_Amount,sum(loan.Paid_Amount) as Paid_Amount');
$this->db->from('T_Emp_Pay_Data Pay');
$this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID');
$this->db->join('T_Loan_Master loan', 'Pay.EmpID = loan.EmpID');
$this->db->join('t_employee_details Emp', 'Pay.EmpID = Emp.EmpID');
$this->db->join('t_loan_master loan', 'Pay.EmpID = loan.EmpID');
if($source != 'company'){
$this->db->where('Pay.EmpID',$source);
@ -261,8 +261,8 @@ class Payroll_model extends CI_Model
{
$this->db->select('Pay.EmpID,Pay.FirstName as FName ,Pay.LastName as Lname');
$this->db->from('T_Employee_Details Pay');
$this->db->join('T_Loan_Master loan', 'Pay.EmpID = loan.EmpID');
$this->db->from('t_employee_details Pay');
$this->db->join('t_loan_master loan', 'Pay.EmpID = loan.EmpID');
$this->db->order_by('Pay.EmpID','asc');
$query = $this->db->get();
return $query->result();
@ -277,8 +277,8 @@ class Payroll_model extends CI_Model
if($string == 'emp'){
$this->db->select('Pay.EmpID,Emp.FirstName as FName ,Emp.LastName as Lname,loan.*');
$this->db->from('T_Emp_Pay_Data Pay');
$this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID');
$this->db->join('T_Loan_Master loan', 'Pay.EmpID = loan.EmpID','left');
$this->db->join('t_employee_details Emp', 'Pay.EmpID = Emp.EmpID');
$this->db->join('t_loan_master loan', 'Pay.EmpID = loan.EmpID','left');
// if($source != 'company'){
$this->db->where('Pay.EmpID',$eid);
//}
@ -297,10 +297,10 @@ class Payroll_model extends CI_Model
elseif($string == 'history')
{
$this->db->select('T_Loan_Master.EmpID,Emp.FirstName,Emp.LastName,T_Loan_Master.Loan_Amount,T_Loan_Master.Loan_Issued_Date,T_Loan_History.*');
$this->db->select('t_loan_master.EmpID,Emp.FirstName,Emp.LastName,t_loan_master.Loan_Amount,t_loan_master.Loan_Issued_Date,T_Loan_History.*');
$this->db->from('T_Loan_History');
$this->db->join('T_Loan_Master','T_Loan_Master.Loan_ID=T_Loan_History.Loan_ID');
$this->db->join('T_Employee_Details Emp', 'T_Loan_Master.EmpID = Emp.EmpID');
$this->db->join('t_loan_master','t_loan_master.Loan_ID=T_Loan_History.Loan_ID');
$this->db->join('t_employee_details Emp', 't_loan_master.EmpID = Emp.EmpID');
$this->db->where('T_Loan_History.Loan_ID',$eid);
$q = $this->db->get();
// $this->db->order_by('Entry_Date','asc');
@ -324,7 +324,7 @@ class Payroll_model extends CI_Model
{
$this->db->select('Pay.EmpID as EmpId,Emp.FirstName as Fname,Emp.LastName as Lname');
$this->db->from('T_Payroll Pay');
$this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID');
$this->db->join('t_employee_details Emp', 'Pay.EmpID = Emp.EmpID');
if($Payon != '')
{
$this->db->where('Pay.PayOn', $Payon);
@ -340,7 +340,7 @@ class Payroll_model extends CI_Model
{
$this->db->select('Pay.EmpID as EmpId,Emp.FirstName as Fname,Emp.LastName as Lname');
$this->db->from('T_Monthly_Pay_Inputs Pay');
$this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID');
$this->db->join('t_employee_details Emp', 'Pay.EmpID = Emp.EmpID');
if($Payon != '')
{
$this->db->where('Pay.Month_Year', $Payon);
@ -359,7 +359,7 @@ class Payroll_model extends CI_Model
{
$this->db->select('Pay.EmpID as EmpId,Emp.FirstName as Fname,Emp.LastName as Lname');
$this->db->from('T_Payroll Pay');
$this->db->join('T_Employee_Details Emp', 'Pay.EmpID = Emp.EmpID');
$this->db->join('t_employee_details Emp', 'Pay.EmpID = Emp.EmpID');
if($Payon != '')
{
$this->db->where('Pay.PayOn', $Payon);
@ -386,7 +386,7 @@ class Payroll_model extends CI_Model
function getEmpID($q='')
{
$this->db->select('EmpID,FirstName,LastName');
$this->db->from('T_Employee_Details');
$this->db->from('t_employee_details');
if($q == "addemppaydate"){
$this->db->where('EmpID NOT IN (SELECT EmpID from T_Emp_Pay_Data)',NULL,FALSE);
}
@ -425,7 +425,7 @@ class Payroll_model extends CI_Model
{
$subQuery = "select CompanyName,Address,GSTNO,PAN,ContactNumber,EmailAddress,AlternateContactNumber,companyWebsite,StateCode
from T_Company_Details ";
from t_company_details ";
$query = $this->db->query($subQuery);
//print_r($query->result());die();
return $query->result();

View File

@ -6,9 +6,9 @@ class purchaseorder_model extends CI_Model
{
$this->db->distinct();
$this->db->select('PO.PONO');
$this->db->from('T_PurchaseOrder_Master PO');
$this->db->join('T_PurchaseOrder_LineItem Line','PO.PONO = Line.PONO');
$this->db->join('T_Requestion_Master Req','Req.ReqNo = Line.ReqNo');
$this->db->from('t_purchaseorder_master PO');
$this->db->join('t_purchaseorder_lineitem Line','PO.PONO = Line.PONO');
$this->db->join('t_requestion_master Req','Req.ReqNo = Line.ReqNo');
$this->db->where('PO.POType',SERVICE);
$this->db->where('PO.status',PO_RELEASED);
@ -204,7 +204,7 @@ $this->db->where('PONO',$PONO);
function getpolineqty($NewPO)
{
$this->db->select('sum(Quantity)as Qty,sum(ReceivedQuantity)as rec');
$this->db->from('T_PurchaseOrder_LineItem');
$this->db->from('t_purchaseorder_lineitem');
$this->db->where('PONO',$NewPO);
$query = $this->db->get();
@ -215,7 +215,7 @@ function getpolineqty($NewPO)
function POLineItemsupdatestatus($NewPO,$Newstatus)
{
$this->db->where('PONO',$NewPO);
$this->db->update('T_PurchaseOrder_LineItem',$Newstatus);
$this->db->update('t_purchaseorder_lineitem',$Newstatus);
$update = $this->db->affected_rows();
return $update;
@ -224,7 +224,7 @@ function POLineItemsupdatestatus($NewPO,$Newstatus)
function pomasterupdatestatus($NewPO,$Newstatus)
{
$this->db->where('PONO',$NewPO);
$this->db->update('T_PurchaseOrder_Master',$Newstatus);
$this->db->update('t_purchaseorder_master',$Newstatus);
$update = $this->db->affected_rows();
return $update;
}
@ -243,7 +243,7 @@ function pomasterupdatestatus($NewPO,$Newstatus)
$this->db->join('T_IGR_Master mstr','bill.PONO = mstr.PONO','left');
$this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left');
// $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode');
$this->db->join('T_PurchaseOrder_Master pom','pom.PONO = bill.PONO');
$this->db->join('t_purchaseorder_master pom','pom.PONO = bill.PONO');
$this->db->where('bill.PONO',$pono);
//$this->db->or_where('pom.status',SPECIAL_PO);
$this->db->group_by('bill.BillNo');
@ -260,7 +260,7 @@ function pomasterupdatestatus($NewPO,$Newstatus)
// $this->db->join('T_PurchaseOrder_BillUpload bill','bill.PONO = mstr.PONO','left');
// $this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left');
// // $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode');
// $this->db->join('T_PurchaseOrder_Master pom','pom.PONO = mstr.PONO');
// $this->db->join('t_purchaseorder_master pom','pom.PONO = mstr.PONO');
// $this->db->where('mstr.PONO',$pono);
$query = $this->db->get();
@ -276,7 +276,7 @@ function getfunctionr($pono)
// $this->db->join('T_IGR_Master mstr','bill.PONO = mstr.PONO','left');
// $this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left');
// // $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode');
// $this->db->join('T_PurchaseOrder_Master pom','pom.PONO = bill.PONO');
// $this->db->join('t_purchaseorder_master pom','pom.PONO = bill.PONO');
// $this->db->where('bill.PONO',$pono);
// //$this->db->or_where('pom.status',SPECIAL_PO);
// $this->db->group_by('bill.BillNo');
@ -293,7 +293,7 @@ mstr.CourierNo,pom.Status,pom.POType'); //,bill.BillNo,bill.FilePath,
//$this->db->join('T_PurchaseOrder_BillUpload bill','bill.PONO = mstr.PONO','left');
$this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left');
// $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode');
$this->db->join('T_PurchaseOrder_Master pom','pom.PONO = mstr.PONO');
$this->db->join('t_purchaseorder_master pom','pom.PONO = mstr.PONO');
$this->db->where('mstr.PONO',$pono);
$query = $this->db->get();
@ -310,7 +310,7 @@ function getbillfiesr($pono)
// $this->db->join('T_IGR_Master mstr','bill.PONO = mstr.PONO','left');
// $this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left');
// // $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode');
// $this->db->join('T_PurchaseOrder_Master pom','pom.PONO = bill.PONO');
// $this->db->join('t_purchaseorder_master pom','pom.PONO = bill.PONO');
// $this->db->where('bill.PONO',$pono);
// //$this->db->or_where('pom.status',SPECIAL_PO);
// $this->db->group_by('bill.BillNo');
@ -327,7 +327,7 @@ mstr.CourierNo,bill.BillNo,bill.FilePath,pom.Status,pom.POType');
$this->db->join('T_PurchaseOrder_BillUpload bill','bill.PONO = mstr.PONO','left');
$this->db->join('T_IGR_Details dtl','mstr.IGRNO = dtl.IGRNO','left');
// $this->db->join('T_MaterialMaster mm','mm.MaterialCode = bill.MaterialCode');
$this->db->join('T_PurchaseOrder_Master pom','pom.PONO = mstr.PONO');
$this->db->join('t_purchaseorder_master pom','pom.PONO = mstr.PONO');
$this->db->where('mstr.PONO',$pono);
$query = $this->db->get();
@ -342,15 +342,15 @@ mstr.CourierNo,bill.BillNo,bill.FilePath,pom.Status,pom.POType');
$subQuery ='select mast.ReqNo,mast.ReqDate,supp.SupplierName,PODate,st.StatusName as WorkStatus,ServiceWorkStatus,POMast.PaymentTerms,
POMast.ServiceWorkStatus,LineItem.*,mat.MaterialName,mat.UOM,emp.FirstName,emp.LastName,POMast.TotalOrderValue
from T_PurchaseOrder_Master POMast
join T_PurchaseOrder_LineItem LineItem on LineItem.PONO = POMast.PONO
from t_purchaseorder_master POMast
join t_purchaseorder_lineitem LineItem on LineItem.PONO = POMast.PONO
join T_SupplierDetailsN supp on supp.SupplierID = POMast.SupplierID
join T_MaterialMaster mat on mat.MaterialCode = LineItem.MaterialCode
join T_Status Stat on Stat.StatusCode = POMast.Status
join T_Status st on st.StatusCode = POMast.ServiceWorkStatus
join T_Requestion_Master mast on mast.ReqNo = LineItem.ReqNo
join t_status Stat on Stat.StatusCode = POMast.Status
join t_status st on st.StatusCode = POMast.ServiceWorkStatus
join t_requestion_master mast on mast.ReqNo = LineItem.ReqNo
join tbl_users users on users.userId = mast.CreatedBy
join T_Employee_Details emp on emp.EmpID = users.EmpID
join t_employee_details emp on emp.EmpID = users.EmpID
where POMast.POType=? and POMast.PONO=?';
$query = $this->db->query($subQuery,array(SERVICE,$PONO));
@ -363,17 +363,17 @@ mstr.CourierNo,bill.BillNo,bill.FilePath,pom.Status,pom.POType');
{
$subQuery ='select POMast.PONO,supp.SupplierName,PODate,POMast.PaymentTerms,POMast.ServiceWorkStatusRemarks,StatusName,POMast.CapitalRange,POType,
LineItem.*,mat.MaterialName,mat.UOM,emp.FirstName,emp.LastName,Tax.TotalValue,Cost.CostCenterName,AdvanceAmount
,Dept.DepartmentName from T_PurchaseOrder_Master POMast
join T_PurchaseOrder_LineItem LineItem on LineItem.PONO = POMast.PONO
,Dept.DepartmentName from t_purchaseorder_master POMast
join t_purchaseorder_lineitem LineItem on LineItem.PONO = POMast.PONO
join T_Service_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo
left join T_PurchaseOrder_AdvanceRequest PUADV on POMast.PONO=PUADV.PONO
join T_SupplierDetailsN supp on supp.SupplierID = POMast.SupplierID
join T_MaterialMaster mat on mat.MaterialCode = LineItem.MaterialCode
join T_Status Stat on Stat.StatusCode = POMast.Status
join T_Requestion_Master mast on mast.ReqNo = LineItem.ReqNo
join t_status Stat on Stat.StatusCode = POMast.Status
join t_requestion_master mast on mast.ReqNo = LineItem.ReqNo
join tbl_users users on users.userId = POMast.CreatedBy
left join T_Employee_Details emp on emp.EmpID = mast.Requestedby
join T_DepartmentDetails Dept on Dept.DEPCode = mast.RequestedDept
left join t_employee_details emp on emp.EmpID = mast.Requestedby
join t_departmentdetails Dept on Dept.DEPCode = mast.RequestedDept
join T_CostCenter_Master Cost on Cost.CostCenterCode=LineItem.CostCenterCode
where POMast.POType=? and ServiceWorkStatus=? order by POMast.UpdatedOn desc';
@ -393,11 +393,11 @@ mstr.CourierNo,bill.BillNo,bill.FilePath,pom.Status,pom.POType');
{
$this->db->distinct();
$this->db->select('POMast.PONO,supp.SupplierName,TotalOrderValue,PODate,Stat.StatusName,Req.ReqType,DeliveryDate');
$this->db->from('T_PurchaseOrder_Master POMast');
$this->db->from('t_purchaseorder_master POMast');
$this->db->join('T_SupplierDetailsN supp', 'supp.SupplierID = POMast.SupplierID');
$this->db->join('T_Status Stat', 'Stat.StatusCode = POMast.Status');
$this->db->join('T_PurchaseOrder_LineItem LineItem', 'POMast.PONO = LineItem.PONO');
$this->db->join('T_Requestion_Master Req', 'Req.ReqNo = LineItem.ReqNo');
$this->db->join('t_status Stat', 'Stat.StatusCode = POMast.Status');
$this->db->join('t_purchaseorder_lineitem LineItem', 'POMast.PONO = LineItem.PONO');
$this->db->join('t_requestion_master Req', 'Req.ReqNo = LineItem.ReqNo');
// print_r( $this->db->last_query());
$query = $this->db->get();
@ -416,11 +416,11 @@ function purchaseorderListing($forwhat='')
{
$this->db->distinct();
$this->db->select('POMast.PONO,supp.SupplierName,TotalOrderValue,PODate,Stat.StatusName,Stat.StatusCode,POMast.POType as ReqType,DeliveryDate,DeliverySchedule,DeliveryOption,POMast.CapitalRange');
$this->db->from('T_PurchaseOrder_Master POMast');
$this->db->from('t_purchaseorder_master POMast');
$this->db->join('T_SupplierDetailsN supp', 'supp.SupplierID = POMast.SupplierID');
$this->db->join('T_Status Stat', 'Stat.StatusCode = POMast.Status');
$this->db->join('T_PurchaseOrder_LineItem LineItem', 'POMast.PONO = LineItem.PONO');
$this->db->join('T_Requestion_Master Req', 'Req.ReqNo = LineItem.ReqNo');
$this->db->join('t_status Stat', 'Stat.StatusCode = POMast.Status');
$this->db->join('t_purchaseorder_lineitem LineItem', 'POMast.PONO = LineItem.PONO');
$this->db->join('t_requestion_master Req', 'Req.ReqNo = LineItem.ReqNo');
if($forwhat=='amendment')
{
$this->db->where('POMast.Status',PO_RELEASED);
@ -473,7 +473,7 @@ function purchaseorderListing($forwhat='')
function getqtycheck($PONO)
{
$this->db->select('IsQualityChkReqired');
$this->db->from('T_PurchaseOrder_Master');
$this->db->from('t_purchaseorder_master');
$this->db->where('PONO',$PONO);
$query = $this->db->get();
@ -553,7 +553,7 @@ function purchaseorderListing($forwhat='')
JOIN T_MaterialMaster mat ON Req.MaterialCode = mat.MaterialCode
where mat.MaterialType = ?
AND Req.ReqNo = ?
AND mat.MaterialCode != (SELECT MaterialCode FROM T_PurchaseOrder_LineItem WHERE ReqNo =?
AND mat.MaterialCode != (SELECT MaterialCode FROM t_purchaseorder_lineitem WHERE ReqNo =?
)';
$query = $this->db->query($subQuery,array($MatType,$ReqNo,$ReqNo));
@ -565,9 +565,9 @@ function purchaseorderListing($forwhat='')
//Import PO Available Budget Amount
function GetAvailableImportBudgetAmount($CostCode,$Year,$BudgetType)
{
$subQuery='select BudgetAmount,(select ifnull(sum((Quantity*Rate*ExchangeRate)),0)as TValue from T_PurchaseOrder_LineItem LineItem
join T_PurchaseOrder_Master Mast on Mast.PONO=LineItem.PONO where POType=?
and CostCenterCode=? and Mast.status not in (?) )as Totalvalue from T_CostCenter_Budget Bud where Bud.CostCenterCode=? and BudgetYear=? and BudgetType=?';
$subQuery='select BudgetAmount,(select ifnull(sum((Quantity*Rate*ExchangeRate)),0)as TValue from t_purchaseorder_lineitem LineItem
join t_purchaseorder_master Mast on Mast.PONO=LineItem.PONO where POType=?
and CostCenterCode=? and Mast.status not in (?) )as Totalvalue from t_costcenter_budget Bud where Bud.CostCenterCode=? and BudgetYear=? and BudgetType=?';
$query = $this->db->query($subQuery,array($BudgetType,$CostCode,PO_AMENDED,$CostCode,$Year,$BudgetType));
//print_r($this->db->last_query());
return $query->result_array();
@ -579,9 +579,9 @@ function purchaseorderListing($forwhat='')
{
$subQuery ='select BudgetAmount, (select ifnull(sum(IF(POMaster.ExchangeRate>0,Quantity*Rate*POMaster.ExchangeRate,Quantity*Rate-tax.Afterdiscountval)),0) as Totalvalue from
T_PurchaseOrder_LineItem Item join T_Requestion_Master mast
on mast.ReqNo = Item.ReqNo join T_PurchaseOrder_Master POMaster on POMaster.PONO=Item.PONO left join T_Service_Tax tax on tax.LineItemNo=Item.LineItemNo where Item.CostCenterCode=? and POMaster.POType=? and POMaster.status not in (?))as Totalvalue
from T_CostCenter_Budget Bud where Bud.CostCenterCode=? and
t_purchaseorder_lineitem Item join t_requestion_master mast
on mast.ReqNo = Item.ReqNo join t_purchaseorder_master POMaster on POMaster.PONO=Item.PONO left join T_Service_Tax tax on tax.LineItemNo=Item.LineItemNo where Item.CostCenterCode=? and POMaster.POType=? and POMaster.status not in (?))as Totalvalue
from t_costcenter_budget Bud where Bud.CostCenterCode=? and
BudgetYear = ? and BudgetType =?';
$query = $this->db->query($subQuery,array($CostCode,$BudgetType,PO_AMENDED,$CostCode,$Year,$BudgetType));
@ -593,16 +593,16 @@ function purchaseorderListing($forwhat='')
{
$subQuery ='select distinct Bud.CostCenterCode,BudgetAmount, case WHEN BudgetType = ? then (select
round(ifnull(sum((Quantity*Rate)-ifnull(tax.AfterDiscount,0)),0),2) as
Totalvalue from T_PurchaseOrder_LineItem Item join T_Requestion_Master mast
on mast.ReqNo = Item.ReqNo join T_PurchaseOrder_Master POM on POM.PONO = Item.PONO left join T_Revenue_Tax tax on
Totalvalue from t_purchaseorder_lineitem Item join t_requestion_master mast
on mast.ReqNo = Item.ReqNo join t_purchaseorder_master POM on POM.PONO = Item.PONO left join T_Revenue_Tax tax on
tax.LineItemNo = Item.LineItemNo
where Item.CostCenterCode=? and POM.POType=? and POM.status not in (?)) else (select
round(ifnull(sum(Quantity*Rate*ifnull(case when mast.NumberOfService=?
then 1 else mast.NumberOfService end ,1)),0),2) as
Totalvalue from T_PurchaseOrder_LineItem Item join T_Requestion_Master mast
on mast.ReqNo = Item.ReqNo join T_PurchaseOrder_Master POM on POM.PONO = Item.PONO left join T_Requestion_Master ReqMas on ReqMas.ReqNo= Item.ReqNo
Totalvalue from t_purchaseorder_lineitem Item join t_requestion_master mast
on mast.ReqNo = Item.ReqNo join t_purchaseorder_master POM on POM.PONO = Item.PONO left join t_requestion_master ReqMas on ReqMas.ReqNo= Item.ReqNo
where Item.CostCenterCode=? and POM.POType=? and POM.status not in (?) ) end as Totalvalue
from T_CostCenter_Budget Bud join T_CostCenter_Departments dept on dept.CostCenterCode = Bud.CostCenterCode
from t_costcenter_budget Bud join T_CostCenter_Departments dept on dept.CostCenterCode = Bud.CostCenterCode
where Bud.CostCenterCode=? and
BudgetYear = ? and BudgetType =?';
@ -619,8 +619,8 @@ function purchaseorderListing($forwhat='')
function GetPOType($ReqNo)
{
$this->db->select('POType');
$this->db->from('T_PurchaseOrder_Master mast');
$this->db->join('T_PurchaseOrder_LineItem Line', 'mast.PONO=Line.PONO');
$this->db->from('t_purchaseorder_master mast');
$this->db->join('t_purchaseorder_lineitem Line', 'mast.PONO=Line.PONO');
$this->db->where('Line.ReqNo', $ReqNo);
$query = $this->db->get();
return $query->result_array();
@ -642,18 +642,18 @@ function GetPOType($ReqNo)
$this->db->distinct();
$this->db->select('ReqNo,ReqType,Status,Requestedby,mast.CreatedDate,mast.Schedule_Type,mast.NumberOfService,mast.Service_Period,
Dept.DEPCode,Dept.DepartmentName,mast.ReqDate,mast.CostCenterCode,mast.Status');
$this->db->from('T_Requestion_Master mast');
$this->db->from('t_requestion_master mast');
$this->db->join('T_DepartmentDetails Dept', 'mast.RequestedDept = Dept.DEPCode');
$this->db->join('t_departmentdetails Dept', 'mast.RequestedDept = Dept.DEPCode');
$this->db->where_in('mast.ReqNo', $ReqNoList);
}
else if($ReqBy!='') {
$this->db->distinct();
$this->db->select('ReqNo,ReqType,Status,Requestedby,mast.CreatedDate,mast.Schedule_Type,mast.NumberOfService,mast.Service_Period,emp.FirstName,emp.EmpID,emp.Designation, Dept.DEPCode,Dept.DepartmentName,mast.ReqDate,mast.CostCenterCode,mast.Status');
$this->db->from('T_Requestion_Master mast');
$this->db->join('T_Employee_Details emp', 'mast.Requestedby = emp.EmpID');
$this->db->join('T_DepartmentDetails Dept', 'mast.RequestedDept = Dept.DEPCode');
$this->db->from('t_requestion_master mast');
$this->db->join('t_employee_details emp', 'mast.Requestedby = emp.EmpID');
$this->db->join('t_departmentdetails Dept', 'mast.RequestedDept = Dept.DEPCode');
$this->db->where_in('mast.ReqNo', $ReqNoList);
}
@ -670,9 +670,9 @@ function GetPOType($ReqNo)
{
$this->db->distinct();
$this->db->select('ReqNo,ReqType,Status,Requestedby,mast.CreatedDate,emp.FirstName,emp.EmpID,emp.Designation, Dept.DEPCode,Dept.DepartmentName,mast.ReqDate');
$this->db->from('T_Requestion_Master mast');
$this->db->join('T_Employee_Details emp', 'mast.Requestedby = emp.EmpID');
$this->db->join('T_DepartmentDetails Dept', 'emp.Departmentcode = Dept.DEPCode');
$this->db->from('t_requestion_master mast');
$this->db->join('t_employee_details emp', 'mast.Requestedby = emp.EmpID');
$this->db->join('t_departmentdetails Dept', 'emp.Departmentcode = Dept.DEPCode');
$this->db->where_in('mast.ReqNo', $ReqNoList);
$query = $this->db->get();
@ -706,9 +706,9 @@ function GetPOType($ReqNo)
$this->db->select('Mast.CostCenterCode,Mast.CostCenterName,Bud.BudgetAmount,ReqNo');
$this->db->from('T_CostCenter_Master Mast');
$this->db->join('T_CostCenter_Departments CostDept', 'CostDept.CostCenterCode = Mast.CostCenterCode');
$this->db->join('T_CostCenter_Budget Bud', 'Bud.CostCenterCode = Mast.CostCenterCode');
$this->db->join('T_Employee_Details emp', 'CostDept.DEPCode = emp.Departmentcode');
$this->db->join('T_Requestion_Master req', 'req.Requestedby = emp.EmpID');
$this->db->join('t_costcenter_budget Bud', 'Bud.CostCenterCode = Mast.CostCenterCode');
$this->db->join('t_employee_details emp', 'CostDept.DEPCode = emp.Departmentcode');
$this->db->join('t_requestion_master req', 'req.Requestedby = emp.EmpID');
$this->db->where('BudgetType ',$ReqType );
$this->db->where('BudgetYear ',$BudYear );
@ -729,7 +729,7 @@ function GetPOType($ReqNo)
{
$this->db->distinct();
$this->db->select('ReqNo,');
$this->db->from('T_PurchaseOrder_LineItem');
$this->db->from('t_purchaseorder_lineitem');
if($PONO != '')
{
$this->db->where('PONO ',$PONO );
@ -764,14 +764,14 @@ function GetPOType($ReqNo)
/**
* This function is used to get the Company information from T_Company_Details table
* This function is used to get the Company information from t_company_details table
* @return array $result : This is result of the query
*/
function getCompanyInformation()
{
$subQuery = "select CompanyName,replace(Address,'<br>','') as Address,GSTNO,PAN,ContactNumber,EmailAddress,AlternateContactNumber,companyWebsite,StateCode
from T_Company_Details ";
from t_company_details ";
@ -783,14 +783,14 @@ function GetPOType($ReqNo)
// return $query->result();
}
/**
* This function is used to get the Company information from T_Company_Details table
* This function is used to get the Company information from t_company_details table
* @return array $result : This is result of the query
*/
function getCompanyInformationforPDF()
{
$subQuery = "select CompanyName,Address,GSTNO,PAN,ContactNumber,EmailAddress,AlternateContactNumber,companyWebsite,StateCode
from T_Company_Details ";
from t_company_details ";
@ -809,7 +809,7 @@ function GetPOType($ReqNo)
function getAllEmployees()
{
$this->db->select('EmpID,FirstName,LastName');
$this->db->from('T_Employee_Details');
$this->db->from('t_employee_details');
$query = $this->db->get();
return $query->result();
@ -822,7 +822,7 @@ function GetPOType($ReqNo)
function getLastCreatedPODate()
{
$this->db->select('max(PODate) as PODate');
$this->db->from('T_PurchaseOrder_Master');
$this->db->from('t_purchaseorder_master');
$query = $this->db->get();
return $query->result();
@ -831,7 +831,7 @@ function GetPOType($ReqNo)
function getLastReleasedPODate()
{
$this->db->select('max(ReleasedOn) as PODate');
$this->db->from('T_PurchaseOrder_Master');
$this->db->from('t_purchaseorder_master');
$query = $this->db->get();
return $query->result();
@ -843,7 +843,7 @@ function GetPOType($ReqNo)
function addPOMaster($POMaster,$POType,$POSubtype)
{
$this->db->trans_start();
$this->db->insert('T_PurchaseOrder_Master', $POMaster);
$this->db->insert('t_purchaseorder_master', $POMaster);
//$this->db->update('T_PONO_Reset_Table')
$insert_id = $this->db->affected_rows();
@ -851,7 +851,7 @@ function GetPOType($ReqNo)
// print_r($this->db->last_query());
if($insert_id>0)
{
$subQuery = 'select PONO from T_PurchaseOrder_Master where POType=? and POSubType=? and isnull(ParentPO) order by CreatedDate desc limit 1 ';
$subQuery = 'select PONO from t_purchaseorder_master where POType=? and POSubType=? and isnull(ParentPO) order by CreatedDate desc limit 1 ';
$query = $this->db->query($subQuery,array($POType,$POSubtype));
@ -868,13 +868,13 @@ function GetPOType($ReqNo)
{
// print_r($POMaster);
$this->db->trans_start();
$this->db->insert('T_PurchaseOrder_Master', $POMaster);
$this->db->insert('t_purchaseorder_master', $POMaster);
$insert_id = $this->db->affected_rows();
$this->db->trans_complete();
// print_r($this->db->last_query());
if($insert_id>0)
{
$subQuery = 'select PONO from T_PurchaseOrder_Master where CreatedBy=? and ParentPO=? order by CreatedDate desc limit 1';
$subQuery = 'select PONO from t_purchaseorder_master where CreatedBy=? and ParentPO=? order by CreatedDate desc limit 1';
$query = $this->db->query($subQuery,array($CreatedBy,$ParentPO));
@ -888,14 +888,14 @@ function GetPOType($ReqNo)
function addPOLineItem($POLineItem)
{
$this->db->trans_start();
$this->db->insert('T_PurchaseOrder_LineItem', $POLineItem);
$this->db->insert('t_purchaseorder_lineitem', $POLineItem);
$insert_id = $this->db->affected_rows();
$this->db->trans_complete();
// print_r($this->db->last_query());
if($insert_id>0)
{
// $subQuery = 'select max(LineItemNo) as LineItemNo from T_PurchaseOrder_LineItem';
$subQuery = 'SELECT * FROM T_PurchaseOrder_LineItem where PONO = "'.$POLineItem['PONO'].'" ORDER BY LineItemNo DESC';
// $subQuery = 'select max(LineItemNo) as LineItemNo from t_purchaseorder_lineitem';
$subQuery = 'SELECT * FROM t_purchaseorder_lineitem where PONO = "'.$POLineItem['PONO'].'" ORDER BY LineItemNo DESC';
$query = $this->db->query($subQuery);
@ -1002,10 +1002,10 @@ function GetPOType($ReqNo)
{
$this->db->distinct();
$this->db->select('ReqNo,POMast.PONO,POMast.PaymentTerms,POMast.PaymentOtherDescription,ServiceDescription,supp.SupplierID,supp.SupplierName,supp.Address,PODate,Stat.StatusName,DeliveryOption,DeliverySchedule,DeliveryDate,DeliveryAddress,POMast.PaymentTerms,POMast.ExchangeRate,POMast.UpdatedOn,Stat.StatusCode,POMast.ServiceWorkStatus,POMast.*,POMast.TotalOrderValue,POMast.BudgetType,IGR.IGRNO');
$this->db->from('T_PurchaseOrder_Master POMast');
$this->db->from('t_purchaseorder_master POMast');
$this->db->join('T_SupplierDetailsN supp', 'supp.SupplierID = POMast.SupplierID');
$this->db->join('T_Status Stat', 'Stat.StatusCode = POMast.Status');
$this->db->join('T_PurchaseOrder_LineItem LineItem', 'POMast.PONO = LineItem.PONO');
$this->db->join('t_status Stat', 'Stat.StatusCode = POMast.Status');
$this->db->join('t_purchaseorder_lineitem LineItem', 'POMast.PONO = LineItem.PONO');
$this->db->join('T_IGR_Master IGR','POMast.PONO = IGR.PONO','left');
$this->db->where('POMast.PONO', $PONO);
@ -1025,13 +1025,13 @@ function GetPOType($ReqNo)
$subQuery ='SELECT distinct LineItem.LineItemNo,LineItem.ReqNo,LineItem.Per,Mat.MaterialCode,Mat.MaterialName,Mat.UOM,LineItem.Quantity,ReceivedQuantity,Rate,LineItem.Status,(LineItem.Quantity *Rate) as BasicValue ,(After_CGST + After_SGST + After_IGST) as Taxamount,Dept.DepartmentName
,TotalValue,CGST,After_CGST,SGST,After_SGST,IGST,After_IGST,otherallowance,LineItem.CostCenterCode,LineItem.ServiceFrequency,LineItem.ServiceMaterialDescription,Req.Schedule_Type,Req.NumberOfService,Req.Service_Period,ReqDet.MaterialDescription
FROM T_PurchaseOrder_LineItem LineItem
FROM t_purchaseorder_lineitem LineItem
join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode
join T_Service_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo
join T_Requestion_Master Req on Req.ReqNo = LineItem.ReqNo
join t_requestion_master Req on Req.ReqNo = LineItem.ReqNo
join T_Requestion_Details ReqDet on ReqDet.ReqNo = LineItem.ReqNo and LineItem.MaterialCode = ReqDet.MaterialCode
left join T_Employee_Details emp on Req.Requestedby = emp.EmpID
join T_DepartmentDetails Dept on Req.RequestedDept = Dept.DEPCode
left join t_employee_details emp on Req.Requestedby = emp.EmpID
join t_departmentdetails Dept on Req.RequestedDept = Dept.DEPCode
where LineItem.PONO =?';
$query = $this->db->query($subQuery,array($PONO));
@ -1050,13 +1050,13 @@ function GetPOType($ReqNo)
Mat.UOM,Quantity,Rate,ROUND((Quantity *Rate),2 ) as BasicValue,POMaster.AmendedDetails,LineItem.AmendedDetails as lineamenddetails,
ROUND(( Tax.After_SGST + Tax.After_CGST + Tax.After_IGST ) ,2)as Taxamount,ReqMat.NumberOfService,ReqMat.Schedule_Type,ReqMat.Service_Period,
TotalValue,Tax.*,LineItem.CostCenterCode ,POMaster.*,sup.SupplierName,sup.SupplierID,sup.Address,sup.ContactNumber,sup.EmailAddress,sup.PAN,sup.GSTNO,Payment.PaymentTerms,AdvanceAmount
FROM T_PurchaseOrder_LineItem LineItem
FROM t_purchaseorder_lineitem LineItem
join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode
join T_Service_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo
join T_PurchaseOrder_Master POMaster on POMaster.PONO = LineItem.PONO
join t_purchaseorder_master POMaster on POMaster.PONO = LineItem.PONO
join T_SupplierDetailsN sup on sup.SupplierID = POMaster.SupplierID
join T_PaymentTerms Payment on Payment.PaymentID = POMaster.PaymentTerms
join T_Requestion_Master ReqMat on ReqMat.ReqNo = LineItem.ReqNo
join t_requestion_master ReqMat on ReqMat.ReqNo = LineItem.ReqNo
left join T_PurchaseOrder_AdvanceRequest PurAdv on POMaster.PONO=PurAdv.PONO
where LineItem.PONO =?';
@ -1075,12 +1075,12 @@ function GetPOType($ReqNo)
$subQuery ='SELECT distinct LineItem.LineItemNo,Req.ReqNo,Mat.MaterialCode,Mat.MaterialName,Mat.UOM,Quantity,Per,ServiceMaterialDescription,ReceivedQuantity,Rate,Req.Status,(Quantity *Rate) as BasicValue , (( AfterSGST + AfterCGST +
AfterIGST )) as Taxamount ,TotalValue,Tax.*,Req.CostCenterCode,Dept.DepartmentName
FROM T_PurchaseOrder_LineItem LineItem
FROM t_purchaseorder_lineitem LineItem
join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode
left join T_Revenue_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo
join T_Requestion_Master Req on Req.ReqNo = LineItem.ReqNo
left join T_Employee_Details emp on Req.Requestedby = emp.EmpID
join T_DepartmentDetails Dept on Req.RequestedDept = Dept.DEPCode
join t_requestion_master Req on Req.ReqNo = LineItem.ReqNo
left join t_employee_details emp on Req.Requestedby = emp.EmpID
join t_departmentdetails Dept on Req.RequestedDept = Dept.DEPCode
where LineItem.PONO =?';
$query = $this->db->query($subQuery,array($PONO));
@ -1099,10 +1099,10 @@ function GetPOType($ReqNo)
ROUND(((AfterSGST + AfterCGST +
AfterIGST)) ,2)as Taxamount,AdvanceAmount,
TotalValue,Tax.*,LineItem.CostCenterCode ,POMaster.*,sup.SupplierName,sup.Address,sup.SupplierID,sup.ContactNumber,sup.EmailAddress,sup.PAN,sup.GSTNO,LineItem.AmendedDetails as LineAmend,Payment.PaymentTerms
FROM T_PurchaseOrder_LineItem LineItem
FROM t_purchaseorder_lineitem LineItem
left join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode
left join T_Revenue_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo
join T_PurchaseOrder_Master POMaster on POMaster.PONO = LineItem.PONO
join t_purchaseorder_master POMaster on POMaster.PONO = LineItem.PONO
join T_SupplierDetailsN sup on sup.SupplierID = POMaster.SupplierID
left join T_PaymentTerms Payment on Payment.PaymentID = POMaster.PaymentTerms
left join T_PurchaseOrder_AdvanceRequest PurAdv on POMaster.PONO=PurAdv.PONO
@ -1119,9 +1119,9 @@ function GetPOType($ReqNo)
{
$subQuery ='SELECT group_concat(pl.MaterialCode ORDER BY pl.MaterialCode ASC) as Itemcode,rt.CGST,rt.SGST,rt.IGST,rt.FreightValue,rt.AfterFreightValue,rt.PackagingValue,rt.AfterPackagingValue,rt.DiscountValue,rt.AfterDiscount FROM T_Revenue_Tax rt
join T_PurchaseOrder_LineItem pl on pl.LineItemNo=rt.LineItemNo
join t_purchaseorder_lineitem pl on pl.LineItemNo=rt.LineItemNo
join T_PurchaseOrder_Master pm on pm.PONO=pl.PONO
join t_purchaseorder_master pm on pm.PONO=pl.PONO
where pm.POType=? and pm.PONO=?
@ -1141,25 +1141,25 @@ function GetImportPurchaseOrderDetailsForPDF($PONO = '')
// $subQuery ='SELECT distinct LineItem.LineItemNo,LineItem.ReqNo,Mat.MaterialCode,Mat.MaterialName,
// Mat.UOM,Quantity,ReqMas.Requestedby,Rate,ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,
// ProductPrice,Tax.*,LineItem.CostCenterCode , POMaster.*,sup.SupplierName,sup.Address
// FROM T_PurchaseOrder_LineItem LineItem
// join T_Requestion_Master ReqMas on ReqMas.ReqNo=LineItem.ReqNo
// FROM t_purchaseorder_lineitem LineItem
// join t_requestion_master ReqMas on ReqMas.ReqNo=LineItem.ReqNo
// join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode
// join T_Import_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo
// join T_PurchaseOrder_Master POMaster on POMaster.PONO = LineItem.PONO
// join t_purchaseorder_master POMaster on POMaster.PONO = LineItem.PONO
// join T_SupplierDetailsN sup on sup.SupplierID = POMaster.SupplierID
// where LineItem.PONO =?';
$subQuery='SELECT distinct LineItem.LineItemNo,LineItem.ReqNo,Mat.MaterialCode,Mat.MaterialName,Import_DispatchDetails,LineItem.Per,LineItem.ServiceMaterialDescription,
Mat.UOM,Quantity,ReqMas.Requestedby,Rate,ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount ,
ProductPrice,Tax.*,LineItem.CostCenterCode ,Date(ReqMast.ReqDate) as ReqDate,POMaster.*,sup.SupplierName,sup.Address,LineItem.AmendedDetails as LineAmend,AdvanceAmount, Pay.PaymentTerms as Pay,ROUND((Quantity *Rate),2 ) as BasicValue,HSNCODE,sup.EmailAddress,sup.SupplierID,sup.PAN,sup.ContactNumber,sup.GSTNO
FROM T_PurchaseOrder_LineItem LineItem
join T_Requestion_Master ReqMas on ReqMas.ReqNo=LineItem.ReqNo
FROM t_purchaseorder_lineitem LineItem
join t_requestion_master ReqMas on ReqMas.ReqNo=LineItem.ReqNo
join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode
join T_Import_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo
join T_PurchaseOrder_Master POMaster on POMaster.PONO = LineItem.PONO
join t_purchaseorder_master POMaster on POMaster.PONO = LineItem.PONO
join T_SupplierDetailsN sup on sup.SupplierID = POMaster.SupplierID
left join T_PurchaseOrder_AdvanceRequest PurAdv on POMaster.PONO=PurAdv.PONO
join T_Requestion_Master ReqMast on LineItem.ReqNo=ReqMast.ReqNo
join t_requestion_master ReqMast on LineItem.ReqNo=ReqMast.ReqNo
join T_PaymentTerms Pay on POMaster.PaymentTerms=Pay.PaymentID
where LineItem.PONO =?';
@ -1185,7 +1185,7 @@ where LineItem.PONO =?';
function GerRequesterName($Requester='')
{
$subQuery='SELECT EmpID,FirstName,Departmentcode from T_Employee_Details where EmpID=?';
$subQuery='SELECT EmpID,FirstName,Departmentcode from t_employee_details where EmpID=?';
$query=$this->db->query($subQuery,array($Requester));
@ -1195,7 +1195,7 @@ where LineItem.PONO =?';
function GerRequesterDep($Depcode='')
{
$subQuery='SELECT DepartmentName from T_DepartmentDetails where DEPCode=?';
$subQuery='SELECT DepartmentName from t_departmentdetails where DEPCode=?';
$query=$this->db->query($subQuery,array($Depcode));
return $query->result();
@ -1214,7 +1214,7 @@ where LineItem.PONO =?';
function GetPOStatus($Status='')
{
$subQuery='SELECT StatusName from T_Status where StatusCode=?';
$subQuery='SELECT StatusName from t_status where StatusCode=?';
$query=$this->db->query($subQuery,array($Status));
return $query->result();
@ -1223,7 +1223,7 @@ where LineItem.PONO =?';
function GetPaymentTerms($PONO='')
{
$subQuery='SELECT PaymentTerms from T_PurchaseOrder_Master where PONO=?';
$subQuery='SELECT PaymentTerms from t_purchaseorder_master where PONO=?';
$query=$this->db->query($subQuery,array($PONO));
//print_r($query);
return $query->result();
@ -1275,18 +1275,18 @@ QuantityRejected,ROUND(Quantity-ReceivedQuantity)as PendingQty,Per,
ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,LandingCharge,HighSeasSalesCharge,CustomDuty,ExciseDuty,ExciseDutyEdCess,CustomEdCess,POMast.ExchangeRate,AfterLandingCharge,AfterHighSeasSalesCharge,AfterCustomDuty,AfterExciseDuty,AfterExciseDutyEdCess,AddlExciseDuty,AfterAddlExciseDuty,Grossdutypayable,AvailableModvat,Grossexpensesduetocustomduty,purchaseratePerKG,CustomDutyExpensesPerKG,RMCIncludingCustomersPerKG,QuantityKG,BasicPriceInMTon,ProductPrice,CustomSHCess,AfterCustomSHCess,AfterExciseDutySHCess,ExciseDutySHCess,
AfterCustomEdCess,ROUND((Quantity *Rate),2)as TotalOrderValue,ROUND((POMast.ExchangeRate*BasicPriceInMTon),2) as BasicINRValue,TotalValue,CurrencyType,ReceivedQuantity,Tax.*,LineItem.ServiceMaterialDescription,
Req.CostCenterCode,Dept.DepartmentName FROM T_PurchaseOrder_LineItem LineItem
join T_PurchaseOrder_Master POMast on POMast.PONO = LineItem.PONO
Req.CostCenterCode,Dept.DepartmentName FROM t_purchaseorder_lineitem LineItem
join t_purchaseorder_master POMast on POMast.PONO = LineItem.PONO
join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode
join T_Import_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo
join T_Requestion_Master Req on Req.ReqNo = LineItem.ReqNo
left join T_Employee_Details emp on Req.Requestedby = emp.EmpID
join t_requestion_master Req on Req.ReqNo = LineItem.ReqNo
left join t_employee_details emp on Req.Requestedby = emp.EmpID
left join T_MRIR_Master Mast on POMast.PONO=Mast.PONO
left join T_MRIR_Details Det on Det.MaterialCode=LineItem.MaterialCode and Mast.MRIRNO=Det.MRIRNO
join T_DepartmentDetails Dept on Req.RequestedDept = Dept.DEPCode where LineItem.PONO =?';
join t_departmentdetails Dept on Req.RequestedDept = Dept.DEPCode where LineItem.PONO =?';
//print_r($subQuery);
$query = $this->db->query($subQuery,array($PONO));
@ -1328,7 +1328,7 @@ function GetCurrencytype()
function updatePOMaster($PONO,$PODetails)
{
$this->db->where('PONO', $PONO);
$this->db->update('T_PurchaseOrder_Master', $PODetails);
$this->db->update('t_purchaseorder_master', $PODetails);
return TRUE;
}
@ -1341,7 +1341,7 @@ function GetCurrencytype()
$this->db->where('PONO', $PONO);
$this->db->update('T_PurchaseOrder_Master', $PODetail);
$this->db->update('t_purchaseorder_master', $PODetail);
$insert_id = $this->db->affected_rows();
return $insert_id;
@ -1396,7 +1396,7 @@ function GetCurrencytype()
{
$this->db->where('PONO', $PONO);
$this->db->where('LineItemNo', $LineItemNo);
$this->db->update('T_PurchaseOrder_LineItem', $PODetails);
$this->db->update('t_purchaseorder_lineitem', $PODetails);
return TRUE;
}
@ -1446,9 +1446,9 @@ function GetCurrencytype()
/* This Method to get all the Department name for the requistion */
function getDepartmentListForAllReq()
{
$subQuery ='SELECT DISTINCT DEPT.DEPCode,DEPT.DepartmentName FROM T_Requestion_Master REQ
JOIN T_Employee_Details EMP ON REQ.Requestedby = EMP.EmpID
JOIN T_DepartmentDetails DEPT ON EMP.Departmentcode = DEPT.DEPCode WHERE REQ.Status not in(?,?,?,?)';
$subQuery ='SELECT DISTINCT DEPT.DEPCode,DEPT.DepartmentName FROM t_requestion_master REQ
JOIN t_employee_details EMP ON REQ.Requestedby = EMP.EmpID
JOIN t_departmentdetails DEPT ON EMP.Departmentcode = DEPT.DEPCode WHERE REQ.Status not in(?,?,?,?)';
$query = $this->db->query($subQuery,array(REQ_DRAFT,REQ_PENDING_APPROVAL,REQ_DELETED,REQ_REJECTED));
//print_r($query);
@ -1459,7 +1459,7 @@ function GetCurrencytype()
*/
function getDepartmentAllList()
{
$subQuery ='SELECT DISTINCT DEPCode,DepartmentName FROM T_DepartmentDetails';
$subQuery ='SELECT DISTINCT DEPCode,DepartmentName FROM t_departmentdetails';
$query = $this->db->query($subQuery);
//print_r($query);
@ -1469,8 +1469,8 @@ function GetCurrencytype()
function getStatusListforAllReq()
{
$subQuery ='SELECT DISTINCT STAT.StatusCode, STAT.StatusName FROM T_Requestion_Master REQ
JOIN T_Status STAT on REQ.Status = STAT.StatusCode where STAT.StatusCode not in (?,?,?,?)';
$subQuery ='SELECT DISTINCT STAT.StatusCode, STAT.StatusName FROM t_requestion_master REQ
JOIN t_status STAT on REQ.Status = STAT.StatusCode where STAT.StatusCode not in (?,?,?,?)';
$query = $this->db->query($subQuery,array(REQ_DRAFT,REQ_PENDING_APPROVAL,REQ_DELETED,REQ_REJECTED));
// print_r( $this->db->last_query());
@ -1481,10 +1481,10 @@ function GetCurrencytype()
function getStatusByDepartment($DepNo='')
{
$subQuery ='SELECT DISTINCT STAT.StatusCode ,STAT.StatusName FROM T_Requestion_Master REQ
JOIN T_Employee_Details EMP ON REQ.Requestedby = EMP.EmpID
JOIN T_DepartmentDetails DEPT ON EMP.Departmentcode = DEPT.DEPCode
JOIN T_Status STAT ON REQ.Status = STAT.StatusCode
$subQuery ='SELECT DISTINCT STAT.StatusCode ,STAT.StatusName FROM t_requestion_master REQ
JOIN t_employee_details EMP ON REQ.Requestedby = EMP.EmpID
JOIN t_departmentdetails DEPT ON EMP.Departmentcode = DEPT.DEPCode
JOIN t_status STAT ON REQ.Status = STAT.StatusCode
WHERE DEPT.DEPCode=? AND REQ.Status NOT IN (?,?,?,?)';
$query = $this->db->query($subQuery,array($DepNo,REQ_DRAFT,REQ_PENDING_APPROVAL,REQ_DELETED,REQ_REJECTED));
@ -1493,10 +1493,10 @@ function GetCurrencytype()
function getRequistionListbySearch($Depid='',$Status='',$FromDate='',$ToDate='')
{
$subQuery =' SELECT ReqNo,ReqType,Requestedby,EMP.FirstName,EMP.Designation,STAT.StatusCode ,STAT.StatusName,ReqDate,DEPT.DEPCode,DEPT.DepartmentName FROM T_Requestion_Master REQ
JOIN T_Employee_Details EMP ON REQ.Requestedby = EMP.EmpID
JOIN T_DepartmentDetails DEPT ON EMP.Departmentcode = DEPT.DEPCode
JOIN T_Status STAT on REQ.Status = STAT.StatusCode
$subQuery =' SELECT ReqNo,ReqType,Requestedby,EMP.FirstName,EMP.Designation,STAT.StatusCode ,STAT.StatusName,ReqDate,DEPT.DEPCode,DEPT.DepartmentName FROM t_requestion_master REQ
JOIN t_employee_details EMP ON REQ.Requestedby = EMP.EmpID
JOIN t_departmentdetails DEPT ON EMP.Departmentcode = DEPT.DEPCode
JOIN t_status STAT on REQ.Status = STAT.StatusCode
where REQ.Status NOT IN (?,?,?,?,?)';
$appendQuery = $subQuery ;
@ -1569,8 +1569,8 @@ function GetCurrencytype()
function UpdateRequistItemStatus()
{
$query = $this->db->query("update T_Requestion_Details REQ
JOIN T_PurchaseOrder_LineItem line ON REQ.ReqNo = line.ReqNo
JOIN T_PurchaseOrder_Master PO ON PO.PONO = line.PONO
JOIN t_purchaseorder_lineitem line ON REQ.ReqNo = line.ReqNo
JOIN t_purchaseorder_master PO ON PO.PONO = line.PONO
set REQ.Status = CASE WHEN REQ.Quantity = line.Quantity THEN 'ST022' WHEN REQ.Quantity > line.Quantity THEN 'ST023' ELSE 'ST003' END ,
REQ.updatedOn= CURRENT_TIMESTAMP
where PO.Status ='".PO_CREATED."'");
@ -1594,7 +1594,7 @@ function GetCurrencytype()
$this->db->where('LineItemNo', $LineItem);
$this->db->where('ReqNo', $ReqNo);
$this->db->where('MaterialCode', $MaterialCode);
$this->db->delete('T_PurchaseOrder_LineItem');
$this->db->delete('t_purchaseorder_lineitem');
return TRUE;
}
@ -1635,25 +1635,25 @@ function GetCurrencytype()
/**
* This function is used to get the List of PO details to the approver
* @return array $result : This is result of the query
join T_DepartmentDetails Dept on emp.Departmentcode = Dept.DEPCode
join t_departmentdetails Dept on emp.Departmentcode = Dept.DEPCode
*/
function getPOList($type)
{
$this->db->distinct();
$this->db->select('mast.PONO,mast.TotalOrderValue,st.StatusCode,st.StatusName,emp.FirstName,mast.CreatedDate,ccm.CostCenterName,ccm.CostCenterCode,mast.POType as RType,mast.Remarks,DepartmentName,mast.ApprovedBy,(select EmpID from tbl_users where userId=mast.ApprovedBy )as EID,rmast.ReqType,mast.Status,mast.CapitalRange,
(select FirstName from T_Employee_Details where EmpID=EID)as Approver');
$this->db->from('T_PurchaseOrder_Master mast');
(select FirstName from t_employee_details where EmpID=EID)as Approver');
$this->db->from('t_purchaseorder_master mast');
// $this->db->order_by('mast.Status',"PO_CREATED");
$this->db->join('T_Status st', 'st.StatusCode=mast.Status');
$this->db->join('t_status st', 'st.StatusCode=mast.Status');
$this->db->join('T_PurchaseOrder_LineItem req', 'req.PONO= mast.PONO');
$this->db->join('T_Requestion_Master rmast','rmast.ReqNo=req.ReqNo');
//$this->db->join('T_CostCenter_Budget bud','bud.CostCenterCode = req.CostCenterCode and bud.BudgetType = rmast.ReqType');
$this->db->join('t_purchaseorder_lineitem req', 'req.PONO= mast.PONO');
$this->db->join('t_requestion_master rmast','rmast.ReqNo=req.ReqNo');
//$this->db->join('t_costcenter_budget bud','bud.CostCenterCode = req.CostCenterCode and bud.BudgetType = rmast.ReqType');
$this->db->join('T_CostCenter_Master ccm','ccm.CostCenterCode = req.CostCenterCode','left');
$this->db->join('tbl_users tbl', 'rmast.createdby=tbl.userid');
$this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid');
$this->db->join('T_DepartmentDetails as Dep','Dep.DEPCode=emp.Departmentcode');
$this->db->join('t_employee_details as emp', 'emp.empid=tbl.empid');
$this->db->join('t_departmentdetails as Dep','Dep.DEPCode=emp.Departmentcode');
if($type=='APPROVAL'){
$this->db->or_where('mast.Status',PO_CREATED);
@ -1684,16 +1684,16 @@ function GetCurrencytype()
{
$this->db->where('PONO', $PONO);
$this->db->update('T_PurchaseOrder_Master', $store);
$this->db->update('t_purchaseorder_master', $store);
return TRUE;
}
function GetReleasedDetails($PONO){
$this->db->select('mast.ReleasedOn,re.FirstName');
$this->db->from('T_PurchaseOrder_Master mast');
$this->db->from('t_purchaseorder_master mast');
$this->db->join('tbl_users tbl','mast.ReleasedBy=tbl.userid');
$this->db->join('T_Employee_Details re','re.EmpID=tbl.EmpID');
$this->db->join('t_employee_details re','re.EmpID=tbl.EmpID');
$this->db->where('mast.PONO',$PONO);
$result=$this->db->get();
//print_r($this->db->last_query());
@ -1710,15 +1710,15 @@ function getCapitalPurchaseOrderDetails($PONO = '')
Mat.UOM,Quantity,ReceivedQuantity,Rate,Req.Status,Tax.*,
ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,LandingCharge,HighSeasSalesCharge,CustomDuty,ExciseDuty,ExciseDutyEdCess,CustomEdCess,POMast.ExchangeRate,POMast.ExchangeRateCalculatedon,POMast.TotalOrderValue as BasicValue,POMast.CapitalRange,AfterLandingCharge,AfterHighSeasSalesCharge,AfterCustomDuty,AfterExciseDuty,AfterExciseDutyEdCess,AddlExciseDuty,AfterAddlExciseDuty,Grossdutypayable,AvailableModvat,Grossexpensesduetocustomduty,purchaseratePerKG,CustomDutyExpensesPerKG,RMCIncludingCustomersPerKG,QuantityKG,BasicPriceInMTon,ProductPrice,CustomSHCess,AfterCustomSHCess,AfterExciseDutySHCess,ExciseDutySHCess,AfterCustomEdCess,ROUND((POMast.ExchangeRate*BasicPriceInMTon*Quantity),2) as BasicINRValue,Tax.TotalValue as ImportTotalValue,Tax.FreightType,Tax.NoOfTrip,Tax.FreightValue,Tax.AfterFreightValue,POMast.CurrencyType,
Req.CostCenterCode,Dept.DepartmentName FROM T_PurchaseOrder_LineItem LineItem
join T_PurchaseOrder_Master POMast on POMast.PONO = LineItem.PONO
Req.CostCenterCode,Dept.DepartmentName FROM t_purchaseorder_lineitem LineItem
join t_purchaseorder_master POMast on POMast.PONO = LineItem.PONO
join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode
join T_Import_Tax Tax on Tax.LineItemNo = LineItem.LineItemNo
join T_Requestion_Master Req on Req.ReqNo = LineItem.ReqNo
left join T_Employee_Details emp on Req.Requestedby = emp.EmpID
join t_requestion_master Req on Req.ReqNo = LineItem.ReqNo
left join t_employee_details emp on Req.Requestedby = emp.EmpID
join T_DepartmentDetails Dept on Req.RequestedDept = Dept.DEPCode where LineItem.PONO =?';
join t_departmentdetails Dept on Req.RequestedDept = Dept.DEPCode where LineItem.PONO =?';
//print_r($subQuery);
$query = $this->db->query($subQuery,array($PONO));
@ -1735,10 +1735,10 @@ left join T_Employee_Details emp on Req.Requestedby = emp.EmpID
$subQuery ='SELECT distinct LineItem.LineItemNo,LineItem.Per,LineItem.AmendedDetails as lineamd,ReqNo,Mat.MaterialCode,Mat.MaterialName,LineItem.ServiceMaterialDescription,
Mat.UOM,Mat.HSNCODE,Quantity,Rate,ROUND((Quantity *Rate),2 ) as BasicValue ,
LineItem.CostCenterCode , POMaster.*,sup.SupplierName,sup.SupplierID,sup.Address,sup.ContactNumber,sup.EmailAddress,sup.PAN,sup.GSTNO,Payment.PaymentID,Payment.PaymentTerms,AdvanceAmount,HSNCODE
FROM T_PurchaseOrder_LineItem LineItem
FROM t_purchaseorder_lineitem LineItem
join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode
join T_PurchaseOrder_Master POMaster on POMaster.PONO = LineItem.PONO
join t_purchaseorder_master POMaster on POMaster.PONO = LineItem.PONO
join T_SupplierDetailsN sup on sup.SupplierID = POMaster.SupplierID
join T_PaymentTerms Payment on Payment.PaymentID = POMaster.PaymentTerms
left join T_PurchaseOrder_AdvanceRequest Adv on POMaster.PONO=Adv.PONO
@ -1752,10 +1752,10 @@ left join T_Employee_Details emp on Req.Requestedby = emp.EmpID
// get requested by details
function GetRequesedByDetails($PONO){
$this->db->select('mast.CreatedBy,re.FirstName,Dept.DEPCode,Dept.DepartmentName');
$this->db->from('T_PurchaseOrder_Master mast');
$this->db->from('t_purchaseorder_master mast');
$this->db->join('tbl_users tbl','mast.CreatedBy=tbl.userid');
$this->db->join('T_Employee_Details re','re.EmpID=tbl.EmpID');
$this->db->join('T_DepartmentDetails Dept', 're.Departmentcode = Dept.DEPCode');
$this->db->join('t_employee_details re','re.EmpID=tbl.EmpID');
$this->db->join('t_departmentdetails Dept', 're.Departmentcode = Dept.DEPCode');
$this->db->where('mast.PONO',$PONO);
$result=$this->db->get();
@ -1775,14 +1775,14 @@ left join T_Employee_Details emp on Req.Requestedby = emp.EmpID
,ServiceTax.TotalValue,ServiceTax.CGST,ServiceTax.After_CGST,ServiceTax.SGST,ServiceTax.After_SGST,ServiceTax.IGST,ServiceTax.After_IGST,ServiceTax.otherallowance,ServiceTax.discount,ServiceTax.discountval,ServiceTax.Afterdiscountval,
POMast.ExchangeRate,POMast.ExchangeRateCalculatedon,POMast.TotalOrderValue as BasicValue,POMast.CapitalRange,ROUND((POMast.TotalOrderValue),2) as BasicINRValue,POMast.CurrencyType,FreightType as Ftype,NoOfTrip as NoTrip,FreightValue as Fvalue,AfterFreightValue as Afvalue,
Req.CostCenterCode,Dept.DepartmentName FROM T_PurchaseOrder_LineItem LineItem
join T_PurchaseOrder_Master POMast on POMast.PONO = LineItem.PONO
Req.CostCenterCode,Dept.DepartmentName FROM t_purchaseorder_lineitem LineItem
join t_purchaseorder_master POMast on POMast.PONO = LineItem.PONO
join T_MaterialMaster Mat on Mat.MaterialCode = LineItem.MaterialCode
join T_Service_Tax ServiceTax on ServiceTax.LineItemNo = LineItem.LineItemNo
join T_Requestion_Master Req on Req.ReqNo = LineItem.ReqNo
join T_Employee_Details emp on Req.Requestedby = emp.EmpID
join t_requestion_master Req on Req.ReqNo = LineItem.ReqNo
join t_employee_details emp on Req.Requestedby = emp.EmpID
join T_DepartmentDetails Dept on emp.Departmentcode = Dept.DEPCode where LineItem.PONO =?';
join t_departmentdetails Dept on emp.Departmentcode = Dept.DEPCode where LineItem.PONO =?';
//print_r($subQuery);
$query = $this->db->query($subQuery,array($PONO));
@ -1796,7 +1796,7 @@ left join T_Employee_Details emp on Req.Requestedby = emp.EmpID
function GetPdfRequistionDetails($PONO){
$this->db->select('LineItem.ReqNo');
$this->db->from('T_PurchaseOrder_LineItem LineItem');
$this->db->from('t_purchaseorder_lineitem LineItem');
$this->db->where('LineItem.PONO',$PONO);
$result=$this->db->get();
$ReqNo='';
@ -1809,9 +1809,9 @@ left join T_Employee_Details emp on Req.Requestedby = emp.EmpID
else{
$ReqNo = $res->ReqNo;
$this->db->select('ReqMast.ReqNo,ReqMast.CostCenterCode,ReqMast.ReqDate,ReqMast.Schedule_Type,ReqMast.NumberOfService,ReqMast.Service_Period,Dept.DEPCode,Dept.DepartmentName,Dept.shortName');
$this->db->from('T_Requestion_Master ReqMast');
$this->db->from('t_requestion_master ReqMast');
$this->db->join('T_DepartmentDetails Dept', 'ReqMast.RequestedDept = Dept.DEPCode');
$this->db->join('t_departmentdetails Dept', 'ReqMast.RequestedDept = Dept.DEPCode');
$this->db->where('ReqMast.ReqNo',$ReqNo);
$Reqresult=$this->db->get();
$Details['RequistionNo']= $Reqresult->result()[0]->ReqNo;
@ -1842,7 +1842,7 @@ left join T_Employee_Details emp on Req.Requestedby = emp.EmpID
function GetLineItemReceivedQty($ParentPO,$MaterialCode)
{
$this->db->select('ReceivedQuantity');
$this->db->from('T_PurchaseOrder_LineItem');
$this->db->from('t_purchaseorder_lineitem');
$this->db->where('PONO',$ParentPO);
$this->db->where('MaterialCode',$MaterialCode);
@ -1870,7 +1870,7 @@ left join T_Employee_Details emp on Req.Requestedby = emp.EmpID
function getStatus($StatusType = '')
{
$this->db->select('StatusCode,StatusName ');
$this->db->from('T_Status');
$this->db->from('t_status');
$this->db->where('StatusType', $StatusType);
$query = $this->db->get();
@ -1885,18 +1885,18 @@ left join T_Employee_Details emp on Req.Requestedby = emp.EmpID
$this->db->from ('T_MRIR_Master TMM');
$this->db->join ('T_MRIR_Details TMD','TMM.MRIRNO = TMD.MRIRNO','left');//to get IGRNO,PONO,MRIRNO,mrirdate,
$this->db->join ('T_IGR_Master IGRM', 'IGRM.IGRNO = TMM.IGRNO','left');//to get actualquantity,deliverydate,Invoicedate,vechileno,courierno,igrdate,
$this->db->join ('T_PurchaseOrder_Master POMR ','IGRM.PONO = POMR.PONO','left');//to get podate,deliverydate,servicedescription
$this->db->join ('T_PurchaseOrder_LineItem POLT','IGRM.PONO=POLT.PONO','left');//to get receivedquantity,quantity
$this->db->join ('t_purchaseorder_master POMR ','IGRM.PONO = POMR.PONO','left');//to get podate,deliverydate,servicedescription
$this->db->join ('t_purchaseorder_lineitem POLT','IGRM.PONO=POLT.PONO','left');//to get receivedquantity,quantity
$this->db->join ('T_IGR_Details IGRD','IGRD.IGRNO = IGRM.IGRNO','left');//to get invoicequantity
$this->db->join ('T_MaterialMaster MM','IGRD.MaterialCode = MM.MaterialCode','left');
$this->db->join ('T_SupplierDetailsN SUPP','POMR.SupplierID = SUPP.SupplierID','left');//to get suppliername,supplieraddress
$this->db->join ('tbl_users user','user.userid = POMR.CreatedBy','left');//to get poraisedby
$this->db->join ('T_Employee_Details ED','ED.EmpID = user.EmpID','left');
$this->db->join ('t_employee_details ED','ED.EmpID = user.EmpID','left');
$this->db->join ('tbl_users user1','user1.userid=TMM.CreatedBy','left');//to get mrirraisedby
$this->db->join ('T_Employee_Details ED1','ED1.EmpID = user1.EmpID','left');
$this->db->join ('t_employee_details ED1','ED1.EmpID = user1.EmpID','left');
$this->db->join ('tbl_users user2','user2.userid=IGRM.CreatedBy','left');//to get igrraisedby
$this->db->join ('T_Employee_Details ED2','ED2.EmpID = user2.EmpID','left');
$this->db->join ('t_employee_details ED2','ED2.EmpID = user2.EmpID','left');
$this->db->join('T_CostCenter_Master TCOST','POLT.CostCenterCode=TCOST.CostCenterCode');
$this->db->where('TMM.MRIRNO',$MrirNo);
$this->db->group_by('TMM.MRIRNO,TMD.MaterialCode');
@ -1914,11 +1914,11 @@ left join T_Employee_Details emp on Req.Requestedby = emp.EmpID
function getadvancePONO($Status='')
{
$this->db->select ('Mast.PONO,POType,Mast.CreatedDate,Mast.ReleasedOn,Mast.TotalOrderValue,Mast.SupplierID,DeliveryDate,DeliverySchedule,DeliveryOption,Mast.PaymentTerms as Paycode,Payterm.PaymentTerms,LineItem.ReqNo,Requestedby,Departmentcode,DepartmentName,LineItem.CostCenterCode,SupDet.SupplierName,Import_DispatchDetails,CurrencyType,AdvancePercentage,AdvanceAmount,POAdv.Remarks,Mast.CapitalRange,Mast.PaymentOtherDescription,RequestedDept');
$this->db->from('T_PurchaseOrder_Master Mast');
$this->db->join('T_PurchaseOrder_LineItem LineItem','Mast.PONO=LineItem.PONO');
$this->db->join('T_Requestion_Master ReqMa','LineItem.ReqNo=ReqMa.ReqNo');
$this->db->join('T_Employee_Details EmpDet','ReqMa.Requestedby=EmpDet.EmpID','left');
$this->db->join('T_DepartmentDetails DepDet','EmpDet.Departmentcode=DepDet.DEPCode or ReqMa.RequestedDept=DepDet.DEPCode','left');
$this->db->from('t_purchaseorder_master Mast');
$this->db->join('t_purchaseorder_lineitem LineItem','Mast.PONO=LineItem.PONO');
$this->db->join('t_requestion_master ReqMa','LineItem.ReqNo=ReqMa.ReqNo');
$this->db->join('t_employee_details EmpDet','ReqMa.Requestedby=EmpDet.EmpID','left');
$this->db->join('t_departmentdetails DepDet','EmpDet.Departmentcode=DepDet.DEPCode or ReqMa.RequestedDept=DepDet.DEPCode','left');
$this->db->join('T_SupplierDetailsN SupDet','Mast.SupplierID=SupDet.SupplierID');
$this->db->join('T_PurchaseOrder_AdvanceRequest POAdv','Mast.PONO=POAdv.PONO','left');
$this->db->join('T_PaymentTerms Payterm','Mast.PaymentTerms=Payterm.PaymentID');
@ -1937,14 +1937,14 @@ left join T_Employee_Details emp on Req.Requestedby = emp.EmpID
$this->db->set('Req.Status',$POStatus);
$this->db->where('Item.PONO',$PONO);
$this->db->where('Req.MaterialCode',$MaterialCode);
$this->db->update('T_PurchaseOrder_LineItem Item JOIN T_Requestion_Details Req ON Item.ReqNo= Req.ReqNo');
$this->db->update('t_purchaseorder_lineitem Item JOIN T_Requestion_Details Req ON Item.ReqNo= Req.ReqNo');
return TRUE;
}
function UpdateReceivedQtyforServicePO($PONO,$updateddt,$updatedBy)
{
$this->db->select('LineItemNo,MaterialCode');
$this->db->from('T_PurchaseOrder_LineItem');
$this->db->from('t_purchaseorder_lineitem');
$this->db->where('PONO ',$PONO );
$query = $this->db->get();
$result = $query->result();
@ -1957,14 +1957,14 @@ left join T_Employee_Details emp on Req.Requestedby = emp.EmpID
$MaterialCode = $res->MaterialCode;
//echo $LineItemNo;
$subQuery = 'update T_PurchaseOrder_LineItem
$subQuery = 'update t_purchaseorder_lineitem
set ReceivedQuantity=Quantity, status=?,UpdatedOn=?,UpdateBY=? where PONO=? and LineItemNo=?';
$query = $this->db->query($subQuery,array(PO_SERVICE_COMPLETED,$updateddt,$updatedBy,$PONO,$LineItemNo));
$finddot = strpos($PONO,'.');
if($finddot = true)
{
$subQuery = 'update T_PurchaseOrder_LineItem
$subQuery = 'update t_purchaseorder_lineitem
set ReceivedQuantity=Quantity, status=?,UpdatedOn=?,UpdateBY=? where PONO=substring(?,1,(case when INstr(?,?) > 0 then INstr(?,?)-1 else 0 end)) and MaterialCode=?';
$query = $this->db->query($subQuery,array(PO_SERVICE_COMPLETED,$updateddt,$updatedBy,$PONO,$PONO,'.',$PONO,'.',$MaterialCode));
@ -1980,8 +1980,8 @@ left join T_Employee_Details emp on Req.Requestedby = emp.EmpID
$taxQuery ='SELECT group_concat(@count:=@count+1) Itemcode,
st.CGST,st.SGST,st.IGST,st.otherallowance FROM T_Service_Tax st
join T_PurchaseOrder_LineItem pl on pl.LineItemNo=st.LineItemNo
join T_PurchaseOrder_Master pm on pm.PONO=pl.PONO JOIN
join t_purchaseorder_lineitem pl on pl.LineItemNo=st.LineItemNo
join t_purchaseorder_master pm on pm.PONO=pl.PONO JOIN
(SELECT @count := 0) count
where pm.POType=? and pm.PONO=?
group by st.CGST,st.SGST,st.IGST,st.otherallowance
@ -1998,8 +1998,8 @@ st.CGST,st.SGST,st.IGST,st.otherallowance FROM T_Service_Tax st
if($CapitalRange==1){
$taxQuery ='SELECT group_concat(pl.MaterialCode ORDER BY pl.MaterialCode ASC) as Itemcode,SUM(st.`After_CGST`) AS TotalCGST,SUM(st.`After_SGST`) AS TotalSGST,SUM(st.`After_IGST`) AS TotalIGST,SUM(st.`otherallowance`) AS TotalOtherAllowance,SUM(st.`Afterdiscountval`) AS TotalDiscount,st.discountval,st.Afterdiscountval,st.CGST,st.SGST,st.IGST,st.otherallowance,SUM(st.`AfterFreightValue`) AS TotalFreight,st.FreightValue FROM T_Service_Tax st
join T_PurchaseOrder_LineItem pl on pl.LineItemNo=st.LineItemNo
join T_PurchaseOrder_Master pm on pm.PONO=pl.PONO
join t_purchaseorder_lineitem pl on pl.LineItemNo=st.LineItemNo
join t_purchaseorder_master pm on pm.PONO=pl.PONO
where pm.POType=? and pm.PONO=?
group by st.Afterdiscountval,st.CGST,st.SGST,st.IGST,st.otherallowance ORDER BY st.LineItemNo ASC';
$query = $this->db->query($taxQuery,array("CAPITAL",$PONO));
@ -2010,8 +2010,8 @@ st.CGST,st.SGST,st.IGST,st.otherallowance FROM T_Service_Tax st
$taxQuery ='SELECT group_concat(pl.MaterialCode ORDER BY pl.MaterialCode ASC) as Itemcode,
SUM(it.`AfterFreightValue`) AS TotalFreight,it.FreightValue,it.AfterFreightValue,
it.IGST AS TotalIGSTPer,SUM(it.AfterIGST) as AfterIGST1,it.AfterIGST as AIgst FROM T_Import_Tax it
join T_PurchaseOrder_LineItem pl on pl.LineItemNo=it.LineItemNo
join T_PurchaseOrder_Master pm on pm.PONO=pl.PONO
join t_purchaseorder_lineitem pl on pl.LineItemNo=it.LineItemNo
join t_purchaseorder_master pm on pm.PONO=pl.PONO
where pm.POType=? and pm.PONO=?
group by it.AfterFreightValue ORDER BY it.LineItemNo ASC';
$query = $this->db->query($taxQuery,array("CAPITAL",$PONO));
@ -2022,7 +2022,7 @@ st.CGST,st.SGST,st.IGST,st.otherallowance FROM T_Service_Tax st
}
// get po format for acedamic year based
function GetPoFormat($PONO=''){
$poQuery ='select PONO from T_PurchaseOrder_Master where PONO=?';
$poQuery ='select PONO from t_purchaseorder_master where PONO=?';
$query = $this->db->query($poQuery,array($PONO));
return $query->result();
@ -2030,7 +2030,7 @@ st.CGST,st.SGST,st.IGST,st.otherallowance FROM T_Service_Tax st
//get Dept Emp Name
function getDepartmentEmpList($DepCode=''){
$this->db->select('EmpID');
$this->db->from('T_Employee_Details');
$this->db->from('t_employee_details');
$this->db->where('Departmentcode', $DepCode);
$this->db->limit('1');
$query = $this->db->get();
@ -2042,7 +2042,7 @@ function GetRequistionMasterUsingReqNo($Req){
$this->db->select('Requestedby');
$this->db->from('T_Requestion_Master');
$this->db->from('t_requestion_master');
$this->db->where('ReqNo', $Req[0]);
$query = $this->db->get();
@ -2055,8 +2055,8 @@ function amendpdf($PONO='')
$Amend ='select p.PONO,p.ParentPO,p.Status,p.TotalOrderValue,
m.Status as parentpostatus,
m.TotalOrderValue as partenttotalorder
from T_PurchaseOrder_Master as p
join T_PurchaseOrder_Master as m
from t_purchaseorder_master as p
join t_purchaseorder_master as m
on m.PONO = p.ParentPO
where p.PONO = ?';
$amendment = $this->db->query($Amend,array($PONO));
@ -2474,10 +2474,10 @@ function getlogpodtl($PONO){
// from T_ponewlogs_Details log
// join T_PurchaseOrder_LineItem pl on log.LineItemNos = pl.LineItemNo
// join T_PurchaseOrder_Master pm on pm.PONO = log.PONO
// join t_purchaseorder_lineitem pl on log.LineItemNos = pl.LineItemNo
// join t_purchaseorder_master pm on pm.PONO = log.PONO
// join tbl_users user on user.userId = log.UpdateBy
// left join T_Employee_Details emp on emp.EmpID= user.EmpID
// left join t_employee_details emp on emp.EmpID= user.EmpID
// left join T_SupplierDetailsN sup on sup.SupplierID = log.SupplierID
// where log.PONO ='".$PONO."'";
@ -2486,7 +2486,7 @@ function getlogpodtl($PONO){
$SQL = "select log.*,sup.SupplierName,emp.FirstName from
T_polog_Details log
join tbl_users user on user.userId = log.UpdateBy
left join T_Employee_Details emp on emp.EmpID= user.EmpID
left join t_employee_details emp on emp.EmpID= user.EmpID
left join T_SupplierDetailsN sup on sup.SupplierID = log.oldValue
where PONO ='".$PONO."'";

View File

@ -184,27 +184,27 @@ class Quality_model extends CI_Model
}
function getOperatorsListforReport()
{
$r = $this->db->select('EmpID,FirstName,LastName')->from('T_Employee_Details')->get();
$r = $this->db->select('EmpID,FirstName,LastName')->from('t_employee_details')->get();
return $r->result();
}
function getExistOperatorsListforReport($rbcid)
{
$sql = "select T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName
from T_ResinBatchCard_Operators join T_Employee_Details on T_ResinBatchCard_Operators.EmpID =
T_Employee_Details.EmpID where T_ResinBatchCard_Operators.master_id = ?";
$sql = "select t_employee_details.EmpID,t_employee_details.FirstName,t_employee_details.LastName
from T_ResinBatchCard_Operators join t_employee_details on T_ResinBatchCard_Operators.EmpID =
t_employee_details.EmpID where T_ResinBatchCard_Operators.master_id = ?";
$r = $this->db->query($sql,array($rbcid));
return $r->result();
}
function getEmplistforReport()
{
$this->db->select('T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.Departmentcode,T_DepartmentDetails.shortName,');
$this->db->from('T_Employee_Details');
$this->db->join('T_DepartmentDetails','T_Employee_Details.Departmentcode=T_DepartmentDetails.DEPCode');
$this->db->select('t_employee_details.EmpID,t_employee_details.FirstName,t_employee_details.LastName,t_employee_details.Departmentcode,t_departmentdetails.shortName,');
$this->db->from('t_employee_details');
$this->db->join('t_departmentdetails','t_employee_details.Departmentcode=t_departmentdetails.DEPCode');
//$this->db->join('ip_invoice_items','ip_invoices.invoice_number=ip_invoice_items.invoice_number');
//$this->db->join('ip_products','ip_invoice_items.item_product_id=ip_products.product_id');
//$this->db->join('ip_invoice_custom','ip_invoices.invoice_number=ip_invoice_custom.invoice_number and invoice_custom_fieldid=62');
$this->db->order_by('T_Employee_Details.EmpID');
$this->db->order_by('t_employee_details.EmpID');
$res = $this->db->get();
return $res->result();
@ -263,13 +263,13 @@ class Quality_model extends CI_Model
function getResinBatchCardDetails($rbcid)
{
$sql = 'select T_ResinBatchCard_Master.*,ip_products.product_name,ip_products.product_description,ip_clients.client_name,T_Machine_Master.Machine_Name,T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,a.FirstName as name from T_ResinBatchCard_Master
$sql = 'select T_ResinBatchCard_Master.*,ip_products.product_name,ip_products.product_description,ip_clients.client_name,T_Machine_Master.Machine_Name,t_employee_details.EmpID,t_employee_details.FirstName,t_employee_details.LastName,a.FirstName as name from T_ResinBatchCard_Master
join ip_products on T_ResinBatchCard_Master.productid = ip_products.product_id
join ip_clients on T_ResinBatchCard_Master.customerid = ip_clients.client_id
join T_Machine_Master on T_ResinBatchCard_Master.machinecode = T_Machine_Master.Machine_Code
join tbl_users on T_ResinBatchCard_Master.createdby = tbl_users.userId
join T_Employee_Details on tbl_users.EmpID = T_Employee_Details.EmpID
join T_Employee_Details as a on a.EmpID = T_ResinBatchCard_Master.operatedby
join t_employee_details on tbl_users.EmpID = t_employee_details.EmpID
join t_employee_details as a on a.EmpID = T_ResinBatchCard_Master.operatedby
where T_ResinBatchCard_Master.resinbatch_id = ?';
$res['masterdata'] = $this->db->query($sql,array($rbcid))->result();
//print_r($res['masterdata']);
@ -315,8 +315,8 @@ class Quality_model extends CI_Model
join ip_products on T_ResinBatchCard_Master.productid=ip_products.product_id
join ip_clients on T_ResinBatchCard_Master.customerid=ip_clients.client_id
join tbl_users on T_ResinBatchCard_Master.createdby = tbl_users.userId
join T_Employee_Details ED on ED.EmpID = T_ResinBatchCard_Master.operatedby
join T_Employee_Details EmpDtl on EmpDtl.EmpID = tbl_users.EmpID';
join t_employee_details ED on ED.EmpID = T_ResinBatchCard_Master.operatedby
join t_employee_details EmpDtl on EmpDtl.EmpID = tbl_users.EmpID';
$res = $this->db->query($sql);
return $res->result();
@ -346,7 +346,7 @@ class Quality_model extends CI_Model
function getIndividualReportData($reportid)
{
$this->db->select('T_Test_Report_Master.testreport_id,ip_invoices.invoice_date_created,T_Test_Report_Master.invoiceid,T_Test_Report_Master.batchdate,T_Test_Report_Master.chartdata,ip_clients.client_id,ip_clients.client_name,invoice_custom_fieldvalue,ip_products.product_id,ip_products.product_name,ip_products.product_description,T_Employee_Details.FirstName,T_Employee_Details.LastName,ip_invoice_items.item_quantity,T_Test_Report_Master.approvedby');
$this->db->select('T_Test_Report_Master.testreport_id,ip_invoices.invoice_date_created,T_Test_Report_Master.invoiceid,T_Test_Report_Master.batchdate,T_Test_Report_Master.chartdata,ip_clients.client_id,ip_clients.client_name,invoice_custom_fieldvalue,ip_products.product_id,ip_products.product_name,ip_products.product_description,t_employee_details.FirstName,t_employee_details.LastName,ip_invoice_items.item_quantity,T_Test_Report_Master.approvedby');
$this->db->from('T_Test_Report_Master');
$this->db->join('ip_invoices','T_Test_Report_Master.invoiceid=ip_invoices.invoice_number');
$this->db->join('ip_clients','ip_invoices.client_id=ip_clients.client_id');
@ -354,8 +354,8 @@ class Quality_model extends CI_Model
$this->db->join('ip_products','ip_products.product_id=ip_invoice_items.item_product_id');
$this->db->join('ip_invoice_custom','ip_invoices.invoice_id=ip_invoice_custom.invoice_id and invoice_custom_fieldid=62');
$this->db->join('tbl_users','T_Test_Report_Master.createdby=tbl_users.userid');
$this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID');
//$this->db->join('T_Employee_Details','T_Test_Report_Master.EmpID=T_Employee_Details.EmpID');
$this->db->join('t_employee_details','tbl_users.EmpID=t_employee_details.EmpID');
//$this->db->join('t_employee_details','T_Test_Report_Master.EmpID=t_employee_details.EmpID');
//$this->db->join('ip_invoice_custom','ip_invoices.invoice_number=ip_invoice_custom.invoice_number and invoice_custom_fieldid=62');
$this->db->where('testreport_id',$reportid);
// $this->db->join('T_Test_Report','T_Test_Report_Master.testreport_id=T_Test_Report.testreport_id');
@ -383,8 +383,8 @@ class Quality_model extends CI_Model
$res1 = $this->db->get();
$reportdata['masterreportafs'] = $res1->result();
$this->db->select('T_Company_Details.CompanyName,T_Company_Details.Address,T_Company_Details.ProfilePic');
$this->db->from('T_Company_Details');
$this->db->select('t_company_details.CompanyName,t_company_details.Address,t_company_details.ProfilePic');
$this->db->from('t_company_details');
//$this->db->where('testreport_id',$reportid);
$res1 = $this->db->get();
$reportdata['company'] = $res1->result();
@ -396,15 +396,15 @@ class Quality_model extends CI_Model
function getIndividualInwardReportData($reportid)
{
$this->db->select('T_Test_Report_Master.chartdata,T_Test_Report_Master.batchdate,T_Test_Report_Master.testreport_id,T_IGR_Master.IGRNO,T_IGR_Master.DeliveryChellanOrInvoiceNo,T_IGR_Master.DeliveryChellanDate,T_IGR_Details.IGRItemNo,T_IGR_Details.QuantityAsPerInvoice,T_MaterialMaster.MaterialCode,T_MaterialMaster.Materialname,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,T_Test_Report_Master.approvedby,T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName');
$this->db->select('T_Test_Report_Master.chartdata,T_Test_Report_Master.batchdate,T_Test_Report_Master.testreport_id,T_IGR_Master.IGRNO,T_IGR_Master.DeliveryChellanOrInvoiceNo,T_IGR_Master.DeliveryChellanDate,T_IGR_Details.IGRItemNo,T_IGR_Details.QuantityAsPerInvoice,T_MaterialMaster.MaterialCode,T_MaterialMaster.Materialname,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,T_Test_Report_Master.approvedby,t_employee_details.EmpID,t_employee_details.FirstName,t_employee_details.LastName');
$this->db->from('T_Test_Report_Master');
$this->db->join('T_IGR_Master','T_Test_Report_Master.igrno=T_IGR_Master.IGRNO');
$this->db->join('T_IGR_Details','T_Test_Report_Master.igrlineitemno=T_IGR_Details.IGRItemNo');
$this->db->join('T_PurchaseOrder_Master','T_IGR_Master.PONO=T_PurchaseOrder_Master.PONO');
$this->db->join('t_purchaseorder_master','T_IGR_Master.PONO=t_purchaseorder_master.PONO');
$this->db->join('T_MaterialMaster','T_IGR_Details.MaterialCode=T_MaterialMaster.MaterialCode');
$this->db->join('T_SupplierDetailsN','T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID');
$this->db->join('T_SupplierDetailsN','t_purchaseorder_master.SupplierID=T_SupplierDetailsN.SupplierID');
$this->db->join('tbl_users','T_Test_Report_Master.createdby=tbl_users.userid');
$this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID');
$this->db->join('t_employee_details','tbl_users.EmpID=t_employee_details.EmpID');
$this->db->where('T_Test_Report_Master.testreport_id',$reportid);
@ -429,8 +429,8 @@ class Quality_model extends CI_Model
$res1 = $this->db->get();
$reportdata['masterreportafs'] = $res1->result();
$this->db->select('T_Company_Details.CompanyName,T_Company_Details.Address,T_Company_Details.ProfilePic');
$this->db->from('T_Company_Details');
$this->db->select('t_company_details.CompanyName,t_company_details.Address,t_company_details.ProfilePic');
$this->db->from('t_company_details');
//$this->db->where('testreport_id',$reportid);
$res1 = $this->db->get();
$reportdata['company'] = $res1->result();
@ -463,15 +463,15 @@ class Quality_model extends CI_Model
// $res = $this->db->get();
// return $res->result();
$this->db->select('T_Test_Report_Master.batchdate,T_Test_Report_Master.testreport_id,T_IGR_Master.IGRNO,T_IGR_Master.DeliveryChellanOrInvoiceNo,T_IGR_Master.DeliveryChellanDate,T_IGR_Details.IGRItemNo,T_IGR_Details.QuantityAsPerInvoice,T_MaterialMaster.MaterialCode,T_MaterialMaster.Materialname,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,T_Test_Report_Master.approvedby,T_Test_Report_Master.document,T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName');
$this->db->select('T_Test_Report_Master.batchdate,T_Test_Report_Master.testreport_id,T_IGR_Master.IGRNO,T_IGR_Master.DeliveryChellanOrInvoiceNo,T_IGR_Master.DeliveryChellanDate,T_IGR_Details.IGRItemNo,T_IGR_Details.QuantityAsPerInvoice,T_MaterialMaster.MaterialCode,T_MaterialMaster.Materialname,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,T_Test_Report_Master.approvedby,T_Test_Report_Master.document,t_employee_details.EmpID,t_employee_details.FirstName,t_employee_details.LastName');
$this->db->from('T_Test_Report_Master');
$this->db->join('T_IGR_Master','T_Test_Report_Master.igrno=T_IGR_Master.IGRNO');
$this->db->join('T_IGR_Details','T_Test_Report_Master.igrlineitemno=T_IGR_Details.IGRItemNo');
$this->db->join('T_PurchaseOrder_Master','T_IGR_Master.PONO=T_PurchaseOrder_Master.PONO');
$this->db->join('t_purchaseorder_master','T_IGR_Master.PONO=t_purchaseorder_master.PONO');
$this->db->join('T_MaterialMaster','T_IGR_Details.MaterialCode=T_MaterialMaster.MaterialCode');
$this->db->join('T_SupplierDetailsN','T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID');
$this->db->join('T_SupplierDetailsN','t_purchaseorder_master.SupplierID=T_SupplierDetailsN.SupplierID');
$this->db->join('tbl_users','T_Test_Report_Master.createdby=tbl_users.userid');
$this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID');
$this->db->join('t_employee_details','tbl_users.EmpID=t_employee_details.EmpID');
$this->db->order_by('testreport_id','desc');
$res = $this->db->get();
return $res->result();
@ -538,8 +538,8 @@ class Quality_model extends CI_Model
// $this->db->from('T_IGR_Master');
// $this->db->join('T_IGR_Details','T_IGR_Master.IGRNO=T_IGR_Details.IGRNO');
// $this->db->join('T_MaterialMaster','T_IGR_Details.MaterialCode=T_MaterialMaster.MaterialCode');
// $this->db->join('T_PurchaseOrder_Master','T_IGR_Master.PONO=T_PurchaseOrder_Master.PONO');
// $this->db->join('T_SupplierDetailsN','T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID');
// $this->db->join('t_purchaseorder_master','T_IGR_Master.PONO=t_purchaseorder_master.PONO');
// $this->db->join('T_SupplierDetailsN','t_purchaseorder_master.SupplierID=T_SupplierDetailsN.SupplierID');
// $this->db->where('T_IGR_Details.IGRNO',$igrno);
// $this->db->where('T_IGR_Details.IGRItemNo',$igrlineitemno);
@ -552,8 +552,8 @@ class Quality_model extends CI_Model
from T_IGR_Master
join T_IGR_Details on T_IGR_Master.IGRNO=T_IGR_Details.IGRNO
join T_MaterialMaster on T_IGR_Details.MaterialCode=T_MaterialMaster.MaterialCode
join T_PurchaseOrder_Master on T_IGR_Master.PONO=T_PurchaseOrder_Master.PONO
join T_SupplierDetailsN on T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID
join t_purchaseorder_master on T_IGR_Master.PONO=t_purchaseorder_master.PONO
join T_SupplierDetailsN on t_purchaseorder_master.SupplierID=T_SupplierDetailsN.SupplierID
where T_IGR_Master.IGRNO = ? and T_IGR_Details.IGRItemNo = ?';
$res = $this->db->query($sql,array($igrno,$igrlineitemno));
return $res->result();

View File

@ -211,9 +211,9 @@ WHERE MaterialCode=? AND CreatedOn >=? AND CreatedOn <=? ";
$this->db->select('det.*,emp.firstname,emp1.firstname as Updated_By,det.IsActive');
$this->db->join('tbl_users as tbl',' det.createdby = tbl.userid','left');
$this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid','left');
$this->db->join('t_employee_details as emp', 'emp.empid=tbl.empid','left');
$this->db->join('tbl_users as tbl1',' det.UpdatedBy = tbl1.userid','left');
$this->db->join('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid','left');
$this->db->join('t_employee_details as emp1', 'emp1.empid=tbl1.empid','left');
return $this->db->get('T_MaterialMaster as det')->result_array();
}
@ -337,8 +337,8 @@ where (CurrentStock+OpeningStock)<reorder";
function getMaterialAvg($RawMaterialID)
{
$subQuery='select AVG(Rate) as avg_rate from T_PurchaseOrder_LineItem
join T_PurchaseOrder_Master on T_PurchaseOrder_Master.PONO=T_PurchaseOrder_LineItem.PONO
$subQuery='select AVG(Rate) as avg_rate from t_purchaseorder_lineitem
join t_purchaseorder_master on t_purchaseorder_master.PONO=t_purchaseorder_lineitem.PONO
where MaterialCode = ?';
$query = $this->db->query($subQuery,array($RawMaterialID));

View File

@ -55,10 +55,10 @@ class requistion_model extends CI_Model
ifnull(Po.Quantity,0) as POQTY,sta.StatusName
from T_Requestion_Details Req join T_MaterialMaster Mat on
Req.MaterialCode = Mat.MaterialCode
left join T_PurchaseOrder_LineItem Po on Po.ReqNo = Req.ReqNo
left join T_PurchaseOrder_Master POmast on POmast.PONO=Po.PONO
left join t_purchaseorder_lineitem Po on Po.ReqNo = Req.ReqNo
left join t_purchaseorder_master POmast on POmast.PONO=Po.PONO
and Po.MaterialCode = Req.MaterialCode
join T_Status sta on sta.StatusCode = Req.Status
join t_status sta on sta.StatusCode = Req.Status
where Req.ReqNo = ? and POmast.Status != ?';
$query = $this->db->query($subQuery, array($ReqNo,PO_AMENDED));
@ -75,7 +75,7 @@ class requistion_model extends CI_Model
function getStatus()
{
$this->db->select('StatusCode,StatusName ');
$this->db->from('T_Status');
$this->db->from('t_status');
$this->db->where('StatusType', REQUISTSTATUS);
$this->db->where('StatusCode !=', REQ_DRAFT);
$query = $this->db->get();
@ -114,8 +114,8 @@ class requistion_model extends CI_Model
{
$this->db->select(' EMP.EmpID,EMP.Designation,DEPT.DEPCode,DEPT.DepartmentName');
$this->db->from('T_Employee_Details EMP');
$this->db->join('T_DepartmentDetails DEPT', 'EMP.Departmentcode = DEPT.DEPCode');
$this->db->from('t_employee_details EMP');
$this->db->join('t_departmentdetails DEPT', 'EMP.Departmentcode = DEPT.DEPCode');
$this->db->where('EMP.EmpID ',$EmpID );
$query = $this->db->get();
@ -144,7 +144,7 @@ class requistion_model extends CI_Model
function GetAvailableBudgetAmount($CostCode,$Year,$BudgetType)
{
$this->db->select('BudgetAmount');
$this->db->from('T_CostCenter_Budget');
$this->db->from('t_costcenter_budget');
$this->db->where('CostCenterCode',$CostCode );
$this->db->where('BudgetYear',$Year );
$this->db->where('BudgetType',$BudgetType );
@ -157,7 +157,7 @@ class requistion_model extends CI_Model
{
$subQuery ='SELECT Mat.MaterialCode,Mat.MaterialName,Mat.UOM
from T_MaterialMaster Mat where Mat.MaterialCode not in (select Req.MaterialCode from T_Requestion_Details Req
join T_Requestion_Master mast on Req.ReqNo = mast.ReqNo where mast.ReqNo=? and mast.ReqType=?
join t_requestion_master mast on Req.ReqNo = mast.ReqNo where mast.ReqNo=? and mast.ReqType=?
) and Mat.MaterialType=?';
$query = $this->db->query($subQuery, array($ReqNo,$ReqType,$ReqType));
@ -230,7 +230,7 @@ class requistion_model extends CI_Model
function getAllEmployees()
{
$this->db->select('EmpID,FirstName,LastName');
$this->db->from('T_Employee_Details');
$this->db->from('t_employee_details');
$query = $this->db->get();
return $query->result();
@ -243,7 +243,7 @@ class requistion_model extends CI_Model
function getEmpIdByUserID($UserID)
{
$subQuery ='SELECT EMP.EmpID,EMP.FirstName,EMP.Designation,DEPT.DEPCode,DEPT.DepartmentName
FROM T_Employee_Details EMP JOIN T_DepartmentDetails DEPT ON
FROM t_employee_details EMP JOIN t_departmentdetails DEPT ON
EMP.Departmentcode = DEPT.DEPCode
WHERE EMP.EmpID=(select EmpID from tbl_users where userId=?)';
@ -261,7 +261,7 @@ class requistion_model extends CI_Model
{
$subQuery ='SELECT Mast.CostCenterCode,Mast.CostCenterName from T_CostCenter_Master Mast
LEFT JOIN T_CostCenter_Departments COST ON COST.CostCenterCode = Mast.CostCenterCode
WHERE COST.DEPCode=(select Departmentcode from T_Employee_Details where EmpID = (select EmpID from tbl_users where userId=?))';
WHERE COST.DEPCode=(select Departmentcode from t_employee_details where EmpID = (select EmpID from tbl_users where userId=?))';
$query = $this->db->query($subQuery, array($UserID));
//print_r($this->db->last_query());
@ -275,7 +275,7 @@ class requistion_model extends CI_Model
function CheckDraftStatus($UserID)
{
$subQuery = 'select count(ReqNo) as cnt,ReqNo from T_Requestion_Master where
$subQuery = 'select count(ReqNo) as cnt,ReqNo from t_requestion_master where
Requestedby= ( select EmpID from tbl_users where userId=?) and status=?';
$query = $this->db->query($subQuery, array($UserID,REQ_DRAFT));
@ -290,10 +290,10 @@ class requistion_model extends CI_Model
{
$subQuery = 'select distinct ReqNo,ReqType,Status,Requestedby,DATE_FORMAT(mast.CreatedDate, "%d-%m-%Y") as CreatedDate,Schedule_Type,NumberOfService,Service_Period ,emp.FirstName,emp.EmpID,emp.Designation, Dept.DEPCode,Dept.DepartmentName,DATE_FORMAT(mast.ReqDate, "%d-%m-%Y") as ReqDate,mast.CostCenterCode,Cost.CostCenterName
from T_Requestion_Master mast
from t_requestion_master mast
left join T_CostCenter_Master Cost on Cost.CostCenterCode = mast.CostCenterCode
join T_Employee_Details emp on mast.Requestedby = emp.EmpID
join T_DepartmentDetails Dept on emp.Departmentcode = Dept.DEPCode
join t_employee_details emp on mast.Requestedby = emp.EmpID
join t_departmentdetails Dept on emp.Departmentcode = Dept.DEPCode
where ReqNo=?';
@ -315,8 +315,8 @@ class requistion_model extends CI_Model
function getRequistListUserID($UserID)
{
$subQuery = 'select ReqNo, ReqType ,Status,CreatedDate ,StatusName from T_Requestion_Master mast
join T_Status st on st.StatusCode= mast.Status where
$subQuery = 'select ReqNo, ReqType ,Status,CreatedDate ,StatusName from t_requestion_master mast
join t_status st on st.StatusCode= mast.Status where
Requestedby = ( select EmpID from tbl_users where userId=?) and Status != ? ';
$query = $this->db->query($subQuery, array($UserID,REQ_DELETED));
@ -332,8 +332,8 @@ class requistion_model extends CI_Model
/* $subQuery = 'select distinct Req.ReqNo, Mat.MaterialCode,Mat.MaterialName,Mat.UOM, Req.Quantity,sum(Po.Quantity) as POQTY,sta.StatusName from T_MaterialMaster Mat
left join T_Requestion_Details Req on Req.MaterialCode = Mat.MaterialCode
left join T_PurchaseOrder_LineItem Po on Po.ReqNo = Req.ReqNo and Po.MaterialCode = Req.MaterialCode
left join T_Status sta on sta.StatusCode = Req.Status where Req.ReqNo=? group by Po.ReqNo,Req.MaterialCode';
left join t_purchaseorder_lineitem Po on Po.ReqNo = Req.ReqNo and Po.MaterialCode = Req.MaterialCode
left join t_status sta on sta.StatusCode = Req.Status where Req.ReqNo=? group by Po.ReqNo,Req.MaterialCode';
$query = $this->db->query($subQuery, array($ReqID)); */
@ -360,13 +360,13 @@ class requistion_model extends CI_Model
// function addRequistion($Requistion)
// {
// $this->db->trans_start();
// $this->db->insert('T_Requestion_Master', $Requistion);
// $this->db->insert('t_requestion_master', $Requistion);
// $insert_id = $this->db->affected_rows();
// $this->db->trans_complete();
// if($insert_id>0)
// {
// $subQuery = 'select max(ReqNo) as ReqNo from T_Requestion_Master';
// $subQuery = 'select max(ReqNo) as ReqNo from t_requestion_master';
// $query = $this->db->query($subQuery);
@ -375,14 +375,14 @@ class requistion_model extends CI_Model
function addRequistion($Requistion){
$this->db->trans_start();
$result = $this->db->insert('T_Requestion_Master', $Requistion);
$result = $this->db->insert('t_requestion_master', $Requistion);
$insert_id = $this->db->insert_id();
$affected_rows = $this->db->affected_rows();
$this->db->trans_complete();
try {
$result = ($result) ? $result : false;
if ($result && $affected_rows > 0) {
$subQuery = 'select ReqNo from T_Requestion_Master order by CreatedDate desc limit 1';
$subQuery = 'select ReqNo from t_requestion_master order by CreatedDate desc limit 1';
$query = $this->db->query($subQuery);
log_message('error','add new Requisition insert_id '.$insert_id);
return $query->result_array();
@ -402,7 +402,7 @@ class requistion_model extends CI_Model
function RequistionIsExists($ReqBy)
{
$this->db->select('ReqNo');
$this->db->from('T_Requestion_Master');
$this->db->from('t_requestion_master');
$this->db->where('Status ',REQ_DRAFT );
$this->db->where('Requestedby ',$ReqBy );
$query = $this->db->get();
@ -501,7 +501,7 @@ class requistion_model extends CI_Model
function UpdateRequistion($Requistion, $ReqNo)
{
$this->db->where('ReqNo', $ReqNo);
$this->db->update('T_Requestion_Master', $Requistion);
$this->db->update('t_requestion_master', $Requistion);
return TRUE;
}
@ -517,11 +517,11 @@ class requistion_model extends CI_Model
// echo 'UserId: '.$UserID . 'From: '.$FromDate .'TO: '. $ToDate. 'Status: '. $Status;
$subQuery = 'select distinct ReqNo,Status,mast.CreatedDate,Requestedby,emp.FirstName,mast.Comments,st.StatusName
from T_Requestion_Master mast join T_Employee_Details emp on mast.Requestedby = emp.EmpID
join T_DepartmentDetails Dept on emp.Departmentcode = Dept.DEPCode
join T_Status st on st.StatusCode = mast.Status
where status not in(?,?,?) and emp.Departmentcode in (select DEPCode from T_DepartmentDetails where HeadDept=
(select HeadDept from T_DepartmentDetails where DEPCode = (select Departmentcode from T_Employee_Details where
from t_requestion_master mast join t_employee_details emp on mast.Requestedby = emp.EmpID
join t_departmentdetails Dept on emp.Departmentcode = Dept.DEPCode
join t_status st on st.StatusCode = mast.Status
where status not in(?,?,?) and emp.Departmentcode in (select DEPCode from t_departmentdetails where HeadDept=
(select HeadDept from t_departmentdetails where DEPCode = (select Departmentcode from t_employee_details where
EmpID=(select EmpID from tbl_users where userId=?))))';
$subQuery1 = $subQuery;
$order_by = ' order by mast.CreatedDate desc';

View File

@ -9,8 +9,8 @@ class storerequistion_model extends CI_Model
$this->db->select ('ED.FirstName,CM.CostCenterCode,CM.CostCenterName,CB.BudgetAmount,CB.BudgetType');
$this->db-> from(' T_CostCenter_Master CM');
$this->db->join ('T_CostCenter_Departments CD ',' CD.CostCenterCode = CM.CostCenterCode');
$this->db->join ('T_CostCenter_Budget CB ',' CB.CostCenterCode = CM.CostCenterCode');
$this->db->join ('T_Employee_Details ED ','ED.Departmentcode = CD.DEPCode');
$this->db->join ('t_costcenter_budget CB ',' CB.CostCenterCode = CM.CostCenterCode');
$this->db->join ('t_employee_details ED ','ED.Departmentcode = CD.DEPCode');
$this->db->join ('tbl_users TU ',' TU.EmpID = ED.EmpID ');
$this->db->where('TU.userId ',$userId);
//$this->db->where('CB.BudgetType','SERVICE');
@ -75,9 +75,9 @@ class storerequistion_model extends CI_Model
$this->db->select('Sm.StoreReqNo, Emp.FirstName as Requestedby,Sm.ReqDate,Sm.Status,Sm.Comments as Remarks,St.StatusName,Dept.DepartmentName ');
$this->db->from ('T_Store_Requestion_Master Sm');
$this->db->join('tbl_users user','Sm.CreatedBy = user.userId ');
$this->db->join('T_Employee_Details Emp','Emp.EmpID= user.EmpID');
$this->db->join('T_DepartmentDetails Dept','Dept.DEPCode = Sm.DepartmentCode');
$this->db->join('T_Status St','St.StatusCode = Sm.Status');
$this->db->join('t_employee_details Emp','Emp.EmpID= user.EmpID');
$this->db->join('t_departmentdetails Dept','Dept.DEPCode = Sm.DepartmentCode');
$this->db->join('t_status St','St.StatusCode = Sm.Status');
$this->db->where('Sm.Status ',STORE_APPROVAL);
$this->db->or_where('Sm.Status ',STORE_PARTIALLYISSUSED);
@ -240,7 +240,7 @@ class storerequistion_model extends CI_Model
function getStatus()
{
$this->db->select('StatusCode,StatusName ');
$this->db->from('T_Status');
$this->db->from('t_status');
$this->db->where('Remarks', 'STORE REQUISTION STATUS');
//$this->db->where('StatusCode!=', REQ_DRAFT);
$query = $this->db->get();
@ -308,12 +308,12 @@ class storerequistion_model extends CI_Model
$subQuery = ' select distinct Str.StoreReqNo,Str.Requestedby,Str.ReqDate,Str.Status,Str.CreatedDate,Str.Comments,St.StatusName,Emp1.FirstName
from T_Store_Requestion_Master Str
join T_Status St on St.StatusCode = Str.Status
join T_Employee_Details Emp on Emp.Departmentcode =Str.DepartmentCode
join T_Employee_Details Emp1 on Emp1.EmpID =Str.Requestedby
join T_DepartmentDetails Dept on Dept.DEPCode = Emp.Departmentcode
where Str.Status not in(?,?,?) and Emp.Departmentcode in (select DEPCode from T_DepartmentDetails where HeadDept=
(select HeadDept from T_DepartmentDetails where DEPCode = (select Departmentcode from T_Employee_Details where
join t_status St on St.StatusCode = Str.Status
join t_employee_details Emp on Emp.Departmentcode =Str.DepartmentCode
join t_employee_details Emp1 on Emp1.EmpID =Str.Requestedby
join t_departmentdetails Dept on Dept.DEPCode = Emp.Departmentcode
where Str.Status not in(?,?,?) and Emp.Departmentcode in (select DEPCode from t_departmentdetails where HeadDept=
(select HeadDept from t_departmentdetails where DEPCode = (select Departmentcode from t_employee_details where
EmpID=(select EmpID from tbl_users where userId=?))))';
$query ='';
@ -333,9 +333,9 @@ class storerequistion_model extends CI_Model
{
$subQuery = ' select Str.StoreReqNo,Str.Requestedby,Str.ReqDate,Dept.DEPCode,Dept.DepartmentName,Cm.CostCenterCode,Cm.CostCenterName,Emp.FirstName from T_Store_Requestion_Master Str
join T_DepartmentDetails Dept on Dept.DEPCode = Str.DepartmentCode
join t_departmentdetails Dept on Dept.DEPCode = Str.DepartmentCode
join T_CostCenter_Master Cm on Cm.CostCenterCode =Str.CostCenterCode
join T_Employee_Details Emp on Emp.EmpID =Str.Requestedby
join t_employee_details Emp on Emp.EmpID =Str.Requestedby
where StoreReqNo =? ';
@ -368,7 +368,7 @@ $this->db->select('StoreReqNo,Sr.CostCenterCode,Cc.CostCenterName
$subQuery = ' select Str.StoreReqNo,Str.MaterialCode,Str.QuantityRequired,Str.Remarks,Mat.MaterialName,Mat.UOM,Ss.StatusName,Str.Status,Str.QuantityIssued
from T_Store_Requestion_Details Str
join T_MaterialMaster Mat on Mat.MaterialCode = Str.MaterialCode
join T_Status Ss on Ss.StatusCode = Str.Status
join t_status Ss on Ss.StatusCode = Str.Status
where Str.StoreReqNo =?';
@ -395,7 +395,7 @@ $this->db->select('StoreReqNo,Sr.CostCenterCode,Cc.CostCenterName
$subQuery = ' select Str.StoreReqNo,Str.MaterialCode,Str.QuantityRequired,Str.QuantityIssued,Str.Remarks,Str.StoreComments,Mat.MaterialName,Mat.UOM,Ss.StatusName,St.Status,St.Quantity
from T_Store_Requestion_Details Str
join T_MaterialMaster Mat on Mat.MaterialCode = Str.MaterialCode
join T_Status Ss on Ss.StatusCode = Str.Status
join t_status Ss on Ss.StatusCode = Str.Status
left join T_Store_Stockdetails St on St.MaterialCode=Str.MaterialCode
where Str.StoreReqNo =?';

View File

@ -181,7 +181,7 @@ function addNewsupplier($supplier)
det.Cert_EMS,det.Cert_TS,det.Cert_OSHAS,det.Cert_ISO,det.Cert_IMS,det.BankAcNumber,det.IFSCCode,det.BranchName,det.BankAddress,
det.IsService,det.IsMaintanance,det.IsRawMaterial');
$this->db->join('tbl_users as tbl',' det.createdby = tbl.userid','left');
$this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid','left');
$this->db->join('t_employee_details as emp', 'emp.empid=tbl.empid','left');
$this->db->join('tbl_users as tbl1',' det.UpdatedBy = tbl1.userid','left');
$this->db->join('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid','left');
$this->db->join('T_PaymentTerms as pmt', 'pmt.PaymentID = det.PaymentID','left');

View File

@ -15,8 +15,8 @@ class User_model extends CI_Model
{
$this->db->select('EMP.EmpID,EMP.FirstName,EMP.LastName,EMP.Designation,EMP.EmailId,EMP.ContactNumber,
DEPT.DEPCode,DEPT.DepartmentName,role.role,user.userId');
$this->db->from('T_Employee_Details EMP');
$this->db->join('T_DepartmentDetails DEPT', 'EMP.Departmentcode = DEPT.DEPCode');
$this->db->from('t_employee_details EMP');
$this->db->join('t_departmentdetails DEPT', 'EMP.Departmentcode = DEPT.DEPCode');
$this->db->join('tbl_users user', 'user.EmpID = EMP.EmpID');
$this->db->join('tbl_roles role', 'user.roleId = role.roleId');
@ -184,7 +184,7 @@ class User_model extends CI_Model
{
//echo $UserId;
$subQuery = 'select EMP.EmpID,EMP.FirstName,EMP.LastName,EMP.Designation,EMP.EmailId,EMP.ContactNumber,DEPT.DEPCode,DEPT.DepartmentName from
T_Employee_Details EMP join T_DepartmentDetails DEPT on
t_employee_details EMP join t_departmentdetails DEPT on
EMP.Departmentcode = DEPT.DEPCode where EMP.EmpID= (select EmpID from tbl_users where userId=?)';
$query = $this->db->query($subQuery, array($UserId));
@ -200,13 +200,13 @@ class User_model extends CI_Model
function getAllEmployees()
{
/*$this->db->select('EmpID,FirstName,LastName');
$this->db->from('T_Employee_Details');
$this->db->from('t_employee_details');
$query = $this->db->get();
return $query->result(); */
$this->db->select('EMP.EmpID,EMP.FirstName,EMP.LastName,EMP.Designation,EMP.EmailId,EMP.ContactNumber,DEPT.DEPCode,DEPT.DepartmentName');
$this->db->from('T_Employee_Details EMP');
$this->db->join('T_DepartmentDetails DEPT', 'EMP.Departmentcode = DEPT.DEPCode');
$this->db->from('t_employee_details EMP');
$this->db->join('t_departmentdetails DEPT', 'EMP.Departmentcode = DEPT.DEPCode');
$this->db->where('EMP.IsActive ',1 );
$query = $this->db->get();
return $query->result();
@ -298,12 +298,12 @@ GROUP BY financial_year ";
// $this->db->where('id', $id);
// return $this->db->delete('employee');
$this->db->where('Menu_ID',$favourite['Menu_ID']);
$this->db->delete('T_fav_add');
$this->db->delete('t_fav_add');
}else{
//echo "else";
$this->db->insert('T_fav_add',$favourite);
$this->db->insert('t_fav_add',$favourite);
$r = $this->db->affected_rows();
return $r;
}

View File

@ -0,0 +1,78 @@
<?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)
{
// echo 'model';
// print_r($action);
// echo '<br>';
$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);
}
}

View File

@ -22,10 +22,12 @@
<!--<center><h3 class="box-title">-->
<div class="box-tools">
<!-- <form action="<?php echo base_url() ?>assetListing" method="POST" id="searchList">-->
<div class="col-md-3">
<a href=" <?php echo base_url().'quality/report';?> " type="button" class="btn btn-primary">Add New</a>
</div>
<div class="col-md-3">
<a href=" <?php echo base_url().'quality/report';?> " type="button" class="btn btn-primary">Add New</a>
</div>
<div class="col-md-3 col-md-offset-1" style="margin-bottom:2px">
<a href=" javascript:void(0)" type="button" class="btn btn-primary" onclick="synczohobooks()">Sync With Zoho Books</a>
</div>
</form>
</div><!--</h3></center>-->
@ -119,4 +121,37 @@
</script>
<!-- <script src="https://cdn.datatables.net/plug-ins/1.10.11/sorting/date-eu.js"></script> -->
<script type="text/javascript">
function synczohobooks(){
var sync = true
$('#loader_wrapper').css("display", "block");
$.ajax({
// $('#loadingDiv').show();
url:"<?php echo base_url() ?>login/zohobooks_api_fetch_all",
type:"post",
data:{sync},
success:function(data){
console.log(data);
alert("Sync Completed");
// alert(data.invoice);
},
complete: function(){
$('#loader_wrapper').css("display", "none");
}
});
}
</script>