ADOQuery_CARD.SQL.Text:="select count(i.article) sale_count,sum(i.quantity) sale_quantity, sum(i.totalsum) sale_sum, ch.cashier,u.surname,l.name loc_name "+chr(13)+ "from supermag.smcashchecks ch, supermag.smcashcheckitems i,supermag.smcashdesksstaff u, supermag.smstorelocations l "+chr(13)+ "where ch.locid=i.locid "+chr(13)+ "and ch.desknum=i.desknum "+chr(13)+ "and ch.znum=i.znum "+chr(13)+ "and ch.checknum=i.checknum "+chr(13)+ "and ch.cashier=u.id(+) "+chr(13)+ "and ch.locid=u.locid(+) "+chr(13)+ "and ch.locid=l.id "+chr(13)+ "and ch.locid=14 "+chr(13)+ "and ch.opcode=1 "+chr(13)+ "and d.CREATEDAT>=to_date('"+DateToStr(DE_Begin.Date)+"',''DD.MM.YYYY'') "+chr(13)+ "and d.CREATEDAT<=to_date('"+DateToStr(DE_End.Date)+"',''DD.MM.YYYY'') "+chr(13)+ "and i.article=E_ARTICLE.Text "+chr(13)+ "group by ch.cashier,u.surname,l.name ";
ADOQuery_CARD.SQL.Text:="select count(i.article) sale_count,sum(i.quantity) sale_quantity, sum(i.totalsum) sale_sum, ch.cashier,u.surname,l.name loc_name "+chr(13)+ "from supermag.smcashchecks ch, supermag.smcashcheckitems i,supermag.smcashdesksstaff u, supermag.smstorelocations l "+chr(13)+ "where ch.locid=i.locid "+chr(13)+ "and ch.desknum=i.desknum "+chr(13)+ "and ch.znum=i.znum "+chr(13)+ "and ch.checknum=i.checknum "+chr(13)+ "and ch.cashier=u.id(+) "+chr(13)+ "and ch.locid=u.locid(+) "+chr(13)+ "and ch.locid=l.id "+chr(13)+ "and ch.locid=14 "+chr(13)+ "and ch.opcode=1 "+chr(13)+ "and d.CREATEDAT>=to_date('"+DateToStr(DE_Begin.Date)+"',''DD.MM.YYYY'') "+chr(13)+ "and d.CREATEDAT<=to_date('"+DateToStr(DE_End.Date)+"',''DD.MM.YYYY'') "+chr(13)+ "and i.article=E_ARTICLE.Text "+chr(13)+ "group by ch.cashier,u.surname,l.name ";