
--
-- Dumping routines for database 'ebillingappdtls'
--
/*!50003 DROP PROCEDURE IF EXISTS `sp_AddtoCart_OneProduct` */;
DELIMITER ;;
CREATE  PROCEDURE `sp_AddtoCart_OneProduct`(IN `intProductID` INT, IN `intCustomerID` BIGINT, IN `intOrderID` BIGINT, IN `intQty` INT, IN `intUserID` INT)
BEGIN
DECLARE intStoreID,intProdCat,intProdSubCat,intPseudoStock,isOrderDetailsPresent,isProductDetailsPresent INT;
DECLARE fProdOfferPrice,fProdClubPrice,fIGSTPer,fCGSTPer,fSGSTPer float;
DECLARE fPriceP,fRate,fCGST,fSGST,fIGST FLOAT;
DECLARE isCustomerClubMember VARCHAR(10);

SET intStoreID = 0; SET intProdCat = 0; SET intProdSubCat = 0;set intPseudoStock = 0; set isOrderDetailsPresent =0; SET isProductDetailsPresent =0;
SET fProdOfferPrice = 0;SET fProdClubPrice = 0;SET fIGSTPer = 0;SET fCGSTPer = 0;SET fSGSTPer = 0;
SET fPriceP =0; set fRate = 0; set fCGST = 0; set fSGST =0; set fIGST = 0;

select adm_store INTO intStoreID from karloff_admin where id = intUserID;

  CALL `sp_getCustomerClubMemberDetails`(intCustomerID,isCustomerClubMember);
  
select ProductOfferprice,ProductClubprice,PseudoStock,ProductIgst,ProductCgst,ProductSgst,
ProductCategory,ProductSubcategoryL1 into fProdOfferPrice,fProdClubPrice,intPseudoStock,
fIGSTPer,fCGSTPer,fSGSTPer,intProdCat,intProdSubCat	

from karloff_productdb where id = intProductID;
			 
		IF (isCustomerClubMember = 'Yes') THEN
		  SET fPriceP = fProdClubPrice;
		ELSE
		 SET fPriceP = fProdOfferPrice;
		END IF;
		
		   
set fPriceP = (fPriceP * intQty);
-- set fRate = (fPriceP * intQty);
set fCGST = (fPriceP * (fCGSTPer/100));
set fSGST = (fPriceP * (fSGSTPer/100));
set fIGST = (fPriceP * (fIGSTPer/100));

set fRate = (fPriceP -(fCGST + fSGST + fIGST));


SELECT Count(ID) into isProductDetailsPresent FROM karloff_weborder_details WHERE order_id = intOrderID and product_id = intProductID;

IF (isProductDetailsPresent > 0) THEN

 UPDATE karloff_weborder_details SET BaseValue = (BaseValue + fRate),CgstAmount = (CgstAmount + fCGST),SgstAmount = (SgstAmount + fSGST),
 IgstAmount = (IgstAmount + fIGST), qty = (qty + intQty)  
  WHERE order_id = intOrderID and product_id = intProductID;

ELSE
 INSERT INTO `karloff_weborder_details`(`order_id`,`customer_id`,`product_id`,`product_category_id`,`product_subcategory_id`,`BaseValue`,`CgstAmount`,
`SgstAmount`,`IgstAmount`,`qty`,`net_amount`,`updated_at`,`created_at`)
VALUES(intOrderID,intCustomerID,intProductID,intProdCat,intProdSubCat,fRate,fCGST,fSGST,fIGST,intQty,fPriceP,CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());

END IF;


