CasperSecurity
<?php
session_start();
include '../../../web/connection/connection.php';
include '../../../web/connection/functions/encryption.php';
$item_id = $_REQUEST['iteid'];
$item_ide = amebi_crypt($item_id,e);
$brand_name = $_REQUEST['brand_name'];
$item_sgroups = $_REQUEST['item_sgroups'];
$item_name = $_REQUEST['item_name'];
$item_unit = $_REQUEST['item_unit'];
$hsn_code = $_REQUEST['hsn_code'];
$sgst_rate = $_REQUEST['sgst_rate'];
$cgst_rate = $_REQUEST['cgst_rate'];
$igst_rate = $_REQUEST['igst_rate'];
$returnable = $_REQUEST['returnable'];
$item_photo1 = $_FILES['item_photo1']['name'];
$photoPath = "../../../web/uploads/imguploads/";
$imgtype = pathinfo($item_photo1,PATHINFOEXTENSION);
$maxsize = 2097152;
$tempname = $_FILES['item_photo1']['tmp_name'];
$photoUpload = move_uploaded_file($tempname,$photoPath.$item_photo1);
$item_photo2 = $_FILES['item_photo2']['name'];
$photoPath = "../../../web/uploads/imguploads/";
$imgtype = pathinfo($item_photo2,PATHINFOEXTENSION);
$maxsize = 2097152;
$tempname = $_FILES['item_photo2']['tmp_name'];
$photoUpload = move_uploaded_file($tempname,$photoPath.$item_photo2);
$item_photo3 = $_FILES['item_photo3']['name'];
$photoPath = "../../../web/uploads/imguploads/";
$imgtype = pathinfo($item_photo3,PATHINFOEXTENSION);
$maxsize = 2097152;
$tempname = $_FILES['item_photo3']['tmp_name'];
$photoUpload = move_uploaded_file($tempname,$photoPath.$item_photo3);
$item_photo4 = $_FILES['item_photo4']['name'];
$photoPath = "../../../web/uploads/imguploads/";
$imgtype = pathinfo($item_photo4,PATHINFOEXTENSION);
$maxsize = 2097152;
$tempname = $_FILES['item_photo4']['tmp_name'];
$photoUpload = move_uploaded_file($tempname,$photoPath.$item_photo4);
$db_handle = new DBController();
$brands = $db_handle-> runQuery("SELECT * FROM brand WHERE brand_name = '$brand_name'");
foreach($brands as $brand){
$newInsert_brand_id = $brand['brand_id'];
}
$db_handle = new DBController();
$brand_numrows = $db_handle->numRows("SELECT * FROM brand WHERE brand_name = '$brand_name'");
if($brand_numrows >= '1'){
}else{
$db_handle = new DBController();
$newInsert_brand_id = $db_handle->tableinsert("INSERT INTO brand(brand_name,created_on,created_by,is_active)
VALUES ('$brand_name','$date','$userId','$active')");
}
$date = date("Y-m-d");
$userId = $_SESSION['USER_ID'];
if(!empty($cgst_rate)){
$db_handle = new DBController();
$newUpdateitemgst = $db_handle->runMyUpdate("UPDATE item_gst SET sgst_rate = '$sgst_rate', cgst_rate = '$cgst_rate', igst_rate = '$igst_rate' WHERE item_id = '$item_id'");
}else{
}
if(!empty($item_name)){
$db_handle = new DBController();
$newUpdate = $db_handle->runMyUpdate("UPDATE item SET item_name='$item_name',item_unit='$item_unit', hsn_code ='$hsn_code',modified_on ='$date',modified_by = '$userId' WHERE item_id = '$item_id'");
}else{
$db_handle = new DBController();
$newUpdate = $db_handle->runMyUpdate("UPDATE item SET item_unit='$item_unit', hsn_code ='$hsn_code',modified_on ='$date',modified_by = '$userId' WHERE item_id = '$item_id'");
}
$db_handle = new DBController();
$numrowss = $db_handle->numRows("SELECT * FROM item_image WHERE item_id = '$item_id' AND brand_id = '$newInsert_brand_id'");
$db_handle = new DBController();
$newUpdate2 = $db_handle->runMyUpdate("UPDATE item_image SET brand_id='$newInsert_brand_id', Image1 ='$item_photo1',Image2 = '$item_photo2',Image3='$item_photo3',Image4='$item_photo4',modified_on ='$date',modified_by = '$userId' WHERE item_id = '$item_id'");
//$newI = $db_handle->tableinsert("INSERT INTO item_image(item_id,brand_id,Image1,Image2,Image3,Image4)
//VALUES ('$item_id','$newInsert_brand_id','$item_photo1','$item_photo2','$item_photo3','$item_photo4')");
header('location:../../../web/home/modules/stock/item/item_grid.php');
//header('location:../../../web/home/modules/stock/item/edit_item_details.php?item_id='.$item_ide);
?>