diff --git a/app/Controllers/Assetdetails.php b/app/Controllers/Assetdetails.php index cecc86b2..97aa6bdc 100755 --- a/app/Controllers/Assetdetails.php +++ b/app/Controllers/Assetdetails.php @@ -225,8 +225,7 @@ class Assetdetails extends BaseController if (false) { // $this->addasset(); } else { - $assetName = $this->request->getPost('AssetName'); - $AssetName = (!empty($assetName)) ? strtoupper((string)$assetName) : ""; + $AssetName = $this->request->getPost('AssetName'); $Description = $this->request->getPost('Description'); $Department = $this->request->getPost('AssetDept'); $Location = $this->request->getPost('Location'); @@ -375,8 +374,7 @@ class Assetdetails extends BaseController $this->editOldasset($Asset_Code); } else { $Asset_Code = $this->request->getPost('AssetCode'); - $assetName = $this->request->getPost('AssetName'); - $AssetName = (!empty($assetName)) ? strtoupper((string)$assetName) : ''; + $AssetName = $this->request->getPost('AssetName'); $Description = $this->request->getPost('PODescription'); $Department = $this->request->getPost('AssetDept'); $Location = $this->request->getPost('Location'); diff --git a/app/Controllers/CostCenter.php b/app/Controllers/CostCenter.php index 0a231e42..6d00c8ee 100755 --- a/app/Controllers/CostCenter.php +++ b/app/Controllers/CostCenter.php @@ -58,7 +58,6 @@ class CostCenter extends BaseController $id = $this->request->getPost('id'); log_message('error', 'id: ' . $id); $CostCenterName = $this->request->getPost('CostCenterName'); - $CostCenterName = ($CostCenterName !== null && is_string($CostCenterName)) ? strtoupper(trim($CostCenterName)) : null; $userId = $this->session->get('userId'); $approverId = $this->session->get('EmpID'); $currentdt = get_current_date_time(); diff --git a/app/Controllers/Sales.php b/app/Controllers/Sales.php index dbc27e72..267848f6 100755 --- a/app/Controllers/Sales.php +++ b/app/Controllers/Sales.php @@ -24,43 +24,42 @@ class Sales extends BaseController $this->isLoggedIn(); } - function formatIndianCurrency($amount) { - // Convert the amount to a string with 2 decimal places - $formattedAmount = number_format((float)$amount, 2, '.', ''); - - // Split the integer and decimal parts - $parts = explode('.', $formattedAmount); - $integerPart = $parts[0]; - $decimalPart = isset($parts[1]) ? $parts[1] : '00'; - - // Format the integer part for Indian numbering system - if (strlen($integerPart) > 3) { - $lastThreeDigits = substr($integerPart, -3); // Get the last 3 digits (thousands) - $remainingDigits = substr($integerPart, 0, -3); // Get the remaining digits - - // Add commas to the remaining digits in groups of 2 - $remainingDigits = preg_replace('/\B(?=(\d{2})+(?!\d))/', ',', $remainingDigits); - - // Combine the formatted parts - $integerPart = $remainingDigits . ',' . $lastThreeDigits; + function formatIndianCurrency($num,$type) { + $num = explode('.', $num); // Split the number into integer and decimal parts + $integerPart = $num[0]; // Get the integer part + if($type == 'qty'){ return $integerPart; } + // Apply the Indian number format to the integer part + $lastThreeDigits = substr($integerPart, -3); + $remainingDigits = substr($integerPart, 0, -3); + + if ($remainingDigits != '') { + $formattedNumber = preg_replace('/\B(?=(\d{2})+(?!\d))/', ',', $remainingDigits) . ',' . $lastThreeDigits; + } else { + $formattedNumber = $lastThreeDigits; } - - // Combine the integer and decimal parts - return $integerPart . '.' . $decimalPart; + + return $formattedNumber; } public function sales_dashboard() { $this->global['pageTitle'] = 'Sales Dashboard'; $data = []; + $data['today_sales'] = $this->ipinvoice_model->todaySales(); - $data['today_sales']->Sales = $this->formatIndianCurrency($data['today_sales']->Sales, 2, '.', ','); + $data['today_sales']->Sales = $this->formatIndianCurrency($data['today_sales']->Sales,'money'); + $data['today_sales']->Qty = $this->formatIndianCurrency($data['today_sales']->Qty,'qty'); + $data['this_month_sales'] = $this->ipinvoice_model->thisMonthSales(); - $data['this_month_sales']->Sales = $this->formatIndianCurrency($data['this_month_sales']->Sales); + $data['this_month_sales']->Sales = $this->formatIndianCurrency($data['this_month_sales']->Sales,'money'); + $data['this_month_sales']->Qty = $this->formatIndianCurrency($data['this_month_sales']->Qty,'qty'); + $data['this_year_sales'] = $this->ipinvoice_model->thisYearSales(); - $data['this_year_sales']->Sales = $this->formatIndianCurrency($data['this_year_sales']->Sales, 2, '.', ','); + $data['this_year_sales']->Sales = $this->formatIndianCurrency($data['this_year_sales']->Sales,'money'); + $data['this_year_sales']->Qty = $this->formatIndianCurrency($data['this_year_sales']->Qty,'qty'); + $data['this_year_sales_trend'] = $this->ipinvoice_model->thisYearSalesTrend(); $data['get_today_invoices'] = $this->ipinvoice_model->getTodayInvoices(); - + // Define months from April to March $months = ['Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan', 'Feb', 'Mar']; diff --git a/app/Controllers/Supplier.php b/app/Controllers/Supplier.php index c0a4495d..e89c72b2 100755 --- a/app/Controllers/Supplier.php +++ b/app/Controllers/Supplier.php @@ -423,14 +423,14 @@ class Supplier extends BaseController $id = $this->request->getPost('transporterid'); $name = $this->request->getPost('transportername'); - $name = ($name !== null && is_string($name)) ? strtoupper(trim($name)) : null; $userId = $this->session->get('userId'); $data = ['status' => false, 'message' => 'An error occurred while creating transporter details'.gettype($id)]; $id = trim($id); if ((int)$id === 0) { - $addarr = ['name' => $name, + $addarr = [ + 'name' => $name, 'created_by' => $userId, ]; if ($this->supplier_model->saveTransporter($addarr) > 0) { diff --git a/app/Views/sales_dashboard.php b/app/Views/sales_dashboard.php index 8e175860..7233bc4b 100755 --- a/app/Views/sales_dashboard.php +++ b/app/Views/sales_dashboard.php @@ -133,7 +133,7 @@