#packopt name "optoregi" #packopt version &qu […]
#packopt name "optoregi" #packopt version &qu […]
#packopt name "optoregi"
#packopt version "versiondate.txt"
#packopt lang "1041"
#packopt icon "icon.ico"
#packopt hide 1
#define version "1.3" ; バージョン定数
// タイトル定数(コンパイル制御)
#ifdef _debug
#define titl "OptOレジ! v" + version + " (デバッグモード)"
#else
#define titl "OptOレジ! v" + version
#endif
#include "wgini.as"
#include "kernel32.as"
#include "user32.as"
#include "gdi32.as"
#include "shell32.as"
#uselib "imm32.dll"
#func ImmAssociateContext "ImmAssociateContext" int, int
#module
#deffunc clr int mode, int x1, int y1, int x2, int y2 ; 画面クリア(0 = オブジェクトも, 1 = オブジェクト以外, 2 = 1を部分的に)
if mode = 0 : cls
color 128, 255, 255 ; 薄水色
if mode = 2 : boxf x1, y1, x2, y2 : else : boxf
color 0, 0, 0
return mode
#deffunc HideSubWindow int wID ; サブウィンドウ非表示
gsel wID, -1
EnableWindow hWnd_main@, 1
gsel 0, 1
return wID
// CSV系関数
#deffunc SplitCSV int index, int column ; CSVデータの指定行をカラムごとに分割
if index < 0 or column < 0 : return -1 ; インデックスかカラムが負であれば-1
; 変数初期化
if flag = 0 {
sdim temp
sdim spl, , 5
}
flag = 1
noteget temp, index ; 指定行取得
split temp, ",", spl ; カラムごとに分割
return stat
#defcfunc GetCSV int index, int column ; CSVデータの指定行指定カラムを返す
SplitCSV index, column ; 指定行分割
if stat - 1 < column : return "" ; 指定カラムが無ければ-1
return spl(column) ; 指定カラムを返す
#deffunc WriteCSV int index, int column, str word ; CSVデータの指定行指定カラムを書き換える
SplitCSV index, column ; 指定行分割
if stat - 1 < column : return -1 ; 指定カラムが無ければ-1
; 上書き用文字列作成
spl(column) = word
temp = spl(0)
repeat stat - 1, 1
temp += "," + spl(cnt)
loop
noteadd temp, index, 1 ; 指定行に上書き
return
#deffunc SearchCSV int index, int column, str word ; CSVデータを検索
; 変数初期化
result = -1
if index < 0 or column < 0 or word = "" : return result ; インデックスかカラムが負、wordがnullなら-1を返す
; データ検索
repeat notemax - index, index
if GetCSV(cnt, column) = word { ; 内容が一致するか
result = cnt
break
}
loop
return result ; 何も見つからなかった場合-1を返す
#deffunc deletef str _dir ; ディレクトリ削除
sdim pFrom, 260
pFrom = _dir
dim SHFILEOPSTRUCT, 8
SHFILEOPSTRUCT.0 = hWnd
SHFILEOPSTRUCT.1 = $3 ; FO_DELETE
SHFILEOPSTRUCT.2 = varptr( pFrom )
SHFILEOPSTRUCT.3 = 0
SHFILEOPSTRUCT.4 = $4 | $10 | $100 | $400 ; FOF_SILENT | FOF_NOCONFIRMATION | FOF_SIMPLEPROGRESS | FOF_NOERRORUI
SHFileOperation varptr( SHFILEOPSTRUCT )
return stat
#global
// レイアウト算出用マクロ
#define lay_sx (lay_ex - lay_x - lay_ox * 2 - lay_ix * (lay_nx - 1)) / lay_nx ; オブジェクトサイズ算出
#define lay_sy (lay_ey - lay_y - lay_oy * 2 - lay_iy * (lay_ny - 1)) / lay_ny
#define ctype lay_px(%1) lay_x + lay_ox + (lay_sx + lay_ix) * %1 ; 描画位置算出
#define ctype lay_py(%1) lay_y + lay_oy + (lay_sy + lay_iy) * %1
///////////////// 二重起動防止 /////////////////
CreateMutex 0, 0, "OptO_register_!_Mutex" ; ミューテックス生成
GetLastError
if stat = $B7 { ; ERROR_ALREADY_EXISTS
dialog "OptOレジ!は既に起動しています。", 1, titl
end
}
////////////////// 事前処理 ////////////////////
*s_start ; 開発時便宜ラベル
// メインウィンドウ(コンパイル制御)
#ifdef _debug ; デバッグ時
screen 0, , : title titl
#else ; 通常時
bgscr 0, ginfo_dispx, ginfo_dispy, 0, 0, 0 : title titl
#endif
hWnd_main = hWnd
title titl
// 一時変数初期化
dim temp_i, ; 整数型一時変数
sdim temp_s, 260 ; 文字列型一時変数
// ディレクト・ファイルチェック・新規作成(最低限)
exist "settings.ini" ; 設定ファイル
if strsize = -1 {
temp_s = "[system]\npass=0000\nopened=0\nlast=\npdcount=0\n"
notesel temp_s
notesave "settings.ini"
noteunsel
}
; 設定ファイル読み込み
setini "settings.ini" ; 設定ファイルを指定
sdim s_password ; パスワード
getini "system", "pass", s_password
dim s_opened ; 開店フラグ
getini "system", "opened", s_opened
sdim s_last ; 前回の開店日
getini "system", "last", s_last
exist "pd.csv" ; 商品データファイル
temp_i = strsize
exist "rpd.csv" ; 削除済み商品データファイル
if strsize = -1 or temp_i = -1 { ; 一方でも欠けていれば再生成
p_buf = "商品ID,商品名,単価\n"
notesel p_buf
notesave "pd.csv"
notesave "rpd.csv"
noteunsel
s_pdcount = 0
writeini "system", "pdcount", s_pdcount ; 商品IDカウンターリセット
}
gosub *load_pd ; 商品データ読み込み(p_numが確定)
sdim d_buf_total, 4096 ; 累計販売実績用バッファ
exist "total.csv" ; 累計販売実績データファイル
if strsize = -1 {
; フォーマット作成
d_buf_total = "営業日数,0\n\n会計回数,0\n売上金額,0\n\n返金回数,0\n返金額,0\n\n現金誤差,0\n\n商品ID,売上数,返品数\n"
repeat p_num
d_buf_total += p_id(cnt) + ",0,0\n"
loop
; 保存
notesel d_buf_total
notesave "total.csv"
noteunsel
} else {
; 累計販売実績データ読み込み
notesel d_buf_total
noteload "total.csv"
noteunsel
}
dirlist temp_s, "daily", 5 ; 販売実績ディレクトリ
if stat = 0 : mkdir "daily"
dirlist temp_s, "history", 5 ; 販売履歴ディレクトリ
if stat = 0 : mkdir "history"
dirlist temp_s, "refund", 5 ; 返金履歴ディレクトリ
if stat = 0 : mkdir "refund"
dirlist temp_s, "hourly", 5 ; 毎時売上ディレクトリ
if stat = 0 : mkdir "hourly"
// 変数初期化
; システム用変数
dim tkey_arg, 11, 2 ; テンキーの配置配列
tkey_arg(0, 0) = 0, 0, 1, 2, 0, 1, 2, 0, 1, 2, 1
tkey_arg(0, 1) = 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, 3
dim tkey_clr_ID ; テンキークリアキーのオブジェクトID
dim LVCOLUMS, 6 ; LVCOLUMN構造体
dim SHFILEOPSTRUCT, 8 ; SHFILEOPSTRUCT構造体
sdim input_pw ; パスワード入力ボックス用
dim main_x : dim main_y ; メインウィンドウの座標
dim main_w : dim main_h ; メインウィンドウの幅高
; システム用変数
dim s_pdcount ; 商品IDのカウンター
s_week = "日", "月", "火", "水", "木", "金", "土"
s_today = strf("%04d/%02d/%02d", gettime(0), gettime(1), gettime(3))
; レイアウト用変数
unit_x = ginfo_winx / 128 ; サイズ、座標の単位ピクセル
unit_y = ginfo_winy / 96 ; 480p -> 5:5, 1080p -> 15:11
dim lay_x : dim lay_y ; 原点
dim lay_ex : dim lay_ey ; 範囲
dim lay_ox : dim lay_oy ; 外側幅
dim lay_ix : dim lay_iy ; 内側幅
dim lay_nx : dim lay_ny ; 配置数
dim lay_mpx : dim lay_mpy ; 文字列描画位置
dim lay_msx : dim lay_msy ; 文字列描画サイズ
; 時計表示用変数
dim t_sx ; 時計描画Xサイズ
dim t_sy ; 時計描画Yサイズ
; 開閉店処理用変数
o_amount = 10000, 5000, 2000, 1000, 500, 100, 50, 10, 5, 1
dim o_num, 10 ; 釣銭枚数(1万円から始まる配列)
dim o_sum ; 釣銭金額合計
dim o_error ; 現金誤差
dim o_focus ; フォーカスされている入力ボックス
dim o_input ; 入力切替用フラグ
; 会計用変数
dim c_num, p_num ; 各商品個数
dim c_anum ; 全商品個数
dim c_total ; 合計価格
dim c_depoint ; 預り金
dim c_change ; 会計完了フラグ
; 商品データ用変数(一部)
dim p_index ; 商品データ指定用インデックス
; 販売履歴用変数
sdim h_buf, 1024 ; 販売履歴ファイル用バッファ
; 販売実績用変数
sdim d_buf, 4096 ; 販売実績ファイル用バッファ(noteselのデフォルトのバッファ)
sdim d_buf_date, 4096 ; 日付別販売実績用バッファ
sdim d_list, 512 ; 販売実績データ列挙用
dim d_total ; 理論存高用
dim d_sel ; 販売データ指定インデックス
dim d_path ; 販売データ指定パス
; 返金用変数
sdim r_list, 512 ; 販売履歴列挙用
sdim r_path, 260 ; 販売履歴ファイルパス用
dim r_total ; 販売履歴売上金額用
dim r_pnum ; 販売履歴商品数用
sdim r_ID, , p_num ; 販売履歴商品ID用
dim r_num, p_num ; 販売履歴売上数用
; 毎時売上用変数
sdim u_buf, 256 ; 毎時売上用バッファ
sdim u_buf_date, 256 ; 毎時売上参照用バッファ
; 商品登録用変数
sdim a_name ; 登録商品名
dim a_value ; 登録商品単価
; 設定用変数
sdim e_newpass ; 新パスワード用
// フォントハンドル生成
; 汎用(hFont.0)
font msgothic, unit_y * 6
mref bmscr, 67
CreateFontIndirect varptr(bmscr.49)
hFont.0 = stat
; リストビュー用(hFont.1)
font msgothic, unit_y * 4, 1
mref bmscr, 67
CreateFontIndirect varptr(bmscr.49)
hFont.1 = stat
// サブウィンドウ作成
; パスワード入力ウィンドウ(sub_1)
screen 1, unit_x * 50, unit_y * 20, 6
hWnd_sub1 = hWnd
title "パスワード入力"
GetWindowLong hWnd_sub1, -16 ; GWL_STYLE
SetWindowLong hWnd_sub1, -16, stat & ($10000 | $20000 | $40000) ^ stat ; GWL_STYLE
SetWindowLong hWnd_sub1, -8, hWnd_main ; GWL_HWNDPARENT
SetWindowPos hWnd_sub1, 0, 0, 0, 0, 0, $1 | $2 | $4 | $20 ; SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED
clr 1
font msgothic, unit_y * 6 ; フォント選択
objmode 2
pos unit_x * 2, unit_y * 2
input input_pw, ginfo_winx - unit_x * 4, ginfo_winy / 2 - unit_y * 2, 4
hInput = objinfo_hwnd(stat)
sendmsg hInput, $CC, '*' ; EM_SETPASSWORDCHAR
SetWindowLong hInput, -16, $50010080 | $2000 ; 数字のみ
ImmAssociateContext hInput, 0 ; IME無効
objsize ginfo_winx / 2 - unit_x * 2, ginfo_winy / 2 - unit_y * 2
button gosub "OK", *sub_1_OK
pos ginfo_cx + ginfo_winx / 2 - unit_x * 2, ginfo_cy - (ginfo_winy / 2 - unit_y * 2)
button gosub "キャンセル", *sub_1_cancel
gsel 0
// 割り込み処理
onexit gosub *exit
onerror gosub *exerror
// その他の事前処理
; 時計表示サイズ取得
SelectObject hdc, hFont.0
mes s_today + strf("[%s] %02d:%02d:%02d", s_week(gettime(2)), gettime(4), gettime(5), gettime(6))
t_sx = ginfo_mesx : t_sy = ginfo_mesy
gosub *mode_0_i
///////////////// メインループ /////////////////
repeat
if ginfo_act = 0 {
; 時計表示
redraw 0
clr 2, 0, 0, t_sx, t_sy
pos 0, 0
SelectObject hdc, hFont.0
mes s_today + strf("[%s] %02d:%02d:%02d", s_week(gettime(2)), gettime(4), gettime(5), gettime(6))
redraw
}
wait 100
loop
stop
//////// 画面切替ルーチン(メイン直下以外) //////
*mode_open ; 開店処理
clr 0 ; 画面クリア(オブジェクト含む)
; 販売実績データファイル
exist "daily\\" + f_date + ".csv"
if strsize = -1 {
; 文字描画
SelectObject hdc, hFont.0
color 255 ; 赤
pos unit_x * 6, unit_y * 6
mes "開店処理"
color , , 255 ; 青
mes"釣銭準備金額入力"
color ; 黒
pos ginfo_cx + unit_y * 6, ginfo_cy + unit_y * 3
lay_x = ginfo_cx : lay_y = ginfo_cy
mes "5000円× 枚\n2000円× 枚\n1000円× 枚\n 500円× 枚\n 100円× 枚\n 50円× 枚\n 10円× 枚\n 5円× 枚\n 1円× 枚"
pos ginfo_cx - unit_y * 6, ginfo_cy + unit_y * 3
lay_mpx = ginfo_cx : lay_mpy = ginfo_cy
mes "合計 円"
; 各種入力ボックス配置
font msgothic, unit_y * 5
objmode 2
pos lay_x + unit_y * 25, lay_y + 1
repeat length(o_num) - 1 ; 1万円分減
input o_num(cnt + 1), unit_y * 20, unit_y * 6 ; 各紙貨幣枚数用入力ボックス
hInput.cnt = objinfo_hwnd(stat)
SetWindowLong hInput.cnt, -16, $50010080 | $2002 ; 数字入力限定右揃え
ImmAssociateContext hInput.cnt, 0 ; IME無効
loop
pos lay_mpx + unit_y * 13, lay_mpy + 1
input o_sum, unit_y * 38, unit_y * 6 ; 釣銭合計用入力ボックス
nInput = stat
objskip nInput, 7 ; フォーカス移動スキップ
hInput.nInput = objinfo_hwnd(nInput)
SetWindowLong hInput.nInput, -16, $50010080 | $2002 ; 数字入力限定右揃え
ImmAssociateContext hInput.nInput, 0 ; IME無効
sendmsg hInput.nInput, $CF, 1 ; 入力無効
// 切替ボタン
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = unit_x : lay_iy = unit_y
lay_nx = 1 : lay_ny = 3
objsize lay_sx, lay_sy
; オブジェクトフォントサイズ
font msgothic, unit_y * 9, 5
objmode 2
pos lay_px(0), lay_py(1)
button gosub "開店", *o_open
objskip stat, 3
; オブジェクトフォントサイズ
font msgothic, unit_y * 7
objmode 2
pos lay_px(0), lay_py(0)
button gosub "戻る", *mode_4
objskip stat, 3
pos lay_px(0), lay_py(2)
button gosub "入力切替", *o_change
objskip stat, 3
// テンキー設置
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = ginfo_cy - unit_y * 5
lay_ex = ginfo_winx : lay_ey = ginfo_winy
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = 0 : lay_iy = 0
lay_nx = 3 : lay_ny = 4
; オブジェクトフォントサイズ
font msgothic, unit_y * 8, 1
objmode 2
; クリアボタン
objsize lay_sx * 2 + lay_ix, lay_sy
pos lay_px(tkey_arg(10, 0)), lay_py(tkey_arg(10, 1))
button gosub "クリア", *o_tenkey
tkey_clr_ID = stat
objskip tkey_clr_ID, 3
; 数字ボタン
objsize lay_sx, lay_sy
repeat length(tkey_arg) - 1
pos lay_px(tkey_arg(cnt, 0)), lay_py(tkey_arg(cnt, 1))
button gosub str(cnt), *o_tenkey
objskip stat, 3
loop
oncmd gosub *o_command, $111 ; 入力割り込み処理
} else {
dialog "本日の閉店処理は完了しています。\n再び開店しますか。", 2, titl
if stat = 6 { ; はい
; 開店フラグ書き込み
s_opened = 1
writeini "system", "opened", s_opened
notesel d_buf ; 販売実績データを対象バッファに指定(デフォルト)
noteload "daily\\" + f_date + ".csv" ; 販売実績データ読み込み
noteunsel
gosub *mode_4
} else { ; いいえ
gosub *mode_4
}
}
return
*mode_close ; 閉店処理画面
; 各変数再初期化
dim o_num, 10 ; 釣銭枚数(1万円から始まる配列)
dim o_sum ; 釣銭金額合計
dim o_focus ; フォーカスされている入力ボックス
dim o_input ; 入力切替用フラグ
*mode_close_back ; 戻り処理
clr 0 ; 画面クリア(オブジェクト含む)
; 文字描画
SelectObject hdc, hFont.0
color 255 ; 赤
pos unit_x * 6, unit_y * 6
mes "閉店処理"
color , , 255 ; 青
mes "現金誤差確認"
color ; 黒
pos ginfo_cx + unit_y * 6, ginfo_cy + unit_y * 3
lay_x = ginfo_cx : lay_y = ginfo_cy
mes "10000円× 枚\n 5000円× 枚\n 2000円× 枚\n 1000円× 枚\n 500円× 枚\n 100円× 枚\n 50円× 枚\n 10円× 枚\n 5円× 枚\n 1円× 枚"
pos ginfo_cx - unit_y * 6, ginfo_cy + unit_y * 3
lay_mpx = ginfo_cx : lay_mpy = ginfo_cy
mes "合計 円"
; 各種入力ボックス配置
font msgothic, unit_y * 5
objmode 2
pos lay_x + unit_y * 28, lay_y + 1
repeat length(o_num)
input o_num(cnt), unit_y * 20, unit_y * 6 ; 各紙貨幣枚数用入力ボックス
hInput.cnt = objinfo_hwnd(stat)
SetWindowLong hInput.cnt, -16, $50010080 | $2002 ; 数字入力限定右揃え
ImmAssociateContext hInput.cnt, 0 ; IME無効
loop
pos lay_mpx + unit_y * 13, lay_mpy + 1
input o_sum, unit_y * 41, unit_y * 6 ; 釣銭合計用入力ボックス
nInput = stat
objskip nInput, 7 ; フォーカス移動スキップ
hInput.nInput = objinfo_hwnd(nInput)
SetWindowLong hInput.nInput, -16, $50010080 | $2002 ; 数字入力限定右揃え
ImmAssociateContext hInput.nInput, 0 ; IME無効
sendmsg hInput.nInput, $CF, 1 ; 入力無効
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = unit_x : lay_iy = unit_y
lay_nx = 1 : lay_ny = 3
objsize lay_sx, lay_sy
; オブジェクトフォントサイズ
font msgothic, unit_y * 7, 5
objmode 2
pos lay_px(0), lay_py(1)
button gosub "誤差確認", *mode_close2
objskip stat, 3
; オブジェクトフォントサイズ
font msgothic, unit_y * 7
objmode 2
pos lay_px(0), lay_py(0)
button gosub "戻る", *mode_4
objenable stat, 1 + (s_last ! s_today)
objskip stat, 3
pos lay_px(0), lay_py(2)
button gosub "入力切替", *o_change
objskip stat, 3
// テンキー設置
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = ginfo_cy - unit_y * 5
lay_ex = ginfo_winx : lay_ey = ginfo_winy
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = 0 : lay_iy = 0
lay_nx = 3 : lay_ny = 4
; オブジェクトフォントサイズ
font msgothic, unit_y * 8, 1
objmode 2
; クリアボタン
objsize lay_sx * 2 + lay_ix, lay_sy
pos lay_px(tkey_arg(10, 0)), lay_py(tkey_arg(10, 1))
button gosub "クリア", *o_tenkey
tkey_clr_ID = stat
objskip tkey_clr_ID, 3
; 数字ボタン
objsize lay_sx, lay_sy
repeat length(tkey_arg) - 1
pos lay_px(tkey_arg(cnt, 0)), lay_py(tkey_arg(cnt, 1))
button gosub str(cnt), *o_tenkey
objskip stat, 3
loop
oncmd gosub *o_command, $111 ; 入力割り込み処理
return
*mode_close2
oncmd gosub *dummy, $111 ; 入力割り込み無効
clr 0 ; 画面クリア(オブジェクト含む)
; 理論存高取得
notesel d_buf
d_total = int(GetCSV(9, 1))
noteunsel
; 文字描画
SelectObject hdc, hFont.0
color 255 ; 赤
pos unit_x * 6, unit_y * 6
mes "閉店処理"
color , , 255 ; 青
mes "現金誤差確認"
; 合計表示下書き
temp_i = ginfo_cx : lay_mpy = ginfo_cy + unit_y * 6
SelectObject hdc, hFont.0 ; フォントを選択
pos ginfo_winx, ginfo_winy
mes strf(" 現金存高%8d円 ", 0)
lay_msx = ginfo_mesx : lay_msy = ginfo_mesy
lay_mpx = temp_i + unit_y * 75 - lay_msx ; 右揃えに
; 現金存高表示描画
color , , 255 ; 青
pos lay_mpx, lay_mpy
mes strf(" 現金存高%10d円 ", o_sum)
; 理論存高表示下書き
color 255 ; 赤
mes strf(" 理論存高%10d円 ", d_total)
color 0, 0, 0
mes "────────────"
; 現金誤差表示
color , 128 ; 緑
mes strf(" 現金誤差%10d円 ", o_sum - d_total)
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = unit_x : lay_iy = unit_y
lay_nx = 1 : lay_ny = 2
objsize lay_sx, lay_sy
; オブジェクトフォントサイズ
font msgothic, unit_y * 9, 5
objmode 2
pos lay_px(0), lay_py(1)
button gosub "閉店", *o_close
objskip stat, 3
; オブジェクトフォントサイズ
font msgothic, unit_y * 9
objmode 2
pos lay_px(0), lay_py(0)
button gosub "戻る", *mode_close_back
return
///////// 画面切替ルーチン(メイン直下) /////////
*mode_0_i ; 起動時のジャンプ
clr 0 ; 画面クリア(オブジェクト含む)
f_date = strf("%04d-%02d-%02d", gettime(0), gettime(1), gettime(3)) ; 日付フォルダの名前(yyyy-mm-dd)
; 開店識別
if s_opened { ; 開店状態
if s_last ! s_today { ; 営業日が今日ではない
if s_last = "" { ; 営業日が取得できない
dialog "前回の営業日が取得できませんでした。\nこのエラーは自動で修復されます。", 1, titl
exist "daily\\" + f_date + ".csv"
if strsize = -1 {
; 閉店フラグ書き込み
s_opened = 0
writeini "system", "opened", s_opened
} else {
; 最終営業日書き込み
writeini "system", "last", s_today
}
} else { ; 閉店忘れ
dialog "前回(" + s_last + ")、閉店処理をせずに終了した可能性があります。\n前回の閉店処理を行いますか。", 3, titl
if stat = 6 { ; はい
f_date = s_last
strrep f_date, "/", "-"
; 前回の販売データ読み込み
exist "daily\\" + f_date + ".csv"
if strsize = -1 {
dialog "前回(" + s_last + ")の販売データが見つかりませんでした。", 1, titl
} else {
notesel d_buf
noteload "daily\\" + f_date + ".csv"
noteunsel
gosub *mode_close ; 閉店処理実行
return
}
} else {
; 閉店フラグ書き込み
s_opened = 0
writeini "system", "opened", s_opened
}
}
} else { ; 営業日が今日
exist "daily\\" + f_date + ".csv"
if strsize = -1 { ; 販売データがない
dialog "本日分の販売データが見つかりません。\n再度開店処理を行って下さい。", 1, titl
; 閉店フラグ書き込み
s_opened = 0
writeini "system", "opened", s_opened
} else { ; 開店状態(エラーなし)
notesel d_buf ; 販売実績データを対象バッファに指定(デフォルト)
noteload "daily\\" + f_date + ".csv" ; 販売実績データ読み込み
noteunsel
notesel u_buf ; 毎時売上データ
noteload "hourly\\" + f_date + ".csv" ; 販売実績データ読み込み
noteunsel
}
}
} else { ; 閉店状態
if s_last ! s_today { ; 営業日が今日ではない
dialog "おはようございます。\n[管理] ⇒ [開店]から開店作業を行ってください。", 0, titl
}
; 営業日が今日(閉店済み)
}
if p_num = 0 : dialog "商品が登録されていません。\n[管理] ⇒ [商品登録]から商品の登録を行ってください。", 1, titl
*mode_0 ; メインメニュー
clr 0 ; 画面クリア(オブジェクト含む)
; 画面レイアウト設定
lay_x = 0 : lay_y = 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy
lay_ox = unit_x * 12 : lay_oy = unit_y * 12
lay_ix = unit_x * 4 : lay_iy = unit_y * 4
lay_nx = 3 : lay_ny = 1
objsize lay_sx, lay_sy
; オブジェクトフォントサイズ
font msgothic, unit_y * 12, 5
objmode 2
pos lay_px(0), lay_py(0)
button gosub "会計", *mode_1
objenable stat, p_num * s_opened
; オブジェクトフォントサイズ
font msgothic, unit_y * 12
objmode 2
pos lay_px(1), lay_py(0)
button gosub "販売\n実績", *mode_2
SetWindowLong objinfo_hwnd(stat), -16, $50000000 | $2000 ; 複数行表示
pos lay_px(2), lay_py(0) ; 返金ボタン描画位置
lay_ny = 2 ; 縦レイアウト変更
objsize lay_sx, lay_sy
button gosub "返金", *mode_3
objenable stat, s_opened
pos lay_px(2), lay_py(1)
#ifdef _debug
button gosub "管理", *mode_4
#else
button gosub "管理", *sub_1
#endif
objsel 0
onkey 0
return
*mode_1 ; 受注画面
; 受注用変数初期化
c_total = 0 : c_anum = 0
repeat p_num
c_num(cnt) = 0
loop
*mode_1_back
clr 0 ; 画面クリア(オブジェクト含む)
// 受注用リストビュー設置
pos unit_x * 6, unit_y * 6
winobj "SysListView32", "", $200, $50000001, unit_x * 75, ginfo_winy - unit_y * 18
hList = objinfo_hwnd(stat)
sendmsg hList, $1036, , $1 | $20 ; 拡張スタイル(LVM_SETEXTENDEDLISTVIEWSTYLE)
sendmsg hList, $30, hFont.1, 0 ; フォント変更(WM_SETFONT)
syscolor 16
sendmsg hList, $1026, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16)
sendmsg hList, $1001, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16)
color 0, 0, 0
ImmAssociateContext hList, 0 ; IME無効
; カラム追加
temp_s = "商品名"
LVCOLUMS = $F, 0, unit_x * 46, varptr(temp_s), 0, 0
sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
temp_s = "単価"
LVCOLUMS = $F, 1, unit_x * 13, varptr(temp_s), 0, 0
sendmsg hList, $101B, 1, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
temp_s = "個"
LVCOLUMS = $F, 1, unit_x * 9, varptr(temp_s), 0, 0
sendmsg hList, $101B, 2, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
; アイテム追加
repeat p_num
; 商品名
temp_s = p_name(cnt)
LVCOLUMS = $1, cnt, 0, 0, 0, varptr(temp_s)
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_INSERTITEM
; 単価
temp_s = str(p_value(cnt))
LVCOLUMS = $1, cnt, 1, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
; 個数
temp_s = str(c_num(cnt))
LVCOLUMS = $1, cnt, 2, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
loop
; 小計表示下書き
lay_mpx = ginfo_cx : lay_mpy = ginfo_cy
SelectObject hdc, hFont.0
pos ginfo_winx, ginfo_winy
mes strf("小計%8d円", 0)
lay_msx = ginfo_mesx : lay_msy = ginfo_mesy
lay_mpx = lay_mpx + unit_x * 75 - lay_msx
pos lay_mpx, lay_mpy
mes strf("小計%8d円", c_total)
// 会計&取り消しボタン
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = unit_x : lay_iy = unit_y
lay_nx = 1 : lay_ny = 2
objsize lay_sx, lay_sy
; オブジェクトフォントサイズ
font msgothic, unit_y * 10
objmode 2
pos lay_px(0), lay_py(0)
button gosub "取消", *mode_1_cancel
; オブジェクトフォントサイズ
font msgothic, unit_y * 10, 5
objmode 2
pos lay_px(0), lay_py(1)
button gosub "会計", *mode_1_1
// テンキー設置
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = ginfo_cy - unit_y * 5
lay_ex = ginfo_winx : lay_ey = ginfo_winy
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = 0 : lay_iy = 0
lay_nx = 3 : lay_ny = 4
; オブジェクトフォントサイズ
font msgothic, unit_y * 8, 1
objmode 2
; クリアボタン
objsize lay_sx * 2 + lay_ix, lay_sy
pos lay_px(tkey_arg(10, 0)), lay_py(tkey_arg(10, 1))
button gosub "クリア", *mode_1_tenkey
tkey_clr_ID = stat
; 数字ボタン
objsize lay_sx, lay_sy
repeat length(tkey_arg) - 1
pos lay_px(tkey_arg(cnt, 0)), lay_py(tkey_arg(cnt, 1))
button gosub str(cnt), *mode_1_tenkey
loop
onkey gosub *mode_1_key_event ; mode_1でのキーイベントジャンプ先
return
*mode_2 ; 販売実績表示画面
clr 0 ; 画面クリア(オブジェクト含む)
; 画面レイアウト設定
lay_x = 0 : lay_y = 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy
lay_ox = unit_x * 12 : lay_oy = unit_y * 12
lay_ix = unit_x * 4 : lay_iy = unit_y * 4
lay_nx = 1 : lay_ny = 3
; オブジェクトフォントサイズ
font msgothic, unit_y * 12
objmode 2
objsize lay_sx, lay_sy
pos lay_px(0), lay_py(0)
button gosub "日付別販売実績", *mode_2_1
pos lay_px(0), lay_py(1)
button gosub "累計販売実績", *mode_2_2
pos lay_px(0), lay_py(2)
button gosub "戻る", *mode_0
return
*mode_3 ; 返金選択画面
#ifndef _debug ; 通常時
dialog "返金は本日分の会計のみ行えます。", 0, titl
#endif
*mode_3_back
clr 0 ; 画面クリア(オブジェクト含む)
// 受注用リストビュー設置
pos unit_x * 6, unit_y * 6
winobj "SysListView32", "", $200, $50000001, unit_x * 75, ginfo_winy - unit_y * 18
hList = objinfo_hwnd(stat)
sendmsg hList, $1036, , $1 | $20 ; 拡張スタイル(LVM_SETEXTENDEDLISTVIEWSTYLE)
sendmsg hList, $30, hFont.1, 0 ; フォント変更(WM_SETFONT)
syscolor 16
sendmsg hList, $1026, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16)
sendmsg hList, $1001, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16)
color 0, 0, 0
ImmAssociateContext hList, 0 ; IME無効
; カラム追加
temp_s = "会計時間"
LVCOLUMS = $F, 0, unit_x * 67, varptr(temp_s), 0, 0
sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
// 戻る&選択ボタン
; オブジェクトフォントサイズ
font msgothic, unit_y * 9
objmode 2
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = unit_x : lay_iy = unit_y
lay_nx = 1 : lay_ny = 2
objsize lay_sx, lay_sy
pos lay_px(0), lay_py(0)
button gosub "戻る", *mode_0
font msgothic, unit_y * 9, 5
objmode 2
pos lay_px(0), lay_py(1)
button gosub "選択", *mode_3_1
dirlist r_list, "history\\" + f_date + "\\**-**-**.csv", 3
repeat stat
temp_s = strmid(r_list, cnt * 14, 8) ; ファイル名取り出し(拡張子 + 改行コード抜き)
strrep temp_s, "-", ":"
; アイテム追加
LVCOLUMS = $1, 0, 0, 0, 0, varptr(temp_s)
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_SETITEM
loop
noteunsel
return
*mode_4 ; 管理画面
oncmd gosub *dummy, $111 ; 入力割り込み無効
clr 0 ; 画面クリア(オブジェクト含む)
; 画面レイアウト設定
lay_x = 0 : lay_y = 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy
lay_ox = unit_x * 12 : lay_oy = unit_y * 12
lay_ix = unit_x * 4 : lay_iy = unit_y * 4
lay_nx = 3 : lay_ny = 2
objsize lay_sx, lay_sy
; オブジェクトフォント指定
font msgothic, unit_y * 10, 5
objmode 2
pos lay_px(0), lay_py(0)
if s_opened {
button gosub "閉店", *mode_close
} else {
if s_last = s_today {
button gosub "再開店", *mode_open
} else {
button gosub "開店", *mode_open
}
}
; オブジェクトフォント指定
font msgothic, unit_y * 10
objmode 2
pos lay_px(1), lay_py(0)
button gosub "レジ\n点検", *mode_4_2
nButton = stat
SetWindowLong objinfo_hwnd(nButton), -16, $50000000 | $2000 ; 複数行表示
objenable nButton, s_opened
pos lay_px(2), lay_py(0)
button gosub "返金\n取消", *mode_4_3
nButton = stat
SetWindowLong objinfo_hwnd(nButton), -16, $50000000 | $2000 ; 複数行表示
objenable nButton, s_opened
pos lay_px(0), lay_py(1)
button gosub "商品\n登録", *mode_4_4
SetWindowLong objinfo_hwnd(stat), -16, $50000000 | $2000 ; 複数行表示
pos lay_px(1), lay_py(1)
button gosub "その他", *mode_4_5
pos lay_px(2), lay_py(1)
button gosub "戻る", *mode_0
font msgothic, unit_y * 4, 1
objsize unit_x * 14, unit_y * 6
pos ginfo_winx - unit_x * 14, 0
button gosub "終了", *exit2
pos ginfo_winx - unit_x * 28, 0
button gosub "最小化", *s_mini
return
*sub_1 ; パスワード入力ウィンドウ表示
if s_password = "0000" { ; パスワード「0000」ならスキップ
gosub *mode_4
return
}
main_x = ginfo_wx1 : main_y = ginfo_wy1
main_w = ginfo_winx : main_h = ginfo_winy
EnableWindow hWnd_main, 0
gsel 1
width unit_x * 50, unit_y * 20, main_x + (main_w - ginfo_winx) / 2, main_y + (main_h - ginfo_winy) / 2
objprm 0, "" : objsel 0
gsel 1, 1
onkey gosub *sub_1_key_event
return
//////////// 画面切替ルーチン(従属) ////////////
*mode_1_1 ; 会計画面
if c_anum <= 0 { ; 商品個数0の通知
dialog "商品個数が入力されていません。", 0, titl
return
}
if c_total <= 0 {
dialog "金額が異常です。\n入力内容を確認してください。", 1, titl
return
}
; 会計用変数初期化
c_depoint = 0
c_change = 1
clr 0 ; 画面クリア(オブジェクト含む)
// 受注内容確認リストビュー配置
pos unit_x * 6, unit_y * 6
winobj "SysListView32", "", $200, $50000001, unit_x * 75, ginfo_winy / 2 - unit_y * 6
hList = objinfo_hwnd(stat)
sendmsg hList, $1036, , $1 | $20 ; 拡張スタイル(LVM_SETEXTENDEDLISTVIEWSTYLE)
sendmsg hList, $30, hFont.1, 0 ; フォント変更(WM_SETFONT)
syscolor 16
sendmsg hList, $1001, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16) ; 背景色変更(LVM_SETBKCOLOR)
sendmsg hList, $1026, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16) ; テキスト背景色変更(LVM_SETTEXTBKCOLOR)
color 0, 0, 0
ImmAssociateContext hList, 0 ; IME無効
; カラム追加
temp_s = "商品名"
LVCOLUMS = $F, 0, unit_x * 46, varptr(temp_s), 0, 0
sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
temp_s = "単価"
LVCOLUMS = $F, 1, unit_x * 13, varptr(temp_s), 0, 0
sendmsg hList, $101B, 1, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
temp_s = "個"
LVCOLUMS = $F, 1, unit_x * 9, varptr(temp_s), 0, 0
sendmsg hList, $101B, 2, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
; アイテム追加
repeat p_num
if c_num(cnt) = 0 : continue ; 数量0はスキップ
; アイテム数取得
sendmsg hList, $1004 ; LVM_GETITEMCOUNT
temp_i = stat
; 商品名
LVCOLUMS = $1, temp_i, 0, 0, 0, varptr(p_name(cnt))
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_INSERTITEM
; 単価
temp_s = str(p_value(cnt))
LVCOLUMS = $1, temp_i, 1, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
; 個数
temp_s = str(c_num(cnt))
LVCOLUMS = $1, temp_i, 2, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
loop
; 合計表示下書き
temp_i = ginfo_cx : lay_mpy = ginfo_cy + unit_y * 4
SelectObject hdc, hFont.0 ; フォントを選択
pos ginfo_winx, ginfo_winy
mes strf(" 合計%8d円 ", 0)
lay_msx = ginfo_mesx : lay_msy = ginfo_mesy
lay_mpx = temp_i + unit_y * 75 - lay_msx ; 右揃えに
; 合計表示描画
pos lay_mpx, lay_mpy
mes strf(" 合計%8d円 ", c_total)
; 預り金表示下書き
color 255, 0, 0
lay_mpx = ginfo_cx : lay_mpy = ginfo_cy
mes strf(" お預り%8d円 ", c_depoint)
color 0, 0, 0
mes "────────────"
// 変更&確定ボタン
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = unit_x : lay_iy = unit_y
lay_nx = 1 : lay_ny = 2
objsize lay_sx, lay_sy
; オブジェクトフォントサイズ
font msgothic, unit_y * 10
objmode 2
pos lay_px(0), lay_py(0)
button gosub "変更", *mode_1_back
; オブジェクトフォントサイズ
font msgothic, unit_y * 10, 5
objmode 2
pos lay_px(0), lay_py(1)
button gosub "確定", *mode_1_1_confirm
// テンキー設置
; オブジェクトフォントサイズ
font msgothic, unit_y * 8, 1
objmode 2
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = ginfo_cy - unit_y * 5
lay_ex = ginfo_winx : lay_ey = ginfo_winy
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = 0 : lay_iy = 0
lay_nx = 3 : lay_ny = 4
; クリアボタン
objsize lay_sx * 2 + lay_ix, lay_sy
pos lay_px(tkey_arg(10, 0)), lay_py(tkey_arg(10, 1))
button gosub "クリア", *mode_1_tenkey
tkey_clr_ID = stat
; 数字ボタン
objsize lay_sx, lay_sy
repeat length(tkey_arg) - 1
pos lay_px(tkey_arg(cnt, 0)), lay_py(tkey_arg(cnt, 1))
button gosub str(cnt), *mode_1_tenkey
loop
onkey gosub *mode_1_1_key_event
return
*mode_2_1 ; 日付別販売実績
clr 0 ; 画面クリア(オブジェクト含む)
// 日付リストビュー配置
pos unit_x * 6, unit_y * 6
winobj "SysListView32", "", $200, $50000001, unit_x * 75, ginfo_winy - unit_y * 12
hList = objinfo_hwnd(stat)
sendmsg hList, $1036, , $1 | $20 ; 拡張スタイル(LVM_SETEXTENDEDLISTVIEWSTYLE)
sendmsg hList, $30, hFont.1, 0 ; フォント変更(WM_SETFONT)
syscolor 16
sendmsg hList, $1001, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16) ; 背景色変更(LVM_SETBKCOLOR)
sendmsg hList, $1026, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16) ; テキスト背景色変更(LVM_SETTEXTBKCOLOR)
color 0, 0, 0
ImmAssociateContext hList, 0 ; IME無効
; カラム追加
temp_s = "日付"
LVCOLUMS = $F, 0, unit_x * 67, varptr(temp_s), 0, 0
sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
dirlist d_list, "daily\\****-**-**.csv", 3 ; 販売実績ファイル列挙
repeat stat
temp_s = strmid(d_list, cnt * 16, 10) ; ファイル名取り出し(拡張子 + 改行コード抜き)
strrep temp_s, "-", "/"
; アイテム追加
LVCOLUMS = $1, 0, 0, 0, 0, varptr(temp_s)
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_SETITEM
loop
// 戻る&選択ボタン
; オブジェクトフォントサイズ
font msgothic, unit_y * 9
objmode 2
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = unit_x : lay_iy = unit_y
lay_nx = 1 : lay_ny = 2
objsize lay_sx, lay_sy
pos lay_px(0), lay_py(0)
button gosub "戻る", *mode_2
font msgothic, unit_y * 9, 5
objmode 2
pos lay_px(0), lay_py(1)
button gosub "選択", *mode_2_1_1
return
*mode_2_2 ; 累計販売実績
clr 0 ; 画面クリア(オブジェクト含む)
// 累計販売実績リストビュー配置
pos unit_x * 6, unit_y * 6
winobj "SysListView32", "", $200, $50000001, unit_x * 75, ginfo_winy - unit_y * 12
hList = objinfo_hwnd(stat)
sendmsg hList, $1036, , $1 | $20 ; 拡張スタイル(LVM_SETEXTENDEDLISTVIEWSTYLE)
sendmsg hList, $30, hFont.1, 0 ; フォント変更(WM_SETFONT)
syscolor 16
sendmsg hList, $1001, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16) ; 背景色変更(LVM_SETBKCOLOR)
sendmsg hList, $1026, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16) ; テキスト背景色変更(LVM_SETTEXTBKCOLOR)
color 0, 0, 0
ImmAssociateContext hList, 0 ; IME無効
; カラム追加
temp_s = "商品名"
LVCOLUMS = $F, 0, unit_x * 43, varptr(temp_s), 0, 0
sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
temp_s = "売上"
LVCOLUMS = $F, 1, unit_x * 12, varptr(temp_s), 0, 0
sendmsg hList, $101B, 1, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
temp_s = "返品"
LVCOLUMS = $F, 1, unit_x * 12, varptr(temp_s), 0, 0
sendmsg hList, $101B, 2, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
// 戻るボタン
; オブジェクトフォントサイズ
font msgothic, unit_y * 9, 1
objmode 2
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = unit_x : lay_iy = unit_y
lay_nx = 1 : lay_ny = 2
objsize lay_sx, lay_sy
pos lay_px(0), lay_py(0)
button gosub "戻る", *mode_2
notesel d_buf_total ; 対象バッファを累計販売実績データに
; 商品一覧表示
repeat notemax - 11, 11
temp_s = GetCSV(cnt, 0) ; 商品ID取得
p_index = -1
repeat p_num ; 商品データから検索
if temp_s = p_id(cnt) : p_index = cnt : break
loop
sendmsg hList, $1004 ; LVM_GETITEMCOUNT
temp_i = stat
if p_index >= 0 { ; 商品データから見つかった
; 商品名項目追加
LVCOLUMS = $1, temp_i, 0, 0, 0, varptr(p_name(p_index))
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_INSERTITEM
} else {
repeat rp_num ; 削除済み商品データから検索
if temp_s = rp_id(cnt) : p_index = cnt : break
loop
if p_index >= 0 { ; 削除済み商品データから見つかった
; 商品名項目追加
LVCOLUMS = $1, temp_i, 0, 0, 0, varptr(rp_name(p_index))
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_INSERTITEM
} else {
; 商品名項目追加
temp_s = "不明な商品(ID:" + temp_s + ")"
LVCOLUMS = $1, temp_i, 0, 0, 0, varptr(temp_s)
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_INSERTITEM
}
}
; 売上数項目追加
temp_s = GetCSV(cnt, 1)
LVCOLUMS = $1, temp_i, 1, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
; 返品数項目追加
temp_s = GetCSV(cnt, 2)
LVCOLUMS = $1, temp_i, 2, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
loop
; 合計表示
SelectObject hdc, hFont.0 ; フォントを選択
color 128, , 255 ; 紫
mes strf("営業日数\n%11d日", int(GetCSV(0, 1)))
color 255, 128 ; 橙
mes strf("客数\n%11d人", int(GetCSV(2, 1)))
color 255 ; 赤
mes strf("売上金額\n%11d円", int(GetCSV(3, 1)))
color , 128 ; 緑
mes strf("返金額\n%11d円", int(GetCSV(6, 1)))
color , , 255 ; 青
mes strf("現金誤差\n%11d円", int(GetCSV(8, 1)))
noteunsel ; バッファ復帰
return
*mode_2_1_1 ; 日付別販売実績表示
; 選択アイテム取得
sendmsg hList, $100C, -1, $2 ; LVM_GETNEXTITEM LVNI_SELECTED
if stat = -1 : return
d_sel = stat
*mode_2_1_1_back
clrobj 1, 2 ; ボタンだけ削除
sendmsg hList, $1009 ; LVM_DELETEALLITEMS
; カラム追加
temp_s = "商品名"
LVCOLUMS = $F, 0, unit_x * 43, varptr(temp_s), 0, 0
sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
temp_s = "売上"
LVCOLUMS = $F, 1, unit_x * 12, varptr(temp_s), 0, 0
sendmsg hList, $101B, 1, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
temp_s = "返品"
LVCOLUMS = $F, 1, unit_x * 12, varptr(temp_s), 0, 0
sendmsg hList, $101B, 2, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
sendmsg hList, $101C, 3 ; カラムを削除(LVM_DELETECOLUMN)
sendmsg hList, $101C, 3 ; カラムを削除(LVM_DELETECOLUMN)
sendmsg hList, $101C, 3 ; カラムを削除(LVM_DELETECOLUMN)
sendmsg hList, $101C, 3 ; カラムを削除(LVM_DELETECOLUMN)
; オブジェクトフォントサイズ
font msgothic, unit_y * 9, 1
objmode 2
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = unit_x : lay_iy = unit_y
lay_nx = 1 : lay_ny = 2
objsize lay_sx, lay_sy
pos lay_px(0), lay_py(0)
button gosub "戻る", *mode_2_1
font msgothic, unit_y * 9, 5
objmode 2
pos lay_px(0), lay_py(1)
button gosub "毎時売上", *mode_2_1_2
; 販売実績データ一覧から選択されたファイルを取得
notesel d_list
noteget d_path, notemax - d_sel - 1
noteunsel
; 選択された販売実績データをバッファにロード
notesel d_buf_date
noteload "daily\\" + d_path
if notemax = 0 {
dialog "選択された日付の販売実績データは読み込めません。", 1, titl
noteunsel ; バッファ復帰
gosub *mode_2_1
return
}
; 商品一覧表示
repeat notemax - 14, 14
temp_s = GetCSV(cnt, 0) ; 商品ID取得
p_index = -1
repeat p_num ; 商品データから検索
if temp_s = p_id(cnt) : p_index = cnt : break
loop
sendmsg hList, $1004 ; LVM_GETITEMCOUNT
temp_i = stat
if p_index >= 0 { ; 商品データから見つかった
; 商品名項目追加
LVCOLUMS = $1, temp_i, 0, 0, 0, varptr(p_name(p_index))
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_INSERTITEM
} else {
repeat rp_num ; 削除済み商品データから検索
if temp_s = rp_id(cnt) : p_index = cnt : break
loop
if p_index >= 0 { ; 削除済み商品データから見つかった
; 商品名項目追加
LVCOLUMS = $1, temp_i, 0, 0, 0, varptr(rp_name(p_index))
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_INSERTITEM
} else {
; 商品名項目追加
temp_s = "不明な商品(ID:" + temp_s + ")"
LVCOLUMS = $1, temp_i, 0, 0, 0, varptr(temp_s)
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_INSERTITEM
}
}
; 売上数項目追加
temp_s = GetCSV(cnt, 1)
LVCOLUMS = $1, temp_i, 1, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
; 返品数項目追加
temp_s = GetCSV(cnt, 2)
LVCOLUMS = $1, temp_i, 2, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
loop
; 合計表示
SelectObject hdc, hFont.0 ; フォントを選択
color 255, 128 ; 橙
mes strf("客数\n%11d人", int(GetCSV(3, 1)))
color 255 ; 赤
mes strf("売上金額\n%11d円", int(GetCSV(4, 1)))
color , 128 ; 緑
mes strf("返金額\n%11d円", int(GetCSV(7, 1)))
color , , 255 ; 青
mes strf("現金誤差\n%11d円", int(GetCSV(11, 1)))
noteunsel ; バッファ復帰
return
*mode_2_1_2 ; 時間別販売実績表示
clrobj 1, 2 ; ボタンだけ削除
sendmsg hList, $1009 ; LVM_DELETEALLITEMS
; カラム追加
temp_s = "時間"
LVCOLUMS = $F, 0, unit_x * 13, varptr(temp_s), 0, 0
sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
temp_s = "客数"
LVCOLUMS = $F, 1, unit_x * 16, varptr(temp_s), 0, 0
sendmsg hList, $101B, 1, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
temp_s = "売上"
LVCOLUMS = $F, 1, unit_x * 21, varptr(temp_s), 0, 0
sendmsg hList, $101B, 2, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
temp_s = "客単価"
LVCOLUMS = $F, 1, unit_x * 17, varptr(temp_s), 0, 0
sendmsg hList, $101B, 3, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
sendmsg hList, $101C, 4 ; カラムを削除(LVM_DELETECOLUMN)
sendmsg hList, $101C, 4 ; カラムを削除(LVM_DELETECOLUMN)
sendmsg hList, $101C, 4 ; カラムを削除(LVM_DELETECOLUMN)
; オブジェクトフォントサイズ
font msgothic, unit_y * 9, 1
objmode 2
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = unit_x : lay_iy = unit_y
lay_nx = 1 : lay_ny = 2
objsize lay_sx, lay_sy
pos lay_px(0), lay_py(0)
button gosub "戻る", *mode_2_1
font msgothic, unit_y * 9, 5
objmode 2
pos lay_px(0), lay_py(1)
button gosub "売上一覧", *mode_2_1_1_back
notesel u_buf_date
noteload "hourly\\" + d_path
repeat 24
; 時間項目追加
temp_s = strf("%02d:00", cnt)
LVCOLUMS = $1, cnt, 0, 0, 0, varptr(temp_s)
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_INSERTITEM
; 会計数項目追加
temp_s = GetCSV(cnt + 1, 1)
temp_i = int(temp_s)
LVCOLUMS = $1, cnt, 1, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
; 売上額項目追加
temp_s = GetCSV(cnt + 1, 2)
LVCOLUMS = $1, cnt, 2, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
; 客単価項目追加
if temp_i {
temp_s = str(int(temp_s) / temp_i)
} else : temp_s = "0"
LVCOLUMS = $1, cnt, 3, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
loop
noteunsel
return
*mode_3_1 ; 返金画面
; 選択アイテム取得
sendmsg hList, $100C, -1, $2 ; LVM_GETNEXTITEM LVNI_SELECTED
if stat = -1 : return
temp_i = stat
clrobj 1, 2 ; ボタンだけ削除
sendmsg hList, $1009 ; LVM_DELETEALLITEMS
; カラム追加
temp_s = "商品名"
LVCOLUMS = $F, 0, unit_x * 55, varptr(temp_s), 0, 0
sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
temp_s = "個"
LVCOLUMS = $F, 1, unit_x * 12, varptr(temp_s), 0, 0
sendmsg hList, $101B, 1, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
sendmsg hList, $101C, 2 ; 時間カラムを削除(LVM_DELETECOLUMN)
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = unit_x : lay_iy = unit_y
lay_nx = 1 : lay_ny = 2
objsize lay_sx, lay_sy
font msgothic, unit_y * 9
objmode 2
pos lay_px(0), lay_py(0)
button gosub "戻る", *mode_3_back
font msgothic, unit_y * 9, 5
objmode 2
pos lay_px(0), lay_py(1)
button gosub "返金", *mode_3_1_refund
; 販売実績データ一覧から選択されたファイルを取得
notesel r_list
noteget temp_s, notemax - temp_i - 1
noteunsel
r_path = f_date + "\\" + temp_s ; 販売実績ファイルパス代入
; 選択された販売実績データをバッファにロード
notesel h_buf
noteload "history\\" + r_path
if notemax = 0 {
dialog "選択された販売履歴データは読み込めません。", 1, titl
noteunsel ; バッファ復帰
gosub *mode_3_back
return
}
; 商品一覧表示
repeat notemax - 2, 2
temp_s = GetCSV(cnt, 0) ; 商品ID取得
p_index = -1
repeat p_num ; 商品データから検索
if temp_s = p_id(cnt) : p_index = cnt : break
loop
sendmsg hList, $1004 ; LVM_GETITEMCOUNT
temp_i = stat
if p_index >= 0 { ; 商品データから見つかった
; 商品名項目追加
LVCOLUMS = $1, temp_i, 0, 0, 0, varptr(p_name(p_index))
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_INSERTITEM
} else {
repeat rp_num ; 削除済み商品データから検索
if temp_s = rp_id(cnt) : p_index = cnt : break
loop
if p_index >= 0 { ; 削除済み商品データから見つかった
; 商品名項目追加
LVCOLUMS = $1, temp_i, 0, 0, 0, varptr(rp_name(p_index))
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_INSERTITEM
} else {
; 商品名項目追加
temp_s = "不明な商品(ID:" + temp_s + ")"
LVCOLUMS = $1, temp_i, 0, 0, 0, varptr(temp_s)
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_INSERTITEM
}
}
; 売上数項目追加
temp_s = GetCSV(cnt, 1)
LVCOLUMS = $1, temp_i, 1, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
loop
; 売上金額表示
SelectObject hdc, hFont.0 ; フォントを選択
color 255 ; 赤
mes strf("\n売上金額\n%11d円", int(GetCSV(0, 1)))
noteunsel ; バッファ復帰
return
*mode_4_2 ; レジ点検
; 各変数再初期化
dim o_num, 10 ; 釣銭枚数(1万円から始まる配列)
dim o_sum ; 釣銭金額合計
dim o_focus ; フォーカスされている入力ボックス
dim o_input ; 入力切替用フラグ
*mode_4_2_back ; 戻り処理
clr 0 ; 画面クリア(オブジェクト含む)
; 文字描画
SelectObject hdc, hFont.0
color 255 ; 赤
pos unit_x * 6, unit_y * 6
mes "レジ点検" + strf("(%04d/%02d/%02d[%s])", gettime(0), gettime(1), gettime(3), s_week(gettime(2)))
color , , 255 ; 青
mes "現金誤差確認"
color ; 黒
pos ginfo_cx + unit_y * 6, ginfo_cy + unit_y * 3
lay_x = ginfo_cx : lay_y = ginfo_cy
mes "10000円× 枚\n 5000円× 枚\n 2000円× 枚\n 1000円× 枚\n 500円× 枚\n 100円× 枚\n 50円× 枚\n 10円× 枚\n 5円× 枚\n 1円× 枚"
pos ginfo_cx - unit_y * 6, ginfo_cy + unit_y * 3
lay_mpx = ginfo_cx : lay_mpy = ginfo_cy
mes "合計 円"
; 各種入力ボックス配置
font msgothic, unit_y * 5
objmode 2
pos lay_x + unit_y * 28, lay_y + 1
repeat length(o_num)
input o_num(cnt), unit_y * 20, unit_y * 6 ; 各紙貨幣枚数用入力ボックス
hInput.cnt = objinfo_hwnd(stat)
SetWindowLong hInput.cnt, -16, $50010080 | $2002 ; 数字入力限定右揃え
ImmAssociateContext hInput.cnt, 0 ; IME無効
loop
pos lay_mpx + unit_y * 13, lay_mpy + 1
input o_sum, unit_y * 41, unit_y * 6 ; 釣銭合計用入力ボックス
nInput = stat
objskip nInput, 7 ; フォーカス移動スキップ
hInput.nInput = objinfo_hwnd(nInput)
SetWindowLong hInput.nInput, -16, $50010080 | $2002 ; 数字入力限定右揃え
ImmAssociateContext hInput.nInput, 0 ; IME無効
sendmsg hInput.nInput, $CF, 1 ; 入力無効
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = unit_x : lay_iy = unit_y
lay_nx = 1 : lay_ny = 3
objsize lay_sx, lay_sy
; オブジェクトフォントサイズ
font msgothic, unit_y * 7, 5
objmode 2
pos lay_px(0), lay_py(1)
button gosub "誤差確認", *mode_4_2_1
objskip stat, 3
; オブジェクトフォントサイズ
font msgothic, unit_y * 7
objmode 2
pos lay_px(0), lay_py(0)
button gosub "戻る", *mode_4
objskip stat, 3
pos lay_px(0), lay_py(2)
button gosub "入力切替", *o_change
objskip stat, 3
// テンキー設置
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = ginfo_cy - unit_y * 5
lay_ex = ginfo_winx : lay_ey = ginfo_winy
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = 0 : lay_iy = 0
lay_nx = 3 : lay_ny = 4
; オブジェクトフォントサイズ
font msgothic, unit_y * 8, 1
objmode 2
; クリアボタン
objsize lay_sx * 2 + lay_ix, lay_sy
pos lay_px(tkey_arg(10, 0)), lay_py(tkey_arg(10, 1))
button gosub "クリア", *o_tenkey
tkey_clr_ID = stat
objskip tkey_clr_ID, 3
; 数字ボタン
objsize lay_sx, lay_sy
repeat length(tkey_arg) - 1
pos lay_px(tkey_arg(cnt, 0)), lay_py(tkey_arg(cnt, 1))
button gosub str(cnt), *o_tenkey
objskip stat, 3
loop
oncmd gosub *o_command, $111 ; 入力割り込み処理
return
*mode_4_2_1
oncmd gosub *dummy, $111 ; 入力割り込み無効
clr 0 ; 画面クリア(オブジェクト含む)
; 理論存高取得
notesel d_buf
d_total = int(GetCSV(9, 1))
noteunsel
; 文字描画
SelectObject hdc, hFont.0
color 255 ; 赤
pos unit_x * 6, unit_y * 6
mes "レジ点検" + strf("(%04d/%02d/%02d[%s])", gettime(0), gettime(1), gettime(3), s_week(gettime(2)))
color , , 255 ; 青
mes "現金誤差確認"
; 合計表示下書き
temp_i = ginfo_cx : lay_mpy = ginfo_cy + unit_y * 6
SelectObject hdc, hFont.0 ; フォントを選択
pos ginfo_winx, ginfo_winy
mes strf(" 現金存高%8d円 ", 0)
lay_msx = ginfo_mesx : lay_msy = ginfo_mesy
lay_mpx = temp_i + unit_y * 75 - lay_msx ; 右揃えに
; 現金存高表示描画
color , , 255 ; 青
pos lay_mpx, lay_mpy
mes strf(" 現金存高%10d円 ", o_sum)
; 理論存高表示下書き
color 255 ; 赤
mes strf(" 理論存高%10d円 ", d_total)
color 0, 0, 0
mes "────────────"
; 現金誤差表示
color , 128 ; 緑
mes strf(" 現金誤差%10d円 ", o_sum - d_total)
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = unit_x : lay_iy = unit_y
lay_nx = 1 : lay_ny = 2
objsize lay_sx, lay_sy
; オブジェクトフォントサイズ
font msgothic, unit_y * 9, 5
objmode 2
pos lay_px(0), lay_py(1)
button gosub "完了", *mode_4_2_1_error
objskip stat, 3
; オブジェクトフォントサイズ
font msgothic, unit_y * 9
objmode 2
pos lay_px(0), lay_py(0)
button gosub "戻る", *mode_4_2_back
return
*mode_4_3 ; 返金取消選択画面
clr 0 ; 画面クリア(オブジェクト含む)
// 受注用リストビュー設置
pos unit_x * 6, unit_y * 6
winobj "SysListView32", "", $200, $50000001, unit_x * 75, ginfo_winy - unit_y * 18
hList = objinfo_hwnd(stat)
sendmsg hList, $1036, , $1 | $20 ; 拡張スタイル(LVM_SETEXTENDEDLISTVIEWSTYLE)
sendmsg hList, $30, hFont.1, 0 ; フォント変更(WM_SETFONT)
syscolor 16
sendmsg hList, $1026, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16)
sendmsg hList, $1001, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16)
color 0, 0, 0
ImmAssociateContext hList, 0 ; IME無効
; カラム追加
temp_s = "会計時間"
LVCOLUMS = $F, 0, unit_x * 67, varptr(temp_s), 0, 0
sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
// 戻る&選択ボタン
; オブジェクトフォントサイズ
font msgothic, unit_y * 9
objmode 2
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = unit_x : lay_iy = unit_y
lay_nx = 1 : lay_ny = 2
objsize lay_sx, lay_sy
pos lay_px(0), lay_py(0)
button gosub "戻る", *mode_4
font msgothic, unit_y * 9, 5
objmode 2
pos lay_px(0), lay_py(1)
button gosub "選択", *mode_4_3_2
dirlist r_list, "refund\\" + f_date + "\\**-**-**.csv", 3
repeat stat
temp_s = strmid(r_list, cnt * 14, 8) ; ファイル名取り出し(拡張子 + 改行コード抜き)
strrep temp_s, "-", ":"
; アイテム追加
LVCOLUMS = $1, 0, 0, 0, 0, varptr(temp_s)
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_SETITEM
loop
noteunsel
return
*mode_4_3_2 ; 取消返金データ表示画面
; 選択アイテム取得
sendmsg hList, $100C, -1, $2 ; LVM_GETNEXTITEM LVNI_SELECTED
if stat = -1 : return
temp_i = stat
clrobj 1, 2 ; ボタンだけ削除
sendmsg hList, $1009 ; LVM_DELETEALLITEMS
; カラム追加
temp_s = "商品名"
LVCOLUMS = $F, 0, unit_x * 55, varptr(temp_s), 0, 0
sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
temp_s = "個"
LVCOLUMS = $F, 1, unit_x * 12, varptr(temp_s), 0, 0
sendmsg hList, $101B, 1, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
sendmsg hList, $101C, 2 ; 時間カラムを削除(LVM_DELETECOLUMN)
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = unit_x : lay_iy = unit_y
lay_nx = 1 : lay_ny = 2
objsize lay_sx, lay_sy
font msgothic, unit_y * 9
objmode 2
pos lay_px(0), lay_py(0)
button gosub "戻る", *mode_4_3
font msgothic, unit_y * 9, 5
objmode 2
pos lay_px(0), lay_py(1)
button gosub "返金取消", *mode_4_3_2_cancel
; 販売実績データ一覧から選択されたファイルを取得
notesel r_list
noteget temp_s, notemax - temp_i - 1
noteunsel
r_path = f_date + "\\" + temp_s ; 販売実績ファイルパス代入
; 選択された販売実績データをバッファにロード
notesel h_buf
noteload "refund\\" + r_path
if notemax = 0 {
dialog "選択された返金履歴データは読み込めません。", 1, titl
noteunsel ; バッファ復帰
gosub *mode_4_3
return
}
; 商品一覧表示
repeat notemax - 2, 2
temp_s = GetCSV(cnt, 0) ; 商品ID取得
p_index = -1
repeat p_num ; 商品データから検索
if temp_s = p_id(cnt) : p_index = cnt : break
loop
sendmsg hList, $1004 ; LVM_GETITEMCOUNT
temp_i = stat
if p_index >= 0 { ; 商品データから見つかった
; 商品名項目追加
LVCOLUMS = $1, temp_i, 0, 0, 0, varptr(p_name(p_index))
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_INSERTITEM
} else {
repeat rp_num ; 削除済み商品データから検索
if temp_s = rp_id(cnt) : p_index = cnt : break
loop
if p_index >= 0 { ; 削除済み商品データから見つかった
; 商品名項目追加
LVCOLUMS = $1, temp_i, 0, 0, 0, varptr(rp_name(p_index))
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_INSERTITEM
} else {
; 商品名項目追加
temp_s = "不明な商品(ID:" + temp_s + ")"
LVCOLUMS = $1, temp_i, 0, 0, 0, varptr(temp_s)
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_INSERTITEM
}
}
; 売上数項目追加
temp_s = GetCSV(cnt, 1)
LVCOLUMS = $1, temp_i, 1, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
loop
; 売上金額表示
SelectObject hdc, hFont.0 ; フォントを選択
color 255 ; 赤
mes strf("\n返金額\n%11d円", int(GetCSV(0, 1)))
noteunsel ; バッファ復帰
return
*mode_4_4 ; 商品登録画面
clr 0 ; 画面クリア(オブジェクト含む)
getini "system", "pdcount", s_pdcount
; 商品追加入力ボックス
font msgothic, unit_y * 5, 1
objmode 2
pos unit_x * 6, unit_y * 6
mes "商品名"
input a_name, unit_x * 72, unit_y * 6
pos ginfo_cx + unit_x * 72, unit_y * 6
mes "単価"
input a_value, unit_x * 24, unit_y * 6
hInput = objinfo_hwnd(stat)
SetWindowLong hInput, -16, $50010080 | $2 ; 右揃え
ImmAssociateContext hInput, 0 ; IME無効
pos ginfo_cx + unit_x * 24, unit_y * 11
objsize unit_x * 20, unit_y * 6
button gosub "追加", *mode_4_4_add
; 商品データ一覧リストビュー
pos unit_x * 6, unit_y * 18
winobj "SysListView32", "", $200, $50000001, ginfo_winx - unit_x * 12, ginfo_winy - unit_y * 30
hList = objinfo_hwnd(stat)
sendmsg hList, $1036, , $1 | $20 ; 拡張スタイル(LVM_SETEXTENDEDLISTVIEWSTYLE)
sendmsg hList, $30, hFont.1, 0 ; フォント変更(WM_SETFONT)
syscolor 16
sendmsg hList, $1001, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16) ; 背景色変更(LVM_SETBKCOLOR)
sendmsg hList, $1026, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16) ; テキスト背景色変更(LVM_SETTEXTBKCOLOR)
color 0, 0, 0
ImmAssociateContext hList, 0 ; IME無効
objsize (ginfo_winx - unit_x * 12) / 4, unit_y * 6
lay_x = (ginfo_winx - unit_x * 12) / 4
lay_y = ginfo_cy
; 商品データ一覧操作ボタン
button gosub "削除", *mode_4_4_delete
pos unit_x * 6 + lay_x, lay_y
button gosub "上へ", *mode_4_4_up
pos unit_x * 6 + lay_x * 2, lay_y
button gosub "下へ", *mode_4_4_down
font msgothic, unit_y * 5, 5
objmode 2
pos unit_x * 6 + lay_x * 3, lay_y
button gosub "完了", *mode_4_4_reflect
; カラム追加
temp_s = "商品ID"
LVCOLUMS = $F, 1, unit_x * 24, varptr(temp_s), 0, 0
sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
temp_s = "商品名"
LVCOLUMS = $F, 0, unit_x * 64, varptr(temp_s), 0, 0
sendmsg hList, $101B, 1, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
temp_s = "単価"
LVCOLUMS = $F, 1, unit_x * 12, varptr(temp_s), 0, 0
sendmsg hList, $101B, 2, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN
; アイテム追加
repeat p_num
; 商品ID
temp_s = p_ID(cnt)
LVCOLUMS = $1, cnt, 0, 0, 0, varptr(temp_s)
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_INSERTITEM
; 商品名
temp_s = p_name(cnt)
LVCOLUMS = $1, cnt, 1, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
; 単価
temp_s = str(p_value(cnt))
LVCOLUMS = $1, cnt, 2, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
loop
return
*mode_4_5 ; 管理その他
clr 0 ; 画面クリア(オブジェクト含む)
; 画面レイアウト設定
lay_x = 0 : lay_y = 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy
lay_ox = unit_x * 12 : lay_oy = unit_y * 12
lay_ix = unit_x * 4 : lay_iy = unit_y * 4
lay_nx = 1 : lay_ny = 3
; オブジェクトフォントサイズ
font msgothic, unit_y * 12
objmode 2
objsize lay_sx, lay_sy
pos lay_px(0), lay_py(0)
button gosub "パスワード変更", *mode_4_5_1
pos lay_px(0), lay_py(1)
button gosub "各種初期化", *mode_4_5_2
pos lay_px(0), lay_py(2)
button gosub "戻る", *mode_4
return
*mode_4_5_1 ; パスワード変更画面
clr 0 ; 画面クリア(オブジェクト含む)
pos unit_x * 6, unit_y * 6
font msgothic, unit_y * 6
mes "パスワード変更"
color 255 ; 赤
mes "\n現在のパスワード:" + s_password
color , , 255 ; 青
mes "\n新しいパスワード:"
objmode 2
pos ginfo_cx + ginfo_mesx, ginfo_cy - unit_y * 6
input e_newpass, unit_y * 14, unit_y * 7, 4
hInput = objinfo_hwnd(stat)
sendmsg hInput, $CC, '*' ; EM_SETPASSWORDCHAR
SetWindowLong hInput, -16, $50010080 | $2000 ; 数字のみ
ImmAssociateContext hInput, 0 ; IME無効
font msgothic, unit_y * 3
color
pos unit_x * 6
mes "\n※ 4桁の数字のみ使用できます。\n※ 0000はパスワード無しになります。"
// 戻る&変更ボタン
; オブジェクトフォントサイズ
font msgothic, unit_y * 9, 1
objmode 2
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = unit_x : lay_iy = unit_y
lay_nx = 1 : lay_ny = 2
objsize lay_sx, lay_sy
pos lay_px(0), lay_py(0)
button gosub "戻る", *mode_4_5
pos lay_px(0), lay_py(1)
button gosub "変更", *mode_4_5_1_change
return
*mode_4_5_2 ; 各種初期化画面
clr 0 ; 画面クリア(オブジェクト含む)
; 初期化フラグ初期化
dim i_today
dim i_ex
dim i_total
dim i_pd
font msgothic, unit_y * 4, 1
pos unit_x * 6, unit_y * 6
color 255 ; 赤
mes "初期化する項目を選択してください。\n"
font msgothic, unit_y * 6
objmode 2
objsize unit_x * 75, unit_y * 6, unit_y * 8
chkbox "本日分の販売データ", i_today
objenable stat, s_opened + (s_last = s_today) ; 本日開店していなければ無効
chkbox "本日分以外の販売データ", i_ex
chkbox "累計販売データ", i_total
chkbox "商品データ", i_pd
button gosub "全てのデータ", *mode_4_5_2_all
hButton = objinfo_hwnd(stat)
sendmsg hButton, $F4, $3
// 戻る&初期化ボタン
; オブジェクトフォントサイズ
font msgothic, unit_y * 9, 1
objmode 2
; 画面レイアウト設定
lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0
lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2
lay_ox = unit_x * 6 : lay_oy = unit_y * 6
lay_ix = unit_x : lay_iy = unit_y
lay_nx = 1 : lay_ny = 2
objsize lay_sx, lay_sy
pos lay_px(0), lay_py(0)
button gosub "戻る", *mode_4_5
pos lay_px(0), lay_py(1)
button gosub "初期化", *mode_4_5_2_init
return
///////////////// その他の処理 /////////////////
*o_open ; 開店処理
dialog "入力された釣銭準備金額は" + o_sum + "円です。\n開店しますか。", 2, titl
if stat = 7 : return
oncmd gosub *dummy, $111 ; 入力割り込み無効
; 販売データ作成
d_buf = s_today + "\n釣銭準備金額," + o_sum + "\n\n会計回数,0\n売上金額,0\n\n返金回数,0\n返金額,0\n\n理論存高," + o_sum + "\n現金存高,0\n現金誤差,0\n\n商品ID,売上数,返品数\n"
repeat p_num
d_buf += p_id(cnt) + ",0,0\n"
loop
notesel d_buf ; 販売実績データを対象バッファに指定(デフォルト)
notesave "daily\\" + f_date + ".csv"
noteunsel
; 営業日数加算
notesel d_buf_total
WriteCSV 0, 1, str(int(GetCSV(0, 1)) + 1)
notesave "total.csv"
; 開店フラグ書き込み
s_opened = 1
writeini "system", "opened", s_opened
; 開店日書き込み
s_last = s_today
writeini "system", "last", s_last
; 販売履歴ディレクトリ
dirlist temp_s, "history\\" + f_date, 5
if stat = 0 : mkdir "history\\" + f_date
; 返金履歴ディレクトリ
dirlist temp_s, "refund\\" + f_date, 5
if stat = 0 : mkdir "refund\\" + f_date
; 毎時売上ファイル作成
u_buf = "時間,会計数,売上金額\n"
repeat 24
u_buf += strf("%02d,0,0\n", cnt)
loop
notesel u_buf
notesave "hourly\\" + f_date + ".csv"
noteunsel
gosub *mode_4 ; メインメニューにジャンプ
return
*o_close ; 閉店処理
o_error = o_sum - d_total ; 現金誤差算出
if o_error { ; 現金誤差あり
dialog "現金誤差が" + o_error + "円発生しています。\n閉店処理を確定しますか。", 3, titl
} else { ; 現金誤差なし
dialog "閉店処理を確定しますか。", 2, titl
}
if stat = 7 : return ; いいえ
; 現金誤差書き込み
notesel d_buf
WriteCSV 10, 1, str(o_sum) ; 現金在高
WriteCSV 11, 1, str(o_error) ; 現金誤差
notesave "daily\\" + f_date + ".csv"
noteunsel
notesel d_buf_total
WriteCSV 8, 1, str(int(GetCSV(8, 1)) + o_error)
notesave "total.csv"
noteunsel
; 開店フラグ書き込み
s_opened = 0
writeini "system", "opened", s_opened
gosub *mode_4
return
*o_change
o_input ^ 1 ; 0,1反転
if o_input { ; o_input = 1のとき
oncmd gosub *dummy, $111 ; WM_COMMAND無効化
repeat 9 + s_opened
sendmsg hInput.cnt, $CF, 1 ; 枚数入力ボックス無効化
objprm cnt, 0 ; 枚数リセット
objskip cnt, 7 ; フォーカススキップ
loop
sendmsg hInput(9 + s_opened), $CF, 0 ; 釣銭合計入力ボックス有効化
o_focus = 9 + s_opened
objsel o_focus ; フォーカス指定
objskip o_focus, 5 ; フォーカススキップ無効
} else { ; o_input = 0のとき
sendmsg hInput(9 + s_opened), $CF, 1 ; 釣銭合計入力ボックス無効化
objskip 9 + s_opened, 7 ; フォーカススキップ
repeat 9 + s_opened
sendmsg hInput.cnt, $CF, 0 ; 枚数入力ボックス有効化
objskip cnt, 5 ; フォーカススキップ無効
loop
oncmd gosub *o_command, $111 ; WM_COMMAND有効化
o_focus = 0
objsel o_focus ; フォーカス指定
}
return
*o_command ; 開閉店処理の入力処理
repeat 9 + s_opened
if lParam = hInput.cnt {
o_focus = cnt ; フォーカスされたオブジェクトID代入
; 釣銭合計反映
o_sum = 0
repeat 10
o_sum += o_amount(cnt) * o_num(cnt)
loop
objprm 9 + s_opened, o_sum ; オブジェクトに描画
}
loop
return
*o_tenkey ; 開閉店処理のテンキー処理
temp_i = stat - tkey_clr_ID ; オブジェクトIDからテンキーのボタンを特定
objsel o_focus
if temp_i { ; テンキー入力をキーコードに変換
if o_focus < 9 + s_opened {
if o_num(o_focus + 1 - s_opened) > 0 : keybd_event 39, 0, 0, 0 ; →キー
} else {
if o_sum > 0 : keybd_event 39, 0, 0, 0 ; →キー
}
keybd_event temp_i + 47, 0, 0, 0 ; 0~9
} else {
keybd_event 48, 0, 0, 0 ; 0
}
return
*load_pd ; 商品データ読み込み
// 商品データ読み込み
; 変数確保(p_num非依存)
sdim p_buf, 4096 ; 商品データファイル用バッファ
dim p_num ; 商品登録数
; 商品データをバッファに展開
notesel p_buf
noteload "pd.csv"
; 無限ループ防止
if notemax = 0 {
dialog "商品データファイル(pd.csv)が読み込めません。\nアプリケーションを終了してから、手動で修復するか、ファイルを削除してください。", 1, titl
noteunsel ; バッファ復帰
return
}
; CSVデータ読み込み
p_num = notemax - 1
; 変数確保(p_num依存)
sdim p_id, p_num ; 商品ID
sdim p_name, , p_num ; 商品名
dim p_value, p_num ; 商品価格
repeat p_num ; カラムを無視
noteget temp_s, cnt + 1 ; 行を取り出し
split temp_s, ",", p_id(cnt), p_name(cnt), temp_s ; 分割(ID, 商品名, 単価)
p_value(cnt) = int(temp_s) ; 単価をint型に変換
loop
noteunsel ; バッファ復帰
// 削除済み商品データ読み込み
; 変数確保(p_num非依存)
sdim rp_buf, 4096 ; 商品データファイル用バッファ
dim rp_num ; 商品登録数
; 商品データをバッファに展開
notesel rp_buf
noteload "rpd.csv"
; 無限ループ防止
if notemax = 0 {
dialog "削除済み商品データファイル(rpd.csv)が読み込めません。\nアプリケーションを終了してから、手動で修復するか、ファイルを削除してください。", 1, titl
noteunsel ; バッファ復帰
return
}
; CSVデータ読み込み
rp_num = notemax - 1
; 変数確保(p_num依存)
sdim rp_id, rp_num ; 商品ID
sdim rp_name, , rp_num ; 商品名
dim rp_value, rp_num ; 商品価格
repeat rp_num ; カラムを無視
noteget temp_s, cnt + 1 ; 行を取り出し
split temp_s, ",", rp_id(cnt), rp_name(cnt), temp_s ; 分割(ID, 商品名, 単価)
rp_value(cnt) = int(temp_s) ; 単価をint型に変換
loop
noteunsel ; バッファ復帰
return
*aggregate ; 販売実績集計
if s_last ! s_today : return ; 今日開店していない場合
clr 0 ; 画面クリア(オブジェクト含む)
SelectObject hdc, hFont.0
pos 0, 0
mes "販売データ集計中..."
return
// sub_1
*sub_1_OK
if input_pw ! s_password {
dialog "パスワードが間違っています。", 0, titl
objsel 0
return
}
onkey 0
HideSubWindow 1
gosub *mode_4
return
*sub_1_cancel
onkey 0
HideSubWindow 1
return
// mode_1
*mode_1_cancel ; mode_1から会計取消
if c_anum {
dialog "会計内容をすべて取り消しますか?", 2, titl
if stat = 7 : return
}
gosub *mode_0
return
*mode_1_tenkey ; mode_1 and mode_1_1テンキーのジャンプ先
temp_i = stat - tkey_clr_ID ; オブジェクトIDからテンキーのボタンを特定
objsel 0 ; フォーカスをリストビューに戻す
if temp_i { ; テンキー入力をキーコードに変換
keybd_event temp_i + 47, 0, 0, 0 ; 0~9
} else {
keybd_event 46, 0, 0, 0 ; Delete
}
return
*mode_1_key_event ; mode_1でのキーイベント
; 選択アイテム取得
sendmsg hList, $100C, -1, $2 ; LVM_GETNEXTITEM LVNI_SELECTED
if stat = -1 : return
temp_i = stat ; 選択アイテムのINDEX
; キーコードを数字に変換
if wParam >= 48 & wParam <= 57 { ; 通常数字キー
c_num(temp_i) = c_num(temp_i) * 10 + wParam - 48
} elseif wParam >= 96 and wParam <= 105 { ; テンキー
c_num(temp_i) = c_num(temp_i) * 10 + wParam - 96
} elseif wParam = 8 | wParam = 46 { ; BSとDEL
c_num(temp_i) = 0
} else {
return
}
; 選択商品の数量をリストビューに反映
temp_s = str(c_num(temp_i))
LVCOLUMS = $1, temp_i, 2, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
; 小計を計算
c_total = 0 : c_anum = 0
repeat p_num
c_anum += c_num(cnt)
c_total += p_value(cnt) * c_num(cnt)
loop
; 小計表示を更新
clr 2, lay_mpx, lay_mpy, lay_mpx + lay_msx, lay_mpy + lay_msy
SelectObject hdc, hFont.0
pos lay_mpx, lay_mpy
mes strf("小計%8d円", c_total)
return
*mode_1_1_key_event ; mode_1_1でのキーイベント
; キーコードを数字に変換
if wParam >= 48 & wParam <= 57 { ; 通常数字キー
temp_i = wParam - 48
c_depoint = c_depoint * 10 + temp_i
} elseif wParam >= 96 and wParam <= 105 { ; テンキー
temp_i = wParam - 96
c_depoint = c_depoint * 10 + temp_i
} elseif wParam = 8 | wParam = 46 { ; BSとDEL
c_depoint = 0
} else {
return
}
/*mode_1_1_exactly2 ; 丁度預かり*/
clr 2, lay_mpx, lay_mpy, lay_mpx + lay_msx, lay_mpy + lay_msy
SelectObject hdc, hFont.0
color 255, 0, 0
pos lay_mpx, lay_mpy
mes strf(" お預り%8d円 ", c_depoint)
color 0, 0, 0
return
*mode_1_1_confirm
if c_depoint < c_total {
dialog "預り金が不足しています。\nもう一度入力してください。", 0, titl
return
}
if c_change {; 会計確定処理
; テンキー&変更ボタン無効化
onkey 0
objenable 1, 0 ; 変更ボタン
repeat 11
objenable tkey_clr_ID + cnt, 0 ; テンキー
loop
objprm 2, "終了"
; お釣り描画
SelectObject hdc, hFont.0
color 0, 0, 255
pos lay_mpx, lay_mpy + lay_msy * 2
mes strf(" お釣り%8d円 ", c_depoint - c_total)
color 0, 0, 0
c_change = 0
return
}
// 会計終了処理
; 累計販売実績データ更新
notesel d_buf_total
WriteCSV 2, 1, str(int(GetCSV(2, 1)) + 1) ; 会計回数
WriteCSV 3, 1, str(int(GetCSV(3, 1)) + c_total) ; 売上金額
repeat p_num
if c_num(cnt) = 0 : continue ; 数量0はスキップ
SearchCSV 11, 0, p_id(cnt) ; 商品ID検索
if stat = -1 {
d_buf_total += p_id(cnt) + "," + c_num(cnt) + ",0\n" ; 商品データを新たに追加
} else {
WriteCSV stat, 1, str(int(GetCSV(stat, 1)) + c_num(cnt)) ; 売上数上書き
}
loop
notesave "total.csv"
noteunsel ; バッファ復帰
; 毎時売上更新
notesel u_buf
WriteCSV gettime(4) + 1, 1, str(int(GetCSV(gettime(4) + 1, 1)) + 1) ; 会計数
WriteCSV gettime(4) + 1, 2, str(int(GetCSV(gettime(4) + 1, 2)) + c_total) ; 売上
notesave "hourly\\" + f_date + ".csv"
noteunsel
; 各販売データ更新
notesel d_buf
WriteCSV 3, 1, str(int(GetCSV(3, 1)) + 1) ; 会計回数
WriteCSV 4, 1, str(int(GetCSV(4, 1)) + c_total) ; 売上金額
WriteCSV 9, 1, str(int(GetCSV(9, 1)) + c_total) ; 現金
; 販売データ処理
h_buf = "売上金額," + c_total + "\n商品ID,売上数\n" ; 商品履歴データバッファ初期化(カラム)
repeat p_num
if c_num(cnt) = 0 : continue ; 数量0はスキップ
; 販売履歴データ作成
h_buf += p_id(cnt) + "," + c_num(cnt) + "\n"
; 販売データ書き込み
SearchCSV 14, 0, p_id(cnt) ; 商品ID検索
if stat = -1 {
d_buf += p_id(cnt) + "," + c_num(cnt) + ",0\n" ; 商品データを新たに追加
} else {
WriteCSV stat, 1, str(int(GetCSV(stat, 1)) + c_num(cnt)) ; 売上数上書き
}
loop
notesave "daily\\" + f_date + ".csv" ; 販売データ保存
noteunsel
notesel h_buf ; 対象バッファを販売履歴データに変更
notesave "history\\" + f_date + "\\" + strf("%02d-%02d-%02d", gettime(4), gettime(5), gettime(6)) + ".csv" ; 販売履歴データ保存
noteunsel
gosub *mode_0 ; メインメニュー
return
*mode_3_1_refund ; 返金処理
dialog "表示された内容の返金処理を行いますか。", 2, titl
if stat = 7 : return ; いいえ
notesel h_buf ; 販売履歴データ再指定
; 販売履歴データ取得
r_total = int(GetCSV(0, 1))
r_pnum = notemax - 2 ; ループ回数
repeat r_pnum
r_ID(cnt) = GetCSV(cnt + 2, 0) ; 商品ID取得
r_num(cnt) = int(GetCSV(cnt + 2, 1)) ; 売上数取得
loop
noteunsel ; バッファ復帰
; 販売データに反映
notesel d_buf
WriteCSV 3, 1, str(int(GetCSV(3, 1)) - 1) ; 会計回数
WriteCSV 4, 1, str(int(GetCSV(4, 1)) - r_total) ; 売上金額
WriteCSV 6, 1, str(int(GetCSV(6, 1)) + 1) ; 返金回数
WriteCSV 7, 1, str(int(GetCSV(7, 1)) + r_total) ; 返金額
WriteCSV 9, 1, str(int(GetCSV(9, 1)) - r_total) ; 現金
repeat r_pnum
SearchCSV 14, 0, r_ID(cnt) ; 商品ID検索
temp_i = stat
WriteCSV temp_i, 1, str(int(GetCSV(temp_i, 1)) - r_num(cnt)) ; 売上数
WriteCSV temp_i, 2, str(int(GetCSV(temp_i, 2)) + r_num(cnt)) ; 返品数
loop
notesave "daily\\" + f_date + ".csv" ; 販売データ保存
noteunsel
; 毎時売上データに反映
temp_i = int(getpath(r_path, 9)) + 1
notesel u_buf
WriteCSV temp_i, 1, str(int(GetCSV(temp_i, 1)) - 1) ; 会計数
WriteCSV temp_i, 2, str(int(GetCSV(temp_i, 2)) - r_total) ; 売上
notesave "hourly\\" + f_date + ".csv" ; 保存
noteunsel
; 累計販売データに反映
notesel d_buf_total
WriteCSV 2, 1, str(int(GetCSV(2, 1)) - 1) ; 会計回数
WriteCSV 3, 1, str(int(GetCSV(3, 1)) - r_total) ; 売上金額
WriteCSV 5, 1, str(int(GetCSV(5, 1)) + 1) ; 返金回数
WriteCSV 6, 1, str(int(GetCSV(6, 1)) + r_total) ; 返金額
repeat r_pnum
SearchCSV 9, 0, r_ID(cnt) ; 商品ID検索
temp_i = stat
WriteCSV temp_i, 1, str(int(GetCSV(temp_i, 1)) - r_num(cnt)) ; 売上数
WriteCSV temp_i, 2, str(int(GetCSV(temp_i, 2)) + r_num(cnt)) ; 返品数
loop
notesave "total.csv" ; 累計販売データ保存
noteunsel
; 返金データ保存(ファイル移動)
bcopy "history\\" + r_path, "refund\\" + r_path ; ファイルをコピー
delete "history\\" + r_path ; 元のファイルを削除
gosub *mode_3_back
return
*mode_4_2_1_error
o_error = o_sum - d_total ; 現金誤差算出
if o_error {
dialog "現金誤差が" + o_error + "円発生しています。", 1, titl
}
; 現金誤差書き込み
notesel d_buf
WriteCSV 11, 1, str(o_sum - d_total)
notesave "daily\\" + f_date + ".csv"
noteunsel
notesel d_buf_total
WriteCSV 8, 1, str(int(GetCSV(8, 1)) + o_sum - d_total)
notesave "total.csv"
noteunsel
gosub *mode_4
return
*mode_4_3_2_cancel
dialog "表示された内容の返金取消を行いますか。", 2, titl
if stat = 7 : return ; いいえ
notesel h_buf ; 販売履歴データ再指定
; 販売履歴データ取得
r_total = int(GetCSV(0, 1))
r_pnum = notemax - 2 ; ループ回数
repeat r_pnum
r_ID(cnt) = GetCSV(cnt + 2, 0) ; 商品ID取得
r_num(cnt) = int(GetCSV(cnt + 2, 1)) ; 売上数取得
loop
noteunsel ; バッファ復帰
; 販売データに反映
notesel d_buf
WriteCSV 3, 1, str(int(GetCSV(3, 1)) + 1) ; 会計回数
WriteCSV 4, 1, str(int(GetCSV(4, 1)) + r_total) ; 売上金額
WriteCSV 6, 1, str(int(GetCSV(6, 1)) - 1) ; 返金回数
WriteCSV 7, 1, str(int(GetCSV(7, 1)) - r_total) ; 返金額
WriteCSV 9, 1, str(int(GetCSV(9, 1)) + r_total) ; 現金
repeat r_pnum
SearchCSV 14, 0, r_ID(cnt) ; 商品ID検索
temp_i = stat
WriteCSV temp_i, 1, str(int(GetCSV(temp_i, 1)) + r_num(cnt)) ; 売上数
WriteCSV temp_i, 2, str(int(GetCSV(temp_i, 2)) - r_num(cnt)) ; 返品数
loop
notesave "daily\\" + f_date + ".csv" ; 販売データ保存
noteunsel
; 毎時売上データに反映
temp_i = int(getpath(r_path, 9)) + 1
notesel u_buf
WriteCSV temp_i, 1, str(int(GetCSV(temp_i, 1)) + 1) ; 会計数
WriteCSV temp_i, 2, str(int(GetCSV(temp_i, 2)) + r_total) ; 売上
notesave "hourly\\" + f_date + ".csv" ; 保存
noteunsel
; 累計販売データに反映
notesel d_buf_total
WriteCSV 2, 1, str(int(GetCSV(2, 1)) + 1) ; 会計回数
WriteCSV 3, 1, str(int(GetCSV(3, 1)) + r_total) ; 売上金額
WriteCSV 5, 1, str(int(GetCSV(5, 1)) - 1) ; 返金回数
WriteCSV 6, 1, str(int(GetCSV(6, 1)) - r_total) ; 返金額
repeat r_pnum
SearchCSV 9, 0, r_ID(cnt) ; 商品ID検索
temp_i = stat
WriteCSV temp_i, 1, str(int(GetCSV(temp_i, 1)) + r_num(cnt)) ; 売上数
WriteCSV temp_i, 2, str(int(GetCSV(temp_i, 2)) - r_num(cnt)) ; 返品数
loop
notesave "total.csv" ; 累計販売データ保存
noteunsel
; 返金データ保存(ファイル移動)
bcopy "refund\\" + r_path, "history\\" + r_path ; ファイルをコピー
delete "refund\\" + r_path ; 元のファイルを削除
gosub *mode_4_3
return
*mode_4_4_add ; mode_4_4の追加
if a_name = "" or a_value = 0 {
dialog "商品名か単価に問題があります。", 1, titl
return
}
notesel p_buf
repeat ; 商品IDが被らないように
SearchCSV 1, 0, strf("%08X", s_pdcount)
if stat ! -1 : s_pdcount++ : else : break
loop
noteadd strf("%08X", s_pdcount) + "," + a_name + "," + a_value, -1, 0 ; 商品データ書き込み
noteunsel
s_pdcount++
; リストビューに反映
; アイテム数取得
sendmsg hList, $1004 ; LVM_GETITEMCOUNT
temp_i = stat
; 商品ID
temp_s = strf("%08X", s_pdcount)
LVCOLUMS = $1, temp_i, 0, 2, 2, varptr(temp_s)
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_INSERTITEM
; 商品名
LVCOLUMS = $1, temp_i, 1, 0, 0, varptr(a_name)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
; 単価
temp_s = str(a_value)
LVCOLUMS = $1, temp_i, 2, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
objprm 0, ""
objprm 1, 0
return
*mode_4_4_delete ; mode_4_4の削除
; 選択アイテム取得
sendmsg hList, $100C, -1, $2 ; LVM_GETNEXTITEM LVNI_SELECTED
if stat = -1 : return
temp_i = stat ; 選択アイテムのINDEX
; 商品データ削除
notesel p_buf
noteget temp_s, temp_i + 1 ; 商品データ取得
notedel temp_i + 1 ; 商品データ削除
noteunsel
; 削除済み商品データ登録
notesel rp_buf
noteadd temp_s, -1, 0
noteunsel
; リストビューに反映
sendmsg hList, $1008, temp_i ; LVM_DELETEITEM
return
*mode_4_4_up ; mode_4_4の上へ
objsel 3 ; フォーカスを戻す
; 選択アイテム取得
sendmsg hList, $100C, -1, $2 ; LVM_GETNEXTITEM LVNI_SELECTED
if stat <= 0 : return ; 最上部
temp_i = stat ; 選択アイテムのINDEX
; 商品データ上へ移動
notesel p_buf
noteget temp_s, temp_i + 1
notedel temp_i + 1
noteadd temp_s, temp_i, 0
; リストビューに反映
sendmsg hList, $1008, temp_i ; LVM_DELETEITEM
; 商品ID
temp_s = GetCSV(temp_i, 0)
LVCOLUMS = $1 | $8, temp_i - 1, 0, 2, 2, varptr(temp_s)
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_INSERTITEM
; 商品名
temp_s = GetCSV(temp_i, 1)
LVCOLUMS = $1, temp_i - 1, 1, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
; 単価
temp_s = GetCSV(temp_i, 2)
LVCOLUMS = $1, temp_i - 1, 2, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
noteunsel
return
*mode_4_4_down ; mode_4_4の下へ
objsel 3 ; フォーカスを戻す
; 選択アイテム取得
sendmsg hList, $100C, -1, $2 ; LVM_GETNEXTITEM LVNI_SELECTED
if stat = -1 : return
temp_i = stat ; 選択アイテムのINDEX
; アイテム数取得
sendmsg hList, $1004 ; LVM_GETITEMCOUNT
if stat <= temp_i + 1 : return ; 最下部
; 商品データ下へ移動
notesel p_buf
noteget temp_s, temp_i + 1
notedel temp_i + 1
noteadd temp_s, temp_i + 2, 0
; リストビューに反映
sendmsg hList, $1008, temp_i ; LVM_DELETEITEM
; 商品ID
temp_s = GetCSV(temp_i + 2, 0)
LVCOLUMS = $1 | $8, temp_i + 1, 0, 2, 2, varptr(temp_s)
sendmsg hList, $1007, 0, varptr(LVCOLUMS) ; LVM_INSERTITEM
; 商品名
temp_s = GetCSV(temp_i + 2, 1)
LVCOLUMS = $1, temp_i + 1, 1, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
; 単価
temp_s = GetCSV(temp_i + 2, 2)
LVCOLUMS = $1, temp_i + 1, 2, 0, 0, varptr(temp_s)
sendmsg hList, $1006, 0, varptr(LVCOLUMS) ; LVM_SETITEM
return
*mode_4_4_reflect ; mode_4_4の完了
writeini "system", "pdcount", s_pdcount ; 商品IDカウンター読み込み
; 商品データ反映
notesel p_buf
notesave "pd.csv"
noteunsel
notesel rp_buf
notesave "rpd.csv"
noteunsel
gosub *load_pd
gosub *mode_4
return
*mode_4_5_1_change ; パスワード変更
dialog "パスワードを変更しますか。", 2, titl
if stat = 7 : return ; いいえ
; 変更を書き込み
s_password = e_newpass
writeini "system", "pass", s_password
e_newpass = ""
gosub *mode_4_5
return
*mode_4_5_2_all ; 全て初期化を選択
sendmsg hButton, $F0 ; チェック確認
if stat {
repeat 4 - (1 - ( s_last = s_today)), 1 - (s_last = s_today)
objenable cnt, 0 ; 無効化
objprm cnt, 1 ; すべてチェック
loop
} else {
repeat 4 - (1 - (s_last = s_today)), 1 - (s_last = s_today)
objenable cnt, 1 ; 有効化
loop
}
return
*mode_4_5_2_init ; 初期化処理
if i_today + i_ex + i_total + i_pd = 0 {
dialog "初期化する項目が選択されていません。", 1, titl
return
}
dialog "初期化したデータは元に戻せません。\n選択項目の初期化を実行しますか。\n(初期化後はソフトが再起動します。)", 3, titl
if stat = 7 : return ; いいえ
if i_today and s_last = s_today { ; 本日分
delete "daily\\" + f_date + ".csv"
delete "hourly\\" + f_date + ".csv"
deletef dir_cur + "\\history\\" + f_date
deletef dir_cur + "\\refund\\" + f_date
; 開店フラグ書き込み
s_opened = 0
writeini "system", "opened", s_opened
; 最終営業日書き換え
temp_s = ""
writeini "system", "last", temp_s
}
if i_ex { ; 本日分以外
notesel r_list
; 販売データ削除
dirlist r_list, "daily\\****-**-**.csv", 1
repeat stat
noteget temp_s, cnt
if temp_s = f_date + ".csv" : continue
delete "daily\\" + temp_s
loop
; 毎時売上データ削除
dirlist r_list, "hourly\\****-**-**.csv", 1
repeat stat
noteget temp_s, cnt
if temp_s = f_date + ".csv" : continue
delete "hourly\\" + temp_s
loop
; 販売履歴データ削除
dirlist r_list, "history\\****-**-**", 5
repeat stat
noteget temp_s, cnt
if temp_s = f_date : continue
deletef dir_cur + "\\history\\" + temp_s
loop
; 返金データ削除
dirlist r_list, "refund\\****-**-**", 5
repeat stat
noteget temp_s, cnt
if temp_s = f_date : continue
deletef dir_cur + "\\refund\\" + temp_s
loop
noteunsel
; 最終営業日書き換え
temp_s = ""
writeini "system", "last", temp_s
}
if i_total { ; 累計販売データ
delete "total.csv"
}
if i_pd { ; 商品データ
delete "pd.csv"
delete "rpd.csv"
}
sendmsg hButton, $F0 ; チェック確認
if stat { ; 全て
delete "settings.ini"
deletef dir_cur + "\\daily"
deletef dir_cur + "\\history"
deletef dir_cur + "\\hourly"
deletef dir_cur + "\\refund"
}
; 再起動
GetModuleFileName 0, varptr(temp_s), 260 ; 自分自身のファイルパスを取得
gosub *release
exec "cmd /q /c \"timeout /t 2 /nobreak & start \"\" \"" + temp_s + "\"\"" ; コマンドプロンプトに実行させる
end
return
*s_mini ; ウィンドウ最小化
sendmsg hwnd, $112, $F020 ; SC_MINIMIZE
return
*sub_1_key_event ; パスワード入力ボックスのキーイベントを処理
if wParam = 13 : gosub *sub_1_OK
return
*dummy ; ダミー(なにもおこらない)
return
/////////////// エラー・終了処理 ///////////////
*release ; 解放処理
onerror 0
onexit 0
oncmd 0
onkey 0
; ハンドル解放
DeleteObject hFont.0 ; 汎用フォント
DeleteObject hFont.1 ; リストビューフォント
return
*exerror ; 予期せぬエラー
; エラーメッセージ(コンパイル制御)
#ifdef _debug ; デバッグ時
dialog "" + lParam + "行目で、" + wParam + "のエラーです。", 1, titl
#else ; 通常時
dialog "不明なエラーが発生しました。\nお問い合わせの際は、以下の番号をお伝えください。\nエラー番号 : " + wParam, 1, titl
#endif
gosub *release ; 解放処理
end
end
*exit
if wParam ! 0 {
HideSubWindow wParam ; サブウィンドウ非表示
return
}
*exit2
#ifndef _debug ; 通常時
if s_opened {
dialog "閉店処理を行っていません。\nOptOレジ!を終了しますか。", 3, titl
} else {
dialog "OptOレジ!を終了しますか。", 3, titl
}
if stat = 7 : return
#endif
gosub *release ; 解放処理
end
end