<?php //define('SITEURL','http://localhost/design2/');
include_once('database_connection.php');
 /* $cachefile = 'v'.date('M-d-Y').'.html';
    // define how long we want to keep the file in seconds. I set mine to 5 hours.
    $cachetime = 18000;
    // Check if the cached file is still fresh. If it is, serve it up and exit.
    if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) {
    include($cachefile);
        exit;
    }
    // if there is either no file OR the file to too old, render the page and capture the HTML.
    ob_start();*/
if(isset($_POST['submit']))
{
   // print_r($_POST);
        //$_SESSION['userid']=
        $COAID=$_POST['dealer'];
        $userid=1;//$_SESSION['userid'];
        $visitdate=$_POST['visitdate'];
        $newappoint=$_POST['appointarrange'];
        $appointdate=$_POST['appointdate'];
        $additional_info=$_POST['additional_info'];
        $ContactPerson=$_POST['ContactPerson'];
       // $ContactType=$_POST['ContactType'];
        $contactTypeId=$_POST['contactTypeId'];
        $TypeContactId=$_POST['TypeContactId'];
        $customerCategoryId=$_POST['customerCategoryId'];
        $discuss=$_POST['discuss'];
        $feedback=$_POST['feedback'];
        $notes=$_POST['notes'];
        $managernotes=$_POST['managernotes'];  
       $id=1;
       $sql="select max(id) as id from VisitMaster";
                $result=odbc_exec($connection,$sql);
               // print_r($result);
                while($row=odbc_fetch_array($result))
                {
                $id=$row['id'];
                $id=$id+1;
                //echo "id=".$id;
                 }
                
     $sql="insert into VisitMaster (id,COAID,salesrepid,visitdate,appointdate,newappoint,additional_info,contact_person,contactTypeId,TypeContactId,customerCategoryId,discuss,feedback,notes,managernotes) values('$id','$COAID','$userid','$visitdate','$appointdate','$newappoint','$additional_info','$ContactPerson','$contactTypeId','$TypeContactId','$customerCategoryId','$discuss','$feedback','$notes','$managernotes')";
    odbc_exec($connection,$sql);
    echo "<script>alert('Visit Saved Sucessfully');window.location='visit.php?sidebarid=21#supplier</script>";
}

?>

    <link rel="icon" href="<?php echo SITEURL;?>assets/images/favicon.png" type="image/x-icon" />
    <link rel="shortcut icon" href="<?php echo SITEURL;?>assets/images/favicon.png" type="image/x-icon" />
    <title>Sub-Page</title>

    <!--JSGrid css-->
    <link rel="stylesheet" type="text/css" href="<?php echo SITEURL;?>assets/css/datatables.css" />

    <!--Google font-->
<!--     <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Raleway:300,400,500,600,700" rel="stylesheet">
 -->
    <!-- Font Awesome -->
    <link rel="stylesheet" type="text/css" href="<?php echo SITEURL;?>assets/css/fontawesome.css">

    <!-- ico-font -->
    <link rel="stylesheet" type="text/css" href="<?php echo SITEURL;?>assets/css/icofont.css">

    <!-- Themify icon -->
    <link rel="stylesheet" type="text/css" href="<?php echo SITEURL;?>assets/css/themify.css">

    <!-- Flag icon -->
    <link rel="stylesheet" type="text/css" href="<?php echo SITEURL;?>assets/css/flag-icon.css">

    <!-- prism css -->
    <link rel="stylesheet" type="text/css" href="<?php echo SITEURL;?>assets/css/prism.css">

    <!-- Tour css -->
    <link rel="stylesheet" type="text/css" href="<?php echo SITEURL;?>assets/css/tour.css">

    <!-- Owl css -->
    <link rel="stylesheet" type="text/css" href="<?php echo SITEURL;?>assets/css/owlcarousel.css">

    <!-- Bootstrap css -->
    <link rel="stylesheet" type="text/css" href="<?php echo SITEURL;?>assets/css/bootstrap.css">

    <!-- App css -->
    <link rel="stylesheet" type="text/css" href="<?php echo SITEURL;?>assets/css/style.css">

    <!-- Chartist -->
    <link rel="stylesheet" type="text/css" href="<?php echo SITEURL;?>assets/css/chartist.css">

    <!-- Responsive css -->
    <link rel="stylesheet" type="text/css" href="<?php echo SITEURL;?>assets/css/responsive.css">

    <!-- DatePicker css -->
    <link rel="stylesheet" type="text/css" href="<?php echo SITEURL;?>assets/css/date-picker.css">

    <!--Select2 css-->
    <link rel="stylesheet" type="text/css" href="<?php echo SITEURL;?>assets/css/select2.css" />

    <!-- Animate icon -->
    <link rel="stylesheet" href="<?php echo SITEURL;?>assets/css/animate.css">
<!--     <link rel="stylesheet" href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css"/>
 -->
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.6.1/css/buttons.dataTables.min.css">
    <style>

        table#invoice {
            table-layout: fixed;
        }

        table#invoice {
            font-size: small;
        }

        .tabbed-card .col-1,
        .col-2,
        .col-3,
        .col-4,
        .col-5,
        .col-6,
        .col-7,
        .col-8,
        .col-9,
        .col-10,
        .col-11,
        .col-12,
        .col,
        .col-auto,
        .col-sm-1,
        .col-sm-2,
        .col-sm-3,
        .col-sm-4,
        .col-sm-5,
        .col-sm-6,
        .col-sm-7,
        .col-sm-8,
        .col-sm-9,
        .col-sm-10,
        .col-sm-11,
        .col-sm-12,
        .col-sm,
        .col-sm-auto,
        .col-md-1,
        .col-md-2,
        .col-md-3,
        .col-md-4,
        .col-md-5,
        .col-md-6,
        .col-md-7,
        .col-md-8,
        .col-md-9,
        .col-md-10,
        .col-md-11,
        .col-md-12,
        .col-md,
        .col-md-auto,
        .col-lg-1,
        .col-lg-2,
        .col-lg-3,
        .col-lg-4,
        .col-lg-5,
        .col-lg-6,
        .col-lg-7,
        .col-lg-8,
        .col-lg-9,
        .col-lg-10,
        .col-lg-11,
        .col-lg-12,
        .col-lg,
        .col-lg-auto,
        .col-xl-1,
        .col-xl-2,
        .col-xl-3,
        .col-xl-4,
        .col-xl-5,
        .col-xl-6,
        .col-xl-7,
        .col-xl-8,
        .col-xl-9,
        .col-xl-10,
        .col-xl-11,
        .col-xl-12,
        .col-xl,
        .col-xl-auto {
            padding-left: 4px !important;
            padding-right: 4px !important;

        }

        #select2-cheque_cboVendor-container {
            font-size: smaller;
        }

        .card.full-card {
            top: 0px !important;
            left: 0px !important;
            right: 0px !important;
            height: 100% !important;
            width: 100% !important;
        }

        .lbl_edit {
            color: blue;
            text-align: center;
        }
    </style>


</head>
