<?php
session_start();
include 'dbc.php';


$userid=$_SESSION["userid"];
$today=date("Y-m-d");
$acc_name=$_POST["acc_name"];
$month_name=$_POST["month_name"];

$acc_type=$_POST["acc_type"];
$dr_bal=$_POST["dr_bal"];
$cr_bal=$_POST["cr_bal"];
$acc_symb=$_POST["acc_symb"];
$sql = "Insert into chartofaccounts (id,date,acc_name,acc_type,dr_bal,cr_bal,user_id,acc_symb) values (null,'$today','$acc_name','$acc_type','$dr_bal','$cr_bal','$userid','$acc_symb')";
mysql_query($sql) or die("Error : " . mysql_error());

$sql1 = "Insert into acc_ledger (id,date,tr_no,acc_name,discription,acc_type,dr_amount,cr_amount,balance,user_id,acc_symb) values (null,'$today','0','$acc_name','Opening balance','$acc_type','$dr_bal','$cr_bal','0','$userid','$acc_symb')";
mysql_query($sql1) or die("Error : " . mysql_error());
$Message = "Record saved ";
    header("Location:chart_of_accounts.php?Message={$Message}");?>
<a href="chart_of_accounts.php"> Back </a>