CHANGE_ISSUE_CLEAR

This commit is contained in:
aadhavan valli 2024-09-05 09:04:36 +05:30
parent a1be08cf7f
commit 660536d515
22 changed files with 1326 additions and 1031 deletions

View File

@ -74,6 +74,7 @@ $routes->get('exportcost', 'CostCenter::exportcost');
$routes->get('assetListing', 'Assetdetails::assetListing'); $routes->get('assetListing', 'Assetdetails::assetListing');
$routes->get('addasset', 'Assetdetails::addasset'); $routes->get('addasset', 'Assetdetails::addasset');
$routes->get('assetdetails/editOldasset', 'Assetdetails::editOldasset'); $routes->get('assetdetails/editOldasset', 'Assetdetails::editOldasset');
$routes->post('assetdetails/getpodetails', 'Assetdetails::getpodetails');
// $routes->post('addNewasset', 'Assetdetails::addNewasset'); // $routes->post('addNewasset', 'Assetdetails::addNewasset');
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'editOldasset', 'Assetdetails::editasset'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'],'editOldasset', 'Assetdetails::editasset');
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'editOldasset/(:num)', 'Assetdetails::editasset/$1'); $routes->match(['GET', 'POST', 'PUT', 'DELETE'],'editOldasset/(:num)', 'Assetdetails::editasset/$1');
@ -376,6 +377,7 @@ $routes->get('inprocess', 'Inprocess::index');
// Sales Controller // Sales Controller
$routes->get('sales_dashboard', 'Sales::sales_dashboard'); $routes->get('sales_dashboard', 'Sales::sales_dashboard');
$routes->get('invoicedetails/ViewInvoice', 'Sales::ViewInvoice'); $routes->get('invoicedetails/ViewInvoice', 'Sales::ViewInvoice');
$routes->get('getInvoiceAttachment', 'Sales::getInvoiceAttachments');
$routes->get('getInvoiceAttachments', 'Sales::getInvoiceAttachments'); $routes->get('getInvoiceAttachments', 'Sales::getInvoiceAttachments');
$routes->get('deleteAttachment', 'Sales::deleteAttachment'); $routes->get('deleteAttachment', 'Sales::deleteAttachment');
$routes->post('saveAttachment', 'Sales::saveAttachment'); $routes->post('saveAttachment', 'Sales::saveAttachment');

View File

