clo_branch_closing.sql 1021 B

12345678910111213141516171819202122232425262728293031323334353637
  1. -- truncate table dbr_pos_closing;
  2. drop procedure if exists clo_branch_closing;
  3. DELIMITER //
  4. create procedure clo_branch_closing( _curr_date varchar(8), _branch int, _user int)
  5. SQL SECURITY INVOKER
  6. BEGIN
  7. Declare _sales_day decimal(20,4) default "0.0000";
  8. Declare _ccard_day decimal(20,4) default "0.0000";
  9. Declare _cash_day decimal(20,4) default "0.0000";
  10. Declare _coupon_day decimal(20,4) default "0.0000";
  11. Declare _reward_day decimal(20,4) default "0.0000";
  12. Declare _discount_day decimal(20,4) default "0.0000";
  13. Declare _sorder_cnt int;
  14. Declare _sorder_new int;
  15. Declare _revisit_cnt int;
  16. Declare _log_token varchar(21);
  17. Declare _seq_no int;
  18. set _seq_no = 0;
  19. set _log_token = SUBSTR(MD5(RAND()), 1, 21);
  20. call clo_pos_closing(_curr_date, _branch, _user);
  21. -- _seq_no = _seq_no + 1;s
  22. insert into log_procedure_run
  23. ( log_token, token_seq_no, calling_procedure, procedure_name)
  24. values ( _log_token, _seq_no, 'clo_branch_closing', 'clo_pos_closing');
  25. END; //
  26. DELIMITER ;
  27. call clo_branch_closing('20220815', 1, 5);