EVOLUTION-NINJA
Edit File: Madeups_model.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class madeups_model extends CI_Model { public function __construct() { parent::__construct(); } public function insert($table,$data) { $this->db->insert($table,$data); } public function insert_data($table,$data) { $this->db->insert($table,$data); return $this->db->insert_id(); } public function fetch_where_data($table) { $this->db->select("*"); $this->db->from($table); $query = $this->db->get(); return $query->result(); } public function fetch_where_design_details_data($table) { $this->db->select("*"); $this->db->order_by('designmp','asc'); $this->db->from($table); $query = $this->db->get(); return $query->result(); } public function get_data($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function Getsearch_pono_partly($keyword) { $this->db->distinct(); $this->db->select('o.oslNo'); $this->db->like("o.oslNo", $keyword); $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->where('so.subOrderType !=', 'FABRIC'); // $this->db->where('pm.issue_status', 'PARTLY'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->result(); } public function get_asc_data($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 max_select_maximum_id($table) { $this->db->select_max('id'); $this->db->from($table); $query = $this->db->get(); return $query->row(); } public function planned_details() { $this->db->select('pm.id,o.oslNo,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'); $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->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->result_array(); } public function no_planned_details() { $this->db->select('pm.id,pm.issued_for,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'); $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->where('pm.confirm', 'No'); $this->db->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->result_array(); } public function yes_planned_details() { $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.issue_approved_by,pm.issue_approved_date'); $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->where('pm.confirm', 'Yes'); $this->db->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->result_array(); } public function get_customerdata($val) { $this->db->select('pm.id,o.oslNo,o.deliveryDate,s_m.shadeName,pm.pieceLength,so.subOrderType,so.unit,so.articleNo,so.quality,so.design,so.description,sos.buyerShade,sos.quantity,so.width,sos.issue_stock'); $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->where('pm.id', $val); $query = $this->db->get(); return $query->row(); } public function get_issue_purchase_table_madeups_consum_selected_data($g) { // $this->db->distinct('indent_cs_goods_details.po_id'); $this->db->select('indent_po.*,indent_cs_goods_details.consumed_at,indent_cs_goods_details.received_date'); $this->db->from('indent_cs_goods_details'); $this->db->join('indent_po','indent_cs_goods_details.po_list_id=indent_po.id'); $this->db->where('indent_po.id',$g); $query=$this->db->get(); return $query->row(); } public function serch_planned_details($id) { $this->db->select('pm.id,o.oslNo,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'); $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->where('pm.id', $id); $query = $this->db->get(); return $query->row(); } public function Getsearch_pono($keyword) { $this->db->distinct(); $this->db->select('o.oslNo'); $this->db->like("o.oslNo", $keyword); $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->where('so.subOrderType !=', 'FABRIC'); $this->db->where('pm.issue_status', 'PARTLY'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->result(); } public function get_search_customerdata($where) { $this->db->select("*"); $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->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $this->db->where('o.oslNo',$where); $query = $this->db->get(); return $query->row(); } public function delivery_rec_qua($table,$where) { $this->db->select_sum('received_qty'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function delivery_batch_no($table) { $this->db->select_max('batch_id'); $this->db->from($table); $query = $this->db->get(); return $query->row(); } public function get_data_customer($table) { $this->db->select("*"); $this->db->from($table); $query = $this->db->get(); return $query->result(); } public function add_stock_planned_details($osl) { $this->db->select('pm.id,o.oslNo,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'); $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->where('o.oslno_id', $osl); $this->db->where('pm.confirm', 'No'); $this->db->where('so.subOrderType !=', 'FABRIC'); $this->db->where('pm.issue_status', 'PARTLY'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->result_array(); } public function add_stock_planned_details1($osl) { $this->db->select('pm.id,o.oslNo,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'); $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->where('o.oslno_id', $osl); $this->db->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->result_array(); } public function add_stock_value_planned_details($osl) { $this->db->select('sos.buyer_product_name,sos.vendor_item,sos.barcode,p_d.composition,p_d.hsn_code,p_d.dbk_si,p_d.p_category,p_d.hs_code,p_d.customs_declaration,p_d.custom_description,pm.id,o.oslNo,o.deliveryDate,so.unit,s_m.shadeName,o.fileNo,sos.skuNo,pm.pieceLength,so.subOrderType,so.articleNo,so.quality,so.design,so.description,sos.buyerShade,sos.quantity,so.width,sos.issue_stock,sos.consumable_stock,p_d.net_wt,p_d.gross_wt,p_d.box_dimention,p_d.piececase,so.description'); $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('product_details p_d', 'so.product_id = p_d.id','left'); $this->db->where('pm.id', $osl); $query = $this->db->get(); return $query->row(); } public function cons_no_planned_details() { $this->db->select('pm.id,o.fileNo,o.oslNo,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.cons_confirm,pm.consumable_issue_status'); $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->where('pm.cons_confirm','No'); $this->db->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->result_array(); } public function cons_yes_planned_details() { $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.cons_confirm,pm.consumable_issue_status,pm.cons_approved_by,pm.cons_approved_date'); $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->where('pm.cons_confirm','Yes'); $this->db->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->result_array(); } public function no_planned_planned_details() { $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'); $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->where('pm.confirm', 'No'); $this->db->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->result_array(); } public function add_stock_planned_planned_details1($osl,$po) { $this->db->select('pm.id,o.oslNo,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,p_d.piececase,p_d.net_wt,p_d.gross_wt,p_d.box_dimention,so.no_boxes'); $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('product_details p_d', 'so.product_id = p_d.id','left'); $this->db->where('o.oslno_id', $osl); $this->db->where('o.oslNo', $po); //$this->db->where('pm.confirm', 'No'); $this->db->where('so.subOrderType !=', 'FABRIC'); // $this->db->where('pm.issue_status', 'PARTLY'); $this->db->where('sos.planningStatus','planned'); $this->db->order_by('pm.id','DESC'); $query = $this->db->get(); return $query->result_array(); } public function order_list_details($table,$f) { $this->db->select("orders.*,sub_orders.orders_Type,sub_order_shades.planned_by,sub_order_shades.planningStatus,orders.currency,sub_orders.contractType,sub_order_shades.planned_status"); $this->db->from("orders"); $this->db->join("sub_orders","orders.id=sub_orders.orderID","INNER JOIN"); $this->db->join("sub_order_shades","sub_order_shades.subOrderID =sub_orders.id","INNER JOIN"); $this->db->where("orders.orderType",$f); $this->db->where("sub_orders.orders_Type",'MADEUPS'); $this->db->where("orders.shipped_fun",0); //$this->db->where("orders.deliveryDate BETWEEN '$from_date1' AND '$end_date1'"); $this->db->group_by("sub_orders.orderID"); $this->db->order_by("orders.id", "DESC"); $query= $this->db->get(); // print_r($this->db->last_query()); // die(); $result1= $query->result(); $array=array(); foreach($result1 as $result) { $data['id']=$result->id; $data['oslNo']=$result->oslNo; $data['fileNo']=$result->fileNo; $data['orderMode']=$result->orderMode; $data['orderNo']=$result->orderNo; $this->db->select('SUM(sub_orders.totalValue) as value,SUM(sub_orders.totalQuantity) as qnty,SUM(sub_orders.indianValue) as indian'); $this->db->from('sub_orders'); $this->db->where('sub_orders.orderID',$result->id); //$this->db->join("sub_order_shades","sub_order_shades.subOrderID =sub_orders.id","INNER JOIN"); $query= $this->db->get(); $sumvalues= $query->row(); $data['qnty']=$sumvalues->qnty; $data['orders_Type']=$result->orders_Type; $data['value']=round($sumvalues->value,2); $data['currency']=$result->currency; $data['indian']=round($sumvalues->indian,2); $data['deliveryDate']=$result->deliveryDate; $data['preview1']=$result->preview1; $data['preview2']=$result->preview2; $data['preview3']=$result->preview3; $data['confirm_status']=$result->confirm_status; $data['planningStatus']=$result->planningStatus; $data['shipped_fun']=$result->shipped_fun; $data['shipping_name']=$result->shipping_name; $data['contractType']=$result->contractType; $data['planned_status']=$result->planned_status; array_push($array, $data); } return $array; } 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,product_details.net_wt,product_details.gross_wt,product_details.box_dimention,product_details.piececase'); //$this->db->order_by('sub_orders.id','asc'); $this->db->order_by('sub_order_shades.shadeID','asc'); $this->db->from('sub_orders'); $this->db->join('sub_order_shades', 'sub_orders.id = sub_order_shades.subOrderId'); $this->db->join('product_details', 'sub_orders.product_id = product_details.id','left'); $this->db->where('sub_orders.orderID', $id); $this->db->where("sub_orders.orders_Type",'MADEUPS'); $this->db->where('status', 0); $query = $this->db->get(); // print_r($this->db->last_query()); return $query->result(); } public function getsuborder_update_new($id) { $this->db->select('sub_orders.orderID,sub_orders.id 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,product_details.net_wt,product_details.gross_wt,product_details.box_dimention,product_details.piececase'); //$this->db->order_by('sub_orders.id','asc'); $this->db->order_by('sub_order_shades.shadeID','asc'); $this->db->from('sub_orders'); $this->db->join('sub_order_shades', 'sub_orders.id = sub_order_shades.subOrderId'); $this->db->join('product_details', 'sub_orders.product_id = product_details.id','left'); $this->db->where('sub_orders.orderID', $id); $this->db->where("sub_orders.orders_Type",'MADEUPS'); $this->db->where('status', 0); $query = $this->db->get(); // print_r($this->db->last_query()); return $query->result(); } public function list_details($id,$f) { //$this->db->select('pm.id,o.id,so.orders_Type,o.oslNo,so.unit,s_m.shadeName,pm.pieceLength,o.fileNo,so.subOrderType,so.articleNo,so.quality,so.design,so.description,sos.skuNo,sos.buyerShade,sos.quantity,so.width,sos.issue_stock,sos.consumable_stock,p_d.piececase,p_d.net_wt,p_d.gross_wt,p_d.box_dimention,so.description'); // $this->db->select('pm.id,o.id,so.orders_Type,o.oslNo,so.unit,o.fileNo,so.subOrderType,so.articleNo,so.quality,so.design,so.description,sos.skuNo,sos.buyerShade,sos.quantity,so.width,sos.issue_stock,sos.consumable_stock,p_d.piececase,p_d.net_wt,p_d.gross_wt,p_d.box_dimention,so.description,sos.ourShade as shadeName'); // $this->db->from('sub_orders so'); // $this->db->order_by('so.subCode','asc'); // $this->db->join('orders o', 'so.orderID = o.id'); // $this->db->join('sub_order_shades sos', 'so.id = sos.subOrderId'); // $this->db->join('planned_order pm', 'sos.shadeID = pm.subNo'); // $this->db->join('product_details p_d', 'so.product_id = p_d.id','left'); // //$this->db->join('shade_master s_m', 'pm.sslShade=s_m.shadeID'); // $this->db->where("so.orders_Type",'MADEUPS'); // $this->db->where("o.id",$id); // $query = $this->db->get(); // print_r($this->db->last_query()); //return $query->result(); $this->db->select('sos.buyer_product_name,sos.vendor_item,sos.barcode,p_d.composition,p_d.hsn_code,p_d.dbk_si,p_d.p_category,p_d.hs_code,p_d.customs_declaration,p_d.custom_description,pm.id,so.orders_Type,o.oslNo,so.unit,s_m.shadeName,pm.pieceLength,o.fileNo,so.subOrderType,so.articleNo,so.quality,so.design,so.description,sos.skuNo,sos.buyerShade,sos.quantity,so.width,sos.issue_stock,sos.consumable_stock,p_d.piececase,p_d.net_wt,p_d.gross_wt,p_d.box_dimention,so.description'); $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('product_details p_d', 'so.product_id = p_d.id','left'); //$this->db->join('madeups_product_shades m_p_s', 'p_d.id = m_p_s.product_id','left'); //$this->db->where("m_p_s.buyer_shade",'sos.buyerShade'); $this->db->where("so.orders_Type",'MADEUPS'); $this->db->where("o.id",$id); $query= $this->db->get(); //print_r($this->db->last_query()); // die(); return $query->result(); // $this->db->select('pm.id,so.orders_Type,o.oslNo,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,p_d.piececase,p_d.net_wt,p_d.gross_wt,p_d.box_dimention'); // //$this->db->select('so.*'); // $this->db->from('sub_orders so'); // $this->db->join('orders o', 'so.orderID = o.id'); // $this->db->join('sub_order_shades sos', 'so.id = sos.subOrderId'); // //$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('product_details p_d', 'so.product_id = p_d.id','left'); // $this->db->where('so.orderID', $id); // $this->db->where("so.orders_Type",'MADEUPS'); // $this->db->where('so.status', 0); // $this->db->order_by('so.subCode','asc'); // $query = $this->db->get(); // //print_r($this->db->last_query()); // // die(); // //print_r($this->db->last_query()); // return $query->result(); } public function fetch_billing($table,$id){ $this->db->select('*'); $this->db->from($table); $this->db->where('id',$id); $query = $this->db->get(); return $query->result(); } public function get_cust_id($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 check_if_planned($id) { $this->db->select('pm.id'); $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('product_details p_d', 'so.product_id = p_d.id','left'); $this->db->where("so.orders_Type",'MADEUPS'); $this->db->where("o.id",$id); $query= $this->db->get(); $ret = $query->row(); return $ret->id; } public function fetch_sub_no($table,$where){ $this->db->select('subNo'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); $ret = $query->row(); return $ret->subNo; } public function insert_status($table,$where,$data){ $this->db->where($where); $this->db->set($data); $this->db->update($table); return $data; } public function fetch_madeups_planned_id($id) { $this->db->select('pm.id'); $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('product_details p_d', 'so.product_id = p_d.id','left'); $this->db->where("so.orders_Type",'MADEUPS'); $this->db->where("o.id",$id); $query= $this->db->get(); return $query->result(); } public function delete_row_data($table,$where){ $this->db->where($where); $this->db->delete($table); return $table; } public function fetch_where_data_row($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function get_workorder_data() { $this->db->select('wo.*,sum(f_wo.f_issue_mtrs) as sum_mts,sum(f_wo.est_pcs) as sum_est_pcs,(select sum(rec_mtrs) as sum_rec_mts from wo_inspection_details where work_order_id = f_wo.id) as sum_rec_mts,(select sum(rec_pcs) as sum_rec_pcs from wo_inspection_details where work_order_id = f_wo.id) as sum_rec_pcs'); $this->db->from('madeups_work_order wo'); $this->db->join('fabric_madeups_workorder f_wo', 'wo.id = f_wo.plan_id','left'); //$this->db->join('wo_inspection_details wo_details', 'f_wo.id = wo_details.work_order_id','left'); $this->db->group_by('wo.id'); $this->db->order_by('wo.id','DESC'); //$this->db->join('product_details p_d', 'so.product_id = p_d.id','left'); $this->db->where("wo.wo_number !=",''); $this->db->where("wo.delete_status",'0'); //$this->db->where("f_wo.issued_for",'Main Fabric'); $query= $this->db->get(); //print_r($this->db->last_query()); //die(); return $query->result(); } public function get_workorder_data_old() { $this->db->select('wo.*,sum(f_wo.f_issue_mtrs) as sum_mts,sum(f_wo.est_pcs) as sum_est_pcs,sum(wo_details.rec_mtrs) as sum_rec_mts,sum(wo_details.rec_goods) as sum_rec_pcs'); $this->db->from('madeups_work_order wo'); $this->db->join('fabric_madeups_workorder f_wo', 'wo.id = f_wo.plan_id','left'); //$this->db->join('wo_inspection_details wo_details', 'f_wo.id = wo_details.work_order_id','left'); $this->db->group_by('wo.id'); $this->db->order_by('wo.id','DESC'); //$this->db->join('product_details p_d', 'so.product_id = p_d.id','left'); $this->db->where("wo.wo_number !=",''); $this->db->where("wo.delete_status",'0'); //$this->db->where("f_wo.issued_for",'Main Fabric'); $query= $this->db->get(); print_r($this->db->last_query()); die(); return $query->result(); } public function get_workorder_data_subgrid($id) { $this->db->select('wo.*,sum(f_wo.rec_mtrs) as sum_rec_mtrs,m_wo.complete as comp,sum(f_wo.processed_mtrs) as sum_processed_mtrs,sum(f_wo.rec_pcs) as sum_est_pcs,sum(f_wo.rec_weight) as sum_rec_weight,sum(f_wo.vari_e_width) as sum_variance'); $this->db->from('fabric_madeups_workorder wo'); $this->db->join('madeups_work_order m_wo', 'wo.plan_id = m_wo.id','left'); $this->db->join('wo_inspection_details f_wo', 'wo.id = f_wo.work_order_id','left'); $this->db->group_by('wo.id'); $this->db->where("wo.plan_id",$id); $this->db->order_by('wo.id','DESC'); //$this->db->join('product_details p_d', 'so.product_id = p_d.id','left'); $query= $this->db->get(); //print_r($this->db->last_query()); return $query->result(); } public function get_workorder_data_subgrid_inword($id) { $this->db->select('wo.*,f_wo.rec_mtrs as sum_rec_mtrs,f_wo.rec_width as sum_width,f_wo.processed_mtrs as sum_processed_mtrs,f_wo.rec_pcs as sum_est_pcs,f_wo.rec_weight as sum_rec_weight,f_wo.vari_e_width as sum_variance,f_wo.type_recieved,f_wo.invoice,f_wo.received_date'); $this->db->from('fabric_madeups_workorder wo'); //$this->db->join('fabric_inspection_details f_wo', 'wo.id = f_wo.work_order_id','left'); $this->db->join('wo_inspection_details f_wo', 'wo.id = f_wo.work_order_id'); //$this->db->group_by('wo.id'); $this->db->where("wo.plan_id",$id); $this->db->order_by('wo.id','DESC'); //$this->db->join('product_details p_d', 'so.product_id = p_d.id','left'); $query= $this->db->get(); //print_r($this->db->last_query()); return $query->result(); } public function Get_search_dtl($keyword) { $this->db->distinct(); $this->db->select('oslNo'); //$this->db->order_by('customer_name', 'DESC'); $this->db->like("oslNo", $keyword); $this->db->from('orders'); $query= $this->db->get(); return $query->result(); } public function Get_search_workorder($keyword) { $this->db->distinct(); $this->db->select('wo_number'); //$this->db->order_by('customer_name', 'DESC'); $this->db->like("wo_number", $keyword); $this->db->from('madeups_work_order'); $query= $this->db->get(); return $query->result(); } } ?>