예제 #1
0
파일: FrmSISShip.cs 프로젝트: yanhsiGit/ERP
        private void RunDeleteData(SIS.Configuration.Items[] OldItems)
        {
            try
            {
                My.MyDatabase MyDb = new My.MyDatabase();
                SIS.Configuration.ClsShipConfig CSC = new Configuration.ClsShipConfig();
                CSC.ShipID = txtShipID.Text;

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

                if (MyDb.AuthPK(CSC.ShipID, "ShipID", "ShipMaster") == true)
                {
                    if (DBCSM.DeleteMasterDetailsData(CSC.ShipID, OldItems))
                    {
                        MessageBox.Show("刪除[" + CSC.ShipID +
                                        "]出貨單資料成功", "刪除出貨單資料", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        LoadDefaultValue();
                    }
                    else
                    {
                        MessageBox.Show("刪除[" + CSC.ShipID +
                                        "]出貨單資料失敗", "刪除出貨單資料", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("對不起,資料庫不存在[ " + CSC.ShipID +
                                    " ]出貨單資料!!(資料不存在)", "資料刪除");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("錯誤訊息:" + ex.Message.ToString(), "發生例外");
            }
        }
예제 #2
0
파일: FrmSISShip.cs 프로젝트: yanhsiGit/ERP
        private void RunUpdateData(SIS.Configuration.Items[] OldItems)
        {
            try
            {
                My.MyDatabase MyDb = new My.MyDatabase();
                SIS.Configuration.ClsShipConfig CSC = new Configuration.ClsShipConfig();
                CSC.ShipID                 = txtShipID.Text;
                CSC.ShipDate               = dtpShipDate.Value.ToString("yyyy年MM月dd日");
                CSC.TotalPreTax            = int.Parse(txtTotalPreTax.Text);
                CSC.Tax                    = int.Parse(txtTax.Text);
                CSC.TotalAfterTax          = int.Parse(txtTotalAfterTax.Text);
                CSC.CustomerID             = cboCustomer.Text.Substring(0, cboCustomer.Text.IndexOf("-"));
                CSC.BusinessTaxShipTaxRate = int.Parse(txtBusinessTaxShipTaxRate.Text);
                CSC.AmountPaid             = int.Parse(mtbAmountPaid.Text);
                CSC.UnpaidAmount           = int.Parse(txtUnpaidAmount.Text);
                CSC.ShipStaff              = cboShipStaff.Text;
                CSC.PaymentType            = cboPaymentType.Text.Split('-')[1];
                CSC.Notes                  = rtbNotes.Text.Replace("'", "''");
                CSC.ShipItems              = getItemsValueFromDataGridView(dgvShipDetails);

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

                if (MyDb.AuthPK(CSC.ShipID, "ShipID", "ShipMaster") == true)
                {
                    if (DBCSM.Update(CSC, OldItems))
                    {
                        MessageBox.Show("更新[" + CSC.ShipID +
                                        "]出貨單資料成功", "更新出貨單資料", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        LoadDefaultValue();
                    }
                    else
                    {
                        MessageBox.Show("更新[" + CSC.ShipID +
                                        "]出貨單資料失敗", "更新出貨單資料", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("對不起,資料庫不存在[ " + CSC.ShipID +
                                    " ]出貨單資料!!(資料不存在)", "資料更新");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("錯誤訊息:" + ex.Message.ToString(), "發生例外");
            }
        }
예제 #3
0
파일: FrmSISShip.cs 프로젝트: yanhsiGit/ERP
 //列印
 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 + "]資料,無法列印!", "列印結果");
         }
     }
 }
예제 #4
0
파일: FrmSISShip.cs 프로젝트: yanhsiGit/ERP
        //查詢
        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("取消進貨單查詢動作!!", "查詢進貨單");
            }
        }
예제 #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 + "]資料!", "搜尋結果");
                    }
                }
            }
        }