<?php
ini_set('display_errors', 0);
//error_reporting(E_ALL);
//ini_set('display_errors', 1);

session_start();
ob_start();

require_once('configuration/server_connect.php');
require_once('configuration/all_function.php');

$status='CHECKED';

$order_no = $_REQUEST['id'];
$ledger_id_edit = $_REQUEST['ledger_id_edit'];
$ref_no_edit = $_REQUEST['ref_no_edit'];
$narration_edit = $_REQUEST['narration_edit'];
$dr_amt_edit = $_REQUEST['dr_amt_edit'];


//$dateString = ''.$year.'-'.$mon.'-01';
//$tr_date = date("Y-m-t", strtotime($dateString));
//
//$year_sm = date('y',strtotime($tr_date));
//$mon_no = sprintf("%02d", $mon);
//$tr_no = $year_sm.''.$mon_no.''.$ref_no;
//
//
//
//
$entry_by=$_SESSION['user']['id'];
$entry_at=date('Y-m-d H:i:s');
//
//if($flag>0){
//
//$sql_del = 'delete from customer_monthly_sales_target where ref_no="'.$ref_no.'" and mon="'.$mon.'" and year="'.$year.'" ';
//mysqli_query($conn,$sql_del);
//
//}

//$ins_sql = 'INSERT INTO  customer_monthly_sales_target (ref_no, tr_no, tr_date, mon, year, target_qty, status, entry_at, entry_by) VALUES
//("'.$ref_no.'", "'.$tr_no.'", "'.$dateString.'", "'.$mon.'", "'.$year.'", "'.$target_qty.'", "'.$status.'", "'.$entry_at.'", "'.$entry_by.'")';
//	
//mysqli_query($conn,$ins_sql);


 $up_jv='update secondary_journal set ledger_id="'.$ledger_id_edit.'",  ref_no="'.$ref_no_edit.'", narration="'.$narration_edit.'", dr_amt="'.$dr_amt_edit.'", edit_by="'.$entry_by.'", edit_at="'.$entry_at.'"  where id="'.$order_no.'"';
mysqli_query($conn,$up_jv);


echo 'Success!';
?>