PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` date_range) { $x = 1; $delim = ' - '; $str = $request->date_range; $parts = explode($delim,$str); $string1 = implode($delim,array_slice($parts,0,$x)) . $delim; $string2 = implode($delim,array_slice($parts,$x)); $string2 = date("y-m-d", strtotime($string2)); $string1 = date("y-m-d", strtotime($string1)); $sales = Sale::whereBetween('created_at', [$string1, $string2])->sum('paid'); $land_installment = installment::whereBetween('created_at', [$string1, $string2])->sum('amount'); $purchase = LandPurchase::whereBetween('created_at', [$string1, $string2])->sum('paid_amount'); $ref_with = ReferenceWithdraw::whereBetween('created_at', [$string1, $string2])->sum('amount'); $expence = Expence::whereBetween('created_at', [$string1, $string2])->sum('amount'); $purchase_installment = purchaseInstallment::whereBetween('created_at', [$string1, $string2])->sum('amount'); $total_income = $sales + $land_installment; $total_expense = $purchase + $ref_with + $expence + $purchase_installment; } else { $sales = Sale::whereDate('created_at', Carbon::today())->sum('paid'); $land_installment = installment::whereDate('created_at', Carbon::today())->sum('amount'); $purchase = LandPurchase::whereDate('created_at', Carbon::today())->sum('paid_amount'); $ref_with = ReferenceWithdraw::whereDate('created_at', Carbon::today())->sum('amount'); $expence = Expence::whereDate('created_at', Carbon::today())->sum('amount'); $purchase_installment = purchaseInstallment::whereDate('created_at', Carbon::today())->sum('amount'); $total_income = $sales + $land_installment; $total_expense = $purchase + $ref_with + $expence + $purchase_installment; } $company = Company::latest()->first(); return view('report.cashbook', compact('company', 'sales', 'land_installment', 'purchase', 'purchase_installment', 'ref_with', 'expence', 'total_income', 'total_expense')); } }