private void insertTo退貨記錄(string p_str請購單號, string p_str產品編號, int p_int退貨數量) { CKGPartOrderFactory l_factory請購主檔 = _context.CFactoryManager.CKGPartOrderFactory; CKGPartOrder l_code請購主檔 = l_factory請購主檔.getKGPartOrderBy請購單號(p_str請購單號); CKGPartOrderDetailFactory l_factory請購明細 = _context.CFactoryManager.CKGPartOrderDetailFactory; CKGPartOrderDetail l_code請購明細 = l_factory請購明細.get請購單內的單一產品明細(p_str請購單號, p_str產品編號); CKGPartOrderDetailOutFactory l_factroy退貨記錄 = _context.CFactoryManager.CKGPartOrderDetailOutFactory; CKGPartOrderDetailOut l_code退貨記錄 = l_factroy退貨記錄.createCKGPartOrderDetailOut(); CUser l_user = Session[SealedGlobalPage.SESSIONKEY_LOGIN_USER_DATA] as CUser; l_code退貨記錄.f_ExchangeID請購單號 = p_str請購單號; l_code退貨記錄.f_SalesSmid業代員編 = l_code請購主檔.f_SalesSmid業代員編; l_code退貨記錄.f_SalesBranch業代單位 = l_user.f_branchid所別; l_code退貨記錄.f_AssistantSmid退貨助理員編 = l_user.f_userid帳號; //"F9446";// l_code退貨記錄.f_ProductID產品編號 = l_code請購明細.f_ProductID產品編號; l_code退貨記錄.f_ProductName產品名稱 = l_code請購明細.f_ProductName產品名稱; l_code退貨記錄.f_OutAmount退貨數量 = p_int退貨數量; l_code退貨記錄.f_OutDate退貨日期 = DateTime.Today.ToString("yyyy/MM/dd"); l_code退貨記錄.f_Qty產品單位 = l_code請購明細.f_Qty產品單位; l_code退貨記錄.f_Cost產品成本 = l_code請購明細.f_Cost產品成本價; l_code退貨記錄.f_UnitPrice產品單價 = l_code請購明細.f_UnitPrice產品單價; l_code退貨記錄.f_ListPrice建議售價 = l_code請購明細.f_ListPrice建議售價; l_code退貨記錄.f_OutTotal總計退貨價格 = l_code請購明細.f_UnitPrice產品單價 * p_int退貨數量; l_code退貨記錄.f_OutReasons退貨原因 = iv_txt退貨原因.Text.Replace("'", ""); l_code退貨記錄.f_Check管理者確認退貨 = "False"; l_code退貨記錄.f_EditDate編輯日期 = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); l_factroy退貨記錄.insertCKGPartOrderDetailOut(l_code退貨記錄); }
private string get列印領料單Html(string p_strEID) { string l_str助理員編 = (Session[SealedGlobalPage.SESSIONKEY_LOGIN_USER_DATA] as CUser).f_userid帳號;//"H9503";// CKGPartOrderFactory l_factory主檔 = _context.CFactoryManager.CKGPartOrderFactory; CKGPartOrder l_code主檔 = l_factory主檔.getKGPartOrderBy請購單號(p_strEID, l_str助理員編); if (l_code主檔 != null) { l_code主檔.明細 = _context.CFactoryManager.CKGPartOrderDetailFactory.get請購明細ByExchangeID(p_strEID); int l_intcount = (l_code主檔.明細.Length / 10); //一頁10筆,總列印頁整數數 if (l_code主檔.明細.Length % 10 != 0) //最後一頁未滿10筆的,要再加1頁 { l_intcount++; } return(組HTML(l_code主檔, l_intcount)); } else { return("<font size=\"5\"><b>查無資料!!</b>"); } }
protected void iv_btn查詢請購單號_Click(object sender, EventArgs e) { CUser l_user = Session[SealedGlobalPage.SESSIONKEY_LOGIN_USER_DATA] as CUser; string l_str助理Smid = l_user.f_userid帳號;//"H9503";// string l_str請購單號 = _txt請購編號.Text.Trim(); string l_str起始日期 = _txtBDate.Text.Trim(); string l_str結束日期 = _txtEDate.Text.Trim(); string l_str廠商 = _cbo廠商.SelectedValue; CKGPartOrderFactory l_factory = _context.CFactoryManager.CKGPartOrderFactory; CKGPartOrder[] l_codes = l_factory.getKGPartOrderBy請購單號(l_str請購單號, l_str助理Smid, l_str廠商, l_str起始日期, l_str結束日期); display(l_codes); }
private void 自動發信() { get請購清單(); if (_CKGPartOrder == null) { return; } if (_CKGPartOrder.Length <= 0) { return; } for (int i = 0; i < _CKGPartOrder.Length; i++) { string l_str請購所別 = dataGridView1.Rows[i].Cells["請購所別"].Value.ToString(); string l_str對象廠商 = dataGridView1.Rows[i].Cells["對象廠商"].Value.ToString(); CKGPartOrderFactory l_factory = _context.CFactoryManager.CKGPartOrderFactory; CKGPartOrder[] l_codes = l_factory.get所別未定購的請購明細(l_str對象廠商, l_str請購所別); ArrayList l_al = new ArrayList(); for (int j = 0; j < l_codes.Length; j++) { //CUser l_user = _context.CFactoryManager.CUserFactory.get高都員工檔(l_codes[j].f_SalesSmid業代員編); //l_codes[j].f_SalesName業代姓名 = l_user.f_username姓名; //string l_str顯示字串 = l_codes[i].f_ExchangeID請購單號 + " " + l_codes[i].f_Branchid請購單位 + " " + l_codes[i].f_SalesName業代姓名; //iv_lbx請購單號.Items.Add(new ListItem(l_str顯示字串, l_codes[i].f_ExchangeID請購單號)); l_al.Add(l_codes[j].f_ExchangeID請購單號); } CKGPartOrder[] l_code選擇 = new CKGPartOrder[l_al.Count]; for (int k = 0; k < l_code選擇.Length; k++) { //try //{ l_code選擇[k] = l_factory.getKGPartOrderBy請購單號((string)l_al[k]); 確認訂購並發送Email(l_code選擇[k]); _txtLog.Text += l_code選擇[k].f_ExchangeID請購單號 + "發送完成!" + DateTime.Now + "\r\n"; //} //catch { _txtLog.Text += l_code選擇[k].f_ExchangeID請購單號 + "發送失敗!" + DateTime.Now + "\r\n"; } } } }
private void 送出訂購單(ArrayList p_al) { string l_Msg = ""; CKGPartOrder[] l_code選擇 = new CKGPartOrder[p_al.Count]; CKGPartOrderFactory l_factory = _context.CFactoryManager.CKGPartOrderFactory; for (int i = 0; i < l_code選擇.Length; i++) { try { l_code選擇[i] = l_factory.getKGPartOrderBy請購單號((string)p_al[i]); 確認訂購並發送Email(l_code選擇[i]); } catch { l_Msg = "alert('訂購作業失敗,訂購單號為: " + l_code選擇[i].f_ExchangeID請購單號 + ",訂購郵件發送失敗!"; ScriptManager.RegisterClientScriptBlock(UpdatePanel1, typeof(UpdatePanel), "OK", l_Msg, true); } } l_Msg = "alert('訂購作業完成,訂購郵件發送成功');"; ScriptManager.RegisterClientScriptBlock(UpdatePanel1, typeof(UpdatePanel), "OK", l_Msg, true); //寫入KGPartInMoney(l_code選擇); }