403Webshell
Server IP : 27.254.152.13  /  Your IP : 216.73.217.38
Web Server : Apache/2
System : Linux ns1-252017.dragonhispeed.com 5.2.0 #1 SMP Fri Mar 29 22:50:14 MSK 2024 x86_64
User : coloflew ( 1072)
PHP Version : 5.6.40
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/coloflew/domains/fulltion.com/public_html/administrator/modules/manu_supply/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/coloflew/domains/fulltion.com/public_html/administrator/modules/manu_supply//supplyin_b1.php
<?php
@$linkurl = "index.php?name=manu_supply&file=supplyin";
@$link1 = "index.php?name=manu_supply&file=supplydetail";
if(isset($fullsc)){
@$linkurl .= "&fullsc=fullsc";
@$link1 .= "&fullsc=fullsc";
}

if(isset($_GET['cl'])){
unset($_SESSION['SSEnd']);
unset($_SESSION['SSStart']);
}

if(@$_GET['act2']=="step1"){
	@$arrData = array();
	@$arrCustomerSend = array();
	@$arrCustomerReceive = array();
	if(@$_POST['SendName'] && @$_POST['SendTel']){
		@$getname = @$db->getOne("customer","*"," CustomerName='".@$_POST['SendName']."'  and CustomerPhon='".@$_POST['SendTel']."'");
	}elseif($_POST['SendIdentification']){
		@$getname = @$db->getOne("customer","*"," CustomerIdentification='".@$_POST['SendIdentification']."'");
	}
	@$getidsend = @$getname['CustomerID'];
	if(@!$getname){	
		@$arrCustomerSend['CustomerName']		= @$_POST['SendName'];
		@$arrCustomerSend['CustomerSurName']		= @$_POST['SendSurName'];
		@$arrCustomerSend['CustomerIdentification']		= @$_POST['SendIdentification'];
		@$arrCustomerSend['CustomerAddress']		= @$_POST['SendAddress'];
		@$arrCustomerSend['CustomerProvince']	= @$_POST['SendProvince'];
		@$arrCustomerSend['CustomerDistrict']	= @$_POST['SendDistrict'];
		@$arrCustomerSend['CustomerTambon']	= @$_POST['SendTambon'];
		@$arrCustomerSend['CustomerPostCode']	= @$_POST['SendPostCode'];
		@$arrCustomerSend['CustomerPhon']		= @$_POST['SendTel'];
		@$arrCustomerSend['CustomerHomePhon']		= @$_POST['SendHomeTel'];
		@$arrCustomerSend['CustomerOtherPhon']		= @$_POST['SendOtherPhon'];
		@$arrCustomerSend['CustomerTypeID']		= '1';
		@$arrCustomerSend['CustomerLastUse']		= @date("Y-m-d");
		
		foreach($arrCustomerSend as $k => $v ){
			@$arrCustomerSend[@$k] = str_replace("'", "\'", @$v); 
		}
	
		@$getidsend = @$db->insertData("customer",@$arrCustomerSend);	
	}else{
		@$arrCustomerSend = array();
		@$arrCustomerSend['CustomerLastUse']		= @date("Y-m-d");
		@$db->updateData("customer",@$arrCustomerSend," CustomerID='".@$getidsend."'");
	}
	//echo @$getidsend;
	//exit;
	@$sendRes = @$db->getOne("customer","*"," CustomerID='".@$getidsend."'");
	@$sendtype = @$db->getOne("customertype","*"," CustomerTypeID='".@$sendRes['CustomerTypeID']."'");
	
	if(count(@$_POST['EndPoint']) > 0){
		
		@$_SESSION['SSEnd'] = @$_POST['EndPoint'];
		@$_SESSION['SSStart'] = @$_POST['StartPoint'];
		@$_SESSION['SSProvinceRoute'] = @$_POST['ProvinceRoute'];

	}
}

