self.cr.execute('select j.code, j.name, sum(l.debit) as debit, sum(l.credit) as credit from account_move_line l left join account_journal j on (l.journal_id=j.id) where period_id=%s and journal_id in ('+','.join(map(str,journal_id))+') and l.state<>\'draft\' group by j.id, j.code, j.name',(period,))
self.cr.execute('select j.code, j.name, sum(l.debit) as debit, sum(l.credit) as credit from account_move_line l left join account_journal j on (l.journal_id=j.id) where period_id=%s and journal_id in ('+self.journal_ids+') and l.state<>\'draft\' group by j.id, j.code, j.name',(period_id,))
self.cr.execute('select sum(debit) from account_move_line where period_id=%s and journal_id in ('+','.join(map(str,journal_id))+') and state<>\'draft\'',(period_id,))
self.cr.execute('select sum(debit) from account_move_line where period_id=%s and journal_id in ('+self.journal_ids+') and state<>\'draft\'',(period_id,))
self.cr.execute('select sum(credit) from account_move_line where period_id=%s and journal_id in ('+','.join(map(str,journal_id))+') and state<>\'draft\'',(period_id,))
self.cr.execute('select sum(credit) from account_move_line where period_id=%s and journal_id in ('+self.journal_ids+') and state<>\'draft\'',(period_id,))
self.cr.execute('select sum(debit) from account_move_line where period_id in ('+','.join(map(str,period_id))+') and journal_id in ('+','.join(map(str,journal_id))+') and state<>\'draft\'')
self.cr.execute('select sum(debit) from account_move_line where period_id in ('+self.period_ids+') and journal_id in ('+self.journal_ids+') and state<>\'draft\'')
self.cr.execute('select sum(credit) from account_move_line where period_id in ('+','.join(map(str,period_id))+') and journal_id in ('+','.join(map(str,journal_id))+') and state<>\'draft\'')
self.cr.execute('select sum(credit) from account_move_line where period_id in ('+self.period_ids+') and journal_id in ('+self.journal_ids+') and state<>\'draft\'')