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


            DialogResult DR;

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

            if (DR == DialogResult.Yes)
            {
                if (CheckField())
                {
                    SIS.DBClass.DBClassStockMaster   DBCSM = new DBClass.DBClassStockMaster();
                    SIS.Configuration.ClsStockConfig CSC   = new Configuration.ClsStockConfig();

                    bool result = DBCSM.QueryData(txtStockID.Text, CSC);
                    if (result)
                    {
                        MessageBox.Show("有找到進貨單號:[" + txtStockID.Text + "]資料!\r\n是否將進貨單資料載入?", "搜尋結果", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        if (DR == DialogResult.Yes)
                        {
                            txtStockID.Text                 = CSC.StockID;
                            dtpStockDate.Text               = CSC.StockDate;
                            txtTotalPreTax.Text             = CSC.TotalPreTax.ToString();
                            txtTax.Text                     = CSC.Tax.ToString();
                            txtTotalAfterTax.Text           = CSC.TotalAfterTax.ToString();
                            cboManufacturer.Text            = My.MyMethod.SearchComboBoxItems(cboManufacturer, CSC.ManufacturerID);
                            txtBusinessTaxStockTaxRate.Text = CSC.BusinessTaxStockTaxRate.ToString();
                            mtbAmountPaid.Text              = CSC.AmountPaid.ToString();
                            txtUnpaidAmount.Text            = CSC.UnpaidAmount.ToString();
                            cboStockStaff.Text              = CSC.StockStaff;
                            cboPaymentType.Text             = My.MyMethod.SearchComboBoxItems(cboPaymentType, CSC.PaymentType);
                            rtbNotes.Text                   = CSC.Notes;

                            if (dgvStockDetails.Rows.Count > 1)
                            {
                                btnRemoveItems_Click(sender, e);
                            }

                            for (int i = 0; i < CSC.StockItems.Length; i++)
                            {
                                var index = dgvStockDetails.Rows.Add();
                                dgvStockDetails.Rows[index].Cells["ItemsID"].Value   = CSC.StockItems[i].ItemsID;
                                dgvStockDetails.Rows[index].Cells["NAME"].Value      = CSC.StockItems[i].NAME;
                                dgvStockDetails.Rows[index].Cells["Quantity"].Value  = CSC.StockItems[i].Quantity.ToString();
                                dgvStockDetails.Rows[index].Cells["ItemsUnit"].Value = CSC.StockItems[i].ItemsUnit;
                                dgvStockDetails.Rows[index].Cells["CostPrice"].Value = CSC.StockItems[i].Price.ToString();
                                dgvStockDetails.Rows[index].Cells["Totals"].Value    = CSC.StockItems[i].Totals.ToString();
                                dgvStockDetails.Rows[index].Cells["Notes"].Value     = CSC.StockItems[i].Notes;
                            }
                            getTaxTotals();
                        }
                    }
                    else
                    {
                        MessageBox.Show("沒有找到進貨單號:[" + txtStockID.Text + "]資料!", "搜尋結果");
                    }
                }
            }
            else
            {
                MessageBox.Show("取消進貨單查詢動作!!", "查詢進貨單");
            }
        }
Exemple #3
0
        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 + "]資料!", "搜尋結果");
                    }
                }
            }
        }