<?php

include('includes/session.inc');


			
			   
$sql4011 =  "SELECT id,account_number
			FROM debtortrans
			WHERE department ='11'
			";
	$ErrMsg = _('This customer could not be added because');
			$result4011 = DB_query($sql4011,$ErrMsg);
	while ($myrow4011 = DB_fetch_array($result4011) ){
		
				   
$sql =  "SELECT debtorno
			FROM debtoraccount
			
			WHERE account_number = '" . $myrow4011['account_number']. "'
			";
	$ErrMsg = _('This customer could not be added because');
			$result = DB_query($sql,$ErrMsg);
	$myrow = DB_fetch_array($result) ;

		$debtorno = $myrow['debtorno'];

		
		
		
		$SQL20 = "UPDATE  debtortrans set 									
									debtorno = '" . $debtorno . "'

									where id = '" . $myrow4011['id'] . "'
									";

	

		$ErrMsg = _('Cannot update debtors in debtor trans because');

		$DbgMsg = _('debtortrans debtor column update error');

		$result20 = DB_query($SQL20,$ErrMsg,$DbgMsg,true);
		
	}

		
	

	
	
?>
