<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Invoice V1</title>
	{{ HTML::style('css/installment.css') }}
    <style media="print">
    @page {
        size: A4;
        margin-top: 10px !important;
        margin: 10px;
        margin-left: 10px;

    }
    body { font-size: 12px !important; color: #000 !important; }
    img { width: 150px !important; }
    hr { border-color: #333333!important; margin-top: 0; margin-bottom: 0;}
        /*.table-nobordered { border: 1px solid #333333 !important; }*/
        .table-nobordered th, .table-nobordered td { border: 0 !important;  padding: 5px; color: #000 !important;}
        .table-nobordered { margin-bottom: 5px; }
        table, th, td { border-color: #333333 !important; padding: 5px !important; color: #000 !important;}
        th { border-bottom-width: 1px !important;}
        h2 { font-family: "Khmer OS Muol";}
        h2, h3, p { text-align: center; }
        h2 { font-size: 22px !important; margin-bottom: 5px !important; }
        h3 { font-size: 18px !important; margin-top: 0 !important; }
        p { margin: 5px !important; color: #000 !important;}
        table.table-paid{
            border: 1px solid #333;
        }
        table th { font-weight: bold !important; }
        .table-paid th, .table-paid td{
            border: 1px solid #333;
        }
        .table-paid tr td:last-child{
            border-right: none;
        }
        .strike-trough{
            position: relative;
        }
        .strike-trough:after{
            content: '';
            display: block;
            border-bottom: 1px solid #333;
            right: 0;
            position: absolute;
            left: 0;
            padding-top: 20px;
            margin-left: 15px;
            margin-right: 15px;
        }
        .logo { padding-top: 30px; padding-bottom: 40px; }
    </style>
    <style>
        hr { border-color: #333333!important; margin-top: 0; margin-bottom: 0;}
        /*.table-nobordered { border: 1px solid #333333 !important; }*/
        .table-nobordered th, .table-nobordered td { border: 0 !important; }
        table, th, td { border-color: #333333 !important;}
        th { border-bottom-width: 1px !important;}
        h2 { font-family: "Khmer OS Muol";}
        h2, h3, p { text-align: center; }
        table.table-paid{
            border: 1px solid #333;
        }
        .table-paid th, .table-paid td{
            border: 1px solid #333;
        }
        .table-paid tr td:last-child{
            border-right: none;
        }
        .strike-trough{
            position: relative;
        }
        .strike-trough:after{
            content: '';
            display: block;
            border-bottom: 1px solid #333;
            right: 0;
            position: absolute;
            left: 0;
            padding-top: 20px;
            margin-left: 15px;
            margin-right: 15px;
        }
        .logo { padding-top: 30px; padding-bottom: 40px; }
		.company_banner {
			padding: 5px;}
		.installment-title { border-bottom: 1px solid #000; padding-bottom: 5px; }
        .header { text-align: center;}
        .header p { margin-bottom: 5px !important;}
		{{ get_config("custom_style") }}
    </style>
</head>

<body>
	<div class="container-fluid">
		<div class="row">
			<div class="col-xs-3" >
				{{ HTML::image(get_config('company_logo'), "Logo", ['width' => '200px;', 'class' => 'logo'])}}
			</div>
			<div class="col-xs-6">
				<div class="header">
                    <h2>{{ get_config('company_name') }}</h2>
                    <h3 style="margin-top: 10px; text-transform: uppercase;">{{ get_config('company_name_en') }}</h3>
                    <p>{{ get_config('company_detail') }}</p>
                    <p>{{ get_config('company_address')}}</p>
                    <p>{{ get_config('company_tel')}}</p>
                    @if (get_config('company_facebook'))
                        <p>Facebook: {{ get_config("company_facebook") }}</p>
                    @endif
                </div>
			</div>
		</div>

		<div class="row">
			<div class="col-xs-12">
				<h3 class="text-left installment-title">{{ trans('installments.menu') }}</h3>
				<table class="table table-nobordered">
					<tr>
						<th style="width: 15%;">{{ trans('installments.code') }}</th>
						<td>{{ convertInvoiceNumber($installment->id) }}</td>
						<th style="width: 15%;">{{ trans('installments.user') }}</th>
						<td style="width: 15%;">{{ $installment->first_name }} {{ $installment->last_name }}</td>
					</tr>
					<tr>
						<th>{{ trans('installments.date') }}</th>
						<td>{{ get_day_week($installment->created_at)}} {{ format_date_installment($installment->created_at) }}</td>
					</tr>
				</table>
				<table class="table table-nobordered">
					<tr>
						<th>{{ trans('installments.customer_name') }}</th>
						<td>{{ $installment->full_name_kh }}</td>
						<th>{{ trans('installments.product_name') }}</th>
						<td>{{ $installment->product_name }}</td>
						<th>{{ trans('installments.duration') }}</th>
						<td>{{ $installment->duration }}</td>
					</tr>
					<tr>
						<th>{{ trans('customers.sex') }}</th>
						<td>{{ trans('customers.gender.'.$installment->gender)}}</td>
						<th>{{ trans('installments.total_price') }}</th>
						<td>{{ money($installment->total_price) }}</td>
						<th>{{ trans('installments.principal')}}</th>
						<td>{{ money($installment->getMonthlyPriciple())}}</td>
					</tr>
					<tr>
						<th>{{ trans('customers.tel') }}</th>
						<td>{{ $installment->tel }}</td>
						<th>{{ trans('installments.deposit') }}</th>
						<td>{{ money($installment->deposit) }}</td>
						<th>{{ trans('installments.total_pay')}}</th>
						<td>{{ money($installment->getFutureValue() )}}</td>
					</tr>
					<tr>
						<th></th>
						<td></td>
						{{-- <th>{{ trans('installments.rate') }}</th>
						<td>{{ $installment->rate }}%</td> --}}
						<th>{{ trans('installments.pay_of_day') }}</th>
						<td>{{ get_day_week($payOffDay->payment_date)}} {{ $payOffDay->displayDate() }}</td>
					</tr>
				</table>
		<table class="table table-paid">
					<thead>
              <tr>
                  <th style="width: 5%;">{{ trans('installments.id') }}</th>
                  <th colspan="2" style="width: 25%;">{{ trans('installments.date_payment')}}</th>
                  <th style="width: 15%;">{{ trans('installments.monthly_payment') }}</th>
                  <th style="width: 15%;">{{ trans('installments.payment_name') }}</th>
                  <th style="width: 15%;">{{ trans('installments.reciever_name') }}</th>
                  <th style="width: 15%;">{{ trans('installments.others') }}</th>
              </tr>
           </thead>
           <tbody>
           	@if (count($payments) > 0)
           		<?php $i = 1; ?>
           		@foreach ($payments as $pay)
           		<tr>
           			<td>{{ $i }}</td>
           			<td style="width: 10%;">{{ get_day_week($pay->payment_date) }}</td>
                    <td>{{ format_date_installment($pay->payment_date) }}</td>
           			<td>{{ money($pay->amount) }}</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
           			<td>&nbsp;</td>
           		</tr>
           		<?php $i++; ?>
           		@endforeach
           	@endif
           </tbody>
				</table>
        <p class="text-left">{{ get_config("invoice_client_note ")}}</p>
			</div>
		</div>
	</div>
   
</body>
<script>
	window.print();
</script>
@if (get_config('auto_close_print') == 'yes')
<script>
    window.close();
</script>
@endif
</html>
