<?php

	require_once("../include/config.php");	
	require_once("../include/startup.php");

$obj  = new Product();

if($_POST['SUBMIT'])
{ 
		$NewProduct['memberid']								= sanitize($_POST['txtmemberid'],SQL);
		$NewProduct['membercompanyid']					= sanitize($_POST['txtmembercompanyid'],SQL);
		$NewProduct['itemno']								= sanitize($_POST['txtitemno'],SQL);
		$NewProduct['productname']							= sanitize($_POST['txtproductname'],SQL);
	 	$NewProduct['product_description']				= sanitize($_POST['txtproduct_description'],SQL);
	 	$NewProduct['price']									= $_POST['txtprice'];
	 	$product_unit											= $_POST['txtproduct_unit'];
	 	$NewProduct['product_unit']						= $product_unit[0];
	 	$NewProduct['igst_rate']							= sanitize($_POST['txtigst'],SQL);
	 	$NewProduct['sgst_rate']							= sanitize($_POST['txtsgst'],SQL);
	 	$NewProduct['cgst_rate']							= sanitize($_POST['txtcgst'],SQL);
	 	$NewProduct['hsn_code']								= sanitize($_POST['txthsn'],SQL);
	 	
	 	
	 	$NewProduct['tax_rate']								= sanitize($_POST['txttax_rate'],SQL);
	 	$NewProduct['provider_name'] 						= sanitize($_POST['txtprovider_name'],SQL);
	 	$NewProduct['purchase_price'] 					= sanitize($_POST['txtpurchase_price'],SQL);

		
			

		 
		 $addresult     = $obj -> AddProduct($NewProduct);
		 if($addresult)
		 {
					$redirect_url = DOC_ROOT."admin/view_products.php";
					header("Location: $redirect_url");
	    			exit;
		 }
}
?>