//echo "<pre>"; print_r(@$_SESSION);
///////////////////////////////////////////////////////////////////////////////////add
if(@$_GET['act']=="add"){
@$arrInvoiceID = array();
@$arrData = array();
@$arrDataUpdateRun = array();
@$arrCustomerReceive = array();
@$arrDataProduct = array();
@$arrDataProductUpdate = array();
@$arrDataHist = array();
	@$i =1;
	foreach($_SESSION['SSEnd']  as $val){
		//add new code by noi 31/08/2012
		@$getname = @$db->getOne("customer","*"," CustomerName='".@$_POST['ReceiveName_'.@$i.""]."' and CustomerPhon='".@$_POST['ReceiveTel_'.@$i.""]."'");
		@$getidrecv = @$getname['CustomerID'];
		//echo '<pre>';print_r(@$getname);
		if(@!$getname){
			@$arrCustomerReceive['CustomerName']	= @$_POST['ReceiveName_'.@$i.""];
			@$arrCustomerReceive['CustomerSurName']	= @$_POST['ReceiveSurName_'.@$i.""];
			@$arrCustomerReceive['CustomerIdentification']	= @$_POST['ReceiveIdentification_'.@$i.""];
			@$arrCustomerReceive['CustomerAddress']		= @$_POST['ReceiveAddress_'.@$i.""];
			@$arrCustomerReceive['CustomerProvince']	= @$_POST['ReceiveProvince_'.@$i.""];
			@$arrCustomerReceive['CustomerDistrict']	 = @$_POST['ReceiveDistrict_'.@$i.""];
			@$arrCustomerReceive['CustomerTambon']	   = @$_POST['ReceiveTambon_'.@$i.""];
			@$arrCustomerReceive['CustomerPostCode']	= @$_POST['ReceivePostCode_'.@$i.""];
			@$arrCustomerReceive['CustomerPhon']		= @$_POST['ReceiveTel_'.@$i.""];
			@$arrCustomerReceive['CustomerHomePhon']		= @$_POST['ReceiveHomeTel_'.@$i.""];
			@$arrCustomerReceive['CustomerOtherPhon']		= @$_POST['ReceiveOtherPhon_'.@$i.""];
			@$arrCustomerReceive['CustomerTypeID']		= '1';
			@$arrCustomerReceive['CustomerLastUse']		= @date("Y-m-d");

			//@$arrCustomerSend['CustomerName']		= @$_POST['SendName'];
			if( @$_POST['CheckDalivary_'.@$i.""] == '1'){
				@$arrCustomerReceive['CustomerVilla']		= @$_POST['Villa_'.@$i.""];
				@$arrCustomerReceive['CustomerRoom']		= @$_POST['Room_'.@$i.""];
				@$arrCustomerReceive['CustomerFloor']		= @$_POST['Floor_'.@$i.""];
				@$arrCustomerReceive['CustomerHome']		= @$_POST['Home_'.@$i.""];
				@$arrCustomerReceive['CustomerMuu']		= @$_POST['Muu_'.@$i.""];
				@$arrCustomerReceive['CustomerZoy']		= @$_POST['Zoy_'.@$i.""];
				@$arrCustomerReceive['CustomerRode']		= @$_POST['Rode_'.@$i.""];
				@$arrCustomerReceive['CustomerAddress']	= "หมู่บ้าน/อาคาร ".@$_POST['Villa_'.@$i.""]." เลขที่ห้อง ".@$_POST['Room_'.@$i.""]
															." ชั้น ".@$_POST['Floor_'.@$i.""]." บ้านเลขที่ ".@$_POST['Home_'.@$i.""]
															." หมู่ ".@$_POST['Muu_'.@$i.""]." ซอย ".@$_POST['Zoy_'.@$i.""]
															." ถนน ".@$_POST['Rode_'.@$i.""];	
				@$arrCustomerReceive['CustomerProvince']		= @$_POST['ReceiveProvince_'.@$i.""];
				@$arrCustomerReceive['CustomerDistrict']		= @$_POST['ReceiveDistrict_'.@$i.""];
				@$arrCustomerReceive['CustomerTambon']	= @$_POST['ReceiveTambon_'.@$i.""];
				@$arrCustomerReceive['CustomerPostCode']		= @$_POST['ReceivePostCode_'.@$i.""];
			}
			@$arrCustomerReceive['CustomerPhon']			= @$_POST['ReceiveTel_'.@$i.""];
			@$arrCustomerReceive['CustomerHomePhon']			= @$_POST['ReceiveHomeTel_'.@$i.""];
			@$arrCustomerReceive['CustomerOtherPhon']		= @$_POST['ReceiveOtherPhon_'.@$i.""];

			@$arrCustomerReceive['CustomerLastUse']		= @date("Y-m-d");
				
			foreach($arrCustomerReceive as $k => $v ){
					@$arrCustomerReceive[@$k] = str_replace("'", "\'", @$v); 
			}
			@$getidrecv = @$db->insertData("customer",@$arrCustomerReceive);	
		}else{
			@$arrCustomerReceive = array();
			@$arrCustomerReceive['CustomerLastUse']		= @date("Y-m-d");
			@$db->updateData("customer",@$arrCustomerReceive," CustomerID='".@$getidrecv."'");
		}
		
		@$getruncode = @$db->getOne("invoiceruning","*"," DeliveryPointID='".@$_POST['StartPointID_'.@$i.""]."'");
		@$arrDataUpdateRun['RunNum']	= @$getruncode['RunNum'] + 1;
		@$db->updateData("invoiceruning",@$arrDataUpdateRun," RunID='".@$getruncode['RunID']."'");
		
		@$runcode = @$db->getOne("invoiceruning","*"," DeliveryPointID='".@$_POST['StartPointID_'.@$i.""]."'");
		@$getcode = @$db->getOne("deliverypoint","*"," DeliveryPointID='".@$_POST['StartPointID_'.@$i.""]."'");
		
		@$code = @$getcode['DeliveryPointCode']."-".@$runcode['RunText'].@$runcode['RunNum'];
			
		@$arrData['InvoiceCode']			= @$code;
		@$arrData['InvoiceStartPoint']	= @$_POST['StartPointID_'.@$i.""];
		@$arrData['InvoiceEndPoint']		= @$_POST['EndPointID_'.@$i.""];
		@$arrData['InvoiceDate']			= @date("Y-m-d");
		@$arrData['InvoiceTime']			= date("H:i:s",time());
		@$arrData['InvoiceSendID']		= @$_POST['SendID_'.@$i.""];
		@$arrData['InvoiceReceiveID']	= @$getidrecv;
		@$arrData['InvoiceEmpID']		= @$_SESSION['member']['userid'];
		@$arrData['InvoiceCreatePoint']	= @$_POST['StartPointID_'.@$i.""];
		@$arrData['InvoiceSetEndPoint']	= @$_POST['EndPointID_'.@$i.""];
		@$arrData['CheckDalivary']	= @$_POST['CheckDalivary_'.@$i.""];
		foreach($arrData as $k => $v ){
				@$arrData[@$k] = str_replace("'", "\'", @$v); 
		}
		
		@$getidinv = @$db->insertData("invoice",@$arrData);
		
		//@$getidin = @$db->getOne("invoice","max(InvoiceID) as InvoiceID","","","");
		@$getidin = @$db->getOne("invoice","InvoiceID","InvoiceCode='".@$code."'","","");
		@$getidinv = @$getidin['InvoiceID'];
		
		if(@$getidinv){
			for($j=0; $j<count($_POST['ProductName_'.@$i]);$j++){ 
				
				if( @$_POST['totalmoney_'.@$i][@$j] != ""){
					
					@$arrDataProduct['InvoiceID'] = @$getidinv;
					@$arrDataProduct['ProductName'] = @$_POST['ProductName_'.@$i][@$j];
					@$arrDataProduct['ProductDetail'] = @$_POST['ProductDetail_'.@$i][@$j];
					@$arrDataProduct['ProductWeight'] = @$_POST['ProductWeight_'.@$i][@$j];
					@$arrDataProduct['ProductSize'] = @$_POST['ProductSize_'.@$i][@$j];
					@$arrDataProduct['Saleper'] = @$_POST['Saleper_'.@$i][@$j];
					@$arrDataProduct['totalmoney'] = @$_POST['totalmoney_'.@$i][@$j];
					@$arrDataProduct['LastPoint'] = @$_POST['StartPointID_'.@$i.""];
					@$arrDataProduct['status'] = '1';
					
					foreach($arrDataProduct as $k => $v ){
							@$arrDataProduct[@$k] = str_replace("'", "\'", @$v); 
					}
					
					$DetailID = @$db->insertData("invoicedetail",@$arrDataProduct);
					
					//@$getiddetail = @$db->getOne("invoicedetail","max(InvoiceDetailID) as InvoiceDetailID","InvoiceID='".@$getidinv."'","","");
					@$getiddetail = @$db->getOne("invoicedetail","InvoiceDetailID","InvoiceDetailID='".@$DetailID."'","","");
					
					@$arrDataHist['InvoiceDetailID'] = @$getiddetail['InvoiceDetailID'];
					@$arrDataHist['InvoiceID'] 		= @$getidinv;
					@$arrDataHist['LastPoint'] 		= @$_POST['StartPointID_'.@$i.""];
					@$arrDataHist['StartPoint'] 		= @$_POST['StartPointID_'.@$i.""];
					@$arrDataHist['EndPoint']		= @$_POST['EndPointID_'.@$i.""];
					@$arrDataHist['status'] 			= '1';
					@$arrDataHist['HistDatetime'] 	= date("Y-m-d H:i:s");
					@$db->insertData("hist",@$arrDataHist);
					
					@$getidinvoice = @$db->getOne("invoicedetail","*"," InvoiceDetailID='".@$getiddetail['InvoiceDetailID']."'","","");
					@$getcodeproviceinvoice = @$db->getOne("invoice","*"," InvoiceID = '".@$getidinvoice['InvoiceID']."'","","");
					//@$getcodeprovice = @$db->getOne("deliverypoint","*,SUBSTR(DeliveryPointCode, 2, 4) as codeB"," DeliveryPointID = '".@$getcodeproviceinvoice['InvoiceCreatePoint']."'","");
					@$getcodeprovice = @$db->getOne("deliverypoint","*,DeliveryPointCode as codeB"," DeliveryPointID = '".@$getcodeproviceinvoice['InvoiceCreatePoint']."'","");
					@$getcode = @$db->getOne("province","*"," PROVINCE_ID = '".@$getcodeprovice['DeliveryPointProvince']."'","","");
					
					@$getidcodedetail = @$db->getOne("invoicedetail","max(InvoiceDetailID) as maxInvoiceDetailID"," ProductCode like '".@$getcode['PROVINCE_CODE'].@$getcodeprovice['codeB'].date("dm")."%'","");
					
					//@$getidcodedetail = @$db->getOne("invoicedetail","max(InvoiceDetailID) as maxInvoiceDetailID"," ProductCode like '".@$getcode['PROVINCE_CODE'].date("dm")."%'","");
				
					if(@$getidcodedetail['maxInvoiceDetailID'])
					{
						@$getcodeproduct = @$db->getOne("invoicedetail","*"," InvoiceDetailID = '".@$getidcodedetail['maxInvoiceDetailID']."'","");
						@$num = substr(@$getcodeproduct['ProductCode'],-4);
						@$num = @$num + 1;
					}else{
						@$num = '0';
					}
					
					@$arrDataProductUpdate['ProductCode'] = @$getcode['PROVINCE_CODE'].@$getcodeprovice['codeB'].date("dm").sprintf("%04d",(int)@$num);
					//@$arrDataProductUpdate['ProductCode'] = @$getcode['PROVINCE_CODE'].date("dm").sprintf("%04d",(int)@$num);
					
					@$db->updateData("invoicedetail",@$arrDataProductUpdate," InvoiceDetailID='".@$getiddetail['InvoiceDetailID']."'");
				}
			}
		}
		
		@$arrInvoiceID[] = @$getidinv;
	@$i++;
	//exit;
	}
	unset($_SESSION['SSEnd']);
	unset($_SESSION['SSStart']);
	@$_SESSION['SSInvoice'] = @$arrInvoiceID;
	@$recvRes[@$i] = @$db->getOne("customer","*"," CustomerID='".@$getidrecv."'");
	@$sendRes = @$db->getOne("customer","*"," CustomerID='".@$_POST['SendCustomerID']."'");
	@$msg = "Save Data complete.";
	@$res = true;
	
///////////////////////////////////////////////////////////////////////////////////editdata
}
@$where_point = "lang_code='".@$lang_code."' and DeliveryPointStatus='1'";

