public POPickupPartForm() { InitializeComponent(); pnlContent.BackColor = Color.FromArgb(42, 73, 93); //深藍底 panel1.BackColor = Color.FromArgb(250, 236, 209); //淺黃底 btnSearch.BackColor = Color.FromArgb(242, 213, 143); // 按鈕深黃色 this.lblPODCount.Text = PurchasingOrderUtil.GetPurchasingOrderDetailStatus(); }
void Init() { this.lblPODCount.Text = PurchasingOrderUtil.GetPurchasingOrderDetailStatus(); decimal total = 0.0M; SourceListDao slDao = new SourceListDao(); List <Model.PurchasingOrderDetail> pods = PurchasingOrderUtil.GetPurchasingOrderDetail(); var q = from s in pods select s.SourceListOID; DataTable dt = new DataTable(); object resultObj = null; if (!(pods == null || pods.Count == 0)) { dt = slDao.FineSourceListForPOAddMain(q.ToList()); dt.PrimaryKey = new DataColumn[] { dt.Columns["SourceListOID"] }; var qs = from pod in pods select new { 料件編號 = GetDTValue(dt, "料件編號", pod.SourceListOID), 料件品名 = GetDTValue(dt, "料件品名", pod.SourceListOID), 供應商名稱 = GetDTValue(dt, "供應商名稱", pod.SourceListOID), 批量 = GetDTValue(dt, "批量", pod.SourceListOID), 批量單價 = $"{Convert.ToDecimal(GetDTValue(dt, "批量單價", pod.SourceListOID)):#.#}", 採購數量 = $"{pod.Qty:#.#}", 小計 = (Convert.ToDecimal(GetDTValue(dt, "批量單價", pod.SourceListOID)) * pod.Qty).ToString("#.#"), pod.SourceListOID }; var result = qs.ToList(); foreach (var item in result) { total += Convert.ToDecimal(item.小計); } resultObj = result; } this.lblTotal.Text = $"採購單金額總計:{total:0.#}"; this.dataGridView1.Columns.Clear(); if (resultObj != null) { this.DataGridViewAddButton(); } this.POD.DataSource = resultObj; this.dataGridView1.DataSource = this.POD; if (resultObj != null) { this.dataGridView1.Columns[this.dataGridView1.GetColumnIndex("SourceListOID")].Visible = false; } this.btnSendPO.Enabled = !(PurchasingOrderUtil.GetPurchasingOrderDetailCount() == 0); }
private void btnAddToPO_Click(object sender, EventArgs e) { int qty = 0; if (!int.TryParse(txtQty.Text.Trim(), out qty)) { MessageBox.Show("請輸入正確數字"); return; } switch (this.CmdMode) { case CommandMode.Add: PurchasingOrderDetail pod = new PurchasingOrderDetail() { SourceListOID = Convert.ToInt32(this.cbSourceList.SelectedValue), Qty = qty }; PurchasingOrderUtil.SetPurchasingOrderDetail(pod); this.lblPODCount.Text = PurchasingOrderUtil.GetPurchasingOrderDetailStatus(); break; case CommandMode.Edit: PurchasingOrderDetail updatePod = PurchasingOrderUtil.GetPurchasingOrderDetail()[this.ListIndex]; updatePod.SourceListOID = Convert.ToInt32(this.cbSourceList.SelectedValue); updatePod.Qty = qty; Common.ContainerForm.NextForm(new POAddMainForm()); break; case CommandMode.OrderEdit: Model.SourceList sl = this.sourceLists.Find(s => s.SourceListOID.Equals(Convert.ToInt32(this.cbSourceList.SelectedValue))); this.SourceOrderListData.Batch = sl.Batch; this.SourceOrderListData.Discount = sl.Discount; this.SourceOrderListData.Qty = Convert.ToInt32(this.txtQty.Text); SourceOrderListDao dao = new SourceOrderListDao(); dao.Update(this.SourceOrderListData); CheckOrderForm cof = new CheckOrderForm(this.SourceOrderListData.GetOrderPart().OrderID, "edit"); Common.ContainerForm.NextForm(cof); break; default: break; } }
/// <summary> /// 新增採購單的起始內容 /// </summary> void POInit() { this.SetShowData(this.PartNumber); this.lblPODCount.Text = PurchasingOrderUtil.GetPurchasingOrderDetailStatus(); }