EVOLUTION-NINJA
Edit File: Marketing_model.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Marketing_model extends CI_Model { public function __construct() { parent::__construct(); } //insert yarn quality here public function customer_insert($customer_data) { $customerinsert = $this->db->insert('customer_master', $customer_data); if ($customerinsert) { return true; } else { return false; } } public function input_preview_input_suborder($subOrderID) { $this->db->select('sub_order_shades.unitPrice,sub_orders.product_id,sub_orders.subCode,sub_orders.width,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_order_shades.ourShade,sub_order_shades.buyerShade,sub_order_shades.skuNo,sub_orders.subOrderType,sub_orders.description,sub_orders.totalQuantity,sub_orders.deliveryMode,sub_order_shades.quantity,sub_orders.unit,sub_order_shades.foreignValue'); $this->db->order_by('sub_orders.subCode','asc'); $this->db->from('sub_orders'); $this->db->where('sub_orders.orderId', $subOrderID); $this->db->where('status',0); // $this->db->where('sub_order_shades.add_suborder',1); $this->db->join('sub_order_shades', 'sub_orders.id = sub_order_shades.subOrderId'); $query = $this->db->get(); return $query->result(); } public function fetch_where_ordered_data($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $this->db->order_by('box_id','asc'); $query = $this->db->get(); return $query->result(); } public function fetch_where_ordered_datawith_netwt($invoice) { $this->db->select("madeups_box_packing.*,madeups_packing.exp_wt"); $this->db->from('madeups_box_packing'); $this->db->join('madeups_packing', 'madeups_packing.box_id = madeups_box_packing.box_id'); $this->db->where('madeups_box_packing.invoice',$invoice); $this->db->where('madeups_packing.invoice',$invoice); $this->db->where('madeups_box_packing.status',0); $this->db->order_by('madeups_box_packing.box_id','asc'); $query = $this->db->get(); return $query->result(); } public function fetch_where_ordered_datawith_netwt_new($invoice) { $this->db->select("madeups_box_packing_new.*,madeups_packing_new.exp_wt"); $this->db->from('madeups_box_packing_new'); $this->db->join('madeups_packing_new', 'madeups_packing_new.box_id = madeups_box_packing_new.box_id'); $this->db->where('madeups_box_packing_new.invoice',$invoice); $this->db->where('madeups_packing_new.invoice',$invoice); $this->db->where('madeups_box_packing_new.status',0); $this->db->order_by('madeups_box_packing_new.box_id','asc'); $query = $this->db->get(); return $query->result(); } public function fetch_desc_where_invoice_data($table,$where) { $this->db->select("*"); $this->db->order_by('id','DESC'); $this->db->group_by("invoice,financ_year"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function fetch_desc_where_invoice_data_madeups($table,$where) { $this->db->select("madeups_list_data.*,madeups_invoice_packing.currency as cur,madeups_invoice_packing.contarct_type,sum(madeups_invoice_packing.stock_qty) as sum_qty,customer_master.customerID"); $this->db->order_by('id','DESC'); $this->db->group_by("invoice,financ_year"); $this->db->from('madeups_list_data'); $this->db->join('madeups_invoice_packing', 'madeups_invoice_packing.pack_id = madeups_list_data.id','left'); $this->db->join('customer_master', 'customer_master.customerName = madeups_list_data.customer_name','left'); $this->db->where('madeups_list_data.status','0'); $query = $this->db->get(); return $query->result(); } public function fetch_desc_where_invoice_data_new($table,$where) { $this->db->select("packing_list_data.*,invoice_packing.contarct_type,sum(invoice_packing.stock_wt) as sum_qty"); $this->db->order_by('id','DESC'); $this->db->group_by("invoice,financ_year"); $this->db->from('packing_list_data'); $this->db->join('invoice_packing', 'invoice_packing.pack_id = packing_list_data.id','left'); $this->db->where('packing_list_data.status','0'); $query = $this->db->get(); return $query->result(); } public function fetch_desc_where_invoice_madeups_history() { $this->db->select("madeups_invoice_packing.*,madeups_list_data.sys_date,orders.fileNo as customerID,madeups_list_data.customer_name,madeups_list_data.units,orders.orderNo"); $this->db->order_by('id','DESC'); $this->db->from('madeups_invoice_packing'); $this->db->join('madeups_list_data', 'madeups_list_data.id = madeups_invoice_packing.pack_id'); // $this->db->join('madeups_packing', 'madeups_packing.madeups_id = madeups_invoice_packing.pack_id','right'); $this->db->join('orders', 'orders.oslNo = madeups_invoice_packing.osl_no','left'); $this->db->where('madeups_list_data.status',0); $this->db->order_by('id','DESC'); $query = $this->db->get(); return $query->result(); } public function recent_fetch_desc_where_invoice_madeups_history($fileNo,$orderType,$order_id) { $this->db->select("madeups_invoice_packing.*,madeups_list_data.sys_date,orders.fileNo as customerID,madeups_list_data.customer_name,madeups_list_data.units,orders.orderNo"); $this->db->order_by('id','DESC'); $this->db->from('madeups_invoice_packing'); $this->db->join('madeups_list_data', 'madeups_list_data.id = madeups_invoice_packing.pack_id'); // $this->db->join('madeups_packing', 'madeups_packing.madeups_id = madeups_invoice_packing.pack_id','right'); $this->db->join('orders', 'orders.oslNo = madeups_invoice_packing.osl_no','left'); $this->db->where('madeups_list_data.status',0); $this->db->where('madeups_list_data.type',$orderType); $this->db->where('orders.fileNo',$fileNo); $this->db->order_by('id','DESC'); $query = $this->db->get(); //print_r($this->db->last_query()); // die(); return $query->result(); } public function dtl_madeups_history($fileNo,$orderType,$order_id,$po) { $this->db->select("madeups_invoice_packing.*,madeups_list_data.sys_date,orders.fileNo as customerID,madeups_list_data.customer_name,madeups_list_data.units,orders.orderNo"); $this->db->order_by('id','DESC'); $this->db->from('madeups_invoice_packing'); $this->db->join('madeups_list_data', 'madeups_list_data.id = madeups_invoice_packing.pack_id'); // $this->db->join('madeups_packing', 'madeups_packing.madeups_id = madeups_invoice_packing.pack_id','right'); $this->db->join('orders', 'orders.oslNo = madeups_invoice_packing.osl_no','left'); $this->db->where('madeups_list_data.status',0); $this->db->where('madeups_list_data.type',$orderType); $this->db->where('madeups_invoice_packing.osl_no',$po); $this->db->where('orders.fileNo',$fileNo); $this->db->order_by('id','DESC'); $query = $this->db->get(); // print_r($this->db->last_query()); // die(); return $query->result(); } public function fetch_desc_where_invoice_data_history() { $this->db->select("invoice_packing.*,packing_list_data.sys_date,orders.fileNo as customerID,packing_list_data.customer_name,packing_list_data.units,packing_list_data.osl_no,orders.orderNo"); //$this->db->select("invoice_packing.*,packing_list_data.sys_date.customerID,packing_list_data.sys_date.customer_name,packing_list_data.sys_date.units"); $this->db->order_by('id','DESC'); //$this->db->group_by("invoice,financ_year"); $this->db->from('invoice_packing'); // $this->db->limit(1500); // $this->db->join('invoice_packing', 'invoice_packing.invoice= packing_list_data.invoice'); $this->db->join('packing_list_data', 'packing_list_data.id= invoice_packing.pack_id'); $this->db->join('orders', 'orders.oslNo = invoice_packing.po_no','left'); $this->db->where('packing_list_data.status',0); //$this->db->group_by("invoice_packing.invoice,invoice_packing.financ_year"); //$this->db->group_by("invoice_packing.invoice"); $this->db->order_by('id','DESC'); $query = $this->db->get(); return $query->result(); } public function recent_shipping_grid_data($fileNo,$orderType,$order_id) { $this->db->select("invoice_packing.*,packing_list_data.sys_date,orders.fileNo as customerID,packing_list_data.customer_name,packing_list_data.units,packing_list_data.osl_no,orders.orderNo"); //$this->db->select("invoice_packing.*,packing_list_data.sys_date.customerID,packing_list_data.sys_date.customer_name,packing_list_data.sys_date.units"); $this->db->order_by('id','DESC'); $this->db->from('invoice_packing'); // $this->db->join('invoice_packing', 'invoice_packing.invoice= packing_list_data.invoice'); $this->db->join('packing_list_data', 'packing_list_data.id= invoice_packing.pack_id'); $this->db->join('orders', 'orders.oslNo = invoice_packing.po_no'); $this->db->where('packing_list_data.status',0); $this->db->where('invoice_packing.status',0); $this->db->where('packing_list_data.type',$orderType); $this->db->where('orders.fileNo',$fileNo); $this->db->order_by('id','DESC'); //$this->db->where('packing_list_data.customer_name',$fileNo); //$this->db->where('packing_list_data.customerID',$fileNo); $query = $this->db->get(); // print_r($this->db->last_query()); // die(); return $query->result(); } public function dtl_shipping_grid_data($fileNo,$orderType,$order_id,$po) { $this->db->select("invoice_packing.*,packing_list_data.sys_date,orders.fileNo as customerID,packing_list_data.customer_name,packing_list_data.units,packing_list_data.osl_no,orders.orderNo"); //$this->db->select("invoice_packing.*,packing_list_data.sys_date.customerID,packing_list_data.sys_date.customer_name,packing_list_data.sys_date.units"); // $this->db->order_by('id','DESC'); $this->db->from('invoice_packing'); // $this->db->join('invoice_packing', 'invoice_packing.invoice= packing_list_data.invoice'); $this->db->join('packing_list_data', 'packing_list_data.id= invoice_packing.pack_id'); $this->db->join('orders', 'orders.oslNo = invoice_packing.po_no'); $this->db->where('packing_list_data.status',0); $this->db->where('invoice_packing.status',0); $this->db->where('packing_list_data.type',$orderType); $this->db->where('invoice_packing.po_no',$po); $this->db->where('orders.fileNo',$fileNo); $this->db->order_by('id','DESC'); //$this->db->where('packing_list_data.customer_name',$fileNo); //$this->db->where('packing_list_data.customerID',$fileNo); $query = $this->db->get(); return $query->result(); // print_r($query->result()); // die(); } public function custum_fetch_where_group_data($table) { $this->db->select("*"); $this->db->group_by("customerName"); $this->db->from($table); // $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function customer_update($customer_up,$idd) { $this->db->where('id', $idd); $customerinsert = $this->db->update('customer_master', $customer_up); if ($customerinsert) { return true; } else { return false; } } public function product_insert($product_data) { $productinsert = $this->db->insert('product_master', $product_data); if ($productinsert) { return true; } else { return false; } } public function add_usermanage($article_data) { $article_data = array('fName' => $this->input->post('firstname'), 'lName' => $this->input->post('lastname'), 'username' => $this->input->post('username'), 'email' => $this->input->post('emailid'), 'password' => $this->input->post('password'), 'role' => $this->input->post('role') ); $query1= $this->db->insert('user_management', $article_data); if($query1) { return true; } else { return false; } } public function fetch_main_data_customer($table,$where) { $this->db->select("packing_list_data.*,customer_master.customerName"); $this->db->group_by("packing_list_data.invoice"); $this->db->from('packing_list_data'); $this->db->join('customer_master','customer_master.customerID = packing_list_data.customer_name'); $this->db->where('packing_list_data.status',0); $query = $this->db->get(); return $query->result(); } public function update_data_p($table,$data) { $this->db->where('exp_qty >',0); $this->db->update($table,$data); } public function update_data_q($table,$data) { $this->db->where('exp_wt >',0); $this->db->update($table,$data); } public function update_data_w($table,$data) { $this->db->where('pklist_id >',0); $this->db->update($table,$data); } public function shade_ides($id) { $this->db->select('*'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.id'); $this->db->join('planned_order', 'planned_order.subNo= sub_order_shades.shadeID'); //$this->db->join('shade_master', 'shade_master.shadeID= planned_order.sslShade'); $this->db->where('sub_order_shades.shadeID',$id); $query=$this->db->get(); return $query->row(); } public function fetch_po_nooo($table,$where,$title) { $this->db->select('po_no'); $this->db->group_by('po_no'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->like('fabric_inspection_details.po_no',$title); $this->db->where('fabric_inspection_details.status','0'); $this->db->where('fabric_inspection.balanced_mtrs !=','0.00'); $query = $this->db->get(); return $query->result(); } public function fetch_po_nooo_selected($table,$where,$title) { $this->db->select('po_no'); $this->db->group_by('po_no'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->like('fabric_inspection_details.po_no',$title); $this->db->where('fabric_inspection_details.selected_po','1'); $this->db->where('fabric_inspection_details.status','0'); $this->db->where('fabric_inspection.balanced_mtrs !=','0.00'); $query = $this->db->get(); return $query->result(); } public function fetch_where_osl_po_data($table) { $this->db->select("*"); $this->db->group_by('osl_no'); $this->db->from($table); // $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function indent_planning_join($w) { $this->db->select('indent_po.po_no,orders.oslNo'); $this->db->from('indent_po'); $this->db->join('indent_add_indent', 'indent_po.indent_id= indent_add_indent.id'); $this->db->join('sub_order_shades', 'sub_order_shades.shadeID= indent_add_indent.purpose_shadeid'); $this->db->join('sub_orders', 'sub_order_shades.subOrderID = sub_orders.id'); $this->db->join('orders', 'sub_orders.orderID = orders.id'); $this->db->where('indent_po.po_no',$w); $query=$this->db->get(); return $query->row(); } public function OSL_NUMBER_getorder() { $this->db->order_by('id', "desc"); $this->db->where('status',0); $this->db->where('orderType','DTL'); $query = $this->db->get('orders'); return $query->result(); } public function fetch_where_invoice_data($table,$where) { $this->db->select("*"); $this->db->group_by("invoice"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function outsource_osl() { $this->db->select('*'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.id'); $this->db->where('sub_order_shades.planningStatus','planned'); $this->db->where('sub_orders.article_type','outsource'); $query=$this->db->get(); return $query->result(); } public function get_outsource_osl_details($orderID) { $this->db->select('*'); $this->db->from('sub_order_shades sos'); $this->db->join('sub_orders so', 'sos.subOrderID = so.id'); // $this->db->join('article_master am', 'so.articleNo = am.articleNo'); $this->db->join('orders o', 'so.orderID = o.id'); $this->db->where('o.id', $orderID); $this->db->where('so.article_type', 'outsource'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->result_array(); } public function get_usermanage_editdata($id) { $this -> db -> select('*'); $this -> db -> from('user_management'); $this -> db -> where('id', $id); $query = $this -> db -> get(); return $query->row(); } public function get_sub_planned_orders($orderID) { $this->db->from('sub_order_shades'); $this->db->where('subOrderID', $orderID); $query = $this->db->get(); return $query->row(); } public function displayProductType($fabricType) { $query = $this->db->query('SELECT type FROM product_master where fabricType="' . $fabricType . '"'); $r=$query->row(); echo $type=$r->type;exit; //echo'<pre>';print_r($query->row());exit; //$query = $this->db->query('SELECT * FROM shade_master where shadeType="' . $shadeType . '" and articleID="' . $articleID . '"'); //return $query->result(); } public function user_management_update($supplier_data,$id) { $supplier_data = array('fName' => $this->input->post('firstname'), 'lName' => $this->input->post('lastname'), 'username' => $this->input->post('username'), 'email' => $this->input->post('emailid'), 'password' => $this->input->post('password'), 'role' => $this->input->post('role') ); $query1=$this->db->where('id', $id); $query1=$this->db->update('user_management', $supplier_data); if($query1) { return true; } else { return false; } } public function delete_users($id) { $query1=$this->db->where('id', $id); $query1=$this->db->delete('user_management'); if($query1) { return true; } else { return false; } } public function checkclient($chickclient) { $this -> db -> select('username'); $this -> db -> from('user_management'); $this -> db -> where('username', $chickclient); $this -> db -> limit(1); $query = $this -> db -> get(); if($query -> num_rows() == 1) { return $query->result(); } else { return false; } } public function display_user_managment() { $query=$this->db->get('user_management'); return $query->result(); } public function checkemail($chickemail) { $this -> db -> select('email'); $this -> db -> from('user_management'); $this -> db -> where('email', $chickemail); $this -> db -> limit(1); $query = $this -> db -> get(); if($query -> num_rows() == 1) { return $query->result(); } else { return false; } } public function article_insert($article_data) { $articleinsert = $this->db->insert('article_master', $article_data); $lastinsertid = $this->db->insert_id(); //insert warp data start for ($i = 0; $i < count($this->input->post('warpquality')); $i++) { if ($this->input->post('warpquality')[$i] != "" && $this->input->post('warpdenier')[$i] != "" && $this->input->post('warpspecification')[$i] != "" && $this->input->post('warpfinaldenier')[$i] != "" && $this->input->post('noofends')[$i] != "" && $this->input->post('korawt')[$i] != "" && $this->input->post('hanks')[$i] != "" && $this->input->post('dyedwtwarp')[$i] != "" && $this->input->post('percentagewarp')[$i] != "") { $warp_data = array( 'article_id' => $lastinsertid, 'Warp_Quality' => $this->input->post('warpquality')[$i], 'Warp_Denier' => $this->input->post('warpdenier')[$i], 'Warp_Specification' => $this->input->post('warpspecification')[$i], 'Warp_Final_Denier' => $this->input->post('warpfinaldenier')[$i], 'No_of_Ends' => $this->input->post('noofends')[$i], 'Kora_Wt' => $this->input->post('korawt')[$i], 'Hanks' => $this->input->post('hanks')[$i], 'Dyed_Wt' => $this->input->post('dyedwtwarp')[$i], 'percentage' => $this->input->post('percentagewarp')[$i], 'composition' => $this->input->post('warpcomposition')[$i], ); $this->db->insert('warp_data', $warp_data); } } //insert warp data end //insert weft data start for ($j = 0; $j < count($this->input->post('weftquality')); $j++) { if ($this->input->post('weftquality')[$j] != "" && $this->input->post('weftdenier')[$j] != "" && $this->input->post('weftspecification')[$j] != "" && $this->input->post('weftfinaldenier')[$j] != "" && $this->input->post('ppc')[$j] != "" && $this->input->post('korawtweft')[$j] != "" && $this->input->post('wefthanks')[$j] != "" && $this->input->post('weftdyedwt')[$j] != "" && $this->input->post('weftpercentage')[$j] != "") { $weft_data = array( 'article_id' => $lastinsertid, 'Weft_Quality' => $this->input->post('weftquality')[$j], 'Weft_Denier' => $this->input->post('weftdenier')[$j], 'Weft_Specification' => $this->input->post('weftspecification')[$j], 'Weft_Final_Denier' => $this->input->post('weftfinaldenier')[$j], 'PPC' => $this->input->post('ppc')[$j], 'Kora_Wt' => $this->input->post('korawtweft')[$j], 'Hanks' => $this->input->post('wefthanks')[$j], 'Dyed_Wt' => $this->input->post('weftdyedwt')[$j], 'percentage' => $this->input->post('weftpercentage')[$j], 'composition' => $this->input->post('weftcomposition')[$j], ); $this->db->insert('weft_data', $weft_data); } } //insert weft data end if ($articleinsert) { return true; } else { return false; } } public function article_edit($article_data,$id) { $update=$this->db->update('article_master', $article_data, array('articleID' => $id)); $deleteold=$this->db->delete('warp_data', array('article_id' => $id)); $deleteold1=$this->db->delete('weft_data', array('article_id' => $id)); if($deleteold) { //insert warp data start for ($i = 0; $i < count($this->input->post('warpquality')); $i++) { if ($this->input->post('warpquality')[$i] != "" && $this->input->post('warpdenier')[$i] != "" && $this->input->post('warpspecification')[$i] != "" && $this->input->post('warpfinaldenier')[$i] != "" && $this->input->post('noofends')[$i] != "" && $this->input->post('korawt')[$i] != "" && $this->input->post('hanks')[$i] != "" && $this->input->post('dyedwtwarp')[$i] != "" && $this->input->post('percentagewarp')[$i] != "") { $warp_data = array( 'article_id' => $id, 'Warp_Quality' => $this->input->post('warpquality')[$i], 'Warp_Denier' => $this->input->post('warpdenier')[$i], 'Warp_Specification' => $this->input->post('warpspecification')[$i], 'Warp_Final_Denier' => $this->input->post('warpfinaldenier')[$i], 'No_of_Ends' => $this->input->post('noofends')[$i], 'Kora_Wt' => $this->input->post('korawt')[$i], 'Hanks' => $this->input->post('hanks')[$i], 'Dyed_Wt' => $this->input->post('dyedwtwarp')[$i], 'percentage' => $this->input->post('percentagewarp')[$i], 'composition' => $this->input->post('warpcomposition')[$i], ); $this->db->insert('warp_data', $warp_data); } } //insert warp data end } if($deleteold1) { for ($j = 0; $j < count($this->input->post('weftquality')); $j++) { if ($this->input->post('weftquality')[$j] != "" && $this->input->post('weftdenier')[$j] != "" && $this->input->post('weftspecification')[$j] != "" && $this->input->post('weftfinaldenier')[$j] != "" && $this->input->post('ppc')[$j] != "" && $this->input->post('korawtweft')[$j] != "" && $this->input->post('wefthanks')[$j] != "" && $this->input->post('weftdyedwt')[$j] != "" && $this->input->post('weftpercentage')[$j] != "") { $weft_data = array( 'article_id' => $id, 'Weft_Quality' => $this->input->post('weftquality')[$j], 'Weft_Denier' => $this->input->post('weftdenier')[$j], 'Weft_Specification' => $this->input->post('weftspecification')[$j], 'Weft_Final_Denier' => $this->input->post('weftfinaldenier')[$j], 'PPC' => $this->input->post('ppc')[$j], 'Kora_Wt' => $this->input->post('korawtweft')[$j], 'Hanks' => $this->input->post('wefthanks')[$j], 'Dyed_Wt' => $this->input->post('weftdyedwt')[$j], 'percentage' => $this->input->post('weftpercentage')[$j], 'composition' => $this->input->post('weftcomposition')[$j], ); $this->db->insert('weft_data', $weft_data); } } } if($update) { return true; } else { return false; } } public function contact_insert($contact_data) { $contactinsert = $this->db->insert('contact_person', $contact_data); if ($contactinsert) { return true; } else { return false; } } public function display_customer_data() { $this->db->order_by('customerName','asc'); $query = $this->db->get('customer_master'); return $query->result(); } public function edit_customer_data($idd) { $query = $this->db->get_where('customer_master', array('id' => $idd)); return $query->row(); } //display customer name based on the file number public function display_name($id) { $query = $this->db->get_where('customer_master', array('customerID' => $id)); return $query->result(); } public function getCustomerData($id) { $query = $this->db->get_where('customer_master', array('customerID' => $id)); return $query->row(); } public function getProductDetails($id) { $query = $this->db->get_where('product_details', array('id' => $id)); return $query->row(); } // public function getProductDetails($id) { // $this->db->where('id', $id); // $this->db->where('delete_status', 0); // Assuming 0 means not deleted // $query = $this->db->get('product_details'); // return $query->row(); // } public function getMainorderType($suborder) { $query = $this->db->get_where('product_master', array('fabricType' => $suborder)); return $query->row(); } // public function getCustomerProduct($id) { // $query = $this->db->get_where('product_details', array('customer_id' => $id)); // // $query = $this->db->get_where('delete_status', 0); // return $query->result(); // } public function getCustomerProduct($id) { $this->db->where('customer_id', $id); $this->db->where('delete_status', 0); $query = $this->db->get('product_details'); return $query->result(); } public function display_product_data() { $query = $this->db->get('product_master'); return $query->result(); } public function display_article_data() { $this->db->order_by("articleNo", "asc"); $query = $this->db->get('article_master'); return $query->result(); } public function display_user_data() { $this->db->order_by("name", "asc"); $this->db->where("status", "1"); $query = $this->db->get('employee_details'); return $query->result(); } public function display_oslnos_data() { $this->db->select('o.*,'); $this->db->from('orders o'); $this->db->where('o.status',0); $this->db->order_by("id", "desc"); $this->db->group_by('o.oslNo'); $this->db->where('o.orderType','DTL'); $query = $this->db->get(); return $query->result(); } public function fetch($where,$table){ $this->db->select("*"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function display_po_data() { $this->db->select('o.po_no'); $this->db->from('indent_po o'); $this->db->where('o.confirm','Yes'); $this->db->order_by("id", "desc"); $this->db->group_by('o.po_id'); $query = $this->db->get(); return $query->result(); } public function display_quality_data() { $this->db->group_by('quality','asc'); $query = $this->db->get('article_master'); return $query->result(); } public function display_transaction_data_old() { $query = $this->db->get('transaction_order'); return $query->result(); } public function display_transaction_data() { $this->db->order_by("id", "desc"); $query = $this->db->get('orders'); return $query->result(); } public function getsuborder($id) { $this->db->select('sub_orders.id,sub_orders.articleNo,sub_orders.unit,sub_orders.width,sub_orders.subOrderType,sub_orders.description,sub_orders.totalQuantity,sub_orders.totalValue, sub_orders.orderConfirm,sub_orders.edit,sub_orders.delete,sub_orders.confirm_by,sub_orders.created_by,sub_orders.design,sub_orders.quality,sub_orders.weave,sub_orders.shipping_status'); $this->db->from('sub_orders'); //$this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.subCode'); $this->db->where('sub_orders.orderID', $id); $this->db->where('sub_orders.status', 0); $query = $this->db->get(); //print_r($this->db->last_query()); //die(); return $query->result(); } public function getsuborder_update($id) { $this->db->select('sub_orders.orderID,sub_order_shades.shadeID as id,sub_orders.articleNo,sub_orders.unit,sub_orders.width,sub_orders.subOrderType,sub_orders.description,sub_orders.totalQuantity,sub_orders.totalValue, sub_orders.orderConfirm,sub_orders.edit,sub_orders.delete,sub_orders.confirm_by,sub_orders.created_by,sub_orders.design,sub_orders.quality,sub_orders.weave,sub_order_shades.shipping_status,sub_order_shades.quantity,sub_order_shades.unitPrice,sub_order_shades.foreignValue,sub_order_shades.shipped_by,sub_order_shades.ourShade'); $this->db->order_by('sub_orders.subCode','asc'); $this->db->from('sub_orders'); //$this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.subCode'); $this->db->join('sub_order_shades', 'sub_orders.id = sub_order_shades.subOrderId'); $this->db->where('sub_orders.orderID', $id); $this->db->where('status', 0); $query = $this->db->get(); return $query->result(); // $this->db->select('sub_orders.subCode,sub_orders.width,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_order_shades.ourShade,sub_order_shades.buyerShade,sub_order_shades.skuNo,sub_orders.subOrderType,sub_orders.description,sub_orders.totalQuantity,sub_orders.deliveryMode,sub_order_shades.quantity,sub_orders.unit,sub_order_shades.foreignValue'); // $this->db->order_by('sub_orders.subCode','asc'); // $this->db->from('sub_orders'); // $this->db->where('sub_orders.orderId', $subOrderID); // $this->db->where('status',0); // // $this->db->where('sub_order_shades.add_suborder',1); // $this->db->join('sub_order_shades', 'sub_orders.id = sub_order_shades.subOrderId'); // $query = $this->db->get(); // return $query->result(); } public function pending_getsuborder_update($id) { $ignore = array('Fully Shipped'); $this->db->select('sub_orders.orderID,sub_order_shades.shadeID as id,sub_orders.articleNo,sub_orders.unit,sub_orders.width,sub_orders.subOrderType,sub_orders.description,sub_orders.totalQuantity,sub_orders.totalValue, sub_orders.orderConfirm,sub_orders.edit,sub_orders.delete,sub_orders.confirm_by,sub_orders.created_by,sub_orders.design,sub_orders.quality,sub_orders.weave,sub_order_shades.shipping_status,sub_order_shades.quantity,sub_order_shades.unitPrice,sub_order_shades.foreignValue,sub_order_shades.shipped_by,sub_order_shades.ourShade'); $this->db->order_by('sub_orders.subCode','asc'); $this->db->from('sub_orders'); //$this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.subCode'); $this->db->join('sub_order_shades', 'sub_orders.id = sub_order_shades.subOrderId'); $this->db->where('sub_orders.orderID', $id); $this->db->where_not_in('sub_order_shades.shipping_status', $ignore); $this->db->where('status', 0); $query = $this->db->get(); //print_r($this->db->last_query()); return $query->result(); // $this->db->select('sub_orders.subCode,sub_orders.width,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_order_shades.ourShade,sub_order_shades.buyerShade,sub_order_shades.skuNo,sub_orders.subOrderType,sub_orders.description,sub_orders.totalQuantity,sub_orders.deliveryMode,sub_order_shades.quantity,sub_orders.unit,sub_order_shades.foreignValue'); // $this->db->order_by('sub_orders.subCode','asc'); // $this->db->from('sub_orders'); // $this->db->where('sub_orders.orderId', $subOrderID); // $this->db->where('status',0); // // $this->db->where('sub_order_shades.add_suborder',1); // $this->db->join('sub_order_shades', 'sub_orders.id = sub_order_shades.subOrderId'); // $query = $this->db->get(); // return $query->result(); } public function completed_getsuborder_update($id) { $ignore = array('Pending','Partially Shipped'); $this->db->select('sub_orders.orderID,sub_order_shades.shadeID as id,sub_orders.articleNo,sub_orders.unit,sub_orders.width,sub_orders.subOrderType,sub_orders.description,sub_orders.totalQuantity,sub_orders.totalValue, sub_orders.orderConfirm,sub_orders.edit,sub_orders.delete,sub_orders.confirm_by,sub_orders.created_by,sub_orders.design,sub_orders.quality,sub_orders.weave,sub_order_shades.shipping_status,sub_order_shades.quantity,sub_order_shades.unitPrice,sub_order_shades.foreignValue,sub_order_shades.shipped_by,sub_order_shades.ourShade'); $this->db->order_by('sub_orders.subCode','asc'); $this->db->from('sub_orders'); //$this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.subCode'); $this->db->join('sub_order_shades', 'sub_orders.id = sub_order_shades.subOrderId'); $this->db->where('sub_orders.orderID', $id); $this->db->where_not_in('sub_order_shades.shipping_status', $ignore); $this->db->where('status', 0); $query = $this->db->get(); //print_r($this->db->last_query()); return $query->result(); } public function display_design_data() { $this->db->order_by("designmp", "asc"); $query = $this->db->get('design_master'); return $query->result(); } //display customerid from 'customer master' based on alphabet selection in 'transaction master' public function filter_customer_filenor($alphachar) { $this->db->like('customerID', $alphachar, 'after'); $query = $this->db->get('customer_master'); return $query->result(); } //insert transaction order here public function transaction_order_insert($transaction_data) { $transactioninsert = $this->db->insert('transaction_order', $transaction_data); if ($transactioninsert) { return true; } else { return false; } } //ADD ORDERS public function addTransactionOrder($transaction_data) { $transactioninsert = $this->db->insert('orders', $transaction_data); if ($transactioninsert) { return $this->db->insert_id(); } else { return false; } } //UPDATE ORDERS public function updateTransactionOrder($transaction_data, $postOrderID = "") { $this->db->where('id', $postOrderID); $update = $this->db->update('orders', $transaction_data); if ($update) { return true; } else { return false; } } //ADD SUBORDER WITH SUBCODE public function addSubOrder($data) { $transactioninsert = $this->db->insert('sub_orders', $data); if ($transactioninsert) { return $this->db->insert_id(); } else { return false; echo $this->db->last_query();exit; } } public function addSuborder1($data,$where){ $this->db->where($where); $this->db->update('sub_order_shades', $data); } //UPDATE SUBORDER public function updateSubOrder($subOrderData, $id) { $this->db->where('id', $id); $update = $this->db->update('sub_orders', $subOrderData); if ($update) { return true; } else { return false; } } //ADD SUBORDER SHADES public function addSubOrderShades($data) { $transactioninsert = $this->db->insert('sub_order_shades', $data); if ($transactioninsert) { return $this->db->insert_id(); } else { return false; } } //UPDATE SUBORDER SHADES public function updateSubOrderShades($data, $id) { $this->db->where('shadeID', $id); $update = $this->db->update('sub_order_shades', $data); if ($update) { return true; } else { return false; } } //get article edit data public function get_article_editdata($id) { $query = $this->db->get_where('article_master', array('articleID' => $id)); return $query->row(); } //get article edit data public function get_article_warpdata($id) { $query = $this->db->get_where('warp_data', array('article_id' => $id)); return $query->row(); } //get article edit data public function get_article_weftdata($id) { $query = $this->db->get_where('weft_data', array('article_id' => $id)); return $query->row(); } //GENERATE NEW OSL NUMBER /* public function generateOSL($oslvalue) { $query = $this->db->query("SELECT * FROM orders WHERE orderType='" . $oslvalue . "' "); $invoiceno = $query->num_rows() + 1; $invID = str_pad($invoiceno, 1, '0', STR_PAD_LEFT); $month = date("m"); if ($month == "01" || $month == "02" || $month == "03") { $yearis = date("Y") - 1; } else { $yearis = date("Y"); } // return $yearis . $oslvalue . $invID; return array( 'osl' => $yearis . $oslvalue . $invID, 'sub' => $invoiceno, ); }*/ public function generateOSL($oslvalue) { // $query = $this->db->query("SELECT oslno_id as max FROM `orders` WHERE orderType='" . $oslvalue . "'"); $month = date("m"); if ($month == "01" || $month == "02" || $month == "03") { $year = date("Y") - 1; } else { $year = date("Y"); } //$year = date("Y"); $query = $this->db->query("SELECT oslno_id FROM orders WHERE orderType='" . $oslvalue . "' AND financial_year='" . $year . "' ORDER BY id DESC "); //print_r($this->db->last_query()); $invoicenos = $query->row(); //print_r($invoicenos); //die(); if(empty($invoicenos)) { $invoiceno =1; } else { $invoiceno = $invoicenos->oslno_id+1; } if($invoiceno < 10 ) { $invID = '0' . $invoiceno; } else { $invID =$invoiceno; } $month = date("m"); if ($month == "01" || $month == "02" || $month == "03") { $yearis = date("Y") - 1; } else { $yearis = date("Y"); } // return $yearis . $oslvalue . $invID; return array( 'osl' => $yearis . $oslvalue . $invID, 'sub' => $invoiceno, ); } //GET EXISTING OSL NUMBERS ACCORDING TO THE SELECTED TYPE public function getOSL($oslvalue) { echo "SELECT oslNo FROM orders WHERE oslNO LIKE '%" . $oslvalue . "'"; $query = $this->db->query("SELECT * FROM orders WHERE oslNO LIKE '%" . $oslvalue . "%'"); return $query->result(); } //TO GET ORDER TYPES function getOrderTypes() { $query = $this->db->get('product_master'); return $query->result(); } //TO GET ARTICLE DETAILS function getArticleDetails($articleNumber) { $query = $this->db->get_where('article_master', array('articleNo' => $articleNumber)); return $query->row(); } public function display_product($id) { $query = $this->db->get_where('product_master', array('productID' => $id)); return $query->result(); } public function display_customer($id) { $query = $this->db->get_where('customer_master', array('id' => $id)); return $query->result(); } public function get_order_details($orderID) { $this->db->from('orders'); $this->db->where('orders.id', $orderID); $this->db->join('customer_master', 'orders.fileNo = customer_master.customerID'); $query = $this->db->get(); //$query = $this->db->get_where('orders', array('id' => $orderID)); return $query->row(); } public function get_sub_orders($orderID) { $this->db->from('sub_orders'); $this->db->where('sub_orders.orderID', $orderID); $query = $this->db->get(); return $query->result(); } public function get_sub_order_details($subOrderID) { $this->db->from('sub_orders'); $this->db->where('sub_orders.id', $subOrderID); $this->db->join('article_master', 'sub_orders.articleNo = article_master.articleNo'); $query = $this->db->get(); return $query->row_array(); } public function input_preview($subOrderID) { $this->db->select('sub_orders.subCode,sub_orders.width,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_order_shades.ourShade,sub_order_shades.buyerShade,sub_order_shades.skuNo,sub_orders.subOrderType,sub_orders.description,sub_orders.totalQuantity,sub_orders.deliveryMode,sub_order_shades.quantity,sub_orders.unit,sub_order_shades.foreignValue'); $this->db->order_by('sub_orders.subCode','asc'); $this->db->from('sub_orders'); $this->db->where('sub_orders.orderId', $subOrderID); $this->db->where('status',0); $this->db->where('sub_order_shades.add_suborder',0); $this->db->join('sub_order_shades', 'sub_orders.id = sub_order_shades.subOrderId'); $query = $this->db->get(); return $query->result(); } public function order_preview($subOrderID) { $this->db->select('sub_orders.subCode,,sub_orders.width,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_order_shades.ourShade,sub_order_shades.buyerShade,sub_order_shades.skuNo,sub_orders.subOrderType,sub_orders.description,sub_orders.totalQuantity,sub_orders.deliveryMode,sub_order_shades.quantity,sub_orders.unit,sub_orders.totalValue,sub_order_shades.unitPrice,sub_orders.deliveryPoint,sub_order_shades.foreignValue'); $this->db->from('sub_orders'); $this->db->where('sub_orders.orderId', $subOrderID); $this->db->where('status',0); $this->db->where('sub_order_shades.add_suborder',0); $this->db->join('sub_order_shades', 'sub_orders.id = sub_order_shades.subOrderId'); $query = $this->db->get(); return $query->result(); } public function pre($subOrderID) { $this->db->select('sub_orders.subCode,sum(sub_order_shades.quantity) as subtotal,sub_order_shades.*'); $this->db->from('sub_orders'); $this->db->where('sub_orders.orderId', $subOrderID); $this->db->where('sub_orders.status !=', 1); $this->db->join('sub_order_shades', 'sub_orders.id = sub_order_shades.subOrderId'); $this->db->group_by('sub_orders.subCode'); $query = $this->db->get(); return $query->result(); } public function get_osl_details($orderID) { $this->db->select('*'); $this->db->from('sub_order_shades sos'); $this->db->join('sub_orders so', 'sos.subOrderID = so.id'); // $this->db->join('article_master am', 'so.articleNo = am.articleNo'); $this->db->join('orders o', 'so.orderID = o.id'); $this->db->where('o.id', $orderID); $this->db->where('so.article_type', 'inhouse'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->result_array(); } // public function get_osl_details($orderID) { // $this->db->from('sub_order_shades sos'); // $this->db->join('sub_orders so', 'sos.subOrderID = so.id'); // $this->db->join('article_master am', 'so.articleNo = am.articleNo'); // $this->db->join('orders o', 'so.orderID = o.id'); // $this->db->where('o.id', $orderID); // $query = $this->db->get(); // return $query->result_array(); // } public function getShadesOfSubOrder($subOrderID) { $this->db->from('sub_order_shades'); $this->db->where('sub_order_shades.subOrderID', $subOrderID); $query = $this->db->get(); //echo $this->db->last_query(); return $query->result_array(); } // TO GET THE NEXT SUBCODE TO BE INSERTED public function getNextSubCode($orederID) { $query = $this->db->get_where('sub_orders', array('orderID' => $orederID)); return $query->num_rows(); } //check license and quality unique in database here public function uniqueproduct($type, $fabricType) { $this->db->select('type,fabricType'); $this->db->from("product_master"); $this->db->where('type', $type); $this->db->where('fabricType', $fabricType); $this->db->limit(1); $query = $this->db->get(); if ($query->num_rows() == 1) { return $query->result(); } else { return false; } } public function get_sub_order_shade($shadeID){ $this->db->from('sub_order_shades sos'); $this->db->where('sos.shadeID', $shadeID); $query = $this->db->get(); return $query->result_array(); } public function delete_sub_shade_details($shadeID){ $this->db->where('shadeID', $shadeID); $this->db->delete('sub_order_shades'); return; } public function displayorderinputdata($orderID) { $query=$this->db->query("SELECT sub_orders.*,GROUP_CONCAT(sub_order_shades.ourShade order by shadeID desc) as ourshades,GROUP_CONCAT(sub_order_shades.buyerShade) as buyershade,GROUP_CONCAT(sub_order_shades.skuNo) as skunum,GROUP_CONCAT(sub_order_shades.quantity) as quantity,GROUP_CONCAT(sub_order_shades.unitPrice) as unitPrice from sub_orders LEFT JOIN sub_order_shades on sub_orders.id=sub_order_shades.subOrderID WHERE sub_orders.orderID='".$orderID."' GROUP BY sub_orders.id"); return $query->result(); } public function performanceinvoicedata($orderID) { $query=$this->db->query("SELECT orders.*,sub_orders.contractType from orders join sub_orders on orders.id=sub_orders.orderID where id='".$orderID."'"); return $query->result(); } public function pak_fabric_packing_all_embroidryinspection($osl_no) { //$this->db->distinct(); $this->db->select('fabric_inspection_details.id,fabric_inspection_details.vendor_name,fabric_inspection_details.consumed_at,fabric_inspection_details.piece_no,fabric_inspection_details.po_no,fabric_inspection_details.product_name,fabric_inspection_details.width,fabric_inspection_details.shades,fabric_inspection_details.rec_goods,fabric_inspection_details.rec_weight,fabric_inspection.inspected_mtrs,fabric_inspection.rejected_mtrs,fabric_inspection.ssl_pc_no,fabric_inspection.quantity,fabric_inspection_details.bal_goods,fabric_inspection_details.remainning_quantity,fabric_inspection_details.available_quantity,fabric_inspection.variance_mtrs,fabric_inspection.balanced_mtrs,fabric_inspection_details.design,fabric_inspection_details.unit'); $this->db->order_by('fabric_inspection_details.id'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->where('fabric_inspection_details.status','0'); $this->db->where('fabric_inspection_details.po_no',$osl_no); $this->db->where('fabric_inspection.balanced_mtrs !=','0.00'); $this->db->where('fabric_inspection.balanced_mtrs !=',''); $this->db->where('fabric_inspection.balanced_mtrs >','0'); //$this->db->where('fabric_inspection_details.rec_weight >','0'); $query=$this->db->get(); return $query->result(); } public function display_fabric_packing_osl_wise_embroidryinspection($id) { $this->db->select('orders.*,sub_orders.unit'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.id'); $this->db->where('orders.oslNo',$id); $query=$this->db->get(); return $query->row(); } public function fetch_where_data($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function fetch_where_data_limit($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $this->db->limit(1); $query = $this->db->get(); return $query->result(); } public function fetch_main_data($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function fetch_customer_data($id) { $this->db->select('customer_master.customerID,customer_master.customerName,customer_master.customerAddress,customer_master.city,customer_master.pincode,country.country'); $this->db->from('customer_master'); $this->db->join('country','customer_master.country=country.id'); $this->db->where('customerId',$id); $query = $this->db->get(); return $query->row(); } public function get_where_data($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function update($data,$where) { $this->db->where($where); $this->db->update('orders',$data); } public function update_new($data,$where) { $this->db->where($where); $this->db->update('sub_orders',$data); } public function fetch_where_data_edit($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function fetch_multiple_data_edit($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function update1($data,$where) { $this->db->where($where); $this->db->update('sub_orders',$data); } public function fetch_main() { $this->db->select_max('invoice_value'); $this->db->from('orders'); $query = $this->db->get(); return $query->row(); } public function fetch_max_invoice() { $this->db->select_max('invoice_num'); $this->db->from('madeups_list_data_new'); $query = $this->db->get(); return $query->row(); } public function fetch_max_invoice_billing() { if(date('m') <= 3) { $financial_year = (date('y')-1) . '-' . date('y'); } else { $financial_year = date('y') . '-' . (date('y') + 1); } $this->db->where('financ_year',$financial_year); $this->db->select_max('invoice_num'); $this->db->from('madeups_list_data'); $query = $this->db->get(); return $query->row(); } public function fetch_marketing_invoice_datas1($id) { $this->db->select('*'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->where('fabric_inspection_details.id',$id); $query=$this->db->get(); return $query->row(); } public function update_data($where,$table,$data) { $this->db->where($where); $this->db->update($table,$data); } public function fetch_edit_data($where) { $this->db->select('*'); $this -> db ->from ('sub_orders'); //$this -> db->join ( 'jb_role r ', 'l.role=r.id'); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function fetch_edit_data1($where) { $this->db->select('*'); $this -> db ->from ('sub_order_shades'); //$this -> db->join ( 'jb_role r ', 'l.role=r.id'); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function insert($table,$data) { $this->db->insert($table,$data); } public function quality_update($table,$data,$wh) { $this->db->where($wh); $this->db->update($table,$data); } public function inserted($table,$data) { $this->db->insert($table,$data); $id = $this->db->insert_id(); return $id; } public function inserted99($table,$data) { $this->db->insert($table,$data); $id = $this->db->insert_id(); return $id; } public function updated99($table,$data,$where) { $this->db->where($where); $this->db->update($table,$data); } public function fetch_where_data_edit1($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function max_select() { $this->db->select_max('id'); //$query = $this->db->get('orders'); $this->db->from('orders'); //$this->db->where($where); $query = $this->db->get(); return $query->row(); } public function max_select_suborders() { $this->db->select_max('id'); //$query = $this->db->get('orders'); $this->db->from('sub_orders'); //$this->db->where($where); $query = $this->db->get(); return $query->row(); } public function fetch_edit_data_update($where) { $this->db->select('*'); $this -> db ->from ('sub_order_shades'); //$this -> db->join ( 'jb_role r ', 'l.role=r.id'); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function max_select_subcode($where) { $this->db->select_max('subCode'); $this->db->from('sub_orders'); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function fetch_max_id_orders() { $this->db->select('*'); $this->db->from('orders'); $this->db->order_by('id','DESC'); $this->db->limit(1); $query = $this->db->get(); return $query->row(); } public function select_article_row($where) { $this->db->select('*'); $this->db->from('article_master'); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function select_product_row($where) { $this->db->select('*'); $this->db->from('indent_product'); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function select_product_row1($where) { $this->db->select('*'); $this->db->from('product_category'); $this->db->where($where); $query = $this->db->get(); return $query->row(); } // public function delete($where,$table) // { // $this->db->where($where); // $this->db->delete($table); // } public function delete($table,$where){ // print_r($table);die(); $this->db->where($where); $this->db->delete($table); } public function get_shadeNo1($orderID, $status) { $this->db->select('*'); $this->db->from('sub_orders so'); $this->db->join('sub_order_shades sos', 'sos.subOrderID = so.id'); $this->db->where('so.orderID', $orderID); $this->db->where('so.status', $status); $query = $this->db->get(); return $query->result(); } public function get_shadeNo2($orderID, $status) { $this->db->select('*'); $this->db->from('sub_orders so'); //$this->db->join('sub_order_shades sos', 'sos.subOrderID = so.id'); $this->db->where('so.orderID', $orderID); $this->db->where('so.status', $status); $query = $this->db->get(); return $query->result(); } public function getordershade($shadeID) { $this->db->select('sub_orders.subOrderType,sub_orders.unit,sub_orders.articleNo,sub_orders.article_type,,sub_orders.weave,sub_orders.quality,sub_orders.design,sub_orders.width,sub_orders.description,sub_orders.totalQuantity,sub_orders.totalValue,sub_orders.discount,sub_orders.netValue,sub_orders.indianValue,sub_order_shades.buyerShade,sub_order_shades.ourShade,sub_order_shades.quantity,sub_order_shades.unitPrice,sub_order_shades.foreignValue,sub_order_shades.deliveryDate,sub_order_shades.skuNo,orders.lcNo,orders.lcDate,orders.expiryDate,orders.daysCredit,orders.bank,orders.amount,orders.customerComments, sub_orders.freightForwarder,sub_orders.freightType,sub_orders.deliveryMode,sub_orders.deliveryPoint,sub_orders.packingType,sub_orders.labelTerms,sub_orders.packinginstructions ') ; $this->db->from('sub_orders'); $this->db->where('shadeID', $shadeID); //$this->db->where('status',0); $this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.id'); $this->db->join('orders', 'sub_orders.orderID = orders.id'); $query = $this->db->get(); //$query=$this->db->get_where('sub_order_shades', array('shadeID' => $shadeID)); $result = $query->row_array(); return $result; } public function getorder_shadeid($shadeID) { $this->db->select('*') ; $this->db->from('sub_order_shades'); $this->db->where('subOrderID', $shadeID); $query = $this->db->get(); //$query = $this->db->get(); return $query->result(); } public function fetch_edit_data_update4($where) { $this->db->select_sum('quantity'); $this -> db ->from ('sub_order_shades'); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function fetch_edit_data_update5($where) { $this->db->select_sum('foreignValue'); $this -> db ->from ('sub_order_shades'); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function max_select1() { $this->db->select_max('id'); //$query = $this->db->get('orders'); $this->db->from('transaction_orders'); //$this->db->where($where); $query = $this->db->get(); return $query->row(); } public function max_select_suborders1() { $this->db->select_max('id'); //$query = $this->db->get('orders'); $this->db->from('transaction_suborder'); //$this->db->where($where); $query = $this->db->get(); return $query->row(); } public function getwarpdenier($yarnname) { $query = $this->db->query('SELECT DISTINCT(templateNo) FROM transaction_orders where fileNo="' . $yarnname . '"'); return $query->result(); } public function getshade($product_id) { $query = $this->db->query('SELECT * FROM madeups_product_shades where product_id ="' . $product_id . '"'); return $query->result(); } public function getshadedetails($shade,$product_id) { $query = $this->db->query('SELECT * FROM madeups_product_shades where product_id ="' .$product_id . '" and our_shade ="' .$shade .'"'); return $query->result(); } public function max_select_template() { $this->db->select_max('templateNo'); $this->db->from('transaction_orders'); //$this->db->where($where); $query = $this->db->get(); return $query->row(); } public function getordershade_1($orderid) { $this->db->select('transaction_suborder.subOrderType,transaction_suborder.unit,transaction_suborder.articleNo,transaction_suborder.article_type,transaction_suborder.weave,transaction_suborder.quality,transaction_suborder.design,transaction_suborder.width,transaction_suborder.description,transaction_suborder.totalQuantity,transaction_suborder.totalValue,transaction_suborder.discount,transaction_suborder.netValue,transaction_suborder.indianValue,transaction_shades.buyerShade,transaction_shades.ourShade,transaction_shades.quantity,transaction_shades.unitPrice,transaction_shades.foreignValue,transaction_shades.deliveryDate,transaction_shades.skuNo,transaction_orders.lcNo,transaction_orders.lcDate,transaction_orders.expiryDate,transaction_orders.daysCredit,transaction_orders.bank,transaction_orders.amount,transaction_orders.customerComments, transaction_suborder.freightForwarder,transaction_suborder.freightType,transaction_suborder.deliveryMode,transaction_suborder.deliveryPoint,transaction_suborder.packingType,transaction_suborder.labelTerms,transaction_suborder.packinginstructions ') ; $this->db->from('transaction_suborder'); $this->db->where('transaction_suborder.id', $orderid); $this->db->join('transaction_shades', 'transaction_shades.subOrderID = transaction_suborder.id'); $this->db->join('transaction_orders', 'transaction_suborder.orderID = transaction_orders.id'); $query = $this->db->get(); //$query=$this->db->get_where('sub_order_shades', array('shadeID' => $shadeID)); $result = $query->row_array(); return $result; } public function fetch_where_data_desc($table,$where) { $this->db->select("*"); $this->db->order_by('id','DESC'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function fetch_where_data_desc222($table,$where) { $this->db->select("*"); $this->db->order_by('id','ASC'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function fetch_where_data_desc22($table,$where) { $this->db->select("*"); $this->db->order_by('id','ASC'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); // print_r($this->db->last_query()); // die(); return $query->result(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////// public function getorder() { $this->db->select('*'); $this->db->order_by('oslno', "desc"); $this->db->from('orders'); $this->db->where('status',0); $this->db->where('orderType','DTL'); $query = $this->db->get(); return $query->result(); } public function getorder_sam_details() { $this->db->order_by('id', "desc"); $this->db->where('status',0); $this->db->where('orderType','SAM'); $query = $this->db->get('orders'); return $query->result(); } public function getorder_sdk_details() { $this->db->order_by('id', "desc"); $this->db->where('status',0); $this->db->where('orderType','STK'); $query = $this->db->get('orders'); return $query->result(); } public function get_shadeNo_status($orderID, $status) { $this->db->select('*'); $this->db->from('sub_orders so'); //$this->db->join('sub_order_shades sos', 'sos.subOrderID = so.id'); $this->db->where('so.orderID', $orderID); $this->db->where('so.status', $status); $this->db->where('so.orderConfirm','No'); $query = $this->db->get(); return $query->result(); } public function customer_view_data($where) { $this->db->select('*'); $this->db->from('sub_orders so'); $this->db->join('orders o', 'o.id = so.orderID'); $this->db->join('sub_order_shades sos', 'sos.subOrderID = so.id'); $this->db->where('o.fileNo', $where); $query = $this->db->get(); return $query->result(); } public function fetch_uniqueno($table) { $this->db->select_max('unique_no'); $this->db->from($table); $query = $this->db->get(); return $query->row(); } public function getoslno($table) { $this->db->select('oslNo'); $this->db->from($table); $this->db->group_by('oslNo'); $query = $this->db->get(); return $query->result(); } public function fetch_po_no($table,$where) { $this->db->select('*'); $this->db->group_by('po_no'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function display_fabric_packing_embroidryinspection($osl_no,$location) { //$this->db->distinct(); $this->db->select('fabric_inspection_details.id,fabric_inspection_details.vendor_name,fabric_inspection_details.consumed_at,fabric_inspection_details.piece_no,fabric_inspection_details.po_no,fabric_inspection_details.product_name,fabric_inspection_details.width,fabric_inspection_details.shades,fabric_inspection_details.rec_goods,fabric_inspection_details.rec_weight,fabric_inspection.inspected_mtrs,fabric_inspection.rejected_mtrs,fabric_inspection.ssl_pc_no,fabric_inspection.quantity,fabric_inspection_details.bal_goods,fabric_inspection_details.remainning_quantity,fabric_inspection_details.available_quantity,fabric_inspection.variance_mtrs,fabric_inspection.balanced_mtrs,fabric_inspection_details.design'); $this->db->order_by('fabric_inspection_details.id'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->where('fabric_inspection_details.status','0'); $this->db->where('fabric_inspection_details.po_no',$osl_no); $this->db->where('fabric_inspection_details.consumed_at',$location); $this->db->where('fabric_inspection.balanced_mtrs !=','0.00'); $query=$this->db->get(); return $query->result(); } public function display_fabric_packing_all_embroidryinspection($osl_no) { //$this->db->distinct(); $this->db->select('fabric_inspection_details.id,fabric_inspection_details.vendor_name,fabric_inspection_details.consumed_at,fabric_inspection_details.piece_no,fabric_inspection_details.po_no,fabric_inspection_details.product_name,fabric_inspection_details.width,fabric_inspection_details.shades,fabric_inspection_details.rec_goods,fabric_inspection_details.rec_weight,fabric_inspection.inspected_mtrs,fabric_inspection.rejected_mtrs,fabric_inspection.ssl_pc_no,fabric_inspection.quantity,fabric_inspection_details.bal_goods,fabric_inspection_details.remainning_quantity,fabric_inspection_details.available_quantity,fabric_inspection.variance_mtrs,fabric_inspection.balanced_mtrs,fabric_inspection_details.design'); $this->db->order_by('fabric_inspection_details.id'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->where('fabric_inspection_details.status','0'); $this->db->where('fabric_inspection_details.po_no',$osl_no); // $this->db->where('fabric_inspection_details.consumed_at',$location); $this->db->where('fabric_inspection.balanced_mtrs !=','0.00'); $query=$this->db->get(); return $query->result(); } public function fetch_marketing_data($width,$product_name,$shades,$design,$table) { $this->db->select('sum(fabric_inspection_details.exp_qty) as exp_qty'); //$this->db->select('fabric_inspection_details.exp_qty as e'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->where('fabric_inspection_details.width',$width); $this->db->where('fabric_inspection_details.product_name',$product_name); $this->db->where('fabric_inspection_details.shades',$shades); $this->db->where('fabric_inspection_details.design',$design); $query=$this->db->get(); return $query->row(); } public function fetch_marketing_data1($width,$product_name,$shades,$design,$table) { $this->db->select('sum(fabric_inspection_details.exp_wt) as exp_wt'); //$this->db->select_sum('fabric_inspection_details.exp_wt'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->where('fabric_inspection_details.width',$width); $this->db->where('fabric_inspection_details.product_name',$product_name); $this->db->where('fabric_inspection_details.shades',$shades); $this->db->where('fabric_inspection_details.design',$design); $query=$this->db->get(); return $query->row(); } public function fetch_marketing_datas1($width,$product_name,$shades,$design,$table) { $this->db->select('sum(fabric_inspection_details.rec_weight) as rec_weight'); //$this->db->select_sum('fabric_inspection_details.rec_weight'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->where('fabric_inspection_details.width',$width); $this->db->where('fabric_inspection_details.product_name',$product_name); $this->db->where('fabric_inspection_details.shades',$shades); $this->db->where('fabric_inspection_details.design',$design); $this->db->where('fabric_inspection_details.pklist_id','1'); $query=$this->db->get(); return $query->row(); } public function fetch_marketing_datas($width,$product_name,$shades,$design,$table) { $this->db->select('sum(fabric_inspection.balanced_mtrs) as balanced_mtrs,sum(fabric_inspection_details.rec_weight) as rec_weight'); //$this->db->select_sum('fabric_inspection.balanced_mtrs'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->where('fabric_inspection_details.width',$width); $this->db->where('fabric_inspection_details.product_name',$product_name); $this->db->where('fabric_inspection_details.shades',$shades); $this->db->where('fabric_inspection_details.design',$design); $this->db->where('fabric_inspection_details.pklist_id','1'); $query=$this->db->get(); return $query->row(); } public function fetch_marketing_datas_new($width,$product_name,$shades,$design,$table,$po) { $this->db->select('sum(fabric_inspection.balanced_mtrs) as balanced_mtrs,sum(fabric_inspection_details.rec_weight) as rec_weight'); //$this->db->select_sum('fabric_inspection.balanced_mtrs'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->where('fabric_inspection_details.width',$width); $this->db->where('fabric_inspection_details.product_name',$product_name); $this->db->where('fabric_inspection_details.shades',$shades); $this->db->where('fabric_inspection_details.design',$design); $this->db->where('fabric_inspection_details.pklist_id','1'); $this->db->where('fabric_inspection_details.po_no',$po); $query=$this->db->get(); return $query->row(); } public function fetch_where_box_group_data($table) { $this->db->select("*"); $this->db->group_by('datas'); $this->db->from($table); $query = $this->db->get(); return $query->result(); } public function fetch_box_list_group_details($where,$table) { $this->db->select_sum('e_wt'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function fetch_box_list_group_data($where,$table) { $this->db->select('COUNT(datas) as count'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function fetch_where_box_group_data22($table) { $this->db->select("*"); $this->db->group_by('width,article,shades'); $this->db->from($table); $query = $this->db->get(); return $query->result(); } public function fetch_marketing_data11($where,$table) { $this->db->select_sum('balanced_mtrs'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function fetch_marketing_data12($where,$table) { $this->db->select_sum('rec_weight'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function display_fabric_packing_osl_pkg_embroidryinspection1($osl_num,$width,$design,$article,$shades) { $this->db->select('orders.orderNo,sub_orders.design,sub_orders.subOrderType,sub_order_shades.unitPrice,sub_order_shades.buyerShade,sub_order_shades.skuNo,sub_orders.contractType,orders.currency'); $this->db->group_by(['sub_orders.design', 'sub_orders.articleNo']); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.id'); $this->db->join('planned_order', 'planned_order.subNo= sub_order_shades.shadeID'); $this->db->join('shade_master', 'shade_master.shadeID= planned_order.sslShade'); $this->db->where('orders.oslNo',$osl_num); $this->db->where('sub_orders.design',$design); $this->db->where('shade_master.shadeName',$shades); $this->db->where('sub_orders.articleNo',$article); //$this->db->where('sub_orders.width',$width); $query=$this->db->get(); return $query->row(); } public function display_fabric_packing_osl_pkg_embroidryinspections1($osl_num,$width,$design,$article) { $this->db->select('orders.orderNo,sub_orders.subOrderType,sub_order_shades.unitPrice,sub_order_shades.buyerShade,sub_order_shades.skuNo'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.id'); // $this->db->join('planned_order', 'planned_order.subNo= sub_order_shades.shadeID'); // $this->db->join('shade_master', 'shade_master.shadeID= planned_order.sslShade'); $this->db->where('orders.oslNo',$osl_num); $this->db->where('sub_orders.design',$design); $this->db->where('sub_orders.articleNo',$article); $query=$this->db->get(); return $query->row(); } public function outsource_getordershade($shadeID) { $this->db->select('orders.orderNo,sub_orders.subOrderType,sub_order_shades.unitPrice,sub_order_shades.buyerShade,sub_order_shades.skuNo') ; $this->db->from('sub_orders'); $this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.id'); $this->db->join('orders', 'sub_orders.orderID = orders.id'); $this->db->where('sub_order_shades.shadeID',$shadeID); $query = $this->db->get(); //$query=$this->db->get(); return $query->row(); } public function indent_shade_outsource_id($osl) { $this->db->select('indent_po.purpose,indent_add_indent.add_product,indent_add_indent.purpose_shadeid'); $this->db->from('indent_po'); $this->db->join('indent_add_indent', 'indent_add_indent.id = indent_po.indent_id'); $this->db->where('po_no',$osl); $query=$this->db->get(); return $query->row(); } public function display_fabric_packing_group_id_embroidryinspection() { //$this->db->distinct(); $this->db->select('fabric_inspection_details.id,fabric_inspection_details.osl_like,fabric_inspection_details.vendor_name,fabric_inspection_details.consumed_at,fabric_inspection_details.piece_no,fabric_inspection_details.po_no,fabric_inspection_details.product_name,fabric_inspection_details.width,fabric_inspection_details.shades,fabric_inspection_details.rec_goods,fabric_inspection_details.rec_weight,fabric_inspection.inspected_mtrs,fabric_inspection.rejected_mtrs,fabric_inspection.ssl_pc_no,fabric_inspection.quantity,fabric_inspection_details.bal_goods,fabric_inspection_details.remainning_quantity,fabric_inspection_details.available_quantity,fabric_inspection.variance_mtrs,fabric_inspection.balanced_mtrs,fabric_inspection_details.design,fabric_inspection_details.buyerShade,fabric_inspection_details.orderType,fabric_inspection_details.unit'); $this->db->order_by('fabric_inspection_details.id'); $this->db->group_by(['fabric_inspection_details.width', 'fabric_inspection_details.shades', 'fabric_inspection_details.product_name','fabric_inspection_details.design']) ; $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->where('fabric_inspection_details.pklist_id',1); $query=$this->db->get(); return $query->result(); } public function display_fabric_packing_group_id_embroidryinspection_new() { //$this->db->distinct(); $this->db->select('fabric_inspection_details.id,fabric_inspection_details.osl_like,fabric_inspection_details.vendor_name,fabric_inspection_details.consumed_at,fabric_inspection_details.piece_no,fabric_inspection_details.po_no,fabric_inspection_details.product_name,fabric_inspection_details.width,fabric_inspection_details.shades,fabric_inspection_details.rec_goods,fabric_inspection_details.rec_weight,fabric_inspection.inspected_mtrs,fabric_inspection.rejected_mtrs,fabric_inspection.ssl_pc_no,fabric_inspection.quantity,fabric_inspection_details.bal_goods,fabric_inspection_details.remainning_quantity,fabric_inspection_details.available_quantity,fabric_inspection.variance_mtrs,fabric_inspection.balanced_mtrs,fabric_inspection_details.design,fabric_inspection_details.buyerShade,fabric_inspection_details.orderType,fabric_inspection_details.unit'); $this->db->order_by('fabric_inspection_details.id'); $this->db->group_by(['fabric_inspection_details.po_no','fabric_inspection_details.width', 'fabric_inspection_details.shades', 'fabric_inspection_details.product_name','fabric_inspection_details.design']) ; $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->where('fabric_inspection_details.pklist_id',1); $query=$this->db->get(); return $query->result(); } public function display_fabric_packing_osl_pkg_embroidryinspection($osl_num,$width,$design,$article,$shade_id) { $this->db->select('orders.orderNo,sub_orders.subOrderType,sub_order_shades.unitPrice,sub_order_shades.buyerShade,sub_order_shades.skuNo'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.id'); $this->db->join('planned_order', 'planned_order.subNo= sub_order_shades.shadeID'); $this->db->join('shade_master', 'shade_master.shadeID= planned_order.sslShade'); $this->db->where('orders.oslNo',$osl_num); $this->db->where('sub_orders.design',$design); $this->db->where('shade_master.shadeID',$shade_id); $this->db->where('planned_order.sslShade',$shade_id); $this->db->where('sub_orders.articleNo',$article); $query=$this->db->get(); return $query->row(); } public function display_fabric_packing_id_embroidryinspection($id) { //$this->db->distinct(); $this->db->select('fabric_inspection_details.unit,fabric_inspection_details.id,fabric_inspection_details.vendor_name,fabric_inspection_details.osl_like,fabric_inspection_details.consumed_at,fabric_inspection_details.piece_no,fabric_inspection_details.po_no,fabric_inspection_details.product_name,fabric_inspection_details.width,fabric_inspection_details.shades,fabric_inspection_details.rec_goods,fabric_inspection_details.rec_weight,fabric_inspection.inspected_mtrs,fabric_inspection.rejected_mtrs,fabric_inspection.ssl_pc_no,fabric_inspection.quantity,fabric_inspection_details.bal_goods,fabric_inspection_details.remainning_quantity,fabric_inspection_details.available_quantity,fabric_inspection.variance_mtrs,fabric_inspection.balanced_mtrs,fabric_inspection_details.design,fabric_inspection_details.design,fabric_inspection_details.buyerShade,fabric_inspection_details.orderType'); $this->db->order_by('fabric_inspection_details.id'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->where('fabric_inspection_details.status','0'); $this->db->where('fabric_inspection_details.id',$id); // $this->db->where('fabric_inspection_details.consumed_at',$location); $this->db->where('fabric_inspection.balanced_mtrs !=','0.00'); $query=$this->db->get(); return $query->row(); } public function display_fabric_packing_osl_embroidryinspection($id) { $this->db->select('sub_order_shades.skuNo'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.id'); $this->db->where('orders.oslNo',$id); $query=$this->db->get(); return $query->row(); } public function fetch_invoice_no($table) { $this->db->select_max('invoice'); $this->db->from($table); $query = $this->db->get(); return $query->row(); } public function shade_id($id) { $this->db->select('*'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.id'); $this->db->join('planned_order', 'planned_order.subNo= sub_order_shades.shadeID'); $this->db->join('shade_master', 'shade_master.shadeID= planned_order.sslShade'); $this->db->where('sub_order_shades.shadeID',$id); $query=$this->db->get(); return $query->row(); } public function fetch_where_mark_data($table) { $this->db->select("*"); $this->db->from($table); $query = $this->db->get(); return $query->result(); } public function osl_shade_id($osl) { $this->db->select('*'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.id'); $this->db->join('planned_order', 'planned_order.subNo= sub_order_shades.shadeID'); $this->db->join('shade_master', 'shade_master.shadeID= planned_order.sslShade'); $this->db->where('orders.oslNo',$osl); $query=$this->db->get(); return $query->row(); } public function indent_shade_id($osl) { $this->db->select('indent_add_indent.purpose,indent_add_indent.purpose_shadeid'); $this->db->from('indent_po'); $this->db->join('indent_add_indent', 'indent_add_indent.id= indent_po.indent_id'); $this->db->where('indent_po.po_no',$osl); $query=$this->db->get(); return $query->row(); } public function planning_shade_id($id) { $this->db->select('orders.*,sub_orders.*,planned_order.*,sub_order_shades.buyerShade as b_shade,sub_order_shades.*'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.id'); $this->db->join('planned_order', 'planned_order.subNo= sub_order_shades.shadeID'); $this->db->where('planned_order.id',$id); $query=$this->db->get(); return $query->row(); } public function fetch_po_no_oldstock() { $this->db->select('fabric_inspection_details.id,fabric_inspection_details.vendor_name,fabric_inspection_details.consumed_at,fabric_inspection_details.piece_no,fabric_inspection_details.po_no,fabric_inspection_details.product_name,fabric_inspection_details.width,fabric_inspection_details.shades,fabric_inspection_details.rec_goods,fabric_inspection_details.rec_weight,fabric_inspection.inspected_mtrs,fabric_inspection.rejected_mtrs,fabric_inspection.ssl_pc_no,fabric_inspection.quantity,fabric_inspection_details.bal_goods,fabric_inspection_details.remainning_quantity,fabric_inspection_details.available_quantity,fabric_inspection.variance_mtrs,fabric_inspection.balanced_mtrs,fabric_inspection_details.design'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->where('fabric_inspection_details.vendor_name','OLD STOCK'); $query = $this->db->get(); return $query->result(); } public function box_group_by($table,$where) { $this->db->select('*'); $this->db->group_by('box_id'); $this->db->order_by('box_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function box_group_by_id($data1,$financ_year) { $this->db->select('*'); $this->db->from('madeups_box_packing'); $this->db->where('invoice',$data1); $this->db->where('status','0'); //$this->db->like('financ_year',$financ_year); //$this->db->group_by('box_id'); //$this->db->order_by('box_id'); $query = $this->db->get(); $res = $query->result(); return $res; } public function box_group_by_id_new($data1,$financ_year) { $this->db->select('*'); $this->db->from('madeups_box_packing_new'); $this->db->where('invoice',$data1); $this->db->where('status','0'); //$this->db->like('financ_year',$financ_year); //$this->db->group_by('box_id'); //$this->db->order_by('box_id'); $query = $this->db->get(); $res = $query->result(); return $res; } public function box_net_group_by($table,$where) { $this->db->select_sum('net_wt'); $this->db->group_by('box_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function box_gross_group_by($table,$where) { $this->db->select_sum('gross_wt'); $this->db->group_by('box_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function box_tare_group_by($table,$where) { $this->db->select_sum('tare_wt'); $this->db->group_by('box_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function box_total_pcs_group_by($table,$where) { $this->db->select_sum('total_pcs'); $this->db->group_by('box_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function fetch_where_customer_data($table,$where) { $this->db->select("*"); $this->db->order_by('customerName','asc'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function fetch_OLD_po_no_oldstock($location) { $this->db->select('fabric_inspection_details.id,fabric_inspection_details.vendor_name,fabric_inspection_details.consumed_at,fabric_inspection_details.piece_no,fabric_inspection_details.po_no,fabric_inspection_details.product_name,fabric_inspection_details.width,fabric_inspection_details.shades,fabric_inspection_details.rec_goods,fabric_inspection_details.rec_weight,fabric_inspection.inspected_mtrs,fabric_inspection.rejected_mtrs,fabric_inspection.ssl_pc_no,fabric_inspection.quantity,fabric_inspection_details.bal_goods,fabric_inspection_details.remainning_quantity,fabric_inspection_details.available_quantity,fabric_inspection.variance_mtrs,fabric_inspection.balanced_mtrs,fabric_inspection_details.design,fabric_inspection_details.unit'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->where('fabric_inspection_details.consumed_at',$location); $this->db->where('fabric_inspection_details.po_no','OLD STOCK'); $this->db->where('fabric_inspection_details.unit !=','PCS'); $this->db->where('fabric_inspection_details.unit !=','NO(s)'); $this->db->where('fabric_inspection_details.unit !=','PAIRS'); $this->db->where('fabric_inspection_details.unit !=','SETS'); $query = $this->db->get(); return $query->result(); } public function pkg_fetch_where_data() { $this->db->select("*"); $this->db->group_by('width,shades,unit_price,product_name,design'); $this->db->from('pkg_table'); //$this->db->where($where); $query = $this->db->get(); return $query->result(); } public function pkg_fetch_where_data_new() { $this->db->select("*"); $this->db->group_by('width,shades,unit_price,product_name,design,po_no'); $this->db->from('pkg_table'); //$this->db->where($where); $query = $this->db->get(); return $query->result(); } public function discount_fetch_edit_data_update($where) { $this->db->select_sum('values_es'); $this -> db ->from ('invoice_packing'); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function packing_fetch_main() { $this->db->select_max('generate_invoice_num'); $this->db->from('packing_list_data'); $query = $this->db->get(); return $query->row(); } public function fetch_ALL_po_no_oldstock() { $this->db->select('fabric_inspection_details.id,fabric_inspection_details.vendor_name,fabric_inspection_details.customer_id,fabric_inspection_details.consumed_at,fabric_inspection_details.piece_no,fabric_inspection_details.po_no,fabric_inspection_details.product_name,fabric_inspection_details.width,fabric_inspection_details.shades,fabric_inspection_details.rec_goods,fabric_inspection_details.rec_weight,fabric_inspection.inspected_mtrs,fabric_inspection.rejected_mtrs,fabric_inspection.ssl_pc_no,fabric_inspection.quantity,fabric_inspection_details.bal_goods,fabric_inspection_details.remainning_quantity,fabric_inspection_details.available_quantity,fabric_inspection.variance_mtrs,fabric_inspection.balanced_mtrs,fabric_inspection_details.design'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); //$this->db->where('fabric_inspection_details.consumed_at',$location); // $this->db->where('fabric_inspection_details.vendor_name','OLD STOCK'); $this->db->where('fabric_inspection.balanced_mtrs !=','0.00'); $this->db->where('fabric_inspection.balanced_mtrs !=',''); $this->db->where('fabric_inspection.balanced_mtrs >','0'); $query = $this->db->get(); return $query->result(); } public function display_fabric_packing_id_sub_embroidryinspection($id) { //$this->db->distinct(); $this->db->select('fabric_inspection_details.id,fabric_inspection_details.osl_like,fabric_inspection_details.vendor_name,fabric_inspection_details.consumed_at,fabric_inspection_details.piece_no,fabric_inspection_details.po_no,fabric_inspection_details.product_name,fabric_inspection_details.width,fabric_inspection_details.shades,fabric_inspection_details.rec_goods,fabric_inspection_details.rec_weight,fabric_inspection.inspected_mtrs,fabric_inspection.rejected_mtrs,fabric_inspection.ssl_pc_no,fabric_inspection.quantity,fabric_inspection_details.bal_goods,fabric_inspection_details.remainning_quantity,fabric_inspection_details.available_quantity,fabric_inspection.variance_mtrs,fabric_inspection.balanced_mtrs,fabric_inspection_details.design,fabric_inspection_details.design,fabric_inspection_details.buyerShade,fabric_inspection_details.orderType as subOrderType,fabric_inspection_details.unit'); $this->db->order_by('fabric_inspection_details.id'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->where('fabric_inspection_details.status','0'); $this->db->where('fabric_inspection_details.id',$id); // $this->db->where('fabric_inspection_details.consumed_at',$location); $this->db->where('fabric_inspection.balanced_mtrs !=','0.00'); $query=$this->db->get(); return $query->row(); } public function fetch_ALL_loc_no_oldstock($location) { $this->db->select('fabric_inspection_details.id,fabric_inspection_details.vendor_name,fabric_inspection_details.consumed_at,fabric_inspection_details.piece_no,fabric_inspection_details.po_no,fabric_inspection_details.product_name,fabric_inspection_details.width,fabric_inspection_details.shades,fabric_inspection_details.rec_goods,fabric_inspection_details.rec_weight,fabric_inspection.inspected_mtrs,fabric_inspection.rejected_mtrs,fabric_inspection.ssl_pc_no,fabric_inspection.quantity,fabric_inspection_details.bal_goods,fabric_inspection_details.remainning_quantity,fabric_inspection_details.available_quantity,fabric_inspection.variance_mtrs,fabric_inspection.balanced_mtrs,fabric_inspection_details.design,fabric_inspection_details.unit'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->where('fabric_inspection_details.consumed_at',$location); // $this->db->where('fabric_inspection_details.vendor_name','OLD STOCK'); $this->db->where('fabric_inspection.balanced_mtrs !=','0.00'); $this->db->where('fabric_inspection.balanced_mtrs !=',''); $this->db->where('fabric_inspection.balanced_mtrs >','0'); $this->db->where('fabric_inspection_details.unit !=','PCS'); $this->db->where('fabric_inspection_details.unit !=','NO(s)'); $this->db->where('fabric_inspection_details.unit !=','PAIRS'); $this->db->where('fabric_inspection_details.unit !=','SETS'); $query = $this->db->get(); return $query->result(); } public function fetch_po_numers($oslvalue) { $query = $this->db->query("SELECT * FROM fabric_inspection_details WHERE po_no LIKE '%" . 'PO' . "%'"); return $query->result(); } public function fetch_po_numers_osl($oslvalue) { $query = $this->db->query("SELECT * FROM fabric_inspection_details WHERE po_no LIKE '%" . 'DTL' . "%'"); return $query->result(); } public function fetch_po_numers_sd($oslvalue) { $query = $this->db->query("SELECT * FROM fabric_inspection_details WHERE po_no LIKE '%" . 'SD' . "%'"); return $query->result(); } public function fetch_po_numers_stk($oslvalue) { $query = $this->db->query("SELECT * FROM fabric_inspection_details WHERE po_no LIKE '%" . 'STK' . "%'"); return $query->result(); } /////////////////////////// 10-4-2018 ////////////////////////////////////////////////////////////////// public function display_madeups_packing_group_id_embroidryinspection($table) { //$this->db->distinct(); $this->db->select('*'); $this->db->order_by('id'); $this->db->group_by(['article', 'size', 'shade','design']); $this->db->from($table); $this->db->where('pklist_id',1); $query=$this->db->get(); return $query->result(); } public function display_madeups_packing_group_id_embroidryinspection_unitprice($table) { //$this->db->distinct(); $this->db->select('*'); $this->db->order_by('id'); $this->db->group_by(['article', 'size', 'shade','design','unitprice']); $this->db->from($table); $this->db->where('pklist_id',1); $query=$this->db->get(); return $query->result(); } public function display_madeups_packing_group_id_new($table) { //$this->db->distinct(); $this->db->select('*,SUM(stock_qty) as sum_val'); $this->db->order_by('id'); $this->db->group_by(['article', 'width', 'buyershade','design','unitprice','osl_no']); $this->db->from('madeups_invoice_packing_temp'); $query=$this->db->get(); return $query->result(); } public function display_madeups_packing_group_id_embroidryinspections($table) { //$this->db->distinct(); $this->db->select('*'); $this->db->order_by('id'); //$this->db->group_by('article', 'size', 'shade','design'); $this->db->from($table); $this->db->where('pklist_id',1); $query=$this->db->get(); return $query->result(); } public function fetch_madeups_data11($where,$table) { $this->db->select_sum('received_qty'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function fetch_where_madeups_box_group_data22($table) { $this->db->select("*"); $this->db->group_by('article', 'size', 'ssl_shade','design'); //$this->db->group_by(['article', 'size', 'ssl_shade','design','osl']); $this->db->from($table); $query = $this->db->get(); return $query->result(); } public function fetch_where_madeups_box_group_data22_osl($table) //8-5-2024 { $this->db->select("*"); // $this->db->group_by('article', 'size', 'ssl_shade','design'); $this->db->group_by(['article', 'size', 'ssl_shade','design','osl']); $this->db->from($table); $query = $this->db->get(); return $query->result(); } public function fetch_where_madeups_box_group_data23($table) { $this->db->select("*"); $this->db->group_by('article', 'size', 'ssl_shade','design'); //$this->db->group_by(['article', 'size', 'ssl_shade','design','osl']); $this->db->from($table); $query = $this->db->get(); return $query->result(); } public function display_madeups_fabric_packing_osl_pkg_embroidryinspection1($ref) { $this->db->select('orders.orderNo,sub_orders.design,sub_orders.subOrderType,sub_order_shades.unitPrice,sub_order_shades.buyerShade,sub_order_shades.skuNo,sub_orders.contractType,orders.currency'); //$this->db->group_by(['sub_orders.design', 'sub_orders.articleNo']); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.id'); $this->db->join('planned_order', 'planned_order.subNo= sub_order_shades.shadeID'); $this->db->join('shade_master', 'shade_master.shadeID= planned_order.sslShade'); $this->db->where('planned_order.id',$ref); $query=$this->db->get(); return $query->row(); } public function fetch_madeups_datas($size,$article,$shades,$design) { $this->db->select_sum('received_qty'); $this->db->group_by(['article', 'size', 'shade','design']); $this->db->from('fabric_madeups_delivery_confirmation'); $this->db->where('size',$size); $this->db->where('article',$article); $this->db->where('ssl_shade',$shades); $this->db->where('design',$design); $this->db->where('pklist_id','1'); $query=$this->db->get(); return $query->row(); } public function fetch_madeups_exp_datas($size,$article,$shades,$design) { $this->db->select_sum('exp_wt'); $this->db->group_by('article', 'size', 'ssl_shade','design'); $this->db->from('fabric_madeups_delivery_confirmation'); $this->db->where('size',$size); $this->db->where('article',$article); $this->db->where('ssl_shade',$shades); $this->db->where('design',$design); $this->db->where('pklist_id','1'); $query=$this->db->get(); return $query->row(); } public function fetch_madeups_datas1() { $this->db->select_sum('received_qty'); $this->db->group_by(['article', 'size', 'ssl_shade','design','osl']); $this->db->from('invoice_madeups'); $query=$this->db->get(); return $query->result(); } public function fetch_madeups_datas1_order() { $this->db->select_sum('received_qty'); $this->db->group_by(['article', 'size', 'ssl_shade','design','osl']); $this->db->from('invoice_madeups'); $this->db->order_by('id'); $query=$this->db->get(); return $query->result(); } public function fetch_madeups_exp_datas1_order() { $this->db->select_sum('exp_wt'); $this->db->group_by(['article', 'size', 'ssl_shade','design','osl']); $this->db->from('invoice_madeups'); $this->db->order_by('id'); $query=$this->db->get(); return $query->result(); } public function fetch_madeups_exp_datas1() { $this->db->select_sum('exp_wt'); $this->db->group_by(['article', 'size', 'ssl_shade','design','osl']); $this->db->from('invoice_madeups'); $query=$this->db->get(); return $query->result(); } public function madeups_pkg_fetch_where_data() { $this->db->select("*"); $this->db->group_by(['article', 'size', 'shade','design','unit_price','osl']); $this->db->from('pkg_madeups_table'); //$this->db->where($where); $query = $this->db->get(); return $query->result(); } public function madeups_pkg_fetch_where_data_order() { $this->db->select("*"); $this->db->group_by(['article', 'size', 'shade','design','unit_price','osl']); $this->db->from('pkg_madeups_table'); $this->db->order_by('id','ASC'); //$this->db->where($where); $query = $this->db->get(); return $query->result(); } /////////////////////// 14-4-2018 ///////////////////////////// public function discount_madeups_fetch_edit_data_update($where) { $this->db->select_sum('values_es'); $this -> db ->from ('madeups_invoice_packing'); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function madeups_fetch_main() { $this->db->select_max('generate_invoice_num'); $this->db->from('madeups_list_data'); $query = $this->db->get(); return $query->row(); } public function fetch_invoice_madeupo_no($table) { $this->db->select_max('invoice_num'); $this->db->from($table); $query = $this->db->get(); return $query->row(); } public function outsource_getordershade1($shadeID) { $this->db->select('orders.orderNo,sub_orders.subOrderType,sub_order_shades.unitPrice,sub_order_shades.buyerShade,sub_order_shades.skuNo') ; $this->db->from('sub_orders'); $this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.id'); $this->db->join('orders', 'sub_orders.orderID = orders.id'); $this->db->where('orders.oslNo',$shadeID); $query = $this->db->get(); //$query=$this->db->get(); return $query->row(); } public function fetch_where_result_data_edit1($table) { $this->db->select("*"); $this->db->from($table); $query = $this->db->get(); return $query->result(); } public function fetch_join_planned($where) { $this->db->select('sub_orders.unit') ; $this->db->from('fabric_inspection_details'); $this->db->join('planned_order', 'planned_order.oslNo = fabric_inspection_details.po_no'); $this->db->join('sub_order_shades', 'sub_order_shades.shadeID = planned_order.subNo'); $this->db->join('sub_orders', 'sub_orders.id = sub_order_shades.subOrderID'); $this->db->where('fabric_inspection_details.po_no',$where); $query = $this->db->get(); //$query=$this->db->get(); return $query->row(); } public function fetch_join_indent($where) { $this->db->select('indent_po.indent_unit') ; $this->db->from('fabric_inspection_details'); $this->db->join('indent_po', 'indent_po.id = fabric_inspection_details.po_list_id'); $this->db->where('fabric_inspection_details.po_no',$where); $query = $this->db->get(); //$query=$this->db->get(); return $query->row(); } public function fetch_where_group_data($table,$where) { $this->db->select("*"); $this->db->group_by("po_no"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function pak_fabric_packing_all_fabric_embroidryinspection($osl_no) { //$this->db->distinct(); $this->db->select('fabric_inspection_details.id,fabric_inspection_details.vendor_name,fabric_inspection_details.consumed_at,fabric_inspection_details.piece_no,fabric_inspection_details.po_no,fabric_inspection_details.product_name,fabric_inspection_details.width,fabric_inspection_details.shades,fabric_inspection_details.rec_goods,fabric_inspection_details.rec_weight,fabric_inspection.inspected_mtrs,fabric_inspection.rejected_mtrs,fabric_inspection.ssl_pc_no,fabric_inspection.quantity,fabric_inspection_details.bal_goods,fabric_inspection_details.remainning_quantity,fabric_inspection_details.available_quantity,fabric_inspection.variance_mtrs,fabric_inspection.balanced_mtrs,fabric_inspection_details.design,fabric_inspection_details.unit'); $this->db->order_by('fabric_inspection_details.id'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->where('fabric_inspection_details.status','0'); //$this->db->where('fabric_inspection_details.unit','MTRS'); //$this->db->where('fabric_inspection_details.unit','YARDS'); $this->db->where('fabric_inspection_details.po_no',$osl_no); $this->db->where('fabric_inspection_details.unit !=','PCS'); $this->db->where('fabric_inspection_details.unit !=','NO(s)'); $this->db->where('fabric_inspection_details.unit !=','PAIRS'); $this->db->where('fabric_inspection_details.unit !=','SETS'); $this->db->where('fabric_inspection.balanced_mtrs !=','0.00'); $this->db->where('fabric_inspection.balanced_mtrs !=',''); $this->db->where('fabric_inspection.balanced_mtrs >','0'); //$this->db->where('fabric_inspection_details.rec_weight >','0'); $query=$this->db->get(); return $query->result(); } public function pak_fabric_packing_all_fabric_embroidryinspection_selected($osl_no) { //$this->db->distinct(); $this->db->select('fabric_inspection_details.id,fabric_inspection_details.vendor_name,fabric_inspection_details.consumed_at,fabric_inspection_details.piece_no,fabric_inspection_details.po_no,fabric_inspection_details.product_name,fabric_inspection_details.width,fabric_inspection_details.shades,fabric_inspection_details.rec_goods,fabric_inspection_details.rec_weight,fabric_inspection.inspected_mtrs,fabric_inspection.rejected_mtrs,fabric_inspection.ssl_pc_no,fabric_inspection.quantity,fabric_inspection_details.bal_goods,fabric_inspection_details.remainning_quantity,fabric_inspection_details.available_quantity,fabric_inspection.variance_mtrs,fabric_inspection.balanced_mtrs,fabric_inspection_details.design,fabric_inspection_details.unit'); $this->db->order_by('fabric_inspection_details.id'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->where('fabric_inspection_details.status','0'); //$this->db->where('fabric_inspection_details.unit','MTRS'); //$this->db->where('fabric_inspection_details.unit','YARDS'); $this->db->where('fabric_inspection_details.po_no',$osl_no); $this->db->where('fabric_inspection_details.unit !=','PCS'); $this->db->where('fabric_inspection_details.unit !=','NO(s)'); $this->db->where('fabric_inspection_details.unit !=','PAIRS'); $this->db->where('fabric_inspection_details.unit !=','SETS'); $this->db->where('fabric_inspection.balanced_mtrs !=','0.00'); $this->db->where('fabric_inspection.balanced_mtrs !=',''); $this->db->where('fabric_inspection_details.selected_po =','1'); $this->db->where('fabric_inspection.balanced_mtrs >','0'); //$this->db->where('fabric_inspection_details.rec_weight >','0'); $query=$this->db->get(); return $query->result(); } //////////////////// 1-6-2018 //////////////////// public function OSL_delivery_date_getorder($y,$y1) { $this->db->select('o.*,so.subOrderType,sos.planned_by,sos.planningStatus,so.totalValue'); $this->db->from('orders o'); ///$this->db->where('so.orderConfirm', 'Yes'); $this->db->where('o.status',0); $this->db->where('o.deliveryDate >=', $y); $this->db->where('o.deliveryDate <=', $y1); $this->db->join('sub_orders so', 'so.orderID = o.id'); $this->db->join('sub_order_shades sos', 'sos.subOrderID = so.id'); $this->db->order_by("id", "desc"); $this->db->group_by('o.oslNo'); $this->db->where('o.orderType','DTL'); $query=$this->db->get(); $result=$query->result(); $array = array(); foreach($result as $value) { $data['id'] = $value->id; $data['oslNo'] = $value->oslNo; $data['fileNo'] = $value->fileNo; $data['orderMode'] = $value->orderMode; $data['orderNo'] = $value->orderNo; $data['deliveryDate'] = $value->deliveryDate; $data['subOrderType'] = $value->subOrderType; $this->db->select('sum(totalValue) as totalValue'); $this->db->from('sub_orders'); $this->db->where('orderID',$value->id); $query=$this->db->get(); $total=$query->row(); $data['totalValue'] = ROUND($total->totalValue,2); $data['currency'] = $value->currency; $data['preview1'] = $value->preview1; $data['preview2'] = $value->preview2; $data['preview3'] = $value->preview3; $data['confirm_status'] = $value->confirm_status; $data['planningStatus'] = $value->planningStatus; array_push($array, $data); } return $array; } public function display_CUSTOMER_madeups_fabric_packing_osl_pkg_embroidryinspection1($ref) { $this->db->select('orders.orderNo'); $this->db->from('orders'); $this->db->where('orders.oslNo',$ref); $query=$this->db->get(); return $query->row(); } public function indent_shade_product_outsource_id($osl,$product) { $this->db->select('indent_po.purpose,indent_add_indent.add_product,indent_add_indent.purpose_shadeid'); $this->db->from('indent_po'); $this->db->join('indent_add_indent', 'indent_add_indent.id = indent_po.indent_id'); $this->db->where('indent_po.po_no',$osl); $this->db->where('indent_po.product_name',$product); $query=$this->db->get(); return $query->row(); } public function outsource_articl_getordershade($shadeID,$article) { $this->db->select('orders.orderNo,sub_orders.subOrderType,sub_order_shades.unitPrice,sub_order_shades.buyerShade,sub_order_shades.skuNo') ; $this->db->from('sub_orders'); $this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.id'); $this->db->join('orders', 'sub_orders.orderID = orders.id'); $this->db->where('sub_order_shades.shadeID',$shadeID); $this->db->where('sub_orders.articleNo',$article); $query = $this->db->get(); //$query=$this->db->get(); return $query->row(); } public function pre_order($subOrderID) { } public function input_preview_input_suborders($subOrderID) { $this->db->select('sub_order_shades.shadeID,sub_orders.subCode,sub_orders.width,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_order_shades.ourShade,sub_order_shades.buyerShade,sub_order_shades.skuNo,sub_orders.subOrderType,sub_orders.description,sub_orders.totalQuantity,sub_orders.deliveryMode,sub_order_shades.quantity,sub_orders.unit,sub_order_shades.foreignValue,shade_master.shadeName,planned_order.warpPlandMtr,planned_order.weftPlandMtr,planned_order.selWidth'); $this->db->order_by('sub_orders.subCode','asc'); $this->db->from('sub_orders'); $this->db->group_by('sub_order_shades.shadeID'); $this->db->where('sub_orders.orderId', $subOrderID); $this->db->where('status',0); // $this->db->where('sub_order_shades.add_suborder',1); $this->db->join('sub_order_shades', 'sub_orders.id = sub_order_shades.subOrderId'); $this->db->join('planned_order', 'sub_order_shades.shadeID = planned_order.subNo'); // $this->db->join('orders', 'sub_orders.orderId = orders.id'); //$this->db->join('weaving_panel_planning_order', 'orders.id = weaving_panel_planning_order.order_id'); $this->db->join('shade_master', 'shade_master.shadeID = planned_order.sslShade'); $query = $this->db->get(); return $query->result(); } public function display_madeups_edit_packing_group_id_embroidryinspection($table) { //$this->db->distinct(); $this->db->select('*'); $this->db->order_by('id'); $this->db->group_by(['article', 'size', 'shade','design']); $this->db->from($table); $this->db->where('edit_list',1); $query=$this->db->get(); return $query->result(); } public function indent_planning_join_fabric($w) { $this->db->select('indent_po.po_no,orders.oslNo'); $this->db->from('indent_po'); $this->db->join('indent_add_indent', 'indent_po.indent_id= indent_add_indent.id'); $this->db->join('sub_order_shades', 'sub_order_shades.shadeID= indent_add_indent.purpose_shadeid'); $this->db->join('sub_orders', 'sub_order_shades.subOrderID = sub_orders.id'); $this->db->join('orders', 'sub_orders.orderID = orders.id'); $this->db->where('sub_orders.subOrderType','FABRIC'); $this->db->where('indent_po.po_no',$w); $query=$this->db->get(); return $query->row(); } public function fetch_where_osl_group_po_data($table,$where) { $this->db->select("*"); $this->db->group_by(['width','shades','article']); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function fetch_marketing_data_sum_data($where,$table) { $this->db->select('sum(edit_exp_wt) as edit_exp_wt,shades'); $this->db->group_by(['width','shades','article']); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); // print_R($query); //die(); return $query->row(); } public function fetch_marketing_data_sum_box_data($where,$table) { $this->db->select('sum(edit_exp_wt) as edit_exp_wt'); $this->db->group_by('box_id'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); // print_R($query); //die(); return $query->row(); } ////////// 14-11-2018 ////////////////////////////// public function chage_weaving_factory_planning_shade($id) { $this->db->select('*'); $this->db->from('planned_order'); $this->db->where('subNo',$id); //$this->db->where('po.subNo', $subNumber); $query=$this->db->get(); return $query->row(); } public function OSL_NUMBERss_getorder() { $this->db->select("o.id, o.oslNo, o.fileNo, o.orderMode, o.orderNo, o.deliveryDate, o.invoice_no, o.currency, o.confirm_status, sos.planned_by, sos.planningStatus, so.orders_Type, adv.adv_pay_stat, SUM(so.totalValue) as totalValue, SUM(so.indianValue) as indian, (CASE WHEN o.shipped_fun = 0 THEN 'Pending' ELSE 'Completed' END) as shipped_fun", false); $this->db->from('orders as o'); $this->db->join('sub_orders as so', 'so.orderID = o.id', 'inner'); $this->db->join('sub_order_shades as sos', 'sos.subOrderID = so.id', 'inner'); $this->db->join('advance_payment_details as adv', 'adv.orderid = o.id', 'left'); $this->db->where('o.status', 0); $this->db->where('o.orderType', 'DTL'); $this->db->group_by('o.oslNo'); $this->db->order_by('o.id', 'desc'); $query = $this->db->get(); return $query->result(); } public function getorder_sams_details() { $this->db->select('o.*,sos.planned_by,sos.planningStatus'); $this->db->from('orders o'); ///$this->db->where('so.orderConfirm', 'Yes'); $this->db->where('o.status',0); //$this->db->where('so.article_type', 'outsource'); $this->db->join('sub_orders so', 'so.orderID = o.id'); $this->db->join('sub_order_shades sos', 'sos.subOrderID = so.id'); $this->db->order_by("id", "desc"); $this->db->where('o.orderType','SAM'); $this->db->group_by('o.oslNo'); $query = $this->db->get(); return $query->result(); } public function getorder_sdks_details() { $this->db->select('o.*,sos.planned_by,sos.planningStatus'); $this->db->from('orders o'); ///$this->db->where('so.orderConfirm', 'Yes'); $this->db->where('o.status',0); //$this->db->where('so.article_type', 'outsource'); $this->db->join('sub_orders so', 'so.orderID = o.id'); $this->db->join('sub_order_shades sos', 'sos.subOrderID = so.id'); $this->db->order_by("id", "desc"); $this->db->where('o.orderType','STK'); $this->db->group_by('o.oslNo'); $query = $this->db->get(); return $query->result(); } public function order_by_fetch_where_data($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $this->db->order_by('length_cm','asc'); $this->db->order_by('width_cm','asc'); $this->db->order_by('height_cm','asc'); $query = $this->db->get(); return $query->result(); } /////////////////////////// new /////////////////////////////////// public function fetch_invoice_years_date_no($table,$where) { $this->db->select_max('invoice'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function fetch_invoice_madeupo_years_no($table,$where) { $this->db->select_max('invoice_num'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } ////////////////////////////// public function fetch_where_group_data_all($table,$group_by) { $this->db->select("*"); $this->db->from($table); $this->db->group_by($group_by); $query = $this->db->get(); return $query->result(); } public function fetch_where_data_all($table) { $this->db->select("*"); $this->db->from($table); //$this->db->order_by('filetype','ASC'); $query = $this->db->get(); return $query->result(); } public function get_order_number($id) { $this->db->select('sub_orders.orderId'); $this->db->from('sub_order_shades'); $this->db->where('sub_order_shades.shadeID',$id); $this->db->join('sub_orders', 'sub_order_shades.subOrderId = sub_orders.id'); $query = $this->db->get(); $ret = $query->row(); return $ret->orderId; //return $query->result(); } public function getmax_id($table){ $this->db->select_max('id'); $this->db->from($table); $query = $this->db->get(); $ret = $query->row(); return $ret->id; } public function getmax_id1($table,$wh){ $this->db->select('*'); $this->db->where($wh); $this->db->from($table); $query = $this->db->get(); return $query->result(); } public function fetch_where_subgrid_data4($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function fetch_where_subgrid_data2($data1,$financ_year,$confirm) { $this->db->select("indent_po.*"); $this->db->from('indent_po'); $this->db->where('indent_po.po_id',$data1); $this->db->where('indent_po.financ_year',$financ_year); $this->db->where('indent_po.department !=', ' '); $this->db->where('indent_po.confirm',$confirm); $query = $this->db->get(); return $query->result(); } public function get_work_order_data4($table,$where) { $this->db->select('*'); $this->db->group_by('work_order_no','vendor_name','date','delivery_date'); $this->db->order_by('id','desc'); // $this->db->order_by('work_order_no'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function fetchdtl(){ $this->db->select('o.*,sos.planned_by,so.created_by'); $this->db->from('orders o'); $this->db->where('so.orderConfirm', 'Yes'); $this->db->where('sos.planningStatus', 'Pending'); $this->db->or_where('sos.planningStatus', 'planned'); $this->db->where('so.article_type', 'inhouse'); $this->db->join('sub_orders so', 'so.orderID = o.id'); $this->db->join('sub_order_shades sos', 'sos.subOrderID = so.id'); $this->db->order_by("o.id", "desc"); $this->db->group_by('oslNo'); $query = $this->db->get(); return $query->result(); } public function get_po($confirm){ $this->db->select("indent_po.*"); $this->db->from('indent_po'); $this->db->group_by('indent_po.po_no','indent_po.indent_no','indent_po.vendor_name','indent_po.g_date','indent_po.currency','indent_po.confirm','indent_po.approved_by','indent_po.remark'); $this->db->order_by("indent_po.po_id","desc"); $this->db->where('indent_po.product_type','Yarn - Dyed'); $this->db->where('indent_po.confirm',$confirm); $query = $this->db->get(); return $query->result(); } public function fetch_shade($data1,$financ_year,$confirm){ $this->db->select("indent_po.indent_id,indent_add_indent.*"); $this->db->from('indent_po'); $this->db->join('indent_add_indent', 'indent_po.indent_id = indent_add_indent.id'); $this->db->where('indent_po.po_id',$data1); $this->db->where('indent_po.financ_year',$financ_year); $this->db->where('indent_po.department !=', ' '); $this->db->where('indent_po.confirm',$confirm); $query = $this->db->get(); return $query->result(); } public function pooo($id){ $this->db->select("oslNo"); $this->db->from('orders'); $this->db->where('orders.id',$id); $query = $this->db->get(); $ret = $query->row(); // return $query->result(); return $ret->oslNo; // print_r(); // die(); } public function addu($id){ $this->db->select("fileNo"); $this->db->from('orders'); $this->db->where('orders.id',$id); $query = $this->db->get(); $ret = $query->row(); // return $query->result(); return $ret->fileNo; // print_r(); // die(); } public function display_fabric_embroidryinspection($po) { //$this->db->distinct(); $this->db->select('indent_po.unit,fabric_inspection_details.splited_piece_no,fabric_inspection_details.received_date, fabric_inspection_details.id,fabric_inspection_details.vendor_name,fabric_inspection_details.consumed_at,fabric_inspection_details.piece_no, fabric_inspection_details.po_no,fabric_inspection_details.product_name,fabric_inspection_details.width,fabric_inspection_details.shades, fabric_inspection_details.rec_goods,fabric_inspection_details.rec_weight,fabric_inspection.inspected_mtrs,fabric_inspection.rejected_mtrs, fabric_inspection.ssl_pc_no,fabric_inspection.quantity,fabric_inspection_details.bal_goods,fabric_inspection_details.remainning_quantity, fabric_inspection_details.available_quantity,fabric_inspection.variance_mtrs,fabric_inspection.balanced_mtrs,fabric_inspection_details.design, fabric_inspection_details.customer_id,fabric_inspection.rejected_weight'); $this->db->order_by('fabric_inspection_details.id'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->join('indent_po', 'indent_po.id = fabric_inspection_details.po_list_id','left'); $this->db->where('fabric_inspection_details.status','0'); $this->db->where('fabric_inspection_details.consumed_at !=','0'); $this->db->where('fabric_inspection_details.po_no',$po); $this->db->where('fabric_inspection.balanced_mtrs > 0'); // $this->db->where('fabric_inspection.balanced_mtrs !=','0.00'); //$this->db->where('fabric_inspection.balanced_mtrs !=',''); // $this->db->where('fabric_inspection.balanced_mtrs >', 0); $query=$this->db->get(); return $query->result(); } public function display_fabric_embroidryinspection2($po) { //$this->db->distinct(); $this->db->select('indent_po.unit,fabric_inspection_details.splited_piece_no,fabric_inspection_details.received_date, fabric_inspection_details.id,fabric_inspection_details.vendor_name,fabric_inspection_details.consumed_at,fabric_inspection_details.piece_no, fabric_inspection_details.po_no,fabric_inspection_details.product_name,fabric_inspection_details.width,fabric_inspection_details.shades, fabric_inspection_details.rec_goods,fabric_inspection_details.rec_weight,fabric_inspection.inspected_mtrs,fabric_inspection.rejected_mtrs, fabric_inspection.ssl_pc_no,fabric_inspection.quantity,fabric_inspection_details.bal_goods,fabric_inspection_details.remainning_quantity, fabric_inspection_details.available_quantity,fabric_inspection.variance_mtrs,fabric_inspection.balanced_mtrs,fabric_inspection_details.design, fabric_inspection_details.customer_id,fabric_inspection.rejected_weight,orders.orderNo,orders.currency,sub_order_shades.unitPrice'); $this->db->order_by('fabric_inspection_details.id','DESC'); $this->db->from('fabric_inspection_details'); $this->db->join('orders', 'orders.oslNo = fabric_inspection_details.po_no'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.id'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->join('indent_po','indent_po.id = fabric_inspection_details.po_list_id','left'); $this->db->where('fabric_inspection_details.status','0'); $this->db->where('fabric_inspection_details.consumed_at !=','0'); $this->db->where('fabric_inspection_details.id',$po); $this->db->where('fabric_inspection.balanced_mtrs > 0'); $this->db->group_by('fabric_inspection_details.id'); // $this->db->where('fabric_inspection.balanced_mtrs !=','0.00'); //$this->db->where('fabric_inspection.balanced_mtrs !=',''); // $this->db->where('fabric_inspection.balanced_mtrs >', 0); $query=$this->db->get(); return $query->result(); } public function display_fabric_embroidryinspection1($po) { //$this->db->distinct(); $this->db->select('indent_po.unit,fabric_inspection_details.splited_piece_no,fabric_inspection_details.received_date, fabric_inspection_details.id,fabric_inspection_details.vendor_name,fabric_inspection_details.consumed_at,fabric_inspection_details.piece_no, fabric_inspection_details.po_no,fabric_inspection_details.product_name,fabric_inspection_details.width,fabric_inspection_details.shades, fabric_inspection_details.rec_goods,fabric_inspection_details.rec_weight,fabric_inspection.inspected_mtrs,fabric_inspection.rejected_mtrs, fabric_inspection.ssl_pc_no,fabric_inspection.quantity,fabric_inspection_details.bal_goods,fabric_inspection_details.remainning_quantity, fabric_inspection_details.available_quantity,fabric_inspection.variance_mtrs,fabric_inspection.balanced_mtrs,fabric_inspection_details.design, fabric_inspection_details.customer_id,fabric_inspection.rejected_weight,orders.orderNo,orders.currency,sub_order_shades.unitPrice,fabric_inspection_details.selected_po'); $this->db->order_by('fabric_inspection_details.id','DESC'); $this->db->from('fabric_inspection_details'); $this->db->join('orders', 'orders.oslNo = fabric_inspection_details.po_no'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.id'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.id'); $this->db->join('indent_po','indent_po.id = fabric_inspection_details.po_list_id','left'); $this->db->where('fabric_inspection_details.status','0'); $this->db->where('fabric_inspection_details.consumed_at !=','0'); $this->db->where('fabric_inspection_details.customer_id',$po); $this->db->where('fabric_inspection.balanced_mtrs > 0'); $this->db->group_by('fabric_inspection_details.id'); // $this->db->where('fabric_inspection.balanced_mtrs !=','0.00'); //$this->db->where('fabric_inspection.balanced_mtrs !=',''); // $this->db->where('fabric_inspection.balanced_mtrs >', 0); $query=$this->db->get(); return $query->result(); } public function fetch_usertype($id){ $this->db->select('to'); $this->db->from('color/quality_approval'); $this->db->where('color/quality_approval.id',$id); $query = $this->db->get(); $ret = $query->row(); return $ret->to; } public function fetch_kids($mo){ $this->db->select('id'); $this->db->from('employee_details'); $this->db->where('employee_details.name',$mo); $query = $this->db->get(); $ret = $query->row(); return $ret->id; } public function history_desc_dyeing_grid_data() { $this->db->select('workorder_dyeing.id,workorder_dyeing.work_order_no,workorder_dyeing.date,workorder_dyeing.vendor as d, workorder_dyeing.issue_no as issueNo,work_order_dyeing.status as issue_s,workorder_dyeing.dyed_wt as dyed_wt, workorder_dyeing_material.lot,workorder_dyeing_material.bale,workorder_dyeing_material.issue_stock,workorder_dyeing.article,workorder_dyeing_material.ourshade, workorder_dyeing.osl_no as oslNo,workorder_dyeing.yarn_details as yarnDetails,workorder_dyeing_material.date,workorder_dyeing_material.delivery_date'); $this->db->from('workorder_dyeing '); $this->db->join('work_order_dyeing', 'workorder_dyeing.issue_no= work_order_dyeing.issue_no'); $this->db->join('workorder_dyeing_material', 'workorder_dyeing_material.issue_no= workorder_dyeing.issue_no'); $this->db->where('workorder_dyeing.status','0'); $this->db->where('workorder_dyeing_material.dyeing_main_status','COMPLETED'); $this->db->where_not_in('work_order_dyeing.status','COMPLETED'); // $this->db->where('workorder_dyeing_material.complite_status','NOT YET'); // $this->db->where('workorder_dyeing_material.complite_status','PARTLY'); $this->db->order_by('workorder_dyeing.work_order','DESC'); // $this->db->group_by('workorder_dyeing.id'); //$this->db->where('workorder_dyeing.dyeing_status','1'); $query=$this->db->get(); // print_r($query->result()); // die(); return $query->result(); //$this->db->where('workorder_dyeing.dyeing_status','1'); } public function get_issue_purchase_table_data_grid_fabric_new($table,$where) { $this->db->distinct(); $this->db->select('indent_po.*,(indent_po.total_quantity-indent_po.quantity) as varience,indent_add_indent.required_on'); $this->db->from($table); $this->db->join('indent_add_indent', 'indent_po.indent_id= indent_add_indent.id'); $this->db->join('indent_goods_details','indent_goods_details.po_id=indent_po.po_id','left'); $this->db->where($where); $this->db->where_not_in('indent_po.quantity_approval','COMPLETED'); $this->db->order_by('indent_po.id','desc'); $query=$this->db->get(); // print_r($query->result()); // die(); return $query->result(); } public function fetch_issueno($id){ $this->db->select(' workorder_dyeing.issue_no'); $this->db->from('workorder_dyeing'); $this->db->where('workorder_dyeing.id',$id); $query=$this->db->get(); $q=$query->row(); return $q->issue_no; } public function updt_isstat($id){ $this->db->where('workorder_dyeing.id',$id); $this->db->update(' workorder_dyeing','complition_status=>"COMPLETED"'); } public function fetch_recwt($val){ $this->db->select('SUM(indent_goods_details.rec_weight) as rec_weight,SUM(rec_weight/indent_po.total_quantity) as avg_wt'); $this->db->from('indent_po'); $this->db->join('indent_goods_details','indent_goods_details.po_list_id=indent_po.id'); $this->db->where($val); $this->db->group_by('indent_goods_details.po_no,indent_goods_details.product_name'); $query=$this->db->get(); // $q=$query->row(); return $query->result(); } public function get_data_sl_fetch($table,$where) { $this->db->select('*'); $this->db->order_by('sl_indent_no','desc'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function get_des_data_fetch1() { $this->db->select('create_yarntwisting_work_order.*,sum(work_order_twisting.twisting_net_weight) as net, sum(create_materialissue_work_order.issued_net_weight) as net1'); $this->db->order_by('create_yarntwisting_work_order.id','DESC'); $this->db->from('create_yarntwisting_work_order'); $this->db->join('work_order_twisting','work_order_twisting.yarn_id=create_yarntwisting_work_order.id','left'); $this->db->join('create_materialissue_work_order','create_materialissue_work_order.work_order=create_yarntwisting_work_order.work_order'); // $this->db->where('create_yarntwisting_work_order.status',0); $this->db->where_not_in('create_yarntwisting_work_order.quantity_approval','Completed'); $this->db->group_by('create_yarntwisting_work_order.work_order'); $query=$this->db->get(); $result= $query->result(); $latest = array(); foreach($result as $value) { $data['id']=$value->id; $data['work_order_no']=$value->work_order_no; $data['date']=$value->date; $data['vendor_name']=$value->vendor_name; $data['quty_kgs']=$value->quty_kgs; $ys=$value->yarn_specification; $din=$value->yarn_denier; $name=$value->yarn_name; $data['yarn_name']=$name . $din . $ys; $data['net']=$value->net; $net1 = $value->quty_kgs; $net = $value->net; $data['variance']=$net-$net1; $varience=$net-$net1; if($net1==0){ $data['variencess'] =0.00; }else{ $data['variencess'] = ($varience/ $net1)*100 ; } $data['delivery_date']=$value->delivery_date; $data['quantity_approval']=$value->quantity_approval; array_push($latest, $data); } return $latest; } public function updt_stat($input,$where){ $this->db->where($where); $this->db->update('create_yarntwisting_work_order',$input); } public function get_work_fabric_history_order_data($table) { $this->db->select('weaving_panel_planning_order.*,orders.fileNo,sub_orders.unit,orders.orderNo,weaving_panel_planning_order.status as prod'); $this->db->from('weaving_panel_planning_order'); $this->db->join('orders', 'orders.id= weaving_panel_planning_order.order_id'); $this->db->join('sub_orders', 'orders.id= sub_orders.orderID'); $wherecond = "( ( ( warp_pland_mtr ='0' AND weft_pland_mtr >'0') OR ( warp_pland_mtr >'0' AND weft_pland_mtr ='0') OR ( warp_pland_mtr >'0' AND weft_pland_mtr >'0') ) )"; $this->db->where($wherecond); $this->db->where_not_in('fabric_details','Completed'); $this->db->order_by('weaving_panel_planning_order.delivery_date','desc'); $this->db->group_by(array('weaving_panel_planning_order.id')); $query=$this->db->get(); return $query->result(); } public function updt_stat22($input,$where){ $this->db->where($where); $this->db->update('weaving_panel_planning_order',$input); } public function from_master(){ $this->db->select('*'); $this->db->from('product_master'); $this->db->where('type','FABRIC'); $query=$this->db->get(); return $query->result(); } public function update_pro($table,$where,$info){ $this->db->where($where); $this->db->update($table,$info); } public function madeups_master(){ $this->db->select('*'); $this->db->from('product_master'); $this->db->where('type','MADEUPS'); $query=$this->db->get(); return $query->result(); } public function from_fabmaster(){ $this->db->select('*'); $this->db->from('fabric_size_master'); $query=$this->db->get(); return $query->result(); } public function from_madeupsmaster(){ $this->db->select('*'); $this->db->from('madeups_size_master'); $query=$this->db->get(); return $query->result(); } public function fetch_details66($where){ $this->db->select('*'); $this->db->from('product_details'); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function fetch_width($table){ $this->db->select('*'); $this->db->from($table); $query=$this->db->get(); return $query->result(); } public function tooooto($table,$where){ $this->db->select('*'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function subgrid_inserted_data($id){ $this->db->select('A.paymentTerms,B.vendor_item,A.piececase,A.net_wt,A.gross_wt,A.box_dimention,B.our_shade,B.buyer_shade,B.buyer_product_name,B.buyer_product_barcode,B.sku,B.buyer_product_barcode,B.id'); $this->db->from('product_details A'); $this->db->join('madeups_product_shades B', 'A.id= B.product_id','left'); $this->db->where('A.id',$id); $query=$this->db->get(); // print_r($this->db->last_query()); // die(); return $query->result(); } public function fetch_id($table,$where){ $this->db->select('id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); $ret = $query->row(); return $ret->id; } public function get_data($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); // $this->db->order_by('name','asc'); $query=$this->db->get(); return $query->result(); } public function getdtl($table,$where){ $this->db->select('oslNo'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); $q=$query->row(); return $q->oslNo; } public function dyeing_grid_data($where) { $this->db->select('workorder_dyeing.work_order_no,workorder_dyeing.date,workorder_dyeing.vendor as d,workorder_dyeing.issue_no as issueNo,work_order_dyeing.*,workorder_dyeing_material.complite_status as issue_s,workorder_dyeing.dyed_wt as dyed_wt,workorder_dyeing_material.lot,workorder_dyeing_material.bale,workorder_dyeing_material.issue_stock,workorder_dyeing.article,workorder_dyeing_material.ourshade,workorder_dyeing.osl_no as oslNo,workorder_dyeing.yarn_details as yarnDetails,workorder_dyeing_material.date,workorder_dyeing_material.delivery_date'); $this->db->from('workorder_dyeing '); $this->db->join('work_order_dyeing ', 'workorder_dyeing.id= work_order_dyeing.dyed_id','left'); $this->db->join('workorder_dyeing_material', 'workorder_dyeing_material.issue_no= workorder_dyeing.issue_no'); $this->db->where('workorder_dyeing.status','0'); $this->db->order_by('workorder_dyeing.work_order','DESC'); // $this->db->group_by('workorder_dyeing.id'); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function issue_loom_details($where) { $this->db->select('weaving_panel_planning_order.*,issue_loom.*'); $this->db->from('weaving_panel_planning_order'); $this->db->join('issue_loom', 'weaving_panel_planning_order.id= issue_loom.weaving_panel_id'); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function fetch_madeups_datahii($where) { $this->db->select('pm.id,o.oslNo,o.fileNo,o.deliveryDate,so.unit,s_m.shadeName,pm.pieceLength,so.subOrderType,so.articleNo,so.quality,so.design,so.description,sos.buyerShade,sos.quantity,so.width,sos.issue_stock,sos.consumable_stock,pm.confirm,pm.issue_status,pm.add_stock_status,f_m.*'); $this->db->from('sub_order_shades sos'); $this->db->join('sub_orders so', 'sos.subOrderID = so.id'); $this->db->join('orders o', 'so.orderID = o.id'); $this->db->join('planned_order pm', 'sos.shadeID = pm.subNo'); $this->db->join('shade_master s_m', 'pm.sslShade=s_m.shadeID'); $this->db->join('fabric_madeups f_m', 'pm.id=f_m.plan_id'); $this->db->where('pm.confirm', 'No'); $this->db->where($where); $this->db->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); // print_r($this->db->last_query()); // die(); return $query->result_array(); } public function display_fabric_inspection_order_embroidryinspection_date($where) { //$this->db->distinct(); $this->db->select('fabric_inspection.inspected_weight,fabric_inspection.rejected_weight,fabric_inspection_details.consumed_at, fabric_inspection_details.splited_piece_no,fabric_inspection_details.id,fabric_inspection_details.received_date, fabric_inspection_details.received_date,fabric_inspection_details.id,fabric_inspection_details.vendor_name, fabric_inspection_details.consumed_at,fabric_inspection_details.piece_no,fabric_inspection_details.po_no, fabric_inspection_details.product_name,fabric_inspection_details.width,fabric_inspection_details.shades, fabric_inspection_details.rec_goods,fabric_inspection_details.rec_weight,fabric_inspection.inspected_mtrs, fabric_inspection.rejected_mtrs,fabric_inspection.ssl_pc_no,fabric_inspection.quantity,fabric_inspection_details.bal_goods, fabric_inspection_details.remainning_quantity,fabric_inspection_details.available_quantity,fabric_inspection.variance_mtrs, fabric_inspection.balanced_mtrs,fabric_inspection_details.design,fabric_inspection.sys_date,fabric_inspection_details.customer_id, fabric_inspection.created_by,indent_goods_details.no_type_val'); // $this->db->order_by('fabric_inspection.id','desc'); // $this->db->group_by('fabric_inspection.ssl_pc_no'); $this->db->from('fabric_inspection_details'); // $n='JW'; $this->db->join('fabric_inspection', 'fabric_inspection.goods_id = fabric_inspection_details.po_list_id'); $this->db->join('indent_goods_details', 'fabric_inspection_details.po_list_id = indent_goods_details.po_list_id'); // $this->db->or_not_like('fabric_inspection_details.piece_no','DTL%'); $this->db->where('fabric_inspection_details.status','0'); $this->db->where($where); // print_r($where); // die(); $query=$this->db->get(); return $query->result(); } public function fetch_main_data_pro($orderid) { $this->db->select("*"); $this->db->from('product_details'); // $this->db->join('customer_master c','c.id = p.customer_id'); $this->db->where('product_details.id',$orderid); $query = $this->db->get(); return $query->row(); } public function delete_madeupspro_details($id,$pro,$data){ $this->db->where('id',$id); $this->db->where('product_id',$pro); $this->db->update('madeups_product_details',$data); } public function fetch_fabpro_detls($table,$where){ $this->db->select('*'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function orders_stat($where){ $this->db->select('*'); $this->db->from('orders o'); $this->db->join('advance_payment_details adv', 'adv.orderid = o.id','left'); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function fetch_customer($table,$where){ $this->db->select('customerID'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); $ret = $query->row(); return $ret->customerID; } public function fetch_materials($orderID){ $this->db->select('*'); $this->db->from('fabric_product_details'); $this->db->where('product_id',$orderID); $query = $this->db->get(); return $query->result(); } public function fetch_materials_madeups($orderID){ $this->db->select('*'); $this->db->from('madeups_product_details'); $this->db->where('product_id',$orderID); $query = $this->db->get(); return $query->result(); } public function fetch_amt($table,$where){ $this->db->select('debit_value'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); $ret = $query->row(); return $ret->debit_value; } public function fetch_name_image($table,$where){ $this->db->select('file_path'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); $ret = $query->row(); // print_r($this->db->last_query()); // die(); return $ret->file_path; } public function fetch_width_article($subOrderID) { $this->db->select('product_id'); $this->db->from('sub_orders'); $this->db->where('orderId', $subOrderID); $query = $this->db->get(); $ret = $query->row(); return $ret->product_id; } public function fetch_product_types($id){ $this->db->select('subOrderType'); $this->db->from('sub_orders'); $this->db->where('orderID',$id); $query=$this->db->get(); $ret = $query->row(); return $ret->subOrderType; } public function fetch_currency($id){ $this->db->select('currency'); $this->db->from('product_details'); $this->db->where('id',$id); $query=$this->db->get(); $ret = $query->row(); return $ret->currency; } public function preview_input_suborder($subOrderID) { $this->db->select('sub_orders.orderId,sub_order_shades.unitPrice,sub_orders.product_id,sub_orders.subCode,sub_orders.width,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_order_shades.ourShade,sub_order_shades.buyerShade,sub_order_shades.skuNo,sub_orders.subOrderType,sub_orders.description,sub_orders.totalQuantity,sub_orders.deliveryMode,sub_order_shades.quantity,sub_orders.unit,sub_order_shades.foreignValue'); $this->db->order_by('sub_orders.subCode','asc'); $this->db->from('sub_orders'); $this->db->where('sub_orders.orderId', $subOrderID); $this->db->where('status',0); $this->db->group_by('sub_orders.subCode'); // $this->db->where('sub_order_shades.add_suborder',1); $this->db->join('sub_order_shades', 'sub_orders.id = sub_order_shades.subOrderId'); $query = $this->db->get(); return $query->result(); } public function input_shades_input_suborder($subOrderID) { $this->db->select('sub_orders.orderId,sub_order_shades.unitPrice,sub_orders.product_id,sub_orders.subCode,sub_orders.width,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_order_shades.ourShade,sub_order_shades.buyerShade,sub_order_shades.skuNo,sub_orders.subOrderType,sub_orders.description,sub_orders.totalQuantity,sub_orders.deliveryMode,sub_order_shades.quantity,sub_orders.unit,sub_order_shades.foreignValue'); $this->db->order_by('sub_orders.subCode','asc'); $this->db->from('sub_orders'); $this->db->where('sub_orders.orderId', $subOrderID); $this->db->where('status',0); // $this->db->where('sub_order_shades.add_suborder',1); $this->db->join('sub_order_shades', 'sub_orders.id = sub_order_shades.subOrderId'); $query = $this->db->get(); return $query->result(); } public function fetch_subid($id){ $this->db->select('id'); $this->db->from('sub_orders'); $this->db->where('orderId', $id); $query=$this->db->get(); $ret = $query->row(); return $ret->id; } public function display_madeups_planned_group_id_embroidryinspections($table) { //$this->db->distinct(); $this->db->select('*'); $this->db->order_by('id'); //$this->db->group_by('article', 'size', 'shade','design'); $this->db->from($table); // $this->db->where('pklist_id',1); $query=$this->db->get(); return $query->result(); } public function fetch_madeups_planned($size,$article,$shades,$design) { $this->db->select('SUM(quantity) as quantity'); $this->db->group_by(['article', 'width', 'buyerShade','design']); $this->db->from('madeups_billing'); $this->db->where('width',$size); $this->db->where('article',$article); $this->db->where('buyerShade',$shades); $this->db->where('design',$design); // $this->db->where('pklist_id','1'); $query=$this->db->get(); // print_r($this->db->last_query()); // die(); return $query->row(); } public function getsuborder_all($id) { $this->db->select('so.*,o.oslNo'); $this->db->from('sub_orders so'); $this->db->join('orders o', 'o.id = so.orderID'); $this->db->where('o.oslNo',$id); $query = $this->db->get(); //print_r($this->db->last_query()); //die(); return $query->result(); } public function input_preview_input_suborder_workorder($subOrderID) { $this->db->select('sub_order_shades.shadeID as id,o.oslNo,sub_orders.subCode,sub_orders.width,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_order_shades.ourShade,sub_order_shades.buyerShade,sub_order_shades.skuNo,sub_orders.subOrderType,sub_orders.description,sub_order_shades.quantity,sub_orders.deliveryMode,sub_order_shades.quantity,sub_orders.unit,sub_order_shades.foreignValue,shade_master.shadeName,planned_order.warpPlandMtr,planned_order.weftPlandMtr,planned_order.selWidth'); $this->db->order_by('sub_orders.subCode','asc'); $this->db->from('sub_orders'); $this->db->join('orders o', 'o.id = sub_orders.orderID'); $this->db->group_by('sub_order_shades.shadeID'); $this->db->where('sub_orders.status',0); $this->db->where('o.oslNo',$subOrderID); // $this->db->where('sub_order_shades.add_suborder',1); $this->db->join('sub_order_shades', 'sub_orders.id = sub_order_shades.subOrderId'); $this->db->join('planned_order', 'sub_order_shades.shadeID = planned_order.subNo'); // $this->db->join('orders', 'sub_orders.orderId = orders.id'); //$this->db->join('weaving_panel_planning_order', 'orders.id = weaving_panel_planning_order.order_id'); $this->db->join('shade_master', 'shade_master.shadeID = planned_order.sslShade'); $query = $this->db->get(); //print_r($this->db->last_query()); //die(); return $query->result(); } public function getsuborder_data($id) { $this->db->select('sub_order_shades.shadeID as id,sub_orders.orders_Type,o.orderType,o.oslNo,sub_orders.subCode,sub_orders.width,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_order_shades.ourShade,sub_order_shades.buyerShade,sub_order_shades.skuNo,sub_orders.subOrderType,sub_orders.description,sub_orders.totalQuantity,sub_orders.deliveryMode,sub_order_shades.quantity,sub_orders.unit,sub_order_shades.foreignValue,shade_master.shadeName,planned_order.warpPlandMtr,planned_order.weftPlandMtr,planned_order.selWidth'); $this->db->order_by('sub_orders.subCode','asc'); $this->db->from('sub_orders'); $this->db->join('orders o', 'o.id = sub_orders.orderID'); $this->db->group_by('sub_order_shades.shadeID'); $this->db->where('sub_orders.status',0); $this->db->where('sub_order_shades.shadeID',$id); // $this->db->where('sub_order_shades.add_suborder',1); $this->db->join('sub_order_shades', 'sub_orders.id = sub_order_shades.subOrderId'); $this->db->join('planned_order', 'sub_order_shades.shadeID = planned_order.subNo'); // $this->db->join('orders', 'sub_orders.orderId = orders.id'); //$this->db->join('weaving_panel_planning_order', 'orders.id = weaving_panel_planning_order.order_id'); $this->db->join('shade_master', 'shade_master.shadeID = planned_order.sslShade'); $query = $this->db->get(); //print_r($this->db->last_query()); //die(); return $query->result(); } } ?>