SELECT Count(ID) into isOrderDetailsPresent FROM karloff_weborder WHERE order_id = intOrderID;

	IF (isOrderDetailsPresent > 0) THEN
				
		update karloff_weborder set BaseValue = (BaseValue + fRate),CgstAmount = (CgstAmount + fCGST), 
		SgstAmount = (SgstAmount + fSGST),IgstAmount = (IgstAmount + fIGST),InvoiceAmount = (InvoiceAmount + fPriceP),
		NetAmount = (NetAmount + fPriceP)
		where order_id = intOrderID;
		
		
	ELSE
       INSERT INTO `karloff_weborder`(`storeId`,`order_id`,`customer_id`,`BaseValue`,`CgstAmount`,`SgstAmount`,`IgstAmount`,`InvoiceAmount`,
		`NetAmount`,`order_status`,`order_date`,`updated_at`,`created_at`)
		VALUES(intStoreID,intOrderID,intCustomerID,fRate,fCGST,fSGST,fIGST,fPriceP,fPriceP,7,Current_Date(),CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());
	END IF;


 CALL sp_UpdatePsudoProductStock(intProductID,intQty,intOrderID,1);

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_AddtoCart_OneProduct_main` */;
DELIMITER ;;
CREATE  PROCEDURE `sp_AddtoCart_OneProduct_main`(IN `intProductID` INT, IN `intCustomerID` VARCHAR(200), IN `intOrderID` VARCHAR(200), IN `intQty` INT, IN `intUserID` INT)
BEGIN

call sp_AddtoCart_OneProduct(intProductID,intCustomerID,intOrderID,intQty,intUserID);

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_generateInvoice_details` */;
DELIMITER ;;
CREATE  PROCEDURE `sp_generateInvoice_details`(IN `intCardAmount` INT, IN `intCashAmount` INT, IN `intPaytemAmount` INT, IN `intOnlineAmount` INT, IN `intUserID` INT, IN `intOrderID` BIGINT)
BEGIN
DECLARE intCurrentMaxInvoiveID,intNewInvoiveID,intTHISInvoiveIDPresent,intStoreID,intNetAmount INT;

set intCurrentMaxInvoiveID =0; set intNewInvoiveID =0;set intTHISInvoiveIDPresent =0;set intStoreID=0;set intNetAmount =0;

select MAX(invoice_id) into intCurrentMaxInvoiveID from karloff_invoice_master;
SET intNewInvoiveID = (intCurrentMaxInvoiveID + 1);
select COUNT(id) into intTHISInvoiveIDPresent from karloff_invoice_master where invoice_id = intNewInvoiveID;
IF (intTHISInvoiveIDPresent > 0) THEN
	SET intNewInvoiveID = (intNewInvoiveID + 1);
END IF;

select adm_store INTO intStoreID from karloff_admin where id = intUserID;
select NetAmount INTO intNetAmount from karloff_weborder where order_id = intOrderID;


INSERT INTO `karloff_invoice_master`(`invoice_id`,`order_id`,`customer_id`,`delivery_charge`,`GoCashPay`,`Promocode`,`PromocodeDiscount`,`PromoDiscBasePrice`,`PromoDiscGST`,
`CouponCodeTotalDiscount`,`CashbackTotalDiscount`,`discount_amount`,`RedeemAmount`,`BaseValue`,`CgstAmount`,`SgstAmount`,`IgstAmount`,`InvoiceAmount`,`NetAmount`,
`round_off_amount`,`order_status`,`payment_code`,`InvoiceDate`,`order_receive_date`,`order_receive_datetime`,`delivery_date`,`sale_point`,`sales_person`,
`sale_type`,`updated_at`,`created_at`) 
SELECT intNewInvoiveID,`order_id`,`customer_id`,`delivery_charge`,`GoCashPay`,`Promocode`,`PromocodeDiscount`,`PromoDiscBasePrice`,`PromoDiscGST`,
`CouponCodeTotalDiscount`,`CashbackTotalDiscount`,`discount_amount`,`RedeemAmount`,`BaseValue`,`CgstAmount`,`SgstAmount`,`IgstAmount`,`InvoiceAmount`,`NetAmount`,
`round_off_amount`,`order_status`,`payment_code`,Current_Date(),`order_date`,`order_datetime`,Current_Date(),intStoreID,intUserID,3,CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP()
 FROM `karloff_weborder` WHERE order_id = intOrderID;