if(@$_SESSION['member']['permistion'] != 4)
	{
		@$setpoint = @$_SESSION['member']['point'];
		@$setjava = @$_SESSION['member']['point'];

		/*
		,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
		@$getRouteID = @$db->getAll( "routexpoint", "RouteID"," DeliveryPointID = '".@$setpoint."'","" );
		if(@$getRouteID){
			@$wheretest = " c.lang_code = '".@$lang_code."' and (";
			foreach($getRouteID as $key => $val){
				@$wheretest .= " a.RouteID = '".@$val['RouteID']."' or ";
			}
			@$wheretest .= " a.RouteID = '' ) and d.lang_code = '".@$lang_code."'";
		}
		,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
		
		*/
			/*
		@$wheretest = "a.RouteID in ( SELECT RouteID FROM `better_routexpoint` WHERE DeliveryPointID = '".@$setpoint."') 
		and d.lang_code = '".@$lang_code."' and c.lang_code = '".@$lang_code."' ";
		
		@$gettest = @$db->getJoin(" distinct d.DeliveryPointID , d.DeliveryPointName , c.lang_code , d.lang_code","better_routexpoint a LEFT OUTER JOIN better_busxroute b ON a.RouteID = b.RouteID LEFT OUTER JOIN better_route c ON a.RouteID = c.RouteID LEFT OUTER JOIN better_deliverypoint d ON a.DeliveryPointID = d.DeliveryPointID",@$wheretest,"","");
		
		@$getproviceroute = @$db->getAll( "province", "*"," PROVINCE_ID  in (select d.DeliveryPointProvince from better_routexpoint a LEFT OUTER JOIN better_busxroute b ON a.RouteID = b.RouteID LEFT OUTER JOIN better_route c ON a.RouteID = c.RouteID LEFT OUTER JOIN better_deliverypoint d ON a.DeliveryPointID = d.DeliveryPointID where  ".@$wheretest.")"," order by PROVINCE_ID" );
		*/
		@$setpoint = @$_SESSION['member']['point'];
		
		@$setjava = 'admin';
		@$gettest = @$db->getAll( "deliverypoint", "*",@$where_point,"" );
		
		@$getproviceroute = @$db->getAll( "province", "*"," PROVINCE_ID  in (select DeliveryPointProvince from better_deliverypoint where ".@$where_point.")","order by PROVINCE_ID" );

	}else
	{

		@$setpoint = @$_SESSION['member']['point'];
		
		@$setjava = 'admin';
		@$gettest = @$db->getAll( "deliverypoint", "*",@$where_point,"" );
		
		@$getproviceroute = @$db->getAll( "province", "*"," PROVINCE_ID  in (select DeliveryPointProvince from better_deliverypoint where ".@$where_point.")","order by PROVINCE_ID" );

	}

@$where_province = "lang_code='".@$lang_code."' and status='1'";
@$where_district = "lang_code='".@$lang_code."' and status='1'";
@$where_point = "lang_code='".@$lang_code."' and DeliveryPointStatus='1'";
@$where_producttype = "lang_code='".@$lang_code."' and ProductTypeStatus='1'";

@$getProvince = @$db->getAll( "province", "*",@$where_province," order by PROVINCE_CODE asc" );
@$getDistrict = @$db->getAll( "district", "*",@$where_district," order by PROVINCE_ID,AMPHUR_ID asc" );

@$getProvince1 = @$db->getAll( "province", "*",@$where_province," order by PROVINCE_CODE asc" );
@$getDistrict1 = @$db->getAll( "district", "*",@$where_district," order by PROVINCE_ID,AMPHUR_ID asc" );

@$getpoint = @$db->getAll( "deliverypoint", "*",@$where_point,"order by DeliveryPointName asc" );

@$getRoute = @$db->getAll( "route", "*"," RouteStatus = '1'","" );

@$getproducttype = @$db->getAll( "producttype", "*",@$where_producttype,"" );
@$getsetupsize = @$db->getAll( "setupsize", "*","","" );

//echo "<pre>";print_r($_SESSION);
?>

<!-- Scrip Java-->
<!--<script type="text/javascript" src="jquery-1.4.2.min.js"></script>-->

