128 lines
5.7 KiB
PHP
128 lines
5.7 KiB
PHP
<div class="container">
|
|
|
|
<?php
|
|
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
|
|
|
|
if ($conn->connect_error) die("Connection failed: " . $conn->connect_error);
|
|
if(isset($_POST["ac_type"]) && isset($_POST["ac_name"]) && $_POST["ac_name"]!="" && is_numeric($_POST["Mature_Value"]) ) {
|
|
$return_json['NotiFi'] = "";$return_json['NotiFi_m'] = "";$return_json['NotiFi_d'] = "";
|
|
$ca["ac_type"]=$_POST["ac_type"];
|
|
$ca["ac_name"]=$_POST["ac_name"];
|
|
$ca["ac_phone"]=$_POST["ac_phone"];
|
|
$ca["ac_mail"]=$_POST["ac_mail"];
|
|
$ca["ac_address"]=$_POST["ac_address"];
|
|
$ca["ac_no"]="GV".$_POST["ac_type"].date("Ymd")."F";
|
|
$ca["ac_agent"] = $_POST["ac_agent"] ?? null;
|
|
//GC_new_entry($ca);
|
|
|
|
$t="FD";
|
|
$stmt = $conn->prepare("INSERT INTO ".$GLOBALS['arif_ac']." (`AA_ICARD_NO`,`AA_NOMINEE_DETAILS`,`AA_INTEREST`,`AA_DATE`, `AA_DATE_MATURE`, `AA_NO_OF_PAYMENT`,`AA_AMOUNT`, `AA_MATURE_VALUE`, `AA_TYPE`,`AA_ACTYPE`,`AA_NAME`, `AA_PHONE`, `AA_EMAIL`, `AA_ADDRESS`, `AA_ADMIN`, `AA_AGENT`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
|
$stmt->bind_param("ssssssssssssssss" ,$_POST["AA_ICARD_NO"],$_POST["AA_NOMINEE_DETAILS"],$_POST["CA_interest"], $_POST["date_today"],$_POST["date_mature"],$_POST["CA_No_Of_Payment"],$_POST["CA_Amount"],$_POST["Mature_Value"], $t,$ca["ac_type"],$ca["ac_name"],$ca["ac_phone"],$ca["ac_mail"],$ca["ac_address"],$_SESSION["EMAIL"], $ca["ac_agent"]);
|
|
|
|
if($stmt->execute()){
|
|
$lid=$conn->insert_id;$ca["ac_no"]=$ca["ac_no"].$lid;
|
|
if($conn->query("UPDATE `".$GLOBALS['arif_ac']."` SET `AA_ACNO` = '".$ca["ac_no"]."' WHERE `AA_ID` =".$lid.";"))
|
|
{$return_json['NotiFi'] = "OK";$return_json['NotiFi_m'] = "New FD A/C Created !";$return_json['NotiFi_d'] = "<a href='./Details?no=".$ca["ac_no"]."'>A/C NO- ".$ca["ac_no"]."</a>";}
|
|
else{$return_json['NotiFi'] = "Error";$return_json['NotiFi_m'] = "Error Creating New Recurring A/C !";$return_json['NotiFi_d'] = "Failed in Secondary Execution";}
|
|
}else printf("Error: %s.\n", $stmt->error);
|
|
$stmt->close();
|
|
|
|
$conn->close();
|
|
echo $return_json['NotiFi'],$return_json['NotiFi_m'],$return_json['NotiFi_d'];
|
|
} //else {$return_json['NotiFi'] = "Error";$return_json['NotiFi_m'] = "Error on input !";$return_json['NotiFi_d'] = "Check Input Details";}
|
|
//echo json_encode($return_json);
|
|
|
|
$getAgentListsQuery = "SELECT * FROM " . $GLOBALS['arif_users'];
|
|
$result = $conn->query($getAgentListsQuery);
|
|
|
|
$agentList = [];
|
|
|
|
if ($result && $result->num_rows > 0) {
|
|
while ($row = $result->fetch_assoc()) {
|
|
$agentList[] = $row;
|
|
}
|
|
} else {
|
|
echo "No agents found.";
|
|
}
|
|
|
|
?>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<form method="post" enctype="multipart/form-data" id="new_fd">
|
|
<input type="hidden" name="ac_type" value="F">
|
|
<div class="form-group">
|
|
<input type="text" class="form-control text-capitalize" name="ac_name" placeholder="Name" >
|
|
<small id="emailHelp" class="form-text text-muted">A/C Holder Name*</small>
|
|
</div>
|
|
<div class="form-group">
|
|
<input type="text" class="form-control text-uppercase" name="AA_ICARD_NO" placeholder="I-CARD NO" required>
|
|
</div>
|
|
<table><tr>
|
|
<td><div class="form-group">
|
|
<input type="text" class="form-control" name="CA_Amount" oninput="cal_FD();">
|
|
<small id="emailHelp" class="form-text text-muted">Amount*</small>
|
|
</div></td>
|
|
<td><div class="form-group">
|
|
<input type="text" class="form-control" name="CA_interest" value="8">
|
|
<small id="emailHelp" class="form-text text-muted">interest*</small>
|
|
</div></td>
|
|
<td><div class="form-group">
|
|
<input type="text" class="form-control" name="CA_No_Of_Payment" oninput="cal_FD();cal_FD_md();" >
|
|
<small id="emailHelp" class="form-text text-muted">Month*</small>
|
|
</div></td>
|
|
<td><div class="form-group">
|
|
<input type="text" class="form-control" name="Mature_Value" id="Mature_Value" value="">
|
|
<small id="emailHelp" class="form-text text-muted">Mature Value*</small>
|
|
</div></td>
|
|
<td>
|
|
<div class="form-group">
|
|
<select class="form-control" name="ac_agent">
|
|
<option>-Dedicate Agent-</option>
|
|
<?php foreach ($agentList as $agent): ?>
|
|
<option Value="<?php echo htmlspecialchars($agent['user_id']) ?>"><?php echo htmlspecialchars($agent['user_id']); ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
<small class="form-text text-muted">Dedicate a Agent</small>
|
|
</div>
|
|
</td>
|
|
</tr></table>
|
|
<div class="form-group">
|
|
<input type="text" class="form-control" id="date_today" name="date_today" value="<?php echo date('Y-m-d');?>" >
|
|
<small id="emailHelp" class="form-text text-muted">Date*</small>
|
|
</div>
|
|
<div class="form-group">
|
|
<input type="text" class="form-control" name="date_mature" >
|
|
<small id="emailHelp" class="form-text text-muted">Mature Date*</small>
|
|
</div>
|
|
<div class="form-group">
|
|
<input type="text" class="form-control" name="ac_phone" placeholder="Phone No">
|
|
</div>
|
|
|
|
|
|
<div class="form-group">
|
|
<input type="text" class="form-control" name="ac_mail" placeholder="Email">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<textarea class="form-control text-capitalize" rows="5" name="ac_address" placeholder="Address"></textarea>
|
|
</div>
|
|
<hr>
|
|
<small class="form-text text-muted"><u>Nominee details*</u></small>
|
|
<div class="form-group">
|
|
<textarea class="form-control text-capitalize" rows="5" name="AA_NOMINEE_DETAILS" required>Name:
|
|
DOB:
|
|
Relation:
|
|
ID:
|
|
</textarea>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-lg-4 col-md-4 col-md-offset-5 col-sm-12 col-xs-12">
|
|
<button type="submit" class="btn btn-primary">Create New FD A/C</button>
|
|
</div>
|
|
</div>
|
|
|
|
</form>
|
|
|
|
|
|
</div>
|