<?php
require "../commonincludefiles.php";

$task = '';
if ( isset($_POST['task'])){
  $task = $_POST['task'];
}
switch($task){
    
    case "DELETEDIST":
        deleteUsers();
        break;
    default:
        echo "{failure:true}";
        break;
}
function deleteUsers(){
   $Dist_ids = $_POST['ids'];   
   if (version_compare(PHP_VERSION,"5.2","<"))  {    
     require_once("./JSON.php"); 
     $json = new Services_JSON();
     $deletevoucher_Id = $json->decode(stripslashes($Dist_ids));;
   } else {
     $deletevoucher_Id = json_decode(stripslashes($Dist_ids));
   }
    if(sizeof($deletevoucher_Id)<1)
	{
	  echo "0";
    }
	else {

		$objVoucherMasterMgmt= new VoucherMasterMgmt();
		$objVoucherMasterMgmt->voucher_id = implode(",",$deletevoucher_Id) ;
		$objVoucherMasterMgmt ->delete();
		
		$objVoucherDetailMgmt= new VoucherDetailMgmt();
     	$objVoucherDetailMgmt->voucher_id = implode(",",$deletevoucher_Id);
		$objVoucherDetailMgmt ->delete();
		
		echo "1";		
	}        
}
?> 



