public function SummarySubmit() { $start = date('Y-m-d', strtotime(Input::get('start'))); $end = date('Y-m-d', strtotime(Input::get('end'))); $date_today = date('Y-m-d'); $prCount = 0; $POCount = 0; $chequeCount = 0; if ($end == '1970-01-01' && $start == '1970-01-01') { $end = '9998-01-01'; $start = '0001-01-01'; $reports = Reports::whereBetween('date', array($start, $end))->get(); foreach ($reports as $report) { $prCount = $prCount + $report->pRequestCount; $POCount = $POCount + $report->pOrderCount; $chequeCount = $chequeCount + $report->chequeCount; } $data = array("inner-fragments" => array("#PR" => "\n\t\t\t\t\t<span class='summary-panel-title'><strong>Total Number of PR Received:</strong></span><br/>\n\t <span class='summary-amount' style='color: #246D27'> {$prCount} </span>\n\t\t\t\t", "#PO" => "\n\t\t\t\t\t<span class='summary-panel-title'><strong>Total Number of PO Received:</strong></span><br/>\n\t <span class='summary-amount' style='color: #4E3A17'> {$POCount} </span>\n\t\t\t\t", "#Cheque" => "\n\t\t\t\t\t<span class='summary-panel-title'><strong>Total Number of Cheque Received:</strong></span><br/>\n\t <span class='summary-amount' style='color: #1B4F69'> {$chequeCount} </span>\n\t\t\t\t", "#dateReport" => "\n\t\t\t\t\t<div id='dateReport' class='alert alert-info'>\n\t\t\t <p>Summary Reports from beginning to {$date_today}.</p>\n\t\t\t </div>\n\t\t\t\t")); return Response::json($data); } else { if ($end == '1970-01-01') { $end = '9998-01-01'; $reports = Reports::whereBetween('date', array($start, $end))->get(); foreach ($reports as $report) { $prCount = $prCount + $report->pRequestCount; $POCount = $POCount + $report->pOrderCount; $chequeCount = $chequeCount + $report->chequeCount; } $data = array("inner-fragments" => array("#PR" => "\n\t\t\t\t\t<span class='summary-panel-title'><strong>Total Number of PR Received:</strong></span><br/>\n\t <span class='summary-amount' style='color: #246D27'> {$prCount} </span>\n\t\t\t\t", "#PO" => "\n\t\t\t\t\t<span class='summary-panel-title'><strong>Total Number of PO Received:</strong></span><br/>\n\t <span class='summary-amount' style='color: #4E3A17'> {$POCount} </span>\n\t\t\t\t", "#Cheque" => "\n\t\t\t\t\t<span class='summary-panel-title'><strong>Total Number of Cheque Received:</strong></span><br/>\n\t <span class='summary-amount' style='color: #1B4F69'> {$chequeCount} </span>\n\t\t\t\t", "#dateReport" => "\n\t\t\t\t\t<div id='dateReport' class='alert alert-info'>\n\t\t\t <p>Summary Reports {$start} to {$date_today}.</p>\n\t\t\t </div>\n\t\t\t\t")); return Response::json($data); } else { if ($start == '1970-01-01') { $start = '0001-01-01'; $reports = Reports::whereBetween('date', array($start, $end))->get(); foreach ($reports as $report) { $prCount = $prCount + $report->pRequestCount; $POCount = $POCount + $report->pOrderCount; $chequeCount = $chequeCount + $report->chequeCount; } $data = array("inner-fragments" => array("#PR" => "\n\t\t\t\t\t<span class='summary-panel-title'><strong>Total Number of PR Received:</strong></span><br/>\n\t <span class='summary-amount' style='color: #246D27'> {$prCount} </span>\n\t\t\t\t", "#PO" => "\n\t\t\t\t\t<span class='summary-panel-title'><strong>Total Number of PO Received:</strong></span><br/>\n\t <span class='summary-amount' style='color: #4E3A17'> {$POCount} </span>\n\t\t\t\t", "#Cheque" => "\n\t\t\t\t\t<span class='summary-panel-title'><strong>Total Number of Cheque Received:</strong></span><br/>\n\t <span class='summary-amount' style='color: #1B4F69'> {$chequeCount} </span>\n\t\t\t\t", "#dateReport" => "\n\t\t\t\t\t<div id='dateReport' class='alert alert-info'>\n\t\t\t <p>Summary Reports from beginning to {$end}.</p>\n\t\t\t </div>\n\t\t\t\t")); return Response::json($data); } else { $reports = Reports::whereBetween('date', array($start, $end))->get(); foreach ($reports as $report) { $prCount = $prCount + $report->pRequestCount; $POCount = $POCount + $report->pOrderCount; $chequeCount = $chequeCount + $report->chequeCount; } $data = array("inner-fragments" => array("#PR" => "\n\t\t\t\t\t<span class='summary-panel-title'><strong>Total Number of PR Received:</strong></span><br/>\n\t <span class='summary-amount' style='color: #246D27'> {$prCount} </span>\n\t\t\t\t", "#PO" => "\n\t\t\t\t\t<span class='summary-panel-title'><strong>Total Number of PO Received:</strong></span><br/>\n\t <span class='summary-amount' style='color: #4E3A17'> {$POCount} </span>\n\t\t\t\t", "#Cheque" => "\n\t\t\t\t\t<span class='summary-panel-title'><strong>Total Number of Cheque Received:</strong></span><br/>\n\t <span class='summary-amount' style='color: #1B4F69'> {$chequeCount} </span>\n\t\t\t\t", "#dateReport" => "\n\t\t\t\t\t<div id='dateReport' class='alert alert-info'>\n\t\t\t <p>Summary Reports from {$start} to {$end}.</p>\n\t\t\t </div>\n\t\t\t\t")); return Response::json($data); } } } }