text: CREATE DEFINER=`neon-user`@`117.247.87.156` PROCEDURE `prc_insertPayments`(
  	IN `p_CompanyID` INT,
  	IN `p_ProcessID` VARCHAR(100),
  	IN `p_UserID` INT
  
  
  )
  BEGIN
  
  	
  	DECLARE v_UserName varchar(30);
   	
   	SELECT CONCAT(u.FirstName,CONCAT(' ',u.LastName)) as name into v_UserName from NeonRMDev.tblUser u where u.UserID=p_UserID;
   	
   	INSERT INTO tblPayment (
  	 		CompanyID,
  	 		 AccountID,
  			 InvoiceNo,
  			 PaymentDate,
  			 PaymentMethod,
  			 PaymentType,
  			 Notes,
  			 Amount,
  			 CurrencyID,
  			 Recall,
  			 `Status`,
  			 created_at,
  			 updated_at,
  			 CreatedBy,
  			 ModifyBy,
  			 RecallReasoan,
  			 RecallBy,
  			 BulkUpload,
  			 InvoiceID
  			 )
   	select tp.CompanyID,
  	 		 tp.AccountID,
  			 COALESCE(tp.InvoiceNo,''),
  			 tp.PaymentDate,
  			 tp.PaymentMethod,
  			 tp.PaymentType,
  			 tp.Notes,
  			 tp.Amount,
  			 ac.CurrencyId,
  			 0 as Recall,
  			 tp.Status,
  			 Now() as created_at,
  			 Now() as updated_at,
  			 v_UserName as CreatedBy,
  			 '' as ModifyBy,
  			 '' as RecallReasoan,
  			 '' as RecallBy,
  			 1 as BulkUpload,
  			 InvoiceID
  	from tblTempPayment tp
  	INNER JOIN NeonRMDev.tblAccount ac 
  		ON  ac.AccountID = tp.AccountID  and ac.AccountType = 1 and ac.CurrencyId IS NOT NULL
  	where tp.ProcessID = p_ProcessID
  			AND tp.PaymentDate <= NOW()
  			AND tp.CompanyID = p_CompanyID;
  			
  	
  			
  	 delete from tblTempPayment where CompanyID = p_CompanyID and ProcessID = p_ProcessID;
  	 
  			
  END