예제 #1
0
 //列印
 private void tsbPrint_Click(object sender, EventArgs e)
 {
     if (CheckField())
     {
         SIS.DBClass.DBClassTakeStockMaster DBCTSM = new DBClass.DBClassTakeStockMaster();
         bool result = DBCTSM.QueryData(txtTakeStockID.Text);
         if (result)
         {
             FrmReportPrint FRP = new FrmReportPrint("TakeStockID", txtTakeStockID.Text, "rptTakeStockMaster");
             FRP.ShowDialog();
         }
         else
         {
             MessageBox.Show("沒有找到盤點單號:[" + txtTakeStockID.Text + "]資料,無法列印!", "列印結果");
         }
     }
 }
예제 #2
0
        //查詢
        private void tsbQuery_Click(object sender, EventArgs e)
        {
            string Msg = "是否要進行盤點單[" + txtTakeStockID.Text + "]查詢動作?\r\n";


            DialogResult DR;

            DR = MessageBox.Show(Msg, "查詢盤點單", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (DR == DialogResult.Yes)
            {
                if (CheckField())
                {
                    SIS.DBClass.DBClassTakeStockMaster   DBCTSM = new DBClass.DBClassTakeStockMaster();
                    SIS.Configuration.ClsTakeStockConfig CTSC   = new Configuration.ClsTakeStockConfig();

                    bool result = DBCTSM.QueryData(txtTakeStockID.Text, CTSC);
                    if (result)
                    {
                        MessageBox.Show("有找到盤點單號:[" + txtTakeStockID.Text + "]資料!\r\n是否將盤點單資料載入?", "搜尋結果", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        if (DR == DialogResult.Yes)
                        {
                            //要從最後面資料列開始往上移除才能正確執行
                            for (int i = dgvTakeStockItemsInfo.Rows.Count - 1; i >= 0; i--)
                            {
                                dgvTakeStockItemsInfo.Rows.RemoveAt(i);
                                //System.Threading.Thread.Sleep(10);
                            }

                            txtTakeStockID.Text    = CTSC.TakeStockID;
                            dtpTakeStockDate.Text  = CTSC.TakeStockDate;
                            cboTakeStockStaff.Text = CTSC.TakeStockStaff;
                            rtbNotes.Text          = CTSC.Notes;

                            for (int i = 0; i < CTSC.TakeStockItems.Length; i++)
                            {
                                var index = dgvTakeStockItemsInfo.Rows.Add();
                                dgvTakeStockItemsInfo.Rows[index].Cells["ItemsID"].Value            = CTSC.TakeStockItems[i].ItemsID;
                                dgvTakeStockItemsInfo.Rows[index].Cells["NAME"].Value               = CTSC.TakeStockItems[i].NAME;
                                dgvTakeStockItemsInfo.Rows[index].Cells["Inventory"].Value          = CTSC.TakeStockItems[i].Inventory.ToString();
                                dgvTakeStockItemsInfo.Rows[index].Cells["TakeStockInventory"].Value = CTSC.TakeStockItems[i].TakeStockInventory.ToString();
                                dgvTakeStockItemsInfo.Rows[index].Cells["GainLossInventory"].Value  = CTSC.TakeStockItems[i].GainLossInventory.ToString();
                                dgvTakeStockItemsInfo.Rows[index].Cells["IsTakeStock"].Value        = CTSC.TakeStockItems[i].IsTakeStock; //Boolean
                                dgvTakeStockItemsInfo.Rows[index].Cells["ItemsUnit"].Value          = CTSC.TakeStockItems[i].ItemsUnit;
                                dgvTakeStockItemsInfo.Rows[index].Cells["Price"].Value              = CTSC.TakeStockItems[i].Price.ToString();
                                dgvTakeStockItemsInfo.Rows[index].Cells["Totals"].Value             = CTSC.TakeStockItems[i].Totals.ToString();
                                dgvTakeStockItemsInfo.Rows[index].Cells["Notes"].Value              = CTSC.TakeStockItems[i].Notes;
                            }

                            tsslDataCount.Text = dgvTakeStockItemsInfo.Rows.Count.ToString();
                        }
                    }
                    else
                    {
                        MessageBox.Show("沒有找到盤點單號:[" + txtTakeStockID.Text + "]資料!", "搜尋結果");
                    }
                }
            }
            else
            {
                MessageBox.Show("取消盤點單查詢動作!!", "查詢盤點單");
            }
        }