wip
This commit is contained in:
@@ -147,6 +147,7 @@ class DownloadCardTransaction extends Action
|
|||||||
// Write HTML content...
|
// Write HTML content...
|
||||||
$html = Blade::render('orders.cards.card-transaction.download-card-transaction', [
|
$html = Blade::render('orders.cards.card-transaction.download-card-transaction', [
|
||||||
'data' => $data,
|
'data' => $data,
|
||||||
|
'extra' => $this->getExtraVariables($data),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$mpdf->WriteHTML($html);
|
$mpdf->WriteHTML($html);
|
||||||
@@ -154,4 +155,36 @@ class DownloadCardTransaction extends Action
|
|||||||
// Save the PDF to a file...
|
// Save the PDF to a file...
|
||||||
$mpdf->Output($fileDest, \Mpdf\Output\Destination::FILE);
|
$mpdf->Output($fileDest, \Mpdf\Output\Destination::FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ResponseTypes\AzatApiClientInfoAllResponse $data
|
||||||
|
*/
|
||||||
|
public function getExtraVariables($data)
|
||||||
|
{
|
||||||
|
if (count($data->transactions) < 1) {
|
||||||
|
return emptyClass(basdakyGalyndy: 0, ahyrkyGalyndy: 0, girdeji: 0, cykdajy: 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$basdakyGalyndy = $data->transactions[0]->balsum;
|
||||||
|
$basdakyTransaksiya = $data->transactions[0]->opersum;
|
||||||
|
$sonkyGalyndy = $data->transactions[count($data->transactions) - 1]->balsum;
|
||||||
|
|
||||||
|
$positive = 0;
|
||||||
|
$negative = 0;
|
||||||
|
for ($i = 0; $i < count($data->transactions); $i++) {
|
||||||
|
// Positive...
|
||||||
|
if ($data->transactions[$i]->balsum > 0) {
|
||||||
|
$positive += $data->transactions[$i]->balsum;
|
||||||
|
} else {
|
||||||
|
$negative += $data->transactions[$i]->balsum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return emptyClass(
|
||||||
|
basdakyGalyndy: $basdakyGalyndy - ($basdakyTransaksiya),
|
||||||
|
ahyrkyGalyndy: $sonkyGalyndy,
|
||||||
|
girdeji: $positive,
|
||||||
|
cykdajy: $negative
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ use App\Modules\DateHelper\Repositories\DateHelperRepository;
|
|||||||
use App\Nova\Resource;
|
use App\Nova\Resource;
|
||||||
use App\Nova\Resources\Order\Card\CardTransaction\Actions\DownloadCardTransaction;
|
use App\Nova\Resources\Order\Card\CardTransaction\Actions\DownloadCardTransaction;
|
||||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
use Laravel\Nova\Fields\Hidden;
|
use Laravel\Nova\Fields\Hidden;
|
||||||
use Laravel\Nova\Fields\ID;
|
use Laravel\Nova\Fields\ID;
|
||||||
use Laravel\Nova\Fields\Select;
|
use Laravel\Nova\Fields\Select;
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
<p>{{ $data->fromDate }} - {{ $data->toDate }} aralygy üçin</p>
|
<p>{{ $data->fromDate }} - {{ $data->toDate }} aralygy üçin</p>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<p>Başdaky galyndy: <strong> ---YOK--- </strong></p>
|
<p>Başdaky galyndy: <strong> {{ $extra->basdakyGalyndy }} </strong></p>
|
||||||
<p>Ahyrky galyndy: <strong> ---YOK--- </strong></p>
|
<p>Ahyrky galyndy: <strong> {{ $extra->ahyrkyGalyndy }} </strong></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
@@ -57,8 +57,8 @@
|
|||||||
|
|
||||||
<div class="summary">
|
<div class="summary">
|
||||||
<p>Aralyk boýunça hereket:</p>
|
<p>Aralyk boýunça hereket:</p>
|
||||||
<p>Girdeji: <strong>---YOK---</strong></p>
|
<p>Girdeji: <strong>{{ $extra->girdeji }}</strong></p>
|
||||||
<p>Çykdajy: <strong>---YOK---</strong></p>
|
<p>Çykdajy: <strong>{{ $extra->cykdajy }}</strong></p>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user