//列印 private void tsbPrint_Click(object sender, EventArgs e) { if (CheckField()) { SIS.DBClass.DBClassShipMaster DBCSM = new DBClass.DBClassShipMaster(); bool result = DBCSM.QueryData(txtShipID.Text); if (result) { FrmReportPrint FRP = new FrmReportPrint("ShipID", txtShipID.Text, "rptShipMaster"); FRP.ShowDialog(); } else { MessageBox.Show("沒有找到出貨單號:[" + txtShipID.Text + "]資料,無法列印!", "列印結果"); } } }
//查詢 private void tsbQuery_Click(object sender, EventArgs e) { string Msg = "是否要進行出貨單[" + txtShipID.Text + "]查詢動作?\r\n"; DialogResult DR; DR = MessageBox.Show(Msg, "查詢進貨單", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (DR == DialogResult.Yes) { if (CheckField()) { SIS.DBClass.DBClassShipMaster DBCSM = new DBClass.DBClassShipMaster(); SIS.Configuration.ClsShipConfig CSC = new Configuration.ClsShipConfig(); bool result = DBCSM.QueryData(txtShipID.Text, CSC); if (result) { MessageBox.Show("有找到出貨單號:[" + txtShipID.Text + "]資料!\r\n是否將出貨單資料載入?", "搜尋結果", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DR == DialogResult.Yes) { txtShipID.Text = CSC.ShipID; dtpShipDate.Text = CSC.ShipDate; txtTotalPreTax.Text = CSC.TotalPreTax.ToString(); txtTax.Text = CSC.Tax.ToString(); txtTotalAfterTax.Text = CSC.TotalAfterTax.ToString(); cboCustomer.Text = My.MyMethod.SearchComboBoxItems(cboCustomer, CSC.CustomerID); txtBusinessTaxShipTaxRate.Text = CSC.BusinessTaxShipTaxRate.ToString(); mtbAmountPaid.Text = CSC.AmountPaid.ToString(); txtUnpaidAmount.Text = CSC.UnpaidAmount.ToString(); cboShipStaff.Text = CSC.ShipStaff; cboPaymentType.Text = My.MyMethod.SearchComboBoxItems(cboPaymentType, CSC.PaymentType); rtbNotes.Text = CSC.Notes; if (dgvShipDetails.Rows.Count > 1) { btnRemoveItems_Click(sender, e); } for (int i = 0; i < CSC.ShipItems.Length; i++) { var index = dgvShipDetails.Rows.Add(); dgvShipDetails.Rows[index].Cells["ItemsID"].Value = CSC.ShipItems[i].ItemsID; dgvShipDetails.Rows[index].Cells["NAME"].Value = CSC.ShipItems[i].NAME; dgvShipDetails.Rows[index].Cells["Quantity"].Value = CSC.ShipItems[i].Quantity.ToString(); dgvShipDetails.Rows[index].Cells["ItemsUnit"].Value = CSC.ShipItems[i].ItemsUnit; dgvShipDetails.Rows[index].Cells["SellingPrice"].Value = CSC.ShipItems[i].Price.ToString(); dgvShipDetails.Rows[index].Cells["Totals"].Value = CSC.ShipItems[i].Totals.ToString(); dgvShipDetails.Rows[index].Cells["Notes"].Value = CSC.ShipItems[i].Notes; } getTaxTotals(); } } else { MessageBox.Show("沒有找到進貨單號:[" + txtShipID.Text + "]資料!", "搜尋結果"); } } } else { MessageBox.Show("取消進貨單查詢動作!!", "查詢進貨單"); } }
private void btnLoadItems_Click(object sender, EventArgs e) { if (CheckField()) { if (rdoRMAShip.Checked == true) { SIS.DBClass.DBClassShipMaster DBCSM = new DBClass.DBClassShipMaster(); SIS.Configuration.ClsShipConfig CSC = new Configuration.ClsShipConfig(); bool result = DBCSM.QueryData(txtStockIDOrShipID.Text, CSC); mtbAmountPaid.Text = CSC.AmountPaid.ToString(); txtUnpaidAmount.Text = CSC.UnpaidAmount.ToString(); txtBusinessTax.Text = CSC.BusinessTaxShipTaxRate.ToString(); mtbRMAAmount.Text = mtbAmountPaid.Text; if (result) { DialogResult DR; DR = MessageBox.Show("有找到出貨單號:[" + txtStockIDOrShipID.Text + "]資料!\r\n是否將出貨單資料載入?", "搜尋結果", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DR == DialogResult.Yes) { if (dgvRMADetails.Rows.Count > 1) { //要從最後面資料列開始往上移除才能正確執行 for (int i = dgvRMADetails.Rows.Count - 1; i >= 0; i--) { dgvRMADetails.Rows.RemoveAt(i); System.Threading.Thread.Sleep(100); } } for (int i = 0; i < CSC.ShipItems.Length; i++) { var index = dgvRMADetails.Rows.Add(); dgvRMADetails.Rows[index].Cells["ItemsID"].Value = CSC.ShipItems[i].ItemsID; dgvRMADetails.Rows[index].Cells["NAME"].Value = CSC.ShipItems[i].NAME; dgvRMADetails.Rows[index].Cells["Quantity"].Value = CSC.ShipItems[i].Quantity.ToString(); dgvRMADetails.Rows[index].Cells["RMAQuantity"].Value = CSC.ShipItems[i].Quantity.ToString(); dgvRMADetails.Rows[index].Cells["ItemsUnit"].Value = CSC.ShipItems[i].ItemsUnit; dgvRMADetails.Rows[index].Cells["Price"].Value = CSC.ShipItems[i].Price.ToString(); dgvRMADetails.Rows[index].Cells["Totals"].Value = CSC.ShipItems[i].Totals.ToString(); dgvRMADetails.Rows[index].Cells["Notes"].Value = CSC.ShipItems[i].Notes; } getTaxTotals(); } } else { MessageBox.Show("沒有找到出貨單號:[" + txtStockIDOrShipID.Text + "]資料!", "搜尋結果"); } } else // if (rdoRMAShip.Checked ==false) { SIS.DBClass.DBClassStockMaster DBCSM = new DBClass.DBClassStockMaster(); SIS.Configuration.ClsStockConfig CSC = new Configuration.ClsStockConfig(); bool result = DBCSM.QueryData(txtStockIDOrShipID.Text, CSC); mtbAmountPaid.Text = CSC.AmountPaid.ToString(); txtUnpaidAmount.Text = CSC.UnpaidAmount.ToString(); txtBusinessTax.Text = CSC.BusinessTaxStockTaxRate.ToString(); if (result) { DialogResult DR; DR = MessageBox.Show("有找到進貨單號:[" + txtStockIDOrShipID.Text + "]資料!\r\n是否將進貨單資料載入?", "搜尋結果", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (DR == DialogResult.Yes) { if (dgvRMADetails.Rows.Count > 1) { //要從最後面資料列開始往上移除才能正確執行 for (int i = dgvRMADetails.Rows.Count - 1; i >= 0; i--) { dgvRMADetails.Rows.RemoveAt(i); System.Threading.Thread.Sleep(100); } } for (int i = 0; i < CSC.StockItems.Length; i++) { var index = dgvRMADetails.Rows.Add(); dgvRMADetails.Rows[index].Cells["ItemsID"].Value = CSC.StockItems[i].ItemsID; dgvRMADetails.Rows[index].Cells["NAME"].Value = CSC.StockItems[i].NAME; dgvRMADetails.Rows[index].Cells["Quantity"].Value = CSC.StockItems[i].Quantity.ToString(); dgvRMADetails.Rows[index].Cells["RMAQuantity"].Value = CSC.StockItems[i].Quantity.ToString(); dgvRMADetails.Rows[index].Cells["ItemsUnit"].Value = CSC.StockItems[i].ItemsUnit; dgvRMADetails.Rows[index].Cells["Price"].Value = CSC.StockItems[i].Price.ToString(); dgvRMADetails.Rows[index].Cells["Totals"].Value = CSC.StockItems[i].Totals.ToString(); dgvRMADetails.Rows[index].Cells["Notes"].Value = CSC.StockItems[i].Notes; } getTaxTotals(); } } else { MessageBox.Show("沒有找到進貨單號:[" + txtStockIDOrShipID.Text + "]資料!", "搜尋結果"); } } } }