/home/optimumoperation/quarksperforma.optimumoperations.top/admin/renewal_invoice.php
<?php include 'include/top-part.php'; ?>
<script type="text/javascript" src="//code.jquery.com/jquery-latest.js"></script>
<script src="../ckeditor/ckeditor.js"></script>
<style>
.new_class{
float: left;
}
</style>
<div class="dashboard-wrapper">
<div class="container-fluid dashboard-content">
<!-- ============================================================== -->
<!-- pageheader -->
<!-- ============================================================== -->
<div class="row">
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
<div class="page-header">
<h2 class="pageheader-title">Renewal Invoice</h2>
<p class="pageheader-text"> Fill the form to create an Renewal Invoice.</p>
<div class="page-breadcrumb">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#" class="breadcrumb-link">Dashboard</a></li>
<li class="breadcrumb-item"><a href="#" class="breadcrumb-link">Invoice</a></li>
<li class="breadcrumb-item active" aria-current="page">Add Renewal Invoice</li>
</ol>
</nav>
</div>
</div>
</div>
</div>
<!-- ============================================================== -->
<!-- end pageheader -->
<!-- ============================================================== -->
<div class="row">
<!-- ============================================================== -->
<!-- data table -->
<!-- ============================================================== -->
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
<div class="card">
<div class="card-header">
<h5 class="mb-0">Fill all the field to create an Renewal invoice </h5>
<p>The invoice will be listed in:- <?php echo $phone; ?>.</p>
</div>
<div class="card-body">
<?php
$sql = "SELECT * from invoice_details ORDER BY id DESC LIMIT 1";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$invoice_id = $row["id"];
$invoice_number = $invoice_id+1;
?>
<?php
}
} else {
echo "Welcome this the first Invoice";
}
?>
<?php $mydate = date('Y'); $invoice_session = $mydate + 1 ; ?>
<form action="" method="post">
<div class="form-group col-md-6">
<input style="display:none;" type="text" class="form-control" name="serial_number" value="<?php echo $invoice_number;?>" />
<input style="display:none;" type="text" class="form-control" name="invoice_date" value="<?php echo date('d-m-Y');?>" />
<input style="display:none;" type="text" class="form-control" name="invoice_session"
value="<?php echo date('Y') .'-'.date('y', strtotime('+1 year')); ?>" />
</div>
<div class="form-group col-md-6" style=" float:left;">
<label>Invoice/Quotation</label>
<select class="form-control" name="invoice_quatation">
<option value="RenQuot"> RenQuot</option>
<option value="RenewalInv"> RenewalInv </option>
</select>
<label>Customer Phone</label>
<input required name="customer_mobile" type="text" placeholder="Customer Phone" class="form-control">
<label>Customer Mail</label>
<input required name="customer_mail" type="text" placeholder="Customer Mail" class="form-control">
</div>
<div class="form-group col-md-6" style=" float:left;">
<label>Customer Name</label>
<input required name="customer_name" type="text" placeholder="Customer Name" class="form-control">
<label for="inputText4" class="col-form-label">Full Address</label>
<input required id="inputText4" type="text" class="form-control" placeholder="Customer Address" name="customer_address">
<label for="inputText4" class="col-form-label">Advance Payment</label>
<input required type="text" class="form-control" placeholder="Advance Payment to start work. Eg- 50 (for 50% of invoice)." name="advance_payment_invoice">
</div>
<div class="my-form">
<p class="text-box">
<label for="box1"> Product Description <span class="box-number">1</span></label>
<input type="text" name="product_description[]" value="" id="box1" />
<label for="box1">Product Qty Type <span class="box-number">1</span></label>
<input type="text" name="product_qty_type[]" value="" id="box1" />
<label for="box1"> Product Amount <span class="box-number">1</span></label>
<input type="text" name="product_amount[]" value="" id="box1" />
<a class="add-box" href="#">Add More</a>
<hr>
<div class="form-group">
<label for="inputText4" class="col-form-label">complete feature</label>
<textarea id="editor" name="complete_feature">
<ol><li><pre><span style="font-size:12.5pt">Invoice will be paid in full advance. No Discount available.</span></pre></li><li><pre><span style="font-size:12.5pt">Server-Services have already been availed/charged for Data Backup for a year in advance.</span></pre></li><li><pre><span style="font-size:12.5pt">Renewal of Services may take a day or two to reinstate back to normal.</span></pre></li><li><pre><span style="font-size:12.5pt">In case of Premium Mailboxes it may take a day extra to setup in case of Server Propagation. </span></pre></li><li><pre><span style="font-size:12.5pt">Invoice doesnot bears the cost for any Maintenance or Support on Websites (if any).</span></pre></li><li><pre><span style="font-size:12.5pt">Discontinuation or Migration is NOT applicable until Invoice-Pay.</span></pre></li></ol>
</textarea>
</div>
<hr>
<div class="form-group">
<label for="inputText4" class="col-form-label">Client's Support History:</label>
<textarea id="seceditor" name="updation_work">
</textarea>
</div>
<button type="submit" name="save" class="btn btn-primary btn-lg btn-block">Add Renewal Invoice</button>
</form>
<?php
if(isset($_POST['save']))
{
$invoice_quatation = $_POST['invoice_quatation'];
$advance_payment_invoice = $_POST['advance_payment_invoice'];
$invoice_date = $_POST['invoice_date'];
$invoice_session = $_POST['invoice_session'];
$customer_name = $_POST['customer_name'];
$customer_address = $_POST['customer_address'];
$customer_mail = $_POST['customer_mail'];
$customer_mobile = $_POST['customer_mobile'];
$complete_feature = $_POST['complete_feature'];
$updation_work = $_POST['updation_work'];
$product_descriptionall = $_POST['product_description'];
$product_description="";
foreach($product_descriptionall as $allproductdescription)
{
$product_description.= $allproductdescription.",";
}
$product_qty_typeall = $_POST['product_qty_type'];
$product_qty_type="";
foreach($product_qty_typeall as $allproduct_qty_type)
{
$product_qty_type.= $allproduct_qty_type.",";
}
$product_amountall = $_POST['product_amount'];
$product_amount="";
foreach($product_amountall as $allproduct_amount)
{
$product_amount.= $allproduct_amount.",";
}
if (!empty($_POST['customer_name'])) {
$sql = "INSERT INTO invoice_details
(invoice_date,invoice_quatation,advance_payment_invoice,invoice_session,customer_name,customer_address,customer_mail,customer_mobile,product_description, product_qty_type, product_amount, complete_feature,updation_work,WhatsApp_Group,price_paid, invoice_status, invoice_renewal, user_id,created_at)
VALUES
('$invoice_date','$invoice_quatation','$advance_payment_invoice','$invoice_session', '$customer_name', '$customer_address','$customer_mail','$customer_mobile','$product_description','$product_qty_type','$product_amount', '$complete_feature','$updation_work','$customer_name','0','1', '1','$user_id', now())";
if (mysqli_query($conn, $sql)) {
echo "<h2 class='center_text'>"."Records Saving"."</h2>" ;
echo "<meta http-equiv='refresh' content='3; url=renewal_invoice'>";
}
else {
echo "Error: " . $sql . " " . mysqli_error($conn);
echo "<meta http-equiv='refresh' content='3; url=renewal_invoice'>";
}
mysqli_close($conn);
}
}
?>
</div>
</div>
</div>
<!-- ============================================================== -->
<!-- end data table -->
<!-- ============================================================== -->
</div>
</div>
<?php include 'include/bottom-part.php'; ?>
<script type="text/javascript">
jQuery(document).ready(function($){
$('.my-form .add-box').click(function(){
var n = $('.text-box').length + 1;
if( 5 < n ) {
alert('Stop it! Maximum 5 allowed');
return false;
}
var box_html = $('<p class="text-box"><label for="box' + n + '"> Product Description <span class="box-number">' + n + '</span></label> <input type="text" name="product_description[]" value="" id="box' + n + '" /><label for="box' + n + '"> Product Qty Type <span class="box-number">' + n + '</span></label> <input type="number" name="product_qty_type[]" value="" id="sbox' + n + '" /><label for="box' + n + '">Product Amount <span class="box-number">' + n + '</span></label> <input type="number" name="product_amount[]" value="" id="thirdbox' + n + '" /> <a href="#" class="remove-box">Remove</a></p>');
box_html.hide();
$('.my-form p.text-box:last').after(box_html);
box_html.fadeIn('slow');
return false;
});
$('.my-form').on('click', '.remove-box', function(){
$(this).parent().css( 'background-color', '#FF6C6C' );
$(this).parent().fadeOut("slow", function() {
$(this).remove();
$('.box-number').each(function(index){
$(this).text( index + 1 );
});
});
return false;
});
});
</script>
<script>
CKEDITOR.replace('editor');
</script>
<script>
CKEDITOR.replace('seceditor');
</script>