CasperSecurity

Current Path : /var/www/acasv2.uiet.co.in/v.2.0/api/request/purchase_amendment/
Upload File :
Current File : /var/www/acasv2.uiet.co.in/v.2.0/api/request/purchase_amendment/purchase_amendment_update_api.php

 <?php
session_start();

include '../../../web/connection/connectionv2.php';

include '../../../web/connection/encryption.php';

  $purchase_idzw = $_REQUEST['purchase_idzw'];
  $purchase_item_id = $_REQUEST['purchase_item_id'];

  $purchase_invoice_no = $_REQUEST['purchase_invoice_no'];
  $itemname = $_REQUEST['myInput_item'];
  $dimension = $_REQUEST['dimension'];
  $brand_name = $_REQUEST['brand_name'];
  $hsn_code = $_REQUEST['hsn_code'];
  $cgst_rate = $_REQUEST['cgst_rate'];
  $sgst_rate = $_REQUEST['sgst_rate'];
 
 
 $quantity = $_REQUEST['quantity'];
 $rata = $_REQUEST['rata'];
  $amtt = $_REQUEST['amtt'];
 $discount_rate = $_REQUEST['discount_rate'];
 $batch_no = $_REQUEST['batch_no'];
 $mfg_date = $_REQUEST['mfg_date'];
 $mrp = $_REQUEST['mrp'];
 $bar_code = $_REQUEST['bar_code'];
 
 
 $supplier_name = $_REQUEST['myInput'];


   $db_handle = new DBController();					
	$selectz = $db_handle-> runQuery("SELECT * FROM canteen_dimensions WHERE dimension ='$dimension'");
	foreach($selectz as $resultd){
	 $dimension_id = $resultd['dimension_id'];
	 
	 }
     $db_handle = new DBController();
  $brands = $db_handle-> runQuery("SELECT * FROM canteen_brand WHERE brand_name = '$brand_name'");
  foreach($brands as $brand){
	$newInsert_brand_id = $brand['brand_id'];
  }
 
 $db_handle = new DBController();
  $suppliersy = $db_handle-> runQuery("SELECT * FROM supplier WHERE supplier_name = '$supplier_name'");
  foreach($suppliersy as $suppliery){
	
	  $supplier_id = $suppliery['supplier_id'];
	
  } 
 
  $db_handle = new DBController();
  $itemsx = $db_handle-> runQuery("SELECT * FROM canteen_item WHERE item_name = '$itemname'");
  foreach($itemsx as $item){
	  $item_id = $item['item_id'];
	
				  }
				  
//for net amt				  
 
 $db_handle = new DBController();
  $suppliers = $db_handle-> runQuery("SELECT * FROM supplier WHERE supplier_name = '$supplier_name'");
  foreach($suppliers as $supplier){
      $other_state = $supplier['other_state'];
    }

 if($other_state == 'Yes'){
  $sgst_ratek = $_REQUEST['igst_rate']/2;
   $cgst_ratek = $_REQUEST['igst_rate']/2;
   $igst_ratek = $_REQUEST['igst_rate'];							
     $gstk = $igst_ratek;//5
 }else{
     $sgst_ratek = $_REQUEST['sgst_rate'];
     $cgst_ratek = $_REQUEST['cgst_rate'];
   
     $gstk = $cgst_ratek + $sgst_ratek;//5
 }
 
 
 if($other_state == 'Yes'){
  $sgst_ratez = $_REQUEST['igst_ratez']/2;
    $cgst_ratez = $_REQUEST['igst_ratez']/2;
   $igst_ratez = $_REQUEST['igst_ratez'];							
     $gstz = $igst_ratez;//5
 }else{
     $sgst_ratez = $_REQUEST['sgst_ratez'];
     $cgst_ratez = $_REQUEST['cgst_ratez'];
   
     $gstz = $cgst_ratez + $sgst_ratez;//5
 }
 
 if(!empty($cgst_ratez)){
	    $sgst_rate = $sgst_ratez;
		$cgst_rate = $cgst_ratez;
		$igst_rate = $igst_ratez;							
	    $gst = $gstz;
		
}else{
	     $sgst_rate = $sgst_ratek;
		 $cgst_rate = $cgst_ratek;
		 $igst_rate = $igst_ratek;							
		 $gst = $gstk;    
}
 
 
 
 
 $iprice =$quantity*$rata;//100
$discountamt=$iprice*$discount_rate/100;//10

$discountplusamt=$iprice-$iprice*$discount_rate/100;//90
 
$gstamt=$discountplusamt*$gst/100;//4.5

//cgst sgst igst amt 
$cgstamt = $discountplusamt * $cgst_rate/100;
$sgstamt = $discountplusamt * $sgst_rate/100;
//$igstamt = $discountplusamt * $igst_rate/100;
$igstamt = $discountplusamt * $gst/100;