@ -201,11 +201,9 @@ class Employeedetails extends BaseController
function AddNewEmployee() function AddNewEmployee()
{ {
// print_r($this->request->getPost());die;
$photo = $this->request->getFile('photo'); $photo = $this->request->getFile('photo');
$Picture = ""; $Picture = "";
if(isset($photoan)){ if (isset($photo)) {
if ($photo->isValid() && !$photo->hasMoved()) { if ($photo->isValid() && !$photo->hasMoved()) {
$uploadDir = ROOTPATH . 'public/uploads/images/'; $uploadDir = ROOTPATH . 'public/uploads/images/';
$allowedTypes = ['jpg', 'jpeg', 'png', 'gif']; $allowedTypes = ['jpg', 'jpeg', 'png', 'gif'];
@ -603,8 +601,7 @@ class Employeedetails extends BaseController
/* To Update the employee details*/ /* To Update the employee details*/
function UpdateEmployee() function UpdateEmployee()
{ {
// echo "<pre>";
// print_r($this->request->getPost());die;
$EmpId = $this->request->getPost('employeeid'); $EmpId = $this->request->getPost('employeeid');
//$mail = $this->this->.post('emailid'); //$mail = $this->this->.post('emailid');
@ -637,16 +634,25 @@ class Employeedetails extends BaseController
$ModifyPictureName = $this->request->getPost('ModifyImage'); $ModifyPictureName = $this->request->getPost('ModifyImage');
$Picture = ""; $Picture = "";
if ($PictureName != '') { if ($PictureName != '') {
//echo 'Exists'; //echo 'Exists';
//$Picture = $PictureName; //$Picture = $PictureName;
if (strlen((string)$ModifyPictureName) == 0) { if (strlen((string)$ModifyPictureName) == 0) {
//echo 'Exists But Not replace'; //echo 'Exists But Not replace';
$Picture = $PictureName; $Picture = $PictureName;
} else { } else {
// echo "<pre>";
// // print_r($this->request->getPost());
// print_r($this->request->getFile('photo'));
// die;
//echo 'Exists But Replace'; //echo 'Exists But Replace';
//$Picture = $ModifyPictureName; //$Picture = $ModifyPictureName;
//$Picture = $this->editimage($ModifyPictureName); //$Picture = $this->editimage($ModifyPictureName);
$photo = $this->request->getFile('ModifyImage'); $photo = $this->request->getFile('ModifyImage');
if (!$photo || !$photo->isValid()) {
$photo = $this->request->getFile('photo');
}
if (isset($photo)) {
if ($photo->isValid() && !$photo->hasMoved()) { if ($photo->isValid() && !$photo->hasMoved()) {
$uploadDir = ROOTPATH . 'public/uploads/images/'; $uploadDir = ROOTPATH . 'public/uploads/images/';
$allowedTypes = ['jpg', 'jpeg', 'png', 'gif']; $allowedTypes = ['jpg', 'jpeg', 'png', 'gif'];
@ -660,6 +666,7 @@ class Employeedetails extends BaseController
} }
} }
} }
}
} else { } else {
//echo 'Not Exists'; //echo 'Not Exists';
$photo = $this->request->getFile('photo'); $photo = $this->request->getFile('photo');

View File

@ -37,7 +37,9 @@ class Login extends BaseController
return view('login'); return view('login');
} else { } else {
// redirect('/dashboard'); // redirect('/dashboard');
return redirect()->to('/dashboard'); // return redirect()->to('/dashboard');
return redirect()->to('/sales_dashboard');
} }
} }
@ -53,7 +55,9 @@ class Login extends BaseController
return view('login'); return view('login');
} else { } else {
// return view('login'); // return view('login');
return redirect()->to('/dashboard'); // return redirect()->to('/dashboard');
return redirect()->to('/sales_dashboard');
} }
} }
@ -107,9 +111,11 @@ class Login extends BaseController
$DEPCode = $res->DEPCode; $DEPCode = $res->DEPCode;
if ($DEPCode == SECURITY) { if ($DEPCode == SECURITY) {
return redirect()->to(site_url('/dashboard')); // return redirect()->to(site_url('/dashboard'));
return redirect()->to(site_url('/sales_dashboard'));
} else { } else {
return redirect()->to(site_url('/dashboard')); return redirect()->to(site_url('/sales_dashboard'));
// return redirect()->to(site_url('/dashboard'));
} }
} }
} else { } else {

View File

@ -5,18 +5,21 @@ namespace App\Controllers;
use App\Controllers\BaseController; use App\Controllers\BaseController;
use App\Models\Ipinvoice_model; use App\Models\Ipinvoice_model;
use App\Models\Ipattachment_model;
require_once 'vendor/autoload.php'; require_once 'vendor/autoload.php';
class Sales extends BaseController class Sales extends BaseController
{ {
protected $ipinvoice_model; protected $ipinvoice_model;
protected $ipattachment_model;
protected $session; protected $session;
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
$this->ipinvoice_model = new Ipinvoice_model(); $this->ipinvoice_model = new Ipinvoice_model();
$this->ipattachment_model = new Ipattachment_model();
$this->session = session(); $this->session = session();
$this->isLoggedIn(); $this->isLoggedIn();
} }
@ -91,8 +94,7 @@ class Sales extends BaseController
// Invoice Attachments // Invoice Attachments
function getInvoiceAttachments(){ function getInvoiceAttachments(){
$data['invoiceAttachment'] = $this->ipinvoice_model->getinvoiceAttachment($this->request->getGet('invoice_id')); $data['invoiceAttachment'] = $this->ipinvoice_model->getinvoiceAttachment($this->request->getGet('invoice_number'));
return json_encode($data); return json_encode($data);
} }

View File

@ -14,6 +14,7 @@ use App\Models\User_model;
use App\Models\Ipinvoice_model; use App\Models\Ipinvoice_model;
use App\Models\Ipattachment_model; use App\Models\Ipattachment_model;
use App\Models\Zohobooks_api_model; use App\Models\Zohobooks_api_model;
require_once 'vendor/autoload.php'; require_once 'vendor/autoload.php';
/** /**
@ -253,8 +254,7 @@ class User extends BaseController
$working = array(); $working = array();
$overtime = array(); $overtime = array();
//$holid = array(); //$holid = array();
for ($i = 1; $i <= $dat; $i++) for ($i = 1; $i <= $dat; $i++) {
{
$Working[] = 'WH' . $i; $Working[] = 'WH' . $i;
$overtime[] = 'OT' . $i; $overtime[] = 'OT' . $i;
@ -704,7 +704,6 @@ class User extends BaseController
if ($CURMONTH == $doj_month && $CURYEAR == $doj_year) { if ($CURMONTH == $doj_month && $CURYEAR == $doj_year) {
$data['CUR_month'] = $CURDATE - $doj_day + 1; $data['CUR_month'] = $CURDATE - $doj_day + 1;
} else { } else {
$data['CUR_month'] = $date; $data['CUR_month'] = $date;
} }
@ -1176,7 +1175,7 @@ class User extends BaseController
{ {
$this->global['pageTitle'] = 'Change Password'; $this->global['pageTitle'] = 'Change Password';
$this->loadViews("changePassword", $this->global, NULL, NULL); $this->loadViews("changePassword", $this->global, [], NULL);
} }
@ -1187,29 +1186,27 @@ class User extends BaseController
{ {
helper('form'); //$this->load->library('form_validation'); helper('form'); //$this->load->library('form_validation');
$this->validator->setRules(['oldPassword', 'Old password'=> 'required|max_length[20]']); // $this->validator->setRules(['oldPassword', 'Old password'=> 'required|max_length[20]']);
$this->validator->setRules(['newPassword', 'New password'=> 'required|max_length[20]']); // $this->validator->setRules(['newPassword', 'New password'=> 'required|max_length[20]']);
$this->validator->setRules(['cNewPassword', 'Confirm new password'=> 'required|matches[newPassword]|max_length[20]']); // $this->validator->setRules(['cNewPassword', 'Confirm new password'=> 'required|matches[newPassword]|max_length[20]']);
if ($this->validator->run() == FALSE) { // if ($this->validator->run() == FALSE) {
$this->loadChangePass();
} else {
$oldPassword = $this->request->getPost('oldPassword'); $oldPassword = $this->request->getPost('oldPassword');
$newPassword = $this->request->getPost('newPassword'); $newPassword = $this->request->getPost('newPassword');
$cNewPassword = $this->request->getPost('newPassword');
if($newPassword === $cNewPassword && $oldPassword != $newPassword) {
$resultPas = $this->user_model->matchOldPassword($this->vendorId, $oldPassword); $resultPas = $this->user_model->matchOldPassword($this->vendorId, $oldPassword);
if (empty($resultPas)) { if (empty($resultPas)) {
$this->session->setFlashdata('nomatch', 'Your old password not correct'); $this->session->setFlashdata('nomatch', 'Your old password not correct');
return redirect()->route('loadChangePass'); return redirect()->route('loadChangePass');
} else { } else {
$usersData = array( $usersData = array(
'password' => getHashedPassword($newPassword), 'updatedBy' => $this->vendorId, 'password' => getHashedPassword($newPassword),
'updatedBy' => $this->vendorId,
'updatedDtm' => date('Y-m-d H:i:sa') 'updatedDtm' => date('Y-m-d H:i:sa')
); );
$this->session->setFlashdata('error', 'Password updation failed');
$result = $this->user_model->changePassword($this->vendorId, $usersData); $result = $this->user_model->changePassword($this->vendorId, $usersData);
if ($result > 0) { if ($result > 0) {
$this->session->setFlashdata('success', 'Password updation successful'); $this->session->setFlashdata('success', 'Password updation successful');
} else { } else {
@ -1236,7 +1233,6 @@ class User extends BaseController
$data['fy'] = $this->user_model->fincalYear(); $data['fy'] = $this->user_model->fincalYear();
$data['per'] = $this->user_model->deliver_perform($fa, $aa, $m); $data['per'] = $this->user_model->deliver_perform($fa, $aa, $m);
} }
$data['fy'] = $this->user_model->fincalYear(); $data['fy'] = $this->user_model->fincalYear();
@ -1281,7 +1277,8 @@ class User extends BaseController
} }
} }
function zohobooks_api_fetch_all(){ function zohobooks_api_fetch_all()
{
// print_r($_GET); // print_r($_GET);
// echo isset($_GET['from']) ? $_GET['from'] : 'n'; // echo isset($_GET['from']) ? $_GET['from'] : 'n';
// echo isset($_GET['to']) ? $_GET['to'] : 'n'; // echo isset($_GET['to']) ? $_GET['to'] : 'n';
@ -1293,13 +1290,10 @@ class User extends BaseController
//$this->load->helper('zohobooks_fetch_api_helper'); //$this->load->helper('zohobooks_fetch_api_helper');
helper('zohobook'); helper('zohobook');
$Zohobook_model = model('Zohobook_api_model'); $Zohobook_model = model('Zohobook_api_model');
if(isset($_GET['from']) && $_GET['from'] != null && isset($_GET['to']) && $_GET['to'] != null) if (isset($_GET['from']) && $_GET['from'] != null && isset($_GET['to']) && $_GET['to'] != null) {
{
$date_today = $_GET['to']; $date_today = $_GET['to'];
$date_yesterday = $_GET['from']; $date_yesterday = $_GET['from'];
} } else {
else
{
$date_today = date('Y-m-d'); $date_today = date('Y-m-d');
$date_yesterday = date('Y-m-d', strtotime('-3 day', strtotime($date_today))); $date_yesterday = date('Y-m-d', strtotime('-3 day', strtotime($date_today)));
} }
@ -1313,8 +1307,13 @@ class User extends BaseController
//echo '****************'; //echo '****************';
//print_r(date('Y-m-d h:i:s')); //print_r(date('Y-m-d h:i:s'));
$token = 0; $token = 0;
if ($date->format('Y-m-d H:i:s') > date('Y-m-d H:i:s')) { $token = $chk_acc_token_val[0]['token']; } if ($date->format('Y-m-d H:i:s') > date('Y-m-d H:i:s')) {
else { $token = generateNewToken(); $tokendata['token'] = $token; $Zohobook_model->customUpdate($tokendata , 1,'zohobook_accesstoken'); } $token = $chk_acc_token_val[0]['token'];
} else {
$token = generateNewToken();
$tokendata['token'] = $token;
$Zohobook_model->customUpdate($tokendata, 1, 'zohobook_accesstoken');
}
// $token = generateNewToken(); $tokendata['token'] = $token; // $token = generateNewToken(); $tokendata['token'] = $token;
//$Zohobook_model->update($tokendata , 1,'zohobook_accesstoken'); //$Zohobook_model->update($tokendata , 1,'zohobook_accesstoken');
$result = getheringInvoiceDetails($date_today, $date_yesterday, $token); $result = getheringInvoiceDetails($date_today, $date_yesterday, $token);
@ -1337,8 +1336,7 @@ class User extends BaseController
} }
$insert_count = 0; $insert_count = 0;
$update_count = 0; $update_count = 0;
foreach($res2 as $rs) foreach ($res2 as $rs) {
{
$gst_no = $rs['gst_no']; $gst_no = $rs['gst_no'];
$invoice_number = $rs['invoice_number']; $invoice_number = $rs['invoice_number'];
$invoice_date = $rs['date']; $invoice_date = $rs['date'];
@ -1353,17 +1351,13 @@ class User extends BaseController
$invoice_time = $time_array[0]; $invoice_time = $time_array[0];
$sql_invoice_chk = $Zohobook_model->ip_invoices($invoice_number, $invoice_date); $sql_invoice_chk = $Zohobook_model->ip_invoices($invoice_number, $invoice_date);
if($sql_invoice_chk <= 0) if ($sql_invoice_chk <= 0) {
{
$gst_sql = $Zohobook_model->ip_clients($gst_no); $gst_sql = $Zohobook_model->ip_clients($gst_no);
if($gst_sql) if ($gst_sql) {
{
$client_id = $gst_sql[0]['client_id']; $client_id = $gst_sql[0]['client_id'];
log_message('error', 'Data fetch success DB : ip_clients , client_id : ' . $client_id); log_message('error', 'Data fetch success DB : ip_clients , client_id : ' . $client_id);
} } else {
else
{
log_message('error', 'No data => Data fetch failed DB : ip_clients ' . $gst_no); log_message('error', 'No data => Data fetch failed DB : ip_clients ' . $gst_no);
$gst_no_data['client_tax_code'] = $gst_no; $gst_no_data['client_tax_code'] = $gst_no;
$gst_inserted_id = $Zohobook_model->customInsert($gst_no_data, 'ip_clients'); $gst_inserted_id = $Zohobook_model->customInsert($gst_no_data, 'ip_clients');
@ -1375,7 +1369,9 @@ class User extends BaseController
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters); $charactersLength = strlen($characters);
$randomString = ''; $randomString = '';
for ($i = 0; $i < 16; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } for ($i = 0; $i < 16; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
$url_key = $randomString; $url_key = $randomString;
$ip_invoices['user_id'] = 1; $ip_invoices['user_id'] = 1;
@ -1393,8 +1389,7 @@ class User extends BaseController
$ip_invoices['e_invoice_number'] = $einvoice_number; $ip_invoices['e_invoice_number'] = $einvoice_number;
$ip_invoices['invoice_url'] = $invoice_url; $ip_invoices['invoice_url'] = $invoice_url;
$invoice_insert_id = $Zohobook_model->customInsert($ip_invoices, 'ip_invoices'); $invoice_insert_id = $Zohobook_model->customInsert($ip_invoices, 'ip_invoices');
if($invoice_insert_id) if ($invoice_insert_id) {
{
log_message('error', 'Data insert success DB : ip_invoices client id :' . $client_id); log_message('error', 'Data insert success DB : ip_invoices client id :' . $client_id);
$insert_count = $insert_count + 1; $insert_count = $insert_count + 1;
//start invoice level custom fields //start invoice level custom fields
@ -1465,12 +1460,10 @@ class User extends BaseController
//end invoice level custom fields //end invoice level custom fields
//if line items available //if line items available
if(isset($rs['line_items']) && count($rs['line_items']) > 0) if (isset($rs['line_items']) && count($rs['line_items']) > 0) {
{
log_message('error', 'Processing line items' . count($rs['line_items'])); log_message('error', 'Processing line items' . count($rs['line_items']));
for($i = 0; $i< count($rs['line_items']);$i++) for ($i = 0; $i < count($rs['line_items']); $i++) { //start insert line items
{ //start insert line items
$sku = $rs['line_items'][$i]['sku']; $sku = $rs['line_items'][$i]['sku'];
@ -1486,13 +1479,10 @@ class User extends BaseController
$sgst = $sgst[4]; $sgst = $sgst[4];
$cgst = $cgst . '.000'; $cgst = $cgst . '.000';
$getcgsttax = $Zohobook_model->ip_tax_rates($cgst); $getcgsttax = $Zohobook_model->ip_tax_rates($cgst);
if($getcgsttax) if ($getcgsttax) {
{
$cgsttaxid = $getcgsttax[0]['tax_rate_id']; $cgsttaxid = $getcgsttax[0]['tax_rate_id'];
log_message('error', 'Data fetch success DB : ip_tax_rates cgst' . $cgst); log_message('error', 'Data fetch success DB : ip_tax_rates cgst' . $cgst);
} } else {
else
{
log_message('error', 'No data => Data fetch failed DB : ip_tax_rates ' . $cgst); log_message('error', 'No data => Data fetch failed DB : ip_tax_rates ' . $cgst);
$cgst_data['tax_rate_percent'] = $cgst; $cgst_data['tax_rate_percent'] = $cgst;
$getcgsttax = $Zohobook_model->customInsert($cgst_data, 'ip_tax_rates'); $getcgsttax = $Zohobook_model->customInsert($cgst_data, 'ip_tax_rates');
@ -1502,13 +1492,10 @@ class User extends BaseController
$sgst = $sgst . '.000'; $sgst = $sgst . '.000';
$getsgsttax = $Zohobook_model->ip_tax_rates($sgst); $getsgsttax = $Zohobook_model->ip_tax_rates($sgst);
if($getsgsttax) if ($getsgsttax) {
{
$sgsttaxid = $getsgsttax[0]['tax_rate_id']; $sgsttaxid = $getsgsttax[0]['tax_rate_id'];
log_message('error', 'Data fetch success DB : ip_tax_rates sgst' . $sgst); log_message('error', 'Data fetch success DB : ip_tax_rates sgst' . $sgst);
} } else {
else
{
log_message('error', 'No data => Data fetch failed DB : ip_tax_rates ' . $sgst); log_message('error', 'No data => Data fetch failed DB : ip_tax_rates ' . $sgst);
$sgst_data['tax_rate_percent'] = $sgst; $sgst_data['tax_rate_percent'] = $sgst;
$getsgsttax = $Zohobook_model->customInsert($sgst_data, 'ip_tax_rates'); $getsgsttax = $Zohobook_model->customInsert($sgst_data, 'ip_tax_rates');
@ -1530,13 +1517,10 @@ class User extends BaseController
$sku_sql = $Zohobook_model->ip_products($sku); $sku_sql = $Zohobook_model->ip_products($sku);
if(!empty($sku_sql)) if (!empty($sku_sql)) {
{
$product_id = $sku_sql[0]['product_id']; $product_id = $sku_sql[0]['product_id'];
log_message('error', 'Data fetch success DB : ip_products , product_id : ' . $product_id); log_message('error', 'Data fetch success DB : ip_products , product_id : ' . $product_id);
} } else {
else
{
log_message('error', 'No data => Data fetch failed DB : ip_products ' . $sku); log_message('error', 'No data => Data fetch failed DB : ip_products ' . $sku);
$sku_data['product_name'] = $item_name; $sku_data['product_name'] = $item_name;
$sku_data['product_description'] = $item_description; $sku_data['product_description'] = $item_description;
@ -1582,23 +1566,15 @@ class User extends BaseController
log_message('error', 'Data insert success DB : ip_invoice_item_amounts '); log_message('error', 'Data insert success DB : ip_invoice_item_amounts ');
else else
log_message('error', 'Data insert failed DB : ip_invoice_item_amounts '); log_message('error', 'Data insert failed DB : ip_invoice_item_amounts ');
} //end line items insert } //end line items insert
} } else {
else
{
log_message('error', 'Line Items not found in API result'); log_message('error', 'Line Items not found in API result');
} }
} } else {
else
{
log_message('error', 'Data insert failed DB : ip_invoice_items client id :' . $client_id); log_message('error', 'Data insert failed DB : ip_invoice_items client id :' . $client_id);
} }
} else // update invoice status, especially for cancelled invoices
}
else // update invoice status, especially for cancelled invoices
{ {
// if($status == "void" || $status == "sent" || $status == "overdue") // if($status == "void" || $status == "sent" || $status == "overdue")
// { // {
@ -1608,12 +1584,9 @@ class User extends BaseController
// print_r( $sql_invoice_update); // print_r( $sql_invoice_update);
// echo '<br>'; // echo '<br>';
$sql_invoice_update = $Zohobook_model->sql_invoice_update($sql_invoice_update, $invoice_number, $invoice_date, 'ip_invoices'); $sql_invoice_update = $Zohobook_model->sql_invoice_update($sql_invoice_update, $invoice_number, $invoice_date, 'ip_invoices');
if($sql_invoice_update) if ($sql_invoice_update) {
{
log_message('error', 'Data update success DB : ip_invoices '); log_message('error', 'Data update success DB : ip_invoices ');
} } else {
else
{
log_message('error', 'Data update failed DB : ip_invoices '); log_message('error', 'Data update failed DB : ip_invoices ');
} }
$update_count = $update_count + 1; $update_count = $update_count + 1;
@ -1621,7 +1594,8 @@ class User extends BaseController
} }
// echo 'new invoice inserted count- ' . $insert_count . '/' . 'status updated count - ' . $update_count; // echo 'new invoice inserted count- ' . $insert_count . '/' . 'status updated count - ' . $update_count;
}$response = [ }
$response = [
'status' => true, 'status' => true,
'message' => "Successfully data inserted. Total inserted: " . $insert_count . ", Total Updated: " . $update_count 'message' => "Successfully data inserted. Total inserted: " . $insert_count . ", Total Updated: " . $update_count
]; ];
@ -1629,8 +1603,7 @@ class User extends BaseController
// curl_close($ch); // curl_close($ch);
// } // }
} } catch (\Exception $e) {
catch (\Exception $e) {
$data['err'] = $e->getMessage(); $data['err'] = $e->getMessage();
// $db = \Config\Database::connect(); // $db = \Config\Database::connect();
// $data['last_query'] = $db->getLastQuery();; // $data['last_query'] = $db->getLastQuery();;
@ -1642,7 +1615,8 @@ class User extends BaseController
} }
// END zoho API // END zoho API
function fetchEmployeeDetails() { function fetchEmployeeDetails()
{
$EmpID = $this->request->getPost('EmpID'); $EmpID = $this->request->getPost('EmpID');
if (!$EmpID) { if (!$EmpID) {

View File

@ -48,9 +48,9 @@ if (!function_exists('generateCopyrightNotice')) {
{ {
$current_year = date('Y'); $current_year = date('Y');
if ($current_year > 2024) { if ($current_year > 2024) {
return " Copyright &copy; 2024 - $current_year "; return " &copy; 2024 - $current_year ";
} else { } else {
return " Copyright &copy; $current_year "; return " &copy; $current_year ";
} }
} }
} }

View File

@ -160,7 +160,6 @@ class User_model extends Model
$query = $builder->get(); $query = $builder->get();
$user = $query->getResult(); $user = $query->getResult();
if (!empty($user)) { if (!empty($user)) {
if (password_verify($oldPassword, $user[0]->password)) { if (password_verify($oldPassword, $user[0]->password)) {

View File

@ -966,7 +966,7 @@
</div> </div>
<div class="tab-pane fade" id="fivth"> <div class="tab-pane fade" id="fivth">
<form id="fileForm" method="post" action="#" class="form-horizontal"> <form id="fileForm" method="post" action="#" class="form-horizontal" enctype="multipart/form-data">
<div class="row"> <div class="row">
<div class="col-md-1"> <div class="col-md-1">
</div> </div>
@ -1347,7 +1347,7 @@
e.preventDefault(); // Prevent default form submission e.preventDefault(); // Prevent default form submission
var isValid = true; var isValid = true;
var combinedFormData = ''; var combinedFormData = new FormData(); // Use FormData to handle files
// List of form IDs you want to combine // List of form IDs you want to combine
var formIds = ['#accountForm', '#profileForm', '#bankForm', '#proofForm', '#fileForm']; // Add all your form IDs here var formIds = ['#accountForm', '#profileForm', '#bankForm', '#proofForm', '#fileForm']; // Add all your form IDs here
@ -1362,8 +1362,19 @@
return false; // Break the loop if any form is invalid return false; // Break the loop if any form is invalid
} }
// Serialize and combine the form data // Serialize and append the form data
combinedFormData += $form.serialize() + '&'; // Append each form's serialized data $form.find(':input').each(function() {
var input = $(this);
if (input.attr('type') === 'file') {
// If the input is a file, append it to FormData
$.each(input[0].files, function(i, file) {
combinedFormData.append(input.attr('name'), file);
});
} else {
// Otherwise, append other form data
combinedFormData.append(input.attr('name'), input.val());
}
});
}); });
if (!isValid) { if (!isValid) {
@ -1371,16 +1382,15 @@
return; // Stop the submission if validation fails return; // Stop the submission if validation fails
} }
// Remove the trailing '&' from the combined form data console.log('Combined Form Data:', combinedFormData); // Log the combined form data for debugging
combinedFormData = combinedFormData.slice(0, -1);
console.log('Combined Form Data:', combinedFormData); // Log the combined form data // Now you can send the combined data via AJAX
// Now you can send the combined data via AJAX or perform your desired action
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '<?php echo base_url() ?>addNewEmployee', // Replace with your form submission URL url: '<?php echo base_url() ?>addNewEmployee', // Replace with your form submission URL
data: combinedFormData, data: combinedFormData,
processData: false, // Don't process the data
contentType: false, // Don't set content type
success: function(response) { success: function(response) {
console.log('Form submitted successfully:', response); console.log('Form submitted successfully:', response);
// Handle the success scenario // Handle the success scenario
@ -1398,6 +1408,7 @@
}); });
// Function to navigate to the next tab // Function to navigate to the next tab
function goToNextTab() { function goToNextTab() {
var $activeTab = $('#rootwizard').find('ul.nav li.nav-item a.active'); var $activeTab = $('#rootwizard').find('ul.nav li.nav-item a.active');

View File

@ -229,6 +229,7 @@
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
//alert(data); //alert(data);
console.log(data);
var line = ''; var line = '';
$('#SelectMaterialCode').empty(); $('#SelectMaterialCode').empty();

View File

@ -1,62 +1,21 @@
<div class="content-wrapper"> <div class="content-page">
<!-- Content Header (Page header) --> <div class="content">
<section class="content-header"> <!-- Start Content-->
<h1> <div class="container-fluid">
Change Password <!-- start page title -->
<small>Set new password for your account</small> <div>
</h1>
</section>
<section class="content">
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-6">
<!-- general form elements --> <div class="page-title-box page-title-box-alt">
<div class="box box-success"> <h4 class="page-title"> Change Password
<div class="box-header"> <small>Set new password for your account</small></h4>
<h3 class="box-title">Enter Details</h3>
</div><!-- /.box-header -->
<!-- form start -->
<form role="form" action="<?php echo base_url() ?>changePassword" method="post">
<div class="box-body">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="inputPassword1">Old Password</label>
<input type="password" class="form-control" id="inputOldPassword" placeholder="Old password" name="oldPassword" maxlength="15" required>
</div> </div>
</div> </div>
</div> </div>
<hr>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="inputPassword1">New Password</label>
<input type="password" class="form-control" id="inputPassword1" placeholder="New password" name="newPassword" maxlength="15" required>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="inputPassword2">Confirm New Password</label>
<input type="password" class="form-control" id="inputPassword2" placeholder="Confirm new password" name="cNewPassword" maxlength="15" required>
</div>
</div>
</div>
</div><!-- /.box-body -->
<div class="box-footer">
<input type="submit" class="btn btn-success" value="Submit" />
<input type="reset" class="btn btn-default" value="Reset" />
</div>
</form>
</div>
</div>
<div class="col-md-4">
<?php <?php
helper('form'); helper('form');
$error = session()->getFlashdata('error'); $error = session()->getFlashdata('error');
if($error) if ($error) {
{
?> ?>
<div class="alert alert-danger alert-dismissable"> <div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button> <button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
@ -65,8 +24,7 @@
<?php } ?> <?php } ?>
<?php <?php
$success = session()->getFlashdata('success'); $success = session()->getFlashdata('success');
if($success) if ($success) {
{
?> ?>
<div class="alert alert-success alert-dismissable"> <div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button> <button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
@ -76,8 +34,7 @@
<?php <?php
$noMatch = session()->getFlashdata('nomatch'); $noMatch = session()->getFlashdata('nomatch');
if($noMatch) if ($noMatch) {
{
?> ?>
<div class="alert alert-warning alert-dismissable"> <div class="alert alert-warning alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button> <button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
@ -86,11 +43,54 @@
<?php } ?> <?php } ?>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-12">
<?php //echo validation_errors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true"><3E></button></div>'); ?> <div class="card">
<div class="card-body">
<form role="form" action="<?php echo base_url() ?>changePassword" method="post">
<div class="box-body">
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="inputPassword1">Old Password</label>
<input type="password" class="form-control" id="inputOldPassword" placeholder="Old password" name="oldPassword" maxlength="15" required>
</div> </div>
</div> </div>
</div> </div>
<hr>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="inputPassword1">New Password</label>
<input type="password" class="form-control" id="inputPassword1" placeholder="New password" name="newPassword" maxlength="15" required>
</div> </div>
</section> </div>
<div class="col-md-4">
<div class="form-group">
<label for="inputPassword2">Confirm New Password</label>
<input type="password" class="form-control" id="inputPassword2" placeholder="Confirm new password" name="cNewPassword" maxlength="15" required>
</div>
</div>
</div>
<div class="row">
</div>
</div><!-- /.box-body -->
<div class="box-footer">
<div class="row">
<div class="col-12 text-right">
<input type="reset" class="btn btn-default" style="background-color:red;color:white;" value="Reset" />
<input type="submit" class="btn btn-success" value="Submit" />
</div>
</div>
</div>
</form>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
</div> </div>

View File

@ -481,7 +481,7 @@ function ValidateUA() {
<div class="row" style="margin-bottom: 10px;"> <div class="row" style="margin-bottom: 10px;">
<div class="col-6"> <div class="col-6">
<div class="page-title-box page-title-box-alt"> <div class="page-title-box page-title-box-alt">
<h4 class="page-title">Company Profile</h4> <h4 class="page-title">Business Settings</h4>
</div> </div>
</div> </div>
<div class="col-6 text-right"> <div class="col-6 text-right">
@ -498,7 +498,7 @@ function ValidateUA() {
<form class="form-horizontal" role="form" id="addemployee" action="<?php echo base_url() ?>Updatecompany" method="post" role="form" enctype="multipart/form-data"> <form class="form-horizontal" role="form" id="addemployee" action="<?php echo base_url() ?>Updatecompany" method="post" role="form" enctype="multipart/form-data">
<div class="box-body"> <div class="box-body">
<!-- Supplier Information --> <!-- Supplier Information -->
<legend style="margin-left:-10px;color: #4f7c97;;color: #4f7c97;">Company Information</legend> <legend style="margin-left:-10px;color: #4f7c97;;color: #4f7c97;">Business Information</legend>
<div class="col-md-12" style="margin-bottom: 27px;"> <div class="col-md-12" style="margin-bottom: 27px;">
<div class="form-row"> <div class="form-row">
<div class=" col-md-3"> <div class=" col-md-3">

View File

@ -625,8 +625,10 @@ $('#datepick').change(function() {
<!-- <section class="content-header"> --> <!-- <section class="content-header"> -->
<!-- <h3>Admin Dashboard</h3> --> <!-- <h3>Admin Dashboard</h3> -->
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-4 col-md-offset-4" style="height: 75px;"> <div class="col-12 text-right" style="height: 75px;">
<a href="javascript:void(0)" type="button" class="btn btn-success" onclick="synczohobooks()">Sync With Zoho Books</a> <a href="javascript:void(0)" type="button" title="Sync With Zoho Books" class="btn btn-success" onclick="synczohobooks()">
<i class="fas fa-sync-alt"></i> <!-- <img src="<?php echo base_url();?>public/new_assets/images/zoho_sync.png" alt="Sync Icon" style="width: 20px; height: 20px;"> -->
</a>
</div> </div>
</div> </div>
<!-- </section> --> <!-- </section> -->

View File

@ -207,7 +207,7 @@ if (!empty($EmpDetails)) {
src="<?php echo base_url() . $ProfilePic; ?>" src="<?php echo base_url() . $ProfilePic; ?>"
alt="your image" style="width: 139px;" /><br /> alt="your image" style="width: 139px;" /><br />
<input type='file' onchange="readURL(this);" id="photo" <input type='file' onchange="readURL(this);" id="photo"
value="<?php echo $ProfilePic; ?>" name="photo" /> value="<?php echo base_url() . $ProfilePic; ?>" name="photo" />
<label for="photo">Select profile picture<br /><small>(only .jpg or <label for="photo">Select profile picture<br /><small>(only .jpg or
.png)</small></label> .png)</small></label>
@ -874,13 +874,17 @@ if (!empty($EmpDetails)) {
<div class="col-md-1"> <div class="col-md-1">
</div> </div>
<div class="col-md-11"> <div class="col-md-11">
<div class="row"> <!-- <div class="row"> -->
<!-- <div class="files"> --> <!-- <div class="files"> -->
<div class="col-md-10 text-right">
<button type="button" class="btn btn-primary btn-sm a1" onclick="appendFilesFileds()" id="day" style="display: inline-block;">
Add New File
</button>
</div>
<?php if (count($emp_data) > 0) { <?php if (count($emp_data) > 0) {
foreach ($emp_data as $key => $value) { ?> foreach ($emp_data as $key => $value) { ?>
<div class="col-md-12 pad "> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<span>File Name</span> <span>File Name</span>
<input type="text" maxlength="255" class="form-control" <input type="text" maxlength="255" class="form-control"
@ -921,7 +925,7 @@ if (!empty($EmpDetails)) {
<div id="filesContainer" class="col-12"></div> <div id="filesContainer" class="col-12"></div>
<!-- </div> --> <!-- </div> -->
</div> <!-- </div> -->
</div> </div>
</div> </div>
@ -1617,55 +1621,55 @@ if (!empty($EmpDetails)) {
}); });
$('.submit').click(function(e) { $('.submit').click(function(e) {
e.preventDefault(); // Prevent default form submission e.preventDefault();
var isValid = true; var isValid = true;
var combinedFormData = ''; var combinedFormData = new FormData();
// List of form IDs you want to combine
var formIds = ['#accountForm', '#profileForm', '#bankForm', '#proofForm', '#fileForm']; // Add all your form IDs here var formIds = ['#accountForm', '#profileForm', '#bankForm', '#proofForm', '#fileForm']; // Add all your form IDs here
formIds.forEach(function(formId) { formIds.forEach(function(formId) {
var $form = $(formId); var $form = $(formId);
// Validate the form
if (!$form[0].checkValidity()) { if (!$form[0].checkValidity()) {
isValid = false; isValid = false;
$form.find(':submit').click(); // Trigger the built-in HTML5 validation to show errors $form.find(':submit').click(); // Trigger the built-in HTML5 validation to show errors
return false; // Break the loop if any form is invalid return false; // Break the loop if any form is invalid
} }
// Append the form data to FormData
// Serialize and combine the form data $form.serializeArray().forEach(function(field) {
combinedFormData += $form.serialize() + '&'; // Append each form's serialized data combinedFormData.append(field.name, field.value);
});
// Handle file inputs separately
$form.find('input[type="file"]').each(function() {
var input = $(this);
$.each(input[0].files, function(i, file) {
combinedFormData.append(input.attr('name'), file);
});
});
}); });
if (!isValid) { if (!isValid) {
console.log('Validation failed. Please fill all required fields.'); console.log('Validation failed. Please fill all required fields.');
return; // Stop the submission if validation fails return; // Stop the submission if validation fails
} }
console.log('Form Data Prepared:', combinedFormData); // Log for debugging
// Remove the trailing '&' from the combined form data // Send the combined data via AJAX
combinedFormData = combinedFormData.slice(0, -1);
console.log('Combined Form Data:', combinedFormData); // Log the combined form data
// Now you can send the combined data via AJAX or perform your desired action
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: '<?php echo base_url() ?>employeedetails/UpdateEmployee', // Replace with your form submission URL url: '<?php echo base_url() ?>employeedetails/UpdateEmployee', // Replace with your form submission URL
data: combinedFormData, data: combinedFormData,
processData: false, // Prevent jQuery from processing the data
contentType: false, // Prevent jQuery from setting the content type
success: function(response) { success: function(response) {
console.log('Form submitted successfully:', response); console.log(response);
// Handle the success scenario
// if (response) { console.log('Form submitted successfully:', response == 'true');
// window.location.href = '<?php echo base_url("employeeListing"); ?>'; if (response == 'true') {
// } else { window.location.href = '<?php echo base_url("employeeListing"); ?>';
// alert('Employee details Not Update...'); } else {
// } alert('Employee details Not Update...');
}
}, },
error: function(error) { error: function(error) {
console.log('Form submission failed:', error); console.log('Form submission failed:', error);
// Handle the error scenario
} }
}); });
}); });

View File

@ -95,7 +95,7 @@
</div> </div>
<div class="col-6 text-right"> <div class="col-6 text-right">
<a class="btn btn-success" href="<?php echo base_url(); ?>addemployee">Add New Employee</a> <a class="btn btn-success" href="<?php echo base_url(); ?>addemployee">Add New Employee</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportemployee">Export Employee Details <i class="fa fa-download" aira-hidden="true"></i></a> <!-- <a class="btn btn-success" href="<?php echo base_url(); ?>exportemployee">Export Employee Details <i class="fa fa-download" aira-hidden="true"></i></a> -->
</div> </div>
</div> </div>
<div class="row"> <div class="row">

View File

@ -8,6 +8,7 @@
.form-group { .form-group {
padding-bottom: 0%; padding-bottom: 0%;
} }
.Date-filter-form { .Date-filter-form {
display: flex; display: flex;
align-items: center; align-items: center;
@ -43,6 +44,7 @@
.icon-button:hover { .icon-button:hover {
color: #0056b3; color: #0056b3;
} }
.delete_button { .delete_button {
border: none; border: none;
background-color: white; background-color: white;
@ -87,11 +89,11 @@
<th align="right">Created Date</th> <th align="right">Created Date</th>
<!-- <th align="right">Expense Id</th> --> <!-- <th align="right">Expense Id</th> -->
<th align="right">Supplier Name</th> <th align="right">Supplier Name</th>
<th align="right">GST</th>
<th align="right">Cost</th> <th align="right">Cost</th>
<th align="right">GST</th>
<th align="right">Total</th> <th align="right">Total</th>
<th align="right">Status</th>
<th align="right">Payment Method</th> <th align="right">Payment Method</th>
<th align="right">Status</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
</thead> </thead>
@ -117,11 +119,11 @@
<td><?php echo $cdate; ?></td> <td><?php echo $cdate; ?></td>
<!-- <td><?php echo $record['id']; ?></td> --> <!-- <td><?php echo $record['id']; ?></td> -->
<td><?php echo $record['SupplierName']; ?></td> <td><?php echo $record['SupplierName']; ?></td>
<td><?php echo $record['gst']; ?></td>
<td><?php echo $record['cost']; ?></td> <td><?php echo $record['cost']; ?></td>
<td><?php echo $record['gst']; ?></td>
<td><?php echo $record['total']; ?></td> <td><?php echo $record['total']; ?></td>
<td><?php echo $record['status']; ?></td>
<td><?php echo $record['payment_method']; ?></td> <td><?php echo $record['payment_method']; ?></td>
<td><?php echo $record['status']; ?></td>
<td> <td>
<?php if ($fileExists == 1) { ?> <?php if ($fileExists == 1) { ?>
<button title="Download FIle" class="download_button" onclick="downloadFile('<?php echo $record['id']; ?>', '<?php echo $record['transporter_file']; ?>')" style="border: none;background-color: white;color: #02a8b5;"> <button title="Download FIle" class="download_button" onclick="downloadFile('<?php echo $record['id']; ?>', '<?php echo $record['transporter_file']; ?>')" style="border: none;background-color: white;color: #02a8b5;">
@ -165,7 +167,7 @@
<input type="hidden" name="id" id="id"> <input type="hidden" name="id" id="id">
<div class="form-group row"> <div class="form-group row">
<div class="col-md-5"> <div class="col-md-5">
<label for="transporterfile" class="col-form-label">Transporter File:</label> <label for="transporterfile" class="col-form-label">Transporter File</label>
<input type="file" name="transporterfile" id="transporterfile" class="form-control"> <input type="file" name="transporterfile" id="transporterfile" class="form-control">
<input type="hidden" name="transporterfile_name" id="transporterfile_name"> <input type="hidden" name="transporterfile_name" id="transporterfile_name">
<small id="fileHelp" class="form-text text-muted"> <small id="fileHelp" class="form-text text-muted">
@ -175,7 +177,7 @@
<div class="col-md-1"> <div class="col-md-1">
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
<label for="supplierid" class="col-form-label">Supplier :</label> <label for="supplierid" class="col-form-label">Supplier </label>
<select name="supplierid" id="supplierid" class="form-control" required> <select name="supplierid" id="supplierid" class="form-control" required>
</select> </select>
</div> </div>
@ -183,21 +185,19 @@
<div class="form-group row"> <div class="form-group row">
<div class="col-md-5"> <div class="col-md-5">
<label for="gst" class="col-form-label">Tax:</label> <label for="cost" class="col-form-label">Cost</label>
<input type="number" name="gst" id="gst" class="form-control" > <input type="number" name="cost" id="cost" class="form-control">
</div> </div>
<div class="col-md-1"> <div class="col-md-1">
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
<label for="cost" class="col-form-label">Cost:</label> <label for="gst" class="col-form-label">Tax</label>
<input type="number" name="cost" id="cost" class="form-control"> <input type="number" name="gst" id="gst" class="form-control">
</div> </div>
</div> </div>
<div class="form-group row"> <div class="form-group row">
<div class="col-md-5"> <div class="col-md-5">
<label for="status" class="col-form-label">Status:</label> <label for="status" class="col-form-label">Status</label>
<select name="status" id="status_id" class="form-control" required> <select name="status" id="status_id" class="form-control" required>
<option>Select Status</option> <option>Select Status</option>
<option value="Payment Pending">Payment Pending</option> <option value="Payment Pending">Payment Pending</option>
@ -207,7 +207,7 @@
<div class="col-md-1"> <div class="col-md-1">
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
<label for="payment_method" class="col-form-label">Payment Method:</label> <label for="payment_method" class="col-form-label">Payment Method</label>
<select name="payment_method" id="payment_method" class="form-control" required> <select name="payment_method" id="payment_method" class="form-control" required>
<option>Select Payment Method</option> <option>Select Payment Method</option>
<option value="Cash">Cash</option> <option value="Cash">Cash</option>
@ -217,7 +217,7 @@
</div> </div>
<div class="form-group row"> <div class="form-group row">
<div class="col-md-12"> <div class="col-md-12">
<label for="remarks" class="col-form-label">Remarks:</label> <label for="remarks" class="col-form-label">Remarks</label>
<!-- <input type="text" name="remarks" id="remarks" class="form-control"> --> <!-- <input type="text" name="remarks" id="remarks" class="form-control"> -->
<textarea name="remarks" id="remarks" class="form-control"></textarea> <textarea name="remarks" id="remarks" class="form-control"></textarea>
</div> </div>
@ -269,6 +269,7 @@
var fileName = $(this).val().split('\\').pop(); // Get the file name var fileName = $(this).val().split('\\').pop(); // Get the file name
$('#file-name-display').text(fileName); // Display the file name $('#file-name-display').text(fileName); // Display the file name
}); });
function togglePaymentMethodEdit() { function togglePaymentMethodEdit() {
var status = $('#status_id').val(); var status = $('#status_id').val();
console.log(status); console.log(status);
@ -294,7 +295,9 @@
$.ajax({ $.ajax({
url: '<?php echo base_url() . 'getExpenseDetails'; ?>', url: '<?php echo base_url() . 'getExpenseDetails'; ?>',
type: 'POST', type: 'POST',
data: { id: expenseId }, data: {
id: expenseId
},
success: function(response) { success: function(response) {
var expense = JSON.parse(response); var expense = JSON.parse(response);
$('#id').val(expense.id); $('#id').val(expense.id);
@ -404,9 +407,14 @@
'copy', 'csv', 'excel', 'pdf', 'print' 'copy', 'csv', 'excel', 'pdf', 'print'
], ],
pageLength: 10, pageLength: 10,
lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ], lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
],
responsive: true, responsive: true,
order: [[0, 'desc']], order: [
[0, 'desc']
],
language: { language: {
paginate: { paginate: {
next: '<i class="fas fa-angle-right"></i>', next: '<i class="fas fa-angle-right"></i>',
@ -466,7 +474,10 @@ $(document).on('click', '#deleteFile', function() {
$.ajax({ $.ajax({
url: '<?php echo base_url('deleteFile'); ?>', url: '<?php echo base_url('deleteFile'); ?>',
type: 'POST', type: 'POST',
data: { file_name: fileName, expense_id: expenseId }, data: {
file_name: fileName,
expense_id: expenseId
},
success: function(response) { success: function(response) {
console.log(response); console.log(response);
@ -486,9 +497,6 @@ $(document).on('click', '#deleteFile', function() {
} }
}); });
}); });
</script> </script>

View File

@ -82,6 +82,36 @@
$('#hdate').addClass('form-control'); $('#hdate').addClass('form-control');
$('#hname').addClass('form-control'); $('#hname').addClass('form-control');
}); });
// Zoho Sync FUnction
function synczohobooks() {
var sync = true
$('#loader_wrapper').css("display", "block");
$.ajax({
// $('#loadingDiv').show();
url: "<?php echo base_url() ?>user/zohobooks_api_fetch_all",
type: "post",
data: {
sync
},
success: function(data) {
console.log(data);
alert("Sync Completed");
},
failure: function(data) {
alert("Failed");
},
complete: function() {
$('#loader_wrapper').css("display", "none");
}
});
}
</script> </script>
</body> </body>
</html> </html>

View File

@ -318,7 +318,8 @@
<div class="dropdown-menu dropdown-menu-right profile-dropdown "> <div class="dropdown-menu dropdown-menu-right profile-dropdown ">
<!-- item--> <!-- item-->
<div class="dropdown-header noti-title"> <div class="dropdown-header noti-title">
<h6 class="text-overflow m-0"><?php echo "Welcome ".$role_text." !"; ?><?php //echo $role; ?></h6> <h6 class="text-overflow m-0"><?php echo "Welcome ".$name." !"; ?><?php //echo $role; ?></h6>
<!-- <h6 class="text-overflow m-0"><?php echo "Welcome ".$role_text." !"; ?><?php //echo $role; ?></h6> -->
</div> </div>
<!-- item--> <!-- item-->
@ -397,15 +398,19 @@
<div class="collapse navbar-collapse" id="topnav-menu-content"> <div class="collapse navbar-collapse" id="topnav-menu-content">
<ul class="navbar-nav"> <ul class="navbar-nav">
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle arrow-none" href="#" id="topnav-dashboard" role="button" <a class="nav-link dropdown-toggle arrow-none" href="<?php echo base_url(); ?>sales_dashboard" role="button"
aria-expanded="false">
<i class="ri-dashboard-line mr-1"></i> DASHBOARD
</a>
<!-- <a class="nav-link dropdown-toggle arrow-none" href="#" id="topnav-dashboard" role="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="ri-dashboard-line mr-1"></i> DASHBOARDS <div class="arrow-down"></div> <i class="ri-dashboard-line mr-1"></i> DASHBOARD <div class="arrow-down"></div>
</a> </a>
<div class="dropdown-menu" aria-labelledby="topnav-dashboard"> <div class="dropdown-menu" aria-labelledby="topnav-dashboard">
<a href="<?php echo base_url(); ?>dashboard" class="dropdown-item">Home</a> <a href="<?php echo base_url(); ?>dashboard" class="dropdown-item">Home</a>
<!-- <a href="https://vu.venbait.in/d/d9eb820b-60aa-4fe6-9de0-531924185b77/sales-at-a-glance?orgId=2&from=1715215911333&to=1715237511333" class="dropdown-item">Sales</a> --> <a href="https://vu.venbait.in/d/d9eb820b-60aa-4fe6-9de0-531924185b77/sales-at-a-glance?orgId=2&from=1715215911333&to=1715237511333" class="dropdown-item">Sales</a>
<a href="<?php echo base_url(); ?>sales_dashboard" class="dropdown-item">Sales</a> <a href="<?php echo base_url(); ?>sales_dashboard" class="dropdown-item">Sales</a>
</div> </div> -->
</li> </li>
<li class="nav-item dropdown"> <li class="nav-item dropdown">
@ -414,7 +419,8 @@
<i class="ri-file-paper-2-line mr-1"></i> SALES <div class="arrow-down"></div> <i class="ri-file-paper-2-line mr-1"></i> SALES <div class="arrow-down"></div>
</a> </a>
<div class="dropdown-menu" aria-labelledby="topnav-hr"> <div class="dropdown-menu" aria-labelledby="topnav-hr">
<a href="<?php echo base_url(); ?>sales_invoice" class="dropdown-item"><i class="ri-file-list-3-line align-middle mr-1"></i> Sales Invoice</a> <a href="<?php echo base_url(); ?>sales_invoice" class="dropdown-item"><i class="ri-file-list-3-line align-middle mr-1"></i>Invoice</a>
<a href="<?php echo base_url(); ?>dashboard" class="dropdown-item"><i class="ri-refresh-line align-middle mr-1"></i>Sync With Zoho Books</a>
</div> </div>
</li> </li>
@ -483,8 +489,17 @@
<a href="<?php echo base_url(); ?>ViewPay" class="dropdown-item">PaySlip Generator</a> <a href="<?php echo base_url(); ?>ViewPay" class="dropdown-item">PaySlip Generator</a>
<!-- <a href="<?php echo base_url(); ?>PaysilpListing" class="dropdown-item">Edit Payslip</a> --> <!-- <a href="<?php echo base_url(); ?>PaysilpListing" class="dropdown-item">Edit Payslip</a> -->
<a href="<?php echo base_url(); ?>emppayListings" class="dropdown-item">Employee Loan Details</a> <a href="<?php echo base_url(); ?>emppayListings" class="dropdown-item">Employee Loan Details</a>
</div>
</div>
<div class="dropdown">
<a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-leave"
role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-calendar-times align-middle mr-1"></i> Leave <div class="arrow-down"></div>
</a>
<div class="dropdown-menu" aria-labelledby="topnav-leave">
<a href="<?php echo base_url(); ?>publicholidays" class="dropdown-item">Public Holidays</a> <a href="<?php echo base_url(); ?>publicholidays" class="dropdown-item">Public Holidays</a>
<a href="<?php echo base_url(); ?>leavereports" class="dropdown-item">Leave Reports</a> <a href="<?php echo base_url(); ?>leavereports" class="dropdown-item"> Reports</a>
</div> </div>
</div> </div>
@ -508,7 +523,7 @@
<a href="<?php echo base_url(); ?>transporterListing" class="dropdown-item">Transporter Details</a> <a href="<?php echo base_url(); ?>transporterListing" class="dropdown-item">Transporter Details</a>
<a href="<?php echo base_url(); ?>costListing" class="dropdown-item">Cost Details</a> <a href="<?php echo base_url(); ?>costListing" class="dropdown-item">Cost Details</a>
<a href="<?php echo base_url(); ?>assetListing" class="dropdown-item">Asset Details</a> <a href="<?php echo base_url(); ?>assetListing" class="dropdown-item">Asset Details</a>
<a href="<?php echo base_url(); ?>companyview" class="dropdown-item">Company Master</a> <a href="<?php echo base_url(); ?>companyview" class="dropdown-item">Business Settings</a>
<a href="<?php echo base_url(); ?>configlisting" class="dropdown-item">Config Details</a> <a href="<?php echo base_url(); ?>configlisting" class="dropdown-item">Config Details</a>
<a href="<?php echo base_url(); ?>departmentListing" class="dropdown-item">Department Details</a> <a href="<?php echo base_url(); ?>departmentListing" class="dropdown-item">Department Details</a>
<a href="<?php echo base_url(); ?>rawmaterialListing" class="dropdown-item">Material Details</a> <a href="<?php echo base_url(); ?>rawmaterialListing" class="dropdown-item">Material Details</a>

View File

@ -1868,7 +1868,7 @@ if (!empty($INRSYMBOL)) {
</div> </div>
<div class="form-group col-md-3" id="Deliverydtdiv"> <div class="form-group col-md-3" id="Deliverydtdiv">
<label>Delivery Date<span class="badge mandatory">*</span></label> <label>Delivery Date<span class="badge mandatory">*</span></label>
<input type="date" class="form-control num" data-provide="datepicker" data-date-format="dd/mm/yyyy" data-date-autoclose="true" id="Deliverydt" name="Deliverydt" data-date-end-date="<?= date('d/m/Y'); ?>" required autocomplete="off" value="<?= date('d/m/Y'); ?>"> <input class="form-control num" data-provide="datepicker" data-date-format="dd/mm/yyyy" data-date-autoclose="true" id="Deliverydt" name="Deliverydt" data-date-end-date="<?= date('d/m/Y'); ?>" required autocomplete="off" value="<?= date('d/m/Y'); ?>">
<!-- <div> <!-- <div>
<?php <?php
@ -1898,7 +1898,7 @@ if (!empty($INRSYMBOL)) {
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label>Purchase Order Date</label> <label>Purchase Order Date</label>
<input type="date" class="form-control num" data-provide="datepicker" data-date-format="dd/mm/yyyy" data-date-autoclose="true" id="PODate" name="PODate" data-date-end-date="<?= date('d/m/Y'); ?>" required autocomplete="off" value="<?= date('d/m/Y'); ?>"> <input class="form-control num" data-provide="datepicker" data-date-format="dd/mm/yyyy" data-date-autoclose="true" id="PODate" name="PODate" data-date-end-date="<?= date('d/m/Y'); ?>" required autocomplete="off" value="<?= date('d/m/Y'); ?>">
<!-- <div> <!-- <div>
<?php <?php

View File

@ -86,7 +86,7 @@ span.highlight {
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="page-title-box page-title-box-alt"> <div class="page-title-box page-title-box-alt">
<h4 class="page-title">Requisition Listing</h4> <h4 class="page-title">Requisition List</h4>
<?php if($DraftCount == 0) { ?> <?php if($DraftCount == 0) { ?>
<a class="btn btn-success" href="<?php echo base_url(); ?>RequisitionForm">Raise New Requisition</a> <a class="btn btn-success" href="<?php echo base_url(); ?>RequisitionForm">Raise New Requisition</a>
<?php } ?> <?php } ?>

View File

@ -18,6 +18,7 @@
z-index: 1; z-index: 1;
color: rgb(86, 166, 75); color: rgb(86, 166, 75);
} }
.card_font_colorset_bule { .card_font_colorset_bule {
font-size: 23.7215px; font-size: 23.7215px;
font-weight: 500; font-weight: 500;
@ -26,6 +27,7 @@
z-index: 1; z-index: 1;
color: rgb(31, 96, 196); color: rgb(31, 96, 196);
} }
.card_font_colorset_red { .card_font_colorset_red {
font-size: 23.7215px; font-size: 23.7215px;
font-weight: 500; font-weight: 500;
@ -34,7 +36,6 @@
z-index: 1; z-index: 1;
color: rgb(173, 3, 23); color: rgb(173, 3, 23);
} }
</style> </style>
<style> <style>
#Requisition_filter { #Requisition_filter {
@ -74,21 +75,27 @@ span.highlight {
.Date-filter-form { .Date-filter-form {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 10px; /* Adjust the gap as needed */ gap: 10px;
/* Adjust the gap as needed */
} }
.Date-filter-form input, .Date-filter-form button {
.Date-filter-form input,
.Date-filter-form button {
padding: 5px; padding: 5px;
font-size: 14px; font-size: 14px;
} }
.Date-filter-form button { .Date-filter-form button {
background-color: #007bff; background-color: #007bff;
color: white; color: white;
border: none; border: none;
cursor: pointer; cursor: pointer;
} }
.Date-filter-form button:hover { .Date-filter-form button:hover {
background-color: #0056b3; background-color: #0056b3;
} }
.icon-button { .icon-button {
background: none; background: none;
border: none; border: none;
@ -96,6 +103,7 @@ span.highlight {
color: #007bff; color: #007bff;
font-size: 18px; font-size: 18px;
} }
.icon-button:hover { .icon-button:hover {
color: #0056b3; color: #0056b3;
} }
@ -109,7 +117,7 @@ span.highlight {
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="page-title-box page-title-box-alt"> <div class="page-title-box page-title-box-alt">
<h4 class="page-title">Invoices Table</h4> <h4 class="page-title">Invoices List</h4>
</div> </div>
</div> </div>
</div> </div>
@ -148,7 +156,8 @@ span.highlight {
</thead> </thead>
<tbody> <tbody>
<input type="text" id="invoice_id_set" name="invoice_id_set" hidden> <input type="text" id="invoice_id_set" name="invoice_id_set" hidden>
<?php if(!empty($sales_invoice)){ foreach($sales_invoice as $invoice){ <?php if (!empty($sales_invoice)) {
foreach ($sales_invoice as $invoice) {
$subtotal = $invoice->item_price * $invoice->item_quantity; $subtotal = $invoice->item_price * $invoice->item_quantity;
// Calculate CGST and SGST // Calculate CGST and SGST
@ -182,7 +191,8 @@ span.highlight {
</a> </a>
</td> </td>
</tr> </tr>
<?php } } ?> <?php }
} ?>
</tbody> </tbody>
</table> </table>
</div> <!-- end card body--> </div> <!-- end card body-->
@ -195,6 +205,66 @@ span.highlight {
</div> </div>
<!-- Modal Structure -->
<div class="modal fade" id="invoiceModal" tabindex="-1" role="dialog" aria-labelledby="invoiceModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header" style="display:block">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="standard-modalLabel">
<span id="invoice_number_display_model"></span> -
<span id="date_display_model"></span>
</h4>
<span id="client_name_display_model"></span>
<div class="col-md-12">
</div>
</div>
<div class="modal-body" style="margin-top: 23px;">
<div class="col-md-4">
<button type="button" class="btn btn-primary btn-sm a1" onclick="appendFilesFileds()" id="day">
Add New File
</button>
</div>
<div id="filesContainer">
<!-- Rows will be dynamically appended here -->
</div>
<?php if (isset($invoice_data)) {
foreach ($invoice_data as $key => $value) { ?>
<div class="row pad ">
<div class="col-md-6">
<span>File Name</span>
<input type="text" maxlength="255" class="form-control"
value="<?php echo $value['file_name']; ?>" readonly>
</div>
<div class="col-md-1" style="margin-top: 25px;">
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $value['emp_file']; ?>"
download>
<i class="fa fa-download" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<div class="col-md-5" style="margin-top: 23px;">
<button type="button" class="btn btn-danger btn-sm"
id="<?= $value['id']; ?>"
onclick="removeContact(this)">Delete</button>
</div>
</div>
<?php }
} ?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" onclick="saveAttachment()" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
// Initialize the DataTable // Initialize the DataTable
@ -204,9 +274,14 @@ $(document).ready(function() {
'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons 'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
], ],
pageLength: 10, // Default rows per page pageLength: 10, // Default rows per page
lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ], // Rows per page options lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
], // Rows per page options
responsive: true, // Responsive table responsive: true, // Responsive table
order: [[0, 'desc']], // Default ordering (column index 0, descending) order: [
[0, 'desc']
], // Default ordering (column index 0, descending)
language: { language: {
paginate: { paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon next: '<i class="fas fa-angle-right"></i>', // Next button icon
@ -269,5 +344,164 @@ $(document).ready(function() {
toDateInput.value = fromDate; toDateInput.value = fromDate;
} }
}); });
}); });
function openInvoiceModal(invoiceNumber, clientName, invoiceDateCreated, invoiceId) {
$('#invoice_number_display_model').html(invoiceNumber);
$('#date_display_model').html(invoiceDateCreated);
$('#client_name_display_model').html(clientName);
$('#invoice_id_set').val(invoiceId);
// document.getElementById('modalInvoiceNumber').innerText = invoiceNumber;
$('#day').show();
// $('#invoiceModal').modal('show');
// url: "<?php echo base_url() ?>servicepurchaseorder/getPODetails",
$.ajax({
url: '<?php echo base_url() ?>getInvoiceAttachment',
type: 'GET',
data: {
invoice_number: invoiceId
},
success: function(response) {
console.log(response);
console.log(JSON.parse(response).invoiceAttachment);
var list = JSON.parse(response).invoiceAttachment;
var attachmentsHtml = '';
list.forEach(element => {
console.log(element);
var fileName = element.file_name;
var attachmentName = element.attachment_name;
attachmentsHtml += `
<div class="row pad">
<div class="col-md-4">
<span>File Name</span>
<input type="text" maxlength="255" class="form-control"
value="${attachmentName}" readonly>
</div>
<div class="col-md-1" style="margin-top: 25px;">
<a href="<?php echo base_url() . 'public/uploads/images/invoice_files/' ?>${fileName}" download>
<i class="fa fa-download" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<div class="col-md-5" style="margin-top: 23px;">
<button type="button" class="btn btn-danger btn-sm"
id="${element.invoice_attachment_id}"
onclick="removeContact(this)">Delete</button>
</div>
</div>`;
});
$('#filesContainer').html(attachmentsHtml);
$('#invoiceModal').modal('show');
},
error: function() {
// Handle any errors during the AJAX request
$('#filesContainer').html('<p>There was an error loading the attachments.</p>');
$('#invoiceModal').modal('show');
}
});
}
function appendFilesFileds(data) {
var newRowHtml = `
<div class="row pad">
<div class="col-md-4">
<span for="file_name">File name</span>
<input type="text" id="file_name" name="file_name[]" maxlength="255" class="form-control" value="${data != null && data != '' ? data.file_name : ''}">
</div>
<div class="col-md-4">
<span for="emp_file">File</span>
<input type="file" name="emp_file[]" class="form-control">
</div>
<div class="col-md-4" style="margin-top: 23px;">
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)">Remove</button>
<button type="button" class="btn btn-primary btn-sm a1" onclick="appendFilesFileds()">Add</button>
</div>
</div>`;
// Append the new row to the container
$('#filesContainer').append(newRowHtml);
// Hide all "Add" buttons except the last one
$('.a1').hide();
$('#filesContainer .pad:last .a1').show();
}
function removeContact(button) {
$(button).closest('.pad').remove();
$('#filesContainer .a1').hide();
$('#filesContainer .pad:last .a1').show();
var len = $('#filesContainer .pad:last .a1')
var length = len.length;
if (length == 0) {
$('#day').show()
} else {
$('#day').hide()
}
console.log("-------------------");
console.log(button);
console.log($(button).val());
console.log($(button).attr('id'));
$.ajax({
url: '<?php echo base_url() ?>deleteAttachment',
type: 'GET',
data: {
invoice_attachment_id: $(button).attr('id')
},
success: function(response) {
console.log(response);
},
error: function() {
}
});
}
function saveAttachment() {
var formData = new FormData();
var invoiceId = $('#invoice_id_set').val();
formData.append('invoice_id', invoiceId);
// Append files
$('input[name="emp_file[]"]').each(function(index, input) {
var files = $(input)[0].files;
if (files.length > 0) {
formData.append('emp_file[]', files[0]);
}
});
// Append other fields
$('input[name="file_name[]"]').each(function(index, input) {
formData.append('file_name[]', $(input).val());
});
// AJAX request using FormData
$.ajax({
url: '<?php echo base_url() ?>saveAttachment',
type: 'POST',
data: formData,
processData: false, // Prevent jQuery from converting the data
contentType: false, // Prevent jQuery from overriding the content type
success: function(response) {
console.log(response);
if (response.success) {
$('#invoiceModal').modal('hide');
// Handle success
} else {
alert(response.message);
}
},
error: function() {
alert('An error occurred while saving the attachment.');
}
});
}
</script> </script>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB