From: newton-cn Date: Sat, 24 May 2025 02:56:29 +0000 (+0900) Subject: mm X-Git-Url: https://git.insang.kr/gitweb/?a=commitdiff_plain;h=fc9dd55005cd3c31087f997387b1b6c5fa8558bb;p=newton-cn_pos.git mm --- diff --git a/.vs/newton-cn/v16/.suo b/.vs/newton-cn/v16/.suo index 2266e8d..a9ffb4c 100644 Binary files a/.vs/newton-cn/v16/.suo and b/.vs/newton-cn/v16/.suo differ diff --git "a/DB_\355\224\204\353\241\234\354\213\234\354\240\200,\355\212\270\353\246\254\352\261\260/\354\277\274\353\246\254\353\254\270/other_shop_find_ps.sql" "b/DB_\355\224\204\353\241\234\354\213\234\354\240\200,\355\212\270\353\246\254\352\261\260/\354\277\274\353\246\254\353\254\270/other_shop_find_ps.sql" new file mode 100644 index 0000000..89155ae --- /dev/null +++ "b/DB_\355\224\204\353\241\234\354\213\234\354\240\200,\355\212\270\353\246\254\352\261\260/\354\277\274\353\246\254\353\254\270/other_shop_find_ps.sql" @@ -0,0 +1,52 @@ +drop procedure other_shop_find_ps; +CREATE PROCEDURE other_shop_find_ps + @month NVARCHAR(7), -- 예: '2025-05' + @shopName NVARCHAR(100), -- 예: '청라점' + @ctcode NVARCHAR(100) -- 예: '006017' +AS +BEGIN + SET NOCOUNT ON; + + DECLARE @server NVARCHAR(100); + DECLARE @sql NVARCHAR(2000); + DECLARE @startDate NVARCHAR(10); + DECLARE @endDate NVARCHAR(10); + + -- 시작일과 끝일 생성 + SET @startDate = @month + '-01'; + SET @endDate = CONVERT(NVARCHAR(10), DATEADD(MONTH, 1, CAST(@startDate AS DATETIME)), 120) + '-01'; + + -- Linked Server 이름 가져오기 + SELECT @server = gubun + FROM other_shop + WHERE gubun = @shopName; + + IF @server IS NULL + BEGIN + RAISERROR('지점명이 잘못되었거나 서버 정보가 없습니다.', 16, 1); + RETURN; + END + + -- 쿼리 동적 구성 (모든 쿼리는 OPENQUERY 내부에서 실행되어야 함) + SET @sql = N' + SELECT * + FROM OPENQUERY([' + @server + N'], + '' + SELECT + CONVERT(VARCHAR(10), a3.ps_date, 120) + CHAR(13) + CHAR(10) + CONVERT(VARCHAR(5), a3.ps_date, 108) AS 날짜, + a3.ps_prname as 상품명, + a3.ps_up as 금액, + a3.ps_qty as 수량 + FROM + ct a1 + JOIN pe a2 ON a1.ct_code = a2.ct_code + JOIN ps a3 ON a2.pe_id = a3.pe_id + WHERE + a1.ct_code = ''''' + @ctcode + N''''' + AND a3.ps_date BETWEEN ''''' + @startDate + N''''' AND ''''' + @endDate + N''''' + '')'; + + EXEC sp_executesql @sql; +END; + +exec other_shop_find_ps '2025-05', 'lu1', '0000000009'; \ No newline at end of file diff --git "a/DB_\355\224\204\353\241\234\354\213\234\354\240\200,\355\212\270\353\246\254\352\261\260/\354\277\274\353\246\254\353\254\270/\353\213\244\353\245\270\353\247\244\354\236\245\355\232\214\354\233\220\354\240\225\353\263\264\354\241\260\355\232\214.sql" "b/DB_\355\224\204\353\241\234\354\213\234\354\240\200,\355\212\270\353\246\254\352\261\260/\354\277\274\353\246\254\353\254\270/\353\213\244\353\245\270\353\247\244\354\236\245\355\232\214\354\233\220\354\240\225\353\263\264\354\241\260\355\232\214.sql" new file mode 100644 index 0000000..9927db8 --- /dev/null +++ "b/DB_\355\224\204\353\241\234\354\213\234\354\240\200,\355\212\270\353\246\254\352\261\260/\354\277\274\353\246\254\353\254\270/\353\213\244\353\245\270\353\247\244\354\236\245\355\232\214\354\233\220\354\240\225\353\263\264\354\241\260\355\232\214.sql" @@ -0,0 +1,65 @@ +--테이블 +create table other_shop( + gubun varchar(2000) primary key, + name varchar(2000), + memo varchar(2000) +); + +insert into other_shop values ('lu1', '가정점', ''); + + + +drop procedure other_shop_find_ct; +--프로시저 +CREATE PROCEDURE other_shop_find_ct + @shopName NVARCHAR(100), + @searchField NVARCHAR(10), + @keyword NVARCHAR(100) +AS +BEGIN + SET NOCOUNT ON; + + DECLARE @server NVARCHAR(100); + DECLARE @sql NVARCHAR(2000); + DECLARE @where NVARCHAR(2000); + + -- 1. Linked Server 이름 조회 + SELECT @server = gubun + FROM other_shop + WHERE gubun = @shopName; + + -- 2. 서버명이 없을 경우 종료 + IF @server IS NULL + BEGIN + RAISERROR('지점명에 해당하는 서버명이 존재하지 않습니다.', 16, 1); + RETURN; + END + + -- 3. 조건절 구성 + IF @searchField = 'phone' + BEGIN + SET @where = N'ct_phone LIKE ''''%' + @keyword + '%'''' OR ct_cphone LIKE ''''%' + @keyword + '%'''''; + END + ELSE IF @searchField = 'name' + BEGIN + SET @where = N'ct_name LIKE ''''%' + @keyword + '%'''''; + END + ELSE + BEGIN + RAISERROR('검색 조건은 ''phone'' 또는 ''name'' 중 하나여야 합니다.', 16, 1); + RETURN; + END + + -- 4. 전체 쿼리 생성 + SET @sql = N' + SELECT * + FROM OPENQUERY([' + @server + N'], + ''SELECT ct_code as 회원코드, ct_name as 회원명, ct_phone as 전화번호, ct_cphone as 휴대전화, ct_zip, ct_addr1, ct_addr2, ct_memo, ct_no, ct_birth, ct_tpoint, ct_rpoint, ct_visitn, ct_sale, ct_visitd, ct_date + FROM ct + WHERE ' + @where + N''')'; + + -- 5. 실행 + EXEC sp_executesql @sql; +END; + +exec other_shop_find_ct 'lu1', 'phone', '5323'; \ No newline at end of file diff --git "a/DB_\355\224\204\353\241\234\354\213\234\354\240\200,\355\212\270\353\246\254\352\261\260/\354\277\274\353\246\254\353\254\270/\354\203\201\355\222\210 visible \354\227\205\353\215\260\354\235\264\355\212\270\354\213\234 \355\212\270\353\246\254\352\261\260.sql" "b/DB_\355\224\204\353\241\234\354\213\234\354\240\200,\355\212\270\353\246\254\352\261\260/\354\277\274\353\246\254\353\254\270/\354\203\201\355\222\210 visible \354\227\205\353\215\260\354\235\264\355\212\270\354\213\234 \355\212\270\353\246\254\352\261\260.sql" new file mode 100644 index 0000000..751756d --- /dev/null +++ "b/DB_\355\224\204\353\241\234\354\213\234\354\240\200,\355\212\270\353\246\254\352\261\260/\354\277\274\353\246\254\353\254\270/\354\203\201\355\222\210 visible \354\227\205\353\215\260\354\235\264\355\212\270\354\213\234 \355\212\270\353\246\254\352\261\260.sql" @@ -0,0 +1,35 @@ +drop trigger trg_pr_visible_update; + +CREATE TRIGGER trg_pr_visible_update +ON pr +AFTER UPDATE +AS +BEGIN + SET NOCOUNT ON; + + IF UPDATE(PR_VISIBLE) + BEGIN + -- 0 → 1 (숨김 처리) : PR_ORDER보다 큰 친구들은 -1 유지 + UPDATE p + SET p.PR_ORDER = p.PR_ORDER - 1 + FROM pr p + JOIN inserted i ON p.KIND_CODE = i.KIND_CODE + JOIN deleted d ON i.PR_CODE = d.PR_CODE + WHERE + i.PR_VISIBLE = 1 AND d.PR_VISIBLE = 0 + AND p.PR_ORDER > i.PR_ORDER; + + -- 1 → 0 (보임 처리) : pr_order 재설정만 (자리 만드는 작업 없음) + UPDATE p + SET p.PR_ORDER = ( + SELECT COUNT(*) + FROM pr + WHERE kind_code = i.kind_code AND pr_visible = 0 + ) + FROM pr p + JOIN inserted i ON p.PR_CODE = i.PR_CODE + JOIN deleted d ON i.PR_CODE = d.PR_CODE + WHERE + i.PR_VISIBLE = 0 AND d.PR_VISIBLE = 1; + END +END; diff --git "a/DB_\355\224\204\353\241\234\354\213\234\354\240\200,\355\212\270\353\246\254\352\261\260/\354\277\274\353\246\254\353\254\270/\354\203\201\355\222\210\353\223\261\353\241\235 \354\236\220\353\217\231\354\234\274\353\241\234 order \353\223\244\354\226\264\352\260\200\352\262\214.sql" "b/DB_\355\224\204\353\241\234\354\213\234\354\240\200,\355\212\270\353\246\254\352\261\260/\354\277\274\353\246\254\353\254\270/\354\203\201\355\222\210\353\223\261\353\241\235 \354\236\220\353\217\231\354\234\274\353\241\234 order \353\223\244\354\226\264\352\260\200\352\262\214.sql" new file mode 100644 index 0000000..82ee1f6 --- /dev/null +++ "b/DB_\355\224\204\353\241\234\354\213\234\354\240\200,\355\212\270\353\246\254\352\261\260/\354\277\274\353\246\254\353\254\270/\354\203\201\355\222\210\353\223\261\353\241\235 \354\236\220\353\217\231\354\234\274\353\241\234 order \353\223\244\354\226\264\352\260\200\352\262\214.sql" @@ -0,0 +1,205 @@ +-- 청라 +drop trigger trg_pr_insert; + +CREATE TRIGGER trg_pr_insert +ON pr +INSTEAD OF INSERT +AS +BEGIN + SET NOCOUNT ON; + + INSERT INTO pr ( + PR_CODE, + PR_NAME, + KIND_CODE, + PR_KIND, + PR_DATE, + PR_PRICE1, + PR_PRICE2, + PR_PRICE3, + PR_COST, + PR_PRT, + PR_CK, + PR_TAX, + PR_IVCK, + PR_DCGU, + PR_VISIBLE, + PR_SETGU, + PR_COSGU, + PR_OPTGU, + PR_CPRGU, + PR_ORDER, -- ← 덮어씌움 + PR_BARCODE, + PR_QTYS, + PR_QTY, + PR_UNT, + PR_INQTY, + PR_OPEN, + PR_POINT, + PR_PRINTAMT, + PR_REG, + PR_STYPE, + PR_ORDUSE, -- ← 덮어씌움 + PR_FONTSIZE, + PR_AFTERPRICE, + PR_EVT, + PR_ORDER_P, + PR_ORDER_Y, + PR_ORDER_X, + PR_VISIBLE2, + PR_GU, + PR_NICK, + rn + ) + SELECT + i.PR_CODE, + i.PR_NAME, + i.KIND_CODE, + i.PR_KIND, + i.PR_DATE, + i.PR_PRICE1, + i.PR_PRICE2, + i.PR_PRICE3, + i.PR_COST, + i.PR_PRT, + i.PR_CK, + i.PR_TAX, + i.PR_IVCK, + i.PR_DCGU, + i.PR_VISIBLE, + i.PR_SETGU, + i.PR_COSGU, + i.PR_OPTGU, + i.PR_CPRGU, + ( + SELECT COUNT(*) + 1 + FROM pr + WHERE KIND_CODE = i.KIND_CODE and pr_visible= 0 + ) AS PR_ORDER, -- 자동 계산 + i.PR_BARCODE, + i.PR_QTYS, + i.PR_QTY, + i.PR_UNT, + i.PR_INQTY, + i.PR_OPEN, + i.PR_POINT, + i.PR_PRINTAMT, + i.PR_REG, + i.PR_STYPE, + 1 AS PR_ORDUSE, -- 강제 설정 + i.PR_FONTSIZE, + i.PR_AFTERPRICE, + i.PR_EVT, + i.PR_ORDER_P, + i.PR_ORDER_Y, + i.PR_ORDER_X, + i.PR_VISIBLE2, + i.PR_GU, + i.PR_NICK, + i.rn + FROM inserted i; +END; + + + +-- 루원 +drop trigger trg_pr_insert; + +CREATE TRIGGER trg_pr_insert +ON pr +INSTEAD OF INSERT +AS +BEGIN + SET NOCOUNT ON; + + INSERT INTO pr ( + PR_CODE, + PR_NAME, + KIND_CODE, + PR_KIND, + PR_DATE, + PR_PRICE1, + PR_PRICE2, + PR_PRICE3, + PR_COST, + PR_PRT, + PR_CK, + PR_TAX, + PR_IVCK, + PR_DCGU, + PR_VISIBLE, + PR_SETGU, + PR_COSGU, + PR_OPTGU, + PR_CPRGU, + PR_ORDER, -- ← 덮어씌움 + PR_BARCODE, + PR_QTYS, + PR_QTY, + PR_UNT, + PR_INQTY, + PR_OPEN, + PR_POINT, + PR_PRINTAMT, + PR_REG, + PR_STYPE, + PR_ORDUSE, -- ← 덮어씌움 + PR_FONTSIZE, + PR_AFTERPRICE, + PR_EVT, + PR_ORDER_P, + PR_ORDER_Y, + PR_ORDER_X, + PR_VISIBLE2, + PR_GU, + PR_NICK, + rn + ) + SELECT + i.PR_CODE, + i.PR_NAME, + i.KIND_CODE, + i.PR_KIND, + i.PR_DATE, + i.PR_PRICE1, + i.PR_PRICE2, + i.PR_PRICE3, + i.PR_COST, + i.PR_PRT, + i.PR_CK, + i.PR_TAX, + i.PR_IVCK, + i.PR_DCGU, + i.PR_VISIBLE, + i.PR_SETGU, + i.PR_COSGU, + i.PR_OPTGU, + i.PR_CPRGU, + ( + SELECT COUNT(*) + 1 + FROM pr + WHERE KIND_CODE = i.KIND_CODE and pr_visible= 0 + ) AS PR_ORDER, -- 자동 계산 + i.PR_BARCODE, + i.PR_QTYS, + i.PR_QTY, + i.PR_UNT, + i.PR_INQTY, + i.PR_OPEN, + i.PR_POINT, + i.PR_PRINTAMT, + i.PR_REG, + i.PR_STYPE, + 1 AS PR_ORDUSE, -- 강제 설정 + i.PR_FONTSIZE, + i.PR_AFTERPRICE, + i.PR_EVT, + i.PR_ORDER_P, + i.PR_ORDER_Y, + i.PR_ORDER_X, + i.PR_VISIBLE2, + i.PR_GU, + i.PR_NICK, + i.rn + FROM inserted i; +END; diff --git "a/DB_\355\224\204\353\241\234\354\213\234\354\240\200,\355\212\270\353\246\254\352\261\260/\354\277\274\353\246\254\353\254\270/\354\235\274\355\232\214\354\232\251\354\240\201\353\246\275\355\224\204\353\241\234\354\213\234\354\240\200.sql" "b/DB_\355\224\204\353\241\234\354\213\234\354\240\200,\355\212\270\353\246\254\352\261\260/\354\277\274\353\246\254\353\254\270/\354\235\274\355\232\214\354\232\251\354\240\201\353\246\275\355\224\204\353\241\234\354\213\234\354\240\200.sql" new file mode 100644 index 0000000..9eec39e --- /dev/null +++ "b/DB_\355\224\204\353\241\234\354\213\234\354\240\200,\355\212\270\353\246\254\352\261\260/\354\277\274\353\246\254\353\254\270/\354\235\274\355\232\214\354\232\251\354\240\201\353\246\275\355\224\204\353\241\234\354\213\234\354\240\200.sql" @@ -0,0 +1,59 @@ + +drop procedure disposable_analysis_earn; + +EXEC disposable_analysis_earn '2025-05-03'; + +CREATE PROCEDURE disposable_analysis_earn + @SelectedDate DATETIME +AS +BEGIN + SET NOCOUNT ON; + SELECT + CONVERT(CHAR(19), a1.ps_date, 20) AS ps_date, + a2.ct_code, + a2.ct_name + '(' + a5.ct_phone + ')' AS ct_name, + a1.ps_prname, + CAST(a1.ps_qty AS INT) AS ps_qty, + CAST( + ( + ISNULL(( + SELECT SUM(ps_up * ps_qty) + FROM ps + WHERE pe_id = a1.pe_id and ps_no= a1.ps_no + AND ps_prcode IN ( + SELECT pr_code FROM pr + where kind_code in (select kind_code from disposable_analysis_info where gubun in ('wevape', 'etc')) + ) + ), 0) + ) + + + ( + ISNULL(( + SELECT SUM(ps_up * ps_qty) + FROM ps + WHERE pe_id = a1.pe_id + AND ps_prcode IN ( + SELECT pr_code FROM pr + WHERE kind_code = '1100' + ) + ), 0) + ) + AS INT) AS pe_bamt, + a1.pe_id, + a1.ps_no, + ISNULL(a3.is_earn, 0) AS is_earn, + (case when a1.ps_dc != 0 then 'O' else 'X' end) as is_dc + FROM ps a1 + JOIN pe a2 ON a1.pe_id = a2.pe_id AND a2.ct_code != '' + LEFT JOIN disposable_earn_point_status a3 ON a3.pe_id = a1.pe_id AND a3.ps_no = a1.ps_no + JOIN ac a4 ON a4.pe_id = a1.pe_id AND a4.ac_fncd2 NOT IN ('01', '00') + JOIN ct a5 ON a5.ct_code = a2.ct_code + WHERE + a1.ps_prcode IN ( + SELECT pr_code FROM pr WHERE kind_code IN (select kind_code from disposable_analysis_info where gubun in ('wevape', 'etc')) + ) + AND a1.ps_date >= @SelectedDate + AND a1.ps_date < DATEADD(DAY, 1, @SelectedDate) + ORDER BY + a1.pe_id DESC; +END; \ No newline at end of file diff --git "a/DB_\355\224\204\353\241\234\354\213\234\354\240\200,\355\212\270\353\246\254\352\261\260/\354\277\274\353\246\254\353\254\270/\354\235\274\355\232\214\354\232\251\355\224\204\353\241\234\354\213\234\354\240\200.sql" "b/DB_\355\224\204\353\241\234\354\213\234\354\240\200,\355\212\270\353\246\254\352\261\260/\354\277\274\353\246\254\353\254\270/\354\235\274\355\232\214\354\232\251\355\224\204\353\241\234\354\213\234\354\240\200.sql" new file mode 100644 index 0000000..5d3cc47 --- /dev/null +++ "b/DB_\355\224\204\353\241\234\354\213\234\354\240\200,\355\212\270\353\246\254\352\261\260/\354\277\274\353\246\254\353\254\270/\354\235\274\355\232\214\354\232\251\355\224\204\353\241\234\354\213\234\354\240\200.sql" @@ -0,0 +1,311 @@ +create procedure disposable_analysis_old + @year_month nvarchar(7) -- "YYYY-MM" 형식의 월별 입력값 +as +begin + -- 시작일과 종료일 계산 + declare @start_date datetime; + declare @end_date datetime; + + set @start_date = convert(datetime, @year_month + '-01'); + set @end_date = dateadd(month, 1, @start_date); + + -- 임시 테이블 생성 (판매개수 컬럼으로 변경) + create table #product_sales ( + product_name varchar(100), + product_sales varchar(50), -- 문자열로 저장 (반점 포함) + product_ratio varchar(10), -- 문자열로 저장 + product_qty int -- 판매개수 컬럼 + ); + + -- 매출 계산 + declare @totalamount numeric(18, 0); + declare @disposableamount numeric(18, 0); + + select + @totalamount = sum(ps_amt + ps_vat), + @disposableamount = sum(case when kind.kind_code in (1099, 1105, 1106, 1107, 1108) then ps_amt + ps_vat else 0 end) + from ps + join pr on ps.ps_prcode = pr.pr_code + join kind on pr.kind_code = kind.kind_code + where ps.ps_date >= @start_date and ps.ps_date < @end_date; + + declare @totalamount_str varchar(50); + declare @disposableamount_str varchar(50); + + set @totalamount_str = replace(convert(varchar(50), cast(@totalamount as money), 1), '.00', ''); + set @disposableamount_str = replace(convert(varchar(50), cast(@disposableamount as money), 1), '.00', ''); + + insert into #product_sales + values (@year_month + ' ' + '매출', @totalamount_str, null, null); + + insert into #product_sales + values (@year_month + ' ' + '일회용매출', @disposableamount_str, null, null); + + declare @disposable_ratio varchar(10); + if @totalamount > 0 + begin + set @disposable_ratio = cast(cast(@disposableamount * 100.0 / @totalamount as numeric(5, 2)) as varchar(10)) + '%'; + end + else + begin + set @disposable_ratio = '0%'; + end + + update #product_sales + set product_ratio = @disposable_ratio + where product_name = @year_month + ' ' + '일회용매출'; + + insert into #product_sales + select + pr.pr_name as product_name, + replace(convert(varchar(50), cast(sum(ps.ps_amt + ps.ps_vat) as money), 1), '.00', '') as product_sales, + cast(cast(sum(ps.ps_amt + ps.ps_vat) * 100.0 / nullif(@disposableamount, 0) as numeric(5, 2)) as varchar(10)) + '%' as product_ratio, + sum(ps.ps_qty) as product_qty + from ps + join pr on ps.ps_prcode = pr.pr_code + join kind on pr.kind_code = kind.kind_code + where ps.ps_date >= @start_date and ps.ps_date < @end_date + and kind.kind_code in (1099, 1105, 1106, 1107, 1108) + group by pr.pr_name + having sum(ps.ps_amt + ps.ps_vat) > 0; + + declare @total_qty int; + select @total_qty = sum(ps.ps_qty) + from ps + join pr on ps.ps_prcode = pr.pr_code + join kind on pr.kind_code = kind.kind_code + where ps.ps_date >= @start_date and ps.ps_date < @end_date + and kind.kind_code in (1099, 1105, 1106, 1107, 1108); + + update #product_sales + set product_qty = @total_qty + where product_name = @year_month + ' ' + '일회용매출'; + + -- 최종 결과 출력: 매출 → 일회용매출 → 특정 상품들 → 나머지 + select + product_name as 상품명, + product_sales as 매출, + product_ratio as 비율, + product_qty as 개수 + from #product_sales + order by + case product_name + when @year_month + ' ' + '매출' then 1 + when @year_month + ' ' + '일회용매출' then 2 + when '와카' then 3 + when '쥬피터' then 4 + when '에이스' then 5 + when '크리에이터' then 6 + else 7 + end, + product_name; + + drop table #product_sales; +end; + +-- 실행 예제 +EXEC disposable_analysis @year_month = '2025-01'; + + + + +create procedure disposable_analysis_new + @year_month nvarchar(7) +as +begin + declare @start_date datetime; + declare @end_date datetime; + declare @color1 varchar(50); + declare @color2 varchar(50); + declare @color3 varchar(50); + + set @start_date = convert(datetime, @year_month + '-01'); + set @end_date = dateadd(month, 1, @start_date); + set @color1= 'LightYellow'; + set @color2= 'LightPink'; + set @color3= 'PeachPuff'; + + create table #product_sales ( + product_name varchar(100), + product_sales varchar(50), + product_ratio varchar(10), + product_qty int, + row_color varchar(20) + ); + + declare @totalamount numeric(18, 0); + declare @disposableamount numeric(18, 0); + + select + @totalamount = sum(ps_amt + ps_vat) + from ps + join pr on ps.ps_prcode = pr.pr_code + join kind on pr.kind_code = kind.kind_code + where ps.ps_date >= @start_date and ps.ps_date < @end_date; + + select + @disposableamount = sum(ps_amt + ps_vat) + from ps + join pr on ps.ps_prcode = pr.pr_code + join kind on pr.kind_code = kind.kind_code + join disposable_analysis_info on disposable_analysis_info.gubun in ('wevape', 'etc') and kind.kind_code= disposable_analysis_info.kind_code + where ps.ps_date >= @start_date and ps.ps_date < @end_date; + + declare @totalamount_str varchar(50); + declare @disposableamount_str varchar(50); + + set @totalamount_str = replace(convert(varchar(50), cast(@totalamount as money), 1), '.00', ''); + set @disposableamount_str = replace(convert(varchar(50), cast(@disposableamount as money), 1), '.00', ''); + + insert into #product_sales values (@year_month + ' 매출', @totalamount_str, null, null, @color1); + insert into #product_sales values (@year_month + ' 일회용매출', @disposableamount_str, null, null, @color1); + insert into #product_sales values ('----- 일회용매출 -----', null, null, null, null); + + declare @disposable_ratio varchar(10); + if @totalamount > 0 + set @disposable_ratio = cast(cast(@disposableamount * 100.0 / @totalamount as numeric(5, 2)) as varchar(10)) + '%'; + else + set @disposable_ratio = '0%'; + + update #product_sales + set product_ratio = @disposable_ratio + where product_name = @year_month + ' 일회용매출'; + + -- kind별 통합 매출 (매출 없어도 항상 표시되도록 수정) + insert into #product_sales + select + k.kind_name + ' 총 매출', + replace(convert(varchar(50), cast(isnull(sum(ps.ps_amt + ps.ps_vat), 0) as money), 1), '.00', ''), + case when @disposableamount > 0 then + cast(cast(isnull(sum(ps.ps_amt + ps.ps_vat), 0) * 100.0 / nullif(@disposableamount, 0) as numeric(5, 2)) as varchar(10)) + '%' + else '0%' end, + isnull(sum(ps.ps_qty), 0), + @color2 + from ( + select kind_code, kind_name + from kind + where kind_code in (select kind_code from disposable_analysis_info where gubun in ('wevape')) + ) k + left join pr on k.kind_code = pr.kind_code + left join ps on ps.ps_prcode = pr.pr_code and ps.ps_date >= @start_date and ps.ps_date < @end_date + group by k.kind_name; + + -- '그 외 매출 요약' 추가 + declare @sum_known_kind numeric(18, 0); + declare @etc_qty int; + + select @etc_qty= sum(ps.ps_qty) from ps join pr on ps.ps_prcode= pr.pr_code join kind on kind.kind_code= 1099 and kind.kind_code= pr.kind_code where ps.ps_date >= @start_date and ps.ps_date < @end_date + + select @sum_known_kind = sum(amount) + from ( + select sum(ps.ps_amt + ps.ps_vat) as amount + from ps + join pr on ps.ps_prcode = pr.pr_code + join kind k on pr.kind_code = k.kind_code + where ps.ps_date >= @start_date and ps.ps_date < @end_date + and k.kind_code in (select kind_code from disposable_analysis_info where gubun in ('wevape')) + group by k.kind_code + ) as subquery; + + declare @other_amount numeric(18, 0); + set @other_amount = @disposableamount - isnull(@sum_known_kind, 0); + + insert into #product_sales + values ( + '그 외 매출', + replace(convert(varchar(50), cast(isnull(@other_amount, 0) as money), 1), '.00', ''), + case when @disposableamount > 0 then cast(cast(isnull(@other_amount, 0) * 100.0 / nullif(@disposableamount, 0) as numeric(5, 2)) as varchar(10)) + '%' else '0%' end, + @etc_qty, + @color3 + ); + + -- 상세 매출내용 시작 + insert into #product_sales + values ('----- 상세내역 -----', null, null, null, null); + + -- 상품별 상세 매출 삽입 + insert into #product_sales + select + pr.pr_name, + replace(convert(varchar(50), cast(sum(ps.ps_amt + ps.ps_vat) as money), 1), '.00', ''), + cast(cast(sum(ps.ps_amt + ps.ps_vat) * 100.0 / nullif(@disposableamount, 0) as numeric(5, 2)) as varchar(10)) + '%', + sum(ps.ps_qty), + null + from ps + join pr on ps.ps_prcode = pr.pr_code + join kind on pr.kind_code = kind.kind_code + where ps.ps_date >= @start_date and ps.ps_date < @end_date + and kind.kind_code in (select kind_code from disposable_analysis_info where gubun in ('wevape', 'etc')) + group by pr.pr_name + having sum(ps.ps_amt + ps.ps_vat) > 0; + + -- 총 수량 계산해서 일회용매출에 반영 + declare @total_qty int; + select @total_qty = sum(ps.ps_qty) + from ps + join pr on ps.ps_prcode = pr.pr_code + join kind on pr.kind_code = kind.kind_code + where ps.ps_date >= @start_date and ps.ps_date < @end_date + and kind.kind_code in (select kind_code from disposable_analysis_info where gubun in ('wevape', 'etc')); + + update #product_sales + set product_qty = @total_qty + where product_name = @year_month + ' 일회용매출'; + + -- 최종 결과 + select + product_name as 상품명, + product_sales as 매출, + product_ratio as 비율, + product_qty as 개수, + row_color + from #product_sales + order by + case + when product_name = @year_month + ' 매출' then 1 + when product_name = @year_month + ' 일회용매출' then 2 + when product_name = '----- 일회용매출 -----' then 3 + when (product_name like '% 총 매출') then 4 + when product_name = '그 외 매출' then 5 + when product_name = '----- 상세내역 -----' then 6 + else 7 + end, + product_name; + + drop table #product_sales; +end; + + + + + + + +create procedure disposable_analysis + @year_month nvarchar(7) -- "YYYY-MM" 형식 +as +begin + -- 변수 선언 + declare @standard_month nvarchar(7); + set @standard_month = '2025-05'; + + if @year_month < @standard_month + begin + -- 기준월 이전이면 old 프로시저 호출 + exec disposable_analysis_old @year_month; + end + else + begin + -- 기준월 이후거나 같으면 new 프로시저 호출 + exec disposable_analysis_new @year_month; + end +end; + + + + + +EXEC disposable_analysis_old @year_month = '2025-05'; +EXEC disposable_analysis_new @year_month = '2025-05'; +EXEC disposable_analysis @year_month = '2025-05'; +drop procedure disposable_analysis_new; \ No newline at end of file diff --git a/newton-cn.sln b/newton-cn.sln index fd5c6bc..14ac9b1 100644 --- a/newton-cn.sln +++ b/newton-cn.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.31019.35 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "newton-cn", "newton-cn\newton-cn.csproj", "{2C132434-6883-42E4-A80F-EA6C262A4014}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{46665941-173C-427B-BC46-309B55D60D59}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/newton-cn/DBConnector.cs b/newton-cn/DBConnector.cs index 20763cf..33ebd13 100644 --- a/newton-cn/DBConnector.cs +++ b/newton-cn/DBConnector.cs @@ -10,6 +10,78 @@ namespace newton_cn { class DBConnector { + public DataTable getOtherShop_PS(string shop, string date, string code) + { + DataTable result = new DataTable(); + string procedure = "other_shop_find_ps"; +#if DEBUG + SqlConnection conn = new SqlConnection("Data Source=newton-cn1.iptime.org, 1818; Initial Catalog=food; User ID=newton; Password=newton123!;"); +#else + SqlConnection conn = new SqlConnection("Data Source=localhost; Initial Catalog=food; User ID=newton; Password=newton123!;"); +#endif + conn.Open(); + + + SqlCommand cmd_select = new SqlCommand(procedure, conn); + cmd_select.CommandType = CommandType.StoredProcedure; + + cmd_select.Parameters.Add(new SqlParameter("@month", SqlDbType.NVarChar, 50)).Value = date; + cmd_select.Parameters.Add(new SqlParameter("@shopName", SqlDbType.NVarChar, 50)).Value = shop; + cmd_select.Parameters.Add(new SqlParameter("@ctcode", SqlDbType.NVarChar, 50)).Value = code; + + SqlDataAdapter dataAdapter = new SqlDataAdapter(cmd_select); + dataAdapter.Fill(result); + + return result; + } + public DataTable getOtherShop_CT(string shop, string where, string keyword) + { + DataTable result = new DataTable(); + string procedure = "other_shop_find_ct"; +#if DEBUG + SqlConnection conn = new SqlConnection("Data Source=newton-cn1.iptime.org, 1818; Initial Catalog=food; User ID=newton; Password=newton123!;"); +#else + SqlConnection conn = new SqlConnection("Data Source=localhost; Initial Catalog=food; User ID=newton; Password=newton123!;"); +#endif + conn.Open(); + + + SqlCommand cmd_select = new SqlCommand(procedure, conn); + cmd_select.CommandType = CommandType.StoredProcedure; + + cmd_select.Parameters.Add(new SqlParameter("@shopName", SqlDbType.NVarChar, 50)).Value = shop; + cmd_select.Parameters.Add(new SqlParameter("@searchField", SqlDbType.NVarChar, 50)).Value = where; + cmd_select.Parameters.Add(new SqlParameter("@keyword", SqlDbType.NVarChar, 50)).Value = keyword; + + SqlDataAdapter dataAdapter = new SqlDataAdapter(cmd_select); + dataAdapter.Fill(result); + + return result; + } + public DataTable getOtherShop() + { + DataTable result = new DataTable(); + +#if DEBUG + SqlConnection conn = new SqlConnection("Data Source=newton-cn1.iptime.org, 1818; Initial Catalog=food; User ID=newton; Password=newton123!;"); +#else + SqlConnection conn = new SqlConnection("Data Source=localhost; Initial Catalog=food; User ID=newton; Password=newton123!;"); +#endif + + conn.Open(); + + string sql = ""; + sql += @" + select gubun, name, memo from other_shop + "; + + SqlCommand cmd_select = new SqlCommand(sql, conn); + + SqlDataAdapter dataAdapter = new SqlDataAdapter(cmd_select); + dataAdapter.Fill(result); + + return result; + } public DataTable getDisposableAnalysis(string year_month) { DataTable result = new DataTable(); diff --git a/newton-cn/Form1.cs b/newton-cn/Form1.cs index 939978b..caaac2e 100644 --- a/newton-cn/Form1.cs +++ b/newton-cn/Form1.cs @@ -45,18 +45,22 @@ namespace newton_cn private void button2_Click(object sender, EventArgs e) { - if (MessageBox.Show("메뉴정렬을 시작합니다.", "메뉴정렬", MessageBoxButtons.YesNo) == DialogResult.Yes) - { - if (MessageBox.Show("작동중 조작하지마세요.", "메뉴정렬", MessageBoxButtons.YesNo) == DialogResult.Yes) - { - DBConnector dbc = new DBConnector(); - int kind = dbc.getKind(); + Console.WriteLine("폼띄우기"); + Form7 dlg = new Form7(); + dlg.ShowDialog(); - MouseEvent2 me = new MouseEvent2(kind); + //if (MessageBox.Show("메뉴정렬을 시작합니다.", "메뉴정렬", MessageBoxButtons.YesNo) == DialogResult.Yes) + //{ + // if (MessageBox.Show("작동중 조작하지마세요.", "메뉴정렬", MessageBoxButtons.YesNo) == DialogResult.Yes) + // { + // DBConnector dbc = new DBConnector(); + // int kind = dbc.getKind(); - me.start(); - } - } + // MouseEvent2 me = new MouseEvent2(kind); + + // me.start(); + // } + //} } private void button3_Click(object sender, EventArgs e) diff --git a/newton-cn/Form7.Designer.cs b/newton-cn/Form7.Designer.cs new file mode 100644 index 0000000..932db19 --- /dev/null +++ b/newton-cn/Form7.Designer.cs @@ -0,0 +1,291 @@ +namespace newton_cn +{ + partial class Form7 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.comboBox2 = new System.Windows.Forms.ComboBox(); + this.button1 = new System.Windows.Forms.Button(); + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + this.button2 = new System.Windows.Forms.Button(); + this.btn_7 = new System.Windows.Forms.Button(); + this.btn_8 = new System.Windows.Forms.Button(); + this.btn_9 = new System.Windows.Forms.Button(); + this.btn_5 = new System.Windows.Forms.Button(); + this.btn_4 = new System.Windows.Forms.Button(); + this.btn_6 = new System.Windows.Forms.Button(); + this.btn_1 = new System.Windows.Forms.Button(); + this.btn_2 = new System.Windows.Forms.Button(); + this.btn_3 = new System.Windows.Forms.Button(); + this.btn_0 = new System.Windows.Forms.Button(); + this.btn_delete = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.SuspendLayout(); + // + // comboBox1 + // + this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Location = new System.Drawing.Point(35, 26); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(121, 20); + this.comboBox1.TabIndex = 0; + this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(349, 28); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(112, 21); + this.textBox1.TabIndex = 1; + // + // comboBox2 + // + this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox2.FormattingEnabled = true; + this.comboBox2.Location = new System.Drawing.Point(205, 29); + this.comboBox2.Name = "comboBox2"; + this.comboBox2.Size = new System.Drawing.Size(79, 20); + this.comboBox2.TabIndex = 12; + this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(467, 26); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 13; + this.button1.Text = "검색"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // dataGridView1 + // + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Location = new System.Drawing.Point(180, 68); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.RowTemplate.Height = 23; + this.dataGridView1.Size = new System.Drawing.Size(446, 257); + this.dataGridView1.TabIndex = 15; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(548, 26); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.TabIndex = 16; + this.button2.Text = "상세보기"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // btn_7 + // + this.btn_7.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.btn_7.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.btn_7.Location = new System.Drawing.Point(25, 67); + this.btn_7.Name = "btn_7"; + this.btn_7.Size = new System.Drawing.Size(39, 50); + this.btn_7.TabIndex = 17; + this.btn_7.Text = "7"; + this.btn_7.UseVisualStyleBackColor = false; + this.btn_7.Click += new System.EventHandler(this.btn_7_Click); + // + // btn_8 + // + this.btn_8.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.btn_8.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.btn_8.Location = new System.Drawing.Point(70, 68); + this.btn_8.Name = "btn_8"; + this.btn_8.Size = new System.Drawing.Size(39, 50); + this.btn_8.TabIndex = 18; + this.btn_8.Text = "8"; + this.btn_8.UseVisualStyleBackColor = false; + this.btn_8.Click += new System.EventHandler(this.btn_8_Click); + // + // btn_9 + // + this.btn_9.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.btn_9.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.btn_9.Location = new System.Drawing.Point(115, 68); + this.btn_9.Name = "btn_9"; + this.btn_9.Size = new System.Drawing.Size(39, 50); + this.btn_9.TabIndex = 19; + this.btn_9.Text = "9"; + this.btn_9.UseVisualStyleBackColor = false; + this.btn_9.Click += new System.EventHandler(this.btn_9_Click); + // + // btn_5 + // + this.btn_5.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.btn_5.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.btn_5.Location = new System.Drawing.Point(70, 136); + this.btn_5.Name = "btn_5"; + this.btn_5.Size = new System.Drawing.Size(39, 50); + this.btn_5.TabIndex = 20; + this.btn_5.Text = "5"; + this.btn_5.UseVisualStyleBackColor = false; + this.btn_5.Click += new System.EventHandler(this.btn_5_Click); + // + // btn_4 + // + this.btn_4.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.btn_4.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.btn_4.Location = new System.Drawing.Point(25, 136); + this.btn_4.Name = "btn_4"; + this.btn_4.Size = new System.Drawing.Size(39, 50); + this.btn_4.TabIndex = 21; + this.btn_4.Text = "4"; + this.btn_4.UseVisualStyleBackColor = false; + this.btn_4.Click += new System.EventHandler(this.btn_4_Click); + // + // btn_6 + // + this.btn_6.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.btn_6.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.btn_6.Location = new System.Drawing.Point(115, 136); + this.btn_6.Name = "btn_6"; + this.btn_6.Size = new System.Drawing.Size(39, 50); + this.btn_6.TabIndex = 22; + this.btn_6.Text = "6"; + this.btn_6.UseVisualStyleBackColor = false; + this.btn_6.Click += new System.EventHandler(this.btn_6_Click); + // + // btn_1 + // + this.btn_1.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.btn_1.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.btn_1.Location = new System.Drawing.Point(25, 202); + this.btn_1.Name = "btn_1"; + this.btn_1.Size = new System.Drawing.Size(39, 50); + this.btn_1.TabIndex = 23; + this.btn_1.Text = "1"; + this.btn_1.UseVisualStyleBackColor = false; + this.btn_1.Click += new System.EventHandler(this.btn_1_Click); + // + // btn_2 + // + this.btn_2.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.btn_2.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.btn_2.Location = new System.Drawing.Point(70, 202); + this.btn_2.Name = "btn_2"; + this.btn_2.Size = new System.Drawing.Size(39, 50); + this.btn_2.TabIndex = 24; + this.btn_2.Text = "2"; + this.btn_2.UseVisualStyleBackColor = false; + this.btn_2.Click += new System.EventHandler(this.btn_2_Click); + // + // btn_3 + // + this.btn_3.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.btn_3.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.btn_3.Location = new System.Drawing.Point(115, 202); + this.btn_3.Name = "btn_3"; + this.btn_3.Size = new System.Drawing.Size(39, 50); + this.btn_3.TabIndex = 25; + this.btn_3.Text = "3"; + this.btn_3.UseVisualStyleBackColor = false; + this.btn_3.Click += new System.EventHandler(this.btn_3_Click); + // + // btn_0 + // + this.btn_0.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.btn_0.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.btn_0.Location = new System.Drawing.Point(25, 265); + this.btn_0.Name = "btn_0"; + this.btn_0.Size = new System.Drawing.Size(39, 50); + this.btn_0.TabIndex = 26; + this.btn_0.Text = "0"; + this.btn_0.UseVisualStyleBackColor = false; + this.btn_0.Click += new System.EventHandler(this.btn_0_Click); + // + // btn_delete + // + this.btn_delete.BackColor = System.Drawing.SystemColors.ActiveCaption; + this.btn_delete.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.btn_delete.Location = new System.Drawing.Point(70, 265); + this.btn_delete.Name = "btn_delete"; + this.btn_delete.Size = new System.Drawing.Size(84, 50); + this.btn_delete.TabIndex = 27; + this.btn_delete.Text = "지우기"; + this.btn_delete.UseVisualStyleBackColor = false; + this.btn_delete.Click += new System.EventHandler(this.btn_delete_Click); + // + // Form7 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(639, 337); + this.Controls.Add(this.btn_delete); + this.Controls.Add(this.btn_0); + this.Controls.Add(this.btn_3); + this.Controls.Add(this.btn_2); + this.Controls.Add(this.btn_1); + this.Controls.Add(this.btn_6); + this.Controls.Add(this.btn_4); + this.Controls.Add(this.btn_5); + this.Controls.Add(this.btn_9); + this.Controls.Add(this.btn_8); + this.Controls.Add(this.btn_7); + this.Controls.Add(this.button2); + this.Controls.Add(this.dataGridView1); + this.Controls.Add(this.button1); + this.Controls.Add(this.comboBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.comboBox1); + this.Name = "Form7"; + this.Text = "Form7"; + this.TopMost = true; + this.Load += new System.EventHandler(this.Form7_Load); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.ComboBox comboBox2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.DataGridView dataGridView1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button btn_7; + private System.Windows.Forms.Button btn_8; + private System.Windows.Forms.Button btn_9; + private System.Windows.Forms.Button btn_5; + private System.Windows.Forms.Button btn_4; + private System.Windows.Forms.Button btn_6; + private System.Windows.Forms.Button btn_1; + private System.Windows.Forms.Button btn_2; + private System.Windows.Forms.Button btn_3; + private System.Windows.Forms.Button btn_0; + private System.Windows.Forms.Button btn_delete; + } +} \ No newline at end of file diff --git a/newton-cn/Form7.cs b/newton-cn/Form7.cs new file mode 100644 index 0000000..37e600a --- /dev/null +++ b/newton-cn/Form7.cs @@ -0,0 +1,170 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Windows.Forms; + +namespace newton_cn +{ + public partial class Form7 : Form + { + public Form7() + { + InitializeComponent(); + initComboBox(); + textBox1.Focus(); + dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView1.MultiSelect = false; + dataGridView1.ReadOnly = true; + + + } + + private void initComboBox() + { + DBConnector dbc = new DBConnector(); + + DataTable data = dbc.getOtherShop(); + comboBox1.DataSource = data; + comboBox1.DisplayMember = "name"; + comboBox1.ValueMember = "gubun"; + + comboBox1.SelectedIndex = 0; + + + + DataTable data1 = new DataTable(); + + data1.Columns.Add("gubun", typeof(string)); + data1.Columns.Add("name", typeof(string)); + + DataRow data1_r1 = data1.NewRow(); + data1_r1["gubun"] = "phone"; + data1_r1["name"] = "전화번호"; + data1.Rows.Add(data1_r1); + DataRow data1_r2 = data1.NewRow(); + data1_r2["gubun"] = "name"; + data1_r2["name"] = "이름"; + data1.Rows.Add(data1_r2); + + comboBox2.DataSource = data1; + comboBox2.DisplayMember = "name"; + comboBox2.ValueMember = "gubun"; + comboBox2.SelectedIndex = 0; + } + + private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) + { + + } + + private void Form7_Load(object sender, EventArgs e) + { + this.ActiveControl = textBox1; + } + + + private void button1_Click(object sender, EventArgs e) + { + string shop = comboBox1.SelectedValue.ToString(); + string where = comboBox2.SelectedValue.ToString(); + string keyword = textBox1.Text; + + Console.WriteLine(shop); + Console.WriteLine(where); + Console.WriteLine(keyword); + + DBConnector dbc = new DBConnector(); + dataGridView1.DataSource = dbc.getOtherShop_CT(shop, where, keyword); + + for(int i=0; i 3) dataGridView1.Columns[i].Visible = false; + } + + textBox1.Text = ""; + } + + private void button2_Click(object sender, EventArgs e) + { + try + { + List data = new List(); + Console.WriteLine(dataGridView1.SelectedRows[0].Cells.Count); + for (int i = 0; i < dataGridView1.SelectedRows[0].Cells.Count; i++) + { + data.Add(dataGridView1.SelectedRows[0].Cells[i].Value.ToString()); + } + data.Add(comboBox1.SelectedValue.ToString()); //detail[16] + + Form8 frm = new Form8(); + frm.Detail = data; + frm.ShowDialog(); + } + catch (Exception) + { + + } + + } + + private void btn_delete_Click(object sender, EventArgs e) + { + textBox1.Text = ""; + } + + private void btn_0_Click(object sender, EventArgs e) + { + textBox1.Text = textBox1.Text + "0"; + } + + private void btn_1_Click(object sender, EventArgs e) + { + textBox1.Text = textBox1.Text + "1"; + } + + private void btn_2_Click(object sender, EventArgs e) + { + textBox1.Text = textBox1.Text + "2"; + } + + private void btn_3_Click(object sender, EventArgs e) + { + textBox1.Text = textBox1.Text + "3"; + } + + private void btn_4_Click(object sender, EventArgs e) + { + textBox1.Text = textBox1.Text + "4"; + } + + private void btn_5_Click(object sender, EventArgs e) + { + textBox1.Text = textBox1.Text + "5"; + } + + private void btn_6_Click(object sender, EventArgs e) + { + textBox1.Text = textBox1.Text + "6"; + } + + private void btn_7_Click(object sender, EventArgs e) + { + textBox1.Text = textBox1.Text + "7"; + } + + private void btn_8_Click(object sender, EventArgs e) + { + textBox1.Text = textBox1.Text + "8"; + } + + private void btn_9_Click(object sender, EventArgs e) + { + textBox1.Text = textBox1.Text + "9"; + } + + private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) + { + + } + } +} diff --git a/newton-cn/Form7.resx b/newton-cn/Form7.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/newton-cn/Form7.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/newton-cn/Form8.Designer.cs b/newton-cn/Form8.Designer.cs new file mode 100644 index 0000000..b770156 --- /dev/null +++ b/newton-cn/Form8.Designer.cs @@ -0,0 +1,453 @@ +namespace newton_cn +{ + partial class Form8 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.textbox_name = new System.Windows.Forms.TextBox(); + this.textbox_phone = new System.Windows.Forms.TextBox(); + this.textbox_zipcode = new System.Windows.Forms.TextBox(); + this.textbox_cphone = new System.Windows.Forms.TextBox(); + this.textbox_addr1 = new System.Windows.Forms.TextBox(); + this.textbox_addr2 = new System.Windows.Forms.TextBox(); + this.textbox_no = new System.Windows.Forms.TextBox(); + this.textbox_birth = new System.Windows.Forms.TextBox(); + this.textbox_memo = new System.Windows.Forms.TextBox(); + this.textbox_visitd = new System.Windows.Forms.TextBox(); + this.textbox_visitn = new System.Windows.Forms.TextBox(); + this.textbox_tpoint = new System.Windows.Forms.TextBox(); + this.textbox_rpoint = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); + this.label14 = new System.Windows.Forms.Label(); + this.textbox_totalsale = new System.Windows.Forms.TextBox(); + this.label15 = new System.Windows.Forms.Label(); + this.textbox_ctdate = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.label16 = new System.Windows.Forms.Label(); + this.dataGridView1 = new System.Windows.Forms.DataGridView(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + this.SuspendLayout(); + // + // textbox_name + // + this.textbox_name.Location = new System.Drawing.Point(89, 35); + this.textbox_name.Name = "textbox_name"; + this.textbox_name.ReadOnly = true; + this.textbox_name.Size = new System.Drawing.Size(100, 21); + this.textbox_name.TabIndex = 0; + // + // textbox_phone + // + this.textbox_phone.Location = new System.Drawing.Point(89, 62); + this.textbox_phone.Name = "textbox_phone"; + this.textbox_phone.ReadOnly = true; + this.textbox_phone.Size = new System.Drawing.Size(100, 21); + this.textbox_phone.TabIndex = 1; + // + // textbox_zipcode + // + this.textbox_zipcode.Location = new System.Drawing.Point(89, 89); + this.textbox_zipcode.Name = "textbox_zipcode"; + this.textbox_zipcode.ReadOnly = true; + this.textbox_zipcode.Size = new System.Drawing.Size(100, 21); + this.textbox_zipcode.TabIndex = 2; + // + // textbox_cphone + // + this.textbox_cphone.Location = new System.Drawing.Point(276, 62); + this.textbox_cphone.Name = "textbox_cphone"; + this.textbox_cphone.ReadOnly = true; + this.textbox_cphone.Size = new System.Drawing.Size(100, 21); + this.textbox_cphone.TabIndex = 3; + // + // textbox_addr1 + // + this.textbox_addr1.Location = new System.Drawing.Point(89, 116); + this.textbox_addr1.Name = "textbox_addr1"; + this.textbox_addr1.ReadOnly = true; + this.textbox_addr1.Size = new System.Drawing.Size(287, 21); + this.textbox_addr1.TabIndex = 4; + // + // textbox_addr2 + // + this.textbox_addr2.Location = new System.Drawing.Point(89, 143); + this.textbox_addr2.Name = "textbox_addr2"; + this.textbox_addr2.ReadOnly = true; + this.textbox_addr2.Size = new System.Drawing.Size(287, 21); + this.textbox_addr2.TabIndex = 5; + // + // textbox_no + // + this.textbox_no.Location = new System.Drawing.Point(89, 170); + this.textbox_no.Name = "textbox_no"; + this.textbox_no.ReadOnly = true; + this.textbox_no.Size = new System.Drawing.Size(100, 21); + this.textbox_no.TabIndex = 6; + // + // textbox_birth + // + this.textbox_birth.Location = new System.Drawing.Point(89, 197); + this.textbox_birth.Name = "textbox_birth"; + this.textbox_birth.ReadOnly = true; + this.textbox_birth.Size = new System.Drawing.Size(100, 21); + this.textbox_birth.TabIndex = 7; + // + // textbox_memo + // + this.textbox_memo.Location = new System.Drawing.Point(89, 224); + this.textbox_memo.Name = "textbox_memo"; + this.textbox_memo.ReadOnly = true; + this.textbox_memo.Size = new System.Drawing.Size(287, 21); + this.textbox_memo.TabIndex = 8; + // + // textbox_visitd + // + this.textbox_visitd.Location = new System.Drawing.Point(89, 251); + this.textbox_visitd.Name = "textbox_visitd"; + this.textbox_visitd.ReadOnly = true; + this.textbox_visitd.Size = new System.Drawing.Size(100, 21); + this.textbox_visitd.TabIndex = 9; + // + // textbox_visitn + // + this.textbox_visitn.Location = new System.Drawing.Point(89, 278); + this.textbox_visitn.Name = "textbox_visitn"; + this.textbox_visitn.ReadOnly = true; + this.textbox_visitn.Size = new System.Drawing.Size(100, 21); + this.textbox_visitn.TabIndex = 10; + // + // textbox_tpoint + // + this.textbox_tpoint.Location = new System.Drawing.Point(89, 305); + this.textbox_tpoint.Name = "textbox_tpoint"; + this.textbox_tpoint.ReadOnly = true; + this.textbox_tpoint.Size = new System.Drawing.Size(100, 21); + this.textbox_tpoint.TabIndex = 11; + // + // textbox_rpoint + // + this.textbox_rpoint.Location = new System.Drawing.Point(137, 332); + this.textbox_rpoint.Name = "textbox_rpoint"; + this.textbox_rpoint.ReadOnly = true; + this.textbox_rpoint.Size = new System.Drawing.Size(100, 21); + this.textbox_rpoint.TabIndex = 12; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(25, 38); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(29, 12); + this.label1.TabIndex = 14; + this.label1.Text = "이름"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(25, 65); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(53, 12); + this.label2.TabIndex = 15; + this.label2.Text = "전화번호"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(218, 65); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(53, 12); + this.label3.TabIndex = 16; + this.label3.Text = "휴대전화"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(25, 92); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(53, 12); + this.label4.TabIndex = 17; + this.label4.Text = "우편번호"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(25, 119); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(35, 12); + this.label5.TabIndex = 18; + this.label5.Text = "주소1"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(25, 146); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(35, 12); + this.label6.TabIndex = 19; + this.label6.Text = "주소2"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(25, 173); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(53, 12); + this.label7.TabIndex = 20; + this.label7.Text = "확인번호"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(25, 200); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(53, 12); + this.label8.TabIndex = 21; + this.label8.Text = "생년월일"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(25, 227); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(29, 12); + this.label9.TabIndex = 22; + this.label9.Text = "메모"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(25, 254); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(53, 12); + this.label10.TabIndex = 23; + this.label10.Text = "최종방문"; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(25, 281); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(53, 12); + this.label11.TabIndex = 24; + this.label11.Text = "방문횟수"; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(25, 308); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(65, 12); + this.label12.TabIndex = 25; + this.label12.Text = "누적포인트"; + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.label13.ForeColor = System.Drawing.Color.Red; + this.label13.Location = new System.Drawing.Point(25, 335); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(106, 12); + this.label13.TabIndex = 26; + this.label13.Text = "사용 가능 포인트"; + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(206, 9); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(65, 12); + this.label14.TabIndex = 27; + this.label14.Text = "총구매금액"; + // + // textbox_totalsale + // + this.textbox_totalsale.Location = new System.Drawing.Point(276, 6); + this.textbox_totalsale.Name = "textbox_totalsale"; + this.textbox_totalsale.ReadOnly = true; + this.textbox_totalsale.Size = new System.Drawing.Size(100, 21); + this.textbox_totalsale.TabIndex = 28; + // + // label15 + // + this.label15.AutoSize = true; + this.label15.Location = new System.Drawing.Point(25, 9); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(65, 12); + this.label15.TabIndex = 29; + this.label15.Text = "회원가입일"; + // + // textbox_ctdate + // + this.textbox_ctdate.Location = new System.Drawing.Point(89, 6); + this.textbox_ctdate.Name = "textbox_ctdate"; + this.textbox_ctdate.ReadOnly = true; + this.textbox_ctdate.Size = new System.Drawing.Size(100, 21); + this.textbox_ctdate.TabIndex = 30; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("굴림", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.button1.Location = new System.Drawing.Point(651, 12); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(38, 41); + this.button1.TabIndex = 31; + this.button1.Text = "<"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Font = new System.Drawing.Font("굴림", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.button2.Location = new System.Drawing.Point(705, 12); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(38, 41); + this.button2.TabIndex = 32; + this.button2.Text = ">"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // label16 + // + this.label16.AutoSize = true; + this.label16.Font = new System.Drawing.Font("굴림", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); + this.label16.Location = new System.Drawing.Point(415, 19); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(89, 24); + this.label16.TabIndex = 33; + this.label16.Text = "label16"; + // + // dataGridView1 + // + this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView1.Location = new System.Drawing.Point(419, 65); + this.dataGridView1.Name = "dataGridView1"; + this.dataGridView1.ReadOnly = true; + this.dataGridView1.RowTemplate.Height = 23; + this.dataGridView1.Size = new System.Drawing.Size(324, 364); + this.dataGridView1.TabIndex = 34; + // + // Form8 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(756, 450); + this.Controls.Add(this.dataGridView1); + this.Controls.Add(this.label16); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textbox_ctdate); + this.Controls.Add(this.label15); + this.Controls.Add(this.textbox_totalsale); + this.Controls.Add(this.label14); + this.Controls.Add(this.label13); + this.Controls.Add(this.label12); + this.Controls.Add(this.label11); + this.Controls.Add(this.label10); + this.Controls.Add(this.label9); + this.Controls.Add(this.label8); + this.Controls.Add(this.label7); + this.Controls.Add(this.label6); + this.Controls.Add(this.label5); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.textbox_rpoint); + this.Controls.Add(this.textbox_tpoint); + this.Controls.Add(this.textbox_visitn); + this.Controls.Add(this.textbox_visitd); + this.Controls.Add(this.textbox_memo); + this.Controls.Add(this.textbox_birth); + this.Controls.Add(this.textbox_no); + this.Controls.Add(this.textbox_addr2); + this.Controls.Add(this.textbox_addr1); + this.Controls.Add(this.textbox_cphone); + this.Controls.Add(this.textbox_zipcode); + this.Controls.Add(this.textbox_phone); + this.Controls.Add(this.textbox_name); + this.Name = "Form8"; + this.Text = "Form8"; + this.TopMost = true; + this.Load += new System.EventHandler(this.Form8_Load); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox textbox_name; + private System.Windows.Forms.TextBox textbox_phone; + private System.Windows.Forms.TextBox textbox_zipcode; + private System.Windows.Forms.TextBox textbox_cphone; + private System.Windows.Forms.TextBox textbox_addr1; + private System.Windows.Forms.TextBox textbox_addr2; + private System.Windows.Forms.TextBox textbox_no; + private System.Windows.Forms.TextBox textbox_birth; + private System.Windows.Forms.TextBox textbox_memo; + private System.Windows.Forms.TextBox textbox_visitd; + private System.Windows.Forms.TextBox textbox_visitn; + private System.Windows.Forms.TextBox textbox_tpoint; + private System.Windows.Forms.TextBox textbox_rpoint; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.TextBox textbox_totalsale; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.TextBox textbox_ctdate; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.DataGridView dataGridView1; + } +} \ No newline at end of file diff --git a/newton-cn/Form8.cs b/newton-cn/Form8.cs new file mode 100644 index 0000000..c5eb0cb --- /dev/null +++ b/newton-cn/Form8.cs @@ -0,0 +1,136 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace newton_cn +{ + public partial class Form8 : Form + { + public List Detail; + int year = 0; + int month = 0; + public Form8() + { + InitializeComponent(); + dataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True; + dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; + dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; + } + + private void getDate(int append) + { + + if (append == 0) + { + DateTime today = DateTime.Today; + year = today.Year; + month = today.Month; + } + if (append != 0) + { + if (append < 0) + { + if (month - 1 == 0) + { + month = 12; + year -= 1; + } + else + { + month -= 1; + } + } + else if (append > 0) + { + if (month + 1 == 13) + { + month = 1; + year += 1; + } + else + { + month += 1; + } + } + + } + + + } + + private void Form8_Load(object sender, EventArgs e) + { + DateTime today = DateTime.Today; + + textbox_name.Text = Detail[1]; + textbox_phone.Text = Detail[2]; + textbox_cphone.Text = Detail[3]; + textbox_zipcode.Text = Detail[4]; + textbox_addr1.Text = Detail[5]; + textbox_addr2.Text = Detail[6]; + textbox_memo.Text = Detail[7]; + textbox_no.Text = Detail[8]; + textbox_birth.Text = Detail[9]; + textbox_tpoint.Text = string.Format("{0:n0}", Convert.ToInt32(Detail[10].Split('.')[0])); + textbox_rpoint.Text = string.Format("{0:n0}", Convert.ToInt32(Detail[11].Split('.')[0])); + textbox_visitn.Text = Detail[12]; + textbox_totalsale.Text = string.Format("{0:n0}", Convert.ToInt32(Detail[13].Split('.')[0])); + textbox_visitd.Text = Detail[14]; + textbox_ctdate.Text = Detail[15]; + + getDate(0); + + label16.Text = year.ToString() + "-" + month.ToString(); + string p_date = year.ToString() + "-" + month.ToString(); + string p_shop = Detail[16]; + string p_code = Detail[0]; + + DBConnector dbc = new DBConnector(); + dataGridView1.DataSource = dbc.getOtherShop_PS(p_shop, p_date, p_code); + dataGridView1.DataSource = dbc.getOtherShop_PS(p_shop, p_date, p_code); + dataGridView1.Columns[2].DefaultCellStyle.Format = "N0"; + dataGridView1.Columns[3].DefaultCellStyle.Format = "N0"; + + + DataGridViewCellStyle dgvCellStyle = new DataGridViewCellStyle(); + dgvCellStyle.Padding = new Padding(5, 5, 5, 5); + dataGridView1.Columns[0].DefaultCellStyle = dgvCellStyle; + dataGridView1.Columns[1].DefaultCellStyle = dgvCellStyle; + dataGridView1.Columns[2].DefaultCellStyle = dgvCellStyle; + dataGridView1.Columns[3].DefaultCellStyle = dgvCellStyle; + } + + private void button1_Click(object sender, EventArgs e) + { + getDate(-1); + + label16.Text = year.ToString() + "-" + month.ToString(); + + string p_date = year.ToString() + "-" + month.ToString(); + string p_shop = Detail[16]; + string p_code = Detail[0]; + + DBConnector dbc = new DBConnector(); + dataGridView1.DataSource = dbc.getOtherShop_PS(p_shop, p_date, p_code); + dataGridView1.Columns[2].DefaultCellStyle.Format = "N0"; + dataGridView1.Columns[3].DefaultCellStyle.Format = "N0"; + } + + private void button2_Click(object sender, EventArgs e) + { + getDate(+1); + + label16.Text = year.ToString() + "-" + month.ToString(); + + string p_date = year.ToString() + "-" + month.ToString(); + string p_shop = Detail[16]; + string p_code = Detail[0]; + + DBConnector dbc = new DBConnector(); + dataGridView1.DataSource = dbc.getOtherShop_PS(p_shop, p_date, p_code); + dataGridView1.DataSource = dbc.getOtherShop_PS(p_shop, p_date, p_code); + dataGridView1.Columns[2].DefaultCellStyle.Format = "N0"; + dataGridView1.Columns[3].DefaultCellStyle.Format = "N0"; + } + } +} diff --git a/newton-cn/Form8.resx b/newton-cn/Form8.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/newton-cn/Form8.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/newton-cn/bin/Debug/newton-cn.exe b/newton-cn/bin/Debug/newton-cn.exe index 0f72d96..705c15d 100644 Binary files a/newton-cn/bin/Debug/newton-cn.exe and b/newton-cn/bin/Debug/newton-cn.exe differ diff --git a/newton-cn/bin/Debug/newton-cn.pdb b/newton-cn/bin/Debug/newton-cn.pdb index 308e911..d10b1c4 100644 Binary files a/newton-cn/bin/Debug/newton-cn.pdb and b/newton-cn/bin/Debug/newton-cn.pdb differ diff --git a/newton-cn/newton-cn.csproj b/newton-cn/newton-cn.csproj index 5b682bb..87599c4 100644 --- a/newton-cn/newton-cn.csproj +++ b/newton-cn/newton-cn.csproj @@ -80,6 +80,18 @@ Form6.cs + + Form + + + Form7.cs + + + Form + + + Form8.cs + Component @@ -137,6 +149,12 @@ Form6.cs + + Form7.cs + + + Form8.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index b427b6c..35bdfd3 100644 Binary files a/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/newton-cn/obj/Debug/newton-cn.csproj.AssemblyReference.cache b/newton-cn/obj/Debug/newton-cn.csproj.AssemblyReference.cache index f5e894a..aad38d8 100644 Binary files a/newton-cn/obj/Debug/newton-cn.csproj.AssemblyReference.cache and b/newton-cn/obj/Debug/newton-cn.csproj.AssemblyReference.cache differ diff --git a/newton-cn/obj/Debug/newton-cn.csproj.CoreCompileInputs.cache b/newton-cn/obj/Debug/newton-cn.csproj.CoreCompileInputs.cache index 2c3bfcf..5e31e4a 100644 --- a/newton-cn/obj/Debug/newton-cn.csproj.CoreCompileInputs.cache +++ b/newton-cn/obj/Debug/newton-cn.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -77becbbe38540d75bcab8131eb90cecf1ed49f05 +abb06ad62a4ea174c92fc3a2aa27263fcc5d39a6 diff --git a/newton-cn/obj/Debug/newton-cn.csproj.FileListAbsolute.txt b/newton-cn/obj/Debug/newton-cn.csproj.FileListAbsolute.txt index c4f1fdc..1462588 100644 --- a/newton-cn/obj/Debug/newton-cn.csproj.FileListAbsolute.txt +++ b/newton-cn/obj/Debug/newton-cn.csproj.FileListAbsolute.txt @@ -35,3 +35,5 @@ z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Debug\newton-cn.cs z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Debug\newton-cn.exe z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Debug\newton-cn.pdb z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Debug\newton-cn.csproj.AssemblyReference.cache +z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Debug\newton_cn.Form7.resources +z:\바탕 화면\insang\workspace\newton-cn_pos\newton-cn\obj\Debug\newton_cn.Form8.resources diff --git a/newton-cn/obj/Debug/newton-cn.csproj.GenerateResource.cache b/newton-cn/obj/Debug/newton-cn.csproj.GenerateResource.cache index d20a9ec..f9d37c7 100644 Binary files a/newton-cn/obj/Debug/newton-cn.csproj.GenerateResource.cache and b/newton-cn/obj/Debug/newton-cn.csproj.GenerateResource.cache differ diff --git a/newton-cn/obj/Debug/newton-cn.exe b/newton-cn/obj/Debug/newton-cn.exe index 0f72d96..705c15d 100644 Binary files a/newton-cn/obj/Debug/newton-cn.exe and b/newton-cn/obj/Debug/newton-cn.exe differ diff --git a/newton-cn/obj/Debug/newton-cn.pdb b/newton-cn/obj/Debug/newton-cn.pdb index 308e911..d10b1c4 100644 Binary files a/newton-cn/obj/Debug/newton-cn.pdb and b/newton-cn/obj/Debug/newton-cn.pdb differ diff --git a/newton-cn/obj/Debug/newton_cn.Form7.resources b/newton-cn/obj/Debug/newton_cn.Form7.resources new file mode 100644 index 0000000..06c24d0 Binary files /dev/null and b/newton-cn/obj/Debug/newton_cn.Form7.resources differ diff --git a/newton-cn/obj/Debug/newton_cn.Form8.resources b/newton-cn/obj/Debug/newton_cn.Form8.resources new file mode 100644 index 0000000..06c24d0 Binary files /dev/null and b/newton-cn/obj/Debug/newton_cn.Form8.resources differ