<!DOCTYPE html>
<html lang="en">
<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Chandrani Pearls Gold Billing</title>
<link rel="icon" type="image/jpg" href="dist/img/favicon.png?v=2">
<!-- Google Font: Source Sans Pro -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">

<!-- -=---- searchable dropdown link css ------ -->
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
<!-- -=---- searchable dropdown link css ------ -->

<!-- DataTables -->
<link rel="stylesheet" href="plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
<link rel="stylesheet" href="plugins/datatables-buttons/css/buttons.bootstrap4.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/adminlte.min.css">
<link rel="stylesheet" href="dist/css/custom.css?v=2">

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.14.1/themes/base/jquery-ui.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.css" />


<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css" />
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.js"></script>

<style type="text/css">
.fancybox-custom .fancybox-skin {
box-shadow: 0 0 50px #222;
}

.fancybox-skin{
padding:0px;
}

.fancybox__content{
padding:10px !important;
}

select{
padding-left:8px !important;
}

.loader_bg {
float: left;
width: 100%;
height: 100%;
top: 0;
bottom: 0;
background-color: rgba(0, 0, 50, 0.85);
background: rgba(0, 0, 0, 0.85);
z-index: 1500;
position: fixed;

}
.loader_maindiv{
width:190px;
height:auto;
margin:0px auto;

}
.loader_div{float:left; width:100%; height:auto; margin-top:260px;}
.loader_txt{float:left; width:100%; height:auto; margin-top:10px; text-align:center; color:#FFF; font-size:13px;}
</style>
<style type="text/css">
#tooltip
{
text-align: center;
color: #fff;
background: #111;
position: absolute;
z-index: 100;
padding: 5px 10px;
font-size:10px !important;
line-height:12px !important;
}
#tooltip:after /* triangle decoration */
{
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 10px solid #111;
content: '';
position: absolute;
left: 50%;
bottom: -10px;
margin-left: -10px;
}
#tooltip.top:after
{
border-top-color: transparent;
border-bottom: 10px solid #111;
top: -20px;
bottom: auto;
}
#tooltip.left:after
{
left: 10px;
margin: 0;
}
#tooltip.right:after
{
right: 10px;
left: auto;
margin: 0;
}
.message_maindiv{
float:left;
height:auto;
padding:15px;
background-color:#fff8e6;
text-align:left;
font-size:12px;
color:#503a27;
}
</style>

<style type="text/css">


#tooltip
{
text-align: center;
color: #fff;
background: #111;
position: absolute;
z-index: 100;
padding: 5px 10px;
font-size:10px !important;
line-height:12px !important;
}
#tooltip:after /* triangle decoration */
{
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 10px solid #111;
content: '';
position: absolute;
left: 50%;
bottom: -10px;
margin-left: -10px;
}
#tooltip.top:after
{
border-top-color: transparent;
border-bottom: 10px solid #111;
top: -20px;
bottom: auto;
}
#tooltip.left:after
{
left: 10px;
margin: 0;
}
#tooltip.right:after
{
right: 10px;
left: auto;
margin: 0;
}
.fulldiv {
float: left;
width: 100%;
height: 100%;
top: 0;
bottom: 0;
background-color: rgba(38, 53, 68, 0.80);
background: rgba(38, 53, 68, 0.80);
z-index: 1500;
position: fixed;
}
.message_maindiv{
float:left;
height:auto;
padding:15px;
background-color:#fff8e6;
text-align:left;
font-size:12px;
color:#503a27;
}

.print_div_new{
float:left;
width:46%;
margin-left:2%;
margin-right:2%;
}
.message_maindiv_new {

width: 430px;
height: auto;
margin: 0px auto;
}
.message_div_new {
float: left;
width: 100%;
height: auto;
padding: 3%;
background-color: #FFFFFF;
margin-top: 300px;
}
</style>
<style type="text/css">
.table_header{
background-color:#263544;
text-align:center;
color:#FFFFFF;
font-size:13px;
padding:4px 0px;
}
.table_body{
background-color:#e7eef6;
text-align:center;
color:#000000;
font-size:13px;
padding:4px 0px;
}
.total_leftdiv{
float:left;
padding-left:10px;
text-align:left;
font-size:13px;
color:#000000;
padding-bottom:4px;
font-weight:500;
}
.total_rightdiv{
float:right;
padding-left:10px;
text-align:right;
font-size:13px;
color:#000000;
padding-bottom:4px;
font-weight:600;
}
.btn_div{
background-color:#FFFFFF;
border:0px;
text-align:left;
font-weight:600px !important;
outline:0px !important;
cursor:pointer;
}
</style>

<script>
function handel(e){
if(e.keyCode === 13){
//alert(11);
//add_product();
ratecheck();
}
return false;
}
</script>
<script>
function handel1(e){
if(e.keyCode === 13){
//alert(11);
Get_order_id();
}
return false;
}
</script>
<script>
function hide_but()
{
var Order=$('#order').val();
//alert(Order);
if(Order!='')
{
$('#but_sub').hide();
}
}
</script>
<script>
function bday()
{
var bdaytype=$('#date_type').val();
if(bdaytype=='DOB')
{
$('#age').hide();
$('#dob').show();
$('#age').val("");
}
else if(bdaytype=='AGE')
{
$('#dob').hide();
$('#age').show();
$('#dob').val("");
}

}
</script>
<script>
function convert_bday12()
{
var age=$('#age').val();
$.ajax({
url:'ajx_get_bday.php',
type:'post',
//async:false,
data:'age='+age,
success:function(f)
{
////alert(f);
$('#age').hide();
$('#dob').show();
$('#date_type').val('DOB');
$('#dob').val(f);
$('#age').val("");

}
});
}
</script>
<script>
function check_amount()
{


var Cashamt=$('#cash_amount').val();
var Otheramt=$('#other_amount').val();
var Otheramt1=$('#other_amount1').val();
var Bankamt=$('#bank_amount').val();
var Gift=$('#gift_amount').val();
var GrandTot=$('#grand_total').val();
var Amtsum="";

if(Cashamt=="")
{
var Cashamt="0";
}


if(Cashamt!='')
{
Amtsum=Cashamt;
}
if(Otheramt!='')
{
Amtsum=parseFloat(Amtsum) + parseFloat(Otheramt);
}
if(Otheramt1!='')
{
Amtsum=parseFloat(Amtsum) + parseFloat(Otheramt1);
}
if(Bankamt!='')
{
Amtsum=parseFloat(Amtsum) + parseFloat(Bankamt);
}
if(Gift!='')
{
Amtsum=parseFloat(Amtsum) + parseFloat(Gift);
}

var dueAmnt=parseFloat(GrandTot) - parseFloat(Amtsum);

if(dueAmnt<0)
{
var DueAmount=0.00;
}
else
{
var DueAmount=dueAmnt;
}

$('#amount_paid').val(Amtsum+'.00');
$('#due_amount').val(DueAmount+'.00');
$('#return_amount').val(dueAmnt+'.00');
if(dueAmnt>0)
{
$('#return_amount').css('color', "#FF0000");
}
else
{
$('#return_amount').css('color', "#390");
}


//alert(DueAmount);
}
</script>
<script>
function check_Amt(per)
{
var GrandTot=$('#grand_total').val();
var Amount_Paid=$('#amount_paid').val();
if(parseFloat(GrandTot)!=parseFloat(Amount_Paid))
{
alert('Amount Paid is not same as the Total Amount');
return false;
}
else
{
complete_order();
}

}
</script>
<script>
function delete_product(Order,Product_SLN)
{

$.ajax({
url:'ajx_del_product_kd.php',
type:'post',
async:false,
data:{Order:Order,Product_SLN:Product_SLN},
success:function(f)
{
//alert(f);
consolidate_discount(Order);


}
});
}
	
function consolidate_discount(Order)
	{
		$.ajax({
			url:'ajax_update_discount_after_delete.php',
			type:'POST',
			data:{Order:Order},
			success:function(res)
			{
				get_bill();
			}
		});
	}
</script>
<script>
function Get_Gender()
{
var Salutation=$('#title').val();
if(Salutation=='MR.')
{
$Gen='Male';
}
else if(Salutation=='MRS.'||Salutation=='MS.'||Salutation=='MISS.')
{
$Gen='Female';
}
else
{
$Gen='';
}
$('#gender').val($Gen);
//alert($Gen);
}
</script>
<script>
function fancy_print()
{


$('#printmsgdiv').hide();

$('#printmailedmsgdiv').hide();

var order=$('#order').val();
//alert(order);
// window.location.href='invoice-gold.php?Order='+btoa(order);
//window.location.href='new-billing.php';
let url = 'invoice-gold.php?Order=' + btoa(order);

Fancybox.show([
{
src: url, // Change to your desired URL
type: "iframe",
options: {
iframe: {
preload: false,
width: 800, // Adjust width
height: 600, // Adjust height
}
}
}
]);

}
</script>
<script>
function close_fancy()
{
window.location.href='billing.php';

}
</script>
<script>
function close_paymode()
{
$('#payment_mode_div').hide();
}
</script>

<script>
function complete_order()
{
//alert(111);
var Salute=$('#title').val();
var Cus_name=$('#uname').val();
var cust_lname=$('#ulastname').val();
var mobile=$('#mob').val();
var emailid=$('#email').val();
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var address1=$('#add_line').val();
var address2=$('#add_line2').val();
var pincode=$('#pin').val();
var Country=$('#country').val();
var State=$('#state').val();
var Order=$('#order').val();
var Amountpaid=$('#amount_paid').val();
var cashamt=$('#cash_amount').val();
var Otherpaymode=$('#Other_Payment_Name').val();
var Otheramt=$('#other_amount').val();
var Bank=$('#bank_name').val();
var Bankamt=$('#bank_amount').val();
var cardnum=$('#bank_details').val();
var posname=$('#pos_name').val();
var dueamt=$('#due_amount').val();
var Bday=$('#dob').val();
var Bday_Type=$('#date_type').val();
var Bday_Age=$('#age').val();
var Aniversary=$('#anniversary').val();
var Reason=$('#purchase_reason').val();
var Hearabout=$('#hear').val();
var Promotion=$('#promotion').val();
var City=$('#city').val();
var Mem_Type=$('#member_type').val();
var Mem_sln=$('#member_SLN').val();
var Otherpaymode1=$('#Other_Payment_Name1').val();
var Otheramt1=$('#other_amount1').val();
var Gift_Card=$('#giftcard').val();
var Gift_Card_Amt=$('#gift_amount').val();

var Grand_Tot=$('#grand_total').val();
var Sellby=$('#sale-made').val();
var Gender=$('#gender').val();
var Marital=$('#marital').val();
var RT_Amt=$('#return_amount').val();
var Street=$('#street').val();
var Building_No=$('#apt_no').val();
var Customer_Gst=$('#cust_gst').val();
var Ethni=$('#ethinicity').val();
var Bill_date=$('#billing_date').val();
var Member=$('#member_type').val();

//alert(Mem_Type);
//$('#complete_original').hide();
// $('#complete_disabled').show();
if(Salute=="")
{
$('#title').css("border-color","#FF0000");
$('#title').focus();
return false;
}

if(Cus_name=="")
{
$('#uname').css("border-color","#FF0000");
$('#uname').focus();
return false;
}

if(cust_lname=="")
{
$('#ulastname').css("border-color","#FF0000");
$('#ulastname').focus();
return false;
}
if(mobile=="")
{
$('#mob').css("border-color","#FF0000");
$('#mob').focus();
return false;
}
if(regex.test(emailid)==false && emailid!='')
{
$('#email').css("border-color","#FF0000");
$('#email').focus();
return false;
}
if(Gender=="")
{
$('#gender').css("border-color","#FF0000");
$('#gender').focus();
return false;
}
if(Gender=="")
{
$('#gender').css("border-color","#FF0000");
$('#gender').focus();
return false;
}
if(Bday_Type=="DOB" && Bday=='')
{
$('#dob').css("border-color","#FF0000");
$('#dob').focus();
return false;
}
if(Bday_Type=="AGE" && Bday_Age=='')
{
$('#age').css("border-color","#FF0000");
$('#age').focus();
return false;
}
if(Hearabout=='')
{
$('#hear').css("border-color","#FF0000");
$('#hear').focus();
return false;
}
if(Promotion=='')
{
$('#promotion').css("border-color","#FF0000");
$('#promotion').focus();
return false;
}
if(Reason=='')
{
$('#purchase_reason').css("border-color","#FF0000");
$('#purchase_reason').focus();
return false;
}
if(Ethni=='')
{
$('#ethinicity').css("border-color","#FF0000");
$('#ethinicity').focus();
return false;
}
if(pincode=='')
{
$('#pin').css("border-color","#FF0000");
$('#pin').focus();
return false;
}
//alert(112222);
if(Otherpaymode!='')
{
if(Otheramt=='')
{
$('#other_amount').css("border-color","#FF0000");
$('#other_amount').focus();
return false;
}
}
if(Otherpaymode1!='')
{
if(Otheramt1=='')
{
//alert('Enter the amount for payment mode 2.');
$('#other_amount1').css("border-color","#FF0000");
$('#other_amount1').focus();
return false;
}
}
if(Bank!='')
{
if(cardnum=='')
{
//alert('Enter the all the bank details.');
$('#bank_details').css("border-color","#FF0000");
$('#bank_details').focus();
//$('#giftcard').val();
return false;
}
else if(posname=='')
{
//alert('Enter the all the bank details.');
$('#pos_name').css("border-color","#FF0000");
$('#pos_name').focus();
return false;
}
else if(Bankamt=='')
{
//alert('Enter the all the bank details.');
$('#bank_amount').css("border-color","#FF0000");
$('#bank_amount').focus();
return false;
}

}
if(Sellby=='')
{
$('#sale-made').css("border-color","#FF0000");
$('#sale-made').focus();
return false;
}
if((cashamt!=''||cashamt=='0') &&(Otheramt>'0' ||Otheramt1>'0' ||Bankamt>'0'))
{

$('#payment_mode_div').show();
$('#cash_amount').val('');
$('#other_amount').val('');
$('#Other_Payment_Name').val('');
$('#other_amount1').val('');
$('#Other_Payment_Name1').val('');
$('#bank_name').val('');
$('#bank_details').val('');
$('#pos_name').val('');
$('#bank_amount').val('');
$('#amount_paid').val('');
$('#due_amount').val('');
$('#return_amount').val('');
return false;

}
if((Otheramt!=''||Otheramt=='0') &&(cashamt>'0' ||Otheramt1>'0' ||Bankamt>'0'))
{

$('#payment_mode_div').show();
$('#cash_amount').val('');
$('#other_amount').val('');
$('#Other_Payment_Name').val('');
$('#other_amount1').val('');
$('#Other_Payment_Name1').val('');
$('#bank_name').val('');
$('#bank_details').val('');
$('#pos_name').val('');
$('#bank_amount').val('');
$('#amount_paid').val('');
$('#due_amount').val('');
$('#return_amount').val('');
return false;

}
if((Otheramt1!=''||Otheramt1=='0') &&(cashamt>'0' ||Otheramt>'0' ||Bankamt>'0'))
{

$('#payment_mode_div').show();
$('#cash_amount').val('');
$('#other_amount').val('');
$('#Other_Payment_Name').val('');
$('#other_amount1').val('');
$('#Other_Payment_Name1').val('');
$('#bank_name').val('');
$('#bank_details').val('');
$('#pos_name').val('');
$('#bank_amount').val('');
$('#amount_paid').val('');
$('#due_amount').val('');
$('#return_amount').val('');
return false;

}
if((Bankamt!=''||Bankamt=='0') &&(cashamt>'0' ||Otheramt>'0' ||Otheramt1>'0'))
{

$('#payment_mode_div').show();
$('#cash_amount').val('');
$('#other_amount').val('');
$('#Other_Payment_Name').val('');
$('#other_amount1').val('');
$('#Other_Payment_Name1').val('');
$('#bank_name').val('');
$('#bank_details').val('');
$('#pos_name').val('');
$('#bank_amount').val('');
$('#amount_paid').val('');
$('#due_amount').val('');
$('#return_amount').val('');
return false;

}

if(Amountpaid=="")
{
Amountpaid=0;
}

//alert(Grand_Tot);
//alert(Amountpaid);
//alert(RT_Amt);

//return false;
//alert(3333333);

if(parseFloat(Grand_Tot)>parseFloat(Amountpaid))
{
alert('Amount Paid does not match bill amount.');
return false;
}
if(Bankamt!=''||Bankamt=='0')
{
if(parseFloat(Grand_Tot)!=parseFloat(Bankamt))
{
alert('Amount Paid does not match bill amount.');
$('#bank_name').val('');
$('#bank_details').val('');
$('#pos_name').val('');
$('#bank_amount').val('');
$('#amount_paid').val('');
$('#due_amount').val('');
$('#return_amount').val('');
return false;
}
}
if(Otheramt!=''||Otheramt=='0')
{
if(parseFloat(Grand_Tot)!=parseFloat(Otheramt))
{
alert('Amount Paid does not match bill amount.');
$('#other_amount').val('');
$('#Other_Payment_Name').val('');
$('#amount_paid').val('');
$('#due_amount').val('');
$('#return_amount').val('');
return false;
}
}
if(Otheramt1!=''||Otheramt1=='0')
{
if(parseFloat(Grand_Tot)!=parseFloat(Otheramt1))
{
alert('Amount Paid does not match bill amount.');
$('#other_amount1').val('');
$('#Other_Payment_Name1').val('');
$('#amount_paid').val('');
$('#due_amount').val('');
$('#return_amount').val('');
return false;
}
}
if(Grand_Tot<0.00)
{
alert('Gross Amount cannot be Negative.');
return false;
}

else
{
//alert(1111);
//$('#complete_original').hide();
//$('#complete_disabled').show();
$('#page_loder2').show();
$.ajax({
url:'ajx_create_order_gold.php',
type:'post',
async:false,
data:'Cus_name='+Cus_name+'&mobile='+mobile+'&emailid='+emailid+'&address1='+address1+'&address2='+address2+'&pincode='+pincode+'&Country='+Country+'&State='+State+'&Order='+Order+'&Amountpaid='+Amountpaid+'&cashamt='+cashamt+'&Otherpaymode='+Otherpaymode+'&Otheramt='+Otheramt+'&Bank='+Bank+'&Bankamt='+Bankamt+'&cardnum='+cardnum+'&posname='+posname+'&dueamt='+dueamt+'&Bday='+Bday+'&Aniversary='+Aniversary+'&Reason='+Reason+'&Hearabout='+Hearabout+'&Promotion='+Promotion+'&City='+City+'&Mem_Type='+Mem_Type+'&Mem_sln='+Mem_sln+'&Otherpaymode1='+Otherpaymode1+'&Otheramt1='+Otheramt1+'&Gift_Card='+Gift_Card+'&Gift_Card_Amt='+Gift_Card_Amt+'&Sellby='+Sellby+'&billamt='+Grand_Tot+'&Gender='+Gender+'&Marital='+Marital+'&RT_Amt='+RT_Amt+'&Salute='+Salute+'&cust_lname='+cust_lname+'&Street='+Street+'&Building_No='+Building_No+'&Customer_Gst='+Customer_Gst+'&Ethni='+Ethni+'&Bill_date='+Bill_date+'&Member='+Member+'&Bday_Type='+Bday_Type+'&Bday_Age='+Bday_Age,
success:function(f)
{
//alert(f);
var arr=f.split("*");

if(arr[0]==1)
{
alert("Product stock not available");
}
else if(arr[0]==0)
{
exist_order();
}
else if(arr[0]==2)
{
advance_cancelled();
}
else if(arr[1]=='')
{
//invoice_via_whatsapp(Order);
$('#printmsgdiv').show();
$('#page_loder2').hide();
}
else if(arr[1]!='')
{
//invoice_via_whatsapp(Order);
$('#printmailedmsgdiv').show();
$('#page_loder2').hide();
}
//invoice_fancy(f);
}

});
//alert(1111);
}
}
</script>

<script>
function invoice_via_whatsapp(per)
{
var ord=per;
$.ajax({
url:'invoice_to_pdf.php',
type:'POST',
data:{ord:ord},
success:function(res)
{

}
});
}
</script>


<script>
function invoice_fancy(per)
{
//alert(per);
$.fancybox({
maxWidth : 1000,
maxHeight : 800,
fitToView : true,
width : '100%',
height : '100%',
autoSize : false,
closeClick : false,
openEffect : 'none',
closeEffect : 'none',



'href': 'invoice.php?Order='+per ,
'afterClose': function() {
window.location.href="billing.php";

},


});
}
</script>
<script>
function pause_order()
{
$('#pausediv').show();
setTimeout(function(){window.location.href='billing.php';},2500);
}
</script>
<script>
function exist_order()
{
$('#existdiv').show();
setTimeout(function(){window.location.href='billing.php';},5000);
}
</script>
<script>
function advance_cancelled()
{
$('#advancediv').show();
setTimeout(function(){window.location.href='billing.php';},5000);
}
</script>
<script>
$(document).ready(function() {
$(".various").fancybox({
maxWidth : 430,
maxHeight : 330,
fitToView : true,
width : '100%',
height : '100%',
autoSize : false,
closeClick : false,
openEffect : 'none',
closeEffect : 'none',

});
});
</script>
<script>
$(document).ready(function() {
$(".various1").fancybox({
maxWidth : 430,
maxHeight : 230,
fitToView : true,
width : '100%',
height : '100%',
autoSize : false,
closeClick : false,
openEffect : 'none',
closeEffect : 'none',

});
});
</script>
<script>
$(document).ready(function() {
$(".various2").fancybox({
maxWidth : 430,
maxHeight : 100,
fitToView : true,
width : '100%',
height : '100%',
autoSize : false,
closeClick : false,
openEffect : 'none',
closeEffect : 'none',

});
});
</script>
<script>
$(document).ready(function() {
$(".various3").fancybox({
maxWidth : 1000,
maxHeight : 800,
fitToView : true,
width : '100%',
height : '100%',
autoSize : false,
closeClick : false,
openEffect : 'none',
closeEffect : 'none',

});
});
</script>
<script>
$(document).ready(function() {
$(".various4").fancybox({
maxWidth : 430,
maxHeight : 230,
fitToView : true,
width : '100%',
height : '100%',
autoSize : false,
closeClick : false,
openEffect : 'none',
closeEffect : 'none',
afterClose : function()
{
window.parent.location.reload();
}

});
});
</script>
<!--Get member data from membership no or mobile--->
<script>
function Get_order_id()
{
var memid=$('#memo').val();
var Le=memid.length;
//alert(memid);

$('#page_loder').show();

if(memid=='')
{
//$('#Err').html('* Please Enter Membership Number Or Mobile No.');
$('#memo').css('border-color','red');
$('#memo').focus();
$('#page_loder').hide();
return false;
}
if(memid!='' && Le<'10')
{
alert('Membership No. or Mobile No cannot be less than 10 characters.');
$('#memo').css('border-color','red');
$('#memo').focus();
$('#page_loder').hide();
return false;
}
else
{
$.ajax({
url:'ajx_get_member-new-kd.php',
type:'post',
data:'memid='+memid,
success:function(f)
{
//alert(f);
//Get_Member_Data();
$('#but_sub').hide();
var f=f.trim();
var arr=f.split("*");
var Order=btoa(arr[0]);
//alert(arr[0]);
var Mem=btoa(arr[1]);
if(Order!='')
{
window.location.href='billing.php?o='+Order;
}
else
{
Get_Member_Data();
$('#page_loder').hide();
}
}
});
}
}
</script>
<script>
function Get_Member_Data()
{
var order=$('#order').val();
var Mem_Id=$('#memo').val();
//alert(Mem_Id);
if(order!='')
{
$.ajax({
url:'ajx_get_member_details-new-kd-gold.php',
type:'post',
data:'Order='+order,
success:function(f)
{
//alert(f);
//console.log(f);
$('#infodiv').show();
$('#scandiv').show();
var arr=f.split("*");
$fname=arr[0];
$phone=arr[1];
$email=arr[2];
$Err=arr[3];
$mem=arr[4];
$city=arr[5];
$pin=arr[6];
$state=arr[7];
$country=arr[8];
$add1=arr[9];
$add2=arr[10];
$dob=arr[11];
$aniversary=arr[12];
$pur_reason=arr[13];
$Hear=arr[14];
$promotion=arr[15];
$IsMember=arr[16];
$Mem_Type=arr[17];
$Ethini=arr[18];
$gender=arr[19];
$marital=arr[20];
$Membership_No=arr[21];
$Salutation=arr[22];
$building=arr[23];
$Street=arr[24];
$Cust_Gst=arr[25];
$lname=arr[26];
$Bdate=arr[27];
$Mem_Act=arr[28];
$Dob_Type=arr[29];
$Dob_Age=arr[30];
//alert($Dob_Age);
if($Membership_No=='')
{
$Membership="Non Member";
}
else if($Membership_No!='')
{
$Membership='Mem No:'+$Membership_No;
$("#member_number").val($Membership_No);
}
if($Membership_No!='' && $Mem_Act=='Membership Expired')
{
$Expiry=' '+$Mem_Act;
$('#ismemex').html($Expiry);
}



$('#ismem').html($Membership);

$("#member_SLN").val($mem);
//$Order_Id=arr[4];
$('#uname').val($fname);
$('#ulastname').val($lname);
$('#mob').val($phone);
$('#memo').val($phone);
if($phone!='')
{
document.getElementById("memo").readOnly = true;
}
$('#email').val($email);
$('#city').val($city);
$('#pin').val($pin);
$('#state').val($state);
$('#country').val($country);
$('#add_line').val($add1);
$('#add_line2').val($add2);
if($Dob_Type=='DOB')
{
if($dob!='1970-01-01' && $dob!='0000-00-00' && $dob!='01-01-1970')
{
$('#dob').val($dob);
}
}
if($Dob_Type=='AGE')
{
$('#dob').hide();
$('#age').show();
$('#age').val($Dob_Age);
}
$("#date_type").val($Dob_Type);
if($aniversary!='1970-01-01' && $aniversary!='0000-00-00' && $aniversary!='01-01-1970')
{
$('#anniversary').val($aniversary);
}
else
{
$('#anniversary').val("");
}
$('#purchase_reason').val($pur_reason);
$('#hear').val($Hear);
$('#promotion').val($promotion);
$('#ismember').val($IsMember);
//$('#order').val($Order_Id);
//alert($Mem_Type);
$('#member_type').val($Mem_Type);
$('#ethinicity').val($Ethini);
$('#gender').val($gender);
$('#marital').val($marital);
$('#title').val($Salutation);
$('#apt_no').val($building);
$('#street').val($Street);
$('#cust_gst').val($Cust_Gst);
$('#billing_date').val($Bdate);
//Customer_History(arr[1]);
}
});
}
else if(Mem_Id!='')
{
$.ajax({
url:'ajx_get_member_details-new-kd-gold.php',
type:'post',
data:'memid='+Mem_Id,
success:function(f)
{
//alert(f);

$('#infodiv').show();
$('#scandiv').show();
var arr=f.split("*");


$fname=arr[0];


$phone=arr[1];
$email=arr[2];
$Err=arr[3];
$mem=arr[4];
$city=arr[5];
$pin=arr[6];
$state=arr[7];
$country=arr[8];
$add1=arr[9];
$add2=arr[10];
$dob=arr[11];
$aniversary=arr[12];
$pur_reason=arr[13];
$Hear=arr[14];
$promotion=arr[15];

$IsMember=arr[16];

$Mem_Type=arr[17];
$Ethini=arr[18];
$gender=arr[19];
$marital=arr[20];
$Membership_No=arr[21];
$Salutation=arr[22];
$building=arr[23];
$Street=arr[24];
$Cust_Gst=arr[25];
$lname=arr[26];
$Mem_Act=arr[28];
$Dob_Age=arr[30];
//alert($Mem_Type);
if($Membership_No=='')
{
$Membership="Non Member";
}
else if($Membership_No!='')
{
$Membership='Mem No:'+$Membership_No;
$("#member_number").val($Membership_No);
}
if($Membership_No!='' && $Mem_Act=='Membership Expired')
{
$Expiry=' '+$Mem_Act;
$('#ismemex').html($Expiry);
}
$('#ismem').html($Membership);

$("#member_SLN").val($mem);

//$Order_Id=arr[4];
$('#uname').val($fname);
$('#ulastname').val($lname);
$('#mob').val($phone);
$('#email').val($email);
$('#city').val($city);
$('#pin').val($pin);
$('#state').val($state);
$('#country').val($country);
$('#add_line').val($add1);
$('#add_line2').val($add2);

//alert($dob);

if($dob!='1970-01-01' && $dob!='0000-00-00' && $dob!='01-01-1970')
{
$('#dob').val($dob);
$("#date_type").val("DOB");
}
else if(($dob=='1970-01-01' || $dob=='0000-00-00' || $dob=='01-01-1970') && $Dob_Age>0)
{
$('#age').val($Dob_Age);
$('#dob').hide();
$('#age').show();
$("#date_type").val("AGE");
}
else
{
$('#dob').val("");
}
if($aniversary!='1970-01-01' && $aniversary!='0000-00-00' && $aniversary!='01-01-1970')
{
$('#anniversary').val($aniversary);
}
else
{
$('#anniversary').val("");
}
$('#purchase_reason').val($pur_reason);
$('#hear').val($Hear);
$('#promotion').val($promotion);

$('#ismember').val($IsMember);
//$('#order').val($Order_Id);
$('#member_type').val($Mem_Type);
$('#ethinicity').val($Ethini);
$('#gender').val($gender);
$('#marital').val($marital);
$('#title').val($Salutation);
$('#apt_no').val($building);
$('#street').val($Street);
$('#cust_gst').val($Cust_Gst);
//Customer_History(Mem_Id);
}
});

}

}

function Customer_History123(per)
{
var Customer_Contact=per;
$.ajax({
url:'ajx_fetch_customer_bill_history.php',
type:'POST',
data:{'Customer_Contact':Customer_Contact},
success:function(f)
{
$('#cust_hist').html(f);

}
})
}


</script>
<!--checking whether product exist or not then adding to order--->
<script>

function add_product()
{
//alert(111);
var pro_id=$('#scan').val();
var Salute=$('#title').val();
var cust_name=$('#uname').val();
var cust_lname=$('#ulastname').val();
var cust_mob=$('#mob').val();
var State=$('#state').val();
var Bill_date=$('#billing_date').val();
var order=$('#order').val();
var Membership_Id=$('#member_number').val();
//alert(Membership_Id);
/*if(Salute=="")
{
$('#title').css("border-color","#FF0000");
$('#title').focus();
return false;
}
if(cust_name=="")
{
$('#uname').css("border-color","#FF0000");
$('#uname').focus();
return false;
}
if(cust_lname=="")
{
$('#ulastname').css("border-color","#FF0000");
$('#ulastname').focus();
return false;
}
if(cust_mob=="")
{
$('#mob').css("border-color","#FF0000");
$('#mob').focus();
//alert('Customer Mobile cannot be blank');
return false;
}*/
if(Bill_date=="")
{
$('#billing_date').css("border-color","#FF0000");
$('#billing_date').focus();
//alert('Customer Mobile cannot be blank');
return false;
}
if(pro_id=='')
{
//$('#Pro_Err').html(" *Please select product.");
$('#scan').css("border-color","#FF0000");
$('#scan').focus();
return false;
}
if(State=='')
{
//$('#Pro_Err').html(" *Please select product.");
$('#state').css("border-color","#FF0000");
$('#state').focus();
return false;
}
else
{
$.ajax({
url:'ajx_get_product_gold.php',
type:'post',
data:'pro_id='+pro_id+'&order='+order,
success:function(f)
{
//console.log(f);
var arr=f.split("*");
$Err=arr[0];
$PID=arr[1];
$BarcodeID=arr[2];
if($Err==0)
{
//$('#billdiv').show();
$('#product').val($PID);
$('#barcode').val($BarcodeID);
Order_Product();
}
else if($Err==1)
{
$('#Pro_Err').html('* Product Not Found.');
}
else if($Err==2)
{
$('#Pro_Err').html('* Product stock not available.');
}
}
});
}
}
</script>
<script>
function empty_product_err()
{
var pro_id=$('#scan').val();
if(pro_id!='')
{
$('#Pro_Err').html('');
}

}
</script>
<script>
function empty_scan_border()
{
//alert(33);
var pro_id=$('#scan').val();
var Salute=$('#title').val();
var cust_name=$('#uname').val();
var cust_lname=$('#ulastname').val();
var cust_mob=$('#mob').val();
var State=$('#state').val();
var Other_Amt=$('#other_amount').val();
var Other_Amt1=$('#other_amount1').val();
var Bankamt=$('#bank_amount').val();
var cardnum=$('#bank_details').val();
var posname=$('#pos_name').val();
var Sellby=$('#sale-made').val();
var emailid=$('#email').val();
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var Reason=$('#purchase_reason').val();
var Hearabout=$('#hear').val();
var Promotion=$('#promotion').val();
var Ethni=$('#ethinicity').val();
if(Salute!="")
{
$('#title').css("border-color","");
}
if(cust_name!="")
{
$('#uname').css("border-color","");
}
if(cust_lname!="")
{
$('#ulastname').css("border-color","");
}
if(cust_mob!="")
{
$('#mob').css("border-color","");
}
if(State!="")
{
$('#state').css("border-color","");
}
if(pro_id!='')
{
$('#scan').css("border-color","");
}
if(Other_Amt!='')
{
$('#other_amount').css("border-color","");
}
if(Other_Amt1!='')
{
$('#other_amount1').css("border-color","");
}
if(Bankamt!='')
{
$('#bank_amount').css("border-color","");
}
if(cardnum!='')
{
$('#bank_details').css("border-color","");
}
if(posname!='')
{
$('#pos_name').css("border-color","");
}
if(Sellby!='')
{
$('#sale-made').css("border-color","");
}
if(emailid!='')
{
$('#email').css("border-color","");
}
if(regex.test(emailid)==true && emailid!='')
{
$('#email').css("border-color","");
}
if(Reason!='')
{
$('#purchase_reason').css("border-color","");
}
if(Hearabout!='')
{
$('#hear').css("border-color","");
}
if(Promotion!='')
{
$('#promotion').css("border-color","");
}
if(Ethni!='')
{
$('#ethinicity').css("border-color","");
}
}
</script>
<!--adding details to order master and details--->
<script>

function Order_Product()
{
var Product_Id=$('#product').val();
var Barcode=$('#barcode').val();
var order=$('#order').val();
var mobile=$('#mob').val();
var Mem_Ty=$('#member_type').val();
var Bill_date=$('#billing_date').val();
var Membership_Id=$('#member_number').val();
var Bday_Type=$("#date_type").val();
var Bday=$('#dob').val();
var Bday_Age=$('#age').val();
var Aniversary=$('#anniversary').val();
$.ajax({
url:'ajx_insert_order-new-kd-gold.php',
type:'post',
data:'Product_Id='+Product_Id+'&mobile='+mobile+'&Order='+order+'&Mem_Ty='+Mem_Ty+'&Bill_date='+Bill_date+'&Membership_Id='+Membership_Id+'&Bday='+Bday+'&Aniversary='+Aniversary+'&Barcode='+Barcode+'&Bday_Type='+Bday_Type+'&Bday_Age='+Bday_Age,
success:function(f)
{

// alert(f);

// return false;
    
//console.log(f);

// return false;
//console.log(f);
//get_bill();
var arr=f.split("*");
$Order=arr[0];
$Err=arr[1];
$('#scan').val('');
$('#order').val($Order);
$('#but_sub').hide();
//InsertOrderCustomerInfo($Order)
check_discounts(Barcode,$Order);
if($Err==1)
{
alert('More than 10 products cannot be added.');
return false;
}
/*else{
new_sale_discount($Order);
}*/
}
});
}
</script>
<script>
function check_discounts(Barcode,Order)
{
	//alert(Barcode);
$.ajax({
url:'ajax_get_gold_discounts_new.php',
type:'POST',
data:{Barcode:Barcode,Order:Order},
success:function(res)
{
// 	alert(res);
// 	return false;
//console.log(res);
InsertOrderCustomerInfo(Order);
}
});
}
</script>
<script>
function new_sale_discount(per)
{
var Order=per;
$.ajax({
url:'ajx_new_sale_discount.php',
type:'POST',
data:{'Order':Order},
success:function(res)
{
//alert(res);
get_bill();
}
})
}
</script>
<!--showing bill from order master and details--->
<script>

function get_bill()
{
//alert(333);
var order=$('#order').val();
//alert(order);
if(order!='')
{
$.ajax({
url:'ajx_get_bill-new-gold.php',
type:'post',
data:'order='+order,
success:function(f)
{
////alert(f);
$('#billdiv').html(f);

}
});
}
}
</script>
<script>
function remove_voucher()
{
var order=$('#order').val();
$.ajax({
url:'ajx_remove_voucher.php',
type:'post',
data:'order='+order,
success:function(f)
{
////alert(f);
get_bill();

}
});
}
</script>
<script>
function remove_return()
{
var order=$('#order').val();
$.ajax({
url:'ajx_remove_return.php',
type:'post',
data:'order='+order,
success:function(f)
{
////alert(f);
get_bill();

}
});
}
</script>
<script>
function remove_dealer_discount()
{
var order=$('#order').val();
$.ajax({
url:'ajx_remove_dealer_discount_kd.php',
type:'post',
data:'order='+order,
success:function(f)
{
//alert(f);
//new_sale_discount(order);
get_bill();

}
});
}
</script>
<script>
function Other_Pay()
{
var other_name1=$('#Other_Payment_Name').val();
var other_value1=$('#other_amount').val();
var other_name2=$('#Other_Payment_Name1').val();
var other_value2=$('#other_amount1').val();
if(other_name1!='')
{
if(other_value1=='')
{
//alert('Enter the amount for payment mode 1.');
$('#other_amount').css("border-color","#FF0000");
$('#other_amount').focus();
return false;
}
}
if(other_name2!='')
{
if(other_value2=='')
{
//alert('Enter the amount for payment mode 2.');
$('#other_amount1').css("border-color","#FF0000");
$('#other_amount1').focus();
return false;
}
}
}
</script>
<script>
function InsertOrderCustomerInfo(per)
{
var Order=per;
var Salute=$('#title').val();
var Cus_name=$('#uname').val();
var cust_lname=$('#ulastname').val();
var mobile=$('#mob').val();
var emailid=$('#email').val();
var address1=$('#add_line').val();
var address2=$('#add_line2').val();
var pincode=$('#pin').val();
var Country=$('#country').val();
var State=$('#state').val();
var Order=$('#order').val();
var Reason=$('#purchase_reason').val();
var Hearabout=$('#hear').val();
var Promotion=$('#promotion').val();

var Ethni=$('#ethinicity').val();
var Bday_Type=$('#date_type').val();
var Bday=$('#dob').val();
var Bday_Age=$('#age').val();
var Aniversary=$('#anniversary').val();
var City=$('#city').val();
var Member=$('#member_type').val();
var Gender=$('#gender').val();
var Marital=$('#marital').val();
var Street=$('#street').val();
var Building_No=$('#apt_no').val();
var Customer_Gst=$('#cust_gst').val();
var Membership_Id=$('#member_number').val();
var Bill_date=$('#billing_date').val();
$.ajax({
url:'ajx-insert-order-customer-info-new-gold.php',
type:'post',
async:false,
data:'Cus_name='+Cus_name+'&mobile='+mobile+'&emailid='+emailid+'&address1='+address1+'&address2='+address2+'&pincode='+pincode+'&Country='+Country+'&State='+State+'&Order='+Order+'&Bday='+Bday+'&Aniversary='+Aniversary+'&Reason='+Reason+'&Hearabout='+Hearabout+'&Promotion='+Promotion+'&City='+City+'&Order='+Order+'&Member='+Member+'&Ethni='+Ethni+'&Gender='+Gender+'&Marital='+Marital+'&Salute='+Salute+'&cust_lname='+cust_lname+'&Street='+Street+'&Building_No='+Building_No+'&Customer_Gst='+Customer_Gst+'&Membership_Id='+Membership_Id+'&Bill_date='+Bill_date+'&Bday_Type='+Bday_Type+'&Bday_Age='+Bday_Age,
success:function(f)
{
//alert(f);
get_bill();
}

});

}
</script>
<script>
function cancel_order()
{

var order=$('#order').val();
$.ajax({
url:'ajx_cancel_order.php',
type:'post',
data:'order='+order,
success:function(f)
{
////alert(f);
window.location.href='billing.php';

}
});

}
</script>
<script>
function get_giftcard_value(per)
{
var GiftcardCode=per;
$.ajax({
url:'ajx_get_giftcard_value.php',
type:'post',
data:'GiftcardCode='+GiftcardCode,
success:function(f)
{

//alert(f);
$('#gift_amount').val(f);
check_amount();

}
});
}
</script>
<script>
function ratecheck()
{
var prd=$('#scan').val();

if(prd=='')
{
//$('#Pro_Err').html(" *Please select product.");
$('#scan').css("border-color","#FF0000");
$('#scan').focus();
return false;
}


if (prd.length !== 15) {

$('#Pro_Err').html('* Invalid Product.');

return false ;

}



else{
$.ajax({
url:'ajax_check_gold_rate_added.php',
type:'POST',
data:{prd:prd},
success:function(res)
{
//console.log(res);
if(res==1)
{
$("#gold_rate_div").show();
setTimeout(function(){
$("#gold_rate_div").hide();
},2000);
$('#scan').val('');
}

if(res==2)
{
$('#Pro_Err').html('* Billing is not permitted for this product.');
$('#scan').val('');
}

else{
add_product();
}
}
});
}

}
</script>


</head>



<body class="hold-transition sidebar-mini" onLoad="Get_Member_Data(),get_bill(),hide_but(),Get_Gender()">


<div class="loader_bg" id="page_loder" style="display:none;">
<div class="loader_maindiv">
<div class="loader_div">
<img src="loader.gif" style="width:70%; padding-left:25%;" />
</div>
<div class="loader_txt">Please Wait Fetching Data..
</div></div></div>

<div class="loader_bg" id="page_loder2" style="display:none;">
<div class="loader_maindiv">
<div class="loader_div">
<img src="loader.gif" style="width:70%; padding-left:25%;" />
</div>
<div class="loader_txt">Please Wait Updating Data..
</div></div></div>
<div class="fulldiv" id="printmsgdiv" style="display:none;">
<div class="message_maindiv_new">
<div class="message_div_new">
<div class="message_title" style="float:left; width:100%; margin-bottom:10px; text-align:center;">Do you want to print the invoice?</div>
<div class="message_title">
<div class="print_div_new"><input name="print_invoice" type="BUTTON" class="btn btn-primary m-b-0" value="PRINT INVOICE" style="font-size:15px; width:100%; " onClick="fancy_print()" ></div>
<div class="print_div_new"><input name="cancel_invoice" type="BUTTON" class="btn btn-primary m-b-0" value="CANCEL" style="font-size:15px; width:100%; " onClick="close_fancy()" ></div>
</div>
</div>
</div>
</div>

<div class="fulldiv" id="printmailedmsgdiv" style="display: none;">
<div class="message_maindiv_new">
<div class="message_div_new">
<div class="message_title" style="float:left; width:100%; margin-bottom:10px; text-align:center;">Invoice already mailed to the customer.Do you still want to print the invoice?</div>
<div class="message_title">
<div class="print_div_new"><input name="print_invoice" type="BUTTON" class="btn btn-primary m-b-0" value="PRINT INVOICE" style="font-size:15px; width:100%; " onClick="fancy_print()" ></div>
<div class="print_div_new"><input name="cancel_invoice" type="BUTTON" class="btn btn-primary m-b-0" value="CANCEL" style="font-size:15px; width:100%; " onClick="close_fancy()" ></div>
</div>
</div>
</div>
</div>
<div class="fulldiv" id="pausediv" style="display:none;">
<div class="message_maindiv_new" style="width:500px;">
<div class="message_div_new">
<div class="message_title" style="font-size:18px; font-weight:600;">Your order has been paused you can access it from the <b>View Pending Bill</b> section.</div>
</div>
</div>
</div>

<div class="fulldiv" id="existdiv" style="display:none;">
<div class="message_maindiv_new" style="width:500px;">
<div class="message_div_new">
<div class="message_title" style="font-size:18px; font-weight:600;">This order has already been completed you can view it from the <b>View Completed Bill</b> section.</div>
</div>
</div>
</div>

<div class="fulldiv" id="advancediv" style="display:none;">
<div class="message_maindiv_new" style="width:500px;">
<div class="message_div_new">
<div class="message_title" style="font-size:18px; font-weight:600;">This booking has already been cancelled.</div>
</div>
</div>
</div>

<div class="fulldiv" id="payment_mode_div" style="display:none;">
<div class="message_maindiv_new" style="width:500px;">
<div class="message_div_new">
<div class="message_title" style="font-size:18px; font-weight:600;">Only one mode of payment is allowed.</div>
<div class="message_btn_maindiv"><input name="cancel_paymode" type="BUTTON" class="btn btn-primary m-b-0" value="OK" style="font-size:15px; margin-left: 80%;" onClick="close_paymode()" ></div>
</div>
</div>
</div>


<div class="fulldiv" id="gold_rate_div" style="display:none;">
<div class="message_maindiv_new" style="width:500px;">
<div class="message_div_new">
<div class="message_title" style="font-size:18px; font-weight:600;">Gold Rate Is Yet To Be Added. Please Contact The HO.</div>
</div>
</div>
</div>





<div class="wrapper">




<!-- Navbar -->
<?php include ("topheader.php"); ?>

<?php
$Order_Id=base64_decode($_REQUEST['o']);
$Mem_Id=base64_decode($_REQUEST['mem_Id']);
?>




<!-- Main Sidebar Container -->
<?php include ("sidemenu.php"); ?>








<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">

<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h3>New Bill</h3>
</div>
<div class="col-sm-6">

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


<!-- Main content -->
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-12">

<!-- /.card -->
<div class="card">


<!-- /.card-header -->



<div class="card-body">






<div class="row">

<div class="col-sm-3" style="margin-top: 5px;">
<div class="form-group">
<label>Membership ID / Mobile No /Whatsapp No.<span style="color:crimson;font-weight:bold;">*</span></label>
<input type="text" class="form-control" name="memo" id="memo" placeholder="Enter Membership ID / Mobile No" maxlength="10" autocomplete="off" value="<?php echo $Mem_Id;?>" <?php if($Mem_Id!='' || $_REQUEST['memo']!=''){echo "readonly";}?> onKeyPress="handel1(event)">
</div>
</div>

<div class="col-sm-1" id="but_sub"><div class="form-group row">
<label class="col-sm-12 col-form-label">&nbsp;</label>
<div class="col-sm-12" >
<input name="save_submit" id="subbut" type="BUTTON" class="btn btn-primary" value="NEXT" style="width:100px;background-color:#0979d8;border: none;" onClick="Get_order_id()" >
</div>
</div></div>




</div>

<div id="infodiv" style="display:none;">
<div class="row" style="margin-top:5px; ">
<div class="col-sm-3" style="margin-bottom:5px;">
<div class="form-group row">
<div class="col-sm-12">
<div class="row" style="margin:0px;">
<div class="col-sm-5" style="padding-left:0px;">
<select class="form-control" name="title" id="title" style="padding: 2px 4px;" onChange="empty_scan_border(),Get_Gender()">
<option value="" selected>Select Title</option>
<option value="MR.">Mr.</option>
<option value="MS.">Ms.</option>
<option value="MISS.">Miss.</option>
<option value="MRS.">Mrs.</option>
<option value="DR.">Dr.</option>
</select>
</div>
<div class="col-sm-7">
<input type="text" class="form-control" name="uname" id="uname" placeholder="*Enter First Name" autocomplete="off" value="" onKeyDown="empty_scan_border()" >
</div>
</div>
</div>
</div>
</div>

<div class="col-sm-3" style="margin-bottom:5px;"><div class="form-group row">
<div class="col-sm-12">
<input type="text" class="form-control" name="ulastname" id="ulastname" placeholder="*Enter Last Name" autocomplete="off" value="" onKeyDown="empty_scan_border()">
</div>
</div></div>
<div class="col-sm-3" style="margin-bottom:5px;"><div class="form-group row">
<div class="col-sm-12">
<input type="text" class="form-control" name="mob" id="mob" placeholder="Enter Mobile No" autocomplete="off" value="" onKeyPress="return isNumberKey(event)" maxlength="10" oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');" onKeyDown="empty_scan_border()" readonly>
</div>
</div></div>
<div class="col-sm-3" style="margin-bottom:5px;"><div class="form-group row">
<div class="col-sm-12">
<input type="text" class="form-control" name="email" id="email" placeholder="Enter Email ID" autocomplete="off" value="" onKeyDown="empty_scan_border()">
</div>
</div></div>
<div class="col-sm-3" style="margin-bottom:5px;"><div class="form-group row">
<div class="col-sm-12">
<select class="form-control" name="gender" id="gender">
<option value="" selected>Select Gender</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Others">Others</option>
</select>
</div>
</div></div>
<div class="col-sm-3" style="margin-bottom:5px;"><div class="form-group row">
<div class="col-sm-12">
<select class="form-control" name="marital" id="marital">
<option value="" selected>Select Marital Status</option>
<option value="Single">Single</option>
<option value="Married">Married</option>
<!--<option value="Widowed">Widowed</option>
<option value="Divorced">Divorced</option>-->
</select>
</div>
</div></div>

<div class="col-sm-3" style="margin-bottom:5px;"><div class="form-group row">
<div class="col-sm-12">
<input type="text" class="form-control" name="apt_no" id="apt_no" placeholder=" Bld No / Aprt No" autocomplete="off" value="" >
</div>
</div></div>
<div class="col-sm-3" style="margin-bottom:5px;"><div class="form-group row">
<div class="col-sm-12">
<input type="text" class="form-control" name="street" id="street" placeholder=" Street Name" autocomplete="off" value="" >
</div>
</div></div>
<div class="col-sm-3" style="margin-bottom:5px;"><div class="form-group row">
<div class="col-sm-12">
<input type="text" class="form-control" name="add_line" id="add_line" placeholder="Enter Address Line 1 " autocomplete="off" value="" >
</div>
</div></div>
<div class="col-sm-3" style="margin-bottom:5px;"><div class="form-group row">
<div class="col-sm-12">
<input type="text" class="form-control" name="add_line2" id="add_line2" placeholder="Enter Address Line 2 " autocomplete="off" value="" >
</div>
</div></div>
<div class="col-sm-3" style="margin-bottom:5px;"><div class="form-group row">
<div class="col-sm-12">
<input type="text" class="form-control" name="pin" id="pin" placeholder="Enter Pin code" autocomplete="off" value="" onKeyPress="return isNumberKey(event)" maxlength="6">
</div>
</div></div>
<input type="hidden" class="form-control" name="country" id="country" placeholder="Enter Country" autocomplete="off" value="India" readonly >

<div class="col-sm-3" style="margin-bottom:5px;"><div class="form-group row">
<div class="col-sm-12">
<select class="form-control" name="state" id="state" onChange="empty_scan_border()">
<option value="">Select State</option>
<?php
$State=$Mainclass->Fetch_multiple_data("state_master","*","SLN>0 order by State");
foreach($State as $get_state)
{
?>
<option value="<?php echo $get_state['State'];?>"><?php echo $get_state['State'];?></option>
<?php
}
?>
</select>
</div>
</div></div>
<div class="col-sm-3" style="margin-bottom:5px;"><div class="form-group row">
<div class="col-sm-12">
<input type="text" class="form-control" name="city" id="city" placeholder="Enter City" autocomplete="off" value="" >
</div>
</div></div>
<div class="col-sm-3" style="margin-bottom:5px;"><div class="form-group row">
<div class="col-sm-12">
<div class="row" style="margin-right: 0px; margin-left: 0px;">
<div class="col-sm-12 form-control" style="padding:0px;">
<select class="form-control1" name="date_type" id="date_type" style="width:30%; float:left; border:0px; height:26px; padding-left:7px;" onChange="bday()">
<option value="DOB">DOB</option>
<option value="AGE">AGE</option>
</select>
<input type="text" class="form-control" name="dob" id="dob" placeholder="Select Date of Birth" autocomplete="off" style="width:70%; float:left; border:0px; height:26px; padding-left:5px; " onKeyDown="return false;">
<input type="text" class="form-control" name="age" id="age" placeholder="Enter Age" autocomplete="off" style="width:70%; float:left; border:0px; height:26px; padding-left:5px; display:none;" onKeyPress="return isNumberKey(event)" maxlength="3" onBlur="convert_bday()">
</div>
</div>
</div>
</div></div>
<div class="col-sm-3" style="margin-bottom:5px;"><div class="form-group row">
<div class="col-sm-12">
<div class="row" style="margin-right: 0px; margin-left: 0px;">
<div class="col-sm-12 form-control" style="padding:0px;">
<span style="line-height:26px; padding-left:13px;">Anv</span>
<input type="text" class="form-control" name="anniversary" id="anniversary" placeholder="Date of Anniversary" autocomplete="off" style="width:65%; float:right; border:0px; height:26px; padding:0px; " onKeyDown="return false;">
</div>
</div>
</div>
</div></div>

<div class="col-sm-3" style="margin-bottom:5px;"><div class="form-group row">
<div class="col-sm-12">
<select class="form-control" name="purchase_reason" id="purchase_reason" onChange="empty_scan_border()">
<option value="">Reason for Purchase</option>
<?php
$condition=" Reason!='' order by Reason";
$Purchase_Reason=$Mainclass->Fetch_multiple_data('purchase_reason_master','distinct(Reason) as Reason',$condition);
foreach($Purchase_Reason as $Preason)
{
?>
<option value="<?php echo $Preason['Reason'];?>"><?php echo $Preason['Reason'];?></option>
<?php
}
?>
</select>
</div>
</div></div>
<div class="col-sm-3" style="margin-bottom:5px;"><div class="form-group row">
<div class="col-sm-12">
<select class="form-control" name="hear" id="hear" onChange="empty_scan_border()">
<option value="">How did you come to hear about us</option>
<?php
$condition=" Reference_Name!='' order by Reference_Name";
$Get_Reference=$Mainclass->Fetch_multiple_data('reference_master','distinct(Reference_Name) as Reference_Name',$condition);
foreach($Get_Reference as $Reference)
{
?>
<option value="<?php echo $Reference['Reference_Name'];?>"><?php echo $Reference['Reference_Name'];?></option>
<?php
}
?>
</select>
</div>
</div></div>
<div class="col-sm-3" style="margin-bottom:5px;"><div class="form-group row">
<div class="col-sm-12">
<select class="form-control" name="promotion" id="promotion" onChange="empty_scan_border()">
<option value="">Would you like to be part of our promotional list</option>

<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
</div>
</div></div>
<div class="col-sm-3" style="margin-bottom:5px;"><div class="form-group row">
<div class="col-sm-12">
<select class="form-control" name="ethinicity" id="ethinicity" onChange="empty_scan_border()">
<option value="">Ethinicity</option>
<?php
$condition=" Ethinicity!='' order by Ethinicity";
$Get_Ethinicity=$Mainclass->Fetch_multiple_data("ethinicity_master","distinct(Ethinicity) as Ethinicity",$condition);
foreach($Get_Ethinicity as $Ethinicity)
{
?>
<option value="<?php echo $Ethinicity['Ethinicity'];?>"><?php echo $Ethinicity['Ethinicity'];?></option>
<?php
}
?>
</select>
</div>
</div></div>
<div class="col-sm-3" style="margin-bottom:5px; display: none;"><div class="form-group row">
<div class="col-sm-12">
<input type="text" class="form-control" id="cust_gst" name="cust_gst" placeholder="Customer GST No">
</div>
</div></div>
<div class="col-sm-3" style="margin-bottom:5px;"><div class="form-group row">
<div class="col-sm-12">
<input type="hidden" class="form-control" id="billing_date" name="billing_date" placeholder="Billing Date" value="<?php echo date('d-m-Y');?>">
</div>
</div></div>

</div>
</div>

<div id="scandiv" style="display: none;">
<div class="row" style="margin-top:5px;">
<div class="col-sm-3"><div class="form-group row">
<label class="col-sm-12 col-form-label">Scan Product</label>
<div class="col-sm-12">
<input type="text" class="form-control" name="scan" id="scan" placeholder="Scan Product" autocomplete="off" value="" onKeyPress="handel(event)" onKeyDown="empty_scan_border(),empty_product_err()">
</div>
</div></div>
<div class="col-sm-1"><div class="form-group row">
<label class="col-sm-12 col-form-label">&nbsp;</label>
<div class="col-sm-12">
<input name="add_submit" type="BUTTON" class="btn btn-primary" value="ADD" style="width:100px;background-color:#0979d8;border: none;" onClick="ratecheck()">
</div>
</div></div>
<div class="col-sm-5"><div class="form-group row">
<label class="col-sm-12 col-form-label">&nbsp;</label>
<div class="col-sm-12" style="text-align:left;">
<span id="Pro_Err" style="color:#FF0000;"></span>
</div>
</div></div>
</div>
</div>

<div id="billdiv">
</div>

<input type="hidden" id="product"><!--product id--->
<input type="hidden" id="barcode"><!--barcode id--->
<input type="hidden" id="order" value="<?php if($Order_Id!=''){echo $Order_Id;}?>"><!--order id--->
<input type="hidden" id="member" value="<?php echo $Mem_Id;?>"><!--member id--->
<input type="hidden" id="member_type">
<input type="hidden" id="member_SLN">
<input type="hidden" id="member_number">

<!-- /.card-body -->

</div>
<!-- /.card -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</section>
<!-- /.content -->

</div>
<!-- /.content-wrapper -->


<?php include ("footer.php"); ?>

<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Control sidebar content goes here -->


</aside>
<!-- /.control-sidebar -->
</div>




<!-- ./wrapper -->
<!-- jQuery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" ></script>
<!-- Bootstrap 4 -->
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- DataTables & Plugins -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<script src="plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
<script src="plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
<script src="plugins/jszip/jszip.min.js"></script>
<script src="plugins/pdfmake/pdfmake.min.js"></script>
<script src="plugins/pdfmake/vfs_fonts.js"></script>
<script src="plugins/datatables-buttons/js/buttons.html5.min.js"></script>
<script src="plugins/datatables-buttons/js/buttons.print.min.js"></script>
<script src="plugins/datatables-buttons/js/buttons.colVis.min.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="dist/js/demo.js"></script>

<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.14.1/jquery-ui.min.js"></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.pack.js"></script>
<script>
$(function() {
$( "#dob" ).datepicker({
changeMonth: true,
changeYear: true,
yearRange: "1900:<?php echo date('Y');?>",
dateFormat: 'dd-mm-yy'
//dateFormat: 'd MM, yy'
});
});
</script>
<script>
$(function() {
$( "#anniversary" ).datepicker({
changeMonth: true,
changeYear: true,
yearRange: "1980:<?php echo date('Y');?>",
dateFormat: 'dd-mm-yy'
//dateFormat: 'd MM, yy'
});
});
</script>

</body>
</html>