|
|
@@ -484,7 +484,7 @@ Route::get('/get_record_in', function () {
|
|
|
->leftJoin('receipts', 'records.id', '=', 'receipts.record_id')
|
|
|
->where('records.type', 'IN');
|
|
|
|
|
|
- $y = \App\Models\Record::select('records_rows.record_id', 'records_rows.amount', 'records.member_id', 'records.corrispettivo_fiscale', 'records.commercial', 'records.deleted', 'records.financial_movement', 'records_rows.causal_id', DB::raw('members.first_name as first_name'), DB::raw('members.last_name as last_name')) // , \DB::raw('SUM(records.id) As total'))
|
|
|
+ $y = \App\Models\Record::select('records_rows.record_id', 'records_rows.amount', 'records.member_id', 'records.corrispettivo_fiscale', 'records.commercial', 'records.deleted', 'records.financial_movement', 'records_rows.causal_id', 'records.payment_method_id', DB::raw('members.first_name as first_name'), DB::raw('members.last_name as last_name')) // , \DB::raw('SUM(records.id) As total'))
|
|
|
->leftJoin('members', 'records.member_id', '=', 'members.id')
|
|
|
->leftJoin('records_rows', 'records.id', '=', 'records_rows.record_id')
|
|
|
//->leftJoin('receipts', 'records.id', '=', 'receipts.record_id')
|
|
|
@@ -589,6 +589,8 @@ Route::get('/get_record_in', function () {
|
|
|
}
|
|
|
|
|
|
$excludeCausals = [];
|
|
|
+ $causale_movimento_finanziario = \App\Models\Causal::where('name', "MOVIMENTO FINANZIARIO ENTRATA")->where('type', "IN")->pluck('id')->toArray();
|
|
|
+ $excludeCausals = $causale_movimento_finanziario;
|
|
|
/*$borsellino = \App\Models\Causal::where('money', true)->first();
|
|
|
if ($borsellino)
|
|
|
$excludeCausals[] = $borsellino->id;*/
|
|
|
@@ -607,7 +609,8 @@ Route::get('/get_record_in', function () {
|
|
|
$moneys = \App\Models\PaymentMethod::where('money', true)->pluck('id')->toArray();
|
|
|
|
|
|
// Causale money
|
|
|
- $moneysCausal = \App\Models\Causal::where('money', true)->pluck('id')->toArray();
|
|
|
+ // $moneysCausal = \App\Models\Causal::where('money', true)->pluck('id')->toArray();
|
|
|
+ $moneysCausal = [];
|
|
|
|
|
|
$total = 0;
|
|
|
|
|
|
@@ -768,12 +771,18 @@ Route::get('/get_record_out', function () {
|
|
|
$hasFilter = true;
|
|
|
}
|
|
|
|
|
|
+ $excludeCausals = [];
|
|
|
+ $causale_movimento_finanziario = \App\Models\Causal::where('name', "MOVIMENTO FINANZIARIO USCITA")->where('type', "OUT")->pluck('id')->toArray();
|
|
|
+ $excludeCausals = $causale_movimento_finanziario;
|
|
|
+
|
|
|
$total = 0;
|
|
|
foreach ($x->get() as $r) {
|
|
|
foreach ($r->rows as $rr) {
|
|
|
- $total += $rr->amount;
|
|
|
- if ($rr->vat_id > 0)
|
|
|
- $total += getVatValue($rr->amount, $rr->vat_id);
|
|
|
+ if (!in_array($rr->causal_id, $excludeCausals)) {
|
|
|
+ $total += $rr->amount;
|
|
|
+ if ($rr->vat_id > 0)
|
|
|
+ $total += getVatValue($rr->amount, $rr->vat_id);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|