4)
$name = $_POST['name'];
else
$name = '0';
$link = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB);
$link->set_charset("utf8");
$started = 1;
$query = "INSERT INTO `" . SHOP_ID . "_bill` ( `status`,`cust_phone`,`cust_name`)VALUES(?,?,?)";
$stmt = $link->prepare($query);
if ($stmt) {
$stmt->bind_param("sss", $started, $_POST['phone'], $name);
//if(!$stmt->execute()) echo '
' . mysqli_error($link) . '
';
if (!$stmt->execute())
echo '' . mysqli_error($link) . '
';
else {
$last_id = $link->insert_id;
echo ' ' . $last_id . 'Bill Started
';
}
} else
echo mysqli_error($link);
$link->close();
} elseif (isset ($_GET['bill'])) {
// echo $_GET['bill'];
//echo ' ';
if (isset ($_POST['code'])) {
// if(isset($url[1])) { $lnk=$url[2]; $lnk2 = explode('?', $lnk); }
$code = explode('-', $_POST['code']);
// echo $code[1];
$link = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB);
$query = "SELECT * FROM `" . SHOP_ID . "_product` WHERE `id`='" . $code[0] . "'";
$result = mysqli_query($link, $query);
if (mysqli_num_rows($result) < 1) {
echo '
Err: no Product Found
';
} else {
$row = $result->fetch_array(MYSQLI_ASSOC);
// var_dump($row);
if ($row['stock'] < 1)
echo ' Err: out of stock ';
else {
$link = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB);
$link->set_charset("utf8");
$query = "INSERT INTO `" . SHOP_ID . "_bill_product` ( `bill_id`,`product_id`,`price`,`product_name`)VALUES(?,?,?,?)";
$stmt = $link->prepare($query);
if ($stmt) {
$stmt->bind_param("ssss", $_GET['bill'], $code[1], $row['price'], $row['name']);
//if(!$stmt->execute()) echo '' . mysqli_error($link) . '
';
if (!$stmt->execute())
echo ' Err' . mysqli_error($link) . '
';
// else {
// $last_id = $link->insert_id;
// echo ' '.$last_id .'Bill Started
// ';
// }
} else
echo mysqli_error($link);
$link->close();
}
}
}
}
?>
MGM Enterprises
GST: 19AJSPB8539J1ZJ
16/120/57, Golbazar, Ashoknagar, Habra, 743222
+91 9907218172
Fashion Avenue
Bill No:
real_escape_string($_GET['bill']);
$query = "SELECT * FROM `" . SHOP_ID . "_bill` WHERE `id` = '$bill_id'";
$result = $link->query($query);
if ($result) {
if ($row = $result->fetch_assoc()) {
$billing_date = $row['time'];
$tz = 'Asia/Kolkata';
$billing_dt = new DateTime($billing_date, new DateTimeZone('UTC'));
$print_dt = new DateTime("now", new DateTimeZone($tz));
echo "", $_GET['bill'], " , ", $billing_dt->format('Y/m/d h:i:sa');
} else {
echo "No results found.";
}
} else {
echo "Error: " . $link->error;
}
$link->close();
?>
SL
Product
GST
Price
Total
= 1000) {
$GSTPercentage = 112;
} else {
//Future Billing Amount Conditions
}
$GSTAmount = round($row['price'] / $GSTPercentage * 100);
$totalTax = $totalTax + $row['price'] - $GSTAmount;
$totalPrice = $totalPrice + $GSTAmount;
// echo $GSTAmount;
// $withGST = round($row['price'] + $GSTAmount);
?>
HSN: ', $row['hsn'];
if($row['returned']=='1'){
echo ' (Exchanged) ';
$totalReturn=$totalReturn+$row['price'];
}
// if ($row['mrp'] > $row['price']) { $discount = $row['mrp'] - $row['price']; }
?>
' ;
// echo '
Print ';
?>
0) echo
'
Total Return:
'.$totalReturn.'
' ; ?>
Conditions:
• Items sold cannot be returned but exchanged within 5
days from purchase (Time 12:00 to 15:00)
• To exchange, original bill and price tag must be
intact.
• Accessories and undergarments cannot be
exchanged.
Thank You for shopping with us Authorised Signatory
Bill Print Date: format('Y-m-d H:i:s');?>
Print