199 lines
6.1 KiB
PHP
199 lines
6.1 KiB
PHP
<?php
|
|
// 설정 파일 포함
|
|
include_once('_common.php');
|
|
if(!$_SESSION['user_id']) exit; // 로그인 되어있지 않으면 확인 불가
|
|
|
|
// 검색 날짜
|
|
$searchDate = $_POST['searchDate'];
|
|
$ord_by = $_POST['ordBy'];
|
|
$result = getBakeryInvenData($searchDate, $ord_by);
|
|
$authInfo = getAuthorInfo($searchDate);
|
|
|
|
// 누계 데이터 가져오기
|
|
$sumData = getBakeryInvenSummaryData($searchDate);
|
|
|
|
// UTF-8 BOM 추가
|
|
echo "\xEF\xBB\xBF";
|
|
// 헤더 설정
|
|
header("Content-Type: application/vnd.ms-excel; charset=utf-8");
|
|
header("Content-Description: PHP Generated Data");
|
|
?>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<style type="text/css">
|
|
table {border-collapse:collapse; border:none;}
|
|
.head {background-color:#C0C0C0; border: 1px solid black;}
|
|
.foot {background-color:#C0C0C0; border: 1px solid black;}
|
|
.no-text {mso-number-format:'\@'; text-align: center; }
|
|
.line {border: 1px solid black;}
|
|
|
|
</style>
|
|
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>베이커리일일현황</th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
</tr>
|
|
<tr>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
</tr>
|
|
<tr>
|
|
<th>날짜</th>
|
|
<th><?=$searchDate?></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
</tr>
|
|
<tr>
|
|
<th>근무자</th>
|
|
<th><?=$authInfo['worker']?></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
</tr>
|
|
<tr>
|
|
<th>작성자</th>
|
|
<th><?=$authInfo['author']?></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
</tr>
|
|
<tr>
|
|
<th class="head">품목</th>
|
|
<th class="head">바코드</th>
|
|
<th class="head">전일재고</th>
|
|
<th class="head">생산</th>
|
|
<th class="head">업장사용</th>
|
|
<th class="head">재활용</th>
|
|
<th class="head">폐기</th>
|
|
<th class="head">판매수량</th>
|
|
<th class="head">판매단가</th>
|
|
<th class="head">판매금액</th>
|
|
<th class="head">메뉴별할인</th>
|
|
<th class="head">결제금액</th>
|
|
<th class="head">현재고</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
$t_prev_stock = $t_production = $t_inhouse_use = $t_recycling = $t_disposal = $t_sales = $t_sales_amount = $t_menu_discount = $t_payment_amount = $t_current_stock = 0;
|
|
|
|
// 데이터 출력
|
|
foreach ( $result as $row) {
|
|
$previous_stock = getPrevStock($searchDate, $row['barcode']);
|
|
?>
|
|
<tr>
|
|
<td><?=$row['product_name']?></td>
|
|
<td><?=$row['barcode']?></td>
|
|
<td><?=number_format($previous_stock)?></td>
|
|
<td><?=number_format($row['production'])?></td>
|
|
<td><?=number_format($row['inhouse_use'])?></td>
|
|
<td><?=number_format($row['recycling'])?></td>
|
|
<td><?=number_format($row['disposal'])?></td>
|
|
<td><?=number_format($row['sales'])?></td>
|
|
<td><?=($row['sales'] != 0 && $row['sales_amount'] != 0) ? number_format($row['sales_amount']/$row['sales']) : 0 ?></td>
|
|
<td><?=number_format($row['sales_amount'])?></td>
|
|
<td><?=number_format($row['menu_discount'])?></td>
|
|
<td><?=number_format($row['payment_amount'])?></td>
|
|
<td><?=number_format($row['current_stock'])?></td>
|
|
</tr>
|
|
|
|
<?php
|
|
// 합계 함수 처리
|
|
$t_prev_stock += $previous_stock;
|
|
$t_production += $row['production'];
|
|
$t_inhouse_use += $row['inhouse_use'];
|
|
$t_recycling += $row['recycling'];
|
|
$t_disposal += $row['disposal'];
|
|
$t_sales += $row['sales'];
|
|
$t_sales_amount += $row['sales_amount'];
|
|
$t_menu_discount += $row['menu_discount'];
|
|
$t_payment_amount += $row['payment_amount'];
|
|
$t_current_stock += $row['current_stock'];
|
|
}
|
|
|
|
?>
|
|
|
|
</tbody>
|
|
<tfoot class="table-group-divider">
|
|
<tr class="bakery_total">
|
|
<td class="foot">합계</td>
|
|
<td class="foot"></td>
|
|
<td class="foot"><?=number_format($t_prev_stock) ?></td>
|
|
<td class="foot"><?=number_format($t_production) ?></td>
|
|
<td class="foot"><?=number_format($t_inhouse_use) ?></td>
|
|
<td class="foot"><?=number_format($t_recycling) ?></td>
|
|
<td class="foot"><?=number_format($t_disposal) ?></td>
|
|
<td class="foot"><?=number_format($t_sales) ?></td>
|
|
<td class="foot"></td>
|
|
<td class="foot"><?=number_format($t_sales_amount) ?></td>
|
|
<td class="foot"><?=number_format($t_menu_discount) ?></td>
|
|
<td class="foot"><?=number_format($t_payment_amount) ?></td>
|
|
<td class="foot"><?=number_format($t_current_stock) ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="foot">누계</th>
|
|
<td class="foot"></th>
|
|
<td class="foot"></th>
|
|
<td class="foot"><?=number_format($sumData['total_production'])?></th>
|
|
<td class="foot"><?=number_format($sumData['total_inhouse_use'])?></th>
|
|
<td class="foot"><?=number_format($sumData['total_recycling'])?></th>
|
|
<td class="foot"><?=number_format($sumData['total_disposal'])?></th>
|
|
<td class="foot"><?=number_format($sumData['total_sales'])?></th>
|
|
<td class="foot"></th>
|
|
<td class="foot"><?=number_format($sumData['total_sales_amount'])?></th>
|
|
<td class="foot"><?=number_format($sumData['total_menu_discount'])?></th>
|
|
<td class="foot"><?=number_format($sumData['total_payment_amount'])?></th>
|
|
<td class="foot"></th>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|