UPDATE `karloff_invoice_master` SET order_status = 5 WHERE order_id = intOrderID;
UPDATE `karloff_weborder` SET order_status = 5 WHERE order_id = intOrderID;

INSERT INTO `karloff_invoice_details`(`invoice_id`,`order_id`,`customer_id`,`product_id`,`product_category_id`,`product_subcategory_id`,`CgstPercent`,`SgstPercent`,`IgstPercent`,
`BaseValue`,`CgstAmount`,`SgstAmount`,`IgstAmount`,`RoundOffAmount`,`CouponCode`,`CouponCodeDiscount`,`CashbackCode`,`CashbackDiscountAmount`,
`subYesorNot`,`qty`,`net_amount`,`updated_at`,`created_at`)
SELECT intNewInvoiveID,`order_id`,`customer_id`,`product_id`,`product_category_id`,`product_subcategory_id`,`CgstPercent`,`SgstPercent`,`IgstPercent`,
`BaseValue`,`CgstAmount`,`SgstAmount`,`IgstAmount`,`RoundOffAmount`,`CouponCode`,`CouponCodeDiscount`,`CashbackCode`,`CashbackDiscountAmount`,
`subYesorNot`,`qty`,`net_amount`,CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP() FROM `karloff_weborder_details` WHERE order_id = intOrderID;

INSERT INTO `karloff_account_manager`(`invoice_no`,`NetAmount`,`PromocodeDiscount`,`GoCashAmount`,`cash_amount`,`card_amount`,`paytm_amount`,`online_amount`,
`settled`,`updated_at`,`created_at`) VALUES(intNewInvoiveID,intNetAmount,0,0,intCashAmount,intCardAmount,intPaytemAmount,intOnlineAmount,1,CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());

CALL sp_updatefinalStock_details(intOrderID);

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_generateInvoice_details_main` */;
DELIMITER ;;
CREATE  PROCEDURE `sp_generateInvoice_details_main`(IN `intCardAmount` INT, IN `intCashAmount` INT, IN `intPaytemAmount` INT, IN `intOnlineAmount` INT, IN `intUserID` INT, IN `intOrderID` VARCHAR(200))
BEGIN
CALL sp_generateInvoice_details(intCardAmount,intCashAmount,intPaytemAmount,intOnlineAmount,intUserID,intOrderID);
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_getCartDetails_fromOrderID` */;
DELIMITER ;;
CREATE  PROCEDURE `sp_getCartDetails_fromOrderID`(IN `intOrderID` VARCHAR(200))
BEGIN

-- select `product_id`,`BaseValue`,`CgstAmount`,`SgstAmount`,`IgstAmount`,`qty`,`net_amount` from karloff_weborder_details where order_id = intOrderID;
select t2.ProductName,`product_id`,`BaseValue`,`CgstAmount`,`SgstAmount`,`IgstAmount`,`qty`,`net_amount` 
from karloff_weborder_details t1,karloff_productdb t2 where t1.product_id=t2.id and order_id = intOrderID;


select `BaseValue`,`CgstAmount`,`SgstAmount`,`IgstAmount`,`NetAmount` from karloff_weborder where order_id = intOrderID;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_getCustomerClubMemberDetails` */;
DELIMITER ;;
CREATE  PROCEDURE `sp_getCustomerClubMemberDetails`(IN `intCustomerID` BIGINT, OUT `strYesNo` VARCHAR(20))
BEGIN
DECLARE intRowPresent INT;
SET strYesNo = 'No';
SET intRowPresent = 0;

	select (Select Count(ID) from karloff_club_membership where customer_id = t1.customer_id 
	and  expiry >= Current_Date()) INTO intRowPresent 
	from karloff_customer t1 where t1.id = intCustomerID;
    
    IF (intRowPresent > 0) THEN
      SET strYesNo = 'Yes';
    END IF;
                
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_getOrderCountdown_dtls` */;
DELIMITER ;;
CREATE  PROCEDURE `sp_getOrderCountdown_dtls`()
BEGIN

