From 0263b8286e33dc7e299aaaf61a54768540e2fd7d Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Wed, 16 Aug 2017 10:14:33 +0530 Subject: [PATCH] date format for employee,supplier and asset screen --- application/controllers/assetdetails.php | 46 ++++++++++----- application/controllers/employeedetails.php | 65 ++++++++++++++------- application/controllers/supplier.php | 30 ++++++++-- application/views/editEmployee.php | 35 ++++++----- application/views/editOldasset.php | 55 +++++++++++------ application/views/editSupplier.php | 15 ++--- 6 files changed, 163 insertions(+), 83 deletions(-) diff --git a/application/controllers/assetdetails.php b/application/controllers/assetdetails.php index f2fe04c1..c6fe74a0 100755 --- a/application/controllers/assetdetails.php +++ b/application/controllers/assetdetails.php @@ -210,14 +210,14 @@ class assetdetails extends BaseController $Location = $this->input->post('Location'); $User = $this->input->post('User'); $SupplierName = $this->input->post('SupplierName'); - $DateOfCommission = $this->input->post('DateOfCommission'); $CreatedBy = $this->session->userdata('userId'); $AssetValue = $this->input->post('Assetvalue'); if($DateOfCommission != '') { - $DOCommission= $this->getDateformat($DateOfCommission); + $DOCommission= $this->dateformat($DateOfCommission); + //$DOCommission= $this->getDateformat($DateOfCommission); } $AssetStatus = $this->input->post('AssetStatus'); $Remarks = $this->input->post('Remarks'); @@ -318,9 +318,9 @@ class assetdetails extends BaseController $this->form_validation->set_rules('Location','Location','trim|required'); $this->form_validation->set_rules('User','User','trim|required'); $this->form_validation->set_rules('SupplierName','SupplierName','trim|callback_Supplier_validate'); - $this->form_validation->set_rules('DateOfCommission','DateOfCommission','trim|required'); + $this->form_validation->set_rules('DateOfCommission','DateOfCommission','trim|required'); $this->form_validation->set_rules('Assetvalue','Assetvalue','trim|required'); - $this->form_validation->set_rules('AssetStatus','AssetStatus','trim|callback_Asset_validate'); + $this->form_validation->set_rules('AssetStatus','AssetStatus','trim|callback_Asset_validate'); if($this->form_validation->run() == FALSE) { @@ -336,17 +336,23 @@ class assetdetails extends BaseController $Location = $this->input->post('Location'); $User = $this->input->post('User'); $SupplierName = $this->input->post('SupplierName'); - + $DateOfPurchase = $this->input->post('DateOfPurchase'); + if($DateOfPurchase != '') + { + $DOpurchase = $this->dateformat($DateOfPurchase); + } - // $DateOfPurchase = $DateOfPurchase ->format('d-m-y'); + $DateOfCommission = $this->input->post('DateOfCommission'); $UpdatedBy = $this->session->userdata('userId'); $Assetvalue = $this->input->post('Assetvalue'); - if($DateOfCommission != '') - { - $DOCommission= $this->getDateformat($DateOfCommission); - } + if($DateOfCommission != '') + { + + //$DOCommission= $this->getDateformat($DateOfCommission); + $DOCommission= $this->dateformat($DateOfCommission); + } $AssetStatus = $this->input->post('AssetStatus'); @@ -370,9 +376,7 @@ class assetdetails extends BaseController $asset = array(); - $asset = array('AssetName'=>$AssetName, 'Description'=>$Description,'DEPCode'=>$Department,'Location'=>$Location,'UserName'=>$User,'SupplierCode'=>$SupplierName,'DateOfCommison'=>$DOCommission,'AssetValue'=>$Assetvalue,'AssetStatus'=>$AssetStatus,'IsActive'=>$IsActive,'Remarks'=>$Remarks,'UpdatedBy'=>$UpdatedBy,'PONO'=>$PONO,'POLineItem'=>$lineitem,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity); - - //print_r($asset);die(); + $asset = array('AssetName'=>$AssetName, 'Description'=>$Description,'DEPCode'=>$Department,'Location'=>$Location,'UserName'=>$User,'SupplierCode'=>$SupplierName,'DateOfPurchase'=>$DOpurchase,'DateOfCommison'=>$DOCommission,'AssetValue'=>$Assetvalue,'AssetStatus'=>$AssetStatus,'IsActive'=>$IsActive,'Remarks'=>$Remarks,'UpdatedBy'=>$UpdatedBy,'PONO'=>$PONO,'POLineItem'=>$lineitem,'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity); $result = $this->assetdetails_model->editasset($asset, $Asset_Code); @@ -397,6 +401,22 @@ class assetdetails extends BaseController $retDate = $date->format('Y-m-d H:i:s'); return $retDate; } + + //this function used to dateformat to store in db + function dateformat($DateValue) + { + $date = DateTime::createFromFormat('d/m/Y', $DateValue);//we should give the date as per DatePicker format. + + //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; + } function export_asset(){ diff --git a/application/controllers/employeedetails.php b/application/controllers/employeedetails.php index 08801e4c..853c901a 100755 --- a/application/controllers/employeedetails.php +++ b/application/controllers/employeedetails.php @@ -238,15 +238,14 @@ class employeedetails extends BaseController $Picture = $this->add(); $FirstName = $this->input->post('FirstName'); - $LastName = $this->input->post('LastName'); - $FatherName = $this->input->post('FatherName'); - $DateofBirth = $this->input->post('DateofBirth'); - $ContactNumber = $this->input->post('ContactNumber'); - $EmailId = $this->input->post('emailid'); - $comEmailId = $this->input->post('comemailid'); + $LastName = $this->input->post('LastName'); + $FatherName = $this->input->post('FatherName'); + $DateofBirth = $this->input->post('DateofBirth'); + $ContactNumber = $this->input->post('ContactNumber'); + $EmailId = $this->input->post('emailid'); + $comEmailId = $this->input->post('comemailid'); $Gender = $this->input->post('gender'); $MartialStatus = $this->input->post('MartialStatus'); - $BloodGroup = $this->input->post('bloodgroup'); $CurrentAddress = $this->input->post('currentaddress'); $permanentaddress = $this->input->post('permanentaddress'); @@ -267,7 +266,7 @@ class employeedetails extends BaseController } $eduqualifaction = $this->input->post('eduqualifaction'); - $addqualification = $this->input->post('addqualification'); + $addqualification = $this->input->post('addqualification'); $referredby = $this->input->post('referredby'); $referrercontno = $this->input->post('referrercontno'); $accountno = $this->input->post('accountno'); @@ -287,18 +286,18 @@ class employeedetails extends BaseController if($licenseExpiryDate != '') { - $License_ExpiryDate = $this->getDateformat($licenseExpiryDate); + $License_ExpiryDate = $this->dateformat($licenseExpiryDate); } else { $License_ExpiryDate = null; } - $DOB = $this->getDateformat($DateofBirth); - $DOJ = $this->getDateformat($dateofjoining); + $DOB = $this->dateformat($DateofBirth); + $DOJ = $this->dateformat($dateofjoining); if($ValidTill != '') { - $Valid = $this->getDateformat($ValidTill); + $Valid = $this->dateformat($ValidTill); } else { @@ -336,7 +335,23 @@ echo ""; $retDate = $date->format('Y-m-d H:i:s'); return $retDate; } + + //this function used to dateformat to store in db + function dateformat($DateValue) + { + $date = DateTime::createFromFormat('d/m/Y', $DateValue);//we should give the date as per DatePicker format. + //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 load the add new Employee form with dropdown values */ function addemployee() @@ -550,9 +565,14 @@ echo ""; { $EmpId = $this->input->post('employeeid'); $this->load->library('form_validation'); + //$mail = $this->this->.post('emailid'); $this->form_validation->set_rules('ContactNumber', 'ContactNumber', 'trim|required|min_length[10]|max_length[10]'); + //if($mail == ''){ $this->form_validation->set_rules('emailid', 'emailid', 'trim'); + //}else{ + //$this->form_validation->set_rules('emailid', 'emailid', 'trim|callback_checkMailEmp'); + //} $this->form_validation->set_rules('gender', 'gender', 'callback_Gender_validate'); $this->form_validation->set_rules('MartialStatus', 'MartialStatus', 'callback_Martial_validate'); $this->form_validation->set_rules('bloodgroup', 'bloodgroup', 'callback_Blood_validate'); @@ -619,7 +639,7 @@ echo ""; $Previousexperience = $pre_experience; } $eduqualifaction = $this->input->post('eduqualifaction'); - $addqualification = $this->input->post('addqualification'); + $addqualification = $this->input->post('addqualification'); $referredby = $this->input->post('referredby'); $referrercontno = $this->input->post('referrercontno'); $accountno = $this->input->post('accountno'); @@ -631,7 +651,7 @@ echo ""; $passportno = $this->input->post('passportno'); $ValidTill = $this->input->post('ValidTill'); $addinfo = $this->input->post('addinfo'); - $driverlicense = $this->input->post ( 'Driverlicense' ); + $driverlicense = $this->input->post ( 'Driverlicense' ); $licenseExpiryDate = $this->input->post ( 'LicenseExpiryDate' ); $VoterID = $this->input->post ( 'VoterID' ); $chked = $this->input->post('isactive'); @@ -648,11 +668,11 @@ echo ""; $UpdatedBY = $this->session->userdata ( 'userId' ); //$licenseExpiryDate = $this->getDateformat($licenseExpiryDate); - $DOB = $this->getDateformat($DateofBirth); - $DOJ = $this->getDateformat($dateofjoining); + $DOB = $this->dateformat($DateofBirth); + $DOJ = $this->dateformat($dateofjoining); if($ValidTill != '') { - $Valid = $this->getDateformat($ValidTill); + $Valid = $this->dateformat($ValidTill); } else { @@ -661,7 +681,7 @@ echo ""; if($licenseExpiryDate != '') { - $License_ExpiryDate = $this->getDateformat($licenseExpiryDate); + $License_ExpiryDate = $this->dateformat($licenseExpiryDate); } else { @@ -670,8 +690,7 @@ echo ""; //echo $DOB; $Employee = array('FirstName'=>$FirstName, 'LastName'=>$LastName,'FatherName'=>$FatherName,'Gender'=>$Gender,'DateofBirth'=>$DOB,'ContactNumber'=>$ContactNumber,'EmailId'=>$EmailId,'BloodGroup'=>$BloodGroup,'MartialStatus'=>$MartialStatus,'DateofJoining'=>$DOJ,'PreviousYearsOfExp'=>$Previousexperience,'Designation'=>$desigination,'Departmentcode'=>$departmentCode,'PresentAddress'=>$CurrentAddress,'PermanentAddress'=>$permanentaddress,'EmergencyContactName'=>$emergencycontactname,'EmergencyContactNumber'=>$emergencycontactnumber,'Edu_Qualification'=>$eduqualifaction,'Additional_Qualification'=>$addqualification,'AadharNo'=>$aadharno,'PANNo'=>$panno,'BankAccountNo'=>$accountno,'IFSCCode'=>$ifsccode,'BankBranchName'=>$bankbranchname,'BankAddress'=>$bankaddress,'PassportNo'=>$passportno,'Passport_Valid_till'=>$Valid,'IsActive'=>$IsActive,'ProfilePic'=>$Picture,'Reference_Name'=>$referredby,'Reference_ContactNumber'=>$referrercontno,'Remarks'=>$addinfo,'UpdatedBY'=>$UpdatedBY,'personalEmailId'=>$comEmailId,'DriverLicense'=>$driverlicense,'LicenseValidtill'=>$License_ExpiryDate,'VoterID'=>$VoterID); - - //print_r($Employee);die(); + $result = $this->employeedetails_model->UpdateEmployee($Employee,$EmpId); if($result > 0) @@ -701,10 +720,12 @@ echo ""; $this->load->library('excel'); $this->excel->setActiveSheetIndex(0)->mergeCells('L3:S3'); + $this->excel->setActiveSheetIndex(0)->getStyle('L3')->getAlignment()->applyFromArray(array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,)); $this->excel->getActiveSheet()->setTitle('Employee details'); - $this->excel->getActiveSheet()->setCellValue('L3', 'SIDDHARTH INDUSTRIES Employee Details'); + $this->excel->getActiveSheet()->setCellValue('L3', 'SIDDHARTH INDUSTRIES Employee Details'); + $this->excel->getActiveSheet()->setCellValue('A5', 'EmpID'); $this->excel->getActiveSheet()->setCellValue('B5', 'FirstName-LastName'); $this->excel->getActiveSheet()->setCellValue('C5', 'FatherName'); @@ -854,7 +875,7 @@ echo ""; $this->excel->getActiveSheet()->setCellValue('B'. $i,$data['FirstName'].'-'.$data['LastName']); $this->excel->getActiveSheet()->setCellValue('C'. $i,$data['FatherName']); $this->excel->getActiveSheet()->setCellValue('D'. $i,$data['Gender']); - $this->excel->getActiveSheet()->setCellValue('E'. $i,$data['DateofBirth'],PHPExcel_Cell_DataType::TYPE_STRING); + $this->excel->getActiveSheet()->setCellValue('E'. $i,$data['DateofBirth']); $this->excel->getActiveSheet()->setCellValue('F'. $i,$data['ContactNumber']); $this->excel->getActiveSheet()->setCellValue('G'. $i,$data['EmailId']); $this->excel->getActiveSheet()->setCellValue('H'. $i,$data['BloodGroup']); diff --git a/application/controllers/supplier.php b/application/controllers/supplier.php index d355cf90..34b9d1e4 100644 --- a/application/controllers/supplier.php +++ b/application/controllers/supplier.php @@ -219,7 +219,9 @@ class supplier extends BaseController $CSTDate = null; } else{ - $CSTDate = $this->getDateformat($CSTDt); + + $CSTDate = $this->dateformat($CSTDt); + //$CSTDate = $this->getDateformat($CSTDt); } } else{ @@ -269,6 +271,24 @@ class supplier extends BaseController $retDate = $date->format('Y-m-d H:i:s'); return $retDate; } + + //this function used to dateformat to store in db + function dateformat($DateValue) + { + $date = DateTime::createFromFormat('d/m/Y', $DateValue);//we should give the date as per DatePicker format. + + //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 */ @@ -332,8 +352,8 @@ class supplier extends BaseController $CSTDt = $this->input->post('dateofCST'); if($CSTDt != '') - { - $CSTDate = $this->getDateformat($CSTDt); + {$CSTDate = $this->dateformat($CSTDt); + //$CSTDate = $this->getDateformat($CSTDt); } else { @@ -357,7 +377,7 @@ class supplier extends BaseController $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); - // print_r($supplier);die(); + $result = $this->supplier_model->UpdateSupplier($supplier, $supplierID); @@ -406,6 +426,7 @@ class supplier extends BaseController $this->load->library('excel'); $this->excel->setActiveSheetIndex(0)->mergeCells('J3:R3'); + $this->excel->setActiveSheetIndex(0)->getStyle('J3')->getAlignment()->applyFromArray(array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,)); $this->excel->getActiveSheet()->setTitle('Supplier details'); @@ -413,7 +434,6 @@ class supplier extends BaseController $this->excel->getActiveSheet()->setCellValue('A5', 'SupplierID'); $this->excel->getActiveSheet()->setCellValue('B5', 'SupplierName'); - // $this->execl->getActiveSheet()->setCellValue( '' , ''); $this->excel->getActiveSheet()->setCellValue('C5', 'Address'); $this->excel->getActiveSheet()->setCellValue('D5', 'ContactNumber'); $this->excel->getActiveSheet()->setCellValue('E5', 'AlternateContactNumber'); diff --git a/application/views/editEmployee.php b/application/views/editEmployee.php index a72e10ef..3c9a0d16 100755 --- a/application/views/editEmployee.php +++ b/application/views/editEmployee.php @@ -58,7 +58,6 @@ if(!empty($EmpDetails)) $DOB = $from ->format('d/m/Y'); $ContactNumber = $Emp->ContactNumber; $EmailId = $Emp->EmailId; - //$comEmailId = $Emp->comEmailId; $BloodGroup = $Emp->BloodGroup; $MartialStatus =$Emp->MartialStatus; $DateofJoining = $Emp->DateofJoining; @@ -82,27 +81,34 @@ if(!empty($EmpDetails)) $BankAddress = $Emp->BankAddress; $PassportNo = $Emp->PassportNo; $Passport_Valid_till = $Emp->Passport_Valid_till; - if($Passport_Valid_till != '') + if($Passport_Valid_till != '' && $Passport_Valid_till != '0000-00-00 00:00:00') { - $dtpassport = new DateTime($Passport_Valid_till); - $DOPassport = $dtpassport ->format('d/m/Y'); + $dtpassport = new DateTime($Passport_Valid_till); + $DOPassport = $dtpassport ->format('d/m/Y'); } + else { + + $DOPassport = ''; + } + $isactive = $Emp->IsActive; - //print_r($isactive); $ProfilePic = $Emp->ProfilePic; $Reference_Name = $Emp->Reference_Name; $Reference_ContactNumber = $Emp->Reference_ContactNumber; $Remarks = $Emp->Remarks; $personalEmailId = $Emp->personalEmailId; - $DriverLicense = $Emp->DriverLicense; + $DriverLicense = $Emp->DriverLicense; + $VoterID = $Emp->VoterID; - $VoterID = $Emp->VoterID; - - if($Emp->LicenseValidtill != '') + if($Emp->LicenseValidtill != '' && $Emp->LicenseValidtill != '0000-00-00 00:00:00') { $License = new DateTime($Emp->LicenseValidtill); $LicenseValidtill = $License ->format('d/m/Y'); } + else + { + $LicenseValidtill = ''; + } //$chk = $uf->IsActive; if($isactive == 1) { @@ -112,9 +118,6 @@ if(!empty($EmpDetails)) { $IsActive = ''; } - // //$dtLicenseValidtill = new DateTime($LicenseValidtill); - //$LicenseValidtill = $dtLicenseValidtill ->format('Y-m-d'); - //$LicenseValidtill = $Emp-> } } @@ -477,20 +480,20 @@ $(function() { $("#DateofBirth").datepicker({ minDate : new Date(mindt,1,1), maxDate : new Date(maxdt,1,1), - dateFormat: 'mm/dd/yy',changeMonth: true, changeYear: true,yearRange: '-100:+0' + dateFormat: 'dd/mm/yy',changeMonth: true, changeYear: true,yearRange: '-100:+0' }); $("#dateofjoining").datepicker({ minDate : new Date(year-SIAStartYear,1,1), maxDate :'now', - dateFormat: 'mm/dd/yy',changeMonth: true, changeYear: true, + dateFormat: 'dd/mm/yy',changeMonth: true, changeYear: true, }); - $("#ValidTill").datepicker({dateFormat: 'mm/dd/yy',minDate :'now',changeMonth: true, changeYear: true,yearRange: '-0:+100' + $("#ValidTill").datepicker({dateFormat: 'dd/mm/yy',minDate :'now',changeMonth: true, changeYear: true,yearRange: '-0:+100' }); - $("#LicenseExpiryDate").datepicker({dateFormat: 'mm/dd/yy',minDate :'now',changeMonth: true, changeYear: true,yearRange: '-0:+100' + $("#LicenseExpiryDate").datepicker({dateFormat: 'dd/mm/yy',minDate :'now',changeMonth: true, changeYear: true,yearRange: '-0:+100' }); }); diff --git a/application/views/editOldasset.php b/application/views/editOldasset.php index a0c34716..aff20f95 100755 --- a/application/views/editOldasset.php +++ b/application/views/editOldasset.php @@ -23,6 +23,7 @@ $Quantity=''; $UOM = ''; $MaterialName=''; $DeliveryDate=''; +$DDate = ''; if(!empty($assetList)) { foreach ($assetList as $Asset) @@ -38,13 +39,24 @@ if(!empty($assetList)) $SupplierName = $Asset->SupplierName; $SupplierCode = $Asset->SupplierCode; $DateOfPurchase = $Asset->DateOfPurchase;//print_r($Asset->DateOfPurchase); - $PODate = new DateTime($DateOfPurchase); - $DateOfPurchase = $PODate->format('d/m/Y'); - //print_r($Asset->DateOfCommison); - //$assetDate = new DateTime($DateOfCommison); - $DateOfCommission= new DateTime($Asset->DateOfCommison, new DateTimeZone('Asia/Kolkata')); - $DateOfCommison = $DateOfCommission->format('d/m/Y'); - $AssetValue = $Asset->AssetValue; + if($DateOfPurchase != '' && $DateOfPurchase != '0000-00-00 00:00:00' ) { + $PODate = new DateTime($DateOfPurchase); + $DateOfPurchase = $PODate->format('d/m/Y'); + } + else { + $DateOfPurchase = ''; + } + $DateOfCommison = $Asset->DateOfCommison; + if($DateOfCommison != '' && $DateOfCommison != '0000-00-00 00:00:00' ) { + $DateOfCommission= new DateTime($Asset->DateOfCommison, new DateTimeZone('Asia/Kolkata')); + $DateOfCommison = $DateOfCommission->format('d/m/Y'); + } + else { + $DateOfCommison = ''; + } + + + $AssetValue = $Asset->AssetValue; $AssetStatus = $Asset->AssetStatus; $MaterialCode = $Asset->MaterialCode; $PONO = $Asset->PONO; @@ -52,12 +64,19 @@ if(!empty($assetList)) $Quantity = $Asset->Quantity; $MaterialName = $Asset->MaterialName; $UOM = $Asset->UOM; - $DDate = new DateTime($Asset->DeliveryDate, new DateTimeZone('Asia/Kolkata')); - //$PODelivery = new DateTime($DeliveryDate);//print_r($Asset->DeliveryDate); - $DeliveryDate = $DDate ->format('d/m/Y'); - //print_r($DateOfPurchase);print_r($DateOfCommison);print_r($DeliveryDate); + $DDt = $Asset->DeliveryDate; + + if($DDate != '' && $DDate != '0000-00-00 00:00:00'){ + $DDate = new DateTime($DDt, new DateTimeZone('Asia/Kolkata')); + $DeliveryDate = $DDate->format('d/m/Y'); + } + else + { + $DeliveryDate = ''; + } + $Remarks = $Asset->Remarks; - $chk = $Asset->IsActive; + $chk = $Asset->IsActive; if($chk == 1) { @@ -68,11 +87,11 @@ if(!empty($assetList)) $IsActive = ''; } - if($DateOfPurchase != '') - { - $dtpurchase = new DateTime($DateOfPurchase); - $DOPurchase = $dtpurchase ->format('d/m/Y'); - } + // if($DateOfPurchase != '') + // { + // $dtpurchase = new DateTime($DateOfPurchase); + // $DOPurchase = $dtpurchase ->format('d/m/Y'); + // } // if($DateOfCommission != '') // { // $dtCommission = new DateTime($DateOfCommission); @@ -102,7 +121,7 @@ $(function() { $("#DateOfCommission").datepicker({ minDate : new Date(year-SIAStartYear,1,1), maxDate :'now', - dateFormat: 'dd/mm//yy',changeMonth: true, changeYear: true, + dateFormat: 'dd/mm/yy',changeMonth: true, changeYear: true, diff --git a/application/views/editSupplier.php b/application/views/editSupplier.php index bf6574d8..4a84d610 100755 --- a/application/views/editSupplier.php +++ b/application/views/editSupplier.php @@ -55,18 +55,15 @@ if(!empty($supplier)) $CSTNO = $uf->CSTNO; $CSTDt = $uf->CSTDate; - if($CSTDt != '') - { - if ($CSTDt == "0000-00-00 00:00:00" ) + if($CSTDt != '' && $CSTDt != '0000-00-00 00:00:00' ) { - $CSTDate = ""; + $dtCST = new DateTime($CSTDt); + $CSTDate = $dtCST ->format('d/m/Y'); } else { - $dtCST = new DateTime($CSTDt); - $CSTDate = $dtCST ->format('d/m/Y'); + $CSTDate = ""; } - } $chk = $uf->IsActive; @@ -527,11 +524,11 @@ function onlyAlphabets(evt) {
IMS Number - +
ISO Number - +