salix/db/routines/vn/procedures/entry_copyBuys.sql

60 lines
968 B
MySQL
Raw Normal View History

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_copyBuys`(vSelf INT, vCopyTo INT)
BEGIN
/**
* Copies an entry buys to another buy.
*
* @param vSelf The entry id
* @param vCopyTo The destination entry id
*/
INSERT INTO buy(
entryFk,
itemFk,
quantity,
buyingValue,
freightValue,
isIgnored,
stickers,
packing,
`grouping`,
groupingMode,
containerFk,
comissionValue,
packageValue,
packagingFk,
price1,
price2,
price3,
minPrice,
isChecked,
location,
weight,
itemOriginalFk
)
SELECT vCopyTo,
itemFk,
quantity,
buyingValue,
freightValue,
isIgnored,
stickers,
packing,
`grouping`,
groupingMode,
containerFk,
comissionValue,
packageValue,
packagingFk,
price1,
price2,
price3,
minPrice,
isChecked,
location,
weight,
itemOriginalFk
FROM buy
WHERE entryFk = vSelf;
END$$
DELIMITER ;