CREATE OR REPLACE FUNCTION food600.buff_sankcie(
	mmeno character varying,
	mcdata integer,
	msankcia character varying,
	makt_mena integer,
	mc_stredisk integer)
    RETURNS integer
    LANGUAGE 'plpgsql'
    COST 100
    VOLATILE
AS $BODY$
DECLARE zapisuj INT DEFAULT 0;
BEGIN
TRUNCATE food600.test;
IF zapisuj=1 THEN 
	insert into food600.test (cas,text) values (clock_timestamp(),'BUFF_SANKCIE Start');
END IF;
CASE
	WHEN msankcia='01' THEN UPDATE food600.buffer SET cena_part=karty.cena01 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='02' THEN UPDATE food600.buffer SET cena_part=karty.cena02 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='03' THEN UPDATE food600.buffer SET cena_part=karty.cena03 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='04' THEN UPDATE food600.buffer SET cena_part=karty.cena04 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='05' THEN UPDATE food600.buffer SET cena_part=karty.cena05 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='06' THEN UPDATE food600.buffer SET cena_part=karty.cena06 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='07' THEN UPDATE food600.buffer SET cena_part=karty.cena07 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='08' THEN UPDATE food600.buffer SET cena_part=karty.cena08 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='09' THEN UPDATE food600.buffer SET cena_part=karty.cena09 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='10' THEN UPDATE food600.buffer SET cena_part=karty.cena10 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='11' THEN UPDATE food600.buffer SET cena_part=karty.cena11 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='12' THEN UPDATE food600.buffer SET cena_part=karty.cena12 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='13' THEN UPDATE food600.buffer SET cena_part=karty.cena13 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='14' THEN UPDATE food600.buffer SET cena_part=karty.cena14 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='15' THEN UPDATE food600.buffer SET cena_part=karty.cena15 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='16' THEN UPDATE food600.buffer SET cena_part=karty.cena16 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='17' THEN UPDATE food600.buffer SET cena_part=karty.cena17 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='18' THEN UPDATE food600.buffer SET cena_part=karty.cena18 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='19' THEN UPDATE food600.buffer SET cena_part=karty.cena19 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='20' THEN UPDATE food600.buffer SET cena_part=karty.cena20 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='21' THEN UPDATE food600.buffer SET cena_part=karty.cena21 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='22' THEN UPDATE food600.buffer SET cena_part=karty.cena22 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='23' THEN UPDATE food600.buffer SET cena_part=karty.cena23 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='24' THEN UPDATE food600.buffer SET cena_part=karty.cena24 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='25' THEN UPDATE food600.buffer SET cena_part=karty.cena25 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='26' THEN UPDATE food600.buffer SET cena_part=karty.cena26 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='27' THEN UPDATE food600.buffer SET cena_part=karty.cena27 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='28' THEN UPDATE food600.buffer SET cena_part=karty.cena28 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='29' THEN UPDATE food600.buffer SET cena_part=karty.cena29 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='30' THEN UPDATE food600.buffer SET cena_part=karty.cena30 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='31' THEN UPDATE food600.buffer SET cena_part=karty.cena31 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='32' THEN UPDATE food600.buffer SET cena_part=karty.cena32 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='33' THEN UPDATE food600.buffer SET cena_part=karty.cena33 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='34' THEN UPDATE food600.buffer SET cena_part=karty.cena34 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='35' THEN UPDATE food600.buffer SET cena_part=karty.cena35 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='36' THEN UPDATE food600.buffer SET cena_part=karty.cena36 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='37' THEN UPDATE food600.buffer SET cena_part=karty.cena37 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='38' THEN UPDATE food600.buffer SET cena_part=karty.cena38 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='39' THEN UPDATE food600.buffer SET cena_part=karty.cena39 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='40' THEN UPDATE food600.buffer SET cena_part=karty.cena40 FROM food600.karty WHERE buffer.c_karty=karty.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='A0' THEN UPDATE food600.buffer SET cena_part=kceny.cenaA0 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='A1' THEN UPDATE food600.buffer SET cena_part=kceny.cenaA1 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='A2' THEN UPDATE food600.buffer SET cena_part=kceny.cenaA2 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='A3' THEN UPDATE food600.buffer SET cena_part=kceny.cenaA3 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='A4' THEN UPDATE food600.buffer SET cena_part=kceny.cenaA4 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='A5' THEN UPDATE food600.buffer SET cena_part=kceny.cenaA5 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='A6' THEN UPDATE food600.buffer SET cena_part=kceny.cenaA6 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='A7' THEN UPDATE food600.buffer SET cena_part=kceny.cenaA7 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='A8' THEN UPDATE food600.buffer SET cena_part=kceny.cenaA8 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='A9' THEN UPDATE food600.buffer SET cena_part=kceny.cenaA9 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='B0' THEN UPDATE food600.buffer SET cena_part=kceny.cenaB0 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='B1' THEN UPDATE food600.buffer SET cena_part=kceny.cenaB1 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='B2' THEN UPDATE food600.buffer SET cena_part=kceny.cenaB2 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='B3' THEN UPDATE food600.buffer SET cena_part=kceny.cenaB3 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='B4' THEN UPDATE food600.buffer SET cena_part=kceny.cenaB4 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='B5' THEN UPDATE food600.buffer SET cena_part=kceny.cenaB5 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='B6' THEN UPDATE food600.buffer SET cena_part=kceny.cenaB6 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='B7' THEN UPDATE food600.buffer SET cena_part=kceny.cenaB7 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='B8' THEN UPDATE food600.buffer SET cena_part=kceny.cenaB8 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='B9' THEN UPDATE food600.buffer SET cena_part=kceny.cenaB9 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='C0' THEN UPDATE food600.buffer SET cena_part=kceny.cenaC0 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='C1' THEN UPDATE food600.buffer SET cena_part=kceny.cenaC1 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='C2' THEN UPDATE food600.buffer SET cena_part=kceny.cenaC2 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='C3' THEN UPDATE food600.buffer SET cena_part=kceny.cenaC3 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='C4' THEN UPDATE food600.buffer SET cena_part=kceny.cenaC4 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='C5' THEN UPDATE food600.buffer SET cena_part=kceny.cenaC5 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='C6' THEN UPDATE food600.buffer SET cena_part=kceny.cenaC6 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='C7' THEN UPDATE food600.buffer SET cena_part=kceny.cenaC7 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='C8' THEN UPDATE food600.buffer SET cena_part=kceny.cenaC8 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='C9' THEN UPDATE food600.buffer SET cena_part=kceny.cenaC9 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='D0' THEN UPDATE food600.buffer SET cena_part=kceny.cenaD0 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='D1' THEN UPDATE food600.buffer SET cena_part=kceny.cenaD1 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='D2' THEN UPDATE food600.buffer SET cena_part=kceny.cenaD2 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='D3' THEN UPDATE food600.buffer SET cena_part=kceny.cenaD3 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='D4' THEN UPDATE food600.buffer SET cena_part=kceny.cenaD4 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='D5' THEN UPDATE food600.buffer SET cena_part=kceny.cenaD5 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='D6' THEN UPDATE food600.buffer SET cena_part=kceny.cenaD6 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='D7' THEN UPDATE food600.buffer SET cena_part=kceny.cenaD7 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='D8' THEN UPDATE food600.buffer SET cena_part=kceny.cenaD8 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='D9' THEN UPDATE food600.buffer SET cena_part=kceny.cenaD9 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='E0' THEN UPDATE food600.buffer SET cena_part=kceny.cenaE0 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='E1' THEN UPDATE food600.buffer SET cena_part=kceny.cenaE1 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='E2' THEN UPDATE food600.buffer SET cena_part=kceny.cenaE2 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='E3' THEN UPDATE food600.buffer SET cena_part=kceny.cenaE3 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='E4' THEN UPDATE food600.buffer SET cena_part=kceny.cenaE4 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='E5' THEN UPDATE food600.buffer SET cena_part=kceny.cenaE5 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='E6' THEN UPDATE food600.buffer SET cena_part=kceny.cenaE6 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='E7' THEN UPDATE food600.buffer SET cena_part=kceny.cenaE7 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='E8' THEN UPDATE food600.buffer SET cena_part=kceny.cenaE8 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='E9' THEN UPDATE food600.buffer SET cena_part=kceny.cenaE9 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='F0' THEN UPDATE food600.buffer SET cena_part=kceny.cenaF0 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='F1' THEN UPDATE food600.buffer SET cena_part=kceny.cenaF1 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='F2' THEN UPDATE food600.buffer SET cena_part=kceny.cenaF2 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='F3' THEN UPDATE food600.buffer SET cena_part=kceny.cenaF3 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='F4' THEN UPDATE food600.buffer SET cena_part=kceny.cenaF4 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='F5' THEN UPDATE food600.buffer SET cena_part=kceny.cenaF5 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='F6' THEN UPDATE food600.buffer SET cena_part=kceny.cenaF6 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='F7' THEN UPDATE food600.buffer SET cena_part=kceny.cenaF7 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='F8' THEN UPDATE food600.buffer SET cena_part=kceny.cenaF8 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='F9' THEN UPDATE food600.buffer SET cena_part=kceny.cenaF9 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='G0' THEN UPDATE food600.buffer SET cena_part=kceny.cenaG0 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='G1' THEN UPDATE food600.buffer SET cena_part=kceny.cenaG1 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='G2' THEN UPDATE food600.buffer SET cena_part=kceny.cenaG2 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='G3' THEN UPDATE food600.buffer SET cena_part=kceny.cenaG3 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='G4' THEN UPDATE food600.buffer SET cena_part=kceny.cenaG4 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='G5' THEN UPDATE food600.buffer SET cena_part=kceny.cenaG5 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='G6' THEN UPDATE food600.buffer SET cena_part=kceny.cenaG6 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='G7' THEN UPDATE food600.buffer SET cena_part=kceny.cenaG7 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='G8' THEN UPDATE food600.buffer SET cena_part=kceny.cenaG8 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='G9' THEN UPDATE food600.buffer SET cena_part=kceny.cenaG9 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='H0' THEN UPDATE food600.buffer SET cena_part=kceny.cenaH0 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='H1' THEN UPDATE food600.buffer SET cena_part=kceny.cenaH1 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='H2' THEN UPDATE food600.buffer SET cena_part=kceny.cenaH2 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='H3' THEN UPDATE food600.buffer SET cena_part=kceny.cenaH3 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='H4' THEN UPDATE food600.buffer SET cena_part=kceny.cenaH4 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='H5' THEN UPDATE food600.buffer SET cena_part=kceny.cenaH5 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='H6' THEN UPDATE food600.buffer SET cena_part=kceny.cenaH6 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='H7' THEN UPDATE food600.buffer SET cena_part=kceny.cenaH7 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='H8' THEN UPDATE food600.buffer SET cena_part=kceny.cenaH8 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='H9' THEN UPDATE food600.buffer SET cena_part=kceny.cenaH9 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='I0' THEN UPDATE food600.buffer SET cena_part=kceny.cenaI0 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='I1' THEN UPDATE food600.buffer SET cena_part=kceny.cenaI1 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='I2' THEN UPDATE food600.buffer SET cena_part=kceny.cenaI2 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='I3' THEN UPDATE food600.buffer SET cena_part=kceny.cenaI3 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='I4' THEN UPDATE food600.buffer SET cena_part=kceny.cenaI4 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='I5' THEN UPDATE food600.buffer SET cena_part=kceny.cenaI5 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='I6' THEN UPDATE food600.buffer SET cena_part=kceny.cenaI6 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='I7' THEN UPDATE food600.buffer SET cena_part=kceny.cenaI7 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='I8' THEN UPDATE food600.buffer SET cena_part=kceny.cenaI8 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='I9' THEN UPDATE food600.buffer SET cena_part=kceny.cenaI9 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='J0' THEN UPDATE food600.buffer SET cena_part=kceny.cenaJ0 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='J1' THEN UPDATE food600.buffer SET cena_part=kceny.cenaJ1 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='J2' THEN UPDATE food600.buffer SET cena_part=kceny.cenaJ2 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='J3' THEN UPDATE food600.buffer SET cena_part=kceny.cenaJ3 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='J4' THEN UPDATE food600.buffer SET cena_part=kceny.cenaJ4 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='J5' THEN UPDATE food600.buffer SET cena_part=kceny.cenaJ5 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='J6' THEN UPDATE food600.buffer SET cena_part=kceny.cenaJ6 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='J7' THEN UPDATE food600.buffer SET cena_part=kceny.cenaJ7 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='J8' THEN UPDATE food600.buffer SET cena_part=kceny.cenaJ8 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='J9' THEN UPDATE food600.buffer SET cena_part=kceny.cenaJ9 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='K0' THEN UPDATE food600.buffer SET cena_part=kceny.cenaK0 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='K1' THEN UPDATE food600.buffer SET cena_part=kceny.cenaK1 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='K2' THEN UPDATE food600.buffer SET cena_part=kceny.cenaK2 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='K3' THEN UPDATE food600.buffer SET cena_part=kceny.cenaK3 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='K4' THEN UPDATE food600.buffer SET cena_part=kceny.cenaK4 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='K5' THEN UPDATE food600.buffer SET cena_part=kceny.cenaK5 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='K6' THEN UPDATE food600.buffer SET cena_part=kceny.cenaK6 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='K7' THEN UPDATE food600.buffer SET cena_part=kceny.cenaK7 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='K8' THEN UPDATE food600.buffer SET cena_part=kceny.cenaK8 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='K9' THEN UPDATE food600.buffer SET cena_part=kceny.cenaK9 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='L0' THEN UPDATE food600.buffer SET cena_part=kceny.cenaL0 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='L1' THEN UPDATE food600.buffer SET cena_part=kceny.cenaL1 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='L2' THEN UPDATE food600.buffer SET cena_part=kceny.cenaL2 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='L3' THEN UPDATE food600.buffer SET cena_part=kceny.cenaL3 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='L4' THEN UPDATE food600.buffer SET cena_part=kceny.cenaL4 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='L5' THEN UPDATE food600.buffer SET cena_part=kceny.cenaL5 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='L6' THEN UPDATE food600.buffer SET cena_part=kceny.cenaL6 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='L7' THEN UPDATE food600.buffer SET cena_part=kceny.cenaL7 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='L8' THEN UPDATE food600.buffer SET cena_part=kceny.cenaL8 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
	WHEN msankcia='L9' THEN UPDATE food600.buffer SET cena_part=kceny.cenaL9 FROM food600.kceny WHERE buffer.c_karty=kceny.c_karty AND buffer.menobuf=mmeno;
END CASE;
UPDATE food600.buffer SET cena=food600.prep_meny(sklad.c_mena, makt_mena,sklad.cena_prum), na_sklade=sklad.zustatek, zustatek=mnozstvi FROM food600.sklad WHERE buffer.c_karty=sklad.c_karty AND buffer.menobuf=mmeno AND sklad.c_stredisk=mc_stredisk AND sklad.c_data=mcdata AND buffer.operace='PI';
RETURN 1;
END
$BODY$;