-- select count(id) as totalid from karloff_weborder where order_status =1;

select 
(select count(id) from karloff_weborder where order_status =1) as neworder,
(select count(id) from karloff_weborder where order_status in (2,3)) as processorder ,
(select count(id) from karloff_weborder where order_status =4) as dispatchorder ,
(select count(id) from karloff_weborder where order_status =5) as deliveredorder  
from dual;


END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_getOrderList_fromStatusID` */;
DELIMITER ;;
CREATE  PROCEDURE `sp_getOrderList_fromStatusID`(IN intOrderStatusID INT)
BEGIN

	/* select order_id,t1.customer_id,t1.updated_at,t1.created_at,t2.name,t2.mobile,NetAmount,order_status 
from karloff_weborder t1 ,karloff_customer t2 
where order_id not in (select order_id from karloff_invoice_master) and t1.customer_id = t2.customer_id 
and t1.order_status = intOrderStatusID; */

 select order_id,t1.customer_id,t2.customer_id,t1.updated_at,t1.created_at,t2.name,t2.mobile,NetAmount,
 order_status,t1.payment_code,t3.payment_name,delivery_charge,GoCashPay,RedeemAmount
from karloff_weborder t1 ,karloff_customer t2,karloff_payment_mode t3 
where t1.customer_id = t2.customer_id and t3.payment_code = t1.payment_code
and t1.order_status = intOrderStatusID;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_getOrder_Details` */;
DELIMITER ;;
CREATE  PROCEDURE `sp_getOrder_Details`(IN strOrderID VARCHAR(200))
BEGIN

select InvoiceAmount, NetAmount, round_off_amount,status_name,delivery_date,
                t2.name,t2.mobile,t2.cust_gst,t2.customer_id,t1.created_at,
                t1.payment_code,t4.payment_name,delivery_charge,GoCashPay,RedeemAmount,t4.id as paymentid
				from karloff_weborder t1, karloff_customer t2,karloff_order_status t3,karloff_payment_mode t4
                 where t1.customer_id = t2.customer_id and t3.id = t1.order_status and t4.payment_code = t1.payment_code
                 and order_id = strOrderID;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_getSearch_OrderList` */;
DELIMITER ;;
CREATE  PROCEDURE `sp_getSearch_OrderList`(IN intOrderID VARCHAR(200),
IN intOrderDate VARCHAR(200),
IN intOrderStatus VARCHAR(200),
IN intCustomerID VARCHAR(200),
IN strCustomerName VARCHAR(200),
IN strCustomerMobile VARCHAR(200))
BEGIN
DECLARE strQuery TEXT;
/*
DECLARE strQuery TEXT;

SET @strQuery = CONCAT(@strQuery," where FK_TypeID = ",intExamTypeID," and IsActive = 1 ");
SET @strQuery = CONCAT(@strQuery,"; ");

   PREPARE stmt FROM @strQuery;   
    EXECUTE stmt;	
	DEALLOCATE PREPARE stmt;

*/
-- select ID,status_name from karloff_order_status t1 where id in(1,2,3,4); 
-- SET @strQuery = CONCAT(@strQuery," select order_id,t1.customer_id,t2.customer_id,t1.updated_at,t1.created_at,t2.name,t2.mobile,NetAmount,");
SET @strQuery = "select order_id,t1.customer_id,t2.customer_id,t1.updated_at,t1.created_at,t2.name,t2.mobile,NetAmount,";
SET @strQuery = CONCAT(@strQuery," order_status,t1.payment_code,t3.payment_name,delivery_charge,GoCashPay,RedeemAmount");
SET @strQuery = CONCAT(@strQuery," from karloff_weborder t1 ,karloff_customer t2,karloff_payment_mode t3 ");
SET @strQuery = CONCAT(@strQuery," where t1.customer_id = t2.customer_id and t3.payment_code = t1.payment_code");

IF ((intOrderStatus IS NOT NULL) AND (intOrderStatus <> '')) THEN
   SET @strQuery = CONCAT(@strQuery," and t1.order_status ='", intOrderStatus,"'");
END IF;

IF ((intOrderID IS NOT NULL) AND (intOrderID <> '')) THEN
   SET @strQuery = CONCAT(@strQuery," and t1.order_id like('", intOrderID,"%')");
END IF;
-- ++++++++++++++++++++++++++++++++++++
IF ((intCustomerID IS NOT NULL) AND (intCustomerID <> '')) THEN
   SET @strQuery = CONCAT(@strQuery," and t2.customer_id like('", intCustomerID,"%')");
END IF;
IF ((strCustomerName IS NOT NULL) AND (strCustomerName <> '')) THEN
   SET @strQuery = CONCAT(@strQuery," and t2.name like('", strCustomerName,"%')");
END IF;
IF ((strCustomerMobile IS NOT NULL) AND (strCustomerMobile <> '')) THEN
   SET @strQuery = CONCAT(@strQuery," and t2.mobile like('", strCustomerMobile,"%')");
END IF;
-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

SET @strQuery = CONCAT(@strQuery,";");

PREPARE stmt FROM @strQuery;   
EXECUTE stmt;	
DEALLOCATE PREPARE stmt; 

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_insert_CustomerAddress` */;
DELIMITER ;;
CREATE  PROCEDURE `sp_insert_CustomerAddress`(IN strCustomerID VARCHAR(200),
 IN strCustName VARCHAR(200),IN strCustMobile VARCHAR(200),
 IN strCustHouseNo VARCHAR(200),IN strCustLocality VARCHAR(200),
 IN strCustLandmark VARCHAR(200),IN strCustCity VARCHAR(200),IN strCustState VARCHAR(200),
 IN strCustPin VARCHAR(200),IN strCustAddresType VARCHAR(200),
 IN strCustisDefault INT)
