@extends('layouts.print')
<style>
    .h5, h5 {
        font-size: 18px !important;
    }
    td, body:lang(en) {
        font-size: 18px !important;
    }
</style>
@section('content')
    <div class="main-content-wrapper">
        <div class="main-box">
            <div class="main-content">
                <div class="container">
                    <div class="page">
                        <div class="row">
                            <div class="report-capital layout-print">
                                <div class="header">
                                    <div class="logo">
                                    </div>
                                    <div class="title">
                                        <h2>{{!empty($projects->project_name)?$projects->project_name:'Green Zone'}}</h2>
                                        <h3>Voucher សក្ខីប័ត្រ</h3>
                                    </div>
                                    <div class="clear"></div>
                                    <div class="border-bottom"></div>
                                    <div class="voucher-header">
                                        <div class="voucher-header-title">
                                            <label for="">VOUCHER REF#: {{$data[0]->voucher_ref}}</label><br>
                                            <label for="">DATE: {{date('d M Y',strtotime($data[0]->journal_transactiondate))}}</label>
                                        </div>
                                    </div>
{{--                                    <div class="voucher-box">--}}
{{--                                        <div class="voucher-box-left">--}}
{{--                                            <div class="voucher-purpose">--}}
{{--                                                <h5 class="voucher-title">Voucher Type : Tick ប្រភេទសក្ខីប័ត្រ</h5>--}}
{{--                                            </div>--}}
{{--                                        </div>--}}
{{--                                        <div class="voucher-box-right">--}}
{{--                                        </div>--}}
{{--                                    </div>--}}
                                    <br>
                                    <div class="table">
                                        <table>
                                            <thead>
                                            <tr>
                                                <b><th>DATE ថ្ងៃខែឆ្នាំ</th>
                                                    <th>ACCOUNT NAME ឈ្មោះគណនី</th>
                                                    <th>DESCRIPTION បរិយាយ</th>
                                                    <th>ACCOUNT # លេខគណនី</th>
                                                    <th>DEBIT</th>
                                                    <th>CREDIT</th></b>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            @php
                                                $total_debit = 0;
                                                $total_credit = 0;
                                            @endphp
                                            @foreach($data as $key => $list)
                                                <?php
                                                $total_credit += $list->journal_credit;
                                                $total_debit += $list->journal_debit;
                                                ?>
                                                <tr>
                                                    <td class="center">{{date("d-m-Y",strtotime($list->journal_paydate))}}</td>
                                                    <td>{{$list->acc_name}}</td>
                                                    <td>{{$list->journal_des}}</td>
                                                    <td>{{$list->journal_acccode}}</td>
                                                    <td class="right">{{$list->journal_debit<0?number_format(abs($list->journal_debit),2):number_format($list->journal_debit,2)}}</td>
                                                    <td class="right">{{$list->journal_credit<0?number_format(abs($list->journal_credit),2):number_format($list->journal_credit,2)}}</td>
                                                </tr>
                                            @endforeach
                                            </tbody>
                                            <tfoot>
                                            <tr class="no-border">
                                                <td colspan="4" class="no-border footer-text-right">TOTAL</td>
                                                <td class="double-bb footer-text-right">{{number_format($total_debit,2)}}</td>
                                                <td class="double-bb footer-text-right">{{number_format($total_credit,2)}}</td>
                                            </tr>
                                            </tfoot>

                                        </table>
                                        <div class="make-date">
                                            <p>ធ្វើនៅ​ <strong>ភ្នំពេញ  </strong>  <strong>{{\Globals::date_khmers(date('d M Y',strtotime($data[0]->journal_transactiondate)))}}</strong></p>
                                        </div>
                                        <div class="row">
                                            <div class="col-lg-12 col-sm-12 col-xs-12 tt">
                                                <div class="col-lg-4 col-sm-4 col-xs-4">
                                                    <p>អ្នកធ្វើបញ្ជី</p>
                                                    <p>{{!empty($user->username)?$user->username:'_________________'}}</p>
                                                </div>
                                                <div class="col-lg-4 col-sm-4 col-xs-4">
                                                    <p>អ្នកពិនិត្យ</p>
                                                    <p>_________________</p>
                                                </div>
                                                <div class="col-lg-4 col-sm-4 col-xs-4">
                                                    <p>ឯកភាព</p>
                                                    <p>_________________</p>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <style>
        .container {
            width: 420mm !important;
            margin-top: 10px;
        }

        .voucher-box .voucher-box-left,
        .voucher-box-right {
            -webkit-box-flex: 1;
            -moz-box-flex: 1;
            -webkit-flex: 1;
            -ms-flex: 1;
            flex: 1;
        }

        .voucher-box {
            display: -webkit-box;
            display: -moz-box;
            display: -webkit-flexbox;
            display: -ms-flexbox;
            display: -webkit-flex;
            display: flex;
        }

        .voucher-box .voucher-box-left .voucher-purpose {
            height: 30px;
        }

        .voucher-box .voucher-box-left .voucher-purpose-detail {
            /*border: 1px solid #bbb;*/
            padding: 1em;
            height: calc(100% - 40px);
            border-right: none;
        }

        /*.voucher-box .voucher-box-right {*/
        /*    border: 1px solid #bbb;*/
        /*}*/

        .voucher-box .voucher-box-right .voucher-type .voucher-title {
            padding-top: 10px;
            padding-bottom: 10px;
            text-align: center;
            font-weight: bolder;
        }

        .voucher-box .voucher-box-right .voucher-type-list input {
            width: 10%;
        }

        .voucher-box .voucher-box-right .voucher-type-list .voucher-list {
            padding: 0;
        }

        .footer-text-right {
            text-align: right;
            padding-right: 10% !important;
            font-size: 20px !important;
            font-weight: bold !important;
        }

        .no-border {
            border: none !important;
        }

        .double-bb {
            border-bottom-style: double !important;
            border-bottom-width: 3px !important;
        }

        .voucher-header {
            width: 100%;
        }

        .voucher-header .voucher-header-title {
            text-align: right;
            margin-bottom: 20px;
        }
    </style>
@endsection