diff --git a/application/config/routes.php b/application/config/routes.php
index e2645edb..ec54d62e 100644
--- a/application/config/routes.php
+++ b/application/config/routes.php
@@ -79,6 +79,7 @@ $route['emppayListings/(:num)'] = 'emppaydate/emppayListing/$1';
$route['attendance'] = 'monthlypay/attendanceLoad';
$route['publicholidays'] = 'monthlypay/loadPublicholidays';
$route['loanreports'] = 'payslip/loadLoanReport';
+$route['qualityreportlist'] = "quality/reportList";
diff --git a/application/controllers/assetdetails.php b/application/controllers/assetdetails.php
index bc5feafb..895b077f 100644
--- a/application/controllers/assetdetails.php
+++ b/application/controllers/assetdetails.php
@@ -4,15 +4,16 @@ require APPPATH . '/libraries/BaseController.php';
/**
* Class : assetdetails (Asset Details - Controller)
- * User Class to control all user related operations.
+ * Assetdetails Class to control all Asset Details related operations.
* @author : Venba Info Tech
* @version : 1.1
* @since : 18 November 2017
*/
+
class assetdetails extends BaseController
{
/**
- * This is default constructor of the class
+ * default constructor of the class
*/
public function __construct()
{
@@ -21,54 +22,49 @@ class assetdetails extends BaseController
$this->load->library('form_validation');
$this->isLoggedIn();
}
+
/**
- * This function used to load the first screen of the user
+ * default function of the assetdetails class
*/
public function index()
{
- $this->global['pageTitle'] = 'Resico : Asset Details';
-
+ $this->global['pageTitle'] = 'Resico : Asset Details';
$this->loadViews("assetListing", $this->global, NULL , NULL);
}
/**
- * This function is used to load the Supplier list
+ * To load the Asset list
*/
function assetListing()
{
$this->load->model('assetdetails_model');
-
$data['userRecords'] = $this->assetdetails_model->assetListing();
-
$this->global['pageTitle'] = 'Resico : Asset List';
- //print_r($data);die();
$this->loadViews("assetListing", $this->global, $data, NULL);
}
+
/**
- * This function is used to load the add new supplier */
+ * To load the add asset
+ */
function addasset()
{
-
-
+
$data['AssetStatus'] = $this->assetdetails_model->getConfigValue('C015');
$data['po'] = $this->assetdetails_model->getPO();
-
- //print_r($data);die();
- $this->global['pageTitle'] = 'Resico : Add Asset';
-
+ $this->global['pageTitle'] = 'Resico : Add Asset';
$this->loadViews("addasset", $this->global, $data, NULL);
}
-
+ /**
+ * Based on PONO its display relvant material code's are listed in dropdown
+ */
function getpodetails()
{
$PO= $this->input->post('PONO');
-
$data = $this->assetdetails_model->getpodetails($PO);
- //print_r($data);die();
$HTML = "";
if(count($data) > 0)
@@ -78,22 +74,18 @@ class assetdetails extends BaseController
$Code = $data[$j]->LineItemNo;
$Name = $data[$j]->MaterialCode;
-
-
$HTML .="";
}
}
- //echo $HTML;
die(json_encode(array($HTML)));
- //echo json_encode($data);
- //die();
}
-
+
+ /**
+ * Based on PO type its get relvant material code's
+ */
function getline()
{
$line = $this->input->post('line');
-
-
$type = $this->assetdetails_model->gettyp($line);
$data='';
@@ -118,59 +110,52 @@ class assetdetails extends BaseController
}
elseif($data=='CAPITAL'){
$ser = $this->assetdetails_model->getlineitemcap($line);
- }
- //print_r($ser);die();
-
-
- //print_r($data);die();
- //$data = $this->getDateformat($data);
+ };
echo json_encode($ser);
die();
}
- // function getlin(){
- // $line = $this->input->post('line');
-
-
- // }
- /* Validation for Department Dropdown
- */
+
+ /**
+ * Validation for Department Dropdown
+ */
function Department_validate($selectValue)
-{
- //echo 'select_validate method called';
- // 'none' is the first option and the text says something like "-Choose one-"
- if($selectValue == '-1')
- {
- $this->form_validation->set_message('Department_validate', 'Please Select Department.');
- return false;
+ {
+ // 'none' is the first option and the text says something like "-Choose one-"
+ if($selectValue == '-1')
+ {
+ $this->form_validation->set_message('Department_validate', 'Please Select Department.');
+ return false;
+ }
+ else // user picked something
+ {
+ return true;
+ }
}
- else // user picked something
- {
- return true;
- }
-}
-/* Validation for Supplier Dropdown
- */
- function Supplier_validate($selectValue)
-{
- //echo 'select_validate method called';
- // 'none' is the first option and the text says something like "-Choose one-"
- if($selectValue == '-1')
- {
- $this->form_validation->set_message('Supplier_validate', 'Please Select Supplier.');
- return false;
- }
- else // user picked something
- {
- return true;
- }
-}
-/* Validation for Supplier Dropdown
- */
+ /**
+ * Validation for Supplier Dropdown
+ */
+ function Supplier_validate($selectValue)
+ {
+ // 'none' is the first option and the text says something like "-Choose one-"
+ if($selectValue == '-1')
+ {
+ $this->form_validation->set_message('Supplier_validate', 'Please Select Supplier.');
+ return false;
+ }
+ else // user picked something
+ {
+ return true;
+ }
+ }
+
+ /**
+ * Validation for Asset Status Dropdown
+ */
function Asset_validate($selectValue)
-{
+ {
//echo 'select_validate method called';
- // 'none' is the first option and the text says something like "-Choose one-"
+ //'none' is the first option and the text says something like "-Choose one-"
if($selectValue == '-1')
{
$this->form_validation->set_message('Asset_validate', 'Please Select Asset Status.');
@@ -182,13 +167,12 @@ class assetdetails extends BaseController
}
}
/**
- * This function is used to add new user to the system
+ * To add new asset to the system
*/
function addNewasset()
{
$this->form_validation->set_rules('AssetName','AssetName','trim|required');
- //$this->form_validation->set_rules('Description','Description','trim|required');
$this->form_validation->set_rules('Department','Department','trim|callback_Department_validate');
$this->form_validation->set_rules('Location','Location','trim|required');
$this->form_validation->set_rules('User','User','trim|required');
@@ -222,7 +206,6 @@ class assetdetails extends BaseController
if($DateOfCommission != '')
{
$DOCommission= $this->getDateformat($DateOfCommission);
- //$DOCommission= $this->getDateformat($DateOfCommission);
}
$AssetStatus = $this->input->post('AssetStatus');
$Remarks = $this->input->post('Remarks');
@@ -252,7 +235,6 @@ class assetdetails extends BaseController
if($result > 0)
{
- // $this->session->set_flashdata('success', 'New Asset created successfully');
echo "";
redirect('assetListing','refresh');
@@ -267,16 +249,10 @@ class assetdetails extends BaseController
}
}
- /**
- * This function is used load user edit information
- * @param number $userId : Optional : This is user id
- */
-
- /*function ech(){
-
- echo $this->input->post('Asset_Code');
- }*/
+ /**
+ * To edit exists asset details to the system (href link)
+ */
function editOldasset($AssetCode = '',$PO='')
{
@@ -293,30 +269,22 @@ class assetdetails extends BaseController
{
$AssetID = $AssetCode;
}
- //echo $AssetID;
-
$data['assetList'] = $this->assetdetails_model->getAssetDetails($AssetID);
- // $data['SupplierList'] = $this->assetdetails_model->getSupplierName($SupplierName);
- // $data['DepartmentList'] = $this->assetdetails_model->getDepartment($Department);
$data['AssetStatusList'] = $this->assetdetails_model->getConfigValue('C015');
$data['PO'] = $this->assetdetails_model->getPO($PO);
- //print_r($data);die();
$this->global['pageTitle'] = 'Resico : Edit Asset';
-
$this->loadViews("editasset", $this->global, $data,NULL);
}
/**
- * This function is used to edit the user information
+ * To store edited asset data into DB.
*/
function editasset()
{
-
$Asset_Code = $this->input->post('AssetCode');
-
$this->form_validation->set_rules('AssetName','AssetName','trim|required');
$this->form_validation->set_rules('Description','Description','trim|required');
$this->form_validation->set_rules('Department','Department','trim|callback_Department_validate');
@@ -356,7 +324,7 @@ class assetdetails extends BaseController
{
$DOCommission= $this->getDateformat($DateOfCommission);
- //$DOCommission= $this->dateformat($DateOfCommission);
+
}
@@ -399,7 +367,10 @@ class assetdetails extends BaseController
}
}
-
+
+ /**
+ * To convert the dateformat (date with time) and store to DB
+ */
function getDateformat($Val)
{
$date = new DateTime($Val);
@@ -407,7 +378,9 @@ class assetdetails extends BaseController
return $retDate;
}
- //this function used to dateformat to store in db
+ /**
+ * To convert the dateformat (date only) and store to DB
+ */
function dateformat($DateValue)
{
$date = DateTime::createFromFormat('d/m/Y', $DateValue);//we should give the date as per DatePicker format.
@@ -415,15 +388,17 @@ class assetdetails extends BaseController
//if the date picker format is mismatched means it display as invalid date so that we can use this "IF" Conditions (i.e) If the above format returns false then the date is not formatted correctly
if ($date === false) {
return false;
- //return null;
+
}
$retDate = $date->format('Y-m-d'); //in this line using the parsed date., we can create a new formatting for storing value to datebase ("we choosing date value based on datepicker")
- // echo "";
+
return $retDate;
}
-
+ /**
+ * This function is used to export report of asset details in excel
+ */
function export_asset(){
@@ -503,7 +478,7 @@ class assetdetails extends BaseController
$exportData = $this->assetdetails_model->export_excel();
-//print_r($exportData);die();
+
if ($exportData) {
$i = 6;
$s = 1;
@@ -550,6 +525,9 @@ class assetdetails extends BaseController
}
+ /**
+ * To load pagenotfound view
+ */
function pageNotFound()
{
$this->global['pageTitle'] = 'Resico : 404 - Page Not Found';
@@ -558,4 +536,4 @@ class assetdetails extends BaseController
}
}
-?>
\ No newline at end of file
+?>s
\ No newline at end of file
diff --git a/application/controllers/companycontroller.php b/application/controllers/companycontroller.php
index bb7df7a9..b338e7e5 100644
--- a/application/controllers/companycontroller.php
+++ b/application/controllers/companycontroller.php
@@ -4,7 +4,7 @@ require APPPATH . '/libraries/BaseController.php';
/**
* Class : companycontroller (Company Details - Controller)
- * User Class to control all user related operations.
+ * companycontoller Class to control all company details related operations.
* @author :Venba Info Tech - Gandhimathi
* @version : 1.1
* @since : 18 November 2017
@@ -12,26 +12,27 @@ require APPPATH . '/libraries/BaseController.php';
class companycontroller extends BaseController
{
/**
- * This is default constructor of the class
+ * default constructor of the class
*/
public function __construct()
{
parent::__construct();
- $this->load->model('companydetailsmodel');
+ $this->load->model('companydetailsmodel');
$this->isLoggedIn();
}
/**
- * This function used to load the first screen of the user
+ * default function of the companycontroller
*/
public function index()
{
$this->global['pageTitle'] = 'Resico : Company Details';
-
//$this->loadViews("companyadd", $this->global, NULL , NULL);
-
//$this->loadViews("Updatecompany", $this->global,NULL,NULL);
}
+ /**
+ * To load update company
+ */
public function companyview()
{
$this->global['pageTitle'] = 'Resico : Company Details';
@@ -40,20 +41,16 @@ class companycontroller extends BaseController
$data['payment'] = $this->companydetailsmodel->getPaymentTerms();
$data['filenames']=$this->companydetailsmodel->filelist();
$data['bankdetails']=$this->companydetailsmodel->getBankDetails();
- //$data['filetype']=$this->companydetailsmodel->getfilename();
$data['filetype']=$this->companydetailsmodel->getfilename();
$this->loadViews("companyview", $this->global,$data, NULL);
}
- /* this function used to add and update the bank details*/
+ /**
+ * To add and update the bank details
+ */
public function bankdtl()
{
- //$bankname = $this->input->post('id1');
- //$ifsccode = $this->input->post('id2');
- //$bankaddress = $this->input->post('id3');
- //$isactive = $this->input->post('');
-
$id = $this->input->post('id');
$tablevalue = json_decode($id,true);
@@ -75,22 +72,24 @@ class companycontroller extends BaseController
$Bank = array('Bank_name'=>$bankname,'IFSC'=>$ifsccode,'Address'=>$bankaddress,'Is_Active'=>$isactive,'Bank_Accno'=>$bankaccno);
$result = $this->companydetailsmodel->BankDetails($Bank);
- }
-
- //$Bank = array('Bank_name'=>$bankname,'IFSC'=>$ifsccode,'Address'=>$bankaddress);
- //$result = $this->companydetailsmodel->AddBankDetails($Bank);
-
+ }
}
-
+ /**
+ * To load add company
+ *
+ * Note : this function Temporary not in use
+ */
function companyadd(){
$this->global['pageTitle'] = 'Resico : Company Details';
$this->loadViews("companyadd", $this->global, NULL);
}
-
+ /**
+ * To add company revalant files
+ */
function add()
{
$picture = '';
@@ -120,10 +119,14 @@ class companycontroller extends BaseController
}
return $picture ;
- }
+ }
+
+ /**
+ * To Edit company revalant Images
+ */
function editimage($ModifyPictureName)
{
- //$picture = $ModifyPictureName;
+
if(!empty($_FILES['photo']['name']))
{
$config['upload_path'] = 'uploads/images/';
@@ -150,7 +153,11 @@ class companycontroller extends BaseController
}
return $picture ;
- }
+ }
+
+ /**
+ * To add company revalant files
+ */
function addfile()
{
$file = '';
@@ -185,9 +192,11 @@ class companycontroller extends BaseController
return $file ;
}
-
- function checkPanValidate()
- {
+ /**
+ * To check whether PAN already exist or not
+ */
+ function checkPanValidate()
+ {
$PanNo = $this->input->post('panno');
$query = $this->supplier_model->checkPAN($PanNo);
if (count($query)> 0)
@@ -199,9 +208,13 @@ class companycontroller extends BaseController
{
return true;
}
- }
- function deletefile()
- {
+ }
+
+ /**
+ * To delete company revalant files
+ */
+ function deletefile()
+ {
$ID = $this->input->post('id');
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
@@ -213,11 +226,11 @@ class companycontroller extends BaseController
}
-
+ /**
+ * To edit exists Company details
+ */
function UpdateCompany()
{
- //die();
- // $data['payment'] = $this->companydetailsmodel->getpayment();
if($this->isAdmin() == TRUE)
{
$this->loadThis();
@@ -229,22 +242,20 @@ class companycontroller extends BaseController
$PictureName = $this->input->post('Image');
$ModifyPictureName = $this->input->post('ModifyImage');
if ($PictureName != '')
- { //echo 'Exists';
+ {
if(strlen($ModifyPictureName) == 0)
{
- //echo 'Exists But Not replace';
+
$Picture = $PictureName;
}
else
{
- //echo 'Exists But Replace';
- //$Picture = $this->editimage($ModifyPictureName);
$Picture = $this->add($ModifyPictureName);
}
}
else
{
- //echo 'Not Exists';
+
$Picture = $this->add();
}
$file =$this->addfile();
@@ -262,38 +273,22 @@ class companycontroller extends BaseController
$CollectrateAddress = $this->input->post('CollectrateAddress');
$UANumber = $this->input->post('UANumber');
$PaymentId = $this->input->post('paymentid');
- //$Payment = $this->input->post('PaymentTerms');
- //$PaymentDays = $this->input->post('PaymentDays');
- //$PayableAT = $this->input->post('PayableAT');
$createdby = $this->session->userdata ( 'userId' );
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$createddt = $dt->format('Y-m-d H:i:s');
$updatedby = $this->session->userdata ( 'userId' );
$date = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
$updateddt = $date->format('Y-m-d H:i:s');
- //$UpdatedBY = $this->session->userdata ( 'Userid' );
- //$companywebsite = $this->input->post('companywebsite');
- //$ceoname = $this->input->post('ceoname');
- //$mdname = $this->input->post('mdname');
- //$companystartedon = $this->input->post('companystartedon');
- //$partnerdetails = $this->input->post ('partnerdetails');
- $companywebsite = $this->input->post('companywebsite');
- //$ProfilePic = $this->input->post ('ProfilePic');
- //$files = $this->input->post('files');
+ $companywebsite = $this->input->post('companywebsite');
$filedescription1= $this->input->post('filedescription');
- //$files = $this->input->post('filename');
- //$financialstart=$this->input->post('financialstart');
- //$financialend=$this->input->post('financialend');
- $date = new DateTime($this->input->post('financialstart'));
+ $date = new DateTime($this->input->post('financialstart'));
$financialstart = $date->format('Y-m-d H:i:s');
$date2 = new DateTime($this->input->post('financialend'));
$financialend = $date2->format('Y-m-d H:i:s');
$ID= $this->input->post('ID');
- //$createdDate=$this->input->post('createdDate');
-
- //$Company = array('CompID'=>$CompID,'CompanyName'=>$CompanyName,'Address'=>$Address,'ContactNumber'=>$ContactNumber,'AlternateContactNumber'=>$AlternateContactNumber,'EmailAddress'=>$EmailAddress,'TIN'=>$TIN,'PAN'=>$PAN,'GSTNO'=>$GSTNO,'GSTRange'=>$GSTRange,'UANumber'=>$UANumber,'PaymentTerms'=>$Payment ,'PaymentDays'=>$PaymentDays ,'PayableAT'=>$PayableAT ,'Createdby'=>$createdby,'ProfilePic'=>$Picture,'Exiseregistration'=>$Exiseregistration,'CollectrateAddress'=>$CollectrateAddress,'FiscalYearStartOn'=>$financialstart,'FiscalYearEndsOn'=> $financialend);
+
$Company = array('CompID'=>$CompID,'CompanyName'=>$CompanyName,'Address'=>$Address,'ContactNumber'=>$ContactNumber,'AlternateContactNumber'=>$AlternateContactNumber,'EmailAddress'=>$EmailAddress,'TIN'=>$TIN,'PAN'=>$PAN,'GSTNO'=>$GSTNO,'GSTRange'=>$GSTRange,'UANumber'=>$UANumber,'Createdby'=>$createdby,'ProfilePic'=>$Picture,'Exiseregistration'=>$Exiseregistration,'CollectrateAddress'=>$CollectrateAddress,'FiscalYearStartOn'=>$financialstart,'FiscalYearEndsOn'=> $financialend,'paymentID'=>$PaymentId,'companyWebsite'=>$companywebsite,'UpdatedBY'=>$updatedby,'Updatedon'=>$updateddt);
if(!empty($file))
@@ -313,7 +308,6 @@ class companycontroller extends BaseController
}
- // redirect('companyview');
}
}
diff --git a/application/controllers/quality.php b/application/controllers/quality.php
new file mode 100644
index 00000000..fe9dbf2b
--- /dev/null
+++ b/application/controllers/quality.php
@@ -0,0 +1,287 @@
+load->model('quality_model');
+ $this->load->library('form_validation');
+ //$this->load->library('dompdf_gen');
+ $this->isLoggedIn();
+ }
+ /**
+ * This function used to load the first screen of the user
+ */
+ public function index()
+ {
+ $data['products'] = $this->quality_model->getAllprodcuts();
+ $data['customers'] = $this->quality_model->getAllcustomers();
+ $data['existspec'] = $this->quality_model->getAllspec();
+ $this->global['pageTitle'] = 'Resico : Quality Master';
+
+ $this->loadViews("qualitymasterlistview", $this->global, $data , NULL);
+ }
+
+
+ public function reportList()
+ {
+ $data['records'] = $this->quality_model->getTestMasterforList();
+
+ $this->global['pageTitle'] = 'Resico : Quality Master';
+ $this->loadViews("reportmasterlist", $this->global, $data , NULL);
+ }
+
+ function addNewPage()
+ {
+ $data['products'] = $this->quality_model->getAllprodcuts();
+ $data['customers'] = $this->quality_model->getAllcustomers();
+
+ $this->global['pageTitle'] = 'Resico : Quality Master';
+
+ $this->loadViews("qualitymaster", $this->global, $data , NULL);
+ }
+
+ function saveSpectficationData()
+ {
+ $product = $this->input->post('param2');
+ $customer = $this->input->post('param3');
+ $jsondata = $this->input->post('param1');
+ $createdby = $this->session->userdata ( 'userId' );
+ $phpdata = json_decode($jsondata);
+ $total = 0;
+ // echo $product .'-'. $customer;
+ // print_r($phpdata);die();
+
+ foreach($phpdata as $data)
+ {
+ $name = $data->Name;
+ $name = strtoupper($name);
+ $uom = $data->UOM;
+ $min = $data->Min;
+ $max = $data->Max;
+ $temp = $data->Temp;
+ $isExist = $this->quality_model->checkExist($product,$customer,$name);
+ //echo $isExist[0]->count;die();
+ if($isExist[0]->count == 0)
+ {
+
+ $tostore = array('customer_id'=>$customer,'product_id'=>$product,'testtype'=>$name,'uom'=>$uom,'min'=>$min,'max'=>$max,'temp'=>$temp,'created_by'=>$createdby);
+ $res = $this->quality_model->addSpecMast($tostore);
+ //echo 'i'.$res;
+ }
+ else if($isExist[0]->count == 1)
+ {
+
+ $tostore = array('uom'=>$uom,'min'=>$min,'max'=>$max,'temp'=>$temp,'updated_by'=>$createdby);
+ $res = $this->quality_model->updateSpecMast($tostore,$product,$customer,$name);
+ //echo 'u'.$res;
+ }
+
+ $total +=$res;
+ }
+
+ echo $total.'- Specification Saved Successfully';
+ }
+
+ function deleteSpecification()
+ {
+ $spname = $this->input->post('param1');
+ $product = $this->input->post('param2');
+ $customer = $this->input->post('param3');
+ $res = $this->quality_model->deleteSpecification($spname,$product,$customer);
+ if($res == 1)
+ {
+ echo "Deleted Successfully..!";
+ }
+ else
+ {
+ echo "Something Went Wrong..!Try later";
+ }
+
+ }
+
+ function report()
+ {
+
+ $data['records'] = $this->quality_model->getDataforReport();
+ $data['emplist'] = $this->quality_model->getEmplistforReport();
+ $this->global['pageTitle'] = 'Resico : Inspection Report Screen';
+ $this->loadViews("qualityreport", $this->global, $data, NULL);
+ }
+
+ function viewSpec()
+ {
+ $prodcutid = $this->uri->segment(3);
+ $customerid =$this->uri->segment(4);
+ $data['specifications'] = $this->quality_model->getIndividualSpec($prodcutid,$customerid);
+ $this->global['pageTitle'] = 'Resico : View reports Lists';
+
+ $this->loadViews("viewIndSpec", $this->global, $data, NULL);
+
+ }
+
+ function viewIndReport()
+ {
+ $reportid = $this->uri->segment(3);
+
+ $data['reportdata'] = $this->quality_model->getIndividualReportData($reportid);
+ $this->global['pageTitle'] = 'Resico : View Individual Report';
+ $this->loadViews("viewindreport", $this->global, $data, NULL);
+
+ }
+
+ function printReportPDF()
+ {
+
+
+ $reportid = $this->input->post('rid');
+
+ $data['reportdata'] = $this->quality_model->getIndividualReportData($reportid);
+
+ $filename = 'PRE DESPATCH INSPECTION REPORT'.$reportid;
+
+ $html = $this->load->View("viewindreportpdf",$data,true);
+ require APPPATH . '/third_party/mpdf/mpdf.php';
+ $mpdf=new mPDF('utf-8','A4-P',7,10,10, 10, 10, 24, 4, 6);
+ $mpdf->SetDisplayMode('fullpage');
+
+ $mpdf->list_indent_first_level = 1;
+ $mpdf->setAutoTopMargin = 'stretch';
+ $mpdf->setAutoBottomMargin = 'stretch';
+ $mpdf->WriteHTML($html);
+ $mpdf->Output($filename.'.pdf','I');
+
+ }
+
+ function getAllSpecforReport()
+ {
+ $productid = $this->input->post('param1');
+ $customerid = $this->input->post('param2');
+ //echo 'from cn'.$productid.'-'.$customerid;
+ $res = $this->quality_model->getSpecifications($productid,$customerid);
+ echo json_encode($res);
+ }
+
+
+ function saveTestReportData()
+ {
+
+ date_default_timezone_get('Asia/Kolkata');
+ $testjson = $this->input->post('param1');
+ $loijson = $this->input->post('param2');
+ $afsjson = $this->input->post('param3');
+ $invoiceno = $this->input->post('param4');
+ $batchno = $this->input->post('param5');
+ $chart = $this->input->post('param7');
+ $batchno = date_format(date_create($batchno),'Y-m-d');
+
+ $approver = $this->input->post('param6');
+
+ $testphpdata = json_decode($testjson,true);
+ $loiphpdata = json_decode($loijson,true);
+
+ $afsphpdata = json_decode($afsjson,true);
+ //print_r($afsphpdata);die();
+ $createdon = date('Y-m-d H:i:s');
+ $createby = $this->session->userdata ( 'userId' );
+
+ $masterreportdata = array('invoiceid'=>$invoiceno,'batchdate'=>$batchno,'createdby'=>$createby,'createdon'=>$createdon,'approvedby'=>$approver,'chartdata'=>$chart);
+ $MASTERID = $this->quality_model->saveMasterTestData($masterreportdata);
+
+
+
+ $descrition = '';
+ $min = '';
+ $max = '';
+ $uom = '';
+ $act1 = '';
+ $act2 = '';
+ $act3 = '';
+ $average = '';
+ $results = '';
+ $remarks1 = '';
+ foreach($testphpdata as $data)
+ {
+ //print_r($data);die();
+ $descrition = $data['Description'];
+ $min = $data['SpecificationMin'];
+ $max = $data['SpecificationMax'];
+ $uom = $data['SpecificationUOM'];
+ $act1 = $data['ACT X1'];
+ $act2 = $data['ACT X2'];
+ $act3 = $data['ACT X3'];
+ $average = $data['Average'];
+ $results = $data['Results'];
+ $remarks1 = $data['Remarks'];
+ $testreportdata = array('testreport_id'=>$MASTERID,'description'=>$descrition,'min'=>$min,'max'=>$max,'UOM'=>$uom,'act1'=>$act1,'act2'=>$act2,'act3'=>$act3,'average'=>$average,'result'=>$results,'remarks'=>$remarks1);
+ $reportid = $this->quality_model->saveTestReportData($testreportdata);
+ }
+
+
+ $start = '';
+ $end = '';
+ $temp = '';
+ $w1 = '';
+ $w2 = '';
+ $w3 = '';
+ $loip = '';
+ $remark = '';
+ foreach($loiphpdata as $loi)
+ {
+ $start = $loi['Heating Timestart'];
+ $end = $loi['Heating Timeend'];
+ $temp = $loi['Temp *c'];
+ $w1 = $loi['Crucible Weight w1(g)'];
+ $w2 = $loi['Before Heatingw2(g)'];
+ $w3 = $loi['After Heatingw3(g)'];
+ $loip = $loi['L.O.I %'];
+ $remark = $loi['Remarks'];
+ //echo $loip;
+ //echo $remark;die();
+ $loitabledata = array('testreport_id'=>$MASTERID,'start_time'=>$start,'end_time'=>$end,'temp'=>$temp,'w1'=>$w1,'w2'=>$w2,'w3'=>$w3,'loi_percentage'=>$loip,'remarks'=>$remark);
+ $loiid = $this->quality_model->saveTestReportLOIData($loitabledata);
+
+ }
+
+ $count =0;
+ foreach($afsphpdata as $afs)
+ {
+ $count++;
+ if($count != 12){
+ $ssize = $afs['Sieve Size µm'];
+ $sandweight = $afs['Sand Weight'];
+ $Percentage = $afs['Percentage'];
+ $Multiplier = $afs['Multiplier'];
+ $Product = $afs['Product'];
+ $afstabledata = array('testreport_id'=>$MASTERID,'sieve_size'=>$ssize,'sandweight'=>$sandweight,'percentage'=>$Percentage,'multiplier'=>$Multiplier,'product'=>$Product);
+ $afsid = $this->quality_model->saveTestReportAFSData($afstabledata);
+ }
+ }
+
+ echo "Report Data Saved Successfully!";
+
+
+ }
+
+ function pageNotFound()
+ {
+ $this->global['pageTitle'] = 'Resico : 404 - Page Not Found';
+
+ $this->loadViews("404", $this->global, NULL, NULL);
+ }
+}
+
+?>
\ No newline at end of file
diff --git a/application/controllers/supplier.php b/application/controllers/supplier.php
index 23c3f9a0..a399245a 100644
--- a/application/controllers/supplier.php
+++ b/application/controllers/supplier.php
@@ -4,15 +4,16 @@ require APPPATH . '/libraries/BaseController.php';
/**
* Class : supplier (Supplier Details - Controller)
- * User Class to control all user related operations.
+ * Supplier Class to control all Supplier related operations.
* @author :Venba Info Tech - Gandhimathi
* @version : 1.1
* @since : 18 November 2017
*/
+
class supplier extends BaseController
{
/**
- * This is default constructor of the class
+ * default constructor of the class
*/
public function __construct()
{
@@ -23,18 +24,19 @@ class supplier extends BaseController
$this->load->library('Excel');
$this->isLoggedIn();
}
+
/**
- * This function used to load the first screen of the user
+ * default function of the supplier class
*/
public function index()
{
$this->global['pageTitle'] = 'Resico : Supplier';
-
+ //Load the view supplierListing.php
$this->loadViews("supplierListing", $this->global, NULL , NULL);
}
/**
- * This function is used to load the Supplier list
+ * To load the Supplier list
*/
function supplierListing()
{
@@ -45,46 +47,72 @@ class supplier extends BaseController
$this->global['pageTitle'] = 'Resico : Supplier Listing';
+ if($this->role == ROLE_ADMIN || $this->DEPCode == SALES || $this->DEPCode == FINANCE ||$this->DEPCode == HR)
+ {
+
+ if($this->DEPCode != FINANCE && $this->DEPCode != HR)
+ {
+ //Load the view supplierListing.php
$this->loadViews("supplierListing", $this->global, $data, NULL);
+
+ }
+ }
+
+ else
+ {
+ //Load the view access.php
+ $this->loadViews("access", $this->global, $data, NULL);
+ }
}
+
/**
- * This function is used to load the add new supplier */
+ * To load the add new supplier
+ */
function addsupplier()
{
- //$data['payment'] = $this->supplier_model->getpayment();
- $data['payment'] = $this->supplier_model->getPaymentTerms();
- //$data['users'] = $this->purchaseorder_model->getusers();
-
- $this->global['pageTitle'] = 'Resico : Add New Supplier';
+ $data['payment'] = $this->supplier_model->getPaymentTerms();
+ $this->global['pageTitle'] = 'Resico : Add New Supplier';
+ if($this->role == ROLE_ADMIN || $this->DEPCode == SALES || $this->DEPCode == FINANCE ||$this->DEPCode == HR)
+ {
- $this->loadViews("addsupplier", $this->global,$data, NULL);
+ if($this->DEPCode != FINANCE && $this->DEPCode != HR)
+ {
+ //Load the view addsupplier.php
+ $this->loadViews("addsupplier", $this->global,$data, NULL);
+
+ }
+ }
+
+ else
+ {
+ //Load the view access.php
+ $this->loadViews("access", $this->global,$data, NULL);
+ }
}
- /**
- * This function is used to check whether PAN already exist or not
- */
-
- function CheckPAN()
+
+ /**
+ * To check whether PAN already exist or not
+ */
+ function CheckPAN()
{
- $id = $this->input->post('id');
-
- $query = $this->supplier_model->checkPAN($id );
-
+ $id = $this->input->post('id');
+ $query = $this->supplier_model->checkPAN($id);
$query = $query[0]['PAN'];
-
print_r($query);
}
- /* To Check the Pan Number is exists in the database or not for the selected Supplier */
+ /**
+ * To Check the Pan Number is exists in the database or not for the selected Supplier
+ */
function checkPanValidateSupplier() {
$SupplierID = $this->input->post('SupplierID');
$PanNo = $this->input->post('panno');
- // echo 'Sup'. $SupplierID ;
$query = $this->supplier_model->checkPAN($PanNo,$SupplierID);
if (count($query)> 0)
{
@@ -97,13 +125,13 @@ class supplier extends BaseController
}
}
- /* To Check the Pan Number is exists in the database or not */
+ /**
+ * To Check the Pan Number is exists in the database or not
+ */
function checkPanValidate()
{
- // alert('validation pan');
-
+
$PanNo = $this->input->post('panno');
-
$query = $this->supplier_model->checkPAN($PanNo);
if (count($query)> 0)
{
@@ -117,24 +145,25 @@ class supplier extends BaseController
}
-
- function CheckGST()
- {
- //alert('check validation GST');
+ /**
+ * To check whether GST Number already exist or not
+ */
+ function CheckGST()
+ {
+
$id = $this->input->post('id');
$query = $this->supplier_model->checkGST($id);
$query = $query[0]['GSTNO'];
print_r($query);
-
- }
+ }
-
- /* To Check the GST Number is exists in the database or not for the selected Supplier */
- function checkGstValidateSupplier() {
- //alert(' gst validation GST');
+ /**
+ * To Check the GST Number is exists in the database or not for the selected Supplier
+ */
+ function checkGstValidateSupplier()
+ {
$SupplierID = $this->input->post('SupplierID');
$GstNo = $this->input->post('GSTNo');
- //echo 'Sup'. $SupplierID ;
$query = $this->supplier_model->checkGST($GstNo,$SupplierID);
if (count($query)> 0)
{
@@ -148,7 +177,9 @@ class supplier extends BaseController
}
- /* To Check the GST Number is exists in the database or not */
+ /**
+ * To Check the GST Number is exists in the database or not
+ */
function checkGstValidate()
{
@@ -167,7 +198,7 @@ class supplier extends BaseController
/**
- * This function is used to add new Supplier to the system
+ * To add new Supplier
*/
function addNewsupplier()
{
@@ -215,9 +246,7 @@ class supplier extends BaseController
$CSTDate = null;
}
else{
-
- //$CSTDate = $this->dateformat($CSTDt);
- $CSTDate = $this->getDateformat($CSTDt);
+ $CSTDate = $this->getDateformat($CSTDt);
}
}
else{
@@ -264,6 +293,9 @@ class supplier extends BaseController
}
+ /**
+ * To Convert the dateformat (date with time) and stored into DB
+ */
function getDateformat($Val)
{
$date = new DateTime($Val);
@@ -271,7 +303,9 @@ class supplier extends BaseController
return $retDate;
}
- //this function used to dateformat to store in db
+ /**
+ * To Convert the dateformat (date only) and stored into DB
+ */
function dateformat($DateValue)
{
$date = DateTime::createFromFormat('d/m/Y', $DateValue);//we should give the date as per DatePicker format.
@@ -279,24 +313,23 @@ class supplier extends BaseController
//if the date picker format is mismatched means it display as invalid date so that we can use this "IF" Conditions (i.e) If the above format returns false then the date is not formatted correctly
if ($date === false) {
return false;
- //return null;
+
}
$retDate = $date->format('Y-m-d'); //in this line using the parsed date., we can create a new formatting for storing value to datebase ("we choosing date value based on datepicker")
- // echo "";
return $retDate;
}
/**
- * This function is used to edit the Supplier information
+ * To store edited Supplier information into DB
*/
function editsupplier()
- { $pan = $this->input->post('panno');
+ {
+ $pan = $this->input->post('panno');
$this->form_validation->set_rules('SupplierName','Supplier Name','trim|required');
$this->form_validation->set_rules('Address','Address','trim|required|');
$supplierID = $this->input->post('SupplierID');
- //echo 'supID' . $supplierID ;
$this->form_validation->set_rules('ContactNumber','Contact Number','trim|required|max_length[13]');
$this->form_validation->set_rules('AlternateContactNumber','Alternate Contact Number','trim|max_length[13]');
$this->form_validation->set_rules('emailid','emailid','valid_email|max_length[128]|required');
@@ -334,7 +367,6 @@ class supplier extends BaseController
$CollectrateAddress = $this->input->post('CollectrateAddress');
$UANumber = $this->input->post('UANumber');
$PaymentTerms = $this->input->post('paymentname');
- //print_r($PaymentTerms);
$UpdatedBy = $this->session->userdata ( 'userId' );
$chked = $this->input->post('isactive');
@@ -351,7 +383,7 @@ class supplier extends BaseController
$CSTDt = $this->input->post('dateofCST');
if($CSTDt != '')
- {//$CSTDate = $this->dateformat($CSTDt);
+ {
$CSTDate = $this->getDateformat($CSTDt);
}
else
@@ -374,8 +406,7 @@ class supplier extends BaseController
$PaymentId = $this->input->post('paymentid');
$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,'PaymentID'=>$PaymentId,'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); //'PaymentTerms'=>$PaymentTerms,'PaymentDays'=>$Payment);
- //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);
+ $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,'PaymentID'=>$PaymentId,'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);
$result = $this->supplier_model->UpdateSupplier($supplier, $supplierID);
@@ -397,7 +428,10 @@ class supplier extends BaseController
}
- function viewsupplier($SID = '')
+ /**
+ * To view the Supplier information and load's the edit supplier screen
+ */
+ function viewusupplier($SID = '')
{
$Payment = '';
if($SID == '')
@@ -413,15 +447,30 @@ class supplier extends BaseController
$data['supplier'] = $this->supplier_model->getSupplierInfo($supplierID);
- //$data['payment'] = $this->supplier_model->getpayment($Payment );
$data['payment'] = $this->supplier_model->getPaymentTerms($Payment);
$this->global['pageTitle'] = 'Resico : Edit Supplier';
+ if($this->role == ROLE_ADMIN || $this->DEPCode == SALES || $this->DEPCode == FINANCE ||$this->DEPCode == HR)
+ {
+
+ if($this->DEPCode != FINANCE && $this->DEPCode != HR)
+ {
+ //Load the view editSupplier.php
+ $this->loadViews("editSupplier", $this->global,$data, NULL);
- $this->loadViews("editSupplier", $this->global,$data, NULL);
+ }
+ }
+
+ else
+ {
+ //Load the view access.php
+ $this->loadViews("access", $this->global,$data, NULL);
+ }
}
- /** this function can be use for excel report **/
+ /**
+ * This function is used to export report of supplier details in excel
+ */
function export_supplierdetails(){
@@ -430,8 +479,7 @@ class supplier extends BaseController
$this->excel->setActiveSheetIndex(0)->getStyle('J3')->getAlignment()->applyFromArray(array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,));
$this->excel->getActiveSheet()->setTitle('Supplier details');
-
- $this->excel->getActiveSheet()->setCellValue('J3', 'Resico INDUSTRIES Supplier Details');
+ $this->excel->getActiveSheet()->setCellValue('J3', 'RESICO INDUSTRIES Supplier Details');
$this->excel->getActiveSheet()->setCellValue('A5', 'SupplierID');
$this->excel->getActiveSheet()->setCellValue('B5', 'SupplierName');
@@ -579,11 +627,13 @@ class supplier extends BaseController
}
-
+ /**
+ * To load pagenotfound view
+ */
function pageNotFound()
{
$this->global['pageTitle'] = 'Resico : 404 - Page Not Found';
-
+ //Load the view 404.php
$this->loadViews("404", $this->global, NULL, NULL);
}
}
diff --git a/application/models/assetdetails_model.php b/application/models/assetdetails_model.php
index e15251de..a1181fbd 100644
--- a/application/models/assetdetails_model.php
+++ b/application/models/assetdetails_model.php
@@ -4,10 +4,7 @@ class assetdetails_model extends CI_Model
{
/**
- * This function is used to get the user listing count
- * @param string $searchText : This is optional search text
- * @param number $page : This is pagination offset
- * @param number $segment : This is pagination limit
+ * To get the Asset data for listing
* @return array $result : This is result
*/
function assetListing()
@@ -16,19 +13,23 @@ class assetdetails_model extends CI_Model
$this->db->from('T_Asset_Details asd');
$this->db->join('T_DepartmentDetails dep', ' dep.DEPCode = asd.DEPCode','left');
$this->db->join ('T_SupplierDetailsN sup','sup.SupplierID = asd.SupplierCode','left');
-
-
$query = $this->db->get();
-
$result = $query->result();
return $result;
}
-
+ /**
+ * To get the actived department information
+ * @param $Department : Optional : To get department code
+ * @return $query->result() : This is result of the query (department information)
+ *
+ * Note : This function Temporary not in use
+ */
+
function getDepartment($Department = '')
{
$this->db->select('DEPCode,DepartmentName');
- $this->db->from('T_DepartmentDetails');
+ $this->db->from('T_DepartmentDetails');
$this->db->where('IsActive',1 );
if($Department != '')
{
@@ -39,6 +40,11 @@ class assetdetails_model extends CI_Model
return $query->result();
}
+ /**
+ * To get the actived supplier information
+ * @param $SupplierID : Optional : To get Supplier id
+ * @return $query->result() : This is result of the query (supplier information)
+ */
function getSupplierName($SupplierID = '')
{
$this->db->select('SupplierID, SupplierName');
@@ -51,52 +57,89 @@ class assetdetails_model extends CI_Model
$query = $this->db->get();
return $query->result();
- }
- function getpodetails($PO){
-
-
- $this->db->distinct();
+ }
+
+ /**
+ * To get the MRIR Approved PO details
+ * @param $PO : To get PO number from the controller
+ * @return $query->result() : This is result of the query (po details)
+ */
+
+ function getpodetails($PO)
+ {
+
+ $this->db->distinct();
$this->db->select('POM.PONO,POM.SupplierID,POL.MaterialCode,DeliveryDate,PODate,sup.SupplierName,POL.LineItemNo');
$this->db->from('T_PurchaseOrder_Master POM');
$this->db->join('T_PurchaseOrder_LineItem POL', 'POL.PONO = POM.PONO');
$this->db->join('T_SupplierDetailsN sup', 'sup.SupplierID = POM.SupplierID');
$this->db->where('POM.status',MRIR_APPROVED);
if(!empty($PO)){
- $this->db->where('POM.PONO',$PO);
-
+ $this->db->where('POM.PONO',$PO);
}
$query = $this->db->get();
- //print_r($this->db->last_query());
return $query->result();
}
+
+ /**
+ * To get the MRIR Approved PO number (listed on dropdown)
+ * @param $PO :Optional : To get PO number
+ * @return $query->result() : This is result of the query (po no)
+ */
function getPO($PO='')
{
- $this->db->distinct();
- $this->db->select(' POM.PONO');//,DeliveryDate,PODate,sup.SupplierName,POM.SupplierID');
+ $this->db->distinct();
+ $this->db->select(' POM.PONO');
$this->db->from('T_PurchaseOrder_Master POM');
- //$this->db->join ('T_PurchaseOrder_LineItem POL ',' POL.PONO = POM.PONO');
- //$this->db->join ('T_SupplierDetailsN sup ',' sup.SupplierID = POM.SupplierID');
- $this->db->where('POM.status',MRIR_APPROVED);
- $this->db->where('POM.POType','CAPITAL');
+ $this->db->where('POM.status',MRIR_APPROVED);
+ $this->db->where('POM.POType','CAPITAL');
if(!empty($PO)){
$this->db->where('POM.PONO',$PO);
}
- $query = $this->db->get();
- //print_r($this->db->last_query());
+ $query = $this->db->get();
return $query->result();
}
+
+ /**
+ * To get the PO lineitem details for revenue po.
+ * @param $line : To get PO lineitem number from the controller
+ * @return $result : This is result of the query (po lineitem no)
+ */
function getlineitemre($line){
$this->db->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POL.Quantity,POM.POType,re.TotalValue,req.ReqNo,emp.firstname,emp.Departmentcode,dep.DepartmentName,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID');
$this->db->from('T_PurchaseOrder_LineItem POL');
$this->db->join('T_Requestion_Master req','req.ReqNo = POL.ReqNo','left');
$this->db->join('T_PurchaseOrder_Master POM','POM.PONO=POL.PONO','left');
+ $this->db->join('T_MaterialMaster MM','MM.MaterialCode = POL.MaterialCode','left');
+ $this->db->join('T_Employee_Details emp','emp.EmpID = req.Requestedby','left');
+ $this->db->join('T_DepartmentDetails dep','dep.DEPCode = emp.Departmentcode','left');
+ $this->db->join('T_Revenue_Tax re','re.LineItemNo = POL.LineItemNo','left');
+ $this->db->join('T_SupplierDetailsN sup','sup.SupplierID = POM.SupplierID','left');
+ $this->db->where('POL.LineItemNo',$line);
+
+ $query = $this->db->get();
+
+ $result = $query->result();
+ return $result;
+ }
+
+ /**
+ * To get the PO lineitem details for service po.
+ * @param $line : To get PO lineitem number from the controller
+ * @return $result : This is result of the query (po lineitem no)
+ */
+ function getlineitemser($line){
+ $this->db->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,ser.TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID');
+ $this->db->from('T_PurchaseOrder_LineItem POL');
+ $this->db->join('T_Requestion_Master req','req.ReqNo = POL.ReqNo','left');
+ $this->db->join('T_PurchaseOrder_Master POM','POM.PONO=POL.PONO','left');
$this->db->join ('T_MaterialMaster MM','MM.MaterialCode = POL.MaterialCode','left');
- $this->db->join('T_Employee_Details emp','emp.EmpID = req.Requestedby','left');
- $this->db->join('T_DepartmentDetails dep','dep.DEPCode = emp.Departmentcode','left');
- $this->db->join ('T_Revenue_Tax re','re.LineItemNo = POL.LineItemNo','left');
- $this->db->join('T_SupplierDetailsN sup','sup.SupplierID = POM.SupplierID','left');
- $this->db->where('POL.LineItemNo',$line);
+ $this->db->join('T_Employee_Details emp','emp.EmpID = req.Requestedby','left');
+ $this->db->join('T_DepartmentDetails dep','dep.DEPCode = emp.Departmentcode','left');
+ $this->db->join ('T_Service_Tax ser','ser.LineItemNo = POL.LineItemNo','left');
+ $this->db->join('T_SupplierDetailsN sup','sup.SupplierID = POM.SupplierID','left');
+ $this->db->where('POL.LineItemNo',$line);
$query = $this->db->get();
@@ -104,23 +147,11 @@ class assetdetails_model extends CI_Model
return $result;
}
- function getlineitemser($line){
- $this->db->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,ser.TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID');
- $this->db->from('T_PurchaseOrder_LineItem POL');
- $this->db->join('T_Requestion_Master req','req.ReqNo = POL.ReqNo','left');
- $this->db->join('T_PurchaseOrder_Master POM','POM.PONO=POL.PONO','left');
- $this->db->join ('T_MaterialMaster MM','MM.MaterialCode = POL.MaterialCode','left');
- $this->db->join('T_Employee_Details emp','emp.EmpID = req.Requestedby','left');
- $this->db->join('T_DepartmentDetails dep','dep.DEPCode = emp.Departmentcode','left');
- $this->db->join ('T_Service_Tax ser','ser.LineItemNo = POL.LineItemNo','left');
- $this->db->join('T_SupplierDetailsN sup','sup.SupplierID = POM.SupplierID','left');
- $this->db->where('POL.LineItemNo',$line);
-
- $query = $this->db->get();
-
- $result = $query->result();
- return $result;
- }
+ /**
+ * To get the PO lineitem details for import po.
+ * @param $line : To get PO lineitem number from the controller
+ * @return $result : This is result of the query (po lineitem no)
+ */
function getlineitemimport($line){
$this->db->select('POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,ser.TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID');
$this->db->from('T_PurchaseOrder_LineItem POL');
@@ -139,6 +170,11 @@ class assetdetails_model extends CI_Model
return $result;
}
+ /**
+ * To get the PO lineitem details for capital po.
+ * @param $line : To get PO lineitem number from the controller
+ * @return $result : This is result of the query (po lineitem no)
+ */
function getlineitemcap($line){
$sql="SELECT POL.LineItemNo,POL.MaterialCode,MM.MaterialName,MM.UOM,POM.POType,POL.Quantity,sum(coalesce(ser.TotalValue,0) + coalesce((POL.Quantity*POL.Rate*POM.ExchangeRate),0)) as TotalValue,req.ReqNo,emp.firstname,dep.DepartmentName,emp.Departmentcode,sup.SupplierName,date(POM.DeliveryDate) as DeliveryDate,POM.PODate,POM.SupplierID
@@ -156,6 +192,12 @@ class assetdetails_model extends CI_Model
return $query->result();
}
+
+ /**
+ * To get the PO lineitem details revalant po.
+ * @param $type : To get PO type from the controller
+ * @return $result : This is result of the query (po lineitem no)
+ */
function gettyp($type)
{
$this->db->select('POM.POType,POL.LineItemNo');
@@ -167,9 +209,12 @@ class assetdetails_model extends CI_Model
$result = $query->result();
return $result;
}
- /**
- * This function is used to get the Config value from configuration table
- * @return array $result : This is result of the query
+
+ /**
+ * To get the Config value from configuration table
+ * @param $ConfigID : To get Configid from the controller
+ * @param $ConfigValue : Optional : To get PO type
+ * @return array $query->result() : This is result of the query(config details)
*/
function getConfigValue($ConfigID ,$ConfigValue = '')
{
@@ -187,61 +232,69 @@ class assetdetails_model extends CI_Model
}
/**
- * This function used to get user information by id
- * @param number $userId : This is user id
- * @return array $result : This is user information
+ * To Store the values
+ * @param number $asset : To get all the information of asset from the controller
+ * @return $Asset_Code : This will return how many value are inserted (return as number/count)
*/
-
-function addNewasset($asset)
+ function addNewasset($asset)
{
$this->db->trans_start();
$this->db->insert('T_Asset_Details', $asset);
-
- //$Asset_Code = $this->db->insert_id();
$Asset_Code = $this->db->affected_rows();
-
$this->db->trans_complete();
-
return $Asset_Code;
}
/**
- * This function used to get Asset details by Asset Code
- * @param number $Asset_Code : This is AssetCode
- * @return array $result : This is Asset information
+ * To get Asset details on respective Asset Code
+ * @param number $Asset_Code : To get asset code from the controller
+ * @return array $query->result() : This is result of the query(asset data)
*/
function getAssetDetails($Asset_Code)
{
- //echo $Asset_Code;
$this->db->select('Asset.*,POM.DeliveryDate,Dep.DepartmentName as DepartmentName,MM.MaterialName,MM.UOM,Supp.SupplierName as SupplierName');
$this->db->from('T_Asset_Details Asset');
- $this->db->join('T_DepartmentDetails Dep', 'Asset.DEPCode = Dep.DEPCode','left');
- $this->db->join('T_SupplierDetailsN Supp', 'Asset.SupplierCode = Supp.SupplierID','left');
- $this->db->join('T_MaterialMaster MM ', 'MM.MaterialCode = Asset.MaterialCode','left');
- $this->db->join('T_PurchaseOrder_Master POM','POM.PONO = Asset.PONO','left');
+ $this->db->join('T_DepartmentDetails Dep', 'Asset.DEPCode = Dep.DEPCode','left');
+ $this->db->join('T_SupplierDetailsN Supp', 'Asset.SupplierCode = Supp.SupplierID','left');
+ $this->db->join('T_MaterialMaster MM ', 'MM.MaterialCode = Asset.MaterialCode','left');
+ $this->db->join('T_PurchaseOrder_Master POM','POM.PONO = Asset.PONO','left');
$this->db->where('Asset.AssetCode', $Asset_Code);
$query = $this->db->get();
- //print_r($this->db->last_query());
return $query->result();
- }
+ }
+
+ /**
+ * To Stored edited Asset details in respective Asset Code
+ * @param number $asset : To get all the information of asset from the controller
+ * @param number $Asset_Code : To get asset code from the controller
+ */
function editasset($asset, $Asset_Code)
{
$this->db->where('AssetCode', $Asset_Code);
$this->db->update('T_Asset_Details', $asset);
- //print_r($this->db->last_query());
return TRUE;
}
-
+ /**
+ * To Stored edited Asset details in respective Asset Code
+ * @param number $asset : To get all the information of asset from the controller
+ * @param number $Asset_Code : To get asset code from the controller
+ *
+ * Note : This function Temporary not in use
+ */
function viewasset($asset, $Asset_Code)
{
$this->db->where('AssetCode', $Asset_Code);
$this->db->update('T_Asset_Details', $asset);
return TRUE;
- }
+ }
+
+ /**
+ * To get Asset's information for export xl
+ */
function export_excel(){
$this->db->select('det.*,dep.DepartmentName as DEPCode,sup.SupplierName,MM.MaterialName,emp.firstname,emp1.firstname as Updated_By');
diff --git a/application/models/companydetailsmodel.php b/application/models/companydetailsmodel.php
index 47235283..e5bdc89f 100644
--- a/application/models/companydetailsmodel.php
+++ b/application/models/companydetailsmodel.php
@@ -2,13 +2,11 @@
class companydetailsmodel extends CI_Model
{
- /**
- * This function is used to get the user listing count
- * @param string $searchText : This is optional search text
- * @return number $count : This is row count
+ /**
+ * To Store the values
+ * @param number $Company : To get all the information of company
+ * @return $CompID : This will return how many value are inserted (return as number/count)
*/
-
- //inserted data into companydetails table//
function Companyadd($Company)
{
$this->db->insert('T_Company_Details', $Company);
@@ -16,8 +14,11 @@ class companydetailsmodel extends CI_Model
return $Company;
}
-
- //inserted data into file table//
+ /**
+ * To Store the values
+ * @param number $myfile : To get all the information of company's file
+ * @return $CompID : This will return how many value are inserted (return as number/count)
+ */
function filedetails($myfile)
{
$this->db->insert('file',$myfile);
@@ -26,7 +27,10 @@ class companydetailsmodel extends CI_Model
}
- //for listing file//
+ /**
+ * To get the company files for listing
+ * @return array $query->result() : This is result of the query (company files's information)
+ */
function filelist()
{
$sql=" select ID,filename,filedescription,createdDate from file where isDeleted IS NULL OR isDeleted=0";
@@ -35,7 +39,12 @@ class companydetailsmodel extends CI_Model
}
- //for deleting file//
+ /**
+ * To update the company files as inactive(if deleted means)
+ * @param number $ID :
+ * @param number $userInfo : To get all the information of company's files
+ * @return array $this->db->affected_rows() : This will return how many value are changed (return as number/count)
+ */
function deletefile($ID,$userInfo)
{
$this->db->where('ID', $ID);
@@ -44,7 +53,13 @@ class companydetailsmodel extends CI_Model
}
-
+ /**
+ * To update the company related information
+ * @param number $compID :
+ * @param number $Comp : To get all the information of company's files
+ * @return array $this->db->affected_rows() : This will return how many value are changed (return as number/count)
+ */
+
function Updatecompany($Comp, $CompID)
{
$this->db->where('CompID', $CompID);
diff --git a/application/models/quality_model.php b/application/models/quality_model.php
new file mode 100644
index 00000000..7482470f
--- /dev/null
+++ b/application/models/quality_model.php
@@ -0,0 +1,226 @@
+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 getAllcustomers()
+ {
+ $this->db->select('client_id,client_name');
+ $this->db->from('ip_clients');
+ $result = $this->db->get();
+ return $result->result();
+ }
+
+ function checkExist($product,$customer,$name)
+ {
+ $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);
+ $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)
+ {
+ //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->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');
+ $result = $this->db->get();
+ return $result->result();
+ }
+
+
+ function getIndividualSpec($prodcutid,$customerid)
+ {
+ $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);
+ $result = $this->db->get();
+ return $result->result();
+ }
+
+
+ function deleteSpecification($spname,$product,$customer)
+ {
+ $this->db->where("testtype", $spname);
+ $this->db->where("product_id", $product);
+ $this->db->where("customer_id", $customer);
+ $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)',NULL,false);
+ $this->db->order_by('ip_invoices.invoice_number','desc');
+ $res = $this->db->get();
+ return $res->result();
+ }
+
+ function getSpecifications($productid,$customerid)
+ {
+ $this->db->where('product_id',$productid);
+ $this->db->where('customer_id',$customerid);
+ $res = $this->db->get('T_Prodcut_Specification_Master');
+ return $res->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 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 getTestMasterforList()
+ {
+ $this->db->select('T_Test_Report_Master.testreport_id,T_Test_Report_Master.invoiceid,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();
+ }
+}
+?>
+
\ No newline at end of file
diff --git a/application/models/supplier_model.php b/application/models/supplier_model.php
index 1c57e8c3..5791007a 100644
--- a/application/models/supplier_model.php
+++ b/application/models/supplier_model.php
@@ -3,11 +3,8 @@
class supplier_model extends CI_Model
{
- /**
- * This function is used to get the user listing count
- * @param string $searchText : This is optional search text
- * @param number $page : This is pagination offset
- * @param number $segment : This is pagination limit
+ /**
+ * To get the Supplier Information for listing
* @return array $result : This is result
*/
function supplierListing()
@@ -15,20 +12,17 @@ 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.CreatedOn,BaseT.PaymentID,pmt.PaymentTerms,BaseT.CSTDate');//,BaseT.PaymentTerms,BaseT.PaymentDays,BaseT.PayableAT,pmt.Details');
$this->db->from('T_SupplierDetailsN as BaseT');
$this->db->join('T_PaymentTerms as pmt', 'pmt.PaymentID = BaseT.PaymentID','left');
-
$query = $this->db->get();
-
$result = $query->result();
return $result;
}
- /**
- * This function used to get user information by id
- * @param number $userId : This is user id
- * @return array $result : This is user information
+
+ /**
+ * To get Config information by config id and config value
+ * @param number $Configvalue :Optional : To get config value
+ * @return $query->result() : This is result of the query (config information)
*/
-
-
- function getpayment($Configvalue = '')
+ function getpayment($Configvalue = '')
{
$ConfigID = 'C009';
$this->db->select('ConfigValue');
@@ -39,37 +33,51 @@ class supplier_model extends CI_Model
$this->db->where('ConfigValue !=',$Configvalue );
}
$query = $this->db->get();
-
return $query->result();
}
- function getPaymentTerms($payment = '')
+ /**
+ * To get Payment information
+ * @param number $payment :Optional : To get payment value
+ * @return array $result : This is result of the query(payment information)
+ */
+ function getPaymentTerms($payment = '')
{
$this->db->select('*');
$this->db->from('T_PaymentTerms');
- $query = $this->db->get();
- $result = $query->result();
- return $result;
+ $query = $this->db->get();
+ $result = $query->result();
+ return $result;
}
- function checkPAN($PAN,$SID = '')
+ /**
+ * To Check PAN number is already exists are not
+ * @param number $SID : Optional:To get Supplier ID
+ * @param number $PAN : To get PAN number from the controller - for check purpose if already exists are not
+ * @return $query->result_array() : This is result of the query (PAN Number information based on supplier ID)
+ */
+ function checkPAN($PAN,$SID = '')
{
$this->db->select('PAN');
$this->db->from('T_SupplierDetailsN');
$this->db->where('PAN',$PAN);
- if ($SID != '')
+ if ($SID != '')
{
$this->db->where('SupplierID !=',$SID);
}
$query = $this->db->get();
- //print_r($this->db->last_query());
if ($query->num_rows > 0) {
- //echo $result->num_rows;
return $query->result_array();
}
}
+ /**
+ * To Check GST number is already exists are not
+ * @param number $SID :Optional: To get Supplier ID
+ * @param number $GST : To get GST number from the controller - for check purpose if already exists are not
+ * @return $query->result_array() : This is result of the query (This is GST Number information based on supplier ID)
+ */
function checkGST($GST,$SID = '')
{
$this->db->select('GSTNO');
@@ -80,50 +88,44 @@ class supplier_model extends CI_Model
$this->db->where('SupplierID !=',$SID);
}
$query = $this->db->get();
- //print_r($this->db->last_query());
if ($query->num_rows > 0) {
- // echo $query->num_rows;
return $query->result_array();
}
}
-
-
-
-function addNewsupplier($supplier)
+ /**
+ * To Store the values
+ * @param number $supplier : To get all the information of Supplier from the controller
+ * @return $SID : This will return how many value are inserted (return as number/count)
+ */
+ function addNewsupplier($supplier)
{
-
$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;
-
+ $SID = $this->db->affected_rows();
+ return $SID;
}
/**
- * This function used to get user information by id
- * @param number $userId : This is user id
- * @return array $result : This is user information
+ * To get Supplier information on respective supplier id
+ * @param number $supplierID : Optional : To get Supplier ID
+ * @return $query->result() : This is result of the query
*/
function getSupplierInfo($supplierID='')
- {
+ {
$this->db->select('SD.*,PT.PaymentTerms');
- //$this->db->select('SD.SupplierID, SD.SupplierName, SD.Address, SD.ContactNumber, SD.AlternateContactNumber, SD.EmailAddress, SD.Exiseregistration, SD.TIN, SD.PAN, SD.CSTNO, SD.CSTDate, SD.GSTNO, SD.GSTRange, SD.CollectrateAddress, SD.UANumber, SD.Cert_EMS, SD.Cert_TS, SD.Cert_IMS, SD.Cert_ISO, SD.Cert_OSHAS, SD.BankAcNumber, SD.IsService, SD.IsMaintanance, SD.IsRawMaterial, SD.IFSCCode, SD.BranchName, SD.BankAddress, SD.IsActive, SD.PaymentID,PT.PaymentTerms');
$this->db->from('T_SupplierDetailsN SD');
$this->db->join('T_PaymentTerms PT','PT.PaymentID = SD.PaymentID','left');
$this->db->where('SD.SupplierID', $supplierID);
$query = $this->db->get();
- // print_r($this->db->last_query());
return $query->result();
}
- /* This function to get the Supplier Address on respective Supplier ID */
+
+ /**
+ * To get the Supplier Address on respective Supplier ID
+ * @param number $supplierID : To get Supplier ID from the controller
+ * @return $query->result_array() : This is result of the query (Supplier's address information)
+ */
function GetSupplierAddress($supplierID)
{
$this->db->select('Address');
@@ -132,37 +134,49 @@ function addNewsupplier($supplier)
$query = $this->db->get();
return $query->result_array();
}
+
+ /**
+ * To Update the values of supplier on respective Supplier ID
+ * @param number $supplier : To get all the information of Supplier from the controller
+ * @param number $supplierID : To get Supplier ID from the controller
+ */
function UpdateSupplier($supplier, $supplierID)
{
$this->db->where('SupplierID', $supplierID);
- $this->db->update('T_SupplierDetailsN', $supplier);
-
-
-
-
+ $this->db->update('T_SupplierDetailsN', $supplier);
return TRUE;
}
-
-
-
+ /**
+ * To updated the Supplier information
+ * @param number $supplier : To get all the information of Supplier from the controller
+ * @param number $supplierID : To get Supplier ID from the controller
+ *
+ * Note : This function Temporary not in use
+ */
function viewsupplier($supplier, $supplierID)
{
$this->db->where('SupplierID', $supplierID);
$this->db->update('T_SupplierDetailsN', $supplier);
-
return TRUE;
}
+ /**
+ * To store the Supplier Certificate details
+ * @param number $cerificate : To get all the information of cerficate from the controller
+ *
+ * Note : This function Temporary not in use
+ */
function SupplierCertification($cerificate)
{
$this->db->insert_id('T_Supplier_Certification',$cerificate);
$insert_id = $this->db->affected_rows();
-
return $insert_id;
-
}
+ /**
+ * To get Supplier's information for export xl
+ */
function export_excel(){
$this->db->select('det.SupplierID,SupplierName,det.Address,det.ContactNumber,det.AlternateContactNumber,det.EmailAddress,det.Exiseregistration,det.TIN,
@@ -175,11 +189,6 @@ function addNewsupplier($supplier)
$this->db->join('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid','left');
$this->db->join('T_PaymentTerms as pmt', 'pmt.PaymentID = det.PaymentID','left');
return $this->db->get('T_SupplierDetailsN as det')->result_array();
- }
-
-
- /*SUPPLIER */
- /*SUPPLIER TYPE */
-
+ }
}
?>
\ No newline at end of file
diff --git a/application/views/includes/header.php b/application/views/includes/header.php
index e683445f..c3fa2eed 100644
--- a/application/views/includes/header.php
+++ b/application/views/includes/header.php
@@ -563,6 +563,22 @@ $(function() {
View Material Inspection Report
+
+