diff --git a/application/controllers/supplier.php b/application/controllers/supplier.php index 7189fda4..c82d54e0 100755 --- a/application/controllers/supplier.php +++ b/application/controllers/supplier.php @@ -18,7 +18,7 @@ class supplier extends BaseController { parent::__construct(); $this->load->model('supplier_model'); - $this->load->library('form_validation'); + $this->load->library('form_validation'); $this->load->library('pagination'); $this->load->library('Excel'); $this->isLoggedIn(); @@ -40,8 +40,7 @@ class supplier extends BaseController { $this->load->model('supplier_model'); - - + $data['userRecords'] = $this->supplier_model->supplierListing(); $this->global['pageTitle'] = 'Siddharth Industries : Supplier Listing'; @@ -122,13 +121,10 @@ class supplier extends BaseController $this->form_validation->set_rules('SupplierName','Supplier Name','trim|required'); $this->form_validation->set_rules('Address','Address','trim|required|'); - $this->form_validation->set_rules('ContactNumber','Contact Number','trim|required|numeric|max_length[10]'); $this->form_validation->set_rules('AlternateContactNumber','Alternate Contact Number','trim|numeric|max_length[10]'); $this->form_validation->set_rules('emailid','emailid', 'valid_email|max_length[128]|required'); - $this->form_validation->set_rules('TIN','TIN','trim|required|max_length[11]'); - $this->form_validation->set_rules('panno', 'panno', 'trim|required|max_length[10]|callback_checkPanValidate'); @@ -153,7 +149,7 @@ class supplier extends BaseController $PaymentTerms = $this->input->post('PaymentTerms'); $Payment = $this->input->post('Payment'); $PayableAT = $this->input->post('PayableAT'); - $CSTNo = $this->input->post('CSTNo'); + $CSTNo = $this->input->post('CSTNo'); $CSTDt = $this->input->post('dateofCST'); @@ -165,11 +161,29 @@ class supplier extends BaseController { $CSTDate = null; } + + $EMSNo = $this->input->post('EMSNo'); + $TSNo = $this->input->post('TSNo'); + $IMSNo = $this->input->post('IMSNo'); + $ISONo = $this->input->post('ISONo'); + $OSHASNo = $this->input->post('OSHASNo'); + $accno = $this->input->post('accno'); + $ifsc = $this->input->post('ifsc'); + $branchname = $this->input->post('branchname'); + $bankaddress = $this->input->post('bankaddress'); + $Createdby = $this->session->userdata ( 'userId' ); + $date = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $createddate = $date->format('Y-m-d H:i:s'); + $service = $this->input->post('service'); + $rawmaterial =$this->input->post('rawmaterial'); + $maintenance = $this->input->post('maintenance'); + - $supplier = array('SupplierName'=>$SupplierName, 'Address'=>$Address, 'ContactNumber'=>$ContactNumber, 'AlternateContactNumber'=> $AlternateContactNumber,'EmailAddress'=>$EmailAddress,'Exiseregistration'=>$Exiseregistration,'TIN'=>$TIN,'PAN'=>$PAN,'GSTNo'=>$GSTNo,'GSTRange'=>$GSTRange,'CollectrateAddress'=>$CollectrateAddress,'UANumber'=>$UANumber,'PaymentTerms'=>$PaymentTerms,'PaymentDays'=>$Payment,'PayableAT'=>$PayableAT,'CSTNo'=>$CSTNo,'CSTDate'=>$CSTDate,'Createdby'=>$Createdby); + $supplier = array('SupplierName'=>$SupplierName, 'Address'=>$Address, 'ContactNumber'=>$ContactNumber, 'AlternateContactNumber'=> $AlternateContactNumber,'EmailAddress'=>$EmailAddress,'Exiseregistration'=>$Exiseregistration,'TIN'=>$TIN,'PAN'=>$PAN,'GSTNo'=>$GSTNo,'GSTRange'=>$GSTRange,'CollectrateAddress'=>$CollectrateAddress,'UANumber'=>$UANumber,'PaymentTerms'=>$PaymentTerms,'PaymentDays'=>$Payment,'PayableAT'=>$PayableAT,'CSTNo'=>$CSTNo,'CSTDate'=>$CSTDate,'CSTNo'=>$CSTNo,'CSTDate'=>$CSTDate,'Cert_EMS'=>$EMSNo, 'Cert_TS'=>$TSNo, 'Cert_IMS'=>$IMSNo, 'Cert_ISO'=>$ISONo, 'Cert_OSHAS'=>$OSHASNo, 'BankAcNumber'=>$accno, 'IFSCCode'=>$ifsc, 'BranchName'=>$branchname, 'BankAddress'=>$bankaddress,'Createdby'=>$Createdby,'IsService'=>$service,'IsMaintanance'=>$maintenance,'IsRawMaterial'=>$rawmaterial); $result = $this->supplier_model->addNewsupplier($supplier); + if($result > 0) { @@ -206,16 +220,17 @@ class supplier extends BaseController $this->form_validation->set_rules('emailid','emailid','valid_email|max_length[128]|required'); $this->form_validation->set_rules('TIN','TIN','trim|required|max_length[11]'); - + $this->form_validation->set_rules('panno', 'panno', 'trim|required|max_length[10]|callback_checkPanValidateSupplier'); - + + if($this->form_validation->run() == FALSE) { $this->viewsupplier($supplierID); } else { - + $SupplierName = $this->input->post('SupplierName'); $Address = $this->input->post('Address'); $ContactNumber = $this->input->post('ContactNumber'); @@ -230,7 +245,7 @@ class supplier extends BaseController $UANumber = $this->input->post('UANumber'); $PaymentTerms = $this->input->post('PaymentTerms'); $Payment = $this->input->post('Payment'); - $PayableAT = $this->input->post('PayableAT'); + //$PayableAT = $this->input->post('PayableAT'); $UpdatedBy = $this->session->userdata ( 'userId' ); $chked = $this->input->post('isactive'); @@ -244,9 +259,8 @@ class supplier extends BaseController } $CSTNo = $this->input->post('CSTNo'); - $CSTDt = $this->input->post('dateofCST'); - + if($CSTDt != '') { $CSTDate = $this->getDateformat($CSTDt); @@ -255,11 +269,27 @@ class supplier extends BaseController { $CSTDate = null; } - $supplier = array(); - - $supplier = array('SupplierName'=>$SupplierName, 'Address'=>$Address, 'ContactNumber'=>$ContactNumber, 'AlternateContactNumber'=> $AlternateContactNumber,'EmailAddress'=>$EmailAddress,'Exiseregistration'=>$Exiseregistration,'TIN'=>$TIN,'PAN'=>$PAN,'GSTNo'=>$GSTNo,'GSTRange'=>$GSTRange,'CollectrateAddress'=>$CollectrateAddress,'UANumber'=>$UANumber,'PaymentTerms'=>$PaymentTerms,'PaymentDays'=>$Payment,'PayableAT'=>$PayableAT,'UpdatedBy'=>$UpdatedBy,'IsActive'=>$IsActive,'CSTNo'=>$CSTNo,'CSTDate'=>$CSTDate); - - $result = $this->supplier_model->UpdateSupplier($supplier, $supplierID); + + $EMSNo = $this->input->post('EMSNo'); + $TSNo = $this->input->post('TSNo'); + $IMSNo = $this->input->post('IMSNo'); + $ISONo = $this->input->post('ISONo'); + $OSHASNo = $this->input->post('OSHASNo'); + $accno = $this->input->post('accno'); + $ifsc = $this->input->post('ifsc'); + $branchname = $this->input->post('branchname'); + $bankaddress = $this->input->post('bankaddress'); + $service = $this->input->post('service'); + $rawmaterial =$this->input->post('rawmaterial'); + $maintanance = $this->input->post('maintanance'); + + $supplier = array(); + $supplier = array('SupplierName'=>$SupplierName, 'Address'=>$Address, 'ContactNumber'=>$ContactNumber, 'AlternateContactNumber'=> $AlternateContactNumber,'EmailAddress'=>$EmailAddress,'Exiseregistration'=>$Exiseregistration,'TIN'=>$TIN,'PAN'=>$PAN,'GSTNo'=>$GSTNo,'GSTRange'=>$GSTRange,'CollectrateAddress'=>$CollectrateAddress,'UANumber'=>$UANumber,'PaymentTerms'=>$PaymentTerms,'PaymentDays'=>$Payment,'CSTNo'=>$CSTNo,'CSTDate'=>$CSTDate,'Cert_EMS'=>$EMSNo, 'Cert_TS'=>$TSNo, 'Cert_IMS'=>$IMSNo, 'Cert_ISO'=>$ISONo, 'Cert_OSHAS'=>$OSHASNo, 'BankAcNumber'=>$accno, 'IFSCCode'=>$ifsc, 'BranchName'=>$branchname, 'BankAddress'=>$bankaddress,'UpdatedBy'=>$UpdatedBy,'IsActive'=>$IsActive,'IsService'=>$service,'IsMaintanance'=>$maintanance,'IsRawMaterial'=>$rawmaterial); + //SupplierID, SupplierName, Address, ContactNumber, AlternateContactNumber, EmailAddress, Exiseregistration, TIN, PAN, CSTNO, CSTDate, GSTNO, GSTRange, CollectrateAddress, UANumber, PaymentTerms, PaymentDays, PayableAT, Cert_EMS, Cert_TS, Cert_IMS, Cert_ISO, Cert_OSHAS, BankAcNumber, IFSCCode, BranchName, BankAddress, Createdby, UpdatedBy, Updatedon, CreatedOn, IsActive); + print_r($supplier); + //die(); + $result = $this->supplier_model->UpdateSupplier($supplier, $supplierID); + if($result == True) { @@ -307,7 +337,6 @@ class supplier extends BaseController $this->excel->setActiveSheetIndex(0); $this->excel->getActiveSheet()->setTitle('supplier details'); - $this->excel->getActiveSheet()->setCellValue('A1', 'SupplierID'); $this->excel->getActiveSheet()->setCellValue('B1', 'SupplierName'); $this->excel->getActiveSheet()->setCellValue('C1', 'Address'); @@ -405,10 +434,6 @@ class supplier extends BaseController $this->excel->getActiveSheet()->setCellValue('S' . $i,$data['firstname']); $this->excel->getActiveSheet()->setCellValue('T' . $i,$data['Update_by']); $this->excel->getActiveSheet()->setCellValue('U' . $i,$data['IsActive']); - - - - $i++; $s++; diff --git a/application/models/supplier_model.php b/application/models/supplier_model.php index dc2f9554..96219051 100755 --- a/application/models/supplier_model.php +++ b/application/models/supplier_model.php @@ -15,7 +15,6 @@ class supplier_model extends CI_Model $this->db->select('BaseT.SupplierID, BaseT.SupplierName, BaseT.Address, BaseT.ContactNumber, BaseT.AlternateContactNumber,BaseT.EmailAddress,BaseT.Exiseregistration, BaseT.TIN, BaseT.PAN,,BaseT.GSTNO,BaseT.GSTRange,BaseT.CollectrateAddress,BaseT.UANumber,BaseT.PaymentTerms,BaseT.PaymentDays,BaseT.PayableAT,BaseT.CreatedOn'); $this->db->from('T_SupplierDetailsN as BaseT'); - $query = $this->db->get(); $result = $query->result(); @@ -67,12 +66,17 @@ class supplier_model extends CI_Model function addNewsupplier($supplier) { - - $this->db->insert('T_SupplierDetailsN', $supplier); - - $SID = $this->db->affected_rows(); - return $SID; + $this->db->insert('T_SupplierDetailsN', $supplier); + $SID = $this->db->affected_rows(); + + if($SID>0) + { + $subQuery = 'select max(SupplierID) as suppid from T_SupplierDetailsN'; + $query = $this->db->query($subQuery); + return $query->result(); + } + //return $SID; } @@ -95,7 +99,7 @@ function addNewsupplier($supplier) { $this->db->select('Address'); $this->db->from('T_SupplierDetailsN'); - $this->db->where('SupplierID', $supplierID); + $this->db->where('SupplierID', $supplierID); $query = $this->db->get(); return $query->result_array(); } @@ -103,9 +107,15 @@ function addNewsupplier($supplier) { $this->db->where('SupplierID', $supplierID); $this->db->update('T_SupplierDetailsN', $supplier); + + + return TRUE; } + + + function viewsupplier($supplier, $supplierID) { @@ -114,17 +124,29 @@ function addNewsupplier($supplier) return TRUE; } - + + function SupplierCertification($cerificate) + { + $this->db->insert_id('T_Supplier_Certification',$cerificate); + $insert_id = $this->db->affected_rows(); + + return $insert_id; + + } + function export_excel(){ $this->db->select('det.SupplierID,SupplierName,det.Address,det.ContactNumber,det.AlternateContactNumber,det.EmailAddress,det.Exiseregistration,det.TIN, -det.PAN,det.CSTNO,det.CSTDate,det.GSTNO,det.GSTRange,det.CollectrateAddress,det.UANumber,det.PaymentTerms,det.PaymentDays,det.PayableAT,emp.firstname ,emp1.firstname as Update_by,,det.IsActive'); + det.PAN,det.CSTNO,det.CSTDate,det.GSTNO,det.GSTRange,det.CollectrateAddress,det.UANumber,det.PaymentTerms,det.PaymentDays,det.PayableAT,emp.firstname ,emp1.firstname as Update_by,,det.IsActive'); $this->db->join('tbl_users as tbl',' det.createdby = tbl.userid','left'); $this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid','left'); $this->db->join('tbl_users as tbl1',' det.UpdatedBy = tbl1.userid','left'); $this->db->join('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid','left'); return $this->db->get('T_SupplierDetailsN as det')->result_array(); } + + /*SUPPLIER */ + /*SUPPLIER TYPE */ diff --git a/application/views/addsupplier.php b/application/views/addsupplier.php index 8eaa0a91..32f4a58d 100755 --- a/application/views/addsupplier.php +++ b/application/views/addsupplier.php @@ -1,4 +1,5 @@ -
@@ -232,47 +237,56 @@ $(function() { Supplier Information -
+
+
+ +
Supplier Name*
- -
+
Supplier Type*
+ + SERVICE
+ RAW MATERIALS
+ MAINTENANCE +
+
+
+
Contact Number*
- -
+
Alternate Contact Number
- -
+
+
Email ID* -
- +
+
Address Details - +
Address*
- +
Tax Related Data - +
PAN * - +
TIN* @@ -287,39 +301,79 @@ $(function() { Excise Registration
- - -
+
+
+
CST Number
CST Registration Date -
- - +
- GST Number - -
- + GST Number* + +
- GST Range - + GST Range* +
- - -
Collectrate Address + +
Collectrate Address
- + +
- + Certification Details +
+
+
EMS Number + +
+
TS Number + +
+
+
+
+ IMS Number + +
+
+ ISO Range + +
+
+
+ OSHAS Number + + +
+
+ Bank Details + + +
+
Account Number + +
+
IFSC Code + +
+
Bank Branch Name + +
+
Bank Address + +
+
Payment Details +
Payable Terms -
- -
- Payable AT - -
- -
Payment Date
- - +
-
+
+
@@ -460,3 +506,4 @@ if(!validateEmail()) }); + \ No newline at end of file diff --git a/application/views/editSupplier.php b/application/views/editSupplier.php index 6f5196cf..3b0db906 100755 --- a/application/views/editSupplier.php +++ b/application/views/editSupplier.php @@ -16,10 +16,21 @@ $PaymentTerms = ''; $PaymentDays = ''; $PayableAT = ''; $IsActive = ''; -$PaymentBefore = ''; -$PaymentAfter = ''; $CSTNO = ''; $CSTDate = ''; +$EMSNo = ''; +$TSNo = ''; +$IMSNo = ''; +$ISONo = ''; +$OSHASNo = ''; +$accno = ''; +$ifsc = ''; +$branchname = ''; +$bankaddress = ''; +$IsService = ''; +$IsMaintanance = ''; +$IsRawMaterial = ''; + if(!empty($supplier)) { foreach ($supplier as $uf) @@ -42,16 +53,15 @@ if(!empty($supplier)) $PayableAT = $uf->PayableAT; $CSTNO = $uf->CSTNO; $CSTDt = $uf->CSTDate; - //echo 'CST date:'. $CSTDt ; + if($CSTDt != '') { $dtCST = new DateTime($CSTDt); $CSTDate = $dtCST ->format('Y-m-d'); - //echo $CSTDate ; + } - $chk = $uf->IsActive; - + $chk = $uf->IsActive; if($chk == 1) { $IsActive = 'checked'; @@ -60,17 +70,48 @@ if(!empty($supplier)) { $IsActive = ''; } - $Paymentchk = $uf->PaymentDays; - if($Paymentchk == 'Before' ) - { - $PaymentBefore = 'checked'; - $PaymentAfter = ''; - } - else - { - $PaymentAfter = 'checked'; - $PaymentBefore = ''; - } + + $sr = $uf->IsService; + if($sr == 1) + { + $IsService = 'checked'; + } + else + { + $IsService = ''; + } + + $mt = $uf->IsMaintanance; + if($mt == 1) + { + $IsMaintanance = 'checked'; + } + else + { + $IsMaintanance = ''; + } + + $rm = $uf->IsRawMaterial; + if($rm == 1) + { + $IsRawMaterial = 'checked'; + } + else + { + $IsRawMaterial = ''; + } + + + $EMSNo = $uf->Cert_EMS; + $TSNo = $uf->Cert_TS; + $IMSNo = $uf->Cert_IMS; + $ISONo = $uf->Cert_ISO; + $OSHASNo = $uf->Cert_OSHAS; + $accno = $uf->BankAcNumber; + $IFSCCode = $uf->IFSCCode; + $branchname = $uf->BranchName; + $bankaddress = $uf->BankAddress; + } } @@ -179,7 +220,7 @@ function getValidAlternateNumber() } function validateEmail() { - var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; + //var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; var email = $('#emailid').val(); @@ -307,7 +348,14 @@ function onlyAlphabets(evt) {
-
name="isactive" > IsActive
+
Supplier Type :* + + name="service" value="1"> SERVICE    + name="rawmaterial" value="1"> RAW MATERIALS    + name="maintanance" value="1"> MAINTENANCE + +
+
name="isactive" > IsActive
Address Details @@ -362,7 +410,51 @@ function onlyAlphabets(evt) {
- + + Certification Details +
+
+
EMS Number + +
+
TS Number + +
+
+
+
+ IMS Number + +
+
+ ISO Number + +
+
+
+ OSHAS Number + + +
+
+ + Bank Details + + +
+
Account Number + +
+
IFSC Code + +
+
Bank Branch Name + +
+
Bank Address + +
+
Payment Details @@ -387,21 +479,7 @@ function onlyAlphabets(evt) { ?>
- -
- Payable AT - -
- -
Payment Date
- - -
- - - - -
+
@@ -501,4 +579,4 @@ function Validate() } }); - + \ No newline at end of file