ok

Mini Shell

Direktori : /home2/selectio/public_html/lilyexpresslive/software/admin/
Upload File :
Current File : /home2/selectio/public_html/lilyexpresslive/software/admin/pickup_onetime_add_ajax.php

<?php 
ob_start();
session_start();
$clientId=$_SESSION['user']['id'];
$clientLocation=$_SESSION['user']['location'];
$clientType=$_SESSION['user']['role'];
include("inc/config.php");
	    $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_o=$row['big_id']+1;
                                        $awb_no=1000001+$awb_o;
                                    }
                                    else
                                    {
                                        $awb_no=1000001;
                                    }

								}
				$statement = $pdo->prepare("SHOW TABLE STATUS LIKE 'tbl_customer'");
        		$statement->execute();
        		$result = $statement->fetchAll();
        		foreach($result as $row) {
        			$cust_id=$row[10];
        		                        }
								
								// 	**********************************  Generate AWB No End ********************************************
        $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']));

        if($clientType=='Admin')
        {
            $pic_status='picked';
        }
        else
        {
            $pic_status='picked';
            //$pic_status='pending';
        }
        
                            
    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];
		}
        
    date_default_timezone_set('Asia/Kolkata');
	$statement = $pdo->prepare("INSERT INTO pickup_entry (awb_no,ref_no,client_id,status,pincode,shipping_mode,customer_id,address,city,state,destination,phone,c_weight,a_weight,content_desc,total_charges,other_charges,payment_mode,pics,gst_no,created_at,office_customer_name,office_customer_address) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
	$result1=$statement->execute(array($awb_no,$_POST['awb_no'],$_POST['client_id'],$pic_status,$_POST['pincode'],$_POST['shipping_mode'],$cust_id,$_POST['address'],$_POST['city'],$_POST['state'],$_POST['destination_city'],$_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['created'],$_POST['sender_name'],$_POST['sender_address']));
		
	
        $statement_update = $pdo->prepare("UPDATE tbl_awb set status=0 WHERE awb_code='".$_POST['awb_no']."'");
    	$statement_update->execute();
    	
			/*Tracking Module Start*/
	$statement = $pdo->prepare("INSERT INTO tbl_tracking (pickup_entry_id,user_id,location,status,description,remark,created_at) VALUES (?,?,?,?,?,?,?)");
	$result2=$statement->execute(array($ai_id,$clientId,$clientLocation,'picked','Entry Successfully Picked','Material Safe...',$_POST['created']));
    }	                    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);     
?>

Zerion Mini Shell 1.0