my $project;
my $where = "1 = 1";
my $glwhere = "";
+ my $prwhere = "";
my $subwhere = "";
my $item;
if ($form->{method} eq 'cash') {
$subwhere .= " AND transdate >= '$fromdate'";
$glwhere = " AND ac.transdate >= '$fromdate'";
+ $prwhere = " AND ar.transdate >= '$fromdate'";
} else {
$where .= " AND ac.transdate >= '$fromdate'";
}
if ($todate) {
$where .= " AND ac.transdate <= '$todate'";
$subwhere .= " AND transdate <= '$todate'";
+ $prwhere .= " AND ar.transdate <= '$todate'";
}
if ($department_id) {
JOIN parts p ON (ac.parts_id = p.id)
JOIN chart c on (p.income_accno_id = c.id)
$dpt_join
- -- use transdate from subwhere
- WHERE 1 = 1 $subwhere
+ WHERE 1 = 1 $prwhere
AND c.category = 'I'
$dpt_where
AND ac.trans_id IN
JOIN parts p ON (ac.parts_id = p.id)
JOIN chart c on (p.expense_accno_id = c.id)
$dpt_join
- WHERE 1 = 1 $subwhere
+ WHERE 1 = 1 $prwhere
AND c.category = 'E'
$dpt_where
AND ac.trans_id IN
JOIN parts p ON (ac.parts_id = p.id)
JOIN chart c on (p.income_accno_id = c.id)
$dpt_join
- -- use transdate from subwhere
- WHERE 1 = 1 $subwhere
+ WHERE 1 = 1 $prwhere
AND c.category = 'I'
$dpt_where
$project
JOIN parts p ON (ac.parts_id = p.id)
JOIN chart c on (p.expense_accno_id = c.id)
$dpt_join
- WHERE 1 = 1 $subwhere
+ WHERE 1 = 1 $prwhere
AND c.category = 'E'
$dpt_where
$project