<?php $con = connect_db(); insert_table('customer_fix', $_POST['fix'], $con); close_db($con); ?> <script> alert('เพิ่มข้อมูลเรียบร้อยแล้ว'); window.location='index.php?system=1&module=control&action=list_customer'; </script>
<?php $con = connect_db(); //dieArray($_POST['c']); $data = $_POST['c']; $data['cl_date'] = date("Y-m-d H:i:s"); $data['cl_status'] = 1; insert_table('claim', $data, $con); close_db($con); ?> <script type="text/javascript"> alert('บันทึกข้อมูลเรียบร้อยแล้ว'); window.location="?module=system_claim&action=list_claim"; </script>
<?php $con = connect_db(); //dieArray($_POST['send']); $rs = insert_table('customer_quote', $_POST['send'], $con); ?> <script>window.location="index.php?module=control&action=quote&system=2"</script>
<?php $con = connect_db(); $arr = $_POST['send']; $arr['cp_update'] = date('Y-m-d H:i:s'); $arr['cp_user_update'] = $_SESSION['am_id']; insert_table('company', $arr, $con); close_db($con); ?> <script> alert('เพิ่มข้อมูลเรียบร้อยแล้ว'); window.location="?module=control&action=company"; </script>
<?php $con = connect_db(); $customer = $_POST['customer']; $result = get_query("SELECT count(c_id) AS cntid FROM customer_fix WHERE c_phone='{$customer['c_phone']}'", $con); $rs = assoc_get($result); if ($rs['cntid'] <= 0) { insert_table('customer_fix', $customer, $con); $result = getTable_where('customer_fix', 'c_phone', $customer['c_phone'], $con); $rsNewCustomer = assoc_get($result); $repair = $_POST['rp']; $repair['c_id'] = $rsNewCustomer['c_id']; $repair['rp_datekey'] = date("Y-m-d H:i:s"); insert_table('repair_tb', $repair, $con); } else { $result = getTable_where('customer_fix', 'c_phone', $customer['c_phone'], $con); $rsNewCustomer = assoc_get($result); $repair = $_POST['rp']; $repair['c_id'] = $rsNewCustomer['c_id']; $repair['rp_datekey'] = date("Y-m-d H:i:s"); //dieArray($repair); insert_table('repair_tb', $repair, $con); } close_db($con); ?> <script> alert('เพิ่มข้อมูลเรียบร้อยแล้ว'); window.location='index.php?module=system_repair&action=list_repair'; </script>
<?php $con = connect_db(); insert_table('products', $_POST['pd'], $con); close_db($con); ?> <script> alert('เพิ่มข้อมูลเรียบร้อยแล้ว'); window.location='index.php?system=3&module=system_products&action=list_products'; </script>
<div class="panel panel-default"> <div class="panel-heading">ประเภทสินค้า</div> <div class="panel-body"> <form method="POST" class="form-inline"> <input type="hidden" name="type_id"> <spen class="title">เพิ่ม : </spen><input type="text" class="form-control" name="type_name" placeholder="เพิ่ม / แก้ไข"> <button type="submit" class="btn btn-default"><i class="glyphicon glyphicon-ok"></i> ตกลง</button> <a href="javascript:void(0)" class="btn btn-success btn-add pull-right"><i class="glyphicon glyphicon-plus"></i> เพิ่ม</a> </form> </div> <?php if (isset($_POST['type_name'])) { if ($_POST['type_id'] != '') { update_table('type_repair', array('tr_name' => $_POST['type_name']), 'tr_id', $_POST['type_id'], $con); } elseif ($_POST['type_name'] != '') { insert_table('type_repair', array('tr_name' => $_POST['type_name']), $con); } } if (isset($_GET['del'])) { delete_data('type_repair', 'tr_id', $_GET['id'], $con); echo "<script>window.location='index.php?system=1&module=control&action=type_repair'</script>"; } $tr = getTable('type_repair', $con); ?> <table id="table-data" class="display table-data" border="1" cellspacing="0" width="100%"> <thead> <tr> <th>รหัส</th> <th>ชื่อลูกค้า</th> <th style="width:15%">สถานะ</th> </tr>
if (isset($_POST['repair-submit'])) { $date = date("Y-m-d H:i:s"); $item = serialize($_POST['item']); $software = serialize($_POST['software']); if ($_POST['c_id'] != null) { $arr = array('rp_id' => '', 'rp_datetime' => $date, 'c_id' => $_POST['c_id'], 'rp_version' => $_POST['version'], 'rp_symptom' => $_POST['symptom'], 'rp_item' => $item, 'rp_software' => $software, 'rp_data' => $_POST['data_computer'], 'rp_datereturn' => $_POST['date_return'], 'rp_status' => '1', 'tr_id' => $_POST['pd_type_id']); insert_table('repair', $arr, $con); } else { $data_customer = array('c_flname' => $_POST['flname'], 'c_address' => $_POST['address'], 'c_phone' => $_POST['phone'], 'c_status' => '1'); //dieArray($data_customer); insert_table('customer_fix', $data_customer, $con); $select_c = "SELECT MAX(c_id) AS c_id FROM customer_fix"; $rs_c = mysqli_query($con, $select_c) or die(mysql_error()); $r_c = assoc_get($rs_c); $arr = array('rp_id' => '', 'rp_datetime' => $date, 'c_id' => $r_c['c_id'], 'rp_version' => $_POST['version'], 'rp_symptom' => $_POST['symptom'], 'rp_item' => $item, 'rp_software' => $software, 'rp_data' => $_POST['data_computer'], 'rp_datereturn' => $_POST['date_return'], 'rp_status' => '1', 'tr_id' => $_POST['pd_type_id']); insert_table('repair', $arr, $con); } echo "<script>alert('บันทึกข้อมูลเรียบร้อยแล้ว')</script>"; echo "<script>window.location='index.php?system=1&module=control&action=inform_repair';</script>"; } ?> <div class="panel panel-default"> <div class="panel-heading">เพิ่มข้อมูลใบแจ้งซ่อม</div> <table id="table-data" class="display" border="1" cellspacing="0" width="100%"> <thead> <tr> <th>รหัส</th> <th>ชื่อลูกค้า</th> <th>สถานะ</th> </tr> </thead>
</div> <div class="panel-body"> <form method="POST" class="form-inline"> <input type="hidden" name="type_id"> <spen class="title">เพิ่ม : </spen> <input type="text" class="form-control" name="type_name" placeholder="เพิ่ม / แก้ไข"> <span id="cate"><input type="radio" value="1" name="type_cat"> สิ้นเปลือง <input type="radio" value="2" name="type_cat"> ไม่สิ้นเปลือง</span> <button type="submit" class="btn btn-default"><i class="glyphicon glyphicon-ok"></i> ตกลง</button> <a href="javascript:void(0)" class="btn btn-success btn-add pull-right"><i class="glyphicon glyphicon-plus"></i> เพิ่ม</a> </form> <?php if (isset($_POST['type_name'])) { if ($_POST['type_id'] != '') { update_table('type_product', array('tp_name' => $_POST['type_name'], 'tp_category' => $_POST['type_cat']), 'tp_id', $_POST['type_id'], $con); } elseif ($_POST['type_name'] != '') { insert_table('type_product', array('tp_name' => $_POST['type_name'], 'tp_category' => $_POST['type_cat']), $con); } } if (isset($_GET['del'])) { delete_data('type_product', 'tp_id', $_GET['id'], $con); echo "<script>window.location='index.php?system=3&module=system_products&action=list_type_products'</script>"; } $rs = getTable('type_product', $con); ?> <table class="table table-bordered" width="100%"> <thead> <tr> <th>รหัส</th> <th>ประเภท</th> <th>หมวด</th> <th></th>
<?php $con = connect_db(); insert_table('send_repair', $_POST['send'], $con); update_table('repair', array('rp_status' => '3'), 'rp_id', $_POST['send']['rp_id'], $con); ?> <script>alert('เพิ่มข้อมูลใบส่งซ่อมเรียบร้อยแล้ว');</script> <script>window.location='index.php?system=1&module=control&action=list_send_repair'</script>
<?php $con = connect_db(); insert_table('admin_user', $_POST['u'], $con); ?> <script type="text/javascript"> alert('เพิ่มข้อมูลเรียบร้อย'); window.location="index.php?module=system_staff&action=list_staff"; </script>
<?php $con = connect_db(); $data['sp_list'] = serialize($_SESSION['sale_product']); $data['sp_total'] = $_POST['total']; $data['sp_income'] = $_POST['income']; $data['sp_change'] = $_POST['change']; $data['am_id'] = $_SESSION['am_id']; //dieArray($_SESSION['sale_product']); foreach ($_SESSION['sale_product'] as $k => $v) { $result = getTable_where('products', 'p_barcode', $v['p_barcode'], $con); $r = assoc_get($result); $amount['p_amount'] = $r['p_amount'] - $v['p_amount']; update_table('products', $amount, 'p_barcode', $v['p_barcode'], $con); } insert_table('saleproduct_tb', $data, $con); unset($_SESSION['sale_product']); $result_sale = getTable_order('saleproduct_tb', 'sp_id', 'DESC LIMIT 1', $con); $rs = assoc_get($result_sale); //echo $rs['sp_id']; ?> <script> var id = <?php echo $rs['sp_id']; ?> ; js_popup('index.php?module=system_pos&action=receipt&id='+id,783,600); function js_popup(theURL,width,height) { //v2.0 leftpos = (screen.availWidth - width) / 2; toppos = (screen.availHeight - height) / 2; window.open(theURL, "viewdetails","width=" + width + ",height=" + height + ",left=" + leftpos + ",top=" + toppos);