99 lines
3.4 KiB
PHP
99 lines
3.4 KiB
PHP
<?php
|
|
// 설정 파일 포함
|
|
include_once('_common.php');
|
|
if(!$_SESSION['user_id']) exit; // 로그인 되어있지 않으면 확인 불가
|
|
|
|
// 검색 날짜
|
|
$searchDate = $_POST['searchDate'];
|
|
$ord_by = $_POST['ordBy'];
|
|
$result = getBakeryInvenData($searchDate, $ord_by);
|
|
|
|
// 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">
|
|
.tit { background-color:#C0C0C0; height:30px; }
|
|
.no-text { mso-number-format:'\@'; text-align:center; }
|
|
</style>
|
|
|
|
<table cellspacing="0" cellpadding="0" border="1">
|
|
<thead>
|
|
<tr>
|
|
<th class="tit">품목</th>
|
|
<th class="tit">바코드</th>
|
|
<th class="tit">전일재고</th>
|
|
<th class="tit">생산</th>
|
|
<th class="tit">업장사용</th>
|
|
<th class="tit">재활용</th>
|
|
<th class="tit">폐기</th>
|
|
<th class="tit">판매수량</th>
|
|
<th class="tit">판매단가</th>
|
|
<th class="tit">판매금액</th>
|
|
<th class="tit">메뉴별할인</th>
|
|
<th class="tit">결제금액</th>
|
|
<th class="tit">현재고</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>합계</td>
|
|
<td></td>
|
|
<td><?=number_format($t_prev_stock) ?></td>
|
|
<td><?=number_format($t_production) ?></td>
|
|
<td><?=number_format($t_inhouse_use) ?></td>
|
|
<td><?=number_format($t_recycling) ?></td>
|
|
<td><?=number_format($t_disposal) ?></td>
|
|
<td><?=number_format($t_sales) ?></td>
|
|
<td></td>
|
|
<td><?=number_format($t_sales_amount) ?></td>
|
|
<td><?=number_format($t_menu_discount) ?></td>
|
|
<td><?=number_format($t_payment_amount) ?></td>
|
|
<td><?=number_format($t_current_stock) ?></td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|