D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
proc
/
self
/
root
/
home
/
shubmkcj
/
urbane.createerp.com
/
Filename :
update-invoice.php
back
Copy
<?php ob_start(); session_start(); include 'config.php'; $id = $_POST['id']; $invoice_reference = $_POST['invoice_reference']; $invoice_id = $_POST['invoice_id']; $bill_pay_name = $conn -> real_escape_string($_POST['bill_pay_name']); $proforma_id = $_POST['proforma_id']; $date = $_POST['date']; $terms = $conn -> real_escape_string($_POST['terms']); $due_date = $_POST['due_date']; $billingCompanyAddress = $conn -> real_escape_string($_POST['billingAddress']); $deliveryAddress = $conn -> real_escape_string($_POST['deliveryAddress']); $pincode = $_POST['pincode']; $client_name = $_POST['client_name']; $mobile = $_POST['mobile']; $email = $_POST['email']; $gstin = $_POST['gstin']; $type = $_POST['type']; $buyerreference = $_POST['buyerreference']; $delivery_type = $conn -> real_escape_string($_POST['delivery_type']); $delivery_terms = $conn -> real_escape_string($_POST['delivery_terms']); $mode_of_shipment = $conn -> real_escape_string($_POST['mode_of_shipment']); $shipping_date = $_POST['shipping_date']; $post_of_loading = $_POST['post_of_loading']; $port_of_delivery = $conn -> real_escape_string($_POST['port_of_delivery']); $payment_method = $_POST['payment_method']; $hs_code = $_POST['hs_code']; $termsofpayment = $conn -> real_escape_string($_POST['termsofpayment']); $bank_details = $conn -> real_escape_string($_POST['bank_details']); $other_charges = $conn -> real_escape_string($_POST['other_charges']); $short_msg = $conn -> real_escape_string($_POST['short_msg']); $comment = $conn -> real_escape_string($_POST['comment']); $invoice_item_id = $_POST['invoice_item_id']; $item = $_POST['item']; $item_code = $_POST['item_code']; $qty = $_POST['qty']; $price = $_POST['price']; $total_amt = $_POST['total_amt']; $other_charges_t = $conn -> real_escape_string($_POST['other_charges_t']); $subtotal = $conn -> real_escape_string($_POST['subtotal']); $bank_charges = $conn -> real_escape_string($_POST['bank_charges']); $amount_paid = $conn -> real_escape_string($_POST['amount_paid']); $companySign = ""; $sqlGetCompanyDetail = "SELECT * FROM company_details"; $resultGetCompanyDetail = mysqli_query($conn, $sqlGetCompanyDetail); if($resultGetCompanyDetail){ if(mysqli_num_rows($resultGetCompanyDetail) > 0){ while($rowGetCompanyDetail = mysqli_fetch_assoc($resultGetCompanyDetail)){ $companySign = $rowGetCompanyDetail["signature"]; } } } $revised_date = date('d F Y'); $sqlInsertInvoice = "UPDATE `generate_invoice` SET `bill_pay_name`='$bill_pay_name',`date`='$date',`terms`='$terms',`due_date`='$due_date',`billingAddress`='$billingCompanyAddress',`deliver_address`='$deliveryAddress',`pincode`='$pincode',`client_name`='$client_name',`mobile_no`='$mobile',`email`='$email',`gstin`='$gstin',`type`='$type',`buyer_reference`='$buyerreference',`delivery_type`='$delivery_type',`delivery_terms`='$delivery_terms',`mode_of_shipment`='$mode_of_shipment',`shipping_date`='$shipping_date',`port_of_loading`='$post_of_loading',`port_of_delivery`='$port_of_delivery',`payment_method`='$payment_method',`hs_code`='$hs_code',`terms_of_payment`='$termsofpayment',`bank_details`='$bank_details',`other_charges`='$other_charges',`other_charge_msg`='$short_msg',`other_price`='$other_charges_t',`subtotal_price`='$subtotal',`bank_charge`='$bank_charges',`amount_paid`='$amount_paid',`signature`='$companySign',`comment`='$comment',`revised_date`='$revised_date' WHERE id='$id'"; $resultM = $conn->query($sqlInsertInvoice); if ($resultM === TRUE) { $iif = $conn->insert_id; $delete = mysqli_query($conn,"DELETE FROM `invoice_item` WHERE invoice_reference='$invoice_reference'"); for($j = 0; $j < count($item); $j++){ $invoice_item_id1 = $invoice_item_id[$j]; $item1 = $item[$j] ; $item_code1 = $item_code[$j] ; $price1 = $price[$j] ; $qty1 = $qty[$j] ; $total_amt1= $total_amt[$j] ; $sqlInsertInvoice2 = "INSERT INTO `invoice_item`(`invoice_reference`, `invoice_id`, `proforma_id`, `item_id`, `item_code`, `qty`, `price`, `row_total`) VALUES ('$invoice_reference','$invoice_id','$proforma_id','$item1','$item_code1','$qty1','$price1','$total_amt1')"; $resultN = $conn->query($sqlInsertInvoice2); } echo '<script>localStorage.setItem("InvoiceUpdate", "true");</script>'; echo '<script>location.replace("invoice.php")</script>'; }else{ echo '<script>alert("fail !")</script>'; echo '<script>location.replace("invoice.php")</script>'; } ?>