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 void get請購清單() { CKGPartOrderFactory l_factory = _context.CFactoryManager.CKGPartOrderFactory; _CKGPartOrder = l_factory.getGroupBy未訂購所別筆數("", ""); display請購單(_CKGPartOrder); }
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) { string l_str所別 = iv_cbo營業所別.SelectedValue; string l_str廠商 = iv_cbo廠商.SelectedValue; string l_str起始日期 = _txtBDate.Text.Trim(); string l_str結束日期 = _txtEDate.Text.Trim(); CKGPartOrderFactory l_factory主檔 = _context.CFactoryManager.CKGPartOrderFactory; CKGPartOrder[] l_codes主檔 = l_factory主檔.get各所日報的請購總金額(l_str所別, l_str廠商, l_str起始日期, l_str結束日期); dispaly各所Total(l_codes主檔); }
protected void iv_btn請購明細_Click(object sender, EventArgs e) { iv_lbx請購單號.Items.Clear(); iv_lbx要訂購的請購單號.Items.Clear(); iv_lblTitle請購單號.Text = ""; string l_str請購所別 = get請購所別(sender); string l_str對象廠商 = get對象廠商(sender); CKGPartOrderFactory l_factory = _context.CFactoryManager.CKGPartOrderFactory; CKGPartOrder[] l_codes = l_factory.get所別未定購的請購明細(l_str對象廠商, l_str請購所別); add請購單號到ListBox(l_codes); }
private void get請購清單() { string l_str廠商 = iv_cbo廠商.SelectedValue; string l_str所別 = iv_cbo請購所別.SelectedValue; if ("".Equals(l_str廠商)) { return; } CKGPartOrderFactory l_factory = _context.CFactoryManager.CKGPartOrderFactory; CKGPartOrder[] l_codes = l_factory.getGroupBy未訂購所別筆數(l_str廠商, l_str所別); display請購單(l_codes); }
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"; } } } }
protected void iv_btn查詢_Click(object sender, EventArgs e) { CUser l_user = (Session[SealedGlobalPage.SESSIONKEY_LOGIN_USER_DATA] as CUser); string l_str業代員編 = iv_txt業代員編.Text.Trim().ToUpper(); string l_str請購單號 = iv_txt請購單號.Text.Trim().ToUpper(); string l_str起始日期 = _txtBDate.Text.Trim(); string l_str結束日期 = _txtEDate.Text.Trim(); string l_str助理員編 = l_user.f_userid帳號;//"F9446";// CKGPartOrderFactory l_factory = _context.CFactoryManager.CKGPartOrderFactory; CKGPartOrder[] l_codes = l_factory.getAll請購單號By條件(l_str助理員編, l_str業代員編, l_str請購單號, "", l_str起始日期, l_str結束日期); if (l_codes == null) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, typeof(UpdatePanel), "OK", "alert('查無資料');", true); //iv_pnl退貨畫面.Visible = false; return; } display請購記錄(l_codes); }
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選擇); }
private void 送出請購清單() { DataTable l_dt = (DataTable)Session[SealedGlobalPage.SESSIONKEY_KGPARTORDER_TEMPTABLE]; if (l_dt.Rows.Count == 0) { string l_str = "alert('清單內無任何資料,請加入請購產品至清單內');"; ScriptManager.RegisterClientScriptBlock(UpdatePanel1, typeof(UpdatePanel), "OK", l_str, true); return; } else { CKGPartOrderFactory l_factory主檔 = _context.CFactoryManager.CKGPartOrderFactory; CKGPartOrder l_code主檔 = l_factory主檔.createCKGPartOrder(); string l_str請購單號 = ""; CUser l_User = (Session[SealedGlobalPage.SESSIONKEY_LOGIN_USER_DATA] as CUser); l_str請購單號 = CTools.get訂單號碼(l_User.f_branchid所別); l_code主檔.f_ExchangeID請購單號 = l_str請購單號; l_code主檔.f_EngineNo引擎號碼 = iv_txt引擎號碼.Text.Trim(); l_code主檔.f_Vendor請購廠商 = _rbl廠商.SelectedValue; l_code主檔.f_AssistantSmid助理員編 = l_User.f_userid帳號;//"F9446";// l_code主檔.f_AssistantBranchid助理單位編號 = l_User.f_branchid所別; l_code主檔.f_TotalPrice總計價格 = Convert.ToInt32(_lblTotal.Text); l_code主檔.f_SalesSmid業代員編 = _lblSmid.Text; l_code主檔.f_TotalSale總販賣價 = Convert.ToInt32(_lblSaleTotal.Text); l_code主檔.f_IsSend是否發送 = "False"; l_code主檔.f_Memo備註說明 = _txt備註.Text.Replace("'", ""); l_code主檔.f_InsertDate請購日期 = DateTime.Now.ToString("yyyy/MM/dd"); l_code主檔.f_InsertIP輸入電腦IP = Request.UserHostAddress; l_code主檔.f_EditDate編輯日期 = DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss"); CKGPartOrderDetailFactory l_factory = _context.CFactoryManager.CKGPartOrderDetailFactory; CKGPartOrderDetail[] l_codes明細 = new CKGPartOrderDetail[l_dt.Rows.Count]; int l_int主檔總計成本 = 0; for (int i = 0; i < l_dt.Rows.Count; i++) { l_codes明細[i] = l_factory.createCKGPartOrderDetail(); l_codes明細[i].f_ExchangeID請購單號 = l_str請購單號; l_codes明細[i].f_ProductID產品編號 = l_dt.Rows[i]["產品編號"].ToString(); l_codes明細[i].f_ProductName產品名稱 = l_dt.Rows[i]["產品名稱"].ToString(); l_codes明細[i].f_Amount選購數量 = Convert.ToInt32(l_dt.Rows[i]["數量"].ToString()); l_codes明細[i].f_Qty產品單位 = l_dt.Rows[i]["單位"].ToString(); l_codes明細[i].f_Cost產品成本價 = Convert.ToInt32(l_dt.Rows[i]["成本"].ToString()); l_codes明細[i].f_UnitPrice產品單價 = Convert.ToInt32(l_dt.Rows[i]["業代價"].ToString()); l_codes明細[i].f_SalePrice販賣價 = Convert.ToInt32(l_dt.Rows[i]["販賣價"].ToString()); l_codes明細[i].f_ListPrice建議售價 = Convert.ToInt32(l_dt.Rows[i]["建議售價"].ToString()); CUser l_user = Session[SealedGlobalPage.SESSIONKEY_LOGIN_USER_DATA] as CUser; if (l_user == null) { Session.Remove(SealedGlobalPage.SESSIONKEY_LOGIN_USER_DATA); Response.Redirect("../FrmLogin.aspx"); } if (l_user.f_lvl等級 == 4) { l_codes明細[i].f_Total總計價格 = Convert.ToInt32(l_dt.Rows[i]["總販賣"].ToString()); } else { l_codes明細[i].f_Total總計價格 = Convert.ToInt32(l_dt.Rows[i]["總計"].ToString()); } l_codes明細[i].f_EditDate編輯日期 = l_code主檔.f_EditDate編輯日期; l_int主檔總計成本 += (l_codes明細[i].f_Cost產品成本價 * l_codes明細[i].f_Amount選購數量); } l_code主檔.f_TotalCost總成本價 = l_int主檔總計成本; l_code主檔.明細 = l_codes明細; string l_str = "alert('選購作業完成,請購單號為: " + l_str請購單號 + "');"; ScriptManager.RegisterClientScriptBlock(UpdatePanel1, typeof(UpdatePanel), "OK", l_str, true); l_factory主檔.insertCKGPartOrder(l_code主檔); 新增應收帳款(l_code主檔); 初始化(); } }