示例#1
0
<!-- 7-5 売上情報の検索・更新・削除用のページを作ろう -->
<?php 
require 'class_folder/DBSalesinfo.php';
$slipDetail = "";
$total = "";
$SalesDate = new DateTime('NOW');
$SalesDate = $SalesDate->format("Y-m-d");
$dbSalesInfo = new DBSalesInfo();
//日付の設定
if (isset($_POST['SalesDate'])) {
    $SalesDate = $_POST['SalesDate'];
}
//←ボタンの処理(1日前を表示)
if (isset($_POST['prev'])) {
    $SalesDate = new DateTime($_POST['SalesDate']);
    //日付の減算処理はsubメソッド
    $SalesDate->sub(new DateInterval('P1D'));
    $SalesDate = $SalesDate->format("Y-m-d");
}
//→ボタンの処理(1日後を表示)
if (isset($_POST['next'])) {
    $SalesDate = new DateTime($_POST['SalesDate']);
    //日付の加算処理はaddメソッド
    $SalesDate->add(new DateInterval('P1D'));
    $SalesDate = $SalesDate->format("Y-m-d");
}
//伝票明細の削除
if (isset($_POST['deletedetail'])) {
    $SalesDate = $dbSalesInfo->getSalesDate($_POST['id']);
    $dbSalesInfo->DeleteDetail();
}
示例#2
0
<!-- 売上情報の登録 -->
<?php 
require 'class_folder/DBSalesinfo.php';
$slip = "";
$SalesDate = new DateTime('NOW');
$SalesDate = $SalesDate->format('Y-m-d');
$CustomerID = "";
$dbSalesInfo = new DBSalesInfo();
// 商品名リストの作成
$GoodsList = $dbSalesInfo->ListGoods();
if (isset($_POST['submit'])) {
    // 新規登録処理
    $SalesDate = $_POST['SalesDate'];
    $CustomerID = $_POST['CustomerID'];
    $dbSalesInfo->InsertSalesinfo();
    // 新規登録後だけ登録データを表示
    $slip = $dbSalesInfo->SelectSalesinfo($SalesDate, $CustomerID);
    // 顧客名リストの作成 (選択者を表示)
    $CustomerList = $dbSalesInfo->ListCustomerWithSelected($CustomerID);
} else {
    // 顧客名リストの作成
    $CustomerList = $dbSalesInfo->ListCustomer();
}
?>
<!DOCTYPE html>
	<html>
	<head>
		<meta charset="utf-8">
		<title>売上管理システム</title>
		<link rel="stylesheet" type="text/css" href="../Chapter7/css/style.css" />
	</head>