$gstamtplusamt=$discountplusamt+$discountplusamt*$gst/100;//94.5

$totalgstamt += $gstamt;
$taxamount = number_format((float)$totalgstamt,2,'.','');
$gstamtzz = number_format((float)$gstamt,2,'.','');



$discountamtsy = number_format((float)$discountamt,2,'.','');
$discountplusamtup = number_format((float)$discountplusamt,2,'.','');

$totalgrossAmt += $discountplusamtup;
$totalgrossAmount = number_format((float)$totalgrossAmt,2,'.','');

$netamt = $totalgrossAmount + $taxamount;
 $netAmount = number_format((float)$netamt,2,'.','');
 date_default_timezone_set('Asia/Kolkata');
$date = date("Y-m-d");
//$userId = $_SESSION['userId'];
$userId   = $_SESSION['USER_ID'];

$purchaseval_id =amebi_crypt($purchase_idzw,e);
$purchase_invoice_noe =amebi_crypt($purchase_invoice_no,e);


if(!empty($purchase_invoice_no)){
	
    $newUpdate = $db_handle->runMyUpdate("UPDATE canteen_purchase_item SET item_id = '$item_id',brand_id = '$newInsert_brand_id',dimension_id = '$dimension_id',quantity = '$quantity', rate = '$rata',discount_rate = '$discount_rate',discount_amount = '$discountamtsy', amount ='$iprice', cgst_rate ='$cgst_rate',sgst_rate ='$sgst_rate',cgst_amt ='$cgstamt',sgst_amt ='$sgstamt',igst_amt ='$igstamt',batch_no ='$batch_no',bar_code ='$bar_code',mrp ='$mrp', mfg_date ='$mfg_date',gst_amount ='$gstamtzz',net_amount ='$netAmount' WHERE purchase_item_id = '$purchase_item_id'");
	//$newUpdate = $db_handle->runMyUpdate("UPDATE canteen_purchase_item SET item_id = '$item_id',brand_id = '$newInsert_brand_id',dimension_id = '$dimension_id',quantity = '$quantity', rate = '$rata',discount_rate = '$discount_rate',discount_amount = '$discountamtsy', amount ='$iprice', cgst_rate ='$cgst_rate',sgst_rate ='$sgst_rate',igst_rate ='$gst' WHERE purchase_item_id = '$purchase_item_id'");
//echo $purchase_item_id;


	$db_handle = new DBController();
		  $suppliers = $db_handle-> runQuery("SELECT *,SUM(canteen_purchase_item.amount) AS totalGROSS,SUM(canteen_purchase_item.gst_amount) AS totalGST,SUM(canteen_purchase_item.discount_amount) AS totalDISC,SUM(canteen_purchase_item.net_amount) AS totalnet_amt FROM (canteen_purchase
                 INNER JOIN canteen_purchase_item ON canteen_purchase.purchase_id = canteen_purchase_item.purchase_id)		  
		    
		   WHERE canteen_purchase_item.purchase_id = '$purchase_idzw' GROUP BY canteen_purchase_item.purchase_id");
		 
		  foreach($suppliers as $supplier){
			
            	
             $totalgross = $supplier['totalGROSS']; 	
             $totaltax = $supplier['totalGST']; 	
			   $totalnet_amt = $supplier['totalnet_amt']; 
			   $discount_amount = $supplier['totalDISC']; 
		
			  
			  $db_handle = new DBController();
$newUpdate = $db_handle->runMyUpdate("UPDATE canteen_purchase
 SET purchase_invoice_no= '$purchase_invoice_no',supplier_id = '$supplier_id',gross_amount='$totalgross',tax_amount='$totaltax', discount_amount ='$discount_amount',net_amount ='$totalnet_amt',modified_on='$date',modified_by='$userId' WHERE purchase_id= '$purchase_idzw'"); 

		 }

	
$newUpdate2 = $db_handle->runMyUpdate("UPDATE item_selling_price SET selling_price = '$mrp',online_selling_price = '$mrp' WHERE purchase_item_id = '$purchase_item_id'");
 
		
if($newUpdate2 === TRUE){ 
			
			
			 $_SESSION['ERROR_MSG'] = "Success";
		     $_SESSION['MSG_ALRT'] = "TRUE";
		    header('location:../../../web/home/modules/university/Canteen/purchase_amendment/purchase_amendment_grid.php?purchase_invoice_noe='.$purchase_invoice_noe.'&purchaseidval='.$purchaseval_id);

		 }else{
			 $_SESSION['ERROR_MSG'] = "Unsuccess";
		     $_SESSION['MSG_ALRT'] = "FALSE";
		     header('location:../../../web/home/modules/university/Canteen/purchase_amendment/purchase_amendment_grid.php?purchase_invoice_noe='.$purchase_invoice_noe.'&purchaseidval='.$purchaseval_id);

		}
}
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY