|
@@ -27,6 +27,7 @@ $customer_id = (int)$_POST['customer_id'];
|
|
|
$contact_id = !empty($_POST['contact_id']) ? (int)$_POST['contact_id'] : "NULL";
|
|
|
$employee_id = $_SESSION['employee_id'];
|
|
|
$order_date = mysqli_real_escape_string($conn, $_POST['order_date']);
|
|
|
+$order_type = (int)$_POST['order_type'];
|
|
|
|
|
|
// 设置已删除字段的默认值
|
|
|
$delivery_date = "NULL";
|
|
@@ -58,6 +59,11 @@ if (empty($order_code)) {
|
|
|
exit;
|
|
|
}
|
|
|
|
|
|
+if (!in_array($order_type, [1, 2])) {
|
|
|
+ echo "<script>alert('请选择有效的订单类型');history.back();</script>";
|
|
|
+ exit;
|
|
|
+}
|
|
|
+
|
|
|
if ($customer_id <= 0) {
|
|
|
echo "<script>alert('请选择客户');history.back();</script>";
|
|
|
exit;
|
|
@@ -119,6 +125,7 @@ if ($isedit) {
|
|
|
// 更新订单基本信息
|
|
|
$sql = "UPDATE orders SET
|
|
|
order_code = '$order_code',
|
|
|
+ order_type = $order_type,
|
|
|
customer_id = $customer_id,
|
|
|
contact_id = $contact_id,
|
|
|
employee_id = $employee_id,
|
|
@@ -172,13 +179,13 @@ if ($isedit) {
|
|
|
|
|
|
// 创建新订单
|
|
|
$sql = "INSERT INTO orders (
|
|
|
- order_code, customer_id, contact_id, employee_id,
|
|
|
+ order_code, order_type, customer_id, contact_id, employee_id,
|
|
|
order_date, delivery_date, actual_delivery_date,
|
|
|
order_status, payment_status, currency,
|
|
|
subtotal, discount_amount, total_amount,
|
|
|
notes, internal_notes, created_at, updated_at
|
|
|
) VALUES (
|
|
|
- '$order_code', $customer_id, $contact_id, $employee_id,
|
|
|
+ '$order_code', $order_type, $customer_id, $contact_id, $employee_id,
|
|
|
'$order_date', $delivery_date, $actual_delivery_date,
|
|
|
$order_status, $payment_status, '$currency',
|
|
|
$subtotal, $discount_amount, $total_amount,
|