Quote - Deal Sync and Automation Rules

Quote - Deal Sync and Automation Rules

Hi everyone, 

I have a couple of questions about Quote and Deal sync. When I create a quote and insert the amount, products, etc, I want to refresh the deal's amount with the amount of the quote. I also want quotes to refresh products in Accounts regarding products offered in the quote. 

On the other hand, when the quote is not accepted by my customers and needs to be revised, I want it to create a new quote and refresh the deal amount and products again, accordingly. 

How can I do that? How can I create a custom function here? 

Here's my workflow: 
   

In written; 
Creating a quote -> Sending it with Zoho Sign -> AUTOMATION - Replacing the appropriate deal's amount with a quote's amount -> AUTOMATION - Replating the deals products with a quote's products -> When a sale is closed -> Replace sum of deals' amounts to invoice amount 

When the sale is not closed, -> Creating a new quote -> Replacing the previous deal's amount with quote's amount -> Replacing the previous product's base with new quote's product list.