<?php
include("db.php");
  
  echo $openingBalance_sql="select * from customeropeningbalance";
  $openingBalance_query= $db ->query($openingBalance_sql);
  while($openingBalance_row=$openingBalance_query ->fetch_array()){
    
	 $reference='بلانس افتتاحیه';
	 $transaction_id=$openingBalance_row['id'];
	 $customerId=$openingBalance_row['customerId'];
	 $currency_id=$openingBalance_row['currencyId'];
	 $amount=$openingBalance_row['amount'];
	 $date=$openingBalance_row['date'];
	 if($amount>0){
	    $transaction_type=1;
	 }
     if($amount<0){
	    $transaction_type=2;
		$amount=-$amount;
	 }
     $description='الباقی';
  
  
    $insert_sql="insert into customer_statement (reference,transaction_id,customerId,currency_id,amount,date,transaction_type,description)  values 
	
	('$reference','$transaction_id','$customerId','$currency_id','$amount','$date','$transaction_type','$description')";
   
    $insert_query= $db ->query($insert_sql);
	
  }
  
?>











