コード例 #1
0
ファイル: FrmSISStock.cs プロジェクト: cyrsis/RetailsPOS
        private void RunDeleteData(SIS.Configuration.Items[] OldItems)
        {
            try
            {
                My.MyDatabase MyDb = new My.MyDatabase();
                SIS.Configuration.ClsStockConfig CSC = new Configuration.ClsStockConfig();
                CSC.StockID = txtStockID.Text;

                SIS.DBClass.DBClassStockMaster DBCSM = new DBClass.DBClassStockMaster();

                if (MyDb.AuthPK(CSC.StockID, "StockID", "StockMaster") == true)
                {
                    if (DBCSM.DeleteMasterDetailsData(CSC.StockID, OldItems))
                    {
                        MessageBox.Show("刪除[" + CSC.StockID +
                                        "]進貨單資料成功", "刪除進貨單資料", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        LoadDefaultValue();
                    }
                    else
                    {
                        MessageBox.Show("刪除[" + CSC.StockID +
                                        "]進貨單資料失敗", "刪除進貨單資料", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("對不起,資料庫不存在[ " + CSC.StockID +
                                    " ]進貨單資料!!(資料不存在)", "資料刪除");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("錯誤訊息:" + ex.Message.ToString(), "發生例外");
            }
        }
コード例 #2
0
ファイル: FrmSISStock.cs プロジェクト: cyrsis/RetailsPOS
        private void RunUpdateData(SIS.Configuration.Items[] OldItems)
        {
            try
            {
                My.MyDatabase MyDb = new My.MyDatabase();
                SIS.Configuration.ClsStockConfig CSC = new Configuration.ClsStockConfig();
                CSC.StockID                 = txtStockID.Text;
                CSC.StockDate               = dtpStockDate.Value.ToString("yyyy年MM月dd日");
                CSC.TotalPreTax             = int.Parse(txtTotalPreTax.Text);
                CSC.Tax                     = int.Parse(txtTax.Text);
                CSC.TotalAfterTax           = int.Parse(txtTotalAfterTax.Text);
                CSC.ManufacturerID          = cboManufacturer.Text.Substring(0, cboManufacturer.Text.IndexOf("-"));
                CSC.BusinessTaxStockTaxRate = int.Parse(txtBusinessTaxStockTaxRate.Text);
                CSC.AmountPaid              = int.Parse(mtbAmountPaid.Text);
                CSC.UnpaidAmount            = int.Parse(txtUnpaidAmount.Text);
                CSC.StockStaff              = cboStockStaff.Text;
                CSC.PaymentType             = cboPaymentType.Text.Split('-')[1];
                CSC.Notes                   = rtbNotes.Text.Replace("'", "''");
                CSC.StockItems              = getItemsValueFromDataGridView(dgvStockDetails);

                SIS.DBClass.DBClassStockMaster DBCSM = new DBClass.DBClassStockMaster();

                if (MyDb.AuthPK(CSC.StockID, "StockID", "StockMaster") == true)
                {
                    if (DBCSM.Update(CSC, OldItems))
                    {
                        MessageBox.Show("更新[" + CSC.StockID +
                                        "]進貨單資料成功", "更新進貨單資料", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        LoadDefaultValue();
                    }
                    else
                    {
                        MessageBox.Show("更新[" + CSC.StockID +
                                        "]進貨單資料失敗", "更新進貨單資料", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("對不起,資料庫不存在[ " + CSC.StockID +
                                    " ]進貨單資料!!(資料不存在)", "資料更新");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("錯誤訊息:" + ex.Message.ToString(), "發生例外");
            }
        }
コード例 #3
0
ファイル: FrmSISStock.cs プロジェクト: cyrsis/RetailsPOS
 //列印
 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 + "]資料,無法列印!", "列印結果");
         }
     }
 }
コード例 #4
0
ファイル: FrmSISStock.cs プロジェクト: cyrsis/RetailsPOS
        //查詢
        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("取消進貨單查詢動作!!", "查詢進貨單");
            }
        }
コード例 #5
0
ファイル: FrmSISRMA.cs プロジェクト: yanhsiGit/ERP
        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 + "]資料!", "搜尋結果");
                    }
                }
            }
        }