2024-10-16 19:18:52 +05:30
< ? php
include ( 'includes/config/config.php' );
include ( 'includes/functions.php' );
include ( 'log_entry.php' );
error_log ( " Start Printing Request Attributes " );
$requestStr = " " ;
foreach ( $_REQUEST as $key => $value ) {
$requestStr .= $key . " : " . $value . " \n " ;
error_log ( $key . " : " . $value . " <br /> \r \n " );
}
error_log ( " End Printing Request Attributes " );
save_log ( $requestStr , 'procurement item' , 'SAVE' , 'item_rate.php' );
$id = $_POST [ 'id' ];
$year = $_POST [ 'year' ];
$primary_budget = $_POST [ 'primary_budget' ];
$additional_approved_budget = $_POST [ 'additional_approved_budget' ];
$total_budget = $_POST [ 'total_budget' ];
// $utilized_budget = $_POST['utilized_budget'];
$available_budget = $_POST [ 'available_budget' ];
$remarks = $_POST [ 'remarks' ];
$query_old_data = " select * from yearly_budget where id=' $id ' " ;
error_log ( 'history:old rate ' . $query_old_data );
if ( ! $result_old_data = @ mysqli_query ( $conn , $query_old_data )) {
2024-11-02 18:03:13 +05:30
die ( mysqli_error ( $conn ));
2024-10-16 19:18:52 +05:30
}
if ( mysqli_num_rows ( $result_old_data ) > 0 ) {
while ( $row_old_data = @ mysqli_fetch_assoc ( $result_old_data )) {
$old_primary_budget = $row_old_data [ 'primary_budget' ];
$old_additional_approved_budget = $row_old_data [ 'additional_approved_budget' ];
}
}
error_log ( " update yearly_budge id: " . $id . " item_id: " . $item_id . " batch: " . $item_batch_no . " desc: " . $mrp . 'new_rate' . $new_rate );
if ( ! empty ( $id )){
$query_history = " insert into yearly_budget_change_history set budget_id = ' $id ', old_primary_budget = ' $old_primary_budget ', old_additional_approved_budget = ' $old_additional_approved_budget ',new_primary_budget = ' $primary_budget ', new_additional_approved_budget = ' $additional_approved_budget ' , modified_by = ' " . $_SESSION [ 'user_id' ] . " ' ,year = ' " . $year . " ',remarks=' $remarks ' " ;
error_log ( 'rate change history ' . $query_history );
if ( ! $result_history = @ mysqli_query ( $conn , $query_history )) {
2024-11-02 18:03:13 +05:30
die ( mysqli_error ( $conn ));
2024-10-16 19:18:52 +05:30
}
$query = " update yearly_budget set year = ' $year ', primary_budget = ' $primary_budget ',additional_approved_budget = ' $additional_approved_budget ' ,total_budget=' $total_budget ',available_budget=' $available_budget ' , modified_by = ' " . $_SESSION [ 'user_id' ] . " ' where id = ' " . $id . " ' " ;
}
else { $query = " insert into yearly_budget set year = ' $year ', primary_budget = ' $primary_budget ',additional_approved_budget = ' $additional_approved_budget ' ,total_budget=' $total_budget ',available_budget=' $available_budget ' , modified_by = ' " . $_SESSION [ 'user_id' ] . " ' " ;}
error_log ( 'save_query_item_rate ' . $query );
if ( ! $result = @ mysqli_query ( $conn , $query )) {
2024-11-02 18:03:13 +05:30
die ( mysqli_error ( $conn ));
2024-10-16 19:18:52 +05:30
}
?>