/** SALE PAYMENT RECYCLE *********************************************/
UPDATE tbl_payment_sale AS p SET p.payment_date_time = '2022-06-08'
WHERE sale_id IN (SELECT sale_id 
                  FROM tbl_sale AS s
                  WHERE DATE(s.sale_date) = '2022-06-08'
                  AND s.store_code = 001
                  AND sale_status = 'CLOSED'
                 );

UPDATE tbl_recycle_sale AS r SET r.recycle_date_weight = '2022-06-08'
WHERE sale_id IN (SELECT sale_id
                  FROM tbl_sale AS s
                  WHERE DATE(s.sale_date) = '2022-06-08'
                  AND s.store_code = 001
                  AND sale_status = 'CLOSED'
                 );
/*********************************************************************/


/** SALE PAYMENT RECYCLE SALE_ID *************************************/
UPDATE tbl_payment_sale AS p SET p.payment_date_time = '2022-05-31'
WHERE sale_id IN (SELECT sale_id 
                  FROM tbl_sale AS s
                  WHERE sale_id = 97109
                 );

UPDATE tbl_recycle_sale AS r SET r.recycle_date_weight = '2022-06-01'
WHERE sale_id IN (SELECT sale_id
                  FROM tbl_sale AS s
                  WHERE sale_id = 97109
                 );
/*********************************************************************/

/** SALE STATUS ******************************************************/
UPDATE tbl_sale SET sale_status = 'OPENED'
WHERE store_code = 001 
AND DATE(sale_date) = '2022-06-08'
AND sale_status = 'SK_WAITING';
/*********************************************************************/