$return_hist['return_id'] = $data_return['return_id'];
 $return_hist['invoice_id'] = $invoice_id;
 $return_hist['invoice_no'] = $data_return['invoice_no'];
 $return_hist['jng_sp_orders_items_id'] = $data_return['jng_sp_orders_items_id'];
 $joid_arr[] = $data_return['jng_sp_orders_items_id'];
 $rid_arr[] = $data_return['return_id'];
 $id_arr[] = $data_return['id'];
 $pr_arr[] = $data_return['pr'];
 $no_arr[] = $data_return['no'];
 $de_arr[] = $data_return['de'];
 $va_arr[] = $data_return['va'];
 $return_hist['txid'] = $data_return['txid'];
 $return_hist['status'] = $data_return['status'];
 $return_hist['sequencenumber'] = $nextsequencenumber;
 $return_hist['currency'] = $data_return['currency'];
 if ($class_pi->getReceivable() == 0) {
     //REFUND
     if ($is_sp) {
         $customer_bankdata = $class_jcust->getBankAccountData($data_return['jng_sp_customers_id']);
     } else {
         $customer_bankdata = $class_cust->getBankAccountData($class_pi->detail['invoice_order_id']);
     }
     if (!is_null($customer_bankdata)) {
         if ($is_sp) {
             $return_hist['bankcode'] = str_replace(' ', '', $customer_bankdata['bank_code']);
             $return_hist['bankcountry'] = $customer_bankdata['bank_country'];
             $return_hist['bankaccount'] = $customer_bankdata['bank_account_number'];
             $return_hist['bankaccountholder'] = $customer_bankdata['bank_account_holder'];
         } else {
             $return_hist['bankcode'] = str_replace(' ', '', $customer_bankdata['banktransfer_blz']);
             if (strlen($customer_bankdata['banktransfer_bankname']) == 2 && strtoupper($customer_bankdata['banktransfer_bankname']) == $customer_bankdata['banktransfer_bankname']) {