DROP PROCEDURE if EXISTS sp_alm_customer_list;

DELIMITER $$
CREATE  PROCEDURE `sp_alm_customer_list`(IN `id_sale` VARCHAR(50))
    NO SQL
BEGIN

SELECT name, cf1, cf2, customers_type_id
FROM tec_sales s
LEFT JOIN tec_customers c ON c.id = s.customer_id
WHERE s.id = id_sale;

END$$
DELIMITER ;

DELIMITER $$
CREATE  PROCEDURE `sp_alm_envioguiaremision_registrar`(IN `referral_guide_idP` INT, IN `issue_dateP` VARCHAR(50), IN `file_nameP` VARCHAR(50), IN `flg_responseP` INT, IN `error_codeP` VARCHAR(50), IN `response_descripP` VARCHAR(1000), IN `status_grP` INT, IN `user_CreateP` INT, IN `date_CreateP` VARCHAR(50), IN `estadoP` INT)
    NO SQL
BEGIN

INSERT INTO tec_send_invoice_gr (referral_guide_id, issue_date, 
                                  file_name, flg_response, error_code, 
                                  response_descrip, status, 
                                  user_Create, date_Create, estado) VALUES (referral_guide_idP, issue_dateP, file_nameP, 
                                  flg_responseP, error_codeP, response_descripP, 
                                  status_grP, user_CreateP, date_CreateP, 
                                  estadoP
                                  );

END$$
DELIMITER ;