Stav 23.06.2026
This commit is contained in:
+154
@@ -0,0 +1,154 @@
|
||||
# ------------------------------------------------
|
||||
# --- MODUL PRO VYTVORENI TESTOVACICH DAT
|
||||
# ------------------------------------------------
|
||||
import data
|
||||
import json
|
||||
# ------------------------------------------------
|
||||
# --- CENIK
|
||||
|
||||
def create_tst_cenik(id_kas: str):
|
||||
c_pol0 = data.CenPol(
|
||||
id_card= 101, kod= 101, d_name= "Pivo 12°", ch_name= "Pivo", color= 1, pokl= id_kas, sklad= "01",
|
||||
ceny= [data.Cena(cena= 45.0, mena= "Kc", dan= "1.21", name= "standard") ,
|
||||
data.Cena(cena= 29.0, mena= "Kc", dan= "1.21", name= "zamestnanci"),
|
||||
data.Cena(cena= 42.0, mena= "Kc", dan= "1.21", name="vecernisleva"),],
|
||||
pos_pc= [data.Position(page= 2,line=5, col= 0 ),data.Position(page= 3,line=0, col= 0 )],
|
||||
pos_mb= [],
|
||||
eany= [],
|
||||
messagepol= [data.MessagePol(text="jen po pracovni dobe",povinna=True),
|
||||
data.MessagePol(text="ne ridicum", povinna=False)],
|
||||
atributes= ["perm:0001", "nosale", "only:Kc"])
|
||||
|
||||
c_pol1 = data.CenPol( id_card=1, kod=1, color=1, d_name='chl. uherakovy', ch_name='chlebicek uherakovy', pokl=id_kas, sklad='41',
|
||||
ceny=[data.Cena(cena=44, mena="Kc", dan='1.1', name="standard"),
|
||||
data.Cena(cena=24, mena="Kc", dan='1.1', name="zamestnanci"),
|
||||
data.Cena(cena=38, mena="Kc", dan='1.1', name="vecerni sleva"),
|
||||
data.Cena(cena=1.1, mena="Eur", dan='1.1', name="Euro cena"),],
|
||||
pos_pc= [data.Position(page= 1,line=0, col= 0 ),data.Position(page= 3,line=1, col= 0 )],
|
||||
pos_mb= [],
|
||||
eany= [],
|
||||
messagepol= [],
|
||||
atributes= ["standard"])
|
||||
|
||||
c_pol2 = data.CenPol( id_card=2, kod=2, color=1, d_name='chl. vajickovy', ch_name='chlebicek vajickovy', pokl=id_kas, sklad='41',
|
||||
ceny=[data.Cena(cena=42, mena="Kc", dan='1.1', name="standard"),
|
||||
data.Cena(cena=23, mena="Kc", dan='1.1', name="zamestnanci"),
|
||||
data.Cena(cena=39, mena="Kc", dan='1.1', name="vecerni sleva"),
|
||||
data.Cena(cena=1., mena="Eur", dan='1.1', name="Euro cena"),],
|
||||
pos_pc= [data.Position(page= 1,line=0, col= 1 ),data.Position(page= 3,line=1, col= 1 )],
|
||||
pos_mb= [],
|
||||
eany= [],
|
||||
messagepol= [],
|
||||
atributes= [])
|
||||
|
||||
c_pol3 = data.CenPol( id_card=3, kod=3, color=1, d_name='chl. krabi', ch_name='chlebicek krabi', pokl=id_kas, sklad='41',
|
||||
pos_pc= [data.Position(page= 1,line=0, col= 2 ),data.Position(page= 3,line=1, col= 2 )],
|
||||
pos_mb= [],
|
||||
eany= [],
|
||||
messagepol= [],
|
||||
atributes= [],
|
||||
ceny=[data.Cena(cena=48, mena="Kc", dan='1.1', name="standard"),
|
||||
data.Cena(cena=27, mena="Kc", dan='1.1', name="zamestnanci"),
|
||||
data.Cena(cena=41, mena="Kc", dan='1.1', name="vecerni sleva"),
|
||||
data.Cena(cena=1.3, mena="Eur", dan='1.1', name="Euro cena"),])
|
||||
|
||||
c_pol4 = data.CenPol( id_card=4, color=2, d_name='d. sacher', ch_name='dort Sacher', pokl=id_kas, sklad='41',
|
||||
pos_pc= [data.Position(page= 1,line=1, col= 0 ),data.Position(page= 3,line=2, col= 0 )],
|
||||
pos_mb= [],
|
||||
eany= [],
|
||||
messagepol= [],
|
||||
atributes= [],
|
||||
ceny=[data.Cena(cena=108, mena="Kc", dan='1.21', name="standard"),
|
||||
data.Cena(cena=56, mena="Kc", dan='1.21', name="zamestnanci"),
|
||||
data.Cena(cena=94, mena="Kc", dan='1.21', name="vecerni sleva"),
|
||||
data.Cena(cena=4.2, mena="Eur", dan='1.21', name="Euro cena"),])
|
||||
|
||||
c_pol5 = data.CenPol( id_card=5, kod= 5, color=1, d_name='chl. s krenem', ch_name='chlebicek s krenem', pokl=id_kas, sklad='41',
|
||||
pos_pc= [data.Position(page= 1,line=0, col= 3 ),data.Position(page= 3,line=2, col= 3 )],
|
||||
pos_mb= [],
|
||||
eany= [],
|
||||
messagepol= [],
|
||||
atributes= [],
|
||||
ceny=[data.Cena(cena=42, mena="Kc", dan='1.1', name="standard"),
|
||||
data.Cena(cena=23, mena="Kc", dan='1.1', name="zamestnanci"),
|
||||
data.Cena(cena=39, mena="Kc", dan='1.1', name="vecerni sleva"),
|
||||
data.Cena(cena=1., mena="Eur", dan='1.1', name="Euro cena"),])
|
||||
|
||||
c_pol6 = data.CenPol( id_card=6, kod=6, color=1, d_name='chl. roastbeef', ch_name='chlebicek roastbeef', pokl=id_kas, sklad='41',
|
||||
pos_pc= [data.Position(page= 1,line=0, col= 5 ),data.Position(page= 3,line=2, col= 5 )],
|
||||
pos_mb= [],
|
||||
eany= [],
|
||||
messagepol= [],
|
||||
atributes= [],
|
||||
ceny=[data.Cena(cena=48, mena="Kc", dan='1.1', name="standard"),
|
||||
data.Cena(cena=27, mena="Kc", dan='1.1', name="zamestnanci"),
|
||||
data.Cena(cena=41, mena="Kc", dan='1.1', name="vecerni sleva"),
|
||||
data.Cena(cena=1.3, mena="Eur", dan='1.1', name="Euro cena"),])
|
||||
|
||||
c_pol7 = data.CenPol( id_card=7, kod=7, color=3, d_name='d. Praga', ch_name='dort Praga', pokl=id_kas, sklad='41',
|
||||
pos_pc= [data.Position(page= 1,line=1, col= 1 ),data.Position(page= 3,line=4, col= 1 ),
|
||||
data.Position(page= 1,line=2, col= 2 ),data.Position(page= 1,line=3, col= 2 ),data.Position(page= 1,line=4, col= 2 ),
|
||||
data.Position(page= 1,line=5, col= 2 ),data.Position(page= 1,line=7, col= 1 ),],
|
||||
pos_mb= [],
|
||||
eany= [],
|
||||
messagepol= [],
|
||||
atributes= [],
|
||||
ceny=[data.Cena(cena=112, mena="Kc", dan='1.21', name="standard"),
|
||||
data.Cena(cena=58, mena="Kc", dan='1.21', name="zamestnanci"),
|
||||
data.Cena(cena=98, mena="Kc", dan='1.21', name="vecerni sleva"),
|
||||
data.Cena(cena=4.4, mena="Eur", dan='1.21', name="Euro cena"),])
|
||||
c_pol8 = data.CenPol(
|
||||
id_card=-1,
|
||||
kod=-1,
|
||||
d_name="str.napoje",
|
||||
ch_name="str.napoje",
|
||||
color=2,
|
||||
pokl=id_kas,
|
||||
sklad="",
|
||||
ceny=[],
|
||||
pos_pc=[
|
||||
data.Position(page=1,line=3,col=0),
|
||||
data.Position(page=3,line=3,col=0),
|
||||
],
|
||||
pos_mb=[],
|
||||
eany=[],
|
||||
messagepol=[],
|
||||
atributes=["page"]
|
||||
)
|
||||
cenik = data.Cenik(cenpol=[c_pol0,c_pol1,c_pol2,c_pol3,c_pol5,c_pol6,c_pol4,c_pol7,c_pol8])
|
||||
|
||||
|
||||
print(json.dumps(c_pol0.model_dump(), indent=2, ensure_ascii=False))
|
||||
|
||||
return cenik
|
||||
# ------------------------------------------------
|
||||
# --- UCET
|
||||
def create_tst_ucet(id_kas, maly: bool = False):
|
||||
a = data.UcPol(nazev="Chlebicek uhersky", id_card=1, cena=36., pocet=2, delitel=2, dph='1.05', cenhlad='1', kstornu=2)
|
||||
b = data.UcPol(nazev="Chlebicek s vajickem", id_card=2, pocet=3, delitel=3, cena=39., dph='1.05', cenhlad='1', kstornu=3)
|
||||
c = data.UcPol(nazev="Dort Sacher", id_card=3, pocet=1, delitel=1, cena=89., dph='1.2', cenhlad='1', kstornu=1)
|
||||
d = data.UcPol(nazev="Chlebicek s humr", id_card=4, pocet=3, delitel=1, cena=41., dph='1.05', cenhlad='1')
|
||||
e = data.UcPol(nazev="Pohar Kiwi", id_card=5, pocet=1, delitel=1, cena=139., dph='1.20', cenhlad='1')
|
||||
f = data.UcPol(nazev="Fresh pomerancovy", id_card=6, pocet=2, delitel=1, cena=55., dph='1.2', cenhlad='1')
|
||||
polozky = [a,b]
|
||||
if maly:
|
||||
polozky.extend([c,d,e,f,])
|
||||
ucet = data.Ucet(
|
||||
datetime=data.stime_str(), # ✔️ funkce zavolaná
|
||||
ucislo="",
|
||||
stul="2",
|
||||
id_kas=id_kas,
|
||||
autor="Petr Kobrle",
|
||||
poloz=polozky,
|
||||
platby=[],
|
||||
dane=[] )
|
||||
return ucet
|
||||
|
||||
# --- ucet pro PosDialog
|
||||
def make_dummy_ucet():
|
||||
u = create_tst_ucet(id_kas='01', maly=False)
|
||||
ue = data.ucet_to_edit(u)
|
||||
print(ue)
|
||||
return ue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user