db->select('invoice_number'); $this->db->from('ip_invoices'); $result = $this->db->get(); return $result->result(); } function getAllprodcuts() { $this->db->select('product_id,product_name,product_description'); $this->db->from('ip_products'); $result = $this->db->get(); return $result->result(); } function getAllprodcutsInward() { $this->db->select('MaterialCode,MaterialName'); $this->db->from('T_MaterialMaster'); $this->db->like('T_MaterialMaster.Category','raw material'); $result = $this->db->get(); return $result->result(); } function getAllcustomers() { $this->db->select('client_id,client_name'); $this->db->from('ip_clients'); $result = $this->db->get(); return $result->result(); } function getAllcustomersInward() { $this->db->select('SupplierID,SupplierName'); $this->db->from('T_SupplierDetailsN'); $this->db->where('IsActive',1); $result = $this->db->get(); return $result->result(); } function checkExist($product,$customer,$name,$type) { $this->db->select('count(*) as count'); $this->db->from('T_Prodcut_Specification_Master'); $this->db->where('product_id',$product); $this->db->where('customer_id',$customer); $this->db->where('testtype',$name); $this->db->where('type',$type); $result = $this->db->get(); return $result->result(); } function addSpecMast($data) { //print_r($data); $this->db->insert('T_Prodcut_Specification_Master',$data); $r = $this->db->affected_rows(); return $r; } function updateSpecMast($data,$product,$customer,$name,$type) { //echo $product.$customer.$name; //print_r($data); $this->db->where('product_id',$product); $this->db->where('customer_id',$customer); $this->db->where('testtype',$name); $this->db->where('type',$type); $this->db->update('T_Prodcut_Specification_Master',$data); $r = $this->db->affected_rows(); //echo $r;die(); return $r; } function getAllspec() { $this->db->select('T_Prodcut_Specification_Master.*,ip_products.product_name,ip_products.product_description,ip_clients.client_name,count(*) as count'); $this->db->from('T_Prodcut_Specification_Master'); $this->db->join('ip_products','T_Prodcut_Specification_Master.product_id=ip_products.product_id'); $this->db->join('ip_clients','T_Prodcut_Specification_Master.customer_id=ip_clients.client_id'); $this->db->group_by('product_id,customer_id,T_Prodcut_Specification_Master.type'); $result = $this->db->get(); return $result->result(); } function getAllspecInward() { $this->db->select('T_Prodcut_Specification_Master.*,T_MaterialMaster.MaterialCode,T_MaterialMaster.MaterialName,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,count(*) as count'); $this->db->from('T_Prodcut_Specification_Master'); $this->db->join('T_MaterialMaster','T_Prodcut_Specification_Master.product_id=T_MaterialMaster.MaterialCode'); $this->db->join('T_SupplierDetailsN','T_Prodcut_Specification_Master.customer_id=T_SupplierDetailsN.SupplierID'); $this->db->group_by('product_id,customer_id,T_Prodcut_Specification_Master.type'); $result = $this->db->get(); return $result->result(); } function getIndividualSpec($prodcutid,$customerid,$type) { $this->db->select('T_Prodcut_Specification_Master.*,ip_products.product_name,ip_products.product_description,ip_clients.client_name'); $this->db->from('T_Prodcut_Specification_Master'); $this->db->join('ip_products','T_Prodcut_Specification_Master.product_id=ip_products.product_id'); $this->db->join('ip_clients','T_Prodcut_Specification_Master.customer_id=ip_clients.client_id'); $this->db->where('T_Prodcut_Specification_Master.product_id',$prodcutid); $this->db->where('T_Prodcut_Specification_Master.customer_id',$customerid); $this->db->where('T_Prodcut_Specification_Master.type',$type); $result = $this->db->get(); //print_r($result->result()); if(empty($result->result())) { $this->db->select('T_Prodcut_Specification_Master.*,T_MaterialMaster.MaterialCode,T_MaterialMaster.MaterialName as product_name,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName as client_name'); $this->db->from('T_Prodcut_Specification_Master'); $this->db->join('T_MaterialMaster','T_Prodcut_Specification_Master.product_id=T_MaterialMaster.MaterialCode'); $this->db->join('T_SupplierDetailsN','T_Prodcut_Specification_Master.customer_id=T_SupplierDetailsN.SupplierID'); $this->db->where('T_Prodcut_Specification_Master.product_id',$prodcutid); $this->db->where('T_Prodcut_Specification_Master.customer_id',$customerid); $this->db->where('T_Prodcut_Specification_Master.type',$type); $result = $this->db->get(); } //exit(); return $result->result(); } function deleteSpecification($spname,$product,$customer,$type) { $this->db->where("testtype", $spname); $this->db->where("product_id", $product); $this->db->where("customer_id", $customer); $this->db->where("type", $type); $this->db->delete('T_Prodcut_Specification_Master'); $r = $this->db->affected_rows(); return $r; } function getDataforReport() { $this->db->select('ip_invoices.invoice_number,ip_invoices.client_id,ip_invoice_custom.invoice_custom_fieldvalue,ip_clients.client_name,ip_invoices.invoice_date_created,ip_invoice_items.item_product_id,ip_products.product_name,ip_products.product_description,ip_invoice_items.item_quantity'); $this->db->from('ip_invoices'); $this->db->join('ip_clients','ip_invoices.client_id=ip_clients.client_id'); $this->db->join('ip_invoice_items','ip_invoices.invoice_id=ip_invoice_items.invoice_id'); $this->db->join('ip_products','ip_invoice_items.item_product_id=ip_products.product_id'); $this->db->join('ip_invoice_custom','ip_invoices.invoice_id=ip_invoice_custom.invoice_id and invoice_custom_fieldid=62'); $this->db->where('ip_invoices.invoice_number NOT IN (SELECT invoiceid from T_Test_Report_Master where invoiceid is not null)',NULL,false); $this->db->order_by('ip_invoices.invoice_number','desc'); $res = $this->db->get(); //print_r($res->result());die(); return $res->result(); } function getSpecifications($productid,$customerid,$ttype="") { //echo 'from model'.$productid.'-'.$customerid; // $this->db->where('product_id',$productid); // $this->db->where('customer_id',$customerid); // $res = $this->db->get('T_Prodcut_Specification_Master'); $sql =''; $res = ""; if(!empty($ttype)) { $sql = "Select * from T_Prodcut_Specification_Master where product_id = ? and customer_id = ? and type = ?"; $res = $this->db->query($sql,array($productid,$customerid,$ttype)); } else { $sql = "Select * from T_Prodcut_Specification_Master where product_id = ? and customer_id = ?"; $res = $this->db->query($sql,array($productid,$customerid)); } // print_r($this->db->last_query()); return $res->result(); //print_r($res->result()); } function getOperatorsListforReport() { $r = $this->db->select('EmpID,FirstName,LastName')->from('T_Employee_Details')->get(); return $r->result(); } function getExistOperatorsListforReport($rbcid) { $sql = "select T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName from T_ResinBatchCard_Operators join T_Employee_Details on T_ResinBatchCard_Operators.EmpID = T_Employee_Details.EmpID where T_ResinBatchCard_Operators.master_id = ?"; $r = $this->db->query($sql,array($rbcid)); return $r->result(); } function getEmplistforReport() { $this->db->select('T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,T_Employee_Details.Departmentcode,T_DepartmentDetails.shortName,'); $this->db->from('T_Employee_Details'); $this->db->join('T_DepartmentDetails','T_Employee_Details.Departmentcode=T_DepartmentDetails.DEPCode'); //$this->db->join('ip_invoice_items','ip_invoices.invoice_number=ip_invoice_items.invoice_number'); //$this->db->join('ip_products','ip_invoice_items.item_product_id=ip_products.product_id'); //$this->db->join('ip_invoice_custom','ip_invoices.invoice_number=ip_invoice_custom.invoice_number and invoice_custom_fieldid=62'); $this->db->order_by('T_Employee_Details.EmpID'); $res = $this->db->get(); return $res->result(); } function saveMasterTestData($masterreportdata) { $this->db->insert('T_Test_Report_Master',$masterreportdata); $id = $this->db->insert_id(); return $id; } function saveResinBatchCardMasterTestData($masterreportdata) { $this->db->insert('T_ResinBatchCard_Master',$masterreportdata); $id = $this->db->insert_id(); return $id; } function updateResinBatchCardChildTestData($newArray) { $this->db->select('resinbatchcard_iter_id'); $this->db->from('T_ResinBatchCard_Child'); $this->db->where('master_report_id',$newArray['master_report_id']); $this->db->where('i_time',$newArray['i_time']); $this->db->where('spec_id',$newArray['spec_id']); $res = $this->db->get(); $res = $res->result(); if(!empty($res[0]->resinbatchcard_iter_id)) { $this->db->where('master_report_id',$newArray['master_report_id']); $this->db->where('i_time',$newArray['i_time']); $this->db->where('spec_id',$newArray['spec_id']); $this->db->update('T_ResinBatchCard_Child',$newArray); } else { $this->saveResinBatchCardChildTestData($newArray); } } function saveResinBatchCardChildTestData($newArray) { $this->db->insert('T_ResinBatchCard_Child',$newArray); } function updateResinBatchCardMasterTestData($masterreportdata,$MASTERID) { $this->db->where('resinbatch_id',$MASTERID); $this->db->update('T_ResinBatchCard_Master',$masterreportdata); } function getResinBatchCardDetails($rbcid) { $sql = 'select T_ResinBatchCard_Master.*,ip_products.product_name,ip_products.product_description,ip_clients.client_name,T_Machine_Master.Machine_Name,T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName,a.FirstName as name from T_ResinBatchCard_Master join ip_products on T_ResinBatchCard_Master.productid = ip_products.product_id join ip_clients on T_ResinBatchCard_Master.customerid = ip_clients.client_id join T_Machine_Master on T_ResinBatchCard_Master.machinecode = T_Machine_Master.Machine_Code join tbl_users on T_ResinBatchCard_Master.createdby = tbl_users.userId join T_Employee_Details on tbl_users.EmpID = T_Employee_Details.EmpID join T_Employee_Details as a on a.EmpID = T_ResinBatchCard_Master.operatedby where T_ResinBatchCard_Master.resinbatch_id = ?'; $res['masterdata'] = $this->db->query($sql,array($rbcid))->result(); //print_r($res['masterdata']); $sql = 'select T_ResinBatchCard_Child.*,T_Prodcut_Specification_Master.testtype from T_ResinBatchCard_Child join T_Prodcut_Specification_Master on T_ResinBatchCard_Child.spec_id = T_Prodcut_Specification_Master.productspecmaster_id where master_report_id = ?;'; $res['childdata'] = $this->db->query($sql,array($rbcid))->result(); $sid = ''; //print_r($res['childdata']); $index = 0; $newArray = array(); $allspecs = array('TEST'); foreach($res['childdata'] as $c) { if($sid != $c->i_time) { $index++; $newArray[$index] = array($c->i_time,$c->spec_value); if($index == 1){ array_push($allspecs,strtolower($c->testtype)); } } else { array_push($newArray[$index],$c->spec_value); if($index == 1){ array_push($allspecs,strtolower($c->testtype)); } } $sid = $c->i_time; } $res['childdata'] = $newArray; //print_r($res['childdata']); $res['allspec'] = $allspecs; return $res; } function getResinBatchCardTestMasterList() { $sql = 'Select resinbatch_id,productid,ip_products.product_name,ip_products.product_description,customerid,client_name,batchdate,igrno,igrlineno,operatedby,T_ResinBatchCard_Master.createdby,approvedby,document,ED.FirstName from T_ResinBatchCard_Master join ip_products on T_ResinBatchCard_Master.productid=ip_products.product_id join ip_clients on T_ResinBatchCard_Master.customerid=ip_clients.client_id join tbl_users on T_ResinBatchCard_Master.createdby = tbl_users.userId join T_Employee_Details ED on ED.EmpID = T_ResinBatchCard_Master.operatedby join T_Employee_Details EmpDtl on EmpDtl.EmpID = tbl_users.EmpID'; $res = $this->db->query($sql); return $res->result(); } function saveTestReportData($testreportdata) { $this->db->insert('T_Test_Report',$testreportdata); $row = $this->db->affected_rows(); return $row; } function saveTestReportAFSData($afstabledata) { $this->db->insert('T_Test_Report_AFS',$afstabledata); $row = $this->db->affected_rows(); return $row; } function saveTestReportLOIData($loitabledata) { $this->db->insert('T_Test_Report_LOI',$loitabledata); $row = $this->db->affected_rows(); return $row; } function getIndividualReportData($reportid) { $this->db->select('T_Test_Report_Master.testreport_id,ip_invoices.invoice_date_created,T_Test_Report_Master.invoiceid,T_Test_Report_Master.batchdate,T_Test_Report_Master.chartdata,ip_clients.client_id,ip_clients.client_name,invoice_custom_fieldvalue,ip_products.product_id,ip_products.product_name,ip_products.product_description,T_Employee_Details.FirstName,T_Employee_Details.LastName,ip_invoice_items.item_quantity,T_Test_Report_Master.approvedby'); $this->db->from('T_Test_Report_Master'); $this->db->join('ip_invoices','T_Test_Report_Master.invoiceid=ip_invoices.invoice_number'); $this->db->join('ip_clients','ip_invoices.client_id=ip_clients.client_id'); $this->db->join('ip_invoice_items','ip_invoices.invoice_id=ip_invoice_items.invoice_id'); $this->db->join('ip_products','ip_products.product_id=ip_invoice_items.item_product_id'); $this->db->join('ip_invoice_custom','ip_invoices.invoice_id=ip_invoice_custom.invoice_id and invoice_custom_fieldid=62'); $this->db->join('tbl_users','T_Test_Report_Master.createdby=tbl_users.userid'); $this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID'); //$this->db->join('T_Employee_Details','T_Test_Report_Master.EmpID=T_Employee_Details.EmpID'); //$this->db->join('ip_invoice_custom','ip_invoices.invoice_number=ip_invoice_custom.invoice_number and invoice_custom_fieldid=62'); $this->db->where('testreport_id',$reportid); // $this->db->join('T_Test_Report','T_Test_Report_Master.testreport_id=T_Test_Report.testreport_id'); // $this->db->join('T_Test_Report_loi','T_Test_Report_Master.testreport_id=T_Test_Report_loi.testreport_id'); // $this->db->join('T_Test_Report_afs','T_Test_Report_Master.testreport_id=T_Test_Report_afs.testreport_id'); $res = $this->db->get(); $reportdata['master'] = $res->result(); $this->db->select('T_Test_Report.*'); $this->db->from('T_Test_Report'); $this->db->where('testreport_id',$reportid); $res1 = $this->db->get(); $reportdata['masterreport'] = $res1->result(); $this->db->select('T_Test_Report_LOI.*'); $this->db->from('T_Test_Report_LOI'); $this->db->where('testreport_id',$reportid); $res1 = $this->db->get(); $reportdata['masterreportloi'] = $res1->result(); $this->db->select('T_Test_Report_AFS.*'); $this->db->from('T_Test_Report_AFS'); $this->db->where('testreport_id',$reportid); $res1 = $this->db->get(); $reportdata['masterreportafs'] = $res1->result(); $this->db->select('T_Company_Details.CompanyName,T_Company_Details.Address,T_Company_Details.ProfilePic'); $this->db->from('T_Company_Details'); //$this->db->where('testreport_id',$reportid); $res1 = $this->db->get(); $reportdata['company'] = $res1->result(); return $reportdata; } function getIndividualInwardReportData($reportid) { $this->db->select('T_Test_Report_Master.chartdata,T_Test_Report_Master.batchdate,T_Test_Report_Master.testreport_id,T_IGR_Master.IGRNO,T_IGR_Master.DeliveryChellanOrInvoiceNo,T_IGR_Master.DeliveryChellanDate,T_IGR_Details.IGRItemNo,T_IGR_Details.QuantityAsPerInvoice,T_MaterialMaster.MaterialCode,T_MaterialMaster.Materialname,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,T_Test_Report_Master.approvedby,T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName'); $this->db->from('T_Test_Report_Master'); $this->db->join('T_IGR_Master','T_Test_Report_Master.igrno=T_IGR_Master.IGRNO'); $this->db->join('T_IGR_Details','T_Test_Report_Master.igrlineitemno=T_IGR_Details.IGRItemNo'); $this->db->join('T_PurchaseOrder_Master','T_IGR_Master.PONO=T_PurchaseOrder_Master.PONO'); $this->db->join('T_MaterialMaster','T_IGR_Details.MaterialCode=T_MaterialMaster.MaterialCode'); $this->db->join('T_SupplierDetailsN','T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID'); $this->db->join('tbl_users','T_Test_Report_Master.createdby=tbl_users.userid'); $this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID'); $this->db->where('T_Test_Report_Master.testreport_id',$reportid); $res = $this->db->get(); $reportdata['master'] = $res->result(); $this->db->select('T_Test_Report.*'); $this->db->from('T_Test_Report'); $this->db->where('testreport_id',$reportid); $res1 = $this->db->get(); $reportdata['masterreport'] = $res1->result(); $this->db->select('T_Test_Report_LOI.*'); $this->db->from('T_Test_Report_LOI'); $this->db->where('testreport_id',$reportid); $res1 = $this->db->get(); $reportdata['masterreportloi'] = $res1->result(); $this->db->select('T_Test_Report_AFS.*'); $this->db->from('T_Test_Report_AFS'); $this->db->where('testreport_id',$reportid); $res1 = $this->db->get(); $reportdata['masterreportafs'] = $res1->result(); $this->db->select('T_Company_Details.CompanyName,T_Company_Details.Address,T_Company_Details.ProfilePic'); $this->db->from('T_Company_Details'); //$this->db->where('testreport_id',$reportid); $res1 = $this->db->get(); $reportdata['company'] = $res1->result(); return $reportdata; } function getTestMasterforList() { $this->db->select('T_Test_Report_Master.testreport_id,T_Test_Report_Master.invoiceid,T_Test_Report_Master.batchdate,T_Test_Report_Master.document,ip_clients.client_id,ip_clients.client_name,ip_products.product_id,ip_products.product_name,ip_products.product_description'); $this->db->from('T_Test_Report_Master'); $this->db->join('ip_invoices','T_Test_Report_Master.invoiceid=ip_invoices.invoice_number'); $this->db->join('ip_clients','ip_invoices.client_id=ip_clients.client_id'); $this->db->join('ip_invoice_items','ip_invoices.invoice_id=ip_invoice_items.invoice_id'); $this->db->join('ip_products','ip_products.product_id=ip_invoice_items.item_product_id'); //$this->db->where('T_Test_Report_Master.invoiceid','!=0'); $res = $this->db->get(); return $res->result(); } function getTestMasterforListInward() { // $this->db->select('T_Test_Report_Master.testreport_id,T_Test_Report_Master.igrno,T_Test_Report_Master.igrlineitemno,T_Test_Report_Master.batchdate,ip_clients.client_id,ip_clients.client_name,ip_products.product_id,ip_products.product_name,ip_products.product_description'); // $this->db->from('T_Test_Report_Master'); // $this->db->join('ip_invoices','T_Test_Report_Master.invoiceid=ip_invoices.invoice_number'); // $this->db->join('ip_clients','ip_invoices.client_id=ip_clients.client_id'); // $this->db->join('ip_invoice_items','ip_invoices.invoice_id=ip_invoice_items.invoice_id'); // $this->db->join('ip_products','ip_products.product_id=ip_invoice_items.item_product_id'); // $res = $this->db->get(); // return $res->result(); $this->db->select('T_Test_Report_Master.batchdate,T_Test_Report_Master.testreport_id,T_IGR_Master.IGRNO,T_IGR_Master.DeliveryChellanOrInvoiceNo,T_IGR_Master.DeliveryChellanDate,T_IGR_Details.IGRItemNo,T_IGR_Details.QuantityAsPerInvoice,T_MaterialMaster.MaterialCode,T_MaterialMaster.Materialname,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,T_Test_Report_Master.approvedby,T_Test_Report_Master.document,T_Employee_Details.EmpID,T_Employee_Details.FirstName,T_Employee_Details.LastName'); $this->db->from('T_Test_Report_Master'); $this->db->join('T_IGR_Master','T_Test_Report_Master.igrno=T_IGR_Master.IGRNO'); $this->db->join('T_IGR_Details','T_Test_Report_Master.igrlineitemno=T_IGR_Details.IGRItemNo'); $this->db->join('T_PurchaseOrder_Master','T_IGR_Master.PONO=T_PurchaseOrder_Master.PONO'); $this->db->join('T_MaterialMaster','T_IGR_Details.MaterialCode=T_MaterialMaster.MaterialCode'); $this->db->join('T_SupplierDetailsN','T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID'); $this->db->join('tbl_users','T_Test_Report_Master.createdby=tbl_users.userid'); $this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID'); $this->db->order_by('testreport_id','desc'); $res = $this->db->get(); return $res->result(); } function getIGRNOforReport() { // $this->db->distinct(); // $this->db->select('IGRNO'); // $this->db->from('T_IGR_Details'); // $this->db->join('T_MaterialMaster','T_IGR_Details.MaterialCode=T_MaterialMaster.MaterialCode'); // $this->db->like('T_MaterialMaster.Category','raw material'); $sql = 'select distinct IGRNO from T_IGR_Details join T_MaterialMaster on T_IGR_Details.MaterialCode = T_MaterialMaster.MaterialCode where T_MaterialMaster.Category like "%Raw Material%"and date(T_IGR_Details.CreatedDate) between date(SUBDATE(CURRENT_DATE,1)) and date(CURRENT_DATE) order by IGRNO desc'; $result = $this->db->query($sql); return $result->result(); } function getIGRLineItemNo($igrno) { // $this->db->select('IGRItemNo'); // $this->db->from('T_IGR_Details'); // $this->db->where('IGRNO',$igrno); $sql = 'select IGRItemNo from T_IGR_Details join T_MaterialMaster on T_IGR_Details.MaterialCode = T_MaterialMaster.MaterialCode where IGRNO = ? and T_MaterialMaster.Category like "%Raw Material%"'; $result = $this->db->query($sql,array($igrno)); return $result->result(); } function getIGRNOReport() { $this->db->select('igrno,igrlineitemno'); $this->db->from('T_Test_Report_Master'); $res['generated'] = ($this->db->get()->result()); // $this->db->select('IGRNO,IGRItemNo'); // $this->db->from('T_IGR_Details'); // $this->db->where('IGRNO NOT IN (SELECT IGRNO from T_Test_Report_Master)',NULL,false); // $this->db->or_where('IGRItemNo NOT IN (SELECT IGRItemNo from T_Test_Report_Master)',NULL,false); $sql= 'select distinct IGRNO,IGRItemNo from T_IGR_Details join T_MaterialMaster on T_IGR_Details.MaterialCode = T_MaterialMaster.MaterialCode where (T_IGR_Details.IGRNO not in (select igrno from T_Test_Report_Master where igrno != "") or T_IGR_Details.IGRItemNo not in (select igrlineitemno from T_Test_Report_Master where igrno != "") ) and T_MaterialMaster.Category like "%Raw Material%" order by T_IGR_Details.IGRNO DESC'; $r = $this->db->query($sql); $res['notgenerated'] = ($r->result()); return $res; } function getIGRDataforReport($igrno,$igrlineitemno) { //echo $igrno.'-'.$igrlineitemno;die(); // $this->db->select('T_IGR_Master.DeliveryChellanOrInvoiceNo,T_IGR_Master.DeliveryChellanDate,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,T_MaterialMaster.MaterialCode,T_MaterialMaster.MaterialName,T_IGR_Details.QuantityAsPerInvoice'); // $this->db->from('T_IGR_Master'); // $this->db->join('T_IGR_Details','T_IGR_Master.IGRNO=T_IGR_Details.IGRNO'); // $this->db->join('T_MaterialMaster','T_IGR_Details.MaterialCode=T_MaterialMaster.MaterialCode'); // $this->db->join('T_PurchaseOrder_Master','T_IGR_Master.PONO=T_PurchaseOrder_Master.PONO'); // $this->db->join('T_SupplierDetailsN','T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID'); // $this->db->where('T_IGR_Details.IGRNO',$igrno); // $this->db->where('T_IGR_Details.IGRItemNo',$igrlineitemno); // $this->db->order_by('T_IGR_Master.IGRNO'); // $res = $this->db->get(); // return $res->result(); $sql = 'select T_IGR_Master.DeliveryChellanOrInvoiceNo, date_format(T_IGR_Master.DeliveryChellanDate,"%d-%m-%Y") as DeliveryChellanDate,T_SupplierDetailsN.SupplierID,T_SupplierDetailsN.SupplierName,T_MaterialMaster.MaterialCode, T_MaterialMaster.MaterialName,T_IGR_Details.QuantityAsPerInvoice from T_IGR_Master join T_IGR_Details on T_IGR_Master.IGRNO=T_IGR_Details.IGRNO join T_MaterialMaster on T_IGR_Details.MaterialCode=T_MaterialMaster.MaterialCode join T_PurchaseOrder_Master on T_IGR_Master.PONO=T_PurchaseOrder_Master.PONO join T_SupplierDetailsN on T_PurchaseOrder_Master.SupplierID=T_SupplierDetailsN.SupplierID where T_IGR_Master.IGRNO = ? and T_IGR_Details.IGRItemNo = ?'; $res = $this->db->query($sql,array($igrno,$igrlineitemno)); return $res->result(); } function getIGRNos() { $sql = 'select IGRNO from T_IGR_Master order by IGRNO desc'; $res = $this->db->query($sql); return $res->result(); } function getMachineList() { $sql = 'select Machine_Code,Machine_Name from T_Machine_Master'; $res = $this->db->query($sql); return $res->result(); } function getTRPBatchcardNos() { $sql = 'select dailyid from T_daily_batchcard_data'; $res = $this->db->query($sql); return $res->result(); } function getIGRItemNos() { $sql = 'select IGRItemNo from T_IGR_Details order by IGRItemNo desc'; $res = $this->db->query($sql); return $res->result(); } } ?>