<?php

error_reporting(0);
$cekid = new cekID();
$crud = new crudData();
$jmldata = $cekid->Cek($payment_list, 'payment_id', $id_page);

$status = $crud->getValue($payment_list, "where payment_id='$id_page'", 'status');

if ($status == "PAID") {
    $tb_transaksi = $tb_transaksi;
} else {
    $tb_transaksi = 'payment_list_detail';
};

$editUser = $crud->editData($tb_transaksi, 'id_tr', $id_page);
$data = $editUser->fetch(PDO::FETCH_OBJ);
$nis = $data->nis;
if ($data->startAt == "") {
    $startAt = 1;
} else {
    $startAt = $data->startAt;
};
date_default_timezone_set('Asia/Jakarta');
$time = date('Y-m-d H:i:s');


$id_tr = $id_page;
$format = new format;
//Data sekolah
$sekolah = new sekolah;
$sekolah_nama_kuitansi = $sekolah->dataSekolah('nama_kuitansi');
$sekolah_model_kw = $sekolah->dataSekolah('model_kw');


//Jumlah Kuitansi
$classTransaksi = new transaksi();
$jmlKuitansi = $crud->sum($tb_transaksi, 'jumlah', "where id_tr='$id_tr'");

if ($sekolah_model_kw == 4) {
    $persenmodel = 41;
} else {
    $persenmodel = 80;
};

include "print_2.php";
?>
<style>
    .fontInput {
        font-size: 11px;
        font-family: arial;
    }

    .fontJudul {
        font-size: 12px;
        font-family: arial;
        color: dodgerblue;
        background: #000;

    }
</style>
<div class="content-wrapper">

    <!-- Main content -->
    <section class="content">
        <div class="container">
            <!-- Info boxes -->

            <!-- /.row -->
            <div class="row mt-5">
                <div class="col-md-12  mt-5">


                    <div class="timeline-header bg-secondary pt-2 pb-2">
                        <b class="text-light judul my-3 ml-3 "><span class="bi bi-printer"></span> Cetak Kuitansi</b>
                    </div>
                    <div class="card-body mb-1">
                        <form action="" method="post">
                            <input type="text" name="id" value="<?php echo $data->id; ?>" hidden>
                            <input type="text" name="nis" value="<?php echo $data->nis; ?>" hidden>
                            <input type="text" name="nama" value="<?php echo $data->nama; ?>" hidden>
                            <input type="text" name="kelamin" value="<?php echo $data->kelamin; ?>" hidden>
                            <input type="text" name="jenjang" value="<?php echo $data->jenjang; ?>" hidden>
                            <input type="text" name="paralel" value="<?php echo $data->paralel; ?>" hidden>
                            <input type="text" name="id_tr" value="<?php echo $id_tr; ?>" hidden>
                            <div class="row mx-3 mt-0">

                                <div class="col-md-6">
                                    <div class="card-body mt-0 px-1 mx-2">
                                        <div class="row">
                                            <label for="nis" class="col-sm-4 col-form-label">ID-Transaksi</label>
                                            <div class="col-sm-8">
                                                <input type="text" class="form-control form-control-sm fontInput" value="<?php echo $data->id_tr; ?>" placeholder="" name="hp" disabled>
                                            </div>
                                        </div>

                                        <div class="row">
                                            <label for="nis" class="col-sm-4 col-form-label">Jumlah</label>
                                            <div class="col-sm-8">
                                                <input type="text" class="form-control form-control-sm fontInput text-primary" value="<?php echo @(number_format($jmlKuitansi, 0, ".", "."));; ?>" style='text-align:left;font-size:16px;font-weight:bold' disabled>
                                            </div>
                                        </div>

                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="card-body mt-0 px-1 mx-2">

                                        <div class="row">
                                            <label for="nis" class="col-sm-4 col-form-label">Tanggal</label>
                                            <div class="col-sm-8">
                                                <input type="email" class="form-control form-control-sm fontInput" value="<?php echo $format->dateTimeToIndo($time); ?>" placeholder="email@mail.com" name="email" disabled>
                                            </div>
                                        </div>


                                    </div>
                                </div>
                                <div class="row col-12 pl-4 mb-2">
                                    <a <?php echo $link->page('payment/payment_read'); ?> class="btn btn-primary btn-xs float-right mx-1 px-2"><i class="bi-arrow-left-circle"></i> Kembali</a>
                                </div>
                                <div class="col-md-12">

                                    <div class='col-md-12 pl-3 ml-2' style='background:#c3c3c3;  padding-top:50px; padding-bottom:50px'>
                                        <div class="mb-2" style='background:#fff; width:85%; margin:0 auto; padding:5px; height:600px;'>


                                            <iframe name='cetak' src='view/transaksi/kuitansi.pdf' style='border:0; padding:10px; width:100%; height:550px;'></iframe>

                                        </div>
                                    </div>
                                </div>
                            </div>

                        </form>
                    </div>

                </div>
            </div>

        </div>
</div>