<div class="content-box">
    <div class="content-box-header">
    	<?PHP if(isset($fullsc)){ ?>
			<label><a href="index.php?name=manu_main&hk=login"><img src="resources/images/home.png" alt="Edit" /></a></label>
        <?PHP }?>
		<h3><?php echo @$lang_set['SupplyProduct']; ?></h3>					
			<ul class="content-box-tabs">
				<li><a href="#list" class="default-tab"><?php echo @$lang_set['SupplyProduct']; ?></a></li>
            </ul>
         <div class="clear"></div>            	
    </div>
    
    <div class="content-box-content">
    	<?php if(@$res){?>
          <div class="notification success png_bg">
             <a href="#" class="close"><img src="resources/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
                   <div>
                       <?php echo @$msg;?>
                   </div>
             </div>
          <meta http-equiv="refresh" content="1;URL=<?PHP echo @$link1;?>">
        <?php }?>

              <!--##############Send Customer ######################-->

    <form action="<?PHP echo @$linkurl;?>&act2=step1" method="post" onsubmit="return checkpagesupplyinstepone('<?PHP echo @$setjava;?>');" name="formss" >
		<div class="content-box">	
    	<div class="content-box-header">

        	<h3 style="color:#FF0000"><?php echo @$lang_set['SendProfile']; ?></h3>	

            <span style="float:right; margin-right:5px; margin-top:5px;"><input type="button" class="button" onclick="SearchCustomer('Send','0');" value="<?PHP echo "ค้นหาข้อมูลในระบบ";?>" /><a href="#Search" id="hideSearch" ></a></span>
        </div>
        
        <table width="100%">
        	<tr style="background:#F3F3F3;">
            	<td></td>
                <td></td>
                <td></td>
                <td></td>
             </tr>

             <tr  style="background:#fff;">
                 <td><font style="font-size:16px;font-weight:bolder"><?php echo @$lang_set['Namesend']; ?>:</font>
				 <input type="text" class="text-input" name="SendName" id="SendName" value="<?php echo @$sendRes['CustomerName'];?>" /></td>
                <td><strong><?php echo @$lang_set['SurNamesend']; ?>:<strong>
				   <input type="text" class="text-input" name="SendSurName" id="SendSurName"  value="<?php echo @$sendRes['CustomerSurName'];?>" /></td>
                <td><strong><?php echo @$lang_set['Identificationsend']; ?>:<strong>
				<input type="text" class="text-input" name="SendIdentification" id="SendIdentification" value="<?php echo @$sendRes['CustomerIdentification'];?>" maxlength="13"/></td>
                <td><strong><?php echo @$lang_set['telephonenum']; ?>:<strong>
				<input type="text" class="text-input" name="SendTel" id="SendTel"value="<?php echo @$sendRes['CustomerPhon'];?>" maxlength="10" /></td>

			</tr>
            <tr>

            <tr style="background:#fff;">
            	<td colspan="2"><strong><?php echo @$lang_set['Addresssend']; ?>:</strong> <input type="text" class="text-input large-input" name="SendAddress" id="SendAddress" value="<?php echo @$sendRes['CustomerAddress'];?>" /></td>
                <td><strong><?php echo @$lang_set['emp_province']; ?>:</strong>
                <select  name="SendProvince" id="SendProvince" onchange="SelectProvince('<?PHP echo @$lang_code;?>','Send','0')" class="widthselect" style="width:170px;">
                    <option value="0">--Select--</option>
					<?php 
                        if(@$getProvince1){
							foreach($getProvince1 as $key => $val){
                    ?>
                        <option value="<?php echo @$val['PROVINCE_ID'];?>" <?php echo (@$val['PROVINCE_ID']=='' || @$val['PROVINCE_ID']==@$sendRes['CustomerProvince'] ? "selected" : "")?>><?php echo @$val['PROVINCE_NAME'];?></option>
                    <?php 	}
                        }
                    ?>						
                      </select></td>
                <td><strong><?php echo @$lang_set['emp_district']; ?>:</strong>
                <select name="SendDistrict" id="SendDistrict" class="widthselect" style="width:170px;">
                    <option value="0">--Select--</option>
					<?php 
                        if(@$getDistrict1){
							foreach($getDistrict1 as $key => $val){
                    ?>
                        <option value="<?php echo @$val['AMPHUR_ID'];?>" <?php echo (@$val['AMPHUR_ID']=='' || @$val['AMPHUR_ID']==@$sendRes['CustomerDistrict'] ? "selected" : "")?>><?php echo @$val['AMPHUR_NAME'];?></option>
                    <?php 	}
                        }
                     ?>						
                      </select>
                </td>
            </tr>
            <tr style="background:#fff;">
            	<td><strong><?php echo @$lang_set['tambon']; ?>:</strong> <input type="text" class="text-input" name="SendTambon" id="SendTambon" 
                      value="<?php echo @$sendRes['CustomerTambon'];?>" /></td>
                <td><strong><?php echo @$lang_set['postcode']; ?>:</strong> <input type="text" class="text-input" name="SendPostCode" id="SendPostCode" 
                      value="<?php echo @$sendRes['CustomerPostCode'];?>" maxlength="5"/></td>
            	<td><strong><?php echo @$lang_set['hometelephonenum']; ?>:</strong> <input type="text" class="text-input" name="SendHomeTel" id="SendHomeTel" 
                      value="<?php echo @$sendRes['CustomerHomePhon'];?>" maxlength="9" /></td>
                <td><strong><?php echo @$lang_set['customer_phonother']; ?>:</strong> <input type="text" class="text-input" name="SendOtherPhon" id="SendOtherPhon" value="<?php echo @$sendRes['CustomerOtherPhon'];?>"  /></td>
            </tr>
        </table>
        <?php if(@$_SESSION['member']['permistion'] == "4"){?>
       <table>
        	<tr>
            	<td width="10%" align="right">
                   <label><?php echo @$lang_set['startpoint']; ?>:</label>
                </td>
                <td width="90%" align="left" colspan="2">
                
                	<select name="StartPoint" id="StartPoint">
                    	<option value="0">เลือกต้นทาง</option>
						<?php 
                        	if(@$getpoint){
                            	foreach($getpoint as $key => $val){
                        ?>
                        <option value="<?php echo @$val['DeliveryPointID'];?>" <?php echo (@$val['DeliveryPointID']=='' || @$val['DeliveryPointID']==@$_SESSION['SSStart'] ? "selected" : "")?>><?php echo @$val['DeliveryPointName'];?></option>
                        <?php 	}
                        	}
                        ?>						
                    </select>
                </td>
            <tr>
        </table>
        <?PHP }else{?>
                <input type="hidden" name="StartPoint" value="<?PHP echo @$setpoint;?>" />
        <?PHP }?>
        <table id="tbln2">
            <tr>
            	<td width="10%">
                	<label><?php echo @$lang_set['endpoint']; ?>:</label>
                </td>
            	 <td align="left" width="10%"><input type="button" class="button" value="เพิ่มปลายทาง" onclick="javascript:addropdown();"/>
                </td>
                <td width="90%" >
                      <table id="tbln" style="width:100%;">
                      	<tr style=" border:1px solid #fff; background:#fff;">
                        	<select name="ProvinceRoute[]" disabled="disabled" style="display:none"></select>
                            <select name="EndPoint[]" disabled="disabled" style="display:none"></select>
							<?php
                            if(is_array(@$_SESSION['SSEnd'])){
                                foreach($_SESSION['SSEnd']  as $key1 => $va){
                            ?>
                        	<td style="width:150px;"><select name="ProvinceRoute[]2" onchange="SelectProviceRoute('<?PHP echo @$setjava;?>','<?PHP echo @$lang_code;?>',1,options[selectedIndex].value)" style="width:119px;">
                        	  <?php 
							
                                if(@$getproviceroute){
                                    foreach($getproviceroute as $key => $val){
                            ?>
                        	  <option value="<?php echo @$val['PROVINCE_ID'];?>" <?php echo (@$val['PROVINCE_ID']==@$_SESSION['SSProvinceRoute'][@$key1] ? "selected" : "")?>><?php echo @$val['PROVINCE_NAME'];?></option>
                        	  <?php 	}
                                }
                            ?>
                      	  </select>
                       	    <br/>
                            	<select name="EndPoint[]" id="EndPoint<?php echo ($key1+1);?>" style="width:119px;">
									<?php 
                                        if(@$gettest){
                                            foreach($gettest as $key => $val){
                                    ?>
                                    <option value="<?php echo @$val['DeliveryPointID'];?>" <?php echo (@$val['DeliveryPointID']=='' || @$val['DeliveryPointID']==@$va ? "selected" : "")?>><?php echo @$val['DeliveryPointName'];?></option>
                                    <?php 	}
                                        }
                                    ?>						
                      			</select>
                      			<input type="button" class="button" onclick="javascript:RemoveItem(this,<?php echo ($key1+1);?>);" style="width:25px;" 
                                value="-">
                            </td>
						  	<?php } }else{?>
                          	<td style="width:150px;">
                            <select name="ProvinceRoute[]" id="ProvinceRoutes1" onchange="SelectProviceRoute('<?PHP echo @$setjava?>','<?PHP echo @$lang_code;?>',1,options[selectedIndex].value)" style=" width:119px;">
                            <option value="0">--Select--</option>
                            <?php 
                                if(@$getproviceroute){
                                    foreach($getproviceroute as $key => $val){
                            ?>
                                <option value="<?php echo @$val['PROVINCE_ID'];?>" <?php echo (@$val['PROVINCE_ID']=='' || @$val['PROVINCE_ID']==@$sendRes['CustomerProvince'] ? "selected" : "")?>><?php echo @$val['PROVINCE_NAME'];?></option>
                            <?php 	}
                                }
                            ?>						
                              </select><br/>
                            	<select name="EndPoint[]" id="EndPoint1" style=" width:119px;">
                                <option value="0">--Select--</option>					
                      			</select>
                      			<input type="button" class="button" onclick="javascript:RemoveItem(this);" style="width:25px;" value="-">
                            </td>
                            
						  	<?php 
                          	}
                          	?>
                    		
                       	</tr>
                   	</table> 
              </td>
              <td style="vertical-align:bottom">
              	<input type="submit" class="button"  style="width:60px;" value="ตกลง">
              </td>
            </tr>
       </table>
    	</div>

	</form>


              <!--##############Receiev Customer ######################-->


    <?php
		if(is_array(@$_SESSION['SSEnd'])){
	?>
    <form action="<?PHP echo @$linkurl;?>&act=<?php echo (@$_GET['act']=="edit" ? "editdata" : "add");?>" method="post" onsubmit="return checkpagesupplyinstepend(<?php echo  count(@$_POST['EndPoint']);?>);" name="fromend">
    <input type="hidden" name="SendCustomerID" value="<?php echo  @$sendRes['CustomerID'];?>">
    <input type="hidden" name="SendCustomerType" value="<?php echo  @$sendRes['CustomerTypeID'];?>">
    <div class="content-box">
    <div class="content-box-header">

    	<h3 style="color:#FF0000"><?php echo @$lang_set['RecvProfile']; ?></h3>		

        <ul class="content-box-tabs">
            <?php 
				@$getstartname = @$db->getOne("deliverypoint","*","DeliveryPointID = ".@$_SESSION['SSStart']);
				foreach($_SESSION['SSEnd']  as $key =>  $val){ 
					  @$getname = @$db->getOne("deliverypoint","*","DeliveryPointID = ".@$val);
			?>
            	<li id="tabProvinceID<?php echo ($key+1);?>">
                	<a href="#<?php echo @($key+1); ?>" <?php echo (@($key+1)=="1" ? 'class="default-tab"' : '');?>><?php echo @$getstartname['DeliveryPointName']."-".@$getname['DeliveryPointName'];?></a>
                </li> 
            <?PHP 
				} 
			?> 
		</ul>	
		<div class="clear"></div>	
    </div>
    <div class="content-box" style="margin:0;">    
    	<?php 
			foreach($_SESSION['SSEnd']  as $i => $val){
				$i = ($i+1);
				@$getP = @$db->getOne("deliverypoint","*","DeliveryPointID = ".@$val);
		?>  
    	<div class="tab-content <?php echo (@$i=="1" ? 'default-tab' : '');?>" id="<?php echo @$i; ?>">
        	<input type="hidden" name="SendID_<?PHP echo @$i;?>" value="<?php echo  @$sendRes['CustomerID'];?>">
        	<input type="hidden" name="StartPointID_<?PHP echo @$i;?>" value="<?php echo  @$_SESSION['SSStart'];?>">
        	<input type="hidden" name="EndPointID_<?PHP echo @$i;?>" id="EndPointID_<?PHP echo @$i;?>" value="<?php echo  @$val;?>">
        	<table style=" border:1px solid #fff; background:#fff;">
            	<tr>
                	<td colspan="8" style="text-align:right;background:#fff;">
					<input type="button" class="button" onclick="SearchCustomer('Receive','<?PHP echo @$i;?>');" id="buttonReceive_<?php echo @$i;?>" value="<?PHP echo  	"ค้นหาข้อมูลในระบบ";?>" /></td>
                </tr>


                <tr style="background:#fff;">
                    <td><font style="font-size:16px;font-weight:bolder"><?php echo @$lang_set['NameRecv']; ?>:</font>
                    <input type="text" class="text-input" name="ReceiveName_<?PHP echo @$i;?>" id="ReceiveName_<?PHP echo @$i;?>" value="<?php echo @$recvRes[@$i]['CustomerName'];?>" />
                    </td>
                    <td><strong><?php echo @$lang_set['SurNameRecv']; ?>:</strong>
					<input type="text" class="text-input" name="ReceiveSurName_<?PHP echo @$i;?>" id="ReceiveSurName_<?PHP echo @$i;?>" value="<?php echo @$recvRes[@$i]['CustomerSurName'];?>" /></td>

                    <td><strong><?php echo @$lang_set['IdentificationRecv']; ?>:</strong> 
					<input type="text" class="text-input" name="ReceiveIdentification_<?PHP echo @$i;?>" id="ReceiveIdentification_<?PHP echo @$i;?>" value="<?php echo @$recvRes[@$i]['CustomerIdentification'];?>" maxlength="13"/></td>

                    <td><strong><?php echo @$lang_set['telephonenum']; ?>:</strong>
					<input type="text" class="text-input" name="ReceiveTel_<?PHP echo @$i;?>" id="ReceiveTel_<?PHP echo @$i;?>" value="<?php echo @$recvRes[@$i]['CustomerPhon'];?>" maxlength="10" onblur="SearchCustomer1('Receive','<?PHP echo @$i;?>');"/></td>
                 </tr>

            <tr style="background:#fff;">
            	<td colspan="2"><strong><?php echo @$lang_set['Addresssend']; ?>:</strong> 
				<input type="text" class="text-input large-input" name="ReceiveAddress_<?PHP echo @$i;?>" id="ReceiveAddress_<?PHP echo @$i;?>" value="<?php echo @$recvRes[@$i]['CustomerAddress'];?>" /></td>

                <td><strong><?php echo @$lang_set['emp_province']; ?>:</strong>

                  <select  name="ReceiveProvince_<?PHP echo @$i;?>" id="ReceiveProvince_<?PHP echo @$i;?>" onchange="SelectProvince('<?PHP echo @$lang_code;?>','Send','0')" class="widthselect" style="width:170px;">
                    <option value="0">--Select--</option>
                    <?php 
                        if(@$getProvince){
							foreach($getProvince as $key => $val){
                    ?>
                    <option value="<?php echo @$val['PROVINCE_ID'];?>" <?php echo (@$val['PROVINCE_ID']=='' || @$val['PROVINCE_ID']==@$recvRes['CustomerProvince'] ? "selected" : "")?>><?php echo @$val['PROVINCE_NAME'];?></option>
                    <?php 	}
                        }
                    ?>
                </select>
				
				</td>
                <td><strong><?php echo @$lang_set['emp_district']; ?>:</strong>

                <select name="ReceiveDistrict_<?PHP echo @$i;?>"  id="ReceiveDistrict_<?PHP echo @$i;?>"  class="widthselect" style="width:170px;">
                    <option value="0">--Select--</option>
					<?php 
                        if(@$getDistrict){
							foreach($getDistrict as $key => $val){
                    ?>
                        <option value="<?php echo @$val['AMPHUR_ID'];?>" <?php echo (@$val['AMPHUR_ID']=='' || @$val['AMPHUR_ID']==@$recvRes[@$i]['CustomerDistrict'] ? "selected" : "")?>><?php echo @$val['AMPHUR_NAME'];?></option>
                    <?php 	}
                        }
                     ?>						
                      </select>
                
                </td>
              </tr>
            <tr style="background:#fff;">
            	<td><strong><?php echo @$lang_set['tambon']; ?>:</strong> 
				<input type="text" class="text-input" name="ReceiveTambon_<?PHP echo @$i;?>" id="ReceiveTambon_<?PHP echo @$i;?>" value="<?php echo @$recvRes[@$i]['CustomerTambon'];?>" /></td>
                <td><strong><?php echo @$lang_set['postcode']; ?>:</strong> 
				<input type="text" class="text-input" name="ReceivePostCode_<?PHP echo @$i;?>" id="ReceivePostCode_<?PHP echo @$i;?>" value="<?php echo @$recvRes[@$i]['CustomerPostCode'];?>" maxlength="5"/></td>

            	<td><strong><?php echo @$lang_set['hometelephonenum']; ?>:</strong> 
				<input type="text" class="text-input" name="ReceiveHomeTel_<?PHP echo @$i;?>"  id="ReceiveHomeTel_<?PHP echo @$i;?>" value="<?php echo @$recvRes[@$i]['CustomerHomePhon'];?>" maxlength="9" /></td>

                <td><strong><?php echo @$lang_set['customer_phonother']; ?>:</strong> 
				<input type="text" class="text-input" name="ReceiveOtherPhon_<?PHP echo @$i;?>"id="ReceiveOtherPhon_<?PHP echo @$i;?>" value="<?php echo @$recvRes[@$i]['CustomerOtherPhon'];?>"  /></td>
            </tr>

                <tr style="background:#fff;">

                    <td><strong><?php echo @$lang_set['Dalivary']; ?>:</strong>
					<input type="checkbox" name="Agent" onclick="ShowDalivary('<?PHP echo @$i;?>');" disabled="disabled"/><input type="hidden" value="0" id="CheckDalivary_<?PHP echo @$i;?>" name="CheckDalivary_<?PHP echo @$i;?>" /></td>

                    <td>&nbsp;</td>
                </tr>
            </table>

		<!--##############Parcel Information Send ######################-->

           <div class="content-box" id="ShowDalivary_<?PHP echo @$i;?>" <?PHP if(@$recvRes[@$i]['CheckDalivary'] == 0){echo 'style="display:none"';}?>>
            <table>
            	<tr style="background:#F3F3F3;">
                    <td><label><?php echo @$lang_set['Villa']; ?>:</label></td>
                    <td><label><?php echo @$lang_set['Roomnum']; ?>:</label></td>
                    <td><label><?php echo @$lang_set['Floor']; ?>:</label></td>
                    <td><label><?php echo @$lang_set['Homenum']; ?>:</label></td>
                    <td><label><?php echo @$lang_set['Muu']; ?>:</label></td>
                    <td><label><?php echo @$lang_set['Zoy']; ?>:</label></td>
                    <td><label><?php echo @$lang_set['Rode']; ?>:</label></td>
                    <td>&nbsp;</td>
                </tr>
            	<tr style="background:#fff;">
                	<td>
                      	<input type="text" class="text-input large-input" name="Villa_<?PHP echo @$i;?>" 
                        id="Villa_<?PHP echo @$i;?>" />
                    </td>
                    <td>
                      	<input type="text" class="text-input large-input" name="Room_<?PHP echo @$i;?>" 
                        id="Room_<?PHP echo @$i;?>"  />
                    </td>
                    <td>
                      	<input type="text" class="text-input large-input" name="Floor_<?PHP echo @$i;?>" 
                        id="Floor_<?PHP echo @$i;?>"  />
                    </td>
                    <td>
                      	<input type="text" class="text-input large-input" name="Home_<?PHP echo @$i;?>" 
                        id="Home_<?PHP echo @$i;?>"  />
                    </td>
                    <td>
                      	<input type="text" class="text-input large-input" name="Muu_<?PHP echo @$i;?>" 
                        id="Muu_<?PHP echo @$i;?>"  />
                    </td>
                    <td>
                      	<input type="text" class="text-input large-input" name="Zoy_<?PHP echo @$i;?>" 
                        id="Zoy_<?PHP echo @$i;?>"  />
                    </td>
                    <td>
                      	<input type="text" class="text-input large-input" name="Rode_<?PHP echo @$i;?>" 
                        id="Rode_<?PHP echo @$i;?>"  />
                    </td>
                <tr>

                <tr style="background:#fff;">
                    <td style="text-align:right"><strong><?php echo @$lang_set['emp_province']; ?>:</strong></td>
                    <td>
                      	<select  name="ReceiveProvince<?PHP echo @$i;?>" id="ReceiveProvince<?PHP echo @$i;?>" onchange="SelectProvince('<?PHP echo @$lang_code;?>','Receive','<?PHP echo @$i;?>')" class="widthselect">
                        <option value="0">--Select--</option>
							<?php 
                            if(@$getProvince){
								foreach($getProvince as $key => $val){
                            ?>
                        	<option value="<?php echo @$val['PROVINCE_ID'];?>" <?php echo (@$val['PROVINCE_ID']=='' || @$val['PROVINCE_ID']==@$recvRes[@$i]['CustomerProvince'] ? "selected" : "")?>><?php echo @$val['PROVINCE_NAME'];?></option>
							<?php }
                            }
                            ?>						
                      </select>
                    </td>
                    <td style="text-align:right"><strong><?php echo @$lang_set['emp_district']; ?>:</strong></td>
                     <td>
                      	<select name="ReceiveDistrict<?PHP echo @$i;?>" id="ReceiveDistrict<?PHP echo @$i;?>" class="widthselect">
                        <option value="0">--Select--</option>
							<?php 
                            if(@$getDistrict){
								foreach($getDistrict as $key => $val){
                            ?>
                        	<option value="<?php echo @$val['AMPHUR_ID'];?>" <?php echo (@$val['AMPHUR_ID']=='' || @$val['AMPHUR_ID']==@$recvRes[@$i]['CustomerDistrict']  ? "selected" : "")?>><?php echo @$val['AMPHUR_NAME'];?></option>
							<?php }
                            }
                            ?>						
                      </select>
                    </td>
                    <td style="text-align:right"><strong><?php echo @$lang_set['tambon']; ?>:</strong></td>
                    <td>
                          <input type="text" class="text-input large-input" name="ReceiveTambon_<?PHP echo @$i;?>" id="ReceiveTambon_<?PHP echo @$i;?>" 
                          value="<?php echo @$recvRes[@$i]['CustomerTambon'];?>"/>
                    </td>
                    <td style="text-align:right"><label><?php echo @$lang_set['postcode']; ?>:</label></td>
                    <td>
                          <input type="text" class="text-input medium-input" name="ReceivePostCode_<?PHP echo @$i;?>" id="ReceivePostCode_<?PHP echo @$i;?>" 
                          value="<?php echo @$recvRes[@$i]['CustomerPostCode'];?>" maxlength="5"/>
                    </td>
                </tr>
            </table>
            </div>
            
                       
 <!--#########################ListItem######################################################################-->
 		<script type="text/javascript">
		function addrow(tid){
			//$('#mytbl_'+tid+' tbody tr').last().clone().appendTo('#mytbl_'+tid+' tbody');
			var table = document.getElementById('mytbl_'+tid);
			var rowCount = table.rows.length;
			//alert(rowCount);
			$('#mytbl_'+tid).append('<tr><td>'+(rowCount-1)+'</td><td><select  name="ProductName_'+tid+'[]" id="ProductName_'+tid+'_'+(rowCount-1)+'" class="widthselect " onblur="ProcessPrice(\''+tid+'\',\'<?PHP echo @$getP['DeliveryPointID'];?>\','+(rowCount-1)+')" onchange="ProcessPrice('+tid+',\'<?PHP echo @$getP['DeliveryPointID'];?>\','+(rowCount-1)+')"><option value="0">--ประเภท--</option><?php if(@$getproducttype){foreach($getproducttype as $key => $val){ ?><option value="<?php echo @$val['ProductTypeName'];?>" <?php echo (@$val['ProductTypeName']=='' || @$val['ProductTypeName']==@$sendRes['ProductTypeName'] ? "selected" : "")?>><?php echo @$val['ProductTypeName'];?></option><?php 	}}?></select></td><td><input type="text" class="text-input large-input" name="ProductDetail_'+tid+'[]" id="ProductDetail_'+tid+'_'+(rowCount-1)+'"  value="<?php echo @$arrRes['ProductDetail'];?>" /></td><td><select  name="ProductSize_'+tid+'[]" id="ProductSize_'+tid+'_'+(rowCount-1)+'" class="widthselect " onblur="ProcessPrice(\''+tid+'\',\'<?PHP echo @$getP['DeliveryPointID'];?>\','+(rowCount-1)+')" onchange="ProcessPrice('+tid+',\'<?PHP echo @$getP['DeliveryPointID'];?>\','+(rowCount-1)+')"><option value="0">--ขนาด--</option><?php if(@$getsetupsize){foreach($getsetupsize as $key => $val){?><option value="<?php echo @$val['SetupSizeID'];?>" <?php echo (@$val['SetupSizeID']=='' || @$val['SetupSizeID']==@$sendRes['SetupSizeID'] ? "selected" : "")?>><?php echo @$val['SetupSizeSize'];?></option><?php } }?></select></td><td><input type="text" class="text-input large-input" name="ProductWeight_'+tid+'[]" id="ProductWeight_'+tid+'_'+(rowCount-1)+'"  value="<?php echo (@$arrRes['ProductWeight'] ? @$arrRes['ProductWeight'] : 0);?>" style="width:50px" onkeyup="ProcessPrice('+tid+',\'<?PHP echo @$getP['DeliveryPointID'];?>\','+(rowCount-1)+')" onkeydown="ProcessPrice('+tid+',\'<?PHP echo @$getP['DeliveryPointID'];?>\','+(rowCount-1)+')"/></td><td><input type="text" class="text-input large-input" name="Saleper_'+tid+'[]" id="Saleper_'+tid+'_'+(rowCount-1)+'" value="<?php echo @$sendtype['CustomerTypeDiscount'];?>" onkeyup="ProcessPrice(\''+tid+'\',\'<?PHP echo @$getP['DeliveryPointID'];?>\','+(rowCount-1)+')" onkeydown="ProcessPrice(\''+tid+'\',\'<?PHP echo @$getP['DeliveryPointID'];?>\','+(rowCount-1)+')" /></td><td><input type="text" class="text-input large-input" name="totalmoney_'+tid+'[]" id="totalmoney_'+tid+'_'+(rowCount-1)+'" value="<?php echo (@$arrRes['totalmoney'] ? @$arrRes['totalmoney'] : 0);?>"  onkeyup="ProcessPrice(\''+tid+'\',\'<?PHP echo @$getP['DeliveryPointID'];?>\','+(rowCount-1)+')"/></td><td align="middle" width="3%"><button class="button" onclick="javascript:doRemoveItem(this,\''+tid+'\');" style="width:25px;">-</button></td></tr>');
		
		}
        </script>
		<p></p>






        <div class="content-box">
		<div class="content-box-header">
        	<h3 style="color:#FF0000"><?php echo @$lang_set['recvdetailproduct']; ?></h3>	
        </div>
        <!--<input type="hidden" name="ProductName_<?PHP echo @$i;?>[]" id="ProductName_<?PHP echo @$i;?>[]" disabled="disabled" />
        <input type="hidden" name="ProductDetail_<?PHP echo @$i;?>[]" id="ProductDetail_<?PHP echo @$i;?>[]" disabled="disabled" />
        <input type="hidden" name="ProductSize_<?PHP echo @$i;?>[]" id="ProductSize_<?PHP echo @$i;?>[]" disabled="disabled" />
        <input type="hidden" name="ProductWeight_<?PHP echo @$i;?>[]" id="ProductWeight_<?PHP echo @$i;?>[]" disabled="disabled" />
        <input type="hidden" name="Saleper_<?PHP echo @$i;?>[]" id="Saleper_<?PHP echo @$i;?>[]" disabled="disabled" />
         <input type="hidden" name="totalmoney_<?PHP echo @$i;?>[]" id="totalmoney_<?PHP echo @$i;?>[]" disabled="disabled" />-->
			<table id="mytbl_<?php echo @$i;?>" width="100%">
            	<thead>
            		<tr>
                        <th width="10">ลำดับ</th>
                        <th align="left"><?php echo @$lang_set['NameProduct']; ?></th>
                        <th align="left"><?php echo @$lang_set['DetailProduct']; ?></th>
                        <th align="left"><?php echo @$lang_set['SizeProducr']; ?></th>
                        <th align="left"><?php echo @$lang_set['WeightProduct']; ?></th>
                        <th align="left"><?php echo @$lang_set['Sale']."%"; ?></th>
                        <th align="left"><?php echo @$lang_set['Price/Unit']; ?></th>
                        <th><button type="button" class="button" id="add_item" style="width:25px;" onclick="javascript:addrow(<?php echo @$i;?>);">+</button></th>
                	<tr>
                </thead>
                <tbody>
              	<tr>
                	<td>1</td>
					<td>
                    	<select  name="ProductName_<?PHP echo @$i;?>[]" id="ProductName_<?PHP echo @$i;?>_1" class="widthselect" onchange="ProcessPrice('<?PHP echo @$i;?>','<?PHP echo @$getP['DeliveryPointID'];?>',1)">
                        <option value="0">--ประเภท--</option>
					<?php 
                        if(@$getproducttype){
							foreach($getproducttype as $key => $val){
                    ?>
                        <option value="<?php echo @$val['ProductTypeName'];?>" <?php echo (@$val['ProductTypeName']=='' || @$val['ProductTypeName']==@$sendRes['ProductTypeName'] ? "selected" : "")?>><?php echo @$val['ProductTypeName'];?></option>
                    <?php 	}
                        }
                    ?>						
                      </select>
                      <input type="hidden" name="ProductCount_<?PHP echo @$i;?>[]" id="ProductCount_<?PHP echo @$i;?>[]" />
                    </td>
					
					<td>  
                      <input type="text" class="text-input large-input" name="ProductDetail_<?PHP echo @$i;?>[]" id="ProductDetail_<?PHP echo @$i;?>_1"  value="<?php echo @$arrRes['ProductDetail'];?>" />
                    </td>
					
					<td>
                      <select  name="ProductSize_<?PHP echo @$i;?>[]" id="ProductSize_<?PHP echo @$i;?>_1" class="widthselect " onblur="ProcessPrice('<?PHP echo @$i;?>','<?PHP echo @$getP['DeliveryPointID'];?>',1)" onchange="ProcessPrice('<?PHP echo @$i;?>','<?PHP echo @$getP['DeliveryPointID'];?>',1)">
                      <option value="0">--ขนาด--</option>
					<?php 
                        if(@$getsetupsize){
							foreach($getsetupsize as $key => $val){
                    ?>
                        <option value="<?php echo @$val['SetupSizeID'];?>" <?php echo (@$val['SetupSizeID']=='' || @$val['SetupSizeID']==@$sendRes['SetupSizeID'] ? "selected" : "")?>><?php echo @$val['SetupSizeSize'];?></option>
                    <?php 	}
                        }
                    ?>						
                      </select>
                    </td>
					
					<td>  
                      <input type="text" class="text-input large-input" name="ProductWeight_<?PHP echo @$i;?>[]" id="ProductWeight_<?PHP echo @$i;?>_1"  value="<?php echo (@$arrRes['ProductWeight'] ? @$arrRes['ProductWeight'] : 0);?>" style="width:50px',1)"/>
                    </td>
					
					<td>
                      <input type="text" class="text-input large-input" name="Saleper_<?PHP echo @$i;?>[]" id="Saleper_<?PHP echo @$i;?>_1" value="<?php echo @$sendtype['CustomerTypeDiscount'];?>" />
                    </td>
					
					<td>
                      <input type="text" class="text-input large-input" name="totalmoney_<?PHP echo @$i;?>[]" id="totalmoney_<?PHP echo @$i;?>_1" value="<?php echo (@$arrRes['totalmoney'] ? @$arrRes['totalmoney'] : 0);?>"/>
                    </td>
					
					<td align="middle" width="3%">
                    	<button class="button" onclick="javascript:doRemoveItem(this,<?php echo @$i;?>);" style="width:25px;">-</button>
                    </td>

               </tr>
           </tbody>
       </table>
	</div>
    	</div>
	<?PHP @$i++;} ?> 
</div>
    <div style="text-align: right;font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px;">
    	<input type="submit" class="button" value="<?php echo @$lang_set['submit']; ?>" />
    </div>
                     
</form>
<?php }?>

 <div id="dialog" style="display:none" title="รายการค้นหา">

