{"text_format":"2","workbook":"xlsx","n_sheets":9,"sheets":["工作表2","Log記錄流程","Table Schema","sp_ChangeSalesStatus","DB Trigger","Function","後台介面","ZH修改記錄","Notice"],"not_rendered":{"charts":0,"images":2,"macros":0,"external_links":0,"defined_names":0,"comments":1,"pivot_tables":0},"unopened":[],"bounds":{"document_bytes":16777216,"sheet_cells":100000,"run_cost":"one","rows_first":2000,"rows_last":500,"rows_between":2000,"halvings":0,"cell_chars":16384,"cell_head_chars":4096},"cells_cut":0,"cells_raw":0,"read":"whole","date_system":"1900"}

{"sheet":"工作表2","index":0,"n_rows":2,"n_cols":3,"rows_kept":2,"cut":false,"hidden":false,"merged":[[6,2,6,8],[7,2,7,8],[8,2,8,8],[0,2,0,8],[1,2,1,8],[2,2,2,8],[3,2,3,8],[4,2,4,8],[5,2,5,8]]}
["Time","Name","Remark"]
["2021-01-25","Tobey","透過ZH增加Oid_Log 統整規格書"]

{"sheet":"Log記錄流程","index":1,"n_rows":1,"n_cols":1,"rows_kept":1,"cut":false,"hidden":false,"merged":[]}
["Workflow"]

{"sheet":"Table Schema","index":2,"n_rows":26,"n_cols":11,"rows_kept":26,"cut":false,"hidden":false,"merged":[[0,8,0,9]]}
["Oid_Log","name","type","null","desc",null,null,null,"DataType清單",null,"ZH"]
["PK","Serno","bigint",{"$nulls":6},"DynaSmart受注(contract)","DynaSmart訂單(contract)"]
[null,"DataType","nvarchar(30)",{"$nulls":6},"DynaSmart受注(sales)","DynaSmart訂單(sales)"]
[null,"Action","nvarchar(10)",null,"Modify,CSVダウンロード",{"$nulls":4},"DynaSmart受注(ship)","DynaSmart訂單(ship)"]
[null,"csvType","nvarchar(20)","V",{"$nulls":5},"DynaSmart受注(status)"]
[null,"Keyword","nvarchar(4000)","V",{"$nulls":5},"DynaSmart受注管理","年度授權訂單資料"]
[null,"Modify","nvarchar(4000)","V",{"$nulls":5},"DynaSmart契約(contract)","DynaSmart契約(contract)"]
[null,"Modify_Serno","bigint","V","修改記錄序號",{"$nulls":4},"DynaSmart契約(contract_list)","DynaSmart契約(contract_list)"]
[null,"Cdate","datetime",{"$nulls":6},"DynaSmart契約(license)"]
[null,"Oid","int",{"$nulls":6},"DynaSmart契約管理","年度授權產品契約管理"]
[{"$nulls":9},"EC受注(sales)","EC訂單(sales)"]
[{"$nulls":9},"EC受注(ship)","EC訂單(ship)"]
[{"$nulls":9},"EC受注(status)"]
[{"$nulls":9},"EC受注管理","EC訂單資料"]
[{"$nulls":9},"ライセンス受注(contract)"]
[{"$nulls":9},"ライセンス受注(status)"]
[{"$nulls":9},"ライセンス受注管理"]
[{"$nulls":9},"ライセンス契約(contract)"]
[{"$nulls":9},"ライセンス契約(contract_list)"]
[{"$nulls":9},"ライセンス契約(license)"]
[{"$nulls":9},"ライセンス契約管理","盒裝授權契約管理"]
[{"$nulls":9},"顧客アンケート"]
[{"$nulls":9},"顧客管理"]
[{"$nulls":9},"顧客管理(法人)","顧客管理(法人)"]
[{"$nulls":9},"顧客管理(個人)","顧客管理(個人)"]
[{"$nulls":9},"ライセンス受注(ship)","License訂單(ship)"]

