D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
home
/
shubmkcj
/
urbane.createerp.com
/
Filename :
insert-proforma.php
back
Copy
<?php ob_start(); session_start(); include 'config.php'; $companyd = mysqli_query($conn,"SELECT * FROM `company_details`"); $companyrow = mysqli_fetch_assoc($companyd); $invoice_prifix = $companyrow['invoice_prifix']; $getting_proforma = mysqli_query($conn,"SELECT * FROM `proforma` ORDER BY `id` DESC LIMIT 1"); $getting_proformarow = mysqli_fetch_assoc($getting_proforma); $getting_proforma_id = $getting_proformarow['proforma_id']; $get_performa_ids=(int)substr($getting_proforma_id,8); $get_performa_ids=create_slug_bill($get_performa_ids+1); // $get_performa_ids=create_slug_bill(1); // $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; $proforma_id = $invoice_prifix."/".date('Y')."/".$get_performa_ids; //die; //UM/2022/01 $bill_pay_name = $_POST['bill_pay_name']; // $proforma_id = $_POST['proforma_id']; $date = $_POST['date']; $terms = $_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 = $_POST['delivery_type']; $delivery_terms = $_POST['delivery_terms']; $mode_of_shipment = $_POST['mode_of_shipment']; $shipping_date = $_POST['shipping_date']; $post_of_loading = $_POST['post_of_loading']; $port_of_delivery = $_POST['port_of_delivery']; $country_of_goods = $_POST['country_of_goods']; $country_of_destination = $_POST['country_of_destination']; $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 = $_POST['other_charges']; $short_msg = $_POST['short_msg']; $comment = $conn -> real_escape_string($_POST['comment']); $item = $_POST['item']; $item_code = $_POST['item_code']; $qty = $_POST['qty']; $price = $_POST['price']; $total_amt = $_POST['total_amt']; $other_charges_t = $_POST['other_charges_t']; $subtotal = $_POST['subtotal']; $bank_charges = $_POST['bank_charges']; $amount_paid = $_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"]; } } } $sqlInsertInvoice = "INSERT INTO `proforma`(`bill_pay_name`, `proforma_id`, `date`, `terms`, `due_date`, `billingAddress`, `deliver_address`, `pincode`,`client_name`,`mobile_no`, `email`, `gstin`, `type`, `buyer_reference`, `delivery_type`, `delivery_terms`, `mode_of_shipment`, `shipping_date`, `port_of_loading`, `port_of_delivery`,`country_of_goods`, `country_of_destination`, `payment_method`, `hs_code`, `terms_of_payment`, `bank_details`, `other_charges`, `other_charge_msg`, `other_price`, `subtotal_price`, `bank_charge`, `amount_paid`, `signature`, `comment`) VALUES ('$bill_pay_name','$proforma_id','$date','$terms','$due_date','$billingCompanyAddress', '$deliveryAddress','$pincode','$client_name','$mobile','$email','$gstin','$type','$buyerreference','$delivery_type','$delivery_terms','$mode_of_shipment','$shipping_date','$post_of_loading','$port_of_delivery','$country_of_goods','$country_of_destination','$payment_method','$hs_code','$termsofpayment','$bank_details','$other_charges','$short_msg','$other_charges_t','$subtotal','$bank_charges','$amount_paid','$companySign','$comment')"; $resultM = $conn->query($sqlInsertInvoice); if ($resultM === TRUE) { $iif = $conn->insert_id; for($j = 0; $j < count($item); $j++){ $item1 = $item[$j] ; $item_code1 = $item_code[$j] ; $price1 = $price[$j] ; $qty1 = $qty[$j] ; $total_amt1= $total_amt[$j] ; $sqlInsertInvoice2 = "INSERT INTO `proforma_item`(`proforma_id`, `item_id`, `item_code`, `qty`, `price`, `row_total`) VALUES ('$proforma_id','$item1','$item_code1','$qty1','$price1','$total_amt1')"; $resultN = $conn->query($sqlInsertInvoice2); } echo '<script>localStorage.setItem("InvoiceInserted", "true");</script>'; echo '<script>location.replace("proforma.php")</script>'; }else{ echo '<script>alert("fail !")</script>'; echo '<script>location.replace("proforma.php")</script>'; } ?>