</div>

<?PHP if(is_array(@$_SESSION['SSEnd'])){?>
<script type="text/javascript">
$('#ReceiveName_1').focus();
</script> 
<?PHP }else{?>
<script type="text/javascript">
$('#SendName').focus();
</script>
<?PHP }?>
<script type="text/javascript">
function addropdown(){	
	/*if($('#tbln tr td').size() < 4){		   
	    $('#tbln tr td').last().clone().appendTo('#tbln tr');
	}else{
		alert('ไม่อนุญาติให้เพิ่มเกินกว่านี้ได้')
	}*/
	//var table = document.getElementById('tbln2');
	var rowCount = $('#tbln tr:first td').length;
	if(rowCount < 4){	
		$('#tbln tr:first').append('<td style="width:150px; text-align:left;"><select name="ProvinceRoute[]" id="ProvinceRoutes'+(rowCount+1)+'" onchange="SelectProviceRoute(\'<?PHP echo @$setjava?>\',\'<?PHP echo @$lang_code;?>\','+(rowCount+1)+',options[selectedIndex].value)" style=" width:119px;"><option value="0">--Select--</option><?php if(@$getproviceroute){foreach($getproviceroute as $key => $val){?><option value="<?php echo @$val['PROVINCE_ID'];?>" <?php echo (@$val['PROVINCE_ID']=='' || @$val['PROVINCE_ID']==@$sendRes['CustomerProvince'] ? "selected" : "")?>><?php echo @$val['PROVINCE_NAME'];?></option> <?php }}?></select><br/><select name="EndPoint[]" id="EndPoint'+(rowCount+1)+'" style=" width:119px;"><option value="0">--Select--</option></select><input type="button" class="button" onclick="javascript:RemoveItem(this,'+(rowCount+1)+');" style="width:25px;" value="-"></td>');
	}else{
		alert('ไม่อนุญาติให้เพิ่มเกินกว่านี้ได้')
	}
}
function RemoveItem(obj,id){
	var rowCount = $('#tbln tr:first td').length;
    if(rowCount > 1){
       if(confirm('ต้องการลบ list นี้')) $(obj).parent().remove();
	   document.formss.submit();
	   $("#tabProvinceID"+id).hide();
    }else{
       alert('ไม่อนุญาตให้ลบแถวที่เหลือนี้ได้');
	}
}


function doRemoveItem(obj,tid){
	if($('#mytbl_'+tid+' tbody tr').size() > 1){
    	if(confirm('คุณต้องการลบแถวนี้?')) $(obj).parent().parent().remove();
    }else{
        alert('ไม่อนุญาตให้ลบแถวที่เหลือนี้ได้');
   	}
}
</script> 
<!-- Scrip Java-->

Youez - 2016 - github.com/yon3zu
LinuXploit