clo_branch_closing.sql 1000 B

123456789101112131415161718192021222324252627282930313233343536
  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. BEGIN
  6. Declare _sales_day decimal(20,4) default "0.0000";
  7. Declare _ccard_day decimal(20,4) default "0.0000";
  8. Declare _cash_day decimal(20,4) default "0.0000";
  9. Declare _coupon_day decimal(20,4) default "0.0000";
  10. Declare _reward_day decimal(20,4) default "0.0000";
  11. Declare _discount_day decimal(20,4) default "0.0000";
  12. Declare _sorder_cnt int;
  13. Declare _sorder_new int;
  14. Declare _revisit_cnt int;
  15. Declare _log_token varchar(21);
  16. Declare _seq_no int;
  17. set _seq_no = 0;
  18. set _log_token = SUBSTR(MD5(RAND()), 1, 21);
  19. call clo_pos_closing(_curr_date, _branch, _user);
  20. -- _seq_no = _seq_no + 1;s
  21. insert into log_procedure_run
  22. ( log_token, token_seq_no, calling_procedure, procedure_name)
  23. values ( _log_token, _seq_no, 'clo_branch_closing', 'clo_pos_closing');
  24. END; //
  25. DELIMITER ;
  26. call clo_branch_closing('20220815', 1, 5);