ok

Mini Shell

Direktori : /home2/selectio/www/lilyexpresslive/software/admin/
Upload File :
Current File : /home2/selectio/www/lilyexpresslive/software/admin/cargo_one_time_ajax_add.php

<?php 
try{
ob_start();
session_start();
$clientId=$_SESSION['lily_express_software_live']['id'];
$clientLocation=$_SESSION['lily_express_software_live']['location'];
// $clientType=$_SESSION['user']['role'];
include("inc/config.php");
   // var_dump($_POST);
	    $valid = 1;
        // 	**********************************  Generate AWB No Start ********************************************
        $statement = $pdo->prepare("SELECT MAX(id) as big_id FROM pickup_entry");
		$statement->execute();
		$result = $statement->fetchAll(PDO::FETCH_ASSOC);
			foreach ($result as $row)
			{
			    $bid=$row['big_id'];
                if($bid!='')
                {
                    $awb_n=$row['big_id']+1;
                    $awb_no=1000001+$awb_n;
                }
                else
                {
                    $awb_no=1000001;
                }

			}

if($clientType=='Admin')
{
    $pic_status='picked';
    $pic_desc='Entry Successfully Picked';
}
else
{
    $pic_status='picked';
    $pic_desc='Entry Successfully Picked';
}
        
                            
    if($valid==1)
    {
        $statement = $pdo->prepare("SHOW TABLE STATUS LIKE 'pickup_entry'");
		$statement->execute();
		$result = $statement->fetchAll();
		foreach($result as $row) {
			$ai_id=$row[10];
		}
		        $statement = $pdo->prepare("SHOW TABLE STATUS LIKE 'tbl_customer'");
        		$statement->execute();
        		$result = $statement->fetchAll();
        		foreach($result as $row) {
        			$cust_id=$row[10];
        		}
// 	**********************************  Customer Details ********************************************
        $statement = $pdo->prepare("INSERT INTO tbl_customer (client_id,cust_code,cust_type,cust_name,cust_address,cust_zip,cust_phone,cust_city,cust_state,destination_city) VALUES (?,?,?,?,?,?,?,?,?,?)");
		$statement->execute(array($_POST['client_id'],$_POST['db_code'],'one_time',$_POST['customer_name'],$_POST['address'],$_POST['pincode'],$_POST['phone'],$_POST['city'],$_POST['state'],$_POST['destination_city']));
		                        
        		                        
        
            date_default_timezone_set('Asia/Kolkata');
            //$date = date('Y/m/d h:i:s a', time());
	    $statement = $pdo->prepare("INSERT INTO pickup_entry (manifest_id,awb_no,ref_no,client_id,status,pincode,shipping_mode,customer_id,address,city,state,phone,c_weight,a_weight,content_desc,total_charges,other_charges,payment_mode,pics,gst_no,destination,created_at,e_way_bill_no,invoice_no,invoice_value,length1,width1,height1,nob1,act_wt1,length2,width2,height2,nob2,act_wt2,length3,width3,height3,nob3,act_wt3,length4,width4,height4,nob4,act_wt4,length5,width5,height5,nob5,act_wt5,total_no_pieces,payment_details) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
		$result1=$statement->execute(array(0,$awb_no,$_POST['awb_no'],$_POST['client_id'],$pic_status,$_POST['pincode'],$_POST['shipping_mode'],$cust_id,$_POST['address'],$_POST['city'],$_POST['state'],$_POST['phone'],$_POST['c_weight'],$_POST['a_weight'],$_POST['content_desc'],$_POST['total_charges'],$_POST['other_charges'],$_POST['payment_mode'],$_POST['pics'],$_POST['gst_no'],$_POST['destination_city'],$_POST['created'],$_POST['e_way_bill_number'],$_POST['invoice_no'],$_POST['invoice_value'],$_POST['length1'],$_POST['width1'],$_POST['height1'],$_POST['nob1'],$_POST['act_wt1'],$_POST['length2'],$_POST['width2'],$_POST['height2'],$_POST['nob2'],$_POST['act_wt2'],$_POST['length3'],$_POST['width3'],$_POST['height3'],$_POST['nob3'],$_POST['act_wt3'],$_POST['length4'],$_POST['width4'],$_POST['height4'],$_POST['nob4'],$_POST['act_wt4'],$_POST['length5'],$_POST['width5'],$_POST['height5'],$_POST['nob5'],$_POST['act_wt5'],$_POST['total_no_pieces'],$_POST['payment_details']));


        $statement_update = $pdo->prepare("UPDATE tbl_awb set status=0 WHERE awb_code='".$_POST['awb_no']."'");
    	$resu=$statement_update->execute();

if(!$resu){ error_log('awb_code Number Update Failed :'.$_POST['awb_no']);}


			/*Tracking Module Start*/
	$statements = $pdo->prepare("INSERT INTO tbl_tracking (pickup_entry_id,user_id,location,status,description,remark,created_at,manifest_id) VALUES (?,?,?,?,?,?,?,?)");
	$result2=$statements->execute(array($ai_id,$clientId,$clientLocation,$pic_status,$pic_desc,'Material Safe...',$_POST['created'],0));  
    }	                    if($result1==1 && $result2==1)
							{
							    $txt='Success..';
							    $error='1';
							}
							else
							{
							    $txt='Failed..';
							    $error='0';
							}
                            
                              $datas[] = array('txt' => $txt, 'error' => $error,'awb_number'=>$awb_no,'p_id'=>$ai_id);
                              
                         echo json_encode($datas);     
                        
}catch(exception $e){
    $txt='Failed..'.$clientId.$clientLocation.$e;
	$error='0';$awb_no=0;$ai_id=0;
    $datas[] = array('txt' => $txt, 'error' => $error,'awb_number'=>$awb_no,'p_id'=>$ai_id);
                              
     echo json_encode($datas); 
}	
?>

Zerion Mini Shell 1.0