D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
shubmkcj
/
urbane.createerp.com
/
Filename :
create-proforma-invoice-copy.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']; } $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> "; } } } $datacodeitem = ""; $datacodesqlitem = "SELECT * FROM inventory WHERE data_delete = 'no' and source_id = '$source_id'"; $datacoderesultitem = mysqli_query($conn,$datacodesqlitem); if($datacoderesultitem){ if(mysqli_num_rows($datacoderesultitem) > 0){ while( $datacoderowitem = mysqli_fetch_assoc($datacoderesultitem)){ $datacodeitem .= "<option value='". $datacoderowitem['id'] ."'>".$datacoderowitem['item_code']."</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"> <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"> <link href="plugins/sweet-alert2/sweetalert2.min.css" rel="stylesheet" type="text/css"> <link href="plugins/jquery-toastr/jquery.toast.min.css" rel="stylesheet" /> <style> .filter_price_value{ cursor: pointer; text-align: center; display: block; color:blue !important; } #myModalShowRateItem .table td:nth-child(1),#myModalShowRateItem .table th:nth-child(1){ width:50px !important; text-align:center; } #myModalShowRateItem .table td:nth-child(2),#myModalShowRateItem .table th:nth-child(2){ width:100px !important; text-align:center; } </style> </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 Proforma</h4> <ol class="breadcrumb float-right"> <li class="breadcrumb-item ">Sales</li> <li class="breadcrumb-item active">Create Proforma</li> </ol> <div class="clearfix"></div> </div> </div> </div> <div class="row"> <div class="col-md-12"> <button data-toggle="modal" data-target="#myModal" class="btn add-more theme-bg uppercase w-100 mb-2" type="button"> + Add New Item </button> </div> </div> <?php $getting_proforma = mysqli_query($conn,"SELECT max(id) AS performa_number FROM `proforma`"); $getting_proformarow = mysqli_fetch_assoc($getting_proforma); $getting_proforma_id = $getting_proformarow['performa_number'] + 1; ?> <!-- end row --> <form action="insert-proforma.php" method="post" class="form-horizontal" role="form"> <div class="card-box"> <div class="row"> <div class="col-md-12"> <div class="form-group"> <label class="col-form-label">Bill Pay Name</label> <select id="show_bill_pay_name" class="form-control select" name="bill_pay_name" onchange="showUser(this.value)" required> <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']; $company_name_id = $row['id']; ?> <option value="<?php echo $row['id'] ?>"><?php echo $company_name ?></option> <?php } ?> </select> <input type="hidden" id="partyIdDks" > </div> </div> <!--<div class="col-md-6">--> <!-- <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 $invoice_prifix.$getting_proforma_id ?>" readonly>--> <!-- </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('j F Y'); ?>"> </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" required> <option value="">--Select--</option> <option value="Paid">Paid</option> <option value="7 days">7 days</option> <option value="15 days">15 days</option> <option value="30 days">30 days</option> <option value="60 days">60 days</option> <option value="Due end of the month">Due end of the month</option> <option value="Due end of the next month">Due end of the next month</option> <option value="Due on reciept">Due on reciept</option> <option value="Custom">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 date('j F Y'); ?>"> </div> </div> </div> <div class="row"> <div class="col-md-4"> <div class="form-group"> <label for="inputEmail3" class="col-form-label">Billing Address</label> <select name="billingAddress" class="form-control billingAddress" onchange="getAddressDetail(this.value)" required> <option value="">--Select--</option> </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" required> <option value="">--Select--</option> </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" required> </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> <select class="form-control" name="client_name" id="contact_person_name" required> <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)){ ?> <option value="<?php echo $rowGetCompanyName['contact_person_name'] ?>"><?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"> </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" > </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"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Type</label> <select class="form-control" name="type" id="type"> <option value=''>--select type--</option> <option>Export</option> <option>Import</option> <option>Domastic</option> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Buyer Reference</label> <input class="form-control" name="buyerreference"> </div> </div> </div> </div> <div class="card-box"> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label>Delivery Type</label> <select class="form-control select" name="delivery_type"> <option value="">-- Select Delivery Type--</option> <option value="FOB">FOB</option> <option value="EXW China">EXW China</option> <option value="CNF Air">CNF Air</option> <option value="CNF Sea">CNF Sea</option> <option value="Courier">Courier</option> <option value="other">Other</option> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Delivery Terms</label> <select class="form-control select" name="delivery_terms" id="delivery_terms"> <option value="">--Select--</option> <option value="deliver">Deliver</option> <option value="7 days">7 days</option> <option value="15 days">15 days</option> <option value="30 days">30 days</option> <option value="60 days">60 days</option> <option value="Due end of the month">Due end of the month</option> <option value="Due end of the next month">Due end of the next month</option> <option value="Due on reciept">Due on reciept</option> <option value="Custom">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">By Air</option> <option value="By Sea">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 date('j F Y'); ?>"> </div> </div> </div> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label>Port Of Loading</label> <select name="post_of_loading" class="form-control select"> <option value="">-- select port of loading --</option> <?php $sql_t = mysqli_query($conn,"SELECT * FROM company_details"); $row_t = mysqli_fetch_array($sql_t); $port_loading = explode('--',$row_t['port_loading']); foreach($port_loading as $port_loadinga){ if($port_loadinga != ''){ ?> <option value="<?php echo $port_loadinga ?>"><?php echo $port_loadinga ?></option> <?php } } ?> <option value="other">Other</option> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Port Of Delivery</label> <select name="port_of_delivery" class="form-control select"> <option value="">-- select port of deilvery --</option> <?php $sql_t = mysqli_query($conn,"SELECT * FROM company_details"); $row_t = mysqli_fetch_array($sql_t); $port_delivery = explode('--',$row_t['port_delivery']); foreach($port_delivery as $port_deliverya){ if($port_deliverya != ''){ ?> <option value="<?php echo $port_deliverya ?>"><?php echo $port_deliverya ?></option> <?php } } ?> <option value="other">Other</option> </select> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="form-group"> <label>Payment Method</label> <select class="form-control select" name="payment_method" id="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 echo $paymentmethoda ?></option> <?php } } } } ?> <option value="other">Other</option> </select> </div> </div> <!--<div class="col-md-6">--> <!-- <div class="form-group">--> <!-- <label>HS Code</label>--> <!-- <input class="form-control" name="hs_code"> --> <!-- </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"></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" readonly>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="0"> </div> <div class="col-md-6"> <label>Other Charges (Short Message)</label> <input class="form-control" name="short_msg" id="short_msg" placeholder="Enter other charges short description"> </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"></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'> <tr style="width:100%"> <td style="width:10%"> <select class='item_code_dks form-control select itemcode' name="item_code[]" type='text' onchange="getitemcodedata(this)"> <option value=''>--select item code--</option> <?php echo $datacodeitem ?> </select> </td> <td style="width:7%"> <img class="img_item" src="" width="50"> </td> <td style="width:18%"> <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:7%"> <input class='form-control unitClass' name='unit[]' type='text' ondrop='return false;' > </td> <td style="width:13%"> <input class='form-control priceClass' name='price[]' type='text' ondrop='return false;' > <a class="filter_price_value" f_contact_id="" f_item_code_id="" style="cursor: pointer;">Check Price</a> </td> <td style="width:15%"> <input type="text" name="total_amt[]" value="" class='form-control totalClass' readonly> </td> <td></td> </tr> </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" 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" 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" autocomplete="off" required> </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" 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 --> <div class="modal fade" id="myModal"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <!-- Modal Header --> <div class="modal-header"> <h4 class="modal-title">Add New Product</h4> <button type="button" class="close" data-dismiss="modal">×</button> </div> <!-- Modal body --> <div class="modal-body"> <form action="insert_new_item.php" method="post" role="form" enctype="multipart/form-data"> <div class="card-box"> <div class="row"> <div class="col-md-12"> <div class="form-group"> <label for="exampleInputEmail1">Category</label> <select class="form-control select" name="category" id="category" onchange="showUser(this.value)"> <option value="">Select Option</option> <?php $sql1 = "SELECT * FROM category WHERE is_deleted = 'NO' AND source_id = '$source_id' order by category"; $result1 = mysqli_query($conn,$sql1); while( $row = mysqli_fetch_array($result1)){ ?> <option value="<?php echo $row['id'] ?>" ><?php echo $row['category'] ?></option> <?php } ?> </select> </div> </div> </div> </div> <!-- end row --> <div class="card-box"> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label>Item Code</label> <input class="form-control" id="item_code" name="item_code" placeholder="Enter Item Code"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>HSN Code</label> <input class="form-control" name="hsncode" placeholder="Enter HSN Code"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Name<span style="color:red;padding-left:30px">Do not use double / single quote ("/')</span></label> <input class="form-control" id="name" name="name" placeholder="Enter Name"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Item Quantity</label> <input class="form-control" name="item_qty" placeholder="Enter Name"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Size</label> <input class="form-control" name="size" placeholder="Enter Size"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Unit Of Measure</label> <select name="unit_of_measure" class="form-control"> <option value=''>--select units--</option> <option value="Yard">Yard</option> <option value="Box">Box</option> <option value="Cms">Cms</option> <option value="Gross">Gross</option> <option value="Kg">Kg</option> <option value="Mtr">Mtr</option> <option value="Mile Meter">Mile Meter</option> <option value="Nothing">Nothing</option> <option value="N/A">N/A</option> <option value="Nos">Nos</option> <option value="Pairs">Pairs</option> <option value="Pcs">Pcs</option> <option value="Sets">Sets</option> <option value="Sheet">Sheet</option> <option value="Soft">Soft</option> <option value="Styles">Styles</option> <option value="mm">mm</option> <option value="cm">cm</option> <option value="dm">dm</option> <option value="km">km</option> <option value="other">Other</option> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Item Type</label> <?php $compan_d = mysqli_query($conn,"SELECT * FROM `company_details`"); $company_r = mysqli_fetch_assoc($compan_d); $item_type = explode(',',$company_r['item_type']); ?> <select class="form-control" name="item_type"> <option value=''>--select type--</option> <?php foreach($item_type as $item_type_v){ ?> <option><?php echo $item_type_v ?></option> <?php } ?> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Stock High Threshold</label> <input class="form-control" placeholder="Enter Stock High Threshold" name="stock_high_threshold"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Tax Inclusive</label> <select class="form-control" name="tax_inclusive"> <option value=''>--select type--</option> <option>No</option> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Color</label> <input class="form-control" name="color" placeholder="Enter Color"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Material</label> <input class="form-control" placeholder="Enter Material" name="material"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label>Item Image</label> <input type="file" class="form-control" name="image"> </div> </div> <div class="col-md-12"> <div class="form-group"> <label>Cost Variance Limit(%)</label> <input class="form-control" placeholder="Enter Group" name="cost_variance_limit"> </div> </div> </div> <button type="submit" id="btn" class="btn btn-purple waves-effect waves-light w-100">Submit</button> </div> </form> </div> <!-- Modal footer --> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> </div> </div> </div> </div> <div class="modal fade" id="myModalShowRateItem"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <!-- Modal Header --> <div class="modal-header"> <h4 class="modal-title"></h4> <button type="button" class="close" data-dismiss="modal">×</button> </div> <!-- Modal body --> <div class="modal-body"> <div class="table-responsive"> <table id="customer_data" class="table table-striped table-bordered employerTable" style="width:100%"> <thead> <tr> <th style="width:12px !important">Sr.</th> <th width="20%">Invoice No</th> <th width="20%">Date</th> <th width="20%">Rate</th> </tr> </thead> <tbody id="fetchTableData"> </tbody> </table> </div> </div> <!-- Modal footer --> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> </div> </div> </div> </div> <!-- 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='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/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 src="plugins/sweet-alert2/sweetalert2.min.js"></script> <script src="plugins/jquery-toastr/jquery.toast.min.js" type="text/javascript"></script> <script> $('document').ready(function() { // $('#show_bill_pay_name').change(function(){ $(document).on('change', '#show_bill_pay_name', function (event) { // var c_idz = $('#show_bill_pay_name').val(); var c_idz = $(this).val(); $('#partyIdDks').val(c_idz); // $(".filter_price_value").attr("f_contact_id", c_idz); // alert(c_idz); }); // $('.item_code_dks').change(function(){ $(document).on('change', '.item_code_dks', function (event) { var c_codeidz = $(this).val(); // $('.criteria_rate').val(criteria_rate); $(".filter_price_value").attr("f_item_code_id", c_codeidz); // alert(c_codeidz); $.ajax({ type: 'post', url: 'item-code-name.php', data: { c_codeidz: c_codeidz }, success: function (result) { var data = JSON.parse(result); if (data.status == "true") { $("#myModalShowRateItem .modal-title").html(data.item_code_name); } else { alert(data.msg); } } }); }); // $('.filter_price_value').click(function(event) { $(document).on('click', '.filter_price_value', function (event) { // alert("xkk"); event.preventDefault(); var data_f_contact_id = $('#partyIdDks').val(); var data_f_item_code_id = $(this).attr("f_item_code_id"); if (data_f_item_code_id == ''){ alert("Please Select Party and item Code"); }else{ $.ajax({ type: 'post', url: 'preview-details-item-code.php', data: { data_f_contact_id: data_f_contact_id, data_f_item_code_id: data_f_item_code_id }, success: function (result) { // alert(result); // console.log(result); $('#fetchTableData').html(result); $("#myModalShowRateItem").modal('show'); } }); } }); }); var lst = ["\"", "&", "'"]; $('#name').on('input', function () { debugger var inputText = $(this).val(); var index = 0; for (var i = 0; i < inputText.length; i++) { index = $.inArray(inputText.charAt(i), lst); if (index >= 0) { var myregexp = new RegExp(lst[index], 'g'); $(this).val($(this).val().replace(myregexp, "")); } } }); $(document).ready(function(){ if (localStorage.getItem("ItemAdded") == "true") { successMessage("Item Successfully Added."); localStorage.setItem("ItemAdded", "false"); } }); function successMessage(msg){ swal({ title: 'Success!', text: msg, type: 'success', confirmButtonColor: '#4fa7f3' }); } $(document).ready(function() { $(".delete").hide(); //when the Add Field button is clicked $("#add").click(function(e) { // var c_idz4 = $('#show_bill_pay_name').val(); // alert("id "+c_idz4); // $(".tdDks .filter_price_value").attr("f_contact_id", c_idz4); $(".delete").fadeIn("1500"); //Append a new row of code to the "#items" div $("#itemsadd").append( "<tr id='next-referral' style='width:100%' class='tdDks'><td style='width:10%'><select class='item_code_dks form-control select itemcode' name='item_code[]' type='text' onchange='getitemcodedata(this)'><option value=''>--select item code--</option><?php echo $datacodeitem ?></select></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;' ><a class='filter_price_value' f_contact_id='' f_item_code_id='' style='cursor: pointer;'>Check Price</a></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 () { $(".select") .on('select2:close', function() { var el = $(this); if(el.val()==="other") { var newval = prompt("Enter other value you want: "); if(newval !== null) { el.append('<option>'+newval+'</option>') .val(newval); } } }); }); 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(); $("#other_charges_t").val((parseFloat(other_charges)).toFixed(2)); var other_foreign_subtotal = (parseFloat(totalPrice) + parseFloat(other_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 (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 other_subtotal = (parseFloat(totalPrice) + parseFloat(other_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").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 days"){ date.setDate( date.getDate() + 7 ); var newDate = date.toDateString(); newDate = new Date( Date.parse( newDate ) ); $('#due_date').datepicker('setDate', newDate ); } else if(terms === "15 days"){ date.setDate( date.getDate() + 15 ); var newDate = date.toDateString(); newDate = new Date( Date.parse( newDate ) ); $('#due_date').datepicker('setDate', newDate ); } else if(terms === "30 days"){ date.setDate( date.getDate() + 30 ); var newDate = date.toDateString(); newDate = new Date( Date.parse( newDate ) ); $('#due_date').datepicker('setDate', newDate ); } else if(terms === "60 days"){ 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 days"){ date.setDate( date.getDate() + 7 ); var newDate = date.toDateString(); newDate = new Date( Date.parse( newDate ) ); $('#shipping_date').datepicker('setDate', newDate ); } else if(terms === "15 days"){ date.setDate( date.getDate() + 15 ); var newDate = date.toDateString(); newDate = new Date( Date.parse( newDate ) ); $('#shipping_date').datepicker('setDate', newDate ); } else if(terms === "30 days"){ date.setDate( date.getDate() + 30 ); var newDate = date.toDateString(); newDate = new Date( Date.parse( newDate ) ); $('#shipping_date').datepicker('setDate', newDate ); } else if(terms === "60 days"){ 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); $("#iecno").val(str.iecno); $("#type").val(str.type); $("#panno").val(str.panno); $("#currency").val(str.currency); $("#contact_person_name").val(str.contact_person_name); $("#opening_balance").val(str.opening_balance); $("#terms_condtion").val(str.terms_condtion); } }, error:function(err){ } }); } function getitemcodedata(response){ var thisRow = $(response).closest('tr'); var getitemcodedata = thisRow.find('.itemcode').val(); if (getitemcodedata == "") { document.getElementById("txtHint").innerHTML = ""; return; } $.ajax({ url : "PHP/response.php", data : "getitemcodedata="+getitemcodedata+"&action=getitemcodedata", async : false, method : "post", success: function(response) { var str1 = JSON.parse(response); thisRow.find('.itemClass').html('<option 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); } }) } 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').html('<option value="' + str1.id + '">' + str1.item_code + '</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); $(".filter_price_value").attr("f_item_code_id", str1.item_code); $("#myModalShowRateItem .modal-title").html(str1.item_code); if(thisRow.find('.quantityClass').val() != ""){ thisRow.find('.quantityClass').trigger("keyup"); } }, error: function(jqXHR, textStatus, errorThrown) { alert('Internal error: ' + jqXHR.responseText); } }) } </script> </body> </html>