{"sheet":"sp_ChangeSalesStatus","index":3,"n_rows":105,"n_cols":9,"rows_kept":105,"cut":false,"hidden":false,"merged":[]}
["銷售狀態異動log 表"]
["IF ((@new_status_id not in (0,10,11,17,20,33,35,42,44)) OR (@succ = 'C'))"]
[null,null,"BEGIN"]
[]
[null,null,null,"BEGIN TRANSACTION;"]
[]
[{"$nulls":4},"BEGIN TRY"]
[{"$nulls":5},"SET @sales_type_str = "]
[{"$nulls":6},"CASE"]
[{"$nulls":6},"WHEN @sales_type = 1 THEN 'EC受注(status)'"]
[{"$nulls":6},"WHEN @sales_type = 2 THEN 'DynaSmart受注(status)'"]
[{"$nulls":6},"WHEN @sales_type = 3 THEN N'ライセンス受注(status)'"]
[{"$nulls":6},"ELSE ''"]
[{"$nulls":6},"END;"]
[{"$nulls":5},"INSERT INTO [Oid_Log] ("]
["                            [DataType]"]
["                            ,[Action]"]
["                            ,[Modify_Serno]"]
["                            ,[Oid]"]
["                        ) VALUES ("]
["                            @sales_type_str"]
["                            ,'Modify'"]
["                            ,(SELECT [sales_status_id] from [sales_status] where sales_status_flag = 1 AND sales_id = @sales_id)"]
["                            ,@staff_id"]
["                        );"]
[{"$nulls":6},"UPDATE [Oid_Log] SET [Modify] = (SELECT "]
[{"$nulls":7},"  CASE WHEN (ISNULL(CONVERT(nvarchar(max),@old_status_id),'') <> ISNULL(CONVERT(nvarchar(max),@new_status_id),'')) THEN N'ステータス：' + ISNULL((SELECT CONVERT(nvarchar(max),[status_name]) FROM [status] WHERE [status_id]=@old_status_id),'')+'->'+ISNULL((SELECT CONVERT(nvarchar(max),[status_name]) FROM [status] WHERE [status_id]=@new_status_id),'')+',' ELSE '' END "]
[{"$nulls":7},"  )"]
[{"$nulls":6},"WHERE [DataType] = @sales_type_str"]
[{"$nulls":6},"AND [Action] = 'Modify' "]
[{"$nulls":6},"AND [Modify_Serno] = (SELECT [sales_status_id] from [sales_status] where sales_status_flag = 1 AND sales_id = @sales_id) AND ([Modify] is NULL or [Modify] = '');"]
[{"$nulls":6},"DELETE FROM [Oid_Log] WHERE ([Modify] is NULL or [Modify] = '') AND [DataType] = @sales_type_str AND [Action] = 'Modify' ;"]
[]
[]
[{"$nulls":5},"UPDATE Sales_Status SET sales_status_flag = 0 WHERE sales_status_flag = 1 AND sales_id = @sales_id;"]
[{"$nulls":4},"   "]
[{"$nulls":5},"INSERT INTO Sales_Status (sales_id, status_id, sales_status_date, sales_status_flag, staff_id)"]
[{"$nulls":5},"VALUES (@sales_id, @new_status_id, Getdate(), 1, @staff_id);"]
[]
[]
[{"$nulls":4},"END TRY"]
[{"$nulls":4},"BEGIN CATCH"]
[{"$nulls":4},"    ROLLBACK TRANSACTION;"]
[{"$nulls":4},"    RETURN;"]
[{"$nulls":4},"END CATCH; "]
[]
[{"$nulls":4},"IF (@new_status_id in (3, 7, 8, 9, 16, 27, 28, 32, 29, 36, 41))",{"$f":"--針對未入帳/取消的 sales_status, 連帶更新契約的 contract_status, 但要限目前契約中才行","v":{"$error":"#NAME?"}}]
[{"$nulls":4},"BEGIN"]
[{"$nulls":5},"IF ((SELECT COUNT(*) FROM Contract WHERE sales_id = @sales_id AND contract_status = 1) > 0)"]
[{"$nulls":5},"BEGIN"]
[{"$nulls":6},"UPDATE Contract SET contract_status = 0",{"$f":"--未契約","v":{"$error":"#NAME?"}}]
[{"$nulls":6},"WHERE sales_id = @sales_id"]
[{"$nulls":7},"AND contract_status = 1;",{"$f":"--契約中","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"END;"]
[{"$nulls":4},"END;"]
[]
[{"$nulls":4},"IF (@succ = 'C')",{"$f":"--此次異動 sales_status 之前, 已有付過款項的記錄","v":{"$error":"#NAME?"}}]
[{"$nulls":4},"BEGIN"]
[{"$nulls":5},{"$f":"--連帶更新契約的 contract_status (可能會沒有更新到資料, 因為該製品沒有產生契約的必要 或是 切換已付款裡的不同 stauts)","v":{"$error":"#NAME?"}}]
[]
[{"$nulls":6},"UPDATE Contract SET contract_status = 1",{"$f":"--契約中","v":{"$error":"#NAME?"}}]
[{"$nulls":6},"WHERE sales_id = @sales_id"]
[{"$nulls":7},"AND contract_status = 0;",{"$f":"--未契約","v":{"$error":"#NAME?"}}]
[{"$nulls":4},"END;"]
[]
[{"$nulls":4},"SET @mail_id ="]
[{"$nulls":5},"CASE"]
[{"$nulls":5},"WHEN @succ = 'C' THEN 0"]
[]
[{"$nulls":5},"WHEN ((@sales_type = 1) AND (@new_status_id = 9) AND (@contract_type = 'ECNEW')) THEN 12",{"$f":"--EC受注 + 銀行入金待(新規購入)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 1) AND (@sales_collect = 1) AND (@new_status_id = 10) AND (@contract_type = 'ECNEW')) THEN 13",{"$f":"--EC受注 + 銀行入金濟(新規購入)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 1) AND (@sales_collect = 3) AND (@new_status_id = 11) AND (@contract_type = 'ECNEW')) THEN 15",{"$f":"--EC受注 + 信用卡處理濟(新規購入)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 1) AND (@new_status_id = 0)) THEN 1",{"$f":"--EC受注 + 新規","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 1) AND (@new_status_id = 2)) THEN 3",{"$f":"--EC受注 + 出荷","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 1) AND (@new_status_id = 3)) THEN 14",{"$f":"--EC受注 + 取消訂單","v":{"$error":"#NAME?"}}]
[]
[{"$nulls":5},"WHEN ((@sales_type = 2) AND (@new_status_id = 32) AND (@contract_type = 'DSNEW')) THEN 45",{"$f":"--DS受注 + 銀行入金待(新規購入)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 2) AND (@sales_collect = 1) AND (@new_status_id = 33) AND (@contract_type = 'DSNEW')) THEN 46",{"$f":"--DS受注 + 銀行入金濟(新規購入)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 2) AND (@sales_collect = 3) AND (@new_status_id = 35) AND (@contract_type = 'DSNEW')) THEN 47",{"$f":"--DS受注 + 信用卡處理濟(新規購入)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 2) AND (@new_status_id = 32) AND (@contract_type = 'DSADD')) THEN 59",{"$f":"--DS受注 + 銀行入金待(追加購入)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 2) AND (@sales_collect = 1) AND (@new_status_id = 33) AND (@contract_type = 'DSADD')) THEN 62",{"$f":"--DS受注 + 銀行入金濟(追加購入)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 2) AND (@sales_collect = 3) AND (@new_status_id = 35) AND (@contract_type = 'DSADD')) THEN 64",{"$f":"--DS受注 + 信用卡處理濟(追加購入)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 2) AND (@new_status_id = 32) AND (@contract_type = 'DSREN')) THEN 60",{"$f":"--DS受注 + 銀行入金待(更新購入)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 2) AND (@sales_collect = 1) AND (@new_status_id = 33) AND (@contract_type = 'DSREN')) THEN 63",{"$f":"--DS受注 + 銀行入金濟(更新購入)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 2) AND (@sales_collect = 3) AND (@new_status_id = 35) AND (@contract_type = 'DSREN')) THEN 65",{"$f":"--DS受注 + 信用卡處理濟(更新購入)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"--WHEN ((@sales_type = 2) AND (@new_status_id = 14)) THEN 48",{"$f":"--DS受注 + 出荷 (系統不直接寄信給顧客,由華康人工寄信)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 2) AND (@new_status_id = 16)) THEN 49",{"$f":"--DS受注 + 取消訂單","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 2) AND (@new_status_id = 45)) THEN 83",{"$f":"--DSメール納品 郵件交貨","v":{"$error":"#NAME?"}}]
[]
[{"$nulls":5},"WHEN ((@sales_type = 3) AND (@new_status_id = 41) AND (@contract_type = 'LPNEW')) THEN 50",{"$f":"--LP受注 + 銀行入金待(新規購入)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 3) AND (@sales_collect = 1) AND (@new_status_id = 42) AND (@contract_type = 'LPNEW')) THEN 51",{"$f":"--LP受注 + 銀行入金濟(新規購入)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 3) AND (@sales_collect = 3) AND (@new_status_id = 44) AND (@contract_type = 'LPNEW')) THEN 52",{"$f":"--LP受注 + 信用卡處理濟(新規購入)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 3) AND (@new_status_id = 41) AND (@contract_type = 'LPADD')) THEN 61",{"$f":"--LP受注 + 銀行入金待(追加購入)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 3) AND (@sales_collect = 1) AND (@new_status_id = 42) AND (@contract_type = 'LPADD')) THEN 66",{"$f":"--LP受注 + 銀行入金濟(追加購入)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 3) AND (@sales_collect = 3) AND (@new_status_id = 44) AND (@contract_type = 'LPADD')) THEN 67",{"$f":"--LP受注 + 信用卡處理濟(追加購入)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"--WHEN ((@sales_type = 3) AND (@new_status_id = 39)) THEN 53",{"$f":"--LP受注 + 出荷 (系統不直接寄信給顧客,由華康人工寄信)","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"WHEN ((@sales_type = 3) AND (@new_status_id = 29)) THEN 54",{"$f":"--LP受注 + 取消訂單","v":{"$error":"#NAME?"}}]
[{"$nulls":5},"ELSE 0"]
[{"$nulls":5},"END;"]
[]
[null,null,null,"SET @succ = 'Y';"]
[]
[null,null,null,"COMMIT TRANSACTION;"]
[]
[null,null,"END;"]

{"sheet":"DB Trigger","index":4,"n_rows":10,"n_cols":4,"rows_kept":10,"cut":false,"hidden":false,"merged":[]}
["目的：當下列資料表的資料異動時寫一筆log"]
["Trigger","tablename","table desc"]
[null,"contract","契約基本情報"]
[null,"contract_list","契約明細ログ"]
[null,"customer","顧客情報"]
[null,"ec_cart_list","購物車名細"]
[null,"license",null,"DataType:EC受注(status),DynaSmart受注(status),ライセンス受注(status)"]
[null,"person","顧客連絡人情報"]
[null,"sales","銷售記錄"]
[null,"ship","送貨記錄"]

{"sheet":"Function","index":5,"n_rows":15,"n_cols":6,"rows_kept":15,"cut":false,"hidden":false,"merged":[]}
[null,"File Name","Function Name","Input","Output","Desc"]
["app_code","dboperator.cs","Get_oid_log_List"]
[null,null,"Get_oid_log_Count"]
[null,null,"GetOidDatatype"]
[null,null,"GetOidAction"]
[null,null,"GetOidname"]
[null,null,"Get_Oid_Logexport_List"]
["Form","Oid_logexport.aspx.cs",null,null,null,"匯出log"]
["Form","Oid_log.cs",null,null,null,"顯示log"]
["app_code","dbcontract.cs",null,null,null,"記錄log-契約基本情報、契約明細ログ"]
["app_code","dbcustomer.cs",null,null,null,"記錄log-顧客情報、顧客連絡人情報"]
["app_code","dblicense.cs",null,null,null,"記錄log"]
["app_code","dbsales.cs",null,null,null,"記錄log-銷售記錄"]
["app_code","dbcustomer.cs","InsertOidLog",null,null,"CSVダウンロード Log"]
["app_code","dbcustomer.cs","InsertModifyOidLog",null,null,"Normal Modify Log\n目前僅有change_customer_password.aspx.cs使用"]

{"sheet":"後台介面","index":6,"n_rows":0,"n_cols":0,"rows_kept":0,"cut":false,"hidden":false,"merged":[]}

{"sheet":"ZH修改記錄","index":7,"n_rows":11,"n_cols":2,"rows_kept":11,"cut":false,"hidden":false,"merged":[]}
["FilePath","Operation Path"]
["/backend/customer/customerlist.aspx","客戶管理/客戶資料/CSV下載"]
["/backend/dynasmart/dynasmartlist.aspx","年度授權產品契約管理/契約資料年度授權產品契約管理"]
["/backend/dynasmartsales/dynasmartsaleslist.aspx","訂單管理/年度授權訂單資料/CSV下載"]
["/backend/licensecontract/licensecontractlist.aspx","盒裝授權訂單管理/契約資料/CSV下載"]
["dynasmartsaleslist","已設無效"]
["questionnaireexport.aspx","產品註冊管理/客戶問卷/CSV下載"]
["/backend/sales/saleslist.aspx","訂單管理/EC訂單資料/CSV下載"]
["app_code\\backend\\backend_dbcontract.cs","update"]
["app_code\\backend\\backend_dbcustomer.cs","update"]
["app_code\\backend\\backend_dbsales.cs","update"]

{"sheet":"Notice","index":8,"n_rows":2,"n_cols":2,"rows_kept":2,"cut":false,"hidden":false,"merged":[[0,1,0,8]]}
["No","Remark"]
[1,"[Update_DS] Update sales 表時，sales_total與其他欄位會分開下update語法"]