<?php session_start();
include('accesscheck2.php');
require_once('Connections/courier.php');
require_once('functions/functions.php');

$action = $_POST["act"];
$id = $_POST['id'];
$payment_methods = $_POST['payment_method'];

if ($action == 'get_payment_status') {
    if($id == 'POSMOMO'){ ?>
        <option value="cash">Cash</option>
        <option value="creditcard">POS</option>
        <option value="Mobile Money">Mobile Money</option>
        <option value="EcoBank Master Pass">EcoBank Master Pass</option>
        <option value="cheque">Cheque</option>
    <?php }else{
    if (count($payment_methods) > 0) {
    foreach ($payment_methods as $payment_method) {
        $payment_qry .= "mode_of_payment='$payment_method' OR ";
    }
    $payment_qry = substr($payment_qry, 0, -4);
}
    $payment_status = mysql_query("SELECT DISTINCT payment_status FROM claims_details WHERE ($payment_qry) ");
    while ($row = mysql_fetch_assoc($payment_status)) {
        ?>
        <option value="<?php echo $row['payment_status'] ?>"><?php echo ucfirst($row['payment_status']); ?></option>
    <?php
    }
}

}

if($action == "get_insurance_company"){
    echo "SELECT * FROM insurance_company WHERE type='$payment_methods'";
        $payment_status = mysql_query("SELECT * FROM insurance_company WHERE type='$payment_methods'");
    while ($row = mysql_fetch_assoc($payment_status)) {
        ?>
        <option value="<?php echo strtoupper($row['company_code']); ?>"><?php echo strtoupper($row['company_name']); ?></option>
    <?php
    }
}