BEGIN

update karloff_address_manager set is_default=1 where customer_id = strCustomerID;

INSERT INTO `karloff_address_manager`(`customer_id`,`full_name`,`phone_no`,`house_no`,`locality`,`landmark`,`city`,`state`,`type`,`is_default`,`pincode`,`updated_at`,`created_at`)
VALUES(strCustomerID,strCustName,strCustMobile,strCustHouseNo,strCustLocality,strCustLandmark,strCustCity,strCustState,strCustAddresType,strCustisDefault,strCustPin,CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_orderstatus_list` */;
DELIMITER ;;
CREATE  PROCEDURE `sp_orderstatus_list`(IN intFlag INT)
BEGIN
 IF (intFlag = 0) THEN
	select ID,status_name from karloff_order_status t1;
  ELSEIF (intFlag = 1) THEN
	select ID,status_name from karloff_order_status t1 where id in(0,1,2,3,4,5,6); 
  ELSEIF (intFlag = 2) THEN
	select ID,status_name from karloff_order_status t1 where id in(1,2,3,4); 
  END IF; 
  
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_remove_orderdetails` */;
DELIMITER ;;
CREATE  PROCEDURE `sp_remove_orderdetails`(IN `intOrderID` VARCHAR(200))
BEGIN
SELECT `product_id`,`product_category_id`,`product_subcategory_id`,`qty` 
FROM `karloff_weborder_details` WHERE order_id =intOrderID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_set_CustomerAddressDefault` */;
DELIMITER ;;
CREATE  PROCEDURE `sp_set_CustomerAddressDefault`(IN strCustomerID VARCHAR(200),
IN intAddressID VARCHAR(200))
BEGIN

update karloff_address_manager set is_default=1 where customer_id = strCustomerID;

update karloff_address_manager set is_default=0 
where customer_id = strCustomerID and id = intAddressID;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_updatefinalStock_details` */;
DELIMITER ;;
CREATE  PROCEDURE `sp_updatefinalStock_details`(IN `intOrderID` BIGINT)
BEGIN
 -- **********************************************
  DECLARE done INT DEFAULT FALSE;
  DECLARE prodid,prodcatid,prodsubcatid,qtydtls INT; 
  
 DECLARE cursor_Prod CURSOR FOR 
 SELECT `product_id`,`product_category_id`,`product_subcategory_id`,`qty` 
 FROM `karloff_weborder_details` WHERE order_id = intOrderID;  
 
   DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
     
   OPEN cursor_Prod;
  read_loop: LOOP
    FETCH cursor_Prod INTO prodid,prodcatid,prodsubcatid,qtydtls;
    IF done THEN
      LEAVE read_loop;
    END IF;
   -- ========================================= 
    update karloff_productdb set CurrentStock = (CurrentStock - qtydtls) where id = prodid and ProductCategory = prodcatid and ProductSubcategoryL1 = prodsubcatid;
  -- ==============================================
  END LOOP;
  CLOSE cursor_Prod;
	 
 -- ********************************************
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_UpdatePsudoProductStock` */;
DELIMITER ;;
CREATE  PROCEDURE `sp_UpdatePsudoProductStock`(IN `intProductID` INT, IN `intQty` INT, IN `intOrderID` VARCHAR(200), IN `intRemoved` INT)
BEGIN

	IF (intRemoved = 1) THEN  -- Product Added on cart
      update karloff_productdb set PseudoStock = (PseudoStock - intQty) where id = intProductID;
	ELSE   -- Product Removed from cart
       update karloff_productdb set PseudoStock = (PseudoStock + intQty) where id = intProductID;
   
     CALL sp_UpdateWebOrderTableforProductRemoved(intProductID,intQty,intOrderID);
	
    END IF;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `sp_UpdateWebOrderTableforProductRemoved` */;
DELIMITER ;;
CREATE  PROCEDURE `sp_UpdateWebOrderTableforProductRemoved`(IN `intProductID` INT, IN `intQty` INT, IN `intOrderID` BIGINT)
BEGIN

DECLARE fPriceP,fRate,fCGST,fSGST,fIGST FLOAT;

SET fPriceP =0; set fRate = 0; set fCGST = 0; set fSGST =0; set fIGST = 0;

SELECT `BaseValue`,`CgstAmount`,`SgstAmount`,`IgstAmount`,`net_amount` 
INTO fRate,fCGST,fSGST,fIGST,fPriceP
FROM karloff_weborder_details WHERE order_id = intOrderID AND product_id = intProductID;


update karloff_weborder set BaseValue = (BaseValue - fRate),CgstAmount = (CgstAmount - fCGST), 
		SgstAmount = (SgstAmount - fSGST),IgstAmount = (IgstAmount - fIGST),InvoiceAmount = (InvoiceAmount - fPriceP),
		NetAmount = (NetAmount - fPriceP),updated_at= CURRENT_TIMESTAMP()
		where order_id = intOrderID;

DELETE FROM karloff_weborder_details WHERE order_id = intOrderID AND product_id = intProductID;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `test_procedure` */;
DELIMITER ;;
CREATE  PROCEDURE `test_procedure`()
BEGIN
DECLARE intProductID,intQty,intUserID INT;
DECLARE intCustomerID,intOrderID BIGINT;
/* -- DECLARE Param5 VARCHAR(500);
 --  `sp_AddtoCart_OneProduct`(IN intProductID INT,IN intCustomerID BIGINT,IN intOrderID BIGINT,IN intQty INT,IN intUserID INT) 
 
 SET intProductID = 2420; SET intQty =1;  SET intUserID = 40;
  SET intCustomerID = 2062020142531; SET intOrderID =0506202018054540; 
  
 call `sp_AddtoCart_OneProduct`(intProductID,intCustomerID,intOrderID,intQty,intUserID);
-- SELECT Param3;
 -- select ;
 */
/* SET intProductID = 259; SET intQty =2;
  SET intOrderID =2020060617165140; 
 call sp_UpdatePsudoProductStock(intProductID,intQty,intOrderID,0); */
 
 -- CALL sp_getSearch_OrderList('','','','','','');
 
 call sp_getOrderCountdown_dtls();
END ;;
DELIMITER ;


