get(); $data['title']='Expense Report'; return view('admin.acc_report.expense_report',$data); } function expense_report(Request $req) { $from=$req->get('from_date'); $to=$req->get('to_date'); $acc_head=$req->get('acc_head'); if(empty($from) || empty($to)){ return ''; } $sql="SELECT ahd.name,j.* FROM journal j JOIN acc_head ahd ON j.ref_id=ahd.id WHERE DATE(j.created_at) >= '{$from}' AND DATE(j.created_at) <= '{$to}' AND ahd.type_id=2"; if(!empty($acc_head)) { $sql.=" AND ref_id={$acc_head} "; } $sql.=" order by j.id desc"; $report_data=\DB::select($sql); $str=""; $str.="

Expense Report

"; $str.="
From {$from} To {$to}
"; $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; if($report_data) { $i=1; $amnt=0; foreach($report_data as $row) { $str.=""; $str.=""; $dt=date('d M, Y',strtotime($row->created_at)); $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; $amnt+= $row->amount; $str.=""; $i++; } $str.=""; $str.=""; $amnt=number_format($amnt,2,'.',''); $str.=""; $str.=""; }else{ $str.=""; $str.=""; $str.=""; } $str.=""; $str.="
Sl.DateExpense NameDescriptionDocumentAmount
{$i}{$dt}{$row->name}{$row->description}expense_document)."' target='_blank'>{$row->expense_document}{$row->amount}
Total{$amnt}
No Record Found !
"; return $str; } function revenue_report_view() { $data['companies']=CompanyModel::where('status',2)->orderBy('name')->get(['id','name']); $data['credit_heads']=AccountHead::where('type_id',4)->get(); $data['title']='Revenue Report'; return view('admin.acc_report.revenue_report',$data); } function revenue_report(Request $req) { $from=$req->get('from_date'); $to=$req->get('to_date'); $client=$req->get('client'); $acc_head=$req->get('acc_head'); if(empty($from) || empty($to)){ return ''; } $sql="SELECT ahd.name,j.* FROM journal j JOIN acc_head ahd ON j.ref_id=ahd.id WHERE DATE(j.created_at) >= '{$from}' AND DATE(j.created_at) <= '{$to}' "; if(!empty($client)) { $sql.=" AND client_id={$client} "; } if(!empty($acc_head)) { $sql.=" AND ref_id={$acc_head} "; } $sql.=" AND ahd.type_id=4 order by j.id desc"; $report_data=\DB::select($sql); $str=""; $str.="

Revenue Report

"; $str.="
From {$from} To {$to}
"; $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; $str.=""; if($report_data) { $i=1; $amnt=0; foreach($report_data as $row) { $str.=""; $str.=""; $dt=date('d M, Y',strtotime($row->created_at)); $str.=""; if($row->client_id != 0){ $client_info=User::with(['company_data'])->find($row->client_id); $client_name=$client_info->company_data?$client_info->company_data->name:'Not Found'; }else{ $client_name = 'None'; } $str.=""; $str.=""; $str.=""; $str.=""; $amnt+= $row->amount; $str.=""; $i++; } $str.=""; $str.=""; $amnt=number_format($amnt,2,'.',''); $str.=""; $str.=""; }else{ $str.=""; $str.=""; $str.=""; } $str.=""; $str.="
Sl.DateClient NamePurposeDescriptionAmount
{$i}{$dt}{$client_name}{$row->name}{$row->description}{$row->amount}
Total{$amnt}
No Record Found !
"; return $str; } }