<?php include('techsyn_header.php'); ?>
<!-- Main Content Container for side bar and body-->
<div class="main-container ace-save-state" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.loadState('main-container')
        } catch (e) {}
    </script>
    <?php include('techsyn_sidebar.php'); ?>

    <!--breadcrumb-->
    <div class="main-content">
        <div class="main-content-inner">
            <div class="breadcrumbs ace-save-state" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li>
                        <i class="ace-icon fa fa-home home-icon"></i>
                        <a href="#">Home</a>
                    </li>
                    <li class="#">Patient Visit</li>
                    <li class="active">Pending INJURY LIST</li>
                </ul>
            </div>
            <!-- End of breadcrumb -->


            <div>

                <form name="f1" method="post" action="" id="flex_form_unit">
                    <div id="flex1" style="width:100%">
                    </div>
                    <input type="hidden" name="flex_unit_id" id="flex_unit_id" />
                </form>
                <form name="export_form" method="post" id="export_form" action="">
                    <input type="hidden" name="flex_employee_appointment_id" id="flex_employee_appointment_id" />
                    <input type="hidden" name="pdf_action" id="pdf_action" value="pdf_pending_medical_disbursment_list.php" />
                    <input type="hidden" name="excel_action" id="excel_action" value="excel_sickness.php" />
                </form>

                <form name="flex_appointment_form" method="post" id="flex_appointment_form" action="">
                    <input type="hidden" name="appointmentId" id="appointmentId" /> <input type="hidden" name="flex_opd_id" id="flex_opd_id" /> <input type="hidden" name="returnPage" id="returnPage" />
                </form>
            </div>



        </div><!-- /.page-content -->
    </div>
</div><!-- /.main-content -->
<script>
    $(function() {

        var w = screen.width * .90;

        var w = screen.width * .90;
        var h = 0;
        h = (window.innerHeight - ($("#navbar").height() + $(".breadcrumbs").height())) * .75;
        $("#flex1").flexigrid({
            url: 'pending_injury_list_script.php',

            dataType: 'json',
            colModel: [{
                    display: '',
                    name: 'link',
                    width: w * .06,
                    sortable: true,
                    align: 'left'
                },
                {
                    display: 'Sr',
                    name: 'count',
                    width: w * .03,
                    sortable: false,
                    align: 'left'
                },
                //{display: '', name : 'link', width : w*.07, sortable : false, align: 'left'}   ,        
                {
                    display: 'Date',
                    name: 'appointment_date',
                    width: w * .11,
                    sortable: true,
                    align: 'left'
                },
                {
                    display: 'Ticket No',
                    name: 'ticket_no',
                    width: w * .05,
                    sortable: true,
                    align: 'left'
                },
                {
                    display: 'followup',
                    name: 'followup',
                    width: w * .06,
                    sortable: false,
                    align: 'left'
                },
                {
                    display: 'Emp Code',
                    name: 'emp_code',
                    width: w * .1,
                    sortable: true,
                    align: 'left'
                },
                {
                    display: 'Patient Name',
                    name: 'patient_name',
                    width: w * .15,
                    sortable: true,
                    align: 'left'
                },
                {
                    display: 'Emergency?',
                    name: 'IsEmergency',
                    width: w * .06,
                    sortable: true,
                    align: 'left'
                },

                {
                    display: 'Doctor Consulted?',
                    name: 'doctor_attended_flag',
                    width: w * .1,
                    sortable: true,
                    align: 'left'
                },
                {
                    display: 'Complaints',
                    name: 'complaints',
                    width: w * .15,
                    sortable: true,
                    align: 'left'
                },

                {
                    display: 'Vitals',
                    name: 'vitals',
                    width: w * .1,
                    sortable: false,
                    align: 'left'
                },
                {
                    display: 'Remarks(Follow-up Investigation)',
                    name: 'remarks',
                    width: w * .15,
                    sortable: true,
                    align: 'left'
                },



            ],
            buttons: [
                //{name: 'Direct Medicine Issue', bclass: 'add', onpress : add},
                {
                    separator: true
                },
                {
                    name: 'PDF',
                    bclass: 'print',
                    onpress: pdf
                },
                {
                    separator: true
                },
                {
                    name: 'Excel',
                    bclass: 'print_excel',
                    onpress: excel
                },
                {
                    separator: true
                }
            ],
            searchitems: [{
                    display: 'Emp Code',
                    name: 'emp_code',
                    isdefault: true
                }, {
                    display: 'Ticket No',
                    name: 'ticket_no',

                },

                {
                    display: 'Patient Name',
                    name: 'patient_name'
                },



            ],
            sortname: "appointment_date",
            sortorder: "desc",
            usepager: true, //pagination
            //title:"Employee OPD",
            useRp: true,
            rp: 50, //records per page
            showTableToggleBtn: false, //toggle button for the whole table
            resizable: true,
            //	width: w, 
            height: h,
            singleSelect: true
        });
    });

    function open_employee_appointment(appointmentId, appointment_type, emp_id, action) {
        if (appointment_type == "O") {
            if (action == 'V') {
                document.forms['flex_appointment_form'].action = "view_opd.php";
            } else if (action == 'E') {
                document.forms["flex_appointment_form"].action = "edit_opd.php";
            }
        } else if (appointment_type == "I") {
            if (action == 'V') {
                document.forms['flex_appointment_form'].action = "view_injury.php";
            } else if (action == 'E') {
                document.forms['flex_appointment_form'].action = "edit_injury.php";
            }
        }
        $("#flex_appointment_form").method = "post";
        $("#flex_appointment_form").find("#appointmentId").val(appointmentId);
        $("#flex_appointment_form").find("#flex_opd_id").val(emp_id);
        $("#flex_appointment_form").find("#returnPage").val("appointment_list.php");
        $("#flex_appointment_form").submit();
    }


    function pdf() {
        //window.open('pdf_manage_item.php');

        window.open('ajax_pdf.php', 'Pending Medicine List');
    }

    function excel() {
        window.open('ajax_excel.php', 'Pending Medicine List');
    }

    function add() {
        window.location.href = "direct_medicine_issue.php";
    }


    function open_approval() {
        jQuery(function($) {




            BootstrapDialog.show({
                title: 'Forward',

                message: '<select class="form-control"  id="forward_status"  style="margin-left:100px;width:60%">'

                    +
                    '<option value="select">Please Select Yes Or No</option>' +
                    '<option value="Y">YES</option>' +
                    '<option value="N">NO</option>',

                buttons: [{
                    label: 'OK',
                    action: function() {
                        $("#attendedStatus").val($("#forward_status").val());
                        validate_update('opd_form', '<?php echo $row['appointment_id'] ?>')
                        $(".close").click();
                    }
                }]
            });

            $("#attendedStatus").val('CLS');
            validate_update('opd_form', '<?php echo $row['appointment_id'] ?>')



        });
    }
</script>
<?php include('techsyn_footer.php'); ?>