D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
proc
/
self
/
root
/
home
/
shubmkcj
/
urbane.createerp.com
/
Filename :
edit-invoice-original.php
back
Copy
<?php ob_start(); session_start(); include 'config.php'; $login = $_SESSION['login_email']; if($login == ''){ echo '<script>location.replace("index.php")</script>'; } $clientId = ""; if(isset($_GET["clientId"])){ $clientId = $_GET["clientId"]; } if(isset($_SESSION["source_id"])){ $source_id = $_SESSION['source_id']; } $applicable_tax = ""; $tax_manager = "SELECT * FROM tax_manager where set_default_value = 'set' AND source_id = '$source_id'"; $applicableresult = mysqli_query($conn,$tax_manager); if($applicableresult){ if(mysqli_num_rows($applicableresult) > 0){ while( $rowapplicable = mysqli_fetch_assoc($applicableresult)){ $applicable_tax = $rowapplicable['applicable_tax']; } } } $companyd = mysqli_query($conn,"SELECT * FROM `company_details`"); $companyrow = mysqli_fetch_assoc($companyd); $contact_person = $companyrow['contact_person']; $company_name = $companyrow['company_name']; $company_logo = $companyrow['company_logo']; $GSTIN = $companyrow['GSTIN']; $phone = $companyrow['phone']; $eb_email = $companyrow['email']; $address = $companyrow['address']; $city = $companyrow['city']; $state = $companyrow['state']; $country = $companyrow['country']; $account_name = $companyrow['account_name']; $account_no = $companyrow['account_no']; $bank_name = $companyrow['bank_name']; $ifsc = $companyrow['ifsc']; $shift = $companyrow['shift']; $branch = $companyrow['branch']; $company_color = $companyrow['company_color']; $currency = $companyrow['currency']; $invoice_prifix = $companyrow['invoice_prifix']; $default_invoice = $companyrow['default_invoice']; $signature = $companyrow['signature']; $invoice_note = $companyrow['invoice_note']; $item = ""; $sqlitem = "SELECT * FROM inventory WHERE data_delete = 'no' and source_id = '$source_id'"; $resultitem = mysqli_query($conn,$sqlitem); if($resultitem){ if(mysqli_num_rows($resultitem) > 0){ while( $rowitem = mysqli_fetch_assoc($resultitem)){ $item .= "<option value='". $rowitem['id'] ."'>".$rowitem['name']."</option> "; } } } $itemcode = ""; $sqlitemcode = "SELECT * FROM inventory WHERE data_delete = 'no' and source_id = '$source_id'"; $resultitemcode = mysqli_query($conn,$sqlitemcode); if($resultitemcode){ if(mysqli_num_rows($resultitemcode) > 0){ while( $rowitemcode = mysqli_fetch_assoc($resultitemcode)){ $itemcode .= "<option value='". $rowitemcode['item_code'] ."'>".$rowitemcode['item_code']."</option> "; } } } $id = strip_tags($_GET['id']); $sql = " SELECT * FROM generate_invoice where id = '$id' and data_delete = 'NO'"; $result = mysqli_query($conn,$sql); $row = mysqli_fetch_array($result); $bill_pay_name = $row['bill_pay_name']; $proforma_id = $row['proforma_id']; $date = $row['date']; $terms = $row['terms']; $due_date = $row['due_date']; $billingAddress = $row['billingAddress']; $deliver_address = $row['deliver_address']; $pincode = $row['pincode']; $client_name = $row['client_name']; $mobile_no = $row['mobile_no']; $email = $row['email']; $gstin = $row['gstin']; $type = $row['type']; $buyer_reference = $row['buyer_reference']; $delivery_type = $row['delivery_type']; $delivery_terms = $row['delivery_terms']; $mode_of_shipment = $row['mode_of_shipment']; $shipping_date = $row['shipping_date']; $port_of_loading = $row['port_of_loading']; $port_of_delivery = $row['port_of_delivery']; $payment_method_g = $row['payment_method']; $hs_code = $row['hs_code']; $terms_of_payment = $row['terms_of_payment']; $bank_details = $row['bank_details']; $other_charges = $row['other_charges']; $other_charge_msg = $row['other_charge_msg']; $comment = $row['comment']; $other_price = $row['other_price']; $subtotal_price = $row['subtotal_price']; $amount_paid = $row['amount_paid']; $bank_charge = $row['bank_charge']; $invoice_reference = $row['invoice_reference']; $invoice_id = $row['invoice_Id']; $resultCustomerAddress_b = "<option value=''>--Select--</option>"; $getCustomerAddress_b = "SELECT * FROM `contact_address` WHERE id = '$billingAddress' AND is_deleted = 'NO'"; $resultGetCustomerAddress_b = mysqli_query($conn, $getCustomerAddress_b) or die("error"); if($resultGetCustomerAddress_b){ if(mysqli_num_rows($resultGetCustomerAddress_b) > 0){ while($rowGetCustomerAddress_b = mysqli_fetch_assoc($resultGetCustomerAddress_b)){ $addressId_b = $rowGetCustomerAddress_b["id"]; $address_b = $rowGetCustomerAddress_b["address"]; $city_b = $rowGetCustomerAddress_b["city"]; $state_b = $rowGetCustomerAddress_b["state"]; $country_b = $rowGetCustomerAddress_b["country"]; $resultCustomerAddress_b .= "<option value='".$rowGetCustomerAddress_b["id"]."' selected>".$address_b.", ".$city_b.", ".$state_b.", ".$country_b."</option>"; } } } $resultCustomerAddress = "<option value=''>--Select--</option>"; $getCustomerAddress = "SELECT * FROM `contact_address` WHERE contact_id = '$bill_pay_name' AND is_deleted = 'NO'"; $resultGetCustomerAddress = mysqli_query($conn, $getCustomerAddress) or die("error"); if($resultGetCustomerAddress){ if(mysqli_num_rows($resultGetCustomerAddress) > 0){ while($rowGetCustomerAddress = mysqli_fetch_assoc($resultGetCustomerAddress)){ $addressId = $rowGetCustomerAddress["id"]; $address = $rowGetCustomerAddress["address"]; $city = $rowGetCustomerAddress["city"]; $state = $rowGetCustomerAddress["state"]; $country = $rowGetCustomerAddress["country"]; $resultCustomerAddress .= "<option value='".$rowGetCustomerAddress["id"]."' selected>".$address.", ".$city.", ".$state.", ".$country."</option>"; } } } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title> Invoice Management | Invoice</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" /> <meta content="Coderthemes" name="author" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <!-- Font Awsome --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <!-- App favicon --> <link rel="shortcut icon" href="assets/images/favicon.png"> <!-- Pie Chart Css --> <!--<link href="assets/pie charts/style.css" rel="stylesheet" type="text/css" />--> <!-- App css --> <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/icons.css" rel="stylesheet" type="text/css" /> <link href="assets/css/metismenu.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/style.css" rel="stylesheet" type="text/css" /> <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/css/select2.min.css'> <link href="https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet"> </head> <body> <!-- Begin page --> <div id="wrapper"> <!-- Top Bar Start --> <?php include 'top-header.php'; ?> <!-- Top Bar End --> <!-- ========== Left Sidebar Start ========== --> <?php include 'left-sidebar.php'; ?> <!-- Left Sidebar End --> <!-- ============================================================== --> <!-- Start right Content here --> <!-- ============================================================== --> <div class="content-page"> <!-- Start content --> <div class="content"> <div class="container-fluid"> <div class="row"> <div class="col-12"> <div class="page-title-box"> <h4 class="page-title float-left">Create Invoice</h4> <ol class="breadcrumb float-right"> <li class="breadcrumb-item ">Sales</li> <li class="breadcrumb-item active">Create Invoice</li> </ol> <div class="clearfix"></div> </div> </div> </div> <!-- end row --> <form action="update-invoice.php" method="post" class="form-horizontal" role="form"> <input class="form-control" type="hidden" name="id" value="<?php echo $id?>"> <div class="card-box"> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label class="col-form-label">Bill Pay Name</label> <select class="form-control select" name="bill_pay_name" onchange="showUser(this.value)"> <option value=''>--Select Customer--</option> <?php $sql = "SELECT * FROM contact where trim(data_delete) != 'yes'"; $result = mysqli_query($conn,$sql); while( $row = mysqli_fetch_array($result)){ $company_name = $row['bill_display_name']; ?> <option value="<?php echo $row['id'] ?>" <?php if($bill_pay_name == $row['id']){ echo "selected"; } ?>><?php echo $company_name ?></option> <?php } ?> </select> </div> </div> <div class="col-md-6"> <div class="row"> <div class="col-md-4"> <div class="form-group"> <label id="lblInvoice" class="col-form-label">Invoice Id</label> <input type="text" name="invoice_id" class="form-control" value="<?php echo $invoice_id ?>" readonly> </div> </div> <div class="col-md-4"> <div class="form-group"> <label id="lblInvoice" class="col-form-label">Invoice Reference</label> <input type="text" name="invoice_reference" class="form-control" value="<?php echo $invoice_reference ?>" required readonly> </div> </div> <div class="col-md-4"> <div class="form-group"> <label id="lblInvoice" class="col-form-label">Proforma Id</label> <input type="text" name="proforma_id" class="form-control" value="<?php echo $proforma_id ?>" readonly> </div> </div> </div> </div> </div> <div class="row"> <div class="col-md-4"> <div class="form-group"> <label for="inputPassword4" class="col-form-label">Date</label> <input type="text" class="form-control" name="date" id="date" value="<?php echo $date; ?>"> </div> </div> <div class="col-md-4"> <div class="form-group"> <label for="terms" class="col-form-label">Terms</label> <select class="form-control" name="terms" id="terms"> <option value="">--Select--</option> <option value="Paid" <?php if($terms == 'Paid'){ echo "selected"; } ?>>Paid</option> <option value="7 days" <?php if($terms == '7 days'){ echo "selected"; } ?>>7 days</option> <option value="15 days" <?php if($terms == '15 days'){ echo "selected"; } ?>>15 days</option> <option value="30 days" <?php if($terms == '30 days'){ echo "selected"; } ?>>30 days</option> <option value="60 days" <?php if($terms == '60 days'){ echo "selected"; } ?>>60 days</option> <option value="Due end of the month" <?php if($terms == 'Due end of the month'){ echo "selected"; } ?>>Due end of the month</option> <option value="Due end of the next month" <?php if($terms == 'Due end of the next month'){ echo "selected"; } ?>>Due end of the next month</option> <option value="Due on reciept" <?php if($terms == 'Due on reciept'){ echo "selected"; } ?>>Due on reciept</option> <option value="Custom" <?php if($terms == 'Custom'){ echo "selected"; } ?>>Custom</option> </select> </div> </div> <div class="col-md-4"> <div class="form-group"> <label for="inputPassword4" class="col-form-label">Due Date</label> <input type="text" class="form-control" id="due_date" name="due_date" value="<?php echo $due_date; ?>"> </div> </div> </div> <div class="row"> <div class="col-md-4"> <div class="form-group"> <label for="inputEmail3" class="col-form-label">Biling Address</label> <select name="billingAddress" class="form-control billingAddress" onchange="getAddressDetail(this.value)"> <?php echo $resultCustomerAddress_b ?> </select> </div> </div> <div class="col-md-4"> <div class="form-group"> <label for="inputEmail3" class="col-form-label">Delivery Address</label> <select name="deliveryAddress" class="form-control billingAddress"> <?php echo $resultCustomerAddress ?> </select> </div> </div> <div class="col-md-4"> <div class="form-group"> <label class="col-form-label">Delivery Pincode</label> <input class="form-control" name="pincode" id="pin" value="<?php echo $pincode ?>"> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="inputEmail3" class="col-form-label">Client Name</label> <input type="text" class="form-control" name="client_name" id="client_name" value="<?php echo $client_name ?>"> <!--<select class="form-control select" name="client_name" >--> <!-- <option value="">--Select--</option>--> <?php // <!-- $sqlGetCompanyName = "SELECT * FROM contact where data_delete = 'no'";--> // <!-- $resultGetCompanyName = mysqli_query($conn, $sqlGetCompanyName);--> // <!-- if($resultGetCompanyName){--> // <!-- if(mysqli_num_rows($resultGetCompanyName) > 0){--> // <!-- while($rowGetCompanyName = mysqli_fetch_array($resultGetCompanyName)){ --> // <!-- $customer_client_contact_person = $rowGetCompanyName['contact_person_name'];--> ?> <!-- <option value="<?php echo $rowGetCompanyName['contact_person_name'] ?>" <?php if($client_name == $customer_client_contact_person){ echo "selected"; } ?>><?php echo $rowGetCompanyName['contact_person_name'] ?></option>--> <?php // <!-- } --> // <!-- } --> // <!-- } --> ?> <!--</select>--> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="inputEmail3" class="col-form-label"> Mobile Number</label> <input type="text" class="form-control" name="mobile" id="phone" value="<?php echo $mobile_no ?>"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="inputEmail3" class="col-form-label"> Email Address</label> <input type="email" id="email" class="form-control" name="email" value="<?php echo $email ?>"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="inputEmail3" class="col-form-label"> GSTIN Number</label> <input type="text" class="form-control" name="gstin" id="gstin" value="<?php echo $gstin ?>"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Type</label> <select class="form-control" name="type"> <option>--select type--</option> <option value="Export" <?php if($type == 'Export'){ echo "selected";} ?>>Export</option> <option value="Import" <?php if($type == 'Import'){ echo "selected";} ?>>Import</option> <option value="Domastic" <?php if($type == 'Domastic'){ echo "selected";} ?>>Domastic</option> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Buyer Reference</label> <input class="form-control" name="buyerreference" value="<?php echo $buyer_reference ?>"> </div> </div> </div> </div> <div class="card-box"> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label>Delivery Type</label> <input class="form-control" name="delivery_type" value="<?php echo $delivery_type ?>"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Delivery Terms</label> <select class="form-control" name="delivery_terms" id="delivery_terms"> <option value="">--Select--</option> <option value="deliver" <?php if($delivery_terms == 'deliver'){ echo "selected"; } ?>>Deliver</option> <option value="7 days" <?php if($delivery_terms == '7 days'){ echo "selected"; } ?>>7 days</option> <option value="15 days" <?php if($delivery_terms == '15 days'){ echo "selected"; } ?>>15 days</option> <option value="30 days" <?php if($delivery_terms == '30 days'){ echo "selected"; } ?>>30 days</option> <option value="60 days" <?php if($delivery_terms == '60 days'){ echo "selected"; } ?>>60 days</option> <option value="Due end of the month" <?php if($delivery_terms == 'Due end of the month'){ echo "selected"; } ?>>Due end of the month</option> <option value="Due end of the next month" <?php if($delivery_terms == 'Due end of the next month'){ echo "selected"; } ?>>Due end of the next month</option> <option value="Due on reciept" <?php if($delivery_terms == 'Due on reciept'){ echo "selected"; } ?>>Due on reciept</option> <option value="Custom" <?php if($delivery_terms == 'Custom'){ echo "selected"; } ?>>Custom</option> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Mode Of Shipment</label> <select class="form-control" name="mode_of_shipment"> <option value="">-- select option --</option> <option value="By Air" <?php if($mode_of_shipment == 'By Air'){ echo "selected"; } ?>>By Air</option> <option value="By Sea" <?php if($mode_of_shipment == 'By Sea'){ echo "selected"; } ?>>By Sea</option> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="inputPassword4" class="col-form-label">Shipping Date</label> <input type="text" class="form-control" id="shipping_date" name="shipping_date" value="<?php echo $shipping_date; ?>"> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label>Port Of Loading</label> <input class="form-control" name="post_of_loading" value="<?php echo $port_of_loading ?>"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Port Of Delivery</label> <input class="form-control" name="port_of_delivery" value="<?php echo $port_of_delivery ?>"> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label>Payment Method</label> <select class="form-control select" name="payment_method" > <option value="">--Select--</option> <?php $sqlpayment = "SELECT * FROM `company_details` where data_delete = 'no'"; $resultpayment = mysqli_query($conn, $sqlpayment); if($resultpayment){ if(mysqli_num_rows($resultpayment) > 0){ while($rowpayment = mysqli_fetch_array($resultpayment)){ $paymentmethod = explode(',',$rowpayment['payment_method']); foreach($paymentmethod as $paymentmethoda){ ?> <option value="<?php echo $paymentmethoda ?>" <?php if($payment_method_g == $paymentmethoda){ echo "selected"; } ?>><?php echo $paymentmethoda ?></option> <?php } } } } ?> </select> </div> </div> <!--<div class="col-md-4">--> <!-- <div class="form-group">--> <!-- <label>HS Code</label>--> <!-- <input class="form-control" name="hs_code" value="<?php echo $hs_code ?>"> --> <!-- </div>--> <!--</div>--> <div class="col-md-6"> <div class="form-group"> <label for="inputPassword4">Revised Date</label> <input class="form-control" name="revised_date" id="revised_date" value="<?php echo date('j F Y'); ?>"> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label>Terms Of Payment</label> <textarea class="form-control" name="termsofpayment" id="terms_condtion"><?php echo $terms_of_payment ?></textarea> </div> </div> <?php $bank = mysqli_query($conn,"SELECT * FROM `company_details`"); $bankrow = mysqli_fetch_assoc($bank); $account_name = $bankrow['account_name']; $account_no = $bankrow['account_no']; $bank_name = $bankrow['bank_name']; $ifsc = $bankrow['ifsc']; $shift = $bankrow['shift']; $branch = $bankrow['branch']; ?> <div class="col-md-6"> <div class="form-group"> <label>Bank Details</label> <textarea class="form-control" name="bank_details" id="terms_condtion">Account Name : <?php echo $account_name ?>, Account No. : <?php echo $account_no ?>, Bank Name : <?php echo $bank_name ?> , IFSC : <?php echo $ifsc ?>, Shift : <?php echo $shift ?>, Branch : <?php echo $branch ?></textarea> </div> </div> </div> </div> <div class="card-box"> <div class="row"> <div class="col-md-6"> <label>Other Charges</label> <input class="form-control other_charges" name="other_charges" id="other_charges" value="<?php if($other_charges == ''){ echo "0";}else{ echo $other_charges; } ?>"> </div> <div class="col-md-6"> <label>Other Charges (Short Message)</label> <input class="form-control" name="short_msg" id="short_msg" value="<?php echo $other_charge_msg ?>"> </div> </div> <div class="row mt-3"> <div class="col-md-12"> <div class="form-group"> <label>Comment</label> <textarea class="form-control" name="comment" placeholder="Enter Your Comment"><?php echo $comment ?></textarea> </div> </div> </div> <div class="row mt-3"> <button id="add" class="btn add-more button-yellow uppercase" type="button"> + Add Line Item</button> <table class="table table-responsive"> <thead> <tr style="width:100%"> <th>Item Code</th> <th>Item Image</th> <th>Item Name</th> <th>Size</th> <th>Color</th> <th>Qty</th> <th>Unit</th> <th>Price</th> <th>Total</th> <th></th> </tr> </thead> <tbody id='itemsadd'> <?php $getitemsql = mysqli_query($conn,"SELECT * FROM invoice_item a left join inventory b on a.item_id = b.id where a.invoice_reference = '$invoice_reference'"); while($item_row = mysqli_fetch_assoc($getitemsql)){ $fqty = 0; $qty_p = 0; $item_id_p = $item_row['item_id']; $item_code_p = $item_row['item_code']; $qty_p = $item_row['qty']; $price_p = $item_row['price']; $size_p = $item_row['size']; $row_total = $item_row['row_total']; $item_p_img = 'inventory/'.$item_row['item_image']; $item_name = $item_row['name']; $color_p = $item_row['color']; $unit_p = $item_row['unit_of_measure']; ?> <tr id='next-referral' style="width:100%"> <td style="width:10%"> <input class='form-control itemcode' name="item_code[]" type='text' value='<?php echo $item_code_p ?>'> </td> <td style="width:10%"> <img class="img_item" src="<?php echo $item_p_img ?>" width="50"> </td> <td style="width:18%"> <div id="text"> <select class="form-control select itemClass" name="item[]" onchange="showitem(this)"> <option value='<?php echo $item_id_p ?>'><?php echo $item_name ?></option> <?php $sqlitem = "SELECT * FROM inventory where data_delete = 'no' and source_id = '$source_id'"; $resultitem = mysqli_query($conn,$sqlitem); if($resultitem){ if(mysqli_num_rows($resultitem) > 0){ while( $rowitem = mysqli_fetch_assoc($resultitem)){ ?> <option value='<?php echo $rowitem['id'] ?>' <?php if($item_id_p == $rowitem['id']){ echo "selected";} ?>><?php echo $rowitem['name'] ?></option> <?php } } } ?> </select> </div> </td> <td style="width:10%"> <input class='form-control sizeClass' name="size[]" type="text" ondrop='return false;' value='<?php echo $size_p ?>'> </td> <td style="width:10%"> <input class='form-control colorClass' name='color[]' type="text" ondrop='return false;' value='<?php echo $color_p ?>'> </td> <td style="width:10%"> <input class='form-control quantityClass' name='qty[]' type="text" ondrop='return false;' value='<?php echo $qty_p ?>'> </td> <td style="width:7%"> <input class='form-control unitClass' name='unit[]' type='text' ondrop='return false;' value="<?php echo $unit_p ?>"> </td> <td style="width:10%"> <input class='form-control priceClass' name='price[]' type='text' ondrop='return false;' value='<?php echo $price_p ?>'> </td> <td style="width:15%"> <input type="text" name="total_amt[]" class='form-control totalClass' value='<?php echo $row_total ?>' readonly> </td> <td><button type="button" class="btn btn-xs btn-danger delete"><span class="fa fa-trash"></span></button></td> </tr> <?php } ?> </tbody> </table> </div> <div class="row"> <div class="col-md-6"> </div> <div class="col-md-6"> <div class="form-group row"> <label class="col-4 col-form-label" for="example-email">Other </label> <div class="col-8"> <input type="text" id="other_charges_t" class="form-control" name="other_charges_t" value="<?php echo $other_price ?>" readonly> </div> </div> <div class="form-group row"> <label class="col-4 col-form-label" for="example-email">Subtotal </label> <div class="col-8"> <input type="text" id="a4" class="form-control" name="subtotal" value="<?php echo $subtotal_price ?>" readonly> </div> </div> <div class="form-group row"> <label class="col-4 col-form-label" for="example-email">Bank Charges</label> <div class="col-8"> <input type="text" id="bank_charges" class="form-control bank_charges" name="bank_charges" value="<?php echo $bank_charge ?>" autocomplete="off"> </div> </div> <div class="form-group row"> <label class="col-4 col-form-label" for="example-email">Amount Paid </label> <div class="col-8"> <input type="text" id="amountvalue" class="form-control" name="amount_paid" value="<?php echo $amount_paid ?>" readonly> </div> </div> </div> </div> </div> <button type="submit" class="btn btn-info waves-effect waves-light w-100">Submit</button> </form> </div> </div> <!-- container --> </div> <!-- content --> <?php include 'copyrignt.php' ?> </div> <!-- ============================================================== --> <!-- End Right content here --> <!-- ============================================================== --> </div> <!-- END wrapper --> <!-- Chart Js --> <script src='https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.11/c3.min.js'></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.3/Chart.js'></script> <!-- jQuery --> <script src="assets/js/jquery.min.js"></script> <script src="assets/js/popper.min.js"></script><!-- Popper for Bootstrap --> <script src="assets/js/bootstrap.min.js"></script> <script src="assets/js/metisMenu.min.js"></script> <!--<script src="assets/js/waves.js"></script>--> <script src="assets/js/jquery.slimscroll.js"></script> <!-- Dashboard init --> <script src="assets/pages/jquery.dashboard.js"></script> <!-- App js --> <script src="assets/js/jquery.core.js"></script> <script src="assets/js/jquery.app.js"></script> <!-- Chart Js --> <!-- <script src="assets/pie charts/script.js"></script>--> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js'></script> <script src="https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script> <script src='https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/js/select2.min.js'></script> <script src="assets/js/modernizr.min.js"></script> <!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> --> <script type="text/javascript" src="script.js"></script> <script> $(document).ready(function() { //when the Add Field button is clicked $("#add").click(function(e) { $(".delete").fadeIn("1500"); //Append a new row of code to the "#items" div $("#itemsadd").append( "<tr id='next-referral' style='width:100%'><td style='width:10%'><div id='textcode'><select class='form-control select itemcode itemCodeClass' name='item_code[]' onchange='showitemcode(this)'><option value=''>--Select Item--</option><?php echo $itemcode; ?></select></div></td><td style='width:10%'><img class='img_item' src='' width='50'></td><td style='width:20%'><div id='text'><select class='form-control select itemClass itemClassDks' name='item[]' onchange='showitem(this)'><option value=''>--Select Item--</option><?php echo $item; ?></select></div></td><td style='width:10%'><input class='form-control sizeClass' name='size[]' type='text' ondrop='return false;'></td><td style='width:10%'><input class='form-control colorClass' name='color[]' type='text' ondrop='return false;'></td><td style='width:10%'><input class='form-control quantityClass' name='qty[]' type='text' ondrop='return false;'></td><td style='width:5%'><input class='form-control unitClass' name='unit[]' type='text' ondrop='return false;'></td><td style='width:10%'><input class='form-control priceClass' name='price[]' type='text' ondrop='return false;'></td><td style='width:15%'><input type='text' name='total_amt[]' value='' class='form-control totalClass' readonly></td><td><button type='button' class='btn btn-xs btn-danger delete'><span class='fa fa-trash'></span></button></td></tr>" ); // $("#itemsadd").append( // "<tr id='next-referral' style='width:100%'><td style='width:10%'><input class='form-control itemcode' name='item_code[]' type='text'></td><td style='width:10%'><img class='img_item' src='' width='50'></td><td style='width:20%'><div id='text'><select class='form-control select itemClass' name='item[]' onchange='showitem(this)'><option value=''>--Select Item--</option><?php echo $item; ?></select></div></td><td style='width:10%'><input class='form-control sizeClass' name='size[]' type='text' ondrop='return false;'></td><td style='width:10%'><input class='form-control colorClass' name='color[]' type='text' ondrop='return false;'></td><td style='width:10%'><input class='form-control quantityClass' name='qty[]' type='text' ondrop='return false;'></td><td style='width:5%'><input class='form-control unitClass' name='unit[]' type='text' ondrop='return false;' ></td><td style='width:10%'><input class='form-control priceClass' name='price[]' type='text' ondrop='return false;' ></td><td style='width:15%'><input type='text' name='total_amt[]' value='' class='form-control totalClass' readonly></td><td><button type='button' class='btn btn-xs btn-danger delete'><span class='fa fa-trash'></span></button></td></tr>" // ); forSelect(); }); //("body").on("click", ".delete", function(e) { //$("#next-referral").last().remove(); //}); }); </script> <script> function selectOption() { $('.select').select2(); } $(document).ready(function() { forSelect(); }); function forSelect() { selectOption(); $('#add').click(function() { var text = $('#text').html(); $('#demo').append(text); $('#demo .select').select2(); $('#demo .select').last().next().next().remove(); }); } $(document).on('keyup', '.quantityClass,.priceClass', function() { var sum = 0; var gsum = 0; var price = 0; var quantity = 0; var tax = 0; var discountApplied = 0; var thisRow = $(this).closest('tr'); thisRow.find('.priceClass').each(function() { if (this.value == null || this.value == '') price = 0; else price = this.value; }); thisRow.find('.quantityClass').each(function() { if (this.value == null || this.value == '') quantity = 0; else quantity = this.value; }); var decreaseValue = parseFloat(price) * parseFloat(quantity); var subTotal = (parseFloat(decreaseValue)).toFixed(2); thisRow.find('.totalClass').val(subTotal); var totalColumn = $(this).closest('tr').parent(); // for total amount var totalPrice = 0; totalColumn.find('.totalClass').each(function() { totalPrice = (parseFloat(totalPrice) + parseFloat(this.value)).toFixed(2); }); $("#a4").val(totalPrice); //----------------------------- var other_charges = $('#other_charges').val(); var other_charges = $('#other_charges').val(); var bank_charges = $('#bank_charges').val(); $("#other_charges_t").val((parseFloat(other_charges)).toFixed(2)); var other_foreign_subtotal = (parseFloat(totalPrice) + parseFloat(other_charges)+ parseFloat(bank_charges)).toFixed(2); $("#amountvalue").val((parseFloat(other_foreign_subtotal)).toFixed(2)); }); $(document).on('keyup', '.other_charges,.bank_charges', function() { var other_charges = 0; var bank_charges = 0; var totalPrice = $('#a4').val(); var other_charges = $('#other_charges').val(); var bank_charges = $('#bank_charges').val(); if (bank_charges == null || bank_charges == ''){ var bank_charges = 0; }else{ var bank_charges = $('#bank_charges').val(); } if (totalPrice == null || totalPrice == ''){ var totalPrice = 0; }else{ var totalPrice = $('#a4').val(); } if (other_charges == null || other_charges == ''){ var other_charges = 0; }else{ var other_charges = $('#other_charges').val(); } if (bank_charges == null || bank_charges == ''){ var bank_charges = 0; }else{ var bank_charges = $('#bank_charges').val(); } $("#other_charges_t").val((parseFloat(other_charges)).toFixed(2)); var other_subtotal = (parseFloat(totalPrice) + parseFloat(other_charges) + parseFloat(bank_charges)).toFixed(2); $("#amountvalue").val((parseFloat(other_subtotal)).toFixed(2)); }); $(document).on('click', '.delete', function() { var totalColumn = $(this).closest('tr').parent(); $(this).closest('tr').remove(); // for total amount var totalPrice = 0; totalColumn.find('.totalClass').each(function() { totalPrice = (parseFloat(totalPrice) + parseFloat(this.value)).toFixed(2); }); $("#a4").val(totalPrice); var other_charges = $('#other_charges').val(); if (other_charges == null || other_charges == ''){ var other_charges = 0; }else{ var other_charges = $('#other_charges').val(); } var bank_charges = $('#bank_charges').val(); if (bank_charges == null || bank_charges == ''){ var bank_charges = 0; }else{ var bank_charges = $('#bank_charges').val(); } var other_subtotal = (parseFloat(totalPrice) + parseFloat(other_charges) + parseFloat(bank_charges)).toFixed(2); $("#amountvalue").val((parseFloat(other_subtotal)).toFixed(2)); }); $(document).ready(function() { $("#s").change(function() { if (!this.checked) { $("#due_date").removeAttr('disabled'); $("#due_date").removeAttr('readonly'); if ($("#due_date").val() == "Paid") { $("#due_date").val("<?php echo date('j F Y'); ?> "); } } else { $("#due_date").attr('disabled', 'disabled'); $("#due_date").attr('readonly', 'true'); $("#due_date").val("Paid"); } }); //triger change event in case checkbox checked when user accessed page $("#s").trigger("change") }); $(document).ready(function() { $("#due_date,#date,#shipping_date,#revised_date").datepicker({ dateFormat: 'dd MM yy' }); }); $(document).ready(function(){ $("#terms").change(function(){ var date1 = $('#date').val(); var date = new Date( Date.parse( date1 ) ); var terms = $( "#terms option:selected" ).val(); if(terms === "Paid"){ } else if(terms === "7"){ date.setDate( date.getDate() + 7 ); var newDate = date.toDateString(); newDate = new Date( Date.parse( newDate ) ); $('#due_date').datepicker('setDate', newDate ); } else if(terms === "15"){ date.setDate( date.getDate() + 15 ); var newDate = date.toDateString(); newDate = new Date( Date.parse( newDate ) ); $('#due_date').datepicker('setDate', newDate ); } else if(terms === "30"){ date.setDate( date.getDate() + 30 ); var newDate = date.toDateString(); newDate = new Date( Date.parse( newDate ) ); $('#due_date').datepicker('setDate', newDate ); } else if(terms === "60"){ date.setDate( date.getDate() + 60 ); var newDate = date.toDateString(); newDate = new Date( Date.parse( newDate ) ); $('#due_date').datepicker('setDate', newDate ); } else if(terms === "Due end of the month"){ $('#due_date').datepicker('setDate', new Date(date.getFullYear(), date.getMonth() + 1, 0)); } else if(terms === "Due on reciept"){ $('#due_date').datepicker('setDate', date); } else if(terms === "Due end of the next month"){ $('#due_date').datepicker('setDate', new Date(date.getFullYear(), date.getMonth() + 2, 0)); } }); }); $(document).ready(function(){ $("#date").change(function(){ $("#terms").trigger("change"); }); $("#due_date").change(function(){ $('#terms option[value="Custom"]').attr("selected", "selected"); }); // $("#date").datepicker("setDate", new Date()); // $("#due_date").datepicker("setDate", new Date()); }); $(document).ready(function(){ $("#delivery_terms").change(function(){ var date1 = $('#date').val(); var date = new Date( Date.parse( date1 ) ); var terms = $( "#delivery_terms option:selected" ).val(); if(terms === "deliver"){ } else if(terms === "7"){ date.setDate( date.getDate() + 7 ); var newDate = date.toDateString(); newDate = new Date( Date.parse( newDate ) ); $('#shipping_date').datepicker('setDate', newDate ); } else if(terms === "15"){ date.setDate( date.getDate() + 15 ); var newDate = date.toDateString(); newDate = new Date( Date.parse( newDate ) ); $('#shipping_date').datepicker('setDate', newDate ); } else if(terms === "30"){ date.setDate( date.getDate() + 30 ); var newDate = date.toDateString(); newDate = new Date( Date.parse( newDate ) ); $('#shipping_date').datepicker('setDate', newDate ); } else if(terms === "60"){ date.setDate( date.getDate() + 60 ); var newDate = date.toDateString(); newDate = new Date( Date.parse( newDate ) ); $('#shipping_date').datepicker('setDate', newDate ); } else if(terms === "Due end of the month"){ $('#shipping_date').datepicker('setDate', new Date(date.getFullYear(), date.getMonth() + 1, 0)); } else if(terms === "Due on reciept"){ $('#shipping_date').datepicker('setDate', date); } else if(terms === "Due end of the next month"){ $('#shipping_date').datepicker('setDate', new Date(date.getFullYear(), date.getMonth() + 2, 0)); } }); }); $(document).ready(function(){ $("#shipping_date").change(function(){ $("#delivery_terms").trigger("change"); }); $("#shipping_date").change(function(){ $('#delivery_terms option[value="Custom"]').attr("selected", "selected"); }); // $("#date").datepicker("setDate", new Date()); // $("#shipping_date").datepicker("setDate", new Date()); }); // getInvoicePrefix("<?php echo $source_id; ?>"); // $("input[name=invoiceType]").click(function(){ // if($(this).val() == "Invoice"){ // $("#lblInvoice").text("Invoice Number"); // getInvoicePrefix("<?php echo $source_id; ?>"); // } // else{ // getPerformaNumber(); // $("#lblInvoice").text("Performa Id"); // } // }); // function getPerformaNumber(){ // var companyId = "<?php echo $source_id; ?>"; // $.ajax({ // url : "PHP/response.php", // data : "action=GetPerforma&companyId="+companyId, // async : false, // method : "POST", // success : function(response){ // var val = (response * 1) + 1; // $("#invoice_number").val(val); // var s_number = ('0000' + val).substr(-5); // $("#invoice_id").val("#PI"+s_number); // }, // error : function(err){ // } // }); // } </script> <?php if($clientId != ""){ // echo "<script>showUser('".$clientId."');</script>"; } ?> <!--My js--> <script> function getAddressDetail(addressId){ $.ajax({ url: "get-contact-details.php?companyId=" + addressId, method: "GET", async: false, success : function(response){ var str = JSON.parse(response); if(str != ""){ $("#address").val(str.address); $("#country").val(str.country); $("#country").trigger("change"); $("#state").val(str.state); $("#city").val(str.city); $("#pin").val(str.pin); $("#phone").val(str.phone); $("#email").val(str.email); $("#gstin").val(str.gstin); $("#bank_charges").val(str.bank_charges); $("#iecno").val(str.iecno); $("#type").val(str.type); $("#panno").val(str.panno); $("#currency").val(str.currency); $("#opening_balance").val(str.opening_balance); $("#terms_condtion").val(str.terms_condtion); } }, error:function(err){ } }); } function showUser(str) { $.ajax({ url: "getCustomerAddress.php?companyId=" + str, method: "GET", async: false, success: function(response) { $(".billingAddress").html(response); }, error: function(jqXHR, textStatus, errorThrown) { alert('Internal error: ' + jqXHR.responseText); } }) } function showitem(str) { var thisRow = $(str).closest('tr'); var item = thisRow.find('.itemClass').val(); if (item == "") { document.getElementById("txtHint").innerHTML = ""; return; } $.ajax({ url: "getitem.php", method: "POST", async: false, data: {q:item}, success: function(response) { var str1 = JSON.parse(response); thisRow.find('.itemcode').val(str1.item_code); thisRow.find('.item_qty').val(str1.item_qty); thisRow.find('.item_id').val(str1.id); thisRow.find(".img_item").attr("src",'inventory/'+str1.item_image); // thisRow.find('.discountAppliedClass').val(str1.discount_applied); // thisRow.find('.discountCategoryClass').val(str1.discount_category); if(thisRow.find('.quantityClass').val() != ""){ thisRow.find('.quantityClass').trigger("keyup"); } }, error: function(jqXHR, textStatus, errorThrown) { alert('Internal error: ' + jqXHR.responseText); } }) } function showitemcode(str) { var thisRow = $(str).closest('tr'); var txtitemcode = thisRow.find('.itemCodeClass').val(); // alert item; $.ajax({ url: "getitemCode.php", method: "POST", async: false, data: {txtitemcode:txtitemcode}, success: function(response) { var str1 = JSON.parse(response); // var optn='<option value='str1.id'>str1.name</option>'; thisRow.find('.itemcode').val(str1.item_code); thisRow.find('.itemClassDks').append(`<option selected value='${str1.id}'>${str1.name}</option>`); thisRow.find('.item_qty').val(str1.item_qty); thisRow.find('.item_id').val(str1.id); thisRow.find('.sizeClass').val(str1.size); thisRow.find('.colorClass').val(str1.color); thisRow.find('.unitClass').val(str1.unit_of_measure); thisRow.find(".img_item").attr("src",'inventory/'+str1.item_image); // thisRow.find('.discountAppliedClass').val(str1.discount_applied); // thisRow.find('.discountCategoryClass').val(str1.discount_category); if(thisRow.find('.quantityClass').val() != ""){ thisRow.find('.quantityClass').trigger("keyup"); } }, error: function(jqXHR, textStatus, errorThrown) { alert('Internal error: ' + jqXHR.responseText); } }) } </script> </body> </html>