diff --git a/application/controllers/supplier.php b/application/controllers/supplier.php index 9e233dfa..35f1ac7c 100644 --- a/application/controllers/supplier.php +++ b/application/controllers/supplier.php @@ -45,7 +45,7 @@ class supplier extends BaseController $count = $this->supplier_model->supplierListingCount($searchText); - $returns = $this->paginationCompress ( "supplierListing/", $count, 15 ); + $returns = $this->paginationCompress ( "supplierListing/", $count, 5 ); $data['userRecords'] = $this->supplier_model->supplierListing($searchText, $returns["page"], $returns["segment"]); @@ -59,14 +59,40 @@ class supplier extends BaseController function addsupplier() { $this->load->model('supplier_model'); - //$data['SupplierName'] = $this->purchaseorder_model->getSupplierName(); + $data['payment'] = $this->supplier_model->getpayment(); //$data['users'] = $this->purchaseorder_model->getusers(); - $this->global['pageTitle'] = 'siddharth : Add New Supplier'; + $this->global['pageTitle'] = 'siddharth : AddNew Supplier'; - $this->loadViews("addsupplier", $this->global, NULL); + $this->loadViews("addsupplier", $this->global,$data, NULL); } + /** + * This function is used to check whether PAN already exist or not + */ + + + + function CheckPAN() + { + $id = $this->input->post('id'); + + $this->load->model('supplier_model'); + + $query = $this->supplier_model->checkPAN($id ); + + // $result = array_shift($result); + + $query = $query[0]['PAN']; + + + print_r($query); + + //return $PAN; + + } + + /** * This function is used to add new user to the system @@ -78,13 +104,23 @@ class supplier extends BaseController $SupplierID = $this->input->post('SupplierID'); - $this->form_validation->set_rules('SupplierName','Supplier Name','trim|'); + $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||numeric'); - $this->form_validation->set_rules('AlternateContactNumber','Alternate Contact Number','trim||numeric'); - $this->form_validation->set_rules('EmailAddress','Email Address|valid_email|xss_clean|max_length[128]'); + + $this->form_validation->set_rules('ContactNumber','Contact Number','trim|required|numeric'); + $this->form_validation->set_rules('AlternateContactNumber','Alternate Contact Number','trim|required|numeric'); + $this->form_validation->set_rules('EmailAddress','Email Address|valid_email|xss_clean|max_length[128]|required'); + $this->form_validation->set_rules('Exiseregistration','Exiseregistration','trim|required'); $this->form_validation->set_rules('TIN','TIN','trim|required'); - $this->form_validation->set_rules('PAN','PAN','required'); + + $this->form_validation->set_rules('PAN', 'PAN', 'trim|required'); + $this->form_validation->set_rules('GSTNo','GST No','trim|required'); + $this->form_validation->set_rules('GSTRange','GST Range','trim|required'); + $this->form_validation->set_rules('CollectrateAddress','CollectrateAddress','trim|required'); + $this->form_validation->set_rules('UANumber','UANumber','trim|required'); + $this->form_validation->set_rules('PaymentTerms','PaymentTerms','trim|required'); + $this->form_validation->set_rules('PaymentDays','PaymentTerms','trim|required'); + $this->form_validation->set_rules('PayableAT','PaymentTerms','trim|required'); if($this->form_validation->run() == FALSE) @@ -95,29 +131,39 @@ class supplier extends BaseController { $SupplierName = ucwords(strtolower($this->input->post('SupplierName'))); $Address = $this->input->post('Address'); + $ContactNumber = $this->input->post('ContactNumber'); $AlternateContactNumber = $this->input->post('AlternateContactNumber'); $EmailAddress = $this->input->post('EmailAddress'); + $Exiseregistration = $this->input->post('Exiseregistration'); $TIN = $this->input->post('TIN'); $PAN = $this->input->post('PAN'); + $GSTNo = $this->input->post('GSTNo'); + $GSTRange = $this->input->post('GSTRange'); + $CollectrateAddress = $this->input->post('CollectrateAddress'); + $UANumber = $this->input->post('UANumber'); + $PaymentTerms = $this->input->post('PaymentTerms'); + $PaymentDays = $this->input->post('PaymentDays'); + $PayableAT = $this->input->post('PayableAT'); - $supplier = array('SupplierName'=>$SupplierName, 'Address'=>$Address, 'ContactNumber'=>$ContactNumber, 'AlternateContactNumber'=> $AlternateContactNumber,'EmailAddress'=>$EmailAddress,'TIN'=>$TIN,'PAN'=>$PAN,'createdDate'=>date('Y-m-d H:i:sa')); + $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'=>$PaymentDays,'PayableAT'=>$PayableAT,'createdDate'=>date('Y-m-d H:i:sa')); $this->load->model('supplier_model'); $result = $this->supplier_model->addNewsupplier($supplier); - + echo $supplier; if($result > 0) { $this->session->set_flashdata('success', 'New Supplier created successfully'); } + else { $this->session->set_flashdata('error', 'Supplier Not Create'); } - redirect('addsupplier'); + redirect('supplierListing'); } } @@ -132,7 +178,7 @@ class supplier extends BaseController //$data['SupplierName'] = $this->purchaseorder_model->getSupplierName(); $data['supplier'] = $this->supplier_model->getUserInfo($supplierID); - + $data['payment'] = $this->supplier_model->getpayment(); $this->global['pageTitle'] = 'Siddharth : Edit Supplier'; $this->loadViews("editOldsupplier", $this->global,$data, NULL); @@ -159,9 +205,16 @@ class supplier extends BaseController $this->form_validation->set_rules('ContactNumber','Contact Number','trim||numeric'); $this->form_validation->set_rules('AlternateContactNumber','Alternate Contact Number','trim||numeric'); $this->form_validation->set_rules('EmailAddress','Email Address|valid_email|xss_clean|max_length[128]'); + $this->form_validation->set_rules('Exiseregistration','Exiseregistration','trim|required'); $this->form_validation->set_rules('TIN','TIN','trim|required'); $this->form_validation->set_rules('PAN','PAN','required'); - + $this->form_validation->set_rules('GSTNo','GST No','trim|required'); + $this->form_validation->set_rules('GSTRange','GST Range','trim|required'); + $this->form_validation->set_rules('CollectrateAddress','CollectrateAddress','trim|required'); + $this->form_validation->set_rules('UANumber','UANumber','trim|required'); + $this->form_validation->set_rules('PaymentTerms','PaymentTerms','trim|required'); + $this->form_validation->set_rules('PaymentDays','PaymentTerms','trim|required'); + $this->form_validation->set_rules('PayableAT','PaymentTerms','trim|required'); if($this->form_validation->run() == FALSE) { $this->editsupplier($supplierID); @@ -174,23 +227,34 @@ class supplier extends BaseController $ContactNumber = $this->input->post('ContactNumber'); $AlternateContactNumber = $this->input->post('AlternateContactNumber'); $EmailAddress = $this->input->post('EmailAddress'); + $Exiseregistration = $this->input->post('Exiseregistration'); $TIN = $this->input->post('TIN'); $PAN = $this->input->post('PAN'); + $GSTNo = $this->input->post('GSTNo'); + $GSTRange = $this->input->post('GSTRange'); + $CollectrateAddress = $this->input->post('CollectrateAddress'); + $UANumber = $this->input->post('UANumber'); + $PaymentTerms = $this->input->post('PaymentTerms'); + $PaymentDays = $this->input->post('PaymentDays'); + $PayableAT = $this->input->post('PayableAT'); - $supplier = array(); + + $supplier = array(); + + if(empty($ContactNumber)) { - $supplier = array('SupplierID'=>$SupplierID,'SupplierName'=>$SupplierName, 'Address'=>$Address, 'ContactNumber'=>$ContactNumber, 'AlternateContactNumber'=> $AlternateContactNumber,'EmailAddress'=>$EmailAddress,'TIN'=>$TIN,'PAN'=>$PAN,'createdDate'=>date('Y-m-d H:i:sa')); + $supplier = array('SupplierName'=>$SupplierName, 'Address'=>$Address, 'ContactNumber'=>$ContactNumber, 'AlternateContactNumber'=> $AlternateContactNumber,'EmailAddress'=>$EmailAddress,'TIN'=>$TIN,'Exiseregistration'=>$Exiseregistration,'PAN'=>$PAN,'GSTNo'=>$GSTNo,'GSTRange'=>$GSTRange,'CollectrateAddress'=>$CollectrateAddress,'UANumber'=>$UANumber,'PaymentTerms'=>$PaymentTerms,'PaymentDays'=>$PaymentDays,'PayableAT'=>$PayableAT,'createdDate'=>date('Y-m-d H:i:sa')); } else{ - $supplier = array('SupplierName'=>$SupplierName, 'Address'=>$Address, 'ContactNumber'=>$ContactNumber, 'AlternateContactNumber'=> $AlternateContactNumber,'EmailAddress'=>$EmailAddress,'TIN'=>$TIN,'PAN'=>$PAN,'createdDate'=>date('Y-m-d H:i:sa')); + $supplier = array('SupplierName'=>$SupplierName, 'Address'=>$Address, 'ContactNumber'=>$ContactNumber, 'AlternateContactNumber'=> $AlternateContactNumber,'EmailAddress'=>$EmailAddress,'TIN'=>$TIN,'Exiseregistration'=>$Exiseregistration,'PAN'=>$PAN,'GSTNo'=>$GSTNo,'GSTRange'=>$GSTRange,'CollectrateAddress'=>$CollectrateAddress,'UANumber'=>$UANumber,'PaymentTerms'=>$PaymentTerms,'PaymentDays'=>$PaymentDays,'PayableAT'=>$PayableAT,'createdDate'=>date('Y-m-d H:i:sa')); } $result = $this->supplier_model->editsupplier($supplier, $supplierID); - + echo $PaymentDays; if($result == true) { $this->session->set_flashdata('success', 'supplier updated successfully'); @@ -221,28 +285,7 @@ class supplier extends BaseController } - /** - * This function is used to delete the user using userId - * @return boolean $result : TRUE / FALSE - - function deleteUser() - { - if($this->isAdmin() == TRUE) - { - echo(json_encode(array('status'=>'access'))); - } - else - { - $userId = $this->input->post('userId'); - $userInfo = array('isDeleted'=>1,'updatedBy'=>$this->vendorId, 'updatedDtm'=>date('Y-m-d H:i:sa')); - - $result = $this->user_model->deleteUser($userId, $userInfo); - - if ($result > 0) { echo(json_encode(array('status'=>TRUE))); } - else { echo(json_encode(array('status'=>FALSE))); } - } - }*/ - + function pageNotFound() { diff --git a/application/models/supplier_model.php b/application/models/supplier_model.php index 9215681a..b9170f18 100644 --- a/application/models/supplier_model.php +++ b/application/models/supplier_model.php @@ -9,7 +9,7 @@ class supplier_model extends CI_Model */ function supplierListingCount($searchText = '') { - $this->db->select('BaseT.SupplierID, BaseT.SupplierName, BaseT.Address, BaseT.ContactNumber, BaseT.AlternateContactNumber,BaseT.EmailAddress,BaseT.TIN,BaseT.PAN'); + $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'); $this->db->from('T_SupplierDetailsN as BaseT'); //$this->db->join('tbl_users as users', 'users.userId = BaseT.userId','left'); //$this->db->join('T_SupplierDetails as ID', 'ID.SupplierID = BaseT.SupplierID','left'); @@ -20,8 +20,16 @@ class supplier_model extends CI_Model OR BaseT.ContactNumber LIKE '%".$searchText."%' OR BaseT.AlternateContactNumber LIKE '%".$searchText."%' OR BaseT.EmailAddress LIKE '%".$searchText."%' + OR BaseT.Exiseregistration LIKE '%".$searchText."%' OR BaseT.TIN LIKE '%".$searchText."%' - OR BaseT.PAN LIKE '%".$searchText."%')"; + OR BaseT.PAN LIKE '%".$searchText."%' + OR BaseT.GSTNO LIKE '%".$searchText."%' + OR BaseT.GSTRange LIKE '%".$searchText."%' + OR BaseT.CollectrateAddress LIKE '%".$searchText."%' + OR BaseT.UANumber LIKE '%".$searchText."%' + OR BaseT.PaymentTerms LIKE '%".$searchText."%' + OR BaseT.PaymentDays LIKE '%".$searchText."%' + OR BaseT.PayableAT LIKE '%".$searchText."%')"; $this->db->where($likeCriteria); } //$this->db->where('BaseT.isDeleted', 0); @@ -39,7 +47,7 @@ class supplier_model extends CI_Model */ function supplierListing($searchText = '', $page, $segment) { - $this->db->select('BaseT.SupplierID, BaseT.SupplierName, BaseT.Address, BaseT.ContactNumber, BaseT.AlternateContactNumber,BaseT.EmailAddress, BaseT.TIN, BaseT.PAN,BaseT.CreatedDate'); + $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.CreatedDate'); $this->db->from('T_SupplierDetailsN as BaseT'); //$this->db->join('tbl_users as users', 'users.userId = BaseT.userId','left'); //$this->db->join('T_SupplierDetails as ID', 'ID.SupplierID = BaseT.SupplierID','left'); @@ -50,9 +58,17 @@ class supplier_model extends CI_Model OR BaseT.ContactNumber LIKE '%".$searchText."%' OR BaseT.AlternateContactNumber LIKE '%".$searchText."%' OR BaseT.EmailAddress LIKE '%".$searchText."%' + OR BaseT.Exiseregistration LIKE '%".$searchText."%' OR BaseT.TIN LIKE '%".$searchText."%' OR BaseT.CreatedDate LIKE '%".$searchText."%' - OR BaseT.PAN LIKE '%".$searchText."%')"; + OR BaseT.PAN LIKE '%".$searchText."%' + OR BaseT.GSTNO LIKE '%".$searchText."%' + OR BaseT.GSTRange LIKE '%".$searchText."%' + OR BaseT.CollectrateAddress LIKE '%".$searchText."%' + OR BaseT.UANumber LIKE '%".$searchText."%' + OR BaseT.PaymentTerms LIKE '%".$searchText."%' + OR BaseT.PaymentDays LIKE '%".$searchText."%' + OR BaseT.PayableAT LIKE '%".$searchText."%')"; $this->db->where($likeCriteria); } //$this->db->where('BaseT.isDeleted', 0); @@ -69,6 +85,39 @@ class supplier_model extends CI_Model * @return array $result : This is user information */ + + function getpayment() + { + $ConfigID = 'C009'; + $this->db->select('ConfigValue'); + $this->db->from('T_ConfigDetails'); + $this->db->where('Config_id ',$ConfigID ); + $query = $this->db->get(); + + return $query->result(); + } + + + function checkPAN($PAN) + { + $this->db->select('PAN'); + $this->db->from('T_SupplierDetailsN'); + $this->db->where('PAN',$PAN); + + $query = $this->db->get(); + + if ($query->num_rows > 0) { + //echo $result->num_rows; + return $query->result_array(); + } + + + //return $query->result(); + } + + + + function addNewsupplier($supplier) { $this->db->trans_start(); @@ -88,7 +137,7 @@ function addNewsupplier($supplier) */ function getuserInfo($supplierID) { - $this->db->select('SupplierID, SupplierName,Address,ContactNumber,AlternateContactNumber,EmailAddress,TIN,PAN,CreatedDate'); + $this->db->select('SupplierID, SupplierName,Address,ContactNumber,AlternateContactNumber,Exiseregistration,EmailAddress,TIN,PAN,,GSTNO,GSTRange,CollectrateAddress,UANumber,PaymentTerms,PaymentDays,PayableAT,CreatedDate'); $this->db->from('T_SupplierDetailsN'); //$this->db->where('isDeleted', 0); //$this->db->where('roleId !=', 1); @@ -121,17 +170,10 @@ function addNewsupplier($supplier) return TRUE; } - /** - * This function is used to delete the user information - * @param number $userId : This is user id - * @return boolean $result : TRUE / FALSE - - function deletePO($PO, $POinfo) - { - $this->db->where('PO', $PO); - $this->db->update('T_PurchaseOrderDetails', $POInfo); - - return $this->db->affected_rows(); - }*/ -} + + + + + + } ?> \ No newline at end of file diff --git a/application/views/addsupplier.php b/application/views/addsupplier.php index 4c3e2382..a2a72400 100644 --- a/application/views/addsupplier.php +++ b/application/views/addsupplier.php @@ -2,15 +2,15 @@

-
SUPPLIER LIST
+
ADD SUPPLIER

-
- Back +
+ Back

@@ -26,64 +26,151 @@
-
+
-
+
+
+ + +
+
+
- +
-
+ +
- - + +
-
-
-
+ + + + +
- +
-
+
- +
-
-
+ + -
+
- +
-
+
+
+ + +
+
+
-
-
- - -
+
- +
+
+
+ + +
+
+ + + +
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+ +
+
+
+

Payment terms

+
+
+ +
+ + +
+ +
+
+
+ Before + +
+
+
+
+ + After + +
+
+ +
+
+ + +
+
+ +
@@ -121,4 +208,106 @@
- \ No newline at end of file + + diff --git a/application/views/supplierListing.php b/application/views/supplierListing.php index 6f84ae18..a89ef827 100644 --- a/application/views/supplierListing.php +++ b/application/views/supplierListing.php @@ -10,7 +10,7 @@
@@ -39,8 +39,16 @@ Contact Number Alternate Contact Number Email Address + Exiseregistration TIN PAN + GSTNO + GSTRange + CollectrateAddress + UANumber + PaymentTerms + PaymentDays + PayableAT Create Date Action @@ -58,8 +66,16 @@ ContactNumber ?> AlternateContactNumber ?> EmailAddress ?> + Exiseregistration ?> TIN ?> PAN ?> + GSTNO ?> + GSTRange ?> + CollectrateAddress ?> + UANumber ?> + PaymentTerms ?> + PaymentDays ?> + PayableAT ?> CreatedDate ?> diff --git a/application/views/viewsupplier.php b/application/views/viewsupplier.php index 43cd23d2..f63463d7 100644 --- a/application/views/viewsupplier.php +++ b/application/views/viewsupplier.php @@ -8,7 +8,13 @@ $AlternateContactNumber = ''; $EmailAddress = ''; $TIN = ''; $PAN = ''; - +$GSTNO = ''; +$GSTRange = ''; +$CollectrateAddress = ''; +$UANumber = ''; +$PaymentTerms = ''; +$PaymentDays = ''; +$PayableAT = ''; if(!empty($supplier)) { foreach ($supplier as $uf) @@ -21,6 +27,13 @@ if(!empty($supplier)) $EmailAddress = $uf->EmailAddress; $TIN = $uf->TIN; $PAN = $uf->PAN; + $GSTNO = $uf->GSTNO; + $GSTRange = $uf->GSTRange; + $CollectrateAddress = $uf->CollectrateAddress; + $UANumber = $uf->UANumber; + $PaymentTerms = $uf->PaymentTerms; + $PaymentDays = $uf->PaymentDays; + $PayableAT = $uf->PayableAT; } } @@ -116,10 +129,44 @@ window.print(); - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +