This commit is contained in:
parent
a55db17684
commit
67a8197e06
@ -988,8 +988,9 @@ function viewIGRDetails()
|
||||
|
||||
$notification = new Notification();
|
||||
|
||||
$history_content = "<br>IGR History<br><br> <ul>";
|
||||
$history = $result_for_history['history'];
|
||||
$history_content = "<br><b>IGR History</b><br><br> <ul>";
|
||||
// $history = $result_for_history['history']; // old
|
||||
$history = $this->inwardgateregister_model->ViewIGRHistory($IGRNo);
|
||||
if(!empty($history)){
|
||||
|
||||
$field_labels = [
|
||||
@ -1025,22 +1026,57 @@ function viewIGRDetails()
|
||||
];
|
||||
// $history_content = "<br>The following values have been edited:"; //old Format
|
||||
|
||||
for ($j = 0; $j < count($history); $j++) {
|
||||
$field_name = $history[$j]->field;
|
||||
$readable_field = isset($field_labels[$field_name]) ? $field_labels[$field_name] : $field_name;
|
||||
$history_content .= "<li>" .
|
||||
(($history[$j]->IGRItem_No)
|
||||
? $history[$j]->MaterialName . " (" . $history[$j]->MaterialCode . ") - "
|
||||
: "") .
|
||||
$readable_field . " " . $history[$j]->old_data .
|
||||
" was updated into " . $history[$j]->new_data .
|
||||
" by " . $history[$j]->history_by .
|
||||
" on " . $history[$j]->indian_date .
|
||||
" at " . $history[$j]->indian_time .
|
||||
"</li><br>";
|
||||
// $history_content .= "<br>" . $readable_field . ": `" . $history[$j]->old_data . "` was updated to `" . $history[$j]->new_data . "` .";
|
||||
}
|
||||
$history_content .= "</ul>";
|
||||
for ($j = 0; $j < count($history); $j++) {
|
||||
$field_name = $history[$j]->field;
|
||||
$readable_field = isset($field_labels[$field_name]) ? $field_labels[$field_name] : $field_name;
|
||||
|
||||
if(intval($history[$j]->is_add) === 1) {
|
||||
$history_content .= $history[$j]->IGR_No . " was Created by " . $history[$j]->FullName . " on " . $history[$j]->indian_date . " at " . $history[$j]->indian_time . " </br></br>";
|
||||
|
||||
if ($history[$j]->field === "IGRStatus") {
|
||||
$str1 = $history[$j]->new_data;
|
||||
$str2 = preg_replace('/\bIGR\b/i', '', $str1);
|
||||
$str2 = trim($str2);
|
||||
$str2 = ($str2 === "CREATED") ? "GENERATED" : $str2;
|
||||
|
||||
$history_content .= $history[$j]->IGR_No . " was <b> ` " . $str2 . " ` </b> by " . $history[$j]->FullName .
|
||||
" on " . $history[$j]->indian_date . " at " . $history[$j]->indian_time;
|
||||
} else {
|
||||
$history_content .= $history[$j]->IGR_No . " was <b> ` GENERATED ` </b> by " . $history[$j]->FullName .
|
||||
" on " . $history[$j]->indian_date . " at " . $history[$j]->indian_time;
|
||||
}
|
||||
} else if (intval($history[$j]->is_edit) === 1) {
|
||||
$str = $history[$j]->field;
|
||||
|
||||
if (!in_array($str, ["UpdateBY", "MaterialRcvdDate", "DeliveryChellanDate"])) {
|
||||
$fieldName = preg_replace('/([a-z])([A-Z])/', '$1 $2', $str);
|
||||
$displayOldData = (empty($history[$j]->old_data)) ? " " : $history[$j]->old_data;
|
||||
$displayNewData = (empty($history[$j]->new_data)) ? " " : $history[$j]->new_data;
|
||||
|
||||
if ($history[$j]->field === "IGRStatus") {
|
||||
$displayOldData = trim(preg_replace('/\bIGR\b/i', '', $displayOldData));
|
||||
$displayOldData = ($displayOldData === "CREATED") ? "GENERATED" : $displayOldData;
|
||||
|
||||
$displayNewData = trim(preg_replace('/\bIGR\b/i', '', $displayNewData));
|
||||
$displayNewData = ($displayNewData === "CREATED") ? "GENERATED" : $displayNewData;
|
||||
}
|
||||
|
||||
if ($displayNewData || $displayOldData) {
|
||||
$materialPart = (!empty($history[$j]->IGRItem_No)) ? $history[$j]->MaterialName . " ( " . $history[$j]->MaterialCode . " ) - " : "";
|
||||
$history_content .= "<li> ".$materialPart . $readable_field . " <b> ` " . $displayOldData . " ` </b> was Updated into <b> ` " . $displayNewData . " ` </b> by " .
|
||||
$history[$j]->FullName . " on " . $history[$j]->indian_date . " at " . $history[$j]->indian_time. " </li><br>";
|
||||
|
||||
}
|
||||
}
|
||||
} else if (intval($history[$j]->is_delete) === 1) {
|
||||
$str = $history[$j]->field;
|
||||
$fieldName = preg_replace('/([a-z])([A-Z])/', '$1 $2', $str);
|
||||
$history_content .= "<li> ".$readable_field . " " . $history[$j]->new_data . " was deleted by " . $history[$j]->FullName .
|
||||
" on " . $history[$j]->indian_date . " at " . $history[$j]->indian_time. " </li><br>";
|
||||
}
|
||||
// $history_content .= "<br>" . $readable_field . ": `" . $history[$j]->old_data . "` was updated to `" . $history[$j]->new_data . "` .";
|
||||
}
|
||||
$history_content .= " </ul>";
|
||||
|
||||
$to_email_addr = "";
|
||||
for ($i = 0; $i < count($result_for_email['to_mails']); $i++) {
|
||||
@ -1097,6 +1133,14 @@ function viewIGRDetails()
|
||||
echo $finalstatement;
|
||||
}
|
||||
|
||||
function generateSentence($record) {
|
||||
$sentence = "<li>";
|
||||
|
||||
|
||||
return $sentence;
|
||||
}
|
||||
|
||||
|
||||
function CancelIGR(){
|
||||
|
||||
# Step 1 : Gethering Data..
|
||||
|
||||
Loading…
Reference in New Issue
Block a user