FIX_PO pono no changed as per client requested : ps
This commit is contained in:
parent
0cd99ce38e
commit
c87f9bf948
17
app/Helpers/datetime_helper.php
Normal file → Executable file
17
app/Helpers/datetime_helper.php
Normal file → Executable file
@ -125,6 +125,23 @@ if (!function_exists('get_financial_year')) {
|
||||
return $financialYear;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_shorten_financial_year')) {
|
||||
function get_shorten_financial_year($date = null)
|
||||
{
|
||||
|
||||
$date = $date ?: date('Y-m-d');
|
||||
|
||||
$year = date('y', strtotime($date));
|
||||
|
||||
if (date('n', strtotime($date)) < 4) {
|
||||
$shortenFinancialYear = ($year - 1) . '-' . $year;
|
||||
} else {
|
||||
$shortenFinancialYear = $year . '-' . ($year + 1);
|
||||
}
|
||||
return $shortenFinancialYear;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('generate_pos_number')) {
|
||||
function generate_pos_number($last_pono)
|
||||
|
||||
10
app/Helpers/purchaseorder_helper.php
Normal file → Executable file
10
app/Helpers/purchaseorder_helper.php
Normal file → Executable file
@ -3,7 +3,7 @@ if (!function_exists('generate_po_number')) {
|
||||
function generate_po_number($last_pono)
|
||||
{
|
||||
$currentYear = date("Y");
|
||||
$finYear = get_financial_year(); // Get it From DateTime Helper
|
||||
$shortenFinYear = get_shorten_financial_year();// Get it From - DateTime Helper refer it.
|
||||
|
||||
// if(here have to check fin year if there is a change means both are same means ){
|
||||
// $counter = $counter + 1;
|
||||
@ -13,15 +13,15 @@ if (!function_exists('generate_po_number')) {
|
||||
|
||||
$result = explode('/', $last_pono);
|
||||
$requestedFinYear = $result[1];
|
||||
$leftPad = $result[0];
|
||||
$leftPad = "RIPL";
|
||||
$digit = 5;
|
||||
|
||||
if($requestedFinYear == $finYear){
|
||||
if($requestedFinYear == $shortenFinYear){
|
||||
$number = ((int)$result[2])+1;
|
||||
$PoNo = $leftPad . '/' . $finYear . '/' . str_pad($number, $digit, '0', STR_PAD_LEFT);
|
||||
$PoNo = $leftPad . '/' . $shortenFinYear . '/' . str_pad($number, $digit, '0', STR_PAD_LEFT);
|
||||
}else{
|
||||
$counter = 1;
|
||||
$PoNo = $leftPad . '/' . $finYear . '/' . str_pad($counter, $digit, '0', STR_PAD_LEFT);
|
||||
$PoNo = $leftPad . '/' . $shortenFinYear . '/' . str_pad($counter, $digit, '0', STR_PAD_LEFT);
|
||||
}
|
||||
return $PoNo;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user