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

View File

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

View File

@ -37,7 +37,9 @@ class Login extends BaseController
return view('login');
} else {
// 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');
} else {
// 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;
if ($DEPCode == SECURITY) {
return redirect()->to(site_url('/dashboard'));
// return redirect()->to(site_url('/dashboard'));
return redirect()->to(site_url('/sales_dashboard'));
} else {
return redirect()->to(site_url('/dashboard'));
return redirect()->to(site_url('/sales_dashboard'));
// return redirect()->to(site_url('/dashboard'));
}
}
} else {

View File

@ -5,18 +5,21 @@ namespace App\Controllers;
use App\Controllers\BaseController;
use App\Models\Ipinvoice_model;
use App\Models\Ipattachment_model;
require_once 'vendor/autoload.php';
class Sales extends BaseController
{
protected $ipinvoice_model;
protected $ipattachment_model;
protected $session;
public function __construct()
{
parent::__construct();
$this->ipinvoice_model = new Ipinvoice_model();
$this->ipattachment_model = new Ipattachment_model();
$this->session = session();
$this->isLoggedIn();
}
@ -91,8 +94,7 @@ class Sales extends BaseController
// Invoice Attachments
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);
}

View File

@ -14,6 +14,7 @@ use App\Models\User_model;
use App\Models\Ipinvoice_model;
use App\Models\Ipattachment_model;
use App\Models\Zohobooks_api_model;
require_once 'vendor/autoload.php';
/**
@ -107,7 +108,7 @@ class User extends BaseController
$data['capitalbud'] = $this->dahsboard_Model->capitalbud();
$data['typebal'] = [];// $this->dahsboard_Model->typebal();
$data['typebal'] = []; // $this->dahsboard_Model->typebal();
/* HR DASHBOARD Controller Start*/
@ -253,8 +254,7 @@ class User extends BaseController
$working = array();
$overtime = array();
//$holid = array();
for ($i = 1; $i <= $dat; $i++)
{
for ($i = 1; $i <= $dat; $i++) {
$Working[] = 'WH' . $i;
$overtime[] = 'OT' . $i;
@ -380,11 +380,11 @@ class User extends BaseController
$date = $this->request->getPost("id");
$daydate = format_date($date,0,'Y-m');
$daydate = format_date($date, 0, 'Y-m');
$daydate = $daydate . '-01';
$WH = 'WH' . format_date($date,0,'j');
$WH = 'WH' . format_date($date, 0, 'j');
$yesterday = $this->dahsboard_Model->attyesterday($WH, $daydate);
@ -407,7 +407,7 @@ class User extends BaseController
$data['today'] = $values;
$data['absname'] = $absEmp;
$OT = 'OT' .format_date($date,0,'j');
$OT = 'OT' . format_date($date, 0, 'j');
$CUR_month = date('t');
@ -488,7 +488,7 @@ class User extends BaseController
$working = array();
$overtime = array();
//$holid = array();
$len = format_date($date,0,'d');
$len = format_date($date, 0, 'd');
for ($i = 1; $i <= $len; $i++) //echo $dat; die;
{
@ -704,7 +704,6 @@ class User extends BaseController
if ($CURMONTH == $doj_month && $CURYEAR == $doj_year) {
$data['CUR_month'] = $CURDATE - $doj_day + 1;
} else {
$data['CUR_month'] = $date;
}
@ -1009,7 +1008,7 @@ class User extends BaseController
$email = $this->request->getPost('MailID');
$SelectedDepartment = (string)$this->request->getPost('txtSelectedDepartment');
$comma_separated = explode(':', $SelectedDepartment);
if(count($comma_separated)== 1 && in_array('DEP27', $comma_separated)){
if (count($comma_separated) == 1 && in_array('DEP27', $comma_separated)) {
$roleId = '6';
}
$userInfo = [
@ -1176,7 +1175,7 @@ class User extends BaseController
{
$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');
$this->validator->setRules(['oldPassword', 'Old 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(['oldPassword', 'Old 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]']);
if ($this->validator->run() == FALSE) {
$this->loadChangePass();
} else {
// if ($this->validator->run() == FALSE) {
$oldPassword = $this->request->getPost('oldPassword');
$newPassword = $this->request->getPost('newPassword');
$cNewPassword = $this->request->getPost('newPassword');
if($newPassword === $cNewPassword && $oldPassword != $newPassword) {
$resultPas = $this->user_model->matchOldPassword($this->vendorId, $oldPassword);
if (empty($resultPas)) {
$this->session->setFlashdata('nomatch', 'Your old password not correct');
return redirect()->route('loadChangePass');
} else {
$usersData = array(
'password' => getHashedPassword($newPassword), 'updatedBy' => $this->vendorId,
'password' => getHashedPassword($newPassword),
'updatedBy' => $this->vendorId,
'updatedDtm' => date('Y-m-d H:i:sa')
);
$this->session->setFlashdata('error', 'Password updation failed');
$result = $this->user_model->changePassword($this->vendorId, $usersData);
if ($result > 0) {
$this->session->setFlashdata('success', 'Password updation successful');
} else {
@ -1236,7 +1233,6 @@ class User extends BaseController
$data['fy'] = $this->user_model->fincalYear();
$data['per'] = $this->user_model->deliver_perform($fa, $aa, $m);
}
$data['fy'] = $this->user_model->fincalYear();
@ -1281,30 +1277,28 @@ class User extends BaseController
}
}
function zohobooks_api_fetch_all(){
function zohobooks_api_fetch_all()
{
// print_r($_GET);
// echo isset($_GET['from']) ? $_GET['from'] : 'n';
// echo isset($_GET['to']) ? $_GET['to'] : 'n';
// die();
try{
try {
// if (isset($_POST['sync']) || $_GET['from'] != null && $_GET['to'] != null)
// {
// $ch=curl_init();
//$this->load->helper('zohobooks_fetch_api_helper');
helper('zohobook');
$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_yesterday = $_GET['from'];
}
else
{
} else {
$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)));
}
// echo $date_today.'--'.$date_yesterday;die;
$chk_acc_token_val = $Zohobook_model->get_data('zohobook_accesstoken','id' , 1);
$chk_acc_token_val = $Zohobook_model->get_data('zohobook_accesstoken', 'id', 1);
// print_r($chk_acc_token_val);//die();
$date = new \DateTime($chk_acc_token_val[0]['created_at']);
//print_r($date);
@ -1313,32 +1307,36 @@ class User extends BaseController
//echo '****************';
//print_r(date('Y-m-d h:i:s'));
$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']; }
else { $token = generateNewToken(); $tokendata['token'] = $token; $Zohobook_model->customUpdate($tokendata , 1,'zohobook_accesstoken'); }
if ($date->format('Y-m-d H:i:s') > date('Y-m-d H:i:s')) {
$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;
//$Zohobook_model->update($tokendata , 1,'zohobook_accesstoken');
$result = getheringInvoiceDetails($date_today , $date_yesterday , $token);
$result = getheringInvoiceDetails($date_today, $date_yesterday, $token);
$headers_new = $result['headers_new'];
$res = json_decode($result['data'],true);
$res = json_decode($result['data'], true);
$inv_array = $res['invoices'];
// print_r($inv_array);
// echo "rrrr";
// die();
foreach($inv_array as $inv){
foreach ($inv_array as $inv) {
$invoice_id = $inv['invoice_id'];
//filter only einvoice status pushed invoices only
//&& isset($inv['einvoice_details']) && isset($inv['einvoice_details']['status']) && ($inv['einvoice_details']['status'] == 'pushed')
if($invoice_id !== "" ){
if ($invoice_id !== "") {
$organization_id = '776847408';
$result2=getheringInvoiceSubDetails($invoice_id,$organization_id,$headers_new);
$resall = json_decode($result2,true);
$result2 = getheringInvoiceSubDetails($invoice_id, $organization_id, $headers_new);
$resall = json_decode($result2, true);
$res2[] = $resall['invoice'];
}
}
$insert_count = 0;
$update_count = 0;
foreach($res2 as $rs)
{
foreach ($res2 as $rs) {
$gst_no = $rs['gst_no'];
$invoice_number = $rs['invoice_number'];
$invoice_date = $rs['date'];
@ -1347,35 +1345,33 @@ class User extends BaseController
$invoice_url = $rs['invoice_url'];
$einvoice_number = $rs['einvoice_details']['inv_ref_num'];
$invoice_time=$rs['created_time'];
$invoice_time = $rs['created_time'];
$time_array = explode("T", $invoice_time);
$time_array = explode("+",$time_array[1]);
$time_array = explode("+", $time_array[1]);
$invoice_time = $time_array[0];
$sql_invoice_chk = $Zohobook_model->ip_invoices($invoice_number , $invoice_date);
if($sql_invoice_chk <= 0)
{
$sql_invoice_chk = $Zohobook_model->ip_invoices($invoice_number, $invoice_date);
if ($sql_invoice_chk <= 0) {
$gst_sql = $Zohobook_model->ip_clients($gst_no);
if($gst_sql)
{
if ($gst_sql) {
$client_id = $gst_sql[0]['client_id'];
log_message('error', 'Data fetch success DB : ip_clients , client_id : '.$client_id);
}
else
{
log_message('error', 'No data => Data fetch failed DB : ip_clients '.$gst_no);
log_message('error', 'Data fetch success DB : ip_clients , client_id : ' . $client_id);
} else {
log_message('error', 'No data => Data fetch failed DB : ip_clients ' . $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');
$client_id = $gst_inserted_id;
log_message('error', 'New Data Created : DB : ip_clients , client_id : '.$client_id);
log_message('error', 'New Data Created : DB : ip_clients , client_id : ' . $client_id);
}
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$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;
$ip_invoices['user_id'] = 1;
@ -1392,10 +1388,9 @@ class User extends BaseController
$ip_invoices['status'] = $status;
$ip_invoices['e_invoice_number'] = $einvoice_number;
$ip_invoices['invoice_url'] = $invoice_url;
$invoice_insert_id = $Zohobook_model->customInsert($ip_invoices,'ip_invoices');
if($invoice_insert_id)
{
log_message('error', 'Data insert success DB : ip_invoices client id :'. $client_id);
$invoice_insert_id = $Zohobook_model->customInsert($ip_invoices, 'ip_invoices');
if ($invoice_insert_id) {
log_message('error', 'Data insert success DB : ip_invoices client id :' . $client_id);
$insert_count = $insert_count + 1;
//start invoice level custom fields
@ -1403,17 +1398,17 @@ class User extends BaseController
$batch_no = isset($rs['custom_fields'][5]['value']) ? $rs['custom_fields'][5]['value'] : "";
// $batch_no = "";
$vehicle_number = isset($rs['custom_field_hash']['cf_vehicle_number']) ? $rs['custom_field_hash']['cf_vehicle_number']: '';
$transport_mode =isset($rs['custom_field_hash']['cf_transport_mode']) ? $rs['custom_field_hash']['cf_transport_mode'] : '';
$purchase_order_date = isset($rs['custom_field_hash']['cf_purchase_order_date'])?$rs['custom_field_hash']['cf_purchase_order_date']:'';
$vehicle_number = isset($rs['custom_field_hash']['cf_vehicle_number']) ? $rs['custom_field_hash']['cf_vehicle_number'] : '';
$transport_mode = isset($rs['custom_field_hash']['cf_transport_mode']) ? $rs['custom_field_hash']['cf_transport_mode'] : '';
$purchase_order_date = isset($rs['custom_field_hash']['cf_purchase_order_date']) ? $rs['custom_field_hash']['cf_purchase_order_date'] : '';
$driver = isset($rs['custom_field_hash']['cf_driver']) ? $rs['custom_field_hash']['cf_driver'] : '';
$place_of_supply = isset($rs['custom_field_hash']['cf_place_of_supply']) ? $rs['custom_field_hash']['cf_place_of_supply']:'';
$place_of_supply = isset($rs['custom_field_hash']['cf_place_of_supply']) ? $rs['custom_field_hash']['cf_place_of_supply'] : '';
// batch_no
$ip_invoice_custom_b['invoice_id'] = $invoice_insert_id;
$ip_invoice_custom_b['invoice_custom_fieldid'] = 62;
$ip_invoice_custom_b['invoice_custom_fieldvalue'] = $batch_no;
$result_invoice_custom_insert = $Zohobook_model->customInsert($ip_invoice_custom_b,'ip_invoice_custom');
if($result_invoice_custom_insert)
$result_invoice_custom_insert = $Zohobook_model->customInsert($ip_invoice_custom_b, 'ip_invoice_custom');
if ($result_invoice_custom_insert)
log_message('error', 'Data insert success DB : ip_invoice_custom ');
else
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
@ -1421,8 +1416,8 @@ class User extends BaseController
$ip_invoice_custom_v['invoice_id'] = $invoice_insert_id;
$ip_invoice_custom_v['invoice_custom_fieldid'] = 8;
$ip_invoice_custom_v['invoice_custom_fieldvalue'] = $vehicle_number;
$res_vehicle = $Zohobook_model->customInsert($ip_invoice_custom_v,'ip_invoice_custom');
if($res_vehicle)
$res_vehicle = $Zohobook_model->customInsert($ip_invoice_custom_v, 'ip_invoice_custom');
if ($res_vehicle)
log_message('error', 'Data insert success DB : ip_invoice_custom ');
else
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
@ -1430,8 +1425,8 @@ class User extends BaseController
$ip_invoice_custom_t['invoice_id'] = $invoice_insert_id;
$ip_invoice_custom_t['invoice_custom_fieldid'] = 7;
$ip_invoice_custom_t['invoice_custom_fieldvalue'] = $transport_mode;
$res_transport_mode = $Zohobook_model->customInsert($ip_invoice_custom_t,'ip_invoice_custom');
if($res_transport_mode)
$res_transport_mode = $Zohobook_model->customInsert($ip_invoice_custom_t, 'ip_invoice_custom');
if ($res_transport_mode)
log_message('error', 'Data insert success DB : ip_invoice_custom ');
else
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
@ -1439,8 +1434,8 @@ class User extends BaseController
$ip_invoice_custom_p['invoice_id'] = $invoice_insert_id;
$ip_invoice_custom_p['invoice_custom_fieldid'] = 15;
$ip_invoice_custom_p['invoice_custom_fieldvalue'] = $purchase_order_date;
$res_purchase_order_date =$Zohobook_model->customInsert($ip_invoice_custom_p,'ip_invoice_custom');
if($res_purchase_order_date)
$res_purchase_order_date = $Zohobook_model->customInsert($ip_invoice_custom_p, 'ip_invoice_custom');
if ($res_purchase_order_date)
log_message('error', 'Data insert success DB : ip_invoice_custom ');
else
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
@ -1448,8 +1443,8 @@ class User extends BaseController
$ip_invoice_custom_d['invoice_id'] = $invoice_insert_id;
$ip_invoice_custom_d['invoice_custom_fieldid'] = 58;
$ip_invoice_custom_d['invoice_custom_fieldvalue'] = $driver;
$res_driver = $Zohobook_model->customInsert($ip_invoice_custom_d,'ip_invoice_custom');
if($res_driver)
$res_driver = $Zohobook_model->customInsert($ip_invoice_custom_d, 'ip_invoice_custom');
if ($res_driver)
log_message('error', 'Data insert success DB : ip_invoice_custom ');
else
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
@ -1457,20 +1452,18 @@ class User extends BaseController
$ip_invoice_custom_d['invoice_id'] = $invoice_insert_id;
$ip_invoice_custom_d['invoice_custom_fieldid'] = 10;
$ip_invoice_custom_d['invoice_custom_fieldvalue'] = $place_of_supply;
$res_place = $Zohobook_model->customInsert($ip_invoice_custom_d,'ip_invoice_custom');
if($res_place)
$res_place = $Zohobook_model->customInsert($ip_invoice_custom_d, 'ip_invoice_custom');
if ($res_place)
log_message('error', 'Data insert success DB : ip_invoice_custom ');
else
log_message('error', 'Data insert failed DB : ip_invoice_custom ');
//end invoice level custom fields
//if line items available
if(isset($rs['line_items']) && count($rs['line_items']) > 0)
{
log_message('error', 'Processing line items'.count($rs['line_items']));
if (isset($rs['line_items']) && count($rs['line_items']) > 0) {
log_message('error', 'Processing line items' . count($rs['line_items']));
for($i = 0; $i< count($rs['line_items']);$i++)
{ //start insert line items
for ($i = 0; $i < count($rs['line_items']); $i++) { //start insert line items
$sku = $rs['line_items'][$i]['sku'];
@ -1484,36 +1477,30 @@ class User extends BaseController
$sgst = $rs['line_items'][$i]['line_item_taxes'][0]['tax_name'];
$cgst = $cgst[4];
$sgst = $sgst[4];
$cgst = $cgst.'.000';
$cgst = $cgst . '.000';
$getcgsttax = $Zohobook_model->ip_tax_rates($cgst);
if($getcgsttax)
{
if ($getcgsttax) {
$cgsttaxid = $getcgsttax[0]['tax_rate_id'];
log_message('error', 'Data fetch success DB : ip_tax_rates cgst'. $cgst);
}
else
{
log_message('error', 'No data => Data fetch failed DB : ip_tax_rates '. $cgst);
log_message('error', 'Data fetch success DB : ip_tax_rates cgst' . $cgst);
} else {
log_message('error', 'No data => Data fetch failed DB : ip_tax_rates ' . $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');
$cgsttaxid = $getcgsttax;
log_message('error', 'New Data Created : DB : ip_tax_rates , tax_rate_id : '.$cgsttaxid);
log_message('error', 'New Data Created : DB : ip_tax_rates , tax_rate_id : ' . $cgsttaxid);
}
$sgst = $sgst.'.000';
$sgst = $sgst . '.000';
$getsgsttax = $Zohobook_model->ip_tax_rates($sgst);
if($getsgsttax)
{
if ($getsgsttax) {
$sgsttaxid = $getsgsttax[0]['tax_rate_id'];
log_message('error', 'Data fetch success DB : ip_tax_rates sgst'. $sgst);
}
else
{
log_message('error', 'No data => Data fetch failed DB : ip_tax_rates '. $sgst);
log_message('error', 'Data fetch success DB : ip_tax_rates sgst' . $sgst);
} else {
log_message('error', 'No data => Data fetch failed DB : ip_tax_rates ' . $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');
$sgsttaxid = $getsgsttax;
log_message('error', 'New Data Created : DB : ip_tax_rates , tax_rate_id : '.$sgsttaxid);
log_message('error', 'New Data Created : DB : ip_tax_rates , tax_rate_id : ' . $sgsttaxid);
}
$item_subtotal = $rs['line_items'][$i]['item_total'];
@ -1530,23 +1517,20 @@ class User extends BaseController
$sku_sql = $Zohobook_model->ip_products($sku);
if(!empty($sku_sql))
{
if (!empty($sku_sql)) {
$product_id = $sku_sql[0]['product_id'];
log_message('error', 'Data fetch success DB : ip_products , product_id : '.$product_id);
}
else
{
log_message('error', 'No data => Data fetch failed DB : ip_products '. $sku);
log_message('error', 'Data fetch success DB : ip_products , product_id : ' . $product_id);
} else {
log_message('error', 'No data => Data fetch failed DB : ip_products ' . $sku);
$sku_data['product_name'] = $item_name;
$sku_data['product_description'] = $item_description;
$sku_data['sku'] = $sku;
$sku_inserted_id = $Zohobook_model->customInsert($sku_data,'ip_products');
$sku_inserted_id = $Zohobook_model->customInsert($sku_data, 'ip_products');
$product_id = $sku_inserted_id;
log_message('error', '$sku_sql => Data fetch failed DB : ip_products '. $sku_sql);
log_message('error', '$sku_sql => Data fetch failed DB : ip_products ' . $sku_sql);
log_message('error', 'sku'.$sku);
log_message('error', 'New Data Created : DB : product_id , product_id : '.$product_id);
log_message('error', 'sku' . $sku);
log_message('error', 'New Data Created : DB : product_id , product_id : ' . $product_id);
}
//#1
@ -1562,11 +1546,11 @@ class User extends BaseController
$ip_invoice_items['item_product_unit'] = $item_product_unit;
$ip_invoice_items['Sgst_item_tax_rate_id'] = $sgsttaxid;
$ip_invoice_items['Cgst_item_tax_rate_id'] = $cgsttaxid;
$item_insert_id = $Zohobook_model->customInsert($ip_invoice_items,'ip_invoice_items');
if($item_insert_id)
log_message('error', 'Data insert success DB : ip_invoice_items => Sgst_item_tax_rate_id :'. $sgsttaxid);
$item_insert_id = $Zohobook_model->customInsert($ip_invoice_items, 'ip_invoice_items');
if ($item_insert_id)
log_message('error', 'Data insert success DB : ip_invoice_items => Sgst_item_tax_rate_id :' . $sgsttaxid);
else
log_message('error', 'Data insert failed DB : ip_invoice_items => Sgst_item_tax_rate_id :'. $sgsttaxid);
log_message('error', 'Data insert failed DB : ip_invoice_items => Sgst_item_tax_rate_id :' . $sgsttaxid);
//tax amount -- ip_invoice_item_amounts - table
$ip_invoice_item_amounts['item_id'] = $item_insert_id;
@ -1577,28 +1561,20 @@ class User extends BaseController
$ip_invoice_item_amounts['item_cgst_amt'] = $item_cgst_amt;
$ip_invoice_item_amounts['item_discount'] = $item_discount;
$ip_invoice_item_amounts['item_igst_amt'] = $item_igst_amt;
$result_tax_amount_insert = $Zohobook_model->customInsert($ip_invoice_item_amounts,'ip_invoice_item_amounts');
if($result_tax_amount_insert)
$result_tax_amount_insert = $Zohobook_model->customInsert($ip_invoice_item_amounts, 'ip_invoice_item_amounts');
if ($result_tax_amount_insert)
log_message('error', 'Data insert success DB : ip_invoice_item_amounts ');
else
log_message('error', 'Data insert failed DB : ip_invoice_item_amounts ');
} //end line items insert
}
else
{
} else {
log_message('error', 'Line Items not found in API result');
}
} else {
log_message('error', 'Data insert failed DB : ip_invoice_items client id :' . $client_id);
}
else
{
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")
// {
@ -1607,13 +1583,10 @@ class User extends BaseController
// echo 'script' . $invoice_number. $status;
// print_r( $sql_invoice_update);
// echo '<br>';
$sql_invoice_update = $Zohobook_model->sql_invoice_update($sql_invoice_update,$invoice_number,$invoice_date,'ip_invoices');
if($sql_invoice_update)
{
$sql_invoice_update = $Zohobook_model->sql_invoice_update($sql_invoice_update, $invoice_number, $invoice_date, 'ip_invoices');
if ($sql_invoice_update) {
log_message('error', 'Data update success DB : ip_invoices ');
}
else
{
} else {
log_message('error', 'Data update failed DB : ip_invoices ');
}
$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;
}$response = [
}
$response = [
'status' => true,
'message' => "Successfully data inserted. Total inserted: " . $insert_count . ", Total Updated: " . $update_count
];
@ -1629,12 +1603,11 @@ class User extends BaseController
// curl_close($ch);
// }
}
catch (\Exception $e) {
} catch (\Exception $e) {
$data['err'] = $e->getMessage();
// $db = \Config\Database::connect();
// $data['last_query'] = $db->getLastQuery();;
$Zohobook_model->customInsert($data,'zohobook_api_err');
$Zohobook_model->customInsert($data, 'zohobook_api_err');
log_message('error', "Data insertion failed : " . $e->getMessage());
return json_encode("Data insertion failed : " . $e->getMessage());
@ -1642,7 +1615,8 @@ class User extends BaseController
}
// END zoho API
function fetchEmployeeDetails() {
function fetchEmployeeDetails()
{
$EmpID = $this->request->getPost('EmpID');
if (!$EmpID) {

View File

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

View File

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

View File

@ -966,7 +966,7 @@
</div>
<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="col-md-1">
</div>
@ -1347,7 +1347,7 @@
e.preventDefault(); // Prevent default form submission
var isValid = true;
var combinedFormData = '';
var combinedFormData = new FormData(); // Use FormData to handle files
// List of form IDs you want to combine
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
}
// Serialize and combine the form data
combinedFormData += $form.serialize() + '&'; // Append each form's serialized data
// Serialize and append the form 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) {
@ -1371,22 +1382,21 @@
return; // Stop the submission if validation fails
}
// Remove the trailing '&' from the combined form data
combinedFormData = combinedFormData.slice(0, -1);
console.log('Combined Form Data:', combinedFormData); // Log the combined form data for debugging
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
// Now you can send the combined data via AJAX
$.ajax({
type: 'POST',
url: '<?php echo base_url() ?>addNewEmployee', // Replace with your form submission URL
data: combinedFormData,
processData: false, // Don't process the data
contentType: false, // Don't set content type
success: function(response) {
console.log('Form submitted successfully:', response);
// Handle the success scenario
if(response){
if (response) {
window.location.href = '<?php echo base_url("employeeListing"); ?>';
}else{
} else {
alert('Employee details Not Update...');
}
},
@ -1398,6 +1408,7 @@
});
// Function to navigate to the next tab
function goToNextTab() {
var $activeTab = $('#rootwizard').find('ul.nav li.nav-item a.active');

View File

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

View File

@ -1,62 +1,21 @@
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Change Password
<small>Set new password for your account</small>
</h1>
</section>
<section class="content">
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-md-4">
<!-- general form elements -->
<div class="box box-success">
<div class="box-header">
<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 class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title"> Change Password
<small>Set new password for your account</small></h4>
</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
helper('form');
$error = session()->getFlashdata('error');
if($error)
{
if ($error) {
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
@ -65,8 +24,7 @@
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if($success)
{
if ($success) {
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
@ -76,8 +34,7 @@
<?php
$noMatch = session()->getFlashdata('nomatch');
if($noMatch)
{
if ($noMatch) {
?>
<div class="alert alert-warning alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
@ -86,11 +43,54 @@
<?php } ?>
<div class="row">
<div class="col-md-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="col-12">
<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>
<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>
</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>

View File

@ -481,7 +481,7 @@ function ValidateUA() {
<div class="row" style="margin-bottom: 10px;">
<div class="col-6">
<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 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">
<div class="box-body">
<!-- 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="form-row">
<div class=" col-md-3">

View File

@ -625,8 +625,10 @@ $('#datepick').change(function() {
<!-- <section class="content-header"> -->
<!-- <h3>Admin Dashboard</h3> -->
<div class="row">
<div class="col-xs-12 col-md-4 col-md-offset-4" style="height: 75px;">
<a href="javascript:void(0)" type="button" class="btn btn-success" onclick="synczohobooks()">Sync With Zoho Books</a>
<div class="col-12 text-right" style="height: 75px;">
<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>
<!-- </section> -->

View File

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

View File

@ -95,7 +95,7 @@
</div>
<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(); ?>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 class="row">

View File

@ -8,6 +8,7 @@
.form-group {
padding-bottom: 0%;
}
.Date-filter-form {
display: flex;
align-items: center;
@ -43,7 +44,8 @@
.icon-button:hover {
color: #0056b3;
}
.delete_button{
.delete_button {
border: none;
background-color: white;
color: red;
@ -87,11 +89,11 @@
<th align="right">Created Date</th>
<!-- <th align="right">Expense Id</th> -->
<th align="right">Supplier Name</th>
<th align="right">GST</th>
<th align="right">Cost</th>
<th align="right">GST</th>
<th align="right">Total</th>
<th align="right">Status</th>
<th align="right">Payment Method</th>
<th align="right">Status</th>
<th>Action</th>
</tr>
</thead>
@ -117,20 +119,20 @@
<td><?php echo $cdate; ?></td>
<!-- <td><?php echo $record['id']; ?></td> -->
<td><?php echo $record['SupplierName']; ?></td>
<td><?php echo $record['gst']; ?></td>
<td><?php echo $record['cost']; ?></td>
<td><?php echo $record['gst']; ?></td>
<td><?php echo $record['total']; ?></td>
<td><?php echo $record['status']; ?></td>
<td><?php echo $record['payment_method']; ?></td>
<td><?php echo $record['status']; ?></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;">
<i class="fas fa-file-download"></i>
</button>
<button title="Delete File" id="deleteFile" class="delete_button" data-value="<?php echo $record['id'] ?>" data-id="<?php echo $record['id'] ?>" data-file="<?php echo $record['transporter_file'] ?>"><i class="fas fa-trash"></i></button>
<?php } ?>
<button title="Edit" class="edit-button" data-toggle="modal" data-target="#expenseModal" data-id="<?php echo $record['id']; ?>" style="border: none;background-color: white;color: #02a8b5;" >
<button title="Edit" class="edit-button" data-toggle="modal" data-target="#expenseModal" data-id="<?php echo $record['id']; ?>" style="border: none;background-color: white;color: #02a8b5;">
<i class="fas fa-pencil-alt"></i>
</button>
</td>
@ -165,7 +167,7 @@
<input type="hidden" name="id" id="id">
<div class="form-group row">
<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="hidden" name="transporterfile_name" id="transporterfile_name">
<small id="fileHelp" class="form-text text-muted">
@ -175,7 +177,7 @@
<div class="col-md-1">
</div>
<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>
</div>
@ -183,21 +185,19 @@
<div class="form-group row">
<div class="col-md-5">
<label for="gst" class="col-form-label">Tax:</label>
<input type="number" name="gst" id="gst" class="form-control" >
<label for="cost" class="col-form-label">Cost</label>
<input type="number" name="cost" id="cost" class="form-control">
</div>
<div class="col-md-1">
</div>
<div class="col-md-5">
<label for="cost" class="col-form-label">Cost:</label>
<input type="number" name="cost" id="cost" class="form-control">
<label for="gst" class="col-form-label">Tax</label>
<input type="number" name="gst" id="gst" class="form-control">
</div>
</div>
<div class="form-group row">
<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>
<option>Select Status</option>
<option value="Payment Pending">Payment Pending</option>
@ -207,7 +207,7 @@
<div class="col-md-1">
</div>
<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>
<option>Select Payment Method</option>
<option value="Cash">Cash</option>
@ -217,7 +217,7 @@
</div>
<div class="form-group row">
<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"> -->
<textarea name="remarks" id="remarks" class="form-control"></textarea>
</div>
@ -258,7 +258,7 @@
$('#status_id').on('change', function() {
togglePaymentMethod();
});
});
});
$(document).ready(function() {
$('#supplierid').select2();
@ -269,6 +269,7 @@
var fileName = $(this).val().split('\\').pop(); // Get the file name
$('#file-name-display').text(fileName); // Display the file name
});
function togglePaymentMethodEdit() {
var status = $('#status_id').val();
console.log(status);
@ -289,12 +290,14 @@
supplier_list[0].forEach(function(supplier) {
$('#supplierid').append('<option value="' + supplier.SupplierID + '">' + supplier.SupplierName + '</option>');
});
formActionUrl = '<?php echo base_url().'editExpense' ?>'; // Set action URL for adding
formActionUrl = '<?php echo base_url() . 'editExpense' ?>'; // Set action URL for adding
$.ajax({
url: '<?php echo base_url().'getExpenseDetails'; ?>',
url: '<?php echo base_url() . 'getExpenseDetails'; ?>',
type: 'POST',
data: { id: expenseId },
data: {
id: expenseId
},
success: function(response) {
var expense = JSON.parse(response);
$('#id').val(expense.id);
@ -321,7 +324,7 @@
// Create download link and delete button
var fileLink = '<a class="download_button" href="' + fileUrl + '" target="_blank" download="' + expense.transporter_file + '"><i class=" fas fa-file-download"></i></a>';
var deleteButton = '<button id="deleteFile" class="delete_button" data-value="' + expense.id +'" data-id="' + expense.id + '" data-file="' + expense.transporter_file + '"><i class="fas fa-trash"></i></button>';
var deleteButton = '<button id="deleteFile" class="delete_button" data-value="' + expense.id + '" data-id="' + expense.id + '" data-file="' + expense.transporter_file + '"><i class="fas fa-trash"></i></button>';
// Add the file link and delete button
$('#transporterfile').after(fileLink + ' ' + deleteButton);
@ -335,7 +338,7 @@
});
$(document).on('click', '#addExpense', function () {
$(document).on('click', '#addExpense', function() {
$('.download_button').remove();
$('.delete_button').remove();
$('.modal-title').html('Add Expense');
@ -355,7 +358,7 @@
supplier_list[0].forEach(function(supplier) {
$('#supplierid').append('<option value="' + supplier.SupplierID + '">' + supplier.SupplierName + '</option>');
});
formActionUrl = '<?php echo base_url().'addExpense' ?>'; // Set action URL for adding
formActionUrl = '<?php echo base_url() . 'addExpense' ?>'; // Set action URL for adding
togglePaymentMethodEdit();
});
@ -394,7 +397,7 @@
// If form is invalid, show native validation messages
$('#expenseForm')[0].reportValidity();
}
});
});
// DataTable initialization and date range filter logic (unchanged)
@ -404,9 +407,14 @@
'copy', 'csv', 'excel', 'pdf', 'print'
],
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,
order: [[0, 'desc']],
order: [
[0, 'desc']
],
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>',
@ -457,16 +465,19 @@
toDateInput.value = fromDate;
}
});
});
});
$(document).on('click', '#deleteFile', function() {
$(document).on('click', '#deleteFile', function() {
var fileName = $(this).data('file');
var expenseId = $(this).data('value');
$.ajax({
url: '<?php echo base_url('deleteFile'); ?>',
type: 'POST',
data: { file_name: fileName, expense_id: expenseId },
data: {
file_name: fileName,
expense_id: expenseId
},
success: function(response) {
console.log(response);
@ -485,10 +496,7 @@ $(document).on('click', '#deleteFile', function() {
alert('Error deleting the file.');
}
});
});
});
</script>

View File

@ -82,6 +82,36 @@
$('#hdate').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>
</body>
</html>

View File

@ -318,7 +318,8 @@
<div class="dropdown-menu dropdown-menu-right profile-dropdown ">
<!-- item-->
<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>
<!-- item-->
@ -397,15 +398,19 @@
<div class="collapse navbar-collapse" id="topnav-menu-content">
<ul class="navbar-nav">
<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">
<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>
<div class="dropdown-menu" aria-labelledby="topnav-dashboard">
<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>
</div>
</div> -->
</li>
<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>
</a>
<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>
</li>
@ -483,8 +489,17 @@
<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(); ?>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(); ?>leavereports" class="dropdown-item">Leave Reports</a>
<a href="<?php echo base_url(); ?>leavereports" class="dropdown-item"> Reports</a>
</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(); ?>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(); ?>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(); ?>departmentListing" class="dropdown-item">Department 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 class="form-group col-md-3" id="Deliverydtdiv">
<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>
<?php
@ -1898,7 +1898,7 @@ if (!empty($INRSYMBOL)) {
<div class="form-row">
<div class="form-group col-md-3">
<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>
<?php

View File

@ -86,7 +86,7 @@ span.highlight {
<div class="row">
<div class="col-12">
<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) { ?>
<a class="btn btn-success" href="<?php echo base_url(); ?>RequisitionForm">Raise New Requisition</a>
<?php } ?>

View File

@ -1,16 +1,16 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<style>
/* Target the first child element of #datatable-buttons_wrapper */
#datatable-buttons_wrapper.dataTables_wrapper.dt-bootstrap4.no-footer > :nth-child(1) {
/* Target the first child element of #datatable-buttons_wrapper */
#datatable-buttons_wrapper.dataTables_wrapper.dt-bootstrap4.no-footer> :nth-child(1) {
display: none;
}
}
/* Target the third child element of #datatable-buttons_wrapper */
#datatable-buttons_wrapper.dataTables_wrapper.dt-bootstrap4.no-footer> :nth-child(3) {
/* Target the third child element of #datatable-buttons_wrapper */
#datatable-buttons_wrapper.dataTables_wrapper.dt-bootstrap4.no-footer> :nth-child(3) {
display: none;
}
}
.card_font_colorset_green{
.card_font_colorset_green {
font-size: 23.7215px;
font-weight: 500;
line-height: 1.2;
@ -18,7 +18,8 @@
z-index: 1;
color: rgb(86, 166, 75);
}
.card_font_colorset_bule{
.card_font_colorset_bule {
font-size: 23.7215px;
font-weight: 500;
line-height: 1.2;
@ -26,7 +27,8 @@
z-index: 1;
color: rgb(31, 96, 196);
}
.card_font_colorset_red{
.card_font_colorset_red {
font-size: 23.7215px;
font-weight: 500;
line-height: 1.2;
@ -34,61 +36,66 @@
z-index: 1;
color: rgb(173, 3, 23);
}
</style>
<style>
#Requisition_filter {
#Requisition_filter {
float: inline-end;
}
}
#Requisition_wrapper .row .col-sm-4 {
#Requisition_wrapper .row .col-sm-4 {
flex-basis: 50%;
float: inline-end;
}
}
#Requisition_paginate .pagination {
#Requisition_paginate .pagination {
flex-basis: 50%;
float: inline-end;
margin: 0 0 15px;
}
}
#Requisition_wrapper .row:nth-child(3),
#Requisition_wrapper .row:nth-child(1) {
#Requisition_wrapper .row:nth-child(3),
#Requisition_wrapper .row:nth-child(1) {
padding: 0 15px;
}
}
#Requisition_info {
#Requisition_info {
margin-top: 5px;
}
}
.dataTables_wrapper {
.dataTables_wrapper {
padding-bottom: 0;
}
}
span.highlight {
span.highlight {
background-color: yellow;
}
}
</style>
<style>
.Date-filter-form {
display: flex;
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;
font-size: 14px;
}
.Date-filter-form button {
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
.Date-filter-form button:hover {
background-color: #0056b3;
}
.icon-button {
background: none;
border: none;
@ -96,10 +103,11 @@ span.highlight {
color: #007bff;
font-size: 18px;
}
.icon-button:hover {
color: #0056b3;
}
</style>
</style>
<div class="content-page">
<div class="content">
<!-- Start Content-->
@ -109,7 +117,7 @@ span.highlight {
<div class="row">
<div class="col-12">
<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>
@ -132,57 +140,59 @@ span.highlight {
<table id="datatable-buttosns" class="table dt-responsive nowrap w-100">
<thead>
<tr>
<th >Invoice Date</th>
<th>Invoice Date</th>
<th>Invoice No</th>
<th>Client Name</th>
<th >Product</th>
<th>Product</th>
<th>Rate</th>
<th>Quantity</th>
<th>Sub Total</th>
<th>GST</th>
<th>Total</th>
<th>Status</th>
<th >E-Invoice Number</th>
<th >Action</th>
<th>E-Invoice Number</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<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;
// Calculate CGST and SGST
$cgst_amount = ($subtotal * $invoice->cgst) / 100;
$sgst_amount = ($subtotal * $invoice->sgst) / 100;
$total = $subtotal + $cgst_amount + $sgst_amount;?>
$total = $subtotal + $cgst_amount + $sgst_amount; ?>
<!-- Main invoice row -->
<tr >
<td ><?php echo date('d-m-Y', strtotime($invoice->invoice_date_created)); ?></td>
<td >
<?php if(!empty($invoice->invoice_url)){ ?>
<tr>
<td><?php echo date('d-m-Y', strtotime($invoice->invoice_date_created)); ?></td>
<td>
<?php if (!empty($invoice->invoice_url)) { ?>
<a href="<?php echo $invoice->invoice_url; ?>" target="_blank" class="invoice-link">
<?php } ?>
<?php echo $invoice->invoice_number; ?>
<?php if(!empty($invoice->invoice_url)){ ?>
<?php if (!empty($invoice->invoice_url)) { ?>
</a>
<?php } ?>
</td>
<td ><?php echo $invoice->client_name ?></td>
<td ><?php echo $invoice->item_name ?></td>
<td ><?php echo $invoice->item_price ?></td>
<td ><?php echo number_format($invoice->item_quantity, 2 ,'.', ',' ) ?></td>
<td ><?php echo number_format($subtotal, 2, '.', ',') ?></td>
<td ><?php echo number_format($cgst_amount+$sgst_amount, 2, '.', ',') ?></td>
<td ><?php echo number_format($total, 2, '.', ',') ?></td>
<td ><?php echo $invoice->status ?></td>
<td ><?php echo $invoice->e_invoice_number; ?></td>
<td >
<td><?php echo $invoice->client_name ?></td>
<td><?php echo $invoice->item_name ?></td>
<td><?php echo $invoice->item_price ?></td>
<td><?php echo number_format($invoice->item_quantity, 2, '.', ',') ?></td>
<td><?php echo number_format($subtotal, 2, '.', ',') ?></td>
<td><?php echo number_format($cgst_amount + $sgst_amount, 2, '.', ',') ?></td>
<td><?php echo number_format($total, 2, '.', ',') ?></td>
<td><?php echo $invoice->status ?></td>
<td><?php echo $invoice->e_invoice_number; ?></td>
<td>
<a class="edit-button" style="cursor: pointer; display: inline-block;" title="Files Upload" onclick="openInvoiceModal('<?php echo $invoice->invoice_number; ?>', '<?php echo $invoice->client_name; ?>', '<?php echo $invoice->invoice_date_created; ?>', '<?php echo $invoice->invoice_id; ?>')">
<i class="fas fa-file-upload text-muted" style="font-size: 18px; vertical-align: middle;"></i>
</a>
</td>
</tr>
<?php } } ?>
<?php }
} ?>
</tbody>
</table>
</div> <!-- end card body-->
@ -195,8 +205,68 @@ span.highlight {
</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>
$(document).ready(function() {
$(document).ready(function() {
// Initialize the DataTable
var table = $('#datatable-buttosns').DataTable({
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
@ -204,9 +274,14 @@ $(document).ready(function() {
'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
],
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
order: [[0, 'desc']], // Default ordering (column index 0, descending)
order: [
[0, 'desc']
], // Default ordering (column index 0, descending)
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
@ -269,5 +344,164 @@ $(document).ready(function() {
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>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB