#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 : clscolor 128, 255, 255 ; 薄水色if mode = 2 : boxf x1, y1, x2, y2 : else : boxfcolor 0, 0, 0return mode#deffunc HideSubWindow int wID ; サブウィンドウ非表示gsel wID, -1EnableWindow hWnd_main@, 1gsel 0, 1return wID// CSV系関数#deffunc SplitCSV int index, int column ; CSVデータの指定行をカラムごとに分割if index < 0 or column < 0 : return -1 ; インデックスかカラムが負であれば-1; 変数初期化if flag = 0 {sdim tempsdim spl, , 5}flag = 1noteget temp, index ; 指定行取得split temp, ",", spl ; カラムごとに分割return stat#defcfunc GetCSV int index, int column ; CSVデータの指定行指定カラムを返すSplitCSV index, column ; 指定行分割if stat - 1 < column : return "" ; 指定カラムが無ければ-1return spl(column) ; 指定カラムを返す#deffunc WriteCSV int index, int column, str word ; CSVデータの指定行指定カラムを書き換えるSplitCSV index, column ; 指定行分割if stat - 1 < column : return -1 ; 指定カラムが無ければ-1; 上書き用文字列作成spl(column) = wordtemp = spl(0)repeat stat - 1, 1temp += "," + spl(cnt)loopnoteadd temp, index, 1 ; 指定行に上書きreturn#deffunc SearchCSV int index, int column, str word ; CSVデータを検索; 変数初期化result = -1if index < 0 or column < 0 or word = "" : return result ; インデックスかカラムが負、wordがnullなら-1を返す; データ検索repeat notemax - index, indexif GetCSV(cnt, column) = word { ; 内容が一致するかresult = cntbreak}loopreturn result ; 何も見つからなかった場合-1を返す#deffunc deletef str _dir ; ディレクトリ削除sdim pFrom, 260pFrom = _dirdim SHFILEOPSTRUCT, 8SHFILEOPSTRUCT.0 = hWndSHFILEOPSTRUCT.1 = $3 ; FO_DELETESHFILEOPSTRUCT.2 = varptr( pFrom )SHFILEOPSTRUCT.3 = 0SHFILEOPSTRUCT.4 = $4 | $10 | $100 | $400 ; FOF_SILENT | FOF_NOCONFIRMATION | FOF_SIMPLEPROGRESS | FOF_NOERRORUISHFileOperation 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" ; ミューテックス生成GetLastErrorif stat = $B7 { ; ERROR_ALREADY_EXISTSdialog "OptOレジ!は既に起動しています。", 1, titlend}////////////////// 事前処理 ////////////////////*s_start ; 開発時便宜ラベル// メインウィンドウ(コンパイル制御)#ifdef _debug ; デバッグ時screen 0, , : title titl#else ; 通常時bgscr 0, ginfo_dispx, ginfo_dispy, 0, 0, 0 : title titl#endifhWnd_main = hWndtitle 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_snotesave "settings.ini"noteunsel}; 設定ファイル読み込みsetini "settings.ini" ; 設定ファイルを指定sdim s_password ; パスワードgetini "system", "pass", s_passworddim s_opened ; 開店フラグgetini "system", "opened", s_openedsdim s_last ; 前回の開店日getini "system", "last", s_lastexist "pd.csv" ; 商品データファイルtemp_i = strsizeexist "rpd.csv" ; 削除済み商品データファイルif strsize = -1 or temp_i = -1 { ; 一方でも欠けていれば再生成p_buf = "商品ID,商品名,単価\n"notesel p_bufnotesave "pd.csv"notesave "rpd.csv"noteunsels_pdcount = 0writeini "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_numd_buf_total += p_id(cnt) + ",0,0\n"loop; 保存notesel d_buf_totalnotesave "total.csv"noteunsel} else {; 累計販売実績データ読み込みnotesel d_buf_totalnoteload "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, 1tkey_arg(0, 1) = 3, 2, 2, 2, 1, 1, 1, 0, 0, 0, 3dim tkey_clr_ID ; テンキークリアキーのオブジェクトIDdim 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:11dim 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, 1dim 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 * 6mref bmscr, 67CreateFontIndirect varptr(bmscr.49)hFont.0 = stat; リストビュー用(hFont.1)font msgothic, unit_y * 4, 1mref bmscr, 67CreateFontIndirect varptr(bmscr.49)hFont.1 = stat// サブウィンドウ作成; パスワード入力ウィンドウ(sub_1)screen 1, unit_x * 50, unit_y * 20, 6hWnd_sub1 = hWndtitle "パスワード入力"GetWindowLong hWnd_sub1, -16 ; GWL_STYLESetWindowLong hWnd_sub1, -16, stat & ($10000 | $20000 | $40000) ^ stat ; GWL_STYLESetWindowLong hWnd_sub1, -8, hWnd_main ; GWL_HWNDPARENTSetWindowPos hWnd_sub1, 0, 0, 0, 0, 0, $1 | $2 | $4 | $20 ; SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGEDclr 1font msgothic, unit_y * 6 ; フォント選択objmode 2pos unit_x * 2, unit_y * 2input input_pw, ginfo_winx - unit_x * 4, ginfo_winy / 2 - unit_y * 2, 4hInput = objinfo_hwnd(stat)sendmsg hInput, $CC, '*' ; EM_SETPASSWORDCHARSetWindowLong hInput, -16, $50010080 | $2000 ; 数字のみImmAssociateContext hInput, 0 ; IME無効objsize ginfo_winx / 2 - unit_x * 2, ginfo_winy / 2 - unit_y * 2button gosub "OK", *sub_1_OKpos ginfo_cx + ginfo_winx / 2 - unit_x * 2, ginfo_cy - (ginfo_winy / 2 - unit_y * 2)button gosub "キャンセル", *sub_1_cancelgsel 0// 割り込み処理onexit gosub *exitonerror gosub *exerror// その他の事前処理; 時計表示サイズ取得SelectObject hdc, hFont.0mes s_today + strf("[%s] %02d:%02d:%02d", s_week(gettime(2)), gettime(4), gettime(5), gettime(6))t_sx = ginfo_mesx : t_sy = ginfo_mesygosub *mode_0_i///////////////// メインループ /////////////////repeatif ginfo_act = 0 {; 時計表示redraw 0clr 2, 0, 0, t_sx, t_sypos 0, 0SelectObject hdc, hFont.0mes s_today + strf("[%s] %02d:%02d:%02d", s_week(gettime(2)), gettime(4), gettime(5), gettime(6))redraw}wait 100loopstop//////// 画面切替ルーチン(メイン直下以外) //////*mode_open ; 開店処理clr 0 ; 画面クリア(オブジェクト含む); 販売実績データファイルexist "daily\\" + f_date + ".csv"if strsize = -1 {; 文字描画SelectObject hdc, hFont.0color 255 ; 赤pos unit_x * 6, unit_y * 6mes "開店処理"color , , 255 ; 青mes"釣銭準備金額入力"color ; 黒pos ginfo_cx + unit_y * 6, ginfo_cy + unit_y * 3lay_x = ginfo_cx : lay_y = ginfo_cymes "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 * 3lay_mpx = ginfo_cx : lay_mpy = ginfo_cymes "合計 円"; 各種入力ボックス配置font msgothic, unit_y * 5objmode 2pos lay_x + unit_y * 25, lay_y + 1repeat 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無効looppos lay_mpx + unit_y * 13, lay_mpy + 1input o_sum, unit_y * 38, unit_y * 6 ; 釣銭合計用入力ボックスnInput = statobjskip 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 = 0lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2lay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = unit_x : lay_iy = unit_ylay_nx = 1 : lay_ny = 3objsize lay_sx, lay_sy; オブジェクトフォントサイズfont msgothic, unit_y * 9, 5objmode 2pos lay_px(0), lay_py(1)button gosub "開店", *o_openobjskip stat, 3; オブジェクトフォントサイズfont msgothic, unit_y * 7objmode 2pos lay_px(0), lay_py(0)button gosub "戻る", *mode_4objskip stat, 3pos lay_px(0), lay_py(2)button gosub "入力切替", *o_changeobjskip stat, 3// テンキー設置; 画面レイアウト設定lay_x = unit_x * (81 - 5) : lay_y = ginfo_cy - unit_y * 5lay_ex = ginfo_winx : lay_ey = ginfo_winylay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = 0 : lay_iy = 0lay_nx = 3 : lay_ny = 4; オブジェクトフォントサイズfont msgothic, unit_y * 8, 1objmode 2; クリアボタンobjsize lay_sx * 2 + lay_ix, lay_sypos lay_px(tkey_arg(10, 0)), lay_py(tkey_arg(10, 1))button gosub "クリア", *o_tenkeytkey_clr_ID = statobjskip tkey_clr_ID, 3; 数字ボタンobjsize lay_sx, lay_syrepeat length(tkey_arg) - 1pos lay_px(tkey_arg(cnt, 0)), lay_py(tkey_arg(cnt, 1))button gosub str(cnt), *o_tenkeyobjskip stat, 3looponcmd gosub *o_command, $111 ; 入力割り込み処理} else {dialog "本日の閉店処理は完了しています。\n再び開店しますか。", 2, titlif stat = 6 { ; はい; 開店フラグ書き込みs_opened = 1writeini "system", "opened", s_openednotesel d_buf ; 販売実績データを対象バッファに指定(デフォルト)noteload "daily\\" + f_date + ".csv" ; 販売実績データ読み込みnoteunselgosub *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.0color 255 ; 赤pos unit_x * 6, unit_y * 6mes "閉店処理"color , , 255 ; 青mes "現金誤差確認"color ; 黒pos ginfo_cx + unit_y * 6, ginfo_cy + unit_y * 3lay_x = ginfo_cx : lay_y = ginfo_cymes "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 * 3lay_mpx = ginfo_cx : lay_mpy = ginfo_cymes "合計 円"; 各種入力ボックス配置font msgothic, unit_y * 5objmode 2pos lay_x + unit_y * 28, lay_y + 1repeat 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無効looppos lay_mpx + unit_y * 13, lay_mpy + 1input o_sum, unit_y * 41, unit_y * 6 ; 釣銭合計用入力ボックスnInput = statobjskip 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 = 0lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2lay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = unit_x : lay_iy = unit_ylay_nx = 1 : lay_ny = 3objsize lay_sx, lay_sy; オブジェクトフォントサイズfont msgothic, unit_y * 7, 5objmode 2pos lay_px(0), lay_py(1)button gosub "誤差確認", *mode_close2objskip stat, 3; オブジェクトフォントサイズfont msgothic, unit_y * 7objmode 2pos lay_px(0), lay_py(0)button gosub "戻る", *mode_4objenable stat, 1 + (s_last ! s_today)objskip stat, 3pos lay_px(0), lay_py(2)button gosub "入力切替", *o_changeobjskip stat, 3// テンキー設置; 画面レイアウト設定lay_x = unit_x * (81 - 5) : lay_y = ginfo_cy - unit_y * 5lay_ex = ginfo_winx : lay_ey = ginfo_winylay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = 0 : lay_iy = 0lay_nx = 3 : lay_ny = 4; オブジェクトフォントサイズfont msgothic, unit_y * 8, 1objmode 2; クリアボタンobjsize lay_sx * 2 + lay_ix, lay_sypos lay_px(tkey_arg(10, 0)), lay_py(tkey_arg(10, 1))button gosub "クリア", *o_tenkeytkey_clr_ID = statobjskip tkey_clr_ID, 3; 数字ボタンobjsize lay_sx, lay_syrepeat length(tkey_arg) - 1pos lay_px(tkey_arg(cnt, 0)), lay_py(tkey_arg(cnt, 1))button gosub str(cnt), *o_tenkeyobjskip stat, 3looponcmd gosub *o_command, $111 ; 入力割り込み処理return*mode_close2oncmd gosub *dummy, $111 ; 入力割り込み無効clr 0 ; 画面クリア(オブジェクト含む); 理論存高取得notesel d_bufd_total = int(GetCSV(9, 1))noteunsel; 文字描画SelectObject hdc, hFont.0color 255 ; 赤pos unit_x * 6, unit_y * 6mes "閉店処理"color , , 255 ; 青mes "現金誤差確認"; 合計表示下書きtemp_i = ginfo_cx : lay_mpy = ginfo_cy + unit_y * 6SelectObject hdc, hFont.0 ; フォントを選択pos ginfo_winx, ginfo_winymes strf(" 現金存高%8d円 ", 0)lay_msx = ginfo_mesx : lay_msy = ginfo_mesylay_mpx = temp_i + unit_y * 75 - lay_msx ; 右揃えに; 現金存高表示描画color , , 255 ; 青pos lay_mpx, lay_mpymes strf(" 現金存高%10d円 ", o_sum); 理論存高表示下書きcolor 255 ; 赤mes strf(" 理論存高%10d円 ", d_total)color 0, 0, 0mes "────────────"; 現金誤差表示color , 128 ; 緑mes strf(" 現金誤差%10d円 ", o_sum - d_total); 画面レイアウト設定lay_x = unit_x * (81 - 5) : lay_y = 0lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2lay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = unit_x : lay_iy = unit_ylay_nx = 1 : lay_ny = 2objsize lay_sx, lay_sy; オブジェクトフォントサイズfont msgothic, unit_y * 9, 5objmode 2pos lay_px(0), lay_py(1)button gosub "閉店", *o_closeobjskip stat, 3; オブジェクトフォントサイズfont msgothic, unit_y * 9objmode 2pos lay_px(0), lay_py(0)button gosub "戻る", *mode_close_backreturn///////// 画面切替ルーチン(メイン直下) /////////*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, titlexist "daily\\" + f_date + ".csv"if strsize = -1 {; 閉店フラグ書き込みs_opened = 0writeini "system", "opened", s_opened} else {; 最終営業日書き込みwriteini "system", "last", s_today}} else { ; 閉店忘れdialog "前回(" + s_last + ")、閉店処理をせずに終了した可能性があります。\n前回の閉店処理を行いますか。", 3, titlif stat = 6 { ; はいf_date = s_laststrrep f_date, "/", "-"; 前回の販売データ読み込みexist "daily\\" + f_date + ".csv"if strsize = -1 {dialog "前回(" + s_last + ")の販売データが見つかりませんでした。", 1, titl} else {notesel d_bufnoteload "daily\\" + f_date + ".csv"noteunselgosub *mode_close ; 閉店処理実行return}} else {; 閉店フラグ書き込みs_opened = 0writeini "system", "opened", s_opened}}} else { ; 営業日が今日exist "daily\\" + f_date + ".csv"if strsize = -1 { ; 販売データがないdialog "本日分の販売データが見つかりません。\n再度開店処理を行って下さい。", 1, titl; 閉店フラグ書き込みs_opened = 0writeini "system", "opened", s_opened} else { ; 開店状態(エラーなし)notesel d_buf ; 販売実績データを対象バッファに指定(デフォルト)noteload "daily\\" + f_date + ".csv" ; 販売実績データ読み込みnoteunselnotesel 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 = 0lay_ex = ginfo_winx : lay_ey = ginfo_winylay_ox = unit_x * 12 : lay_oy = unit_y * 12lay_ix = unit_x * 4 : lay_iy = unit_y * 4lay_nx = 3 : lay_ny = 1objsize lay_sx, lay_sy; オブジェクトフォントサイズfont msgothic, unit_y * 12, 5objmode 2pos lay_px(0), lay_py(0)button gosub "会計", *mode_1objenable stat, p_num * s_opened; オブジェクトフォントサイズfont msgothic, unit_y * 12objmode 2pos lay_px(1), lay_py(0)button gosub "販売\n実績", *mode_2SetWindowLong objinfo_hwnd(stat), -16, $50000000 | $2000 ; 複数行表示pos lay_px(2), lay_py(0) ; 返金ボタン描画位置lay_ny = 2 ; 縦レイアウト変更objsize lay_sx, lay_sybutton gosub "返金", *mode_3objenable stat, s_openedpos lay_px(2), lay_py(1)#ifdef _debugbutton gosub "管理", *mode_4#elsebutton gosub "管理", *sub_1#endifobjsel 0onkey 0return*mode_1 ; 受注画面; 受注用変数初期化c_total = 0 : c_anum = 0repeat p_numc_num(cnt) = 0loop*mode_1_backclr 0 ; 画面クリア(オブジェクト含む)// 受注用リストビュー設置pos unit_x * 6, unit_y * 6winobj "SysListView32", "", $200, $50000001, unit_x * 75, ginfo_winy - unit_y * 18hList = objinfo_hwnd(stat)sendmsg hList, $1036, , $1 | $20 ; 拡張スタイル(LVM_SETEXTENDEDLISTVIEWSTYLE)sendmsg hList, $30, hFont.1, 0 ; フォント変更(WM_SETFONT)syscolor 16sendmsg hList, $1026, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16)sendmsg hList, $1001, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16)color 0, 0, 0ImmAssociateContext hList, 0 ; IME無効; カラム追加temp_s = "商品名"LVCOLUMS = $F, 0, unit_x * 46, varptr(temp_s), 0, 0sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNtemp_s = "単価"LVCOLUMS = $F, 1, unit_x * 13, varptr(temp_s), 0, 0sendmsg hList, $101B, 1, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNtemp_s = "個"LVCOLUMS = $F, 1, unit_x * 9, varptr(temp_s), 0, 0sendmsg 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_SETITEMloop; 小計表示下書きlay_mpx = ginfo_cx : lay_mpy = ginfo_cySelectObject hdc, hFont.0pos ginfo_winx, ginfo_winymes strf("小計%8d円", 0)lay_msx = ginfo_mesx : lay_msy = ginfo_mesylay_mpx = lay_mpx + unit_x * 75 - lay_msxpos lay_mpx, lay_mpymes strf("小計%8d円", c_total)// 会計&取り消しボタン; 画面レイアウト設定lay_x = unit_x * (81 - 5) : lay_y = 0lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2lay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = unit_x : lay_iy = unit_ylay_nx = 1 : lay_ny = 2objsize lay_sx, lay_sy; オブジェクトフォントサイズfont msgothic, unit_y * 10objmode 2pos lay_px(0), lay_py(0)button gosub "取消", *mode_1_cancel; オブジェクトフォントサイズfont msgothic, unit_y * 10, 5objmode 2pos lay_px(0), lay_py(1)button gosub "会計", *mode_1_1// テンキー設置; 画面レイアウト設定lay_x = unit_x * (81 - 5) : lay_y = ginfo_cy - unit_y * 5lay_ex = ginfo_winx : lay_ey = ginfo_winylay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = 0 : lay_iy = 0lay_nx = 3 : lay_ny = 4; オブジェクトフォントサイズfont msgothic, unit_y * 8, 1objmode 2; クリアボタンobjsize lay_sx * 2 + lay_ix, lay_sypos lay_px(tkey_arg(10, 0)), lay_py(tkey_arg(10, 1))button gosub "クリア", *mode_1_tenkeytkey_clr_ID = stat; 数字ボタンobjsize lay_sx, lay_syrepeat length(tkey_arg) - 1pos lay_px(tkey_arg(cnt, 0)), lay_py(tkey_arg(cnt, 1))button gosub str(cnt), *mode_1_tenkeylooponkey gosub *mode_1_key_event ; mode_1でのキーイベントジャンプ先return*mode_2 ; 販売実績表示画面clr 0 ; 画面クリア(オブジェクト含む); 画面レイアウト設定lay_x = 0 : lay_y = 0lay_ex = ginfo_winx : lay_ey = ginfo_winylay_ox = unit_x * 12 : lay_oy = unit_y * 12lay_ix = unit_x * 4 : lay_iy = unit_y * 4lay_nx = 1 : lay_ny = 3; オブジェクトフォントサイズfont msgothic, unit_y * 12objmode 2objsize lay_sx, lay_sypos lay_px(0), lay_py(0)button gosub "日付別販売実績", *mode_2_1pos lay_px(0), lay_py(1)button gosub "累計販売実績", *mode_2_2pos lay_px(0), lay_py(2)button gosub "戻る", *mode_0return*mode_3 ; 返金選択画面#ifndef _debug ; 通常時dialog "返金は本日分の会計のみ行えます。", 0, titl#endif*mode_3_backclr 0 ; 画面クリア(オブジェクト含む)// 受注用リストビュー設置pos unit_x * 6, unit_y * 6winobj "SysListView32", "", $200, $50000001, unit_x * 75, ginfo_winy - unit_y * 18hList = objinfo_hwnd(stat)sendmsg hList, $1036, , $1 | $20 ; 拡張スタイル(LVM_SETEXTENDEDLISTVIEWSTYLE)sendmsg hList, $30, hFont.1, 0 ; フォント変更(WM_SETFONT)syscolor 16sendmsg hList, $1026, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16)sendmsg hList, $1001, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16)color 0, 0, 0ImmAssociateContext hList, 0 ; IME無効; カラム追加temp_s = "会計時間"LVCOLUMS = $F, 0, unit_x * 67, varptr(temp_s), 0, 0sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN// 戻る&選択ボタン; オブジェクトフォントサイズfont msgothic, unit_y * 9objmode 2; 画面レイアウト設定lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2lay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = unit_x : lay_iy = unit_ylay_nx = 1 : lay_ny = 2objsize lay_sx, lay_sypos lay_px(0), lay_py(0)button gosub "戻る", *mode_0font msgothic, unit_y * 9, 5objmode 2pos lay_px(0), lay_py(1)button gosub "選択", *mode_3_1dirlist r_list, "history\\" + f_date + "\\**-**-**.csv", 3repeat stattemp_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_SETITEMloopnoteunselreturn*mode_4 ; 管理画面oncmd gosub *dummy, $111 ; 入力割り込み無効clr 0 ; 画面クリア(オブジェクト含む); 画面レイアウト設定lay_x = 0 : lay_y = 0lay_ex = ginfo_winx : lay_ey = ginfo_winylay_ox = unit_x * 12 : lay_oy = unit_y * 12lay_ix = unit_x * 4 : lay_iy = unit_y * 4lay_nx = 3 : lay_ny = 2objsize lay_sx, lay_sy; オブジェクトフォント指定font msgothic, unit_y * 10, 5objmode 2pos 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 * 10objmode 2pos lay_px(1), lay_py(0)button gosub "レジ\n点検", *mode_4_2nButton = statSetWindowLong objinfo_hwnd(nButton), -16, $50000000 | $2000 ; 複数行表示objenable nButton, s_openedpos lay_px(2), lay_py(0)button gosub "返金\n取消", *mode_4_3nButton = statSetWindowLong objinfo_hwnd(nButton), -16, $50000000 | $2000 ; 複数行表示objenable nButton, s_openedpos lay_px(0), lay_py(1)button gosub "商品\n登録", *mode_4_4SetWindowLong objinfo_hwnd(stat), -16, $50000000 | $2000 ; 複数行表示pos lay_px(1), lay_py(1)button gosub "その他", *mode_4_5pos lay_px(2), lay_py(1)button gosub "戻る", *mode_0font msgothic, unit_y * 4, 1objsize unit_x * 14, unit_y * 6pos ginfo_winx - unit_x * 14, 0button gosub "終了", *exit2pos ginfo_winx - unit_x * 28, 0button gosub "最小化", *s_minireturn*sub_1 ; パスワード入力ウィンドウ表示if s_password = "0000" { ; パスワード「0000」ならスキップgosub *mode_4return}main_x = ginfo_wx1 : main_y = ginfo_wy1main_w = ginfo_winx : main_h = ginfo_winyEnableWindow hWnd_main, 0gsel 1width unit_x * 50, unit_y * 20, main_x + (main_w - ginfo_winx) / 2, main_y + (main_h - ginfo_winy) / 2objprm 0, "" : objsel 0gsel 1, 1onkey gosub *sub_1_key_eventreturn//////////// 画面切替ルーチン(従属) ////////////*mode_1_1 ; 会計画面if c_anum <= 0 { ; 商品個数0の通知dialog "商品個数が入力されていません。", 0, titlreturn}if c_total <= 0 {dialog "金額が異常です。\n入力内容を確認してください。", 1, titlreturn}; 会計用変数初期化c_depoint = 0c_change = 1clr 0 ; 画面クリア(オブジェクト含む)// 受注内容確認リストビュー配置pos unit_x * 6, unit_y * 6winobj "SysListView32", "", $200, $50000001, unit_x * 75, ginfo_winy / 2 - unit_y * 6hList = objinfo_hwnd(stat)sendmsg hList, $1036, , $1 | $20 ; 拡張スタイル(LVM_SETEXTENDEDLISTVIEWSTYLE)sendmsg hList, $30, hFont.1, 0 ; フォント変更(WM_SETFONT)syscolor 16sendmsg 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, 0ImmAssociateContext hList, 0 ; IME無効; カラム追加temp_s = "商品名"LVCOLUMS = $F, 0, unit_x * 46, varptr(temp_s), 0, 0sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNtemp_s = "単価"LVCOLUMS = $F, 1, unit_x * 13, varptr(temp_s), 0, 0sendmsg hList, $101B, 1, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNtemp_s = "個"LVCOLUMS = $F, 1, unit_x * 9, varptr(temp_s), 0, 0sendmsg hList, $101B, 2, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN; アイテム追加repeat p_numif c_num(cnt) = 0 : continue ; 数量0はスキップ; アイテム数取得sendmsg hList, $1004 ; LVM_GETITEMCOUNTtemp_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_SETITEMloop; 合計表示下書きtemp_i = ginfo_cx : lay_mpy = ginfo_cy + unit_y * 4SelectObject hdc, hFont.0 ; フォントを選択pos ginfo_winx, ginfo_winymes strf(" 合計%8d円 ", 0)lay_msx = ginfo_mesx : lay_msy = ginfo_mesylay_mpx = temp_i + unit_y * 75 - lay_msx ; 右揃えに; 合計表示描画pos lay_mpx, lay_mpymes strf(" 合計%8d円 ", c_total); 預り金表示下書きcolor 255, 0, 0lay_mpx = ginfo_cx : lay_mpy = ginfo_cymes strf(" お預り%8d円 ", c_depoint)color 0, 0, 0mes "────────────"// 変更&確定ボタン; 画面レイアウト設定lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2lay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = unit_x : lay_iy = unit_ylay_nx = 1 : lay_ny = 2objsize lay_sx, lay_sy; オブジェクトフォントサイズfont msgothic, unit_y * 10objmode 2pos lay_px(0), lay_py(0)button gosub "変更", *mode_1_back; オブジェクトフォントサイズfont msgothic, unit_y * 10, 5objmode 2pos lay_px(0), lay_py(1)button gosub "確定", *mode_1_1_confirm// テンキー設置; オブジェクトフォントサイズfont msgothic, unit_y * 8, 1objmode 2; 画面レイアウト設定lay_x = unit_x * (81 - 5) : lay_y = ginfo_cy - unit_y * 5lay_ex = ginfo_winx : lay_ey = ginfo_winylay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = 0 : lay_iy = 0lay_nx = 3 : lay_ny = 4; クリアボタンobjsize lay_sx * 2 + lay_ix, lay_sypos lay_px(tkey_arg(10, 0)), lay_py(tkey_arg(10, 1))button gosub "クリア", *mode_1_tenkeytkey_clr_ID = stat; 数字ボタンobjsize lay_sx, lay_syrepeat length(tkey_arg) - 1pos lay_px(tkey_arg(cnt, 0)), lay_py(tkey_arg(cnt, 1))button gosub str(cnt), *mode_1_tenkeylooponkey gosub *mode_1_1_key_eventreturn*mode_2_1 ; 日付別販売実績clr 0 ; 画面クリア(オブジェクト含む)// 日付リストビュー配置pos unit_x * 6, unit_y * 6winobj "SysListView32", "", $200, $50000001, unit_x * 75, ginfo_winy - unit_y * 12hList = objinfo_hwnd(stat)sendmsg hList, $1036, , $1 | $20 ; 拡張スタイル(LVM_SETEXTENDEDLISTVIEWSTYLE)sendmsg hList, $30, hFont.1, 0 ; フォント変更(WM_SETFONT)syscolor 16sendmsg 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, 0ImmAssociateContext hList, 0 ; IME無効; カラム追加temp_s = "日付"LVCOLUMS = $F, 0, unit_x * 67, varptr(temp_s), 0, 0sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNdirlist d_list, "daily\\****-**-**.csv", 3 ; 販売実績ファイル列挙repeat stattemp_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_SETITEMloop// 戻る&選択ボタン; オブジェクトフォントサイズfont msgothic, unit_y * 9objmode 2; 画面レイアウト設定lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2lay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = unit_x : lay_iy = unit_ylay_nx = 1 : lay_ny = 2objsize lay_sx, lay_sypos lay_px(0), lay_py(0)button gosub "戻る", *mode_2font msgothic, unit_y * 9, 5objmode 2pos lay_px(0), lay_py(1)button gosub "選択", *mode_2_1_1return*mode_2_2 ; 累計販売実績clr 0 ; 画面クリア(オブジェクト含む)// 累計販売実績リストビュー配置pos unit_x * 6, unit_y * 6winobj "SysListView32", "", $200, $50000001, unit_x * 75, ginfo_winy - unit_y * 12hList = objinfo_hwnd(stat)sendmsg hList, $1036, , $1 | $20 ; 拡張スタイル(LVM_SETEXTENDEDLISTVIEWSTYLE)sendmsg hList, $30, hFont.1, 0 ; フォント変更(WM_SETFONT)syscolor 16sendmsg 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, 0ImmAssociateContext hList, 0 ; IME無効; カラム追加temp_s = "商品名"LVCOLUMS = $F, 0, unit_x * 43, varptr(temp_s), 0, 0sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNtemp_s = "売上"LVCOLUMS = $F, 1, unit_x * 12, varptr(temp_s), 0, 0sendmsg hList, $101B, 1, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNtemp_s = "返品"LVCOLUMS = $F, 1, unit_x * 12, varptr(temp_s), 0, 0sendmsg hList, $101B, 2, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN// 戻るボタン; オブジェクトフォントサイズfont msgothic, unit_y * 9, 1objmode 2; 画面レイアウト設定lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2lay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = unit_x : lay_iy = unit_ylay_nx = 1 : lay_ny = 2objsize lay_sx, lay_sypos lay_px(0), lay_py(0)button gosub "戻る", *mode_2notesel d_buf_total ; 対象バッファを累計販売実績データに; 商品一覧表示repeat notemax - 11, 11temp_s = GetCSV(cnt, 0) ; 商品ID取得p_index = -1repeat p_num ; 商品データから検索if temp_s = p_id(cnt) : p_index = cnt : breakloopsendmsg hList, $1004 ; LVM_GETITEMCOUNTtemp_i = statif 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 : breakloopif 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_SETITEMloop; 合計表示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_SELECTEDif stat = -1 : returnd_sel = stat*mode_2_1_1_backclrobj 1, 2 ; ボタンだけ削除sendmsg hList, $1009 ; LVM_DELETEALLITEMS; カラム追加temp_s = "商品名"LVCOLUMS = $F, 0, unit_x * 43, varptr(temp_s), 0, 0sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNtemp_s = "売上"LVCOLUMS = $F, 1, unit_x * 12, varptr(temp_s), 0, 0sendmsg hList, $101B, 1, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNtemp_s = "返品"LVCOLUMS = $F, 1, unit_x * 12, varptr(temp_s), 0, 0sendmsg hList, $101B, 2, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNsendmsg 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, 1objmode 2; 画面レイアウト設定lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2lay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = unit_x : lay_iy = unit_ylay_nx = 1 : lay_ny = 2objsize lay_sx, lay_sypos lay_px(0), lay_py(0)button gosub "戻る", *mode_2_1font msgothic, unit_y * 9, 5objmode 2pos lay_px(0), lay_py(1)button gosub "毎時売上", *mode_2_1_2; 販売実績データ一覧から選択されたファイルを取得notesel d_listnoteget d_path, notemax - d_sel - 1noteunsel; 選択された販売実績データをバッファにロードnotesel d_buf_datenoteload "daily\\" + d_pathif notemax = 0 {dialog "選択された日付の販売実績データは読み込めません。", 1, titlnoteunsel ; バッファ復帰gosub *mode_2_1return}; 商品一覧表示repeat notemax - 14, 14temp_s = GetCSV(cnt, 0) ; 商品ID取得p_index = -1repeat p_num ; 商品データから検索if temp_s = p_id(cnt) : p_index = cnt : breakloopsendmsg hList, $1004 ; LVM_GETITEMCOUNTtemp_i = statif 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 : breakloopif 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_SETITEMloop; 合計表示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, 0sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNtemp_s = "客数"LVCOLUMS = $F, 1, unit_x * 16, varptr(temp_s), 0, 0sendmsg hList, $101B, 1, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNtemp_s = "売上"LVCOLUMS = $F, 1, unit_x * 21, varptr(temp_s), 0, 0sendmsg hList, $101B, 2, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNtemp_s = "客単価"LVCOLUMS = $F, 1, unit_x * 17, varptr(temp_s), 0, 0sendmsg hList, $101B, 3, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNsendmsg hList, $101C, 4 ; カラムを削除(LVM_DELETECOLUMN)sendmsg hList, $101C, 4 ; カラムを削除(LVM_DELETECOLUMN)sendmsg hList, $101C, 4 ; カラムを削除(LVM_DELETECOLUMN); オブジェクトフォントサイズfont msgothic, unit_y * 9, 1objmode 2; 画面レイアウト設定lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2lay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = unit_x : lay_iy = unit_ylay_nx = 1 : lay_ny = 2objsize lay_sx, lay_sypos lay_px(0), lay_py(0)button gosub "戻る", *mode_2_1font msgothic, unit_y * 9, 5objmode 2pos lay_px(0), lay_py(1)button gosub "売上一覧", *mode_2_1_1_backnotesel u_buf_datenoteload "hourly\\" + d_pathrepeat 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_SETITEMloopnoteunselreturn*mode_3_1 ; 返金画面; 選択アイテム取得sendmsg hList, $100C, -1, $2 ; LVM_GETNEXTITEM LVNI_SELECTEDif stat = -1 : returntemp_i = statclrobj 1, 2 ; ボタンだけ削除sendmsg hList, $1009 ; LVM_DELETEALLITEMS; カラム追加temp_s = "商品名"LVCOLUMS = $F, 0, unit_x * 55, varptr(temp_s), 0, 0sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNtemp_s = "個"LVCOLUMS = $F, 1, unit_x * 12, varptr(temp_s), 0, 0sendmsg hList, $101B, 1, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNsendmsg hList, $101C, 2 ; 時間カラムを削除(LVM_DELETECOLUMN); 画面レイアウト設定lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2lay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = unit_x : lay_iy = unit_ylay_nx = 1 : lay_ny = 2objsize lay_sx, lay_syfont msgothic, unit_y * 9objmode 2pos lay_px(0), lay_py(0)button gosub "戻る", *mode_3_backfont msgothic, unit_y * 9, 5objmode 2pos lay_px(0), lay_py(1)button gosub "返金", *mode_3_1_refund; 販売実績データ一覧から選択されたファイルを取得notesel r_listnoteget temp_s, notemax - temp_i - 1noteunselr_path = f_date + "\\" + temp_s ; 販売実績ファイルパス代入; 選択された販売実績データをバッファにロードnotesel h_bufnoteload "history\\" + r_pathif notemax = 0 {dialog "選択された販売履歴データは読み込めません。", 1, titlnoteunsel ; バッファ復帰gosub *mode_3_backreturn}; 商品一覧表示repeat notemax - 2, 2temp_s = GetCSV(cnt, 0) ; 商品ID取得p_index = -1repeat p_num ; 商品データから検索if temp_s = p_id(cnt) : p_index = cnt : breakloopsendmsg hList, $1004 ; LVM_GETITEMCOUNTtemp_i = statif 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 : breakloopif 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_SETITEMloop; 売上金額表示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.0color 255 ; 赤pos unit_x * 6, unit_y * 6mes "レジ点検" + 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 * 3lay_x = ginfo_cx : lay_y = ginfo_cymes "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 * 3lay_mpx = ginfo_cx : lay_mpy = ginfo_cymes "合計 円"; 各種入力ボックス配置font msgothic, unit_y * 5objmode 2pos lay_x + unit_y * 28, lay_y + 1repeat 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無効looppos lay_mpx + unit_y * 13, lay_mpy + 1input o_sum, unit_y * 41, unit_y * 6 ; 釣銭合計用入力ボックスnInput = statobjskip 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 = 0lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2lay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = unit_x : lay_iy = unit_ylay_nx = 1 : lay_ny = 3objsize lay_sx, lay_sy; オブジェクトフォントサイズfont msgothic, unit_y * 7, 5objmode 2pos lay_px(0), lay_py(1)button gosub "誤差確認", *mode_4_2_1objskip stat, 3; オブジェクトフォントサイズfont msgothic, unit_y * 7objmode 2pos lay_px(0), lay_py(0)button gosub "戻る", *mode_4objskip stat, 3pos lay_px(0), lay_py(2)button gosub "入力切替", *o_changeobjskip stat, 3// テンキー設置; 画面レイアウト設定lay_x = unit_x * (81 - 5) : lay_y = ginfo_cy - unit_y * 5lay_ex = ginfo_winx : lay_ey = ginfo_winylay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = 0 : lay_iy = 0lay_nx = 3 : lay_ny = 4; オブジェクトフォントサイズfont msgothic, unit_y * 8, 1objmode 2; クリアボタンobjsize lay_sx * 2 + lay_ix, lay_sypos lay_px(tkey_arg(10, 0)), lay_py(tkey_arg(10, 1))button gosub "クリア", *o_tenkeytkey_clr_ID = statobjskip tkey_clr_ID, 3; 数字ボタンobjsize lay_sx, lay_syrepeat length(tkey_arg) - 1pos lay_px(tkey_arg(cnt, 0)), lay_py(tkey_arg(cnt, 1))button gosub str(cnt), *o_tenkeyobjskip stat, 3looponcmd gosub *o_command, $111 ; 入力割り込み処理return*mode_4_2_1oncmd gosub *dummy, $111 ; 入力割り込み無効clr 0 ; 画面クリア(オブジェクト含む); 理論存高取得notesel d_bufd_total = int(GetCSV(9, 1))noteunsel; 文字描画SelectObject hdc, hFont.0color 255 ; 赤pos unit_x * 6, unit_y * 6mes "レジ点検" + 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 * 6SelectObject hdc, hFont.0 ; フォントを選択pos ginfo_winx, ginfo_winymes strf(" 現金存高%8d円 ", 0)lay_msx = ginfo_mesx : lay_msy = ginfo_mesylay_mpx = temp_i + unit_y * 75 - lay_msx ; 右揃えに; 現金存高表示描画color , , 255 ; 青pos lay_mpx, lay_mpymes strf(" 現金存高%10d円 ", o_sum); 理論存高表示下書きcolor 255 ; 赤mes strf(" 理論存高%10d円 ", d_total)color 0, 0, 0mes "────────────"; 現金誤差表示color , 128 ; 緑mes strf(" 現金誤差%10d円 ", o_sum - d_total); 画面レイアウト設定lay_x = unit_x * (81 - 5) : lay_y = 0lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2lay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = unit_x : lay_iy = unit_ylay_nx = 1 : lay_ny = 2objsize lay_sx, lay_sy; オブジェクトフォントサイズfont msgothic, unit_y * 9, 5objmode 2pos lay_px(0), lay_py(1)button gosub "完了", *mode_4_2_1_errorobjskip stat, 3; オブジェクトフォントサイズfont msgothic, unit_y * 9objmode 2pos lay_px(0), lay_py(0)button gosub "戻る", *mode_4_2_backreturn*mode_4_3 ; 返金取消選択画面clr 0 ; 画面クリア(オブジェクト含む)// 受注用リストビュー設置pos unit_x * 6, unit_y * 6winobj "SysListView32", "", $200, $50000001, unit_x * 75, ginfo_winy - unit_y * 18hList = objinfo_hwnd(stat)sendmsg hList, $1036, , $1 | $20 ; 拡張スタイル(LVM_SETEXTENDEDLISTVIEWSTYLE)sendmsg hList, $30, hFont.1, 0 ; フォント変更(WM_SETFONT)syscolor 16sendmsg hList, $1026, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16)sendmsg hList, $1001, , (ginfo_r) + (ginfo_g << 8) + (ginfo_b << 16)color 0, 0, 0ImmAssociateContext hList, 0 ; IME無効; カラム追加temp_s = "会計時間"LVCOLUMS = $F, 0, unit_x * 67, varptr(temp_s), 0, 0sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN// 戻る&選択ボタン; オブジェクトフォントサイズfont msgothic, unit_y * 9objmode 2; 画面レイアウト設定lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2lay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = unit_x : lay_iy = unit_ylay_nx = 1 : lay_ny = 2objsize lay_sx, lay_sypos lay_px(0), lay_py(0)button gosub "戻る", *mode_4font msgothic, unit_y * 9, 5objmode 2pos lay_px(0), lay_py(1)button gosub "選択", *mode_4_3_2dirlist r_list, "refund\\" + f_date + "\\**-**-**.csv", 3repeat stattemp_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_SETITEMloopnoteunselreturn*mode_4_3_2 ; 取消返金データ表示画面; 選択アイテム取得sendmsg hList, $100C, -1, $2 ; LVM_GETNEXTITEM LVNI_SELECTEDif stat = -1 : returntemp_i = statclrobj 1, 2 ; ボタンだけ削除sendmsg hList, $1009 ; LVM_DELETEALLITEMS; カラム追加temp_s = "商品名"LVCOLUMS = $F, 0, unit_x * 55, varptr(temp_s), 0, 0sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNtemp_s = "個"LVCOLUMS = $F, 1, unit_x * 12, varptr(temp_s), 0, 0sendmsg hList, $101B, 1, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNsendmsg hList, $101C, 2 ; 時間カラムを削除(LVM_DELETECOLUMN); 画面レイアウト設定lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2lay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = unit_x : lay_iy = unit_ylay_nx = 1 : lay_ny = 2objsize lay_sx, lay_syfont msgothic, unit_y * 9objmode 2pos lay_px(0), lay_py(0)button gosub "戻る", *mode_4_3font msgothic, unit_y * 9, 5objmode 2pos lay_px(0), lay_py(1)button gosub "返金取消", *mode_4_3_2_cancel; 販売実績データ一覧から選択されたファイルを取得notesel r_listnoteget temp_s, notemax - temp_i - 1noteunselr_path = f_date + "\\" + temp_s ; 販売実績ファイルパス代入; 選択された販売実績データをバッファにロードnotesel h_bufnoteload "refund\\" + r_pathif notemax = 0 {dialog "選択された返金履歴データは読み込めません。", 1, titlnoteunsel ; バッファ復帰gosub *mode_4_3return}; 商品一覧表示repeat notemax - 2, 2temp_s = GetCSV(cnt, 0) ; 商品ID取得p_index = -1repeat p_num ; 商品データから検索if temp_s = p_id(cnt) : p_index = cnt : breakloopsendmsg hList, $1004 ; LVM_GETITEMCOUNTtemp_i = statif 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 : breakloopif 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_SETITEMloop; 売上金額表示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, 1objmode 2pos unit_x * 6, unit_y * 6mes "商品名"input a_name, unit_x * 72, unit_y * 6pos ginfo_cx + unit_x * 72, unit_y * 6mes "単価"input a_value, unit_x * 24, unit_y * 6hInput = objinfo_hwnd(stat)SetWindowLong hInput, -16, $50010080 | $2 ; 右揃えImmAssociateContext hInput, 0 ; IME無効pos ginfo_cx + unit_x * 24, unit_y * 11objsize unit_x * 20, unit_y * 6button gosub "追加", *mode_4_4_add; 商品データ一覧リストビューpos unit_x * 6, unit_y * 18winobj "SysListView32", "", $200, $50000001, ginfo_winx - unit_x * 12, ginfo_winy - unit_y * 30hList = objinfo_hwnd(stat)sendmsg hList, $1036, , $1 | $20 ; 拡張スタイル(LVM_SETEXTENDEDLISTVIEWSTYLE)sendmsg hList, $30, hFont.1, 0 ; フォント変更(WM_SETFONT)syscolor 16sendmsg 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, 0ImmAssociateContext hList, 0 ; IME無効objsize (ginfo_winx - unit_x * 12) / 4, unit_y * 6lay_x = (ginfo_winx - unit_x * 12) / 4lay_y = ginfo_cy; 商品データ一覧操作ボタンbutton gosub "削除", *mode_4_4_deletepos unit_x * 6 + lay_x, lay_ybutton gosub "上へ", *mode_4_4_uppos unit_x * 6 + lay_x * 2, lay_ybutton gosub "下へ", *mode_4_4_downfont msgothic, unit_y * 5, 5objmode 2pos unit_x * 6 + lay_x * 3, lay_ybutton gosub "完了", *mode_4_4_reflect; カラム追加temp_s = "商品ID"LVCOLUMS = $F, 1, unit_x * 24, varptr(temp_s), 0, 0sendmsg hList, $101B, 0, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNtemp_s = "商品名"LVCOLUMS = $F, 0, unit_x * 64, varptr(temp_s), 0, 0sendmsg hList, $101B, 1, varptr(LVCOLUMS) ; LVM_INSERTCOLUMNtemp_s = "単価"LVCOLUMS = $F, 1, unit_x * 12, varptr(temp_s), 0, 0sendmsg hList, $101B, 2, varptr(LVCOLUMS) ; LVM_INSERTCOLUMN; アイテム追加repeat p_num; 商品IDtemp_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_SETITEMloopreturn*mode_4_5 ; 管理その他clr 0 ; 画面クリア(オブジェクト含む); 画面レイアウト設定lay_x = 0 : lay_y = 0lay_ex = ginfo_winx : lay_ey = ginfo_winylay_ox = unit_x * 12 : lay_oy = unit_y * 12lay_ix = unit_x * 4 : lay_iy = unit_y * 4lay_nx = 1 : lay_ny = 3; オブジェクトフォントサイズfont msgothic, unit_y * 12objmode 2objsize lay_sx, lay_sypos lay_px(0), lay_py(0)button gosub "パスワード変更", *mode_4_5_1pos lay_px(0), lay_py(1)button gosub "各種初期化", *mode_4_5_2pos lay_px(0), lay_py(2)button gosub "戻る", *mode_4return*mode_4_5_1 ; パスワード変更画面clr 0 ; 画面クリア(オブジェクト含む)pos unit_x * 6, unit_y * 6font msgothic, unit_y * 6mes "パスワード変更"color 255 ; 赤mes "\n現在のパスワード:" + s_passwordcolor , , 255 ; 青mes "\n新しいパスワード:"objmode 2pos ginfo_cx + ginfo_mesx, ginfo_cy - unit_y * 6input e_newpass, unit_y * 14, unit_y * 7, 4hInput = objinfo_hwnd(stat)sendmsg hInput, $CC, '*' ; EM_SETPASSWORDCHARSetWindowLong hInput, -16, $50010080 | $2000 ; 数字のみImmAssociateContext hInput, 0 ; IME無効font msgothic, unit_y * 3colorpos unit_x * 6mes "\n※ 4桁の数字のみ使用できます。\n※ 0000はパスワード無しになります。"// 戻る&変更ボタン; オブジェクトフォントサイズfont msgothic, unit_y * 9, 1objmode 2; 画面レイアウト設定lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2lay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = unit_x : lay_iy = unit_ylay_nx = 1 : lay_ny = 2objsize lay_sx, lay_sypos lay_px(0), lay_py(0)button gosub "戻る", *mode_4_5pos lay_px(0), lay_py(1)button gosub "変更", *mode_4_5_1_changereturn*mode_4_5_2 ; 各種初期化画面clr 0 ; 画面クリア(オブジェクト含む); 初期化フラグ初期化dim i_todaydim i_exdim i_totaldim i_pdfont msgothic, unit_y * 4, 1pos unit_x * 6, unit_y * 6color 255 ; 赤mes "初期化する項目を選択してください。\n"font msgothic, unit_y * 6objmode 2objsize unit_x * 75, unit_y * 6, unit_y * 8chkbox "本日分の販売データ", i_todayobjenable stat, s_opened + (s_last = s_today) ; 本日開店していなければ無効chkbox "本日分以外の販売データ", i_exchkbox "累計販売データ", i_totalchkbox "商品データ", i_pdbutton gosub "全てのデータ", *mode_4_5_2_allhButton = objinfo_hwnd(stat)sendmsg hButton, $F4, $3// 戻る&初期化ボタン; オブジェクトフォントサイズfont msgothic, unit_y * 9, 1objmode 2; 画面レイアウト設定lay_x = unit_x * (81 - 5) : lay_y = unit_y * 0lay_ex = ginfo_winx : lay_ey = ginfo_winy / 2lay_ox = unit_x * 6 : lay_oy = unit_y * 6lay_ix = unit_x : lay_iy = unit_ylay_nx = 1 : lay_ny = 2objsize lay_sx, lay_sypos lay_px(0), lay_py(0)button gosub "戻る", *mode_4_5pos lay_px(0), lay_py(1)button gosub "初期化", *mode_4_5_2_initreturn///////////////// その他の処理 /////////////////*o_open ; 開店処理dialog "入力された釣銭準備金額は" + o_sum + "円です。\n開店しますか。", 2, titlif stat = 7 : returnoncmd 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_numd_buf += p_id(cnt) + ",0,0\n"loopnotesel d_buf ; 販売実績データを対象バッファに指定(デフォルト)notesave "daily\\" + f_date + ".csv"noteunsel; 営業日数加算notesel d_buf_totalWriteCSV 0, 1, str(int(GetCSV(0, 1)) + 1)notesave "total.csv"; 開店フラグ書き込みs_opened = 1writeini "system", "opened", s_opened; 開店日書き込みs_last = s_todaywriteini "system", "last", s_last; 販売履歴ディレクトリdirlist temp_s, "history\\" + f_date, 5if stat = 0 : mkdir "history\\" + f_date; 返金履歴ディレクトリdirlist temp_s, "refund\\" + f_date, 5if stat = 0 : mkdir "refund\\" + f_date; 毎時売上ファイル作成u_buf = "時間,会計数,売上金額\n"repeat 24u_buf += strf("%02d,0,0\n", cnt)loopnotesel u_bufnotesave "hourly\\" + f_date + ".csv"noteunselgosub *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_bufWriteCSV 10, 1, str(o_sum) ; 現金在高WriteCSV 11, 1, str(o_error) ; 現金誤差notesave "daily\\" + f_date + ".csv"noteunselnotesel d_buf_totalWriteCSV 8, 1, str(int(GetCSV(8, 1)) + o_error)notesave "total.csv"noteunsel; 開店フラグ書き込みs_opened = 0writeini "system", "opened", s_openedgosub *mode_4return*o_changeo_input ^ 1 ; 0,1反転if o_input { ; o_input = 1のときoncmd gosub *dummy, $111 ; WM_COMMAND無効化repeat 9 + s_openedsendmsg hInput.cnt, $CF, 1 ; 枚数入力ボックス無効化objprm cnt, 0 ; 枚数リセットobjskip cnt, 7 ; フォーカススキップloopsendmsg hInput(9 + s_opened), $CF, 0 ; 釣銭合計入力ボックス有効化o_focus = 9 + s_openedobjsel 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_openedsendmsg hInput.cnt, $CF, 0 ; 枚数入力ボックス有効化objskip cnt, 5 ; フォーカススキップ無効looponcmd gosub *o_command, $111 ; WM_COMMAND有効化o_focus = 0objsel o_focus ; フォーカス指定}return*o_command ; 開閉店処理の入力処理repeat 9 + s_openedif lParam = hInput.cnt {o_focus = cnt ; フォーカスされたオブジェクトID代入; 釣銭合計反映o_sum = 0repeat 10o_sum += o_amount(cnt) * o_num(cnt)loopobjprm 9 + s_opened, o_sum ; オブジェクトに描画}loopreturn*o_tenkey ; 開閉店処理のテンキー処理temp_i = stat - tkey_clr_ID ; オブジェクトIDからテンキーのボタンを特定objsel o_focusif 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_bufnoteload "pd.csv"; 無限ループ防止if notemax = 0 {dialog "商品データファイル(pd.csv)が読み込めません。\nアプリケーションを終了してから、手動で修復するか、ファイルを削除してください。", 1, titlnoteunsel ; バッファ復帰return}; CSVデータ読み込みp_num = notemax - 1; 変数確保(p_num依存)sdim p_id, p_num ; 商品IDsdim 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型に変換loopnoteunsel ; バッファ復帰// 削除済み商品データ読み込み; 変数確保(p_num非依存)sdim rp_buf, 4096 ; 商品データファイル用バッファdim rp_num ; 商品登録数; 商品データをバッファに展開notesel rp_bufnoteload "rpd.csv"; 無限ループ防止if notemax = 0 {dialog "削除済み商品データファイル(rpd.csv)が読み込めません。\nアプリケーションを終了してから、手動で修復するか、ファイルを削除してください。", 1, titlnoteunsel ; バッファ復帰return}; CSVデータ読み込みrp_num = notemax - 1; 変数確保(p_num依存)sdim rp_id, rp_num ; 商品IDsdim 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型に変換loopnoteunsel ; バッファ復帰return*aggregate ; 販売実績集計if s_last ! s_today : return ; 今日開店していない場合clr 0 ; 画面クリア(オブジェクト含む)SelectObject hdc, hFont.0pos 0, 0mes "販売データ集計中..."return// sub_1*sub_1_OKif input_pw ! s_password {dialog "パスワードが間違っています。", 0, titlobjsel 0return}onkey 0HideSubWindow 1gosub *mode_4return*sub_1_cancelonkey 0HideSubWindow 1return// mode_1*mode_1_cancel ; mode_1から会計取消if c_anum {dialog "会計内容をすべて取り消しますか?", 2, titlif stat = 7 : return}gosub *mode_0return*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_SELECTEDif stat = -1 : returntemp_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とDELc_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 = 0repeat p_numc_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_msySelectObject hdc, hFont.0pos lay_mpx, lay_mpymes strf("小計%8d円", c_total)return*mode_1_1_key_event ; mode_1_1でのキーイベント; キーコードを数字に変換if wParam >= 48 & wParam <= 57 { ; 通常数字キーtemp_i = wParam - 48c_depoint = c_depoint * 10 + temp_i} elseif wParam >= 96 and wParam <= 105 { ; テンキーtemp_i = wParam - 96c_depoint = c_depoint * 10 + temp_i} elseif wParam = 8 | wParam = 46 { ; BSとDELc_depoint = 0} else {return}/*mode_1_1_exactly2 ; 丁度預かり*/clr 2, lay_mpx, lay_mpy, lay_mpx + lay_msx, lay_mpy + lay_msySelectObject hdc, hFont.0color 255, 0, 0pos lay_mpx, lay_mpymes strf(" お預り%8d円 ", c_depoint)color 0, 0, 0return*mode_1_1_confirmif c_depoint < c_total {dialog "預り金が不足しています。\nもう一度入力してください。", 0, titlreturn}if c_change {; 会計確定処理; テンキー&変更ボタン無効化onkey 0objenable 1, 0 ; 変更ボタンrepeat 11objenable tkey_clr_ID + cnt, 0 ; テンキーloopobjprm 2, "終了"; お釣り描画SelectObject hdc, hFont.0color 0, 0, 255pos lay_mpx, lay_mpy + lay_msy * 2mes strf(" お釣り%8d円 ", c_depoint - c_total)color 0, 0, 0c_change = 0return}// 会計終了処理; 累計販売実績データ更新notesel d_buf_totalWriteCSV 2, 1, str(int(GetCSV(2, 1)) + 1) ; 会計回数WriteCSV 3, 1, str(int(GetCSV(3, 1)) + c_total) ; 売上金額repeat p_numif 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)) ; 売上数上書き}loopnotesave "total.csv"noteunsel ; バッファ復帰; 毎時売上更新notesel u_bufWriteCSV 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_bufWriteCSV 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_numif 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)) ; 売上数上書き}loopnotesave "daily\\" + f_date + ".csv" ; 販売データ保存noteunselnotesel h_buf ; 対象バッファを販売履歴データに変更notesave "history\\" + f_date + "\\" + strf("%02d-%02d-%02d", gettime(4), gettime(5), gettime(6)) + ".csv" ; 販売履歴データ保存noteunselgosub *mode_0 ; メインメニューreturn*mode_3_1_refund ; 返金処理dialog "表示された内容の返金処理を行いますか。", 2, titlif stat = 7 : return ; いいえnotesel h_buf ; 販売履歴データ再指定; 販売履歴データ取得r_total = int(GetCSV(0, 1))r_pnum = notemax - 2 ; ループ回数repeat r_pnumr_ID(cnt) = GetCSV(cnt + 2, 0) ; 商品ID取得r_num(cnt) = int(GetCSV(cnt + 2, 1)) ; 売上数取得loopnoteunsel ; バッファ復帰; 販売データに反映notesel d_bufWriteCSV 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_pnumSearchCSV 14, 0, r_ID(cnt) ; 商品ID検索temp_i = statWriteCSV 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)) ; 返品数loopnotesave "daily\\" + f_date + ".csv" ; 販売データ保存noteunsel; 毎時売上データに反映temp_i = int(getpath(r_path, 9)) + 1notesel u_bufWriteCSV 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_totalWriteCSV 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_pnumSearchCSV 9, 0, r_ID(cnt) ; 商品ID検索temp_i = statWriteCSV 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)) ; 返品数loopnotesave "total.csv" ; 累計販売データ保存noteunsel; 返金データ保存(ファイル移動)bcopy "history\\" + r_path, "refund\\" + r_path ; ファイルをコピーdelete "history\\" + r_path ; 元のファイルを削除gosub *mode_3_backreturn*mode_4_2_1_erroro_error = o_sum - d_total ; 現金誤差算出if o_error {dialog "現金誤差が" + o_error + "円発生しています。", 1, titl}; 現金誤差書き込みnotesel d_bufWriteCSV 11, 1, str(o_sum - d_total)notesave "daily\\" + f_date + ".csv"noteunselnotesel d_buf_totalWriteCSV 8, 1, str(int(GetCSV(8, 1)) + o_sum - d_total)notesave "total.csv"noteunselgosub *mode_4return*mode_4_3_2_canceldialog "表示された内容の返金取消を行いますか。", 2, titlif stat = 7 : return ; いいえnotesel h_buf ; 販売履歴データ再指定; 販売履歴データ取得r_total = int(GetCSV(0, 1))r_pnum = notemax - 2 ; ループ回数repeat r_pnumr_ID(cnt) = GetCSV(cnt + 2, 0) ; 商品ID取得r_num(cnt) = int(GetCSV(cnt + 2, 1)) ; 売上数取得loopnoteunsel ; バッファ復帰; 販売データに反映notesel d_bufWriteCSV 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_pnumSearchCSV 14, 0, r_ID(cnt) ; 商品ID検索temp_i = statWriteCSV 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)) ; 返品数loopnotesave "daily\\" + f_date + ".csv" ; 販売データ保存noteunsel; 毎時売上データに反映temp_i = int(getpath(r_path, 9)) + 1notesel u_bufWriteCSV 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_totalWriteCSV 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_pnumSearchCSV 9, 0, r_ID(cnt) ; 商品ID検索temp_i = statWriteCSV 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)) ; 返品数loopnotesave "total.csv" ; 累計販売データ保存noteunsel; 返金データ保存(ファイル移動)bcopy "refund\\" + r_path, "history\\" + r_path ; ファイルをコピーdelete "refund\\" + r_path ; 元のファイルを削除gosub *mode_4_3return*mode_4_4_add ; mode_4_4の追加if a_name = "" or a_value = 0 {dialog "商品名か単価に問題があります。", 1, titlreturn}notesel p_bufrepeat ; 商品IDが被らないようにSearchCSV 1, 0, strf("%08X", s_pdcount)if stat ! -1 : s_pdcount++ : else : breakloopnoteadd strf("%08X", s_pdcount) + "," + a_name + "," + a_value, -1, 0 ; 商品データ書き込みnoteunsels_pdcount++; リストビューに反映; アイテム数取得sendmsg hList, $1004 ; LVM_GETITEMCOUNTtemp_i = stat; 商品IDtemp_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_SETITEMobjprm 0, ""objprm 1, 0return*mode_4_4_delete ; mode_4_4の削除; 選択アイテム取得sendmsg hList, $100C, -1, $2 ; LVM_GETNEXTITEM LVNI_SELECTEDif stat = -1 : returntemp_i = stat ; 選択アイテムのINDEX; 商品データ削除notesel p_bufnoteget temp_s, temp_i + 1 ; 商品データ取得notedel temp_i + 1 ; 商品データ削除noteunsel; 削除済み商品データ登録notesel rp_bufnoteadd temp_s, -1, 0noteunsel; リストビューに反映sendmsg hList, $1008, temp_i ; LVM_DELETEITEMreturn*mode_4_4_up ; mode_4_4の上へobjsel 3 ; フォーカスを戻す; 選択アイテム取得sendmsg hList, $100C, -1, $2 ; LVM_GETNEXTITEM LVNI_SELECTEDif stat <= 0 : return ; 最上部temp_i = stat ; 選択アイテムのINDEX; 商品データ上へ移動notesel p_bufnoteget temp_s, temp_i + 1notedel temp_i + 1noteadd temp_s, temp_i, 0; リストビューに反映sendmsg hList, $1008, temp_i ; LVM_DELETEITEM; 商品IDtemp_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_SETITEMnoteunselreturn*mode_4_4_down ; mode_4_4の下へobjsel 3 ; フォーカスを戻す; 選択アイテム取得sendmsg hList, $100C, -1, $2 ; LVM_GETNEXTITEM LVNI_SELECTEDif stat = -1 : returntemp_i = stat ; 選択アイテムのINDEX; アイテム数取得sendmsg hList, $1004 ; LVM_GETITEMCOUNTif stat <= temp_i + 1 : return ; 最下部; 商品データ下へ移動notesel p_bufnoteget temp_s, temp_i + 1notedel temp_i + 1noteadd temp_s, temp_i + 2, 0; リストビューに反映sendmsg hList, $1008, temp_i ; LVM_DELETEITEM; 商品IDtemp_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_SETITEMreturn*mode_4_4_reflect ; mode_4_4の完了writeini "system", "pdcount", s_pdcount ; 商品IDカウンター読み込み; 商品データ反映notesel p_bufnotesave "pd.csv"noteunselnotesel rp_bufnotesave "rpd.csv"noteunselgosub *load_pdgosub *mode_4return*mode_4_5_1_change ; パスワード変更dialog "パスワードを変更しますか。", 2, titlif stat = 7 : return ; いいえ; 変更を書き込みs_password = e_newpasswriteini "system", "pass", s_passworde_newpass = ""gosub *mode_4_5return*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, titlreturn}dialog "初期化したデータは元に戻せません。\n選択項目の初期化を実行しますか。\n(初期化後はソフトが再起動します。)", 3, titlif 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_datedeletef dir_cur + "\\refund\\" + f_date; 開店フラグ書き込みs_opened = 0writeini "system", "opened", s_opened; 最終営業日書き換えtemp_s = ""writeini "system", "last", temp_s}if i_ex { ; 本日分以外notesel r_list; 販売データ削除dirlist r_list, "daily\\****-**-**.csv", 1repeat statnoteget temp_s, cntif temp_s = f_date + ".csv" : continuedelete "daily\\" + temp_sloop; 毎時売上データ削除dirlist r_list, "hourly\\****-**-**.csv", 1repeat statnoteget temp_s, cntif temp_s = f_date + ".csv" : continuedelete "hourly\\" + temp_sloop; 販売履歴データ削除dirlist r_list, "history\\****-**-**", 5repeat statnoteget temp_s, cntif temp_s = f_date : continuedeletef dir_cur + "\\history\\" + temp_sloop; 返金データ削除dirlist r_list, "refund\\****-**-**", 5repeat statnoteget temp_s, cntif temp_s = f_date : continuedeletef dir_cur + "\\refund\\" + temp_sloopnoteunsel; 最終営業日書き換え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 *releaseexec "cmd /q /c \"timeout /t 2 /nobreak & start \"\" \"" + temp_s + "\"\"" ; コマンドプロンプトに実行させるendreturn*s_mini ; ウィンドウ最小化sendmsg hwnd, $112, $F020 ; SC_MINIMIZEreturn*sub_1_key_event ; パスワード入力ボックスのキーイベントを処理if wParam = 13 : gosub *sub_1_OKreturn*dummy ; ダミー(なにもおこらない)return/////////////// エラー・終了処理 ///////////////*release ; 解放処理onerror 0onexit 0oncmd 0onkey 0; ハンドル解放DeleteObject hFont.0 ; 汎用フォントDeleteObject hFont.1 ; リストビューフォントreturn*exerror ; 予期せぬエラー; エラーメッセージ(コンパイル制御)#ifdef _debug ; デバッグ時dialog "" + lParam + "行目で、" + wParam + "のエラーです。", 1, titl#else ; 通常時dialog "不明なエラーが発生しました。\nお問い合わせの際は、以下の番号をお伝えください。\nエラー番号 : " + wParam, 1, titl#endifgosub *release ; 解放処理endend*exitif wParam ! 0 {HideSubWindow wParam ; サブウィンドウ非表示return}*exit2#ifndef _debug ; 通常時if s_opened {dialog "閉店処理を行っていません。\nOptOレジ!を終了しますか。", 3, titl} else {dialog "OptOレジ!を終了しますか。", 3, titl}if stat = 7 : return#endifgosub *release ; 解放処理endend