EVOLUTION-NINJA
Edit File: Vendor_model.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Vendor_model extends CI_Model { public function __construct() { parent::__construct(); $this->load->database(); } public function insert_access($table,$data) { $this->db->insert($table,$data); return $this->db->insert_id(); } public function insert($table,$data) { $this->db->insert($table,$data); } public function fetch_where_osl_data($table) { $this->db->select("*"); $this->db->order_by('oslno_id','asc'); $this->db->from($table); $this->db->where('oslno_id !=',''); $query = $this->db->get(); return $query->result(); } public function group_get_where_a_dataa($table,$where) { $this->db->select('*'); $this->db->group_by('box_id'); $this->db->group_by('article'); $this->db->order_by('id','asc'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function get_customerdata_group($table,$where) { $this->db->select('*'); $this->db->group_by('orderNo'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function history_data_fetch_po($table) { $this->db->select('*'); $this->db->order_by('po_id','desc'); $this->db->from($table); $this->db->where('department !=', ' '); $query=$this->db->get(); return $query->result(); } public function fetch_where_subgrid_data_history_data() { $this->db->select('*'); $this->db->order_by('finishing_embroidry.work_order_num','desc'); $this->db->from('finishing_embroidry'); $this->db->join('finishing_embroidry_stock', 'finishing_embroidry_stock.fin_emb_id = finishing_embroidry.id'); $this->db->where('finishing_embroidry.status','1'); $query = $this->db->get(); return $query->result(); } public function group_get_where_b_dataa($table,$where) { $this->db->select('*'); //$this->db->group_by('box_id'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function sum_get_receive_customerdata_qty($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 fetch_dese($u,$s,$p,$b,$a) { $this->db->select('sub_orders.*'); $this->db->from('indent_po'); $this->db->join('indent_add_indent', 'indent_add_indent.id= indent_po.indent_id'); $this->db->join('orders', 'indent_add_indent.purpose= orders.oslNo'); $this->db->join('sub_orders', 'orders.id= sub_orders.orderID'); $this->db->join('sub_order_shades', 'sub_orders.id= sub_order_shades.subOrderID'); $this->db->where('indent_po.po_no',$p); //$this->db->where('indent_po.width',$u); $this->db->where('indent_po.shades',$s); //$this->db->where('sub_orders.articleNo',$a); $this->db->where('sub_order_shades.buyerShade',$b); $query=$this->db->get(); return $query->row(); } public function fetch_des($b,$p,$w,$a) { $this->db->select('sub_orders.*'); $this->db->from('orders'); $this->db->join('sub_orders', 'orders.id= sub_orders.orderID'); $this->db->join('sub_order_shades', 'sub_orders.id= sub_order_shades.subOrderID'); $this->db->where('orders.oslNo',$p); //$this->db->where('sub_orders.width',$w); $this->db->where('sub_orders.articleNo',$a); $this->db->where('sub_order_shades.buyerShade',$b); $query=$this->db->get(); return $query->row(); } public function get_issue_purchase_table_madeups_consum_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.product_type','Consumables'); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.total_quantity !=','0.00'); $this->db->where('indent_cs_goods_details.consumed_at',$g); $query=$this->db->get(); return $query->result(); } public function sum_get_rec_qty_weaving_sum_customerdata($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 sum_get_est_pcs_weaving_sum_customerdata($table,$where) { $this->db->select_sum('est_pcs'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function outsource_getordershade_planned($shadeID) { $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->from('sub_order_shades'); $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_order_shades.shadeID',$shadeID); $query = $this->db->get(); return $query->row(); } public function sum_get_rec_sck_weaving_sum_customerdata($table,$where) { $this->db->select_sum('rec_work_order_dyed_qua'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function sum_get_rec_deg_weaving_sum_customerdata($table,$where) { $this->db->select_sum('degum_loss'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function sum_get_rec_deg_per_weaving_sum_customerdata($table,$where) { $this->db->select_sum('degum_loss_per'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function max_select_prefix_goods($table,$where) { $this->db->select_max('design'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function marketing_notification_confirm_get_details($where) { $this->db->select('orders.*,sub_orders.*'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->where('sub_orders.orderConfirmDate',$where); $this->db->where('orders.approval_notification_status',0); $query=$this->db->get(); return $query->result(); } public function marketing_notification_confirmgetsuborder($where) { $this->db->select('*'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->where('sub_orders.orderConfirmDate',$where); $query = $this->db->get(); return $query->num_rows(); } public function marketing_notification_confirm_getsuborder($where) { $this->db->select('*'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->where('sub_orders.orderConfirmDate',$where); $this->db->where('orders.approval_notification_status',0); $query = $this->db->get(); return $query->num_rows(); } public function update_confirm_indent_packing_madeups($data,$where) { $this->db->where($where); $this->db->update('madeups_list_data',$data); } public function sum_get_receive_customerdata($table,$where) { $this->db->select_sum('received_qty_ref'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function get_sl_data1($table,$where) { $this->db->select('*'); $this->db->group_by('sl_indent_no'); $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_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_data_customer($table) { $this->db->select("*"); $this->db->from($table); $query = $this->db->get(); return $query->result(); } public function sum_get_customerdata($table,$where) { $this->db->select_sum('stock_wt'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function sum_get_customerdata_new11($table,$where) { $this->db->select_sum('stock_qty'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function sum_amount_get_customerdata($table,$where) { $this->db->select_sum('values_es'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function get_data21($table,$where) { $this->db->select('*'); $this->db->group_by('sl_indent_no'); $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($table) { $this->db->select("*"); $this->db->from($table); $query = $this->db->get(); return $query->result(); } public function get_where_prefix_result($table,$where) { $this->db->select('prefix_name'); $this->db->distinct('prefix_name'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function fetch_where_product_data($table) { $this->db->select("*"); $this->db->from($table); $this->db->order_by("UPPER(product)", "asc"); $query = $this->db->get(); return $query->result(); } public function get_data($table,$where) { $this->db->select('*'); //$this->db->order_by('name','asc'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function get_data_desc($table,$where) { $this->db->select('*'); $this->db->group_by('sl_indent_no'); $this->db->order_by('id','desc'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function geting_data($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $this->db->order_by("product", "asc"); $query=$this->db->get(); return $query->result(); } public function fetch_where_cs_net_quantity_total($table,$where) { $this->db->select_sum('net_weight'); //$this->db->select('quantity'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function get_purchase_data1($table) { $this->db->select('indent_po.id,indent_add_indent.color_code,indent_po.po_no,indent_po.vendor_name,indent_po.shades,indent_po.quantity,indent_po.total_quantity,indent_po.balanced_quantity,indent_po.g_date,indent_po.currency,indent_po.confirm,indent_po.approved_by,indent_po.remark,indent_po.grand_total'); $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->join('indent_add_indent', 'indent_add_indent.id = indent_po.indent_id'); $this->db->from($table); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.product_type','Yarn - Dyed'); $query=$this->db->get(); return $query->result(); } public function get_data1($table,$where) { $this->db->select('*'); $this->db->group_by('sl_indent_no'); $this->db->order_by('id'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function Get($keyword) { $this->db->distinct(); $this->db->select('product'); $this->db->order_by('id', 'DESC'); $this->db->like("product", $keyword); $this->db->from('indent_product'); $query= $this->db->get(); return $query->result(); } public function get_customerdata($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function get_customerdata_fabric($table,$where,$financial_year) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $this->db->where('financ_year',$financial_year); $query = $this->db->get(); return $query->row(); } public function getsuborder1($id) { $this->db->select('*'); $this->db->from('indent_add_indent'); //$this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.subCode'); $this->db->where('sl_indent_no', $id); $this->db->where('confirm', 'No'); $query = $this->db->get(); return $query->result(); } public function get_where_data($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); $arr=array(); foreach($query->result() as $row) { $arr[]=$row; } $json=json_encode($arr); return $json; } public function Getsearch($keyword) { $this->db->distinct(); $this->db->select('product'); //$this->db->order_by('customer_name', 'DESC'); $this->db->like("product", $keyword); $this->db->from('indent_product'); $query= $this->db->get(); return $query->result(); } public function Getsearch_pono($keyword) { $this->db->distinct(); $this->db->select('po_no'); //$this->db->order_by('customer_name', 'DESC'); $this->db->like("po_no", $keyword); $this->db->from('indent_po'); $this->db->where('confirm', 'Yes'); $this->db->where('product_type', 'Fabrics'); $query= $this->db->get(); return $query->result(); } public function get_productname_pono($keyword) { $this->db->select('indent_product.product as proname'); //$this->db->order_by('customer_name', 'DESC'); $this->db->from('indent_po'); $this->db->join('indent_product','indent_product.id = indent_po.product_id','left'); $this->db->where("indent_po.id", $keyword); $query= $this->db->get(); return $query->row(); } public function yarn_raw_Getsearch_pono($keyword,$status) { $this->db->distinct(); $this->db->select('po_no'); $this->db->like("po_no", $keyword); $this->db->from('indent_po'); //$this->db->where('confirm','Yes'); $this->db->or_where_in('product_type', $status); $this->db->where('confirm','Yes'); $query= $this->db->get(); return $query->result(); } public function cs_received_Getsearch_pono($keyword,$status) { $this->db->distinct(); $this->db->select('po_no'); $this->db->like("po_no", $keyword); $this->db->from('indent_po'); $this->db->or_where_in('product_type', $status); $query= $this->db->get(); return $query->result(); } public function Get_search($keyword) { $this->db->distinct(); $this->db->select('name'); //$this->db->order_by('customer_name', 'DESC'); $this->db->like("name", $keyword); $this->db->from('indent_vendor_master'); $query= $this->db->get(); return $query->result(); } public function Get_search_name($keyword) { $this->db->distinct(); $this->db->select('name'); //$this->db->order_by('customer_name', 'DESC'); $this->db->like("name", $keyword); $this->db->from('outsource_vendor_master'); $query= $this->db->get(); return $query->result(); } public function max_select_indent_no($table) { $this->db->select_max('sl_indent_no'); $this->db->from($table); $query = $this->db->get(); return $query->row(); } public function max_select_indent_no_id($table) { $this->db->select_max('id'); $this->db->from($table); $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 delete_product_vendor($where){ $this->db->where($where); $this->db->delete('indent_product'); return; } public function delete_vendor($table,$where){ $this->db->where($where); $this->db->delete($table); return; } public function max_select_purchase_no($table) { $this->db->select_max('po_id'); $this->db->from($table); $query = $this->db->get(); return $query->row(); } public function max_select_goods($table) { $this->db->select_max('invoice_no_id'); $this->db->from($table); $query = $this->db->get(); return $query->row(); } public function Getsearch_auto($keyword,$where) { $this->db->distinct(); $this->db->select('indent_no'); $this->db->like("indent_no", $keyword); $this->db->from('indent_add_indent'); $this->db->where($where); $query= $this->db->get(); return $query->result(); } public function Getsearch_vendorname_auto($keyword) { $this->db->distinct(); $this->db->select('name'); $this->db->order_by('name','asc'); $this->db->like("name", $keyword); $this->db->from('indent_vendor_master'); $query= $this->db->get(); return $query->result(); } public function Getsearch_shade_auto($keyword) { $this->db->distinct(); $this->db->select('color'); $this->db->like('color', $keyword); $this->db->from('color_master'); $query= $this->db->get(); return $query->result(); } public function update_new($data,$where) { $this->db->where($where); $this->db->update('indent_add_indent',$data); } public function update_confirm_purchase($data,$where) { $this->db->where($where); $this->db->update('indent_purchase_order',$data); } public function get_where_dataa($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function get_where_dataa_order($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $this->db->order_by('madeups_invoice_packing.id','ASC'); $query=$this->db->get(); return $query->result(); } public function getsuborder($id) { $this->db->select('*'); $this->db->from('indent_add_indent'); //$this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.subCode'); $this->db->where('sl_indent_no', $id); $query = $this->db->get(); return $query->result(); } public function get_group_invoice_customerdata($table,$where) { $this->db->select("*"); $this->db->group_by(['shades','article','width']); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function getproduct_details($po_id) { $this->db->select('*'); $this->db->from('indent_po'); $this->db->join('indent_product', 'indent_product.product = indent_po.product_name'); $this->db->where('indent_po.po_id', $po_id); //$this->db->where('indent_product.product','indent_po.product_name'); //$this->db->where('indent_product.product_type','indent_po.product_type'); $query = $this->db->get(); return $query->result(); } public function getpurchaseorder($id) { $this->db->select('*'); $this->db->from('indent_purchase_order'); //$this->db->join('sub_order_shades', 'sub_order_shades.subOrderID = sub_orders.subCode'); $this->db->where('sl_no', $id); $query = $this->db->get(); return $query->result(); } public function fetch_where_subgrid_data($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function fetch_where_subgrid_data1($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_data_loom($i) { $this->db->select("issue_loom.*,weaving_panel_planning_order.shade"); $this->db->from('issue_loom'); $this->db->join('weaving_panel_planning_order', 'weaving_panel_planning_order.id = issue_loom.weaving_panel_id'); $this->db->where('issue_loom.weaving_panel_id',$i); $query = $this->db->get(); $result= $query->result(); $array = array(); foreach($result as $val) { $data['id'] = $val->id; $data['yarn_name'] = $val->yarn_name; $data['yarn_den'] = $val->yarn_den; $data['yarn_spec'] = $val->yarn_spec; $data['ssl_shade_w'] = $val->ssl_shade_w; $data['dtl_shade'] = $val->dtl_shade; $data['shade'] = $val->yarn_ssl_shade; $data['color_code'] = $val->color_code; $data['yarn_lot'] = $val->yarn_lot; $data['yarn_bale'] = $val->yarn_bale; $data['stock_net_wt'] = $val->stock_net_wt; $data['issue_net_wt'] = $val->issue_net_wt; $data['rements'] = $val->rements; $data['balanced_stock_wt'] = $val->balanced_stock_wt; $data['issued_date'] = $val->issued_date; $data['remarks'] = $val->remarks; $data['add_stock_status'] = $val->add_stock_status; $data['add_stock_val'] = $val->add_stock_val; $data['add_stock_date'] = $val->add_stock_date; $yarn=$val->yarn_ids; if($yarn[0]=='r') { $data['yarn_type'] = 'Raw Yarn'; } else if($yarn[0]=='t') { $data['yarn_type'] = 'Twisted Yarn'; } else if($yarn[0]=='d') { $data['yarn_type'] = 'Dyed Yarn'; } else if($yarn[0]=='s') { $data['yarn_type'] = 'Swan-Dyed Yarn'; } else if($yarn[0]=='rem') { $data['yarn_type'] ='Remnant'; } else { $data['yarn_type'] = ''; } array_push($array,$data); } return $array; } public function fetch_where_subgrid_data_loom_update($i) { $this->db->select("issue_loom.*,weaving_panel_planning_order.shade"); $this->db->from('issue_loom'); //$this->db->join('indent_po', 'indent_po.id = indent_yarn_goods_details.po_list_id'); $this->db->join('weaving_panel_planning_order', 'weaving_panel_planning_order.id = issue_loom.weaving_panel_id'); $this->db->where('issue_loom.weaving_panel_id',$i); $query = $this->db->get(); $result= $query->result(); $array = array(); foreach($result as $val) { $table_id=$val->yarn_ids; // echo $table_id; $arr = preg_match_all('/([0-9]+|[a-zA-Z]+)/',$table_id,$matches); $first_input_field = $matches[0]; $second_input_field = $matches[1]; if($second_input_field[0] == 'd'){ $this->db->select("indent_yarn_goods_details.*,indent_po.purpose,indent_po.product_type"); $this->db->from('indent_yarn_goods_details'); $this->db->join('indent_po', 'indent_po.id = indent_yarn_goods_details.po_list_id'); $this->db->where('indent_yarn_goods_details.id',$second_input_field[1],'indent_yarn_goods_details.lot',$val->yarn_lot,'indent_yarn_goods_details.bale',$val->yarn_bale,'indent_yarn_goods_details.yarndenier',$val->yarn_den,'indent_yarn_goods_details.yarnspecification',$val->yarn_spec,'indent_yarn_goods_details.yarnname',$val->yarn_name); $this->db->where('indent_po.product_type', 'Yarn - Dyed'); $query1 = $this->db->get(); $result1 = $query1->result(); if(count($result1) == 1){ foreach($result1 as $val1) { $data['purpose'] = $val1->purpose; } } else{ $this->db->select("indent_yarn_goods_details.*,indent_po.purpose,indent_po.product_type"); $this->db->from('indent_yarn_goods_details'); $this->db->join('indent_po', 'indent_po.id = indent_yarn_goods_details.po_list_id'); $this->db->where('indent_yarn_goods_details.po_list_id',$second_input_field[1],'indent_yarn_goods_details.lot',$val->yarn_lot,'indent_yarn_goods_details.bale',$val->yarn_bale,'indent_yarn_goods_details.yarndenier',$val->yarn_den,'indent_yarn_goods_details.yarnspecification',$val->yarn_spec,'indent_yarn_goods_details.yarnname',$val->yarn_name); $this->db->where('indent_po.product_type', 'Yarn - Dyed'); $query1 = $this->db->get(); $result1 = $query1->result(); foreach($result1 as $val1) { $data['purpose'] = $val1->purpose; } } } else if($second_input_field[0] == 'r'){ $this->db->select("indent_yarn_goods_details.*,indent_po.purpose,indent_po.product_type"); $this->db->from('indent_yarn_goods_details'); $this->db->join('indent_po', 'indent_po.id = indent_yarn_goods_details.po_list_id'); $this->db->where('indent_yarn_goods_details.id',$second_input_field[1],''); $this->db->where('indent_po.product_type', 'Yarn - Raw'); $query1 = $this->db->get(); $result1 = $query1->result(); foreach($result1 as $val1) { $data['purpose'] = $val1->purpose; } } else if($second_input_field[0] == 't'){ $this->db->select("delivery_yarn_twisting.purpose"); $this->db->from('delivery_yarn_twisting'); $this->db->where('delivery_yarn_twisting.id',$second_input_field[1],''); //$this->db->where('indent_po.product_type', 'Yarn - Raw'); $query1 = $this->db->get(); $result1 = $query1->result(); foreach($result1 as $val1) { $data['purpose'] = $val1->purpose; } } else if($second_input_field[0] == 's'){ $this->db->select("work_order_dyeing.osl_no"); $this->db->from('work_order_dyeing'); $this->db->where('work_order_dyeing.id',$second_input_field[1],''); //$this->db->where('indent_po.product_type', 'Yarn - Raw'); $query1 = $this->db->get(); $result1 = $query1->result(); foreach($result1 as $val1) { $data['purpose'] = $val1->osl_no; } } else{ $data['purpose'] = 'Purpose'; } $data['id'] = $val->id; $data['yarn_name'] = $val->yarn_name; $data['yarn_den'] = $val->yarn_den; $data['yarn_spec'] = $val->yarn_spec; $data['ssl_shade_w'] = $val->ssl_shade_w; $data['dtl_shade'] = $val->dtl_shade; $data['shade'] = $val->yarn_ssl_shade; $data['color_code'] = $val->color_code; $data['yarn_lot'] = $val->yarn_lot; $data['yarn_bale'] = $val->yarn_bale; $data['stock_net_wt'] = $val->stock_net_wt; $data['issue_net_wt'] = $val->issue_net_wt; $data['rements'] = $val->rements; $data['balanced_stock_wt'] = $val->balanced_stock_wt; $data['issued_date'] = $val->issued_date; $data['remarks'] = $val->remarks; $data['add_stock_status'] = $val->add_stock_status; $data['add_stock_val'] = $val->add_stock_val; $data['add_stock_date'] = $val->add_stock_date; $yarn=$val->yarn_ids; if($yarn[0]=='r') { $data['yarn_type'] = 'Raw Yarn'; } else if($yarn[0]=='t') { $data['yarn_type'] = 'Twisted Yarn'; } else if($yarn[0]=='d') { $data['yarn_type'] = 'Dyed Yarn'; } else if($yarn[0]=='s') { $data['yarn_type'] = 'Swan-Dyed Yarn'; } else if($yarn[0]=='rem') { $data['yarn_type'] ='Remnant'; } else { $data['yarn_type'] = ''; } array_push($array,$data); } return $array; } public function update_confirm_indent($data,$where) { $this->db->where($where); $this->db->update('indent_add_indent',$data); } public function fetch_where_subgrid_data2($where,$id1) { $this->db->select('indent_purchase_order.rate_inr,indent_purchase_order.value_inr,indent_add_indent.add_product,indent_add_indent.quantity,indent_add_indent.indent_no'); $this->db->from('indent_add_indent'); $this->db->where('indent_add_indent.sl_indent_no', $where); $this->db->where('indent_purchase_order.id', $id1); $this->db->join('indent_purchase_order', 'indent_purchase_order.sl_indent_no = indent_add_indent.sl_indent_no'); $query = $this->db->get(); return $query->result(); } public function getproducts($type) { $query = $this->db->query('SELECT DISTINCT(product) FROM indent_product where product_type="' . $type .'" ORDER BY product ASC'); return $query->result(); } public function getproductrow($type) { $query = $this->db->query('SELECT * FROM indent_product where id=' . $type); return $query->row(); } public function getunit($type) { $query = $this->db->query('SELECT * FROM indent_product where product="' . $type .'"'); return $query->row(); } public function get_wish_list_data($ids) { $this->db->select('*'); $this->db->from('indent_add_indent'); $this->db->where('id', $ids); $query=$this->db->get(); return $query->row(); } public function get_data_fetch($table,$where) { $this->db->select('*'); // $this->db->group_by('sl_indent_no'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function update_po_list_confirm_purchase($table,$data,$where) { $this->db->where($where); $this->db->update($table,$data); } public function update_fetch_data($val) { $this->db->select('*'); $this->db->from('indent_po'); $this->db->where('id', $val); $query=$this->db->get(); return $query->row(); } public function fetch_where_ot_charges_subgrid_data($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->where($where); $this->db->where('department !=', ' '); $query = $this->db->get(); return $query->result(); } public function fetch_where_ot_charges_subgrid_data55($table,$where) { $this->db->select("indent_po.*,indent_cs_goods_details.received_quality"); $this->db->from($table); $this->db->join('indent_cs_goods_details','indent_cs_goods_details.po_list_id=indent_po.id','left'); $this->db->where($where); $this->db->where('department !=', ' '); $query = $this->db->get(); return $query->result(); } public function fetch_where_ot_charges_subgrid_data_fabric($data1,$financ_year) { $this->db->select("indent_po.*,indent_goods_details.shades po_shade,Sum(indent_goods_details.rec_goods) as rec_goods,indent_goods_details.width po_width"); $this->db->from('indent_po'); //$this->db->join(' indent_product', 'indent_po.product_id = indent_product.id'); $this->db->join('indent_goods_details', 'indent_po.id = indent_goods_details.po_list_id','left'); $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','Yes'); //$this->db->group_by('indent_goods_details.po_list_id'); $query = $this->db->get(); return $query->result(); } public function fetch_where_subgrid_datas1($data1,$financ_year,$confirm) { $this->db->select("indent_po.*,indent_add_indent.quantity indent_qty"); $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 fetch_where_ot_charges_subgrid_data1($table,$where) { $this->db->select("*"); $this->db->from($table); $this->db->join('indent_add_indent', 'indent_add_indent.id = indent_po.indent_id'); $this->db->where($where); $this->db->where('indent_po.department !=', ' '); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.product_type','Yarn - Dyed'); $query = $this->db->get(); return $query->result(); } public function fetch_where_quantity_total($table,$where) { $this->db->select_sum('rec_goods'); //$this->db->select('quantity'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function history_data_fetch($table) { $this->db->select('*'); $this->db->order_by('id'); $this->db->from($table); $this->db->where('department !=', ' '); $query=$this->db->get(); return $query->result(); } public function fetch_where_cs_quantity_total($table,$where) { $this->db->select_sum('gross_weight'); //$this->db->select('quantity'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function getgoods_data($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $this->db->where('department !=', ' '); $query=$this->db->get(); return $query->result(); } public function get_wish_list_dataa($ids) { $this->db->select('*'); $this->db->from('indent_product'); $this->db->join('indent_add_indent', 'indent_add_indent.product_id = indent_product.id'); $this->db->where('indent_add_indent.id', $ids); $query = $this->db->get(); return $query->row(); } public function fetch_where_consum_spares_quantity_total($table,$where) { $this->db->select_sum('received_quality'); //$this->db->select('quantity'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function fetch_total_rec_goods($table,$where) { $this->db->select_sum('rec_goods'); //$this->db->select('quantity'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function fetch_total_yarn_rec_goods($table,$where) { $this->db->select_sum('gross_weight'); //$this->db->select('quantity'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function fetch_total_spares_issue_rec_goods($table,$where) { //$this->db->select_sum('balanced_quantity'); $this->db->select('balanced_quantity'); $this->db->order_by('id',"desc"); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function fetch_total_spares_rec_goods($table,$where) { $this->db->select_sum('received_quality'); //$this->db->select('quantity'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function fetch_total_rec_dyed_goods($table,$where) { $this->db->select_sum('rec_dyed_qua'); //$this->db->select('quantity'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function fetch_total_weaving_fabric_goods($table,$where) { $this->db->select_sum('received_mtrs'); //$this->db->select('quantity'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function access_control_data($table) { $this->db->select('*'); $this->db->from($table); //$this->db->where($where); $this->db->where('parent_id !=', 0); $query=$this->db->get(); return $query->result(); } /////////////////access controlle--------------------------------------------------------------------------------------- public function get_all_menu() { $this->db->select('A.*'); $this->db->from('swansilk_menu A'); $this->db->where('A.parent_id','0'); $this->db->where('A.delete_status','ACTIVE'); $result = $this->db->get(); $result = $result->result(); $array = array(); foreach($result as $val) { $data['menu_id'] = $val->menu_id; $data['menu_name'] = $val->menu_name; $data['parent_id'] = $val->parent_id; $this->db->select('B.*'); $this->db->from('swansilk_menu B'); $this->db->where('B.delete_status','ACTIVE'); $this->db->where('B.parent_id !=','0'); $this->db->where('B.parent_id',$val->menu_id); $menu_result = $this->db->get(); $menu_result = $menu_result->result(); if($menu_result) { $data['sub_menu'] = $menu_result; } else { $data['sub_menu'] = ""; } array_push($array,$data); } return $array; } public function get_all_sub_menu() { $this->db->select('A.*'); $this->db->from('swansilk_menu A'); $this->db->where('A.parent_id >','9'); $this->db->where('A.delete_status','ACTIVE'); $result = $this->db->get(); $result = $result->result(); $array = array(); foreach($result as $val) { $data['menu_id'] = $val->menu_id; $data['menu_name'] = $val->menu_name; $data['parent_id'] = $val->parent_id; $this->db->select('B.*'); $this->db->from('swansilk_menu B'); $this->db->where('B.delete_status','ACTIVE'); $this->db->where('B.parent_id >','9'); $this->db->where('B.parent_id',$val->menu_id); $menu_result = $this->db->get(); $menu_result = $menu_result->result(); if($menu_result) { $data['sub_menu'] = $menu_result; } else { $data['sub_menu'] = ""; } array_push($array,$data); } return $array; } public function get_all_departments() { $this->db->select('*'); $this->db->from('swansilk_user_type'); $this->db->where('delete_status','ACTIVE'); $result = $this->db->get(); return $result->result(); } public function get_where_row($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function get_where_row_new($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $this->db->limit(1); $query=$this->db->get(); return $query->row(); } public function get_where_result($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function update_access($where,$table,$data) { $this->db->where($where); $this->db->update($table,$data); } public function get_access_list() { $this->db->select('A.*,B.*'); $this->db->from('swansilk_access_controls A'); $this->db->join('swansilk_user_type B','B.user_type_id=A.department_id'); $this->db->where('A.delete_status','ACTIVE'); $this->db->where('B.delete_status','ACTIVE'); $result = $this->db->get(); $result = $result->result(); $array = array(); foreach($result as $val) { $data['department_id'] = $val->department_id; $data['department'] = $val->user_type; $this->db->select('C.menu_id'); $this->db->from('swansilk_access_controls C'); $this->db->where('C.department_id',$val->department_id); $this->db->where('C.delete_status','ACTIVE'); $menu = $this->db->get(); $menu = $menu->row(); if($menu) { $result=explode(",",$menu->menu_id); foreach($result as $res) { $sub_res[]=explode(",",$res); } $data['menu'] = $sub_res; } else { $data['menu'] = ''; } array_push($array,$data); } return $array; } public function get_all_staff() { $this->db->select('A.username,A.id,B.user_type'); $this->db->from('employee_details A'); $this->db->join('swansilk_user_type B','B.user_type_id=A.user_type_id'); $this->db->where('A.delete_status','ACTIVE'); $this->db->where('B.delete_status','ACTIVE'); $result = $this->db->get(); return $result->result(); } public function Getsearch_id_pono($keyword) { $this->db->distinct(); $this->db->select('*'); //$this->db->order_by('customer_name', 'DESC'); $this->db->like("po_no", $keyword); $this->db->from('indent_po'); $this->db->where('confirm', 'Yes'); $this->db->where('product_type', 'Fabrics'); $query= $this->db->get(); return $query->result(); } public function cs_received_issue_Getsearch_pono($keyword,$status) { $this->db->distinct(); $this->db->select('po_no'); $this->db->like("po_no", $keyword); $this->db->from('indent_po'); $this->db->or_where_in('product_type', $status); $this->db->where('confirm','Yes'); $this->db->where('product_type','Consumables'); $query= $this->db->get(); return $query->result(); } public function get_issue_purchase_data($table,$status) { $this->db->select('*'); // $this->db->group_by('po_no','indent_no','vendor_name','g_date','currency','confirm','approved_by','remark'); // $this->db->order_by('po_id'); $this->db->from($table); $this->db->or_where_in('product_type', $status); $this->db->where('confirm','Yes'); $this->db->where('total_quantity !=','0.00'); $query=$this->db->get(); return $query->result(); } public function get_purchase_cs_data($table) { $this->db->select('*'); $this->db->group_by('work_order','vendor_name','sys_date','created_by','total_quantity'); $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_cs_subgrid_data($table,$where) { $this->db->select("*"); $this->db->order_by('id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // public function fetch_where_quantity_total($table,$where) // { // $this->db->select_sum('rec_goods'); // //$this->db->select('quantity'); // $this->db->from($table); // $this->db->where($where); // $query = $this->db->get(); // return $query->row(); // } public function get_purchase_fabric_data($table) { $this->db->select('*'); //$this->db->group_by('po_no','indent_no','product_name','available_quantity','design','shades','width','rec_goods'); // $this->db->order_by('id'); $this->db->from($table); //$this->db->where($where); $query=$this->db->get(); return $query->result(); } public function fetch_where_fabric_data1($table) { $this->db->select('indent_no'); $this->db->from($table); //$this->db->where($where); $query = $this->db->get(); return $query->result(); } public function fetch_where_modal_fabric_data($table) { $this->db->select("*"); $this->db->from($table); // $this->db->where($where); $this->db->where('rec_bal_goods !=','0.00'); $query = $this->db->get(); return $query->result(); } public function get_purchase_fabric_issue_data($table) { $this->db->select('*'); $this->db->order_by('id','DESC'); $this->db->group_by('work_order','vendor_name','sys_date','created_by','total_quantity'); $this->db->from($table); //$this->db->where($where); $query=$this->db->get(); return $query->result(); } public function get_podata($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function fetch_tare_sum_update($where) { $this->db->select_sum('tare_weight'); $this -> db ->from ('indent_yarn_goods_details'); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function fetch_net_sum_update($where) { $this->db->select_sum('net_weight'); $this -> db ->from ('indent_yarn_goods_details'); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function fetch_gross_sum_update($where) { $this->db->select_sum('gross_weight'); $this -> db ->from ('indent_yarn_goods_details'); $this->db->where($where); $query=$this->db->get(); return $query->row(); } ////////////////////////////////////////////////////////////////// public function get_issue_purchase_table_data($status) { $this->db->distinct('indent_cs_goods_details.po_id'); $this->db->select('indent_po.*'); $this->db->from('indent_cs_goods_details'); $this->db->join('indent_po','indent_cs_goods_details.po_list_id=indent_po.id'); $this->db->or_where_in('indent_po.product_type', $status); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.total_quantity !=','0.00'); $query=$this->db->get(); return $query->result(); } public function get_issue_purchase_table_data_ho($status) { $this->db->distinct('indent_cs_goods_details.po_id'); $this->db->select('indent_po.*,indent_cs_goods_details.consumed_at'); $this->db->from('indent_po'); $this->db->join('indent_cs_goods_details','indent_cs_goods_details.po_list_id=indent_po.id'); $this->db->or_where_in('indent_po.product_type', $status); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_cs_goods_details.consumed_at','HO'); $this->db->where('indent_po.total_quantity !=','0.00'); $query=$this->db->get(); return $query->result(); } public function get_issue_purchase_table_data_peenya($status) { $this->db->distinct('indent_cs_goods_details.po_id'); $this->db->select('indent_po.*,indent_cs_goods_details.consumed_at'); $this->db->from('indent_po'); $this->db->join('indent_cs_goods_details','indent_cs_goods_details.po_list_id=indent_po.id'); $this->db->or_where_in('indent_po.product_type', $status); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_cs_goods_details.consumed_at','PEENYA - DYEING'); $this->db->where('indent_po.total_quantity !=','0.00'); $query=$this->db->get(); return $query->result(); } public function get_issue_purchase_table_data_nandi($status) { $this->db->distinct('indent_cs_goods_details.po_id'); $this->db->select('indent_po.*,indent_cs_goods_details.consumed_at'); $this->db->from('indent_po'); $this->db->join('indent_cs_goods_details','indent_cs_goods_details.po_list_id=indent_po.id'); $this->db->or_where_in('indent_po.product_type', $status); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_cs_goods_details.consumed_at','NANDI'); $this->db->where('indent_po.total_quantity !=','0.00'); $query=$this->db->get(); return $query->result(); } public function get_issue_purchase_table_data_tailoring($status) { $this->db->distinct('indent_cs_goods_details.po_id'); $this->db->select('indent_po.*,indent_cs_goods_details.consumed_at'); $this->db->from('indent_po'); $this->db->join('indent_cs_goods_details','indent_cs_goods_details.po_list_id=indent_po.id'); $this->db->or_where_in('indent_po.product_type', $status); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_cs_goods_details.consumed_at','PEENYA - TAILORING'); $this->db->where('indent_po.total_quantity !=','0.00'); $query=$this->db->get(); return $query->result(); } public function get_issue_purchase_table_data_grid_fabric($status) { $this->db->select('indent_goods_details.product_name,indent_po.quantity,indent_po.total_quantity,indent_goods_details.id,indent_goods_details.width,indent_goods_details.shades,indent_goods_details.rec_goods,indent_goods_details.rec_weight,indent_goods_details.received_date,indent_goods_details.consumed_at,indent_goods_details.piece_no,indent_goods_details.no_type_val,indent_goods_details.rec_by'); $this->db->from('indent_po'); $this->db->join('indent_goods_details','indent_goods_details.po_list_id=indent_po.id'); $this->db->where('indent_goods_details.po_id',$status); // $this->db->group_by('indent_po.id'); $query=$this->db->get(); return $query->result(); } public function get_issue_purchase_table_data_grid_fabric_new() { $this->db->select('indent_po.*,indent_goods_details.product_name,indent_po.quantity,indent_po.total_quantity,indent_goods_details.id,indent_add_indent.required_on, indent_goods_details.width,indent_goods_details.shades,indent_goods_details.rec_goods,SUM(indent_goods_details.rec_weight) as rec_weight, SUM(rec_weight/indent_po.total_quantity) as avg_wt,(indent_po.total_quantity-indent_po.quantity) as varience,indent_goods_details.received_date, indent_goods_details.consumed_at,indent_goods_details.piece_no,indent_goods_details.no_type_val,indent_goods_details.rec_by, indent_goods_details.quantity_approval'); $this->db->from('indent_po'); $this->db->join('indent_goods_details','indent_goods_details.po_list_id=indent_po.id'); $this->db->join('indent_add_indent', ' indent_add_indent.id = indent_po.indent_id'); //$this->db->where('indent_goods_details.po_id',$status); $this->db->order_by('indent_po.id','desc'); $this->db->group_by('indent_goods_details.po_no,indent_goods_details.product_name'); $query=$this->db->get(); return $query->result(); } public function get_issue_purchase_table_data_grid_yarn_raw($status) { $this->db->select('indent_yarn_goods_details.yarnname,indent_po.quantity,indent_po.total_quantity,indent_yarn_goods_details.id,indent_yarn_goods_details.rec_date,indent_yarn_goods_details.invoice,indent_yarn_goods_details.received_date,indent_yarn_goods_details.lot,indent_yarn_goods_details.bale,indent_yarn_goods_details.gross_weight,indent_yarn_goods_details.net_weight,indent_yarn_goods_details.tare_weight,indent_yarn_goods_details.mill,indent_yarn_goods_details.grade,indent_yarn_goods_details.consumed_at,indent_yarn_goods_details.rec_by'); $this->db->from('indent_po'); $this->db->join('indent_yarn_goods_details','indent_yarn_goods_details.po_list_id=indent_po.id'); $this->db->where('indent_yarn_goods_details.po_id',$status); $query=$this->db->get(); return $query->result(); } public function get_issue_purchase_table_data_grid_peenya($status) { $this->db->select('indent_po.product_name,indent_po.quantity,indent_po.total_quantity,indent_cs_goods_details.id,indent_cs_goods_details.rec_date,indent_cs_goods_details.invoice,indent_cs_goods_details.received_date,indent_cs_goods_details.received_quality,indent_cs_goods_details.consumed_at,indent_cs_goods_details.rec_by'); $this->db->from('indent_po'); $this->db->join('indent_cs_goods_details','indent_cs_goods_details.po_list_id=indent_po.id'); $this->db->where('indent_cs_goods_details.po_id',$status); $query=$this->db->get(); return $query->result(); } public function get_issue_purchase_table_data_grid_data() { $this->db->select('indent_po.id,indent_po.po_no,indent_po.vendor_name,indent_po.product_name,indent_po.quantity,indent_po.total_quantity,indent_po.balanced_quantity,indent_po.currency,indent_po.confirm,indent_po.approved_by,indent_po.remark,indent_po.department,indent_po.indent_no,indent_cs_goods_details.consumed_at,indent_cs_goods_details.received_date,indent_cs_goods_details.rec_by'); $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->join('indent_cs_goods_details','indent_cs_goods_details.po_list_id=indent_po.id'); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.product_type','Consumables'); $query=$this->db->get(); return $query->result(); } public function get_issue_purchase_table_data_grid_spares_data() { $this->db->select('indent_po.id,indent_po.po_no,indent_po.vendor_name,indent_po.product_name,indent_po.quantity,indent_po.total_quantity,indent_po.balanced_quantity,indent_po.currency,indent_po.confirm,indent_po.approved_by,indent_po.remark,indent_po.department,indent_po.indent_no,indent_cs_goods_details.consumed_at,indent_cs_goods_details.received_date,indent_cs_goods_details.rec_by'); $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->join('indent_cs_goods_details','indent_cs_goods_details.po_list_id=indent_po.id'); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.product_type','Spares'); $query=$this->db->get(); return $query->result(); } public function get_purchase_data($table,$where) { $this->db->select('*'); $this->db->group_by('po_no','indent_no','vendor_name','g_date','currency','confirm','approved_by','remark'); $this->db->order_by("id","desc"); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function get_purchase_data_raw($table,$where) { $this->db->select('indent_po.*,indent_add_indent.indent_no'); $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("id","desc"); $this->db->from('indent_po'); $this->db->join('indent_add_indent', ' indent_add_indent.id = indent_po.indent_id'); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.product_type','Yarn - Raw'); $query=$this->db->get(); return $query->result(); } public function get_purchase_data_raw1($table,$where) { $this->db->select('indent_po.*,indent_add_indent.indent_no,indent_add_indent.required_on'); // $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("id","desc"); $this->db->from('indent_po'); $this->db->join('indent_add_indent', ' indent_add_indent.id = indent_po.indent_id'); $this->db->where('indent_po.product_type','Yarn - Raw'); $this->db->where_not_in('indent_po.quantity_approval','Completed'); $query=$this->db->get(); // print_r($this->db->last_query()); // die(); return $query->result(); } public function get_purchase_data_twist1($table,$where) { $this->db->select('indent_po.*,indent_add_indent.indent_no,indent_add_indent.required_on'); //$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->group_by('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("id","desc"); $this->db->from('indent_po'); $this->db->join('indent_add_indent', ' indent_add_indent.id = indent_po.indent_id'); $this->db->where('indent_po.product_type','Yarn - Twisted'); $this->db->where_not_in('indent_po.quantity_approval','Completed'); $query=$this->db->get(); return $query->result(); } public function get_purchase_data_twist($table,$where) { $this->db->select('indent_po.*,indent_add_indent.indent_no'); //$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->group_by('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("id","desc"); $this->db->from('indent_po'); $this->db->join('indent_add_indent', ' indent_add_indent.id = indent_po.indent_id'); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.product_type','Yarn - Twisted'); $query=$this->db->get(); return $query->result(); } public function get_purchase_data_dyed1($table,$where) { $this->db->select('indent_po.*,indent_add_indent.color_code,indent_add_indent.yarn_dyed_shade,indent_add_indent.indent_no,indent_add_indent.required_on'); // $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.id","desc"); $this->db->from('indent_po'); $this->db->join('indent_add_indent', ' indent_add_indent.id = indent_po.indent_id'); $this->db->where('indent_po.product_type','Yarn - Dyed'); $this->db->where_not_in('indent_po.quantity_approval','Completed'); $query=$this->db->get(); return $query->result(); } public function get_purchase_data_dyed($table,$where) { $this->db->select('indent_po.*,indent_add_indent.color_code,indent_add_indent.yarn_dyed_shade,indent_add_indent.indent_no'); $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.id","desc"); $this->db->from('indent_po'); $this->db->join('indent_add_indent', ' indent_add_indent.id = indent_po.indent_id'); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.product_type','Yarn - Dyed'); $query=$this->db->get(); return $query->result(); } public function fetch_where_cinsumable_subgrid_data1($where) { $this->db->select('*'); $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_cs_goods_details.po_list_id',$where); // $this->db->where('indent_po.product_type','Consumables'); $query=$this->db->get(); return $query->result(); } public function get_issue_purchase_table_data_grid_stock_yarn_raw($status) { $this->db->select('indent_yarn_goods_details.yarnname,indent_yarn_goods_details.hank_cones,indent_po.quantity,indent_po.total_quantity,indent_yarn_goods_details.id,indent_yarn_goods_details.rec_date,indent_yarn_goods_details.invoice,indent_yarn_goods_details.received_date,indent_yarn_goods_details.lot,indent_yarn_goods_details.bale,indent_yarn_goods_details.gross_weight,indent_yarn_goods_details.net_weight,indent_yarn_goods_details.tare_weight,indent_yarn_goods_details.mill,indent_yarn_goods_details.grade,indent_yarn_goods_details.consumed_at,indent_yarn_goods_details.rec_by'); $this->db->from('indent_po'); $this->db->join('indent_yarn_goods_details','indent_yarn_goods_details.po_list_id=indent_po.id'); $this->db->where('indent_yarn_goods_details.po_list_id',$status); $query=$this->db->get(); return $query->result(); } public function get_issue_purchase_table_consum_data() { $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.product_type','Consumables'); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.total_quantity !=','0.00'); $this->db->group_by('indent_po.financ_year'); $query=$this->db->get(); return $query->result(); } public function get_issue_purchase_table_data_grid_spares_stock_data() { $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.product_type','Spares'); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.total_quantity !=','0.00'); $query=$this->db->get(); return $query->result(); } public function get_issue_purchase_table_cs_location_data($gett,$yarn_type) { $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.product_type',$yarn_type); $this->db->where('indent_cs_goods_details.consumed_at',$gett); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.total_quantity !=','0.00'); $query=$this->db->get(); return $query->result(); // $this->db->distinct('indent_cs_goods_details.po_id'); // $this->db->select('indent_po.*,indent_cs_goods_details.consumed_at'); // $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.confirm','Yes'); // $this->db->where('indent_po.product_type',$yarn_type); // $this->db->where('indent_cs_goods_details.consumed_at',$gett); // $this->db->where('indent_po.total_quantity !=','0.00'); // $query=$this->db->get(); // return $query->result(); } public function get_issue_purchase_table_stock_consum_data($where) { $this->db->distinct('indent_cs_goods_details.po_id'); $this->db->select('indent_po.*,indent_cs_goods_details.consumed_at'); $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.product_type','Consumables'); $this->db->where('indent_cs_goods_details.consumed_at',$where); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.total_quantity !=','0.00'); $query=$this->db->get(); return $query->result(); } public function get_issue_purchase_conm_spares_table_data($status,$location) { $this->db->distinct('indent_cs_goods_details.po_id'); $this->db->select('indent_po.*,,indent_cs_goods_details.consumed_at'); $this->db->from('indent_cs_goods_details'); $this->db->join('indent_po','indent_cs_goods_details.po_list_id=indent_po.id'); $this->db->or_where_in('indent_po.product_type', $status); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.total_quantity !=','0.00'); $this->db->where('indent_cs_goods_details.consumed_at',$location); $query=$this->db->get(); return $query->result(); } public function fetch_design_subgrid_data($shadeID) { $this->db->select('*'); $this->db->from('sub_order_shades'); $this->db->join('sub_orders', 'sub_order_shades.subOrderID = sub_orders.id'); $this->db->where('sub_order_shades.shadeID',$shadeID); $query = $this->db->get(); return $query->row(); } public function get_rec_wei_data($table,$where) { $this->db->select_sum('issue_weight'); //$this->db->order_by('name','asc'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function get_rec_mtr_data($table,$where) { $this->db->select_sum('issue_mtrs'); //$this->db->order_by('name','asc'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function get_rec_net_data($table,$where) { $this->db->select_sum('issue_net_weight'); //$this->db->order_by('name','asc'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function get_rec_rem_data($table,$where) { $this->db->select_sum('issued_rem_wt'); //$this->db->order_by('name','asc'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function get_rec_dyed_data($table,$where) { $this->db->select_sum('issue_dyed_weight'); //$this->db->order_by('name','asc'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function get_rec_cs_data($table,$where) { $this->db->select_sum('issue_qua'); //$this->db->order_by('name','asc'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function count_amount_get_customerdata($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function count_amount_get_customerdata_new($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function sum_get_fetch_sum_net_invoice($table,$where) { $this->db->select_sum('net_wt'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function sum_get_fetch_sum_gross_invoice($table,$where) { $this->db->select_sum('gross_wt'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function order_sub_order_data($design,$width,$shade,$article,$po_no,$buyershade) { $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('orders.oslNo',$po_no); //$this->db->where('sub_orders.width',$width); $this->db->where('sub_orders.articleNo',$article); $this->db->where('sub_orders.design',$design); $this->db->where('sub_order_shades.buyerShade',$buyershade); $query=$this->db->get(); return $query->row(); } public function order_sub_order_data_new($design,$width,$shade,$article,$po_no,$buyershade) { $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('orders.oslNo',$po_no); //$this->db->where('sub_orders.width',$width); $this->db->where('sub_orders.articleNo',$article); $this->db->where('sub_orders.design',$design); //$this->db->where('sub_order_shades.buyerShade',$buyershade); $query=$this->db->get(); return $query->row(); } public function group_indent_get_purchase_data($table,$where) { $this->db->select('indent_po.*,shade_master.shadeName'); $this->db->group_by('po_no','indent_no','vendor_name','g_date','currency','confirm','approved_by','remark'); $this->db->order_by("po_id","desc"); $this->db->from('indent_po'); $this->db->join('indent_add_indent', 'indent_add_indent.id = indent_po.indent_id'); $this->db->join('shade_master', 'shade_master.shadeName = indent_add_indent.yarn_dyed_shade'); // $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.po_id',$where); //$this->db->where($where); $query=$this->db->get(); return $query->result(); } public function group_indent_get_purchase_details($table,$where) { $this->db->select('indent_po.*,shade_master.shadeName,indent_add_indent.shades as shade'); $this->db->group_by('po_no','indent_no','vendor_name','g_date','currency','confirm','approved_by','remark'); $this->db->order_by("po_id","desc"); $this->db->from('indent_po'); $this->db->join('indent_add_indent', 'indent_add_indent.id = indent_po.indent_id'); $this->db->join('shade_master', 'shade_master.shadeName = indent_add_indent.yarn_dyed_shade'); // $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.id',$where); //$this->db->where($where); $query=$this->db->get(); return $query->row(); } public function get_contract_type_customerdata($osl_number) { $this->db->select('sub_orders.contractType'); $this->db->from('orders'); $this->db->join('sub_orders','sub_orders.orderID= orders.id'); $this->db->where('orders.oslNo',$osl_number); $query = $this->db->get(); return $query->row(); } public function group_indent_get_purchase_data3($table,$where) { $this->db->select('indent_po.*,indent_add_indent.shades as shade,shade_master.shadeName,indent_add_indent.color_code'); //$this->db->group_by('po_no','indent_no','vendor_name','g_date','currency','confirm','approved_by','remark'); $this->db->order_by("po_id","desc"); $this->db->from('indent_po'); $this->db->join('indent_add_indent', 'indent_add_indent.id = indent_po.indent_id'); $this->db->join('shade_master', 'shade_master.shadeName = indent_add_indent.yarn_dyed_shade'); // $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.po_id',$where); //$this->db->where($where); $query=$this->db->get(); return $query->result(); } public function group_indent_get_purchase_datas3($table,$where,$financ_year) { $this->db->select('indent_po.*,indent_add_indent.shades as shade,shade_master.shadeName,indent_add_indent.color_code'); //$this->db->group_by('po_no','indent_no','vendor_name','g_date','currency','confirm','approved_by','remark'); $this->db->from('indent_po'); $this->db->join('indent_add_indent', 'indent_add_indent.id = indent_po.indent_id'); $this->db->join('shade_master', 'shade_master.shadeName = indent_add_indent.yarn_dyed_shade'); $this->db->where('indent_po.po_id',$where); $this->db->where('indent_po.financ_year',$financ_year); $this->db->order_by("indent_po.po_id","desc"); $query=$this->db->get(); return $query->result(); } public function group_get_where_dataa($table,$where) { $this->db->select('*'); $this->db->group_by('box_id'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function sum_of_mktrs($table,$where) { $this->db->select_sum('exp_qty'); $this->db->group_by('box_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function sum_of_mktrs1($table,$where) { $this->db->select_sum('exp_wt'); $this->db->group_by('box_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function count_of_mktrs1($table,$where) { $this->db->select('box_id'); $this->db->group_by('box_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function count_of_pcs($table,$where) { $this->db->select('*'); //$this->db->group_by(''); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function sum_of_mktrs_exp_qty($table,$where) { $this->db->select_sum('exp_qty'); //$this->db->group_by('box_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function sum_of_mktrs_exp_wt($table,$where) { $this->db->select_sum('exp_wt'); //$this->db->group_by('box_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function group_indent_get_shade_purchase_details($table,$where) { $this->db->select('indent_po.*,indent_add_indent.yarn_dyed_shade as shadeName,indent_add_indent.shades as shade'); $this->db->group_by('po_no','indent_no','vendor_name','g_date','currency','confirm','approved_by','remark'); $this->db->order_by("po_id","desc"); $this->db->from('indent_po'); $this->db->join('indent_add_indent', 'indent_add_indent.id = indent_po.indent_id'); //$this->db->join('shade_master', 'shade_master.shadeName = indent_add_indent.yarn_dyed_shade'); // $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.id',$where); //$this->db->where($where); $query=$this->db->get(); return $query->row(); } public function group_indent_get_purchase_details2($table,$where) { $this->db->select('indent_po.*,indent_add_indent.shades as shade'); $this->db->group_by('po_no','indent_no','vendor_name','g_date','currency','confirm','approved_by','remark'); $this->db->order_by("po_id","desc"); $this->db->from('indent_po'); $this->db->join('indent_add_indent', 'indent_add_indent.id = indent_po.indent_id'); //$this->db->join('shade_master', 'shade_master.shadeName = indent_add_indent.yarn_dyed_shade'); // $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.id',$where); //$this->db->where($where); $query=$this->db->get(); return $query->row(); } public function group_indent_get_purchase_details1($table,$where) { $this->db->select('indent_po.*,indent_add_indent.yarn_dyed_shade,indent_add_indent.color_code'); $this->db->group_by('po_no','indent_no','vendor_name','g_date','currency','confirm','approved_by','remark'); $this->db->order_by("po_id","desc"); $this->db->from('indent_po'); $this->db->join('indent_add_indent', 'indent_add_indent.id = indent_po.indent_id'); //$this->db->join('shade_master', 'shade_master.shadeName = indent_add_indent.yarn_dyed_shade'); // $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.id',$where); //$this->db->where($where); $query=$this->db->get(); return $query->row(); } public function new_Stores_fetch_where_subgrid_data1($table,$where) { $this->db->select("indent_yarn_goods_details.*,indent_add_indent.shades as shadename,indent_add_indent.color_code"); $this->db->from('indent_yarn_goods_details'); $this->db->join('indent_po', 'indent_po.id= indent_yarn_goods_details.po_list_id'); $this->db->join('indent_add_indent', 'indent_add_indent.id= indent_po.indent_id'); $this->db->where($where); $query = $this->db->get(); return $query->result(); } ///////////////////////////////////////// notifications ///////////////////////////////////////////////////////// public function count_amount_notification_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('transfer_id_val,product_type,product_location,transfer_location'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function stock_location_get_where_dataa($table,$where) { $this->db->select('*'); $this->db->group_by('transfer_id_val,product_type,product_location,transfer_location'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function stock_count_wt_get_data_fetch($table,$where) { $this->db->select_sum('issue_weight'); $this->db->group_by('transfer_id_val,product_type,product_location,transfer_location'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function stock_count_mtrs_get_data_fetch($table,$where) { $this->db->select_sum('issue_mtrs'); $this->db->group_by('transfer_id_val,product_type,product_location,transfer_location'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function stock_count_net_wt_get_data_fetch($table,$where) { $this->db->select_sum('issue_net_weight'); $this->db->group_by('transfer_id_val,product_type,product_location,transfer_location'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function stock_count_qua_get_data_fetch($table,$where) { $this->db->select_sum('issue_qua'); $this->db->group_by('transfer_id_val,product_type,product_location,transfer_location'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function stock_count_dyed_wt_get_data_fetch($table,$where) { $this->db->select_sum('issue_dyed_weight'); $this->db->group_by('transfer_id_val,product_type,product_location,transfer_location'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function get_where_access_rights_dataa($table) { $this->db->select('*'); $this->db->from($table); $query=$this->db->get(); return $query->result(); } public function rec_stock_count_mtrs_get_data_fetch($table,$where) { $this->db->select_sum('rec_mtrs'); $this->db->group_by('transfer_id_val,product_type,product_location,transfer_location'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function rec_stock_count_net_wt_get_data_fetch($table,$where) { $this->db->select_sum('rec_net_wt'); $this->db->group_by('transfer_id_val,product_type,product_location,transfer_location'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function rec_stock_count_qua_get_data_fetch($table,$where) { $this->db->select_sum('rec_qua'); $this->db->group_by('transfer_id_val,product_type,product_location,transfer_location'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function rec_stock_count_dyed_wt_get_data_fetch($table,$where) { $this->db->select_sum('rec_dyed_wt'); $this->db->group_by('transfer_id_val,product_type,product_location,transfer_location'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function marketing_notification_getsuborder($where) { $this->db->select('*'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->where('sub_orders.created_date',$where); $this->db->where('orders.insert_notification_status',0); $query = $this->db->get(); return $query->num_rows(); } public function marketing_notification_delivery_date_getsuborder($where) { $this->db->select('*'); $this->db->group_by('sub_orders.orderID'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->where('orders.deliveryDate',$where); $query = $this->db->get(); return $query->num_rows(); } public function marketing_notification_deying_date_getsuborder($where) { $this->db->select('orders.oslNo,orders.orderType,orders.orderNo,sub_orders.article_type,sub_orders.subOrderType,sub_order_shades.unitPrice,sub_order_shades.buyerShade,sub_order_shades.skuNo,planned_order.dyeingDate'); $this->db->group_by('planned_order.subNo'); $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.dyeingDate',$where); $query=$this->db->get(); return $query->num_rows(); } public function marketing_notification_weaving_date_getsuborder($where) { $this->db->select('*'); $this->db->group_by('subNo'); $this->db->from('planned_order'); $this->db->where('weavingDate',$where); $query = $this->db->get(); return $query->num_rows(); } public function planning_notification_dyeing_date_result_get_details($where) { $this->db->select('orders.oslNo,orders.orderType,orders.orderNo,sub_orders.article_type,sub_orders.subOrderType,sub_order_shades.unitPrice,sub_order_shades.buyerShade,sub_order_shades.skuNo,planned_order.dyeingDate'); $this->db->group_by('planned_order.subNo'); $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.dyeingDate',$where); $query=$this->db->get(); return $query->result(); } public function planning_notification_weaving_date_result_get_details($where) { $this->db->select('orders.oslNo,orders.orderType,orders.orderNo,sub_orders.article_type,sub_orders.subOrderType,sub_order_shades.unitPrice,sub_order_shades.buyerShade,sub_order_shades.skuNo,planned_order.weavingDate'); $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.weavingDate',$where); $query=$this->db->get(); return $query->result(); } public function marketing_notification_delivery_date_result_get_details($where) { $this->db->select('orders.*,sub_orders.*'); $this->db->group_by('sub_orders.orderID'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->where('orders.deliveryDate',$where); $query=$this->db->get(); return $query->result(); } public function planning_notification_get_result($where) { $this->db->select('orders.*,sub_orders.*,sub_order_shades.*'); $this->db->group_by('orders.oslNo'); $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.planned_date',$where); $this->db->where('sub_orders.approval_notification_status',0); $query=$this->db->get(); return $query->result(); } public function outsource_planning_notification_get_details($where) { $this->db->select('orders.*,sub_orders.*,sub_order_shades.*,planned_order.*'); $this->db->group_by('orders.oslNo'); $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.plannedDate',$where); $this->db->where('sub_order_shades.planningStatus','planned'); $this->db->where('sub_orders.article_type','outsource'); $this->db->where('sub_orders.approval_notification_status',0); $query = $this->db->get(); return $query->num_rows(); } public function outsource_planning_notification_get_result($where) { $this->db->select('orders.*,sub_orders.*,sub_order_shades.*,planned_order.*'); $this->db->group_by('orders.oslNo'); $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.plannedDate',$where); $this->db->where('sub_order_shades.planningStatus','planned'); $this->db->where('sub_orders.article_type','outsource'); $this->db->where('sub_orders.approval_notification_status',0); $query=$this->db->get(); return $query->result(); } public function shade_master_getsuborder1($where) { $this->db->select('shade_master.*,article_master.articleNo'); $this->db->from('shade_master'); $this->db->join('article_master', 'article_master.articleID= shade_master.articleID'); $this->db->where('shade_master.created_date',$where); $query = $this->db->get(); return $query->result(); } public function shade_master_update_getsuborder1($where) { $this->db->select('shade_master.*,article_master.articleNo'); $this->db->from('shade_master'); $this->db->join('article_master', 'article_master.articleID= shade_master.articleID'); $this->db->where('shade_master.updated_on',$where); $query = $this->db->get(); return $query->result(); } public function madeups_noti_get_where_dataa($table,$where) { $this->db->select('*'); $this->db->group_by('osl'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function madeups_noti_qua_get_where_dataa($table,$where) { $this->db->select_sum('issued_quantity'); $this->db->group_by('osl'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function madeups_count_amount_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('osl'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function issue_cs_noti_qua_get_where_dataa($table,$where) { $this->db->select_sum('issue_quantity'); $this->db->group_by('work_order'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function issue_fabric_noti_qua_get_where_dataa($table,$where) { $this->db->select_sum('issue_stock'); $this->db->group_by('work_order'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function issue_fabric_noti_all_get_where_dataa($table,$where) { $this->db->select('*'); $this->db->group_by('work_order'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function issue_fabric_count_amount_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('work_order'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function fabric_inspection_update_getsuborder1($where) { $this->db->select('fabric_inspection_details.*,fabric_inspection.*'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id= fabric_inspection_details.id'); $this->db->where('fabric_inspection.created_date',$where); $this->db->where('fabric_inspection.insert_notification_status',0); $query = $this->db->get(); return $query->result(); } public function yarn_delivery_insert_getsuborder1($where) { $this->db->select('indent_yarn_goods_details.*,indent_po.*'); $this->db->from('indent_yarn_goods_details'); $this->db->join('indent_po', 'indent_po.id= indent_yarn_goods_details.po_list_id'); $this->db->where('indent_yarn_goods_details.received_date',$where); $this->db->where('indent_yarn_goods_details.insert_notification_status',0); $query = $this->db->get(); return $query->result(); } public function cs_delivery_insert_getsuborder1($where) { $this->db->select('indent_cs_goods_details.*,indent_po.*'); $this->db->from('indent_cs_goods_details'); $this->db->join('indent_po', 'indent_po.id= indent_cs_goods_details.po_list_id'); $this->db->where('indent_cs_goods_details.received_date',$where); $this->db->where('indent_cs_goods_details.insert_notification_status',0); $query = $this->db->get(); return $query->result(); } public function fabric_delivery_goods_insert_getsuborder1($where) { $this->db->select('indent_goods_details.*,indent_po.*'); $this->db->from('indent_goods_details'); $this->db->join('indent_po', 'indent_po.id= indent_goods_details.po_list_id'); $this->db->where('indent_goods_details.received_date',$where); $this->db->where('indent_goods_details.insert_notification_status',0); $query = $this->db->get(); return $query->result(); } public function count_amount_work_order_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('work_order'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function issue_work_order_noti_qua_get_where_dataa($table,$where) { $this->db->select_sum('quty_kgs'); $this->db->group_by('work_order'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function issue_work_order_dyeing_noti_qua_get_where_dataa($table,$where) { $this->db->select_sum('warp_wt'); $this->db->group_by('work_order'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function issue_work_order_fabric_noti_qua_get_where_dataa($table,$where) { $this->db->select_sum('issue_stock'); $this->db->group_by('work_order'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function count_amount_work_order_delivery_twisting_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('yarn_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function count_amount_work_order_delivery_dyed_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('dyed_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function count_amount_work_order_delivery_weaving_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('po_list_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function count_amount_work_order_delivery_fabric_finishing_emp_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('fin_emb_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function issue_work_order_deli_twi_noti_qua_get_where_dataa1($table,$where) { $this->db->select_sum('gross_weight'); $this->db->group_by('yarn_id'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function issue_work_order_deli_twi_noti_qua_get_where_dataa2($table,$where) { $this->db->select_sum('twisting_net_weight'); $this->db->group_by('yarn_id'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function issue_work_order_deli_twi_noti_qua_get_where_dataa3($table,$where) { $this->db->select_sum('tare_weight'); $this->db->group_by('yarn_id'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function count_amount_work_order_deliv_twist_get_customerdata($table,$where) { $this->db->select('work_order_twisting.id,work_order_twisting.rec_date,work_order_twisting.rec_by,create_yarntwisting_work_order.work_order_no'); $this->db->group_by('yarn_id'); $this->db->from('create_yarntwisting_work_order'); $this->db->join('work_order_twisting', 'work_order_twisting.yarn_id=create_yarntwisting_work_order.id'); $this->db->where('work_order_twisting.rec_date',$where); $this->db->where('work_order_twisting.insert_notification_status',0); $query = $this->db->get(); return $query->result(); } public function issue_work_order_deli_dye_noti_qua_get_where_dataa3($table,$where) { $this->db->select_sum('rec_dyed_qua'); $this->db->group_by('dyed_id'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function count_amount_work_order_delivery_yarn_dyed_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('dyed_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function count_amount_work_order_deliv_dyeing1_get_customerdata($table,$where) { $this->db->select('work_order_dyeing.id,work_order_dyeing.rec_date,work_order_dyeing.rec_by,workorder_dyeing.work_order_no'); $this->db->group_by('dyed_id'); $this->db->from('workorder_dyeing'); $this->db->join('work_order_dyeing', 'work_order_dyeing.dyed_id=workorder_dyeing.id'); $this->db->where('work_order_dyeing.rec_date',$where); $this->db->where('work_order_dyeing.insert_notification_status',0); $query = $this->db->get(); return $query->result(); } public function issue_work_order_deli_fab_noti_qua_get_where_dataa3($table,$where) { $this->db->select_sum('rec_qua'); $this->db->group_by('fin_emb_id'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function count_amount_work_order_delivery_yarn_fab_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('fin_emb_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function count_amount_work_order_deliv_fab_get_customerdata($table,$where) { $this->db->select('finishing_embroidry_stock.id,finishing_embroidry_stock.received_date,finishing_embroidry_stock.rec_by,finishing_embroidry.work_order'); $this->db->group_by('fin_emb_id'); $this->db->from('finishing_embroidry_stock'); $this->db->join('finishing_embroidry', 'finishing_embroidry_stock.fin_emb_id=finishing_embroidry.id'); $this->db->where('finishing_embroidry_stock.received_date',$where); $this->db->where('finishing_embroidry_stock.insert_notification_status',0); $query = $this->db->get(); return $query->result(); } public function count_amount_work_order_deliv_po_get_customerdata($table,$where) { $this->db->select('indent_po.po_no as p,indent_goods_details.*'); $this->db->from('indent_goods_details'); $this->db->join('indent_po', 'indent_goods_details.po_list_id=indent_po.id'); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function count_amount_work_order_deliv_po_osl_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('weaving_id'); $this->db->from('weaving_factory_stock'); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function sum1_amount_work_order_deliv_po_osl_get_customerdata($table,$where) { $this->db->select_sum('received_mtrs'); $this->db->group_by('weaving_id'); $this->db->from('weaving_factory_stock'); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function sum2_amount_work_order_deliv_po_osl_get_customerdata($table,$where) { $this->db->select_sum('received_weight'); $this->db->group_by('weaving_id'); $this->db->from('weaving_factory_stock'); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function count_amount_work_order_delivery_yarn_po_get_customerdata($table, $where) { $this->db->from($table); $this->db->where($where); return $this->db->count_all_results(); } // public function count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where) // { // $this->db->select('*'); // $this->db->from($table); // $this->db->where($where); // $query = $this->db->get(); // return $query->num_rows(); // } public function marketing_notification_update_getsuborder($where) { $this->db->select('*'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->where('sub_orders.updated_on',$where); $this->db->where('orders.update_notification_status',0); $query = $this->db->get(); return $query->num_rows(); } public function marketing_notification_update_get_details($where) { $this->db->select('orders.*,sub_orders.*'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->where('sub_orders.updated_on',$where); $this->db->where('orders.update_notification_status',0); $query=$this->db->get(); return $query->result(); } public function count_amount_work_order_delivery_weaving_fabric_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('weaving_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function issue_fabric_material_noti_all_get_where_dataa($table,$where) { $this->db->select('*'); $this->db->group_by('work_order'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function issue_work_order_dyeing_material_noti_qua_get_where_dataa($table,$where) { $this->db->select_sum('issue_net_weight'); $this->db->group_by('work_order'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function notifications_get_where_dataa($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function planning_notification_get_details($where) { $this->db->select('orders.*,sub_orders.*'); $this->db->group_by('orders.oslNo'); $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.planned_date',$where); $this->db->where('sub_order_shades.planningStatus','planned'); $this->db->where('sub_orders.article_type','inhouse'); $this->db->where('sub_orders.approval_notification_status',0); $query = $this->db->get(); return $query->num_rows(); } public function marketing_notification_get_details($where) { $this->db->select('orders.*,sub_orders.*'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->where('sub_orders.created_date',$where); $this->db->where('orders.insert_notification_status',0); $query=$this->db->get(); return $query->result(); } public function marketing_notification_get_details2($where) { $this->db->select('orders.*,sub_orders.*'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->where('sub_orders.created_date',$where); $query=$this->db->get(); return $query->result(); } public function marketing_notification_getsuborder2($where) { $this->db->select('*'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->where('sub_orders.created_date',$where); $query = $this->db->get(); return $query->num_rows(); } public function marketing_notification_confirm_get_details2($where) { $this->db->select('orders.*,sub_orders.*'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->where('sub_orders.orderConfirmDate',$where); $query=$this->db->get(); return $query->result(); } public function marketing_notification_confirmgetsuborder2($where) { $this->db->select('*'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->where('sub_orders.orderConfirmDate',$where); $query = $this->db->get(); return $query->num_rows(); } public function marketing_notification_update_get_details2($where) { $this->db->select('orders.*,sub_orders.*'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->where('sub_orders.updated_on',$where); $query=$this->db->get(); return $query->result(); } public function marketing_notification_update_getsuborder2($where) { $this->db->select('*'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->where('sub_orders.updated_on',$where); $query = $this->db->get(); return $query->num_rows(); } public function planning_notification_get_results2($where) { $this->db->select('orders.*,sub_orders.*,sub_order_shades.*'); $this->db->group_by('orders.oslNo'); $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.planned_date',$where); $query=$this->db->get(); return $query->result(); } public function planning_notification_get_details2($where) { $this->db->select('orders.*,sub_orders.*'); $this->db->group_by('orders.oslNo'); $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.planned_date',$where); $this->db->where('sub_order_shades.planningStatus','planned'); $this->db->where('sub_orders.article_type','inhouse'); $query = $this->db->get(); return $query->num_rows(); } public function outsource_planning_notification_get_results2($where) { $this->db->select('orders.*,sub_orders.*,sub_order_shades.*,planned_order.*'); $this->db->group_by('orders.oslNo'); $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.plannedDate',$where); $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 outsource_planning_notification_get_details2($where) { $this->db->select('orders.*,sub_orders.*,sub_order_shades.*,planned_order.*'); $this->db->group_by('orders.oslNo'); $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.plannedDate',$where); $this->db->where('sub_order_shades.planningStatus','planned'); $this->db->where('sub_orders.article_type','outsource'); $query = $this->db->get(); return $query->num_rows(); } public function count_amount_work_order_deliv_twist_get_customerdata2($table,$where) { $this->db->select('work_order_twisting.id,work_order_twisting.rec_date,work_order_twisting.rec_by,create_yarntwisting_work_order.work_order_no'); $this->db->group_by('yarn_id'); $this->db->from('create_yarntwisting_work_order'); $this->db->join('work_order_twisting', 'work_order_twisting.yarn_id=create_yarntwisting_work_order.id'); $this->db->where('work_order_twisting.rec_date',$where); $query = $this->db->get(); return $query->result(); } public function count_amount_work_order_deliv_dyeing1_get_customerdata2($table,$where) { $this->db->select('work_order_dyeing.id,work_order_dyeing.rec_date,work_order_dyeing.rec_by,workorder_dyeing.work_order_no'); $this->db->group_by('dyed_id'); $this->db->from('workorder_dyeing'); $this->db->join('work_order_dyeing', 'work_order_dyeing.dyed_id=workorder_dyeing.id'); $this->db->where('work_order_dyeing.rec_date',$where); $query = $this->db->get(); return $query->result(); } public function count_amount_work_order_deliv_fab_gett_customerdata2($table,$where) { $this->db->select('finishing_embroidry_stock.id,finishing_embroidry_stock.received_date,finishing_embroidry_stock.rec_by,finishing_embroidry.work_order'); $this->db->group_by('fin_emb_id'); $this->db->from('finishing_embroidry_stock'); $this->db->join('finishing_embroidry', 'finishing_embroidry_stock.fin_emb_id=finishing_embroidry.id'); $this->db->where('finishing_embroidry_stock.received_date',$where); $query = $this->db->get(); return $query->result(); } public function yarn_delivery1_insert_getsuborder1($where) { $this->db->select('indent_yarn_goods_details.*,indent_po.*'); $this->db->from('indent_yarn_goods_details'); $this->db->join('indent_po', 'indent_po.id= indent_yarn_goods_details.po_list_id'); $this->db->where('indent_yarn_goods_details.received_date',$where); $query = $this->db->get(); return $query->result(); } public function cs_delivery_insertt_getsuborder1($where) { $this->db->select('indent_cs_goods_details.*,indent_po.*'); $this->db->from('indent_cs_goods_details'); $this->db->join('indent_po', 'indent_po.id= indent_cs_goods_details.po_list_id'); $this->db->where('indent_cs_goods_details.received_date',$where); $query = $this->db->get(); return $query->result(); } public function fabric_delivery_goods_insertt_getsuborder1($where) { $this->db->select('indent_goods_details.*,indent_po.*'); $this->db->from('indent_goods_details'); $this->db->join('indent_po', 'indent_po.id= indent_goods_details.po_list_id'); $this->db->where('indent_goods_details.received_date',$where); $this->db->where('indent_goods_details.insert_notification_status',0); $query = $this->db->get(); return $query->result(); } public function fabric_inspection_updatee_getsuborder1($where) { $this->db->select('fabric_inspection_details.*,fabric_inspection.*'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id= fabric_inspection_details.id'); $this->db->where('fabric_inspection.created_date',$where); $query = $this->db->get(); return $query->result(); } public function yarn_deliveryy_insert_getsuborder1($where) { $this->db->select('indent_yarn_goods_details.*,indent_po.*'); $this->db->from('indent_yarn_goods_details'); $this->db->join('indent_po', 'indent_po.id= indent_yarn_goods_details.po_list_id'); $this->db->where('indent_yarn_goods_details.received_date',$where); $query = $this->db->get(); return $query->result(); } public function cs_deliveryy_insert_getsuborder1($where) { $this->db->select('indent_cs_goods_details.*,indent_po.*'); $this->db->from('indent_cs_goods_details'); $this->db->join('indent_po', 'indent_po.id= indent_cs_goods_details.po_list_id'); $this->db->where('indent_cs_goods_details.received_date',$where); $query = $this->db->get(); return $query->result(); } public function fabric_inspections_update_getsuborder1($where) { $this->db->select('fabric_inspection_details.*,fabric_inspection.*'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_inspection', 'fabric_inspection.goods_id= fabric_inspection_details.id'); $this->db->where('fabric_inspection.created_date',$where); $query = $this->db->get(); return $query->result(); } ///////////////////////////////////////////////////// 16-5-2018 /////////////////////////////////////////////////////////// public function exported_fabric_details() { $this->db->select('fabric_addstock.id,fabric_addstock.issue_stock,fabric_inspection_details.vendor_name,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.design,fabric_inspection_details.consumed_at,fabric_addstock.ssl_pc_no,fabric_inspection_details.units_val as unit,fabric_inspection_details.customer_id,fabric_addstock.work_order,fabric_inspection_details.orderType'); $this->db->order_by('fabric_inspection_details.id','desc'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_addstock', 'fabric_addstock.fabric_id = fabric_inspection_details.id'); $this->db->where('fabric_addstock.issue_stock !=',''); $query=$this->db->get(); return $query->result(); } public function exported_packing_fabric_details() { $this->db->select('package_packing.id,package_packing.exp_qty,fabric_inspection_details.vendor_name,fabric_inspection_details.piece_no,package_packing.po_no,fabric_inspection_details.product_name,package_packing.width,package_packing.shades,fabric_inspection_details.design,fabric_inspection_details.consumed_at,package_packing.ssl_pc_no,fabric_inspection_details.units_val as unit,package_packing.invoice_num,package_packing.customer_name,fabric_inspection_details.customer_id,fabric_inspection_details.received_date'); $this->db->order_by('fabric_inspection_details.id','desc'); $this->db->from('fabric_inspection_details'); $this->db->join('package_packing', 'package_packing.stcok_id = fabric_inspection_details.id'); $this->db->where('package_packing.exp_qty !=',''); $query=$this->db->get(); return $query->result(); } public function exported_packing_madeup_details() { $this->db->select('madeups_list_data.customer_name,madeups_list_data.order_date,madeups_list_data.units,madeups_packing.order_type,madeups_packing.id,madeups_packing.invoice,madeups_packing.article,madeups_packing.size,madeups_packing.orderNo,madeups_packing.shades,madeups_packing.design,madeups_packing.exp_qty,madeups_packing.exp_wt'); $this->db->from('madeups_packing'); $this->db->join('madeups_list_data', 'madeups_list_data.id = madeups_packing.madeups_id'); $this->db->order_by('madeups_list_data.id','desc'); $this->db->group_by('madeups_packing.madeups_id'); $query=$this->db->get(); return $query->result(); } public function issue_fabric_exported_stock($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } //////////////////////////// dashboard notifications /////////////////////////////////////////////////////////////////// public function invoice_dashboard_po_list_id($where) { $this->db->select('*'); $this->db->group_by('packing_list_data.invoice'); $this->db->from('packing_list_data'); $this->db->join('package_packing', 'package_packing.pack_id = packing_list_data.id'); $this->db->where('packing_list_data.created_at',$where); $this->db->where('package_packing.exp_qty !=',''); $query = $this->db->get(); return $query->num_rows(); } public function dashboard_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->num_rows(); } public function marketing_dashboard_po_no($table,$where) { $this->db->select('*'); $this->db->group_by('orderID'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function dashboard_po_list_id($table,$where) { $this->db->select('*'); $this->db->group_by('po_list_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function fabric_madeups_dashboard_po_list_id($table,$where) { $this->db->select('*'); $this->db->group_by('plan_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function fabric_del_madeups_dashboard_po_list_id($table,$where) { $this->db->select('*'); $this->db->group_by('ref_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function issue_fabric_no_count_amount_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('work_order'); $this->db->from($table); $this->db->where($where); $this->db->where('issue_stock !=',''); $query = $this->db->get(); return $query->num_rows(); } public function work_order_no_count_amount_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('work_order'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function waving_no_count_amount_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('weaving_panel_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function marketing_planning_notification_get_details2($where) { $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->join('planned_order', 'planned_order.subNo= sos.shadeID'); $this->db->where('planned_order.plannedDate',$where); $this->db->order_by("id", "desc"); $this->db->group_by('oslNo'); $query = $this->db->get(); return $query->num_rows(); } public function monthly_created_po_generate($table,$m,$y) { $query = $this->db->query('SELECT * FROM indent_po where Month(STR_TO_DATE (created_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_date,"%d-%m-%Y"))="' . $y . '" GROUP BY po_no,indent_no,vendor_name,g_date,currency,confirm,approved_by,remark'); return $query->num_rows(); } public function monthly_approved_po_generate($table,$m,$y) { $query = $this->db->query('SELECT * FROM indent_po where Month(STR_TO_DATE (approved_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (approved_date,"%d-%m-%Y"))="' . $y . '" GROUP BY po_no,indent_no,vendor_name,g_date,currency,confirm,approved_by,remark'); return $query->num_rows(); } public function year_created_po_generate($table,$y) { $query = $this->db->query('SELECT * FROM indent_po where Year(STR_TO_DATE (created_date,"%d-%m-%Y"))="' . $y . '" GROUP BY po_no,indent_no,vendor_name,g_date,currency,confirm,approved_by,remark'); return $query->num_rows(); } public function year_approved_po_generate($table,$y) { $query = $this->db->query('SELECT * FROM indent_po where Year(STR_TO_DATE (approved_date,"%d-%m-%Y"))="' . $y . '" GROUP BY po_no,indent_no,vendor_name,g_date,currency,confirm,approved_by,remark'); return $query->num_rows(); } public function monthly_result_created_po_generate($table,$m,$y) { $query = $this->db->query('SELECT * FROM indent_po where Month(STR_TO_DATE (created_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_date,"%d-%m-%Y"))="' . $y . '" GROUP BY po_no,indent_no,vendor_name,g_date,currency,confirm,approved_by,remark ORDER BY po_id DESC'); return $query->result(); } public function monthly_result_approved_po_generate($table,$m,$y) { $query = $this->db->query('SELECT * FROM indent_po where Month(STR_TO_DATE (approved_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (approved_date,"%d-%m-%Y"))="' . $y . '" GROUP BY po_no,indent_no,vendor_name,g_date,currency,confirm,approved_by,remark ORDER BY po_id DESC'); return $query->result(); } public function year_result_created_po_generate($table,$y) { $query = $this->db->query('SELECT * FROM indent_po where Year(STR_TO_DATE (created_date,"%d-%m-%Y"))="' . $y . '" GROUP BY po_no,indent_no,vendor_name,g_date,currency,confirm,approved_by,remark ORDER BY po_id DESC'); return $query->result(); } public function year_result_approved_po_generate($table,$y) { $query = $this->db->query('SELECT * FROM indent_po where Year(STR_TO_DATE (approved_date,"%d-%m-%Y"))="' . $y . '" GROUP BY po_no,indent_no,vendor_name,g_date,currency,confirm,approved_by,remark ORDER BY po_id DESC'); return $query->result(); } public function montly_dashboard_po_no($table,$m,$y) { $query = $this->db->query('SELECT * FROM indent_goods_details where Month(STR_TO_DATE (received_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (received_date,"%d-%m-%Y"))="' . $y . '" GROUP BY po_no'); return $query->num_rows(); } public function year_dashboard_po_no($table,$y) { $query = $this->db->query('SELECT * FROM indent_goods_details where Year(STR_TO_DATE (received_date,"%d-%m-%Y"))="' . $y . '" GROUP BY po_no'); return $query->num_rows(); } public function monthly_dashboard_po_list_id($table,$m,$y) { $query = $this->db->query('SELECT * FROM indent_yarn_goods_details where Month(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY po_list_id'); return $query->num_rows(); } public function year_dashboard_po_list_id($table,$y) { $query = $this->db->query('SELECT * FROM indent_yarn_goods_details where Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY po_list_id'); return $query->num_rows(); } public function monthly_cs_dashboard_po_list_id($table,$m,$y) { $query = $this->db->query('SELECT * FROM indent_cs_goods_details where Month(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY po_list_id'); return $query->num_rows(); } public function year_cs_dashboard_po_list_id($table,$y) { $query = $this->db->query('SELECT * FROM indent_cs_goods_details where Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY po_list_id'); return $query->num_rows(); } public function today_get_customer_details($where){ $this->db->select('id,customer_name,customer_id,reference,date,product_type,article,quality,price,composition,description,preview'); $this->db->order_by('date','desc'); $this->db->from('sample_request'); //$this->db->join('planned_order po', 'po.id=pow.planningOrderID'); $this->db->where('status',0); $this->db->where($where); $this->db->group_by('customer_id,customer_name,date'); $this->db->order_by('date', 'DESC'); $query= $this->db->get(); return $query->result(); } public function monthly_count_amount_get_customerdata($table,$m,$y) { $query = $this->db->query('SELECT * FROM sample_request where Month(STR_TO_DATE (created_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_date,"%d-%m-%Y"))="' . $y . '" GROUP BY customer_id,customer_name,date ORDER BY date DESC'); return $query->num_rows(); } public function year_count_amount_get_customerdata($table,$y) { $query = $this->db->query('SELECT * FROM sample_request where Year(STR_TO_DATE (created_date,"%d-%m-%Y"))="' . $y . '" GROUP BY customer_id,customer_name,date ORDER BY date DESC'); return $query->num_rows(); } public function monthly_count_amount_get_customerdata1($table,$m,$y) { $query = $this->db->query('SELECT * FROM sample_request where Month(STR_TO_DATE (created_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_date,"%d-%m-%Y"))="' . $y . '" GROUP BY customer_id,customer_name,date ORDER BY date DESC'); return $query->result(); } public function year_count_amount_get_customerdata1($table,$y) { $query = $this->db->query('SELECT * FROM sample_request where Year(STR_TO_DATE (created_date,"%d-%m-%Y"))="' . $y . '" GROUP BY customer_id,customer_name,date ORDER BY date DESC'); return $query->result(); } /////////////////////////////////// design weaving dashboard ////////////////////////////////////////////////// public function monthly_design_count_amount_get_customerdata1($table,$m,$y,$s) { $query = $this->db->query('SELECT * FROM design_weave where Month(STR_TO_DATE (created_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_date,"%d-%m-%Y"))="' . $y . '" '); return $query->num_rows(); } public function year_design_count_amount_get_customerdata1($table,$y,$s) { $query = $this->db->query('SELECT * FROM design_weave where Year(STR_TO_DATE (created_date,"%d-%m-%Y"))="' . $y . '" '); return $query->num_rows(); } public function pending_monthly_design_count_amount_get_customerdata1($table,$m,$y,$s) { $query = $this->db->query('SELECT * FROM design_weave where Month(STR_TO_DATE (finalized_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (finalized_date,"%d-%m-%Y"))="' . $y . '" '); return $query->num_rows(); } public function pending_year_design_count_amount_get_customerdata1($table,$y,$s) { $query = $this->db->query('SELECT * FROM design_weave where Year(STR_TO_DATE (finalized_date,"%d-%m-%Y"))="' . $y . '" '); return $query->num_rows(); } public function complete_monthly_design_count_amount_get_customerdata1($table,$m,$y,$s) { $query = $this->db->query('SELECT * FROM design_weave where Month(STR_TO_DATE (approved_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (approved_date,"%d-%m-%Y"))="' . $y . '" '); return $query->num_rows(); } public function complete_year_design_count_amount_get_customerdata1($table,$y,$s) { $query = $this->db->query('SELECT * FROM design_weave where Year(STR_TO_DATE (approved_date,"%d-%m-%Y"))="' . $y . '" '); return $query->num_rows(); } public function monthly_design_count_amount_get_customerdata11($table,$m,$y,$s) { $query = $this->db->query('SELECT * FROM design_weave where Month(STR_TO_DATE (created_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_date,"%d-%m-%Y"))="' . $y . '" '); return $query->result(); } public function year_design_count_amount_get_customerdata11($table,$y,$s) { $query = $this->db->query('SELECT * FROM design_weave where Year(STR_TO_DATE (created_date,"%d-%m-%Y"))="' . $y . '" '); return $query->result(); } public function pending_monthly_design_count_amount_get_customerdata11($table,$m,$y,$s) { $query = $this->db->query('SELECT * FROM design_weave where Month(STR_TO_DATE (finalized_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (finalized_date,"%d-%m-%Y"))="' . $y . '" '); return $query->result(); } public function pending_year_design_count_amount_get_customerdata11($table,$y,$s) { $query = $this->db->query('SELECT * FROM design_weave where Year(STR_TO_DATE (finalized_date,"%d-%m-%Y"))="' . $y . '" '); return $query->result(); } public function complete_monthly_design_count_amount_get_customerdata11($table,$m,$y,$s) { $query = $this->db->query('SELECT * FROM design_weave where Month(STR_TO_DATE (approved_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (approved_date,"%d-%m-%Y"))="' . $y . '" '); return $query->result(); } public function complete_year_design_count_amount_get_customerdata11($table,$y,$s) { $query = $this->db->query('SELECT * FROM design_weave where Year(STR_TO_DATE (approved_date,"%d-%m-%Y"))="' . $y . '" '); return $query->result(); } ///////////////////////////////////////////// issue cs ////////////////////////////////////////////// public function monthly_issue_cs_dashboard_po_list_id($table,$m,$y) { $query = $this->db->query('SELECT * FROM cs_addstock where Month(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->num_rows(); } public function year_issue_cs_dashboard_po_list_id($table,$y) { $query = $this->db->query('SELECT * FROM cs_addstock where Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->num_rows(); } public function monthly_issue_cs_dashboard_po_list_id1($table,$m,$y) { $query = $this->db->query('SELECT * FROM cs_addstock where Month(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->result(); } public function year_issue_cs_dashboard_po_list_id1($table,$y) { $query = $this->db->query('SELECT * FROM cs_addstock where Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->result(); } public function get_where_issue_cs_dataa($table,$where) { $this->db->select('*'); $this->db->group_by('work_order'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } ///////////////////////////////////////////// issue fabric ////////////////////////////////////////////// public function monthly_issue_fabric_dashboard_po_list_id($table,$m,$y) { $query = $this->db->query('SELECT * FROM fabric_addstock where Month(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->num_rows(); } public function year_issue_fabric_dashboard_po_list_id($table,$y) { $query = $this->db->query('SELECT * FROM fabric_addstock where Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->num_rows(); } public function monthly_issue_fabric_dashboard_po_list_id1($table,$m,$y) { $query = $this->db->query('SELECT * FROM fabric_addstock where Month(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->result(); } public function year_issue_fabric_dashboard_po_list_id1($table,$y) { $query = $this->db->query('SELECT * FROM fabric_addstock where Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->result(); } public function get_where_issue_fabric_dataa($table,$where) { $this->db->select('*'); $this->db->group_by('work_order'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } ///////////////////////////////////////////// exported fabric ////////////////////////////////////////////// public function monthly_export_fabric_dashboard_po_list_id($table,$m,$y) { $query = $this->db->query('SELECT fabric_addstock.id,fabric_addstock.issue_stock,fabric_inspection_details.vendor_name,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.design,fabric_inspection_details.consumed_at,fabric_addstock.ssl_pc_no FROM fabric_inspection_details INNER JOIN fabric_addstock ON fabric_inspection_details.id=fabric_addstock.fabric_id where Month(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" AND issue_stock > 0 GROUP BY work_order'); return $query->num_rows(); } public function monthly_export_packing_result_dashboard_po_list_id($table,$m,$y) { $query = $this->db->query('SELECT fabric_addstock.id,fabric_inspection_details.units_val as unit,fabric_addstock.issue_stock,fabric_inspection_details.vendor_name,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.design,fabric_inspection_details.consumed_at,fabric_addstock.ssl_pc_no FROM fabric_inspection_details INNER JOIN fabric_addstock ON fabric_inspection_details.id=fabric_addstock.fabric_id where Month(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" AND issue_stock > 0 GROUP BY work_order'); return $query->result(); } public function year_export_fabric_dashboard_po_list_id($table,$y) { $query = $this->db->query('SELECT fabric_addstock.id,fabric_addstock.issue_stock,fabric_inspection_details.vendor_name,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.design,fabric_inspection_details.consumed_at,fabric_addstock.ssl_pc_no FROM fabric_inspection_details INNER JOIN fabric_addstock ON fabric_inspection_details.id=fabric_addstock.fabric_id where Year(STR_TO_DATE (fabric_addstock.created_at,"%d/%m/%Y"))="' . $y . '" AND fabric_addstock.issue_stock > 0'); return $query->num_rows(); } public function monthly_export_packing_dashboard_po_list_id($table,$m,$y) { $query = $this->db->query('SELECT * FROM packing_list_data INNER JOIN package_packing ON packing_list_data.id=package_packing.pack_id where Month(STR_TO_DATE (packing_list_data.created_at,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (packing_list_data.created_at,"%d-%m-%Y"))="' . $y . '" AND package_packing.exp_qty > 0 GROUP BY packing_list_data.invoice'); return $query->num_rows(); } public function year_export_packing_dashboard_po_list_id($table,$y) { $query = $this->db->query('SELECT * FROM packing_list_data INNER JOIN package_packing ON packing_list_data.id=package_packing.pack_id where Year(STR_TO_DATE (packing_list_data.created_at,"%d-%m-%Y"))="' . $y . '" AND package_packing.exp_qty > 0 GROUP BY packing_list_data.invoice'); return $query->num_rows(); } public function year_export_packing_result_dashboard_po_list_id($table,$y) { $query = $this->db->query('SELECT fabric_addstock.id,fabric_inspection_details.units_val as unit,fabric_addstock.issue_stock,fabric_inspection_details.vendor_name,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.design,fabric_inspection_details.consumed_at,fabric_addstock.ssl_pc_no FROM fabric_inspection_details INNER JOIN fabric_addstock ON fabric_inspection_details.id=fabric_addstock.fabric_id where Year(STR_TO_DATE (fabric_addstock.created_at,"%d/%m/%Y"))="' . $y . '" AND fabric_addstock.issue_stock > 0'); return $query->result(); } public function exported_result_fabric_details($d) { $this->db->select('fabric_addstock.id,fabric_addstock.issue_stock,fabric_inspection_details.vendor_name,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.design,fabric_inspection_details.consumed_at,fabric_addstock.ssl_pc_no,fabric_inspection_details.units_val as unit'); $this->db->order_by('fabric_inspection_details.id','desc'); $this->db->from('fabric_inspection_details'); $this->db->join('fabric_addstock', 'fabric_addstock.fabric_id = fabric_inspection_details.id'); $this->db->where('fabric_addstock.created_at',$d); $this->db->where('fabric_addstock.issue_stock !=',''); $query=$this->db->get(); return $query->result(); } public function exported_packing_RESULT_fabric_details($d,$d1) { $this->db->select('package_packing.id,package_packing.exp_qty,fabric_inspection_details.vendor_name,fabric_inspection_details.piece_no,package_packing.po_no,fabric_inspection_details.product_name,package_packing.width,package_packing.shades,fabric_inspection_details.design,fabric_inspection_details.consumed_at,package_packing.ssl_pc_no,fabric_inspection_details.units_val as unit'); $this->db->order_by('fabric_inspection_details.id','desc'); $this->db->from('fabric_inspection_details'); $this->db->join('package_packing', 'package_packing.stcok_id = fabric_inspection_details.id'); $this->db->join('packing_list_data', 'packing_list_data.id = package_packing.pack_id'); $this->db->where('package_packing.exp_qty !=',''); $this->db->where('packing_list_data.created_at',$d); $this->db->or_where('packing_list_data.created_at',$d1); $query=$this->db->get(); return $query->result(); } public function exported_packing_rows_RESULT_fabric_details($d,$d1) { $this->db->select('package_packing.id,package_packing.exp_qty,fabric_inspection_details.vendor_name,fabric_inspection_details.piece_no,package_packing.po_no,fabric_inspection_details.product_name,package_packing.width,package_packing.shades,fabric_inspection_details.design,fabric_inspection_details.consumed_at,package_packing.ssl_pc_no'); $this->db->order_by('fabric_inspection_details.id','desc'); $this->db->from('fabric_inspection_details'); $this->db->join('package_packing', 'package_packing.stcok_id = fabric_inspection_details.id'); $this->db->join('packing_list_data', 'packing_list_data.id = package_packing.pack_id'); $this->db->where('package_packing.exp_qty !=',''); $this->db->where('packing_list_data.created_at',$d); $this->db->or_where('packing_list_data.created_at',$d1); $query=$this->db->get(); return $query->num_rows(); } public function monthly_export_packing_resultss_dashboard_po_list_id($table,$m,$y) { $query = $this->db->query('SELECT package_packing.id,package_packing.exp_qty,fabric_inspection_details.units_val as unit,fabric_inspection_details.vendor_name,fabric_inspection_details.piece_no,package_packing.po_no,fabric_inspection_details.product_name,package_packing.width,package_packing.shades,fabric_inspection_details.design,fabric_inspection_details.consumed_at,package_packing.ssl_pc_no FROM packing_list_data INNER JOIN package_packing ON packing_list_data.id=package_packing.pack_id INNER JOIN fabric_inspection_details ON package_packing.stcok_id=fabric_inspection_details.id where Month(STR_TO_DATE (packing_list_data.created_at,"%d/%m/%Y"))="' . $m . '" OR Month(STR_TO_DATE (packing_list_data.created_at,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (packing_list_data.created_at,"%d/%m/%Y"))="' . $y . '" OR Year(STR_TO_DATE (packing_list_data.created_at,"%d-%m-%Y"))="' . $y . '" AND package_packing.exp_qty > 0 GROUP BY packing_list_data.invoice'); return $query->result(); } public function year_export_packing_resultsss_dashboard_po_list_id($table,$y) { $query = $this->db->query('SELECT package_packing.id,package_packing.exp_qty,fabric_inspection_details.units_val as unit,fabric_inspection_details.vendor_name,fabric_inspection_details.piece_no,package_packing.po_no,fabric_inspection_details.product_name,package_packing.width,package_packing.shades,fabric_inspection_details.design,fabric_inspection_details.consumed_at,package_packing.ssl_pc_no FROM packing_list_data INNER JOIN package_packing ON packing_list_data.id=package_packing.pack_id INNER JOIN fabric_inspection_details ON package_packing.stcok_id=fabric_inspection_details.id where Year(STR_TO_DATE (packing_list_data.created_at,"%d/%m/%Y"))="' . $y . '" OR Year(STR_TO_DATE (packing_list_data.created_at,"%d-%m-%Y"))="' . $y . '" AND package_packing.exp_qty > 0 GROUP BY packing_list_data.invoice'); return $query->result(); } public function monthly_export_packing_date_dashboard_po_list_id($table,$m,$y) { $query = $this->db->query('SELECT package_packing.id,package_packing.exp_qty,fabric_inspection_details.vendor_name,fabric_inspection_details.piece_no,package_packing.po_no,fabric_inspection_details.product_name,package_packing.width,package_packing.shades,fabric_inspection_details.design,fabric_inspection_details.consumed_at,package_packing.ssl_pc_no FROM packing_list_data INNER JOIN package_packing ON packing_list_data.id=package_packing.pack_id INNER JOIN fabric_inspection_details ON package_packing.stcok_id=fabric_inspection_details.id where Month(STR_TO_DATE (packing_list_data.created_at,"%d/%m/%Y"))="' . $m . '" OR Month(STR_TO_DATE (packing_list_data.created_at,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (packing_list_data.created_at,"%d/%m/%Y"))="' . $y . '" OR Year(STR_TO_DATE (packing_list_data.created_at,"%d-%m-%Y"))="' . $y . '" AND package_packing.exp_qty > 0 GROUP BY packing_list_data.invoice'); return $query->num_rows(); } public function year_export_packing_date_dashboard_po_list_id($table,$y) { $query = $this->db->query('SELECT package_packing.id,package_packing.exp_qty,fabric_inspection_details.vendor_name,fabric_inspection_details.piece_no,package_packing.po_no,fabric_inspection_details.product_name,package_packing.width,package_packing.shades,fabric_inspection_details.design,fabric_inspection_details.consumed_at,package_packing.ssl_pc_no FROM packing_list_data INNER JOIN package_packing ON packing_list_data.id=package_packing.pack_id INNER JOIN fabric_inspection_details ON package_packing.stcok_id=fabric_inspection_details.id where Year(STR_TO_DATE (packing_list_data.created_at,"%d/%m/%Y"))="' . $y . '" OR Year(STR_TO_DATE (packing_list_data.created_at,"%d-%m-%Y"))="' . $y . '" AND package_packing.exp_qty > 0 GROUP BY packing_list_data.invoice'); return $query->num_rows(); } /////////////////////////////////////////// marketing ////////////////////////////////// public function marketing_dashboard_po_list_id($where,$d) { $this->db->select('*'); $this->db->group_by('sub_orders.orderID'); $this->db->from('orders'); $this->db->join('sub_orders', 'sub_orders.orderID = orders.id'); $this->db->where('sub_orders.created_date',$where); $this->db->where('orders.orderType',$d); $query = $this->db->get(); return $query->num_rows(); } public function monthly_marketing_dashboard_po_list_id($table,$m,$y,$f) { $query = $this->db->query('SELECT * FROM orders INNER JOIN sub_orders ON orders.id=sub_orders.orderID where Month(STR_TO_DATE (sub_orders.created_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (sub_orders.created_date,"%d-%m-%Y"))="' . $y . '" AND orders.orderType="' . $f . '" GROUP BY sub_orders.orderID'); return $query->num_rows(); } public function year_marketing_dashboard_po_list_id($table,$y,$f) { $query = $this->db->query('SELECT * FROM orders INNER JOIN sub_orders ON orders.id=sub_orders.orderID where Year(STR_TO_DATE (sub_orders.created_date,"%d-%m-%Y"))="' . $y . '" AND orders.orderType="' . $f . '" GROUP BY sub_orders.orderID'); return $query->num_rows(); } public function monthly_marketing_res_dashboard_po_list_id($table,$m,$y,$f) { $query = $this->db->query('SELECT orders.*,sub_order_shades.planned_by,sub_order_shades.planningStatus FROM orders INNER JOIN sub_orders ON orders.id=sub_orders.orderID INNER JOIN sub_order_shades ON sub_order_shades.subOrderID =sub_orders.id where Month(STR_TO_DATE (sub_orders.created_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (sub_orders.created_date,"%d-%m-%Y"))="' . $y . '" AND orders.orderType="' . $f . '" GROUP BY sub_orders.orderID'); return $query->result(); } public function year_marketing_res_dashboard_po_list_id($table,$y,$f) { $query = $this->db->query('SELECT orders.*,sub_order_shades.planned_by,sub_order_shades.planningStatus FROM orders INNER JOIN sub_orders ON orders.id=sub_orders.orderID INNER JOIN sub_order_shades ON sub_order_shades.subOrderID =sub_orders.id where Year(STR_TO_DATE (sub_orders.created_date,"%d-%m-%Y"))="' . $y . '" AND orders.orderType="' . $f . '" GROUP BY sub_orders.orderID'); return $query->result(); } public function marketing_res_dashboard_po_list_id($where,$d) { $this->db->select('orders.*,sub_order_shades.planned_by,sub_order_shades.planningStatus'); $this->db->group_by('sub_orders.orderID'); $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_orders.created_date',$where); $this->db->where('orders.orderType',$d); $query = $this->db->get(); return $query->result(); } //////////////////////////////////// fabric inspection ////////////////////////////////////////////////////////// public function monthly_fabric_inspection_dashboard_po_list_id($table,$m,$y) { $query = $this->db->query('SELECT * FROM fabric_inspection_details where Month(STR_TO_DATE (received_date,"%d-%m-%Y"))="' . $m . '" OR Month(STR_TO_DATE (received_date,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE (received_date,"%d-%m-%Y"))="' . $y . '" OR Year(STR_TO_DATE (received_date,"%d/%m/%Y"))="' . $y . '"'); return $query->num_rows(); } public function monthly_fabric_inspection_dashboard_po_list_idd($table,$m,$y) { $query = $this->db->query('SELECT * FROM fabric_inspection_details where Month(STR_TO_DATE (received_date,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE (received_date,"%d/%m/%Y"))="' . $y . '" '); return $query->num_rows(); } public function year_fabric_inspection_dashboard_po_list_id($table,$y) { $query = $this->db->query('SELECT * FROM fabric_inspection_details where Year(STR_TO_DATE (received_date,"%d-%m-%Y"))="' . $y . '" OR Year(STR_TO_DATE (received_date,"%d/%m/%Y"))="' . $y . '" '); return $query->num_rows(); } public function year_fabric_inspection_dashboard_po_list_idd($table,$y) { $query = $this->db->query('SELECT * FROM fabric_inspection_details where Year(STR_TO_DATE (received_date,"%d/%m/%Y"))="' . $y . '" '); return $query->num_rows(); } public function fabric_inspection_count_amount_get_customerdata($table,$where,$where1) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $this->db->or_where($where1); $query = $this->db->get(); return $query->num_rows(); } public function fabric_inspection_result_count_amount_get_customerdata($table,$where,$where1) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $this->db->or_where($where1); $query = $this->db->get(); return $query->result(); } public function monthly_result_fabric_inspection_dashboard_po_list_id($table,$m,$y) { $query = $this->db->query('SELECT * FROM fabric_inspection_details where Month(STR_TO_DATE (received_date,"%d-%m-%Y"))="' . $m . '" OR Month(STR_TO_DATE (received_date,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE (received_date,"%d-%m-%Y"))="' . $y . '" OR Year(STR_TO_DATE (received_date,"%d/%m/%Y"))="' . $y . '"'); return $query->result(); } public function year_result_fabric_inspection_dashboard_po_list_id($table,$y) { $query = $this->db->query('SELECT * FROM fabric_inspection_details where Year(STR_TO_DATE (received_date,"%d-%m-%Y"))="' . $y . '" OR Year(STR_TO_DATE (received_date,"%d/%m/%Y"))="' . $y . '" '); return $query->result(); } //////////////////////////////////// packing list ///////////////////////////////////////////////////////////////////////////////////////////////////// public function packing_count_amount_get_customerdata($table,$where,$where1) { $this->db->select('*'); $this->db->group_by("invoice"); $this->db->from($table); $this->db->where($where); $this->db->or_where($where1); $query = $this->db->get(); return $query->num_rows(); } public function monthly_packing_created_po_generate($table,$m,$y) { $query = $this->db->query('SELECT * FROM packing_list_data where Month(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $m . '" OR Month(STR_TO_DATE (created_at,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" OR Year(STR_TO_DATE (created_at,"%d/%m/%Y"))="' . $y . '" GROUP BY invoice'); return $query->num_rows(); } public function year_packing_created_po_generate($table,$y) { $query = $this->db->query('SELECT * FROM packing_list_data where Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" OR Year(STR_TO_DATE (created_at,"%d/%m/%Y"))="' . $y . '" GROUP BY invoice'); return $query->num_rows(); } public function packing_res_amount_get_customerdata($table,$where,$where1) { $this->db->select('*'); $this->db->group_by("invoice"); $this->db->from($table); $this->db->where($where); $this->db->or_where($where1); $query = $this->db->get(); return $query->result(); } public function monthly_packing_res_created_po_generate($table,$m,$y) { $query = $this->db->query('SELECT * FROM packing_list_data where Month(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $m . '" OR Month(STR_TO_DATE (created_at,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" OR Year(STR_TO_DATE (created_at,"%d/%m/%Y"))="' . $y . '" GROUP BY invoice'); return $query->result(); } public function year_packing_res_created_po_generate($table,$y) { $query = $this->db->query('SELECT * FROM packing_list_data where Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" OR Year(STR_TO_DATE (created_at,"%d/%m/%Y"))="' . $y . '" GROUP BY invoice'); return $query->result(); } public function monthly_packing_madeups_created_po_generate($table,$m,$y) { $query = $this->db->query('SELECT * FROM madeups_list_data where Month(STR_TO_DATE (created_at,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d/%m/%Y"))="' . $y . '" GROUP BY invoice'); return $query->num_rows(); } public function year_packing_madeups_created_po_generate($table,$y) { $query = $this->db->query('SELECT * FROM madeups_list_data where Year(STR_TO_DATE (created_at,"%d/%m/%Y"))="' . $y . '" GROUP BY invoice'); return $query->num_rows(); } public function monthly_packing_madeups_res_created_po_generate($table,$m,$y) { $query = $this->db->query('SELECT * FROM madeups_list_data where Month(STR_TO_DATE (created_at,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d/%m/%Y"))="' . $y . '" GROUP BY invoice'); return $query->result(); } public function year_packing_madeups_res_created_po_generate($table,$y) { $query = $this->db->query('SELECT * FROM madeups_list_data where Year(STR_TO_DATE (created_at,"%d/%m/%Y"))="' . $y . '" GROUP BY invoice'); return $query->result(); } //////////////////////////////////////////////////// madeups ////////////////////////////////////////////// public function monthly_fabric_madeups_res_created_po_generate($table,$m,$y) { $query = $this->db->query('SELECT * FROM fabric_madeups where Month(STR_TO_DATE (created_at,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d/%m/%Y"))="' . $y . '" GROUP BY plan_id'); return $query->num_rows(); } public function year_fabric_madeups_res_created_po_generate($table,$y) { $query = $this->db->query('SELECT * FROM fabric_madeups where Year(STR_TO_DATE (created_at,"%d/%m/%Y"))="' . $y . '" GROUP BY plan_id'); return $query->num_rows(); } public function monthly_consumable_madeups_res_created_po_generate($table,$m,$y) { $query = $this->db->query('SELECT * FROM consumable_madeups where Month(STR_TO_DATE (created_at,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d/%m/%Y"))="' . $y . '" GROUP BY plan_id'); return $query->num_rows(); } public function year_consumable_madeups_res_created_po_generate($table,$y) { $query = $this->db->query('SELECT * FROM consumable_madeups where Year(STR_TO_DATE (created_at,"%d/%m/%Y"))="' . $y . '" GROUP BY plan_id'); return $query->num_rows(); } public function fabric_no_plan_madeups_no_planned_details($d) { $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,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->join('fabric_madeups', 'pm.id=fabric_madeups.plan_id'); $this->db->where('fabric_madeups.created_at', $d); $this->db->where('pm.confirm', 'No'); $this->db->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->num_rows(); } public function fabric_planned_madeups_no_planned_details($d) { $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,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->join('fabric_madeups', 'pm.id=fabric_madeups.plan_id'); $this->db->where('fabric_madeups.created_at', $d); $this->db->where('pm.confirm', 'Yes'); $this->db->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->num_rows(); } public function monthly_madeups_res_dashboard_po_list_id($table,$m,$y,$f) { $query = $this->db->query('SELECT * FROM planned_order INNER JOIN fabric_madeups ON planned_order.id=fabric_madeups.plan_id where Month(STR_TO_DATE (fabric_madeups.created_at,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE (fabric_madeups.created_at,"%d/%m/%Y"))="' . $y . '" AND planned_order.confirm="' . $f . '" GROUP BY fabric_madeups.plan_id'); return $query->num_rows(); } public function yearly_madeups_res_dashboard_po_list_id($table,$y,$f) { $query = $this->db->query('SELECT * FROM planned_order INNER JOIN fabric_madeups ON planned_order.id=fabric_madeups.plan_id where Year(STR_TO_DATE (fabric_madeups.created_at,"%d/%m/%Y"))="' . $y . '" AND planned_order.confirm="' . $f . '" GROUP BY fabric_madeups.plan_id'); return $query->num_rows(); } public function yearly_madeups_result_fetch_dashboard_po_list_id($table,$y,$f) { $query = $this->db->query('SELECT planned_order.id,orders.fileNo,orders.oslNo,orders.deliveryDate,sub_orders.unit,shade_master.shadeName,planned_order.pieceLength,sub_orders.subOrderType,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_orders.description,sub_order_shades.buyerShade,sub_order_shades.quantity,sub_orders.width,sub_order_shades.issue_stock,sub_order_shades.consumable_stock,planned_order.confirm,planned_order.issue_status,planned_order.add_stock_status FROM sub_order_shades INNER JOIN sub_orders ON sub_orders.id=sub_order_shades.subOrderID INNER JOIN orders ON orders.id=sub_orders.orderID INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo INNER JOIN shade_master ON shade_master.shadeID=planned_order.sslShade INNER JOIN fabric_madeups ON fabric_madeups.plan_id=planned_order.id where Year(STR_TO_DATE (fabric_madeups.created_at,"%d/%m/%Y"))="' . $y . '" GROUP BY fabric_madeups.plan_id'); return $query->result(); } public function mponthly_madeups_result_fetch_dashboard_po_list_id($table,$m,$y,$f) { $query = $this->db->query('SELECT planned_order.id,orders.fileNo,orders.oslNo,orders.deliveryDate,sub_orders.unit,shade_master.shadeName,planned_order.pieceLength,sub_orders.subOrderType,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_orders.description,sub_order_shades.buyerShade,sub_order_shades.quantity,sub_orders.width,sub_order_shades.issue_stock,sub_order_shades.consumable_stock,planned_order.confirm,planned_order.issue_status,planned_order.add_stock_status FROM sub_order_shades INNER JOIN sub_orders ON sub_orders.id=sub_order_shades.subOrderID INNER JOIN orders ON orders.id=sub_orders.orderID INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo INNER JOIN shade_master ON shade_master.shadeID=planned_order.sslShade INNER JOIN fabric_madeups ON fabric_madeups.plan_id=planned_order.id where Month(STR_TO_DATE (fabric_madeups.created_at,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE (fabric_madeups.created_at,"%d/%m/%Y"))="' . $y . '" GROUP BY fabric_madeups.plan_id'); return $query->result(); } public function fabric_con_no_plan_madeups_no_planned_details($d) { $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,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->join('consumable_madeups', 'pm.id=consumable_madeups.plan_id'); $this->db->where('consumable_madeups.created_at', $d); $this->db->where('pm.confirm', 'No'); $this->db->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->num_rows(); } public function fabric_con_planned_madeups_no_planned_details($d) { $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,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->join('consumable_madeups', 'pm.id=consumable_madeups.plan_id'); $this->db->where('consumable_madeups.created_at', $d); $this->db->where('pm.confirm', 'Yes'); $this->db->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->num_rows(); } public function monthly_con_madeups_res_dashboard_po_list_id($table,$m,$y,$f) { $query = $this->db->query('SELECT * FROM planned_order INNER JOIN consumable_madeups ON planned_order.id=consumable_madeups.plan_id where Month(STR_TO_DATE (consumable_madeups.created_at,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE (consumable_madeups.created_at,"%d/%m/%Y"))="' . $y . '" AND planned_order.confirm="' . $f . '" GROUP BY consumable_madeups.plan_id'); return $query->num_rows(); } public function yearly_con_madeups_res_dashboard_po_list_id($table,$y,$f) { $query = $this->db->query('SELECT * FROM planned_order INNER JOIN consumable_madeups ON planned_order.id=consumable_madeups.plan_id where Year(STR_TO_DATE (consumable_madeups.created_at,"%d/%m/%Y"))="' . $y . '" AND planned_order.confirm="' . $f . '" GROUP BY consumable_madeups.plan_id'); return $query->num_rows(); } public function fabric_planned_madeups_no_res_planned_details($d,$t) { $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->join('fabric_madeups', 'pm.id=fabric_madeups.plan_id'); $this->db->where('fabric_madeups.created_at', $d); // $this->db->where('pm.confirm', $t); $this->db->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->result(); } public function consuam_planned_madeups_no_res_planned_details($d,$t) { $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.confirm,pm.issue_status,pm.add_stock_status'); $this->db->group_by('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('consumable_madeups', 'pm.id=consumable_madeups.plan_id'); $this->db->where('consumable_madeups.created_at', $d); // $this->db->where('pm.confirm', $t); $this->db->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->result(); } public function yearly_madeups_consuma_result_fetch_dashboard_po_list_id($table,$y,$f) { $query = $this->db->query('SELECT planned_order.id,orders.fileNo,orders.oslNo,orders.deliveryDate,sub_orders.unit,shade_master.shadeName,planned_order.pieceLength,sub_orders.subOrderType,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_orders.description,sub_order_shades.buyerShade,sub_order_shades.quantity,sub_orders.width,sub_order_shades.issue_stock,sub_order_shades.consumable_stock,planned_order.confirm,planned_order.issue_status,planned_order.add_stock_status FROM sub_order_shades INNER JOIN sub_orders ON sub_orders.id=sub_order_shades.subOrderID INNER JOIN orders ON orders.id=sub_orders.orderID INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo INNER JOIN shade_master ON shade_master.shadeID=planned_order.sslShade INNER JOIN consumable_madeups ON consumable_madeups.plan_id=planned_order.id where Year(STR_TO_DATE (consumable_madeups.created_at,"%d/%m/%Y"))="' . $y . '" GROUP BY consumable_madeups.plan_id'); return $query->result(); } public function mponthly_madeups_consuma_result_fetch_dashboard_po_list_id($table,$m,$y,$f) { $query = $this->db->query('SELECT planned_order.id,orders.fileNo,orders.oslNo,orders.deliveryDate,sub_orders.unit,shade_master.shadeName,planned_order.pieceLength,sub_orders.subOrderType,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_orders.description,sub_order_shades.buyerShade,sub_order_shades.quantity,sub_orders.width,sub_order_shades.issue_stock,sub_order_shades.consumable_stock,planned_order.confirm,planned_order.issue_status,planned_order.add_stock_status FROM sub_order_shades INNER JOIN sub_orders ON sub_orders.id=sub_order_shades.subOrderID INNER JOIN orders ON orders.id=sub_orders.orderID INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo INNER JOIN shade_master ON shade_master.shadeID=planned_order.sslShade INNER JOIN consumable_madeups ON consumable_madeups.plan_id=planned_order.id where Month(STR_TO_DATE (consumable_madeups.created_at,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE (consumable_madeups.created_at,"%d/%m/%Y"))="' . $y . '" GROUP BY consumable_madeups.plan_id'); return $query->result(); } public function fabric_delivery_planned_madeups_no_res_planned_details($d,$t) { $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->group_by('o.oslNo'); $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_delivery_confirmation', 'pm.id=fabric_madeups_delivery_confirmation.ref_id'); $this->db->where('fabric_madeups_delivery_confirmation.rec_date', $d); $this->db->where('pm.confirm', $t); $this->db->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->result(); } public function yearly_madeups_result_fetch_delievry_dashboard_po_list_id($table,$y,$f) { $query = $this->db->query('SELECT planned_order.id,orders.fileNo,orders.oslNo,orders.deliveryDate,sub_orders.unit,shade_master.shadeName,planned_order.pieceLength,sub_orders.subOrderType,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_orders.description,sub_order_shades.buyerShade,sub_order_shades.quantity,sub_orders.width,sub_order_shades.issue_stock,sub_order_shades.consumable_stock,planned_order.confirm,planned_order.issue_status,planned_order.add_stock_status FROM sub_order_shades INNER JOIN sub_orders ON sub_orders.id=sub_order_shades.subOrderID INNER JOIN orders ON orders.id=sub_orders.orderID INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo INNER JOIN shade_master ON shade_master.shadeID=planned_order.sslShade INNER JOIN fabric_madeups_delivery_confirmation ON fabric_madeups_delivery_confirmation.ref_id=planned_order.id where Year(STR_TO_DATE (fabric_madeups_delivery_confirmation.rec_date,"%d/%m/%Y"))="' . $y . '" AND planned_order.confirm="' . $f . '" GROUP BY orders.oslNo'); return $query->result(); } public function mponthly_madeups_result_fetch_delievry_dashboard_po_list_id($table,$m,$y,$f) { $query = $this->db->query('SELECT planned_order.id,orders.fileNo,orders.oslNo,orders.deliveryDate,sub_orders.unit,shade_master.shadeName,planned_order.pieceLength,sub_orders.subOrderType,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_orders.description,sub_order_shades.buyerShade,sub_order_shades.quantity,sub_orders.width,sub_order_shades.issue_stock,sub_order_shades.consumable_stock,planned_order.confirm,planned_order.issue_status,planned_order.add_stock_status FROM sub_order_shades INNER JOIN sub_orders ON sub_orders.id=sub_order_shades.subOrderID INNER JOIN orders ON orders.id=sub_orders.orderID INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo INNER JOIN shade_master ON shade_master.shadeID=planned_order.sslShade INNER JOIN fabric_madeups_delivery_confirmation ON fabric_madeups_delivery_confirmation.ref_id=planned_order.id where Month(STR_TO_DATE (fabric_madeups_delivery_confirmation.rec_date,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE (fabric_madeups_delivery_confirmation.rec_date,"%d/%m/%Y"))="' . $y . '" AND planned_order.confirm="' . $f . '" GROUP BY orders.oslNo'); return $query->result(); } public function deliver_monthly_consumable_madeups_res_created_po_generate($table,$m,$y) { $query = $this->db->query('SELECT * FROM fabric_madeups_delivery_confirmation where Month(STR_TO_DATE (rec_date,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE (rec_date,"%d/%m/%Y"))="' . $y . '" GROUP BY ref_id'); return $query->num_rows(); } public function deliver_year_consumable_madeups_res_created_po_generate($table,$y) { $query = $this->db->query('SELECT * FROM fabric_madeups_delivery_confirmation where Year(STR_TO_DATE (rec_date,"%d/%m/%Y"))="' . $y . '" GROUP BY ref_id'); return $query->num_rows(); } public function fabric_delivery_planned_madeups_no_res_planned_details1($d,$t) { $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,pm.add_stock_status'); $this->db->group_by('o.oslNo'); $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_delivery_confirmation', 'pm.id=fabric_madeups_delivery_confirmation.ref_id'); $this->db->where('fabric_madeups_delivery_confirmation.rec_date', $d); $this->db->where('pm.confirm', $t); $this->db->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->num_rows(); } public function yearly_madeups_result_fetch_delievry_dashboard_po_list_id1($table,$y,$f) { $query = $this->db->query('SELECT planned_order.id,orders.oslNo,orders.deliveryDate,sub_orders.unit,shade_master.shadeName,planned_order.pieceLength,sub_orders.subOrderType,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_orders.description,sub_order_shades.buyerShade,sub_order_shades.quantity,sub_orders.width,sub_order_shades.issue_stock,sub_order_shades.consumable_stock,planned_order.confirm,planned_order.issue_status,planned_order.add_stock_status FROM sub_order_shades INNER JOIN sub_orders ON sub_orders.id=sub_order_shades.subOrderID INNER JOIN orders ON orders.id=sub_orders.orderID INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo INNER JOIN shade_master ON shade_master.shadeID=planned_order.sslShade INNER JOIN fabric_madeups_delivery_confirmation ON fabric_madeups_delivery_confirmation.ref_id=planned_order.id where Year(STR_TO_DATE (fabric_madeups_delivery_confirmation.rec_date,"%d/%m/%Y"))="' . $y . '" AND planned_order.confirm="' . $f . '" GROUP BY orders.oslNo'); return $query->num_rows(); } public function mponthly_madeups_result_fetch_delievry_dashboard_po_list_id1($table,$m,$y,$f) { $query = $this->db->query('SELECT planned_order.id,orders.oslNo,orders.deliveryDate,sub_orders.unit,shade_master.shadeName,planned_order.pieceLength,sub_orders.subOrderType,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_orders.description,sub_order_shades.buyerShade,sub_order_shades.quantity,sub_orders.width,sub_order_shades.issue_stock,sub_order_shades.consumable_stock,planned_order.confirm,planned_order.issue_status,planned_order.add_stock_status FROM sub_order_shades INNER JOIN sub_orders ON sub_orders.id=sub_order_shades.subOrderID INNER JOIN orders ON orders.id=sub_orders.orderID INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo INNER JOIN shade_master ON shade_master.shadeID=planned_order.sslShade INNER JOIN fabric_madeups_delivery_confirmation ON fabric_madeups_delivery_confirmation.ref_id=planned_order.id where Month(STR_TO_DATE (fabric_madeups_delivery_confirmation.rec_date,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE (fabric_madeups_delivery_confirmation.rec_date,"%d/%m/%Y"))="' . $y . '" AND planned_order.confirm="' . $f . '" GROUP BY orders.oslNo'); return $query->num_rows(); } //////////////////////////////// planning /////////////////////////////////// public function mponthly_planning_fetch_dashboard_po_list_id1($table,$m,$y,$o,$a,$p,$s) { $query = $this->db->query('SELECT * FROM orders INNER JOIN sub_orders ON sub_orders.orderID=orders.id INNER JOIN sub_order_shades ON sub_order_shades.subOrderID=sub_orders.id INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo where Month(STR_TO_DATE(planned_order.plannedDate,"%Y-%m-%d"))="' . $m . '" AND Year(STR_TO_DATE(planned_order.plannedDate,"%Y-%m-%d"))="' . $y . '" AND sub_orders.orderConfirm="' . $o . '" AND sub_orders.article_type="' . $a . '" AND sub_order_shades.planningStatus="' . $p . '" OR sub_order_shades.planningStatus="' . $s . '" GROUP BY orders.oslNo ORDER BY orders.id DESC'); return $query->num_rows(); } public function yearly_planning_fetch_dashboard_po_list_id1($table,$m,$y,$o,$a,$p,$s) { $query = $this->db->query('SELECT * FROM orders INNER JOIN sub_orders ON sub_orders.orderID=orders.id INNER JOIN sub_order_shades ON sub_order_shades.subOrderID=sub_orders.id INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo where Year(STR_TO_DATE(planned_order.plannedDate,"%Y-%m-%d"))="' . $y . '" AND sub_orders.orderConfirm="' . $o . '" AND sub_orders.article_type="' . $a . '" AND sub_order_shades.planningStatus="' . $p . '" OR sub_order_shades.planningStatus="' . $s . '" GROUP BY orders.oslNo ORDER BY orders.id DESC'); return $query->num_rows(); } public function marketing_planning_notification_gets_details2($where) { $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->join('planned_order', 'planned_order.subNo= sos.shadeID'); $this->db->where('planned_order.plannedDate',$where); $this->db->order_by("id", "desc"); $this->db->group_by('oslNo'); $query = $this->db->get(); return $query->result(); } public function mponthly_planning_fetch_dashboard_pos_list_id1($table,$m,$y,$o,$a,$p,$s) { $query = $this->db->query('SELECT * FROM orders INNER JOIN sub_orders ON sub_orders.orderID=orders.id INNER JOIN sub_order_shades ON sub_order_shades.subOrderID=sub_orders.id INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo where Month(STR_TO_DATE(planned_order.plannedDate,"%Y-%m-%d"))="' . $m . '" AND Year(STR_TO_DATE(planned_order.plannedDate,"%Y-%m-%d"))="' . $y . '" AND sub_orders.orderConfirm="' . $o . '" AND sub_orders.article_type="' . $a . '" AND sub_order_shades.planningStatus="' . $p . '" OR sub_order_shades.planningStatus="' . $s . '" GROUP BY orders.oslNo ORDER BY orders.id DESC'); return $query->result(); } public function yearly_planning_fetch_dashboard_pos_list_id1($table,$m,$y,$o,$a,$p,$s) { $query = $this->db->query('SELECT * FROM orders INNER JOIN sub_orders ON sub_orders.orderID=orders.id INNER JOIN sub_order_shades ON sub_order_shades.subOrderID=sub_orders.id INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo where Year(STR_TO_DATE(planned_order.plannedDate,"%Y-%m-%d"))="' . $y . '" AND sub_orders.orderConfirm="' . $o . '" AND sub_orders.article_type="' . $a . '" AND sub_order_shades.planningStatus="' . $p . '" OR sub_order_shades.planningStatus="' . $s . '" GROUP BY orders.oslNo ORDER BY orders.id DESC'); return $query->result(); } public function marketing_planning_notification_get_details222($where) { $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', 'outsource'); $this->db->join('sub_orders so', 'so.orderID = o.id'); $this->db->join('sub_order_shades sos', 'sos.subOrderID = so.id'); $this->db->join('planned_order', 'planned_order.subNo= sos.shadeID'); $this->db->where('planned_order.plannedDate',$where); $this->db->order_by("id", "desc"); $this->db->group_by('oslNo'); $query = $this->db->get(); return $query->num_rows(); } public function mponthly_planning_fetch_dashboard_po_list_id12($table,$m,$y,$o,$a,$p,$s) { $query = $this->db->query('SELECT * FROM orders INNER JOIN sub_orders ON sub_orders.orderID=orders.id INNER JOIN sub_order_shades ON sub_order_shades.subOrderID=sub_orders.id INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo where Month(STR_TO_DATE(planned_order.plannedDate,"%Y-%m-%d"))="' . $m . '" AND Year(STR_TO_DATE(planned_order.plannedDate,"%Y-%m-%d"))="' . $y . '" AND sub_orders.orderConfirm="' . $o . '" AND sub_orders.article_type="' . $a . '" AND sub_order_shades.planningStatus="' . $p . '" OR sub_order_shades.planningStatus="' . $s . '" GROUP BY orders.oslNo ORDER BY orders.id DESC'); return $query->num_rows(); } public function yearly_planning_fetch_dashboard_po_list_id12($table,$m,$y,$o,$a,$p,$s) { $query = $this->db->query('SELECT * FROM orders INNER JOIN sub_orders ON sub_orders.orderID=orders.id INNER JOIN sub_order_shades ON sub_order_shades.subOrderID=sub_orders.id INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo where Year(STR_TO_DATE(planned_order.plannedDate,"%Y-%m-%d"))="' . $y . '" AND sub_orders.orderConfirm="' . $o . '" AND sub_orders.article_type="' . $a . '" AND sub_order_shades.planningStatus="' . $p . '" OR sub_order_shades.planningStatus="' . $s . '" GROUP BY orders.oslNo ORDER BY orders.id DESC'); return $query->num_rows(); } public function marketing_planning_notification_gets_details222($where) { $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', 'outsource'); $this->db->join('sub_orders so', 'so.orderID = o.id'); $this->db->join('sub_order_shades sos', 'sos.subOrderID = so.id'); $this->db->join('planned_order', 'planned_order.subNo= sos.shadeID'); $this->db->where('planned_order.plannedDate',$where); $this->db->order_by("id", "desc"); $this->db->group_by('oslNo'); $query = $this->db->get(); return $query->result(); } public function mponthly_planning_fetch_dashboard_pos_list_id12($table,$m,$y,$o,$a,$p,$s) { $query = $this->db->query('SELECT * FROM orders INNER JOIN sub_orders ON sub_orders.orderID=orders.id INNER JOIN sub_order_shades ON sub_order_shades.subOrderID=sub_orders.id INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo where Month(STR_TO_DATE(planned_order.plannedDate,"%Y-%m-%d"))="' . $m . '" AND Year(STR_TO_DATE(planned_order.plannedDate,"%Y-%m-%d"))="' . $y . '" AND sub_orders.orderConfirm="' . $o . '" AND sub_orders.article_type="' . $a . '" AND sub_order_shades.planningStatus="' . $p . '" OR sub_order_shades.planningStatus="' . $s . '" GROUP BY orders.oslNo ORDER BY orders.id DESC'); return $query->result(); } public function yearly_planning_fetch_dashboard_pos_list_id12($table,$m,$y,$o,$a,$p,$s) { $query = $this->db->query('SELECT * FROM orders INNER JOIN sub_orders ON sub_orders.orderID=orders.id INNER JOIN sub_order_shades ON sub_order_shades.subOrderID=sub_orders.id INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo where Year(STR_TO_DATE(planned_order.plannedDate,"%Y-%m-%d"))="' . $y . '" AND sub_orders.orderConfirm="' . $o . '" AND sub_orders.article_type="' . $a . '" AND sub_order_shades.planningStatus="' . $p . '" OR sub_order_shades.planningStatus="' . $s . '" GROUP BY orders.oslNo ORDER BY orders.id DESC'); return $query->result(); } /////////////////////////////////////////////////// stock transfer //////////////////////////////// public function stock_transfer_count_amount_notification_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('transfer_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function stock_transfer_result_amount_notification_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('transfer_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function monthly_stock_transfer_res_dashboard_po_list_id($table,$m,$y) { $query = $this->db->query('SELECT * FROM fabric_transfer where Month(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $y . '" GROUP BY transfer_id'); return $query->num_rows(); } public function yearly_stock_transfer_res_dashboard_po_list_id($table,$y) { $query = $this->db->query('SELECT * FROM fabric_transfer where Year(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $y . '" GROUP BY transfer_id'); return $query->num_rows(); } public function monthly_stock_rec_res_dashboard_po_list_id($table,$m,$y) { $query = $this->db->query('SELECT * FROM fabric_transfer where Month(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY transfer_id'); return $query->num_rows(); } public function yearly_stock_rec_res_dashboard_po_list_id($table,$y) { $query = $this->db->query('SELECT * FROM fabric_transfer where Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY transfer_id'); return $query->num_rows(); } public function monthly_stock_transfer_result_dashboard_po_list_id($table,$m,$y) { $query = $this->db->query('SELECT * FROM fabric_transfer where Month(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $y . '" GROUP BY transfer_id'); return $query->result(); } public function yearly_stock_transfer_result_dashboard_po_list_id($table,$y) { $query = $this->db->query('SELECT * FROM fabric_transfer where Year(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $y . '" GROUP BY transfer_id'); return $query->result(); } public function monthly_stock_rec_result_dashboard_po_list_id($table,$m,$y) { $query = $this->db->query('SELECT * FROM fabric_transfer where Month(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY transfer_id'); return $query->result(); } public function yearly_stock_rec_result_dashboard_po_list_id($table,$y) { $query = $this->db->query('SELECT * FROM fabric_transfer where Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY transfer_id'); return $query->result(); } public function monthly_stock_transfer_cs_res_dashboard_po_list_id($table,$m,$y,$p) { $query = $this->db->query('SELECT * FROM cs_transfer where Month(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $y . '" AND product_type="' . $p . '" GROUP BY transfer_id'); return $query->num_rows(); } public function monthly_stock_transfer_cs_reses_dashboard_po_list_id($table,$m,$y,$p) { $query = $this->db->query('SELECT * FROM cs_transfer where Month(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $y . '" AND product_type="' . $p . '" GROUP BY transfer_id'); return $query->result(); } public function yearly_stock_transfer_cs_res_dashboard_po_list_id($table,$y,$p) { $query = $this->db->query('SELECT * FROM cs_transfer where Year(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $y . '" AND product_type="' . $p . '" GROUP BY transfer_id'); return $query->num_rows(); } public function yearly_stock_transfer_cs_reses_dashboard_po_list_id($table,$y,$p) { $query = $this->db->query('SELECT * FROM cs_transfer where Year(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $y . '" AND product_type="' . $p . '" GROUP BY transfer_id'); return $query->result(); } public function monthly_stock_rec_cs_res_dashboard_po_list_id($table,$m,$y,$p) { $query = $this->db->query('SELECT * FROM cs_transfer where Month(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" AND product_type="' . $p . '" GROUP BY transfer_id'); return $query->num_rows(); } public function yearly_stock_rec_cs_res_dashboard_po_list_id($table,$y,$p) { $query = $this->db->query('SELECT * FROM cs_transfer where Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" AND product_type="' . $p . '" GROUP BY transfer_id'); return $query->num_rows(); } public function monthly_stock_rec_stock_cs_res_dashboard_po_list_id($table,$m,$y,$p) { $query = $this->db->query('SELECT * FROM cs_transfer where Month(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" AND product_type="' . $p . '" GROUP BY transfer_id'); return $query->result(); } public function yearly_stock_rec_stock_cs_res_dashboard_po_list_id($table,$y,$p) { $query = $this->db->query('SELECT * FROM cs_transfer where Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" AND product_type="' . $p . '" GROUP BY transfer_id'); return $query->result(); } ///////////////////////////// stock transefr yarns ///////////////////////////////////////// public function monthly_stock_transfer_yarn_res_dashboard_po_list_id($table,$m,$y,$p) { $query = $this->db->query('SELECT * FROM yarn_transfer where Month(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $y . '" AND product_type="' . $p . '" GROUP BY transfer_id'); return $query->num_rows(); } public function yearly_stock_transfer_yarn_res_dashboard_po_list_id($table,$y,$p) { $query = $this->db->query('SELECT * FROM yarn_transfer where Year(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $y . '" AND product_type="' . $p . '" GROUP BY transfer_id'); return $query->num_rows(); } public function monthly_stock_rec_stock_yarn_res_dashboard_po_list_id($table,$m,$y,$p) { $query = $this->db->query('SELECT * FROM yarn_transfer where Month(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" AND product_type="' . $p . '" GROUP BY transfer_id'); return $query->num_rows(); } public function yearly_stock_rec_stock_yarn_res_dashboard_po_list_id($table,$y,$p) { $query = $this->db->query('SELECT * FROM yarn_transfer where Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" AND product_type="' . $p . '" GROUP BY transfer_id'); return $query->num_rows(); } public function monthly_stock_rec_swan_result_dashboard_po_list_id($table,$m,$y) { $query = $this->db->query('SELECT * FROM swan_yarn_transfer where Month(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $y . '" GROUP BY transfer_id'); return $query->num_rows(); } public function yearly_stock_rec_swan_result_dashboard_po_list_id($table,$y) { $query = $this->db->query('SELECT * FROM swan_yarn_transfer where Year(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $y . '" GROUP BY transfer_id'); return $query->num_rows(); } public function monthly_stock_rec_result_swan_yarn_dashboard_po_list_id($table,$m,$y) { $query = $this->db->query('SELECT * FROM swan_yarn_transfer where Month(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY transfer_id'); return $query->num_rows(); } public function yearly_stock_rec_result_swan_yarn_dashboard_po_list_id($table,$y) { $query = $this->db->query('SELECT * FROM swan_yarn_transfer where Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY transfer_id'); return $query->num_rows(); } public function monthly_stock_transfer_yarn_results_dashboard_po_list_id($table,$m,$y,$p) { $query = $this->db->query('SELECT * FROM yarn_transfer where Month(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $y . '" AND product_type="' . $p . '" GROUP BY transfer_id'); return $query->result(); } public function yearly_stock_transfer_yarn_results_dashboard_po_list_id($table,$y,$p) { $query = $this->db->query('SELECT * FROM yarn_transfer where Year(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $y . '" AND product_type="' . $p . '" GROUP BY transfer_id'); return $query->result(); } public function monthly_stock_rec_stock_yarn_results_dashboard_po_list_id($table,$m,$y,$p) { $query = $this->db->query('SELECT * FROM yarn_transfer where Month(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" AND product_type="' . $p . '" GROUP BY transfer_id'); return $query->result(); } public function yearly_stock_rec_stock_yarn_results_dashboard_po_list_id($table,$y,$p) { $query = $this->db->query('SELECT * FROM yarn_transfer where Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" AND product_type="' . $p . '" GROUP BY transfer_id'); return $query->result(); } public function swan_monthly_stock_rec_result_swan_yarn_dashboard_po_list_id($table,$m,$y) { $query = $this->db->query('SELECT * FROM swan_yarn_transfer where Month(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $y . '" GROUP BY transfer_id'); return $query->result(); } public function swan_yearly_stock_rec_result_swan_yarn_dashboard_po_list_id($table,$y) { $query = $this->db->query('SELECT * FROM swan_yarn_transfer where Year(STR_TO_DATE (transfer_date,"%d-%m-%Y"))="' . $y . '" GROUP BY transfer_id'); return $query->result(); } public function swan_monthly_stock_rec_result_swan_yarn_dashboard_po_list_id1($table,$m,$y) { $query = $this->db->query('SELECT * FROM swan_yarn_transfer where Month(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY transfer_id'); return $query->result(); } public function swan_yearly_stock_rec_result_swan_yarn_dashboard_po_list_id1($table,$y) { $query = $this->db->query('SELECT * FROM swan_yarn_transfer where Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY transfer_id'); return $query->result(); } //////////////////////////////////////////// new stores /////////////////////////////////////////////////// public function montly_dashboard_new_stores_fabric_no($table,$m,$y) { $query = $this->db->query('SELECT * FROM indent_goods_details where Month(STR_TO_DATE (received_date,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE (received_date,"%d/%m/%Y"))="' . $y . '" GROUP BY po_no'); return $query->num_rows(); } public function year_dashboard_new_stores_fabric_no($table,$y) { $query = $this->db->query('SELECT * FROM indent_goods_details where Year(STR_TO_DATE (received_date,"%d/%m/%Y"))="' . $y . '" GROUP BY po_no'); return $query->num_rows(); } public function new_stores_get_purchase_data1($d) { $this->db->select('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->from('indent_po'); $this->db->join('indent_goods_details', 'indent_goods_details.po_list_id = indent_po.id'); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.product_type','Fabrics'); $this->db->where('indent_goods_details.received_date',$d); $query=$this->db->get(); return $query->result(); } public function mponthly_new_stores_fetch_dashboard_pos_list_id12($table,$m,$y,$o,$a) { $query = $this->db->query('SELECT indent_po.* FROM indent_po INNER JOIN indent_goods_details ON indent_goods_details.po_list_id=indent_po.id where Month(STR_TO_DATE(indent_goods_details.received_date,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE(indent_goods_details.received_date,"%d/%m/%Y"))="' . $y . '" AND indent_po.product_type="' . $o . '" AND indent_po.confirm="' . $a . '" '); return $query->result(); } public function yearly_new_stores_fetch_dashboard_pos_list_id12($table,$y,$o,$a) { $query = $this->db->query('SELECT indent_po.* FROM indent_po INNER JOIN indent_goods_details ON indent_goods_details.po_list_id=indent_po.id where Year(STR_TO_DATE(indent_goods_details.received_date,"%d/%m/%Y"))="' . $y . '" AND indent_po.product_type="' . $o . '" AND indent_po.confirm="' . $a . '" '); return $query->result(); } public function new_stores_get_purchase_data_count($d) { $this->db->select('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->from('indent_po'); $this->db->join('indent_goods_details', 'indent_goods_details.po_list_id = indent_po.id'); $this->db->where('indent_po.confirm','Yes'); $this->db->where('indent_po.product_type','Fabrics'); $this->db->where('indent_goods_details.received_date',$d); $query=$this->db->get(); return $query->num_rows(); } public function mponthly_new_stores_fetch_dashboard_pos_list_id_count($table,$m,$y,$o,$a) { $query = $this->db->query('SELECT indent_po.* FROM indent_po INNER JOIN indent_goods_details ON indent_goods_details.po_list_id=indent_po.id where Month(STR_TO_DATE(indent_goods_details.received_date,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE(indent_goods_details.received_date,"%d/%m/%Y"))="' . $y . '" AND indent_po.product_type="' . $o . '" AND indent_po.confirm="' . $a . '" '); return $query->num_rows(); } public function yearly_new_stores_fetch_dashboard_pos_list_id_count($table,$y,$o,$a) { $query = $this->db->query('SELECT indent_po.* FROM indent_po INNER JOIN indent_goods_details ON indent_goods_details.po_list_id=indent_po.id where Year(STR_TO_DATE(indent_goods_details.received_date,"%d/%m/%Y"))="' . $y . '" AND indent_po.product_type="' . $o . '" AND indent_po.confirm="' . $a . '" '); return $query->num_rows(); } public function news_dashboard_po_list_id($where,$p) { $this->db->select('indent_po.*'); $this->db->group_by('indent_yarn_goods_details.po_list_id'); $this->db->from('indent_po'); $this->db->join('indent_yarn_goods_details', 'indent_yarn_goods_details.po_list_id = indent_po.id'); $this->db->where('indent_yarn_goods_details.rec_date',$where); $this->db->where('indent_po.product_type',$p); $query = $this->db->get(); return $query->num_rows(); } public function monthly_news_dashboard_po_list_id($table,$m,$y,$p) { $query = $this->db->query('SELECT indent_po.* FROM indent_yarn_goods_details INNER JOIN indent_po ON indent_yarn_goods_details.po_list_id=indent_po.id where Month(STR_TO_DATE(indent_yarn_goods_details.rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE(indent_yarn_goods_details.rec_date,"%d-%m-%Y"))="' . $y . '" AND indent_po.product_type="' . $p . '" GROUP BY po_list_id'); return $query->num_rows(); } public function year_news_dashboard_po_list_id($table,$y,$p) { $query = $this->db->query('SELECT indent_po.* FROM indent_yarn_goods_details INNER JOIN indent_po ON indent_yarn_goods_details.po_list_id=indent_po.id where Year(STR_TO_DATE(indent_yarn_goods_details.rec_date,"%d-%m-%Y"))="' . $y . '" AND indent_po.product_type="' . $p . '" GROUP BY po_list_id'); return $query->num_rows(); } public function news_dashboard_po_list_id_res($where,$p) { $this->db->select('indent_po.*'); $this->db->group_by('indent_yarn_goods_details.po_list_id'); $this->db->from('indent_po'); $this->db->join('indent_yarn_goods_details', 'indent_yarn_goods_details.po_list_id = indent_po.id'); $this->db->where('indent_yarn_goods_details.rec_date',$where); $this->db->where('indent_po.product_type',$p); $query = $this->db->get(); return $query->result(); } public function monthly_news_dashboard_po_list_id_res($table,$m,$y,$p) { $query = $this->db->query('SELECT indent_po.* FROM indent_yarn_goods_details INNER JOIN indent_po ON indent_yarn_goods_details.po_list_id=indent_po.id where Month(STR_TO_DATE(indent_yarn_goods_details.rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE(indent_yarn_goods_details.rec_date,"%d-%m-%Y"))="' . $y . '" AND indent_po.product_type="' . $p . '" GROUP BY po_list_id'); return $query->result(); } public function year_news_dashboard_po_list_id_res($table,$y,$p) { $query = $this->db->query('SELECT indent_po.* FROM indent_yarn_goods_details INNER JOIN indent_po ON indent_yarn_goods_details.po_list_id=indent_po.id where Year(STR_TO_DATE(indent_yarn_goods_details.rec_date,"%d-%m-%Y"))="' . $y . '" AND indent_po.product_type="' . $p . '" GROUP BY po_list_id'); return $query->result(); } public function news_dashboard_cs_list_id_res($where,$p) { $this->db->select('indent_po.*'); $this->db->group_by('indent_cs_goods_details.po_list_id'); $this->db->from('indent_po'); $this->db->join('indent_cs_goods_details', 'indent_cs_goods_details.po_list_id = indent_po.id'); $this->db->where('indent_cs_goods_details.rec_date',$where); $this->db->where('indent_po.product_type',$p); $query = $this->db->get(); return $query->num_rows(); } public function monthly_news_cs_dashboard_po_list_id_res($table,$m,$y,$p) { $query = $this->db->query('SELECT indent_po.* FROM indent_cs_goods_details INNER JOIN indent_po ON indent_cs_goods_details.po_list_id=indent_po.id where Month(STR_TO_DATE(indent_cs_goods_details.rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE(indent_cs_goods_details.rec_date,"%d-%m-%Y"))="' . $y . '" AND indent_po.product_type="' . $p . '" GROUP BY po_list_id'); return $query->num_rows(); } public function year_news_cs_dashboard_po_list_id_res($table,$y,$p) { $query = $this->db->query('SELECT indent_po.* FROM indent_cs_goods_details INNER JOIN indent_po ON indent_cs_goods_details.po_list_id=indent_po.id where Year(STR_TO_DATE(indent_cs_goods_details.rec_date,"%d-%m-%Y"))="' . $y . '" AND indent_po.product_type="' . $p . '" GROUP BY po_list_id'); return $query->num_rows(); } public function news_dashboard_cs_list_id_resul($where,$p) { $this->db->select('indent_po.*'); $this->db->group_by('indent_cs_goods_details.po_list_id'); $this->db->from('indent_po'); $this->db->join('indent_cs_goods_details', 'indent_cs_goods_details.po_list_id = indent_po.id'); $this->db->where('indent_cs_goods_details.rec_date',$where); $this->db->where('indent_po.product_type',$p); $query = $this->db->get(); return $query->result(); } public function monthly_news_cs_dashboard_po_list_id_resul($table,$m,$y,$p) { $query = $this->db->query('SELECT indent_po.* FROM indent_cs_goods_details INNER JOIN indent_po ON indent_cs_goods_details.po_list_id=indent_po.id where Month(STR_TO_DATE(indent_cs_goods_details.rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE(indent_cs_goods_details.rec_date,"%d-%m-%Y"))="' . $y . '" AND indent_po.product_type="' . $p . '" GROUP BY po_list_id'); return $query->result(); } public function year_news_cs_dashboard_po_list_id_resul($table,$y,$p) { $query = $this->db->query('SELECT indent_po.* FROM indent_cs_goods_details INNER JOIN indent_po ON indent_cs_goods_details.po_list_id=indent_po.id where Year(STR_TO_DATE(indent_cs_goods_details.rec_date,"%d-%m-%Y"))="' . $y . '" AND indent_po.product_type="' . $p . '" GROUP BY po_list_id'); return $query->result(); } //////////////////////////// work order ////////////////////////////////////// public function work_order_count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('work_order'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function swan_monthly_create_twiusting_result_swan_yarn_dashboard_po_list_id1($table,$m,$y) { $query = $this->db->query('SELECT * FROM create_materialissue_work_order where Month(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->num_rows(); } public function swan_yearly_create_twiusting_result_swan_yarn_dashboard_po_list_id1($table,$y) { $query = $this->db->query('SELECT * FROM create_materialissue_work_order where Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->num_rows(); } public function work_order_res_amount_work_order_delivery_yarn_po_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('work_order'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function swan_monthly_res_create_twiusting_result_swan_yarn_dashboard_po_list_id1($table,$m,$y) { $query = $this->db->query('SELECT * FROM create_materialissue_work_order where Month(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->result(); } public function swan_yearly_res_create_twiusting_result_swan_yarn_dashboard_po_list_id1($table,$y) { $query = $this->db->query('SELECT * FROM create_materialissue_work_order where Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->result(); } public function swan_monthly_create_dyeing_result_swan_yarn_dashboard_po_list_id1($table,$m,$y) { $query = $this->db->query('SELECT * FROM workorder_dyeing_material where Month(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->num_rows(); } public function swan_yearly_create_dyeing_result_swan_yarn_dashboard_po_list_id1($table,$y) { $query = $this->db->query('SELECT * FROM workorder_dyeing_material where Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->num_rows(); } public function swan_monthly_res_create_dyeing_result_swan_yarn_dashboard_po_list_id1($table,$m,$y) { $query = $this->db->query('SELECT * FROM workorder_dyeing_material where Month(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->result(); } public function swan_yearly_res_create_dyeing_result_swan_yarn_dashboard_po_list_id1($table,$y) { $query = $this->db->query('SELECT * FROM workorder_dyeing_material where Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->result(); } public function swan_monthly_create_fab_result_swan_yarn_dashboard_po_list_id1($table,$m,$y) { $query = $this->db->query('SELECT * FROM finishing_embroidry where Month(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->num_rows(); } public function swan_yearly_create_fab_result_swan_yarn_dashboard_po_list_id1($table,$y) { $query = $this->db->query('SELECT * FROM finishing_embroidry where Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->num_rows(); } public function swan_monthly_res_create_fab_result_swan_yarn_dashboard_po_list_id1($table,$m,$y) { $query = $this->db->query('SELECT * FROM finishing_embroidry where Month(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->result(); } public function swan_yearly_res_create_fab_result_swan_yarn_dashboard_po_list_id1($table,$y) { $query = $this->db->query('SELECT * FROM finishing_embroidry where Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order'); return $query->result(); } public function dyeing_work_order_count_amount_work_order_delivery_yarn_po_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('work_order_no'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function dye_swan_monthly_create_dyeing_result_swan_yarn_dashboard_po_list_id1($table,$m,$y) { $query = $this->db->query('SELECT * FROM workorder_dyeing_material where Month(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order_no'); return $query->num_rows(); } public function dye_swan_yearly_create_dyeing_result_swan_yarn_dashboard_po_list_id1($table,$y) { $query = $this->db->query('SELECT * FROM workorder_dyeing_material where Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order_no'); return $query->num_rows(); } public function work_order_dyed_res_amount_work_order_delivery_yarn_po_get_customerdata($table,$where) { $this->db->select('*'); $this->db->group_by('work_order_no'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function swan_monthly_dyed_res_create_dyeing_result_swan_yarn_dashboard_po_list_id1($table,$m,$y) { $query = $this->db->query('SELECT * FROM workorder_dyeing_material where Month(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order_no'); return $query->result(); } public function swan_yearly_dyed_res_create_dyeing_result_swan_yarn_dashboard_po_list_id1($table,$y) { $query = $this->db->query('SELECT * FROM workorder_dyeing_material where Year(STR_TO_DATE (created_at,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order_no'); return $query->result(); } ////////////////////////////////////////////////// deliver confirmation dyeing /////////////////////////////////////////////////////////////////// public function delivery_twist_swan_monthly_create_dyeing_result_swan_yarn_dashboard_po_list_id1($table,$m,$y) { $query = $this->db->query('SELECT * FROM work_order_twisting where Month(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY yarn_id'); return $query->num_rows(); } public function delivery_twist_swan_yearly_create_dyeing_result_swan_yarn_dashboard_po_list_id1($table,$y) { $query = $this->db->query('SELECT * FROM work_order_twisting where Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY yarn_id'); return $query->num_rows(); } public function delivery_twist_get_data_fetch($table,$where) { $this->db->select('create_yarntwisting_work_order.*'); $this->db->group_by('work_order_twisting.yarn_id'); $this->db->from('create_yarntwisting_work_order'); $this->db->join('work_order_twisting', 'create_yarntwisting_work_order.id = work_order_twisting.yarn_id'); $this->db->where('work_order_twisting.rec_date',$where); // $this->db->where('indent_po.product_type',$p); $query = $this->db->get(); return $query->result(); } public function dely_twist_monthly_news_cs_dashboard_po_list_id_res($table,$m,$y) { $query = $this->db->query('SELECT create_yarntwisting_work_order.* FROM create_yarntwisting_work_order INNER JOIN work_order_twisting ON work_order_twisting.yarn_id=create_yarntwisting_work_order.id where Month(STR_TO_DATE(work_order_twisting.rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE(work_order_twisting.rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order_twisting.yarn_id'); return $query->result(); } public function dely_twist_year_news_cs_dashboard_po_list_id_res($table,$y) { $query = $this->db->query('SELECT create_yarntwisting_work_order.* FROM create_yarntwisting_work_order INNER JOIN work_order_twisting ON work_order_twisting.yarn_id=create_yarntwisting_work_order.id where Year(STR_TO_DATE(work_order_twisting.rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order_twisting.yarn_id'); return $query->result(); } public function delivery_dyed_swan_monthly_create_dyeing_result_swan_yarn_dashboard_po_list_id1($table,$m,$y) { $query = $this->db->query('SELECT * FROM work_order_dyeing where Month(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY dyed_id'); return $query->num_rows(); } public function delivery_dyed_swan_yearly_create_dyeing_result_swan_yarn_dashboard_po_list_id1($table,$y) { $query = $this->db->query('SELECT * FROM work_order_dyeing where Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY dyed_id'); return $query->num_rows(); } public function delivery_dyed_get_data_fetch($table,$where) { $this->db->select('workorder_dyeing.*'); $this->db->group_by('work_order_dyeing.dyed_id'); $this->db->from('workorder_dyeing'); $this->db->join('work_order_dyeing', 'workorder_dyeing.id = work_order_dyeing.dyed_id'); $this->db->where('work_order_dyeing.rec_date',$where); // $this->db->where('indent_po.product_type',$p); $query = $this->db->get(); return $query->result(); } public function dely_dyed_monthly_news_cs_dashboard_po_list_id_res($table,$m,$y) { $query = $this->db->query('SELECT workorder_dyeing.* FROM workorder_dyeing INNER JOIN work_order_dyeing ON work_order_dyeing.dyed_id=workorder_dyeing.id where Month(STR_TO_DATE(work_order_dyeing.rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE(work_order_dyeing.rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order_dyeing.dyed_id'); return $query->result(); } public function dely_dyed_year_news_cs_dashboard_po_list_id_res($table,$y) { $query = $this->db->query('SELECT workorder_dyeing.* FROM workorder_dyeing INNER JOIN work_order_dyeing ON work_order_dyeing.dyed_id=workorder_dyeing.id where Year(STR_TO_DATE(work_order_dyeing.rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY work_order_dyeing.dyed_id'); return $query->result(); } public function delivery_weaving_swan_monthly_create_dyeing_result_swan_yarn_dashboard_po_list_id1($table,$m,$y) { $query = $this->db->query('SELECT * FROM weaving_factory_stock where Month(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY weaving_id'); return $query->num_rows(); } public function delivery_weaving_swan_yearly_create_dyeing_result_swan_yarn_dashboard_po_list_id1($table,$y) { $query = $this->db->query('SELECT weaving_panel_planning_order.* FROM weaving_panel_planning_order INNER JOIN weaving_factory_stock ON weaving_factory_stock.weaving_id=weaving_panel_planning_order.id where Year(STR_TO_DATE(weaving_factory_stock.rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY weaving_factory_stock.weaving_id'); return $query->num_rows(); } public function delivery_weaving_get_data_fetch($table,$where) { $this->db->select('weaving_panel_planning_order.*'); $this->db->group_by('weaving_factory_stock.weaving_id'); $this->db->from('weaving_panel_planning_order'); $this->db->join('weaving_factory_stock', 'weaving_panel_planning_order.id = weaving_factory_stock.weaving_id'); $this->db->where('weaving_factory_stock.rec_date',$where); // $this->db->where('indent_po.product_type',$p); $query = $this->db->get(); return $query->result(); } public function dely_weaving_monthly_news_cs_dashboard_po_list_id_res($table,$m,$y) { $query = $this->db->query('SELECT weaving_panel_planning_order.* FROM weaving_panel_planning_order INNER JOIN weaving_factory_stock ON weaving_factory_stock.weaving_id=weaving_panel_planning_order.id where Month(STR_TO_DATE(weaving_factory_stock.rec_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE(weaving_factory_stock.rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY weaving_factory_stock.weaving_id'); return $query->result(); } public function dely_weaving_year_news_cs_dashboard_po_list_id_res($table,$y) { $query = $this->db->query('SELECT weaving_panel_planning_order.* FROM weaving_panel_planning_order INNER JOIN weaving_factory_stock ON weaving_factory_stock.weaving_id=weaving_panel_planning_order.id where Year(STR_TO_DATE(weaving_factory_stock.rec_date,"%d-%m-%Y"))="' . $y . '" GROUP BY weaving_factory_stock.weaving_id'); return $query->result(); } public function delivery_fabric_swan_monthly_create_dyeing_result_swan_yarn_dashboard_po_list_id1($table,$m,$y) { $query = $this->db->query('SELECT * FROM finishing_embroidry_stock where Month(STR_TO_DATE (received_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (received_date,"%d-%m-%Y"))="' . $y . '" GROUP BY fin_emb_id'); return $query->num_rows(); } public function delivery_fabric_swan_yearly_create_dyeing_result_swan_yarn_dashboard_po_list_id1($table,$y) { $query = $this->db->query('SELECT * FROM finishing_embroidry_stock where Year(STR_TO_DATE (received_date,"%d-%m-%Y"))="' . $y . '" GROUP BY fin_emb_id'); return $query->num_rows(); } public function delivery_fabric_get_data_fetch($table,$where) { $this->db->select('finishing_embroidry.*'); $this->db->group_by('finishing_embroidry_stock.fin_emb_id'); $this->db->from('finishing_embroidry'); $this->db->join('finishing_embroidry_stock', 'finishing_embroidry.id = finishing_embroidry_stock.fin_emb_id'); $this->db->where('finishing_embroidry_stock.received_date',$where); // $this->db->where('indent_po.product_type',$p); $query = $this->db->get(); return $query->result(); } public function dely_fabric_monthly_news_cs_dashboard_po_list_id_res($table,$m,$y) { $query = $this->db->query('SELECT finishing_embroidry.* FROM finishing_embroidry INNER JOIN finishing_embroidry_stock ON weaving_factory_stock.fin_emb_id=finishing_embroidry.id where Month(STR_TO_DATE(finishing_embroidry_stock.received_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE(finishing_embroidry_stock.received_date,"%d-%m-%Y"))="' . $y . '" GROUP BY finishing_embroidry_stock.fin_emb_id'); return $query->result(); } public function dely_fabric_year_news_cs_dashboard_po_list_id_res($table,$y) { $query = $this->db->query('SELECT finishing_embroidry.* FROM finishing_embroidry INNER JOIN finishing_embroidry_stock ON finishing_embroidry_stock.fin_emb_id=finishing_embroidry.id where Year(STR_TO_DATE(finishing_embroidry_stock.received_date,"%d-%m-%Y"))="' . $y . '" GROUP BY finishing_embroidry_stock.fin_emb_id'); return $query->result(); } public function Getsearch_customername_auto($keyword) { $this->db->distinct(); $this->db->select('customerName'); $this->db->order_by('customerName','asc'); $this->db->like("customerName", $keyword); $this->db->from('customer_master'); $query= $this->db->get(); return $query->result(); } public function fabric_no_madeups_plan_madeups_no_planned_details($d) { $this->db->select('*'); $this->db->group_by('fabric_madeups.plan_id'); $this->db->from('fabric_madeups'); $this->db->join('planned_order', 'planned_order.id = fabric_madeups.plan_id'); $this->db->where('planned_order.issue_approved_date', $d); $this->db->where('planned_order.confirm', 'Yes'); $query = $this->db->get(); return $query->num_rows(); } public function monthly_madeups_res_res_dashboard_po_list_id($table,$m,$y,$f) { $query = $this->db->query('SELECT * FROM planned_order INNER JOIN fabric_madeups ON planned_order.id=fabric_madeups.plan_id where Month(STR_TO_DATE (planned_order.issue_approved_date,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE (planned_order.issue_approved_date,"%d/%m/%Y"))="' . $y . '" AND planned_order.confirm="' . $f . '" GROUP BY fabric_madeups.plan_id'); return $query->num_rows(); } public function yearly_madeups_res_res_dashboard_po_list_id($table,$y,$f) { $query = $this->db->query('SELECT * FROM planned_order INNER JOIN fabric_madeups ON planned_order.id=fabric_madeups.plan_id where Year(STR_TO_DATE (planned_order.issue_approved_date,"%d/%m/%Y"))="' . $y . '" AND planned_order.confirm="' . $f . '" GROUP BY fabric_madeups.plan_id'); return $query->num_rows(); } public function fabric_planned_madeups_no_red_res_planned_details($d,$t) { $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->group_by('fabric_madeups.plan_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('fabric_madeups', 'pm.id=fabric_madeups.plan_id'); $this->db->where('pm.issue_approved_date', $d); $this->db->where('pm.confirm', $t); $this->db->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->result(); } public function mponthly_madeups_result_red_fetch_dashboard_po_list_id($table,$m,$y,$f) { $query = $this->db->query('SELECT planned_order.id,orders.oslNo,orders.fileNo,orders.deliveryDate,sub_orders.unit,shade_master.shadeName,planned_order.pieceLength,sub_orders.subOrderType,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_orders.description,sub_order_shades.buyerShade,sub_order_shades.quantity,sub_orders.width,sub_order_shades.issue_stock,sub_order_shades.consumable_stock,planned_order.confirm,planned_order.issue_status,planned_order.add_stock_status FROM sub_order_shades INNER JOIN sub_orders ON sub_orders.id=sub_order_shades.subOrderID INNER JOIN orders ON orders.id=sub_orders.orderID INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo INNER JOIN shade_master ON shade_master.shadeID=planned_order.sslShade INNER JOIN fabric_madeups ON fabric_madeups.plan_id=planned_order.id where Month(STR_TO_DATE (planned_order.issue_approved_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (planned_order.issue_approved_date,"%d-%m-%Y"))="' . $y . '" AND planned_order.confirm="' . $f . '" GROUP BY fabric_madeups.plan_id'); return $query->result(); } public function yearly_madeups_result_red_fetch_dashboard_po_list_id($table,$y,$f) { $query = $this->db->query('SELECT planned_order.id,orders.fileNo,orders.oslNo,orders.deliveryDate,sub_orders.unit,shade_master.shadeName,planned_order.pieceLength,sub_orders.subOrderType,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_orders.description,sub_order_shades.buyerShade,sub_order_shades.quantity,sub_orders.width,sub_order_shades.issue_stock,sub_order_shades.consumable_stock,planned_order.confirm,planned_order.issue_status,planned_order.add_stock_status FROM sub_order_shades INNER JOIN sub_orders ON sub_orders.id=sub_order_shades.subOrderID INNER JOIN orders ON orders.id=sub_orders.orderID INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo INNER JOIN shade_master ON shade_master.shadeID=planned_order.sslShade INNER JOIN fabric_madeups ON fabric_madeups.plan_id=planned_order.id where Year(STR_TO_DATE (planned_order.issue_approved_date,"%d-%m-%Y"))="' . $y . '" GROUP BY AND planned_order.confirm="' . $f . '" fabric_madeups.plan_id'); return $query->result(); } public function fabric_no_con_madeups_plan_madeups_no_planned_details($d) { $this->db->select('*'); $this->db->group_by('consumable_madeups.plan_id'); $this->db->from('consumable_madeups'); $this->db->join('planned_order', 'planned_order.id = consumable_madeups.plan_id'); $this->db->where('planned_order.cons_approved_date', $d); $this->db->where('planned_order.cons_confirm', 'Yes'); $query = $this->db->get(); return $query->num_rows(); } public function monthly_con_madeups_res_res_dashboard_po_list_id($table,$m,$y,$f) { $query = $this->db->query('SELECT * FROM planned_order INNER JOIN consumable_madeups ON planned_order.id=consumable_madeups.plan_id where Month(STR_TO_DATE (planned_order.cons_approved_date,"%d/%m/%Y"))="' . $m . '" AND Year(STR_TO_DATE (planned_order.cons_approved_date,"%d/%m/%Y"))="' . $y . '" AND planned_order.cons_confirm="' . $f . '" GROUP BY consumable_madeups.plan_id'); return $query->num_rows(); } public function yearly_con_madeups_res_res_dashboard_po_list_id($table,$y,$f) { $query = $this->db->query('SELECT * FROM planned_order INNER JOIN consumable_madeups ON planned_order.id=consumable_madeups.plan_id where Year(STR_TO_DATE (planned_order.cons_approved_date,"%d/%m/%Y"))="' . $y . '" AND planned_order.cons_confirm="' . $f . '" GROUP BY consumable_madeups.plan_id'); return $query->num_rows(); } public function fabric_con_planned_madeups_no_red_res_planned_details($d,$t) { $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.confirm,pm.issue_status,pm.add_stock_status'); $this->db->group_by('consumable_madeups.plan_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('consumable_madeups', 'pm.id=consumable_madeups.plan_id'); $this->db->where('pm.cons_approved_date', $d); $this->db->where('pm.cons_confirm', $t); $this->db->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $query = $this->db->get(); return $query->result(); } public function mponthlycon__madeups_result_red_fetch_dashboard_po_list_id($table,$m,$y,$f) { $query = $this->db->query('SELECT planned_order.id,orders.fileNo,orders.oslNo,orders.deliveryDate,sub_orders.unit,shade_master.shadeName,planned_order.pieceLength,sub_orders.subOrderType,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_orders.description,sub_order_shades.buyerShade,sub_order_shades.quantity,sub_orders.width,sub_order_shades.issue_stock,sub_order_shades.consumable_stock,planned_order.confirm,planned_order.issue_status,planned_order.add_stock_status FROM sub_order_shades INNER JOIN sub_orders ON sub_orders.id=sub_order_shades.subOrderID INNER JOIN orders ON orders.id=sub_orders.orderID INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo INNER JOIN shade_master ON shade_master.shadeID=planned_order.sslShade INNER JOIN consumable_madeups ON consumable_madeups.plan_id=planned_order.id where Month(STR_TO_DATE (planned_order.cons_approved_date,"%d-%m-%Y"))="' . $m . '" AND Year(STR_TO_DATE (planned_order.cons_approved_date,"%d-%m-%Y"))="' . $y . '" AND planned_order.cons_confirm="' . $f . '" GROUP BY consumable_madeups.plan_id'); return $query->result(); } public function yearly_con_madeups_result_red_fetch_dashboard_po_list_id($table,$y,$f) { $query = $this->db->query('SELECT planned_order.id,orders.fileNo,orders.oslNo,orders.deliveryDate,sub_orders.unit,shade_master.shadeName,planned_order.pieceLength,sub_orders.subOrderType,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_orders.description,sub_order_shades.buyerShade,sub_order_shades.quantity,sub_orders.width,sub_order_shades.issue_stock,sub_order_shades.consumable_stock,planned_order.confirm,planned_order.issue_status,planned_order.add_stock_status FROM sub_order_shades INNER JOIN sub_orders ON sub_orders.id=sub_order_shades.subOrderID INNER JOIN orders ON orders.id=sub_orders.orderID INNER JOIN planned_order ON sub_order_shades.shadeID=planned_order.subNo INNER JOIN shade_master ON shade_master.shadeID=planned_order.sslShade INNER JOIN consumable_madeups ON consumable_madeups.plan_id=planned_order.id where Year(STR_TO_DATE (planned_order.cons_approved_date,"%d-%m-%Y"))="' . $y . '" GROUP BY AND planned_order.cons_confirm="' . $f . '" consumable_madeups.plan_id'); return $query->result(); } public function max_select_billing_no($table) { $this->db->select_max('billing_sl_no'); $this->db->from($table); $this->db->where('status', 1); $query = $this->db->get(); return $query->row(); } public function max_select_billing_number($table) { $this->db->select_max('billing_sl_no'); $this->db->from($table); // $this->db->where('status', 1); $query = $this->db->get(); return $query->row(); } public function update_confirm_indent_packing($data,$where) { $this->db->where($where); $this->db->update('packing_list_data',$data); } public function max_select_generate_invoice_no() { $this->db->select('invoice'); $this->db->from('packing_list_data'); $query = $this->db->get(); return $query->row(); } public function consuam_planned_stock_madeups_no_res_planned_details() { $this->db->select('*'); $this->db->from('weaving_panel_planning_order'); $this->db->join('issue_loom', 'issue_loom.weaving_panel_id = weaving_panel_planning_order.id'); $this->db->order_by('issue_loom.id','desc'); $query = $this->db->get(); return $query->result(); } public function stock_no_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,pm.add_stock_status,fabric_madeups.*'); $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', 'fabric_madeups.plan_id=pm.id'); $this->db->where('pm.confirm', 'No'); $this->db->where('so.subOrderType !=', 'FABRIC'); $this->db->where('sos.planningStatus','planned'); $this->db->order_by('fabric_madeups.id','desc'); $query = $this->db->get(); return $query->result_array(); } public function get_modal_customerdata($table,$where) { $this->db->select("*"); $this->db->group_by('po_no,shades,article,width'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function get_modal_madeups_sku_customerdata($table,$where) { $this->db->select("*"); //$this->db->group_by('osl_no,design,article,ssl_shade'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function get_modal_g_madeups_sku_customerdata($table,$where) { $this->db->select("*"); $this->db->order_by('id','asc'); // $this->db->group_by('design,article,size,ssl_shade'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function get_modal_g_madeups_sku_customerdata_new($table,$where) { $this->db->select("*"); $this->db->order_by('id','asc'); $this->db->group_by('design,article,size,ssl_shade,unit_price'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function sum_get_qty_customerdata($table,$where) { $this->db->select_sum('stock_qty'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function get_where_dataa_invoice($table,$where) { $this->db->select('box_id'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->num_rows(); } public function sum_get_receive_weaving_customerdata($table,$where) { $this->db->select_sum('issue_net_wt'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function sum_get_receive_weaving_sum_customerdata($table,$where) { $this->db->select_sum('rements'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function sum_get_receive_mtrs_weaving_sum_customerdata($table,$where) { $this->db->select_sum('f_issue_mtrs'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function sum_get_receive_wt_customerdata($table,$where) { $this->db->select_sum('received_wt'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function get_box_data_sl_fetch($table,$where) { $this->db->select('*'); $this->db->order_by('box_dimension'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function marketing_box_master_confirm_get_details($where) { $this->db->select('madeups_packing.*,madeups_box_packing.box_dimension,madeups_box_packing.gross_wt'); $this->db->group_by('madeups_packing.id'); $this->db->order_by('madeups_packing.box_id'); $this->db->from('madeups_packing'); $this->db->join('madeups_box_packing', 'madeups_box_packing.box_id = madeups_packing.box_id'); $this->db->where('madeups_box_packing.invoice',$where); $this->db->where('madeups_packing.invoice',$where); $query=$this->db->get(); return $query->result(); } public function marketing_box_master_confirm_get_details_new($where) { $this->db->select('madeups_packing_new.*,madeups_box_packing_new.box_dimension,madeups_box_packing_new.gross_wt'); $this->db->group_by('madeups_packing_new.id'); $this->db->order_by('madeups_packing_new.box_id'); $this->db->from('madeups_packing_new'); $this->db->join('madeups_box_packing_new', 'madeups_box_packing_new.box_id = madeups_packing_new.box_id'); $this->db->where('madeups_box_packing_new.invoice',$where); $this->db->where('madeups_packing_new.invoice',$where); $query=$this->db->get(); return $query->result(); } public function marketing_toatl_box_master_confirm_get_details($where) { $this->db->select('SUM(madeups_box_packing.gross_wt) AS gross_wt'); //$this->db->select('madeups_packing.*,madeups_box_packing.box_dimension,madeups_box_packing.gross_wt'); $this->db->from('madeups_packing'); $this->db->join('madeups_box_packing', 'madeups_box_packing.box_id = madeups_packing.box_id'); $this->db->where('madeups_box_packing.invoice',$where); $this->db->where('madeups_packing.invoice',$where); $query=$this->db->get(); return $query->row(); } public function marketing_toatl_box_master_confirm_get_details_new($where) { $this->db->select('SUM(madeups_box_packing_new.gross_wt) AS gross_wt'); //$this->db->select('madeups_packing.*,madeups_box_packing.box_dimension,madeups_box_packing.gross_wt'); $this->db->from('madeups_packing_new'); $this->db->join('madeups_box_packing_new', 'madeups_box_packing_new.box_id = madeups_packing_new.box_id'); $this->db->where('madeups_box_packing_new.invoice',$where); $this->db->where('madeups_packing_new.invoice',$where); $query=$this->db->get(); return $query->row(); } public function marketing_toatl_box_master_summary_confirm_get_details($where) { $this->db->select('madeups_box_packing.*,madeups_box_master.total_cmb'); //$this->db->select('madeups_packing.*,madeups_box_packing.box_dimension,madeups_box_packing.gross_wt'); $this->db->from('madeups_box_packing'); $this->db->join('madeups_box_master', 'madeups_box_master.box_dimention = madeups_box_packing.box_dimension'); $this->db->where('madeups_box_packing.invoice',$where); $this->db->where('madeups_box_packing.box_dimension !=',''); $this->db->group_by('madeups_box_packing.box_dimension'); $query=$this->db->get(); return $query->result(); } public function marketing_toatl_box_master_summary_confirm_get_details_new($where) { $this->db->select('madeups_box_packing_new.*,madeups_box_master.total_cmb'); //$this->db->select('madeups_packing.*,madeups_box_packing.box_dimension,madeups_box_packing.gross_wt'); $this->db->from('madeups_box_packing_new'); $this->db->join('madeups_box_master', 'madeups_box_master.box_dimention = madeups_box_packing_new.box_dimension'); $this->db->where('madeups_box_packing_new.invoice',$where); $this->db->where('madeups_box_packing_new.box_dimension !=',''); $this->db->group_by('madeups_box_packing_new.box_dimension'); $query=$this->db->get(); return $query->result(); } public function marketing_toatl_box_master_pkg_summary_confirm_get_details($where,$where1) { $this->db->select('box_packing.*,box_master.total_cmb'); $this->db->group_by('box_packing.box_dimension'); $this->db->from('box_packing'); $this->db->join('box_master', 'box_master.box_dimention = box_packing.box_dimension'); $this->db->where('box_packing.invoice',$where); $this->db->where('box_packing.financ_year',$where1); $this->db->where('box_packing.box_dimension !=',''); $this->db->where('box_packing.status !=',1); $query=$this->db->get(); return $query->result(); } public function marketing_toatl_box_master_pkg_summary_confirm_get_details_new($where,$where1,$pack_id) { $this->db->select('box_packing.*,box_master.total_cmb'); $this->db->from('box_packing'); $this->db->join('box_master', 'box_master.box_dimention = box_packing.box_dimension'); $this->db->where('box_packing.invoice',$where); $this->db->where('box_packing.financ_year',$where1); $this->db->where('box_packing.pack_id',$pack_id); $this->db->where('box_packing.box_dimension !=',''); $this->db->where('box_packing.status !=',1); $this->db->group_by('box_packing.box_dimension'); $query=$this->db->get(); return $query->result(); } public function list_invoice_sum_of_mktrs1($table,$where) { $this->db->select_min('id'); $this->db->group_by(['size','shades','design','article']); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function fetch_madeups_exp_groups_datas($table,$where) { $this->db->select('*'); //$this->db->group_by('article', 'size', 'ssl_shade','design'); $this->db->group_by('design,article,size,ssl_shade'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function fetch_article_details() { $this->db->select('article_master.articleID as id,article_master.articleNo,article_master.loomWidth,article_master.reed,article_master.warpTotalEnds,article_master.weftPicks,warp_data.Warp_Quality,warp_data.Warp_Specification,warp_data.Warp_Denier,weft_data.Weft_Quality,weft_data.Weft_Denier,weft_data.Weft_Specification,weft_data.PPC,weft_data.Weft_Final_Denier,warp_data.Warp_Final_Denier'); $this->db->group_by('article_master.articleNo,article_master.loomWidth,article_master.reed,article_master.warpTotalEnds,article_master.weftPicks,warp_data.Warp_Quality,warp_data.Warp_Specification,warp_data.Warp_Denier,weft_data.Weft_Quality,weft_data.Weft_Denier,weft_data.Weft_Specification'); $this->db->from('article_master'); $this->db->join('warp_data', 'warp_data.article_id= article_master.articleID'); $this->db->join('weft_data', 'weft_data.article_id= article_master.articleID'); $query=$this->db->get(); return $query->result(); } public function fetch_preview_val($val) { $this->db->select('*'); $this->db->group_by('article_master.articleNo,article_master.loomWidth,article_master.reed,article_master.warpTotalEnds,article_master.weftPicks,warp_data.Warp_Quality,warp_data.Warp_Specification,warp_data.Warp_Denier,weft_data.Weft_Quality,weft_data.Weft_Denier,weft_data.Weft_Specification'); $this->db->from('article_master'); $this->db->join('warp_data', 'warp_data.article_id= article_master.articleID'); $this->db->join('weft_data', 'weft_data.article_id= article_master.articleID'); $this->db->where('article_master.articleID',$val); $query=$this->db->get(); return $query->row(); } public function fetch_where_subgrid_data_chatting($table,$where) { $this->db->select("*"); $this->db->order_by('chat_id','asc'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->result(); } public function count_chatting($where) { $this->db->select('employee_details.name,chat_message.to_id, COUNT(chat_message.chat_id) as total'); $this->db->group_by('chat_message.from_id'); $this->db->from('chat_message'); $this->db->join('employee_details', 'chat_message.from_id= employee_details.id'); $this->db->where('chat_message.unread',0); $this->db->where('to_id',$where); $this->db->where('chat_message.sender_one',0); $this->db->where('chat_message.sender_two',0); $query = $this->db->get(); return $query->result(); } ///////////////// user chats ////////////// public function user_chats_details($where) { $this->db->select('employee_details.name,employee_details.id'); $this->db->group_by('employee_details.name'); $this->db->from('chat_message'); $this->db->join('employee_details', 'employee_details.id= chat_message.to_id'); $this->db->where('chat_message.sender_one !=',$where); $this->db->where('chat_message.sender_two !=',$where); $this->db->where('employee_details.id !=',$where); $query = $this->db->get(); return $query->result(); } public function fetch_where_subgrid_chat_data_chatting($from,$to) { $this->db->select('employee_details.name as to_name,chat_message.*'); $this->db->group_by('employee_details.name'); $this->db->from('chat_message'); $this->db->join('employee_details', 'employee_details.id= chat_message.to_id'); $this->db->where('chat_message.from_id',$from); $this->db->where('chat_message.to_id',$to); $query = $this->db->get(); return $query->result(); } public function fetch_where_subgrid_chat_data_chattings($from,$to) { $this->db->select('employee_details.name as to_name,chat_message.*'); $this->db->group_by('employee_details.name'); $this->db->from('chat_message'); $this->db->join('employee_details', 'employee_details.id= chat_message.to_id'); $this->db->where('chat_message.to_id',$from); $this->db->where('chat_message.from_id',$to); $query = $this->db->get(); return $query->result(); } public function fetch_where_subgrid_chat_data_chatting1($from,$to) { $this->db->select('employee_details.name as from_name,chat_message.*'); $this->db->group_by('employee_details.name'); $this->db->from('chat_message'); $this->db->join('employee_details', 'employee_details.id= chat_message.from_id'); $this->db->where('chat_message.from_id',$from); $this->db->where('chat_message.to_id',$to); $query = $this->db->get(); return $query->result(); } public function fetch_where_subgrid_chat_data_chattings1($from,$to) { $this->db->select('employee_details.name as from_name,chat_message.*'); $this->db->group_by('employee_details.name'); $this->db->from('chat_message'); $this->db->join('employee_details', 'employee_details.id= chat_message.from_id'); $this->db->where('chat_message.to_id',$from); $this->db->where('chat_message.from_id',$to); $query = $this->db->get(); return $query->result(); } public function user_chatting_details($where) { $this->db->select('chat_message.chat_id as id,chat_message.to_name as from_name'); $this->db->group_by('chat_message.to_id'); $this->db->from('chat_message'); $this->db->join('employee_details', 'employee_details.id= chat_message.from_id'); $this->db->where('chat_message.sender_one !=',$where); $this->db->where('chat_message.sender_two !=',$where); $this->db->where('chat_message.from_id',$where); $query = $this->db->get(); return $query->result(); } public function user_chatting_details1($where) { $this->db->select('chat_message.chat_id as id,chat_message.from_name'); $this->db->group_by('chat_message.from_id'); $this->db->from('chat_message'); $this->db->join('employee_details', 'employee_details.id= chat_message.to_id'); $this->db->where('chat_message.sender_one !=',$where); $this->db->where('chat_message.sender_two !=',$where); $this->db->where('chat_message.to_id',$where); $query = $this->db->get(); return $query->result(); } ////////////////////////// 6-11-2018 ////////////////////////////// public function fetch_weaving_receipt_details() { $this->db->select('weaving_panel_planning_order.*,weaving_factory_stock.*,weaving_panel_planning_order.piece_length as p_l,orders.fileNo'); $this->db->from('weaving_panel_planning_order'); $this->db->join('weaving_factory_stock', 'weaving_factory_stock.weaving_id= weaving_panel_planning_order.id'); $this->db->join('orders', 'orders.id= weaving_panel_planning_order.order_id'); $query = $this->db->get(); return $query->result(); } public function fetch_madeups_receipt_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.confirm,pm.issue_status,pm.add_stock_status,fm.*'); $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_delivery_confirmation fm', 'fm.ref_id = pm.id'); //$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(); } public function date_wise_madeups_reports($f,$t) { $select = "select planned_order.id,orders.fileNo,orders.oslNo,orders.deliveryDate,sub_orders.unit,shade_master.shadeName,planned_order.pieceLength,sub_orders.subOrderType,sub_orders.articleNo,sub_orders.quality,sub_orders.design,sub_orders.description,sub_order_shades.buyerShade,sub_order_shades.quantity,sub_orders.width,sub_order_shades.issue_stock,sub_order_shades.consumable_stock,planned_order.confirm,planned_order.issue_status,planned_order.add_stock_status,fabric_madeups_delivery_confirmation.*"; $from = " from sub_order_shades,sub_orders,orders,planned_order,shade_master,fabric_madeups_delivery_confirmation"; $where = " where "; $where .= " sub_order_shades.subOrderID = sub_orders.id"; $where .= " and sub_orders.orderID = orders.id"; $where .= " and planned_order.subNo = sub_order_shades.shadeID"; $where .= " and shade_master.shadeID = planned_order.sslShade"; $where .= " and fabric_madeups_delivery_confirmation.ref_id = planned_order.id"; $where .= " and sub_orders.subOrderType != 'FABRIC'"; $where .= " and sub_order_shades.planningStatus = 'planned'"; $where .= " and STR_TO_DATE(fabric_madeups_delivery_confirmation.rec_date,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(fabric_madeups_delivery_confirmation.rec_date,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function fetch_weaving_receipt_report_details($f,$t) { $select = "select weaving_panel_planning_order.*,weaving_factory_stock.*,weaving_panel_planning_order.piece_length as p_l,orders.fileNo"; $from = " from weaving_panel_planning_order,weaving_factory_stock,orders"; $where = " where "; $where .= " weaving_factory_stock.weaving_id= weaving_panel_planning_order.id"; $where .= " and orders.id= weaving_panel_planning_order.order_id"; $where .= " and STR_TO_DATE(weaving_factory_stock.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(weaving_factory_stock.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_po_num_types($table,$where,$keyword) { $this->db->distinct(); $this->db->select('*'); $this->db->like("po_no", $keyword); $this->db->from($table); $this->db->where($where); $query= $this->db->get(); return $query->result(); } public function get_data_article_asc_customer($table) { $this->db->select("*"); $this->db->from($table); $this->db->order_by('article','asc'); $query = $this->db->get(); return $query->result(); } public function get_data_date_dsc_customer($table) { $this->db->select("*"); $this->db->from($table); $this->db->order_by('date','desc'); $query = $this->db->get(); return $query->result(); } //////////////////////// 14-11-2018 /////////////////////////// public function date_wise_sample_reports($from_date,$to_date) { $f=date('Y-m-d',strtotime($from_date)); $t=date('Y-m-d',strtotime($to_date)); $select = "select sample_request.*"; $from = " from sample_request"; $where = " where "; $where .= " STR_TO_DATE(sample_request.date,'%Y-%m-%d')>=STR_TO_DATE('$f','%Y-%m-%d')"; $where .=" and STR_TO_DATE(sample_request.date,'%Y-%m-%d')<=STR_TO_DATE('$t','%Y-%m-%d')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } //////////////////////// 14-11-2018 /////////////////////////// public function get_data_inhouse_planning_data() { $this->db->select('o.fileNo,o.orderDate, po.sslShade,po.oslNo,po.weaving_factory,po.selWidth,po.warpPlandMtr,po.weftPlandMtr,so.articleNo,so.design,so.width,so.subOrderType, sos.buyerShade,sos.quantity,sos.planningStatus,am.quality,am.loomWidth,am.finishWidth,am.articleID,sm.shadeName,sos.shadeID as id,o.deliveryDate as d_date'); $this->db->from('planned_order po'); // $this->db->where('po.subNo', $subNumber); $this->db->join('sub_order_shades sos', 'sos.shadeID = po.subNo'); $this->db->join('shade_master sm', 'po.sslShade = sm.shadeID'); $this->db->join('sub_orders so', 'so.id = sos.subOrderID'); $this->db->join('article_master am', 'so.articleNo = am.articleNo'); $this->db->join('product_master pm', 'pm.fabricType = so.subOrderType','left'); $this->db->join('orders o', 'so.orderID = o.id'); $this->db->where('so.article_type','inhouse'); $this->db->order_by('o.orderDate','desc'); $query = $this->db->get(); return $query->result(); } public function get_data_outsource_planning_data() { $this->db->select('planned_order.oslNo,planned_order.m_width,planned_order.weaving_factory,planned_order.PlndMtr, sub_orders.subOrderType,sub_orders.design,sub_orders.articleNo,sub_orders.quality,sub_orders.width, sub_order_shades.buyerShade,sub_order_shades.ourShade,sub_order_shades.quantity,sub_order_shades.planningStatus ,orders.fileNo,orders.orderDate,orders.deliveryDate ,shade_master.shadeName'); $this->db->from('sub_orders'); $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', 'planned_order.sslShade = shade_master.shadeID'); $this->db->join('indent_product', 'sub_orders.articleNo = indent_product.product'); $this->db->join('product_master pm', 'pm.fabricType = sub_orders.subOrderType','left'); $this->db->join('orders', 'sub_orders.orderID = orders.id'); $this->db->where('sub_orders.article_type','outsource'); $this->db->order_by('orders.orderDate','desc'); $query = $this->db->get(); return $query->result(); } public function date_wise_inhouse_reports($f,$t) { $this->db->select('o.fileNo,o.orderDate, po.sslShade,po.oslNo,po.weaving_factory,po.selWidth,po.warpPlandMtr,po.weftPlandMtr,so.articleNo,so.design,so.width,so.subOrderType, sos.buyerShade,sos.quantity,sos.planningStatus,am.quality,am.loomWidth,am.finishWidth,am.articleID,sm.shadeName,sos.shadeID as id,o.deliveryDate as d_date'); $this->db->from('planned_order po'); // $this->db->where('po.subNo', $subNumber); $this->db->join('sub_order_shades sos', 'sos.shadeID = po.subNo'); $this->db->join('shade_master sm', 'po.sslShade = sm.shadeID'); $this->db->join('sub_orders so', 'so.id = sos.subOrderID'); $this->db->join('article_master am', 'so.articleNo = am.articleNo'); $this->db->join('product_master pm', 'pm.fabricType = so.subOrderType','left'); $this->db->join('orders o', 'so.orderID = o.id'); $this->db->where('so.article_type','inhouse'); $this->db->where('o.orderDate >=',$f); $this->db->where('o.orderDate <=',$t); $this->db->order_by('o.orderDate','desc'); $query = $this->db->get(); return $query->result(); } public function date_wise_outsource_reports($f,$t) { $this->db->select('planned_order.oslNo,planned_order.m_width,planned_order.weaving_factory,planned_order.PlndMtr, sub_orders.subOrderType,sub_orders.design,sub_orders.articleNo,sub_orders.quality,sub_orders.width, sub_order_shades.buyerShade,sub_order_shades.ourShade,sub_order_shades.quantity,sub_order_shades.planningStatus ,orders.fileNo,orders.orderDate,orders.deliveryDate ,shade_master.shadeName'); $this->db->from('sub_orders'); $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', 'planned_order.sslShade = shade_master.shadeID'); $this->db->join('indent_product', 'sub_orders.articleNo = indent_product.product'); $this->db->join('product_master pm', 'pm.fabricType = sub_orders.subOrderType','left'); $this->db->join('orders', 'sub_orders.orderID = orders.id'); $this->db->where('sub_orders.article_type','outsource'); $this->db->where('orders.orderDate >=',$f); $this->db->where('orders.orderDate <=',$t); $this->db->order_by('orders.orderDate','desc'); $query = $this->db->get(); return $query->result(); } ///////////////////////// public function fabric_inspection_split_count_amount_get_customerdata($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->num_rows(); } public function fabric_inspection_split_count_res_amount_get_customerdata($table,$where,$where1) { $this->db->select('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.rec_by,fabric_inspection_details.piece_no '); $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.received_date',$where); $this->db->or_where('fabric_inspection_details.received_date',$where1); $this->db->where('fabric_inspection_details.split_noti','Yes'); $query = $this->db->get(); return $query->result(); } public function madeups__inspection_split_count_amount_get_customerdata($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); //$this->db->or_where($where1); $this->db->where('split_noti','Yes'); $query = $this->db->get(); return $query->num_rows(); } public function fabric_inspection_splits_count_res_amount_get_customerdata($table,$where) { $this->db->select('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.rec_by,fabric_inspection_details.piece_no '); $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.received_date',$where); $this->db->where('fabric_inspection_details.split_noti','Yes'); $query = $this->db->get(); return $query->result(); } ///////////////////////////////// 21-11-2018 ///////////////////////////////////////// public function get_from_to_indent_not($f,$t) { $select = "select indent_add_indent.*"; $from = " from indent_add_indent"; $where = " where "; $where .= " STR_TO_DATE(indent_add_indent.indented_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_add_indent.indented_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_not_count($f,$t) { $select = "select indent_add_indent.*"; $from = " from indent_add_indent"; $where = " where "; $where .= " STR_TO_DATE(indent_add_indent.indented_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_add_indent.indented_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); $result = $this->db->query($sql); return $result->num_rows(); } public function get_from_to_indent_unot($f,$t) { $select = "select indent_add_indent.*"; $from = " from indent_add_indent"; $where = " where "; $where .= " STR_TO_DATE(indent_add_indent.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_add_indent.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_unot_count($f,$t) { $select = "select indent_add_indent.*"; $from = " from indent_add_indent"; $where = " where "; $where .= " STR_TO_DATE(indent_add_indent.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_add_indent.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); $result = $this->db->query($sql); return $result->num_rows(); } public function get_from_to_indent_anot($f,$t) { $select = "select indent_add_indent.*"; $from = " from indent_add_indent"; $where = " where "; $where .= " STR_TO_DATE(indent_add_indent.approved_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_add_indent.approved_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_anot_count($f,$t) { $select = "select indent_add_indent.*"; $from = " from indent_add_indent"; $where = " where "; $where .= " STR_TO_DATE(indent_add_indent.approved_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_add_indent.approved_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_from_to_indent_pcnot($f,$t) { $select = "select indent_po.*"; $from = " from indent_po"; $where = " where "; $where .= " STR_TO_DATE(indent_po.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_po.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_pcnot_count($f,$t) { $select = "select indent_po.*"; $from = " from indent_po"; $where = " where "; $where .= " STR_TO_DATE(indent_po.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_po.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_from_to_indent_punot($f,$t) { $select = "select indent_po.*"; $from = " from indent_po"; $where = " where "; $where .= " STR_TO_DATE(indent_po.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_po.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_punot_count($f,$t) { $select = "select indent_po.*"; $from = " from indent_po"; $where = " where "; $where .= " STR_TO_DATE(indent_po.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_po.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_from_to_indent_panot($f,$t) { $select = "select indent_po.*"; $from = " from indent_po"; $where = " where "; $where .= " STR_TO_DATE(indent_po.approved_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_po.approved_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_panot_count($f,$t) { $select = "select indent_po.*"; $from = " from indent_po"; $where = " where "; $where .= " STR_TO_DATE(indent_po.approved_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_po.approved_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_from_to_indent_transfer_not($f,$t) { $select = "select fabric_transfer.*"; $from = " from fabric_transfer"; $where = " where "; $where .= " STR_TO_DATE(fabric_transfer.transfer_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(fabric_transfer.transfer_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY fabric_transfer.transfer_id_val,fabric_transfer.product_type,fabric_transfer.product_location,fabric_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_transfer_cnot($f,$t) { $select = "select SUM(fabric_transfer.issue_weight) as issue_weight"; $from = " from fabric_transfer"; $where = " where "; $where .= " STR_TO_DATE(fabric_transfer.transfer_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(fabric_transfer.transfer_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY fabric_transfer.transfer_id_val,fabric_transfer.product_type,fabric_transfer.product_location,fabric_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_transfer_snot($f,$t) { $select = "select SUM(fabric_transfer.issue_mtrs) as issue_mtrs"; $from = " from fabric_transfer"; $where = " where "; $where .= " STR_TO_DATE(fabric_transfer.transfer_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(fabric_transfer.transfer_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY fabric_transfer.transfer_id_val,fabric_transfer.product_type,fabric_transfer.product_location,fabric_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_transfer_cunot($f,$t) { $select = "select fabric_transfer.*"; $from = " from fabric_transfer"; $where = " where "; $where .= " STR_TO_DATE(fabric_transfer.transfer_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(fabric_transfer.transfer_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY fabric_transfer.transfer_id_val,fabric_transfer.product_type,fabric_transfer.product_location,fabric_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_from_to_indent_yarn_transfer_not($f,$t) { $select = "select yarn_transfer.*"; $from = " from yarn_transfer"; $where = " where "; $where .= " STR_TO_DATE(yarn_transfer.transfer_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(yarn_transfer.transfer_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY yarn_transfer.transfer_id_val,yarn_transfer.product_type,yarn_transfer.product_location,yarn_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_yarn_transfer_nots($f,$t) { $select = "select SUM(yarn_transfer.issue_net_weight) as issue_net_weight"; $from = " from yarn_transfer"; $where = " where "; $where .= " STR_TO_DATE(yarn_transfer.transfer_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(yarn_transfer.transfer_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY yarn_transfer.transfer_id_val,yarn_transfer.product_type,yarn_transfer.product_location,yarn_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_transfer_cyunot($f,$t) { $select = "select yarn_transfer.*"; $from = " from yarn_transfer"; $where = " where "; $where .= " STR_TO_DATE(yarn_transfer.transfer_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(yarn_transfer.transfer_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY yarn_transfer.transfer_id_val,yarn_transfer.product_type,yarn_transfer.product_location,yarn_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_from_to_indent_cs_transfer_not($f,$t) { $select = "select cs_transfer.*"; $from = " from cs_transfer"; $where = " where "; $where .= " STR_TO_DATE(cs_transfer.transfer_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(cs_transfer.transfer_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY cs_transfer.transfer_id_val,cs_transfer.product_type,cs_transfer.product_location,cs_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_cs_transfer_notts($f,$t) { $select = "select SUM(cs_transfer.issue_qua) as issue_qua"; $from = " from cs_transfer"; $where = " where "; $where .= " STR_TO_DATE(cs_transfer.transfer_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(cs_transfer.transfer_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY cs_transfer.transfer_id_val,cs_transfer.product_type,cs_transfer.product_location,cs_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_transfer_csunot($f,$t) { $select = "select cs_transfer.*"; $from = " from cs_transfer"; $where = " where "; $where .= " STR_TO_DATE(cs_transfer.transfer_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(cs_transfer.transfer_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY cs_transfer.transfer_id_val,cs_transfer.product_type,cs_transfer.product_location,cs_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_from_to_swan_yarn_transfer_not($f,$t) { $select = "select swan_yarn_transfer.*"; $from = " from swan_yarn_transfer"; $where = " where "; $where .= " STR_TO_DATE(swan_yarn_transfer.transfer_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(swan_yarn_transfer.transfer_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY swan_yarn_transfer.transfer_id_val,swan_yarn_transfer.product_type,swan_yarn_transfer.product_location,swan_yarn_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_swan_yarn_transfer_cnot($f,$t) { $select = "select SUM(swan_yarn_transfer.issue_dyed_weight) as issue_dyed_weight"; $from = " from swan_yarn_transfer"; $where = " where "; $where .= " STR_TO_DATE(swan_yarn_transfer.transfer_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(swan_yarn_transfer.transfer_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY swan_yarn_transfer.transfer_id_val,swan_yarn_transfer.product_type,swan_yarn_transfer.product_location,swan_yarn_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_transfer_swan_unot($f,$t) { $select = "select swan_yarn_transfer.*"; $from = " from swan_yarn_transfer"; $where = " where "; $where .= " STR_TO_DATE(swan_yarn_transfer.transfer_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(swan_yarn_transfer.transfer_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY swan_yarn_transfer.transfer_id_val,swan_yarn_transfer.product_type,swan_yarn_transfer.product_location,swan_yarn_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_from_to_split_stock_unot($f,$t) { $select = "select fabric_madeups_delivery_confirmation.*"; $from = " from fabric_madeups_delivery_confirmation"; $where = " where "; $where .= " STR_TO_DATE(fabric_madeups_delivery_confirmation.rec_date,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(fabric_madeups_delivery_confirmation.rec_date,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; $where .=" and fabric_madeups_delivery_confirmation.split_noti = 'Yes'"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_from_to_split_stock_unot_res($f,$t) { $select = "select fabric_madeups_delivery_confirmation.*"; $from = " from fabric_madeups_delivery_confirmation"; $where = " where "; $where .= " STR_TO_DATE(fabric_madeups_delivery_confirmation.rec_date,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(fabric_madeups_delivery_confirmation.rec_date,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; $where .=" and fabric_madeups_delivery_confirmation.split_noti = 'Yes'"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_splits_stock_unot($f,$t) { $select = "select fabric_inspection_details.*"; $from = " from fabric_inspection_details"; $where = " where "; $where .= " STR_TO_DATE(fabric_inspection_details.received_date,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(fabric_inspection_details.received_date,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; $where .=" and fabric_inspection_details.split_noti = 'Yes'"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_from_to_splits_stock_unot_res($f,$t) { $select = "select fabric_inspection_details.*"; $from = " from fabric_inspection_details"; $where = " where "; $where .= " STR_TO_DATE(fabric_inspection_details.received_date,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(fabric_inspection_details.received_date,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; $where .=" and fabric_inspection_details.split_noti = 'Yes'"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_transfer_recnot($f,$t) { $select = "select fabric_transfer.*"; $from = " from fabric_transfer"; $where = " where "; $where .= " STR_TO_DATE(fabric_transfer.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(fabric_transfer.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY fabric_transfer.transfer_id_val,fabric_transfer.product_type,fabric_transfer.product_location,fabric_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_transfer_reccnot($f,$t) { $select = "select SUM(fabric_transfer.issue_weight) as issue_weight"; $from = " from fabric_transfer"; $where = " where "; $where .= " STR_TO_DATE(fabric_transfer.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(fabric_transfer.rec_mtrs,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY fabric_transfer.transfer_id_val,fabric_transfer.product_type,fabric_transfer.product_location,fabric_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_transfer_recsnot($f,$t) { $select = "select SUM(fabric_transfer.rec_mtrs) as rec_mtrs"; $from = " from fabric_transfer"; $where = " where "; $where .= " STR_TO_DATE(fabric_transfer.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(fabric_transfer.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY fabric_transfer.transfer_id_val,fabric_transfer.product_type,fabric_transfer.product_location,fabric_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_transfer_reccunot($f,$t) { $select = "select fabric_transfer.*"; $from = " from fabric_transfer"; $where = " where "; $where .= " STR_TO_DATE(fabric_transfer.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(fabric_transfer.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY fabric_transfer.transfer_id_val,fabric_transfer.product_type,fabric_transfer.product_location,fabric_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_from_to_indent_yarn_transfer_recnot($f,$t) { $select = "select yarn_transfer.*"; $from = " from yarn_transfer"; $where = " where "; $where .= " STR_TO_DATE(yarn_transfer.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(yarn_transfer.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY yarn_transfer.transfer_id_val,yarn_transfer.product_type,yarn_transfer.product_location,yarn_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_yarn_transfer_recnots($f,$t) { $select = "select SUM(yarn_transfer.rec_net_wt) as rec_net_wt"; $from = " from yarn_transfer"; $where = " where "; $where .= " STR_TO_DATE(yarn_transfer.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(yarn_transfer.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY yarn_transfer.transfer_id_val,yarn_transfer.product_type,yarn_transfer.product_location,yarn_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_transfer_reccyunot($f,$t) { $select = "select yarn_transfer.*"; $from = " from yarn_transfer"; $where = " where "; $where .= " STR_TO_DATE(yarn_transfer.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(yarn_transfer.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY yarn_transfer.transfer_id_val,yarn_transfer.product_type,yarn_transfer.product_location,yarn_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_from_to_indent_cs_transfer_recnot($f,$t) { $select = "select cs_transfer.*"; $from = " from cs_transfer"; $where = " where "; $where .= " STR_TO_DATE(cs_transfer.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(cs_transfer.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY cs_transfer.transfer_id_val,cs_transfer.product_type,cs_transfer.product_location,cs_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_cs_transfer_recnotts($f,$t) { $select = "select SUM(cs_transfer.rec_qua) as rec_qua"; $from = " from cs_transfer"; $where = " where "; $where .= " STR_TO_DATE(cs_transfer.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(cs_transfer.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY cs_transfer.transfer_id_val,cs_transfer.product_type,cs_transfer.product_location,cs_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_transfer_reccsunot($f,$t) { $select = "select cs_transfer.*"; $from = " from cs_transfer"; $where = " where "; $where .= " STR_TO_DATE(cs_transfer.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(cs_transfer.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY cs_transfer.transfer_id_val,cs_transfer.product_type,cs_transfer.product_location,cs_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_from_to_swan_yarn_transfer_recnot($f,$t) { $select = "select swan_yarn_transfer.*"; $from = " from swan_yarn_transfer"; $where = " where "; $where .= " STR_TO_DATE(swan_yarn_transfer.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(swan_yarn_transfer.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY swan_yarn_transfer.transfer_id_val,swan_yarn_transfer.product_type,swan_yarn_transfer.product_location,swan_yarn_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_swan_yarn_transfer_reccnot($f,$t) { $select = "select SUM(swan_yarn_transfer.rec_dyed_wt) as rec_dyed_wt"; $from = " from swan_yarn_transfer"; $where = " where "; $where .= " STR_TO_DATE(swan_yarn_transfer.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(swan_yarn_transfer.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY swan_yarn_transfer.transfer_id_val,swan_yarn_transfer.product_type,swan_yarn_transfer.product_location,swan_yarn_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_from_to_indent_transfer_swan_recunot($f,$t) { $select = "select swan_yarn_transfer.*"; $from = " from swan_yarn_transfer"; $where = " where "; $where .= " STR_TO_DATE(swan_yarn_transfer.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(swan_yarn_transfer.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY swan_yarn_transfer.transfer_id_val,swan_yarn_transfer.product_type,swan_yarn_transfer.product_location,swan_yarn_transfer.transfer_location"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_not($f,$t) { $select = "select import_yarn.*"; $from = " from import_yarn"; $where = " where "; $where .= " STR_TO_DATE(import_yarn.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(import_yarn.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_cnot($f,$t) { $select = "select import_yarn.*"; $from = " from import_yarn"; $where = " where "; $where .= " STR_TO_DATE(import_yarn.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(import_yarn.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_unot($f,$t) { $select = "select import_yarn.*"; $from = " from import_yarn"; $where = " where "; $where .= " STR_TO_DATE(import_yarn.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(import_yarn.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_ucnot($f,$t) { $select = "select import_yarn.*"; $from = " from import_yarn"; $where = " where "; $where .= " STR_TO_DATE(import_yarn.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(import_yarn.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_aunot($f,$t) { $select = "select article_master.*"; $from = " from article_master"; $where = " where "; $where .= " STR_TO_DATE(article_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(article_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_aucnot($f,$t) { $select = "select article_master.*"; $from = " from article_master"; $where = " where "; $where .= " STR_TO_DATE(article_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(article_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_acunot($f,$t) { $select = "select article_master.*"; $from = " from article_master"; $where = " where "; $where .= " STR_TO_DATE(article_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(article_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_acucnot($f,$t) { $select = "select article_master.*"; $from = " from article_master"; $where = " where "; $where .= " STR_TO_DATE(article_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(article_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_fnot($f,$t) { $select = "select fabric_master.*"; $from = " from fabric_master"; $where = " where "; $where .= " STR_TO_DATE(fabric_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(fabric_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_fcnot($f,$t) { $select = "select fabric_master.*"; $from = " from fabric_master"; $where = " where "; $where .= " STR_TO_DATE(fabric_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(fabric_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_funot($f,$t) { $select = "select fabric_master.*"; $from = " from fabric_master"; $where = " where "; $where .= " STR_TO_DATE(fabric_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(fabric_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_fucnot($f,$t) { $select = "select fabric_master.*"; $from = " from fabric_master"; $where = " where "; $where .= " STR_TO_DATE(fabric_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(fabric_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_snot($f,$t) { $select = "select shade_master.*,article_master.articleNo"; $from = " from shade_master,article_master"; $where = " where "; $where .= "article_master.articleID= shade_master.articleID"; $where .= " and STR_TO_DATE(shade_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(shade_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_scnot($f,$t) { $select = "select shade_master.*"; $from = " from shade_master"; $where = " where "; $where .= " STR_TO_DATE(shade_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(shade_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_sunot($f,$t) { $select = "select shade_master.*,article_master.articleNo"; $from = " from shade_master,article_master"; $where = " where "; $where .= "article_master.articleID= shade_master.articleID"; $where .= " and STR_TO_DATE(shade_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(shade_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_sucnot($f,$t) { $select = "select shade_master.*"; $from = " from shade_master"; $where = " where "; $where .= " STR_TO_DATE(shade_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(shade_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_colnot($f,$t) { $select = "select color_master.*"; $from = " from color_master"; $where = " where "; $where .= " STR_TO_DATE(color_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(color_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_colcnot($f,$t) { $select = "select color_master.*"; $from = " from color_master"; $where = " where "; $where .= " STR_TO_DATE(color_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(color_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_colunot($f,$t) { $select = "select color_master.*"; $from = " from color_master"; $where = " where "; $where .= " STR_TO_DATE(color_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(color_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_colucnot($f,$t) { $select = "select color_master.*"; $from = " from color_master"; $where = " where "; $where .= " STR_TO_DATE(color_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(color_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_desunot($f,$t) { $select = "select design_master.*"; $from = " from design_master"; $where = " where "; $where .= " STR_TO_DATE(design_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(design_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_desucnot($f,$t) { $select = "select design_master.*"; $from = " from design_master"; $where = " where "; $where .= " STR_TO_DATE(design_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(design_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_descunot($f,$t) { $select = "select design_master.*"; $from = " from design_master"; $where = " where "; $where .= " STR_TO_DATE(design_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(design_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_descucnot($f,$t) { $select = "select design_master.*"; $from = " from design_master"; $where = " where "; $where .= " STR_TO_DATE(design_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(design_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_cusunot($f,$t) { $select = "select customer_master.*"; $from = " from customer_master"; $where = " where "; $where .= " STR_TO_DATE(customer_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(customer_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_cusucnot($f,$t) { $select = "select customer_master.*"; $from = " from customer_master"; $where = " where "; $where .= " STR_TO_DATE(customer_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(customer_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_boxunot($f,$t) { $select = "select box_master.*"; $from = " from box_master"; $where = " where "; $where .= " STR_TO_DATE(box_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(box_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_boxucnot($f,$t) { $select = "select box_master.*"; $from = " from box_master"; $where = " where "; $where .= " STR_TO_DATE(box_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(box_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_mboxunot($f,$t) { $select = "select madeups_box_master.*"; $from = " from madeups_box_master"; $where = " where "; $where .= " STR_TO_DATE(madeups_box_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(madeups_box_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_mboxucnot($f,$t) { $select = "select madeups_box_master.*"; $from = " from madeups_box_master"; $where = " where "; $where .= " STR_TO_DATE(madeups_box_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(madeups_box_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_prounot($f,$t) { $select = "select product_master.*"; $from = " from product_master"; $where = " where "; $where .= " STR_TO_DATE(product_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(product_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_proucnot($f,$t) { $select = "select product_master.*"; $from = " from product_master"; $where = " where "; $where .= " STR_TO_DATE(product_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(product_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_invenunot($f,$t) { $select = "select indent_vendor_master.*"; $from = " from indent_vendor_master"; $where = " where "; $where .= " STR_TO_DATE(indent_vendor_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_vendor_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_invencnot($f,$t) { $select = "select indent_vendor_master.*"; $from = " from indent_vendor_master"; $where = " where "; $where .= " STR_TO_DATE(indent_vendor_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_vendor_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_inprounot($f,$t) { $select = "select indent_product.*"; $from = " from indent_product"; $where = " where "; $where .= " STR_TO_DATE(indent_product.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_product.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_inprocnot($f,$t) { $select = "select indent_product.*"; $from = " from indent_product"; $where = " where "; $where .= " STR_TO_DATE(indent_product.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_product.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_cuspunot($f,$t) { $select = "select customer_master.*"; $from = " from customer_master"; $where = " where "; $where .= " STR_TO_DATE(customer_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(customer_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_cusupcnot($f,$t) { $select = "select customer_master.*"; $from = " from customer_master"; $where = " where "; $where .= " STR_TO_DATE(customer_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(customer_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_boxpunot($f,$t) { $select = "select box_master.*"; $from = " from box_master"; $where = " where "; $where .= " STR_TO_DATE(box_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(box_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_boxpucnot($f,$t) { $select = "select box_master.*"; $from = " from box_master"; $where = " where "; $where .= " STR_TO_DATE(box_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(box_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_mboxpunot($f,$t) { $select = "select madeups_box_master.*"; $from = " from madeups_box_master"; $where = " where "; $where .= " STR_TO_DATE(madeups_box_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(madeups_box_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_mboxpucnot($f,$t) { $select = "select madeups_box_master.*"; $from = " from madeups_box_master"; $where = " where "; $where .= " STR_TO_DATE(madeups_box_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(madeups_box_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_ovnot($f,$t) { $select = "select outsource_vendor_master.*"; $from = " from outsource_vendor_master"; $where = " where "; $where .= " STR_TO_DATE(outsource_vendor_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(outsource_vendor_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_ovcnot($f,$t) { $select = "select outsource_vendor_master.*"; $from = " from outsource_vendor_master"; $where = " where "; $where .= " STR_TO_DATE(outsource_vendor_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(outsource_vendor_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_ovunot($f,$t) { $select = "select outsource_vendor_master.*"; $from = " from outsource_vendor_master"; $where = " where "; $where .= " STR_TO_DATE(outsource_vendor_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(outsource_vendor_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_ovucnot($f,$t) { $select = "select outsource_vendor_master.*"; $from = " from outsource_vendor_master"; $where = " where "; $where .= " STR_TO_DATE(outsource_vendor_master.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(outsource_vendor_master.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_ivnot($f,$t) { $select = "select indent_vendor_master.*"; $from = " from indent_vendor_master"; $where = " where "; $where .= " STR_TO_DATE(indent_vendor_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_vendor_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_ivcnot($f,$t) { $select = "select indent_vendor_master.*"; $from = " from indent_vendor_master"; $where = " where "; $where .= " STR_TO_DATE(indent_vendor_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_vendor_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_ipnot($f,$t) { $select = "select indent_product.*"; $from = " from indent_product"; $where = " where "; $where .= " STR_TO_DATE(indent_product.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_product.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_ipcnot($f,$t) { $select = "select indent_product.*"; $from = " from indent_product"; $where = " where "; $where .= " STR_TO_DATE(indent_product.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_product.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_master_import_pmnot($f,$t) { $select = "select product_master.*"; $from = " from product_master"; $where = " where "; $where .= " STR_TO_DATE(product_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(product_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_master_import_pmcnot($f,$t) { $select = "select product_master.*"; $from = " from product_master"; $where = " where "; $where .= " STR_TO_DATE(product_master.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(product_master.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function sample_old_noti_date_wise($f,$t) { $select = "select sample_request.*"; $from = " from sample_request"; $where = " where "; $where .= " STR_TO_DATE(sample_request.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(sample_request.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function sample_old_noti_date_wise_counti($f,$t) { $select = "select sample_request.*"; $from = " from sample_request"; $where = " where "; $where .= " STR_TO_DATE(sample_request.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(sample_request.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function sample_old_unoti_date_wise($f,$t) { $select = "select sample_request.*"; $from = " from sample_request"; $where = " where "; $where .= " STR_TO_DATE(sample_request.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(sample_request.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function sample_old_unoti_date_wise_counti($f,$t) { $select = "select sample_request.*"; $from = " from sample_request"; $where = " where "; $where .= " STR_TO_DATE(sample_request.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(sample_request.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_plannind_import_snot($f,$t) { $select = "select orders.*,sub_orders.*,sub_order_shades.*"; $from = " from orders,sub_orders,sub_order_shades"; $where = " where "; $where .= " sub_orders.orderID = orders.id"; $where .= " and sub_order_shades.subOrderID = sub_orders.id"; $where .= " and STR_TO_DATE(sub_order_shades.planned_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(sub_order_shades.planned_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY orders.oslNo"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_plannind_rows_import_snot($f,$t) { $select = "select orders.*,sub_orders.*"; $from = " from orders,sub_orders,sub_order_shades"; $where = " where "; $where .= " sub_orders.orderID = orders.id"; $where .= " and sub_order_shades.subOrderID = sub_orders.id"; $where .= " and STR_TO_DATE(sub_order_shades.planned_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(sub_order_shades.planned_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .= " and sub_order_shades.planningStatus = 'planned'"; $where .= " and sub_orders.article_type = 'inhouse'"; $where .=" GROUP BY orders.oslNo"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_outsource_plannind_import_snot($f,$t) { $select = "select orders.*,sub_orders.*,sub_order_shades.*,planned_order.*"; $from = " from orders,sub_orders,sub_order_shades,planned_order"; $where = " where "; $where .= " sub_orders.orderID = orders.id"; $where .= " and sub_order_shades.subOrderID = sub_orders.id"; $where .= " and planned_order.subNo= sub_order_shades.shadeID"; $where .= " and STR_TO_DATE(planned_order.plannedDate,'%Y-%m-%d')>=STR_TO_DATE('$f','%Y-%m-%d')"; $where .=" and STR_TO_DATE(planned_order.plannedDate,'%Y-%m-%d')<=STR_TO_DATE('$t','%Y-%m-%d')"; $where .= " and sub_order_shades.planningStatus = 'planned'"; $where .= " and sub_orders.article_type = 'outsource'"; $where .=" GROUP BY orders.oslNo"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_outsource_plannind_rows_import_snot($f,$t) { $select = "select orders.*,sub_orders.*,sub_order_shades.*,planned_order.*"; $from = " from orders,sub_orders,sub_order_shades,planned_order"; $where = " where "; $where .= " sub_orders.orderID = orders.id"; $where .= " and sub_order_shades.subOrderID = sub_orders.id"; $where .= " and planned_order.subNo= sub_order_shades.shadeID"; $where .= " and STR_TO_DATE(planned_order.plannedDate,'%Y-%m-%d')>=STR_TO_DATE('$f','%Y-%m-%d')"; $where .=" and STR_TO_DATE(planned_order.plannedDate,'%Y-%m-%d')<=STR_TO_DATE('$t','%Y-%m-%d')"; $where .= " and sub_order_shades.planningStatus = 'planned'"; $where .= " and sub_orders.article_type = 'outsource'"; $where .=" GROUP BY orders.oslNo"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_plannind_import_marketing_snot($f,$t) { $select = "select orders.*,sub_orders.*"; $from = " from orders,sub_orders"; $where = " where "; $where .= " sub_orders.orderID = orders.id"; $where .= " and STR_TO_DATE(sub_orders.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(sub_orders.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_plannind_rows_import_marketing_snot($f,$t) { $select = "select orders.*,sub_orders.*"; $from = " from orders,sub_orders"; $where = " where "; $where .= " sub_orders.orderID = orders.id"; $where .= " and STR_TO_DATE(sub_orders.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(sub_orders.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_plannind_import_marketing_subnot($f,$t) { $select = "select orders.*,sub_orders.*"; $from = " from orders,sub_orders"; $where = " where "; $where .= " sub_orders.orderID = orders.id"; $where .= " and STR_TO_DATE(sub_orders.orderConfirmDate,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(sub_orders.orderConfirmDate,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_plannind_rows_import_marketing_subnot($f,$t) { $select = "select orders.*,sub_orders.*"; $from = " from orders,sub_orders"; $where = " where "; $where .= " sub_orders.orderID = orders.id"; $where .= " and STR_TO_DATE(sub_orders.orderConfirmDate,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(sub_orders.orderConfirmDate,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_plannind_import_marketing_subunot($f,$t) { $select = "select orders.*,sub_orders.*"; $from = " from orders,sub_orders"; $where = " where "; $where .= " sub_orders.orderID = orders.id"; $where .= " and STR_TO_DATE(sub_orders.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(sub_orders.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_plannind_rows_import_marketing_subunot($f,$t) { $select = "select orders.*,sub_orders.*"; $from = " from orders,sub_orders"; $where = " where "; $where .= " sub_orders.orderID = orders.id"; $where .= " and STR_TO_DATE(sub_orders.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(sub_orders.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function packing_old_noti_date_wise($f,$t) { $select = "select packing_list_data.*"; $from = " from packing_list_data"; $where = " where "; $where .= " STR_TO_DATE(packing_list_data.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(packing_list_data.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function packing_old_noti_date_wise_counti($f,$t) { $select = "select packing_list_data.*"; $from = " from packing_list_data"; $where = " where "; $where .= " STR_TO_DATE(packing_list_data.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(packing_list_data.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function upacking_old_noti_date_wise($f,$t) { $select = "select packing_list_data.*"; $from = " from packing_list_data"; $where = " where "; $where .= " STR_TO_DATE(packing_list_data.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(packing_list_data.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function upacking_old_noti_date_wise_counti($f,$t) { $select = "select packing_list_data.*"; $from = " from packing_list_data"; $where = " where "; $where .= " STR_TO_DATE(packing_list_data.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(packing_list_data.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function madeups_old_noti_date_wise($f,$t) { $select = "select madeups_list_data.*"; $from = " from madeups_list_data"; $where = " where "; $where .= " STR_TO_DATE(madeups_list_data.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(madeups_list_data.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function madeups_old_noti_date_wise_counti($f,$t) { $select = "select madeups_list_data.*"; $from = " from madeups_list_data"; $where = " where "; $where .= " STR_TO_DATE(madeups_list_data.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(madeups_list_data.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function madeups_menu_old_noti_date_wise($f,$t) { $select = "select fabric_madeups.*"; $from = " from fabric_madeups"; $where = " where "; $where .= " STR_TO_DATE(fabric_madeups.created_at,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(fabric_madeups.created_at,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function madeups_menu_old_noti_date_wise_counti($f,$t) { $select = "select fabric_madeups.*"; $from = " from fabric_madeups"; $where = " where "; $where .= " STR_TO_DATE(fabric_madeups.created_at,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(fabric_madeups.created_at,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function consum_menu_old_noti_date_wise($f,$t) { $select = "select consumable_madeups.*"; $from = " from consumable_madeups"; $where = " where "; $where .= " STR_TO_DATE(consumable_madeups.created_at,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(consumable_madeups.created_at,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; $where .=" GROUP BY consumable_madeups.osl"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function consum_menu_old_noti_date_wise_counti_res($f,$t) { $select = "select SUM(consumable_madeups.issued_quantity) as issued_quantity"; $from = " from consumable_madeups"; $where = " where "; $where .= " STR_TO_DATE(consumable_madeups.created_at,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(consumable_madeups.created_at,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; $where .=" GROUP BY consumable_madeups.osl"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function consum_menu_old_noti_date_wise_counti($f,$t) { $select = "select SUM(consumable_madeups.issued_quantity) as issued_quantity"; $from = " from consumable_madeups"; $where = " where "; $where .= " STR_TO_DATE(consumable_madeups.created_at,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(consumable_madeups.created_at,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; $where .=" GROUP BY consumable_madeups.osl"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function fab_madeups_menu_old_noti_date_wise($f,$t) { $select = "select fabric_madeups_delivery_confirmation.*"; $from = " from fabric_madeups_delivery_confirmation"; $where = " where "; $where .= " STR_TO_DATE(fabric_madeups_delivery_confirmation.rec_date,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(fabric_madeups_delivery_confirmation.rec_date,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function fab_madeups_rows_menu_old_noti_date_wise($f,$t) { $select = "select fabric_madeups_delivery_confirmation.*"; $from = " from fabric_madeups_delivery_confirmation"; $where = " where "; $where .= " STR_TO_DATE(fabric_madeups_delivery_confirmation.rec_date,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(fabric_madeups_delivery_confirmation.rec_date,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function fab_madeups_menu_old_noti_date_wise1($f,$t) { $select = "select fabric_madeups_delivery_confirmation.*"; $from = " from fabric_madeups_delivery_confirmation"; $where = " where "; $where .= " STR_TO_DATE(fabric_madeups_delivery_confirmation.rec_date,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(fabric_madeups_delivery_confirmation.rec_date,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function fab_madeups_rows_menu_old_noti_date_wise1($f,$t) { $select = "select fabric_madeups_delivery_confirmation.*"; $from = " from fabric_madeups_delivery_confirmation"; $where = " where "; $where .= " STR_TO_DATE(fabric_madeups_delivery_confirmation.rec_date,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(fabric_madeups_delivery_confirmation.rec_date,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function design_weave_old_noti_date_wise($f,$t) { $select = "select design_weave.*"; $from = " from design_weave"; $where = " where "; $where .= " STR_TO_DATE(design_weave.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(design_weave.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function design_weave_old_noti_date_wise_counti($f,$t) { $select = "select design_weave.*"; $from = " from design_weave"; $where = " where "; $where .= " STR_TO_DATE(design_weave.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(design_weave.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function design_weave_uold_noti_date_wise($f,$t) { $select = "select design_weave.*"; $from = " from design_weave"; $where = " where "; $where .= " STR_TO_DATE(design_weave.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(design_weave.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function design_weave_uold_noti_date_wise_counti($f,$t) { $select = "select design_weave.*"; $from = " from design_weave"; $where = " where "; $where .= " STR_TO_DATE(design_weave.updated_on,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(design_weave.updated_on,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function design_weave_fold_noti_date_wise($f,$t) { $select = "select design_weave.*"; $from = " from design_weave"; $where = " where "; $where .= " STR_TO_DATE(design_weave.finalized_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(design_weave.finalized_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function design_weave_fold_noti_date_wise_counti($f,$t) { $select = "select design_weave.*"; $from = " from design_weave"; $where = " where "; $where .= " STR_TO_DATE(design_weave.finalized_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(design_weave.finalized_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function design_weave_aold_noti_date_wise($f,$t) { $select = "select design_weave.*"; $from = " from design_weave"; $where = " where "; $where .= " STR_TO_DATE(design_weave.approved_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(design_weave.approved_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function design_weave_aold_noti_date_wise_counti($f,$t) { $select = "select design_weave.*"; $from = " from design_weave"; $where = " where "; $where .= " STR_TO_DATE(design_weave.approved_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(design_weave.approved_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function get_fabric_inspection_master_import_snot($f,$t) { $select = "select fabric_inspection_details.*,fabric_inspection.*"; $from = " from fabric_inspection,fabric_inspection_details"; $where = " where "; $where .= " fabric_inspection.goods_id= fabric_inspection_details.id"; $where .= " and STR_TO_DATE(fabric_inspection.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(fabric_inspection.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function get_fabric_inspection_master_rows_import_snot($f,$t) { $select = "select fabric_inspection_details.*,fabric_inspection.*"; $from = " from fabric_inspection,fabric_inspection_details"; $where = " where "; $where .= " fabric_inspection.goods_id= fabric_inspection_details.id"; $where .= " and STR_TO_DATE(fabric_inspection.created_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(fabric_inspection.created_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function cs_addstock_aold_noti_date_wise($f,$t) { $select = "select cs_addstock.*"; $from = " from cs_addstock"; $where = " where "; $where .= " STR_TO_DATE(cs_addstock.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(cs_addstock.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY cs_addstock.work_order"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function add_stock_aold_noti_date_wise_counts($f,$t) { $select = "select cs_addstock.*"; $from = " from cs_addstock"; $where = " where "; $where .= " STR_TO_DATE(cs_addstock.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(cs_addstock.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY cs_addstock.work_order"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function add_stock_aold_noti_date_wise_counti($f,$t) { $select = "select SUM(cs_addstock.issue_quantity) as issue_quantity"; $from = " from cs_addstock"; $where = " where "; $where .= " STR_TO_DATE(cs_addstock.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(cs_addstock.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY cs_addstock.work_order"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function fabric_addstock_aold_noti_date_wise($f,$t) { $select = "select fabric_addstock.*"; $from = " from fabric_addstock"; $where = " where "; $where .= " STR_TO_DATE(fabric_addstock.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(fabric_addstock.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY fabric_addstock.work_order"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function fabric_stock_aold_noti_date_wise_counti($f,$t) { $select = "select SUM(fabric_addstock.issue_stock) as issue_stock"; $from = " from fabric_addstock"; $where = " where "; $where .= " STR_TO_DATE(fabric_addstock.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(fabric_addstock.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY fabric_addstock.work_order"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function fabric_stock_aold_noti_date_wise_counts($f,$t) { $select = "select fabric_addstock.*"; $from = " from fabric_addstock"; $where = " where "; $where .= " STR_TO_DATE(fabric_addstock.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(fabric_addstock.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY fabric_addstock.work_order"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function cyt_addstock_aold_noti_date_wise($f,$t) { $select = "select create_yarntwisting_work_order.*"; $from = " from create_yarntwisting_work_order"; $where = " where "; $where .= " STR_TO_DATE(create_yarntwisting_work_order.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(create_yarntwisting_work_order.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY create_yarntwisting_work_order.work_order"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function cyt_stock_aold_noti_date_wise_counti($f,$t) { $select = "select SUM(create_yarntwisting_work_order.quty_kgs) as quty_kgs"; $from = " from create_yarntwisting_work_order"; $where = " where "; $where .= " STR_TO_DATE(create_yarntwisting_work_order.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(create_yarntwisting_work_order.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY create_yarntwisting_work_order.work_order"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function cyt_stock_aold_noti_date_wise_counts($f,$t) { $select = "select create_yarntwisting_work_order.*"; $from = " from create_yarntwisting_work_order"; $where = " where "; $where .= " STR_TO_DATE(create_yarntwisting_work_order.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(create_yarntwisting_work_order.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY create_yarntwisting_work_order.work_order"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function wd_addstock_aold_noti_date_wise($f,$t) { $select = "select workorder_dyeing.*"; $from = " from workorder_dyeing"; $where = " where "; $where .= " STR_TO_DATE(workorder_dyeing.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(workorder_dyeing.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY workorder_dyeing.work_order"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function wd_stock_aold_noti_date_wise_counti($f,$t) { $select = "select SUM(workorder_dyeing.warp_wt) as warp_wt"; $from = " from workorder_dyeing"; $where = " where "; $where .= " STR_TO_DATE(workorder_dyeing.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(workorder_dyeing.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY workorder_dyeing.work_order"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function wd_stock_aold_noti_date_wise_counts($f,$t) { $select = "select workorder_dyeing.*"; $from = " from workorder_dyeing"; $where = " where "; $where .= " STR_TO_DATE(workorder_dyeing.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(workorder_dyeing.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY workorder_dyeing.work_order"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function wdm_addstock_aold_noti_date_wise($f,$t) { $select = "select workorder_dyeing_material.*"; $from = " from workorder_dyeing_material"; $where = " where "; $where .= " STR_TO_DATE(workorder_dyeing_material.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(workorder_dyeing_material.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY workorder_dyeing_material.work_order"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function wdm_stock_aold_noti_date_wise_counti($f,$t) { $select = "select SUM(workorder_dyeing_material.issue_net_weight) as issue_net_weight"; $from = " from workorder_dyeing_material"; $where = " where "; $where .= " STR_TO_DATE(workorder_dyeing_material.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(workorder_dyeing_material.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY workorder_dyeing_material.work_order"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function wdm_stock_aold_noti_date_wise_counts($f,$t) { $select = "select workorder_dyeing_material.*"; $from = " from workorder_dyeing_material"; $where = " where "; $where .= " STR_TO_DATE(workorder_dyeing_material.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(workorder_dyeing_material.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY workorder_dyeing_material.work_order"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function fab_emb_addstock_aold_noti_date_wise($f,$t) { $select = "select finishing_embroidry.*"; $from = " from finishing_embroidry"; $where = " where "; $where .= " STR_TO_DATE(finishing_embroidry.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(finishing_embroidry.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY finishing_embroidry.work_order"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function fab_emb_stock_aold_noti_date_wise_counti($f,$t) { $select = "select SUM(finishing_embroidry.issue_stock) as issue_stock"; $from = " from finishing_embroidry"; $where = " where "; $where .= " STR_TO_DATE(finishing_embroidry.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(finishing_embroidry.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY finishing_embroidry.work_order"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function fab_emb_stock_aold_noti_date_wise_counts($f,$t) { $select = "select finishing_embroidry.*"; $from = " from finishing_embroidry"; $where = " where "; $where .= " STR_TO_DATE(finishing_embroidry.created_at,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(finishing_embroidry.created_at,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY finishing_embroidry.work_order"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function wod_emb_addstock_aold_noti_date_wise($f,$t) { $select = "select work_order_dyeing.id,work_order_dyeing.rec_date,work_order_dyeing.rec_by,workorder_dyeing.work_order_no"; $from = " from work_order_dyeing,workorder_dyeing"; $where = " where "; $where .= " work_order_dyeing.dyed_id=workorder_dyeing.id"; $where .= " and STR_TO_DATE(work_order_dyeing.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(work_order_dyeing.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY work_order_dyeing.dyed_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function wod_gross_aold_noti_date_wise_counti($f,$t) { $select = "select SUM(work_order_dyeing.rec_dyed_qua) as rec_dyed_qua"; $from = " from work_order_dyeing,workorder_dyeing"; $where = " where "; $where .= " work_order_dyeing.dyed_id=workorder_dyeing.id"; $where .= " and STR_TO_DATE(work_order_dyeing.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(work_order_dyeing.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY work_order_dyeing.dyed_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function wod_stock_aold_noti_date_wise_counts($f,$t) { $select = "select work_order_dyeing.id,work_order_dyeing.rec_date,work_order_dyeing.rec_by,workorder_dyeing.work_order_no"; $from = " from work_order_dyeing,workorder_dyeing"; $where = " where "; $where .= " work_order_dyeing.dyed_id=workorder_dyeing.id"; $where .= " and STR_TO_DATE(work_order_dyeing.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(work_order_dyeing.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY work_order_dyeing.dyed_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function wot_emb_addstock_aold_noti_date_wise($f,$t) { $select = "select work_order_twisting.id,work_order_twisting.rec_date,work_order_twisting.rec_by,create_yarntwisting_work_order.work_order_no"; $from = " from create_yarntwisting_work_order,work_order_twisting"; $where = " where "; $where .= " work_order_twisting.yarn_id=create_yarntwisting_work_order.id"; $where .= " and STR_TO_DATE(work_order_twisting.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(work_order_twisting.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY work_order_twisting.yarn_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function wot_gross_aold_noti_date_wise_counti($f,$t) { $select = "select SUM(work_order_twisting.gross_weight) as gross_weight"; $from = " from create_yarntwisting_work_order,work_order_twisting"; $where = " where "; $where .= " work_order_twisting.yarn_id=create_yarntwisting_work_order.id"; $where .= " and STR_TO_DATE(work_order_twisting.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(work_order_twisting.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY work_order_twisting.yarn_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function wot_net_wt_aold_noti_date_wise_counti($f,$t) { $select = "select SUM(work_order_twisting.twisting_net_weight) as twisting_net_weight"; $from = " from create_yarntwisting_work_order,work_order_twisting"; $where = " where "; $where .= " work_order_twisting.yarn_id=create_yarntwisting_work_order.id"; $where .= " and STR_TO_DATE(work_order_twisting.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(work_order_twisting.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY work_order_twisting.yarn_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function wot_tare_wt_aold_noti_date_wise_counti($f,$t) { $select = "select SUM(work_order_twisting.tare_weight) as tare_weight"; $from = " from create_yarntwisting_work_order,work_order_twisting"; $where = " where "; $where .= " work_order_twisting.yarn_id=create_yarntwisting_work_order.id"; $where .= " and STR_TO_DATE(work_order_twisting.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(work_order_twisting.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY work_order_twisting.yarn_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function wot_stock_aold_noti_date_wise_counts($f,$t) { $select = "select work_order_twisting.id,work_order_twisting.rec_date,work_order_twisting.rec_by,create_yarntwisting_work_order.work_order_no"; $from = " from create_yarntwisting_work_order,work_order_twisting"; $where = " where "; $where .= " work_order_twisting.yarn_id=create_yarntwisting_work_order.id"; $where .= " and STR_TO_DATE(work_order_twisting.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(work_order_twisting.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY work_order_twisting.yarn_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function wfs_res_colunot($f,$t) { $select = "select weaving_factory_stock.*"; $from = " from weaving_factory_stock"; $where = " where "; $where .= " STR_TO_DATE(weaving_factory_stock.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(weaving_factory_stock.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY weaving_factory_stock.weaving_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function wfs_rec_mtrs_colunot($f,$t) { $select = "select SUM(weaving_factory_stock.received_mtrs) as received_mtrs"; $from = " from weaving_factory_stock"; $where = " where "; $where .= " STR_TO_DATE(weaving_factory_stock.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(weaving_factory_stock.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY weaving_factory_stock.weaving_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function wfs_rec_wt_get_colunot($f,$t) { $select = "select SUM(weaving_factory_stock.received_weight) as received_weight"; $from = " from weaving_factory_stock"; $where = " where "; $where .= " STR_TO_DATE(weaving_factory_stock.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(weaving_factory_stock.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY weaving_factory_stock.weaving_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function wfs_num_rows_colucnot($f,$t) { $select = "select weaving_factory_stock.*"; $from = " from weaving_factory_stock"; $where = " where "; $where .= " STR_TO_DATE(weaving_factory_stock.rec_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(weaving_factory_stock.rec_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; $where .=" GROUP BY weaving_factory_stock.weaving_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function fes_res_colunot($f,$t) { $select = "select finishing_embroidry_stock.id,finishing_embroidry_stock.received_date,finishing_embroidry_stock.rec_by,finishing_embroidry.work_order"; $from = " from finishing_embroidry_stock,finishing_embroidry"; $where = " where "; $where .= " finishing_embroidry_stock.fin_emb_id=finishing_embroidry.id"; $where .= " and STR_TO_DATE(finishing_embroidry_stock.received_date,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(finishing_embroidry_stock.received_date,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; $where .=" GROUP BY finishing_embroidry_stock.fin_emb_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function fes_rec_wt_get_colunot($f,$t) { $select = "select SUM(finishing_embroidry_stock.rec_qua) as rec_qua"; $from = " from finishing_embroidry_stock,finishing_embroidry"; $where = " where "; $where .= " finishing_embroidry_stock.fin_emb_id=finishing_embroidry.id"; $where .= " and STR_TO_DATE(finishing_embroidry_stock.received_date,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(finishing_embroidry_stock.received_date,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; $where .=" GROUP BY finishing_embroidry_stock.fin_emb_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function fes_num_rows_colucnot($f,$t) { $select = "select finishing_embroidry_stock.id,finishing_embroidry_stock.received_date,finishing_embroidry_stock.rec_by,finishing_embroidry.work_order"; $from = " from finishing_embroidry_stock,finishing_embroidry"; $where = " where "; $where .= " finishing_embroidry_stock.fin_emb_id=finishing_embroidry.id"; $where .= " and STR_TO_DATE(finishing_embroidry_stock.received_date,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(finishing_embroidry_stock.received_date,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; $where .=" GROUP BY finishing_embroidry_stock.fin_emb_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function indent_po_get_colunot($f,$t) { $select = "select indent_yarn_goods_details.*,indent_po.*"; $from = " from indent_yarn_goods_details,indent_po"; $where = " where "; $where .= " indent_po.id= indent_yarn_goods_details.po_list_id"; $where .= " and STR_TO_DATE(indent_yarn_goods_details.received_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_yarn_goods_details.received_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; //$where .=" GROUP BY finishing_embroidry_stock.fin_emb_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function indent_po_rows_colucnot($f,$t) { $select = "select indent_yarn_goods_details.*,indent_po.*"; $from = " from indent_yarn_goods_details,indent_po"; $where = " where "; $where .= " indent_po.id= indent_yarn_goods_details.po_list_id"; $where .= " and STR_TO_DATE(indent_yarn_goods_details.received_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_yarn_goods_details.received_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; //$where .=" GROUP BY finishing_embroidry_stock.fin_emb_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function indent_cs_get_colunot($f,$t) { $select = "select indent_cs_goods_details.*,indent_po.*"; $from = " from indent_cs_goods_details,indent_po"; $where = " where "; $where .= " indent_po.id= indent_cs_goods_details.po_list_id"; $where .= " and STR_TO_DATE(indent_cs_goods_details.received_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_cs_goods_details.received_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; //$where .=" GROUP BY finishing_embroidry_stock.fin_emb_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function indent_cs_rows_colucnot($f,$t) { $select = "select indent_cs_goods_details.*,indent_po.*"; $from = " from indent_cs_goods_details,indent_po"; $where = " where "; $where .= " indent_po.id= indent_cs_goods_details.po_list_id"; $where .= " and STR_TO_DATE(indent_cs_goods_details.received_date,'%d-%m-%Y')>=STR_TO_DATE('$f','%d-%m-%Y')"; $where .=" and STR_TO_DATE(indent_cs_goods_details.received_date,'%d-%m-%Y')<=STR_TO_DATE('$t','%d-%m-%Y')"; //$where .=" GROUP BY finishing_embroidry_stock.fin_emb_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function indent_cs_date_wise_get_colunot($f,$t) { $select = "select indent_cs_goods_details.*,indent_po.*"; $from = " from indent_cs_goods_details,indent_po"; $where = " where "; $where .= " indent_po.id= indent_cs_goods_details.po_list_id"; $where .= " and STR_TO_DATE(indent_cs_goods_details.received_date,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(indent_cs_goods_details.received_date,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; //$where .=" GROUP BY finishing_embroidry_stock.fin_emb_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function indent_cs_date_wise_rows_colucnot($f,$t) { $select = "select indent_cs_goods_details.*,indent_po.*"; $from = " from indent_cs_goods_details,indent_po"; $where = " where "; $where .= " indent_po.id= indent_cs_goods_details.po_list_id"; $where .= " and STR_TO_DATE(indent_cs_goods_details.received_date,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(indent_cs_goods_details.received_date,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; //$where .=" GROUP BY finishing_embroidry_stock.fin_emb_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function indent_goods_date_wise_get_colunot($f,$t) { $select = "select indent_goods_details.*,indent_po.*"; $from = " from indent_goods_details,indent_po"; $where = " where "; $where .= " indent_po.id= indent_goods_details.po_list_id"; $where .= " and STR_TO_DATE(indent_goods_details.received_date,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(indent_goods_details.received_date,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; //$where .=" GROUP BY finishing_embroidry_stock.fin_emb_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->result(); } public function indent_goods_date_wise_rows_colucnot($f,$t) { $select = "select indent_goods_details.*,indent_po.*"; $from = " from indent_goods_details,indent_po"; $where = " where "; $where .= " indent_po.id= indent_goods_details.po_list_id"; $where .= " and STR_TO_DATE(indent_goods_details.received_date,'%d/%m/%Y')>=STR_TO_DATE('$f','%d/%m/%Y')"; $where .=" and STR_TO_DATE(indent_goods_details.received_date,'%d/%m/%Y')<=STR_TO_DATE('$t','%d/%m/%Y')"; //$where .=" GROUP BY finishing_embroidry_stock.fin_emb_id"; $sql = $select.$from.$where; $result = $this->db->query($sql); return $result->num_rows(); } public function fetch_orderid_dese($where) { $this->db->select('fabric_madeups_delivery_confirmation.*,orders.fileNo'); $this->db->from('fabric_madeups_delivery_confirmation'); $this->db->join('orders', 'orders.oslNo= fabric_madeups_delivery_confirmation.osl'); $this->db->where('fabric_madeups_delivery_confirmation.received_qty >',0); $query=$this->db->get(); return $query->result(); } public function fetch_each_orderid_dese($where) { $this->db->select('fabric_madeups_delivery_confirmation.*,orders.fileNo'); $this->db->from('fabric_madeups_delivery_confirmation'); $this->db->join('orders', 'orders.oslNo= fabric_madeups_delivery_confirmation.osl'); $this->db->where('fabric_madeups_delivery_confirmation.received_qty >',0); $this->db->where('fabric_madeups_delivery_confirmation.id',$where); $query=$this->db->get(); return $query->result(); } public function fetch_orderid_dese_location($where) { $this->db->select('fabric_madeups_delivery_confirmation.*,orders.fileNo'); $this->db->from('fabric_madeups_delivery_confirmation'); $this->db->join('orders', 'orders.oslNo= fabric_madeups_delivery_confirmation.osl'); $this->db->where('fabric_madeups_delivery_confirmation.received_qty >',0); $this->db->where('fabric_madeups_delivery_confirmation.location',$where); $query=$this->db->get(); return $query->result(); } public function fetch_where_outsource_subgrid_data_history_data($val) { $this->db->select('workorder_dyeing.osl_no,workorder_dyeing.yarn_details,work_order_dyeing.issue_no,work_order_dyeing.shade,work_order_dyeing.issue_dyed_qua, work_order_dyeing.rec_work_order_dyed_qua,work_order_dyeing.rec_date,workorder_dyeing.work_order_no'); $this->db->group_by('workorder_dyeing.issue_no'); $this->db->from('workorder_dyeing'); $this->db->join('work_order_dyeing', 'work_order_dyeing.work_order= workorder_dyeing.work_order'); $this->db->where('workorder_dyeing.work_order',$val); $query = $this->db->get(); return $query->result(); } public function fetch_where_outsource_twisting_subgrid_data_history_data($val) { $this->db->select('*'); $this->db->from('create_yarntwisting_work_order'); $this->db->join('work_order_twisting', 'work_order_twisting.yarn_id= create_yarntwisting_work_order.id'); $this->db->where('create_yarntwisting_work_order.id',$val); $query = $this->db->get(); return $query->result(); } public function Getsearch_fabric_numbers($keyword) { $this->db->distinct(); $this->db->select('*'); $this->db->like("po_no", $keyword); $this->db->from('finishing_embroidry'); $this->db->where('finishing_embroidry.customer_id',''); $query= $this->db->get(); return $query->result(); } public function monthly_current_month_delievry_osl_list($table,$fromdate,$enddate,$f) { if($fromdate == 'present_year'){ $y=date('Y'); date_default_timezone_set("Asia/Kolkata"); //India time (GMT+5:30) $month = date('m'); $query = $this->db->query('SELECT orders.*,sub_orders.orders_Type,sub_order_shades.planned_by, sub_order_shades.planningStatus,orders.currency,sub_orders.contractType FROM orders INNER JOIN sub_orders ON orders.id=sub_orders.orderID INNER JOIN sub_order_shades ON sub_order_shades.subOrderID =sub_orders.id where Month(STR_TO_DATE (orders.deliveryDate,"%Y-%m-%d"))="'.$month.'" AND Year(STR_TO_DATE (orders.deliveryDate,"%Y-%m-%d"))="'.$y.'" AND orders.orderType="'.$f.'" GROUP BY sub_orders.orderID ORDER BY orders.deliveryDate ASC') ; }else{ $from_date1 = date('Y-m-d',strtotime($fromdate)); $end_date1 = date('Y-m-d',strtotime($enddate)); $this->db->select("orders.*,sub_orders.orders_Type,sub_order_shades.planned_by,sub_order_shades.planningStatus,orders.currency,sub_orders.contractType"); $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("orders.deliveryDate BETWEEN '$from_date1' AND '$end_date1'"); $this->db->group_by("sub_orders.orderID"); $this->db->order_by("orders.deliveryDate ASC"); $query= $this->db->get(); } $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); $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['contractType']=$result->contractType; array_push($array, $data); } return $array; } public function pending_order_list_details($table,$f) { $ignore = array('Fully Shipped'); $this->db->select("orders.*,sub_orders.orders_Type,sub_order_shades.planned_by,sub_order_shades.planningStatus,orders.currency,sub_orders.contractType"); $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("orders.shipped_fun",'0'); $this->db->where_not_in('sub_order_shades.shipping_status', $ignore); //$this->db->where("orders.deliveryDate BETWEEN '$from_date1' AND '$end_date1'"); $this->db->group_by("sub_orders.orderID"); $this->db->order_by("orders.deliveryDate ASC"); $query= $this->db->get(); $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; array_push($array, $data); } return $array; } public function completed_order_list_details($table,$f) { $ignore = array('Pending','Partially Shipped'); $this->db->select("orders.*,sub_orders.orders_Type,sub_order_shades.planned_by,sub_order_shades.planningStatus,orders.currency,sub_orders.contractType"); $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("orders.shipped_fun",'0'); $this->db->where_not_in('sub_order_shades.shipping_status', $ignore); //$this->db->where("orders.deliveryDate BETWEEN '$from_date1' AND '$end_date1'"); $this->db->group_by("sub_orders.orderID"); $this->db->order_by("orders.deliveryDate DESC"); $query= $this->db->get(); $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; array_push($array, $data); } return $array; } public function fetch_where_subgrid_news_data1($where) { $this->db->select("consumable_madeups.*,orders.fileNo"); $this->db->from('consumable_madeups'); $this->db->join('orders', 'orders.oslNo = consumable_madeups.osl'); $this->db->where('consumable_madeups.plan_id',$where); $query = $this->db->get(); return $query->result(); } public function max_select_years_purchase_no($table,$where) { $this->db->select_max('po_id'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function get_purchase_new_datas() { $query = $this->db->query('SELECT po_no,vendor_name,balanced_quantity,g_date,currency,approved_by,remark,complition_status,STR_TO_DATE (g_date,"%d-%m-%Y") as gdate FROM indent_po where confirm="Yes" AND product_type="Consumables" ORDER BY gdate DESC'); return $query->result(); } public function history_data_fetch_new_po($table) { $query = $this->db->query('SELECT *,STR_TO_DATE (approved_date,"%d-%m-%Y") as approveddate FROM indent_po where department !=" " ORDER BY approveddate DESC'); return $query->result(); } public function get_purchase_new_or_datas($table,$where) { $query = $this->db->query('SELECT *,STR_TO_DATE (g_date,"%d-%m-%Y") as gdate FROM indent_po where confirm="Yes" AND product_type="Services" GROUP BY po_no ORDER BY gdate DESC'); return $query->result(); } public function get_purchase_new_or_spares_datas() { $query = $this->db->query('SELECT po_no,vendor_name,balanced_quantity,g_date,currency,approved_by,remark,complition_status,STR_TO_DATE (g_date,"%d-%m-%Y") as gdate FROM indent_po where confirm="Yes" AND product_type="Spares" ORDER BY gdate DESC'); return $query->result(); } public function get_purchase_new_or_fabrics_datas() { $this->db->select('po_no, vendor_name, balanced_quantity, g_date, currency, approved_by, remark, complition_status, STR_TO_DATE(g_date, "%d-%m-%Y") as gdate'); $this->db->from('indent_po'); $this->db->where('confirm', 'Yes'); $this->db->where('product_type', 'Fabrics'); $this->db->order_by('gdate', 'DESC'); $query = $this->db->get(); return $query->result(); } // public function get_purchase_new_or_fabrics_datas($table,$where) // { // $query = $this->db->query('SELECT po_no,vendor_name,balanced_quantity,g_date,currency,approved_by,remark,complition_status,STR_TO_DATE (g_date,"%d-%m-%Y") as gdate FROM // indent_po where confirm="Yes" AND product_type="Fabrics" GROUP BY po_no ORDER BY gdate DESC'); // return $query->result(); // } public function get_purchase_new_or_yarns_raw_datas() { $this->db->select('po_no, vendor_name, balanced_quantity, g_date, currency, approved_by, remark, complition_status, STR_TO_DATE(g_date, "%d-%m-%Y") as gdate'); $this->db->from('indent_po'); $this->db->where('confirm', 'Yes'); $this->db->where('product_type', 'Yarn - Raw'); $this->db->order_by('gdate', 'DESC'); $query = $this->db->get(); return $query->result(); } // public function get_purchase_new_or_yarns_raw_datas($table,$where) // { // $query = $this->db->query('SELECT po_no,vendor_name,balanced_quantity,g_date,currency,approved_by,remark,complition_status,STR_TO_DATE (g_date,"%d-%m-%Y") as gdate FROM // indent_po where confirm="Yes" AND product_type="Yarn - Raw" GROUP BY po_no ORDER BY gdate DESC'); // return $query->result(); // } public function get_purchase_new_or_yarns_twist_datas() { $this->db->select('po_no, vendor_name, balanced_quantity, g_date, currency, approved_by, remark, complition_status, STR_TO_DATE(g_date, "%d-%m-%Y") as gdate'); $this->db->from('indent_po'); $this->db->where('confirm', 'Yes'); $this->db->where('product_type', 'Yarn - Twisted'); $this->db->order_by('gdate', 'DESC'); $query = $this->db->get(); return $query->result(); } // public function get_purchase_new_or_yarns_twist_datas($table,$where) // { // $query = $this->db->query('SELECT po_no,vendor_name,balanced_quantity,g_date,currency,approved_by,remark,complition_status,STR_TO_DATE (g_date,"%d-%m-%Y") as gdate FROM // indent_po where confirm="Yes" AND product_type="Yarn - Twisted" GROUP BY po_no ORDER BY gdate DESC'); // return $query->result(); // } public function get_purchase_new_or_yarns_dyed_datas() { $this->db->select('po_no, vendor_name, balanced_quantity, g_date, currency, approved_by, remark, complition_status, STR_TO_DATE(g_date, "%d-%m-%Y") as gdate'); $this->db->from('indent_po'); $this->db->where('confirm', 'Yes'); $this->db->where('product_type', 'Yarn - Dyed'); $this->db->order_by('gdate', 'DESC'); $query = $this->db->get(); return $query->result(); } // public function get_purchase_new_or_yarns_dyed_datas($table,$where) // { // $query = $this->db->query('SELECT po_no,vendor_name,balanced_quantity,g_date,currency,approved_by,remark,complition_status,STR_TO_DATE (g_date,"%d-%m-%Y") as gdate FROM // indent_po where confirm="Yes" AND product_type="Yarn - Dyed" GROUP BY po_no ORDER BY gdate DESC'); // return $query->result(); // } public function get_podata_row($table,$where) { $this->db->select('*'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->row(); } public function sum_get_customerdata_new($table,$where) { $this->db->select_sum('stock_wt','stock_wt_tot'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function sum_amount_get_customerdata_new($table,$where) { $this->db->select_sum('values_es','values_es_tot'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); return $query->row(); } public function insert_details($table,$data) { $this->db->insert($table,$data); return $this->db->insert_id(); } ///////////////////// public function get_transaction_details($table,$where) { $this->db->select('A.*'); $this->db->from('transaction A'); $this->db->join('account_master B','B.id=A.account'); $this->db->where('A.delete_status','ACTIVE'); $this->db->where('B.delete_status','ACTIVE'); $this->db->group_by(array('A.year_data')); $query_new=$this->db->get(); $result_new= $query_new->result(); $return_array=array(); foreach ($result_new as $keys => $val) { $January_credit = 0; $January_debit = 0; $Febraury_credit =0; $Febraury_debit =0; $March_credit =0; $March_debit =0; $April_credit =0; $April_debit =0; $May_credit=0; $May_debit =0; $June_credit =0; $June_debit =0; $July_credit =0; $July_debit =0; $August_credit=0; $August_debit =0; $September_credit=0; $September_debit =0; $October_credit=0; $October_debit =0; $November_credit=0; $November_debit =0; $December_credit=0; $December_debit =0; $january_array=array(); $febraury_array=array(); $march_array=array(); $april_array=array(); $may_array=array(); $june_array=array(); $july_array=array(); $august_array=array(); $september_array=array(); $october_array=array(); $november_array=array(); $december_array=array(); $this->db->select('C.*'); $this->db->from('transaction C'); $this->db->join('account_master D','D.id=C.account'); $this->db->where('C.delete_status','ACTIVE'); $this->db->where('D.delete_status','ACTIVE'); //$this->db->where('C.month_data',$val->month_data); $this->db->where('C.year_data',$val->year_data); $query=$this->db->get(); $result= $query->result(); if(!empty($result)) { foreach ($result as $k => $v) { if($v->month_data == '1') { $January_credit += $v->credit; $January_debit += $v->debit; $data['id']=$v->id; $data['credit']=$January_credit; $data['debit']=$January_debit; $data['available_bal']=$January_credit-$January_debit; $data['month']='January'; $data['month_in_num']='01'; $data['confirm']=$v->confirm; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($january_array); $january_array=array(); array_push($january_array,$data); } else if($v->month_data == '2') { $Febraury_credit += $v->credit; $Febraury_debit += $v->debit; $data['id']=$v->id; $data['credit']=$Febraury_credit; $data['debit']=$Febraury_debit; $data['available_bal']=$Febraury_credit-$Febraury_debit; $data['month']='Febraury'; $data['month_in_num']='02'; $data['confirm']=$v->confirm; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($febraury_array); $febraury_array=array(); array_push($febraury_array,$data); } else if($month == '3') { $March_credit += $v->credit; $March_debit += $v->debit; $data['id']=$v->id; $data['credit']=$March_credit; $data['debit']=$March_debit; $data['month']='March'; $data['month_in_num']='3'; $data['confirm']=$v->confirm; $data['available_bal']=$March_credit-$March_debit; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($march_array); $march_array=array(); array_push($march_array,$data); } else if($month == '4') { $April_credit += $v->credit; $April_debit += $v->debit; $data['id']=$v->id; $data['credit']=$April_credit; $data['debit']=$April_debit; $data['month']='April'; $data['month_in_num']='4'; $data['confirm']=$v->confirm; $data['available_bal']=$April_credit-$April_debit; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($april_array); $april_array=array(); array_push($april_array,$data); } else if($month == '05') { $May_credit += $v->credit; $June_debit += $v->debit; $data['id']=$v->id; $data['credit']=$May_credit; $data['debit']=$June_debit; $data['month']='May'; $data['month_in_num']='5'; $data['confirm']=$v->confirm; $data['available_bal']=$May_credit-$June_debit; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($may_array); $may_array=array(); array_push($may_array,$data); } else if($month == '06') { $June_credit += $v->credit; $July_debit += $v->debit; $data['id']=$v->id; $data['credit']=$June_credit; $data['debit']=$July_debit; $data['month']='June'; $data['month_in_num']='6'; $data['confirm']=$v->confirm; $data['available_bal']=$June_credit-$July_debit; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($june_array); $june_array=array(); array_push($june_array,$data); } else if($month == '07') { $July_credit += $v->credit; $January_debit += $v->debit; $data['id']=$v->id; $data['credit']=$July_credit; $data['debit']=$January_debit; $data['month']='July'; $data['month_in_num']='7'; $data['confirm']=$v->confirm; $data['available_bal']=$July_credit-$January_debit; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($july_array); $july_array=array(); array_push($july_array,$data); } else if($month == '8') { $August_credit += $v->credit; $August_debit += $v->debit; $data['id']=$v->id; $data['credit']=$August_credit; $data['debit']=$August_debit; $data['month']='August'; $data['month_in_num']='8'; $data['confirm']=$v->confirm; $data['available_bal']=$August_credit-$August_debit; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($august_array); $august_array=array(); array_push($august_array,$data); } else if($month == '9') { $September_credit += $v->credit; $September_debit += $v->debit; $data['id']=$v->id; $data['credit']=$September_credit; $data['debit']=$September_debit; $data['month']='September'; $data['month_in_num']='9'; $data['confirm']=$v->confirm; $data['available_bal']=$September_credit-$September_debit; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($september_array); $september_array=array(); array_push($september_array,$data); } else if($month == '10') { $October_credit += $v->credit; $October_debit += $v->debit; $data['id']=$v->id; $data['credit']=$October_credit; $data['debit']=$October_debit; $data['month']='October'; $data['month_in_num']='10'; $data['confirm']=$v->confirm; $data['available_bal']=$October_credit-$October_debit; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($october_array); $october_array=array(); array_push($october_array,$data); } else if($month == '11') { $November_credit += $v->credit; $November_debit += $v->debit; $data['id']=$v->id; $data['credit']=$November_credit; $data['debit']=$November_debit; $data['month']='November'; $data['month_in_num']='11'; $data['confirm']=$v->confirm; $data['available_bal']=$November_credit-$November_debit; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($november_array); $november_array=array(); array_push($november_array,$data); } else if($month == '12') { $December_credit += $v->credit; $December_debit += $v->debit; $data['id']=$v->id; $data['credit']=$December_credit; $data['debit']=$December_debit; $data['month']='December'; $data['month_in_num']='12'; $data['confirm']=$v->confirm; $data['available_bal']=$December_credit-$December_debit; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($december_array); $december_array=array(); array_push($december_array,$data); } } } $datas1=array_merge($january_array,$febraury_array); $datas2=array_merge($datas1,$march_array); $datas3=array_merge($datas2,$april_array); $datas4=array_merge($datas3,$may_array); $datas5=array_merge($datas4,$june_array); $datas6=array_merge($datas5,$july_array); $datas7=array_merge($datas6,$august_array); $datas8=array_merge($datas7,$september_array); $datas9=array_merge($datas8,$october_array); $datas10=array_merge($datas9,$november_array); //array_push($return_array,$febraury_array,$january_array,$march_array,$april_array,$may_array,$june_array,$july_array,$august_array,$september_array,$october_array,$november_array,$december_array); array_push($return_array,$datas10); } $final_array=array(); if(!empty($return_array)) { foreach ($return_array as $ke => $val) { foreach ($val as $kes => $valf) { array_push($final_array,$valf); } } } return $final_array; } public function group_get_where_transaction($table,$where) { $this->db->select('A.*, A.id as a_id,B.*,B.name as b_name'); $this->db->from("transaction A"); $this->db->join("account_master B","B.id=A.account"); $this->db->where('B.delete_status','ACTIVE'); $this->db->where('A.delete_status','ACTIVE'); $query=$this->db->get(); return $query->result(); } public function update_status($array,$table,$data) { $this->db->where_in('id',$array); $this->db->update($table,$data); return $this->db->affected_rows(); } public function get_preview_data($month,$table) { $this->db->where_in('id',$month); $this->db->update($table); return $this->db->affected_rows(); } public function get_where_preview($month,$year) { $this->db->select('A.*, A.id as a_id,B.*,B.name as b_name'); $this->db->from("transaction A"); $this->db->join("account_master B","B.id=A.account"); $this->db->where('A.month_data',$month); $this->db->where('A.year_data',$year); $this->db->where('B.delete_status','ACTIVE'); $this->db->where('A.delete_status','ACTIVE'); $query = $this->db->get(); $res = $query->result(); return $res; } public function update_status_new($array,$table,$data) { $this->db->where($array); $this->db->update($table,$data); return $this->db->affected_rows(); } public function group_get_where_nandi_transaction($table,$where) { $this->db->select('A.*, A.id as a_id,B.*,B.name as b_name'); $this->db->from("nandi_transaction A"); $this->db->join("account_master B","B.id=A.account"); $this->db->where('B.delete_status','ACTIVE'); $this->db->where('A.delete_status','ACTIVE'); $this->db->order_by('A.id','desc'); $query=$this->db->get(); return $query->result(); } public function get_nandi_transaction_details($table,$where) { $this->db->select('A.*'); $this->db->from('nandi_transaction A'); $this->db->join('account_master B','B.id=A.account'); $this->db->where('A.delete_status','ACTIVE'); $this->db->where('B.delete_status','ACTIVE'); $this->db->group_by(array('A.year_data')); $query_new=$this->db->get(); $result_new= $query_new->result(); $return_array=array(); foreach ($result_new as $keys => $val) { $January_credit = 0; $January_debit = 0; $January_bal = 0; $Febraury_credit =0; $Febraury_debit =0; $Febraury_bal = 0; $March_credit =0; $March_debit =0; $March_bal = 0; $April_credit =0; $April_debit =0; $April_bal = 0; $May_credit=0; $May_debit =0; $May_bal = 0; $June_credit =0; $June_debit =0; $June_bal = 0; $July_credit =0; $July_debit =0; $July_bal = 0; $August_credit=0; $August_debit =0; $August_bal = 0; $September_credit=0; $September_debit =0; $September_bal = 0; $October_credit=0; $October_debit =0; $October_bal = 0; $November_credit=0; $November_debit =0; $November_bal = 0; $December_credit=0; $December_debit =0; $December_bal = 0; $january_array=array(); $febraury_array=array(); $march_array=array(); $april_array=array(); $may_array=array(); $june_array=array(); $july_array=array(); $august_array=array(); $september_array=array(); $october_array=array(); $november_array=array(); $december_array=array(); $this->db->select('C.*'); $this->db->from('nandi_transaction C'); $this->db->join('account_master D','D.id=C.account'); $this->db->where('C.delete_status','ACTIVE'); $this->db->where('D.delete_status','ACTIVE'); //$this->db->where('C.month_data',$val->month_data); $this->db->where('C.year_data',$val->year_data); $query=$this->db->get(); $result= $query->result(); if(!empty($result)) { foreach ($result as $k => $v) { if($v->month_data == '1') { $January_credit += $v->credit; $January_debit += $v->debit; $data['id']=$v->id; $data['credit']=$January_credit; $data['debit']=$January_debit; if($December_bal==0) { $January_bal=($January_credit-$January_debit); } else if($January_credit==0) { $January_bal=$December_bal-$January_debit; } else { $January_bal=$December_bal-($January_credit-$January_debit); } $data['available_bal']=$January_bal; $data['month']='January'; $data['month_in_num']='01'; $data['confirm']=$v->confirm; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($january_array); $january_array=array(); array_push($january_array,$data); } else if($v->month_data == '2') { $Febraury_credit += $v->credit; $Febraury_debit += $v->debit; $data['id']=$v->id; $data['credit']=$Febraury_credit; $data['debit']=$Febraury_debit; if($January_bal==0) { $Febraury_bal=($Febraury_credit-$Febraury_debit); } else if($Febraury_credit==0) { $Febraury_bal=$January_bal-$Febraury_debit; } else { $Febraury_bal=$January_bal-($Febraury_credit-$Febraury_debit); } $data['available_bal']=$Febraury_bal; $data['month']='Febraury'; $data['month_in_num']='02'; $data['confirm']=$v->confirm; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($febraury_array); $febraury_array=array(); array_push($febraury_array,$data); } else if($v->month_data == '3') { $March_credit += $v->credit; $March_debit += $v->debit; $data['id']=$v->id; $data['credit']=$March_credit; $data['debit']=$March_debit; $data['month']='March'; $data['month_in_num']='3'; $data['confirm']=$v->confirm; if($Febraury_bal==0) { $March_bal=($March_credit-$March_debit); } else if($March_credit==0) { $March_bal=$Febraury_bal-$March_debit; } else { $March_bal=$Febraury_bal-($March_credit-$March_debit); } $data['available_bal']=$March_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($march_array); $march_array=array(); array_push($march_array,$data); } else if($v->month_data == '4') { $April_credit += $v->credit; $April_debit += $v->debit; $data['id']=$v->id; $data['credit']=$April_credit; $data['debit']=$April_debit; $data['month']='April'; $data['month_in_num']='4'; $data['confirm']=$v->confirm; if($March_bal==0) { $April_bal=($April_credit-$April_debit); } else if($April_credit==0) { $April_bal=$March_bal-$April_debit; } else { $April_bal=$March_bal-($April_credit-$April_debit); } $data['available_bal']=$April_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($april_array); $april_array=array(); array_push($april_array,$data); } else if($v->month_data == '05') { $May_credit += $v->credit; $May_debit += $v->debit; $data['id']=$v->id; $data['credit']=$May_credit; $data['debit']=$May_debit; $data['month']='May'; $data['month_in_num']='5'; $data['confirm']=$v->confirm; if($April_bal==0) { $May_bal=($May_credit-$May_debit); } else if($May_credit==0) { $May_bal=$April_bal-$May_debit; } else { $May_bal=$April_bal-($May_credit-$May_debit); } $data['available_bal']=$May_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($may_array); $may_array=array(); array_push($may_array,$data); } else if($v->month_data == '06') { $June_credit += $v->credit; $June_debit += $v->debit; $data['id']=$v->id; $data['credit']=$June_credit; $data['debit']=$June_debit; $data['month']='June'; $data['month_in_num']='6'; $data['confirm']=$v->confirm; if($May_bal==0) { $June_bal=($June_credit-$June_debit); } else if($June_credit==0) { $June_bal=$May_bal-$June_debit; } else { $June_bal=$May_bal-($June_credit-$June_debit); } $data['available_bal']=$June_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($june_array); $june_array=array(); array_push($june_array,$data); } else if($v->month_data == '07') { $July_credit += $v->credit; $July_debit += $v->debit; $data['id']=$v->id; $data['credit']=$July_credit; $data['debit']=$July_debit; $data['month']='July'; $data['month_in_num']='7'; $data['confirm']=$v->confirm; if($June_bal==0) { $July_bal=($July_credit-$July_debit); } else if($July_credit==0) { $July_bal=$June_bal-$July_debit; } else { $July_bal=$June_bal-($July_credit-$July_debit); } $data['available_bal']=$July_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($july_array); $july_array=array(); array_push($july_array,$data); } else if($v->month_data == '8') { $August_credit += $v->credit; $August_debit += $v->debit; $data['id']=$v->id; $data['credit']=$August_credit; $data['debit']=$August_debit; $data['month']='August'; $data['month_in_num']='8'; $data['confirm']=$v->confirm; if($July_bal==0) { $August_bal=($August_credit-$August_debit); } else if($August_credit==0) { $August_bal=$July_bal-$August_debit; } else { $August_bal=$July_bal-($August_credit-$August_debit); } $data['available_bal']=$August_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($august_array); $august_array=array(); array_push($august_array,$data); } else if($v->month_data == '9') { $September_credit += $v->credit; $September_debit += $v->debit; $data['id']=$v->id; $data['credit']=$September_credit; $data['debit']=$September_debit; $data['month']='September'; $data['month_in_num']='9'; $data['confirm']=$v->confirm; if($August_bal==0) { $September_bal=($September_credit-$September_debit); } else if($September_credit==0) { $September_bal=$August_bal-$September_debit; } else { $September_bal=$August_bal-($September_credit-$September_debit); } $data['available_bal']=$September_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($september_array); $september_array=array(); array_push($september_array,$data); } else if($v->month_data == '10') { $October_credit += $v->credit; $October_debit += $v->debit; $data['id']=$v->id; $data['credit']=$October_credit; $data['debit']=$October_debit; $data['month']='October'; $data['month_in_num']='10'; $data['confirm']=$v->confirm; if($September_bal==0) { $October_bal=($October_credit-$October_debit); } else if($October_credit==0) { $October_bal=$September_bal-$October_debit; } else { $October_bal=$September_bal-($October_credit-$October_debit); } $data['available_bal']=$October_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($october_array); $october_array=array(); array_push($october_array,$data); } else if($v->month_data == '11') { $November_credit += $v->credit; $November_debit += $v->debit; $data['id']=$v->id; $data['credit']=$November_credit; $data['debit']=$November_debit; $data['month']='November'; $data['month_in_num']='11'; $data['confirm']=$v->confirm; if($October_bal==0) { $November_bal=($November_credit-$November_debit); } else if($November_credit==0) { $November_bal=$October_bal-$November_debit; } else { $November_bal=$October_bal-($November_credit-$November_debit); } $data['available_bal']=$November_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($november_array); $november_array=array(); array_push($november_array,$data); } else if($v->month_data == '12') { $December_credit += $v->credit; $December_debit += $v->debit; $data['id']=$v->id; $data['credit']=$December_credit; $data['debit']=$December_debit; $data['month']='December'; $data['month_in_num']='12'; $data['confirm']=$v->confirm; if($November_bal==0) { $December_bal=($December_credit-$December_debit); } else if($December_credit==0) { $December_bal=$November_bal-$December_debit; } else { $December_bal=$November_bal-($December_credit-$December_debit); } $data['available_bal']=$December_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($december_array); $december_array=array(); array_push($december_array,$data); } } } $datas1=array_merge($january_array,$febraury_array); $datas2=array_merge($datas1,$march_array); $datas3=array_merge($datas2,$april_array); $datas4=array_merge($datas3,$may_array); $datas5=array_merge($datas4,$june_array); $datas6=array_merge($datas5,$july_array); $datas7=array_merge($datas6,$august_array); $datas8=array_merge($datas7,$september_array); $datas9=array_merge($datas8,$october_array); $datas10=array_merge($datas9,$november_array); $datas11=array_merge($datas10,$december_array); //array_push($return_array,$febraury_array,$january_array,$march_array,$april_array,$may_array,$june_array,$july_array,$august_array,$september_array,$october_array,$november_array,$december_array); array_push($return_array,$datas11); } $final_array=array(); if(!empty($return_array)) { foreach ($return_array as $ke => $val) { foreach ($val as $kes => $valf) { array_push($final_array,$valf); } } } return $final_array; } public function get_where_nandi_preview($month,$year) { $this->db->select('A.*, A.id as a_id,B.*,B.name as b_name,A.created_by as created'); $this->db->from("nandi_transaction A"); $this->db->join("account_master B","B.id=A.account"); $this->db->where('A.month_data',$month); $this->db->where('A.year_data',$year); $this->db->where('B.delete_status','ACTIVE'); $this->db->where('A.delete_status','ACTIVE'); $query = $this->db->get(); $res = $query->result(); return $res; } public function get_where_nandi_preview_download($month,$year) { $this->db->select('A.*, A.id as a_id,B.*,B.name as b_name,A.created_by as created,SUM(A.debit) as tot_debit,SUM(A.credit) as tot_credit'); $this->db->from("nandi_transaction A"); $this->db->join("account_master B","B.id=A.account"); $this->db->where('A.month_data',$month); $this->db->where('A.year_data',$year); $this->db->where('B.delete_status','ACTIVE'); $this->db->where('A.delete_status','ACTIVE'); $query = $this->db->get(); $res = $query->result(); return $res; } public function get_where_nandi_preview_sum($month,$year) { $this->db->select('SUM(A.debit) as debit,SUM(A.credit)as credit'); $this->db->from("nandi_transaction A"); $this->db->join("account_master B","B.id=A.account"); $this->db->where('A.month_data',$month); $this->db->where('A.year_data',$year); $this->db->where('B.delete_status','ACTIVE'); $this->db->where('A.delete_status','ACTIVE'); $query = $this->db->get(); $res = $query->row(); return $res; } public function group_get_where_tailoring_transaction($table,$where) { $this->db->select('A.*, A.id as a_id,B.*,B.name as b_name'); $this->db->from("tailoring_transaction A"); $this->db->join("account_master B","B.id=A.account"); $this->db->where('B.delete_status','ACTIVE'); $this->db->where('A.delete_status','ACTIVE'); $this->db->order_by('A.id','desc'); $query=$this->db->get(); return $query->result(); } public function get_where_tailoring_preview($month,$year) { $this->db->select('A.*, A.id as a_id,B.*,B.name as b_name,A.created_by as created'); $this->db->from("tailoring_transaction A"); $this->db->join("account_master B","B.id=A.account"); $this->db->where('A.month_data',$month); $this->db->where('A.year_data',$year); $this->db->where('B.delete_status','ACTIVE'); $this->db->where('A.delete_status','ACTIVE'); $query = $this->db->get(); $res = $query->result(); return $res; } /* public function get_where_tailoring_preview($month,$year) { $this->db->select('A.*, A.id as a_id,B.*,B.name as b_name'); $this->db->from("tailoring_transaction A"); $this->db->join("account_master B","B.id=A.account"); $this->db->where('A.month_data',$month); $this->db->where('A.year_data',$year); $this->db->where('B.delete_status','ACTIVE'); $this->db->where('A.delete_status','ACTIVE'); $query = $this->db->get(); $res = $query->result(); $array = array(); foreach($res as $val) { $data['b_name'] = $val->b_name; $data['narration'] = $val->narration; $data['debit'] = $val->debit; $data['credit'] = $val->credit; $data['transaction_date'] = $val->transaction_date; $data['created_by'] = $val->created_by; $data['created_at'] = $val->created_at; array_push($array,$data); } //print_r($array);die(); $new_array = $array[0]; return $new_array; }*/ public function get_tailer_transaction_details($table,$where) { $this->db->select('A.*'); $this->db->from('tailoring_transaction A'); $this->db->join('account_master B','B.id=A.account'); $this->db->where('A.delete_status','ACTIVE'); $this->db->where('B.delete_status','ACTIVE'); $this->db->group_by(array('A.year_data')); $query_new=$this->db->get(); $result_new= $query_new->result(); $return_array=array(); foreach ($result_new as $keys => $val) { $January_credit = 0; $January_debit = 0; $January_bal = 0; $Febraury_credit =0; $Febraury_debit =0; $Febraury_bal = 0; $March_credit =0; $March_debit =0; $March_bal = 0; $April_credit =0; $April_debit =0; $April_bal = 0; $May_credit=0; $May_debit =0; $May_bal = 0; $June_credit =0; $June_debit =0; $June_bal = 0; $July_credit =0; $July_debit =0; $July_bal = 0; $August_credit=0; $August_debit =0; $August_bal = 0; $September_credit=0; $September_debit =0; $September_bal = 0; $October_credit=0; $October_debit =0; $October_bal = 0; $November_credit=0; $November_debit =0; $November_bal = 0; $December_credit=0; $December_debit =0; $December_bal = 0; $january_array=array(); $febraury_array=array(); $march_array=array(); $april_array=array(); $may_array=array(); $june_array=array(); $july_array=array(); $august_array=array(); $september_array=array(); $october_array=array(); $november_array=array(); $december_array=array(); $this->db->select('C.*'); $this->db->from('tailoring_transaction C'); $this->db->join('account_master D','D.id=C.account'); $this->db->where('C.delete_status','ACTIVE'); $this->db->where('D.delete_status','ACTIVE'); //$this->db->where('C.month_data',$val->month_data); $this->db->where('C.year_data',$val->year_data); $query=$this->db->get(); $result= $query->result(); if(!empty($result)) { foreach ($result as $k => $v) { if($v->month_data == '1') { $January_credit += $v->credit; $January_debit += $v->debit; $data['id']=$v->id; $data['credit']=$January_credit; $data['debit']=$January_debit; if($December_bal==0) { $January_bal=($January_credit-$January_debit); } else if($January_credit==0) { $January_bal=$December_bal-$January_debit; } else { $January_bal=$December_bal-($January_credit-$January_debit); } $data['available_bal']=$January_bal; $data['month']='January'; $data['month_in_num']='01'; $data['confirm']=$v->confirm; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($january_array); $january_array=array(); array_push($january_array,$data); } else if($v->month_data == '2') { $Febraury_credit += $v->credit; $Febraury_debit += $v->debit; $data['id']=$v->id; $data['credit']=$Febraury_credit; $data['debit']=$Febraury_debit; if($January_bal==0) { $Febraury_bal=($Febraury_credit-$Febraury_debit); } else if($Febraury_credit==0) { $Febraury_bal=$January_bal-$Febraury_debit; } else { $Febraury_bal=$January_bal-($Febraury_credit-$Febraury_debit); } $data['available_bal']=$Febraury_bal; $data['month']='Febraury'; $data['month_in_num']='02'; $data['confirm']=$v->confirm; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($febraury_array); $febraury_array=array(); array_push($febraury_array,$data); } else if($v->month_data == '3') { $March_credit += $v->credit; $March_debit += $v->debit; $data['id']=$v->id; $data['credit']=$March_credit; $data['debit']=$March_debit; $data['month']='March'; $data['month_in_num']='3'; $data['confirm']=$v->confirm; if($Febraury_bal==0) { $March_bal=($March_credit-$March_debit); } else if($March_credit==0) { $March_bal=$Febraury_bal-$March_debit; } else { $March_bal=$Febraury_bal-($March_credit-$March_debit); } $data['available_bal']=$March_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($march_array); $march_array=array(); array_push($march_array,$data); } else if($v->month_data == '4') { $April_credit += $v->credit; $April_debit += $v->debit; $data['id']=$v->id; $data['credit']=$April_credit; $data['debit']=$April_debit; $data['month']='April'; $data['month_in_num']='4'; $data['confirm']=$v->confirm; if($March_bal==0) { $April_bal=($April_credit-$April_debit); } else if($April_credit==0) { $April_bal=$March_bal-$April_debit; } else { $April_bal=$March_bal-($April_credit-$April_debit); } $data['available_bal']=$April_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($april_array); $april_array=array(); array_push($april_array,$data); } else if($v->month_data == '05') { $May_credit += $v->credit; $June_debit += $v->debit; $data['id']=$v->id; $data['credit']=$May_credit; $data['debit']=$June_debit; $data['month']='May'; $data['month_in_num']='5'; $data['confirm']=$v->confirm; if($April_bal==0) { $May_bal=($May_credit-$May_debit); } else if($May_credit==0) { $May_bal=$April_bal-$May_debit; } else { $May_bal=$April_bal-($May_credit-$May_debit); } $data['available_bal']=$May_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($may_array); $may_array=array(); array_push($may_array,$data); } else if($v->month_data == '06') { $June_credit += $v->credit; $July_debit += $v->debit; $data['id']=$v->id; $data['credit']=$June_credit; $data['debit']=$July_debit; $data['month']='June'; $data['month_in_num']='6'; $data['confirm']=$v->confirm; if($May_bal==0) { $June_bal=($June_credit-$June_debit); } else if($June_credit==0) { $June_bal=$May_bal-$June_debit; } else { $June_bal=$May_bal-($June_credit-$June_debit); } $data['available_bal']=$June_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($june_array); $june_array=array(); array_push($june_array,$data); } else if($v->month_data == '07') { $July_credit += $v->credit; $January_debit += $v->debit; $data['id']=$v->id; $data['credit']=$July_credit; $data['debit']=$January_debit; $data['month']='July'; $data['month_in_num']='7'; $data['confirm']=$v->confirm; if($June_bal==0) { $July_bal=($July_credit-$July_debit); } else if($July_credit==0) { $July_bal=$June_bal-$July_debit; } else { $July_bal=$June_bal-($July_credit-$July_debit); } $data['available_bal']=$July_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($july_array); $july_array=array(); array_push($july_array,$data); } else if($v->month_data == '8') { $August_credit += $v->credit; $August_debit += $v->debit; $data['id']=$v->id; $data['credit']=$August_credit; $data['debit']=$August_debit; $data['month']='August'; $data['month_in_num']='8'; $data['confirm']=$v->confirm; if($July_bal==0) { $August_bal=($August_credit-$August_debit); } else if($August_credit==0) { $August_bal=$July_bal-$August_debit; } else { $August_bal=$July_bal-($August_credit-$August_debit); } $data['available_bal']=$August_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($august_array); $august_array=array(); array_push($august_array,$data); } else if($v->month_data == '9') { $September_credit += $v->credit; $September_debit += $v->debit; $data['id']=$v->id; $data['credit']=$September_credit; $data['debit']=$September_debit; $data['month']='September'; $data['month_in_num']='9'; $data['confirm']=$v->confirm; if($August_bal==0) { $September_bal=($September_credit-$September_debit); } else if($September_credit==0) { $September_bal=$August_bal-$September_debit; } else { $September_bal=$August_bal-($September_credit-$September_debit); } $data['available_bal']=$September_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($september_array); $september_array=array(); array_push($september_array,$data); } else if($v->month_data == '10') { $October_credit += $v->credit; $October_debit += $v->debit; $data['id']=$v->id; $data['credit']=$October_credit; $data['debit']=$October_debit; $data['month']='October'; $data['month_in_num']='10'; $data['confirm']=$v->confirm; if($September_bal==0) { $October_bal=($October_credit-$October_debit); } else if($October_credit==0) { $October_bal=$September_bal-$October_debit; } else { $October_bal=$September_bal-($October_credit-$October_debit); } $data['available_bal']=$October_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($october_array); $october_array=array(); array_push($october_array,$data); } else if($v->month_data == '11') { $November_credit += $v->credit; $November_debit += $v->debit; $data['id']=$v->id; $data['credit']=$November_credit; $data['debit']=$November_debit; $data['month']='November'; $data['month_in_num']='11'; $data['confirm']=$v->confirm; if($October_bal==0) { $November_bal=($November_credit-$November_debit); } else if($November_credit==0) { $November_bal=$October_bal-$November_debit; } else { $November_bal=$October_bal-($November_credit-$November_debit); } $data['available_bal']=$November_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($november_array); $november_array=array(); array_push($november_array,$data); } else if($v->month_data == '12') { $December_credit += $v->credit; $December_debit += $v->debit; $data['id']=$v->id; $data['credit']=$December_credit; $data['debit']=$December_debit; $data['month']='December'; $data['month_in_num']='12'; $data['confirm']=$v->confirm; if($November_bal==0) { $December_bal=($December_credit-$December_debit); } else if($December_credit==0) { $December_bal=$November_bal-$December_debit; } else { $December_bal=$November_bal-($December_credit-$December_debit); } $data['available_bal']=$December_bal; $data['year']=$v->year_data; $data['approved_by']=$v->approved_by; $data['year_data']=$v->year_data; $data['month_data']=$v->month_data; unset($december_array); $december_array=array(); array_push($december_array,$data); } } } $datas1=array_merge($january_array,$febraury_array); $datas2=array_merge($datas1,$march_array); $datas3=array_merge($datas2,$april_array); $datas4=array_merge($datas3,$may_array); $datas5=array_merge($datas4,$june_array); $datas6=array_merge($datas5,$july_array); $datas7=array_merge($datas6,$august_array); $datas8=array_merge($datas7,$september_array); $datas9=array_merge($datas8,$october_array); $datas10=array_merge($datas9,$november_array); $datas11=array_merge($datas10,$december_array); //array_push($return_array,$febraury_array,$january_array,$march_array,$april_array,$may_array,$june_array,$july_array,$august_array,$september_array,$october_array,$november_array,$december_array); array_push($return_array,$datas11); } $final_array=array(); if(!empty($return_array)) { foreach ($return_array as $ke => $val) { foreach ($val as $kes => $valf) { array_push($final_array,$valf); } } } return $final_array; } public function getgoods_data_fabric($i,$po_no) { $this->db->select("indent_po.*,indent_goods_details.shades po_shade,sum(indent_goods_details.rec_goods) as rec_goods,indent_goods_details.width po_width"); $this->db->from('indent_po'); $this->db->join('indent_goods_details', 'indent_po.id = indent_goods_details.po_list_id','left'); $this->db->where('indent_po.po_id',$i); $this->db->where('indent_po.po_no',$po_no); $this->db->where('indent_po.department !=', ' '); $this->db->group_by('indent_po.indent_id'); $query = $this->db->get(); return $query->result(); } public function update($where,$table,$data) { $this->db->where($where); $this->db->update($table,$data); return $this->db->affected_rows(); } public function fetch_where_subgrid_data_product($id) { $this->db->select("indent_add_indent.add_product"); $this->db->from('indent_po'); $this->db->join('indent_add_indent', 'indent_add_indent.id= indent_po.indent_id'); $this->db->where('indent_po.id',$id); $query = $this->db->get(); return $query->row(); } public function updt_stat($input,$where){ $this->db->where($where); $this->db->update('indent_po', $input); $this->db->order_by('required_on','desc'); } public function updt_statwo($input,$where){ $this->db->where('work_order_dyeing.issue_no',$where); $this->db->update('work_order_dyeing', $input); // print_r($this->db->last_query()); // die(); $this->db->order_by('required_on','desc'); } public function get_purchase_11($table,$where) { $this->db->select('*'); $this->db->from(product_details); $query=$this->db->get(); return $query->result(); } public function get_hscode($customerID,$design,$width,$shade,$article,$buyershade) { $this->db->select('hs_code,dbk_si,customs_declaration,p_category'); $this->db->from('product_details'); $this->db->where('customer_id',$customerID); $this->db->where('design',$design); $this->db->where('width',$width); $this->db->where('articleNo',$article); $query = $this->db->get(); return $query->row(); //echo 'helo'; } public function get_hscode_fabric($customerID,$article,$width) { $this->db->select('hs_code,dbk_si,customs_declaration,p_category'); $this->db->from('product_details'); $this->db->where('customer_id',$customerID); $this->db->where('articleNo',$article); $this->db->where('width',$width); $query = $this->db->get(); return $query->row(); //echo 'helo'; } public function get_distict_where_data($table,$where) { $this->db->select('orderNo'); $this->db->group_by('orderNo'); $this->db->order_by('id','asc'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function get_distict_dtl_where_data($table,$where) { $this->db->select('osl_no'); $this->db->group_by('osl_no'); $this->db->order_by('id','asc'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function get_hsn_code($table,$where) { $this->db->select('hsn_code'); $this->db->group_by('hsn_code'); $this->db->order_by('id','asc'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function get_dbk_code($table,$where) { $this->db->select('dbk_si'); //$this->db->group_by('dbk_si'); //$this->db->order_by('id','asc'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function get_dbk_desc($table,$where) { $this->db->select('dbk_desc'); //$this->db->group_by('dbk_desc'); //$this->db->order_by('id','asc'); $this->db->from($table); $this->db->where($where); $query=$this->db->get(); return $query->result(); } public function get_custom_desc($article,$width) { $this->db->select('A.custom_description'); $this->db->from('product_details A'); $this->db->where('A.articleNo',$article); $this->db->where('A.width',$width); $query=$this->db->get(); return $query->row(); } public function fetch_name_image($table,$where){ $this->db->select('uploaded_files'); $this->db->from($table); $this->db->where($where); $query = $this->db->get(); $ret = $query->row(); return $ret->uploaded_files; } public function get_user_type_id($user_id) { $this->db->select('user_type_id'); $this->db->from('employee_details'); $this->db->where('id', $user_id); $query = $this->db->get(); if ($query->num_rows() > 0) { return $query->row()->user_type_id; } return null; // or handle error as needed } public function get_menu_url($menu_id) { $this->db->select('reference_url'); $this->db->from('swansilk_menu'); $this->db->where('menu_id', $menu_id); $query = $this->db->get(); if ($query->num_rows() > 0) { return $query->row()->reference_url; } return null; // or handle error as needed } public function count_unread_chats($to_id) { $this->db->where('unread', '0'); $this->db->where('to_id', $to_id); $this->db->from('chat_message'); return $this->db->count_all_results(); } } ?>